@sanity/ui 1.7.9 → 1.7.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.
Files changed (55) hide show
  1. package/dist/index.d.ts +351 -15
  2. package/dist/index.esm.js +44 -47
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +43 -46
  5. package/dist/index.js.map +1 -1
  6. package/package.json +20 -19
  7. package/src/components/dialog/styles.ts +1 -1
  8. package/src/components/menu/__workshop__/shouldFocus.tsx +1 -1
  9. package/src/components/menu/menuDivider.ts +2 -3
  10. package/src/components/menu/menuGroup.tsx +1 -1
  11. package/src/components/tree/style.ts +4 -4
  12. package/src/primitives/_selectable/style.ts +3 -3
  13. package/src/primitives/avatar/styles.ts +6 -3
  14. package/src/primitives/badge/styles.ts +1 -1
  15. package/src/primitives/box/box.tsx +1 -0
  16. package/src/primitives/button/styles.ts +3 -2
  17. package/src/primitives/card/styles.ts +4 -4
  18. package/src/primitives/checkbox/styles.ts +3 -3
  19. package/src/primitives/code/styles.ts +3 -5
  20. package/src/primitives/container/styles.ts +1 -1
  21. package/src/primitives/flex/flex.tsx +1 -0
  22. package/src/primitives/heading/styles.ts +2 -4
  23. package/src/primitives/inline/inline.tsx +8 -1
  24. package/src/primitives/inline/styles.ts +1 -1
  25. package/src/primitives/label/styles.ts +2 -2
  26. package/src/primitives/popover/popover.tsx +2 -0
  27. package/src/primitives/radio/styles.ts +3 -3
  28. package/src/primitives/select/styles.ts +6 -5
  29. package/src/primitives/stack/styles.ts +1 -1
  30. package/src/primitives/switch/styles.ts +6 -6
  31. package/src/primitives/text/styles.ts +2 -2
  32. package/src/primitives/tooltip/tooltip.tsx +11 -22
  33. package/src/styles/border/borderStyle.ts +1 -1
  34. package/src/styles/box/boxStyle.ts +1 -1
  35. package/src/styles/colorVars/colorVarsStyle.ts +1 -1
  36. package/src/styles/flex/flexItemStyle.ts +1 -1
  37. package/src/styles/flex/flexStyle.ts +1 -1
  38. package/src/styles/font/codeFontStyle.ts +1 -1
  39. package/src/styles/font/headingFontStyle.ts +1 -1
  40. package/src/styles/font/labelFontStyle.ts +1 -1
  41. package/src/styles/font/responsiveFont.ts +1 -1
  42. package/src/styles/font/textAlignStyle.ts +1 -1
  43. package/src/styles/font/textFontStyle.ts +1 -1
  44. package/src/styles/grid/gridItemStyle.ts +1 -1
  45. package/src/styles/grid/gridStyle.ts +1 -1
  46. package/src/styles/helpers.ts +1 -1
  47. package/src/styles/input/responsiveInputPaddingStyle.ts +1 -1
  48. package/src/styles/input/textInputStyle.ts +5 -4
  49. package/src/styles/margin/marginStyle.ts +1 -1
  50. package/src/styles/padding/paddingStyle.ts +1 -1
  51. package/src/styles/radius/radiusStyle.ts +1 -1
  52. package/src/styles/shadow/shadowStyle.ts +1 -1
  53. package/src/theme/types.ts +1 -1
  54. package/src/types/index.ts +1 -0
  55. package/src/types/styled.ts +9 -0
package/dist/index.js CHANGED
@@ -3996,6 +3996,7 @@ function avatarArrowStyle() {
3996
3996
  top: "-5px",
3997
3997
  left: "50%",
3998
3998
  transform: "translateX(-6px)",
3999
+ // @ts-expect-error -- TODO wait for CSSObject types to be fixed in `styled-components` itself
3999
4000
  "&:not([hidden])": {
4000
4001
  display: "block"
4001
4002
  }
@@ -4032,13 +4033,14 @@ function avatarRootStyle(props) {
4032
4033
  opacity: 0.5
4033
4034
  },
4034
4035
  "&>svg": {
4036
+ // @ts-expect-error -- TODO wait for CSSObject types to be fixed in `styled-components` itself
4035
4037
  "&:not([hidden])": {
4036
4038
  display: "block"
4037
4039
  }
4038
4040
  },
4039
4041
  /* &:is(button) */
4040
4042
  '&[data-as="button"]': {
4041
- "-webkit-font-smoothing": "inherit",
4043
+ WebkitFontSmoothing: "inherit",
4042
4044
  appearance: "none",
4043
4045
  margin: 0,
4044
4046
  padding: 0,
@@ -4046,6 +4048,7 @@ function avatarRootStyle(props) {
4046
4048
  font: "inherit",
4047
4049
  color: "inherit",
4048
4050
  outline: "none",
4051
+ // @ts-expect-error -- TODO wait for CSSObject types to be fixed in `styled-components` itself
4049
4052
  "&:focus": {
4050
4053
  boxShadow: focusRingStyle({
4051
4054
  focusRing
@@ -4110,7 +4113,7 @@ function avatarStrokeStyle() {
4110
4113
  return {
4111
4114
  strokeWidth: "3px",
4112
4115
  '[data-status="editing"] &': {
4113
- strokeSasharray: "2 4",
4116
+ strokeDasharray: "2 4",
4114
4117
  strokeLinecap: "round"
4115
4118
  }
4116
4119
  };
@@ -4527,17 +4530,21 @@ const Flex = react.forwardRef(function Flex2(props, ref) {
4527
4530
  wrap,
4528
4531
  ...restProps
4529
4532
  } = props;
4530
- return /* @__PURE__ */jsxRuntime.jsx(Root$x, {
4531
- "data-ui": "Flex",
4532
- ...restProps,
4533
- $align: useArrayProp(align),
4534
- $direction: useArrayProp(direction),
4535
- $gap: useArrayProp(gap),
4536
- $justify: useArrayProp(justify),
4537
- $wrap: useArrayProp(wrap),
4538
- forwardedAs: as,
4539
- ref
4540
- });
4533
+ return (
4534
+ // @ts-expect-error -- some dollar prefixed typings aren't inferred correctly https://github.com/styled-components/styled-components/issues/4062
4535
+ /* @__PURE__ */
4536
+ jsxRuntime.jsx(Root$x, {
4537
+ "data-ui": "Flex",
4538
+ ...restProps,
4539
+ $align: useArrayProp(align),
4540
+ $direction: useArrayProp(direction),
4541
+ $gap: useArrayProp(gap),
4542
+ $justify: useArrayProp(justify),
4543
+ $wrap: useArrayProp(wrap),
4544
+ forwardedAs: as,
4545
+ ref
4546
+ })
4547
+ );
4541
4548
  });
4542
4549
  var __freeze$w = Object.freeze;
4543
4550
  var __defProp$x = Object.defineProperty;
@@ -6883,28 +6890,11 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
6883
6890
  boundary: boundaryElement || void 0,
6884
6891
  fallbackPlacements,
6885
6892
  padding: 4,
6886
- rootBoundary,
6887
- mainAxis: false
6893
+ rootBoundary
6888
6894
  }));
6889
6895
  ret.push(reactDom$1.offset({
6890
6896
  mainAxis: 3
6891
6897
  }));
6892
- ret.push(reactDom$1.size({
6893
- apply(_ref22) {
6894
- let {
6895
- availableWidth,
6896
- availableHeight,
6897
- elements
6898
- } = _ref22;
6899
- Object.assign(elements.floating.style, {
6900
- maxWidth: "".concat(availableWidth - 4 * 2, "px"),
6901
- // the padding is `4px`
6902
- maxHeight: "".concat(availableHeight - 4 * 2, "px")
6903
- // the padding is `4px`
6904
- });
6905
- }
6906
- }));
6907
-
6908
6898
  ret.push(reactDom$1.shift({
6909
6899
  boundary: boundaryElement || void 0,
6910
6900
  rootBoundary,
@@ -6917,16 +6907,23 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
6917
6907
  return ret;
6918
6908
  }, [boundaryElement, fallbackPlacements]);
6919
6909
  const {
6920
- floatingStyles,
6910
+ x,
6911
+ y,
6921
6912
  placement,
6922
6913
  middlewareData,
6923
6914
  refs,
6924
- update
6915
+ update,
6916
+ strategy
6925
6917
  } = reactDom$1.useFloating({
6926
6918
  middleware,
6927
6919
  placement: placementProp,
6928
6920
  whileElementsMounted: reactDom$1.autoUpdate
6929
6921
  });
6922
+ const rootStyle = react.useMemo(() => ({
6923
+ position: strategy,
6924
+ top: y != null ? y : 0,
6925
+ left: x != null ? x : 0
6926
+ }), [strategy, x, y]);
6930
6927
  const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
6931
6928
  const arrowX = (_b = middlewareData.arrow) == null ? void 0 : _b.x;
6932
6929
  const arrowY = (_c = middlewareData.arrow) == null ? void 0 : _c.y;
@@ -7000,7 +6997,7 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
7000
6997
  "data-ui": "Tooltip",
7001
6998
  ...restProps,
7002
6999
  ref: setFloating,
7003
- style: floatingStyles,
7000
+ style: rootStyle,
7004
7001
  zOffset,
7005
7002
  children: /* @__PURE__ */jsxRuntime.jsxs(Card, {
7006
7003
  "data-ui": "Tooltip__card",
@@ -7178,10 +7175,10 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7178
7175
  query,
7179
7176
  value
7180
7177
  } = state;
7181
- const defaultRenderOption = react.useCallback(_ref23 => {
7178
+ const defaultRenderOption = react.useCallback(_ref22 => {
7182
7179
  let {
7183
7180
  value: value2
7184
- } = _ref23;
7181
+ } = _ref22;
7185
7182
  return /* @__PURE__ */jsxRuntime.jsx(Card, {
7186
7183
  "data-as": "button",
7187
7184
  padding: paddingProp,
@@ -7634,10 +7631,10 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7634
7631
  }, itemIndex))
7635
7632
  });
7636
7633
  });
7637
- function dialogStyle(_ref24) {
7634
+ function dialogStyle(_ref23) {
7638
7635
  let {
7639
7636
  theme
7640
- } = _ref24;
7637
+ } = _ref23;
7641
7638
  const color = theme.sanity.color.base;
7642
7639
  return {
7643
7640
  "&:not([hidden])": {
@@ -8699,15 +8696,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
8699
8696
  var _a$6, _b$3, _c$1, _d;
8700
8697
  const keyframe = styled.keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8701
8698
  const animation = styled.css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
8702
- const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref25 => {
8699
+ const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref24 => {
8703
8700
  let {
8704
8701
  $visible
8705
- } = _ref25;
8702
+ } = _ref24;
8706
8703
  return $visible ? 1 : 0;
8707
- }, _ref26 => {
8704
+ }, _ref25 => {
8708
8705
  let {
8709
8706
  $animated
8710
- } = _ref26;
8707
+ } = _ref25;
8711
8708
  return $animated ? animation : styled.css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
8712
8709
  });
8713
8710
  const Root$4 = styled__default.default(Box)(responsiveRadiusStyle, skeletonStyle);
@@ -8738,12 +8735,12 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
8738
8735
  ref
8739
8736
  });
8740
8737
  });
8741
- const Root$3 = styled__default.default(Skeleton)(_ref27 => {
8738
+ const Root$3 = styled__default.default(Skeleton)(_ref26 => {
8742
8739
  let {
8743
8740
  $size,
8744
8741
  $style,
8745
8742
  theme
8746
- } = _ref27;
8743
+ } = _ref26;
8747
8744
  const {
8748
8745
  media
8749
8746
  } = theme.sanity;
@@ -9090,12 +9087,12 @@ function ToastProvider(props) {
9090
9087
  paddingY,
9091
9088
  children: /* @__PURE__ */jsxRuntime.jsx(framerMotion.AnimatePresence, {
9092
9089
  initial: false,
9093
- children: state.map(_ref28 => {
9090
+ children: state.map(_ref27 => {
9094
9091
  let {
9095
9092
  dismiss,
9096
9093
  id,
9097
9094
  params
9098
- } = _ref28;
9095
+ } = _ref27;
9099
9096
  return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
9100
9097
  animate: {
9101
9098
  opacity: 1,