@sanity/ui 2.10.18 → 2.11.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.d.mts +29 -19
- package/dist/index.d.ts +29 -19
- package/dist/index.esm.js +32 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +32 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +3 -4
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/dialog/dialogProvider.tsx +1 -1
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/core/components/menu/menuButton.tsx +2 -2
- package/src/core/components/menu/menuGroup.tsx +15 -2
- package/src/core/components/tab/tabList.tsx +2 -2
- package/src/core/components/toast/toast.tsx +1 -1
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/tree/tree.tsx +1 -1
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -2
- package/src/core/primitives/popover/popover.tsx +3 -3
- package/src/core/primitives/tooltip/tooltip.tsx +1 -1
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -1
- package/src/core/theme/__workshop__/build/story.tsx +1 -2
- package/src/core/theme/themeColorProvider.tsx +1 -1
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/utils/arrow/arrow.tsx +2 -2
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +1 -3
- package/src/core/utils/layer/layerProvider.tsx +1 -1
- package/src/core/utils/portal/portalProvider.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
package/dist/index.js
CHANGED
|
@@ -6091,13 +6091,14 @@ function useMenu() {
|
|
|
6091
6091
|
return value;
|
|
6092
6092
|
}
|
|
6093
6093
|
function MenuGroup(props) {
|
|
6094
|
-
const $ = reactCompilerRuntime.c(
|
|
6095
|
-
let IconComponent, children, onClick, popover, restProps, t0, t1, t2, t3, t4, t5, text;
|
|
6094
|
+
const $ = reactCompilerRuntime.c(79);
|
|
6095
|
+
let IconComponent, children, menuProps, onClick, popover, restProps, t0, t1, t2, t3, t4, t5, text;
|
|
6096
6096
|
$[0] !== props ? ({
|
|
6097
6097
|
as: t0,
|
|
6098
6098
|
children,
|
|
6099
6099
|
fontSize: t1,
|
|
6100
6100
|
icon: IconComponent,
|
|
6101
|
+
menu: menuProps,
|
|
6101
6102
|
onClick,
|
|
6102
6103
|
padding: t2,
|
|
6103
6104
|
popover,
|
|
@@ -6106,7 +6107,7 @@ function MenuGroup(props) {
|
|
|
6106
6107
|
text,
|
|
6107
6108
|
tone: t5,
|
|
6108
6109
|
...restProps
|
|
6109
|
-
} = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] =
|
|
6110
|
+
} = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = menuProps, $[4] = onClick, $[5] = popover, $[6] = restProps, $[7] = t0, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5, $[13] = text) : (IconComponent = $[1], children = $[2], menuProps = $[3], onClick = $[4], popover = $[5], restProps = $[6], t0 = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12], text = $[13]);
|
|
6110
6111
|
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(), {
|
|
6111
6112
|
scheme
|
|
6112
6113
|
} = useRootTheme(), {
|
|
@@ -6119,80 +6120,80 @@ function MenuGroup(props) {
|
|
|
6119
6120
|
registerElement
|
|
6120
6121
|
} = 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);
|
|
6121
6122
|
let t6;
|
|
6122
|
-
$[
|
|
6123
|
+
$[14] !== onItemMouseEnter ? (t6 = (event) => {
|
|
6123
6124
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
6124
|
-
}, $[
|
|
6125
|
+
}, $[14] = onItemMouseEnter, $[15] = t6) : t6 = $[15];
|
|
6125
6126
|
const handleMouseEnter = t6;
|
|
6126
6127
|
let t7;
|
|
6127
|
-
$[
|
|
6128
|
+
$[16] !== rootElement ? (t7 = (event_0) => {
|
|
6128
6129
|
event_0.key === "ArrowLeft" && (event_0.stopPropagation(), setOpen(!1), requestAnimationFrame(() => {
|
|
6129
6130
|
rootElement?.focus();
|
|
6130
6131
|
}));
|
|
6131
|
-
}, $[
|
|
6132
|
+
}, $[16] = rootElement, $[17] = t7) : t7 = $[17];
|
|
6132
6133
|
const handleMenuKeyDown = t7;
|
|
6133
6134
|
let t8;
|
|
6134
|
-
$[
|
|
6135
|
+
$[18] !== onClick ? (t8 = (event_1) => {
|
|
6135
6136
|
onClick?.(event_1), setShouldFocus("first"), setOpen(!0);
|
|
6136
|
-
}, $[
|
|
6137
|
+
}, $[18] = onClick, $[19] = t8) : t8 = $[19];
|
|
6137
6138
|
const handleClick = t8;
|
|
6138
6139
|
let t9;
|
|
6139
|
-
$[
|
|
6140
|
+
$[20] !== onItemClick ? (t9 = () => {
|
|
6140
6141
|
setOpen(!1), onItemClick?.();
|
|
6141
|
-
}, $[
|
|
6142
|
+
}, $[20] = onItemClick, $[21] = t9) : t9 = $[21];
|
|
6142
6143
|
const handleChildItemClick = t9;
|
|
6143
6144
|
let t10;
|
|
6144
|
-
$[
|
|
6145
|
+
$[22] === Symbol.for("react.memo_cache_sentinel") ? (t10 = () => setWithinMenu(!0), $[22] = t10) : t10 = $[22];
|
|
6145
6146
|
const handleMenuMouseEnter = t10;
|
|
6146
6147
|
let t11, t12;
|
|
6147
|
-
$[
|
|
6148
|
+
$[23] !== mount || $[24] !== rootElement ? (t11 = () => mount(rootElement), t12 = [mount, rootElement], $[23] = mount, $[24] = rootElement, $[25] = t11, $[26] = t12) : (t11 = $[25], t12 = $[26]), react.useEffect(t11, t12);
|
|
6148
6149
|
let t13, t14;
|
|
6149
|
-
$[
|
|
6150
|
+
$[27] !== active ? (t13 = () => {
|
|
6150
6151
|
active || setOpen(!1);
|
|
6151
|
-
}, t14 = [active], $[
|
|
6152
|
+
}, t14 = [active], $[27] = active, $[28] = t13, $[29] = t14) : (t13 = $[28], t14 = $[29]), react.useEffect(t13, t14);
|
|
6152
6153
|
let t15, t16;
|
|
6153
|
-
$[
|
|
6154
|
+
$[30] !== open ? (t15 = () => {
|
|
6154
6155
|
open || setWithinMenu(!1);
|
|
6155
|
-
}, t16 = [open], $[
|
|
6156
|
+
}, t16 = [open], $[30] = open, $[31] = t15, $[32] = t16) : (t15 = $[31], t16 = $[32]), react.useEffect(t15, t16);
|
|
6156
6157
|
let t17, t18;
|
|
6157
|
-
$[
|
|
6158
|
+
$[33] !== shouldFocus ? (t17 = () => {
|
|
6158
6159
|
if (!shouldFocus)
|
|
6159
6160
|
return;
|
|
6160
6161
|
const rafId = requestAnimationFrame(() => setShouldFocus(null));
|
|
6161
6162
|
return () => cancelAnimationFrame(rafId);
|
|
6162
|
-
}, t18 = [shouldFocus], $[
|
|
6163
|
+
}, t18 = [shouldFocus], $[33] = shouldFocus, $[34] = t17, $[35] = t18) : (t17 = $[34], t18 = $[35]), react.useEffect(t17, t18);
|
|
6163
6164
|
let t19;
|
|
6164
|
-
$[
|
|
6165
|
+
$[36] !== children || $[37] !== handleChildItemClick || $[38] !== handleMenuKeyDown || $[39] !== menuProps || $[40] !== onClickOutside || $[41] !== onEscape || $[42] !== registerElement || $[43] !== shouldFocus ? (t19 = /* @__PURE__ */ jsxRuntime.jsx(Menu, { ...menuProps, onClickOutside, onEscape, onItemClick: handleChildItemClick, onKeyDown: handleMenuKeyDown, onMouseEnter: handleMenuMouseEnter, registerElement, shouldFocus, children }), $[36] = children, $[37] = handleChildItemClick, $[38] = handleMenuKeyDown, $[39] = menuProps, $[40] = onClickOutside, $[41] = onEscape, $[42] = registerElement, $[43] = shouldFocus, $[44] = t19) : t19 = $[44];
|
|
6165
6166
|
const childMenu = t19;
|
|
6166
6167
|
let t20;
|
|
6167
|
-
$[
|
|
6168
|
+
$[45] === Symbol.for("react.memo_cache_sentinel") ? (t20 = (event_2) => {
|
|
6168
6169
|
const target = event_2.currentTarget;
|
|
6169
6170
|
if (document.activeElement === target && event_2.key === "ArrowRight") {
|
|
6170
6171
|
setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
|
|
6171
6172
|
return;
|
|
6172
6173
|
}
|
|
6173
|
-
}, $[
|
|
6174
|
+
}, $[45] = t20) : t20 = $[45];
|
|
6174
6175
|
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;
|
|
6175
6176
|
let t26;
|
|
6176
|
-
$[
|
|
6177
|
+
$[46] !== IconComponent || $[47] !== fontSize2 ? (t26 = IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
6177
6178
|
react.isValidElement(IconComponent) && IconComponent,
|
|
6178
6179
|
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
6179
|
-
] }), $[
|
|
6180
|
+
] }), $[46] = IconComponent, $[47] = fontSize2, $[48] = t26) : t26 = $[48];
|
|
6180
6181
|
let t27;
|
|
6181
|
-
$[
|
|
6182
|
+
$[49] !== fontSize2 || $[50] !== text ? (t27 = /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text }) }), $[49] = fontSize2, $[50] = text, $[51] = t27) : t27 = $[51];
|
|
6182
6183
|
let t28;
|
|
6183
|
-
$[
|
|
6184
|
+
$[52] === Symbol.for("react.memo_cache_sentinel") ? (t28 = /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronRightIcon, {}), $[52] = t28) : t28 = $[52];
|
|
6184
6185
|
let t29;
|
|
6185
|
-
$[
|
|
6186
|
+
$[53] !== fontSize2 ? (t29 = /* @__PURE__ */ jsxRuntime.jsx(Text, { size: fontSize2, children: t28 }), $[53] = fontSize2, $[54] = t29) : t29 = $[54];
|
|
6186
6187
|
let t30;
|
|
6187
|
-
$[
|
|
6188
|
+
$[55] !== padding || $[56] !== space || $[57] !== t26 || $[58] !== t27 || $[59] !== t29 ? (t30 = /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: space, padding, children: [
|
|
6188
6189
|
t26,
|
|
6189
6190
|
t27,
|
|
6190
6191
|
t29
|
|
6191
|
-
] }), $[
|
|
6192
|
+
] }), $[55] = padding, $[56] = space, $[57] = t26, $[58] = t27, $[59] = t29, $[60] = t30) : t30 = $[60];
|
|
6192
6193
|
let t31;
|
|
6193
|
-
$[
|
|
6194
|
+
$[61] !== as || $[62] !== handleClick || $[63] !== handleMouseEnter || $[64] !== restProps || $[65] !== scheme || $[66] !== t21 || $[67] !== t22 || $[68] !== t23 || $[69] !== t24 || $[70] !== t25 || $[71] !== t30 || $[72] !== tone ? (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 }), $[61] = as, $[62] = handleClick, $[63] = handleMouseEnter, $[64] = restProps, $[65] = scheme, $[66] = t21, $[67] = t22, $[68] = t23, $[69] = t24, $[70] = t25, $[71] = t30, $[72] = tone, $[73] = t31) : t31 = $[73];
|
|
6194
6195
|
let t32;
|
|
6195
|
-
return $[
|
|
6196
|
+
return $[74] !== childMenu || $[75] !== open || $[76] !== popover || $[77] !== t31 ? (t32 = /* @__PURE__ */ jsxRuntime.jsx(Popover, { ...popover, content: childMenu, "data-ui": "MenuGroup__popover", open, children: t31 }), $[74] = childMenu, $[75] = open, $[76] = popover, $[77] = t31, $[78] = t32) : t32 = $[78], t32;
|
|
6196
6197
|
}
|
|
6197
6198
|
MenuGroup.displayName = "MenuGroup";
|
|
6198
6199
|
const MenuItem = react.forwardRef(function(props, forwardedRef) {
|