@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.
- package/dist/components/combobox/combobox-button.js +72 -73
- package/dist/components/combobox/combobox-menu.js +68 -69
- package/dist/components/combobox/combobox.js +104 -109
- package/dist/components/date-picker/base-date-picker.js +175 -176
- package/dist/components/date-picker/date-picker-header.js +10 -10
- package/dist/components/date-picker/helper.js +9 -9
- package/dist/components/image-upload/image-cropper.js +112 -113
- package/dist/components/image-upload/image-upload-dropzone.js +35 -36
- package/dist/components/menu/menu-group.js +44 -45
- package/dist/components/segmented-control/segmented-control.js +29 -29
- package/dist/components/table/table-cell.js +25 -26
- package/dist/components/table/table-header-dropdown.js +60 -60
- package/dist/components/table/table-header-row.js +19 -20
- package/dist/components/table/table-toolbar.js +63 -64
- package/dist/components/table/use-controllable-state.js +7 -7
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +1 -1
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +41 -41
- package/dist/node_modules/date-fns/addDays.js +7 -7
- package/dist/node_modules/date-fns/addMonths.js +13 -13
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +11 -11
- package/dist/node_modules/date-fns/endOfDay.js +6 -6
- package/dist/node_modules/date-fns/endOfMonth.js +6 -6
- package/dist/node_modules/date-fns/format.js +46 -47
- package/dist/node_modules/date-fns/getDayOfYear.js +8 -8
- package/dist/node_modules/date-fns/getISOWeek.js +9 -9
- package/dist/node_modules/date-fns/getISOWeekYear.js +10 -10
- package/dist/node_modules/date-fns/getWeek.js +9 -9
- package/dist/node_modules/date-fns/getWeekYear.js +13 -14
- package/dist/node_modules/date-fns/isSameDay.js +9 -9
- package/dist/node_modules/date-fns/isSameMonth.js +9 -9
- package/dist/node_modules/date-fns/isSameWeek.js +8 -8
- package/dist/node_modules/date-fns/isSameYear.js +9 -9
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +12 -12
- package/dist/node_modules/date-fns/locale/da/_lib/formatDistance.js +4 -4
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +3 -3
- package/dist/node_modules/date-fns/locale/es/_lib/formatDistance.js +4 -4
- package/dist/node_modules/date-fns/locale/et/_lib/formatDistance.js +6 -6
- package/dist/node_modules/date-fns/locale/fi/_lib/formatDistance.js +17 -17
- package/dist/node_modules/date-fns/locale/lt/_lib/formatDistance.js +47 -47
- package/dist/node_modules/date-fns/locale/lv/_lib/formatDistance.js +11 -11
- package/dist/node_modules/date-fns/locale/nb/_lib/formatDistance.js +3 -3
- package/dist/node_modules/date-fns/locale/nl/_lib/formatDistance.js +4 -4
- package/dist/node_modules/date-fns/locale/sv/_lib/formatDistance.js +5 -5
- package/dist/node_modules/date-fns/startOfDay.js +6 -6
- package/dist/node_modules/date-fns/startOfMonth.js +6 -6
- package/dist/node_modules/date-fns/startOfWeek.js +7 -8
- package/dist/node_modules/date-fns/startOfWeekYear.js +9 -10
- package/dist/node_modules/date-fns/startOfYear.js +5 -5
- package/dist/theme/theme-config/components/modal-theme.js +13 -15
- package/dist/theme/theme-config/components/select-theme.js +15 -19
- package/package.json +2 -2
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Box as
|
|
3
|
-
import { SegmentedControlButton as
|
|
4
|
-
import { ThemeRadiusVariable as
|
|
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:
|
|
7
|
-
activeItemId:
|
|
8
|
-
onChange:
|
|
9
|
-
isDisabled:
|
|
10
|
-
size:
|
|
11
|
-
...
|
|
6
|
+
items: o,
|
|
7
|
+
activeItemId: i,
|
|
8
|
+
onChange: a,
|
|
9
|
+
isDisabled: n,
|
|
10
|
+
size: d = "md",
|
|
11
|
+
...t
|
|
12
12
|
}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
const c = (r) => {
|
|
14
|
+
a && a(r);
|
|
15
15
|
};
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
16
|
+
return /* @__PURE__ */ e(
|
|
17
|
+
m,
|
|
18
18
|
{
|
|
19
|
-
p:
|
|
20
|
-
bg:
|
|
21
|
-
borderRadius:
|
|
22
|
-
...
|
|
23
|
-
children: /* @__PURE__ */
|
|
24
|
-
|
|
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:
|
|
28
|
-
spacing:
|
|
27
|
+
isDisabled: n,
|
|
28
|
+
spacing: l.XSmall,
|
|
29
29
|
_disabled: { opacity: 1, cursor: "not-allowed" },
|
|
30
|
-
children:
|
|
31
|
-
|
|
30
|
+
children: o.map((r) => /* @__PURE__ */ e(
|
|
31
|
+
b,
|
|
32
32
|
{
|
|
33
33
|
item: r,
|
|
34
|
-
onClick:
|
|
35
|
-
isDisabled: r
|
|
36
|
-
isActive:
|
|
37
|
-
size:
|
|
38
|
-
"aria-label": r
|
|
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
|
|
2
|
-
import { Divider as
|
|
3
|
-
import { flexRender as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { TableRowExpandToggleButton as
|
|
6
|
-
import { ThemeColorVariable as
|
|
7
|
-
const
|
|
8
|
-
({ cell: n, row: i, rowIsExpanded:
|
|
9
|
-
|
|
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]),
|
|
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
|
-
|
|
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
|
-
}, []),
|
|
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 ?
|
|
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
|
-
|
|
43
|
+
S,
|
|
45
44
|
{
|
|
46
45
|
id: i.id,
|
|
47
|
-
isNumeric:
|
|
46
|
+
isNumeric: t.columnDef.meta?.isNumeric,
|
|
48
47
|
style: {
|
|
49
|
-
...
|
|
48
|
+
...g(),
|
|
50
49
|
borderBottom: 0,
|
|
51
|
-
paddingLeft: i.depth && d || a ? `${i.depth * 2}rem` :
|
|
50
|
+
paddingLeft: i.depth && d || a ? `${i.depth * 2}rem` : R.Small
|
|
52
51
|
},
|
|
53
|
-
children: /* @__PURE__ */
|
|
52
|
+
children: /* @__PURE__ */ v(T, { w: "100%", align: "center", children: [
|
|
54
53
|
a || i.depth > 0 && d ? /* @__PURE__ */ o(
|
|
55
|
-
|
|
54
|
+
D,
|
|
56
55
|
{
|
|
57
56
|
row: i,
|
|
58
|
-
localeString:
|
|
57
|
+
localeString: u,
|
|
59
58
|
hidden: !m,
|
|
60
|
-
rowIsExpanded:
|
|
59
|
+
rowIsExpanded: c
|
|
61
60
|
}
|
|
62
|
-
) : /* @__PURE__ */ o(
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */ o("div", { style:
|
|
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
|
-
|
|
71
|
+
j as TableCell
|
|
73
72
|
};
|
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Portal as
|
|
3
|
-
import { flexRender as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { TableContext as
|
|
6
|
-
import { translations as
|
|
7
|
-
import { Icon as
|
|
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
|
|
11
|
-
import { MenuDivider as
|
|
12
|
-
import { Switch as
|
|
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
|
|
17
|
-
const
|
|
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:
|
|
19
|
+
header: o,
|
|
20
20
|
breakingContentState: m,
|
|
21
|
-
onBreakingContentChange:
|
|
22
|
-
setBreakingContentState:
|
|
23
|
-
headerGroup:
|
|
24
|
-
sorting:
|
|
21
|
+
onBreakingContentChange: f,
|
|
22
|
+
setBreakingContentState: D,
|
|
23
|
+
headerGroup: z,
|
|
24
|
+
sorting: d,
|
|
25
25
|
setSorting: a,
|
|
26
|
-
columnVisibility:
|
|
26
|
+
columnVisibility: M,
|
|
27
27
|
localeString: w
|
|
28
28
|
}) => {
|
|
29
|
-
const i =
|
|
29
|
+
const i = X[w], p = L(U), B = x(
|
|
30
30
|
(e) => {
|
|
31
|
-
const
|
|
31
|
+
const t = {
|
|
32
32
|
...m,
|
|
33
|
-
[
|
|
33
|
+
[o.column.id]: e.target.checked
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
D(t), f?.(t);
|
|
36
36
|
},
|
|
37
|
-
[m,
|
|
38
|
-
),
|
|
37
|
+
[m, f]
|
|
38
|
+
), F = x(
|
|
39
39
|
(e) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const { column:
|
|
44
|
-
e.getIsPinned() ? h >=
|
|
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
|
-
),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
] }), [
|
|
53
|
-
/* @__PURE__ */
|
|
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:
|
|
56
|
+
onClick: () => a([{ desc: !1, id: o.column.id }]),
|
|
57
57
|
leftIcon: l.SortAsc,
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ n(c, { children: i.sortUp })
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ n(
|
|
62
62
|
r,
|
|
63
63
|
{
|
|
64
|
-
onClick: () => a([{ desc: !0, id:
|
|
64
|
+
onClick: () => a([{ desc: !0, id: o.column.id }]),
|
|
65
65
|
leftIcon: l.SortDesc,
|
|
66
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ n(c, { children: i.sortDown })
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ n(
|
|
70
70
|
r,
|
|
71
71
|
{
|
|
72
72
|
onClick: () => {
|
|
73
|
-
|
|
73
|
+
p?.onFilterColumn && p.onFilterColumn(o.column);
|
|
74
74
|
},
|
|
75
75
|
leftIcon: l.Filter,
|
|
76
|
-
children: /* @__PURE__ */
|
|
76
|
+
children: /* @__PURE__ */ n(c, { children: i.filter })
|
|
77
77
|
}
|
|
78
78
|
),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
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__ */
|
|
86
|
-
|
|
85
|
+
/* @__PURE__ */ n(
|
|
86
|
+
v,
|
|
87
87
|
{
|
|
88
|
-
onChange:
|
|
89
|
-
isChecked: m[
|
|
88
|
+
onChange: B,
|
|
89
|
+
isChecked: m[o.column.id]
|
|
90
90
|
}
|
|
91
91
|
)
|
|
92
92
|
] })
|
|
93
|
-
] }), [m,
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
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:
|
|
98
|
+
color: b.OnBackgroundSubdued,
|
|
99
99
|
textTransform: "none",
|
|
100
|
-
fontSize:
|
|
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 ?
|
|
106
|
-
children:
|
|
105
|
+
backgroundColor: e ? b.BackgroundDisabled : "unset",
|
|
106
|
+
children: j(P, o.getContext())
|
|
107
107
|
}
|
|
108
108
|
),
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ n(E, { children: /* @__PURE__ */ n($, { fontSize: k.Medium, children: V }) })
|
|
110
110
|
] }) });
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
export {
|
|
114
|
-
|
|
114
|
+
dn as TableHeaderDropdown
|
|
115
115
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { Tr as
|
|
3
|
-
import { flexRender as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { TableContext as
|
|
6
|
-
import { TableHeaderDropdown as
|
|
7
|
-
import { Box as
|
|
8
|
-
import { ThemeColorVariable as
|
|
9
|
-
const
|
|
10
|
-
const t =
|
|
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
|
|
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 ?
|
|
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(
|
|
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
|
-
|
|
29
|
+
s,
|
|
31
30
|
{
|
|
32
31
|
className: "tableHeaderCell",
|
|
33
|
-
isNumeric:
|
|
32
|
+
isNumeric: o.columnDef.meta?.isNumeric,
|
|
34
33
|
zIndex: o.getIsPinned() ? 2 : 1,
|
|
35
34
|
style: {
|
|
36
|
-
...
|
|
37
|
-
borderBottom: `1px solid ${
|
|
35
|
+
...l(o),
|
|
36
|
+
borderBottom: `1px solid ${i.OnBackgroundBorder}`
|
|
38
37
|
},
|
|
39
|
-
children:
|
|
40
|
-
|
|
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
|
-
|
|
58
|
+
D as TableHeaderRow
|
|
60
59
|
};
|
|
@@ -1,108 +1,107 @@
|
|
|
1
|
-
import { jsx as t, jsxs as o, Fragment as
|
|
2
|
-
import { useMediaQuery as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { TableContext as
|
|
5
|
-
import { translations as
|
|
6
|
-
import { Text as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { Icons as
|
|
10
|
-
import { Menu as
|
|
11
|
-
import { MenuButton as
|
|
12
|
-
import { MenuList as
|
|
13
|
-
import { MenuItem as
|
|
14
|
-
import { Checkbox as
|
|
15
|
-
import { MenuDivider as
|
|
16
|
-
import { Switch as
|
|
17
|
-
import { IconButton as
|
|
18
|
-
import { ThemeSpaceVariable as r, ThemeFontVariable as
|
|
19
|
-
function
|
|
20
|
-
tableName:
|
|
21
|
-
onSearch:
|
|
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 =
|
|
25
|
+
const e = O(A);
|
|
26
26
|
if (!e) throw new Error("No table context found");
|
|
27
|
-
const [x] =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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(
|
|
37
|
-
onChange: (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
|
-
),
|
|
44
|
-
/* @__PURE__ */ t(
|
|
45
|
-
/* @__PURE__ */ t(
|
|
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
|
-
|
|
46
|
+
g,
|
|
48
47
|
{
|
|
49
48
|
color: S.OnSurfaceSubdued,
|
|
50
49
|
py: r.Small,
|
|
51
50
|
px: r.Medium,
|
|
52
|
-
children:
|
|
51
|
+
children: a.showColumns
|
|
53
52
|
}
|
|
54
53
|
),
|
|
55
|
-
e.table.getAllLeafColumns().filter((n) => n.getCanHide()).map((n) => /* @__PURE__ */ o(
|
|
56
|
-
/* @__PURE__ */ t(
|
|
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
|
-
|
|
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(
|
|
66
|
-
/* @__PURE__ */ o(
|
|
67
|
-
|
|
68
|
-
/* @__PURE__ */ t(
|
|
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
|
-
] }) }),
|
|
72
|
-
|
|
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:
|
|
73
|
+
fontSize: J.X2Large,
|
|
75
74
|
color: S.OnBackgroundHeader,
|
|
76
75
|
fontWeight: "bold",
|
|
77
|
-
fontFamily:
|
|
78
|
-
children:
|
|
76
|
+
fontFamily: q.Header,
|
|
77
|
+
children: k
|
|
79
78
|
}
|
|
80
|
-
), w =
|
|
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
|
-
|
|
81
|
+
h(),
|
|
83
82
|
/* @__PURE__ */ o(i, { gap: r.Medium, children: [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
s(),
|
|
84
|
+
d(),
|
|
85
|
+
u()
|
|
87
86
|
] })
|
|
88
87
|
] }) }),
|
|
89
|
-
[
|
|
90
|
-
), B =
|
|
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
|
-
|
|
94
|
-
|
|
92
|
+
h(),
|
|
93
|
+
u()
|
|
95
94
|
] }),
|
|
96
95
|
/* @__PURE__ */ o(i, { justifyContent: "space-between", gap: r.Medium, children: [
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
s(),
|
|
97
|
+
d()
|
|
99
98
|
] })
|
|
100
99
|
] }),
|
|
101
|
-
[
|
|
100
|
+
[m, e.breakingContentState, e.columnVisibility]
|
|
102
101
|
);
|
|
103
|
-
return /* @__PURE__ */ t(
|
|
102
|
+
return /* @__PURE__ */ t(L, { id: "tableToolbar", ...M, children: x ? w : B });
|
|
104
103
|
}
|
|
105
|
-
const
|
|
104
|
+
const he = z(R);
|
|
106
105
|
export {
|
|
107
|
-
|
|
106
|
+
he as TableToolbar
|
|
108
107
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
function
|
|
3
|
-
const [r,
|
|
4
|
-
return [
|
|
5
|
-
if (typeof
|
|
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
|
-
|
|
7
|
+
l(t), e?.(t);
|
|
8
8
|
}];
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
|
-
|
|
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
|
|
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) => {
|