@versini/ui-table 4.0.15 → 4.0.17
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 -0
- package/dist/components/Table/Table.js +41 -44
- package/dist/components/TableConstants/TableConstants.js +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -11
- package/package.json +16 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @versini/ui-table
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@versini/ui-table)
|
|
4
|
+
>)
|
|
4
5
|
|
|
5
6
|
> An accessible and feature-rich React table component built with TypeScript and TailwindCSS.
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as o, jsxs as N, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import z, { useRef as w, useLayoutEffect as q, useEffect as U, useState as ne, useMemo as K, useCallback as de, useContext as B } from "react";
|
|
3
3
|
import l from "clsx";
|
|
4
|
+
import { TableCellSortDirections as R } from "../TableConstants/TableConstants.js";
|
|
4
5
|
const Y = "av-button", W = "icon", Q = "button", P = "link", he = ({
|
|
5
6
|
type: e,
|
|
6
7
|
size: r,
|
|
@@ -327,7 +328,7 @@ const Y = "av-button", W = "icon", Q = "button", P = "link", he = ({
|
|
|
327
328
|
r
|
|
328
329
|
)), we = (e, r, t) => {
|
|
329
330
|
!r && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof e?.currentTarget?.focus == "function" && e.currentTarget.focus(), typeof t == "function" && t(e);
|
|
330
|
-
}, X =
|
|
331
|
+
}, X = z.forwardRef((e, r) => {
|
|
331
332
|
const { onClick: t, noInternalClick: a = !1, ...s } = e;
|
|
332
333
|
return /* @__PURE__ */ o(
|
|
333
334
|
"button",
|
|
@@ -365,7 +366,7 @@ const Be = {
|
|
|
365
366
|
bottom: 0,
|
|
366
367
|
right: 0
|
|
367
368
|
};
|
|
368
|
-
function
|
|
369
|
+
function A(e) {
|
|
369
370
|
const r = Ne(), t = w(0), a = w(null), [s, i] = ne(Be), c = K(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((d) => {
|
|
370
371
|
const n = d[0];
|
|
371
372
|
n && (cancelAnimationFrame(t.current), t.current = requestAnimationFrame(() => {
|
|
@@ -376,7 +377,7 @@ function j(e) {
|
|
|
376
377
|
c?.disconnect(), t.current && cancelAnimationFrame(t.current);
|
|
377
378
|
}), [c, e]), [a, s];
|
|
378
379
|
}
|
|
379
|
-
const
|
|
380
|
+
const E = {
|
|
380
381
|
small: 24,
|
|
381
382
|
// w-6
|
|
382
383
|
medium: 32,
|
|
@@ -390,7 +391,7 @@ const R = {
|
|
|
390
391
|
// px-3 x 2
|
|
391
392
|
large: 32
|
|
392
393
|
// px-4 x 2
|
|
393
|
-
}, Ie = 2, Re = 300, Z =
|
|
394
|
+
}, Ie = 2, Re = 300, Z = z.forwardRef(
|
|
394
395
|
({
|
|
395
396
|
children: e,
|
|
396
397
|
disabled: r = !1,
|
|
@@ -409,7 +410,7 @@ const R = {
|
|
|
409
410
|
noBackground: L = !1,
|
|
410
411
|
align: M = "center",
|
|
411
412
|
radius: T = "large",
|
|
412
|
-
variant:
|
|
413
|
+
variant: D = "secondary",
|
|
413
414
|
iconClassName: te,
|
|
414
415
|
animated: k = !1,
|
|
415
416
|
...re
|
|
@@ -429,17 +430,17 @@ const R = {
|
|
|
429
430
|
noBackground: L,
|
|
430
431
|
align: M,
|
|
431
432
|
radius: T,
|
|
432
|
-
variant:
|
|
433
|
+
variant: D,
|
|
433
434
|
animated: k
|
|
434
|
-
}), le = fe({ mode: t, raw: d, iconClassName: te, variant:
|
|
435
|
+
}), le = fe({ mode: t, raw: d, iconClassName: te, variant: D }), F = xe({ animated: k }), ie = "flex items-center justify-center relative w-full h-full overflow-hidden", [u, V] = A(), [y, O] = A(), [I, G] = A(), j = w(0), v = w(null), f = w(null), oe = Ce([ae, v]);
|
|
435
436
|
return q(() => {
|
|
436
|
-
I && I.current && k && (
|
|
437
|
+
I && I.current && k && (j.current = G.width + Te[h] + (n ? 0 : Ie), v.current && !v.current.style.width && (v.current.style.width = `${E[h]}px`));
|
|
437
438
|
}, [G, I, h, n, k]), q(() => {
|
|
438
439
|
if (v && v.current && k) {
|
|
439
|
-
let x =
|
|
440
|
-
m && u && V.width > 0 ? x = V.width +
|
|
440
|
+
let x = E[h];
|
|
441
|
+
m && u && V.width > 0 ? x = V.width + j.current : p && y && O.width > 0 && (x = O.width + j.current), f.current && clearTimeout(f.current), x !== parseInt(v.current.style.width || "0", 10) && (u.current && (u.current.style.opacity = "0"), y.current && (y.current.style.opacity = "0"), v.current.style.width = `${x}px`, x > E[h] && (f.current = setTimeout(() => {
|
|
441
442
|
u.current && m && (u.current.style.opacity = "1"), y.current && p && (y.current.style.opacity = "1"), f.current = null;
|
|
442
|
-
}, Re * 0.8))), x ===
|
|
443
|
+
}, Re * 0.8))), x === E[h] && (u.current && (u.current.style.opacity = "0"), y.current && (y.current.style.opacity = "0"));
|
|
443
444
|
}
|
|
444
445
|
}, [
|
|
445
446
|
V,
|
|
@@ -504,19 +505,19 @@ const R = {
|
|
|
504
505
|
);
|
|
505
506
|
Z.displayName = "ButtonIcon";
|
|
506
507
|
/*!
|
|
507
|
-
@versini/ui-button v7.1.
|
|
508
|
+
@versini/ui-button v7.1.5
|
|
508
509
|
© 2025 gizmette.com
|
|
509
510
|
*/
|
|
510
511
|
try {
|
|
511
512
|
window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
|
|
512
|
-
version: "7.1.
|
|
513
|
-
buildTime: "08/
|
|
513
|
+
version: "7.1.5",
|
|
514
|
+
buildTime: "08/30/2025 02:56 PM EDT",
|
|
514
515
|
homepage: "https://github.com/aversini/ui-components",
|
|
515
516
|
license: "MIT"
|
|
516
517
|
});
|
|
517
518
|
} catch {
|
|
518
519
|
}
|
|
519
|
-
const ee =
|
|
520
|
+
const ee = z.forwardRef(
|
|
520
521
|
({
|
|
521
522
|
children: e,
|
|
522
523
|
mode: r = "system",
|
|
@@ -626,7 +627,7 @@ const Ee = ({
|
|
|
626
627
|
/* @__PURE__ */ o("path", { d: "M137.4 470.6c12.5 12.5 32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 370.7V64c0-17.7-14.3-32-32-32s-32 14.3-32 32v306.7l-41.4-41.3c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96z" })
|
|
627
628
|
]
|
|
628
629
|
}
|
|
629
|
-
),
|
|
630
|
+
), ze = ({
|
|
630
631
|
className: e,
|
|
631
632
|
viewBox: r,
|
|
632
633
|
title: t,
|
|
@@ -652,7 +653,7 @@ const Ee = ({
|
|
|
652
653
|
/* @__PURE__ */ o("path", { d: "M128 480c9 0 17.5-3.8 23.6-10.4l88-96c11.9-13 11.1-33.3-2-45.2s-33.3-11.1-45.2 2L160 365.7V64c0-17.7-14.3-32-32-32S96 46.3 96 64v301.7l-32.4-35.3c-11.9-13-32.2-13.9-45.2-2s-13.9 32.2-2 45.2l88 96c6.1 6.6 14.6 10.4 23.6 10.4" })
|
|
653
654
|
]
|
|
654
655
|
}
|
|
655
|
-
),
|
|
656
|
+
), Se = ({
|
|
656
657
|
className: e,
|
|
657
658
|
viewBox: r,
|
|
658
659
|
title: t,
|
|
@@ -692,16 +693,13 @@ try {
|
|
|
692
693
|
});
|
|
693
694
|
} catch {
|
|
694
695
|
}
|
|
695
|
-
const C =
|
|
696
|
+
const C = z.createContext({
|
|
696
697
|
mode: "light",
|
|
697
698
|
cellWrapper: "thead",
|
|
698
699
|
stickyHeader: !1,
|
|
699
700
|
stickyFooter: !1,
|
|
700
701
|
compact: !1
|
|
701
|
-
}),
|
|
702
|
-
ASC: "asc",
|
|
703
|
-
DESC: "desc"
|
|
704
|
-
}, Le = ({
|
|
702
|
+
}), S = "thead", H = "tfoot", _ = "tbody", Le = ({
|
|
705
703
|
mode: e,
|
|
706
704
|
className: r,
|
|
707
705
|
wrapperClassName: t,
|
|
@@ -766,7 +764,7 @@ const C = S.createContext({
|
|
|
766
764
|
mode: e,
|
|
767
765
|
className: r,
|
|
768
766
|
cellWrapper: t
|
|
769
|
-
}) => t ===
|
|
767
|
+
}) => t === S || t === H ? l(
|
|
770
768
|
{
|
|
771
769
|
"bg-table-head-dark": e === "dark" || e === "system",
|
|
772
770
|
"bg-table-head-light": e === "light" || e === "alt-system",
|
|
@@ -787,7 +785,7 @@ const C = S.createContext({
|
|
|
787
785
|
"odd:bg-table-light-odd even:bg-table-light-even dark:odd:bg-table-dark-odd dark:even:bg-table-dark-even": t === _ && e === "alt-system"
|
|
788
786
|
},
|
|
789
787
|
r
|
|
790
|
-
),
|
|
788
|
+
), je = ({
|
|
791
789
|
cellWrapper: e,
|
|
792
790
|
className: r,
|
|
793
791
|
compact: t,
|
|
@@ -805,13 +803,13 @@ const C = S.createContext({
|
|
|
805
803
|
"text-copy-dark": a === "light" || a === "alt-system",
|
|
806
804
|
"dark:text-copy-dark": a === "system",
|
|
807
805
|
"dark:text-copy-light": a === "alt-system",
|
|
808
|
-
"px-4 py-3": !t && (e ===
|
|
806
|
+
"px-4 py-3": !t && (e === S || e === H),
|
|
809
807
|
"p-4": !t && e === _,
|
|
810
808
|
"px-2 py-1.5": t
|
|
811
809
|
},
|
|
812
810
|
r
|
|
813
811
|
)
|
|
814
|
-
}),
|
|
812
|
+
}), Ae = ({
|
|
815
813
|
buttonClassName: e
|
|
816
814
|
}) => l("rounded-none text-sm", e), De = ({
|
|
817
815
|
children: e,
|
|
@@ -852,36 +850,36 @@ const C = S.createContext({
|
|
|
852
850
|
)
|
|
853
851
|
}
|
|
854
852
|
);
|
|
855
|
-
},
|
|
853
|
+
}, Fe = ({
|
|
856
854
|
children: e,
|
|
857
855
|
className: r,
|
|
858
856
|
...t
|
|
859
857
|
}) => {
|
|
860
858
|
const a = B(C);
|
|
861
|
-
a.cellWrapper =
|
|
859
|
+
a.cellWrapper = S;
|
|
862
860
|
const s = Me({
|
|
863
861
|
className: r,
|
|
864
862
|
mode: a.mode,
|
|
865
863
|
stickyHeader: a.stickyHeader
|
|
866
864
|
});
|
|
867
865
|
return /* @__PURE__ */ o("thead", { className: s, ...t, children: e });
|
|
868
|
-
},
|
|
866
|
+
}, Ge = ({
|
|
869
867
|
children: e,
|
|
870
868
|
className: r,
|
|
871
869
|
...t
|
|
872
870
|
}) => {
|
|
873
871
|
const a = B(C);
|
|
874
|
-
a.cellWrapper =
|
|
872
|
+
a.cellWrapper = H;
|
|
875
873
|
const s = Ve({
|
|
876
874
|
className: r,
|
|
877
875
|
mode: a.mode,
|
|
878
876
|
stickyFooter: a.stickyFooter
|
|
879
877
|
});
|
|
880
878
|
return /* @__PURE__ */ o("tfoot", { className: s, ...t, children: e });
|
|
881
|
-
},
|
|
879
|
+
}, qe = ({ children: e, ...r }) => {
|
|
882
880
|
const t = B(C);
|
|
883
881
|
return t.cellWrapper = _, /* @__PURE__ */ o("tbody", { ...r, children: e });
|
|
884
|
-
},
|
|
882
|
+
}, Ye = ({
|
|
885
883
|
children: e,
|
|
886
884
|
className: r,
|
|
887
885
|
...t
|
|
@@ -899,7 +897,7 @@ const C = S.createContext({
|
|
|
899
897
|
align: a,
|
|
900
898
|
...s
|
|
901
899
|
}) => {
|
|
902
|
-
const i = B(C), c = r || (i.cellWrapper ===
|
|
900
|
+
const i = B(C), c = r || (i.cellWrapper === S ? "th" : "td"), { mainClasses: d, alignClasses: n } = je({
|
|
903
901
|
cellWrapper: i.cellWrapper,
|
|
904
902
|
className: t,
|
|
905
903
|
mode: i.mode,
|
|
@@ -907,7 +905,7 @@ const C = S.createContext({
|
|
|
907
905
|
align: a
|
|
908
906
|
});
|
|
909
907
|
return a ? /* @__PURE__ */ o(c, { className: d, ...s, children: /* @__PURE__ */ o("div", { className: n, children: e }) }) : /* @__PURE__ */ o(c, { className: d, ...s, children: e });
|
|
910
|
-
},
|
|
908
|
+
}, Je = ({
|
|
911
909
|
align: e,
|
|
912
910
|
children: r,
|
|
913
911
|
buttonClassName: t,
|
|
@@ -921,14 +919,14 @@ const C = S.createContext({
|
|
|
921
919
|
cellId: b,
|
|
922
920
|
...h
|
|
923
921
|
}) => {
|
|
924
|
-
const m =
|
|
922
|
+
const m = Ae({ buttonClassName: t });
|
|
925
923
|
return /* @__PURE__ */ o(
|
|
926
924
|
Pe,
|
|
927
925
|
{
|
|
928
926
|
component: s,
|
|
929
927
|
className: a,
|
|
930
928
|
role: "columnheader",
|
|
931
|
-
"aria-sort": n ===
|
|
929
|
+
"aria-sort": n === R.ASC && g === b ? "ascending" : n === R.DESC && g === b ? "descending" : "other",
|
|
932
930
|
...h,
|
|
933
931
|
children: /* @__PURE__ */ o(
|
|
934
932
|
ee,
|
|
@@ -942,7 +940,7 @@ const C = S.createContext({
|
|
|
942
940
|
mode: c,
|
|
943
941
|
fullWidth: !0,
|
|
944
942
|
labelRight: r,
|
|
945
|
-
children: n ===
|
|
943
|
+
children: n === R.ASC && g === b ? /* @__PURE__ */ o(Se, { className: "size-4", monotone: !0 }) : n === R.DESC && g === b ? /* @__PURE__ */ o(ze, { className: "size-4", monotone: !0 }) : /* @__PURE__ */ o(Ee, { className: "size-4", monotone: !0 })
|
|
946
944
|
}
|
|
947
945
|
)
|
|
948
946
|
}
|
|
@@ -950,11 +948,10 @@ const C = S.createContext({
|
|
|
950
948
|
};
|
|
951
949
|
export {
|
|
952
950
|
De as Table,
|
|
953
|
-
|
|
951
|
+
qe as TableBody,
|
|
954
952
|
Pe as TableCell,
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
Fe as
|
|
958
|
-
|
|
959
|
-
qe as TableRow
|
|
953
|
+
Je as TableCellSort,
|
|
954
|
+
Ge as TableFooter,
|
|
955
|
+
Fe as TableHead,
|
|
956
|
+
Ye as TableRow
|
|
960
957
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { Table as
|
|
1
|
+
import { Table as r, TableBody as i, TableCell as T, TableCellSort as a, TableFooter as t, TableHead as _, TableRow as b } from "./components/Table/Table.js";
|
|
2
|
+
import { TableCellSortDirections as I } from "./components/TableConstants/TableConstants.js";
|
|
2
3
|
/*!
|
|
3
|
-
@versini/ui-table v4.0.
|
|
4
|
+
@versini/ui-table v4.0.17
|
|
4
5
|
© 2025 gizmette.com
|
|
5
6
|
*/
|
|
6
7
|
try {
|
|
7
8
|
window.__VERSINI_UI_TABLE__ || (window.__VERSINI_UI_TABLE__ = {
|
|
8
|
-
version: "4.0.
|
|
9
|
-
buildTime: "08/
|
|
9
|
+
version: "4.0.17",
|
|
10
|
+
buildTime: "08/30/2025 02:58 PM EDT",
|
|
10
11
|
homepage: "https://github.com/aversini/ui-components",
|
|
11
12
|
license: "MIT"
|
|
12
13
|
});
|
|
13
14
|
} catch {
|
|
14
15
|
}
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
r as Table,
|
|
18
|
+
i as TableBody,
|
|
19
|
+
T as TableCell,
|
|
20
|
+
a as TableCellSort,
|
|
21
|
+
I as TableCellSortDirections,
|
|
21
22
|
t as TableFooter,
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
_ as TableHead,
|
|
24
|
+
b as TableRow
|
|
24
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-table",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -14,6 +14,20 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./constants": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/components/TableConstants/TableConstants.js"
|
|
25
|
+
},
|
|
26
|
+
"./table": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/components/Table/Table.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
17
31
|
"files": [
|
|
18
32
|
"dist",
|
|
19
33
|
"README.md"
|
|
@@ -54,5 +68,5 @@
|
|
|
54
68
|
"sideEffects": [
|
|
55
69
|
"**/*.css"
|
|
56
70
|
],
|
|
57
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "9309d65ae499da20d8170cdaa583bedbf7896ce9"
|
|
58
72
|
}
|