{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "feedback",
  "title": "Feedback",
  "description": "Thumbs up and down for a response, with an optional comment written in a popover.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/react@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup",
    "@kind-ui/internal-textarea"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/react/feedback.tsx",
      "content": "\"use client\";\n\nimport { feedbackPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/react/primitive\";\nimport { Toggle, ToggleGroup, ToggleIcon } from \"@ui-sdk/react/toggle\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { KindTextarea } from \"./internal/textarea\";\n\nconst parts = createParts(feedbackPrimitive, {\n  root: \"div\",\n  thumbs: \"div\",\n  comment: \"button\",\n  thanks: \"span\",\n  content: \"div\",\n  title: \"h2\",\n  \"comment-text\": \"div\",\n  \"comment-send\": \"button\",\n  \"comment-status\": \"span\",\n  \"comment-status-icon\": \"span\",\n  \"comment-error\": \"span\",\n});\n\nexport type FeedbackProps = ComponentProps<typeof parts.Root>;\n\n/**\n * Thumbs up and down for a response, then \"Add a comment\" while `onComment` is set, which opens a box to write one.\n * Any `children` replace the default parts.\n */\nexport function Feedback({ children = DEFAULT_PARTS, ...props }: FeedbackProps) {\n  return <parts.Root {...props}>{children}</parts.Root>;\n}\n\nexport type FeedbackThumbsProps = Omit<ComponentProps<typeof parts.Thumbs>, \"children\"> & {\n  children?: ReactNode;\n};\n\n/** UI SDK's Toggle group, holding the thumbs unless you pass children. One Tab stop, with arrow keys between. */\nexport function FeedbackThumbs({ children = DEFAULT_THUMBS, ...props }: FeedbackThumbsProps) {\n  return (\n    <parts.Thumbs {...props}>\n      {(group) => (\n        // Hidden from agents, which use the Feedback's own `rate`.\n        <ToggleGroup {...group} data-agent-hidden=\"\">\n          {children}\n        </ToggleGroup>\n      )}\n    </parts.Thumbs>\n  );\n}\n\nexport type FeedbackThumbProps = Omit<ComponentProps<typeof Toggle>, \"value\">;\n\n/** \"Good response\": a Toggle whose value is `\"up\"`. */\nexport function FeedbackUp({\n  children = <ToggleIcon data-feedback-icon=\"up\" />,\n  ...props\n}: FeedbackThumbProps) {\n  return (\n    <Toggle value=\"up\" aria-label=\"Good response\" data-kind-icon-button=\"\" data-kind-size=\"sm\" {...props}>\n      {children}\n    </Toggle>\n  );\n}\n\n/** \"Bad response\": a Toggle whose value is `\"down\"`. */\nexport function FeedbackDown({\n  children = <ToggleIcon data-feedback-icon=\"down\" />,\n  ...props\n}: FeedbackThumbProps) {\n  return (\n    <Toggle value=\"down\" aria-label=\"Bad response\" data-kind-icon-button=\"\" data-kind-size=\"sm\" {...props}>\n      {children}\n    </Toggle>\n  );\n}\n\nexport type FeedbackCommentProps = ComponentProps<typeof parts.Comment>;\n\n/** \"Add a comment\", unless you pass children. Opens the comment box. Rendered once there's a rating and `onComment`. */\nexport function FeedbackComment({ children = \"Add a comment\", ...props }: FeedbackCommentProps) {\n  return <parts.Comment {...props}>{children}</parts.Comment>;\n}\n\nexport type FeedbackThanksProps = ComponentProps<typeof parts.Thanks>;\n\n/** \"Thanks for your feedback\", unless you pass children. Rendered while `commentSent` is set. */\nexport function FeedbackThanks({ children = \"Thanks for your feedback\", ...props }: FeedbackThanksProps) {\n  return <parts.Thanks {...props}>{children}</parts.Thanks>;\n}\n\nexport type FeedbackContentProps = ComponentProps<typeof parts.Content>;\n\n/** The comment box: a title, the text, Send and its error, unless you pass children. */\nexport function FeedbackContent({ children = DEFAULT_CONTENT, ...props }: FeedbackContentProps) {\n  return <parts.Content {...props}>{children}</parts.Content>;\n}\n\nexport type FeedbackTitleProps = ComponentProps<typeof parts.Title>;\n\n/** \"Add a comment\", unless you pass children. Names the comment box; the styles keep it for assistive technology only. */\nexport function FeedbackTitle({ children = \"Add a comment\", ...props }: FeedbackTitleProps) {\n  return <parts.Title {...props}>{children}</parts.Title>;\n}\n\nexport type FeedbackCommentTextProps = ComponentProps<typeof parts.CommentText>;\n\n/** UI SDK's Textarea, unless you pass children, a function that gets its props, its placeholder keyed on the rating. */\nexport function FeedbackCommentText({\n  children = (textarea) => <KindTextarea {...textarea} rows={3} />,\n  ...props\n}: FeedbackCommentTextProps) {\n  return <parts.CommentText {...props}>{children}</parts.CommentText>;\n}\n\nexport type FeedbackCommentSendProps = ComponentProps<typeof parts.CommentSend>;\n\n/** Sends the comment through `onComment`. Reads \"Send\" unless you pass children. */\nexport function FeedbackCommentSend({ children = \"Send\", ...props }: FeedbackCommentSendProps) {\n  return <parts.CommentSend {...props}>{children}</parts.CommentSend>;\n}\n\nexport const FeedbackCommentStatusIcon = parts.CommentStatusIcon;\n\nexport type FeedbackCommentStatusProps = ComponentProps<typeof parts.CommentStatus>;\n\n/** A running mark and \"Sending\" while `onComment` is pending, unless you pass children. */\nexport function FeedbackCommentStatus({ children = DEFAULT_STATUS, ...props }: FeedbackCommentStatusProps) {\n  return <parts.CommentStatus {...props}>{children}</parts.CommentStatus>;\n}\n\nexport type FeedbackCommentErrorProps = ComponentProps<typeof parts.CommentError>;\n\n/** \"Comment not sent. Try again.\" after `onComment` rejects, unless you pass children. */\nexport function FeedbackCommentError({\n  children = \"Comment not sent. Try again.\",\n  ...props\n}: FeedbackCommentErrorProps) {\n  return <parts.CommentError {...props}>{children}</parts.CommentError>;\n}\n\n// Shared, so an update doesn't render the default parts' wrappers again.\nconst DEFAULT_STATUS = (\n  <>\n    <FeedbackCommentStatusIcon />\n    Sending\n  </>\n);\n\nconst DEFAULT_THUMBS = (\n  <>\n    <FeedbackUp />\n    <FeedbackDown />\n  </>\n);\n\nconst DEFAULT_CONTENT = (\n  <>\n    <FeedbackTitle />\n    <FeedbackCommentText />\n    <div data-feedback-actions=\"\">\n      <FeedbackCommentStatus />\n      <FeedbackCommentError />\n      <FeedbackCommentSend />\n    </div>\n  </>\n);\n\nconst DEFAULT_PARTS = (\n  <>\n    <FeedbackThumbs />\n    <FeedbackComment />\n    <FeedbackThanks />\n    <FeedbackContent />\n  </>\n);\n",
      "type": "registry:ui",
      "target": "@ui/feedback.tsx"
    }
  ],
  "meta": {
    "layer": "react"
  },
  "type": "registry:ui"
}
