@sanity/ui 1.7.10 → 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.
package/dist/index.esm.js CHANGED
@@ -5,7 +5,7 @@ import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css,
5
5
  import { white as white$1, black as black$1, hues } from '@sanity/color';
6
6
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
7
7
  import Refractor from 'react-refractor';
8
- import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate, size as size$2 } from '@floating-ui/react-dom';
8
+ import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from '@floating-ui/react-dom';
9
9
  import { createPortal } from 'react-dom';
10
10
  import { AnimatePresence, motion } from 'framer-motion';
11
11
  const EMPTY_ARRAY = [];
@@ -6877,28 +6877,11 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6877
6877
  boundary: boundaryElement || void 0,
6878
6878
  fallbackPlacements,
6879
6879
  padding: 4,
6880
- rootBoundary,
6881
- mainAxis: false
6880
+ rootBoundary
6882
6881
  }));
6883
6882
  ret.push(offset({
6884
6883
  mainAxis: 3
6885
6884
  }));
6886
- ret.push(size$2({
6887
- apply(_ref22) {
6888
- let {
6889
- availableWidth,
6890
- availableHeight,
6891
- elements
6892
- } = _ref22;
6893
- Object.assign(elements.floating.style, {
6894
- maxWidth: "".concat(availableWidth - 4 * 2, "px"),
6895
- // the padding is `4px`
6896
- maxHeight: "".concat(availableHeight - 4 * 2, "px")
6897
- // the padding is `4px`
6898
- });
6899
- }
6900
- }));
6901
-
6902
6885
  ret.push(shift({
6903
6886
  boundary: boundaryElement || void 0,
6904
6887
  rootBoundary,
@@ -6911,16 +6894,23 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6911
6894
  return ret;
6912
6895
  }, [boundaryElement, fallbackPlacements]);
6913
6896
  const {
6914
- floatingStyles,
6897
+ x,
6898
+ y,
6915
6899
  placement,
6916
6900
  middlewareData,
6917
6901
  refs,
6918
- update
6902
+ update,
6903
+ strategy
6919
6904
  } = useFloating({
6920
6905
  middleware,
6921
6906
  placement: placementProp,
6922
6907
  whileElementsMounted: autoUpdate
6923
6908
  });
6909
+ const rootStyle = useMemo(() => ({
6910
+ position: strategy,
6911
+ top: y != null ? y : 0,
6912
+ left: x != null ? x : 0
6913
+ }), [strategy, x, y]);
6924
6914
  const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
6925
6915
  const arrowX = (_b = middlewareData.arrow) == null ? void 0 : _b.x;
6926
6916
  const arrowY = (_c = middlewareData.arrow) == null ? void 0 : _c.y;
@@ -6994,7 +6984,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6994
6984
  "data-ui": "Tooltip",
6995
6985
  ...restProps,
6996
6986
  ref: setFloating,
6997
- style: floatingStyles,
6987
+ style: rootStyle,
6998
6988
  zOffset,
6999
6989
  children: /* @__PURE__ */jsxs(Card, {
7000
6990
  "data-ui": "Tooltip__card",
@@ -7172,10 +7162,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7172
7162
  query,
7173
7163
  value
7174
7164
  } = state;
7175
- const defaultRenderOption = useCallback(_ref23 => {
7165
+ const defaultRenderOption = useCallback(_ref22 => {
7176
7166
  let {
7177
7167
  value: value2
7178
- } = _ref23;
7168
+ } = _ref22;
7179
7169
  return /* @__PURE__ */jsx(Card, {
7180
7170
  "data-as": "button",
7181
7171
  padding: paddingProp,
@@ -7628,10 +7618,10 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7628
7618
  }, itemIndex))
7629
7619
  });
7630
7620
  });
7631
- function dialogStyle(_ref24) {
7621
+ function dialogStyle(_ref23) {
7632
7622
  let {
7633
7623
  theme
7634
- } = _ref24;
7624
+ } = _ref23;
7635
7625
  const color = theme.sanity.color.base;
7636
7626
  return {
7637
7627
  "&:not([hidden])": {
@@ -8693,15 +8683,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
8693
8683
  var _a$6, _b$3, _c$1, _d;
8694
8684
  const keyframe = keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8695
8685
  const animation = 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);
8696
- const skeletonStyle = 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 => {
8686
+ const skeletonStyle = 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 => {
8697
8687
  let {
8698
8688
  $visible
8699
- } = _ref25;
8689
+ } = _ref24;
8700
8690
  return $visible ? 1 : 0;
8701
- }, _ref26 => {
8691
+ }, _ref25 => {
8702
8692
  let {
8703
8693
  $animated
8704
- } = _ref26;
8694
+ } = _ref25;
8705
8695
  return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
8706
8696
  });
8707
8697
  const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
@@ -8732,12 +8722,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
8732
8722
  ref
8733
8723
  });
8734
8724
  });
8735
- const Root$3 = styled(Skeleton)(_ref27 => {
8725
+ const Root$3 = styled(Skeleton)(_ref26 => {
8736
8726
  let {
8737
8727
  $size,
8738
8728
  $style,
8739
8729
  theme
8740
- } = _ref27;
8730
+ } = _ref26;
8741
8731
  const {
8742
8732
  media
8743
8733
  } = theme.sanity;
@@ -9084,12 +9074,12 @@ function ToastProvider(props) {
9084
9074
  paddingY,
9085
9075
  children: /* @__PURE__ */jsx(AnimatePresence, {
9086
9076
  initial: false,
9087
- children: state.map(_ref28 => {
9077
+ children: state.map(_ref27 => {
9088
9078
  let {
9089
9079
  dismiss,
9090
9080
  id,
9091
9081
  params
9092
- } = _ref28;
9082
+ } = _ref27;
9093
9083
  return /* @__PURE__ */jsx(motion.div, {
9094
9084
  animate: {
9095
9085
  opacity: 1,