{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "confirmation-solid",
  "title": "Confirmation (Solid)",
  "description": "Approve or deny an agent's request, with an optional reason, then the recorded outcome.",
  "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/confirmation.tsx",
      "content": "import { codeSpans, confirmationPrimitive, WORDS } from \"@kind-ui/agent-ui/core\";\nimport type { ComponentProps, JSX } from \"@solidjs/web\";\nimport { createParts } from \"@ui-sdk/solid/primitive\";\nimport { omit, Show } from \"solid-js\";\nimport { KindTextarea } from \"./internal/textarea\";\n\nconst parts = createParts(confirmationPrimitive, {\n  root: \"div\",\n  title: \"div\",\n  meta: \"span\",\n  risk: \"div\",\n  \"risk-icon\": \"span\",\n  reason: \"div\",\n  choices: \"div\",\n  approve: \"button\",\n  always: \"button\",\n  deny: \"button\",\n  cancel: \"button\",\n  error: \"span\",\n  detail: \"div\",\n  outcome: \"div\",\n  \"outcome-icon\": \"span\",\n});\n\nexport type ConfirmationProps = ComponentProps<typeof parts.Root>;\n\n/**\n * Asks a person to approve or deny a request, then shows what was decided. Only the choices the host supplies\n * (`onDeny`, `onAlwaysAllow`, `onApprove`) render, in that order. Any `children` replace the default parts.\n */\nexport function Confirmation(props: ConfirmationProps) {\n  return <parts.Root {...omit(props, \"children\")}>{props.children ?? <DefaultParts />}</parts.Root>;\n}\n\nexport const ConfirmationChoices = parts.Choices;\nexport const ConfirmationOutcomeIcon = parts.OutcomeIcon;\nexport const ConfirmationRiskIcon = parts.RiskIcon;\n\n// Text with its backticks as `code`.\nfunction Code(props: { text: string }) {\n  return <>{codeSpans(props.text).map((piece, index) => (index % 2 ? <code>{piece}</code> : piece))}</>;\n}\n\nexport type ConfirmationTitleProps = ComponentProps<typeof parts.Title>;\n\n/** The `label`, unless you pass children. Rendered only while `label` is set, and hidden inside a Tool. */\nexport function ConfirmationTitle(props: ConfirmationTitleProps) {\n  return (\n    <parts.Title {...omit(props, \"children\")}>\n      {props.children ?? ((state: { label: string }) => <Code text={state.label} />)}\n    </parts.Title>\n  );\n}\n\nexport type ConfirmationMetaProps = ComponentProps<typeof parts.Meta>;\n\n/** \"Sending decision\", else the deadline (\"Decide in 4 min\", then \"Expired\"), unless you pass children. */\nexport function ConfirmationMeta(props: ConfirmationMetaProps) {\n  return (\n    <parts.Meta {...omit(props, \"children\")}>\n      {props.children ?? ((state: { text: string }) => state.text)}\n    </parts.Meta>\n  );\n}\n\nexport type ConfirmationRiskProps = ComponentProps<typeof parts.Risk>;\n\n/** The `riskText` after a warning mark, unless you pass children. Rendered only while `riskText` is set. */\nexport function ConfirmationRisk(props: ConfirmationRiskProps) {\n  return (\n    <parts.Risk {...omit(props, \"children\")}>\n      {props.children ??\n        ((state: { text: string }) => (\n          <>\n            <ConfirmationRiskIcon />\n            <span>\n              <Code text={state.text} />\n            </span>\n          </>\n        ))}\n    </parts.Risk>\n  );\n}\n\nexport type ConfirmationReasonProps = ComponentProps<typeof parts.Reason>;\n\n/**\n * A box for the reason Deny sends, unless you pass children. Rendered with the `reason` option, once a person's Deny\n * opens it.\n */\nexport function ConfirmationReason(props: ConfirmationReasonProps) {\n  return (\n    <parts.Reason {...omit(props, \"children\")}>\n      {props.children ??\n        ((state) => (\n          <KindTextarea\n            controller={state.controller}\n            readonly={state.readOnly}\n            aria-label=\"Reason for denying\"\n            placeholder=\"Add a reason (optional)\"\n            rows={2}\n          />\n        ))}\n    </parts.Reason>\n  );\n}\n\nexport type ConfirmationApproveProps = ComponentProps<typeof parts.Approve>;\n\n/** Calls `onApprove`. Reads the `approveLabel` unless you pass children. Rendered only while `onApprove` is set. */\nexport function ConfirmationApprove(props: ConfirmationApproveProps) {\n  return <parts.Approve {...omit(props, \"children\")}>{props.children ?? withPendingMark}</parts.Approve>;\n}\n\nexport type ConfirmationAlwaysProps = ComponentProps<typeof parts.Always>;\n\n/**\n * Calls `onAlwaysAllow`, which approves and asks the host to remember. Reads the `alwaysLabel` and `alwaysTarget`\n * unless you pass children. Rendered only while `onAlwaysAllow` is set and `risk` isn't `\"danger\"`.\n */\nexport function ConfirmationAlways(props: ConfirmationAlwaysProps) {\n  return <parts.Always {...omit(props, \"children\")}>{props.children ?? withPendingMark}</parts.Always>;\n}\n\nexport type ConfirmationDenyProps = ComponentProps<typeof parts.Deny>;\n\n/**\n * Calls `onDeny`. With `reason`, a person's first press opens the reason box instead. Reads the `denyLabel` unless\n * you pass children. Rendered only while `onDeny` is set.\n */\nexport function ConfirmationDeny(props: ConfirmationDenyProps) {\n  return <parts.Deny {...omit(props, \"children\")}>{props.children ?? withPendingMark}</parts.Deny>;\n}\n\nexport type ConfirmationCancelProps = ComponentProps<typeof parts.Cancel>;\n\n/** Closes the reason box without deciding. Reads \"Cancel\" unless you pass children. Rendered while the box is open. */\nexport function ConfirmationCancel(props: ConfirmationCancelProps) {\n  return <parts.Cancel {...omit(props, \"children\")}>{props.children ?? \"Cancel\"}</parts.Cancel>;\n}\n\nexport type ConfirmationErrorProps = ComponentProps<typeof parts.Error>;\n\n/** \"Decision not sent. Try again.\" while the host reports `submit-failed`, unless you pass children. */\nexport function ConfirmationError(props: ConfirmationErrorProps) {\n  return <parts.Error {...omit(props, \"children\")}>{props.children ?? WORDS.notSentRetry}</parts.Error>;\n}\n\nexport type ConfirmationDetailProps = ComponentProps<typeof parts.Detail>;\n\n/** The `alwaysDetail`, unless you pass children. Rendered under the choices while Always allow shows. */\nexport function ConfirmationDetail(props: ConfirmationDetailProps) {\n  return (\n    <parts.Detail {...omit(props, \"children\")}>\n      {props.children ?? ((state: { text: string }) => <Code text={state.text} />)}\n    </parts.Detail>\n  );\n}\n\nexport type ConfirmationOutcomeProps = ComponentProps<typeof parts.Outcome>;\n\n/** Where the request stands, like \"Approved\", with the denial's reason, unless you pass children. */\nexport function ConfirmationOutcome(props: ConfirmationOutcomeProps) {\n  return (\n    <parts.Outcome {...omit(props, \"children\")}>\n      {props.children ??\n        ((state) => (\n          <>\n            <ConfirmationOutcomeIcon />\n            <span data-confirmation-label=\"\">\n              <Code text={state.label} />\n            </span>{\" \"}\n            <Show when={state.reason}>\n              <span data-confirmation-reason=\"\">{state.reason}</span>\n            </Show>\n          </>\n        ))}\n    </parts.Outcome>\n  );\n}\n\n// The mark shows only while the button's call is pending (controls.css).\nconst withPendingMark = (state: { label: string }): JSX.Element => (\n  <>\n    <span data-kind-pending-mark=\"\" data-status-mark=\"\" data-status=\"running\" aria-hidden=\"true\" />\n    <Code text={state.label} />\n  </>\n);\n\nfunction DefaultParts() {\n  return (\n    <>\n      <ConfirmationTitle />\n      <ConfirmationMeta />\n      <ConfirmationRisk />\n      <ConfirmationReason />\n      <ConfirmationChoices>\n        <ConfirmationCancel />\n        <ConfirmationDeny />\n        <ConfirmationAlways />\n        <ConfirmationApprove />\n        <ConfirmationError />\n      </ConfirmationChoices>\n      <ConfirmationDetail />\n      <ConfirmationOutcome />\n    </>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/confirmation.tsx"
    }
  ],
  "meta": {
    "layer": "solid"
  },
  "type": "registry:ui"
}
