@alfadocs/ui-kit 1.33.0 → 1.35.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 (126) hide show
  1. package/dist/_chunks/appointment-card-Bh_CIlc6.js +431 -0
  2. package/dist/_chunks/appointment-timeline-De-Wqdkw.js +449 -0
  3. package/dist/_chunks/{appointment-tray-DCk8gHod.js → appointment-tray-4I9wTAi4.js} +2 -2
  4. package/dist/_chunks/{calendar-workspace-BX-zDyVR.js → calendar-workspace-UywR5gUl.js} +7 -7
  5. package/dist/_chunks/{care-plan-card-CZW476Kg.js → care-plan-card-DHVhBcvs.js} +3 -3
  6. package/dist/_chunks/{care-plan-entry-card-BMUYagEw.js → care-plan-entry-card-Dx6IdTcR.js} +2 -2
  7. package/dist/_chunks/{care-plan-header-B5CBE0zu.js → care-plan-header-UTX5ZD74.js} +2 -2
  8. package/dist/_chunks/{clinical-note-card-D2WTV2CO.js → clinical-note-card-CTRzmqvv.js} +83 -81
  9. package/dist/_chunks/{contact-profile-card-BZqi8Hck.js → contact-profile-card-DSI9uumA.js} +17 -16
  10. package/dist/_chunks/{control-room-rail-iO_BCaq1.js → control-room-rail-5MbhjsxN.js} +2 -2
  11. package/dist/_chunks/{entity-card-DmrgYSEX.js → entity-card-9_62gY7l.js} +4 -4
  12. package/dist/_chunks/format-price-BkMEbeW3.js +47 -0
  13. package/dist/_chunks/{format-price-DNqXPa_q.js → languages-CZqBaPwI.js} +8 -38
  14. package/dist/_chunks/money.agent-Dw55UxUA.js +116 -0
  15. package/dist/_chunks/notes-panel-BjLt-kiP.js +469 -0
  16. package/dist/_chunks/{operator-hero-D7-iiFQ9.js → operator-hero-aG_qyn6g.js} +2 -2
  17. package/dist/_chunks/{payment-request-card-lmKLwsDs.js → payment-request-card-DvEsWEkC.js} +2 -2
  18. package/dist/_chunks/{practice-results-DjEzPgAK.js → practice-results-kayDEorM.js} +15 -14
  19. package/dist/_chunks/{rich-text-editor-CQ7yZdG3.js → rich-text-editor-CCI-Y3DN.js} +3 -5
  20. package/dist/_chunks/{task-card-BUgK6yZT.js → task-card-BalrLkSz.js} +41 -40
  21. package/dist/_chunks/{task-tray-CYG6rj2s.js → task-tray-COo-RlDv.js} +2 -2
  22. package/dist/_chunks/tasks-panel-DLKpSNoE.js +844 -0
  23. package/dist/_chunks/tool-rail-ONaV-Nzz.js +588 -0
  24. package/dist/_chunks/use-check-animation--I3cS00X.js +28 -0
  25. package/dist/_chunks/use-list-reflow-Cw43nxw5.js +100 -0
  26. package/dist/agent-catalog.json +15 -1
  27. package/dist/components/_shared/format-price.d.ts +15 -0
  28. package/dist/components/appointment-card/appointment-card.d.ts +36 -1
  29. package/dist/components/appointment-card/index.js +2 -2
  30. package/dist/components/appointment-timeline/appointment-timeline.d.ts +6 -0
  31. package/dist/components/appointment-timeline/index.js +1 -1
  32. package/dist/components/care-plan-card/index.js +1 -1
  33. package/dist/components/care-plan-entry-card/index.js +1 -1
  34. package/dist/components/care-plan-header/index.js +1 -1
  35. package/dist/components/clinical-note-card/clinical-note-card.d.ts +8 -1
  36. package/dist/components/clinical-note-card/index.js +1 -1
  37. package/dist/components/command-palette/command-palette.d.ts +7 -7
  38. package/dist/components/contact-profile-card/index.js +1 -1
  39. package/dist/components/control-room-rail/index.js +1 -1
  40. package/dist/components/index.d.ts +1 -0
  41. package/dist/components/money/index.d.ts +4 -0
  42. package/dist/components/money/index.js +6 -0
  43. package/dist/components/money/money.agent.d.ts +3 -0
  44. package/dist/components/money/money.d.ts +38 -0
  45. package/dist/components/notes-panel/index.js +1 -1
  46. package/dist/components/notes-panel/notes-panel.d.ts +16 -1
  47. package/dist/components/operator-hero/index.js +1 -1
  48. package/dist/components/payment-card/index.js +1 -1
  49. package/dist/components/practice-results/index.js +1 -1
  50. package/dist/components/rich-text-editor/index.js +1 -1
  51. package/dist/components/rich-text-editor/rich-text-editor.d.ts +1 -1
  52. package/dist/components/task-card/index.js +1 -1
  53. package/dist/components/task-card/task-card.d.ts +11 -3
  54. package/dist/components/task-tray/index.js +1 -1
  55. package/dist/components/tasks-panel/index.js +1 -1
  56. package/dist/components/tasks-panel/tasks-panel.d.ts +1 -1
  57. package/dist/components/tool-rail/index.js +1 -1
  58. package/dist/hooks/index.d.ts +3 -0
  59. package/dist/hooks/index.js +43 -37
  60. package/dist/hooks/use-check-animation.d.ts +53 -0
  61. package/dist/hooks/use-exit-transition.d.ts +48 -0
  62. package/dist/hooks/use-list-reflow.d.ts +47 -0
  63. package/dist/host-compat.css +8 -2
  64. package/dist/i18n/locales/ar.d.ts +10 -0
  65. package/dist/i18n/locales/ar.js +12 -2
  66. package/dist/i18n/locales/de.d.ts +10 -0
  67. package/dist/i18n/locales/de.js +12 -2
  68. package/dist/i18n/locales/el.d.ts +10 -0
  69. package/dist/i18n/locales/el.js +12 -2
  70. package/dist/i18n/locales/en.d.ts +10 -0
  71. package/dist/i18n/locales/en.js +12 -2
  72. package/dist/i18n/locales/es.d.ts +10 -0
  73. package/dist/i18n/locales/es.js +12 -2
  74. package/dist/i18n/locales/fr.d.ts +10 -0
  75. package/dist/i18n/locales/fr.js +12 -2
  76. package/dist/i18n/locales/hi.d.ts +10 -0
  77. package/dist/i18n/locales/hi.js +12 -2
  78. package/dist/i18n/locales/it.d.ts +13 -3
  79. package/dist/i18n/locales/it.js +14 -4
  80. package/dist/i18n/locales/ja.d.ts +10 -0
  81. package/dist/i18n/locales/ja.js +12 -2
  82. package/dist/i18n/locales/nl.d.ts +10 -0
  83. package/dist/i18n/locales/nl.js +12 -2
  84. package/dist/i18n/locales/pl.d.ts +10 -0
  85. package/dist/i18n/locales/pl.js +12 -2
  86. package/dist/i18n/locales/pt.d.ts +10 -0
  87. package/dist/i18n/locales/pt.js +12 -2
  88. package/dist/i18n/locales/ro.d.ts +10 -0
  89. package/dist/i18n/locales/ro.js +12 -2
  90. package/dist/i18n/locales/ru.d.ts +10 -0
  91. package/dist/i18n/locales/ru.js +12 -2
  92. package/dist/i18n/locales/sq.d.ts +10 -0
  93. package/dist/i18n/locales/sq.js +12 -2
  94. package/dist/i18n/locales/sv.d.ts +10 -0
  95. package/dist/i18n/locales/sv.js +12 -2
  96. package/dist/i18n/locales/tr.d.ts +10 -0
  97. package/dist/i18n/locales/tr.js +12 -2
  98. package/dist/i18n/locales/zh.d.ts +10 -0
  99. package/dist/i18n/locales/zh.js +12 -2
  100. package/dist/index.js +919 -916
  101. package/dist/locales/ar.json +12 -2
  102. package/dist/locales/de.json +12 -2
  103. package/dist/locales/el.json +12 -2
  104. package/dist/locales/en.json +12 -2
  105. package/dist/locales/es.json +12 -2
  106. package/dist/locales/fr.json +12 -2
  107. package/dist/locales/hi.json +12 -2
  108. package/dist/locales/it.json +14 -4
  109. package/dist/locales/ja.json +12 -2
  110. package/dist/locales/nl.json +12 -2
  111. package/dist/locales/pl.json +12 -2
  112. package/dist/locales/pt.json +12 -2
  113. package/dist/locales/ro.json +12 -2
  114. package/dist/locales/ru.json +12 -2
  115. package/dist/locales/sq.json +12 -2
  116. package/dist/locales/sv.json +12 -2
  117. package/dist/locales/tr.json +12 -2
  118. package/dist/locales/zh.json +12 -2
  119. package/dist/patterns/calendar/index.js +1 -1
  120. package/dist/tokens.css +2 -1
  121. package/package.json +5 -1
  122. package/dist/_chunks/appointment-card-D-oj_ugh.js +0 -296
  123. package/dist/_chunks/appointment-timeline-CymGHyIP.js +0 -403
  124. package/dist/_chunks/notes-panel-C4G-mhZ9.js +0 -380
  125. package/dist/_chunks/tasks-panel-DQuaVvl5.js +0 -757
  126. package/dist/_chunks/tool-rail-8Scslq3X.js +0 -524
@@ -0,0 +1,588 @@
1
+ import { jsxs as x, jsx as f } from "react/jsx-runtime";
2
+ import { forwardRef as Le, useRef as g, useState as T, useMemo as k, useId as Ve, useEffect as ie, useCallback as O, useImperativeHandle as je, Fragment as Ke } from "react";
3
+ import { c as w } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as Me } from "react-i18next";
5
+ import { I as oe } from "./icon-button-DA2CAGHZ.js";
6
+ import { S as Pe } from "./scroll-area-BZOvUhwQ.js";
7
+ import { a as Be } from "./tooltip-DvmfrNvB.js";
8
+ import { u as qe } from "./use-controllable-state-BiY4xTzM.js";
9
+ import { u as Fe } from "./use-edge-resize-ZnGG7gyO.js";
10
+ import { u as le } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
11
+ import { a as Oe, u as Ue, R as We } from "./use-list-reflow-Cw43nxw5.js";
12
+ import { u as He } from "./use-theme-CAuo6EYT.js";
13
+ import { u as $e } from "./registry-DvAUVLHh.js";
14
+ const Ze = {
15
+ id: "tool-rail",
16
+ capabilities: ["open", "close", "select_single"],
17
+ state: {
18
+ activeToolId: {
19
+ type: "string | null",
20
+ descriptionKey: "ui.toolRail.agent.state.activeToolId",
21
+ 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.",
22
+ read: (l) => l.getActiveToolId()
23
+ }
24
+ },
25
+ actions: {
26
+ open: {
27
+ // Pure ephemeral panel state (open) — no data loss, no external effect.
28
+ safety: "read",
29
+ argsType: "{ id: string }",
30
+ argsSchema: {
31
+ type: "object",
32
+ properties: { id: { type: "string" } },
33
+ required: ["id"]
34
+ },
35
+ idempotent: !0,
36
+ // descriptionKey shape is intentionally pre-existing — already resolves to
37
+ // real multi-locale translations; do not canonicalise.
38
+ descriptionKey: "ui.toolRail.agent.actions.open",
39
+ description: "Open the given tool's panel.",
40
+ examples: [{ args: { id: "inbox" }, note: "Open the inbox tool panel." }],
41
+ invoke: (l, a) => {
42
+ l.open(a.id);
43
+ }
44
+ },
45
+ close: {
46
+ safety: "read",
47
+ idempotent: !0,
48
+ descriptionKey: "ui.toolRail.agent.actions.close",
49
+ description: "Collapse the rail to its strip (no active tool).",
50
+ invoke: (l) => {
51
+ l.close();
52
+ }
53
+ },
54
+ select_tool: {
55
+ safety: "read",
56
+ argsType: "{ id: string | null }",
57
+ argsSchema: {
58
+ type: "object",
59
+ properties: { id: { type: ["string", "null"] } },
60
+ required: ["id"]
61
+ },
62
+ idempotent: !0,
63
+ descriptionKey: "ui.toolRail.agent.actions.selectTool",
64
+ description: "Set the active tool by id (opens its panel), or pass null to collapse.",
65
+ invoke: (l, a) => {
66
+ l.setActiveTool(a.id);
67
+ }
68
+ }
69
+ },
70
+ domHooks: {
71
+ root: {
72
+ attr: "data-component",
73
+ value: "tool-rail",
74
+ description: "Marks the ToolRail wrapper."
75
+ },
76
+ instanceId: {
77
+ attr: "data-component-id",
78
+ sourceProp: "id",
79
+ description: "Sourced from the id prop. Required to address a specific rail from the agent."
80
+ },
81
+ item: {
82
+ attr: "data-tool-id",
83
+ description: "Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id."
84
+ }
85
+ }
86
+ }, Xe = "ds:[inline-size:3rem]", Ye = "ds:[inline-size:var(--tool-rail-panel-inline-size,var(--ai-tools-rail-panel-inline-size,22rem))]", de = "--tool-rail-panel-inline-size", Ge = 288, Je = 880, Qe = 352, es = w(
87
+ ["ds:flex ds:shrink-0 ds:h-full", "ds:bg-[var(--background)]"].join(" "),
88
+ {
89
+ variants: {
90
+ side: {
91
+ // Strip docks inline-end; the panel mounts inline-start of it
92
+ // (flex-row, panel rendered first). Shadow faces the main area —
93
+ // no border against main (the rail stays line-free; the only seam
94
+ // is the strip↔panel divider on the open panel, see render).
95
+ // Accessible (AAA) theme swaps the soft chrome shadow for a solid 1px
96
+ // border on the content-facing edge (border-s for end-docked).
97
+ end: "ds:flex-row ds:shadow-[var(--shadow-chrome-start)] ds:[.theme-accessible_&]:border-s ds:[.theme-accessible_&]:border-[var(--border)] ds:[.theme-accessible_&]:shadow-none",
98
+ // Strip docks inline-start; the panel mounts inline-end of it.
99
+ start: "ds:flex-row-reverse ds:shadow-[var(--shadow-chrome-end)] ds:[.theme-accessible_&]:border-e ds:[.theme-accessible_&]:border-[var(--border)] ds:[.theme-accessible_&]:shadow-none"
100
+ }
101
+ },
102
+ defaultVariants: { side: "end" }
103
+ }
104
+ ), ss = w(
105
+ [
106
+ "ds:flex ds:shrink-0 ds:flex-col ds:items-center",
107
+ "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]",
108
+ "ds:gap-[var(--spacing-xs)]",
109
+ Xe
110
+ ].join(" ")
111
+ ), ts = w(
112
+ [
113
+ "ds:relative ds:flex ds:min-h-0 ds:flex-col ds:h-full",
114
+ "ds:bg-[var(--background)]",
115
+ Ye,
116
+ // Defensive: the panel doesn't animate its width today, but if a
117
+ // consumer adds a transition on the var, suppress it mid-drag.
118
+ "ds:data-[resizing]:transition-none"
119
+ ].join(" ")
120
+ ), as = w(
121
+ [
122
+ "ds:absolute ds:[inset-block:0] ds:z-[1] ds:select-none ds:touch-none",
123
+ "ds:[inline-size:var(--resizable-handle-size)] ds:cursor-col-resize",
124
+ "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
125
+ "ds:hover:bg-[var(--accent)] ds:focus-visible:bg-[var(--accent)] ds:data-[resizing]:bg-[var(--accent)]",
126
+ "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
127
+ "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
128
+ "ds:forced-colors:focus-visible:outline-[CanvasText]",
129
+ "ds:before:absolute ds:before:content-['']",
130
+ "ds:before:[block-size:100%]",
131
+ "ds:before:[inline-size:var(--min-target-size)]",
132
+ "ds:before:[inset-block:0]",
133
+ "ds:before:[inset-inline:calc(0px_-_(var(--min-target-size)_-_var(--resizable-handle-size))_/_2)]"
134
+ ],
135
+ {
136
+ variants: {
137
+ edge: {
138
+ "inline-start": "ds:start-0",
139
+ "inline-end": "ds:end-0"
140
+ }
141
+ },
142
+ defaultVariants: { edge: "inline-start" }
143
+ }
144
+ ), rs = w(
145
+ [
146
+ "ds:absolute ds:-top-[var(--spacing-xs)] ds:-end-[var(--spacing-xs)]",
147
+ "ds:inline-flex ds:items-center ds:justify-center",
148
+ "ds:min-w-[calc(var(--spacing-md)+var(--spacing-xs))]",
149
+ "ds:h-[calc(var(--spacing-md)+var(--spacing-xs))]",
150
+ "ds:ps-[calc(var(--spacing-xs)/1.5)] ds:pe-[calc(var(--spacing-xs)/1.5)]",
151
+ "ds:rounded-[var(--radius-full)]",
152
+ "ds:bg-[color:var(--destructive)] ds:text-[color:var(--destructive-foreground)]",
153
+ "ds:text-[length:var(--font-size-xs)] ds:font-semibold ds:leading-none",
154
+ "ds:pointer-events-none ds:select-none",
155
+ "ds:forced-colors:outline ds:forced-colors:outline-1 ds:forced-colors:outline-[CanvasText]"
156
+ ].join(" ")
157
+ ), ce = w(
158
+ // `group/rail-tool` lets an affordance overlay (e.g. a pin star) reveal on
159
+ // hover / focus-within of the whole slot.
160
+ ["ds:group/rail-tool ds:relative", "ds:rounded-[var(--radius-sm)]"],
161
+ {
162
+ variants: {
163
+ dragging: { true: "ds:opacity-60", false: "" },
164
+ dropTarget: {
165
+ true: "ds:outline-[length:var(--focus-ring-width)] ds:outline-dashed ds:outline-[var(--accent)] ds:outline-offset-[length:var(--focus-ring-offset)]",
166
+ false: ""
167
+ },
168
+ reorderable: {
169
+ true: "ds:cursor-grab ds:active:cursor-grabbing",
170
+ false: ""
171
+ }
172
+ },
173
+ defaultVariants: {
174
+ dragging: !1,
175
+ dropTarget: !1,
176
+ reorderable: !1
177
+ }
178
+ }
179
+ ), ns = "ds:opacity-0", ue = [
180
+ "ds:transition-opacity ds:duration-[var(--animation-duration)]",
181
+ "ds:ease-[var(--ease-out)] ds:motion-reduce:transition-none"
182
+ ].join(" ");
183
+ function is(l, a) {
184
+ return l > 99 ? a : String(l);
185
+ }
186
+ const os = Le(
187
+ ({
188
+ id: l,
189
+ tools: a,
190
+ activeToolId: fe,
191
+ defaultActiveToolId: pe = null,
192
+ onActiveToolChange: ve,
193
+ side: S = "end",
194
+ railLabel: ge,
195
+ resizablePanel: _ = !1,
196
+ onReorder: z,
197
+ formatReorderAnnouncement: N,
198
+ renderToolAffordance: C,
199
+ renderPanelHeader: U,
200
+ dataComponent: me = "tool-rail",
201
+ agentAdapter: be = Ze,
202
+ className: he
203
+ }, ye) => {
204
+ var ae;
205
+ const { t: p } = Me(), [we, v] = qe({
206
+ value: fe,
207
+ defaultValue: pe,
208
+ onChange: ve
209
+ }), m = we ?? null, L = g([]), A = g(null), [V, j] = T(0), h = g(!1), K = g(!1), b = k(
210
+ () => a.findIndex((e) => e.id === m),
211
+ [a, m]
212
+ ), d = b >= 0 ? a[b] : null, Ie = k(
213
+ () => a.findIndex((e) => !e.disabled),
214
+ [a]
215
+ ), W = k(() => {
216
+ var s;
217
+ const e = (s = a[0]) == null ? void 0 : s.scope;
218
+ return e ? a.findIndex((t) => t.scope && t.scope !== e) : -1;
219
+ }, [a]), Re = W > 0, c = k(() => {
220
+ var t;
221
+ const e = a.findIndex((n) => n.reorderable);
222
+ if (e < 0) return null;
223
+ let s = e;
224
+ for (; s + 1 < a.length && ((t = a[s + 1]) != null && t.reorderable); ) s += 1;
225
+ return { first: e, last: s };
226
+ }, [a]), H = !!z && c !== null, xe = Ve(), [I, M] = T(null), [$, E] = T(null), { resolvedTheme: Te } = He(), Z = Te.endsWith("-accessible") || void 0, { containerRef: ke } = Oe({
227
+ key: a.map((e) => e.id).join(),
228
+ reduceMotion: Z
229
+ }), P = Ue({ reduceMotion: Z }), [Se, X] = T([]), Y = g(a);
230
+ ie(() => {
231
+ const e = Y.current, s = new Set(a.map((n) => n.id)), t = e.filter((n) => !s.has(n.id));
232
+ if (t.length > 0) {
233
+ X((n) => {
234
+ const i = new Set(n.map((o) => o.id));
235
+ return [
236
+ ...n,
237
+ ...t.filter((o) => !i.has(o.id))
238
+ ];
239
+ });
240
+ for (const n of t)
241
+ P.leave(n.id, () => {
242
+ X(
243
+ (i) => i.filter((o) => o.id !== n.id)
244
+ );
245
+ });
246
+ }
247
+ Y.current = a;
248
+ }, [a, P]);
249
+ const [_e, ze] = T(""), B = g(!1), G = O(
250
+ (e, s) => {
251
+ if (!z || !c) return;
252
+ const t = Math.max(
253
+ c.first,
254
+ Math.min(c.last, s)
255
+ );
256
+ if (t === e) return;
257
+ z(e, t);
258
+ const n = a[e];
259
+ if (n) {
260
+ const i = N ? N({ tool: n, from: e, to: t }) : p("toolRail.reorderAnnounce", {
261
+ tool: n.label,
262
+ to: t - c.first + 1,
263
+ total: c.last - c.first + 1,
264
+ defaultValue: "{{tool}} moved to position {{to}} of {{total}}"
265
+ });
266
+ i && (B.current = !B.current, ze(B.current ? i : `${i}​`));
267
+ }
268
+ },
269
+ [z, c, a, p, N]
270
+ ), R = b >= 0 ? b : V >= 0 && !((ae = a[V]) != null && ae.disabled) ? V : Ie, Ae = O(
271
+ (e, s) => {
272
+ const t = a.find((n) => n.id === e);
273
+ !t || t.disabled || (h.current = s, v(m === e ? null : e));
274
+ },
275
+ [a, m, v]
276
+ ), Ee = O(
277
+ (e) => {
278
+ var y, r, u;
279
+ const s = a.length;
280
+ if (s === 0 || e.altKey) return;
281
+ let t = null;
282
+ if (e.key === "ArrowDown" ? t = (R + 1) % s : e.key === "ArrowUp" ? t = (R - 1 + s) % s : e.key === "Home" ? t = 0 : e.key === "End" && (t = s - 1), t === null) return;
283
+ const n = e.key === "ArrowUp" || e.key === "End";
284
+ let i = t, o = 0;
285
+ for (; o < s && ((y = a[i]) != null && y.disabled); )
286
+ i = n ? (i - 1 + s) % s : (i + 1) % s, o += 1;
287
+ (r = a[i]) != null && r.disabled || (e.preventDefault(), j(i), (u = L.current[i]) == null || u.focus());
288
+ },
289
+ [a, R]
290
+ ), D = g(null);
291
+ ie(() => {
292
+ const e = D.current;
293
+ if (!e) return;
294
+ const s = (t) => {
295
+ if (t.key !== "Escape" || b < 0) return;
296
+ t.preventDefault();
297
+ const n = b;
298
+ v(null), j(n), requestAnimationFrame(() => {
299
+ var i;
300
+ (i = L.current[n]) == null || i.focus();
301
+ });
302
+ };
303
+ return e.addEventListener("keydown", s), () => e.removeEventListener("keydown", s);
304
+ }, [b, v]), le(() => {
305
+ var e;
306
+ d && h.current && ((e = A.current) == null || e.focus()), h.current = !1;
307
+ }, [d]);
308
+ const J = S === "end" ? "inline-start" : "inline-end", { separatorProps: Q, isResizing: ee, isResized: se } = Fe({
309
+ edge: J,
310
+ targetRef: A,
311
+ cssProperty: de,
312
+ minSize: Ge,
313
+ maxSize: Je,
314
+ defaultSize: Qe,
315
+ disabled: !_
316
+ }), te = Q["aria-valuenow"];
317
+ le(() => {
318
+ var e;
319
+ !_ || !se || !d || (e = A.current) == null || e.style.setProperty(
320
+ de,
321
+ `${te}px`
322
+ );
323
+ }, [d, _, se, te]);
324
+ const q = g(m);
325
+ q.current = m;
326
+ const F = k(
327
+ () => ({
328
+ getActiveToolId: () => q.current,
329
+ setActiveTool: (e) => {
330
+ h.current = !1, v(e);
331
+ },
332
+ open: (e) => {
333
+ const s = a.find((t) => t.id === e);
334
+ !s || s.disabled || (h.current = !1, v(e));
335
+ },
336
+ close: () => {
337
+ const e = q.current;
338
+ h.current = !1, v(null), e != null && requestAnimationFrame(() => {
339
+ var s, t;
340
+ (t = (s = D.current) == null ? void 0 : s.querySelector(
341
+ `[data-tool-id="${CSS.escape(e)}"]`
342
+ )) == null || t.focus();
343
+ });
344
+ }
345
+ }),
346
+ [a, v]
347
+ );
348
+ je(ye, () => F, [F]), $e(be, F, l);
349
+ const De = p("toolRail.badgeCountOverflow", {
350
+ defaultValue: "99+"
351
+ });
352
+ return /* @__PURE__ */ x(
353
+ "div",
354
+ {
355
+ ref: D,
356
+ "data-component": me,
357
+ "data-component-id": l,
358
+ "data-side": S,
359
+ className: [es({ side: S }), he].filter(Boolean).join(" "),
360
+ children: [
361
+ H ? /* @__PURE__ */ f("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: _e }) : null,
362
+ d ? /* @__PURE__ */ x(
363
+ "aside",
364
+ {
365
+ ref: A,
366
+ tabIndex: -1,
367
+ "aria-label": p("toolRail.panelLabel", {
368
+ tool: d.label,
369
+ defaultValue: "{{tool}} panel"
370
+ }),
371
+ "data-tool-rail-state": "expanded",
372
+ "data-active-tool": d.id,
373
+ "data-resizing": ee ? "" : void 0,
374
+ className: [
375
+ ts(),
376
+ // Subtle shadow — not a line — separating the panel from the
377
+ // icon strip (the tab row). The panel casts a soft chrome
378
+ // shadow toward the strip on its strip-facing edge. `z-[1]`
379
+ // lifts it above the adjacent strip (the panel is already
380
+ // `relative`) so the shadow paints at the seam instead of being
381
+ // covered by the strip's opaque background. Only renders while
382
+ // the panel is open (the aside is unmounted when collapsed), so
383
+ // it never doubles as a rail↔main seam. In the accessible (AAA)
384
+ // theme the soft shadow becomes a solid 1px border on that same
385
+ // strip-facing edge.
386
+ "ds:z-[1]",
387
+ S === "end" ? "ds:shadow-[var(--shadow-chrome-end)] ds:[.theme-accessible_&]:border-e ds:[.theme-accessible_&]:border-[var(--border)] ds:[.theme-accessible_&]:shadow-none" : "ds:shadow-[var(--shadow-chrome-start)] ds:[.theme-accessible_&]:border-s ds:[.theme-accessible_&]:border-[var(--border)] ds:[.theme-accessible_&]:shadow-none",
388
+ "ds:focus-visible:outline-none"
389
+ ].join(" "),
390
+ children: [
391
+ U ? U(d, { isActive: !0 }) : null,
392
+ d.header ? /* @__PURE__ */ f("div", { className: "ds:shrink-0", children: d.header }) : null,
393
+ d.fill ? (
394
+ // data-tool-fill: a self-scrolling panel owns its own native
395
+ // scroll (it can't use the rail's ScrollArea), so a token rule
396
+ // paints its scrollbar to match the 8px overlay. See tokens/index.css.
397
+ /* @__PURE__ */ f("div", { "data-tool-fill": "", className: "ds:flex-1 ds:min-h-0", children: d.panel })
398
+ ) : /* @__PURE__ */ f(
399
+ Pe,
400
+ {
401
+ orientation: "vertical",
402
+ className: "ds:flex-1 ds:min-h-0",
403
+ children: d.panel
404
+ }
405
+ ),
406
+ _ ? /* @__PURE__ */ f(
407
+ "div",
408
+ {
409
+ ...Q,
410
+ "aria-label": p("toolRail.resizePanel", {
411
+ defaultValue: "Resize tool panel"
412
+ }),
413
+ "data-resizing": ee ? "" : void 0,
414
+ className: as({ edge: J })
415
+ }
416
+ ) : null
417
+ ]
418
+ }
419
+ ) : null,
420
+ /* @__PURE__ */ f(Be, { children: /* @__PURE__ */ x(
421
+ "div",
422
+ {
423
+ ref: ke,
424
+ role: "toolbar",
425
+ "aria-orientation": "vertical",
426
+ "aria-label": ge ?? p("toolRail.railLabel", { defaultValue: "Tools" }),
427
+ className: ss(),
428
+ onKeyDown: Ee,
429
+ children: [
430
+ a.map((e, s) => {
431
+ const t = e.id === m, n = typeof e.badgeCount == "number" && e.badgeCount > 0, i = n ? p("toolRail.toolWithCount", {
432
+ tool: e.label,
433
+ count: e.badgeCount,
434
+ defaultValue: "{{tool}}, {{count}} updates"
435
+ }) : e.label, o = H && !!e.reorderable && !e.disabled, y = o ? `${xe}-${e.id}` : void 0;
436
+ return /* @__PURE__ */ x(Ke, { children: [
437
+ Re && s === W ? /* @__PURE__ */ f(
438
+ "div",
439
+ {
440
+ role: "separator",
441
+ "aria-orientation": "horizontal",
442
+ className: "ds:my-[var(--spacing-2xs)] ds:h-px ds:w-[var(--spacing-lg)] ds:shrink-0 ds:bg-[var(--border)] ds:forced-colors:bg-[CanvasText]"
443
+ }
444
+ ) : null,
445
+ /* @__PURE__ */ x(
446
+ "div",
447
+ {
448
+ className: [
449
+ ce({
450
+ dragging: I === s,
451
+ dropTarget: $ === s && I !== s,
452
+ reorderable: o
453
+ }),
454
+ ue,
455
+ We
456
+ ].filter(Boolean).join(" "),
457
+ "data-reflow-id": e.id,
458
+ "data-dragging": I === s ? "" : void 0,
459
+ draggable: o || void 0,
460
+ onDragStart: o ? (r) => {
461
+ M(s), r.dataTransfer.effectAllowed = "move", r.dataTransfer.setData(
462
+ "text/plain",
463
+ String(s)
464
+ );
465
+ } : void 0,
466
+ onDragOver: o ? (r) => {
467
+ I !== null && (r.preventDefault(), r.dataTransfer.dropEffect = "move", $ !== s && E(s));
468
+ } : void 0,
469
+ onDragLeave: o ? () => E((r) => r === s ? null : r) : void 0,
470
+ onDrop: o ? (r) => {
471
+ r.preventDefault();
472
+ const u = I;
473
+ E(null), M(null), !(u === null || u === s) && G(u, s);
474
+ } : void 0,
475
+ onDragEnd: o ? () => {
476
+ M(null), E(null);
477
+ } : void 0,
478
+ children: [
479
+ /* @__PURE__ */ f(
480
+ oe,
481
+ {
482
+ ref: (r) => {
483
+ L.current[s] = r;
484
+ },
485
+ icon: e.icon,
486
+ tooltip: e.label,
487
+ "aria-label": i,
488
+ intent: "ghost",
489
+ size: "sm",
490
+ disabled: e.disabled,
491
+ "aria-pressed": t,
492
+ "aria-expanded": t,
493
+ "data-active": t ? e.id : void 0,
494
+ "data-tool-id": e.id,
495
+ "aria-describedby": y,
496
+ "aria-keyshortcuts": o ? "Alt+ArrowUp Alt+ArrowDown" : void 0,
497
+ tabIndex: s === R ? 0 : -1,
498
+ onFocus: () => {
499
+ e.disabled || j(s);
500
+ },
501
+ onClick: () => Ae(e.id, K.current),
502
+ onKeyDown: (r) => {
503
+ if (r.key === "Enter" || r.key === " ") {
504
+ K.current = !0;
505
+ return;
506
+ }
507
+ if (o && r.altKey && c) {
508
+ let u = null;
509
+ if (r.key === "ArrowUp" ? u = s - 1 : r.key === "ArrowDown" ? u = s + 1 : r.key === "Home" ? u = c.first : r.key === "End" && (u = c.last), u !== null) {
510
+ r.preventDefault();
511
+ const Ne = Math.max(
512
+ c.first,
513
+ Math.min(c.last, u)
514
+ ), Ce = e.id;
515
+ G(s, Ne), requestAnimationFrame(() => {
516
+ var re, ne;
517
+ (ne = (re = D.current) == null ? void 0 : re.querySelector(
518
+ `[data-tool-id="${CSS.escape(Ce)}"]`
519
+ )) == null || ne.focus();
520
+ });
521
+ }
522
+ }
523
+ },
524
+ onKeyUp: (r) => {
525
+ (r.key === "Enter" || r.key === " ") && (K.current = !1);
526
+ }
527
+ }
528
+ ),
529
+ n ? /* @__PURE__ */ f("span", { "aria-hidden": "true", className: rs(), children: is(
530
+ e.badgeCount,
531
+ De
532
+ ) }) : null,
533
+ C == null ? void 0 : C(e, {
534
+ index: s,
535
+ isActive: t,
536
+ isRovingTarget: s === R
537
+ }),
538
+ y ? /* @__PURE__ */ f("span", { id: y, className: "ds:sr-only", children: p("toolRail.reorderInstructions", {
539
+ tool: e.label,
540
+ defaultValue: "Reorder {{tool}}. Press Alt + Up or Alt + Down to move."
541
+ }) }) : null
542
+ ]
543
+ }
544
+ )
545
+ ] }, e.id);
546
+ }),
547
+ Se.map(
548
+ (e) => P.isLeaving(e.id) ? /* @__PURE__ */ f(
549
+ "div",
550
+ {
551
+ className: [
552
+ ce({
553
+ dragging: !1,
554
+ dropTarget: !1,
555
+ reorderable: !1
556
+ }),
557
+ ue,
558
+ ns
559
+ ].filter(Boolean).join(" "),
560
+ "aria-hidden": "true",
561
+ children: /* @__PURE__ */ f(
562
+ oe,
563
+ {
564
+ icon: e.icon,
565
+ intent: "ghost",
566
+ size: "sm",
567
+ disabled: !0,
568
+ tabIndex: -1
569
+ }
570
+ )
571
+ },
572
+ e.id
573
+ ) : null
574
+ )
575
+ ]
576
+ }
577
+ ) })
578
+ ]
579
+ }
580
+ );
581
+ }
582
+ );
583
+ os.displayName = "ToolRail";
584
+ export {
585
+ os as T,
586
+ Ze as t
587
+ };
588
+ //# sourceMappingURL=tool-rail-ONaV-Nzz.js.map
@@ -0,0 +1,28 @@
1
+ import { useState as o, useRef as p, useEffect as c, useCallback as g } from "react";
2
+ import { u as R } from "./use-prefers-reduced-motion-BMwIQRjB.js";
3
+ function M({
4
+ checked: n,
5
+ durationMs: l = 200,
6
+ reduceMotion: f
7
+ }) {
8
+ const a = R(), r = f ?? a ? 0 : l, [t, i] = o(null), [m, s] = o(!1), e = p(null), d = t ?? n;
9
+ c(() => {
10
+ t !== null && t === n && i(null);
11
+ }, [t, n]), c(
12
+ () => () => {
13
+ e.current !== null && window.clearTimeout(e.current);
14
+ },
15
+ []
16
+ );
17
+ const w = g(() => {
18
+ const u = !(t ?? n);
19
+ return i(u), e.current !== null && window.clearTimeout(e.current), !u || r === 0 ? (s(!1), u) : (s(!0), e.current = window.setTimeout(() => {
20
+ e.current = null, s(!1);
21
+ }, r), u);
22
+ }, [t, n, r]);
23
+ return { checked: d, drawing: m, durationMs: r, toggle: w };
24
+ }
25
+ export {
26
+ M as u
27
+ };
28
+ //# sourceMappingURL=use-check-animation--I3cS00X.js.map