@sanity/ui 3.0.12-canary.1 → 3.0.12-canary.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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var _visualEditing = require("./_chunks-cjs/_visual-editing.js"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), styledComponents = require("styled-components"), reactCompilerRuntime = require("react-compiler-runtime"), theme = require("@sanity/ui/theme"), framerMotion = require("framer-motion");
3
+ var _visualEditing = require("./_chunks-cjs/_visual-editing.js"), jsxRuntime = require("react/jsx-runtime"), reactCompilerRuntime = require("react-compiler-runtime"), icons = require("@sanity/icons"), react = require("react"), styledComponents = require("styled-components"), theme = require("@sanity/ui/theme"), framerMotion = require("framer-motion");
4
4
  function _raf(fn) {
5
5
  const frameId = requestAnimationFrame(fn);
6
6
  return () => {
@@ -214,15 +214,17 @@ function autocompleteReducer(state, msg) {
214
214
  } : state;
215
215
  }
216
216
  const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "Home", "End", "PageUp", "PageDown", "Meta", "Tab", "CapsLock"], AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start", AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1, InnerAutocomplete = react.forwardRef(function(props, forwardedRef) {
217
- const {
218
- border = !0,
217
+ const $ = reactCompilerRuntime.c(180);
218
+ let customValidity, disabled, filterOptionProp, 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;
219
+ $[0] !== props ? ({
220
+ border: t0,
219
221
  customValidity,
220
222
  disabled,
221
223
  filterOption: filterOptionProp,
222
- fontSize = 2,
224
+ fontSize: t1,
223
225
  icon,
224
226
  id,
225
- listBox = _visualEditing.EMPTY_RECORD,
227
+ listBox: t2,
226
228
  loading,
227
229
  onBlur,
228
230
  onChange,
@@ -232,35 +234,60 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
232
234
  openButton,
233
235
  openOnFocus,
234
236
  options: optionsProp,
235
- padding: paddingProp = 3,
236
- popover = _visualEditing.EMPTY_RECORD,
237
+ padding: t3,
238
+ popover: t4,
237
239
  prefix,
238
- radius = 2,
240
+ radius: t5,
239
241
  readOnly,
240
242
  relatedElements,
241
243
  renderOption: renderOptionProp,
242
244
  renderPopover,
243
- renderValue = DEFAULT_RENDER_VALUE,
245
+ renderValue: t6,
244
246
  suffix,
245
247
  value: valueProp,
246
248
  ...restProps
247
- } = props, [state, dispatch] = react.useReducer(autocompleteReducer, {
248
- activeValue: valueProp || null,
249
+ } = props, $[0] = props, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[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) : (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], icon = $[4], id = $[5], loading = $[6], onBlur = $[7], onChange = $[8], onFocus = $[9], onQueryChange = $[10], onSelect = $[11], openButton = $[12], openOnFocus = $[13], optionsProp = $[14], prefix = $[15], readOnly = $[16], relatedElements = $[17], renderOptionProp = $[18], renderPopover = $[19], restProps = $[20], suffix = $[21], t0 = $[22], t1 = $[23], t2 = $[24], t3 = $[25], t4 = $[26], t5 = $[27], t6 = $[28], valueProp = $[29]);
250
+ const border = t0 === void 0 ? !0 : t0, fontSize = t1 === void 0 ? 2 : t1, listBox = t2 === void 0 ? _visualEditing.EMPTY_RECORD : t2, paddingProp = t3 === void 0 ? 3 : t3, popover = t4 === void 0 ? _visualEditing.EMPTY_RECORD : t4, radius = t5 === void 0 ? 2 : t5, renderValue = t6 === void 0 ? DEFAULT_RENDER_VALUE : t6, t7 = valueProp || null, t8 = valueProp || null;
251
+ let t9;
252
+ $[30] !== t7 || $[31] !== t8 ? (t9 = {
253
+ activeValue: t7,
249
254
  focused: !1,
250
255
  listFocused: !1,
251
256
  query: null,
252
- value: valueProp || null
253
- }), {
257
+ value: t8
258
+ }, $[30] = t7, $[31] = t8, $[32] = t9) : t9 = $[32];
259
+ const [state, dispatch] = react.useReducer(autocompleteReducer, t9), {
254
260
  activeValue,
255
261
  focused,
256
262
  listFocused,
257
263
  query,
258
264
  value
259
- } = state, defaultRenderOption = react.useCallback(({
260
- value: value_0
261
- }) => /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Card, { "data-as": "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) }), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), [inputElement, setInputElement] = react.useState(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
262
- react.useImperativeHandle(inputElementRef, () => inputElement, [inputElement]), react.useImperativeHandle(forwardedRef, () => inputElement, [inputElement]);
263
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : _visualEditing.EMPTY_ARRAY, padding = _visualEditing._getArrayProp(paddingProp), currentOption = react.useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = react.useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = react.useCallback((event) => {
265
+ } = state;
266
+ let t10;
267
+ $[33] !== fontSize || $[34] !== paddingProp ? (t10 = (t112) => {
268
+ const {
269
+ value: value_0
270
+ } = t112;
271
+ return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Card, { "data-as": "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) });
272
+ }, $[33] = fontSize, $[34] = paddingProp, $[35] = t10) : t10 = $[35];
273
+ const renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), [inputElement, setInputElement] = react.useState(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
274
+ let t11, t12;
275
+ $[36] !== inputElement ? (t11 = () => inputElement, t12 = [inputElement], $[36] = inputElement, $[37] = t11, $[38] = t12) : (t11 = $[37], t12 = $[38]), react.useImperativeHandle(inputElementRef, t11, t12);
276
+ let t13, t14;
277
+ $[39] !== inputElement ? (t13 = () => inputElement, t14 = [inputElement], $[39] = inputElement, $[40] = t13, $[41] = t14) : (t13 = $[40], t14 = $[41]), react.useImperativeHandle(forwardedRef, t13, t14);
278
+ const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : _visualEditing.EMPTY_ARRAY, padding = _visualEditing._getArrayProp(paddingProp);
279
+ let t15;
280
+ $[42] !== options || $[43] !== value ? (t15 = value !== null ? options.find((o) => o.value === value) : void 0, $[42] = options, $[43] = value, $[44] = t15) : t15 = $[44];
281
+ const currentOption = t15;
282
+ let t16;
283
+ if ($[45] !== filterOption || $[46] !== options || $[47] !== query) {
284
+ let t172;
285
+ $[49] !== filterOption || $[50] !== query ? (t172 = (option) => query ? filterOption(query, option) : !0, $[49] = filterOption, $[50] = query, $[51] = t172) : t172 = $[51], t16 = options.filter(t172), $[45] = filterOption, $[46] = options, $[47] = query, $[48] = t16;
286
+ } else
287
+ t16 = $[48];
288
+ const filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null;
289
+ let t17;
290
+ $[52] !== onBlur || $[53] !== onQueryChange || $[54] !== relatedElements ? (t17 = (event) => {
264
291
  setTimeout(() => {
265
292
  if (popoverMouseWithinRef.current)
266
293
  return;
@@ -277,20 +304,30 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
277
304
  type: "root/blur"
278
305
  }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
279
306
  }, 0);
280
- }, [onBlur, onQueryChange, relatedElements]), handleRootFocus = react.useCallback((event_0) => {
307
+ }, $[52] = onBlur, $[53] = onQueryChange, $[54] = relatedElements, $[55] = t17) : t17 = $[55];
308
+ const handleRootBlur = t17;
309
+ let t18;
310
+ $[56] === Symbol.for("react.memo_cache_sentinel") ? (t18 = (event_0) => {
281
311
  const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
282
312
  listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
283
313
  type: "root/setListFocused",
284
314
  listFocused: listFocused_0
285
315
  }));
286
- }, []), handleOptionSelect = react.useCallback((v) => {
316
+ }, $[56] = t18) : t18 = $[56];
317
+ const handleRootFocus = t18;
318
+ let t19;
319
+ $[57] !== onChange || $[58] !== onQueryChange || $[59] !== onSelect ? (t19 = (v) => {
287
320
  dispatch({
288
321
  type: "value/change",
289
322
  value: v
290
323
  }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
291
- }, [onChange, onSelect, onQueryChange]), handleRootKeyDown = react.useCallback((event_1) => {
324
+ }, $[57] = onChange, $[58] = onQueryChange, $[59] = onSelect, $[60] = t19) : t19 = $[60];
325
+ const handleOptionSelect = t19;
326
+ let t20;
327
+ $[61] !== activeValue || $[62] !== filteredOptions || $[63] !== filteredOptionsLen || $[64] !== onQueryChange ? (t20 = (event_1) => {
292
328
  if (event_1.key === "ArrowDown") {
293
- if (event_1.preventDefault(), !filteredOptionsLen) return;
329
+ if (event_1.preventDefault(), !filteredOptionsLen)
330
+ return;
294
331
  const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
295
332
  nextActiveOption && dispatch({
296
333
  type: "root/setActiveValue",
@@ -300,7 +337,8 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
300
337
  return;
301
338
  }
302
339
  if (event_1.key === "ArrowUp") {
303
- if (event_1.preventDefault(), !filteredOptionsLen) return;
340
+ if (event_1.preventDefault(), !filteredOptionsLen)
341
+ return;
304
342
  const activeOption_0 = filteredOptions.find((o_1) => o_1.value === activeValue), activeIndex_0 = activeOption_0 ? filteredOptions.indexOf(activeOption_0) : -1, nextActiveOption_0 = filteredOptions[activeIndex_0 === -1 ? filteredOptionsLen - 1 : (filteredOptionsLen + activeIndex_0 - 1) % filteredOptionsLen];
305
343
  nextActiveOption_0 && dispatch({
306
344
  type: "root/setActiveValue",
@@ -320,35 +358,58 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
320
358
  inputElementRef.current?.focus();
321
359
  return;
322
360
  }
323
- }, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = react.useCallback((event_2) => {
361
+ }, $[61] = activeValue, $[62] = filteredOptions, $[63] = filteredOptionsLen, $[64] = onQueryChange, $[65] = t20) : t20 = $[65];
362
+ const handleRootKeyDown = t20;
363
+ let t21;
364
+ $[66] !== onQueryChange ? (t21 = (event_2) => {
324
365
  const nextQuery = event_2.currentTarget.value;
325
366
  dispatch({
326
367
  type: "input/change",
327
368
  query: nextQuery
328
369
  }), onQueryChange && onQueryChange(nextQuery);
329
- }, [onQueryChange]), dispatchOpen = react.useCallback(() => {
370
+ }, $[66] = onQueryChange, $[67] = t21) : t21 = $[67];
371
+ const handleInputChange = t21;
372
+ let t22;
373
+ $[68] !== currentOption || $[69] !== renderValue || $[70] !== value ? (t22 = () => {
330
374
  dispatch({
331
375
  type: "root/open",
332
376
  query: value ? renderValue(value, currentOption) : ""
333
377
  });
334
- }, [currentOption, renderValue, value]), handleInputFocus = react.useCallback((event_3) => {
378
+ }, $[68] = currentOption, $[69] = renderValue, $[70] = value, $[71] = t22) : t22 = $[71];
379
+ const dispatchOpen = t22;
380
+ let t23;
381
+ $[72] !== dispatchOpen || $[73] !== focused || $[74] !== onFocus || $[75] !== openOnFocus ? (t23 = (event_3) => {
335
382
  focused || (dispatch({
336
383
  type: "input/focus"
337
384
  }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
338
- }, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = react.useCallback(() => {
385
+ }, $[72] = dispatchOpen, $[73] = focused, $[74] = onFocus, $[75] = openOnFocus, $[76] = t23) : t23 = $[76];
386
+ const handleInputFocus = t23;
387
+ let t24;
388
+ $[77] === Symbol.for("react.memo_cache_sentinel") ? (t24 = () => {
339
389
  popoverMouseWithinRef.current = !0;
340
- }, []), handlePopoverMouseLeave = react.useCallback(() => {
390
+ }, $[77] = t24) : t24 = $[77];
391
+ const handlePopoverMouseEnter = t24;
392
+ let t25;
393
+ $[78] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
341
394
  popoverMouseWithinRef.current = !1;
342
- }, []), handleClearButtonClick = react.useCallback(() => {
395
+ }, $[78] = t25) : t25 = $[78];
396
+ const handlePopoverMouseLeave = t25;
397
+ let t26;
398
+ $[79] !== onChange || $[80] !== onQueryChange ? (t26 = () => {
343
399
  dispatch({
344
400
  type: "root/clear"
345
401
  }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
346
- }, [onChange, onQueryChange]), handleClearButtonFocus = react.useCallback(() => {
402
+ }, $[79] = onChange, $[80] = onQueryChange, $[81] = t26) : t26 = $[81];
403
+ const handleClearButtonClick = t26;
404
+ let t27;
405
+ $[82] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
347
406
  dispatch({
348
407
  type: "input/focus"
349
408
  });
350
- }, []);
351
- react.useEffect(() => {
409
+ }, $[82] = t27) : t27 = $[82];
410
+ const handleClearButtonFocus = t27;
411
+ let t28, t29;
412
+ $[83] !== valueProp ? (t28 = () => {
352
413
  if (valueProp !== valuePropRef.current) {
353
414
  valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
354
415
  type: "value/change",
@@ -360,14 +421,19 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
360
421
  type: "value/change",
361
422
  value: valueProp || null
362
423
  }));
363
- }, [valueProp]), react.useEffect(() => {
424
+ }, t29 = [valueProp], $[83] = valueProp, $[84] = t28, $[85] = t29) : (t28 = $[84], t29 = $[85]), react.useEffect(t28, t29);
425
+ let t30, t31;
426
+ $[86] !== focused ? (t30 = () => {
364
427
  !focused && valueRef.current && dispatch({
365
428
  type: "root/setActiveValue",
366
429
  value: valueRef.current
367
430
  });
368
- }, [focused]), react.useEffect(() => {
431
+ }, t31 = [focused], $[86] = focused, $[87] = t30, $[88] = t31) : (t30 = $[87], t31 = $[88]), react.useEffect(t30, t31);
432
+ let t32, t33;
433
+ $[89] !== activeValue || $[90] !== filteredOptions ? (t32 = () => {
369
434
  const listElement = listBoxElementRef.current;
370
- if (!listElement) return;
435
+ if (!listElement)
436
+ return;
371
437
  const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
372
438
  if (activeOption_1) {
373
439
  const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
@@ -377,29 +443,95 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
377
443
  focusFirstDescendant(activeItemElement);
378
444
  }
379
445
  }
380
- }, [activeValue, filteredOptions]);
381
- const clearButton = react.useMemo(() => {
382
- if (!loading && !disabled && value)
383
- return {
446
+ }, t33 = [activeValue, filteredOptions], $[89] = activeValue, $[90] = filteredOptions, $[91] = t32, $[92] = t33) : (t32 = $[91], t33 = $[92]), react.useEffect(t32, t33);
447
+ let t34;
448
+ bb0: {
449
+ if (!loading && !disabled && value) {
450
+ let t352;
451
+ $[93] === Symbol.for("react.memo_cache_sentinel") ? (t352 = {
384
452
  "aria-label": "Clear",
385
453
  onFocus: handleClearButtonFocus
386
- };
387
- }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = react.useMemo(() => padding.map((v_0) => v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2), [padding]), openButtonPadding = react.useMemo(() => padding.map((v_1) => Math.max(v_1 - 1, 0)), [padding]), openButtonProps = react.useMemo(() => typeof openButton == "object" ? openButton : _visualEditing.EMPTY_RECORD, [openButton]), handleOpenClick = react.useCallback((event_4) => {
454
+ }, $[93] = t352) : t352 = $[93], t34 = t352;
455
+ break bb0;
456
+ }
457
+ t34 = void 0;
458
+ }
459
+ const clearButton = t34, openButtonBoxPadding = padding.map(_temp$3), openButtonPadding = padding.map(_temp2$1), openButtonProps = typeof openButton == "object" ? openButton : _visualEditing.EMPTY_RECORD;
460
+ let t35;
461
+ $[94] !== dispatchOpen || $[95] !== openButtonProps ? (t35 = (event_4) => {
388
462
  dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
389
- }, [openButtonProps, dispatchOpen]), openButtonNode = react.useMemo(() => !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Open", disabled: expanded, fontSize, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, [disabled, expanded, fontSize, handleOpenClick, openButton, openButtonBoxPadding, openButtonPadding, openButtonProps, readOnly]), inputValue = react.useMemo(() => query === null ? value !== null ? renderValue(value, currentOption) : "" : query, [currentOption, query, renderValue, value]), handleListBoxKeyDown = react.useCallback((event_5) => {
463
+ }, $[94] = dispatchOpen, $[95] = openButtonProps, $[96] = t35) : t35 = $[96];
464
+ const handleOpenClick = t35;
465
+ let t36;
466
+ $[97] !== disabled || $[98] !== expanded || $[99] !== fontSize || $[100] !== handleOpenClick || $[101] !== openButton || $[102] !== openButtonBoxPadding || $[103] !== openButtonPadding || $[104] !== openButtonProps || $[105] !== readOnly ? (t36 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Open", disabled: expanded, fontSize, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, $[97] = disabled, $[98] = expanded, $[99] = fontSize, $[100] = handleOpenClick, $[101] = openButton, $[102] = openButtonBoxPadding, $[103] = openButtonPadding, $[104] = openButtonProps, $[105] = readOnly, $[106] = t36) : t36 = $[106];
467
+ const openButtonNode = t36;
468
+ let t37;
469
+ bb1: {
470
+ if (query === null) {
471
+ if (value !== null) {
472
+ let t382;
473
+ $[107] !== currentOption || $[108] !== renderValue || $[109] !== value ? (t382 = renderValue(value, currentOption), $[107] = currentOption, $[108] = renderValue, $[109] = value, $[110] = t382) : t382 = $[110], t37 = t382;
474
+ break bb1;
475
+ }
476
+ t37 = "";
477
+ break bb1;
478
+ }
479
+ t37 = query;
480
+ }
481
+ const inputValue = t37;
482
+ let t38;
483
+ $[111] !== listFocused ? (t38 = (event_5) => {
390
484
  event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
391
- }, [listFocused]), content2 = react.useMemo(() => filteredOptions.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(ListBox, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", id: listBoxId, ref: listBoxElementRef, role: "listbox", space: 1, children: filteredOptions.map((option_0) => {
392
- const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
393
- return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
394
- disabled: loading,
395
- selected: active,
396
- tabIndex: listFocused && active ? 0 : -1
397
- }) }, option_0.value);
398
- }) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = react.useMemo(() => renderPopover ? /* @__PURE__ */ jsxRuntime.jsx(RenderPopover, { content: content2, hidden: !expanded, inputElement, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, resultsPopoverElementRef, renderPopover }) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius, ref: resultsPopoverElementRef, referenceElement: inputElement, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, inputElement, popover, radius, renderPopover]);
399
- return /* @__PURE__ */ jsxRuntime.jsxs(StyledAutocomplete, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
400
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TextInput, { ...restProps, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", border, clearButton, customValidity, disabled, fontSize, icon, iconRight: loading && AnimatedSpinnerIcon, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: setInputElement, role: "combobox", spellCheck: !1, suffix: suffix || openButtonNode, value: inputValue }),
485
+ }, $[111] = listFocused, $[112] = t38) : t38 = $[112];
486
+ const handleListBoxKeyDown = t38;
487
+ let t39;
488
+ bb2: {
489
+ if (filteredOptions.length === 0) {
490
+ t39 = null;
491
+ break bb2;
492
+ }
493
+ let t402;
494
+ if ($[113] !== activeValue || $[114] !== currentOption || $[115] !== filteredOptions || $[116] !== handleOptionSelect || $[117] !== id || $[118] !== listFocused || $[119] !== loading || $[120] !== renderOption) {
495
+ let t413;
496
+ $[122] !== activeValue || $[123] !== currentOption || $[124] !== handleOptionSelect || $[125] !== id || $[126] !== listFocused || $[127] !== loading || $[128] !== renderOption ? (t413 = (option_0) => {
497
+ const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
498
+ return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
499
+ disabled: loading,
500
+ selected: active,
501
+ tabIndex: listFocused && active ? 0 : -1
502
+ }) }, option_0.value);
503
+ }, $[122] = activeValue, $[123] = currentOption, $[124] = handleOptionSelect, $[125] = id, $[126] = listFocused, $[127] = loading, $[128] = renderOption, $[129] = t413) : t413 = $[129], t402 = filteredOptions.map(t413), $[113] = activeValue, $[114] = currentOption, $[115] = filteredOptions, $[116] = handleOptionSelect, $[117] = id, $[118] = listFocused, $[119] = loading, $[120] = renderOption, $[121] = t402;
504
+ } else
505
+ t402 = $[121];
506
+ let t412;
507
+ $[130] !== listBoxId || $[131] !== t402 ? (t412 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", id: listBoxId, ref: listBoxElementRef, role: "listbox", space: 1, children: t402 }), $[130] = listBoxId, $[131] = t402, $[132] = t412) : t412 = $[132];
508
+ let t422;
509
+ $[133] !== handleListBoxKeyDown || $[134] !== listBox || $[135] !== t412 ? (t422 = /* @__PURE__ */ jsxRuntime.jsx(ListBox, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: t412 }), $[133] = handleListBoxKeyDown, $[134] = listBox, $[135] = t412, $[136] = t422) : t422 = $[136], t39 = t422;
510
+ }
511
+ const content2 = t39;
512
+ let t40;
513
+ bb3: {
514
+ if (renderPopover) {
515
+ const t413 = !expanded;
516
+ let t422;
517
+ $[137] !== content2 || $[138] !== handlePopoverMouseEnter || $[139] !== handlePopoverMouseLeave || $[140] !== inputElement || $[141] !== renderPopover || $[142] !== t413 ? (t422 = /* @__PURE__ */ jsxRuntime.jsx(RenderPopover, { content: content2, hidden: t413, inputElement, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, resultsPopoverElementRef, renderPopover }), $[137] = content2, $[138] = handlePopoverMouseEnter, $[139] = handlePopoverMouseLeave, $[140] = inputElement, $[141] = renderPopover, $[142] = t413, $[143] = t422) : t422 = $[143], t40 = t422;
518
+ break bb3;
519
+ }
520
+ if (filteredOptionsLen === 0) {
521
+ t40 = null;
522
+ break bb3;
523
+ }
524
+ let t412;
525
+ $[144] !== content2 || $[145] !== expanded || $[146] !== handlePopoverMouseEnter || $[147] !== handlePopoverMouseLeave || $[148] !== inputElement || $[149] !== popover || $[150] !== radius ? (t412 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius, ref: resultsPopoverElementRef, referenceElement: inputElement, ...popover }), $[144] = content2, $[145] = expanded, $[146] = handlePopoverMouseEnter, $[147] = handlePopoverMouseLeave, $[148] = inputElement, $[149] = popover, $[150] = radius, $[151] = t412) : t412 = $[151], t40 = t412;
526
+ }
527
+ const results = t40, t41 = loading && AnimatedSpinnerIcon, t42 = suffix || openButtonNode;
528
+ let t43;
529
+ $[152] !== activeItemId || $[153] !== border || $[154] !== clearButton || $[155] !== customValidity || $[156] !== disabled || $[157] !== expanded || $[158] !== fontSize || $[159] !== handleClearButtonClick || $[160] !== handleInputChange || $[161] !== handleInputFocus || $[162] !== icon || $[163] !== id || $[164] !== inputValue || $[165] !== listBoxId || $[166] !== padding || $[167] !== prefix || $[168] !== radius || $[169] !== readOnly || $[170] !== restProps || $[171] !== t41 || $[172] !== t42 ? (t43 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TextInput, { ...restProps, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", border, clearButton, customValidity, disabled, fontSize, icon, iconRight: t41, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: setInputElement, role: "combobox", spellCheck: !1, suffix: t42, value: inputValue }), $[152] = activeItemId, $[153] = border, $[154] = clearButton, $[155] = customValidity, $[156] = disabled, $[157] = expanded, $[158] = fontSize, $[159] = handleClearButtonClick, $[160] = handleInputChange, $[161] = handleInputFocus, $[162] = icon, $[163] = id, $[164] = inputValue, $[165] = listBoxId, $[166] = padding, $[167] = prefix, $[168] = radius, $[169] = readOnly, $[170] = restProps, $[171] = t41, $[172] = t42, $[173] = t43) : t43 = $[173];
530
+ let t44;
531
+ return $[174] !== handleRootBlur || $[175] !== handleRootFocus || $[176] !== handleRootKeyDown || $[177] !== results || $[178] !== t43 ? (t44 = /* @__PURE__ */ jsxRuntime.jsxs(StyledAutocomplete, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
532
+ t43,
401
533
  results
402
- ] });
534
+ ] }), $[174] = handleRootBlur, $[175] = handleRootFocus, $[176] = handleRootKeyDown, $[177] = results, $[178] = t43, $[179] = t44) : t44 = $[179], t44;
403
535
  });
404
536
  function RenderPopover({
405
537
  renderPopover,
@@ -419,7 +551,14 @@ function RenderPopover({
419
551
  }, resultsPopoverElementRef);
420
552
  }
421
553
  InnerAutocomplete.displayName = "ForwardRef(Autocomplete)";
422
- const Autocomplete = InnerAutocomplete, StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
554
+ const Autocomplete = InnerAutocomplete;
555
+ function _temp$3(v_0) {
556
+ return v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2;
557
+ }
558
+ function _temp2$1(v_1) {
559
+ return Math.max(v_1 - 1, 0);
560
+ }
561
+ const StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
423
562
  displayName: "StyledBreadcrumbs",
424
563
  componentId: "sc-1es8h8q-0"
425
564
  })`margin:0;padding:0;display:flex;list-style:none;align-items:center;white-space:nowrap;line-height:0;`, ExpandButton = styledComponents.styled(_visualEditing.Button).withConfig({