@sanity/ui 3.0.14 → 3.0.15-canary.0

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