{"version":3,"sources":["../src/button/button.tsx","../src/dialog/dialog.tsx","../src/tooltip/tooltip.tsx","../src/input/input.tsx","../src/toggle/toggle.tsx","../src/popover/popover.tsx","../src/tabs/tabs.tsx","../src/select/select.tsx","../src/manifest-schema.ts"],"names":["forwardRef","Button","usePermissions","resolvePermissions","useAudit","evaluatePermission","CANONICAL_ACTIONS","jsx","Root","RadixDialog","Trigger","Portal","Overlay","Content","Title","Description","Close","resolveMessage","Provider","RadixTooltip","Arrow","Input","useRef","Toggle","useState","RadixPopover","Anchor","RadixTabs","List","RadixSelect","Value","Icon","Viewport","Item","ItemText","ItemIndicator","Separator","Group","Label","z"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGO,IAAM,MAAA,GAASA,gBAAA;AAAA,EACpB,SAASC,OAAAA,CACP;AAAA,IACE,QAAA;AAAA,IACA,IAAA,GAAO,QAAA;AAAA,IACP,QAAA,GAAW,KAAA;AAAA,IACX,OAAA,GAAU,KAAA;AAAA,IACV,WAAA;AAAA,IACA,QAAA,GAAW,QAAA;AAAA,IACX,eAAA;AAAA,IACA,OAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,EACA;AACA,IAAA,MAAM,qBAAqBC,yBAAA,EAAe;AAC1C,IAAA,MAAM,SAAA,GAAYC,6BAAA,CAAmB,WAAA,EAAa,kBAAkB,CAAA;AACpE,IAAA,MAAM,IAAA,GAAO,UAAU,IAAA,IAAQ,UAAA;AAC/B,IAAA,MAAM,OAAOC,mBAAA,EAAS;AAEtB,IAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAW,GAAIC,6BAAA;AAAA,MAC9B,SAAA;AAAA,MACA,OAAA;AAAA,MACA,QAAA;AAAA,MACA;AAAA,KACF;AAGA,IAAA,IAAI,CAAC,OAAA,IAAW,IAAA,KAAS,QAAA,EAAU,OAAO,IAAA;AAK1C,IAAA,MAAM,gBAAA,GAAmB,CAAC,OAAA,IAAW,IAAA,KAAS,UAAA;AA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C,UAAU,CAAA,IAAA,EAAO,KAAA,CAAM,KAAK,IAAA,CAAK,GAAG,CAAC,CAAA,EAAA,EAAK,KAAA,CAAM,OAAO,CAAA,CAAE,CAAA,CAC9D,KAAK,IAAI,CAAA;AACZ,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,8BAA8B,OAAO,CAAA;AAAA,EAAO,MAAM,CAAA;AAAA,KACpD;AAAA,EACF;AACA,EAAA,OAAO,MAAA,CAAO,IAAA;AAChB","file":"index.cjs","sourcesContent":["/**\n * Button — headless proprietary primitive.\n *\n * Client component (consumes `PermissionContext` + `AuditContext` via\n * `useContext`). See `docs/adr/primitives/001-button-rsc-default.md` for\n * the full trade-off analysis.\n *\n * Contracts honored:\n *   - Permission gate (ARCHITECTURE §10). The button asks the ambient\n *     policy `can('click', 'button', attrs?)`. Denied → the `mode` field\n *     decides presentation (`'disabled'`, `'hidden'`, or `'readOnly'`).\n *   - Audit event (§10). Every successful activation emits\n *     `PRIMITIVE_ACTIONS.BUTTON_CLICK` with ISO-8601 timestamp. Denied\n *     activations emit `DATA_ACTIONS.PERMISSION_DENIED` with the deny\n *     reason so governance can index on them.\n */\n\n'use client';\n\nimport { forwardRef } from 'react';\nimport type {\n  ButtonHTMLAttributes,\n  MouseEventHandler,\n  ReactNode,\n  Ref,\n} from 'react';\nimport {\n  evaluatePermission,\n  resolvePermissions,\n  usePermissions,\n  useAudit,\n  type PermissionContext,\n} from '../context.js';\nimport { CANONICAL_ACTIONS } from '../actions.js';\n\ntype NativeButtonProps = Omit<\n  ButtonHTMLAttributes<HTMLButtonElement>,\n  'type' | 'disabled' | 'aria-busy'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n  /**\n   * Button contents. Unstyled — wrap with icons / labels as needed. The\n   * visual layer in `@oshon-ai/components` adds spacing and iconography\n   * on top of this primitive.\n   */\n  children: ReactNode;\n  /**\n   * Native `type` attribute. Defaults to `'button'` so the primitive\n   * never accidentally submits a form. Pass `'submit'` explicitly for\n   * form buttons.\n   */\n  type?: 'button' | 'submit' | 'reset';\n  /**\n   * Disable the button. Renders with `aria-disabled=\"true\"` and the\n   * native `disabled` attribute so screen readers and keyboard users\n   * get consistent signal. When `disabled`, `onClick` does not fire and\n   * no audit event is emitted.\n   */\n  disabled?: boolean;\n  /**\n   * In-flight state. Sets `aria-busy=\"true\"` + `disabled` so assistive\n   * tech announces the button as unavailable while the action resolves.\n   * The visual layer renders a spinner on top; the primitive itself does\n   * not.\n   */\n  loading?: boolean;\n  /**\n   * Per-instance permission override. Merges over the ambient\n   * `PermissionContext`. Example: `permissions={{ mode: 'hidden' }}`\n   * switches this one instance to render-as-null when denied.\n   */\n  permissions?: Partial<PermissionContext>;\n  /**\n   * Resource name passed to `permissions.can(action, resource, attrs)`.\n   * Default `'button'`. Consumers override for specific semantics, e.g.\n   * `resource=\"row:edit\"` for a row-level action button.\n   */\n  resource?: string;\n  /**\n   * Attribute bag forwarded to `permissions.can(..., attrs)` for\n   * attribute-based access control (row ID, tenant, owner). Primitives\n   * never invent values here — the consumer supplies them.\n   */\n  permissionAttrs?: Record<string, unknown>;\n}\n\n/**\n * Headless button. Accessible `<button>` with:\n *   - `type=\"button\"` default (no accidental form submits)\n *   - `disabled` + `aria-disabled` + `aria-busy` synchronised\n *   - Permission gating via `can('click', resource, attrs)` with `mode`\n *     controlling the denied-state presentation\n *   - Canonical `button:click` audit event on activation; `permission:denied`\n *     with deny reason on blocked activation\n *   - `data-oshon-primitive=\"button\"` styling hook for the components layer\n *   - `data-permission-state=\"denied\"` hook when mode is `'disabled'` or\n *     `'readOnly'` and the policy denied the action\n *   - No visual styling — consumers supply their own className / styles.\n *\n * Keyboard: native browser behavior — Enter + Space activate.\n *\n * @see docs/adr/primitives/001-button-rsc-default.md\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n  function Button(\n    {\n      children,\n      type = 'button',\n      disabled = false,\n      loading = false,\n      permissions,\n      resource = 'button',\n      permissionAttrs,\n      onClick,\n      ...rest\n    }: ButtonProps,\n    ref: Ref<HTMLButtonElement>,\n  ) {\n    const contextPermissions = usePermissions();\n    const effective = resolvePermissions(permissions, contextPermissions);\n    const mode = effective.mode ?? 'disabled';\n    const emit = useAudit();\n\n    const { granted, denyReason } = evaluatePermission(\n      effective,\n      'click',\n      resource,\n      permissionAttrs,\n    );\n\n    // Permission denied + mode='hidden' → the affordance must not exist.\n    if (!granted && mode === 'hidden') return null;\n\n    // `readOnly` denies the click but keeps the affordance visible +\n    // focusable. `disabled` denies + visibly disables. Both emit the\n    // permission:denied audit trail on interaction attempts.\n    const permissionBlocks = !granted && mode !== 'readOnly';\n    const isDisabled = disabled || loading || permissionBlocks;\n\n    const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n      // Local disabled/loading — silent drop, no audit.\n      if (disabled || loading) return;\n\n      if (!granted) {\n        // Record the denial regardless of `mode`. Governance wants these\n        // events to surface over-permissive UIs as much as under-permissive\n        // ones.\n        emit({\n          component: 'button',\n          action: CANONICAL_ACTIONS.PERMISSION_DENIED,\n          permissionResult: 'denied',\n          ...(denyReason ? { denyReason } : {}),\n          details: { attemptedAction: 'click', resource },\n        });\n        // `readOnly` means \"visible, non-mutating\" — we don't invoke\n        // onClick but we also don't `preventDefault` the browser's click\n        // (it has no meaningful default behavior on a plain button).\n        return;\n      }\n\n      emit({\n        component: 'button',\n        action: CANONICAL_ACTIONS.BUTTON_CLICK,\n        permissionResult: 'granted',\n      });\n      onClick?.(event);\n    };\n\n    const permissionDataState =\n      !granted && mode !== 'hidden' ? 'denied' : undefined;\n\n    // Consumer title always wins; deny reason fills in only when no title.\n    const resolvedTitle =\n      rest.title ?? (permissionDataState && denyReason ? denyReason : undefined);\n\n    return (\n      <button\n        {...rest}\n        ref={ref}\n        type={type}\n        disabled={isDisabled}\n        aria-disabled={isDisabled || undefined}\n        aria-busy={loading || undefined}\n        data-oshon-primitive=\"button\"\n        data-loading={loading ? 'true' : undefined}\n        data-permission-state={permissionDataState}\n        title={resolvedTitle}\n        onClick={handleClick}\n      >\n        {children}\n      </button>\n    );\n  },\n);\n","/**\n * Dialog — headless primitive wrapping Radix Dialog.\n *\n * Radix's Dialog is best-in-class for focus trap, portal, scroll lock,\n * and `aria-modal` semantics (ARCHITECTURE §6). We wrap thinly:\n *   - Permission gating on <Root> (canView=false → primitive returns null)\n *   - Audit events on open / close\n *   - `data-oshon-primitive=\"dialog-*\"` styling hooks for Phase 4\n *   - i18n-ready `messages` prop on <Close> (for the \"Close\" aria-label)\n *\n * \"use client\" is mandatory here — Radix primitives use hooks + DOM APIs\n * internally, so our wrapper inherits the client boundary. See\n * `docs/adr/primitives/002-dialog-radix-wrap.md`.\n */\n\n'use client';\n\nimport * as RadixDialog from '@radix-ui/react-dialog';\nimport { forwardRef } from 'react';\nimport type {\n  ComponentPropsWithoutRef,\n  ElementRef,\n  ReactNode,\n} from 'react';\nimport {\n  evaluatePermission,\n  resolvePermissions,\n  usePermissions,\n  useAudit,\n  type PermissionContext,\n} from '../context.js';\nimport { CANONICAL_ACTIONS } from '../actions.js';\nimport { resolveMessage, type MessageBag } from '../i18n.js';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Root\n\nexport interface DialogRootProps\n  extends Omit<RadixDialog.DialogProps, 'onOpenChange'> {\n  /**\n   * Called whenever the dialog's open state changes. The primitive fires\n   * `dialog:open` / `dialog:close` audit events automatically before\n   * this callback runs — consumers receive the same notification either\n   * way.\n   */\n  onOpenChange?: (open: boolean) => void;\n  /**\n   * Per-instance permission override. Merges over the ambient\n   * `PermissionContext` (ARCHITECTURE §10). The primitive queries\n   * `can('view', resource, attrs)` on mount; denied + `mode='hidden'`\n   * returns `null`. Denied + `'disabled'` or `'readOnly'` still returns\n   * `null` for a dialog (there is no useful visible-but-non-interactive\n   * state for a modal) and emits a `permission:denied` audit.\n   */\n  permissions?: Partial<PermissionContext>;\n  /**\n   * Resource name passed to `permissions.can('view', resource, attrs)`.\n   * Default `'dialog'`. Override for specific semantics like\n   * `resource=\"record:delete-confirmation\"`.\n   */\n  resource?: string;\n  /** Attribute bag for attribute-based access control. */\n  permissionAttrs?: Record<string, unknown>;\n  children: ReactNode;\n}\n\n/**\n * Dialog root. Controls open state, gates on permissions, and fires\n * audit events. Must wrap every other `Dialog.*` sub-component.\n */\nfunction Root({\n  children,\n  open,\n  defaultOpen,\n  onOpenChange,\n  permissions,\n  resource = 'dialog',\n  permissionAttrs,\n  modal,\n}: DialogRootProps) {\n  const context = usePermissions();\n  const effective = resolvePermissions(permissions, context);\n  const emit = useAudit();\n\n  const { granted, denyReason } = evaluatePermission(\n    effective,\n    'view',\n    resource,\n    permissionAttrs,\n  );\n\n  if (!granted) {\n    // A dialog with no content can't render \"readOnly\" usefully, so we\n    // hide under any deny mode — but still emit the denial so governance\n    // can surface over-/under-permissive flows.\n    emit({\n      component: 'dialog',\n      action: CANONICAL_ACTIONS.PERMISSION_DENIED,\n      permissionResult: 'denied',\n      ...(denyReason ? { denyReason } : {}),\n      details: { attemptedAction: 'view', resource },\n    });\n    return null;\n  }\n\n  const handleOpenChange = (next: boolean) => {\n    emit({\n      component: 'dialog',\n      action: next ? CANONICAL_ACTIONS.DIALOG_OPEN : CANONICAL_ACTIONS.DIALOG_CLOSE,\n      permissionResult: 'granted',\n    });\n    onOpenChange?.(next);\n  };\n\n  return (\n    <RadixDialog.Root\n      open={open}\n      defaultOpen={defaultOpen}\n      onOpenChange={handleOpenChange}\n      modal={modal}\n    >\n      {children}\n    </RadixDialog.Root>\n  );\n}\nRoot.displayName = 'Dialog.Root';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Trigger\n\nexport type DialogTriggerProps = ComponentPropsWithoutRef<typeof RadixDialog.Trigger>;\n\nconst Trigger = forwardRef<\n  ElementRef<typeof RadixDialog.Trigger>,\n  DialogTriggerProps\n>(function DialogTrigger(props, ref) {\n  return (\n    <RadixDialog.Trigger\n      ref={ref}\n      data-oshon-primitive=\"dialog-trigger\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Portal\n\nexport type DialogPortalProps = RadixDialog.DialogPortalProps;\n\n/**\n * Portal. Radix handles the portal container itself; we pass through.\n */\nfunction Portal(props: DialogPortalProps) {\n  return <RadixDialog.Portal {...props} />;\n}\nPortal.displayName = 'Dialog.Portal';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Overlay\n\nexport type DialogOverlayProps = ComponentPropsWithoutRef<typeof RadixDialog.Overlay>;\n\nconst Overlay = forwardRef<\n  ElementRef<typeof RadixDialog.Overlay>,\n  DialogOverlayProps\n>(function DialogOverlay(props, ref) {\n  return (\n    <RadixDialog.Overlay\n      ref={ref}\n      data-oshon-primitive=\"dialog-overlay\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Content\n\nexport type DialogContentProps = ComponentPropsWithoutRef<typeof RadixDialog.Content>;\n\n/**\n * Content. Radix provides focus trap, scroll lock, ESC-to-close,\n * `aria-modal`, and `role=\"dialog\"` — we add only the styling hook.\n */\nconst Content = forwardRef<\n  ElementRef<typeof RadixDialog.Content>,\n  DialogContentProps\n>(function DialogContent(props, ref) {\n  return (\n    <RadixDialog.Content\n      ref={ref}\n      data-oshon-primitive=\"dialog-content\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Title\n\nexport type DialogTitleProps = ComponentPropsWithoutRef<typeof RadixDialog.Title>;\n\nconst Title = forwardRef<\n  ElementRef<typeof RadixDialog.Title>,\n  DialogTitleProps\n>(function DialogTitle(props, ref) {\n  return (\n    <RadixDialog.Title\n      ref={ref}\n      data-oshon-primitive=\"dialog-title\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Description\n\nexport type DialogDescriptionProps = ComponentPropsWithoutRef<typeof RadixDialog.Description>;\n\nconst Description = forwardRef<\n  ElementRef<typeof RadixDialog.Description>,\n  DialogDescriptionProps\n>(function DialogDescription(props, ref) {\n  return (\n    <RadixDialog.Description\n      ref={ref}\n      data-oshon-primitive=\"dialog-description\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Close\n\nexport interface DialogCloseProps\n  extends ComponentPropsWithoutRef<typeof RadixDialog.Close> {\n  /**\n   * i18n message bag. Reads `close` key for the default aria-label when\n   * the consumer renders an icon-only close button.\n   */\n  messages?: MessageBag;\n}\n\nconst Close = forwardRef<\n  ElementRef<typeof RadixDialog.Close>,\n  DialogCloseProps\n>(function DialogClose({ messages, 'aria-label': ariaLabel, children, ...rest }, ref) {\n  // Only fall back to the \"close\" message when there's no visible text\n  // label (icon-only close button). If consumers render `<Close>Cancel</Close>`\n  // the button's text content is its accessible name — overriding aria-label\n  // would shadow it and break `getByRole('button', { name: 'Cancel' })`.\n  const resolvedLabel =\n    ariaLabel ??\n    (children == null\n      ? resolveMessage(messages, 'close', 'Close')\n      : undefined);\n  return (\n    <RadixDialog.Close\n      ref={ref}\n      data-oshon-primitive=\"dialog-close\"\n      aria-label={resolvedLabel}\n      {...rest}\n    >\n      {children}\n    </RadixDialog.Close>\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Compound export\n\n/**\n * Compound Dialog primitive. Use as:\n *\n *   <Dialog.Root>\n *     <Dialog.Trigger>Open</Dialog.Trigger>\n *     <Dialog.Portal>\n *       <Dialog.Overlay />\n *       <Dialog.Content>\n *         <Dialog.Title>Confirm</Dialog.Title>\n *         <Dialog.Description>Are you sure?</Dialog.Description>\n *         <Dialog.Close>Cancel</Dialog.Close>\n *       </Dialog.Content>\n *     </Dialog.Portal>\n *   </Dialog.Root>\n */\nexport const Dialog = {\n  Root,\n  Trigger,\n  Portal,\n  Overlay,\n  Content,\n  Title,\n  Description,\n  Close,\n};\n\nexport type DialogProps = DialogRootProps;\n","/**\n * Tooltip — headless primitive wrapping Radix Tooltip.\n *\n * Radix's Tooltip owns the hard parts: hover + focus triggers with\n * configurable delay, `aria-describedby` wiring, keyboard reachability,\n * pointer-vs-touch heuristics (ARCHITECTURE §6). We wrap thinly:\n *   - `Tooltip.Provider` surfaces the default delay contract\n *   - Permission gating on <Root> (canView=false → primitive returns null)\n *   - `data-oshon-primitive=\"tooltip-*\"` styling hooks\n *\n * Deliberately no audit events. Tooltips open/close on every hover and\n * an audit stream would be noise, not signal — principle #3 (\"RBAC +\n * audit by default\") covers actions, not purely informational surfaces.\n * See `docs/adr/primitives/003-tooltip-radix-wrap.md`.\n */\n\n'use client';\n\nimport * as RadixTooltip from '@radix-ui/react-tooltip';\nimport { forwardRef } from 'react';\nimport type {\n  ComponentPropsWithoutRef,\n  ElementRef,\n  ReactNode,\n} from 'react';\nimport {\n  evaluatePermission,\n  resolvePermissions,\n  usePermissions,\n  useAudit,\n  type PermissionContext,\n} from '../context.js';\nimport { CANONICAL_ACTIONS } from '../actions.js';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Provider\n\nexport type TooltipProviderProps = ComponentPropsWithoutRef<typeof RadixTooltip.Provider>;\n\n/**\n * Configures default delay + skip-delay behavior for every descendant\n * Tooltip. Mount once near the app root.\n */\nfunction Provider(props: TooltipProviderProps) {\n  return <RadixTooltip.Provider {...props} />;\n}\nProvider.displayName = 'Tooltip.Provider';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Root\n\nexport interface TooltipRootProps extends RadixTooltip.TooltipProps {\n  /**\n   * Per-instance permission override. Merges over the ambient\n   * `PermissionContext`. A tooltip has no useful non-interactive visible\n   * state, so any denied permission (regardless of `mode`) hides both\n   * trigger and content and emits a `permission:denied` audit event.\n   */\n  permissions?: Partial<PermissionContext>;\n  /**\n   * Resource name passed to `permissions.can('view', resource, attrs)`.\n   * Default `'tooltip'`. Override for specific semantics like\n   * `resource=\"field:ssn-help\"`.\n   */\n  resource?: string;\n  /** Attribute bag for attribute-based access control. */\n  permissionAttrs?: Record<string, unknown>;\n  children: ReactNode;\n}\n\nfunction Root({\n  children,\n  permissions,\n  resource = 'tooltip',\n  permissionAttrs,\n  ...rest\n}: TooltipRootProps) {\n  const context = usePermissions();\n  const effective = resolvePermissions(permissions, context);\n  const emit = useAudit();\n\n  const { granted, denyReason } = evaluatePermission(\n    effective,\n    'view',\n    resource,\n    permissionAttrs,\n  );\n\n  if (!granted) {\n    // Tooltips have no meaningful visible-but-inert state — all deny\n    // modes hide. We still emit the denial so governance can surface\n    // over-permissive help-text surfaces (principle #3, ADR-003).\n    emit({\n      component: 'tooltip',\n      action: CANONICAL_ACTIONS.PERMISSION_DENIED,\n      permissionResult: 'denied',\n      ...(denyReason ? { denyReason } : {}),\n      details: { attemptedAction: 'view', resource },\n    });\n    return null;\n  }\n\n  return <RadixTooltip.Root {...rest}>{children}</RadixTooltip.Root>;\n}\nRoot.displayName = 'Tooltip.Root';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Trigger\n\nexport type TooltipTriggerProps = ComponentPropsWithoutRef<typeof RadixTooltip.Trigger>;\n\nconst Trigger = forwardRef<\n  ElementRef<typeof RadixTooltip.Trigger>,\n  TooltipTriggerProps\n>(function TooltipTrigger(props, ref) {\n  return (\n    <RadixTooltip.Trigger\n      ref={ref}\n      data-oshon-primitive=\"tooltip-trigger\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Portal\n\nexport type TooltipPortalProps = RadixTooltip.TooltipPortalProps;\n\nfunction Portal(props: TooltipPortalProps) {\n  return <RadixTooltip.Portal {...props} />;\n}\nPortal.displayName = 'Tooltip.Portal';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Content\n\nexport type TooltipContentProps = ComponentPropsWithoutRef<typeof RadixTooltip.Content>;\n\n/**\n * Content. Radix handles `role=\"tooltip\"`, positioning, and collision\n * detection. We add the styling hook.\n */\nconst Content = forwardRef<\n  ElementRef<typeof RadixTooltip.Content>,\n  TooltipContentProps\n>(function TooltipContent(props, ref) {\n  return (\n    <RadixTooltip.Content\n      ref={ref}\n      data-oshon-primitive=\"tooltip-content\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Arrow\n\nexport type TooltipArrowProps = ComponentPropsWithoutRef<typeof RadixTooltip.Arrow>;\n\nconst Arrow = forwardRef<\n  ElementRef<typeof RadixTooltip.Arrow>,\n  TooltipArrowProps\n>(function TooltipArrow(props, ref) {\n  return (\n    <RadixTooltip.Arrow\n      ref={ref}\n      data-oshon-primitive=\"tooltip-arrow\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Compound export\n\n/**\n * Compound Tooltip primitive. Use as:\n *\n *   <Tooltip.Provider>\n *     <Tooltip.Root>\n *       <Tooltip.Trigger asChild>\n *         <button>Help</button>\n *       </Tooltip.Trigger>\n *       <Tooltip.Portal>\n *         <Tooltip.Content>Inline documentation.</Tooltip.Content>\n *       </Tooltip.Portal>\n *     </Tooltip.Root>\n *   </Tooltip.Provider>\n */\nexport const Tooltip = {\n  Provider,\n  Root,\n  Trigger,\n  Portal,\n  Content,\n  Arrow,\n};\n\nexport type TooltipProps = TooltipRootProps;\n","/**\n * Input — headless proprietary primitive.\n *\n * Client component (consumes `PermissionContext` + `AuditContext` via\n * `useContext`). Wraps the native `<input>` with:\n *   - Permission gating via `can('edit', resource, attrs)`. The three\n *     modes collapse cleanly for form fields: `disabled` → native\n *     disabled, `readOnly` → native readOnly (visible, focus-reachable,\n *     non-mutating), `hidden` → returns null.\n *   - Canonical `input:change` audit emission on blur (not per-keystroke —\n *     that would drown the stream; blur is the semantic \"I'm done typing\"\n *     boundary). Also `input:blur` when a consumer needs the signal\n *     separately. `permission:denied` on blocked edits in `readOnly`.\n *   - `data-oshon-primitive=\"input\"` + `data-permission-state` styling hooks.\n *\n * Proprietary rather than Radix-wrapped because native `<input>` behavior\n * is narrow — label wiring (htmlFor), form association, constraint\n * validation, ARIA defaults all come free. See ADR-001 for the\n * \"proprietary vs. Radix\" rubric (same rubric applied to Button).\n */\n\n'use client';\n\nimport { forwardRef, useRef } from 'react';\nimport type {\n  FocusEventHandler,\n  ChangeEventHandler,\n  InputHTMLAttributes,\n  Ref,\n} from 'react';\nimport {\n  evaluatePermission,\n  resolvePermissions,\n  usePermissions,\n  useAudit,\n  type PermissionContext,\n} from '../context.js';\nimport { CANONICAL_ACTIONS } from '../actions.js';\n\ntype NativeInputProps = Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  'disabled' | 'readOnly' | 'aria-invalid'\n>;\n\nexport interface InputProps extends NativeInputProps {\n  /**\n   * Disable the input. Renders with the native `disabled` attribute so\n   * screen readers and keyboard users get consistent signal. No change /\n   * blur audit events fire while disabled.\n   */\n  disabled?: boolean;\n  /**\n   * Non-mutating but still interactive. Renders with native `readOnly`\n   * so the field is focus-reachable, copy-friendly, and announced as\n   * read-only by assistive tech. Change events are silently dropped.\n   */\n  readOnly?: boolean;\n  /**\n   * Marks the field as invalid for a11y. `true` → `aria-invalid=\"true\"`.\n   * The visual layer surfaces the error styling; primitive only ensures\n   * correct ARIA.\n   */\n  invalid?: boolean;\n  /**\n   * Per-instance permission override. Merges over the ambient\n   * `PermissionContext`. Example: `permissions={{ mode: 'hidden' }}`\n   * switches this one instance to render-as-null when denied.\n   */\n  permissions?: Partial<PermissionContext>;\n  /**\n   * Resource name passed to `permissions.can('edit', resource, attrs)`.\n   * Default `'input'`. Consumers override for specific semantics, e.g.\n   * `resource=\"field:ssn\"` for a sensitive data field.\n   */\n  resource?: string;\n  /**\n   * Attribute bag forwarded to `permissions.can(..., attrs)` for\n   * attribute-based access control. Primitives never invent values here\n   * — the consumer supplies them.\n   */\n  permissionAttrs?: Record<string, unknown>;\n}\n\n/**\n * Headless input. Accessible `<input>` with:\n *   - `disabled` / `readOnly` / `aria-invalid` / `aria-disabled`\n *     synchronised\n *   - Permission gating via `can('edit', resource, attrs)`:\n *       - `mode='disabled'` (default) — renders native `disabled`\n *       - `mode='readOnly'` — renders native `readOnly` (visible,\n *         focus-reachable, non-mutating)\n *       - `mode='hidden'` — returns null\n *   - Canonical `input:change` + `input:blur` audit on blur (granted);\n *     `permission:denied` when the user attempts to mutate a\n *     readOnly-gated field\n *   - `data-oshon-primitive=\"input\"` styling hook\n *   - `data-permission-state=\"denied\"` styling hook under any deny mode\n *     that keeps the affordance visible\n *   - No visual styling — consumers supply their own className / styles.\n *\n * Keyboard: native browser behavior — Tab focuses, typing mutates.\n */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n  function Input(\n    {\n      disabled = false,\n      readOnly = false,\n      invalid = false,\n      permissions,\n      resource = 'input',\n      permissionAttrs,\n      onChange,\n      onBlur,\n      value,\n      defaultValue,\n      ...rest\n    }: InputProps,\n    ref: Ref<HTMLInputElement>,\n  ) {\n    const contextPermissions = usePermissions();\n    const effective = resolvePermissions(permissions, contextPermissions);\n    const mode = effective.mode ?? 'disabled';\n    const emit = useAudit();\n\n    const { granted, denyReason } = evaluatePermission(\n      effective,\n      'edit',\n      resource,\n      permissionAttrs,\n    );\n\n    // Track whether the current value differs from the value at focus so\n    // the blur emit only fires `input:change` when the user actually\n    // changed something. Consumers who want per-keystroke telemetry layer\n    // that on top via `onChange` — primitive stream stays quiet.\n    const focusValueRef = useRef<string | null>(null);\n    const changedSinceFocusRef = useRef(false);\n\n    if (!granted && mode === 'hidden') return null;\n\n    const permissionBlocks = !granted && mode !== 'readOnly';\n    const isDisabled = disabled || permissionBlocks;\n    const isReadOnly = readOnly || (!granted && mode === 'readOnly');\n\n    const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n      if (disabled) return;\n\n      if (!granted && mode === 'readOnly') {\n        // User attempted to mutate a permission-gated readOnly field.\n        // Record the denial once per keystroke attempt — governance can\n        // aggregate these into \"user tried to edit X N times\" signals.\n        emit({\n          component: 'input',\n          action: CANONICAL_ACTIONS.PERMISSION_DENIED,\n          permissionResult: 'denied',\n          ...(denyReason ? { denyReason } : {}),\n          details: { attemptedAction: 'edit', resource },\n        });\n        // Don't forward — a readOnly field must not let consumer state\n        // drift into an edit it rejected.\n        return;\n      }\n\n      if (readOnly) {\n        // Locally readOnly — silent drop, no audit (the consumer\n        // declared the field read-only on purpose).\n        return;\n      }\n\n      changedSinceFocusRef.current = true;\n      onChange?.(event);\n    };\n\n    const handleFocus: FocusEventHandler<HTMLInputElement> = (event) => {\n      focusValueRef.current = event.currentTarget.value;\n      changedSinceFocusRef.current = false;\n      rest.onFocus?.(event);\n    };\n\n    const handleBlur: FocusEventHandler<HTMLInputElement> = (event) => {\n      // Blur fires regardless of permission state — disabled fields\n      // can't be focused, so a blur here implies the field was\n      // interactable. Still audit even if the user didn't change\n      // anything (consumers can filter on `details.changed`).\n      if (!disabled && granted && !readOnly) {\n        emit({\n          component: 'input',\n          action: CANONICAL_ACTIONS.INPUT_BLUR,\n          permissionResult: 'granted',\n          details: { changed: changedSinceFocusRef.current },\n        });\n        if (changedSinceFocusRef.current) {\n          emit({\n            component: 'input',\n            action: CANONICAL_ACTIONS.INPUT_CHANGE,\n            permissionResult: 'granted',\n          });\n        }\n      }\n      onBlur?.(event);\n    };\n\n    const permissionDataState =\n      !granted && mode !== 'hidden' ? 'denied' : undefined;\n\n    const resolvedTitle =\n      rest.title ?? (permissionDataState && denyReason ? denyReason : undefined);\n\n    return (\n      <input\n        {...rest}\n        ref={ref}\n        value={value}\n        defaultValue={defaultValue}\n        disabled={isDisabled}\n        readOnly={isReadOnly}\n        aria-disabled={isDisabled || undefined}\n        aria-readonly={isReadOnly || undefined}\n        aria-invalid={invalid || undefined}\n        data-oshon-primitive=\"input\"\n        data-permission-state={permissionDataState}\n        title={resolvedTitle}\n        onChange={handleChange}\n        onFocus={handleFocus}\n        onBlur={handleBlur}\n      />\n    );\n  },\n);\n","/**\n * Toggle — headless proprietary primitive.\n *\n * A binary on/off control rendered as `<button role=\"switch\">` with\n * `aria-checked`. Following WAI-ARIA Authoring Practices 1.3 §3.23\n * (\"Switch Pattern\") — a switch is keyboard-equivalent to a checkbox\n * (Space/Enter toggles, Tab navigates) but communicates a distinct\n * \"on/off state of a single option\" semantic to assistive tech.\n *\n * Client component (consumes `PermissionContext` + `AuditContext`).\n *\n * Contracts honored:\n *   - Permission gate via `can('toggle', resource, attrs)`. Denied\n *     presentations collapse like Button: `disabled` → native disabled,\n *     `readOnly` → visible + non-mutating, `hidden` → null.\n *   - Canonical `toggle:change` audit on state flip; `permission:denied`\n *     on blocked flip in readOnly mode.\n *   - `data-oshon-primitive=\"toggle\"` + `data-permission-state` styling\n *     hooks; `data-state=\"on\"|\"off\"` for the two states.\n *\n * Proprietary rather than Radix-wrapped because switch semantics are\n * narrow enough that a native `<button>` + `aria-checked` is a complete,\n * well-specified pattern. Same rubric as Button (ADR-001).\n */\n\n'use client';\n\nimport { forwardRef, useState } from 'react';\nimport type {\n  ButtonHTMLAttributes,\n  MouseEventHandler,\n  ReactNode,\n  Ref,\n} from 'react';\nimport {\n  evaluatePermission,\n  resolvePermissions,\n  usePermissions,\n  useAudit,\n  type PermissionContext,\n} from '../context.js';\nimport { CANONICAL_ACTIONS } from '../actions.js';\n\ntype NativeButtonProps = Omit<\n  ButtonHTMLAttributes<HTMLButtonElement>,\n  'type' | 'disabled' | 'role' | 'aria-checked' | 'aria-pressed'\n>;\n\nexport interface ToggleProps extends NativeButtonProps {\n  /**\n   * Controlled on/off state. Mutually exclusive with `defaultChecked`.\n   * When provided, the primitive is fully controlled — the consumer\n   * manages state and responds to `onCheckedChange` to update it.\n   */\n  checked?: boolean;\n  /**\n   * Initial state for uncontrolled mode. Primitive owns its own state;\n   * consumer reads it only via `onCheckedChange`.\n   */\n  defaultChecked?: boolean;\n  /**\n   * Fires whenever the switch flips. `next` is the new state. Not called\n   * when a flip attempt is denied by permissions or blocked by\n   * disabled/loading.\n   */\n  onCheckedChange?: (next: boolean) => void;\n  /**\n   * Disable the toggle. Renders with native `disabled` + `aria-disabled`.\n   * No flip, no audit.\n   */\n  disabled?: boolean;\n  /**\n   * Visible label for assistive tech. Either pass `children` (the label\n   * is read as the button's accessible name) or an `aria-label` / use an\n   * external `<label htmlFor>` + `id`. For icon-only toggles, always use\n   * `aria-label`.\n   */\n  children?: ReactNode;\n  /** Per-instance permission override; merges over context. */\n  permissions?: Partial<PermissionContext>;\n  /**\n   * Resource name for `permissions.can('toggle', resource, attrs)`.\n   * Default `'toggle'`. Override for specific semantics, e.g.\n   * `resource=\"settings:notifications\"`.\n   */\n  resource?: string;\n  /** Attribute bag for attribute-based access control. */\n  permissionAttrs?: Record<string, unknown>;\n}\n\n/**\n * Headless switch/toggle. Accessible `<button role=\"switch\">` with:\n *   - `aria-checked` synchronised with state\n *   - `disabled` + `aria-disabled` synchronised\n *   - Permission gating via `can('toggle', resource, attrs)` with three\n *     modes (disabled / readOnly / hidden)\n *   - Canonical `toggle:change` audit on flip; `permission:denied` on\n *     blocked flip in readOnly mode\n *   - `data-oshon-primitive=\"toggle\"` + `data-state=\"on\"|\"off\"` +\n *     `data-permission-state` styling hooks\n *   - No visual styling — consumers supply their own className / styles.\n *\n * Keyboard: native browser behavior — Enter + Space activate (flip).\n *\n * Controlled vs. uncontrolled: pass `checked` for controlled,\n * `defaultChecked` for uncontrolled. Only one at a time.\n */\nexport const Toggle = forwardRef<HTMLButtonElement, ToggleProps>(\n  function Toggle(\n    {\n      checked,\n      defaultChecked = false,\n      onCheckedChange,\n      disabled = false,\n      children,\n      permissions,\n      resource = 'toggle',\n      permissionAttrs,\n      onClick,\n      ...rest\n    }: ToggleProps,\n    ref: Ref<HTMLButtonElement>,\n  ) {\n    const isControlled = checked !== undefined;\n    const [internal, setInternal] = useState(defaultChecked);\n    const current = isControlled ? (checked as boolean) : internal;\n\n    const contextPermissions = usePermissions();\n    const effective = resolvePermissions(permissions, contextPermissions);\n    const mode = effective.mode ?? 'disabled';\n    const emit = useAudit();\n\n    const { granted, denyReason } = evaluatePermission(\n      effective,\n      'toggle',\n      resource,\n      permissionAttrs,\n    );\n\n    if (!granted && mode === 'hidden') return null;\n\n    const permissionBlocks = !granted && mode !== 'readOnly';\n    const isDisabled = disabled || permissionBlocks;\n\n    const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n      if (disabled) return;\n\n      if (!granted) {\n        emit({\n          component: 'toggle',\n          action: CANONICAL_ACTIONS.PERMISSION_DENIED,\n          permissionResult: 'denied',\n          ...(denyReason ? { denyReason } : {}),\n          details: { attemptedAction: 'toggle', resource },\n        });\n        // readOnly: visible but non-mutating. No state change, no\n        // onCheckedChange call, no onClick forward.\n        return;\n      }\n\n      const next = !current;\n      if (!isControlled) setInternal(next);\n\n      emit({\n        component: 'toggle',\n        action: CANONICAL_ACTIONS.TOGGLE_CHANGE,\n        permissionResult: 'granted',\n        details: { from: current, to: next },\n      });\n\n      onCheckedChange?.(next);\n      onClick?.(event);\n    };\n\n    const permissionDataState =\n      !granted && mode !== 'hidden' ? 'denied' : undefined;\n\n    const resolvedTitle =\n      rest.title ?? (permissionDataState && denyReason ? denyReason : undefined);\n\n    return (\n      <button\n        {...rest}\n        ref={ref}\n        type=\"button\"\n        role=\"switch\"\n        aria-checked={current}\n        disabled={isDisabled}\n        aria-disabled={isDisabled || undefined}\n        data-oshon-primitive=\"toggle\"\n        data-state={current ? 'on' : 'off'}\n        data-permission-state={permissionDataState}\n        title={resolvedTitle}\n        onClick={handleClick}\n      >\n        {children}\n      </button>\n    );\n  },\n);\n","/**\n * Popover — headless primitive wrapping Radix Popover.\n *\n * Radix's Popover owns focus management, collision detection, portal,\n * ESC-to-close, and click-outside behavior (ARCHITECTURE §6). We wrap\n * thinly:\n *   - Permission gating on <Root> (denied → null + permission:denied\n *     audit; any mode collapses to null for a popover that has no useful\n *     visible-but-inert state)\n *   - Audit events on open / close\n *   - `data-oshon-primitive=\"popover-*\"` styling hooks\n *\n * \"use client\" mandatory — Radix uses hooks + DOM APIs internally.\n */\n\n'use client';\n\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { forwardRef } from 'react';\nimport type {\n  ComponentPropsWithoutRef,\n  ElementRef,\n  ReactNode,\n} from 'react';\nimport {\n  evaluatePermission,\n  resolvePermissions,\n  usePermissions,\n  useAudit,\n  type PermissionContext,\n} from '../context.js';\nimport { CANONICAL_ACTIONS } from '../actions.js';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Root\n\nexport interface PopoverRootProps\n  extends Omit<RadixPopover.PopoverProps, 'onOpenChange'> {\n  /**\n   * Fires whenever the popover's open state changes. The primitive fires\n   * `popover:open` / `popover:close` audit events automatically before\n   * this callback runs.\n   */\n  onOpenChange?: (open: boolean) => void;\n  /**\n   * Per-instance permission override. Merges over the ambient\n   * `PermissionContext`. Denied + any mode returns `null` (popovers, like\n   * dialogs, have no useful visible-but-inert state) and emits a\n   * `permission:denied` audit.\n   */\n  permissions?: Partial<PermissionContext>;\n  /**\n   * Resource name for `permissions.can('view', resource, attrs)`.\n   * Default `'popover'`. Override for specific semantics, e.g.\n   * `resource=\"record:quick-actions\"`.\n   */\n  resource?: string;\n  /** Attribute bag for attribute-based access control. */\n  permissionAttrs?: Record<string, unknown>;\n  children: ReactNode;\n}\n\n/**\n * Popover root. Controls open state, gates on permissions, fires audit\n * events. Must wrap every other `Popover.*` sub-component.\n */\nfunction Root({\n  children,\n  open,\n  defaultOpen,\n  onOpenChange,\n  permissions,\n  resource = 'popover',\n  permissionAttrs,\n  modal,\n}: PopoverRootProps) {\n  const context = usePermissions();\n  const effective = resolvePermissions(permissions, context);\n  const emit = useAudit();\n\n  const { granted, denyReason } = evaluatePermission(\n    effective,\n    'view',\n    resource,\n    permissionAttrs,\n  );\n\n  if (!granted) {\n    emit({\n      component: 'popover',\n      action: CANONICAL_ACTIONS.PERMISSION_DENIED,\n      permissionResult: 'denied',\n      ...(denyReason ? { denyReason } : {}),\n      details: { attemptedAction: 'view', resource },\n    });\n    return null;\n  }\n\n  const handleOpenChange = (next: boolean) => {\n    emit({\n      component: 'popover',\n      action: next\n        ? CANONICAL_ACTIONS.POPOVER_OPEN\n        : CANONICAL_ACTIONS.POPOVER_CLOSE,\n      permissionResult: 'granted',\n    });\n    onOpenChange?.(next);\n  };\n\n  return (\n    <RadixPopover.Root\n      open={open}\n      defaultOpen={defaultOpen}\n      onOpenChange={handleOpenChange}\n      modal={modal}\n    >\n      {children}\n    </RadixPopover.Root>\n  );\n}\nRoot.displayName = 'Popover.Root';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Trigger\n\nexport type PopoverTriggerProps = ComponentPropsWithoutRef<typeof RadixPopover.Trigger>;\n\nconst Trigger = forwardRef<\n  ElementRef<typeof RadixPopover.Trigger>,\n  PopoverTriggerProps\n>(function PopoverTrigger(props, ref) {\n  return (\n    <RadixPopover.Trigger\n      ref={ref}\n      data-oshon-primitive=\"popover-trigger\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Anchor\n\nexport type PopoverAnchorProps = ComponentPropsWithoutRef<typeof RadixPopover.Anchor>;\n\n/**\n * Anchor. Optional — when present, positions the popover relative to an\n * element separate from the trigger. Useful for context menus anchored\n * to a cursor position or cell.\n */\nconst Anchor = forwardRef<\n  ElementRef<typeof RadixPopover.Anchor>,\n  PopoverAnchorProps\n>(function PopoverAnchor(props, ref) {\n  return (\n    <RadixPopover.Anchor\n      ref={ref}\n      data-oshon-primitive=\"popover-anchor\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Portal\n\nexport type PopoverPortalProps = RadixPopover.PopoverPortalProps;\n\nfunction Portal(props: PopoverPortalProps) {\n  return <RadixPopover.Portal {...props} />;\n}\nPortal.displayName = 'Popover.Portal';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Content\n\nexport type PopoverContentProps = ComponentPropsWithoutRef<typeof RadixPopover.Content>;\n\n/**\n * Content. Radix handles positioning, collision, focus return, ESC-to-close,\n * click-outside, and `role=\"dialog\"` for non-modal popovers. We add only\n * the styling hook.\n */\nconst Content = forwardRef<\n  ElementRef<typeof RadixPopover.Content>,\n  PopoverContentProps\n>(function PopoverContent(props, ref) {\n  return (\n    <RadixPopover.Content\n      ref={ref}\n      data-oshon-primitive=\"popover-content\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Close\n\nexport type PopoverCloseProps = ComponentPropsWithoutRef<typeof RadixPopover.Close>;\n\nconst Close = forwardRef<\n  ElementRef<typeof RadixPopover.Close>,\n  PopoverCloseProps\n>(function PopoverClose(props, ref) {\n  return (\n    <RadixPopover.Close\n      ref={ref}\n      data-oshon-primitive=\"popover-close\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Arrow\n\nexport type PopoverArrowProps = ComponentPropsWithoutRef<typeof RadixPopover.Arrow>;\n\nconst Arrow = forwardRef<\n  ElementRef<typeof RadixPopover.Arrow>,\n  PopoverArrowProps\n>(function PopoverArrow(props, ref) {\n  return (\n    <RadixPopover.Arrow\n      ref={ref}\n      data-oshon-primitive=\"popover-arrow\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Compound export\n\n/**\n * Compound Popover primitive. Use as:\n *\n *   <Popover.Root>\n *     <Popover.Trigger>Open</Popover.Trigger>\n *     <Popover.Portal>\n *       <Popover.Content>\n *         <p>Popover content</p>\n *         <Popover.Close>Close</Popover.Close>\n *       </Popover.Content>\n *     </Popover.Portal>\n *   </Popover.Root>\n */\nexport const Popover = {\n  Root,\n  Trigger,\n  Anchor,\n  Portal,\n  Content,\n  Close,\n  Arrow,\n};\n\nexport type PopoverProps = PopoverRootProps;\n","/**\n * Tabs — headless primitive wrapping Radix Tabs.\n *\n * Radix's Tabs owns the WAI-ARIA Tabs pattern: `role=\"tablist\"` /\n * `role=\"tab\"` / `role=\"tabpanel\"` wiring, arrow-key + Home/End\n * navigation, automatic vs. manual activation modes, and\n * `aria-controls` / `aria-labelledby` pairing (ARCHITECTURE §6). We\n * wrap thinly:\n *   - Permission gating on <Root> (denied → null + permission:denied)\n *   - Audit emission on tab change (`tabs:change`)\n *   - `data-oshon-primitive=\"tabs-*\"` styling hooks\n *\n * \"use client\" mandatory — Radix uses hooks + DOM APIs internally.\n */\n\n'use client';\n\nimport * as RadixTabs from '@radix-ui/react-tabs';\nimport { forwardRef } from 'react';\nimport type {\n  ComponentPropsWithoutRef,\n  ElementRef,\n  ReactNode,\n} from 'react';\nimport {\n  evaluatePermission,\n  resolvePermissions,\n  usePermissions,\n  useAudit,\n  type PermissionContext,\n} from '../context.js';\nimport { CANONICAL_ACTIONS } from '../actions.js';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Root\n\nexport interface TabsRootProps\n  extends Omit<RadixTabs.TabsProps, 'onValueChange'> {\n  /**\n   * Fires whenever the active tab changes. The primitive fires\n   * `tabs:change` audit automatically before this callback runs.\n   */\n  onValueChange?: (value: string) => void;\n  /**\n   * Per-instance permission override. Merges over the ambient\n   * `PermissionContext`. Denied + any mode hides the entire tabs\n   * surface — tabs are navigation scaffolding; no useful visible-but-\n   * inert state — and emits a `permission:denied` audit.\n   */\n  permissions?: Partial<PermissionContext>;\n  /**\n   * Resource name for `permissions.can('view', resource, attrs)`.\n   * Default `'tabs'`. Override for e.g. `resource=\"admin:settings-tabs\"`.\n   */\n  resource?: string;\n  /** Attribute bag for attribute-based access control. */\n  permissionAttrs?: Record<string, unknown>;\n  children: ReactNode;\n}\n\n/**\n * Tabs root. Orchestrates the tablist + panels, gates on permissions,\n * fires `tabs:change` audit. Must wrap `Tabs.List` + `Tabs.Trigger*` +\n * `Tabs.Content*`.\n */\nfunction Root({\n  children,\n  value,\n  defaultValue,\n  onValueChange,\n  permissions,\n  resource = 'tabs',\n  permissionAttrs,\n  orientation,\n  dir,\n  activationMode,\n  ...rest\n}: TabsRootProps) {\n  const context = usePermissions();\n  const effective = resolvePermissions(permissions, context);\n  const emit = useAudit();\n\n  const { granted, denyReason } = evaluatePermission(\n    effective,\n    'view',\n    resource,\n    permissionAttrs,\n  );\n\n  if (!granted) {\n    emit({\n      component: 'tabs',\n      action: CANONICAL_ACTIONS.PERMISSION_DENIED,\n      permissionResult: 'denied',\n      ...(denyReason ? { denyReason } : {}),\n      details: { attemptedAction: 'view', resource },\n    });\n    return null;\n  }\n\n  const handleValueChange = (next: string) => {\n    emit({\n      component: 'tabs',\n      action: CANONICAL_ACTIONS.TABS_CHANGE,\n      permissionResult: 'granted',\n      details: { value: next },\n    });\n    onValueChange?.(next);\n  };\n\n  return (\n    <RadixTabs.Root\n      value={value}\n      defaultValue={defaultValue}\n      onValueChange={handleValueChange}\n      orientation={orientation}\n      dir={dir}\n      activationMode={activationMode}\n      data-oshon-primitive=\"tabs-root\"\n      {...rest}\n    >\n      {children}\n    </RadixTabs.Root>\n  );\n}\nRoot.displayName = 'Tabs.Root';\n\n// ────────────────────────────────────────────────────────────────────────────\n// List\n\nexport type TabsListProps = ComponentPropsWithoutRef<typeof RadixTabs.List>;\n\nconst List = forwardRef<ElementRef<typeof RadixTabs.List>, TabsListProps>(\n  function TabsList(props, ref) {\n    return (\n      <RadixTabs.List\n        ref={ref}\n        data-oshon-primitive=\"tabs-list\"\n        {...props}\n      />\n    );\n  },\n);\n\n// ────────────────────────────────────────────────────────────────────────────\n// Trigger\n\nexport type TabsTriggerProps = ComponentPropsWithoutRef<typeof RadixTabs.Trigger>;\n\nconst Trigger = forwardRef<\n  ElementRef<typeof RadixTabs.Trigger>,\n  TabsTriggerProps\n>(function TabsTrigger(props, ref) {\n  return (\n    <RadixTabs.Trigger\n      ref={ref}\n      data-oshon-primitive=\"tabs-trigger\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Content\n\nexport type TabsContentProps = ComponentPropsWithoutRef<typeof RadixTabs.Content>;\n\nconst Content = forwardRef<\n  ElementRef<typeof RadixTabs.Content>,\n  TabsContentProps\n>(function TabsContent(props, ref) {\n  return (\n    <RadixTabs.Content\n      ref={ref}\n      data-oshon-primitive=\"tabs-content\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Compound export\n\n/**\n * Compound Tabs primitive. Use as:\n *\n *   <Tabs.Root defaultValue=\"overview\">\n *     <Tabs.List>\n *       <Tabs.Trigger value=\"overview\">Overview</Tabs.Trigger>\n *       <Tabs.Trigger value=\"activity\">Activity</Tabs.Trigger>\n *     </Tabs.List>\n *     <Tabs.Content value=\"overview\">…</Tabs.Content>\n *     <Tabs.Content value=\"activity\">…</Tabs.Content>\n *   </Tabs.Root>\n */\nexport const Tabs = {\n  Root,\n  List,\n  Trigger,\n  Content,\n};\n\nexport type TabsProps = TabsRootProps;\n","/**\n * Select — headless primitive wrapping Radix Select.\n *\n * Radix's Select owns the WAI-ARIA Listbox pattern used for native-like\n * dropdowns: combobox semantics, typeahead, arrow-key navigation,\n * keyboard-only operation, collision detection, portal, and focus\n * return (ARCHITECTURE §6). We wrap thinly:\n *   - Permission gating on <Root> (denied → null + permission:denied\n *     audit; no useful visible-but-inert state)\n *   - Audit on open / close (`select:open` / `select:close`) and on\n *     value change (`select:change`)\n *   - `data-oshon-primitive=\"select-*\"` styling hooks\n *\n * \"use client\" mandatory — Radix uses hooks + DOM APIs internally.\n */\n\n'use client';\n\nimport * as RadixSelect from '@radix-ui/react-select';\nimport { forwardRef } from 'react';\nimport type {\n  ComponentPropsWithoutRef,\n  ElementRef,\n  ReactNode,\n} from 'react';\nimport {\n  evaluatePermission,\n  resolvePermissions,\n  usePermissions,\n  useAudit,\n  type PermissionContext,\n} from '../context.js';\nimport { CANONICAL_ACTIONS } from '../actions.js';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Root\n\nexport interface SelectRootProps\n  extends Omit<RadixSelect.SelectProps, 'onOpenChange' | 'onValueChange'> {\n  /**\n   * Fires whenever the select's open state changes. Primitive emits\n   * `select:open` / `select:close` audit before the callback runs.\n   */\n  onOpenChange?: (open: boolean) => void;\n  /**\n   * Fires whenever the user picks a value. Primitive emits\n   * `select:change` audit with `{ value }` details before the callback\n   * runs.\n   */\n  onValueChange?: (value: string) => void;\n  /**\n   * Per-instance permission override. Merges over the ambient\n   * `PermissionContext`. Denied → primitive returns null (a select has\n   * no useful visible-but-inert state — the components layer can render\n   * a static readout for that case) and emits `permission:denied`.\n   */\n  permissions?: Partial<PermissionContext>;\n  /**\n   * Resource name for `permissions.can('view', resource, attrs)`.\n   * Default `'select'`. Override for e.g. `resource=\"field:status\"`.\n   */\n  resource?: string;\n  /** Attribute bag for attribute-based access control. */\n  permissionAttrs?: Record<string, unknown>;\n  children: ReactNode;\n}\n\nfunction Root({\n  children,\n  value,\n  defaultValue,\n  onValueChange,\n  open,\n  defaultOpen,\n  onOpenChange,\n  permissions,\n  resource = 'select',\n  permissionAttrs,\n  ...rest\n}: SelectRootProps) {\n  const context = usePermissions();\n  const effective = resolvePermissions(permissions, context);\n  const emit = useAudit();\n\n  const { granted, denyReason } = evaluatePermission(\n    effective,\n    'view',\n    resource,\n    permissionAttrs,\n  );\n\n  if (!granted) {\n    emit({\n      component: 'select',\n      action: CANONICAL_ACTIONS.PERMISSION_DENIED,\n      permissionResult: 'denied',\n      ...(denyReason ? { denyReason } : {}),\n      details: { attemptedAction: 'view', resource },\n    });\n    return null;\n  }\n\n  const handleOpenChange = (next: boolean) => {\n    emit({\n      component: 'select',\n      action: next ? CANONICAL_ACTIONS.SELECT_OPEN : CANONICAL_ACTIONS.SELECT_CLOSE,\n      permissionResult: 'granted',\n    });\n    onOpenChange?.(next);\n  };\n\n  const handleValueChange = (next: string) => {\n    emit({\n      component: 'select',\n      action: CANONICAL_ACTIONS.SELECT_CHANGE,\n      permissionResult: 'granted',\n      details: { value: next },\n    });\n    onValueChange?.(next);\n  };\n\n  return (\n    <RadixSelect.Root\n      value={value}\n      defaultValue={defaultValue}\n      onValueChange={handleValueChange}\n      open={open}\n      defaultOpen={defaultOpen}\n      onOpenChange={handleOpenChange}\n      {...rest}\n    >\n      {children}\n    </RadixSelect.Root>\n  );\n}\nRoot.displayName = 'Select.Root';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Trigger\n\nexport type SelectTriggerProps = ComponentPropsWithoutRef<typeof RadixSelect.Trigger>;\n\nconst Trigger = forwardRef<\n  ElementRef<typeof RadixSelect.Trigger>,\n  SelectTriggerProps\n>(function SelectTrigger(props, ref) {\n  return (\n    <RadixSelect.Trigger\n      ref={ref}\n      data-oshon-primitive=\"select-trigger\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Value\n\nexport type SelectValueProps = ComponentPropsWithoutRef<typeof RadixSelect.Value>;\n\n/**\n * Reads the currently-selected item's text content. Radix renders a\n * `<span>` with `data-placeholder` when no value is set — the\n * components layer styles both states.\n */\nconst Value = forwardRef<\n  ElementRef<typeof RadixSelect.Value>,\n  SelectValueProps\n>(function SelectValue(props, ref) {\n  return <RadixSelect.Value ref={ref} {...props} />;\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Icon\n\nexport type SelectIconProps = ComponentPropsWithoutRef<typeof RadixSelect.Icon>;\n\nconst Icon = forwardRef<\n  ElementRef<typeof RadixSelect.Icon>,\n  SelectIconProps\n>(function SelectIcon(props, ref) {\n  return (\n    <RadixSelect.Icon\n      ref={ref}\n      data-oshon-primitive=\"select-icon\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Portal\n\nexport type SelectPortalProps = RadixSelect.SelectPortalProps;\n\nfunction Portal(props: SelectPortalProps) {\n  return <RadixSelect.Portal {...props} />;\n}\nPortal.displayName = 'Select.Portal';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Content\n\nexport type SelectContentProps = ComponentPropsWithoutRef<typeof RadixSelect.Content>;\n\nconst Content = forwardRef<\n  ElementRef<typeof RadixSelect.Content>,\n  SelectContentProps\n>(function SelectContent(props, ref) {\n  return (\n    <RadixSelect.Content\n      ref={ref}\n      data-oshon-primitive=\"select-content\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Viewport\n\nexport type SelectViewportProps = ComponentPropsWithoutRef<typeof RadixSelect.Viewport>;\n\nconst Viewport = forwardRef<\n  ElementRef<typeof RadixSelect.Viewport>,\n  SelectViewportProps\n>(function SelectViewport(props, ref) {\n  return (\n    <RadixSelect.Viewport\n      ref={ref}\n      data-oshon-primitive=\"select-viewport\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Item\n\nexport type SelectItemProps = ComponentPropsWithoutRef<typeof RadixSelect.Item>;\n\nconst Item = forwardRef<\n  ElementRef<typeof RadixSelect.Item>,\n  SelectItemProps\n>(function SelectItem(props, ref) {\n  return (\n    <RadixSelect.Item\n      ref={ref}\n      data-oshon-primitive=\"select-item\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// ItemText / ItemIndicator / Separator / Group / Label\n\nexport type SelectItemTextProps = ComponentPropsWithoutRef<typeof RadixSelect.ItemText>;\n\nconst ItemText = forwardRef<\n  ElementRef<typeof RadixSelect.ItemText>,\n  SelectItemTextProps\n>(function SelectItemText(props, ref) {\n  return <RadixSelect.ItemText ref={ref} {...props} />;\n});\n\nexport type SelectItemIndicatorProps = ComponentPropsWithoutRef<typeof RadixSelect.ItemIndicator>;\n\nconst ItemIndicator = forwardRef<\n  ElementRef<typeof RadixSelect.ItemIndicator>,\n  SelectItemIndicatorProps\n>(function SelectItemIndicator(props, ref) {\n  return (\n    <RadixSelect.ItemIndicator\n      ref={ref}\n      data-oshon-primitive=\"select-item-indicator\"\n      {...props}\n    />\n  );\n});\n\nexport type SelectSeparatorProps = ComponentPropsWithoutRef<typeof RadixSelect.Separator>;\n\nconst Separator = forwardRef<\n  ElementRef<typeof RadixSelect.Separator>,\n  SelectSeparatorProps\n>(function SelectSeparator(props, ref) {\n  return (\n    <RadixSelect.Separator\n      ref={ref}\n      data-oshon-primitive=\"select-separator\"\n      {...props}\n    />\n  );\n});\n\nexport type SelectGroupProps = ComponentPropsWithoutRef<typeof RadixSelect.Group>;\n\nconst Group = forwardRef<\n  ElementRef<typeof RadixSelect.Group>,\n  SelectGroupProps\n>(function SelectGroup(props, ref) {\n  return <RadixSelect.Group ref={ref} {...props} />;\n});\n\nexport type SelectLabelProps = ComponentPropsWithoutRef<typeof RadixSelect.Label>;\n\nconst Label = forwardRef<\n  ElementRef<typeof RadixSelect.Label>,\n  SelectLabelProps\n>(function SelectLabel(props, ref) {\n  return (\n    <RadixSelect.Label\n      ref={ref}\n      data-oshon-primitive=\"select-label\"\n      {...props}\n    />\n  );\n});\n\n// ────────────────────────────────────────────────────────────────────────────\n// Compound export\n\n/**\n * Compound Select primitive. Use as:\n *\n *   <Select.Root defaultValue=\"open\">\n *     <Select.Trigger aria-label=\"Status\">\n *       <Select.Value placeholder=\"Select…\" />\n *       <Select.Icon>▾</Select.Icon>\n *     </Select.Trigger>\n *     <Select.Portal>\n *       <Select.Content>\n *         <Select.Viewport>\n *           <Select.Item value=\"open\">\n *             <Select.ItemText>Open</Select.ItemText>\n *             <Select.ItemIndicator>✓</Select.ItemIndicator>\n *           </Select.Item>\n *           <Select.Item value=\"closed\">\n *             <Select.ItemText>Closed</Select.ItemText>\n *           </Select.Item>\n *         </Select.Viewport>\n *       </Select.Content>\n *     </Select.Portal>\n *   </Select.Root>\n */\nexport const Select = {\n  Root,\n  Trigger,\n  Value,\n  Icon,\n  Portal,\n  Content,\n  Viewport,\n  Item,\n  ItemText,\n  ItemIndicator,\n  Separator,\n  Group,\n  Label,\n};\n\nexport type SelectProps = SelectRootProps;\n","/**\n * @oshon-ai/primitives — component manifest contract.\n *\n * Ported verbatim from MCP_SCHEMA.md §6. Every shipping component in\n * `@oshon-ai/primitives` and `@oshon-ai/components` declares a manifest\n * validated against `ComponentManifestSchema` at test time; downstream\n * tooling (MCP server, Figma Code Connect, docs generator, Skills bundle)\n * consumes the same schema to render the component without hand-rolled\n * metadata per surface.\n *\n * This is principle #8 (\"manifest-driven\") and principle #9 (\"trust-\n * boundary Zod\") from the Oshon engineering principles.\n */\n\nimport { z } from 'zod';\n\n/** Six density regimes defined by ARCHITECTURE.md §8 principle #1. */\nexport const DENSITY_REGIMES = [\n  'card',\n  'standard',\n  'paginated',\n  'virtualized',\n  'server',\n  'infinite',\n] as const;\n\nexport const ComponentManifestSchema = z.object({\n  name: z.string(),\n  package: z.string(),\n  version: z.string(),\n  license: z.enum(['MIT', 'commercial']),\n  purpose: z.string().min(10).max(280),\n  dataShape: z\n    .object({\n      primary: z.string(),\n      secondary: z.string().optional(),\n    })\n    .optional(),\n  densitySupport: z.array(z.enum(DENSITY_REGIMES)).optional(),\n  permissionsRequired: z.array(z.string()).default([]),\n  permissionsOptional: z.array(z.string()).default([]),\n  auditEvents: z.array(z.string()).default([]),\n  a11y: z.object({\n    wcagLevel: z.string(),\n    keyboardMap: z.string(),\n    screenReadersTested: z.array(z.string()),\n    lastAudit: z.string(),\n  }),\n  variants: z\n    .array(\n      z.object({\n        name: z.string(),\n        description: z.string(),\n      }),\n    )\n    .default([]),\n  slots: z\n    .array(\n      z.object({\n        name: z.string(),\n        description: z.string(),\n      }),\n    )\n    .default([]),\n  doExamples: z\n    .array(\n      z.object({\n        label: z.string(),\n        code: z.string(),\n      }),\n    )\n    .default([]),\n  dontExamples: z\n    .array(\n      z.object({\n        label: z.string(),\n        code: z.string(),\n        why: z.string(),\n      }),\n    )\n    .default([]),\n  figmaNode: z.string().optional(),\n  designRationale: z.string(),\n  relatedComponents: z.array(z.string()).default([]),\n  breakingChanges: z\n    .array(\n      z.object({\n        version: z.string(),\n        change: z.string(),\n        migration: z.string(),\n      }),\n    )\n    .default([]),\n});\n\nexport type ComponentManifest = z.infer<typeof ComponentManifestSchema>;\nexport type ComponentManifestInput = z.input<typeof ComponentManifestSchema>;\n\n/**\n * Validate a manifest and throw a descriptive error if it fails. Designed\n * for `scripts/validate-manifests.mjs` and per-primitive tests — failures\n * carry the full Zod issue list so the author knows exactly what's wrong.\n */\nexport function assertValidManifest(\n  manifest: unknown,\n  context: string,\n): ComponentManifest {\n  const result = ComponentManifestSchema.safeParse(manifest);\n  if (!result.success) {\n    const issues = result.error.issues\n      .map((issue) => `  - ${issue.path.join('.')}: ${issue.message}`)\n      .join('\\n');\n    throw new Error(\n      `Invalid ComponentManifest (${context}):\\n${issues}`,\n    );\n  }\n  return result.data;\n}\n"]}