@alfadocs/ui-kit 1.42.0 → 1.43.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 (27) hide show
  1. package/dist/_chunks/{calendar-workspace-qlxrxCqm.js → calendar-workspace-DhXqqu-D.js} +2 -2
  2. package/dist/_chunks/control-room-rail-Cv7GpMqX.js +354 -0
  3. package/dist/_chunks/{marketplace-app-shell-D_g9BaDI.js → marketplace-app-shell-DdwPj03y.js} +3 -3
  4. package/dist/_chunks/{sidebar-ClTY9lLI.js → sidebar-DbZXLl8h.js} +2 -2
  5. package/dist/_chunks/tab-bar-Cw9UK18Z.js +228 -0
  6. package/dist/_chunks/{tool-rail-D89USYE6.js → tool-rail-CCFqDfAn.js} +282 -276
  7. package/dist/_chunks/use-edge-resize-BHesP0kg.js +149 -0
  8. package/dist/_chunks/use-scroll-overflow-UbLrUfBo.js +72 -0
  9. package/dist/agent-catalog.json +1 -1
  10. package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
  11. package/dist/components/control-room-rail/index.js +1 -1
  12. package/dist/components/sidebar/index.js +1 -1
  13. package/dist/components/tab-bar/index.js +1 -1
  14. package/dist/components/tool-rail/index.js +1 -1
  15. package/dist/components/tool-rail/tool-rail.d.ts +16 -0
  16. package/dist/hooks/index.d.ts +2 -0
  17. package/dist/hooks/index.js +35 -32
  18. package/dist/hooks/use-edge-resize.d.ts +13 -1
  19. package/dist/index.js +5 -5
  20. package/dist/patterns/calendar/index.js +1 -1
  21. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  22. package/dist/tokens.css +1 -1
  23. package/package.json +1 -1
  24. package/dist/_chunks/control-room-rail-CnNZusR5.js +0 -337
  25. package/dist/_chunks/tab-bar-rDkLiaA6.js +0 -268
  26. package/dist/_chunks/use-edge-resize-ZnGG7gyO.js +0 -139
  27. package/dist/_chunks/use-overflow-collapse-BIOzKbni.js +0 -32
@@ -1,19 +1,19 @@
1
- import { jsxs as S, jsx as g } from "react/jsx-runtime";
2
- import { forwardRef as rt, useRef as h, useState as A, useMemo as M, useId as it, useCallback as N, useEffect as re, useImperativeHandle as ot, Fragment as lt } from "react";
3
- import { c as E } from "./index-D2ZczOXr.js";
4
- import { useTranslation as dt } from "react-i18next";
5
- import { I as Le } from "./icon-button-CehAeZoP.js";
6
- import { S as ct } from "./scroll-area-BZOvUhwQ.js";
7
- import { a as ut } from "./tooltip-Cp-PLePW.js";
8
- import { u as ft } from "./use-controllable-state-BiY4xTzM.js";
9
- import { u as pt } from "./use-edge-resize-ZnGG7gyO.js";
10
- import { u as P } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
11
- import { a as vt, u as ze, R as mt } from "./use-list-reflow-Cw43nxw5.js";
12
- import { u as gt } from "./use-prefers-reduced-motion-BMwIQRjB.js";
13
- import { u as bt } from "./use-presence-transition-cDwWUXV-.js";
14
- import { u as ht } from "./use-theme-CAuo6EYT.js";
15
- import { u as yt } from "./registry-DvAUVLHh.js";
16
- const It = {
1
+ import { jsxs as R, jsx as g } from "react/jsx-runtime";
2
+ import { forwardRef as ot, useRef as h, useState as S, useMemo as j, useId as lt, useCallback as z, useEffect as ie, useImperativeHandle as dt, Fragment as ct } from "react";
3
+ import { c as A } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as ut } from "react-i18next";
5
+ import { I as ze } from "./icon-button-CehAeZoP.js";
6
+ import { S as ft } from "./scroll-area-BZOvUhwQ.js";
7
+ import { a as pt } from "./tooltip-Cp-PLePW.js";
8
+ import { u as vt } from "./use-controllable-state-BiY4xTzM.js";
9
+ import { u as mt } from "./use-edge-resize-BHesP0kg.js";
10
+ import { u as M } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
11
+ import { a as gt, u as Ne, R as bt } from "./use-list-reflow-Cw43nxw5.js";
12
+ import { u as ht } from "./use-prefers-reduced-motion-BMwIQRjB.js";
13
+ import { u as yt } from "./use-presence-transition-cDwWUXV-.js";
14
+ import { u as It } from "./use-theme-CAuo6EYT.js";
15
+ import { u as xt } from "./registry-DvAUVLHh.js";
16
+ const wt = {
17
17
  id: "tool-rail",
18
18
  capabilities: ["open", "close", "select_single"],
19
19
  state: {
@@ -40,8 +40,8 @@ const It = {
40
40
  descriptionKey: "ui.toolRail.agent.actions.open",
41
41
  description: "Open the given tool's panel.",
42
42
  examples: [{ args: { id: "inbox" }, note: "Open the inbox tool panel." }],
43
- invoke: (l, n) => {
44
- l.open(n.id);
43
+ invoke: (l, s) => {
44
+ l.open(s.id);
45
45
  }
46
46
  },
47
47
  close: {
@@ -64,8 +64,8 @@ const It = {
64
64
  idempotent: !0,
65
65
  descriptionKey: "ui.toolRail.agent.actions.selectTool",
66
66
  description: "Set the active tool by id (opens its panel), or pass null to collapse.",
67
- invoke: (l, n) => {
68
- l.setActiveTool(n.id);
67
+ invoke: (l, s) => {
68
+ l.setActiveTool(s.id);
69
69
  }
70
70
  }
71
71
  },
@@ -85,7 +85,7 @@ const It = {
85
85
  description: "Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id."
86
86
  }
87
87
  }
88
- }, xt = "ds:[inline-size:3rem]", wt = "ds:[inline-size:var(--tool-rail-panel-inline-size,var(--ai-tools-rail-panel-inline-size,22rem))]", Ne = "--tool-rail-panel-inline-size", Tt = 288, Rt = 880, St = 352, At = E(
88
+ }, Tt = "ds:[inline-size:3rem]", Rt = "ds:[inline-size:var(--tool-rail-panel-inline-size,var(--ai-tools-rail-panel-inline-size,22rem))]", De = "--tool-rail-panel-inline-size", St = 288, At = 880, Et = 352, kt = A(
89
89
  ["ds:flex ds:shrink-0 ds:h-full", "ds:bg-[var(--background)]"].join(" "),
90
90
  {
91
91
  variants: {
@@ -103,18 +103,18 @@ const It = {
103
103
  },
104
104
  defaultVariants: { side: "end" }
105
105
  }
106
- ), Et = E(
106
+ ), _t = A(
107
107
  [
108
108
  "ds:flex ds:shrink-0 ds:flex-col ds:items-center",
109
109
  "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]",
110
110
  "ds:gap-[var(--spacing-xs)]",
111
- xt
111
+ Tt
112
112
  ].join(" ")
113
- ), kt = E(
113
+ ), Lt = A(
114
114
  [
115
115
  "ds:relative ds:flex ds:min-h-0 ds:flex-col ds:h-full",
116
116
  "ds:bg-[var(--background)]",
117
- wt,
117
+ Rt,
118
118
  // Open / collapse: the panel fades and slides from the strip. The WIDTH
119
119
  // snaps on purpose — animating it would re-lay-out the main area (a
120
120
  // calendar grid) on every frame. Declared at rest so both directions
@@ -135,7 +135,7 @@ const It = {
135
135
  },
136
136
  defaultVariants: { side: "end" }
137
137
  }
138
- ), _t = "ds:relative ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ds:overflow-clip", De = E(
138
+ ), zt = "ds:relative ds:flex ds:min-h-0 ds:flex-1 ds:flex-col ds:overflow-clip", Ce = A(
139
139
  [
140
140
  "ds:flex ds:min-h-0 ds:flex-col",
141
141
  "ds:transition-[opacity,translate] ds:duration-[var(--animation-duration)]",
@@ -160,7 +160,7 @@ const It = {
160
160
  },
161
161
  defaultVariants: { layer: "live" }
162
162
  }
163
- ), Lt = 500, zt = [
163
+ ), Nt = 500, Dt = [
164
164
  "id",
165
165
  "name",
166
166
  "for",
@@ -168,29 +168,29 @@ const It = {
168
168
  "data-component-id",
169
169
  "data-testid"
170
170
  ];
171
- function Nt(l) {
172
- return window.getComputedStyle(l).transitionDuration.split(",").some((n) => Number.parseFloat(n) > 0);
171
+ function Ct(l) {
172
+ return window.getComputedStyle(l).transitionDuration.split(",").some((s) => Number.parseFloat(s) > 0);
173
173
  }
174
- function Dt(l) {
175
- const n = l.cloneNode(!0), H = l.querySelectorAll("*"), q = n.querySelectorAll("*"), F = [];
176
- return H.forEach((d, D) => {
177
- var x;
178
- const f = q[D];
179
- if (f && ((d.scrollTop !== 0 || d.scrollLeft !== 0) && F.push([f, d.scrollTop, d.scrollLeft]), d instanceof HTMLCanvasElement && f instanceof HTMLCanvasElement))
174
+ function Vt(l) {
175
+ const s = l.cloneNode(!0), U = l.querySelectorAll("*"), P = s.querySelectorAll("*"), q = [];
176
+ return U.forEach((d, N) => {
177
+ var F;
178
+ const f = P[N];
179
+ if (f && ((d.scrollTop !== 0 || d.scrollLeft !== 0) && q.push([f, d.scrollTop, d.scrollLeft]), d instanceof HTMLCanvasElement && f instanceof HTMLCanvasElement))
180
180
  try {
181
- (x = f.getContext("2d")) == null || x.drawImage(d, 0, 0);
181
+ (F = f.getContext("2d")) == null || F.drawImage(d, 0, 0);
182
182
  } catch {
183
183
  }
184
- }), q.forEach((d) => {
185
- const D = d instanceof SVGElement;
186
- for (const f of zt)
187
- D && f === "id" || d.removeAttribute(f);
184
+ }), P.forEach((d) => {
185
+ const N = d instanceof SVGElement;
186
+ for (const f of Dt)
187
+ N && f === "id" || d.removeAttribute(f);
188
188
  if (d.matches("iframe, video, audio, embed, object, source"))
189
189
  for (const f of ["src", "srcdoc", "data", "autoplay"])
190
190
  d.removeAttribute(f);
191
- }), { nodes: Array.from(n.childNodes), scrolls: F };
191
+ }), { nodes: Array.from(s.childNodes), scrolls: q };
192
192
  }
193
- const Ct = E(
193
+ const Bt = A(
194
194
  [
195
195
  "ds:absolute ds:[inset-block:0] ds:z-[1] ds:select-none ds:touch-none",
196
196
  "ds:[inline-size:var(--resizable-handle-size)] ds:cursor-col-resize",
@@ -214,7 +214,7 @@ const Ct = E(
214
214
  },
215
215
  defaultVariants: { edge: "inline-start" }
216
216
  }
217
- ), Vt = E(
217
+ ), jt = A(
218
218
  [
219
219
  "ds:absolute ds:-top-[var(--spacing-xs)] ds:-end-[var(--spacing-xs)]",
220
220
  "ds:inline-flex ds:items-center ds:justify-center",
@@ -227,7 +227,7 @@ const Ct = E(
227
227
  "ds:pointer-events-none ds:select-none",
228
228
  "ds:forced-colors:outline ds:forced-colors:outline-1 ds:forced-colors:outline-[CanvasText]"
229
229
  ].join(" ")
230
- ), Ce = E(
230
+ ), Ve = A(
231
231
  // `group/rail-tool` lets an affordance overlay (e.g. a pin star) reveal on
232
232
  // hover / focus-within of the whole slot.
233
233
  ["ds:group/rail-tool ds:relative", "ds:rounded-[var(--radius-sm)]"],
@@ -249,311 +249,317 @@ const Ct = E(
249
249
  reorderable: !1
250
250
  }
251
251
  }
252
- ), Bt = "ds:opacity-0", Ve = [
252
+ ), Mt = "ds:opacity-0", Be = [
253
253
  "ds:transition-opacity ds:duration-[var(--animation-duration)]",
254
254
  "ds:ease-[var(--ease-out)] ds:motion-reduce:transition-none"
255
255
  ].join(" ");
256
- function jt(l, n) {
257
- return l > 99 ? n : String(l);
256
+ function Pt(l, s) {
257
+ return l > 99 ? s : String(l);
258
258
  }
259
- const Mt = rt(
259
+ const qt = ot(
260
260
  ({
261
261
  id: l,
262
- tools: n,
263
- activeToolId: H,
264
- defaultActiveToolId: q = null,
265
- onActiveToolChange: F,
262
+ tools: s,
263
+ activeToolId: U,
264
+ defaultActiveToolId: P = null,
265
+ onActiveToolChange: q,
266
266
  side: d = "end",
267
- railLabel: D,
267
+ railLabel: N,
268
268
  resizablePanel: f = !1,
269
- onReorder: x,
270
- formatReorderAnnouncement: U,
271
- renderToolAffordance: W,
272
- renderPanelHeader: ie,
273
- dataComponent: Be = "tool-rail",
274
- agentAdapter: je = It,
275
- className: Me
276
- }, Pe) => {
277
- var Se, Ae, Ee;
278
- const { t: y } = dt(), [qe, I] = ft({
279
- value: H,
280
- defaultValue: q,
281
- onChange: F
282
- }), w = qe ?? null, Z = h([]), C = h(null), [G, Y] = A(0), k = h(!1), X = h(!1), T = M(
283
- () => n.findIndex((e) => e.id === w),
284
- [n, w]
285
- ), u = T >= 0 ? n[T] : null, J = h(u);
286
- u && (J.current = u);
287
- const Fe = M(
288
- () => n.findIndex((e) => !e.disabled),
289
- [n]
290
- ), oe = M(() => {
269
+ panelWidth: F,
270
+ onPanelWidthChange: je,
271
+ onReorder: K,
272
+ formatReorderAnnouncement: W,
273
+ renderToolAffordance: Z,
274
+ renderPanelHeader: oe,
275
+ dataComponent: Me = "tool-rail",
276
+ agentAdapter: Pe = wt,
277
+ className: qe
278
+ }, Fe) => {
279
+ var Ae, Ee, ke;
280
+ const { t: y } = ut(), [Ke, I] = vt({
281
+ value: U,
282
+ defaultValue: P,
283
+ onChange: q
284
+ }), x = Ke ?? null, G = h([]), D = h(null), [Y, X] = S(0), E = h(!1), J = h(!1), w = j(
285
+ () => s.findIndex((e) => e.id === x),
286
+ [s, x]
287
+ ), u = w >= 0 ? s[w] : null, Q = h(u);
288
+ u && (Q.current = u);
289
+ const Oe = j(
290
+ () => s.findIndex((e) => !e.disabled),
291
+ [s]
292
+ ), le = j(() => {
291
293
  var t;
292
- const e = (t = n[0]) == null ? void 0 : t.scope;
293
- return e ? n.findIndex((a) => a.scope && a.scope !== e) : -1;
294
- }, [n]), Ke = oe > 0, p = M(() => {
294
+ const e = (t = s[0]) == null ? void 0 : t.scope;
295
+ return e ? s.findIndex((a) => a.scope && a.scope !== e) : -1;
296
+ }, [s]), $e = le > 0, p = j(() => {
295
297
  var a;
296
- const e = n.findIndex((s) => s.reorderable);
298
+ const e = s.findIndex((n) => n.reorderable);
297
299
  if (e < 0) return null;
298
300
  let t = e;
299
- for (; t + 1 < n.length && ((a = n[t + 1]) != null && a.reorderable); ) t += 1;
301
+ for (; t + 1 < s.length && ((a = s[t + 1]) != null && a.reorderable); ) t += 1;
300
302
  return { first: e, last: t };
301
- }, [n]), le = !!x && p !== null, Oe = it(), [V, Q] = A(null), [de, K] = A(null), { resolvedTheme: $e } = ht(), _ = $e.endsWith("-accessible") || void 0, { containerRef: He } = vt({
302
- key: n.map((e) => e.id).join(),
303
- reduceMotion: _
304
- }), ee = ze({ reduceMotion: _ }), te = bt(
303
+ }, [s]), de = !!K && p !== null, He = lt(), [C, ee] = S(null), [ce, O] = S(null), { resolvedTheme: Ue } = It(), k = Ue.endsWith("-accessible") || void 0, { containerRef: We } = gt({
304
+ key: s.map((e) => e.id).join(),
305
+ reduceMotion: k
306
+ }), te = Ne({ reduceMotion: k }), ae = yt(
305
307
  u !== null,
306
- { reduceMotion: _ }
307
- ), R = u === null && te.mounted, b = u ?? (R ? J.current : null), { ref: ce } = te, Ue = N(
308
+ { reduceMotion: k }
309
+ ), T = u === null && ae.mounted, b = u ?? (T ? Q.current : null), { ref: ue } = ae, Ze = z(
308
310
  (e) => {
309
- C.current = e, ce(e);
311
+ D.current = e, ue(e);
310
312
  },
311
- [ce]
313
+ [ue]
312
314
  );
313
- P(() => {
314
- var a, s;
315
- const e = C.current;
315
+ M(() => {
316
+ var a, n;
317
+ const e = D.current;
316
318
  if (!e) return;
317
319
  const t = document.activeElement;
318
- if (R && t instanceof HTMLElement && e.contains(t)) {
319
- const i = (a = J.current) == null ? void 0 : a.id, o = i ? (s = L.current) == null ? void 0 : s.querySelector(
320
+ if (T && t instanceof HTMLElement && e.contains(t)) {
321
+ const i = (a = Q.current) == null ? void 0 : a.id, o = i ? (n = _.current) == null ? void 0 : n.querySelector(
320
322
  `[data-tool-id="${CSS.escape(i)}"]`
321
323
  ) : null;
322
324
  t.blur(), e.setAttribute("inert", ""), o == null || o.focus();
323
325
  return;
324
326
  }
325
- e.toggleAttribute("inert", R);
326
- }, [R]);
327
- const ue = gt(), [O, fe] = A(
327
+ e.toggleAttribute("inert", T);
328
+ }, [T]);
329
+ const fe = ht(), [$, pe] = S(
328
330
  (u == null ? void 0 : u.id) ?? null
329
- ), v = (u == null ? void 0 : u.id) ?? null, $ = !_ && !ue && v !== null && O !== null && O !== v;
330
- P(() => {
331
- if (O === v) return;
332
- if (!$) {
333
- fe(v);
331
+ ), v = (u == null ? void 0 : u.id) ?? null, H = !k && !fe && v !== null && $ !== null && $ !== v;
332
+ M(() => {
333
+ if ($ === v) return;
334
+ if (!H) {
335
+ pe(v);
334
336
  return;
335
337
  }
336
338
  let e = 0;
337
- const t = () => fe(v), a = requestAnimationFrame(() => {
339
+ const t = () => pe(v), a = requestAnimationFrame(() => {
338
340
  e = requestAnimationFrame(t);
339
- }), s = window.setTimeout(t, 64);
341
+ }), n = window.setTimeout(t, 64);
340
342
  return () => {
341
- cancelAnimationFrame(a), cancelAnimationFrame(e), window.clearTimeout(s);
343
+ cancelAnimationFrame(a), cancelAnimationFrame(e), window.clearTimeout(n);
342
344
  };
343
- }, [v, O, $]);
344
- const We = !!_ || ue, pe = h(null), [c, ve] = A({ liveId: v, serial: 0, focusLost: !1, leaving: [] });
345
+ }, [v, $, H]);
346
+ const Ge = !!k || fe, ve = h(null), [c, me] = S({ liveId: v, serial: 0, focusLost: !1, leaving: [] });
345
347
  if (c.liveId !== v) {
346
- const e = c.liveId !== null && v !== null ? ((Se = pe.current) == null ? void 0 : Se.querySelector(
348
+ const e = c.liveId !== null && v !== null ? ((Ae = ve.current) == null ? void 0 : Ae.querySelector(
347
349
  ':scope > [data-tool-rail-layer="live"]'
348
350
  )) ?? null : null, t = c.leaving.filter(
349
351
  (a) => a.toolId !== v
350
352
  );
351
- ve({
353
+ me({
352
354
  liveId: v,
353
355
  serial: c.serial + 1,
354
356
  focusLost: (e == null ? void 0 : e.contains(document.activeElement)) ?? !1,
355
- leaving: e && !We ? [
357
+ leaving: e && !Ge ? [
356
358
  ...t.filter((a) => a.toolId !== c.liveId),
357
359
  {
358
360
  exitId: `${c.liveId}:${c.serial}`,
359
361
  toolId: c.liveId,
360
- ...Dt(e)
362
+ ...Vt(e)
361
363
  }
362
364
  ] : t
363
365
  });
364
366
  }
365
- const B = N((e) => {
366
- ve(
367
+ const V = z((e) => {
368
+ me(
367
369
  (t) => t.leaving.some((a) => a.exitId === e) ? {
368
370
  ...t,
369
371
  leaving: t.leaving.filter((a) => a.exitId !== e)
370
372
  } : t
371
373
  );
372
- }, []), { leave: me } = ze({
373
- reduceMotion: _,
374
- durationMs: Lt
374
+ }, []), { leave: ge } = Ne({
375
+ reduceMotion: k,
376
+ durationMs: Nt
375
377
  });
376
- re(() => {
378
+ ie(() => {
377
379
  for (const { exitId: e } of c.leaving)
378
- me(e, () => B(e));
379
- }, [c.leaving, me, B]);
380
- const Ze = b ? c.leaving : [], Ge = ((Ae = c.leaving[c.leaving.length - 1]) == null ? void 0 : Ae.exitId) ?? null, ge = h(c.leaving);
381
- ge.current = c.leaving;
382
- const Ye = N(
380
+ ge(e, () => V(e));
381
+ }, [c.leaving, ge, V]);
382
+ const Ye = b ? c.leaving : [], Xe = ((Ee = c.leaving[c.leaving.length - 1]) == null ? void 0 : Ee.exitId) ?? null, be = h(c.leaving);
383
+ be.current = c.leaving;
384
+ const Je = z(
383
385
  (e) => {
384
386
  if (!e || e.childNodes.length > 0) return;
385
- const t = ge.current.find(
387
+ const t = be.current.find(
386
388
  (a) => a.exitId === e.dataset.exitId
387
389
  );
388
390
  if (t) {
389
- if (!Nt(e)) {
390
- B(t.exitId);
391
+ if (!Ct(e)) {
392
+ V(t.exitId);
391
393
  return;
392
394
  }
393
395
  e.setAttribute("inert", ""), e.append(...t.nodes);
394
- for (const [a, s, i] of t.scrolls)
395
- a.scrollTop = s, a.scrollLeft = i;
396
+ for (const [a, n, i] of t.scrolls)
397
+ a.scrollTop = n, a.scrollLeft = i;
396
398
  }
397
399
  },
398
- [B]
400
+ [V]
399
401
  );
400
- P(() => {
402
+ M(() => {
401
403
  var t, a;
402
404
  if (!c.focusLost || !v) return;
403
405
  const e = document.activeElement;
404
- e && e !== document.body || (a = (t = L.current) == null ? void 0 : t.querySelector(
406
+ e && e !== document.body || (a = (t = _.current) == null ? void 0 : t.querySelector(
405
407
  `[data-tool-id="${CSS.escape(v)}"]`
406
408
  )) == null || a.focus();
407
409
  }, [c.serial]);
408
- const [Xe, be] = A([]), he = h(n);
409
- re(() => {
410
- const e = he.current, t = new Set(n.map((s) => s.id)), a = e.filter((s) => !t.has(s.id));
410
+ const [Qe, he] = S([]), ye = h(s);
411
+ ie(() => {
412
+ const e = ye.current, t = new Set(s.map((n) => n.id)), a = e.filter((n) => !t.has(n.id));
411
413
  if (a.length > 0) {
412
- be((s) => {
413
- const i = new Set(s.map((o) => o.id));
414
+ he((n) => {
415
+ const i = new Set(n.map((o) => o.id));
414
416
  return [
415
- ...s,
417
+ ...n,
416
418
  ...a.filter((o) => !i.has(o.id))
417
419
  ];
418
420
  });
419
- for (const s of a)
420
- ee.leave(s.id, () => {
421
- be(
422
- (i) => i.filter((o) => o.id !== s.id)
421
+ for (const n of a)
422
+ te.leave(n.id, () => {
423
+ he(
424
+ (i) => i.filter((o) => o.id !== n.id)
423
425
  );
424
426
  });
425
427
  }
426
- he.current = n;
427
- }, [n, ee]);
428
- const [Je, Qe] = A(""), ae = h(!1), ye = N(
428
+ ye.current = s;
429
+ }, [s, te]);
430
+ const [et, tt] = S(""), se = h(!1), Ie = z(
429
431
  (e, t) => {
430
- if (!x || !p) return;
432
+ if (!K || !p) return;
431
433
  const a = Math.max(
432
434
  p.first,
433
435
  Math.min(p.last, t)
434
436
  );
435
437
  if (a === e) return;
436
- x(e, a);
437
- const s = n[e];
438
- if (s) {
439
- const i = U ? U({ tool: s, from: e, to: a }) : y("toolRail.reorderAnnounce", {
440
- tool: s.label,
438
+ K(e, a);
439
+ const n = s[e];
440
+ if (n) {
441
+ const i = W ? W({ tool: n, from: e, to: a }) : y("toolRail.reorderAnnounce", {
442
+ tool: n.label,
441
443
  to: a - p.first + 1,
442
444
  total: p.last - p.first + 1,
443
445
  defaultValue: "{{tool}} moved to position {{to}} of {{total}}"
444
446
  });
445
- i && (ae.current = !ae.current, Qe(ae.current ? i : `${i}​`));
447
+ i && (se.current = !se.current, tt(se.current ? i : `${i}​`));
446
448
  }
447
449
  },
448
- [x, p, n, y, U]
449
- ), j = T >= 0 ? T : G >= 0 && !((Ee = n[G]) != null && Ee.disabled) ? G : Fe, et = N(
450
+ [K, p, s, y, W]
451
+ ), B = w >= 0 ? w : Y >= 0 && !((ke = s[Y]) != null && ke.disabled) ? Y : Oe, at = z(
450
452
  (e, t) => {
451
- const a = n.find((s) => s.id === e);
452
- !a || a.disabled || (k.current = t, I(w === e ? null : e));
453
+ const a = s.find((n) => n.id === e);
454
+ !a || a.disabled || (E.current = t, I(x === e ? null : e));
453
455
  },
454
- [n, w, I]
455
- ), tt = N(
456
+ [s, x, I]
457
+ ), st = z(
456
458
  (e) => {
457
- var z, r, m;
458
- const t = n.length;
459
+ var L, r, m;
460
+ const t = s.length;
459
461
  if (t === 0 || e.altKey) return;
460
462
  let a = null;
461
- if (e.key === "ArrowDown" ? a = (j + 1) % t : e.key === "ArrowUp" ? a = (j - 1 + t) % t : e.key === "Home" ? a = 0 : e.key === "End" && (a = t - 1), a === null) return;
462
- const s = e.key === "ArrowUp" || e.key === "End";
463
+ if (e.key === "ArrowDown" ? a = (B + 1) % t : e.key === "ArrowUp" ? a = (B - 1 + t) % t : e.key === "Home" ? a = 0 : e.key === "End" && (a = t - 1), a === null) return;
464
+ const n = e.key === "ArrowUp" || e.key === "End";
463
465
  let i = a, o = 0;
464
- for (; o < t && ((z = n[i]) != null && z.disabled); )
465
- i = s ? (i - 1 + t) % t : (i + 1) % t, o += 1;
466
- (r = n[i]) != null && r.disabled || (e.preventDefault(), Y(i), (m = Z.current[i]) == null || m.focus());
466
+ for (; o < t && ((L = s[i]) != null && L.disabled); )
467
+ i = n ? (i - 1 + t) % t : (i + 1) % t, o += 1;
468
+ (r = s[i]) != null && r.disabled || (e.preventDefault(), X(i), (m = G.current[i]) == null || m.focus());
467
469
  },
468
- [n, j]
469
- ), L = h(null);
470
- re(() => {
471
- const e = L.current;
470
+ [s, B]
471
+ ), _ = h(null);
472
+ ie(() => {
473
+ const e = _.current;
472
474
  if (!e) return;
473
475
  const t = (a) => {
474
- if (a.key !== "Escape" || T < 0) return;
476
+ if (a.key !== "Escape" || w < 0) return;
475
477
  a.preventDefault();
476
- const s = T;
477
- I(null), Y(s), requestAnimationFrame(() => {
478
+ const n = w;
479
+ I(null), X(n), requestAnimationFrame(() => {
478
480
  var i;
479
- (i = Z.current[s]) == null || i.focus();
481
+ (i = G.current[n]) == null || i.focus();
480
482
  });
481
483
  };
482
484
  return e.addEventListener("keydown", t), () => e.removeEventListener("keydown", t);
483
- }, [T, I]), P(() => {
485
+ }, [w, I]), M(() => {
484
486
  var e;
485
- u && k.current && ((e = C.current) == null || e.focus()), k.current = !1;
487
+ u && E.current && ((e = D.current) == null || e.focus()), E.current = !1;
486
488
  }, [u]);
487
- const Ie = d === "end" ? "inline-start" : "inline-end", { separatorProps: xe, isResizing: we, isResized: Te } = pt({
488
- edge: Ie,
489
- targetRef: C,
490
- cssProperty: Ne,
491
- minSize: Tt,
492
- maxSize: Rt,
493
- defaultSize: St,
494
- disabled: !f
495
- }), Re = xe["aria-valuenow"];
496
- P(() => {
489
+ const xe = d === "end" ? "inline-start" : "inline-end", { separatorProps: we, isResizing: Te, isResized: Re } = mt({
490
+ edge: xe,
491
+ targetRef: D,
492
+ cssProperty: De,
493
+ minSize: St,
494
+ maxSize: At,
495
+ defaultSize: Et,
496
+ disabled: !f,
497
+ // A width the user cannot change or reset is a trap: the controlled
498
+ // value applies only while the handle is on.
499
+ size: f ? F : void 0,
500
+ onResize: je
501
+ }), Se = we["aria-valuenow"];
502
+ M(() => {
497
503
  var e;
498
- !f || !Te || !u || (e = C.current) == null || e.style.setProperty(
499
- Ne,
500
- `${Re}px`
504
+ !f || !Re || !u || (e = D.current) == null || e.style.setProperty(
505
+ De,
506
+ `${Se}px`
501
507
  );
502
- }, [u, f, Te, Re]);
503
- const ne = h(w);
504
- ne.current = w;
505
- const se = M(
508
+ }, [u, f, Re, Se]);
509
+ const ne = h(x);
510
+ ne.current = x;
511
+ const re = j(
506
512
  () => ({
507
513
  getActiveToolId: () => ne.current,
508
514
  setActiveTool: (e) => {
509
- k.current = !1, I(e);
515
+ E.current = !1, I(e);
510
516
  },
511
517
  open: (e) => {
512
- const t = n.find((a) => a.id === e);
513
- !t || t.disabled || (k.current = !1, I(e));
518
+ const t = s.find((a) => a.id === e);
519
+ !t || t.disabled || (E.current = !1, I(e));
514
520
  },
515
521
  close: () => {
516
522
  const e = ne.current;
517
- k.current = !1, I(null), e != null && requestAnimationFrame(() => {
523
+ E.current = !1, I(null), e != null && requestAnimationFrame(() => {
518
524
  var t, a;
519
- (a = (t = L.current) == null ? void 0 : t.querySelector(
525
+ (a = (t = _.current) == null ? void 0 : t.querySelector(
520
526
  `[data-tool-id="${CSS.escape(e)}"]`
521
527
  )) == null || a.focus();
522
528
  });
523
529
  }
524
530
  }),
525
- [n, I]
531
+ [s, I]
526
532
  );
527
- ot(Pe, () => se, [se]), yt(je, se, l);
528
- const at = y("toolRail.badgeCountOverflow", {
533
+ dt(Fe, () => re, [re]), xt(Pe, re, l);
534
+ const nt = y("toolRail.badgeCountOverflow", {
529
535
  defaultValue: "99+"
530
536
  });
531
- return /* @__PURE__ */ S(
537
+ return /* @__PURE__ */ R(
532
538
  "div",
533
539
  {
534
- ref: L,
535
- "data-component": Be,
540
+ ref: _,
541
+ "data-component": Me,
536
542
  "data-component-id": l,
537
543
  "data-side": d,
538
- className: [At({ side: d }), Me].filter(Boolean).join(" "),
544
+ className: [kt({ side: d }), qe].filter(Boolean).join(" "),
539
545
  children: [
540
- le ? /* @__PURE__ */ g("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: Je }) : null,
541
- b ? /* @__PURE__ */ S(
546
+ de ? /* @__PURE__ */ g("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: et }) : null,
547
+ b ? /* @__PURE__ */ R(
542
548
  "aside",
543
549
  {
544
- ref: Ue,
550
+ ref: Ze,
545
551
  tabIndex: -1,
546
552
  "aria-label": y("toolRail.panelLabel", {
547
553
  tool: b.label,
548
554
  defaultValue: "{{tool}} panel"
549
555
  }),
550
- "aria-hidden": R || void 0,
551
- "data-tool-rail-state": R ? "collapsing" : "expanded",
552
- "data-presence": te.phase,
556
+ "aria-hidden": T || void 0,
557
+ "data-tool-rail-state": T ? "collapsing" : "expanded",
558
+ "data-presence": ae.phase,
553
559
  "data-active-tool": b.id,
554
- "data-resizing": we ? "" : void 0,
560
+ "data-resizing": Te ? "" : void 0,
555
561
  className: [
556
- kt({ side: d }),
562
+ Lt({ side: d }),
557
563
  // Subtle shadow — not a line — separating the panel from the
558
564
  // icon strip (the tab row). The panel casts a soft chrome
559
565
  // shadow toward the strip on its strip-facing edge. `z-[1]`
@@ -569,31 +575,31 @@ const Mt = rt(
569
575
  "ds:focus-visible:outline-none"
570
576
  ].join(" "),
571
577
  children: [
572
- ie ? ie(b, { isActive: !R }) : null,
573
- /* @__PURE__ */ S("div", { ref: pe, className: _t, children: [
574
- Ze.map((e) => /* @__PURE__ */ g(
578
+ oe ? oe(b, { isActive: !T }) : null,
579
+ /* @__PURE__ */ R("div", { ref: ve, className: zt, children: [
580
+ Ye.map((e) => /* @__PURE__ */ g(
575
581
  "div",
576
582
  {
577
- ref: Ye,
583
+ ref: Je,
578
584
  "aria-hidden": "true",
579
585
  "data-exit-id": e.exitId,
580
586
  "data-tool-rail-body": e.toolId,
581
587
  "data-tool-rail-layer": "leaving",
582
- "data-presence": $ && e.exitId === Ge ? "present" : "leaving",
583
- className: De({ layer: "leaving" }),
588
+ "data-presence": H && e.exitId === Xe ? "present" : "leaving",
589
+ className: Ce({ layer: "leaving" }),
584
590
  onTransitionEnd: (t) => {
585
- t.target === t.currentTarget && B(e.exitId);
591
+ t.target === t.currentTarget && V(e.exitId);
586
592
  }
587
593
  },
588
594
  e.exitId
589
595
  )),
590
- /* @__PURE__ */ S(
596
+ /* @__PURE__ */ R(
591
597
  "div",
592
598
  {
593
599
  "data-tool-rail-body": b.id,
594
600
  "data-tool-rail-layer": "live",
595
- "data-presence": $ ? "entering" : "present",
596
- className: De({ layer: "live" }),
601
+ "data-presence": H ? "entering" : "present",
602
+ className: Ce({ layer: "live" }),
597
603
  children: [
598
604
  b.header ? /* @__PURE__ */ g("div", { className: "ds:shrink-0", children: b.header }) : null,
599
605
  b.fill ? (
@@ -602,7 +608,7 @@ const Mt = rt(
602
608
  // 8px overlay. See tokens/index.css.
603
609
  /* @__PURE__ */ g("div", { "data-tool-fill": "", className: "ds:flex-1 ds:min-h-0", children: b.panel })
604
610
  ) : /* @__PURE__ */ g(
605
- ct,
611
+ ft,
606
612
  {
607
613
  orientation: "vertical",
608
614
  className: "ds:flex-1 ds:min-h-0",
@@ -617,35 +623,35 @@ const Mt = rt(
617
623
  f ? /* @__PURE__ */ g(
618
624
  "div",
619
625
  {
620
- ...xe,
626
+ ...we,
621
627
  "aria-label": y("toolRail.resizePanel", {
622
628
  defaultValue: "Resize tool panel"
623
629
  }),
624
- "data-resizing": we ? "" : void 0,
625
- className: Ct({ edge: Ie })
630
+ "data-resizing": Te ? "" : void 0,
631
+ className: Bt({ edge: xe })
626
632
  }
627
633
  ) : null
628
634
  ]
629
635
  }
630
636
  ) : null,
631
- /* @__PURE__ */ g(ut, { children: /* @__PURE__ */ S(
637
+ /* @__PURE__ */ g(pt, { children: /* @__PURE__ */ R(
632
638
  "div",
633
639
  {
634
- ref: He,
640
+ ref: We,
635
641
  role: "toolbar",
636
642
  "aria-orientation": "vertical",
637
- "aria-label": D ?? y("toolRail.railLabel", { defaultValue: "Tools" }),
638
- className: Et(),
639
- onKeyDown: tt,
643
+ "aria-label": N ?? y("toolRail.railLabel", { defaultValue: "Tools" }),
644
+ className: _t(),
645
+ onKeyDown: st,
640
646
  children: [
641
- n.map((e, t) => {
642
- const a = e.id === w, s = typeof e.badgeCount == "number" && e.badgeCount > 0, i = s ? y("toolRail.toolWithCount", {
647
+ s.map((e, t) => {
648
+ const a = e.id === x, n = typeof e.badgeCount == "number" && e.badgeCount > 0, i = n ? y("toolRail.toolWithCount", {
643
649
  tool: e.label,
644
650
  count: e.badgeCount,
645
651
  defaultValue: "{{tool}}, {{count}} updates"
646
- }) : e.label, o = le && !!e.reorderable && !e.disabled, z = o ? `${Oe}-${e.id}` : void 0;
647
- return /* @__PURE__ */ S(lt, { children: [
648
- Ke && t === oe ? /* @__PURE__ */ g(
652
+ }) : e.label, o = de && !!e.reorderable && !e.disabled, L = o ? `${He}-${e.id}` : void 0;
653
+ return /* @__PURE__ */ R(ct, { children: [
654
+ $e && t === le ? /* @__PURE__ */ g(
649
655
  "div",
650
656
  {
651
657
  role: "separator",
@@ -653,45 +659,45 @@ const Mt = rt(
653
659
  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]"
654
660
  }
655
661
  ) : null,
656
- /* @__PURE__ */ S(
662
+ /* @__PURE__ */ R(
657
663
  "div",
658
664
  {
659
665
  className: [
660
- Ce({
661
- dragging: V === t,
662
- dropTarget: de === t && V !== t,
666
+ Ve({
667
+ dragging: C === t,
668
+ dropTarget: ce === t && C !== t,
663
669
  reorderable: o
664
670
  }),
665
- Ve,
666
- mt
671
+ Be,
672
+ bt
667
673
  ].filter(Boolean).join(" "),
668
674
  "data-reflow-id": e.id,
669
- "data-dragging": V === t ? "" : void 0,
675
+ "data-dragging": C === t ? "" : void 0,
670
676
  draggable: o || void 0,
671
677
  onDragStart: o ? (r) => {
672
- Q(t), r.dataTransfer.effectAllowed = "move", r.dataTransfer.setData(
678
+ ee(t), r.dataTransfer.effectAllowed = "move", r.dataTransfer.setData(
673
679
  "text/plain",
674
680
  String(t)
675
681
  );
676
682
  } : void 0,
677
683
  onDragOver: o ? (r) => {
678
- V !== null && (r.preventDefault(), r.dataTransfer.dropEffect = "move", de !== t && K(t));
684
+ C !== null && (r.preventDefault(), r.dataTransfer.dropEffect = "move", ce !== t && O(t));
679
685
  } : void 0,
680
- onDragLeave: o ? () => K((r) => r === t ? null : r) : void 0,
686
+ onDragLeave: o ? () => O((r) => r === t ? null : r) : void 0,
681
687
  onDrop: o ? (r) => {
682
688
  r.preventDefault();
683
- const m = V;
684
- K(null), Q(null), !(m === null || m === t) && ye(m, t);
689
+ const m = C;
690
+ O(null), ee(null), !(m === null || m === t) && Ie(m, t);
685
691
  } : void 0,
686
692
  onDragEnd: o ? () => {
687
- Q(null), K(null);
693
+ ee(null), O(null);
688
694
  } : void 0,
689
695
  children: [
690
696
  /* @__PURE__ */ g(
691
- Le,
697
+ ze,
692
698
  {
693
699
  ref: (r) => {
694
- Z.current[t] = r;
700
+ G.current[t] = r;
695
701
  },
696
702
  icon: e.icon,
697
703
  tooltip: e.label,
@@ -703,50 +709,50 @@ const Mt = rt(
703
709
  "aria-expanded": a,
704
710
  "data-active": a ? e.id : void 0,
705
711
  "data-tool-id": e.id,
706
- "aria-describedby": z,
712
+ "aria-describedby": L,
707
713
  "aria-keyshortcuts": o ? "Alt+ArrowUp Alt+ArrowDown" : void 0,
708
- tabIndex: t === j ? 0 : -1,
714
+ tabIndex: t === B ? 0 : -1,
709
715
  onFocus: () => {
710
- e.disabled || Y(t);
716
+ e.disabled || X(t);
711
717
  },
712
- onClick: () => et(e.id, X.current),
718
+ onClick: () => at(e.id, J.current),
713
719
  onKeyDown: (r) => {
714
720
  if (r.key === "Enter" || r.key === " ") {
715
- X.current = !0;
721
+ J.current = !0;
716
722
  return;
717
723
  }
718
724
  if (o && r.altKey && p) {
719
725
  let m = null;
720
726
  if (r.key === "ArrowUp" ? m = t - 1 : r.key === "ArrowDown" ? m = t + 1 : r.key === "Home" ? m = p.first : r.key === "End" && (m = p.last), m !== null) {
721
727
  r.preventDefault();
722
- const nt = Math.max(
728
+ const rt = Math.max(
723
729
  p.first,
724
730
  Math.min(p.last, m)
725
- ), st = e.id;
726
- ye(t, nt), requestAnimationFrame(() => {
727
- var ke, _e;
728
- (_e = (ke = L.current) == null ? void 0 : ke.querySelector(
729
- `[data-tool-id="${CSS.escape(st)}"]`
730
- )) == null || _e.focus();
731
+ ), it = e.id;
732
+ Ie(t, rt), requestAnimationFrame(() => {
733
+ var _e, Le;
734
+ (Le = (_e = _.current) == null ? void 0 : _e.querySelector(
735
+ `[data-tool-id="${CSS.escape(it)}"]`
736
+ )) == null || Le.focus();
731
737
  });
732
738
  }
733
739
  }
734
740
  },
735
741
  onKeyUp: (r) => {
736
- (r.key === "Enter" || r.key === " ") && (X.current = !1);
742
+ (r.key === "Enter" || r.key === " ") && (J.current = !1);
737
743
  }
738
744
  }
739
745
  ),
740
- s ? /* @__PURE__ */ g("span", { "aria-hidden": "true", className: Vt(), children: jt(
746
+ n ? /* @__PURE__ */ g("span", { "aria-hidden": "true", className: jt(), children: Pt(
741
747
  e.badgeCount,
742
- at
748
+ nt
743
749
  ) }) : null,
744
- W == null ? void 0 : W(e, {
750
+ Z == null ? void 0 : Z(e, {
745
751
  index: t,
746
752
  isActive: a,
747
- isRovingTarget: t === j
753
+ isRovingTarget: t === B
748
754
  }),
749
- z ? /* @__PURE__ */ g("span", { id: z, className: "ds:sr-only", children: y("toolRail.reorderInstructions", {
755
+ L ? /* @__PURE__ */ g("span", { id: L, className: "ds:sr-only", children: y("toolRail.reorderInstructions", {
750
756
  tool: e.label,
751
757
  defaultValue: "Reorder {{tool}}. Press Alt + Up or Alt + Down to move."
752
758
  }) }) : null
@@ -755,22 +761,22 @@ const Mt = rt(
755
761
  )
756
762
  ] }, e.id);
757
763
  }),
758
- Xe.map(
759
- (e) => ee.isLeaving(e.id) ? /* @__PURE__ */ g(
764
+ Qe.map(
765
+ (e) => te.isLeaving(e.id) ? /* @__PURE__ */ g(
760
766
  "div",
761
767
  {
762
768
  className: [
763
- Ce({
769
+ Ve({
764
770
  dragging: !1,
765
771
  dropTarget: !1,
766
772
  reorderable: !1
767
773
  }),
768
- Ve,
769
- Bt
774
+ Be,
775
+ Mt
770
776
  ].filter(Boolean).join(" "),
771
777
  "aria-hidden": "true",
772
778
  children: /* @__PURE__ */ g(
773
- Le,
779
+ ze,
774
780
  {
775
781
  icon: e.icon,
776
782
  intent: "ghost",
@@ -791,9 +797,9 @@ const Mt = rt(
791
797
  );
792
798
  }
793
799
  );
794
- Mt.displayName = "ToolRail";
800
+ qt.displayName = "ToolRail";
795
801
  export {
796
- Mt as T,
797
- It as t
802
+ qt as T,
803
+ wt as t
798
804
  };
799
- //# sourceMappingURL=tool-rail-D89USYE6.js.map
805
+ //# sourceMappingURL=tool-rail-CCFqDfAn.js.map