@alfadocs/ui-kit-debug 0.84.1 → 0.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/_chunks/actions-cell-renderer-DaL80uqL.js.map +1 -1
  2. package/dist/_chunks/{ai-consent-banner-DUhr1yNj.js → ai-consent-banner-BXD7W6FI.js} +2 -2
  3. package/dist/_chunks/{ai-consent-banner-DUhr1yNj.js.map → ai-consent-banner-BXD7W6FI.js.map} +1 -1
  4. package/dist/_chunks/{alert-KJbsPYkI.js → alert-Cxaqd-QO.js} +12 -12
  5. package/dist/_chunks/alert-Cxaqd-QO.js.map +1 -0
  6. package/dist/_chunks/anamnesis-card-CJ5MNbkc.js.map +1 -1
  7. package/dist/_chunks/{audio-recorder-Cc3KuL9y.js → audio-recorder-BjnB7V8n.js} +2 -2
  8. package/dist/_chunks/{audio-recorder-Cc3KuL9y.js.map → audio-recorder-BjnB7V8n.js.map} +1 -1
  9. package/dist/_chunks/{booking-CLmeXtGv.js → booking-BvCu2XWY.js} +2 -2
  10. package/dist/_chunks/{booking-CLmeXtGv.js.map → booking-BvCu2XWY.js.map} +1 -1
  11. package/dist/_chunks/breadcrumb-agut0PwN.js.map +1 -1
  12. package/dist/_chunks/calendar-event-card-C6qGtywL.js.map +1 -1
  13. package/dist/_chunks/chat-input-QpHxBEnN.js.map +1 -1
  14. package/dist/_chunks/chat-message-CdjWqZjo.js.map +1 -1
  15. package/dist/_chunks/checkbox-group-CfqMv57d.js.map +1 -1
  16. package/dist/_chunks/dependent-selector-DyFpdzZV.js.map +1 -1
  17. package/dist/_chunks/{document-preview-nwfulDEs.js → document-preview-DXl9migE.js} +2 -2
  18. package/dist/_chunks/{document-preview-nwfulDEs.js.map → document-preview-DXl9migE.js.map} +1 -1
  19. package/dist/_chunks/{document-scanner-B6h1Ir56.js → document-scanner-cS_ispQs.js} +3 -3
  20. package/dist/_chunks/document-scanner-cS_ispQs.js.map +1 -0
  21. package/dist/_chunks/editable-currency-cell-renderer-Dus_sBvX.js.map +1 -1
  22. package/dist/_chunks/email-input-Dpe63k0K.js.map +1 -1
  23. package/dist/_chunks/{entity-summary--vP698Jn.js → entity-summary-BILN4wEG.js} +2 -2
  24. package/dist/_chunks/{entity-summary--vP698Jn.js.map → entity-summary-BILN4wEG.js.map} +1 -1
  25. package/dist/_chunks/{field-value-DHG6gEKS.js → field-value-BRVbZJej.js} +133 -144
  26. package/dist/_chunks/field-value-BRVbZJej.js.map +1 -0
  27. package/dist/_chunks/{file-manager-DLJlinIO.js → file-manager-B9LZzT5E.js} +129 -129
  28. package/dist/_chunks/file-manager-B9LZzT5E.js.map +1 -0
  29. package/dist/_chunks/{file-upload-DENvuhfs.js → file-upload-CwxdqkMK.js} +134 -146
  30. package/dist/_chunks/file-upload-CwxdqkMK.js.map +1 -0
  31. package/dist/_chunks/finished-terminal-C0_mefrf.js.map +1 -1
  32. package/dist/_chunks/fiscal-code-input-QP9gkyDE.js.map +1 -1
  33. package/dist/_chunks/form-field-M5UpX65Z.js.map +1 -1
  34. package/dist/_chunks/{freemium-paywall-CmV642PA.js → freemium-paywall-Dr2342_S.js} +2 -2
  35. package/dist/_chunks/{freemium-paywall-CmV642PA.js.map → freemium-paywall-Dr2342_S.js.map} +1 -1
  36. package/dist/_chunks/iban-input-DXIA8Ln_.js.map +1 -1
  37. package/dist/_chunks/{marketplace-app-shell-Br2yebEK.js → marketplace-app-shell-Chcj4q4z.js} +2 -2
  38. package/dist/_chunks/{marketplace-app-shell-Br2yebEK.js.map → marketplace-app-shell-Chcj4q4z.js.map} +1 -1
  39. package/dist/_chunks/message-square-Bye4ATvx.js +20 -0
  40. package/dist/_chunks/message-square-Bye4ATvx.js.map +1 -0
  41. package/dist/_chunks/{notes-panel-Cvdp818a.js → notes-panel-BLjlYBt-.js} +2 -2
  42. package/dist/_chunks/{notes-panel-Cvdp818a.js.map → notes-panel-BLjlYBt-.js.map} +1 -1
  43. package/dist/_chunks/pagination-EkD5SiCK.js.map +1 -1
  44. package/dist/_chunks/{patient-details-COvYWp2e.js → patient-details-B9LCdyWW.js} +2 -2
  45. package/dist/_chunks/{patient-details-COvYWp2e.js.map → patient-details-B9LCdyWW.js.map} +1 -1
  46. package/dist/_chunks/{patient-search-BaUJ_Y-N.js → patient-search-vtRTSdf6.js} +2 -2
  47. package/dist/_chunks/{patient-search-BaUJ_Y-N.js.map → patient-search-vtRTSdf6.js.map} +1 -1
  48. package/dist/_chunks/{patient-summary-card-D6kgdTNn.js → patient-summary-card-vn1H4xWj.js} +2 -2
  49. package/dist/_chunks/patient-summary-card-vn1H4xWj.js.map +1 -0
  50. package/dist/_chunks/{patient-table-BHzmUbzu.js → patient-table-B6AKMTm3.js} +182 -196
  51. package/dist/_chunks/patient-table-B6AKMTm3.js.map +1 -0
  52. package/dist/_chunks/{payment-form-DL9xk9BA.js → payment-form-BoGxEmGn.js} +2 -2
  53. package/dist/_chunks/{payment-form-DL9xk9BA.js.map → payment-form-BoGxEmGn.js.map} +1 -1
  54. package/dist/_chunks/{payment-request-card-d-RmzsUd.js → payment-request-card-CygO1anM.js} +72 -70
  55. package/dist/_chunks/payment-request-card-CygO1anM.js.map +1 -0
  56. package/dist/_chunks/{pdf-viewer-DF3VMaPo.js → pdf-viewer-CcOuR2wj.js} +2 -2
  57. package/dist/_chunks/{pdf-viewer-DF3VMaPo.js.map → pdf-viewer-CcOuR2wj.js.map} +1 -1
  58. package/dist/_chunks/postal-code-input-BznBxVxf.js.map +1 -1
  59. package/dist/_chunks/{practice-results-BCr7jMt1.js → practice-results-yKbwIxqa.js} +2 -2
  60. package/dist/_chunks/{practice-results-BCr7jMt1.js.map → practice-results-yKbwIxqa.js.map} +1 -1
  61. package/dist/_chunks/radio-group-CI-6SmSw.js.map +1 -1
  62. package/dist/_chunks/{radiograph-panel.agent-CxF9pVxd.js → radiograph-panel.agent-M9XD4ze4.js} +2 -2
  63. package/dist/_chunks/{radiograph-panel.agent-CxF9pVxd.js.map → radiograph-panel.agent-M9XD4ze4.js.map} +1 -1
  64. package/dist/_chunks/{rich-text-editor-CCWjNkbx.js → rich-text-editor-RRkBN_WB.js} +2 -2
  65. package/dist/_chunks/rich-text-editor-RRkBN_WB.js.map +1 -0
  66. package/dist/_chunks/{session-countdown-C8AsE072.js → session-countdown-Bc70VXN1.js} +58 -48
  67. package/dist/_chunks/session-countdown-Bc70VXN1.js.map +1 -0
  68. package/dist/_chunks/{sign-document-Bfk0WpWV.js → sign-document-DI561d1C.js} +2 -2
  69. package/dist/_chunks/sign-document-DI561d1C.js.map +1 -0
  70. package/dist/_chunks/{signature-request-CEOrCDyk.js → signature-request-D_6jgDZd.js} +60 -77
  71. package/dist/_chunks/signature-request-D_6jgDZd.js.map +1 -0
  72. package/dist/_chunks/task-card-BUgK6yZT.js.map +1 -1
  73. package/dist/_chunks/{task-tray-Br3vc0O1.js → task-tray-CLIqIXUZ.js} +58 -70
  74. package/dist/_chunks/task-tray-CLIqIXUZ.js.map +1 -0
  75. package/dist/_chunks/tasks-panel-CjGAhIN8.js.map +1 -1
  76. package/dist/_chunks/timeline-r-8IUoBS.js.map +1 -1
  77. package/dist/_chunks/{toast.agent-uV8CeAy6.js → toast.agent-Iw2jWdce.js} +2 -2
  78. package/dist/_chunks/{toast.agent-uV8CeAy6.js.map → toast.agent-Iw2jWdce.js.map} +1 -1
  79. package/dist/_chunks/use-password-requirements-Bwtqx1qN.js.map +1 -1
  80. package/dist/_chunks/{warning-stack-BlG_Ujy3.js → warning-stack-CAHQ0xxS.js} +2 -2
  81. package/dist/_chunks/{warning-stack-BlG_Ujy3.js.map → warning-stack-CAHQ0xxS.js.map} +1 -1
  82. package/dist/_chunks/{workflow-map-C643Q43h.js → workflow-map-SIfAhmWz.js} +2 -2
  83. package/dist/_chunks/workflow-map-SIfAhmWz.js.map +1 -0
  84. package/dist/agent-catalog.json +1 -1
  85. package/dist/components/ai-consent-banner/index.js +1 -1
  86. package/dist/components/alert/index.js +1 -1
  87. package/dist/components/audio-recorder/index.js +1 -1
  88. package/dist/components/booking/index.js +1 -1
  89. package/dist/components/document-preview/index.js +1 -1
  90. package/dist/components/document-scanner/index.js +1 -1
  91. package/dist/components/entity-summary/index.js +1 -1
  92. package/dist/components/file-manager/index.js +1 -1
  93. package/dist/components/file-upload/file-upload.d.ts.map +1 -1
  94. package/dist/components/file-upload/index.js +1 -1
  95. package/dist/components/freemium-paywall/index.js +1 -1
  96. package/dist/components/notes-panel/index.js +1 -1
  97. package/dist/components/patient-details/index.js +1 -1
  98. package/dist/components/patient-search/index.js +1 -1
  99. package/dist/components/patient-summary-card/index.js +1 -1
  100. package/dist/components/patient-table/index.js +1 -1
  101. package/dist/components/payment-card/index.js +1 -1
  102. package/dist/components/payment-form/index.js +1 -1
  103. package/dist/components/pdf-viewer/index.js +1 -1
  104. package/dist/components/practice-results/index.js +1 -1
  105. package/dist/components/radiograph-panel/index.js +1 -1
  106. package/dist/components/rich-text-editor/index.js +1 -1
  107. package/dist/components/session-countdown/index.js +1 -1
  108. package/dist/components/sign-document/index.js +1 -1
  109. package/dist/components/task-card/task-card.d.ts.map +1 -1
  110. package/dist/components/task-tray/index.js +1 -1
  111. package/dist/components/toast/index.js +1 -1
  112. package/dist/components/warning-stack/index.js +1 -1
  113. package/dist/components/workflow/index.js +1 -1
  114. package/dist/index.js +434 -445
  115. package/dist/index.js.map +1 -1
  116. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  117. package/dist/patterns/signature-request/index.js +1 -1
  118. package/dist/tokens.css +1 -1
  119. package/package.json +5 -3
  120. package/dist/_chunks/alert-KJbsPYkI.js.map +0 -1
  121. package/dist/_chunks/circle-x-W8Enq3i4.js +0 -16
  122. package/dist/_chunks/circle-x-W8Enq3i4.js.map +0 -1
  123. package/dist/_chunks/document-scanner-B6h1Ir56.js.map +0 -1
  124. package/dist/_chunks/field-value-DHG6gEKS.js.map +0 -1
  125. package/dist/_chunks/file-manager-DLJlinIO.js.map +0 -1
  126. package/dist/_chunks/file-upload-DENvuhfs.js.map +0 -1
  127. package/dist/_chunks/patient-summary-card-D6kgdTNn.js.map +0 -1
  128. package/dist/_chunks/patient-table-BHzmUbzu.js.map +0 -1
  129. package/dist/_chunks/payment-request-card-d-RmzsUd.js.map +0 -1
  130. package/dist/_chunks/rich-text-editor-CCWjNkbx.js.map +0 -1
  131. package/dist/_chunks/session-countdown-C8AsE072.js.map +0 -1
  132. package/dist/_chunks/sign-document-Bfk0WpWV.js.map +0 -1
  133. package/dist/_chunks/signature-request-CEOrCDyk.js.map +0 -1
  134. package/dist/_chunks/task-tray-Br3vc0O1.js.map +0 -1
  135. package/dist/_chunks/workflow-map-C643Q43h.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-countdown-C8AsE072.js","sources":["../../node_modules/lucide-react/dist/esm/icons/timer.mjs","../../src/components/session-countdown/session-countdown.agent.ts","../../src/components/session-countdown/session-countdown.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"line\", { x1: \"10\", x2: \"14\", y1: \"2\", y2: \"2\", key: \"14vaq8\" }],\n [\"line\", { x1: \"12\", x2: \"15\", y1: \"14\", y2: \"11\", key: \"17fdiu\" }],\n [\"circle\", { cx: \"12\", cy: \"14\", r: \"8\", key: \"1e1u0o\" }]\n];\nconst Timer = createLucideIcon(\"timer\", __iconNode);\n\nexport { __iconNode, Timer as default };\n//# sourceMappingURL=timer.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — SessionCountdown. */\n/* */\n/* A live status surface that renders the remaining time of a check-in */\n/* session and escalates tone toward expiry. Pure presentation — it owns */\n/* no consumer-actionable state (the deadline lives with the consumer */\n/* via `remainingMs` / `expiresAt`, and the only interactive element is */\n/* the consumer-wired Restart button). So this adapter registers only */\n/* the canonical `data-component=\"session-countdown\"` DOM hook; the root */\n/* also exposes `data-tone` so a future MCP UI bridge can read the */\n/* running / warning / expired state without parsing the visible digits. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\n\nexport const sessionCountdownAgent: AgentAdapter = {\n id: 'session-countdown',\n capabilities: [],\n state: {},\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'session-countdown',\n description:\n 'Marks the element as a kit SessionCountdown banner. The root also emits `data-tone=\"running\" | \"warning\" | \"expired\"` (derived from the remaining time). The accessible remaining-time announcement is surfaced via the region\\'s aria-label and a nested polite live region.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { TriangleAlert, CircleX, Timer } from 'lucide-react';\nimport { Button } from '../button';\nimport { Progress } from '../progress';\nimport { LiveRegion } from '../live-region';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { sessionCountdownAgent } from './session-countdown.agent';\n\n/* ------------------------------------------------------------------ */\n/* Constants */\n/* ------------------------------------------------------------------ */\n\nconst SECOND_MS = 1000;\nconst MINUTE_MS = 60 * SECOND_MS;\nconst DEFAULT_TOTAL_MS = 15 * MINUTE_MS; // 900_000 — HTP-5118 check-in window\nconst DEFAULT_WARN_AT_MS = 2 * MINUTE_MS; // 120_000 — final 2 minutes\n\n/* ------------------------------------------------------------------ */\n/* CVA — public axis: size (sm | md | lg). The component renders the */\n/* banner as its sole presentation (the former `inline` variant was */\n/* removed — see breaking change note). */\n/* */\n/* `tone` (running | warning | expired) is DERIVED internally from the */\n/* remaining time and is NOT a consumer-set prop (see spec / synthesis */\n/* recommendedAdjustment). It still flows through the CVA recipe as an */\n/* internal variant key so the tone colours stay token-driven and */\n/* mirror Alert's info / warning / error surfaces. */\n/* ------------------------------------------------------------------ */\n\nconst countdownVariants = cva(\n [\n 'ds:break-words',\n 'ds:flex ds:w-full ds:flex-col',\n 'ds:rounded-[var(--radius-md)]',\n 'ds:border ds:border-[length:var(--border-width-sm)]',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:p-[var(--spacing-sm)] ds:gap-[var(--spacing-xs)]',\n md: 'ds:p-[var(--spacing-md)] ds:gap-[var(--spacing-sm)]',\n lg: 'ds:p-[var(--spacing-lg)] ds:gap-[var(--spacing-sm)]',\n },\n // Internal-only — derived from remaining time, never surfaced to Controls.\n tone: {\n running: [\n 'ds:border-[color:var(--info)]',\n 'ds:bg-[color-mix(in_srgb,var(--info)_10%,transparent)]',\n 'ds:text-[color:var(--info-foreground)]',\n ].join(' '),\n warning: [\n 'ds:border-[color:var(--warning)]',\n 'ds:bg-[color-mix(in_srgb,var(--warning)_10%,transparent)]',\n 'ds:text-[color:var(--warning-foreground)]',\n ].join(' '),\n expired: [\n 'ds:border-[color:var(--error)]',\n 'ds:bg-[color-mix(in_srgb,var(--error)_10%,transparent)]',\n 'ds:text-[color:var(--error-foreground)]',\n // The tonal Restart button inherits the error tint via the\n // established Alert child-selector trick — contrast-validated.\n 'ds:[&_[data-intent=tonal]]:bg-[color:var(--error-foreground)]',\n 'ds:[&_[data-intent=tonal]]:text-[color:var(--background)]',\n ].join(' '),\n },\n },\n defaultVariants: {\n size: 'md',\n tone: 'running',\n },\n },\n);\n\nconst ICON_SIZE_CLASS = {\n sm: 'ds:size-4',\n md: 'ds:size-5',\n lg: 'ds:size-6',\n} as const;\n\n/* ------------------------------------------------------------------ */\n/* Derived tone */\n/* ------------------------------------------------------------------ */\n\ntype Tone = 'running' | 'warning' | 'expired';\n\nfunction deriveTone(remaining: number, warnAtMs: number): Tone {\n if (remaining <= 0) return 'expired';\n if (remaining <= warnAtMs) return 'warning';\n return 'running';\n}\n\n/* ------------------------------------------------------------------ */\n/* Announcement bucketing */\n/* */\n/* The visual digits update every second, but AT must hear only coarse */\n/* buckets to avoid flooding: minute boundaries while remaining > 60s, */\n/* then once at 30s and 10s, then expiry. We key the polite */\n/* announcement on the bucket — NOT on the per-second value — so NVDA */\n/* / VoiceOver never interrupt themselves continuously. */\n/* */\n/* The returned value is the count spoken to AT, in SECONDS, and is */\n/* FLOORED to the threshold the user has actually crossed into so the */\n/* announcement never claims MORE time than truly remains (a deadline */\n/* countdown must round down, never up). e.g. at 45s the bucket is 30 */\n/* — \"30 seconds remaining\" — never \"60 seconds\". Above 60s we floor */\n/* to whole minutes (4m37s → 4 minutes), so it re-keys on each minute */\n/* boundary while staying truthful. */\n/* ------------------------------------------------------------------ */\n\nfunction announcementBucket(remaining: number): number {\n if (remaining <= 0) return 0;\n if (remaining <= 30 * SECOND_MS) return 10;\n if (remaining <= 60 * SECOND_MS) return 30;\n // Coarse minute bucket above 60s: 60, 120, 180 … (in seconds), floored\n // so the spoken minute count is always <= the true remaining time.\n return Math.floor(remaining / MINUTE_MS) * 60;\n}\n\n/* ------------------------------------------------------------------ */\n/* Time math */\n/* ------------------------------------------------------------------ */\n\nfunction toEpoch(value: number | string | Date): number {\n if (value instanceof Date) return value.getTime();\n if (typeof value === 'number') return value;\n return new Date(value).getTime();\n}\n\n/**\n * Internal-tick hook for the `expiresAt` path. Returns the live remaining\n * milliseconds (clamped >= 0) and re-renders every `tickMs` until expiry.\n * When `controlledRemaining` is supplied it is the source of truth and the\n * timer never starts — the deterministic path for stories / tests.\n */\nfunction useRemainingMs(\n controlledRemaining: number | undefined,\n expiresAtEpoch: number | undefined,\n tickMs: number,\n): number {\n const [now, setNow] = useState<number>(() => Date.now());\n\n const isControlled = controlledRemaining !== undefined;\n\n useEffect(() => {\n if (isControlled || expiresAtEpoch === undefined) return;\n // Re-sync on mount so a late mount / clock-skew reads correctly.\n setNow(Date.now());\n if (expiresAtEpoch - Date.now() <= 0) return; // already expired — no timer\n const id = window.setInterval(\n () => {\n const current = Date.now();\n setNow(current);\n if (expiresAtEpoch - current <= 0) {\n window.clearInterval(id);\n }\n },\n Math.max(1, tickMs),\n );\n return () => window.clearInterval(id);\n }, [isControlled, expiresAtEpoch, tickMs]);\n\n if (isControlled) return Math.max(0, controlledRemaining);\n if (expiresAtEpoch === undefined) return 0;\n return Math.max(0, expiresAtEpoch - now);\n}\n\n/* ------------------------------------------------------------------ */\n/* Props */\n/* ------------------------------------------------------------------ */\n\ntype CountdownVariantProps = Pick<\n VariantProps<typeof countdownVariants>,\n 'size'\n>;\n\nexport interface SessionCountdownProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'role'>, CountdownVariantProps {\n /** Controlled remaining milliseconds. Source of truth; no internal tick. */\n remainingMs?: number;\n /** Absolute deadline (ms-epoch, ISO string, or Date). Ticks internally. */\n expiresAt?: number | string | Date;\n /** Full session duration in ms — progress denominator. Default 900000. */\n totalMs?: number;\n /** Remaining threshold (ms) at/below which tone escalates to warning. */\n warnAtMs?: number;\n /** Type / padding scale. Default `md`. */\n size?: 'sm' | 'md' | 'lg';\n /** Determinate Progress bar of elapsed fraction. */\n showProgress?: boolean;\n /** Fired exactly once when remaining crosses to 0. Idempotent. */\n onExpire?: () => void;\n /** Restart CTA handler (expired banner). Omit → no button rendered. */\n onRestart?: () => void;\n /** Restart in flight — disables + spins the Restart button. */\n restarting?: boolean;\n /** Internal tick cadence (ms) for the `expiresAt` path. Default 1000. */\n tickMs?: number;\n /** Locale override for number formatting. Falls back to i18n.language. */\n locale?: string;\n /** Override the accessible name of the timer region. */\n label?: string;\n /** Merged onto the outermost element. CVA-composed, never inline style. */\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* SessionCountdown */\n/* ------------------------------------------------------------------ */\n\nexport const SessionCountdown = forwardRef<\n HTMLDivElement,\n SessionCountdownProps\n>(\n (\n {\n remainingMs,\n expiresAt,\n totalMs = DEFAULT_TOTAL_MS,\n warnAtMs = DEFAULT_WARN_AT_MS,\n size = 'md',\n showProgress = false,\n onExpire,\n onRestart,\n restarting = false,\n tickMs = 1000,\n locale: localeProp,\n label,\n className,\n id,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const locale = localeProp ?? i18n.language ?? 'en';\n\n // DEV warning when both controlled + deadline are passed; remainingMs wins.\n useEffect(() => {\n if (\n import.meta.env.DEV &&\n remainingMs !== undefined &&\n expiresAt !== undefined\n ) {\n console.warn(\n 'SessionCountdown: both `remainingMs` and `expiresAt` provided; `remainingMs` wins and the deadline is ignored.',\n );\n }\n }, [remainingMs, expiresAt]);\n\n const expiresAtEpoch = useMemo(\n () =>\n remainingMs === undefined && expiresAt !== undefined\n ? toEpoch(expiresAt)\n : undefined,\n [remainingMs, expiresAt],\n );\n\n const remaining = useRemainingMs(remainingMs, expiresAtEpoch, tickMs);\n const tone = deriveTone(remaining, warnAtMs);\n const isExpired = tone === 'expired';\n\n /* ── onExpire — fire exactly once via a ref guard ─────────────── */\n const expireFiredRef = useRef(false);\n useEffect(() => {\n if (remaining <= 0 && !expireFiredRef.current) {\n expireFiredRef.current = true;\n onExpire?.();\n }\n // Allow a fresh expiry if the timer is restarted (remaining climbs > 0).\n if (remaining > 0 && expireFiredRef.current) {\n expireFiredRef.current = false;\n }\n }, [remaining, onExpire]);\n\n /* ── Number formatting (Intl, no deps) ────────────────────────── */\n const nf = useMemo(\n () => new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }),\n [locale],\n );\n const totalSeconds = Math.ceil(remaining / SECOND_MS);\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n\n // Visible compact time string. Under 60s we drop the minutes segment.\n const timeText =\n minutes > 0\n ? t('sessionCountdown.timeMinutesSeconds', {\n minutes: nf.format(minutes),\n seconds: nf.format(seconds),\n })\n : t('sessionCountdown.timeSecondsOnly', {\n seconds: nf.format(seconds),\n });\n\n /* ── Coarse announcement (decoupled from the per-second tick) ─── */\n const bucket = announcementBucket(remaining);\n const announcement = useMemo(() => {\n if (bucket <= 0) {\n return t('sessionCountdown.expiredAnnouncement');\n }\n // Sub-minute buckets (30, 10) speak seconds; whole-minute buckets\n // (60, 120, …) speak minutes. The bucket is already floored so the\n // spoken count never exceeds the true remaining time.\n if (bucket < 60) {\n return t('sessionCountdown.secondsRemaining', { count: bucket });\n }\n return t('sessionCountdown.minutesRemaining', { count: bucket / 60 });\n }, [bucket, t]);\n\n // Clean, standalone expiry announcement — surfaced verbatim (NOT folded\n // into the ariaLabel template, which would double-interpolate into\n // \"Session expires in Session expired.\").\n const expiredAnnouncement = t('sessionCountdown.expiredAnnouncement');\n\n // Accessible name for the region:\n // - running / warning → the terse ariaLabel template (\"Session expires\n // in 5 minutes remaining\"), refreshed only when the bucket changes.\n // - expired → no aria-label; the root becomes role=\"alert\" and takes its\n // accessible name from the real `expiredAnnouncement` text node inside\n // it, so screen readers that announce a live region's TEXT (not its\n // aria-label) still voice the expiry. A `label` override wins in all\n // states.\n const regionLabel =\n label ??\n (isExpired\n ? undefined\n : t('sessionCountdown.ariaLabel', { time: announcement }));\n\n const composedClass = countdownVariants({\n size,\n tone,\n className,\n });\n\n // role escalation modelled on Alert: timer while running / warning,\n // alert (implicitly an assertive live region) on expiry. The root does\n // NOT carry `aria-live` while running — the per-second visual value is\n // aria-hidden and the coarse running announcements come from the nested\n // polite LiveRegion. On expiry the root's `role=\"alert\"` carries a real\n // (non-aria-hidden) text node with `expiredAnnouncement`, so the message\n // is announced via live-region TEXT rather than an aria-label-only name\n // — reliable across NVDA / VoiceOver — and exactly once (the text does\n // not change on later ticks). The nested polite region is emptied on\n // expiry so the two regions never double-announce.\n const role = isExpired ? 'alert' : 'timer';\n\n useAgentRegistration(sessionCountdownAgent, null, id);\n\n /* ── banner ───────────────────────────────────────────────────── */\n const Icon = isExpired\n ? CircleX\n : tone === 'warning'\n ? TriangleAlert\n : Timer;\n const elapsed = Math.min(totalMs, Math.max(0, totalMs - remaining));\n\n const messageKey = isExpired\n ? 'sessionCountdown.expired'\n : tone === 'warning'\n ? 'sessionCountdown.warning'\n : 'sessionCountdown.remainingBanner';\n const message = t(messageKey, { time: timeText });\n\n return (\n <div\n ref={ref}\n id={id}\n role={role}\n aria-label={regionLabel}\n data-component=\"session-countdown\"\n data-tone={tone}\n className={composedClass}\n {...rest}\n >\n {/* On expiry the root is role=\"alert\"; this real (non-aria-hidden)\n sr-only text node gives the alert its announced content and\n accessible name (the visible banner sentence stays aria-hidden so\n it is not read twice). It appears once, on the expiry render, so\n the message is voiced exactly once and stays quiet on later ticks. */}\n {isExpired ? (\n <span className=\"ds:sr-only\">{expiredAnnouncement}</span>\n ) : null}\n <div className=\"ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className={`ds:shrink-0 ${ICON_SIZE_CLASS[size]}`}>\n <Icon aria-hidden=\"true\" className=\"ds:size-full\" />\n </span>\n <p\n className={[\n 'ds:min-w-0 ds:flex-1',\n size === 'lg' ? 'type-body' : 'type-body-sm',\n ].join(' ')}\n aria-hidden=\"true\"\n >\n {message}\n </p>\n {isExpired && onRestart ? (\n <Button\n type=\"button\"\n intent=\"tonal\"\n size={size === 'lg' ? 'lg' : 'md'}\n loading={restarting}\n disabled={restarting}\n onClick={onRestart}\n className=\"ds:shrink-0\"\n >\n {t('sessionCountdown.restart')}\n </Button>\n ) : null}\n </div>\n\n {showProgress && !isExpired ? (\n // Elapsed fraction flows through the existing Progress API\n // (value/max) — never a hand-rolled inline-width bar. The bar\n // is aria-hidden: the timer region already conveys remaining\n // time, so a second progressbar would double-announce.\n <div aria-hidden=\"true\" className=\"ds:w-full\">\n <Progress\n value={elapsed}\n max={totalMs}\n shape=\"bar\"\n size={size}\n ariaLabel={t('sessionCountdown.progressLabel')}\n />\n </div>\n ) : null}\n\n {/* Coarse running announcement, keyed on the bucket. Polite\n (role=\"status\"). Suppressed on expiry — the root alert above\n carries the expiry message, so the two never double-announce. */}\n <LiveRegion politeness=\"polite\" atomic>\n {isExpired ? '' : announcement}\n </LiveRegion>\n </div>\n );\n },\n);\n\nSessionCountdown.displayName = 'SessionCountdown';\n"],"names":["__iconNode","Timer","createLucideIcon","sessionCountdownAgent","SECOND_MS","MINUTE_MS","DEFAULT_TOTAL_MS","DEFAULT_WARN_AT_MS","countdownVariants","cva","ICON_SIZE_CLASS","deriveTone","remaining","warnAtMs","announcementBucket","toEpoch","value","useRemainingMs","controlledRemaining","expiresAtEpoch","tickMs","now","setNow","useState","isControlled","useEffect","id","current","SessionCountdown","forwardRef","remainingMs","expiresAt","totalMs","size","showProgress","onExpire","onRestart","restarting","localeProp","label","className","rest","ref","t","i18n","useTranslation","locale","useMemo","tone","isExpired","expireFiredRef","useRef","nf","totalSeconds","minutes","seconds","timeText","bucket","announcement","expiredAnnouncement","regionLabel","composedClass","role","useAgentRegistration","Icon","CircleX","TriangleAlert","elapsed","message","jsxs","jsx","Button","Progress","LiveRegion"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,IAAI,MAAM,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,KAAK,SAAQ,CAAE;AAAA,EAChE,CAAC,QAAQ,EAAE,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,KAAK,SAAQ,CAAE;AAAA,EAClE,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,KAAK,KAAK,SAAQ,CAAE;AAC1D,GACMC,KAAQC,GAAiB,SAASF,EAAU,GCCrCG,KAAsC;AAAA,EACjD,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO,CAAA;AAAA,EACP,SAAS,CAAA;AAAA,EACT,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aACE;AAAA,IAAA;AAAA,EACJ;AAEJ,GCPMC,IAAY,KACZC,IAAY,KAAKD,GACjBE,KAAmB,KAAKD,GACxBE,KAAqB,IAAIF,GAczBG,KAAoBC;AAAA,EACxB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,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AC;AAAA,gBACA,WAAWU,EAAE,gCAAgC;AAAA,cAAA;AAAA,YAAA,GAEjD;AAAA,cACE;AAAA,UAKJ,gBAAA2B,EAACG,KAAW,YAAW,UAAS,QAAM,IACnC,UAAAxB,IAAY,KAAKS,EAAA,CACpB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA9B,GAAiB,cAAc;","x_google_ignoreList":[0]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sign-document-Bfk0WpWV.js","sources":["../../src/components/sign-document/sign-document.agent.ts","../../src/components/sign-document/sign-document.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — SignDocument. */\n/* */\n/* State exposes only structural lifecycle info — never the signature */\n/* bytes (the signed consent is sensitive; persistence is the consumer's */\n/* concern). The single write action confirms the captured signature. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { SignDocumentHandle } from './sign-document';\n\nexport const signDocumentAgent: AgentAdapter<SignDocumentHandle> = {\n id: 'sign-document',\n capabilities: ['submit'],\n state: {\n isReadComplete: {\n type: 'boolean',\n descriptionKey: 'signDocument.agent.state.isReadComplete',\n description:\n 'True when the reader has reached the last page (or read-gating is off).',\n read: (handle) => handle.isReadComplete(),\n },\n },\n actions: {\n submit: {\n // Persists intent: commits the captured signature and emits it via the\n // consumer's onSign callback. Reversible via reset() before persistence.\n safety: 'write',\n returns: 'SignatureConfirmPayload | null',\n returnsSchema: {\n oneOf: [\n {\n type: 'object',\n description:\n 'The confirmed signature payload (PNG data URL + metadata).',\n properties: {\n dataUrl: {\n type: 'string',\n description: 'PNG data URL of the rendered signature.',\n },\n },\n required: ['dataUrl'],\n },\n {\n type: 'null',\n description: 'Returned when there is no signature to confirm.',\n },\n ],\n },\n // confirm() emits via onSign — calling twice re-emits the same payload,\n // so it is not flagged idempotent.\n descriptionKey: 'signDocument.agent.actions.confirm',\n description:\n 'Confirm the current signature, emitting it via onSign. No-op if unsigned.',\n invoke: (handle) => handle.confirm(),\n },\n reset: {\n // Discards the captured signature — destructive (loses drawn input).\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'signDocument.agent.actions.reset',\n description: 'Clear the captured signature and return to unsigned.',\n invoke: (handle) => {\n handle.reset();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'sign-document',\n description: 'Marks the SignDocument wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* SignDocument — review a PDF document, then sign it. */\n/* */\n/* Fills the kit gap where consumers hand-composed PDFViewer + */\n/* SignatureCapture for consents (e.g. sign.alfadocs.com, HTP-4889). */\n/* This component owns the composition and the read-gate so the consent */\n/* flow is a single primitive: */\n/* */\n/* - PDFViewer (the document) renders above; the signing surface */\n/* renders below. */\n/* - When `requireReadToEnd` (default), the SignatureCapture pad and */\n/* the \"Confirm & sign\" button are gated until the reader reaches the */\n/* LAST page. We track this via PDFViewer's onLoadComplete (numPages) */\n/* + onPageChange (currentPage === numPages). NOTE: last-page-reached */\n/* is an APPROXIMATE read signal — a fit-page zoom can show the last */\n/* page without scrolling. That is acceptable for this gate; a */\n/* legal-grade \"read every page\" guarantee is the consumer's call. */\n/* - When `signedAt` is set the component renders an already-signed */\n/* read-only state (no pad) so re-sign-on-change consumers can show */\n/* signed status. */\n/* - Security: no fetch / XHR / storage / globals here. SignatureCapture */\n/* owns the export payload (PNG/SVG + sha256); the consumer owns */\n/* persistence via onSign. */\n/* - i18n: every authored string via `t('signDocument.*')` (bare keys */\n/* under the `ui` namespace). PDFViewer's `pdf.*` and */\n/* SignatureCapture's `signature.*` strings already exist. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { CheckCircle2 } from 'lucide-react';\nimport { PDFViewer } from '../pdf-viewer';\nimport {\n SignatureCapture,\n type SignatureCaptureHandle,\n type SignatureConfirmPayload,\n} from '../signature-capture';\nimport { useAgentRegistration } from '../../agent';\nimport { signDocumentAgent } from './sign-document.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface SignDocumentProps {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Document PDF — URL string, ArrayBuffer, or Uint8Array. Passed to PDFViewer. */\n src: string | ArrayBuffer | Uint8Array;\n /** Accessible name for the document region (also used as a heading). */\n documentTitle?: string;\n /**\n * Gate the signature + Confirm until the reader reaches the last page.\n * Default `true`. Last-page-reached is an approximate read signal (a\n * fit-page zoom can show the last page without scrolling) — adequate for\n * this gate; legal-grade read tracking is the consumer's concern.\n */\n requireReadToEnd?: boolean;\n /** Fired when the user captures a signature AND confirms. */\n onSign?: (payload: SignatureConfirmPayload) => void;\n /** Forwarded from PDFViewer on any load / render error. */\n onError?: (error: Error) => void;\n /**\n * When set, render the already-signed read-only state: shows \"Signed\" +\n * the signed date and hides the pad. Use for re-sign-on-change consumers\n * that surface signed status. `null` / `undefined` → unsigned.\n */\n signedAt?: string | null;\n /**\n * Optional on-behalf attribution. When both `signer` and `subject` are\n * given, a \"Signed by {signer} on behalf of {subject}\" note renders both\n * near the signature pad (so the signer sees who they're signing for) AND\n * inside the already-signed read-only banner. Omit (the default) and\n * nothing extra renders — the existing subject-agnostic API is unchanged.\n * Provide both to opt in; a lone `signer` or `subject` renders nothing.\n */\n signedByNote?: { signer: string; subject: string };\n /** Disable all controls (document still readable). */\n disabled?: boolean;\n /** Render read-only: the document is shown but the pad is suppressed. */\n readOnly?: boolean;\n /** Accessible label for the component's group region. */\n ariaLabel?: string;\n /** Extra class names merged onto the outermost wrapper. */\n className?: string;\n}\n\n/** Curated imperative handle for agent / external automation. */\nexport interface SignDocumentHandle {\n /** Clear the captured signature, returning to the unsigned state. */\n reset: () => void;\n /** Confirm the current signature; resolves the payload, or null if unsigned. */\n confirm: () => Promise<SignatureConfirmPayload | null>;\n /** True when the reader has reached the last page (or the gate is off). */\n isReadComplete: () => boolean;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst rootVariants = cva(\n [\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)]',\n 'ds:shadow-[var(--shadow-card)] ds:[.theme-accessible_&]:border-2',\n 'ds:bg-[var(--background)] ds:text-[var(--foreground)]',\n 'ds:p-[var(--spacing-md)]',\n 'ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed',\n ].join(' '),\n);\n\nconst headingVariants = cva(\n ['type-heading-sm ds:text-[var(--foreground)]'].join(' '),\n);\n\nconst signSectionVariants = cva(\n ['ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]'].join(' '),\n);\n\nconst sectionLabelVariants = cva(\n ['type-body-sm ds:font-medium ds:text-[var(--foreground)]'].join(' '),\n);\n\nconst progressVariants = cva(\n [\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'type-body-sm ds:text-[var(--muted-foreground)]',\n ].join(' '),\n);\n\n// The \"scroll to the end to sign\" hint uses --info as a low-emphasis\n// informational tint — tokenised, logical-property insets, no accent over\n// arbitrary content.\nconst hintVariants = cva(\n [\n 'ds:flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'type-body-sm',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]',\n 'ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]',\n 'ds:bg-[color-mix(in_srgb,var(--info)_10%,transparent)]',\n 'ds:text-[var(--foreground)]',\n 'ds:border ds:border-[color:color-mix(in_srgb,var(--info)_40%,transparent)]',\n ].join(' '),\n);\n\nconst confirmButtonVariants = cva(\n [\n 'ds:inline-flex ds:inline-size-full ds:items-center ds:justify-center',\n 'ds:[min-block-size:var(--min-target-size)]',\n 'ds:[min-inline-size:var(--min-target-size)]',\n 'ds:gap-[var(--spacing-xs)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]',\n 'ds:text-[length:var(--font-size-base)] ds:font-medium',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:hover:bg-[var(--primary-hover)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[var(--ring)]',\n 'ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:disabled:opacity-[var(--opacity-50)] ds:disabled:cursor-not-allowed',\n 'ds:disabled:hover:bg-[var(--primary)]',\n ].join(' '),\n);\n\n// The signed banner uses the semantic --success alias for the confirmed\n// state — never the raw ramp step (constraint §11).\nconst signedBannerVariants = cva(\n [\n 'ds:flex ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'ds:bg-[color-mix(in_srgb,var(--success)_12%,transparent)]',\n 'ds:text-[var(--foreground)]',\n 'ds:border ds:border-[color:color-mix(in_srgb,var(--success)_45%,transparent)]',\n ].join(' '),\n);\n\n// The on-behalf attribution note. Low-emphasis muted text — it qualifies the\n// signature, it isn't an action. `placement` swaps the inset/spacing so the\n// same string reads correctly above the pad (a hint) and inside the signed\n// banner (a continuation of the signed copy).\nconst attributionVariants = cva(['type-body-sm'].join(' '), {\n variants: {\n placement: {\n pad: 'ds:text-[var(--muted-foreground)]',\n banner: 'ds:block ds:text-[var(--foreground)]',\n },\n },\n defaultVariants: { placement: 'pad' },\n});\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\n/**\n * Format an ISO timestamp using the active i18n locale. Falls back to the\n * raw string if it can't be parsed so a malformed `signedAt` never throws.\n */\nfunction formatSignedAt(iso: string, locale: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return iso;\n try {\n return new Intl.DateTimeFormat(locale, {\n dateStyle: 'long',\n timeStyle: 'short',\n }).format(date);\n } catch {\n return date.toISOString();\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* SignDocument */\n/* ------------------------------------------------------------------ */\n\nexport const SignDocument = forwardRef<SignDocumentHandle, SignDocumentProps>(\n (\n {\n id,\n src,\n documentTitle,\n requireReadToEnd = true,\n onSign,\n onError,\n signedAt = null,\n signedByNote,\n disabled = false,\n readOnly = false,\n ariaLabel,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const rawId = useId();\n const idSafe = useMemo(\n () => `sign-doc-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}`,\n [rawId],\n );\n const docHeadingId = `${idSafe}-doc-heading`;\n const signLabelId = `${idSafe}-sign-label`;\n const liveRegionId = `${idSafe}-live`;\n // Stable, static describedby target for the sign section + Confirm —\n // kept separate from the polite live region so describedby points at\n // unchanging text, not the transition announcer (which only carries\n // gate-met / signed announcements).\n const gateHintId = `${idSafe}-gate-hint`;\n\n const signatureRef = useRef<SignatureCaptureHandle>(null);\n\n const [numPages, setNumPages] = useState(0);\n const [currentPage, setCurrentPage] = useState(1);\n // True once the reader has reached the last page at least once. Sticky:\n // scrolling back up does not re-lock the signature.\n const [reachedEnd, setReachedEnd] = useState(false);\n // Mirrors the pad's ink state so the Confirm button re-renders when a\n // signature lands. SignatureCapture's isEmpty() is a sync ref read (no\n // re-render) and its onStart only fires on a DRAWN stroke — not on the\n // typed fallback. We poll the handle so both paths gate Confirm\n // identically; onStart/onClear below are immediate-feedback hints.\n const [hasSignature, setHasSignature] = useState(false);\n\n const isSigned = signedAt != null;\n const inert = disabled || readOnly || isSigned;\n\n // Latest callbacks via refs so the async confirm path never closes over\n // a stale prop.\n const onSignRef = useRef(onSign);\n const onErrorRef = useRef(onError);\n useEffect(() => {\n onSignRef.current = onSign;\n onErrorRef.current = onError;\n }, [onSign, onError]);\n\n /* ---- Per-document reset -------------------------------------- */\n // When the consumer swaps `src` to a NEW document, the previous \"read\n // complete\" state must NOT carry over — otherwise the new document\n // could be signed without being read. Reset the per-document state;\n // PDFViewer's onLoadComplete re-sets reachedEnd for single-page docs.\n useEffect(() => {\n setReachedEnd(false);\n setNumPages(0);\n setCurrentPage(1);\n setHasSignature(false);\n }, [src]);\n\n /* ---- Read-gate tracking -------------------------------------- */\n const handleLoadComplete = useCallback(\n (info: { numPages: number; title?: string }) => {\n setNumPages(info.numPages);\n // A single-page document is \"read to the end\" the moment it loads.\n if (info.numPages <= 1) setReachedEnd(true);\n },\n [],\n );\n\n const handlePageChange = useCallback((page: number) => {\n setCurrentPage(page);\n setNumPages((total) => {\n if (total > 0 && page >= total) setReachedEnd(true);\n return total;\n });\n }, []);\n\n const handleError = useCallback((error: Error) => {\n onErrorRef.current?.(error);\n }, []);\n\n /* ---- Signature-presence polling ------------------------------ */\n // Poll the pad's isEmpty() while the signing surface is live so the\n // Confirm button reflects both drawn AND typed signatures. Cheap\n // (a single boolean ref read on an interval); torn down when signed,\n // read-only, or unmounted.\n const signLive = !isSigned && !readOnly;\n useEffect(() => {\n if (!signLive) return undefined;\n const tick = (): void => {\n const pad = signatureRef.current;\n if (!pad) return;\n setHasSignature(!pad.isEmpty());\n };\n tick();\n const interval = window.setInterval(tick, 200);\n return () => window.clearInterval(interval);\n }, [signLive]);\n\n // The gate is satisfied when reading isn't required, or the reader has\n // reached the last page at least once.\n const readComplete = !requireReadToEnd || reachedEnd;\n const canSign = !inert && readComplete;\n const confirmDisabled = !canSign || !hasSignature;\n\n /* ---- Confirm path -------------------------------------------- */\n // `onSign` fires from SignatureCapture's `onConfirm` (wired below) — the\n // single source of truth, so it fires once whether the user clicks the\n // pad's own Confirm or this component's \"Confirm & sign\". This handle\n // just proxies the pad's confirm() and returns its payload.\n const handleSigned = useCallback((payload: SignatureConfirmPayload) => {\n onSignRef.current?.(payload);\n }, []);\n\n const confirm =\n useCallback(async (): Promise<SignatureConfirmPayload | null> => {\n const pad = signatureRef.current;\n if (!pad) return null;\n return pad.confirm();\n }, []);\n\n const reset = useCallback(() => {\n signatureRef.current?.clear();\n setHasSignature(false);\n }, []);\n\n /* ---- Imperative handle + agent registration ------------------ */\n const agentHandle = useMemo<SignDocumentHandle>(\n () => ({\n reset,\n confirm,\n isReadComplete: () => readComplete,\n }),\n [reset, confirm, readComplete],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(signDocumentAgent, agentHandle, id);\n\n /* ---- Derived strings ----------------------------------------- */\n const regionLabel =\n ariaLabel ??\n (documentTitle\n ? t('signDocument.regionLabelNamed', { title: documentTitle })\n : t('signDocument.regionLabel'));\n const documentRegionLabel =\n documentTitle ?? t('signDocument.documentLabel');\n\n // Live region — ONLY transition announcements (gate met / signed).\n const liveText = isSigned\n ? t('signDocument.signedOn', {\n date: formatSignedAt(signedAt as string, i18n.language),\n })\n : readComplete\n ? t('signDocument.readyToSign')\n : '';\n\n // Static describedby target — always names WHY Confirm is unavailable\n // (or stays empty when it's actionable). Stable text, never live.\n const gateHintText = !readComplete\n ? t('signDocument.scrollToEnd')\n : !hasSignature\n ? t('signDocument.signToEnable')\n : '';\n\n // On-behalf attribution — only when BOTH signer and subject are present\n // (a lone half is meaningless). Rendered above the pad and in the signed\n // banner. Optional: undefined → no attribution, API unchanged.\n const attributionText =\n signedByNote?.signer && signedByNote?.subject\n ? t('signDocument.signedByOnBehalf', {\n signer: signedByNote.signer,\n subject: signedByNote.subject,\n })\n : null;\n\n return (\n <div\n role=\"group\"\n // Prefer labelling by the visible heading so the visible + accessible\n // names match; fall back to aria-label only when there's no heading.\n aria-labelledby={!ariaLabel && documentTitle ? docHeadingId : undefined}\n aria-label={ariaLabel || !documentTitle ? regionLabel : undefined}\n aria-disabled={disabled || undefined}\n className={[rootVariants(), className].filter(Boolean).join(' ')}\n data-component=\"sign-document\"\n data-component-id={id}\n data-signed={isSigned || undefined}\n >\n {/* Polite live region — ONLY transition announcements (gate met /\n signed). Static describedby text lives in the gate-hint span. */}\n <span\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ds:sr-only\"\n data-testid=\"sign-document-live\"\n id={liveRegionId}\n >\n {liveText}\n </span>\n\n {/* Static, non-live describedby target for the sign group + Confirm:\n names why Confirm is unavailable (or empty when actionable). */}\n <span className=\"ds:sr-only\" id={gateHintId}>\n {gateHintText}\n </span>\n\n {documentTitle ? (\n <h2 id={docHeadingId} className={headingVariants()}>\n {documentTitle}\n </h2>\n ) : null}\n\n {/* The document. PDFViewer owns its own toolbar, a11y, and zoom. */}\n <PDFViewer\n src={src}\n ariaLabel={documentRegionLabel}\n onLoadComplete={handleLoadComplete}\n onPageChange={handlePageChange}\n onError={handleError}\n />\n\n {isSigned ? (\n /* ---- Already-signed, read-only ---- */\n <div\n className={signedBannerVariants()}\n data-testid=\"sign-document-signed\"\n >\n <CheckCircle2\n aria-hidden=\"true\"\n className=\"ds:size-5 ds:text-[var(--success)] ds:shrink-0\"\n />\n <span className=\"type-body-sm\">\n <strong className=\"ds:font-semibold\">\n {t('signDocument.signed')}\n </strong>\n {' — '}\n {t('signDocument.signedOn', {\n date: formatSignedAt(signedAt as string, i18n.language),\n })}\n {attributionText ? (\n <span\n className={attributionVariants({ placement: 'banner' })}\n data-testid=\"sign-document-attribution\"\n >\n {attributionText}\n </span>\n ) : null}\n </span>\n </div>\n ) : readOnly ? null : (\n /* ---- Sign surface ---- */\n <div\n className={signSectionVariants()}\n role=\"group\"\n aria-labelledby={signLabelId}\n aria-describedby={gateHintId}\n >\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <span id={signLabelId} className={sectionLabelVariants()}>\n {t('signDocument.signatureSection')}\n </span>\n {numPages > 0 ? (\n <span\n className={progressVariants()}\n data-testid=\"sign-document-progress\"\n >\n {t('signDocument.pageProgress', {\n current: currentPage,\n total: numPages,\n })}\n </span>\n ) : null}\n </div>\n\n {attributionText ? (\n <p\n className={attributionVariants({ placement: 'pad' })}\n data-testid=\"sign-document-attribution\"\n >\n {attributionText}\n </p>\n ) : null}\n\n {requireReadToEnd && !readComplete ? (\n <p className={hintVariants()} data-testid=\"sign-document-hint\">\n {t('signDocument.scrollToEnd')}\n </p>\n ) : null}\n\n {/* The pad is always mounted so a keyboard user can prepare a\n typed signature; the Confirm button is the gate. When the\n read-gate is unmet the pad is disabled so it can't accept\n ink prematurely. */}\n <SignatureCapture\n ref={signatureRef}\n ariaLabel={t('signDocument.signatureSection')}\n disabled={disabled || !readComplete}\n onStart={() => setHasSignature(true)}\n onClear={() => setHasSignature(false)}\n onConfirm={handleSigned}\n />\n\n {/* Native `disabled` (not aria-disabled) so a gated Confirm\n leaves the tab order entirely — mirrors how Button gates a\n primary action. describedby names WHY it's unavailable. */}\n <button\n type=\"button\"\n onClick={() => {\n if (confirmDisabled) return;\n void confirm();\n }}\n disabled={confirmDisabled}\n aria-describedby={gateHintId}\n className={confirmButtonVariants()}\n data-testid=\"sign-document-confirm\"\n >\n <CheckCircle2 aria-hidden=\"true\" className=\"ds:size-4\" />\n {t('signDocument.confirm')}\n </button>\n </div>\n )}\n </div>\n );\n },\n);\n\nSignDocument.displayName = 'SignDocument';\n\nexport { rootVariants as signDocumentRootVariants };\n"],"names":["signDocumentAgent","handle","rootVariants","cva","headingVariants","signSectionVariants","sectionLabelVariants","progressVariants","hintVariants","confirmButtonVariants","signedBannerVariants","attributionVariants","formatSignedAt","iso","locale","date","SignDocument","forwardRef","id","src","documentTitle","requireReadToEnd","onSign","onError","signedAt","signedByNote","disabled","readOnly","ariaLabel","className","ref","t","i18n","useTranslation","rawId","useId","idSafe","useMemo","docHeadingId","signLabelId","liveRegionId","gateHintId","signatureRef","useRef","numPages","setNumPages","useState","currentPage","setCurrentPage","reachedEnd","setReachedEnd","hasSignature","setHasSignature","isSigned","inert","onSignRef","onErrorRef","useEffect","handleLoadComplete","useCallback","info","handlePageChange","page","total","handleError","error","_a","signLive","tick","pad","interval","readComplete","confirmDisabled","handleSigned","payload","confirm","reset","agentHandle","useImperativeHandle","useAgentRegistration","regionLabel","documentRegionLabel","liveText","gateHintText","attributionText","jsxs","jsx","PDFViewer","CheckCircle2","SignatureCapture"],"mappings":";;;;;;;;AAaO,MAAMA,KAAsD;AAAA,EACjE,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ;AAAA,EACvB,OAAO;AAAA,IACL,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,eAAA;AAAA,IAAe;AAAA,EAC1C;AAAA,EAEF,SAAS;AAAA,IACP,QAAQ;AAAA;AAAA;AAAA,MAGN,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,eAAe;AAAA,QACb,OAAO;AAAA,UACL;AAAA,YACE,MAAM;AAAA,YACN,aACE;AAAA,YACF,YAAY;AAAA,cACV,SAAS;AAAA,gBACP,MAAM;AAAA,gBACN,aAAa;AAAA,cAAA;AAAA,YACf;AAAA,YAEF,UAAU,CAAC,SAAS;AAAA,UAAA;AAAA,UAEtB;AAAA,YACE,MAAM;AAAA,YACN,aAAa;AAAA,UAAA;AAAA,QACf;AAAA,MACF;AAAA;AAAA;AAAA,MAIF,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,QAAQ,CAACA,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAA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BAEX,UAAAyE;AAAA,oBAAA;AAAA,kBAAA,IAED;AAAA,kBAEH/D,KAAoB,CAACkD,IACpB,gBAAAe,EAAC,KAAA,EAAE,WAAW9E,GAAA,GAAgB,eAAY,sBACvC,UAAAuB,EAAE,0BAA0B,GAC/B,IACE;AAAA,kBAMJ,gBAAAuD;AAAA,oBAACG;AAAA,oBAAA;AAAA,sBACC,KAAK/C;AAAA,sBACL,WAAWX,EAAE,+BAA+B;AAAA,sBAC5C,UAAUL,KAAY,CAAC6C;AAAA,sBACvB,SAAS,MAAMnB,EAAgB,EAAI;AAAA,sBACnC,SAAS,MAAMA,EAAgB,EAAK;AAAA,sBACpC,WAAWqB;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAMb,gBAAAY;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,MAAK;AAAA,sBACL,SAAS,MAAM;AACb,wBAAIb,KACCG,EAAA;AAAA,sBACP;AAAA,sBACA,UAAUH;AAAA,sBACV,oBAAkB/B;AAAA,sBAClB,WAAWhC,GAAA;AAAA,sBACX,eAAY;AAAA,sBAEZ,UAAA;AAAA,wBAAA,gBAAA6E,EAACE,GAAA,EAAa,eAAY,QAAO,WAAU,aAAY;AAAA,wBACtDzD,EAAE,sBAAsB;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAC3B;AAAA,cAAA;AAAA,YAAA;AAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAf,GAAa,cAAc;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"signature-request-CEOrCDyk.js","sources":["../../node_modules/lucide-react/dist/esm/icons/message-square-text.mjs","../../node_modules/lucide-react/dist/esm/icons/tablet.mjs","../../node_modules/lucide-react/dist/esm/icons/user-plus.mjs","../../src/patterns/signature-request/signature-request.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\",\n key: \"18887p\"\n }\n ],\n [\"path\", { d: \"M7 11h10\", key: \"1twpyw\" }],\n [\"path\", { d: \"M7 15h6\", key: \"d9of3u\" }],\n [\"path\", { d: \"M7 7h8\", key: \"af5zfr\" }]\n];\nconst MessageSquareText = createLucideIcon(\"message-square-text\", __iconNode);\n\nexport { __iconNode, MessageSquareText as default };\n//# sourceMappingURL=message-square-text.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"16\", height: \"20\", x: \"4\", y: \"2\", rx: \"2\", ry: \"2\", key: \"76otgf\" }],\n [\"line\", { x1: \"12\", x2: \"12.01\", y1: \"18\", y2: \"18\", key: \"1dp563\" }]\n];\nconst Tablet = createLucideIcon(\"tablet\", __iconNode);\n\nexport { __iconNode, Tablet as default };\n//# sourceMappingURL=tablet.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\", key: \"1yyitq\" }],\n [\"circle\", { cx: \"9\", cy: \"7\", r: \"4\", key: \"nufk8\" }],\n [\"line\", { x1: \"19\", x2: \"19\", y1: \"8\", y2: \"14\", key: \"1bvyxn\" }],\n [\"line\", { x1: \"22\", x2: \"16\", y1: \"11\", y2: \"11\", key: \"1shjgl\" }]\n];\nconst UserPlus = createLucideIcon(\"user-plus\", __iconNode);\n\nexport { __iconNode, UserPlus as default };\n//# sourceMappingURL=user-plus.mjs.map\n","/**\n * SignatureRequestModal — the practice-side \"Documenti firmati\" modal that\n * dispatches a document-signature request: assign the operator who must\n * counter-sign (or leave the request unassigned), build the patient-side\n * signer roster (up to `maxSigners`, each with their own delivery channel\n * and, for on-device signing, an OTP waiver), and send.\n *\n * Runtime pattern: real consuming apps mount this in production (surfaced via\n * `src/patterns/index.ts` and the `./patterns/signature-request` subpath).\n * The component owns the form state — re-seeded from the `initial*` props\n * every time `open` flips back to `true` — while the host owns `open`, the\n * option lists, and what happens on submit. Multiple on-device signers sign\n * sequentially in roster order — the execution side is the Signing pattern's\n * multi-signer flow; this modal only encodes the intents.\n */\nimport {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n Mail,\n MessageSquareText,\n PenLine,\n Plus,\n Tablet,\n UserPlus,\n X,\n} from 'lucide-react';\nimport { Dialog } from '../../components/dialog';\nimport { Button } from '../../components/button';\nimport { IconButton } from '../../components/icon-button';\nimport { Checkbox } from '../../components/checkbox';\nimport { WhatsAppGlyph } from '../../components/whatsapp-button';\nimport { Select } from '../../components/select';\nimport { Switch } from '../../components/switch';\nimport { Alert } from '../../components/alert';\nimport { Separator } from '../../components/separator';\nimport { Avatar } from '../../components/avatar';\n\n/** Delivery channel for one signer's signature request. */\nexport type SignatureChannel = 'sms' | 'email' | 'whatsapp' | 'on-device';\n\n/** One selectable person/role for the operator or signer selects. */\nexport interface SignerOption {\n value: string;\n label: string;\n /**\n * Delivery channels this person can actually receive. Omit (or pass an\n * empty list) to offer every channel. Hosts gate this from per-patient\n * capability flags — e.g. a patient with no mobile number drops `'sms'`\n * and `'whatsapp'`. Only meaningful for signer options, not operators.\n */\n availableChannels?: SignatureChannel[];\n}\n\n/** One patient-side signer row in the submission. */\nexport interface SignerRequest {\n signerId: string;\n channel: SignatureChannel;\n /** Only meaningful when `channel` is `'on-device'`. */\n skipOtp?: boolean;\n}\n\n/** Payload handed to `onRequestSignature`. */\nexport interface SignatureRequestSubmission {\n /** `null` when the counter-signing operator is left unassigned. */\n operatorId: string | null;\n /** 1..N signers; on-device signers sign sequentially in this order. */\n signers: SignerRequest[];\n}\n\nexport interface SignatureRequestModalProps {\n /** Controlled open state. Reopening re-seeds the form from `initial*`. */\n open: boolean;\n /**\n * Fires when the dialog requests a state change (<kbd>Esc</kbd> or the\n * footer Close button). `false` is the dismiss signal — hosts typically\n * persist a \"dismissed this session\" flag there.\n */\n onOpenChange: (open: boolean) => void;\n /** Operators offered as the counter-signing signer. */\n operators: SignerOption[];\n /** Patient-side people/roles offered in each signer row. */\n signerOptions: SignerOption[];\n /** Enables the \"Assign to me\" shortcut targeting this operator. */\n currentOperatorId?: string;\n /** Offer an \"Assign later\" option in the operator select. Default `true`. */\n allowAssignLater?: boolean;\n /**\n * Preselected operator; `null` preselects \"Assign later\" (honoured only\n * while `allowAssignLater` — otherwise the first operator is seeded).\n */\n initialOperatorId?: string | null;\n /** Seed the signer roster. Defaults to the first option, on-device. */\n initialSigners?: SignerRequest[];\n /** Cap on roster size. Default `2`. */\n maxSigners?: number;\n /** Disables all inputs and shows the primary action as loading. */\n busy?: boolean;\n /** Consumer-translated error shown above the footer (e.g. server failure). */\n error?: string;\n /** Override the dialog title. Defaults to the `ui.*` string. */\n title?: string;\n /** Override the dialog description. Defaults to the `ui.*` string. */\n description?: string;\n /** Receives the completed submission. The host closes via `onOpenChange`. */\n onRequestSignature: (submission: SignatureRequestSubmission) => void;\n /**\n * Extra attributes for the portaled dialog surface (e.g. `dir`/`lang`\n * when the host pins a locale below `<html>`, or a test id).\n */\n contentProps?: ComponentPropsWithoutRef<'div'>;\n}\n\nconst ASSIGN_LATER = '__assign-later__';\n\n/** Canonical channel display order; per-signer availability filters this. */\nconst CHANNEL_ORDER: SignatureChannel[] = [\n 'sms',\n 'email',\n 'whatsapp',\n 'on-device',\n];\n\n/** Internal roster row — `rowId` keys the DOM so editing a row's person\n * never remounts the row (which would drop keyboard focus). */\ninterface RosterRow extends SignerRequest {\n rowId: number;\n}\n\nfunction labelFor(options: SignerOption[], value: string): string {\n return options.find((option) => option.value === value)?.label ?? '';\n}\n\nexport const SignatureRequestModal = forwardRef<\n HTMLDivElement,\n SignatureRequestModalProps\n>(\n (\n {\n open,\n onOpenChange,\n operators,\n signerOptions,\n currentOperatorId,\n allowAssignLater = true,\n initialOperatorId,\n initialSigners,\n maxSigners = 2,\n busy = false,\n error,\n title,\n description,\n onRequestSignature,\n contentProps,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n\n const nextRowId = useRef(0);\n const addButtonRef = useRef<HTMLButtonElement>(null);\n\n // Channels a given signer can receive on — the person's `availableChannels`\n // filtered into canonical order; omitted/empty means every channel.\n const channelsFor = (signerId: string): SignatureChannel[] => {\n const allowed = signerOptions.find(\n (option) => option.value === signerId,\n )?.availableChannels;\n return allowed && allowed.length > 0\n ? CHANNEL_ORDER.filter((channel) => allowed.includes(channel))\n : CHANNEL_ORDER;\n };\n\n // First available channel for a signer, preferring `preferred` when offered.\n const resolveChannel = (\n signerId: string,\n preferred: SignatureChannel,\n ): SignatureChannel => {\n const available = channelsFor(signerId);\n return available.includes(preferred) ? preferred : available[0];\n };\n\n const seedOperator = () => {\n if (initialOperatorId === null) {\n return allowAssignLater\n ? ASSIGN_LATER\n : (operators[0]?.value ?? ASSIGN_LATER);\n }\n return (\n initialOperatorId ??\n operators[0]?.value ??\n (allowAssignLater ? ASSIGN_LATER : '')\n );\n };\n const seedRows = (): RosterRow[] => {\n const seed =\n initialSigners && initialSigners.length > 0\n ? initialSigners\n : signerOptions.length > 0\n ? [\n {\n signerId: signerOptions[0].value,\n channel: resolveChannel(signerOptions[0].value, 'on-device'),\n },\n ]\n : [];\n return seed.map((signer) => ({ ...signer, rowId: nextRowId.current++ }));\n };\n\n const [operator, setOperator] = useState<string>(seedOperator);\n const [signers, setSigners] = useState<RosterRow[]>(seedRows);\n\n // Re-seed the form whenever the host reopens the (still-mounted) modal,\n // so a previous request's choices never leak into the next one.\n const wasOpen = useRef(open);\n useEffect(() => {\n if (open && !wasOpen.current) {\n setOperator(seedOperator());\n setSigners(seedRows());\n }\n wasOpen.current = open;\n // The seeds intentionally read the render-time props on the rising\n // edge only — prop changes while open (or closed) don't reset input.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n\n const operatorSelectOptions = allowAssignLater\n ? [\n ...operators,\n { value: ASSIGN_LATER, label: t('signatureRequest.assignLater') },\n ]\n : operators;\n const isUnassigned = operator === ASSIGN_LATER;\n\n const channelMeta: Record<\n SignatureChannel,\n { label: string; icon: React.ReactNode }\n > = {\n sms: {\n label: t('signatureRequest.viaSms'),\n icon: <MessageSquareText className=\"ds:size-4\" aria-hidden />,\n },\n email: {\n label: t('signatureRequest.viaEmail'),\n icon: <Mail className=\"ds:size-4\" aria-hidden />,\n },\n whatsapp: {\n label: t('signatureRequest.viaWhatsapp'),\n icon: <WhatsAppGlyph className=\"ds:size-4\" aria-hidden />,\n },\n 'on-device': {\n label: t('signatureRequest.onThisDevice'),\n icon: <Tablet className=\"ds:size-4\" aria-hidden />,\n },\n };\n\n const chosenIds = signers.map((signer) => signer.signerId);\n const nextFreeOption = signerOptions.find(\n (option) => !chosenIds.includes(option.value),\n );\n const canAddSigner =\n !busy && signers.length < maxSigners && nextFreeOption !== undefined;\n\n const patchSigner = (rowId: number, patch: Partial<SignerRequest>) => {\n setSigners((current) =>\n current.map((signer) =>\n signer.rowId === rowId ? { ...signer, ...patch } : signer,\n ),\n );\n };\n\n const addSigner = () => {\n if (!nextFreeOption) return;\n setSigners((current) => [\n ...current,\n {\n signerId: nextFreeOption.value,\n channel: resolveChannel(nextFreeOption.value, 'sms'),\n rowId: nextRowId.current++,\n },\n ]);\n };\n\n const removeSigner = (rowId: number) => {\n // Move focus BEFORE the row (and the focused remove button) unmounts —\n // otherwise Radix's focus scope dumps focus on the dialog container.\n addButtonRef.current?.focus();\n setSigners((current) =>\n current.filter((signer) => signer.rowId !== rowId),\n );\n };\n\n const handleRequest = () => {\n onRequestSignature({\n operatorId: isUnassigned ? null : operator,\n signers: signers.map(({ rowId: _rowId, ...signer }) => signer),\n });\n };\n\n return (\n <div ref={ref} className=\"ds:contents\" data-component=\"signature-request\">\n <Dialog open={open} onOpenChange={onOpenChange}>\n <Dialog.Content size=\"lg\" hideCloseButton {...contentProps}>\n <Dialog.Header>\n <Dialog.Title>\n {title ?? t('signatureRequest.title')}\n </Dialog.Title>\n <Dialog.Description>\n {description ?? t('signatureRequest.noSignedVersions')}\n </Dialog.Description>\n </Dialog.Header>\n\n <Dialog.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <section className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <p className=\"type-eyebrow ds:text-start ds:text-[color:var(--muted-foreground)]\">\n {t('signatureRequest.operatorSection')}\n </p>\n {currentOperatorId !== undefined ? (\n <Button\n intent=\"primary\"\n size=\"sm\"\n startIcon={<UserPlus />}\n disabled={busy}\n onClick={() => setOperator(currentOperatorId)}\n >\n {t('signatureRequest.assignToMe')}\n </Button>\n ) : null}\n </div>\n\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n {/* Mirrors the select value — decorative for AT. No name →\n Avatar's built-in placeholder-icon fallback. */}\n <Avatar\n aria-hidden=\"true\"\n name={\n isUnassigned ? undefined : labelFor(operators, operator)\n }\n size=\"sm\"\n />\n <div className=\"ds:min-w-0 ds:flex-1 ds:text-start\">\n <Select\n options={operatorSelectOptions}\n value={operator}\n onValueChange={(value) => value && setOperator(value)}\n required\n disabled={busy}\n placeholder={t('signatureRequest.operatorPlaceholder')}\n aria-label={t('signatureRequest.operatorSection')}\n />\n </div>\n </div>\n\n {isUnassigned ? null : (\n <Alert variant=\"info\">\n <Alert.Description>\n {t('signatureRequest.operatorHint')}\n </Alert.Description>\n </Alert>\n )}\n </section>\n\n <Separator decorative />\n\n <section className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:text-start\">\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <p className=\"type-eyebrow ds:text-[color:var(--muted-foreground)]\">\n {t('signatureRequest.signersSection')}\n </p>\n <Button\n ref={addButtonRef}\n intent=\"primary\"\n size=\"sm\"\n startIcon={<Plus />}\n disabled={!canAddSigner}\n onClick={addSigner}\n >\n {t('signatureRequest.addSigner')}\n </Button>\n </div>\n\n {signers.map((signer) => {\n const rowOptions = signerOptions.filter(\n (option) =>\n option.value === signer.signerId ||\n !chosenIds.includes(option.value),\n );\n const rowLabel = labelFor(signerOptions, signer.signerId);\n const rowChannelOptions = channelsFor(signer.signerId).map(\n (channel) => ({ value: channel, ...channelMeta[channel] }),\n );\n return (\n <div\n key={signer.rowId}\n role=\"group\"\n aria-label={rowLabel}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\"\n >\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n {/* Mirrors the select value — decorative for AT. */}\n <Avatar aria-hidden=\"true\" name={rowLabel} size=\"sm\" />\n <div className=\"ds:min-w-0 ds:flex-1\">\n <Select\n options={rowOptions}\n value={signer.signerId}\n onValueChange={(value) => {\n if (!value) return;\n const channel = resolveChannel(\n value,\n signer.channel,\n );\n patchSigner(signer.rowId, {\n signerId: value,\n channel,\n skipOtp:\n channel === 'on-device'\n ? signer.skipOtp\n : undefined,\n });\n }}\n required\n disabled={busy}\n placeholder={t(\n 'signatureRequest.signerPlaceholder',\n )}\n aria-label={t('signatureRequest.signerPlaceholder')}\n />\n </div>\n {signers.length > 1 ? (\n <IconButton\n intent=\"ghost\"\n size=\"sm\"\n icon={<X />}\n disabled={busy}\n aria-label={t('signatureRequest.removeSigner')}\n onClick={() => removeSigner(signer.rowId)}\n />\n ) : null}\n </div>\n\n {/* One channel per signer — checkbox visuals, but the\n choice is mutually exclusive: checking a channel\n unchecks the others, and the active one can't be\n unchecked. */}\n <div\n role=\"group\"\n aria-label={t('signatureRequest.channelLabel')}\n className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-lg)] ds:gap-y-[var(--spacing-sm)] ds:ps-[var(--spacing-xl)]\"\n >\n {rowChannelOptions.map((option) => (\n <Checkbox\n key={option.value}\n checked={signer.channel === option.value}\n disabled={busy}\n onCheckedChange={(checked) =>\n checked === true &&\n patchSigner(signer.rowId, {\n channel: option.value,\n skipOtp: undefined,\n })\n }\n label={\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <span\n aria-hidden=\"true\"\n className=\"ds:text-[var(--accent)]\"\n >\n {option.icon}\n </span>\n {option.label}\n </span>\n }\n />\n ))}\n </div>\n\n {signer.channel === 'on-device' ? (\n <div className=\"ds:ps-[var(--spacing-xl)]\">\n <Switch\n label={t('signatureRequest.noOtp')}\n checked={signer.skipOtp === true}\n disabled={busy}\n onCheckedChange={(checked) =>\n patchSigner(signer.rowId, { skipOtp: checked })\n }\n />\n </div>\n ) : null}\n </div>\n );\n })}\n </section>\n\n {/* Dedicated alert area — one warning regardless of how many\n signers waive OTP, stacked with any submission error, all at\n the same full width as the operator hint. */}\n {signers.some(\n (signer) =>\n signer.channel === 'on-device' && signer.skipOtp === true,\n ) ? (\n <Alert variant=\"warning\">\n <Alert.Description>\n {t('signatureRequest.noOtpWarning')}\n </Alert.Description>\n </Alert>\n ) : null}\n {error ? (\n <Alert variant=\"error\">\n <Alert.Description>{error}</Alert.Description>\n </Alert>\n ) : null}\n </Dialog.Body>\n\n <Dialog.Footer>\n <Button\n intent=\"primary\"\n startIcon={<PenLine />}\n onClick={handleRequest}\n disabled={busy || signers.length === 0}\n loading={busy}\n >\n {t('signatureRequest.requestSignature')}\n </Button>\n <Dialog.Close asChild>\n <Button intent=\"outline\" disabled={busy}>\n {t('signatureRequest.close')}\n </Button>\n </Dialog.Close>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n </div>\n );\n },\n);\nSignatureRequestModal.displayName = 'SignatureRequestModal';\n"],"names":["__iconNode","MessageSquareText","createLucideIcon","Tablet","UserPlus","ASSIGN_LATER","CHANNEL_ORDER","labelFor","options","value","_a","option","SignatureRequestModal","forwardRef","open","onOpenChange","operators","signerOptions","currentOperatorId","allowAssignLater","initialOperatorId","initialSigners","maxSigners","busy","error","title","description","onRequestSignature","contentProps","ref","t","useTranslation","nextRowId","useRef","addButtonRef","channelsFor","signerId","allowed","channel","resolveChannel","preferred","available","seedOperator","_b","seedRows","signer","operator","setOperator","useState","signers","setSigners","wasOpen","useEffect","operatorSelectOptions","isUnassigned","channelMeta","jsx","Mail","WhatsAppGlyph","chosenIds","nextFreeOption","canAddSigner","patchSigner","rowId","patch","current","addSigner","removeSigner","handleRequest","_rowId","Dialog","jsxs","Button","Avatar","Select","Alert","Separator","Plus","rowOptions","rowLabel","rowChannelOptions","IconButton","X","Checkbox","checked","Switch","PenLine"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,UAAU,KAAK,SAAQ,CAAE;AACzC,GACMC,KAAoBC,EAAiB,uBAAuBF,EAAU;ACrB5E;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,OAAO,MAAM,QAAQ,MAAM,GAAG,KAAK,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,KAA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ACF;AACAlB,GAAsB,cAAc;","x_google_ignoreList":[0,1,2]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-tray-Br3vc0O1.js","sources":["../../node_modules/lucide-react/dist/esm/icons/list-todo.mjs","../../src/components/task-tray/task-tray.agent.ts","../../src/components/task-tray/task-tray.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M13 5h8\", key: \"a7qcls\" }],\n [\"path\", { d: \"M13 12h8\", key: \"h98zly\" }],\n [\"path\", { d: \"M13 19h8\", key: \"c3s6r1\" }],\n [\"path\", { d: \"m3 17 2 2 4-4\", key: \"1jhpwq\" }],\n [\"rect\", { x: \"3\", y: \"4\", width: \"6\", height: \"6\", rx: \"1\", key: \"cif1o7\" }]\n];\nconst ListTodo = createLucideIcon(\"list-todo\", __iconNode);\n\nexport { __iconNode, ListTodo as default };\n//# sourceMappingURL=list-todo.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — TaskTray. */\n/* */\n/* Tray-level surface: read the current task ids + status, route a */\n/* `select_item` activation, and `toggle_done` / `dismiss` per task */\n/* through the curated handle. TaskTray is in-page (no open/close), */\n/* so it declares neither `open` nor `close`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { TaskTrayHandle } from './task-tray';\n\nexport const taskTrayAgent: AgentAdapter<TaskTrayHandle> = {\n id: 'task-tray',\n capabilities: ['select_single', 'dismiss'],\n state: {\n items: {\n type: 'Array<{ id: string; status: string }>',\n descriptionKey: 'ui.agent.taskTray.state.items',\n description:\n 'Currently-displayed tasks. Ids + status only — never task title / patient.',\n read: (handle) => handle.getItems(),\n },\n },\n actions: {\n select_item: {\n safety: 'read',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.taskTray.actions.selectItem',\n description: 'Activate the task with the given id.',\n invoke: (handle, args: { id: string }) => {\n handle.selectItem(args.id);\n },\n },\n toggle_done: {\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n descriptionKey: 'ui.agent.taskTray.actions.toggleDone',\n description: 'Request the host to toggle the done state of a task.',\n invoke: (handle, args: { id: string }) => {\n handle.toggleDone(args.id);\n },\n },\n dismiss: {\n safety: 'destructive',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.taskTray.actions.dismiss',\n description:\n 'Request the host to dismiss / remove the task with the given id.',\n invoke: (handle, args: { id: string }) => {\n handle.dismiss(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'task-tray',\n description: 'Marks the TaskTray wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific tray from the agent.',\n },\n item: {\n attr: 'data-task-id',\n description:\n 'Stable task id emitted on each rendered TaskCard inside the tray.',\n },\n },\n};\n","import {\n forwardRef,\n useImperativeHandle,\n useMemo,\n useRef,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ListTodo, Plus } from 'lucide-react';\nimport { IconButton } from '../button/icon-button';\nimport { Skeleton } from '../skeleton/skeleton';\nimport { EmptyState } from '../empty-state/empty-state';\nimport { TaskCard, type TaskItem } from '../task-card';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { taskTrayAgent } from './task-tray.agent';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst taskTrayVariants = cva(\n [\n 'ds:flex ds:flex-col',\n 'ds:rounded-[var(--radius-md)] ds:shadow-[var(--shadow-card)]',\n 'ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2',\n 'ds:bg-[color:var(--card)] ds:text-[color:var(--card-foreground)]',\n 'ds:overflow-hidden',\n ].join(' '),\n {\n variants: {\n size: {\n sm: '',\n md: '',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\n/**\n * Curated imperative handle for TaskTray. Exposed as the forwardRef\n * target so a future agent / MCP UI bridge can drive the tray without\n * touching the DOM. See `task-tray.agent.ts`.\n */\nexport interface TaskTrayHandle {\n getItems: () => Array<{ id: string; status: string }>;\n selectItem: (id: string) => void;\n toggleDone: (id: string) => void;\n dismiss: (id: string) => void;\n}\n\nexport interface TaskTrayProps\n extends\n Omit<HTMLAttributes<HTMLElement>, 'onClick' | 'id'>,\n VariantProps<typeof taskTrayVariants> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so\n * an agent / MCP UI bridge can address this specific tray.\n */\n id?: string;\n /** Tasks rendered inside the panel. */\n items: TaskItem[];\n /** Section title — rendered in the header. Localised by the consumer. */\n title?: string;\n /** Visual density forwarded to each TaskCard. */\n size?: 'sm' | 'md';\n /** Fires when the user activates a task (click / Enter / Space). */\n onOpenTask?: (item: TaskItem) => void;\n /** Fires when the host should toggle the done state of a task. Used by agent integration. */\n onToggleDone?: (item: TaskItem) => void;\n /** Fires when the host should dismiss / remove a task. Used by agent integration. */\n onDismissTask?: (item: TaskItem) => void;\n /** Fires when the user activates the header \"Add\" affordance. */\n onAddTask?: () => void;\n /** Localised label for the \"Add\" affordance. Defaults to `ui.taskTray.add`. */\n addLabel?: string;\n /** When true the panel renders skeleton placeholders. */\n loading?: boolean;\n /** Render an empty state when `items` is empty and `loading` is false. */\n emptyTitle?: string;\n emptyDescription?: string;\n /** Optional CTA wired into the empty state (EmptyState primaryAction). */\n emptyAction?: { label: string; onClick: () => void };\n /**\n * Pinned footer link (e.g. \"All my undone tasks (12)\"). Localised by\n * the consumer; rendered after the list, before the section closes.\n */\n viewAllLabel?: string;\n /** Fires when the footer link is activated. Required to render it. */\n onViewAll?: () => void;\n /**\n * Per-row trailing action toolbar, forwarded to each TaskCard's\n * `actions` slot.\n */\n renderItemActions?: (item: TaskItem) => ReactNode;\n /**\n * Constrain the list to the tray's own height and scroll inside it —\n * pair with a height/max-height on `className`. The scroll region is\n * keyboard-focusable so it stays operable without a pointer.\n */\n scrollable?: boolean;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const TaskTray = forwardRef<HTMLElement, TaskTrayProps>(\n (\n {\n id,\n items,\n title,\n size = 'sm',\n onOpenTask,\n onToggleDone,\n onDismissTask,\n onAddTask,\n addLabel,\n loading = false,\n emptyTitle,\n emptyDescription,\n emptyAction,\n viewAllLabel,\n onViewAll,\n renderItemActions,\n scrollable = false,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const heading = title ?? t('taskTray.title', 'Tasks');\n const resolvedAddLabel = addLabel ?? t('taskTray.add', 'Add task');\n const isEmpty = !loading && items.length === 0;\n\n let body: ReactNode;\n if (loading) {\n body = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)]\">\n {[0, 1, 2].map((i) => (\n <Skeleton key={i} variant=\"rectangular\" height=\"2.5rem\" />\n ))}\n </div>\n );\n } else if (isEmpty) {\n body = (\n <div className=\"ds:p-[var(--spacing-md)]\">\n <EmptyState\n variant=\"first-use\"\n size=\"sm\"\n title={emptyTitle ?? t('taskTray.empty.title', 'No tasks yet')}\n description={\n emptyDescription ??\n t('taskTray.empty.description', 'New tasks will appear here.')\n }\n primaryAction={emptyAction}\n />\n </div>\n );\n } else {\n body = (\n <ul\n className={[\n // flex-1 unconditionally so a footer pins to the tray's\n // bottom edge in equal-height grid rows.\n 'ds:flex ds:list-none ds:flex-col ds:flex-1 ds:min-h-0',\n // Keyboard-focusable when it scrolls (axe\n // scrollable-region-focusable) — pair with a height on the\n // tray's className.\n scrollable ? 'ds:overflow-y-auto' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- scrollable list must be keyboard focusable (axe scrollable-region-focusable)\n tabIndex={scrollable ? 0 : undefined}\n aria-label={scrollable ? heading : undefined}\n >\n {items.map((item) => (\n <TaskCard\n key={item.id}\n item={item}\n size={size}\n onActivate={onOpenTask}\n actions={renderItemActions?.(item)}\n data-task-id={item.id}\n />\n ))}\n </ul>\n );\n }\n\n /* Curated imperative handle for agent integration. See\n * task-tray.agent.ts. */\n const itemsRef = useRef<TaskItem[]>(items);\n itemsRef.current = items;\n\n const handle = useMemo<TaskTrayHandle>(\n () => ({\n getItems: () =>\n itemsRef.current.map((i) => ({\n id: i.id,\n status: i.status ?? 'open',\n })),\n selectItem: (targetId: string) => {\n const found = itemsRef.current.find((i) => i.id === targetId);\n if (found) onOpenTask?.(found);\n },\n toggleDone: (targetId: string) => {\n const found = itemsRef.current.find((i) => i.id === targetId);\n if (found) onToggleDone?.(found);\n },\n dismiss: (targetId: string) => {\n const found = itemsRef.current.find((i) => i.id === targetId);\n if (found) onDismissTask?.(found);\n },\n }),\n [onOpenTask, onToggleDone, onDismissTask],\n );\n\n const rootRef = useRef<HTMLElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLElement, []);\n useAgentRegistration(taskTrayAgent, handle, id);\n\n return (\n <section\n ref={rootRef}\n aria-label={heading}\n data-component=\"task-tray\"\n data-component-id={id}\n className={taskTrayVariants({ size, className })}\n {...rest}\n >\n <header className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)]\">\n <h3 className=\"ds:m-0 ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-title-card\">\n <ListTodo aria-hidden=\"true\" className=\"ds:size-4\" />\n {heading}\n </h3>\n {onAddTask ? (\n <IconButton\n icon={<Plus />}\n intent=\"outline\"\n size=\"sm\"\n aria-label={resolvedAddLabel}\n onClick={onAddTask}\n />\n ) : null}\n </header>\n {body}\n {viewAllLabel && onViewAll && !isEmpty && !loading ? (\n <footer className=\"ds:[border-block-start:var(--border-width-sm)_solid_var(--card-border)] ds:p-[var(--spacing-sm)]\">\n <button\n type=\"button\"\n onClick={onViewAll}\n className={[\n 'type-label ds:text-[color:var(--link)] ds:underline ds:underline-offset-2 ds:hover:no-underline',\n 'ds:rounded-[var(--radius-sm)] ds:min-h-[var(--min-target-size)] ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n ].join(' ')}\n >\n {viewAllLabel}\n </button>\n </footer>\n ) : null}\n </section>\n );\n },\n);\n\nTaskTray.displayName = 'TaskTray';\n"],"names":["__iconNode","ListTodo","createLucideIcon","taskTrayAgent","handle","args","taskTrayVariants","cva","TaskTray","forwardRef","id","items","title","size","onOpenTask","onToggleDone","onDismissTask","onAddTask","addLabel","loading","emptyTitle","emptyDescription","emptyAction","viewAllLabel","onViewAll","renderItemActions","scrollable","className","rest","ref","t","useTranslation","heading","resolvedAddLabel","isEmpty","body","jsx","i","Skeleton","EmptyState","item","TaskCard","itemsRef","useRef","useMemo","targetId","found","rootRef","useImperativeHandle","useAgentRegistration","jsxs","IconButton","Plus"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE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