@lablup/ui-common 0.1.0-alpha.2 → 0.1.0-alpha.20
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/README.md +1 -1
- package/dist/assets/components/BaseCard/BaseCard.css +1 -1
- package/dist/assets/components/Button/Button.css +1 -1
- package/dist/assets/components/DataTable/DataTable.css +1 -1
- package/dist/assets/components/Drawer/Drawer.css +1 -1
- package/dist/assets/components/EmptyState/EmptyState.css +1 -1
- package/dist/assets/components/ErrorState/ErrorState.css +1 -1
- package/dist/assets/components/PageHeader/PageHeader.css +1 -1
- package/dist/assets/components/Select/Select.css +1 -0
- package/dist/assets/components/StatCard/StatCard.css +1 -1
- package/dist/assets/components/Tabs/Tabs.css +1 -1
- package/dist/assets/components/Tooltip/Tooltip.css +1 -1
- package/dist/components/DataTable/DataTable.d.ts +30 -6
- package/dist/components/DataTable/DataTable2.js +85 -92
- package/dist/components/DataTable/DataTable2.js.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +12 -1
- package/dist/components/Drawer/Drawer2.js +69 -51
- package/dist/components/Drawer/Drawer2.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +10 -3
- package/dist/components/EmptyState/EmptyState2.js +31 -48
- package/dist/components/EmptyState/EmptyState2.js.map +1 -1
- package/dist/components/EmptyState/index.d.ts +6 -1
- package/dist/components/ErrorState/ErrorState.d.ts +17 -4
- package/dist/components/ErrorState/ErrorState2.js +20 -23
- package/dist/components/ErrorState/ErrorState2.js.map +1 -1
- package/dist/components/ErrorState/index.d.ts +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +14 -1
- package/dist/components/PageHeader/PageHeader2.js +40 -24
- package/dist/components/PageHeader/PageHeader2.js.map +1 -1
- package/dist/components/Select/Select.d.ts +38 -0
- package/dist/components/Select/Select2.js +313 -0
- package/dist/components/Select/Select2.js.map +1 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Skeleton/Skeleton.d.ts +11 -1
- package/dist/components/Skeleton/Skeleton2.js +8 -6
- package/dist/components/Skeleton/Skeleton2.js.map +1 -1
- package/dist/components/Skeleton/SkeletonCard.d.ts +3 -1
- package/dist/components/Skeleton/SkeletonCard2.js +13 -3
- package/dist/components/Skeleton/SkeletonCard2.js.map +1 -1
- package/dist/components/Skeleton/SkeletonChart2.js +5 -0
- package/dist/components/Skeleton/SkeletonChart2.js.map +1 -1
- package/dist/components/Skeleton/SkeletonRow.d.ts +3 -1
- package/dist/components/Skeleton/SkeletonRow2.js +9 -3
- package/dist/components/Skeleton/SkeletonRow2.js.map +1 -1
- package/dist/components/Skeleton/SkeletonText.d.ts +3 -1
- package/dist/components/Skeleton/SkeletonText2.js +7 -5
- package/dist/components/Skeleton/SkeletonText2.js.map +1 -1
- package/dist/components/StatCard/StatCard.d.ts +10 -1
- package/dist/components/StatCard/StatCard2.js +30 -30
- package/dist/components/StatCard/StatCard2.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +10 -23
- package/dist/components/Tabs/Tabs2.js +127 -146
- package/dist/components/Tabs/Tabs2.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/Tabs/index.js +2 -3
- package/dist/components/Tooltip/Tooltip.d.ts +15 -1
- package/dist/components/Tooltip/Tooltip2.js +77 -47
- package/dist/components/Tooltip/Tooltip2.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -6
- package/dist/styles/base.css +101 -10
- package/dist/styles/themes/orange-dark.css +3 -0
- package/dist/styles/themes/orange-light.css +6 -1
- package/package.json +1 -1
- package/dist/components/EmptyState/illustrations.d.ts +0 -51
- package/dist/components/EmptyState/illustrations.js +0 -571
- package/dist/components/EmptyState/illustrations.js.map +0 -1
- package/dist/components/Tabs/tabTags.d.ts +0 -9
- package/dist/components/Tabs/tabTags.js +0 -11
- package/dist/components/Tabs/tabTags.js.map +0 -1
|
@@ -1,54 +1,46 @@
|
|
|
1
|
-
import { Badge as e } from "../Badge/Badge2.js";
|
|
2
|
-
import { TAG_CONFIG as t } from "./tabTags.js";
|
|
3
1
|
/* empty css */
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { Fragment as
|
|
2
|
+
import { useCallback as e, useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import { Fragment as ee, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
4
|
//#region src/components/Tabs/Tabs.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
recommended: "Recommended",
|
|
10
|
-
beta: "Beta",
|
|
11
|
-
experimental: "Experimental"
|
|
12
|
-
};
|
|
13
|
-
function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange: p, className: m = "", panelClassName: h = "", ariaLabel: ne, showOverflowControls: g = !0, showGroupLabels: _ = !0, overflowMode: re, variant: v = "underlined", fillContainer: ie = !1, renderPanel: y = !0, moreTabsLabel: ae = "More tabs", selectTabLabel: oe = "Select tab", scrollLeftLabel: se = "Scroll left", scrollRightLabel: ce = "Scroll right", tagLabels: b = ee }) {
|
|
14
|
-
let x = re ?? (d.length > 0 ? "menu" : "dropdown"), [le, ue] = o(te || u[0]?.id || ""), [de, S] = o(!1), [fe, C] = o(!1), [w, pe] = o(!1), [T, E] = o(!1), [D, O] = o(!1), [me, k] = o(-1), A = a(null), j = a(/* @__PURE__ */ new Map()), M = a(null), N = a(null), P = a(null), F = a([]), I = a(null), L = a(0), R = a(0), z = f ?? le, B = i(() => d.length > 0 ? d.map((e) => ({
|
|
5
|
+
function s({ tabs: s, groups: c = [], defaultTab: te, activeTab: l, onTabChange: u, className: d = "", panelClassName: f = "", ariaLabel: p, showOverflowControls: m = !0, showGroupLabels: h = !0, overflowMode: g, variant: _ = "underlined", fillContainer: ne = !1, renderPanel: v = !0, moreTabsLabel: re = "More tabs", selectTabLabel: ie = "Select tab", scrollLeftLabel: y = "Scroll left", scrollRightLabel: ae = "Scroll right" }) {
|
|
6
|
+
let b = g ?? (c.length > 0 ? "menu" : "dropdown"), [x, oe] = i(te || s[0]?.id || ""), [se, S] = i(!1), [ce, C] = i(!1), [w, le] = i(!1), [T, E] = i(!1), [D, O] = i(!1), [ue, k] = i(-1), A = r(null), j = r(/* @__PURE__ */ new Map()), M = r(null), N = r(null), P = r(null), F = r([]), I = r(null), L = r(0), R = r(0), z = l ?? x, B = n(() => c.length > 0 ? c.map((e) => ({
|
|
15
7
|
group: e,
|
|
16
|
-
tabs:
|
|
8
|
+
tabs: s.filter((t) => t.groupId === e.id)
|
|
17
9
|
})) : [{
|
|
18
10
|
group: null,
|
|
19
|
-
tabs:
|
|
20
|
-
}], [
|
|
21
|
-
|
|
22
|
-
}, [
|
|
11
|
+
tabs: s
|
|
12
|
+
}], [c, s]), V = n(() => B.flatMap(({ tabs: e }) => e), [B]), H = e((e) => {
|
|
13
|
+
l || oe(e), u?.(e), O(!1);
|
|
14
|
+
}, [l, u]), U = e((e, t) => {
|
|
23
15
|
let n;
|
|
24
16
|
switch (e.key) {
|
|
25
17
|
case "ArrowRight":
|
|
26
|
-
e.preventDefault(), n = t ===
|
|
18
|
+
e.preventDefault(), n = t === s.length - 1 ? 0 : t + 1;
|
|
27
19
|
break;
|
|
28
20
|
case "ArrowLeft":
|
|
29
|
-
e.preventDefault(), n = t === 0 ?
|
|
21
|
+
e.preventDefault(), n = t === 0 ? s.length - 1 : t - 1;
|
|
30
22
|
break;
|
|
31
23
|
case "Home":
|
|
32
24
|
e.preventDefault(), n = 0;
|
|
33
25
|
break;
|
|
34
26
|
case "End":
|
|
35
|
-
e.preventDefault(), n =
|
|
27
|
+
e.preventDefault(), n = s.length - 1;
|
|
36
28
|
break;
|
|
37
29
|
default: return;
|
|
38
30
|
}
|
|
39
|
-
let r =
|
|
31
|
+
let r = s[n];
|
|
40
32
|
r && (H(r.id), j.current.get(r.id)?.focus());
|
|
41
|
-
}, [
|
|
33
|
+
}, [s, H]), de = e((e, t) => {
|
|
42
34
|
t ? j.current.set(e, t) : j.current.delete(e);
|
|
43
|
-
}, []), W =
|
|
35
|
+
}, []), W = e(() => {
|
|
44
36
|
let e = A.current;
|
|
45
|
-
if (!e || !
|
|
37
|
+
if (!e || !m) {
|
|
46
38
|
S(!1), C(!1);
|
|
47
39
|
return;
|
|
48
40
|
}
|
|
49
41
|
let { scrollLeft: t, scrollWidth: n, clientWidth: r } = e;
|
|
50
42
|
S(t > 0), C(t + r < n - 1);
|
|
51
|
-
}, [
|
|
43
|
+
}, [m]), G = e((e) => {
|
|
52
44
|
let t = A.current;
|
|
53
45
|
if (!t) return;
|
|
54
46
|
let n = t.clientWidth * .75;
|
|
@@ -56,35 +48,35 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
56
48
|
left: e === "left" ? -n : n,
|
|
57
49
|
behavior: "smooth"
|
|
58
50
|
}), I.current !== null && clearTimeout(I.current), I.current = setTimeout(W, 300);
|
|
59
|
-
}, [W]), K =
|
|
51
|
+
}, [W]), K = e(() => {
|
|
60
52
|
if (!A.current || w) return;
|
|
61
53
|
let e = j.current.get(z);
|
|
62
54
|
if (!e) return;
|
|
63
55
|
let t = A.current, n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
64
56
|
n.left < r.left ? t.scrollLeft -= r.left - n.left + 8 : n.right > r.right && (t.scrollLeft += n.right - r.right + 8);
|
|
65
|
-
}, [z, w]), q =
|
|
66
|
-
typeof window > "u" ||
|
|
67
|
-
}, [
|
|
57
|
+
}, [z, w]), q = e(() => {
|
|
58
|
+
typeof window > "u" || b !== "dropdown" || le(window.innerWidth < 480);
|
|
59
|
+
}, [b]), fe = e(() => {
|
|
68
60
|
E((e) => !e);
|
|
69
|
-
}, []),
|
|
61
|
+
}, []), pe = e((e) => {
|
|
70
62
|
e.key === "Escape" && T && (e.preventDefault(), E(!1));
|
|
71
|
-
}, [T]), J =
|
|
63
|
+
}, [T]), J = e((e) => {
|
|
72
64
|
e.touches[0] && (L.current = e.touches[0].clientX);
|
|
73
|
-
}, []), Y =
|
|
65
|
+
}, []), Y = e((e) => {
|
|
74
66
|
e.touches[0] && (R.current = e.touches[0].clientX);
|
|
75
|
-
}, []), X =
|
|
67
|
+
}, []), X = e(() => {
|
|
76
68
|
if (!L.current || !R.current) return;
|
|
77
69
|
let e = L.current - R.current;
|
|
78
70
|
if (Math.abs(e) > 50) {
|
|
79
|
-
let t =
|
|
71
|
+
let t = s.findIndex((e) => e.id === z), n = s[t + 1], r = s[t - 1];
|
|
80
72
|
e > 0 && n ? H(n.id) : e < 0 && r && H(r.id);
|
|
81
73
|
}
|
|
82
74
|
L.current = 0, R.current = 0;
|
|
83
75
|
}, [
|
|
84
76
|
z,
|
|
85
|
-
|
|
77
|
+
s,
|
|
86
78
|
H
|
|
87
|
-
]),
|
|
79
|
+
]), me = e((e) => {
|
|
88
80
|
let t = V.length;
|
|
89
81
|
switch (e.key) {
|
|
90
82
|
case "Escape":
|
|
@@ -107,10 +99,10 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
107
99
|
break;
|
|
108
100
|
case "End": e.preventDefault(), k(t - 1), F.current[t - 1]?.focus();
|
|
109
101
|
}
|
|
110
|
-
}, [V.length]),
|
|
102
|
+
}, [V.length]), he = e((e) => {
|
|
111
103
|
e.key === "Escape" && D && (e.preventDefault(), O(!1), k(-1));
|
|
112
104
|
}, [D]);
|
|
113
|
-
|
|
105
|
+
t(() => {
|
|
114
106
|
if (!T) return;
|
|
115
107
|
let e = (e) => {
|
|
116
108
|
M.current && !M.current.contains(e.target) && E(!1);
|
|
@@ -118,7 +110,7 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
118
110
|
return document.addEventListener("mousedown", e), () => {
|
|
119
111
|
document.removeEventListener("mousedown", e);
|
|
120
112
|
};
|
|
121
|
-
}, [T]),
|
|
113
|
+
}, [T]), t(() => {
|
|
122
114
|
if (!D) return;
|
|
123
115
|
let e = (e) => {
|
|
124
116
|
N.current && !N.current.contains(e.target) && (O(!1), k(-1));
|
|
@@ -128,7 +120,7 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
128
120
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
129
121
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
130
122
|
};
|
|
131
|
-
}, [D]),
|
|
123
|
+
}, [D]), t(() => {
|
|
132
124
|
if (D && F.current.length > 0) {
|
|
133
125
|
let e = V.findIndex((e) => e.id === z), t = e >= 0 ? e : 0;
|
|
134
126
|
k(t), requestAnimationFrame(() => {
|
|
@@ -139,16 +131,16 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
139
131
|
D,
|
|
140
132
|
V,
|
|
141
133
|
z
|
|
142
|
-
]),
|
|
143
|
-
if (!
|
|
144
|
-
let e =
|
|
134
|
+
]), t(() => {
|
|
135
|
+
if (!s.find((e) => e.id === z)) {
|
|
136
|
+
let e = s[0];
|
|
145
137
|
e && H(e.id);
|
|
146
138
|
}
|
|
147
139
|
}, [
|
|
148
|
-
|
|
140
|
+
s,
|
|
149
141
|
z,
|
|
150
142
|
H
|
|
151
|
-
]),
|
|
143
|
+
]), t(() => {
|
|
152
144
|
q(), W();
|
|
153
145
|
let e = () => {
|
|
154
146
|
q(), W();
|
|
@@ -156,79 +148,73 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
156
148
|
return window.addEventListener("resize", e), () => {
|
|
157
149
|
window.removeEventListener("resize", e);
|
|
158
150
|
};
|
|
159
|
-
}, [q, W]),
|
|
151
|
+
}, [q, W]), t(() => {
|
|
160
152
|
K();
|
|
161
|
-
}, [z, K]),
|
|
153
|
+
}, [z, K]), t(() => {
|
|
162
154
|
W();
|
|
163
|
-
}, [
|
|
155
|
+
}, [s, W]), t(() => () => {
|
|
164
156
|
I.current !== null && clearTimeout(I.current);
|
|
165
157
|
}, []);
|
|
166
|
-
let Z =
|
|
158
|
+
let Z = s.find((e) => e.id === z)?.content, ge = s.find((e) => e.id === z)?.label, _e = c.length > 0;
|
|
167
159
|
F.current = [];
|
|
168
|
-
let Q = (e
|
|
169
|
-
let
|
|
170
|
-
return /* @__PURE__ */
|
|
171
|
-
ref: (
|
|
172
|
-
|
|
160
|
+
let Q = (e, t) => {
|
|
161
|
+
let n = e.id === z;
|
|
162
|
+
return /* @__PURE__ */ o("button", {
|
|
163
|
+
ref: (t) => {
|
|
164
|
+
de(e.id, t);
|
|
173
165
|
},
|
|
174
166
|
role: "tab",
|
|
175
|
-
"aria-selected":
|
|
176
|
-
"aria-controls":
|
|
177
|
-
id: `tab-${
|
|
178
|
-
tabIndex:
|
|
179
|
-
className: `tabs__tab${
|
|
167
|
+
"aria-selected": n,
|
|
168
|
+
"aria-controls": v ? `tabpanel-${e.id}` : void 0,
|
|
169
|
+
id: `tab-${e.id}`,
|
|
170
|
+
tabIndex: n ? 0 : -1,
|
|
171
|
+
className: `tabs__tab${n ? " tabs__tab--active" : ""}`,
|
|
180
172
|
onClick: () => {
|
|
181
|
-
H(
|
|
173
|
+
H(e.id);
|
|
182
174
|
},
|
|
183
175
|
onKeyDown: (e) => {
|
|
184
|
-
U(e,
|
|
176
|
+
U(e, t), (e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End") && e.stopPropagation();
|
|
185
177
|
},
|
|
186
178
|
children: [
|
|
187
|
-
|
|
188
|
-
/* @__PURE__ */
|
|
179
|
+
e.labelPrefix,
|
|
180
|
+
/* @__PURE__ */ a("span", {
|
|
189
181
|
className: "tabs__tab-label",
|
|
190
|
-
children:
|
|
191
|
-
}),
|
|
192
|
-
o && /* @__PURE__ */ c(e, {
|
|
193
|
-
variant: o.variant,
|
|
194
|
-
size: "small",
|
|
195
|
-
className: "tabs__tag-badge",
|
|
196
|
-
children: s
|
|
182
|
+
children: e.label
|
|
197
183
|
}),
|
|
198
|
-
|
|
184
|
+
e.labelExtra
|
|
199
185
|
]
|
|
200
|
-
},
|
|
201
|
-
},
|
|
186
|
+
}, e.id);
|
|
187
|
+
}, ve = () => _e ? B.map(({ group: e, tabs: t }, n) => /* @__PURE__ */ o("div", {
|
|
202
188
|
className: "tabs__group",
|
|
203
|
-
children: [e && /* @__PURE__ */
|
|
189
|
+
children: [e && /* @__PURE__ */ o(ee, { children: [n > 0 && /* @__PURE__ */ a("div", {
|
|
204
190
|
className: "tabs__separator",
|
|
205
191
|
role: "separator",
|
|
206
192
|
"aria-hidden": "true"
|
|
207
|
-
}),
|
|
193
|
+
}), h && /* @__PURE__ */ a("span", {
|
|
208
194
|
className: "tabs__group-label",
|
|
209
195
|
children: e.label
|
|
210
|
-
})] }), /* @__PURE__ */
|
|
196
|
+
})] }), /* @__PURE__ */ a("div", {
|
|
211
197
|
className: "tabs__group-tabs",
|
|
212
198
|
children: t.map((e) => {
|
|
213
|
-
let t =
|
|
214
|
-
return
|
|
199
|
+
let t = s.findIndex((t) => t.id === e.id);
|
|
200
|
+
return Q(e, t);
|
|
215
201
|
})
|
|
216
202
|
})]
|
|
217
|
-
}, e?.id || "default")) :
|
|
203
|
+
}, e?.id || "default")) : s.map((e, t) => Q(e, t)), ye = () => b !== "menu" || !m ? null : /* @__PURE__ */ o("div", {
|
|
218
204
|
className: "tabs__overflow",
|
|
219
205
|
ref: N,
|
|
220
|
-
children: [/* @__PURE__ */
|
|
206
|
+
children: [/* @__PURE__ */ a("button", {
|
|
221
207
|
ref: P,
|
|
222
208
|
type: "button",
|
|
223
209
|
className: "tabs__overflow-btn",
|
|
224
210
|
onClick: () => {
|
|
225
211
|
O(!D);
|
|
226
212
|
},
|
|
227
|
-
onKeyDown:
|
|
228
|
-
"aria-label":
|
|
213
|
+
onKeyDown: he,
|
|
214
|
+
"aria-label": re,
|
|
229
215
|
"aria-expanded": D,
|
|
230
216
|
"aria-haspopup": "menu",
|
|
231
|
-
children: /* @__PURE__ */
|
|
217
|
+
children: /* @__PURE__ */ o("svg", {
|
|
232
218
|
width: "20",
|
|
233
219
|
height: "20",
|
|
234
220
|
viewBox: "0 0 24 24",
|
|
@@ -238,75 +224,70 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
238
224
|
strokeLinecap: "round",
|
|
239
225
|
strokeLinejoin: "round",
|
|
240
226
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ a("circle", {
|
|
242
228
|
cx: "12",
|
|
243
229
|
cy: "12",
|
|
244
230
|
r: "1"
|
|
245
231
|
}),
|
|
246
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ a("circle", {
|
|
247
233
|
cx: "12",
|
|
248
234
|
cy: "5",
|
|
249
235
|
r: "1"
|
|
250
236
|
}),
|
|
251
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ a("circle", {
|
|
252
238
|
cx: "12",
|
|
253
239
|
cy: "19",
|
|
254
240
|
r: "1"
|
|
255
241
|
})
|
|
256
242
|
]
|
|
257
243
|
})
|
|
258
|
-
}), D && /* @__PURE__ */
|
|
244
|
+
}), D && /* @__PURE__ */ a("div", {
|
|
259
245
|
className: "tabs__overflow-menu",
|
|
260
246
|
role: "menu",
|
|
261
|
-
onKeyDown:
|
|
262
|
-
children: B.map(({ group:
|
|
247
|
+
onKeyDown: me,
|
|
248
|
+
children: B.map(({ group: e, tabs: t }) => /* @__PURE__ */ o("div", {
|
|
263
249
|
className: "tabs__overflow-group",
|
|
264
|
-
children: [
|
|
250
|
+
children: [e && h && /* @__PURE__ */ a("div", {
|
|
265
251
|
className: "tabs__overflow-group-label",
|
|
266
|
-
children:
|
|
267
|
-
}),
|
|
268
|
-
let
|
|
269
|
-
return /* @__PURE__ */
|
|
252
|
+
children: e.label
|
|
253
|
+
}), t.map((e) => {
|
|
254
|
+
let t = e.id === z, n = V.findIndex((t) => t.id === e.id);
|
|
255
|
+
return /* @__PURE__ */ o("button", {
|
|
270
256
|
ref: (e) => {
|
|
271
|
-
e && (F.current[
|
|
257
|
+
e && (F.current[n] = e);
|
|
272
258
|
},
|
|
273
259
|
role: "menuitem",
|
|
274
|
-
tabIndex:
|
|
275
|
-
className: `tabs__overflow-item ${
|
|
260
|
+
tabIndex: ue === n ? 0 : -1,
|
|
261
|
+
className: `tabs__overflow-item ${t ? "tabs__overflow-item--active" : ""}`,
|
|
276
262
|
onClick: () => {
|
|
277
|
-
H(
|
|
263
|
+
H(e.id);
|
|
278
264
|
},
|
|
279
265
|
children: [
|
|
280
|
-
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
|
|
283
|
-
variant: o.variant,
|
|
284
|
-
size: "small",
|
|
285
|
-
children: s
|
|
286
|
-
}),
|
|
287
|
-
n.labelExtra
|
|
266
|
+
e.labelPrefix,
|
|
267
|
+
/* @__PURE__ */ a("span", { children: e.label }),
|
|
268
|
+
e.labelExtra
|
|
288
269
|
]
|
|
289
|
-
},
|
|
270
|
+
}, e.id);
|
|
290
271
|
})]
|
|
291
|
-
},
|
|
272
|
+
}, e?.id || "default"))
|
|
292
273
|
})]
|
|
293
|
-
}), $ =
|
|
294
|
-
return
|
|
295
|
-
className: `tabs tabs--mobile-dropdown ${
|
|
296
|
-
children: [/* @__PURE__ */
|
|
274
|
+
}), $ = _ === "segmented" || _ === "compact";
|
|
275
|
+
return b === "dropdown" && w && !$ ? /* @__PURE__ */ o("div", {
|
|
276
|
+
className: `tabs tabs--mobile-dropdown ${d}`,
|
|
277
|
+
children: [/* @__PURE__ */ o("div", {
|
|
297
278
|
className: "tabs__dropdown-container",
|
|
298
279
|
ref: M,
|
|
299
|
-
children: [/* @__PURE__ */
|
|
280
|
+
children: [/* @__PURE__ */ o("button", {
|
|
300
281
|
className: "tabs__dropdown-trigger",
|
|
301
|
-
onClick:
|
|
302
|
-
onKeyDown:
|
|
282
|
+
onClick: fe,
|
|
283
|
+
onKeyDown: pe,
|
|
303
284
|
"aria-expanded": T,
|
|
304
285
|
"aria-haspopup": "listbox",
|
|
305
|
-
"aria-label":
|
|
306
|
-
children: [/* @__PURE__ */
|
|
286
|
+
"aria-label": p || ie,
|
|
287
|
+
children: [/* @__PURE__ */ a("span", {
|
|
307
288
|
className: "tabs__dropdown-label",
|
|
308
|
-
children:
|
|
309
|
-
}), /* @__PURE__ */
|
|
289
|
+
children: ge
|
|
290
|
+
}), /* @__PURE__ */ a("svg", {
|
|
310
291
|
className: `tabs__dropdown-arrow ${T ? "tabs__dropdown-arrow--open" : ""}`,
|
|
311
292
|
width: "16",
|
|
312
293
|
height: "16",
|
|
@@ -314,7 +295,7 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
314
295
|
fill: "none",
|
|
315
296
|
xmlns: "http://www.w3.org/2000/svg",
|
|
316
297
|
"aria-hidden": "true",
|
|
317
|
-
children: /* @__PURE__ */
|
|
298
|
+
children: /* @__PURE__ */ a("path", {
|
|
318
299
|
d: "M4 6L8 10L12 6",
|
|
319
300
|
stroke: "currentColor",
|
|
320
301
|
strokeWidth: "2",
|
|
@@ -322,10 +303,10 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
322
303
|
strokeLinejoin: "round"
|
|
323
304
|
})
|
|
324
305
|
})]
|
|
325
|
-
}), T && /* @__PURE__ */
|
|
306
|
+
}), T && /* @__PURE__ */ a("div", {
|
|
326
307
|
className: "tabs__dropdown-menu",
|
|
327
308
|
role: "listbox",
|
|
328
|
-
children:
|
|
309
|
+
children: s.map((e) => /* @__PURE__ */ a("button", {
|
|
329
310
|
role: "option",
|
|
330
311
|
"aria-selected": e.id === z,
|
|
331
312
|
className: `tabs__dropdown-item ${e.id === z ? "tabs__dropdown-item--active" : ""}`,
|
|
@@ -335,37 +316,37 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
335
316
|
children: e.label
|
|
336
317
|
}, e.id))
|
|
337
318
|
})]
|
|
338
|
-
}),
|
|
319
|
+
}), v && /* @__PURE__ */ a("div", {
|
|
339
320
|
id: `tabpanel-${z}`,
|
|
340
321
|
role: "tabpanel",
|
|
341
322
|
"aria-labelledby": `tab-${z}`,
|
|
342
|
-
className: `tabs__panel ${
|
|
323
|
+
className: `tabs__panel ${f}`.trim(),
|
|
343
324
|
tabIndex: 0,
|
|
344
325
|
onTouchStart: J,
|
|
345
326
|
onTouchMove: Y,
|
|
346
327
|
onTouchEnd: X,
|
|
347
328
|
children: Z
|
|
348
329
|
})]
|
|
349
|
-
}) : /* @__PURE__ */
|
|
350
|
-
className: `tabs ${
|
|
351
|
-
children: [/* @__PURE__ */
|
|
330
|
+
}) : /* @__PURE__ */ o("div", {
|
|
331
|
+
className: `tabs ${b === "menu" ? "tabs--overflow-menu" : ""} ${_ === "segmented" ? "tabs--variant-segmented" : _ === "compact" ? "tabs--variant-compact" : ""} ${$ && ne ? "tabs--fill-container" : ""} ${d}`.replace(/\s+/g, " ").trim(),
|
|
332
|
+
children: [/* @__PURE__ */ o("div", {
|
|
352
333
|
className: "tabs__container",
|
|
353
334
|
children: [
|
|
354
|
-
|
|
335
|
+
m && se && /* @__PURE__ */ a("button", {
|
|
355
336
|
className: "tabs__scroll-arrow tabs__scroll-arrow--left",
|
|
356
337
|
onClick: () => {
|
|
357
338
|
G("left");
|
|
358
339
|
},
|
|
359
|
-
"aria-label":
|
|
340
|
+
"aria-label": y,
|
|
360
341
|
tabIndex: -1,
|
|
361
|
-
children: /* @__PURE__ */
|
|
342
|
+
children: /* @__PURE__ */ a("svg", {
|
|
362
343
|
width: "20",
|
|
363
344
|
height: "20",
|
|
364
345
|
viewBox: "0 0 20 20",
|
|
365
346
|
fill: "none",
|
|
366
347
|
xmlns: "http://www.w3.org/2000/svg",
|
|
367
348
|
"aria-hidden": "true",
|
|
368
|
-
children: /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ a("path", {
|
|
369
350
|
d: "M12 15L7 10L12 5",
|
|
370
351
|
stroke: "currentColor",
|
|
371
352
|
strokeWidth: "2",
|
|
@@ -374,36 +355,36 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
374
355
|
})
|
|
375
356
|
})
|
|
376
357
|
}),
|
|
377
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ a("div", {
|
|
378
359
|
ref: A,
|
|
379
360
|
className: "tabs__list",
|
|
380
361
|
role: "tablist",
|
|
381
|
-
"aria-label":
|
|
362
|
+
"aria-label": p,
|
|
382
363
|
onScroll: W,
|
|
383
364
|
onKeyDown: (e) => {
|
|
384
|
-
let t =
|
|
365
|
+
let t = s.findIndex((e) => e.id === z);
|
|
385
366
|
t < 0 || U(e, t);
|
|
386
367
|
},
|
|
387
|
-
onTouchStart:
|
|
388
|
-
onTouchMove:
|
|
389
|
-
onTouchEnd:
|
|
390
|
-
children:
|
|
368
|
+
onTouchStart: b === "dropdown" ? J : void 0,
|
|
369
|
+
onTouchMove: b === "dropdown" ? Y : void 0,
|
|
370
|
+
onTouchEnd: b === "dropdown" ? X : void 0,
|
|
371
|
+
children: ve()
|
|
391
372
|
}),
|
|
392
|
-
|
|
373
|
+
m && ce && /* @__PURE__ */ a("button", {
|
|
393
374
|
className: "tabs__scroll-arrow tabs__scroll-arrow--right",
|
|
394
375
|
onClick: () => {
|
|
395
376
|
G("right");
|
|
396
377
|
},
|
|
397
|
-
"aria-label":
|
|
378
|
+
"aria-label": ae,
|
|
398
379
|
tabIndex: -1,
|
|
399
|
-
children: /* @__PURE__ */
|
|
380
|
+
children: /* @__PURE__ */ a("svg", {
|
|
400
381
|
width: "20",
|
|
401
382
|
height: "20",
|
|
402
383
|
viewBox: "0 0 20 20",
|
|
403
384
|
fill: "none",
|
|
404
385
|
xmlns: "http://www.w3.org/2000/svg",
|
|
405
386
|
"aria-hidden": "true",
|
|
406
|
-
children: /* @__PURE__ */
|
|
387
|
+
children: /* @__PURE__ */ a("path", {
|
|
407
388
|
d: "M8 5L13 10L8 15",
|
|
408
389
|
stroke: "currentColor",
|
|
409
390
|
strokeWidth: "2",
|
|
@@ -412,20 +393,20 @@ function u({ tabs: u, groups: d = [], defaultTab: te, activeTab: f, onTabChange:
|
|
|
412
393
|
})
|
|
413
394
|
})
|
|
414
395
|
}),
|
|
415
|
-
|
|
396
|
+
ye()
|
|
416
397
|
]
|
|
417
|
-
}),
|
|
398
|
+
}), v && /* @__PURE__ */ a("div", {
|
|
418
399
|
id: `tabpanel-${z}`,
|
|
419
400
|
role: "tabpanel",
|
|
420
401
|
"aria-labelledby": `tab-${z}`,
|
|
421
|
-
className: `tabs__panel ${
|
|
402
|
+
className: `tabs__panel ${f}`.trim(),
|
|
422
403
|
tabIndex: 0,
|
|
423
404
|
children: Z
|
|
424
405
|
})]
|
|
425
406
|
});
|
|
426
407
|
}
|
|
427
408
|
//#endregion
|
|
428
|
-
export {
|
|
409
|
+
export { s as Tabs };
|
|
429
410
|
|
|
430
411
|
//# sourceMappingURL=Tabs2.js.map
|
|
431
412
|
import "../../assets/components/Tabs/Tabs.css";
|