@sanity/ui 4.4.1 → 4.4.2
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/autocomplete.d.ts +5 -1
- package/dist/autocomplete.d.ts.map +1 -1
- package/dist/autocomplete.js +92 -95
- package/dist/autocomplete.js.map +1 -1
- package/dist/breadcrumbs.js +1 -1
- package/dist/{getElementRef-Jw7gY0eV.js → getElementRef-BLVMlHTn.js} +78 -3
- package/dist/getElementRef-BLVMlHTn.js.map +1 -0
- package/dist/{hotkeys-sG9yO97K.js → hotkeys-Caqg1W-_.js} +2 -2
- package/dist/{hotkeys-sG9yO97K.js.map → hotkeys-Caqg1W-_.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/menu.d.ts +5 -0
- package/dist/menu.d.ts.map +1 -1
- package/dist/menu.js +158 -138
- package/dist/menu.js.map +1 -1
- package/dist/{popover-B0kvwaep.js → popover-CEDyHcBi.js} +140 -143
- package/dist/popover-CEDyHcBi.js.map +1 -0
- package/dist/popover-HDVgZg5e.d.ts.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/tooltip.js +69 -81
- package/dist/tooltip.js.map +1 -1
- package/package.json +1 -1
- package/dist/getElementRef-Jw7gY0eV.js.map +0 -1
- package/dist/popover-B0kvwaep.js.map +0 -1
package/dist/autocomplete.d.ts
CHANGED
|
@@ -126,7 +126,11 @@ interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseAutocomp
|
|
|
126
126
|
}, ref: Ref<HTMLDivElement>) => ReactNode;
|
|
127
127
|
renderValue?: (value: string, option?: Option) => string;
|
|
128
128
|
suffix?: ReactNode;
|
|
129
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* The current value. A changed `value` replaces the value shown and drops a pending query,
|
|
131
|
+
* unless it equals the value shown (a parent echoing `onChange`). A selection or clear shows
|
|
132
|
+
* until `value` changes, and changing `value` to `undefined` keeps the value shown.
|
|
133
|
+
*/
|
|
130
134
|
value?: string;
|
|
131
135
|
}
|
|
132
136
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../src/core/components/autocomplete/types.ts","../src/core/components/autocomplete/autocomplete.tsx"],"mappings":";;;;;;;KAKY,8BAA8B,iBACxC,KAAK,MAAM,UAAU;;;;UAKN;EACf;;;;;UAMe;EACf;EACA;EACA;EACA;EACA;;;;;UAMe;EACf;;;;;UAMe;EACf;;;;;UAMe;EACf;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;EACA;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;;;;;UAMe;EACf;EACA;;;;;KAMU,kBACR,0BACA,2BACA,4BACA,0BACA,oCACA,oCACA,6BACA,6BACA;;;;
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../src/core/components/autocomplete/types.ts","../src/core/components/autocomplete/autocomplete.tsx"],"mappings":";;;;;;;KAKY,8BAA8B,iBACxC,KAAK,MAAM,UAAU;;;;UAKN;EACf;;;;;UAMe;EACf;EACA;EACA;EACA;EACA;;;;;UAMe;EACf;;;;;UAMe;EACf;;;;;UAMe;EACf;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;EACA;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;EACf;;;;;UAMe;EACf;EACA;;;;;KAMU,kBACR,0BACA,2BACA,4BACA,0BACA,oCACA,oCACA,6BACA,6BACA;;;;UCtDa,kBAAkB,eAAe,yBAAyB;EACzE;EACA;EACA,gBAAgB,eAAe,QAAQ;EACvC;EAEA,OAAO,cAAc;EACrB;;EAEA,UAAU;EACV;EACA,YAAY;EACZ,iBAAiB;EACjB,YAAY;;EAEZ,uBAAuB;;EAEvB;;EAEA,UAAU;EACV;EACA,UAAU,KAAK,sEACb,KAAK,UAAU;EACjB,SAAS;EACT,SAAS,SAAS;;EAElB,kBAAkB;;EAElB,gBAAgB,QAAQ,WAAW,MAAM,IAAI;;EAE7C,iBACE;IACE,SAAS,MAAM,IAAI;IACnB;IACA,cAAc;IACd;IACA;KAEF,KAAK,IAAI,oBACN;EACL,eAAe,eAAe,SAAS;EACvC,SAAS;;;;;;EAMT;;;;;;;;wBAec,aAAa,eAAe,wBAC1C,OAAO,kBAAkB,UACvB,KACE,UAAU,gSAmBX,IAAA"}
|
package/dist/autocomplete.js
CHANGED
|
@@ -5,12 +5,13 @@ import { t as _isEnterToClickElement } from "./element-BYgCE_iK.js";
|
|
|
5
5
|
import { s as Card, y as Box } from "./useLayer-B0i19TTM.js";
|
|
6
6
|
import { n as Text, t as Stack } from "./stack-Cv-WM-7p.js";
|
|
7
7
|
import { t as Button } from "./button-dhq4ViVg.js";
|
|
8
|
-
import { t as Popover } from "./popover-
|
|
8
|
+
import { t as Popover } from "./popover-CEDyHcBi.js";
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
10
|
import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
|
|
11
11
|
import { SpinnerIcon } from "@sanity/icons/Spinner";
|
|
12
12
|
import { clsx } from "clsx/lite";
|
|
13
|
-
import { cloneElement, useEffect, useImperativeHandle, useReducer, useRef, useState } from "react";
|
|
13
|
+
import { cloneElement, useDeferredValue, useEffect, useImperativeHandle, useReducer, useRef, useState } from "react";
|
|
14
|
+
import { useEffectEvent } from "use-effect-event";
|
|
14
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
16
|
function AutocompleteOption(props) {
|
|
16
17
|
let $ = c(11), { children, id, onSelect, selected, value } = props, t0;
|
|
@@ -46,19 +47,17 @@ function autocompleteReducer(state, msg) {
|
|
|
46
47
|
} : msg.type === "input/focus" ? {
|
|
47
48
|
...state,
|
|
48
49
|
focused: !0
|
|
49
|
-
} : msg.type === "root/blur" ? {
|
|
50
|
+
} : msg.type === "root/blur" || msg.type === "root/escape" ? {
|
|
50
51
|
...state,
|
|
52
|
+
activeValue: state.value || state.activeValue,
|
|
51
53
|
focused: !1,
|
|
54
|
+
listFocused: !1,
|
|
52
55
|
query: null
|
|
53
56
|
} : msg.type === "root/clear" ? {
|
|
54
57
|
...state,
|
|
55
58
|
activeValue: null,
|
|
56
59
|
query: null,
|
|
57
60
|
value: null
|
|
58
|
-
} : msg.type === "root/escape" ? {
|
|
59
|
-
...state,
|
|
60
|
-
focused: !1,
|
|
61
|
-
query: null
|
|
62
61
|
} : msg.type === "root/open" ? {
|
|
63
62
|
...state,
|
|
64
63
|
query: state.query ?? msg.query
|
|
@@ -101,7 +100,7 @@ const DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, D
|
|
|
101
100
|
* @public
|
|
102
101
|
*/
|
|
103
102
|
function Autocomplete(props) {
|
|
104
|
-
let $ = c(
|
|
103
|
+
let $ = c(187), customValidity, disabled, filterOptionProp, forwardedRef, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, valueProp;
|
|
105
104
|
$[0] === props ? (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], forwardedRef = $[4], icon = $[5], id = $[6], loading = $[7], onBlur = $[8], onChange = $[9], onFocus = $[10], onQueryChange = $[11], onSelect = $[12], openButton = $[13], openOnFocus = $[14], optionsProp = $[15], prefix = $[16], readOnly = $[17], relatedElements = $[18], renderOptionProp = $[19], renderPopover = $[20], restProps = $[21], suffix = $[22], t0 = $[23], t1 = $[24], t2 = $[25], t3 = $[26], t4 = $[27], t5 = $[28], t6 = $[29], valueProp = $[30]) : ({border: t0, customValidity, disabled, filterOption: filterOptionProp, fontSize: t1, icon, id, listBox: t2, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, options: optionsProp, padding: t3, popover: t4, prefix, radius: t5, readOnly, ref: forwardedRef, relatedElements, renderOption: renderOptionProp, renderPopover, renderValue: t6, suffix, value: valueProp, ...restProps} = props, $[0] = props, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[4] = forwardedRef, $[5] = icon, $[6] = id, $[7] = loading, $[8] = onBlur, $[9] = onChange, $[10] = onFocus, $[11] = onQueryChange, $[12] = onSelect, $[13] = openButton, $[14] = openOnFocus, $[15] = optionsProp, $[16] = prefix, $[17] = readOnly, $[18] = relatedElements, $[19] = renderOptionProp, $[20] = renderPopover, $[21] = restProps, $[22] = suffix, $[23] = t0, $[24] = t1, $[25] = t2, $[26] = t3, $[27] = t4, $[28] = t5, $[29] = t6, $[30] = valueProp);
|
|
106
105
|
let border = t0 === void 0 || t0, fontSize = t1 === void 0 ? 2 : t1, listBox = t2 === void 0 ? EMPTY_RECORD : t2, paddingProp = t3 === void 0 ? 3 : t3, popover = t4 === void 0 ? EMPTY_RECORD : t4, radius = t5 === void 0 ? 2 : t5, renderValue = t6 === void 0 ? DEFAULT_RENDER_VALUE : t6, t7 = valueProp || null, t8 = valueProp || null, t9;
|
|
107
106
|
$[31] !== t7 || $[32] !== t8 ? (t9 = {
|
|
@@ -111,7 +110,12 @@ function Autocomplete(props) {
|
|
|
111
110
|
query: null,
|
|
112
111
|
value: t8
|
|
113
112
|
}, $[31] = t7, $[32] = t8, $[33] = t9) : t9 = $[33];
|
|
114
|
-
let [state, dispatch] = useReducer(autocompleteReducer, t9), { activeValue, focused, listFocused, query, value } = state,
|
|
113
|
+
let [state, dispatch] = useReducer(autocompleteReducer, t9), { activeValue, focused, listFocused, query, value } = state, [prevValueProp, setPrevValueProp] = useState(valueProp);
|
|
114
|
+
valueProp !== prevValueProp && (setPrevValueProp(valueProp), valueProp !== void 0 && (valueProp || null) !== value && dispatch({
|
|
115
|
+
type: "value/change",
|
|
116
|
+
value: valueProp
|
|
117
|
+
}));
|
|
118
|
+
let t10;
|
|
115
119
|
$[34] !== fontSize || $[35] !== paddingProp ? (t10 = (t11) => {
|
|
116
120
|
let { value: value_0 } = t11;
|
|
117
121
|
return /* @__PURE__ */ jsx(Card, {
|
|
@@ -126,7 +130,7 @@ function Autocomplete(props) {
|
|
|
126
130
|
})
|
|
127
131
|
});
|
|
128
132
|
}, $[34] = fontSize, $[35] = paddingProp, $[36] = t10) : t10 = $[36];
|
|
129
|
-
let renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), [inputElement, setInputElement] = useState(null), listFocusedRef = useRef(!1),
|
|
133
|
+
let renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = useRef(null), resultsPopoverElementRef = useRef(null), inputElementRef = useRef(null), listBoxElementRef = useRef(null), [inputElement, setInputElement] = useState(null), listFocusedRef = useRef(!1), popoverMouseWithinRef = useRef(!1), t11, t12;
|
|
130
134
|
$[37] === inputElement ? (t11 = $[38], t12 = $[39]) : (t11 = () => inputElement, t12 = [inputElement], $[37] = inputElement, $[38] = t11, $[39] = t12), useImperativeHandle(inputElementRef, t11, t12);
|
|
131
135
|
let t13, t14;
|
|
132
136
|
$[40] === inputElement ? (t13 = $[41], t14 = $[42]) : (t13 = () => inputElement, t14 = [inputElement], $[40] = inputElement, $[41] = t13, $[42] = t14), useImperativeHandle(forwardedRef, t13, t14);
|
|
@@ -137,7 +141,7 @@ function Autocomplete(props) {
|
|
|
137
141
|
let t17;
|
|
138
142
|
$[50] !== filterOption || $[51] !== query ? (t17 = (option) => !query || filterOption(query, option), $[50] = filterOption, $[51] = query, $[52] = t17) : t17 = $[52], t16 = options.filter(t17), $[46] = filterOption, $[47] = options, $[48] = query, $[49] = t16;
|
|
139
143
|
} else t16 = $[49];
|
|
140
|
-
let filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0,
|
|
144
|
+
let filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, querying = query !== null && loading || focused && query !== null, deferredQuerying = useDeferredValue(querying), expanded = querying && deferredQuerying, t17;
|
|
141
145
|
$[53] !== onBlur || $[54] !== onQueryChange || $[55] !== relatedElements ? (t17 = (event) => {
|
|
142
146
|
setTimeout(() => {
|
|
143
147
|
if (popoverMouseWithinRef.current) return;
|
|
@@ -164,7 +168,7 @@ function Autocomplete(props) {
|
|
|
164
168
|
dispatch({
|
|
165
169
|
type: "value/change",
|
|
166
170
|
value: v
|
|
167
|
-
}), popoverMouseWithinRef.current = !1, onSelect && onSelect(v),
|
|
171
|
+
}), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
168
172
|
}, $[58] = onChange, $[59] = onQueryChange, $[60] = onSelect, $[61] = t19) : t19 = $[61];
|
|
169
173
|
let handleOptionSelect = t19, t20;
|
|
170
174
|
$[62] !== activeValue || $[63] !== filteredOptions || $[64] !== filteredOptionsLen || $[65] !== onQueryChange ? (t20 = (event_1) => {
|
|
@@ -224,33 +228,16 @@ function Autocomplete(props) {
|
|
|
224
228
|
}, $[79] = t25) : t25 = $[79];
|
|
225
229
|
let handlePopoverMouseLeave = t25, t26;
|
|
226
230
|
$[80] !== onChange || $[81] !== onQueryChange ? (t26 = () => {
|
|
227
|
-
dispatch({ type: "root/clear" }),
|
|
231
|
+
dispatch({ type: "root/clear" }), onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
|
|
228
232
|
}, $[80] = onChange, $[81] = onQueryChange, $[82] = t26) : t26 = $[82];
|
|
229
233
|
let handleClearButtonClick = t26, t27;
|
|
230
234
|
$[83] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
|
|
231
235
|
dispatch({ type: "input/focus" });
|
|
232
236
|
}, $[83] = t27) : t27 = $[83];
|
|
233
|
-
let handleClearButtonFocus = t27, t28
|
|
234
|
-
$[84]
|
|
235
|
-
valueProp === valuePropRef.current ? valueProp !== valueRef.current && (valueRef.current = valueProp || null, dispatch({
|
|
236
|
-
type: "value/change",
|
|
237
|
-
value: valueProp || null
|
|
238
|
-
})) : (valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
|
|
239
|
-
type: "value/change",
|
|
240
|
-
value: valueProp
|
|
241
|
-
}), valueRef.current = valueProp));
|
|
242
|
-
}, t29 = [valueProp], $[84] = valueProp, $[85] = t28, $[86] = t29), useEffect(t28, t29);
|
|
243
|
-
let t30, t31;
|
|
244
|
-
$[87] === focused ? (t30 = $[88], t31 = $[89]) : (t30 = () => {
|
|
245
|
-
!focused && valueRef.current && dispatch({
|
|
246
|
-
type: "root/setActiveValue",
|
|
247
|
-
value: valueRef.current
|
|
248
|
-
});
|
|
249
|
-
}, t31 = [focused], $[87] = focused, $[88] = t30, $[89] = t31), useEffect(t30, t31);
|
|
250
|
-
let t32, t33;
|
|
251
|
-
$[90] !== activeValue || $[91] !== filteredOptions ? (t32 = () => {
|
|
237
|
+
let handleClearButtonFocus = t27, t28;
|
|
238
|
+
$[84] !== activeValue || $[85] !== filteredOptions || $[86] !== listFocused ? (t28 = () => {
|
|
252
239
|
let listElement = listBoxElementRef.current;
|
|
253
|
-
if (!listElement) return;
|
|
240
|
+
if (!listFocused || !listElement) return;
|
|
254
241
|
let activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
|
|
255
242
|
if (activeOption_1) {
|
|
256
243
|
let activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
|
|
@@ -259,30 +246,40 @@ function Autocomplete(props) {
|
|
|
259
246
|
focusFirstDescendant(activeItemElement);
|
|
260
247
|
}
|
|
261
248
|
}
|
|
262
|
-
},
|
|
263
|
-
let
|
|
249
|
+
}, $[84] = activeValue, $[85] = filteredOptions, $[86] = listFocused, $[87] = t28) : t28 = $[87];
|
|
250
|
+
let focusActiveOption = useEffectEvent(t28), t29;
|
|
251
|
+
$[88] !== expanded || $[89] !== focusActiveOption ? (t29 = () => {
|
|
252
|
+
expanded && focusActiveOption();
|
|
253
|
+
}, $[88] = expanded, $[89] = focusActiveOption, $[90] = t29) : t29 = $[90];
|
|
254
|
+
let t30;
|
|
255
|
+
$[91] !== activeValue || $[92] !== expanded || $[93] !== filteredOptions ? (t30 = [
|
|
256
|
+
activeValue,
|
|
257
|
+
expanded,
|
|
258
|
+
filteredOptions
|
|
259
|
+
], $[91] = activeValue, $[92] = expanded, $[93] = filteredOptions, $[94] = t30) : t30 = $[94], useEffect(t29, t30);
|
|
260
|
+
let t31;
|
|
264
261
|
bb0: {
|
|
265
262
|
if (!loading && !disabled && value) {
|
|
266
|
-
let
|
|
267
|
-
$[
|
|
263
|
+
let t32;
|
|
264
|
+
$[95] === Symbol.for("react.memo_cache_sentinel") ? (t32 = {
|
|
268
265
|
"aria-label": "Clear",
|
|
269
266
|
onFocus: handleClearButtonFocus
|
|
270
|
-
}, $[
|
|
267
|
+
}, $[95] = t32) : t32 = $[95], t31 = t32;
|
|
271
268
|
break bb0;
|
|
272
269
|
}
|
|
273
|
-
|
|
270
|
+
t31 = void 0;
|
|
274
271
|
}
|
|
275
|
-
let clearButton =
|
|
276
|
-
$[
|
|
272
|
+
let clearButton = t31, openButtonBoxPadding = padding.map(_temp), openButtonPadding = padding.map(_temp2), openButtonProps = typeof openButton == "object" ? openButton : EMPTY_RECORD, t32;
|
|
273
|
+
$[96] !== dispatchOpen || $[97] !== openButtonProps ? (t32 = (event_4) => {
|
|
277
274
|
dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
|
|
278
|
-
}, $[
|
|
279
|
-
let handleOpenClick =
|
|
280
|
-
$[
|
|
281
|
-
"aria-hidden":
|
|
275
|
+
}, $[96] = dispatchOpen, $[97] = openButtonProps, $[98] = t32) : t32 = $[98];
|
|
276
|
+
let handleOpenClick = t32, t33;
|
|
277
|
+
$[99] !== disabled || $[100] !== fontSize || $[101] !== handleOpenClick || $[102] !== openButton || $[103] !== openButtonBoxPadding || $[104] !== openButtonPadding || $[105] !== openButtonProps || $[106] !== querying || $[107] !== readOnly ? (t33 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsx(Box, {
|
|
278
|
+
"aria-hidden": querying,
|
|
282
279
|
padding: openButtonBoxPadding,
|
|
283
280
|
children: /* @__PURE__ */ jsx(Button, {
|
|
284
281
|
"aria-label": "Open",
|
|
285
|
-
disabled:
|
|
282
|
+
disabled: querying,
|
|
286
283
|
fontSize,
|
|
287
284
|
icon: ChevronDownIcon,
|
|
288
285
|
mode: "bleed",
|
|
@@ -290,36 +287,36 @@ function Autocomplete(props) {
|
|
|
290
287
|
...openButtonProps,
|
|
291
288
|
onClick: handleOpenClick
|
|
292
289
|
})
|
|
293
|
-
}) : void 0, $[
|
|
294
|
-
let openButtonNode =
|
|
290
|
+
}) : void 0, $[99] = disabled, $[100] = fontSize, $[101] = handleOpenClick, $[102] = openButton, $[103] = openButtonBoxPadding, $[104] = openButtonPadding, $[105] = openButtonProps, $[106] = querying, $[107] = readOnly, $[108] = t33) : t33 = $[108];
|
|
291
|
+
let openButtonNode = t33, t34;
|
|
295
292
|
bb1: {
|
|
296
293
|
if (query === null) {
|
|
297
294
|
if (value !== null) {
|
|
298
|
-
let
|
|
299
|
-
$[
|
|
295
|
+
let t35;
|
|
296
|
+
$[109] !== currentOption || $[110] !== renderValue || $[111] !== value ? (t35 = renderValue(value, currentOption), $[109] = currentOption, $[110] = renderValue, $[111] = value, $[112] = t35) : t35 = $[112], t34 = t35;
|
|
300
297
|
break bb1;
|
|
301
298
|
}
|
|
302
|
-
|
|
299
|
+
t34 = "";
|
|
303
300
|
break bb1;
|
|
304
301
|
}
|
|
305
|
-
|
|
302
|
+
t34 = query;
|
|
306
303
|
}
|
|
307
|
-
let inputValue =
|
|
308
|
-
$[
|
|
304
|
+
let inputValue = t34, t35;
|
|
305
|
+
$[113] === listFocused ? t35 = $[114] : (t35 = (event_5) => {
|
|
309
306
|
event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
|
|
310
|
-
}, $[
|
|
311
|
-
let handleListBoxKeyDown =
|
|
307
|
+
}, $[113] = listFocused, $[114] = t35);
|
|
308
|
+
let handleListBoxKeyDown = t35, t36;
|
|
312
309
|
bb2: {
|
|
313
310
|
if (filteredOptions.length === 0) {
|
|
314
|
-
|
|
311
|
+
t36 = null;
|
|
315
312
|
break bb2;
|
|
316
313
|
}
|
|
317
|
-
let
|
|
318
|
-
$[
|
|
319
|
-
let
|
|
320
|
-
if ($[
|
|
321
|
-
let
|
|
322
|
-
$[
|
|
314
|
+
let t37 = listBox?.className, t38;
|
|
315
|
+
$[115] === t37 ? t38 = $[116] : (t38 = clsx(autocompleteListBox, t37), $[115] = t37, $[116] = t38);
|
|
316
|
+
let t39;
|
|
317
|
+
if ($[117] !== activeValue || $[118] !== currentOption || $[119] !== filteredOptions || $[120] !== handleOptionSelect || $[121] !== id || $[122] !== listFocused || $[123] !== loading || $[124] !== renderOption) {
|
|
318
|
+
let t40;
|
|
319
|
+
$[126] !== activeValue || $[127] !== currentOption || $[128] !== handleOptionSelect || $[129] !== id || $[130] !== listFocused || $[131] !== loading || $[132] !== renderOption ? (t40 = (option_0) => {
|
|
323
320
|
let active = activeValue === null ? currentOption === option_0 : option_0.value === activeValue;
|
|
324
321
|
return /* @__PURE__ */ jsx(AutocompleteOption, {
|
|
325
322
|
id: `${id}-option-${option_0.value}`,
|
|
@@ -332,10 +329,10 @@ function Autocomplete(props) {
|
|
|
332
329
|
tabIndex: listFocused && active ? 0 : -1
|
|
333
330
|
})
|
|
334
331
|
}, option_0.value);
|
|
335
|
-
}, $[
|
|
336
|
-
} else
|
|
337
|
-
let
|
|
338
|
-
$[
|
|
332
|
+
}, $[126] = activeValue, $[127] = currentOption, $[128] = handleOptionSelect, $[129] = id, $[130] = listFocused, $[131] = loading, $[132] = renderOption, $[133] = t40) : t40 = $[133], t39 = filteredOptions.map(t40), $[117] = activeValue, $[118] = currentOption, $[119] = filteredOptions, $[120] = handleOptionSelect, $[121] = id, $[122] = listFocused, $[123] = loading, $[124] = renderOption, $[125] = t39;
|
|
333
|
+
} else t39 = $[125];
|
|
334
|
+
let t40;
|
|
335
|
+
$[134] !== listBoxId || $[135] !== t39 ? (t40 = /* @__PURE__ */ jsx(Stack, {
|
|
339
336
|
as: "ul",
|
|
340
337
|
"aria-multiselectable": !1,
|
|
341
338
|
"data-ui": "AutoComplete__resultsList",
|
|
@@ -343,40 +340,40 @@ function Autocomplete(props) {
|
|
|
343
340
|
ref: listBoxElementRef,
|
|
344
341
|
role: "listbox",
|
|
345
342
|
gap: 1,
|
|
346
|
-
children:
|
|
347
|
-
}), $[
|
|
348
|
-
let
|
|
349
|
-
$[
|
|
343
|
+
children: t39
|
|
344
|
+
}), $[134] = listBoxId, $[135] = t39, $[136] = t40) : t40 = $[136];
|
|
345
|
+
let t41;
|
|
346
|
+
$[137] !== handleListBoxKeyDown || $[138] !== listBox || $[139] !== t38 || $[140] !== t40 ? (t41 = /* @__PURE__ */ jsx(Box, {
|
|
350
347
|
"data-ui": "AutoComplete__results",
|
|
351
348
|
onKeyDown: handleListBoxKeyDown,
|
|
352
349
|
padding: 1,
|
|
353
350
|
...listBox,
|
|
354
|
-
className:
|
|
351
|
+
className: t38,
|
|
355
352
|
tabIndex: -1,
|
|
356
|
-
children:
|
|
357
|
-
}), $[
|
|
353
|
+
children: t40
|
|
354
|
+
}), $[137] = handleListBoxKeyDown, $[138] = listBox, $[139] = t38, $[140] = t40, $[141] = t41) : t41 = $[141], t36 = t41;
|
|
358
355
|
}
|
|
359
|
-
let content =
|
|
356
|
+
let content = t36, t37;
|
|
360
357
|
bb3: {
|
|
361
358
|
if (renderPopover) {
|
|
362
|
-
let
|
|
363
|
-
$[
|
|
359
|
+
let t38 = !expanded, t39;
|
|
360
|
+
$[142] !== content || $[143] !== handlePopoverMouseEnter || $[144] !== handlePopoverMouseLeave || $[145] !== inputElement || $[146] !== renderPopover || $[147] !== t38 ? (t39 = /* @__PURE__ */ jsx(RenderPopover, {
|
|
364
361
|
content,
|
|
365
|
-
hidden:
|
|
362
|
+
hidden: t38,
|
|
366
363
|
inputElement,
|
|
367
364
|
onMouseEnter: handlePopoverMouseEnter,
|
|
368
365
|
onMouseLeave: handlePopoverMouseLeave,
|
|
369
366
|
resultsPopoverElementRef,
|
|
370
367
|
renderPopover
|
|
371
|
-
}), $[
|
|
368
|
+
}), $[142] = content, $[143] = handlePopoverMouseEnter, $[144] = handlePopoverMouseLeave, $[145] = inputElement, $[146] = renderPopover, $[147] = t38, $[148] = t39) : t39 = $[148], t37 = t39;
|
|
372
369
|
break bb3;
|
|
373
370
|
}
|
|
374
371
|
if (filteredOptionsLen === 0) {
|
|
375
|
-
|
|
372
|
+
t37 = null;
|
|
376
373
|
break bb3;
|
|
377
374
|
}
|
|
378
|
-
let
|
|
379
|
-
$[
|
|
375
|
+
let t38;
|
|
376
|
+
$[149] !== content || $[150] !== expanded || $[151] !== handlePopoverMouseEnter || $[152] !== handlePopoverMouseLeave || $[153] !== inputElement || $[154] !== popover || $[155] !== radius ? (t38 = /* @__PURE__ */ jsx(Popover, {
|
|
380
377
|
arrow: !1,
|
|
381
378
|
constrainSize: !0,
|
|
382
379
|
content,
|
|
@@ -392,14 +389,14 @@ function Autocomplete(props) {
|
|
|
392
389
|
ref: resultsPopoverElementRef,
|
|
393
390
|
referenceElement: inputElement,
|
|
394
391
|
...popover
|
|
395
|
-
}), $[
|
|
392
|
+
}), $[149] = content, $[150] = expanded, $[151] = handlePopoverMouseEnter, $[152] = handlePopoverMouseLeave, $[153] = inputElement, $[154] = popover, $[155] = radius, $[156] = t38) : t38 = $[156], t37 = t38;
|
|
396
393
|
}
|
|
397
|
-
let results =
|
|
398
|
-
$[
|
|
399
|
-
let
|
|
400
|
-
$[
|
|
394
|
+
let results = t37, t38 = expanded ? activeItemId : void 0, t39;
|
|
395
|
+
$[157] === loading ? t39 = $[158] : (t39 = loading && /* @__PURE__ */ jsx(SpinnerIcon, { className: "_1b6o2se1" }), $[157] = loading, $[158] = t39);
|
|
396
|
+
let t40 = suffix || openButtonNode, t41;
|
|
397
|
+
$[159] !== border || $[160] !== clearButton || $[161] !== customValidity || $[162] !== disabled || $[163] !== expanded || $[164] !== fontSize || $[165] !== handleClearButtonClick || $[166] !== handleInputChange || $[167] !== handleInputFocus || $[168] !== icon || $[169] !== id || $[170] !== inputValue || $[171] !== listBoxId || $[172] !== padding || $[173] !== prefix || $[174] !== radius || $[175] !== readOnly || $[176] !== restProps || $[177] !== t38 || $[178] !== t39 || $[179] !== t40 ? (t41 = /* @__PURE__ */ jsx(TextInput, {
|
|
401
398
|
...restProps,
|
|
402
|
-
"aria-activedescendant":
|
|
399
|
+
"aria-activedescendant": t38,
|
|
403
400
|
"aria-autocomplete": "list",
|
|
404
401
|
"aria-expanded": expanded,
|
|
405
402
|
"aria-owns": listBoxId,
|
|
@@ -412,7 +409,7 @@ function Autocomplete(props) {
|
|
|
412
409
|
disabled,
|
|
413
410
|
fontSize,
|
|
414
411
|
icon,
|
|
415
|
-
iconRight:
|
|
412
|
+
iconRight: t39,
|
|
416
413
|
id,
|
|
417
414
|
inputMode: "search",
|
|
418
415
|
onChange: handleInputChange,
|
|
@@ -425,19 +422,19 @@ function Autocomplete(props) {
|
|
|
425
422
|
ref: setInputElement,
|
|
426
423
|
role: "combobox",
|
|
427
424
|
spellCheck: !1,
|
|
428
|
-
suffix:
|
|
425
|
+
suffix: t40,
|
|
429
426
|
value: inputValue
|
|
430
|
-
}), $[
|
|
431
|
-
let
|
|
432
|
-
return $[
|
|
427
|
+
}), $[159] = border, $[160] = clearButton, $[161] = customValidity, $[162] = disabled, $[163] = expanded, $[164] = fontSize, $[165] = handleClearButtonClick, $[166] = handleInputChange, $[167] = handleInputFocus, $[168] = icon, $[169] = id, $[170] = inputValue, $[171] = listBoxId, $[172] = padding, $[173] = prefix, $[174] = radius, $[175] = readOnly, $[176] = restProps, $[177] = t38, $[178] = t39, $[179] = t40, $[180] = t41) : t41 = $[180];
|
|
428
|
+
let t42;
|
|
429
|
+
return $[181] !== handleRootBlur || $[182] !== handleRootFocus || $[183] !== handleRootKeyDown || $[184] !== results || $[185] !== t41 ? (t42 = /* @__PURE__ */ jsxs("div", {
|
|
433
430
|
className: autocomplete,
|
|
434
431
|
"data-ui": "Autocomplete",
|
|
435
432
|
onBlur: handleRootBlur,
|
|
436
433
|
onFocus: handleRootFocus,
|
|
437
434
|
onKeyDown: handleRootKeyDown,
|
|
438
435
|
ref: rootElementRef,
|
|
439
|
-
children: [
|
|
440
|
-
}), $[
|
|
436
|
+
children: [t41, results]
|
|
437
|
+
}), $[181] = handleRootBlur, $[182] = handleRootFocus, $[183] = handleRootKeyDown, $[184] = results, $[185] = t41, $[186] = t42) : t42 = $[186], t42;
|
|
441
438
|
}
|
|
442
439
|
function _temp2(v_1) {
|
|
443
440
|
return Math.max(v_1 - 1, 0);
|