@alfadocs/ui-kit 1.9.3 → 1.10.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.
@@ -1,18 +1,18 @@
1
- import { jsxs as L, jsx as b } from "react/jsx-runtime";
2
- import { useMemo as ie, useCallback as u, useRef as f, useEffect as be, forwardRef as Se, useId as De, useState as ue, useImperativeHandle as Fe } from "react";
3
- import * as oe from "@radix-ui/react-tabs";
4
- import { a as Z, c as Ie } from "./index-D2ZczOXr.js";
5
- import { useTranslation as ke } from "react-i18next";
6
- import { I as de } from "./icon-button-DA2CAGHZ.js";
7
- import { P as ce } from "./popover-Cqcjx-Ny.js";
8
- import { T as je } from "./text-input-CUvCb6ST.js";
9
- import { u as ze } from "./use-direction-Dp8h70PP.js";
10
- import { u as Ke } from "./registry-DvAUVLHh.js";
11
- import { u as ye } from "./use-controllable-state-BiY4xTzM.js";
1
+ import { jsxs as O, jsx as p } from "react/jsx-runtime";
2
+ import { useMemo as de, useCallback as u, useRef as T, useEffect as me, forwardRef as De, useId as Fe, useState as pe, useImperativeHandle as je } from "react";
3
+ import * as ce from "@radix-ui/react-tabs";
4
+ import { a as ne, c as ke } from "./index-D2ZczOXr.js";
5
+ import { useTranslation as Ae } from "react-i18next";
6
+ import { I as le } from "./icon-button-DA2CAGHZ.js";
7
+ import { P as ue } from "./popover-Cqcjx-Ny.js";
8
+ import { T as ze } from "./text-input-CUvCb6ST.js";
9
+ import { u as Ke } from "./use-direction-Dp8h70PP.js";
10
+ import { u as Me } from "./registry-DvAUVLHh.js";
11
+ import { u as Ie } from "./use-controllable-state-BiY4xTzM.js";
12
12
  import { X as we } from "./x-B5YnXwCz.js";
13
- import { P as Me } from "./plus-DzMQ_c6b.js";
14
- import { C as Pe } from "./check-DrFSN__t.js";
15
- const qe = {
13
+ import { P as Pe } from "./plus-DzMQ_c6b.js";
14
+ import { C as qe } from "./check-DrFSN__t.js";
15
+ const Le = {
16
16
  id: "data-table-tabs",
17
17
  capabilities: ["select_single", "view_change"],
18
18
  state: {
@@ -20,13 +20,13 @@ const qe = {
20
20
  type: "string | null",
21
21
  descriptionKey: "ui.agent.dataTableTabs.state.activeTabId",
22
22
  description: "Id of the currently-active saved-filter tab.",
23
- read: (r) => r.getActiveTabId()
23
+ read: (n) => n.getActiveTabId()
24
24
  },
25
25
  tabs: {
26
26
  type: "Array<{ id, label }>",
27
27
  descriptionKey: "ui.agent.dataTableTabs.state.tabs",
28
28
  description: "The saved-filter tabs, in strip order (ids + labels).",
29
- read: (r) => r.getTabs().map(({ id: o, label: g }) => ({ id: o, label: g }))
29
+ read: (n) => n.getTabs().map(({ id: i, label: v }) => ({ id: i, label: v }))
30
30
  }
31
31
  },
32
32
  actions: {
@@ -44,8 +44,8 @@ const qe = {
44
44
  idempotent: !0,
45
45
  descriptionKey: "ui.agent.dataTableTabs.actions.selectTab",
46
46
  description: "Activate a saved-filter tab: snapshots the outgoing tab, applies the incoming filter model to the table.",
47
- invoke: (r, o) => {
48
- r.selectTab(o.id);
47
+ invoke: (n, i) => {
48
+ n.selectTab(i.id);
49
49
  }
50
50
  },
51
51
  get_tabs: {
@@ -65,7 +65,7 @@ const qe = {
65
65
  idempotent: !0,
66
66
  descriptionKey: "ui.agent.dataTableTabs.actions.getTabs",
67
67
  description: "Return the saved-filter tabs (ids + labels) in order.",
68
- invoke: (r) => r.getTabs().map(({ id: o, label: g }) => ({ id: o, label: g }))
68
+ invoke: (n) => n.getTabs().map(({ id: i, label: v }) => ({ id: i, label: v }))
69
69
  },
70
70
  add_tab: {
71
71
  safety: "write",
@@ -85,7 +85,7 @@ const qe = {
85
85
  description: "Add a new tab capturing the table's current filter model, and activate it. Returns the new tab id.",
86
86
  returns: "string",
87
87
  returnsSchema: { type: "string" },
88
- invoke: (r, o) => r.addTab(o.label)
88
+ invoke: (n, i) => n.addTab(i.label)
89
89
  },
90
90
  rename_tab: {
91
91
  safety: "write",
@@ -101,8 +101,8 @@ const qe = {
101
101
  idempotent: !0,
102
102
  descriptionKey: "ui.agent.dataTableTabs.actions.renameTab",
103
103
  description: "Rename a saved-filter tab. No-op on locked tabs and empty labels.",
104
- invoke: (r, o) => {
105
- r.renameTab(o.id, o.label);
104
+ invoke: (n, i) => {
105
+ n.renameTab(i.id, i.label);
106
106
  }
107
107
  },
108
108
  remove_tab: {
@@ -119,8 +119,8 @@ const qe = {
119
119
  idempotent: !0,
120
120
  descriptionKey: "ui.agent.dataTableTabs.actions.removeTab",
121
121
  description: "Remove a saved-filter tab (its saved filter is lost). No-op on locked tabs and the last remaining tab.",
122
- invoke: (r, o) => {
123
- r.removeTab(o.id);
122
+ invoke: (n, i) => {
123
+ n.removeTab(i.id);
124
124
  }
125
125
  }
126
126
  },
@@ -131,7 +131,7 @@ const qe = {
131
131
  }
132
132
  };
133
133
  let xe = 0;
134
- function Le() {
134
+ function Oe() {
135
135
  try {
136
136
  if (typeof crypto < "u" && "randomUUID" in crypto)
137
137
  return crypto.randomUUID();
@@ -139,191 +139,207 @@ function Le() {
139
139
  }
140
140
  return xe += 1, `tab-${xe}`;
141
141
  }
142
- function le(r) {
143
- return typeof r == "object" && r !== null && !Array.isArray(r) && Object.getPrototypeOf(r) !== null;
142
+ function be(n) {
143
+ return typeof n == "object" && n !== null && !Array.isArray(n) && Object.getPrototypeOf(n) !== null;
144
144
  }
145
- function Oe(r) {
146
- return !le(r) || r.v !== 1 || !Array.isArray(r.tabs) ? !1 : r.tabs.every(
147
- (o) => le(o) && typeof o.id == "string" && typeof o.label == "string" && le(o.filterModel)
145
+ function Ee(n) {
146
+ return !be(n) || n.v !== 1 || !Array.isArray(n.tabs) ? !1 : n.tabs.every(
147
+ (i) => be(i) && typeof i.id == "string" && typeof i.label == "string" && be(i.filterModel)
148
148
  );
149
149
  }
150
- function Ve(r) {
151
- var J, Q;
150
+ function Ve(n) {
151
+ var k, z;
152
152
  const {
153
- getTable: o,
154
- tabs: g,
155
- defaultTabs: k,
153
+ getTable: i,
154
+ tabs: v,
155
+ defaultTabs: A,
156
156
  onTabsChange: R,
157
- activeTabId: ee,
158
- defaultActiveTabId: te,
159
- onActiveTabChange: ae,
160
- persistKey: z,
161
- captureQuickFilter: x = !1,
162
- applyOnActivate: A = !0,
163
- maxTabs: O = 8,
164
- createTab: N,
165
- makeTabId: V = Le
166
- } = r, { t: _ } = ke(), $ = g !== void 0, E = ie(() => k && k.length > 0 ? k : [
157
+ activeTabId: re,
158
+ defaultActiveTabId: se,
159
+ onActiveTabChange: ie,
160
+ persistKey: j,
161
+ persistActiveTab: E = !1,
162
+ captureQuickFilter: w = !1,
163
+ applyOnActivate: N = !0,
164
+ maxTabs: V = 8,
165
+ createTab: C,
166
+ makeTabId: _ = Oe
167
+ } = n, { t: $ } = Ae(), U = v !== void 0, G = de(() => A && A.length > 0 ? A : [
167
168
  {
168
169
  id: "default",
169
- label: _("dataTableTabs.newTabName", { number: 1 }),
170
+ label: $("dataTableTabs.newTabName", { number: 1 }),
170
171
  filterModel: {}
171
172
  }
172
- ], []), W = ie(() => {
173
- if (!z || $ || typeof window > "u")
173
+ ], []), g = de(() => {
174
+ if (!j || U || typeof window > "u")
174
175
  return null;
175
176
  try {
176
- const t = window.localStorage.getItem(`data-table-tabs:${z}`);
177
+ const t = window.localStorage.getItem(`data-table-tabs:${j}`);
177
178
  if (!t) return null;
178
179
  const a = JSON.parse(t);
179
- return Oe(a) ? a.tabs : null;
180
+ return Ee(a) ? a : null;
180
181
  } catch {
181
182
  return null;
182
183
  }
183
- }, []), [U, G] = ye({
184
- value: g,
185
- defaultValue: W ?? E,
186
- onChange: R
187
- }), C = ie(() => U ?? E, [U, E]), y = u(
188
- (t) => {
189
- const a = t(p.current);
190
- if (p.current = a, G(a), z && !$)
184
+ }, []), Q = (g == null ? void 0 : g.tabs) ?? null, X = E && (g != null && g.activeTabId) && g.tabs.some((t) => t.id === g.activeTabId) ? g.activeTabId : void 0, K = u(
185
+ (t, a) => {
186
+ if (!(!j || U))
191
187
  try {
192
- const n = { v: 1, tabs: a };
188
+ const r = {
189
+ v: 1,
190
+ tabs: t,
191
+ ...E && a ? { activeTabId: a } : {}
192
+ };
193
193
  window.localStorage.setItem(
194
- `data-table-tabs:${z}`,
195
- JSON.stringify(n)
194
+ `data-table-tabs:${j}`,
195
+ JSON.stringify(r)
196
196
  );
197
197
  } catch {
198
198
  }
199
199
  },
200
+ [j, U, E]
201
+ ), [W, Y] = Ie({
202
+ value: v,
203
+ defaultValue: Q ?? G,
204
+ onChange: R
205
+ }), S = de(() => W ?? G, [W, G]), o = u(
206
+ (t) => {
207
+ const a = t(m.current);
208
+ m.current = a, Y(a), K(a, f.current);
209
+ },
200
210
  // eslint-disable-next-line react-hooks/exhaustive-deps
201
- [G, z, $]
202
- ), [ne, S] = ye({
203
- value: ee,
204
- defaultValue: te ?? ((J = C[0]) == null ? void 0 : J.id) ?? "default",
205
- onChange: ae
206
- }), l = ne ?? ((Q = C[0]) == null ? void 0 : Q.id) ?? "default", p = f(C);
207
- p.current = C;
208
- const m = f(l);
209
- m.current = l;
210
- const H = f(!1), T = f(o);
211
- T.current = o;
212
- const K = u(() => {
213
- const t = T.current();
211
+ [Y, K]
212
+ ), [Z, D] = Ie({
213
+ value: re,
214
+ defaultValue: X ?? se ?? ((k = S[0]) == null ? void 0 : k.id) ?? "default",
215
+ onChange: ie
216
+ }), H = Z ?? ((z = S[0]) == null ? void 0 : z.id) ?? "default", m = T(S);
217
+ m.current = S;
218
+ const f = T(H);
219
+ f.current = H;
220
+ const M = T(!1), b = T(i);
221
+ b.current = i;
222
+ const x = u(() => {
223
+ const t = b.current();
214
224
  if (!t) return;
215
- const a = t.getFilter() ?? {}, n = x ? (() => {
216
- var s;
217
- const d = (s = t.getRawApi()) == null ? void 0 : s.getGridOption("quickFilterText");
218
- return typeof d == "string" && d.length > 0 ? d : void 0;
225
+ const a = t.getFilter() ?? {}, r = w ? (() => {
226
+ var d;
227
+ const l = (d = t.getRawApi()) == null ? void 0 : d.getGridOption("quickFilterText");
228
+ return typeof l == "string" && l.length > 0 ? l : void 0;
219
229
  })() : void 0;
220
- y(
221
- (d) => d.map(
222
- (s) => s.id === m.current ? {
223
- ...s,
230
+ o(
231
+ (l) => l.map(
232
+ (d) => d.id === f.current ? {
233
+ ...d,
224
234
  filterModel: a,
225
- ...x ? { quickFilter: n } : {}
226
- } : s
235
+ ...w ? { quickFilter: r } : {}
236
+ } : d
227
237
  )
228
238
  );
229
- }, [x, y]), I = u(
239
+ }, [w, o]), y = u(
230
240
  (t) => {
231
241
  if (!t) return;
232
- const a = T.current();
242
+ const a = b.current();
233
243
  if (a) {
234
- H.current = !0;
244
+ M.current = !0;
235
245
  try {
236
246
  a.setFilter(t.filterModel ?? {});
237
- const n = a.getRawApi();
238
- x && (n == null || n.setGridOption("quickFilterText", t.quickFilter ?? "")), n == null || n.onFilterChanged();
247
+ const r = a.getRawApi();
248
+ w && (r == null || r.setGridOption("quickFilterText", t.quickFilter ?? "")), r == null || r.onFilterChanged();
239
249
  } finally {
240
- H.current = !1;
250
+ M.current = !1;
241
251
  }
242
252
  }
243
253
  },
244
- [x]
254
+ [w]
245
255
  );
246
- be(() => {
256
+ me(() => {
247
257
  let t;
248
258
  const a = () => {
249
- H.current || K();
250
- }, n = (c) => {
251
- const D = c.getRawApi();
252
- if (!D) return !1;
253
- if (D.addEventListener("filterChanged", a), t = () => D.removeEventListener("filterChanged", a), A) {
254
- const F = p.current.find(
255
- (j) => j.id === m.current
259
+ M.current || x();
260
+ }, r = (c) => {
261
+ const L = c.getRawApi();
262
+ if (!L) return !1;
263
+ if (L.addEventListener("filterChanged", a), t = () => L.removeEventListener("filterChanged", a), N) {
264
+ const F = m.current.find(
265
+ (B) => B.id === f.current
256
266
  );
257
- F && (Object.keys(F.filterModel ?? {}).length > 0 || x && F.quickFilter) && I(F);
267
+ F && (Object.keys(F.filterModel ?? {}).length > 0 || w && F.quickFilter) && y(F);
258
268
  }
259
269
  return !0;
260
- }, d = T.current();
261
- if (d && n(d)) return () => t == null ? void 0 : t();
262
- const s = window.setInterval(() => {
263
- const c = T.current();
264
- c && n(c) && window.clearInterval(s);
270
+ }, l = b.current();
271
+ if (l && r(l)) return () => t == null ? void 0 : t();
272
+ const d = window.setInterval(() => {
273
+ const c = b.current();
274
+ c && r(c) && window.clearInterval(d);
265
275
  }, 50);
266
276
  return () => {
267
- window.clearInterval(s), t == null || t();
277
+ window.clearInterval(d), t == null || t();
268
278
  };
269
- }, [A, I, K, x]);
270
- const v = u(
279
+ }, [N, y, x, w]);
280
+ const P = u(
271
281
  (t) => {
272
- if (t === m.current) return;
273
- const a = p.current.find((n) => n.id === t);
274
- a && (K(), S(t), m.current = t, A && I(a));
282
+ if (t === f.current) return;
283
+ const a = m.current.find((r) => r.id === t);
284
+ a && (x(), D(t), f.current = t, K(m.current, t), N && y(a));
275
285
  },
276
- [A, I, K, S]
277
- ), M = u(
286
+ [
287
+ N,
288
+ y,
289
+ x,
290
+ D,
291
+ K
292
+ ]
293
+ ), q = u(
278
294
  (t, a) => {
279
- var s;
280
- if (p.current.length >= O) return m.current;
281
- const n = p.current.length + 1, d = N ? N(n) : {
282
- id: V(),
283
- label: t ?? _("dataTableTabs.newTabName", { number: n }),
295
+ var d;
296
+ if (m.current.length >= V) return f.current;
297
+ const r = m.current.length + 1, l = C ? C(r) : {
298
+ id: _(),
299
+ label: t ?? $("dataTableTabs.newTabName", { number: r }),
284
300
  // New tab = copy of the CURRENT live model, so the grid view does
285
301
  // not jump on add — the natural gesture is "save my current
286
302
  // filter as a tab".
287
- filterModel: a ?? ((s = T.current()) == null ? void 0 : s.getFilter()) ?? {}
303
+ filterModel: a ?? ((d = b.current()) == null ? void 0 : d.getFilter()) ?? {}
288
304
  };
289
- return y((c) => [...c, d]), S(d.id), m.current = d.id, d.id;
305
+ return D(l.id), f.current = l.id, o((c) => [...c, l]), l.id;
290
306
  },
291
- [N, V, O, S, y, _]
292
- ), B = u(
307
+ [C, _, V, D, o, $]
308
+ ), ee = u(
293
309
  (t, a) => {
294
- const n = a.trim();
295
- n && y(
296
- (d) => d.map(
297
- (s) => s.id === t && !s.locked ? { ...s, label: n } : s
310
+ const r = a.trim();
311
+ r && o(
312
+ (l) => l.map(
313
+ (d) => d.id === t && !d.locked ? { ...d, label: r } : d
298
314
  )
299
315
  );
300
316
  },
301
- [y]
302
- ), P = u(
317
+ [o]
318
+ ), te = u(
303
319
  (t) => {
304
- const a = p.current, n = a.find((c) => c.id === t);
305
- if (!n || n.locked || a.length <= 1) return;
306
- const d = a.findIndex((c) => c.id === t), s = a.filter((c) => c.id !== t);
307
- if (y(() => s), m.current === t) {
308
- const c = s[Math.max(0, d - 1)];
309
- c && (S(c.id), m.current = c.id, A && I(c));
320
+ const a = m.current, r = a.find((c) => c.id === t);
321
+ if (!r || r.locked || a.length <= 1) return;
322
+ const l = a.findIndex((c) => c.id === t), d = a.filter((c) => c.id !== t);
323
+ if (o(() => d), f.current === t) {
324
+ const c = d[Math.max(0, l - 1)];
325
+ c && (D(c.id), f.current = c.id, N && y(c));
310
326
  }
311
327
  },
312
- [A, I, S, y]
313
- ), q = u(() => p.current, []), Y = u(() => m.current, []);
328
+ [N, y, D, o]
329
+ ), ae = u(() => m.current, []), oe = u(() => f.current, []);
314
330
  return {
315
- tabs: C,
316
- activeTabId: l,
317
- selectTab: v,
318
- addTab: M,
319
- renameTab: B,
320
- removeTab: P,
321
- atCapacity: C.length >= O,
322
- getTabsSnapshot: q,
323
- getActiveTabIdSnapshot: Y
331
+ tabs: S,
332
+ activeTabId: H,
333
+ selectTab: P,
334
+ addTab: q,
335
+ renameTab: ee,
336
+ removeTab: te,
337
+ atCapacity: S.length >= V,
338
+ getTabsSnapshot: ae,
339
+ getActiveTabIdSnapshot: oe
324
340
  };
325
341
  }
326
- const _e = Ie(
342
+ const _e = ke(
327
343
  [
328
344
  // The strip scrolls horizontally when tabs overflow; focusable tabs inside
329
345
  // (with an inset focus ring, below) satisfy scrollable-region-focusable.
@@ -342,7 +358,7 @@ const _e = Ie(
342
358
  },
343
359
  defaultVariants: { size: "md" }
344
360
  }
345
- ), $e = Ie(
361
+ ), $e = ke(
346
362
  [
347
363
  // `group` so the pointer-only ✕ can reveal on hover/focus/active; `relative`
348
364
  // so that ✕ can be absolutely positioned in the trailing padding (below).
@@ -385,192 +401,194 @@ const _e = Ie(
385
401
  },
386
402
  defaultVariants: { size: "md" }
387
403
  }
388
- ), Ee = "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:[outline-offset:calc(-1*var(--focus-ring-width))]";
389
- function Ue() {
390
- const [r, o] = ue(!1);
391
- return be(() => {
392
- const g = () => o((R) => R || !0), k = () => o((R) => R && !1);
393
- return document.addEventListener("keydown", g, !0), document.addEventListener("pointerdown", k, !0), () => {
394
- document.removeEventListener("keydown", g, !0), document.removeEventListener("pointerdown", k, !0);
404
+ ), Ue = "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:[outline-offset:calc(-1*var(--focus-ring-width))]";
405
+ function Ge() {
406
+ const [n, i] = pe(!1);
407
+ return me(() => {
408
+ const v = () => i((R) => R || !0), A = () => i((R) => R && !1);
409
+ return document.addEventListener("keydown", v, !0), document.addEventListener("pointerdown", A, !0), () => {
410
+ document.removeEventListener("keydown", v, !0), document.removeEventListener("pointerdown", A, !0);
395
411
  };
396
- }, []), r;
412
+ }, []), n;
397
413
  }
398
- const Ge = Se(function({
399
- getTable: o,
400
- tabs: g,
401
- defaultTabs: k,
414
+ const He = De(function({
415
+ getTable: i,
416
+ tabs: v,
417
+ defaultTabs: A,
402
418
  onTabsChange: R,
403
- activeTabId: ee,
404
- defaultActiveTabId: te,
405
- onActiveTabChange: ae,
406
- persistKey: z,
407
- captureQuickFilter: x = !1,
408
- applyOnActivate: A = !0,
409
- allowAdd: O = !0,
410
- allowRename: N = !0,
411
- allowRemove: V = !0,
412
- maxTabs: _ = 8,
413
- createTab: $,
414
- makeTabId: E,
415
- renameOnAdd: W = !0,
416
- size: U = "md",
417
- id: G,
418
- className: C,
419
- "aria-label": y,
420
- children: ne
419
+ activeTabId: re,
420
+ defaultActiveTabId: se,
421
+ onActiveTabChange: ie,
422
+ persistKey: j,
423
+ persistActiveTab: E,
424
+ captureQuickFilter: w = !1,
425
+ applyOnActivate: N = !0,
426
+ allowAdd: V = !0,
427
+ allowRename: C = !0,
428
+ allowRemove: _ = !0,
429
+ maxTabs: $ = 8,
430
+ createTab: U,
431
+ makeTabId: G,
432
+ renameOnAdd: g = !0,
433
+ size: Q = "md",
434
+ id: X,
435
+ className: K,
436
+ "aria-label": W,
437
+ children: Y
421
438
  }, S) {
422
- const { t: l } = ke(), p = f(null), m = ze(p), H = Ue(), T = De(), K = `${T}-panel`, I = `${T}-hint`, {
423
- tabs: v,
424
- activeTabId: M,
425
- selectTab: B,
439
+ const { t: o } = Ae(), Z = T(null), D = Ke(Z), H = Ge(), m = Fe(), f = `${m}-panel`, M = `${m}-hint`, {
440
+ tabs: b,
441
+ activeTabId: x,
442
+ selectTab: y,
426
443
  addTab: P,
427
444
  renameTab: q,
428
- removeTab: Y,
429
- atCapacity: J,
430
- getTabsSnapshot: Q,
431
- getActiveTabIdSnapshot: t
445
+ removeTab: ee,
446
+ atCapacity: te,
447
+ getTabsSnapshot: ae,
448
+ getActiveTabIdSnapshot: oe
432
449
  } = Ve({
433
- getTable: o,
434
- tabs: g,
435
- defaultTabs: k,
450
+ getTable: i,
451
+ tabs: v,
452
+ defaultTabs: A,
436
453
  onTabsChange: R,
437
- activeTabId: ee,
438
- defaultActiveTabId: te,
439
- onActiveTabChange: ae,
440
- persistKey: z,
441
- captureQuickFilter: x,
442
- applyOnActivate: A,
443
- maxTabs: _,
444
- createTab: $,
445
- makeTabId: E
446
- }), [a, n] = ue(null), d = f(null), s = v.find((e) => e.id === a), [c, D] = ue("");
447
- be(() => {
448
- if (!c) return;
449
- const e = setTimeout(() => D(""), 3e3);
454
+ activeTabId: re,
455
+ defaultActiveTabId: se,
456
+ onActiveTabChange: ie,
457
+ persistKey: j,
458
+ persistActiveTab: E,
459
+ captureQuickFilter: w,
460
+ applyOnActivate: N,
461
+ maxTabs: $,
462
+ createTab: U,
463
+ makeTabId: G
464
+ }), [k, z] = pe(null), t = T(null), a = b.find((e) => e.id === k), [r, l] = pe("");
465
+ me(() => {
466
+ if (!r) return;
467
+ const e = setTimeout(() => l(""), 3e3);
450
468
  return () => clearTimeout(e);
451
- }, [c]);
452
- const F = f(/* @__PURE__ */ new Map()), j = u((e) => {
469
+ }, [r]);
470
+ const d = T(/* @__PURE__ */ new Map()), c = u((e) => {
453
471
  requestAnimationFrame(() => {
454
- var i;
455
- (i = F.current.get(e)) == null || i.focus();
472
+ var s;
473
+ (s = d.current.get(e)) == null || s.focus();
456
474
  });
457
- }, []), pe = u(
458
- (e) => N && !e.locked,
459
- [N]
460
- ), re = u(
461
- (e) => V && !e.locked && v.length > 1,
462
- [V, v.length]
463
- ), se = u(
475
+ }, []), L = u(
476
+ (e) => C && !e.locked,
477
+ [C]
478
+ ), F = u(
479
+ (e) => _ && !e.locked && b.length > 1,
480
+ [_, b.length]
481
+ ), B = u(
464
482
  (e) => {
465
- pe(e) && n(e.id);
483
+ L(e) && z(e.id);
466
484
  },
467
- [pe]
485
+ [L]
468
486
  ), Re = u(() => {
469
487
  var e;
470
- if (a) {
471
- const i = ((e = d.current) == null ? void 0 : e.value) ?? "";
472
- i.trim() && (q(a, i), D(
473
- l("dataTableTabs.announce.renamed", { name: i.trim() })
488
+ if (k) {
489
+ const s = ((e = t.current) == null ? void 0 : e.value) ?? "";
490
+ s.trim() && (q(k, s), l(
491
+ o("dataTableTabs.announce.renamed", { name: s.trim() })
474
492
  ));
475
493
  }
476
- n(null);
477
- }, [a, q, l]), me = u(() => n(null), []), Ae = u(() => {
478
- const e = l("dataTableTabs.newTabName", { number: v.length + 1 }), i = P();
479
- D(l("dataTableTabs.announce.added", { name: e })), W && N ? n(i) : j(i);
480
- }, [P, N, j, W, l, v.length]), X = u(
494
+ z(null);
495
+ }, [k, q, o]), fe = u(() => z(null), []), Ne = u(() => {
496
+ const e = o("dataTableTabs.newTabName", { number: b.length + 1 }), s = P();
497
+ l(o("dataTableTabs.announce.added", { name: e })), g && C ? z(s) : c(s);
498
+ }, [P, C, c, g, o, b.length]), J = u(
481
499
  (e) => {
482
- if (!re(e)) return;
483
- const i = v.findIndex((h) => h.id === e.id), w = v.filter((h) => h.id !== e.id)[Math.max(0, i - 1)];
484
- Y(e.id), D(l("dataTableTabs.announce.removed", { name: e.label })), w && j(w.id);
500
+ if (!F(e)) return;
501
+ const s = b.findIndex((h) => h.id === e.id), I = b.filter((h) => h.id !== e.id)[Math.max(0, s - 1)];
502
+ ee(e.id), l(o("dataTableTabs.announce.removed", { name: e.label })), I && c(I.id);
485
503
  },
486
- [re, j, Y, l, v]
487
- ), Ne = u(
488
- (e, i) => {
489
- e.key === "Delete" || e.key === "Backspace" ? (e.preventDefault(), X(i)) : e.key === "F2" && (e.preventDefault(), se(i));
504
+ [F, c, ee, o, b]
505
+ ), Ce = u(
506
+ (e, s) => {
507
+ e.key === "Delete" || e.key === "Backspace" ? (e.preventDefault(), J(s)) : e.key === "F2" && (e.preventDefault(), B(s));
490
508
  },
491
- [X, se]
492
- ), fe = f(B);
493
- fe.current = B;
494
- const ge = f(P);
495
- ge.current = P;
496
- const Te = f(q);
497
- Te.current = q;
498
- const ve = f(X);
499
- ve.current = X;
500
- const he = f({
501
- getTabs: () => Q(),
502
- getActiveTabId: () => t() ?? null,
503
- selectTab: (e) => fe.current(e),
504
- addTab: (e, i) => ge.current(e, i),
505
- renameTab: (e, i) => Te.current(e, i),
509
+ [J, B]
510
+ ), ge = T(y);
511
+ ge.current = y;
512
+ const Te = T(P);
513
+ Te.current = P;
514
+ const ve = T(q);
515
+ ve.current = q;
516
+ const he = T(J);
517
+ he.current = J;
518
+ const ye = T({
519
+ getTabs: () => ae(),
520
+ getActiveTabId: () => oe() ?? null,
521
+ selectTab: (e) => ge.current(e),
522
+ addTab: (e, s) => Te.current(e, s),
523
+ renameTab: (e, s) => ve.current(e, s),
506
524
  removeTab: (e) => {
507
- const i = Q().find((w) => w.id === e);
508
- i && ve.current(i);
525
+ const s = ae().find((I) => I.id === e);
526
+ s && he.current(s);
509
527
  }
510
528
  });
511
- Fe(S, () => he.current, []), Ke(qe, he.current, G);
512
- const Ce = `${T}-tab-${M}`;
513
- return /* @__PURE__ */ L(
529
+ je(S, () => ye.current, []), Me(Le, ye.current, X);
530
+ const Se = `${m}-tab-${x}`;
531
+ return /* @__PURE__ */ O(
514
532
  "div",
515
533
  {
516
- ref: p,
534
+ ref: Z,
517
535
  "data-component": "data-table-tabs",
518
- "data-component-id": G,
519
- className: Z("ds:flex ds:min-w-0 ds:flex-col", C),
536
+ "data-component-id": X,
537
+ className: ne("ds:flex ds:min-w-0 ds:flex-col", K),
520
538
  children: [
521
- /* @__PURE__ */ L(
522
- ce.Root,
539
+ /* @__PURE__ */ O(
540
+ ue.Root,
523
541
  {
524
- open: a !== null,
542
+ open: k !== null,
525
543
  onOpenChange: (e) => {
526
- e || me();
544
+ e || fe();
527
545
  },
528
546
  children: [
529
- /* @__PURE__ */ L(
530
- oe.Root,
547
+ /* @__PURE__ */ O(
548
+ ce.Root,
531
549
  {
532
- value: M,
533
- onValueChange: B,
550
+ value: x,
551
+ onValueChange: y,
534
552
  orientation: "horizontal",
535
553
  activationMode: "manual",
536
- dir: m,
554
+ dir: D,
537
555
  children: [
538
- /* @__PURE__ */ L("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-2xs)]", children: [
539
- /* @__PURE__ */ b(
540
- oe.List,
556
+ /* @__PURE__ */ O("div", { className: "ds:flex ds:items-end ds:gap-[var(--spacing-2xs)]", children: [
557
+ /* @__PURE__ */ p(
558
+ ce.List,
541
559
  {
542
- "aria-label": y ?? l("dataTableTabs.tablistLabel"),
543
- "aria-describedby": I,
544
- className: Z(
545
- _e({ size: U }),
560
+ "aria-label": W ?? o("dataTableTabs.tablistLabel"),
561
+ "aria-describedby": M,
562
+ className: ne(
563
+ _e({ size: Q }),
546
564
  "ds:min-w-0 ds:flex-initial"
547
565
  ),
548
- children: v.map((e, i) => {
549
- const w = /* @__PURE__ */ L(
550
- oe.Trigger,
566
+ children: b.map((e, s) => {
567
+ const I = /* @__PURE__ */ O(
568
+ ce.Trigger,
551
569
  {
552
570
  ref: (h) => {
553
- h ? F.current.set(e.id, h) : F.current.delete(e.id);
571
+ h ? d.current.set(e.id, h) : d.current.delete(e.id);
554
572
  },
555
573
  value: e.id,
556
- id: `${T}-tab-${e.id}`,
557
- "aria-controls": K,
574
+ id: `${m}-tab-${e.id}`,
575
+ "aria-controls": f,
558
576
  "data-tab-id": e.id,
559
- className: Z(
560
- $e({ size: U }),
577
+ className: ne(
578
+ $e({ size: Q }),
561
579
  // The leading tab sits flush in the panel's leading-top
562
580
  // corner: square that corner (and the grid's, below) so
563
581
  // the leading edge is one straight line with no cut-in.
564
- i === 0 && "ds:[border-start-start-radius:0]",
582
+ s === 0 && "ds:[border-start-start-radius:0]",
565
583
  // Keyboard-only focus ring; in pointer mode suppress the
566
584
  // UA default outline that Radix's click-focus would show.
567
- H ? Ee : "ds:focus-visible:outline-none"
585
+ H ? Ue : "ds:focus-visible:outline-none"
568
586
  ),
569
- onKeyDown: (h) => Ne(h, e),
570
- onDoubleClick: () => se(e),
587
+ onKeyDown: (h) => Ce(h, e),
588
+ onDoubleClick: () => B(e),
571
589
  children: [
572
- /* @__PURE__ */ b("span", { className: "ds:max-w-[12rem] ds:truncate", children: e.label }),
573
- re(e) && // Visual-only dismiss — pointer removal fires here;
590
+ /* @__PURE__ */ p("span", { className: "ds:max-w-[12rem] ds:truncate", children: e.label }),
591
+ F(e) && // Visual-only dismiss — pointer removal fires here;
574
592
  // keyboard removal is Delete/Backspace on the trigger.
575
593
  // No role/tabIndex: interactive content inside <button>
576
594
  // is invalid HTML (kit TabsTrigger precedent). Absolutely
@@ -579,11 +597,11 @@ const Ge = Se(function({
579
597
  // space — every tab keeps the same symmetric padding
580
598
  // whether or not it can be removed, and labels never
581
599
  // reflow when it reveals.
582
- /* @__PURE__ */ b(
600
+ /* @__PURE__ */ p(
583
601
  "span",
584
602
  {
585
603
  "aria-hidden": "true",
586
- className: Z(
604
+ className: ne(
587
605
  "ds:absolute ds:end-[var(--spacing-2xs)] ds:top-1/2 ds:-translate-y-1/2",
588
606
  "ds:inline-flex ds:items-center ds:justify-center",
589
607
  "ds:size-3.5 ds:rounded-[var(--radius-sm)]",
@@ -593,60 +611,60 @@ const Ge = Se(function({
593
611
  "ds:hover:bg-muted-foreground/20"
594
612
  ),
595
613
  onPointerDown: (h) => {
596
- h.stopPropagation(), h.preventDefault(), X(e);
614
+ h.stopPropagation(), h.preventDefault(), J(e);
597
615
  },
598
- children: /* @__PURE__ */ b(we, { className: "ds:size-3" })
616
+ children: /* @__PURE__ */ p(we, { className: "ds:size-3" })
599
617
  }
600
618
  )
601
619
  ]
602
620
  },
603
621
  e.id
604
622
  );
605
- return a === e.id ? /* @__PURE__ */ b(ce.Anchor, { asChild: !0, children: w }, e.id) : w;
623
+ return k === e.id ? /* @__PURE__ */ p(ue.Anchor, { asChild: !0, children: I }, e.id) : I;
606
624
  })
607
625
  }
608
626
  ),
609
- O && /* @__PURE__ */ b(
610
- de,
627
+ V && /* @__PURE__ */ p(
628
+ le,
611
629
  {
612
630
  intent: "ghost",
613
631
  size: "sm",
614
- icon: /* @__PURE__ */ b(Me, { "aria-hidden": "true" }),
615
- tooltip: l(J ? "dataTableTabs.maxTabsReached" : "dataTableTabs.addTab"),
616
- disabled: J,
632
+ icon: /* @__PURE__ */ p(Pe, { "aria-hidden": "true" }),
633
+ tooltip: o(te ? "dataTableTabs.maxTabsReached" : "dataTableTabs.addTab"),
634
+ disabled: te,
617
635
  className: "ds:mb-[var(--spacing-2xs)] ds:shrink-0",
618
- onClick: Ae
636
+ onClick: Ne
619
637
  }
620
638
  )
621
639
  ] }),
622
- /* @__PURE__ */ b(
640
+ /* @__PURE__ */ p(
623
641
  "div",
624
642
  {
625
643
  role: "tabpanel",
626
- id: K,
627
- "aria-labelledby": Ce,
644
+ id: f,
645
+ "aria-labelledby": Se,
628
646
  className: "ds:min-w-0 ds:[&_.ag-root-wrapper]:[border-start-start-radius:0]",
629
- children: ne
647
+ children: Y
630
648
  }
631
649
  )
632
650
  ]
633
651
  }
634
652
  ),
635
- /* @__PURE__ */ b(
636
- ce.Content,
653
+ /* @__PURE__ */ p(
654
+ ue.Content,
637
655
  {
638
656
  side: "bottom",
639
657
  align: "start",
640
- "aria-label": l("dataTableTabs.rename.title"),
658
+ "aria-label": o("dataTableTabs.rename.title"),
641
659
  className: "ds:w-64",
642
660
  onCloseAutoFocus: (e) => {
643
- e.preventDefault(), s ? j(s.id) : M && j(M);
661
+ e.preventDefault(), a ? c(a.id) : x && c(x);
644
662
  },
645
663
  onOpenAutoFocus: (e) => {
646
- var i, w;
647
- e.preventDefault(), (i = d.current) == null || i.focus(), (w = d.current) == null || w.select();
664
+ var s, I;
665
+ e.preventDefault(), (s = t.current) == null || s.focus(), (I = t.current) == null || I.select();
648
666
  },
649
- children: /* @__PURE__ */ L(
667
+ children: /* @__PURE__ */ O(
650
668
  "form",
651
669
  {
652
670
  className: "ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
@@ -654,36 +672,36 @@ const Ge = Se(function({
654
672
  e.preventDefault(), Re();
655
673
  },
656
674
  children: [
657
- /* @__PURE__ */ b(
658
- je,
675
+ /* @__PURE__ */ p(
676
+ ze,
659
677
  {
660
- ref: d,
678
+ ref: t,
661
679
  size: "sm",
662
- "aria-label": l("dataTableTabs.rename.inputLabel"),
663
- defaultValue: (s == null ? void 0 : s.label) ?? "",
680
+ "aria-label": o("dataTableTabs.rename.inputLabel"),
681
+ defaultValue: (a == null ? void 0 : a.label) ?? "",
664
682
  maxLength: 60,
665
683
  className: "ds:min-w-0 ds:flex-1"
666
684
  }
667
685
  ),
668
- /* @__PURE__ */ b(
669
- de,
686
+ /* @__PURE__ */ p(
687
+ le,
670
688
  {
671
689
  type: "submit",
672
690
  intent: "ghost",
673
691
  size: "sm",
674
- icon: /* @__PURE__ */ b(Pe, { "aria-hidden": "true" }),
675
- tooltip: l("dataTableTabs.rename.save")
692
+ icon: /* @__PURE__ */ p(qe, { "aria-hidden": "true" }),
693
+ tooltip: o("dataTableTabs.rename.save")
676
694
  }
677
695
  ),
678
- /* @__PURE__ */ b(
679
- de,
696
+ /* @__PURE__ */ p(
697
+ le,
680
698
  {
681
699
  type: "button",
682
700
  intent: "ghost",
683
701
  size: "sm",
684
- icon: /* @__PURE__ */ b(we, { "aria-hidden": "true" }),
685
- tooltip: l("dataTableTabs.rename.cancel"),
686
- onClick: me
702
+ icon: /* @__PURE__ */ p(we, { "aria-hidden": "true" }),
703
+ tooltip: o("dataTableTabs.rename.cancel"),
704
+ onClick: fe
687
705
  }
688
706
  )
689
707
  ]
@@ -694,17 +712,17 @@ const Ge = Se(function({
694
712
  ]
695
713
  }
696
714
  ),
697
- /* @__PURE__ */ b("span", { id: I, className: "ds:sr-only", children: l("dataTableTabs.hint") }),
698
- /* @__PURE__ */ b("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: c })
715
+ /* @__PURE__ */ p("span", { id: M, className: "ds:sr-only", children: o("dataTableTabs.hint") }),
716
+ /* @__PURE__ */ p("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: r })
699
717
  ]
700
718
  }
701
719
  );
702
720
  });
703
- Ge.displayName = "DataTableTabs";
721
+ He.displayName = "DataTableTabs";
704
722
  export {
705
- Ge as D,
723
+ He as D,
706
724
  _e as a,
707
725
  $e as b,
708
- qe as d
726
+ Le as d
709
727
  };
710
- //# sourceMappingURL=data-table-tabs-C1kRUzat.js.map
728
+ //# sourceMappingURL=data-table-tabs-D24qj89A.js.map