@caspeco/casper-ui-library 7.0.1 → 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.
|
@@ -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,
|
|
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
|
|
2
|
-
import { useMediaQuery as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { useTableContext as
|
|
5
|
-
import { translations as
|
|
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
|
|
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
|
|
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
|
|
19
|
-
function
|
|
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
|
-
...
|
|
23
|
+
...w
|
|
24
24
|
}) {
|
|
25
|
-
const t =
|
|
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
|
-
),
|
|
33
|
+
), c = l(
|
|
34
34
|
() => /* @__PURE__ */ e(
|
|
35
35
|
A,
|
|
36
36
|
{
|
|
37
|
-
leftElement: /* @__PURE__ */ e(
|
|
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
|
-
),
|
|
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(
|
|
49
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
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(
|
|
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: "
|
|
91
|
+
variant: "secondary"
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
94
|
[g, o.new]
|
|
95
95
|
), d = l(
|
|
96
96
|
() => /* @__PURE__ */ e(
|
|
97
|
-
|
|
97
|
+
x,
|
|
98
98
|
{
|
|
99
|
-
fontSize:
|
|
99
|
+
fontSize: J.X2Large,
|
|
100
100
|
color: I.OnBackgroundHeader,
|
|
101
101
|
fontWeight: "bold",
|
|
102
|
-
fontFamily:
|
|
102
|
+
fontFamily: q.Header,
|
|
103
103
|
children: p
|
|
104
104
|
}
|
|
105
105
|
),
|
|
106
106
|
[p]
|
|
107
|
-
),
|
|
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,
|
|
117
|
-
),
|
|
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
|
-
|
|
125
|
-
|
|
124
|
+
c(),
|
|
125
|
+
s()
|
|
126
126
|
] })
|
|
127
127
|
] }),
|
|
128
|
-
[m,
|
|
128
|
+
[m, c, s, d]
|
|
129
129
|
);
|
|
130
|
-
return /* @__PURE__ */ e(
|
|
130
|
+
return /* @__PURE__ */ e(S, { id: "tableToolbar", ...w, children: B ? F : L });
|
|
131
131
|
}
|
|
132
|
-
const ue =
|
|
132
|
+
const ue = v(K);
|
|
133
133
|
export {
|
|
134
134
|
ue as TableToolbar
|
|
135
135
|
};
|