@caspeco/casper-ui-library 7.0.0 → 7.0.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.
@@ -106,11 +106,10 @@ function be({
106
106
  const $ = ce(I), R = (t) => {
107
107
  if (!t || x || S)
108
108
  return;
109
- if (t.id === "_back") {
109
+ if (O.current?.parentNode?.querySelector("input")?.focus(), t.id === "_back") {
110
110
  f.back();
111
111
  return;
112
112
  }
113
- O.current?.parentNode?.querySelector("input")?.focus();
114
113
  const d = f.opened.length > 0 && f.opened[f.opened.length - 1]?.id === t.id;
115
114
  if (!v && !d && t.children && t.children.length > 0) {
116
115
  f.open(t), requestAnimationFrame(() => E.set(1));
@@ -1,50 +1,50 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { Tr as x } from "@chakra-ui/react";
3
- import { memo as h, useMemo as u, useCallback as r } from "react";
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { Tr as T } from "@chakra-ui/react";
3
+ import { memo as x, useMemo as l, useCallback as s } from "react";
4
4
  import { TableCell as S } from "./table-cell.js";
5
- import { useTableContext as y } from "./table-context.js";
6
- import { ThemeColorVariable as a } from "../../theme/theme-types.js";
7
- const A = ({
5
+ import { useTableContext as h } from "./table-context.js";
6
+ import { ThemeColorVariable as r } from "../../theme/theme-types.js";
7
+ const y = ({
8
8
  row: e,
9
- visibleCells: i,
9
+ visibleCells: a,
10
10
  onClickRow: o,
11
- showRowHoverStyle: c,
12
- onRowClickIndication: d
11
+ showRowHoverStyle: i,
12
+ onRowClickIndication: c
13
13
  }) => {
14
- const n = y(), g = u(() => ({ backgroundColor: c ? a.AccentHoverAlpha : "unset", ".action-menu-button": { opacity: 1 } }), [c]), m = r(
14
+ const n = h(), u = l(() => ({ backgroundColor: i ? r.AccentHoverAlpha : "unset", ".action-menu-button": { opacity: 1 } }), [i]), g = s(
15
15
  (t) => {
16
16
  o && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), o(e.original, t));
17
17
  },
18
18
  [o, e.original]
19
- ), p = r(
19
+ ), m = s(
20
20
  (t) => {
21
- t.stopPropagation(), e.getToggleSelectedHandler(), o && o(e.original, t), d && n.setRowSelection({ [t.currentTarget.id]: !0 });
21
+ t.stopPropagation(), e.getToggleSelectedHandler(), o && o(e.original, t), c && n.setRowSelection({ [t.currentTarget.id]: !0 });
22
22
  },
23
- [e, o, d, n]
24
- ), l = r(() => e.getIsSelected() ? a.AccentHoverAlpha : "unset", [e]), b = u(() => l(), [l]), f = n.getRowActions?.(e.original);
25
- return /* @__PURE__ */ s(
26
- x,
23
+ [e, o, c, n]
24
+ ), p = l(() => e.getIsSelected() ? r.AccentHoverAlpha : "unset", [e, n.rowSelection]), b = n.getRowActions?.(e.original);
25
+ return /* @__PURE__ */ d(
26
+ T,
27
27
  {
28
28
  id: e.id,
29
29
  tabIndex: o ? 0 : void 0,
30
- onClick: p,
31
- onKeyDown: m,
32
- borderTop: e.depth > 0 ? "none" : `1px solid ${a.OnBackgroundBorder}`,
30
+ onClick: m,
31
+ onKeyDown: g,
32
+ borderTop: e.depth > 0 ? "none" : `1px solid ${r.OnBackgroundBorder}`,
33
33
  cursor: o ? "pointer" : void 0,
34
- backgroundColor: b,
35
- _hover: g,
36
- children: i.map((t) => {
37
- const T = t.column.getIndex() === 0;
38
- return /* @__PURE__ */ s(
34
+ backgroundColor: p,
35
+ _hover: u,
36
+ children: a.map((t) => {
37
+ const f = t.column.getIndex() === 0;
38
+ return /* @__PURE__ */ d(
39
39
  S,
40
40
  {
41
41
  cell: t,
42
- visibleCells: i,
42
+ visibleCells: a,
43
43
  row: e,
44
44
  rowIsExpanded: e.getIsExpanded(),
45
45
  breakingContentState: n.breakingContentState,
46
46
  localeString: n.localeString,
47
- actionMenu: T ? f : void 0
47
+ actionMenu: f ? b : void 0
48
48
  },
49
49
  t.id
50
50
  );
@@ -52,7 +52,7 @@ const A = ({
52
52
  },
53
53
  e.id
54
54
  );
55
- }, H = h(A);
55
+ }, k = x(y);
56
56
  export {
57
- H as TableRow
57
+ k as TableRow
58
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"table-toolbar.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar.tsx"],"names":[],"mappings":"AAOA,OAAO,EAMN,KAAK,eAAe,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,KAAK,WAAW,EAA8B,MAAM,OAAO,CAAC;AAIrE,MAAM,MAAM,iBAAiB,GAAG;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACtD;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,iBAAS,iBAAiB,CAAC,EAC1B,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,GAAG,KAAK,EACR,EAAE,iBAAiB,GAAG,eAAe,2CAyJrC;AAED,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
1
+ {"version":3,"file":"table-toolbar.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-toolbar.tsx"],"names":[],"mappings":"AAOA,OAAO,EAMN,KAAK,eAAe,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,KAAK,WAAW,EAA8B,MAAM,OAAO,CAAC;AAIrE,MAAM,MAAM,iBAAiB,GAAG;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACtD;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,iBAAS,iBAAiB,CAAC,EAC1B,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,GAAG,KAAK,EACR,EAAE,iBAAiB,GAAG,eAAe,2CA2JrC;AAED,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
@@ -1,28 +1,28 @@
1
- import { jsx as e, jsxs as r, Fragment as L } from "react/jsx-runtime";
2
- import { useMediaQuery as j, Flex as a, Portal as V, Box as z } from "@chakra-ui/react";
3
- import { memo as O, useCallback as l, useMemo as S } from "react";
4
- import { useTableContext as v } from "./table-context.js";
5
- import { translations as H } from "./translations.js";
1
+ import { jsx as e, jsxs as r, Fragment as j } from "react/jsx-runtime";
2
+ import { useMediaQuery as V, Flex as a, Portal as z, Box as S } from "@chakra-ui/react";
3
+ import { memo as v, useCallback as l, useMemo as T } from "react";
4
+ import { useTableContext as H } from "./table-context.js";
5
+ import { translations as O } from "./translations.js";
6
6
  import { Input as A } from "../input/input.js";
7
- import { Icon as T } from "../icon/icon.js";
7
+ import { Icon as M } from "../icon/icon.js";
8
8
  import { Icons as h } from "../icon/types.js";
9
9
  import { Menu as D } from "../menu/menu.js";
10
10
  import { MenuButton as G } from "../menu/menu-button.js";
11
11
  import { MenuList as E } from "../menu/menu-list.js";
12
- import { Text as M } from "../text/text.js";
12
+ import { Text as x } from "../text/text.js";
13
13
  import { MenuItem as y } from "../menu/menu-item.js";
14
14
  import { Checkbox as P } from "../checkbox/checkbox.js";
15
15
  import { MenuDivider as Q } from "../menu/menu-divider.js";
16
16
  import { Switch as W } from "../switch/switch.js";
17
17
  import { IconButton as X } from "../icon-button/icon-button.js";
18
- import { ThemeIconSizeVariable as q, ThemeSpaceVariable as i, ThemeColorVariable as I, ThemeFontVariable as J, ThemeFontSizeVariable as K } from "../../theme/theme-types.js";
19
- function R({
18
+ import { ThemeIconSizeVariable as Y, ThemeSpaceVariable as i, ThemeColorVariable as I, ThemeFontVariable as q, ThemeFontSizeVariable as J } from "../../theme/theme-types.js";
19
+ function K({
20
20
  tableName: p,
21
21
  onSearch: b,
22
22
  onAddNewItem: g,
23
- ...x
23
+ ...w
24
24
  }) {
25
- const t = v(), [w] = j("(min-width: 48em)"), o = H[t.localeString], f = l(() => t.table.getAllColumns().length === Object.keys(t.breakingContentState).length && !Object.values(t.breakingContentState).includes(!1), [t.breakingContentState, t.table]), C = l(
25
+ const t = H(), [B] = V("(min-width: 48em)"), o = O[t.localeString], f = l(() => t.table.getAllColumns().length === Object.keys(t.breakingContentState).length && !Object.values(t.breakingContentState).includes(!1), [t.breakingContentState, t.table]), C = l(
26
26
  (n) => {
27
27
  const u = {};
28
28
  t.table.getAllColumns().forEach((k) => {
@@ -30,11 +30,11 @@ function R({
30
30
  }), t.setBreakingContentState(u), t.onBreakingContentChange?.(u);
31
31
  },
32
32
  [t]
33
- ), s = l(
33
+ ), c = l(
34
34
  () => /* @__PURE__ */ e(
35
35
  A,
36
36
  {
37
- leftElement: /* @__PURE__ */ e(T, { icon: h.Search }),
37
+ leftElement: /* @__PURE__ */ e(M, { icon: h.Search }),
38
38
  onChange: (n) => b?.(n),
39
39
  size: "md",
40
40
  type: "search",
@@ -43,12 +43,12 @@ function R({
43
43
  }
44
44
  ),
45
45
  [b]
46
- ), c = l(
46
+ ), s = l(
47
47
  () => /* @__PURE__ */ e(a, { children: /* @__PURE__ */ r(D, { closeOnSelect: !1, isLazy: !0, children: [
48
- /* @__PURE__ */ e(G, { "aria-label": o.presets, variant: "ghost", p: "unset", w: "40px", h: "40px", children: /* @__PURE__ */ e(T, { icon: h.Sliders, size: q.Medium }) }),
49
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ r(E, { children: [
48
+ /* @__PURE__ */ e(G, { "aria-label": o.presets, variant: "ghost", p: "unset", w: "40px", h: "40px", children: /* @__PURE__ */ e(M, { icon: h.Sliders, size: Y.Medium }) }),
49
+ /* @__PURE__ */ e(z, { children: /* @__PURE__ */ r(E, { children: [
50
50
  /* @__PURE__ */ e(
51
- M,
51
+ x,
52
52
  {
53
53
  color: I.OnSurfaceSubdued,
54
54
  py: i.Small,
@@ -56,8 +56,8 @@ function R({
56
56
  children: o.showColumns
57
57
  }
58
58
  ),
59
- t.table.getAllLeafColumns().filter((n) => n.getCanHide()).map((n) => /* @__PURE__ */ r(y, { itemType: "checkbox", leftIcon: h.GripMore, children: [
60
- /* @__PURE__ */ e(L, { children: n.columnDef.header }),
59
+ /* @__PURE__ */ e(S, { maxHeight: "320px", overflowY: "auto", children: t.table.getAllLeafColumns().filter((n) => n.getCanHide()).map((n) => /* @__PURE__ */ r(y, { itemType: "checkbox", leftIcon: h.GripMore, children: [
60
+ /* @__PURE__ */ e(j, { children: n.columnDef.header }),
61
61
  /* @__PURE__ */ e(
62
62
  P,
63
63
  {
@@ -65,7 +65,7 @@ function R({
65
65
  onChange: n.getToggleVisibilityHandler()
66
66
  }
67
67
  )
68
- ] }, n.id)),
68
+ ] }, n.id)) }),
69
69
  /* @__PURE__ */ e(Q, {}),
70
70
  /* @__PURE__ */ r(y, { itemType: "switch", children: [
71
71
  o.breakingContent,
@@ -88,48 +88,48 @@ function R({
88
88
  "aria-label": o.new,
89
89
  icon: h.Increase,
90
90
  onClick: g,
91
- variant: "primary"
91
+ variant: "secondary"
92
92
  }
93
93
  ),
94
94
  [g, o.new]
95
95
  ), d = l(
96
96
  () => /* @__PURE__ */ e(
97
- M,
97
+ x,
98
98
  {
99
- fontSize: K.X2Large,
99
+ fontSize: J.X2Large,
100
100
  color: I.OnBackgroundHeader,
101
101
  fontWeight: "bold",
102
- fontFamily: J.Header,
102
+ fontFamily: q.Header,
103
103
  children: p
104
104
  }
105
105
  ),
106
106
  [p]
107
- ), B = S(
107
+ ), F = T(
108
108
  () => /* @__PURE__ */ e(a, { direction: "column", gap: i.Medium, mb: i.Medium, children: /* @__PURE__ */ r(a, { justifyContent: "space-between", alignItems: "center", children: [
109
109
  d(),
110
110
  /* @__PURE__ */ r(a, { gap: i.Medium, children: [
111
- s(),
112
111
  c(),
112
+ s(),
113
113
  m()
114
114
  ] })
115
115
  ] }) }),
116
- [m, s, c, d]
117
- ), F = S(
116
+ [m, c, s, d]
117
+ ), L = T(
118
118
  () => /* @__PURE__ */ r(a, { direction: "column", gap: i.Medium, mb: i.Medium, children: [
119
119
  /* @__PURE__ */ r(a, { justifyContent: "space-between", children: [
120
120
  d(),
121
121
  m()
122
122
  ] }),
123
123
  /* @__PURE__ */ r(a, { justifyContent: "space-between", gap: i.Medium, children: [
124
- s(),
125
- c()
124
+ c(),
125
+ s()
126
126
  ] })
127
127
  ] }),
128
- [m, s, c, d]
128
+ [m, c, s, d]
129
129
  );
130
- return /* @__PURE__ */ e(z, { id: "tableToolbar", ...x, children: w ? B : F });
130
+ return /* @__PURE__ */ e(S, { id: "tableToolbar", ...w, children: B ? F : L });
131
131
  }
132
- const ue = O(R);
132
+ const ue = v(K);
133
133
  export {
134
134
  ue as TableToolbar
135
135
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caspeco/casper-ui-library",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "prettier": "@caspeco/prettier-config",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -35,18 +35,18 @@
35
35
  "@testing-library/react": "^16.3.0",
36
36
  "@testing-library/user-event": "^14.6.1",
37
37
  "@types/jest": "^30.0.0",
38
- "@types/node": "^24.7.0",
38
+ "@types/node": "^24.7.2",
39
39
  "@types/react": "^18.3.12",
40
40
  "@types/react-dom": "^18.3.1",
41
41
  "@vitejs/plugin-react-swc": "^4.1.0",
42
42
  "eslint": "^9.37.0",
43
- "eslint-plugin-react-hooks": "^6.1.1",
43
+ "eslint-plugin-react-hooks": "^7.0.0",
44
44
  "eslint-plugin-react-refresh": "^0.4.23",
45
45
  "globals": "^16.4.0",
46
46
  "jsdom": "^27.0.0",
47
47
  "tsc-alias": "^1.8.16",
48
48
  "typescript": "~5.9.3",
49
- "typescript-eslint": "^8.45.0",
49
+ "typescript-eslint": "^8.46.0",
50
50
  "vite": "^7.1.9",
51
51
  "vite-plugin-dts": "^4.5.4",
52
52
  "vite-tsconfig-paths": "^5.1.4",