@alfadocs/ui-kit-debug 1.36.0 → 1.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/dist/_chunks/appointment-peek-5S4O1VQP.js +115 -0
  2. package/dist/_chunks/appointment-peek-5S4O1VQP.js.map +1 -0
  3. package/dist/_chunks/appointment-peek.agent-C539tNFM.js +17 -0
  4. package/dist/_chunks/appointment-peek.agent-C539tNFM.js.map +1 -0
  5. package/dist/_chunks/building-2-D33bLCWL.js +24 -0
  6. package/dist/_chunks/building-2-D33bLCWL.js.map +1 -0
  7. package/dist/_chunks/calendar-workspace-BqKBj26r.js +9715 -0
  8. package/dist/_chunks/calendar-workspace-BqKBj26r.js.map +1 -0
  9. package/dist/_chunks/{control-room-rail-Ds45_g4f.js → control-room-rail-DQoHdE1U.js} +2 -2
  10. package/dist/_chunks/{control-room-rail-Ds45_g4f.js.map → control-room-rail-DQoHdE1U.js.map} +1 -1
  11. package/dist/_chunks/editable-description-BOfAeY3T.js +112 -0
  12. package/dist/_chunks/editable-description-BOfAeY3T.js.map +1 -0
  13. package/dist/_chunks/editable-description.agent-Bm_LBV2j.js +21 -0
  14. package/dist/_chunks/editable-description.agent-Bm_LBV2j.js.map +1 -0
  15. package/dist/_chunks/{money.agent-Dw55UxUA.js → money-BY-HmKhZ.js} +33 -47
  16. package/dist/_chunks/money-BY-HmKhZ.js.map +1 -0
  17. package/dist/_chunks/money.agent-BjJ6gOkx.js +17 -0
  18. package/dist/_chunks/money.agent-BjJ6gOkx.js.map +1 -0
  19. package/dist/_chunks/notes-panel-4y5JioWN.js +556 -0
  20. package/dist/_chunks/notes-panel-4y5JioWN.js.map +1 -0
  21. package/dist/_chunks/panel-subview-BNXN8OEL.js +160 -0
  22. package/dist/_chunks/panel-subview-BNXN8OEL.js.map +1 -0
  23. package/dist/_chunks/panel-subview.agent-BIBvE-IW.js +17 -0
  24. package/dist/_chunks/panel-subview.agent-BIBvE-IW.js.map +1 -0
  25. package/dist/_chunks/{patient-details-f7SSXkTJ.js → patient-details-2cIaL-Zb.js} +2 -2
  26. package/dist/_chunks/{patient-details-f7SSXkTJ.js.map → patient-details-2cIaL-Zb.js.map} +1 -1
  27. package/dist/_chunks/{patient-field-row-BQZoP4m2.js → patient-field-row-IHb2VFc2.js} +193 -172
  28. package/dist/_chunks/patient-field-row-IHb2VFc2.js.map +1 -0
  29. package/dist/_chunks/{patient-summary-card-Bz7KdUin.js → patient-summary-card-BzmJH9a-.js} +2 -2
  30. package/dist/_chunks/{patient-summary-card-Bz7KdUin.js.map → patient-summary-card-BzmJH9a-.js.map} +1 -1
  31. package/dist/_chunks/{section-card.agent-W18CHEgX.js → section-card-XR2bW1Ie.js} +20 -34
  32. package/dist/_chunks/{section-card.agent-W18CHEgX.js.map → section-card-XR2bW1Ie.js.map} +1 -1
  33. package/dist/_chunks/section-card.agent-Bz1BhM_j.js +17 -0
  34. package/dist/_chunks/section-card.agent-Bz1BhM_j.js.map +1 -0
  35. package/dist/_chunks/smartphone-DaPcFw-X.js +32 -0
  36. package/dist/_chunks/smartphone-DaPcFw-X.js.map +1 -0
  37. package/dist/_chunks/{task-card-BalrLkSz.js → task-card-qTKD1fIT.js} +39 -57
  38. package/dist/_chunks/task-card-qTKD1fIT.js.map +1 -0
  39. package/dist/_chunks/{task-tray-wl9eti6J.js → task-tray-CQ8UAR2j.js} +2 -2
  40. package/dist/_chunks/{task-tray-wl9eti6J.js.map → task-tray-CQ8UAR2j.js.map} +1 -1
  41. package/dist/_chunks/{tasks-panel-BDNB7hsZ.js → tasks-panel-CBGMtQ_f.js} +2 -2
  42. package/dist/_chunks/{tasks-panel-BDNB7hsZ.js.map → tasks-panel-CBGMtQ_f.js.map} +1 -1
  43. package/dist/_chunks/{tool-rail-Bq5eiFMG.js → tool-rail-BP8sjxCw.js} +310 -231
  44. package/dist/_chunks/tool-rail-BP8sjxCw.js.map +1 -0
  45. package/dist/_chunks/treatment-receipt-D4kOLXOk.js +94 -0
  46. package/dist/_chunks/treatment-receipt-D4kOLXOk.js.map +1 -0
  47. package/dist/_chunks/treatment-receipt.agent-bpFm2RPH.js +21 -0
  48. package/dist/_chunks/treatment-receipt.agent-bpFm2RPH.js.map +1 -0
  49. package/dist/_chunks/use-presence-transition-cDwWUXV-.js +58 -0
  50. package/dist/_chunks/use-presence-transition-cDwWUXV-.js.map +1 -0
  51. package/dist/_chunks/{workflow-map-D-LEni11.js → workflow-map-CXdsxvUj.js} +140 -156
  52. package/dist/_chunks/workflow-map-CXdsxvUj.js.map +1 -0
  53. package/dist/agent-catalog.json +65 -1
  54. package/dist/components/appointment-peek/appointment-peek.agent.d.ts +3 -0
  55. package/dist/components/appointment-peek/appointment-peek.agent.d.ts.map +1 -0
  56. package/dist/components/appointment-peek/appointment-peek.d.ts +45 -0
  57. package/dist/components/appointment-peek/appointment-peek.d.ts.map +1 -0
  58. package/dist/components/appointment-peek/index.d.ts +4 -0
  59. package/dist/components/appointment-peek/index.d.ts.map +1 -0
  60. package/dist/components/appointment-peek/index.js +7 -0
  61. package/dist/components/appointment-peek/index.js.map +1 -0
  62. package/dist/components/control-room-rail/index.js +1 -1
  63. package/dist/components/editable-description/editable-description.agent.d.ts +3 -0
  64. package/dist/components/editable-description/editable-description.agent.d.ts.map +1 -0
  65. package/dist/components/editable-description/editable-description.d.ts +20 -0
  66. package/dist/components/editable-description/editable-description.d.ts.map +1 -0
  67. package/dist/components/editable-description/index.d.ts +4 -0
  68. package/dist/components/editable-description/index.d.ts.map +1 -0
  69. package/dist/components/editable-description/index.js +7 -0
  70. package/dist/components/editable-description/index.js.map +1 -0
  71. package/dist/components/index.d.ts +4 -0
  72. package/dist/components/index.d.ts.map +1 -1
  73. package/dist/components/money/index.js +2 -1
  74. package/dist/components/money/index.js.map +1 -1
  75. package/dist/components/notes-panel/index.js +1 -1
  76. package/dist/components/notes-panel/notes-panel.d.ts +16 -0
  77. package/dist/components/notes-panel/notes-panel.d.ts.map +1 -1
  78. package/dist/components/panel-subview/index.d.ts +4 -0
  79. package/dist/components/panel-subview/index.d.ts.map +1 -0
  80. package/dist/components/panel-subview/index.js +7 -0
  81. package/dist/components/panel-subview/index.js.map +1 -0
  82. package/dist/components/panel-subview/panel-subview.agent.d.ts +3 -0
  83. package/dist/components/panel-subview/panel-subview.agent.d.ts.map +1 -0
  84. package/dist/components/panel-subview/panel-subview.d.ts +32 -0
  85. package/dist/components/panel-subview/panel-subview.d.ts.map +1 -0
  86. package/dist/components/patient-details/index.js +1 -1
  87. package/dist/components/patient-summary-card/index.js +1 -1
  88. package/dist/components/section-card/index.js +4 -3
  89. package/dist/components/section-card/index.js.map +1 -1
  90. package/dist/components/task-card/index.js +1 -1
  91. package/dist/components/task-tray/index.js +1 -1
  92. package/dist/components/tasks-panel/index.js +1 -1
  93. package/dist/components/tool-rail/index.js +1 -1
  94. package/dist/components/tool-rail/tool-rail.d.ts.map +1 -1
  95. package/dist/components/treatment-receipt/index.d.ts +4 -0
  96. package/dist/components/treatment-receipt/index.d.ts.map +1 -0
  97. package/dist/components/treatment-receipt/index.js +7 -0
  98. package/dist/components/treatment-receipt/index.js.map +1 -0
  99. package/dist/components/treatment-receipt/treatment-receipt.agent.d.ts +3 -0
  100. package/dist/components/treatment-receipt/treatment-receipt.agent.d.ts.map +1 -0
  101. package/dist/components/treatment-receipt/treatment-receipt.d.ts +30 -0
  102. package/dist/components/treatment-receipt/treatment-receipt.d.ts.map +1 -0
  103. package/dist/components/workflow/index.js +1 -1
  104. package/dist/hooks/index.d.ts +1 -0
  105. package/dist/hooks/index.d.ts.map +1 -1
  106. package/dist/hooks/index.js +9 -7
  107. package/dist/hooks/index.js.map +1 -1
  108. package/dist/hooks/use-presence-transition.d.ts +40 -0
  109. package/dist/hooks/use-presence-transition.d.ts.map +1 -0
  110. package/dist/host-compat.css +7 -1
  111. package/dist/i18n/locales/ar.d.ts +29 -5
  112. package/dist/i18n/locales/ar.d.ts.map +1 -1
  113. package/dist/i18n/locales/ar.js +29 -5
  114. package/dist/i18n/locales/ar.js.map +1 -1
  115. package/dist/i18n/locales/de.d.ts +29 -5
  116. package/dist/i18n/locales/de.d.ts.map +1 -1
  117. package/dist/i18n/locales/de.js +29 -5
  118. package/dist/i18n/locales/de.js.map +1 -1
  119. package/dist/i18n/locales/el.d.ts +29 -5
  120. package/dist/i18n/locales/el.d.ts.map +1 -1
  121. package/dist/i18n/locales/el.js +29 -5
  122. package/dist/i18n/locales/el.js.map +1 -1
  123. package/dist/i18n/locales/en.d.ts +29 -5
  124. package/dist/i18n/locales/en.d.ts.map +1 -1
  125. package/dist/i18n/locales/en.js +29 -5
  126. package/dist/i18n/locales/en.js.map +1 -1
  127. package/dist/i18n/locales/es.d.ts +29 -5
  128. package/dist/i18n/locales/es.d.ts.map +1 -1
  129. package/dist/i18n/locales/es.js +29 -5
  130. package/dist/i18n/locales/es.js.map +1 -1
  131. package/dist/i18n/locales/fr.d.ts +29 -5
  132. package/dist/i18n/locales/fr.d.ts.map +1 -1
  133. package/dist/i18n/locales/fr.js +29 -5
  134. package/dist/i18n/locales/fr.js.map +1 -1
  135. package/dist/i18n/locales/hi.d.ts +29 -5
  136. package/dist/i18n/locales/hi.d.ts.map +1 -1
  137. package/dist/i18n/locales/hi.js +29 -5
  138. package/dist/i18n/locales/hi.js.map +1 -1
  139. package/dist/i18n/locales/it.d.ts +29 -5
  140. package/dist/i18n/locales/it.d.ts.map +1 -1
  141. package/dist/i18n/locales/it.js +29 -5
  142. package/dist/i18n/locales/it.js.map +1 -1
  143. package/dist/i18n/locales/ja.d.ts +29 -5
  144. package/dist/i18n/locales/ja.d.ts.map +1 -1
  145. package/dist/i18n/locales/ja.js +29 -5
  146. package/dist/i18n/locales/ja.js.map +1 -1
  147. package/dist/i18n/locales/nl.d.ts +29 -5
  148. package/dist/i18n/locales/nl.d.ts.map +1 -1
  149. package/dist/i18n/locales/nl.js +29 -5
  150. package/dist/i18n/locales/nl.js.map +1 -1
  151. package/dist/i18n/locales/pl.d.ts +29 -5
  152. package/dist/i18n/locales/pl.d.ts.map +1 -1
  153. package/dist/i18n/locales/pl.js +29 -5
  154. package/dist/i18n/locales/pl.js.map +1 -1
  155. package/dist/i18n/locales/pt.d.ts +29 -5
  156. package/dist/i18n/locales/pt.d.ts.map +1 -1
  157. package/dist/i18n/locales/pt.js +29 -5
  158. package/dist/i18n/locales/pt.js.map +1 -1
  159. package/dist/i18n/locales/ro.d.ts +29 -5
  160. package/dist/i18n/locales/ro.d.ts.map +1 -1
  161. package/dist/i18n/locales/ro.js +29 -5
  162. package/dist/i18n/locales/ro.js.map +1 -1
  163. package/dist/i18n/locales/ru.d.ts +29 -5
  164. package/dist/i18n/locales/ru.d.ts.map +1 -1
  165. package/dist/i18n/locales/ru.js +29 -5
  166. package/dist/i18n/locales/ru.js.map +1 -1
  167. package/dist/i18n/locales/sq.d.ts +29 -5
  168. package/dist/i18n/locales/sq.d.ts.map +1 -1
  169. package/dist/i18n/locales/sq.js +29 -5
  170. package/dist/i18n/locales/sq.js.map +1 -1
  171. package/dist/i18n/locales/sv.d.ts +29 -5
  172. package/dist/i18n/locales/sv.d.ts.map +1 -1
  173. package/dist/i18n/locales/sv.js +29 -5
  174. package/dist/i18n/locales/sv.js.map +1 -1
  175. package/dist/i18n/locales/tr.d.ts +29 -5
  176. package/dist/i18n/locales/tr.d.ts.map +1 -1
  177. package/dist/i18n/locales/tr.js +29 -5
  178. package/dist/i18n/locales/tr.js.map +1 -1
  179. package/dist/i18n/locales/zh.d.ts +29 -5
  180. package/dist/i18n/locales/zh.d.ts.map +1 -1
  181. package/dist/i18n/locales/zh.js +29 -5
  182. package/dist/i18n/locales/zh.js.map +1 -1
  183. package/dist/index.js +958 -940
  184. package/dist/index.js.map +1 -1
  185. package/dist/locales/ar.json +29 -5
  186. package/dist/locales/de.json +29 -5
  187. package/dist/locales/el.json +29 -5
  188. package/dist/locales/en.json +29 -5
  189. package/dist/locales/es.json +29 -5
  190. package/dist/locales/fr.json +29 -5
  191. package/dist/locales/hi.json +29 -5
  192. package/dist/locales/it.json +29 -5
  193. package/dist/locales/ja.json +29 -5
  194. package/dist/locales/nl.json +29 -5
  195. package/dist/locales/pl.json +29 -5
  196. package/dist/locales/pt.json +29 -5
  197. package/dist/locales/ro.json +29 -5
  198. package/dist/locales/ru.json +29 -5
  199. package/dist/locales/sq.json +29 -5
  200. package/dist/locales/sv.json +29 -5
  201. package/dist/locales/tr.json +29 -5
  202. package/dist/locales/zh.json +29 -5
  203. package/dist/patterns/calendar/calendar-appointment-details.d.ts +15 -6
  204. package/dist/patterns/calendar/calendar-appointment-details.d.ts.map +1 -1
  205. package/dist/patterns/calendar/calendar-appointment-details.sections.d.ts +23 -23
  206. package/dist/patterns/calendar/calendar-appointment-details.sections.d.ts.map +1 -1
  207. package/dist/patterns/calendar/calendar-info-hover.d.ts +18 -0
  208. package/dist/patterns/calendar/calendar-info-hover.d.ts.map +1 -0
  209. package/dist/patterns/calendar/calendar-workspace.d.ts.map +1 -1
  210. package/dist/patterns/calendar/calendar.journey.d.ts +10 -0
  211. package/dist/patterns/calendar/calendar.journey.d.ts.map +1 -1
  212. package/dist/patterns/calendar/calendar.sheets.d.ts +2 -2
  213. package/dist/patterns/calendar/calendar.sheets.d.ts.map +1 -1
  214. package/dist/patterns/calendar/calendar.surface.d.ts.map +1 -1
  215. package/dist/patterns/calendar/index.js +1 -1
  216. package/dist/tokens.css +1 -1
  217. package/package.json +17 -1
  218. package/dist/_chunks/calendar-workspace-Duv_5B4j.js +0 -9471
  219. package/dist/_chunks/calendar-workspace-Duv_5B4j.js.map +0 -1
  220. package/dist/_chunks/hourglass-BEAzW1wE.js +0 -26
  221. package/dist/_chunks/hourglass-BEAzW1wE.js.map +0 -1
  222. package/dist/_chunks/money.agent-Dw55UxUA.js.map +0 -1
  223. package/dist/_chunks/notes-panel-Co8D3uDd.js +0 -469
  224. package/dist/_chunks/notes-panel-Co8D3uDd.js.map +0 -1
  225. package/dist/_chunks/patient-field-row-BQZoP4m2.js.map +0 -1
  226. package/dist/_chunks/smartphone-C0rFF2if.js +0 -15
  227. package/dist/_chunks/smartphone-C0rFF2if.js.map +0 -1
  228. package/dist/_chunks/task-card-BalrLkSz.js.map +0 -1
  229. package/dist/_chunks/tool-rail-Bq5eiFMG.js.map +0 -1
  230. package/dist/_chunks/workflow-map-D-LEni11.js.map +0 -1
@@ -3,7 +3,7 @@ import { useState as _, useCallback as g, useMemo as T, useRef as B, useContext
3
3
  import { useTranslation as po } from "react-i18next";
4
4
  import { I as G } from "./icon-button-8xqRnkdG.js";
5
5
  import { a as fo } from "./panel-header-D_mTdhUp.js";
6
- import { T as mo } from "./tool-rail-Bq5eiFMG.js";
6
+ import { T as mo } from "./tool-rail-BP8sjxCw.js";
7
7
  import { u as go } from "./use-persistent-state-nZwZAnE9.js";
8
8
  import { S as Ro } from "./star-Bf9L2Uot.js";
9
9
  import { X as vo } from "./x-B5YnXwCz.js";
@@ -334,4 +334,4 @@ export {
334
334
  Ho as d,
335
335
  Ko as u
336
336
  };
337
- //# sourceMappingURL=control-room-rail-Ds45_g4f.js.map
337
+ //# sourceMappingURL=control-room-rail-DQoHdE1U.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-room-rail-Ds45_g4f.js","sources":["../../src/components/control-room-rail/control-room-rail.agent.ts","../../src/components/control-room-rail/control-room-context.tsx","../../src/components/control-room-rail/control-room-rail.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — ControlRoomRail. */\n/* */\n/* The product surface built on ToolRail: the docked \"Control Room\". */\n/* It claims its OWN agent identity ('control-room-rail') so an agent and */\n/* the DOM / cascade boundary can tell the Control Room apart from a bare */\n/* ToolRail. Generic rail surface only: open / close a tool's panel and */\n/* read which tool is active. State is strictly the active tool id — never */\n/* any tool's panel CONTENT (which may carry PHI). */\n/* */\n/* The descriptionKeys deliberately REUSE the existing */\n/* `ui.toolRail.agent.*` translations — no new i18n keys are coined this */\n/* pass. */\n/* */\n/* NOTE: pin / unpin / reorder favourites are intentionally NOT yet an */\n/* agent capability. Exposing them is a deferred follow-up: it needs a */\n/* closed-vocabulary capability addition (DS-maintainer approval per */\n/* src/docs/26-agent-readiness.mdx) plus its own 18-locale descriptionKeys */\n/* — neither of which this pass introduces. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ControlRoomRailHandle } from './control-room-rail';\n\nexport const controlRoomRailAgent: AgentAdapter<ControlRoomRailHandle> = {\n id: 'control-room-rail',\n capabilities: ['open', 'close', 'select_single'],\n state: {\n activeToolId: {\n type: 'string | null',\n descriptionKey: 'ui.toolRail.agent.state.activeToolId',\n description:\n 'Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.',\n read: (handle) => handle.getActiveToolId(),\n },\n },\n actions: {\n open: {\n // Pure ephemeral panel state (open) — no data loss, no external effect.\n safety: 'read',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.open',\n description: \"Open the given tool's panel.\",\n examples: [{ args: { id: 'inbox' }, note: 'Open the inbox tool panel.' }],\n invoke: (handle, args: { id: string }) => {\n handle.open(args.id);\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.close',\n description: 'Collapse the rail to its strip (no active tool).',\n invoke: (handle) => {\n handle.close();\n },\n },\n select_tool: {\n safety: 'read',\n argsType: '{ id: string | null }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: ['string', 'null'] } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.selectTool',\n description:\n 'Set the active tool by id (opens its panel), or pass null to collapse.',\n invoke: (handle, args: { id: string | null }) => {\n handle.setActiveTool(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'control-room-rail',\n description: 'Marks the ControlRoomRail wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific rail from the agent.',\n },\n item: {\n attr: 'data-tool-id',\n description:\n 'Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id.',\n },\n },\n};\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport type { ToolRailHandle, ToolRailTool } from '../tool-rail';\n\n/* ------------------------------------------------------------------ */\n/* Control Room context — the scope mechanism */\n/* */\n/* The DS provides the plumbing; the CONSUMER declares scope by which */\n/* API it reaches for: */\n/* - <ControlRoomProvider globalTools={…}> → `global` tools, set */\n/* once at the app shell, persist across navigation. */\n/* - useControlRoomTools([…]) → `contextual` tools, */\n/* registered per-page, swap with the open entity. */\n/* `<ControlRoomRail>` reads the merged set; `global` tools seed the */\n/* default favourites (pinned on top), `contextual` tools fall below */\n/* the divider. The rail renders the divider between the two groups. */\n/* ------------------------------------------------------------------ */\n\ninterface ControlRoomContextValue {\n globalTools: ToolRailTool[];\n contextualTools: ToolRailTool[];\n registerContextualTools: (id: string, tools: ToolRailTool[]) => void;\n unregisterContextualTools: (id: string) => void;\n // The rail registers its imperative handle here so pages can drive it\n // (e.g. open the X-ray panel when a tooth is clicked). Null until mounted.\n registerRail: (handle: ToolRailHandle | null) => void;\n openTool: (id: string) => void;\n closeTool: () => void;\n}\n\nconst ControlRoomContext = createContext<ControlRoomContextValue | null>(null);\n\nexport interface ControlRoomProviderProps {\n /**\n * Tools valid in every context (Alia, Inbox). Set once at the app shell —\n * they pin to the rail's far end and persist across navigation. Memoise\n * this array so it doesn't re-register every render.\n */\n globalTools?: ToolRailTool[];\n children: ReactNode;\n}\n\n/**\n * Holds the Control Room's global tools and the registry of per-context\n * contextual tools. Mount once at the app shell, inside the frame that also\n * renders `<ControlRoomRail>`.\n */\nexport function ControlRoomProvider({\n globalTools = [],\n children,\n}: ControlRoomProviderProps) {\n // id → that registration's contextual tools. Multiple concurrent\n // registrations merge in insertion order (rare, but composes cleanly).\n const [registry, setRegistry] = useState<Map<string, ToolRailTool[]>>(\n () => new Map(),\n );\n\n const registerContextualTools = useCallback(\n (id: string, tools: ToolRailTool[]) => {\n setRegistry((prev) => {\n const next = new Map(prev);\n next.set(id, tools);\n return next;\n });\n },\n [],\n );\n\n const unregisterContextualTools = useCallback((id: string) => {\n setRegistry((prev) => {\n if (!prev.has(id)) return prev;\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n const contextualTools = useMemo(\n () => Array.from(registry.values()).flat(),\n [registry],\n );\n\n // The rail's imperative handle, registered by <ControlRoomRail> on mount.\n // openTool/closeTool drive it so a page can open a panel (e.g. the X-ray\n // viewer when a tooth is clicked) without holding a ref to the rail itself.\n const railHandleRef = useRef<ToolRailHandle | null>(null);\n const registerRail = useCallback((handle: ToolRailHandle | null) => {\n railHandleRef.current = handle;\n }, []);\n const openTool = useCallback((id: string) => {\n railHandleRef.current?.setActiveTool(id);\n }, []);\n const closeTool = useCallback(() => {\n railHandleRef.current?.setActiveTool(null);\n }, []);\n\n const value = useMemo<ControlRoomContextValue>(\n () => ({\n globalTools,\n contextualTools,\n registerContextualTools,\n unregisterContextualTools,\n registerRail,\n openTool,\n closeTool,\n }),\n [\n globalTools,\n contextualTools,\n registerContextualTools,\n unregisterContextualTools,\n registerRail,\n openTool,\n closeTool,\n ],\n );\n\n return (\n <ControlRoomContext.Provider value={value}>\n {children}\n </ControlRoomContext.Provider>\n );\n}\n\n/**\n * Register this context's **contextual** tools (Notes, Appointments, the entity\n * summary). They sit below the favourites divider and unregister automatically\n * when the calling component unmounts (i.e. when you leave the context).\n *\n * Pass a **stable / memoised** array — like `useEffect` deps, a fresh array\n * every render re-registers every render. Wrap it in `useMemo`.\n *\n * No-op when rendered outside a `<ControlRoomProvider>`.\n */\nexport function useControlRoomTools(tools: ToolRailTool[]): void {\n const ctx = useContext(ControlRoomContext);\n // Depend on the STABLE register/unregister callbacks, never the whole\n // context value: the value object changes every time the registry updates\n // (which this very effect triggers), so depending on `ctx` would re-register\n // on every change — an infinite loop. The callbacks are `useCallback([])`.\n const register = ctx?.registerContextualTools;\n const unregister = ctx?.unregisterContextualTools;\n const id = useId();\n useEffect(() => {\n if (!register || !unregister) return undefined;\n register(id, tools);\n return () => unregister(id);\n }, [register, unregister, id, tools]);\n}\n\n/**\n * The merged tool set the rail consumes: contextual tools (auto-tagged\n * `scope: 'contextual'`) then globals (`scope: 'global'`). Scope is assigned\n * here by which API registered the tool — `global` seeds the Control Room's\n * default favourites (pinned on top); `contextual` falls below the divider.\n * `ControlRoomRail` re-groups by favourite membership for the final order.\n * Returns `[]` outside a provider.\n */\nexport function useControlRoomMergedTools(): ToolRailTool[] {\n const ctx = useContext(ControlRoomContext);\n return useMemo(() => {\n if (!ctx) return [];\n const contextual = ctx.contextualTools.map((tool) => ({\n ...tool,\n scope: 'contextual' as const,\n }));\n const global = ctx.globalTools.map((tool) => ({\n ...tool,\n scope: 'global' as const,\n }));\n return [...contextual, ...global];\n }, [ctx]);\n}\n\n/**\n * Imperative actions to drive the rail from a page: open a tool's panel (e.g.\n * the X-ray viewer when a tooth is clicked) or collapse it. No-ops outside a\n * `<ControlRoomProvider>`. The functions are stable across renders.\n */\nexport function useControlRoomActions(): {\n openTool: (id: string) => void;\n closeTool: () => void;\n} {\n const ctx = useContext(ControlRoomContext);\n const noop = useCallback(() => {}, []);\n return {\n openTool: ctx?.openTool ?? noop,\n closeTool: ctx?.closeTool ?? noop,\n };\n}\n\n/**\n * Internal: the rail registers its imperative handle with the provider so\n * `useControlRoomActions().openTool` can drive it. Returns the stable\n * `registerRail` callback (or a no-op outside a provider).\n */\nexport function useControlRoomRailRegister(): (\n handle: ToolRailHandle | null,\n) => void {\n const ctx = useContext(ControlRoomContext);\n const noop = useCallback((_handle: ToolRailHandle | null) => {}, []);\n return ctx?.registerRail ?? noop;\n}\n","import {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Star, X } from 'lucide-react';\nimport { IconButton } from '../button/icon-button';\nimport { PanelHeaderActionsProvider } from '../panel-header/panel-header';\nimport {\n ToolRail,\n type ToolRailHandle,\n type ToolRailProps,\n type ToolRailTool,\n} from '../tool-rail';\nimport { usePersistentState } from '../../hooks/use-persistent-state';\nimport { controlRoomRailAgent } from './control-room-rail.agent';\nimport {\n useControlRoomMergedTools,\n useControlRoomRailRegister,\n} from './control-room-context';\n\n/* ------------------------------------------------------------------ */\n/* ControlRoomRail — the unified, contextual workspace rail. */\n/* */\n/* The docked right-hand \"Control Room\": the single home for the */\n/* assistant, inbox, notes, appointments and entity summaries */\n/* alongside the main work surface. One panel open at a time, */\n/* non-modal. */\n/* */\n/* It layers a FAVOURITES model over the proven ToolRail (its prior */\n/* name): favourited tools form a pinned group at the TOP of the strip */\n/* above a divider, then everything else below. The default favourites */\n/* are the host's `global` tools (Alia, Inbox) — so the rail opens with */\n/* notifications + Alia on top, the Control Room's default arrangement. */\n/* */\n/* Favouriting is DRAG-FIRST, no per-icon star: drag a tool up across */\n/* the divider to pin it (and drop it where you want in the order), */\n/* drag a favourite back down to unpin. The keyboard equivalent is */\n/* `Alt`+Arrow (crossing the divider pins / unpins, announced). The */\n/* non-drag pointer path — and the discoverable entry point — is an */\n/* add / remove control in each open tool's panel header. */\n/* */\n/* ToolRail stays favourite-agnostic: this layer maps favourite */\n/* membership onto the rail's generic `scope` grouping + (whole-strip) */\n/* `reorderable` run, reads cross-divider moves as pin / unpin, and */\n/* injects the favourite + close controls into the active panel's */\n/* PanelHeader via <PanelHeaderActionsProvider> (no separate header */\n/* row — the controls live inline-end of the panel's title row). */\n/* ------------------------------------------------------------------ */\n\n/** A Control Room tool — the rail tool descriptor, `scope`-aware. */\nexport type ControlRoomTool = ToolRailTool;\n\n/** Imperative handle — open / collapse a tool panel without the DOM. */\nexport type ControlRoomRailHandle = ToolRailHandle;\n\nexport interface ControlRoomRailProps extends Omit<\n ToolRailProps,\n | 'tools'\n | 'onReorder'\n | 'formatReorderAnnouncement'\n | 'renderToolAffordance'\n | 'renderPanelHeader'\n> {\n /**\n * Explicit tool set. Omit to read the merged global + contextual tools from\n * the nearest `<ControlRoomProvider>` (+ `useControlRoomTools`).\n */\n tools?: ControlRoomTool[];\n /**\n * Enable the favourites model: a pinned top group, drag / `Alt`+Arrow\n * reordering, and the panel-header add / remove control. Default `true`. Set\n * `false` for the legacy flat strip (tools render in the order / `scope` you\n * pass, no drag, no panel-header control).\n */\n reorderable?: boolean;\n /**\n * Controlled favourite tool ids, in pinned order. When set, the rail does not\n * persist — the host owns the value and is notified via `onFavoriteIdsChange`.\n */\n favoriteIds?: string[];\n /**\n * HARD-PINNED favourite ids — always rendered at the very START of the\n * pinned group, ahead of (and deduped from) user favourites, in both\n * controlled and uncontrolled modes. Immune to unpin: removing one via\n * the panel-header control or a drag is a no-op (it re-pins on the next\n * render). For tools the product wants permanently one glance away —\n * e.g. notifications at the top of the strip.\n */\n pinnedFavoriteIds?: string[];\n /**\n * Uncontrolled initial favourites. Defaults to the ids of the tools the host\n * marked `scope: 'global'` (Alia, Inbox) — pinning them on top by default.\n */\n defaultFavoriteIds?: string[];\n /** Fires with the next favourites order whenever the user pins / reorders. */\n onFavoriteIdsChange?: (next: string[]) => void;\n /** localStorage key for the uncontrolled favourites. */\n persistFavoritesKey?: string;\n}\n\nexport const ControlRoomRail = forwardRef<\n ControlRoomRailHandle,\n ControlRoomRailProps\n>(function ControlRoomRail(\n {\n tools,\n railLabel,\n reorderable = true,\n favoriteIds,\n defaultFavoriteIds,\n pinnedFavoriteIds,\n onFavoriteIdsChange,\n persistFavoritesKey = 'ui.controlRoom.favorites',\n activeToolId,\n defaultActiveToolId = null,\n onActiveToolChange,\n ...rest\n },\n ref,\n) {\n const { t } = useTranslation();\n\n // Mirror the active tool id so the rail can build the panel-header controls\n // (favourite + close) for whichever tool is open. Controlled hosts own the\n // value via `activeToolId`; otherwise we seed from `defaultActiveToolId` and\n // track subsequent changes through the intercepted `onActiveToolChange`.\n const [activeTracked, setActiveTracked] = useState<string | null>(\n activeToolId ?? defaultActiveToolId ?? null,\n );\n const activeId = activeToolId !== undefined ? activeToolId : activeTracked;\n const handleActiveToolChange = useCallback(\n (id: string | null) => {\n if (activeToolId === undefined) setActiveTracked(id);\n onActiveToolChange?.(id);\n },\n [activeToolId, onActiveToolChange],\n );\n // Provider-driven tools when none are passed explicitly. Calling the hook\n // unconditionally is safe — it returns [] outside a provider.\n const merged = useControlRoomMergedTools();\n const resolved = tools ?? merged;\n\n const isControlled = favoriteIds !== undefined;\n // Uncontrolled favourites persist to localStorage; the lazy initial seeds\n // from the host's `global` tools on first mount only (later tool changes\n // don't re-seed — favourites are user-owned once set). When controlled, the\n // hook is disabled so it never reads or writes storage.\n const [storedFavorites, setStoredFavorites] = usePersistentState<string[]>(\n persistFavoritesKey,\n () =>\n defaultFavoriteIds ??\n resolved.filter((tl) => tl.scope === 'global').map((tl) => tl.id),\n { disabled: isControlled },\n );\n const userFavorites = isControlled ? favoriteIds : storedFavorites;\n /* Hard-pinned ids lead the group every render — user favourites follow,\n deduped. Because the merge happens HERE (not in storage), an unpin\n write simply has no effect on a pinned id. */\n const favorites = useMemo(() => {\n if (!pinnedFavoriteIds?.length) return userFavorites;\n return [\n ...pinnedFavoriteIds,\n ...userFavorites.filter((id) => !pinnedFavoriteIds.includes(id)),\n ];\n }, [pinnedFavoriteIds, userFavorites]);\n\n const byId = useMemo(() => {\n const map = new Map<string, ControlRoomTool>();\n for (const tl of resolved) map.set(tl.id, tl);\n return map;\n }, [resolved]);\n\n // Favourites filtered to currently-present tools — stale ids are ignored\n // (and dropped on the next write).\n const favoriteSet = useMemo(\n () => new Set(favorites.filter((id) => byId.has(id))),\n [favorites, byId],\n );\n\n const updateFavorites = (updater: (prev: string[]) => string[]) => {\n // `updater` must be pure — it is invoked twice (once to compute the\n // reported `next`, once inside the functional setState below).\n const next = updater(favorites.filter((id) => byId.has(id)));\n // Persist via a functional update so rapid pin/reorder events compose\n // (mirrors the Sidebar's useFavorites); controlled hosts own the value.\n if (!isControlled)\n setStoredFavorites((prev) => updater(prev.filter((id) => byId.has(id))));\n onFavoriteIdsChange?.(next);\n };\n\n // Re-group into the pinned run (favourites order, tagged so ToolRail draws\n // the divider) followed by the rest. EVERY tool is `reorderable` so the rail's\n // reorder run spans the whole strip — that's what lets a drag / Alt+Arrow\n // cross the divider; `handleReorder` reads the crossing as pin / unpin.\n const railTools = useMemo<ControlRoomTool[]>(() => {\n if (!reorderable) return resolved;\n const favTools = favorites\n .filter((id) => byId.has(id))\n .map((id) => ({\n ...(byId.get(id) as ControlRoomTool),\n scope: 'global' as const,\n reorderable: true,\n }));\n const rest = resolved\n .filter((tl) => !favoriteSet.has(tl.id))\n .map((tl) => ({\n ...tl,\n scope: 'contextual' as const,\n reorderable: true,\n }));\n return [...favTools, ...rest];\n }, [reorderable, resolved, favorites, byId, favoriteSet]);\n\n // The drag / Alt+Arrow path announces through the rail's own reorder live\n // region; the panel-header button toggles outside it, so it needs its own\n // polite announcement. The zero-width-space toggle forces a re-announce of an\n // identical message (e.g. pin → unpin → pin the same tool).\n const [pinMessage, setPinMessage] = useState('');\n const pinAnnounceToggle = useRef(false);\n const announcePinChange = (label: string, willPin: boolean) => {\n const text = willPin\n ? t('controlRoom.pinnedAnnounce', {\n tool: label,\n defaultValue: 'Pinned {{tool}} to favourites',\n })\n : t('controlRoom.unpinnedAnnounce', {\n tool: label,\n defaultValue: 'Removed {{tool}} from favourites',\n });\n pinAnnounceToggle.current = !pinAnnounceToggle.current;\n setPinMessage(pinAnnounceToggle.current ? text : `${text}\\u200B`);\n };\n\n const togglePin = (id: string) => {\n announcePinChange(byId.get(id)?.label ?? id, !favoriteSet.has(id));\n updateFavorites((prev) =>\n prev.includes(id) ? prev.filter((p) => p !== id) : [...prev, id],\n );\n };\n\n // The rail fires `onReorder` with indices into `railTools` (favourites first,\n // then the rest). The divider sits at `favCount`, so the index either side of\n // it tells us whether a move is a reorder, a pin, an unpin, or a no-op.\n const handleReorder = (from: number, to: number) => {\n const movedId = railTools[from]?.id;\n if (movedId === undefined) return;\n updateFavorites((prev) => {\n const present = prev.filter((id) => byId.has(id));\n const favCount = present.length;\n const wasFav = from < favCount;\n if (wasFav) {\n // Dropped below the divider → unpin.\n if (to >= favCount) return present.filter((id) => id !== movedId);\n // Reorder within favourites (full-strip index == favourites index).\n const next = present.slice();\n next.splice(from, 1);\n next.splice(to, 0, movedId);\n return next;\n }\n // A contextual tool dropped onto / above the divider → pin at that slot.\n if (to <= favCount) {\n const next = present.slice();\n next.splice(Math.min(to, favCount), 0, movedId);\n return next;\n }\n // Contextual → contextual: that group is host-ordered, so nothing to do.\n return prev;\n });\n };\n\n // Membership-aware live-region phrasing for the rail's reorder announcer.\n const formatReorderAnnouncement = ({\n tool,\n from,\n to,\n }: {\n tool: ControlRoomTool;\n from: number;\n to: number;\n }): string => {\n const favCount = favoriteSet.size;\n const wasFav = from < favCount;\n if (wasFav && to >= favCount)\n return t('controlRoom.unpinnedAnnounce', {\n tool: tool.label,\n defaultValue: 'Removed {{tool}} from favourites',\n });\n if (!wasFav && to <= favCount)\n return t('controlRoom.pinnedAnnounce', {\n tool: tool.label,\n defaultValue: 'Pinned {{tool}} to favourites',\n });\n if (wasFav && to < favCount)\n return t('controlRoom.reorderAnnounce', {\n tool: tool.label,\n to: to + 1,\n total: favCount,\n defaultValue: '{{tool}} moved to position {{to}} of {{total}}',\n });\n // Contextual → contextual is a no-op; stay silent.\n return '';\n };\n\n // Register the rail's imperative handle with the provider (so a page's\n // useControlRoomActions().openTool can drive it) AND forward it to the\n // consumer's ref. A callback ref does both; no-op without a provider. We also\n // stash it locally so the injected close control can collapse the panel.\n const railHandleRef = useRef<ToolRailHandle | null>(null);\n const registerRail = useControlRoomRailRegister();\n const setRefs = useCallback(\n (handle: ToolRailHandle | null) => {\n railHandleRef.current = handle;\n registerRail(handle);\n if (typeof ref === 'function') ref(handle);\n else if (ref) ref.current = handle;\n },\n [registerRail, ref],\n );\n\n // The active tool's panel-header controls, injected into its PanelHeader's\n // action cluster (inline-end of the title row) via context — no separate\n // header row. When a tool is open: an icon-only favourite toggle (only when\n // reorderable; pressed state via aria-pressed + the filled star) followed by\n // a close control that collapses the panel. Nothing injected when collapsed\n // or where the panel renders no PanelHeader.\n const activeTool = activeId != null ? (byId.get(activeId) ?? null) : null;\n const injectedActions: ReactNode = activeTool ? (\n <>\n {reorderable\n ? (() => {\n const pinned = favoriteSet.has(activeTool.id);\n return (\n <IconButton\n icon={\n <Star\n aria-hidden=\"true\"\n fill={pinned ? 'currentColor' : 'none'}\n className={\n pinned ? 'ds:text-[color:var(--accent)]' : undefined\n }\n />\n }\n intent=\"ghost\"\n size=\"sm\"\n aria-pressed={pinned}\n aria-label={t('controlRoom.favorite', {\n defaultValue: 'Favourite',\n })}\n onClick={() => togglePin(activeTool.id)}\n />\n );\n })()\n : null}\n <IconButton\n icon={<X aria-hidden=\"true\" />}\n intent=\"ghost\"\n size=\"sm\"\n aria-label={t('controlRoom.close', { defaultValue: 'Close' })}\n onClick={() => railHandleRef.current?.close()}\n />\n </>\n ) : null;\n return (\n <PanelHeaderActionsProvider actions={injectedActions}>\n <ToolRail\n ref={setRefs}\n dataComponent=\"control-room-rail\"\n agentAdapter={controlRoomRailAgent}\n tools={railTools}\n activeToolId={activeToolId}\n defaultActiveToolId={defaultActiveToolId}\n onActiveToolChange={handleActiveToolChange}\n railLabel={\n railLabel ??\n t('controlRoom.railLabel', { defaultValue: 'Control room' })\n }\n onReorder={reorderable ? handleReorder : undefined}\n formatReorderAnnouncement={\n reorderable ? formatReorderAnnouncement : undefined\n }\n {...rest}\n />\n {/* Polite announcement for the panel-header pin / unpin button (the\n drag / Alt+Arrow path announces via the rail's own reorder region). */}\n {reorderable ? (\n <span role=\"status\" aria-live=\"polite\" className=\"ds:sr-only\">\n {pinMessage}\n </span>\n ) : null}\n </PanelHeaderActionsProvider>\n );\n});\n"],"names":["controlRoomRailAgent","handle","args","ControlRoomContext","createContext","ControlRoomProvider","globalTools","children","registry","setRegistry","useState","registerContextualTools","useCallback","id","tools","prev","next","unregisterContextualTools","contextualTools","useMemo","railHandleRef","useRef","registerRail","openTool","_a","closeTool","value","jsx","useControlRoomTools","ctx","useContext","register","unregister","useId","useEffect","useControlRoomMergedTools","contextual","tool","global","useControlRoomActions","noop","useControlRoomRailRegister","_handle","ControlRoomRail","forwardRef","railLabel","reorderable","favoriteIds","defaultFavoriteIds","pinnedFavoriteIds","onFavoriteIdsChange","persistFavoritesKey","activeToolId","defaultActiveToolId","onActiveToolChange","rest","ref","t","useTranslation","activeTracked","setActiveTracked","activeId","handleActiveToolChange","merged","resolved","isControlled","storedFavorites","setStoredFavorites","usePersistentState","tl","userFavorites","favorites","byId","map","favoriteSet","updateFavorites","updater","railTools","favTools","pinMessage","setPinMessage","pinAnnounceToggle","announcePinChange","label","willPin","text","togglePin","p","handleReorder","from","to","movedId","present","favCount","formatReorderAnnouncement","wasFav","setRefs","activeTool","injectedActions","jsxs","Fragment","pinned","IconButton","Star","X","PanelHeaderActionsProvider","ToolRail"],"mappings":";;;;;;;;;AAwBO,MAAMA,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,SAAS,eAAe;AAAA,EAC/C,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,gBAAA;AAAA,IAAgB;AAAA,EAC3C;AAAA,EAEF,SAAS;AAAA,IACP,MAAM;AAAA;AAAA,MAEJ,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY,EAAE,IAAI,EAAE,MAAM,WAAS;AAAA,QACnC,UAAU,CAAC,IAAI;AAAA,MAAA;AAAA,MAEjB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;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C,cAAc;AAAA,UAAA,CACf;AAAA,UACD,SAAS,MAAM6B,GAAUW,EAAW,EAAE;AAAA,QAAA;AAAA,MAAA;AAAA,IAG5C,OACA;AAAA,IACJ,gBAAAtE;AAAA,MAAC2E;AAAA,MAAA;AAAA,QACC,MAAM,gBAAA3E,EAAC6E,IAAA,EAAE,eAAY,OAAA,CAAO;AAAA,QAC5B,QAAO;AAAA,QACP,MAAK;AAAA,QACL,cAAY/C,EAAE,qBAAqB,EAAE,cAAc,SAAS;AAAA,QAC5D,SAAS,MAAA;;AAAM,kBAAAjC,IAAAJ,EAAc,YAAd,gBAAAI,EAAuB;AAAA;AAAA,MAAM;AAAA,IAAA;AAAA,EAC9C,EAAA,CACF,IACE;AACJ,SACE,gBAAA2E,EAACM,IAAA,EAA2B,SAASP,IACnC,UAAA;AAAA,IAAA,gBAAAvE;AAAA,MAAC+E;AAAA,MAAA;AAAA,QACC,KAAKV;AAAA,QACL,eAAc;AAAA,QACd,cAAchG;AAAA,QACd,OAAO6E;AAAA,QACP,cAAAzB;AAAA,QACA,qBAAAC;AAAA,QACA,oBAAoBS;AAAA,QACpB,WACEjB,KACAY,EAAE,yBAAyB,EAAE,cAAc,gBAAgB;AAAA,QAE7D,WAAWX,IAAc0C,KAAgB;AAAA,QACzC,2BACE1C,IAAcgD,KAA4B;AAAA,QAE3C,GAAGvC;AAAA,MAAA;AAAA,IAAA;AAAA,IAILT,IACC,gBAAAnB,EAAC,QAAA,EAAK,MAAK,UAAS,aAAU,UAAS,WAAU,cAC9C,UAAAoD,EAAA,CACH,IACE;AAAA,EAAA,GACN;AAEJ,CAAC;"}
1
+ {"version":3,"file":"control-room-rail-DQoHdE1U.js","sources":["../../src/components/control-room-rail/control-room-rail.agent.ts","../../src/components/control-room-rail/control-room-context.tsx","../../src/components/control-room-rail/control-room-rail.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — ControlRoomRail. */\n/* */\n/* The product surface built on ToolRail: the docked \"Control Room\". */\n/* It claims its OWN agent identity ('control-room-rail') so an agent and */\n/* the DOM / cascade boundary can tell the Control Room apart from a bare */\n/* ToolRail. Generic rail surface only: open / close a tool's panel and */\n/* read which tool is active. State is strictly the active tool id — never */\n/* any tool's panel CONTENT (which may carry PHI). */\n/* */\n/* The descriptionKeys deliberately REUSE the existing */\n/* `ui.toolRail.agent.*` translations — no new i18n keys are coined this */\n/* pass. */\n/* */\n/* NOTE: pin / unpin / reorder favourites are intentionally NOT yet an */\n/* agent capability. Exposing them is a deferred follow-up: it needs a */\n/* closed-vocabulary capability addition (DS-maintainer approval per */\n/* src/docs/26-agent-readiness.mdx) plus its own 18-locale descriptionKeys */\n/* — neither of which this pass introduces. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ControlRoomRailHandle } from './control-room-rail';\n\nexport const controlRoomRailAgent: AgentAdapter<ControlRoomRailHandle> = {\n id: 'control-room-rail',\n capabilities: ['open', 'close', 'select_single'],\n state: {\n activeToolId: {\n type: 'string | null',\n descriptionKey: 'ui.toolRail.agent.state.activeToolId',\n description:\n 'Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.',\n read: (handle) => handle.getActiveToolId(),\n },\n },\n actions: {\n open: {\n // Pure ephemeral panel state (open) — no data loss, no external effect.\n safety: 'read',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.open',\n description: \"Open the given tool's panel.\",\n examples: [{ args: { id: 'inbox' }, note: 'Open the inbox tool panel.' }],\n invoke: (handle, args: { id: string }) => {\n handle.open(args.id);\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.close',\n description: 'Collapse the rail to its strip (no active tool).',\n invoke: (handle) => {\n handle.close();\n },\n },\n select_tool: {\n safety: 'read',\n argsType: '{ id: string | null }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: ['string', 'null'] } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.selectTool',\n description:\n 'Set the active tool by id (opens its panel), or pass null to collapse.',\n invoke: (handle, args: { id: string | null }) => {\n handle.setActiveTool(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'control-room-rail',\n description: 'Marks the ControlRoomRail wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific rail from the agent.',\n },\n item: {\n attr: 'data-tool-id',\n description:\n 'Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id.',\n },\n },\n};\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport type { ToolRailHandle, ToolRailTool } from '../tool-rail';\n\n/* ------------------------------------------------------------------ */\n/* Control Room context — the scope mechanism */\n/* */\n/* The DS provides the plumbing; the CONSUMER declares scope by which */\n/* API it reaches for: */\n/* - <ControlRoomProvider globalTools={…}> → `global` tools, set */\n/* once at the app shell, persist across navigation. */\n/* - useControlRoomTools([…]) → `contextual` tools, */\n/* registered per-page, swap with the open entity. */\n/* `<ControlRoomRail>` reads the merged set; `global` tools seed the */\n/* default favourites (pinned on top), `contextual` tools fall below */\n/* the divider. The rail renders the divider between the two groups. */\n/* ------------------------------------------------------------------ */\n\ninterface ControlRoomContextValue {\n globalTools: ToolRailTool[];\n contextualTools: ToolRailTool[];\n registerContextualTools: (id: string, tools: ToolRailTool[]) => void;\n unregisterContextualTools: (id: string) => void;\n // The rail registers its imperative handle here so pages can drive it\n // (e.g. open the X-ray panel when a tooth is clicked). Null until mounted.\n registerRail: (handle: ToolRailHandle | null) => void;\n openTool: (id: string) => void;\n closeTool: () => void;\n}\n\nconst ControlRoomContext = createContext<ControlRoomContextValue | null>(null);\n\nexport interface ControlRoomProviderProps {\n /**\n * Tools valid in every context (Alia, Inbox). Set once at the app shell —\n * they pin to the rail's far end and persist across navigation. Memoise\n * this array so it doesn't re-register every render.\n */\n globalTools?: ToolRailTool[];\n children: ReactNode;\n}\n\n/**\n * Holds the Control Room's global tools and the registry of per-context\n * contextual tools. Mount once at the app shell, inside the frame that also\n * renders `<ControlRoomRail>`.\n */\nexport function ControlRoomProvider({\n globalTools = [],\n children,\n}: ControlRoomProviderProps) {\n // id → that registration's contextual tools. Multiple concurrent\n // registrations merge in insertion order (rare, but composes cleanly).\n const [registry, setRegistry] = useState<Map<string, ToolRailTool[]>>(\n () => new Map(),\n );\n\n const registerContextualTools = useCallback(\n (id: string, tools: ToolRailTool[]) => {\n setRegistry((prev) => {\n const next = new Map(prev);\n next.set(id, tools);\n return next;\n });\n },\n [],\n );\n\n const unregisterContextualTools = useCallback((id: string) => {\n setRegistry((prev) => {\n if (!prev.has(id)) return prev;\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n const contextualTools = useMemo(\n () => Array.from(registry.values()).flat(),\n [registry],\n );\n\n // The rail's imperative handle, registered by <ControlRoomRail> on mount.\n // openTool/closeTool drive it so a page can open a panel (e.g. the X-ray\n // viewer when a tooth is clicked) without holding a ref to the rail itself.\n const railHandleRef = useRef<ToolRailHandle | null>(null);\n const registerRail = useCallback((handle: ToolRailHandle | null) => {\n railHandleRef.current = handle;\n }, []);\n const openTool = useCallback((id: string) => {\n railHandleRef.current?.setActiveTool(id);\n }, []);\n const closeTool = useCallback(() => {\n railHandleRef.current?.setActiveTool(null);\n }, []);\n\n const value = useMemo<ControlRoomContextValue>(\n () => ({\n globalTools,\n contextualTools,\n registerContextualTools,\n unregisterContextualTools,\n registerRail,\n openTool,\n closeTool,\n }),\n [\n globalTools,\n contextualTools,\n registerContextualTools,\n unregisterContextualTools,\n registerRail,\n openTool,\n closeTool,\n ],\n );\n\n return (\n <ControlRoomContext.Provider value={value}>\n {children}\n </ControlRoomContext.Provider>\n );\n}\n\n/**\n * Register this context's **contextual** tools (Notes, Appointments, the entity\n * summary). They sit below the favourites divider and unregister automatically\n * when the calling component unmounts (i.e. when you leave the context).\n *\n * Pass a **stable / memoised** array — like `useEffect` deps, a fresh array\n * every render re-registers every render. Wrap it in `useMemo`.\n *\n * No-op when rendered outside a `<ControlRoomProvider>`.\n */\nexport function useControlRoomTools(tools: ToolRailTool[]): void {\n const ctx = useContext(ControlRoomContext);\n // Depend on the STABLE register/unregister callbacks, never the whole\n // context value: the value object changes every time the registry updates\n // (which this very effect triggers), so depending on `ctx` would re-register\n // on every change — an infinite loop. The callbacks are `useCallback([])`.\n const register = ctx?.registerContextualTools;\n const unregister = ctx?.unregisterContextualTools;\n const id = useId();\n useEffect(() => {\n if (!register || !unregister) return undefined;\n register(id, tools);\n return () => unregister(id);\n }, [register, unregister, id, tools]);\n}\n\n/**\n * The merged tool set the rail consumes: contextual tools (auto-tagged\n * `scope: 'contextual'`) then globals (`scope: 'global'`). Scope is assigned\n * here by which API registered the tool — `global` seeds the Control Room's\n * default favourites (pinned on top); `contextual` falls below the divider.\n * `ControlRoomRail` re-groups by favourite membership for the final order.\n * Returns `[]` outside a provider.\n */\nexport function useControlRoomMergedTools(): ToolRailTool[] {\n const ctx = useContext(ControlRoomContext);\n return useMemo(() => {\n if (!ctx) return [];\n const contextual = ctx.contextualTools.map((tool) => ({\n ...tool,\n scope: 'contextual' as const,\n }));\n const global = ctx.globalTools.map((tool) => ({\n ...tool,\n scope: 'global' as const,\n }));\n return [...contextual, ...global];\n }, [ctx]);\n}\n\n/**\n * Imperative actions to drive the rail from a page: open a tool's panel (e.g.\n * the X-ray viewer when a tooth is clicked) or collapse it. No-ops outside a\n * `<ControlRoomProvider>`. The functions are stable across renders.\n */\nexport function useControlRoomActions(): {\n openTool: (id: string) => void;\n closeTool: () => void;\n} {\n const ctx = useContext(ControlRoomContext);\n const noop = useCallback(() => {}, []);\n return {\n openTool: ctx?.openTool ?? noop,\n closeTool: ctx?.closeTool ?? noop,\n };\n}\n\n/**\n * Internal: the rail registers its imperative handle with the provider so\n * `useControlRoomActions().openTool` can drive it. Returns the stable\n * `registerRail` callback (or a no-op outside a provider).\n */\nexport function useControlRoomRailRegister(): (\n handle: ToolRailHandle | null,\n) => void {\n const ctx = useContext(ControlRoomContext);\n const noop = useCallback((_handle: ToolRailHandle | null) => {}, []);\n return ctx?.registerRail ?? noop;\n}\n","import {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Star, X } from 'lucide-react';\nimport { IconButton } from '../button/icon-button';\nimport { PanelHeaderActionsProvider } from '../panel-header/panel-header';\nimport {\n ToolRail,\n type ToolRailHandle,\n type ToolRailProps,\n type ToolRailTool,\n} from '../tool-rail';\nimport { usePersistentState } from '../../hooks/use-persistent-state';\nimport { controlRoomRailAgent } from './control-room-rail.agent';\nimport {\n useControlRoomMergedTools,\n useControlRoomRailRegister,\n} from './control-room-context';\n\n/* ------------------------------------------------------------------ */\n/* ControlRoomRail — the unified, contextual workspace rail. */\n/* */\n/* The docked right-hand \"Control Room\": the single home for the */\n/* assistant, inbox, notes, appointments and entity summaries */\n/* alongside the main work surface. One panel open at a time, */\n/* non-modal. */\n/* */\n/* It layers a FAVOURITES model over the proven ToolRail (its prior */\n/* name): favourited tools form a pinned group at the TOP of the strip */\n/* above a divider, then everything else below. The default favourites */\n/* are the host's `global` tools (Alia, Inbox) — so the rail opens with */\n/* notifications + Alia on top, the Control Room's default arrangement. */\n/* */\n/* Favouriting is DRAG-FIRST, no per-icon star: drag a tool up across */\n/* the divider to pin it (and drop it where you want in the order), */\n/* drag a favourite back down to unpin. The keyboard equivalent is */\n/* `Alt`+Arrow (crossing the divider pins / unpins, announced). The */\n/* non-drag pointer path — and the discoverable entry point — is an */\n/* add / remove control in each open tool's panel header. */\n/* */\n/* ToolRail stays favourite-agnostic: this layer maps favourite */\n/* membership onto the rail's generic `scope` grouping + (whole-strip) */\n/* `reorderable` run, reads cross-divider moves as pin / unpin, and */\n/* injects the favourite + close controls into the active panel's */\n/* PanelHeader via <PanelHeaderActionsProvider> (no separate header */\n/* row — the controls live inline-end of the panel's title row). */\n/* ------------------------------------------------------------------ */\n\n/** A Control Room tool — the rail tool descriptor, `scope`-aware. */\nexport type ControlRoomTool = ToolRailTool;\n\n/** Imperative handle — open / collapse a tool panel without the DOM. */\nexport type ControlRoomRailHandle = ToolRailHandle;\n\nexport interface ControlRoomRailProps extends Omit<\n ToolRailProps,\n | 'tools'\n | 'onReorder'\n | 'formatReorderAnnouncement'\n | 'renderToolAffordance'\n | 'renderPanelHeader'\n> {\n /**\n * Explicit tool set. Omit to read the merged global + contextual tools from\n * the nearest `<ControlRoomProvider>` (+ `useControlRoomTools`).\n */\n tools?: ControlRoomTool[];\n /**\n * Enable the favourites model: a pinned top group, drag / `Alt`+Arrow\n * reordering, and the panel-header add / remove control. Default `true`. Set\n * `false` for the legacy flat strip (tools render in the order / `scope` you\n * pass, no drag, no panel-header control).\n */\n reorderable?: boolean;\n /**\n * Controlled favourite tool ids, in pinned order. When set, the rail does not\n * persist — the host owns the value and is notified via `onFavoriteIdsChange`.\n */\n favoriteIds?: string[];\n /**\n * HARD-PINNED favourite ids — always rendered at the very START of the\n * pinned group, ahead of (and deduped from) user favourites, in both\n * controlled and uncontrolled modes. Immune to unpin: removing one via\n * the panel-header control or a drag is a no-op (it re-pins on the next\n * render). For tools the product wants permanently one glance away —\n * e.g. notifications at the top of the strip.\n */\n pinnedFavoriteIds?: string[];\n /**\n * Uncontrolled initial favourites. Defaults to the ids of the tools the host\n * marked `scope: 'global'` (Alia, Inbox) — pinning them on top by default.\n */\n defaultFavoriteIds?: string[];\n /** Fires with the next favourites order whenever the user pins / reorders. */\n onFavoriteIdsChange?: (next: string[]) => void;\n /** localStorage key for the uncontrolled favourites. */\n persistFavoritesKey?: string;\n}\n\nexport const ControlRoomRail = forwardRef<\n ControlRoomRailHandle,\n ControlRoomRailProps\n>(function ControlRoomRail(\n {\n tools,\n railLabel,\n reorderable = true,\n favoriteIds,\n defaultFavoriteIds,\n pinnedFavoriteIds,\n onFavoriteIdsChange,\n persistFavoritesKey = 'ui.controlRoom.favorites',\n activeToolId,\n defaultActiveToolId = null,\n onActiveToolChange,\n ...rest\n },\n ref,\n) {\n const { t } = useTranslation();\n\n // Mirror the active tool id so the rail can build the panel-header controls\n // (favourite + close) for whichever tool is open. Controlled hosts own the\n // value via `activeToolId`; otherwise we seed from `defaultActiveToolId` and\n // track subsequent changes through the intercepted `onActiveToolChange`.\n const [activeTracked, setActiveTracked] = useState<string | null>(\n activeToolId ?? defaultActiveToolId ?? null,\n );\n const activeId = activeToolId !== undefined ? activeToolId : activeTracked;\n const handleActiveToolChange = useCallback(\n (id: string | null) => {\n if (activeToolId === undefined) setActiveTracked(id);\n onActiveToolChange?.(id);\n },\n [activeToolId, onActiveToolChange],\n );\n // Provider-driven tools when none are passed explicitly. Calling the hook\n // unconditionally is safe — it returns [] outside a provider.\n const merged = useControlRoomMergedTools();\n const resolved = tools ?? merged;\n\n const isControlled = favoriteIds !== undefined;\n // Uncontrolled favourites persist to localStorage; the lazy initial seeds\n // from the host's `global` tools on first mount only (later tool changes\n // don't re-seed — favourites are user-owned once set). When controlled, the\n // hook is disabled so it never reads or writes storage.\n const [storedFavorites, setStoredFavorites] = usePersistentState<string[]>(\n persistFavoritesKey,\n () =>\n defaultFavoriteIds ??\n resolved.filter((tl) => tl.scope === 'global').map((tl) => tl.id),\n { disabled: isControlled },\n );\n const userFavorites = isControlled ? favoriteIds : storedFavorites;\n /* Hard-pinned ids lead the group every render — user favourites follow,\n deduped. Because the merge happens HERE (not in storage), an unpin\n write simply has no effect on a pinned id. */\n const favorites = useMemo(() => {\n if (!pinnedFavoriteIds?.length) return userFavorites;\n return [\n ...pinnedFavoriteIds,\n ...userFavorites.filter((id) => !pinnedFavoriteIds.includes(id)),\n ];\n }, [pinnedFavoriteIds, userFavorites]);\n\n const byId = useMemo(() => {\n const map = new Map<string, ControlRoomTool>();\n for (const tl of resolved) map.set(tl.id, tl);\n return map;\n }, [resolved]);\n\n // Favourites filtered to currently-present tools — stale ids are ignored\n // (and dropped on the next write).\n const favoriteSet = useMemo(\n () => new Set(favorites.filter((id) => byId.has(id))),\n [favorites, byId],\n );\n\n const updateFavorites = (updater: (prev: string[]) => string[]) => {\n // `updater` must be pure — it is invoked twice (once to compute the\n // reported `next`, once inside the functional setState below).\n const next = updater(favorites.filter((id) => byId.has(id)));\n // Persist via a functional update so rapid pin/reorder events compose\n // (mirrors the Sidebar's useFavorites); controlled hosts own the value.\n if (!isControlled)\n setStoredFavorites((prev) => updater(prev.filter((id) => byId.has(id))));\n onFavoriteIdsChange?.(next);\n };\n\n // Re-group into the pinned run (favourites order, tagged so ToolRail draws\n // the divider) followed by the rest. EVERY tool is `reorderable` so the rail's\n // reorder run spans the whole strip — that's what lets a drag / Alt+Arrow\n // cross the divider; `handleReorder` reads the crossing as pin / unpin.\n const railTools = useMemo<ControlRoomTool[]>(() => {\n if (!reorderable) return resolved;\n const favTools = favorites\n .filter((id) => byId.has(id))\n .map((id) => ({\n ...(byId.get(id) as ControlRoomTool),\n scope: 'global' as const,\n reorderable: true,\n }));\n const rest = resolved\n .filter((tl) => !favoriteSet.has(tl.id))\n .map((tl) => ({\n ...tl,\n scope: 'contextual' as const,\n reorderable: true,\n }));\n return [...favTools, ...rest];\n }, [reorderable, resolved, favorites, byId, favoriteSet]);\n\n // The drag / Alt+Arrow path announces through the rail's own reorder live\n // region; the panel-header button toggles outside it, so it needs its own\n // polite announcement. The zero-width-space toggle forces a re-announce of an\n // identical message (e.g. pin → unpin → pin the same tool).\n const [pinMessage, setPinMessage] = useState('');\n const pinAnnounceToggle = useRef(false);\n const announcePinChange = (label: string, willPin: boolean) => {\n const text = willPin\n ? t('controlRoom.pinnedAnnounce', {\n tool: label,\n defaultValue: 'Pinned {{tool}} to favourites',\n })\n : t('controlRoom.unpinnedAnnounce', {\n tool: label,\n defaultValue: 'Removed {{tool}} from favourites',\n });\n pinAnnounceToggle.current = !pinAnnounceToggle.current;\n setPinMessage(pinAnnounceToggle.current ? text : `${text}\\u200B`);\n };\n\n const togglePin = (id: string) => {\n announcePinChange(byId.get(id)?.label ?? id, !favoriteSet.has(id));\n updateFavorites((prev) =>\n prev.includes(id) ? prev.filter((p) => p !== id) : [...prev, id],\n );\n };\n\n // The rail fires `onReorder` with indices into `railTools` (favourites first,\n // then the rest). The divider sits at `favCount`, so the index either side of\n // it tells us whether a move is a reorder, a pin, an unpin, or a no-op.\n const handleReorder = (from: number, to: number) => {\n const movedId = railTools[from]?.id;\n if (movedId === undefined) return;\n updateFavorites((prev) => {\n const present = prev.filter((id) => byId.has(id));\n const favCount = present.length;\n const wasFav = from < favCount;\n if (wasFav) {\n // Dropped below the divider → unpin.\n if (to >= favCount) return present.filter((id) => id !== movedId);\n // Reorder within favourites (full-strip index == favourites index).\n const next = present.slice();\n next.splice(from, 1);\n next.splice(to, 0, movedId);\n return next;\n }\n // A contextual tool dropped onto / above the divider → pin at that slot.\n if (to <= favCount) {\n const next = present.slice();\n next.splice(Math.min(to, favCount), 0, movedId);\n return next;\n }\n // Contextual → contextual: that group is host-ordered, so nothing to do.\n return prev;\n });\n };\n\n // Membership-aware live-region phrasing for the rail's reorder announcer.\n const formatReorderAnnouncement = ({\n tool,\n from,\n to,\n }: {\n tool: ControlRoomTool;\n from: number;\n to: number;\n }): string => {\n const favCount = favoriteSet.size;\n const wasFav = from < favCount;\n if (wasFav && to >= favCount)\n return t('controlRoom.unpinnedAnnounce', {\n tool: tool.label,\n defaultValue: 'Removed {{tool}} from favourites',\n });\n if (!wasFav && to <= favCount)\n return t('controlRoom.pinnedAnnounce', {\n tool: tool.label,\n defaultValue: 'Pinned {{tool}} to favourites',\n });\n if (wasFav && to < favCount)\n return t('controlRoom.reorderAnnounce', {\n tool: tool.label,\n to: to + 1,\n total: favCount,\n defaultValue: '{{tool}} moved to position {{to}} of {{total}}',\n });\n // Contextual → contextual is a no-op; stay silent.\n return '';\n };\n\n // Register the rail's imperative handle with the provider (so a page's\n // useControlRoomActions().openTool can drive it) AND forward it to the\n // consumer's ref. A callback ref does both; no-op without a provider. We also\n // stash it locally so the injected close control can collapse the panel.\n const railHandleRef = useRef<ToolRailHandle | null>(null);\n const registerRail = useControlRoomRailRegister();\n const setRefs = useCallback(\n (handle: ToolRailHandle | null) => {\n railHandleRef.current = handle;\n registerRail(handle);\n if (typeof ref === 'function') ref(handle);\n else if (ref) ref.current = handle;\n },\n [registerRail, ref],\n );\n\n // The active tool's panel-header controls, injected into its PanelHeader's\n // action cluster (inline-end of the title row) via context — no separate\n // header row. When a tool is open: an icon-only favourite toggle (only when\n // reorderable; pressed state via aria-pressed + the filled star) followed by\n // a close control that collapses the panel. Nothing injected when collapsed\n // or where the panel renders no PanelHeader.\n const activeTool = activeId != null ? (byId.get(activeId) ?? null) : null;\n const injectedActions: ReactNode = activeTool ? (\n <>\n {reorderable\n ? (() => {\n const pinned = favoriteSet.has(activeTool.id);\n return (\n <IconButton\n icon={\n <Star\n aria-hidden=\"true\"\n fill={pinned ? 'currentColor' : 'none'}\n className={\n pinned ? 'ds:text-[color:var(--accent)]' : undefined\n }\n />\n }\n intent=\"ghost\"\n size=\"sm\"\n aria-pressed={pinned}\n aria-label={t('controlRoom.favorite', {\n defaultValue: 'Favourite',\n })}\n onClick={() => togglePin(activeTool.id)}\n />\n );\n })()\n : null}\n <IconButton\n icon={<X aria-hidden=\"true\" />}\n intent=\"ghost\"\n size=\"sm\"\n aria-label={t('controlRoom.close', { defaultValue: 'Close' })}\n onClick={() => railHandleRef.current?.close()}\n />\n </>\n ) : null;\n return (\n <PanelHeaderActionsProvider actions={injectedActions}>\n <ToolRail\n ref={setRefs}\n dataComponent=\"control-room-rail\"\n agentAdapter={controlRoomRailAgent}\n tools={railTools}\n activeToolId={activeToolId}\n defaultActiveToolId={defaultActiveToolId}\n onActiveToolChange={handleActiveToolChange}\n railLabel={\n railLabel ??\n t('controlRoom.railLabel', { defaultValue: 'Control room' })\n }\n onReorder={reorderable ? handleReorder : undefined}\n formatReorderAnnouncement={\n reorderable ? formatReorderAnnouncement : undefined\n }\n {...rest}\n />\n {/* Polite announcement for the panel-header pin / unpin button (the\n drag / Alt+Arrow path announces via the rail's own reorder region). */}\n {reorderable ? (\n <span role=\"status\" aria-live=\"polite\" className=\"ds:sr-only\">\n {pinMessage}\n </span>\n ) : null}\n </PanelHeaderActionsProvider>\n );\n});\n"],"names":["controlRoomRailAgent","handle","args","ControlRoomContext","createContext","ControlRoomProvider","globalTools","children","registry","setRegistry","useState","registerContextualTools","useCallback","id","tools","prev","next","unregisterContextualTools","contextualTools","useMemo","railHandleRef","useRef","registerRail","openTool","_a","closeTool","value","jsx","useControlRoomTools","ctx","useContext","register","unregister","useId","useEffect","useControlRoomMergedTools","contextual","tool","global","useControlRoomActions","noop","useControlRoomRailRegister","_handle","ControlRoomRail","forwardRef","railLabel","reorderable","favoriteIds","defaultFavoriteIds","pinnedFavoriteIds","onFavoriteIdsChange","persistFavoritesKey","activeToolId","defaultActiveToolId","onActiveToolChange","rest","ref","t","useTranslation","activeTracked","setActiveTracked","activeId","handleActiveToolChange","merged","resolved","isControlled","storedFavorites","setStoredFavorites","usePersistentState","tl","userFavorites","favorites","byId","map","favoriteSet","updateFavorites","updater","railTools","favTools","pinMessage","setPinMessage","pinAnnounceToggle","announcePinChange","label","willPin","text","togglePin","p","handleReorder","from","to","movedId","present","favCount","formatReorderAnnouncement","wasFav","setRefs","activeTool","injectedActions","jsxs","Fragment","pinned","IconButton","Star","X","PanelHeaderActionsProvider","ToolRail"],"mappings":";;;;;;;;;AAwBO,MAAMA,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,SAAS,eAAe;AAAA,EAC/C,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,gBAAA;AAAA,IAAgB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A,CACH,IACE;AAAA,EAAA,GACN;AAEJ,CAAC;"}
@@ -0,0 +1,112 @@
1
+ import { jsxs as d, jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as k, useState as D, useMemo as j } from "react";
3
+ import { c as t } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as B } from "react-i18next";
5
+ import { B as V } from "./button-nJaPh_HC.js";
6
+ import { I as z } from "./icon-button-8xqRnkdG.js";
7
+ import { P as E } from "./pencil-B1sKKyuT.js";
8
+ const C = t(
9
+ "ds:flex ds:min-w-0 ds:items-start ds:gap-[var(--spacing-xs)]"
10
+ ), M = t(
11
+ [
12
+ "ds:m-0 ds:flex ds:min-w-0 ds:flex-1 ds:list-none ds:flex-col ds:p-0",
13
+ "ds:gap-[var(--spacing-2xs)]"
14
+ ].join(" ")
15
+ ), I = t(
16
+ "ds:m-0 ds:min-w-0 ds:flex-1 type-body-sm ds:text-[color:var(--muted-foreground)]"
17
+ ), P = t(
18
+ "ds:flex ds:items-start ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[color:var(--foreground)]"
19
+ ), $ = t(
20
+ [
21
+ "ds:mt-[var(--spacing-sm)] ds:size-[var(--spacing-xs)] ds:shrink-0 ds:self-start",
22
+ "ds:rounded-[var(--radius-full)] ds:bg-[color:var(--border)]"
23
+ ].join(" ")
24
+ ), L = k(
25
+ ({
26
+ value: r,
27
+ maxLines: o = 3,
28
+ onEdit: l,
29
+ editButtonRef: p,
30
+ emptyLabel: m,
31
+ editLabel: f,
32
+ seeMoreLabel: h,
33
+ showLessLabel: g,
34
+ className: x,
35
+ ...u
36
+ }, b) => {
37
+ const { t: i } = B(), [n, v] = D(!1), a = j(
38
+ () => (r ?? "").split(/\r?\n/).map((e) => e.trim()).filter(Boolean),
39
+ [r]
40
+ ), N = Math.max(0, a.length - o), w = n ? a : a.slice(0, o), c = f ?? i("editableDescription.edit");
41
+ return /* @__PURE__ */ d(
42
+ "div",
43
+ {
44
+ ...u,
45
+ ref: b,
46
+ "data-component": "editable-description",
47
+ "data-empty": a.length === 0 ? "" : void 0,
48
+ className: [C(), x].filter(Boolean).join(" "),
49
+ children: [
50
+ a.length === 0 ? /* @__PURE__ */ s("p", { "data-editable-description-empty": "", className: I(), children: m ?? i("editableDescription.empty") }) : /* @__PURE__ */ d("ul", { className: M(), children: [
51
+ w.map((e, y) => /* @__PURE__ */ d(
52
+ "li",
53
+ {
54
+ "data-editable-description-line": "",
55
+ className: P(),
56
+ children: [
57
+ /* @__PURE__ */ s("span", { "aria-hidden": "true", className: $() }),
58
+ /* @__PURE__ */ s("span", { className: "ds:min-w-0 ds:[overflow-wrap:anywhere]", children: e })
59
+ ]
60
+ },
61
+ `${y}-${e}`
62
+ )),
63
+ N > 0 ? (
64
+ // An ITEM of the list, aligned with the text rather than the
65
+ // dots, so opening it does not shift the column.
66
+ /* @__PURE__ */ d("li", { className: "ds:flex ds:items-start ds:gap-[var(--spacing-xs)]", children: [
67
+ /* @__PURE__ */ s(
68
+ "span",
69
+ {
70
+ "aria-hidden": "true",
71
+ className: "ds:size-[var(--spacing-xs)] ds:shrink-0"
72
+ }
73
+ ),
74
+ /* @__PURE__ */ s(
75
+ V,
76
+ {
77
+ intent: "link",
78
+ size: "sm",
79
+ "data-editable-description-toggle": "",
80
+ className: "ds:!ps-0 ds:!pe-0",
81
+ "aria-expanded": n,
82
+ onClick: () => v((e) => !e),
83
+ children: n ? g ?? i("editableDescription.showLess") : h ?? i("editableDescription.seeMore")
84
+ }
85
+ )
86
+ ] })
87
+ ) : null
88
+ ] }),
89
+ l ? /* @__PURE__ */ s(
90
+ z,
91
+ {
92
+ ref: p,
93
+ icon: /* @__PURE__ */ s(E, { "aria-hidden": "true" }),
94
+ intent: "ghost",
95
+ size: "sm",
96
+ className: "ds:-mt-[var(--spacing-sm)] ds:shrink-0",
97
+ "aria-label": c,
98
+ tooltip: c,
99
+ "data-editable-description-edit": "",
100
+ onClick: l
101
+ }
102
+ ) : null
103
+ ]
104
+ }
105
+ );
106
+ }
107
+ );
108
+ L.displayName = "EditableDescription";
109
+ export {
110
+ L as E
111
+ };
112
+ //# sourceMappingURL=editable-description-BOfAeY3T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editable-description-BOfAeY3T.js","sources":["../../src/components/editable-description/editable-description.tsx"],"sourcesContent":["import {\n forwardRef,\n useMemo,\n useState,\n type HTMLAttributes,\n type Ref,\n} from 'react';\nimport { cva } from 'class-variance-authority';\nimport { Pencil } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport { Button } from '../button/button';\nimport { IconButton } from '../button/icon-button';\n\n/* -------------------------------------------------------------------- */\n/* EditableDescription */\n/* */\n/* A record's free-text description, set as bulleted lines, with a pencil */\n/* beside it when the reader may edit. An appointment's description, a */\n/* task's description, a treatment's remark. PLAIN text only: patient */\n/* notes are rich text and belong to NotesPanel and NoteTimeline. */\n/* */\n/* In practice this text is written as a list (\"sensitive lower left\", */\n/* \"review the bitewings\", \"allow extra time\"), so it is set as one, a */\n/* dot per line, rather than as a paragraph pretending to be prose. */\n/* */\n/* Long descriptions cut at the LINE, not at a rendered row: `maxLines` */\n/* bullets, then a \"See more\" that is itself an item of the list, so the */\n/* column does not shift when it opens. */\n/* */\n/* It DISPLAYS and asks to edit; it does not own the editor. `onEdit` */\n/* hands over to the host, which opens its form, in a rail panel a */\n/* `PanelSubview` with a `TextArea`. Omit `onEdit` for a read-only view. */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:flex ds:min-w-0 ds:items-start ds:gap-[var(--spacing-xs)]',\n);\n\nconst listVariants = cva(\n [\n 'ds:m-0 ds:flex ds:min-w-0 ds:flex-1 ds:list-none ds:flex-col ds:p-0',\n 'ds:gap-[var(--spacing-2xs)]',\n ].join(' '),\n);\n\nconst emptyVariants = cva(\n 'ds:m-0 ds:min-w-0 ds:flex-1 type-body-sm ds:text-[color:var(--muted-foreground)]',\n);\n\nconst lineVariants = cva(\n 'ds:flex ds:items-start ds:gap-[var(--spacing-xs)] type-body-sm ds:text-[color:var(--foreground)]',\n);\n\n/* `--spacing-sm` is (line-height − dot) / 2 for this type scale, so the dot\n centres on the FIRST line; `self-start` keeps it there when a line wraps. */\nconst dotVariants = cva(\n [\n 'ds:mt-[var(--spacing-sm)] ds:size-[var(--spacing-xs)] ds:shrink-0 ds:self-start',\n 'ds:rounded-[var(--radius-full)] ds:bg-[color:var(--border)]',\n ].join(' '),\n);\n\nexport interface EditableDescriptionProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange'\n> {\n /** The description. One bullet per non-empty line. */\n value?: string | null;\n /** Lines shown before the rest go behind \"See more\". Default `3`. */\n maxLines?: number;\n /** Fires from the pencil. Omit for a read-only description. */\n onEdit?: () => void;\n /** Receives the pencil button, so a host can return focus to it. */\n editButtonRef?: Ref<HTMLButtonElement>;\n /** Shown when there are no lines. Defaults to the kit's translated text. */\n emptyLabel?: string;\n /** Accessible name and tooltip of the pencil. Defaults to the kit's text. */\n editLabel?: string;\n /** Disclosure labels. Default to the kit's translated text. */\n seeMoreLabel?: string;\n showLessLabel?: string;\n}\n\nexport const EditableDescription = forwardRef<\n HTMLDivElement,\n EditableDescriptionProps\n>(\n (\n {\n value,\n maxLines = 3,\n onEdit,\n editButtonRef,\n emptyLabel,\n editLabel,\n seeMoreLabel,\n showLessLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const [expanded, setExpanded] = useState(false);\n\n const lines = useMemo(\n () =>\n (value ?? '')\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter(Boolean),\n [value],\n );\n\n const hiddenCount = Math.max(0, lines.length - maxLines);\n const shown = expanded ? lines : lines.slice(0, maxLines);\n const resolvedEditLabel = editLabel ?? t('editableDescription.edit');\n\n return (\n <div\n {...rest}\n ref={ref}\n data-component=\"editable-description\"\n data-empty={lines.length === 0 ? '' : undefined}\n className={[rootVariants(), className].filter(Boolean).join(' ')}\n >\n {lines.length === 0 ? (\n <p data-editable-description-empty=\"\" className={emptyVariants()}>\n {emptyLabel ?? t('editableDescription.empty')}\n </p>\n ) : (\n <ul className={listVariants()}>\n {shown.map((line, index) => (\n <li\n key={`${index}-${line}`}\n data-editable-description-line=\"\"\n className={lineVariants()}\n >\n <span aria-hidden=\"true\" className={dotVariants()} />\n <span className=\"ds:min-w-0 ds:[overflow-wrap:anywhere]\">\n {line}\n </span>\n </li>\n ))}\n {hiddenCount > 0 ? (\n // An ITEM of the list, aligned with the text rather than the\n // dots, so opening it does not shift the column.\n <li className=\"ds:flex ds:items-start ds:gap-[var(--spacing-xs)]\">\n <span\n aria-hidden=\"true\"\n className=\"ds:size-[var(--spacing-xs)] ds:shrink-0\"\n />\n <Button\n intent=\"link\"\n size=\"sm\"\n data-editable-description-toggle=\"\"\n className=\"ds:!ps-0 ds:!pe-0\"\n aria-expanded={expanded}\n onClick={() => setExpanded((previous) => !previous)}\n >\n {expanded\n ? (showLessLabel ?? t('editableDescription.showLess'))\n : (seeMoreLabel ?? t('editableDescription.seeMore'))}\n </Button>\n </li>\n ) : null}\n </ul>\n )}\n {onEdit ? (\n <IconButton\n ref={editButtonRef}\n icon={<Pencil aria-hidden=\"true\" />}\n intent=\"ghost\"\n size=\"sm\"\n // Pulled up so the 2rem button centres on the first text line.\n className=\"ds:-mt-[var(--spacing-sm)] ds:shrink-0\"\n aria-label={resolvedEditLabel}\n tooltip={resolvedEditLabel}\n data-editable-description-edit=\"\"\n onClick={onEdit}\n />\n ) : null}\n </div>\n );\n },\n);\nEditableDescription.displayName = 'EditableDescription';\n"],"names":["rootVariants","cva","listVariants","emptyVariants","lineVariants","dotVariants","EditableDescription","forwardRef","value","maxLines","onEdit","editButtonRef","emptyLabel","editLabel","seeMoreLabel","showLessLabel","className","rest","ref","t","useTranslation","expanded","setExpanded","useState","lines","useMemo","line","hiddenCount","shown","resolvedEditLabel","jsxs","jsx","index","Button","previous","IconButton","Pencil"],"mappings":";;;;;;;AAkCA,MAAMA,IAAeC;AAAA,EACnB;AACF,GAE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A;AAAA,UAAA,IAET;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AACAJ,EAAoB,cAAc;"}
@@ -0,0 +1,21 @@
1
+ const e = {
2
+ id: "editable-description",
3
+ capabilities: [],
4
+ state: {},
5
+ actions: {},
6
+ domHooks: {
7
+ root: {
8
+ attr: "data-component",
9
+ value: "editable-description",
10
+ description: "Marks the element as a kit EditableDescription."
11
+ },
12
+ item: {
13
+ attr: "data-editable-description-line",
14
+ description: "One visible description line."
15
+ }
16
+ }
17
+ };
18
+ export {
19
+ e
20
+ };
21
+ //# sourceMappingURL=editable-description.agent-Bm_LBV2j.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editable-description.agent-Bm_LBV2j.js","sources":["../../src/components/editable-description/editable-description.agent.ts"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — EditableDescription. */\n/* */\n/* Display plus an edit request. The text and the editor are the host's, */\n/* so this exposes no actions: DOM hooks only, for reading the lines and */\n/* finding the pencil and the see-more disclosure. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\n\nexport const editableDescriptionAgent: AgentAdapter = {\n id: 'editable-description',\n capabilities: [],\n state: {},\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'editable-description',\n description: 'Marks the element as a kit EditableDescription.',\n },\n item: {\n attr: 'data-editable-description-line',\n description: 'One visible description line.',\n },\n },\n};\n"],"names":["editableDescriptionAgent"],"mappings":"AAUO,MAAMA,IAAyC;AAAA,EACpD,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO,CAAA;AAAA,EACP,SAAS,CAAA;AAAA,EACT,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ;"}
@@ -2,9 +2,9 @@ import { jsxs as V, jsx as p } from "react/jsx-runtime";
2
2
  import { forwardRef as z, useMemo as N } from "react";
3
3
  import { c as Z } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as $ } from "react-i18next";
5
- import { V as H } from "./visually-hidden-BHxEUGyT.js";
6
- import { f as O, a as R } from "./format-price-BkMEbeW3.js";
7
- const T = Z(
5
+ import { V as O } from "./visually-hidden-BHxEUGyT.js";
6
+ import { f as R, a as T } from "./format-price-BkMEbeW3.js";
7
+ const U = Z(
8
8
  [
9
9
  "ds:inline-flex ds:items-baseline ds:whitespace-nowrap",
10
10
  // Lining, fixed-width figures: without these a column of amounts
@@ -31,86 +31,72 @@ const T = Z(
31
31
  },
32
32
  defaultVariants: { size: "md", tone: "default", strikethrough: !1 }
33
33
  }
34
- ), U = z(
34
+ ), C = z(
35
35
  ({
36
36
  value: o,
37
37
  currency: s = "EUR",
38
- locale: y,
39
- size: v,
38
+ locale: v,
39
+ size: x,
40
40
  tone: l = "default",
41
- decimals: n = "full",
41
+ decimals: a = "full",
42
42
  signDisplay: m = "auto",
43
- strikethrough: x,
43
+ strikethrough: y,
44
44
  className: g,
45
45
  ...h
46
- }, k) => {
47
- const { i18n: M } = $(), r = y ?? M.language, { nodes: b, full: j } = N(() => {
48
- const e = O(
46
+ }, j) => {
47
+ const { i18n: b } = $(), n = v ?? b.language, { nodes: k, full: w } = N(() => {
48
+ const e = R(
49
49
  o,
50
50
  s,
51
- r,
51
+ n,
52
52
  m === "always" ? { signDisplay: "exceptZero" } : {}
53
- ), u = R(o, s, r);
53
+ ), f = T(o, s, n);
54
54
  if (!e)
55
- return { nodes: [{ text: u, muted: !1 }], full: u };
56
- const i = e.map((t) => t.value).join(""), P = e.filter((t) => t.type === "fraction").every((t) => /^0+$/.test(t.value)), f = (t) => t === "decimal" || t === "fraction";
57
- if (n === "hideWhenZero" && P) {
58
- const c = e.filter((d) => !f(d.type)).map((d) => d.value).join("").trim();
55
+ return { nodes: [{ text: f, muted: !1 }], full: f };
56
+ const i = e.map((t) => t.value).join(""), P = e.filter((t) => t.type === "fraction").every((t) => /^0+$/.test(t.value)), u = (t) => t === "decimal" || t === "fraction";
57
+ if (a === "hideWhenZero" && P) {
58
+ const c = e.filter((d) => !u(d.type)).map((d) => d.value).join("").trim();
59
59
  return { nodes: [{ text: c, muted: !1 }], full: c };
60
60
  }
61
- return n === "muted" ? {
61
+ return a === "muted" ? {
62
62
  nodes: e.map((t) => ({
63
63
  text: t.value,
64
- muted: f(t.type)
64
+ muted: u(t.type)
65
65
  })),
66
66
  full: i
67
67
  } : { nodes: [{ text: i, muted: !1 }], full: i };
68
- }, [o, s, r, n, m]), w = l === "auto" ? o < 0 ? "negative" : "default" : l;
68
+ }, [o, s, n, a, m]), M = l === "auto" ? o < 0 ? "negative" : "default" : l;
69
69
  return /* @__PURE__ */ V(
70
70
  "span",
71
71
  {
72
- ref: k,
72
+ ref: j,
73
73
  "data-component": "money",
74
74
  "data-currency": s.toUpperCase(),
75
- className: T({
76
- size: v,
77
- tone: w,
78
- strikethrough: x,
75
+ className: U({
76
+ size: x,
77
+ tone: M,
78
+ strikethrough: y,
79
79
  className: g
80
80
  }),
81
81
  ...h,
82
82
  children: [
83
- b.map((a, e) => /* @__PURE__ */ p(
83
+ k.map((r, e) => /* @__PURE__ */ p(
84
84
  "span",
85
85
  {
86
86
  "aria-hidden": "true",
87
- className: a.muted ? "ds:opacity-70 ds:[font-size:0.85em]" : void 0,
88
- children: a.text
87
+ className: r.muted ? "ds:opacity-70 ds:[font-size:0.85em]" : void 0,
88
+ children: r.text
89
89
  },
90
- `${e}-${a.text}`
90
+ `${e}-${r.text}`
91
91
  )),
92
- /* @__PURE__ */ p(H, { children: j })
92
+ /* @__PURE__ */ p(O, { children: w })
93
93
  ]
94
94
  }
95
95
  );
96
96
  }
97
97
  );
98
- U.displayName = "Money";
99
- const W = {
100
- id: "money",
101
- capabilities: [],
102
- state: {},
103
- actions: {},
104
- domHooks: {
105
- root: {
106
- attr: "data-component",
107
- value: "money",
108
- description: "Marks the element as a kit Money amount."
109
- }
110
- }
111
- };
98
+ C.displayName = "Money";
112
99
  export {
113
- U as M,
114
- W as m
100
+ C as M
115
101
  };
116
- //# sourceMappingURL=money.agent-Dw55UxUA.js.map
102
+ //# sourceMappingURL=money-BY-HmKhZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"money-BY-HmKhZ.js","sources":["../../src/components/money/money.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Money — a formatted monetary amount. */\n/* */\n/* Every price in the kit arrives as an integer in the smallest currency */\n/* unit plus an ISO-4217 code, and the kit formats it (see */\n/* `_shared/format-price`). This is the read-only leaf that renders one, */\n/* so a price is not re-implemented per surface with its own */\n/* `Intl.NumberFormat` call and its own alignment and tone decisions. */\n/* */\n/* What it adds over a bare formatted string: */\n/* - tabular figures, so a column of prices lines up on the decimal; */\n/* - the fraction can be de-emphasised or dropped when it is zero, so */\n/* the whole units read first; */\n/* - tone follows the sign when asked, so money owed reads as owed; */\n/* - the visual parts are hidden from assistive tech and the full */\n/* formatted amount is announced once, so splitting the fraction into */\n/* its own element cannot fragment what a screen reader says. */\n/* -------------------------------------------------------------------- */\n\nimport { forwardRef, useMemo, type HTMLAttributes } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\n\nimport { VisuallyHidden } from '../visually-hidden';\nimport { formatPrice, formatPriceParts } from '../_shared/format-price';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst moneyVariants = cva(\n [\n 'ds:inline-flex ds:items-baseline ds:whitespace-nowrap',\n // Lining, fixed-width figures: without these a column of amounts\n // wanders because glyph widths differ between digits.\n 'ds:tabular-nums',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'type-body-sm',\n md: 'type-body',\n lg: 'type-title-item',\n },\n tone: {\n default: 'ds:text-[color:var(--foreground)]',\n muted: 'ds:text-[color:var(--muted-foreground)]',\n positive: 'ds:text-[color:var(--success-foreground)]',\n negative: 'ds:text-[color:var(--destructive)]',\n },\n strikethrough: {\n true: 'ds:line-through ds:decoration-from-font',\n false: '',\n },\n },\n defaultVariants: { size: 'md', tone: 'default', strikethrough: false },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\nexport type MoneyDecimals = 'full' | 'muted' | 'hideWhenZero';\n\nexport interface MoneyProps\n extends\n Omit<HTMLAttributes<HTMLSpanElement>, 'children'>,\n Omit<VariantProps<typeof moneyVariants>, 'tone'> {\n /**\n * Amount in the SMALLEST currency unit (cents), the kit's price\n * convention — never a pre-formatted string. Zero-decimal currencies\n * (JPY, KRW …) take the major amount, as `formatPrice` expects.\n */\n value: number;\n /** ISO-4217 code. Defaults to EUR, the practice currency. */\n currency?: string;\n /** BCP 47 locale. Defaults to the active i18n language. */\n locale?: string;\n /**\n * Colour. `auto` follows the sign — a negative amount reads destructive,\n * everything else inherits the default. Explicit tones always win.\n */\n tone?: 'default' | 'muted' | 'positive' | 'negative' | 'auto';\n /**\n * What to do with the fraction:\n * `full` (default) leaves it alone;\n * `muted` de-emphasises it so the whole units read first;\n * `hideWhenZero` drops it ONLY when it is all zeros, so a price is\n * never rounded away in the display.\n */\n decimals?: MoneyDecimals;\n /** Force a leading `+` on positive amounts (a credit, a movement). */\n signDisplay?: 'auto' | 'always';\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const Money = forwardRef<HTMLSpanElement, MoneyProps>(\n (\n {\n value,\n currency = 'EUR',\n locale,\n size,\n tone = 'default',\n decimals = 'full',\n signDisplay = 'auto',\n strikethrough,\n className,\n ...rest\n },\n ref,\n ) => {\n const { i18n } = useTranslation();\n const resolvedLocale = locale ?? i18n.language;\n\n const { nodes, full } = useMemo(() => {\n const signOptions =\n signDisplay === 'always'\n ? ({ signDisplay: 'exceptZero' } as const)\n : {};\n const parts = formatPriceParts(\n value,\n currency,\n resolvedLocale,\n signOptions,\n );\n const plain = formatPrice(value, currency, resolvedLocale);\n\n // No parts means the locale or currency was rejected; the plain\n // string still honours the zero-decimal rule, so show that whole.\n if (!parts)\n return { nodes: [{ text: plain, muted: false }], full: plain };\n\n const text = parts.map((part) => part.value).join('');\n const fractionIsZero = parts\n .filter((part) => part.type === 'fraction')\n .every((part) => /^0+$/.test(part.value));\n\n // `decimal` and `fraction` are labelled by Intl, so this holds\n // wherever the locale puts them and whatever glyph it uses — an\n // it-IT group separator is a `group` part and is never touched.\n const isFractionPart = (type: Intl.NumberFormatPartTypes): boolean =>\n type === 'decimal' || type === 'fraction';\n\n if (decimals === 'hideWhenZero' && fractionIsZero) {\n const kept = parts.filter((part) => !isFractionPart(part.type));\n const trimmed = kept\n .map((part) => part.value)\n .join('')\n .trim();\n return { nodes: [{ text: trimmed, muted: false }], full: trimmed };\n }\n\n if (decimals === 'muted') {\n return {\n nodes: parts.map((part) => ({\n text: part.value,\n muted: isFractionPart(part.type),\n })),\n full: text,\n };\n }\n\n return { nodes: [{ text, muted: false }], full: text };\n }, [value, currency, resolvedLocale, decimals, signDisplay]);\n\n const resolvedTone =\n tone === 'auto' ? (value < 0 ? 'negative' : 'default') : tone;\n\n return (\n <span\n ref={ref}\n data-component=\"money\"\n data-currency={currency.toUpperCase()}\n className={moneyVariants({\n size,\n tone: resolvedTone,\n strikethrough,\n className,\n })}\n {...rest}\n >\n {/* The visual pieces are decorative: the amount is announced once,\n below, so a split fraction cannot be read as two numbers. */}\n {nodes.map((node, index) => (\n <span\n // Parts are positional and re-derived together, so the index is\n // the identity here.\n key={`${index}-${node.text}`}\n aria-hidden=\"true\"\n className={\n node.muted ? 'ds:opacity-70 ds:[font-size:0.85em]' : undefined\n }\n >\n {node.text}\n </span>\n ))}\n <VisuallyHidden>{full}</VisuallyHidden>\n </span>\n );\n },\n);\n\nMoney.displayName = 'Money';\n"],"names":["moneyVariants","cva","Money","forwardRef","value","currency","locale","size","tone","decimals","signDisplay","strikethrough","className","rest","ref","i18n","useTranslation","resolvedLocale","nodes","full","useMemo","parts","formatPriceParts","plain","formatPrice","text","part","fractionIsZero","isFractionPart","type","trimmed","resolvedTone","jsxs","node","index","jsx","VisuallyHidden"],"mappings":";;;;;;AA8BA,MAAMA,IAAgBC;AAAA,EACpB;AAAA,IACE;AAAA;AAAA;AAAA,IAGA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,MAEN,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,OAAO;AAAA,QACP,UAAU;AAAA,QACV,UAAU;AAAA,MAAA;AAAA,MAEZ,eAAe;AAAA,QACb,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB,EAAE,MAAM,MAAM,MAAM,WAAW,eAAe,GAAA;AAAA,EAAM;AAEzE,GA2CaC,IAAQC;AAAA,EACnB,CACE;AAAA,IACE,OAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC,IAAW;AAAA,IACX,aAAAC,IAAc;AAAA,IACd,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAM,EAAE,MAAAC,EAAA,IAASC,EAAA,GACXC,IAAiBX,KAAUS,EAAK,UAEhC,EAAE,OAAAG,GAAO,MAAAC,EAAA,IAASC,EAAQ,MAAM;AAKpC,YAAMC,IAAQC;AAAA,QACZlB;AAAA,QACAC;AAAA,QACAY;AAAA,QANAP,MAAgB,WACX,EAAE,aAAa,aAAA,IAChB,CAAA;AAAA,MAKJ,GAEIa,IAAQC,EAAYpB,GAAOC,GAAUY,CAAc;AAIzD,UAAI,CAACI;AACH,eAAO,EAAE,OAAO,CAAC,EAAE,MA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AAM,IAAI,CAACe,GAAMC,MAChB,gBAAAC;AAAA,YAAC;AAAA,YAAA;AAAA,cAIC,eAAY;AAAA,cACZ,WACEF,EAAK,QAAQ,wCAAwC;AAAA,cAGtD,UAAAA,EAAK;AAAA,YAAA;AAAA,YAND,GAAGC,CAAK,IAAID,EAAK,IAAI;AAAA,UAAA,CAQ7B;AAAA,UACD,gBAAAE,EAACC,KAAgB,UAAAjB,EAAA,CAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG5B;AACF;AAEAjB,EAAM,cAAc;"}
@@ -0,0 +1,17 @@
1
+ const t = {
2
+ id: "money",
3
+ capabilities: [],
4
+ state: {},
5
+ actions: {},
6
+ domHooks: {
7
+ root: {
8
+ attr: "data-component",
9
+ value: "money",
10
+ description: "Marks the element as a kit Money amount."
11
+ }
12
+ }
13
+ };
14
+ export {
15
+ t as m
16
+ };
17
+ //# sourceMappingURL=money.agent-BjJ6gOkx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"money.agent-BjJ6gOkx.js","sources":["../../src/components/money/money.agent.ts"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — Money. */\n/* */\n/* A read-only formatted amount. It holds no state an agent can change */\n/* and exposes no actions. The root also carries `data-currency` (the */\n/* ISO-4217 code) so a reader can tell two amounts apart without */\n/* parsing the glyph; the hook vocabulary has no slot to declare it. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\n\nexport const moneyAgent: AgentAdapter = {\n id: 'money',\n capabilities: [],\n state: {},\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'money',\n description: 'Marks the element as a kit Money amount.',\n },\n },\n};\n"],"names":["moneyAgent"],"mappings":"AAWO,MAAMA,IAA2B;AAAA,EACtC,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO,CAAA;AAAA,EACP,SAAS,CAAA;AAAA,EACT,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ;"}