{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "feedback-solid",
  "title": "Feedback (Solid)",
  "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/solid@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup",
    "@kind-ui/internal-textarea-solid"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/solid/feedback.tsx",
      "content": "import { feedbackPrimitive } from \"@kind-ui/agent-ui/core\";\nimport type { ComponentProps, JSX } from \"@solidjs/web\";\nimport { createParts } from \"@ui-sdk/solid/primitive\";\nimport { Toggle, ToggleGroup, ToggleIcon } from \"@ui-sdk/solid/toggle\";\nimport { omit } from \"solid-js\";\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(props: FeedbackProps) {\n  return (\n    <parts.Root {...omit(props, \"children\")}>\n      {props.children ?? (\n        <>\n          <FeedbackThumbs />\n          <FeedbackComment />\n          <FeedbackThanks />\n          <FeedbackContent />\n        </>\n      )}\n    </parts.Root>\n  );\n}\n\nexport type FeedbackThumbsProps = Omit<ComponentProps<typeof parts.Thumbs>, \"children\"> & {\n  children?: JSX.Element;\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(props: FeedbackThumbsProps) {\n  return (\n    <parts.Thumbs {...omit(props, \"children\")}>\n      {(group) => (\n        // Hidden from agents, which use the Feedback's own `rate`.\n        <ToggleGroup\n          controller={group.controller}\n          defaultValue={group.defaultValue}\n          aria-label={group[\"aria-label\"]}\n          data-agent-hidden=\"\"\n        >\n          {props.children ?? (\n            <>\n              <FeedbackUp />\n              <FeedbackDown />\n            </>\n          )}\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(props: FeedbackThumbProps) {\n  return (\n    <Toggle\n      value=\"up\"\n      aria-label=\"Good response\"\n      data-kind-icon-button=\"\"\n      data-kind-size=\"sm\"\n      {...omit(props, \"children\")}\n    >\n      {props.children ?? <ToggleIcon data-feedback-icon=\"up\" />}\n    </Toggle>\n  );\n}\n\n/** \"Bad response\": a Toggle whose value is `\"down\"`. */\nexport function FeedbackDown(props: FeedbackThumbProps) {\n  return (\n    <Toggle\n      value=\"down\"\n      aria-label=\"Bad response\"\n      data-kind-icon-button=\"\"\n      data-kind-size=\"sm\"\n      {...omit(props, \"children\")}\n    >\n      {props.children ?? <ToggleIcon data-feedback-icon=\"down\" />}\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(props: FeedbackCommentProps) {\n  return <parts.Comment {...omit(props, \"children\")}>{props.children ?? \"Add a comment\"}</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(props: FeedbackThanksProps) {\n  return (\n    <parts.Thanks {...omit(props, \"children\")}>{props.children ?? \"Thanks for your feedback\"}</parts.Thanks>\n  );\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(props: FeedbackContentProps) {\n  return (\n    <parts.Content {...omit(props, \"children\")}>\n      {props.children ?? (\n        <>\n          <FeedbackTitle />\n          <FeedbackCommentText />\n          <div data-feedback-actions=\"\">\n            <FeedbackCommentStatus />\n            <FeedbackCommentError />\n            <FeedbackCommentSend />\n          </div>\n        </>\n      )}\n    </parts.Content>\n  );\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(props: FeedbackTitleProps) {\n  return <parts.Title {...omit(props, \"children\")}>{props.children ?? \"Add a comment\"}</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(props: FeedbackCommentTextProps) {\n  return (\n    <parts.CommentText {...omit(props, \"children\")}>\n      {props.children ??\n        ((textarea) => (\n          <KindTextarea\n            controller={textarea.controller}\n            defaultValue={textarea.defaultValue}\n            readonly={textarea.readOnly}\n            placeholder={textarea.placeholder}\n            aria-label={textarea[\"aria-label\"]}\n            rows={3}\n          />\n        ))}\n    </parts.CommentText>\n  );\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(props: FeedbackCommentSendProps) {\n  return <parts.CommentSend {...omit(props, \"children\")}>{props.children ?? \"Send\"}</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(props: FeedbackCommentStatusProps) {\n  return (\n    <parts.CommentStatus {...omit(props, \"children\")}>\n      {props.children ?? (\n        <>\n          <FeedbackCommentStatusIcon />\n          Sending\n        </>\n      )}\n    </parts.CommentStatus>\n  );\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(props: FeedbackCommentErrorProps) {\n  return (\n    <parts.CommentError {...omit(props, \"children\")}>\n      {props.children ?? \"Comment not sent. Try again.\"}\n    </parts.CommentError>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/feedback.tsx"
    }
  ],
  "meta": {
    "layer": "solid"
  },
  "type": "registry:ui"
}
