@caspeco/casper-ui-library 5.6.0 → 6.0.0

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 (43) hide show
  1. package/dist/components/table/index.d.ts +2 -3
  2. package/dist/components/table/index.d.ts.map +1 -1
  3. package/dist/components/table/table-cell.d.ts +11 -6
  4. package/dist/components/table/table-cell.d.ts.map +1 -1
  5. package/dist/components/table/table-cell.js +118 -69
  6. package/dist/components/table/table-content.d.ts +4 -4
  7. package/dist/components/table/table-content.d.ts.map +1 -1
  8. package/dist/components/table/table-content.js +17 -20
  9. package/dist/components/table/table-context-provider.d.ts +57 -0
  10. package/dist/components/table/table-context-provider.d.ts.map +1 -0
  11. package/dist/components/table/table-context-provider.js +115 -0
  12. package/dist/components/table/table-context.d.ts +4 -54
  13. package/dist/components/table/table-context.d.ts.map +1 -1
  14. package/dist/components/table/table-context.js +10 -108
  15. package/dist/components/table/table-header-dropdown.d.ts +6 -4
  16. package/dist/components/table/table-header-dropdown.d.ts.map +1 -1
  17. package/dist/components/table/table-header-dropdown.js +98 -103
  18. package/dist/components/table/table-header-row.d.ts +5 -3
  19. package/dist/components/table/table-header-row.d.ts.map +1 -1
  20. package/dist/components/table/table-header-row.js +32 -33
  21. package/dist/components/table/table-row-expand-toggle-button.d.ts +2 -2
  22. package/dist/components/table/table-row-expand-toggle-button.d.ts.map +1 -1
  23. package/dist/components/table/table-row-expand-toggle-button.js +14 -13
  24. package/dist/components/table/table-row.d.ts +6 -6
  25. package/dist/components/table/table-row.d.ts.map +1 -1
  26. package/dist/components/table/table-row.js +41 -43
  27. package/dist/components/table/table-toolbar.d.ts +2 -3
  28. package/dist/components/table/table-toolbar.d.ts.map +1 -1
  29. package/dist/components/table/table-toolbar.js +38 -40
  30. package/dist/components/table/table.composition.d.ts +3 -3
  31. package/dist/components/table/table.composition.d.ts.map +1 -1
  32. package/dist/components/table/table.d.ts +2 -2
  33. package/dist/components/table/table.d.ts.map +1 -1
  34. package/dist/components/table/table.js +20 -18
  35. package/dist/components/table/translations.d.ts +5 -0
  36. package/dist/components/table/translations.d.ts.map +1 -1
  37. package/dist/components/table/translations.js +8 -4
  38. package/dist/components/table/types.d.ts +29 -11
  39. package/dist/components/table/types.d.ts.map +1 -1
  40. package/dist/index.js +26 -24
  41. package/dist/theme/theme-config/components/tag-theme.d.ts.map +1 -1
  42. package/dist/theme/theme-config/components/tag-theme.js +13 -12
  43. package/package.json +7 -6
@@ -1,110 +1,12 @@
1
- import { jsx as H } from "react/jsx-runtime";
2
- import { useControllableState as i } from "@chakra-ui/react";
3
- import { useReactTable as J } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { useState as R, useEffect as K, useCallback as s, createContext as L } from "react";
5
- import { getFilteredRowModel as N, getSortedRowModel as Q, getExpandedRowModel as U, getCoreRowModel as W } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
6
- const X = L(null), O = ({
7
- data: a,
8
- columns: p,
9
- children: h,
10
- expandedState: x,
11
- localeString: M,
12
- initialExpandedState: r = {},
13
- initialBreakingContentState: d = {},
14
- initialColumnVisibilityState: v = {},
15
- columnVisibilityState: y,
16
- onColumnVisibilityChange: E,
17
- onExpandedChange: u,
18
- getRowId: c,
19
- onBreakingContentChange: V,
20
- onFilterColumn: T,
21
- id: k,
22
- customRowIndication: n,
23
- onSortingChange: b,
24
- initialSortingState: F = [],
25
- sortingState: f
26
- }) => {
27
- const [t, g] = i({
28
- value: x,
29
- onChange: u,
30
- defaultValue: r
31
- }), [l, P] = i({
32
- value: y,
33
- onChange: E,
34
- defaultValue: v
35
- }), [C, S] = i({
36
- value: f,
37
- onChange: b,
38
- defaultValue: F
39
- }), [j, q] = R(
40
- d || {}
41
- ), [w, m] = R({});
42
- K(() => {
43
- n && m(n);
44
- }, [n]);
45
- const z = s(
46
- (e) => {
47
- let o;
48
- typeof e == "function" ? o = e(l) : o = e, P(o);
49
- },
50
- [l]
51
- ), A = s(
52
- (e) => {
53
- let o;
54
- typeof e == "function" ? o = e(t) : o = e, g(o);
55
- },
56
- [t]
57
- ), B = s(
58
- (e) => {
59
- S(e);
60
- },
61
- [S]
62
- ), D = J({
63
- columns: p,
64
- data: a,
65
- getCoreRowModel: W(),
66
- getExpandedRowModel: U(),
67
- getSortedRowModel: Q(),
68
- getFilteredRowModel: N(),
69
- onColumnVisibilityChange: z,
70
- onExpandedChange: A,
71
- getSubRows: (e) => e.subRows,
72
- getRowId: c,
73
- enableSubRowSelection: !0,
74
- enableMultiRowSelection: !1,
75
- enableRowSelection: !0,
76
- state: {
77
- sorting: C,
78
- columnVisibility: l,
79
- expanded: t,
80
- rowSelection: w
81
- },
82
- manualSorting: f !== void 0
83
- }), G = {
84
- data: a,
85
- table: D,
86
- initialExpandedState: r,
87
- initialBreakingContentState: d,
88
- localeString: M,
89
- onExpandedChange: u,
90
- expanded: t,
91
- sorting: C,
92
- setSorting: B,
93
- setExpanded: g,
94
- getRowId: c,
95
- breakingContentState: j,
96
- setBreakingContentState: q,
97
- onBreakingContentChange: V,
98
- onFilterColumn: T,
99
- id: k,
100
- setRowSelection: m,
101
- rowSelection: w,
102
- columnVisibility: l,
103
- onSortingChange: b
104
- };
105
- return /* @__PURE__ */ H(X.Provider, { value: G, children: h });
106
- };
1
+ import { useContext as e, createContext as o } from "react";
2
+ const n = o(null);
3
+ function u() {
4
+ const t = e(n);
5
+ if (!t)
6
+ throw new Error("useTableContext must be used within a TableProvider");
7
+ return t;
8
+ }
107
9
  export {
108
- X as TableContext,
109
- O as TableProvider
10
+ n as TableContext,
11
+ u as useTableContext
110
12
  };
@@ -1,16 +1,18 @@
1
1
  import { Header, HeaderGroup, SortingState, VisibilityState } from '@tanstack/react-table';
2
2
  import { Locales } from './translations.js';
3
- type TableHeaderDropdownProps = {
4
- header: Header<any, unknown>;
3
+ import { TableData, TableRow } from './types.js';
4
+ type TableHeaderDropdownProps<TData extends TableData> = {
5
+ header: Header<TableRow<TData>, unknown>;
5
6
  breakingContentState: Record<string, boolean>;
6
7
  onBreakingContentChange?: (breakingContentState: Record<string, boolean>) => void;
7
8
  setBreakingContentState: (value: React.SetStateAction<Record<string, boolean>>) => void;
8
- headerGroup: HeaderGroup<any>[];
9
+ headerGroup: HeaderGroup<TableRow<TData>>[];
9
10
  sorting: SortingState;
10
11
  setSorting: (value: SortingState) => void;
11
12
  columnVisibility: VisibilityState;
12
13
  localeString: Locales;
13
14
  };
14
- export declare const TableHeaderDropdown: import('react').MemoExoticComponent<({ header, breakingContentState, onBreakingContentChange, setBreakingContentState, headerGroup, sorting, setSorting, columnVisibility, localeString, }: TableHeaderDropdownProps) => import("react/jsx-runtime").JSX.Element>;
15
+ declare const TableHeaderDropdownComponent: <TData extends TableData>({ header, breakingContentState, onBreakingContentChange, setBreakingContentState, headerGroup, sorting, setSorting, columnVisibility, localeString, }: TableHeaderDropdownProps<TData>) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const TableHeaderDropdown: typeof TableHeaderDropdownComponent;
15
17
  export {};
16
18
  //# sourceMappingURL=table-header-dropdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table-header-dropdown.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-dropdown.tsx"],"names":[],"mappings":"AAWA,OAAO,EAGN,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,gBAAgB,CAAC;AAG5D,KAAK,wBAAwB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,uBAAuB,CAAC,EAAE,CAAC,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAClF,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,CAA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KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1C,gBAAgB,EAAE,eAAe,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,4BAA4B,GAAI,KAAK,SAAS,SAAS,EAAE,uJAU5D,wBAAwB,CAAC,KAAK,CAAC,4CAqHjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAyC,OAAO,4BAA4B,CAAC"}
@@ -1,115 +1,110 @@
1
1
  import { jsxs as s, Fragment as u, jsx as n } from "react/jsx-runtime";
2
2
  import { Portal as E } from "@chakra-ui/react";
3
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";
4
+ import { memo as A, useCallback as x, useMemo as g } from "react";
5
+ import { useTableContext as L } from "./table-context.js";
6
+ import { translations as U } from "./translations.js";
7
+ import { Icon as T } 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
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
- import { Menu as O } from "../menu/menu.js";
14
- import { MenuBoxButton as R } from "../menu/menu-box-button.js";
15
- import { MenuList as $ } from "../menu/menu-list.js";
16
- import { ThemeIconSizeVariable as T, ThemeColorVariable as b, ThemeSpaceVariable as q, ThemeFontSizeVariable as k } from "../../theme/theme-types.js";
17
- const dn = A(
18
- ({
19
- header: o,
20
- breakingContentState: m,
21
- onBreakingContentChange: f,
22
- setBreakingContentState: D,
23
- headerGroup: z,
24
- sorting: d,
25
- setSorting: a,
26
- columnVisibility: M,
27
- localeString: w
28
- }) => {
29
- const i = X[w], p = L(U), B = x(
30
- (e) => {
31
- const t = {
32
- ...m,
33
- [o.column.id]: e.target.checked
34
- };
35
- D(t), f?.(t);
36
- },
37
- [m, f]
38
- ), F = x(
39
- (e) => {
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
- });
46
- });
47
- },
48
- []
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: [
11
+ import { MenuDivider as b } from "../menu/menu-divider.js";
12
+ import { Switch as X } from "../switch/switch.js";
13
+ import { Menu as v } from "../menu/menu.js";
14
+ import { MenuBoxButton as O } from "../menu/menu-box-button.js";
15
+ import { MenuList as R } from "../menu/menu-list.js";
16
+ import { ThemeIconSizeVariable as I, ThemeColorVariable as S, ThemeSpaceVariable as $, ThemeFontSizeVariable as k } from "../../theme/theme-types.js";
17
+ const q = ({
18
+ header: o,
19
+ breakingContentState: m,
20
+ onBreakingContentChange: f,
21
+ setBreakingContentState: D,
22
+ headerGroup: z,
23
+ sorting: d,
24
+ setSorting: a,
25
+ columnVisibility: M,
26
+ localeString: w
27
+ }) => {
28
+ const i = U[w], p = L(), B = x(
29
+ (e) => {
30
+ const t = {
31
+ ...m,
32
+ [o.column.id]: e.target.checked
33
+ };
34
+ D(t), f?.(t);
35
+ },
36
+ [m, f]
37
+ ), F = x((e) => {
38
+ const t = e.getIndex();
39
+ z.forEach((V) => {
40
+ V.headers.forEach((y, h) => {
41
+ const { column: C } = y;
42
+ e.getIsPinned() ? h >= t && C.pin(!1) : h <= t && C.pin("left");
43
+ });
44
+ });
45
+ }, []), H = g(() => /* @__PURE__ */ s(u, { children: [
46
+ d.find((e) => e.id === o.column.id) && (d.find((e) => e.desc) ? /* @__PURE__ */ n(T, { icon: l.SortDesc, size: I.XSmall }) : /* @__PURE__ */ n(T, { icon: l.SortAsc, size: I.XSmall })),
47
+ o.column.columnDef.header
48
+ ] }), [d]), P = g(() => /* @__PURE__ */ s(u, { children: [
49
+ /* @__PURE__ */ n(
50
+ r,
51
+ {
52
+ onClick: () => a([{ desc: !1, id: o.column.id }]),
53
+ leftIcon: l.SortAsc,
54
+ children: /* @__PURE__ */ n(c, { children: i.sortUp })
55
+ }
56
+ ),
57
+ /* @__PURE__ */ n(
58
+ r,
59
+ {
60
+ onClick: () => a([{ desc: !0, id: o.column.id }]),
61
+ leftIcon: l.SortDesc,
62
+ children: /* @__PURE__ */ n(c, { children: i.sortDown })
63
+ }
64
+ ),
65
+ /* @__PURE__ */ n(
66
+ r,
67
+ {
68
+ onClick: () => {
69
+ p?.onFilterColumn && p.onFilterColumn(o.column);
70
+ },
71
+ leftIcon: l.Filter,
72
+ children: /* @__PURE__ */ n(c, { children: i.filter })
73
+ }
74
+ ),
75
+ /* @__PURE__ */ n(b, {}),
76
+ o.column.getCanHide() && /* @__PURE__ */ n(r, { onClick: o.column.getToggleVisibilityHandler(), leftIcon: l.Hide, children: /* @__PURE__ */ n(c, { children: i.hideColumn }) }),
77
+ /* @__PURE__ */ n(r, { onClick: () => F(o.column), leftIcon: l.Thumbtack, children: /* @__PURE__ */ n(c, { children: o.column.getIsPinned() ? i.stopPinningColumn : i.pinUpToColumn }) }),
78
+ /* @__PURE__ */ n(b, {}),
79
+ /* @__PURE__ */ s(r, { itemType: "switch", children: [
80
+ i.breakingContent,
53
81
  /* @__PURE__ */ n(
54
- r,
82
+ X,
55
83
  {
56
- onClick: () => a([{ desc: !1, id: o.column.id }]),
57
- leftIcon: l.SortAsc,
58
- children: /* @__PURE__ */ n(c, { children: i.sortUp })
84
+ onChange: B,
85
+ isChecked: m[o.column.id]
59
86
  }
60
- ),
61
- /* @__PURE__ */ n(
62
- r,
63
- {
64
- onClick: () => a([{ desc: !0, id: o.column.id }]),
65
- leftIcon: l.SortDesc,
66
- children: /* @__PURE__ */ n(c, { children: i.sortDown })
67
- }
68
- ),
69
- /* @__PURE__ */ n(
70
- r,
71
- {
72
- onClick: () => {
73
- p?.onFilterColumn && p.onFilterColumn(o.column);
74
- },
75
- leftIcon: l.Filter,
76
- children: /* @__PURE__ */ n(c, { children: i.filter })
77
- }
78
- ),
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
- i.breakingContent,
85
- /* @__PURE__ */ n(
86
- v,
87
- {
88
- onChange: B,
89
- isChecked: m[o.column.id]
90
- }
91
- )
92
- ] })
93
- ] }), [m, M, d]);
94
- return /* @__PURE__ */ n(O, { isLazy: !0, children: ({ isOpen: e }) => /* @__PURE__ */ s(u, { children: [
95
- /* @__PURE__ */ n(
96
- R,
97
- {
98
- color: b.OnBackgroundSubdued,
99
- textTransform: "none",
100
- fontSize: k.Small,
101
- h: "40px",
102
- display: "flex",
103
- alignItems: "center",
104
- padding: `0px 0px 0px ${q.Small}`,
105
- backgroundColor: e ? b.BackgroundDisabled : "unset",
106
- children: j(P, o.getContext())
107
- }
108
- ),
109
- /* @__PURE__ */ n(E, { children: /* @__PURE__ */ n($, { fontSize: k.Medium, children: V }) })
110
- ] }) });
111
- }
112
- );
87
+ )
88
+ ] })
89
+ ] }), [m, M, d]);
90
+ return /* @__PURE__ */ n(v, { isLazy: !0, children: ({ isOpen: e }) => /* @__PURE__ */ s(u, { children: [
91
+ /* @__PURE__ */ n(
92
+ O,
93
+ {
94
+ color: S.OnBackgroundSubdued,
95
+ textTransform: "none",
96
+ fontSize: k.Small,
97
+ h: "40px",
98
+ display: "flex",
99
+ alignItems: "center",
100
+ padding: `0px 0px 0px ${$.Small}`,
101
+ backgroundColor: e ? S.BackgroundDisabled : "unset",
102
+ children: j(H, o.getContext())
103
+ }
104
+ ),
105
+ /* @__PURE__ */ n(E, { children: /* @__PURE__ */ n(R, { fontSize: k.Medium, children: P }) })
106
+ ] }) });
107
+ }, dn = A(q);
113
108
  export {
114
109
  dn as TableHeaderDropdown
115
110
  };
@@ -1,8 +1,10 @@
1
1
  import { HeaderGroup } from '@tanstack/react-table';
2
- type TableHeaderRowProps = {
3
- headerGroup: HeaderGroup<any>;
2
+ import { TableData, TableRow } from './types.js';
3
+ type TableHeaderRowProps<TData extends TableData> = {
4
+ headerGroup: HeaderGroup<TableRow<TData>>;
4
5
  hideTableHeaderDropdown: boolean | undefined;
5
6
  };
6
- export declare const TableHeaderRow: import('react').MemoExoticComponent<({ headerGroup, hideTableHeaderDropdown }: TableHeaderRowProps) => import("react/jsx-runtime").JSX.Element>;
7
+ declare const TableHeaderRowComponent: <TData extends TableData>({ headerGroup, hideTableHeaderDropdown, }: TableHeaderRowProps<TData>) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const TableHeaderRow: typeof TableHeaderRowComponent;
7
9
  export {};
8
10
  //# sourceMappingURL=table-header-row.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,WAAW,EAAc,MAAM,uBAAuB,CAAC;AAMlF,KAAK,mBAAmB,GAAG;IAC1B,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,uBAAuB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,cAAc,iFAAmD,mBAAmB,6CAwD/F,CAAC"}
1
+ {"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,WAAW,EAAc,MAAM,uBAAuB,CAAC;AAIlF,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD,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,2CAGvD,mBAAmB,CAAC,KAAK,CAAC,4CAuD5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAoC,OAAO,uBAAuB,CAAC"}
@@ -1,42 +1,41 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
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";
2
+ import { Tr as m, Th as g } from "@chakra-ui/react";
3
+ import { flexRender as c } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { memo as p, useCallback as u } from "react";
5
+ import { useTableContext as C } from "./table-context.js";
6
+ import { TableHeaderDropdown as b } from "./table-header-dropdown.js";
7
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
- if (!t) throw new Error("Expected tableData");
12
- const l = p(
13
- (e) => {
14
- const o = e.getIsPinned();
15
- return {
16
- position: o ? "sticky" : "relative",
17
- left: o ? `${e.getStart("left")}px` : void 0,
18
- backgroundColor: o ? i.Background : void 0,
19
- zIndex: o ? 1 : 0,
20
- width: e.getSize(),
21
- maxWidth: e.getSize()
22
- };
23
- },
24
- []
25
- );
26
- return /* @__PURE__ */ n(m, { children: r.headers.map((e) => {
27
- const { column: o } = e;
8
+ import { ThemeColorVariable as r, ThemeSpaceVariable as S } from "../../theme/theme-types.js";
9
+ const x = ({
10
+ headerGroup: i,
11
+ hideTableHeaderDropdown: a
12
+ }) => {
13
+ const t = C(), l = !!t.getRowActions, s = u((e) => {
14
+ const o = e.getIsPinned();
15
+ return {
16
+ position: o ? "sticky" : "relative",
17
+ left: o ? `${e.getStart("left")}px` : void 0,
18
+ backgroundColor: o ? r.Background : void 0,
19
+ zIndex: o ? 1 : 0,
20
+ width: e.getSize(),
21
+ maxWidth: e.getSize()
22
+ };
23
+ }, []);
24
+ return /* @__PURE__ */ n(m, { children: i.headers.map((e) => {
25
+ const { column: o } = e, d = o.getIndex() === 0;
28
26
  return /* @__PURE__ */ n(
29
- s,
27
+ g,
30
28
  {
31
29
  className: "tableHeaderCell",
32
30
  isNumeric: o.columnDef.meta?.isNumeric,
33
31
  zIndex: o.getIsPinned() ? 2 : 1,
34
32
  style: {
35
- ...l(o),
36
- borderBottom: `1px solid ${i.OnBackgroundBorder}`
33
+ ...s(o),
34
+ borderBottom: `1px solid ${r.OnBackgroundBorder}`,
35
+ paddingLeft: d && l ? "24px" : void 0
37
36
  },
38
- children: a ? /* @__PURE__ */ n(f, { paddingLeft: u.Small, children: d(e.column.columnDef.header, e.getContext()) }) : /* @__PURE__ */ n(
39
- C,
37
+ children: a ? /* @__PURE__ */ n(f, { paddingLeft: S.Small, children: c(e.column.columnDef.header, e.getContext()) }) : /* @__PURE__ */ n(
38
+ b,
40
39
  {
41
40
  header: e,
42
41
  breakingContentState: t.breakingContentState,
@@ -52,8 +51,8 @@ const D = g(({ headerGroup: r, hideTableHeaderDropdown: a }) => {
52
51
  },
53
52
  e.id
54
53
  );
55
- }) }, r.id);
56
- });
54
+ }) }, i.id);
55
+ }, P = p(x);
57
56
  export {
58
- D as TableHeaderRow
57
+ P as TableHeaderRow
59
58
  };
@@ -1,8 +1,8 @@
1
1
  import { Row } from '@tanstack/react-table';
2
2
  import { Locales } from './translations.js';
3
- import { TableDataType } from './types.js';
3
+ import { TableRow } from './types.js';
4
4
  interface TableRowExpandToggleButtonProps {
5
- row: Row<TableDataType<any>>;
5
+ row: Row<TableRow>;
6
6
  localeString: Locales;
7
7
  rowIsExpanded: boolean;
8
8
  hidden?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"table-row-expand-toggle-button.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row-expand-toggle-button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,UAAU,+BAA+B;IACxC,GAAG,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,0BAA0B,qFACS,+BAA+B,6CAkC9E,CAAC"}
1
+ {"version":3,"file":"table-row-expand-toggle-button.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row-expand-toggle-button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,UAAU,+BAA+B;IACxC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,0BAA0B,qFACS,+BAA+B,6CAoC9E,CAAC"}
@@ -1,32 +1,33 @@
1
- import { jsx as r } from "react/jsx-runtime";
1
+ import { jsx as t } from "react/jsx-runtime";
2
2
  import { Box as c } from "@chakra-ui/react";
3
3
  import { memo as d } from "react";
4
4
  import { translations as x } from "./translations.js";
5
5
  import { IconButton as g } from "../icon-button/icon-button.js";
6
6
  import { Icons as i } from "../icon/types.js";
7
7
  import { ThemeSpaceVariable as f } from "../../theme/theme-types.js";
8
- const R = d(
9
- ({ row: o, localeString: l, rowIsExpanded: a, hidden: n }) => {
10
- const e = x[l], m = o.getToggleExpandedHandler(), p = (t) => {
11
- t.stopPropagation(), m();
12
- }, s = () => a ? `${e.collapseRow} ${o.index + 1}` : `${e.expandRow} ${o.index + 1}`;
13
- return /* @__PURE__ */ r(c, { as: "span", h: "100%", children: /* @__PURE__ */ r(
8
+ const B = d(
9
+ ({ row: o, localeString: l, rowIsExpanded: n, hidden: a }) => {
10
+ const r = x[l], m = o.getToggleExpandedHandler(), p = (e) => {
11
+ e.stopPropagation(), m();
12
+ }, s = () => n ? `${r.collapseRow} ${o.index + 1}` : `${r.expandRow} ${o.index + 1}`;
13
+ return /* @__PURE__ */ t(c, { as: "span", h: "100%", children: /* @__PURE__ */ t(
14
14
  g,
15
15
  {
16
16
  size: "sm",
17
17
  mr: f.XSmall,
18
18
  variant: "ghost",
19
19
  "aria-label": s(),
20
- icon: a ? i.TreeViewCollapse : i.TreeViewExpand,
20
+ icon: n ? i.TreeViewCollapse : i.TreeViewExpand,
21
21
  onClick: p,
22
- onKeyDown: (t) => t.stopPropagation(),
23
- visibility: n ? "hidden" : "initial",
24
- "aria-hidden": n,
25
- tabIndex: n ? -1 : 0
22
+ onKeyDown: (e) => e.stopPropagation(),
23
+ visibility: a ? "hidden" : "initial",
24
+ "aria-hidden": a,
25
+ tabIndex: a ? -1 : 0,
26
+ borderRadius: "0"
26
27
  }
27
28
  ) });
28
29
  }
29
30
  );
30
31
  export {
31
- R as TableRowExpandToggleButton
32
+ B as TableRowExpandToggleButton
32
33
  };
@@ -1,13 +1,13 @@
1
1
  import { Cell, Row } from '@tanstack/react-table';
2
- import { TableDataType, TableSubrows } from './types.js';
3
- type TableRowProps<J extends TableSubrows<J>> = {
4
- row: Row<J>;
5
- visibleCells: Cell<any, unknown>[];
6
- onClickRow?: (row: TableDataType<J>, event: React.MouseEvent<HTMLTableRowElement> | React.KeyboardEvent<HTMLTableRowElement>) => void;
2
+ import { TableData, TableRow as TableRowType } from './types.js';
3
+ type TableRowProps<TData extends TableData> = {
4
+ row: Row<TableRowType<TData>>;
5
+ visibleCells: Cell<TableRowType<TData>, unknown>[];
6
+ onClickRow?: (row: TableRowType<TData>, event: React.MouseEvent<HTMLTableRowElement> | React.KeyboardEvent<HTMLTableRowElement>) => void;
7
7
  showRowHoverStyle?: boolean;
8
8
  onRowClickIndication?: boolean;
9
9
  };
10
- declare const TableRowInner: <T extends TableSubrows<T>>({ row, visibleCells, onClickRow, showRowHoverStyle, onRowClickIndication, }: TableRowProps<T>) => import("react/jsx-runtime").JSX.Element;
10
+ declare const TableRowInner: <TData extends TableData>({ row, visibleCells, onClickRow, showRowHoverStyle, onRowClickIndication, }: TableRowProps<TData>) => import("react/jsx-runtime").JSX.Element;
11
11
  export declare const TableRow: typeof TableRowInner;
12
12
  export {};
13
13
  //# sourceMappingURL=table-row.d.ts.map
@@ -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,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE3D,KAAK,aAAa,CAAC,CAAC,SAAS,YAAY,CAAC,CAAC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