@pismo/marola 1.0.0-beta.31 → 1.0.0-beta.32
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/assets/Autocomplete.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/Skeleton.css +1 -1
- package/dist/assets/Table.css +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +185 -185
- package/dist/components/Input/Input.js +63 -63
- package/dist/components/Skeleton/Skeleton.js +3 -3
- package/dist/components/Table/Table.js +88 -88
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import * as h from "react";
|
|
|
4
4
|
import { useId as at, useState as ut, createElement as ct } from "react";
|
|
5
5
|
import { Icon as pt } from "../Icon/Icon.js";
|
|
6
6
|
import { Input as ft } from "../Input/Input.js";
|
|
7
|
-
import { b as
|
|
7
|
+
import { b as je, s as dt } from "../../useSlotProps-C_I1kEHr.js";
|
|
8
8
|
import { u as gt } from "../../useId-BW-oWmul.js";
|
|
9
9
|
import { u as _e } from "../../useControlled-CCMYYdCM.js";
|
|
10
10
|
import { u as ae } from "../../useEventCallback-BAQJJ3ye.js";
|
|
@@ -14,10 +14,10 @@ const ht = (c) => {
|
|
|
14
14
|
b.current = c;
|
|
15
15
|
}), b.current;
|
|
16
16
|
};
|
|
17
|
-
function
|
|
17
|
+
function Ve(c) {
|
|
18
18
|
return typeof c.normalize < "u" ? c.normalize("NFD").replace(/[\u0300-\u036f]/g, "") : c;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function mt(c = {}) {
|
|
21
21
|
const {
|
|
22
22
|
ignoreAccents: b = !0,
|
|
23
23
|
ignoreCase: g = !0,
|
|
@@ -28,15 +28,15 @@ function yt(c = {}) {
|
|
|
28
28
|
} = c;
|
|
29
29
|
return (N, {
|
|
30
30
|
inputValue: L,
|
|
31
|
-
getOptionLabel:
|
|
31
|
+
getOptionLabel: y
|
|
32
32
|
}) => {
|
|
33
33
|
let S = C ? L.trim() : L;
|
|
34
|
-
g && (S = S.toLowerCase()), b && (S =
|
|
35
|
-
const
|
|
36
|
-
let w = (v ||
|
|
37
|
-
return g && (w = w.toLowerCase()), b && (w =
|
|
34
|
+
g && (S = S.toLowerCase()), b && (S = Ve(S));
|
|
35
|
+
const q = S ? N.filter((z) => {
|
|
36
|
+
let w = (v || y)(z);
|
|
37
|
+
return g && (w = w.toLowerCase()), b && (w = Ve(w)), K === "start" ? w.indexOf(S) === 0 : w.indexOf(S) > -1;
|
|
38
38
|
}) : N;
|
|
39
|
-
return typeof D == "number" ?
|
|
39
|
+
return typeof D == "number" ? q.slice(0, D) : q;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
function ue(c, b) {
|
|
@@ -45,14 +45,14 @@ function ue(c, b) {
|
|
|
45
45
|
return g;
|
|
46
46
|
return -1;
|
|
47
47
|
}
|
|
48
|
-
const bt =
|
|
48
|
+
const bt = mt(), Me = 5, yt = (c) => {
|
|
49
49
|
var b;
|
|
50
50
|
return c.current !== null && ((b = c.current.parentElement) == null ? void 0 : b.contains(document.activeElement));
|
|
51
51
|
};
|
|
52
52
|
function xt(c) {
|
|
53
53
|
const {
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
55
|
-
unstable_isActiveElementInListbox: b =
|
|
55
|
+
unstable_isActiveElementInListbox: b = yt,
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
57
57
|
unstable_classNamePrefix: g = "Mui",
|
|
58
58
|
autoComplete: D = !1,
|
|
@@ -61,9 +61,9 @@ function xt(c) {
|
|
|
61
61
|
blurOnSelect: C = !1,
|
|
62
62
|
clearOnBlur: N = !c.freeSolo,
|
|
63
63
|
clearOnEscape: L = !1,
|
|
64
|
-
componentName:
|
|
64
|
+
componentName: y = "useAutocomplete",
|
|
65
65
|
defaultValue: S = c.multiple ? [] : null,
|
|
66
|
-
disableClearable:
|
|
66
|
+
disableClearable: q = !1,
|
|
67
67
|
disableCloseOnSelect: z = !1,
|
|
68
68
|
disabled: w,
|
|
69
69
|
disabledItemsFocusable: ce = !1,
|
|
@@ -71,9 +71,9 @@ function xt(c) {
|
|
|
71
71
|
filterOptions: pe = bt,
|
|
72
72
|
filterSelectedOptions: Q = !1,
|
|
73
73
|
freeSolo: i = !1,
|
|
74
|
-
getOptionDisabled:
|
|
75
|
-
getOptionKey:
|
|
76
|
-
getOptionLabel:
|
|
74
|
+
getOptionDisabled: m,
|
|
75
|
+
getOptionKey: j,
|
|
76
|
+
getOptionLabel: V = (t) => {
|
|
77
77
|
var e;
|
|
78
78
|
return (e = t.label) != null ? e : t;
|
|
79
79
|
},
|
|
@@ -81,44 +81,44 @@ function xt(c) {
|
|
|
81
81
|
handleHomeEndKeys: Z = !c.freeSolo,
|
|
82
82
|
id: fe,
|
|
83
83
|
includeInputInList: Oe = !1,
|
|
84
|
-
inputValue:
|
|
85
|
-
isOptionEqualToValue:
|
|
84
|
+
inputValue: Re,
|
|
85
|
+
isOptionEqualToValue: M = (t, e) => t === e,
|
|
86
86
|
multiple: u = !1,
|
|
87
87
|
onChange: Ie,
|
|
88
88
|
onClose: Se,
|
|
89
89
|
onHighlightChange: we,
|
|
90
|
-
onInputChange:
|
|
90
|
+
onInputChange: R,
|
|
91
91
|
onOpen: ke,
|
|
92
|
-
open:
|
|
93
|
-
openOnFocus:
|
|
92
|
+
open: He,
|
|
93
|
+
openOnFocus: Fe = !1,
|
|
94
94
|
options: de,
|
|
95
95
|
readOnly: W = !1,
|
|
96
|
-
selectOnFocus:
|
|
97
|
-
value:
|
|
96
|
+
selectOnFocus: qe = !c.freeSolo,
|
|
97
|
+
value: Be
|
|
98
98
|
} = c, E = gt(fe);
|
|
99
|
-
let O =
|
|
99
|
+
let O = V;
|
|
100
100
|
O = (t) => {
|
|
101
|
-
const e =
|
|
101
|
+
const e = V(t);
|
|
102
102
|
if (typeof e != "string") {
|
|
103
103
|
if (process.env.NODE_ENV !== "production") {
|
|
104
|
-
const
|
|
105
|
-
console.error(`MUI: The \`getOptionLabel\` method of ${
|
|
104
|
+
const r = e === void 0 ? "undefined" : `${typeof e} (${e})`;
|
|
105
|
+
console.error(`MUI: The \`getOptionLabel\` method of ${y} returned ${r} instead of a string for ${JSON.stringify(t)}.`);
|
|
106
106
|
}
|
|
107
107
|
return String(e);
|
|
108
108
|
}
|
|
109
109
|
return e;
|
|
110
110
|
};
|
|
111
|
-
const ge = h.useRef(!1), he = h.useRef(!0), f = h.useRef(null), T = h.useRef(null), [ee,
|
|
112
|
-
controlled:
|
|
111
|
+
const ge = h.useRef(!1), he = h.useRef(!0), f = h.useRef(null), T = h.useRef(null), [ee, Ue] = h.useState(null), [$, me] = h.useState(-1), Ee = K ? 0 : -1, x = h.useRef(Ee), [o, Ke] = _e({
|
|
112
|
+
controlled: Be,
|
|
113
113
|
default: S,
|
|
114
|
-
name:
|
|
114
|
+
name: y
|
|
115
115
|
}), [a, te] = _e({
|
|
116
|
-
controlled:
|
|
116
|
+
controlled: Re,
|
|
117
117
|
default: "",
|
|
118
|
-
name:
|
|
118
|
+
name: y,
|
|
119
119
|
state: "inputValue"
|
|
120
|
-
}), [
|
|
121
|
-
if (!(u ?
|
|
120
|
+
}), [re, Te] = h.useState(!1), oe = h.useCallback((t, e) => {
|
|
121
|
+
if (!(u ? o.length < e.length : e !== null) && !N)
|
|
122
122
|
return;
|
|
123
123
|
let n;
|
|
124
124
|
if (u)
|
|
@@ -129,14 +129,14 @@ function xt(c) {
|
|
|
129
129
|
const s = O(e);
|
|
130
130
|
n = typeof s == "string" ? s : "";
|
|
131
131
|
}
|
|
132
|
-
a !== n && (te(n),
|
|
133
|
-
}, [O, a, u,
|
|
134
|
-
controlled:
|
|
132
|
+
a !== n && (te(n), R && R(t, n, "reset"));
|
|
133
|
+
}, [O, a, u, R, te, N, o]), [B, $e] = _e({
|
|
134
|
+
controlled: He,
|
|
135
135
|
default: !1,
|
|
136
|
-
name:
|
|
136
|
+
name: y,
|
|
137
137
|
state: "open"
|
|
138
|
-
}), [ze, Pe] = h.useState(!0), Ae = !u &&
|
|
139
|
-
de.filter((t) => !(Q && (u ?
|
|
138
|
+
}), [ze, Pe] = h.useState(!0), Ae = !u && o != null && a === O(o), k = B && !W, p = k ? pe(
|
|
139
|
+
de.filter((t) => !(Q && (u ? o : [o]).some((e) => e !== null && M(t, e)))),
|
|
140
140
|
// we use the empty string to manipulate `filterOptions` to not filter any options
|
|
141
141
|
// i.e. the filter predicate always returns true
|
|
142
142
|
{
|
|
@@ -145,43 +145,43 @@ function xt(c) {
|
|
|
145
145
|
}
|
|
146
146
|
) : [], P = ht({
|
|
147
147
|
filteredOptions: p,
|
|
148
|
-
value:
|
|
148
|
+
value: o,
|
|
149
149
|
inputValue: a
|
|
150
150
|
});
|
|
151
151
|
h.useEffect(() => {
|
|
152
|
-
const t =
|
|
153
|
-
|
|
154
|
-
}, [
|
|
155
|
-
const be =
|
|
156
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
157
|
-
const t = (u ?
|
|
158
|
-
t.length > 0 && console.warn([`MUI: The value provided to ${
|
|
152
|
+
const t = o !== P.value;
|
|
153
|
+
re && !t || i && !t || oe(null, o);
|
|
154
|
+
}, [o, oe, re, P.value, i]);
|
|
155
|
+
const be = B && p.length > 0 && !W;
|
|
156
|
+
if (process.env.NODE_ENV !== "production" && o !== null && !i && de.length > 0) {
|
|
157
|
+
const t = (u ? o : [o]).filter((e) => !de.some((r) => M(r, e)));
|
|
158
|
+
t.length > 0 && console.warn([`MUI: The value provided to ${y} is invalid.`, `None of the options match with \`${t.length > 1 ? JSON.stringify(t) : JSON.stringify(t[0])}\`.`, "You can use the `isOptionEqualToValue` prop to customize the equality test."].join(`
|
|
159
159
|
`));
|
|
160
160
|
}
|
|
161
161
|
const ne = ae((t) => {
|
|
162
162
|
t === -1 ? f.current.focus() : ee.querySelector(`[data-tag-index="${t}"]`).focus();
|
|
163
163
|
});
|
|
164
164
|
h.useEffect(() => {
|
|
165
|
-
u && $ >
|
|
166
|
-
}, [
|
|
165
|
+
u && $ > o.length - 1 && (me(-1), ne(-1));
|
|
166
|
+
}, [o, u, $, ne]);
|
|
167
167
|
function Je(t, e) {
|
|
168
168
|
if (!T.current || t < 0 || t >= p.length)
|
|
169
169
|
return -1;
|
|
170
|
-
let
|
|
170
|
+
let r = t;
|
|
171
171
|
for (; ; ) {
|
|
172
|
-
const n = T.current.querySelector(`[data-option-index="${
|
|
172
|
+
const n = T.current.querySelector(`[data-option-index="${r}"]`), s = ce ? !1 : !n || n.disabled || n.getAttribute("aria-disabled") === "true";
|
|
173
173
|
if (n && n.hasAttribute("tabindex") && !s)
|
|
174
|
-
return
|
|
175
|
-
if (e === "next" ?
|
|
174
|
+
return r;
|
|
175
|
+
if (e === "next" ? r = (r + 1) % p.length : r = (r - 1 + p.length) % p.length, r === t)
|
|
176
176
|
return -1;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const H = ae(({
|
|
180
180
|
event: t,
|
|
181
181
|
index: e,
|
|
182
|
-
reason:
|
|
182
|
+
reason: r = "auto"
|
|
183
183
|
}) => {
|
|
184
|
-
if (x.current = e, e === -1 ? f.current.removeAttribute("aria-activedescendant") : f.current.setAttribute("aria-activedescendant", `${E}-option-${e}`), we && we(t, e === -1 ? null : p[e],
|
|
184
|
+
if (x.current = e, e === -1 ? f.current.removeAttribute("aria-activedescendant") : f.current.setAttribute("aria-activedescendant", `${E}-option-${e}`), we && we(t, e === -1 ? null : p[e], r), !T.current)
|
|
185
185
|
return;
|
|
186
186
|
const n = T.current.querySelector(`[role="option"].${g}-focused`);
|
|
187
187
|
n && (n.classList.remove(`${g}-focused`), n.classList.remove(`${g}-focusVisible`));
|
|
@@ -193,14 +193,14 @@ function xt(c) {
|
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
const l = T.current.querySelector(`[data-option-index="${e}"]`);
|
|
196
|
-
if (l && (l.classList.add(`${g}-focused`),
|
|
196
|
+
if (l && (l.classList.add(`${g}-focused`), r === "keyboard" && l.classList.add(`${g}-focusVisible`), s.scrollHeight > s.clientHeight && r !== "mouse" && r !== "touch")) {
|
|
197
197
|
const d = l, I = s.clientHeight + s.scrollTop, ie = d.offsetTop + d.offsetHeight;
|
|
198
198
|
ie > I ? s.scrollTop = ie - s.clientHeight : d.offsetTop - d.offsetHeight * (_ ? 1.3 : 0) < s.scrollTop && (s.scrollTop = d.offsetTop - d.offsetHeight * (_ ? 1.3 : 0));
|
|
199
199
|
}
|
|
200
200
|
}), A = ae(({
|
|
201
201
|
event: t,
|
|
202
202
|
diff: e,
|
|
203
|
-
direction:
|
|
203
|
+
direction: r = "next",
|
|
204
204
|
reason: n = "auto"
|
|
205
205
|
}) => {
|
|
206
206
|
if (!k)
|
|
@@ -215,8 +215,8 @@ function xt(c) {
|
|
|
215
215
|
return d;
|
|
216
216
|
const I = x.current + e;
|
|
217
217
|
return I < 0 ? I === -1 && Oe ? -1 : J && x.current !== -1 || Math.abs(e) > 1 ? 0 : d : I > d ? I === d + 1 && Oe ? -1 : J || Math.abs(e) > 1 ? d : 0 : I;
|
|
218
|
-
})(),
|
|
219
|
-
if (
|
|
218
|
+
})(), r);
|
|
219
|
+
if (H({
|
|
220
220
|
index: l,
|
|
221
221
|
reason: n,
|
|
222
222
|
event: t
|
|
@@ -228,17 +228,17 @@ function xt(c) {
|
|
|
228
228
|
f.current.value = d, d.toLowerCase().indexOf(a.toLowerCase()) === 0 && a.length > 0 && f.current.setSelectionRange(a.length, d.length);
|
|
229
229
|
}
|
|
230
230
|
}), We = () => {
|
|
231
|
-
const t = (e,
|
|
232
|
-
const n = e ? O(e) : "", s =
|
|
231
|
+
const t = (e, r) => {
|
|
232
|
+
const n = e ? O(e) : "", s = r ? O(r) : "";
|
|
233
233
|
return n === s;
|
|
234
234
|
};
|
|
235
|
-
if (x.current !== -1 && P.filteredOptions && P.filteredOptions.length !== p.length && P.inputValue === a && (u ?
|
|
235
|
+
if (x.current !== -1 && P.filteredOptions && P.filteredOptions.length !== p.length && P.inputValue === a && (u ? o.length === P.value.length && P.value.every((e, r) => O(o[r]) === O(e)) : t(P.value, o))) {
|
|
236
236
|
const e = P.filteredOptions[x.current];
|
|
237
237
|
if (e)
|
|
238
|
-
return ue(p, (
|
|
238
|
+
return ue(p, (r) => O(r) === O(e));
|
|
239
239
|
}
|
|
240
240
|
return -1;
|
|
241
|
-
},
|
|
241
|
+
}, ye = h.useCallback(() => {
|
|
242
242
|
if (!k)
|
|
243
243
|
return;
|
|
244
244
|
const t = We();
|
|
@@ -246,7 +246,7 @@ function xt(c) {
|
|
|
246
246
|
x.current = t;
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
const e = u ?
|
|
249
|
+
const e = u ? o[0] : o;
|
|
250
250
|
if (p.length === 0 || e == null) {
|
|
251
251
|
A({
|
|
252
252
|
diff: "reset"
|
|
@@ -255,24 +255,24 @@ function xt(c) {
|
|
|
255
255
|
}
|
|
256
256
|
if (T.current) {
|
|
257
257
|
if (e != null) {
|
|
258
|
-
const
|
|
259
|
-
if (u &&
|
|
258
|
+
const r = p[x.current];
|
|
259
|
+
if (u && r && ue(o, (s) => M(r, s)) !== -1)
|
|
260
260
|
return;
|
|
261
|
-
const n = ue(p, (s) =>
|
|
261
|
+
const n = ue(p, (s) => M(s, e));
|
|
262
262
|
n === -1 ? A({
|
|
263
263
|
diff: "reset"
|
|
264
|
-
}) :
|
|
264
|
+
}) : H({
|
|
265
265
|
index: n
|
|
266
266
|
});
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
269
|
if (x.current >= p.length - 1) {
|
|
270
|
-
|
|
270
|
+
H({
|
|
271
271
|
index: p.length - 1
|
|
272
272
|
});
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
|
|
275
|
+
H({
|
|
276
276
|
index: x.current
|
|
277
277
|
});
|
|
278
278
|
}
|
|
@@ -281,73 +281,73 @@ function xt(c) {
|
|
|
281
281
|
p.length,
|
|
282
282
|
// Don't sync the highlighted index with the value when multiple
|
|
283
283
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
284
|
-
u ? !1 :
|
|
284
|
+
u ? !1 : o,
|
|
285
285
|
Q,
|
|
286
286
|
A,
|
|
287
|
-
|
|
287
|
+
H,
|
|
288
288
|
k,
|
|
289
289
|
a,
|
|
290
290
|
u
|
|
291
291
|
]), Ye = ae((t) => {
|
|
292
|
-
dt(T, t), t &&
|
|
292
|
+
dt(T, t), t && ye();
|
|
293
293
|
});
|
|
294
294
|
process.env.NODE_ENV !== "production" && h.useEffect(() => {
|
|
295
|
-
(!f.current || f.current.nodeName !== "INPUT") && (f.current && f.current.nodeName === "TEXTAREA" ? console.warn([`A textarea element was provided to ${
|
|
296
|
-
`)) : console.error([`MUI: Unable to find the input element. It was resolved to ${f.current} while an HTMLInputElement was expected.`, `Instead, ${
|
|
295
|
+
(!f.current || f.current.nodeName !== "INPUT") && (f.current && f.current.nodeName === "TEXTAREA" ? console.warn([`A textarea element was provided to ${y} where input was expected.`, "This is not a supported scenario but it may work under certain conditions.", "A textarea keyboard navigation may conflict with Autocomplete controls (for example enter and arrow keys).", "Make sure to test keyboard navigation and add custom event handlers if necessary."].join(`
|
|
296
|
+
`)) : console.error([`MUI: Unable to find the input element. It was resolved to ${f.current} while an HTMLInputElement was expected.`, `Instead, ${y} expects an input element.`, "", y === "useAutocomplete" ? "Make sure you have bound getInputProps correctly and that the normal ref/effect resolutions order is guaranteed." : "Make sure you have customized the input component correctly."].join(`
|
|
297
297
|
`)));
|
|
298
|
-
}, [
|
|
299
|
-
|
|
300
|
-
}, [
|
|
301
|
-
const
|
|
302
|
-
|
|
298
|
+
}, [y]), h.useEffect(() => {
|
|
299
|
+
ye();
|
|
300
|
+
}, [ye]);
|
|
301
|
+
const F = (t) => {
|
|
302
|
+
B || ($e(!0), Pe(!0), ke && ke(t));
|
|
303
303
|
}, Y = (t, e) => {
|
|
304
|
-
|
|
305
|
-
},
|
|
304
|
+
B && ($e(!1), Se && Se(t, e));
|
|
305
|
+
}, U = (t, e, r, n) => {
|
|
306
306
|
if (u) {
|
|
307
|
-
if (
|
|
307
|
+
if (o.length === e.length && o.every((s, l) => s === e[l]))
|
|
308
308
|
return;
|
|
309
|
-
} else if (
|
|
309
|
+
} else if (o === e)
|
|
310
310
|
return;
|
|
311
|
-
Ie && Ie(t, e,
|
|
312
|
-
}, se = h.useRef(!1), X = (t, e,
|
|
313
|
-
let s =
|
|
311
|
+
Ie && Ie(t, e, r, n), Ke(e);
|
|
312
|
+
}, se = h.useRef(!1), X = (t, e, r = "selectOption", n = "options") => {
|
|
313
|
+
let s = r, l = e;
|
|
314
314
|
if (u) {
|
|
315
|
-
if (l = Array.isArray(
|
|
316
|
-
const I = l.filter((ie) =>
|
|
317
|
-
I.length > 1 && console.error([`MUI: The \`isOptionEqualToValue\` method of ${
|
|
315
|
+
if (l = Array.isArray(o) ? o.slice() : [], process.env.NODE_ENV !== "production") {
|
|
316
|
+
const I = l.filter((ie) => M(e, ie));
|
|
317
|
+
I.length > 1 && console.error([`MUI: The \`isOptionEqualToValue\` method of ${y} does not handle the arguments correctly.`, `The component expects a single value to match a given option but found ${I.length} matches.`].join(`
|
|
318
318
|
`));
|
|
319
319
|
}
|
|
320
|
-
const d = ue(l, (I) =>
|
|
320
|
+
const d = ue(l, (I) => M(e, I));
|
|
321
321
|
d === -1 ? l.push(e) : n !== "freeSolo" && (l.splice(d, 1), s = "removeOption");
|
|
322
322
|
}
|
|
323
|
-
|
|
323
|
+
oe(t, l), U(t, l, s, {
|
|
324
324
|
option: e
|
|
325
325
|
}), !z && (!t || !t.ctrlKey && !t.metaKey) && Y(t, s), (C === !0 || C === "touch" && se.current || C === "mouse" && !se.current) && f.current.blur();
|
|
326
326
|
};
|
|
327
327
|
function Xe(t, e) {
|
|
328
328
|
if (t === -1)
|
|
329
329
|
return -1;
|
|
330
|
-
let
|
|
330
|
+
let r = t;
|
|
331
331
|
for (; ; ) {
|
|
332
|
-
if (e === "next" &&
|
|
332
|
+
if (e === "next" && r === o.length || e === "previous" && r === -1)
|
|
333
333
|
return -1;
|
|
334
|
-
const n = ee.querySelector(`[data-tag-index="${
|
|
334
|
+
const n = ee.querySelector(`[data-tag-index="${r}"]`);
|
|
335
335
|
if (!n || !n.hasAttribute("tabindex") || n.disabled || n.getAttribute("aria-disabled") === "true")
|
|
336
|
-
|
|
336
|
+
r += e === "next" ? 1 : -1;
|
|
337
337
|
else
|
|
338
|
-
return
|
|
338
|
+
return r;
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
const De = (t, e) => {
|
|
342
342
|
if (!u)
|
|
343
343
|
return;
|
|
344
344
|
a === "" && Y(t, "toggleInput");
|
|
345
|
-
let
|
|
346
|
-
$ === -1 ? a === "" && e === "previous" && (
|
|
345
|
+
let r = $;
|
|
346
|
+
$ === -1 ? a === "" && e === "previous" && (r = o.length - 1) : (r += e === "next" ? 1 : -1, r < 0 && (r = 0), r === o.length && (r = -1)), r = Xe(r, e), me(r), ne(r);
|
|
347
347
|
}, Ce = (t) => {
|
|
348
|
-
ge.current = !0, te(""),
|
|
348
|
+
ge.current = !0, te(""), R && R(t, "", "clear"), U(t, u ? [] : null, "clear");
|
|
349
349
|
}, Ge = (t) => (e) => {
|
|
350
|
-
if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && ($ !== -1 && ["ArrowLeft", "ArrowRight"].indexOf(e.key) === -1 && (
|
|
350
|
+
if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && ($ !== -1 && ["ArrowLeft", "ArrowRight"].indexOf(e.key) === -1 && (me(-1), ne(-1)), e.which !== 229))
|
|
351
351
|
switch (e.key) {
|
|
352
352
|
case "Home":
|
|
353
353
|
k && Z && (e.preventDefault(), A({
|
|
@@ -367,19 +367,19 @@ function xt(c) {
|
|
|
367
367
|
break;
|
|
368
368
|
case "PageUp":
|
|
369
369
|
e.preventDefault(), A({
|
|
370
|
-
diff: -
|
|
370
|
+
diff: -Me,
|
|
371
371
|
direction: "previous",
|
|
372
372
|
reason: "keyboard",
|
|
373
373
|
event: e
|
|
374
|
-
}),
|
|
374
|
+
}), F(e);
|
|
375
375
|
break;
|
|
376
376
|
case "PageDown":
|
|
377
377
|
e.preventDefault(), A({
|
|
378
|
-
diff:
|
|
378
|
+
diff: Me,
|
|
379
379
|
direction: "next",
|
|
380
380
|
reason: "keyboard",
|
|
381
381
|
event: e
|
|
382
|
-
}),
|
|
382
|
+
}), F(e);
|
|
383
383
|
break;
|
|
384
384
|
case "ArrowDown":
|
|
385
385
|
e.preventDefault(), A({
|
|
@@ -387,7 +387,7 @@ function xt(c) {
|
|
|
387
387
|
direction: "next",
|
|
388
388
|
reason: "keyboard",
|
|
389
389
|
event: e
|
|
390
|
-
}),
|
|
390
|
+
}), F(e);
|
|
391
391
|
break;
|
|
392
392
|
case "ArrowUp":
|
|
393
393
|
e.preventDefault(), A({
|
|
@@ -395,7 +395,7 @@ function xt(c) {
|
|
|
395
395
|
direction: "previous",
|
|
396
396
|
reason: "keyboard",
|
|
397
397
|
event: e
|
|
398
|
-
}),
|
|
398
|
+
}), F(e);
|
|
399
399
|
break;
|
|
400
400
|
case "ArrowLeft":
|
|
401
401
|
De(e, "previous");
|
|
@@ -405,92 +405,92 @@ function xt(c) {
|
|
|
405
405
|
break;
|
|
406
406
|
case "Enter":
|
|
407
407
|
if (x.current !== -1 && k) {
|
|
408
|
-
const
|
|
408
|
+
const r = p[x.current], n = m ? m(r) : !1;
|
|
409
409
|
if (e.preventDefault(), n)
|
|
410
410
|
return;
|
|
411
|
-
X(e,
|
|
411
|
+
X(e, r, "selectOption"), D && f.current.setSelectionRange(f.current.value.length, f.current.value.length);
|
|
412
412
|
} else
|
|
413
413
|
i && a !== "" && Ae === !1 && (u && e.preventDefault(), X(e, a, "createOption", "freeSolo"));
|
|
414
414
|
break;
|
|
415
415
|
case "Escape":
|
|
416
|
-
k ? (e.preventDefault(), e.stopPropagation(), Y(e, "escape")) : L && (a !== "" || u &&
|
|
416
|
+
k ? (e.preventDefault(), e.stopPropagation(), Y(e, "escape")) : L && (a !== "" || u && o.length > 0) && (e.preventDefault(), e.stopPropagation(), Ce(e));
|
|
417
417
|
break;
|
|
418
418
|
case "Backspace":
|
|
419
|
-
if (u && !W && a === "" &&
|
|
420
|
-
const
|
|
421
|
-
n.splice(
|
|
422
|
-
option: r
|
|
419
|
+
if (u && !W && a === "" && o.length > 0) {
|
|
420
|
+
const r = $ === -1 ? o.length - 1 : $, n = o.slice();
|
|
421
|
+
n.splice(r, 1), U(e, n, "removeOption", {
|
|
422
|
+
option: o[r]
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
break;
|
|
426
426
|
case "Delete":
|
|
427
|
-
if (u && !W && a === "" &&
|
|
428
|
-
const
|
|
429
|
-
n.splice(
|
|
430
|
-
option: r
|
|
427
|
+
if (u && !W && a === "" && o.length > 0 && $ !== -1) {
|
|
428
|
+
const r = $, n = o.slice();
|
|
429
|
+
n.splice(r, 1), U(e, n, "removeOption", {
|
|
430
|
+
option: o[r]
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
break;
|
|
434
434
|
}
|
|
435
435
|
}, Qe = (t) => {
|
|
436
|
-
Te(!0),
|
|
436
|
+
Te(!0), Fe && !ge.current && F(t);
|
|
437
437
|
}, Ne = (t) => {
|
|
438
438
|
if (b(T)) {
|
|
439
439
|
f.current.focus();
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
|
-
Te(!1), he.current = !0, ge.current = !1, v && x.current !== -1 && k ? X(t, p[x.current], "blur") : v && i && a !== "" ? X(t, a, "blur", "freeSolo") : N &&
|
|
442
|
+
Te(!1), he.current = !0, ge.current = !1, v && x.current !== -1 && k ? X(t, p[x.current], "blur") : v && i && a !== "" ? X(t, a, "blur", "freeSolo") : N && oe(t, o), Y(t, "blur");
|
|
443
443
|
}, Ze = (t) => {
|
|
444
444
|
const e = t.target.value;
|
|
445
|
-
a !== e && (te(e), Pe(!1),
|
|
445
|
+
a !== e && (te(e), Pe(!1), R && R(t, e, "input")), e === "" ? !q && !u && U(t, null, "clear") : F(t);
|
|
446
446
|
}, et = (t) => {
|
|
447
447
|
const e = Number(t.currentTarget.getAttribute("data-option-index"));
|
|
448
|
-
x.current !== e &&
|
|
448
|
+
x.current !== e && H({
|
|
449
449
|
event: t,
|
|
450
450
|
index: e,
|
|
451
451
|
reason: "mouse"
|
|
452
452
|
});
|
|
453
453
|
}, tt = (t) => {
|
|
454
|
-
|
|
454
|
+
H({
|
|
455
455
|
event: t,
|
|
456
456
|
index: Number(t.currentTarget.getAttribute("data-option-index")),
|
|
457
457
|
reason: "touch"
|
|
458
458
|
}), se.current = !0;
|
|
459
|
-
},
|
|
459
|
+
}, rt = (t) => {
|
|
460
460
|
const e = Number(t.currentTarget.getAttribute("data-option-index"));
|
|
461
461
|
X(t, p[e], "selectOption"), se.current = !1;
|
|
462
|
-
},
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
option:
|
|
462
|
+
}, ot = (t) => (e) => {
|
|
463
|
+
const r = o.slice();
|
|
464
|
+
r.splice(t, 1), U(e, r, "removeOption", {
|
|
465
|
+
option: o[t]
|
|
466
466
|
});
|
|
467
467
|
}, ve = (t) => {
|
|
468
|
-
|
|
468
|
+
B ? Y(t, "toggleInput") : F(t);
|
|
469
469
|
}, nt = (t) => {
|
|
470
470
|
t.currentTarget.contains(t.target) && t.target.getAttribute("id") !== E && t.preventDefault();
|
|
471
471
|
}, st = (t) => {
|
|
472
|
-
t.currentTarget.contains(t.target) && (f.current.focus(),
|
|
472
|
+
t.currentTarget.contains(t.target) && (f.current.focus(), qe && he.current && f.current.selectionEnd - f.current.selectionStart === 0 && f.current.select(), he.current = !1);
|
|
473
473
|
}, it = (t) => {
|
|
474
|
-
!w && (a === "" || !
|
|
474
|
+
!w && (a === "" || !B) && ve(t);
|
|
475
475
|
};
|
|
476
476
|
let xe = i && a.length > 0;
|
|
477
|
-
xe = xe || (u ?
|
|
477
|
+
xe = xe || (u ? o.length > 0 : o !== null);
|
|
478
478
|
let Le = p;
|
|
479
479
|
if (_) {
|
|
480
480
|
const t = /* @__PURE__ */ new Map();
|
|
481
481
|
let e = !1;
|
|
482
|
-
Le = p.reduce((
|
|
482
|
+
Le = p.reduce((r, n, s) => {
|
|
483
483
|
const l = _(n);
|
|
484
|
-
return
|
|
484
|
+
return r.length > 0 && r[r.length - 1].group === l ? r[r.length - 1].options.push(n) : (process.env.NODE_ENV !== "production" && (t.get(l) && !e && (console.warn(`MUI: The options provided combined with the \`groupBy\` method of ${y} returns duplicated headers.`, "You can solve the issue by sorting the options with the output of `groupBy`."), e = !0), t.set(l, !0)), r.push({
|
|
485
485
|
key: s,
|
|
486
486
|
index: s,
|
|
487
487
|
group: l,
|
|
488
488
|
options: [n]
|
|
489
|
-
})),
|
|
489
|
+
})), r;
|
|
490
490
|
}, []);
|
|
491
491
|
}
|
|
492
|
-
return w &&
|
|
493
|
-
getRootProps: (t = {}) =>
|
|
492
|
+
return w && re && Ne(), {
|
|
493
|
+
getRootProps: (t = {}) => je({
|
|
494
494
|
"aria-owns": be ? `${E}-listbox` : null
|
|
495
495
|
}, t, {
|
|
496
496
|
onKeyDown: Ge(t),
|
|
@@ -535,12 +535,12 @@ function xt(c) {
|
|
|
535
535
|
}),
|
|
536
536
|
getTagProps: ({
|
|
537
537
|
index: t
|
|
538
|
-
}) =>
|
|
538
|
+
}) => je({
|
|
539
539
|
key: t,
|
|
540
540
|
"data-tag-index": t,
|
|
541
541
|
tabIndex: -1
|
|
542
542
|
}, !W && {
|
|
543
|
-
onDelete:
|
|
543
|
+
onDelete: ot(t)
|
|
544
544
|
}),
|
|
545
545
|
getListboxProps: () => ({
|
|
546
546
|
role: "listbox",
|
|
@@ -555,15 +555,15 @@ function xt(c) {
|
|
|
555
555
|
index: t,
|
|
556
556
|
option: e
|
|
557
557
|
}) => {
|
|
558
|
-
var
|
|
559
|
-
const n = (u ?
|
|
558
|
+
var r;
|
|
559
|
+
const n = (u ? o : [o]).some((l) => l != null && M(e, l)), s = m ? m(e) : !1;
|
|
560
560
|
return {
|
|
561
|
-
key: (
|
|
561
|
+
key: (r = j == null ? void 0 : j(e)) != null ? r : O(e),
|
|
562
562
|
tabIndex: -1,
|
|
563
563
|
role: "option",
|
|
564
564
|
id: `${E}-option-${t}`,
|
|
565
565
|
onMouseMove: et,
|
|
566
|
-
onClick:
|
|
566
|
+
onClick: rt,
|
|
567
567
|
onTouchStart: tt,
|
|
568
568
|
"data-option-index": t,
|
|
569
569
|
"aria-disabled": s,
|
|
@@ -572,37 +572,37 @@ function xt(c) {
|
|
|
572
572
|
},
|
|
573
573
|
id: E,
|
|
574
574
|
inputValue: a,
|
|
575
|
-
value:
|
|
575
|
+
value: o,
|
|
576
576
|
dirty: xe,
|
|
577
577
|
expanded: k && ee,
|
|
578
578
|
popupOpen: k,
|
|
579
|
-
focused:
|
|
579
|
+
focused: re || $ !== -1,
|
|
580
580
|
anchorEl: ee,
|
|
581
|
-
setAnchorEl:
|
|
581
|
+
setAnchorEl: Ue,
|
|
582
582
|
focusedTag: $,
|
|
583
583
|
groupedOptions: Le
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
|
-
const _t = "
|
|
587
|
-
"u-typography-h1": "_u-typography-
|
|
588
|
-
"u-typography-h2": "_u-typography-
|
|
589
|
-
"u-typography-h3": "_u-typography-
|
|
590
|
-
"u-typography-h4": "_u-typography-
|
|
591
|
-
"u-typography-h5": "_u-typography-
|
|
592
|
-
"u-typography-h6": "_u-typography-
|
|
593
|
-
"u-typography-base": "_u-typography-
|
|
594
|
-
"u-typography-base--xxl": "_u-typography-base--
|
|
595
|
-
"u-typography-base--xl": "_u-typography-base--
|
|
596
|
-
"u-typography-base--lg": "_u-typography-base--
|
|
597
|
-
"u-typography-base--sm": "_u-typography-base--
|
|
598
|
-
"u-typography-base--bold": "_u-typography-base--
|
|
599
|
-
"autocomplete__dropdown-item": "_autocomplete__dropdown-
|
|
600
|
-
"u-typography-base--strikethrough": "_u-typography-base--
|
|
601
|
-
"u-typography-base--underlined": "_u-typography-base--
|
|
602
|
-
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-
|
|
586
|
+
const _t = "_autocomplete_mj65r_65", G = {
|
|
587
|
+
"u-typography-h1": "_u-typography-h1_mj65r_1",
|
|
588
|
+
"u-typography-h2": "_u-typography-h2_mj65r_8",
|
|
589
|
+
"u-typography-h3": "_u-typography-h3_mj65r_15",
|
|
590
|
+
"u-typography-h4": "_u-typography-h4_mj65r_22",
|
|
591
|
+
"u-typography-h5": "_u-typography-h5_mj65r_29",
|
|
592
|
+
"u-typography-h6": "_u-typography-h6_mj65r_36",
|
|
593
|
+
"u-typography-base": "_u-typography-base_mj65r_43",
|
|
594
|
+
"u-typography-base--xxl": "_u-typography-base--xxl_mj65r_49",
|
|
595
|
+
"u-typography-base--xl": "_u-typography-base--xl_mj65r_53",
|
|
596
|
+
"u-typography-base--lg": "_u-typography-base--lg_mj65r_57",
|
|
597
|
+
"u-typography-base--sm": "_u-typography-base--sm_mj65r_61",
|
|
598
|
+
"u-typography-base--bold": "_u-typography-base--bold_mj65r_65",
|
|
599
|
+
"autocomplete__dropdown-item": "_autocomplete__dropdown-item_mj65r_65",
|
|
600
|
+
"u-typography-base--strikethrough": "_u-typography-base--strikethrough_mj65r_68",
|
|
601
|
+
"u-typography-base--underlined": "_u-typography-base--underlined_mj65r_71",
|
|
602
|
+
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_mj65r_74",
|
|
603
603
|
autocomplete: _t,
|
|
604
|
-
"autocomplete__dropdown-list": "_autocomplete__dropdown-
|
|
605
|
-
"option-focused": "_option-
|
|
604
|
+
"autocomplete__dropdown-list": "_autocomplete__dropdown-list_mj65r_82",
|
|
605
|
+
"option-focused": "_option-focused_mj65r_106"
|
|
606
606
|
}, Pt = ({
|
|
607
607
|
labelKey: c,
|
|
608
608
|
valueKey: b,
|
|
@@ -614,28 +614,28 @@ const _t = "_autocomplete_164gy_65", G = {
|
|
|
614
614
|
"data-testid-wrapper": N,
|
|
615
615
|
...L
|
|
616
616
|
}) => {
|
|
617
|
-
const
|
|
617
|
+
const y = at(), [S, q] = ut("");
|
|
618
618
|
g != null && g.some((i) => typeof i != "string") && (!c || !b) && console.error(
|
|
619
619
|
'[autocomplete] When options is a list of objects, you must provide the "labelKey" and "valueKey" parameters.'
|
|
620
620
|
);
|
|
621
621
|
const { getRootProps: z, getInputProps: w, getOptionProps: ce, groupedOptions: J, getListboxProps: pe } = xt({
|
|
622
|
-
id: `autocomplete_${
|
|
622
|
+
id: `autocomplete_${y}`,
|
|
623
623
|
options: g,
|
|
624
624
|
getOptionLabel: (i) => typeof i == "string" ? i : String(i[c || "label"]),
|
|
625
625
|
value: K,
|
|
626
626
|
inputValue: S,
|
|
627
|
-
isOptionEqualToValue: (i,
|
|
628
|
-
onChange: (i,
|
|
629
|
-
v && v(i,
|
|
627
|
+
isOptionEqualToValue: (i, m) => typeof i == "string" ? String(i) === String(m) : String(i[b || "id"]) === String(m[b || "id"]),
|
|
628
|
+
onChange: (i, m) => {
|
|
629
|
+
v && v(i, m);
|
|
630
630
|
},
|
|
631
|
-
onInputChange: (i,
|
|
632
|
-
C && C(i,
|
|
631
|
+
onInputChange: (i, m) => {
|
|
632
|
+
C && C(i, m), q(m);
|
|
633
633
|
},
|
|
634
|
-
onHighlightChange: (i,
|
|
635
|
-
var
|
|
636
|
-
if (
|
|
634
|
+
onHighlightChange: (i, m, j) => {
|
|
635
|
+
var V;
|
|
636
|
+
if (j === "keyboard") {
|
|
637
637
|
const _ = document.querySelector("#autocomplete-list"), Z = (i == null ? void 0 : i.target).getAttribute("aria-activedescendant");
|
|
638
|
-
_ == null || _.querySelectorAll("li").forEach((fe) => fe.classList.remove(G["option-focused"])), (
|
|
638
|
+
_ == null || _.querySelectorAll("li").forEach((fe) => fe.classList.remove(G["option-focused"])), (V = _ == null ? void 0 : _.querySelector(`[id="${Z}"]`)) == null || V.classList.add(G["option-focused"]);
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
}), Q = {
|
|
@@ -656,18 +656,18 @@ const _t = "_autocomplete_164gy_65", G = {
|
|
|
656
656
|
...pe(),
|
|
657
657
|
id: "autocomplete-list",
|
|
658
658
|
className: G["autocomplete__dropdown-list"],
|
|
659
|
-
children: J.map((i,
|
|
660
|
-
const
|
|
659
|
+
children: J.map((i, m) => {
|
|
660
|
+
const j = ce({ option: i, index: m }), V = typeof i == "string" ? i : String(i[c || "label"]), _ = j.key === S;
|
|
661
661
|
return /* @__PURE__ */ ct(
|
|
662
662
|
"li",
|
|
663
663
|
{
|
|
664
|
-
tabIndex:
|
|
664
|
+
tabIndex: m,
|
|
665
665
|
className: G["autocomplete__dropdown-item"],
|
|
666
|
-
...
|
|
666
|
+
...j,
|
|
667
667
|
"aria-selected": _,
|
|
668
|
-
key: String(
|
|
668
|
+
key: String(m)
|
|
669
669
|
},
|
|
670
|
-
|
|
670
|
+
V
|
|
671
671
|
);
|
|
672
672
|
})
|
|
673
673
|
}
|