@alfadocs/ui-kit 1.9.4 → 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.
- package/dist/_chunks/actions-cell-renderer-BbzCqcld.js +1887 -0
- package/dist/_chunks/{balance-badge-cell-DHTiSFyD.js → balance-badge-cell-DK9wxCxW.js} +447 -426
- package/dist/_chunks/{data-table-tabs-C1kRUzat.js → data-table-tabs-D24qj89A.js} +343 -325
- package/dist/_chunks/{file-manager-lAeBBfZi.js → file-manager-CRxq0UIl.js} +2 -2
- package/dist/agent-catalog.json +1 -1
- package/dist/components/data-table/data-table.d.ts +11 -0
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/data-table/toolbar.d.ts +2 -1
- package/dist/components/data-table-tabs/data-table-tabs.d.ts +2 -0
- package/dist/components/data-table-tabs/index.js +1 -1
- package/dist/components/data-table-tabs/use-data-table-filter-tabs.d.ts +7 -0
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/patient-table/use-responsive-columns.d.ts +7 -4
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/_chunks/actions-cell-renderer-WUTyAes8.js +0 -1795
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import * as
|
|
4
|
-
import { a as
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
import { I as
|
|
7
|
-
import { P as
|
|
8
|
-
import { T as
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as
|
|
11
|
-
import { u as
|
|
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
|
|
14
|
-
import { C as
|
|
15
|
-
const
|
|
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: (
|
|
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: (
|
|
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: (
|
|
48
|
-
|
|
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: (
|
|
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: (
|
|
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: (
|
|
105
|
-
|
|
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: (
|
|
123
|
-
|
|
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
|
|
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
|
|
143
|
-
return typeof
|
|
142
|
+
function be(n) {
|
|
143
|
+
return typeof n == "object" && n !== null && !Array.isArray(n) && Object.getPrototypeOf(n) !== null;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
return !
|
|
147
|
-
(
|
|
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(
|
|
151
|
-
var
|
|
150
|
+
function Ve(n) {
|
|
151
|
+
var k, z;
|
|
152
152
|
const {
|
|
153
|
-
getTable:
|
|
154
|
-
tabs:
|
|
155
|
-
defaultTabs:
|
|
153
|
+
getTable: i,
|
|
154
|
+
tabs: v,
|
|
155
|
+
defaultTabs: A,
|
|
156
156
|
onTabsChange: R,
|
|
157
|
-
activeTabId:
|
|
158
|
-
defaultActiveTabId:
|
|
159
|
-
onActiveTabChange:
|
|
160
|
-
persistKey:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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:
|
|
170
|
+
label: $("dataTableTabs.newTabName", { number: 1 }),
|
|
170
171
|
filterModel: {}
|
|
171
172
|
}
|
|
172
|
-
], []),
|
|
173
|
-
if (!
|
|
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:${
|
|
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
|
|
180
|
+
return Ee(a) ? a : null;
|
|
180
181
|
} catch {
|
|
181
182
|
return null;
|
|
182
183
|
}
|
|
183
|
-
}, []),
|
|
184
|
-
|
|
185
|
-
|
|
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
|
|
188
|
+
const r = {
|
|
189
|
+
v: 1,
|
|
190
|
+
tabs: t,
|
|
191
|
+
...E && a ? { activeTabId: a } : {}
|
|
192
|
+
};
|
|
193
193
|
window.localStorage.setItem(
|
|
194
|
-
`data-table-tabs:${
|
|
195
|
-
JSON.stringify(
|
|
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
|
-
[
|
|
202
|
-
), [
|
|
203
|
-
value:
|
|
204
|
-
defaultValue:
|
|
205
|
-
onChange:
|
|
206
|
-
}),
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
const t =
|
|
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() ?? {},
|
|
216
|
-
var
|
|
217
|
-
const
|
|
218
|
-
return typeof
|
|
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
|
-
|
|
221
|
-
(
|
|
222
|
-
(
|
|
223
|
-
...
|
|
230
|
+
o(
|
|
231
|
+
(l) => l.map(
|
|
232
|
+
(d) => d.id === f.current ? {
|
|
233
|
+
...d,
|
|
224
234
|
filterModel: a,
|
|
225
|
-
...
|
|
226
|
-
} :
|
|
235
|
+
...w ? { quickFilter: r } : {}
|
|
236
|
+
} : d
|
|
227
237
|
)
|
|
228
238
|
);
|
|
229
|
-
}, [
|
|
239
|
+
}, [w, o]), y = u(
|
|
230
240
|
(t) => {
|
|
231
241
|
if (!t) return;
|
|
232
|
-
const a =
|
|
242
|
+
const a = b.current();
|
|
233
243
|
if (a) {
|
|
234
|
-
|
|
244
|
+
M.current = !0;
|
|
235
245
|
try {
|
|
236
246
|
a.setFilter(t.filterModel ?? {});
|
|
237
|
-
const
|
|
238
|
-
|
|
247
|
+
const r = a.getRawApi();
|
|
248
|
+
w && (r == null || r.setGridOption("quickFilterText", t.quickFilter ?? "")), r == null || r.onFilterChanged();
|
|
239
249
|
} finally {
|
|
240
|
-
|
|
250
|
+
M.current = !1;
|
|
241
251
|
}
|
|
242
252
|
}
|
|
243
253
|
},
|
|
244
|
-
[
|
|
254
|
+
[w]
|
|
245
255
|
);
|
|
246
|
-
|
|
256
|
+
me(() => {
|
|
247
257
|
let t;
|
|
248
258
|
const a = () => {
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
253
|
-
if (
|
|
254
|
-
const F =
|
|
255
|
-
(
|
|
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 ||
|
|
267
|
+
F && (Object.keys(F.filterModel ?? {}).length > 0 || w && F.quickFilter) && y(F);
|
|
258
268
|
}
|
|
259
269
|
return !0;
|
|
260
|
-
},
|
|
261
|
-
if (
|
|
262
|
-
const
|
|
263
|
-
const c =
|
|
264
|
-
c &&
|
|
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(
|
|
277
|
+
window.clearInterval(d), t == null || t();
|
|
268
278
|
};
|
|
269
|
-
}, [
|
|
270
|
-
const
|
|
279
|
+
}, [N, y, x, w]);
|
|
280
|
+
const P = u(
|
|
271
281
|
(t) => {
|
|
272
|
-
if (t ===
|
|
273
|
-
const a =
|
|
274
|
-
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
|
-
[
|
|
277
|
-
|
|
286
|
+
[
|
|
287
|
+
N,
|
|
288
|
+
y,
|
|
289
|
+
x,
|
|
290
|
+
D,
|
|
291
|
+
K
|
|
292
|
+
]
|
|
293
|
+
), q = u(
|
|
278
294
|
(t, a) => {
|
|
279
|
-
var
|
|
280
|
-
if (
|
|
281
|
-
const
|
|
282
|
-
id:
|
|
283
|
-
label: t ??
|
|
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 ?? ((
|
|
303
|
+
filterModel: a ?? ((d = b.current()) == null ? void 0 : d.getFilter()) ?? {}
|
|
288
304
|
};
|
|
289
|
-
return
|
|
305
|
+
return D(l.id), f.current = l.id, o((c) => [...c, l]), l.id;
|
|
290
306
|
},
|
|
291
|
-
[
|
|
292
|
-
),
|
|
307
|
+
[C, _, V, D, o, $]
|
|
308
|
+
), ee = u(
|
|
293
309
|
(t, a) => {
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
(
|
|
297
|
-
(
|
|
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
|
-
[
|
|
302
|
-
),
|
|
317
|
+
[o]
|
|
318
|
+
), te = u(
|
|
303
319
|
(t) => {
|
|
304
|
-
const a =
|
|
305
|
-
if (!
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
308
|
-
const c =
|
|
309
|
-
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
|
-
[
|
|
313
|
-
),
|
|
328
|
+
[N, y, D, o]
|
|
329
|
+
), ae = u(() => m.current, []), oe = u(() => f.current, []);
|
|
314
330
|
return {
|
|
315
|
-
tabs:
|
|
316
|
-
activeTabId:
|
|
317
|
-
selectTab:
|
|
318
|
-
addTab:
|
|
319
|
-
renameTab:
|
|
320
|
-
removeTab:
|
|
321
|
-
atCapacity:
|
|
322
|
-
getTabsSnapshot:
|
|
323
|
-
getActiveTabIdSnapshot:
|
|
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 =
|
|
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 =
|
|
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
|
-
),
|
|
389
|
-
function
|
|
390
|
-
const [
|
|
391
|
-
return
|
|
392
|
-
const
|
|
393
|
-
return document.addEventListener("keydown",
|
|
394
|
-
document.removeEventListener("keydown",
|
|
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
|
-
}, []),
|
|
412
|
+
}, []), n;
|
|
397
413
|
}
|
|
398
|
-
const
|
|
399
|
-
getTable:
|
|
400
|
-
tabs:
|
|
401
|
-
defaultTabs:
|
|
414
|
+
const He = De(function({
|
|
415
|
+
getTable: i,
|
|
416
|
+
tabs: v,
|
|
417
|
+
defaultTabs: A,
|
|
402
418
|
onTabsChange: R,
|
|
403
|
-
activeTabId:
|
|
404
|
-
defaultActiveTabId:
|
|
405
|
-
onActiveTabChange:
|
|
406
|
-
persistKey:
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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:
|
|
423
|
-
tabs:
|
|
424
|
-
activeTabId:
|
|
425
|
-
selectTab:
|
|
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:
|
|
429
|
-
atCapacity:
|
|
430
|
-
getTabsSnapshot:
|
|
431
|
-
getActiveTabIdSnapshot:
|
|
445
|
+
removeTab: ee,
|
|
446
|
+
atCapacity: te,
|
|
447
|
+
getTabsSnapshot: ae,
|
|
448
|
+
getActiveTabIdSnapshot: oe
|
|
432
449
|
} = Ve({
|
|
433
|
-
getTable:
|
|
434
|
-
tabs:
|
|
435
|
-
defaultTabs:
|
|
450
|
+
getTable: i,
|
|
451
|
+
tabs: v,
|
|
452
|
+
defaultTabs: A,
|
|
436
453
|
onTabsChange: R,
|
|
437
|
-
activeTabId:
|
|
438
|
-
defaultActiveTabId:
|
|
439
|
-
onActiveTabChange:
|
|
440
|
-
persistKey:
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
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
|
-
}, [
|
|
452
|
-
const
|
|
469
|
+
}, [r]);
|
|
470
|
+
const d = T(/* @__PURE__ */ new Map()), c = u((e) => {
|
|
453
471
|
requestAnimationFrame(() => {
|
|
454
|
-
var
|
|
455
|
-
(
|
|
472
|
+
var s;
|
|
473
|
+
(s = d.current.get(e)) == null || s.focus();
|
|
456
474
|
});
|
|
457
|
-
}, []),
|
|
458
|
-
(e) =>
|
|
459
|
-
[
|
|
460
|
-
),
|
|
461
|
-
(e) =>
|
|
462
|
-
[
|
|
463
|
-
),
|
|
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
|
-
|
|
483
|
+
L(e) && z(e.id);
|
|
466
484
|
},
|
|
467
|
-
[
|
|
485
|
+
[L]
|
|
468
486
|
), Re = u(() => {
|
|
469
487
|
var e;
|
|
470
|
-
if (
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
|
|
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
|
-
|
|
477
|
-
}, [
|
|
478
|
-
const e =
|
|
479
|
-
|
|
480
|
-
}, [P,
|
|
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 (!
|
|
483
|
-
const
|
|
484
|
-
|
|
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
|
-
[
|
|
487
|
-
),
|
|
488
|
-
(e,
|
|
489
|
-
e.key === "Delete" || e.key === "Backspace" ? (e.preventDefault(),
|
|
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
|
-
[
|
|
492
|
-
),
|
|
493
|
-
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
getTabs: () =>
|
|
502
|
-
getActiveTabId: () =>
|
|
503
|
-
selectTab: (e) =>
|
|
504
|
-
addTab: (e,
|
|
505
|
-
renameTab: (e,
|
|
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
|
|
508
|
-
|
|
525
|
+
const s = ae().find((I) => I.id === e);
|
|
526
|
+
s && he.current(s);
|
|
509
527
|
}
|
|
510
528
|
});
|
|
511
|
-
|
|
512
|
-
const
|
|
513
|
-
return /* @__PURE__ */
|
|
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:
|
|
534
|
+
ref: Z,
|
|
517
535
|
"data-component": "data-table-tabs",
|
|
518
|
-
"data-component-id":
|
|
519
|
-
className:
|
|
536
|
+
"data-component-id": X,
|
|
537
|
+
className: ne("ds:flex ds:min-w-0 ds:flex-col", K),
|
|
520
538
|
children: [
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
|
|
539
|
+
/* @__PURE__ */ O(
|
|
540
|
+
ue.Root,
|
|
523
541
|
{
|
|
524
|
-
open:
|
|
542
|
+
open: k !== null,
|
|
525
543
|
onOpenChange: (e) => {
|
|
526
|
-
e ||
|
|
544
|
+
e || fe();
|
|
527
545
|
},
|
|
528
546
|
children: [
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
|
|
547
|
+
/* @__PURE__ */ O(
|
|
548
|
+
ce.Root,
|
|
531
549
|
{
|
|
532
|
-
value:
|
|
533
|
-
onValueChange:
|
|
550
|
+
value: x,
|
|
551
|
+
onValueChange: y,
|
|
534
552
|
orientation: "horizontal",
|
|
535
553
|
activationMode: "manual",
|
|
536
|
-
dir:
|
|
554
|
+
dir: D,
|
|
537
555
|
children: [
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
|
|
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":
|
|
543
|
-
"aria-describedby":
|
|
544
|
-
className:
|
|
545
|
-
_e({ size:
|
|
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:
|
|
549
|
-
const
|
|
550
|
-
|
|
566
|
+
children: b.map((e, s) => {
|
|
567
|
+
const I = /* @__PURE__ */ O(
|
|
568
|
+
ce.Trigger,
|
|
551
569
|
{
|
|
552
570
|
ref: (h) => {
|
|
553
|
-
h ?
|
|
571
|
+
h ? d.current.set(e.id, h) : d.current.delete(e.id);
|
|
554
572
|
},
|
|
555
573
|
value: e.id,
|
|
556
|
-
id: `${
|
|
557
|
-
"aria-controls":
|
|
574
|
+
id: `${m}-tab-${e.id}`,
|
|
575
|
+
"aria-controls": f,
|
|
558
576
|
"data-tab-id": e.id,
|
|
559
|
-
className:
|
|
560
|
-
$e({ size:
|
|
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
|
-
|
|
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 ?
|
|
585
|
+
H ? Ue : "ds:focus-visible:outline-none"
|
|
568
586
|
),
|
|
569
|
-
onKeyDown: (h) =>
|
|
570
|
-
onDoubleClick: () =>
|
|
587
|
+
onKeyDown: (h) => Ce(h, e),
|
|
588
|
+
onDoubleClick: () => B(e),
|
|
571
589
|
children: [
|
|
572
|
-
/* @__PURE__ */
|
|
573
|
-
|
|
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__ */
|
|
600
|
+
/* @__PURE__ */ p(
|
|
583
601
|
"span",
|
|
584
602
|
{
|
|
585
603
|
"aria-hidden": "true",
|
|
586
|
-
className:
|
|
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(),
|
|
614
|
+
h.stopPropagation(), h.preventDefault(), J(e);
|
|
597
615
|
},
|
|
598
|
-
children: /* @__PURE__ */
|
|
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
|
|
623
|
+
return k === e.id ? /* @__PURE__ */ p(ue.Anchor, { asChild: !0, children: I }, e.id) : I;
|
|
606
624
|
})
|
|
607
625
|
}
|
|
608
626
|
),
|
|
609
|
-
|
|
610
|
-
|
|
627
|
+
V && /* @__PURE__ */ p(
|
|
628
|
+
le,
|
|
611
629
|
{
|
|
612
630
|
intent: "ghost",
|
|
613
631
|
size: "sm",
|
|
614
|
-
icon: /* @__PURE__ */
|
|
615
|
-
tooltip:
|
|
616
|
-
disabled:
|
|
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:
|
|
636
|
+
onClick: Ne
|
|
619
637
|
}
|
|
620
638
|
)
|
|
621
639
|
] }),
|
|
622
|
-
/* @__PURE__ */
|
|
640
|
+
/* @__PURE__ */ p(
|
|
623
641
|
"div",
|
|
624
642
|
{
|
|
625
643
|
role: "tabpanel",
|
|
626
|
-
id:
|
|
627
|
-
"aria-labelledby":
|
|
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:
|
|
647
|
+
children: Y
|
|
630
648
|
}
|
|
631
649
|
)
|
|
632
650
|
]
|
|
633
651
|
}
|
|
634
652
|
),
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
|
|
653
|
+
/* @__PURE__ */ p(
|
|
654
|
+
ue.Content,
|
|
637
655
|
{
|
|
638
656
|
side: "bottom",
|
|
639
657
|
align: "start",
|
|
640
|
-
"aria-label":
|
|
658
|
+
"aria-label": o("dataTableTabs.rename.title"),
|
|
641
659
|
className: "ds:w-64",
|
|
642
660
|
onCloseAutoFocus: (e) => {
|
|
643
|
-
e.preventDefault(),
|
|
661
|
+
e.preventDefault(), a ? c(a.id) : x && c(x);
|
|
644
662
|
},
|
|
645
663
|
onOpenAutoFocus: (e) => {
|
|
646
|
-
var
|
|
647
|
-
e.preventDefault(), (
|
|
664
|
+
var s, I;
|
|
665
|
+
e.preventDefault(), (s = t.current) == null || s.focus(), (I = t.current) == null || I.select();
|
|
648
666
|
},
|
|
649
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
658
|
-
|
|
675
|
+
/* @__PURE__ */ p(
|
|
676
|
+
ze,
|
|
659
677
|
{
|
|
660
|
-
ref:
|
|
678
|
+
ref: t,
|
|
661
679
|
size: "sm",
|
|
662
|
-
"aria-label":
|
|
663
|
-
defaultValue: (
|
|
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__ */
|
|
669
|
-
|
|
686
|
+
/* @__PURE__ */ p(
|
|
687
|
+
le,
|
|
670
688
|
{
|
|
671
689
|
type: "submit",
|
|
672
690
|
intent: "ghost",
|
|
673
691
|
size: "sm",
|
|
674
|
-
icon: /* @__PURE__ */
|
|
675
|
-
tooltip:
|
|
692
|
+
icon: /* @__PURE__ */ p(qe, { "aria-hidden": "true" }),
|
|
693
|
+
tooltip: o("dataTableTabs.rename.save")
|
|
676
694
|
}
|
|
677
695
|
),
|
|
678
|
-
/* @__PURE__ */
|
|
679
|
-
|
|
696
|
+
/* @__PURE__ */ p(
|
|
697
|
+
le,
|
|
680
698
|
{
|
|
681
699
|
type: "button",
|
|
682
700
|
intent: "ghost",
|
|
683
701
|
size: "sm",
|
|
684
|
-
icon: /* @__PURE__ */
|
|
685
|
-
tooltip:
|
|
686
|
-
onClick:
|
|
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__ */
|
|
698
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
721
|
+
He.displayName = "DataTableTabs";
|
|
704
722
|
export {
|
|
705
|
-
|
|
723
|
+
He as D,
|
|
706
724
|
_e as a,
|
|
707
725
|
$e as b,
|
|
708
|
-
|
|
726
|
+
Le as d
|
|
709
727
|
};
|
|
710
|
-
//# sourceMappingURL=data-table-tabs-
|
|
728
|
+
//# sourceMappingURL=data-table-tabs-D24qj89A.js.map
|