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