@ogcio/design-system-react 1.16.0 → 1.17.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.
- package/dist/autocomplete/use-autocomplete-controller.js +55 -54
- package/dist/breadcrumbs/breadcrumbs.js +29 -23
- package/dist/card/card-next.js +1 -1
- package/dist/data-table/data-table-footer.d.ts +12 -0
- package/dist/data-table/data-table-footer.js +66 -0
- package/dist/data-table/data-table-header.d.ts +28 -0
- package/dist/data-table/data-table-header.js +157 -0
- package/dist/data-table/data-table-selected-rows.d.ts +6 -0
- package/dist/data-table/data-table-selected-rows.js +23 -0
- package/dist/{data-grid → data-table}/tanstack/tanstack-helpers.d.ts +1 -0
- package/dist/{data-grid → data-table}/tanstack/tanstack-helpers.js +27 -25
- package/dist/forms/form-field/form-field.js +18 -18
- package/dist/header/components/header-menu.js +26 -27
- package/dist/index.d.ts +4 -4
- package/dist/index.js +43 -43
- package/dist/input-radio/input-radio.js +31 -31
- package/dist/modal/modal.js +17 -16
- package/dist/popover/popover.js +10 -1
- package/dist/select/select-menu.js +27 -27
- package/dist/styles.css +1 -1
- package/dist/table/table-pagination.js +2 -2
- package/dist/utils/utilities.d.ts +1 -0
- package/dist/utils/utilities.js +17 -12
- package/package.json +4 -4
- package/dist/data-grid/data-grid-footer.d.ts +0 -12
- package/dist/data-grid/data-grid-footer.js +0 -66
- package/dist/data-grid/data-grid-header.d.ts +0 -12
- package/dist/data-grid/data-grid-header.js +0 -82
- /package/dist/{data-grid → data-table}/editable-table-cell.d.ts +0 -0
- /package/dist/{data-grid → data-table}/editable-table-cell.js +0 -0
- /package/dist/{data-grid → data-table}/types.d.ts +0 -0
- /package/dist/{data-grid → data-table}/types.js +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { l as F } from "../lodash-D1c5hFAM.js";
|
|
2
|
-
import { useRef as g, useMemo as G, Children as
|
|
3
|
-
import { useScrollHighlightedItem as
|
|
2
|
+
import { useRef as g, useMemo as G, Children as C, useReducer as X, useEffect as A, isValidElement as h } from "react";
|
|
3
|
+
import { useScrollHighlightedItem as Y } from "../hooks/use-scroll-highlighted-item.js";
|
|
4
|
+
import { safeCloneElement as j } from "../utils/utilities.js";
|
|
4
5
|
import { AUTOCOMPLETE_ACTIONS as k } from "./types.js";
|
|
5
6
|
const {
|
|
6
|
-
ON_RESET:
|
|
7
|
+
ON_RESET: x,
|
|
7
8
|
ON_SELECT_ITEM: q,
|
|
8
9
|
SET_INPUT_VALUE: P,
|
|
9
10
|
SET_IS_OPEN: v,
|
|
10
|
-
SET_OPTIONS:
|
|
11
|
+
SET_OPTIONS: E,
|
|
11
12
|
TOGGLE_CLEAR_BUTTON: U,
|
|
12
13
|
SET_VALUE: w,
|
|
13
14
|
SET_HIGHLIGHTED_INDEX: S,
|
|
@@ -18,7 +19,7 @@ const {
|
|
|
18
19
|
return { ...e, isOpen: t.payload };
|
|
19
20
|
case P:
|
|
20
21
|
return { ...e, inputValue: t.payload };
|
|
21
|
-
case
|
|
22
|
+
case E:
|
|
22
23
|
return {
|
|
23
24
|
...e,
|
|
24
25
|
autocompleteOptions: t.payload || []
|
|
@@ -30,7 +31,7 @@ const {
|
|
|
30
31
|
...e,
|
|
31
32
|
isClearButtonEnabled: t.payload || !!e.inputValue
|
|
32
33
|
};
|
|
33
|
-
case
|
|
34
|
+
case x:
|
|
34
35
|
return {
|
|
35
36
|
...e,
|
|
36
37
|
value: "",
|
|
@@ -55,26 +56,26 @@ const {
|
|
|
55
56
|
}
|
|
56
57
|
}, J = (e) => {
|
|
57
58
|
var n, p;
|
|
58
|
-
const t = ((n = e == null ? void 0 : e.type) == null ? void 0 : n.componentType) || ((p = e == null ? void 0 : e.props) == null ? void 0 : p.
|
|
59
|
-
return
|
|
60
|
-
},
|
|
59
|
+
const t = ((n = e == null ? void 0 : e.type) == null ? void 0 : n.componentType) || ((p = e == null ? void 0 : e.props) == null ? void 0 : p.__type);
|
|
60
|
+
return h(e) && (t === "AutocompleteItem" || t === "AutocompleteGroupItem");
|
|
61
|
+
}, B = (e, t) => {
|
|
61
62
|
var s, a;
|
|
62
63
|
const n = ((s = e.props.children) == null ? void 0 : s.toString().toLowerCase()) || "", p = (a = e.props.value) == null ? void 0 : a.toLowerCase(), l = t.toLowerCase();
|
|
63
64
|
return n.includes(l) || p.includes(l);
|
|
64
|
-
}, V = (e) =>
|
|
65
|
-
var p, l, s, a,
|
|
65
|
+
}, V = (e) => C.toArray(e).filter((t) => J(t)) || [], R = (e, t) => {
|
|
66
|
+
var p, l, s, a, I, f;
|
|
66
67
|
const n = V(e);
|
|
67
|
-
for (const
|
|
68
|
-
const
|
|
69
|
-
if (((s =
|
|
70
|
-
return ((a =
|
|
71
|
-
if (
|
|
72
|
-
const u =
|
|
73
|
-
(
|
|
68
|
+
for (const y of n) {
|
|
69
|
+
const T = ((p = y.type) == null ? void 0 : p.componentType) || ((l = y.props) == null ? void 0 : l.__type);
|
|
70
|
+
if (((s = y.props) == null ? void 0 : s.value) === t)
|
|
71
|
+
return ((a = y.props.children) == null ? void 0 : a.toString()) || "";
|
|
72
|
+
if (T === "AutocompleteGroupItem") {
|
|
73
|
+
const u = C.toArray(y.props.children).filter(
|
|
74
|
+
(c) => h(c)
|
|
74
75
|
);
|
|
75
|
-
for (const
|
|
76
|
-
if (((
|
|
77
|
-
return ((
|
|
76
|
+
for (const c of u)
|
|
77
|
+
if (((I = c.props) == null ? void 0 : I.value) === t)
|
|
78
|
+
return ((f = c.props.children) == null ? void 0 : f.toString()) || "";
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
return "";
|
|
@@ -83,10 +84,10 @@ const {
|
|
|
83
84
|
return t != null && t.length && t.every(
|
|
84
85
|
(p) => {
|
|
85
86
|
var l;
|
|
86
|
-
return p.props.
|
|
87
|
+
return p.props.__type === "AutocompleteGroupItem" || ((l = p.type) == null ? void 0 : l.componentType) === "AutocompleteGroupItem";
|
|
87
88
|
}
|
|
88
89
|
) ? "AutocompleteGroupItem" : "AutocompleteItem";
|
|
89
|
-
},
|
|
90
|
+
}, pe = ({
|
|
90
91
|
children: e,
|
|
91
92
|
defaultValue: t = "",
|
|
92
93
|
isOpen: n = !1,
|
|
@@ -94,43 +95,43 @@ const {
|
|
|
94
95
|
onOpen: l,
|
|
95
96
|
onClose: s,
|
|
96
97
|
onChange: a,
|
|
97
|
-
value:
|
|
98
|
+
value: I
|
|
98
99
|
}) => {
|
|
99
|
-
const
|
|
100
|
+
const f = g(null), y = g(null), T = g(!1), u = G(
|
|
100
101
|
() => V(e || []),
|
|
101
102
|
[e]
|
|
102
|
-
),
|
|
103
|
+
), c = () => {
|
|
103
104
|
var i;
|
|
104
|
-
return (i =
|
|
105
|
-
},
|
|
105
|
+
return (i = f.current) == null ? void 0 : i.focus();
|
|
106
|
+
}, d = G(() => K(e), [e]), [r, o] = X(z, null, () => ({
|
|
106
107
|
isOpen: !!n,
|
|
107
|
-
value:
|
|
108
|
+
value: I,
|
|
108
109
|
inputValue: t,
|
|
109
110
|
autocompleteOptions: u,
|
|
110
111
|
isClearButtonEnabled: !1,
|
|
111
112
|
highlightedIndex: -1,
|
|
112
|
-
optionType:
|
|
113
|
+
optionType: d
|
|
113
114
|
}));
|
|
114
|
-
|
|
115
|
-
o({ type:
|
|
115
|
+
Y(y, r.highlightedIndex), A(() => {
|
|
116
|
+
o({ type: E, payload: u });
|
|
116
117
|
}, [u]), A(() => {
|
|
117
|
-
o({ type: H, payload:
|
|
118
|
-
}, [
|
|
119
|
-
if (!
|
|
120
|
-
|
|
118
|
+
o({ type: H, payload: d });
|
|
119
|
+
}, [d]), A(() => {
|
|
120
|
+
if (!T.current) {
|
|
121
|
+
T.current = !0;
|
|
121
122
|
return;
|
|
122
123
|
}
|
|
123
|
-
r.inputValue === "" && r.value === "" &&
|
|
124
|
+
r.inputValue === "" && r.value === "" && c();
|
|
124
125
|
}, [r.isClearButtonEnabled]), A(() => {
|
|
125
126
|
if (r.isOpen)
|
|
126
|
-
l == null || l(),
|
|
127
|
+
l == null || l(), c(), o({ type: E, payload: u });
|
|
127
128
|
else {
|
|
128
129
|
s == null || s();
|
|
129
|
-
const i =
|
|
130
|
+
const i = R(e, r.value);
|
|
130
131
|
i && r.value ? (o({
|
|
131
132
|
type: P,
|
|
132
133
|
payload: i
|
|
133
|
-
}), o({ type: v, payload: !1 })) : p || (o({ type:
|
|
134
|
+
}), o({ type: v, payload: !1 })) : p || (o({ type: x }), a == null || a("")), o({ type: U });
|
|
134
135
|
}
|
|
135
136
|
}, [r.isOpen]);
|
|
136
137
|
const M = G(
|
|
@@ -138,34 +139,34 @@ const {
|
|
|
138
139
|
if (i) {
|
|
139
140
|
const _ = u.map((m) => {
|
|
140
141
|
var L, b;
|
|
141
|
-
const D = ((L = m.type) == null ? void 0 : L.componentType) || ((b = m.props) == null ? void 0 : b.
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
142
|
+
const D = ((L = m.type) == null ? void 0 : L.componentType) || ((b = m.props) == null ? void 0 : b.__type);
|
|
143
|
+
if (d === "AutocompleteGroupItem" && D === "AutocompleteGroupItem") {
|
|
144
|
+
const N = C.toArray(
|
|
144
145
|
m.props.children
|
|
145
|
-
).filter((O) =>
|
|
146
|
-
(O) =>
|
|
146
|
+
).filter((O) => h(O)).filter(
|
|
147
|
+
(O) => B(O, i)
|
|
147
148
|
);
|
|
148
|
-
return
|
|
149
|
-
} else if (
|
|
150
|
-
return
|
|
149
|
+
return N.length > 0 ? j(m, { children: N }) : null;
|
|
150
|
+
} else if (d === "AutocompleteItem")
|
|
151
|
+
return B(m, i) ? m : null;
|
|
151
152
|
return null;
|
|
152
153
|
}).filter(Boolean);
|
|
153
|
-
o({ type:
|
|
154
|
+
o({ type: E, payload: _ }), o({ type: S, payload: -1 }), (!r.isOpen && !r.value || (_ == null ? void 0 : _.length) === 0) && o({ type: v, payload: !0 });
|
|
154
155
|
} else
|
|
155
|
-
o({ type: w, payload: "" }), o({ type:
|
|
156
|
+
o({ type: w, payload: "" }), o({ type: E, payload: u }), o({ type: S, payload: -1 });
|
|
156
157
|
}, 500),
|
|
157
158
|
[u, r.isOpen, r.value, p]
|
|
158
159
|
);
|
|
159
160
|
return {
|
|
160
161
|
state: r,
|
|
161
162
|
dispatch: o,
|
|
162
|
-
inputRef:
|
|
163
|
-
listRef:
|
|
163
|
+
inputRef: f,
|
|
164
|
+
listRef: y,
|
|
164
165
|
validChildren: u,
|
|
165
|
-
getOptionLabelByValue:
|
|
166
|
+
getOptionLabelByValue: R,
|
|
166
167
|
debouncedFilter: M
|
|
167
168
|
};
|
|
168
169
|
};
|
|
169
170
|
export {
|
|
170
|
-
|
|
171
|
+
pe as useAutocompleteController
|
|
171
172
|
};
|
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
-
import { translate as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { Link as
|
|
5
|
-
const
|
|
2
|
+
import { translate as c } from "../i18n/utility.js";
|
|
3
|
+
import { Icon as t } from "../icon/icon.js";
|
|
4
|
+
import { Link as o } from "../link/link.js";
|
|
5
|
+
const h = () => /* @__PURE__ */ r("div", { "aria-hidden": "true", children: /* @__PURE__ */ r(t, { className: "gi-text-gray-700", icon: "more_horiz" }) }), n = ({
|
|
6
6
|
href: e,
|
|
7
7
|
children: a,
|
|
8
|
-
asChild:
|
|
9
|
-
...
|
|
8
|
+
asChild: s,
|
|
9
|
+
...i
|
|
10
10
|
}) => /* @__PURE__ */ r(
|
|
11
|
-
|
|
11
|
+
o,
|
|
12
12
|
{
|
|
13
13
|
noColor: !0,
|
|
14
|
-
asChild:
|
|
14
|
+
asChild: s,
|
|
15
15
|
href: e,
|
|
16
16
|
"aria-label": `${a} page`,
|
|
17
17
|
size: "sm",
|
|
18
18
|
className: "gi-breadcrumbs-link",
|
|
19
|
-
...
|
|
19
|
+
...i,
|
|
20
20
|
children: a
|
|
21
21
|
}
|
|
22
|
-
), f = (e) => /* @__PURE__ */ r(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
), f = (e) => /* @__PURE__ */ r(n, { ...e, "aria-current": "page" }), b = () => /* @__PURE__ */ r("span", { className: "gi-breadcrumbs-separator", children: "/" }), B = ({ children: e, iconStart: a }) => {
|
|
23
|
+
const s = Array.isArray(e) ? e : [e];
|
|
24
|
+
return /* @__PURE__ */ r(
|
|
25
|
+
"nav",
|
|
26
|
+
{
|
|
27
|
+
"aria-label": c("breadcrumbs.breadcrumbs", { defaultValue: "Breadcrumbs" }),
|
|
28
|
+
className: "gi-breadcrumbs",
|
|
29
|
+
children: /* @__PURE__ */ m("ol", { role: "list", children: [
|
|
30
|
+
a && /* @__PURE__ */ r("li", { role: "listitem", className: "gi-pr-1", children: /* @__PURE__ */ r(t, { "aria-label": "chevron-left", icon: "chevron_left", size: "sm" }) }),
|
|
31
|
+
s.map((i, l) => /* @__PURE__ */ m("li", { role: "listitem", children: [
|
|
32
|
+
i,
|
|
33
|
+
l < s.length - 1 && /* @__PURE__ */ r(b, {})
|
|
34
|
+
] }, `breadcrumb_item_${l}`))
|
|
35
|
+
] })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
33
39
|
export {
|
|
34
40
|
f as BreadcrumbCurrentLink,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
h as BreadcrumbEllipsis,
|
|
42
|
+
n as BreadcrumbLink,
|
|
43
|
+
B as Breadcrumbs
|
|
38
44
|
};
|
package/dist/card/card-next.js
CHANGED
|
@@ -60,7 +60,7 @@ const D = ({ children: e }) => {
|
|
|
60
60
|
var d, C;
|
|
61
61
|
if (!f(t))
|
|
62
62
|
return;
|
|
63
|
-
(((d = t == null ? void 0 : t.type) == null ? void 0 : d.componentType) || ((C = t.props) == null ? void 0 : C.
|
|
63
|
+
(((d = t == null ? void 0 : t.type) == null ? void 0 : d.componentType) || ((C = t.props) == null ? void 0 : C.__type)) === "CardTag" ? n.push(t) : a.push(t);
|
|
64
64
|
}), /* @__PURE__ */ r(o.Provider, { value: !0, children: /* @__PURE__ */ g("div", { className: "gi-card-header", children: [
|
|
65
65
|
/* @__PURE__ */ r("div", { className: "gi-card-heading", children: a }),
|
|
66
66
|
n
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface DataTableFooterTypeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
interface DataTableFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export type { DataTableFooterProps, DataTableFooterTypeProps };
|
|
9
|
+
export declare const DataTableFooterStart: React.FC<DataTableFooterTypeProps>;
|
|
10
|
+
export declare const DataTableFooterCenter: React.FC<DataTableFooterTypeProps>;
|
|
11
|
+
export declare const DataTableFooterEnd: React.FC<DataTableFooterTypeProps>;
|
|
12
|
+
export declare const DataTableFooter: React.FC<DataTableFooterProps>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as s, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import l from "react";
|
|
3
|
+
import { cn as i } from "../cn.js";
|
|
4
|
+
const o = (e, t) => l.isValidElement(e) && e.type === t, r = (e, t, n) => e ? /* @__PURE__ */ s(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: i(
|
|
8
|
+
t,
|
|
9
|
+
n,
|
|
10
|
+
e.props.className
|
|
11
|
+
),
|
|
12
|
+
style: e.props.style,
|
|
13
|
+
children: e.props.children
|
|
14
|
+
}
|
|
15
|
+
) : null, y = ({
|
|
16
|
+
children: e,
|
|
17
|
+
...t
|
|
18
|
+
}) => /* @__PURE__ */ s("div", { ...t, children: e });
|
|
19
|
+
y.displayName = "DataTableFooterStart";
|
|
20
|
+
const F = ({
|
|
21
|
+
children: e,
|
|
22
|
+
...t
|
|
23
|
+
}) => /* @__PURE__ */ s("div", { ...t, children: e });
|
|
24
|
+
F.displayName = "DataTableFooterCenter";
|
|
25
|
+
const T = ({
|
|
26
|
+
children: e,
|
|
27
|
+
...t
|
|
28
|
+
}) => /* @__PURE__ */ s("div", { ...t, children: e });
|
|
29
|
+
T.displayName = "DataTableFooterEnd";
|
|
30
|
+
const E = ({
|
|
31
|
+
children: e,
|
|
32
|
+
className: t,
|
|
33
|
+
...n
|
|
34
|
+
}) => {
|
|
35
|
+
const D = l.useMemo(() => {
|
|
36
|
+
let f = null, u = null, b = null;
|
|
37
|
+
return l.Children.forEach(e, (a) => {
|
|
38
|
+
o(a, y) ? f = a : o(a, F) ? u = a : o(a, T) && (b = a);
|
|
39
|
+
}), { start: f, center: u, end: b };
|
|
40
|
+
}, [e]), { start: c, center: d, end: m } = D, p = !!!c && !!!d && !!m, g = "gi-grow gi-basis-0 gi-min-w-0", C = `${g} gi-text-center`, S = i("gi-min-w-0", {
|
|
41
|
+
"gi-basis-1/2 gi-text-right": !p
|
|
42
|
+
});
|
|
43
|
+
return /* @__PURE__ */ x(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
...n,
|
|
47
|
+
className: i(
|
|
48
|
+
"gi-flex gi-flex-row gi-w-full gi-items-center gi-py-2",
|
|
49
|
+
p ? "gi-justify-end" : "gi-gap-2",
|
|
50
|
+
t
|
|
51
|
+
),
|
|
52
|
+
children: [
|
|
53
|
+
r(c, g),
|
|
54
|
+
r(d, C),
|
|
55
|
+
r(m, S)
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
E.displayName = "DataTableFooter";
|
|
61
|
+
export {
|
|
62
|
+
E as DataTableFooter,
|
|
63
|
+
F as DataTableFooterCenter,
|
|
64
|
+
T as DataTableFooterEnd,
|
|
65
|
+
y as DataTableFooterStart
|
|
66
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface DataTableHeaderTypeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
interface DataTableHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
showHeader?: boolean;
|
|
8
|
+
showFilter?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const DataTableHeader: React.FC<DataTableHeaderProps>;
|
|
11
|
+
export declare const DataTableHeaderSearch: React.FC<DataTableHeaderTypeProps>;
|
|
12
|
+
export declare const DataTableHeaderActions: React.FC<DataTableHeaderTypeProps>;
|
|
13
|
+
export declare const DataTableHeaderFilter: React.FC<DataTableHeaderTypeProps>;
|
|
14
|
+
export declare const DataTableHeaderFilterTitle: React.FC<DataTableHeaderTypeProps>;
|
|
15
|
+
export declare const DataTableHeaderFilterContent: React.FC<DataTableHeaderTypeProps>;
|
|
16
|
+
export declare const DataTableHeaderFilterContentTitle: React.FC<DataTableHeaderTypeProps>;
|
|
17
|
+
export declare const DataTableHeaderFilterActions: React.FC<DataTableHeaderTypeProps>;
|
|
18
|
+
type DataTableHeaderFilterListProps = {
|
|
19
|
+
filters: {
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
}[];
|
|
23
|
+
onRemove?: (id: string) => void;
|
|
24
|
+
onClear?: () => void;
|
|
25
|
+
className?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const DataTableHeaderFilterList: React.FC<DataTableHeaderFilterListProps>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { jsxs as o, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import p from "react";
|
|
3
|
+
import { Button as A } from "../button/button.js";
|
|
4
|
+
import { Chip as C } from "../chip/chip.js";
|
|
5
|
+
import { cn as i } from "../cn.js";
|
|
6
|
+
import { Heading as L } from "../heading/heading.js";
|
|
7
|
+
import { translate as N } from "../i18n/utility.js";
|
|
8
|
+
const s = (e, a) => p.isValidElement(e) && e.type === a, F = ({
|
|
9
|
+
children: e,
|
|
10
|
+
className: a,
|
|
11
|
+
showHeader: t = !0,
|
|
12
|
+
showFilter: d = !0,
|
|
13
|
+
...c
|
|
14
|
+
}) => {
|
|
15
|
+
const { search: n, filter: O, filterList: b, actions: P } = p.useMemo(() => {
|
|
16
|
+
let u = null, y = null, H = null, D = null;
|
|
17
|
+
return p.Children.forEach(e, (r) => {
|
|
18
|
+
s(r, m) ? u = r : s(r, f) ? y = r : s(r, T) ? H = r : s(r, g) && (D = r);
|
|
19
|
+
}), { search: u, filter: y, filterList: H, actions: D };
|
|
20
|
+
}, [e]);
|
|
21
|
+
return /* @__PURE__ */ o(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
...c,
|
|
25
|
+
className: i(
|
|
26
|
+
"gi-flex gi-flex-wrap gi-items-center gi-w-full gi-gap-4 gi-mb-2",
|
|
27
|
+
a
|
|
28
|
+
),
|
|
29
|
+
children: [
|
|
30
|
+
t && /* @__PURE__ */ o("div", { className: "gi-flex gi-flex-1 gi-gap-4 gi-items-center", children: [
|
|
31
|
+
n,
|
|
32
|
+
O,
|
|
33
|
+
P
|
|
34
|
+
] }),
|
|
35
|
+
b && d && /* @__PURE__ */ l("div", { className: "gi-w-full", children: b })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}, m = ({
|
|
40
|
+
children: e,
|
|
41
|
+
className: a,
|
|
42
|
+
...t
|
|
43
|
+
}) => /* @__PURE__ */ l("div", { className: i("gi-flex gi-flex-1", a), ...t, children: e }), g = ({
|
|
44
|
+
children: e,
|
|
45
|
+
className: a,
|
|
46
|
+
...t
|
|
47
|
+
}) => /* @__PURE__ */ l(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: i("gi-flex gi-items-center gi-ml-auto gi-gap-4", a),
|
|
51
|
+
...t,
|
|
52
|
+
children: e
|
|
53
|
+
}
|
|
54
|
+
), f = ({
|
|
55
|
+
children: e,
|
|
56
|
+
className: a,
|
|
57
|
+
...t
|
|
58
|
+
}) => /* @__PURE__ */ l("div", { className: i("gi-flex gi-items-center", a), ...t, children: e }), x = ({
|
|
59
|
+
children: e,
|
|
60
|
+
className: a,
|
|
61
|
+
...t
|
|
62
|
+
}) => /* @__PURE__ */ l("div", { className: i("gi-border-b gi-px-6 gi-py-4", a), ...t, children: /* @__PURE__ */ l(L, { as: "h6", children: e }) }), v = ({ children: e, className: a, ...t }) => /* @__PURE__ */ l(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: i("gi-flex gi-flex-col gi-gap-2 gi-px-6", a),
|
|
66
|
+
...t,
|
|
67
|
+
children: e
|
|
68
|
+
}
|
|
69
|
+
), h = ({ children: e, className: a, ...t }) => /* @__PURE__ */ l("div", { className: i("gi-py-2 gi-font-medium", a), ...t, children: e }), j = ({ children: e, className: a, ...t }) => /* @__PURE__ */ l(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: i("gi-flex gi-justify-end gi-gap-2 gi-p-6", a),
|
|
73
|
+
...t,
|
|
74
|
+
children: e
|
|
75
|
+
}
|
|
76
|
+
), T = ({ filters: e, onRemove: a, onClear: t, className: d, ...c }) => !e || e.length === 0 ? null : /* @__PURE__ */ o(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: i("gi-flex gi-items-center gi-gap-2 gi-flex-wrap", d),
|
|
80
|
+
...c,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ l("span", { className: "gi-text-sm", children: N("dataTableHeader.filtersApplied", {
|
|
83
|
+
length: e.length,
|
|
84
|
+
defaultValue: `Filters applied ${e.length}:`
|
|
85
|
+
}) }),
|
|
86
|
+
e.map((n) => /* @__PURE__ */ l(
|
|
87
|
+
C,
|
|
88
|
+
{
|
|
89
|
+
onClose: () => a == null ? void 0 : a(n.id),
|
|
90
|
+
label: n.label
|
|
91
|
+
},
|
|
92
|
+
n.id
|
|
93
|
+
)),
|
|
94
|
+
/* @__PURE__ */ l(
|
|
95
|
+
A,
|
|
96
|
+
{
|
|
97
|
+
appearance: "dark",
|
|
98
|
+
size: "medium",
|
|
99
|
+
variant: "flat",
|
|
100
|
+
onClick: () => {
|
|
101
|
+
t == null || t();
|
|
102
|
+
},
|
|
103
|
+
children: N("dataTableHeader.clearAllFilters", {
|
|
104
|
+
defaultValue: "Clear all filters"
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
F.displayName = "DataTableHeader";
|
|
112
|
+
m.displayName = "DataTableHeaderSearch";
|
|
113
|
+
g.displayName = "DataTableHeaderActions";
|
|
114
|
+
f.displayName = "DataTableHeaderFilter";
|
|
115
|
+
T.displayName = "DataTableHeaderFilterList";
|
|
116
|
+
x.displayName = "DataTableHeaderFilterTitle";
|
|
117
|
+
v.displayName = "DataTableHeaderFilterContent";
|
|
118
|
+
h.displayName = "DataTableHeaderFilterContentTitle";
|
|
119
|
+
j.displayName = "DataTableHeaderFilterActions";
|
|
120
|
+
Object.defineProperty(F, "componentType", {
|
|
121
|
+
value: "DataTableHeader"
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(m, "componentType", {
|
|
124
|
+
value: "DataTableHeaderSearch"
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(g, "componentType", {
|
|
127
|
+
value: "DataTableHeaderActions"
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(f, "componentType", {
|
|
130
|
+
value: "DataTableHeaderFilter"
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(T, "componentType", {
|
|
133
|
+
value: "DataTableHeaderFilterList"
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(x, "componentType", {
|
|
136
|
+
value: "DataTableHeaderFilterTitle"
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(v, "componentType", {
|
|
139
|
+
value: "DataTableHeaderFilterContent"
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(h, "componentType", {
|
|
142
|
+
value: "DataTableHeaderFilterContentTitle"
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(j, "componentType", {
|
|
145
|
+
value: "DataTableHeaderFilterActions"
|
|
146
|
+
});
|
|
147
|
+
export {
|
|
148
|
+
F as DataTableHeader,
|
|
149
|
+
g as DataTableHeaderActions,
|
|
150
|
+
f as DataTableHeaderFilter,
|
|
151
|
+
j as DataTableHeaderFilterActions,
|
|
152
|
+
v as DataTableHeaderFilterContent,
|
|
153
|
+
h as DataTableHeaderFilterContentTitle,
|
|
154
|
+
T as DataTableHeaderFilterList,
|
|
155
|
+
x as DataTableHeaderFilterTitle,
|
|
156
|
+
m as DataTableHeaderSearch
|
|
157
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsxs as r, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { cn as g } from "../cn.js";
|
|
3
|
+
import { translate as l } from "../i18n/utility.js";
|
|
4
|
+
const o = ({ selectedCount: e, actions: t, className: a, ...s }) => /* @__PURE__ */ r(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: g(
|
|
8
|
+
"gi-w-full gi-flex gi-items-center gi-justify-between gi-px-3 gi-py-2 gi-bg-gray-900 gi-rounded-md",
|
|
9
|
+
a
|
|
10
|
+
),
|
|
11
|
+
...s,
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ i("span", { className: "gi-text-sm gi-font-medium gi-text-white", children: l("dataTable.selectedRows", {
|
|
14
|
+
count: e,
|
|
15
|
+
defaultValue: ` (${e} Row${e === 1 ? "" : "s"} selected)`
|
|
16
|
+
}) }),
|
|
17
|
+
/* @__PURE__ */ i("div", { className: "gi-flex gi-gap-4", children: t })
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
export {
|
|
22
|
+
o as DataTableSelectedRowsBanner
|
|
23
|
+
};
|