@pismo/marola 1.1.13 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Badge.css +1 -1
- package/dist/assets/PageHeader.css +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +3 -3
- package/dist/components/Autocomplete/Autocomplete.js +263 -266
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts +1 -1
- package/dist/components/Badge/Badge.js +21 -21
- package/dist/components/PageHeader/PageHeader.js +57 -57
- package/package.json +1 -1
package/dist/assets/Badge.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._badge-
|
|
1
|
+
._badge-root_40fsi_1{position:relative;box-sizing:border-box;display:inline-block;padding:0;margin:0;font-family:IBM Plex Sans,sans-serif;font-variant:tabular-nums;line-height:1;list-style:none}._badge_40fsi_1{position:absolute;top:.25rem;right:.5rem;z-index:auto;min-width:1rem;height:1rem;font-size:.75rem;font-weight:500;line-height:1rem;color:var(--white-100);text-align:center;white-space:nowrap;background-color:var(--error-text);border-radius:50%;transform:translate(50%,-50%);transform-origin:100% 0}._badge--red_40fsi_31{background-color:var(--error-text)}._badge--green_40fsi_34{background-color:var(--colors-brand-success-color-success)}._badge--blue_40fsi_37{background-color:var(--colors-brand-primary-color-primary-active)}._badge--blueInvert_40fsi_40{color:var(--colors-brand-primary-color-primary-active);background-color:var(--colors-brand-primary-color-primary-bg)}._badge--gray_40fsi_44{color:var(--black);background-color:rgb(from var(--black-100) r g b/15%)}._badge--basic_40fsi_48{line-height:.875rem;color:var(--black);background-color:var(--white-100);border:1px solid rgba(from var(--black-100) r g b/6%)}._badge--double_40fsi_54{width:1.625rem;border-radius:100px}._badge--triple_40fsi_58{width:2.5rem;border-radius:100px}._badge--medium_40fsi_62{min-width:1.25rem;min-height:1.25rem;line-height:1.25rem}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._u-typography-
|
|
1
|
+
._u-typography-h1_1oa3o_1{font-size:var(--heading-font-size-1);font-weight:var(--heading-font-weight);line-height:var(--heading-line-height-1);margin:0}._u-typography-h2_1oa3o_8{font-size:var(--heading-font-size-2);font-weight:var(--heading-font-weight);line-height:var(--heading-line-height-2);margin:0}._u-typography-h3_1oa3o_15{font-size:var(--heading-font-size-3);font-weight:var(--heading-font-weight);line-height:var(--heading-line-height-3);margin:0}._u-typography-h4_1oa3o_22{font-size:var(--heading-font-size-4);font-weight:var(--heading-font-weight);line-height:var(--heading-line-height-4);margin:0}._u-typography-h5_1oa3o_29{font-size:var(--heading-font-size-5);font-weight:var(--heading-font-weight);line-height:var(--heading-line-height-5);margin:0}._u-typography-h6_1oa3o_36{font-size:var(--heading-font-size-6);font-weight:var(--heading-font-weight);line-height:var(--heading-line-height-6);margin:0}._u-typography-base_1oa3o_43{margin:0;font-size:var(--base-font-size);font-weight:var(--base-weight);line-height:var(--base-line-height)}._u-typography-base--xxl_1oa3o_49{font-size:var(--base-font-size-xxl);line-height:var(--base-line-height-xxl)}._u-typography-base--xl_1oa3o_53{font-size:var(--base-font-size-xl);line-height:var(--base-line-height-xl)}._u-typography-base--lg_1oa3o_57{font-size:var(--base-font-size-lg);line-height:var(--base-line-height-lg)}._u-typography-base--sm_1oa3o_61{font-size:var(--base-font-size-sm);line-height:var(--base-line-height-sm)}._u-typography-base--bold_1oa3o_65{font-weight:var(--base-bold)}._u-typography-base--strikethrough_1oa3o_68{text-decoration:line-through}._u-typography-base--underlined_1oa3o_71{text-decoration:underline}._u-typography-base--strikethrough-underlined_1oa3o_74{text-decoration:underline line-through}._page-header_1oa3o_78{width:100%;min-height:7.375rem;background-color:var(--cream)}._page-header__main-content_1oa3o_83{position:relative;width:64rem;max-width:100%;padding:1rem 0;margin:0 auto}._page-header__bottom-content_1oa3o_90{width:64rem;max-width:100%;margin:0 auto}._page-header__breadcrumb_1oa3o_95{display:flex;gap:.5rem;align-items:center;height:2rem}._page-header__breadcrumb_1oa3o_95 button{padding:0;line-height:1.25rem;color:var(--colors-neutral-text-color-text)}._page-header__breadcrumb_1oa3o_95 button:active,._page-header__breadcrumb_1oa3o_95 button:focus{color:var(--colors-neutral-text-color-text);outline:none}._page-header__breadcrumb_1oa3o_95 button:hover:enabled{color:var(--accent-dark)}._page-header__breadcrumb_1oa3o_95 button *:not(svg){font-size:.75rem}._page-header__breadcrumb_1oa3o_95 button:disabled{color:var(--colors-neutral-text-color-text-tertiary)}._page-header__breadcrumb_1oa3o_95 button svg{width:1rem;height:1rem}._page-header__breadcrumb__separator_1oa3o_123{height:1.125rem;padding:0;line-height:1.125rem;color:var(--colors-neutral-text-color-text-description)}._page-header__right-children-wrapper_1oa3o_129{display:flex;align-items:center;justify-content:space-between}._header-bubble_1oa3o_135{flex:1}._header-bubble--container_1oa3o_138{position:absolute;max-width:80%;height:5.75rem;background-color:var(--white-100);border:1px solid var(--border-secondary);border-radius:8px}._header-bubble--container--full_1oa3o_146{max-width:100%}._header-bubble-margin_1oa3o_150{padding-bottom:1rem}
|
|
@@ -10,11 +10,11 @@ export type AutocompleteProps<T> = Omit<InputProps, 'onChange' | 'value'> & {
|
|
|
10
10
|
value?: T;
|
|
11
11
|
/** Options array */
|
|
12
12
|
options?: Array<T>;
|
|
13
|
+
/** CSS classes to be applied on the input container element */
|
|
14
|
+
classNameInputWrapper?: string;
|
|
13
15
|
/** callback for new option selected */
|
|
14
16
|
onChange?: (event: SyntheticEvent<Element, Event>, newValue: T) => void;
|
|
15
17
|
/** callback when characters are entered into the input box */
|
|
16
18
|
onInputChange?: (event: SyntheticEvent<Element, Event>, newValue: string) => void;
|
|
17
|
-
/** Id to be applied as `data-testid` on the container element */
|
|
18
|
-
'data-testid-wrapper'?: string;
|
|
19
19
|
};
|
|
20
|
-
export declare const Autocomplete: <T extends string | object>({ labelKey, valueKey, options, type, value, onChange, onInputChange, "data-testid-wrapper": dataTestId, ...props }: AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const Autocomplete: <T extends string | object>({ labelKey, valueKey, options, type, value, onChange, onInputChange, classNameWrapper, "data-testid-wrapper": dataTestId, classNameInputWrapper, ...props }: AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,123 +1,124 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as Z, jsxs as lt } from "react/jsx-runtime";
|
|
2
2
|
import * as h from "react";
|
|
3
|
-
import { useId as at, useState as ut
|
|
3
|
+
import { useId as at, useState as ut } from "react";
|
|
4
|
+
import { c as ct } from "../../clsx-DB4S2d7J.js";
|
|
4
5
|
import { Icon as pt } from "../Icon/Icon.js";
|
|
5
6
|
import { Input as ft } from "../Input/Input.js";
|
|
6
|
-
import { b as
|
|
7
|
+
import { b as Ve, s as dt } from "../../useSlotProps-C_I1kEHr.js";
|
|
7
8
|
import { u as gt } from "../../useId-BW-oWmul.js";
|
|
8
|
-
import { u as
|
|
9
|
-
import { u as
|
|
9
|
+
import { u as Ie } from "../../useControlled-CCMYYdCM.js";
|
|
10
|
+
import { u as ce } from "../../useEventCallback-BAQJJ3ye.js";
|
|
10
11
|
import '../../assets/Autocomplete.css';const ht = (c) => {
|
|
11
|
-
const
|
|
12
|
+
const m = h.useRef({});
|
|
12
13
|
return h.useEffect(() => {
|
|
13
|
-
|
|
14
|
-
}),
|
|
14
|
+
m.current = c;
|
|
15
|
+
}), m.current;
|
|
15
16
|
};
|
|
16
|
-
function
|
|
17
|
+
function Me(c) {
|
|
17
18
|
return typeof c.normalize < "u" ? c.normalize("NFD").replace(/[\u0300-\u036f]/g, "") : c;
|
|
18
19
|
}
|
|
19
20
|
function mt(c = {}) {
|
|
20
21
|
const {
|
|
21
|
-
ignoreAccents:
|
|
22
|
+
ignoreAccents: m = !0,
|
|
22
23
|
ignoreCase: g = !0,
|
|
23
|
-
limit:
|
|
24
|
-
matchFrom:
|
|
25
|
-
stringify:
|
|
26
|
-
trim:
|
|
24
|
+
limit: A,
|
|
25
|
+
matchFrom: J = "any",
|
|
26
|
+
stringify: j,
|
|
27
|
+
trim: D = !1
|
|
27
28
|
} = c;
|
|
28
|
-
return (
|
|
29
|
-
inputValue:
|
|
30
|
-
getOptionLabel:
|
|
29
|
+
return (C, {
|
|
30
|
+
inputValue: q,
|
|
31
|
+
getOptionLabel: b
|
|
31
32
|
}) => {
|
|
32
|
-
let
|
|
33
|
-
g && (
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
return g && (
|
|
37
|
-
}) :
|
|
38
|
-
return typeof
|
|
33
|
+
let I = D ? q.trim() : q;
|
|
34
|
+
g && (I = I.toLowerCase()), m && (I = Me(I));
|
|
35
|
+
const B = I ? C.filter((W) => {
|
|
36
|
+
let S = (j || b)(W);
|
|
37
|
+
return g && (S = S.toLowerCase()), m && (S = Me(S)), J === "start" ? S.indexOf(I) === 0 : S.indexOf(I) > -1;
|
|
38
|
+
}) : C;
|
|
39
|
+
return typeof A == "number" ? B.slice(0, A) : B;
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function pe(c, m) {
|
|
42
43
|
for (let g = 0; g < c.length; g += 1)
|
|
43
|
-
if (
|
|
44
|
+
if (m(c[g]))
|
|
44
45
|
return g;
|
|
45
46
|
return -1;
|
|
46
47
|
}
|
|
47
|
-
const bt = mt(),
|
|
48
|
-
var
|
|
49
|
-
return c.current !== null && ((
|
|
48
|
+
const bt = mt(), Re = 5, yt = (c) => {
|
|
49
|
+
var m;
|
|
50
|
+
return c.current !== null && ((m = c.current.parentElement) == null ? void 0 : m.contains(document.activeElement));
|
|
50
51
|
};
|
|
51
52
|
function xt(c) {
|
|
52
53
|
const {
|
|
53
54
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
54
|
-
unstable_isActiveElementInListbox:
|
|
55
|
+
unstable_isActiveElementInListbox: m = yt,
|
|
55
56
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
56
57
|
unstable_classNamePrefix: g = "Mui",
|
|
57
|
-
autoComplete:
|
|
58
|
-
autoHighlight:
|
|
59
|
-
autoSelect:
|
|
60
|
-
blurOnSelect:
|
|
61
|
-
clearOnBlur:
|
|
62
|
-
clearOnEscape:
|
|
63
|
-
componentName:
|
|
64
|
-
defaultValue:
|
|
65
|
-
disableClearable:
|
|
66
|
-
disableCloseOnSelect:
|
|
67
|
-
disabled:
|
|
68
|
-
disabledItemsFocusable:
|
|
69
|
-
disableListWrap:
|
|
70
|
-
filterOptions:
|
|
71
|
-
filterSelectedOptions:
|
|
72
|
-
freeSolo:
|
|
73
|
-
getOptionDisabled:
|
|
74
|
-
getOptionKey:
|
|
75
|
-
getOptionLabel:
|
|
58
|
+
autoComplete: A = !1,
|
|
59
|
+
autoHighlight: J = !1,
|
|
60
|
+
autoSelect: j = !1,
|
|
61
|
+
blurOnSelect: D = !1,
|
|
62
|
+
clearOnBlur: C = !c.freeSolo,
|
|
63
|
+
clearOnEscape: q = !1,
|
|
64
|
+
componentName: b = "useAutocomplete",
|
|
65
|
+
defaultValue: I = c.multiple ? [] : null,
|
|
66
|
+
disableClearable: B = !1,
|
|
67
|
+
disableCloseOnSelect: W = !1,
|
|
68
|
+
disabled: S,
|
|
69
|
+
disabledItemsFocusable: fe = !1,
|
|
70
|
+
disableListWrap: te = !1,
|
|
71
|
+
filterOptions: de = bt,
|
|
72
|
+
filterSelectedOptions: Y = !1,
|
|
73
|
+
freeSolo: N = !1,
|
|
74
|
+
getOptionDisabled: U,
|
|
75
|
+
getOptionKey: i,
|
|
76
|
+
getOptionLabel: y = (t) => {
|
|
76
77
|
var e;
|
|
77
78
|
return (e = t.label) != null ? e : t;
|
|
78
79
|
},
|
|
79
|
-
groupBy:
|
|
80
|
-
handleHomeEndKeys:
|
|
81
|
-
id:
|
|
82
|
-
includeInputInList:
|
|
83
|
-
inputValue:
|
|
80
|
+
groupBy: L,
|
|
81
|
+
handleHomeEndKeys: V = !c.freeSolo,
|
|
82
|
+
id: v,
|
|
83
|
+
includeInputInList: re = !1,
|
|
84
|
+
inputValue: ge,
|
|
84
85
|
isOptionEqualToValue: M = (t, e) => t === e,
|
|
85
86
|
multiple: u = !1,
|
|
86
|
-
onChange:
|
|
87
|
-
onClose:
|
|
88
|
-
onHighlightChange:
|
|
87
|
+
onChange: Se,
|
|
88
|
+
onClose: we,
|
|
89
|
+
onHighlightChange: ke,
|
|
89
90
|
onInputChange: R,
|
|
90
|
-
onOpen:
|
|
91
|
+
onOpen: Ee,
|
|
91
92
|
open: He,
|
|
92
93
|
openOnFocus: Fe = !1,
|
|
93
|
-
options:
|
|
94
|
-
readOnly:
|
|
94
|
+
options: he,
|
|
95
|
+
readOnly: X = !1,
|
|
95
96
|
selectOnFocus: qe = !c.freeSolo,
|
|
96
97
|
value: Be
|
|
97
|
-
} = c,
|
|
98
|
-
let
|
|
99
|
-
|
|
100
|
-
const e =
|
|
98
|
+
} = c, k = gt(v);
|
|
99
|
+
let _ = y;
|
|
100
|
+
_ = (t) => {
|
|
101
|
+
const e = y(t);
|
|
101
102
|
if (typeof e != "string") {
|
|
102
103
|
if (process.env.NODE_ENV !== "production") {
|
|
103
104
|
const r = e === void 0 ? "undefined" : `${typeof e} (${e})`;
|
|
104
|
-
console.error(`MUI: The \`getOptionLabel\` method of ${
|
|
105
|
+
console.error(`MUI: The \`getOptionLabel\` method of ${b} returned ${r} instead of a string for ${JSON.stringify(t)}.`);
|
|
105
106
|
}
|
|
106
107
|
return String(e);
|
|
107
108
|
}
|
|
108
109
|
return e;
|
|
109
110
|
};
|
|
110
|
-
const
|
|
111
|
+
const me = h.useRef(!1), be = h.useRef(!0), f = h.useRef(null), E = h.useRef(null), [oe, Ue] = h.useState(null), [T, ye] = h.useState(-1), Te = J ? 0 : -1, x = h.useRef(Te), [o, Ke] = Ie({
|
|
111
112
|
controlled: Be,
|
|
112
|
-
default:
|
|
113
|
-
name:
|
|
114
|
-
}), [a,
|
|
115
|
-
controlled:
|
|
113
|
+
default: I,
|
|
114
|
+
name: b
|
|
115
|
+
}), [a, ne] = Ie({
|
|
116
|
+
controlled: ge,
|
|
116
117
|
default: "",
|
|
117
|
-
name:
|
|
118
|
+
name: b,
|
|
118
119
|
state: "inputValue"
|
|
119
|
-
}), [
|
|
120
|
-
if (!(u ? o.length < e.length : e !== null) && !
|
|
120
|
+
}), [se, $e] = h.useState(!1), ie = h.useCallback((t, e) => {
|
|
121
|
+
if (!(u ? o.length < e.length : e !== null) && !C)
|
|
121
122
|
return;
|
|
122
123
|
let n;
|
|
123
124
|
if (u)
|
|
@@ -125,120 +126,120 @@ function xt(c) {
|
|
|
125
126
|
else if (e == null)
|
|
126
127
|
n = "";
|
|
127
128
|
else {
|
|
128
|
-
const s =
|
|
129
|
+
const s = _(e);
|
|
129
130
|
n = typeof s == "string" ? s : "";
|
|
130
131
|
}
|
|
131
|
-
a !== n && (
|
|
132
|
-
}, [
|
|
132
|
+
a !== n && (ne(n), R && R(t, n, "reset"));
|
|
133
|
+
}, [_, a, u, R, ne, C, o]), [K, Pe] = Ie({
|
|
133
134
|
controlled: He,
|
|
134
135
|
default: !1,
|
|
135
|
-
name:
|
|
136
|
+
name: b,
|
|
136
137
|
state: "open"
|
|
137
|
-
}), [ze,
|
|
138
|
-
|
|
138
|
+
}), [ze, Ae] = h.useState(!0), De = !u && o != null && a === _(o), w = K && !X, p = w ? de(
|
|
139
|
+
he.filter((t) => !(Y && (u ? o : [o]).some((e) => e !== null && M(t, e)))),
|
|
139
140
|
// we use the empty string to manipulate `filterOptions` to not filter any options
|
|
140
141
|
// i.e. the filter predicate always returns true
|
|
141
142
|
{
|
|
142
|
-
inputValue:
|
|
143
|
-
getOptionLabel:
|
|
143
|
+
inputValue: De && ze ? "" : a,
|
|
144
|
+
getOptionLabel: _
|
|
144
145
|
}
|
|
145
|
-
) : [],
|
|
146
|
+
) : [], $ = ht({
|
|
146
147
|
filteredOptions: p,
|
|
147
148
|
value: o,
|
|
148
149
|
inputValue: a
|
|
149
150
|
});
|
|
150
151
|
h.useEffect(() => {
|
|
151
|
-
const t = o !==
|
|
152
|
-
|
|
153
|
-
}, [o,
|
|
154
|
-
const
|
|
155
|
-
if (process.env.NODE_ENV !== "production" && o !== null && !
|
|
156
|
-
const t = (u ? o : [o]).filter((e) => !
|
|
157
|
-
t.length > 0 && console.warn([`MUI: The value provided to ${
|
|
152
|
+
const t = o !== $.value;
|
|
153
|
+
se && !t || N && !t || ie(null, o);
|
|
154
|
+
}, [o, ie, se, $.value, N]);
|
|
155
|
+
const xe = K && p.length > 0 && !X;
|
|
156
|
+
if (process.env.NODE_ENV !== "production" && o !== null && !N && he.length > 0) {
|
|
157
|
+
const t = (u ? o : [o]).filter((e) => !he.some((r) => M(r, e)));
|
|
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(`
|
|
158
159
|
`));
|
|
159
160
|
}
|
|
160
|
-
const
|
|
161
|
-
t === -1 ? f.current.focus() :
|
|
161
|
+
const le = ce((t) => {
|
|
162
|
+
t === -1 ? f.current.focus() : oe.querySelector(`[data-tag-index="${t}"]`).focus();
|
|
162
163
|
});
|
|
163
164
|
h.useEffect(() => {
|
|
164
|
-
u &&
|
|
165
|
-
}, [o, u,
|
|
165
|
+
u && T > o.length - 1 && (ye(-1), le(-1));
|
|
166
|
+
}, [o, u, T, le]);
|
|
166
167
|
function Je(t, e) {
|
|
167
|
-
if (!
|
|
168
|
+
if (!E.current || t < 0 || t >= p.length)
|
|
168
169
|
return -1;
|
|
169
170
|
let r = t;
|
|
170
171
|
for (; ; ) {
|
|
171
|
-
const n =
|
|
172
|
+
const n = E.current.querySelector(`[data-option-index="${r}"]`), s = fe ? !1 : !n || n.disabled || n.getAttribute("aria-disabled") === "true";
|
|
172
173
|
if (n && n.hasAttribute("tabindex") && !s)
|
|
173
174
|
return r;
|
|
174
175
|
if (e === "next" ? r = (r + 1) % p.length : r = (r - 1 + p.length) % p.length, r === t)
|
|
175
176
|
return -1;
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
|
-
const H =
|
|
179
|
+
const H = ce(({
|
|
179
180
|
event: t,
|
|
180
181
|
index: e,
|
|
181
182
|
reason: r = "auto"
|
|
182
183
|
}) => {
|
|
183
|
-
if (x.current = e, e === -1 ? f.current.removeAttribute("aria-activedescendant") : f.current.setAttribute("aria-activedescendant", `${
|
|
184
|
+
if (x.current = e, e === -1 ? f.current.removeAttribute("aria-activedescendant") : f.current.setAttribute("aria-activedescendant", `${k}-option-${e}`), ke && ke(t, e === -1 ? null : p[e], r), !E.current)
|
|
184
185
|
return;
|
|
185
|
-
const n =
|
|
186
|
+
const n = E.current.querySelector(`[role="option"].${g}-focused`);
|
|
186
187
|
n && (n.classList.remove(`${g}-focused`), n.classList.remove(`${g}-focusVisible`));
|
|
187
|
-
let s =
|
|
188
|
-
if (
|
|
188
|
+
let s = E.current;
|
|
189
|
+
if (E.current.getAttribute("role") !== "listbox" && (s = E.current.parentElement.querySelector('[role="listbox"]')), !s)
|
|
189
190
|
return;
|
|
190
191
|
if (e === -1) {
|
|
191
192
|
s.scrollTop = 0;
|
|
192
193
|
return;
|
|
193
194
|
}
|
|
194
|
-
const l =
|
|
195
|
+
const l = E.current.querySelector(`[data-option-index="${e}"]`);
|
|
195
196
|
if (l && (l.classList.add(`${g}-focused`), r === "keyboard" && l.classList.add(`${g}-focusVisible`), s.scrollHeight > s.clientHeight && r !== "mouse" && r !== "touch")) {
|
|
196
|
-
const d = l,
|
|
197
|
-
|
|
197
|
+
const d = l, O = s.clientHeight + s.scrollTop, ue = d.offsetTop + d.offsetHeight;
|
|
198
|
+
ue > O ? s.scrollTop = ue - s.clientHeight : d.offsetTop - d.offsetHeight * (L ? 1.3 : 0) < s.scrollTop && (s.scrollTop = d.offsetTop - d.offsetHeight * (L ? 1.3 : 0));
|
|
198
199
|
}
|
|
199
|
-
}),
|
|
200
|
+
}), P = ce(({
|
|
200
201
|
event: t,
|
|
201
202
|
diff: e,
|
|
202
203
|
direction: r = "next",
|
|
203
204
|
reason: n = "auto"
|
|
204
205
|
}) => {
|
|
205
|
-
if (!
|
|
206
|
+
if (!w)
|
|
206
207
|
return;
|
|
207
208
|
const l = Je((() => {
|
|
208
209
|
const d = p.length - 1;
|
|
209
210
|
if (e === "reset")
|
|
210
|
-
return
|
|
211
|
+
return Te;
|
|
211
212
|
if (e === "start")
|
|
212
213
|
return 0;
|
|
213
214
|
if (e === "end")
|
|
214
215
|
return d;
|
|
215
|
-
const
|
|
216
|
-
return
|
|
216
|
+
const O = x.current + e;
|
|
217
|
+
return O < 0 ? O === -1 && re ? -1 : te && x.current !== -1 || Math.abs(e) > 1 ? 0 : d : O > d ? O === d + 1 && re ? -1 : te || Math.abs(e) > 1 ? d : 0 : O;
|
|
217
218
|
})(), r);
|
|
218
219
|
if (H({
|
|
219
220
|
index: l,
|
|
220
221
|
reason: n,
|
|
221
222
|
event: t
|
|
222
|
-
}),
|
|
223
|
+
}), A && e !== "reset")
|
|
223
224
|
if (l === -1)
|
|
224
225
|
f.current.value = a;
|
|
225
226
|
else {
|
|
226
|
-
const d =
|
|
227
|
+
const d = _(p[l]);
|
|
227
228
|
f.current.value = d, d.toLowerCase().indexOf(a.toLowerCase()) === 0 && a.length > 0 && f.current.setSelectionRange(a.length, d.length);
|
|
228
229
|
}
|
|
229
230
|
}), We = () => {
|
|
230
231
|
const t = (e, r) => {
|
|
231
|
-
const n = e ?
|
|
232
|
+
const n = e ? _(e) : "", s = r ? _(r) : "";
|
|
232
233
|
return n === s;
|
|
233
234
|
};
|
|
234
|
-
if (x.current !== -1 &&
|
|
235
|
-
const e =
|
|
235
|
+
if (x.current !== -1 && $.filteredOptions && $.filteredOptions.length !== p.length && $.inputValue === a && (u ? o.length === $.value.length && $.value.every((e, r) => _(o[r]) === _(e)) : t($.value, o))) {
|
|
236
|
+
const e = $.filteredOptions[x.current];
|
|
236
237
|
if (e)
|
|
237
|
-
return
|
|
238
|
+
return pe(p, (r) => _(r) === _(e));
|
|
238
239
|
}
|
|
239
240
|
return -1;
|
|
240
|
-
},
|
|
241
|
-
if (!
|
|
241
|
+
}, _e = h.useCallback(() => {
|
|
242
|
+
if (!w)
|
|
242
243
|
return;
|
|
243
244
|
const t = We();
|
|
244
245
|
if (t !== -1) {
|
|
@@ -247,18 +248,18 @@ function xt(c) {
|
|
|
247
248
|
}
|
|
248
249
|
const e = u ? o[0] : o;
|
|
249
250
|
if (p.length === 0 || e == null) {
|
|
250
|
-
|
|
251
|
+
P({
|
|
251
252
|
diff: "reset"
|
|
252
253
|
});
|
|
253
254
|
return;
|
|
254
255
|
}
|
|
255
|
-
if (
|
|
256
|
+
if (E.current) {
|
|
256
257
|
if (e != null) {
|
|
257
258
|
const r = p[x.current];
|
|
258
|
-
if (u && r &&
|
|
259
|
+
if (u && r && pe(o, (s) => M(r, s)) !== -1)
|
|
259
260
|
return;
|
|
260
|
-
const n =
|
|
261
|
-
n === -1 ?
|
|
261
|
+
const n = pe(p, (s) => M(s, e));
|
|
262
|
+
n === -1 ? P({
|
|
262
263
|
diff: "reset"
|
|
263
264
|
}) : H({
|
|
264
265
|
index: n
|
|
@@ -281,47 +282,47 @@ function xt(c) {
|
|
|
281
282
|
// Don't sync the highlighted index with the value when multiple
|
|
282
283
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
283
284
|
u ? !1 : o,
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
Y,
|
|
286
|
+
P,
|
|
286
287
|
H,
|
|
287
|
-
|
|
288
|
+
w,
|
|
288
289
|
a,
|
|
289
290
|
u
|
|
290
|
-
]), Ye =
|
|
291
|
-
dt(
|
|
291
|
+
]), Ye = ce((t) => {
|
|
292
|
+
dt(E, t), t && _e();
|
|
292
293
|
});
|
|
293
294
|
process.env.NODE_ENV !== "production" && h.useEffect(() => {
|
|
294
|
-
(!f.current || f.current.nodeName !== "INPUT") && (f.current && f.current.nodeName === "TEXTAREA" ? console.warn([`A textarea element was provided to ${
|
|
295
|
-
`)) : console.error([`MUI: Unable to find the input element. It was resolved to ${f.current} while an HTMLInputElement was expected.`, `Instead, ${
|
|
295
|
+
(!f.current || f.current.nodeName !== "INPUT") && (f.current && f.current.nodeName === "TEXTAREA" ? console.warn([`A textarea element was provided to ${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 ${f.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(`
|
|
296
297
|
`)));
|
|
297
|
-
}, [
|
|
298
|
-
|
|
299
|
-
}, [
|
|
298
|
+
}, [b]), h.useEffect(() => {
|
|
299
|
+
_e();
|
|
300
|
+
}, [_e]);
|
|
300
301
|
const F = (t) => {
|
|
301
|
-
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
},
|
|
302
|
+
K || (Pe(!0), Ae(!0), Ee && Ee(t));
|
|
303
|
+
}, G = (t, e) => {
|
|
304
|
+
K && (Pe(!1), we && we(t, e));
|
|
305
|
+
}, z = (t, e, r, n) => {
|
|
305
306
|
if (u) {
|
|
306
307
|
if (o.length === e.length && o.every((s, l) => s === e[l]))
|
|
307
308
|
return;
|
|
308
309
|
} else if (o === e)
|
|
309
310
|
return;
|
|
310
|
-
|
|
311
|
-
},
|
|
311
|
+
Se && Se(t, e, r, n), Ke(e);
|
|
312
|
+
}, ae = h.useRef(!1), Q = (t, e, r = "selectOption", n = "options") => {
|
|
312
313
|
let s = r, l = e;
|
|
313
314
|
if (u) {
|
|
314
315
|
if (l = Array.isArray(o) ? o.slice() : [], process.env.NODE_ENV !== "production") {
|
|
315
|
-
const
|
|
316
|
-
|
|
316
|
+
const O = l.filter((ue) => M(e, ue));
|
|
317
|
+
O.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 ${O.length} matches.`].join(`
|
|
317
318
|
`));
|
|
318
319
|
}
|
|
319
|
-
const d =
|
|
320
|
+
const d = pe(l, (O) => M(e, O));
|
|
320
321
|
d === -1 ? l.push(e) : n !== "freeSolo" && (l.splice(d, 1), s = "removeOption");
|
|
321
322
|
}
|
|
322
|
-
|
|
323
|
+
ie(t, l), z(t, l, s, {
|
|
323
324
|
option: e
|
|
324
|
-
}), !
|
|
325
|
+
}), !W && (!t || !t.ctrlKey && !t.metaKey) && G(t, s), (D === !0 || D === "touch" && ae.current || D === "mouse" && !ae.current) && f.current.blur();
|
|
325
326
|
};
|
|
326
327
|
function Xe(t, e) {
|
|
327
328
|
if (t === -1)
|
|
@@ -330,26 +331,26 @@ function xt(c) {
|
|
|
330
331
|
for (; ; ) {
|
|
331
332
|
if (e === "next" && r === o.length || e === "previous" && r === -1)
|
|
332
333
|
return -1;
|
|
333
|
-
const n =
|
|
334
|
+
const n = oe.querySelector(`[data-tag-index="${r}"]`);
|
|
334
335
|
if (!n || !n.hasAttribute("tabindex") || n.disabled || n.getAttribute("aria-disabled") === "true")
|
|
335
336
|
r += e === "next" ? 1 : -1;
|
|
336
337
|
else
|
|
337
338
|
return r;
|
|
338
339
|
}
|
|
339
340
|
}
|
|
340
|
-
const
|
|
341
|
+
const Ce = (t, e) => {
|
|
341
342
|
if (!u)
|
|
342
343
|
return;
|
|
343
|
-
a === "" &&
|
|
344
|
-
let r =
|
|
345
|
-
|
|
346
|
-
},
|
|
347
|
-
|
|
344
|
+
a === "" && G(t, "toggleInput");
|
|
345
|
+
let r = T;
|
|
346
|
+
T === -1 ? a === "" && e === "previous" && (r = o.length - 1) : (r += e === "next" ? 1 : -1, r < 0 && (r = 0), r === o.length && (r = -1)), r = Xe(r, e), ye(r), le(r);
|
|
347
|
+
}, Ne = (t) => {
|
|
348
|
+
me.current = !0, ne(""), R && R(t, "", "clear"), z(t, u ? [] : null, "clear");
|
|
348
349
|
}, Ge = (t) => (e) => {
|
|
349
|
-
if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && (
|
|
350
|
+
if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && (T !== -1 && ["ArrowLeft", "ArrowRight"].indexOf(e.key) === -1 && (ye(-1), le(-1)), e.which !== 229))
|
|
350
351
|
switch (e.key) {
|
|
351
352
|
case "Home":
|
|
352
|
-
|
|
353
|
+
w && V && (e.preventDefault(), P({
|
|
353
354
|
diff: "start",
|
|
354
355
|
direction: "next",
|
|
355
356
|
reason: "keyboard",
|
|
@@ -357,7 +358,7 @@ function xt(c) {
|
|
|
357
358
|
}));
|
|
358
359
|
break;
|
|
359
360
|
case "End":
|
|
360
|
-
|
|
361
|
+
w && V && (e.preventDefault(), P({
|
|
361
362
|
diff: "end",
|
|
362
363
|
direction: "previous",
|
|
363
364
|
reason: "keyboard",
|
|
@@ -365,23 +366,23 @@ function xt(c) {
|
|
|
365
366
|
}));
|
|
366
367
|
break;
|
|
367
368
|
case "PageUp":
|
|
368
|
-
e.preventDefault(),
|
|
369
|
-
diff: -
|
|
369
|
+
e.preventDefault(), P({
|
|
370
|
+
diff: -Re,
|
|
370
371
|
direction: "previous",
|
|
371
372
|
reason: "keyboard",
|
|
372
373
|
event: e
|
|
373
374
|
}), F(e);
|
|
374
375
|
break;
|
|
375
376
|
case "PageDown":
|
|
376
|
-
e.preventDefault(),
|
|
377
|
-
diff:
|
|
377
|
+
e.preventDefault(), P({
|
|
378
|
+
diff: Re,
|
|
378
379
|
direction: "next",
|
|
379
380
|
reason: "keyboard",
|
|
380
381
|
event: e
|
|
381
382
|
}), F(e);
|
|
382
383
|
break;
|
|
383
384
|
case "ArrowDown":
|
|
384
|
-
e.preventDefault(),
|
|
385
|
+
e.preventDefault(), P({
|
|
385
386
|
diff: 1,
|
|
386
387
|
direction: "next",
|
|
387
388
|
reason: "keyboard",
|
|
@@ -389,7 +390,7 @@ function xt(c) {
|
|
|
389
390
|
}), F(e);
|
|
390
391
|
break;
|
|
391
392
|
case "ArrowUp":
|
|
392
|
-
e.preventDefault(),
|
|
393
|
+
e.preventDefault(), P({
|
|
393
394
|
diff: -1,
|
|
394
395
|
direction: "previous",
|
|
395
396
|
reason: "keyboard",
|
|
@@ -397,51 +398,51 @@ function xt(c) {
|
|
|
397
398
|
}), F(e);
|
|
398
399
|
break;
|
|
399
400
|
case "ArrowLeft":
|
|
400
|
-
|
|
401
|
+
Ce(e, "previous");
|
|
401
402
|
break;
|
|
402
403
|
case "ArrowRight":
|
|
403
|
-
|
|
404
|
+
Ce(e, "next");
|
|
404
405
|
break;
|
|
405
406
|
case "Enter":
|
|
406
|
-
if (x.current !== -1 &&
|
|
407
|
-
const r = p[x.current], n =
|
|
407
|
+
if (x.current !== -1 && w) {
|
|
408
|
+
const r = p[x.current], n = U ? U(r) : !1;
|
|
408
409
|
if (e.preventDefault(), n)
|
|
409
410
|
return;
|
|
410
|
-
|
|
411
|
+
Q(e, r, "selectOption"), A && f.current.setSelectionRange(f.current.value.length, f.current.value.length);
|
|
411
412
|
} else
|
|
412
|
-
|
|
413
|
+
N && a !== "" && De === !1 && (u && e.preventDefault(), Q(e, a, "createOption", "freeSolo"));
|
|
413
414
|
break;
|
|
414
415
|
case "Escape":
|
|
415
|
-
|
|
416
|
+
w ? (e.preventDefault(), e.stopPropagation(), G(e, "escape")) : q && (a !== "" || u && o.length > 0) && (e.preventDefault(), e.stopPropagation(), Ne(e));
|
|
416
417
|
break;
|
|
417
418
|
case "Backspace":
|
|
418
|
-
if (u && !
|
|
419
|
-
const r =
|
|
420
|
-
n.splice(r, 1),
|
|
419
|
+
if (u && !X && a === "" && o.length > 0) {
|
|
420
|
+
const r = T === -1 ? o.length - 1 : T, n = o.slice();
|
|
421
|
+
n.splice(r, 1), z(e, n, "removeOption", {
|
|
421
422
|
option: o[r]
|
|
422
423
|
});
|
|
423
424
|
}
|
|
424
425
|
break;
|
|
425
426
|
case "Delete":
|
|
426
|
-
if (u && !
|
|
427
|
-
const r =
|
|
428
|
-
n.splice(r, 1),
|
|
427
|
+
if (u && !X && a === "" && o.length > 0 && T !== -1) {
|
|
428
|
+
const r = T, n = o.slice();
|
|
429
|
+
n.splice(r, 1), z(e, n, "removeOption", {
|
|
429
430
|
option: o[r]
|
|
430
431
|
});
|
|
431
432
|
}
|
|
432
433
|
break;
|
|
433
434
|
}
|
|
434
435
|
}, Qe = (t) => {
|
|
435
|
-
|
|
436
|
-
},
|
|
437
|
-
if (
|
|
436
|
+
$e(!0), Fe && !me.current && F(t);
|
|
437
|
+
}, Le = (t) => {
|
|
438
|
+
if (m(E)) {
|
|
438
439
|
f.current.focus();
|
|
439
440
|
return;
|
|
440
441
|
}
|
|
441
|
-
|
|
442
|
+
$e(!1), be.current = !0, me.current = !1, j && x.current !== -1 && w ? Q(t, p[x.current], "blur") : j && N && a !== "" ? Q(t, a, "blur", "freeSolo") : C && ie(t, o), G(t, "blur");
|
|
442
443
|
}, Ze = (t) => {
|
|
443
444
|
const e = t.target.value;
|
|
444
|
-
a !== e && (
|
|
445
|
+
a !== e && (ne(e), Ae(!1), R && R(t, e, "input")), e === "" ? !B && !u && z(t, null, "clear") : F(t);
|
|
445
446
|
}, et = (t) => {
|
|
446
447
|
const e = Number(t.currentTarget.getAttribute("data-option-index"));
|
|
447
448
|
x.current !== e && H({
|
|
@@ -454,33 +455,33 @@ function xt(c) {
|
|
|
454
455
|
event: t,
|
|
455
456
|
index: Number(t.currentTarget.getAttribute("data-option-index")),
|
|
456
457
|
reason: "touch"
|
|
457
|
-
}),
|
|
458
|
+
}), ae.current = !0;
|
|
458
459
|
}, rt = (t) => {
|
|
459
460
|
const e = Number(t.currentTarget.getAttribute("data-option-index"));
|
|
460
|
-
|
|
461
|
+
Q(t, p[e], "selectOption"), ae.current = !1;
|
|
461
462
|
}, ot = (t) => (e) => {
|
|
462
463
|
const r = o.slice();
|
|
463
|
-
r.splice(t, 1),
|
|
464
|
+
r.splice(t, 1), z(e, r, "removeOption", {
|
|
464
465
|
option: o[t]
|
|
465
466
|
});
|
|
466
467
|
}, ve = (t) => {
|
|
467
|
-
|
|
468
|
+
K ? G(t, "toggleInput") : F(t);
|
|
468
469
|
}, nt = (t) => {
|
|
469
|
-
t.currentTarget.contains(t.target) && t.target.getAttribute("id") !==
|
|
470
|
+
t.currentTarget.contains(t.target) && t.target.getAttribute("id") !== k && t.preventDefault();
|
|
470
471
|
}, st = (t) => {
|
|
471
|
-
t.currentTarget.contains(t.target) && (f.current.focus(), qe &&
|
|
472
|
+
t.currentTarget.contains(t.target) && (f.current.focus(), qe && be.current && f.current.selectionEnd - f.current.selectionStart === 0 && f.current.select(), be.current = !1);
|
|
472
473
|
}, it = (t) => {
|
|
473
|
-
!
|
|
474
|
+
!S && (a === "" || !K) && ve(t);
|
|
474
475
|
};
|
|
475
|
-
let
|
|
476
|
-
|
|
477
|
-
let
|
|
478
|
-
if (
|
|
476
|
+
let Oe = N && a.length > 0;
|
|
477
|
+
Oe = Oe || (u ? o.length > 0 : o !== null);
|
|
478
|
+
let je = p;
|
|
479
|
+
if (L) {
|
|
479
480
|
const t = /* @__PURE__ */ new Map();
|
|
480
481
|
let e = !1;
|
|
481
|
-
|
|
482
|
-
const l =
|
|
483
|
-
return r.length > 0 && r[r.length - 1].group === l ? r[r.length - 1].options.push(n) : (process.env.NODE_ENV !== "production" && (t.get(l) && !e && (console.warn(`MUI: The options provided combined with the \`groupBy\` method of ${
|
|
482
|
+
je = p.reduce((r, n, s) => {
|
|
483
|
+
const l = L(n);
|
|
484
|
+
return r.length > 0 && r[r.length - 1].group === l ? r[r.length - 1].options.push(n) : (process.env.NODE_ENV !== "production" && (t.get(l) && !e && (console.warn(`MUI: The options provided combined with the \`groupBy\` method of ${b} returns duplicated headers.`, "You can solve the issue by sorting the options with the output of `groupBy`."), e = !0), t.set(l, !0)), r.push({
|
|
484
485
|
key: s,
|
|
485
486
|
index: s,
|
|
486
487
|
group: l,
|
|
@@ -488,31 +489,31 @@ function xt(c) {
|
|
|
488
489
|
})), r;
|
|
489
490
|
}, []);
|
|
490
491
|
}
|
|
491
|
-
return
|
|
492
|
-
getRootProps: (t = {}) =>
|
|
493
|
-
"aria-owns":
|
|
492
|
+
return S && se && Le(), {
|
|
493
|
+
getRootProps: (t = {}) => Ve({
|
|
494
|
+
"aria-owns": xe ? `${k}-listbox` : null
|
|
494
495
|
}, t, {
|
|
495
496
|
onKeyDown: Ge(t),
|
|
496
497
|
onMouseDown: nt,
|
|
497
498
|
onClick: st
|
|
498
499
|
}),
|
|
499
500
|
getInputLabelProps: () => ({
|
|
500
|
-
id: `${
|
|
501
|
-
htmlFor:
|
|
501
|
+
id: `${k}-label`,
|
|
502
|
+
htmlFor: k
|
|
502
503
|
}),
|
|
503
504
|
getInputProps: () => ({
|
|
504
|
-
id:
|
|
505
|
+
id: k,
|
|
505
506
|
value: a,
|
|
506
|
-
onBlur:
|
|
507
|
+
onBlur: Le,
|
|
507
508
|
onFocus: Qe,
|
|
508
509
|
onChange: Ze,
|
|
509
510
|
onMouseDown: it,
|
|
510
511
|
// if open then this is handled imperatively so don't let react override
|
|
511
512
|
// only have an opinion about this when closed
|
|
512
|
-
"aria-activedescendant":
|
|
513
|
-
"aria-autocomplete":
|
|
514
|
-
"aria-controls":
|
|
515
|
-
"aria-expanded":
|
|
513
|
+
"aria-activedescendant": w ? "" : null,
|
|
514
|
+
"aria-autocomplete": A ? "both" : "list",
|
|
515
|
+
"aria-controls": xe ? `${k}-listbox` : void 0,
|
|
516
|
+
"aria-expanded": xe,
|
|
516
517
|
// Disable browser's suggestion that might overlap with the popup.
|
|
517
518
|
// Handle autocomplete but not autofill.
|
|
518
519
|
autoComplete: "off",
|
|
@@ -520,12 +521,12 @@ function xt(c) {
|
|
|
520
521
|
autoCapitalize: "none",
|
|
521
522
|
spellCheck: "false",
|
|
522
523
|
role: "combobox",
|
|
523
|
-
disabled:
|
|
524
|
+
disabled: S
|
|
524
525
|
}),
|
|
525
526
|
getClearProps: () => ({
|
|
526
527
|
tabIndex: -1,
|
|
527
528
|
type: "button",
|
|
528
|
-
onClick:
|
|
529
|
+
onClick: Ne
|
|
529
530
|
}),
|
|
530
531
|
getPopupIndicatorProps: () => ({
|
|
531
532
|
tabIndex: -1,
|
|
@@ -534,17 +535,17 @@ function xt(c) {
|
|
|
534
535
|
}),
|
|
535
536
|
getTagProps: ({
|
|
536
537
|
index: t
|
|
537
|
-
}) =>
|
|
538
|
+
}) => Ve({
|
|
538
539
|
key: t,
|
|
539
540
|
"data-tag-index": t,
|
|
540
541
|
tabIndex: -1
|
|
541
|
-
}, !
|
|
542
|
+
}, !X && {
|
|
542
543
|
onDelete: ot(t)
|
|
543
544
|
}),
|
|
544
545
|
getListboxProps: () => ({
|
|
545
546
|
role: "listbox",
|
|
546
|
-
id: `${
|
|
547
|
-
"aria-labelledby": `${
|
|
547
|
+
id: `${k}-listbox`,
|
|
548
|
+
"aria-labelledby": `${k}-label`,
|
|
548
549
|
ref: Ye,
|
|
549
550
|
onMouseDown: (t) => {
|
|
550
551
|
t.preventDefault();
|
|
@@ -555,12 +556,12 @@ function xt(c) {
|
|
|
555
556
|
option: e
|
|
556
557
|
}) => {
|
|
557
558
|
var r;
|
|
558
|
-
const n = (u ? o : [o]).some((l) => l != null && M(e, l)), s =
|
|
559
|
+
const n = (u ? o : [o]).some((l) => l != null && M(e, l)), s = U ? U(e) : !1;
|
|
559
560
|
return {
|
|
560
|
-
key: (r =
|
|
561
|
+
key: (r = i == null ? void 0 : i(e)) != null ? r : _(e),
|
|
561
562
|
tabIndex: -1,
|
|
562
563
|
role: "option",
|
|
563
|
-
id: `${
|
|
564
|
+
id: `${k}-option-${t}`,
|
|
564
565
|
onMouseMove: et,
|
|
565
566
|
onClick: rt,
|
|
566
567
|
onTouchStart: tt,
|
|
@@ -569,20 +570,20 @@ function xt(c) {
|
|
|
569
570
|
"aria-selected": n
|
|
570
571
|
};
|
|
571
572
|
},
|
|
572
|
-
id:
|
|
573
|
+
id: k,
|
|
573
574
|
inputValue: a,
|
|
574
575
|
value: o,
|
|
575
|
-
dirty:
|
|
576
|
-
expanded:
|
|
577
|
-
popupOpen:
|
|
578
|
-
focused:
|
|
579
|
-
anchorEl:
|
|
576
|
+
dirty: Oe,
|
|
577
|
+
expanded: w && oe,
|
|
578
|
+
popupOpen: w,
|
|
579
|
+
focused: se || T !== -1,
|
|
580
|
+
anchorEl: oe,
|
|
580
581
|
setAnchorEl: Ue,
|
|
581
|
-
focusedTag:
|
|
582
|
-
groupedOptions:
|
|
582
|
+
focusedTag: T,
|
|
583
|
+
groupedOptions: je
|
|
583
584
|
};
|
|
584
585
|
}
|
|
585
|
-
const _t = "_autocomplete_mj65r_65",
|
|
586
|
+
const _t = "_autocomplete_mj65r_65", ee = {
|
|
586
587
|
"u-typography-h1": "_u-typography-h1_mj65r_1",
|
|
587
588
|
"u-typography-h2": "_u-typography-h2_mj65r_8",
|
|
588
589
|
"u-typography-h3": "_u-typography-h3_mj65r_15",
|
|
@@ -602,77 +603,73 @@ const _t = "_autocomplete_mj65r_65", G = {
|
|
|
602
603
|
autocomplete: _t,
|
|
603
604
|
"autocomplete__dropdown-list": "_autocomplete__dropdown-list_mj65r_82",
|
|
604
605
|
"option-focused": "_option-focused_mj65r_106"
|
|
605
|
-
},
|
|
606
|
+
}, At = ({
|
|
606
607
|
labelKey: c,
|
|
607
|
-
valueKey:
|
|
608
|
+
valueKey: m,
|
|
608
609
|
options: g,
|
|
609
|
-
type:
|
|
610
|
-
value:
|
|
611
|
-
onChange:
|
|
612
|
-
onInputChange:
|
|
613
|
-
|
|
614
|
-
|
|
610
|
+
type: A,
|
|
611
|
+
value: J,
|
|
612
|
+
onChange: j,
|
|
613
|
+
onInputChange: D,
|
|
614
|
+
classNameWrapper: C,
|
|
615
|
+
"data-testid-wrapper": q,
|
|
616
|
+
classNameInputWrapper: b,
|
|
617
|
+
...I
|
|
615
618
|
}) => {
|
|
616
|
-
const
|
|
617
|
-
g != null && g.some((i) => typeof i != "string") && (!c || !
|
|
619
|
+
const B = at(), [W, S] = ut("");
|
|
620
|
+
g != null && g.some((i) => typeof i != "string") && (!c || !m) && console.error(
|
|
618
621
|
'[autocomplete] When options is a list of objects, you must provide the "labelKey" and "valueKey" parameters.'
|
|
619
622
|
);
|
|
620
|
-
const { getRootProps:
|
|
621
|
-
id: `autocomplete_${
|
|
623
|
+
const { getRootProps: fe, getInputProps: te, getOptionProps: de, groupedOptions: Y, getListboxProps: N } = xt({
|
|
624
|
+
id: `autocomplete_${B}`,
|
|
622
625
|
options: g,
|
|
623
626
|
getOptionLabel: (i) => typeof i == "string" ? i : String(i[c || "label"]),
|
|
624
|
-
value:
|
|
625
|
-
inputValue:
|
|
626
|
-
isOptionEqualToValue: (i,
|
|
627
|
-
|
|
628
|
-
|
|
627
|
+
value: J,
|
|
628
|
+
inputValue: W,
|
|
629
|
+
isOptionEqualToValue: (i, y) => typeof i == "string" ? String(i) === String(y) : String(i[m || "id"]) === String(y[m || "id"]),
|
|
630
|
+
getOptionKey(i) {
|
|
631
|
+
return String(typeof i == "string" ? i : i[m || "id"]);
|
|
632
|
+
},
|
|
633
|
+
onChange: (i, y) => {
|
|
634
|
+
j && j(i, y);
|
|
629
635
|
},
|
|
630
|
-
onInputChange: (i,
|
|
631
|
-
|
|
636
|
+
onInputChange: (i, y) => {
|
|
637
|
+
D && D(i, y), S(y);
|
|
632
638
|
},
|
|
633
|
-
onHighlightChange: (i,
|
|
639
|
+
onHighlightChange: (i, y, L) => {
|
|
634
640
|
var V;
|
|
635
|
-
if (
|
|
636
|
-
const
|
|
637
|
-
|
|
641
|
+
if (L === "keyboard") {
|
|
642
|
+
const v = document.querySelector("#autocomplete-list"), re = (i == null ? void 0 : i.target).getAttribute("aria-activedescendant");
|
|
643
|
+
v == null || v.querySelectorAll("li").forEach((ge) => ge.classList.remove(ee["option-focused"])), (V = v == null ? void 0 : v.querySelector(`[id="${re}"]`)) == null || V.classList.add(ee["option-focused"]);
|
|
638
644
|
}
|
|
639
645
|
}
|
|
640
|
-
}),
|
|
641
|
-
...
|
|
642
|
-
...
|
|
646
|
+
}), U = {
|
|
647
|
+
...te(),
|
|
648
|
+
...I,
|
|
649
|
+
classNameWrapper: b
|
|
643
650
|
};
|
|
644
|
-
return /* @__PURE__ */
|
|
645
|
-
/* @__PURE__ */
|
|
651
|
+
return /* @__PURE__ */ Z("div", { className: ct(ee.autocomplete, C), "data-testid": q, children: /* @__PURE__ */ lt("div", { ...fe(), children: [
|
|
652
|
+
/* @__PURE__ */ Z(
|
|
646
653
|
ft,
|
|
647
654
|
{
|
|
648
|
-
rightIcon:
|
|
649
|
-
...
|
|
655
|
+
rightIcon: A === "search" && /* @__PURE__ */ Z(pt, { color: "var(--accent)", icon: "magnifying-glass" }),
|
|
656
|
+
...U
|
|
650
657
|
}
|
|
651
658
|
),
|
|
652
|
-
|
|
659
|
+
Y.length > 0 && !I.disabled && /* @__PURE__ */ Z(
|
|
653
660
|
"ul",
|
|
654
661
|
{
|
|
655
|
-
...
|
|
662
|
+
...N(),
|
|
656
663
|
id: "autocomplete-list",
|
|
657
|
-
className:
|
|
658
|
-
children:
|
|
659
|
-
const
|
|
660
|
-
return /* @__PURE__ */
|
|
661
|
-
"li",
|
|
662
|
-
{
|
|
663
|
-
tabIndex: m,
|
|
664
|
-
className: G["autocomplete__dropdown-item"],
|
|
665
|
-
...j,
|
|
666
|
-
"aria-selected": _,
|
|
667
|
-
key: String(m)
|
|
668
|
-
},
|
|
669
|
-
V
|
|
670
|
-
);
|
|
664
|
+
className: ee["autocomplete__dropdown-list"],
|
|
665
|
+
children: Y.map((i, y) => {
|
|
666
|
+
const L = de({ option: i, index: y }), V = typeof i == "string" ? i : String(i[c || "label"]);
|
|
667
|
+
return /* @__PURE__ */ Z("li", { tabIndex: y, className: ee["autocomplete__dropdown-item"], ...L, children: V });
|
|
671
668
|
})
|
|
672
669
|
}
|
|
673
670
|
)
|
|
674
671
|
] }) });
|
|
675
672
|
};
|
|
676
673
|
export {
|
|
677
|
-
|
|
674
|
+
At as Autocomplete
|
|
678
675
|
};
|
|
@@ -2,7 +2,7 @@ import { StoryObj } from '@storybook/react';
|
|
|
2
2
|
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: <T extends string | object>({ labelKey, valueKey, options, type, value, onChange, onInputChange, "data-testid-wrapper": dataTestId, ...props }: import('./Autocomplete.tsx').AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
component: <T extends string | object>({ labelKey, valueKey, options, type, value, onChange, onInputChange, classNameWrapper, "data-testid-wrapper": dataTestId, classNameInputWrapper, ...props }: import('./Autocomplete.tsx').AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: string;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as r, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as l } from "react";
|
|
3
3
|
import { c as t } from "../../clsx-DB4S2d7J.js";
|
|
4
|
-
import '../../assets/Badge.css';const
|
|
5
|
-
"badge-root": "_badge-
|
|
6
|
-
badge:
|
|
7
|
-
"badge--red": "_badge--
|
|
8
|
-
"badge--green": "_badge--
|
|
9
|
-
"badge--blue": "_badge--
|
|
10
|
-
"badge--blueInvert": "_badge--
|
|
11
|
-
"badge--gray": "_badge--
|
|
12
|
-
"badge--basic": "_badge--
|
|
13
|
-
"badge--double": "_badge--
|
|
14
|
-
"badge--triple": "_badge--
|
|
15
|
-
"badge--medium": "_badge--
|
|
16
|
-
}, p = ({ count:
|
|
17
|
-
const
|
|
4
|
+
import '../../assets/Badge.css';const f = "_badge_40fsi_1", e = {
|
|
5
|
+
"badge-root": "_badge-root_40fsi_1",
|
|
6
|
+
badge: f,
|
|
7
|
+
"badge--red": "_badge--red_40fsi_31",
|
|
8
|
+
"badge--green": "_badge--green_40fsi_34",
|
|
9
|
+
"badge--blue": "_badge--blue_40fsi_37",
|
|
10
|
+
"badge--blueInvert": "_badge--blueInvert_40fsi_40",
|
|
11
|
+
"badge--gray": "_badge--gray_40fsi_44",
|
|
12
|
+
"badge--basic": "_badge--basic_40fsi_48",
|
|
13
|
+
"badge--double": "_badge--double_40fsi_54",
|
|
14
|
+
"badge--triple": "_badge--triple_40fsi_58",
|
|
15
|
+
"badge--medium": "_badge--medium_40fsi_62"
|
|
16
|
+
}, p = ({ count: d, children: _, variant: a, size: b, className: g }) => {
|
|
17
|
+
const s = d > 99 ? "triple" : d > 9 ? "double" : "single", i = l(
|
|
18
18
|
() => t([
|
|
19
19
|
e.badge,
|
|
20
|
-
e[`badge--${
|
|
20
|
+
e[`badge--${a}`],
|
|
21
21
|
e[`badge--${b}`],
|
|
22
|
-
e[`badge--${
|
|
22
|
+
e[`badge--${s}`],
|
|
23
23
|
g
|
|
24
24
|
]),
|
|
25
|
-
[g,
|
|
25
|
+
[g, a, b, s]
|
|
26
26
|
);
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
/* @__PURE__ */ o("span", { className:
|
|
27
|
+
return /* @__PURE__ */ r("span", { className: e["badge-root"], children: [
|
|
28
|
+
_,
|
|
29
|
+
/* @__PURE__ */ o("span", { className: i, children: d > 999 ? "999+" : d })
|
|
30
30
|
] });
|
|
31
31
|
};
|
|
32
32
|
export {
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as p, Fragment as n } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as I } from "react";
|
|
3
3
|
import { c as y } from "../../clsx-DB4S2d7J.js";
|
|
4
4
|
import { Icon as P } from "../Icon/Icon.js";
|
|
5
5
|
import { IconButton as $ } from "../IconButton/IconButton.js";
|
|
6
6
|
import { Text as m } from "../Typography/Typography.js";
|
|
7
7
|
import '../../assets/PageHeader.css';const a = {
|
|
8
|
-
"u-typography-h1": "_u-typography-
|
|
9
|
-
"u-typography-h2": "_u-typography-
|
|
10
|
-
"u-typography-h3": "_u-typography-
|
|
11
|
-
"u-typography-h4": "_u-typography-
|
|
12
|
-
"u-typography-h5": "_u-typography-
|
|
13
|
-
"u-typography-h6": "_u-typography-
|
|
14
|
-
"u-typography-base": "_u-typography-
|
|
15
|
-
"u-typography-base--xxl": "_u-typography-base--
|
|
16
|
-
"u-typography-base--xl": "_u-typography-base--
|
|
17
|
-
"u-typography-base--lg": "_u-typography-base--
|
|
18
|
-
"u-typography-base--sm": "_u-typography-base--
|
|
19
|
-
"u-typography-base--bold": "_u-typography-base--
|
|
20
|
-
"u-typography-base--strikethrough": "_u-typography-base--
|
|
21
|
-
"u-typography-base--underlined": "_u-typography-base--
|
|
22
|
-
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-
|
|
23
|
-
"page-header": "_page-
|
|
24
|
-
"page-header__main-content": "_page-header__main-
|
|
25
|
-
"page-header__bottom-content": "_page-header__bottom-
|
|
26
|
-
"page-header__breadcrumb": "_page-
|
|
27
|
-
"page-header__breadcrumb__separator": "_page-
|
|
28
|
-
"page-header__right-children-wrapper": "_page-header__right-children-
|
|
29
|
-
"header-bubble": "_header-
|
|
30
|
-
"header-bubble--container": "_header-bubble--
|
|
31
|
-
"header-bubble--container--full": "_header-bubble--container--
|
|
32
|
-
"header-bubble-margin": "_header-bubble-
|
|
8
|
+
"u-typography-h1": "_u-typography-h1_1oa3o_1",
|
|
9
|
+
"u-typography-h2": "_u-typography-h2_1oa3o_8",
|
|
10
|
+
"u-typography-h3": "_u-typography-h3_1oa3o_15",
|
|
11
|
+
"u-typography-h4": "_u-typography-h4_1oa3o_22",
|
|
12
|
+
"u-typography-h5": "_u-typography-h5_1oa3o_29",
|
|
13
|
+
"u-typography-h6": "_u-typography-h6_1oa3o_36",
|
|
14
|
+
"u-typography-base": "_u-typography-base_1oa3o_43",
|
|
15
|
+
"u-typography-base--xxl": "_u-typography-base--xxl_1oa3o_49",
|
|
16
|
+
"u-typography-base--xl": "_u-typography-base--xl_1oa3o_53",
|
|
17
|
+
"u-typography-base--lg": "_u-typography-base--lg_1oa3o_57",
|
|
18
|
+
"u-typography-base--sm": "_u-typography-base--sm_1oa3o_61",
|
|
19
|
+
"u-typography-base--bold": "_u-typography-base--bold_1oa3o_65",
|
|
20
|
+
"u-typography-base--strikethrough": "_u-typography-base--strikethrough_1oa3o_68",
|
|
21
|
+
"u-typography-base--underlined": "_u-typography-base--underlined_1oa3o_71",
|
|
22
|
+
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_1oa3o_74",
|
|
23
|
+
"page-header": "_page-header_1oa3o_78",
|
|
24
|
+
"page-header__main-content": "_page-header__main-content_1oa3o_83",
|
|
25
|
+
"page-header__bottom-content": "_page-header__bottom-content_1oa3o_90",
|
|
26
|
+
"page-header__breadcrumb": "_page-header__breadcrumb_1oa3o_95",
|
|
27
|
+
"page-header__breadcrumb__separator": "_page-header__breadcrumb__separator_1oa3o_123",
|
|
28
|
+
"page-header__right-children-wrapper": "_page-header__right-children-wrapper_1oa3o_129",
|
|
29
|
+
"header-bubble": "_header-bubble_1oa3o_135",
|
|
30
|
+
"header-bubble--container": "_header-bubble--container_1oa3o_138",
|
|
31
|
+
"header-bubble--container--full": "_header-bubble--container--full_1oa3o_146",
|
|
32
|
+
"header-bubble-margin": "_header-bubble-margin_1oa3o_150"
|
|
33
33
|
}, E = ({
|
|
34
|
-
title:
|
|
34
|
+
title: l,
|
|
35
35
|
subtitle: b,
|
|
36
|
-
rightChildren:
|
|
37
|
-
bottomChildren:
|
|
36
|
+
rightChildren: s,
|
|
37
|
+
bottomChildren: c,
|
|
38
38
|
classNameWrapper: k,
|
|
39
39
|
classNameTitle: N,
|
|
40
40
|
classNameSubtitle: f,
|
|
41
|
-
headerBubble:
|
|
41
|
+
headerBubble: t,
|
|
42
42
|
fullWidthHeaderBubble: x,
|
|
43
43
|
"data-testid-wrapper": v,
|
|
44
44
|
"data-testid-title": w,
|
|
@@ -48,41 +48,41 @@ import '../../assets/PageHeader.css';const a = {
|
|
|
48
48
|
}) => {
|
|
49
49
|
const {
|
|
50
50
|
breadcrumb: r,
|
|
51
|
-
backLinkText:
|
|
52
|
-
onBackLinkClick:
|
|
51
|
+
backLinkText: d,
|
|
52
|
+
onBackLinkClick: h,
|
|
53
53
|
classNameBackLink: u,
|
|
54
54
|
"data-testid-backLink": g,
|
|
55
55
|
...B
|
|
56
56
|
} = T;
|
|
57
|
-
|
|
57
|
+
t && (l || b || c) && console.error("headerBubble prop can not be used with title, subtitle or bottomChildren"), !t && !l && console.error("title prop is required when not using headerBubble"), (d || h) && console.error("backLinkText and onBackLinkClick props are deprecated. Please use breadcrumb instead");
|
|
58
58
|
const j = y([a["page-header"], k]), H = I(() => {
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
label:
|
|
59
|
+
const _ = [];
|
|
60
|
+
return d && h && _.push({
|
|
61
|
+
label: d,
|
|
62
62
|
className: u,
|
|
63
63
|
"data-testid": g,
|
|
64
|
-
onClick:
|
|
65
|
-
}), r &&
|
|
64
|
+
onClick: h
|
|
65
|
+
}), r && _.push(...r), /* @__PURE__ */ e("div", { className: a["page-header__breadcrumb"], children: _.map((o, i) => /* @__PURE__ */ e(
|
|
66
66
|
$,
|
|
67
67
|
{
|
|
68
68
|
icon: i === 0 ? /* @__PURE__ */ e(P, { icon: "house-blank" }) : /* @__PURE__ */ e("span", { className: a["page-header__breadcrumb__separator"], children: "/" }),
|
|
69
|
-
onClick: () =>
|
|
70
|
-
className:
|
|
71
|
-
"data-testid":
|
|
72
|
-
disabled:
|
|
73
|
-
children:
|
|
69
|
+
onClick: () => o.onClick && o.onClick(),
|
|
70
|
+
className: o.className,
|
|
71
|
+
"data-testid": o["data-testid"],
|
|
72
|
+
disabled: _.length === 1 ? !1 : i === _.length - 1,
|
|
73
|
+
children: o.label
|
|
74
74
|
},
|
|
75
|
-
`${
|
|
75
|
+
`${o.label}_${i}`
|
|
76
76
|
)) });
|
|
77
|
-
}, [r,
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
77
|
+
}, [r, d, u, g, h]);
|
|
78
|
+
return /* @__PURE__ */ p(n, { children: [
|
|
79
|
+
/* @__PURE__ */ p("div", { className: j, "data-testid": v, ...B, children: [
|
|
80
|
+
/* @__PURE__ */ p("div", { className: a["page-header__main-content"], children: [
|
|
81
|
+
/* @__PURE__ */ p("div", { className: a["page-header__right-children-wrapper"], children: [
|
|
82
82
|
r && H,
|
|
83
|
-
r &&
|
|
83
|
+
r && s && /* @__PURE__ */ e(n, { children: s })
|
|
84
84
|
] }),
|
|
85
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ p("div", { className: a["page-header__right-children-wrapper"], children: [
|
|
86
86
|
/* @__PURE__ */ e(
|
|
87
87
|
m,
|
|
88
88
|
{
|
|
@@ -91,10 +91,10 @@ import '../../assets/PageHeader.css';const a = {
|
|
|
91
91
|
color: "var(--colors-neutral-text-color-text)",
|
|
92
92
|
className: N,
|
|
93
93
|
"data-testid": w,
|
|
94
|
-
children:
|
|
94
|
+
children: l
|
|
95
95
|
}
|
|
96
96
|
),
|
|
97
|
-
!r &&
|
|
97
|
+
!r && s && /* @__PURE__ */ e(n, { children: s })
|
|
98
98
|
] }),
|
|
99
99
|
/* @__PURE__ */ e(
|
|
100
100
|
m,
|
|
@@ -107,18 +107,18 @@ import '../../assets/PageHeader.css';const a = {
|
|
|
107
107
|
children: b
|
|
108
108
|
}
|
|
109
109
|
),
|
|
110
|
-
|
|
110
|
+
t && /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e("div", { className: a["header-bubble"], children: /* @__PURE__ */ e(
|
|
111
111
|
"div",
|
|
112
112
|
{
|
|
113
113
|
className: x ? y(a["header-bubble--container"], a["header-bubble--container--full"]) : a["header-bubble--container"],
|
|
114
114
|
"data-testid": C,
|
|
115
|
-
children:
|
|
115
|
+
children: t
|
|
116
116
|
}
|
|
117
117
|
) }) })
|
|
118
118
|
] }),
|
|
119
|
-
|
|
119
|
+
c && /* @__PURE__ */ e("div", { className: a["page-header__bottom-content"], children: c })
|
|
120
120
|
] }),
|
|
121
|
-
|
|
121
|
+
t && /* @__PURE__ */ e("div", { className: a["header-bubble-margin"] })
|
|
122
122
|
] });
|
|
123
123
|
};
|
|
124
124
|
export {
|