@sanity/ui 2.9.0-canary.0 → 2.9.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +308 -169
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +307 -168
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +308 -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 +22 -26
- 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, {});
|
|
@@ -4545,7 +4574,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4545
4574
|
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
4575
|
let t7;
|
|
4547
4576
|
$[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$
|
|
4577
|
+
const handleClearMouseDown = _temp$2;
|
|
4549
4578
|
let t8;
|
|
4550
4579
|
$[20] !== onClear ? (t8 = (event_0) => {
|
|
4551
4580
|
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
@@ -4613,7 +4642,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4613
4642
|
] }), $[81] = rootTheme.tone, $[82] = prefixNode, $[83] = t27, $[84] = suffixNode, $[85] = t28) : t28 = $[85], t28;
|
|
4614
4643
|
});
|
|
4615
4644
|
TextInput.displayName = "ForwardRef(TextInput)";
|
|
4616
|
-
function _temp$
|
|
4645
|
+
function _temp$2(event) {
|
|
4617
4646
|
event.preventDefault(), event.stopPropagation();
|
|
4618
4647
|
}
|
|
4619
4648
|
function useDelayedState(initialState) {
|
|
@@ -4733,21 +4762,21 @@ const Root$a = styledComponents.styled(Layer)`
|
|
|
4733
4762
|
} = useTheme_v2(), {
|
|
4734
4763
|
animate: _animate = !1,
|
|
4735
4764
|
arrow: arrowProp = !1,
|
|
4736
|
-
boundaryElement
|
|
4765
|
+
boundaryElement: _boundaryElement,
|
|
4737
4766
|
children: childProp,
|
|
4738
4767
|
content,
|
|
4739
4768
|
disabled,
|
|
4740
|
-
fallbackPlacements:
|
|
4769
|
+
fallbackPlacements: _fallbackPlacementsProp,
|
|
4741
4770
|
padding = 2,
|
|
4742
4771
|
placement: placementProp = "bottom",
|
|
4743
4772
|
portal: portalProp,
|
|
4744
4773
|
radius = 2,
|
|
4745
4774
|
scheme,
|
|
4746
4775
|
shadow = 2,
|
|
4747
|
-
zOffset
|
|
4776
|
+
zOffset: _zOffset,
|
|
4748
4777
|
delay,
|
|
4749
4778
|
...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);
|
|
4779
|
+
} = 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
4780
|
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
4752
4781
|
const portal = usePortal(), portalElement = typeof portalProp == "string" ? portal.elements?.[portalProp] || null : portal.element, middleware = react.useMemo(() => {
|
|
4753
4782
|
const ret = [];
|
|
@@ -5497,13 +5526,15 @@ const Root$7 = styledComponents.styled(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
5497
5526
|
});
|
|
5498
5527
|
DialogCard.displayName = "ForwardRef(DialogCard)";
|
|
5499
5528
|
const Dialog = react.forwardRef(function(props, ref) {
|
|
5500
|
-
const dialog = useDialog(), {
|
|
5529
|
+
const $ = reactCompilerRuntime.c(60), dialog = useDialog(), {
|
|
5501
5530
|
layer
|
|
5502
|
-
} = useTheme_v2()
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5531
|
+
} = useTheme_v2();
|
|
5532
|
+
let t0, t1, t2, t3, t4, t5, t6, _positionProp, _zOffsetProp, portalProp, onFocus, id, contentRef, footer, header, onClickOutside, onClose, scheme, children, restProps, onActivate;
|
|
5533
|
+
$[0] !== props ? ({
|
|
5534
|
+
__unstable_autoFocus: t0,
|
|
5535
|
+
__unstable_hideCloseButton: t1,
|
|
5536
|
+
cardRadius: t2,
|
|
5537
|
+
cardShadow: t3,
|
|
5507
5538
|
children,
|
|
5508
5539
|
contentRef,
|
|
5509
5540
|
footer,
|
|
@@ -5513,15 +5544,18 @@ const Dialog = react.forwardRef(function(props, ref) {
|
|
|
5513
5544
|
onClickOutside,
|
|
5514
5545
|
onClose,
|
|
5515
5546
|
onFocus,
|
|
5516
|
-
padding:
|
|
5547
|
+
padding: t4,
|
|
5517
5548
|
portal: portalProp,
|
|
5518
|
-
position:
|
|
5549
|
+
position: _positionProp,
|
|
5519
5550
|
scheme,
|
|
5520
|
-
width:
|
|
5521
|
-
zOffset:
|
|
5522
|
-
animate:
|
|
5551
|
+
width: t5,
|
|
5552
|
+
zOffset: _zOffsetProp,
|
|
5553
|
+
animate: t6,
|
|
5523
5554
|
...restProps
|
|
5524
|
-
} = props,
|
|
5555
|
+
} = 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]);
|
|
5556
|
+
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);
|
|
5557
|
+
let t7;
|
|
5558
|
+
$[22] !== onFocus ? (t7 = (event) => {
|
|
5525
5559
|
onFocus?.(event);
|
|
5526
5560
|
const target = event.target, cardElement = cardRef.current;
|
|
5527
5561
|
if (cardElement && target === preDivRef.current) {
|
|
@@ -5533,7 +5567,10 @@ const Dialog = react.forwardRef(function(props, ref) {
|
|
|
5533
5567
|
return;
|
|
5534
5568
|
}
|
|
5535
5569
|
isHTMLElement(event.target) && (focusedElementRef.current = event.target);
|
|
5536
|
-
}, [
|
|
5570
|
+
}, $[22] = onFocus, $[23] = t7) : t7 = $[23];
|
|
5571
|
+
const handleFocus = t7, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef();
|
|
5572
|
+
let t8;
|
|
5573
|
+
$[24] !== boundaryElement || $[25] !== portalElement ? (t8 = () => {
|
|
5537
5574
|
rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
|
|
5538
5575
|
const activeElement = document.activeElement;
|
|
5539
5576
|
if (activeElement && !isTargetWithinScope(boundaryElement, portalElement, activeElement)) {
|
|
@@ -5546,12 +5583,22 @@ const Dialog = react.forwardRef(function(props, ref) {
|
|
|
5546
5583
|
target_0.focus();
|
|
5547
5584
|
}
|
|
5548
5585
|
}, 0);
|
|
5549
|
-
}, [boundaryElement, portalElement]);
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
] })
|
|
5586
|
+
}, $[24] = boundaryElement, $[25] = portalElement, $[26] = t8) : t8 = $[26];
|
|
5587
|
+
const handleRootClick = t8;
|
|
5588
|
+
let t9;
|
|
5589
|
+
$[27] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: preDivRef, tabIndex: 0 }), $[27] = t9) : t9 = $[27];
|
|
5590
|
+
let t10;
|
|
5591
|
+
$[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];
|
|
5592
|
+
let t11;
|
|
5593
|
+
$[43] === Symbol.for("react.memo_cache_sentinel") ? (t11 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: postDivRef, tabIndex: 0 }), $[43] = t11) : t11 = $[43];
|
|
5594
|
+
let t12;
|
|
5595
|
+
$[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: [
|
|
5596
|
+
t9,
|
|
5597
|
+
t10,
|
|
5598
|
+
t11
|
|
5599
|
+
] }), $[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];
|
|
5600
|
+
let t13;
|
|
5601
|
+
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
5602
|
});
|
|
5556
5603
|
Dialog.displayName = "ForwardRef(Dialog)";
|
|
5557
5604
|
function DialogProvider(props) {
|
|
@@ -5782,48 +5829,66 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5782
5829
|
outline: none;
|
|
5783
5830
|
overflow: auto;
|
|
5784
5831
|
`, Menu = react.forwardRef(function(props, forwardedRef) {
|
|
5832
|
+
const $ = reactCompilerRuntime.c(50);
|
|
5833
|
+
let t0, t1, _shouldFocus, onKeyDown, originElement, registerElement, onItemSelect, onClickOutside, onEscape, onItemClick, children, restProps;
|
|
5834
|
+
if ($[0] !== props) {
|
|
5835
|
+
const {
|
|
5836
|
+
children: t22,
|
|
5837
|
+
focusFirst,
|
|
5838
|
+
focusLast,
|
|
5839
|
+
onClickOutside: t32,
|
|
5840
|
+
onEscape: t42,
|
|
5841
|
+
onItemClick: t52,
|
|
5842
|
+
onItemSelect: t62,
|
|
5843
|
+
onKeyDown: t72,
|
|
5844
|
+
originElement: t82,
|
|
5845
|
+
padding: t92,
|
|
5846
|
+
registerElement: t102,
|
|
5847
|
+
shouldFocus: t112,
|
|
5848
|
+
space: t122,
|
|
5849
|
+
...t132
|
|
5850
|
+
} = props;
|
|
5851
|
+
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;
|
|
5852
|
+
} else
|
|
5853
|
+
t0 = $[1], t1 = $[2], _shouldFocus = $[3], onKeyDown = $[4], originElement = $[5], registerElement = $[6], onItemSelect = $[7], onClickOutside = $[8], onEscape = $[9], onItemClick = $[10], children = $[11], restProps = $[12];
|
|
5854
|
+
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);
|
|
5855
|
+
let t2;
|
|
5856
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => ref.current, $[13] = t2) : t2 = $[13], react.useImperativeHandle(forwardedRef, t2);
|
|
5785
5857
|
const {
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
focusLast,
|
|
5791
|
-
onClickOutside,
|
|
5792
|
-
onEscape,
|
|
5793
|
-
onItemClick,
|
|
5794
|
-
onItemSelect,
|
|
5858
|
+
isTopLayer
|
|
5859
|
+
} = useLayer();
|
|
5860
|
+
let t3;
|
|
5861
|
+
$[14] !== onKeyDown || $[15] !== originElement || $[16] !== shouldFocus ? (t3 = {
|
|
5795
5862
|
onKeyDown,
|
|
5796
5863
|
originElement,
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
space = 1,
|
|
5801
|
-
...restProps
|
|
5802
|
-
} = props, ref = react.useRef(null);
|
|
5803
|
-
react.useImperativeHandle(forwardedRef, () => ref.current);
|
|
5864
|
+
shouldFocus,
|
|
5865
|
+
rootElementRef: ref
|
|
5866
|
+
}, $[14] = onKeyDown, $[15] = originElement, $[16] = shouldFocus, $[17] = t3) : t3 = $[17];
|
|
5804
5867
|
const {
|
|
5805
|
-
isTopLayer
|
|
5806
|
-
} = useLayer(), {
|
|
5807
5868
|
activeElement,
|
|
5808
5869
|
activeIndex,
|
|
5809
5870
|
handleItemMouseEnter,
|
|
5810
5871
|
handleItemMouseLeave,
|
|
5811
5872
|
handleKeyDown,
|
|
5812
5873
|
mount
|
|
5813
|
-
} = useMenuController(
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
shouldFocus,
|
|
5817
|
-
rootElementRef: ref
|
|
5818
|
-
}), unregisterElementRef = react.useRef(null), handleRefChange = react.useCallback((el) => {
|
|
5874
|
+
} = useMenuController(t3), unregisterElementRef = react.useRef(null);
|
|
5875
|
+
let t4;
|
|
5876
|
+
$[18] !== registerElement ? (t4 = (el) => {
|
|
5819
5877
|
unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
|
|
5820
|
-
}, [registerElement]);
|
|
5821
|
-
|
|
5878
|
+
}, $[18] = registerElement, $[19] = t4) : t4 = $[19];
|
|
5879
|
+
const handleRefChange = t4;
|
|
5880
|
+
let t5, t6;
|
|
5881
|
+
$[20] !== onItemSelect || $[21] !== activeIndex ? (t5 = () => {
|
|
5822
5882
|
onItemSelect && onItemSelect(activeIndex);
|
|
5823
|
-
}, [activeIndex, onItemSelect]
|
|
5883
|
+
}, t6 = [activeIndex, onItemSelect], $[20] = onItemSelect, $[21] = activeIndex, $[22] = t5, $[23] = t6) : (t5 = $[22], t6 = $[23]), react.useEffect(t5, t6);
|
|
5884
|
+
let t7;
|
|
5885
|
+
$[24] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => [ref.current], $[24] = t7) : t7 = $[24], useClickOutsideEvent(isTopLayer && onClickOutside, t7);
|
|
5886
|
+
let t8;
|
|
5887
|
+
$[25] !== isTopLayer || $[26] !== onEscape ? (t8 = (event) => {
|
|
5824
5888
|
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|
|
5825
|
-
}, [isTopLayer, onEscape]));
|
|
5826
|
-
|
|
5889
|
+
}, $[25] = isTopLayer, $[26] = onEscape, $[27] = t8) : t8 = $[27], useGlobalKeyDown(t8);
|
|
5890
|
+
let t9, t10;
|
|
5891
|
+
$[28] !== activeElement || $[29] !== activeIndex || $[30] !== mount || $[31] !== onClickOutside || $[32] !== onEscape || $[33] !== onItemClick || $[34] !== handleItemMouseEnter || $[35] !== handleItemMouseLeave || $[36] !== registerElement ? (t10 = {
|
|
5827
5892
|
version: 0,
|
|
5828
5893
|
activeElement,
|
|
5829
5894
|
activeIndex,
|
|
@@ -5834,11 +5899,16 @@ const Root$5 = styledComponents.styled(Box)`
|
|
|
5834
5899
|
onItemMouseEnter: handleItemMouseEnter,
|
|
5835
5900
|
onItemMouseLeave: handleItemMouseLeave,
|
|
5836
5901
|
registerElement,
|
|
5837
|
-
// deprecated
|
|
5838
5902
|
onMouseEnter: handleItemMouseEnter,
|
|
5839
5903
|
onMouseLeave: handleItemMouseLeave
|
|
5840
|
-
}
|
|
5841
|
-
|
|
5904
|
+
}, $[28] = activeElement, $[29] = activeIndex, $[30] = mount, $[31] = onClickOutside, $[32] = onEscape, $[33] = onItemClick, $[34] = handleItemMouseEnter, $[35] = handleItemMouseLeave, $[36] = registerElement, $[37] = t10) : t10 = $[37], t9 = t10;
|
|
5905
|
+
const value = t9;
|
|
5906
|
+
let t11;
|
|
5907
|
+
$[38] !== space || $[39] !== children ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { space, children }), $[38] = space, $[39] = children, $[40] = t11) : t11 = $[40];
|
|
5908
|
+
let t12;
|
|
5909
|
+
$[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];
|
|
5910
|
+
let t13;
|
|
5911
|
+
return $[47] !== value || $[48] !== t12 ? (t13 = /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value, children: t12 }), $[47] = value, $[48] = t12, $[49] = t13) : t13 = $[49], t13;
|
|
5842
5912
|
});
|
|
5843
5913
|
Menu.displayName = "ForwardRef(Menu)";
|
|
5844
5914
|
const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
@@ -6052,20 +6122,23 @@ function useMenu() {
|
|
|
6052
6122
|
return value;
|
|
6053
6123
|
}
|
|
6054
6124
|
function MenuGroup(props) {
|
|
6055
|
-
const
|
|
6056
|
-
|
|
6125
|
+
const $ = reactCompilerRuntime.c(77);
|
|
6126
|
+
let t0, t1, t2, t3, t4, t5, onClick, children, IconComponent, text, restProps, popover;
|
|
6127
|
+
$[0] !== props ? ({
|
|
6128
|
+
as: t0,
|
|
6057
6129
|
children,
|
|
6058
|
-
fontSize:
|
|
6130
|
+
fontSize: t1,
|
|
6059
6131
|
icon: IconComponent,
|
|
6060
6132
|
onClick,
|
|
6061
|
-
padding
|
|
6133
|
+
padding: t2,
|
|
6062
6134
|
popover,
|
|
6063
|
-
radius
|
|
6064
|
-
space
|
|
6135
|
+
radius: t3,
|
|
6136
|
+
space: t4,
|
|
6065
6137
|
text,
|
|
6066
|
-
tone
|
|
6138
|
+
tone: t5,
|
|
6067
6139
|
...restProps
|
|
6068
|
-
} = props,
|
|
6140
|
+
} = 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]);
|
|
6141
|
+
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
6142
|
scheme
|
|
6070
6143
|
} = useRootTheme(), {
|
|
6071
6144
|
activeElement,
|
|
@@ -6073,56 +6146,99 @@ function MenuGroup(props) {
|
|
|
6073
6146
|
onClickOutside,
|
|
6074
6147
|
onEscape,
|
|
6075
6148
|
onItemClick,
|
|
6076
|
-
onItemMouseEnter
|
|
6149
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
6077
6150
|
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)
|
|
6151
|
+
} = 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);
|
|
6152
|
+
let t6;
|
|
6153
|
+
$[13] !== onItemMouseEnter ? (t6 = (event) => {
|
|
6079
6154
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
6080
|
-
}, [onItemMouseEnter
|
|
6155
|
+
}, $[13] = onItemMouseEnter, $[14] = t6) : t6 = $[14];
|
|
6156
|
+
const handleMouseEnter = t6;
|
|
6157
|
+
let t7;
|
|
6158
|
+
$[15] !== rootElement ? (t7 = (event_0) => {
|
|
6081
6159
|
event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
|
|
6082
6160
|
rootElement?.focus();
|
|
6083
6161
|
}));
|
|
6084
|
-
}, [rootElement
|
|
6162
|
+
}, $[15] = rootElement, $[16] = t7) : t7 = $[16];
|
|
6163
|
+
const handleMenuKeyDown = t7;
|
|
6164
|
+
let t8;
|
|
6165
|
+
$[17] !== onClick ? (t8 = (event_1) => {
|
|
6085
6166
|
onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
|
|
6086
|
-
}, [onClick
|
|
6167
|
+
}, $[17] = onClick, $[18] = t8) : t8 = $[18];
|
|
6168
|
+
const handleClick = t8;
|
|
6169
|
+
let t9;
|
|
6170
|
+
$[19] !== onItemClick ? (t9 = () => {
|
|
6087
6171
|
setOpen(!1), onItemClick?.();
|
|
6088
|
-
}, [onItemClick
|
|
6089
|
-
|
|
6172
|
+
}, $[19] = onItemClick, $[20] = t9) : t9 = $[20];
|
|
6173
|
+
const handleChildItemClick = t9;
|
|
6174
|
+
let t10;
|
|
6175
|
+
$[21] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[21] = t10) : t10 = $[21];
|
|
6176
|
+
const handleMenuMouseEnter = t10;
|
|
6177
|
+
let t11, t12;
|
|
6178
|
+
$[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);
|
|
6179
|
+
let t13, t14;
|
|
6180
|
+
$[26] !== active ? (t13 = () => {
|
|
6090
6181
|
active || setOpen(!1);
|
|
6091
|
-
}, [active]), react.useEffect(
|
|
6182
|
+
}, t14 = [active], $[26] = active, $[27] = t13, $[28] = t14) : (t13 = $[27], t14 = $[28]), react.useEffect(t13, t14);
|
|
6183
|
+
let t15, t16;
|
|
6184
|
+
$[29] !== open ? (t15 = () => {
|
|
6092
6185
|
open || setWithinMenu(!1);
|
|
6093
|
-
}, [open]), react.useEffect(
|
|
6094
|
-
|
|
6186
|
+
}, t16 = [open], $[29] = open, $[30] = t15, $[31] = t16) : (t15 = $[30], t16 = $[31]), react.useEffect(t15, t16);
|
|
6187
|
+
let t17, t18;
|
|
6188
|
+
$[32] !== shouldFocus ? (t17 = () => {
|
|
6189
|
+
if (!shouldFocus)
|
|
6190
|
+
return;
|
|
6095
6191
|
const rafId = requestAnimationFrame(() => setShouldFocus(null));
|
|
6096
6192
|
return () => cancelAnimationFrame(rafId);
|
|
6097
|
-
}, [shouldFocus]);
|
|
6098
|
-
|
|
6193
|
+
}, t18 = [shouldFocus], $[32] = shouldFocus, $[33] = t17, $[34] = t18) : (t17 = $[33], t18 = $[34]), react.useEffect(t17, t18);
|
|
6194
|
+
let t19;
|
|
6195
|
+
$[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];
|
|
6196
|
+
const childMenu = t19;
|
|
6197
|
+
let t20;
|
|
6198
|
+
$[43] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
|
|
6099
6199
|
const target = event_2.currentTarget;
|
|
6100
6200
|
if (document.activeElement === target && event_2.key === "ArrowRight") {
|
|
6101
6201
|
setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
|
|
6102
6202
|
return;
|
|
6103
6203
|
}
|
|
6104
|
-
}, []);
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
] }) })
|
|
6204
|
+
}, $[43] = t20) : t20 = $[43];
|
|
6205
|
+
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;
|
|
6206
|
+
let t26;
|
|
6207
|
+
$[44] !== IconComponent || $[45] !== fontSize2 ? (t26 = IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6208
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
6209
|
+
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
6210
|
+
] }), $[44] = IconComponent, $[45] = fontSize2, $[46] = t26) : t26 = $[46];
|
|
6211
|
+
let t27;
|
|
6212
|
+
$[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];
|
|
6213
|
+
let t28;
|
|
6214
|
+
$[50] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}), $[50] = t28) : t28 = $[50];
|
|
6215
|
+
let t29;
|
|
6216
|
+
$[51] !== fontSize2 ? (t29 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, children: t28 }), $[51] = fontSize2, $[52] = t29) : t29 = $[52];
|
|
6217
|
+
let t30;
|
|
6218
|
+
$[53] !== space || $[54] !== padding || $[55] !== t26 || $[56] !== t27 || $[57] !== t29 ? (t30 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: space, padding, children: [
|
|
6219
|
+
t26,
|
|
6220
|
+
t27,
|
|
6221
|
+
t29
|
|
6222
|
+
] }), $[53] = space, $[54] = padding, $[55] = t26, $[56] = t27, $[57] = t29, $[58] = t30) : t30 = $[58];
|
|
6223
|
+
let t31;
|
|
6224
|
+
$[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];
|
|
6225
|
+
let t32;
|
|
6226
|
+
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
6227
|
}
|
|
6114
6228
|
MenuGroup.displayName = "MenuGroup";
|
|
6115
6229
|
const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
6116
|
-
const
|
|
6117
|
-
|
|
6230
|
+
const $ = reactCompilerRuntime.c(74);
|
|
6231
|
+
let t0, t1, t2, t3, t4, t5, selectedProp, disabled, onClick, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, pressed, IconComponent, text, IconRightComponent, hotkeys, children, restProps;
|
|
6232
|
+
$[0] !== props ? ({
|
|
6233
|
+
as: t0,
|
|
6118
6234
|
children,
|
|
6119
6235
|
disabled,
|
|
6120
|
-
fontSize:
|
|
6236
|
+
fontSize: t1,
|
|
6121
6237
|
hotkeys,
|
|
6122
6238
|
icon: IconComponent,
|
|
6123
6239
|
iconRight: IconRightComponent,
|
|
6124
6240
|
onClick,
|
|
6125
|
-
padding
|
|
6241
|
+
padding: t2,
|
|
6126
6242
|
paddingX,
|
|
6127
6243
|
paddingY,
|
|
6128
6244
|
paddingTop,
|
|
@@ -6130,25 +6246,33 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
|
6130
6246
|
paddingBottom,
|
|
6131
6247
|
paddingLeft,
|
|
6132
6248
|
pressed,
|
|
6133
|
-
radius
|
|
6249
|
+
radius: t3,
|
|
6134
6250
|
selected: selectedProp,
|
|
6135
|
-
space
|
|
6251
|
+
space: t4,
|
|
6136
6252
|
text,
|
|
6137
|
-
tone
|
|
6253
|
+
tone: t5,
|
|
6138
6254
|
...restProps
|
|
6139
|
-
} = props,
|
|
6255
|
+
} = 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]);
|
|
6256
|
+
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
6257
|
scheme
|
|
6141
6258
|
} = useRootTheme(), menu = useMenu(), {
|
|
6142
6259
|
activeElement,
|
|
6143
6260
|
mount,
|
|
6144
6261
|
onItemClick,
|
|
6145
|
-
onItemMouseEnter
|
|
6146
|
-
onItemMouseLeave
|
|
6147
|
-
} = menu, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
6148
|
-
|
|
6149
|
-
|
|
6262
|
+
onItemMouseEnter: _onItemMouseEnter,
|
|
6263
|
+
onItemMouseLeave: _onItemMouseLeave
|
|
6264
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu.onMouseLeave, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
6265
|
+
let t6;
|
|
6266
|
+
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[23] = t6) : t6 = $[23], react.useImperativeHandle(forwardedRef, t6);
|
|
6267
|
+
let t7, t8;
|
|
6268
|
+
$[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);
|
|
6269
|
+
let t9;
|
|
6270
|
+
$[29] !== disabled || $[30] !== onClick || $[31] !== onItemClick ? (t9 = (event) => {
|
|
6150
6271
|
disabled || (onClick && onClick(event), onItemClick && onItemClick());
|
|
6151
|
-
}, [disabled, onClick, onItemClick
|
|
6272
|
+
}, $[29] = disabled, $[30] = onClick, $[31] = onItemClick, $[32] = t9) : t9 = $[32];
|
|
6273
|
+
const handleClick = t9;
|
|
6274
|
+
let t10, t11;
|
|
6275
|
+
$[33] !== padding || $[34] !== paddingX || $[35] !== paddingY || $[36] !== paddingTop || $[37] !== paddingRight || $[38] !== paddingBottom || $[39] !== paddingLeft ? (t11 = {
|
|
6152
6276
|
padding,
|
|
6153
6277
|
paddingX,
|
|
6154
6278
|
paddingY,
|
|
@@ -6156,29 +6280,44 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
|
6156
6280
|
paddingRight,
|
|
6157
6281
|
paddingBottom,
|
|
6158
6282
|
paddingLeft
|
|
6159
|
-
}
|
|
6283
|
+
}, $[33] = padding, $[34] = paddingX, $[35] = paddingY, $[36] = paddingTop, $[37] = paddingRight, $[38] = paddingBottom, $[39] = paddingLeft, $[40] = t11) : t11 = $[40], t10 = t11;
|
|
6284
|
+
const paddingProps = t10, t12 = useArrayProp(fontSize2);
|
|
6285
|
+
let t13;
|
|
6286
|
+
$[41] !== t12 ? (t13 = t12.map(_temp$1), $[41] = t12, $[42] = t13) : t13 = $[42];
|
|
6287
|
+
const hotkeysFontSize = t13;
|
|
6288
|
+
let t14;
|
|
6289
|
+
$[43] === Symbol.for("react.memo_cache_sentinel") ? (t14 = (el) => {
|
|
6160
6290
|
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
|
-
] })
|
|
6291
|
+
}, $[43] = t14) : t14 = $[43];
|
|
6292
|
+
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;
|
|
6293
|
+
let t23;
|
|
6294
|
+
$[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: [
|
|
6295
|
+
IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6296
|
+
react.isValidElement(IconComponent) && IconComponent,
|
|
6297
|
+
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
6177
6298
|
] }),
|
|
6178
|
-
|
|
6179
|
-
|
|
6299
|
+
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }),
|
|
6300
|
+
hotkeys && /* @__PURE__ */ jsxRuntime.jsx(Hotkeys, { fontSize: hotkeysFontSize, keys: hotkeys, style: {
|
|
6301
|
+
marginTop: -4,
|
|
6302
|
+
marginBottom: -4
|
|
6303
|
+
} }),
|
|
6304
|
+
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6305
|
+
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
6306
|
+
ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
6307
|
+
] })
|
|
6308
|
+
] }), $[44] = IconComponent, $[45] = text, $[46] = IconRightComponent, $[47] = fontSize2, $[48] = hotkeys, $[49] = hotkeysFontSize, $[50] = space, $[51] = paddingProps, $[52] = t23) : t23 = $[52];
|
|
6309
|
+
let t24;
|
|
6310
|
+
$[53] !== children || $[54] !== paddingProps ? (t24 = children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...paddingProps, children }), $[53] = children, $[54] = paddingProps, $[55] = t24) : t24 = $[55];
|
|
6311
|
+
let t25;
|
|
6312
|
+
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: [
|
|
6313
|
+
t23,
|
|
6314
|
+
t24
|
|
6315
|
+
] }), $[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
6316
|
});
|
|
6181
6317
|
MenuItem.displayName = "ForwardRef(MenuItem)";
|
|
6318
|
+
function _temp$1(s) {
|
|
6319
|
+
return s - 1;
|
|
6320
|
+
}
|
|
6182
6321
|
const keyframe = styledComponents.keyframes`
|
|
6183
6322
|
0% {
|
|
6184
6323
|
background-position: 100%;
|