@ogcio/design-system-react 1.15.2 → 1.15.3
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/autocomplete.js +55 -53
- package/dist/popover/popover.js +560 -524
- package/dist/select/select-menu.js +61 -63
- package/dist/select/select-next.js +74 -72
- package/dist/select/types.d.ts +0 -3
- package/dist/styles.css +1 -1
- package/dist/toast/toast.js +6 -9
- package/package.json +2 -2
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
2
|
+
import { jsxs as J, jsx as O } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as Q, useRef as G, useImperativeHandle as W, useEffect as Y, createElement as Z, Children as ee, isValidElement as te } from "react";
|
|
4
4
|
import { cn as P } from "../cn.js";
|
|
5
5
|
import { translate as D } from "../i18n/utility.js";
|
|
6
|
-
import { InputText as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { SelectMenu as
|
|
9
|
-
import { AUTOCOMPLETE_ACTIONS as
|
|
10
|
-
import { useAutocompleteController as
|
|
6
|
+
import { InputText as oe } from "../input-text/input-text.js";
|
|
7
|
+
import { Popover as ne } from "../popover/popover.js";
|
|
8
|
+
import { SelectMenu as le, SelectMenuOption as L, SelectMenuGroupItem as re } from "../select/select-menu.js";
|
|
9
|
+
import { AUTOCOMPLETE_ACTIONS as ae } from "./types.js";
|
|
10
|
+
import { useAutocompleteController as pe } from "./use-autocomplete-controller.js";
|
|
11
11
|
const {
|
|
12
|
-
ON_RESET:
|
|
13
|
-
ON_SELECT_ITEM:
|
|
12
|
+
ON_RESET: ie,
|
|
13
|
+
ON_SELECT_ITEM: se,
|
|
14
14
|
SET_INPUT_VALUE: R,
|
|
15
15
|
SET_IS_OPEN: d,
|
|
16
16
|
TOGGLE_CLEAR_BUTTON: v,
|
|
17
17
|
SET_HIGHLIGHTED_INDEX: B,
|
|
18
|
-
SET_VALUE:
|
|
19
|
-
} =
|
|
18
|
+
SET_VALUE: ce
|
|
19
|
+
} = ae, ue = (n) => n ? "keyboard_arrow_up" : "keyboard_arrow_down", C = (n, l) => (p) => {
|
|
20
20
|
n && n({
|
|
21
21
|
target: {
|
|
22
22
|
name: l,
|
|
@@ -38,7 +38,7 @@ const {
|
|
|
38
38
|
bubbles: !0,
|
|
39
39
|
isTrusted: !0
|
|
40
40
|
});
|
|
41
|
-
},
|
|
41
|
+
}, ve = Q(
|
|
42
42
|
(n, l) => {
|
|
43
43
|
var N;
|
|
44
44
|
const p = G(null), {
|
|
@@ -51,49 +51,50 @@ const {
|
|
|
51
51
|
onChange: b,
|
|
52
52
|
onBlur: A,
|
|
53
53
|
name: c,
|
|
54
|
-
value: E
|
|
54
|
+
value: E,
|
|
55
|
+
id: U
|
|
55
56
|
} = n, _ = G(!1), {
|
|
56
57
|
state: t,
|
|
57
58
|
dispatch: o,
|
|
58
59
|
inputRef: m,
|
|
59
60
|
getOptionLabelByValue: x,
|
|
60
61
|
listRef: w,
|
|
61
|
-
debouncedFilter:
|
|
62
|
-
} =
|
|
62
|
+
debouncedFilter: V
|
|
63
|
+
} = pe({
|
|
63
64
|
...n,
|
|
64
65
|
onChange: C(b, c)
|
|
65
66
|
});
|
|
66
|
-
|
|
67
|
-
E !== void 0 && (o({ type:
|
|
67
|
+
W(l, () => m.current), Y(() => {
|
|
68
|
+
E !== void 0 && (o({ type: ce, payload: E }), o({
|
|
68
69
|
type: R,
|
|
69
70
|
payload: x(f, E)
|
|
70
71
|
}), o({ type: v }));
|
|
71
72
|
}, [E]);
|
|
72
|
-
const
|
|
73
|
+
const H = (e) => {
|
|
73
74
|
o({ type: d, payload: e }), e || o({ type: v, payload: !1 });
|
|
74
|
-
},
|
|
75
|
-
o({ type:
|
|
76
|
-
}, j = (e) => {
|
|
77
|
-
o({ type: R, payload: e }), s && C(b, c)(e), e && o({ type: d, payload: !0 }), U(e);
|
|
75
|
+
}, j = () => {
|
|
76
|
+
o({ type: ie }), o({ type: d, payload: !1 }), C(b, c)("");
|
|
78
77
|
}, $ = (e) => {
|
|
78
|
+
o({ type: R, payload: e }), s && C(b, c)(e), e && o({ type: d, payload: !0 }), V(e);
|
|
79
|
+
}, K = (e) => {
|
|
79
80
|
const {
|
|
80
81
|
target: { value: a }
|
|
81
82
|
} = e;
|
|
82
|
-
e.__origin === "clear_button" ?
|
|
83
|
+
e.__origin === "clear_button" ? j() : $(a), o({ type: v }), setTimeout(() => {
|
|
83
84
|
var u;
|
|
84
85
|
return (u = m.current) == null ? void 0 : u.focus();
|
|
85
86
|
});
|
|
86
|
-
},
|
|
87
|
+
}, F = () => {
|
|
87
88
|
var e;
|
|
88
89
|
o({ type: d, payload: !t.isOpen }), (e = m.current) == null || e.focus();
|
|
89
|
-
},
|
|
90
|
+
}, X = () => {
|
|
90
91
|
t.isOpen || o({
|
|
91
92
|
type: d,
|
|
92
93
|
payload: !0
|
|
93
94
|
});
|
|
94
95
|
}, S = (e) => {
|
|
95
96
|
o({
|
|
96
|
-
type:
|
|
97
|
+
type: se,
|
|
97
98
|
payload: {
|
|
98
99
|
inputValue: x(f, e),
|
|
99
100
|
value: e
|
|
@@ -102,7 +103,7 @@ const {
|
|
|
102
103
|
var a;
|
|
103
104
|
M(A, c)(e), (a = m.current) == null || a.blur();
|
|
104
105
|
}, 0), y == null || y(e);
|
|
105
|
-
},
|
|
106
|
+
}, q = (e) => {
|
|
106
107
|
var i, I;
|
|
107
108
|
const { relatedTarget: a } = e;
|
|
108
109
|
if (a && ((i = w.current) != null && i.contains(a) || (I = p.current) != null && I.contains(a)) || _.current) {
|
|
@@ -111,7 +112,7 @@ const {
|
|
|
111
112
|
}
|
|
112
113
|
const u = t.value ?? t.inputValue ?? "";
|
|
113
114
|
M(A, c)(u);
|
|
114
|
-
},
|
|
115
|
+
}, z = (e) => {
|
|
115
116
|
const a = t.autocompleteOptions.length, u = (i, I) => {
|
|
116
117
|
let T = i;
|
|
117
118
|
for (let k = 0; k < a; k++)
|
|
@@ -134,21 +135,22 @@ const {
|
|
|
134
135
|
i && i.props.value && !i.props.disabled && S(i.props.value);
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ J(
|
|
138
139
|
"div",
|
|
139
140
|
{
|
|
140
141
|
"aria-disabled": r,
|
|
141
142
|
className: P("gi-autocomplete gi-not-prose", n.className),
|
|
142
143
|
children: [
|
|
143
144
|
/* @__PURE__ */ O(
|
|
144
|
-
|
|
145
|
+
oe,
|
|
145
146
|
{
|
|
147
|
+
id: U,
|
|
146
148
|
name: c,
|
|
147
|
-
onKeyDown:
|
|
148
|
-
onIconEndClick:
|
|
149
|
-
onChange:
|
|
150
|
-
onClick:
|
|
151
|
-
onBlur:
|
|
149
|
+
onKeyDown: z,
|
|
150
|
+
onIconEndClick: F,
|
|
151
|
+
onChange: K,
|
|
152
|
+
onClick: X,
|
|
153
|
+
onBlur: q,
|
|
152
154
|
clearButtonEnabled: t.isClearButtonEnabled,
|
|
153
155
|
inputActionPosition: "beforeSuffix",
|
|
154
156
|
"aria-label": D("autocomplete.placeholder", {
|
|
@@ -156,12 +158,12 @@ const {
|
|
|
156
158
|
}),
|
|
157
159
|
"aria-disabled": r,
|
|
158
160
|
disabled: r,
|
|
159
|
-
placeholder: h
|
|
161
|
+
placeholder: h ?? D("autocomplete.placeholder", { defaultValue: "Type to Search" }),
|
|
160
162
|
iconEndClassName: P({
|
|
161
163
|
"gi-cursor-pointer": !r && !s,
|
|
162
164
|
"gi-cursor-not-allowed gi-pointer-events-none": r && !s
|
|
163
165
|
}),
|
|
164
|
-
iconEnd: s ? void 0 :
|
|
166
|
+
iconEnd: s ? void 0 : ue(t.isOpen),
|
|
165
167
|
ref: m,
|
|
166
168
|
iconEndRef: p,
|
|
167
169
|
value: t.inputValue,
|
|
@@ -169,9 +171,9 @@ const {
|
|
|
169
171
|
}
|
|
170
172
|
),
|
|
171
173
|
/* @__PURE__ */ O(
|
|
172
|
-
|
|
174
|
+
ne,
|
|
173
175
|
{
|
|
174
|
-
onOpenChange:
|
|
176
|
+
onOpenChange: H,
|
|
175
177
|
triggerRef: m,
|
|
176
178
|
extraRefs: [p],
|
|
177
179
|
open: t.isOpen,
|
|
@@ -188,13 +190,13 @@ const {
|
|
|
188
190
|
]
|
|
189
191
|
},
|
|
190
192
|
children: /* @__PURE__ */ O(
|
|
191
|
-
|
|
193
|
+
le,
|
|
192
194
|
{
|
|
193
195
|
onChange: S,
|
|
194
196
|
isLoading: g,
|
|
195
197
|
showNoData: !((N = t.autocompleteOptions) != null && N.length),
|
|
196
198
|
ref: w,
|
|
197
|
-
children:
|
|
199
|
+
children: de(
|
|
198
200
|
t.autocompleteOptions,
|
|
199
201
|
t,
|
|
200
202
|
S
|
|
@@ -207,9 +209,9 @@ const {
|
|
|
207
209
|
}
|
|
208
210
|
);
|
|
209
211
|
}
|
|
210
|
-
),
|
|
212
|
+
), de = (n, l, p) => n.map((r, f) => {
|
|
211
213
|
if (l.optionType === "AutocompleteItem")
|
|
212
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ Z(
|
|
213
215
|
L,
|
|
214
216
|
{
|
|
215
217
|
...r.props,
|
|
@@ -220,7 +222,7 @@ const {
|
|
|
220
222
|
}
|
|
221
223
|
);
|
|
222
224
|
if (l.optionType === "AutocompleteGroupItem") {
|
|
223
|
-
const h = r, y =
|
|
225
|
+
const h = r, y = ee.toArray(h.props.children).filter((g) => te(g)).map((g) => {
|
|
224
226
|
const s = g.props;
|
|
225
227
|
return /* @__PURE__ */ O(
|
|
226
228
|
L,
|
|
@@ -234,7 +236,7 @@ const {
|
|
|
234
236
|
);
|
|
235
237
|
});
|
|
236
238
|
return /* @__PURE__ */ O(
|
|
237
|
-
|
|
239
|
+
re,
|
|
238
240
|
{
|
|
239
241
|
label: h.props.label,
|
|
240
242
|
children: y
|
|
@@ -243,21 +245,21 @@ const {
|
|
|
243
245
|
);
|
|
244
246
|
}
|
|
245
247
|
return null;
|
|
246
|
-
}),
|
|
247
|
-
Object.defineProperty(
|
|
248
|
+
}), fe = () => null;
|
|
249
|
+
Object.defineProperty(fe, "componentType", {
|
|
248
250
|
value: "AutocompleteItem",
|
|
249
251
|
writable: !1,
|
|
250
252
|
enumerable: !1
|
|
251
253
|
});
|
|
252
|
-
const
|
|
253
|
-
Object.defineProperty(
|
|
254
|
+
const me = () => null;
|
|
255
|
+
Object.defineProperty(me, "componentType", {
|
|
254
256
|
value: "AutocompleteGroupItem",
|
|
255
257
|
writable: !1,
|
|
256
258
|
enumerable: !1
|
|
257
259
|
});
|
|
258
260
|
export {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
ve as Autocomplete,
|
|
262
|
+
me as AutocompleteGroupItem,
|
|
263
|
+
fe as AutocompleteItem,
|
|
264
|
+
de as renderSelectMenuOptions
|
|
263
265
|
};
|