@caspeco/casper-ui-library 8.2.0 → 8.2.2

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":"combobox-menu.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACX,kBAAkB,EAIlB,MAAM,SAAS,CAAC;AA2CjB,wBAAgB,qBAAqB,CAAC,EACrC,cAAc,EACd,SAAS,GACT,EAAE;IACF,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACnB,2CAEA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,2CAiGrD"}
1
+ {"version":3,"file":"combobox-menu.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACX,kBAAkB,EAIlB,MAAM,SAAS,CAAC;AA2CjB,wBAAgB,qBAAqB,CAAC,EACrC,cAAc,EACd,SAAS,GACT,EAAE;IACF,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACnB,2CAEA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,2CAkGrD"}
@@ -130,6 +130,7 @@ function pe(o) {
130
130
  backgroundColor: d.Surface,
131
131
  padding: `${c.Small} ${c.Medium}`,
132
132
  borderTop: `${N.XSmall} ${d.OnSurfaceBorder}`,
133
+ tabIndex: -1,
133
134
  children: l
134
135
  }
135
136
  )
@@ -179,9 +180,9 @@ const A = ({
179
180
  p.stopPropagation(), p.preventDefault(), s(r);
180
181
  };
181
182
  i.length > 0 && (i[i.length - 1] -= 1);
182
- const m = P++, B = r.children && r.children.length > 0, I = !B || r.isSelectableParent;
183
+ const m = P++, I = r.children && r.children.length > 0, B = !I || r.isSelectableParent;
183
184
  let $ = e.some((p) => p.id === r.id);
184
- return a && B && !r.isSelectableParent && w(r, e) && ($ = !0), /* @__PURE__ */ g(T, { children: [
185
+ return a && I && !r.isSelectableParent && w(r, e) && ($ = !0), /* @__PURE__ */ g(T, { children: [
185
186
  /* @__PURE__ */ g(
186
187
  A,
187
188
  {
@@ -227,7 +228,7 @@ const A = ({
227
228
  }),
228
229
  /* @__PURE__ */ n(H, { item: r, asPlainText: !0, highlightQuery: x })
229
230
  ] }),
230
- I ? /* @__PURE__ */ n(X, { isSingleSelect: k, isChecked: $ }) : a && !k && /* @__PURE__ */ n(W, { isIndeterminate: S(r), isChecked: $ })
231
+ B ? /* @__PURE__ */ n(X, { isSingleSelect: k, isChecked: $ }) : a && !k && /* @__PURE__ */ n(W, { isIndeterminate: S(r), isChecked: $ })
231
232
  ]
232
233
  }
233
234
  ),
@@ -253,7 +254,7 @@ const A = ({
253
254
  e.stopPropagation(), e.preventDefault(), s(i);
254
255
  };
255
256
  return o.map((e, i) => {
256
- const r = t.some((f) => f.id === e.id), v = e.children?.length, m = e.id === "_back", B = x.opened[x.opened.length - 1], I = e.id === B?.id, $ = m ? /* @__PURE__ */ g(y, { gap: c.XSmall, alignItems: "center", children: [
257
+ const r = t.some((f) => f.id === e.id), v = e.children?.length, m = e.id === "_back", I = x.opened[x.opened.length - 1], B = e.id === I?.id, $ = m ? /* @__PURE__ */ g(y, { gap: c.XSmall, alignItems: "center", children: [
257
258
  /* @__PURE__ */ n(z, { icon: D.Back, size: F.Small }),
258
259
  e.label
259
260
  ] }) : /* @__PURE__ */ g(_, { children: [
@@ -264,7 +265,7 @@ const A = ({
264
265
  ] }, f)),
265
266
  /* @__PURE__ */ n(H, { item: e, asPlainText: w })
266
267
  ] }),
267
- P ? void 0 : v && !I && !S ? /* @__PURE__ */ n(
268
+ P ? void 0 : v && !B && !S ? /* @__PURE__ */ n(
268
269
  z,
269
270
  {
270
271
  icon: D.Forward,
@@ -272,7 +273,7 @@ const A = ({
272
273
  color: d.OnBackgroundSubdued
273
274
  }
274
275
  ) : /* @__PURE__ */ n(X, { isSingleSelect: b, isChecked: r })
275
- ] }), p = u.length > 0 && u.length - 1 === i && u.length < o.length, M = !P && !S && (p || (m || I));
276
+ ] }), p = u.length > 0 && u.length - 1 === i && u.length < o.length, M = !P && !S && (p || (m || B));
276
277
  return /* @__PURE__ */ g(T, { children: [
277
278
  /* @__PURE__ */ n(
278
279
  A,
@@ -48,7 +48,8 @@ export interface TableContentProps<TData extends TableData = TableData> {
48
48
  */
49
49
  portalContainerRef?: React.RefObject<HTMLElement | null>;
50
50
  }
51
- declare const TableContentInner: <TData extends TableData>({ onClickRow, onRowClickIndication, hideTableHeaderDropdown, showRowHoverStyle, stickyHeaders, virtualization, portalContainerRef, ...props }: TableContentProps<TData> & ThemeStyleProps) => import("react/jsx-runtime").JSX.Element;
51
+ type TableContentInnerProps<TData extends TableData> = TableContentProps<TData> & ThemeStyleProps;
52
+ declare const TableContentInner: <TData extends TableData>({ virtualization, ...props }: TableContentInnerProps<TData>) => import("react/jsx-runtime").JSX.Element;
52
53
  /**
53
54
  * Renders table rows and columns with support for row interactions, nested data, and virtualization.
54
55
  *
@@ -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;IACvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE,+IASjD,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,4CAuJ5C,CAAC;AAEF;;;;GAIG;AACH,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;IACvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,KAAK,sBAAsB,CAAC,KAAK,SAAS,SAAS,IAAI,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC;AAElG,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE,8BAGjD,sBAAsB,CAAC,KAAK,CAAC,4CAM/B,CAAC;AAuLF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
@@ -1,25 +1,21 @@
1
- import { jsxs as S, jsx as e } from "react/jsx-runtime";
2
- import { Table as E, Thead as M, Box as $, Tbody as y } from "@chakra-ui/react";
3
- import { useVirtualizer as D } from "../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
4
- import { memo as L, useRef as O, useMemo as u } from "react";
5
- import { useTableContext as Y } from "./table-context.js";
6
- import { TableHeaderRow as k } from "./table-header-row.js";
7
- import { TableRow as v } from "./table-row.js";
8
- const q = ({
9
- onClickRow: m,
10
- onRowClickIndication: b,
11
- hideTableHeaderDropdown: w,
12
- showRowHoverStyle: g = !0,
13
- stickyHeaders: h,
14
- virtualization: a,
15
- portalContainerRef: R,
16
- ...z
1
+ import { jsx as e, jsxs as C } from "react/jsx-runtime";
2
+ import { Tbody as w, Box as y, Table as v, Thead as H } from "@chakra-ui/react";
3
+ import { useVirtualizer as B } from "../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
4
+ import { memo as I, useMemo as h, useRef as k } from "react";
5
+ import { useTableContext as g } from "./table-context.js";
6
+ import { TableHeaderRow as D } from "./table-header-row.js";
7
+ import { TableRow as x } from "./table-row.js";
8
+ const M = ({
9
+ virtualization: l,
10
+ ...i
11
+ }) => l ? /* @__PURE__ */ e(_, { ...i, virtualization: l }) : /* @__PURE__ */ e(j, { ...i }), _ = ({
12
+ onClickRow: l,
13
+ onRowClickIndication: i,
14
+ showRowHoverStyle: d = !0,
15
+ virtualization: r,
16
+ ...o
17
17
  }) => {
18
- const t = Y(), i = O(null), B = u(() => h ? {
19
- position: "sticky",
20
- top: 0,
21
- zIndex: 1
22
- } : {}, [h]), c = u(
18
+ const t = g(), n = k(null), s = h(
23
19
  () => t.table.getRowModel().rows,
24
20
  // The dependencies are needed to ensure that the rows are recalculated when any of these change
25
21
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -30,82 +26,108 @@ const q = ({
30
26
  t.sorting,
31
27
  t.data
32
28
  ]
33
- ), p = c.length, l = !!a, f = a?.estimateRowHeight ?? 40, x = a?.overscan ?? 5, H = a?.height ?? "600px", I = u(
34
- () => ({
35
- count: p,
36
- getScrollElement: () => i.current,
37
- estimateSize: () => f,
38
- overscan: x,
39
- enabled: l,
40
- onChange: (o, d) => {
41
- d && i.current && document.activeElement !== i.current && i.current.focus();
29
+ ), R = h(() => {
30
+ const u = r.estimateRowHeight ?? 40, b = r.overscan ?? 5;
31
+ return {
32
+ count: s.length,
33
+ getScrollElement: () => n.current,
34
+ estimateSize: () => u,
35
+ overscan: b,
36
+ enabled: !0,
37
+ onChange: (f, c) => {
38
+ c && n.current && document.activeElement !== n.current && n.current.focus();
42
39
  }
43
- }),
44
- [l, f, x, p]
45
- ), C = D(I), n = l ? C.getVirtualItems() : [], _ = () => {
46
- if (!l)
47
- return /* @__PURE__ */ e(y, { children: c.map((s) => {
48
- const r = s.getVisibleCells();
40
+ };
41
+ }, [r.estimateRowHeight, r.overscan, s]), p = B(R), a = p.getVirtualItems(), V = () => {
42
+ const u = a.length > 0 ? a[0]?.start ?? 0 : 0, b = a.length > 0 ? p.getTotalSize() - (a[a.length - 1]?.end ?? 0) : 0, m = s[0]?.getVisibleCells().length ?? t.table.getVisibleLeafColumns().length;
43
+ return /* @__PURE__ */ C(w, { children: [
44
+ u > 0 && /* @__PURE__ */ e("tr", { style: { height: `${u}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: m }) }),
45
+ a.map((f) => {
46
+ const c = s[f.index];
47
+ if (!c) return null;
48
+ const S = c.getVisibleCells();
49
49
  return /* @__PURE__ */ e(
50
- v,
50
+ x,
51
51
  {
52
- row: s,
53
- visibleCells: r,
54
- onClickRow: m,
55
- onRowClickIndication: b,
56
- showRowHoverStyle: g
52
+ row: c,
53
+ visibleCells: S,
54
+ onClickRow: l,
55
+ onRowClickIndication: i,
56
+ showRowHoverStyle: d
57
57
  },
58
- s.id
59
- );
60
- }) });
61
- 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;
62
- return /* @__PURE__ */ S(y, { children: [
63
- o > 0 && /* @__PURE__ */ e("tr", { style: { height: `${o}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: V }) }),
64
- n.map((s) => {
65
- const r = c[s.index];
66
- if (!r) return null;
67
- const j = r.getVisibleCells();
68
- return /* @__PURE__ */ e(
69
- v,
70
- {
71
- row: r,
72
- visibleCells: j,
73
- onClickRow: m,
74
- onRowClickIndication: b,
75
- showRowHoverStyle: g
76
- },
77
- r.id
58
+ c.id
78
59
  );
79
60
  }),
80
- d > 0 && /* @__PURE__ */ e("tr", { style: { height: `${d}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: V }) })
61
+ b > 0 && /* @__PURE__ */ e("tr", { style: { height: `${b}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: m }) })
81
62
  ] });
82
- }, T = /* @__PURE__ */ S(E, { ...z, id: t.id, children: [
83
- /* @__PURE__ */ e(M, { style: B, children: t.table.getHeaderGroups().map((o) => /* @__PURE__ */ e(
84
- k,
85
- {
86
- headerGroup: o,
87
- hideTableHeaderDropdown: w,
88
- portalContainerRef: R
89
- },
90
- o.id
91
- )) }),
92
- _()
93
- ] });
94
- return l ? /* @__PURE__ */ e(
95
- $,
63
+ };
64
+ return /* @__PURE__ */ e(
65
+ y,
96
66
  {
97
- ref: i,
67
+ ref: n,
98
68
  overflowY: "auto",
99
- height: H,
69
+ height: r.height ?? "600px",
100
70
  position: "relative",
101
71
  tabIndex: -1,
102
72
  outline: "none",
103
73
  _focus: { outline: "none", boxShadow: "none" },
104
74
  _focusVisible: { outline: "none", boxShadow: "none" },
105
- children: T
75
+ children: /* @__PURE__ */ e(T, { ...o, children: V() })
106
76
  }
107
- ) : T;
108
- }, Q = L(q);
77
+ );
78
+ }, j = ({
79
+ onClickRow: l,
80
+ onRowClickIndication: i,
81
+ showRowHoverStyle: d = !0,
82
+ ...r
83
+ }) => {
84
+ const o = g(), t = h(
85
+ () => o.table.getRowModel().rows,
86
+ // The dependencies are needed to ensure that the rows are recalculated when any of these change
87
+ // eslint-disable-next-line react-hooks/exhaustive-deps
88
+ [
89
+ o.expanded,
90
+ o.breakingContentState,
91
+ o.columnVisibility,
92
+ o.sorting,
93
+ o.data
94
+ ]
95
+ );
96
+ return /* @__PURE__ */ e(T, { ...r, children: /* @__PURE__ */ e(w, { children: t.map((n) => {
97
+ const s = n.getVisibleCells();
98
+ return /* @__PURE__ */ e(
99
+ x,
100
+ {
101
+ row: n,
102
+ visibleCells: s,
103
+ onClickRow: l,
104
+ onRowClickIndication: i,
105
+ showRowHoverStyle: d
106
+ },
107
+ n.id
108
+ );
109
+ }) }) });
110
+ }, T = ({
111
+ hideTableHeaderDropdown: l,
112
+ stickyHeaders: i,
113
+ portalContainerRef: d,
114
+ children: r,
115
+ ...o
116
+ }) => {
117
+ const t = g();
118
+ return /* @__PURE__ */ C(v, { ...o, id: t.id, children: [
119
+ /* @__PURE__ */ e(H, { "data-sticky-headers": i, children: t.table.getHeaderGroups().map((n) => /* @__PURE__ */ e(
120
+ D,
121
+ {
122
+ headerGroup: n,
123
+ hideTableHeaderDropdown: l,
124
+ portalContainerRef: d
125
+ },
126
+ n.id
127
+ )) }),
128
+ r
129
+ ] });
130
+ }, q = I(M);
109
131
  export {
110
- Q as TableContent
132
+ q as TableContent
111
133
  };
@@ -1 +1 @@
1
- {"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAYlF,OAAO,KAAK,EAAmB,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpE,KAAK,mBAAmB,CAAC,KAAK,SAAS,SAAS,IAAI;IACnD,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,uBAAuB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,KAAK,SAAS,SAAS,EAAE,+DAIvD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAAE,4CA2F3F,CAAC;AAuJF,eAAO,MAAM,cAAc,EAAoC,OAAO,uBAAuB,CAAC"}
1
+ {"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwC,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAoB/F,OAAO,KAAK,EAAmB,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpE,KAAK,mBAAmB,CAAC,KAAK,SAAS,SAAS,IAAI;IACnD,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,uBAAuB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,KAAK,SAAS,SAAS,EAAE,+DAIvD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAAE,4CAiD3F,CAAC;AAuPF,eAAO,MAAM,cAAc,EAAoC,OAAO,uBAAuB,CAAC"}
@@ -1,159 +1,187 @@
1
- import { jsx as e, Fragment as u, jsxs as f } from "react/jsx-runtime";
2
- import { Tr as B, Th as b, useMediaQuery as v, Portal as M } from "@chakra-ui/react";
3
- import { flexRender as T } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { memo as y, useCallback as C, useMemo as A } from "react";
5
- import { useTableContext as p } from "./table-context.js";
6
- import { TableHeaderDropdown as V } from "./table-header-dropdown.js";
7
- import { translations as x } from "./translations.js";
8
- import { Box as g } from "../box/box.js";
9
- import { Flex as w } from "../flex/flex.js";
10
- import { Divider as z } from "../divider/divider.js";
11
- import { Menu as D } from "../menu/menu.js";
12
- import { MenuButton as F } from "../menu/menu-button.js";
13
- import { Icons as R } from "../icon/types.js";
14
- import { MenuList as H } from "../menu/menu-list.js";
15
- import { Checkbox as P } from "../checkbox/checkbox.js";
16
- import { MenuItem as L } from "../menu/menu-item.js";
17
- import { IconButton as N } from "../icon-button/icon-button.js";
18
- import { Button as O } from "../button/button.js";
19
- import { ThemeColorVariable as d, ThemeSpaceVariable as m, ThemeFontSizeVariable as j, ThemeFontVariable as $ } from "../../theme/theme-types.js";
20
- const W = ({
21
- headerGroup: o,
22
- hideTableHeaderDropdown: r,
23
- portalContainerRef: a
1
+ import { jsx as e, Fragment as b, jsxs as C } from "react/jsx-runtime";
2
+ import { Tr as A, Th as B, useMediaQuery as z, Portal as D } from "@chakra-ui/react";
3
+ import { flexRender as V } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { memo as H, useRef as L, useCallback as R, useLayoutEffect as P, useMemo as F } from "react";
5
+ import { useTableContext as f } from "./table-context.js";
6
+ import { TableHeaderDropdown as O } from "./table-header-dropdown.js";
7
+ import { translations as v } from "./translations.js";
8
+ import { Flex as I } from "../flex/flex.js";
9
+ import { Box as S } from "../box/box.js";
10
+ import { Divider as N } from "../divider/divider.js";
11
+ import { Menu as j } from "../menu/menu.js";
12
+ import { MenuButton as E } from "../menu/menu-button.js";
13
+ import { Icons as y } from "../icon/types.js";
14
+ import { MenuList as $ } from "../menu/menu-list.js";
15
+ import { Checkbox as W } from "../checkbox/checkbox.js";
16
+ import { MenuItem as Q } from "../menu/menu-item.js";
17
+ import { IconButton as X } from "../icon-button/icon-button.js";
18
+ import { Button as q } from "../button/button.js";
19
+ import { ThemeColorVariable as g, ThemeSpaceVariable as p, ThemeFontSizeVariable as G, ThemeFontVariable as J } from "../../theme/theme-types.js";
20
+ const K = ({
21
+ headerGroup: t,
22
+ hideTableHeaderDropdown: o,
23
+ portalContainerRef: s
24
24
  }) => {
25
- const n = p(), s = !!n.getRowActions, i = C((t) => {
26
- const l = t.getIsPinned();
27
- return {
28
- position: l ? "sticky" : "relative",
29
- left: l ? `${t.getStart("left")}px` : void 0,
30
- backgroundColor: l ? d.Background : void 0,
31
- zIndex: l ? 1 : 0,
32
- width: t.getSize(),
33
- maxWidth: t.getSize()
34
- };
35
- }, []), c = (n.selectedRowIds?.length ?? 0) > 0 && (n.selectionActions?.length ?? 0) > 0;
36
- return /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(B, { children: c ? /* @__PURE__ */ e(
37
- b,
25
+ const i = f(), c = !!i.getRowActions, l = (i.selectedRowIds?.length ?? 0) > 0 && (i.selectionActions?.length ?? 0) > 0;
26
+ return /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(A, { children: l ? /* @__PURE__ */ e(
27
+ B,
38
28
  {
39
- colSpan: o.headers.length,
29
+ colSpan: t.headers.length,
40
30
  sx: {
41
31
  cursor: "default",
42
32
  "& div:hover": {
43
33
  backgroundColor: "transparent !important"
44
34
  },
45
35
  "div span": {
46
- color: d.OnBackground
36
+ color: g.OnBackground
47
37
  }
48
38
  },
49
39
  zIndex: 1,
50
40
  style: {
51
- borderBottom: `1px solid ${d.OnBackgroundBorder}`,
52
- paddingLeft: s ? "24px" : void 0
41
+ borderBottom: `1px solid ${g.OnBackgroundBorder}`,
42
+ paddingLeft: c ? "24px" : void 0
53
43
  },
54
- children: /* @__PURE__ */ e(I, { showSelectAll: !0, children: /* @__PURE__ */ e(Q, {}) })
44
+ children: /* @__PURE__ */ e(M, { showSelectAll: !0, children: /* @__PURE__ */ e(Z, {}) })
55
45
  }
56
- ) : /* @__PURE__ */ e(u, { children: o.headers.map((t) => {
57
- const { column: l } = t, h = l.getIndex() === 0;
58
- return /* @__PURE__ */ e(
59
- b,
60
- {
61
- className: "tableHeaderCell",
62
- isNumeric: l.columnDef.meta?.isNumeric,
63
- zIndex: l.getIsPinned() ? 2 : 1,
64
- style: {
65
- ...i(l),
66
- borderBottom: `1px solid ${d.OnBackgroundBorder}`,
67
- paddingLeft: h && s ? "24px" : void 0
68
- },
69
- children: /* @__PURE__ */ e(I, { showSelectAll: n.canSelectRows && h, children: /* @__PURE__ */ e(u, { children: r ? /* @__PURE__ */ e(g, { paddingLeft: m.Small, children: T(t.column.columnDef.header, t.getContext()) }) : /* @__PURE__ */ e(
70
- V,
71
- {
72
- header: t,
73
- breakingContentState: n.breakingContentState,
74
- columnVisibility: n.columnVisibility,
75
- headerGroup: n.table.getHeaderGroups(),
76
- localeString: n.localeString,
77
- setBreakingContentState: n.setBreakingContentState,
78
- setSorting: n.setSorting,
79
- sorting: n.sorting,
80
- onBreakingContentChange: n.onBreakingContentChange,
81
- portalContainerRef: a
82
- }
83
- ) }) })
46
+ ) : /* @__PURE__ */ e(b, { children: t.headers.map((n) => /* @__PURE__ */ e(
47
+ U,
48
+ {
49
+ header: n,
50
+ hideTableHeaderDropdown: o,
51
+ applyActionMenuPadding: c,
52
+ portalContainerRef: s,
53
+ isFirstColumn: n.column.getIndex() === 0
54
+ },
55
+ n.id
56
+ )) }) }, t.id) });
57
+ }, U = ({
58
+ header: t,
59
+ hideTableHeaderDropdown: o,
60
+ applyActionMenuPadding: s,
61
+ portalContainerRef: i,
62
+ isFirstColumn: c = !1
63
+ }) => {
64
+ const l = L(null), n = f(), { column: r } = t, m = R((d) => {
65
+ const a = d.getIsPinned(), u = d.getSize();
66
+ return {
67
+ position: a ? "sticky" : "relative",
68
+ left: a ? `${d.getStart("left")}px` : void 0,
69
+ backgroundColor: a ? g.Background : void 0,
70
+ zIndex: a ? 1 : 0,
71
+ width: u,
72
+ maxWidth: u
73
+ };
74
+ }, []);
75
+ return P(() => {
76
+ const d = l.current;
77
+ if (!d) return;
78
+ const a = r.id, u = (h) => {
79
+ h > 0 && n.table.getState().columnSizing[a] !== h && n.table.setColumnSizing((w) => ({ ...w, [a]: h }));
80
+ }, k = new ResizeObserver((h) => {
81
+ const w = h[0];
82
+ if (!w) return;
83
+ const T = w.borderBoxSize?.[0]?.inlineSize ?? d.getBoundingClientRect().width;
84
+ u(T);
85
+ });
86
+ return k.observe(d), u(d.getBoundingClientRect().width), () => k.disconnect();
87
+ }, []), /* @__PURE__ */ e(
88
+ B,
89
+ {
90
+ ref: l,
91
+ className: "tableHeaderCell",
92
+ isNumeric: r.columnDef.meta?.isNumeric,
93
+ zIndex: r.getIsPinned() ? 2 : 1,
94
+ style: {
95
+ ...m(r),
96
+ borderBottom: `1px solid ${g.OnBackgroundBorder}`,
97
+ paddingLeft: c && s ? "24px" : void 0
84
98
  },
85
- t.id
86
- );
87
- }) }) }, o.id) });
88
- }, I = ({ showSelectAll: o, children: r }) => o ? /* @__PURE__ */ f(w, { w: "100%", align: "center", children: [
89
- /* @__PURE__ */ e(g, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(E, {}) }),
90
- r
91
- ] }) : /* @__PURE__ */ e(u, { children: r }), E = () => {
92
- const o = p(), r = C(
93
- (s) => {
94
- const i = s.target.checked, c = o.getSelectableRowIds();
95
- i ? o.setSelectedRowIds((t) => [.../* @__PURE__ */ new Set([...t, ...c])]) : o.setSelectedRowIds((t) => t.filter((l) => !c.includes(l)));
99
+ children: /* @__PURE__ */ e(M, { showSelectAll: n.canSelectRows && c, children: /* @__PURE__ */ e(b, { children: o ? /* @__PURE__ */ e(S, { paddingLeft: p.Small, children: V(t.column.columnDef.header, t.getContext()) }) : /* @__PURE__ */ e(
100
+ O,
101
+ {
102
+ header: t,
103
+ breakingContentState: n.breakingContentState,
104
+ columnVisibility: n.columnVisibility,
105
+ headerGroup: n.table.getHeaderGroups(),
106
+ localeString: n.localeString,
107
+ setBreakingContentState: n.setBreakingContentState,
108
+ setSorting: n.setSorting,
109
+ sorting: n.sorting,
110
+ onBreakingContentChange: n.onBreakingContentChange,
111
+ portalContainerRef: i
112
+ }
113
+ ) }) })
114
+ }
115
+ );
116
+ }, M = ({ showSelectAll: t, children: o }) => t ? /* @__PURE__ */ C(I, { w: "100%", align: "center", children: [
117
+ /* @__PURE__ */ e(S, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(Y, {}) }),
118
+ o
119
+ ] }) : /* @__PURE__ */ e(b, { children: o }), Y = () => {
120
+ const t = f(), o = R(
121
+ (c) => {
122
+ const l = c.target.checked, n = t.getSelectableRowIds();
123
+ l ? t.setSelectedRowIds((r) => [.../* @__PURE__ */ new Set([...r, ...n])]) : t.setSelectedRowIds((r) => r.filter((m) => !n.includes(m)));
96
124
  },
97
- [o]
98
- ), { allIsSelected: a, shouldShowIndeterminateState: n } = A(() => {
99
- const i = o.table.getRowModel().flatRows, c = new Set(o.selectedRowIds), t = o.getSelectableRowIds(), l = t.length > 0 && t.every((S) => c.has(S)), h = i.some((S) => c.has(S.id));
125
+ [t]
126
+ ), { allIsSelected: s, shouldShowIndeterminateState: i } = F(() => {
127
+ const l = t.table.getRowModel().flatRows, n = new Set(t.selectedRowIds), r = t.getSelectableRowIds(), m = r.length > 0 && r.every((a) => n.has(a)), d = l.some((a) => n.has(a.id));
100
128
  return {
101
- allIsSelected: l,
102
- shouldShowIndeterminateState: h && !l
129
+ allIsSelected: m,
130
+ shouldShowIndeterminateState: d && !m
103
131
  };
104
- }, [o]);
132
+ }, [t]);
105
133
  return /* @__PURE__ */ e(
106
- P,
134
+ W,
107
135
  {
108
- isChecked: a,
109
- isIndeterminate: n,
110
- onChange: r
136
+ isChecked: s,
137
+ isIndeterminate: i,
138
+ onChange: o
111
139
  }
112
140
  );
113
- }, Q = () => {
114
- const { localeString: o, selectedRowIds: r = [], selectionActions: a = [] } = p(), n = x[o], [s] = v("(min-width: 48em)"), i = a.length > 3 || !s, c = r.length === 1 ? n.selectedSingular.replace("{count}", "1") : n.selected.replace("{count}", r.length.toString());
115
- return /* @__PURE__ */ f(
116
- w,
141
+ }, Z = () => {
142
+ const { localeString: t, selectedRowIds: o = [], selectionActions: s = [] } = f(), i = v[t], [c] = z("(min-width: 48em)"), l = s.length > 3 || !c, n = o.length === 1 ? i.selectedSingular.replace("{count}", "1") : i.selected.replace("{count}", o.length.toString());
143
+ return /* @__PURE__ */ C(
144
+ I,
117
145
  {
118
- gap: m.Medium,
146
+ gap: p.Medium,
119
147
  align: "center",
120
148
  alignContent: "center",
121
- marginBottom: m.XSmall,
149
+ marginBottom: p.XSmall,
122
150
  children: [
123
151
  /* @__PURE__ */ e(
124
- g,
152
+ S,
125
153
  {
126
- pl: m.Small,
127
- color: d.OnBackground,
128
- fontFamily: $.Body,
129
- fontSize: j.Medium,
154
+ pl: p.Small,
155
+ color: g.OnBackground,
156
+ fontFamily: J.Body,
157
+ fontSize: G.Medium,
130
158
  whiteSpace: "nowrap",
131
159
  style: { fontVariantNumeric: "normal" },
132
- children: c
160
+ children: n
133
161
  }
134
162
  ),
135
- /* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(z, { orientation: "vertical", height: "20px" }) }),
136
- /* @__PURE__ */ e(w, { gap: m.Small, align: "center", children: i ? /* @__PURE__ */ f(D, { children: [
137
- /* @__PURE__ */ e(F, { variant: "ghost", rightIcon: R.TreeViewCollapse, children: n.action }),
138
- /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(H, { children: a.map((t) => /* @__PURE__ */ e(k, { isMenuItem: !0, action: t }, t.name)) }) })
139
- ] }) : a.map((t) => /* @__PURE__ */ e(k, { isMenuItem: !1, action: t }, t.name)) })
163
+ /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(N, { orientation: "vertical", height: "20px" }) }),
164
+ /* @__PURE__ */ e(I, { gap: p.Small, align: "center", children: l ? /* @__PURE__ */ C(j, { children: [
165
+ /* @__PURE__ */ e(E, { variant: "ghost", rightIcon: y.TreeViewCollapse, children: i.action }),
166
+ /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e($, { children: s.map((r) => /* @__PURE__ */ e(x, { isMenuItem: !0, action: r }, r.name)) }) })
167
+ ] }) : s.map((r) => /* @__PURE__ */ e(x, { isMenuItem: !1, action: r }, r.name)) })
140
168
  ]
141
169
  }
142
170
  );
143
- }, k = ({ isMenuItem: o, action: r }) => {
144
- const { selectedRowIds: a, localeString: n } = p(), s = x[n], i = C(() => {
145
- r.onClick(a || []);
146
- }, [r, a]);
147
- return o ? /* @__PURE__ */ e(L, { onClick: i, children: r.variant === "delete" ? /* @__PURE__ */ e(g, { as: "span", color: d.Error, children: r.name }) : r.name }) : r.variant === "delete" ? /* @__PURE__ */ e(
148
- N,
171
+ }, x = ({ isMenuItem: t, action: o }) => {
172
+ const { selectedRowIds: s, localeString: i } = f(), c = v[i], l = R(() => {
173
+ o.onClick(s || []);
174
+ }, [o, s]);
175
+ return t ? /* @__PURE__ */ e(Q, { onClick: l, children: o.variant === "delete" ? /* @__PURE__ */ e(S, { as: "span", color: g.Error, children: o.name }) : o.name }) : o.variant === "delete" ? /* @__PURE__ */ e(
176
+ X,
149
177
  {
150
- onClick: i,
151
- icon: R.Delete,
152
- "aria-label": s.deleteSelectedRows,
178
+ onClick: l,
179
+ icon: y.Delete,
180
+ "aria-label": c.deleteSelectedRows,
153
181
  variant: "ghost"
154
182
  }
155
- ) : /* @__PURE__ */ e(O, { onClick: i, variant: "ghost", children: r.name });
156
- }, de = y(W);
183
+ ) : /* @__PURE__ */ e(q, { onClick: l, variant: "ghost", children: o.name });
184
+ }, we = H(K);
157
185
  export {
158
- de as TableHeaderRow
186
+ we as TableHeaderRow
159
187
  };
@@ -1 +1 @@
1
- {"version":3,"file":"table-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,KAAK,aAAa,CAAC,KAAK,SAAS,SAAS,IAAI;IAC7C,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;IACnD,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;IACV,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,KAAK,SAAS,SAAS,EAAE,6EAM7C,aAAa,CAAC,KAAK,CAAC,4CAmFtB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAA0B,OAAO,aAAa,CAAC"}
1
+ {"version":3,"file":"table-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,KAAK,aAAa,CAAC,KAAK,SAAS,SAAS,IAAI;IAC7C,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;IACnD,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;IACV,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,KAAK,SAAS,SAAS,EAAE,6EAM7C,aAAa,CAAC,KAAK,CAAC,4CA0EtB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAA0B,OAAO,aAAa,CAAC"}
@@ -1,60 +1,59 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { Tr as f } from "@chakra-ui/react";
3
- import { memo as x, useMemo as d, useCallback as u } from "react";
4
- import { TableCell as T } from "./table-cell.js";
5
- import { useTableContext as A } from "./table-context.js";
6
- import { ThemeColorVariable as r } from "../../theme/theme-types.js";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { Tr as p } from "@chakra-ui/react";
3
+ import { memo as h, useCallback as d, useMemo as f } from "react";
4
+ import { TableCell as x } from "./table-cell.js";
5
+ import { useTableContext as S } from "./table-context.js";
7
6
  const I = ({
8
- row: t,
9
- visibleCells: a,
7
+ row: e,
8
+ visibleCells: o,
10
9
  onClickRow: n,
11
- showRowHoverStyle: i,
12
- onRowClickIndication: s
10
+ showRowHoverStyle: l,
11
+ onRowClickIndication: i
13
12
  }) => {
14
- const o = A(), g = d(() => ({ backgroundColor: i ? r.AccentHoverAlpha : "unset", ".action-menu-button": { opacity: 1 } }), [i]), m = u(
15
- (e) => {
16
- n && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n(t.original, e));
13
+ const a = S(), c = d(
14
+ (t) => {
15
+ n && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), n(e.original, t));
17
16
  },
18
- [n, t.original]
19
- ), p = u(
20
- (e) => {
21
- e.stopPropagation(), t.getToggleSelectedHandler(), n && n(t.original, e), s && o.setRowHighlight({ [e.currentTarget.id]: !0 });
17
+ [n, e.original]
18
+ ), g = d(
19
+ (t) => {
20
+ t.stopPropagation(), e.getToggleSelectedHandler(), n && n(e.original, t), i && a.setRowHighlight({ [t.currentTarget.id]: !0 });
22
21
  },
23
- [t, n, s, o]
24
- ), b = d(() => t.getIsSelected() || o.selectedRowIds?.includes(t.id) ? r.AccentHoverAlpha : "unset", [t, o.rowHighlight, o.selectedRowIds]), h = o.getRowActions?.(t.original), S = (e) => o.disableSelectionCheckbox?.(e) ?? !1;
25
- return /* @__PURE__ */ c(
26
- f,
22
+ [e, n, i, a]
23
+ ), u = f(() => e.getIsSelected() || a.selectedRowIds?.includes(e.id), [e, a.rowHighlight, a.selectedRowIds]), m = a.getRowActions?.(e.original), b = (t) => a.disableSelectionCheckbox?.(t) ?? !1;
24
+ return /* @__PURE__ */ s(
25
+ p,
27
26
  {
28
- id: t.id,
27
+ id: e.id,
29
28
  tabIndex: n ? 0 : void 0,
30
- onClick: p,
31
- onKeyDown: m,
32
- borderTop: t.depth > 0 ? "none" : `1px solid ${r.OnBackgroundBorder}`,
29
+ onClick: g,
30
+ onKeyDown: c,
33
31
  cursor: n ? "pointer" : void 0,
34
- backgroundColor: b,
35
- _hover: g,
36
- children: a.map((e) => {
37
- const l = e.column.getIndex() === 0;
38
- return /* @__PURE__ */ c(
39
- T,
32
+ "data-row-selected": u,
33
+ "data-allow-hovered": l,
34
+ "data-is-root-level": e.depth === 0,
35
+ children: o.map((t) => {
36
+ const r = t.column.getIndex() === 0;
37
+ return /* @__PURE__ */ s(
38
+ x,
40
39
  {
41
- cell: e,
42
- visibleCells: a,
43
- row: t,
44
- rowIsExpanded: t.getIsExpanded(),
45
- breakingContentState: o.breakingContentState,
46
- localeString: o.localeString,
47
- actionMenu: l ? h : void 0,
48
- canSelectRows: o.canSelectRows && l,
49
- isCheckboxDisabled: S(t)
40
+ cell: t,
41
+ visibleCells: o,
42
+ row: e,
43
+ rowIsExpanded: e.getIsExpanded(),
44
+ breakingContentState: a.breakingContentState,
45
+ localeString: a.localeString,
46
+ actionMenu: r ? m : void 0,
47
+ canSelectRows: a.canSelectRows && r,
48
+ isCheckboxDisabled: b(e)
50
49
  },
51
- e.id
50
+ t.id
52
51
  );
53
52
  })
54
53
  },
55
- t.id
54
+ e.id
56
55
  );
57
- }, M = x(I);
56
+ }, M = h(I);
58
57
  export {
59
58
  M as TableRow
60
59
  };
@@ -0,0 +1,2 @@
1
+ export * from './setup-mock-resize-observer.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/test-utils/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const setupMockResizeObserver: () => void;
2
+ //# sourceMappingURL=setup-mock-resize-observer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-mock-resize-observer.d.ts","sourceRoot":"","sources":["../../../lib/test-utils/hooks/setup-mock-resize-observer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,YAYnC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"table-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/table-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,yBAAyB,EAA8C,MAAM,kBAAkB,CAAC;AAqF9G,eAAO,MAAM,WAAW,EAAE,yBAExB,CAAC"}
1
+ {"version":3,"file":"table-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/table-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,yBAAyB,EAA8C,MAAM,kBAAkB,CAAC;AA0G9G,eAAO,MAAM,WAAW,EAAE,yBAExB,CAAC"}
@@ -1,15 +1,22 @@
1
1
  import { createMultiStyleConfigHelpers as a, defineStyle as e } from "@chakra-ui/react";
2
- import { ThemeColorVariable as o, ThemeSpaceVariable as r, ThemeFontVariable as n } from "../../theme-types.js";
3
- import { ThemeFontSizeToken as t } from "../theme-tokens.js";
4
- import { tableAnatomy as l } from "../../../packages/casper-ui-library/node_modules/@chakra-ui/anatomy/dist/esm/components.js";
5
- const { definePartsStyle: d, defineMultiStyleConfig: i } = a(l.keys), p = e({
2
+ import { ThemeColorVariable as o, ThemeSpaceVariable as t, ThemeFontVariable as n } from "../../theme-types.js";
3
+ import { ThemeFontSizeToken as r } from "../theme-tokens.js";
4
+ import { tableAnatomy as d } from "../../../packages/casper-ui-library/node_modules/@chakra-ui/anatomy/dist/esm/components.js";
5
+ const { definePartsStyle: l, defineMultiStyleConfig: i } = a(d.keys), c = e({
6
6
  position: "relative",
7
7
  fontFamily: n.Body,
8
- fontSize: t.Small,
8
+ fontSize: r.Small,
9
+ thead: {
10
+ '&[data-sticky-headers="true"]': {
11
+ position: "sticky",
12
+ top: 0,
13
+ zIndex: 5
14
+ }
15
+ },
9
16
  th: {
10
17
  padding: "0px",
11
18
  position: "relative",
12
- fontSize: t.Small,
19
+ fontSize: r.Small,
13
20
  height: "40px",
14
21
  color: o.OnBackgroundSubdued,
15
22
  fontWeight: 400,
@@ -22,10 +29,10 @@ const { definePartsStyle: d, defineMultiStyleConfig: i } = a(l.keys), p = e({
22
29
  },
23
30
  td: {
24
31
  color: o.OnBackground,
25
- padding: `0px 0px 0px ${r.Small}`,
32
+ padding: `0px 0px 0px ${t.Small}`,
26
33
  borderRight: `1px solid ${o.OnBackgroundBorder}`,
27
34
  height: "40px",
28
- gap: r.XSmall,
35
+ gap: t.XSmall,
29
36
  _last: {
30
37
  borderRight: "none"
31
38
  },
@@ -37,7 +44,7 @@ const { definePartsStyle: d, defineMultiStyleConfig: i } = a(l.keys), p = e({
37
44
  tr: {
38
45
  borderColor: o.OnBackgroundBorder
39
46
  }
40
- }), b = e({
47
+ }), p = e({
41
48
  cursor: "pointer",
42
49
  backgroundColor: o.Surface,
43
50
  div: {
@@ -48,29 +55,42 @@ const { definePartsStyle: d, defineMultiStyleConfig: i } = a(l.keys), p = e({
48
55
  }
49
56
  }), s = e({
50
57
  color: o.OnBackground
51
- }), c = e({
52
- borderTop: "1px solid",
58
+ }), b = e({
59
+ borderTop: "none",
53
60
  _first: {
54
61
  borderTop: "none"
55
62
  },
56
63
  _last: {
57
64
  borderBottom: "1px solid",
58
65
  borderColor: o.OnBackgroundBorder
66
+ },
67
+ '&[data-row-selected="true"]': {
68
+ backgroundColor: o.AccentHoverAlpha
69
+ },
70
+ _hover: {
71
+ // Show action menu button on row hover
72
+ ".action-menu-button": { opacity: 1 },
73
+ '&[data-allow-hovered="true"]': {
74
+ backgroundColor: o.AccentHoverAlpha
75
+ }
76
+ },
77
+ '&[data-is-root-level="true"]:not(:first-of-type)': {
78
+ borderTop: `1px solid ${o.OnBackgroundBorder}`
59
79
  }
60
- }), g = e({
80
+ }), u = e({
61
81
  tr: {
62
82
  zIndex: 10,
63
83
  backgroundColor: o.OnBackgroundSubdued
64
84
  }
65
- }), u = d({
66
- table: p,
85
+ }), g = l({
86
+ table: c,
67
87
  tfoot: s,
68
- th: b,
69
- tr: c,
70
- thead: g
71
- }), x = i({
72
- baseStyle: u
88
+ th: p,
89
+ tr: b,
90
+ thead: u
91
+ }), k = i({
92
+ baseStyle: g
73
93
  });
74
94
  export {
75
- x as tableConfig
95
+ k as tableConfig
76
96
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspeco/casper-ui-library",
3
- "version": "8.2.0",
3
+ "version": "8.2.2",
4
4
  "prettier": "@caspeco/prettier-config",
5
5
  "type": "module",
6
6
  "sideEffects": false,