@sanity/ui 1.7.7 → 1.7.9

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.d.ts CHANGED
@@ -33,7 +33,6 @@ export declare const Autocomplete: <Option extends BaseAutocompleteOption>(
33
33
  HTMLProps<HTMLInputElement>,
34
34
  | 'value'
35
35
  | 'ref'
36
- | 'type'
37
36
  | 'id'
38
37
  | 'spellCheck'
39
38
  | 'role'
@@ -49,6 +48,7 @@ export declare const Autocomplete: <Option extends BaseAutocompleteOption>(
49
48
  | 'onSelect'
50
49
  | 'as'
51
50
  | 'autoComplete'
51
+ | 'type'
52
52
  > & {
53
53
  ref?: Ref<HTMLInputElement> | undefined
54
54
  },
@@ -372,7 +372,7 @@ export declare interface BoundaryElementProviderProps {
372
372
  * @public
373
373
  */
374
374
  export declare const Box: ForwardRefExoticComponent<
375
- Omit<BoxProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as'>, 'ref'> &
375
+ Omit<BoxProps & Omit<HTMLProps<HTMLDivElement>, 'as' | 'height'>, 'ref'> &
376
376
  RefAttributes<HTMLDivElement>
377
377
  >
378
378
 
@@ -419,7 +419,7 @@ export declare type BoxSizing = 'content' | 'border'
419
419
  */
420
420
  export declare const Breadcrumbs: ForwardRefExoticComponent<
421
421
  BreadcrumbsProps &
422
- Omit<HTMLProps<HTMLOListElement>, 'ref' | 'type' | 'as'> &
422
+ Omit<HTMLProps<HTMLOListElement>, 'ref' | 'as' | 'type'> &
423
423
  RefAttributes<HTMLOListElement>
424
424
  >
425
425
 
@@ -481,7 +481,7 @@ export declare type ButtonTone = 'default' | 'primary' | 'positive' | 'caution'
481
481
  * @public
482
482
  */
483
483
  export declare const Card: ForwardRefExoticComponent<
484
- Omit<CardProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as'>, 'ref'> &
484
+ Omit<CardProps & Omit<HTMLProps<HTMLDivElement>, 'as' | 'height'>, 'ref'> &
485
485
  RefAttributes<HTMLDivElement>
486
486
  >
487
487
 
@@ -526,7 +526,7 @@ export declare type CardTone = ThemeColorToneKey | 'inherit'
526
526
  * @public
527
527
  */
528
528
  export declare const Checkbox: ForwardRefExoticComponent<
529
- Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & CheckboxProps, 'ref'> &
529
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & CheckboxProps, 'ref'> &
530
530
  RefAttributes<HTMLInputElement>
531
531
  >
532
532
 
@@ -566,7 +566,7 @@ export declare interface CodeProps {
566
566
  */
567
567
  export declare const CodeSkeleton: ForwardRefExoticComponent<
568
568
  Omit<
569
- CodeSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'children' | 'size' | 'height' | 'as'>,
569
+ CodeSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'children' | 'size' | 'as' | 'height'>,
570
570
  'ref'
571
571
  > &
572
572
  RefAttributes<HTMLDivElement>
@@ -584,7 +584,7 @@ export declare interface CodeSkeletonProps extends SkeletonProps {
584
584
  * @public
585
585
  */
586
586
  export declare const Container: ForwardRefExoticComponent<
587
- Omit<ContainerProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'width' | 'as'>, 'ref'> &
587
+ Omit<ContainerProps & Omit<HTMLProps<HTMLDivElement>, 'width' | 'as' | 'height'>, 'ref'> &
588
588
  RefAttributes<HTMLDivElement>
589
589
  >
590
590
 
@@ -847,7 +847,7 @@ export declare function _getResponsiveSpace(
847
847
  * @public
848
848
  */
849
849
  export declare const Grid: ForwardRefExoticComponent<
850
- Omit<GridProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as' | 'rows'>, 'ref'> &
850
+ Omit<GridProps & Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'rows'>, 'ref'> &
851
851
  RefAttributes<HTMLDivElement>
852
852
  >
853
853
 
@@ -938,7 +938,7 @@ export declare interface HeadingProps {
938
938
  */
939
939
  export declare const HeadingSkeleton: ForwardRefExoticComponent<
940
940
  Omit<
941
- HeadingSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'children' | 'size' | 'height' | 'as'>,
941
+ HeadingSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'children' | 'size' | 'as' | 'height'>,
942
942
  'ref'
943
943
  > &
944
944
  RefAttributes<HTMLDivElement>
@@ -1097,7 +1097,7 @@ export declare interface LabelProps {
1097
1097
  */
1098
1098
  export declare const LabelSkeleton: ForwardRefExoticComponent<
1099
1099
  Omit<
1100
- LabelSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'children' | 'size' | 'height' | 'as'>,
1100
+ LabelSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'children' | 'size' | 'as' | 'height'>,
1101
1101
  'ref'
1102
1102
  > &
1103
1103
  RefAttributes<HTMLDivElement>
@@ -1172,7 +1172,7 @@ export declare interface _MediaStore {
1172
1172
  * @public
1173
1173
  */
1174
1174
  export declare const Menu: ForwardRefExoticComponent<
1175
- Omit<MenuProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'tabIndex' | 'role' | 'as'>, 'ref'> &
1175
+ Omit<MenuProps & Omit<HTMLProps<HTMLDivElement>, 'tabIndex' | 'role' | 'as' | 'height'>, 'ref'> &
1176
1176
  RefAttributes<HTMLDivElement>
1177
1177
  >
1178
1178
 
@@ -1257,7 +1257,7 @@ export declare interface MenuGroupProps {
1257
1257
  */
1258
1258
  export declare const MenuItem: ForwardRefExoticComponent<
1259
1259
  MenuItemProps &
1260
- Omit<HTMLProps<HTMLDivElement>, 'selected' | 'ref' | 'height' | 'tabIndex' | 'as'> &
1260
+ Omit<HTMLProps<HTMLDivElement>, 'selected' | 'ref' | 'tabIndex' | 'as' | 'height'> &
1261
1261
  RefAttributes<HTMLDivElement>
1262
1262
  >
1263
1263
 
@@ -1442,7 +1442,7 @@ export declare interface PortalProviderProps {
1442
1442
  * @public
1443
1443
  */
1444
1444
  export declare const Radio: ForwardRefExoticComponent<
1445
- Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & RadioProps, 'ref'> &
1445
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & RadioProps, 'ref'> &
1446
1446
  RefAttributes<HTMLInputElement>
1447
1447
  >
1448
1448
 
@@ -1820,7 +1820,7 @@ export declare interface Styles {
1820
1820
  * @public
1821
1821
  */
1822
1822
  export declare const Switch: ForwardRefExoticComponent<
1823
- Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & SwitchProps, 'ref'> &
1823
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & SwitchProps, 'ref'> &
1824
1824
  RefAttributes<HTMLInputElement>
1825
1825
  >
1826
1826
 
@@ -1836,7 +1836,7 @@ export declare interface SwitchProps {
1836
1836
  */
1837
1837
  export declare const Tab: ForwardRefExoticComponent<
1838
1838
  Omit<
1839
- TabProps & Omit<HTMLProps<HTMLButtonElement>, 'label' | 'type' | 'id' | 'aria-controls' | 'as'>,
1839
+ TabProps & Omit<HTMLProps<HTMLButtonElement>, 'label' | 'id' | 'aria-controls' | 'as' | 'type'>,
1840
1840
  'ref'
1841
1841
  > &
1842
1842
  RefAttributes<HTMLButtonElement>
@@ -1846,7 +1846,7 @@ export declare const Tab: ForwardRefExoticComponent<
1846
1846
  * @public
1847
1847
  */
1848
1848
  export declare const TabList: ForwardRefExoticComponent<
1849
- Omit<TabListProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as'>, 'ref'> &
1849
+ Omit<TabListProps & Omit<HTMLProps<HTMLDivElement>, 'as' | 'height'>, 'ref'> &
1850
1850
  RefAttributes<unknown>
1851
1851
  >
1852
1852
 
@@ -1934,7 +1934,7 @@ export declare interface TextAreaProps extends ResponsiveRadiusProps {
1934
1934
  * @public
1935
1935
  */
1936
1936
  export declare const TextInput: ForwardRefExoticComponent<
1937
- Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | 'prefix' | 'as'>, 'ref'> &
1937
+ Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'prefix' | 'as' | 'type'>, 'ref'> &
1938
1938
  RefAttributes<HTMLInputElement>
1939
1939
  >
1940
1940
 
@@ -2011,7 +2011,7 @@ export declare interface TextProps {
2011
2011
  */
2012
2012
  export declare const TextSkeleton: ForwardRefExoticComponent<
2013
2013
  Omit<
2014
- TextSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'children' | 'size' | 'height' | 'as'>,
2014
+ TextSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'children' | 'size' | 'as' | 'height'>,
2015
2015
  'ref'
2016
2016
  > &
2017
2017
  RefAttributes<HTMLDivElement>
@@ -2679,7 +2679,7 @@ export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
2679
2679
  export declare const Tree: MemoExoticComponent<
2680
2680
  ForwardRefExoticComponent<
2681
2681
  TreeProps &
2682
- Omit<HTMLProps<HTMLDivElement>, 'ref' | 'wrap' | 'height' | 'role' | 'as' | 'align'> &
2682
+ Omit<HTMLProps<HTMLDivElement>, 'ref' | 'wrap' | 'role' | 'as' | 'height' | 'align'> &
2683
2683
  RefAttributes<HTMLDivElement>
2684
2684
  >
2685
2685
  >
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,