@alfadocs/ui-kit 1.7.0 → 1.9.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 (142) hide show
  1. package/dist/_chunks/{actions-cell-renderer-ALEAGO3j.js → actions-cell-renderer-B2pw6iH8.js} +2 -2
  2. package/dist/_chunks/{anamnesis-summary-rows-F-cCmFAn.js → anamnesis-summary-rows-d44s_whc.js} +2 -2
  3. package/dist/_chunks/{antenatal-schedule-timeline-BjlF2rTz.js → antenatal-schedule-timeline-B1k8QkA6.js} +3 -3
  4. package/dist/_chunks/{appointment-card-BhcPJpXh.js → appointment-card-Dzr3GeVz.js} +73 -90
  5. package/dist/_chunks/{appointment-timeline-CMPvzlGZ.js → appointment-timeline-0mwtpErq.js} +3 -3
  6. package/dist/_chunks/{appointment-tray-3c_FLxXJ.js → appointment-tray-4FUu_5NX.js} +2 -2
  7. package/dist/_chunks/armchair-BaLDW6Hz.js +23 -0
  8. package/dist/_chunks/{booking-CQMJUFG-.js → booking-DHkKcUIl.js} +4 -4
  9. package/dist/_chunks/{calendar-4dXTvsCz.js → calendar-B4Gnyu1C.js} +553 -437
  10. package/dist/_chunks/calendar-event-card-Bjdbik8G.js +425 -0
  11. package/dist/_chunks/{care-plan-card-DQjVRDxO.js → care-plan-card-aDN4oem9.js} +3 -3
  12. package/dist/_chunks/{care-plan-entry-card-CMpoeNkb.js → care-plan-entry-card-BEhANdBE.js} +2 -2
  13. package/dist/_chunks/{care-plan-header-CxYoq23f.js → care-plan-header-CkpPyQqG.js} +2 -2
  14. package/dist/_chunks/{color-picker-D-tUwxxT.js → color-picker-oZ6zYks8.js} +164 -151
  15. package/dist/_chunks/control-room-rail-Cj2iX9h_.js +337 -0
  16. package/dist/_chunks/{cycle-calculator-DzgO1vzP.js → cycle-calculator-DmtYGhqq.js} +3 -3
  17. package/dist/_chunks/{date-picker-Bp64zk2p.js → date-picker-CepI_oI2.js} +77 -74
  18. package/dist/_chunks/{date-picker-variants-pKAJfnWr.js → date-picker-variants-DfuooXEK.js} +7 -2
  19. package/dist/_chunks/{date-range-picker-CDrZ8Zh0.js → date-range-picker-BD8P_rJq.js} +46 -45
  20. package/dist/_chunks/{date-time-picker-DVETwpzc.js → date-time-picker-3I2vVKGV.js} +2 -2
  21. package/dist/_chunks/{due-date-calculator-wK8Tajzz.js → due-date-calculator-BF_Ikofx.js} +4 -4
  22. package/dist/_chunks/{entity-card-9_62gY7l.js → entity-card-DmrgYSEX.js} +4 -4
  23. package/dist/_chunks/{file-manager-Cc_upjZX.js → file-manager-Crg5dKez.js} +2 -2
  24. package/dist/_chunks/{gestational-age-calculator-C_uDAeP_.js → gestational-age-calculator-CxZelpu2.js} +5 -5
  25. package/dist/_chunks/{hcg-doubling-BaXkJhT-.js → hcg-doubling-CpU7H5rQ.js} +3 -3
  26. package/dist/_chunks/{link-cell-renderer-DH4JYpKU.js → link-cell-renderer-BZQtsuFz.js} +2 -2
  27. package/dist/_chunks/{notes-panel-DlnENphf.js → notes-panel-e9cJWVRg.js} +2 -2
  28. package/dist/_chunks/{operator-hero-CCDnIa1S.js → operator-hero-BnFv-Uef.js} +2 -2
  29. package/dist/_chunks/{parse-JqixfsU0.js → parse-MN9bGkrY.js} +2 -2
  30. package/dist/_chunks/{patient-details-qnsqYBGQ.js → patient-details-xrqe13az.js} +160 -159
  31. package/dist/_chunks/{patient-table-DwshfVsQ.js → patient-table-ChXM2K7H.js} +11 -7
  32. package/dist/_chunks/{payment-automation-upsell-BBIG7NFL.js → payment-automation-upsell-DwQW2fRp.js} +52 -63
  33. package/dist/_chunks/{payment-request-card-BjjBMdsp.js → payment-request-card-YVCcCZ25.js} +2 -2
  34. package/dist/_chunks/{pregnancy-dating-BVS_9YU2.js → pregnancy-dating-DtToyMyc.js} +5 -5
  35. package/dist/_chunks/{radiograph-panel.agent-CiHwgISa.js → radiograph-panel.agent-C3trfWqB.js} +3 -3
  36. package/dist/_chunks/repeat-CvQa5rZt.js +17 -0
  37. package/dist/_chunks/resource-chip-DYTG0IQQ.js +83 -0
  38. package/dist/_chunks/{rich-text-editor-DARnq_6N.js → rich-text-editor-BDfFtK4H.js} +2 -2
  39. package/dist/_chunks/subDays-BLl3y3pd.js +8 -0
  40. package/dist/agent-catalog.json +2 -2
  41. package/dist/components/appointment-card/index.js +2 -2
  42. package/dist/components/appointment-timeline/index.js +1 -1
  43. package/dist/components/booking/index.js +1 -1
  44. package/dist/components/calendar/calendar.d.ts +138 -12
  45. package/dist/components/calendar/index.js +1 -1
  46. package/dist/components/calendar-event-card/calendar-event-card.d.ts +48 -11
  47. package/dist/components/calendar-event-card/index.js +1 -1
  48. package/dist/components/care-plan-card/index.js +1 -1
  49. package/dist/components/care-plan-entry-card/index.js +1 -1
  50. package/dist/components/care-plan-header/index.js +1 -1
  51. package/dist/components/color-picker/index.d.ts +1 -1
  52. package/dist/components/color-picker/index.js +4 -3
  53. package/dist/components/color-picker/palettes.d.ts +10 -0
  54. package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
  55. package/dist/components/control-room-rail/index.js +1 -1
  56. package/dist/components/cycle-calculator/index.js +1 -1
  57. package/dist/components/data-table/index.js +2 -2
  58. package/dist/components/date-picker/date-picker.d.ts +11 -0
  59. package/dist/components/date-picker/index.js +1 -1
  60. package/dist/components/date-range-picker/index.js +1 -1
  61. package/dist/components/date-time-picker/index.js +1 -1
  62. package/dist/components/due-date-calculator/index.js +2 -2
  63. package/dist/components/file-manager/index.js +1 -1
  64. package/dist/components/gestational-age-calculator/index.js +1 -1
  65. package/dist/components/hcg-doubling/index.js +1 -1
  66. package/dist/components/index.d.ts +1 -0
  67. package/dist/components/notes-panel/index.js +1 -1
  68. package/dist/components/operator-hero/index.js +1 -1
  69. package/dist/components/patient-details/index.js +1 -1
  70. package/dist/components/patient-details/patient-details.d.ts +8 -0
  71. package/dist/components/patient-table/index.js +1 -1
  72. package/dist/components/patient-table/patient-table.d.ts +5 -4
  73. package/dist/components/payment-card/index.js +1 -1
  74. package/dist/components/pregnancy-dating/index.js +1 -1
  75. package/dist/components/radiograph-panel/index.js +1 -1
  76. package/dist/components/resource-chip/index.d.ts +3 -0
  77. package/dist/components/resource-chip/index.js +5 -0
  78. package/dist/components/resource-chip/resource-chip.d.ts +26 -0
  79. package/dist/components/rich-text-editor/index.js +1 -1
  80. package/dist/host-compat.css +7 -1
  81. package/dist/i18n/locales/ar.d.ts +4 -0
  82. package/dist/i18n/locales/ar.js +4 -0
  83. package/dist/i18n/locales/de.d.ts +4 -0
  84. package/dist/i18n/locales/de.js +4 -0
  85. package/dist/i18n/locales/el.d.ts +4 -0
  86. package/dist/i18n/locales/el.js +4 -0
  87. package/dist/i18n/locales/en.d.ts +4 -0
  88. package/dist/i18n/locales/en.js +4 -0
  89. package/dist/i18n/locales/es.d.ts +4 -0
  90. package/dist/i18n/locales/es.js +4 -0
  91. package/dist/i18n/locales/fr.d.ts +4 -0
  92. package/dist/i18n/locales/fr.js +4 -0
  93. package/dist/i18n/locales/hi.d.ts +4 -0
  94. package/dist/i18n/locales/hi.js +4 -0
  95. package/dist/i18n/locales/it.d.ts +4 -0
  96. package/dist/i18n/locales/it.js +4 -0
  97. package/dist/i18n/locales/ja.d.ts +4 -0
  98. package/dist/i18n/locales/ja.js +4 -0
  99. package/dist/i18n/locales/nl.d.ts +4 -0
  100. package/dist/i18n/locales/nl.js +4 -0
  101. package/dist/i18n/locales/pl.d.ts +4 -0
  102. package/dist/i18n/locales/pl.js +4 -0
  103. package/dist/i18n/locales/pt.d.ts +4 -0
  104. package/dist/i18n/locales/pt.js +4 -0
  105. package/dist/i18n/locales/ro.d.ts +4 -0
  106. package/dist/i18n/locales/ro.js +4 -0
  107. package/dist/i18n/locales/ru.d.ts +4 -0
  108. package/dist/i18n/locales/ru.js +4 -0
  109. package/dist/i18n/locales/sq.d.ts +4 -0
  110. package/dist/i18n/locales/sq.js +4 -0
  111. package/dist/i18n/locales/sv.d.ts +4 -0
  112. package/dist/i18n/locales/sv.js +4 -0
  113. package/dist/i18n/locales/tr.d.ts +4 -0
  114. package/dist/i18n/locales/tr.js +4 -0
  115. package/dist/i18n/locales/zh.d.ts +4 -0
  116. package/dist/i18n/locales/zh.js +4 -0
  117. package/dist/index.js +961 -958
  118. package/dist/locales/ar.json +4 -0
  119. package/dist/locales/de.json +4 -0
  120. package/dist/locales/el.json +4 -0
  121. package/dist/locales/en.json +4 -0
  122. package/dist/locales/es.json +4 -0
  123. package/dist/locales/fr.json +4 -0
  124. package/dist/locales/hi.json +4 -0
  125. package/dist/locales/it.json +4 -0
  126. package/dist/locales/ja.json +4 -0
  127. package/dist/locales/nl.json +4 -0
  128. package/dist/locales/pl.json +4 -0
  129. package/dist/locales/pt.json +4 -0
  130. package/dist/locales/ro.json +4 -0
  131. package/dist/locales/ru.json +4 -0
  132. package/dist/locales/sq.json +4 -0
  133. package/dist/locales/sv.json +4 -0
  134. package/dist/locales/tr.json +4 -0
  135. package/dist/locales/zh.json +4 -0
  136. package/dist/patterns/anamnesis/index.js +1 -1
  137. package/dist/patterns/payment-automation-upsell/index.js +1 -1
  138. package/dist/tokens.css +41 -24
  139. package/package.json +5 -1
  140. package/dist/_chunks/calendar-event-card-C6qGtywL.js +0 -257
  141. package/dist/_chunks/control-room-rail-IH1eBjrK.js +0 -333
  142. package/dist/_chunks/subDays-CAUv47M1.js +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe.",
6
6
  "license": "BUSL-1.1",
@@ -569,6 +569,10 @@
569
569
  "types": "./dist/components/reviews-panel/index.d.ts",
570
570
  "import": "./dist/components/reviews-panel/index.js"
571
571
  },
572
+ "./resource-chip": {
573
+ "types": "./dist/components/resource-chip/index.d.ts",
574
+ "import": "./dist/components/resource-chip/index.js"
575
+ },
572
576
  "./rich-text-editor": {
573
577
  "types": "./dist/components/rich-text-editor/index.d.ts",
574
578
  "import": "./dist/components/rich-text-editor/index.js"
@@ -1,257 +0,0 @@
1
- import { jsxs as g, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as H } from "react";
3
- import { useTranslation as T } from "react-i18next";
4
- import { c as h } from "./index-D2ZczOXr.js";
5
- import { c as d } from "./createLucideIcon-DhHxpK9K.js";
6
- import { C as V } from "./check-DrFSN__t.js";
7
- import { S as $ } from "./stethoscope-sZXGC43m.js";
8
- import { C as O } from "./clock-Drd4Wtis.js";
9
- import { G as C } from "./globe-sHBW1JN5.js";
10
- import { T as U } from "./triangle-alert-CBnO6nq_.js";
11
- import { H as q } from "./heart-pulse-BCppJyN2.js";
12
- import { V as B } from "./video-BheNGvsu.js";
13
- /**
14
- * @license lucide-react v1.22.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- */
19
- const G = [
20
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
21
- ["path", { d: "M4.929 4.929 19.07 19.071", key: "196cmz" }]
22
- ], Z = d("ban", G);
23
- /**
24
- * @license lucide-react v1.22.0 - ISC
25
- *
26
- * This source code is licensed under the ISC license.
27
- * See the LICENSE file in the root directory of this source tree.
28
- */
29
- const K = [
30
- ["path", { d: "M4 10h12", key: "1y6xl8" }],
31
- ["path", { d: "M4 14h9", key: "1loblj" }],
32
- [
33
- "path",
34
- {
35
- d: "M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",
36
- key: "1j6lzo"
37
- }
38
- ]
39
- ], P = d("euro", K);
40
- /**
41
- * @license lucide-react v1.22.0 - ISC
42
- *
43
- * This source code is licensed under the ISC license.
44
- * See the LICENSE file in the root directory of this source tree.
45
- */
46
- const R = [
47
- [
48
- "path",
49
- {
50
- d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",
51
- key: "emmmcr"
52
- }
53
- ],
54
- ["path", { d: "M7 10v12", key: "1qc93n" }]
55
- ], W = d("thumbs-up", R);
56
- /**
57
- * @license lucide-react v1.22.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */
62
- const Y = [
63
- [
64
- "path",
65
- {
66
- d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",
67
- key: "1xq2db"
68
- }
69
- ]
70
- ], D = d("zap", Y);
71
- function F(t) {
72
- if (typeof t != "string") return null;
73
- const n = t.trim();
74
- if (!n.startsWith("#")) return null;
75
- const e = n.slice(1);
76
- let s, o, a;
77
- if (e.length === 3) {
78
- if (!/^[0-9a-f]{3}$/i.test(e)) return null;
79
- s = parseInt(e[0] + e[0], 16), o = parseInt(e[1] + e[1], 16), a = parseInt(e[2] + e[2], 16);
80
- } else if (e.length === 6) {
81
- if (!/^[0-9a-f]{6}$/i.test(e)) return null;
82
- s = parseInt(e.slice(0, 2), 16), o = parseInt(e.slice(2, 4), 16), a = parseInt(e.slice(4, 6), 16);
83
- } else
84
- return null;
85
- return [s / 255, o / 255, a / 255];
86
- }
87
- function J([t, n, e]) {
88
- const s = (o) => o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
89
- return 0.2126 * s(t) + 0.7152 * s(n) + 0.0722 * s(e);
90
- }
91
- function ge(t, n, e) {
92
- }
93
- function Q(t) {
94
- const n = F(t);
95
- return n ? J(n) > 0.1791 ? "on-light" : "on-dark" : null;
96
- }
97
- const X = {
98
- confirmed: W,
99
- waiting: O,
100
- in_care: $,
101
- done: V,
102
- cancelled: Z,
103
- absent: D
104
- }, ee = {
105
- confirmed: "calendar.status.confirmed",
106
- waiting: "calendar.status.waiting",
107
- in_care: "calendar.status.inCare",
108
- done: "calendar.status.done",
109
- cancelled: "calendar.status.cancelled",
110
- absent: "calendar.status.absent"
111
- }, ae = h(
112
- [
113
- // layout — verbatim from the Calendar's former eventCardVariants base,
114
- // plus ds:relative for the accent bar's positioning context
115
- "ds:relative ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
116
- "ds:w-full ds:h-full",
117
- "ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)]",
118
- "ds:rounded-[var(--radius-sm)]",
119
- "ds:text-[length:var(--font-size-sm)]",
120
- "ds:font-[var(--font-weight-medium)]",
121
- "ds:overflow-hidden",
122
- // kept verbatim from the former base (inert on a non-focusable div
123
- // inside FC; harmless)
124
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
125
- "ds:focus-visible:outline-[var(--ring)]",
126
- "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
127
- // SINGLE PAINTED SURFACE — always present, never conditional. One
128
- // declaration per paint channel; value chain = "caller custom prop,
129
- // else token". This structurally eliminates the CVA-vs-override
130
- // specificity race (the old double-paint bug) — stylesheet order
131
- // becomes irrelevant.
132
- "ds:[background-color:var(--calendar-event-bg,var(--primary))]",
133
- "ds:[color:var(--calendar-event-text,var(--primary-foreground))]",
134
- "ds:border ds:[border-color:var(--calendar-event-border,transparent)]"
135
- ].join(" "),
136
- {
137
- variants: {
138
- // Do not add colour classes to this axis — status is icon + accent
139
- // + aria only; a unit test asserts identical computed background
140
- // across all six statuses.
141
- status: {
142
- none: "",
143
- confirmed: "",
144
- waiting: "",
145
- in_care: "",
146
- done: "",
147
- cancelled: "ds:line-through",
148
- absent: ""
149
- },
150
- bookedOnline: {
151
- // class name kept as a stable inert DOM hook; the stripe paint
152
- // lives here (moved from fullcalendar-theme.css) so it works in
153
- // the card's own stories, outside .fc-theme-alfadocs.
154
- // currentcolor = resolved ink, so stripes stay visible over any
155
- // picker colour.
156
- true: "event-booked-online ds:bg-[image:repeating-linear-gradient(45deg,transparent,transparent_4px,color-mix(in_srgb,currentcolor_10%,transparent)_4px,color-mix(in_srgb,currentcolor_10%,transparent)_8px)]",
157
- false: ""
158
- }
159
- },
160
- defaultVariants: { status: "none", bookedOnline: !1 }
161
- }
162
- ), ne = h(
163
- "ds:absolute ds:inset-y-0 ds:start-0 ds:w-[3px]",
164
- {
165
- variants: {
166
- status: {
167
- confirmed: "ds:[background-color:var(--success)]",
168
- waiting: "ds:[background-color:var(--info)]",
169
- in_care: "ds:[background-color:var(--primary)]",
170
- done: "ds:[background-color:var(--success)]",
171
- cancelled: "ds:[background-color:var(--destructive)]",
172
- absent: "ds:[background-color:var(--warning)]"
173
- }
174
- }
175
- }
176
- ), te = H(
177
- ({
178
- title: t,
179
- suffix: n,
180
- rangeText: e,
181
- showTime: s = !0,
182
- allDay: o = !1,
183
- status: a,
184
- statusAccent: b = !0,
185
- backgroundColor: i,
186
- textColor: l,
187
- borderColor: c,
188
- isBookedOnline: f = !1,
189
- hasUnassignedPatient: x,
190
- hasHighlightedAnamnesis: k,
191
- hasBillableAmount: _,
192
- isTelehealth: y,
193
- resourceLabel: w,
194
- eventId: z,
195
- className: N,
196
- style: m,
197
- "aria-label": I,
198
- ...A
199
- }, L) => {
200
- const { t: S } = T(), p = a ? X[a] : null, M = a ? S(ee[a]) : void 0, j = I ?? [t, e, w, M].filter(Boolean).join(", "), u = !l && i ? Q(i) : null, v = i || l || c ? {
201
- ...i ? { "--calendar-event-bg": i } : {},
202
- ...l ? { "--calendar-event-text": l } : u === "on-light" ? { "--calendar-event-text": "var(--event-ink-on-light)" } : u === "on-dark" ? { "--calendar-event-text": "var(--event-ink-on-dark)" } : {},
203
- ...c ? { "--calendar-event-border": c } : {}
204
- } : void 0, E = m || v ? { ...m, ...v } : void 0;
205
- return /* @__PURE__ */ g(
206
- "div",
207
- {
208
- ref: L,
209
- ...A,
210
- className: ae({
211
- status: a ?? "none",
212
- bookedOnline: f,
213
- className: N
214
- }),
215
- style: E,
216
- "aria-label": j,
217
- "data-component": "calendar-event-card",
218
- "data-event-id": z,
219
- "data-status": a ?? "none",
220
- "data-contrast": l ? "custom" : u ?? "default",
221
- children: [
222
- a && b ? /* @__PURE__ */ r(
223
- "span",
224
- {
225
- "aria-hidden": "true",
226
- "data-slot": "status-accent",
227
- className: ne({ status: a })
228
- }
229
- ) : null,
230
- /* @__PURE__ */ g("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:self-end", children: [
231
- p ? /* @__PURE__ */ r(p, { size: 14, "aria-hidden": "true" }) : null,
232
- f ? /* @__PURE__ */ r(C, { size: 12, "aria-hidden": "true" }) : null,
233
- x ? /* @__PURE__ */ r(U, { size: 12, "aria-hidden": "true" }) : null,
234
- k ? /* @__PURE__ */ r(q, { size: 12, "aria-hidden": "true" }) : null,
235
- _ ? /* @__PURE__ */ r(P, { size: 12, "aria-hidden": "true" }) : null,
236
- y ? /* @__PURE__ */ r(B, { size: 12, "aria-hidden": "true" }) : null
237
- ] }),
238
- s && !o && e ? (
239
- // No opacity here — composing 70% over saturated bgs drops
240
- // effective contrast below WCAG AA. The smaller font-size-xs vs
241
- // the title's font-weight-semibold provides sufficient visual
242
- // hierarchy.
243
- /* @__PURE__ */ r("span", { className: "ds:text-[length:var(--font-size-xs)]", children: e })
244
- ) : null,
245
- /* @__PURE__ */ r("span", { className: "ds:font-[var(--font-weight-semibold)] ds:truncate ds:text-start", children: t }),
246
- n ? /* @__PURE__ */ r("span", { className: "ds:truncate ds:text-start ds:text-[length:var(--font-size-xs)]", children: n }) : null
247
- ]
248
- }
249
- );
250
- }
251
- );
252
- te.displayName = "CalendarEventCard";
253
- export {
254
- te as C,
255
- ge as w
256
- };
257
- //# sourceMappingURL=calendar-event-card-C6qGtywL.js.map
@@ -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,8 +0,0 @@
1
- import { a as o } from "./date-picker-variants-pKAJfnWr.js";
2
- function n(a, s, r) {
3
- return o(a, -s, r);
4
- }
5
- export {
6
- n as s
7
- };
8
- //# sourceMappingURL=subDays-CAUv47M1.js.map