@sanity/ui 3.0.13 → 3.0.15-canary.0

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