@versini/ui-table 4.0.16 → 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.
@@ -1,6 +1,7 @@
1
1
  import { jsx as o, jsxs as N, Fragment as ce } from "react/jsx-runtime";
2
- import S, { useRef as w, useLayoutEffect as q, useEffect as U, useState as ne, useMemo as K, useCallback as de, useContext as B } from "react";
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 = S.forwardRef((e, r) => {
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 j(e) {
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 R = {
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 = S.forwardRef(
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: H = "secondary",
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: H,
433
+ variant: D,
433
434
  animated: k
434
- }), le = fe({ mode: t, raw: d, iconClassName: te, variant: H }), F = xe({ animated: k }), ie = "flex items-center justify-center relative w-full h-full overflow-hidden", [u, V] = j(), [y, O] = j(), [I, G] = j(), A = w(0), v = w(null), f = w(null), oe = Ce([ae, v]);
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 && (A.current = G.width + Te[h] + (n ? 0 : Ie), v.current && !v.current.style.width && (v.current.style.width = `${R[h]}px`));
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 = R[h];
440
- m && u && V.width > 0 ? x = V.width + A.current : p && y && O.width > 0 && (x = O.width + A.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 > R[h] && (f.current = setTimeout(() => {
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 === R[h] && (u.current && (u.current.style.opacity = "0"), y.current && (y.current.style.opacity = "0"));
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,
@@ -510,13 +511,13 @@ Z.displayName = "ButtonIcon";
510
511
  try {
511
512
  window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
512
513
  version: "7.1.5",
513
- buildTime: "08/23/2025 12:21 PM EDT",
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 = S.forwardRef(
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
- ), Se = ({
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
- ), ze = ({
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 = S.createContext({
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
- }), z = "thead", D = "tfoot", _ = "tbody", E = {
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 === z || t === D ? l(
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
- ), Ae = ({
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 === z || e === D),
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
- }), je = ({
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
- }, He = ({
853
+ }, Fe = ({
856
854
  children: e,
857
855
  className: r,
858
856
  ...t
859
857
  }) => {
860
858
  const a = B(C);
861
- a.cellWrapper = z;
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
- }, Fe = ({
866
+ }, Ge = ({
869
867
  children: e,
870
868
  className: r,
871
869
  ...t
872
870
  }) => {
873
871
  const a = B(C);
874
- a.cellWrapper = D;
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
- }, Ge = ({ children: e, ...r }) => {
879
+ }, qe = ({ children: e, ...r }) => {
882
880
  const t = B(C);
883
881
  return t.cellWrapper = _, /* @__PURE__ */ o("tbody", { ...r, children: e });
884
- }, qe = ({
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 === z ? "th" : "td"), { mainClasses: d, alignClasses: n } = Ae({
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
- }, Ye = ({
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 = je({ buttonClassName: t });
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 === E.ASC && g === b ? "ascending" : n === E.DESC && g === b ? "descending" : "other",
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 === E.ASC && g === b ? /* @__PURE__ */ o(ze, { className: "size-4", monotone: !0 }) : n === E.DESC && g === b ? /* @__PURE__ */ o(Se, { className: "size-4", monotone: !0 }) : /* @__PURE__ */ o(Ee, { className: "size-4", monotone: !0 })
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
- Ge as TableBody,
951
+ qe as TableBody,
954
952
  Pe as TableCell,
955
- Ye as TableCellSort,
956
- E as TableCellSortDirections,
957
- Fe as TableFooter,
958
- He as TableHead,
959
- qe as TableRow
953
+ Je as TableCellSort,
954
+ Ge as TableFooter,
955
+ Fe as TableHead,
956
+ Ye as TableRow
960
957
  };
@@ -0,0 +1,7 @@
1
+ const e = {
2
+ ASC: "asc",
3
+ DESC: "desc"
4
+ };
5
+ export {
6
+ e as TableCellSortDirections
7
+ };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
 
4
4
  declare const TableCellSortDirections: {
5
- ASC: string;
6
- DESC: string;
5
+ readonly ASC: "asc";
6
+ readonly DESC: "desc";
7
7
  };
8
8
 
9
9
  type TableProps = {
package/dist/index.js CHANGED
@@ -1,24 +1,25 @@
1
- import { Table as i, TableBody as T, TableCell as a, TableCellSort as r, TableCellSortDirections as _, TableFooter as t, TableHead as b, TableRow as n } from "./components/Table/Table.js";
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.16
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.16",
9
- buildTime: "08/23/2025 12:23 PM EDT",
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
- i as Table,
17
- T as TableBody,
18
- a as TableCell,
19
- r as TableCellSort,
20
- _ as TableCellSortDirections,
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
- b as TableHead,
23
- n as TableRow
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.16",
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": "d568e20474c6c87f836c4cb6548f2cc0143a353c"
71
+ "gitHead": "9309d65ae499da20d8170cdaa583bedbf7896ce9"
58
72
  }