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