@sanity/ui 1.7.11 → 1.7.12

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