@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 +309 -169
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +308 -168
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +309 -169
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/dialog/dialog.tsx +4 -2
- package/src/core/components/menu/menu.tsx +3 -1
- package/src/core/components/menu/menuGroup.tsx +2 -1
- package/src/core/components/menu/menuItem.tsx +4 -2
- package/src/core/primitives/avatar/avatarStack.tsx +2 -5
- package/src/core/primitives/popover/popover.tsx +24 -27
- package/src/core/primitives/tooltip/tooltip.tsx +7 -4
- package/src/core/theme/themeProvider.tsx +4 -6
- package/src/core/utils/elementQuery/elementQuery.tsx +2 -1
package/dist/index.js
CHANGED
|
@@ -202,7 +202,7 @@ function useClickOutside(listener, t0, boundaryElement) {
|
|
|
202
202
|
}, t5 = [boundaryElement, listener, elements], $[7] = listener, $[8] = boundaryElement, $[9] = elements, $[10] = t4, $[11] = t5) : (t4 = $[10], t5 = $[11]), react.useEffect(t4, t5), setElement;
|
|
203
203
|
}
|
|
204
204
|
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
205
|
-
const $ = reactCompilerRuntime.c(8), elementsArg = t0 === void 0 ? _temp$
|
|
205
|
+
const $ = reactCompilerRuntime.c(8), elementsArg = t0 === void 0 ? _temp$6 : t0;
|
|
206
206
|
let t1;
|
|
207
207
|
$[0] !== listener || $[1] !== boundaryElement || $[2] !== elementsArg ? (t1 = (evt) => {
|
|
208
208
|
if (!listener)
|
|
@@ -230,7 +230,7 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
|
230
230
|
};
|
|
231
231
|
}, t3 = [hasListener, onEvent], $[4] = hasListener, $[5] = onEvent, $[6] = t2, $[7] = t3) : (t2 = $[6], t3 = $[7]), react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
232
232
|
}
|
|
233
|
-
function _temp$
|
|
233
|
+
function _temp$6() {
|
|
234
234
|
return EMPTY_ARRAY;
|
|
235
235
|
}
|
|
236
236
|
function useCustomValidity(ref, customValidity) {
|
|
@@ -616,18 +616,42 @@ function createGlobalScopedContext(key2, defaultValue) {
|
|
|
616
616
|
}
|
|
617
617
|
const ThemeContext = createGlobalScopedContext("@sanity/ui/context/theme", null);
|
|
618
618
|
function ThemeProvider(props) {
|
|
619
|
-
const parentTheme = react.useContext(ThemeContext), {
|
|
620
|
-
children
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
619
|
+
const $ = reactCompilerRuntime.c(15), parentTheme = react.useContext(ThemeContext), {
|
|
620
|
+
children
|
|
621
|
+
} = props, scheme = props.scheme ?? (parentTheme?.scheme || "light"), rootTheme = props.theme ?? (parentTheme?.theme || null), tone = props.tone ?? (parentTheme?.tone || "default");
|
|
622
|
+
let t0;
|
|
623
|
+
bb0: {
|
|
624
|
+
if (!rootTheme) {
|
|
625
|
+
t0 = null;
|
|
626
|
+
break bb0;
|
|
627
|
+
}
|
|
628
|
+
let t12;
|
|
629
|
+
$[0] !== rootTheme || $[1] !== scheme || $[2] !== tone ? (t12 = {
|
|
630
|
+
version: 0,
|
|
631
|
+
theme: rootTheme,
|
|
632
|
+
scheme,
|
|
633
|
+
tone
|
|
634
|
+
}, $[0] = rootTheme, $[1] = scheme, $[2] = tone, $[3] = t12) : t12 = $[3], t0 = t12;
|
|
635
|
+
}
|
|
636
|
+
const themeContext = t0;
|
|
637
|
+
let t1;
|
|
638
|
+
bb1: {
|
|
639
|
+
if (!rootTheme) {
|
|
640
|
+
t1 = null;
|
|
641
|
+
break bb1;
|
|
642
|
+
}
|
|
643
|
+
let t22;
|
|
644
|
+
$[4] !== rootTheme || $[5] !== scheme || $[6] !== tone ? (t22 = theme.getScopedTheme(rootTheme, scheme, tone), $[4] = rootTheme, $[5] = scheme, $[6] = tone, $[7] = t22) : t22 = $[7], t1 = t22;
|
|
645
|
+
}
|
|
646
|
+
const theme$1 = t1;
|
|
647
|
+
if (!theme$1) {
|
|
648
|
+
let t22;
|
|
649
|
+
return $[8] === Symbol.for("react.memo_cache_sentinel") ? (t22 = /* @__PURE__ */ jsxRuntime.jsx("pre", { children: 'ThemeProvider: no "theme" property provided' }), $[8] = t22) : t22 = $[8], t22;
|
|
650
|
+
}
|
|
651
|
+
let t2;
|
|
652
|
+
$[9] !== theme$1 || $[10] !== children ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(styledComponents.ThemeProvider, { theme: theme$1, children }), $[9] = theme$1, $[10] = children, $[11] = t2) : t2 = $[11];
|
|
653
|
+
let t3;
|
|
654
|
+
return $[12] !== themeContext || $[13] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: themeContext, children: t2 }), $[12] = themeContext, $[13] = t2, $[14] = t3) : t3 = $[14], t3;
|
|
631
655
|
}
|
|
632
656
|
ThemeProvider.displayName = "ThemeProvider";
|
|
633
657
|
function useRootTheme() {
|
|
@@ -712,15 +736,15 @@ function useMediaIndex() {
|
|
|
712
736
|
return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
713
737
|
}
|
|
714
738
|
function usePrefersDark(t0) {
|
|
715
|
-
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$
|
|
739
|
+
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$5 : t0);
|
|
716
740
|
}
|
|
717
|
-
function _temp$
|
|
741
|
+
function _temp$5() {
|
|
718
742
|
return !1;
|
|
719
743
|
}
|
|
720
744
|
function usePrefersReducedMotion(t0) {
|
|
721
|
-
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$
|
|
745
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$4 : t0);
|
|
722
746
|
}
|
|
723
|
-
function _temp$
|
|
747
|
+
function _temp$4() {
|
|
724
748
|
return !1;
|
|
725
749
|
}
|
|
726
750
|
function responsiveBorderStyle() {
|
|
@@ -1753,19 +1777,26 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
1753
1777
|
});
|
|
1754
1778
|
}
|
|
1755
1779
|
const Root$z = styledComponents.styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), AvatarStack = react.forwardRef(function(props, ref) {
|
|
1756
|
-
const
|
|
1780
|
+
const $ = reactCompilerRuntime.c(15);
|
|
1781
|
+
let t0, t1, childrenProp, restProps;
|
|
1782
|
+
$[0] !== props ? ({
|
|
1757
1783
|
children: childrenProp,
|
|
1758
|
-
maxLength:
|
|
1759
|
-
size:
|
|
1784
|
+
maxLength: t0,
|
|
1785
|
+
size: t1,
|
|
1760
1786
|
...restProps
|
|
1761
|
-
} = props,
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1787
|
+
} = props, $[0] = props, $[1] = t0, $[2] = t1, $[3] = childrenProp, $[4] = restProps) : (t0 = $[1], t1 = $[2], childrenProp = $[3], restProps = $[4]);
|
|
1788
|
+
const maxLengthProp = t0 === void 0 ? 4 : t0, sizeProp = t1 === void 0 ? 1 : t1, children = react.Children.toArray(childrenProp).filter(react.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__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: len, size: size2 }) }), t4 = len !== 0 && extraCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AvatarCounter, { count: extraCount, size: size2 }) });
|
|
1789
|
+
let t5;
|
|
1790
|
+
$[5] !== size2 ? (t5 = (child, childIndex) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: react.cloneElement(child, {
|
|
1791
|
+
size: size2
|
|
1792
|
+
}) }, String(childIndex)), $[5] = size2, $[6] = t5) : t5 = $[6];
|
|
1793
|
+
const t6 = visibleChildren.map(t5);
|
|
1794
|
+
let t7;
|
|
1795
|
+
return $[7] !== T0 || $[8] !== restProps || $[9] !== ref || $[10] !== size2 || $[11] !== t3 || $[12] !== t4 || $[13] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsxs(T0, { "data-ui": t2, ...restProps, ref, $size: size2, children: [
|
|
1796
|
+
t3,
|
|
1797
|
+
t4,
|
|
1798
|
+
t6
|
|
1799
|
+
] }), $[7] = T0, $[8] = restProps, $[9] = ref, $[10] = size2, $[11] = t3, $[12] = t4, $[13] = t6, $[14] = t7) : t7 = $[14], t7;
|
|
1769
1800
|
});
|
|
1770
1801
|
AvatarStack.displayName = "ForwardRef(AvatarStack)";
|
|
1771
1802
|
const Root$y = styledComponents.styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = react.forwardRef(function(props, ref) {
|
|
@@ -3186,9 +3217,9 @@ function findMinBreakpoints(media, width) {
|
|
|
3186
3217
|
const ElementQuery = react.forwardRef(function(props, forwardedRef) {
|
|
3187
3218
|
const theme2 = useTheme_v2(), {
|
|
3188
3219
|
children,
|
|
3189
|
-
media
|
|
3220
|
+
media: _media,
|
|
3190
3221
|
...restProps
|
|
3191
|
-
} = props, ref = react.useRef(null), [element, setElement] = react.useState(null), elementSize = useElementSize(element), width = react.useMemo(() => elementSize?.border.width ?? window.innerWidth, [elementSize]), max = react.useMemo(() => findMaxBreakpoints(media, width), [media, width]), min = react.useMemo(() => findMinBreakpoints(media, width), [media, width]);
|
|
3222
|
+
} = props, media = _media ?? theme2.media, ref = react.useRef(null), [element, setElement] = react.useState(null), elementSize = useElementSize(element), width = react.useMemo(() => elementSize?.border.width ?? window.innerWidth, [elementSize]), max = react.useMemo(() => findMaxBreakpoints(media, width), [media, width]), min = react.useMemo(() => findMinBreakpoints(media, width), [media, width]);
|
|
3192
3223
|
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
3193
3224
|
const setRef = react.useCallback((el) => {
|
|
3194
3225
|
ref.current = el, setElement(el);
|
|
@@ -3439,7 +3470,7 @@ function PortalProvider(props) {
|
|
|
3439
3470
|
children,
|
|
3440
3471
|
element,
|
|
3441
3472
|
__unstable_elements: elementsProp
|
|
3442
|
-
} = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$
|
|
3473
|
+
} = props, elements = useUnique(elementsProp), fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$3, _temp2$1);
|
|
3443
3474
|
let t0;
|
|
3444
3475
|
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
3445
3476
|
let t3;
|
|
@@ -3456,7 +3487,7 @@ function PortalProvider(props) {
|
|
|
3456
3487
|
function _temp2$1() {
|
|
3457
3488
|
return null;
|
|
3458
3489
|
}
|
|
3459
|
-
function _temp$
|
|
3490
|
+
function _temp$3() {
|
|
3460
3491
|
return document.body;
|
|
3461
3492
|
}
|
|
3462
3493
|
PortalProvider.displayName = "PortalProvider";
|
|
@@ -3772,14 +3803,14 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3772
3803
|
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
3773
3804
|
animate: _animate = !1,
|
|
3774
3805
|
arrow: arrowProp = !1,
|
|
3775
|
-
boundaryElement
|
|
3806
|
+
boundaryElement: _boundaryElement,
|
|
3776
3807
|
children: childProp,
|
|
3777
3808
|
constrainSize = !1,
|
|
3778
3809
|
content,
|
|
3779
3810
|
disabled,
|
|
3780
|
-
fallbackPlacements
|
|
3811
|
+
fallbackPlacements: _fallbackPlacements,
|
|
3781
3812
|
matchReferenceWidth,
|
|
3782
|
-
floatingBoundary
|
|
3813
|
+
floatingBoundary: _floatingBoundary,
|
|
3783
3814
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3784
3815
|
onActivate,
|
|
3785
3816
|
open,
|
|
@@ -3789,16 +3820,16 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3789
3820
|
portal,
|
|
3790
3821
|
preventOverflow = !0,
|
|
3791
3822
|
radius: radiusProp = 3,
|
|
3792
|
-
referenceBoundary
|
|
3823
|
+
referenceBoundary: _referenceBoundary,
|
|
3793
3824
|
referenceElement,
|
|
3794
3825
|
scheme,
|
|
3795
3826
|
shadow: shadowProp = 3,
|
|
3796
3827
|
tone = "inherit",
|
|
3797
3828
|
width: widthProp = "auto",
|
|
3798
|
-
zOffset:
|
|
3829
|
+
zOffset: _zOffsetProp,
|
|
3799
3830
|
updateRef,
|
|
3800
3831
|
...restProps
|
|
3801
|
-
} = 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 = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
|
|
3832
|
+
} = 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 = react.useRef(null), arrowRef = react.useRef(null), rootBoundary = "viewport";
|
|
3802
3833
|
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
3803
3834
|
const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
|
|
3804
3835
|
container,
|
|
@@ -3816,11 +3847,11 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3816
3847
|
maxWidthRef.current = maxWidth;
|
|
3817
3848
|
}, [maxWidth]);
|
|
3818
3849
|
const referenceWidthRef = react.useRef();
|
|
3819
|
-
react.
|
|
3850
|
+
react.useLayoutEffect(() => {
|
|
3820
3851
|
const floatingElement = ref.current;
|
|
3821
3852
|
if (!open || !floatingElement) return;
|
|
3822
3853
|
const referenceWidth = referenceWidthRef.current;
|
|
3823
|
-
matchReferenceWidth ?
|
|
3854
|
+
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`);
|
|
3824
3855
|
}, [width, matchReferenceWidth, maxWidth, open]);
|
|
3825
3856
|
const middleware = react.useMemo(() => {
|
|
3826
3857
|
const ret = [];
|
|
@@ -3875,16 +3906,14 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3875
3906
|
arrowRef.current = arrowEl;
|
|
3876
3907
|
}, []), setFloating = react.useCallback((node) => {
|
|
3877
3908
|
ref.current = node, refs.setFloating(node);
|
|
3878
|
-
}, [refs]), setReference = react.useCallback((node_0) => {
|
|
3879
|
-
refs.setReference(node_0);
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3909
|
+
}, [refs]), [childElement, setChildElement] = react.useState(null), setReference = react.useCallback((node_0) => {
|
|
3910
|
+
refs.setReference(node_0), setChildElement(node_0);
|
|
3911
|
+
}, [refs]);
|
|
3912
|
+
react.useImperativeHandle(getElementRef(childProp), () => childElement, [childElement]);
|
|
3913
|
+
const child = react.useMemo(() => !childProp || referenceElement ? null : react.cloneElement(childProp, {
|
|
3883
3914
|
ref: setReference
|
|
3884
3915
|
}), [childProp, referenceElement, setReference]);
|
|
3885
|
-
if (react.useEffect(() => {
|
|
3886
|
-
updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
|
|
3887
|
-
}, [update, updateRef]), react.useEffect(() => {
|
|
3916
|
+
if (react.useImperativeHandle(updateRef, () => update, [update]), react.useEffect(() => {
|
|
3888
3917
|
child || refs.setReference(referenceElement || null);
|
|
3889
3918
|
}, [referenceElement, refs, child]), disabled)
|
|
3890
3919
|
return childProp || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
@@ -3896,6 +3925,7 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3896
3925
|
}));
|
|
3897
3926
|
Popover.displayName = "Memo(ForwardRef(Popover))";
|
|
3898
3927
|
function getElementRef(element) {
|
|
3928
|
+
if (!element) return null;
|
|
3899
3929
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
3900
3930
|
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);
|
|
3901
3931
|
}
|
|
@@ -4545,7 +4575,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4545
4575
|
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 = react.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;
|
|
4546
4576
|
let t7;
|
|
4547
4577
|
$[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], react.useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
|
|
4548
|
-
const handleClearMouseDown = _temp$
|
|
4578
|
+
const handleClearMouseDown = _temp$2;
|
|
4549
4579
|
let t8;
|
|
4550
4580
|
$[20] !== onClear ? (t8 = (event_0) => {
|
|
4551
4581
|
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
@@ -4613,7 +4643,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4613
4643
|
] }), $[81] = rootTheme.tone, $[82] = prefixNode, $[83] = t27, $[84] = suffixNode, $[85] = t28) : t28 = $[85], t28;
|
|
4614
4644
|
});
|
|
4615
4645
|
TextInput.displayName = "ForwardRef(TextInput)";
|
|
4616
|
-
function _temp$
|
|
4646
|
+
function _temp$2(event) {
|
|
4617
4647
|
event.preventDefault(), event.stopPropagation();
|
|
4618
4648
|
}
|
|
4619
4649
|
function useDelayedState(initialState) {
|
|
@@ -4733,21 +4763,21 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4733
4763
|
} = useTheme_v2(), {
|
|
4734
4764
|
animate: _animate = !1,
|
|
4735
4765
|
arrow: arrowProp = !1,
|
|
4736
|
-
boundaryElement
|
|
4766
|
+
boundaryElement: _boundaryElement,
|
|
4737
4767
|
children: childProp,
|
|
4738
4768
|
content,
|
|
4739
4769
|
disabled,
|
|
4740
|
-
fallbackPlacements:
|
|
4770
|
+
fallbackPlacements: _fallbackPlacementsProp,
|
|
4741
4771
|
padding = 2,
|
|
4742
4772
|
placement: placementProp = "bottom",
|
|
4743
4773
|
portal: portalProp,
|
|
4744
4774
|
radius = 2,
|
|
4745
4775
|
scheme,
|
|
4746
4776
|
shadow = 2,
|
|
4747
|
-
zOffset
|
|
4777
|
+
zOffset: _zOffset,
|
|
4748
4778
|
delay,
|
|
4749
4779
|
...restProps
|
|
4750
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, fallbackPlacements = useArrayProp(fallbackPlacementsProp), ref = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
|
|
4780
|
+
} = 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 = react.useRef(null), [referenceElement, setReferenceElement] = react.useState(null), arrowRef = react.useRef(null), rootBoundary = "viewport", [tooltipMaxWidth, setTooltipMaxWidth] = react.useState(0);
|
|
4751
4781
|
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
4752
4782
|
const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
|
|
4753
4783
|
const ret = [];
|
|
@@ -5497,13 +5527,15 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5497
5527
|
});
|
|
5498
5528
|
DialogCard.displayName = "ForwardRef(DialogCard)";
|
|
5499
5529
|
const Dialog = react.forwardRef(function(props, ref) {
|
|
5500
|
-
const dialog = useDialog(), {
|
|
5530
|
+
const $ = reactCompilerRuntime.c(60), dialog = useDialog(), {
|
|
5501
5531
|
layer
|
|
5502
|
-
} = useTheme_v2()
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5532
|
+
} = useTheme_v2();
|
|
5533
|
+
let t0, t1, t2, t3, t4, t5, t6, _positionProp, _zOffsetProp, portalProp, onFocus, id, contentRef, footer, header, onClickOutside, onClose, scheme, children, restProps, onActivate;
|
|
5534
|
+
$[0] !== props ? ({
|
|
5535
|
+
__unstable_autoFocus: t0,
|
|
5536
|
+
__unstable_hideCloseButton: t1,
|
|
5537
|
+
cardRadius: t2,
|
|
5538
|
+
cardShadow: t3,
|
|
5507
5539
|
children,
|
|
5508
5540
|
contentRef,
|
|
5509
5541
|
footer,
|
|
@@ -5513,15 +5545,18 @@ const Dialog = react.forwardRef(function(props, ref) {
|
|
|
5513
5545
|
onClickOutside,
|
|
5514
5546
|
onClose,
|
|
5515
5547
|
onFocus,
|
|
5516
|
-
padding:
|
|
5548
|
+
padding: t4,
|
|
5517
5549
|
portal: portalProp,
|
|
5518
|
-
position:
|
|
5550
|
+
position: _positionProp,
|
|
5519
5551
|
scheme,
|
|
5520
|
-
width:
|
|
5521
|
-
zOffset:
|
|
5522
|
-
animate:
|
|
5552
|
+
width: t5,
|
|
5553
|
+
zOffset: _zOffsetProp,
|
|
5554
|
+
animate: t6,
|
|
5523
5555
|
...restProps
|
|
5524
|
-
} = props,
|
|
5556
|
+
} = 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]);
|
|
5557
|
+
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 = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
|
|
5558
|
+
let t7;
|
|
5559
|
+
$[22] !== onFocus ? (t7 = (event) => {
|
|
5525
5560
|
onFocus?.(event);
|
|
5526
5561
|
const target = event.target, cardElement = cardRef.current;
|
|
5527
5562
|
if (cardElement && target === preDivRef.current) {
|
|
@@ -5533,7 +5568,10 @@ const Dialog = react.forwardRef(function(props, ref) {
|
|
|
5533
5568
|
return;
|
|
5534
5569
|
}
|
|
5535
5570
|
isHTMLElement(event.target) && (focusedElementRef.current = event.target);
|
|
5536
|
-
}, [
|
|
5571
|
+
}, $[22] = onFocus, $[23] = t7) : t7 = $[23];
|
|
5572
|
+
const handleFocus = t7, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef();
|
|
5573
|
+
let t8;
|
|
5574
|
+
$[24] !== boundaryElement || $[25] !== portalElement ? (t8 = () => {
|
|
5537
5575
|
rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
|
|
5538
5576
|
const activeElement = document.activeElement;
|
|
5539
5577
|
if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
|
|
@@ -5546,12 +5584,22 @@ const Dialog = react.forwardRef(function(props, ref) {
|
|
|
5546
5584
|
target_0.focus();
|
|
5547
5585
|
}
|
|
5548
5586
|
}, 0);
|
|
5549
|
-
}, [boundaryElement, portalElement]);
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
] })
|
|
5587
|
+
}, $[24] = boundaryElement, $[25] = portalElement, $[26] = t8) : t8 = $[26];
|
|
5588
|
+
const handleRootClick = t8;
|
|
5589
|
+
let t9;
|
|
5590
|
+
$[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[27] = t9) : t9 = $[27];
|
|
5591
|
+
let t10;
|
|
5592
|
+
$[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__ */ jsxRuntime.jsx(DialogCard, { __unstable_autoFocus: autoFocus, __unstable_hideCloseButton: hideCloseButton, contentRef, footer, header, id, onClickOutside, onClose, portal: portalProp, radius: cardRadius, ref: cardRef, scheme, shadow: cardShadow, width, children }), $[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];
|
|
5593
|
+
let t11;
|
|
5594
|
+
$[43] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[43] = t11) : t11 = $[43];
|
|
5595
|
+
let t12;
|
|
5596
|
+
$[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__ */ jsxRuntime.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: [
|
|
5597
|
+
t9,
|
|
5598
|
+
t10,
|
|
5599
|
+
t11
|
|
5600
|
+
] }), $[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];
|
|
5601
|
+
let t13;
|
|
5602
|
+
return $[57] !== portalProp || $[58] !== t12 ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(Portal, { __unstable_name: portalProp, children: t12 }), $[57] = portalProp, $[58] = t12, $[59] = t13) : t13 = $[59], t13;
|
|
5555
5603
|
});
|
|
5556
5604
|
Dialog.displayName = "ForwardRef(Dialog)";
|
|
5557
5605
|
function DialogProvider(props) {
|
|
@@ -5782,48 +5830,66 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5782
5830
|
outline: none;
|
|
5783
5831
|
overflow: auto;
|
|
5784
5832
|
`, Menu = react.forwardRef(function(props, forwardedRef) {
|
|
5833
|
+
const $ = reactCompilerRuntime.c(50);
|
|
5834
|
+
let t0, t1, _shouldFocus, onKeyDown, originElement, registerElement, onItemSelect, onClickOutside, onEscape, onItemClick, children, restProps;
|
|
5835
|
+
if ($[0] !== props) {
|
|
5836
|
+
const {
|
|
5837
|
+
children: t22,
|
|
5838
|
+
focusFirst,
|
|
5839
|
+
focusLast,
|
|
5840
|
+
onClickOutside: t32,
|
|
5841
|
+
onEscape: t42,
|
|
5842
|
+
onItemClick: t52,
|
|
5843
|
+
onItemSelect: t62,
|
|
5844
|
+
onKeyDown: t72,
|
|
5845
|
+
originElement: t82,
|
|
5846
|
+
padding: t92,
|
|
5847
|
+
registerElement: t102,
|
|
5848
|
+
shouldFocus: t112,
|
|
5849
|
+
space: t122,
|
|
5850
|
+
...t132
|
|
5851
|
+
} = props;
|
|
5852
|
+
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;
|
|
5853
|
+
} else
|
|
5854
|
+
t0 = $[1], t1 = $[2], _shouldFocus = $[3], onKeyDown = $[4], originElement = $[5], registerElement = $[6], onItemSelect = $[7], onClickOutside = $[8], onEscape = $[9], onItemClick = $[10], children = $[11], restProps = $[12];
|
|
5855
|
+
const padding = t0 === void 0 ? 1 : t0, space = t1 === void 0 ? 1 : t1, shouldFocus = _shouldFocus ?? (props.focusFirst && "first" || props.focusLast && "last" || null), ref = react.useRef(null);
|
|
5856
|
+
let t2;
|
|
5857
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[13] = t2) : t2 = $[13], react.useImperativeHandle(forwardedRef, t2);
|
|
5785
5858
|
const {
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
focusLast,
|
|
5791
|
-
onClickOutside,
|
|
5792
|
-
onEscape,
|
|
5793
|
-
onItemClick,
|
|
5794
|
-
onItemSelect,
|
|
5859
|
+
isTopLayer
|
|
5860
|
+
} = useLayer();
|
|
5861
|
+
let t3;
|
|
5862
|
+
$[14] !== onKeyDown || $[15] !== originElement || $[16] !== shouldFocus ? (t3 = {
|
|
5795
5863
|
onKeyDown,
|
|
5796
5864
|
originElement,
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
space = 1,
|
|
5801
|
-
...restProps
|
|
5802
|
-
} = props, ref = react.useRef(null);
|
|
5803
|
-
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
5865
|
+
shouldFocus,
|
|
5866
|
+
rootElementRef: ref
|
|
5867
|
+
}, $[14] = onKeyDown, $[15] = originElement, $[16] = shouldFocus, $[17] = t3) : t3 = $[17];
|
|
5804
5868
|
const {
|
|
5805
|
-
isTopLayer
|
|
5806
|
-
} = useLayer(), {
|
|
5807
5869
|
activeElement,
|
|
5808
5870
|
activeIndex,
|
|
5809
5871
|
handleItemMouseEnter,
|
|
5810
5872
|
handleItemMouseLeave,
|
|
5811
5873
|
handleKeyDown,
|
|
5812
5874
|
mount
|
|
5813
|
-
} = useMenuController(
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
shouldFocus,
|
|
5817
|
-
rootElementRef: ref
|
|
5818
|
-
}), unregisterElementRef = react.useRef(null), handleRefChange = react.useCallback((el) => {
|
|
5875
|
+
} = useMenuController(t3), unregisterElementRef = react.useRef(null);
|
|
5876
|
+
let t4;
|
|
5877
|
+
$[18] !== registerElement ? (t4 = (el) => {
|
|
5819
5878
|
unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
|
|
5820
|
-
}, [registerElement]);
|
|
5821
|
-
|
|
5879
|
+
}, $[18] = registerElement, $[19] = t4) : t4 = $[19];
|
|
5880
|
+
const handleRefChange = t4;
|
|
5881
|
+
let t5, t6;
|
|
5882
|
+
$[20] !== onItemSelect || $[21] !== activeIndex ? (t5 = () => {
|
|
5822
5883
|
onItemSelect && onItemSelect(activeIndex);
|
|
5823
|
-
}, [activeIndex, onItemSelect]
|
|
5884
|
+
}, t6 = [activeIndex, onItemSelect], $[20] = onItemSelect, $[21] = activeIndex, $[22] = t5, $[23] = t6) : (t5 = $[22], t6 = $[23]), react.useEffect(t5, t6);
|
|
5885
|
+
let t7;
|
|
5886
|
+
$[24] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => [ref.current], $[24] = t7) : t7 = $[24], useClickOutsideEvent(isTopLayer && onClickOutside, t7);
|
|
5887
|
+
let t8;
|
|
5888
|
+
$[25] !== isTopLayer || $[26] !== onEscape ? (t8 = (event) => {
|
|
5824
5889
|
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|
|
5825
|
-
}, [isTopLayer, onEscape]));
|
|
5826
|
-
|
|
5890
|
+
}, $[25] = isTopLayer, $[26] = onEscape, $[27] = t8) : t8 = $[27], useGlobalKeyDown(t8);
|
|
5891
|
+
let t9, t10;
|
|
5892
|
+
$[28] !== activeElement || $[29] !== activeIndex || $[30] !== mount || $[31] !== onClickOutside || $[32] !== onEscape || $[33] !== onItemClick || $[34] !== handleItemMouseEnter || $[35] !== handleItemMouseLeave || $[36] !== registerElement ? (t10 = {
|
|
5827
5893
|
version: 0,
|
|
5828
5894
|
activeElement,
|
|
5829
5895
|
activeIndex,
|
|
@@ -5834,11 +5900,16 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5834
5900
|
onItemMouseEnter: handleItemMouseEnter,
|
|
5835
5901
|
onItemMouseLeave: handleItemMouseLeave,
|
|
5836
5902
|
registerElement,
|
|
5837
|
-
// deprecated
|
|
5838
5903
|
onMouseEnter: handleItemMouseEnter,
|
|
5839
5904
|
onMouseLeave: handleItemMouseLeave
|
|
5840
|
-
}
|
|
5841
|
-
|
|
5905
|
+
}, $[28] = activeElement, $[29] = activeIndex, $[30] = mount, $[31] = onClickOutside, $[32] = onEscape, $[33] = onItemClick, $[34] = handleItemMouseEnter, $[35] = handleItemMouseLeave, $[36] = registerElement, $[37] = t10) : t10 = $[37], t9 = t10;
|
|
5906
|
+
const value = t9;
|
|
5907
|
+
let t11;
|
|
5908
|
+
$[38] !== space || $[39] !== children ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { space, children }), $[38] = space, $[39] = children, $[40] = t11) : t11 = $[40];
|
|
5909
|
+
let t12;
|
|
5910
|
+
$[41] !== restProps || $[42] !== handleKeyDown || $[43] !== padding || $[44] !== handleRefChange || $[45] !== t11 ? (t12 = /* @__PURE__ */ jsxRuntime.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];
|
|
5911
|
+
let t13;
|
|
5912
|
+
return $[47] !== value || $[48] !== t12 ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value, children: t12 }), $[47] = value, $[48] = t12, $[49] = t13) : t13 = $[49], t13;
|
|
5842
5913
|
});
|
|
5843
5914
|
Menu.displayName = "ForwardRef(Menu)";
|
|
5844
5915
|
const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
@@ -6052,20 +6123,23 @@ function useMenu() {
|
|
|
6052
6123
|
return value;
|
|
6053
6124
|
}
|
|
6054
6125
|
function MenuGroup(props) {
|
|
6055
|
-
const
|
|
6056
|
-
|
|
6126
|
+
const $ = reactCompilerRuntime.c(77);
|
|
6127
|
+
let t0, t1, t2, t3, t4, t5, onClick, children, IconComponent, text, restProps, popover;
|
|
6128
|
+
$[0] !== props ? ({
|
|
6129
|
+
as: t0,
|
|
6057
6130
|
children,
|
|
6058
|
-
fontSize:
|
|
6131
|
+
fontSize: t1,
|
|
6059
6132
|
icon: IconComponent,
|
|
6060
6133
|
onClick,
|
|
6061
|
-
padding
|
|
6134
|
+
padding: t2,
|
|
6062
6135
|
popover,
|
|
6063
|
-
radius
|
|
6064
|
-
space
|
|
6136
|
+
radius: t3,
|
|
6137
|
+
space: t4,
|
|
6065
6138
|
text,
|
|
6066
|
-
tone
|
|
6139
|
+
tone: t5,
|
|
6067
6140
|
...restProps
|
|
6068
|
-
} = props,
|
|
6141
|
+
} = 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]);
|
|
6142
|
+
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(), {
|
|
6069
6143
|
scheme
|
|
6070
6144
|
} = useRootTheme(), {
|
|
6071
6145
|
activeElement,
|
|
@@ -6073,56 +6147,99 @@ function MenuGroup(props) {
|
|
|
6073
6147
|
onClickOutside,
|
|
6074
6148
|
onEscape,
|
|
6075
6149
|
onItemClick,
|
|
6076
|
-
onItemMouseEnter
|
|
6150
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
6077
6151
|
registerElement
|
|
6078
|
-
} = menu, [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1)
|
|
6152
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onMouseEnter, [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1);
|
|
6153
|
+
let t6;
|
|
6154
|
+
$[13] !== onItemMouseEnter ? (t6 = (event) => {
|
|
6079
6155
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
6080
|
-
}, [onItemMouseEnter
|
|
6156
|
+
}, $[13] = onItemMouseEnter, $[14] = t6) : t6 = $[14];
|
|
6157
|
+
const handleMouseEnter = t6;
|
|
6158
|
+
let t7;
|
|
6159
|
+
$[15] !== rootElement ? (t7 = (event_0) => {
|
|
6081
6160
|
event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
|
|
6082
6161
|
rootElement?.focus();
|
|
6083
6162
|
}));
|
|
6084
|
-
}, [rootElement
|
|
6163
|
+
}, $[15] = rootElement, $[16] = t7) : t7 = $[16];
|
|
6164
|
+
const handleMenuKeyDown = t7;
|
|
6165
|
+
let t8;
|
|
6166
|
+
$[17] !== onClick ? (t8 = (event_1) => {
|
|
6085
6167
|
onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
|
|
6086
|
-
}, [onClick
|
|
6168
|
+
}, $[17] = onClick, $[18] = t8) : t8 = $[18];
|
|
6169
|
+
const handleClick = t8;
|
|
6170
|
+
let t9;
|
|
6171
|
+
$[19] !== onItemClick ? (t9 = () => {
|
|
6087
6172
|
setOpen(!1), onItemClick?.();
|
|
6088
|
-
}, [onItemClick
|
|
6089
|
-
|
|
6173
|
+
}, $[19] = onItemClick, $[20] = t9) : t9 = $[20];
|
|
6174
|
+
const handleChildItemClick = t9;
|
|
6175
|
+
let t10;
|
|
6176
|
+
$[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[21] = t10) : t10 = $[21];
|
|
6177
|
+
const handleMenuMouseEnter = t10;
|
|
6178
|
+
let t11, t12;
|
|
6179
|
+
$[22] !== mount || $[23] !== rootElement ? (t11 = () => mount(rootElement), t12 = [mount, rootElement], $[22] = mount, $[23] = rootElement, $[24] = t11, $[25] = t12) : (t11 = $[24], t12 = $[25]), react.useEffect(t11, t12);
|
|
6180
|
+
let t13, t14;
|
|
6181
|
+
$[26] !== active ? (t13 = () => {
|
|
6090
6182
|
active || setOpen(!1);
|
|
6091
|
-
}, [active]), react.useEffect(
|
|
6183
|
+
}, t14 = [active], $[26] = active, $[27] = t13, $[28] = t14) : (t13 = $[27], t14 = $[28]), react.useEffect(t13, t14);
|
|
6184
|
+
let t15, t16;
|
|
6185
|
+
$[29] !== open ? (t15 = () => {
|
|
6092
6186
|
open || setWithinMenu(!1);
|
|
6093
|
-
}, [open]), react.useEffect(
|
|
6094
|
-
|
|
6187
|
+
}, t16 = [open], $[29] = open, $[30] = t15, $[31] = t16) : (t15 = $[30], t16 = $[31]), react.useEffect(t15, t16);
|
|
6188
|
+
let t17, t18;
|
|
6189
|
+
$[32] !== shouldFocus ? (t17 = () => {
|
|
6190
|
+
if (!shouldFocus)
|
|
6191
|
+
return;
|
|
6095
6192
|
const rafId = requestAnimationFrame(() => setShouldFocus(null));
|
|
6096
6193
|
return () => cancelAnimationFrame(rafId);
|
|
6097
|
-
}, [shouldFocus]);
|
|
6098
|
-
|
|
6194
|
+
}, t18 = [shouldFocus], $[32] = shouldFocus, $[33] = t17, $[34] = t18) : (t17 = $[33], t18 = $[34]), react.useEffect(t17, t18);
|
|
6195
|
+
let t19;
|
|
6196
|
+
$[35] !== onClickOutside || $[36] !== onEscape || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== registerElement || $[40] !== shouldFocus || $[41] !== children ? (t19 = /* @__PURE__ */ jsxRuntime.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];
|
|
6197
|
+
const childMenu = t19;
|
|
6198
|
+
let t20;
|
|
6199
|
+
$[43] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
|
|
6099
6200
|
const target = event_2.currentTarget;
|
|
6100
6201
|
if (document.activeElement === target && event_2.key === "ArrowRight") {
|
|
6101
6202
|
setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
|
|
6102
6203
|
return;
|
|
6103
6204
|
}
|
|
6104
|
-
}, []);
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
] }) })
|
|
6205
|
+
}, $[43] = t20) : t20 = $[43];
|
|
6206
|
+
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;
|
|
6207
|
+
let t26;
|
|
6208
|
+
$[44] !== IconComponent || $[45] !== fontSize2 ? (t26 = IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6209
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
6210
|
+
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
6211
|
+
] }), $[44] = IconComponent, $[45] = fontSize2, $[46] = t26) : t26 = $[46];
|
|
6212
|
+
let t27;
|
|
6213
|
+
$[47] !== fontSize2 || $[48] !== text ? (t27 = /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }), $[47] = fontSize2, $[48] = text, $[49] = t27) : t27 = $[49];
|
|
6214
|
+
let t28;
|
|
6215
|
+
$[50] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}), $[50] = t28) : t28 = $[50];
|
|
6216
|
+
let t29;
|
|
6217
|
+
$[51] !== fontSize2 ? (t29 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, children: t28 }), $[51] = fontSize2, $[52] = t29) : t29 = $[52];
|
|
6218
|
+
let t30;
|
|
6219
|
+
$[53] !== space || $[54] !== padding || $[55] !== t26 || $[56] !== t27 || $[57] !== t29 ? (t30 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: space, padding, children: [
|
|
6220
|
+
t26,
|
|
6221
|
+
t27,
|
|
6222
|
+
t29
|
|
6223
|
+
] }), $[53] = space, $[54] = padding, $[55] = t26, $[56] = t27, $[57] = t29, $[58] = t30) : t30 = $[58];
|
|
6224
|
+
let t31;
|
|
6225
|
+
$[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__ */ jsxRuntime.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];
|
|
6226
|
+
let t32;
|
|
6227
|
+
return $[72] !== popover || $[73] !== childMenu || $[74] !== open || $[75] !== t31 ? (t32 = /* @__PURE__ */ jsxRuntime.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;
|
|
6113
6228
|
}
|
|
6114
6229
|
MenuGroup.displayName = "MenuGroup";
|
|
6115
6230
|
const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
6116
|
-
const
|
|
6117
|
-
|
|
6231
|
+
const $ = reactCompilerRuntime.c(74);
|
|
6232
|
+
let t0, t1, t2, t3, t4, t5, selectedProp, disabled, onClick, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, pressed, IconComponent, text, IconRightComponent, hotkeys, children, restProps;
|
|
6233
|
+
$[0] !== props ? ({
|
|
6234
|
+
as: t0,
|
|
6118
6235
|
children,
|
|
6119
6236
|
disabled,
|
|
6120
|
-
fontSize:
|
|
6237
|
+
fontSize: t1,
|
|
6121
6238
|
hotkeys,
|
|
6122
6239
|
icon: IconComponent,
|
|
6123
6240
|
iconRight: IconRightComponent,
|
|
6124
6241
|
onClick,
|
|
6125
|
-
padding
|
|
6242
|
+
padding: t2,
|
|
6126
6243
|
paddingX,
|
|
6127
6244
|
paddingY,
|
|
6128
6245
|
paddingTop,
|
|
@@ -6130,25 +6247,33 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
|
6130
6247
|
paddingBottom,
|
|
6131
6248
|
paddingLeft,
|
|
6132
6249
|
pressed,
|
|
6133
|
-
radius
|
|
6250
|
+
radius: t3,
|
|
6134
6251
|
selected: selectedProp,
|
|
6135
|
-
space
|
|
6252
|
+
space: t4,
|
|
6136
6253
|
text,
|
|
6137
|
-
tone
|
|
6254
|
+
tone: t5,
|
|
6138
6255
|
...restProps
|
|
6139
|
-
} = props,
|
|
6256
|
+
} = 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]);
|
|
6257
|
+
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, {
|
|
6140
6258
|
scheme
|
|
6141
6259
|
} = useRootTheme(), menu = useMenu(), {
|
|
6142
6260
|
activeElement,
|
|
6143
6261
|
mount,
|
|
6144
6262
|
onItemClick,
|
|
6145
|
-
onItemMouseEnter
|
|
6146
|
-
onItemMouseLeave
|
|
6147
|
-
} = menu, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
6148
|
-
|
|
6149
|
-
|
|
6263
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
6264
|
+
onItemMouseLeave: _onItemMouseLeave
|
|
6265
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu.onMouseLeave, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
6266
|
+
let t6;
|
|
6267
|
+
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[23] = t6) : t6 = $[23], react.useImperativeHandle(forwardedRef, t6);
|
|
6268
|
+
let t7, t8;
|
|
6269
|
+
$[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]), react.useEffect(t7, t8);
|
|
6270
|
+
let t9;
|
|
6271
|
+
$[29] !== disabled || $[30] !== onClick || $[31] !== onItemClick ? (t9 = (event) => {
|
|
6150
6272
|
disabled || (onClick && onClick(event), onItemClick && onItemClick());
|
|
6151
|
-
}, [disabled, onClick, onItemClick
|
|
6273
|
+
}, $[29] = disabled, $[30] = onClick, $[31] = onItemClick, $[32] = t9) : t9 = $[32];
|
|
6274
|
+
const handleClick = t9;
|
|
6275
|
+
let t10, t11;
|
|
6276
|
+
$[33] !== padding || $[34] !== paddingX || $[35] !== paddingY || $[36] !== paddingTop || $[37] !== paddingRight || $[38] !== paddingBottom || $[39] !== paddingLeft ? (t11 = {
|
|
6152
6277
|
padding,
|
|
6153
6278
|
paddingX,
|
|
6154
6279
|
paddingY,
|
|
@@ -6156,29 +6281,44 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
|
6156
6281
|
paddingRight,
|
|
6157
6282
|
paddingBottom,
|
|
6158
6283
|
paddingLeft
|
|
6159
|
-
}
|
|
6284
|
+
}, $[33] = padding, $[34] = paddingX, $[35] = paddingY, $[36] = paddingTop, $[37] = paddingRight, $[38] = paddingBottom, $[39] = paddingLeft, $[40] = t11) : t11 = $[40], t10 = t11;
|
|
6285
|
+
const paddingProps = t10, t12 = useArrayProp(fontSize2);
|
|
6286
|
+
let t13;
|
|
6287
|
+
$[41] !== t12 ? (t13 = t12.map(_temp$1), $[41] = t12, $[42] = t13) : t13 = $[42];
|
|
6288
|
+
const hotkeysFontSize = t13;
|
|
6289
|
+
let t14;
|
|
6290
|
+
$[43] === Symbol.for("react.memo_cache_sentinel") ? (t14 = (el) => {
|
|
6160
6291
|
ref.current = el, setRootElement(el);
|
|
6161
|
-
}, []);
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
|
|
6169
|
-
hotkeys && /* @__PURE__ */ jsxRuntime.jsx(Hotkeys, { fontSize: hotkeysFontSize, keys: hotkeys, style: {
|
|
6170
|
-
marginTop: -4,
|
|
6171
|
-
marginBottom: -4
|
|
6172
|
-
} }),
|
|
6173
|
-
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6174
|
-
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
6175
|
-
ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
6176
|
-
] })
|
|
6292
|
+
}, $[43] = t14) : t14 = $[43];
|
|
6293
|
+
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;
|
|
6294
|
+
let t23;
|
|
6295
|
+
$[44] !== IconComponent || $[45] !== text || $[46] !== IconRightComponent || $[47] !== fontSize2 || $[48] !== hotkeys || $[49] !== hotkeysFontSize || $[50] !== space || $[51] !== paddingProps ? (t23 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", gap: space, align: "center", ...paddingProps, children: [
|
|
6296
|
+
IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6297
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
6298
|
+
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
6177
6299
|
] }),
|
|
6178
|
-
|
|
6179
|
-
|
|
6300
|
+
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
|
|
6301
|
+
hotkeys && /* @__PURE__ */ jsxRuntime.jsx(Hotkeys, { fontSize: hotkeysFontSize, keys: hotkeys, style: {
|
|
6302
|
+
marginTop: -4,
|
|
6303
|
+
marginBottom: -4
|
|
6304
|
+
} }),
|
|
6305
|
+
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6306
|
+
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
6307
|
+
ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
6308
|
+
] })
|
|
6309
|
+
] }), $[44] = IconComponent, $[45] = text, $[46] = IconRightComponent, $[47] = fontSize2, $[48] = hotkeys, $[49] = hotkeysFontSize, $[50] = space, $[51] = paddingProps, $[52] = t23) : t23 = $[52];
|
|
6310
|
+
let t24;
|
|
6311
|
+
$[53] !== children || $[54] !== paddingProps ? (t24 = children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...paddingProps, children }), $[53] = children, $[54] = paddingProps, $[55] = t24) : t24 = $[55];
|
|
6312
|
+
let t25;
|
|
6313
|
+
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__ */ jsxRuntime.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: [
|
|
6314
|
+
t23,
|
|
6315
|
+
t24
|
|
6316
|
+
] }), $[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;
|
|
6180
6317
|
});
|
|
6181
6318
|
MenuItem.displayName = "ForwardRef(MenuItem)";
|
|
6319
|
+
function _temp$1(s) {
|
|
6320
|
+
return s - 1;
|
|
6321
|
+
}
|
|
6182
6322
|
const keyframe = styledComponents.keyframes`
|
|
6183
6323
|
0% {
|
|
6184
6324
|
background-position: 100%;
|