@alfadocs/ui-kit-debug 1.7.0 → 1.8.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 (234) hide show
  1. package/dist/_chunks/{anamnesis-summary-rows-F-cCmFAn.js → anamnesis-summary-rows-d44s_whc.js} +2 -2
  2. package/dist/_chunks/{anamnesis-summary-rows-F-cCmFAn.js.map → anamnesis-summary-rows-d44s_whc.js.map} +1 -1
  3. package/dist/_chunks/{antenatal-schedule-timeline-BjlF2rTz.js → antenatal-schedule-timeline-B1k8QkA6.js} +3 -3
  4. package/dist/_chunks/{antenatal-schedule-timeline-BjlF2rTz.js.map → antenatal-schedule-timeline-B1k8QkA6.js.map} +1 -1
  5. package/dist/_chunks/{appointment-card-BhcPJpXh.js → appointment-card-Dzr3GeVz.js} +73 -90
  6. package/dist/_chunks/appointment-card-Dzr3GeVz.js.map +1 -0
  7. package/dist/_chunks/{appointment-timeline-CMPvzlGZ.js → appointment-timeline-0mwtpErq.js} +3 -3
  8. package/dist/_chunks/{appointment-timeline-CMPvzlGZ.js.map → appointment-timeline-0mwtpErq.js.map} +1 -1
  9. package/dist/_chunks/{appointment-tray-3c_FLxXJ.js → appointment-tray-4FUu_5NX.js} +2 -2
  10. package/dist/_chunks/{appointment-tray-3c_FLxXJ.js.map → appointment-tray-4FUu_5NX.js.map} +1 -1
  11. package/dist/_chunks/armchair-BaLDW6Hz.js +23 -0
  12. package/dist/_chunks/armchair-BaLDW6Hz.js.map +1 -0
  13. package/dist/_chunks/{booking-CQMJUFG-.js → booking-DHkKcUIl.js} +4 -4
  14. package/dist/_chunks/{booking-CQMJUFG-.js.map → booking-DHkKcUIl.js.map} +1 -1
  15. package/dist/_chunks/{calendar-4dXTvsCz.js → calendar-B4Gnyu1C.js} +553 -437
  16. package/dist/_chunks/calendar-B4Gnyu1C.js.map +1 -0
  17. package/dist/_chunks/calendar-event-card-Bjdbik8G.js +425 -0
  18. package/dist/_chunks/calendar-event-card-Bjdbik8G.js.map +1 -0
  19. package/dist/_chunks/{care-plan-card-DQjVRDxO.js → care-plan-card-aDN4oem9.js} +3 -3
  20. package/dist/_chunks/{care-plan-card-DQjVRDxO.js.map → care-plan-card-aDN4oem9.js.map} +1 -1
  21. package/dist/_chunks/{care-plan-entry-card-CMpoeNkb.js → care-plan-entry-card-BEhANdBE.js} +2 -2
  22. package/dist/_chunks/{care-plan-entry-card-CMpoeNkb.js.map → care-plan-entry-card-BEhANdBE.js.map} +1 -1
  23. package/dist/_chunks/{care-plan-header-CxYoq23f.js → care-plan-header-CkpPyQqG.js} +2 -2
  24. package/dist/_chunks/{care-plan-header-CxYoq23f.js.map → care-plan-header-CkpPyQqG.js.map} +1 -1
  25. package/dist/_chunks/{color-picker-D-tUwxxT.js → color-picker-oZ6zYks8.js} +164 -151
  26. package/dist/_chunks/color-picker-oZ6zYks8.js.map +1 -0
  27. package/dist/_chunks/control-room-rail-Cj2iX9h_.js +337 -0
  28. package/dist/_chunks/control-room-rail-Cj2iX9h_.js.map +1 -0
  29. package/dist/_chunks/{cycle-calculator-DzgO1vzP.js → cycle-calculator-DmtYGhqq.js} +3 -3
  30. package/dist/_chunks/{cycle-calculator-DzgO1vzP.js.map → cycle-calculator-DmtYGhqq.js.map} +1 -1
  31. package/dist/_chunks/{date-picker-Bp64zk2p.js → date-picker-CepI_oI2.js} +77 -74
  32. package/dist/_chunks/date-picker-CepI_oI2.js.map +1 -0
  33. package/dist/_chunks/{date-picker-variants-pKAJfnWr.js → date-picker-variants-DfuooXEK.js} +7 -2
  34. package/dist/_chunks/{date-picker-variants-pKAJfnWr.js.map → date-picker-variants-DfuooXEK.js.map} +1 -1
  35. package/dist/_chunks/{date-range-picker-CDrZ8Zh0.js → date-range-picker-BD8P_rJq.js} +46 -45
  36. package/dist/_chunks/{date-range-picker-CDrZ8Zh0.js.map → date-range-picker-BD8P_rJq.js.map} +1 -1
  37. package/dist/_chunks/{date-time-picker-DVETwpzc.js → date-time-picker-3I2vVKGV.js} +2 -2
  38. package/dist/_chunks/{date-time-picker-DVETwpzc.js.map → date-time-picker-3I2vVKGV.js.map} +1 -1
  39. package/dist/_chunks/{due-date-calculator-wK8Tajzz.js → due-date-calculator-BF_Ikofx.js} +4 -4
  40. package/dist/_chunks/{due-date-calculator-wK8Tajzz.js.map → due-date-calculator-BF_Ikofx.js.map} +1 -1
  41. package/dist/_chunks/{entity-card-9_62gY7l.js → entity-card-DmrgYSEX.js} +4 -4
  42. package/dist/_chunks/{entity-card-9_62gY7l.js.map → entity-card-DmrgYSEX.js.map} +1 -1
  43. package/dist/_chunks/{gestational-age-calculator-C_uDAeP_.js → gestational-age-calculator-CxZelpu2.js} +5 -5
  44. package/dist/_chunks/{gestational-age-calculator-C_uDAeP_.js.map → gestational-age-calculator-CxZelpu2.js.map} +1 -1
  45. package/dist/_chunks/{hcg-doubling-BaXkJhT-.js → hcg-doubling-CpU7H5rQ.js} +3 -3
  46. package/dist/_chunks/{hcg-doubling-BaXkJhT-.js.map → hcg-doubling-CpU7H5rQ.js.map} +1 -1
  47. package/dist/_chunks/{link-cell-renderer-DH4JYpKU.js → link-cell-renderer-BZQtsuFz.js} +2 -2
  48. package/dist/_chunks/{link-cell-renderer-DH4JYpKU.js.map → link-cell-renderer-BZQtsuFz.js.map} +1 -1
  49. package/dist/_chunks/{notes-panel-DlnENphf.js → notes-panel-e9cJWVRg.js} +2 -2
  50. package/dist/_chunks/{notes-panel-DlnENphf.js.map → notes-panel-e9cJWVRg.js.map} +1 -1
  51. package/dist/_chunks/{operator-hero-CCDnIa1S.js → operator-hero-BnFv-Uef.js} +2 -2
  52. package/dist/_chunks/{operator-hero-CCDnIa1S.js.map → operator-hero-BnFv-Uef.js.map} +1 -1
  53. package/dist/_chunks/{parse-JqixfsU0.js → parse-MN9bGkrY.js} +2 -2
  54. package/dist/_chunks/{parse-JqixfsU0.js.map → parse-MN9bGkrY.js.map} +1 -1
  55. package/dist/_chunks/{patient-details-qnsqYBGQ.js → patient-details-xrqe13az.js} +160 -159
  56. package/dist/_chunks/patient-details-xrqe13az.js.map +1 -0
  57. package/dist/_chunks/{patient-table-DwshfVsQ.js → patient-table-BqYomX50.js} +2 -2
  58. package/dist/_chunks/{patient-table-DwshfVsQ.js.map → patient-table-BqYomX50.js.map} +1 -1
  59. package/dist/_chunks/{payment-automation-upsell-BBIG7NFL.js → payment-automation-upsell-DwQW2fRp.js} +52 -63
  60. package/dist/_chunks/payment-automation-upsell-DwQW2fRp.js.map +1 -0
  61. package/dist/_chunks/{payment-request-card-BjjBMdsp.js → payment-request-card-YVCcCZ25.js} +2 -2
  62. package/dist/_chunks/{payment-request-card-BjjBMdsp.js.map → payment-request-card-YVCcCZ25.js.map} +1 -1
  63. package/dist/_chunks/{pregnancy-dating-BVS_9YU2.js → pregnancy-dating-DtToyMyc.js} +5 -5
  64. package/dist/_chunks/{pregnancy-dating-BVS_9YU2.js.map → pregnancy-dating-DtToyMyc.js.map} +1 -1
  65. package/dist/_chunks/{radiograph-panel.agent-CiHwgISa.js → radiograph-panel.agent-C3trfWqB.js} +3 -3
  66. package/dist/_chunks/{radiograph-panel.agent-CiHwgISa.js.map → radiograph-panel.agent-C3trfWqB.js.map} +1 -1
  67. package/dist/_chunks/repeat-CvQa5rZt.js +17 -0
  68. package/dist/_chunks/repeat-CvQa5rZt.js.map +1 -0
  69. package/dist/_chunks/resource-chip-DYTG0IQQ.js +83 -0
  70. package/dist/_chunks/resource-chip-DYTG0IQQ.js.map +1 -0
  71. package/dist/_chunks/{rich-text-editor-DARnq_6N.js → rich-text-editor-BDfFtK4H.js} +2 -2
  72. package/dist/_chunks/{rich-text-editor-DARnq_6N.js.map → rich-text-editor-BDfFtK4H.js.map} +1 -1
  73. package/dist/_chunks/subDays-BLl3y3pd.js +8 -0
  74. package/dist/_chunks/{subDays-CAUv47M1.js.map → subDays-BLl3y3pd.js.map} +1 -1
  75. package/dist/agent-catalog.json +2 -2
  76. package/dist/components/_shared/date-picker-variants.d.ts.map +1 -1
  77. package/dist/components/appointment-card/index.js +2 -2
  78. package/dist/components/appointment-timeline/index.js +1 -1
  79. package/dist/components/booking/index.js +1 -1
  80. package/dist/components/calendar/calendar.agent.d.ts.map +1 -1
  81. package/dist/components/calendar/calendar.d.ts +138 -12
  82. package/dist/components/calendar/calendar.d.ts.map +1 -1
  83. package/dist/components/calendar/index.js +1 -1
  84. package/dist/components/calendar-event-card/calendar-event-card.d.ts +48 -11
  85. package/dist/components/calendar-event-card/calendar-event-card.d.ts.map +1 -1
  86. package/dist/components/calendar-event-card/index.js +1 -1
  87. package/dist/components/care-plan-card/index.js +1 -1
  88. package/dist/components/care-plan-entry-card/index.js +1 -1
  89. package/dist/components/care-plan-header/index.js +1 -1
  90. package/dist/components/color-picker/index.d.ts +1 -1
  91. package/dist/components/color-picker/index.d.ts.map +1 -1
  92. package/dist/components/color-picker/index.js +4 -3
  93. package/dist/components/color-picker/palettes.d.ts +10 -0
  94. package/dist/components/color-picker/palettes.d.ts.map +1 -1
  95. package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
  96. package/dist/components/control-room-rail/control-room-rail.d.ts.map +1 -1
  97. package/dist/components/control-room-rail/index.js +1 -1
  98. package/dist/components/cycle-calculator/index.js +1 -1
  99. package/dist/components/data-table/index.js +1 -1
  100. package/dist/components/date-picker/date-picker.d.ts +11 -0
  101. package/dist/components/date-picker/date-picker.d.ts.map +1 -1
  102. package/dist/components/date-picker/index.js +1 -1
  103. package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -1
  104. package/dist/components/date-range-picker/index.js +1 -1
  105. package/dist/components/date-time-picker/index.js +1 -1
  106. package/dist/components/due-date-calculator/index.js +2 -2
  107. package/dist/components/gestational-age-calculator/index.js +1 -1
  108. package/dist/components/hcg-doubling/index.js +1 -1
  109. package/dist/components/index.d.ts +1 -0
  110. package/dist/components/index.d.ts.map +1 -1
  111. package/dist/components/notes-panel/index.js +1 -1
  112. package/dist/components/operator-hero/index.js +1 -1
  113. package/dist/components/patient-details/index.js +1 -1
  114. package/dist/components/patient-details/patient-details.d.ts +8 -0
  115. package/dist/components/patient-details/patient-details.d.ts.map +1 -1
  116. package/dist/components/patient-table/index.js +1 -1
  117. package/dist/components/payment-card/index.js +1 -1
  118. package/dist/components/pregnancy-dating/index.js +1 -1
  119. package/dist/components/radiograph-panel/index.js +1 -1
  120. package/dist/components/resource-chip/index.d.ts +3 -0
  121. package/dist/components/resource-chip/index.d.ts.map +1 -0
  122. package/dist/components/resource-chip/index.js +5 -0
  123. package/dist/components/resource-chip/index.js.map +1 -0
  124. package/dist/components/resource-chip/resource-chip.d.ts +26 -0
  125. package/dist/components/resource-chip/resource-chip.d.ts.map +1 -0
  126. package/dist/components/rich-text-editor/index.js +1 -1
  127. package/dist/host-compat.css +7 -1
  128. package/dist/i18n/locales/ar.d.ts +4 -0
  129. package/dist/i18n/locales/ar.d.ts.map +1 -1
  130. package/dist/i18n/locales/ar.js +4 -0
  131. package/dist/i18n/locales/ar.js.map +1 -1
  132. package/dist/i18n/locales/de.d.ts +4 -0
  133. package/dist/i18n/locales/de.d.ts.map +1 -1
  134. package/dist/i18n/locales/de.js +4 -0
  135. package/dist/i18n/locales/de.js.map +1 -1
  136. package/dist/i18n/locales/el.d.ts +4 -0
  137. package/dist/i18n/locales/el.d.ts.map +1 -1
  138. package/dist/i18n/locales/el.js +4 -0
  139. package/dist/i18n/locales/el.js.map +1 -1
  140. package/dist/i18n/locales/en.d.ts +4 -0
  141. package/dist/i18n/locales/en.d.ts.map +1 -1
  142. package/dist/i18n/locales/en.js +4 -0
  143. package/dist/i18n/locales/en.js.map +1 -1
  144. package/dist/i18n/locales/es.d.ts +4 -0
  145. package/dist/i18n/locales/es.d.ts.map +1 -1
  146. package/dist/i18n/locales/es.js +4 -0
  147. package/dist/i18n/locales/es.js.map +1 -1
  148. package/dist/i18n/locales/fr.d.ts +4 -0
  149. package/dist/i18n/locales/fr.d.ts.map +1 -1
  150. package/dist/i18n/locales/fr.js +4 -0
  151. package/dist/i18n/locales/fr.js.map +1 -1
  152. package/dist/i18n/locales/hi.d.ts +4 -0
  153. package/dist/i18n/locales/hi.d.ts.map +1 -1
  154. package/dist/i18n/locales/hi.js +4 -0
  155. package/dist/i18n/locales/hi.js.map +1 -1
  156. package/dist/i18n/locales/it.d.ts +4 -0
  157. package/dist/i18n/locales/it.d.ts.map +1 -1
  158. package/dist/i18n/locales/it.js +4 -0
  159. package/dist/i18n/locales/it.js.map +1 -1
  160. package/dist/i18n/locales/ja.d.ts +4 -0
  161. package/dist/i18n/locales/ja.d.ts.map +1 -1
  162. package/dist/i18n/locales/ja.js +4 -0
  163. package/dist/i18n/locales/ja.js.map +1 -1
  164. package/dist/i18n/locales/nl.d.ts +4 -0
  165. package/dist/i18n/locales/nl.d.ts.map +1 -1
  166. package/dist/i18n/locales/nl.js +4 -0
  167. package/dist/i18n/locales/nl.js.map +1 -1
  168. package/dist/i18n/locales/pl.d.ts +4 -0
  169. package/dist/i18n/locales/pl.d.ts.map +1 -1
  170. package/dist/i18n/locales/pl.js +4 -0
  171. package/dist/i18n/locales/pl.js.map +1 -1
  172. package/dist/i18n/locales/pt.d.ts +4 -0
  173. package/dist/i18n/locales/pt.d.ts.map +1 -1
  174. package/dist/i18n/locales/pt.js +4 -0
  175. package/dist/i18n/locales/pt.js.map +1 -1
  176. package/dist/i18n/locales/ro.d.ts +4 -0
  177. package/dist/i18n/locales/ro.d.ts.map +1 -1
  178. package/dist/i18n/locales/ro.js +4 -0
  179. package/dist/i18n/locales/ro.js.map +1 -1
  180. package/dist/i18n/locales/ru.d.ts +4 -0
  181. package/dist/i18n/locales/ru.d.ts.map +1 -1
  182. package/dist/i18n/locales/ru.js +4 -0
  183. package/dist/i18n/locales/ru.js.map +1 -1
  184. package/dist/i18n/locales/sq.d.ts +4 -0
  185. package/dist/i18n/locales/sq.d.ts.map +1 -1
  186. package/dist/i18n/locales/sq.js +4 -0
  187. package/dist/i18n/locales/sq.js.map +1 -1
  188. package/dist/i18n/locales/sv.d.ts +4 -0
  189. package/dist/i18n/locales/sv.d.ts.map +1 -1
  190. package/dist/i18n/locales/sv.js +4 -0
  191. package/dist/i18n/locales/sv.js.map +1 -1
  192. package/dist/i18n/locales/tr.d.ts +4 -0
  193. package/dist/i18n/locales/tr.d.ts.map +1 -1
  194. package/dist/i18n/locales/tr.js +4 -0
  195. package/dist/i18n/locales/tr.js.map +1 -1
  196. package/dist/i18n/locales/zh.d.ts +4 -0
  197. package/dist/i18n/locales/zh.d.ts.map +1 -1
  198. package/dist/i18n/locales/zh.js +4 -0
  199. package/dist/i18n/locales/zh.js.map +1 -1
  200. package/dist/index.js +961 -958
  201. package/dist/index.js.map +1 -1
  202. package/dist/locales/ar.json +4 -0
  203. package/dist/locales/de.json +4 -0
  204. package/dist/locales/el.json +4 -0
  205. package/dist/locales/en.json +4 -0
  206. package/dist/locales/es.json +4 -0
  207. package/dist/locales/fr.json +4 -0
  208. package/dist/locales/hi.json +4 -0
  209. package/dist/locales/it.json +4 -0
  210. package/dist/locales/ja.json +4 -0
  211. package/dist/locales/nl.json +4 -0
  212. package/dist/locales/pl.json +4 -0
  213. package/dist/locales/pt.json +4 -0
  214. package/dist/locales/ro.json +4 -0
  215. package/dist/locales/ru.json +4 -0
  216. package/dist/locales/sq.json +4 -0
  217. package/dist/locales/sv.json +4 -0
  218. package/dist/locales/tr.json +4 -0
  219. package/dist/locales/zh.json +4 -0
  220. package/dist/patterns/anamnesis/index.js +1 -1
  221. package/dist/patterns/payment-automation-upsell/index.js +1 -1
  222. package/dist/tokens.css +40 -24
  223. package/package.json +5 -1
  224. package/dist/_chunks/appointment-card-BhcPJpXh.js.map +0 -1
  225. package/dist/_chunks/calendar-4dXTvsCz.js.map +0 -1
  226. package/dist/_chunks/calendar-event-card-C6qGtywL.js +0 -257
  227. package/dist/_chunks/calendar-event-card-C6qGtywL.js.map +0 -1
  228. package/dist/_chunks/color-picker-D-tUwxxT.js.map +0 -1
  229. package/dist/_chunks/control-room-rail-IH1eBjrK.js +0 -333
  230. package/dist/_chunks/control-room-rail-IH1eBjrK.js.map +0 -1
  231. package/dist/_chunks/date-picker-Bp64zk2p.js.map +0 -1
  232. package/dist/_chunks/patient-details-qnsqYBGQ.js.map +0 -1
  233. package/dist/_chunks/payment-automation-upsell-BBIG7NFL.js.map +0 -1
  234. package/dist/_chunks/subDays-CAUv47M1.js +0 -8
@@ -1,333 +0,0 @@
1
- import { jsx as g, jsxs as I, Fragment as ro } from "react/jsx-runtime";
2
- import { useState as z, useCallback as f, useMemo as C, useRef as N, useContext as j, useId as so, useEffect as lo, createContext as io, forwardRef as ao } from "react";
3
- import { useTranslation as co } from "react-i18next";
4
- import { I as X } from "./icon-button-DA2CAGHZ.js";
5
- import { a as uo } from "./panel-header-D313n_9-.js";
6
- import { T as po } from "./tool-rail-CHyUmulN.js";
7
- import { u as fo } from "./use-persistent-state-nZwZAnE9.js";
8
- import { S as mo } from "./star-Bf9L2Uot.js";
9
- import { X as Ro } from "./x-B5YnXwCz.js";
10
- const go = {
11
- id: "control-room-rail",
12
- capabilities: ["open", "close", "select_single"],
13
- state: {
14
- activeToolId: {
15
- type: "string | null",
16
- descriptionKey: "ui.toolRail.agent.state.activeToolId",
17
- description: "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.",
18
- read: (t) => t.getActiveToolId()
19
- }
20
- },
21
- actions: {
22
- open: {
23
- // Pure ephemeral panel state (open) — no data loss, no external effect.
24
- safety: "read",
25
- argsType: "{ id: string }",
26
- argsSchema: {
27
- type: "object",
28
- properties: { id: { type: "string" } },
29
- required: ["id"]
30
- },
31
- idempotent: !0,
32
- descriptionKey: "ui.toolRail.agent.actions.open",
33
- description: "Open the given tool's panel.",
34
- examples: [{ args: { id: "inbox" }, note: "Open the inbox tool panel." }],
35
- invoke: (t, n) => {
36
- t.open(n.id);
37
- }
38
- },
39
- close: {
40
- safety: "read",
41
- idempotent: !0,
42
- descriptionKey: "ui.toolRail.agent.actions.close",
43
- description: "Collapse the rail to its strip (no active tool).",
44
- invoke: (t) => {
45
- t.close();
46
- }
47
- },
48
- select_tool: {
49
- safety: "read",
50
- argsType: "{ id: string | null }",
51
- argsSchema: {
52
- type: "object",
53
- properties: { id: { type: ["string", "null"] } },
54
- required: ["id"]
55
- },
56
- idempotent: !0,
57
- descriptionKey: "ui.toolRail.agent.actions.selectTool",
58
- description: "Set the active tool by id (opens its panel), or pass null to collapse.",
59
- invoke: (t, n) => {
60
- t.setActiveTool(n.id);
61
- }
62
- }
63
- },
64
- domHooks: {
65
- root: {
66
- attr: "data-component",
67
- value: "control-room-rail",
68
- description: "Marks the ControlRoomRail wrapper."
69
- },
70
- instanceId: {
71
- attr: "data-component-id",
72
- sourceProp: "id",
73
- description: "Sourced from the id prop. Required to address a specific rail from the agent."
74
- },
75
- item: {
76
- attr: "data-tool-id",
77
- description: "Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id."
78
- }
79
- }
80
- }, S = io(null);
81
- function Mo({
82
- globalTools: t = [],
83
- children: n
84
- }) {
85
- const [c, s] = z(
86
- () => /* @__PURE__ */ new Map()
87
- ), d = f(
88
- (l, i) => {
89
- s((h) => {
90
- const k = new Map(h);
91
- return k.set(l, i), k;
92
- });
93
- },
94
- []
95
- ), P = f((l) => {
96
- s((i) => {
97
- if (!i.has(l)) return i;
98
- const h = new Map(i);
99
- return h.delete(l), h;
100
- });
101
- }, []), v = C(
102
- () => Array.from(c.values()).flat(),
103
- [c]
104
- ), x = N(null), p = f((l) => {
105
- x.current = l;
106
- }, []), b = f((l) => {
107
- var i;
108
- (i = x.current) == null || i.setActiveTool(l);
109
- }, []), R = f(() => {
110
- var l;
111
- (l = x.current) == null || l.setActiveTool(null);
112
- }, []), F = C(
113
- () => ({
114
- globalTools: t,
115
- contextualTools: v,
116
- registerContextualTools: d,
117
- unregisterContextualTools: P,
118
- registerRail: p,
119
- openTool: b,
120
- closeTool: R
121
- }),
122
- [
123
- t,
124
- v,
125
- d,
126
- P,
127
- p,
128
- b,
129
- R
130
- ]
131
- );
132
- return /* @__PURE__ */ g(S.Provider, { value: F, children: n });
133
- }
134
- function Vo(t) {
135
- const n = j(S), c = n == null ? void 0 : n.registerContextualTools, s = n == null ? void 0 : n.unregisterContextualTools, d = so();
136
- lo(() => {
137
- if (!(!c || !s))
138
- return c(d, t), () => s(d);
139
- }, [c, s, d, t]);
140
- }
141
- function vo() {
142
- const t = j(S);
143
- return C(() => {
144
- if (!t) return [];
145
- const n = t.contextualTools.map((s) => ({
146
- ...s,
147
- scope: "contextual"
148
- })), c = t.globalTools.map((s) => ({
149
- ...s,
150
- scope: "global"
151
- }));
152
- return [...n, ...c];
153
- }, [t]);
154
- }
155
- function jo() {
156
- const t = j(S), n = f(() => {
157
- }, []);
158
- return {
159
- openTool: (t == null ? void 0 : t.openTool) ?? n,
160
- closeTool: (t == null ? void 0 : t.closeTool) ?? n
161
- };
162
- }
163
- function ho() {
164
- const t = j(S), n = f((c) => {
165
- }, []);
166
- return (t == null ? void 0 : t.registerRail) ?? n;
167
- }
168
- const Fo = ao(function({
169
- tools: n,
170
- railLabel: c,
171
- reorderable: s = !0,
172
- favoriteIds: d,
173
- defaultFavoriteIds: P,
174
- onFavoriteIdsChange: v,
175
- persistFavoritesKey: x = "ui.controlRoom.favorites",
176
- activeToolId: p,
177
- defaultActiveToolId: b = null,
178
- onActiveToolChange: R,
179
- ...F
180
- }, l) {
181
- const { t: i } = co(), [h, k] = z(
182
- p ?? b ?? null
183
- ), _ = p !== void 0 ? p : h, $ = f(
184
- (o) => {
185
- p === void 0 && k(o), R == null || R(o);
186
- },
187
- [p, R]
188
- ), D = vo(), T = n ?? D, H = d !== void 0, [G, J] = fo(
189
- x,
190
- () => P ?? T.filter((o) => o.scope === "global").map((o) => o.id),
191
- { disabled: H }
192
- ), A = H ? d : G, u = C(() => {
193
- const o = /* @__PURE__ */ new Map();
194
- for (const r of T) o.set(r.id, r);
195
- return o;
196
- }, [T]), w = C(
197
- () => new Set(A.filter((o) => u.has(o))),
198
- [A, u]
199
- ), B = (o) => {
200
- const r = o(A.filter((e) => u.has(e)));
201
- H || J((e) => o(e.filter((a) => u.has(a)))), v == null || v(r);
202
- }, L = C(() => {
203
- if (!s) return T;
204
- const o = A.filter((e) => u.has(e)).map((e) => ({
205
- ...u.get(e),
206
- scope: "global",
207
- reorderable: !0
208
- })), r = T.filter((e) => !w.has(e.id)).map((e) => ({
209
- ...e,
210
- scope: "contextual",
211
- reorderable: !0
212
- }));
213
- return [...o, ...r];
214
- }, [s, T, A, u, w]), [Q, U] = z(""), K = N(!1), W = (o, r) => {
215
- const e = r ? i("controlRoom.pinnedAnnounce", {
216
- tool: o,
217
- defaultValue: "Pinned {{tool}} to favourites"
218
- }) : i("controlRoom.unpinnedAnnounce", {
219
- tool: o,
220
- defaultValue: "Removed {{tool}} from favourites"
221
- });
222
- K.current = !K.current, U(K.current ? e : `${e}​`);
223
- }, Y = (o) => {
224
- var r;
225
- W(((r = u.get(o)) == null ? void 0 : r.label) ?? o, !w.has(o)), B(
226
- (e) => e.includes(o) ? e.filter((a) => a !== o) : [...e, o]
227
- );
228
- }, Z = (o, r) => {
229
- var a;
230
- const e = (a = L[o]) == null ? void 0 : a.id;
231
- e !== void 0 && B((y) => {
232
- const M = y.filter((m) => u.has(m)), V = M.length;
233
- if (o < V) {
234
- if (r >= V) return M.filter((no) => no !== e);
235
- const m = M.slice();
236
- return m.splice(o, 1), m.splice(r, 0, e), m;
237
- }
238
- if (r <= V) {
239
- const m = M.slice();
240
- return m.splice(Math.min(r, V), 0, e), m;
241
- }
242
- return y;
243
- });
244
- }, oo = ({
245
- tool: o,
246
- from: r,
247
- to: e
248
- }) => {
249
- const a = w.size, y = r < a;
250
- return y && e >= a ? i("controlRoom.unpinnedAnnounce", {
251
- tool: o.label,
252
- defaultValue: "Removed {{tool}} from favourites"
253
- }) : !y && e <= a ? i("controlRoom.pinnedAnnounce", {
254
- tool: o.label,
255
- defaultValue: "Pinned {{tool}} to favourites"
256
- }) : y && e < a ? i("controlRoom.reorderAnnounce", {
257
- tool: o.label,
258
- to: e + 1,
259
- total: a,
260
- defaultValue: "{{tool}} moved to position {{to}} of {{total}}"
261
- }) : "";
262
- }, O = N(null), E = ho(), to = f(
263
- (o) => {
264
- O.current = o, E(o), typeof l == "function" ? l(o) : l && (l.current = o);
265
- },
266
- [E, l]
267
- ), q = _ != null ? u.get(_) ?? null : null, eo = q ? /* @__PURE__ */ I(ro, { children: [
268
- s ? (() => {
269
- const o = w.has(q.id);
270
- return /* @__PURE__ */ g(
271
- X,
272
- {
273
- icon: /* @__PURE__ */ g(
274
- mo,
275
- {
276
- "aria-hidden": "true",
277
- fill: o ? "currentColor" : "none",
278
- className: o ? "ds:text-[color:var(--accent)]" : void 0
279
- }
280
- ),
281
- intent: "ghost",
282
- size: "sm",
283
- "aria-pressed": o,
284
- "aria-label": i("controlRoom.favorite", {
285
- defaultValue: "Favourite"
286
- }),
287
- onClick: () => Y(q.id)
288
- }
289
- );
290
- })() : null,
291
- /* @__PURE__ */ g(
292
- X,
293
- {
294
- icon: /* @__PURE__ */ g(Ro, { "aria-hidden": "true" }),
295
- intent: "ghost",
296
- size: "sm",
297
- "aria-label": i("controlRoom.close", { defaultValue: "Close" }),
298
- onClick: () => {
299
- var o;
300
- return (o = O.current) == null ? void 0 : o.close();
301
- }
302
- }
303
- )
304
- ] }) : null;
305
- return /* @__PURE__ */ I(uo, { actions: eo, children: [
306
- /* @__PURE__ */ g(
307
- po,
308
- {
309
- ref: to,
310
- dataComponent: "control-room-rail",
311
- agentAdapter: go,
312
- tools: L,
313
- activeToolId: p,
314
- defaultActiveToolId: b,
315
- onActiveToolChange: $,
316
- railLabel: c ?? i("controlRoom.railLabel", { defaultValue: "Control room" }),
317
- onReorder: s ? Z : void 0,
318
- formatReorderAnnouncement: s ? oo : void 0,
319
- ...F
320
- }
321
- ),
322
- s ? /* @__PURE__ */ g("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: Q }) : null
323
- ] });
324
- });
325
- export {
326
- Mo as C,
327
- Fo as a,
328
- vo as b,
329
- go as c,
330
- Vo as d,
331
- jo as u
332
- };
333
- //# sourceMappingURL=control-room-rail-IH1eBjrK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-room-rail-IH1eBjrK.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 * 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 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 favorites = isControlled ? favoriteIds : storedFavorites;\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","onFavoriteIdsChange","persistFavoritesKey","activeToolId","defaultActiveToolId","onActiveToolChange","rest","ref","t","useTranslation","activeTracked","setActiveTracked","activeId","handleActiveToolChange","merged","resolved","isControlled","storedFavorites","setStoredFavorites","usePersistentState","tl","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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AAA,IAG5C,OACA;AAAA,IACJ,gBAAApE;AAAA,MAACyE;AAAA,MAAA;AAAA,QACC,MAAM,gBAAAzE,EAAC2E,IAAA,EAAE,eAAY,OAAA,CAAO;AAAA,QAC5B,QAAO;AAAA,QACP,MAAK;AAAA,QACL,cAAY9C,EAAE,qBAAqB,EAAE,cAAc,SAAS;AAAA,QAC5D,SAAS,MAAA;;AAAM,kBAAAhC,IAAAJ,EAAc,YAAd,gBAAAI,EAAuB;AAAA;AAAA,MAAM;AAAA,IAAA;AAAA,EAC9C,EAAA,CACF,IACE;AACJ,SACE,gBAAAyE,EAACM,IAAA,EAA2B,SAASP,IACnC,UAAA;AAAA,IAAA,gBAAArE;AAAA,MAAC6E;AAAA,MAAA;AAAA,QACC,KAAKV;AAAA,QACL,eAAc;AAAA,QACd,cAAc9F;AAAA,QACd,OAAO2E;AAAA,QACP,cAAAxB;AAAA,QACA,qBAAAC;AAAA,QACA,oBAAoBS;AAAA,QACpB,WACEhB,KACAW,EAAE,yBAAyB,EAAE,cAAc,gBAAgB;AAAA,QAE7D,WAAWV,IAAcwC,IAAgB;AAAA,QACzC,2BACExC,IAAc8C,KAA4B;AAAA,QAE3C,GAAGtC;AAAA,MAAA;AAAA,IAAA;AAAA,IAILR,IACC,gBAAAnB,EAAC,QAAA,EAAK,MAAK,UAAS,aAAU,UAAS,WAAU,cAC9C,UAAAkD,EAAA,CACH,IACE;AAAA,EAAA,GACN;AAEJ,CAAC;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-picker-Bp64zk2p.js","sources":["../../src/components/date-picker/date-picker.agent.ts","../../src/components/date-picker/date-picker.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DatePicker. */\n/* */\n/* DatePicker wraps react-day-picker inside a Radix Popover. The agent */\n/* surface curates the input + popover into a small set of date-shaped */\n/* operations — set / clear / open / close. The handle is the curated */\n/* surface; raw rdp internals are deliberately not exposed. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` §15. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DatePickerHandle } from './date-picker';\n\nexport const datePickerAgent: AgentAdapter<DatePickerHandle> = {\n id: 'date-picker',\n // Persisted single date (value state + set_date) → select_single + set_value,\n // plus open/close of the calendar popover.\n capabilities: ['select_single', 'set_value', 'open', 'close'],\n state: {\n value: {\n type: 'iso-date',\n descriptionKey: 'ui.agent.datePicker.state.value',\n description: 'Currently-selected ISO date, or null.',\n read: (handle) => handle.getValue()?.toISOString() ?? null,\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.datePicker.state.isOpen',\n description: 'Whether the calendar popover is open.',\n read: (handle) => handle.isOpen(),\n },\n },\n actions: {\n set_date: {\n safety: 'write',\n argsType: '{ date: string }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n type: 'string',\n format: 'date',\n description: 'ISO date, e.g. \"2026-06-23\".',\n },\n },\n required: ['date'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.datePicker.actions.setDate',\n description: 'Select a specific date (ISO yyyy-mm-dd).',\n examples: [{ args: { date: '2026-06-23' }, note: 'Select 23 Jun 2026.' }],\n invoke: (handle, args: { date: string }) => {\n handle.setValue(new Date(args.date));\n },\n },\n clear: {\n // Discards the selected date — loses the user's input.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.datePicker.actions.clear',\n description: 'Clear the selected date.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.datePicker.actions.open',\n description: 'Open the calendar popover.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.datePicker.actions.close',\n description: 'Close the calendar popover.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'date-picker',\n description: 'Marks the DatePicker wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type KeyboardEvent,\n} from 'react';\nimport { type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport * as Popover from '@radix-ui/react-popover';\nimport { DayPicker } from 'react-day-picker';\nimport {\n format as fnsFormat,\n parse as fnsParse,\n isValid,\n isSameDay,\n isBefore,\n isAfter,\n} from 'date-fns';\nimport { CalendarDays, Check } from 'lucide-react';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport {\n FormFieldContext,\n useFormField,\n} from '../form-field/form-field-context';\nimport {\n useDateFnsLocale,\n getShortDateFormat,\n buildDisabledMatcher,\n CalendarChevron,\n calendarClassNames,\n triggerVariants,\n calendarIconVariants,\n popoverContentVariants,\n presetButtonVariants,\n} from '../_shared';\nimport { useAgentRegistration } from '../../agent';\nimport { datePickerAgent } from './date-picker.agent';\n\n/* -------------------------------------------------------------------------- */\n/* Imperative handle */\n/* -------------------------------------------------------------------------- */\n\n/** Curated imperative handle exposed via `ref` — also consumed by the agent adapter. */\nexport interface DatePickerHandle {\n /** Get the current selected date, or undefined. */\n getValue: () => Date | undefined;\n /** Set the selected date. */\n setValue: (date: Date | undefined) => void;\n /** Clear the selected date. */\n clear: () => void;\n /** Whether the popover is open. */\n isOpen: () => boolean;\n /** Open the calendar popover. */\n open: () => void;\n /** Close the calendar popover. */\n close: () => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Props */\n/* -------------------------------------------------------------------------- */\n\nexport interface DatePickerPreset {\n label: string;\n date: () => Date;\n}\n\nexport interface DatePickerProps extends Pick<\n VariantProps<typeof triggerVariants>,\n 'size'\n> {\n /** Current selected date — controlled. */\n value?: Date;\n /** Default selected date — uncontrolled. */\n defaultValue?: Date;\n /** Called when the selected date changes. */\n onChange?: (date: Date | undefined) => void;\n /** Minimum selectable date. */\n minDate?: Date;\n /** Maximum selectable date. */\n maxDate?: Date;\n /** Disabled dates — array or predicate. */\n disabledDates?: Date[] | ((date: Date) => boolean);\n /** Week starts on (0=Sunday). Derived from locale if not specified. */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n /** Quick-pick presets shown inline-start of the calendar. */\n presets?: DatePickerPreset[];\n /** Component size. */\n size?: 'sm' | 'md' | 'lg';\n /** Disabled state. */\n disabled?: boolean;\n /** Placeholder text. */\n placeholder?: string;\n /** Additional class names. */\n className?: string;\n /** id override. */\n id?: string;\n /** Accessible name for the date input, when the picker is NOT wrapped in a\n * `FormField`. Without one — and without a FormField's `<label htmlFor>` —\n * the input has no accessible name at all, so a picker placed inline beside\n * chips or in a toolbar was unnamed to a screen reader. Ignored in favour of\n * the FormField label when both are present. */\n 'aria-label'?: string;\n /** Accessible name by reference, same conditions as `aria-label`. */\n 'aria-labelledby'?: string;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------------- */\n\nexport const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n minDate,\n maxDate,\n disabledDates,\n weekStartsOn,\n presets,\n size = 'md',\n disabled,\n placeholder,\n className,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const ctx = useFormField();\n // A FormField labels the input through `<label htmlFor>`; outside one the\n // caller's aria-label is the only name available.\n const inFormField = useContext(FormFieldContext) !== null;\n const effectiveId = id ?? ctx.id;\n const effectiveDisabled = ctx.disabled || disabled;\n const effectiveTone = ctx.invalid ? 'error' : 'default';\n\n const locale = useDateFnsLocale(i18n.language);\n const dateFormat = getShortDateFormat(i18n.language);\n const placeholderText =\n placeholder ?? t('inputs.datePicker.placeholder', 'Select date');\n\n const [currentValueRaw, setDateValue] = useControllableState<\n Date | undefined\n >({\n value,\n defaultValue,\n onChange,\n });\n const currentValue = currentValueRaw;\n\n const [open, setOpen] = useState(false);\n const [inputText, setInputText] = useState(\n currentValue ? fnsFormat(currentValue, dateFormat, { locale }) : '',\n );\n const [inputInvalid, setInputInvalid] = useState(false);\n const [month, setMonth] = useState<Date>(currentValue ?? new Date());\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Sync input text when value changes externally\n useEffect(() => {\n if (currentValue) {\n setInputText(fnsFormat(currentValue, dateFormat, { locale }));\n setInputInvalid(false);\n } else {\n setInputText('');\n }\n }, [currentValue, dateFormat, locale]);\n\n const disabledMatcher = buildDisabledMatcher(\n minDate,\n maxDate,\n disabledDates,\n );\n\n /** Check if a date is disabled. */\n const isDateDisabled = useCallback(\n (date: Date): boolean => {\n if (minDate && isBefore(date, minDate)) return true;\n if (maxDate && isAfter(date, maxDate)) return true;\n if (Array.isArray(disabledDates)) {\n return disabledDates.some(\n (d) => d.toDateString() === date.toDateString(),\n );\n }\n if (typeof disabledDates === 'function') {\n return disabledDates(date);\n }\n return false;\n },\n [minDate, maxDate, disabledDates],\n );\n\n const emit = useCallback(\n (date: Date | undefined) => {\n setDateValue(date);\n },\n [setDateValue],\n );\n\n const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const text = e.target.value;\n setInputText(text);\n\n if (text.length === 0) {\n setInputInvalid(false);\n emit(undefined);\n return;\n }\n\n const parsed = fnsParse(text, dateFormat, new Date(), { locale });\n if (isValid(parsed) && !isDateDisabled(parsed)) {\n setInputInvalid(false);\n emit(parsed);\n setMonth(parsed);\n } else if (text.length === dateFormat.length) {\n setInputInvalid(true);\n }\n };\n\n const handleInputKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter' && open) {\n e.preventDefault();\n setOpen(false);\n }\n if (e.key === 'Escape' && open) {\n e.preventDefault();\n setOpen(false);\n }\n if (e.key === 'ArrowDown' && !open) {\n e.preventDefault();\n setOpen(true);\n }\n };\n\n const handleDaySelect = (date: Date | undefined) => {\n if (date) {\n emit(date);\n setOpen(false);\n inputRef.current?.focus();\n }\n };\n\n const handlePresetClick = (preset: DatePickerPreset) => {\n const date = preset.date();\n emit(date);\n setMonth(date);\n setOpen(false);\n inputRef.current?.focus();\n };\n\n // A preset is \"active\" when the selected date matches the one it produces,\n // so the shortcut and the highlighted day visibly agree.\n const isPresetActive = (preset: DatePickerPreset): boolean =>\n currentValue ? isSameDay(preset.date(), currentValue) : false;\n\n const gridLabel = t('inputs.datePicker.gridLabel', 'Calendar');\n\n const handle = useMemo<DatePickerHandle>(\n () => ({\n getValue: () => currentValue,\n setValue: (date) => emit(date),\n clear: () => emit(undefined),\n isOpen: () => open,\n open: () => setOpen(true),\n close: () => setOpen(false),\n }),\n [currentValue, emit, open],\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLDivElement, []);\n useAgentRegistration(datePickerAgent, handle, effectiveId);\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <div\n ref={rootRef}\n className={className}\n data-component=\"date-picker\"\n data-component-id={effectiveId}\n >\n <div className=\"ds:relative\">\n {/* `Popover.Trigger asChild` slots Radix's trigger props\n (including `type=\"button\"`, `aria-haspopup`,\n `aria-expanded`) onto the child element. We want those on\n the input, not the surrounding `<div>`, so the input is\n the direct asChild target and the icon sits as a sibling. */}\n <Popover.Trigger asChild disabled={effectiveDisabled}>\n <input\n ref={inputRef}\n id={effectiveId}\n type=\"text\"\n // ARIA 1.2 permits `role=\"combobox\"` on `<input>`. That's\n // what makes `aria-expanded` / `aria-controls` valid\n // here — the input acts as a combobox-style trigger\n // whose popup is the calendar dialog. `aria-haspopup=\"dialog\"`\n // replaces `aria-controls` for the dialog-popup pattern.\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n role=\"combobox\"\n value={inputText}\n placeholder={placeholderText}\n disabled={effectiveDisabled}\n // A FormField labels the input through `<label htmlFor>`, so\n // its label wins and these stay off. Outside one they are the\n // only name the input can have.\n aria-label={inFormField ? undefined : ariaLabel}\n aria-labelledby={inFormField ? undefined : ariaLabelledBy}\n aria-describedby={ctx.describedBy || undefined}\n aria-invalid={ctx.invalid || inputInvalid || undefined}\n aria-required={ctx.required || undefined}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onChange={handleInputChange}\n onKeyDown={handleInputKeyDown}\n onClick={() => !open && setOpen(true)}\n className={triggerVariants({\n size,\n tone: inputInvalid ? 'error' : effectiveTone,\n })}\n />\n </Popover.Trigger>\n <span aria-hidden=\"true\" className={calendarIconVariants({ size })}>\n <CalendarDays />\n </span>\n </div>\n\n <Popover.Portal>\n <Popover.Content\n sideOffset={4}\n align=\"start\"\n className={popoverContentVariants()}\n onOpenAutoFocus={(e) => {\n // Keep focus on input, don't auto-focus the calendar\n e.preventDefault();\n }}\n >\n <div className=\"ds:flex ds:gap-[var(--spacing-md)]\">\n {/* Presets column */}\n {presets && presets.length > 0 ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:min-w-[8rem] ds:border-e ds:border-border ds:pe-[var(--spacing-md)]\">\n {presets.map((preset) => {\n const active = isPresetActive(preset);\n return (\n <button\n key={preset.label}\n type=\"button\"\n aria-pressed={active}\n onClick={() => handlePresetClick(preset)}\n className={presetButtonVariants({ active })}\n >\n <span className=\"ds:min-w-0 ds:truncate\">\n {preset.label}\n </span>\n {active ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:shrink-0 ds:text-primary\"\n />\n ) : null}\n </button>\n );\n })}\n </div>\n ) : null}\n\n {/* Calendar */}\n <div role=\"region\" aria-label={gridLabel}>\n <DayPicker\n mode=\"single\"\n selected={currentValue}\n onSelect={handleDaySelect}\n month={month}\n onMonthChange={setMonth}\n disabled={disabledMatcher}\n weekStartsOn={weekStartsOn}\n locale={locale}\n showOutsideDays\n fixedWeeks\n classNames={calendarClassNames}\n components={{ Chevron: CalendarChevron }}\n />\n </div>\n </div>\n </Popover.Content>\n </Popover.Portal>\n </div>\n </Popover.Root>\n );\n },\n);\n\nDatePicker.displayName = 'DatePicker';\n"],"names":["datePickerAgent","handle","_a","args","DatePicker","forwardRef","value","defaultValue","onChange","minDate","maxDate","disabledDates","weekStartsOn","presets","size","disabled","placeholder","className","id","ariaLabel","ariaLabelledBy","ref","t","i18n","useTranslation","ctx","useFormField","inFormField","useContext","FormFieldContext","effectiveId","effectiveDisabled","effectiveTone","locale","useDateFnsLocale","dateFormat","getShortDateFormat","placeholderText","currentValueRaw","setDateValue","useControllableState","currentValue","open","setOpen","useState","inputText","setInputText","fnsFormat","inputInvalid","setInputInvalid","month","setMonth","inputRef","useRef","useEffect","disabledMatcher","buildDisabledMatcher","isDateDisabled","useCallback","date","isBefore","isAfter","d","emit","handleInputChange","text","parsed","fnsParse","isValid","handleInputKeyDown","handleDaySelect","handlePresetClick","preset","isPresetActive","isSameDay","gridLabel","useMemo","rootRef","useImperativeHandle","useAgentRegistration","Popover","jsxs","jsx","triggerVariants","calendarIconVariants","CalendarDays","popoverContentVariants","active","presetButtonVariants","Check","DayPicker","calendarClassNames","CalendarChevron"],"mappings":";;;;;;;;;;;;AAcO,MAAMA,KAAkD;AAAA,EAC7D,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,iBAAiB,aAAa,QAAQ,OAAO;AAAA,EAC5D,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAA;;AAAW,iBAAAC,IAAAD,EAAO,SAAA,MAAP,gBAAAC,EAAmB,kBAAiB;AAAA;AAAA,IAAA;AAAA,IAExD,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACD,MAAWA,EAAO,OAAA;AAAA,IAAO;AAAA,EAClC;AAAA,EAEF,SAAS;AAAA,IACP,UAAU;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MA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