@lax-wp/design-system 0.14.6 → 0.14.8
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/components/data-display/infinite-table/body/rows/row.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/rows/row.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/rows/row.es.js +77 -75
- package/dist/components/data-display/infinite-table/body/rows/row.es.js.map +1 -1
- package/dist/components/navigation/tabs/Tabs.cjs.js +1 -1
- package/dist/components/navigation/tabs/Tabs.cjs.js.map +1 -1
- package/dist/components/navigation/tabs/Tabs.es.js +126 -126
- package/dist/components/navigation/tabs/Tabs.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as n, jsxs as ke } from "react/jsx-runtime";
|
|
2
|
-
import { useSensors as Rt, useSensor as Ze, MouseSensor as
|
|
2
|
+
import { useSensors as Rt, useSensor as Ze, MouseSensor as Wt, TouchSensor as Pt, DndContext as Ft, closestCenter as zt } from "@dnd-kit/core";
|
|
3
3
|
import { SortableContext as Bt, horizontalListSortingStrategy as jt, arrayMove as Ke } from "@dnd-kit/sortable";
|
|
4
4
|
import { Dropdown as ye } from "antd";
|
|
5
5
|
import l from "../../../_virtual/index.es.js";
|
|
@@ -17,13 +17,13 @@ import Ce from "../../tooltip/Tooltip.es.js";
|
|
|
17
17
|
import { EditIcon as Xt } from "../../icons/EditIcon.es.js";
|
|
18
18
|
import { toast as Zt } from "react-toastify";
|
|
19
19
|
import { TabSwitch as Se } from "./TabSwitch.es.js";
|
|
20
|
-
import { PinIcon as
|
|
20
|
+
import { PinIcon as oe, ArrowOutwardIcon as Kt, ArrowUpwardIcon as en, ArrowDownwardIcon as tn, ContentCopyIcon as nn, VisibilityOffIcon as on, VisibilityIcon as sn, UnpinFilledIcon as an, DeleteIcon as rn } from "../../icon/icons.generated.es.js";
|
|
21
21
|
import { SortableTab as tt } from "./SortableTab.es.js";
|
|
22
22
|
import { DropableWrapper as ln } from "./DropableWrapper.es.js";
|
|
23
23
|
import { MoreButton as cn } from "./MoreButton.es.js";
|
|
24
24
|
import { TabOptions as dn } from "./TabOptions.es.js";
|
|
25
25
|
import { TabDragOverlay as un } from "./TabDragOverlay.es.js";
|
|
26
|
-
const mn = () => Math.random().toString(16).slice(2, 13),
|
|
26
|
+
const mn = () => Math.random().toString(16).slice(2, 13), se = [
|
|
27
27
|
"[&_.ant-dropdown-menu-item]:!outline-none",
|
|
28
28
|
"[&_.ant-dropdown-menu-submenu-title]:!outline-none",
|
|
29
29
|
"[&_.ant-dropdown-menu-item:focus-visible_.option-button-inner]:ring-2",
|
|
@@ -55,24 +55,24 @@ const Ie = (T) => {
|
|
|
55
55
|
PIN: "Pin",
|
|
56
56
|
UNPIN: "Unpin",
|
|
57
57
|
EDIT: "Edit"
|
|
58
|
-
},
|
|
58
|
+
}, Fn = ({
|
|
59
59
|
variant: T = "default",
|
|
60
60
|
tabs: _ = [],
|
|
61
|
-
activeTab:
|
|
61
|
+
activeTab: i,
|
|
62
62
|
onTabClick: nt,
|
|
63
63
|
suffixRecord: $,
|
|
64
|
-
isLoading:
|
|
64
|
+
isLoading: ot,
|
|
65
65
|
size: O = "md",
|
|
66
66
|
className: ve,
|
|
67
67
|
draggable: E = !1,
|
|
68
68
|
showAllItems: A = !1,
|
|
69
|
-
copyLink:
|
|
69
|
+
copyLink: st = !1,
|
|
70
70
|
isDisabled: at = !1,
|
|
71
71
|
color: ae = "light",
|
|
72
|
-
iconsOnly:
|
|
73
|
-
tabIcons:
|
|
74
|
-
height:
|
|
75
|
-
fullWidth:
|
|
72
|
+
iconsOnly: it = !1,
|
|
73
|
+
tabIcons: ie = {},
|
|
74
|
+
height: rt = "h-6",
|
|
75
|
+
fullWidth: re = !1,
|
|
76
76
|
fitContentWidth: lt = !1,
|
|
77
77
|
disableAnimation: ct = !1,
|
|
78
78
|
onEdit: _e,
|
|
@@ -90,29 +90,29 @@ const Ie = (T) => {
|
|
|
90
90
|
linkConfig: m,
|
|
91
91
|
showTabOptions: pt = !0
|
|
92
92
|
}) => {
|
|
93
|
-
const x = Yt(), Le = S ? x?.getTabSettings(S) : void 0, le = dt ?? Le?.tab_items, Y = ut ?? Le?.tab_options, [ce, ft] = w(""), [I, J] = w(!1), [U,
|
|
93
|
+
const x = Yt(), Le = S ? x?.getTabSettings(S) : void 0, le = dt ?? Le?.tab_items, Y = ut ?? Le?.tab_options, [ce, ft] = w(""), [I, J] = w(!1), [U, ht] = w(0), [d, de] = w([]), [q, bt] = w([]), [xt, Q] = w(null), [D, X] = w(null), [gt, Me] = w(!1), [He, Ue] = w(
|
|
94
94
|
Y ?? At
|
|
95
|
-
), [ue, wt] = w(""), [Re, kt] = w("contains"), { showCounts: k, lockOrder: R, sortOrder: me } = He, { t: u } = $t(), Z = Te(null), yt = Te(null),
|
|
96
|
-
Ze(
|
|
97
|
-
Ze(
|
|
95
|
+
), [ue, wt] = w(""), [Re, kt] = w("contains"), { showCounts: k, lockOrder: R, sortOrder: me } = He, { t: u } = $t(), Z = Te(null), yt = Te(null), We = Te(U), { measureText: W } = Jt(), P = M(() => mn(), []), Tt = Rt(
|
|
96
|
+
Ze(Wt, { activationConstraint: { distance: 5 } }),
|
|
97
|
+
Ze(Pt, { activationConstraint: { delay: 300, tolerance: 5 } })
|
|
98
98
|
), p = M(() => $ && Object.fromEntries(
|
|
99
99
|
Object.entries($).map(([e, t]) => [
|
|
100
100
|
e,
|
|
101
101
|
Gt(t)
|
|
102
102
|
])
|
|
103
|
-
), [$]),
|
|
104
|
-
() =>
|
|
103
|
+
), [$]), Pe = M(() => q.filter(({ is_hidden: e }) => !e), [q]), V = M(() => q.filter(({ is_hidden: e }) => e), [q]), Fe = M(
|
|
104
|
+
() => Pe.filter(({ name: e }) => {
|
|
105
105
|
if (!ue) return !0;
|
|
106
|
-
const t = (e ?? "").toLowerCase(),
|
|
107
|
-
return Re === "contains" ? t.includes(
|
|
106
|
+
const t = (e ?? "").toLowerCase(), o = ue.toLowerCase();
|
|
107
|
+
return Re === "contains" ? t.includes(o) : !t.includes(o);
|
|
108
108
|
}),
|
|
109
|
-
[
|
|
109
|
+
[Pe, ue, Re]
|
|
110
110
|
), a = M(
|
|
111
|
-
() => [...
|
|
112
|
-
[
|
|
113
|
-
), Ct = U < a.length, K = A ? a.length : Ct ? U : a.length,
|
|
114
|
-
|
|
115
|
-
const
|
|
111
|
+
() => [...Fe].sort((e, t) => e.is_pinned && !t.is_pinned ? -1 : !e.is_pinned && t.is_pinned ? 1 : 0),
|
|
112
|
+
[Fe]
|
|
113
|
+
), Ct = U < a.length, K = A ? a.length : Ct ? U : a.length, ze = a.findIndex((e) => e.name === i) >= K, Be = d.length - K - (ze ? 1 : 0);
|
|
114
|
+
We.current = U;
|
|
115
|
+
const F = v(
|
|
116
116
|
(e) => {
|
|
117
117
|
de(e), Ve?.(e), S && x?.persistTabSettings && x.persistTabSettings({ tab_type: S, tab_items: e });
|
|
118
118
|
},
|
|
@@ -125,42 +125,42 @@ const Ie = (T) => {
|
|
|
125
125
|
), je = (e) => e.is_pinned ? 32 : 0, pe = v(
|
|
126
126
|
(e) => {
|
|
127
127
|
if (!e) return;
|
|
128
|
-
const t = E ? 30 : 0,
|
|
128
|
+
const t = E ? 30 : 0, o = k ? 190 : 84, r = O === "sm" ? 4 : 8, s = 32;
|
|
129
129
|
let f = 0, te = 0, g = 0;
|
|
130
|
-
const
|
|
131
|
-
for (let
|
|
132
|
-
const N = a[
|
|
130
|
+
const h = e - (H?.width || 0) - t, Ye = We.current, Je = Ye < a.length, qe = V.length > 0;
|
|
131
|
+
for (let b = 0; b < a.length; b++) {
|
|
132
|
+
const N = a[b], ne = p?.[N.name] ? String(p?.[N.name]) : "", xe = k && ne ? W(ne, {
|
|
133
133
|
fontSize: "16px",
|
|
134
134
|
fontWeight: "500",
|
|
135
135
|
fontFamily: "Inter, system-ui, -apple-system, sans-serif"
|
|
136
|
-
}) + 18 + 2 : 0, ge =
|
|
136
|
+
}) + 18 + 2 : 0, ge = W(N?.name || "", {
|
|
137
137
|
fontSize: "16px",
|
|
138
138
|
fontWeight: "600",
|
|
139
139
|
fontFamily: "Inter, system-ui, -apple-system, sans-serif"
|
|
140
|
-
}), we = C ? je(N) : 0, Xe = ge + xe +
|
|
141
|
-
if (N.name ===
|
|
142
|
-
g =
|
|
140
|
+
}), we = C ? je(N) : 0, Xe = ge + xe + s + r + we;
|
|
141
|
+
if (N.name === i && (te = Xe), f += Xe, h > f + (Je || qe ? o : 0) + b * 25)
|
|
142
|
+
g = b + 1;
|
|
143
143
|
else
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
146
146
|
const Qe = a.length - g;
|
|
147
147
|
if (Qe + V.length === 1 && V.length === 0 && Qe === 1 && g < a.length) {
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
150
|
-
const N = p?.[
|
|
148
|
+
const b = a[g];
|
|
149
|
+
if (b) {
|
|
150
|
+
const N = p?.[b.name] ? String(p?.[b.name]) : "", ne = k && N ? W(N, {
|
|
151
151
|
fontSize: "16px",
|
|
152
152
|
fontWeight: "500",
|
|
153
153
|
fontFamily: "Inter, system-ui, -apple-system, sans-serif"
|
|
154
|
-
}) + 18 + 2 : 0, xe =
|
|
154
|
+
}) + 18 + 2 : 0, xe = W(b?.name || "", {
|
|
155
155
|
fontSize: "16px",
|
|
156
156
|
fontWeight: "600",
|
|
157
157
|
fontFamily: "Inter, system-ui, -apple-system, sans-serif"
|
|
158
|
-
}), ge = C ? je(
|
|
159
|
-
|
|
158
|
+
}), ge = C ? je(b) : 0, we = xe + ne + s + r + ge;
|
|
159
|
+
h >= f + we && (g += 1);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
const Ut = A ? a.length : g;
|
|
163
|
-
a.findIndex((
|
|
163
|
+
a.findIndex((b) => b.name === i) >= Ut && (f += te, h < f + (Je || qe ? o : 0) && (g = Math.max(g - 1, 0))), g !== Ye && ht(g);
|
|
164
164
|
},
|
|
165
165
|
[
|
|
166
166
|
a,
|
|
@@ -169,11 +169,11 @@ const Ie = (T) => {
|
|
|
169
169
|
C,
|
|
170
170
|
p,
|
|
171
171
|
H?.width,
|
|
172
|
-
|
|
172
|
+
i,
|
|
173
173
|
O,
|
|
174
174
|
E,
|
|
175
175
|
V.length,
|
|
176
|
-
|
|
176
|
+
W
|
|
177
177
|
]
|
|
178
178
|
), fe = v(
|
|
179
179
|
() => {
|
|
@@ -186,53 +186,53 @@ const Ie = (T) => {
|
|
|
186
186
|
return new URLSearchParams();
|
|
187
187
|
},
|
|
188
188
|
[m, x]
|
|
189
|
-
),
|
|
189
|
+
), he = v(
|
|
190
190
|
(e, t) => (m && (t === m.defaultLink ? e.delete(m.key) : e.set(m.key, t), m.onResolve?.(e)), e),
|
|
191
191
|
[m]
|
|
192
|
-
),
|
|
193
|
-
(e) => m ? `?${
|
|
194
|
-
[
|
|
195
|
-
), Nt =
|
|
192
|
+
), z = v(
|
|
193
|
+
(e) => m ? `?${he(fe(), e).toString()}` : void 0,
|
|
194
|
+
[he, fe, m]
|
|
195
|
+
), Nt = st || !!m, It = v(
|
|
196
196
|
async (e) => {
|
|
197
|
-
const t =
|
|
198
|
-
await navigator.clipboard.writeText(
|
|
197
|
+
const t = z(e), o = typeof window < "u" ? window.location.origin : "", r = typeof window < "u" ? window.location.pathname : "", s = t ? `${o}${r}${t}` : `${o}${r}`;
|
|
198
|
+
await navigator.clipboard.writeText(s), Zt.success(u("Link copied to clipboard"), {
|
|
199
199
|
toastId: "Link copied to clipboard"
|
|
200
|
-
}), Ee?.(e,
|
|
200
|
+
}), Ee?.(e, s);
|
|
201
201
|
},
|
|
202
|
-
[
|
|
202
|
+
[z, u, Ee]
|
|
203
203
|
), B = (e) => {
|
|
204
204
|
if (J(!1), nt?.(e), m && x?.navigate) {
|
|
205
|
-
const t =
|
|
205
|
+
const t = he(fe(), e);
|
|
206
206
|
x.navigate(`?${t.toString()}`);
|
|
207
207
|
}
|
|
208
208
|
}, $e = (e) => {
|
|
209
209
|
if (a.length <= 1) return;
|
|
210
210
|
const t = d.map(
|
|
211
|
-
(
|
|
212
|
-
),
|
|
213
|
-
B(a[
|
|
211
|
+
(s) => s.name === e ? { ...s, is_hidden: !0 } : s
|
|
212
|
+
), o = a.findIndex((s) => s.name === e), r = o === 0 ? 1 : o - 1;
|
|
213
|
+
B(a[r].name), F(t);
|
|
214
214
|
}, vt = (e) => {
|
|
215
215
|
const t = d.map(
|
|
216
|
-
(
|
|
216
|
+
(o) => o.name === e ? { ...o, is_hidden: !1 } : o
|
|
217
217
|
);
|
|
218
|
-
J(!1),
|
|
218
|
+
J(!1), F(t);
|
|
219
219
|
}, ee = (e) => {
|
|
220
220
|
if (!C) return;
|
|
221
221
|
const t = d.map(
|
|
222
|
-
(
|
|
222
|
+
(o) => o.name === e ? { ...o, is_pinned: !o.is_pinned } : o
|
|
223
223
|
);
|
|
224
|
-
|
|
224
|
+
F(t);
|
|
225
225
|
}, Ae = (e, t) => {
|
|
226
|
-
const
|
|
227
|
-
|
|
226
|
+
const o = d.findIndex(({ name: s }) => s === e), r = t === "left" ? o - (d[o - 1]?.name === i ? 2 : 1) : o + 1;
|
|
227
|
+
F(Ke(d, o, r));
|
|
228
228
|
}, Ge = () => J(!I), _t = (e) => X(e.active.id), Ot = (e) => {
|
|
229
|
-
const { active: t, over:
|
|
230
|
-
if (
|
|
229
|
+
const { active: t, over: o } = e;
|
|
230
|
+
if (o?.id === "more-tabs") {
|
|
231
231
|
$e(t.id), X(null), Q(null);
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
-
const
|
|
235
|
-
|
|
234
|
+
const r = d.findIndex(({ name: f }) => f === t.id), s = d.findIndex(({ name: f }) => f === o?.id);
|
|
235
|
+
F(Ke(d, r, s)), X(null), Q(null);
|
|
236
236
|
}, Et = () => {
|
|
237
237
|
X(null), Q(null);
|
|
238
238
|
}, Dt = (e) => {
|
|
@@ -240,13 +240,13 @@ const Ie = (T) => {
|
|
|
240
240
|
}, Vt = () => {
|
|
241
241
|
}, Lt = (e, t) => {
|
|
242
242
|
wt(e), kt(t);
|
|
243
|
-
},
|
|
244
|
-
const
|
|
243
|
+
}, be = (e, t = !1, o = !1) => {
|
|
244
|
+
const s = d.find((h) => h.name === e)?.is_pinned, f = [
|
|
245
245
|
{
|
|
246
246
|
label: /* @__PURE__ */ n(
|
|
247
247
|
y,
|
|
248
248
|
{
|
|
249
|
-
icon: /* @__PURE__ */ n(Kt, {
|
|
249
|
+
icon: /* @__PURE__ */ n(Kt, { className: "w-icon h-icon text-inherit dark:text-inherit" }),
|
|
250
250
|
text: u("Select Tab"),
|
|
251
251
|
className: "text-black-900 dark:text-white"
|
|
252
252
|
}
|
|
@@ -258,7 +258,7 @@ const Ie = (T) => {
|
|
|
258
258
|
label: /* @__PURE__ */ n(
|
|
259
259
|
y,
|
|
260
260
|
{
|
|
261
|
-
icon: /* @__PURE__ */ n(en, {
|
|
261
|
+
icon: /* @__PURE__ */ n(en, { className: "w-icon h-icon text-inherit dark:text-inherit" }),
|
|
262
262
|
text: u("Move Up"),
|
|
263
263
|
isDisabled: R,
|
|
264
264
|
className: "text-black-900 dark:text-white"
|
|
@@ -272,7 +272,7 @@ const Ie = (T) => {
|
|
|
272
272
|
label: /* @__PURE__ */ n(
|
|
273
273
|
y,
|
|
274
274
|
{
|
|
275
|
-
icon: /* @__PURE__ */ n(tn, {
|
|
275
|
+
icon: /* @__PURE__ */ n(tn, { className: "w-icon h-icon text-inherit dark:text-inherit" }),
|
|
276
276
|
text: u("Move Down"),
|
|
277
277
|
isDisabled: R,
|
|
278
278
|
className: "text-black-900 dark:text-white"
|
|
@@ -286,7 +286,7 @@ const Ie = (T) => {
|
|
|
286
286
|
label: /* @__PURE__ */ n(
|
|
287
287
|
y,
|
|
288
288
|
{
|
|
289
|
-
icon: /* @__PURE__ */ n(nn, {
|
|
289
|
+
icon: /* @__PURE__ */ n(nn, { className: "w-icon h-icon text-inherit dark:text-inherit" }),
|
|
290
290
|
text: u("Copy Link"),
|
|
291
291
|
className: "text-black-900 dark:text-white"
|
|
292
292
|
}
|
|
@@ -298,7 +298,7 @@ const Ie = (T) => {
|
|
|
298
298
|
label: /* @__PURE__ */ n(
|
|
299
299
|
y,
|
|
300
300
|
{
|
|
301
|
-
icon: /* @__PURE__ */ n(
|
|
301
|
+
icon: /* @__PURE__ */ n(on, { className: "w-icon h-icon text-inherit dark:text-inherit" }),
|
|
302
302
|
text: u("Hide"),
|
|
303
303
|
className: "text-black-900 dark:text-white"
|
|
304
304
|
}
|
|
@@ -310,7 +310,7 @@ const Ie = (T) => {
|
|
|
310
310
|
label: /* @__PURE__ */ n(
|
|
311
311
|
y,
|
|
312
312
|
{
|
|
313
|
-
icon: /* @__PURE__ */ n(
|
|
313
|
+
icon: /* @__PURE__ */ n(sn, { className: "w-icon h-icon text-inherit dark:text-inherit" }),
|
|
314
314
|
text: u("Unhide"),
|
|
315
315
|
className: "text-black-900 dark:text-white"
|
|
316
316
|
}
|
|
@@ -322,13 +322,13 @@ const Ie = (T) => {
|
|
|
322
322
|
label: /* @__PURE__ */ n(
|
|
323
323
|
y,
|
|
324
324
|
{
|
|
325
|
-
icon:
|
|
326
|
-
text: u(
|
|
325
|
+
icon: s ? /* @__PURE__ */ n(an, { className: "w-icon h-icon rotate-12 text-inherit dark:text-inherit" }) : /* @__PURE__ */ n(oe, { className: "w-icon h-icon rotate-45 text-inherit dark:text-inherit" }),
|
|
326
|
+
text: u(s ? "Unpin" : "Pin"),
|
|
327
327
|
className: "text-black-900 dark:text-white",
|
|
328
328
|
notVisible: !C
|
|
329
329
|
}
|
|
330
330
|
),
|
|
331
|
-
key:
|
|
331
|
+
key: s ? c.UNPIN : c.PIN,
|
|
332
332
|
onClick: () => ee(e)
|
|
333
333
|
},
|
|
334
334
|
{
|
|
@@ -336,7 +336,7 @@ const Ie = (T) => {
|
|
|
336
336
|
y,
|
|
337
337
|
{
|
|
338
338
|
className: "text-black-900 dark:text-white",
|
|
339
|
-
icon: /* @__PURE__ */ n(Xt, {}),
|
|
339
|
+
icon: /* @__PURE__ */ n(Xt, { className: "w-icon h-icon" }),
|
|
340
340
|
text: u("Edit"),
|
|
341
341
|
notVisible: !_e
|
|
342
342
|
}
|
|
@@ -349,7 +349,7 @@ const Ie = (T) => {
|
|
|
349
349
|
y,
|
|
350
350
|
{
|
|
351
351
|
className: "text-error-600 dark:text-error-600",
|
|
352
|
-
icon: /* @__PURE__ */ n(rn, {
|
|
352
|
+
icon: /* @__PURE__ */ n(rn, { className: "w-icon h-icon text-error-600 dark:text-error-600" }),
|
|
353
353
|
text: u("Delete"),
|
|
354
354
|
notVisible: !Oe
|
|
355
355
|
}
|
|
@@ -359,8 +359,8 @@ const Ie = (T) => {
|
|
|
359
359
|
}
|
|
360
360
|
], te = [c.HIDE, c.UNHIDE], g = [c.SELECT, c.MOVE_LEFT, c.MOVE_RIGHT, c.UNHIDE];
|
|
361
361
|
return f.filter(
|
|
362
|
-
(
|
|
363
|
-
).filter((
|
|
362
|
+
(h) => t ? h.key === c.UNHIDE : o ? !te.includes(h.key) : !g.includes(h.key)
|
|
363
|
+
).filter((h) => Nt ? !0 : h.key !== c.COPY_LINK).filter((h) => a.length === 1 ? h.key !== c.HIDE : !0);
|
|
364
364
|
}, L = (e, t) => ({
|
|
365
365
|
classValue: {
|
|
366
366
|
default: l("relative inline-flex pt-2 pb-3 px-2 pl-3 sm:px-2 rounded-t-sm group"),
|
|
@@ -387,8 +387,8 @@ const Ie = (T) => {
|
|
|
387
387
|
j(() => {
|
|
388
388
|
if (!Z.current || T === "switch") return;
|
|
389
389
|
const e = new ResizeObserver((t) => {
|
|
390
|
-
const
|
|
391
|
-
pe(
|
|
390
|
+
const o = t[0].contentRect.width;
|
|
391
|
+
pe(o);
|
|
392
392
|
});
|
|
393
393
|
return e.observe(Z.current), pe(Z.current.clientWidth), () => e.disconnect();
|
|
394
394
|
}, [pe, T]);
|
|
@@ -397,20 +397,20 @@ const Ie = (T) => {
|
|
|
397
397
|
if (le?.length) {
|
|
398
398
|
let e = [...le];
|
|
399
399
|
_.forEach((t) => {
|
|
400
|
-
e.find((
|
|
400
|
+
e.find((o) => o.name === t) || e.push({ name: t, is_default: !1, is_hidden: !1, is_pinned: !1 });
|
|
401
401
|
}), e = e.filter(
|
|
402
|
-
(t,
|
|
402
|
+
(t, o, r) => _.includes(t.name) && o === r.findIndex((s) => s.name === t.name)
|
|
403
403
|
), de(e);
|
|
404
404
|
} else
|
|
405
405
|
de(
|
|
406
|
-
_.map((e) => ({ name: e, is_default: !1, is_hidden: !1, is_pinned: !1 })).filter((e, t,
|
|
406
|
+
_.map((e) => ({ name: e, is_default: !1, is_hidden: !1, is_pinned: !1 })).filter((e, t, o) => t === o.findIndex((r) => r.name === e.name))
|
|
407
407
|
);
|
|
408
408
|
}, [Mt, Ht]), j(() => {
|
|
409
409
|
Y && Ue(Y);
|
|
410
410
|
}, [Y]), j(() => {
|
|
411
411
|
if (!d.length) return;
|
|
412
412
|
const e = [...d];
|
|
413
|
-
me === "asc" ? e.sort((t,
|
|
413
|
+
me === "asc" ? e.sort((t, o) => t.name.localeCompare(o.name)) : me === "desc" && e.sort((t, o) => o.name.localeCompare(t.name)), bt(e);
|
|
414
414
|
}, [d, me]), j(() => {
|
|
415
415
|
Ie(I);
|
|
416
416
|
}, [I]), T === "switch" ? /* @__PURE__ */ n("div", { className: l("inline", ve), children: /* @__PURE__ */ n(
|
|
@@ -421,11 +421,11 @@ const Ie = (T) => {
|
|
|
421
421
|
className: l(
|
|
422
422
|
"inline-flex grow-0 p-1 rounded-lg",
|
|
423
423
|
ae === "dark" ? "border-[1.5px] border-neutral-800 bg-neutral-800 dark:border-black-800" : "bg-neutral-100 dark:bg-black-700",
|
|
424
|
-
|
|
424
|
+
re ? "w-full" : "w-auto"
|
|
425
425
|
),
|
|
426
426
|
children: _.map((e) => {
|
|
427
|
-
const t =
|
|
428
|
-
return /* @__PURE__ */ n("li", { role: "presentation", className: l("inline-flex",
|
|
427
|
+
const t = i === e, o = ie?.[e], r = d.find((f) => f.name === e), s = C && r?.is_pinned;
|
|
428
|
+
return /* @__PURE__ */ n("li", { role: "presentation", className: l("inline-flex", re ? "w-full" : "w-auto"), children: /* @__PURE__ */ n(
|
|
429
429
|
Se,
|
|
430
430
|
{
|
|
431
431
|
title: e,
|
|
@@ -433,12 +433,12 @@ const Ie = (T) => {
|
|
|
433
433
|
role: "tab",
|
|
434
434
|
ariaSelected: t,
|
|
435
435
|
tabIndex: 0,
|
|
436
|
-
icon:
|
|
437
|
-
iconsOnly:
|
|
436
|
+
icon: s ? /* @__PURE__ */ n(Ce, { title: "Unpin", children: /* @__PURE__ */ n("span", { onClick: () => ee(e), children: /* @__PURE__ */ n(oe, { className: "rotate-45 w-icon h-icon text-inherit dark:text-inherit" }) }) }) : o,
|
|
437
|
+
iconsOnly: it,
|
|
438
438
|
classValue: l(
|
|
439
439
|
"relative py-0.5 border-gray-200",
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
rt,
|
|
441
|
+
re ? "w-full flex items-center justify-center" : "px-2"
|
|
442
442
|
),
|
|
443
443
|
selectedClassValue: l(
|
|
444
444
|
"absolute inset-0 rounded-md z-0",
|
|
@@ -449,10 +449,10 @@ const Ie = (T) => {
|
|
|
449
449
|
t ? "text-neutral-900 dark:text-neutral-100" : "text-neutral-700 dark:text-neutral-100"
|
|
450
450
|
),
|
|
451
451
|
isSelected: t,
|
|
452
|
-
href:
|
|
452
|
+
href: z(e),
|
|
453
453
|
onClick: at ? void 0 : () => B(e),
|
|
454
454
|
suffixRecord: p,
|
|
455
|
-
selectedId:
|
|
455
|
+
selectedId: P,
|
|
456
456
|
color: ae,
|
|
457
457
|
disableAnimation: ct
|
|
458
458
|
}
|
|
@@ -467,13 +467,13 @@ const Ie = (T) => {
|
|
|
467
467
|
onMouseEnter: () => Me(!0),
|
|
468
468
|
onMouseLeave: () => Me(!1),
|
|
469
469
|
children: /* @__PURE__ */ ke(
|
|
470
|
-
|
|
470
|
+
Ft,
|
|
471
471
|
{
|
|
472
472
|
sensors: Tt,
|
|
473
473
|
onDragEnd: Ot,
|
|
474
474
|
onDragStart: _t,
|
|
475
475
|
onDragCancel: Et,
|
|
476
|
-
collisionDetection:
|
|
476
|
+
collisionDetection: zt,
|
|
477
477
|
onDragOver: Dt,
|
|
478
478
|
children: [
|
|
479
479
|
/* @__PURE__ */ ke(
|
|
@@ -488,7 +488,7 @@ const Ie = (T) => {
|
|
|
488
488
|
),
|
|
489
489
|
ref: yt,
|
|
490
490
|
children: [
|
|
491
|
-
|
|
491
|
+
ot ? /* @__PURE__ */ n("div", { className: "skeleton bg-neutral-300 dark:bg-black-700 animate-pulse h-10 min-w-[100px] w-full rounded" }) : /* @__PURE__ */ ke(
|
|
492
492
|
Bt,
|
|
493
493
|
{
|
|
494
494
|
items: a.map(({ name: e }) => e),
|
|
@@ -497,7 +497,7 @@ const Ie = (T) => {
|
|
|
497
497
|
disabled: !E || R,
|
|
498
498
|
children: [
|
|
499
499
|
a.slice(0, K).map(({ name: e, is_pinned: t }) => {
|
|
500
|
-
const
|
|
500
|
+
const o = i === e && !I, r = C && t;
|
|
501
501
|
return /* @__PURE__ */ n(
|
|
502
502
|
tt,
|
|
503
503
|
{
|
|
@@ -510,21 +510,21 @@ const Ie = (T) => {
|
|
|
510
510
|
showCounts: k,
|
|
511
511
|
title: e,
|
|
512
512
|
role: "tab",
|
|
513
|
-
ariaSelected:
|
|
513
|
+
ariaSelected: o,
|
|
514
514
|
tabIndex: 0,
|
|
515
515
|
classValue: l(
|
|
516
|
-
L("classValue",
|
|
516
|
+
L("classValue", o),
|
|
517
517
|
G ? "w-full justify-center" : ""
|
|
518
518
|
),
|
|
519
|
-
selectedClassValue: L("selectedClassValue",
|
|
520
|
-
textClassValue: L("textClassValue",
|
|
521
|
-
isSelected:
|
|
522
|
-
tabOptions:
|
|
519
|
+
selectedClassValue: L("selectedClassValue", o),
|
|
520
|
+
textClassValue: L("textClassValue", o),
|
|
521
|
+
isSelected: o,
|
|
522
|
+
tabOptions: o && E ? /* @__PURE__ */ n(
|
|
523
523
|
ye,
|
|
524
524
|
{
|
|
525
525
|
menu: {
|
|
526
|
-
items:
|
|
527
|
-
className:
|
|
526
|
+
items: be(e),
|
|
527
|
+
className: se
|
|
528
528
|
},
|
|
529
529
|
trigger: ["click"],
|
|
530
530
|
onOpenChange: Ie,
|
|
@@ -544,22 +544,22 @@ const Ie = (T) => {
|
|
|
544
544
|
}
|
|
545
545
|
) : null,
|
|
546
546
|
draggingTab: D === e,
|
|
547
|
-
href:
|
|
547
|
+
href: z(e),
|
|
548
548
|
onClick: () => B(e),
|
|
549
549
|
suffixRecord: p,
|
|
550
|
-
selectedId:
|
|
551
|
-
icon:
|
|
550
|
+
selectedId: P,
|
|
551
|
+
icon: r ? /* @__PURE__ */ n(Ce, { title: u("Unpin"), children: /* @__PURE__ */ n("span", { onClick: () => ee(e), children: /* @__PURE__ */ n(oe, { size: 20, className: "rotate-45 text-inherit dark:text-inherit" }) }) }) : ie?.[e] ?? null
|
|
552
552
|
}
|
|
553
553
|
) }, e)
|
|
554
554
|
},
|
|
555
555
|
e
|
|
556
556
|
);
|
|
557
557
|
}),
|
|
558
|
-
|
|
558
|
+
i && ze ? /* @__PURE__ */ n(tt, { title: i, isDragging: D === i, children: /* @__PURE__ */ n("li", { role: "presentation", className: l("sm:mr-2"), children: /* @__PURE__ */ n(
|
|
559
559
|
Se,
|
|
560
560
|
{
|
|
561
561
|
showCounts: k,
|
|
562
|
-
title:
|
|
562
|
+
title: i,
|
|
563
563
|
role: "tab",
|
|
564
564
|
ariaSelected: !0,
|
|
565
565
|
tabIndex: 0,
|
|
@@ -571,8 +571,8 @@ const Ie = (T) => {
|
|
|
571
571
|
ye,
|
|
572
572
|
{
|
|
573
573
|
menu: {
|
|
574
|
-
items:
|
|
575
|
-
className:
|
|
574
|
+
items: be(i),
|
|
575
|
+
className: se
|
|
576
576
|
},
|
|
577
577
|
trigger: ["click"],
|
|
578
578
|
onOpenChange: Ie,
|
|
@@ -583,13 +583,13 @@ const Ie = (T) => {
|
|
|
583
583
|
children: /* @__PURE__ */ n(et, { sx: { fontSize: 20 }, className: "text-primary-600" })
|
|
584
584
|
}
|
|
585
585
|
) : null,
|
|
586
|
-
draggingTab: D ===
|
|
587
|
-
href:
|
|
586
|
+
draggingTab: D === i,
|
|
587
|
+
href: z(i),
|
|
588
588
|
suffixRecord: p,
|
|
589
|
-
selectedId:
|
|
590
|
-
icon: C && d.find((e) => e.name ===
|
|
589
|
+
selectedId: P,
|
|
590
|
+
icon: C && d.find((e) => e.name === i)?.is_pinned ? /* @__PURE__ */ n(Ce, { title: u("Pinned"), children: /* @__PURE__ */ n("span", { onClick: () => ee(i), children: /* @__PURE__ */ n(oe, { size: 20, className: "rotate-45 text-inherit dark:text-inherit" }) }) }) : ie?.[i] ?? null
|
|
591
591
|
}
|
|
592
|
-
) },
|
|
592
|
+
) }, i) }, i) : null,
|
|
593
593
|
(U < a.length && !A || V.length > 0) && Be > 0 ? /* @__PURE__ */ n(ln, { id: "more-tabs", children: /* @__PURE__ */ n(
|
|
594
594
|
ye,
|
|
595
595
|
{
|
|
@@ -619,7 +619,7 @@ const Ie = (T) => {
|
|
|
619
619
|
}
|
|
620
620
|
) })
|
|
621
621
|
},
|
|
622
|
-
...a.slice(K).filter((e) => e.name !==
|
|
622
|
+
...a.slice(K).filter((e) => e.name !== i).concat(V).filter(
|
|
623
623
|
({ name: e }) => typeof e == "string" && (e ?? "").toLowerCase().includes(ce.toLowerCase())
|
|
624
624
|
).map(({ name: e, is_hidden: t }) => ({
|
|
625
625
|
key: e,
|
|
@@ -640,11 +640,11 @@ const Ie = (T) => {
|
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
),
|
|
643
|
-
popupClassName:
|
|
644
|
-
children: I ?
|
|
643
|
+
popupClassName: se,
|
|
644
|
+
children: I ? be(e, t, !0) : null
|
|
645
645
|
}))
|
|
646
646
|
],
|
|
647
|
-
className:
|
|
647
|
+
className: se
|
|
648
648
|
},
|
|
649
649
|
openClassName: "max-h-[350px] overflow-y-auto",
|
|
650
650
|
trigger: ["click"],
|
|
@@ -660,7 +660,7 @@ const Ie = (T) => {
|
|
|
660
660
|
draggingOver: xt,
|
|
661
661
|
suffixRecord: p,
|
|
662
662
|
handleShowMoreDropdown: Ge,
|
|
663
|
-
selectedId:
|
|
663
|
+
selectedId: P,
|
|
664
664
|
showMoreDropdown: I
|
|
665
665
|
}
|
|
666
666
|
)
|
|
@@ -701,7 +701,7 @@ const Ie = (T) => {
|
|
|
701
701
|
suffixRecord: p,
|
|
702
702
|
size: O,
|
|
703
703
|
variant: T,
|
|
704
|
-
selectedId:
|
|
704
|
+
selectedId: P,
|
|
705
705
|
parentContainer: mt
|
|
706
706
|
}
|
|
707
707
|
) : null
|
|
@@ -712,6 +712,6 @@ const Ie = (T) => {
|
|
|
712
712
|
);
|
|
713
713
|
};
|
|
714
714
|
export {
|
|
715
|
-
|
|
715
|
+
Fn as Tabs
|
|
716
716
|
};
|
|
717
717
|
//# sourceMappingURL=Tabs.es.js.map
|