@cfx-dev/ui-components 2.1.12 → 2.1.14
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/assets/Badge.css +1 -1
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/InputDropzone.css +1 -1
- package/dist/assets/ItemPreview.css +1 -1
- package/dist/assets/Modal.css +1 -1
- package/dist/assets/RichInput.css +1 -1
- package/dist/assets/Select.css +1 -1
- package/dist/assets/Table.css +1 -1
- package/dist/assets/Tabular.css +1 -1
- package/dist/assets/global.css +1 -1
- package/dist/components/Badge/Badge.d.ts +2 -0
- package/dist/components/Badge/Badge.js +23 -21
- package/dist/components/Badge/BadgeShowcase.js +44 -22
- package/dist/components/IconButton/IconButton.d.ts +2 -0
- package/dist/components/IconButton/IconButton.js +27 -24
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.js +94 -72
- package/dist/components/Input/InputShowcase.js +24 -10
- package/dist/components/Input/RichInput.js +28 -28
- package/dist/components/InputDropzone/InputDropzone.d.ts +9 -1
- package/dist/components/InputDropzone/InputDropzone.js +316 -300
- package/dist/components/InputDropzone/InputDropzoneShowcase.js +28 -18
- package/dist/components/InputDropzone/ItemPreview.d.ts +2 -1
- package/dist/components/InputDropzone/ItemPreview.js +20 -18
- package/dist/components/Modal/Modal.js +39 -39
- package/dist/components/Modal/ModalShowcase.js +18 -14
- package/dist/components/Select/Select.js +53 -53
- package/dist/components/Table/Table.d.ts +2 -0
- package/dist/components/Table/Table.js +87 -82
- package/dist/components/Tabular/Tabular.js +46 -46
- package/dist/main.d.ts +1 -1
- package/dist/main.js +43 -42
- package/dist/styles-scss/tokens.scss +5 -0
- package/package.json +1 -1
|
@@ -249,7 +249,7 @@ var dt = "focusScope.autoFocusOnMount", ft = "focusScope.autoFocusOnUnmount", Yt
|
|
|
249
249
|
const d = document.activeElement;
|
|
250
250
|
if (!s.contains(d)) {
|
|
251
251
|
const h = new CustomEvent(dt, Yt);
|
|
252
|
-
s.addEventListener(dt, l), s.dispatchEvent(h), h.defaultPrevented || (
|
|
252
|
+
s.addEventListener(dt, l), s.dispatchEvent(h), h.defaultPrevented || (qo(er(wn(s)), { select: !0 }), document.activeElement === d && ue(s));
|
|
253
253
|
}
|
|
254
254
|
return () => {
|
|
255
255
|
s.removeEventListener(dt, l), setTimeout(() => {
|
|
@@ -264,7 +264,7 @@ var dt = "focusScope.autoFocusOnMount", ft = "focusScope.autoFocusOnUnmount", Yt
|
|
|
264
264
|
if (!n && !o || m.paused) return;
|
|
265
265
|
const g = d.key === "Tab" && !d.altKey && !d.ctrlKey && !d.metaKey, h = document.activeElement;
|
|
266
266
|
if (g && h) {
|
|
267
|
-
const y = d.currentTarget, [x, S] =
|
|
267
|
+
const y = d.currentTarget, [x, S] = Go(y);
|
|
268
268
|
x && S ? !d.shiftKey && h === S ? (d.preventDefault(), n && ue(x, { select: !0 })) : d.shiftKey && h === x && (d.preventDefault(), n && ue(S, { select: !0 })) : h === y && d.preventDefault();
|
|
269
269
|
}
|
|
270
270
|
},
|
|
@@ -273,12 +273,12 @@ var dt = "focusScope.autoFocusOnMount", ft = "focusScope.autoFocusOnUnmount", Yt
|
|
|
273
273
|
return /* @__PURE__ */ C(U.div, { tabIndex: -1, ...c, ref: w, onKeyDown: v });
|
|
274
274
|
});
|
|
275
275
|
gn.displayName = Xo;
|
|
276
|
-
function
|
|
276
|
+
function qo(e, { select: t = !1 } = {}) {
|
|
277
277
|
const n = document.activeElement;
|
|
278
278
|
for (const o of e)
|
|
279
279
|
if (ue(o, { select: t }), document.activeElement !== n) return;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function Go(e) {
|
|
282
282
|
const t = wn(e), n = jt(t, e), o = jt(t.reverse(), e);
|
|
283
283
|
return [n, o];
|
|
284
284
|
}
|
|
@@ -320,15 +320,15 @@ function Jo() {
|
|
|
320
320
|
return {
|
|
321
321
|
add(t) {
|
|
322
322
|
const n = e[0];
|
|
323
|
-
t !== n && (n == null || n.pause()), e =
|
|
323
|
+
t !== n && (n == null || n.pause()), e = qt(e, t), e.unshift(t);
|
|
324
324
|
},
|
|
325
325
|
remove(t) {
|
|
326
326
|
var n;
|
|
327
|
-
e =
|
|
327
|
+
e = qt(e, t), (n = e[0]) == null || n.resume();
|
|
328
328
|
}
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function qt(e, t) {
|
|
332
332
|
const n = [...e], o = n.indexOf(t);
|
|
333
333
|
return o !== -1 && n.splice(o, 1), n;
|
|
334
334
|
}
|
|
@@ -343,7 +343,7 @@ function Nt(e) {
|
|
|
343
343
|
n((o) => o ?? String(nr++));
|
|
344
344
|
}, [e]), t ? `radix-${t}` : "";
|
|
345
345
|
}
|
|
346
|
-
const or = ["top", "right", "bottom", "left"], te = Math.min,
|
|
346
|
+
const or = ["top", "right", "bottom", "left"], te = Math.min, q = Math.max, Je = Math.round, Ke = Math.floor, pe = (e) => ({
|
|
347
347
|
x: e,
|
|
348
348
|
y: e
|
|
349
349
|
}), rr = {
|
|
@@ -356,7 +356,7 @@ const or = ["top", "right", "bottom", "left"], te = Math.min, G = Math.max, Je =
|
|
|
356
356
|
end: "start"
|
|
357
357
|
};
|
|
358
358
|
function yt(e, t, n) {
|
|
359
|
-
return
|
|
359
|
+
return q(e, te(t, n));
|
|
360
360
|
}
|
|
361
361
|
function se(e, t) {
|
|
362
362
|
return typeof e == "function" ? e(t) : e;
|
|
@@ -448,7 +448,7 @@ function tt(e) {
|
|
|
448
448
|
y: n
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function Gt(e, t, n) {
|
|
452
452
|
let {
|
|
453
453
|
reference: o,
|
|
454
454
|
floating: r
|
|
@@ -510,7 +510,7 @@ const dr = async (e, t, n) => {
|
|
|
510
510
|
}), {
|
|
511
511
|
x: p,
|
|
512
512
|
y: f
|
|
513
|
-
} =
|
|
513
|
+
} = Gt(l, o, a), w = o, m = {}, v = 0;
|
|
514
514
|
for (let d = 0; d < s.length; d++) {
|
|
515
515
|
const {
|
|
516
516
|
name: g,
|
|
@@ -547,7 +547,7 @@ const dr = async (e, t, n) => {
|
|
|
547
547
|
}) : b.rects), {
|
|
548
548
|
x: p,
|
|
549
549
|
y: f
|
|
550
|
-
} =
|
|
550
|
+
} = Gt(l, w, a)), d = -1);
|
|
551
551
|
}
|
|
552
552
|
return {
|
|
553
553
|
x: p,
|
|
@@ -939,8 +939,8 @@ const vr = function(e) {
|
|
|
939
939
|
const g = m - a.top - a.bottom, h = w - a.left - a.right, y = te(m - a[v], g), x = te(w - a[d], h), S = !t.middlewareData.shift;
|
|
940
940
|
let b = y, P = x;
|
|
941
941
|
if (f ? P = p || S ? te(x, h) : h : b = p || S ? te(y, g) : g, S && !p) {
|
|
942
|
-
const T =
|
|
943
|
-
f ? P = w - 2 * (T !== 0 || I !== 0 ? T + I :
|
|
942
|
+
const T = q(a.left, 0), I = q(a.right, 0), _ = q(a.top, 0), V = q(a.bottom, 0);
|
|
943
|
+
f ? P = w - 2 * (T !== 0 || I !== 0 ? T + I : q(a.left, a.right)) : b = m - 2 * (_ !== 0 || V !== 0 ? _ + V : q(a.top, a.bottom));
|
|
944
944
|
}
|
|
945
945
|
await c({
|
|
946
946
|
...t,
|
|
@@ -959,7 +959,7 @@ const vr = function(e) {
|
|
|
959
959
|
function _e(e) {
|
|
960
960
|
return xn(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function G(e) {
|
|
963
963
|
var t;
|
|
964
964
|
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
965
965
|
}
|
|
@@ -968,16 +968,16 @@ function ae(e) {
|
|
|
968
968
|
return (t = (xn(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
|
|
969
969
|
}
|
|
970
970
|
function xn(e) {
|
|
971
|
-
return e instanceof Node || e instanceof
|
|
971
|
+
return e instanceof Node || e instanceof G(e).Node;
|
|
972
972
|
}
|
|
973
973
|
function ne(e) {
|
|
974
|
-
return e instanceof Element || e instanceof
|
|
974
|
+
return e instanceof Element || e instanceof G(e).Element;
|
|
975
975
|
}
|
|
976
976
|
function oe(e) {
|
|
977
|
-
return e instanceof HTMLElement || e instanceof
|
|
977
|
+
return e instanceof HTMLElement || e instanceof G(e).HTMLElement;
|
|
978
978
|
}
|
|
979
979
|
function Jt(e) {
|
|
980
|
-
return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof
|
|
980
|
+
return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof G(e).ShadowRoot;
|
|
981
981
|
}
|
|
982
982
|
function $e(e) {
|
|
983
983
|
const {
|
|
@@ -1022,7 +1022,7 @@ function Ne(e) {
|
|
|
1022
1022
|
return ["html", "body", "#document"].includes(_e(e));
|
|
1023
1023
|
}
|
|
1024
1024
|
function J(e) {
|
|
1025
|
-
return
|
|
1025
|
+
return G(e).getComputedStyle(e);
|
|
1026
1026
|
}
|
|
1027
1027
|
function it(e) {
|
|
1028
1028
|
return ne(e) ? {
|
|
@@ -1052,7 +1052,7 @@ function Sn(e) {
|
|
|
1052
1052
|
function Ve(e, t, n) {
|
|
1053
1053
|
var o;
|
|
1054
1054
|
t === void 0 && (t = []), n === void 0 && (n = !0);
|
|
1055
|
-
const r = Sn(e), i = r === ((o = e.ownerDocument) == null ? void 0 : o.body), c =
|
|
1055
|
+
const r = Sn(e), i = r === ((o = e.ownerDocument) == null ? void 0 : o.body), c = G(r);
|
|
1056
1056
|
return i ? t.concat(c, c.visualViewport || [], $e(r) ? r : [], c.frameElement && n ? Ve(c.frameElement) : []) : t.concat(r, Ve(r, [], n));
|
|
1057
1057
|
}
|
|
1058
1058
|
function bn(e) {
|
|
@@ -1085,14 +1085,14 @@ function Te(e) {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
const br = /* @__PURE__ */ pe(0);
|
|
1087
1087
|
function Cn(e) {
|
|
1088
|
-
const t =
|
|
1088
|
+
const t = G(e);
|
|
1089
1089
|
return !Dt() || !t.visualViewport ? br : {
|
|
1090
1090
|
x: t.visualViewport.offsetLeft,
|
|
1091
1091
|
y: t.visualViewport.offsetTop
|
|
1092
1092
|
};
|
|
1093
1093
|
}
|
|
1094
1094
|
function Cr(e, t, n) {
|
|
1095
|
-
return t === void 0 && (t = !1), !n || t && n !==
|
|
1095
|
+
return t === void 0 && (t = !1), !n || t && n !== G(e) ? !1 : t;
|
|
1096
1096
|
}
|
|
1097
1097
|
function be(e, t, n, o) {
|
|
1098
1098
|
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
@@ -1102,11 +1102,11 @@ function be(e, t, n, o) {
|
|
|
1102
1102
|
const s = Cr(i, n, o) ? Cn(i) : pe(0);
|
|
1103
1103
|
let a = (r.left + s.x) / c.x, l = (r.top + s.y) / c.y, p = r.width / c.x, f = r.height / c.y;
|
|
1104
1104
|
if (i) {
|
|
1105
|
-
const w =
|
|
1105
|
+
const w = G(i), m = o && ne(o) ? G(o) : o;
|
|
1106
1106
|
let v = w, d = v.frameElement;
|
|
1107
1107
|
for (; d && o && m !== v; ) {
|
|
1108
1108
|
const g = Te(d), h = d.getBoundingClientRect(), y = J(d), x = h.left + (d.clientLeft + parseFloat(y.paddingLeft)) * g.x, S = h.top + (d.clientTop + parseFloat(y.paddingTop)) * g.y;
|
|
1109
|
-
a *= g.x, l *= g.y, p *= g.x, f *= g.y, a += x, l += S, v =
|
|
1109
|
+
a *= g.x, l *= g.y, p *= g.x, f *= g.y, a += x, l += S, v = G(d), d = v.frameElement;
|
|
1110
1110
|
}
|
|
1111
1111
|
}
|
|
1112
1112
|
return tt({
|
|
@@ -1149,10 +1149,10 @@ function En(e) {
|
|
|
1149
1149
|
return be(ae(e)).left + it(e).scrollLeft;
|
|
1150
1150
|
}
|
|
1151
1151
|
function Rr(e) {
|
|
1152
|
-
const t = ae(e), n = it(e), o = e.ownerDocument.body, r =
|
|
1152
|
+
const t = ae(e), n = it(e), o = e.ownerDocument.body, r = q(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), i = q(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
|
|
1153
1153
|
let c = -n.scrollLeft + En(e);
|
|
1154
1154
|
const s = -n.scrollTop;
|
|
1155
|
-
return J(o).direction === "rtl" && (c +=
|
|
1155
|
+
return J(o).direction === "rtl" && (c += q(t.clientWidth, o.clientWidth) - r), {
|
|
1156
1156
|
width: r,
|
|
1157
1157
|
height: i,
|
|
1158
1158
|
x: c,
|
|
@@ -1160,7 +1160,7 @@ function Rr(e) {
|
|
|
1160
1160
|
};
|
|
1161
1161
|
}
|
|
1162
1162
|
function Ar(e, t) {
|
|
1163
|
-
const n =
|
|
1163
|
+
const n = G(e), o = ae(e), r = n.visualViewport;
|
|
1164
1164
|
let i = o.clientWidth, c = o.clientHeight, s = 0, a = 0;
|
|
1165
1165
|
if (r) {
|
|
1166
1166
|
i = r.width, c = r.height;
|
|
@@ -1227,7 +1227,7 @@ function Nr(e) {
|
|
|
1227
1227
|
} = e;
|
|
1228
1228
|
const c = [...n === "clippingAncestors" ? rt(t) ? [] : Or(t, this._c) : [].concat(n), o], s = c[0], a = c.reduce((l, p) => {
|
|
1229
1229
|
const f = en(t, p, r);
|
|
1230
|
-
return l.top =
|
|
1230
|
+
return l.top = q(f.top, l.top), l.right = te(f.right, l.right), l.bottom = te(f.bottom, l.bottom), l.left = q(f.left, l.left), l;
|
|
1231
1231
|
}, en(t, s, r));
|
|
1232
1232
|
return {
|
|
1233
1233
|
width: a.right - a.left,
|
|
@@ -1273,7 +1273,7 @@ function tn(e, t) {
|
|
|
1273
1273
|
return !oe(e) || J(e).position === "fixed" ? null : t ? t(e) : e.offsetParent;
|
|
1274
1274
|
}
|
|
1275
1275
|
function Rn(e, t) {
|
|
1276
|
-
const n =
|
|
1276
|
+
const n = G(e);
|
|
1277
1277
|
if (rt(e))
|
|
1278
1278
|
return n;
|
|
1279
1279
|
if (!oe(e)) {
|
|
@@ -1336,7 +1336,7 @@ function kr(e, t) {
|
|
|
1336
1336
|
return;
|
|
1337
1337
|
const m = Ke(p), v = Ke(r.clientWidth - (l + f)), d = Ke(r.clientHeight - (p + w)), g = Ke(l), y = {
|
|
1338
1338
|
rootMargin: -m + "px " + -v + "px " + -d + "px " + -g + "px",
|
|
1339
|
-
threshold:
|
|
1339
|
+
threshold: q(0, te(1, a)) || 1
|
|
1340
1340
|
};
|
|
1341
1341
|
let x = !0;
|
|
1342
1342
|
function S(b) {
|
|
@@ -1412,7 +1412,7 @@ const Fr = vr, Wr = gr, Hr = pr, Vr = yr, $r = mr, nn = fr, Ur = wr, zr = (e, t,
|
|
|
1412
1412
|
platform: i
|
|
1413
1413
|
});
|
|
1414
1414
|
};
|
|
1415
|
-
var
|
|
1415
|
+
var Ge = typeof document < "u" ? Po : Ro;
|
|
1416
1416
|
function nt(e, t) {
|
|
1417
1417
|
if (e === t)
|
|
1418
1418
|
return !0;
|
|
@@ -1452,7 +1452,7 @@ function on(e, t) {
|
|
|
1452
1452
|
}
|
|
1453
1453
|
function rn(e) {
|
|
1454
1454
|
const t = u.useRef(e);
|
|
1455
|
-
return
|
|
1455
|
+
return Ge(() => {
|
|
1456
1456
|
t.current = e;
|
|
1457
1457
|
}), t;
|
|
1458
1458
|
}
|
|
@@ -1501,16 +1501,16 @@ function Kr(e) {
|
|
|
1501
1501
|
}));
|
|
1502
1502
|
});
|
|
1503
1503
|
}, [w, t, n, V]);
|
|
1504
|
-
|
|
1504
|
+
Ge(() => {
|
|
1505
1505
|
l === !1 && T.current.isPositioned && (T.current.isPositioned = !1, f((A) => ({
|
|
1506
1506
|
...A,
|
|
1507
1507
|
isPositioned: !1
|
|
1508
1508
|
})));
|
|
1509
1509
|
}, [l]);
|
|
1510
1510
|
const $ = u.useRef(!1);
|
|
1511
|
-
|
|
1511
|
+
Ge(() => ($.current = !0, () => {
|
|
1512
1512
|
$.current = !1;
|
|
1513
|
-
}), []),
|
|
1513
|
+
}), []), Ge(() => {
|
|
1514
1514
|
if (S && (P.current = S), b && (E.current = b), S && b) {
|
|
1515
1515
|
if (_.current)
|
|
1516
1516
|
return _.current(S, b, B);
|
|
@@ -1581,10 +1581,10 @@ const Yr = (e) => {
|
|
|
1581
1581
|
}), Xr = (e, t) => ({
|
|
1582
1582
|
...Wr(e),
|
|
1583
1583
|
options: [e, t]
|
|
1584
|
-
}),
|
|
1584
|
+
}), qr = (e, t) => ({
|
|
1585
1585
|
...Ur(e),
|
|
1586
1586
|
options: [e, t]
|
|
1587
|
-
}),
|
|
1587
|
+
}), Gr = (e, t) => ({
|
|
1588
1588
|
...Hr(e),
|
|
1589
1589
|
options: [e, t]
|
|
1590
1590
|
}), Zr = (e, t) => ({
|
|
@@ -1665,10 +1665,10 @@ var Ft = "PopperContent", [oi, ri] = On(Ft), Dn = u.forwardRef(
|
|
|
1665
1665
|
a && Xr({
|
|
1666
1666
|
mainAxis: !0,
|
|
1667
1667
|
crossAxis: !1,
|
|
1668
|
-
limiter: f === "partial" ?
|
|
1668
|
+
limiter: f === "partial" ? qr() : void 0,
|
|
1669
1669
|
...$
|
|
1670
1670
|
}),
|
|
1671
|
-
a &&
|
|
1671
|
+
a && Gr({ ...$ }),
|
|
1672
1672
|
Zr({
|
|
1673
1673
|
...$,
|
|
1674
1674
|
apply: ({ elements: X, rects: ee, availableWidth: ke, availableHeight: Be }) => {
|
|
@@ -2107,7 +2107,7 @@ var Re = St ? { passive: !1 } : !1, Mi = function(e) {
|
|
|
2107
2107
|
a && (t.contains(s) || t === s)
|
|
2108
2108
|
);
|
|
2109
2109
|
return (p && (Math.abs(f) < 1 || !r) || !p && (Math.abs(w) < 1 || !r)) && (l = !0), l;
|
|
2110
|
-
},
|
|
2110
|
+
}, qe = function(e) {
|
|
2111
2111
|
return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
|
|
2112
2112
|
}, an = function(e) {
|
|
2113
2113
|
return [e.deltaX, e.deltaY];
|
|
@@ -2141,7 +2141,7 @@ function Ui(e) {
|
|
|
2141
2141
|
var s = u.useCallback(function(d, g) {
|
|
2142
2142
|
if ("touches" in d && d.touches.length === 2)
|
|
2143
2143
|
return !c.current.allowPinchZoom;
|
|
2144
|
-
var h =
|
|
2144
|
+
var h = qe(d), y = n.current, x = "deltaX" in d ? d.deltaX : y[0] - h[0], S = "deltaY" in d ? d.deltaY : y[1] - h[1], b, P = d.target, E = Math.abs(x) > Math.abs(S) ? "h" : "v";
|
|
2145
2145
|
if ("touches" in d && E === "h" && P.type === "range")
|
|
2146
2146
|
return !1;
|
|
2147
2147
|
var T = cn(E, P);
|
|
@@ -2156,7 +2156,7 @@ function Ui(e) {
|
|
|
2156
2156
|
}, []), a = u.useCallback(function(d) {
|
|
2157
2157
|
var g = d;
|
|
2158
2158
|
if (!(!Ae.length || Ae[Ae.length - 1] !== i)) {
|
|
2159
|
-
var h = "deltaY" in g ? an(g) :
|
|
2159
|
+
var h = "deltaY" in g ? an(g) : qe(g), y = t.current.filter(function(b) {
|
|
2160
2160
|
return b.name === g.type && (b.target === g.target || g.target === b.shadowParent) && Hi(b.delta, h);
|
|
2161
2161
|
})[0];
|
|
2162
2162
|
if (y && y.should) {
|
|
@@ -2178,11 +2178,11 @@ function Ui(e) {
|
|
|
2178
2178
|
});
|
|
2179
2179
|
}, 1);
|
|
2180
2180
|
}, []), p = u.useCallback(function(d) {
|
|
2181
|
-
n.current =
|
|
2181
|
+
n.current = qe(d), o.current = void 0;
|
|
2182
2182
|
}, []), f = u.useCallback(function(d) {
|
|
2183
2183
|
l(d.type, an(d), d.target, s(d, e.lockRef.current));
|
|
2184
2184
|
}, []), w = u.useCallback(function(d) {
|
|
2185
|
-
l(d.type,
|
|
2185
|
+
l(d.type, qe(d), d.target, s(d, e.lockRef.current));
|
|
2186
2186
|
}, []);
|
|
2187
2187
|
u.useEffect(function() {
|
|
2188
2188
|
return Ae.push(i), e.setCallbacks({
|
|
@@ -2216,7 +2216,7 @@ jn.classNames = st.classNames;
|
|
|
2216
2216
|
var Yi = [" ", "Enter", "ArrowUp", "ArrowDown"], ji = [" ", "Enter"], Ue = "Select", [ct, at, Xi] = ko(Ue), [Me, Ys] = Ot(Ue, [
|
|
2217
2217
|
Xi,
|
|
2218
2218
|
Nn
|
|
2219
|
-
]), lt = Nn(), [
|
|
2219
|
+
]), lt = Nn(), [qi, ve] = Me(Ue), [Gi, Zi] = Me(Ue), Xn = (e) => {
|
|
2220
2220
|
const {
|
|
2221
2221
|
__scopeSelect: t,
|
|
2222
2222
|
children: n,
|
|
@@ -2241,7 +2241,7 @@ var Yi = [" ", "Enter", "ArrowUp", "ArrowDown"], ji = [" ", "Enter"], Ue = "Sele
|
|
|
2241
2241
|
onChange: a
|
|
2242
2242
|
}), _ = u.useRef(null), V = d ? !!d.closest("form") : !0, [B, $] = u.useState(/* @__PURE__ */ new Set()), N = Array.from(B).map((O) => O.props.value).join(";");
|
|
2243
2243
|
return /* @__PURE__ */ C(ai, { ...v, children: /* @__PURE__ */ de(
|
|
2244
|
-
|
|
2244
|
+
qi,
|
|
2245
2245
|
{
|
|
2246
2246
|
required: m,
|
|
2247
2247
|
scope: t,
|
|
@@ -2261,7 +2261,7 @@ var Yi = [" ", "Enter", "ArrowUp", "ArrowDown"], ji = [" ", "Enter"], Ue = "Sele
|
|
|
2261
2261
|
disabled: w,
|
|
2262
2262
|
children: [
|
|
2263
2263
|
/* @__PURE__ */ C(ct.Provider, { scope: t, children: /* @__PURE__ */ C(
|
|
2264
|
-
|
|
2264
|
+
Gi,
|
|
2265
2265
|
{
|
|
2266
2266
|
scope: e.__scopeSelect,
|
|
2267
2267
|
onNativeOptionAdd: u.useCallback((O) => {
|
|
@@ -2299,9 +2299,9 @@ var Yi = [" ", "Enter", "ArrowUp", "ArrowDown"], ji = [" ", "Enter"], Ue = "Sele
|
|
|
2299
2299
|
) });
|
|
2300
2300
|
};
|
|
2301
2301
|
Xn.displayName = Ue;
|
|
2302
|
-
var
|
|
2302
|
+
var qn = "SelectTrigger", Gn = u.forwardRef(
|
|
2303
2303
|
(e, t) => {
|
|
2304
|
-
const { __scopeSelect: n, disabled: o = !1, ...r } = e, i = lt(n), c = ve(
|
|
2304
|
+
const { __scopeSelect: n, disabled: o = !1, ...r } = e, i = lt(n), c = ve(qn, n), s = c.disabled || o, a = K(t, c.onTriggerChange), l = at(n), [p, f, w] = yo((v) => {
|
|
2305
2305
|
const d = l().filter((y) => !y.disabled), g = d.find((y) => y.value === c.value), h = xo(d, v, g);
|
|
2306
2306
|
h !== void 0 && c.onValueChange(h.value);
|
|
2307
2307
|
}), m = () => {
|
|
@@ -2341,7 +2341,7 @@ var Gn = "SelectTrigger", qn = u.forwardRef(
|
|
|
2341
2341
|
) });
|
|
2342
2342
|
}
|
|
2343
2343
|
);
|
|
2344
|
-
|
|
2344
|
+
Gn.displayName = qn;
|
|
2345
2345
|
var Zn = "SelectValue", Qn = u.forwardRef(
|
|
2346
2346
|
(e, t) => {
|
|
2347
2347
|
const { __scopeSelect: n, className: o, style: r, children: i, placeholder: c = "", ...s } = e, a = ve(Zn, n), { onValueNodeHasChildrenChange: l } = a, p = i !== void 0, f = K(t, a.onValueNodeChange);
|
|
@@ -2979,7 +2979,7 @@ function xo(e, t, n) {
|
|
|
2979
2979
|
function fs(e, t) {
|
|
2980
2980
|
return e.map((n, o) => e[(t + o) % e.length]);
|
|
2981
2981
|
}
|
|
2982
|
-
var ps = Xn, ms =
|
|
2982
|
+
var ps = Xn, ms = Gn, hs = Qn, vs = Jn, gs = eo, ws = to, ys = io, xs = lo, Ss = uo, bs = po, Cs = mo, Es = ho, So = {
|
|
2983
2983
|
color: void 0,
|
|
2984
2984
|
size: void 0,
|
|
2985
2985
|
className: void 0,
|
|
@@ -3041,7 +3041,7 @@ function dn(e) {
|
|
|
3041
3041
|
function As(e) {
|
|
3042
3042
|
return Co({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708l6-6z" } }] })(e);
|
|
3043
3043
|
}
|
|
3044
|
-
const Ts = "
|
|
3044
|
+
const Ts = "_content_4qddr_1", Os = "_option_4qddr_1", Ns = "_trigger_4qddr_1", Is = "_small_4qddr_5", _s = "_large_4qddr_9", Ms = "_fullWidth_4qddr_131", Ls = "_icon_4qddr_135", Ds = "_app_4qddr_1", ks = "_arrow_4qddr_155", Q = {
|
|
3045
3045
|
content: Ts,
|
|
3046
3046
|
option: Os,
|
|
3047
3047
|
trigger: Ns,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { IconButtonProps } from '../IconButton';
|
|
2
3
|
|
|
3
4
|
export interface TableHeaderType {
|
|
4
5
|
text: string;
|
|
@@ -9,6 +10,7 @@ export type TableRowType = Array<string | number | Date | React.ReactNode>;
|
|
|
9
10
|
export type DataContainerType = React.FC<{
|
|
10
11
|
item: string | number | Date | React.ReactNode;
|
|
11
12
|
}>;
|
|
13
|
+
export declare function TableIconButton(props: IconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
interface TableHeaderItemProps {
|
|
13
15
|
item: TableHeaderType;
|
|
14
16
|
onSortClick?: (sortKey: string) => void;
|
|
@@ -1,85 +1,89 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import s, { useState as p } from "react";
|
|
3
3
|
import B from "../Checkbox/Checkbox.js";
|
|
4
|
-
import
|
|
5
|
-
import { Text as
|
|
6
|
-
import { clsx as
|
|
7
|
-
import '../../assets/Table.css';const j = "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
sortButton: H
|
|
4
|
+
import T from "../IconButton/IconButton.js";
|
|
5
|
+
import { Text as $ } from "../Text/Text.js";
|
|
6
|
+
import { clsx as k } from "../../utils/clsx.js";
|
|
7
|
+
import '../../assets/Table.css';const j = "_iconButton_1yv0x_1", z = "_root_1yv0x_21", A = "_radio_1yv0x_34", E = "_radioContent_1yv0x_37", O = "_pointer_1yv0x_44", S = "_selectedRow_1yv0x_47", F = "_headerContent_1yv0x_57", l = {
|
|
8
|
+
iconButton: j,
|
|
9
|
+
root: z,
|
|
10
|
+
radio: A,
|
|
11
|
+
radioContent: E,
|
|
12
|
+
pointer: O,
|
|
13
|
+
selectedRow: S,
|
|
14
|
+
headerContent: F
|
|
16
15
|
};
|
|
17
|
-
function
|
|
16
|
+
function H(r) {
|
|
17
|
+
const {
|
|
18
|
+
className: e,
|
|
19
|
+
color: o = "inherit"
|
|
20
|
+
} = r, n = k(l.iconButton, e);
|
|
21
|
+
return /* @__PURE__ */ t(T, { ...r, className: n, color: o });
|
|
22
|
+
}
|
|
23
|
+
function I(r) {
|
|
18
24
|
const {
|
|
19
25
|
item: e,
|
|
20
26
|
onSortClick: o
|
|
21
|
-
} =
|
|
27
|
+
} = r, n = s.useCallback(() => {
|
|
22
28
|
o && o(e.sortKey || e.text);
|
|
23
|
-
}, [e.sortKey, e.text, o]),
|
|
24
|
-
[
|
|
25
|
-
[
|
|
29
|
+
}, [e.sortKey, e.text, o]), _ = k(l.headerContent, {
|
|
30
|
+
[l.sortable]: e.sortable,
|
|
31
|
+
[l.empty]: !e.text
|
|
26
32
|
});
|
|
27
33
|
return /* @__PURE__ */ t(
|
|
28
34
|
"th",
|
|
29
35
|
{
|
|
30
|
-
className: e.sortable ?
|
|
31
|
-
onClick: e.sortable ?
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */ t(
|
|
36
|
+
className: e.sortable ? l.pointer : void 0,
|
|
37
|
+
onClick: e.sortable ? n : void 0,
|
|
38
|
+
children: /* @__PURE__ */ C("div", { className: _, children: [
|
|
39
|
+
/* @__PURE__ */ t($, { color: "secondary", weight: "bold", uppercase: !0, size: "xxsmall", children: e.text }),
|
|
34
40
|
!!e.sortable && /* @__PURE__ */ t(
|
|
35
|
-
|
|
41
|
+
H,
|
|
36
42
|
{
|
|
37
|
-
className: r.sortButton,
|
|
38
|
-
color: "secondary",
|
|
39
43
|
name: "Sort",
|
|
40
|
-
onClick:
|
|
44
|
+
onClick: n
|
|
41
45
|
}
|
|
42
46
|
)
|
|
43
47
|
] })
|
|
44
48
|
}
|
|
45
49
|
);
|
|
46
50
|
}
|
|
47
|
-
function
|
|
51
|
+
function V(r) {
|
|
48
52
|
const {
|
|
49
53
|
index: e,
|
|
50
54
|
includeRadio: o = !1,
|
|
51
|
-
selectedRow:
|
|
52
|
-
item:
|
|
53
|
-
dataContainer:
|
|
54
|
-
onSelectChange:
|
|
55
|
-
} =
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
selectedRow: n,
|
|
56
|
+
item: _,
|
|
57
|
+
dataContainer: h,
|
|
58
|
+
onSelectChange: i
|
|
59
|
+
} = r, f = s.useCallback((a) => {
|
|
60
|
+
i(
|
|
61
|
+
a ? e : null
|
|
58
62
|
);
|
|
59
|
-
}, [
|
|
60
|
-
|
|
61
|
-
}, [
|
|
62
|
-
[
|
|
63
|
-
[
|
|
63
|
+
}, [i, e]), u = s.useCallback(() => {
|
|
64
|
+
i(e);
|
|
65
|
+
}, [i, e]), b = k({
|
|
66
|
+
[l.selectedRow]: n === e,
|
|
67
|
+
[l.pointer]: o
|
|
64
68
|
});
|
|
65
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ C(
|
|
66
70
|
"tr",
|
|
67
71
|
{
|
|
68
|
-
className:
|
|
69
|
-
onClick: o ?
|
|
72
|
+
className: b,
|
|
73
|
+
onClick: o ? u : void 0,
|
|
70
74
|
children: [
|
|
71
|
-
o && /* @__PURE__ */ t("td", { className:
|
|
75
|
+
o && /* @__PURE__ */ t("td", { className: l.radio, children: /* @__PURE__ */ t("div", { className: l.radioContent, children: /* @__PURE__ */ t(
|
|
72
76
|
B,
|
|
73
77
|
{
|
|
74
78
|
size: "small",
|
|
75
79
|
onCheckedChange: f,
|
|
76
80
|
"aria-label": `${e}`,
|
|
77
|
-
checked:
|
|
81
|
+
checked: n === e
|
|
78
82
|
}
|
|
79
|
-
) }),
|
|
80
|
-
|
|
81
|
-
let
|
|
82
|
-
return
|
|
83
|
+
) }) }),
|
|
84
|
+
_.map((a, x) => {
|
|
85
|
+
let m;
|
|
86
|
+
return s.isValidElement(a) ? m = a : h ? m = s.createElement(h, { item: a }) : m = String(a), /* @__PURE__ */ t("td", { children: m }, `item-${x}`);
|
|
83
87
|
})
|
|
84
88
|
]
|
|
85
89
|
},
|
|
@@ -87,59 +91,60 @@ function q(h) {
|
|
|
87
91
|
);
|
|
88
92
|
}
|
|
89
93
|
function M({
|
|
90
|
-
headers:
|
|
94
|
+
headers: r = [],
|
|
91
95
|
data: e = [],
|
|
92
96
|
includeRadio: o = !1,
|
|
93
|
-
onSelectChange:
|
|
94
|
-
dataContainer:
|
|
95
|
-
selectedRow:
|
|
96
|
-
sortBy:
|
|
97
|
+
onSelectChange: n,
|
|
98
|
+
dataContainer: _,
|
|
99
|
+
selectedRow: h = null,
|
|
100
|
+
sortBy: i,
|
|
97
101
|
sortOrder: f = "asc",
|
|
98
|
-
onSortChange:
|
|
102
|
+
onSortChange: u
|
|
99
103
|
}) {
|
|
100
|
-
const [
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
}, [
|
|
104
|
+
const [b, a] = p(h), [x, m] = p(i), [v, w] = p(f), N = s.useCallback((c) => {
|
|
105
|
+
const y = x === c && v === "asc" ? "desc" : "asc";
|
|
106
|
+
m(c), w(y), u == null || u(c, y);
|
|
107
|
+
}, [u, x, v]), R = s.useCallback(
|
|
104
108
|
(c) => {
|
|
105
|
-
const
|
|
106
|
-
|
|
109
|
+
const d = c === b ? null : c;
|
|
110
|
+
a(d), n == null || n(d);
|
|
107
111
|
},
|
|
108
|
-
[
|
|
112
|
+
[n, b]
|
|
109
113
|
);
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
}, [
|
|
113
|
-
|
|
114
|
-
}, [
|
|
115
|
-
|
|
116
|
-
}, [f]), /* @__PURE__ */ t("div", { className:
|
|
117
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */
|
|
114
|
+
return s.useEffect(() => {
|
|
115
|
+
a(h);
|
|
116
|
+
}, [h]), s.useEffect(() => {
|
|
117
|
+
m(i);
|
|
118
|
+
}, [i]), s.useEffect(() => {
|
|
119
|
+
w(f);
|
|
120
|
+
}, [f]), /* @__PURE__ */ t("div", { className: l.root, children: /* @__PURE__ */ C("table", { children: [
|
|
121
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ C("tr", { children: [
|
|
118
122
|
o && /* @__PURE__ */ t("th", { "aria-label": "Select Row" }),
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
r.map((c, d) => /* @__PURE__ */ t(
|
|
124
|
+
I,
|
|
121
125
|
{
|
|
122
126
|
item: c,
|
|
123
|
-
onSortClick:
|
|
127
|
+
onSortClick: N
|
|
124
128
|
},
|
|
125
|
-
`header-${
|
|
129
|
+
`header-${d}`
|
|
126
130
|
))
|
|
127
131
|
] }) }),
|
|
128
|
-
/* @__PURE__ */ t("tbody", { children: e.map((c,
|
|
129
|
-
|
|
132
|
+
/* @__PURE__ */ t("tbody", { children: e.map((c, d) => /* @__PURE__ */ t(
|
|
133
|
+
V,
|
|
130
134
|
{
|
|
131
|
-
index:
|
|
135
|
+
index: d,
|
|
132
136
|
item: c,
|
|
133
137
|
includeRadio: o,
|
|
134
|
-
selectedRow:
|
|
135
|
-
onSelectChange:
|
|
136
|
-
dataContainer:
|
|
138
|
+
selectedRow: b,
|
|
139
|
+
onSelectChange: R,
|
|
140
|
+
dataContainer: _
|
|
137
141
|
},
|
|
138
|
-
`row-${
|
|
142
|
+
`row-${d}`
|
|
139
143
|
)) })
|
|
140
144
|
] }) });
|
|
141
145
|
}
|
|
142
146
|
export {
|
|
143
147
|
M as Table,
|
|
144
|
-
|
|
148
|
+
I as TableHeaderItem,
|
|
149
|
+
H as TableIconButton
|
|
145
150
|
};
|