@sanity/ui 3.0.10 → 3.0.11
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/_chunks-cjs/_visual-editing.js +77 -63
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +77 -63
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/index.js +308 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +310 -100
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/core/components/autocomplete/autocomplete.tsx +79 -47
- package/src/core/components/menu/menu.test.tsx +11 -14
- package/src/core/components/menu/menu.tsx +13 -18
- package/src/core/components/menu/menuContext.ts +3 -14
- package/src/core/components/menu/menuGroup.tsx +1 -1
- package/src/core/components/menu/menuItem.tsx +2 -2
- package/src/core/components/menu/useMenu.ts +2 -2
- package/src/core/components/menu/useMenuController.ts +5 -5
- package/src/core/components/tree/treeItem.tsx +17 -15
- package/src/core/utils/portal/portalProvider.tsx +2 -34
|
@@ -197,7 +197,7 @@ function useArrayProp(val, defaultVal) {
|
|
|
197
197
|
return hash !== cachedHash && setCache([_getArrayProp(val, defaultVal), hash]), cachedVal;
|
|
198
198
|
}
|
|
199
199
|
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
200
|
-
const $ = reactCompilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$
|
|
200
|
+
const $ = reactCompilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$a : t0;
|
|
201
201
|
let t1;
|
|
202
202
|
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
203
203
|
if (!listener)
|
|
@@ -227,7 +227,7 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
|
227
227
|
let t3;
|
|
228
228
|
$[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
229
229
|
}
|
|
230
|
-
function _temp$
|
|
230
|
+
function _temp$a() {
|
|
231
231
|
return EMPTY_ARRAY;
|
|
232
232
|
}
|
|
233
233
|
function useCustomValidity(ref, customValidity) {
|
|
@@ -446,15 +446,15 @@ function useMediaIndex() {
|
|
|
446
446
|
return react.useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
|
|
447
447
|
}
|
|
448
448
|
function usePrefersDark(t0) {
|
|
449
|
-
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$
|
|
449
|
+
return useMatchMedia("(prefers-color-scheme: dark)", t0 === void 0 ? _temp$9 : t0);
|
|
450
450
|
}
|
|
451
|
-
function _temp$
|
|
451
|
+
function _temp$9() {
|
|
452
452
|
return !1;
|
|
453
453
|
}
|
|
454
454
|
function usePrefersReducedMotion(t0) {
|
|
455
|
-
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$
|
|
455
|
+
return useMatchMedia("(prefers-reduced-motion: reduce)", t0 === void 0 ? _temp$8 : t0);
|
|
456
456
|
}
|
|
457
|
-
function _temp$
|
|
457
|
+
function _temp$8() {
|
|
458
458
|
return !1;
|
|
459
459
|
}
|
|
460
460
|
function responsiveBorderStyle() {
|
|
@@ -1399,7 +1399,7 @@ const StyledAvatar = /* @__PURE__ */ styledComponents.styled.div.withConfig({
|
|
|
1399
1399
|
}, $[20] = onImageLoadError, $[21] = t7) : t7 = $[21];
|
|
1400
1400
|
const handleImageError = t7;
|
|
1401
1401
|
let t8;
|
|
1402
|
-
$[22] !== size2 ? (t8 = size2.map(_temp$
|
|
1402
|
+
$[22] !== size2 ? (t8 = size2.map(_temp$7), $[22] = size2, $[23] = t8) : t8 = $[23];
|
|
1403
1403
|
const initialsSize = t8, t9 = typeof as == "string" ? as : void 0;
|
|
1404
1404
|
let t10;
|
|
1405
1405
|
$[24] !== color ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Arrow$1, { children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ jsxRuntime.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] = t10) : t10 = $[25];
|
|
@@ -1420,7 +1420,7 @@ const StyledAvatar = /* @__PURE__ */ styledComponents.styled.div.withConfig({
|
|
|
1420
1420
|
] }), $[39] = arrowPosition, $[40] = as, $[41] = color, $[42] = ref, $[43] = restProps, $[44] = size2, $[45] = status, $[46] = t10, $[47] = t11, $[48] = t12, $[49] = t9, $[50] = title, $[51] = t13) : t13 = $[51], t13;
|
|
1421
1421
|
});
|
|
1422
1422
|
Avatar.displayName = "ForwardRef(Avatar)";
|
|
1423
|
-
function _temp$
|
|
1423
|
+
function _temp$7(s) {
|
|
1424
1424
|
return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
|
|
1425
1425
|
}
|
|
1426
1426
|
function _responsiveAvatarCounterSizeStyle(props) {
|
|
@@ -1468,7 +1468,7 @@ const StyledAvatarCounter = /* @__PURE__ */ styledComponents.styled.div.withConf
|
|
|
1468
1468
|
size: t0
|
|
1469
1469
|
} = props, size2 = useArrayProp(t0 === void 0 ? 1 : t0);
|
|
1470
1470
|
let t1;
|
|
1471
|
-
$[0] !== size2 ? (t1 = size2.map(_temp$
|
|
1471
|
+
$[0] !== size2 ? (t1 = size2.map(_temp$6), $[0] = size2, $[1] = t1) : t1 = $[1];
|
|
1472
1472
|
const fontSize2 = t1;
|
|
1473
1473
|
let t2;
|
|
1474
1474
|
$[2] !== count || $[3] !== fontSize2 ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }), $[2] = count, $[3] = fontSize2, $[4] = t2) : t2 = $[4];
|
|
@@ -1476,7 +1476,7 @@ const StyledAvatarCounter = /* @__PURE__ */ styledComponents.styled.div.withConf
|
|
|
1476
1476
|
return $[5] !== ref || $[6] !== size2 || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(StyledAvatarCounter, { $size: size2, "data-ui": "AvatarCounter", ref, children: t2 }), $[5] = ref, $[6] = size2, $[7] = t2, $[8] = t3) : t3 = $[8], t3;
|
|
1477
1477
|
});
|
|
1478
1478
|
AvatarCounter.displayName = "ForwardRef(AvatarCounter)";
|
|
1479
|
-
function _temp$
|
|
1479
|
+
function _temp$6(s) {
|
|
1480
1480
|
return s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0;
|
|
1481
1481
|
}
|
|
1482
1482
|
const BASE_STYLES = styledComponents.css`
|
|
@@ -2713,13 +2713,13 @@ const StyledInline = /* @__PURE__ */ styledComponents.styled(Box).withConfig({
|
|
|
2713
2713
|
...restProps
|
|
2714
2714
|
} = props, $[0] = props, $[1] = as, $[2] = childrenProp, $[3] = restProps, $[4] = space) : (as = $[1], childrenProp = $[2], restProps = $[3], space = $[4]);
|
|
2715
2715
|
let t0;
|
|
2716
|
-
$[5] !== childrenProp ? (t0 = react.Children.map(childrenProp, _temp$
|
|
2716
|
+
$[5] !== childrenProp ? (t0 = react.Children.map(childrenProp, _temp$5), $[5] = childrenProp, $[6] = t0) : t0 = $[6];
|
|
2717
2717
|
const children = t0, t1 = useArrayProp(space), t2 = ref;
|
|
2718
2718
|
let t3;
|
|
2719
2719
|
return $[7] !== as || $[8] !== children || $[9] !== restProps || $[10] !== t1 || $[11] !== t2 ? (t3 = /* @__PURE__ */ jsxRuntime.jsx(StyledInline, { "data-ui": "Inline", ...restProps, $space: t1, forwardedAs: as, ref: t2, children }), $[7] = as, $[8] = children, $[9] = restProps, $[10] = t1, $[11] = t2, $[12] = t3) : t3 = $[12], t3;
|
|
2720
2720
|
});
|
|
2721
2721
|
Inline.displayName = "ForwardRef(Inline)";
|
|
2722
|
-
function _temp$
|
|
2722
|
+
function _temp$5(child) {
|
|
2723
2723
|
return child && /* @__PURE__ */ jsxRuntime.jsx("div", { children: child });
|
|
2724
2724
|
}
|
|
2725
2725
|
function kbdStyle() {
|
|
@@ -3040,7 +3040,7 @@ function LayerProvider(props) {
|
|
|
3040
3040
|
[childLevel]: prevLen + 1
|
|
3041
3041
|
};
|
|
3042
3042
|
return setSize(Object.keys(nextState).length), nextState;
|
|
3043
|
-
}) : setSize(_temp$
|
|
3043
|
+
}) : setSize(_temp$4), () => {
|
|
3044
3044
|
childLevel !== void 0 ? setChildLayers((state_0) => {
|
|
3045
3045
|
const nextState_0 = {
|
|
3046
3046
|
...state_0
|
|
@@ -3068,7 +3068,7 @@ function LayerProvider(props) {
|
|
|
3068
3068
|
function _temp2$2(v_0) {
|
|
3069
3069
|
return v_0 - 1;
|
|
3070
3070
|
}
|
|
3071
|
-
function _temp$
|
|
3071
|
+
function _temp$4(v) {
|
|
3072
3072
|
return v + 1;
|
|
3073
3073
|
}
|
|
3074
3074
|
LayerProvider.displayName = "LayerProvider";
|
|
@@ -3173,8 +3173,8 @@ function PortalProvider(props) {
|
|
|
3173
3173
|
boundaryElement,
|
|
3174
3174
|
children,
|
|
3175
3175
|
element,
|
|
3176
|
-
__unstable_elements:
|
|
3177
|
-
} = props,
|
|
3176
|
+
__unstable_elements: elements
|
|
3177
|
+
} = props, fallbackElement = react.useSyncExternalStore(emptySubscribe, _temp$3, _temp2$1), t0 = boundaryElement || null, t1 = element || fallbackElement;
|
|
3178
3178
|
let t2;
|
|
3179
3179
|
$[0] !== elements || $[1] !== t0 || $[2] !== t1 ? (t2 = {
|
|
3180
3180
|
version: 0,
|
|
@@ -3189,23 +3189,12 @@ function PortalProvider(props) {
|
|
|
3189
3189
|
function _temp2$1() {
|
|
3190
3190
|
return null;
|
|
3191
3191
|
}
|
|
3192
|
-
function _temp$
|
|
3192
|
+
function _temp$3() {
|
|
3193
3193
|
return document.body;
|
|
3194
3194
|
}
|
|
3195
3195
|
PortalProvider.displayName = "PortalProvider";
|
|
3196
3196
|
const emptySubscribe = () => () => {
|
|
3197
|
-
}
|
|
3198
|
-
function useUnique(value) {
|
|
3199
|
-
const valueRef = react.useRef(value);
|
|
3200
|
-
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
3201
|
-
}
|
|
3202
|
-
function _isEqual(objA, objB) {
|
|
3203
|
-
if (!objA || !objB)
|
|
3204
|
-
return objA === objB;
|
|
3205
|
-
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
3206
|
-
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
3207
|
-
}
|
|
3208
|
-
const StyledSrOnly = styledComponents.styled.div.withConfig({
|
|
3197
|
+
}, StyledSrOnly = styledComponents.styled.div.withConfig({
|
|
3209
3198
|
displayName: "StyledSrOnly",
|
|
3210
3199
|
componentId: "sc-mubr0c-0"
|
|
3211
3200
|
})`display:block;width:0;height:0;position:absolute;overflow:hidden;overflow:clip;`, SrOnly = react.forwardRef(function(props, ref) {
|
|
@@ -4278,7 +4267,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4278
4267
|
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;
|
|
4279
4268
|
let t7;
|
|
4280
4269
|
$[19] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[19] = t7) : t7 = $[19], react.useImperativeHandle(forwardedRef, t7), useCustomValidity(ref, customValidity);
|
|
4281
|
-
const handleClearMouseDown = _temp$
|
|
4270
|
+
const handleClearMouseDown = _temp$2;
|
|
4282
4271
|
let t8;
|
|
4283
4272
|
$[20] !== onClear ? (t8 = (event_0) => {
|
|
4284
4273
|
event_0.preventDefault(), event_0.stopPropagation(), onClear && onClear(), ref.current?.focus();
|
|
@@ -4331,7 +4320,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
4331
4320
|
] }), $[79] = prefixNode, $[80] = rootTheme.tone, $[81] = suffixNode, $[82] = t20, $[83] = t21) : t21 = $[83], t21;
|
|
4332
4321
|
});
|
|
4333
4322
|
TextInput.displayName = "ForwardRef(TextInput)";
|
|
4334
|
-
function _temp$
|
|
4323
|
+
function _temp$2(event) {
|
|
4335
4324
|
event.preventDefault(), event.stopPropagation();
|
|
4336
4325
|
}
|
|
4337
4326
|
function _temp2(v) {
|
|
@@ -4669,16 +4658,24 @@ function _sortElements(rootElement, elements) {
|
|
|
4669
4658
|
elements.sort(_sort);
|
|
4670
4659
|
}
|
|
4671
4660
|
function useMenuController(props) {
|
|
4672
|
-
const {
|
|
4661
|
+
const $ = reactCompilerRuntime.c(21), {
|
|
4673
4662
|
onKeyDown,
|
|
4674
4663
|
originElement,
|
|
4675
4664
|
shouldFocus,
|
|
4676
4665
|
rootElementRef
|
|
4677
|
-
} = props
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4666
|
+
} = props;
|
|
4667
|
+
let t0;
|
|
4668
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [], $[0] = t0) : t0 = $[0];
|
|
4669
|
+
const elementsRef = react.useRef(t0), [activeIndex, _setActiveIndex] = react.useState(-1), activeIndexRef = react.useRef(activeIndex), [activeElement, setActiveElement] = react.useState(null);
|
|
4670
|
+
let t1;
|
|
4671
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = (nextActiveIndex) => {
|
|
4672
|
+
_setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex, setActiveElement(elementsRef.current[nextActiveIndex] || null);
|
|
4673
|
+
}, $[1] = t1) : t1 = $[1];
|
|
4674
|
+
const setActiveIndex = t1;
|
|
4675
|
+
let t2;
|
|
4676
|
+
$[2] !== rootElementRef ? (t2 = (element, selected) => {
|
|
4677
|
+
if (!element)
|
|
4678
|
+
return _temp$1;
|
|
4682
4679
|
if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
|
|
4683
4680
|
const selectedIndex = elementsRef.current.indexOf(element);
|
|
4684
4681
|
setActiveIndex(selectedIndex);
|
|
@@ -4687,7 +4684,10 @@ function useMenuController(props) {
|
|
|
4687
4684
|
const idx = elementsRef.current.indexOf(element);
|
|
4688
4685
|
idx > -1 && elementsRef.current.splice(idx, 1);
|
|
4689
4686
|
};
|
|
4690
|
-
}, [rootElementRef,
|
|
4687
|
+
}, $[2] = rootElementRef, $[3] = t2) : t2 = $[3];
|
|
4688
|
+
const mount = t2;
|
|
4689
|
+
let t3;
|
|
4690
|
+
$[4] !== onKeyDown || $[5] !== originElement ? (t3 = (event) => {
|
|
4691
4691
|
if (event.key === "Tab") {
|
|
4692
4692
|
originElement && originElement.focus();
|
|
4693
4693
|
return;
|
|
@@ -4695,7 +4695,8 @@ function useMenuController(props) {
|
|
|
4695
4695
|
if (event.key === "Home") {
|
|
4696
4696
|
event.preventDefault(), event.stopPropagation();
|
|
4697
4697
|
const el = _getFocusableElements(elementsRef.current)[0];
|
|
4698
|
-
if (!el)
|
|
4698
|
+
if (!el)
|
|
4699
|
+
return;
|
|
4699
4700
|
const currentIndex = elementsRef.current.indexOf(el);
|
|
4700
4701
|
setActiveIndex(currentIndex);
|
|
4701
4702
|
return;
|
|
@@ -4703,7 +4704,8 @@ function useMenuController(props) {
|
|
|
4703
4704
|
if (event.key === "End") {
|
|
4704
4705
|
event.preventDefault(), event.stopPropagation();
|
|
4705
4706
|
const focusableElements_0 = _getFocusableElements(elementsRef.current), el_0 = focusableElements_0[focusableElements_0.length - 1];
|
|
4706
|
-
if (!el_0)
|
|
4707
|
+
if (!el_0)
|
|
4708
|
+
return;
|
|
4707
4709
|
const currentIndex_0 = elementsRef.current.indexOf(el_0);
|
|
4708
4710
|
setActiveIndex(currentIndex_0);
|
|
4709
4711
|
return;
|
|
@@ -4711,7 +4713,8 @@ function useMenuController(props) {
|
|
|
4711
4713
|
if (event.key === "ArrowUp") {
|
|
4712
4714
|
event.preventDefault(), event.stopPropagation();
|
|
4713
4715
|
const focusableElements_1 = _getFocusableElements(elementsRef.current), focusableLen = focusableElements_1.length;
|
|
4714
|
-
if (focusableLen === 0)
|
|
4716
|
+
if (focusableLen === 0)
|
|
4717
|
+
return;
|
|
4715
4718
|
const focusedElement = elementsRef.current[activeIndexRef.current];
|
|
4716
4719
|
let focusedIndex = focusableElements_1.indexOf(focusedElement);
|
|
4717
4720
|
focusedIndex = (focusedIndex - 1 + focusableLen) % focusableLen;
|
|
@@ -4722,7 +4725,8 @@ function useMenuController(props) {
|
|
|
4722
4725
|
if (event.key === "ArrowDown") {
|
|
4723
4726
|
event.preventDefault(), event.stopPropagation();
|
|
4724
4727
|
const focusableElements_2 = _getFocusableElements(elementsRef.current), focusableLen_0 = focusableElements_2.length;
|
|
4725
|
-
if (focusableLen_0 === 0)
|
|
4728
|
+
if (focusableLen_0 === 0)
|
|
4729
|
+
return;
|
|
4726
4730
|
const focusedElement_0 = elementsRef.current[activeIndexRef.current];
|
|
4727
4731
|
let focusedIndex_0 = focusableElements_2.indexOf(focusedElement_0);
|
|
4728
4732
|
focusedIndex_0 = (focusedIndex_0 + 1) % focusableLen_0;
|
|
@@ -4731,14 +4735,23 @@ function useMenuController(props) {
|
|
|
4731
4735
|
return;
|
|
4732
4736
|
}
|
|
4733
4737
|
onKeyDown && onKeyDown(event);
|
|
4734
|
-
}, [onKeyDown, originElement,
|
|
4738
|
+
}, $[4] = onKeyDown, $[5] = originElement, $[6] = t3) : t3 = $[6];
|
|
4739
|
+
const handleKeyDown = t3;
|
|
4740
|
+
let t4;
|
|
4741
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = (event_0) => {
|
|
4735
4742
|
const element_0 = event_0.currentTarget, currentIndex_3 = elementsRef.current.indexOf(element_0);
|
|
4736
4743
|
setActiveIndex(currentIndex_3);
|
|
4737
|
-
}, [
|
|
4744
|
+
}, $[7] = t4) : t4 = $[7];
|
|
4745
|
+
const handleItemMouseEnter = t4;
|
|
4746
|
+
let t5;
|
|
4747
|
+
$[8] !== rootElementRef ? (t5 = () => {
|
|
4738
4748
|
setActiveIndex(-2), rootElementRef.current?.focus();
|
|
4739
|
-
}, [rootElementRef,
|
|
4740
|
-
|
|
4741
|
-
|
|
4749
|
+
}, $[8] = rootElementRef, $[9] = t5) : t5 = $[9];
|
|
4750
|
+
const handleItemMouseLeave = t5;
|
|
4751
|
+
let t6, t7;
|
|
4752
|
+
$[10] !== activeIndex || $[11] !== rootElementRef || $[12] !== shouldFocus ? (t6 = () => {
|
|
4753
|
+
if (!rootElementRef.current)
|
|
4754
|
+
return;
|
|
4742
4755
|
const rafId = requestAnimationFrame(() => {
|
|
4743
4756
|
if (activeIndex === -1) {
|
|
4744
4757
|
if (shouldFocus === "first") {
|
|
@@ -4760,20 +4773,24 @@ function useMenuController(props) {
|
|
|
4760
4773
|
(elementsRef.current[activeIndex] || null)?.focus();
|
|
4761
4774
|
});
|
|
4762
4775
|
return () => cancelAnimationFrame(rafId);
|
|
4763
|
-
}, [activeIndex,
|
|
4776
|
+
}, t7 = [activeIndex, rootElementRef, setActiveIndex, shouldFocus], $[10] = activeIndex, $[11] = rootElementRef, $[12] = shouldFocus, $[13] = t6, $[14] = t7) : (t6 = $[13], t7 = $[14]), react.useEffect(t6, t7);
|
|
4777
|
+
let t8;
|
|
4778
|
+
return $[15] !== activeElement || $[16] !== activeIndex || $[17] !== handleItemMouseLeave || $[18] !== handleKeyDown || $[19] !== mount ? (t8 = {
|
|
4764
4779
|
activeElement,
|
|
4765
4780
|
activeIndex,
|
|
4766
4781
|
handleItemMouseEnter,
|
|
4767
4782
|
handleItemMouseLeave,
|
|
4768
4783
|
handleKeyDown,
|
|
4769
4784
|
mount
|
|
4770
|
-
};
|
|
4785
|
+
}, $[15] = activeElement, $[16] = activeIndex, $[17] = handleItemMouseLeave, $[18] = handleKeyDown, $[19] = mount, $[20] = t8) : t8 = $[20], t8;
|
|
4786
|
+
}
|
|
4787
|
+
function _temp$1() {
|
|
4771
4788
|
}
|
|
4772
4789
|
const StyledMenu = styledComponents.styled(Box).withConfig({
|
|
4773
4790
|
displayName: "StyledMenu",
|
|
4774
4791
|
componentId: "sc-xt0tnv-0"
|
|
4775
4792
|
})`outline:none;overflow:auto;`, Menu = react.forwardRef(function(props, forwardedRef) {
|
|
4776
|
-
const $ = reactCompilerRuntime.c(
|
|
4793
|
+
const $ = reactCompilerRuntime.c(49);
|
|
4777
4794
|
let _shouldFocus, children, onClickOutside, onEscape, onItemClick, onItemSelect, onKeyDown, originElement, registerElement, restProps, t0, t1;
|
|
4778
4795
|
if ($[0] !== props) {
|
|
4779
4796
|
const {
|
|
@@ -4832,27 +4849,24 @@ const StyledMenu = styledComponents.styled(Box).withConfig({
|
|
|
4832
4849
|
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|
|
4833
4850
|
}, $[25] = isTopLayer, $[26] = onEscape, $[27] = t8) : t8 = $[27], useGlobalKeyDown(t8);
|
|
4834
4851
|
let t9;
|
|
4835
|
-
$[28] !== activeElement || $[29] !==
|
|
4836
|
-
version:
|
|
4852
|
+
$[28] !== activeElement || $[29] !== handleItemMouseEnter || $[30] !== handleItemMouseLeave || $[31] !== mount || $[32] !== onClickOutside || $[33] !== onEscape || $[34] !== onItemClick || $[35] !== registerElement ? (t9 = {
|
|
4853
|
+
version: 2,
|
|
4837
4854
|
activeElement,
|
|
4838
|
-
activeIndex,
|
|
4839
4855
|
mount,
|
|
4840
4856
|
onClickOutside,
|
|
4841
4857
|
onEscape,
|
|
4842
4858
|
onItemClick,
|
|
4843
4859
|
onItemMouseEnter: handleItemMouseEnter,
|
|
4844
4860
|
onItemMouseLeave: handleItemMouseLeave,
|
|
4845
|
-
registerElement
|
|
4846
|
-
|
|
4847
|
-
onMouseLeave: handleItemMouseLeave
|
|
4848
|
-
}, $[28] = activeElement, $[29] = activeIndex, $[30] = handleItemMouseEnter, $[31] = handleItemMouseLeave, $[32] = mount, $[33] = onClickOutside, $[34] = onEscape, $[35] = onItemClick, $[36] = registerElement, $[37] = t9) : t9 = $[37];
|
|
4861
|
+
registerElement
|
|
4862
|
+
}, $[28] = activeElement, $[29] = handleItemMouseEnter, $[30] = handleItemMouseLeave, $[31] = mount, $[32] = onClickOutside, $[33] = onEscape, $[34] = onItemClick, $[35] = registerElement, $[36] = t9) : t9 = $[36];
|
|
4849
4863
|
const value = t9;
|
|
4850
4864
|
let t10;
|
|
4851
|
-
$[
|
|
4865
|
+
$[37] !== children || $[38] !== space ? (t10 = /* @__PURE__ */ jsxRuntime.jsx(Stack, { space, children }), $[37] = children, $[38] = space, $[39] = t10) : t10 = $[39];
|
|
4852
4866
|
let t11;
|
|
4853
|
-
$[
|
|
4867
|
+
$[40] !== handleKeyDown || $[41] !== handleRefChange || $[42] !== padding || $[43] !== restProps || $[44] !== t10 ? (t11 = /* @__PURE__ */ jsxRuntime.jsx(StyledMenu, { "data-ui": "Menu", ...restProps, onKeyDown: handleKeyDown, padding, ref: handleRefChange, role: "menu", tabIndex: -1, children: t10 }), $[40] = handleKeyDown, $[41] = handleRefChange, $[42] = padding, $[43] = restProps, $[44] = t10, $[45] = t11) : t11 = $[45];
|
|
4854
4868
|
let t12;
|
|
4855
|
-
return $[
|
|
4869
|
+
return $[46] !== t11 || $[47] !== value ? (t12 = /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value, children: t11 }), $[46] = t11, $[47] = value, $[48] = t12) : t12 = $[48], t12;
|
|
4856
4870
|
});
|
|
4857
4871
|
Menu.displayName = "ForwardRef(Menu)";
|
|
4858
4872
|
const MenuDivider = styledComponents.styled.hr.withConfig({
|
|
@@ -4969,7 +4983,7 @@ function useMenu() {
|
|
|
4969
4983
|
const value = react.useContext(MenuContext);
|
|
4970
4984
|
if (!value)
|
|
4971
4985
|
throw new Error("useMenu(): missing context value");
|
|
4972
|
-
if (!isRecord(value) || value.version !==
|
|
4986
|
+
if (!isRecord(value) || value.version !== 2)
|
|
4973
4987
|
throw new Error("useMenu(): the context value is not compatible");
|
|
4974
4988
|
return value;
|
|
4975
4989
|
}
|
|
@@ -5001,7 +5015,7 @@ function MenuGroup(props) {
|
|
|
5001
5015
|
onItemClick,
|
|
5002
5016
|
onItemMouseEnter: _onItemMouseEnter,
|
|
5003
5017
|
registerElement
|
|
5004
|
-
} = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.
|
|
5018
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter, [rootElement, setRootElement] = react.useState(null), [open, setOpen] = react.useState(!1), [shouldFocus, setShouldFocus] = react.useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = react.useState(!1);
|
|
5005
5019
|
let t6;
|
|
5006
5020
|
$[14] !== onItemMouseEnter ? (t6 = (event) => {
|
|
5007
5021
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
@@ -5114,7 +5128,7 @@ const MenuItem = react.forwardRef(function(props, forwardedRef) {
|
|
|
5114
5128
|
onItemClick,
|
|
5115
5129
|
onItemMouseEnter: _onItemMouseEnter,
|
|
5116
5130
|
onItemMouseLeave: _onItemMouseLeave
|
|
5117
|
-
} = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.
|
|
5131
|
+
} = menu, onItemMouseEnter = _onItemMouseEnter ?? menu.onItemMouseEnter, onItemMouseLeave = _onItemMouseLeave ?? menu.onItemMouseLeave, [rootElement, setRootElement] = react.useState(null), active = !!activeElement && activeElement === rootElement, ref = react.useRef(null);
|
|
5118
5132
|
let t6;
|
|
5119
5133
|
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[23] = t6) : t6 = $[23], react.useImperativeHandle(forwardedRef, t6);
|
|
5120
5134
|
let t7, t8;
|