@sanity/ui 3.0.13 → 3.0.15-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +886 -1751
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-cjs/refractor.js +7 -15
  4. package/dist/_chunks-cjs/refractor.js.map +1 -1
  5. package/dist/_chunks-es/_visual-editing.mjs +887 -1753
  6. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  7. package/dist/_chunks-es/refractor.mjs +6 -15
  8. package/dist/_chunks-es/refractor.mjs.map +1 -1
  9. package/dist/index.d.mts +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +349 -810
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +350 -812
  14. package/dist/index.mjs.map +1 -1
  15. package/package.json +27 -41
  16. package/src/core/components/autocomplete/autocomplete.tsx +10 -14
  17. package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -2
  18. package/src/core/components/dialog/dialog.tsx +10 -14
  19. package/src/core/components/hotkeys/hotkeys.tsx +2 -2
  20. package/src/core/components/menu/menuGroup.tsx +2 -2
  21. package/src/core/components/menu/menuItem.tsx +4 -4
  22. package/src/core/components/skeleton/skeleton.tsx +2 -2
  23. package/src/core/components/skeleton/textSkeleton.tsx +5 -6
  24. package/src/core/hooks/index.ts +1 -1
  25. package/src/core/hooks/useArrayProp.ts +3 -17
  26. package/src/core/primitives/avatar/avatar.tsx +14 -16
  27. package/src/core/primitives/avatar/avatarCounter.tsx +14 -17
  28. package/src/core/primitives/avatar/avatarStack.tsx +2 -3
  29. package/src/core/primitives/badge/badge.tsx +3 -3
  30. package/src/core/primitives/box/box.tsx +26 -26
  31. package/src/core/primitives/button/button.tsx +11 -12
  32. package/src/core/primitives/card/card.tsx +8 -8
  33. package/src/core/primitives/code/code.tsx +8 -2
  34. package/src/core/primitives/container/container.tsx +2 -2
  35. package/src/core/primitives/flex/flex.tsx +6 -6
  36. package/src/core/primitives/grid/grid.tsx +9 -9
  37. package/src/core/primitives/heading/heading.tsx +3 -3
  38. package/src/core/primitives/inline/inline.tsx +2 -2
  39. package/src/core/primitives/kbd/kbd.tsx +2 -2
  40. package/src/core/primitives/label/label.tsx +3 -3
  41. package/src/core/primitives/popover/popover.tsx +7 -6
  42. package/src/core/primitives/select/select.tsx +6 -5
  43. package/src/core/primitives/stack/stack.tsx +2 -2
  44. package/src/core/primitives/text/text.tsx +3 -3
  45. package/src/core/primitives/textArea/textArea.tsx +6 -5
  46. package/src/core/primitives/textInput/textInput.tsx +6 -5
  47. package/src/core/primitives/tooltip/tooltip.tsx +3 -2
  48. package/src/core/utils/layer/layerProvider.tsx +3 -2
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"), 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");
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"), theme = require("@sanity/ui/theme"), framerMotion = require("framer-motion");
4
4
  function _raf(fn) {
5
5
  const frameId = requestAnimationFrame(fn);
6
6
  return () => {
@@ -47,19 +47,18 @@ function focusLastDescendant(element) {
47
47
  }
48
48
  return !1;
49
49
  }
50
+ function useArrayProp(val, defaultVal) {
51
+ return react.useMemo(() => _visualEditing._getArrayProp(val, defaultVal), [val, defaultVal]);
52
+ }
50
53
  function _getElements(element, elementsArg) {
51
54
  const ret = [element];
52
55
  for (const el of elementsArg)
53
56
  Array.isArray(el) ? ret.push(...el) : ret.push(el);
54
57
  return ret.filter(Boolean);
55
58
  }
56
- function useClickOutside(listener, t0, boundaryElement) {
57
- const $ = reactCompilerRuntime.c(12), elementsArg = t0 === void 0 ? _visualEditing.EMPTY_ARRAY : t0, [element, setElement] = react.useState(null);
58
- let t1;
59
- $[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
60
- const [elements, setElements] = react.useState(t1), elementsRef = react.useRef(elements);
61
- let t2, t3;
62
- $[3] !== element || $[4] !== elementsArg ? (t2 = () => {
59
+ function useClickOutside(listener, elementsArg = _visualEditing.EMPTY_ARRAY, boundaryElement) {
60
+ const [element, setElement] = react.useState(null), [elements, setElements] = react.useState(() => _getElements(element, elementsArg)), elementsRef = react.useRef(elements);
61
+ return react.useEffect(() => {
63
62
  const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
64
63
  if (prevElements.length !== nextElements.length) {
65
64
  setElements(nextElements), elementsRef.current = nextElements;
@@ -70,21 +69,18 @@ function useClickOutside(listener, t0, boundaryElement) {
70
69
  setElements(nextElements), elementsRef.current = nextElements;
71
70
  return;
72
71
  }
73
- for (const el_0 of nextElements)
74
- if (!prevElements.includes(el_0)) {
72
+ for (const el of nextElements)
73
+ if (!prevElements.includes(el)) {
75
74
  setElements(nextElements), elementsRef.current = nextElements;
76
75
  return;
77
76
  }
78
- }, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), react.useEffect(t2, t3);
79
- let t4, t5;
80
- return $[7] !== boundaryElement || $[8] !== elements || $[9] !== listener ? (t4 = () => {
81
- if (!listener)
82
- return;
77
+ }, [element, elementsArg]), react.useEffect(() => {
78
+ if (!listener) return;
83
79
  const handleWindowMouseDown = (evt) => {
84
80
  const target = evt.target;
85
81
  if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
86
- for (const el_1 of elements)
87
- if (target === el_1 || el_1.contains(target))
82
+ for (const el of elements)
83
+ if (target === el || el.contains(target))
88
84
  return;
89
85
  listener(evt);
90
86
  }
@@ -92,15 +88,14 @@ function useClickOutside(listener, t0, boundaryElement) {
92
88
  return window.addEventListener("mousedown", handleWindowMouseDown), () => {
93
89
  window.removeEventListener("mousedown", handleWindowMouseDown);
94
90
  };
95
- }, t5 = [boundaryElement, listener, elements], $[7] = boundaryElement, $[8] = elements, $[9] = listener, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), react.useEffect(t4, t5), setElement;
91
+ }, [boundaryElement, listener, elements]), setElement;
96
92
  }
97
93
  function useElementRect(element) {
98
94
  return _visualEditing.useElementSize(element)?._contentRect || null;
99
95
  }
100
96
  function useForwardedRef(ref) {
101
- const $ = reactCompilerRuntime.c(1), innerRef = react.useRef(null);
102
- let t0;
103
- return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => innerRef.current, $[0] = t0) : t0 = $[0], react.useImperativeHandle(ref, t0), innerRef;
97
+ const innerRef = react.useRef(null);
98
+ return react.useImperativeHandle(ref, () => innerRef.current), innerRef;
104
99
  }
105
100
  class ErrorBoundary extends react.Component {
106
101
  state = {
@@ -147,27 +142,20 @@ const StyledAutocomplete = styledComponents.styled.div.withConfig({
147
142
  componentId: "sc-1igauft-2"
148
143
  })`animation:${rotate} 500ms linear infinite;`;
149
144
  function AutocompleteOption(props) {
150
- const $ = reactCompilerRuntime.c(11), {
145
+ const {
151
146
  children,
152
147
  id,
153
148
  onSelect,
154
149
  selected,
155
150
  value
156
- } = props;
157
- let t0;
158
- $[0] !== onSelect || $[1] !== value ? (t0 = () => {
151
+ } = props, handleClick = react.useCallback(() => {
159
152
  setTimeout(() => {
160
153
  onSelect(value);
161
154
  }, 0);
162
- }, $[0] = onSelect, $[1] = value, $[2] = t0) : t0 = $[2];
163
- const handleClick = t0;
164
- let t1;
165
- $[3] !== handleClick ? (t1 = (event) => {
155
+ }, [onSelect, value]), handleKeyDown = react.useCallback((event) => {
166
156
  event.key === "Enter" && !_visualEditing._isEnterToClickElement(event.currentTarget) && handleClick();
167
- }, $[3] = handleClick, $[4] = t1) : t1 = $[4];
168
- const handleKeyDown = t1;
169
- let t2;
170
- return $[5] !== children || $[6] !== handleClick || $[7] !== handleKeyDown || $[8] !== id || $[9] !== selected ? (t2 = /* @__PURE__ */ jsxRuntime.jsx("li", { "aria-selected": selected, "data-ui": "AutocompleteOption", id, role: "option", onClick: handleClick, onKeyDown: handleKeyDown, children }), $[5] = children, $[6] = handleClick, $[7] = handleKeyDown, $[8] = id, $[9] = selected, $[10] = t2) : t2 = $[10], t2;
157
+ }, [handleClick]);
158
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { "aria-selected": selected, "data-ui": "AutocompleteOption", id, role: "option", onClick: handleClick, onKeyDown: handleKeyDown, children });
171
159
  }
172
160
  function autocompleteReducer(state, msg) {
173
161
  return msg.type === "input/change" ? {
@@ -209,17 +197,15 @@ function autocompleteReducer(state, msg) {
209
197
  } : state;
210
198
  }
211
199
  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) {
212
- const $ = reactCompilerRuntime.c(179);
213
- 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;
214
- $[0] !== props ? ({
215
- border: t0,
200
+ const {
201
+ border = !0,
216
202
  customValidity,
217
203
  disabled,
218
204
  filterOption: filterOptionProp,
219
- fontSize: t1,
205
+ fontSize = 2,
220
206
  icon,
221
207
  id,
222
- listBox: t2,
208
+ listBox = _visualEditing.EMPTY_RECORD,
223
209
  loading,
224
210
  onBlur,
225
211
  onChange,
@@ -229,60 +215,35 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
229
215
  openButton,
230
216
  openOnFocus,
231
217
  options: optionsProp,
232
- padding: t3,
233
- popover: t4,
218
+ padding: paddingProp = 3,
219
+ popover = _visualEditing.EMPTY_RECORD,
234
220
  prefix,
235
- radius: t5,
221
+ radius = 2,
236
222
  readOnly,
237
223
  relatedElements,
238
224
  renderOption: renderOptionProp,
239
225
  renderPopover,
240
- renderValue: t6,
226
+ renderValue = DEFAULT_RENDER_VALUE,
241
227
  suffix,
242
228
  value: valueProp,
243
229
  ...restProps
244
- } = 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]);
245
- 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;
246
- let t9;
247
- $[30] !== t7 || $[31] !== t8 ? (t9 = {
248
- activeValue: t7,
230
+ } = props, [state, dispatch] = react.useReducer(autocompleteReducer, {
231
+ activeValue: valueProp || null,
249
232
  focused: !1,
250
233
  listFocused: !1,
251
234
  query: null,
252
- value: t8
253
- }, $[30] = t7, $[31] = t8, $[32] = t9) : t9 = $[32];
254
- const [state, dispatch] = react.useReducer(autocompleteReducer, t9), {
235
+ value: valueProp || null
236
+ }), {
255
237
  activeValue,
256
238
  focused,
257
239
  listFocused,
258
240
  query,
259
241
  value
260
- } = state;
261
- let t10;
262
- $[33] !== fontSize || $[34] !== paddingProp ? (t10 = (t112) => {
263
- const {
264
- value: value_0
265
- } = t112;
266
- 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 }) });
267
- }, $[33] = fontSize, $[34] = paddingProp, $[35] = t10) : t10 = $[35];
268
- 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);
269
- let t11, t12;
270
- $[36] !== inputElement ? (t11 = () => inputElement, t12 = [inputElement], $[36] = inputElement, $[37] = t11, $[38] = t12) : (t11 = $[37], t12 = $[38]), react.useImperativeHandle(inputElementRef, t11, t12);
271
- let t13, t14;
272
- $[39] !== inputElement ? (t13 = () => inputElement, t14 = [inputElement], $[39] = inputElement, $[40] = t13, $[41] = t14) : (t13 = $[40], t14 = $[41]), react.useImperativeHandle(forwardedRef, t13, t14);
273
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : _visualEditing.EMPTY_ARRAY, padding = _visualEditing.useArrayProp(paddingProp);
274
- let t15;
275
- $[42] !== options || $[43] !== value ? (t15 = value !== null ? options.find((o) => o.value === value) : void 0, $[42] = options, $[43] = value, $[44] = t15) : t15 = $[44];
276
- const currentOption = t15;
277
- let t16;
278
- if ($[45] !== filterOption || $[46] !== options || $[47] !== query) {
279
- let t172;
280
- $[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;
281
- } else
282
- t16 = $[48];
283
- const filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null;
284
- let t17;
285
- $[52] !== onBlur || $[53] !== onQueryChange || $[54] !== relatedElements ? (t17 = (event) => {
242
+ } = state, defaultRenderOption = react.useCallback(({
243
+ value: value2
244
+ }) => /* @__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: value2 }) }), [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);
245
+ react.useImperativeHandle(inputElementRef, () => inputElement, [inputElement]), react.useImperativeHandle(forwardedRef, () => inputElement, [inputElement]);
246
+ 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) => {
286
247
  setTimeout(() => {
287
248
  if (popoverMouseWithinRef.current)
288
249
  return;
@@ -299,31 +260,21 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
299
260
  type: "root/blur"
300
261
  }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
301
262
  }, 0);
302
- }, $[52] = onBlur, $[53] = onQueryChange, $[54] = relatedElements, $[55] = t17) : t17 = $[55];
303
- const handleRootBlur = t17;
304
- let t18;
305
- $[56] === Symbol.for("react.memo_cache_sentinel") ? (t18 = (event_0) => {
306
- const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
307
- listFocused_0 !== listFocusedRef.current && (listFocusedRef.current = listFocused_0, dispatch({
263
+ }, [onBlur, onQueryChange, relatedElements]), handleRootFocus = react.useCallback((event) => {
264
+ const listBoxElement = listBoxElementRef.current, focusedElement = event.target instanceof HTMLElement ? event.target : null, listFocused2 = listBoxElement?.contains(focusedElement) || !1;
265
+ listFocused2 !== listFocusedRef.current && (listFocusedRef.current = listFocused2, dispatch({
308
266
  type: "root/setListFocused",
309
- listFocused: listFocused_0
267
+ listFocused: listFocused2
310
268
  }));
311
- }, $[56] = t18) : t18 = $[56];
312
- const handleRootFocus = t18;
313
- let t19;
314
- $[57] !== onChange || $[58] !== onQueryChange || $[59] !== onSelect ? (t19 = (v) => {
269
+ }, []), handleOptionSelect = react.useCallback((v) => {
315
270
  dispatch({
316
271
  type: "value/change",
317
272
  value: v
318
273
  }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
319
- }, $[57] = onChange, $[58] = onQueryChange, $[59] = onSelect, $[60] = t19) : t19 = $[60];
320
- const handleOptionSelect = t19;
321
- let t20;
322
- $[61] !== activeValue || $[62] !== filteredOptions || $[63] !== filteredOptionsLen || $[64] !== onQueryChange ? (t20 = (event_1) => {
323
- if (event_1.key === "ArrowDown") {
324
- if (event_1.preventDefault(), !filteredOptionsLen)
325
- return;
326
- const activeOption = filteredOptions.find((o_0) => o_0.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
274
+ }, [onChange, onSelect, onQueryChange]), handleRootKeyDown = react.useCallback((event) => {
275
+ if (event.key === "ArrowDown") {
276
+ if (event.preventDefault(), !filteredOptionsLen) return;
277
+ const activeOption = filteredOptions.find((o) => o.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[(activeIndex + 1) % filteredOptionsLen];
327
278
  nextActiveOption && dispatch({
328
279
  type: "root/setActiveValue",
329
280
  value: nextActiveOption.value,
@@ -331,80 +282,56 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
331
282
  });
332
283
  return;
333
284
  }
334
- if (event_1.key === "ArrowUp") {
335
- if (event_1.preventDefault(), !filteredOptionsLen)
336
- return;
337
- 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];
338
- nextActiveOption_0 && dispatch({
285
+ if (event.key === "ArrowUp") {
286
+ if (event.preventDefault(), !filteredOptionsLen) return;
287
+ const activeOption = filteredOptions.find((o) => o.value === activeValue), activeIndex = activeOption ? filteredOptions.indexOf(activeOption) : -1, nextActiveOption = filteredOptions[activeIndex === -1 ? filteredOptionsLen - 1 : (filteredOptionsLen + activeIndex - 1) % filteredOptionsLen];
288
+ nextActiveOption && dispatch({
339
289
  type: "root/setActiveValue",
340
- value: nextActiveOption_0.value,
290
+ value: nextActiveOption.value,
341
291
  listFocused: !0
342
292
  });
343
293
  return;
344
294
  }
345
- if (event_1.key === "Escape") {
295
+ if (event.key === "Escape") {
346
296
  dispatch({
347
297
  type: "root/escape"
348
298
  }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
349
299
  return;
350
300
  }
351
- const target = event_1.target, listEl = listBoxElementRef.current;
352
- if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event_1.key)) {
301
+ const target = event.target, listEl = listBoxElementRef.current;
302
+ if ((listEl === target || listEl?.contains(target)) && !AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event.key)) {
353
303
  inputElementRef.current?.focus();
354
304
  return;
355
305
  }
356
- }, $[61] = activeValue, $[62] = filteredOptions, $[63] = filteredOptionsLen, $[64] = onQueryChange, $[65] = t20) : t20 = $[65];
357
- const handleRootKeyDown = t20;
358
- let t21;
359
- $[66] !== onQueryChange ? (t21 = (event_2) => {
360
- const nextQuery = event_2.currentTarget.value;
306
+ }, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = react.useCallback((event) => {
307
+ const nextQuery = event.currentTarget.value;
361
308
  dispatch({
362
309
  type: "input/change",
363
310
  query: nextQuery
364
311
  }), onQueryChange && onQueryChange(nextQuery);
365
- }, $[66] = onQueryChange, $[67] = t21) : t21 = $[67];
366
- const handleInputChange = t21;
367
- let t22;
368
- $[68] !== currentOption || $[69] !== renderValue || $[70] !== value ? (t22 = () => {
312
+ }, [onQueryChange]), dispatchOpen = react.useCallback(() => {
369
313
  dispatch({
370
314
  type: "root/open",
371
315
  query: value ? renderValue(value, currentOption) : ""
372
316
  });
373
- }, $[68] = currentOption, $[69] = renderValue, $[70] = value, $[71] = t22) : t22 = $[71];
374
- const dispatchOpen = t22;
375
- let t23;
376
- $[72] !== dispatchOpen || $[73] !== focused || $[74] !== onFocus || $[75] !== openOnFocus ? (t23 = (event_3) => {
317
+ }, [currentOption, renderValue, value]), handleInputFocus = react.useCallback((event) => {
377
318
  focused || (dispatch({
378
319
  type: "input/focus"
379
- }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
380
- }, $[72] = dispatchOpen, $[73] = focused, $[74] = onFocus, $[75] = openOnFocus, $[76] = t23) : t23 = $[76];
381
- const handleInputFocus = t23;
382
- let t24;
383
- $[77] === Symbol.for("react.memo_cache_sentinel") ? (t24 = () => {
320
+ }), onFocus && onFocus(event), openOnFocus && dispatchOpen());
321
+ }, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = react.useCallback(() => {
384
322
  popoverMouseWithinRef.current = !0;
385
- }, $[77] = t24) : t24 = $[77];
386
- const handlePopoverMouseEnter = t24;
387
- let t25;
388
- $[78] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
323
+ }, []), handlePopoverMouseLeave = react.useCallback(() => {
389
324
  popoverMouseWithinRef.current = !1;
390
- }, $[78] = t25) : t25 = $[78];
391
- const handlePopoverMouseLeave = t25;
392
- let t26;
393
- $[79] !== onChange || $[80] !== onQueryChange ? (t26 = () => {
325
+ }, []), handleClearButtonClick = react.useCallback(() => {
394
326
  dispatch({
395
327
  type: "root/clear"
396
328
  }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
397
- }, $[79] = onChange, $[80] = onQueryChange, $[81] = t26) : t26 = $[81];
398
- const handleClearButtonClick = t26;
399
- let t27;
400
- $[82] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
329
+ }, [onChange, onQueryChange]), handleClearButtonFocus = react.useCallback(() => {
401
330
  dispatch({
402
331
  type: "input/focus"
403
332
  });
404
- }, $[82] = t27) : t27 = $[82];
405
- const handleClearButtonFocus = t27;
406
- let t28, t29;
407
- $[83] !== valueProp ? (t28 = () => {
333
+ }, []);
334
+ react.useEffect(() => {
408
335
  if (valueProp !== valuePropRef.current) {
409
336
  valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
410
337
  type: "value/change",
@@ -416,123 +343,46 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
416
343
  type: "value/change",
417
344
  value: valueProp || null
418
345
  }));
419
- }, t29 = [valueProp], $[83] = valueProp, $[84] = t28, $[85] = t29) : (t28 = $[84], t29 = $[85]), react.useEffect(t28, t29);
420
- let t30, t31;
421
- $[86] !== focused ? (t30 = () => {
346
+ }, [valueProp]), react.useEffect(() => {
422
347
  !focused && valueRef.current && dispatch({
423
348
  type: "root/setActiveValue",
424
349
  value: valueRef.current
425
350
  });
426
- }, t31 = [focused], $[86] = focused, $[87] = t30, $[88] = t31) : (t30 = $[87], t31 = $[88]), react.useEffect(t30, t31);
427
- let t32, t33;
428
- $[89] !== activeValue || $[90] !== filteredOptions ? (t32 = () => {
351
+ }, [focused]), react.useEffect(() => {
429
352
  const listElement = listBoxElementRef.current;
430
- if (!listElement)
431
- return;
432
- const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
433
- if (activeOption_1) {
434
- const activeIndex_1 = filteredOptions.indexOf(activeOption_1), activeItemElement = listElement.childNodes[activeIndex_1];
353
+ if (!listElement) return;
354
+ const activeOption = filteredOptions.find((o) => o.value === activeValue);
355
+ if (activeOption) {
356
+ const activeIndex = filteredOptions.indexOf(activeOption), activeItemElement = listElement.childNodes[activeIndex];
435
357
  if (activeItemElement) {
436
358
  if (_hasFocus(activeItemElement))
437
359
  return;
438
360
  focusFirstDescendant(activeItemElement);
439
361
  }
440
362
  }
441
- }, t33 = [activeValue, filteredOptions], $[89] = activeValue, $[90] = filteredOptions, $[91] = t32, $[92] = t33) : (t32 = $[91], t33 = $[92]), react.useEffect(t32, t33);
442
- let t34;
443
- bb0: {
444
- if (!loading && !disabled && value) {
445
- let t352;
446
- $[93] === Symbol.for("react.memo_cache_sentinel") ? (t352 = {
363
+ }, [activeValue, filteredOptions]);
364
+ const clearButton = react.useMemo(() => {
365
+ if (!loading && !disabled && value)
366
+ return {
447
367
  "aria-label": "Clear",
448
368
  onFocus: handleClearButtonFocus
449
- }, $[93] = t352) : t352 = $[93], t34 = t352;
450
- break bb0;
451
- }
452
- t34 = void 0;
453
- }
454
- const clearButton = t34;
455
- let t35;
456
- $[94] !== padding ? (t35 = padding.map(_temp$3), $[94] = padding, $[95] = t35) : t35 = $[95];
457
- const openButtonBoxPadding = t35;
458
- let t36;
459
- $[96] !== padding ? (t36 = padding.map(_temp2$1), $[96] = padding, $[97] = t36) : t36 = $[97];
460
- const openButtonPadding = t36, openButtonProps = typeof openButton == "object" ? openButton : _visualEditing.EMPTY_RECORD;
461
- let t37;
462
- $[98] !== dispatchOpen || $[99] !== openButtonProps ? (t37 = (event_4) => {
463
- dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
464
- }, $[98] = dispatchOpen, $[99] = openButtonProps, $[100] = t37) : t37 = $[100];
465
- const handleOpenClick = t37;
466
- let t38;
467
- $[101] !== disabled || $[102] !== expanded || $[103] !== fontSize || $[104] !== handleOpenClick || $[105] !== openButton || $[106] !== openButtonBoxPadding || $[107] !== openButtonPadding || $[108] !== openButtonProps || $[109] !== readOnly ? (t38 = !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, $[101] = disabled, $[102] = expanded, $[103] = fontSize, $[104] = handleOpenClick, $[105] = openButton, $[106] = openButtonBoxPadding, $[107] = openButtonPadding, $[108] = openButtonProps, $[109] = readOnly, $[110] = t38) : t38 = $[110];
468
- const openButtonNode = t38;
469
- let t39;
470
- bb1: {
471
- if (query === null) {
472
- if (value !== null) {
473
- let t402;
474
- $[111] !== currentOption || $[112] !== renderValue || $[113] !== value ? (t402 = renderValue(value, currentOption), $[111] = currentOption, $[112] = renderValue, $[113] = value, $[114] = t402) : t402 = $[114], t39 = t402;
475
- break bb1;
476
- }
477
- t39 = "";
478
- break bb1;
479
- }
480
- t39 = query;
481
- }
482
- const inputValue = t39;
483
- let t40;
484
- $[115] !== listFocused ? (t40 = (event_5) => {
485
- event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
486
- }, $[115] = listFocused, $[116] = t40) : t40 = $[116];
487
- const handleListBoxKeyDown = t40;
488
- let t41;
489
- bb2: {
490
- if (filteredOptions.length === 0) {
491
- t41 = null;
492
- break bb2;
493
- }
494
- let t422;
495
- if ($[117] !== activeValue || $[118] !== currentOption || $[119] !== filteredOptions || $[120] !== handleOptionSelect || $[121] !== id || $[122] !== listFocused || $[123] !== loading || $[124] !== renderOption) {
496
- let t433;
497
- $[126] !== activeValue || $[127] !== currentOption || $[128] !== handleOptionSelect || $[129] !== id || $[130] !== listFocused || $[131] !== loading || $[132] !== renderOption ? (t433 = (option_0) => {
498
- const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
499
- 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), {
500
- disabled: loading,
501
- selected: active,
502
- tabIndex: listFocused && active ? 0 : -1
503
- }) }, option_0.value);
504
- }, $[126] = activeValue, $[127] = currentOption, $[128] = handleOptionSelect, $[129] = id, $[130] = listFocused, $[131] = loading, $[132] = renderOption, $[133] = t433) : t433 = $[133], t422 = filteredOptions.map(t433), $[117] = activeValue, $[118] = currentOption, $[119] = filteredOptions, $[120] = handleOptionSelect, $[121] = id, $[122] = listFocused, $[123] = loading, $[124] = renderOption, $[125] = t422;
505
- } else
506
- t422 = $[125];
507
- let t432;
508
- $[134] !== listBoxId || $[135] !== t422 ? (t432 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", id: listBoxId, ref: listBoxElementRef, role: "listbox", space: 1, children: t422 }), $[134] = listBoxId, $[135] = t422, $[136] = t432) : t432 = $[136];
509
- let t442;
510
- $[137] !== handleListBoxKeyDown || $[138] !== listBox || $[139] !== t432 ? (t442 = /* @__PURE__ */ jsxRuntime.jsx(ListBox, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: t432 }), $[137] = handleListBoxKeyDown, $[138] = listBox, $[139] = t432, $[140] = t442) : t442 = $[140], t41 = t442;
511
- }
512
- const content2 = t41;
513
- let t42;
514
- bb3: {
515
- if (renderPopover) {
516
- const t433 = !expanded;
517
- let t442;
518
- $[141] !== content2 || $[142] !== inputElement || $[143] !== renderPopover || $[144] !== t433 ? (t442 = /* @__PURE__ */ jsxRuntime.jsx(RenderPopover, { content: content2, hidden: t433, inputElement, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, resultsPopoverElementRef, renderPopover }), $[141] = content2, $[142] = inputElement, $[143] = renderPopover, $[144] = t433, $[145] = t442) : t442 = $[145], t42 = t442;
519
- break bb3;
520
- }
521
- if (filteredOptionsLen === 0) {
522
- t42 = null;
523
- break bb3;
524
- }
525
- let t432;
526
- $[146] !== content2 || $[147] !== expanded || $[148] !== inputElement || $[149] !== popover || $[150] !== radius ? (t432 = /* @__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 }), $[146] = content2, $[147] = expanded, $[148] = inputElement, $[149] = popover, $[150] = radius, $[151] = t432) : t432 = $[151], t42 = t432;
527
- }
528
- const results = t42, t43 = loading && AnimatedSpinnerIcon, t44 = suffix || openButtonNode;
529
- let t45;
530
- $[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] !== t43 || $[172] !== t44 ? (t45 = /* @__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: t43, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: setInputElement, role: "combobox", spellCheck: !1, suffix: t44, 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] = t43, $[172] = t44, $[173] = t45) : t45 = $[173];
531
- let t46;
532
- return $[174] !== handleRootBlur || $[175] !== handleRootKeyDown || $[176] !== results || $[177] !== t45 ? (t46 = /* @__PURE__ */ jsxRuntime.jsxs(StyledAutocomplete, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
533
- t45,
369
+ };
370
+ }, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = padding.map((v) => v === 0 ? 0 : v === 1 || v === 2 ? 1 : v - 2), openButtonPadding = padding.map((v) => Math.max(v - 1, 0)), openButtonProps = react.useMemo(() => typeof openButton == "object" ? openButton : _visualEditing.EMPTY_RECORD, [openButton]), handleOpenClick = react.useCallback((event) => {
371
+ dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event), _raf(() => inputElementRef.current?.focus());
372
+ }, [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) => {
373
+ event.key === "Tab" && listFocused && inputElementRef.current?.focus();
374
+ }, [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) => {
375
+ const active = activeValue !== null ? option.value === activeValue : currentOption === option;
376
+ return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option.value}`, onSelect: handleOptionSelect, selected: active, value: option.value, children: react.cloneElement(renderOption(option), {
377
+ disabled: loading,
378
+ selected: active,
379
+ tabIndex: listFocused && active ? 0 : -1
380
+ }) }, option.value);
381
+ }) }) }), [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]);
382
+ return /* @__PURE__ */ jsxRuntime.jsxs(StyledAutocomplete, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
383
+ /* @__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 }),
534
384
  results
535
- ] }), $[174] = handleRootBlur, $[175] = handleRootKeyDown, $[176] = results, $[177] = t45, $[178] = t46) : t46 = $[178], t46;
385
+ ] });
536
386
  });
537
387
  function RenderPopover({
538
388
  renderPopover,
@@ -552,43 +402,22 @@ function RenderPopover({
552
402
  }, resultsPopoverElementRef);
553
403
  }
554
404
  InnerAutocomplete.displayName = "ForwardRef(Autocomplete)";
555
- const Autocomplete = InnerAutocomplete;
556
- function _temp$3(v_0) {
557
- return v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2;
558
- }
559
- function _temp2$1(v_1) {
560
- return Math.max(v_1 - 1, 0);
561
- }
562
- const StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
405
+ const Autocomplete = InnerAutocomplete, StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
563
406
  displayName: "StyledBreadcrumbs",
564
407
  componentId: "sc-1es8h8q-0"
565
408
  })`margin:0;padding:0;display:flex;list-style:none;align-items:center;white-space:nowrap;line-height:0;`, ExpandButton = styledComponents.styled(_visualEditing.Button).withConfig({
566
409
  displayName: "ExpandButton",
567
410
  componentId: "sc-1es8h8q-1"
568
411
  })`appearance:none;margin:-4px;`, Breadcrumbs = react.forwardRef(function(props, ref) {
569
- const $ = reactCompilerRuntime.c(27);
570
- let children, maxLength, restProps, separator, t0;
571
- $[0] !== props ? ({
412
+ const {
572
413
  children,
573
414
  maxLength,
574
415
  separator,
575
- space: t0,
416
+ space: spaceRaw = 2,
576
417
  ...restProps
577
- } = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = restProps, $[4] = separator, $[5] = t0) : (children = $[1], maxLength = $[2], restProps = $[3], separator = $[4], t0 = $[5]);
578
- const space = _visualEditing.useArrayProp(t0 === void 0 ? 2 : t0), [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null);
579
- let t1;
580
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setOpen(!1), $[6] = t1) : t1 = $[6];
581
- const collapse = t1;
582
- let t2;
583
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!0), $[7] = t2) : t2 = $[7];
584
- const expand = t2;
585
- let t3;
586
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => [expandElementRef.current, popoverElementRef.current], $[8] = t3) : t3 = $[8], _visualEditing.useClickOutsideEvent(collapse, t3);
587
- let t4;
588
- $[9] !== children ? (t4 = react.Children.toArray(children).filter(react.isValidElement), $[9] = children, $[10] = t4) : t4 = $[10];
589
- const rawItems = t4;
590
- let t5;
591
- $[11] !== maxLength || $[12] !== open || $[13] !== rawItems || $[14] !== space ? (t5 = {
418
+ } = props, space = _visualEditing._getArrayProp(spaceRaw), [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null), collapse = react.useCallback(() => setOpen(!1), []), expand = react.useCallback(() => setOpen(!0), []);
419
+ _visualEditing.useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current]);
420
+ const rawItems = react.useMemo(() => react.Children.toArray(children).filter(react.isValidElement), [children]), items = useItems({
592
421
  collapse,
593
422
  expand,
594
423
  expandElementRef,
@@ -597,49 +426,27 @@ const StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
597
426
  popoverElementRef,
598
427
  rawItems,
599
428
  space
600
- }, $[11] = maxLength, $[12] = open, $[13] = rawItems, $[14] = space, $[15] = t5) : t5 = $[15];
601
- const items = useItems(t5);
602
- let t6;
603
- if ($[16] !== items || $[17] !== separator || $[18] !== space) {
604
- let t72;
605
- $[20] !== separator || $[21] !== space ? (t72 = (item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
606
- itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
607
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
608
- ] }, itemIndex), $[20] = separator, $[21] = space, $[22] = t72) : t72 = $[22], t6 = items.map(t72), $[16] = items, $[17] = separator, $[18] = space, $[19] = t6;
609
- } else
610
- t6 = $[19];
611
- let t7;
612
- return $[23] !== ref || $[24] !== restProps || $[25] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: t6 }), $[23] = ref, $[24] = restProps, $[25] = t6, $[26] = t7) : t7 = $[26], t7;
429
+ });
430
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: items.map((item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
431
+ itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
432
+ /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
433
+ ] }, itemIndex)) });
613
434
  });
614
435
  Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
615
- function useItems(t0) {
616
- const $ = reactCompilerRuntime.c(28), {
617
- collapse,
618
- expand,
619
- expandElementRef,
620
- maxLength,
621
- open,
622
- popoverElementRef,
623
- rawItems,
624
- space
625
- } = t0, len = rawItems.length;
436
+ function useItems({
437
+ collapse,
438
+ expand,
439
+ expandElementRef,
440
+ maxLength,
441
+ open,
442
+ popoverElementRef,
443
+ rawItems,
444
+ space
445
+ }) {
446
+ const len = rawItems.length;
626
447
  if (maxLength && len > maxLength) {
627
448
  const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
628
- let t1;
629
- if ($[0] !== afterLength || $[1] !== beforeLength || $[2] !== collapse || $[3] !== expand || $[4] !== expandElementRef || $[5] !== len || $[6] !== open || $[7] !== popoverElementRef || $[8] !== rawItems || $[9] !== space) {
630
- const t2 = rawItems.slice(0, beforeLength - 1);
631
- let t3;
632
- $[11] !== afterLength || $[12] !== beforeLength || $[13] !== len || $[14] !== rawItems ? (t3 = rawItems.slice(beforeLength - 1, len - afterLength), $[11] = afterLength, $[12] = beforeLength, $[13] = len, $[14] = rawItems, $[15] = t3) : t3 = $[15];
633
- let t4;
634
- $[16] !== space || $[17] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ol", overflow: "auto", padding: space, space, children: t3 }), $[16] = space, $[17] = t3, $[18] = t4) : t4 = $[18];
635
- const t5 = open ? collapse : expand;
636
- let t6;
637
- $[19] !== expandElementRef || $[20] !== open || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: t5, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }), $[19] = expandElementRef, $[20] = open, $[21] = t5, $[22] = t6) : t6 = $[22];
638
- let t7;
639
- $[23] !== open || $[24] !== popoverElementRef || $[25] !== t4 || $[26] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { constrainSize: !0, content: t4, open, placement: "top", portal: !0, ref: popoverElementRef, children: t6 }, "button"), $[23] = open, $[24] = popoverElementRef, $[25] = t4, $[26] = t6, $[27] = t7) : t7 = $[27], t1 = [...t2, t7, ...rawItems.slice(len - afterLength)], $[0] = afterLength, $[1] = beforeLength, $[2] = collapse, $[3] = expand, $[4] = expandElementRef, $[5] = len, $[6] = open, $[7] = popoverElementRef, $[8] = rawItems, $[9] = space, $[10] = t1;
640
- } else
641
- t1 = $[10];
642
- return t1;
449
+ return [...rawItems.slice(0, beforeLength - 1), /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { constrainSize: !0, content: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ol", overflow: "auto", padding: space, space, children: rawItems.slice(beforeLength - 1, len - afterLength) }), open, placement: "top", portal: !0, ref: popoverElementRef, children: /* @__PURE__ */ jsxRuntime.jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: open ? collapse : expand, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }) }, "button"), ...rawItems.slice(len - afterLength)];
643
450
  }
644
451
  return rawItems;
645
452
  }
@@ -732,7 +539,7 @@ const StyledDialog = /* @__PURE__ */ styledComponents.styled(_visualEditing.Laye
732
539
  displayName: "DialogFooter",
733
540
  componentId: "sc-4n4xb3-6"
734
541
  })`position:relative;z-index:3;`, DialogCard = react.forwardRef(function(props, forwardedRef) {
735
- const $ = reactCompilerRuntime.c(38), {
542
+ const {
736
543
  __unstable_autoFocus: autoFocus,
737
544
  __unstable_hideCloseButton: hideCloseButton,
738
545
  children,
@@ -747,62 +554,36 @@ const StyledDialog = /* @__PURE__ */ styledComponents.styled(_visualEditing.Laye
747
554
  scheme,
748
555
  shadow: shadowProp,
749
556
  width: widthProp
750
- } = props, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, radius = _visualEditing.useArrayProp(radiusProp), shadow = _visualEditing.useArrayProp(shadowProp), width = _visualEditing.useArrayProp(widthProp), ref = react.useRef(null), contentRef = react.useRef(null), layer = _visualEditing.useLayer(), {
557
+ } = props, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, radius = _visualEditing._getArrayProp(radiusProp), shadow = _visualEditing._getArrayProp(shadowProp), width = _visualEditing._getArrayProp(widthProp), ref = react.useRef(null), contentRef = react.useRef(null), layer = _visualEditing.useLayer(), {
751
558
  isTopLayer
752
559
  } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
753
- let t0;
754
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => ref.current, $[0] = t0) : t0 = $[0], react.useImperativeHandle(forwardedRef, t0);
755
- let t1;
756
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => contentRef.current, $[1] = t1) : t1 = $[1], react.useImperativeHandle(forwardedContentRef, t1);
757
- let t2, t3;
758
- $[2] !== autoFocus ? (t2 = () => {
560
+ return react.useImperativeHandle(forwardedRef, () => ref.current), react.useImperativeHandle(forwardedContentRef, () => contentRef.current), react.useEffect(() => {
759
561
  autoFocus && ref.current && focusFirstDescendant(ref.current);
760
- }, t3 = [autoFocus, ref], $[2] = autoFocus, $[3] = t2, $[4] = t3) : (t2 = $[3], t3 = $[4]), react.useEffect(t2, t3);
761
- let t4;
762
- $[5] !== boundaryElement || $[6] !== isTopLayer || $[7] !== onClose || $[8] !== portalElement ? (t4 = (event) => {
763
- if (!isTopLayer || !onClose)
764
- return;
562
+ }, [autoFocus, ref]), _visualEditing.useGlobalKeyDown(react.useCallback((event) => {
563
+ if (!isTopLayer || !onClose) return;
765
564
  const target = document.activeElement;
766
565
  target && !isTargetWithinScope(boundaryElement, portalElement, target) || event.key === "Escape" && (event.preventDefault(), event.stopPropagation(), onClose());
767
- }, $[5] = boundaryElement, $[6] = isTopLayer, $[7] = onClose, $[8] = portalElement, $[9] = t4) : t4 = $[9], _visualEditing.useGlobalKeyDown(t4);
768
- let t5;
769
- $[10] !== boundaryElement || $[11] !== isTopLayer || $[12] !== onClickOutside || $[13] !== portalElement ? (t5 = isTopLayer && onClickOutside && ((event_0) => {
770
- const target_0 = event_0.target;
771
- target_0 && !isTargetWithinScope(boundaryElement, portalElement, target_0) || onClickOutside();
772
- }), $[10] = boundaryElement, $[11] = isTopLayer, $[12] = onClickOutside, $[13] = portalElement, $[14] = t5) : t5 = $[14];
773
- let t6;
774
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => [ref.current], $[15] = t6) : t6 = $[15], _visualEditing.useClickOutsideEvent(t5, t6);
775
- let t7;
776
- $[16] !== header || $[17] !== labelId || $[18] !== onClose || $[19] !== showCloseButton || $[20] !== showHeader ? (t7 = showHeader && /* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { align: "flex-start", padding: 3, children: [
777
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
778
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: "none", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Close dialog", disabled: !onClose, icon: icons.CloseIcon, mode: "bleed", onClick: onClose, padding: 2 }) })
779
- ] }) }), $[16] = header, $[17] = labelId, $[18] = onClose, $[19] = showCloseButton, $[20] = showHeader, $[21] = t7) : t7 = $[21];
780
- let t8;
781
- $[22] !== children ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { flex: 1, ref: contentRef, tabIndex: -1, children }), $[22] = children, $[23] = t8) : t8 = $[23];
782
- let t9;
783
- $[24] !== footer ? (t9 = footer && /* @__PURE__ */ jsxRuntime.jsx(DialogFooter, { children: footer }), $[24] = footer, $[25] = t9) : t9 = $[25];
784
- let t10;
785
- $[26] !== t7 || $[27] !== t8 || $[28] !== t9 ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs(DialogLayout, { direction: "column", children: [
786
- t7,
787
- t8,
788
- t9
789
- ] }), $[26] = t7, $[27] = t8, $[28] = t9, $[29] = t10) : t10 = $[29];
790
- let t11;
791
- $[30] !== radius || $[31] !== scheme || $[32] !== shadow || $[33] !== t10 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(DialogCardRoot, { radius, ref, scheme, shadow, children: t10 }), $[30] = radius, $[31] = scheme, $[32] = shadow, $[33] = t10, $[34] = t11) : t11 = $[34];
792
- let t12;
793
- return $[35] !== t11 || $[36] !== width ? (t12 = /* @__PURE__ */ jsxRuntime.jsx(DialogContainer, { "data-ui": "DialogCard", width, children: t11 }), $[35] = t11, $[36] = width, $[37] = t12) : t12 = $[37], t12;
566
+ }, [boundaryElement, isTopLayer, onClose, portalElement])), _visualEditing.useClickOutsideEvent(isTopLayer && onClickOutside && ((event) => {
567
+ const target = event.target;
568
+ target && !isTargetWithinScope(boundaryElement, portalElement, target) || onClickOutside();
569
+ }), () => [ref.current]), /* @__PURE__ */ jsxRuntime.jsx(DialogContainer, { "data-ui": "DialogCard", width, children: /* @__PURE__ */ jsxRuntime.jsx(DialogCardRoot, { radius, ref, scheme, shadow, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogLayout, { direction: "column", children: [
570
+ showHeader && /* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { align: "flex-start", padding: 3, children: [
571
+ /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
572
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: "none", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Close dialog", disabled: !onClose, icon: icons.CloseIcon, mode: "bleed", onClick: onClose, padding: 2 }) })
573
+ ] }) }),
574
+ /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { flex: 1, ref: contentRef, tabIndex: -1, children }),
575
+ footer && /* @__PURE__ */ jsxRuntime.jsx(DialogFooter, { children: footer })
576
+ ] }) }) });
794
577
  });
795
578
  DialogCard.displayName = "ForwardRef(DialogCard)";
796
579
  const Dialog = react.forwardRef(function(props, ref) {
797
- const $ = reactCompilerRuntime.c(60), dialog = useDialog(), {
580
+ const dialog = useDialog(), {
798
581
  layer
799
- } = _visualEditing.useTheme_v2();
800
- let _positionProp, _zOffsetProp, children, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5, t6;
801
- $[0] !== props ? ({
802
- __unstable_autoFocus: t0,
803
- __unstable_hideCloseButton: t1,
804
- cardRadius: t2,
805
- cardShadow: t3,
582
+ } = _visualEditing.useTheme_v2(), {
583
+ __unstable_autoFocus: autoFocus = !0,
584
+ __unstable_hideCloseButton: hideCloseButton = !1,
585
+ cardRadius: cardRadiusProp = 4,
586
+ cardShadow = 3,
806
587
  children,
807
588
  contentRef,
808
589
  footer,
@@ -812,18 +593,15 @@ const Dialog = react.forwardRef(function(props, ref) {
812
593
  onClickOutside,
813
594
  onClose,
814
595
  onFocus,
815
- padding: t4,
596
+ padding: paddingProp = 3,
816
597
  portal: portalProp,
817
598
  position: _positionProp,
818
599
  scheme,
819
- width: t5,
600
+ width: widthProp = 0,
820
601
  zOffset: _zOffsetProp,
821
- animate: t6,
602
+ animate: _animate = !1,
822
603
  ...restProps
823
- } = props, $[0] = props, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = children, $[4] = contentRef, $[5] = footer, $[6] = header, $[7] = id, $[8] = onActivate, $[9] = onClickOutside, $[10] = onClose, $[11] = onFocus, $[12] = portalProp, $[13] = restProps, $[14] = scheme, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6) : (_positionProp = $[1], _zOffsetProp = $[2], children = $[3], contentRef = $[4], footer = $[5], header = $[6], id = $[7], onActivate = $[8], onClickOutside = $[9], onClose = $[10], onFocus = $[11], portalProp = $[12], restProps = $[13], scheme = $[14], t0 = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21]);
824
- const autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, cardRadiusProp = t2 === void 0 ? 4 : t2, cardShadow = t3 === void 0 ? 3 : t3, paddingProp = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, _animate = t6 === void 0 ? !1 : t6, positionProp = _positionProp ?? (dialog.position || "fixed"), zOffsetProp = _zOffsetProp ?? (dialog.zOffset || layer.dialog.zOffset), animate = _visualEditing.usePrefersReducedMotion() ? !1 : _animate, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, cardRadius = _visualEditing.useArrayProp(cardRadiusProp), padding = _visualEditing.useArrayProp(paddingProp), position = _visualEditing.useArrayProp(positionProp), width = _visualEditing.useArrayProp(widthProp), zOffset = _visualEditing.useArrayProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
825
- let t7;
826
- $[22] !== onFocus ? (t7 = (event) => {
604
+ } = props, positionProp = _positionProp ?? (dialog.position || "fixed"), zOffsetProp = _zOffsetProp ?? (dialog.zOffset || layer.dialog.zOffset), animate = _visualEditing.usePrefersReducedMotion() ? !1 : _animate, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, cardRadius = _visualEditing._getArrayProp(cardRadiusProp), padding = _visualEditing._getArrayProp(paddingProp), position = _visualEditing._getArrayProp(positionProp), width = _visualEditing._getArrayProp(widthProp), zOffset = _visualEditing._getArrayProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null), handleFocus = react.useCallback((event) => {
827
605
  onFocus?.(event);
828
606
  const target = event.target, cardElement = cardRef.current;
829
607
  if (cardElement && target === preDivRef.current) {
@@ -835,60 +613,43 @@ const Dialog = react.forwardRef(function(props, ref) {
835
613
  return;
836
614
  }
837
615
  _visualEditing.isHTMLElement(event.target) && (focusedElementRef.current = event.target);
838
- }, $[22] = onFocus, $[23] = t7) : t7 = $[23];
839
- const handleFocus = t7, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
840
- let t8;
841
- $[24] !== boundaryElement || $[25] !== portalElement ? (t8 = () => {
616
+ }, [onFocus]), labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0), handleRootClick = react.useCallback(() => {
842
617
  rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
843
618
  const activeElement = document.activeElement;
844
619
  if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
845
- const target_0 = focusedElementRef.current;
846
- if (!target_0 || !document.body.contains(target_0)) {
847
- const cardElement_0 = cardRef.current;
848
- cardElement_0 && focusFirstDescendant(cardElement_0);
620
+ const target = focusedElementRef.current;
621
+ if (!target || !document.body.contains(target)) {
622
+ const cardElement = cardRef.current;
623
+ cardElement && focusFirstDescendant(cardElement);
849
624
  return;
850
625
  }
851
- target_0.focus();
626
+ target.focus();
852
627
  }
853
628
  }, 0);
854
- }, $[24] = boundaryElement, $[25] = portalElement, $[26] = t8) : t8 = $[26];
855
- const handleRootClick = t8;
856
- let t9;
857
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[27] = t9) : t9 = $[27];
858
- let t10;
859
- $[28] !== autoFocus || $[29] !== cardRadius || $[30] !== cardShadow || $[31] !== children || $[32] !== contentRef || $[33] !== footer || $[34] !== header || $[35] !== hideCloseButton || $[36] !== id || $[37] !== onClickOutside || $[38] !== onClose || $[39] !== portalProp || $[40] !== scheme || $[41] !== width ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, width, children }), $[28] = autoFocus, $[29] = cardRadius, $[30] = cardShadow, $[31] = children, $[32] = contentRef, $[33] = footer, $[34] = header, $[35] = hideCloseButton, $[36] = id, $[37] = onClickOutside, $[38] = onClose, $[39] = portalProp, $[40] = scheme, $[41] = width, $[42] = t10) : t10 = $[42];
860
- let t11;
861
- $[43] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[43] = t11) : t11 = $[43];
862
- let t12;
863
- $[44] !== animate || $[45] !== handleFocus || $[46] !== handleRootClick || $[47] !== id || $[48] !== labelId || $[49] !== onActivate || $[50] !== padding || $[51] !== position || $[52] !== ref || $[53] !== restProps || $[54] !== t10 || $[55] !== zOffset ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs(StyledDialog, { ...restProps, $animate: animate, $padding: padding, $position: position, "aria-labelledby": labelId, "aria-modal": !0, "data-ui": "Dialog", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, ref, role: "dialog", zOffset, children: [
864
- t9,
865
- t10,
866
- t11
867
- ] }), $[44] = animate, $[45] = handleFocus, $[46] = handleRootClick, $[47] = id, $[48] = labelId, $[49] = onActivate, $[50] = padding, $[51] = position, $[52] = ref, $[53] = restProps, $[54] = t10, $[55] = zOffset, $[56] = t12) : t12 = $[56];
868
- let t13;
869
- return $[57] !== portalProp || $[58] !== t12 ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Portal, { __unstable_name: portalProp, children: t12 }), $[57] = portalProp, $[58] = t12, $[59] = t13) : t13 = $[59], t13;
629
+ }, [boundaryElement, portalElement]);
630
+ return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Portal, { __unstable_name: portalProp, children: /* @__PURE__ */ jsxRuntime.jsxs(StyledDialog, { ...restProps, $animate: animate, $padding: padding, $position: position, "aria-labelledby": labelId, "aria-modal": !0, "data-ui": "Dialog", id, onActivate, onClick: handleRootClick, onFocus: handleFocus, ref, role: "dialog", zOffset, children: [
631
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }),
632
+ /* @__PURE__ */ jsxRuntime.jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, width, children }),
633
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 })
634
+ ] }) });
870
635
  });
871
636
  Dialog.displayName = "ForwardRef(Dialog)";
872
637
  function DialogProvider(props) {
873
- const $ = reactCompilerRuntime.c(6), {
638
+ const {
874
639
  children,
875
640
  position,
876
641
  zOffset
877
- } = props;
878
- let t0;
879
- $[0] !== position || $[1] !== zOffset ? (t0 = {
642
+ } = props, contextValue = react.useMemo(() => ({
880
643
  version: 0,
881
644
  position,
882
645
  zOffset
883
- }, $[0] = position, $[1] = zOffset, $[2] = t0) : t0 = $[2];
884
- const contextValue = t0;
885
- let t1;
886
- return $[3] !== children || $[4] !== contextValue ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t1) : t1 = $[5], t1;
646
+ }), [position, zOffset]);
647
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children });
887
648
  }
888
649
  DialogProvider.displayName = "DialogProvider";
889
650
  const MenuButton = react.forwardRef(function(props, forwardedRef) {
890
- const $ = reactCompilerRuntime.c(62), {
891
- __unstable_disableRestoreFocusOnClose: t0,
651
+ const {
652
+ __unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
892
653
  boundaryElement: deprecated_boundaryElement,
893
654
  button: buttonProp,
894
655
  id,
@@ -897,85 +658,52 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
897
658
  onOpen,
898
659
  placement: deprecated_placement,
899
660
  popoverScheme: deprecated_popoverScheme,
900
- portal: t1,
661
+ portal: deprecated_portal = !0,
901
662
  popover,
902
663
  popoverRadius: deprecated_popoverRadius,
903
664
  preventOverflow: deprecated_preventOverflow
904
- } = props, disableRestoreFocusOnClose = t0 === void 0 ? !1 : t0, deprecated_portal = t1 === void 0 ? !0 : t1, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null);
905
- let t2;
906
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
907
- const [menuElements, setChildMenuElements] = react.useState(t2), openRef = react.useRef(open);
908
- let t3, t4;
909
- $[1] !== onOpen || $[2] !== open ? (t3 = () => {
665
+ } = props, [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), [buttonElement, setButtonElement] = react.useState(null), [menuElements, setChildMenuElements] = react.useState([]), openRef = react.useRef(open);
666
+ react.useEffect(() => {
910
667
  onOpen && open && !openRef.current && onOpen();
911
- }, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), react.useEffect(t3, t4);
912
- let t5, t6;
913
- $[5] !== onClose || $[6] !== open ? (t5 = () => {
668
+ }, [onOpen, open]), react.useEffect(() => {
914
669
  onClose && !open && openRef.current && onClose();
915
- }, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), react.useEffect(t5, t6);
916
- let t7, t8;
917
- $[9] !== open ? (t7 = () => {
670
+ }, [onClose, open]), react.useEffect(() => {
918
671
  openRef.current = open;
919
- }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
920
- let t9;
921
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
922
- setOpen(_temp$2), setShouldFocus(null);
923
- }, $[12] = t9) : t9 = $[12];
924
- const handleButtonClick = t9;
925
- let t10;
926
- $[13] !== open ? (t10 = (event) => {
672
+ }, [open]);
673
+ const handleButtonClick = react.useCallback(() => {
674
+ setOpen((v) => !v), setShouldFocus(null);
675
+ }, []), handleMouseDown = react.useCallback((event) => {
927
676
  open && event.preventDefault();
928
- }, $[13] = open, $[14] = t10) : t10 = $[14];
929
- const handleMouseDown = t10;
930
- let t11;
931
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
932
- if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
933
- event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
677
+ }, [open]), handleButtonKeyDown = react.useCallback((event) => {
678
+ if (event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") {
679
+ event.preventDefault(), setOpen(!0), setShouldFocus("first");
934
680
  return;
935
681
  }
936
- if (event_0.key === "ArrowUp") {
937
- event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
682
+ if (event.key === "ArrowUp") {
683
+ event.preventDefault(), setOpen(!0), setShouldFocus("last");
938
684
  return;
939
685
  }
940
- }, $[15] = t11) : t11 = $[15];
941
- const handleButtonKeyDown = t11;
942
- let t12;
943
- $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
944
- const target = event_1.target;
686
+ }, []), handleMenuClickOutside = react.useCallback((event) => {
687
+ const target = event.target;
945
688
  if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
946
689
  for (const el of menuElements)
947
690
  if (target === el || el.contains(target))
948
691
  return;
949
692
  setOpen(!1);
950
693
  }
951
- }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
952
- const handleMenuClickOutside = t12;
953
- let t13;
954
- $[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t13 = () => {
694
+ }, [buttonElement, menuElements]), handleMenuEscape = react.useCallback(() => {
955
695
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
956
- }, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t13) : t13 = $[21];
957
- const handleMenuEscape = t13;
958
- let t14;
959
- $[22] !== menuElements ? (t14 = (event_2) => {
960
- const target_0 = event_2.relatedTarget;
961
- if (target_0 instanceof Node) {
962
- for (const el_0 of menuElements)
963
- if (el_0 === target_0 || el_0.contains(target_0))
696
+ }, [buttonElement, disableRestoreFocusOnClose]), handleBlur = react.useCallback((event) => {
697
+ const target = event.relatedTarget;
698
+ if (target instanceof Node) {
699
+ for (const el of menuElements)
700
+ if (el === target || el.contains(target))
964
701
  return;
965
702
  setOpen(!1);
966
703
  }
967
- }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
968
- const handleBlur = t14;
969
- let t15;
970
- $[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t15 = () => {
704
+ }, [menuElements]), handleItemClick = react.useCallback(() => {
971
705
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
972
- }, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t15) : t15 = $[26];
973
- const handleItemClick = t15;
974
- let t16;
975
- $[27] === Symbol.for("react.memo_cache_sentinel") ? (t16 = (el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), $[27] = t16) : t16 = $[27];
976
- const registerElement = t16;
977
- let t17;
978
- $[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t17 = menuProp && react.cloneElement(menuProp, {
706
+ }, [buttonElement, disableRestoreFocusOnClose]), registerElement = react.useCallback((el) => (setChildMenuElements((els) => els.concat([el])), () => setChildMenuElements((els) => els.filter((_el) => _el !== el))), []), menu = menuProp && react.cloneElement(menuProp, {
979
707
  "aria-labelledby": id,
980
708
  onBlurCapture: handleBlur,
981
709
  onClickOutside: handleMenuClickOutside,
@@ -984,10 +712,7 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
984
712
  originElement: buttonElement,
985
713
  registerElement,
986
714
  shouldFocus
987
- }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
988
- const menu = t17;
989
- let t18;
990
- $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t18 = buttonProp && react.cloneElement(buttonProp, {
715
+ }), button = react.useMemo(() => buttonProp && react.cloneElement(buttonProp, {
991
716
  "data-ui": "MenuButton",
992
717
  id,
993
718
  onClick: handleButtonClick,
@@ -997,14 +722,9 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
997
722
  "aria-expanded": open,
998
723
  ref: setButtonElement,
999
724
  selected: buttonProp.props.selected ?? open
1000
- }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t18) : t18 = $[41];
1001
- const button = t18;
1002
- let t19, t20;
1003
- $[42] !== buttonElement ? (t19 = () => buttonElement, t20 = [buttonElement], $[42] = buttonElement, $[43] = t19, $[44] = t20) : (t19 = $[43], t20 = $[44]), react.useImperativeHandle(forwardedRef, t19, t20);
1004
- let t21;
1005
- $[45] !== popover ? (t21 = popover || {}, $[45] = popover, $[46] = t21) : t21 = $[46];
1006
- let t22;
1007
- $[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !== t21 ? (t22 = {
725
+ }), [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]);
726
+ react.useImperativeHandle(forwardedRef, () => buttonElement, [buttonElement]);
727
+ const popoverProps = react.useMemo(() => ({
1008
728
  boundaryElement: deprecated_boundaryElement,
1009
729
  overflow: "auto",
1010
730
  placement: deprecated_placement,
@@ -1012,18 +732,11 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
1012
732
  preventOverflow: deprecated_preventOverflow,
1013
733
  radius: deprecated_popoverRadius,
1014
734
  scheme: deprecated_popoverScheme,
1015
- ...t21
1016
- }, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_popoverRadius, $[50] = deprecated_popoverScheme, $[51] = deprecated_portal, $[52] = deprecated_preventOverflow, $[53] = t21, $[54] = t22) : t22 = $[54];
1017
- const popoverProps = t22;
1018
- let t23;
1019
- $[55] !== button ? (t23 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[55] = button, $[56] = t23) : t23 = $[56];
1020
- let t24;
1021
- return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t23 ? (t24 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t23 }), $[57] = menu, $[58] = open, $[59] = popoverProps, $[60] = t23, $[61] = t24) : t24 = $[61], t24;
735
+ ...popover || {}
736
+ }), [deprecated_boundaryElement, deprecated_placement, deprecated_popoverRadius, deprecated_popoverScheme, deprecated_portal, deprecated_preventOverflow, popover]);
737
+ return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) });
1022
738
  });
1023
739
  MenuButton.displayName = "ForwardRef(MenuButton)";
1024
- function _temp$2(v) {
1025
- return !v;
1026
- }
1027
740
  const keyframe = styledComponents.keyframes`
1028
741
  0% {
1029
742
  background-position: 100%;
@@ -1068,17 +781,13 @@ const keyframe = styledComponents.keyframes`
1068
781
  displayName: "StyledSkeleton",
1069
782
  componentId: "sc-ebtpni-0"
1070
783
  })(_visualEditing.responsiveRadiusStyle, skeletonStyle), Skeleton = react.forwardRef(function(props, ref) {
1071
- const $ = reactCompilerRuntime.c(14);
1072
- let delay, radius, restProps, t0;
1073
- $[0] !== props ? ({
1074
- animated: t0,
784
+ const {
785
+ animated = !1,
1075
786
  delay,
1076
787
  radius,
1077
788
  ...restProps
1078
- } = props, $[0] = props, $[1] = delay, $[2] = radius, $[3] = restProps, $[4] = t0) : (delay = $[1], radius = $[2], restProps = $[3], t0 = $[4]);
1079
- const animated = t0 === void 0 ? !1 : t0, [visible, setVisible] = react.useState(!delay);
1080
- let t1, t2;
1081
- $[5] !== delay ? (t1 = () => {
789
+ } = props, [visible, setVisible] = react.useState(!delay);
790
+ return react.useEffect(() => {
1082
791
  if (!delay)
1083
792
  return;
1084
793
  const timeout = setTimeout(() => {
@@ -1087,10 +796,7 @@ const keyframe = styledComponents.keyframes`
1087
796
  return () => {
1088
797
  clearTimeout(timeout);
1089
798
  };
1090
- }, t2 = [delay], $[5] = delay, $[6] = t1, $[7] = t2) : (t1 = $[6], t2 = $[7]), react.useEffect(t1, t2);
1091
- const t3 = _visualEditing.useArrayProp(radius), t4 = delay ? visible : !0;
1092
- let t5;
1093
- return $[8] !== animated || $[9] !== ref || $[10] !== restProps || $[11] !== t3 || $[12] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton$1, { ...restProps, $animated: animated, $radius: t3, $visible: t4, ref }), $[8] = animated, $[9] = ref, $[10] = restProps, $[11] = t3, $[12] = t4, $[13] = t5) : t5 = $[13], t5;
799
+ }, [delay]), /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton$1, { ...restProps, $animated: animated, $radius: _visualEditing._getArrayProp(radius), $visible: delay ? visible : !0, ref });
1094
800
  });
1095
801
  Skeleton.displayName = "ForwardRef(Skeleton)";
1096
802
  const StyledSkeleton = /* @__PURE__ */ styledComponents.styled(Skeleton).withConfig({
@@ -1111,63 +817,43 @@ const StyledSkeleton = /* @__PURE__ */ styledComponents.styled(Skeleton).withCon
1111
817
  };
1112
818
  });
1113
819
  }), TextSkeleton = react.forwardRef(function(props, ref) {
1114
- const $ = reactCompilerRuntime.c(7);
1115
- let restProps, t0;
1116
- $[0] !== props ? ({
1117
- size: t0,
820
+ const {
821
+ size = 2,
1118
822
  ...restProps
1119
- } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
1120
- const $size = _visualEditing.useArrayProp(t0 === void 0 ? 2 : t0);
1121
- let t1;
1122
- return $[3] !== $size || $[4] !== ref || $[5] !== restProps ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "text" }), $[3] = $size, $[4] = ref, $[5] = restProps, $[6] = t1) : t1 = $[6], t1;
823
+ } = props, $size = _visualEditing._getArrayProp(size);
824
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "text" });
1123
825
  });
1124
826
  TextSkeleton.displayName = "ForwardRef(TextSkeleton)";
1125
827
  const LabelSkeleton = react.forwardRef(function(props, ref) {
1126
- const $ = reactCompilerRuntime.c(7);
1127
- let restProps, t0;
1128
- $[0] !== props ? ({
1129
- size: t0,
828
+ const {
829
+ size = 2,
1130
830
  ...restProps
1131
- } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
1132
- const $size = _visualEditing.useArrayProp(t0 === void 0 ? 2 : t0);
1133
- let t1;
1134
- return $[3] !== $size || $[4] !== ref || $[5] !== restProps ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "label" }), $[3] = $size, $[4] = ref, $[5] = restProps, $[6] = t1) : t1 = $[6], t1;
831
+ } = props, $size = _visualEditing._getArrayProp(size);
832
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "label" });
1135
833
  });
1136
834
  LabelSkeleton.displayName = "ForwardRef(LabelSkeleton)";
1137
835
  const HeadingSkeleton = react.forwardRef(function(props, ref) {
1138
- const $ = reactCompilerRuntime.c(7);
1139
- let restProps, t0;
1140
- $[0] !== props ? ({
1141
- size: t0,
836
+ const {
837
+ size = 2,
1142
838
  ...restProps
1143
- } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
1144
- const $size = _visualEditing.useArrayProp(t0 === void 0 ? 2 : t0);
1145
- let t1;
1146
- return $[3] !== $size || $[4] !== ref || $[5] !== restProps ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "heading" }), $[3] = $size, $[4] = ref, $[5] = restProps, $[6] = t1) : t1 = $[6], t1;
839
+ } = props, $size = _visualEditing._getArrayProp(size);
840
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "heading" });
1147
841
  });
1148
842
  HeadingSkeleton.displayName = "ForwardRef(HeadingSkeleton)";
1149
843
  const CodeSkeleton = react.forwardRef(function(props, ref) {
1150
- const $ = reactCompilerRuntime.c(7);
1151
- let restProps, t0;
1152
- $[0] !== props ? ({
1153
- size: t0,
844
+ const {
845
+ size = 2,
1154
846
  ...restProps
1155
- } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
1156
- const $size = _visualEditing.useArrayProp(t0 === void 0 ? 2 : t0);
1157
- let t1;
1158
- return $[3] !== $size || $[4] !== ref || $[5] !== restProps ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "code" }), $[3] = $size, $[4] = ref, $[5] = restProps, $[6] = t1) : t1 = $[6], t1;
847
+ } = props, $size = _visualEditing._getArrayProp(size);
848
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "code" });
1159
849
  });
1160
850
  CodeSkeleton.displayName = "ForwardRef(CodeSkeleton)";
1161
851
  const TabPanel = react.forwardRef(function(props, ref) {
1162
- const $ = reactCompilerRuntime.c(9);
1163
- let flex, restProps;
1164
- $[0] !== props ? ({
852
+ const {
1165
853
  flex,
1166
854
  ...restProps
1167
- } = props, $[0] = props, $[1] = flex, $[2] = restProps) : (flex = $[1], restProps = $[2]);
1168
- const t0 = props.tabIndex === void 0 ? 0 : props.tabIndex;
1169
- let t1;
1170
- return $[3] !== flex || $[4] !== props.children || $[5] !== ref || $[6] !== restProps || $[7] !== t0 ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "TabPanel", ...restProps, flex, ref, role: "tabpanel", tabIndex: t0, children: props.children }), $[3] = flex, $[4] = props.children, $[5] = ref, $[6] = restProps, $[7] = t0, $[8] = t1) : t1 = $[8], t1;
855
+ } = props;
856
+ return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "data-ui": "TabPanel", ...restProps, flex, ref, role: "tabpanel", tabIndex: props.tabIndex === void 0 ? 0 : props.tabIndex, children: props.children });
1171
857
  });
1172
858
  TabPanel.displayName = "ForwardRef(TabPanel)";
1173
859
  const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
@@ -1207,74 +893,46 @@ const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
1207
893
  info: "alert"
1208
894
  }, LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24;
1209
895
  function Toast(props) {
1210
- const $ = reactCompilerRuntime.c(50);
1211
- let closable, description, duration, onClose, restProps, status, t0, title, updatedAt;
1212
- $[0] !== props ? ({
896
+ const {
1213
897
  closable,
1214
898
  description,
1215
899
  duration,
1216
900
  onClose,
1217
- radius: t0,
901
+ radius = 3,
1218
902
  title,
1219
903
  status,
1220
904
  updatedAt,
1221
905
  ...restProps
1222
- } = props, $[0] = props, $[1] = closable, $[2] = description, $[3] = duration, $[4] = onClose, $[5] = restProps, $[6] = status, $[7] = t0, $[8] = title, $[9] = updatedAt) : (closable = $[1], description = $[2], duration = $[3], onClose = $[4], restProps = $[5], status = $[6], t0 = $[7], title = $[8], updatedAt = $[9]);
1223
- const radius = t0 === void 0 ? 3 : t0, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = _visualEditing.usePrefersReducedMotion() ? 0 : 0.26;
1224
- let t1;
1225
- $[10] !== visualDuration ? (t1 = visualDuration ? {
906
+ } = props, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status", visualDuration = _visualEditing.usePrefersReducedMotion() ? 0 : 0.26, transition = visualDuration ? {
1226
907
  type: "spring",
1227
908
  visualDuration,
1228
909
  bounce: 0.25
1229
910
  } : {
1230
911
  duration: 0
1231
- }, $[10] = visualDuration, $[11] = t1) : t1 = $[11];
1232
- const transition = t1, hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG;
1233
- let t2;
1234
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t2 = ["hidden", "initial"], $[12] = t2) : t2 = $[12];
1235
- const initial = t2;
1236
- let t3;
1237
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t3 = ["visible", "slideIn"], $[13] = t3) : t3 = $[13];
1238
- const animate = t3;
1239
- let t4;
1240
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "slideOut"], $[14] = t4) : t4 = $[14];
1241
- const exit = t4, t5 = hasDuration ? "" : void 0;
1242
- let t6;
1243
- $[15] !== title ? (t6 = title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t6) : t6 = $[16];
1244
- let t7;
1245
- $[17] !== description || $[18] !== transition ? (t7 = description && /* @__PURE__ */ jsxRuntime.jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[17] = description, $[18] = transition, $[19] = t7) : t7 = $[19];
1246
- let t8;
1247
- $[20] !== t6 || $[21] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(TextBox, { flex: 1, padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Stack, { space: 3, children: [
1248
- t6,
1249
- t7
1250
- ] }) }), $[20] = t6, $[21] = t7, $[22] = t8) : t8 = $[22];
1251
- let t9;
1252
- $[23] !== buttonTone || $[24] !== closable || $[25] !== onClose ? (t9 = closable && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
1253
- verticalAlign: "top"
1254
- } }) }), $[23] = buttonTone, $[24] = closable, $[25] = onClose, $[26] = t9) : t9 = $[26];
1255
- let t10;
1256
- $[27] !== t8 || $[28] !== t9 || $[29] !== transition ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
1257
- t8,
1258
- t9
1259
- ] }), $[27] = t8, $[28] = t9, $[29] = transition, $[30] = t10) : t10 = $[30];
1260
- let t11;
1261
- $[31] !== cardTone || $[32] !== duration || $[33] !== hasDuration || $[34] !== onClose || $[35] !== radius || $[36] !== transition || $[37] !== updatedAt || $[38] !== visualDuration ? (t11 = hasDuration && /* @__PURE__ */ jsxRuntime.jsxs(MotionLoadingBar, { variants: content, transition, children: [
1262
- /* @__PURE__ */ jsxRuntime.jsx(LoadingBarMask, { tone: cardTone, radius }),
1263
- /* @__PURE__ */ jsxRuntime.jsx(MotionLoadingBarProgress, { tone: cardTone, initial: {
1264
- scaleX: 0
1265
- }, animate: {
1266
- scaleX: 1
1267
- }, transition: {
1268
- delay: visualDuration,
1269
- duration: duration / 1e3,
1270
- ease: "linear"
1271
- }, onAnimationComplete: onClose }, `progress-${updatedAt}`)
1272
- ] }), $[31] = cardTone, $[32] = duration, $[33] = hasDuration, $[34] = onClose, $[35] = radius, $[36] = transition, $[37] = updatedAt, $[38] = visualDuration, $[39] = t11) : t11 = $[39];
1273
- let t12;
1274
- return $[40] !== cardTone || $[41] !== radius || $[42] !== restProps || $[43] !== role || $[44] !== t10 || $[45] !== t11 || $[46] !== t5 || $[47] !== transition || $[48] !== visualDuration ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs(MotionToast, { "data-ui": "Toast", role, ...restProps, "data-has-duration": t5, custom: visualDuration, radius, shadow: 2, tone: cardTone, forwardedAs: "li", layout: "position", variants: container, initial, animate, exit, transition, children: [
1275
- t10,
1276
- t11
1277
- ] }), $[40] = cardTone, $[41] = radius, $[42] = restProps, $[43] = role, $[44] = t10, $[45] = t11, $[46] = t5, $[47] = transition, $[48] = visualDuration, $[49] = t12) : t12 = $[49], t12;
912
+ }, hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG;
913
+ return /* @__PURE__ */ jsxRuntime.jsxs(MotionToast, { "data-ui": "Toast", role, ...restProps, "data-has-duration": hasDuration ? "" : void 0, custom: visualDuration, radius, shadow: 2, tone: cardTone, forwardedAs: "li", layout: "position", variants: container, initial: ["hidden", "initial"], animate: ["visible", "slideIn"], exit: ["hidden", "slideOut"], transition, children: [
914
+ /* @__PURE__ */ jsxRuntime.jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
915
+ /* @__PURE__ */ jsxRuntime.jsx(TextBox, { flex: 1, padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Stack, { space: 3, children: [
916
+ title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }),
917
+ description && /* @__PURE__ */ jsxRuntime.jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description })
918
+ ] }) }),
919
+ closable && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
920
+ verticalAlign: "top"
921
+ } }) })
922
+ ] }),
923
+ hasDuration && /* @__PURE__ */ jsxRuntime.jsxs(MotionLoadingBar, { variants: content, transition, children: [
924
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingBarMask, { tone: cardTone, radius }),
925
+ /* @__PURE__ */ jsxRuntime.jsx(MotionLoadingBarProgress, { tone: cardTone, initial: {
926
+ scaleX: 0
927
+ }, animate: {
928
+ scaleX: 1
929
+ }, transition: {
930
+ delay: visualDuration,
931
+ duration: duration / 1e3,
932
+ ease: "linear"
933
+ }, onAnimationComplete: onClose }, `progress-${updatedAt}`)
934
+ ] })
935
+ ] });
1278
936
  }
1279
937
  Toast.displayName = "Toast";
1280
938
  const container = {
@@ -1316,32 +974,23 @@ const container = {
1316
974
  }
1317
975
  }, MotionToast = framerMotion.motion.create(StyledToast), MotionFlex = framerMotion.motion.create(_visualEditing.Flex), MotionText = framerMotion.motion.create(_visualEditing.Text), MotionLoadingBar = framerMotion.motion.create(LoadingBar), MotionLoadingBarProgress = framerMotion.motion.create(LoadingBarProgress);
1318
976
  function useMounted() {
1319
- return react.useSyncExternalStore(subscribe, _temp$1, _temp2);
1320
- }
1321
- function _temp2() {
1322
- return !1;
1323
- }
1324
- function _temp$1() {
1325
- return !0;
977
+ return react.useSyncExternalStore(subscribe, () => !0, () => !1);
1326
978
  }
1327
979
  const subscribe = () => () => {
1328
980
  }, ToastContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/toast", null);
1329
981
  function ToastLayer(props) {
1330
- const $ = reactCompilerRuntime.c(9), {
982
+ const {
1331
983
  children,
1332
- padding: t0,
984
+ padding = 4,
1333
985
  paddingX,
1334
986
  paddingY,
1335
- gap: t1
1336
- } = props, padding = t0 === void 0 ? 4 : t0, gap = t1 === void 0 ? 3 : t1, {
987
+ gap = 3
988
+ } = props, {
1337
989
  zIndex
1338
990
  } = _visualEditing.useLayer();
1339
- let t2;
1340
- $[0] !== zIndex ? (t2 = {
991
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledLayer, { forwardedAs: "ul", "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, columns: 1, style: {
1341
992
  zIndex
1342
- }, $[0] = zIndex, $[1] = t2) : t2 = $[1];
1343
- let t3;
1344
- return $[2] !== children || $[3] !== gap || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(StyledLayer, { forwardedAs: "ul", "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, columns: 1, style: t2, children }), $[2] = children, $[3] = gap, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = t2, $[8] = t3) : t3 = $[8], t3;
993
+ }, children });
1345
994
  }
1346
995
  ToastLayer.displayName = "ToastLayer";
1347
996
  const StyledLayer = styledComponents.styled(_visualEditing.Grid).withConfig({
@@ -1353,19 +1002,14 @@ function generateToastId() {
1353
1002
  return String(toastId++);
1354
1003
  }
1355
1004
  function ToastProvider(props) {
1356
- const $ = reactCompilerRuntime.c(13), {
1005
+ const {
1357
1006
  children,
1358
1007
  padding,
1359
1008
  paddingX,
1360
1009
  paddingY,
1361
1010
  gap,
1362
- zOffset: t0
1363
- } = props, zOffset = t0 === void 0 ? 1 : t0;
1364
- let t1;
1365
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
1366
- const [state, setState] = react.useState(t1), mounted = useMounted();
1367
- let t2;
1368
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
1011
+ zOffset = 1
1012
+ } = props, [state, setState] = react.useState([]), mounted = useMounted(), value = react.useMemo(() => ({
1369
1013
  version: 0,
1370
1014
  push: (params) => {
1371
1015
  const id = params.id || generateToastId(), duration = params.duration || 5e3;
@@ -1373,8 +1017,8 @@ function ToastProvider(props) {
1373
1017
  setState((prevState) => {
1374
1018
  if (duration === 0.01)
1375
1019
  return prevState.filter((toast) => toast.id !== id);
1376
- const dismiss = () => react.startTransition(() => setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id)));
1377
- return [...prevState.filter((toast_1) => toast_1.id !== id), {
1020
+ const dismiss = () => react.startTransition(() => setState((currentState) => currentState.filter((toast) => toast.id !== id)));
1021
+ return [...prevState.filter((toast) => toast.id !== id), {
1378
1022
  dismiss,
1379
1023
  id,
1380
1024
  updatedAt: Date.now(),
@@ -1386,24 +1030,16 @@ function ToastProvider(props) {
1386
1030
  });
1387
1031
  }), id;
1388
1032
  }
1389
- }, $[1] = t2) : t2 = $[1];
1390
- const value = t2;
1391
- let t3;
1392
- $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t3 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t3) : t3 = $[9];
1393
- let t4;
1394
- return $[10] !== children || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
1033
+ }), []);
1034
+ return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
1395
1035
  children,
1396
- t3
1397
- ] }), $[10] = children, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
1398
- }
1399
- function _temp(t0) {
1400
- const {
1401
- dismiss: dismiss_0,
1402
- id: id_0,
1403
- params: params_0,
1404
- updatedAt
1405
- } = t0;
1406
- return /* @__PURE__ */ jsxRuntime.jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration, updatedAt }, id_0);
1036
+ mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(({
1037
+ dismiss,
1038
+ id,
1039
+ params,
1040
+ updatedAt
1041
+ }) => /* @__PURE__ */ jsxRuntime.jsx(Toast, { closable: params.closable, description: params.description, onClose: dismiss, status: params.status, title: params.title, duration: params.duration, updatedAt }, id)) }) }) })
1042
+ ] });
1407
1043
  }
1408
1044
  ToastProvider.displayName = "ToastProvider";
1409
1045
  function useToast() {
@@ -1469,68 +1105,44 @@ function _focusItemElement(el) {
1469
1105
  }
1470
1106
  }
1471
1107
  const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/tree", null), Tree = react.forwardRef(function(props, forwardedRef) {
1472
- const $ = reactCompilerRuntime.c(37);
1473
- let children, onFocus, restProps, t0;
1474
- $[0] !== props ? ({
1108
+ const {
1475
1109
  children,
1476
- space: t0,
1110
+ space = 1,
1477
1111
  onFocus,
1478
1112
  ...restProps
1479
- } = props, $[0] = props, $[1] = children, $[2] = onFocus, $[3] = restProps, $[4] = t0) : (children = $[1], onFocus = $[2], restProps = $[3], t0 = $[4]);
1480
- const space = t0 === void 0 ? 1 : t0, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
1481
- let t1;
1482
- $[5] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[5] = t1) : t1 = $[5];
1483
- const path = t1;
1484
- let t2;
1485
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[6] = t2) : t2 = $[6];
1486
- const [itemElements, setItemElements] = react.useState(t2);
1487
- let t3;
1488
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[7] = t3) : t3 = $[7];
1489
- const [state, setState] = react.useState(t3), stateRef = react.useRef(state);
1490
- let t4;
1491
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[8] = t4) : t4 = $[8], react.useImperativeHandle(forwardedRef, t4);
1492
- let t5, t6;
1493
- $[9] !== focusedElement ? (t5 = () => {
1113
+ } = props, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement), path = react.useMemo(() => [], []), [itemElements, setItemElements] = react.useState([]), [state, setState] = react.useState({}), stateRef = react.useRef(state);
1114
+ react.useImperativeHandle(forwardedRef, () => ref.current), react.useEffect(() => {
1494
1115
  focusedElementRef.current = focusedElement;
1495
- }, t6 = [focusedElement], $[9] = focusedElement, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), react.useEffect(t5, t6);
1496
- let t7, t8;
1497
- $[12] !== state ? (t7 = () => {
1116
+ }, [focusedElement]), react.useEffect(() => {
1498
1117
  stateRef.current = state;
1499
- }, t8 = [state], $[12] = state, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useEffect(t7, t8);
1500
- let t9;
1501
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t9 = (element, path_0, expanded, selected) => (setState((s) => ({
1118
+ }, [state]);
1119
+ const registerItem = react.useCallback((element, path2, expanded, selected) => (setState((s) => ({
1502
1120
  ...s,
1503
- [path_0]: {
1121
+ [path2]: {
1504
1122
  element,
1505
1123
  expanded
1506
1124
  }
1507
1125
  })), selected && setFocusedElement(element), () => {
1508
- setState((s_0) => {
1126
+ setState((s) => {
1509
1127
  const newState = {
1510
- ...s_0
1128
+ ...s
1511
1129
  };
1512
- return delete newState[path_0], newState;
1130
+ return delete newState[path2], newState;
1513
1131
  });
1514
- }), $[15] = t9) : t9 = $[15];
1515
- const registerItem = t9;
1516
- let t10;
1517
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (path_1, expanded_0) => {
1518
- setState((s_1) => {
1519
- const itemState = s_1[path_1];
1132
+ }), []), setExpanded = react.useCallback((path2, expanded) => {
1133
+ setState((s) => {
1134
+ const itemState = s[path2];
1520
1135
  return itemState ? {
1521
- ...s_1,
1522
- [path_1]: {
1136
+ ...s,
1137
+ [path2]: {
1523
1138
  ...itemState,
1524
- expanded: expanded_0
1139
+ expanded
1525
1140
  }
1526
- } : s_1;
1141
+ } : s;
1527
1142
  });
1528
- }, $[16] = t10) : t10 = $[16];
1529
- const setExpanded = t10, t11 = focusedElement || itemElements[0] || null;
1530
- let t12;
1531
- $[17] !== space || $[18] !== state || $[19] !== t11 ? (t12 = {
1143
+ }, []), contextValue = react.useMemo(() => ({
1532
1144
  version: 0,
1533
- focusedElement: t11,
1145
+ focusedElement: focusedElement || itemElements[0] || null,
1534
1146
  level: 0,
1535
1147
  path,
1536
1148
  registerItem,
@@ -1538,10 +1150,7 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1538
1150
  setFocusedElement,
1539
1151
  space,
1540
1152
  state
1541
- }, $[17] = space, $[18] = state, $[19] = t11, $[20] = t12) : t12 = $[20];
1542
- const contextValue = t12;
1543
- let t13;
1544
- $[21] !== itemElements ? (t13 = (event) => {
1153
+ }), [focusedElement, itemElements, path, registerItem, setExpanded, space, state]), handleKeyDown = react.useCallback((event) => {
1545
1154
  if (focusedElementRef.current) {
1546
1155
  if (event.key === "ArrowDown") {
1547
1156
  event.preventDefault();
@@ -1558,21 +1167,19 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1558
1167
  if (event.key === "ArrowLeft") {
1559
1168
  event.preventDefault();
1560
1169
  const itemKey = focusedElementRef.current.getAttribute("data-tree-key");
1561
- if (!itemKey)
1562
- return;
1563
- const itemState_0 = stateRef.current[itemKey];
1564
- if (!itemState_0)
1565
- return;
1566
- if (itemState_0.expanded)
1567
- setState((s_2) => {
1568
- const itemState_1 = s_2[itemKey];
1569
- return itemState_1 ? {
1570
- ...s_2,
1170
+ if (!itemKey) return;
1171
+ const itemState = stateRef.current[itemKey];
1172
+ if (!itemState) return;
1173
+ if (itemState.expanded)
1174
+ setState((s) => {
1175
+ const itemState2 = s[itemKey];
1176
+ return itemState2 ? {
1177
+ ...s,
1571
1178
  [itemKey]: {
1572
- ...itemState_1,
1179
+ ...itemState2,
1573
1180
  expanded: !1
1574
1181
  }
1575
- } : s_2;
1182
+ } : s;
1576
1183
  });
1577
1184
  else {
1578
1185
  const itemPath = itemKey.split("/");
@@ -1585,41 +1192,28 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1585
1192
  if (event.key === "ArrowRight") {
1586
1193
  event.preventDefault();
1587
1194
  const focusedKey = focusedElementRef.current.getAttribute("data-tree-key");
1588
- if (!focusedKey)
1589
- return;
1590
- stateRef.current[focusedKey]?.expanded || setState((s_3) => {
1591
- const itemState_2 = s_3[focusedKey];
1592
- return itemState_2 ? {
1593
- ...s_3,
1195
+ if (!focusedKey) return;
1196
+ stateRef.current[focusedKey]?.expanded || setState((s) => {
1197
+ const itemState = s[focusedKey];
1198
+ return itemState ? {
1199
+ ...s,
1594
1200
  [focusedKey]: {
1595
- ...itemState_2,
1201
+ ...itemState,
1596
1202
  expanded: !0
1597
1203
  }
1598
- } : s_3;
1204
+ } : s;
1599
1205
  });
1600
1206
  return;
1601
1207
  }
1602
1208
  }
1603
- }, $[21] = itemElements, $[22] = t13) : t13 = $[22];
1604
- const handleKeyDown = t13;
1605
- let t14;
1606
- $[23] !== onFocus ? (t14 = (event_0) => {
1607
- setFocusedElement(event_0.target), onFocus?.(event_0);
1608
- }, $[23] = onFocus, $[24] = t14) : t14 = $[24];
1609
- const handleFocus = t14;
1610
- let t15;
1611
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => {
1612
- if (!ref.current)
1613
- return;
1209
+ }, [itemElements]), handleFocus = react.useCallback((event) => {
1210
+ setFocusedElement(event.target), onFocus?.(event);
1211
+ }, [onFocus]);
1212
+ return react.useEffect(() => {
1213
+ if (!ref.current) return;
1614
1214
  const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
1615
1215
  setItemElements(_itemElements);
1616
- }, $[25] = t15) : t15 = $[25];
1617
- let t16;
1618
- $[26] !== children ? (t16 = [children], $[26] = children, $[27] = t16) : t16 = $[27], react.useEffect(t15, t16);
1619
- let t17;
1620
- $[28] !== children || $[29] !== handleFocus || $[30] !== handleKeyDown || $[31] !== restProps || $[32] !== space ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "Tree", ...restProps, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", space, children }), $[28] = children, $[29] = handleFocus, $[30] = handleKeyDown, $[31] = restProps, $[32] = space, $[33] = t17) : t17 = $[33];
1621
- let t18;
1622
- return $[34] !== contextValue || $[35] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t17 }), $[34] = contextValue, $[35] = t17, $[36] = t18) : t18 = $[36], t18;
1216
+ }, [children]), /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "Tree", ...restProps, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", space, children }) });
1623
1217
  });
1624
1218
  Tree.displayName = "ForwardRef(Tree)";
1625
1219
  function treeItemRootStyle() {
@@ -1721,16 +1315,12 @@ function useTree() {
1721
1315
  return tree;
1722
1316
  }
1723
1317
  function TreeGroup(props) {
1724
- const $ = reactCompilerRuntime.c(9);
1725
- let children, restProps, t0;
1726
- $[0] !== props ? ({
1318
+ const {
1727
1319
  children,
1728
- expanded: t0,
1320
+ expanded = !1,
1729
1321
  ...restProps
1730
- } = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0) : (children = $[1], restProps = $[2], t0 = $[3]);
1731
- const expanded = t0 === void 0 ? !1 : t0, tree = useTree(), t1 = !expanded;
1732
- let t2;
1733
- return $[4] !== children || $[5] !== restProps || $[6] !== t1 || $[7] !== tree.space ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "TreeGroup", ...restProps, hidden: t1, marginTop: tree.space, role: "group", space: tree.space, children }), $[4] = children, $[5] = restProps, $[6] = t1, $[7] = tree.space, $[8] = t2) : t2 = $[8], t2;
1322
+ } = props, tree = useTree();
1323
+ return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "TreeGroup", ...restProps, hidden: !expanded, marginTop: tree.space, role: "group", space: tree.space, children });
1734
1324
  }
1735
1325
  const StyledTreeItem = /* @__PURE__ */ styledComponents.styled.li.withConfig({
1736
1326
  displayName: "StyledTreeItem",
@@ -1745,115 +1335,64 @@ const StyledTreeItem = /* @__PURE__ */ styledComponents.styled.li.withConfig({
1745
1335
  componentId: "sc-iiskig-2"
1746
1336
  })`& > svg{transition:transform 100ms;}`;
1747
1337
  function TreeItem(props) {
1748
- const $ = reactCompilerRuntime.c(112);
1749
- let IconComponent, children, href, idProp, linkAs, muted, onClick, restProps, t0, t1, t2, t3, t4, text, weight;
1750
- $[0] !== props ? ({
1338
+ const {
1751
1339
  children,
1752
- expanded: t0,
1753
- fontSize: t1,
1340
+ expanded: expandedProp = !1,
1341
+ fontSize = 1,
1754
1342
  href,
1755
1343
  icon: IconComponent,
1756
1344
  id: idProp,
1757
1345
  linkAs,
1758
1346
  muted,
1759
1347
  onClick,
1760
- padding: t2,
1761
- selected: t3,
1762
- space: t4,
1348
+ padding = 2,
1349
+ selected = !1,
1350
+ space = 2,
1763
1351
  text,
1764
1352
  weight,
1765
1353
  ...restProps
1766
- } = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = href, $[4] = idProp, $[5] = linkAs, $[6] = muted, $[7] = onClick, $[8] = restProps, $[9] = t0, $[10] = t1, $[11] = t2, $[12] = t3, $[13] = t4, $[14] = text, $[15] = weight) : (IconComponent = $[1], children = $[2], href = $[3], idProp = $[4], linkAs = $[5], muted = $[6], onClick = $[7], restProps = $[8], t0 = $[9], t1 = $[10], t2 = $[11], t3 = $[12], t4 = $[13], text = $[14], weight = $[15]);
1767
- const expandedProp = t0 === void 0 ? !1 : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 === void 0 ? !1 : t3, space = t4 === void 0 ? 2 : t4, [rootElement, setRootElement] = react.useState(null), treeitemRef = react.useRef(null), tree = useTree(), {
1354
+ } = props, [rootElement, setRootElement] = react.useState(null), treeitemRef = react.useRef(null), tree = useTree(), {
1768
1355
  path,
1769
1356
  registerItem,
1770
1357
  setExpanded,
1771
1358
  setFocusedElement
1772
- } = tree, _id = react.useId(), id = idProp || _id;
1773
- let t5, t6;
1774
- if ($[16] !== id || $[17] !== path) {
1775
- const itemPath = path.concat([id || ""]);
1776
- t5 = itemPath, t6 = itemPath.join("/"), $[16] = id, $[17] = path, $[18] = t5, $[19] = t6;
1777
- } else
1778
- t5 = $[18], t6 = $[19];
1779
- let t7;
1780
- $[20] !== t5 || $[21] !== t6 ? (t7 = [t5, t6], $[20] = t5, $[21] = t6, $[22] = t7) : t7 = $[22];
1781
- const [itemPath_0, itemKey] = t7, itemState = tree.state[itemKey], focused = tree.focusedElement === rootElement, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootElement ? 0 : -1, t8 = tree.level + 1;
1782
- let t9;
1783
- $[23] !== itemPath_0 || $[24] !== t8 || $[25] !== tree ? (t9 = {
1359
+ } = tree, _id = react.useId(), id = idProp || _id, [itemPath, itemKey] = react.useMemo(() => {
1360
+ const itemPath2 = path.concat([id || ""]);
1361
+ return [itemPath2, itemPath2.join("/")];
1362
+ }, [id, path]), itemState = tree.state[itemKey], focused = tree.focusedElement === rootElement, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootElement ? 0 : -1, contextValue = react.useMemo(() => ({
1784
1363
  ...tree,
1785
- level: t8,
1786
- path: itemPath_0
1787
- }, $[23] = itemPath_0, $[24] = t8, $[25] = tree, $[26] = t9) : t9 = $[26];
1788
- const contextValue = t9;
1789
- let t10;
1790
- $[27] !== expanded || $[28] !== itemKey || $[29] !== onClick || $[30] !== rootElement || $[31] !== setExpanded || $[32] !== setFocusedElement ? (t10 = (event) => {
1364
+ level: tree.level + 1,
1365
+ path: itemPath
1366
+ }), [itemPath, tree]), handleClick = react.useCallback((event) => {
1791
1367
  onClick && onClick(event);
1792
1368
  const target = event.target;
1793
1369
  target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
1794
- }, $[27] = expanded, $[28] = itemKey, $[29] = onClick, $[30] = rootElement, $[31] = setExpanded, $[32] = setFocusedElement, $[33] = t10) : t10 = $[33];
1795
- const handleClick = t10;
1796
- let t11;
1797
- $[34] !== focused || $[35] !== rootElement ? (t11 = (event_0) => {
1798
- focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
1799
- }, $[34] = focused, $[35] = rootElement, $[36] = t11) : t11 = $[36];
1800
- const handleKeyDown = t11;
1801
- let t12, t13;
1802
- $[37] !== expanded || $[38] !== itemKey || $[39] !== registerItem || $[40] !== rootElement || $[41] !== selected ? (t12 = () => {
1370
+ }, [expanded, itemKey, onClick, rootElement, setExpanded, setFocusedElement]), handleKeyDown = react.useCallback((event) => {
1371
+ focused && event.key === "Enter" && (treeitemRef.current || rootElement)?.click();
1372
+ }, [focused, rootElement]);
1373
+ react.useEffect(() => {
1803
1374
  if (rootElement)
1804
1375
  return registerItem(rootElement, itemKey, expanded, selected);
1805
- }, t13 = [expanded, itemKey, registerItem, rootElement, selected], $[37] = expanded, $[38] = itemKey, $[39] = registerItem, $[40] = rootElement, $[41] = selected, $[42] = t12, $[43] = t13) : (t12 = $[42], t13 = $[43]), react.useEffect(t12, t13);
1806
- const t14 = IconComponent || children ? "visible" : "hidden";
1807
- let t15;
1808
- $[44] !== t14 ? (t15 = {
1809
- visibility: t14,
1810
- pointerEvents: "none"
1811
- }, $[44] = t14, $[45] = t15) : t15 = $[45];
1812
- let t16;
1813
- $[46] !== IconComponent || $[47] !== fontSize || $[48] !== muted || $[49] !== weight ? (t16 = IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }), $[46] = IconComponent, $[47] = fontSize, $[48] = muted, $[49] = weight, $[50] = t16) : t16 = $[50];
1814
- let t17;
1815
- $[51] !== IconComponent || $[52] !== expanded || $[53] !== fontSize || $[54] !== muted || $[55] !== weight ? (t17 = !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(ToggleArrowText, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
1816
- transform: expanded ? "rotate(90deg)" : void 0
1817
- } }) }), $[51] = IconComponent, $[52] = expanded, $[53] = fontSize, $[54] = muted, $[55] = weight, $[56] = t17) : t17 = $[56];
1818
- let t18;
1819
- $[57] !== space || $[58] !== t15 || $[59] !== t16 || $[60] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { marginRight: space, style: t15, children: [
1820
- t16,
1821
- t17
1822
- ] }), $[57] = space, $[58] = t15, $[59] = t16, $[60] = t17, $[61] = t18) : t18 = $[61];
1823
- let t19;
1824
- $[62] !== fontSize || $[63] !== muted || $[64] !== text || $[65] !== weight ? (t19 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) }), $[62] = fontSize, $[63] = muted, $[64] = text, $[65] = weight, $[66] = t19) : t19 = $[66];
1825
- let t20;
1826
- $[67] !== padding || $[68] !== t18 || $[69] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { padding, children: [
1827
- t18,
1828
- t19
1829
- ] }), $[67] = padding, $[68] = t18, $[69] = t19, $[70] = t20) : t20 = $[70];
1830
- const content2 = t20;
1831
- if (href) {
1832
- const t212 = selected ? "" : void 0;
1833
- let t222;
1834
- $[71] !== content2 || $[72] !== expanded || $[73] !== href || $[74] !== linkAs || $[75] !== tabIndex || $[76] !== tree.level ? (t222 = /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content2 }), $[71] = content2, $[72] = expanded, $[73] = href, $[74] = linkAs, $[75] = tabIndex, $[76] = tree.level, $[77] = t222) : t222 = $[77];
1835
- let t232;
1836
- $[78] !== children || $[79] !== expanded ? (t232 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }), $[78] = children, $[79] = expanded, $[80] = t232) : t232 = $[80];
1837
- let t242;
1838
- $[81] !== contextValue || $[82] !== t232 ? (t242 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t232 }), $[81] = contextValue, $[82] = t232, $[83] = t242) : t242 = $[83];
1839
- let t252;
1840
- return $[84] !== handleClick || $[85] !== id || $[86] !== itemKey || $[87] !== restProps || $[88] !== t212 || $[89] !== t222 || $[90] !== t242 ? (t252 = /* @__PURE__ */ jsxRuntime.jsxs(StyledTreeItem, { "data-selected": t212, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
1841
- t222,
1842
- t242
1843
- ] }), $[84] = handleClick, $[85] = id, $[86] = itemKey, $[87] = restProps, $[88] = t212, $[89] = t222, $[90] = t242, $[91] = t252) : t252 = $[91], t252;
1844
- }
1845
- const t21 = selected ? "" : void 0;
1846
- let t22;
1847
- $[92] !== content2 || $[93] !== tree.level ? (t22 = /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content2 }), $[92] = content2, $[93] = tree.level, $[94] = t22) : t22 = $[94];
1848
- let t23;
1849
- $[95] !== children || $[96] !== expanded ? (t23 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }), $[95] = children, $[96] = expanded, $[97] = t23) : t23 = $[97];
1850
- let t24;
1851
- $[98] !== contextValue || $[99] !== t23 ? (t24 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t23 }), $[98] = contextValue, $[99] = t23, $[100] = t24) : t24 = $[100];
1852
- let t25;
1853
- return $[101] !== expanded || $[102] !== handleClick || $[103] !== handleKeyDown || $[104] !== id || $[105] !== itemKey || $[106] !== restProps || $[107] !== t21 || $[108] !== t22 || $[109] !== t24 || $[110] !== tabIndex ? (t25 = /* @__PURE__ */ jsxRuntime.jsxs(StyledTreeItem, { "data-selected": t21, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
1854
- t22,
1855
- t24
1856
- ] }), $[101] = expanded, $[102] = handleClick, $[103] = handleKeyDown, $[104] = id, $[105] = itemKey, $[106] = restProps, $[107] = t21, $[108] = t22, $[109] = t24, $[110] = tabIndex, $[111] = t25) : t25 = $[111], t25;
1376
+ }, [expanded, itemKey, registerItem, rootElement, selected]);
1377
+ const content2 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { padding, children: [
1378
+ /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { marginRight: space, style: {
1379
+ visibility: IconComponent || children ? "visible" : "hidden",
1380
+ pointerEvents: "none"
1381
+ }, children: [
1382
+ IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }),
1383
+ !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(ToggleArrowText, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
1384
+ transform: expanded ? "rotate(90deg)" : void 0
1385
+ } }) })
1386
+ ] }),
1387
+ /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) })
1388
+ ] });
1389
+ return href ? /* @__PURE__ */ jsxRuntime.jsxs(StyledTreeItem, { "data-selected": selected ? "" : void 0, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
1390
+ /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content2 }),
1391
+ /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }) })
1392
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(StyledTreeItem, { "data-selected": selected ? "" : void 0, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
1393
+ /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content2 }),
1394
+ /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }) })
1395
+ ] });
1857
1396
  }
1858
1397
  TreeItem.displayName = "TreeItem";
1859
1398
  exports.Arrow = _visualEditing.Arrow;
@@ -1934,7 +1473,6 @@ exports.rgbToHsl = _visualEditing.rgbToHsl;
1934
1473
  exports.rgba = _visualEditing.rgba;
1935
1474
  exports.screen = _visualEditing.screen;
1936
1475
  exports.studioTheme = _visualEditing.studioTheme;
1937
- exports.useArrayProp = _visualEditing.useArrayProp;
1938
1476
  exports.useBoundaryElement = _visualEditing.useBoundaryElement;
1939
1477
  exports.useClickOutsideEvent = _visualEditing.useClickOutsideEvent;
1940
1478
  exports.useCustomValidity = _visualEditing.useCustomValidity;
@@ -1974,6 +1512,7 @@ exports.attemptFocus = attemptFocus;
1974
1512
  exports.focusFirstDescendant = focusFirstDescendant;
1975
1513
  exports.focusLastDescendant = focusLastDescendant;
1976
1514
  exports.isFocusable = isFocusable;
1515
+ exports.useArrayProp = useArrayProp;
1977
1516
  exports.useClickOutside = useClickOutside;
1978
1517
  exports.useDialog = useDialog;
1979
1518
  exports.useElementRect = useElementRect;