@caspeco/casper-ui-library 7.9.0 → 7.9.1

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 +1 @@
1
- {"version":3,"file":"table-content.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,UAAU,qBAAqB;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IAEV;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACvC;AAED,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE,2HAQjD,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,4CAqI5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
1
+ {"version":3,"file":"table-content.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,UAAU,qBAAqB;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IAEV;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACvC;AAED,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE,2HAQjD,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,4CAsJ5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
@@ -1,24 +1,24 @@
1
- import { jsxs as y, jsx as e } from "react/jsx-runtime";
2
- import { Table as M, Thead as $, Box as D, Tbody as S } from "@chakra-ui/react";
3
- import { useVirtualizer as E } from "../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
4
- import { memo as L, useRef as O, useMemo as c } from "react";
5
- import { useTableContext as Y } from "./table-context.js";
6
- import { TableHeaderRow as k } from "./table-header-row.js";
1
+ import { jsxs as S, jsx as e } from "react/jsx-runtime";
2
+ import { Table as j, Thead as E, Box as M, Tbody as y } from "@chakra-ui/react";
3
+ import { useVirtualizer as $ } from "../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
4
+ import { memo as D, useRef as L, useMemo as u } from "react";
5
+ import { useTableContext as O } from "./table-context.js";
6
+ import { TableHeaderRow as Y } from "./table-header-row.js";
7
7
  import { TableRow as v } from "./table-row.js";
8
- const q = ({
9
- onClickRow: d,
10
- onRowClickIndication: m,
11
- hideTableHeaderDropdown: R,
8
+ const k = ({
9
+ onClickRow: m,
10
+ onRowClickIndication: b,
11
+ hideTableHeaderDropdown: w,
12
12
  showRowHoverStyle: g = !0,
13
- stickyHeaders: u,
14
- virtualization: s,
15
- ...w
13
+ stickyHeaders: h,
14
+ virtualization: a,
15
+ ...R
16
16
  }) => {
17
- const t = Y(), b = O(null), z = c(() => u ? {
17
+ const t = O(), i = L(null), z = u(() => h ? {
18
18
  position: "sticky",
19
19
  top: 0,
20
20
  zIndex: 1
21
- } : {}, [u]), a = c(
21
+ } : {}, [h]), c = u(
22
22
  () => t.table.getRowModel().rows,
23
23
  // The dependencies are needed to ensure that the rows are recalculated when any of these change
24
24
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -29,65 +29,81 @@ const q = ({
29
29
  t.sorting,
30
30
  t.data
31
31
  ]
32
- ), h = a.length, r = !!s, p = s?.estimateRowHeight ?? 40, f = s?.overscan ?? 5, B = s?.height ?? "600px", H = c(
32
+ ), p = c.length, l = !!a, f = a?.estimateRowHeight ?? 40, x = a?.overscan ?? 5, B = a?.height ?? "600px", H = u(
33
33
  () => ({
34
- count: h,
35
- getScrollElement: () => b.current,
36
- estimateSize: () => p,
37
- overscan: f,
38
- enabled: r
34
+ count: p,
35
+ getScrollElement: () => i.current,
36
+ estimateSize: () => f,
37
+ overscan: x,
38
+ enabled: l,
39
+ onChange: (o, d) => {
40
+ d && i.current && document.activeElement !== i.current && i.current.focus();
41
+ }
39
42
  }),
40
- [r, p, f, h]
41
- ), x = E(H), n = r ? x.getVirtualItems() : [], I = () => {
42
- if (!r)
43
- return /* @__PURE__ */ e(S, { children: a.map((l) => {
44
- const o = l.getVisibleCells();
43
+ [l, f, x, p]
44
+ ), C = $(H), n = l ? C.getVirtualItems() : [], I = () => {
45
+ if (!l)
46
+ return /* @__PURE__ */ e(y, { children: c.map((s) => {
47
+ const r = s.getVisibleCells();
45
48
  return /* @__PURE__ */ e(
46
49
  v,
47
50
  {
48
- row: l,
49
- visibleCells: o,
50
- onClickRow: d,
51
- onRowClickIndication: m,
51
+ row: s,
52
+ visibleCells: r,
53
+ onClickRow: m,
54
+ onRowClickIndication: b,
52
55
  showRowHoverStyle: g
53
56
  },
54
- l.id
57
+ s.id
55
58
  );
56
59
  }) });
57
- const i = n.length > 0 ? n[0]?.start ?? 0 : 0, T = n.length > 0 ? x.getTotalSize() - (n[n.length - 1]?.end ?? 0) : 0, V = a[0]?.getVisibleCells().length ?? t.table.getVisibleLeafColumns().length;
58
- return /* @__PURE__ */ y(S, { children: [
59
- i > 0 && /* @__PURE__ */ e("tr", { style: { height: `${i}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: V }) }),
60
- n.map((l) => {
61
- const o = a[l.index];
62
- if (!o) return null;
63
- const j = o.getVisibleCells();
60
+ const o = n.length > 0 ? n[0]?.start ?? 0 : 0, d = n.length > 0 ? C.getTotalSize() - (n[n.length - 1]?.end ?? 0) : 0, V = c[0]?.getVisibleCells().length ?? t.table.getVisibleLeafColumns().length;
61
+ return /* @__PURE__ */ S(y, { children: [
62
+ o > 0 && /* @__PURE__ */ e("tr", { style: { height: `${o}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: V }) }),
63
+ n.map((s) => {
64
+ const r = c[s.index];
65
+ if (!r) return null;
66
+ const _ = r.getVisibleCells();
64
67
  return /* @__PURE__ */ e(
65
68
  v,
66
69
  {
67
- row: o,
68
- visibleCells: j,
69
- onClickRow: d,
70
- onRowClickIndication: m,
70
+ row: r,
71
+ visibleCells: _,
72
+ onClickRow: m,
73
+ onRowClickIndication: b,
71
74
  showRowHoverStyle: g
72
75
  },
73
- o.id
76
+ r.id
74
77
  );
75
78
  }),
76
- T > 0 && /* @__PURE__ */ e("tr", { style: { height: `${T}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: V }) })
79
+ d > 0 && /* @__PURE__ */ e("tr", { style: { height: `${d}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: V }) })
77
80
  ] });
78
- }, C = /* @__PURE__ */ y(M, { ...w, id: t.id, children: [
79
- /* @__PURE__ */ e($, { style: z, children: t.table.getHeaderGroups().map((i) => /* @__PURE__ */ e(
80
- k,
81
+ }, T = /* @__PURE__ */ S(j, { ...R, id: t.id, children: [
82
+ /* @__PURE__ */ e(E, { style: z, children: t.table.getHeaderGroups().map((o) => /* @__PURE__ */ e(
83
+ Y,
81
84
  {
82
- headerGroup: i,
83
- hideTableHeaderDropdown: R
85
+ headerGroup: o,
86
+ hideTableHeaderDropdown: w
84
87
  },
85
- i.id
88
+ o.id
86
89
  )) }),
87
90
  I()
88
91
  ] });
89
- return r ? /* @__PURE__ */ e(D, { ref: b, overflowY: "auto", height: B, position: "relative", children: C }) : C;
90
- }, Q = L(q);
92
+ return l ? /* @__PURE__ */ e(
93
+ M,
94
+ {
95
+ ref: i,
96
+ overflowY: "auto",
97
+ height: B,
98
+ position: "relative",
99
+ tabIndex: -1,
100
+ outline: "none",
101
+ _focus: { outline: "none", boxShadow: "none" },
102
+ _focusVisible: { outline: "none", boxShadow: "none" },
103
+ children: T
104
+ }
105
+ ) : T;
106
+ }, P = D(k);
91
107
  export {
92
- Q as TableContent
108
+ P as TableContent
93
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspeco/casper-ui-library",
3
- "version": "7.9.0",
3
+ "version": "7.9.1",
4
4
  "prettier": "@caspeco/prettier-config",
5
5
  "type": "module",
6
6
  "sideEffects": false,