@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.
@@ -117,4 +117,3 @@ export const useTheme = cjs.useTheme;
117
117
  export const useToast = cjs.useToast;
118
118
  export const useTree = cjs.useTree;
119
119
 
120
- export default cjs.default;
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 = [];
@@ -6870,11 +6870,28 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6870
6870
  boundary: boundaryElement || void 0,
6871
6871
  fallbackPlacements,
6872
6872
  padding: 4,
6873
- rootBoundary
6873
+ rootBoundary,
6874
+ mainAxis: false
6874
6875
  }));
6875
6876
  ret.push(offset({
6876
6877
  mainAxis: 3
6877
6878
  }));
6879
+ ret.push(size$2({
6880
+ apply(_ref22) {
6881
+ let {
6882
+ availableWidth,
6883
+ availableHeight,
6884
+ elements
6885
+ } = _ref22;
6886
+ Object.assign(elements.floating.style, {
6887
+ maxWidth: "".concat(availableWidth - 4 * 2, "px"),
6888
+ // the padding is `4px`
6889
+ maxHeight: "".concat(availableHeight - 4 * 2, "px")
6890
+ // the padding is `4px`
6891
+ });
6892
+ }
6893
+ }));
6894
+
6878
6895
  ret.push(shift({
6879
6896
  boundary: boundaryElement || void 0,
6880
6897
  rootBoundary,
@@ -6887,23 +6904,16 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6887
6904
  return ret;
6888
6905
  }, [boundaryElement, fallbackPlacements]);
6889
6906
  const {
6890
- x,
6891
- y,
6907
+ floatingStyles,
6892
6908
  placement,
6893
6909
  middlewareData,
6894
6910
  refs,
6895
- update,
6896
- strategy
6911
+ update
6897
6912
  } = useFloating({
6898
6913
  middleware,
6899
6914
  placement: placementProp,
6900
6915
  whileElementsMounted: autoUpdate
6901
6916
  });
6902
- const rootStyle = useMemo(() => ({
6903
- position: strategy,
6904
- top: y != null ? y : 0,
6905
- left: x != null ? x : 0
6906
- }), [strategy, x, y]);
6907
6917
  const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
6908
6918
  const arrowX = (_b = middlewareData.arrow) == null ? void 0 : _b.x;
6909
6919
  const arrowY = (_c = middlewareData.arrow) == null ? void 0 : _c.y;
@@ -6977,7 +6987,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
6977
6987
  "data-ui": "Tooltip",
6978
6988
  ...restProps,
6979
6989
  ref: setFloating,
6980
- style: rootStyle,
6990
+ style: floatingStyles,
6981
6991
  zOffset,
6982
6992
  children: /* @__PURE__ */jsxs(Card, {
6983
6993
  "data-ui": "Tooltip__card",
@@ -7155,10 +7165,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7155
7165
  query,
7156
7166
  value
7157
7167
  } = state;
7158
- const defaultRenderOption = useCallback(_ref22 => {
7168
+ const defaultRenderOption = useCallback(_ref23 => {
7159
7169
  let {
7160
7170
  value: value2
7161
- } = _ref22;
7171
+ } = _ref23;
7162
7172
  return /* @__PURE__ */jsx(Card, {
7163
7173
  "data-as": "button",
7164
7174
  padding: paddingProp,
@@ -7611,10 +7621,10 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7611
7621
  }, itemIndex))
7612
7622
  });
7613
7623
  });
7614
- function dialogStyle(_ref23) {
7624
+ function dialogStyle(_ref24) {
7615
7625
  let {
7616
7626
  theme
7617
- } = _ref23;
7627
+ } = _ref24;
7618
7628
  const color = theme.sanity.color.base;
7619
7629
  return {
7620
7630
  "&:not([hidden])": {
@@ -8676,15 +8686,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
8676
8686
  var _a$6, _b$3, _c$1, _d;
8677
8687
  const keyframe = keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8678
8688
  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);
8679
- 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 => {
8689
+ 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 => {
8680
8690
  let {
8681
8691
  $visible
8682
- } = _ref24;
8692
+ } = _ref25;
8683
8693
  return $visible ? 1 : 0;
8684
- }, _ref25 => {
8694
+ }, _ref26 => {
8685
8695
  let {
8686
8696
  $animated
8687
- } = _ref25;
8697
+ } = _ref26;
8688
8698
  return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
8689
8699
  });
8690
8700
  const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
@@ -8715,12 +8725,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
8715
8725
  ref
8716
8726
  });
8717
8727
  });
8718
- const Root$3 = styled(Skeleton)(_ref26 => {
8728
+ const Root$3 = styled(Skeleton)(_ref27 => {
8719
8729
  let {
8720
8730
  $size,
8721
8731
  $style,
8722
8732
  theme
8723
- } = _ref26;
8733
+ } = _ref27;
8724
8734
  const {
8725
8735
  media
8726
8736
  } = theme.sanity;
@@ -9067,12 +9077,12 @@ function ToastProvider(props) {
9067
9077
  paddingY,
9068
9078
  children: /* @__PURE__ */jsx(AnimatePresence, {
9069
9079
  initial: false,
9070
- children: state.map(_ref27 => {
9080
+ children: state.map(_ref28 => {
9071
9081
  let {
9072
9082
  dismiss,
9073
9083
  id,
9074
9084
  params
9075
- } = _ref27;
9085
+ } = _ref28;
9076
9086
  return /* @__PURE__ */jsx(motion.div, {
9077
9087
  animate: {
9078
9088
  opacity: 1,