@alfadocs/ui-kit-debug 1.10.1 → 1.12.4

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 (213) hide show
  1. package/dist/_chunks/{actions-cell-renderer-xfSYiTXQ.js → actions-cell-renderer-BCEjn3-f.js} +2 -2
  2. package/dist/_chunks/{actions-cell-renderer-xfSYiTXQ.js.map → actions-cell-renderer-BCEjn3-f.js.map} +1 -1
  3. package/dist/_chunks/{anamnesis-summary-rows-d44s_whc.js → anamnesis-summary-rows-BfhxWPO3.js} +1421 -1418
  4. package/dist/_chunks/anamnesis-summary-rows-BfhxWPO3.js.map +1 -0
  5. package/dist/_chunks/appointment-card-Dzr3GeVz.js.map +1 -1
  6. package/dist/_chunks/appointment-timeline-DCn0Jx55.js +403 -0
  7. package/dist/_chunks/appointment-timeline-DCn0Jx55.js.map +1 -0
  8. package/dist/_chunks/{balance-badge-cell-C_Qz76x7.js → balance-badge-cell-BrlikHfT.js} +317 -290
  9. package/dist/_chunks/balance-badge-cell-BrlikHfT.js.map +1 -0
  10. package/dist/_chunks/booking-CBHKdsZl.js +2906 -0
  11. package/dist/_chunks/booking-CBHKdsZl.js.map +1 -0
  12. package/dist/_chunks/{chart-Bkr1Sh4o.js → chart-C6eHTxkO.js} +2 -2
  13. package/dist/_chunks/{chart-Bkr1Sh4o.js.map → chart-C6eHTxkO.js.map} +1 -1
  14. package/dist/_chunks/{contact-profile-card-CE9OJKcl.js → contact-profile-card-BMIBr5s9.js} +104 -125
  15. package/dist/_chunks/contact-profile-card-BMIBr5s9.js.map +1 -0
  16. package/dist/_chunks/{control-room-rail-Cj2iX9h_.js → control-room-rail-iO_BCaq1.js} +2 -2
  17. package/dist/_chunks/{control-room-rail-Cj2iX9h_.js.map → control-room-rail-iO_BCaq1.js.map} +1 -1
  18. package/dist/_chunks/{editable-currency-cell-renderer-zLf_bXvL.js → editable-currency-cell-renderer-B7TVZ5ZJ.js} +2 -2
  19. package/dist/_chunks/{editable-currency-cell-renderer-zLf_bXvL.js.map → editable-currency-cell-renderer-B7TVZ5ZJ.js.map} +1 -1
  20. package/dist/_chunks/{face-scheme-BfDi4YkW.js → face-scheme-CZaKm6fG.js} +2 -2
  21. package/dist/_chunks/{face-scheme-BfDi4YkW.js.map → face-scheme-CZaKm6fG.js.map} +1 -1
  22. package/dist/_chunks/{file-manager-Df6hyUYg.js → file-manager-Moc7sUFj.js} +3 -3
  23. package/dist/_chunks/{file-manager-Df6hyUYg.js.map → file-manager-Moc7sUFj.js.map} +1 -1
  24. package/dist/_chunks/format-price-DNqXPa_q.js +61 -0
  25. package/dist/_chunks/format-price-DNqXPa_q.js.map +1 -0
  26. package/dist/_chunks/{header-settings-CVC_davE.js → header-settings-J-ZCAfir.js} +2 -2
  27. package/dist/_chunks/{header-settings-CVC_davE.js.map → header-settings-J-ZCAfir.js.map} +1 -1
  28. package/dist/_chunks/{icon-button-group-D6SVMteH.js → icon-button-group-VCCod3Hz.js} +154 -145
  29. package/dist/_chunks/icon-button-group-VCCod3Hz.js.map +1 -0
  30. package/dist/_chunks/{link-cell-renderer-Cp2MSlJl.js → link-cell-renderer-CenJx-_7.js} +197 -181
  31. package/dist/_chunks/link-cell-renderer-CenJx-_7.js.map +1 -0
  32. package/dist/_chunks/{marketplace-app-shell-Chfdia7m.js → marketplace-app-shell-DDQXQ8hX.js} +2 -2
  33. package/dist/_chunks/{marketplace-app-shell-Chfdia7m.js.map → marketplace-app-shell-DDQXQ8hX.js.map} +1 -1
  34. package/dist/_chunks/{notes-panel-e9cJWVRg.js → notes-panel-CymneXtl.js} +93 -91
  35. package/dist/_chunks/notes-panel-CymneXtl.js.map +1 -0
  36. package/dist/_chunks/{practice-results-BEsAdW-B.js → practice-results-D7ygCj_W.js} +333 -291
  37. package/dist/_chunks/practice-results-D7ygCj_W.js.map +1 -0
  38. package/dist/_chunks/{signature-request-CW30B77U.js → signature-request-DVDTKLjM.js} +2 -2
  39. package/dist/_chunks/{signature-request-CW30B77U.js.map → signature-request-DVDTKLjM.js.map} +1 -1
  40. package/dist/_chunks/{stepper-accordion-BeVMZPuG.js → stepper-accordion-DmVykr5F.js} +91 -88
  41. package/dist/_chunks/stepper-accordion-DmVykr5F.js.map +1 -0
  42. package/dist/_chunks/{theme-toggle-DuMhQNFS.js → theme-toggle-uEwoKjl3.js} +2 -2
  43. package/dist/_chunks/{theme-toggle-DuMhQNFS.js.map → theme-toggle-uEwoKjl3.js.map} +1 -1
  44. package/dist/_chunks/{tool-rail-CHyUmulN.js → tool-rail-8Scslq3X.js} +2 -2
  45. package/dist/_chunks/tool-rail-8Scslq3X.js.map +1 -0
  46. package/dist/_chunks/{whatsapp-button-Ca9towA4.js → whatsapp-button-CuFIHJzG.js} +27 -19
  47. package/dist/_chunks/{whatsapp-button-Ca9towA4.js.map → whatsapp-button-CuFIHJzG.js.map} +1 -1
  48. package/dist/agent-catalog.json +12 -5
  49. package/dist/agent-i18n/en.json +4 -3
  50. package/dist/components/_shared/format-price.d.ts +21 -0
  51. package/dist/components/_shared/format-price.d.ts.map +1 -0
  52. package/dist/components/_shared/index.d.ts +1 -0
  53. package/dist/components/_shared/index.d.ts.map +1 -1
  54. package/dist/components/_shared/stepper.d.ts +28 -2
  55. package/dist/components/_shared/stepper.d.ts.map +1 -1
  56. package/dist/components/appointment-card/appointment-card.d.ts +1 -1
  57. package/dist/components/appointment-card/appointment-card.d.ts.map +1 -1
  58. package/dist/components/appointment-timeline/appointment-timeline.agent.d.ts.map +1 -1
  59. package/dist/components/appointment-timeline/appointment-timeline.d.ts +8 -0
  60. package/dist/components/appointment-timeline/appointment-timeline.d.ts.map +1 -1
  61. package/dist/components/appointment-timeline/index.js +1 -1
  62. package/dist/components/booking/booking-types.d.ts +15 -2
  63. package/dist/components/booking/booking-types.d.ts.map +1 -1
  64. package/dist/components/booking/booking.agent.d.ts.map +1 -1
  65. package/dist/components/booking/booking.d.ts.map +1 -1
  66. package/dist/components/booking/index.js +1 -1
  67. package/dist/components/chart/index.js +1 -1
  68. package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
  69. package/dist/components/contact-profile-card/index.js +1 -1
  70. package/dist/components/control-room-rail/index.js +1 -1
  71. package/dist/components/data-table/filters/date-range-filter.d.ts +22 -0
  72. package/dist/components/data-table/filters/date-range-filter.d.ts.map +1 -1
  73. package/dist/components/data-table/index.js +3 -3
  74. package/dist/components/face-scheme/index.js +1 -1
  75. package/dist/components/file-manager/index.js +1 -1
  76. package/dist/components/header-settings/index.js +1 -1
  77. package/dist/components/icon-button-group/icon-button-group.d.ts.map +1 -1
  78. package/dist/components/icon-button-group/index.js +1 -1
  79. package/dist/components/notes-panel/index.js +1 -1
  80. package/dist/components/notes-panel/notes-panel.agent.d.ts.map +1 -1
  81. package/dist/components/notes-panel/notes-panel.d.ts +6 -0
  82. package/dist/components/notes-panel/notes-panel.d.ts.map +1 -1
  83. package/dist/components/patient-table/columns.d.ts.map +1 -1
  84. package/dist/components/patient-table/index.js +1 -1
  85. package/dist/components/practice-results/index.js +1 -1
  86. package/dist/components/practice-results/practice-results.d.ts +18 -0
  87. package/dist/components/practice-results/practice-results.d.ts.map +1 -1
  88. package/dist/components/stepper-accordion/index.js +1 -1
  89. package/dist/components/stepper-accordion/stepper-accordion.d.ts.map +1 -1
  90. package/dist/components/theme-toggle/index.js +1 -1
  91. package/dist/components/tool-rail/index.js +1 -1
  92. package/dist/components/tool-rail/tool-rail.d.ts +1 -1
  93. package/dist/components/tool-rail/tool-rail.d.ts.map +1 -1
  94. package/dist/components/whatsapp-button/index.js +1 -1
  95. package/dist/components/whatsapp-button/whatsapp-button.d.ts.map +1 -1
  96. package/dist/host-compat.css +7 -1
  97. package/dist/i18n/locales/ar.d.ts +4 -0
  98. package/dist/i18n/locales/ar.d.ts.map +1 -1
  99. package/dist/i18n/locales/ar.js +5 -1
  100. package/dist/i18n/locales/ar.js.map +1 -1
  101. package/dist/i18n/locales/de.d.ts +5 -1
  102. package/dist/i18n/locales/de.d.ts.map +1 -1
  103. package/dist/i18n/locales/de.js +6 -2
  104. package/dist/i18n/locales/de.js.map +1 -1
  105. package/dist/i18n/locales/el.d.ts +4 -0
  106. package/dist/i18n/locales/el.d.ts.map +1 -1
  107. package/dist/i18n/locales/el.js +5 -1
  108. package/dist/i18n/locales/el.js.map +1 -1
  109. package/dist/i18n/locales/en.d.ts +4 -0
  110. package/dist/i18n/locales/en.d.ts.map +1 -1
  111. package/dist/i18n/locales/en.js +5 -1
  112. package/dist/i18n/locales/en.js.map +1 -1
  113. package/dist/i18n/locales/es.d.ts +5 -1
  114. package/dist/i18n/locales/es.d.ts.map +1 -1
  115. package/dist/i18n/locales/es.js +6 -2
  116. package/dist/i18n/locales/es.js.map +1 -1
  117. package/dist/i18n/locales/fr.d.ts +5 -1
  118. package/dist/i18n/locales/fr.d.ts.map +1 -1
  119. package/dist/i18n/locales/fr.js +6 -2
  120. package/dist/i18n/locales/fr.js.map +1 -1
  121. package/dist/i18n/locales/hi.d.ts +4 -0
  122. package/dist/i18n/locales/hi.d.ts.map +1 -1
  123. package/dist/i18n/locales/hi.js +5 -1
  124. package/dist/i18n/locales/hi.js.map +1 -1
  125. package/dist/i18n/locales/it.d.ts +4 -0
  126. package/dist/i18n/locales/it.d.ts.map +1 -1
  127. package/dist/i18n/locales/it.js +5 -1
  128. package/dist/i18n/locales/it.js.map +1 -1
  129. package/dist/i18n/locales/ja.d.ts +4 -0
  130. package/dist/i18n/locales/ja.d.ts.map +1 -1
  131. package/dist/i18n/locales/ja.js +5 -1
  132. package/dist/i18n/locales/ja.js.map +1 -1
  133. package/dist/i18n/locales/nl.d.ts +5 -1
  134. package/dist/i18n/locales/nl.d.ts.map +1 -1
  135. package/dist/i18n/locales/nl.js +6 -2
  136. package/dist/i18n/locales/nl.js.map +1 -1
  137. package/dist/i18n/locales/pl.d.ts +4 -0
  138. package/dist/i18n/locales/pl.d.ts.map +1 -1
  139. package/dist/i18n/locales/pl.js +5 -1
  140. package/dist/i18n/locales/pl.js.map +1 -1
  141. package/dist/i18n/locales/pt.d.ts +5 -1
  142. package/dist/i18n/locales/pt.d.ts.map +1 -1
  143. package/dist/i18n/locales/pt.js +6 -2
  144. package/dist/i18n/locales/pt.js.map +1 -1
  145. package/dist/i18n/locales/ro.d.ts +4 -0
  146. package/dist/i18n/locales/ro.d.ts.map +1 -1
  147. package/dist/i18n/locales/ro.js +5 -1
  148. package/dist/i18n/locales/ro.js.map +1 -1
  149. package/dist/i18n/locales/ru.d.ts +4 -0
  150. package/dist/i18n/locales/ru.d.ts.map +1 -1
  151. package/dist/i18n/locales/ru.js +5 -1
  152. package/dist/i18n/locales/ru.js.map +1 -1
  153. package/dist/i18n/locales/sq.d.ts +4 -0
  154. package/dist/i18n/locales/sq.d.ts.map +1 -1
  155. package/dist/i18n/locales/sq.js +5 -1
  156. package/dist/i18n/locales/sq.js.map +1 -1
  157. package/dist/i18n/locales/sv.d.ts +4 -0
  158. package/dist/i18n/locales/sv.d.ts.map +1 -1
  159. package/dist/i18n/locales/sv.js +5 -1
  160. package/dist/i18n/locales/sv.js.map +1 -1
  161. package/dist/i18n/locales/tr.d.ts +4 -0
  162. package/dist/i18n/locales/tr.d.ts.map +1 -1
  163. package/dist/i18n/locales/tr.js +5 -1
  164. package/dist/i18n/locales/tr.js.map +1 -1
  165. package/dist/i18n/locales/zh.d.ts +4 -0
  166. package/dist/i18n/locales/zh.d.ts.map +1 -1
  167. package/dist/i18n/locales/zh.js +5 -1
  168. package/dist/i18n/locales/zh.js.map +1 -1
  169. package/dist/index.js +20 -20
  170. package/dist/locales/ar.json +5 -1
  171. package/dist/locales/de.json +6 -2
  172. package/dist/locales/el.json +5 -1
  173. package/dist/locales/en.json +5 -1
  174. package/dist/locales/es.json +6 -2
  175. package/dist/locales/fr.json +6 -2
  176. package/dist/locales/hi.json +5 -1
  177. package/dist/locales/it.json +5 -1
  178. package/dist/locales/ja.json +5 -1
  179. package/dist/locales/nl.json +6 -2
  180. package/dist/locales/pl.json +5 -1
  181. package/dist/locales/pt.json +6 -2
  182. package/dist/locales/ro.json +5 -1
  183. package/dist/locales/ru.json +5 -1
  184. package/dist/locales/sq.json +5 -1
  185. package/dist/locales/sv.json +5 -1
  186. package/dist/locales/tr.json +5 -1
  187. package/dist/locales/zh.json +5 -1
  188. package/dist/patterns/anamnesis/anamnesis-catalogue.d.ts.map +1 -1
  189. package/dist/patterns/anamnesis/anamnesis-compile.d.ts.map +1 -1
  190. package/dist/patterns/anamnesis/anamnesis-config.d.ts +18 -7
  191. package/dist/patterns/anamnesis/anamnesis-config.d.ts.map +1 -1
  192. package/dist/patterns/anamnesis/anamnesis-types.d.ts +8 -0
  193. package/dist/patterns/anamnesis/anamnesis-types.d.ts.map +1 -1
  194. package/dist/patterns/anamnesis/index.js +1 -1
  195. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  196. package/dist/patterns/signature-request/index.js +1 -1
  197. package/dist/tokens.css +1 -1
  198. package/package.json +1 -1
  199. package/dist/_chunks/anamnesis-summary-rows-d44s_whc.js.map +0 -1
  200. package/dist/_chunks/appointment-timeline-0mwtpErq.js +0 -388
  201. package/dist/_chunks/appointment-timeline-0mwtpErq.js.map +0 -1
  202. package/dist/_chunks/balance-badge-cell-C_Qz76x7.js.map +0 -1
  203. package/dist/_chunks/booking-DHkKcUIl.js +0 -2713
  204. package/dist/_chunks/booking-DHkKcUIl.js.map +0 -1
  205. package/dist/_chunks/contact-profile-card-CE9OJKcl.js.map +0 -1
  206. package/dist/_chunks/icon-button-group-D6SVMteH.js.map +0 -1
  207. package/dist/_chunks/languages-CGLX6Qpe.js +0 -19
  208. package/dist/_chunks/languages-CGLX6Qpe.js.map +0 -1
  209. package/dist/_chunks/link-cell-renderer-Cp2MSlJl.js.map +0 -1
  210. package/dist/_chunks/notes-panel-e9cJWVRg.js.map +0 -1
  211. package/dist/_chunks/practice-results-BEsAdW-B.js.map +0 -1
  212. package/dist/_chunks/stepper-accordion-BeVMZPuG.js.map +0 -1
  213. package/dist/_chunks/tool-rail-CHyUmulN.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper-accordion-DmVykr5F.js","sources":["../../src/components/_shared/stepper.ts","../../src/components/stepper-accordion/stepper-accordion.tsx"],"sourcesContent":["// Shared types + state machine for the two stepper variants:\n// - src/components/stepper-progress (lightweight progress bar + caption)\n// - src/components/stepper-accordion (vertical disclosure wizard)\n//\n// Both components consume `StepSpec` and the `stateForStep` helper so the\n// four-state machine (upcoming | current | completed | error) stays in one\n// place. Rename or removal is a MAJOR per src/docs/13-maintainability.mdx.\n\n/**\n * Consumer-supplied override for a step.\n *\n * - `completed` — the step holds a value; render the tick and let the user\n * back in to change it.\n * - `error` — the step's own validation failed; always wins.\n * - `unlocked` (1.11.0) — the step has been *reached* but holds no value of\n * its own. It renders exactly like an upcoming step, but the user may open\n * it. Added for flows whose final step can never report itself \"completed\"\n * because its validity belongs to a form inside it: without this, moving\n * the cursor backwards left that step HTML-`disabled` and unreachable.\n *\n * `'completed'` and `'error'` behave exactly as before, so consumers passing\n * either (or nothing) are unaffected. A consumer that reads this union back\n * in an exhaustive `switch` needs a case for `'unlocked'`; `StepState` — the\n * union such a switch usually runs on — is deliberately untouched.\n */\nexport type StepStatus = 'completed' | 'error' | 'unlocked';\n\nexport type StepState = 'upcoming' | 'current' | 'completed' | 'error';\n\nexport interface StepSpec {\n /** Visible step label — comes from the consumer, already translated. */\n label: string;\n /** Optional secondary line (kept short; shown in accordion + progress captions). */\n description?: string;\n /**\n * Consumer-explicit status override. `error` always wins; `completed` is\n * honoured only for steps at or beyond the active index so the active step\n * always keeps `current` (otherwise a consumer pre-setting `completed` on\n * every step would silently mask the current position). `unlocked` changes\n * reachability only — see `stepIsReachable` — and never the rendered state.\n */\n status?: StepStatus;\n}\n\nexport function stateForStep(\n index: number,\n activeStep: number,\n status?: StepStatus,\n): StepState {\n if (status === 'error') return 'error';\n if (index === activeStep) return 'current';\n if (status === 'completed') return 'completed';\n if (index < activeStep) return 'completed';\n // `unlocked` deliberately falls through: it is a reachability hint, not a\n // visual state, so the returned `StepState` union is unchanged and any\n // exhaustive switch a consumer already wrote keeps compiling.\n return 'upcoming';\n}\n\n/**\n * May the user open this step?\n *\n * Everything at or before the cursor is reachable, as is any step the\n * consumer has explicitly marked `completed`, `error` or `unlocked`.\n * Steps ahead of the cursor with no status stay locked, exactly as before.\n */\nexport function stepIsReachable(\n index: number,\n activeStep: number,\n status?: StepStatus,\n): boolean {\n if (status !== undefined) return true;\n return index <= activeStep;\n}\n","import {\n forwardRef,\n useImperativeHandle,\n useMemo,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\nimport * as AccordionPrimitive from '@radix-ui/react-accordion';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ChevronDown, Lock } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport {\n stateForStep,\n stepIsReachable,\n type StepSpec,\n type StepState,\n} from '../_shared/stepper';\n\n/* -------------------------------------------------------------------- */\n/* StepperAccordion */\n/* */\n/* Vertical disclosure wizard. The current step is expanded inline; */\n/* completed steps collapse to a one-line summary with an \"Edit\" hint */\n/* that re-opens them; upcoming steps are locked. Built on Radix */\n/* Accordion in controlled-single mode with collapsible=false so the */\n/* current panel always stays open. */\n/* -------------------------------------------------------------------- */\n\nconst STEP_VALUE_PREFIX = 'step-';\nconst makeValue = (index: number) => `${STEP_VALUE_PREFIX}${index}`;\nconst indexFromValue = (value: string): number =>\n Number(value.slice(STEP_VALUE_PREFIX.length));\n\n/* -------------------------------------------------------------------- */\n/* Indicator — shared with progress bar visual tone but sized for the */\n/* vertical wizard's dense header row. */\n/* -------------------------------------------------------------------- */\n\nconst iconDrawClasses = [\n 'ds:[stroke-dasharray:1] ds:[stroke-dashoffset:1]',\n 'ds:animate-[stepper-icon-draw_var(--animation-duration)_var(--ease-out)_forwards]',\n 'ds:motion-reduce:animate-none ds:motion-reduce:[stroke-dashoffset:0]',\n].join(' ');\n\nfunction CheckGlyph() {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n >\n <path pathLength=\"1\" d=\"M5 12l5 5L20 7\" className={iconDrawClasses} />\n </svg>\n );\n}\n\nfunction CrossGlyph() {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n >\n <path pathLength=\"1\" d=\"M6 6l12 12\" className={iconDrawClasses} />\n <path pathLength=\"1\" d=\"M18 6l-12 12\" className={iconDrawClasses} />\n </svg>\n );\n}\n\nconst indicatorClasses = [\n 'ds:inline-flex ds:shrink-0 ds:items-center ds:justify-center',\n 'ds:min-w-[var(--min-target-size)] ds:min-h-[var(--min-target-size)]',\n 'ds:size-[var(--min-target-size)]',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:text-[var(--font-size-sm)] ds:font-[var(--font-weight-semibold)]',\n 'ds:border ds:border-[var(--border)]',\n 'ds:transition-[background-color,border-color,color]',\n 'ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n].join(' ');\n\nconst indicatorVariants = cva(indicatorClasses, {\n variants: {\n state: {\n upcoming: 'ds:bg-[var(--background)] ds:text-[var(--muted-foreground)]',\n current: [\n 'ds:border-[var(--primary)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]',\n 'ds:animate-[stepper-indicator-pop_var(--animation-duration)_var(--ease-out)_both]',\n 'ds:motion-reduce:animate-none',\n ].join(' '),\n completed:\n 'ds:border-[var(--primary)] ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]',\n error: [\n 'ds:border-[var(--destructive)] ds:bg-[var(--destructive)] ds:text-[var(--destructive-foreground)]',\n 'ds:animate-[stepper-indicator-pop_var(--animation-duration)_var(--ease-out)_both]',\n 'ds:motion-reduce:animate-none',\n ].join(' '),\n },\n },\n});\n\n/* -------------------------------------------------------------------- */\n/* Item / trigger / content variants */\n/* -------------------------------------------------------------------- */\n\nconst itemVariants = cva(\n [\n 'ds:group/item ds:overflow-hidden ds:rounded-[var(--radius-md)]',\n 'ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2 ds:bg-[var(--card)]',\n 'ds:data-[state=open]:border-[var(--primary)]',\n 'ds:transition-[border-color] ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n ].join(' '),\n {\n variants: {\n tone: {\n neutral: '',\n error: 'ds:data-[state=open]:border-[var(--destructive)]',\n },\n },\n defaultVariants: { tone: 'neutral' },\n },\n);\n\nconst triggerClasses = [\n 'ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-sm)]',\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'ds:text-start',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed',\n 'ds:transition-[background-color] ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n 'ds:hover:enabled:bg-[var(--muted)]/40',\n].join(' ');\n\nconst labelClasses = (state: StepState) =>\n [\n 'type-body-sm',\n state === 'current' || state === 'error'\n ? 'ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]'\n : state === 'completed'\n ? 'ds:text-[var(--foreground)]'\n : 'ds:text-[var(--muted-foreground)]',\n ].join(' ');\n\nconst descriptionClasses = [\n 'type-meta ds:text-[var(--muted-foreground)]',\n 'ds:mt-[var(--spacing-xs)]',\n].join(' ');\n\nconst hintClasses = [\n 'type-meta',\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:text-[var(--muted-foreground)]',\n].join(' ');\n\nconst chevronClasses = [\n 'ds:size-4 ds:shrink-0 ds:text-[var(--muted-foreground)]',\n 'ds:transition-transform ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n 'ds:motion-reduce:transition-none',\n 'ds:group-data-[state=open]/item:rotate-180',\n].join(' ');\n\nconst summaryClasses = [\n 'type-meta ds:text-[var(--muted-foreground)]',\n 'ds:ps-[calc(var(--min-target-size)+var(--spacing-md)+var(--spacing-sm))]',\n 'ds:pe-[var(--spacing-md)] ds:pb-[var(--spacing-sm)]',\n 'ds:group-data-[state=open]/item:hidden',\n].join(' ');\n\nconst contentClasses = [\n 'ds:overflow-hidden',\n 'ds:data-[state=open]:animate-[accordion-down_var(--animation-duration)_var(--ease-out)]',\n 'ds:data-[state=closed]:animate-[accordion-up_var(--animation-duration)_var(--ease-in)]',\n].join(' ');\n\nconst contentInnerClasses = [\n 'ds:ps-[calc(var(--min-target-size)+var(--spacing-md)+var(--spacing-sm))]',\n 'ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-md)]',\n].join(' ');\n\n/* -------------------------------------------------------------------- */\n/* Types */\n/* -------------------------------------------------------------------- */\n\nexport interface AccordionStepSpec extends StepSpec {\n /** Form content rendered inside the expanded panel. */\n content: ReactNode;\n /**\n * One-line summary shown under the header when the step is completed\n * and its panel is collapsed. Typically a preview of the captured\n * data — \"Mario Rossi · 12/03/1985\".\n */\n summary?: ReactNode;\n}\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]', {\n variants: {},\n});\n\nexport interface StepperAccordionProps\n extends\n Omit<\n ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>,\n 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'collapsible'\n >,\n VariantProps<typeof rootVariants> {\n /** Active step (0-indexed). The matching panel is the one that is open. */\n activeStep: number;\n /** Step specs — each one provides its own content + optional summary. */\n steps: AccordionStepSpec[];\n /**\n * Fires when the user re-opens a completed step. Upcoming steps cannot\n * be activated — their triggers are disabled. The current step cannot\n * be collapsed (Radix `collapsible=false`).\n */\n onStepChange?: (index: number) => void;\n /** Override the default `aria-label` on the list wrapper. */\n 'aria-label'?: string;\n /**\n * Consumer-supplied instance id, surfaced as `data-component-id` so an\n * agent / UI bridge can address this instance.\n */\n id?: string;\n}\n\n/**\n * Imperative handle for agent-readiness. Routes state mutations through\n * the consumer's `onStepChange`, never mutating directly.\n */\nexport interface StepperAccordionHandle {\n getCurrentStep: () => number;\n getTotalSteps: () => number;\n /** Indices of currently-open panels — singleton under Radix `type=\"single\"`. */\n getOpenSteps: () => number[];\n gotoStep: (step: number) => void;\n next: () => void;\n previous: () => void;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nconst StepperAccordion = forwardRef<\n StepperAccordionHandle,\n StepperAccordionProps\n>(\n (\n {\n activeStep,\n steps,\n onStepChange,\n 'aria-label': ariaLabel,\n id,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const total = steps.length;\n const clampedActive = Math.max(0, Math.min(activeStep, total - 1));\n const label = ariaLabel ?? t('navigation.stepper.label');\n const editCopy = t('navigation.stepper.edit');\n const openCopy = t('navigation.stepper.open');\n const lockedCopy = t('navigation.stepper.locked');\n const completedCopy = t('navigation.stepper.completed');\n const errorCopy = t('navigation.stepper.error');\n\n const handleValueChange = (value: string) => {\n // `collapsible=false` prevents empty-string values in practice, but the\n // primitive's type still allows one — guard anyway.\n if (!value) return;\n const index = indexFromValue(value);\n if (Number.isFinite(index) && index !== clampedActive) {\n onStepChange?.(index);\n }\n };\n\n const handle = useMemo<StepperAccordionHandle>(\n () => ({\n getCurrentStep: () => clampedActive,\n getTotalSteps: () => total,\n getOpenSteps: () => [clampedActive],\n gotoStep: (step: number) => {\n if (!onStepChange) return;\n const clamped = Math.max(0, Math.min(step, Math.max(total - 1, 0)));\n if (clamped !== clampedActive) onStepChange(clamped);\n },\n next: () => {\n if (!onStepChange) return;\n if (clampedActive < total - 1) onStepChange(clampedActive + 1);\n },\n previous: () => {\n if (!onStepChange) return;\n if (clampedActive > 0) onStepChange(clampedActive - 1);\n },\n }),\n [clampedActive, total, onStepChange],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n\n return (\n <AccordionPrimitive.Root\n type=\"single\"\n value={makeValue(clampedActive)}\n onValueChange={handleValueChange}\n collapsible={false}\n aria-label={label}\n id={id}\n data-component=\"stepper-accordion\"\n data-component-id={id}\n className={rootVariants({ className })}\n {...rest}\n >\n {steps.map((spec, index) => {\n const state = stateForStep(index, clampedActive, spec.status);\n const isCurrent = state === 'current' || state === 'error';\n const isUpcoming = state === 'upcoming';\n // An `unlocked` step renders as `upcoming` but stays reachable —\n // only a step that is BOTH upcoming and unreachable is locked.\n const isLocked =\n isUpcoming && !stepIsReachable(index, clampedActive, spec.status);\n const itemTone = state === 'error' ? 'error' : 'neutral';\n const stepN = t('navigation.stepper.stepN', { n: index + 1 });\n\n const indicatorContent = (() => {\n if (state === 'completed') {\n return (\n <>\n <CheckGlyph />\n <span className=\"ds:sr-only\">{completedCopy}</span>\n </>\n );\n }\n if (state === 'error') {\n return (\n <>\n <CrossGlyph />\n <span className=\"ds:sr-only\">{errorCopy}</span>\n </>\n );\n }\n return <span>{index + 1}</span>;\n })();\n\n const hint = (() => {\n if (state === 'completed') {\n return <span className={hintClasses}>{editCopy}</span>;\n }\n if (isLocked) {\n return (\n <span className={hintClasses}>\n <Lock aria-hidden=\"true\" className=\"ds:size-3\" />\n {lockedCopy}\n </span>\n );\n }\n if (isUpcoming) {\n // Reachable but empty — say so, otherwise the row reads\n // identically to a locked one and nothing signals it opens.\n return <span className={hintClasses}>{openCopy}</span>;\n }\n return null;\n })();\n\n return (\n <AccordionPrimitive.Item\n key={index}\n value={makeValue(index)}\n data-step-id={String(index)}\n className={itemVariants({ tone: itemTone })}\n >\n <AccordionPrimitive.Header className=\"ds:flex\">\n <AccordionPrimitive.Trigger\n // Locked steps (upcoming, and not marked reachable by a\n // `completed` / `error` / `unlocked` status) are *HTML*-\n // disabled — they must not be\n // reachable by Tab or by Radix's arrow-key navigation ring\n // (Radix filters `item.ref.current?.disabled`, which is\n // the HTML attribute). Current is only *ARIA*-disabled so\n // keyboard users can Tab to it as a heading anchor and\n // hear \"current step\"; Radix's `collapsible=false` makes\n // the click a no-op regardless. Setting `disabled` at the\n // Trigger rather than the Item because `...triggerProps`\n // spreads after Collapsible writes its own `disabled`\n // from context, so the Item-level disabled gets overridden.\n disabled={isLocked}\n aria-disabled={isCurrent || undefined}\n // The hint is rendered text, but `aria-label` overrides\n // element content wholesale — so the affordance has to be\n // appended here too or AT hears none of it.\n aria-label={\n state === 'completed'\n ? `${stepN}, ${editCopy}`\n : isUpcoming && !isLocked\n ? `${stepN}, ${openCopy}`\n : stepN\n }\n aria-current={isCurrent ? 'step' : undefined}\n className={triggerClasses}\n >\n <span\n aria-hidden=\"true\"\n className={indicatorVariants({ state })}\n >\n {indicatorContent}\n </span>\n <span className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col\">\n <span className={labelClasses(state)}>{spec.label}</span>\n {spec.description ? (\n <span className={descriptionClasses}>\n {spec.description}\n </span>\n ) : null}\n </span>\n {hint}\n {isCurrent ? null : (\n <ChevronDown\n aria-hidden=\"true\"\n className={chevronClasses}\n />\n )}\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n {spec.summary && state === 'completed' ? (\n <div className={summaryClasses}>{spec.summary}</div>\n ) : null}\n <AccordionPrimitive.Content className={contentClasses}>\n <div className={contentInnerClasses}>{spec.content}</div>\n </AccordionPrimitive.Content>\n </AccordionPrimitive.Item>\n );\n })}\n </AccordionPrimitive.Root>\n );\n },\n);\nStepperAccordion.displayName = 'StepperAccordion';\n\nexport { StepperAccordion };\n"],"names":["stateForStep","index","activeStep","status","stepIsReachable","STEP_VALUE_PREFIX","makeValue","indexFromValue","value","iconDrawClasses","CheckGlyph","jsx","CrossGlyph","jsxs","indicatorClasses","indicatorVariants","cva","itemVariants","triggerClasses","labelClasses","state","descriptionClasses","hintClasses","chevronClasses","summaryClasses","contentClasses","contentInnerClasses","rootVariants","StepperAccordion","forwardRef","steps","onStepChange","ariaLabel","id","className","rest","ref","t","useTranslation","total","clampedActive","label","editCopy","openCopy","lockedCopy","completedCopy","errorCopy","handleValueChange","handle","useMemo","step","clamped","useImperativeHandle","AccordionPrimitive","spec","isCurrent","isUpcoming","isLocked","itemTone","stepN","indicatorContent","Fragment","hint","Lock","ChevronDown"],"mappings":";;;;;;;AA4CO,SAASA,EACdC,GACAC,GACAC,GACW;AACX,SAAIA,MAAW,UAAgB,UAC3BF,MAAUC,IAAmB,YAC7BC,MAAW,eACXF,IAAQC,IAAmB,cAIxB;AACT;AASO,SAASE,EACdH,GACAC,GACAC,GACS;AACT,SAAIA,MAAW,SAAkB,KAC1BF,KAASC;AAClB;AC7CA,MAAMG,IAAoB,SACpBC,IAAY,CAACL,MAAkB,GAAGI,CAAiB,GAAGJ,CAAK,IAC3DM,IAAiB,CAACC,MACtB,OAAOA,EAAM,MAAMH,EAAkB,MAAM,CAAC,GAOxCI,IAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,GAAG;AAEV,SAASC,IAAa;AACpB,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,MACZ,WAAU;AAAA,MAEV,4BAAC,QAAA,EAAK,YAAW,KAAI,GAAE,kBAAiB,WAAWF,EAAA,CAAiB;AAAA,IAAA;AAAA,EAAA;AAG1E;AAEA,SAASG,IAAa;AACpB,SACE,gBAAAC;AAAA,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
  import { useTranslation as g } from "react-i18next";
5
5
  import { I as y } from "./icon-button-DA2CAGHZ.js";
6
- import { I as j } from "./icon-button-group-D6SVMteH.js";
6
+ import { I as j } from "./icon-button-group-VCCod3Hz.js";
7
7
  import { S as K } from "./switch-OILsBLWo.js";
8
8
  import { D as o } from "./dropdown-menu-DU-Hrf33.js";
9
9
  import { u as x } from "./use-theme-CAuo6EYT.js";
@@ -364,4 +364,4 @@ export {
364
364
  F as T,
365
365
  D as t
366
366
  };
367
- //# sourceMappingURL=theme-toggle-DuMhQNFS.js.map
367
+ //# sourceMappingURL=theme-toggle-uEwoKjl3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-toggle-DuMhQNFS.js","sources":["../../src/components/theme-toggle/theme-toggle.agent.ts","../../src/components/theme-toggle/theme-toggle.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — ThemeToggle. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ThemeToggleHandle } from './theme-toggle';\n\nexport const themeToggleAgent: AgentAdapter<ThemeToggleHandle> = {\n id: 'theme-toggle',\n capabilities: ['set_value'],\n state: {\n currentTheme: {\n type: 'ThemePreference',\n descriptionKey: 'ui.agent.themeToggle.state.currentTheme',\n description: 'Active theme preference: light, dark, or system.',\n read: (handle) => handle.getCurrentTheme(),\n },\n currentAccessibility: {\n type: 'AccessibilityPreference',\n descriptionKey: 'ui.agent.themeToggle.state.currentAccessibility',\n description: 'Active accessibility preference: default or accessible.',\n read: (handle) => handle.getCurrentAccessibility(),\n },\n },\n actions: {\n set_theme: {\n safety: 'write',\n argsType: '{ theme: \"light\" | \"dark\" | \"system\" }',\n argsSchema: {\n type: 'object',\n properties: { theme: { enum: ['light', 'dark', 'system'] } },\n required: ['theme'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.themeToggle.actions.setTheme',\n description: 'Switch the theme preference.',\n invoke: (handle, args: { theme: 'light' | 'dark' | 'system' }) => {\n handle.setTheme(args.theme);\n },\n },\n set_accessibility: {\n safety: 'write',\n argsType: '{ accessibility: \"default\" | \"accessible\" }',\n argsSchema: {\n type: 'object',\n properties: { accessibility: { enum: ['default', 'accessible'] } },\n required: ['accessibility'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.themeToggle.actions.setAccessibility',\n description: 'Switch the accessibility preference.',\n invoke: (handle, args: { accessibility: 'default' | 'accessible' }) => {\n handle.setAccessibility(args.accessibility);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'theme-toggle',\n description: 'Marks the ThemeToggle wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Monitor, Moon, Sun } from 'lucide-react';\nimport { IconButton } from '../button/icon-button';\nimport { IconButtonGroup } from '../icon-button-group/icon-button-group';\nimport { Switch } from '../switch/switch';\nimport { DropdownMenu } from '../dropdown-menu/dropdown-menu';\nimport {\n useTheme,\n type AccessibilityPreference,\n type ThemePreference,\n type UseThemeReturn,\n} from '../../hooks';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { themeToggleAgent } from './theme-toggle.agent';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst wrapperVariants = cva('ds:inline-flex ds:items-center', {\n variants: {\n variant: {\n menu: '',\n compact: '',\n split: 'ds:gap-[var(--spacing-md)]',\n },\n },\n defaultVariants: { variant: 'menu' },\n});\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type ThemeToggleVariant = 'menu' | 'compact' | 'split';\n\ninterface ThemeToggleBaseProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>,\n VariantProps<typeof wrapperVariants> {\n /**\n * Visual form factor.\n * - `menu` (default) — single trigger that opens a dropdown with both\n * Appearance and Accessibility controls. Best for headers / nav rails.\n * - `compact` — segmented Appearance control only. Use when accessibility\n * lives on a separate settings surface.\n * - `split` — segmented Appearance control plus an inline Accessibility\n * switch. Best for full-width settings panels.\n */\n variant?: ThemeToggleVariant;\n /** Hide the accessibility control. Ignored on `compact`, which never renders it. */\n showAccessibility?: boolean;\n /**\n * Controlled escape hatch — when omitted the component reads/writes\n * `useTheme()` directly so it can drop into any header with no wiring.\n * Pass all four to opt into controlled mode.\n */\n theme?: ThemePreference;\n accessibility?: AccessibilityPreference;\n onThemeChange?: (next: ThemePreference) => void;\n onAccessibilityChange?: (next: AccessibilityPreference) => void;\n}\n\nexport type ThemeToggleProps = ThemeToggleBaseProps;\n\n/** Curated imperative handle for agent / external automation. */\nexport interface ThemeToggleHandle {\n getCurrentTheme: () => ThemePreference;\n getCurrentAccessibility: () => AccessibilityPreference;\n setTheme: (next: ThemePreference) => void;\n setAccessibility: (next: AccessibilityPreference) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Hook adapter */\n/* ------------------------------------------------------------------ */\n\n/**\n * Resolves controlled props against the store. When the consumer passes\n * `theme` / `onThemeChange` (etc.) we honour those; otherwise we fall\n * through to the singleton `useTheme()` hook so a bare `<ThemeToggle />`\n * works with zero wiring.\n */\nfunction useResolvedTheme(props: ThemeToggleBaseProps): UseThemeReturn {\n const {\n theme: themeProp,\n accessibility: accessibilityProp,\n onThemeChange,\n onAccessibilityChange,\n } = props;\n const store = useTheme();\n const theme = themeProp ?? store.theme;\n const accessibility = accessibilityProp ?? store.accessibility;\n\n const storeSetTheme = store.setTheme;\n const storeSetAccessibility = store.setAccessibility;\n\n const setTheme = useCallback(\n (next: ThemePreference) => {\n if (onThemeChange) {\n onThemeChange(next);\n return;\n }\n storeSetTheme(next);\n },\n [onThemeChange, storeSetTheme],\n );\n\n const setAccessibility = useCallback(\n (next: AccessibilityPreference) => {\n if (onAccessibilityChange) {\n onAccessibilityChange(next);\n return;\n }\n storeSetAccessibility(next);\n },\n [onAccessibilityChange, storeSetAccessibility],\n );\n\n return {\n theme,\n accessibility,\n resolvedTheme: store.resolvedTheme,\n setTheme,\n setAccessibility,\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Sub-pieces */\n/* ------------------------------------------------------------------ */\n\ninterface AppearanceSegmentProps {\n value: ThemePreference;\n onValueChange: (next: ThemePreference) => void;\n ariaLabel: string;\n size?: 'sm' | 'md' | 'lg';\n}\n\nfunction AppearanceSegment({\n value,\n onValueChange,\n ariaLabel,\n size = 'md',\n}: AppearanceSegmentProps) {\n const { t } = useTranslation();\n return (\n <IconButtonGroup\n aria-label={ariaLabel}\n role=\"radiogroup\"\n mode=\"toggle-single\"\n size={size}\n value={value}\n onValueChange={(next) => onValueChange(next as ThemePreference)}\n >\n <IconButton\n icon={<Sun aria-hidden />}\n aria-label={t('navigation.themeToggle.appearance.light')}\n value=\"light\"\n />\n <IconButton\n icon={<Moon aria-hidden />}\n aria-label={t('navigation.themeToggle.appearance.dark')}\n value=\"dark\"\n />\n <IconButton\n icon={<Monitor aria-hidden />}\n aria-label={t('navigation.themeToggle.appearance.system')}\n value=\"system\"\n />\n </IconButtonGroup>\n );\n}\n\ninterface AccessibilitySwitchProps {\n value: AccessibilityPreference;\n onValueChange: (next: AccessibilityPreference) => void;\n size?: 'sm' | 'md' | 'lg';\n}\n\nfunction AccessibilitySwitch({\n value,\n onValueChange,\n size = 'md',\n}: AccessibilitySwitchProps) {\n const { t } = useTranslation();\n // 'system' is treated as \"off\" visually — the OS preference flows through\n // automatically. Flipping the switch on creates an explicit override.\n const checked = value === 'accessible';\n return (\n <Switch\n label={t('navigation.themeToggle.accessibility.label')}\n labelSide=\"start\"\n size={size}\n checked={checked}\n onCheckedChange={(next) => onValueChange(next ? 'accessible' : 'default')}\n />\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Variants */\n/* ------------------------------------------------------------------ */\n\ninterface VariantRenderProps {\n state: UseThemeReturn;\n className?: string;\n rest: HTMLAttributes<HTMLDivElement>;\n forwardedRef: React.Ref<HTMLDivElement>;\n showAccessibility: boolean;\n}\n\nfunction MenuVariant({\n state,\n className,\n rest,\n forwardedRef,\n showAccessibility,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n const triggerIcon =\n state.resolvedTheme === 'dark' ||\n state.resolvedTheme === 'dark-accessible' ? (\n <Moon aria-hidden />\n ) : (\n <Sun aria-hidden />\n );\n\n const accessibleChecked = state.accessibility === 'accessible';\n\n return (\n <div\n ref={forwardedRef}\n data-component=\"theme-toggle\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'menu', className })}\n {...rest}\n >\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n icon={triggerIcon}\n aria-label={t('navigation.themeToggle.trigger')}\n />\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content align=\"end\" sideOffset={8}>\n <DropdownMenu.Label>\n {t('navigation.themeToggle.appearance.label')}\n </DropdownMenu.Label>\n <DropdownMenu.RadioGroup\n value={state.theme}\n onValueChange={(next) => state.setTheme(next as ThemePreference)}\n >\n <DropdownMenu.RadioItem value=\"light\">\n <Sun aria-hidden className=\"ds:size-4\" />\n {t('navigation.themeToggle.appearance.light')}\n </DropdownMenu.RadioItem>\n <DropdownMenu.RadioItem value=\"dark\">\n <Moon aria-hidden className=\"ds:size-4\" />\n {t('navigation.themeToggle.appearance.dark')}\n </DropdownMenu.RadioItem>\n <DropdownMenu.RadioItem value=\"system\">\n <Monitor aria-hidden className=\"ds:size-4\" />\n {t('navigation.themeToggle.appearance.system')}\n </DropdownMenu.RadioItem>\n </DropdownMenu.RadioGroup>\n {showAccessibility ? (\n <>\n <DropdownMenu.Separator />\n {/* CheckboxItem keeps the accessibility toggle inside the\n Radix menu collection so ArrowDown reaches it and Space\n activates it; `onSelect={preventDefault}` prevents the\n menu from closing on toggle. */}\n <DropdownMenu.CheckboxItem\n checked={accessibleChecked}\n onCheckedChange={(next) =>\n state.setAccessibility(next ? 'accessible' : 'default')\n }\n onSelect={(event) => event.preventDefault()}\n >\n {t('navigation.themeToggle.accessibility.label')}\n </DropdownMenu.CheckboxItem>\n </>\n ) : null}\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n </div>\n );\n}\n\nfunction CompactVariant({\n state,\n className,\n rest,\n forwardedRef,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n return (\n <div\n ref={forwardedRef}\n data-component=\"theme-toggle\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'compact', className })}\n {...rest}\n >\n <AppearanceSegment\n value={state.theme}\n onValueChange={state.setTheme}\n ariaLabel={t('navigation.themeToggle.appearance.label')}\n />\n </div>\n );\n}\n\nfunction SplitVariant({\n state,\n className,\n rest,\n forwardedRef,\n showAccessibility,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n return (\n <div\n ref={forwardedRef}\n data-component=\"theme-toggle\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'split', className })}\n {...rest}\n >\n <AppearanceSegment\n value={state.theme}\n onValueChange={state.setTheme}\n ariaLabel={t('navigation.themeToggle.appearance.label')}\n />\n {showAccessibility ? (\n <AccessibilitySwitch\n value={state.accessibility}\n onValueChange={state.setAccessibility}\n />\n ) : null}\n </div>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* ThemeToggle */\n/* ------------------------------------------------------------------ */\n\nexport const ThemeToggle = forwardRef<HTMLDivElement, ThemeToggleProps>(\n (props, ref) => {\n const {\n variant = 'menu',\n showAccessibility = true,\n className,\n id,\n // Strip controlled props from the spread — they are read by the\n // adapter, not by the DOM element.\n theme: _theme,\n accessibility: _accessibility,\n onThemeChange: _onThemeChange,\n onAccessibilityChange: _onAccessibilityChange,\n ...rest\n } = props as ThemeToggleProps & { id?: string };\n\n const state = useResolvedTheme(props);\n const stateRef = useRef(state);\n stateRef.current = state;\n\n // Internal variant wrappers attach refs to <div> elements; we forward that\n // DOM node as the public ref (Pattern B). The agent handle is registered\n // separately via useAgentRegistration.\n const forwardedRef = useRef<HTMLDivElement | null>(null);\n useImperativeHandle(ref, () => forwardedRef.current as HTMLDivElement, []);\n\n const agentHandle = useMemo<ThemeToggleHandle>(\n () => ({\n getCurrentTheme: () => stateRef.current.theme,\n getCurrentAccessibility: () => stateRef.current.accessibility,\n setTheme: (next) => stateRef.current.setTheme(next),\n setAccessibility: (next) => stateRef.current.setAccessibility(next),\n }),\n [],\n );\n useAgentRegistration(themeToggleAgent, agentHandle, id);\n\n if (variant === 'compact') {\n return (\n <CompactVariant\n state={state}\n className={className}\n rest={rest}\n forwardedRef={forwardedRef}\n showAccessibility={showAccessibility}\n />\n );\n }\n if (variant === 'split') {\n return (\n <SplitVariant\n state={state}\n className={className}\n rest={rest}\n forwardedRef={forwardedRef}\n showAccessibility={showAccessibility}\n />\n );\n }\n return (\n <MenuVariant\n state={state}\n className={className}\n rest={rest}\n forwardedRef={forwardedRef}\n showAccessibility={showAccessibility}\n />\n );\n },\n);\n\nThemeToggle.displayName = 'ThemeToggle';\n"],"names":["themeToggleAgent","handle","args","wrapperVariants","cva","useResolvedTheme","props","themeProp","accessibilityProp","onThemeChange","onAccessibilityChange","store","useTheme","theme","accessibility","storeSetTheme","storeSetAccessibility","setTheme","useCallback","next","setAccessibility","AppearanceSegment","value","onValueChange","ariaLabel","size","t","useTranslation","jsxs","IconButtonGroup","jsx","IconButton","Sun","Moon","Monitor","AccessibilitySwitch","checked","Switch","MenuVariant","state","className","rest","forwardedRef","showAccessibility","triggerIcon","accessibleChecked","DropdownMenu","Fragment","event","CompactVariant","SplitVariant","ThemeToggle","forwardRef","ref","variant","id","_theme","_accessibility","_onThemeChange","_onAccessibilityChange","stateRef","useRef","useImperativeHandle","agentHandle","useMemo","useAgentRegistration"],"mappings":";;;;;;;;;;;;AAOO,MAAMA,IAAoD;AAAA,EAC/D,IAAI;AAAA,EACJ,cAAc,CAAC,WAAW;A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A,MAClB,OAAO;AAAA,QACL,iBAAiB,MAAMJ,EAAS,QAAQ;AAAA,QACxC,yBAAyB,MAAMA,EAAS,QAAQ;AAAA,QAChD,UAAU,CAACzC,MAASyC,EAAS,QAAQ,SAASzC,CAAI;AAAA,QAClD,kBAAkB,CAACA,MAASyC,EAAS,QAAQ,iBAAiBzC,CAAI;AAAA,MAAA;AAAA,MAEpE,CAAA;AAAA,IAAC;AAIH,WAFA8C,EAAqBjE,GAAkB+D,GAAaR,CAAE,GAElDD,MAAY,YAEZ,gBAAAxB;AAAA,MAACmB;AAAA,MAAA;AAAA,QACC,OAAAV;AAAA,QACA,WAAAC;AAAA,QACA,MAAAC;AAAA,QACA,cAAAC;AAAA,QACA,mBAAAC;AAAA,MAAA;AAAA,IAAA,IAIFW,MAAY,UAEZ,gBAAAxB;AAAA,MAACoB;AAAA,MAAA;AAAA,QACC,OAAAX;AAAA,QACA,WAAAC;AAAA,QACA,MAAAC;AAAA,QACA,cAAAC;AAAA,QACA,mBAAAC;AAAA,MAAA;AAAA,IAAA,IAKJ,gBAAAb;AAAA,MAACQ;AAAA,MAAA;AAAA,QACC,OAAAC;AAAA,QACA,WAAAC;AAAA,QACA,MAAAC;AAAA,QACA,cAAAC;AAAA,QACA,mBAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAQ,EAAY,cAAc;"}
1
+ {"version":3,"file":"theme-toggle-uEwoKjl3.js","sources":["../../src/components/theme-toggle/theme-toggle.agent.ts","../../src/components/theme-toggle/theme-toggle.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — ThemeToggle. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ThemeToggleHandle } from './theme-toggle';\n\nexport const themeToggleAgent: AgentAdapter<ThemeToggleHandle> = {\n id: 'theme-toggle',\n capabilities: ['set_value'],\n state: {\n currentTheme: {\n type: 'ThemePreference',\n descriptionKey: 'ui.agent.themeToggle.state.currentTheme',\n description: 'Active theme preference: light, dark, or system.',\n read: (handle) => handle.getCurrentTheme(),\n },\n currentAccessibility: {\n type: 'AccessibilityPreference',\n descriptionKey: 'ui.agent.themeToggle.state.currentAccessibility',\n description: 'Active accessibility preference: default or accessible.',\n read: (handle) => handle.getCurrentAccessibility(),\n },\n },\n actions: {\n set_theme: {\n safety: 'write',\n argsType: '{ theme: \"light\" | \"dark\" | \"system\" }',\n argsSchema: {\n type: 'object',\n properties: { theme: { enum: ['light', 'dark', 'system'] } },\n required: ['theme'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.themeToggle.actions.setTheme',\n description: 'Switch the theme preference.',\n invoke: (handle, args: { theme: 'light' | 'dark' | 'system' }) => {\n handle.setTheme(args.theme);\n },\n },\n set_accessibility: {\n safety: 'write',\n argsType: '{ accessibility: \"default\" | \"accessible\" }',\n argsSchema: {\n type: 'object',\n properties: { accessibility: { enum: ['default', 'accessible'] } },\n required: ['accessibility'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.themeToggle.actions.setAccessibility',\n description: 'Switch the accessibility preference.',\n invoke: (handle, args: { accessibility: 'default' | 'accessible' }) => {\n handle.setAccessibility(args.accessibility);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'theme-toggle',\n description: 'Marks the ThemeToggle wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Monitor, Moon, Sun } from 'lucide-react';\nimport { IconButton } from '../button/icon-button';\nimport { IconButtonGroup } from '../icon-button-group/icon-button-group';\nimport { Switch } from '../switch/switch';\nimport { DropdownMenu } from '../dropdown-menu/dropdown-menu';\nimport {\n useTheme,\n type AccessibilityPreference,\n type ThemePreference,\n type UseThemeReturn,\n} from '../../hooks';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { themeToggleAgent } from './theme-toggle.agent';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst wrapperVariants = cva('ds:inline-flex ds:items-center', {\n variants: {\n variant: {\n menu: '',\n compact: '',\n split: 'ds:gap-[var(--spacing-md)]',\n },\n },\n defaultVariants: { variant: 'menu' },\n});\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type ThemeToggleVariant = 'menu' | 'compact' | 'split';\n\ninterface ThemeToggleBaseProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>,\n VariantProps<typeof wrapperVariants> {\n /**\n * Visual form factor.\n * - `menu` (default) — single trigger that opens a dropdown with both\n * Appearance and Accessibility controls. Best for headers / nav rails.\n * - `compact` — segmented Appearance control only. Use when accessibility\n * lives on a separate settings surface.\n * - `split` — segmented Appearance control plus an inline Accessibility\n * switch. Best for full-width settings panels.\n */\n variant?: ThemeToggleVariant;\n /** Hide the accessibility control. Ignored on `compact`, which never renders it. */\n showAccessibility?: boolean;\n /**\n * Controlled escape hatch — when omitted the component reads/writes\n * `useTheme()` directly so it can drop into any header with no wiring.\n * Pass all four to opt into controlled mode.\n */\n theme?: ThemePreference;\n accessibility?: AccessibilityPreference;\n onThemeChange?: (next: ThemePreference) => void;\n onAccessibilityChange?: (next: AccessibilityPreference) => void;\n}\n\nexport type ThemeToggleProps = ThemeToggleBaseProps;\n\n/** Curated imperative handle for agent / external automation. */\nexport interface ThemeToggleHandle {\n getCurrentTheme: () => ThemePreference;\n getCurrentAccessibility: () => AccessibilityPreference;\n setTheme: (next: ThemePreference) => void;\n setAccessibility: (next: AccessibilityPreference) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Hook adapter */\n/* ------------------------------------------------------------------ */\n\n/**\n * Resolves controlled props against the store. When the consumer passes\n * `theme` / `onThemeChange` (etc.) we honour those; otherwise we fall\n * through to the singleton `useTheme()` hook so a bare `<ThemeToggle />`\n * works with zero wiring.\n */\nfunction useResolvedTheme(props: ThemeToggleBaseProps): UseThemeReturn {\n const {\n theme: themeProp,\n accessibility: accessibilityProp,\n onThemeChange,\n onAccessibilityChange,\n } = props;\n const store = useTheme();\n const theme = themeProp ?? store.theme;\n const accessibility = accessibilityProp ?? store.accessibility;\n\n const storeSetTheme = store.setTheme;\n const storeSetAccessibility = store.setAccessibility;\n\n const setTheme = useCallback(\n (next: ThemePreference) => {\n if (onThemeChange) {\n onThemeChange(next);\n return;\n }\n storeSetTheme(next);\n },\n [onThemeChange, storeSetTheme],\n );\n\n const setAccessibility = useCallback(\n (next: AccessibilityPreference) => {\n if (onAccessibilityChange) {\n onAccessibilityChange(next);\n return;\n }\n storeSetAccessibility(next);\n },\n [onAccessibilityChange, storeSetAccessibility],\n );\n\n return {\n theme,\n accessibility,\n resolvedTheme: store.resolvedTheme,\n setTheme,\n setAccessibility,\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Sub-pieces */\n/* ------------------------------------------------------------------ */\n\ninterface AppearanceSegmentProps {\n value: ThemePreference;\n onValueChange: (next: ThemePreference) => void;\n ariaLabel: string;\n size?: 'sm' | 'md' | 'lg';\n}\n\nfunction AppearanceSegment({\n value,\n onValueChange,\n ariaLabel,\n size = 'md',\n}: AppearanceSegmentProps) {\n const { t } = useTranslation();\n return (\n <IconButtonGroup\n aria-label={ariaLabel}\n role=\"radiogroup\"\n mode=\"toggle-single\"\n size={size}\n value={value}\n onValueChange={(next) => onValueChange(next as ThemePreference)}\n >\n <IconButton\n icon={<Sun aria-hidden />}\n aria-label={t('navigation.themeToggle.appearance.light')}\n value=\"light\"\n />\n <IconButton\n icon={<Moon aria-hidden />}\n aria-label={t('navigation.themeToggle.appearance.dark')}\n value=\"dark\"\n />\n <IconButton\n icon={<Monitor aria-hidden />}\n aria-label={t('navigation.themeToggle.appearance.system')}\n value=\"system\"\n />\n </IconButtonGroup>\n );\n}\n\ninterface AccessibilitySwitchProps {\n value: AccessibilityPreference;\n onValueChange: (next: AccessibilityPreference) => void;\n size?: 'sm' | 'md' | 'lg';\n}\n\nfunction AccessibilitySwitch({\n value,\n onValueChange,\n size = 'md',\n}: AccessibilitySwitchProps) {\n const { t } = useTranslation();\n // 'system' is treated as \"off\" visually — the OS preference flows through\n // automatically. Flipping the switch on creates an explicit override.\n const checked = value === 'accessible';\n return (\n <Switch\n label={t('navigation.themeToggle.accessibility.label')}\n labelSide=\"start\"\n size={size}\n checked={checked}\n onCheckedChange={(next) => onValueChange(next ? 'accessible' : 'default')}\n />\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Variants */\n/* ------------------------------------------------------------------ */\n\ninterface VariantRenderProps {\n state: UseThemeReturn;\n className?: string;\n rest: HTMLAttributes<HTMLDivElement>;\n forwardedRef: React.Ref<HTMLDivElement>;\n showAccessibility: boolean;\n}\n\nfunction MenuVariant({\n state,\n className,\n rest,\n forwardedRef,\n showAccessibility,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n const triggerIcon =\n state.resolvedTheme === 'dark' ||\n state.resolvedTheme === 'dark-accessible' ? (\n <Moon aria-hidden />\n ) : (\n <Sun aria-hidden />\n );\n\n const accessibleChecked = state.accessibility === 'accessible';\n\n return (\n <div\n ref={forwardedRef}\n data-component=\"theme-toggle\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'menu', className })}\n {...rest}\n >\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n icon={triggerIcon}\n aria-label={t('navigation.themeToggle.trigger')}\n />\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content align=\"end\" sideOffset={8}>\n <DropdownMenu.Label>\n {t('navigation.themeToggle.appearance.label')}\n </DropdownMenu.Label>\n <DropdownMenu.RadioGroup\n value={state.theme}\n onValueChange={(next) => state.setTheme(next as ThemePreference)}\n >\n <DropdownMenu.RadioItem value=\"light\">\n <Sun aria-hidden className=\"ds:size-4\" />\n {t('navigation.themeToggle.appearance.light')}\n </DropdownMenu.RadioItem>\n <DropdownMenu.RadioItem value=\"dark\">\n <Moon aria-hidden className=\"ds:size-4\" />\n {t('navigation.themeToggle.appearance.dark')}\n </DropdownMenu.RadioItem>\n <DropdownMenu.RadioItem value=\"system\">\n <Monitor aria-hidden className=\"ds:size-4\" />\n {t('navigation.themeToggle.appearance.system')}\n </DropdownMenu.RadioItem>\n </DropdownMenu.RadioGroup>\n {showAccessibility ? (\n <>\n <DropdownMenu.Separator />\n {/* CheckboxItem keeps the accessibility toggle inside the\n Radix menu collection so ArrowDown reaches it and Space\n activates it; `onSelect={preventDefault}` prevents the\n menu from closing on toggle. */}\n <DropdownMenu.CheckboxItem\n checked={accessibleChecked}\n onCheckedChange={(next) =>\n state.setAccessibility(next ? 'accessible' : 'default')\n }\n onSelect={(event) => event.preventDefault()}\n >\n {t('navigation.themeToggle.accessibility.label')}\n </DropdownMenu.CheckboxItem>\n </>\n ) : null}\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n </div>\n );\n}\n\nfunction CompactVariant({\n state,\n className,\n rest,\n forwardedRef,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n return (\n <div\n ref={forwardedRef}\n data-component=\"theme-toggle\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'compact', className })}\n {...rest}\n >\n <AppearanceSegment\n value={state.theme}\n onValueChange={state.setTheme}\n ariaLabel={t('navigation.themeToggle.appearance.label')}\n />\n </div>\n );\n}\n\nfunction SplitVariant({\n state,\n className,\n rest,\n forwardedRef,\n showAccessibility,\n}: VariantRenderProps) {\n const { t } = useTranslation();\n return (\n <div\n ref={forwardedRef}\n data-component=\"theme-toggle\"\n data-component-id={rest.id}\n className={wrapperVariants({ variant: 'split', className })}\n {...rest}\n >\n <AppearanceSegment\n value={state.theme}\n onValueChange={state.setTheme}\n ariaLabel={t('navigation.themeToggle.appearance.label')}\n />\n {showAccessibility ? (\n <AccessibilitySwitch\n value={state.accessibility}\n onValueChange={state.setAccessibility}\n />\n ) : null}\n </div>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* ThemeToggle */\n/* ------------------------------------------------------------------ */\n\nexport const ThemeToggle = forwardRef<HTMLDivElement, ThemeToggleProps>(\n (props, ref) => {\n const {\n variant = 'menu',\n showAccessibility = true,\n className,\n id,\n // Strip controlled props from the spread — they are read by the\n // adapter, not by the DOM element.\n theme: _theme,\n accessibility: _accessibility,\n onThemeChange: _onThemeChange,\n onAccessibilityChange: _onAccessibilityChange,\n ...rest\n } = props as ThemeToggleProps & { id?: string };\n\n const state = useResolvedTheme(props);\n const stateRef = useRef(state);\n stateRef.current = state;\n\n // Internal variant wrappers attach refs to <div> elements; we forward that\n // DOM node as the public ref (Pattern B). The agent handle is registered\n // separately via useAgentRegistration.\n const forwardedRef = useRef<HTMLDivElement | null>(null);\n useImperativeHandle(ref, () => forwardedRef.current as HTMLDivElement, []);\n\n const agentHandle = useMemo<ThemeToggleHandle>(\n () => ({\n getCurrentTheme: () => stateRef.current.theme,\n getCurrentAccessibility: () => stateRef.current.accessibility,\n setTheme: (next) => stateRef.current.setTheme(next),\n setAccessibility: (next) => stateRef.current.setAccessibility(next),\n }),\n [],\n );\n useAgentRegistration(themeToggleAgent, agentHandle, id);\n\n if (variant === 'compact') {\n return (\n <CompactVariant\n state={state}\n className={className}\n rest={rest}\n forwardedRef={forwardedRef}\n showAccessibility={showAccessibility}\n />\n );\n }\n if (variant === 'split') {\n return (\n <SplitVariant\n state={state}\n className={className}\n rest={rest}\n forwardedRef={forwardedRef}\n showAccessibility={showAccessibility}\n />\n );\n }\n return (\n <MenuVariant\n state={state}\n className={className}\n rest={rest}\n forwardedRef={forwardedRef}\n showAccessibility={showAccessibility}\n />\n );\n },\n);\n\nThemeToggle.displayName = 'ThemeToggle';\n"],"names":["themeToggleAgent","handle","args","wrapperVariants","cva","useResolvedTheme","props","themeProp","accessibilityProp","onThemeChange","onAccessibilityChange","store","useTheme","theme","accessibility","storeSetTheme","storeSetAccessibility","setTheme","useCallback","next","setAccessibility","AppearanceSegment","value","onValueChange","ariaLabel","size","t","useTranslation","jsxs","IconButtonGroup","jsx","IconButton","Sun","Moon","Monitor","AccessibilitySwitch","checked","Switch","MenuVariant","state","className","rest","forwardedRef","showAccessibility","triggerIcon","accessibleChecked","DropdownMenu","Fragment","event","CompactVariant","SplitVariant","ThemeToggle","forwardRef","ref","variant","id","_theme","_accessibility","_onThemeChange","_onAccessibilityChange","stateRef","useRef","useImperativeHandle","agentHandle","useMemo","useAgentRegistration"],"mappings":";;;;;;;;;;;;AAOO,MAAMA,IAAoD;AAAA,EAC/D,IAAI;AAAA,EACJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,gBAAA;AAAA,IAAgB;AAAA,IAE3C,sBAAsB;AAAA,MACpB,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,wBAAA;AAAA,IAAwB;AAAA,EACnD;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,QAAQ,QAAQ,IAAE;AAAA,QACzD,UAAU,CAAC,OAAO;AAAA,MAAA;AAAA,MAEpB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACA,GAAQC,MAAiD;AAChE,QAAAD,EAAO,SAASC,EAAK,KAAK;AAAA,MAC5B;AAAA,IAAA;AAAA,IAEF,mBAAmB;AAAA,MACjB,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY,EAAE,e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AAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAQ,EAAY,cAAc;"}
@@ -81,7 +81,7 @@ const Le = {
81
81
  description: "Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id."
82
82
  }
83
83
  }
84
- }, Ke = "ds:[inline-size:3rem]", je = "ds:[inline-size:var(--tool-rail-panel-inline-size,var(--ai-tools-rail-panel-inline-size,22rem))]", ae = "--tool-rail-panel-inline-size", Pe = 288, Me = 640, qe = 352, Be = w(
84
+ }, Ke = "ds:[inline-size:3rem]", je = "ds:[inline-size:var(--tool-rail-panel-inline-size,var(--ai-tools-rail-panel-inline-size,22rem))]", ae = "--tool-rail-panel-inline-size", Pe = 288, Me = 880, qe = 352, Be = w(
85
85
  ["ds:flex ds:shrink-0 ds:h-full", "ds:bg-[var(--background)]"].join(" "),
86
86
  {
87
87
  variants: {
@@ -521,4 +521,4 @@ export {
521
521
  Ze as T,
522
522
  Le as t
523
523
  };
524
- //# sourceMappingURL=tool-rail-CHyUmulN.js.map
524
+ //# sourceMappingURL=tool-rail-8Scslq3X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-rail-8Scslq3X.js","sources":["../../src/components/tool-rail/tool-rail.agent.ts","../../src/components/tool-rail/tool-rail.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — ToolRail. */\n/* */\n/* Rail-level surface: open / close a tool's panel and read which tool */\n/* is active. State is strictly the active tool id — never any tool's */\n/* panel CONTENT (which may carry PHI). Tool ids + badge counts are */\n/* supplied by the host via props, not derived from panel bodies. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ToolRailHandle } from './tool-rail';\n\nexport const toolRailAgent: AgentAdapter<ToolRailHandle> = {\n id: 'tool-rail',\n capabilities: ['open', 'close', 'select_single'],\n state: {\n activeToolId: {\n type: 'string | null',\n descriptionKey: 'ui.toolRail.agent.state.activeToolId',\n description:\n 'Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.',\n read: (handle) => handle.getActiveToolId(),\n },\n },\n actions: {\n open: {\n // Pure ephemeral panel state (open) — no data loss, no external effect.\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 shape is intentionally pre-existing — already resolves to\n // real multi-locale translations; do not canonicalise.\n descriptionKey: 'ui.toolRail.agent.actions.open',\n description: \"Open the given tool's panel.\",\n examples: [{ args: { id: 'inbox' }, note: 'Open the inbox tool panel.' }],\n invoke: (handle, args: { id: string }) => {\n handle.open(args.id);\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.close',\n description: 'Collapse the rail to its strip (no active tool).',\n invoke: (handle) => {\n handle.close();\n },\n },\n select_tool: {\n safety: 'read',\n argsType: '{ id: string | null }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: ['string', 'null'] } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.selectTool',\n description:\n 'Set the active tool by id (opens its panel), or pass null to collapse.',\n invoke: (handle, args: { id: string | null }) => {\n handle.setActiveTool(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'tool-rail',\n description: 'Marks the ToolRail 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 rail from the agent.',\n },\n item: {\n attr: 'data-tool-id',\n description:\n 'Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id.',\n },\n },\n};\n","import {\n forwardRef,\n Fragment,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { IconButton } from '../button/icon-button';\nimport { ScrollArea } from '../scroll-area/scroll-area';\nimport { TooltipProvider } from '../tooltip/tooltip';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useEdgeResize } from '../../hooks/use-edge-resize';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { useAgentRegistration } from '../../agent/registry';\nimport type { AgentAdapter } from '../../agent/types';\nimport { toolRailAgent } from './tool-rail.agent';\n\n/* ------------------------------------------------------------------ */\n/* Tokenised widths */\n/* */\n/* Fixed + tokenised so the rail stays constraint-compliant — no */\n/* prop-driven inline styles. Bare `[inline-size:…]` is NOT a */\n/* recognised utility under the `ds:` prefix; it must carry the */\n/* prefix or Tailwind emits no rule. Consumers needing a different */\n/* size wrap the rail and override via CSS. */\n/* ------------------------------------------------------------------ */\nconst RAIL_WIDTH = 'ds:[inline-size:3rem]';\n// Panel width rides a consumer-overridable custom property (set\n// `--tool-rail-panel-inline-size` on the rail or a wrapper) so\n// content-heavy tools (e.g. an inbox feed) can widen their panel\n// without inline styles. Defaults to the 22rem tray-family width.\n// `--ai-tools-rail-panel-inline-size` is the deprecated alias var read\n// here as a fallback so external consumers that set the pre-rename name\n// keep working for one release; the resize hook only ever writes the new\n// `--tool-rail-panel-inline-size`.\nconst PANEL_WIDTH =\n 'ds:[inline-size:var(--tool-rail-panel-inline-size,var(--ai-tools-rail-panel-inline-size,22rem))]';\n// The custom property PANEL_WIDTH reads. The resize hook writes the\n// committed px width here (on the panel element, so it beats consumer\n// class overrides on the root) and removes it on reset.\nconst PANEL_SIZE_PROPERTY = '--tool-rail-panel-inline-size';\n// Resize clamp + nominal default, px (352px = the 22rem token default).\n// The ceiling is 880 so a form panel can reach a three-column layout:\n// pairing fields is the only way to shorten a long form without\n// shrinking a 44px target, and that needs real inline size.\nconst PANEL_MIN_SIZE = 288;\nconst PANEL_MAX_SIZE = 880;\nconst PANEL_DEFAULT_SIZE = 352;\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface ToolRailTool {\n /** Stable tool id — used in `data-active`, the imperative handle, and\n * to label the open panel region. */\n id: string;\n /** Accessible name for the strip icon + tooltip, and the open panel's\n * region label. Never rendered as visible body text. */\n label: string;\n /** lucide-react glyph (rendered `aria-hidden` inside the IconButton). */\n icon: ReactNode;\n /** Panel body for this tool. Rendered inline-start of the strip when\n * `side='end'` (mirrored for `'start'`). The consumer composes it. */\n panel: ReactNode;\n /**\n * Optional non-scrolling header for this tool's panel. Rendered pinned at\n * the top of the open panel — above the scroll region — so a tool's title /\n * filters stay visible as the body scrolls. This is the rail-level home for\n * a sticky tool header; every tool gets it for free.\n */\n header?: ReactNode;\n /**\n * When true the panel body is NOT wrapped in the rail's `ScrollArea` — the\n * tool fills the (height-bounded) panel and owns its own scroll/layout.\n * Use for self-scrolling tools (e.g. `AppointmentTimeline`, whose infinite\n * scroll + today-anchoring + edge fades require it to be the scroll\n * container). Default `false` (the rail scrolls the body).\n */\n fill?: boolean;\n /** Optional unseen / notification count shown on the strip icon. */\n badgeCount?: number;\n /** When true the icon is non-interactive and skipped by roving focus. */\n disabled?: boolean;\n /**\n * Scope tier (drives the two-group divider). The two scope values render in\n * array order with a divider at the boundary between them — order the array\n * so the groups stay contiguous. A divider only appears when BOTH groups are\n * present; omit `scope` on every tool for an ungrouped strip (legacy). The\n * rail attaches no meaning beyond grouping — the host decides which value\n * leads (e.g. the Control Room pins favourites first).\n */\n scope?: 'global' | 'contextual';\n /**\n * When true this icon joins the drag-and-drop / `Alt`+Arrow reorder run.\n * The host supplies `onReorder` and owns the resulting order. Moves are\n * confined to the contiguous run of `reorderable` tools — so if EVERY tool\n * is `reorderable` the run is the whole strip and a tool can be dragged\n * across the scope divider; the host's `onReorder` decides what crossing it\n * means (e.g. the Control Room reads it as pin / unpin). Reordering never\n * changes focus roving — focus follows the moved tool to its new slot.\n */\n reorderable?: boolean;\n}\n\n/**\n * Curated imperative handle for ToolRail. Exposed as the forwardRef\n * target so a future agent / MCP UI bridge can drive the rail without\n * touching the DOM. See `tool-rail.agent.ts`.\n *\n * State surfaced here is strictly identifiers + counts — never any\n * tool's panel content (which may carry PHI).\n */\nexport interface ToolRailHandle {\n /** Currently-active tool id, or null when collapsed to strip-only. */\n getActiveToolId: () => string | null;\n /** Activate a tool by id (opens its panel), or null to collapse. */\n setActiveTool: (id: string | null) => void;\n /** Activate a tool by id (opens its panel). */\n open: (id: string) => void;\n /** Collapse to strip-only (no active tool). */\n close: () => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA — `side` drives the dock edge + which shadow faces main content */\n/* ------------------------------------------------------------------ */\n\nconst railVariants = cva(\n ['ds:flex ds:shrink-0 ds:h-full', 'ds:bg-[var(--background)]'].join(' '),\n {\n variants: {\n side: {\n // Strip docks inline-end; the panel mounts inline-start of it\n // (flex-row, panel rendered first). Shadow faces the main area —\n // no border against main (the rail stays line-free; the only seam\n // is the strip↔panel divider on the open panel, see render).\n // Accessible (AAA) theme swaps the soft chrome shadow for a solid 1px\n // border on the content-facing edge (border-s for end-docked).\n end: 'ds:flex-row ds:shadow-[var(--shadow-chrome-start)] ds:[.theme-accessible_&]:border-s ds:[.theme-accessible_&]:border-[var(--border)] ds:[.theme-accessible_&]:shadow-none',\n // Strip docks inline-start; the panel mounts inline-end of it.\n start:\n 'ds:flex-row-reverse ds:shadow-[var(--shadow-chrome-end)] ds:[.theme-accessible_&]:border-e ds:[.theme-accessible_&]:border-[var(--border)] ds:[.theme-accessible_&]:shadow-none',\n },\n },\n defaultVariants: { side: 'end' },\n },\n);\n\nconst stripVariants = cva(\n [\n 'ds:flex ds:shrink-0 ds:flex-col ds:items-center',\n 'ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]',\n 'ds:gap-[var(--spacing-xs)]',\n RAIL_WIDTH,\n ].join(' '),\n);\n\nconst panelVariants = cva(\n [\n 'ds:relative ds:flex ds:min-h-0 ds:flex-col ds:h-full',\n 'ds:bg-[var(--background)]',\n PANEL_WIDTH,\n // Defensive: the panel doesn't animate its width today, but if a\n // consumer adds a transition on the var, suppress it mid-drag.\n 'ds:data-[resizing]:transition-none',\n ].join(' '),\n);\n\n// Resize handle on the panel's inner edge — mirrors Resizable's Handle\n// (::before hit area to --min-target-size, hover/focus/drag accent, token\n// focus ring) but absolutely positioned over the panel edge. Like the\n// Sidebar's handle it stays TRANSPARENT at rest: the rail root's\n// `shadow-chrome-*` (which faces the main content) carries the resting seam,\n// exactly as the start-docked Sidebar leans on its own shadow — so the rail\n// never shows the constant coloured bar it used to. The strip only tints\n// accent on hover / focus / drag.\nconst panelResizeHandleVariants = cva(\n [\n 'ds:absolute ds:[inset-block:0] ds:z-[1] ds:select-none ds:touch-none',\n 'ds:[inline-size:var(--resizable-handle-size)] ds:cursor-col-resize',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:hover:bg-[var(--accent)] ds:focus-visible:bg-[var(--accent)] ds:data-[resizing]:bg-[var(--accent)]',\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 \"ds:before:absolute ds:before:content-['']\",\n 'ds:before:[block-size:100%]',\n 'ds:before:[inline-size:var(--min-target-size)]',\n 'ds:before:[inset-block:0]',\n 'ds:before:[inset-inline:calc(0px_-_(var(--min-target-size)_-_var(--resizable-handle-size))_/_2)]',\n ],\n {\n variants: {\n edge: {\n 'inline-start': 'ds:start-0',\n 'inline-end': 'ds:end-0',\n },\n },\n defaultVariants: { edge: 'inline-start' },\n },\n);\n\n// Hand-rolled overlay count chip — mirrors the AliaSidebar / MessageTray\n// badge markup. A <Badge> would re-introduce its own landmark/role; the\n// strip icon already carries the count in its accessible name, so this\n// span is purely decorative (`aria-hidden`).\nconst badgeVariants = cva(\n [\n 'ds:absolute ds:-top-[var(--spacing-xs)] ds:-end-[var(--spacing-xs)]',\n 'ds:inline-flex ds:items-center ds:justify-center',\n 'ds:min-w-[calc(var(--spacing-md)+var(--spacing-xs))]',\n 'ds:h-[calc(var(--spacing-md)+var(--spacing-xs))]',\n 'ds:ps-[calc(var(--spacing-xs)/1.5)] ds:pe-[calc(var(--spacing-xs)/1.5)]',\n 'ds:rounded-[var(--radius-full)]',\n 'ds:bg-[color:var(--destructive)] ds:text-[color:var(--destructive-foreground)]',\n 'ds:text-[length:var(--font-size-xs)] ds:font-semibold ds:leading-none',\n 'ds:pointer-events-none ds:select-none',\n 'ds:forced-colors:outline ds:forced-colors:outline-1 ds:forced-colors:outline-[CanvasText]',\n ].join(' '),\n);\n\n// Per-icon slot — the positioned box that hosts the IconButton, its badge and\n// the optional affordance overlay. CVA carries the drag states: the dragged\n// icon dims; a hovered drop target shows a dashed accent ring (logical offset),\n// mirroring the Sidebar's favourite-row affordance.\nconst toolSlotVariants = cva(\n // `group/rail-tool` lets an affordance overlay (e.g. a pin star) reveal on\n // hover / focus-within of the whole slot.\n ['ds:group/rail-tool ds:relative', 'ds:rounded-[var(--radius-sm)]'],\n {\n variants: {\n dragging: { true: 'ds:opacity-60', false: '' },\n dropTarget: {\n true: 'ds:outline-[length:var(--focus-ring-width)] ds:outline-dashed ds:outline-[var(--accent)] ds:outline-offset-[length:var(--focus-ring-offset)]',\n false: '',\n },\n reorderable: {\n true: 'ds:cursor-grab ds:active:cursor-grabbing',\n false: '',\n },\n },\n defaultVariants: {\n dragging: false,\n dropTarget: false,\n reorderable: false,\n },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Props */\n/* ------------------------------------------------------------------ */\n\nexport interface ToolRailProps extends VariantProps<typeof railVariants> {\n /** Stable instance id, surfaced on the root as `data-component-id`. */\n id?: string;\n /** The tools shown as icons on the strip. */\n tools: ToolRailTool[];\n /** Controlled active tool id (null = collapsed / strip-only). */\n activeToolId?: string | null;\n /** Uncontrolled initial active tool id (default null). */\n defaultActiveToolId?: string | null;\n /** Fires whenever the active tool changes (incl. → null on collapse). */\n onActiveToolChange?: (id: string | null) => void;\n /** Which edge the rail docks to. Default `'end'` (inline-end). */\n side?: 'start' | 'end';\n /** Accessible label for the toolbar strip. */\n railLabel?: string;\n /**\n * Opt-in resize affordance for the open tool panel. Renders a\n * `role=\"separator\"` drag handle on the panel's inner edge (the edge\n * facing the main content). The committed width is written to\n * `--tool-rail-panel-inline-size` on the panel element (288–880px);\n * Enter / double-click resets to the token-driven default. Default `false`.\n */\n resizablePanel?: boolean;\n /**\n * Fires when the user reorders the `reorderable` run (drag-drop or\n * `Alt`+Arrow). `from` / `to` are indices into `tools`; the host applies the\n * move to the array it passes back. Reordering is enabled when this callback\n * is supplied AND at least one tool is `reorderable`. When the whole strip is\n * reorderable, `to` may land in the other scope group — the host interprets\n * the crossing (and may treat it as a no-op, e.g. reordering within a\n * host-ordered group).\n */\n onReorder?: (from: number, to: number) => void;\n /**\n * Optional override for the polite live-region message announced after a\n * reorder. Lets the host phrase membership-aware moves (e.g. \"Pinned X to\n * favourites\") instead of the generic \"moved to position N\". Return an empty\n * string to stay silent (e.g. for a move the host treats as a no-op). When\n * omitted, the rail announces the generic run-relative position.\n */\n formatReorderAnnouncement?: (args: {\n tool: ToolRailTool;\n from: number;\n to: number;\n }) => string;\n /**\n * Optional per-icon overlay control, rendered as a sibling of each strip\n * IconButton (the same positioned box the notification badge uses). Use for\n * a small affordance such as a pin toggle — the rail attaches no meaning to\n * what it renders. Receives the tool and its index / active state.\n */\n renderToolAffordance?: (\n tool: ToolRailTool,\n context: { index: number; isActive: boolean; isRovingTarget: boolean },\n ) => ReactNode;\n /**\n * Optional non-scrolling header rendered at the top of the OPEN tool panel,\n * above its scroll region. Host-owned content (e.g. a pin / unpin control) —\n * the rail attaches no meaning. Receives the active tool.\n */\n renderPanelHeader?: (\n tool: ToolRailTool,\n context: { isActive: boolean },\n ) => ReactNode;\n /**\n * Identity override for the root's `data-component` attribute. Defaults to\n * `'tool-rail'`. A product wrapper (e.g. ControlRoomRail) passes its own\n * kebab id so the DOM / cascade boundary — and an agent's `domHooks.root` —\n * can tell its surface apart from a bare ToolRail, without the engine ever\n * importing the wrapper.\n */\n dataComponent?: string;\n /**\n * Agent adapter registered for this rail instance. Defaults to\n * `toolRailAgent`. A wrapper passes its own adapter (matching\n * `dataComponent`) so the rail registers under the wrapper's identity. The\n * instance id is sourced from the `id` prop (also stamped as\n * `data-component-id`).\n */\n agentAdapter?: AgentAdapter<ToolRailHandle>;\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction formatBadgeCount(count: number, overflowLabel: string): string {\n return count > 99 ? overflowLabel : String(count);\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport const ToolRail = forwardRef<ToolRailHandle, ToolRailProps>(\n (\n {\n id,\n tools,\n activeToolId,\n defaultActiveToolId = null,\n onActiveToolChange,\n side = 'end',\n railLabel,\n resizablePanel = false,\n onReorder,\n formatReorderAnnouncement,\n renderToolAffordance,\n renderPanelHeader,\n dataComponent = 'tool-rail',\n agentAdapter = toolRailAgent,\n className,\n },\n ref,\n ) => {\n const { t } = useTranslation();\n\n // Controlled / uncontrolled bridge — the same hook MessageTray uses.\n const [activeRaw, setActiveRaw] = useControllableState<string | null>({\n value: activeToolId,\n defaultValue: defaultActiveToolId,\n onChange: onActiveToolChange,\n });\n const activeId = activeRaw ?? null;\n\n // Roving-tabindex bookkeeping for the vertical toolbar strip.\n const buttonsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const panelRef = useRef<HTMLElement | null>(null);\n const [focusIndex, setFocusIndex] = useState(0);\n // Distinguishes keyboard activation (auto-focus into the panel) from\n // pointer activation (focus stays on the icon — less jarring).\n const activatedByKeyboardRef = useRef(false);\n // Set on Enter/Space keydown, read by the click handler that follows,\n // cleared on keyup — so a subsequent mouse click never inherits it.\n const keyboardActivateRef = useRef(false);\n\n const activeIndex = useMemo(\n () => tools.findIndex((tl) => tl.id === activeId),\n [tools, activeId],\n );\n const activeTool = activeIndex >= 0 ? tools[activeIndex] : null;\n\n // First non-disabled index — the resting roving stop when none active.\n const firstEnabledIndex = useMemo(\n () => tools.findIndex((tl) => !tl.disabled),\n [tools],\n );\n\n // Scope grouping: a divider marks the boundary between the two scope groups,\n // whichever order they appear in. The array is always grouped (all of one\n // scope, then the other); the divider precedes the first tool whose scope\n // differs from the lead tool's. `boundary > 0` guarantees both groups are\n // present. Render-only (not a `tools[]` member) so roving focus is untouched;\n // a legacy strip with no `scope` set stays ungrouped.\n const scopeDividerIndex = useMemo(() => {\n const lead = tools[0]?.scope;\n if (!lead) return -1;\n return tools.findIndex((tl) => tl.scope && tl.scope !== lead);\n }, [tools]);\n const showScopeDivider = scopeDividerIndex > 0;\n\n /* ---- Reorder (drag-and-drop + Alt+Arrow keyboard) ------------- */\n // The contiguous run of `reorderable` tools — a tool only moves within it.\n const reorderRun = useMemo(() => {\n const first = tools.findIndex((tl) => tl.reorderable);\n if (first < 0) return null;\n let last = first;\n while (last + 1 < tools.length && tools[last + 1]?.reorderable) last += 1;\n return { first, last };\n }, [tools]);\n const reorderEnabled = !!onReorder && reorderRun !== null;\n const reorderInstructionsId = useId();\n\n const [dragIndex, setDragIndex] = useState<number | null>(null);\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n\n // sr-only announcement. The zero-width-space toggle forces a re-announce of\n // an identical message (e.g. moving the same item twice) — same technique\n // the Sidebar uses for its reorder live region.\n const [reorderMessage, setReorderMessage] = useState('');\n const announceToggle = useRef(false);\n const commitReorder = useCallback(\n (from: number, to: number) => {\n if (!onReorder || !reorderRun) return;\n const clamped = Math.max(\n reorderRun.first,\n Math.min(reorderRun.last, to),\n );\n if (clamped === from) return;\n onReorder(from, clamped);\n const moved = tools[from];\n if (moved) {\n // The host can phrase membership-aware moves (e.g. pin / unpin) and\n // can return '' to stay silent for a move it treats as a no-op.\n const text = formatReorderAnnouncement\n ? formatReorderAnnouncement({ tool: moved, from, to: clamped })\n : t('toolRail.reorderAnnounce', {\n tool: moved.label,\n to: clamped - reorderRun.first + 1,\n total: reorderRun.last - reorderRun.first + 1,\n defaultValue: '{{tool}} moved to position {{to}} of {{total}}',\n });\n if (text) {\n announceToggle.current = !announceToggle.current;\n setReorderMessage(announceToggle.current ? text : `${text}\\u200b`);\n }\n }\n },\n [onReorder, reorderRun, tools, t, formatReorderAnnouncement],\n );\n\n // The roving tab stop: the active icon when a tool is open, else the\n // index the user last focused, else the first enabled icon.\n const rovingIndex =\n activeIndex >= 0\n ? activeIndex\n : focusIndex >= 0 && !tools[focusIndex]?.disabled\n ? focusIndex\n : firstEnabledIndex;\n\n const selectTool = useCallback(\n (toolId: string, fromKeyboard: boolean) => {\n const tool = tools.find((tl) => tl.id === toolId);\n if (!tool || tool.disabled) return;\n activatedByKeyboardRef.current = fromKeyboard;\n // Clicking / activating the active tool collapses to strip-only.\n setActiveRaw(activeId === toolId ? null : toolId);\n },\n [tools, activeId, setActiveRaw],\n );\n\n /* ---- Roving arrow-key navigation (vertical toolbar) ----------- */\n const handleStripKeyDown = useCallback(\n (event: ReactKeyboardEvent<HTMLDivElement>) => {\n const count = tools.length;\n if (count === 0) return;\n // Alt+Arrow is reserved for reordering (handled on the icon); never\n // let it move focus roving as well.\n if (event.altKey) return;\n\n let next: number | null = null;\n if (event.key === 'ArrowDown') next = (rovingIndex + 1) % count;\n else if (event.key === 'ArrowUp')\n next = (rovingIndex - 1 + count) % count;\n else if (event.key === 'Home') next = 0;\n else if (event.key === 'End') next = count - 1;\n if (next === null) return;\n\n // Skip disabled icons in the travel direction.\n const goingBack = event.key === 'ArrowUp' || event.key === 'End';\n let candidate = next;\n let attempts = 0;\n while (attempts < count && tools[candidate]?.disabled) {\n candidate = goingBack\n ? (candidate - 1 + count) % count\n : (candidate + 1) % count;\n attempts += 1;\n }\n if (tools[candidate]?.disabled) return;\n\n event.preventDefault();\n setFocusIndex(candidate);\n buttonsRef.current[candidate]?.focus();\n },\n [tools, rovingIndex],\n );\n\n /* ---- Esc collapses + returns focus to the active tool's icon -- */\n // Attached imperatively via the root ref (not a JSX onKeyDown on the\n // static container) so the Escape shortcut works from anywhere inside the\n // open panel without an interaction handler on a non-interactive element.\n const rootRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const node = rootRef.current;\n if (!node) return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return;\n if (activeIndex < 0) return;\n event.preventDefault();\n const returnIndex = activeIndex;\n setActiveRaw(null);\n setFocusIndex(returnIndex);\n // Defer until after the panel unmounts so focus lands cleanly.\n requestAnimationFrame(() => {\n buttonsRef.current[returnIndex]?.focus();\n });\n };\n node.addEventListener('keydown', onKeyDown);\n return () => node.removeEventListener('keydown', onKeyDown);\n }, [activeIndex, setActiveRaw]);\n\n /* ---- Move focus into the panel when opened by keyboard -------- */\n useIsomorphicLayoutEffect(() => {\n if (activeTool && activatedByKeyboardRef.current) {\n panelRef.current?.focus();\n }\n activatedByKeyboardRef.current = false;\n }, [activeTool]);\n\n /* ---- Opt-in panel resize (inner edge) -------------------------- */\n // The handle sits on the edge facing the main content: the panel's\n // inline-start edge for an end-docked rail, inline-end for start.\n const panelEdge = side === 'end' ? 'inline-start' : 'inline-end';\n const { separatorProps, isResizing, isResized } = useEdgeResize({\n edge: panelEdge,\n targetRef: panelRef,\n cssProperty: PANEL_SIZE_PROPERTY,\n minSize: PANEL_MIN_SIZE,\n maxSize: PANEL_MAX_SIZE,\n defaultSize: PANEL_DEFAULT_SIZE,\n disabled: !resizablePanel,\n });\n\n // The aside unmounts on collapse, dropping the hook's inline override.\n // Re-assert the committed width when a panel (re)mounts so a reopened\n // panel keeps the user's chosen size.\n const committedPanelWidth = separatorProps['aria-valuenow'];\n useIsomorphicLayoutEffect(() => {\n if (!resizablePanel || !isResized || !activeTool) return;\n panelRef.current?.style.setProperty(\n PANEL_SIZE_PROPERTY,\n `${committedPanelWidth}px`,\n );\n }, [activeTool, resizablePanel, isResized, committedPanelWidth]);\n\n /* ---- Curated imperative handle for agent integration ---------- */\n const activeIdRef = useRef<string | null>(activeId);\n activeIdRef.current = activeId;\n\n const handle = useMemo<ToolRailHandle>(\n () => ({\n getActiveToolId: () => activeIdRef.current,\n setActiveTool: (toolId) => {\n activatedByKeyboardRef.current = false;\n setActiveRaw(toolId);\n },\n open: (toolId) => {\n const tool = tools.find((tl) => tl.id === toolId);\n if (!tool || tool.disabled) return;\n activatedByKeyboardRef.current = false;\n setActiveRaw(toolId);\n },\n close: () => {\n const returnId = activeIdRef.current;\n activatedByKeyboardRef.current = false;\n setActiveRaw(null);\n // Return focus to the closed tool's strip icon (mirrors Escape) so a\n // close-button / pointer collapse never drops focus to <body>.\n if (returnId != null) {\n requestAnimationFrame(() => {\n rootRef.current\n ?.querySelector<HTMLButtonElement>(\n `[data-tool-id=\"${CSS.escape(returnId)}\"]`,\n )\n ?.focus();\n });\n }\n },\n }),\n [tools, setActiveRaw],\n );\n\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(agentAdapter, handle, id);\n\n const overflowLabel = t('toolRail.badgeCountOverflow', {\n defaultValue: '99+',\n });\n\n return (\n <div\n ref={rootRef}\n data-component={dataComponent}\n data-component-id={id}\n data-side={side}\n className={[railVariants({ side }), className]\n .filter(Boolean)\n .join(' ')}\n >\n {/* Reorder a11y: a polite live region announcing each move. Each\n reorderable icon carries its own keyboard instruction (rendered in\n its slot, referenced via aria-describedby). */}\n {reorderEnabled ? (\n <span role=\"status\" aria-live=\"polite\" className=\"ds:sr-only\">\n {reorderMessage}\n </span>\n ) : null}\n {/* The OPEN panel is the single complementary landmark, named by\n the active tool. Rendered only while a tool is active so two\n unnamed regions never coexist. */}\n {activeTool ? (\n <aside\n ref={panelRef}\n tabIndex={-1}\n aria-label={t('toolRail.panelLabel', {\n tool: activeTool.label,\n defaultValue: '{{tool}} panel',\n })}\n data-tool-rail-state=\"expanded\"\n data-active-tool={activeTool.id}\n data-resizing={isResizing ? '' : undefined}\n className={[\n panelVariants(),\n // Subtle shadow — not a line — separating the panel from the\n // icon strip (the tab row). The panel casts a soft chrome\n // shadow toward the strip on its strip-facing edge. `z-[1]`\n // lifts it above the adjacent strip (the panel is already\n // `relative`) so the shadow paints at the seam instead of being\n // covered by the strip's opaque background. Only renders while\n // the panel is open (the aside is unmounted when collapsed), so\n // it never doubles as a rail↔main seam. In the accessible (AAA)\n // theme the soft shadow becomes a solid 1px border on that same\n // strip-facing edge.\n 'ds:z-[1]',\n side === 'end'\n ? 'ds:shadow-[var(--shadow-chrome-end)] ds:[.theme-accessible_&]:border-e ds:[.theme-accessible_&]:border-[var(--border)] ds:[.theme-accessible_&]:shadow-none'\n : 'ds:shadow-[var(--shadow-chrome-start)] ds:[.theme-accessible_&]:border-s ds:[.theme-accessible_&]:border-[var(--border)] ds:[.theme-accessible_&]:shadow-none',\n 'ds:focus-visible:outline-none',\n ].join(' ')}\n >\n {/* Optional host-owned, non-scrolling panel header (e.g. the\n Control Room's add / remove favourite control). Sits above the\n scroll region so it stays put as the panel body scrolls. */}\n {renderPanelHeader\n ? renderPanelHeader(activeTool, { isActive: true })\n : null}\n {/* Optional per-tool pinned header — the rail-level home for a\n sticky tool header (title / filters). Non-scrolling, above the\n body, so it stays visible for every tool. */}\n {activeTool.header ? (\n <div className=\"ds:shrink-0\">{activeTool.header}</div>\n ) : null}\n {/* Body: a self-scrolling `fill` tool owns its own scroll inside\n the height-bounded panel; otherwise the rail scrolls it. */}\n {activeTool.fill ? (\n // data-tool-fill: a self-scrolling panel owns its own native\n // scroll (it can't use the rail's ScrollArea), so a token rule\n // paints its scrollbar to match the 8px overlay. See tokens/index.css.\n <div data-tool-fill=\"\" className=\"ds:flex-1 ds:min-h-0\">\n {activeTool.panel}\n </div>\n ) : (\n <ScrollArea\n orientation=\"vertical\"\n className=\"ds:flex-1 ds:min-h-0\"\n >\n {activeTool.panel}\n </ScrollArea>\n )}\n {/* Inside the aside (so it belongs to the complementary\n landmark) and outside the toolbar strip — the strip's\n roving handlers never see its key events, and Escape\n still bubbles to the root to collapse, as everywhere\n else in the panel. No stopPropagation needed. */}\n {resizablePanel ? (\n <div\n {...separatorProps}\n aria-label={t('toolRail.resizePanel', {\n defaultValue: 'Resize tool panel',\n })}\n data-resizing={isResizing ? '' : undefined}\n className={panelResizeHandleVariants({ edge: panelEdge })}\n />\n ) : null}\n </aside>\n ) : null}\n\n {/* The 3rem icon strip — a vertical toolbar with roving tabindex.\n Self-contained TooltipProvider so consumers needn't mount one;\n Radix providers compose, so a host-level provider still works. */}\n <TooltipProvider>\n <div\n role=\"toolbar\"\n aria-orientation=\"vertical\"\n aria-label={\n railLabel ?? t('toolRail.railLabel', { defaultValue: 'Tools' })\n }\n className={stripVariants()}\n onKeyDown={handleStripKeyDown}\n >\n {tools.map((tool, index) => {\n const isActive = tool.id === activeId;\n const showBadge =\n typeof tool.badgeCount === 'number' && tool.badgeCount > 0;\n // Fold the count into the accessible name so SR users hear it\n // without relying on the decorative chip.\n const accessibleName = showBadge\n ? t('toolRail.toolWithCount', {\n tool: tool.label,\n count: tool.badgeCount,\n defaultValue: '{{tool}}, {{count}} updates',\n })\n : tool.label;\n const canReorderTool =\n reorderEnabled && !!tool.reorderable && !tool.disabled;\n const reorderDescId = canReorderTool\n ? `${reorderInstructionsId}-${tool.id}`\n : undefined;\n return (\n <Fragment key={tool.id}>\n {showScopeDivider && index === scopeDividerIndex ? (\n <div\n role=\"separator\"\n aria-orientation=\"horizontal\"\n className=\"ds:my-[var(--spacing-2xs)] ds:h-px ds:w-[var(--spacing-lg)] ds:shrink-0 ds:bg-[var(--border)] ds:forced-colors:bg-[CanvasText]\"\n />\n ) : null}\n <div\n className={toolSlotVariants({\n dragging: dragIndex === index,\n dropTarget: dropIndex === index && dragIndex !== index,\n reorderable: canReorderTool,\n })}\n data-dragging={dragIndex === index ? '' : undefined}\n // Drag the whole slot — the icon button is an unreliable\n // HTML5 drag source across browsers. The button keeps its\n // click + Alt+Arrow keyboard reorder; drag is pointer-only.\n draggable={canReorderTool || undefined}\n onDragStart={\n canReorderTool\n ? (event) => {\n setDragIndex(index);\n event.dataTransfer.effectAllowed = 'move';\n // Firefox needs data set to initiate a drag.\n event.dataTransfer.setData(\n 'text/plain',\n String(index),\n );\n }\n : undefined\n }\n onDragOver={\n canReorderTool\n ? (event) => {\n if (dragIndex === null) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = 'move';\n if (dropIndex !== index) setDropIndex(index);\n }\n : undefined\n }\n onDragLeave={\n canReorderTool\n ? () =>\n setDropIndex((cur) => (cur === index ? null : cur))\n : undefined\n }\n onDrop={\n canReorderTool\n ? (event) => {\n event.preventDefault();\n const from = dragIndex;\n setDropIndex(null);\n setDragIndex(null);\n if (from === null || from === index) return;\n commitReorder(from, index);\n }\n : undefined\n }\n onDragEnd={\n canReorderTool\n ? () => {\n setDragIndex(null);\n setDropIndex(null);\n }\n : undefined\n }\n >\n <IconButton\n ref={(el) => {\n buttonsRef.current[index] = el;\n }}\n icon={tool.icon}\n tooltip={tool.label}\n aria-label={accessibleName}\n intent=\"ghost\"\n size=\"sm\"\n disabled={tool.disabled}\n aria-pressed={isActive}\n aria-expanded={isActive}\n data-active={isActive ? tool.id : undefined}\n data-tool-id={tool.id}\n aria-describedby={reorderDescId}\n aria-keyshortcuts={\n canReorderTool ? 'Alt+ArrowUp Alt+ArrowDown' : undefined\n }\n tabIndex={index === rovingIndex ? 0 : -1}\n onFocus={() => {\n if (!tool.disabled) setFocusIndex(index);\n }}\n onClick={() =>\n selectTool(tool.id, keyboardActivateRef.current)\n }\n onKeyDown={(event) => {\n // Enter/Space activate via the native button's click,\n // which fires AFTER this keydown. Flag the upcoming\n // click as keyboard-driven so focus moves into the\n // panel; reset on keyup so a later mouse click doesn't\n // inherit the flag.\n if (event.key === 'Enter' || event.key === ' ') {\n keyboardActivateRef.current = true;\n return;\n }\n // Alt+Arrow / Alt+Home / Alt+End reorder within the run.\n // Focus follows the moved icon to its new index; roving\n // ignores Alt (see handleStripKeyDown).\n if (canReorderTool && event.altKey && reorderRun) {\n let target: number | null = null;\n if (event.key === 'ArrowUp') target = index - 1;\n else if (event.key === 'ArrowDown')\n target = index + 1;\n else if (event.key === 'Home')\n target = reorderRun.first;\n else if (event.key === 'End')\n target = reorderRun.last;\n if (target !== null) {\n event.preventDefault();\n const dest = Math.max(\n reorderRun.first,\n Math.min(reorderRun.last, target),\n );\n // Focus follows the moved TOOL (by id), not the\n // slot index — so it lands correctly however the\n // host reinterprets the move (reorder, cross-group\n // pin / unpin, or a no-op that leaves it in place).\n const movedId = tool.id;\n commitReorder(index, dest);\n requestAnimationFrame(() => {\n rootRef.current\n ?.querySelector<HTMLButtonElement>(\n `[data-tool-id=\"${CSS.escape(movedId)}\"]`,\n )\n ?.focus();\n });\n }\n }\n }}\n onKeyUp={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n keyboardActivateRef.current = false;\n }\n }}\n />\n {showBadge ? (\n <span aria-hidden=\"true\" className={badgeVariants()}>\n {formatBadgeCount(\n tool.badgeCount as number,\n overflowLabel,\n )}\n </span>\n ) : null}\n {renderToolAffordance?.(tool, {\n index,\n isActive,\n isRovingTarget: index === rovingIndex,\n })}\n {reorderDescId ? (\n <span id={reorderDescId} className=\"ds:sr-only\">\n {t('toolRail.reorderInstructions', {\n tool: tool.label,\n defaultValue:\n 'Reorder {{tool}}. Press Alt + Up or Alt + Down to move.',\n })}\n </span>\n ) : null}\n </div>\n </Fragment>\n );\n })}\n </div>\n </TooltipProvider>\n </div>\n );\n },\n);\n\nToolRail.displayName = 'ToolRail';\n"],"names":["toolRailAgent","handle","args","RAIL_WIDTH","PANEL_WIDTH","PANEL_SIZE_PROPERTY","PANEL_MIN_SIZE","PANEL_MAX_SIZE","PANEL_DEFAULT_SIZE","railVariants","cva","stripVariants","panelVariants","panelResizeHandleVariants","badgeVariants","toolSlotVariants","formatBadgeCount","count","overflowLabel","ToolRail","forwardRef","id","tools","activeToolId","defaultActiveToolId","onActiveToolChange","side","railLabel","resizablePanel","onReorder","formatReorderAnnouncement","renderToolAffordance","renderPanelHeader","dataComponent","agentAdapter","className","ref","t","useTranslation","activeRaw","setActiveRaw","useControllableState","activeId","buttonsRef","useRef","panelRef","focusIndex","setFocusIndex","useState","activatedByKeyboardRef","keyboardActivateRef","activeIndex","useMemo","tl","activeTool","firstEnabledIndex","scopeDividerIndex","lead","_a","showScopeDivider","reorderRun","first","last","reorderEnabled","reorderInstructionsId","useId","dragIndex","setDragIndex","dropIndex","setDropIndex","reorderMessage","setReorderMessage","announceToggle","commitReorder","useCallback","from","to","clamped","moved","text","rovingIndex","selectTool","toolId","fromKeyboard","tool","handleStripKeyDown","event","next","goingBack","candidate","attempts","_b","_c","rootRef","useEffect","node","onKeyDown","returnIndex","useIsomorphicLayoutEffect","panelEdge","separatorProps","isResizing","isResized","useEdgeResize","committedPanelWidth","activeIdRef","returnId","useImperativeHandle","useAgentRegistration","jsxs","jsx","ScrollArea","TooltipProvider","index","isActive","showBadge","accessibleName","canReorderTool","reorderDescId","Fragment","cur","IconButton","el","target","dest","movedId"],"mappings":";;;;;;;;;;;AAYO,MAAMA,KAA8C;AAAA,EACzD,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,SAAS,eAAe;AAAA,EAC/C,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,gBAAA;AAAA,IAAgB;AAAA,EAC3C;AAAA,EAEF,SAAS;AAAA,IACP,MAAM;AAAA;AAAA,MAEJ,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY,EAAE,IAAI,EAAE,MAAM,WAAS;AAAA,QACnC,UAAU,CAAC,IAAI;AAAA,MAAA;AAAA,MAEjB,YAAY;AAAA;AAAA;AAAA,MAGZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,UAAU,CAAC,EAAE,MAAM,E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A,GAEJ,IACE;AAAA,wBACHa,KAAA,gBAAAA,EAAuBqD,GAAM;AAAA,0BAC5B,OAAA6B;AAAA,0BACA,UAAAC;AAAA,0BACA,gBAAgBD,MAAUjC;AAAA,wBAAA;AAAA,wBAE3BsC,sBACE,QAAA,EAAK,IAAIA,GAAe,WAAU,cAChC,YAAE,gCAAgC;AAAA,0BACjC,MAAMlC,EAAK;AAAA,0BACX,cACE;AAAA,wBAAA,CACH,GACH,IACE;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACN,EAAA,GAtKaA,EAAK,EAuKpB;AAAA,cAEJ,CAAC;AAAA,YAAA;AAAA,UAAA,EACH,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAjE,GAAS,cAAc;"}
@@ -1,11 +1,11 @@
1
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
2
  import { forwardRef as _, useMemo as A } from "react";
3
3
  import { c as m } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as j } from "react-i18next";
5
5
  function u({
6
6
  className: a
7
7
  }) {
8
- return /* @__PURE__ */ o(
8
+ return /* @__PURE__ */ r(
9
9
  "svg",
10
10
  {
11
11
  "aria-hidden": "true",
@@ -13,11 +13,11 @@ function u({
13
13
  fill: "currentColor",
14
14
  xmlns: "http://www.w3.org/2000/svg",
15
15
  className: a,
16
- children: /* @__PURE__ */ o("path", { d: "M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.149-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.71.306 1.263.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413Z" })
16
+ children: /* @__PURE__ */ r("path", { d: "M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.149-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.71.306 1.263.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413Z" })
17
17
  }
18
18
  );
19
19
  }
20
- const C = m(
20
+ const k = m(
21
21
  [
22
22
  // `position` is provided by `positionVariants` below — `static`
23
23
  // sets `ds:relative` (so the pseudo-element touch-target anchors),
@@ -119,7 +119,7 @@ const C = m(
119
119
  size: "md"
120
120
  }
121
121
  }
122
- ), k = m("", {
122
+ ), C = m("", {
123
123
  variants: {
124
124
  position: {
125
125
  // `relative` so the `::before` pseudo touch-target (defined in
@@ -142,15 +142,15 @@ function B(a, n) {
142
142
  const s = a.replace(/\D/g, "");
143
143
  if (s.length === 0)
144
144
  return null;
145
- const r = `https://wa.me/${s}`;
146
- return n ? `${r}?text=${encodeURIComponent(n)}` : r;
145
+ const d = `https://wa.me/${s}`;
146
+ return n ? `${d}?text=${encodeURIComponent(n)}` : d;
147
147
  }
148
148
  const L = _(
149
149
  ({
150
150
  phoneNumber: a,
151
151
  message: n,
152
152
  variant: s = "pill",
153
- size: r = "md",
153
+ size: d = "md",
154
154
  position: h,
155
155
  label: g,
156
156
  tone: w = "standard",
@@ -161,29 +161,37 @@ const L = _(
161
161
  () => B(a, n),
162
162
  [a, n]
163
163
  ), e = g ?? p(s === "fab" ? "whatsApp.fabLabel" : w === "question" ? "whatsApp.questionPrompt" : "whatsApp.label"), y = [
164
- C({ variant: s, size: r }),
165
- k({ position: h }),
164
+ k({ variant: s, size: d }),
165
+ C({ position: h }),
166
166
  x
167
- ].filter(Boolean).join(" "), d = f === null, v = {
167
+ ].filter(Boolean).join(" "), o = f === null, v = {
168
168
  ref: z,
169
- ...d ? {} : {
169
+ ...o ? {} : {
170
170
  href: f,
171
171
  target: "_blank",
172
172
  rel: "noopener noreferrer"
173
173
  },
174
- "aria-disabled": d ? !0 : void 0,
174
+ /* An <a> without href has NO implicit role, and `aria-disabled` is
175
+ prohibited on a roleless element (axe aria-prohibited-attr). Give
176
+ the disabled anchor an explicit link role so the state is legal
177
+ and assistive tech still announces it. */
178
+ /* `tabIndex` too: an <a> without href is not focusable, and
179
+ `aria-disabled` presupposes something focus CAN reach — otherwise
180
+ the reason the control is disabled never reaches a keyboard. */
181
+ ...o ? { role: "link", tabIndex: 0 } : {},
182
+ "aria-disabled": o ? !0 : void 0,
175
183
  "data-component": "whatsapp-button",
176
184
  "data-variant": s,
177
185
  onClick: (l) => {
178
186
  var b;
179
- d && l.preventDefault(), (b = i.onClick) == null || b.call(i, l);
187
+ o && l.preventDefault(), (b = i.onClick) == null || b.call(i, l);
180
188
  },
181
189
  className: y
182
- }, t = d ? null : p("link.opensInNewTab", "Opens in a new tab");
190
+ }, t = o ? null : p("link.opensInNewTab", "Opens in a new tab");
183
191
  if (s === "fab") {
184
192
  const l = typeof e == "string" ? t ? `${e} — ${t}` : e : void 0;
185
193
  return /* @__PURE__ */ c("a", { ...i, ...v, "aria-label": l, children: [
186
- /* @__PURE__ */ o(u, {}),
194
+ /* @__PURE__ */ r(u, {}),
187
195
  typeof e != "string" ? /* @__PURE__ */ c("span", { className: "ds:sr-only", children: [
188
196
  e,
189
197
  t ? ` — ${t}` : null
@@ -191,8 +199,8 @@ const L = _(
191
199
  ] });
192
200
  }
193
201
  return /* @__PURE__ */ c("a", { ...i, ...v, children: [
194
- /* @__PURE__ */ o(u, {}),
195
- /* @__PURE__ */ o("span", { children: e }),
202
+ /* @__PURE__ */ r(u, {}),
203
+ /* @__PURE__ */ r("span", { children: e }),
196
204
  t ? /* @__PURE__ */ c("span", { className: "ds:sr-only", children: [
197
205
  " — ",
198
206
  t
@@ -205,4 +213,4 @@ export {
205
213
  L as W,
206
214
  u as a
207
215
  };
208
- //# sourceMappingURL=whatsapp-button-Ca9towA4.js.map
216
+ //# sourceMappingURL=whatsapp-button-CuFIHJzG.js.map