@sanity/ui 3.0.14 → 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.
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 () => {
@@ -48,9 +48,7 @@ function focusLastDescendant(element) {
48
48
  return !1;
49
49
  }
50
50
  function useArrayProp(val, defaultVal) {
51
- const $ = reactCompilerRuntime.c(3);
52
- let t0;
53
- return $[0] !== defaultVal || $[1] !== val ? (t0 = _visualEditing._getArrayProp(val, defaultVal), $[0] = defaultVal, $[1] = val, $[2] = t0) : t0 = $[2], t0;
51
+ return react.useMemo(() => _visualEditing._getArrayProp(val, defaultVal), [val, defaultVal]);
54
52
  }
55
53
  function _getElements(element, elementsArg) {
56
54
  const ret = [element];
@@ -58,13 +56,9 @@ function _getElements(element, elementsArg) {
58
56
  Array.isArray(el) ? ret.push(...el) : ret.push(el);
59
57
  return ret.filter(Boolean);
60
58
  }
61
- function useClickOutside(listener, t0, boundaryElement) {
62
- const $ = reactCompilerRuntime.c(12), elementsArg = t0 === void 0 ? _visualEditing.EMPTY_ARRAY : t0, [element, setElement] = react.useState(null);
63
- let t1;
64
- $[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
65
- const [elements, setElements] = react.useState(t1), elementsRef = react.useRef(elements);
66
- let t2, t3;
67
- $[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(() => {
68
62
  const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
69
63
  if (prevElements.length !== nextElements.length) {
70
64
  setElements(nextElements), elementsRef.current = nextElements;
@@ -75,21 +69,18 @@ function useClickOutside(listener, t0, boundaryElement) {
75
69
  setElements(nextElements), elementsRef.current = nextElements;
76
70
  return;
77
71
  }
78
- for (const el_0 of nextElements)
79
- if (!prevElements.includes(el_0)) {
72
+ for (const el of nextElements)
73
+ if (!prevElements.includes(el)) {
80
74
  setElements(nextElements), elementsRef.current = nextElements;
81
75
  return;
82
76
  }
83
- }, t3 = [element, elementsArg], $[3] = element, $[4] = elementsArg, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), react.useEffect(t2, t3);
84
- let t4, t5;
85
- return $[7] !== boundaryElement || $[8] !== elements || $[9] !== listener ? (t4 = () => {
86
- if (!listener)
87
- return;
77
+ }, [element, elementsArg]), react.useEffect(() => {
78
+ if (!listener) return;
88
79
  const handleWindowMouseDown = (evt) => {
89
80
  const target = evt.target;
90
81
  if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
91
- for (const el_1 of elements)
92
- if (target === el_1 || el_1.contains(target))
82
+ for (const el of elements)
83
+ if (target === el || el.contains(target))
93
84
  return;
94
85
  listener(evt);
95
86
  }
@@ -97,15 +88,14 @@ function useClickOutside(listener, t0, boundaryElement) {
97
88
  return window.addEventListener("mousedown", handleWindowMouseDown), () => {
98
89
  window.removeEventListener("mousedown", handleWindowMouseDown);
99
90
  };
100
- }, 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;
101
92
  }
102
93
  function useElementRect(element) {
103
94
  return _visualEditing.useElementSize(element)?._contentRect || null;
104
95
  }
105
96
  function useForwardedRef(ref) {
106
- const $ = reactCompilerRuntime.c(1), innerRef = react.useRef(null);
107
- let t0;
108
- 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;
109
99
  }
110
100
  class ErrorBoundary extends react.Component {
111
101
  state = {
@@ -152,27 +142,20 @@ const StyledAutocomplete = styledComponents.styled.div.withConfig({
152
142
  componentId: "sc-1igauft-2"
153
143
  })`animation:${rotate} 500ms linear infinite;`;
154
144
  function AutocompleteOption(props) {
155
- const $ = reactCompilerRuntime.c(11), {
145
+ const {
156
146
  children,
157
147
  id,
158
148
  onSelect,
159
149
  selected,
160
150
  value
161
- } = props;
162
- let t0;
163
- $[0] !== onSelect || $[1] !== value ? (t0 = () => {
151
+ } = props, handleClick = react.useCallback(() => {
164
152
  setTimeout(() => {
165
153
  onSelect(value);
166
154
  }, 0);
167
- }, $[0] = onSelect, $[1] = value, $[2] = t0) : t0 = $[2];
168
- const handleClick = t0;
169
- let t1;
170
- $[3] !== handleClick ? (t1 = (event) => {
155
+ }, [onSelect, value]), handleKeyDown = react.useCallback((event) => {
171
156
  event.key === "Enter" && !_visualEditing._isEnterToClickElement(event.currentTarget) && handleClick();
172
- }, $[3] = handleClick, $[4] = t1) : t1 = $[4];
173
- const handleKeyDown = t1;
174
- let t2;
175
- 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 });
176
159
  }
177
160
  function autocompleteReducer(state, msg) {
178
161
  return msg.type === "input/change" ? {
@@ -214,17 +197,15 @@ function autocompleteReducer(state, msg) {
214
197
  } : state;
215
198
  }
216
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) {
217
- const $ = reactCompilerRuntime.c(180);
218
- let customValidity, disabled, filterOptionProp, icon, id, loading, onBlur, onChange, onFocus, onQueryChange, onSelect, openButton, openOnFocus, optionsProp, prefix, readOnly, relatedElements, renderOptionProp, renderPopover, restProps, suffix, t0, t1, t2, t3, t4, t5, t6, valueProp;
219
- $[0] !== props ? ({
220
- border: t0,
200
+ const {
201
+ border = !0,
221
202
  customValidity,
222
203
  disabled,
223
204
  filterOption: filterOptionProp,
224
- fontSize: t1,
205
+ fontSize = 2,
225
206
  icon,
226
207
  id,
227
- listBox: t2,
208
+ listBox = _visualEditing.EMPTY_RECORD,
228
209
  loading,
229
210
  onBlur,
230
211
  onChange,
@@ -234,60 +215,35 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
234
215
  openButton,
235
216
  openOnFocus,
236
217
  options: optionsProp,
237
- padding: t3,
238
- popover: t4,
218
+ padding: paddingProp = 3,
219
+ popover = _visualEditing.EMPTY_RECORD,
239
220
  prefix,
240
- radius: t5,
221
+ radius = 2,
241
222
  readOnly,
242
223
  relatedElements,
243
224
  renderOption: renderOptionProp,
244
225
  renderPopover,
245
- renderValue: t6,
226
+ renderValue = DEFAULT_RENDER_VALUE,
246
227
  suffix,
247
228
  value: valueProp,
248
229
  ...restProps
249
- } = props, $[0] = props, $[1] = customValidity, $[2] = disabled, $[3] = filterOptionProp, $[4] = icon, $[5] = id, $[6] = loading, $[7] = onBlur, $[8] = onChange, $[9] = onFocus, $[10] = onQueryChange, $[11] = onSelect, $[12] = openButton, $[13] = openOnFocus, $[14] = optionsProp, $[15] = prefix, $[16] = readOnly, $[17] = relatedElements, $[18] = renderOptionProp, $[19] = renderPopover, $[20] = restProps, $[21] = suffix, $[22] = t0, $[23] = t1, $[24] = t2, $[25] = t3, $[26] = t4, $[27] = t5, $[28] = t6, $[29] = valueProp) : (customValidity = $[1], disabled = $[2], filterOptionProp = $[3], icon = $[4], id = $[5], loading = $[6], onBlur = $[7], onChange = $[8], onFocus = $[9], onQueryChange = $[10], onSelect = $[11], openButton = $[12], openOnFocus = $[13], optionsProp = $[14], prefix = $[15], readOnly = $[16], relatedElements = $[17], renderOptionProp = $[18], renderPopover = $[19], restProps = $[20], suffix = $[21], t0 = $[22], t1 = $[23], t2 = $[24], t3 = $[25], t4 = $[26], t5 = $[27], t6 = $[28], valueProp = $[29]);
250
- const border = t0 === void 0 ? !0 : t0, fontSize = t1 === void 0 ? 2 : t1, listBox = t2 === void 0 ? _visualEditing.EMPTY_RECORD : t2, paddingProp = t3 === void 0 ? 3 : t3, popover = t4 === void 0 ? _visualEditing.EMPTY_RECORD : t4, radius = t5 === void 0 ? 2 : t5, renderValue = t6 === void 0 ? DEFAULT_RENDER_VALUE : t6, t7 = valueProp || null, t8 = valueProp || null;
251
- let t9;
252
- $[30] !== t7 || $[31] !== t8 ? (t9 = {
253
- activeValue: t7,
230
+ } = props, [state, dispatch] = react.useReducer(autocompleteReducer, {
231
+ activeValue: valueProp || null,
254
232
  focused: !1,
255
233
  listFocused: !1,
256
234
  query: null,
257
- value: t8
258
- }, $[30] = t7, $[31] = t8, $[32] = t9) : t9 = $[32];
259
- const [state, dispatch] = react.useReducer(autocompleteReducer, t9), {
235
+ value: valueProp || null
236
+ }), {
260
237
  activeValue,
261
238
  focused,
262
239
  listFocused,
263
240
  query,
264
241
  value
265
- } = state;
266
- let t10;
267
- $[33] !== fontSize || $[34] !== paddingProp ? (t10 = (t112) => {
268
- const {
269
- value: value_0
270
- } = t112;
271
- return /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Card, { "data-as": "button", padding: paddingProp, radius: 2, tone: "inherit", children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 }) });
272
- }, $[33] = fontSize, $[34] = paddingProp, $[35] = t10) : t10 = $[35];
273
- const renderOption = typeof renderOptionProp == "function" ? renderOptionProp : t10, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), [inputElement, setInputElement] = react.useState(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
274
- let t11, t12;
275
- $[36] !== inputElement ? (t11 = () => inputElement, t12 = [inputElement], $[36] = inputElement, $[37] = t11, $[38] = t12) : (t11 = $[37], t12 = $[38]), react.useImperativeHandle(inputElementRef, t11, t12);
276
- let t13, t14;
277
- $[39] !== inputElement ? (t13 = () => inputElement, t14 = [inputElement], $[39] = inputElement, $[40] = t13, $[41] = t14) : (t13 = $[40], t14 = $[41]), react.useImperativeHandle(forwardedRef, t13, t14);
278
- const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : _visualEditing.EMPTY_ARRAY, padding = _visualEditing._getArrayProp(paddingProp);
279
- let t15;
280
- $[42] !== options || $[43] !== value ? (t15 = value !== null ? options.find((o) => o.value === value) : void 0, $[42] = options, $[43] = value, $[44] = t15) : t15 = $[44];
281
- const currentOption = t15;
282
- let t16;
283
- if ($[45] !== filterOption || $[46] !== options || $[47] !== query) {
284
- let t172;
285
- $[49] !== filterOption || $[50] !== query ? (t172 = (option) => query ? filterOption(query, option) : !0, $[49] = filterOption, $[50] = query, $[51] = t172) : t172 = $[51], t16 = options.filter(t172), $[45] = filterOption, $[46] = options, $[47] = query, $[48] = t16;
286
- } else
287
- t16 = $[48];
288
- const filteredOptions = t16, filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null;
289
- let t17;
290
- $[52] !== onBlur || $[53] !== onQueryChange || $[54] !== relatedElements ? (t17 = (event) => {
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) => {
291
247
  setTimeout(() => {
292
248
  if (popoverMouseWithinRef.current)
293
249
  return;
@@ -304,31 +260,21 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
304
260
  type: "root/blur"
305
261
  }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), onBlur && onBlur(event));
306
262
  }, 0);
307
- }, $[52] = onBlur, $[53] = onQueryChange, $[54] = relatedElements, $[55] = t17) : t17 = $[55];
308
- const handleRootBlur = t17;
309
- let t18;
310
- $[56] === Symbol.for("react.memo_cache_sentinel") ? (t18 = (event_0) => {
311
- const listBoxElement = listBoxElementRef.current, focusedElement = event_0.target instanceof HTMLElement ? event_0.target : null, listFocused_0 = listBoxElement?.contains(focusedElement) || !1;
312
- 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({
313
266
  type: "root/setListFocused",
314
- listFocused: listFocused_0
267
+ listFocused: listFocused2
315
268
  }));
316
- }, $[56] = t18) : t18 = $[56];
317
- const handleRootFocus = t18;
318
- let t19;
319
- $[57] !== onChange || $[58] !== onQueryChange || $[59] !== onSelect ? (t19 = (v) => {
269
+ }, []), handleOptionSelect = react.useCallback((v) => {
320
270
  dispatch({
321
271
  type: "value/change",
322
272
  value: v
323
273
  }), popoverMouseWithinRef.current = !1, onSelect && onSelect(v), valueRef.current = v, onChange && onChange(v), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
324
- }, $[57] = onChange, $[58] = onQueryChange, $[59] = onSelect, $[60] = t19) : t19 = $[60];
325
- const handleOptionSelect = t19;
326
- let t20;
327
- $[61] !== activeValue || $[62] !== filteredOptions || $[63] !== filteredOptionsLen || $[64] !== onQueryChange ? (t20 = (event_1) => {
328
- if (event_1.key === "ArrowDown") {
329
- if (event_1.preventDefault(), !filteredOptionsLen)
330
- return;
331
- 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];
332
278
  nextActiveOption && dispatch({
333
279
  type: "root/setActiveValue",
334
280
  value: nextActiveOption.value,
@@ -336,80 +282,56 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
336
282
  });
337
283
  return;
338
284
  }
339
- if (event_1.key === "ArrowUp") {
340
- if (event_1.preventDefault(), !filteredOptionsLen)
341
- return;
342
- const activeOption_0 = filteredOptions.find((o_1) => o_1.value === activeValue), activeIndex_0 = activeOption_0 ? filteredOptions.indexOf(activeOption_0) : -1, nextActiveOption_0 = filteredOptions[activeIndex_0 === -1 ? filteredOptionsLen - 1 : (filteredOptionsLen + activeIndex_0 - 1) % filteredOptionsLen];
343
- 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({
344
289
  type: "root/setActiveValue",
345
- value: nextActiveOption_0.value,
290
+ value: nextActiveOption.value,
346
291
  listFocused: !0
347
292
  });
348
293
  return;
349
294
  }
350
- if (event_1.key === "Escape") {
295
+ if (event.key === "Escape") {
351
296
  dispatch({
352
297
  type: "root/escape"
353
298
  }), popoverMouseWithinRef.current = !1, onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
354
299
  return;
355
300
  }
356
- const target = event_1.target, listEl = listBoxElementRef.current;
357
- 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)) {
358
303
  inputElementRef.current?.focus();
359
304
  return;
360
305
  }
361
- }, $[61] = activeValue, $[62] = filteredOptions, $[63] = filteredOptionsLen, $[64] = onQueryChange, $[65] = t20) : t20 = $[65];
362
- const handleRootKeyDown = t20;
363
- let t21;
364
- $[66] !== onQueryChange ? (t21 = (event_2) => {
365
- const nextQuery = event_2.currentTarget.value;
306
+ }, [activeValue, filteredOptions, filteredOptionsLen, onQueryChange]), handleInputChange = react.useCallback((event) => {
307
+ const nextQuery = event.currentTarget.value;
366
308
  dispatch({
367
309
  type: "input/change",
368
310
  query: nextQuery
369
311
  }), onQueryChange && onQueryChange(nextQuery);
370
- }, $[66] = onQueryChange, $[67] = t21) : t21 = $[67];
371
- const handleInputChange = t21;
372
- let t22;
373
- $[68] !== currentOption || $[69] !== renderValue || $[70] !== value ? (t22 = () => {
312
+ }, [onQueryChange]), dispatchOpen = react.useCallback(() => {
374
313
  dispatch({
375
314
  type: "root/open",
376
315
  query: value ? renderValue(value, currentOption) : ""
377
316
  });
378
- }, $[68] = currentOption, $[69] = renderValue, $[70] = value, $[71] = t22) : t22 = $[71];
379
- const dispatchOpen = t22;
380
- let t23;
381
- $[72] !== dispatchOpen || $[73] !== focused || $[74] !== onFocus || $[75] !== openOnFocus ? (t23 = (event_3) => {
317
+ }, [currentOption, renderValue, value]), handleInputFocus = react.useCallback((event) => {
382
318
  focused || (dispatch({
383
319
  type: "input/focus"
384
- }), onFocus && onFocus(event_3), openOnFocus && dispatchOpen());
385
- }, $[72] = dispatchOpen, $[73] = focused, $[74] = onFocus, $[75] = openOnFocus, $[76] = t23) : t23 = $[76];
386
- const handleInputFocus = t23;
387
- let t24;
388
- $[77] === Symbol.for("react.memo_cache_sentinel") ? (t24 = () => {
320
+ }), onFocus && onFocus(event), openOnFocus && dispatchOpen());
321
+ }, [focused, onFocus, openOnFocus, dispatchOpen]), handlePopoverMouseEnter = react.useCallback(() => {
389
322
  popoverMouseWithinRef.current = !0;
390
- }, $[77] = t24) : t24 = $[77];
391
- const handlePopoverMouseEnter = t24;
392
- let t25;
393
- $[78] === Symbol.for("react.memo_cache_sentinel") ? (t25 = () => {
323
+ }, []), handlePopoverMouseLeave = react.useCallback(() => {
394
324
  popoverMouseWithinRef.current = !1;
395
- }, $[78] = t25) : t25 = $[78];
396
- const handlePopoverMouseLeave = t25;
397
- let t26;
398
- $[79] !== onChange || $[80] !== onQueryChange ? (t26 = () => {
325
+ }, []), handleClearButtonClick = react.useCallback(() => {
399
326
  dispatch({
400
327
  type: "root/clear"
401
328
  }), valueRef.current = "", onChange && onChange(""), onQueryChange && onQueryChange(null), inputElementRef.current?.focus();
402
- }, $[79] = onChange, $[80] = onQueryChange, $[81] = t26) : t26 = $[81];
403
- const handleClearButtonClick = t26;
404
- let t27;
405
- $[82] === Symbol.for("react.memo_cache_sentinel") ? (t27 = () => {
329
+ }, [onChange, onQueryChange]), handleClearButtonFocus = react.useCallback(() => {
406
330
  dispatch({
407
331
  type: "input/focus"
408
332
  });
409
- }, $[82] = t27) : t27 = $[82];
410
- const handleClearButtonFocus = t27;
411
- let t28, t29;
412
- $[83] !== valueProp ? (t28 = () => {
333
+ }, []);
334
+ react.useEffect(() => {
413
335
  if (valueProp !== valuePropRef.current) {
414
336
  valuePropRef.current = valueProp, valueProp !== void 0 && (dispatch({
415
337
  type: "value/change",
@@ -421,117 +343,46 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
421
343
  type: "value/change",
422
344
  value: valueProp || null
423
345
  }));
424
- }, t29 = [valueProp], $[83] = valueProp, $[84] = t28, $[85] = t29) : (t28 = $[84], t29 = $[85]), react.useEffect(t28, t29);
425
- let t30, t31;
426
- $[86] !== focused ? (t30 = () => {
346
+ }, [valueProp]), react.useEffect(() => {
427
347
  !focused && valueRef.current && dispatch({
428
348
  type: "root/setActiveValue",
429
349
  value: valueRef.current
430
350
  });
431
- }, t31 = [focused], $[86] = focused, $[87] = t30, $[88] = t31) : (t30 = $[87], t31 = $[88]), react.useEffect(t30, t31);
432
- let t32, t33;
433
- $[89] !== activeValue || $[90] !== filteredOptions ? (t32 = () => {
351
+ }, [focused]), react.useEffect(() => {
434
352
  const listElement = listBoxElementRef.current;
435
- if (!listElement)
436
- return;
437
- const activeOption_1 = filteredOptions.find((o_2) => o_2.value === activeValue);
438
- if (activeOption_1) {
439
- 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];
440
357
  if (activeItemElement) {
441
358
  if (_hasFocus(activeItemElement))
442
359
  return;
443
360
  focusFirstDescendant(activeItemElement);
444
361
  }
445
362
  }
446
- }, t33 = [activeValue, filteredOptions], $[89] = activeValue, $[90] = filteredOptions, $[91] = t32, $[92] = t33) : (t32 = $[91], t33 = $[92]), react.useEffect(t32, t33);
447
- let t34;
448
- bb0: {
449
- if (!loading && !disabled && value) {
450
- let t352;
451
- $[93] === Symbol.for("react.memo_cache_sentinel") ? (t352 = {
363
+ }, [activeValue, filteredOptions]);
364
+ const clearButton = react.useMemo(() => {
365
+ if (!loading && !disabled && value)
366
+ return {
452
367
  "aria-label": "Clear",
453
368
  onFocus: handleClearButtonFocus
454
- }, $[93] = t352) : t352 = $[93], t34 = t352;
455
- break bb0;
456
- }
457
- t34 = void 0;
458
- }
459
- const clearButton = t34, openButtonBoxPadding = padding.map(_temp$3), openButtonPadding = padding.map(_temp2$1), openButtonProps = typeof openButton == "object" ? openButton : _visualEditing.EMPTY_RECORD;
460
- let t35;
461
- $[94] !== dispatchOpen || $[95] !== openButtonProps ? (t35 = (event_4) => {
462
- dispatchOpen(), openButtonProps.onClick && openButtonProps.onClick(event_4), _raf(() => inputElementRef.current?.focus());
463
- }, $[94] = dispatchOpen, $[95] = openButtonProps, $[96] = t35) : t35 = $[96];
464
- const handleOpenClick = t35;
465
- let t36;
466
- $[97] !== disabled || $[98] !== expanded || $[99] !== fontSize || $[100] !== handleOpenClick || $[101] !== openButton || $[102] !== openButtonBoxPadding || $[103] !== openButtonPadding || $[104] !== openButtonProps || $[105] !== readOnly ? (t36 = !disabled && !readOnly && openButton ? /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": expanded, padding: openButtonBoxPadding, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { "aria-label": "Open", disabled: expanded, fontSize, icon: icons.ChevronDownIcon, mode: "bleed", padding: openButtonPadding, ...openButtonProps, onClick: handleOpenClick }) }) : void 0, $[97] = disabled, $[98] = expanded, $[99] = fontSize, $[100] = handleOpenClick, $[101] = openButton, $[102] = openButtonBoxPadding, $[103] = openButtonPadding, $[104] = openButtonProps, $[105] = readOnly, $[106] = t36) : t36 = $[106];
467
- const openButtonNode = t36;
468
- let t37;
469
- bb1: {
470
- if (query === null) {
471
- if (value !== null) {
472
- let t382;
473
- $[107] !== currentOption || $[108] !== renderValue || $[109] !== value ? (t382 = renderValue(value, currentOption), $[107] = currentOption, $[108] = renderValue, $[109] = value, $[110] = t382) : t382 = $[110], t37 = t382;
474
- break bb1;
475
- }
476
- t37 = "";
477
- break bb1;
478
- }
479
- t37 = query;
480
- }
481
- const inputValue = t37;
482
- let t38;
483
- $[111] !== listFocused ? (t38 = (event_5) => {
484
- event_5.key === "Tab" && listFocused && inputElementRef.current?.focus();
485
- }, $[111] = listFocused, $[112] = t38) : t38 = $[112];
486
- const handleListBoxKeyDown = t38;
487
- let t39;
488
- bb2: {
489
- if (filteredOptions.length === 0) {
490
- t39 = null;
491
- break bb2;
492
- }
493
- let t402;
494
- if ($[113] !== activeValue || $[114] !== currentOption || $[115] !== filteredOptions || $[116] !== handleOptionSelect || $[117] !== id || $[118] !== listFocused || $[119] !== loading || $[120] !== renderOption) {
495
- let t413;
496
- $[122] !== activeValue || $[123] !== currentOption || $[124] !== handleOptionSelect || $[125] !== id || $[126] !== listFocused || $[127] !== loading || $[128] !== renderOption ? (t413 = (option_0) => {
497
- const active = activeValue !== null ? option_0.value === activeValue : currentOption === option_0;
498
- return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
499
- disabled: loading,
500
- selected: active,
501
- tabIndex: listFocused && active ? 0 : -1
502
- }) }, option_0.value);
503
- }, $[122] = activeValue, $[123] = currentOption, $[124] = handleOptionSelect, $[125] = id, $[126] = listFocused, $[127] = loading, $[128] = renderOption, $[129] = t413) : t413 = $[129], t402 = filteredOptions.map(t413), $[113] = activeValue, $[114] = currentOption, $[115] = filteredOptions, $[116] = handleOptionSelect, $[117] = id, $[118] = listFocused, $[119] = loading, $[120] = renderOption, $[121] = t402;
504
- } else
505
- t402 = $[121];
506
- let t412;
507
- $[130] !== listBoxId || $[131] !== t402 ? (t412 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "aria-multiselectable": !1, "data-ui": "AutoComplete__resultsList", id: listBoxId, ref: listBoxElementRef, role: "listbox", space: 1, children: t402 }), $[130] = listBoxId, $[131] = t402, $[132] = t412) : t412 = $[132];
508
- let t422;
509
- $[133] !== handleListBoxKeyDown || $[134] !== listBox || $[135] !== t412 ? (t422 = /* @__PURE__ */ jsxRuntime.jsx(ListBox, { "data-ui": "AutoComplete__results", onKeyDown: handleListBoxKeyDown, padding: 1, ...listBox, tabIndex: -1, children: t412 }), $[133] = handleListBoxKeyDown, $[134] = listBox, $[135] = t412, $[136] = t422) : t422 = $[136], t39 = t422;
510
- }
511
- const content2 = t39;
512
- let t40;
513
- bb3: {
514
- if (renderPopover) {
515
- const t413 = !expanded;
516
- let t422;
517
- $[137] !== content2 || $[138] !== handlePopoverMouseEnter || $[139] !== handlePopoverMouseLeave || $[140] !== inputElement || $[141] !== renderPopover || $[142] !== t413 ? (t422 = /* @__PURE__ */ jsxRuntime.jsx(RenderPopover, { content: content2, hidden: t413, inputElement, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, resultsPopoverElementRef, renderPopover }), $[137] = content2, $[138] = handlePopoverMouseEnter, $[139] = handlePopoverMouseLeave, $[140] = inputElement, $[141] = renderPopover, $[142] = t413, $[143] = t422) : t422 = $[143], t40 = t422;
518
- break bb3;
519
- }
520
- if (filteredOptionsLen === 0) {
521
- t40 = null;
522
- break bb3;
523
- }
524
- let t412;
525
- $[144] !== content2 || $[145] !== expanded || $[146] !== handlePopoverMouseEnter || $[147] !== handlePopoverMouseLeave || $[148] !== inputElement || $[149] !== popover || $[150] !== radius ? (t412 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius, ref: resultsPopoverElementRef, referenceElement: inputElement, ...popover }), $[144] = content2, $[145] = expanded, $[146] = handlePopoverMouseEnter, $[147] = handlePopoverMouseLeave, $[148] = inputElement, $[149] = popover, $[150] = radius, $[151] = t412) : t412 = $[151], t40 = t412;
526
- }
527
- const results = t40, t41 = loading && AnimatedSpinnerIcon, t42 = suffix || openButtonNode;
528
- let t43;
529
- $[152] !== activeItemId || $[153] !== border || $[154] !== clearButton || $[155] !== customValidity || $[156] !== disabled || $[157] !== expanded || $[158] !== fontSize || $[159] !== handleClearButtonClick || $[160] !== handleInputChange || $[161] !== handleInputFocus || $[162] !== icon || $[163] !== id || $[164] !== inputValue || $[165] !== listBoxId || $[166] !== padding || $[167] !== prefix || $[168] !== radius || $[169] !== readOnly || $[170] !== restProps || $[171] !== t41 || $[172] !== t42 ? (t43 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.TextInput, { ...restProps, "aria-activedescendant": activeItemId, "aria-autocomplete": "list", "aria-expanded": expanded, "aria-owns": listBoxId, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", border, clearButton, customValidity, disabled, fontSize, icon, iconRight: t41, id, inputMode: "search", onChange: handleInputChange, onClear: handleClearButtonClick, onFocus: handleInputFocus, padding, prefix, radius, readOnly, ref: setInputElement, role: "combobox", spellCheck: !1, suffix: t42, value: inputValue }), $[152] = activeItemId, $[153] = border, $[154] = clearButton, $[155] = customValidity, $[156] = disabled, $[157] = expanded, $[158] = fontSize, $[159] = handleClearButtonClick, $[160] = handleInputChange, $[161] = handleInputFocus, $[162] = icon, $[163] = id, $[164] = inputValue, $[165] = listBoxId, $[166] = padding, $[167] = prefix, $[168] = radius, $[169] = readOnly, $[170] = restProps, $[171] = t41, $[172] = t42, $[173] = t43) : t43 = $[173];
530
- let t44;
531
- return $[174] !== handleRootBlur || $[175] !== handleRootFocus || $[176] !== handleRootKeyDown || $[177] !== results || $[178] !== t43 ? (t44 = /* @__PURE__ */ jsxRuntime.jsxs(StyledAutocomplete, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
532
- t43,
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 }),
533
384
  results
534
- ] }), $[174] = handleRootBlur, $[175] = handleRootFocus, $[176] = handleRootKeyDown, $[177] = results, $[178] = t43, $[179] = t44) : t44 = $[179], t44;
385
+ ] });
535
386
  });
536
387
  function RenderPopover({
537
388
  renderPopover,
@@ -551,46 +402,22 @@ function RenderPopover({
551
402
  }, resultsPopoverElementRef);
552
403
  }
553
404
  InnerAutocomplete.displayName = "ForwardRef(Autocomplete)";
554
- const Autocomplete = InnerAutocomplete;
555
- function _temp$3(v_0) {
556
- return v_0 === 0 ? 0 : v_0 === 1 || v_0 === 2 ? 1 : v_0 - 2;
557
- }
558
- function _temp2$1(v_1) {
559
- return Math.max(v_1 - 1, 0);
560
- }
561
- const StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
405
+ const Autocomplete = InnerAutocomplete, StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
562
406
  displayName: "StyledBreadcrumbs",
563
407
  componentId: "sc-1es8h8q-0"
564
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({
565
409
  displayName: "ExpandButton",
566
410
  componentId: "sc-1es8h8q-1"
567
411
  })`appearance:none;margin:-4px;`, Breadcrumbs = react.forwardRef(function(props, ref) {
568
- const $ = reactCompilerRuntime.c(29);
569
- let children, maxLength, restProps, separator, t0;
570
- $[0] !== props ? ({
412
+ const {
571
413
  children,
572
414
  maxLength,
573
415
  separator,
574
- space: t0,
416
+ space: spaceRaw = 2,
575
417
  ...restProps
576
- } = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = restProps, $[4] = separator, $[5] = t0) : (children = $[1], maxLength = $[2], restProps = $[3], separator = $[4], t0 = $[5]);
577
- const spaceRaw = t0 === void 0 ? 2 : t0;
578
- let t1;
579
- $[6] !== spaceRaw ? (t1 = _visualEditing._getArrayProp(spaceRaw), $[6] = spaceRaw, $[7] = t1) : t1 = $[7];
580
- const space = t1, [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null);
581
- let t2;
582
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!1), $[8] = t2) : t2 = $[8];
583
- const collapse = t2;
584
- let t3;
585
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => setOpen(!0), $[9] = t3) : t3 = $[9];
586
- const expand = t3;
587
- let t4;
588
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => [expandElementRef.current, popoverElementRef.current], $[10] = t4) : t4 = $[10], _visualEditing.useClickOutsideEvent(collapse, t4);
589
- let t5;
590
- $[11] !== children ? (t5 = react.Children.toArray(children).filter(react.isValidElement), $[11] = children, $[12] = t5) : t5 = $[12];
591
- const rawItems = t5;
592
- let t6;
593
- $[13] !== maxLength || $[14] !== open || $[15] !== rawItems || $[16] !== space ? (t6 = {
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({
594
421
  collapse,
595
422
  expand,
596
423
  expandElementRef,
@@ -599,49 +426,27 @@ const StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
599
426
  popoverElementRef,
600
427
  rawItems,
601
428
  space
602
- }, $[13] = maxLength, $[14] = open, $[15] = rawItems, $[16] = space, $[17] = t6) : t6 = $[17];
603
- const items = useItems(t6);
604
- let t7;
605
- if ($[18] !== items || $[19] !== separator || $[20] !== space) {
606
- let t82;
607
- $[22] !== separator || $[23] !== space ? (t82 = (item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
608
- itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
609
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
610
- ] }, itemIndex), $[22] = separator, $[23] = space, $[24] = t82) : t82 = $[24], t7 = items.map(t82), $[18] = items, $[19] = separator, $[20] = space, $[21] = t7;
611
- } else
612
- t7 = $[21];
613
- let t8;
614
- return $[25] !== ref || $[26] !== restProps || $[27] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: t7 }), $[25] = ref, $[26] = restProps, $[27] = t7, $[28] = t8) : t8 = $[28], t8;
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)) });
615
434
  });
616
435
  Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
617
- function useItems(t0) {
618
- const $ = reactCompilerRuntime.c(28), {
619
- collapse,
620
- expand,
621
- expandElementRef,
622
- maxLength,
623
- open,
624
- popoverElementRef,
625
- rawItems,
626
- space
627
- } = 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;
628
447
  if (maxLength && len > maxLength) {
629
448
  const beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2);
630
- let t1;
631
- if ($[0] !== afterLength || $[1] !== beforeLength || $[2] !== collapse || $[3] !== expand || $[4] !== expandElementRef || $[5] !== len || $[6] !== open || $[7] !== popoverElementRef || $[8] !== rawItems || $[9] !== space) {
632
- const t2 = rawItems.slice(0, beforeLength - 1);
633
- let t3;
634
- $[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];
635
- let t4;
636
- $[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];
637
- const t5 = open ? collapse : expand;
638
- let t6;
639
- $[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];
640
- let t7;
641
- $[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;
642
- } else
643
- t1 = $[10];
644
- 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)];
645
450
  }
646
451
  return rawItems;
647
452
  }
@@ -734,7 +539,7 @@ const StyledDialog = /* @__PURE__ */ styledComponents.styled(_visualEditing.Laye
734
539
  displayName: "DialogFooter",
735
540
  componentId: "sc-4n4xb3-6"
736
541
  })`position:relative;z-index:3;`, DialogCard = react.forwardRef(function(props, forwardedRef) {
737
- const $ = reactCompilerRuntime.c(44), {
542
+ const {
738
543
  __unstable_autoFocus: autoFocus,
739
544
  __unstable_hideCloseButton: hideCloseButton,
740
545
  children,
@@ -749,71 +554,36 @@ const StyledDialog = /* @__PURE__ */ styledComponents.styled(_visualEditing.Laye
749
554
  scheme,
750
555
  shadow: shadowProp,
751
556
  width: widthProp
752
- } = props, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element;
753
- let t0;
754
- $[0] !== radiusProp ? (t0 = _visualEditing._getArrayProp(radiusProp), $[0] = radiusProp, $[1] = t0) : t0 = $[1];
755
- const radius = t0;
756
- let t1;
757
- $[2] !== shadowProp ? (t1 = _visualEditing._getArrayProp(shadowProp), $[2] = shadowProp, $[3] = t1) : t1 = $[3];
758
- const shadow = t1;
759
- let t2;
760
- $[4] !== widthProp ? (t2 = _visualEditing._getArrayProp(widthProp), $[4] = widthProp, $[5] = t2) : t2 = $[5];
761
- const width = t2, 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(), {
762
558
  isTopLayer
763
559
  } = layer, labelId = `${id}_label`, showCloseButton = !!onClose && hideCloseButton === !1, showHeader = !!header || showCloseButton;
764
- let t3;
765
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => ref.current, $[6] = t3) : t3 = $[6], react.useImperativeHandle(forwardedRef, t3);
766
- let t4;
767
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => contentRef.current, $[7] = t4) : t4 = $[7], react.useImperativeHandle(forwardedContentRef, t4);
768
- let t5, t6;
769
- $[8] !== autoFocus ? (t5 = () => {
560
+ return react.useImperativeHandle(forwardedRef, () => ref.current), react.useImperativeHandle(forwardedContentRef, () => contentRef.current), react.useEffect(() => {
770
561
  autoFocus && ref.current && focusFirstDescendant(ref.current);
771
- }, t6 = [autoFocus, ref], $[8] = autoFocus, $[9] = t5, $[10] = t6) : (t5 = $[9], t6 = $[10]), react.useEffect(t5, t6);
772
- let t7;
773
- $[11] !== boundaryElement || $[12] !== isTopLayer || $[13] !== onClose || $[14] !== portalElement ? (t7 = (event) => {
774
- if (!isTopLayer || !onClose)
775
- return;
562
+ }, [autoFocus, ref]), _visualEditing.useGlobalKeyDown(react.useCallback((event) => {
563
+ if (!isTopLayer || !onClose) return;
776
564
  const target = document.activeElement;
777
565
  target && !isTargetWithinScope(boundaryElement, portalElement, target) || event.key === "Escape" && (event.preventDefault(), event.stopPropagation(), onClose());
778
- }, $[11] = boundaryElement, $[12] = isTopLayer, $[13] = onClose, $[14] = portalElement, $[15] = t7) : t7 = $[15], _visualEditing.useGlobalKeyDown(t7);
779
- let t8;
780
- $[16] !== boundaryElement || $[17] !== isTopLayer || $[18] !== onClickOutside || $[19] !== portalElement ? (t8 = isTopLayer && onClickOutside && ((event_0) => {
781
- const target_0 = event_0.target;
782
- target_0 && !isTargetWithinScope(boundaryElement, portalElement, target_0) || onClickOutside();
783
- }), $[16] = boundaryElement, $[17] = isTopLayer, $[18] = onClickOutside, $[19] = portalElement, $[20] = t8) : t8 = $[20];
784
- let t9;
785
- $[21] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => [ref.current], $[21] = t9) : t9 = $[21], _visualEditing.useClickOutsideEvent(t8, t9);
786
- let t10;
787
- $[22] !== header || $[23] !== labelId || $[24] !== onClose || $[25] !== showCloseButton || $[26] !== showHeader ? (t10 = showHeader && /* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { align: "flex-start", padding: 3, children: [
788
- /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
789
- 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 }) })
790
- ] }) }), $[22] = header, $[23] = labelId, $[24] = onClose, $[25] = showCloseButton, $[26] = showHeader, $[27] = t10) : t10 = $[27];
791
- let t11;
792
- $[28] !== children ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { flex: 1, ref: contentRef, tabIndex: -1, children }), $[28] = children, $[29] = t11) : t11 = $[29];
793
- let t12;
794
- $[30] !== footer ? (t12 = footer && /* @__PURE__ */ jsxRuntime.jsx(DialogFooter, { children: footer }), $[30] = footer, $[31] = t12) : t12 = $[31];
795
- let t13;
796
- $[32] !== t10 || $[33] !== t11 || $[34] !== t12 ? (t13 = /* @__PURE__ */ jsxRuntime.jsxs(DialogLayout, { direction: "column", children: [
797
- t10,
798
- t11,
799
- t12
800
- ] }), $[32] = t10, $[33] = t11, $[34] = t12, $[35] = t13) : t13 = $[35];
801
- let t14;
802
- $[36] !== radius || $[37] !== scheme || $[38] !== shadow || $[39] !== t13 ? (t14 = /* @__PURE__ */ jsxRuntime.jsx(DialogCardRoot, { radius, ref, scheme, shadow, children: t13 }), $[36] = radius, $[37] = scheme, $[38] = shadow, $[39] = t13, $[40] = t14) : t14 = $[40];
803
- let t15;
804
- return $[41] !== t14 || $[42] !== width ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(DialogContainer, { "data-ui": "DialogCard", width, children: t14 }), $[41] = t14, $[42] = width, $[43] = t15) : t15 = $[43], t15;
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
+ ] }) }) });
805
577
  });
806
578
  DialogCard.displayName = "ForwardRef(DialogCard)";
807
579
  const Dialog = react.forwardRef(function(props, ref) {
808
- const $ = reactCompilerRuntime.c(70), dialog = useDialog(), {
580
+ const dialog = useDialog(), {
809
581
  layer
810
- } = _visualEditing.useTheme_v2();
811
- let _positionProp, _zOffsetProp, children, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5, t6;
812
- $[0] !== props ? ({
813
- __unstable_autoFocus: t0,
814
- __unstable_hideCloseButton: t1,
815
- cardRadius: t2,
816
- cardShadow: t3,
582
+ } = _visualEditing.useTheme_v2(), {
583
+ __unstable_autoFocus: autoFocus = !0,
584
+ __unstable_hideCloseButton: hideCloseButton = !1,
585
+ cardRadius: cardRadiusProp = 4,
586
+ cardShadow = 3,
817
587
  children,
818
588
  contentRef,
819
589
  footer,
@@ -823,33 +593,15 @@ const Dialog = react.forwardRef(function(props, ref) {
823
593
  onClickOutside,
824
594
  onClose,
825
595
  onFocus,
826
- padding: t4,
596
+ padding: paddingProp = 3,
827
597
  portal: portalProp,
828
598
  position: _positionProp,
829
599
  scheme,
830
- width: t5,
600
+ width: widthProp = 0,
831
601
  zOffset: _zOffsetProp,
832
- animate: t6,
602
+ animate: _animate = !1,
833
603
  ...restProps
834
- } = 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]);
835
- 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;
836
- let t7;
837
- $[22] !== cardRadiusProp ? (t7 = _visualEditing._getArrayProp(cardRadiusProp), $[22] = cardRadiusProp, $[23] = t7) : t7 = $[23];
838
- const cardRadius = t7;
839
- let t8;
840
- $[24] !== paddingProp ? (t8 = _visualEditing._getArrayProp(paddingProp), $[24] = paddingProp, $[25] = t8) : t8 = $[25];
841
- const padding = t8;
842
- let t9;
843
- $[26] !== positionProp ? (t9 = _visualEditing._getArrayProp(positionProp), $[26] = positionProp, $[27] = t9) : t9 = $[27];
844
- const position = t9;
845
- let t10;
846
- $[28] !== widthProp ? (t10 = _visualEditing._getArrayProp(widthProp), $[28] = widthProp, $[29] = t10) : t10 = $[29];
847
- const width = t10;
848
- let t11;
849
- $[30] !== zOffsetProp ? (t11 = _visualEditing._getArrayProp(zOffsetProp), $[30] = zOffsetProp, $[31] = t11) : t11 = $[31];
850
- const zOffset = t11, preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
851
- let t12;
852
- $[32] !== onFocus ? (t12 = (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) => {
853
605
  onFocus?.(event);
854
606
  const target = event.target, cardElement = cardRef.current;
855
607
  if (cardElement && target === preDivRef.current) {
@@ -861,60 +613,43 @@ const Dialog = react.forwardRef(function(props, ref) {
861
613
  return;
862
614
  }
863
615
  _visualEditing.isHTMLElement(event.target) && (focusedElementRef.current = event.target);
864
- }, $[32] = onFocus, $[33] = t12) : t12 = $[33];
865
- const handleFocus = t12, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
866
- let t13;
867
- $[34] !== boundaryElement || $[35] !== portalElement ? (t13 = () => {
616
+ }, [onFocus]), labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0), handleRootClick = react.useCallback(() => {
868
617
  rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
869
618
  const activeElement = document.activeElement;
870
619
  if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
871
- const target_0 = focusedElementRef.current;
872
- if (!target_0 || !document.body.contains(target_0)) {
873
- const cardElement_0 = cardRef.current;
874
- 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);
875
624
  return;
876
625
  }
877
- target_0.focus();
626
+ target.focus();
878
627
  }
879
628
  }, 0);
880
- }, $[34] = boundaryElement, $[35] = portalElement, $[36] = t13) : t13 = $[36];
881
- const handleRootClick = t13;
882
- let t14;
883
- $[37] === Symbol.for("react.memo_cache_sentinel") ? (t14 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[37] = t14) : t14 = $[37];
884
- let t15;
885
- $[38] !== autoFocus || $[39] !== cardRadius || $[40] !== cardShadow || $[41] !== children || $[42] !== contentRef || $[43] !== footer || $[44] !== header || $[45] !== hideCloseButton || $[46] !== id || $[47] !== onClickOutside || $[48] !== onClose || $[49] !== portalProp || $[50] !== scheme || $[51] !== width ? (t15 = /* @__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 }), $[38] = autoFocus, $[39] = cardRadius, $[40] = cardShadow, $[41] = children, $[42] = contentRef, $[43] = footer, $[44] = header, $[45] = hideCloseButton, $[46] = id, $[47] = onClickOutside, $[48] = onClose, $[49] = portalProp, $[50] = scheme, $[51] = width, $[52] = t15) : t15 = $[52];
886
- let t16;
887
- $[53] === Symbol.for("react.memo_cache_sentinel") ? (t16 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[53] = t16) : t16 = $[53];
888
- let t17;
889
- $[54] !== animate || $[55] !== handleFocus || $[56] !== handleRootClick || $[57] !== id || $[58] !== labelId || $[59] !== onActivate || $[60] !== padding || $[61] !== position || $[62] !== ref || $[63] !== restProps || $[64] !== t15 || $[65] !== zOffset ? (t17 = /* @__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: [
890
- t14,
891
- t15,
892
- t16
893
- ] }), $[54] = animate, $[55] = handleFocus, $[56] = handleRootClick, $[57] = id, $[58] = labelId, $[59] = onActivate, $[60] = padding, $[61] = position, $[62] = ref, $[63] = restProps, $[64] = t15, $[65] = zOffset, $[66] = t17) : t17 = $[66];
894
- let t18;
895
- return $[67] !== portalProp || $[68] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Portal, { __unstable_name: portalProp, children: t17 }), $[67] = portalProp, $[68] = t17, $[69] = t18) : t18 = $[69], t18;
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
+ ] }) });
896
635
  });
897
636
  Dialog.displayName = "ForwardRef(Dialog)";
898
637
  function DialogProvider(props) {
899
- const $ = reactCompilerRuntime.c(6), {
638
+ const {
900
639
  children,
901
640
  position,
902
641
  zOffset
903
- } = props;
904
- let t0;
905
- $[0] !== position || $[1] !== zOffset ? (t0 = {
642
+ } = props, contextValue = react.useMemo(() => ({
906
643
  version: 0,
907
644
  position,
908
645
  zOffset
909
- }, $[0] = position, $[1] = zOffset, $[2] = t0) : t0 = $[2];
910
- const contextValue = t0;
911
- let t1;
912
- 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 });
913
648
  }
914
649
  DialogProvider.displayName = "DialogProvider";
915
650
  const MenuButton = react.forwardRef(function(props, forwardedRef) {
916
- const $ = reactCompilerRuntime.c(62), {
917
- __unstable_disableRestoreFocusOnClose: t0,
651
+ const {
652
+ __unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
918
653
  boundaryElement: deprecated_boundaryElement,
919
654
  button: buttonProp,
920
655
  id,
@@ -923,85 +658,52 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
923
658
  onOpen,
924
659
  placement: deprecated_placement,
925
660
  popoverScheme: deprecated_popoverScheme,
926
- portal: t1,
661
+ portal: deprecated_portal = !0,
927
662
  popover,
928
663
  popoverRadius: deprecated_popoverRadius,
929
664
  preventOverflow: deprecated_preventOverflow
930
- } = 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);
931
- let t2;
932
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
933
- const [menuElements, setChildMenuElements] = react.useState(t2), openRef = react.useRef(open);
934
- let t3, t4;
935
- $[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(() => {
936
667
  onOpen && open && !openRef.current && onOpen();
937
- }, t4 = [onOpen, open], $[1] = onOpen, $[2] = open, $[3] = t3, $[4] = t4) : (t3 = $[3], t4 = $[4]), react.useEffect(t3, t4);
938
- let t5, t6;
939
- $[5] !== onClose || $[6] !== open ? (t5 = () => {
668
+ }, [onOpen, open]), react.useEffect(() => {
940
669
  onClose && !open && openRef.current && onClose();
941
- }, t6 = [onClose, open], $[5] = onClose, $[6] = open, $[7] = t5, $[8] = t6) : (t5 = $[7], t6 = $[8]), react.useEffect(t5, t6);
942
- let t7, t8;
943
- $[9] !== open ? (t7 = () => {
670
+ }, [onClose, open]), react.useEffect(() => {
944
671
  openRef.current = open;
945
- }, t8 = [open], $[9] = open, $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]), react.useEffect(t7, t8);
946
- let t9;
947
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t9 = () => {
948
- setOpen(_temp$2), setShouldFocus(null);
949
- }, $[12] = t9) : t9 = $[12];
950
- const handleButtonClick = t9;
951
- let t10;
952
- $[13] !== open ? (t10 = (event) => {
672
+ }, [open]);
673
+ const handleButtonClick = react.useCallback(() => {
674
+ setOpen((v) => !v), setShouldFocus(null);
675
+ }, []), handleMouseDown = react.useCallback((event) => {
953
676
  open && event.preventDefault();
954
- }, $[13] = open, $[14] = t10) : t10 = $[14];
955
- const handleMouseDown = t10;
956
- let t11;
957
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
958
- if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
959
- 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");
960
680
  return;
961
681
  }
962
- if (event_0.key === "ArrowUp") {
963
- event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
682
+ if (event.key === "ArrowUp") {
683
+ event.preventDefault(), setOpen(!0), setShouldFocus("last");
964
684
  return;
965
685
  }
966
- }, $[15] = t11) : t11 = $[15];
967
- const handleButtonKeyDown = t11;
968
- let t12;
969
- $[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
970
- const target = event_1.target;
686
+ }, []), handleMenuClickOutside = react.useCallback((event) => {
687
+ const target = event.target;
971
688
  if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
972
689
  for (const el of menuElements)
973
690
  if (target === el || el.contains(target))
974
691
  return;
975
692
  setOpen(!1);
976
693
  }
977
- }, $[16] = buttonElement, $[17] = menuElements, $[18] = t12) : t12 = $[18];
978
- const handleMenuClickOutside = t12;
979
- let t13;
980
- $[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t13 = () => {
694
+ }, [buttonElement, menuElements]), handleMenuEscape = react.useCallback(() => {
981
695
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
982
- }, $[19] = buttonElement, $[20] = disableRestoreFocusOnClose, $[21] = t13) : t13 = $[21];
983
- const handleMenuEscape = t13;
984
- let t14;
985
- $[22] !== menuElements ? (t14 = (event_2) => {
986
- const target_0 = event_2.relatedTarget;
987
- if (target_0 instanceof Node) {
988
- for (const el_0 of menuElements)
989
- 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))
990
701
  return;
991
702
  setOpen(!1);
992
703
  }
993
- }, $[22] = menuElements, $[23] = t14) : t14 = $[23];
994
- const handleBlur = t14;
995
- let t15;
996
- $[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t15 = () => {
704
+ }, [menuElements]), handleItemClick = react.useCallback(() => {
997
705
  setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
998
- }, $[24] = buttonElement, $[25] = disableRestoreFocusOnClose, $[26] = t15) : t15 = $[26];
999
- const handleItemClick = t15;
1000
- let t16;
1001
- $[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];
1002
- const registerElement = t16;
1003
- let t17;
1004
- $[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, {
1005
707
  "aria-labelledby": id,
1006
708
  onBlurCapture: handleBlur,
1007
709
  onClickOutside: handleMenuClickOutside,
@@ -1010,10 +712,7 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
1010
712
  originElement: buttonElement,
1011
713
  registerElement,
1012
714
  shouldFocus
1013
- }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
1014
- const menu = t17;
1015
- let t18;
1016
- $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t18 = buttonProp && react.cloneElement(buttonProp, {
715
+ }), button = react.useMemo(() => buttonProp && react.cloneElement(buttonProp, {
1017
716
  "data-ui": "MenuButton",
1018
717
  id,
1019
718
  onClick: handleButtonClick,
@@ -1023,14 +722,9 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
1023
722
  "aria-expanded": open,
1024
723
  ref: setButtonElement,
1025
724
  selected: buttonProp.props.selected ?? open
1026
- }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t18) : t18 = $[41];
1027
- const button = t18;
1028
- let t19, t20;
1029
- $[42] !== buttonElement ? (t19 = () => buttonElement, t20 = [buttonElement], $[42] = buttonElement, $[43] = t19, $[44] = t20) : (t19 = $[43], t20 = $[44]), react.useImperativeHandle(forwardedRef, t19, t20);
1030
- let t21;
1031
- $[45] !== popover ? (t21 = popover || {}, $[45] = popover, $[46] = t21) : t21 = $[46];
1032
- let t22;
1033
- $[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(() => ({
1034
728
  boundaryElement: deprecated_boundaryElement,
1035
729
  overflow: "auto",
1036
730
  placement: deprecated_placement,
@@ -1038,18 +732,11 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
1038
732
  preventOverflow: deprecated_preventOverflow,
1039
733
  radius: deprecated_popoverRadius,
1040
734
  scheme: deprecated_popoverScheme,
1041
- ...t21
1042
- }, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_popoverRadius, $[50] = deprecated_popoverScheme, $[51] = deprecated_portal, $[52] = deprecated_preventOverflow, $[53] = t21, $[54] = t22) : t22 = $[54];
1043
- const popoverProps = t22;
1044
- let t23;
1045
- $[55] !== button ? (t23 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[55] = button, $[56] = t23) : t23 = $[56];
1046
- let t24;
1047
- 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, {}) });
1048
738
  });
1049
739
  MenuButton.displayName = "ForwardRef(MenuButton)";
1050
- function _temp$2(v) {
1051
- return !v;
1052
- }
1053
740
  const keyframe = styledComponents.keyframes`
1054
741
  0% {
1055
742
  background-position: 100%;
@@ -1094,17 +781,13 @@ const keyframe = styledComponents.keyframes`
1094
781
  displayName: "StyledSkeleton",
1095
782
  componentId: "sc-ebtpni-0"
1096
783
  })(_visualEditing.responsiveRadiusStyle, skeletonStyle), Skeleton = react.forwardRef(function(props, ref) {
1097
- const $ = reactCompilerRuntime.c(16);
1098
- let delay, radius, restProps, t0;
1099
- $[0] !== props ? ({
1100
- animated: t0,
784
+ const {
785
+ animated = !1,
1101
786
  delay,
1102
787
  radius,
1103
788
  ...restProps
1104
- } = props, $[0] = props, $[1] = delay, $[2] = radius, $[3] = restProps, $[4] = t0) : (delay = $[1], radius = $[2], restProps = $[3], t0 = $[4]);
1105
- const animated = t0 === void 0 ? !1 : t0, [visible, setVisible] = react.useState(!delay);
1106
- let t1, t2;
1107
- $[5] !== delay ? (t1 = () => {
789
+ } = props, [visible, setVisible] = react.useState(!delay);
790
+ return react.useEffect(() => {
1108
791
  if (!delay)
1109
792
  return;
1110
793
  const timeout = setTimeout(() => {
@@ -1113,12 +796,7 @@ const keyframe = styledComponents.keyframes`
1113
796
  return () => {
1114
797
  clearTimeout(timeout);
1115
798
  };
1116
- }, t2 = [delay], $[5] = delay, $[6] = t1, $[7] = t2) : (t1 = $[6], t2 = $[7]), react.useEffect(t1, t2);
1117
- let t3;
1118
- $[8] !== radius ? (t3 = _visualEditing._getArrayProp(radius), $[8] = radius, $[9] = t3) : t3 = $[9];
1119
- const t4 = delay ? visible : !0;
1120
- let t5;
1121
- return $[10] !== animated || $[11] !== ref || $[12] !== restProps || $[13] !== t3 || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton$1, { ...restProps, $animated: animated, $radius: t3, $visible: t4, ref }), $[10] = animated, $[11] = ref, $[12] = restProps, $[13] = t3, $[14] = t4, $[15] = t5) : t5 = $[15], t5;
799
+ }, [delay]), /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton$1, { ...restProps, $animated: animated, $radius: _visualEditing._getArrayProp(radius), $visible: delay ? visible : !0, ref });
1122
800
  });
1123
801
  Skeleton.displayName = "ForwardRef(Skeleton)";
1124
802
  const StyledSkeleton = /* @__PURE__ */ styledComponents.styled(Skeleton).withConfig({
@@ -1139,75 +817,43 @@ const StyledSkeleton = /* @__PURE__ */ styledComponents.styled(Skeleton).withCon
1139
817
  };
1140
818
  });
1141
819
  }), TextSkeleton = react.forwardRef(function(props, ref) {
1142
- const $ = reactCompilerRuntime.c(9);
1143
- let restProps, t0;
1144
- $[0] !== props ? ({
1145
- size: t0,
820
+ const {
821
+ size = 2,
1146
822
  ...restProps
1147
- } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
1148
- const size = t0 === void 0 ? 2 : t0;
1149
- let t1;
1150
- $[3] !== size ? (t1 = _visualEditing._getArrayProp(size), $[3] = size, $[4] = t1) : t1 = $[4];
1151
- const $size = t1;
1152
- let t2;
1153
- return $[5] !== $size || $[6] !== ref || $[7] !== restProps ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "text" }), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
823
+ } = props, $size = _visualEditing._getArrayProp(size);
824
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "text" });
1154
825
  });
1155
826
  TextSkeleton.displayName = "ForwardRef(TextSkeleton)";
1156
827
  const LabelSkeleton = react.forwardRef(function(props, ref) {
1157
- const $ = reactCompilerRuntime.c(9);
1158
- let restProps, t0;
1159
- $[0] !== props ? ({
1160
- size: t0,
828
+ const {
829
+ size = 2,
1161
830
  ...restProps
1162
- } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
1163
- const size = t0 === void 0 ? 2 : t0;
1164
- let t1;
1165
- $[3] !== size ? (t1 = _visualEditing._getArrayProp(size), $[3] = size, $[4] = t1) : t1 = $[4];
1166
- const $size = t1;
1167
- let t2;
1168
- return $[5] !== $size || $[6] !== ref || $[7] !== restProps ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "label" }), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
831
+ } = props, $size = _visualEditing._getArrayProp(size);
832
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "label" });
1169
833
  });
1170
834
  LabelSkeleton.displayName = "ForwardRef(LabelSkeleton)";
1171
835
  const HeadingSkeleton = react.forwardRef(function(props, ref) {
1172
- const $ = reactCompilerRuntime.c(9);
1173
- let restProps, t0;
1174
- $[0] !== props ? ({
1175
- size: t0,
836
+ const {
837
+ size = 2,
1176
838
  ...restProps
1177
- } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
1178
- const size = t0 === void 0 ? 2 : t0;
1179
- let t1;
1180
- $[3] !== size ? (t1 = _visualEditing._getArrayProp(size), $[3] = size, $[4] = t1) : t1 = $[4];
1181
- const $size = t1;
1182
- let t2;
1183
- return $[5] !== $size || $[6] !== ref || $[7] !== restProps ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "heading" }), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
839
+ } = props, $size = _visualEditing._getArrayProp(size);
840
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "heading" });
1184
841
  });
1185
842
  HeadingSkeleton.displayName = "ForwardRef(HeadingSkeleton)";
1186
843
  const CodeSkeleton = react.forwardRef(function(props, ref) {
1187
- const $ = reactCompilerRuntime.c(9);
1188
- let restProps, t0;
1189
- $[0] !== props ? ({
1190
- size: t0,
844
+ const {
845
+ size = 2,
1191
846
  ...restProps
1192
- } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]);
1193
- const size = t0 === void 0 ? 2 : t0;
1194
- let t1;
1195
- $[3] !== size ? (t1 = _visualEditing._getArrayProp(size), $[3] = size, $[4] = t1) : t1 = $[4];
1196
- const $size = t1;
1197
- let t2;
1198
- return $[5] !== $size || $[6] !== ref || $[7] !== restProps ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "code" }), $[5] = $size, $[6] = ref, $[7] = restProps, $[8] = t2) : t2 = $[8], t2;
847
+ } = props, $size = _visualEditing._getArrayProp(size);
848
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSkeleton, { ...restProps, $size, ref, $style: "code" });
1199
849
  });
1200
850
  CodeSkeleton.displayName = "ForwardRef(CodeSkeleton)";
1201
851
  const TabPanel = react.forwardRef(function(props, ref) {
1202
- const $ = reactCompilerRuntime.c(9);
1203
- let flex, restProps;
1204
- $[0] !== props ? ({
852
+ const {
1205
853
  flex,
1206
854
  ...restProps
1207
- } = props, $[0] = props, $[1] = flex, $[2] = restProps) : (flex = $[1], restProps = $[2]);
1208
- const t0 = props.tabIndex === void 0 ? 0 : props.tabIndex;
1209
- let t1;
1210
- 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 });
1211
857
  });
1212
858
  TabPanel.displayName = "ForwardRef(TabPanel)";
1213
859
  const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
@@ -1247,74 +893,46 @@ const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
1247
893
  info: "alert"
1248
894
  }, LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24;
1249
895
  function Toast(props) {
1250
- const $ = reactCompilerRuntime.c(50);
1251
- let closable, description, duration, onClose, restProps, status, t0, title, updatedAt;
1252
- $[0] !== props ? ({
896
+ const {
1253
897
  closable,
1254
898
  description,
1255
899
  duration,
1256
900
  onClose,
1257
- radius: t0,
901
+ radius = 3,
1258
902
  title,
1259
903
  status,
1260
904
  updatedAt,
1261
905
  ...restProps
1262
- } = 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]);
1263
- 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;
1264
- let t1;
1265
- $[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 ? {
1266
907
  type: "spring",
1267
908
  visualDuration,
1268
909
  bounce: 0.25
1269
910
  } : {
1270
911
  duration: 0
1271
- }, $[10] = visualDuration, $[11] = t1) : t1 = $[11];
1272
- const transition = t1, hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG;
1273
- let t2;
1274
- $[12] === Symbol.for("react.memo_cache_sentinel") ? (t2 = ["hidden", "initial"], $[12] = t2) : t2 = $[12];
1275
- const initial = t2;
1276
- let t3;
1277
- $[13] === Symbol.for("react.memo_cache_sentinel") ? (t3 = ["visible", "slideIn"], $[13] = t3) : t3 = $[13];
1278
- const animate = t3;
1279
- let t4;
1280
- $[14] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "slideOut"], $[14] = t4) : t4 = $[14];
1281
- const exit = t4, t5 = hasDuration ? "" : void 0;
1282
- let t6;
1283
- $[15] !== title ? (t6 = title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t6) : t6 = $[16];
1284
- let t7;
1285
- $[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];
1286
- let t8;
1287
- $[20] !== t6 || $[21] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(TextBox, { flex: 1, padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Stack, { space: 3, children: [
1288
- t6,
1289
- t7
1290
- ] }) }), $[20] = t6, $[21] = t7, $[22] = t8) : t8 = $[22];
1291
- let t9;
1292
- $[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: {
1293
- verticalAlign: "top"
1294
- } }) }), $[23] = buttonTone, $[24] = closable, $[25] = onClose, $[26] = t9) : t9 = $[26];
1295
- let t10;
1296
- $[27] !== t8 || $[28] !== t9 || $[29] !== transition ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
1297
- t8,
1298
- t9
1299
- ] }), $[27] = t8, $[28] = t9, $[29] = transition, $[30] = t10) : t10 = $[30];
1300
- let t11;
1301
- $[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: [
1302
- /* @__PURE__ */ jsxRuntime.jsx(LoadingBarMask, { tone: cardTone, radius }),
1303
- /* @__PURE__ */ jsxRuntime.jsx(MotionLoadingBarProgress, { tone: cardTone, initial: {
1304
- scaleX: 0
1305
- }, animate: {
1306
- scaleX: 1
1307
- }, transition: {
1308
- delay: visualDuration,
1309
- duration: duration / 1e3,
1310
- ease: "linear"
1311
- }, onAnimationComplete: onClose }, `progress-${updatedAt}`)
1312
- ] }), $[31] = cardTone, $[32] = duration, $[33] = hasDuration, $[34] = onClose, $[35] = radius, $[36] = transition, $[37] = updatedAt, $[38] = visualDuration, $[39] = t11) : t11 = $[39];
1313
- let t12;
1314
- 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: [
1315
- t10,
1316
- t11
1317
- ] }), $[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
+ ] });
1318
936
  }
1319
937
  Toast.displayName = "Toast";
1320
938
  const container = {
@@ -1356,32 +974,23 @@ const container = {
1356
974
  }
1357
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);
1358
976
  function useMounted() {
1359
- return react.useSyncExternalStore(subscribe, _temp$1, _temp2);
1360
- }
1361
- function _temp2() {
1362
- return !1;
1363
- }
1364
- function _temp$1() {
1365
- return !0;
977
+ return react.useSyncExternalStore(subscribe, () => !0, () => !1);
1366
978
  }
1367
979
  const subscribe = () => () => {
1368
980
  }, ToastContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/toast", null);
1369
981
  function ToastLayer(props) {
1370
- const $ = reactCompilerRuntime.c(9), {
982
+ const {
1371
983
  children,
1372
- padding: t0,
984
+ padding = 4,
1373
985
  paddingX,
1374
986
  paddingY,
1375
- gap: t1
1376
- } = props, padding = t0 === void 0 ? 4 : t0, gap = t1 === void 0 ? 3 : t1, {
987
+ gap = 3
988
+ } = props, {
1377
989
  zIndex
1378
990
  } = _visualEditing.useLayer();
1379
- let t2;
1380
- $[0] !== zIndex ? (t2 = {
991
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledLayer, { forwardedAs: "ul", "data-ui": "ToastProvider", padding, paddingX, paddingY, gap, columns: 1, style: {
1381
992
  zIndex
1382
- }, $[0] = zIndex, $[1] = t2) : t2 = $[1];
1383
- let t3;
1384
- 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 });
1385
994
  }
1386
995
  ToastLayer.displayName = "ToastLayer";
1387
996
  const StyledLayer = styledComponents.styled(_visualEditing.Grid).withConfig({
@@ -1393,19 +1002,14 @@ function generateToastId() {
1393
1002
  return String(toastId++);
1394
1003
  }
1395
1004
  function ToastProvider(props) {
1396
- const $ = reactCompilerRuntime.c(13), {
1005
+ const {
1397
1006
  children,
1398
1007
  padding,
1399
1008
  paddingX,
1400
1009
  paddingY,
1401
1010
  gap,
1402
- zOffset: t0
1403
- } = props, zOffset = t0 === void 0 ? 1 : t0;
1404
- let t1;
1405
- $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
1406
- const [state, setState] = react.useState(t1), mounted = useMounted();
1407
- let t2;
1408
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
1011
+ zOffset = 1
1012
+ } = props, [state, setState] = react.useState([]), mounted = useMounted(), value = react.useMemo(() => ({
1409
1013
  version: 0,
1410
1014
  push: (params) => {
1411
1015
  const id = params.id || generateToastId(), duration = params.duration || 5e3;
@@ -1413,8 +1017,8 @@ function ToastProvider(props) {
1413
1017
  setState((prevState) => {
1414
1018
  if (duration === 0.01)
1415
1019
  return prevState.filter((toast) => toast.id !== id);
1416
- const dismiss = () => react.startTransition(() => setState((currentState) => currentState.filter((toast_0) => toast_0.id !== id)));
1417
- 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), {
1418
1022
  dismiss,
1419
1023
  id,
1420
1024
  updatedAt: Date.now(),
@@ -1426,24 +1030,16 @@ function ToastProvider(props) {
1426
1030
  });
1427
1031
  }), id;
1428
1032
  }
1429
- }, $[1] = t2) : t2 = $[1];
1430
- const value = t2;
1431
- let t3;
1432
- $[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];
1433
- let t4;
1434
- return $[10] !== children || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
1033
+ }), []);
1034
+ return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
1435
1035
  children,
1436
- t3
1437
- ] }), $[10] = children, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
1438
- }
1439
- function _temp(t0) {
1440
- const {
1441
- dismiss: dismiss_0,
1442
- id: id_0,
1443
- params: params_0,
1444
- updatedAt
1445
- } = t0;
1446
- 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
+ ] });
1447
1043
  }
1448
1044
  ToastProvider.displayName = "ToastProvider";
1449
1045
  function useToast() {
@@ -1509,68 +1105,44 @@ function _focusItemElement(el) {
1509
1105
  }
1510
1106
  }
1511
1107
  const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/tree", null), Tree = react.forwardRef(function(props, forwardedRef) {
1512
- const $ = reactCompilerRuntime.c(37);
1513
- let children, onFocus, restProps, t0;
1514
- $[0] !== props ? ({
1108
+ const {
1515
1109
  children,
1516
- space: t0,
1110
+ space = 1,
1517
1111
  onFocus,
1518
1112
  ...restProps
1519
- } = props, $[0] = props, $[1] = children, $[2] = onFocus, $[3] = restProps, $[4] = t0) : (children = $[1], onFocus = $[2], restProps = $[3], t0 = $[4]);
1520
- const space = t0 === void 0 ? 1 : t0, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
1521
- let t1;
1522
- $[5] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[5] = t1) : t1 = $[5];
1523
- const path = t1;
1524
- let t2;
1525
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[6] = t2) : t2 = $[6];
1526
- const [itemElements, setItemElements] = react.useState(t2);
1527
- let t3;
1528
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[7] = t3) : t3 = $[7];
1529
- const [state, setState] = react.useState(t3), stateRef = react.useRef(state);
1530
- let t4;
1531
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[8] = t4) : t4 = $[8], react.useImperativeHandle(forwardedRef, t4);
1532
- let t5, t6;
1533
- $[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(() => {
1534
1115
  focusedElementRef.current = focusedElement;
1535
- }, t6 = [focusedElement], $[9] = focusedElement, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), react.useEffect(t5, t6);
1536
- let t7, t8;
1537
- $[12] !== state ? (t7 = () => {
1116
+ }, [focusedElement]), react.useEffect(() => {
1538
1117
  stateRef.current = state;
1539
- }, t8 = [state], $[12] = state, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useEffect(t7, t8);
1540
- let t9;
1541
- $[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) => ({
1542
1120
  ...s,
1543
- [path_0]: {
1121
+ [path2]: {
1544
1122
  element,
1545
1123
  expanded
1546
1124
  }
1547
1125
  })), selected && setFocusedElement(element), () => {
1548
- setState((s_0) => {
1126
+ setState((s) => {
1549
1127
  const newState = {
1550
- ...s_0
1128
+ ...s
1551
1129
  };
1552
- return delete newState[path_0], newState;
1130
+ return delete newState[path2], newState;
1553
1131
  });
1554
- }), $[15] = t9) : t9 = $[15];
1555
- const registerItem = t9;
1556
- let t10;
1557
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (path_1, expanded_0) => {
1558
- setState((s_1) => {
1559
- const itemState = s_1[path_1];
1132
+ }), []), setExpanded = react.useCallback((path2, expanded) => {
1133
+ setState((s) => {
1134
+ const itemState = s[path2];
1560
1135
  return itemState ? {
1561
- ...s_1,
1562
- [path_1]: {
1136
+ ...s,
1137
+ [path2]: {
1563
1138
  ...itemState,
1564
- expanded: expanded_0
1139
+ expanded
1565
1140
  }
1566
- } : s_1;
1141
+ } : s;
1567
1142
  });
1568
- }, $[16] = t10) : t10 = $[16];
1569
- const setExpanded = t10, t11 = focusedElement || itemElements[0] || null;
1570
- let t12;
1571
- $[17] !== space || $[18] !== state || $[19] !== t11 ? (t12 = {
1143
+ }, []), contextValue = react.useMemo(() => ({
1572
1144
  version: 0,
1573
- focusedElement: t11,
1145
+ focusedElement: focusedElement || itemElements[0] || null,
1574
1146
  level: 0,
1575
1147
  path,
1576
1148
  registerItem,
@@ -1578,10 +1150,7 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1578
1150
  setFocusedElement,
1579
1151
  space,
1580
1152
  state
1581
- }, $[17] = space, $[18] = state, $[19] = t11, $[20] = t12) : t12 = $[20];
1582
- const contextValue = t12;
1583
- let t13;
1584
- $[21] !== itemElements ? (t13 = (event) => {
1153
+ }), [focusedElement, itemElements, path, registerItem, setExpanded, space, state]), handleKeyDown = react.useCallback((event) => {
1585
1154
  if (focusedElementRef.current) {
1586
1155
  if (event.key === "ArrowDown") {
1587
1156
  event.preventDefault();
@@ -1598,21 +1167,19 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1598
1167
  if (event.key === "ArrowLeft") {
1599
1168
  event.preventDefault();
1600
1169
  const itemKey = focusedElementRef.current.getAttribute("data-tree-key");
1601
- if (!itemKey)
1602
- return;
1603
- const itemState_0 = stateRef.current[itemKey];
1604
- if (!itemState_0)
1605
- return;
1606
- if (itemState_0.expanded)
1607
- setState((s_2) => {
1608
- const itemState_1 = s_2[itemKey];
1609
- return itemState_1 ? {
1610
- ...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,
1611
1178
  [itemKey]: {
1612
- ...itemState_1,
1179
+ ...itemState2,
1613
1180
  expanded: !1
1614
1181
  }
1615
- } : s_2;
1182
+ } : s;
1616
1183
  });
1617
1184
  else {
1618
1185
  const itemPath = itemKey.split("/");
@@ -1625,41 +1192,28 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1625
1192
  if (event.key === "ArrowRight") {
1626
1193
  event.preventDefault();
1627
1194
  const focusedKey = focusedElementRef.current.getAttribute("data-tree-key");
1628
- if (!focusedKey)
1629
- return;
1630
- stateRef.current[focusedKey]?.expanded || setState((s_3) => {
1631
- const itemState_2 = s_3[focusedKey];
1632
- return itemState_2 ? {
1633
- ...s_3,
1195
+ if (!focusedKey) return;
1196
+ stateRef.current[focusedKey]?.expanded || setState((s) => {
1197
+ const itemState = s[focusedKey];
1198
+ return itemState ? {
1199
+ ...s,
1634
1200
  [focusedKey]: {
1635
- ...itemState_2,
1201
+ ...itemState,
1636
1202
  expanded: !0
1637
1203
  }
1638
- } : s_3;
1204
+ } : s;
1639
1205
  });
1640
1206
  return;
1641
1207
  }
1642
1208
  }
1643
- }, $[21] = itemElements, $[22] = t13) : t13 = $[22];
1644
- const handleKeyDown = t13;
1645
- let t14;
1646
- $[23] !== onFocus ? (t14 = (event_0) => {
1647
- setFocusedElement(event_0.target), onFocus?.(event_0);
1648
- }, $[23] = onFocus, $[24] = t14) : t14 = $[24];
1649
- const handleFocus = t14;
1650
- let t15;
1651
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => {
1652
- if (!ref.current)
1653
- return;
1209
+ }, [itemElements]), handleFocus = react.useCallback((event) => {
1210
+ setFocusedElement(event.target), onFocus?.(event);
1211
+ }, [onFocus]);
1212
+ return react.useEffect(() => {
1213
+ if (!ref.current) return;
1654
1214
  const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
1655
1215
  setItemElements(_itemElements);
1656
- }, $[25] = t15) : t15 = $[25];
1657
- let t16;
1658
- $[26] !== children ? (t16 = [children], $[26] = children, $[27] = t16) : t16 = $[27], react.useEffect(t15, t16);
1659
- let t17;
1660
- $[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];
1661
- let t18;
1662
- 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 }) });
1663
1217
  });
1664
1218
  Tree.displayName = "ForwardRef(Tree)";
1665
1219
  function treeItemRootStyle() {
@@ -1761,16 +1315,12 @@ function useTree() {
1761
1315
  return tree;
1762
1316
  }
1763
1317
  function TreeGroup(props) {
1764
- const $ = reactCompilerRuntime.c(9);
1765
- let children, restProps, t0;
1766
- $[0] !== props ? ({
1318
+ const {
1767
1319
  children,
1768
- expanded: t0,
1320
+ expanded = !1,
1769
1321
  ...restProps
1770
- } = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0) : (children = $[1], restProps = $[2], t0 = $[3]);
1771
- const expanded = t0 === void 0 ? !1 : t0, tree = useTree(), t1 = !expanded;
1772
- let t2;
1773
- 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 });
1774
1324
  }
1775
1325
  const StyledTreeItem = /* @__PURE__ */ styledComponents.styled.li.withConfig({
1776
1326
  displayName: "StyledTreeItem",
@@ -1785,115 +1335,64 @@ const StyledTreeItem = /* @__PURE__ */ styledComponents.styled.li.withConfig({
1785
1335
  componentId: "sc-iiskig-2"
1786
1336
  })`& > svg{transition:transform 100ms;}`;
1787
1337
  function TreeItem(props) {
1788
- const $ = reactCompilerRuntime.c(112);
1789
- let IconComponent, children, href, idProp, linkAs, muted, onClick, restProps, t0, t1, t2, t3, t4, text, weight;
1790
- $[0] !== props ? ({
1338
+ const {
1791
1339
  children,
1792
- expanded: t0,
1793
- fontSize: t1,
1340
+ expanded: expandedProp = !1,
1341
+ fontSize = 1,
1794
1342
  href,
1795
1343
  icon: IconComponent,
1796
1344
  id: idProp,
1797
1345
  linkAs,
1798
1346
  muted,
1799
1347
  onClick,
1800
- padding: t2,
1801
- selected: t3,
1802
- space: t4,
1348
+ padding = 2,
1349
+ selected = !1,
1350
+ space = 2,
1803
1351
  text,
1804
1352
  weight,
1805
1353
  ...restProps
1806
- } = 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]);
1807
- 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(), {
1808
1355
  path,
1809
1356
  registerItem,
1810
1357
  setExpanded,
1811
1358
  setFocusedElement
1812
- } = tree, _id = react.useId(), id = idProp || _id;
1813
- let t5, t6;
1814
- if ($[16] !== id || $[17] !== path) {
1815
- const itemPath = path.concat([id || ""]);
1816
- t5 = itemPath, t6 = itemPath.join("/"), $[16] = id, $[17] = path, $[18] = t5, $[19] = t6;
1817
- } else
1818
- t5 = $[18], t6 = $[19];
1819
- let t7;
1820
- $[20] !== t5 || $[21] !== t6 ? (t7 = [t5, t6], $[20] = t5, $[21] = t6, $[22] = t7) : t7 = $[22];
1821
- 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;
1822
- let t9;
1823
- $[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(() => ({
1824
1363
  ...tree,
1825
- level: t8,
1826
- path: itemPath_0
1827
- }, $[23] = itemPath_0, $[24] = t8, $[25] = tree, $[26] = t9) : t9 = $[26];
1828
- const contextValue = t9;
1829
- let t10;
1830
- $[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) => {
1831
1367
  onClick && onClick(event);
1832
1368
  const target = event.target;
1833
1369
  target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
1834
- }, $[27] = expanded, $[28] = itemKey, $[29] = onClick, $[30] = rootElement, $[31] = setExpanded, $[32] = setFocusedElement, $[33] = t10) : t10 = $[33];
1835
- const handleClick = t10;
1836
- let t11;
1837
- $[34] !== focused || $[35] !== rootElement ? (t11 = (event_0) => {
1838
- focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
1839
- }, $[34] = focused, $[35] = rootElement, $[36] = t11) : t11 = $[36];
1840
- const handleKeyDown = t11;
1841
- let t12, t13;
1842
- $[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(() => {
1843
1374
  if (rootElement)
1844
1375
  return registerItem(rootElement, itemKey, expanded, selected);
1845
- }, 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);
1846
- const t14 = IconComponent || children ? "visible" : "hidden";
1847
- let t15;
1848
- $[44] !== t14 ? (t15 = {
1849
- visibility: t14,
1850
- pointerEvents: "none"
1851
- }, $[44] = t14, $[45] = t15) : t15 = $[45];
1852
- let t16;
1853
- $[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];
1854
- let t17;
1855
- $[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: {
1856
- transform: expanded ? "rotate(90deg)" : void 0
1857
- } }) }), $[51] = IconComponent, $[52] = expanded, $[53] = fontSize, $[54] = muted, $[55] = weight, $[56] = t17) : t17 = $[56];
1858
- let t18;
1859
- $[57] !== space || $[58] !== t15 || $[59] !== t16 || $[60] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { marginRight: space, style: t15, children: [
1860
- t16,
1861
- t17
1862
- ] }), $[57] = space, $[58] = t15, $[59] = t16, $[60] = t17, $[61] = t18) : t18 = $[61];
1863
- let t19;
1864
- $[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];
1865
- let t20;
1866
- $[67] !== padding || $[68] !== t18 || $[69] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { padding, children: [
1867
- t18,
1868
- t19
1869
- ] }), $[67] = padding, $[68] = t18, $[69] = t19, $[70] = t20) : t20 = $[70];
1870
- const content2 = t20;
1871
- if (href) {
1872
- const t212 = selected ? "" : void 0;
1873
- let t222;
1874
- $[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];
1875
- let t232;
1876
- $[78] !== children || $[79] !== expanded ? (t232 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }), $[78] = children, $[79] = expanded, $[80] = t232) : t232 = $[80];
1877
- let t242;
1878
- $[81] !== contextValue || $[82] !== t232 ? (t242 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t232 }), $[81] = contextValue, $[82] = t232, $[83] = t242) : t242 = $[83];
1879
- let t252;
1880
- 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: [
1881
- t222,
1882
- t242
1883
- ] }), $[84] = handleClick, $[85] = id, $[86] = itemKey, $[87] = restProps, $[88] = t212, $[89] = t222, $[90] = t242, $[91] = t252) : t252 = $[91], t252;
1884
- }
1885
- const t21 = selected ? "" : void 0;
1886
- let t22;
1887
- $[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];
1888
- let t23;
1889
- $[95] !== children || $[96] !== expanded ? (t23 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }), $[95] = children, $[96] = expanded, $[97] = t23) : t23 = $[97];
1890
- let t24;
1891
- $[98] !== contextValue || $[99] !== t23 ? (t24 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t23 }), $[98] = contextValue, $[99] = t23, $[100] = t24) : t24 = $[100];
1892
- let t25;
1893
- 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: [
1894
- t22,
1895
- t24
1896
- ] }), $[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
+ ] });
1897
1396
  }
1898
1397
  TreeItem.displayName = "TreeItem";
1899
1398
  exports.Arrow = _visualEditing.Arrow;