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