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

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, {});
@@ -3902,6 +3931,7 @@ const Popover = memo(forwardRef(function(props, forwardedRef) {
3902
3931
  }));
3903
3932
  Popover.displayName = "Memo(ForwardRef(Popover))";
3904
3933
  function getElementRef(element) {
3934
+ if (!element) return null;
3905
3935
  let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
3906
3936
  return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
3907
3937
  }
@@ -4551,7 +4581,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
4551
4581
  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
4582
  let t7;
4553
4583
  $[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;
4584
+ const handleClearMouseDown = _temp$2;
4555
4585
  let t8;
4556
4586
  $[20] !== onClear ? (t8 = (event_0) => {
4557
4587
  event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
@@ -4619,7 +4649,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
4619
4649
  ] }), $[81] = rootTheme.tone, $[82] = prefixNode, $[83] = t27, $[84] = suffixNode, $[85] = t28) : t28 = $[85], t28;
4620
4650
  });
4621
4651
  TextInput.displayName = "ForwardRef(TextInput)";
4622
- function _temp$1(event) {
4652
+ function _temp$2(event) {
4623
4653
  event.preventDefault(), event.stopPropagation();
4624
4654
  }
4625
4655
  function useDelayedState(initialState) {
@@ -4739,21 +4769,21 @@ const Root$a = styled(Layer)`
4739
4769
  } = useTheme_v2(), {
4740
4770
  animate: _animate = !1,
4741
4771
  arrow: arrowProp = !1,
4742
- boundaryElement = boundaryElementContext?.element,
4772
+ boundaryElement: _boundaryElement,
4743
4773
  children: childProp,
4744
4774
  content,
4745
4775
  disabled,
4746
- fallbackPlacements: fallbackPlacementsProp = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
4776
+ fallbackPlacements: _fallbackPlacementsProp,
4747
4777
  padding = 2,
4748
4778
  placement: placementProp = "bottom",
4749
4779
  portal: portalProp,
4750
4780
  radius = 2,
4751
4781
  scheme,
4752
4782
  shadow = 2,
4753
- zOffset = layer.tooltip.zOffset,
4783
+ zOffset: _zOffset,
4754
4784
  delay,
4755
4785
  ...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);
4786
+ } = 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
4787
  useImperativeHandle(forwardedRef, () => ref.current);
4758
4788
  const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = useMemo(() => {
4759
4789
  const ret = [];
@@ -5503,13 +5533,15 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
5503
5533
  });
5504
5534
  DialogCard.displayName = "ForwardRef(DialogCard)";
5505
5535
  const Dialog = forwardRef(function(props, ref) {
5506
- const dialog = useDialog(), {
5536
+ const $ = c(60), dialog = useDialog(), {
5507
5537
  layer
5508
- } = useTheme_v2(), {
5509
- __unstable_autoFocus: autoFocus = !0,
5510
- __unstable_hideCloseButton: hideCloseButton = !1,
5511
- cardRadius: cardRadiusProp = 4,
5512
- cardShadow = 3,
5538
+ } = useTheme_v2();
5539
+ let t0, t1, t2, t3, t4, t5, t6, _positionProp, _zOffsetProp, portalProp, onFocus, id, contentRef, footer, header, onClickOutside, onClose, scheme, children, restProps, onActivate;
5540
+ $[0] !== props ? ({
5541
+ __unstable_autoFocus: t0,
5542
+ __unstable_hideCloseButton: t1,
5543
+ cardRadius: t2,
5544
+ cardShadow: t3,
5513
5545
  children,
5514
5546
  contentRef,
5515
5547
  footer,
@@ -5519,15 +5551,18 @@ const Dialog = forwardRef(function(props, ref) {
5519
5551
  onClickOutside,
5520
5552
  onClose,
5521
5553
  onFocus,
5522
- padding: paddingProp = 3,
5554
+ padding: t4,
5523
5555
  portal: portalProp,
5524
- position: positionProp = dialog.position || "fixed",
5556
+ position: _positionProp,
5525
5557
  scheme,
5526
- width: widthProp = 0,
5527
- zOffset: zOffsetProp = dialog.zOffset || layer.dialog.zOffset,
5528
- animate: _animate = !1,
5558
+ width: t5,
5559
+ zOffset: _zOffsetProp,
5560
+ animate: t6,
5529
5561
  ...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) => {
5562
+ } = 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]);
5563
+ 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);
5564
+ let t7;
5565
+ $[22] !== onFocus ? (t7 = (event) => {
5531
5566
  onFocus?.(event);
5532
5567
  const target = event.target, cardElement = cardRef.current;
5533
5568
  if (cardElement && target === preDivRef.current) {
@@ -5539,7 +5574,10 @@ const Dialog = forwardRef(function(props, ref) {
5539
5574
  return;
5540
5575
  }
5541
5576
  isHTMLElement(event.target) && (focusedElementRef.current = event.target);
5542
- }, [onFocus]), labelId = `${id}_label`, rootClickTimeoutRef = useRef(), handleRootClick = useCallback(() => {
5577
+ }, $[22] = onFocus, $[23] = t7) : t7 = $[23];
5578
+ const handleFocus = t7, labelId = `${id}_label`, rootClickTimeoutRef = useRef();
5579
+ let t8;
5580
+ $[24] !== boundaryElement || $[25] !== portalElement ? (t8 = () => {
5543
5581
  rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
5544
5582
  const activeElement = document.activeElement;
5545
5583
  if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
@@ -5552,12 +5590,22 @@ const Dialog = forwardRef(function(props, ref) {
5552
5590
  target_0.focus();
5553
5591
  }
5554
5592
  }, 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
- ] }) });
5593
+ }, $[24] = boundaryElement, $[25] = portalElement, $[26] = t8) : t8 = $[26];
5594
+ const handleRootClick = t8;
5595
+ let t9;
5596
+ $[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx("div", { ref: preDivRef, tabIndex: 0 }), $[27] = t9) : t9 = $[27];
5597
+ let t10;
5598
+ $[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];
5599
+ let t11;
5600
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsx("div", { ref: postDivRef, tabIndex: 0 }), $[43] = t11) : t11 = $[43];
5601
+ let t12;
5602
+ $[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: [
5603
+ t9,
5604
+ t10,
5605
+ t11
5606
+ ] }), $[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];
5607
+ let t13;
5608
+ return $[57] !== portalProp || $[58] !== t12 ? (t13 = /* @__PURE__ */ jsx(Portal, { __unstable_name: portalProp, children: t12 }), $[57] = portalProp, $[58] = t12, $[59] = t13) : t13 = $[59], t13;
5561
5609
  });
5562
5610
  Dialog.displayName = "ForwardRef(Dialog)";
5563
5611
  function DialogProvider(props) {
@@ -5788,48 +5836,66 @@ const Root$5 = styled(Box)`
5788
5836
  outline: none;
5789
5837
  overflow: auto;
5790
5838
  `, Menu = forwardRef(function(props, forwardedRef) {
5839
+ const $ = c(50);
5840
+ let t0, t1, _shouldFocus, onKeyDown, originElement, registerElement, onItemSelect, onClickOutside, onEscape, onItemClick, children, restProps;
5841
+ if ($[0] !== props) {
5842
+ const {
5843
+ children: t22,
5844
+ focusFirst,
5845
+ focusLast,
5846
+ onClickOutside: t32,
5847
+ onEscape: t42,
5848
+ onItemClick: t52,
5849
+ onItemSelect: t62,
5850
+ onKeyDown: t72,
5851
+ originElement: t82,
5852
+ padding: t92,
5853
+ registerElement: t102,
5854
+ shouldFocus: t112,
5855
+ space: t122,
5856
+ ...t132
5857
+ } = props;
5858
+ 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;
5859
+ } else
5860
+ t0 = $[1], t1 = $[2], _shouldFocus = $[3], onKeyDown = $[4], originElement = $[5], registerElement = $[6], onItemSelect = $[7], onClickOutside = $[8], onEscape = $[9], onItemClick = $[10], children = $[11], restProps = $[12];
5861
+ 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);
5862
+ let t2;
5863
+ $[13] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[13] = t2) : t2 = $[13], useImperativeHandle(forwardedRef, t2);
5791
5864
  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,
5865
+ isTopLayer
5866
+ } = useLayer();
5867
+ let t3;
5868
+ $[14] !== onKeyDown || $[15] !== originElement || $[16] !== shouldFocus ? (t3 = {
5801
5869
  onKeyDown,
5802
5870
  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);
5871
+ shouldFocus,
5872
+ rootElementRef: ref
5873
+ }, $[14] = onKeyDown, $[15] = originElement, $[16] = shouldFocus, $[17] = t3) : t3 = $[17];
5810
5874
  const {
5811
- isTopLayer
5812
- } = useLayer(), {
5813
5875
  activeElement,
5814
5876
  activeIndex,
5815
5877
  handleItemMouseEnter,
5816
5878
  handleItemMouseLeave,
5817
5879
  handleKeyDown,
5818
5880
  mount
5819
- } = useMenuController({
5820
- onKeyDown,
5821
- originElement,
5822
- shouldFocus,
5823
- rootElementRef: ref
5824
- }), unregisterElementRef = useRef(null), handleRefChange = useCallback((el) => {
5881
+ } = useMenuController(t3), unregisterElementRef = useRef(null);
5882
+ let t4;
5883
+ $[18] !== registerElement ? (t4 = (el) => {
5825
5884
  unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
5826
- }, [registerElement]);
5827
- useEffect(() => {
5885
+ }, $[18] = registerElement, $[19] = t4) : t4 = $[19];
5886
+ const handleRefChange = t4;
5887
+ let t5, t6;
5888
+ $[20] !== onItemSelect || $[21] !== activeIndex ? (t5 = () => {
5828
5889
  onItemSelect && onItemSelect(activeIndex);
5829
- }, [activeIndex, onItemSelect]), useClickOutsideEvent(isTopLayer && onClickOutside, () => [ref.current]), useGlobalKeyDown(useCallback((event) => {
5890
+ }, t6 = [activeIndex, onItemSelect], $[20] = onItemSelect, $[21] = activeIndex, $[22] = t5, $[23] = t6) : (t5 = $[22], t6 = $[23]), useEffect(t5, t6);
5891
+ let t7;
5892
+ $[24] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => [ref.current], $[24] = t7) : t7 = $[24], useClickOutsideEvent(isTopLayer && onClickOutside, t7);
5893
+ let t8;
5894
+ $[25] !== isTopLayer || $[26] !== onEscape ? (t8 = (event) => {
5830
5895
  isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
5831
- }, [isTopLayer, onEscape]));
5832
- const value = useMemo(() => ({
5896
+ }, $[25] = isTopLayer, $[26] = onEscape, $[27] = t8) : t8 = $[27], useGlobalKeyDown(t8);
5897
+ let t9, t10;
5898
+ $[28] !== activeElement || $[29] !== activeIndex || $[30] !== mount || $[31] !== onClickOutside || $[32] !== onEscape || $[33] !== onItemClick || $[34] !== handleItemMouseEnter || $[35] !== handleItemMouseLeave || $[36] !== registerElement ? (t10 = {
5833
5899
  version: 0,
5834
5900
  activeElement,
5835
5901
  activeIndex,
@@ -5840,11 +5906,16 @@ const Root$5 = styled(Box)`
5840
5906
  onItemMouseEnter: handleItemMouseEnter,
5841
5907
  onItemMouseLeave: handleItemMouseLeave,
5842
5908
  registerElement,
5843
- // deprecated
5844
5909
  onMouseEnter: handleItemMouseEnter,
5845
5910
  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 }) }) });
5911
+ }, $[28] = activeElement, $[29] = activeIndex, $[30] = mount, $[31] = onClickOutside, $[32] = onEscape, $[33] = onItemClick, $[34] = handleItemMouseEnter, $[35] = handleItemMouseLeave, $[36] = registerElement, $[37] = t10) : t10 = $[37], t9 = t10;
5912
+ const value = t9;
5913
+ let t11;
5914
+ $[38] !== space || $[39] !== children ? (t11 = /* @__PURE__ */ jsx(Stack, { space, children }), $[38] = space, $[39] = children, $[40] = t11) : t11 = $[40];
5915
+ let t12;
5916
+ $[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];
5917
+ let t13;
5918
+ return $[47] !== value || $[48] !== t12 ? (t13 = /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: t12 }), $[47] = value, $[48] = t12, $[49] = t13) : t13 = $[49], t13;
5848
5919
  });
5849
5920
  Menu.displayName = "ForwardRef(Menu)";
5850
5921
  const MenuButton = forwardRef(function(props, forwardedRef) {
@@ -6058,20 +6129,23 @@ function useMenu() {
6058
6129
  return value;
6059
6130
  }
6060
6131
  function MenuGroup(props) {
6061
- const {
6062
- as = "button",
6132
+ const $ = c(77);
6133
+ let t0, t1, t2, t3, t4, t5, onClick, children, IconComponent, text, restProps, popover;
6134
+ $[0] !== props ? ({
6135
+ as: t0,
6063
6136
  children,
6064
- fontSize: fontSize2 = 1,
6137
+ fontSize: t1,
6065
6138
  icon: IconComponent,
6066
6139
  onClick,
6067
- padding = 3,
6140
+ padding: t2,
6068
6141
  popover,
6069
- radius = 2,
6070
- space = 3,
6142
+ radius: t3,
6143
+ space: t4,
6071
6144
  text,
6072
- tone = "default",
6145
+ tone: t5,
6073
6146
  ...restProps
6074
- } = props, menu = useMenu(), {
6147
+ } = 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]);
6148
+ 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
6149
  scheme
6076
6150
  } = useRootTheme(), {
6077
6151
  activeElement,
@@ -6079,56 +6153,99 @@ function MenuGroup(props) {
6079
6153
  onClickOutside,
6080
6154
  onEscape,
6081
6155
  onItemClick,
6082
- onItemMouseEnter = menu.onMouseEnter,
6156
+ onItemMouseEnter: _onItemMouseEnter,
6083
6157
  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) => {
6158
+ } = 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);
6159
+ let t6;
6160
+ $[13] !== onItemMouseEnter ? (t6 = (event) => {
6085
6161
  setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
6086
- }, [onItemMouseEnter]), handleMenuKeyDown = useCallback((event_0) => {
6162
+ }, $[13] = onItemMouseEnter, $[14] = t6) : t6 = $[14];
6163
+ const handleMouseEnter = t6;
6164
+ let t7;
6165
+ $[15] !== rootElement ? (t7 = (event_0) => {
6087
6166
  event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
6088
6167
  rootElement?.focus();
6089
6168
  }));
6090
- }, [rootElement]), handleClick = useCallback((event_1) => {
6169
+ }, $[15] = rootElement, $[16] = t7) : t7 = $[16];
6170
+ const handleMenuKeyDown = t7;
6171
+ let t8;
6172
+ $[17] !== onClick ? (t8 = (event_1) => {
6091
6173
  onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
6092
- }, [onClick]), handleChildItemClick = useCallback(() => {
6174
+ }, $[17] = onClick, $[18] = t8) : t8 = $[18];
6175
+ const handleClick = t8;
6176
+ let t9;
6177
+ $[19] !== onItemClick ? (t9 = () => {
6093
6178
  setOpen(!1), onItemClick?.();
6094
- }, [onItemClick]), handleMenuMouseEnter = useCallback(() => setWithinMenu(!0), []);
6095
- useEffect(() => mount(rootElement), [mount, rootElement]), useEffect(() => {
6179
+ }, $[19] = onItemClick, $[20] = t9) : t9 = $[20];
6180
+ const handleChildItemClick = t9;
6181
+ let t10;
6182
+ $[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[21] = t10) : t10 = $[21];
6183
+ const handleMenuMouseEnter = t10;
6184
+ let t11, t12;
6185
+ $[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);
6186
+ let t13, t14;
6187
+ $[26] !== active ? (t13 = () => {
6096
6188
  active || setOpen(!1);
6097
- }, [active]), useEffect(() => {
6189
+ }, t14 = [active], $[26] = active, $[27] = t13, $[28] = t14) : (t13 = $[27], t14 = $[28]), useEffect(t13, t14);
6190
+ let t15, t16;
6191
+ $[29] !== open ? (t15 = () => {
6098
6192
  open || setWithinMenu(!1);
6099
- }, [open]), useEffect(() => {
6100
- if (!shouldFocus) return;
6193
+ }, t16 = [open], $[29] = open, $[30] = t15, $[31] = t16) : (t15 = $[30], t16 = $[31]), useEffect(t15, t16);
6194
+ let t17, t18;
6195
+ $[32] !== shouldFocus ? (t17 = () => {
6196
+ if (!shouldFocus)
6197
+ return;
6101
6198
  const rafId = requestAnimationFrame(() => setShouldFocus(null));
6102
6199
  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) => {
6200
+ }, t18 = [shouldFocus], $[32] = shouldFocus, $[33] = t17, $[34] = t18) : (t17 = $[33], t18 = $[34]), useEffect(t17, t18);
6201
+ let t19;
6202
+ $[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];
6203
+ const childMenu = t19;
6204
+ let t20;
6205
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
6105
6206
  const target = event_2.currentTarget;
6106
6207
  if (document.activeElement === target && event_2.key === "ArrowRight") {
6107
6208
  setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
6108
6209
  return;
6109
6210
  }
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
- ] }) }) });
6211
+ }, $[43] = t20) : t20 = $[43];
6212
+ 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;
6213
+ let t26;
6214
+ $[44] !== IconComponent || $[45] !== fontSize2 ? (t26 = IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6215
+ isValidElement(IconComponent) && IconComponent,
6216
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
6217
+ ] }), $[44] = IconComponent, $[45] = fontSize2, $[46] = t26) : t26 = $[46];
6218
+ let t27;
6219
+ $[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];
6220
+ let t28;
6221
+ $[50] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsx(ChevronRightIcon, {}), $[50] = t28) : t28 = $[50];
6222
+ let t29;
6223
+ $[51] !== fontSize2 ? (t29 = /* @__PURE__ */ jsx(Text, { size: fontSize2, children: t28 }), $[51] = fontSize2, $[52] = t29) : t29 = $[52];
6224
+ let t30;
6225
+ $[53] !== space || $[54] !== padding || $[55] !== t26 || $[56] !== t27 || $[57] !== t29 ? (t30 = /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
6226
+ t26,
6227
+ t27,
6228
+ t29
6229
+ ] }), $[53] = space, $[54] = padding, $[55] = t26, $[56] = t27, $[57] = t29, $[58] = t30) : t30 = $[58];
6230
+ let t31;
6231
+ $[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];
6232
+ let t32;
6233
+ 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
6234
  }
6120
6235
  MenuGroup.displayName = "MenuGroup";
6121
6236
  const MenuItem = forwardRef(function(props, forwardedRef) {
6122
- const {
6123
- as = "button",
6237
+ const $ = c(74);
6238
+ let t0, t1, t2, t3, t4, t5, selectedProp, disabled, onClick, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, pressed, IconComponent, text, IconRightComponent, hotkeys, children, restProps;
6239
+ $[0] !== props ? ({
6240
+ as: t0,
6124
6241
  children,
6125
6242
  disabled,
6126
- fontSize: fontSize2 = 1,
6243
+ fontSize: t1,
6127
6244
  hotkeys,
6128
6245
  icon: IconComponent,
6129
6246
  iconRight: IconRightComponent,
6130
6247
  onClick,
6131
- padding = 3,
6248
+ padding: t2,
6132
6249
  paddingX,
6133
6250
  paddingY,
6134
6251
  paddingTop,
@@ -6136,25 +6253,33 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
6136
6253
  paddingBottom,
6137
6254
  paddingLeft,
6138
6255
  pressed,
6139
- radius = 2,
6256
+ radius: t3,
6140
6257
  selected: selectedProp,
6141
- space = 3,
6258
+ space: t4,
6142
6259
  text,
6143
- tone = "default",
6260
+ tone: t5,
6144
6261
  ...restProps
6145
- } = props, {
6262
+ } = 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]);
6263
+ 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
6264
  scheme
6147
6265
  } = useRootTheme(), menu = useMenu(), {
6148
6266
  activeElement,
6149
6267
  mount,
6150
6268
  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) => {
6269
+ onItemMouseEnter: _onItemMouseEnter,
6270
+ onItemMouseLeave: _onItemMouseLeave
6271
+ } = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu.onMouseLeave, [rootElement, setRootElement] = useState(null), active = !!activeElement && activeElement === rootElement, ref = useRef(null);
6272
+ let t6;
6273
+ $[23] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[23] = t6) : t6 = $[23], useImperativeHandle(forwardedRef, t6);
6274
+ let t7, t8;
6275
+ $[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);
6276
+ let t9;
6277
+ $[29] !== disabled || $[30] !== onClick || $[31] !== onItemClick ? (t9 = (event) => {
6156
6278
  disabled || (onClick && onClick(event), onItemClick && onItemClick());
6157
- }, [disabled, onClick, onItemClick]), paddingProps = useMemo(() => ({
6279
+ }, $[29] = disabled, $[30] = onClick, $[31] = onItemClick, $[32] = t9) : t9 = $[32];
6280
+ const handleClick = t9;
6281
+ let t10, t11;
6282
+ $[33] !== padding || $[34] !== paddingX || $[35] !== paddingY || $[36] !== paddingTop || $[37] !== paddingRight || $[38] !== paddingBottom || $[39] !== paddingLeft ? (t11 = {
6158
6283
  padding,
6159
6284
  paddingX,
6160
6285
  paddingY,
@@ -6162,29 +6287,44 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
6162
6287
  paddingRight,
6163
6288
  paddingBottom,
6164
6289
  paddingLeft
6165
- }), [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]), hotkeysFontSize = useArrayProp(fontSize2).map((s) => s - 1), setRef = useCallback((el) => {
6290
+ }, $[33] = padding, $[34] = paddingX, $[35] = paddingY, $[36] = paddingTop, $[37] = paddingRight, $[38] = paddingBottom, $[39] = paddingLeft, $[40] = t11) : t11 = $[40], t10 = t11;
6291
+ const paddingProps = t10, t12 = useArrayProp(fontSize2);
6292
+ let t13;
6293
+ $[41] !== t12 ? (t13 = t12.map(_temp$1), $[41] = t12, $[42] = t13) : t13 = $[42];
6294
+ const hotkeysFontSize = t13;
6295
+ let t14;
6296
+ $[43] === Symbol.for("react.memo_cache_sentinel") ? (t14 = (el) => {
6166
6297
  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
- ] })
6298
+ }, $[43] = t14) : t14 = $[43];
6299
+ 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;
6300
+ let t23;
6301
+ $[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: [
6302
+ IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6303
+ isValidElement(IconComponent) && IconComponent,
6304
+ isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
6183
6305
  ] }),
6184
- children && /* @__PURE__ */ jsx(Box, { as: "span", ...paddingProps, children })
6185
- ] });
6306
+ text && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
6307
+ hotkeys && /* @__PURE__ */ jsx(Hotkeys, { fontSize: hotkeysFontSize, keys: hotkeys, style: {
6308
+ marginTop: -4,
6309
+ marginBottom: -4
6310
+ } }),
6311
+ IconRightComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
6312
+ isValidElement(IconRightComponent) && IconRightComponent,
6313
+ isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
6314
+ ] })
6315
+ ] }), $[44] = IconComponent, $[45] = text, $[46] = IconRightComponent, $[47] = fontSize2, $[48] = hotkeys, $[49] = hotkeysFontSize, $[50] = space, $[51] = paddingProps, $[52] = t23) : t23 = $[52];
6316
+ let t24;
6317
+ $[53] !== children || $[54] !== paddingProps ? (t24 = children && /* @__PURE__ */ jsx(Box, { as: "span", ...paddingProps, children }), $[53] = children, $[54] = paddingProps, $[55] = t24) : t24 = $[55];
6318
+ let t25;
6319
+ 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: [
6320
+ t23,
6321
+ t24
6322
+ ] }), $[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
6323
  });
6187
6324
  MenuItem.displayName = "ForwardRef(MenuItem)";
6325
+ function _temp$1(s) {
6326
+ return s - 1;
6327
+ }
6188
6328
  const keyframe = keyframes`
6189
6329
  0% {
6190
6330
  background-position: 100%;