@caspeco/casper-ui-library 4.0.0 → 4.0.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.
Files changed (51) hide show
  1. package/dist/components/combobox/combobox-button.js +72 -73
  2. package/dist/components/combobox/combobox-menu.js +68 -69
  3. package/dist/components/combobox/combobox.js +104 -109
  4. package/dist/components/date-picker/base-date-picker.js +175 -176
  5. package/dist/components/date-picker/date-picker-header.js +10 -10
  6. package/dist/components/date-picker/helper.js +9 -9
  7. package/dist/components/image-upload/image-cropper.js +112 -113
  8. package/dist/components/image-upload/image-upload-dropzone.js +35 -36
  9. package/dist/components/menu/menu-group.js +44 -45
  10. package/dist/components/segmented-control/segmented-control.js +29 -29
  11. package/dist/components/table/table-cell.js +25 -26
  12. package/dist/components/table/table-header-dropdown.js +60 -60
  13. package/dist/components/table/table-header-row.js +19 -20
  14. package/dist/components/table/table-toolbar.js +63 -64
  15. package/dist/components/table/use-controllable-state.js +7 -7
  16. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +1 -1
  17. package/dist/node_modules/@tanstack/table-core/build/lib/index.js +41 -41
  18. package/dist/node_modules/date-fns/addDays.js +7 -7
  19. package/dist/node_modules/date-fns/addMonths.js +13 -13
  20. package/dist/node_modules/date-fns/differenceInCalendarDays.js +11 -11
  21. package/dist/node_modules/date-fns/endOfDay.js +6 -6
  22. package/dist/node_modules/date-fns/endOfMonth.js +6 -6
  23. package/dist/node_modules/date-fns/format.js +46 -47
  24. package/dist/node_modules/date-fns/getDayOfYear.js +8 -8
  25. package/dist/node_modules/date-fns/getISOWeek.js +9 -9
  26. package/dist/node_modules/date-fns/getISOWeekYear.js +10 -10
  27. package/dist/node_modules/date-fns/getWeek.js +9 -9
  28. package/dist/node_modules/date-fns/getWeekYear.js +13 -14
  29. package/dist/node_modules/date-fns/isSameDay.js +9 -9
  30. package/dist/node_modules/date-fns/isSameMonth.js +9 -9
  31. package/dist/node_modules/date-fns/isSameWeek.js +8 -8
  32. package/dist/node_modules/date-fns/isSameYear.js +9 -9
  33. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +12 -12
  34. package/dist/node_modules/date-fns/locale/da/_lib/formatDistance.js +4 -4
  35. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +3 -3
  36. package/dist/node_modules/date-fns/locale/es/_lib/formatDistance.js +4 -4
  37. package/dist/node_modules/date-fns/locale/et/_lib/formatDistance.js +6 -6
  38. package/dist/node_modules/date-fns/locale/fi/_lib/formatDistance.js +17 -17
  39. package/dist/node_modules/date-fns/locale/lt/_lib/formatDistance.js +47 -47
  40. package/dist/node_modules/date-fns/locale/lv/_lib/formatDistance.js +11 -11
  41. package/dist/node_modules/date-fns/locale/nb/_lib/formatDistance.js +3 -3
  42. package/dist/node_modules/date-fns/locale/nl/_lib/formatDistance.js +4 -4
  43. package/dist/node_modules/date-fns/locale/sv/_lib/formatDistance.js +5 -5
  44. package/dist/node_modules/date-fns/startOfDay.js +6 -6
  45. package/dist/node_modules/date-fns/startOfMonth.js +6 -6
  46. package/dist/node_modules/date-fns/startOfWeek.js +7 -8
  47. package/dist/node_modules/date-fns/startOfWeekYear.js +9 -10
  48. package/dist/node_modules/date-fns/startOfYear.js +5 -5
  49. package/dist/theme/theme-config/components/modal-theme.js +13 -15
  50. package/dist/theme/theme-config/components/select-theme.js +15 -19
  51. package/package.json +2 -2
@@ -1,41 +1,41 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { Box as b, ButtonGroup as p } from "@chakra-ui/react";
3
- import { SegmentedControlButton as t } from "./segmented-control-item.js";
4
- import { ThemeRadiusVariable as u, ThemeColorVariable as h, ThemeSpaceVariable as o } from "../../theme/theme-types.js";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { Box as m, ButtonGroup as s } from "@chakra-ui/react";
3
+ import { SegmentedControlButton as b } from "./segmented-control-item.js";
4
+ import { ThemeRadiusVariable as p, ThemeColorVariable as u, ThemeSpaceVariable as l } from "../../theme/theme-types.js";
5
5
  function g({
6
- items: e,
7
- activeItemId: n,
8
- onChange: l,
9
- isDisabled: d,
10
- size: i = "md",
11
- ...c
6
+ items: o,
7
+ activeItemId: i,
8
+ onChange: a,
9
+ isDisabled: n,
10
+ size: d = "md",
11
+ ...t
12
12
  }) {
13
- const s = (r) => {
14
- l && l(r);
13
+ const c = (r) => {
14
+ a && a(r);
15
15
  };
16
- return /* @__PURE__ */ a(
17
- b,
16
+ return /* @__PURE__ */ e(
17
+ m,
18
18
  {
19
- p: o.XSmall,
20
- bg: h.AccentContainer,
21
- borderRadius: u.Small,
22
- ...c,
23
- children: /* @__PURE__ */ a(
24
- p,
19
+ p: l.XSmall,
20
+ bg: u.AccentContainer,
21
+ borderRadius: p.Small,
22
+ ...t,
23
+ children: /* @__PURE__ */ e(
24
+ s,
25
25
  {
26
26
  w: "100%",
27
- isDisabled: d,
28
- spacing: o.XSmall,
27
+ isDisabled: n,
28
+ spacing: l.XSmall,
29
29
  _disabled: { opacity: 1, cursor: "not-allowed" },
30
- children: e.map((r) => /* @__PURE__ */ a(
31
- t,
30
+ children: o.map((r) => /* @__PURE__ */ e(
31
+ b,
32
32
  {
33
33
  item: r,
34
- onClick: s,
35
- isDisabled: r == null ? void 0 : r.isDisabled,
36
- isActive: n === r.id,
37
- size: i,
38
- "aria-label": r == null ? void 0 : r.ariaLabel,
34
+ onClick: c,
35
+ isDisabled: r?.isDisabled,
36
+ isActive: i === r.id,
37
+ size: d,
38
+ "aria-label": r?.ariaLabel,
39
39
  children: r.label
40
40
  },
41
41
  r.id
@@ -1,23 +1,22 @@
1
- import { jsx as o, jsxs as b, Fragment as C } from "react/jsx-runtime";
2
- import { Divider as S, Td as T, Flex as y } from "@chakra-ui/react";
3
- import { flexRender as I } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { memo as w, useMemo as l, useCallback as D } from "react";
5
- import { TableRowExpandToggleButton as F } from "./table-row-expand-toggle-button.js";
6
- import { ThemeColorVariable as R, ThemeSpaceVariable as z } from "../../theme/theme-types.js";
7
- const N = w(
8
- ({ cell: n, row: i, rowIsExpanded: p, visibleCells: u, breakingContentState: s, localeString: f }) => {
9
- var c;
10
- const { column: t } = n, h = l(() => {
1
+ import { jsx as o, jsxs as v, Fragment as b } from "react/jsx-runtime";
2
+ import { Divider as C, Td as S, Flex as T } from "@chakra-ui/react";
3
+ import { flexRender as y } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { memo as I, useMemo as l, useCallback as w } from "react";
5
+ import { TableRowExpandToggleButton as D } from "./table-row-expand-toggle-button.js";
6
+ import { ThemeColorVariable as F, ThemeSpaceVariable as R } from "../../theme/theme-types.js";
7
+ const j = I(
8
+ ({ cell: n, row: i, rowIsExpanded: c, visibleCells: p, breakingContentState: s, localeString: u }) => {
9
+ const { column: t } = n, f = l(() => {
11
10
  const e = {
12
11
  width: "100%"
13
12
  };
14
13
  return s[t.id] || (e.overflow = "hidden", e.whiteSpace = "nowrap"), e;
15
- }, [s]), x = l(() => t.getIndex() === 0, []), m = i.getCanExpand(), d = u[0].id === n.id, a = m && d, g = l(() => {
14
+ }, [s]), h = l(() => t.getIndex() === 0, []), m = i.getCanExpand(), d = p[0].id === n.id, a = m && d, x = l(() => {
16
15
  const e = [];
17
16
  for (let r = 0; r < i.depth; r += 1)
18
17
  e.push(
19
18
  /* @__PURE__ */ o(
20
- S,
19
+ C,
21
20
  {
22
21
  orientation: "vertical",
23
22
  position: "absolute",
@@ -29,39 +28,39 @@ const N = w(
29
28
  )
30
29
  );
31
30
  return e;
32
- }, []), v = D(() => {
31
+ }, []), g = w(() => {
33
32
  const e = t.getIsPinned();
34
33
  return {
35
34
  position: e ? "sticky" : "relative",
36
35
  left: e ? `${t.getStart("left")}px` : void 0,
37
- backgroundColor: e ? R.Background : void 0,
36
+ backgroundColor: e ? F.Background : void 0,
38
37
  zIndex: e ? 1 : void 0,
39
38
  width: t.getSize(),
40
39
  maxWidth: t.getSize()
41
40
  };
42
41
  }, []);
43
42
  return /* @__PURE__ */ o(
44
- T,
43
+ S,
45
44
  {
46
45
  id: i.id,
47
- isNumeric: (c = t.columnDef.meta) == null ? void 0 : c.isNumeric,
46
+ isNumeric: t.columnDef.meta?.isNumeric,
48
47
  style: {
49
- ...v(),
48
+ ...g(),
50
49
  borderBottom: 0,
51
- paddingLeft: i.depth && d || a ? `${i.depth * 2}rem` : z.Small
50
+ paddingLeft: i.depth && d || a ? `${i.depth * 2}rem` : R.Small
52
51
  },
53
- children: /* @__PURE__ */ b(y, { w: "100%", align: "center", children: [
52
+ children: /* @__PURE__ */ v(T, { w: "100%", align: "center", children: [
54
53
  a || i.depth > 0 && d ? /* @__PURE__ */ o(
55
- F,
54
+ D,
56
55
  {
57
56
  row: i,
58
- localeString: f,
57
+ localeString: u,
59
58
  hidden: !m,
60
- rowIsExpanded: p
59
+ rowIsExpanded: c
61
60
  }
62
- ) : /* @__PURE__ */ o(C, {}),
63
- x && g,
64
- /* @__PURE__ */ o("div", { style: h, children: I(t.columnDef.cell, n.getContext()) })
61
+ ) : /* @__PURE__ */ o(b, {}),
62
+ h && x,
63
+ /* @__PURE__ */ o("div", { style: f, children: y(t.columnDef.cell, n.getContext()) })
65
64
  ] })
66
65
  },
67
66
  n.id
@@ -69,5 +68,5 @@ const N = w(
69
68
  }
70
69
  );
71
70
  export {
72
- N as TableCell
71
+ j as TableCell
73
72
  };
@@ -1,115 +1,115 @@
1
- import { jsxs as f, Fragment as p, jsx as o } from "react/jsx-runtime";
2
- import { Portal as j } from "@chakra-ui/react";
3
- import { flexRender as A } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { memo as L, useContext as U, useCallback as I, useMemo as S } from "react";
5
- import { TableContext as X } from "./table-context.js";
6
- import { translations as v } from "./translations.js";
7
- import { Icon as T } from "../icon/icon.js";
1
+ import { jsxs as s, Fragment as u, jsx as n } from "react/jsx-runtime";
2
+ import { Portal as E } from "@chakra-ui/react";
3
+ import { flexRender as j } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { memo as A, useContext as L, useCallback as x, useMemo as g } from "react";
5
+ import { TableContext as U } from "./table-context.js";
6
+ import { translations as X } from "./translations.js";
7
+ import { Icon as I } from "../icon/icon.js";
8
8
  import { Icons as l } from "../icon/types.js";
9
9
  import { MenuItem as r } from "../menu/menu-item.js";
10
- import { Text as t } from "../text/text.js";
11
- import { MenuDivider as C } from "../menu/menu-divider.js";
12
- import { Switch as B } from "../switch/switch.js";
10
+ import { Text as c } from "../text/text.js";
11
+ import { MenuDivider as S } from "../menu/menu-divider.js";
12
+ import { Switch as v } from "../switch/switch.js";
13
13
  import { Menu as O } from "../menu/menu.js";
14
14
  import { MenuBoxButton as R } from "../menu/menu-box-button.js";
15
15
  import { MenuList as $ } from "../menu/menu-list.js";
16
- import { ThemeIconSizeVariable as b, ThemeColorVariable as z, ThemeSpaceVariable as q, ThemeFontSizeVariable as M } from "../../theme/theme-types.js";
17
- const mo = L(
16
+ import { ThemeIconSizeVariable as T, ThemeColorVariable as b, ThemeSpaceVariable as q, ThemeFontSizeVariable as k } from "../../theme/theme-types.js";
17
+ const dn = A(
18
18
  ({
19
- header: n,
19
+ header: o,
20
20
  breakingContentState: m,
21
- onBreakingContentChange: d,
22
- setBreakingContentState: k,
23
- headerGroup: D,
24
- sorting: s,
21
+ onBreakingContentChange: f,
22
+ setBreakingContentState: D,
23
+ headerGroup: z,
24
+ sorting: d,
25
25
  setSorting: a,
26
- columnVisibility: g,
26
+ columnVisibility: M,
27
27
  localeString: w
28
28
  }) => {
29
- const i = v[w], u = U(X), F = I(
29
+ const i = X[w], p = L(U), B = x(
30
30
  (e) => {
31
- const c = {
31
+ const t = {
32
32
  ...m,
33
- [n.column.id]: e.target.checked
33
+ [o.column.id]: e.target.checked
34
34
  };
35
- k(c), d == null || d(c);
35
+ D(t), f?.(t);
36
36
  },
37
- [m, d]
38
- ), P = I(
37
+ [m, f]
38
+ ), F = x(
39
39
  (e) => {
40
- const c = e.getIndex();
41
- D.forEach((H) => {
42
- H.headers.forEach((E, h) => {
43
- const { column: x } = E;
44
- e.getIsPinned() ? h >= c && x.pin(!1) : h <= c && x.pin("left");
40
+ const t = e.getIndex();
41
+ z.forEach((y) => {
42
+ y.headers.forEach((H, h) => {
43
+ const { column: C } = H;
44
+ e.getIsPinned() ? h >= t && C.pin(!1) : h <= t && C.pin("left");
45
45
  });
46
46
  });
47
47
  },
48
48
  []
49
- ), V = S(() => /* @__PURE__ */ f(p, { children: [
50
- s.find((e) => e.id === n.column.id) && (s.find((e) => e.desc) ? /* @__PURE__ */ o(T, { icon: l.SortDesc, size: b.XSmall }) : /* @__PURE__ */ o(T, { icon: l.SortAsc, size: b.XSmall })),
51
- n.column.columnDef.header
52
- ] }), [s]), y = S(() => /* @__PURE__ */ f(p, { children: [
53
- /* @__PURE__ */ o(
49
+ ), P = g(() => /* @__PURE__ */ s(u, { children: [
50
+ d.find((e) => e.id === o.column.id) && (d.find((e) => e.desc) ? /* @__PURE__ */ n(I, { icon: l.SortDesc, size: T.XSmall }) : /* @__PURE__ */ n(I, { icon: l.SortAsc, size: T.XSmall })),
51
+ o.column.columnDef.header
52
+ ] }), [d]), V = g(() => /* @__PURE__ */ s(u, { children: [
53
+ /* @__PURE__ */ n(
54
54
  r,
55
55
  {
56
- onClick: () => a([{ desc: !1, id: n.column.id }]),
56
+ onClick: () => a([{ desc: !1, id: o.column.id }]),
57
57
  leftIcon: l.SortAsc,
58
- children: /* @__PURE__ */ o(t, { children: i.sortUp })
58
+ children: /* @__PURE__ */ n(c, { children: i.sortUp })
59
59
  }
60
60
  ),
61
- /* @__PURE__ */ o(
61
+ /* @__PURE__ */ n(
62
62
  r,
63
63
  {
64
- onClick: () => a([{ desc: !0, id: n.column.id }]),
64
+ onClick: () => a([{ desc: !0, id: o.column.id }]),
65
65
  leftIcon: l.SortDesc,
66
- children: /* @__PURE__ */ o(t, { children: i.sortDown })
66
+ children: /* @__PURE__ */ n(c, { children: i.sortDown })
67
67
  }
68
68
  ),
69
- /* @__PURE__ */ o(
69
+ /* @__PURE__ */ n(
70
70
  r,
71
71
  {
72
72
  onClick: () => {
73
- u != null && u.onFilterColumn && u.onFilterColumn(n.column);
73
+ p?.onFilterColumn && p.onFilterColumn(o.column);
74
74
  },
75
75
  leftIcon: l.Filter,
76
- children: /* @__PURE__ */ o(t, { children: i.filter })
76
+ children: /* @__PURE__ */ n(c, { children: i.filter })
77
77
  }
78
78
  ),
79
- /* @__PURE__ */ o(C, {}),
80
- n.column.getCanHide() && /* @__PURE__ */ o(r, { onClick: n.column.getToggleVisibilityHandler(), leftIcon: l.Hide, children: /* @__PURE__ */ o(t, { children: i.hideColumn }) }),
81
- /* @__PURE__ */ o(r, { onClick: () => P(n.column), leftIcon: l.Thumbtack, children: /* @__PURE__ */ o(t, { children: n.column.getIsPinned() ? i.stopPinningColumn : i.pinUpToColumn }) }),
82
- /* @__PURE__ */ o(C, {}),
83
- /* @__PURE__ */ f(r, { itemType: "switch", children: [
79
+ /* @__PURE__ */ n(S, {}),
80
+ o.column.getCanHide() && /* @__PURE__ */ n(r, { onClick: o.column.getToggleVisibilityHandler(), leftIcon: l.Hide, children: /* @__PURE__ */ n(c, { children: i.hideColumn }) }),
81
+ /* @__PURE__ */ n(r, { onClick: () => F(o.column), leftIcon: l.Thumbtack, children: /* @__PURE__ */ n(c, { children: o.column.getIsPinned() ? i.stopPinningColumn : i.pinUpToColumn }) }),
82
+ /* @__PURE__ */ n(S, {}),
83
+ /* @__PURE__ */ s(r, { itemType: "switch", children: [
84
84
  i.breakingContent,
85
- /* @__PURE__ */ o(
86
- B,
85
+ /* @__PURE__ */ n(
86
+ v,
87
87
  {
88
- onChange: F,
89
- isChecked: m[n.column.id]
88
+ onChange: B,
89
+ isChecked: m[o.column.id]
90
90
  }
91
91
  )
92
92
  ] })
93
- ] }), [m, g, s]);
94
- return /* @__PURE__ */ o(O, { isLazy: !0, children: ({ isOpen: e }) => /* @__PURE__ */ f(p, { children: [
95
- /* @__PURE__ */ o(
93
+ ] }), [m, M, d]);
94
+ return /* @__PURE__ */ n(O, { isLazy: !0, children: ({ isOpen: e }) => /* @__PURE__ */ s(u, { children: [
95
+ /* @__PURE__ */ n(
96
96
  R,
97
97
  {
98
- color: z.OnBackgroundSubdued,
98
+ color: b.OnBackgroundSubdued,
99
99
  textTransform: "none",
100
- fontSize: M.Small,
100
+ fontSize: k.Small,
101
101
  h: "40px",
102
102
  display: "flex",
103
103
  alignItems: "center",
104
104
  padding: `0px 0px 0px ${q.Small}`,
105
- backgroundColor: e ? z.BackgroundDisabled : "unset",
106
- children: A(V, n.getContext())
105
+ backgroundColor: e ? b.BackgroundDisabled : "unset",
106
+ children: j(P, o.getContext())
107
107
  }
108
108
  ),
109
- /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o($, { fontSize: M.Medium, children: y }) })
109
+ /* @__PURE__ */ n(E, { children: /* @__PURE__ */ n($, { fontSize: k.Medium, children: V }) })
110
110
  ] }) });
111
111
  }
112
112
  );
113
113
  export {
114
- mo as TableHeaderDropdown
114
+ dn as TableHeaderDropdown
115
115
  };
@@ -1,21 +1,21 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import { Tr as s, Th as d } from "@chakra-ui/react";
3
- import { flexRender as g } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { memo as c, useContext as p, useCallback as b } from "react";
5
- import { TableContext as C } from "./table-context.js";
6
- import { TableHeaderDropdown as f } from "./table-header-dropdown.js";
7
- import { Box as u } from "../box/box.js";
8
- import { ThemeColorVariable as a, ThemeSpaceVariable as S } from "../../theme/theme-types.js";
9
- const z = c(({ headerGroup: r, hideTableHeaderDropdown: l }) => {
10
- const t = p(C);
2
+ import { Tr as m, Th as s } from "@chakra-ui/react";
3
+ import { flexRender as d } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { memo as g, useContext as c, useCallback as p } from "react";
5
+ import { TableContext as b } from "./table-context.js";
6
+ import { TableHeaderDropdown as C } from "./table-header-dropdown.js";
7
+ import { Box as f } from "../box/box.js";
8
+ import { ThemeColorVariable as i, ThemeSpaceVariable as u } from "../../theme/theme-types.js";
9
+ const D = g(({ headerGroup: r, hideTableHeaderDropdown: a }) => {
10
+ const t = c(b);
11
11
  if (!t) throw new Error("Expected tableData");
12
- const m = b(
12
+ const l = p(
13
13
  (e) => {
14
14
  const o = e.getIsPinned();
15
15
  return {
16
16
  position: o ? "sticky" : "relative",
17
17
  left: o ? `${e.getStart("left")}px` : void 0,
18
- backgroundColor: o ? a.Background : void 0,
18
+ backgroundColor: o ? i.Background : void 0,
19
19
  zIndex: o ? 1 : 0,
20
20
  width: e.getSize(),
21
21
  maxWidth: e.getSize()
@@ -23,21 +23,20 @@ const z = c(({ headerGroup: r, hideTableHeaderDropdown: l }) => {
23
23
  },
24
24
  []
25
25
  );
26
- return /* @__PURE__ */ n(s, { children: r.headers.map((e) => {
27
- var i;
26
+ return /* @__PURE__ */ n(m, { children: r.headers.map((e) => {
28
27
  const { column: o } = e;
29
28
  return /* @__PURE__ */ n(
30
- d,
29
+ s,
31
30
  {
32
31
  className: "tableHeaderCell",
33
- isNumeric: (i = o.columnDef.meta) == null ? void 0 : i.isNumeric,
32
+ isNumeric: o.columnDef.meta?.isNumeric,
34
33
  zIndex: o.getIsPinned() ? 2 : 1,
35
34
  style: {
36
- ...m(o),
37
- borderBottom: `1px solid ${a.OnBackgroundBorder}`
35
+ ...l(o),
36
+ borderBottom: `1px solid ${i.OnBackgroundBorder}`
38
37
  },
39
- children: l ? /* @__PURE__ */ n(u, { paddingLeft: S.Small, children: g(e.column.columnDef.header, e.getContext()) }) : /* @__PURE__ */ n(
40
- f,
38
+ children: a ? /* @__PURE__ */ n(f, { paddingLeft: u.Small, children: d(e.column.columnDef.header, e.getContext()) }) : /* @__PURE__ */ n(
39
+ C,
41
40
  {
42
41
  header: e,
43
42
  breakingContentState: t.breakingContentState,
@@ -56,5 +55,5 @@ const z = c(({ headerGroup: r, hideTableHeaderDropdown: l }) => {
56
55
  }) }, r.id);
57
56
  });
58
57
  export {
59
- z as TableHeaderRow
58
+ D as TableHeaderRow
60
59
  };
@@ -1,108 +1,107 @@
1
- import { jsx as t, jsxs as o, Fragment as F } from "react/jsx-runtime";
2
- import { useMediaQuery as L, Flex as i, Box as j, Portal as z } from "@chakra-ui/react";
3
- import { memo as O, useContext as v, useCallback as A, useMemo as g } from "react";
4
- import { TableContext as H } from "./table-context.js";
5
- import { translations as E } from "./translations.js";
6
- import { Text as f } from "../text/text.js";
7
- import { Input as G } from "../input/input.js";
8
- import { Icon as C } from "../icon/icon.js";
9
- import { Icons as m } from "../icon/types.js";
10
- import { Menu as D } from "../menu/menu.js";
11
- import { MenuButton as N } from "../menu/menu-button.js";
12
- import { MenuList as P } from "../menu/menu-list.js";
13
- import { MenuItem as k } from "../menu/menu-item.js";
14
- import { Checkbox as Q } from "../checkbox/checkbox.js";
15
- import { MenuDivider as W } from "../menu/menu-divider.js";
16
- import { Switch as X } from "../switch/switch.js";
17
- import { IconButton as q } from "../icon-button/icon-button.js";
18
- import { ThemeSpaceVariable as r, ThemeFontVariable as J, ThemeColorVariable as S, ThemeFontSizeVariable as K, ThemeIconSizeVariable as R } from "../../theme/theme-types.js";
19
- function U({
20
- tableName: T,
21
- onSearch: c,
1
+ import { jsx as t, jsxs as o, Fragment as V } from "react/jsx-runtime";
2
+ import { useMediaQuery as F, Flex as i, Box as L, Portal as j } from "@chakra-ui/react";
3
+ import { memo as z, useContext as O, useCallback as v, useMemo as p } from "react";
4
+ import { TableContext as A } from "./table-context.js";
5
+ import { translations as H } from "./translations.js";
6
+ import { Text as g } from "../text/text.js";
7
+ import { Input as D } from "../input/input.js";
8
+ import { Icon as f } from "../icon/icon.js";
9
+ import { Icons as c } from "../icon/types.js";
10
+ import { Menu as E } from "../menu/menu.js";
11
+ import { MenuButton as G } from "../menu/menu-button.js";
12
+ import { MenuList as N } from "../menu/menu-list.js";
13
+ import { MenuItem as C } from "../menu/menu-item.js";
14
+ import { Checkbox as P } from "../checkbox/checkbox.js";
15
+ import { MenuDivider as Q } from "../menu/menu-divider.js";
16
+ import { Switch as W } from "../switch/switch.js";
17
+ import { IconButton as X } from "../icon-button/icon-button.js";
18
+ import { ThemeSpaceVariable as r, ThemeFontVariable as q, ThemeColorVariable as S, ThemeFontSizeVariable as J, ThemeIconSizeVariable as K } from "../../theme/theme-types.js";
19
+ function R({
20
+ tableName: k,
21
+ onSearch: T,
22
22
  onAddNewItem: y,
23
23
  ...M
24
24
  }) {
25
- const e = v(H);
25
+ const e = O(A);
26
26
  if (!e) throw new Error("No table context found");
27
- const [x] = L("(min-width: 48em)"), l = E[e.localeString], s = A(() => e.table.getAllColumns().length === Object.keys(e.breakingContentState).length && !Object.values(e.breakingContentState).includes(!1), [e.breakingContentState]), I = (n) => {
28
- var d;
29
- const a = {};
30
- e.table.getAllColumns().forEach((V) => {
31
- a[V.id] = n.target.checked;
32
- }), e.setBreakingContentState(a), (d = e.onBreakingContentChange) == null || d.call(e, a);
33
- }, u = () => /* @__PURE__ */ t(
34
- G,
27
+ const [x] = F("(min-width: 48em)"), a = H[e.localeString], m = v(() => e.table.getAllColumns().length === Object.keys(e.breakingContentState).length && !Object.values(e.breakingContentState).includes(!1), [e.breakingContentState]), I = (n) => {
28
+ const l = {};
29
+ e.table.getAllColumns().forEach((b) => {
30
+ l[b.id] = n.target.checked;
31
+ }), e.setBreakingContentState(l), e.onBreakingContentChange?.(l);
32
+ }, s = () => /* @__PURE__ */ t(
33
+ D,
35
34
  {
36
- leftElement: /* @__PURE__ */ t(C, { icon: m.Search }),
37
- onChange: (n) => c == null ? void 0 : c(n),
35
+ leftElement: /* @__PURE__ */ t(f, { icon: c.Search }),
36
+ onChange: (n) => T?.(n),
38
37
  size: "md",
39
38
  type: "search",
40
39
  w: { base: "100%", md: "170px" },
41
40
  "data-testid": "filterInput"
42
41
  }
43
- ), h = () => /* @__PURE__ */ t(i, { children: /* @__PURE__ */ o(D, { closeOnSelect: !1, isLazy: !0, children: [
44
- /* @__PURE__ */ t(N, { "aria-label": l.presets, variant: "ghost", p: "unset", w: "40px", h: "40px", children: /* @__PURE__ */ t(C, { icon: m.Sliders, size: R.Medium }) }),
45
- /* @__PURE__ */ t(z, { children: /* @__PURE__ */ o(P, { children: [
42
+ ), d = () => /* @__PURE__ */ t(i, { children: /* @__PURE__ */ o(E, { closeOnSelect: !1, isLazy: !0, children: [
43
+ /* @__PURE__ */ t(G, { "aria-label": a.presets, variant: "ghost", p: "unset", w: "40px", h: "40px", children: /* @__PURE__ */ t(f, { icon: c.Sliders, size: K.Medium }) }),
44
+ /* @__PURE__ */ t(j, { children: /* @__PURE__ */ o(N, { children: [
46
45
  /* @__PURE__ */ t(
47
- f,
46
+ g,
48
47
  {
49
48
  color: S.OnSurfaceSubdued,
50
49
  py: r.Small,
51
50
  px: r.Medium,
52
- children: l.showColumns
51
+ children: a.showColumns
53
52
  }
54
53
  ),
55
- e.table.getAllLeafColumns().filter((n) => n.getCanHide()).map((n) => /* @__PURE__ */ o(k, { itemType: "checkbox", leftIcon: m.GripMore, children: [
56
- /* @__PURE__ */ t(F, { children: n.columnDef.header }),
54
+ e.table.getAllLeafColumns().filter((n) => n.getCanHide()).map((n) => /* @__PURE__ */ o(C, { itemType: "checkbox", leftIcon: c.GripMore, children: [
55
+ /* @__PURE__ */ t(V, { children: n.columnDef.header }),
57
56
  /* @__PURE__ */ t(
58
- Q,
57
+ P,
59
58
  {
60
59
  isChecked: n.getIsVisible(),
61
60
  onChange: n.getToggleVisibilityHandler()
62
61
  }
63
62
  )
64
63
  ] }, n.id)),
65
- /* @__PURE__ */ t(W, {}),
66
- /* @__PURE__ */ o(k, { itemType: "switch", children: [
67
- l.breakingContent,
68
- /* @__PURE__ */ t(X, { onChange: I, isChecked: s() })
64
+ /* @__PURE__ */ t(Q, {}),
65
+ /* @__PURE__ */ o(C, { itemType: "switch", children: [
66
+ a.breakingContent,
67
+ /* @__PURE__ */ t(W, { onChange: I, isChecked: m() })
69
68
  ] })
70
69
  ] }) })
71
- ] }) }), b = () => /* @__PURE__ */ t(q, { "aria-label": l.new, icon: m.Increase, onClick: y, variant: "primary" }), p = () => /* @__PURE__ */ t(
72
- f,
70
+ ] }) }), u = () => /* @__PURE__ */ t(X, { "aria-label": a.new, icon: c.Increase, onClick: y, variant: "primary" }), h = () => /* @__PURE__ */ t(
71
+ g,
73
72
  {
74
- fontSize: K.X2Large,
73
+ fontSize: J.X2Large,
75
74
  color: S.OnBackgroundHeader,
76
75
  fontWeight: "bold",
77
- fontFamily: J.Header,
78
- children: T
76
+ fontFamily: q.Header,
77
+ children: k
79
78
  }
80
- ), w = g(
79
+ ), w = p(
81
80
  () => /* @__PURE__ */ t(i, { direction: "column", gap: r.Medium, mb: r.Medium, children: /* @__PURE__ */ o(i, { justifyContent: "space-between", alignItems: "center", children: [
82
- p(),
81
+ h(),
83
82
  /* @__PURE__ */ o(i, { gap: r.Medium, children: [
84
- u(),
85
- h(),
86
- b()
83
+ s(),
84
+ d(),
85
+ u()
87
86
  ] })
88
87
  ] }) }),
89
- [s, e.breakingContentState, e.columnVisibility, e.data]
90
- ), B = g(
88
+ [m, e.breakingContentState, e.columnVisibility, e.data]
89
+ ), B = p(
91
90
  () => /* @__PURE__ */ o(i, { direction: "column", gap: r.Medium, mb: r.Medium, children: [
92
91
  /* @__PURE__ */ o(i, { justifyContent: "space-between", children: [
93
- p(),
94
- b()
92
+ h(),
93
+ u()
95
94
  ] }),
96
95
  /* @__PURE__ */ o(i, { justifyContent: "space-between", gap: r.Medium, children: [
97
- u(),
98
- h()
96
+ s(),
97
+ d()
99
98
  ] })
100
99
  ] }),
101
- [s, e.breakingContentState, e.columnVisibility]
100
+ [m, e.breakingContentState, e.columnVisibility]
102
101
  );
103
- return /* @__PURE__ */ t(j, { id: "tableToolbar", ...M, children: x ? w : B });
102
+ return /* @__PURE__ */ t(L, { id: "tableToolbar", ...M, children: x ? w : B });
104
103
  }
105
- const be = O(U);
104
+ const he = z(R);
106
105
  export {
107
- be as TableToolbar
106
+ he as TableToolbar
108
107
  };
@@ -1,12 +1,12 @@
1
- import { useState as i } from "react";
2
- function p(e, t, s) {
3
- const [r, u] = i(s);
4
- return [e !== void 0 ? e : r, (o) => {
5
- if (typeof o == "function")
1
+ import { useState as s } from "react";
2
+ function a(o, e, n) {
3
+ const [r, l] = s(n);
4
+ return [o !== void 0 ? o : r, (t) => {
5
+ if (typeof t == "function")
6
6
  throw new Error("Function as argument is not supported.");
7
- u(o), t == null || t(o);
7
+ l(t), e?.(t);
8
8
  }];
9
9
  }
10
10
  export {
11
- p as useControllableState
11
+ a as useControllableState
12
12
  };
@@ -369,7 +369,7 @@ function Et(t, e, n, i) {
369
369
  var d;
370
370
  u.forEach((y) => {
371
371
  o && y.removeEventListener("scroll", n), r && y.removeEventListener("resize", n);
372
- }), h == null || h(), (d = a) == null || d.disconnect(), a = null, l && cancelAnimationFrame(x);
372
+ }), h?.(), (d = a) == null || d.disconnect(), a = null, l && cancelAnimationFrame(x);
373
373
  };
374
374
  }
375
375
  const Ft = st, Wt = (t, e, n) => {