@sanity/ui 2.11.4 → 2.11.6
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 +56 -108
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +56 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/core/utils/virtualList/virtualList.tsx +13 -9
package/dist/index.mjs
CHANGED
|
@@ -166,13 +166,9 @@ function _getElements(element, elementsArg) {
|
|
|
166
166
|
Array.isArray(el) ? ret.push(...el) : ret.push(el);
|
|
167
167
|
return ret.filter(Boolean);
|
|
168
168
|
}
|
|
169
|
-
function useClickOutside(listener,
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
$[0] !== element || $[1] !== elementsArg ? (t1 = () => _getElements(element, elementsArg), $[0] = element, $[1] = elementsArg, $[2] = t1) : t1 = $[2];
|
|
173
|
-
const [elements, setElements] = useState(t1), elementsRef = useRef(elements);
|
|
174
|
-
let t2, t3;
|
|
175
|
-
$[3] !== element || $[4] !== elementsArg ? (t2 = () => {
|
|
169
|
+
function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
170
|
+
const [element, setElement] = useState(null), [elements, setElements] = useState(() => _getElements(element, elementsArg)), elementsRef = useRef(elements);
|
|
171
|
+
return useEffect(() => {
|
|
176
172
|
const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
|
|
177
173
|
if (prevElements.length !== nextElements.length) {
|
|
178
174
|
setElements(nextElements), elementsRef.current = nextElements;
|
|
@@ -188,11 +184,8 @@ function useClickOutside(listener, t0, boundaryElement) {
|
|
|
188
184
|
setElements(nextElements), elementsRef.current = nextElements;
|
|
189
185
|
return;
|
|
190
186
|
}
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
return $[7] !== boundaryElement || $[8] !== elements || $[9] !== listener ? (t4 = () => {
|
|
194
|
-
if (!listener)
|
|
195
|
-
return;
|
|
187
|
+
}, [element, elementsArg]), useEffect(() => {
|
|
188
|
+
if (!listener) return;
|
|
196
189
|
const handleWindowMouseDown = (evt) => {
|
|
197
190
|
const target = evt.target;
|
|
198
191
|
if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
|
|
@@ -205,10 +198,10 @@ function useClickOutside(listener, t0, boundaryElement) {
|
|
|
205
198
|
return window.addEventListener("mousedown", handleWindowMouseDown), () => {
|
|
206
199
|
window.removeEventListener("mousedown", handleWindowMouseDown);
|
|
207
200
|
};
|
|
208
|
-
},
|
|
201
|
+
}, [boundaryElement, listener, elements]), setElement;
|
|
209
202
|
}
|
|
210
203
|
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
211
|
-
const $ = c(8), elementsArg = t0 === void 0 ? _temp$
|
|
204
|
+
const $ = c(8), elementsArg = t0 === void 0 ? _temp$a : t0;
|
|
212
205
|
let t1;
|
|
213
206
|
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
214
207
|
if (!listener)
|
|
@@ -236,7 +229,7 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
|
236
229
|
};
|
|
237
230
|
}, t3 = [hasListener, onEvent], $[4] = hasListener, $[5] = onEvent, $[6] = t2, $[7] = t3) : (t2 = $[6], t3 = $[7]), useEffect(t2, t3), useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
238
231
|
}
|
|
239
|
-
function _temp$
|
|
232
|
+
function _temp$a() {
|
|
240
233
|
return EMPTY_ARRAY;
|
|
241
234
|
}
|
|
242
235
|
function useCustomValidity(ref, customValidity) {
|
|
@@ -749,15 +742,15 @@ function useMediaIndex() {
|
|
|
749
742
|
return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
750
743
|
}
|
|
751
744
|
function usePrefersDark(t0) {
|
|
752
|
-
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$
|
|
745
|
+
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$9 : t0);
|
|
753
746
|
}
|
|
754
|
-
function _temp$
|
|
747
|
+
function _temp$9() {
|
|
755
748
|
return !1;
|
|
756
749
|
}
|
|
757
750
|
function usePrefersReducedMotion(t0) {
|
|
758
|
-
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$
|
|
751
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$8 : t0);
|
|
759
752
|
}
|
|
760
|
-
function _temp$
|
|
753
|
+
function _temp$8() {
|
|
761
754
|
return !1;
|
|
762
755
|
}
|
|
763
756
|
function responsiveBorderStyle() {
|
|
@@ -1702,7 +1695,7 @@ const StyledAvatar = /* @__PURE__ */ styled.div.withConfig({
|
|
|
1702
1695
|
}, $[20] = onImageLoadError, $[21] = t7) : t7 = $[21];
|
|
1703
1696
|
const handleImageError = t7;
|
|
1704
1697
|
let t8, t9;
|
|
1705
|
-
$[22] !== size2 ? (t9 = size2.map(_temp$
|
|
1698
|
+
$[22] !== size2 ? (t9 = size2.map(_temp$7), $[22] = size2, $[23] = t9) : t9 = $[23], t8 = t9;
|
|
1706
1699
|
const initialsSize = t8, t10 = typeof as == "string" ? as : void 0;
|
|
1707
1700
|
let t11;
|
|
1708
1701
|
$[24] !== color ? (t11 = /* @__PURE__ */ jsx(Arrow$1, { children: /* @__PURE__ */ jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z", fill: color }) }) }), $[24] = color, $[25] = t11) : t11 = $[25];
|
|
@@ -1723,7 +1716,7 @@ const StyledAvatar = /* @__PURE__ */ styled.div.withConfig({
|
|
|
1723
1716
|
] }), $[39] = arrowPosition, $[40] = as, $[41] = color, $[42] = ref, $[43] = restProps, $[44] = size2, $[45] = status, $[46] = t10, $[47] = t11, $[48] = t12, $[49] = t13, $[50] = title, $[51] = t14) : t14 = $[51], t14;
|
|
1724
1717
|
});
|
|
1725
1718
|
Avatar.displayName = "ForwardRef(Avatar)";
|
|
1726
|
-
function _temp$
|
|
1719
|
+
function _temp$7(s) {
|
|
1727
1720
|
return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
|
|
1728
1721
|
}
|
|
1729
1722
|
function _responsiveAvatarCounterSizeStyle(props) {
|
|
@@ -1771,7 +1764,7 @@ const StyledAvatarCounter = /* @__PURE__ */ styled.div.withConfig({
|
|
|
1771
1764
|
size: t0
|
|
1772
1765
|
} = props, size2 = useArrayProp(t0 === void 0 ? 1 : t0);
|
|
1773
1766
|
let t1, t2;
|
|
1774
|
-
$[0] !== size2 ? (t2 = size2.map(_temp$
|
|
1767
|
+
$[0] !== size2 ? (t2 = size2.map(_temp$6), $[0] = size2, $[1] = t2) : t2 = $[1], t1 = t2;
|
|
1775
1768
|
const fontSize2 = t1;
|
|
1776
1769
|
let t3;
|
|
1777
1770
|
$[2] !== count || $[3] !== fontSize2 ? (t3 = /* @__PURE__ */ jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }), $[2] = count, $[3] = fontSize2, $[4] = t3) : t3 = $[4];
|
|
@@ -1779,7 +1772,7 @@ const StyledAvatarCounter = /* @__PURE__ */ styled.div.withConfig({
|
|
|
1779
1772
|
return $[5] !== ref || $[6] !== size2 || $[7] !== t3 ? (t4 = /* @__PURE__ */ jsx(StyledAvatarCounter, { $size: size2, "data-ui": "AvatarCounter", ref, children: t3 }), $[5] = ref, $[6] = size2, $[7] = t3, $[8] = t4) : t4 = $[8], t4;
|
|
1780
1773
|
});
|
|
1781
1774
|
AvatarCounter.displayName = "ForwardRef(AvatarCounter)";
|
|
1782
|
-
function _temp$
|
|
1775
|
+
function _temp$6(s) {
|
|
1783
1776
|
return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
|
|
1784
1777
|
}
|
|
1785
1778
|
const BASE_STYLES = css`
|
|
@@ -3013,13 +3006,13 @@ const StyledInline = /* @__PURE__ */ styled(Box).withConfig({
|
|
|
3013
3006
|
...restProps
|
|
3014
3007
|
} = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = restProps, $[4] = space) : (as = $[1], childrenProp = $[2], restProps = $[3], space = $[4]);
|
|
3015
3008
|
let t0, t1;
|
|
3016
|
-
$[5] !== childrenProp ? (t1 = Children.map(childrenProp, _temp$
|
|
3009
|
+
$[5] !== childrenProp ? (t1 = Children.map(childrenProp, _temp$5), $[5] = childrenProp, $[6] = t1) : t1 = $[6], t0 = t1;
|
|
3017
3010
|
const children = t0, t2 = useArrayProp(space);
|
|
3018
3011
|
let t3;
|
|
3019
3012
|
return $[7] !== as || $[8] !== children || $[9] !== restProps || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledInline, { "data-ui": "Inline", ...restProps, $space: t2, forwardedAs: as, ref, children }), $[7] = as, $[8] = children, $[9] = restProps, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
|
|
3020
3013
|
});
|
|
3021
3014
|
Inline.displayName = "ForwardRef(Inline)";
|
|
3022
|
-
function _temp$
|
|
3015
|
+
function _temp$5(child) {
|
|
3023
3016
|
return child && /* @__PURE__ */ jsx("div", { children: child });
|
|
3024
3017
|
}
|
|
3025
3018
|
function kbdStyle() {
|
|
@@ -3458,7 +3451,7 @@ function LayerProvider(props) {
|
|
|
3458
3451
|
[childLevel]: prevLen + 1
|
|
3459
3452
|
};
|
|
3460
3453
|
return setSize(Object.keys(nextState).length), nextState;
|
|
3461
|
-
}) : setSize(_temp$
|
|
3454
|
+
}) : setSize(_temp$4), () => {
|
|
3462
3455
|
childLevel !== void 0 ? setChildLayers((state_0) => {
|
|
3463
3456
|
const nextState_0 = {
|
|
3464
3457
|
...state_0
|
|
@@ -3486,7 +3479,7 @@ function LayerProvider(props) {
|
|
|
3486
3479
|
function _temp2$3(v_0) {
|
|
3487
3480
|
return v_0 - 1;
|
|
3488
3481
|
}
|
|
3489
|
-
function _temp$
|
|
3482
|
+
function _temp$4(v) {
|
|
3490
3483
|
return v + 1;
|
|
3491
3484
|
}
|
|
3492
3485
|
LayerProvider.displayName = "LayerProvider";
|
|
@@ -3580,7 +3573,7 @@ function PortalProvider(props) {
|
|
|
3580
3573
|
children,
|
|
3581
3574
|
element,
|
|
3582
3575
|
__unstable_elements: elementsProp
|
|
3583
|
-
} = props, elements = useUnique(elementsProp), fallbackElement = useSyncExternalStore(emptySubscribe, _temp$
|
|
3576
|
+
} = props, elements = useUnique(elementsProp), fallbackElement = useSyncExternalStore(emptySubscribe, _temp$3, _temp2$2);
|
|
3584
3577
|
let t0;
|
|
3585
3578
|
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
3586
3579
|
let t3;
|
|
@@ -3597,7 +3590,7 @@ function PortalProvider(props) {
|
|
|
3597
3590
|
function _temp2$2() {
|
|
3598
3591
|
return null;
|
|
3599
3592
|
}
|
|
3600
|
-
function _temp$
|
|
3593
|
+
function _temp$3() {
|
|
3601
3594
|
return document.body;
|
|
3602
3595
|
}
|
|
3603
3596
|
PortalProvider.displayName = "PortalProvider";
|
|
@@ -3664,11 +3657,8 @@ const StyledVirtualList = styled.div.withConfig({
|
|
|
3664
3657
|
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => {
|
|
3665
3658
|
if (!ref.current)
|
|
3666
3659
|
return;
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
_scrollEl = _scrollEl.parentNode;
|
|
3670
|
-
if (_scrollEl) {
|
|
3671
|
-
const scrollEl = _scrollEl;
|
|
3660
|
+
const scrollEl = findScrollable(ref.current.parentNode);
|
|
3661
|
+
if (scrollEl) {
|
|
3672
3662
|
if (!(scrollEl instanceof HTMLElement))
|
|
3673
3663
|
return;
|
|
3674
3664
|
const handleScroll = () => {
|
|
@@ -3746,6 +3736,12 @@ const StyledVirtualList = styled.div.withConfig({
|
|
|
3746
3736
|
return $[52] !== as || $[53] !== restProps || $[54] !== t14 ? (t15 = /* @__PURE__ */ jsx(StyledVirtualList, { as, "data-ui": "VirtualList", ...restProps, ref, children: t14 }), $[52] = as, $[53] = restProps, $[54] = t14, $[55] = t15) : t15 = $[55], t15;
|
|
3747
3737
|
});
|
|
3748
3738
|
VirtualList.displayName = "ForwardRef(VirtualList)";
|
|
3739
|
+
function findScrollable(parentNode) {
|
|
3740
|
+
let _scrollEl = parentNode;
|
|
3741
|
+
for (; _scrollEl && !_isScrollable(_scrollEl); )
|
|
3742
|
+
_scrollEl = _scrollEl.parentNode;
|
|
3743
|
+
return _scrollEl;
|
|
3744
|
+
}
|
|
3749
3745
|
const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER_ARROW_WIDTH = 19, DEFAULT_POPOVER_ARROW_HEIGHT = 8, DEFAULT_POPOVER_ARROW_RADIUS = 2, DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0], DEFAULT_FALLBACK_PLACEMENTS$1 = {
|
|
3750
3746
|
top: ["bottom", "left", "right"],
|
|
3751
3747
|
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
@@ -4711,7 +4707,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4711
4707
|
const border2 = t0 === void 0 ? !0 : t0, disabled = t1 === void 0 ? !1 : t1, fontSizeProp = t2 === void 0 ? 2 : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, spaceProp = t5 === void 0 ? 3 : t5, type = t6 === void 0 ? "text" : t6, ref = useRef(null), rootTheme = useRootTheme(), fontSize2 = useArrayProp(fontSizeProp), padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), space = useArrayProp(spaceProp), $hasClearButton = !!clearButton, $hasIcon = !!IconComponent, $hasIconRight = !!IconRightComponent, $hasSuffix = !!suffix, $hasPrefix = !!prefix;
|
|
4712
4708
|
let t7;
|
|
4713
4709
|
$[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
|
|
4714
|
-
const handleClearMouseDown = _temp$
|
|
4710
|
+
const handleClearMouseDown = _temp$2;
|
|
4715
4711
|
let t8;
|
|
4716
4712
|
$[20] !== onClear ? (t8 = (event_0) => {
|
|
4717
4713
|
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
@@ -4769,7 +4765,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4769
4765
|
] }), $[79] = prefixNode, $[80] = rootTheme.tone, $[81] = suffixNode, $[82] = t27, $[83] = t28) : t28 = $[83], t28;
|
|
4770
4766
|
});
|
|
4771
4767
|
TextInput.displayName = "ForwardRef(TextInput)";
|
|
4772
|
-
function _temp$
|
|
4768
|
+
function _temp$2(event) {
|
|
4773
4769
|
event.preventDefault(), event.stopPropagation();
|
|
4774
4770
|
}
|
|
4775
4771
|
function _temp2$1(v) {
|
|
@@ -5841,8 +5837,8 @@ const StyledMenu = styled(Box).withConfig({
|
|
|
5841
5837
|
});
|
|
5842
5838
|
Menu.displayName = "ForwardRef(Menu)";
|
|
5843
5839
|
const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
5844
|
-
const
|
|
5845
|
-
__unstable_disableRestoreFocusOnClose:
|
|
5840
|
+
const {
|
|
5841
|
+
__unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
|
|
5846
5842
|
boundaryElement: deprecated_boundaryElement,
|
|
5847
5843
|
button: buttonProp,
|
|
5848
5844
|
id,
|
|
@@ -5851,38 +5847,23 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5851
5847
|
onOpen,
|
|
5852
5848
|
placement: deprecated_placement,
|
|
5853
5849
|
popoverScheme: deprecated_popoverScheme,
|
|
5854
|
-
portal:
|
|
5850
|
+
portal: deprecated_portal = !0,
|
|
5855
5851
|
popover,
|
|
5856
5852
|
popoverRadius: deprecated_popoverRadius,
|
|
5857
5853
|
preventOverflow: deprecated_preventOverflow
|
|
5858
|
-
} = props,
|
|
5859
|
-
|
|
5860
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[0] = t2) : t2 = $[0];
|
|
5861
|
-
const [menuElements, setChildMenuElements] = useState(t2), openRef = useRef(open);
|
|
5862
|
-
let t3, t4;
|
|
5863
|
-
$[1] !== onOpen || $[2] !== open ? (t3 = () => {
|
|
5854
|
+
} = props, [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), [buttonElement, setButtonElement] = useState(null), [menuElements, setChildMenuElements] = useState([]), openRef = useRef(open);
|
|
5855
|
+
useEffect(() => {
|
|
5864
5856
|
onOpen && open && !openRef.current && onOpen();
|
|
5865
|
-
},
|
|
5866
|
-
let t5, t6;
|
|
5867
|
-
$[5] !== onClose || $[6] !== open ? (t5 = () => {
|
|
5857
|
+
}, [onOpen, open]), useEffect(() => {
|
|
5868
5858
|
onClose && !open && openRef.current && onClose();
|
|
5869
|
-
},
|
|
5870
|
-
let t7, t8;
|
|
5871
|
-
$[9] !== open ? (t7 = () => {
|
|
5859
|
+
}, [onClose, open]), useEffect(() => {
|
|
5872
5860
|
openRef.current = open;
|
|
5873
|
-
},
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
}, $[12] = t9) : t9 = $[12];
|
|
5878
|
-
const handleButtonClick = t9;
|
|
5879
|
-
let t10;
|
|
5880
|
-
$[13] !== open ? (t10 = (event) => {
|
|
5861
|
+
}, [open]);
|
|
5862
|
+
const handleButtonClick = useCallback(() => {
|
|
5863
|
+
setOpen((v) => !v), setShouldFocus(null);
|
|
5864
|
+
}, []), handleMouseDown = useCallback((event) => {
|
|
5881
5865
|
open && event.preventDefault();
|
|
5882
|
-
},
|
|
5883
|
-
const handleMouseDown = t10;
|
|
5884
|
-
let t11;
|
|
5885
|
-
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (event_0) => {
|
|
5866
|
+
}, [open]), handleButtonKeyDown = useCallback((event_0) => {
|
|
5886
5867
|
if (event_0.key === "ArrowDown" || event_0.key === "Enter" || event_0.key === " ") {
|
|
5887
5868
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("first");
|
|
5888
5869
|
return;
|
|
@@ -5891,10 +5872,7 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5891
5872
|
event_0.preventDefault(), setOpen(!0), setShouldFocus("last");
|
|
5892
5873
|
return;
|
|
5893
5874
|
}
|
|
5894
|
-
},
|
|
5895
|
-
const handleButtonKeyDown = t11;
|
|
5896
|
-
let t12;
|
|
5897
|
-
$[16] !== buttonElement || $[17] !== menuElements ? (t12 = (event_1) => {
|
|
5875
|
+
}, []), handleMenuClickOutside = useCallback((event_1) => {
|
|
5898
5876
|
const target = event_1.target;
|
|
5899
5877
|
if (target instanceof Node && !(buttonElement && (target === buttonElement || buttonElement.contains(target)))) {
|
|
5900
5878
|
for (const el of menuElements)
|
|
@@ -5902,15 +5880,9 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5902
5880
|
return;
|
|
5903
5881
|
setOpen(!1);
|
|
5904
5882
|
}
|
|
5905
|
-
},
|
|
5906
|
-
const handleMenuClickOutside = t12;
|
|
5907
|
-
let t13;
|
|
5908
|
-
$[19] !== buttonElement || $[20] !== disableRestoreFocusOnClose ? (t13 = () => {
|
|
5883
|
+
}, [buttonElement, menuElements]), handleMenuEscape = useCallback(() => {
|
|
5909
5884
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5910
|
-
},
|
|
5911
|
-
const handleMenuEscape = t13;
|
|
5912
|
-
let t14;
|
|
5913
|
-
$[22] !== menuElements ? (t14 = (event_2) => {
|
|
5885
|
+
}, [buttonElement, disableRestoreFocusOnClose]), handleBlur = useCallback((event_2) => {
|
|
5914
5886
|
const target_0 = event_2.relatedTarget;
|
|
5915
5887
|
if (target_0 instanceof Node) {
|
|
5916
5888
|
for (const el_0 of menuElements)
|
|
@@ -5918,18 +5890,9 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5918
5890
|
return;
|
|
5919
5891
|
setOpen(!1);
|
|
5920
5892
|
}
|
|
5921
|
-
},
|
|
5922
|
-
const handleBlur = t14;
|
|
5923
|
-
let t15;
|
|
5924
|
-
$[24] !== buttonElement || $[25] !== disableRestoreFocusOnClose ? (t15 = () => {
|
|
5893
|
+
}, [menuElements]), handleItemClick = useCallback(() => {
|
|
5925
5894
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5926
|
-
},
|
|
5927
|
-
const handleItemClick = t15;
|
|
5928
|
-
let t16;
|
|
5929
|
-
$[27] === Symbol.for("react.memo_cache_sentinel") ? (t16 = (el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), $[27] = t16) : t16 = $[27];
|
|
5930
|
-
const registerElement = t16;
|
|
5931
|
-
let t17;
|
|
5932
|
-
$[28] !== buttonElement || $[29] !== handleBlur || $[30] !== handleItemClick || $[31] !== handleMenuClickOutside || $[32] !== handleMenuEscape || $[33] !== id || $[34] !== menuProp || $[35] !== shouldFocus ? (t17 = menuProp && cloneElement(menuProp, {
|
|
5895
|
+
}, [buttonElement, disableRestoreFocusOnClose]), registerElement = useCallback((el_1) => (setChildMenuElements((els) => els.concat([el_1])), () => setChildMenuElements((els_0) => els_0.filter((_el) => _el !== el_1))), []), menu = menuProp && cloneElement(menuProp, {
|
|
5933
5896
|
"aria-labelledby": id,
|
|
5934
5897
|
onBlurCapture: handleBlur,
|
|
5935
5898
|
onClickOutside: handleMenuClickOutside,
|
|
@@ -5938,10 +5901,7 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5938
5901
|
originElement: buttonElement,
|
|
5939
5902
|
registerElement,
|
|
5940
5903
|
shouldFocus
|
|
5941
|
-
}),
|
|
5942
|
-
const menu = t17;
|
|
5943
|
-
let t18, t19;
|
|
5944
|
-
$[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t19 = buttonProp && cloneElement(buttonProp, {
|
|
5904
|
+
}), button = useMemo(() => buttonProp && cloneElement(buttonProp, {
|
|
5945
5905
|
"data-ui": "MenuButton",
|
|
5946
5906
|
id,
|
|
5947
5907
|
onClick: handleButtonClick,
|
|
@@ -5951,14 +5911,9 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5951
5911
|
"aria-expanded": open,
|
|
5952
5912
|
ref: setButtonElement,
|
|
5953
5913
|
selected: buttonProp.props.selected ?? open
|
|
5954
|
-
}),
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
$[42] !== buttonElement ? (t20 = () => buttonElement, t21 = [buttonElement], $[42] = buttonElement, $[43] = t20, $[44] = t21) : (t20 = $[43], t21 = $[44]), useImperativeHandle(forwardedRef, t20, t21);
|
|
5958
|
-
let t22, t23;
|
|
5959
|
-
$[45] !== popover ? (t23 = popover || {}, $[45] = popover, $[46] = t23) : t23 = $[46];
|
|
5960
|
-
let t24;
|
|
5961
|
-
$[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !== t23 ? (t24 = {
|
|
5914
|
+
}), [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open]);
|
|
5915
|
+
useImperativeHandle(forwardedRef, () => buttonElement, [buttonElement]);
|
|
5916
|
+
const popoverProps = useMemo(() => ({
|
|
5962
5917
|
boundaryElement: deprecated_boundaryElement,
|
|
5963
5918
|
overflow: "auto",
|
|
5964
5919
|
placement: deprecated_placement,
|
|
@@ -5966,18 +5921,11 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5966
5921
|
preventOverflow: deprecated_preventOverflow,
|
|
5967
5922
|
radius: deprecated_popoverRadius,
|
|
5968
5923
|
scheme: deprecated_popoverScheme,
|
|
5969
|
-
...
|
|
5970
|
-
},
|
|
5971
|
-
|
|
5972
|
-
let t25;
|
|
5973
|
-
$[55] !== button ? (t25 = button || /* @__PURE__ */ jsx(Fragment, {}), $[55] = button, $[56] = t25) : t25 = $[56];
|
|
5974
|
-
let t26;
|
|
5975
|
-
return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t25 ? (t26 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t25 }), $[57] = menu, $[58] = open, $[59] = popoverProps, $[60] = t25, $[61] = t26) : t26 = $[61], t26;
|
|
5924
|
+
...popover || {}
|
|
5925
|
+
}), [deprecated_boundaryElement, deprecated_placement, deprecated_popoverRadius, deprecated_popoverScheme, deprecated_portal, deprecated_preventOverflow, popover]);
|
|
5926
|
+
return /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button || /* @__PURE__ */ jsx(Fragment, {}) });
|
|
5976
5927
|
});
|
|
5977
5928
|
MenuButton.displayName = "ForwardRef(MenuButton)";
|
|
5978
|
-
function _temp$2(v) {
|
|
5979
|
-
return !v;
|
|
5980
|
-
}
|
|
5981
5929
|
const MenuDivider = styled.hr.withConfig({
|
|
5982
5930
|
displayName: "MenuDivider",
|
|
5983
5931
|
componentId: "sc-uhoxwu-0"
|