@sanity/ui 2.0.0-alpha.17 → 2.0.0-alpha.19

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.js CHANGED
@@ -3836,16 +3836,16 @@ const studioTheme = {
3836
3836
  avatar: {
3837
3837
  sizes: [{
3838
3838
  distance: -3,
3839
- size: 25
3839
+ size: 23
3840
3840
  }, {
3841
3841
  distance: -6,
3842
- size: 35
3842
+ size: 33
3843
3843
  }, {
3844
3844
  distance: -9,
3845
- size: 55
3845
+ size: 53
3846
3846
  }],
3847
3847
  focusRing: {
3848
- offset: 1,
3848
+ offset: 0,
3849
3849
  width: 1
3850
3850
  }
3851
3851
  },
@@ -4733,6 +4733,7 @@ function textInputRepresentationStyle(props) {
4733
4733
  $hasSuffix,
4734
4734
  $scheme,
4735
4735
  $tone,
4736
+ $unstableDisableFocusRing,
4736
4737
  theme
4737
4738
  } = props;
4738
4739
  const {
@@ -4748,13 +4749,13 @@ function textInputRepresentationStyle(props) {
4748
4749
  }), color.invalid.enabled.bg, color.invalid.enabled.fg, focusRingBorderStyle({
4749
4750
  color: color.invalid.enabled.border,
4750
4751
  width: input.border.width
4751
- }), focusRingStyle({
4752
+ }), $unstableDisableFocusRing ? void 0 : focusRingStyle({
4752
4753
  border: {
4753
4754
  color: color.default.enabled.border,
4754
4755
  width: input.border.width
4755
4756
  },
4756
4757
  focusRing
4757
- }), focusRingStyle({
4758
+ }), $unstableDisableFocusRing ? void 0 : focusRingStyle({
4758
4759
  focusRing
4759
4760
  }), color.default.disabled.bg, color.default.disabled.fg, focusRingBorderStyle({
4760
4761
  color: color.default.disabled.border,
@@ -5017,7 +5018,7 @@ function avatarBgStrokeStyle() {
5017
5018
  }
5018
5019
  function avatarStrokeStyle() {
5019
5020
  return {
5020
- strokeWidth: "3px",
5021
+ strokeWidth: "2px",
5021
5022
  '[data-status="editing"] &': {
5022
5023
  strokeDasharray: "2 4",
5023
5024
  strokeLinecap: "round"
@@ -5039,6 +5040,7 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
5039
5040
  onImageLoadError,
5040
5041
  arrowPosition: arrowPositionProp,
5041
5042
  animateArrowFrom,
5043
+ hideInnerStroke,
5042
5044
  status = "online",
5043
5045
  size: sizeProp = 0,
5044
5046
  ...restProps
@@ -5113,7 +5115,7 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
5113
5115
  cy: _radius,
5114
5116
  r: _radius,
5115
5117
  fill: "url(#".concat(imageId, ")")
5116
- }), /* @__PURE__ */jsxRuntime.jsx(BgStroke, {
5118
+ }), !hideInnerStroke && /* @__PURE__ */jsxRuntime.jsx(BgStroke, {
5117
5119
  cx: _radius,
5118
5120
  cy: _radius,
5119
5121
  rx: _radius,
@@ -5132,9 +5134,8 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
5132
5134
  children: /* @__PURE__ */jsxRuntime.jsx(Text, {
5133
5135
  as: "span",
5134
5136
  size: initialsSize,
5135
- children: /* @__PURE__ */jsxRuntime.jsx("strong", {
5136
- children: initials
5137
- })
5137
+ weight: "medium",
5138
+ children: initials
5138
5139
  })
5139
5140
  })
5140
5141
  })]
@@ -5168,7 +5169,7 @@ function _avatarCounterBaseStyle(props) {
5168
5169
  const {
5169
5170
  theme
5170
5171
  } = props;
5171
- return styled.css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n inset 0 0 0 1.5px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
5172
+ return styled.css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n inset 0 0 0 1px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
5172
5173
  }
5173
5174
  const Root$C = styled__default.default.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
5174
5175
  const AvatarCounter = react.forwardRef(function AvatarCounter2(props, ref) {
@@ -5185,9 +5186,8 @@ const AvatarCounter = react.forwardRef(function AvatarCounter2(props, ref) {
5185
5186
  children: /* @__PURE__ */jsxRuntime.jsx(Text, {
5186
5187
  as: "span",
5187
5188
  size: counterSize,
5188
- children: /* @__PURE__ */jsxRuntime.jsx("strong", {
5189
- children: count
5190
- })
5189
+ weight: "medium",
5190
+ children: count
5191
5191
  })
5192
5192
  });
5193
5193
  });
@@ -7672,6 +7672,7 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
7672
7672
  customValidity,
7673
7673
  type = "text",
7674
7674
  weight,
7675
+ unstableDisableFocusRing,
7675
7676
  ...restProps
7676
7677
  } = props;
7677
7678
  const ref = useForwardedRef(forwardedRef);
@@ -7710,6 +7711,7 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
7710
7711
  }), [prefix, radius]);
7711
7712
  const presentationNode = react.useMemo(() => /* @__PURE__ */jsxRuntime.jsxs(Presentation, {
7712
7713
  $hasPrefix,
7714
+ $unstableDisableFocusRing: unstableDisableFocusRing,
7713
7715
  $hasSuffix,
7714
7716
  $radius: radius,
7715
7717
  $scheme: rootTheme.scheme,
@@ -7730,7 +7732,7 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
7730
7732
  children: [react.isValidElement(iconRight) && iconRight, ReactIs.isValidElementType(iconRight) && react.createElement(iconRight)]
7731
7733
  })
7732
7734
  })]
7733
- }), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
7735
+ }), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix, unstableDisableFocusRing]);
7734
7736
  const clearButtonBoxPadding = react.useMemo(() => padding.map(v => {
7735
7737
  if (v === 0) return 0;
7736
7738
  if (v === 1) return 1;
@@ -7994,19 +7996,21 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
7994
7996
  const closeDelayProp = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.close) || 0;
7995
7997
  const openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp;
7996
7998
  const closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
7997
- const handleIsOpenChange = react.useCallback(open => {
7999
+ const handleIsOpenChange = react.useCallback((open, immediate) => {
7998
8000
  if (isInsideGroup) {
7999
8001
  if (open) {
8000
- delayGroupContext.setIsGroupActive(open, openDelay);
8001
- delayGroupContext.setOpenTooltipId(tooltipId, openDelay);
8002
+ const groupedOpenDelay = immediate ? 0 : openDelay;
8003
+ delayGroupContext.setIsGroupActive(open, groupedOpenDelay);
8004
+ delayGroupContext.setOpenTooltipId(tooltipId, groupedOpenDelay);
8002
8005
  } else {
8003
8006
  const minimumGroupDeactivateDelay = 200;
8004
8007
  const groupDeactivateDelay = closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay;
8005
8008
  delayGroupContext.setIsGroupActive(open, groupDeactivateDelay);
8006
- delayGroupContext.setOpenTooltipId(null, closeDelay);
8009
+ delayGroupContext.setOpenTooltipId(null, immediate ? 0 : closeDelay);
8007
8010
  }
8008
8011
  } else {
8009
- setIsOpen(open, open ? openDelay : closeDelay);
8012
+ const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay;
8013
+ setIsOpen(open, standaloneDelay);
8010
8014
  }
8011
8015
  }, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]);
8012
8016
  const handleBlur = react.useCallback(() => handleIsOpenChange(false), [handleIsOpenChange]);
@@ -8035,6 +8039,18 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
8035
8039
  if (!content) handleIsOpenChange(false);
8036
8040
  }, [content, handleIsOpenChange]);
8037
8041
  react.useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]);
8042
+ react.useEffect(() => {
8043
+ if (!showTooltip) return;
8044
+ function handleWindowKeyDown(event) {
8045
+ if (event.key === "Escape") {
8046
+ handleIsOpenChange(false, true);
8047
+ }
8048
+ }
8049
+ window.addEventListener("keydown", handleWindowKeyDown);
8050
+ return () => {
8051
+ window.removeEventListener("keydown", handleWindowKeyDown);
8052
+ };
8053
+ }, [handleIsOpenChange, showTooltip]);
8038
8054
  const setArrow = react.useCallback(arrowEl => {
8039
8055
  arrowRef.current = arrowEl;
8040
8056
  update();