@sanity/ui 2.12.3 → 2.13.0
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 +27 -22
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/getTheme_v2.js +0 -1
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +27 -22
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +0 -1
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_chunks-es/refractor.mjs +1 -1
- package/dist/_legacy/_visual-editing.esm.js +27 -22
- package/dist/_legacy/_visual-editing.esm.js.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +0 -1
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/_legacy/refractor.esm.js +1 -1
- package/dist/_visual-editing.d.mts +2 -1
- package/dist/_visual-editing.d.ts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/theme.esm.js +0 -3
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +0 -3
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +0 -3
- package/dist/theme.mjs.map +1 -1
- package/package.json +23 -23
- package/src/core/__workshop__/constants.ts +5 -4
- package/src/core/hooks/useClickOutsideEvent.ts +1 -1
- package/src/core/hooks/useGlobalKeyDown.ts +1 -1
- package/src/core/primitives/button/__workshop__/props.tsx +4 -0
- package/src/core/primitives/button/button.tsx +5 -2
- package/src/core/primitives/tooltip/tooltip.tsx +1 -1
|
@@ -154,7 +154,7 @@ function useArrayProp(val, defaultVal) {
|
|
|
154
154
|
return hash !== cachedHash && setCache([_getArrayProp(val, defaultVal), hash]), cachedVal;
|
|
155
155
|
}
|
|
156
156
|
function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
157
|
-
const $ = reactCompilerRuntime.c(
|
|
157
|
+
const $ = reactCompilerRuntime.c(9), elementsArg = t0 === void 0 ? _temp$9 : t0;
|
|
158
158
|
let t1;
|
|
159
159
|
$[0] !== boundaryElement || $[1] !== elementsArg || $[2] !== listener ? (t1 = (evt) => {
|
|
160
160
|
if (!listener)
|
|
@@ -172,7 +172,7 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
|
172
172
|
listener(evt);
|
|
173
173
|
}, $[0] = boundaryElement, $[1] = elementsArg, $[2] = listener, $[3] = t1) : t1 = $[3];
|
|
174
174
|
const onEvent = useEffectEvent.useEffectEvent(t1), hasListener = !!listener;
|
|
175
|
-
let t2
|
|
175
|
+
let t2;
|
|
176
176
|
$[4] !== hasListener || $[5] !== onEvent ? (t2 = () => {
|
|
177
177
|
if (!hasListener)
|
|
178
178
|
return;
|
|
@@ -180,7 +180,9 @@ function useClickOutsideEvent(listener, t0, boundaryElement) {
|
|
|
180
180
|
return document.addEventListener("mousedown", handleEvent), () => {
|
|
181
181
|
document.removeEventListener("mousedown", handleEvent);
|
|
182
182
|
};
|
|
183
|
-
},
|
|
183
|
+
}, $[4] = hasListener, $[5] = onEvent, $[6] = t2) : t2 = $[6];
|
|
184
|
+
let t3;
|
|
185
|
+
$[7] !== hasListener ? (t3 = [hasListener], $[7] = hasListener, $[8] = t3) : t3 = $[8], react.useEffect(t2, t3), react.useDebugValue(listener ? "MouseDown On" : "MouseDown Off");
|
|
184
186
|
}
|
|
185
187
|
function _temp$9() {
|
|
186
188
|
return EMPTY_ARRAY;
|
|
@@ -246,11 +248,13 @@ function useGlobalKeyDown(onKeyDown) {
|
|
|
246
248
|
let t0;
|
|
247
249
|
$[0] !== onKeyDown ? (t0 = (event) => onKeyDown(event), $[0] = onKeyDown, $[1] = t0) : t0 = $[1];
|
|
248
250
|
const handleKeyDown = useEffectEvent.useEffectEvent(t0);
|
|
249
|
-
let t1
|
|
251
|
+
let t1;
|
|
250
252
|
$[2] !== handleKeyDown ? (t1 = () => {
|
|
251
253
|
const handler = (event_0) => handleKeyDown(event_0);
|
|
252
254
|
return window.addEventListener("keydown", handler), () => window.removeEventListener("keydown", handler);
|
|
253
|
-
},
|
|
255
|
+
}, $[2] = handleKeyDown, $[3] = t1) : t1 = $[3];
|
|
256
|
+
let t2;
|
|
257
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[4] = t2) : t2 = $[4], react.useEffect(t1, t2);
|
|
254
258
|
}
|
|
255
259
|
function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
256
260
|
const {
|
|
@@ -1882,8 +1886,8 @@ const StyledButton = /* @__PURE__ */ styledComponents.styled.button.withConfig({
|
|
|
1882
1886
|
displayName: "LoadingBox",
|
|
1883
1887
|
componentId: "sc-aaekt4-1"
|
|
1884
1888
|
})`position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:var(--card-bg-color);border-radius:inherit;z-index:1;box-shadow:inherit;`, Button = react.forwardRef(function(props, ref) {
|
|
1885
|
-
const $ = reactCompilerRuntime.c(
|
|
1886
|
-
let IconComponent, IconRightComponent, children, disabled, loading, paddingBottomProp, paddingLeftProp, paddingRightProp, paddingTopProp, paddingXProp, paddingYProp, restProps, selected, t0, t1, t2, t3, t4, t5, t6, t7, t8, text, textAlign, width;
|
|
1889
|
+
const $ = reactCompilerRuntime.c(66);
|
|
1890
|
+
let IconComponent, IconRightComponent, children, disabled, loading, paddingBottomProp, paddingLeftProp, paddingRightProp, paddingTopProp, paddingXProp, paddingYProp, restProps, selected, t0, t1, t2, t3, t4, t5, t6, t7, t8, text, textAlign, textWeight, width;
|
|
1887
1891
|
$[0] !== props ? ({
|
|
1888
1892
|
children,
|
|
1889
1893
|
disabled,
|
|
@@ -1905,17 +1909,18 @@ const StyledButton = /* @__PURE__ */ styledComponents.styled.button.withConfig({
|
|
|
1905
1909
|
space: t5,
|
|
1906
1910
|
text,
|
|
1907
1911
|
textAlign,
|
|
1912
|
+
textWeight,
|
|
1908
1913
|
tone: t6,
|
|
1909
1914
|
type: t7,
|
|
1910
1915
|
muted: t8,
|
|
1911
1916
|
width,
|
|
1912
1917
|
...restProps
|
|
1913
|
-
} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = loading, $[6] = paddingBottomProp, $[7] = paddingLeftProp, $[8] = paddingRightProp, $[9] = paddingTopProp, $[10] = paddingXProp, $[11] = paddingYProp, $[12] = restProps, $[13] = selected, $[14] = t0, $[15] = t1, $[16] = t2, $[17] = t3, $[18] = t4, $[19] = t5, $[20] = t6, $[21] = t7, $[22] = t8, $[23] = text, $[24] = textAlign, $[25] = width) : (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], loading = $[5], paddingBottomProp = $[6], paddingLeftProp = $[7], paddingRightProp = $[8], paddingTopProp = $[9], paddingXProp = $[10], paddingYProp = $[11], restProps = $[12], selected = $[13], t0 = $[14], t1 = $[15], t2 = $[16], t3 = $[17], t4 = $[18], t5 = $[19], t6 = $[20], t7 = $[21], t8 = $[22], text = $[23], textAlign = $[24],
|
|
1918
|
+
} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = loading, $[6] = paddingBottomProp, $[7] = paddingLeftProp, $[8] = paddingRightProp, $[9] = paddingTopProp, $[10] = paddingXProp, $[11] = paddingYProp, $[12] = restProps, $[13] = selected, $[14] = t0, $[15] = t1, $[16] = t2, $[17] = t3, $[18] = t4, $[19] = t5, $[20] = t6, $[21] = t7, $[22] = t8, $[23] = text, $[24] = textAlign, $[25] = textWeight, $[26] = width) : (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], loading = $[5], paddingBottomProp = $[6], paddingLeftProp = $[7], paddingRightProp = $[8], paddingTopProp = $[9], paddingXProp = $[10], paddingYProp = $[11], restProps = $[12], selected = $[13], t0 = $[14], t1 = $[15], t2 = $[16], t3 = $[17], t4 = $[18], t5 = $[19], t6 = $[20], t7 = $[21], t8 = $[22], text = $[23], textAlign = $[24], textWeight = $[25], width = $[26]);
|
|
1914
1919
|
const fontSize2 = t0 === void 0 ? 1 : t0, justifyProp = t1 === void 0 ? "center" : t1, mode = t2 === void 0 ? "default" : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, spaceProp = t5 === void 0 ? 3 : t5, tone = t6 === void 0 ? "default" : t6, type = t7 === void 0 ? "button" : t7, muted = t8 === void 0 ? !1 : t8, {
|
|
1915
1920
|
button
|
|
1916
1921
|
} = useTheme_v2(), justify = useArrayProp(justifyProp), padding = useArrayProp(paddingProp), paddingX = useArrayProp(paddingXProp), paddingY = useArrayProp(paddingYProp), paddingTop = useArrayProp(paddingTopProp), paddingBottom = useArrayProp(paddingBottomProp), paddingLeft = useArrayProp(paddingLeftProp), paddingRight = useArrayProp(paddingRightProp), radius = useArrayProp(radiusProp), space = useArrayProp(spaceProp);
|
|
1917
1922
|
let t9, t10;
|
|
1918
|
-
$[
|
|
1923
|
+
$[27] !== padding || $[28] !== paddingBottom || $[29] !== paddingLeft || $[30] !== paddingRight || $[31] !== paddingTop || $[32] !== paddingX || $[33] !== paddingY ? (t10 = {
|
|
1919
1924
|
padding,
|
|
1920
1925
|
paddingX,
|
|
1921
1926
|
paddingY,
|
|
@@ -1923,30 +1928,30 @@ const StyledButton = /* @__PURE__ */ styledComponents.styled.button.withConfig({
|
|
|
1923
1928
|
paddingBottom,
|
|
1924
1929
|
paddingLeft,
|
|
1925
1930
|
paddingRight
|
|
1926
|
-
}, $[
|
|
1931
|
+
}, $[27] = padding, $[28] = paddingBottom, $[29] = paddingLeft, $[30] = paddingRight, $[31] = paddingTop, $[32] = paddingX, $[33] = paddingY, $[34] = t10) : t10 = $[34], t9 = t10;
|
|
1927
1932
|
const boxProps = t9, t11 = !!(loading || disabled), t12 = selected ? "" : void 0, t13 = !!(loading || disabled);
|
|
1928
1933
|
let t14;
|
|
1929
|
-
$[
|
|
1934
|
+
$[35] !== loading ? (t14 = !!loading && /* @__PURE__ */ jsxRuntime.jsx(LoadingBox, { children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }), $[35] = loading, $[36] = t14) : t14 = $[36];
|
|
1930
1935
|
let t15;
|
|
1931
|
-
$[
|
|
1936
|
+
$[37] !== IconComponent || $[38] !== IconRightComponent || $[39] !== boxProps || $[40] !== button || $[41] !== fontSize2 || $[42] !== justify || $[43] !== muted || $[44] !== space || $[45] !== text || $[46] !== textAlign || $[47] !== textWeight ? (t15 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", justify, gap: space, children: [
|
|
1932
1937
|
IconComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
1933
1938
|
react.isValidElement(IconComponent) && IconComponent,
|
|
1934
1939
|
ReactIs.isValidElementType(IconComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {})
|
|
1935
1940
|
] }),
|
|
1936
|
-
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, align: textAlign, size: fontSize2, textOverflow: "ellipsis", weight: button.textWeight, children: text }) }),
|
|
1941
|
+
text && /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(Text, { muted, align: textAlign, size: fontSize2, textOverflow: "ellipsis", weight: textWeight ?? button.textWeight, children: text }) }),
|
|
1937
1942
|
IconRightComponent && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size: fontSize2, children: [
|
|
1938
1943
|
react.isValidElement(IconRightComponent) && IconRightComponent,
|
|
1939
1944
|
ReactIs.isValidElementType(IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(IconRightComponent, {})
|
|
1940
1945
|
] })
|
|
1941
|
-
] }) }), $[
|
|
1946
|
+
] }) }), $[37] = IconComponent, $[38] = IconRightComponent, $[39] = boxProps, $[40] = button, $[41] = fontSize2, $[42] = justify, $[43] = muted, $[44] = space, $[45] = text, $[46] = textAlign, $[47] = textWeight, $[48] = t15) : t15 = $[48];
|
|
1942
1947
|
let t16;
|
|
1943
|
-
$[
|
|
1948
|
+
$[49] !== boxProps || $[50] !== children ? (t16 = children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children }), $[49] = boxProps, $[50] = children, $[51] = t16) : t16 = $[51];
|
|
1944
1949
|
let t17;
|
|
1945
|
-
return $[
|
|
1950
|
+
return $[52] !== mode || $[53] !== radius || $[54] !== ref || $[55] !== restProps || $[56] !== t11 || $[57] !== t12 || $[58] !== t13 || $[59] !== t14 || $[60] !== t15 || $[61] !== t16 || $[62] !== tone || $[63] !== type || $[64] !== width ? (t17 = /* @__PURE__ */ jsxRuntime.jsxs(StyledButton, { "data-ui": "Button", ...restProps, $mode: mode, $radius: radius, $tone: tone, "data-disabled": t11, "data-selected": t12, disabled: t13, ref, type, $width: width, children: [
|
|
1946
1951
|
t14,
|
|
1947
1952
|
t15,
|
|
1948
1953
|
t16
|
|
1949
|
-
] }), $[
|
|
1954
|
+
] }), $[52] = mode, $[53] = radius, $[54] = ref, $[55] = restProps, $[56] = t11, $[57] = t12, $[58] = t13, $[59] = t14, $[60] = t15, $[61] = t16, $[62] = tone, $[63] = type, $[64] = width, $[65] = t17) : t17 = $[65], t17;
|
|
1950
1955
|
});
|
|
1951
1956
|
Button.displayName = "ForwardRef(Button)";
|
|
1952
1957
|
function cardStyle(props) {
|
|
@@ -3560,9 +3565,7 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
|
|
|
3560
3565
|
matchReferenceWidth ? elements.floating.style.width = `${referenceWidth_0}px` : _currentWidth !== void 0 && (elements.floating.style.width = `${_currentWidth}px`), constrainSize && (elements.floating.style.maxWidth = `${Math.min(availableWidth, _maxWidth ?? 1 / 0)}px`, elements.floating.style.maxHeight = `${availableHeight}px`);
|
|
3561
3566
|
},
|
|
3562
3567
|
boundaryElement: floatingBoundary || void 0,
|
|
3563
|
-
constrainSize,
|
|
3564
3568
|
margins,
|
|
3565
|
-
matchReferenceWidth,
|
|
3566
3569
|
padding: DEFAULT_POPOVER_PADDING
|
|
3567
3570
|
})), preventOverflow && ret.push(reactDom$1.shift({
|
|
3568
3571
|
boundary: floatingBoundary || void 0,
|
|
@@ -4594,7 +4597,7 @@ const StyledTooltip = styledComponents.styled(Layer).withConfig({
|
|
|
4594
4597
|
});
|
|
4595
4598
|
Tooltip.displayName = "ForwardRef(Tooltip)";
|
|
4596
4599
|
function useCloseOnMouseLeave(t0) {
|
|
4597
|
-
const $ = reactCompilerRuntime.c(
|
|
4600
|
+
const $ = reactCompilerRuntime.c(8), {
|
|
4598
4601
|
handleIsOpenChange,
|
|
4599
4602
|
referenceElement,
|
|
4600
4603
|
showTooltip
|
|
@@ -4604,7 +4607,7 @@ function useCloseOnMouseLeave(t0) {
|
|
|
4604
4607
|
referenceElement && (referenceElement === target || target instanceof Node && referenceElement.contains(target) || (handleIsOpenChange(!1), teardown()));
|
|
4605
4608
|
}, $[0] = handleIsOpenChange, $[1] = referenceElement, $[2] = t1) : t1 = $[2];
|
|
4606
4609
|
const onMouseMove = useEffectEvent.useEffectEvent(t1);
|
|
4607
|
-
let t2
|
|
4610
|
+
let t2;
|
|
4608
4611
|
$[3] !== onMouseMove || $[4] !== showTooltip ? (t2 = () => {
|
|
4609
4612
|
if (!showTooltip)
|
|
4610
4613
|
return;
|
|
@@ -4612,7 +4615,9 @@ function useCloseOnMouseLeave(t0) {
|
|
|
4612
4615
|
onMouseMove(event.target, () => window.removeEventListener("mousemove", handleMouseMove));
|
|
4613
4616
|
};
|
|
4614
4617
|
return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
|
|
4615
|
-
},
|
|
4618
|
+
}, $[3] = onMouseMove, $[4] = showTooltip, $[5] = t2) : t2 = $[5];
|
|
4619
|
+
let t3;
|
|
4620
|
+
$[6] !== showTooltip ? (t3 = [showTooltip], $[6] = showTooltip, $[7] = t3) : t3 = $[7], react.useEffect(t2, t3);
|
|
4616
4621
|
}
|
|
4617
4622
|
const StyledHotkeys = styledComponents.styled.kbd.withConfig({
|
|
4618
4623
|
displayName: "StyledHotkeys",
|