@ogcio/design-system-react 1.20.0 → 1.22.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/alert/alert.d.ts +3 -90
- package/dist/alert/alert.js +43 -74
- package/dist/alert/types.d.ts +11 -0
- package/dist/alert/types.js +1 -0
- package/dist/alert/variants.d.ts +76 -0
- package/dist/alert/variants.js +36 -0
- package/dist/autocomplete/autocomplete.js +105 -97
- package/dist/card/card-legacy.d.ts +1 -1
- package/dist/card/card-legacy.js +12 -12
- package/dist/card/card-next.d.ts +2 -3
- package/dist/card/card-next.js +226 -61
- package/dist/card/card.js +17 -16
- package/dist/card/types.d.ts +20 -30
- package/dist/checkbox/types.d.ts +0 -1
- package/dist/drawer/drawer.d.ts +2 -3
- package/dist/drawer/drawer.js +59 -36
- package/dist/forms/form-field/form-field.d.ts +2 -3
- package/dist/forms/form-field/form-field.js +69 -60
- package/dist/forms/form-field/types.d.ts +3 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +235 -228
- package/dist/input-checkbox/input-checkbox.d.ts +1 -1
- package/dist/input-checkbox/input-checkbox.js +33 -35
- package/dist/input-checkbox/types.d.ts +0 -1
- package/dist/input-checkbox/types.js +2 -3
- package/dist/input-radio/input-radio.d.ts +1 -1
- package/dist/input-radio/input-radio.js +39 -40
- package/dist/input-radio/types.d.ts +0 -1
- package/dist/input-radio/types.js +0 -1
- package/dist/link/link.d.ts +2 -2
- package/dist/link/link.js +18 -19
- package/dist/modal/modal.js +158 -178
- package/dist/radio/types.d.ts +0 -1
- package/dist/select/select-next.js +151 -144
- package/dist/styles.css +1 -1
- package/dist/summary-list/index.d.ts +6 -0
- package/dist/summary-list/index.js +12 -0
- package/dist/summary-list/summary-list-action.d.ts +5 -0
- package/dist/summary-list/summary-list-action.js +18 -0
- package/dist/summary-list/summary-list-context.d.ts +2 -0
- package/dist/summary-list/summary-list-context.js +20 -0
- package/dist/summary-list/summary-list-header.d.ts +5 -0
- package/dist/summary-list/summary-list-header.js +68 -0
- package/dist/summary-list/summary-list-row.d.ts +6 -0
- package/dist/summary-list/summary-list-row.js +63 -0
- package/dist/summary-list/summary-list-value.d.ts +5 -0
- package/dist/summary-list/summary-list-value.js +17 -0
- package/dist/summary-list/summary-list.d.ts +2 -11
- package/dist/summary-list/summary-list.js +37 -43
- package/dist/summary-list/types.d.ts +15 -11
- package/dist/toast/ds-toast.d.ts +1 -1
- package/dist/toast/ds-toast.js +29 -40
- package/dist/toast/toast.d.ts +1 -1
- package/dist/toast/toast.js +65 -57
- package/dist/toast/types.d.ts +3 -2
- package/dist/utilities.d.ts +3 -0
- package/dist/utilities.js +17 -7
- package/package.json +2 -2
|
@@ -1,159 +1,166 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "@ogcio/design-system-react/browser-check";
|
|
3
|
-
import {
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { cn as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
3
|
+
import { jsxs as q, jsx as s } from "react/jsx-runtime";
|
|
4
|
+
import { forwardRef as Z, useRef as v, useState as E, useImperativeHandle as _, Children as R, isValidElement as G, useEffect as P } from "react";
|
|
5
|
+
import { cn as D } from "../cn.js";
|
|
6
|
+
import { useDomId as B } from "../hooks/use-dom-id.js";
|
|
7
|
+
import { translate as z } from "../i18n/utility.js";
|
|
8
|
+
import { InputText as ee } from "../input-text/input-text.js";
|
|
9
|
+
import { Popover as te } from "../popover/popover.js";
|
|
10
|
+
import { SelectMenu as re, SelectMenuOption as F, SelectMenuGroupItem as ne } from "./select-menu.js";
|
|
11
|
+
import { SelectSearch as oe } from "./select-search.js";
|
|
12
|
+
const se = Z(
|
|
12
13
|
({
|
|
13
14
|
children: S,
|
|
14
15
|
value: p,
|
|
15
|
-
defaultValue:
|
|
16
|
-
onChange:
|
|
16
|
+
defaultValue: T = "",
|
|
17
|
+
onChange: b,
|
|
17
18
|
onMenuClose: g,
|
|
18
|
-
enableSearch:
|
|
19
|
-
disabled:
|
|
20
|
-
name:
|
|
21
|
-
onBlur:
|
|
22
|
-
placeholder:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
), [
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
(e) =>
|
|
19
|
+
enableSearch: d,
|
|
20
|
+
disabled: r,
|
|
21
|
+
name: i,
|
|
22
|
+
onBlur: u,
|
|
23
|
+
placeholder: $,
|
|
24
|
+
...x
|
|
25
|
+
}, Q) => {
|
|
26
|
+
const c = v(null), O = v(null), j = v(null), A = v(!1), [n, M] = E(
|
|
27
|
+
T || p
|
|
28
|
+
), [H, h] = E(!1), [U, K] = E("");
|
|
29
|
+
_(Q, () => c.current);
|
|
30
|
+
const k = R.toArray(S).filter(
|
|
31
|
+
(e) => G(e)
|
|
31
32
|
);
|
|
32
|
-
|
|
33
|
-
var
|
|
33
|
+
P(() => {
|
|
34
|
+
var l, a;
|
|
34
35
|
let e;
|
|
35
|
-
for (const o of
|
|
36
|
-
const t = (
|
|
36
|
+
for (const o of k) {
|
|
37
|
+
const t = (l = o.type) == null ? void 0 : l.componentType;
|
|
37
38
|
if (t === "SelectItemNext") {
|
|
38
39
|
const f = o;
|
|
39
|
-
if (f.props.value ===
|
|
40
|
+
if (f.props.value === n) {
|
|
40
41
|
e = f;
|
|
41
42
|
break;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
if (t === "SelectGroupItemNext") {
|
|
45
|
-
const f = o, m =
|
|
46
|
+
const f = o, m = R.toArray(f.props.children).find(
|
|
46
47
|
(y) => {
|
|
47
|
-
var
|
|
48
|
-
return ((
|
|
48
|
+
var V;
|
|
49
|
+
return ((V = y == null ? void 0 : y.type) == null ? void 0 : V.componentType) === "SelectItemNext" && y.props.value === n;
|
|
49
50
|
}
|
|
50
51
|
);
|
|
51
|
-
if (m &&
|
|
52
|
+
if (m && G(m)) {
|
|
52
53
|
e = m;
|
|
53
54
|
break;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
if (e) {
|
|
58
|
-
const o = ((
|
|
59
|
-
|
|
59
|
+
const o = ((a = e.props.children) == null ? void 0 : a.toString()) || "";
|
|
60
|
+
K(o);
|
|
60
61
|
} else
|
|
61
|
-
|
|
62
|
-
}, [
|
|
63
|
-
p !== void 0 &&
|
|
62
|
+
K(""), c.current && (c.current.value = "");
|
|
63
|
+
}, [n, k]), P(() => {
|
|
64
|
+
p !== void 0 && M(p);
|
|
64
65
|
}, [p]);
|
|
65
|
-
const
|
|
66
|
+
const w = () => {
|
|
66
67
|
var e;
|
|
67
|
-
|
|
68
|
+
h(!0), (e = c.current) == null || e.focus();
|
|
69
|
+
}, W = (e) => {
|
|
70
|
+
h(e), g && !e && g();
|
|
68
71
|
}, L = (e) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
target: { name: a, value: e },
|
|
73
|
-
currentTarget: { name: a, value: e },
|
|
72
|
+
if (h(!1), M(e), b && (b({
|
|
73
|
+
target: { name: i, value: e },
|
|
74
|
+
currentTarget: { name: i, value: e },
|
|
74
75
|
type: "change",
|
|
75
76
|
bubbles: !0
|
|
76
|
-
}),
|
|
77
|
-
const
|
|
78
|
-
target: { name:
|
|
79
|
-
currentTarget: { name:
|
|
77
|
+
}), u)) {
|
|
78
|
+
const a = {
|
|
79
|
+
target: { name: i, value: e },
|
|
80
|
+
currentTarget: { name: i, value: e },
|
|
80
81
|
type: "blur",
|
|
81
82
|
bubbles: !0
|
|
82
83
|
};
|
|
83
|
-
|
|
84
|
+
u == null || u(a);
|
|
84
85
|
}
|
|
85
|
-
},
|
|
86
|
-
e.key === "Enter"
|
|
87
|
-
},
|
|
88
|
-
var
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
setTimeout(() =>
|
|
86
|
+
}, X = (e) => {
|
|
87
|
+
!r && (e.key === "Enter" || e.key === "NumpadEnter") ? (e.preventDefault(), w()) : e.key === "Escape" && h(!1);
|
|
88
|
+
}, Y = (e) => {
|
|
89
|
+
var a, o;
|
|
90
|
+
const l = e.relatedTarget;
|
|
91
|
+
if (l && ((a = j.current) != null && a.contains(l) || (o = O.current) != null && o.contains(l)) || A.current) {
|
|
92
|
+
setTimeout(() => A.current = !1, 0);
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
94
|
-
if (
|
|
95
|
-
const t = p ??
|
|
96
|
-
|
|
97
|
-
target: { name:
|
|
98
|
-
currentTarget: { name:
|
|
95
|
+
if (u) {
|
|
96
|
+
const t = p ?? n ?? "";
|
|
97
|
+
u({
|
|
98
|
+
target: { name: i, value: t },
|
|
99
|
+
currentTarget: { name: i, value: t },
|
|
99
100
|
type: "blur",
|
|
100
101
|
bubbles: !0
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
|
-
};
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
}, I = B(), C = x["aria-label"] ?? z("select.next.placeholder", { defaultValue: "Select" });
|
|
105
|
+
return P(() => {
|
|
106
|
+
c.current && c.current.setAttribute("aria-labelledby", I);
|
|
107
|
+
}, [I, d]), d ? /* @__PURE__ */ q("div", { className: D("gi-select-next", x.className), children: [
|
|
108
|
+
/* @__PURE__ */ s("span", { id: I, className: "gi-sr-only", children: C }),
|
|
109
|
+
/* @__PURE__ */ s(
|
|
110
|
+
oe,
|
|
111
|
+
{
|
|
112
|
+
...x,
|
|
113
|
+
value: n,
|
|
114
|
+
onChange: b,
|
|
115
|
+
disabled: r,
|
|
116
|
+
ref: c,
|
|
117
|
+
onBlur: u,
|
|
118
|
+
name: i,
|
|
119
|
+
placeholder: $,
|
|
120
|
+
children: S
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] }) : /* @__PURE__ */ q(
|
|
118
124
|
"div",
|
|
119
125
|
{
|
|
120
|
-
"aria-disabled":
|
|
121
|
-
className:
|
|
126
|
+
"aria-disabled": r,
|
|
127
|
+
className: D("gi-select-next", x.className),
|
|
122
128
|
children: [
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
|
|
129
|
+
/* @__PURE__ */ s("span", { id: I, className: "gi-sr-only", children: C }),
|
|
130
|
+
/* @__PURE__ */ s(
|
|
131
|
+
ee,
|
|
125
132
|
{
|
|
126
|
-
...
|
|
133
|
+
...x,
|
|
127
134
|
autoComplete: "off",
|
|
128
|
-
"aria-label":
|
|
129
|
-
"aria-disabled":
|
|
130
|
-
disabled:
|
|
131
|
-
placeholder:
|
|
135
|
+
"aria-label": C,
|
|
136
|
+
"aria-disabled": r,
|
|
137
|
+
disabled: r,
|
|
138
|
+
placeholder: $ ?? z("select.next.placeholder", { defaultValue: "Search" }),
|
|
132
139
|
readOnly: !0,
|
|
133
140
|
inputClassName: "gi-cursor-pointer",
|
|
134
|
-
iconEndClassName:
|
|
135
|
-
"gi-cursor-pointer": !
|
|
136
|
-
"gi-cursor-not-allowed":
|
|
137
|
-
"gi-pointer-events-none":
|
|
141
|
+
iconEndClassName: D({
|
|
142
|
+
"gi-cursor-pointer": !r,
|
|
143
|
+
"gi-cursor-not-allowed": r,
|
|
144
|
+
"gi-pointer-events-none": r
|
|
138
145
|
}),
|
|
139
|
-
iconEnd: "keyboard_arrow_down",
|
|
140
|
-
onIconEndClick:
|
|
141
|
-
ref:
|
|
142
|
-
iconEndRef:
|
|
143
|
-
value:
|
|
144
|
-
onClick:
|
|
145
|
-
onKeyDown:
|
|
146
|
-
onBlur:
|
|
147
|
-
name:
|
|
146
|
+
iconEnd: H ? "keyboard_arrow_up" : "keyboard_arrow_down",
|
|
147
|
+
onIconEndClick: w,
|
|
148
|
+
ref: c,
|
|
149
|
+
iconEndRef: O,
|
|
150
|
+
value: U,
|
|
151
|
+
onClick: w,
|
|
152
|
+
onKeyDown: X,
|
|
153
|
+
onBlur: Y,
|
|
154
|
+
name: i
|
|
148
155
|
}
|
|
149
156
|
),
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
|
|
157
|
+
/* @__PURE__ */ s(
|
|
158
|
+
te,
|
|
152
159
|
{
|
|
153
|
-
triggerRef:
|
|
154
|
-
extraRefs: [
|
|
155
|
-
onOpenChange:
|
|
156
|
-
open:
|
|
160
|
+
triggerRef: c,
|
|
161
|
+
extraRefs: [O],
|
|
162
|
+
onOpenChange: W,
|
|
163
|
+
open: H,
|
|
157
164
|
maxHeight: 304,
|
|
158
165
|
options: {
|
|
159
166
|
placement: "bottom-start",
|
|
@@ -163,47 +170,47 @@ const ne = W(
|
|
|
163
170
|
{ name: "flip", options: { fallbackPlacements: ["top"] } }
|
|
164
171
|
]
|
|
165
172
|
},
|
|
166
|
-
children: /* @__PURE__ */
|
|
167
|
-
|
|
173
|
+
children: /* @__PURE__ */ s(
|
|
174
|
+
re,
|
|
168
175
|
{
|
|
169
|
-
ref:
|
|
170
|
-
onChange:
|
|
171
|
-
enableSearch:
|
|
172
|
-
children:
|
|
176
|
+
ref: j,
|
|
177
|
+
onChange: L,
|
|
178
|
+
enableSearch: d,
|
|
179
|
+
children: k.map((e, l) => {
|
|
173
180
|
var o;
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
181
|
+
const a = (o = e == null ? void 0 : e.type) == null ? void 0 : o.componentType;
|
|
182
|
+
if (a === "SelectItemNext") {
|
|
176
183
|
const t = e;
|
|
177
|
-
return /* @__PURE__ */
|
|
178
|
-
|
|
184
|
+
return /* @__PURE__ */ s(
|
|
185
|
+
F,
|
|
179
186
|
{
|
|
180
187
|
...t.props,
|
|
181
|
-
selected: (
|
|
182
|
-
index:
|
|
188
|
+
selected: (n == null ? void 0 : n.toString()) === t.props.value.toString(),
|
|
189
|
+
index: l
|
|
183
190
|
},
|
|
184
191
|
`SelectItemNext-${t.props.value.toString()}`
|
|
185
192
|
);
|
|
186
|
-
} else if (
|
|
187
|
-
const t = e, f =
|
|
188
|
-
const
|
|
189
|
-
return /* @__PURE__ */
|
|
190
|
-
|
|
193
|
+
} else if (a === "SelectGroupItemNext") {
|
|
194
|
+
const t = e, f = R.toArray(t.props.children).filter((m) => G(m)).map((m, y) => {
|
|
195
|
+
const N = m.props;
|
|
196
|
+
return /* @__PURE__ */ s(
|
|
197
|
+
F,
|
|
191
198
|
{
|
|
192
|
-
...
|
|
193
|
-
selected: (
|
|
194
|
-
onChange:
|
|
199
|
+
...N,
|
|
200
|
+
selected: (n == null ? void 0 : n.toString()) === N.value.toString(),
|
|
201
|
+
onChange: L,
|
|
195
202
|
index: y
|
|
196
203
|
},
|
|
197
|
-
`SelectGroupItemNext-SelectItemNext-${
|
|
204
|
+
`SelectGroupItemNext-SelectItemNext-${N.value.toString()}`
|
|
198
205
|
);
|
|
199
206
|
});
|
|
200
|
-
return /* @__PURE__ */
|
|
201
|
-
|
|
207
|
+
return /* @__PURE__ */ s(
|
|
208
|
+
ne,
|
|
202
209
|
{
|
|
203
210
|
label: t.props.label,
|
|
204
211
|
children: f
|
|
205
212
|
},
|
|
206
|
-
`option-group-${
|
|
213
|
+
`option-group-${l}`
|
|
207
214
|
);
|
|
208
215
|
}
|
|
209
216
|
return null;
|
|
@@ -216,35 +223,35 @@ const ne = W(
|
|
|
216
223
|
}
|
|
217
224
|
);
|
|
218
225
|
}
|
|
219
|
-
),
|
|
220
|
-
Object.defineProperty(
|
|
226
|
+
), J = () => null;
|
|
227
|
+
Object.defineProperty(J, "componentType", {
|
|
221
228
|
value: "SelectItemNext",
|
|
222
229
|
writable: !1,
|
|
223
230
|
enumerable: !1
|
|
224
231
|
});
|
|
225
|
-
const
|
|
226
|
-
Object.defineProperty(
|
|
232
|
+
const le = () => null;
|
|
233
|
+
Object.defineProperty(le, "componentType", {
|
|
227
234
|
value: "SelectGroupItemNext",
|
|
228
235
|
writable: !1,
|
|
229
236
|
enumerable: !1
|
|
230
237
|
});
|
|
231
|
-
const
|
|
232
|
-
const { options: p, defaultValue:
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
|
|
238
|
+
const Se = (S) => {
|
|
239
|
+
const { options: p, defaultValue: T, onChange: b, error: g } = S;
|
|
240
|
+
return /* @__PURE__ */ s(
|
|
241
|
+
se,
|
|
235
242
|
{
|
|
236
243
|
...S,
|
|
237
|
-
defaultValue:
|
|
238
|
-
onChange:
|
|
244
|
+
defaultValue: T,
|
|
245
|
+
onChange: b,
|
|
239
246
|
"data-table-cell": "true",
|
|
240
247
|
"data-table-cell-error-state": g == null ? void 0 : g.toString(),
|
|
241
|
-
children: p.map(({ value:
|
|
248
|
+
children: p.map(({ value: d, label: r }) => /* @__PURE__ */ s(J, { value: d, children: r }, `${d}-${r}`))
|
|
242
249
|
}
|
|
243
250
|
);
|
|
244
251
|
};
|
|
245
252
|
export {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
le as SelectGroupItemNext,
|
|
254
|
+
J as SelectItemNext,
|
|
255
|
+
se as SelectNext,
|
|
256
|
+
Se as SelectNextTableCell
|
|
250
257
|
};
|