@pismo/marola 2.0.1 → 2.1.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/{Button-cCziLrIy.js → Button-Bh6rpTyY.js} +2 -2
- package/dist/{ClickAwayListener-CUayzVlD.js → ClickAwayListener-BjqhGzJh.js} +3 -3
- package/dist/DatePicker.module-CmT9Zbbu.js +45 -0
- package/dist/{Popup-C7AXLoP0.js → Popup-aWlctE1C.js} +3 -3
- package/dist/{Portal-CYV5TK_i.js → Portal-Dc9ej3DW.js} +2 -2
- package/dist/{RadioButton.module-B4kmS66R.js → RadioButton.module-VF7v9SuY.js} +1 -1
- package/dist/{Toggle-DEVeyo2f.js → Toggle-DeMSbC0N.js} +16 -15
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/assets/DatePicker.css +1 -0
- package/dist/{combineHooksSlotProps-BCXoX9Nx.js → combineHooksSlotProps-CNWfgylM.js} +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/Autocomplete/Autocomplete.js +249 -247
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts +3 -1
- package/dist/components/Autocomplete/Autocomplete.test.d.ts +1 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Chip/Chip.js +4 -3
- package/dist/components/DatePicker/DatePicker.d.ts +30 -0
- package/dist/components/DatePicker/DatePicker.js +1534 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts +45 -0
- package/dist/components/DatePicker/DatePicker.test.d.ts +1 -0
- package/dist/components/DatePicker/dateUtils.d.ts +96 -0
- package/dist/components/DatePicker/dateUtils.js +70 -0
- package/dist/components/DatePicker/dateUtils.test.d.ts +0 -0
- package/dist/components/DatePicker/keyboardNavigation.d.ts +14 -0
- package/dist/components/DatePicker/keyboardNavigation.js +26 -0
- package/dist/components/DatePicker/keyboardNavigation.test.d.ts +1 -0
- package/dist/components/DatePicker/renderCalendarDays.d.ts +25 -0
- package/dist/components/DatePicker/renderCalendarDays.js +85 -0
- package/dist/components/DatePicker/renderCalendarDays.test.d.ts +2 -0
- package/dist/components/DatePicker/renderDualCalendarHeader.d.ts +8 -0
- package/dist/components/DatePicker/renderDualCalendarHeader.js +51 -0
- package/dist/components/DatePicker/renderDualCalendarHeader.test.d.ts +0 -0
- package/dist/components/DatePicker/renderHeader.d.ts +11 -0
- package/dist/components/DatePicker/renderHeader.js +41 -0
- package/dist/components/DatePicker/renderHeader.test.d.ts +0 -0
- package/dist/components/DatePicker/renderNavigatorInput.d.ts +16 -0
- package/dist/components/DatePicker/renderNavigatorInput.js +73 -0
- package/dist/components/DatePicker/renderNavigatorInput.test.d.ts +1 -0
- package/dist/components/DatePicker/renderPeriodSelection.d.ts +17 -0
- package/dist/components/DatePicker/renderPeriodSelection.js +81 -0
- package/dist/components/DatePicker/renderPeriodSelection.test.d.ts +1 -0
- package/dist/components/Dialog/CloseIconButton.js +1 -1
- package/dist/components/Dialog/Dialog.js +4 -4
- package/dist/components/Icon/Icon.js +167 -163
- package/dist/components/Icon/types.d.ts +1 -1
- package/dist/components/IconButton/IconButton.js +1 -1
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Popover/Popover.js +2 -2
- package/dist/components/RadioButton/RadioButton.js +7 -6
- package/dist/components/RadioButton/RadioOption.js +7 -6
- package/dist/components/ResultWithChips/ResultWithChips.js +1 -1
- package/dist/components/RowItem/RowItem.js +4 -3
- package/dist/components/Select/Select.js +5 -5
- package/dist/components/Snackbar/Snackbar.js +3 -3
- package/dist/components/Tabs/Tab.js +3 -3
- package/dist/components/Tabs/TabPanel.js +1 -1
- package/dist/components/Tabs/Tabs.js +3 -3
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/ToggleGroup/Toggle.js +3 -2
- package/dist/components/ToggleGroup/ToggleGroup.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +3 -3
- package/dist/contexts/SnackbarProvider/SnackbarProvider.js +1 -1
- package/dist/dayjs.min-ClQKmc--.js +285 -0
- package/dist/{index-CATDT7fJ.js → index-Bppuplgd.js} +6 -5
- package/dist/main.d.ts +1 -0
- package/dist/main.js +106 -105
- package/dist/{ownerDocument-CAHSRRik.js → ownerDocument-CXvpb_nj.js} +2 -1
- package/dist/{useButton-eF8MXAli.js → useButton-B8Y1xR88.js} +1 -1
- package/dist/{useList-CPY2roI7.js → useList-9gbS2r78.js} +2 -2
- package/dist/{useSlotProps-DSnfx453.js → useSlotProps-C7dqSmdM.js} +109 -112
- package/package.json +1 -1
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as Q, jsxs as it } from "react/jsx-runtime";
|
|
2
|
+
import * as g from "react";
|
|
3
3
|
import { useId as lt, useState as at } from "react";
|
|
4
4
|
import { c as ut } from "../../clsx-OuTLNxxd.js";
|
|
5
5
|
import { Icon as ct } from "../Icon/Icon.js";
|
|
6
6
|
import { Input as ft } from "../Input/Input.js";
|
|
7
|
-
import { s as dt, b as Me } from "../../useSlotProps-
|
|
7
|
+
import { s as dt, b as Me } from "../../useSlotProps-C7dqSmdM.js";
|
|
8
8
|
import { u as pt } from "../../useId-BW-oWmul.js";
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as
|
|
9
|
+
import { u as we } from "../../useControlled-CCMYYdCM.js";
|
|
10
|
+
import { u as fe } from "../../useEventCallback-BAQJJ3ye.js";
|
|
11
11
|
import '../../assets/Autocomplete.css';const gt = (c) => {
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
}),
|
|
12
|
+
const h = g.useRef({});
|
|
13
|
+
return g.useEffect(() => {
|
|
14
|
+
h.current = c;
|
|
15
|
+
}), h.current;
|
|
16
16
|
};
|
|
17
17
|
function Re(c) {
|
|
18
18
|
return typeof c.normalize < "u" ? c.normalize("NFD").replace(/[\u0300-\u036f]/g, "") : c;
|
|
19
19
|
}
|
|
20
20
|
function ht(c = {}) {
|
|
21
21
|
const {
|
|
22
|
-
ignoreAccents:
|
|
23
|
-
ignoreCase:
|
|
24
|
-
limit:
|
|
25
|
-
matchFrom:
|
|
26
|
-
stringify:
|
|
27
|
-
trim:
|
|
22
|
+
ignoreAccents: h = !0,
|
|
23
|
+
ignoreCase: m = !0,
|
|
24
|
+
limit: $,
|
|
25
|
+
matchFrom: N = "any",
|
|
26
|
+
stringify: B,
|
|
27
|
+
trim: V = !1
|
|
28
28
|
} = c;
|
|
29
|
-
return (
|
|
30
|
-
inputValue:
|
|
29
|
+
return (P, {
|
|
30
|
+
inputValue: M,
|
|
31
31
|
getOptionLabel: b
|
|
32
32
|
}) => {
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
let w = (
|
|
37
|
-
return
|
|
38
|
-
}) :
|
|
39
|
-
return typeof
|
|
33
|
+
let k = V ? M.trim() : M;
|
|
34
|
+
m && (k = k.toLowerCase()), h && (k = Re(k));
|
|
35
|
+
const U = k ? P.filter((K) => {
|
|
36
|
+
let w = (B || b)(K);
|
|
37
|
+
return m && (w = w.toLowerCase()), h && (w = Re(w)), N === "start" ? w.indexOf(k) === 0 : w.indexOf(k) > -1;
|
|
38
|
+
}) : P;
|
|
39
|
+
return typeof $ == "number" ? U.slice(0, $) : U;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
for (let
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
42
|
+
function de(c, h) {
|
|
43
|
+
for (let m = 0; m < c.length; m += 1)
|
|
44
|
+
if (h(c[m]))
|
|
45
|
+
return m;
|
|
46
46
|
return -1;
|
|
47
47
|
}
|
|
48
48
|
const mt = ht(), bt = 5, xt = (c) => {
|
|
49
|
-
var
|
|
50
|
-
return c.current !== null && ((
|
|
49
|
+
var h;
|
|
50
|
+
return c.current !== null && ((h = c.current.parentElement) == null ? void 0 : h.contains(document.activeElement));
|
|
51
51
|
};
|
|
52
52
|
function yt(c) {
|
|
53
53
|
const {
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
55
|
-
unstable_isActiveElementInListbox:
|
|
55
|
+
unstable_isActiveElementInListbox: h = xt,
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
57
|
-
unstable_classNamePrefix:
|
|
58
|
-
autoComplete:
|
|
59
|
-
autoHighlight:
|
|
60
|
-
autoSelect:
|
|
61
|
-
blurOnSelect:
|
|
62
|
-
clearOnBlur:
|
|
63
|
-
clearOnEscape:
|
|
57
|
+
unstable_classNamePrefix: m = "Mui",
|
|
58
|
+
autoComplete: $ = !1,
|
|
59
|
+
autoHighlight: N = !1,
|
|
60
|
+
autoSelect: B = !1,
|
|
61
|
+
blurOnSelect: V = !1,
|
|
62
|
+
clearOnBlur: P = !c.freeSolo,
|
|
63
|
+
clearOnEscape: M = !1,
|
|
64
64
|
componentName: b = "useAutocomplete",
|
|
65
|
-
defaultValue:
|
|
66
|
-
disableClearable:
|
|
67
|
-
disableCloseOnSelect:
|
|
65
|
+
defaultValue: k = c.multiple ? [] : null,
|
|
66
|
+
disableClearable: U = !1,
|
|
67
|
+
disableCloseOnSelect: K = !1,
|
|
68
68
|
disabled: w,
|
|
69
|
-
disabledItemsFocusable:
|
|
70
|
-
disableListWrap:
|
|
71
|
-
filterOptions:
|
|
72
|
-
filterSelectedOptions:
|
|
73
|
-
freeSolo:
|
|
74
|
-
getOptionDisabled:
|
|
75
|
-
getOptionKey:
|
|
76
|
-
getOptionLabel:
|
|
69
|
+
disabledItemsFocusable: pe = !1,
|
|
70
|
+
disableListWrap: ee = !1,
|
|
71
|
+
filterOptions: ge = mt,
|
|
72
|
+
filterSelectedOptions: te = !1,
|
|
73
|
+
freeSolo: v = !1,
|
|
74
|
+
getOptionDisabled: R,
|
|
75
|
+
getOptionKey: ne,
|
|
76
|
+
getOptionLabel: re = (t) => {
|
|
77
77
|
var e;
|
|
78
78
|
return (e = t.label) != null ? e : t;
|
|
79
79
|
},
|
|
80
|
-
groupBy:
|
|
81
|
-
handleHomeEndKeys:
|
|
82
|
-
id:
|
|
83
|
-
includeInputInList:
|
|
84
|
-
inputValue:
|
|
85
|
-
isOptionEqualToValue:
|
|
86
|
-
multiple:
|
|
87
|
-
onChange:
|
|
80
|
+
groupBy: i,
|
|
81
|
+
handleHomeEndKeys: x = !c.freeSolo,
|
|
82
|
+
id: W,
|
|
83
|
+
includeInputInList: H = !1,
|
|
84
|
+
inputValue: L,
|
|
85
|
+
isOptionEqualToValue: A = (t, e) => t === e,
|
|
86
|
+
multiple: l = !1,
|
|
87
|
+
onChange: Se,
|
|
88
88
|
onClose: ke,
|
|
89
89
|
onHighlightChange: Ee,
|
|
90
|
-
onInputChange:
|
|
90
|
+
onInputChange: F,
|
|
91
91
|
onOpen: Te,
|
|
92
92
|
open: He,
|
|
93
93
|
openOnFocus: Fe = !1,
|
|
94
94
|
options: he,
|
|
95
|
-
readOnly:
|
|
95
|
+
readOnly: Y = !1,
|
|
96
96
|
selectOnFocus: qe = !c.freeSolo,
|
|
97
97
|
value: je
|
|
98
|
-
} = c, E = pt(
|
|
99
|
-
let O =
|
|
98
|
+
} = c, E = pt(W);
|
|
99
|
+
let O = re;
|
|
100
100
|
O = (t) => {
|
|
101
|
-
const e =
|
|
101
|
+
const e = re(t);
|
|
102
102
|
if (typeof e != "string") {
|
|
103
103
|
if (process.env.NODE_ENV !== "production") {
|
|
104
104
|
const n = e === void 0 ? "undefined" : `${typeof e} (${e})`;
|
|
@@ -108,20 +108,20 @@ function yt(c) {
|
|
|
108
108
|
}
|
|
109
109
|
return e;
|
|
110
110
|
};
|
|
111
|
-
const me =
|
|
111
|
+
const me = g.useRef(!1), be = g.useRef(!0), d = g.useRef(null), T = g.useRef(null), [oe, Be] = g.useState(null), [_, xe] = g.useState(-1), _e = N ? 0 : -1, y = g.useRef(_e), [r, Ue] = we({
|
|
112
112
|
controlled: je,
|
|
113
|
-
default:
|
|
113
|
+
default: k,
|
|
114
114
|
name: b
|
|
115
|
-
}), [
|
|
116
|
-
controlled:
|
|
115
|
+
}), [u, se] = we({
|
|
116
|
+
controlled: L,
|
|
117
117
|
default: "",
|
|
118
118
|
name: b,
|
|
119
119
|
state: "inputValue"
|
|
120
|
-
}), [
|
|
121
|
-
if (!(
|
|
120
|
+
}), [ie, $e] = g.useState(!1), le = g.useCallback((t, e) => {
|
|
121
|
+
if (!(l ? r.length < e.length : e !== null) && !P)
|
|
122
122
|
return;
|
|
123
123
|
let o;
|
|
124
|
-
if (
|
|
124
|
+
if (l)
|
|
125
125
|
o = "";
|
|
126
126
|
else if (e == null)
|
|
127
127
|
o = "";
|
|
@@ -129,62 +129,62 @@ function yt(c) {
|
|
|
129
129
|
const s = O(e);
|
|
130
130
|
o = typeof s == "string" ? s : "";
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
}, [O,
|
|
132
|
+
u !== o && (se(o), F && F(t, o, "reset"));
|
|
133
|
+
}, [O, u, l, F, se, P, r]), [z, Pe] = we({
|
|
134
134
|
controlled: He,
|
|
135
135
|
default: !1,
|
|
136
136
|
name: b,
|
|
137
137
|
state: "open"
|
|
138
|
-
}), [Ke, Ae] =
|
|
139
|
-
he.filter((t) => !(
|
|
138
|
+
}), [Ke, Ae] = g.useState(!0), De = !l && r != null && u === O(r), S = z && !Y, f = S ? ge(
|
|
139
|
+
he.filter((t) => !(te && (l ? r : [r]).some((e) => e !== null && A(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
|
{
|
|
143
|
-
inputValue: De && Ke ? "" :
|
|
143
|
+
inputValue: De && Ke ? "" : u,
|
|
144
144
|
getOptionLabel: O
|
|
145
145
|
}
|
|
146
|
-
) : [],
|
|
146
|
+
) : [], D = gt({
|
|
147
147
|
filteredOptions: f,
|
|
148
148
|
value: r,
|
|
149
|
-
inputValue:
|
|
149
|
+
inputValue: u
|
|
150
150
|
});
|
|
151
|
-
|
|
152
|
-
const t = r !==
|
|
153
|
-
|
|
154
|
-
}, [r,
|
|
155
|
-
const ye =
|
|
156
|
-
if (process.env.NODE_ENV !== "production" && r !== null && !
|
|
157
|
-
const t = (
|
|
151
|
+
g.useEffect(() => {
|
|
152
|
+
const t = r !== D.value;
|
|
153
|
+
ie && !t || v && !t || le(null, r);
|
|
154
|
+
}, [r, le, ie, D.value, v]);
|
|
155
|
+
const ye = z && f.length > 0 && !Y;
|
|
156
|
+
if (process.env.NODE_ENV !== "production" && r !== null && !v && he.length > 0) {
|
|
157
|
+
const t = (l ? r : [r]).filter((e) => !he.some((n) => A(n, e)));
|
|
158
158
|
t.length > 0 && console.warn([`MUI: The value provided to ${b} 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
|
-
const
|
|
162
|
-
t === -1 ? d.current.focus() :
|
|
161
|
+
const ae = fe((t) => {
|
|
162
|
+
t === -1 ? d.current.focus() : oe.querySelector(`[data-tag-index="${t}"]`).focus();
|
|
163
163
|
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}, [r,
|
|
164
|
+
g.useEffect(() => {
|
|
165
|
+
l && _ > r.length - 1 && (xe(-1), ae(-1));
|
|
166
|
+
}, [r, l, _, ae]);
|
|
167
167
|
function ze(t, e) {
|
|
168
168
|
if (!T.current || t < 0 || t >= f.length)
|
|
169
169
|
return -1;
|
|
170
170
|
let n = t;
|
|
171
171
|
for (; ; ) {
|
|
172
|
-
const o = T.current.querySelector(`[data-option-index="${n}"]`), s =
|
|
172
|
+
const o = T.current.querySelector(`[data-option-index="${n}"]`), s = pe ? !1 : !o || o.disabled || o.getAttribute("aria-disabled") === "true";
|
|
173
173
|
if (o && o.hasAttribute("tabindex") && !s)
|
|
174
174
|
return n;
|
|
175
175
|
if (e === "next" ? n = (n + 1) % f.length : n = (n - 1 + f.length) % f.length, n === t)
|
|
176
176
|
return -1;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const q = fe(({
|
|
180
180
|
event: t,
|
|
181
181
|
index: e,
|
|
182
182
|
reason: n = "auto"
|
|
183
183
|
}) => {
|
|
184
184
|
if (y.current = e, e === -1 ? d.current.removeAttribute("aria-activedescendant") : d.current.setAttribute("aria-activedescendant", `${E}-option-${e}`), Ee && Ee(t, e === -1 ? null : f[e], n), !T.current)
|
|
185
185
|
return;
|
|
186
|
-
const o = T.current.querySelector(`[role="option"].${
|
|
187
|
-
o && (o.classList.remove(`${
|
|
186
|
+
const o = T.current.querySelector(`[role="option"].${m}-focused`);
|
|
187
|
+
o && (o.classList.remove(`${m}-focused`), o.classList.remove(`${m}-focusVisible`));
|
|
188
188
|
let s = T.current;
|
|
189
189
|
if (T.current.getAttribute("role") !== "listbox" && (s = T.current.parentElement.querySelector('[role="listbox"]')), !s)
|
|
190
190
|
return;
|
|
@@ -192,20 +192,20 @@ function yt(c) {
|
|
|
192
192
|
s.scrollTop = 0;
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
197
|
-
const p =
|
|
198
|
-
|
|
195
|
+
const a = T.current.querySelector(`[data-option-index="${e}"]`);
|
|
196
|
+
if (a && (a.classList.add(`${m}-focused`), n === "keyboard" && a.classList.add(`${m}-focusVisible`), s.scrollHeight > s.clientHeight && n !== "mouse" && n !== "touch")) {
|
|
197
|
+
const p = a, I = s.clientHeight + s.scrollTop, ce = p.offsetTop + p.offsetHeight;
|
|
198
|
+
ce > I ? s.scrollTop = ce - s.clientHeight : p.offsetTop - p.offsetHeight * (i ? 1.3 : 0) < s.scrollTop && (s.scrollTop = p.offsetTop - p.offsetHeight * (i ? 1.3 : 0));
|
|
199
199
|
}
|
|
200
|
-
}),
|
|
200
|
+
}), C = fe(({
|
|
201
201
|
event: t,
|
|
202
202
|
diff: e,
|
|
203
203
|
direction: n = "next",
|
|
204
204
|
reason: o = "auto"
|
|
205
205
|
}) => {
|
|
206
|
-
if (!
|
|
206
|
+
if (!S)
|
|
207
207
|
return;
|
|
208
|
-
const
|
|
208
|
+
const a = ze((() => {
|
|
209
209
|
const p = f.length - 1;
|
|
210
210
|
if (e === "reset")
|
|
211
211
|
return _e;
|
|
@@ -214,41 +214,41 @@ function yt(c) {
|
|
|
214
214
|
if (e === "end")
|
|
215
215
|
return p;
|
|
216
216
|
const I = y.current + e;
|
|
217
|
-
return I < 0 ? I === -1 &&
|
|
217
|
+
return I < 0 ? I === -1 && H ? -1 : ee && y.current !== -1 || Math.abs(e) > 1 ? 0 : p : I > p ? I === p + 1 && H ? -1 : ee || Math.abs(e) > 1 ? p : 0 : I;
|
|
218
218
|
})(), n);
|
|
219
|
-
if (
|
|
220
|
-
index:
|
|
219
|
+
if (q({
|
|
220
|
+
index: a,
|
|
221
221
|
reason: o,
|
|
222
222
|
event: t
|
|
223
|
-
}),
|
|
224
|
-
if (
|
|
225
|
-
d.current.value =
|
|
223
|
+
}), $ && e !== "reset")
|
|
224
|
+
if (a === -1)
|
|
225
|
+
d.current.value = u;
|
|
226
226
|
else {
|
|
227
|
-
const p = O(f[
|
|
228
|
-
d.current.value = p, p.toLowerCase().indexOf(
|
|
227
|
+
const p = O(f[a]);
|
|
228
|
+
d.current.value = p, p.toLowerCase().indexOf(u.toLowerCase()) === 0 && u.length > 0 && d.current.setSelectionRange(u.length, p.length);
|
|
229
229
|
}
|
|
230
230
|
}), Je = () => {
|
|
231
231
|
const t = (e, n) => {
|
|
232
232
|
const o = e ? O(e) : "", s = n ? O(n) : "";
|
|
233
233
|
return o === s;
|
|
234
234
|
};
|
|
235
|
-
if (y.current !== -1 &&
|
|
236
|
-
const e =
|
|
235
|
+
if (y.current !== -1 && D.filteredOptions && D.filteredOptions.length !== f.length && D.inputValue === u && (l ? r.length === D.value.length && D.value.every((e, n) => O(r[n]) === O(e)) : t(D.value, r))) {
|
|
236
|
+
const e = D.filteredOptions[y.current];
|
|
237
237
|
if (e)
|
|
238
|
-
return
|
|
238
|
+
return de(f, (n) => O(n) === O(e));
|
|
239
239
|
}
|
|
240
240
|
return -1;
|
|
241
|
-
}, Oe =
|
|
242
|
-
if (!
|
|
241
|
+
}, Oe = g.useCallback(() => {
|
|
242
|
+
if (!S)
|
|
243
243
|
return;
|
|
244
244
|
const t = Je();
|
|
245
245
|
if (t !== -1) {
|
|
246
246
|
y.current = t;
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
const e =
|
|
249
|
+
const e = l ? r[0] : r;
|
|
250
250
|
if (f.length === 0 || e == null) {
|
|
251
|
-
|
|
251
|
+
C({
|
|
252
252
|
diff: "reset"
|
|
253
253
|
});
|
|
254
254
|
return;
|
|
@@ -256,23 +256,23 @@ function yt(c) {
|
|
|
256
256
|
if (T.current) {
|
|
257
257
|
if (e != null) {
|
|
258
258
|
const n = f[y.current];
|
|
259
|
-
if (
|
|
259
|
+
if (l && n && de(r, (s) => A(n, s)) !== -1)
|
|
260
260
|
return;
|
|
261
|
-
const o =
|
|
262
|
-
o === -1 ?
|
|
261
|
+
const o = de(f, (s) => A(s, e));
|
|
262
|
+
o === -1 ? C({
|
|
263
263
|
diff: "reset"
|
|
264
|
-
}) :
|
|
264
|
+
}) : q({
|
|
265
265
|
index: o
|
|
266
266
|
});
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
269
|
if (y.current >= f.length - 1) {
|
|
270
|
-
|
|
270
|
+
q({
|
|
271
271
|
index: f.length - 1
|
|
272
272
|
});
|
|
273
273
|
return;
|
|
274
274
|
}
|
|
275
|
-
|
|
275
|
+
q({
|
|
276
276
|
index: y.current
|
|
277
277
|
});
|
|
278
278
|
}
|
|
@@ -281,48 +281,48 @@ function yt(c) {
|
|
|
281
281
|
f.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
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
]), We =
|
|
284
|
+
l ? !1 : r,
|
|
285
|
+
te,
|
|
286
|
+
C,
|
|
287
|
+
q,
|
|
288
|
+
S,
|
|
289
|
+
u,
|
|
290
|
+
l
|
|
291
|
+
]), We = fe((t) => {
|
|
292
292
|
dt(T, t), t && Oe();
|
|
293
293
|
});
|
|
294
|
-
process.env.NODE_ENV !== "production" &&
|
|
294
|
+
process.env.NODE_ENV !== "production" && g.useEffect(() => {
|
|
295
295
|
(!d.current || d.current.nodeName !== "INPUT") && (d.current && d.current.nodeName === "TEXTAREA" ? console.warn([`A textarea element was provided to ${b} 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
296
|
`)) : console.error([`MUI: Unable to find the input element. It was resolved to ${d.current} while an HTMLInputElement was expected.`, `Instead, ${b} expects an input element.`, "", b === "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
|
-
}, [b]),
|
|
298
|
+
}, [b]), g.useEffect(() => {
|
|
299
299
|
Oe();
|
|
300
300
|
}, [Oe]);
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
},
|
|
304
|
-
|
|
305
|
-
},
|
|
306
|
-
if (
|
|
307
|
-
if (r.length === e.length && r.every((s,
|
|
301
|
+
const j = (t) => {
|
|
302
|
+
z || (Pe(!0), Ae(!0), Te && Te(t));
|
|
303
|
+
}, X = (t, e) => {
|
|
304
|
+
z && (Pe(!1), ke && ke(t, e));
|
|
305
|
+
}, J = (t, e, n, o) => {
|
|
306
|
+
if (l) {
|
|
307
|
+
if (r.length === e.length && r.every((s, a) => s === e[a]))
|
|
308
308
|
return;
|
|
309
309
|
} else if (r === e)
|
|
310
310
|
return;
|
|
311
|
-
|
|
312
|
-
},
|
|
313
|
-
let s = n,
|
|
314
|
-
if (
|
|
315
|
-
if (
|
|
316
|
-
const I =
|
|
311
|
+
Se && Se(t, e, n, o), Ue(e);
|
|
312
|
+
}, ue = g.useRef(!1), G = (t, e, n = "selectOption", o = "options") => {
|
|
313
|
+
let s = n, a = e;
|
|
314
|
+
if (l) {
|
|
315
|
+
if (a = Array.isArray(r) ? r.slice() : [], process.env.NODE_ENV !== "production") {
|
|
316
|
+
const I = a.filter((ce) => A(e, ce));
|
|
317
317
|
I.length > 1 && console.error([`MUI: The \`isOptionEqualToValue\` method of ${b} 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 p =
|
|
321
|
-
p === -1 ?
|
|
320
|
+
const p = de(a, (I) => A(e, I));
|
|
321
|
+
p === -1 ? a.push(e) : o !== "freeSolo" && (a.splice(p, 1), s = "removeOption");
|
|
322
322
|
}
|
|
323
|
-
|
|
323
|
+
le(t, a), J(t, a, s, {
|
|
324
324
|
option: e
|
|
325
|
-
}), !
|
|
325
|
+
}), !K && (!t || !t.ctrlKey && !t.metaKey) && X(t, s), (V === !0 || V === "touch" && ue.current || V === "mouse" && !ue.current) && d.current.blur();
|
|
326
326
|
};
|
|
327
327
|
function Ye(t, e) {
|
|
328
328
|
if (t === -1)
|
|
@@ -331,7 +331,7 @@ function yt(c) {
|
|
|
331
331
|
for (; ; ) {
|
|
332
332
|
if (e === "next" && n === r.length || e === "previous" && n === -1)
|
|
333
333
|
return -1;
|
|
334
|
-
const o =
|
|
334
|
+
const o = oe.querySelector(`[data-tag-index="${n}"]`);
|
|
335
335
|
if (!o || !o.hasAttribute("tabindex") || o.disabled || o.getAttribute("aria-disabled") === "true")
|
|
336
336
|
n += e === "next" ? 1 : -1;
|
|
337
337
|
else
|
|
@@ -339,18 +339,18 @@ function yt(c) {
|
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
const Ce = (t, e) => {
|
|
342
|
-
if (!
|
|
342
|
+
if (!l)
|
|
343
343
|
return;
|
|
344
|
-
|
|
344
|
+
u === "" && X(t, "toggleInput");
|
|
345
345
|
let n = _;
|
|
346
|
-
_ === -1 ?
|
|
346
|
+
_ === -1 ? u === "" && e === "previous" && (n = r.length - 1) : (n += e === "next" ? 1 : -1, n < 0 && (n = 0), n === r.length && (n = -1)), n = Ye(n, e), xe(n), ae(n);
|
|
347
347
|
}, Ne = (t) => {
|
|
348
|
-
me.current = !0,
|
|
348
|
+
me.current = !0, se(""), F && F(t, "", "clear"), J(t, l ? [] : null, "clear");
|
|
349
349
|
}, Xe = (t) => (e) => {
|
|
350
|
-
if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && (_ !== -1 && ["ArrowLeft", "ArrowRight"].indexOf(e.key) === -1 && (xe(-1),
|
|
350
|
+
if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && (_ !== -1 && ["ArrowLeft", "ArrowRight"].indexOf(e.key) === -1 && (xe(-1), ae(-1)), e.which !== 229))
|
|
351
351
|
switch (e.key) {
|
|
352
352
|
case "Home":
|
|
353
|
-
|
|
353
|
+
S && x && (e.preventDefault(), C({
|
|
354
354
|
diff: "start",
|
|
355
355
|
direction: "next",
|
|
356
356
|
reason: "keyboard",
|
|
@@ -358,7 +358,7 @@ function yt(c) {
|
|
|
358
358
|
}));
|
|
359
359
|
break;
|
|
360
360
|
case "End":
|
|
361
|
-
|
|
361
|
+
S && x && (e.preventDefault(), C({
|
|
362
362
|
diff: "end",
|
|
363
363
|
direction: "previous",
|
|
364
364
|
reason: "keyboard",
|
|
@@ -366,36 +366,36 @@ function yt(c) {
|
|
|
366
366
|
}));
|
|
367
367
|
break;
|
|
368
368
|
case "PageUp":
|
|
369
|
-
e.preventDefault(),
|
|
369
|
+
e.preventDefault(), C({
|
|
370
370
|
diff: -5,
|
|
371
371
|
direction: "previous",
|
|
372
372
|
reason: "keyboard",
|
|
373
373
|
event: e
|
|
374
|
-
}),
|
|
374
|
+
}), j(e);
|
|
375
375
|
break;
|
|
376
376
|
case "PageDown":
|
|
377
|
-
e.preventDefault(),
|
|
377
|
+
e.preventDefault(), C({
|
|
378
378
|
diff: bt,
|
|
379
379
|
direction: "next",
|
|
380
380
|
reason: "keyboard",
|
|
381
381
|
event: e
|
|
382
|
-
}),
|
|
382
|
+
}), j(e);
|
|
383
383
|
break;
|
|
384
384
|
case "ArrowDown":
|
|
385
|
-
e.preventDefault(),
|
|
385
|
+
e.preventDefault(), C({
|
|
386
386
|
diff: 1,
|
|
387
387
|
direction: "next",
|
|
388
388
|
reason: "keyboard",
|
|
389
389
|
event: e
|
|
390
|
-
}),
|
|
390
|
+
}), j(e);
|
|
391
391
|
break;
|
|
392
392
|
case "ArrowUp":
|
|
393
|
-
e.preventDefault(),
|
|
393
|
+
e.preventDefault(), C({
|
|
394
394
|
diff: -1,
|
|
395
395
|
direction: "previous",
|
|
396
396
|
reason: "keyboard",
|
|
397
397
|
event: e
|
|
398
|
-
}),
|
|
398
|
+
}), j(e);
|
|
399
399
|
break;
|
|
400
400
|
case "ArrowLeft":
|
|
401
401
|
Ce(e, "previous");
|
|
@@ -404,91 +404,91 @@ function yt(c) {
|
|
|
404
404
|
Ce(e, "next");
|
|
405
405
|
break;
|
|
406
406
|
case "Enter":
|
|
407
|
-
if (y.current !== -1 &&
|
|
408
|
-
const n = f[y.current], o =
|
|
407
|
+
if (y.current !== -1 && S) {
|
|
408
|
+
const n = f[y.current], o = R ? R(n) : !1;
|
|
409
409
|
if (e.preventDefault(), o)
|
|
410
410
|
return;
|
|
411
|
-
|
|
412
|
-
} else
|
|
411
|
+
G(e, n, "selectOption"), $ && d.current.setSelectionRange(d.current.value.length, d.current.value.length);
|
|
412
|
+
} else v && u !== "" && De === !1 && (l && e.preventDefault(), G(e, u, "createOption", "freeSolo"));
|
|
413
413
|
break;
|
|
414
414
|
case "Escape":
|
|
415
|
-
|
|
415
|
+
S ? (e.preventDefault(), e.stopPropagation(), X(e, "escape")) : M && (u !== "" || l && r.length > 0) && (e.preventDefault(), e.stopPropagation(), Ne(e));
|
|
416
416
|
break;
|
|
417
417
|
case "Backspace":
|
|
418
|
-
if (
|
|
418
|
+
if (l && !Y && u === "" && r.length > 0) {
|
|
419
419
|
const n = _ === -1 ? r.length - 1 : _, o = r.slice();
|
|
420
|
-
o.splice(n, 1),
|
|
420
|
+
o.splice(n, 1), J(e, o, "removeOption", {
|
|
421
421
|
option: r[n]
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
424
|
break;
|
|
425
425
|
case "Delete":
|
|
426
|
-
if (
|
|
426
|
+
if (l && !Y && u === "" && r.length > 0 && _ !== -1) {
|
|
427
427
|
const n = _, o = r.slice();
|
|
428
|
-
o.splice(n, 1),
|
|
428
|
+
o.splice(n, 1), J(e, o, "removeOption", {
|
|
429
429
|
option: r[n]
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
432
|
break;
|
|
433
433
|
}
|
|
434
434
|
}, Ge = (t) => {
|
|
435
|
-
$e(!0), Fe && !me.current &&
|
|
436
|
-
},
|
|
437
|
-
if (
|
|
435
|
+
$e(!0), Fe && !me.current && j(t);
|
|
436
|
+
}, ve = (t) => {
|
|
437
|
+
if (h(T)) {
|
|
438
438
|
d.current.focus();
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
|
-
$e(!1), be.current = !0, me.current = !1,
|
|
441
|
+
$e(!1), be.current = !0, me.current = !1, B && y.current !== -1 && S ? G(t, f[y.current], "blur") : B && v && u !== "" ? G(t, u, "blur", "freeSolo") : P && le(t, r), X(t, "blur");
|
|
442
442
|
}, Qe = (t) => {
|
|
443
443
|
const e = t.target.value;
|
|
444
|
-
|
|
444
|
+
u !== e && (se(e), Ae(!1), F && F(t, e, "input")), e === "" ? !U && !l && J(t, null, "clear") : j(t);
|
|
445
445
|
}, Ze = (t) => {
|
|
446
446
|
const e = Number(t.currentTarget.getAttribute("data-option-index"));
|
|
447
|
-
y.current !== e &&
|
|
447
|
+
y.current !== e && q({
|
|
448
448
|
event: t,
|
|
449
449
|
index: e,
|
|
450
450
|
reason: "mouse"
|
|
451
451
|
});
|
|
452
452
|
}, et = (t) => {
|
|
453
|
-
|
|
453
|
+
q({
|
|
454
454
|
event: t,
|
|
455
455
|
index: Number(t.currentTarget.getAttribute("data-option-index")),
|
|
456
456
|
reason: "touch"
|
|
457
|
-
}),
|
|
457
|
+
}), ue.current = !0;
|
|
458
458
|
}, tt = (t) => {
|
|
459
459
|
const e = Number(t.currentTarget.getAttribute("data-option-index"));
|
|
460
|
-
|
|
460
|
+
G(t, f[e], "selectOption"), ue.current = !1;
|
|
461
461
|
}, nt = (t) => (e) => {
|
|
462
462
|
const n = r.slice();
|
|
463
|
-
n.splice(t, 1),
|
|
463
|
+
n.splice(t, 1), J(e, n, "removeOption", {
|
|
464
464
|
option: r[t]
|
|
465
465
|
});
|
|
466
|
-
},
|
|
467
|
-
|
|
466
|
+
}, Le = (t) => {
|
|
467
|
+
z ? X(t, "toggleInput") : j(t);
|
|
468
468
|
}, rt = (t) => {
|
|
469
469
|
t.currentTarget.contains(t.target) && t.target.getAttribute("id") !== E && t.preventDefault();
|
|
470
470
|
}, ot = (t) => {
|
|
471
471
|
t.currentTarget.contains(t.target) && (d.current.focus(), qe && be.current && d.current.selectionEnd - d.current.selectionStart === 0 && d.current.select(), be.current = !1);
|
|
472
472
|
}, st = (t) => {
|
|
473
|
-
!w && (
|
|
473
|
+
!w && (u === "" || !z) && Le(t);
|
|
474
474
|
};
|
|
475
|
-
let Ie =
|
|
476
|
-
Ie = Ie || (
|
|
475
|
+
let Ie = v && u.length > 0;
|
|
476
|
+
Ie = Ie || (l ? r.length > 0 : r !== null);
|
|
477
477
|
let Ve = f;
|
|
478
|
-
if (
|
|
478
|
+
if (i) {
|
|
479
479
|
const t = /* @__PURE__ */ new Map();
|
|
480
480
|
let e = !1;
|
|
481
481
|
Ve = f.reduce((n, o, s) => {
|
|
482
|
-
const
|
|
483
|
-
return n.length > 0 && n[n.length - 1].group ===
|
|
482
|
+
const a = i(o);
|
|
483
|
+
return n.length > 0 && n[n.length - 1].group === a ? n[n.length - 1].options.push(o) : (process.env.NODE_ENV !== "production" && (t.get(a) && !e && (console.warn(`MUI: The options provided combined with the \`groupBy\` method of ${b} returns duplicated headers.`, "You can solve the issue by sorting the options with the output of `groupBy`."), e = !0), t.set(a, !0)), n.push({
|
|
484
484
|
key: s,
|
|
485
485
|
index: s,
|
|
486
|
-
group:
|
|
486
|
+
group: a,
|
|
487
487
|
options: [o]
|
|
488
488
|
})), n;
|
|
489
489
|
}, []);
|
|
490
490
|
}
|
|
491
|
-
return w &&
|
|
491
|
+
return w && ie && ve(), {
|
|
492
492
|
getRootProps: (t = {}) => Me({
|
|
493
493
|
"aria-owns": ye ? `${E}-listbox` : null
|
|
494
494
|
}, t, {
|
|
@@ -502,15 +502,15 @@ function yt(c) {
|
|
|
502
502
|
}),
|
|
503
503
|
getInputProps: () => ({
|
|
504
504
|
id: E,
|
|
505
|
-
value:
|
|
506
|
-
onBlur:
|
|
505
|
+
value: u,
|
|
506
|
+
onBlur: ve,
|
|
507
507
|
onFocus: Ge,
|
|
508
508
|
onChange: Qe,
|
|
509
509
|
onMouseDown: st,
|
|
510
510
|
// if open then this is handled imperatively so don't let react override
|
|
511
511
|
// only have an opinion about this when closed
|
|
512
|
-
"aria-activedescendant":
|
|
513
|
-
"aria-autocomplete":
|
|
512
|
+
"aria-activedescendant": S ? "" : null,
|
|
513
|
+
"aria-autocomplete": $ ? "both" : "list",
|
|
514
514
|
"aria-controls": ye ? `${E}-listbox` : void 0,
|
|
515
515
|
"aria-expanded": ye,
|
|
516
516
|
// Disable browser's suggestion that might overlap with the popup.
|
|
@@ -530,7 +530,7 @@ function yt(c) {
|
|
|
530
530
|
getPopupIndicatorProps: () => ({
|
|
531
531
|
tabIndex: -1,
|
|
532
532
|
type: "button",
|
|
533
|
-
onClick:
|
|
533
|
+
onClick: Le
|
|
534
534
|
}),
|
|
535
535
|
getTagProps: ({
|
|
536
536
|
index: t
|
|
@@ -538,7 +538,7 @@ function yt(c) {
|
|
|
538
538
|
key: t,
|
|
539
539
|
"data-tag-index": t,
|
|
540
540
|
tabIndex: -1
|
|
541
|
-
}, !
|
|
541
|
+
}, !Y && {
|
|
542
542
|
onDelete: nt(t)
|
|
543
543
|
}),
|
|
544
544
|
getListboxProps: () => ({
|
|
@@ -555,9 +555,9 @@ function yt(c) {
|
|
|
555
555
|
option: e
|
|
556
556
|
}) => {
|
|
557
557
|
var n;
|
|
558
|
-
const o = (
|
|
558
|
+
const o = (l ? r : [r]).some((a) => a != null && A(e, a)), s = R ? R(e) : !1;
|
|
559
559
|
return {
|
|
560
|
-
key: (n =
|
|
560
|
+
key: (n = ne == null ? void 0 : ne(e)) != null ? n : O(e),
|
|
561
561
|
tabIndex: -1,
|
|
562
562
|
role: "option",
|
|
563
563
|
id: `${E}-option-${t}`,
|
|
@@ -570,85 +570,87 @@ function yt(c) {
|
|
|
570
570
|
};
|
|
571
571
|
},
|
|
572
572
|
id: E,
|
|
573
|
-
inputValue:
|
|
573
|
+
inputValue: u,
|
|
574
574
|
value: r,
|
|
575
575
|
dirty: Ie,
|
|
576
|
-
expanded:
|
|
577
|
-
popupOpen:
|
|
578
|
-
focused:
|
|
579
|
-
anchorEl:
|
|
576
|
+
expanded: S && oe,
|
|
577
|
+
popupOpen: S,
|
|
578
|
+
focused: ie || _ !== -1,
|
|
579
|
+
anchorEl: oe,
|
|
580
580
|
setAnchorEl: Be,
|
|
581
581
|
focusedTag: _,
|
|
582
582
|
groupedOptions: Ve
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
|
-
const Ot = "_autocomplete_mj65r_65",
|
|
585
|
+
const Ot = "_autocomplete_mj65r_65", Z = {
|
|
586
586
|
"autocomplete__dropdown-item": "_autocomplete__dropdown-item_mj65r_65",
|
|
587
587
|
autocomplete: Ot,
|
|
588
588
|
"autocomplete__dropdown-list": "_autocomplete__dropdown-list_mj65r_82",
|
|
589
589
|
"option-focused": "_option-focused_mj65r_106"
|
|
590
590
|
}, At = ({
|
|
591
591
|
labelKey: c,
|
|
592
|
-
valueKey:
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
592
|
+
valueKey: h,
|
|
593
|
+
renderOption: m,
|
|
594
|
+
customSelectedOptionLabel: $,
|
|
595
|
+
options: N,
|
|
596
|
+
type: B,
|
|
597
|
+
value: V,
|
|
598
|
+
onChange: P,
|
|
599
|
+
onInputChange: M,
|
|
600
|
+
classNameWrapper: b,
|
|
601
|
+
"data-testid-wrapper": k,
|
|
602
|
+
classNameInputWrapper: U,
|
|
603
|
+
...K
|
|
602
604
|
}) => {
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
'[autocomplete] When options is a list of objects, you must provide the "labelKey" and "valueKey" parameters.'
|
|
605
|
+
const w = lt(), [pe, ee] = at("");
|
|
606
|
+
(N != null && N.some((i) => typeof i != "string") && !c && !m || !h) && console.error(
|
|
607
|
+
'[autocomplete] When options is a list of objects, you must provide the "labelKey" or "renderOption" and "valueKey" parameters.'
|
|
606
608
|
);
|
|
607
|
-
const { getRootProps:
|
|
608
|
-
id: `autocomplete_${
|
|
609
|
-
options:
|
|
610
|
-
getOptionLabel: (i) => typeof i == "string" ? i : String(i[c || "label"]),
|
|
611
|
-
value:
|
|
612
|
-
inputValue:
|
|
613
|
-
isOptionEqualToValue: (i, x) => typeof i == "string" ? String(i) === String(x) : String(i[
|
|
609
|
+
const { getRootProps: ge, getInputProps: te, getOptionProps: v, groupedOptions: R, getListboxProps: ne } = yt({
|
|
610
|
+
id: `autocomplete_${w}`,
|
|
611
|
+
options: N,
|
|
612
|
+
getOptionLabel: (i) => typeof i == "string" ? i : $ ? $(i) : String(i[c || "label"]),
|
|
613
|
+
value: V,
|
|
614
|
+
inputValue: pe,
|
|
615
|
+
isOptionEqualToValue: (i, x) => typeof i == "string" ? String(i) === String(x) : String(i[h || "id"]) === String(x[h || "id"]),
|
|
614
616
|
getOptionKey(i) {
|
|
615
|
-
return String(typeof i == "string" ? i : i[
|
|
617
|
+
return String(typeof i == "string" ? i : i[h || "id"]);
|
|
616
618
|
},
|
|
617
619
|
onChange: (i, x) => {
|
|
618
|
-
|
|
620
|
+
P && P(i, x);
|
|
619
621
|
},
|
|
620
622
|
onInputChange: (i, x) => {
|
|
621
|
-
|
|
623
|
+
M && M(i, x), ee(x);
|
|
622
624
|
},
|
|
623
|
-
onHighlightChange: (i, x,
|
|
624
|
-
var
|
|
625
|
-
if (
|
|
626
|
-
const
|
|
627
|
-
|
|
625
|
+
onHighlightChange: (i, x, W) => {
|
|
626
|
+
var H;
|
|
627
|
+
if (W === "keyboard") {
|
|
628
|
+
const L = document.querySelector("#autocomplete-list"), A = (i == null ? void 0 : i.target).getAttribute("aria-activedescendant");
|
|
629
|
+
L == null || L.querySelectorAll("li").forEach((l) => l.classList.remove(Z["option-focused"])), (H = L == null ? void 0 : L.querySelector(`[id="${A}"]`)) == null || H.classList.add(Z["option-focused"]);
|
|
628
630
|
}
|
|
629
631
|
}
|
|
630
|
-
}),
|
|
632
|
+
}), re = {
|
|
631
633
|
...te(),
|
|
632
|
-
...
|
|
633
|
-
classNameWrapper:
|
|
634
|
+
...K,
|
|
635
|
+
classNameWrapper: U
|
|
634
636
|
};
|
|
635
|
-
return /* @__PURE__ */
|
|
636
|
-
/* @__PURE__ */
|
|
637
|
+
return /* @__PURE__ */ Q("div", { className: ut(Z.autocomplete, b), "data-testid": k, children: /* @__PURE__ */ it("div", { ...ge(), children: [
|
|
638
|
+
/* @__PURE__ */ Q(
|
|
637
639
|
ft,
|
|
638
640
|
{
|
|
639
|
-
rightIcon:
|
|
640
|
-
...
|
|
641
|
+
rightIcon: B === "search" && /* @__PURE__ */ Q(ct, { color: "var(--accent)", icon: "magnifying-glass" }),
|
|
642
|
+
...re
|
|
641
643
|
}
|
|
642
644
|
),
|
|
643
|
-
|
|
645
|
+
R.length > 0 && !K.disabled && /* @__PURE__ */ Q(
|
|
644
646
|
"ul",
|
|
645
647
|
{
|
|
646
|
-
...
|
|
648
|
+
...ne(),
|
|
647
649
|
id: "autocomplete-list",
|
|
648
|
-
className:
|
|
649
|
-
children:
|
|
650
|
-
const
|
|
651
|
-
return /* @__PURE__ */
|
|
650
|
+
className: Z["autocomplete__dropdown-list"],
|
|
651
|
+
children: R.map((i, x) => {
|
|
652
|
+
const W = v({ option: i, index: x }), H = typeof i == "string" ? i : m ? m(i) : String(i[c || "label"]);
|
|
653
|
+
return /* @__PURE__ */ Q("li", { tabIndex: x, className: Z["autocomplete__dropdown-item"], ...W, children: H });
|
|
652
654
|
})
|
|
653
655
|
}
|
|
654
656
|
)
|