@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
@@ -1 +0,0 @@
1
- {"version":3,"file":"contact-profile-card-CE9OJKcl.js","sources":["../../node_modules/lucide-react/dist/esm/icons/banknote.mjs","../../src/components/contact-profile-card/contact-profile-card.agent.ts","../../src/components/contact-profile-card/contact-profile-card.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"20\", height: \"12\", x: \"2\", y: \"6\", rx: \"2\", key: \"9lu3g6\" }],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"2\", key: \"1c9p78\" }],\n [\"path\", { d: \"M6 12h.01M18 12h.01\", key: \"113zkx\" }]\n];\nconst Banknote = createLucideIcon(\"banknote\", __iconNode);\n\nexport { __iconNode, Banknote as default };\n//# sourceMappingURL=banknote.mjs.map\n","import type { AgentAdapter } from '../../agent/types';\nimport type { ContactProfileCardHandle } from './contact-profile-card';\n\n/* -------------------------------------------------------------------- */\n/* Agent adapter — ContactProfileCard */\n/* */\n/* Read-only adapter. Surfaces the rendered profession field so an */\n/* agent / MCP runtime can resolve \"what kind of practice is this?\" */\n/* without re-parsing the DOM. No actions yet — the card is a passive */\n/* presentation surface; navigation lives on the consumer's page. */\n/* -------------------------------------------------------------------- */\n\nexport const contactProfileCardAgent: AgentAdapter<ContactProfileCardHandle> = {\n id: 'contact-profile-card',\n // Passive presentation surface — only exposes the rendered profession for\n // introspection. No interactive capability is backed by the handle.\n capabilities: [],\n state: {\n profession: {\n type: 'string',\n descriptionKey: 'ui.agent.contactProfileCard.state.profession',\n description:\n 'Profession string the card is currently rendering — undefined when the consumer omitted it.',\n read: (handle) => handle.getProfession(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'contact-profile-card',\n description: 'Marks the ContactProfileCard root region.',\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 useId,\n useMemo,\n type ComponentPropsWithoutRef,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n Banknote,\n ExternalLink,\n Globe,\n Heart,\n Languages as LanguagesIcon,\n Mail,\n MapPin,\n MessageCircle,\n Phone,\n ShieldCheck,\n Stethoscope,\n type LucideIcon,\n} from 'lucide-react';\nimport { Badge } from '../badge/badge';\nimport { Card } from '../card/card';\nimport { KeyValueList, KeyValuePair } from '../key-value-pair/key-value-pair';\nimport { Link } from '../link/link';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { contactProfileCardAgent } from './contact-profile-card.agent';\n\n/* -------------------------------------------------------------------- */\n/* ContactProfileCard */\n/* */\n/* Replaces the bespoke \"Profilo\" / \"Practice info\" cards that every */\n/* AlfaDocs surface composes by hand (booking-website PracticeInfoCard, */\n/* alfascribe operator pages, builders docs example, …). Composes Card */\n/* + KeyValueList + KeyValuePair so the labels share a column (no */\n/* zigzag values) and every row uses the same lucide icon family. */\n/* */\n/* The component is intentionally opinionated: every field is optional, */\n/* but the ORDER, ICONS, and LABELS are owned by the kit. Consumers */\n/* pass the data; the kit owns the visual + i18n. */\n/* */\n/* All visible text flows through `useTranslation('ui')` against the */\n/* `contactProfileCard.*` namespace. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* CVA */\n/* -------------------------------------------------------------------- */\n\n// Override the KVP icon colour at the card root so every inner row's\n// leading glyph paints with `--accent` (brand magenta/violet) instead\n// of the default `--muted-foreground`. The ContactProfileCard is a\n// marketing surface — muted icons read as disabled against the\n// otherwise saturated card chrome. Scoped via CSS custom property so\n// only this card's icons shift; standalone KVPs elsewhere keep\n// `--muted-foreground`.\nconst rootVariants = cva(\n 'ds:w-full ds:text-[color:var(--foreground)] ds:[--key-value-pair-icon-color:var(--accent)]',\n {\n variants: {\n // Matches the kit's other `surface` props (Booking, ReviewsPanel).\n // The card itself renders `<Card variant=\"elevated\">` so the\n // `surface=\"flat\"` opt-out is rare — most consumers want the\n // boundary.\n surface: {\n flat: '',\n elevated: '',\n },\n },\n defaultVariants: { surface: 'elevated' },\n },\n);\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\nexport interface ContactProfileCardAddress {\n /** Display text — already formatted by the consumer (street, postcode, city). */\n line: string;\n /** Optional lat/lng — drives the static-map link + the embedded thumbnail. */\n lat?: number;\n lng?: number;\n}\n\nexport interface ContactProfileCardHandle {\n /** Resolved consumer-supplied data — useful for agent introspection. */\n getProfession: () => string | undefined;\n}\n\nexport interface ContactProfileCardProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'aria-label' | 'children' | 'children'\n> {\n /**\n * Override the localised \"Profilo\" / \"Profile\" heading. Most\n * consumers leave this unset.\n */\n heading?: string;\n /**\n * Free-text intro paragraph rendered above the data rows (e.g.\n * the practice's `bookingDescription` field). When omitted, the\n * card jumps straight into the data rows.\n */\n description?: string;\n\n /* ----- Identity rows ----- */\n\n /** Street + postcode + city, with optional lat/lng for the map link. */\n address?: ContactProfileCardAddress;\n /** Phone number, displayed as-is. Compiled into a `tel:` link. */\n phone?: string;\n /**\n * WhatsApp number — digits only (no `+`, no spaces). Compiled into\n * a `https://wa.me/<number>` link with an optional pre-filled message.\n */\n whatsappNumber?: string;\n /** Optional pre-filled WhatsApp message. Consumer-localised. */\n whatsappMessage?: string;\n /** Public-facing email. Compiled into a `mailto:` link. */\n email?: string;\n /** Practice website (already an absolute URL with protocol). */\n website?: string;\n\n /* ----- Embedded map thumbnail ----- */\n\n /**\n * Google Maps Static API key. When provided alongside `address.lat`\n * and `address.lng`, renders a static-map thumbnail at the top of\n * the card — a single one-shot `<img>` fetch, no JS SDK boot, no\n * consent gate needed (the same pattern PracticeResults uses).\n *\n * Without it (or without coords), the card renders info rows only —\n * the address row's \"Open in Google Maps\" link is still emitted as\n * a real `<a>` so the spatial cue isn't lost.\n *\n * Additive — existing consumers that don't pass this prop see the\n * same render as before.\n */\n googleMapsApiKey?: string;\n /**\n * Zoom level for the embedded map thumbnail. Default `14` —\n * neighbourhood-level, shows the pin in context. Ignored when the\n * thumbnail isn't rendered.\n */\n mapZoom?: number;\n\n /* ----- Profile metadata ----- */\n\n /**\n * ISO 639-1 language codes the practice speaks. Rendered as\n * `<Badge variant=\"neutral\">` chips. Each code is auto-resolved\n * into the active locale's native language name via the kit's\n * built-in `languages.<iso>` i18n bundle (18 ISO codes × 18\n * locales). For example `languages={['it', 'en']}` with\n * `i18n.language === 'it'` renders \"Italiano\" + \"Inglese\".\n *\n * Unknown / unbundled codes fall back to the uppercase ISO code\n * (`'xyz'` → `'XYZ'`). To override a specific label — regional\n * dialect, brand-voice variant, codes the kit doesn't ship — pass\n * `languageLabels`.\n */\n languages?: string[];\n /**\n * Override map from ISO code → display label, applied on top of\n * the kit's i18n auto-resolution. Only set when you need a\n * consumer-specific label for a code — the typical case is\n * regional dialect / brand-voice variants / non-ISO codes.\n *\n * Resolution order: `languageLabels[code]` > `t('languages.<code>')`\n * > `code.toUpperCase()`.\n */\n languageLabels?: Record<string, string>;\n /**\n * Insurance / convention strings (consumer-supplied, free text).\n * Rendered as `<Badge variant=\"info\">` chips.\n */\n insurances?: string[];\n /**\n * First-visit price in the smallest currency unit (cents / centesimi).\n * Formatted via `Intl.NumberFormat`. Omit when the consumer doesn't\n * want to show the price.\n */\n firstVisitPriceCents?: number;\n /** ISO-4217 currency code for the price formatter. Defaults to `EUR`. */\n currencyCode?: string;\n /** Profession line — single value or already-joined comma list. */\n profession?: string;\n /** Show the \"expert for anxious patients\" row when true. */\n specializedInFearPatients?: boolean;\n\n /* ----- Telemetry hooks ----- */\n\n /**\n * Fires when the patient clicks the phone link. The kit emits a\n * `track('practice_profile_card_phone_click')` event before\n * invoking this — gate consumer-side analytics on the same event\n * to avoid duplicate fires.\n */\n onPhoneClick?: () => void;\n /** Fires when the patient clicks the WhatsApp link. */\n onWhatsAppClick?: () => void;\n /** Fires when the patient clicks the static-map link. */\n onMapClick?: () => void;\n /** Fires when the patient clicks the email mailto link. */\n onEmailClick?: () => void;\n\n /* ----- Slots ----- */\n\n /**\n * Rendered above the heading — e.g. a `<Avatar>` for the operator\n * variant, or a coloured chip strip. Optional.\n */\n headerSlot?: ReactNode;\n /**\n * Render an arbitrary map widget at the top of the card chrome —\n * replaces the built-in static `<img>` thumbnail that\n * `googleMapsApiKey` would otherwise produce. Use this when you\n * want an interactive map inside the card boundary instead of a\n * fixed image:\n *\n * <ContactProfileCard\n * mapSlot={\n * <PracticeMap practice={practice} googleMapsApiKey={key} />\n * }\n * …\n * />\n *\n * When both `mapSlot` and `googleMapsApiKey` are provided, the slot\n * wins (explicit > implicit). When neither is provided, no map area\n * renders. The slot is unstyled — pass through any container chrome\n * the consumer wants (e.g. a fixed height wrapper). The kit\n * positions it where the static thumbnail would have lived.\n */\n mapSlot?: ReactNode;\n /**\n * Rendered at the end of the card body, below the rows. Use for\n * a \"Book now\" `<Button>` or a \"View full profile\" link.\n */\n footerSlot?: ReactNode;\n\n /* ----- Styling ----- */\n\n /**\n * `'elevated'` (default) wraps the card in `<Card variant=\"elevated\">`\n * for a defined surface — what most consumers want when the card\n * stands alone on a page. `'flat'` drops the Card chrome so the\n * content sits naked — use when an outer card / sheet already\n * provides the boundary (e.g. embedded inside a `<Sheet>` or a\n * parent `<Card.Body>`).\n */\n surface?: 'flat' | 'elevated';\n\n /* ----- a11y ----- */\n\n /** Override the default region aria-label. */\n 'aria-label'?: string;\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------- */\n\n/** Strip everything except digits + leading `+` for `tel:` URLs. */\nfunction normalisePhone(raw: string): string {\n return raw.replace(/[^\\d+]/g, '');\n}\n\n/** Build the WhatsApp `wa.me` URL. Number must already be digits-only. */\nfunction buildWhatsAppHref(number: string, message?: string): string {\n const base = `https://wa.me/${number}`;\n if (!message) return base;\n return `${base}?text=${encodeURIComponent(message)}`;\n}\n\n/** Google Maps search query — works without an API key. */\nfunction buildMapHref(address: ContactProfileCardAddress): string {\n const q = encodeURIComponent(address.line);\n return `https://www.google.com/maps/search/?api=1&query=${q}`;\n}\n\n/** Format price (cents → currency string) using the consumer's locale. */\nfunction formatPrice(cents: number, currency: string, locale: string): string {\n try {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n }).format(cents / 100);\n } catch {\n // Locale or currency code rejected — fall back to a plain decimal.\n return (cents / 100).toFixed(2);\n }\n}\n\n/* -------------------------------------------------------------------- */\n/* MapThumbStrip — embedded Google Static Maps image */\n/* */\n/* Full-width strip rendered at the top of the card when the consumer */\n/* supplies both `address.lat`/`lng` and `googleMapsApiKey`. Same */\n/* one-shot `<img>` strategy as PracticeResults' StaticMapThumb (no JS */\n/* SDK boot → no consent gate needed), but full-card-width instead of */\n/* a 12rem aside. */\n/* -------------------------------------------------------------------- */\n\ninterface MapThumbStripProps {\n apiKey: string;\n center: { lat: number; lng: number };\n zoom: number;\n altText: string;\n}\n\n/**\n * Resolve the kit's `--map-marker-color` token to a six-character hex\n * string (no leading `#`) for Google Static Maps' `markers=color:` URL\n * parameter, which requires a literal hex value at fetch time.\n *\n * SSR-safe: when `document` is undefined we fall back to the kit's\n * brand violet. Same helper as PracticeResults — keep in sync if you\n * touch one.\n */\nfunction getStaticMapMarkerHex(): string {\n if (typeof document === 'undefined') return '4945a3';\n const raw = getComputedStyle(document.documentElement)\n .getPropertyValue('--map-marker-color')\n .trim();\n const match = /^#?([0-9a-fA-F]{6})$/.exec(raw);\n return match ? match[1] : '4945a3';\n}\n\nfunction MapThumbStrip({ apiKey, center, zoom, altText }: MapThumbStripProps) {\n // 640×192 keeps the asset under Google's 1MP free tier at scale=2\n // (1280×384 actual) and matches the strip's 12rem height at a\n // ~3.33:1 aspect ratio. Marker colour resolves from the kit's\n // `--map-marker-color` token at runtime so the value still lives\n // in `src/tokens/**` per the closed-palette constraint.\n const markerHex = getStaticMapMarkerHex();\n const src =\n `https://maps.googleapis.com/maps/api/staticmap` +\n `?center=${center.lat},${center.lng}` +\n `&zoom=${zoom}` +\n `&size=640x192&scale=2` +\n `&markers=color:0x${markerHex}%7C${center.lat},${center.lng}` +\n `&key=${encodeURIComponent(apiKey)}`;\n return (\n <img\n src={src}\n alt={altText}\n loading=\"lazy\"\n decoding=\"async\"\n width={640}\n height={192}\n className=\"ds:block ds:inline-size-full ds:block-size-[12rem] ds:[object-fit:cover] ds:rounded-[var(--radius-md)]\"\n />\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const ContactProfileCard = forwardRef<\n HTMLDivElement,\n ContactProfileCardProps\n>(\n (\n {\n heading,\n description,\n address,\n phone,\n whatsappNumber,\n whatsappMessage,\n email,\n website,\n languages,\n languageLabels,\n insurances,\n firstVisitPriceCents,\n currencyCode = 'EUR',\n profession,\n specializedInFearPatients,\n googleMapsApiKey,\n mapZoom = 14,\n onPhoneClick,\n onWhatsAppClick,\n onMapClick,\n onEmailClick,\n headerSlot,\n footerSlot,\n mapSlot,\n surface = 'elevated',\n 'aria-label': ariaLabel,\n id,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const headingId = useId();\n const locale = i18n.language ?? 'en';\n\n const resolvedHeading = heading ?? t('contactProfileCard.heading');\n const resolvedAriaLabel = ariaLabel ?? resolvedHeading;\n\n const formattedPrice = useMemo(() => {\n if (firstVisitPriceCents == null) return undefined;\n return formatPrice(firstVisitPriceCents, currencyCode, locale);\n }, [firstVisitPriceCents, currencyCode, locale]);\n\n // Compose the rows in display order. Each `row` carries the icon +\n // localised label + the rendered value. Skipping a field is just\n // omitting the row — `KeyValueList` collapses the subgrid cleanly.\n const rows: Array<{\n key: string;\n icon: ReactElement;\n label: string;\n value: ReactNode;\n }> = [];\n\n if (address) {\n rows.push({\n key: 'address',\n icon: <MapPin aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.address'),\n value: (\n <span className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <span>{address.line}</span>\n {address.lat != null && address.lng != null ? (\n <Link\n href={buildMapHref(address)}\n external\n intent=\"default\"\n onClick={onMapClick}\n >\n {t('contactProfileCard.openInGoogleMaps')}\n </Link>\n ) : null}\n </span>\n ),\n });\n }\n\n if (phone) {\n rows.push({\n key: 'phone',\n icon: <Phone aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.phone'),\n value: (\n <Link\n href={`tel:${normalisePhone(phone)}`}\n intent=\"default\"\n onClick={onPhoneClick}\n >\n {phone}\n </Link>\n ),\n });\n }\n\n if (whatsappNumber) {\n rows.push({\n key: 'whatsapp',\n icon: <MessageCircle aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.whatsapp'),\n value: (\n <Link\n href={buildWhatsAppHref(whatsappNumber, whatsappMessage)}\n external\n intent=\"default\"\n onClick={onWhatsAppClick}\n >\n {whatsappNumber}\n </Link>\n ),\n });\n }\n\n if (email) {\n rows.push({\n key: 'email',\n icon: <Mail aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.email'),\n value: (\n <Link\n href={`mailto:${email}`}\n intent=\"default\"\n onClick={onEmailClick}\n >\n {email}\n </Link>\n ),\n });\n }\n\n if (website) {\n rows.push({\n key: 'website',\n icon: <Globe aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.website'),\n value: (\n <Link href={website} external intent=\"default\">\n {website}\n </Link>\n ),\n });\n }\n\n if (languages && languages.length > 0) {\n // Resolution order, highest to lowest:\n // 1. consumer `languageLabels` override — for regional dialects,\n // brand-voice variants, or codes the kit doesn't ship.\n // 2. kit i18n bundle (`languages.<iso>`) — auto-resolves the 18\n // ISO codes the kit ships into the active locale's native\n // language name. Retires consumer-side ISO→label plumbing.\n // 3. uppercase fallback for unknown codes that the consumer\n // didn't override.\n const resolveLabel = (code: string): string => {\n if (languageLabels?.[code]) return languageLabels[code];\n const key = `languages.${code}`;\n if (i18n.exists(key)) return t(key);\n return code.toUpperCase();\n };\n rows.push({\n key: 'languages',\n icon: <LanguagesIcon aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.languages'),\n value: (\n <span className=\"ds:flex ds:flex-wrap ds:gap-[var(--spacing-2xs)]\">\n {languages.map((code) => (\n <Badge key={code} variant=\"neutral\">\n {resolveLabel(code)}\n </Badge>\n ))}\n </span>\n ),\n });\n }\n\n if (insurances && insurances.length > 0) {\n rows.push({\n key: 'insurances',\n icon: <ShieldCheck aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.insurances'),\n value: (\n <span className=\"ds:flex ds:flex-wrap ds:gap-[var(--spacing-2xs)]\">\n {insurances.map((ins) => (\n <Badge key={ins} variant=\"info\">\n {ins}\n </Badge>\n ))}\n </span>\n ),\n });\n }\n\n if (formattedPrice) {\n rows.push({\n key: 'firstVisitPrice',\n icon: <Banknote aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.firstVisitPrice'),\n value: formattedPrice,\n });\n }\n\n if (specializedInFearPatients) {\n rows.push({\n key: 'expertForAnxiousPatients',\n icon: <Heart aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.expertForAnxiousPatients'),\n value: t('contactProfileCard.value.yesShort'),\n });\n }\n\n if (profession) {\n rows.push({\n key: 'profession',\n icon: <Stethoscope aria-hidden=\"true\" />,\n label: t('contactProfileCard.label.profession'),\n value: profession,\n });\n }\n\n // Imperative handle for agent integrations.\n useAgentRegistration(\n contactProfileCardAgent,\n { getProfession: () => profession },\n id,\n );\n\n // Embedded static-map thumbnail. Renders only when the consumer\n // supplies BOTH a usable lat/lng pair AND a `googleMapsApiKey`.\n // The d.ts-promised behaviour; without a key the strip is silently\n // omitted and the address row's \"Open in Google Maps\" link still\n // emits as the spatial-cue fallback.\n const showMapThumb =\n !!googleMapsApiKey &&\n address?.lat !== undefined &&\n address?.lng !== undefined;\n const mapThumb = showMapThumb ? (\n <MapThumbStrip\n apiKey={googleMapsApiKey!}\n center={{ lat: address!.lat!, lng: address!.lng! }}\n zoom={mapZoom}\n altText={t('contactProfileCard.map.alt', {\n address: address!.line,\n defaultValue: 'Map showing {{address}}',\n })}\n />\n ) : null;\n\n // Map area: explicit consumer slot wins over the implicit\n // googleMapsApiKey-driven static thumbnail. 0.33.4 introduces the\n // slot so consumers can embed an interactive <MapView> /\n // <PracticeMap> wrapper inside the card chrome instead of the\n // fixed static <img>. When neither is set the area renders as\n // nothing. 0.33.6 moves the area from above the heading to below\n // the data rows — the map reads as the spatial closer (\"here it\n // is on the map\") rather than a stylised hero, and any CTA in\n // footerSlot still lands at the very bottom.\n const mapArea = mapSlot ?? mapThumb;\n\n const body = (\n <>\n {description ? (\n <p className=\"type-body-sm ds:m-0 ds:whitespace-pre-line\">\n {description}\n </p>\n ) : null}\n {rows.length > 0 ? (\n <KeyValueList rowGap=\"md\">\n {rows.map((row) => (\n <KeyValuePair\n key={row.key}\n icon={row.icon}\n label={row.label}\n value={row.value}\n />\n ))}\n </KeyValueList>\n ) : null}\n {mapArea}\n {footerSlot}\n </>\n );\n\n // `surface=\"flat\"` skips the Card wrapper — the consumer is\n // already inside a Card / Sheet and doesn't want a double border.\n const inner = (\n <>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {headerSlot}\n <h2\n id={headingId}\n className=\"type-title-card ds:m-0 ds:text-[color:var(--foreground)]\"\n >\n {resolvedHeading}\n </h2>\n </div>\n {body}\n </>\n );\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={resolvedAriaLabel}\n aria-labelledby={headingId}\n data-component=\"contact-profile-card\"\n data-component-id={id}\n id={id}\n className={rootVariants({ surface, className })}\n {...rest}\n >\n {surface === 'elevated' ? (\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {inner}\n </Card.Body>\n </Card>\n ) : (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {inner}\n </div>\n )}\n </div>\n );\n },\n);\n\nContactProfileCard.displayName = 'ContactProfileCard';\n\n// Helper export so consumers can mirror the kit's row order if they\n// need to compose a partial alternative (rare).\nexport const CONTACT_PROFILE_CARD_ROW_KEYS = [\n 'address',\n 'phone',\n 'whatsapp',\n 'email',\n 'website',\n 'languages',\n 'insurances',\n 'firstVisitPrice',\n 'expertForAnxiousPatients',\n 'profession',\n] as const;\n\n// Defensive icon export so consumers can render the same glyph\n// outside the card if they need it for consistency.\nexport const CONTACT_PROFILE_CARD_ROW_ICONS: Record<\n (typeof CONTACT_PROFILE_CARD_ROW_KEYS)[number],\n LucideIcon\n> = {\n address: MapPin,\n phone: Phone,\n whatsapp: MessageCircle,\n email: Mail,\n website: Globe,\n languages: LanguagesIcon,\n insurances: ShieldCheck,\n firstVisitPrice: Banknote,\n expertForAnxiousPatients: Heart,\n profession: Stethoscope,\n};\n\n// Re-exports of the rootVariants type for downstream typing.\nexport type ContactProfileCardSurface = NonNullable<\n VariantProps<typeof rootVariants>['surface']\n>;\n\n// ExternalLink is exported by lucide-react and used elsewhere in the\n// kit; re-exporting here so consumers don't have to add it as a\n// peer-dep import for icon parity in their own UIs.\nexport { ExternalLink };\n"],"names":["__iconNode","Banknote","createLucideIcon","contactProfileCardAgent","handle","rootVariants","cva","normalisePhone","raw","buildWhatsAppHref","number","message","base","buildMapHref","address","formatPrice","cents","currency","locale","getStaticMapMarkerHex","match","MapThumbStrip","apiKey","center","zoom","altText","markerHex","src","jsx","ContactProfileCard","forwardRef","heading","description","phone","whatsappNumber","whatsappMessage","email","website","languages","languageLabels","insurances","firstVisitPriceCents","currencyCode","profession","specializedInFearPatients","googleMapsApiKey","mapZoom","onPhoneClick","onWhatsAppClick","onMapClick","onEmailClick","headerSlot","footerSlot","mapSlot","surface","ariaLabel","id","className","rest","ref","t","i18n","useTranslation","headingId","useId","resolvedHeading","resolvedAriaLabel","formattedPrice","useMemo","rows","MapPin","jsxs","Link","Phone","MessageCircle","Mail","Globe","resolveLabel","code","key","LanguagesIcon","Badge","ShieldCheck","ins","Heart","Stethoscope","useAgentRegistration","mapThumb","mapArea","body","Fragment","KeyValueList","row","KeyValuePair","inner","Card","CONTACT_PROFILE_CARD_ROW_KEYS","CONTACT_PROFILE_CARD_ROW_ICONS"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,OAAO,MAAM,QAAQ,MAAM,GAAG,KAAK,GAAG,KAAK,IAAI,KAAK,KAAK,SAAQ,CAAE;AAAA,EAC9E,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,KAAK,KAAK,UAAU;AAAA,EACxD,CAAC,QAAQ,EAAE,GAAG,uBAAuB,KAAK,SAAQ,CAAE;AACtD,GACMC,IAAWC,GAAiB,YAAYF,EAAU,GCF3CG,KAAkE;AAAA,EAC7E,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,cAAA;AAAA,IAAc;AAAA,EACzC;AAAA,EAEF,SAAS,CAAA;AAAA,EACT,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GCoBMC,KAAeC;AAAA,EACnB;AAAA,EACA;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,MAKR,SAAS;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IAEF,iBAAiB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B;AAAA,EACT,OAAOG;AAAA,EACP,UAAUC;AAAA,EACV,OAAOC;AAAA,EACP,SAASC;AAAA,EACT,WAAWI;AAAAA,EACX,YAAYE;AAAA,EACZ,iBAAiBjF;AAAA,EACjB,0BAA0BmF;AAAA,EAC1B,YAAYC;AACd;","x_google_ignoreList":[0]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"icon-button-group-D6SVMteH.js","sources":["../../src/components/icon-button-group/icon-button-group.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Ellipsis } from 'lucide-react';\nimport { IconButton, type IconButtonProps } from '../button/icon-button';\nimport type { ButtonProps } from '../button/button';\nimport { DropdownMenu } from '../dropdown-menu';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { usePriorityOverflow } from '../../hooks/use-priority-overflow';\n\ntype ButtonIntent = NonNullable<ButtonProps['intent']>;\n\n// Intentionally does NOT compose `@radix-ui/react-toggle-group`. Radix\n// ToggleGroup's render shape makes it hard to layer shared-border chrome\n// across children (first-child / last-child / internal-divider CSS), and\n// the three-mode + three-role matrix (group / toolbar / radiogroup × momentary\n// / toggle-single / toggle-multi) is broader than Radix's single / multi\n// contract. The roving-tabindex implementation below mirrors Radix's pattern\n// so keyboard semantics stay consistent. See 05-accessibility.mdx for the\n// WAI-ARIA toolbar / radiogroup references.\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst iconButtonGroupVariants = cva(\n [\n 'ds:inline-flex ds:isolate',\n // Hairline border around the group unifies the children into one\n // visual unit. Internal child dividers are drawn via the per-child\n // class list below.\n 'ds:border ds:border-border',\n 'ds:rounded-[var(--radius-md)]',\n // Ensure the focus ring of a pressed child sits above its siblings.\n 'ds:[&>*]:relative ds:[&>*:focus-visible]:z-10',\n ].join(' '),\n {\n variants: {\n orientation: {\n horizontal: [\n 'ds:flex-row',\n // Flatten internal corners on children so the outer radius owns\n // the rounded edges.\n 'ds:[&>*:not(:first-child)]:rounded-s-none',\n 'ds:[&>*:not(:last-child)]:rounded-e-none',\n // Internal divider — logical so it flips in RTL.\n 'ds:[&>*:not(:first-child)]:border-s',\n 'ds:[&>*:not(:first-child)]:border-border',\n // The children already own an outer border (from IconButton's\n // own border in secondary/outline variants). Collapse the doubled\n // border so we don't get a 2px seam.\n 'ds:[&>*]:border-0',\n ].join(' '),\n vertical: [\n 'ds:flex-col',\n // Vertical groups flow block-wise. Reading direction doesn't\n // invert vertical stacks in any locale this DS targets, so the\n // physical `rounded-t/b` is intentional.\n 'ds:[&>*:not(:first-child)]:rounded-t-none',\n 'ds:[&>*:not(:last-child)]:rounded-b-none',\n 'ds:[&>*:not(:first-child)]:border-t',\n 'ds:[&>*:not(:first-child)]:border-border',\n 'ds:[&>*]:border-0',\n ].join(' '),\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n },\n);\n\n// Hidden measurement rows: laid out (so widths are real) but invisible,\n// non-interactive and out of the a11y tree. Never display:none.\nconst MEASURE_ROW_CLASSES =\n 'ds:absolute ds:start-0 ds:top-0 ds:invisible ds:pointer-events-none';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type IconButtonGroupRole = 'group' | 'toolbar' | 'radiogroup';\nexport type IconButtonGroupMode =\n | 'momentary'\n | 'toggle-single'\n | 'toggle-multi';\n\ntype SharedPropsBase = {\n /** Forwarded to every child that does not set its own `size`. */\n size?: 'sm' | 'md' | 'lg';\n orientation?: 'horizontal' | 'vertical';\n /** Disables every child. Uses `aria-disabled` on children (not the HTML\n * attribute) so each child still takes focus — matches WAI-ARIA toolbar\n * guidance. Visual disabled styling picks up the `aria-disabled:*`\n * variant declared on the Button base class. */\n disabled?: boolean;\n /** Intent applied to every child that does not set its own `intent`.\n * Defaults to `outline` — grouped icon buttons are peers, not a row\n * of solid-primary CTAs. */\n intent?: ButtonIntent;\n /** `'menu'` keeps the strip on one line whatever the container width:\n * children that stop fitting move into a dropdown behind an ellipsis\n * trigger, preserving toggle semantics (radio / checkbox items). The\n * group then fills its container's inline size. Horizontal only.\n * Children set `data-overflow-pin` to always stay in the strip. */\n overflow?: 'none' | 'menu';\n children: ReactNode;\n};\n\n// At least one of `aria-label` / `aria-labelledby` must be present. This\n// discriminated pair makes the TypeScript compiler reject a group with\n// neither — see the a11y acceptance criteria in the user story.\ntype AccessibleNameProps =\n | { 'aria-label': string; 'aria-labelledby'?: never }\n | { 'aria-label'?: never; 'aria-labelledby': string };\n\ntype SharedProps = SharedPropsBase & AccessibleNameProps;\n\n// Role + mode combinations are not all valid. Encoded via a discriminated\n// union so the compiler rejects nonsensical pairings (e.g. a multi-select\n// radiogroup).\ntype GroupRoleProps =\n | { role?: 'group'; mode?: 'momentary' | 'toggle-single' | 'toggle-multi' }\n | { role: 'toolbar'; mode?: 'momentary' | 'toggle-single' | 'toggle-multi' }\n | { role: 'radiogroup'; mode: 'toggle-single' };\n\ntype MomentaryProps = SharedProps & {\n mode?: 'momentary';\n value?: never;\n defaultValue?: never;\n onValueChange?: never;\n};\n\ntype ToggleSingleProps = SharedProps & {\n mode: 'toggle-single';\n value?: string;\n defaultValue?: string;\n onValueChange?: (next: string) => void;\n};\n\ntype ToggleMultiProps = SharedProps & {\n mode: 'toggle-multi';\n value?: string[];\n defaultValue?: string[];\n onValueChange?: (next: string[]) => void;\n};\n\nexport type IconButtonGroupProps = (\n | MomentaryProps\n | ToggleSingleProps\n | ToggleMultiProps\n) &\n GroupRoleProps &\n Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'onChange' | 'children'> &\n VariantProps<typeof iconButtonGroupVariants>;\n\n/* ------------------------------------------------------------------ */\n/* IconButtonGroup */\n/* ------------------------------------------------------------------ */\n\nexport const IconButtonGroup = forwardRef<HTMLDivElement, IconButtonGroupProps>(\n (props, ref) => {\n const {\n size,\n orientation = 'horizontal',\n role = 'group',\n mode = 'momentary',\n disabled = false,\n intent = 'outline',\n overflow = 'none',\n className,\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n // Controlled-value props are consumed via `props as …` below; strip them\n // here so they never spread onto the root <div> (React would warn that\n // `onValueChange` is an unknown DOM event handler).\n value: _value,\n defaultValue: _defaultValue,\n onValueChange: _onValueChange,\n ...rest\n } = props as IconButtonGroupProps & { className?: string };\n const { t } = useTranslation();\n\n if (import.meta.env.DEV && !ariaLabel && !ariaLabelledBy) {\n console.warn(\n 'IconButtonGroup: `aria-label` or `aria-labelledby` is required for accessibility.',\n );\n }\n if (\n import.meta.env.DEV &&\n overflow === 'menu' &&\n orientation === 'vertical'\n ) {\n console.warn(\n 'IconButtonGroup: overflow=\"menu\" is horizontal-only; falling back to overflow=\"none\".',\n );\n }\n const overflowEnabled = overflow === 'menu' && orientation !== 'vertical';\n\n /* ---- Controlled / uncontrolled value for toggle modes --------- */\n const [internalValue, setInternalValue] = useState<string | string[]>(\n () => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n return p.defaultValue ?? '';\n }\n if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n return p.defaultValue ?? [];\n }\n return '';\n },\n );\n\n const resolvedValue: string | string[] = (() => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n return p.value !== undefined ? p.value : internalValue;\n }\n if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n return p.value !== undefined ? p.value : internalValue;\n }\n return '';\n })();\n\n const commitValue = useCallback(\n (next: string | string[]) => {\n if (mode === 'toggle-single') {\n const p = props as ToggleSingleProps;\n if (p.value === undefined) setInternalValue(next as string);\n p.onValueChange?.(next as string);\n } else if (mode === 'toggle-multi') {\n const p = props as ToggleMultiProps;\n if (p.value === undefined) setInternalValue(next as string[]);\n p.onValueChange?.(next as string[]);\n }\n },\n [mode, props],\n );\n\n /* ---- Roving tabindex state — only active in toolbar / radiogroup - */\n const rovingTabindex = role === 'toolbar' || role === 'radiogroup';\n const buttonsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const [focusIndex, setFocusIndex] = useState(0);\n\n const registerIndex = useCallback(\n (index: number, el: HTMLButtonElement | null) => {\n buttonsRef.current[index] = el;\n },\n [],\n );\n\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [isRTL, setIsRTL] = useState(false);\n // `useLayoutEffect` so the direction is correct BEFORE the first paint\n // (otherwise a user pressing an arrow key on the first frame after mount\n // would hit the default-LTR mapping even in an RTL document).\n useIsomorphicLayoutEffect(() => {\n if (typeof window === 'undefined') return;\n const node = rootRef.current;\n if (!node) return;\n // Read the computed direction from the group's own wrapper so a\n // scoped `dir='rtl'` on any ancestor (not just <html>) flips arrow\n // navigation. `getComputedStyle` walks up automatically.\n const dir = window.getComputedStyle(node).direction;\n setIsRTL(dir === 'rtl');\n }, []);\n\n /* ---- Arrow-key navigation for roving tabindex ----------------- */\n const handleRootKeyDown = useCallback(\n (event: ReactKeyboardEvent<HTMLDivElement>) => {\n if (!rovingTabindex) return;\n const count = buttonsRef.current.filter(Boolean).length;\n if (count === 0) return;\n\n const forwardKey =\n orientation === 'vertical'\n ? 'ArrowDown'\n : isRTL\n ? 'ArrowLeft'\n : 'ArrowRight';\n const backwardKey =\n orientation === 'vertical'\n ? 'ArrowUp'\n : isRTL\n ? 'ArrowRight'\n : 'ArrowLeft';\n\n let next: number | null = null;\n if (event.key === forwardKey) next = (focusIndex + 1) % count;\n else if (event.key === backwardKey)\n next = (focusIndex - 1 + count) % count;\n else if (event.key === 'Home') next = 0;\n else if (event.key === 'End') next = count - 1;\n\n if (next === null) return;\n // Skip over disabled children.\n const maxAttempts = count;\n let attempts = 0;\n let candidate = next;\n while (attempts < maxAttempts) {\n const el = buttonsRef.current[candidate];\n if (\n el &&\n el.getAttribute('aria-disabled') !== 'true' &&\n !el.disabled\n ) {\n break;\n }\n candidate =\n event.key === backwardKey || event.key === 'End'\n ? (candidate - 1 + count) % count\n : (candidate + 1) % count;\n attempts += 1;\n }\n event.preventDefault();\n setFocusIndex(candidate);\n buttonsRef.current[candidate]?.focus();\n // WAI-ARIA radiogroup pattern: arrow keys MOVE focus AND CHANGE\n // the selected radio in one action. toolbar pattern (and plain\n // group) only moves focus.\n if (role === 'radiogroup' && mode === 'toggle-single') {\n const child = childArrayRef.current[candidate];\n if (child && typeof child === 'object' && 'props' in child) {\n const cValue = (child as ReactElement<{ value?: string }>).props\n .value;\n // Same guard as the click path: re-committing the already\n // selected value is a no-op, so Home/End on the selected radio\n // never fires a spurious onValueChange.\n if (cValue && cValue !== resolvedValue) commitValue(cValue);\n }\n }\n },\n [\n rovingTabindex,\n orientation,\n isRTL,\n focusIndex,\n role,\n mode,\n commitValue,\n resolvedValue,\n ],\n );\n\n /* ---- Overflow bookkeeping (menu mode only) --------------------- */\n type OverflowChildProps = IconButtonProps & {\n value?: string;\n 'data-overflow-pin'?: boolean | 'true' | '';\n };\n const allElements = overflowEnabled\n ? (Children.toArray(children).filter(isValidElement) as Array<\n ReactElement<OverflowChildProps>\n >)\n : [];\n const mirrorLabel = (child: ReactElement<OverflowChildProps>) => {\n const aria = child.props['aria-label'];\n if (typeof aria === 'string') return aria;\n return typeof child.props.tooltip === 'string'\n ? child.props.tooltip\n : null;\n };\n const warnedRef = useRef(false);\n const pinnedFlags = allElements.map((child) => {\n const explicit = child.props['data-overflow-pin'] !== undefined;\n const mirrorable = mirrorLabel(child) !== null;\n if (\n import.meta.env.DEV &&\n !explicit &&\n !mirrorable &&\n !warnedRef.current\n ) {\n warnedRef.current = true;\n console.warn(\n 'IconButtonGroup: a child without aria-label / tooltip cannot move into the overflow menu — it stays pinned in the strip.',\n );\n }\n return explicit || !mirrorable;\n });\n\n const { containerRef, fullRowRef, triggerProbeRef, visible, overflowing } =\n usePriorityOverflow({\n enabled: overflowEnabled,\n count: allElements.length,\n pinned: pinnedFlags,\n });\n\n const triggerNodeRef = useRef<HTMLButtonElement | null>(null);\n\n /* ---- Build enhanced children ---------------------------------- */\n const childArray = overflowEnabled\n ? allElements.filter((_, i) => visible[i])\n : Children.toArray(children);\n if (overflowEnabled) {\n buttonsRef.current.length = childArray.length + (overflowing ? 1 : 0);\n }\n // Mirror into a ref so the keydown handler (referenced from Memo deps)\n // can read the latest child list without inflating the dep array.\n const childArrayRef = useRef<ReturnType<typeof Children.toArray>>([]);\n childArrayRef.current = childArray;\n\n // APG radiogroup pattern: Tab must land on the CHECKED radio, not the\n // first one. Keep the roving tab stop pinned to the selected child —\n // covers initial mount (checked child not first) and controlled value\n // changes. Arrow/click interactions already align focusIndex with the\n // selection, so this effect is a no-op for them.\n const checkedIndex =\n role === 'radiogroup' && mode === 'toggle-single'\n ? childArray.findIndex(\n (child) =>\n isValidElement(child) &&\n (child as ReactElement<{ value?: string }>).props.value ===\n resolvedValue,\n )\n : -1;\n useEffect(() => {\n if (checkedIndex >= 0) setFocusIndex(checkedIndex);\n }, [checkedIndex]);\n\n const visibleCount = childArray.length;\n // Clamp the roving focus when items move into the menu; hand real focus\n // to the trigger only when the focused node was the one that left.\n useEffect(() => {\n if (!rovingTabindex || !overflowEnabled) return;\n const total = visibleCount + (overflowing ? 1 : 0);\n if (total > 0 && focusIndex >= total) {\n setFocusIndex(total - 1);\n if (document.activeElement === document.body) {\n triggerNodeRef.current?.focus();\n }\n }\n }, [\n rovingTabindex,\n overflowEnabled,\n visibleCount,\n overflowing,\n focusIndex,\n ]);\n\n const enhanced = childArray.map((child, index) => {\n if (!isValidElement(child)) {\n if (import.meta.env.DEV) {\n console.warn(\n 'IconButtonGroup: children should be <IconButton> elements.',\n );\n }\n return child;\n }\n\n const childEl = child as ReactElement<\n IconButtonProps & {\n value?: string;\n asChild?: boolean;\n children?: ReactNode;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n }\n >;\n\n // DEV-time sanity: warn if we got something that isn't an IconButton.\n // `React.cloneElement` would still work, but IconButton-specific\n // props (::before target size, forwarded tooltip) wouldn't apply.\n // `asChild` wrappers (e.g. DropdownMenu.Trigger) are fine when they\n // Slot-merge the cloned props onto their own IconButton child, as are\n // components that declare a static `rendersIconButton` marker (the\n // DataTable toolbar leaves — each renders one IconButton trigger and\n // forwards ref/tabIndex/onFocus to it).\n if (import.meta.env.DEV && childEl.type !== IconButton) {\n const slotChild =\n childEl.props.asChild === true ? childEl.props.children : null;\n const wrapsIconButton =\n isValidElement(slotChild) && slotChild.type === IconButton;\n const rendersIconButton =\n (childEl.type as { rendersIconButton?: boolean })\n .rendersIconButton === true;\n if (!wrapsIconButton && !rendersIconButton) {\n console.warn(\n 'IconButtonGroup: each child should be a DS <IconButton>. Other elements break target-size + focus-ring contracts.',\n );\n }\n }\n\n const childValue = childEl.props.value;\n\n // Compute aria-pressed / aria-checked for toggle modes.\n const { ariaPressed, ariaChecked } = computeToggleAria(\n mode,\n role,\n childValue,\n resolvedValue,\n );\n\n const groupDisabled = disabled === true;\n const childDisabled = childEl.props.disabled === true;\n\n // Click handling — wrap so aria-disabled (group-level) blocks\n // activation, then forward to the child's own onClick.\n const wrappedOnClick: React.MouseEventHandler<HTMLButtonElement> = (\n event,\n ) => {\n // aria-disabled is advisory; the native click still fires. Block\n // it explicitly when the GROUP (not the child) is disabled.\n if (groupDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n // Forward to the child's own handler first so consumers can run\n // analytics / preventDefault.\n childEl.props.onClick?.(event);\n if (event.defaultPrevented) return;\n if (!childValue) return;\n if (mode === 'toggle-single') {\n // Contract: exactly one pressed. Clicking the pressed one is a\n // no-op. This matches Radix ToggleGroup type='single' and the\n // radiogroup pattern.\n if (resolvedValue === childValue) return;\n commitValue(childValue);\n } else if (mode === 'toggle-multi') {\n const list = resolvedValue as string[];\n const next = list.includes(childValue)\n ? list.filter((v) => v !== childValue)\n : [...list, childValue];\n commitValue(next);\n }\n };\n\n // cloneElement's typed overload rejects `ref` as a prop, so we\n // build the override bag as `unknown` and cast to the element's\n // prop type. React at runtime routes `ref` via its usual channel.\n const setMergedRef = (node: HTMLButtonElement | null) => {\n registerIndex(index, node);\n const originalRef = (\n childEl as unknown as { ref?: React.Ref<HTMLButtonElement> }\n ).ref;\n if (typeof originalRef === 'function') originalRef(node);\n else if (\n originalRef !== null &&\n originalRef !== undefined &&\n typeof originalRef === 'object'\n ) {\n (\n originalRef as React.MutableRefObject<HTMLButtonElement | null>\n ).current = node;\n }\n };\n\n // Per the user story: group-level disabled injects `aria-disabled`\n // so the child stays focusable; child-level `disabled` still uses\n // the HTML attribute (child's own contract). When both are true\n // we leave the HTML disabled in place (strictest cue wins).\n const ariaDisabled = groupDisabled && !childDisabled ? true : undefined;\n\n // If the group is disabled OR we are in a toggle mode, we need the\n // wrapped click handler. In pure momentary mode with no group\n // disable, the child's own onClick is passed through unchanged.\n const needsWrappedClick = mode !== 'momentary' || groupDisabled;\n\n const overrides = {\n intent: childEl.props.intent ?? intent,\n size: childEl.props.size ?? size,\n disabled: childDisabled,\n 'aria-disabled': ariaDisabled,\n onClick: needsWrappedClick ? wrappedOnClick : childEl.props.onClick,\n 'aria-pressed': ariaPressed,\n 'aria-checked': ariaChecked,\n // When the group is a radiogroup, children must be `role=\"radio\"`\n // so screen readers announce them as radio buttons and so\n // `getByRole('radio')` works in tests. The button element is\n // re-purposed as a radio; `aria-checked` above carries the state.\n role: role === 'radiogroup' ? 'radio' : undefined,\n tabIndex: rovingTabindex ? (index === focusIndex ? 0 : -1) : undefined,\n onFocus: (ev: React.FocusEvent<HTMLButtonElement>) => {\n if (rovingTabindex) setFocusIndex(index);\n childEl.props.onFocus?.(ev);\n },\n ref: setMergedRef,\n } as unknown as Partial<IconButtonProps>;\n\n return cloneElement(childEl, overrides);\n });\n\n const mergedRootRef = (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref && typeof ref === 'object') {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n };\n\n if (!overflowEnabled) {\n return (\n <div\n ref={mergedRootRef}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-orientation={role === 'toolbar' ? orientation : undefined}\n onKeyDown={handleRootKeyDown}\n className={iconButtonGroupVariants({ orientation, className })}\n data-component=\"icon-button-group\"\n {...rest}\n >\n {enhanced}\n </div>\n );\n }\n\n /* ---- Menu path: measurement rows + strip + ellipsis trigger ---- */\n const moreLabel = t('buttonGroup.more', 'More options');\n const groupDisabled = disabled === true;\n const overflowItems = allElements\n .map((childEl, i) => ({ childEl, i }))\n .filter(({ i }) => !visible[i]);\n\n let menuContent: ReactNode = null;\n if (mode === 'toggle-single') {\n menuContent = (\n <DropdownMenu.RadioGroup\n value={resolvedValue as string}\n onValueChange={(v) => {\n if (!groupDisabled && v !== resolvedValue) commitValue(v);\n }}\n >\n {overflowItems.map(({ childEl, i }) => (\n <DropdownMenu.RadioItem\n key={childEl.key ?? i}\n value={childEl.props.value ?? ''}\n disabled={groupDisabled || childEl.props.disabled === true}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.RadioItem>\n ))}\n </DropdownMenu.RadioGroup>\n );\n } else if (mode === 'toggle-multi') {\n menuContent = overflowItems.map(({ childEl, i }) => {\n const v = childEl.props.value;\n const list = resolvedValue as string[];\n const checked = v ? list.includes(v) : false;\n return (\n <DropdownMenu.CheckboxItem\n key={childEl.key ?? i}\n checked={checked}\n disabled={groupDisabled || childEl.props.disabled === true}\n onCheckedChange={() => {\n if (groupDisabled || !v) return;\n commitValue(checked ? list.filter((x) => x !== v) : [...list, v]);\n }}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.CheckboxItem>\n );\n });\n } else {\n menuContent = overflowItems.map(({ childEl, i }) => (\n <DropdownMenu.Item\n key={childEl.key ?? i}\n startIcon={childEl.props.icon}\n disabled={groupDisabled || childEl.props.disabled === true}\n onSelect={(event) => {\n childEl.props.onClick?.(\n event as unknown as React.MouseEvent<HTMLButtonElement>,\n );\n }}\n >\n {mirrorLabel(childEl)}\n </DropdownMenu.Item>\n ));\n }\n\n const trigger = overflowing ? (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <IconButton\n icon={<Ellipsis />}\n intent={intent}\n size={size}\n aria-label={moreLabel}\n ref={(node: HTMLButtonElement | null) => {\n triggerNodeRef.current = node;\n registerIndex(visibleCount, node);\n }}\n tabIndex={\n rovingTabindex\n ? focusIndex === visibleCount\n ? 0\n : -1\n : undefined\n }\n onFocus={\n rovingTabindex ? () => setFocusIndex(visibleCount) : undefined\n }\n />\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"end\">{menuContent}</DropdownMenu.Content>\n </DropdownMenu.Root>\n ) : null;\n\n const stripClasses = iconButtonGroupVariants({ orientation });\n // A radiogroup may own only radios, so its trigger sits beside the strip;\n // toolbar / group keep the trigger inside as the last joined control.\n const triggerInside = role !== 'radiogroup';\n const stripDiv = (\n <div\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-orientation={role === 'toolbar' ? orientation : undefined}\n onKeyDown={triggerInside ? handleRootKeyDown : undefined}\n className={`${stripClasses} ds:max-w-full`}\n >\n {enhanced}\n {triggerInside ? trigger : null}\n </div>\n );\n\n return (\n <div\n ref={mergedRootRef}\n data-component=\"icon-button-group\"\n className={[\n 'ds:relative ds:block ds:w-full ds:min-w-0 ds:overflow-x-clip',\n className ?? '',\n ]\n .join(' ')\n .trim()}\n {...rest}\n >\n <div ref={containerRef} className=\"ds:block ds:w-full ds:min-w-0\">\n <div\n ref={fullRowRef}\n aria-hidden=\"true\"\n inert\n className={`${MEASURE_ROW_CLASSES} ${stripClasses}`}\n >\n {allElements.map((childEl, i) =>\n cloneElement(childEl, {\n key: childEl.key ?? i,\n intent: childEl.props.intent ?? intent,\n size: childEl.props.size ?? size,\n tabIndex: -1,\n ref: null,\n } as Partial<OverflowChildProps>),\n )}\n </div>\n <span\n ref={triggerProbeRef}\n aria-hidden=\"true\"\n inert\n className={MEASURE_ROW_CLASSES}\n >\n <IconButton\n icon={<Ellipsis />}\n intent={intent}\n size={size}\n aria-label={moreLabel}\n tabIndex={-1}\n />\n </span>\n {triggerInside ? (\n stripDiv\n ) : (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- non-focusable wrapper; arrow-key roving bubbles up from the focusable IconButtons in the strip and the overflow trigger\n <div\n className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\"\n onKeyDown={handleRootKeyDown}\n >\n {stripDiv}\n {trigger}\n </div>\n )}\n </div>\n </div>\n );\n },\n);\n\nIconButtonGroup.displayName = 'IconButtonGroup';\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction computeToggleAria(\n mode: IconButtonGroupMode,\n role: IconButtonGroupRole,\n childValue: string | undefined,\n resolvedValue: string | string[],\n): { ariaPressed?: boolean; ariaChecked?: boolean } {\n if (mode === 'momentary' || !childValue) return {};\n\n const isActive =\n mode === 'toggle-multi'\n ? (resolvedValue as string[]).includes(childValue)\n : resolvedValue === childValue;\n\n // radiogroup uses aria-checked; toolbar/group use aria-pressed.\n if (role === 'radiogroup') {\n return { ariaChecked: isActive };\n }\n return { ariaPressed: isActive };\n}\n"],"names":["iconButtonGroupVariants","cva","MEASURE_ROW_CLASSES","IconButtonGroup","forwardRef","props","ref","size","orientation","role","mode","disabled","intent","overflow","className","children","ariaLabel","ariaLabelledBy","_value","_defaultValue","_onValueChange","rest","t","useTranslation","overflowEnabled","internalValue","setInternalValue","useState","resolvedValue","p","commitValue","useCallback","next","_a","_b","rovingTabindex","buttonsRef","useRef","focusIndex","setFocusIndex","registerIndex","index","el","rootRef","isRTL","setIsRTL","useIsomorphicLayoutEffect","node","dir","handleRootKeyDown","event","count","forwardKey","backwardKey","maxAttempts","attempts","candidate","child","childArrayRef","cValue","allElements","Children","isValidElement","mirrorLabel","aria","pinnedFlags","explicit","mirrorable","containerRef","fullRowRef","triggerProbeRef","visible","overflowing","usePriorityOverflow","triggerNodeRef","childArray","_","i","checkedIndex","useEffect","visibleCount","total","enhanced","childEl","childValue","ariaPressed","ariaChecked","computeToggleAria","groupDisabled","childDisabled","wrappedOnClick","list","v","setMergedRef","originalRef","ariaDisabled","needsWrappedClick","overrides","ev","cloneElement","mergedRootRef","jsx","moreLabel","overflowItems","menuContent","DropdownMenu","checked","x","trigger","jsxs","IconButton","Ellipsis","stripClasses","triggerInside","stripDiv","isActive"],"mappings":";;;;;;;;;AAsCA,MAAMA,KAA0BC;AAAA,EAC9B;AAAA,IACE;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,aAAa;AAAA,QACX,YAAY;AAAA,UACV;AAAA;AAAA;AAAA,UAGA;AAAA,UACA;AAAA;AAAA,UAEA;AAAA,UACA;AAAA;AAAA;AAAA;AAAA,UAIA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QACV,UAAU;AAAA,UACR;AAAA;AAAA;AAAA;AAAA,UAIA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,MAAA;AAAA,IACZ;AAAA,IAEF,iBAAiB;AAAA,MACf,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GAIMC,KACJ,uEAqFWC,KAAkBC;AAAA,EAC7B,CAACC,GAAOC,MAAQ;AACd,UAAM;AAAA,MACJ,MAAAC;AAAA,MACA,aAAAC,IAAc;AAAA,MACd,MAAAC,IAAO;AAAA,MACP,MAAAC,IAAO;AAAA,MACP,UAAAC,IAAW;AAAA,MACX,QAAAC,IAAS;AAAA,MACT,UAAAC,KAAW;AAAA,MACX,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,cAAcC;AAAA,MACd,mBAAmBC;AAAA;AAAA;AAAA;AAA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kBAC5B,UAAU;AAAA,kBACV,KAAK;AAAA,gBAAA,CACyB;AAAA,cAAA;AAAA,YAClC;AAAA,UAAA;AAAA,UAEF,gBAAA8F;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK/B;AAAA,cACL,eAAY;AAAA,cACZ,OAAK;AAAA,cACL,WAAWpE;AAAA,cAEX,UAAA,gBAAAmG;AAAA,gBAACS;AAAA,gBAAA;AAAA,kBACC,wBAAOC,IAAA,EAAS;AAAA,kBAChB,QAAAnG;AAAA,kBACA,MAAAL;AAAA,kBACA,cAAY+F;AAAA,kBACZ,UAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACZ;AAAA,UAAA;AAAA,UAEDW,IACCC;AAAA;AAAA,YAGA,gBAAAL;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,WAAW5D;AAAA,gBAEV,UAAA;AAAA,kBAAAiE;AAAA,kBACAN;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA;AAAA,QACH,GAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAzG,GAAgB,cAAc;AAM9B,SAASoF,GACP7E,GACAD,GACA2E,GACAxD,GACkD;AAClD,MAAIlB,MAAS,eAAe,CAAC0E,UAAmB,CAAA;AAEhD,QAAM+B,IACJzG,MAAS,iBACJkB,EAA2B,SAASwD,CAAU,IAC/CxD,MAAkBwD;AAGxB,SAAI3E,MAAS,eACJ,EAAE,aAAa0G,EAAA,IAEjB,EAAE,aAAaA,EAAA;AACxB;"}
@@ -1,19 +0,0 @@
1
- import { c as e } from "./createLucideIcon-DhHxpK9K.js";
2
- /**
3
- * @license lucide-react v1.22.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */
8
- const a = [
9
- ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
10
- ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
11
- ["path", { d: "M2 5h12", key: "or177f" }],
12
- ["path", { d: "M7 2h1", key: "1t2jsx" }],
13
- ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
14
- ["path", { d: "M14 18h6", key: "1m8k6r" }]
15
- ], d = e("languages", a);
16
- export {
17
- d as L
18
- };
19
- //# sourceMappingURL=languages-CGLX6Qpe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"languages-CGLX6Qpe.js","sources":["../../node_modules/lucide-react/dist/esm/icons/languages.mjs"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"m5 8 6 6\", key: \"1wu5hv\" }],\n [\"path\", { d: \"m4 14 6-6 2-3\", key: \"1k1g8d\" }],\n [\"path\", { d: \"M2 5h12\", key: \"or177f\" }],\n [\"path\", { d: \"M7 2h1\", key: \"1t2jsx\" }],\n [\"path\", { d: \"m22 22-5-10-5 10\", key: \"don7ne\" }],\n [\"path\", { d: \"M14 18h6\", key: \"1m8k6r\" }]\n];\nconst Languages = createLucideIcon(\"languages\", __iconNode);\n\nexport { __iconNode, Languages as default };\n//# sourceMappingURL=languages.mjs.map\n"],"names":["__iconNode","Languages","createLucideIcon"],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,iBAAiB,KAAK,SAAQ,CAAE;AAAA,EAC9C,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,UAAU,KAAK,SAAQ,CAAE;AAAA,EACvC,CAAC,QAAQ,EAAE,GAAG,oBAAoB,KAAK,SAAQ,CAAE;AAAA,EACjD,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAC3C,GACMC,IAAYC,EAAiB,aAAaF,CAAU;","x_google_ignoreList":[0]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"link-cell-renderer-Cp2MSlJl.js","sources":["../../src/components/data-table/filters/date-range-filter.tsx","../../src/components/data-table/filters/select-filter.tsx","../../src/components/data-table/filters/typeahead-filter.tsx","../../src/components/data-table/filters/number-filter.tsx","../../src/components/data-table/cell-renderers/status-cell-renderer.tsx","../../src/components/data-table/cell-renderers/user-cell-renderer.tsx","../../src/components/data-table/cell-renderers/image-cell-renderer.tsx","../../src/components/data-table/cell-renderers/tag-list-cell-renderer.tsx","../../src/components/data-table/cell-renderers/date-cell-renderer.tsx","../../src/components/data-table/cell-renderers/link-cell-renderer.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport type {\n CustomFilterProps,\n CustomFloatingFilterProps,\n} from 'ag-grid-react';\nimport { useGridFilter } from 'ag-grid-react';\nimport type { IFilter } from 'ag-grid-community';\nimport { DateRangePicker } from '../../date-range-picker';\nimport type { DateRangeValue } from '../../date-range-picker';\n\n/**\n * Custom AG Grid filter component for date *ranges*. AG Grid Community's\n * built-in `agDateColumnFilter` only handles single-date comparison —\n * platform needs \"between X and Y\" for invoice / transaction lists.\n *\n * Wire on a colDef:\n * ```tsx\n * { field: 'date', filter: DateRangeFilter }\n * ```\n *\n * The filter model has shape `{ type: 'inRange', dateFrom, dateTo }` to\n * stay close to AG Grid's own date-filter convention so server-side\n * adapters can interpret it the same way.\n */\nexport interface DateRangeFilterModel {\n type: 'inRange';\n dateFrom: string | null;\n dateTo: string | null;\n}\n\n/**\n * `filterParams` a colDef may pass to `DateRangeFilter` /\n * `DateRangeFloatingFilter`.\n *\n * `commitMode` is forwarded to the wrapped `DateRangePicker`. Leave it unset\n * (picker default `'auto'`, commit-on-complete-range) for cheap client-side row\n * models; set `'apply'` for SERVER-side row models so each range edit defers to\n * one Apply and fires a single datasource round-trip instead of one per commit.\n */\nexport interface DateRangeFilterParams {\n placeholder?: string;\n commitMode?: 'auto' | 'apply';\n}\n\nfunction toIsoDate(d: Date | undefined): string | null {\n if (!d) return null;\n return d.toISOString().slice(0, 10);\n}\n\nfunction fromIsoDate(s: string | null | undefined): Date | undefined {\n if (!s) return undefined;\n const d = new Date(s);\n return Number.isNaN(d.getTime()) ? undefined : d;\n}\n\nexport function DateRangeFilter(\n props: CustomFilterProps<unknown, unknown, DateRangeFilterModel>,\n) {\n const { model, onModelChange, getValue, doesRowPassOtherFilter } = props;\n const filterParams =\n (props.colDef?.filterParams as DateRangeFilterParams | undefined) ?? {};\n // Picker UI state, seeded from the model and kept in sync when the model\n // changes externally — a programmatic default (e.g. \"this week\"), a server\n // restore, or an AG Grid reset. Mirrors `SelectFilter`'s `pending` sync.\n const [range, setRange] = useState<DateRangeValue>(() => ({\n from: fromIsoDate(model?.dateFrom),\n to: fromIsoDate(model?.dateTo),\n }));\n useEffect(() => {\n setRange({\n from: fromIsoDate(model?.dateFrom),\n to: fromIsoDate(model?.dateTo),\n });\n }, [model?.dateFrom, model?.dateTo]);\n\n // Tell AG Grid how to evaluate a row against the current model. AG Grid\n // calls this for each row; we read the cell value via `getValue(node)`\n // (a Date or ISO string), compare to the bounds. Bounds come from the\n // MODEL (the source of truth) — not the picker state — so a model set\n // programmatically applies even before the picker UI has mounted, exactly\n // as `SelectFilter` reads `model.values` directly.\n useGridFilter({\n doesFilterPass: (params) => {\n const from = fromIsoDate(model?.dateFrom);\n const to = fromIsoDate(model?.dateTo);\n if (!from && !to) return true;\n const cellValue = getValue(params.node) as\n | Date\n | string\n | null\n | undefined;\n if (!cellValue) return false;\n const cellDate =\n cellValue instanceof Date ? cellValue : fromIsoDate(String(cellValue));\n if (!cellDate) return false;\n if (from && cellDate < from) return false;\n if (to && cellDate > to) return false;\n // Respect other filters via the supplied callback if AG Grid uses\n // it (some grid setups call `doesRowPassOtherFilter` before us).\n void doesRowPassOtherFilter;\n return true;\n },\n });\n\n function apply(next: DateRangeValue) {\n setRange(next);\n if (!next.from && !next.to) {\n onModelChange(null);\n return;\n }\n onModelChange({\n type: 'inRange',\n dateFrom: toIsoDate(next.from),\n dateTo: toIsoDate(next.to),\n } satisfies DateRangeFilterModel);\n }\n\n return (\n <div\n data-component=\"date-range-filter\"\n className=\"ds:p-[var(--spacing-sm)] ds:min-w-[280px]\"\n >\n <DateRangePicker\n value={range}\n onChange={apply}\n commitMode={filterParams.commitMode}\n size=\"sm\"\n />\n </div>\n );\n}\n\n/**\n * Floating-filter companion for `DateRangeFilter`.\n *\n * Renders the kit's `<DateRangePicker>` directly as the floating-filter\n * input — its built-in trigger button + calendar popover IS the filter\n * UI. Earlier versions wrapped the picker in a second `<Popover>`,\n * producing the \"click → empty popover with another trigger → click\n * again → calendar\" double-step that read as duplicated UI.\n */\nexport function DateRangeFloatingFilter(\n props: CustomFloatingFilterProps<\n IFilter,\n unknown,\n unknown,\n DateRangeFilterModel\n >,\n) {\n const { model, onModelChange, column } = props;\n // Let a colDef supply a short `filterParams.placeholder` for the in-row\n // trigger — the default \"Select date range\" is long for a narrow filter\n // column. (The label truncates cleanly either way; a short placeholder just\n // reads better.)\n const filterParams =\n (column?.getColDef?.()?.filterParams as\n | DateRangeFilterParams\n | undefined) ?? {};\n const [range, setRange] = useState<DateRangeValue>(() => ({\n from: fromIsoDate(model?.dateFrom),\n to: fromIsoDate(model?.dateTo),\n }));\n // Reflect external model changes (a programmatic default, a parent-filter\n // edit, an AG Grid reset) in the in-row picker trigger.\n useEffect(() => {\n setRange({\n from: fromIsoDate(model?.dateFrom),\n to: fromIsoDate(model?.dateTo),\n });\n }, [model?.dateFrom, model?.dateTo]);\n\n function apply(next: DateRangeValue) {\n setRange(next);\n if (!next.from && !next.to) {\n onModelChange(null);\n return;\n }\n onModelChange({\n type: 'inRange',\n dateFrom: toIsoDate(next.from),\n dateTo: toIsoDate(next.to),\n } satisfies DateRangeFilterModel);\n }\n\n return (\n <div data-component=\"date-range-floating-filter\" className=\"ds:w-full\">\n <DateRangePicker\n value={range}\n onChange={apply}\n commitMode={filterParams.commitMode}\n size=\"sm\"\n placeholder={filterParams.placeholder}\n />\n </div>\n );\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type {\n CustomFilterProps,\n CustomFloatingFilterProps,\n} from 'ag-grid-react';\nimport { useGridFilter } from 'ag-grid-react';\nimport type { GridApi, IFilter, IRowNode } from 'ag-grid-community';\nimport { useTranslation } from 'react-i18next';\nimport { Checkbox } from '../../checkbox';\nimport { Button } from '../../button';\nimport { MultiSelect } from '../../multi-select';\nimport { ScrollArea } from '../../scroll-area/scroll-area';\n\n/**\n * Custom AG Grid filter component — multi-select facet filter.\n *\n * The Community-friendly equivalent of AG Grid Enterprise's\n * `agSetColumnFilter`. Surfaces a checkbox list of every value the column\n * can take, so users tick to include / untick to exclude. Much faster than\n * the default `agTextColumnFilter` for closed enums (status, room,\n * operator).\n *\n * Wire on a colDef:\n * ```tsx\n * {\n * field: 'status',\n * filter: SelectFilter,\n * filterParams: {\n * options: [\n * { value: 'open', label: 'Aperte' },\n * { value: 'paid', label: 'Pagate' },\n * ],\n * },\n * }\n * ```\n *\n * Model shape `{ type: 'set', values: Array<string | number> }` matches\n * AG Grid Enterprise's set-filter convention so server-side adapters can\n * read either implementation the same way.\n */\n\nexport interface SelectFilterOption {\n value: string | number;\n label: string;\n}\n\nexport interface SelectFilterModel {\n type: 'set';\n values: Array<string | number>;\n}\n\nexport interface SelectFilterParams {\n options?: SelectFilterOption[];\n placeholder?: string;\n}\n\ntype SelectFilterValue = string | number;\n\nfunction toValueKey(v: SelectFilterValue): string {\n return typeof v === 'number' ? `n:${v}` : `s:${v}`;\n}\n\n/** How a filter surface reads one row's value for its column. */\ntype SelectValueReader = (node: IRowNode) => unknown;\n\n/** Numeric collation, so a derived numeric column lists 1, 2, 3, 10 rather\n * than the lexicographic 1, 10, 2, 3. */\nconst LABEL_COLLATOR = new Intl.Collator(undefined, { numeric: true });\n\n/** Distinct values the column actually holds, label-sorted. `forEachNode`\n * walks the whole client-side row model, so the list does not shrink as\n * other columns filter rows out. */\nfunction collectColumnOptions(\n api: GridApi | undefined,\n readValue: SelectValueReader,\n): SelectFilterOption[] {\n if (!api) return [];\n const seen = new Map<string, SelectFilterOption>();\n api.forEachNode((node: IRowNode) => {\n const raw = readValue(node);\n if (raw === null || raw === undefined) return;\n const value =\n typeof raw === 'string' || typeof raw === 'number' ? raw : String(raw);\n const key = toValueKey(value);\n if (!seen.has(key)) seen.set(key, { value, label: String(value) });\n });\n return Array.from(seen.values()).sort((a, b) =>\n LABEL_COLLATOR.compare(String(a.label), String(b.label)),\n );\n}\n\nfunction sameOptions(\n a: SelectFilterOption[],\n b: SelectFilterOption[],\n): boolean {\n if (a.length !== b.length) return false;\n return a.every(\n (opt, i) =>\n toValueKey(opt.value) === toValueKey(b[i].value) &&\n opt.label === b[i].label,\n );\n}\n\n/**\n * The universe of choices for one Select-filtered column.\n *\n * An explicit `options` filterParam always wins — INCLUDING an empty one,\n * which means \"this column has no facets\", not \"derive them for me\". Omit\n * `options` entirely and the list is DERIVED from the values the column\n * actually holds, and re-derived as the row data changes, so both the popup\n * panel and its floating-filter twin offer the same, data-accurate choices.\n */\nfunction useSelectFilterOptions(\n api: GridApi | undefined,\n options: SelectFilterOption[] | undefined,\n readValue: SelectValueReader,\n): SelectFilterOption[] {\n const explicit = options;\n const hasExplicit = explicit !== undefined;\n const [derived, setDerived] = useState<SelectFilterOption[]>([]);\n\n // Latest-reader ref so a new `getValue` identity per grid render does not\n // tear down and rebuild the grid event subscription below.\n const readValueRef = useRef(readValue);\n useEffect(() => {\n readValueRef.current = readValue;\n });\n\n useEffect(() => {\n if (hasExplicit || !api) return;\n const recompute = () => {\n setDerived((prev) => {\n const next = collectColumnOptions(api, readValueRef.current);\n return sameOptions(prev, next) ? prev : next;\n });\n };\n recompute();\n api.addEventListener('modelUpdated', recompute);\n api.addEventListener('cellValueChanged', recompute);\n return () => {\n if (api.isDestroyed()) return;\n api.removeEventListener('modelUpdated', recompute);\n api.removeEventListener('cellValueChanged', recompute);\n };\n }, [api, hasExplicit]);\n\n return explicit ?? derived;\n}\n\nexport function SelectFilter(\n props: CustomFilterProps<unknown, unknown, SelectFilterModel> &\n SelectFilterParams,\n) {\n const { model, onModelChange, getValue, api, options, placeholder } = props;\n const { t } = useTranslation('ui');\n\n const readValue = useCallback<SelectValueReader>(\n (node) => getValue(node) as unknown,\n [getValue],\n );\n const derivedOptions = useSelectFilterOptions(api, options, readValue);\n\n // Working set — checkboxes mutate `pending` only; we commit to the\n // grid via `onModelChange` when the user clicks Apply (or clears).\n const initialSelected = useMemo<Set<string>>(() => {\n const set = new Set<string>();\n const incoming = model?.values ?? [];\n for (const v of incoming) set.add(toValueKey(v));\n return set;\n }, [model]);\n\n const [pending, setPending] = useState<Set<string>>(initialSelected);\n\n // Sync local `pending` if the model changes externally (e.g. when AG\n // Grid pushes a reset). `model` is the dependency — Set instances are\n // compared by reference in React, so the memo above is sufficient.\n useEffect(() => {\n setPending(initialSelected);\n }, [initialSelected]);\n\n useGridFilter({\n doesFilterPass: (params) => {\n const active = model?.values;\n if (!active || active.length === 0) return true;\n const raw = getValue(params.node) as unknown;\n if (raw === null || raw === undefined) return false;\n const value: SelectFilterValue =\n typeof raw === 'string' || typeof raw === 'number' ? raw : String(raw);\n const key = toValueKey(value);\n return active.some((v) => toValueKey(v) === key);\n },\n });\n\n function toggle(optionKey: string) {\n setPending((prev) => {\n const next = new Set(prev);\n if (next.has(optionKey)) next.delete(optionKey);\n else next.add(optionKey);\n return next;\n });\n }\n\n function apply() {\n if (pending.size === 0) {\n onModelChange(null);\n return;\n }\n const values: SelectFilterValue[] = [];\n for (const opt of derivedOptions) {\n if (pending.has(toValueKey(opt.value))) values.push(opt.value);\n }\n // A ticked value can leave the data before Apply (the derived list is\n // live). Committing `values: []` would read as an active filter that\n // matches every row, so clear instead.\n if (values.length === 0) {\n onModelChange(null);\n return;\n }\n onModelChange({ type: 'set', values });\n }\n\n function clear() {\n setPending(new Set());\n onModelChange(null);\n }\n\n const placeholderLabel = placeholder ?? t('dataTable.selectFilter.all');\n\n return (\n <div\n data-component=\"select-filter\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[200px] ds:max-w-[260px]\"\n >\n <ScrollArea orientation=\"vertical\" className=\"ds:max-h-[240px]\">\n <div\n role=\"group\"\n aria-label={placeholderLabel}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n {derivedOptions.length === 0 ? (\n <p className=\"ds:text-[length:var(--font-size-sm)] ds:text-[var(--muted-foreground)] ds:py-[var(--spacing-xs)]\">\n {t('dataTable.agGrid.noRowsToShow')}\n </p>\n ) : (\n derivedOptions.map((option) => {\n const key = toValueKey(option.value);\n return (\n <Checkbox\n key={key}\n size=\"sm\"\n label={option.label}\n checked={pending.has(key)}\n onCheckedChange={() => toggle(key)}\n />\n );\n })\n )}\n </div>\n </ScrollArea>\n <div className=\"ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]\">\n <Button intent=\"ghost\" size=\"sm\" onClick={clear} type=\"button\">\n {t('dataTable.selectFilter.clear')}\n </Button>\n <Button intent=\"primary\" size=\"sm\" onClick={apply} type=\"button\">\n {t('dataTable.selectFilter.apply')}\n </Button>\n </div>\n </div>\n );\n}\n\n/**\n * Floating-filter companion for `SelectFilter`.\n *\n * Renders the kit's `<MultiSelect>` directly as the floating-filter\n * input — its built-in trigger + checkbox dropdown IS the filter UI.\n * Earlier versions wrapped MultiSelect in another `<Popover>`,\n * producing the \"click trigger → empty popover with another trigger →\n * click → checkbox list\" double-step that read as duplicated UI.\n *\n * MultiSelect's options use `string` values; we string-convert the\n * model's `(string | number)[]` for the trigger and parse back on\n * apply. The grid model still tracks the original primitive types so\n * `doesFilterPass` keeps matching numeric columns correctly.\n *\n * Choices come from the same `useSelectFilterOptions` universe the popup\n * panel uses: an explicit `options` filterParam if the consumer declared\n * one, otherwise the column's own distinct values. Reading only\n * `filterParams.options` used to leave the trigger empty beside a working\n * panel whenever the consumer relied on derivation.\n */\nexport function SelectFloatingFilter(\n props: CustomFloatingFilterProps<\n IFilter,\n unknown,\n unknown,\n SelectFilterModel\n >,\n) {\n const { model, onModelChange, column, api } = props;\n\n const colDef = column?.getColDef?.();\n const filterParams =\n (colDef?.filterParams as SelectFilterParams | undefined) ?? {};\n\n // The floating filter has no `getValue`; read through the grid instead.\n // A column with a `filterValueGetter` should declare `options` — the two\n // reads would otherwise disagree with the panel's.\n const readValue = useCallback<SelectValueReader>(\n (node) =>\n api && column\n ? (api.getCellValue<unknown>({\n rowNode: node,\n colKey: column,\n }) as unknown)\n : undefined,\n [api, column],\n );\n const availableOptions = useSelectFilterOptions(\n api,\n filterParams.options,\n readValue,\n );\n // Name the floating-filter trigger after its column so the per-column Select\n // filters are distinguishable to assistive tech — they otherwise all read as\n // the generic MultiSelect placeholder. An explicit `placeholder` wins.\n const accessibleLabel =\n filterParams.placeholder ??\n (typeof colDef?.headerName === 'string' ? colDef.headerName : undefined);\n\n // MultiSelect's `value` is `string[]`. SelectFilter's model carries\n // `(string | number)[]` so we string-convert in / out. Build a lookup\n // from the stringified key back to the original primitive so the\n // model retains the consumer's typing.\n const valueByKey = useMemo(() => {\n const map = new Map<string, SelectFilterValue>();\n for (const opt of availableOptions) map.set(String(opt.value), opt.value);\n return map;\n }, [availableOptions]);\n\n const selectOptions = useMemo(\n () =>\n availableOptions.map((opt) => ({\n value: String(opt.value),\n label: opt.label,\n })),\n [availableOptions],\n );\n\n const currentValue = useMemo(\n () => (model?.values ?? []).map((v) => String(v)),\n [model],\n );\n\n function handleChange(next: string[]) {\n if (next.length === 0) {\n onModelChange(null);\n return;\n }\n const values: SelectFilterValue[] = [];\n for (const k of next) {\n const original = valueByKey.get(k);\n if (original !== undefined) values.push(original);\n }\n // Same live-list guard as the panel's Apply: an empty set is a cleared\n // filter, never an active one that matches everything.\n if (values.length === 0) {\n onModelChange(null);\n return;\n }\n onModelChange({ type: 'set', values });\n }\n\n return (\n <div data-component=\"select-floating-filter\" className=\"ds:w-full\">\n <MultiSelect\n size=\"sm\"\n options={selectOptions}\n value={currentValue}\n onChange={handleChange}\n placeholder={filterParams.placeholder}\n aria-label={accessibleLabel}\n allowClear\n />\n </div>\n );\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport type {\n CustomFilterProps,\n CustomFloatingFilterProps,\n} from 'ag-grid-react';\nimport { useGridFilter } from 'ag-grid-react';\nimport type { IFilter, IRowNode } from 'ag-grid-community';\nimport { useTranslation } from 'react-i18next';\nimport { Autocomplete } from '../../autocomplete';\nimport { Button } from '../../button';\nimport type { OptionShape } from '../../_shared/option';\n\n/**\n * Custom AG Grid filter component — single-select typeahead filter.\n *\n * Wraps the kit's existing `<Autocomplete>` so the user types to filter a\n * bounded-but-large set of values (e.g. patient names), picks one\n * suggestion, and the grid filters to rows matching that value exactly.\n *\n * Wire on a colDef:\n * ```tsx\n * {\n * field: 'patient',\n * filter: TypeaheadFilter,\n * filterParams: {\n * options: PATIENTS.map(p => ({ value: p.name, label: p.name })),\n * },\n * }\n * ```\n *\n * Model shape `{ type: 'equals', value: string }` matches AG Grid's\n * text-filter `equals` convention so server-side adapters can read either\n * implementation the same way.\n */\n\nexport interface TypeaheadFilterOption {\n value: string;\n label: string;\n}\n\nexport interface TypeaheadFilterModel {\n type: 'equals';\n value: string;\n}\n\nexport interface TypeaheadFilterParams {\n options?: TypeaheadFilterOption[];\n loadOptions?: (\n input: string,\n opts: { signal: AbortSignal; locale: string },\n ) => Promise<TypeaheadFilterOption[]>;\n placeholder?: string;\n}\n\nfunction normalise(s: string): string {\n return s.trim().toLocaleLowerCase();\n}\n\nexport function TypeaheadFilter(\n props: CustomFilterProps<unknown, unknown, TypeaheadFilterModel> &\n TypeaheadFilterParams,\n) {\n const {\n model,\n onModelChange,\n getValue,\n api,\n column,\n options,\n loadOptions,\n placeholder,\n } = props;\n const { t } = useTranslation('ui');\n\n // Universe of choices. Prefer explicit `options`; fall back to the\n // column's distinct values when neither `options` nor `loadOptions` is\n // supplied. Same shape as SelectFilter's derivation so the two filters\n // present a consistent experience when consumers don't enumerate.\n const derivedOptions = useMemo<TypeaheadFilterOption[]>(() => {\n if (options && options.length > 0) return options;\n if (!api || !column) return [];\n const seen = new Map<string, TypeaheadFilterOption>();\n api.forEachNode((node: IRowNode) => {\n const raw = getValue(node) as unknown;\n if (raw === null || raw === undefined) return;\n const value = typeof raw === 'string' ? raw : String(raw);\n if (!seen.has(value)) {\n seen.set(value, { value, label: value });\n }\n });\n return Array.from(seen.values()).sort((a, b) =>\n a.label.localeCompare(b.label),\n );\n }, [options, api, column, getValue]);\n\n // Build the async `loadOptions` adapter that <Autocomplete> consumes.\n // Local-options path filters the snapshot synchronously and wraps it\n // in Promise.resolve(); explicit `loadOptions` is passed through.\n const adapterLoadOptions = useMemo(() => {\n return async (\n query: string,\n opts: { signal: AbortSignal; locale: string },\n ): Promise<OptionShape[]> => {\n if (loadOptions) {\n const result = await loadOptions(query, opts);\n return result.map((o) => ({ value: o.value, label: o.label }));\n }\n const q = normalise(query);\n const filtered = q\n ? derivedOptions.filter((o) => normalise(o.label).includes(q))\n : derivedOptions;\n return filtered\n .slice(0, 50)\n .map((o) => ({ value: o.value, label: o.label }));\n };\n }, [loadOptions, derivedOptions]);\n\n const [draft, setDraft] = useState<string>(model?.value ?? '');\n\n useEffect(() => {\n setDraft(model?.value ?? '');\n }, [model?.value]);\n\n useGridFilter({\n doesFilterPass: (params) => {\n const target = model?.value;\n if (!target) return true;\n const raw = getValue(params.node) as unknown;\n if (raw === null || raw === undefined) return false;\n const value = typeof raw === 'string' ? raw : String(raw);\n return normalise(value) === normalise(target);\n },\n });\n\n function handleSelect(option: OptionShape) {\n // Autocomplete itself commits `option.label` to the input value; we\n // mirror that here so the displayed text matches what the user just\n // picked, even when label and value diverge (e.g. id vs name).\n setDraft(option.label);\n onModelChange({ type: 'equals', value: option.value });\n }\n\n function handleChange(next: string) {\n setDraft(next);\n // Clear the applied model when the user empties the input so the\n // grid stops filtering as soon as the field is blank.\n if (next === '' && model) onModelChange(null);\n }\n\n function clear() {\n setDraft('');\n onModelChange(null);\n }\n\n const placeholderLabel =\n placeholder ?? t('dataTable.typeaheadFilter.placeholder');\n\n return (\n <div\n data-component=\"typeahead-filter\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[240px]\"\n >\n <Autocomplete\n size=\"sm\"\n value={draft}\n onChange={handleChange}\n onSelect={handleSelect}\n loadOptions={adapterLoadOptions}\n placeholder={placeholderLabel}\n aria-label={placeholderLabel}\n />\n <div className=\"ds:flex ds:items-center ds:justify-end ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]\">\n <Button intent=\"ghost\" size=\"sm\" onClick={clear} type=\"button\">\n {t('dataTable.typeaheadFilter.clear')}\n </Button>\n </div>\n </div>\n );\n}\n\n/**\n * Floating-filter companion for `TypeaheadFilter`.\n *\n * Renders the kit's `<Autocomplete>` directly as the floating-filter\n * input — its built-in text input + portaled dropdown IS the filter\n * UI. Earlier versions wrapped Autocomplete in a second `<Popover>`,\n * producing the \"click trigger → popover with another search input →\n * type → list appears\" double-step that read as duplicated UI.\n */\nexport function TypeaheadFloatingFilter(\n props: CustomFloatingFilterProps<\n IFilter,\n unknown,\n unknown,\n TypeaheadFilterModel\n >,\n) {\n const { model, onModelChange, column } = props;\n const { t } = useTranslation('ui');\n\n const filterParams =\n (column?.getColDef?.()?.filterParams as\n | TypeaheadFilterParams\n | undefined) ?? {};\n const availableOptions = filterParams.options ?? [];\n const loadOptions = filterParams.loadOptions;\n const placeholderLabel =\n filterParams.placeholder ?? t('dataTable.typeaheadFilter.placeholder');\n\n const adapterLoadOptions = useMemo(() => {\n return async (\n query: string,\n opts: { signal: AbortSignal; locale: string },\n ): Promise<OptionShape[]> => {\n if (loadOptions) {\n const result = await loadOptions(query, opts);\n return result.map((o) => ({ value: o.value, label: o.label }));\n }\n const q = normalise(query);\n const filtered = q\n ? availableOptions.filter((o) => normalise(o.label).includes(q))\n : availableOptions;\n return filtered\n .slice(0, 50)\n .map((o) => ({ value: o.value, label: o.label }));\n };\n }, [loadOptions, availableOptions]);\n\n // Track the input's display value separately from the applied model.\n // The user can type freely; we only apply when they pick an option\n // from the dropdown (committing a known value to the model). Clearing\n // the input clears the filter.\n const [draft, setDraft] = useState<string>(model?.value ?? '');\n useEffect(() => {\n setDraft(model?.value ?? '');\n }, [model?.value]);\n\n function handleSelect(option: OptionShape) {\n setDraft(option.label);\n onModelChange({ type: 'equals', value: option.value });\n }\n\n function handleChange(next: string) {\n setDraft(next);\n if (next === '' && model) onModelChange(null);\n }\n\n return (\n <div data-component=\"typeahead-floating-filter\" className=\"ds:w-full\">\n <Autocomplete\n size=\"sm\"\n value={draft}\n onChange={handleChange}\n onSelect={handleSelect}\n loadOptions={adapterLoadOptions}\n placeholder={placeholderLabel}\n aria-label={placeholderLabel}\n />\n </div>\n );\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport type {\n CustomFilterProps,\n CustomFloatingFilterProps,\n} from 'ag-grid-react';\nimport { useGridFilter } from 'ag-grid-react';\nimport type { IFilter } from 'ag-grid-community';\nimport { useTranslation } from 'react-i18next';\nimport { NumberInput } from '../../number-input';\nimport { Select } from '../../select';\nimport { Button } from '../../button';\n\n/**\n * Custom AG Grid filter component for numeric columns. AG Grid Community's\n * built-in `agNumberColumnFilter` paints a stock browser-skinned\n * `<input type=\"number\">` that does not match the kit's form language —\n * this wraps the DS `<NumberInput>` + `<Select>` so totals, prices,\n * quantities, etc. line up visually with neighbouring DS-styled cells.\n *\n * Wire on a colDef:\n * ```tsx\n * {\n * field: 'total',\n * filter: NumberFilter,\n * floatingFilterComponent: NumberFloatingFilter,\n * filterParams: { defaultOperator: 'greaterThan', min: 0 },\n * }\n * ```\n *\n * The full-popover variant exposes the operator dropdown (equals,\n * greaterThan, inRange, blank, …); the floating-filter row is a single\n * compact input whose operator is fixed to `defaultOperator`. Both speak\n * the same `NumberFilterModel` so server-side adapters can read either.\n *\n * Model shape `{ type, filter, filterTo? }` matches AG Grid's own\n * `agNumberColumnFilter` vocabulary so adapters can interchange.\n */\n\nexport type NumberFilterOperator =\n | 'equals'\n | 'notEqual'\n | 'greaterThan'\n | 'greaterThanOrEqual'\n | 'lessThan'\n | 'lessThanOrEqual'\n | 'inRange'\n | 'blank'\n | 'notBlank';\n\nexport interface NumberFilterModel {\n type: NumberFilterOperator;\n filter: number;\n filterTo?: number;\n}\n\nexport interface NumberFilterParams {\n defaultOperator?: NumberFilterOperator;\n min?: number;\n max?: number;\n step?: number;\n placeholder?: string;\n}\n\nconst ALL_OPERATORS: NumberFilterOperator[] = [\n 'equals',\n 'notEqual',\n 'greaterThan',\n 'greaterThanOrEqual',\n 'lessThan',\n 'lessThanOrEqual',\n 'inRange',\n 'blank',\n 'notBlank',\n];\n\nfunction operatorTakesValue(op: NumberFilterOperator): boolean {\n return op !== 'blank' && op !== 'notBlank';\n}\n\nfunction operatorTakesRange(op: NumberFilterOperator): boolean {\n return op === 'inRange';\n}\n\nfunction evaluate(\n op: NumberFilterOperator,\n cell: number | null,\n primary: number | null,\n secondary: number | null,\n): boolean {\n if (op === 'blank') return cell === null;\n if (op === 'notBlank') return cell !== null;\n if (cell === null) return false;\n if (primary === null) return true;\n switch (op) {\n case 'equals':\n return cell === primary;\n case 'notEqual':\n return cell !== primary;\n case 'greaterThan':\n return cell > primary;\n case 'greaterThanOrEqual':\n return cell >= primary;\n case 'lessThan':\n return cell < primary;\n case 'lessThanOrEqual':\n return cell <= primary;\n case 'inRange': {\n if (secondary === null) return cell >= primary;\n const lo = Math.min(primary, secondary);\n const hi = Math.max(primary, secondary);\n return cell >= lo && cell <= hi;\n }\n default:\n return true;\n }\n}\n\nfunction coerceCell(raw: unknown): number | null {\n if (raw === null || raw === undefined || raw === '') return null;\n const n = typeof raw === 'number' ? raw : Number(raw);\n return Number.isNaN(n) ? null : n;\n}\n\nexport function NumberFilter(\n props: CustomFilterProps<unknown, unknown, NumberFilterModel> &\n NumberFilterParams,\n) {\n const {\n model,\n onModelChange,\n getValue,\n defaultOperator,\n min,\n max,\n step,\n placeholder,\n } = props;\n const { t } = useTranslation('ui');\n\n const initialOperator: NumberFilterOperator =\n model?.type ?? defaultOperator ?? 'equals';\n const [operator, setOperator] =\n useState<NumberFilterOperator>(initialOperator);\n const [primary, setPrimary] = useState<number | null>(model?.filter ?? null);\n const [secondary, setSecondary] = useState<number | null>(\n model?.filterTo ?? null,\n );\n\n // If AG Grid pushes an externally-cleared / reset model, mirror it in\n // local state so the UI stays consistent with the applied filter. The\n // cleared model arrives as null OR undefined (removed from a setFilterModel\n // map), so a loose check is load-bearing here.\n useEffect(() => {\n if (model == null) {\n setOperator(defaultOperator ?? 'equals');\n setPrimary(null);\n setSecondary(null);\n return;\n }\n setOperator(model.type);\n setPrimary(model.filter ?? null);\n setSecondary(model.filterTo ?? null);\n }, [model, defaultOperator]);\n\n useGridFilter({\n doesFilterPass: (params) => {\n if (!model) return true;\n const cell = coerceCell(getValue(params.node));\n return evaluate(\n model.type,\n cell,\n model.filter ?? null,\n model.filterTo ?? null,\n );\n },\n });\n\n const operatorOptions = useMemo(\n () =>\n ALL_OPERATORS.map((op) => ({\n value: op,\n label: t(`dataTable.numberFilter.operators.${op}`),\n })),\n [t],\n );\n\n const placeholderLabel =\n placeholder ?? t('dataTable.numberFilter.placeholder');\n\n function apply() {\n if (!operatorTakesValue(operator)) {\n onModelChange({ type: operator, filter: 0 });\n return;\n }\n if (primary === null) {\n onModelChange(null);\n return;\n }\n if (operatorTakesRange(operator)) {\n onModelChange({\n type: operator,\n filter: primary,\n filterTo: secondary ?? undefined,\n });\n return;\n }\n onModelChange({ type: operator, filter: primary });\n }\n\n function clear() {\n setOperator(defaultOperator ?? 'equals');\n setPrimary(null);\n setSecondary(null);\n onModelChange(null);\n }\n\n const showValue = operatorTakesValue(operator);\n const showRange = operatorTakesRange(operator);\n\n return (\n <div\n data-component=\"number-filter\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-sm)] ds:min-w-[240px]\"\n >\n <Select\n size=\"sm\"\n options={operatorOptions}\n value={operator}\n onValueChange={(next) => {\n if (next === '') return;\n setOperator(next as NumberFilterOperator);\n }}\n aria-label={t('dataTable.numberFilter.operators.equals')}\n />\n {showValue && !showRange && (\n <NumberInput\n size=\"sm\"\n value={primary}\n onChange={setPrimary}\n min={min}\n max={max}\n step={step}\n placeholder={placeholderLabel}\n aria-label={placeholderLabel}\n />\n )}\n {showRange && (\n <div className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n <NumberInput\n size=\"sm\"\n value={primary}\n onChange={setPrimary}\n min={min}\n max={max}\n step={step}\n placeholder={t('dataTable.numberFilter.from')}\n aria-label={t('dataTable.numberFilter.from')}\n />\n <NumberInput\n size=\"sm\"\n value={secondary}\n onChange={setSecondary}\n min={min}\n max={max}\n step={step}\n placeholder={t('dataTable.numberFilter.to')}\n aria-label={t('dataTable.numberFilter.to')}\n />\n </div>\n )}\n <div className=\"ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)] ds:border-t ds:border-[var(--border)]\">\n <Button intent=\"ghost\" size=\"sm\" onClick={clear} type=\"button\">\n {t('dataTable.numberFilter.clear')}\n </Button>\n <Button intent=\"primary\" size=\"sm\" onClick={apply} type=\"button\">\n {t('dataTable.numberFilter.apply')}\n </Button>\n </div>\n </div>\n );\n}\n\n/**\n * Floating-filter companion for `NumberFilter`.\n *\n * Renders the kit's `<NumberInput>` directly as the inline filter input\n * with a fixed operator (`defaultOperator`, or `'equals'`). The operator\n * dropdown lives only in the full popover — the floating-filter row is\n * deliberately compact, matching the way `agNumberColumnFilter` ships\n * with AG Grid Community.\n *\n * Debounced commit at 200 ms so each keystroke does not re-run the grid\n * filter. Empty input or invalid number commits `null` so the column\n * reverts to \"no filter\" rather than `filter: NaN`.\n */\nexport function NumberFloatingFilter(\n props: CustomFloatingFilterProps<\n IFilter,\n unknown,\n unknown,\n NumberFilterModel\n >,\n) {\n const { model, onModelChange, column } = props;\n const { t } = useTranslation('ui');\n\n const filterParams =\n (column?.getColDef?.()?.filterParams as NumberFilterParams | undefined) ??\n {};\n const operator: NumberFilterOperator =\n filterParams.defaultOperator ?? 'equals';\n const placeholderLabel =\n filterParams.placeholder ?? t('dataTable.numberFilter.placeholder');\n\n const [draft, setDraft] = useState<number | null>(model?.filter ?? null);\n\n // Sync local draft when the model is reset externally (e.g. a global\n // clear from the column-header menu's \"Clear\" button).\n useEffect(() => {\n setDraft(model?.filter ?? null);\n }, [model?.filter]);\n\n // Debounced commit. We don't pull a hook in for this — a single\n // useEffect + setTimeout is cheaper than the cost of importing one,\n // and AG Grid only re-renders this floating filter per keystroke.\n useEffect(() => {\n if (draft === (model?.filter ?? null)) return;\n const handle = setTimeout(() => {\n if (draft === null || Number.isNaN(draft)) {\n onModelChange(null);\n return;\n }\n onModelChange({ type: operator, filter: draft });\n }, 200);\n return () => clearTimeout(handle);\n // `model` intentionally excluded — we only want to react to user\n // edits of `draft`. Model resets sync via the effect above.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [draft, operator]);\n\n return (\n <div data-component=\"number-floating-filter\" className=\"ds:w-full\">\n <NumberInput\n size=\"sm\"\n value={draft}\n onChange={setDraft}\n min={filterParams.min}\n max={filterParams.max}\n step={filterParams.step}\n placeholder={placeholderLabel}\n aria-label={placeholderLabel}\n />\n </div>\n );\n}\n","import type { CustomCellRendererProps } from 'ag-grid-react';\nimport { Badge } from '../../badge/badge';\n\nexport type BadgeVariant = 'neutral' | 'info' | 'success' | 'warning' | 'error';\n\nexport interface StatusCellRendererParams {\n variantMap?: Record<string, BadgeVariant>;\n}\n\nexport function StatusCellRenderer(\n props: CustomCellRendererProps & StatusCellRendererParams,\n) {\n const { value, variantMap } = props;\n const variant: BadgeVariant = variantMap?.[value as string] ?? 'neutral';\n return (\n <Badge variant={variant} withDot size=\"sm\">\n {String(value ?? '')}\n </Badge>\n );\n}\n","import type { CustomCellRendererProps } from 'ag-grid-react';\nimport { Avatar } from '../../avatar/avatar';\n\nexport interface UserCellValue {\n name: string;\n src?: string;\n}\n\nexport function UserCellRenderer(\n props: CustomCellRendererProps<unknown, UserCellValue>,\n) {\n const { value } = props;\n if (!value) return null;\n return (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Avatar name={value.name} src={value.src} size=\"sm\" />\n <span>{value.name}</span>\n </span>\n );\n}\n","import type { CustomCellRendererProps } from 'ag-grid-react';\nimport { Avatar } from '../../avatar/avatar';\n\nexport interface ImageCellRendererParams {\n /** Field name on the row whose value holds the image URL. */\n srcField: string;\n /** Optional field name holding alt text. Falls back to '' (decorative). */\n altField?: string;\n /**\n * Optional field name holding a name string. When the src URL is missing or\n * rejected, the cell falls back to `<Avatar name={fallback}>` so the cell\n * still has a visual.\n */\n fallbackField?: string;\n /** Visual size of the image. Matches `<Avatar>` sizes (sm=32, md=40, lg=48). */\n size?: 'sm' | 'md' | 'lg';\n /** Corner radius preset. `circle` matches `<Avatar>`. */\n shape?: 'square' | 'rounded' | 'circle';\n}\n\nconst SIZE_CLASS: Record<\n NonNullable<ImageCellRendererParams['size']>,\n string\n> = {\n sm: 'ds:size-8',\n md: 'ds:size-10',\n lg: 'ds:size-12',\n};\n\nconst SHAPE_CLASS: Record<\n NonNullable<ImageCellRendererParams['shape']>,\n string\n> = {\n square: 'ds:rounded-none',\n rounded: 'ds:rounded-[var(--radius-md)]',\n circle: 'ds:rounded-[var(--radius-full)]',\n};\n\nfunction readField(row: unknown, field: string): string | undefined {\n if (!row || typeof row !== 'object') return undefined;\n const value = (row as Record<string, unknown>)[field];\n return typeof value === 'string' ? value : undefined;\n}\n\n// Accept http(s), image data: URLs, and same-origin absolute paths. Reject\n// `javascript:` / `vbscript:` / any other smuggled scheme. Browsers won't\n// execute non-image data: URLs in `<img>`, but rejecting them in JS gives a\n// single audit point.\n//\n// A leading `/` cannot carry a scheme, so a root-relative path is at least as\n// safe as an absolute URL — and it is what an app serving its own images\n// naturally produces. `//host/x` IS excluded: protocol-relative URLs are\n// cross-origin, which is the thing this guard exists to control.\nconst SAFE_SRC_RE = /^(?:https?:|data:image\\/|\\/(?!\\/))/i;\n\nfunction sanitizeSrc(raw: string | undefined): string | undefined {\n if (!raw) return undefined;\n const trimmed = raw.trim();\n if (trimmed.length === 0) return undefined;\n return SAFE_SRC_RE.test(trimmed) ? trimmed : undefined;\n}\n\nexport function ImageCellRenderer<TData = unknown>(\n props: CustomCellRendererProps<TData> & ImageCellRendererParams,\n) {\n const {\n data,\n srcField,\n altField,\n fallbackField,\n size = 'md',\n shape = 'rounded',\n } = props;\n\n if (!data) return null;\n\n const rawSrc = readField(data, srcField);\n const src = sanitizeSrc(rawSrc);\n const alt = altField ? (readField(data, altField) ?? '') : '';\n const fallbackName = fallbackField\n ? readField(data, fallbackField)\n : undefined;\n\n // A circular image with a name is a person: let <Avatar> own it. It paints the\n // initials first, covers them once the photo decodes, and drops the <img> on\n // error so the initials persist — instead of a blank cell that later pops.\n if (shape === 'circle' && fallbackName) {\n return <Avatar src={src} name={fallbackName} size={size} />;\n }\n\n if (!src) {\n if (fallbackName) {\n return <Avatar name={fallbackName} size={size} />;\n }\n return null;\n }\n\n return (\n <img\n src={src}\n alt={alt}\n loading=\"lazy\"\n decoding=\"async\"\n className={['ds:object-cover', SIZE_CLASS[size], SHAPE_CLASS[shape]].join(\n ' ',\n )}\n />\n );\n}\n","import type { CustomCellRendererProps } from 'ag-grid-react';\nimport { useTranslation } from 'react-i18next';\nimport { Tag } from '../../tag/tag';\nimport { Tooltip } from '../../tooltip';\n\nexport interface TagListCellRendererParams {\n maxVisible?: number;\n}\n\nexport function TagListCellRenderer(\n props: CustomCellRendererProps<unknown, string[]> & TagListCellRendererParams,\n) {\n const { value, maxVisible = 3 } = props;\n const { t } = useTranslation();\n\n if (!Array.isArray(value) || value.length === 0) return null;\n\n const visible = value.slice(0, maxVisible);\n const overflow = value.length - maxVisible;\n\n return (\n <span className=\"ds:inline-flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {visible.map((tag) => (\n <Tag key={tag} label={tag} size=\"sm\" />\n ))}\n {overflow > 0 && (\n <Tooltip label={value.slice(maxVisible).join(', ')}>\n <Tag\n label={t('inputs.multiSelect.overflow', { count: overflow })}\n size=\"sm\"\n variant=\"neutral\"\n fill=\"outline\"\n />\n </Tooltip>\n )}\n </span>\n );\n}\n","import type { CustomCellRendererProps } from 'ag-grid-react';\nimport { Timestamp } from '../../timestamp';\n\nexport type DateCellFormat = 'date' | 'time' | 'datetime' | 'relative';\n\nexport interface DateCellRendererParams {\n /** Which preset to use. Default `'date'`. */\n format?: DateCellFormat;\n /** Escape hatch — overrides the preset entirely. */\n options?: Intl.DateTimeFormatOptions;\n}\n\nconst PRESETS: Record<\n Exclude<DateCellFormat, 'relative'>,\n Intl.DateTimeFormatOptions\n> = {\n date: { year: 'numeric', month: 'short', day: 'numeric' },\n time: { hour: '2-digit', minute: '2-digit' },\n datetime: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n },\n};\n\nexport function DateCellRenderer(\n props: CustomCellRendererProps & DateCellRendererParams,\n) {\n const { value, format = 'date', options } = props;\n if (value == null || value === '') return null;\n\n // `shape=\"bare\"` keeps the cell font inherited from --ag-font-size. Timestamp\n // still emits a proper `<time dateTime>` for assistive tech and feeds.\n if (format === 'relative' && !options) {\n return <Timestamp value={value as string | Date} shape=\"bare\" />;\n }\n\n return (\n <Timestamp\n value={value as string | Date}\n format=\"absolute\"\n shape=\"bare\"\n absoluteFormat={\n options ?? PRESETS[format === 'relative' ? 'date' : format]\n }\n />\n );\n}\n","import type { MouseEvent } from 'react';\nimport type { CustomCellRendererProps } from 'ag-grid-react';\n\ntype Getter<T, TData> = T | ((data: TData) => T | undefined);\n\nexport interface LinkCellRendererParams<TData = unknown> {\n /** Anchor href — or a function that derives it from the row. */\n href?: Getter<string, TData>;\n /** Fallback / additional onClick. Prevents default when provided without href. */\n onClick?: (data: TData) => void;\n /** Small text rendered below the link — supports a row-aware function. */\n secondary?: Getter<string, TData>;\n}\n\nfunction resolve<T, TData>(\n source: Getter<T, TData> | undefined,\n data: TData,\n): T | undefined {\n if (typeof source === 'function') {\n return (source as (data: TData) => T | undefined)(data);\n }\n return source;\n}\n\nfunction safeHref(href: string): string {\n return /^(https?:\\/\\/|\\/|#|mailto:|tel:)/i.test(href) ? href : '#';\n}\n\nexport function LinkCellRenderer<TData = unknown>(\n props: CustomCellRendererProps<TData> & LinkCellRendererParams<TData>,\n) {\n const { value, data, href, onClick, secondary } = props;\n if (!data) return null;\n\n const resolvedHref = resolve(href, data);\n const resolvedSecondary = resolve(secondary, data);\n const content = value == null || value === '' ? '' : String(value);\n\n const linkClasses = [\n 'ds:text-[color:var(--primary)]',\n 'ds:hover:underline',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)]',\n 'ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:rounded-[var(--radius-sm)]',\n ].join(' ');\n\n const handleClick = (event: MouseEvent) => {\n if (!onClick) return;\n if (!resolvedHref) event.preventDefault();\n event.stopPropagation();\n onClick(data);\n };\n\n return (\n <span className=\"ds:flex ds:flex-col ds:leading-tight\">\n {resolvedHref ? (\n <a\n href={safeHref(resolvedHref)}\n onClick={handleClick}\n className={linkClasses}\n >\n {content}\n </a>\n ) : (\n <button\n type=\"button\"\n onClick={handleClick}\n className={[\n 'ds:appearance-none ds:bg-transparent ds:p-0 ds:text-start',\n linkClasses,\n ].join(' ')}\n >\n {content}\n </button>\n )}\n {resolvedSecondary ? (\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)]\">\n {resolvedSecondary}\n </span>\n ) : null}\n </span>\n );\n}\n"],"names":["toIsoDate","d","fromIsoDate","s","DateRangeFilter","props","model","onModelChange","getValue","doesRowPassOtherFilter","filterParams","_a","range","setRange","useState","useEffect","useGridFilter","params","from","to","cellValue","cellDate","apply","next","jsx","DateRangePicker","DateRangeFloatingFilter","column","_b","toValueKey","v","LABEL_COLLATOR","collectColumnOptions","api","readValue","seen","node","raw","value","key","b","sameOptions","a","opt","i","useSelectFilterOptions","options","explicit","hasExplicit","derived","setDerived","readValueRef","useRef","recompute","prev","SelectFilter","placeholder","t","useTranslation","useCallback","derivedOptions","initialSelected","useMemo","set","incoming","pending","setPending","active","toggle","optionKey","values","clear","placeholderLabel","jsxs","ScrollArea","option","Checkbox","Button","SelectFloatingFilter","colDef","availableOptions","accessibleLabel","valueByKey","map","selectOptions","currentValue","handleChange","k","original","MultiSelect","normalise","TypeaheadFilter","loadOptions","adapterLoadOptions","query","opts","o","q","draft","setDraft","target","handleSelect","Autocomplete","TypeaheadFloatingFilter","ALL_OPERATORS","operatorTakesValue","op","operatorTakesRange","evaluate","cell","primary","secondary","lo","hi","coerceCell","n","NumberFilter","defaultOperator","min","max","step","initialOperator","operator","setOperator","setPrimary","setSecondary","operatorOptions","showValue","showRange","Select","NumberInput","NumberFloatingFilter","handle","StatusCellRenderer","variantMap","variant","Badge","UserCellRenderer","Avatar","SIZE_CLASS","SHAPE_CLASS","readField","row","field","SAFE_SRC_RE","sanitizeSrc","trimmed","ImageCellRenderer","data","srcField","altField","fallbackField","size","shape","rawSrc","src","alt","fallbackName","TagListCellRenderer","maxVisible","visible","overflow","tag","Tag","Tooltip","PRESETS","DateCellRenderer","format","Timestamp","resolve","source","safeHref","href","LinkCellRenderer","onClick","resolvedHref","resolvedSecondary","content","linkClasses","handleClick","event"],"mappings":";;;;;;;;;;;;;;;;;AA4CA,SAASA,EAAUC,GAAoC;AACrD,SAAKA,IACEA,EAAE,YAAA,EAAc,MA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sB;AACzC,IAAKN,MACAC,KAAcK,EAAM,eAAA,GACzBA,EAAM,gBAAA,GACNN,EAAQ1B,CAAI;AAAA,EACd;AAEA,SACE,gBAAA3E,EAAC,QAAA,EAAK,WAAU,wCACb,UAAA;AAAA,IAAAsG,IACC,gBAAAvJ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAMmJ,GAASI,CAAY;AAAA,QAC3B,SAASI;AAAA,QACT,WAAWD;AAAA,QAEV,UAAAD;AAAA,MAAA;AAAA,IAAA,IAGH,gBAAAzJ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS2J;AAAA,QACT,WAAW;AAAA,UACT;AAAA,UACAD;AAAA,QAAA,EACA,KAAK,GAAG;AAAA,QAET,UAAAD;AAAA,MAAA;AAAA,IAAA;AAAA,IAGJD,IACC,gBAAAxJ,EAAC,QAAA,EAAK,WAAU,qDACb,aACH,IACE;AAAA,EAAA,GACN;AAEJ;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"notes-panel-e9cJWVRg.js","sources":["../../src/components/notes-panel/notes-panel.agent.ts","../../src/components/notes-panel/notes-panel.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — NotesPanel. */\n/* */\n/* The Notes tool: a composer over a note timeline. The agent reads the */\n/* timeline STRUCTURE (note ids + pinned / flagged / clinical flags — */\n/* never the note body or author, both PHI), composes and commits a new */\n/* note, and toggles a note's pinned / flagged state. `add_note` carries */\n/* the `phi` safety class: a note body is patient-identifiable clinical */\n/* content, so the host gates it behind the same confirm-before-act as a */\n/* destructive write and never auto-confirms. A clinical submission also */\n/* requires the host's `practice_add_clinical_note` permission (the */\n/* handle drops it when the gate is closed). */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { NotesPanelHandle } from './notes-panel';\n\nexport const notesPanelAgent: AgentAdapter<NotesPanelHandle> = {\n id: 'notes-panel',\n // 'submit' backs add_note (compose + commit a note). pin / flag are toggles\n // with no dedicated capability in the closed vocabulary.\n capabilities: ['submit'],\n state: {\n notes: {\n type: 'Array<{ id?: string; pinned: boolean; flagged: boolean; clinical: boolean }>',\n descriptionKey: 'ui.agent.notesPanel.state.notes',\n description:\n 'Timeline note ids + pinned / flagged / clinical flags. Never the note body or author (both PHI).',\n read: (handle) => handle.getNotes(),\n },\n canAddClinical: {\n type: 'boolean',\n descriptionKey: 'ui.agent.notesPanel.state.canAddClinical',\n description:\n 'Whether the current user may write clinical notes (the practice_add_clinical_note permission gate).',\n read: (handle) => handle.canAddClinical(),\n },\n currentNoteId: {\n type: 'string | null',\n descriptionKey: 'ui.agent.notesPanel.state.currentNoteId',\n description:\n 'Id of the note the host has addressed — the one marked, scrolled to and focused. Null when none is. An id only, never note content.',\n read: (handle) => handle.getCurrentNoteId(),\n },\n },\n actions: {\n add_note: {\n // Writes a clinical/admin note body — patient-identifiable content. PHI.\n safety: 'phi',\n argsType: '{ content: string; clinical: boolean }',\n argsSchema: {\n type: 'object',\n properties: {\n content: {\n type: 'string',\n description:\n 'Note body. Rich HTML for the rich composer, else plain text.',\n },\n clinical: {\n type: 'boolean',\n description:\n 'Whether the note is clinical. Requires the clinical-note permission; the submission is dropped when the gate is closed.',\n },\n },\n required: ['content', 'clinical'],\n },\n openWorld: true,\n descriptionKey: 'ui.agent.notesPanel.actions.addNote',\n description:\n 'Compose and commit a new note. A clinical note requires the clinical-note permission (read canAddClinical first).',\n examples: [\n {\n args: { content: 'Patient reported improvement.', clinical: true },\n note: 'Add a clinical note.',\n },\n ],\n invoke: (handle, args: { content: string; clinical: boolean }) => {\n handle.addNote(args);\n },\n },\n toggle_pin: {\n // Re-orders the timeline (pinned notes lead) — reversible view write.\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: false,\n descriptionKey: 'ui.agent.notesPanel.actions.togglePin',\n description: 'Toggle the pinned state of the note with the given id.',\n invoke: (handle, args: { id: string }) => {\n handle.togglePin(args.id);\n },\n },\n toggle_flag: {\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: false,\n descriptionKey: 'ui.agent.notesPanel.actions.toggleFlag',\n description: 'Toggle the flagged state of the note with the given id.',\n invoke: (handle, args: { id: string }) => {\n handle.toggleFlag(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'notes-panel',\n description: 'Marks the NotesPanel region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific notes panel from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { notesPanelAgent } from './notes-panel.agent';\nimport { ClinicalNoteCard } from '../clinical-note-card';\nimport type { ClinicalNoteCardProps } from '../clinical-note-card';\nimport { RichTextEditor } from '../rich-text-editor';\nimport type {\n RichTextEditorHandle,\n RichTextEditorProps,\n RichTextEditorToolbar,\n RedactorFactory,\n} from '../rich-text-editor';\nimport { TextArea } from '../text-area';\nimport { Button } from '../button';\nimport { Checkbox } from '../checkbox';\nimport { NotebookPen } from 'lucide-react';\nimport { PanelHeader } from '../panel-header';\n\n/* ------------------------------------------------------------------ */\n/* NotesPanel — the Notes tool for the Control Room rail. */\n/* */\n/* A composer over an elevated ClinicalNoteCard timeline. Drops */\n/* into a ControlRoomRail tool `panel`, the patient profile, or the */\n/* care-plan editor — anywhere notes about the open entity belong. */\n/* The composer is the kit RichTextEditor by default (degrades to a */\n/* textarea where Redactor is absent), carries a permission-gated */\n/* \"clinical note\" toggle, and forwards the editor's AI affordances. */\n/* The note attaches to whatever entity the host is showing — the */\n/* host owns the attachment; the panel only emits content + clinical. */\n/* Pinned notes lead; pin / flag are inline per-note toggles. */\n/* ------------------------------------------------------------------ */\n\n/**\n * One note in the panel — the data subset of `ClinicalNoteCard`.\n *\n * `aria-label` names the card for assistive tech. Set it whenever a row is not\n * a clinical note: the card's fallback name is \"Clinical note\", so an entry\n * that is something else (a dated event, an import) is announced as one.\n */\nexport type NotesPanelNote = Pick<\n ClinicalNoteCardProps,\n | 'id'\n | 'dateIso'\n | 'createdAtIso'\n | 'author'\n | 'clinical'\n | 'attachedTo'\n | 'content'\n | 'contentFormat'\n | 'pinned'\n | 'flagged'\n | 'aria-label'\n>;\n\n/**\n * Curated agent handle for NotesPanel. Reads the note timeline's STRUCTURE\n * (ids + pinned / flagged / clinical flags — never the note body or author,\n * both PHI) and drives the composer + per-note toggles. See\n * `notes-panel.agent.ts`.\n */\nexport interface NotesPanelHandle {\n /** Timeline snapshot — ids + flags only, never note content (PHI). */\n getNotes: () => Array<{\n id?: string;\n pinned: boolean;\n flagged: boolean;\n clinical: boolean;\n }>;\n /** Whether the composer is mounted (onAddNote is wired). */\n canAddNote: () => boolean;\n /** Whether clinical notes may be written (the permission gate). */\n canAddClinical: () => boolean;\n /** Id of the note the host has addressed, or null when none is. */\n getCurrentNoteId: () => string | null;\n /** Commit a new note with explicit content (mirrors the composer's submit). */\n addNote: (submission: NotesPanelSubmission) => void;\n /** Toggle a note's pinned state (mirrors onTogglePin). */\n togglePin: (id: string) => void;\n /** Toggle a note's flagged state (mirrors onToggleFlag). */\n toggleFlag: (id: string) => void;\n}\n\n/** Payload handed to `onAddNote` when the composer commits. */\nexport interface NotesPanelSubmission {\n /** The note body — rich HTML (`composer='rich'`) or plain text. */\n content: string;\n /** Whether the \"clinical note\" toggle was set. */\n clinical: boolean;\n}\n\nexport interface NotesPanelProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific notes panel.\n */\n id?: string;\n /** Notes to render, newest-first by convention. Pinned notes lead. */\n notes: NotesPanelNote[];\n /** Commit a new note. Omit to hide the composer (read-only timeline). */\n onAddNote?: (submission: NotesPanelSubmission) => void;\n /**\n * The note the reader ASKED for, addressed by id from somewhere else in the\n * record — a marker in a chart, a row in a grid, an agent. The panel marks\n * it, scrolls it to the middle of its own scroll region and moves focus to\n * it, and renders it unclamped so the thing that was asked for is readable\n * in full without a second click.\n *\n * Opening a panel is not the same as answering a question: a rail's\n * `setActiveTool` moves no focus and announces nothing, so a control whose\n * name promises \"in the notes panel\" produces no perceivable change for a\n * keyboard or screen-reader reader unless the panel lands them on the note.\n * That is what this prop is for; without it, a host has to reach into the\n * panel's DOM to do the same job.\n *\n * Marked on three channels, never colour alone (WCAG 1.4.1): a solid\n * inline-start bar the other notes do not have, a tinted gutter, and\n * `aria-current` plus a visually-hidden sentence naming the mark.\n *\n * Ids that match no note are ignored. To address the SAME note twice — the\n * reader pressing the same marker again after scrolling away — bump\n * `currentNoteKey` alongside it; this prop alone is a value, not a request.\n */\n currentNoteId?: string;\n /**\n * Bump on every address to re-scroll and re-focus the note in `currentNoteId`\n * even when the id has not changed.\n *\n * Addressing is a request, not a value: a reader who presses the same marker\n * a second time (having scrolled away, or having moved focus off the note) is\n * asking to be taken back, and a control whose name promises the notes panel\n * must do something perceivable every time it is pressed. Without this the\n * second press is inert — the panel is already showing that note, so nothing\n * re-runs. Hosts increment a counter in the same handler that opens the tool.\n */\n currentNoteKey?: string | number;\n\n /* ----- Composer ----- */\n /**\n * `'rich'` (default) mounts the kit `RichTextEditor` (Redactor; degrades to a\n * textarea where Redactor is absent). `'plain'` keeps a simple `TextArea` for\n * lightweight surfaces / deterministic tests.\n */\n composer?: 'rich' | 'plain';\n /** Toolbar preset for the rich composer. Defaults to `'standard'`. */\n editorToolbar?: RichTextEditorToolbar;\n /** Inject the Redactor factory for the rich composer (else `window.$R`). */\n redactor?: RedactorFactory;\n /** Consumer image-upload endpoint for the rich composer. */\n imageUploadUrl?: string;\n\n /* ----- Clinical flag (permission-gated) ----- */\n /** Show the \"clinical note\" toggle in the composer. Default `true`. */\n showClinicalToggle?: boolean;\n /**\n * Permission gate — when `false` the clinical toggle is disabled and shows\n * `clinicalGatedReason` on hover/focus. Mirrors platform's\n * `practice_add_clinical_note` permission. Default `true`.\n */\n canAddClinicalNote?: boolean;\n /** Tooltip shown when the clinical toggle is gated off. */\n clinicalGatedReason?: string;\n /** Initial state of the clinical toggle. Default `false`. */\n defaultClinical?: boolean;\n\n /* ----- AI assistance (forwarded to RichTextEditor) ----- */\n onRequestAiDraft?: RichTextEditorProps['onRequestAiDraft'];\n aiDraftFormat?: RichTextEditorProps['aiDraftFormat'];\n aiPrivacyNotice?: RichTextEditorProps['aiPrivacyNotice'];\n onDictate?: RichTextEditorProps['onDictate'];\n onProofread?: RichTextEditorProps['onProofread'];\n onAutoFormat?: RichTextEditorProps['onAutoFormat'];\n\n /* ----- Per-note actions ----- */\n /** Toggle a note's pinned state — renders an inline pin button per note. */\n onTogglePin?: (id: string) => void;\n /** Toggle a note's flagged state — renders an inline flag button per note. */\n onToggleFlag?: (id: string) => void;\n\n /* ----- Labels / chrome ----- */\n /** Panel heading. Defaults to the localised \"Notes\". */\n title?: string;\n /** Composer placeholder. */\n composerPlaceholder?: string;\n /** Save-button label. */\n addNoteLabel?: string;\n /** Rendered when there are no notes. */\n emptyState?: ReactNode;\n /** Accessible name for the panel region (defaults to `title`). */\n 'aria-label'?: string;\n}\n\n/* The timeline row. The addressed note wears a solid inline-start bar the\n others do not — a shape channel, so the mark is not colour alone. Every row\n reserves the bar's width in `transparent`, so marking one shifts nothing. */\nconst noteItemVariants = cva(\n 'ds:flex ds:flex-col ds:rounded-[var(--radius-md)] ds:border-s-2 ds:ps-[var(--spacing-sm)]',\n {\n variants: {\n current: {\n true: 'ds:border-[color:var(--info)] ds:bg-[color:var(--info)]/10 ds:focus:outline-[length:var(--focus-ring-width)] ds:focus:outline-solid ds:focus:outline-[color:var(--ring)] ds:focus:outline-offset-[length:var(--focus-ring-offset)]',\n false: 'ds:border-transparent',\n },\n },\n defaultVariants: { current: false },\n },\n);\n\n/** Strip tags / entities to test whether a rich draft holds real content. */\nfunction hasRichContent(html: string): boolean {\n if (!html) return false;\n if (/<img\\b/i.test(html)) return true;\n return (\n html\n .replace(/<[^>]*>/g, '')\n .replace(/&nbsp;/gi, ' ')\n .trim().length > 0\n );\n}\n\nexport const NotesPanel = forwardRef<HTMLElement, NotesPanelProps>(\n function NotesPanel(\n {\n id,\n notes,\n onAddNote,\n currentNoteId,\n currentNoteKey,\n composer = 'rich',\n editorToolbar = 'standard',\n redactor,\n imageUploadUrl,\n showClinicalToggle = true,\n canAddClinicalNote = true,\n clinicalGatedReason,\n defaultClinical = false,\n onRequestAiDraft,\n aiDraftFormat,\n aiPrivacyNotice,\n onDictate,\n onProofread,\n onAutoFormat,\n onTogglePin,\n onToggleFlag,\n title,\n composerPlaceholder,\n addNoteLabel,\n emptyState,\n className,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation();\n const editorRef = useRef<RichTextEditorHandle>(null);\n const [draft, setDraft] = useState('');\n const [clinical, setClinical] = useState(defaultClinical);\n\n const heading = title ?? t('notesPanel.title', { defaultValue: 'Notes' });\n const headingId = useId();\n const placeholder =\n composerPlaceholder ??\n t('notesPanel.placeholder', { defaultValue: 'Add a note…' });\n const composerLabel = t('notesPanel.composerLabel', {\n defaultValue: 'New note',\n });\n\n // Live content check: plain reads the draft directly; rich strips the draft\n // (debounced) for the disabled state but commits from the editor handle.\n const hasContent =\n composer === 'rich' ? hasRichContent(draft) : draft.trim().length > 0;\n\n const commit = useCallback(() => {\n if (!onAddNote) return;\n if (composer === 'rich') {\n const html = editorRef.current?.getHTML() ?? draft;\n if (!hasRichContent(html)) return;\n onAddNote({ content: html, clinical });\n editorRef.current?.clear();\n } else {\n const text = draft.trim();\n if (!text) return;\n onAddNote({ content: text, clinical });\n }\n setDraft('');\n setClinical(defaultClinical);\n }, [composer, draft, clinical, defaultClinical, onAddNote]);\n\n // Pinned notes lead; order within each group is preserved.\n const ordered = [...notes].sort(\n (a, b) => Number(b.pinned ?? false) - Number(a.pinned ?? false),\n );\n\n /* ----- The addressed note (see `currentNoteId`) ----- */\n const currentItemRef = useRef<HTMLLIElement>(null);\n useEffect(() => {\n if (!currentNoteId) return;\n // `center`, not `nearest`: nearest parks the note flush against the edge\n // of the scroll region, which is the least readable place to land.\n currentItemRef.current?.scrollIntoView({ block: 'center' });\n currentItemRef.current?.focus();\n // `currentNoteKey` is in the deps so a REPEAT address of the same note\n // re-runs — see the prop doc. Addressing is a request, not a value.\n }, [currentNoteId, currentNoteKey]);\n\n /* ----- Agent handle (structural reads + composer / toggles) ----- */\n const notesRef = useRef(notes);\n notesRef.current = notes;\n const onAddNoteRef = useRef(onAddNote);\n onAddNoteRef.current = onAddNote;\n const onTogglePinRef = useRef(onTogglePin);\n onTogglePinRef.current = onTogglePin;\n const onToggleFlagRef = useRef(onToggleFlag);\n onToggleFlagRef.current = onToggleFlag;\n const canAddClinicalRef = useRef(canAddClinicalNote);\n canAddClinicalRef.current = canAddClinicalNote;\n const currentNoteIdRef = useRef(currentNoteId);\n currentNoteIdRef.current = currentNoteId;\n\n const rootRef = useRef<HTMLElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLElement, []);\n\n const handle = useMemo<NotesPanelHandle>(\n () => ({\n // Ids + flags only — never the note body or author (both PHI).\n getNotes: () =>\n notesRef.current.map((n) => ({\n id: n.id,\n pinned: !!n.pinned,\n flagged: !!n.flagged,\n clinical: !!n.clinical,\n })),\n canAddNote: () => !!onAddNoteRef.current,\n canAddClinical: () => canAddClinicalRef.current,\n getCurrentNoteId: () => currentNoteIdRef.current ?? null,\n addNote: (submission) => {\n // A clinical submission requires the permission gate to be open.\n if (submission.clinical && !canAddClinicalRef.current) return;\n onAddNoteRef.current?.(submission);\n },\n togglePin: (noteId) => onTogglePinRef.current?.(noteId),\n toggleFlag: (noteId) => onToggleFlagRef.current?.(noteId),\n }),\n [],\n );\n useAgentRegistration(notesPanelAgent, handle, id);\n\n return (\n <section\n ref={rootRef}\n data-component=\"notes-panel\"\n data-component-id={id}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel}\n className={['ds:flex ds:flex-col', className].filter(Boolean).join(' ')}\n {...rest}\n >\n {/* Shared rail header — pins to the top of the panel's scroll region\n while the composer + note timeline scroll beneath it. The rail\n injects the favourite / close actions via PanelHeaderActionsProvider. */}\n <PanelHeader\n title={heading}\n icon={<NotebookPen aria-hidden=\"true\" />}\n headingId={ariaLabel ? undefined : headingId}\n sticky\n divider\n />\n\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]\">\n {onAddNote ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {composer === 'rich' ? (\n <RichTextEditor\n ref={editorRef}\n ariaLabel={composerLabel}\n placeholder={placeholder}\n toolbar={editorToolbar}\n minHeight=\"sm\"\n redactor={redactor}\n imageUploadUrl={imageUploadUrl}\n onChange={({ html }) => setDraft(html)}\n onRequestAiDraft={onRequestAiDraft}\n aiDraftFormat={aiDraftFormat}\n aiPrivacyNotice={aiPrivacyNotice}\n onDictate={onDictate}\n onProofread={onProofread}\n onAutoFormat={onAutoFormat}\n />\n ) : (\n <TextArea\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n placeholder={placeholder}\n autoResize\n minRows={2}\n maxRows={6}\n aria-label={composerLabel}\n />\n )}\n <div\n className={[\n 'ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]',\n showClinicalToggle ? 'ds:justify-between' : 'ds:justify-end',\n ].join(' ')}\n >\n {showClinicalToggle ? (\n <Checkbox\n size=\"sm\"\n label={t('notesPanel.clinicalToggle', {\n defaultValue: 'Clinical note',\n })}\n checked={clinical}\n onCheckedChange={(next) => setClinical(next === true)}\n disabled={!canAddClinicalNote}\n disabledReason={\n canAddClinicalNote\n ? undefined\n : (clinicalGatedReason ??\n t('notesPanel.clinicalGated', {\n defaultValue:\n 'You do not have permission to write clinical notes.',\n }))\n }\n />\n ) : null}\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={commit}\n disabled={!hasContent}\n >\n {addNoteLabel ??\n t('notesPanel.add', { defaultValue: 'Add note' })}\n </Button>\n </div>\n </div>\n ) : null}\n\n {ordered.length > 0 ? (\n <ul className=\"ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0\">\n {ordered.map((note, index) => {\n const isCurrent =\n currentNoteId != null && note.id === currentNoteId;\n return (\n <li\n key={note.id ?? index}\n ref={isCurrent ? currentItemRef : undefined}\n // Focus lands on the row, not inside the card, so the\n // sentence below and `aria-current` are read out before the\n // note — and the rail's own Escape still bubbles.\n tabIndex={isCurrent ? -1 : undefined}\n aria-current={isCurrent ? 'true' : undefined}\n className={noteItemVariants({ current: isCurrent })}\n >\n {isCurrent ? (\n <span className=\"ds:sr-only\">\n {t('notesPanel.current', {\n defaultValue: 'Current note',\n })}\n </span>\n ) : null}\n {/* Elevated card per note; the list gap (not a separator)\n spaces them. Bodies clamp to five lines with read-more —\n except the addressed one, which is what the reader came\n for and opens in full. */}\n <ClinicalNoteCard\n surface=\"elevated\"\n truncate={!isCurrent}\n {...note}\n onTogglePin={\n onTogglePin && note.id\n ? () => onTogglePin(note.id as string)\n : undefined\n }\n onToggleFlag={\n onToggleFlag && note.id\n ? () => onToggleFlag(note.id as string)\n : undefined\n }\n />\n </li>\n );\n })}\n </ul>\n ) : (\n (emptyState ?? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('notesPanel.empty', { defaultValue: 'No notes yet.' })}\n </p>\n ))\n )}\n </div>\n </section>\n );\n },\n);\n"],"names":["notesPanelAgent","handle","args","noteItemVariants","cva","hasRichContent","html","NotesPanel","forwardRef","id","notes","onAddNote","currentNoteId","currentNoteKey","composer","editorToolbar","redactor","imageUploadUrl","showClinicalToggle","canAddClinicalNote","clinicalGatedReason","defaultClinical","onRequestAiDraft","aiDraftFormat","aiPrivacyNotice","onDictate","onProofread","onAutoFormat","onTogglePin","onToggleFlag","title","composerPlaceholder","addNoteLabel","emptyState","className","ariaLabel","rest","ref","t","useTranslation","editorRef","useRef","draft","setDraft","useState","clinical","setClinical","heading","headingId","useId","placeholder","composerLabel","hasContent","commit","useCallback","_a","_b","text","ordered","a","b","currentItemRef","useEffect","notesRef","onAddNoteRef","onTogglePinRef","onToggleFlagRef","canAddClinicalRef","currentNoteIdRef","rootRef","useImperativeHandle","useMemo","n","submission","noteId","useAgentRegistration","jsxs","jsx","PanelHeader","NotebookPen","RichTextEditor","TextArea","event","Checkbox","next","Button","note","index","isCurrent","ClinicalNoteCard"],"mappings":";;;;;;;;;;;;AAiBO,MAAMA,KAAkD;AAAA,EAC7D,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,QAAQ;AAAA,EACvB,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,eAAA;AAAA,IAAe;AAAA,IAE1C,eAAe;AAAA,MACb,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,iBAAA;AAAA,IAAiB;AAAA,EAC5C;AAAA,EAEF,SAAS;AAAA,IACP,UAAU;AAAA;AAAA,MAER,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,SAAS;AAAA,YACP,MAAM;AAAA,YACN,aACE;AAAA,UAAA;AAAA,UA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