@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.
@@ -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(8), elementsArg = t0 === void 0 ? _temp$9 : t0;
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, t3;
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
- }, 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");
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, t2;
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
- }, t2 = [handleKeyDown], $[2] = handleKeyDown, $[3] = t1, $[4] = t2) : (t1 = $[3], t2 = $[4]), react.useEffect(t1, t2);
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(64);
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], width = $[25]);
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
- $[26] !== padding || $[27] !== paddingBottom || $[28] !== paddingLeft || $[29] !== paddingRight || $[30] !== paddingTop || $[31] !== paddingX || $[32] !== paddingY ? (t10 = {
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
- }, $[26] = padding, $[27] = paddingBottom, $[28] = paddingLeft, $[29] = paddingRight, $[30] = paddingTop, $[31] = paddingX, $[32] = paddingY, $[33] = t10) : t10 = $[33], t9 = t10;
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
- $[34] !== loading ? (t14 = !!loading && /* @__PURE__ */ jsxRuntime.jsx(LoadingBox, { children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) }), $[34] = loading, $[35] = t14) : t14 = $[35];
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
- $[36] !== IconComponent || $[37] !== IconRightComponent || $[38] !== boxProps || $[39] !== button || $[40] !== fontSize2 || $[41] !== justify || $[42] !== muted || $[43] !== space || $[44] !== text || $[45] !== textAlign ? (t15 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { as: "span", justify, gap: space, children: [
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
- ] }) }), $[36] = IconComponent, $[37] = IconRightComponent, $[38] = boxProps, $[39] = button, $[40] = fontSize2, $[41] = justify, $[42] = muted, $[43] = space, $[44] = text, $[45] = textAlign, $[46] = t15) : t15 = $[46];
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
- $[47] !== boxProps || $[48] !== children ? (t16 = children && /* @__PURE__ */ jsxRuntime.jsx(Box, { as: "span", ...boxProps, children }), $[47] = boxProps, $[48] = children, $[49] = t16) : t16 = $[49];
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 $[50] !== mode || $[51] !== radius || $[52] !== ref || $[53] !== restProps || $[54] !== t11 || $[55] !== t12 || $[56] !== t13 || $[57] !== t14 || $[58] !== t15 || $[59] !== t16 || $[60] !== tone || $[61] !== type || $[62] !== 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: [
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
- ] }), $[50] = mode, $[51] = radius, $[52] = ref, $[53] = restProps, $[54] = t11, $[55] = t12, $[56] = t13, $[57] = t14, $[58] = t15, $[59] = t16, $[60] = tone, $[61] = type, $[62] = width, $[63] = t17) : t17 = $[63], t17;
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(7), {
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, t3;
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
- }, t3 = [onMouseMove, showTooltip], $[3] = onMouseMove, $[4] = showTooltip, $[5] = t2, $[6] = t3) : (t2 = $[5], t3 = $[6]), react.useEffect(t2, t3);
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",