@sanity/ui 1.7.6 → 1.7.8

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
@@ -6883,11 +6883,28 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
6883
6883
  boundary: boundaryElement || void 0,
6884
6884
  fallbackPlacements,
6885
6885
  padding: 4,
6886
- rootBoundary
6886
+ rootBoundary,
6887
+ mainAxis: false
6887
6888
  }));
6888
6889
  ret.push(reactDom$1.offset({
6889
6890
  mainAxis: 3
6890
6891
  }));
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
+
6891
6908
  ret.push(reactDom$1.shift({
6892
6909
  boundary: boundaryElement || void 0,
6893
6910
  rootBoundary,
@@ -6900,23 +6917,16 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
6900
6917
  return ret;
6901
6918
  }, [boundaryElement, fallbackPlacements]);
6902
6919
  const {
6903
- x,
6904
- y,
6920
+ floatingStyles,
6905
6921
  placement,
6906
6922
  middlewareData,
6907
6923
  refs,
6908
- update,
6909
- strategy
6924
+ update
6910
6925
  } = reactDom$1.useFloating({
6911
6926
  middleware,
6912
6927
  placement: placementProp,
6913
6928
  whileElementsMounted: reactDom$1.autoUpdate
6914
6929
  });
6915
- const rootStyle = react.useMemo(() => ({
6916
- position: strategy,
6917
- top: y != null ? y : 0,
6918
- left: x != null ? x : 0
6919
- }), [strategy, x, y]);
6920
6930
  const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
6921
6931
  const arrowX = (_b = middlewareData.arrow) == null ? void 0 : _b.x;
6922
6932
  const arrowY = (_c = middlewareData.arrow) == null ? void 0 : _c.y;
@@ -6990,7 +7000,7 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
6990
7000
  "data-ui": "Tooltip",
6991
7001
  ...restProps,
6992
7002
  ref: setFloating,
6993
- style: rootStyle,
7003
+ style: floatingStyles,
6994
7004
  zOffset,
6995
7005
  children: /* @__PURE__ */jsxRuntime.jsxs(Card, {
6996
7006
  "data-ui": "Tooltip__card",
@@ -7168,10 +7178,10 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7168
7178
  query,
7169
7179
  value
7170
7180
  } = state;
7171
- const defaultRenderOption = react.useCallback(_ref22 => {
7181
+ const defaultRenderOption = react.useCallback(_ref23 => {
7172
7182
  let {
7173
7183
  value: value2
7174
- } = _ref22;
7184
+ } = _ref23;
7175
7185
  return /* @__PURE__ */jsxRuntime.jsx(Card, {
7176
7186
  "data-as": "button",
7177
7187
  padding: paddingProp,
@@ -7624,10 +7634,10 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7624
7634
  }, itemIndex))
7625
7635
  });
7626
7636
  });
7627
- function dialogStyle(_ref23) {
7637
+ function dialogStyle(_ref24) {
7628
7638
  let {
7629
7639
  theme
7630
- } = _ref23;
7640
+ } = _ref24;
7631
7641
  const color = theme.sanity.color.base;
7632
7642
  return {
7633
7643
  "&:not([hidden])": {
@@ -8689,15 +8699,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
8689
8699
  var _a$6, _b$3, _c$1, _d;
8690
8700
  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"])));
8691
8701
  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);
8692
- 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 => {
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 => {
8693
8703
  let {
8694
8704
  $visible
8695
- } = _ref24;
8705
+ } = _ref25;
8696
8706
  return $visible ? 1 : 0;
8697
- }, _ref25 => {
8707
+ }, _ref26 => {
8698
8708
  let {
8699
8709
  $animated
8700
- } = _ref25;
8710
+ } = _ref26;
8701
8711
  return $animated ? animation : styled.css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
8702
8712
  });
8703
8713
  const Root$4 = styled__default.default(Box)(responsiveRadiusStyle, skeletonStyle);
@@ -8728,12 +8738,12 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
8728
8738
  ref
8729
8739
  });
8730
8740
  });
8731
- const Root$3 = styled__default.default(Skeleton)(_ref26 => {
8741
+ const Root$3 = styled__default.default(Skeleton)(_ref27 => {
8732
8742
  let {
8733
8743
  $size,
8734
8744
  $style,
8735
8745
  theme
8736
- } = _ref26;
8746
+ } = _ref27;
8737
8747
  const {
8738
8748
  media
8739
8749
  } = theme.sanity;
@@ -9080,12 +9090,12 @@ function ToastProvider(props) {
9080
9090
  paddingY,
9081
9091
  children: /* @__PURE__ */jsxRuntime.jsx(framerMotion.AnimatePresence, {
9082
9092
  initial: false,
9083
- children: state.map(_ref27 => {
9093
+ children: state.map(_ref28 => {
9084
9094
  let {
9085
9095
  dismiss,
9086
9096
  id,
9087
9097
  params
9088
- } = _ref27;
9098
+ } = _ref28;
9089
9099
  return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
9090
9100
  animate: {
9091
9101
  opacity: 1,