@sanity/ui 2.9.0-canary.0 → 2.9.0-canary.1

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.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { buildTheme, createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, getTheme_v2, getScopedTheme } from "@sanity/ui/theme";
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import { c } from "react-compiler-runtime";
4
- import { useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, useMemo, forwardRef, useId, Children, isValidElement, cloneElement, useCallback, Component, memo, useLayoutEffect, useReducer, Fragment as Fragment$1, startTransition } from "react";
4
+ import { useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, createContext, useContext, forwardRef, useId, Children, isValidElement, cloneElement, useMemo, useCallback, Component, memo, useLayoutEffect, useReducer, Fragment as Fragment$1, startTransition } from "react";
5
5
  import ReactIs, { isValidElementType } from "react-is";
6
6
  import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
7
7
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon, ToggleArrowRightIcon } from "@sanity/icons";
@@ -208,7 +208,7 @@ function useClickOutside(listener, t0, boundaryElement) {
208
208
  }, t5 = [boundaryElement, listener, elements], $[7] = listener, $[8] = boundaryElement, $[9] = elements, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), useEffect(t4, t5), setElement;
209
209
  }
210
210
  function useClickOutsideEvent(listener, t0, boundaryElement) {
211
- const $ = c(8), elementsArg = t0 === void 0 ? _temp$5 : t0;
211
+ const $ = c(8), elementsArg = t0 === void 0 ? _temp$6 : t0;
212
212
  let t1;
213
213
  $[0] !== listener || $[1] !== boundaryElement || $[2] !== elementsArg ? (t1 = (evt) => {
214
214
  if (!listener)
@@ -236,7 +236,7 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
236
236
  };
237
237
  }, t3 = [hasListener, onEvent], $[4] = hasListener, $[5] = onEvent, $[6] = t2, $[7] = t3) : (t2 = $[6], t3 = $[7]), useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
238
238
  }
239
- function _temp$5() {
239
+ function _temp$6() {
240
240
  return EMPTY_ARRAY;
241
241
  }
242
242
  function useCustomValidity(ref, customValidity) {
@@ -622,18 +622,42 @@ function createGlobalScopedContext(key2, defaultValue) {
622
622
  }
623
623
  const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
624
624
  function ThemeProvider(props) {
625
- const parentTheme = useContext(ThemeContext), {
626
- children,
627
- scheme = parentTheme?.scheme || "light",
628
- theme: rootTheme = parentTheme?.theme || null,
629
- tone = parentTheme?.tone || "default"
630
- } = props, themeContext = useMemo(() => rootTheme ? {
631
- version: 0,
632
- theme: rootTheme,
633
- scheme,
634
- tone
635
- } : null, [rootTheme, scheme, tone]), theme = useMemo(() => rootTheme ? getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
636
- return theme ? /* @__PURE__ */ jsx(ThemeContext.Provider, { value: themeContext, children: /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children }) }) : /* @__PURE__ */ jsx("pre", { children: 'ThemeProvider: no "theme" property provided' });
625
+ const $ = c(15), parentTheme = useContext(ThemeContext), {
626
+ children
627
+ } = props, scheme = props.scheme ?? (parentTheme?.scheme || "light"), rootTheme = props.theme ?? (parentTheme?.theme || null), tone = props.tone ?? (parentTheme?.tone || "default");
628
+ let t0;
629
+ bb0: {
630
+ if (!rootTheme) {
631
+ t0 = null;
632
+ break bb0;
633
+ }
634
+ let t12;
635
+ $[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t12 = {
636
+ version: 0,
637
+ theme: rootTheme,
638
+ scheme,
639
+ tone
640
+ }, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t12) : t12 = $[3], t0 = t12;
641
+ }
642
+ const themeContext = t0;
643
+ let t1;
644
+ bb1: {
645
+ if (!rootTheme) {
646
+ t1 = null;
647
+ break bb1;
648
+ }
649
+ let t22;
650
+ $[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t22 = getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t22) : t22 = $[7], t1 = t22;
651
+ }
652
+ const theme = t1;
653
+ if (!theme) {
654
+ let t22;
655
+ return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t22 = /* @__PURE__ */ jsx("pre", { children: 'ThemeProvider: no "theme" property provided' }), $[8] = t22) : t22 = $[8], t22;
656
+ }
657
+ let t2;
658
+ $[9] !== theme || $[10] !== children ? (t2 = /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children }), $[9] = theme, $[10] = children, $[11] = t2) : t2 = $[11];
659
+ let t3;
660
+ return $[12] !== themeContext || $[13] !== t2 ? (t3 = /* @__PURE__ */ jsx(ThemeContext.Provider, { value: themeContext, children: t2 }), $[12] = themeContext, $[13] = t2, $[14] = t3) : t3 = $[14], t3;
637
661
  }
638
662
  ThemeProvider.displayName = "ThemeProvider";
639
663
  function useRootTheme() {
@@ -718,15 +742,15 @@ function useMediaIndex() {
718
742
  return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
719
743
  }
720
744
  function usePrefersDark(t0) {
721
- return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$4 : t0);
745
+ return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$5 : t0);
722
746
  }
723
- function _temp$4() {
747
+ function _temp$5() {
724
748
  return !1;
725
749
  }
726
750
  function usePrefersReducedMotion(t0) {
727
- return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$3 : t0);
751
+ return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$4 : t0);
728
752
  }
729
- function _temp$3() {
753
+ function _temp$4() {
730
754
  return !1;
731
755
  }
732
756
  function responsiveBorderStyle() {
@@ -1759,19 +1783,26 @@ function responsiveAvatarStackSizeStyle(props) {
1759
1783
  });
1760
1784
  }
1761
1785
  const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), AvatarStack = forwardRef(function(props, ref) {
1762
- const {
1786
+ const $ = c(15);
1787
+ let t0, t1, childrenProp, restProps;
1788
+ $[0] !== props ? ({
1763
1789
  children: childrenProp,
1764
- maxLength: maxLengthProp = 4,
1765
- size: sizeProp = 1,
1790
+ maxLength: t0,
1791
+ size: t1,
1766
1792
  ...restProps
1767
- } = props, children = useMemo(() => Children.toArray(childrenProp).filter(isValidElement), [childrenProp]), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
1768
- return /* @__PURE__ */ jsxs(Root$z, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
1769
- len === 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: len, size: size2 }) }),
1770
- len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
1771
- visibleChildren.map((child, childIndex) => /* @__PURE__ */ jsx("div", { children: cloneElement(child, {
1772
- size: size2
1773
- }) }, String(childIndex)))
1774
- ] });
1793
+ } = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = childrenProp, $[4] = restProps) : (t0 = $[1], t1 = $[2], childrenProp = $[3], restProps = $[4]);
1794
+ const maxLengthProp = t0 === void 0 ? 4 : t0, sizeProp = t1 === void 0 ? 1 : t1, children = Children.toArray(childrenProp).filter(isValidElement), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children, T0 = Root$z, t2 = "AvatarStack", t3 = len === 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: len, size: size2 }) }), t4 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 }) });
1795
+ let t5;
1796
+ $[5] !== size2 ? (t5 = (child, childIndex) => /* @__PURE__ */ jsx("div", { children: cloneElement(child, {
1797
+ size: size2
1798
+ }) }, String(childIndex)), $[5] = size2, $[6] = t5) : t5 = $[6];
1799
+ const t6 = visibleChildren.map(t5);
1800
+ let t7;
1801
+ return $[7] !== T0 || $[8] !== restProps || $[9] !== ref || $[10] !== size2 || $[11] !== t3 || $[12] !== t4 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsxs(T0, { "data-ui": t2, ...restProps, ref, $size: size2, children: [
1802
+ t3,
1803
+ t4,
1804
+ t6
1805
+ ] }), $[7] = T0, $[8] = restProps, $[9] = ref, $[10] = size2, $[11] = t3, $[12] = t4, $[13] = t6, $[14] = t7) : t7 = $[14], t7;
1775
1806
  });
1776
1807
  AvatarStack.displayName = "ForwardRef(AvatarStack)";
1777
1808
  const Root$y = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = forwardRef(function(props, ref) {
@@ -3192,9 +3223,9 @@ function findMinBreakpoints(media, width) {
3192
3223
  const ElementQuery = forwardRef(function(props, forwardedRef) {
3193
3224
  const theme = useTheme_v2(), {
3194
3225
  children,
3195
- media = theme.media,
3226
+ media: _media,
3196
3227
  ...restProps
3197
- } = props, ref = useRef(null), [element, setElement] = useState(null), elementSize = useElementSize(element), width = useMemo(() => elementSize?.border.width ?? window.innerWidth, [elementSize]), max = useMemo(() => findMaxBreakpoints(media, width), [media, width]), min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
3228
+ } = props, media = _media ?? theme.media, ref = useRef(null), [element, setElement] = useState(null), elementSize = useElementSize(element), width = useMemo(() => elementSize?.border.width ?? window.innerWidth, [elementSize]), max = useMemo(() => findMaxBreakpoints(media, width), [media, width]), min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
3198
3229
  useImperativeHandle(forwardedRef, () => ref.current);
3199
3230
  const setRef = useCallback((el) => {
3200
3231
  ref.current = el, setElement(el);
@@ -3445,7 +3476,7 @@ function PortalProvider(props) {
3445
3476
  children,
3446
3477
  element,
3447
3478
  __unstable_elements: elementsProp
3448
- } = props, elements = useUnique(elementsProp), fallbackElement = useSyncExternalStore(emptySubscribe, _temp$2, _temp2$1);
3479
+ } = props, elements = useUnique(elementsProp), fallbackElement = useSyncExternalStore(emptySubscribe, _temp$3, _temp2$1);
3449
3480
  let t0;
3450
3481
  const t1 = boundaryElement || null, t2 = element || fallbackElement;
3451
3482
  let t3;
@@ -3462,7 +3493,7 @@ function PortalProvider(props) {
3462
3493
  function _temp2$1() {
3463
3494
  return null;
3464
3495
  }
3465
- function _temp$2() {
3496
+ function _temp$3() {
3466
3497
  return document.body;
3467
3498
  }
3468
3499
  PortalProvider.displayName = "PortalProvider";
@@ -3778,14 +3809,14 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
3778
3809
  __unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
3779
3810
  animate: _animate = !1,
3780
3811
  arrow: arrowProp = !1,
3781
- boundaryElement = boundaryElementContext.element,
3812
+ boundaryElement: _boundaryElement,
3782
3813
  children: childProp,
3783
3814
  constrainSize = !1,
3784
3815
  content,
3785
3816
  disabled,
3786
- fallbackPlacements = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"],
3817
+ fallbackPlacements: _fallbackPlacements,
3787
3818
  matchReferenceWidth,
3788
- floatingBoundary = props.boundaryElement ?? boundaryElementContext.element,
3819
+ floatingBoundary: _floatingBoundary,
3789
3820
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
3790
3821
  onActivate,
3791
3822
  open,
@@ -3795,16 +3826,16 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
3795
3826
  portal,
3796
3827
  preventOverflow = !0,
3797
3828
  radius: radiusProp = 3,
3798
- referenceBoundary = props.boundaryElement ?? boundaryElementContext.element,
3829
+ referenceBoundary: _referenceBoundary,
3799
3830
  referenceElement,
3800
3831
  scheme,
3801
3832
  shadow: shadowProp = 3,
3802
3833
  tone = "inherit",
3803
3834
  width: widthProp = "auto",
3804
- zOffset: zOffsetProp = layer.popover.zOffset,
3835
+ zOffset: _zOffsetProp,
3805
3836
  updateRef,
3806
3837
  ...restProps
3807
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
3838
+ } = props, boundaryElement = _boundaryElement ?? boundaryElementContext.element, fallbackPlacements = _fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS$1[props.placement ?? "bottom"], floatingBoundary = _floatingBoundary ?? boundaryElement ?? boundaryElementContext.element, referenceBoundary = _referenceBoundary ?? boundaryElement ?? boundaryElementContext.element, zOffsetProp = _zOffsetProp ?? layer.popover.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), shadow = useArrayProp(shadowProp), widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
3808
3839
  useImperativeHandle(forwardedRef, () => ref.current);
3809
3840
  const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
3810
3841
  container,
@@ -3822,11 +3853,11 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
3822
3853
  maxWidthRef.current = maxWidth;
3823
3854
  }, [maxWidth]);
3824
3855
  const referenceWidthRef = useRef();
3825
- useEffect(() => {
3856
+ useLayoutEffect(() => {
3826
3857
  const floatingElement = ref.current;
3827
3858
  if (!open || !floatingElement) return;
3828
3859
  const referenceWidth = referenceWidthRef.current;
3829
- matchReferenceWidth ? referenceWidth !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
3860
+ matchReferenceWidth ? referenceWidthRef.current !== void 0 && (floatingElement.style.width = `${referenceWidth}px`) : width !== void 0 && (floatingElement.style.width = `${width}px`), typeof maxWidth == "number" && (floatingElement.style.maxWidth = `${maxWidth}px`);
3830
3861
  }, [width, matchReferenceWidth, maxWidth, open]);
3831
3862
  const middleware = useMemo(() => {
3832
3863
  const ret = [];
@@ -3881,16 +3912,14 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
3881
3912
  arrowRef.current = arrowEl;
3882
3913
  }, []), setFloating = useCallback((node) => {
3883
3914
  ref.current = node, refs.setFloating(node);
3884
- }, [refs]), setReference = useCallback((node_0) => {
3885
- refs.setReference(node_0);
3886
- const childRef = getElementRef(childProp);
3887
- typeof childRef == "function" ? childRef(node_0) : childRef && (childRef.current = node_0);
3888
- }, [childProp, refs]), child = useMemo(() => !childProp || referenceElement ? null : cloneElement(childProp, {
3915
+ }, [refs]), [childElement, setChildElement] = useState(null), setReference = useCallback((node_0) => {
3916
+ refs.setReference(node_0), setChildElement(node_0);
3917
+ }, [refs]);
3918
+ useImperativeHandle(getElementRef(childProp), () => childElement, [childElement]);
3919
+ const child = useMemo(() => !childProp || referenceElement ? null : cloneElement(childProp, {
3889
3920
  ref: setReference
3890
3921
  }), [childProp, referenceElement, setReference]);
3891
- if (useEffect(() => {
3892
- updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
3893
- }, [update, updateRef]), useEffect(() => {
3922
+ if (useImperativeHandle(updateRef, () => update, [update]), useEffect(() => {
3894
3923
  child || refs.setReference(referenceElement || null);
3895
3924
  }, [referenceElement, refs, child]), disabled)
3896
3925
  return childProp || /* @__PURE__ */ jsx(Fragment, {});
@@ -4551,7 +4580,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
4551
4580
  const border2 = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSizeProp = t2 === void 0 ? 2 : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, spaceProp = t5 === void 0 ? 3 : t5, type = t6 === void 0 ? "text" : t6, ref = useRef(null), rootTheme = useRootTheme(), fontSize2 = useArrayProp(fontSizeProp), padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), space = useArrayProp(spaceProp), $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix;
4552
4581
  let t7;
4553
4582
  $[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
4554
- const handleClearMouseDown = _temp$1;
4583
+ const handleClearMouseDown = _temp$2;
4555
4584
  let t8;
4556
4585
  $[20] !== onClear ? (t8 = (event_0) => {
4557
4586
  event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
@@ -4619,7 +4648,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
4619
4648
  ] }), $[81] = rootTheme.tone, $[82] = prefixNode, $[83] = t27, $[84] = suffixNode, $[85] = t28) : t28 = $[85], t28;
4620
4649
  });
4621
4650
  TextInput.displayName = "ForwardRef(TextInput)";
4622
- function _temp$1(event) {
4651
+ function _temp$2(event) {
4623
4652
  event.preventDefault(), event.stopPropagation();
4624
4653
  }
4625
4654
  function useDelayedState(initialState) {
@@ -4739,21 +4768,21 @@ const Root$a = styled(Layer)`
4739
4768
  } = useTheme_v2(), {
4740
4769
  animate: _animate = !1,
4741
4770
  arrow: arrowProp = !1,
4742
- boundaryElement = boundaryElementContext?.element,
4771
+ boundaryElement: _boundaryElement,
4743
4772
  children: childProp,
4744
4773
  content,
4745
4774
  disabled,
4746
- fallbackPlacements: fallbackPlacementsProp = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
4775
+ fallbackPlacements: _fallbackPlacementsProp,
4747
4776
  padding = 2,
4748
4777
  placement: placementProp = "bottom",
4749
4778
  portal: portalProp,
4750
4779
  radius = 2,
4751
4780
  scheme,
4752
4781
  shadow = 2,
4753
- zOffset = layer.tooltip.zOffset,
4782
+ zOffset: _zOffset,
4754
4783
  delay,
4755
4784
  ...restProps
4756
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
4785
+ } = props, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacementsProp = _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], zOffset = _zOffset ?? layer.tooltip.zOffset, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = useState(0);
4757
4786
  useImperativeHandle(forwardedRef, () => ref.current);
4758
4787
  const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = useMemo(() => {
4759
4788
  const ret = [];
@@ -5503,13 +5532,15 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
5503
5532
  });
5504
5533
  DialogCard.displayName = "ForwardRef(DialogCard)";
5505
5534
  const Dialog = forwardRef(function(props, ref) {
5506
- const dialog = useDialog(), {
5535
+ const $ = c(60), dialog = useDialog(), {
5507
5536
  layer
5508
- } = useTheme_v2(), {
5509
- __unstable_autoFocus: autoFocus = !0,
5510
- __unstable_hideCloseButton: hideCloseButton = !1,
5511
- cardRadius: cardRadiusProp = 4,
5512
- cardShadow = 3,
5537
+ } = useTheme_v2();
5538
+ let t0, t1, t2, t3, t4, t5, t6, _positionProp, _zOffsetProp, portalProp, onFocus, id, contentRef, footer, header, onClickOutside, onClose, scheme, children, restProps, onActivate;
5539
+ $[0] !== props ? ({
5540
+ __unstable_autoFocus: t0,
5541
+ __unstable_hideCloseButton: t1,
5542
+ cardRadius: t2,
5543
+ cardShadow: t3,
5513
5544
  children,
5514
5545
  contentRef,
5515
5546
  footer,
@@ -5519,15 +5550,18 @@ const Dialog = forwardRef(function(props, ref) {
5519
5550
  onClickOutside,
5520
5551
  onClose,
5521
5552
  onFocus,
5522
- padding: paddingProp = 3,
5553
+ padding: t4,
5523
5554
  portal: portalProp,
5524
- position: positionProp = dialog.position || "fixed",
5555
+ position: _positionProp,
5525
5556
  scheme,
5526
- width: widthProp = 0,
5527
- zOffset: zOffsetProp = dialog.zOffset || layer.dialog.zOffset,
5528
- animate: _animate = !1,
5557
+ width: t5,
5558
+ zOffset: _zOffsetProp,
5559
+ animate: t6,
5529
5560
  ...restProps
5530
- } = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp), padding = useArrayProp(paddingProp), position = useArrayProp(positionProp), width = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), preDivRef = useRef(null), postDivRef = useRef(null), cardRef = useRef(null), focusedElementRef = useRef(null), handleFocus = useCallback((event) => {
5561
+ } = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = t6, $[8] = _positionProp, $[9] = _zOffsetProp, $[10] = portalProp, $[11] = onFocus, $[12] = id, $[13] = contentRef, $[14] = footer, $[15] = header, $[16] = onClickOutside, $[17] = onClose, $[18] = scheme, $[19] = children, $[20] = restProps, $[21] = onActivate) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], t6 = $[7], _positionProp = $[8], _zOffsetProp = $[9], portalProp = $[10], onFocus = $[11], id = $[12], contentRef = $[13], footer = $[14], header = $[15], onClickOutside = $[16], onClose = $[17], scheme = $[18], children = $[19], restProps = $[20], onActivate = $[21]);
5562
+ const autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, cardRadiusProp = t2 === void 0 ? 4 : t2, cardShadow = t3 === void 0 ? 3 : t3, paddingProp = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, _animate = t6 === void 0 ? !1 : t6, positionProp = _positionProp ?? (dialog.position || "fixed"), zOffsetProp = _zOffsetProp ?? (dialog.zOffset || layer.dialog.zOffset), animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp), padding = useArrayProp(paddingProp), position = useArrayProp(positionProp), width = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), preDivRef = useRef(null), postDivRef = useRef(null), cardRef = useRef(null), focusedElementRef = useRef(null);
5563
+ let t7;
5564
+ $[22] !== onFocus ? (t7 = (event) => {
5531
5565
  onFocus?.(event);
5532
5566
  const target = event.target, cardElement = cardRef.current;
5533
5567
  if (cardElement && target === preDivRef.current) {
@@ -5539,7 +5573,10 @@ const Dialog = forwardRef(function(props, ref) {
5539
5573
  return;
5540
5574
  }
5541
5575
  isHTMLElement(event.target) && (focusedElementRef.current = event.target);
5542
- }, [onFocus]), labelId = `${id}_label`, rootClickTimeoutRef = useRef(), handleRootClick = useCallback(() => {
5576
+ }, $[22] = onFocus, $[23] = t7) : t7 = $[23];
5577
+ const handleFocus = t7, labelId = `${id}_label`, rootClickTimeoutRef = useRef();
5578
+ let t8;
5579
+ $[24] !== boundaryElement || $[25] !== portalElement ? (t8 = () => {
5543
5580
  rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
5544
5581
  const activeElement = document.activeElement;
5545
5582
  if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
@@ -5552,12 +5589,22 @@ const Dialog = forwardRef(function(props, ref) {
5552
5589
  target_0.focus();
5553
5590
  }
5554
5591
  }, 0);
5555
- }, [boundaryElement, portalElement]);
5556
- return /* @__PURE__ */ jsx(Portal, { __unstable_name: portalProp, children: /* @__PURE__ */ jsxs(Root$7, { ...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: [
5557
- /* @__PURE__ */ jsx("div", { ref: preDivRef, tabIndex: 0 }),
5558
- /* @__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 }),
5559
- /* @__PURE__ */ jsx("div", { ref: postDivRef, tabIndex: 0 })
5560
- ] }) });
5592
+ }, $[24] = boundaryElement, $[25] = portalElement, $[26] = t8) : t8 = $[26];
5593
+ const handleRootClick = t8;
5594
+ let t9;
5595
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx("div", { ref: preDivRef, tabIndex: 0 }), $[27] = t9) : t9 = $[27];
5596
+ let t10;
5597
+ $[28] !== autoFocus || $[29] !== hideCloseButton || $[30] !== contentRef || $[31] !== footer || $[32] !== header || $[33] !== id || $[34] !== onClickOutside || $[35] !== onClose || $[36] !== portalProp || $[37] !== cardRadius || $[38] !== scheme || $[39] !== cardShadow || $[40] !== width || $[41] !== children ? (t10 = /* @__PURE__ */ jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, width, children }), $[28] = autoFocus, $[29] = hideCloseButton, $[30] = contentRef, $[31] = footer, $[32] = header, $[33] = id, $[34] = onClickOutside, $[35] = onClose, $[36] = portalProp, $[37] = cardRadius, $[38] = scheme, $[39] = cardShadow, $[40] = width, $[41] = children, $[42] = t10) : t10 = $[42];
5598
+ let t11;
5599
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsx("div", { ref: postDivRef, tabIndex: 0 }), $[43] = t11) : t11 = $[43];
5600
+ let t12;
5601
+ $[44] !== restProps || $[45] !== animate || $[46] !== padding || $[47] !== position || $[48] !== labelId || $[49] !== id || $[50] !== onActivate || $[51] !== handleRootClick || $[52] !== handleFocus || $[53] !== ref || $[54] !== zOffset || $[55] !== t10 ? (t12 = /* @__PURE__ */ jsxs(Root$7, { ...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: [
5602
+ t9,
5603
+ t10,
5604
+ t11
5605
+ ] }), $[44] = restProps, $[45] = animate, $[46] = padding, $[47] = position, $[48] = labelId, $[49] = id, $[50] = onActivate, $[51] = handleRootClick, $[52] = handleFocus, $[53] = ref, $[54] = zOffset, $[55] = t10, $[56] = t12) : t12 = $[56];
5606
+ let t13;
5607
+ return $[57] !== portalProp || $[58] !== t12 ? (t13 = /* @__PURE__ */ jsx(Portal, { __unstable_name: portalProp, children: t12 }), $[57] = portalProp, $[58] = t12, $[59] = t13) : t13 = $[59], t13;
5561
5608
  });
5562
5609
  Dialog.displayName = "ForwardRef(Dialog)";
5563
5610
  function DialogProvider(props) {
@@ -5788,48 +5835,66 @@ const Root$5 = styled(Box)`
5788
5835
  outline: none;
5789
5836
  overflow: auto;
5790
5837
  `, Menu = forwardRef(function(props, forwardedRef) {
5838
+ const $ = c(50);
5839
+ let t0, t1, _shouldFocus, onKeyDown, originElement, registerElement, onItemSelect, onClickOutside, onEscape, onItemClick, children, restProps;
5840
+ if ($[0] !== props) {
5841
+ const {
5842
+ children: t22,
5843
+ focusFirst,
5844
+ focusLast,
5845
+ onClickOutside: t32,
5846
+ onEscape: t42,
5847
+ onItemClick: t52,
5848
+ onItemSelect: t62,
5849
+ onKeyDown: t72,
5850
+ originElement: t82,
5851
+ padding: t92,
5852
+ registerElement: t102,
5853
+ shouldFocus: t112,
5854
+ space: t122,
5855
+ ...t132
5856
+ } = props;
5857
+ children = t22, onClickOutside = t32, onEscape = t42, onItemClick = t52, onItemSelect = t62, onKeyDown = t72, originElement = t82, t0 = t92, registerElement = t102, _shouldFocus = t112, t1 = t122, restProps = t132, $[0] = props, $[1] = t0, $[2] = t1, $[3] = _shouldFocus, $[4] = onKeyDown, $[5] = originElement, $[6] = registerElement, $[7] = onItemSelect, $[8] = onClickOutside, $[9] = onEscape, $[10] = onItemClick, $[11] = children, $[12] = restProps;
5858
+ } else
5859
+ t0 = $[1], t1 = $[2], _shouldFocus = $[3], onKeyDown = $[4], originElement = $[5], registerElement = $[6], onItemSelect = $[7], onClickOutside = $[8], onEscape = $[9], onItemClick = $[10], children = $[11], restProps = $[12];
5860
+ const padding = t0 === void 0 ? 1 : t0, space = t1 === void 0 ? 1 : t1, shouldFocus = _shouldFocus ?? (props.focusFirst && "first" || props.focusLast && "last" || null), ref = useRef(null);
5861
+ let t2;
5862
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[13] = t2) : t2 = $[13], useImperativeHandle(forwardedRef, t2);
5791
5863
  const {
5792
- children,
5793
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5794
- focusFirst,
5795
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5796
- focusLast,
5797
- onClickOutside,
5798
- onEscape,
5799
- onItemClick,
5800
- onItemSelect,
5864
+ isTopLayer
5865
+ } = useLayer();
5866
+ let t3;
5867
+ $[14] !== onKeyDown || $[15] !== originElement || $[16] !== shouldFocus ? (t3 = {
5801
5868
  onKeyDown,
5802
5869
  originElement,
5803
- padding = 1,
5804
- registerElement,
5805
- shouldFocus = props.focusFirst && "first" || props.focusLast && "last" || null,
5806
- space = 1,
5807
- ...restProps
5808
- } = props, ref = useRef(null);
5809
- useImperativeHandle(forwardedRef, () => ref.current);
5870
+ shouldFocus,
5871
+ rootElementRef: ref
5872
+ }, $[14] = onKeyDown, $[15] = originElement, $[16] = shouldFocus, $[17] = t3) : t3 = $[17];
5810
5873
  const {
5811
- isTopLayer
5812
- } = useLayer(), {
5813
5874
  activeElement,
5814
5875
  activeIndex,
5815
5876
  handleItemMouseEnter,
5816
5877
  handleItemMouseLeave,
5817
5878
  handleKeyDown,
5818
5879
  mount
5819
- } = useMenuController({
5820
- onKeyDown,
5821
- originElement,
5822
- shouldFocus,
5823
- rootElementRef: ref
5824
- }), unregisterElementRef = useRef(null), handleRefChange = useCallback((el) => {
5880
+ } = useMenuController(t3), unregisterElementRef = useRef(null);
5881
+ let t4;
5882
+ $[18] !== registerElement ? (t4 = (el) => {
5825
5883
  unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
5826
- }, [registerElement]);
5827
- useEffect(() => {
5884
+ }, $[18] = registerElement, $[19] = t4) : t4 = $[19];
5885
+ const handleRefChange = t4;
5886
+ let t5, t6;
5887
+ $[20] !== onItemSelect || $[21] !== activeIndex ? (t5 = () => {
5828
5888
  onItemSelect && onItemSelect(activeIndex);
5829
- }, [activeIndex, onItemSelect]), useClickOutsideEvent(isTopLayer && onClickOutside, () => [ref.current]), useGlobalKeyDown(useCallback((event) => {
5889
+ }, t6 = [activeIndex, onItemSelect], $[20] = onItemSelect, $[21] = activeIndex, $[22] = t5, $[23] = t6) : (t5 = $[22], t6 = $[23]), useEffect(t5, t6);
5890
+ let t7;
5891
+ $[24] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => [ref.current], $[24] = t7) : t7 = $[24], useClickOutsideEvent(isTopLayer && onClickOutside, t7);
5892
+ let t8;
5893
+ $[25] !== isTopLayer || $[26] !== onEscape ? (t8 = (event) => {
5830
5894
  isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
5831
- }, [isTopLayer, onEscape]));
5832
- const value = useMemo(() => ({
5895
+ }, $[25] = isTopLayer, $[26] = onEscape, $[27] = t8) : t8 = $[27], useGlobalKeyDown(t8);
5896
+ let t9, t10;
5897
+ $[28] !== activeElement || $[29] !== activeIndex || $[30] !== mount || $[31] !== onClickOutside || $[32] !== onEscape || $[33] !== onItemClick || $[34] !== handleItemMouseEnter || $[35] !== handleItemMouseLeave || $[36] !== registerElement ? (t10 = {
5833
5898
  version: 0,
5834
5899
  activeElement,
5835
5900
  activeIndex,
@@ -5840,11 +5905,16 @@ const Root$5 = styled(Box)`
5840
5905
  onItemMouseEnter: handleItemMouseEnter,
5841
5906
  onItemMouseLeave: handleItemMouseLeave,
5842
5907
  registerElement,
5843
- // deprecated
5844
5908
  onMouseEnter: handleItemMouseEnter,
5845
5909
  onMouseLeave: handleItemMouseLeave
5846
- }), [activeElement, activeIndex, mount, handleItemMouseEnter, handleItemMouseLeave, onClickOutside, onEscape, onItemClick, registerElement]);
5847
- return /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: /* @__PURE__ */ jsx(Root$5, { "data-ui": "Menu", ...restProps, onKeyDown: handleKeyDown, padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: /* @__PURE__ */ jsx(Stack, { space, children }) }) });
5910
+ }, $[28] = activeElement, $[29] = activeIndex, $[30] = mount, $[31] = onClickOutside, $[32] = onEscape, $[33] = onItemClick, $[34] = handleItemMouseEnter, $[35] = handleItemMouseLeave, $[36] = registerElement, $[37] = t10) : t10 = $[37], t9 = t10;
5911
+ const value = t9;
5912
+ let t11;
5913
+ $[38] !== space || $[39] !== children ? (t11 = /* @__PURE__ */ jsx(Stack, { space, children }), $[38] = space, $[39] = children, $[40] = t11) : t11 = $[40];
5914
+ let t12;
5915
+ $[41] !== restProps || $[42] !== handleKeyDown || $[43] !== padding || $[44] !== handleRefChange || $[45] !== t11 ? (t12 = /* @__PURE__ */ jsx(Root$5, { "data-ui": "Menu", ...restProps, onKeyDown: handleKeyDown, padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t11 }), $[41] = restProps, $[42] = handleKeyDown, $[43] = padding, $[44] = handleRefChange, $[45] = t11, $[46] = t12) : t12 = $[46];
5916
+ let t13;
5917
+ return $[47] !== value || $[48] !== t12 ? (t13 = /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: t12 }), $[47] = value, $[48] = t12, $[49] = t13) : t13 = $[49], t13;
5848
5918
  });
5849
5919
  Menu.displayName = "ForwardRef(Menu)";
5850
5920
  const MenuButton = forwardRef(function(props, forwardedRef) {
@@ -6058,20 +6128,23 @@ function useMenu() {
6058
6128
  return value;
6059
6129
  }
6060
6130
  function MenuGroup(props) {
6061
- const {
6062
- as = "button",
6131
+ const $ = c(77);
6132
+ let t0, t1, t2, t3, t4, t5, onClick, children, IconComponent, text, restProps, popover;
6133
+ $[0] !== props ? ({
6134
+ as: t0,
6063
6135
  children,
6064
- fontSize: fontSize2 = 1,
6136
+ fontSize: t1,
6065
6137
  icon: IconComponent,
6066
6138
  onClick,
6067
- padding = 3,
6139
+ padding: t2,
6068
6140
  popover,
6069
- radius = 2,
6070
- space = 3,
6141
+ radius: t3,
6142
+ space: t4,
6071
6143
  text,
6072
- tone = "default",
6144
+ tone: t5,
6073
6145
  ...restProps
6074
- } = props, menu = useMenu(), {
6146
+ } = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = onClick, $[8] = children, $[9] = IconComponent, $[10] = text, $[11] = restProps, $[12] = popover) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], onClick = $[7], children = $[8], IconComponent = $[9], text = $[10], restProps = $[11], popover = $[12]);
6147
+ const as = t0 === void 0 ? "button" : t0, fontSize2 = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, space = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, menu = useMenu(), {
6075
6148
  scheme
6076
6149
  } = useRootTheme(), {
6077
6150
  activeElement,
@@ -6079,56 +6152,99 @@ function MenuGroup(props) {
6079
6152
  onClickOutside,
6080
6153
  onEscape,
6081
6154
  onItemClick,
6082
- onItemMouseEnter = menu.onMouseEnter,
6155
+ onItemMouseEnter: _onItemMouseEnter,
6083
6156
  registerElement
6084
- } = menu, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1), handleMouseEnter = useCallback((event) => {
6157
+ } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onMouseEnter, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1);
6158
+ let t6;
6159
+ $[13] !== onItemMouseEnter ? (t6 = (event) => {
6085
6160
  setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
6086
- }, [onItemMouseEnter]), handleMenuKeyDown = useCallback((event_0) => {
6161
+ }, $[13] = onItemMouseEnter, $[14] = t6) : t6 = $[14];
6162
+ const handleMouseEnter = t6;
6163
+ let t7;
6164
+ $[15] !== rootElement ? (t7 = (event_0) => {
6087
6165
  event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
6088
6166
  rootElement?.focus();
6089
6167
  }));
6090
- }, [rootElement]), handleClick = useCallback((event_1) => {
6168
+ }, $[15] = rootElement, $[16] = t7) : t7 = $[16];
6169
+ const handleMenuKeyDown = t7;
6170
+ let t8;
6171
+ $[17] !== onClick ? (t8 = (event_1) => {
6091
6172
  onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
6092
- }, [onClick]), handleChildItemClick = useCallback(() => {
6173
+ }, $[17] = onClick, $[18] = t8) : t8 = $[18];
6174
+ const handleClick = t8;
6175
+ let t9;
6176
+ $[19] !== onItemClick ? (t9 = () => {
6093
6177
  setOpen(!1), onItemClick?.();
6094
- }, [onItemClick]), handleMenuMouseEnter = useCallback(() => setWithinMenu(!0), []);
6095
- useEffect(() => mount(rootElement), [mount, rootElement]), useEffect(() => {
6178
+ }, $[19] = onItemClick, $[20] = t9) : t9 = $[20];
6179
+ const handleChildItemClick = t9;
6180
+ let t10;
6181
+ $[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[21] = t10) : t10 = $[21];
6182
+ const handleMenuMouseEnter = t10;
6183
+ let t11, t12;
6184
+ $[22] !== mount || $[23] !== rootElement ? (t11 = () => mount(rootElement), t12 = [mount, rootElement], $[22] = mount, $[23] = rootElement, $[24] = t11, $[25] = t12) : (t11 = $[24], t12 = $[25]), useEffect(t11, t12);
6185
+ let t13, t14;
6186
+ $[26] !== active ? (t13 = () => {
6096
6187
  active || setOpen(!1);
6097
- }, [active]), useEffect(() => {
6188
+ }, t14 = [active], $[26] = active, $[27] = t13, $[28] = t14) : (t13 = $[27], t14 = $[28]), useEffect(t13, t14);
6189
+ let t15, t16;
6190
+ $[29] !== open ? (t15 = () => {
6098
6191
  open || setWithinMenu(!1);
6099
- }, [open]), useEffect(() => {
6100
- if (!shouldFocus) return;
6192
+ }, t16 = [open], $[29] = open, $[30] = t15, $[31] = t16) : (t15 = $[30], t16 = $[31]), useEffect(t15, t16);
6193
+ let t17, t18;
6194
+ $[32] !== shouldFocus ? (t17 = () => {
6195
+ if (!shouldFocus)
6196
+ return;
6101
6197
  const rafId = requestAnimationFrame(() => setShouldFocus(null));
6102
6198
  return () => cancelAnimationFrame(rafId);
6103
- }, [shouldFocus]);
6104
- const childMenu = /* @__PURE__ */ jsx(Menu, { onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), handleKeyDown = useCallback((event_2) => {
6199
+ }, t18 = [shouldFocus], $[32] = shouldFocus, $[33] = t17, $[34] = t18) : (t17 = $[33], t18 = $[34]), useEffect(t17, t18);
6200
+ let t19;
6201
+ $[35] !== onClickOutside || $[36] !== onEscape || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== registerElement || $[40] !== shouldFocus || $[41] !== children ? (t19 = /* @__PURE__ */ jsx(Menu, { onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), $[35] = onClickOutside, $[36] = onEscape, $[37] = handleChildItemClick, $[38] = handleMenuKeyDown, $[39] = registerElement, $[40] = shouldFocus, $[41] = children, $[42] = t19) : t19 = $[42];
6202
+ const childMenu = t19;
6203
+ let t20;
6204
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
6105
6205
  const target = event_2.currentTarget;
6106
6206
  if (document.activeElement === target && event_2.key === "ArrowRight") {
6107
6207
  setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
6108
6208
  return;
6109
6209
  }
6110
- }, []);
6111
- return /* @__PURE__ */ jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: /* @__PURE__ */ jsx(Selectable, { "data-as": as, "data-ui": "MenuGroup", forwardedAs: as, ...restProps, "aria-pressed": as === "button" ? withinMenu : void 0, "data-pressed": as !== "button" ? withinMenu : void 0, "data-selected": !withinMenu && active ? "" : void 0, $radius: useArrayProp(radius), $tone: tone, $scheme: scheme, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, ref: setRootElement, tabIndex: -1, type: as === "button" ? "button" : void 0, children: /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
6112
- IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6113
- isValidElement(IconComponent) && IconComponent,
6114
- isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
6115
- ] }),
6116
- /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
6117
- /* @__PURE__ */ jsx(Text, { size: fontSize2, children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) })
6118
- ] }) }) });
6210
+ }, $[43] = t20) : t20 = $[43];
6211
+ const handleKeyDown = t20, t21 = as === "button" ? withinMenu : void 0, t22 = as !== "button" ? withinMenu : void 0, t23 = !withinMenu && active ? "" : void 0, t24 = useArrayProp(radius), t25 = as === "button" ? "button" : void 0;
6212
+ let t26;
6213
+ $[44] !== IconComponent || $[45] !== fontSize2 ? (t26 = IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6214
+ isValidElement(IconComponent) && IconComponent,
6215
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
6216
+ ] }), $[44] = IconComponent, $[45] = fontSize2, $[46] = t26) : t26 = $[46];
6217
+ let t27;
6218
+ $[47] !== fontSize2 || $[48] !== text ? (t27 = /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }), $[47] = fontSize2, $[48] = text, $[49] = t27) : t27 = $[49];
6219
+ let t28;
6220
+ $[50] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsx(ChevronRightIcon, {}), $[50] = t28) : t28 = $[50];
6221
+ let t29;
6222
+ $[51] !== fontSize2 ? (t29 = /* @__PURE__ */ jsx(Text, { size: fontSize2, children: t28 }), $[51] = fontSize2, $[52] = t29) : t29 = $[52];
6223
+ let t30;
6224
+ $[53] !== space || $[54] !== padding || $[55] !== t26 || $[56] !== t27 || $[57] !== t29 ? (t30 = /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
6225
+ t26,
6226
+ t27,
6227
+ t29
6228
+ ] }), $[53] = space, $[54] = padding, $[55] = t26, $[56] = t27, $[57] = t29, $[58] = t30) : t30 = $[58];
6229
+ let t31;
6230
+ $[59] !== as || $[60] !== restProps || $[61] !== t21 || $[62] !== t22 || $[63] !== t23 || $[64] !== t24 || $[65] !== tone || $[66] !== scheme || $[67] !== handleClick || $[68] !== handleMouseEnter || $[69] !== t25 || $[70] !== t30 ? (t31 = /* @__PURE__ */ jsx(Selectable, { "data-as": as, "data-ui": "MenuGroup", forwardedAs: as, ...restProps, "aria-pressed": t21, "data-pressed": t22, "data-selected": t23, $radius: t24, $tone: tone, $scheme: scheme, onClick: handleClick, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, ref: setRootElement, tabIndex: -1, type: t25, children: t30 }), $[59] = as, $[60] = restProps, $[61] = t21, $[62] = t22, $[63] = t23, $[64] = t24, $[65] = tone, $[66] = scheme, $[67] = handleClick, $[68] = handleMouseEnter, $[69] = t25, $[70] = t30, $[71] = t31) : t31 = $[71];
6231
+ let t32;
6232
+ return $[72] !== popover || $[73] !== childMenu || $[74] !== open || $[75] !== t31 ? (t32 = /* @__PURE__ */ jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t31 }), $[72] = popover, $[73] = childMenu, $[74] = open, $[75] = t31, $[76] = t32) : t32 = $[76], t32;
6119
6233
  }
6120
6234
  MenuGroup.displayName = "MenuGroup";
6121
6235
  const MenuItem = forwardRef(function(props, forwardedRef) {
6122
- const {
6123
- as = "button",
6236
+ const $ = c(74);
6237
+ let t0, t1, t2, t3, t4, t5, selectedProp, disabled, onClick, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, pressed, IconComponent, text, IconRightComponent, hotkeys, children, restProps;
6238
+ $[0] !== props ? ({
6239
+ as: t0,
6124
6240
  children,
6125
6241
  disabled,
6126
- fontSize: fontSize2 = 1,
6242
+ fontSize: t1,
6127
6243
  hotkeys,
6128
6244
  icon: IconComponent,
6129
6245
  iconRight: IconRightComponent,
6130
6246
  onClick,
6131
- padding = 3,
6247
+ padding: t2,
6132
6248
  paddingX,
6133
6249
  paddingY,
6134
6250
  paddingTop,
@@ -6136,25 +6252,33 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
6136
6252
  paddingBottom,
6137
6253
  paddingLeft,
6138
6254
  pressed,
6139
- radius = 2,
6255
+ radius: t3,
6140
6256
  selected: selectedProp,
6141
- space = 3,
6257
+ space: t4,
6142
6258
  text,
6143
- tone = "default",
6259
+ tone: t5,
6144
6260
  ...restProps
6145
- } = props, {
6261
+ } = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = t2, $[4] = t3, $[5] = t4, $[6] = t5, $[7] = selectedProp, $[8] = disabled, $[9] = onClick, $[10] = paddingX, $[11] = paddingY, $[12] = paddingTop, $[13] = paddingRight, $[14] = paddingBottom, $[15] = paddingLeft, $[16] = pressed, $[17] = IconComponent, $[18] = text, $[19] = IconRightComponent, $[20] = hotkeys, $[21] = children, $[22] = restProps) : (t0 = $[1], t1 = $[2], t2 = $[3], t3 = $[4], t4 = $[5], t5 = $[6], selectedProp = $[7], disabled = $[8], onClick = $[9], paddingX = $[10], paddingY = $[11], paddingTop = $[12], paddingRight = $[13], paddingBottom = $[14], paddingLeft = $[15], pressed = $[16], IconComponent = $[17], text = $[18], IconRightComponent = $[19], hotkeys = $[20], children = $[21], restProps = $[22]);
6262
+ const as = t0 === void 0 ? "button" : t0, fontSize2 = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 3 : t2, radius = t3 === void 0 ? 2 : t3, space = t4 === void 0 ? 3 : t4, tone = t5 === void 0 ? "default" : t5, {
6146
6263
  scheme
6147
6264
  } = useRootTheme(), menu = useMenu(), {
6148
6265
  activeElement,
6149
6266
  mount,
6150
6267
  onItemClick,
6151
- onItemMouseEnter = menu.onMouseEnter,
6152
- onItemMouseLeave = menu.onMouseLeave
6153
- } = menu, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
6154
- useImperativeHandle(forwardedRef, () => ref.current), useEffect(() => mount(rootElement, selectedProp), [mount, rootElement, selectedProp]);
6155
- const handleClick = useCallback((event) => {
6268
+ onItemMouseEnter: _onItemMouseEnter,
6269
+ onItemMouseLeave: _onItemMouseLeave
6270
+ } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu.onMouseLeave, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
6271
+ let t6;
6272
+ $[23] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[23] = t6) : t6 = $[23], useImperativeHandle(forwardedRef, t6);
6273
+ let t7, t8;
6274
+ $[24] !== mount || $[25] !== rootElement || $[26] !== selectedProp ? (t7 = () => mount(rootElement, selectedProp), t8 = [mount, rootElement, selectedProp], $[24] = mount, $[25] = rootElement, $[26] = selectedProp, $[27] = t7, $[28] = t8) : (t7 = $[27], t8 = $[28]), useEffect(t7, t8);
6275
+ let t9;
6276
+ $[29] !== disabled || $[30] !== onClick || $[31] !== onItemClick ? (t9 = (event) => {
6156
6277
  disabled || (onClick && onClick(event), onItemClick && onItemClick());
6157
- }, [disabled, onClick, onItemClick]), paddingProps = useMemo(() => ({
6278
+ }, $[29] = disabled, $[30] = onClick, $[31] = onItemClick, $[32] = t9) : t9 = $[32];
6279
+ const handleClick = t9;
6280
+ let t10, t11;
6281
+ $[33] !== padding || $[34] !== paddingX || $[35] !== paddingY || $[36] !== paddingTop || $[37] !== paddingRight || $[38] !== paddingBottom || $[39] !== paddingLeft ? (t11 = {
6158
6282
  padding,
6159
6283
  paddingX,
6160
6284
  paddingY,
@@ -6162,29 +6286,44 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
6162
6286
  paddingRight,
6163
6287
  paddingBottom,
6164
6288
  paddingLeft
6165
- }), [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]), hotkeysFontSize = useArrayProp(fontSize2).map((s) => s - 1), setRef = useCallback((el) => {
6289
+ }, $[33] = padding, $[34] = paddingX, $[35] = paddingY, $[36] = paddingTop, $[37] = paddingRight, $[38] = paddingBottom, $[39] = paddingLeft, $[40] = t11) : t11 = $[40], t10 = t11;
6290
+ const paddingProps = t10, t12 = useArrayProp(fontSize2);
6291
+ let t13;
6292
+ $[41] !== t12 ? (t13 = t12.map(_temp$1), $[41] = t12, $[42] = t13) : t13 = $[42];
6293
+ const hotkeysFontSize = t13;
6294
+ let t14;
6295
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t14 = (el) => {
6166
6296
  ref.current = el, setRootElement(el);
6167
- }, []);
6168
- return /* @__PURE__ */ jsxs(Selectable, { "data-ui": "MenuItem", ...restProps, "aria-pressed": as === "button" && pressed, "data-pressed": as !== "button" && pressed ? "" : void 0, "data-selected": active ? "" : void 0, "data-disabled": disabled ? "" : void 0, forwardedAs: as, $radius: useArrayProp(radius), $padding: useArrayProp(0), $tone: disabled ? "default" : tone, $scheme: scheme, disabled, onClick: handleClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ref: setRef, role: "menuitem", tabIndex: -1, type: as === "button" ? "button" : void 0, children: [
6169
- (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, { as: "span", gap: space, align: "center", ...paddingProps, children: [
6170
- IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6171
- isValidElement(IconComponent) && IconComponent,
6172
- isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
6173
- ] }),
6174
- text && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
6175
- hotkeys && /* @__PURE__ */ jsx(Hotkeys, { fontSize: hotkeysFontSize, keys: hotkeys, style: {
6176
- marginTop: -4,
6177
- marginBottom: -4
6178
- } }),
6179
- IconRightComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6180
- isValidElement(IconRightComponent) && IconRightComponent,
6181
- isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
6182
- ] })
6297
+ }, $[43] = t14) : t14 = $[43];
6298
+ const setRef = t14, t15 = as === "button" && pressed, t16 = as !== "button" && pressed ? "" : void 0, t17 = active ? "" : void 0, t18 = disabled ? "" : void 0, t19 = useArrayProp(radius), t20 = useArrayProp(0), t21 = disabled ? "default" : tone, t22 = as === "button" ? "button" : void 0;
6299
+ let t23;
6300
+ $[44] !== IconComponent || $[45] !== text || $[46] !== IconRightComponent || $[47] !== fontSize2 || $[48] !== hotkeys || $[49] !== hotkeysFontSize || $[50] !== space || $[51] !== paddingProps ? (t23 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, { as: "span", gap: space, align: "center", ...paddingProps, children: [
6301
+ IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6302
+ isValidElement(IconComponent) && IconComponent,
6303
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
6183
6304
  ] }),
6184
- children && /* @__PURE__ */ jsx(Box, { as: "span", ...paddingProps, children })
6185
- ] });
6305
+ text && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
6306
+ hotkeys && /* @__PURE__ */ jsx(Hotkeys, { fontSize: hotkeysFontSize, keys: hotkeys, style: {
6307
+ marginTop: -4,
6308
+ marginBottom: -4
6309
+ } }),
6310
+ IconRightComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6311
+ isValidElement(IconRightComponent) && IconRightComponent,
6312
+ isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
6313
+ ] })
6314
+ ] }), $[44] = IconComponent, $[45] = text, $[46] = IconRightComponent, $[47] = fontSize2, $[48] = hotkeys, $[49] = hotkeysFontSize, $[50] = space, $[51] = paddingProps, $[52] = t23) : t23 = $[52];
6315
+ let t24;
6316
+ $[53] !== children || $[54] !== paddingProps ? (t24 = children && /* @__PURE__ */ jsx(Box, { as: "span", ...paddingProps, children }), $[53] = children, $[54] = paddingProps, $[55] = t24) : t24 = $[55];
6317
+ let t25;
6318
+ return $[56] !== restProps || $[57] !== t15 || $[58] !== t16 || $[59] !== t17 || $[60] !== t18 || $[61] !== as || $[62] !== t19 || $[63] !== t20 || $[64] !== t21 || $[65] !== scheme || $[66] !== disabled || $[67] !== handleClick || $[68] !== onItemMouseEnter || $[69] !== onItemMouseLeave || $[70] !== t22 || $[71] !== t23 || $[72] !== t24 ? (t25 = /* @__PURE__ */ jsxs(Selectable, { "data-ui": "MenuItem", ...restProps, "aria-pressed": t15, "data-pressed": t16, "data-selected": t17, "data-disabled": t18, forwardedAs: as, $radius: t19, $padding: t20, $tone: t21, $scheme: scheme, disabled, onClick: handleClick, onMouseEnter: onItemMouseEnter, onMouseLeave: onItemMouseLeave, ref: setRef, role: "menuitem", tabIndex: -1, type: t22, children: [
6319
+ t23,
6320
+ t24
6321
+ ] }), $[56] = restProps, $[57] = t15, $[58] = t16, $[59] = t17, $[60] = t18, $[61] = as, $[62] = t19, $[63] = t20, $[64] = t21, $[65] = scheme, $[66] = disabled, $[67] = handleClick, $[68] = onItemMouseEnter, $[69] = onItemMouseLeave, $[70] = t22, $[71] = t23, $[72] = t24, $[73] = t25) : t25 = $[73], t25;
6186
6322
  });
6187
6323
  MenuItem.displayName = "ForwardRef(MenuItem)";
6324
+ function _temp$1(s) {
6325
+ return s - 1;
6326
+ }
6188
6327
  const keyframe = keyframes`
6189
6328
  0% {
6190
6329
  background-position: 100%;