@ogcio/design-system-react 1.23.0 → 1.25.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/README.md +5 -5
- package/dist/accordion/accordion-item.d.ts +3 -5
- package/dist/accordion/accordion-item.js +36 -31
- package/dist/accordion/accordion.d.ts +3 -5
- package/dist/accordion/accordion.js +22 -33
- package/dist/autocomplete/autocomplete.js +105 -101
- package/dist/autocomplete/use-autocomplete-controller.js +60 -58
- package/dist/browser-support/browser-support.d.ts +6 -0
- package/dist/browser-support/browser-support.js +2202 -0
- package/dist/browser-support/index.d.ts +1 -0
- package/dist/browser-support/index.js +4 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/cn.js +4 -16
- package/dist/constants.d.ts +43 -0
- package/dist/constants.js +46 -0
- package/dist/icon/icon.d.ts +16 -4
- package/dist/icon/icon.js +79 -166
- package/dist/index.d.ts +3 -3
- package/dist/index.js +193 -190
- package/dist/pagination/pagination.js +305 -565
- package/dist/select/select-next.js +74 -71
- package/dist/side-nav/index.d.ts +2 -0
- package/dist/side-nav/index.js +6 -0
- package/dist/side-nav/side-nav.d.ts +2 -1
- package/dist/side-nav/side-nav.js +119 -98
- package/dist/side-nav/types.d.ts +4 -0
- package/dist/styles.css +1 -1
- package/dist/tabs/tab-item.d.ts +1 -1
- package/dist/tag/tag.d.ts +9 -3
- package/dist/tag/tag.js +35 -18
- package/dist/useTranslation-BmIU4GBA.js +272 -0
- package/package.json +8 -11
- package/dist/browser-support/runtime.d.ts +0 -43
- package/dist/browser-support/runtime.js +0 -282
|
@@ -12,46 +12,46 @@ import { SelectMenu as le, SelectMenuOption as J, SelectMenuGroupItem as ce } fr
|
|
|
12
12
|
import { SelectSearch as ie } from "./select-search.js";
|
|
13
13
|
const pe = B(
|
|
14
14
|
({
|
|
15
|
-
children:
|
|
15
|
+
children: I,
|
|
16
16
|
value: u,
|
|
17
17
|
defaultValue: E = "",
|
|
18
|
-
onChange:
|
|
18
|
+
onChange: v,
|
|
19
19
|
onMenuClose: f,
|
|
20
|
-
enableSearch:
|
|
20
|
+
enableSearch: h,
|
|
21
21
|
disabled: s,
|
|
22
22
|
name: i,
|
|
23
23
|
onBlur: m,
|
|
24
24
|
placeholder: P,
|
|
25
|
-
...
|
|
25
|
+
...N
|
|
26
26
|
}, Q) => {
|
|
27
27
|
const c = w(null), D = w(null), A = w(null), $ = w(!1), [a, j] = k(
|
|
28
28
|
E || u
|
|
29
|
-
), [
|
|
30
|
-
ee(Q, () => c.current), ne(A,
|
|
31
|
-
const
|
|
29
|
+
), [S, p] = k(!1), [W, K] = k(""), [g, V] = k(-1);
|
|
30
|
+
ee(Q, () => c.current), ne(A, g);
|
|
31
|
+
const d = R.toArray(I).filter(
|
|
32
32
|
(e) => G(e)
|
|
33
33
|
);
|
|
34
34
|
O(() => {
|
|
35
35
|
var r, t;
|
|
36
36
|
let e;
|
|
37
|
-
for (const n of
|
|
37
|
+
for (const n of d) {
|
|
38
38
|
const o = (r = n.type) == null ? void 0 : r.componentType;
|
|
39
39
|
if (o === "SelectItemNext") {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
e =
|
|
40
|
+
const y = n;
|
|
41
|
+
if (y.props.value === a) {
|
|
42
|
+
e = y;
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
if (o === "SelectGroupItemNext") {
|
|
47
|
-
const
|
|
48
|
-
(
|
|
47
|
+
const y = n, b = R.toArray(y.props.children).find(
|
|
48
|
+
(x) => {
|
|
49
49
|
var z;
|
|
50
|
-
return ((z =
|
|
50
|
+
return ((z = x == null ? void 0 : x.type) == null ? void 0 : z.componentType) === "SelectItemNext" && x.props.value === a;
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
if (
|
|
54
|
-
e =
|
|
53
|
+
if (b && G(b)) {
|
|
54
|
+
e = b;
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -61,9 +61,9 @@ const pe = B(
|
|
|
61
61
|
K(n);
|
|
62
62
|
} else
|
|
63
63
|
K(""), c.current && (c.current.value = "");
|
|
64
|
-
}, [a,
|
|
65
|
-
|
|
66
|
-
}, [
|
|
64
|
+
}, [a, d]), O(() => {
|
|
65
|
+
S || V(-1);
|
|
66
|
+
}, [S]), O(() => {
|
|
67
67
|
u !== void 0 && j(u);
|
|
68
68
|
}, [u]);
|
|
69
69
|
const L = () => {
|
|
@@ -72,7 +72,7 @@ const pe = B(
|
|
|
72
72
|
}, X = (e) => {
|
|
73
73
|
p(e), e || f == null || f();
|
|
74
74
|
}, U = (e) => {
|
|
75
|
-
if (p(!1), j(e),
|
|
75
|
+
if (p(!1), j(e), v && (v({
|
|
76
76
|
target: { name: i, value: e },
|
|
77
77
|
currentTarget: { name: i, value: e },
|
|
78
78
|
type: "change",
|
|
@@ -86,36 +86,39 @@ const pe = B(
|
|
|
86
86
|
};
|
|
87
87
|
m == null || m(t);
|
|
88
88
|
}
|
|
89
|
-
}, Y = te(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
89
|
+
}, Y = te(
|
|
90
|
+
(e) => {
|
|
91
|
+
var r;
|
|
92
|
+
if (!s)
|
|
93
|
+
switch (e.key) {
|
|
94
|
+
case "ArrowDown":
|
|
95
|
+
case "ArrowUp": {
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
const t = e.key === "ArrowDown" ? 1 : -1;
|
|
98
|
+
V((n) => ae(d, n === -1 ? t === -1 ? 0 : -1 : n, t)), p(!0);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case "Enter":
|
|
102
|
+
case "NumpadEnter": {
|
|
103
|
+
if (e.preventDefault(), S && g != -1 && d[g]) {
|
|
104
|
+
const t = d[g];
|
|
105
|
+
(r = t.props) != null && r.disabled || U(t.props.value);
|
|
106
|
+
} else
|
|
107
|
+
p(!0);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
case "Tab": {
|
|
111
|
+
p(!1);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case "Escape": {
|
|
115
|
+
e.preventDefault(), p(!1);
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
116
118
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
},
|
|
120
|
+
[d, S, g]
|
|
121
|
+
), Z = (e) => {
|
|
119
122
|
var t, n;
|
|
120
123
|
const r = e.relatedTarget;
|
|
121
124
|
if (r && ((t = A.current) != null && t.contains(r) || (n = D.current) != null && n.contains(r)) || $.current) {
|
|
@@ -131,33 +134,33 @@ const pe = B(
|
|
|
131
134
|
bubbles: !0
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
|
-
}, C = re(), q =
|
|
137
|
+
}, C = re(), q = N["aria-label"] ?? F("select.next.placeholder", { defaultValue: "Select" });
|
|
135
138
|
return O(() => {
|
|
136
139
|
c.current && c.current.setAttribute("aria-labelledby", C);
|
|
137
|
-
}, [C,
|
|
140
|
+
}, [C, h]), h ? /* @__PURE__ */ l("div", { className: H("gi-select-next", N.className), children: /* @__PURE__ */ l(
|
|
138
141
|
ie,
|
|
139
142
|
{
|
|
140
|
-
...
|
|
143
|
+
...N,
|
|
141
144
|
value: a,
|
|
142
|
-
onChange:
|
|
145
|
+
onChange: v,
|
|
143
146
|
disabled: s,
|
|
144
147
|
ref: c,
|
|
145
148
|
onBlur: m,
|
|
146
149
|
name: i,
|
|
147
150
|
placeholder: P,
|
|
148
|
-
children:
|
|
151
|
+
children: I
|
|
149
152
|
}
|
|
150
153
|
) }) : /* @__PURE__ */ _(
|
|
151
154
|
"div",
|
|
152
155
|
{
|
|
153
156
|
"aria-disabled": s,
|
|
154
|
-
className: H("gi-select-next",
|
|
157
|
+
className: H("gi-select-next", N.className),
|
|
155
158
|
children: [
|
|
156
159
|
/* @__PURE__ */ l("span", { id: C, className: "gi-sr-only", children: q }),
|
|
157
160
|
/* @__PURE__ */ l(
|
|
158
161
|
oe,
|
|
159
162
|
{
|
|
160
|
-
...
|
|
163
|
+
...N,
|
|
161
164
|
autoComplete: "off",
|
|
162
165
|
"aria-label": q,
|
|
163
166
|
"aria-disabled": s,
|
|
@@ -169,7 +172,7 @@ const pe = B(
|
|
|
169
172
|
"gi-cursor-pointer": !s,
|
|
170
173
|
"gi-cursor-not-allowed gi-pointer-events-none": s
|
|
171
174
|
}),
|
|
172
|
-
iconEnd:
|
|
175
|
+
iconEnd: S ? "keyboard_arrow_up" : "keyboard_arrow_down",
|
|
173
176
|
onIconEndClick: L,
|
|
174
177
|
ref: c,
|
|
175
178
|
iconEndRef: D,
|
|
@@ -186,7 +189,7 @@ const pe = B(
|
|
|
186
189
|
triggerRef: c,
|
|
187
190
|
extraRefs: [D],
|
|
188
191
|
onOpenChange: X,
|
|
189
|
-
open:
|
|
192
|
+
open: S,
|
|
190
193
|
maxHeight: 304,
|
|
191
194
|
options: {
|
|
192
195
|
placement: "bottom-start",
|
|
@@ -203,8 +206,8 @@ const pe = B(
|
|
|
203
206
|
onChange: (e) => {
|
|
204
207
|
p(!1), U(e);
|
|
205
208
|
},
|
|
206
|
-
enableSearch:
|
|
207
|
-
children:
|
|
209
|
+
enableSearch: h,
|
|
210
|
+
children: d.map((e, r) => {
|
|
208
211
|
var n;
|
|
209
212
|
const t = (n = e == null ? void 0 : e.type) == null ? void 0 : n.componentType;
|
|
210
213
|
if (t === "SelectItemNext") {
|
|
@@ -213,22 +216,22 @@ const pe = B(
|
|
|
213
216
|
J,
|
|
214
217
|
{
|
|
215
218
|
...o.props,
|
|
216
|
-
isHighlighted:
|
|
219
|
+
isHighlighted: g === r,
|
|
217
220
|
selected: (a == null ? void 0 : a.toString()) === o.props.value.toString(),
|
|
218
221
|
index: r
|
|
219
222
|
},
|
|
220
223
|
`SelectItemNext-${o.props.value.toString()}`
|
|
221
224
|
);
|
|
222
225
|
} else if (t === "SelectGroupItemNext") {
|
|
223
|
-
const o = e,
|
|
224
|
-
const T =
|
|
226
|
+
const o = e, y = R.toArray(o.props.children).filter((b) => G(b)).map((b, x) => {
|
|
227
|
+
const T = b.props;
|
|
225
228
|
return /* @__PURE__ */ l(
|
|
226
229
|
J,
|
|
227
230
|
{
|
|
228
231
|
...T,
|
|
229
|
-
isHighlighted:
|
|
232
|
+
isHighlighted: g === r,
|
|
230
233
|
selected: (a == null ? void 0 : a.toString()) === T.value.toString(),
|
|
231
|
-
index:
|
|
234
|
+
index: x
|
|
232
235
|
},
|
|
233
236
|
`SelectGroupItemNext-SelectItemNext-${T.value.toString()}`
|
|
234
237
|
);
|
|
@@ -237,7 +240,7 @@ const pe = B(
|
|
|
237
240
|
ce,
|
|
238
241
|
{
|
|
239
242
|
label: o.props.label,
|
|
240
|
-
children:
|
|
243
|
+
children: y
|
|
241
244
|
},
|
|
242
245
|
`option-group-${r}`
|
|
243
246
|
);
|
|
@@ -264,17 +267,17 @@ Object.defineProperty(ue, "componentType", {
|
|
|
264
267
|
writable: !1,
|
|
265
268
|
enumerable: !1
|
|
266
269
|
});
|
|
267
|
-
const Ne = (
|
|
268
|
-
const { options: u, defaultValue: E, onChange:
|
|
270
|
+
const Ne = (I) => {
|
|
271
|
+
const { options: u, defaultValue: E, onChange: v, error: f } = I;
|
|
269
272
|
return /* @__PURE__ */ l(
|
|
270
273
|
pe,
|
|
271
274
|
{
|
|
272
|
-
...
|
|
275
|
+
...I,
|
|
273
276
|
defaultValue: E,
|
|
274
|
-
onChange:
|
|
277
|
+
onChange: v,
|
|
275
278
|
"data-table-cell": "true",
|
|
276
279
|
"data-table-cell-error-state": f == null ? void 0 : f.toString(),
|
|
277
|
-
children: u.map(({ value:
|
|
280
|
+
children: u.map(({ value: h, label: s }) => /* @__PURE__ */ l(M, { value: h, children: s }, `${h}-${s}`))
|
|
278
281
|
}
|
|
279
282
|
);
|
|
280
283
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as React, PropsWithChildren } from 'react';
|
|
2
|
-
import { SideNavItemProps, SideNavProps } from './types.js';
|
|
2
|
+
import { SideNavHeadingProps, SideNavItemProps, SideNavProps } from './types.js';
|
|
3
3
|
export declare const SideNavItem: React.FC<PropsWithChildren<SideNavItemProps> & {
|
|
4
4
|
open?: boolean;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const SideNav: React.FC<PropsWithChildren<SideNavProps>>;
|
|
7
|
+
export declare const SideNavHeading: React.FC<SideNavHeadingProps>;
|
|
@@ -1,132 +1,133 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import { cn as
|
|
6
|
-
import {
|
|
2
|
+
import { jsxs as x, Fragment as R, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import r, { memo as k, useEffect as V, useCallback as g, useState as $ } from "react";
|
|
4
|
+
import { Button as q } from "../button/button.js";
|
|
5
|
+
import { cn as m } from "../cn.js";
|
|
6
|
+
import { Heading as A } from "../heading/heading.js";
|
|
7
|
+
import { Icon as z } from "../icon/icon.js";
|
|
7
8
|
import { Link as G } from "../link/link.js";
|
|
8
|
-
import { Paragraph as
|
|
9
|
-
const
|
|
9
|
+
import { Paragraph as J } from "../paragraph/paragraph.js";
|
|
10
|
+
const C = r.createContext(
|
|
10
11
|
void 0
|
|
11
|
-
),
|
|
12
|
+
), B = k(
|
|
12
13
|
({
|
|
13
14
|
icon: n,
|
|
14
|
-
label:
|
|
15
|
-
showExpandableIcon:
|
|
15
|
+
label: t,
|
|
16
|
+
showExpandableIcon: d,
|
|
16
17
|
isOpen: e
|
|
17
|
-
}) => /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
n && /* @__PURE__ */ s("div", { className: "gi-side-nav-item-icon", children: /* @__PURE__ */ s(
|
|
20
|
-
/* @__PURE__ */ s("div", { className: "gi-side-nav-item-label", children: /* @__PURE__ */ s(
|
|
18
|
+
}) => /* @__PURE__ */ x(R, { children: [
|
|
19
|
+
/* @__PURE__ */ x("div", { className: "gi-side-nav-item-left", children: [
|
|
20
|
+
n && /* @__PURE__ */ s("div", { className: "gi-side-nav-item-icon", children: /* @__PURE__ */ s(z, { icon: n }) }),
|
|
21
|
+
/* @__PURE__ */ s("div", { className: "gi-side-nav-item-label", children: /* @__PURE__ */ s(J, { size: "md", children: t }) })
|
|
21
22
|
] }),
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
d && /* @__PURE__ */ s("div", { className: "gi-side-nav-expandable-icon", children: /* @__PURE__ */ s(
|
|
24
|
+
z,
|
|
24
25
|
{
|
|
25
|
-
className:
|
|
26
|
+
className: m(e && "gi-rotate-180"),
|
|
26
27
|
icon: "keyboard_arrow_down"
|
|
27
28
|
}
|
|
28
29
|
) })
|
|
29
30
|
] })
|
|
30
|
-
),
|
|
31
|
+
), K = r.memo(
|
|
31
32
|
({
|
|
32
33
|
children: n,
|
|
33
|
-
primary:
|
|
34
|
-
secondary:
|
|
34
|
+
primary: t,
|
|
35
|
+
secondary: d,
|
|
35
36
|
expandable: e,
|
|
36
|
-
label:
|
|
37
|
-
value:
|
|
38
|
-
icon:
|
|
39
|
-
href:
|
|
40
|
-
asChild:
|
|
41
|
-
open:
|
|
37
|
+
label: c,
|
|
38
|
+
value: i,
|
|
39
|
+
icon: f,
|
|
40
|
+
href: l,
|
|
41
|
+
asChild: u,
|
|
42
|
+
open: v
|
|
42
43
|
}) => {
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
44
|
+
const I = r.useContext(C);
|
|
45
|
+
if (!I)
|
|
45
46
|
throw new Error("SideNavItem must be used within a SideNav");
|
|
46
47
|
const {
|
|
47
48
|
openItemIds: o,
|
|
48
49
|
selectedItemId: S,
|
|
49
50
|
setOpenItemIds: p,
|
|
50
|
-
setSelectedItemId:
|
|
51
|
-
navId:
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, [
|
|
56
|
-
const h =
|
|
57
|
-
const
|
|
58
|
-
p(
|
|
59
|
-
}, [
|
|
60
|
-
|
|
61
|
-
}, [
|
|
62
|
-
|
|
63
|
-
}, [
|
|
64
|
-
(
|
|
65
|
-
|
|
51
|
+
setSelectedItemId: E,
|
|
52
|
+
navId: b
|
|
53
|
+
} = I, N = o.includes(i), H = S === i;
|
|
54
|
+
V(() => {
|
|
55
|
+
v && p((a) => a.includes(i) ? a : [...a, i]);
|
|
56
|
+
}, [v, p, i]);
|
|
57
|
+
const h = g(() => {
|
|
58
|
+
const a = N ? o.filter((M) => M !== i) : [...o, i];
|
|
59
|
+
p(a);
|
|
60
|
+
}, [N, o, p, i]), w = g(() => {
|
|
61
|
+
E(i);
|
|
62
|
+
}, [E, i]), O = `${b}-${i}`, _ = t && e, j = l !== void 0, P = g(() => {
|
|
63
|
+
t && e && h(), w();
|
|
64
|
+
}, [t, e, h, w]), D = g(
|
|
65
|
+
(a) => {
|
|
66
|
+
a.preventDefault(), t && e ? h() : w();
|
|
66
67
|
},
|
|
67
|
-
[
|
|
68
|
-
),
|
|
69
|
-
"gi-side-nav-item-selected":
|
|
70
|
-
"gi-side-nav-item-primary":
|
|
71
|
-
"gi-side-nav-item-secondary":
|
|
72
|
-
}),
|
|
73
|
-
"gi-side-nav-item-selected":
|
|
74
|
-
"gi-side-nav-item-primary":
|
|
75
|
-
"gi-side-nav-item-secondary":
|
|
68
|
+
[t, e, h, w]
|
|
69
|
+
), F = m("gi-side-nav-item", {
|
|
70
|
+
"gi-side-nav-item-selected": H,
|
|
71
|
+
"gi-side-nav-item-primary": t,
|
|
72
|
+
"gi-side-nav-item-secondary": d
|
|
73
|
+
}), L = m("gi-side-nav-item", {
|
|
74
|
+
"gi-side-nav-item-selected": H,
|
|
75
|
+
"gi-side-nav-item-primary": t,
|
|
76
|
+
"gi-side-nav-item-secondary": d
|
|
76
77
|
});
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ x(
|
|
78
79
|
"div",
|
|
79
80
|
{
|
|
80
81
|
role: "group",
|
|
81
|
-
"aria-label": `${
|
|
82
|
+
"aria-label": `${c} ${t && e ? "dropdown" : "item"}`,
|
|
82
83
|
children: [
|
|
83
|
-
|
|
84
|
+
j ? /* @__PURE__ */ s(
|
|
84
85
|
G,
|
|
85
86
|
{
|
|
86
|
-
id:
|
|
87
|
-
href:
|
|
88
|
-
asChild:
|
|
87
|
+
id: O,
|
|
88
|
+
href: l,
|
|
89
|
+
asChild: u,
|
|
89
90
|
asButton: {
|
|
90
91
|
variant: "flat",
|
|
91
92
|
appearance: "dark",
|
|
92
93
|
size: "medium"
|
|
93
94
|
},
|
|
94
|
-
className:
|
|
95
|
-
onClick:
|
|
96
|
-
children:
|
|
97
|
-
|
|
95
|
+
className: F,
|
|
96
|
+
onClick: P,
|
|
97
|
+
children: u ? n : /* @__PURE__ */ s(
|
|
98
|
+
B,
|
|
98
99
|
{
|
|
99
|
-
icon:
|
|
100
|
-
label:
|
|
101
|
-
showExpandableIcon:
|
|
102
|
-
isOpen:
|
|
100
|
+
icon: f,
|
|
101
|
+
label: c,
|
|
102
|
+
showExpandableIcon: _,
|
|
103
|
+
isOpen: N
|
|
103
104
|
}
|
|
104
105
|
)
|
|
105
106
|
}
|
|
106
107
|
) : /* @__PURE__ */ s(
|
|
107
|
-
|
|
108
|
+
q,
|
|
108
109
|
{
|
|
109
110
|
variant: "flat",
|
|
110
111
|
appearance: "dark",
|
|
111
112
|
size: "medium",
|
|
112
|
-
onClick:
|
|
113
|
-
className:
|
|
114
|
-
id:
|
|
113
|
+
onClick: D,
|
|
114
|
+
className: L,
|
|
115
|
+
id: O,
|
|
115
116
|
children: /* @__PURE__ */ s(
|
|
116
|
-
|
|
117
|
+
B,
|
|
117
118
|
{
|
|
118
|
-
icon:
|
|
119
|
-
label:
|
|
120
|
-
showExpandableIcon:
|
|
121
|
-
isOpen:
|
|
119
|
+
icon: f,
|
|
120
|
+
label: c,
|
|
121
|
+
showExpandableIcon: _,
|
|
122
|
+
isOpen: N
|
|
122
123
|
}
|
|
123
124
|
)
|
|
124
125
|
}
|
|
125
126
|
),
|
|
126
|
-
e &&
|
|
127
|
+
e && t && /* @__PURE__ */ s(
|
|
127
128
|
"div",
|
|
128
129
|
{
|
|
129
|
-
className: N
|
|
130
|
+
className: m(N ? "gi-side-nav-item-content" : "gi-hidden"),
|
|
130
131
|
children: n
|
|
131
132
|
}
|
|
132
133
|
)
|
|
@@ -134,38 +135,58 @@ const j = f.createContext(
|
|
|
134
135
|
}
|
|
135
136
|
);
|
|
136
137
|
}
|
|
137
|
-
),
|
|
138
|
-
({ children: n, className:
|
|
139
|
-
const [
|
|
140
|
-
|
|
141
|
-
),
|
|
138
|
+
), Q = k(
|
|
139
|
+
({ children: n, className: t, dataTestid: d, onChange: e, value: c }) => {
|
|
140
|
+
const [i, f] = $([]), [l, u] = $(
|
|
141
|
+
c
|
|
142
|
+
), v = r.useId(), I = g(
|
|
142
143
|
(S) => {
|
|
143
|
-
|
|
144
|
+
u(S), e == null || e(S);
|
|
144
145
|
},
|
|
145
146
|
[e]
|
|
146
|
-
), o =
|
|
147
|
+
), o = r.useMemo(
|
|
147
148
|
() => ({
|
|
148
|
-
openItemIds:
|
|
149
|
-
selectedItemId:
|
|
150
|
-
setOpenItemIds:
|
|
151
|
-
setSelectedItemId:
|
|
152
|
-
navId:
|
|
149
|
+
openItemIds: i,
|
|
150
|
+
selectedItemId: l,
|
|
151
|
+
setOpenItemIds: f,
|
|
152
|
+
setSelectedItemId: I,
|
|
153
|
+
navId: v
|
|
153
154
|
}),
|
|
154
|
-
[
|
|
155
|
+
[i, l, I, v]
|
|
155
156
|
);
|
|
156
|
-
return /* @__PURE__ */ s(
|
|
157
|
+
return /* @__PURE__ */ s(C.Provider, { value: o, children: /* @__PURE__ */ s(
|
|
157
158
|
"div",
|
|
158
159
|
{
|
|
159
|
-
className:
|
|
160
|
-
"data-testid":
|
|
160
|
+
className: m("gi-side-nav-container", t),
|
|
161
|
+
"data-testid": d,
|
|
161
162
|
children: n
|
|
162
163
|
}
|
|
163
164
|
) });
|
|
164
165
|
}
|
|
166
|
+
), T = k(
|
|
167
|
+
({ children: n, secondary: t, className: d, ...e }) => {
|
|
168
|
+
if (!r.useContext(C))
|
|
169
|
+
throw new Error("SideNavHeading must be used within a SideNav");
|
|
170
|
+
return /* @__PURE__ */ s(
|
|
171
|
+
A,
|
|
172
|
+
{
|
|
173
|
+
...e,
|
|
174
|
+
as: "h5",
|
|
175
|
+
className: m(
|
|
176
|
+
"gi-side-nav-heading",
|
|
177
|
+
t ? "gi-px-6" : "gi-px-3",
|
|
178
|
+
d
|
|
179
|
+
),
|
|
180
|
+
children: n
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
165
184
|
);
|
|
166
|
-
|
|
167
|
-
|
|
185
|
+
Q.displayName = "SideNav";
|
|
186
|
+
K.displayName = "SideNavItem";
|
|
187
|
+
T.displayName = "SideNavHeading";
|
|
168
188
|
export {
|
|
169
|
-
|
|
170
|
-
|
|
189
|
+
Q as SideNav,
|
|
190
|
+
T as SideNavHeading,
|
|
191
|
+
K as SideNavItem
|
|
171
192
|
};
|
package/dist/side-nav/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HeadingProps } from '../heading/heading.js';
|
|
1
2
|
import { IconId } from '../icon/icon.js';
|
|
2
3
|
export type SideNavItemProps = {
|
|
3
4
|
value: string;
|
|
@@ -16,3 +17,6 @@ export type SideNavProps = {
|
|
|
16
17
|
value?: string;
|
|
17
18
|
onChange?: (value: string) => void;
|
|
18
19
|
};
|
|
20
|
+
export type SideNavHeadingProps = {
|
|
21
|
+
secondary?: boolean;
|
|
22
|
+
} & HeadingProps;
|