@sanity/ui 0.37.13 → 0.37.14-next.5

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.
Files changed (46) hide show
  1. package/lib/dts/src/components/autocomplete/autocomplete.styles.d.ts +1 -1
  2. package/lib/dts/src/components/autocomplete/autocomplete.styles.d.ts.map +1 -1
  3. package/lib/dts/src/components/autocomplete/constants.d.ts.map +1 -1
  4. package/lib/dts/src/constants.d.ts +10 -0
  5. package/lib/dts/src/constants.d.ts.map +1 -1
  6. package/lib/dts/src/primitives/popover/popover.d.ts +6 -5
  7. package/lib/dts/src/primitives/popover/popover.d.ts.map +1 -1
  8. package/lib/dts/src/primitives/popover/{arrow.d.ts → popoverArrow.d.ts} +1 -1
  9. package/lib/dts/src/primitives/popover/popoverArrow.d.ts.map +1 -0
  10. package/lib/dts/src/primitives/popover/popoverCard.d.ts +33 -0
  11. package/lib/dts/src/primitives/popover/popoverCard.d.ts.map +1 -0
  12. package/lib/dts/src/primitives/tooltip/tooltip.d.ts +2 -0
  13. package/lib/dts/src/primitives/tooltip/tooltip.d.ts.map +1 -1
  14. package/lib/dts/src/primitives/tooltip/tooltipArrow.d.ts.map +1 -1
  15. package/lib/sanity-ui.js +488 -439
  16. package/lib/sanity-ui.js.map +1 -1
  17. package/lib/sanity-ui.modern.mjs +561 -555
  18. package/lib/sanity-ui.modern.mjs.map +1 -1
  19. package/lib/sanity-ui.module.js +489 -439
  20. package/lib/sanity-ui.module.js.map +1 -1
  21. package/package.json +5 -6
  22. package/src/components/autocomplete/autocomplete.styles.tsx +0 -5
  23. package/src/components/autocomplete/constants.ts +3 -3
  24. package/src/constants.ts +17 -0
  25. package/src/primitives/popover/__workshop__/PlainStory.tsx +1 -0
  26. package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +1 -0
  27. package/src/primitives/popover/__workshop__/TestStory.tsx +1 -0
  28. package/src/primitives/popover/popover.tsx +245 -195
  29. package/src/primitives/popover/{arrow.tsx → popoverArrow.tsx} +5 -5
  30. package/src/primitives/popover/popoverCard.tsx +160 -0
  31. package/src/primitives/tooltip/__workshop__/props.tsx +3 -1
  32. package/src/primitives/tooltip/tooltip.tsx +159 -83
  33. package/src/primitives/tooltip/tooltipArrow.tsx +25 -10
  34. package/lib/dts/src/primitives/popover/arrow.d.ts.map +0 -1
  35. package/lib/dts/src/primitives/popover/modifiers/getPopoverModifiers.d.ts +0 -4
  36. package/lib/dts/src/primitives/popover/modifiers/getPopoverModifiers.d.ts.map +0 -1
  37. package/lib/dts/src/primitives/popover/modifiers/index.d.ts +0 -2
  38. package/lib/dts/src/primitives/popover/modifiers/index.d.ts.map +0 -1
  39. package/lib/dts/src/primitives/popover/modifiers/types.d.ts +0 -18
  40. package/lib/dts/src/primitives/popover/modifiers/types.d.ts.map +0 -1
  41. package/lib/dts/src/primitives/popover/modifiers/usePopoverModifiers.d.ts +0 -4
  42. package/lib/dts/src/primitives/popover/modifiers/usePopoverModifiers.d.ts.map +0 -1
  43. package/src/primitives/popover/modifiers/getPopoverModifiers.ts +0 -137
  44. package/src/primitives/popover/modifiers/index.ts +0 -1
  45. package/src/primitives/popover/modifiers/types.ts +0 -18
  46. package/src/primitives/popover/modifiers/usePopoverModifiers.ts +0 -58
@@ -1,14 +1,13 @@
1
1
  import { useId } from '@reach/auto-id';
2
- import React, { useMemo, useState, useRef, useEffect, createContext, useContext, useLayoutEffect, forwardRef, useCallback, cloneElement, isValidElement, createElement, useReducer, Children, Fragment, memo } from 'react';
2
+ import React, { useMemo, useState, useRef, useEffect, createContext, useContext, useLayoutEffect, forwardRef, useCallback, cloneElement, isValidElement, createElement, memo, useReducer, Children, Fragment } from 'react';
3
3
  import ReactIs, { isElement, isFragment, isValidElementType } from 'react-is';
4
4
  import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
5
5
  import { ResizeObserver } from '@juggle/resize-observer';
6
6
  import { white as white$1, black as black$1, hues } from '@sanity/color';
7
7
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
8
8
  import Refractor from 'react-refractor';
9
- import { usePopper } from 'react-popper';
9
+ import { flip, size as size$1, offset, shift, arrow, useFloating, autoUpdate } from '@floating-ui/react-dom';
10
10
  import ReactDOM from 'react-dom';
11
- import maxSizeModifier from 'popper-max-size-modifier';
12
11
  import { AnimatePresence, motion } from 'framer-motion';
13
12
 
14
13
  function _extends() {
@@ -107,8 +106,25 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
107
106
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
108
107
  }
109
108
 
109
+ /**
110
+ * @internal
111
+ */
110
112
  var EMPTY_ARRAY = [];
113
+ /**
114
+ * @internal
115
+ */
116
+
111
117
  var EMPTY_RECORD = {};
118
+ /**
119
+ * @internal
120
+ */
121
+
122
+ var FLOATING_STATIC_SIDES = {
123
+ top: 'bottom',
124
+ right: 'left',
125
+ bottom: 'top',
126
+ left: 'right'
127
+ };
112
128
 
113
129
  /**
114
130
  * @internal
@@ -2923,7 +2939,7 @@ globalScope[key$7] = globalScope[key$7] || /*#__PURE__*/createContext(null);
2923
2939
 
2924
2940
  var ThemeContext = globalScope[key$7];
2925
2941
 
2926
- var _excluded$H = ["color", "layer"];
2942
+ var _excluded$I = ["color", "layer"];
2927
2943
  /**
2928
2944
  * @public
2929
2945
  */
@@ -2942,7 +2958,7 @@ function ThemeProvider(props) {
2942
2958
 
2943
2959
  var rootColor = themeProp.color,
2944
2960
  rootLayer = themeProp.layer,
2945
- restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$H);
2961
+ restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$I);
2946
2962
 
2947
2963
  var colorScheme = rootColor[scheme] || rootColor.light;
2948
2964
  var color = colorScheme[tone] || colorScheme["default"];
@@ -3685,8 +3701,8 @@ function responsiveInputPaddingIconRightStyle(props) {
3685
3701
  }));
3686
3702
  }
3687
3703
 
3688
- var _templateObject$D, _templateObject2$n, _templateObject3$e;
3689
- var ROOT_STYLE = css(_templateObject$D || (_templateObject$D = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n"])));
3704
+ var _templateObject$C, _templateObject2$m, _templateObject3$d;
3705
+ var ROOT_STYLE = css(_templateObject$C || (_templateObject$C = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n"])));
3690
3706
  function textInputRootStyle() {
3691
3707
  return ROOT_STYLE;
3692
3708
  }
@@ -3696,7 +3712,7 @@ function textInputBaseStyle(props) {
3696
3712
  $weight = props.$weight;
3697
3713
  var font = theme.sanity.fonts.text;
3698
3714
  var color = theme.sanity.color.input;
3699
- return css(_templateObject2$n || (_templateObject2$n = _taggedTemplateLiteralLoose(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $tone, color["default"].enabled.fg, color["default"].enabled.placeholder, color["default"].enabled.fg, color["default"].enabled.placeholder, color["default"].disabled.fg, color["default"].disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color["default"].readOnly.fg, color["default"].readOnly.placeholder);
3715
+ return css(_templateObject2$m || (_templateObject2$m = _taggedTemplateLiteralLoose(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $tone, color["default"].enabled.fg, color["default"].enabled.placeholder, color["default"].enabled.fg, color["default"].enabled.placeholder, color["default"].disabled.fg, color["default"].disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color["default"].readOnly.fg, color["default"].readOnly.placeholder);
3700
3716
  }
3701
3717
  function textInputFontSizeStyle(props) {
3702
3718
  var theme = props.theme;
@@ -3721,7 +3737,7 @@ function textInputRepresentationStyle(props) {
3721
3737
  focusRing = _theme$sanity2.focusRing,
3722
3738
  input = _theme$sanity2.input;
3723
3739
  var color = theme.sanity.color.input;
3724
- return css(_templateObject3$e || (_templateObject3$e = _taggedTemplateLiteralLoose(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + & {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n --input-box-shadow: ", ";\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n --input-box-shadow: ", ";\n }\n\n /* disabled */\n *:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n --input-box-shadow: ", ";\n }\n\n /* readOnly */\n *:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + & {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $tone, color["default"].enabled.bg, color["default"].enabled.fg, $border ? focusRingBorderStyle({
3740
+ return css(_templateObject3$d || (_templateObject3$d = _taggedTemplateLiteralLoose(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + & {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n --input-box-shadow: ", ";\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n --input-box-shadow: ", ";\n }\n\n /* disabled */\n *:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n --input-box-shadow: ", ";\n }\n\n /* readOnly */\n *:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + & {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $tone, color["default"].enabled.bg, color["default"].enabled.fg, $border ? focusRingBorderStyle({
3725
3741
  color: color["default"].enabled.border,
3726
3742
  width: input.border.width
3727
3743
  }) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
@@ -3789,20 +3805,20 @@ function responsiveShadowStyle(props) {
3789
3805
  });
3790
3806
  }
3791
3807
 
3792
- var _templateObject$C, _templateObject2$m, _templateObject3$d;
3808
+ var _templateObject$B, _templateObject2$l, _templateObject3$c;
3793
3809
  function textBaseStyle(props) {
3794
3810
  var $accent = props.$accent,
3795
3811
  $muted = props.$muted,
3796
3812
  theme = props.theme;
3797
3813
  var weights = theme.sanity.fonts.text.weights;
3798
- return css(_templateObject$C || (_templateObject$C = _taggedTemplateLiteralLoose(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$m || (_templateObject2$m = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$d || (_templateObject3$d = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
3814
+ return css(_templateObject$B || (_templateObject$B = _taggedTemplateLiteralLoose(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$c || (_templateObject3$c = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
3799
3815
  }
3800
3816
 
3801
- var _excluded$G = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
3817
+ var _excluded$H = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
3802
3818
 
3803
- var _templateObject$B;
3819
+ var _templateObject$A;
3804
3820
  var Root$E = styled.div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
3805
- var SpanWithTextOverflow$2 = styled.span(_templateObject$B || (_templateObject$B = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
3821
+ var SpanWithTextOverflow$2 = styled.span(_templateObject$A || (_templateObject$A = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
3806
3822
  /**
3807
3823
  * @public
3808
3824
  */
@@ -3818,7 +3834,7 @@ var Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
3818
3834
  size = _props$size === void 0 ? 2 : _props$size,
3819
3835
  textOverflow = props.textOverflow,
3820
3836
  weight = props.weight,
3821
- restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
3837
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$H);
3822
3838
 
3823
3839
  var children = childrenProp;
3824
3840
 
@@ -3978,7 +3994,7 @@ function avatarStrokeStyle() {
3978
3994
  };
3979
3995
  }
3980
3996
 
3981
- var _excluded$F = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
3997
+ var _excluded$G = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
3982
3998
  var Root$D = styled.div(responsiveAvatarSizeStyle, avatarStyle.root);
3983
3999
  var Arrow = styled.div(avatarStyle.arrow);
3984
4000
  var BgStroke = styled.ellipse(avatarStyle.bgStroke);
@@ -4002,7 +4018,7 @@ var Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4002
4018
  status = _props$status === void 0 ? 'online' : _props$status,
4003
4019
  _props$size = props.size,
4004
4020
  sizeProp = _props$size === void 0 ? 0 : _props$size,
4005
- restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4021
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
4006
4022
 
4007
4023
  var as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
4008
4024
  var size = useArrayProp(sizeProp);
@@ -4107,7 +4123,7 @@ var Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4107
4123
  }, /*#__PURE__*/React.createElement("strong", null, initials)))));
4108
4124
  });
4109
4125
 
4110
- var _templateObject$A;
4126
+ var _templateObject$z;
4111
4127
 
4112
4128
  function _responsiveAvatarCounterSizeStyle(props) {
4113
4129
  var theme = props.theme;
@@ -4127,7 +4143,7 @@ function _responsiveAvatarCounterSizeStyle(props) {
4127
4143
 
4128
4144
  function _avatarCounterBaseStyle(props) {
4129
4145
  var theme = props.theme;
4130
- return css(_templateObject$A || (_templateObject$A = _taggedTemplateLiteralLoose(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow: 0 0 0 1px var(--card-bg-color), inset 0 0 0 1.5px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
4146
+ return css(_templateObject$z || (_templateObject$z = _taggedTemplateLiteralLoose(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow: 0 0 0 1px var(--card-bg-color), inset 0 0 0 1.5px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
4131
4147
  }
4132
4148
 
4133
4149
  var Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
@@ -4162,10 +4178,10 @@ function childrenToElementArray(children) {
4162
4178
  });
4163
4179
  }
4164
4180
 
4165
- var _excluded$E = ["children", "maxLength", "size"];
4181
+ var _excluded$F = ["children", "maxLength", "size"];
4166
4182
 
4167
- var _templateObject$z;
4168
- var BASE_STYLES = css(_templateObject$z || (_templateObject$z = _taggedTemplateLiteralLoose(["\n white-space: nowrap;\n\n & > div {\n vertical-align: top;\n\n &:not([hidden]) {\n display: inline-block;\n }\n }\n"])));
4183
+ var _templateObject$y;
4184
+ var BASE_STYLES = css(_templateObject$y || (_templateObject$y = _taggedTemplateLiteralLoose(["\n white-space: nowrap;\n\n & > div {\n vertical-align: top;\n\n &:not([hidden]) {\n display: inline-block;\n }\n }\n"])));
4169
4185
 
4170
4186
  function avatarStackStyle() {
4171
4187
  return BASE_STYLES;
@@ -4198,7 +4214,7 @@ var AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4198
4214
  maxLengthProp = _props$maxLength === void 0 ? 4 : _props$maxLength,
4199
4215
  _props$size = props.size,
4200
4216
  sizeProp = _props$size === void 0 ? 0 : _props$size,
4201
- restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4217
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4202
4218
 
4203
4219
  var children = childrenToElementArray(childrenProp).filter(function (child) {
4204
4220
  return typeof child !== 'string';
@@ -4228,7 +4244,7 @@ var AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4228
4244
  }));
4229
4245
  });
4230
4246
 
4231
- var _excluded$D = ["as", "column", "columnStart", "columnEnd", "display", "flex", "height", "margin", "marginX", "marginY", "marginTop", "marginRight", "marginBottom", "marginLeft", "overflow", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "row", "rowStart", "rowEnd", "sizing"];
4247
+ var _excluded$E = ["as", "column", "columnStart", "columnEnd", "display", "flex", "height", "margin", "marginX", "marginY", "marginTop", "marginRight", "marginBottom", "marginLeft", "overflow", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "row", "rowStart", "rowEnd", "sizing"];
4232
4248
  var Root$A = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle);
4233
4249
  /**
4234
4250
  * @public
@@ -4265,7 +4281,7 @@ var Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4265
4281
  rowStart = props.rowStart,
4266
4282
  rowEnd = props.rowEnd,
4267
4283
  sizing = props.sizing,
4268
- restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4284
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4269
4285
 
4270
4286
  return /*#__PURE__*/React.createElement(Root$A, _extends({
4271
4287
  "data-as": typeof asProp === 'string' ? asProp : undefined,
@@ -4301,20 +4317,20 @@ var Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4301
4317
  }), props.children);
4302
4318
  });
4303
4319
 
4304
- var _templateObject$y, _templateObject2$l, _templateObject3$c;
4320
+ var _templateObject$x, _templateObject2$k, _templateObject3$b;
4305
4321
  function labelBaseStyle(props) {
4306
4322
  var $accent = props.$accent,
4307
4323
  $muted = props.$muted,
4308
4324
  theme = props.theme;
4309
4325
  var fonts = theme.sanity.fonts;
4310
- return css(_templateObject$y || (_templateObject$y = _taggedTemplateLiteralLoose(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$c || (_templateObject3$c = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
4326
+ return css(_templateObject$x || (_templateObject$x = _taggedTemplateLiteralLoose(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$k || (_templateObject2$k = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$b || (_templateObject3$b = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
4311
4327
  }
4312
4328
 
4313
- var _excluded$C = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
4329
+ var _excluded$D = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
4314
4330
 
4315
- var _templateObject$x;
4331
+ var _templateObject$w;
4316
4332
  var Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
4317
- var SpanWithTextOverflow$1 = styled.span(_templateObject$x || (_templateObject$x = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
4333
+ var SpanWithTextOverflow$1 = styled.span(_templateObject$w || (_templateObject$w = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
4318
4334
  /**
4319
4335
  * @public
4320
4336
  */
@@ -4329,7 +4345,7 @@ var Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
4329
4345
  size = _props$size === void 0 ? 2 : _props$size,
4330
4346
  textOverflow = props.textOverflow,
4331
4347
  weight = props.weight,
4332
- restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
4348
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4333
4349
 
4334
4350
  var children = childrenProp;
4335
4351
 
@@ -4368,7 +4384,7 @@ function badgeStyle(props) {
4368
4384
  };
4369
4385
  }
4370
4386
 
4371
- var _excluded$B = ["children", "fontSize", "mode", "padding", "radius", "tone"];
4387
+ var _excluded$C = ["children", "fontSize", "mode", "padding", "radius", "tone"];
4372
4388
  var Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
4373
4389
  /**
4374
4390
  * @public
@@ -4385,7 +4401,7 @@ var Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4385
4401
  radius = _props$radius === void 0 ? 2 : _props$radius,
4386
4402
  _props$tone = props.tone,
4387
4403
  tone = _props$tone === void 0 ? 'default' : _props$tone,
4388
- restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
4404
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
4389
4405
 
4390
4406
  return /*#__PURE__*/React.createElement(Root$y, _extends({
4391
4407
  "data-ui": "Badge"
@@ -4400,7 +4416,7 @@ var Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4400
4416
  }, children));
4401
4417
  });
4402
4418
 
4403
- var _excluded$A = ["align", "as", "direction", "gap", "justify", "wrap"];
4419
+ var _excluded$B = ["align", "as", "direction", "gap", "justify", "wrap"];
4404
4420
  var Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
4405
4421
  /**
4406
4422
  * @public
@@ -4414,7 +4430,7 @@ var Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4414
4430
  gap = props.gap,
4415
4431
  justify = props.justify,
4416
4432
  wrap = props.wrap,
4417
- restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
4433
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
4418
4434
 
4419
4435
  return /*#__PURE__*/React.createElement(Root$x, _extends({
4420
4436
  "data-ui": "Flex"
@@ -4429,9 +4445,9 @@ var Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4429
4445
  }));
4430
4446
  });
4431
4447
 
4432
- var _templateObject$w, _templateObject2$k;
4433
- var rotate$1 = keyframes(_templateObject$w || (_templateObject$w = _taggedTemplateLiteralLoose(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
4434
- var Root$w = styled(Text)(_templateObject2$k || (_templateObject2$k = _taggedTemplateLiteralLoose(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
4448
+ var _templateObject$v, _templateObject2$j;
4449
+ var rotate$1 = keyframes(_templateObject$v || (_templateObject$v = _taggedTemplateLiteralLoose(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
4450
+ var Root$w = styled(Text)(_templateObject2$j || (_templateObject2$j = _taggedTemplateLiteralLoose(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
4435
4451
  /**
4436
4452
  * @public
4437
4453
  */
@@ -4481,13 +4497,13 @@ function _colorVarsStyle(base, color, checkered) {
4481
4497
  };
4482
4498
  }
4483
4499
 
4484
- var _templateObject$v;
4500
+ var _templateObject$u;
4485
4501
  /**
4486
4502
  * @internal
4487
4503
  */
4488
4504
 
4489
4505
  function buttonBaseStyles() {
4490
- return css(_templateObject$v || (_templateObject$v = _taggedTemplateLiteralLoose(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])));
4506
+ return css(_templateObject$u || (_templateObject$u = _taggedTemplateLiteralLoose(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])));
4491
4507
  }
4492
4508
  var buttonTheme = {
4493
4509
  border: {
@@ -4536,11 +4552,11 @@ function buttonColorStyles(props) {
4536
4552
  }, (_theme$sanity$styles = theme.sanity.styles) == null ? void 0 : (_theme$sanity$styles$ = _theme$sanity$styles.button) == null ? void 0 : _theme$sanity$styles$.root].filter(Boolean);
4537
4553
  }
4538
4554
 
4539
- var _excluded$z = ["children", "disabled", "fontSize", "icon", "iconRight", "justify", "loading", "mode", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "radius", "selected", "space", "text", "textAlign", "tone", "type"];
4555
+ var _excluded$A = ["children", "disabled", "fontSize", "icon", "iconRight", "justify", "loading", "mode", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "radius", "selected", "space", "text", "textAlign", "tone", "type"];
4540
4556
 
4541
- var _templateObject$u;
4557
+ var _templateObject$t;
4542
4558
  var Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
4543
- var LoadingBox = styled.div(_templateObject$u || (_templateObject$u = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--card-bg-color);\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])));
4559
+ var LoadingBox = styled.div(_templateObject$t || (_templateObject$t = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--card-bg-color);\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])));
4544
4560
  /**
4545
4561
  * @public
4546
4562
  */
@@ -4575,7 +4591,7 @@ var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4575
4591
  tone = _props$tone === void 0 ? 'default' : _props$tone,
4576
4592
  _props$type = props.type,
4577
4593
  type = _props$type === void 0 ? 'button' : _props$type,
4578
- restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
4594
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
4579
4595
 
4580
4596
  var justify = useArrayProp(justifyProp);
4581
4597
  var padding = useArrayProp(paddingProp);
@@ -4634,7 +4650,7 @@ var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4634
4650
  }, boxProps), children));
4635
4651
  });
4636
4652
 
4637
- var _templateObject$t, _templateObject2$j, _templateObject3$b;
4653
+ var _templateObject$s, _templateObject2$i, _templateObject3$a;
4638
4654
  function cardStyle(props) {
4639
4655
  return [cardBaseStyle(props), cardColorStyle(props)];
4640
4656
  }
@@ -4642,7 +4658,7 @@ function cardBaseStyle(props) {
4642
4658
  var $checkered = props.$checkered,
4643
4659
  theme = props.theme;
4644
4660
  var space = theme.sanity.space;
4645
- return css(_templateObject$t || (_templateObject$t = _taggedTemplateLiteralLoose(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_templateObject2$j || (_templateObject2$j = _taggedTemplateLiteralLoose(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
4661
+ return css(_templateObject$s || (_templateObject$s = _taggedTemplateLiteralLoose(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_templateObject2$i || (_templateObject2$i = _taggedTemplateLiteralLoose(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
4646
4662
  }
4647
4663
  function cardColorStyle(props) {
4648
4664
  var _theme$sanity$styles, _theme$sanity$styles$;
@@ -4658,7 +4674,7 @@ function cardColorStyle(props) {
4658
4674
  width: 0,
4659
4675
  color: 'var(--card-border-color)'
4660
4676
  };
4661
- return css(_templateObject3$b || (_templateObject3$b = _taggedTemplateLiteralLoose(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n\n /* &:is(button) */\n &[data-as='button'] {\n --card-focus-ring-box-shadow: none;\n\n cursor: default;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n cursor: pointer;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, card.enabled, $checkered), _colorVarsStyle(base, card.disabled, $checkered), _colorVarsStyle(base, card.pressed, $checkered), _colorVarsStyle(base, card.selected, $checkered), _colorVarsStyle(base, card.hovered, $checkered), _colorVarsStyle(base, card.pressed, $checkered), $focusRing ? focusRingStyle({
4677
+ return css(_templateObject3$a || (_templateObject3$a = _taggedTemplateLiteralLoose(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n\n /* &:is(button) */\n &[data-as='button'] {\n --card-focus-ring-box-shadow: none;\n\n cursor: default;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n cursor: pointer;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, card.enabled, $checkered), _colorVarsStyle(base, card.disabled, $checkered), _colorVarsStyle(base, card.pressed, $checkered), _colorVarsStyle(base, card.selected, $checkered), _colorVarsStyle(base, card.hovered, $checkered), _colorVarsStyle(base, card.pressed, $checkered), $focusRing ? focusRingStyle({
4662
4678
  base: base,
4663
4679
  border: border,
4664
4680
  focusRing: focusRing
@@ -4669,7 +4685,7 @@ function cardColorStyle(props) {
4669
4685
  }) : undefined, $focusRing ? focusRingBorderStyle(border) : undefined, (_theme$sanity$styles = theme.sanity.styles) == null ? void 0 : (_theme$sanity$styles$ = _theme$sanity$styles.card) == null ? void 0 : _theme$sanity$styles$.root);
4670
4686
  }
4671
4687
 
4672
- var _excluded$y = ["__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "pressed", "radius", "scheme", "selected", "shadow", "tone"];
4688
+ var _excluded$z = ["__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "pressed", "radius", "scheme", "selected", "shadow", "tone"];
4673
4689
  var Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
4674
4690
  /**
4675
4691
  * @public
@@ -4694,7 +4710,7 @@ var Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
4694
4710
  shadow = props.shadow,
4695
4711
  _props$tone = props.tone,
4696
4712
  toneProp = _props$tone === void 0 ? 'default' : _props$tone,
4697
- restProps = _objectWithoutPropertiesLoose(props, _excluded$y);
4713
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
4698
4714
 
4699
4715
  var as = isValidElementType(asProp) ? asProp : 'div';
4700
4716
  var rootTheme = useRootTheme();
@@ -4727,9 +4743,9 @@ var Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
4727
4743
  })));
4728
4744
  });
4729
4745
 
4730
- var _templateObject$s, _templateObject2$i;
4746
+ var _templateObject$r, _templateObject2$h;
4731
4747
  function checkboxBaseStyles() {
4732
- return css(_templateObject$s || (_templateObject$s = _taggedTemplateLiteralLoose(["\n position: relative;\n display: inline-block;\n "])));
4748
+ return css(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n position: relative;\n display: inline-block;\n "])));
4733
4749
  }
4734
4750
  function inputElementStyles(props) {
4735
4751
  var theme = props.theme;
@@ -4738,7 +4754,7 @@ function inputElementStyles(props) {
4738
4754
  focusRing = _theme$sanity.focusRing,
4739
4755
  input = _theme$sanity.input,
4740
4756
  radius = _theme$sanity.radius;
4741
- return css(_templateObject2$i || (_templateObject2$i = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n outline: none;\n opacity: 0;\n z-index: 1;\n padding: 0;\n margin: 0;\n\n & + span {\n position: relative;\n display: block;\n height: ", ";\n width: ", ";\n box-sizing: border-box;\n box-shadow: ", ";\n border-radius: ", ";\n line-height: 1;\n background-color: ", ";\n\n & > svg {\n display: block;\n position: absolute;\n opacity: 0;\n height: 100%;\n width: 100%;\n\n & > path {\n vector-effect: non-scaling-stroke;\n stroke-width: 2 !important;\n }\n }\n }\n\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span > svg:first-child {\n opacity: 1;\n }\n\n &[data-read-only] + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n &:not([data-read-only]):disabled + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n &:indeterminate + span > svg:last-child {\n opacity: 1;\n }\n "])), rem(input.checkbox.size), rem(input.checkbox.size), focusRingBorderStyle({
4757
+ return css(_templateObject2$h || (_templateObject2$h = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n outline: none;\n opacity: 0;\n z-index: 1;\n padding: 0;\n margin: 0;\n\n & + span {\n position: relative;\n display: block;\n height: ", ";\n width: ", ";\n box-sizing: border-box;\n box-shadow: ", ";\n border-radius: ", ";\n line-height: 1;\n background-color: ", ";\n\n & > svg {\n display: block;\n position: absolute;\n opacity: 0;\n height: 100%;\n width: 100%;\n\n & > path {\n vector-effect: non-scaling-stroke;\n stroke-width: 2 !important;\n }\n }\n }\n\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span > svg:first-child {\n opacity: 1;\n }\n\n &[data-read-only] + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n &:not([data-read-only]):disabled + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n &:indeterminate + span > svg:last-child {\n opacity: 1;\n }\n "])), rem(input.checkbox.size), rem(input.checkbox.size), focusRingBorderStyle({
4742
4758
  color: color["default"].enabled.border,
4743
4759
  width: input.border.width
4744
4760
  }), rem(radius[2]), color["default"].enabled.bg, focusRingStyle({
@@ -4759,7 +4775,7 @@ function inputElementStyles(props) {
4759
4775
  }), color["default"].disabled.fg);
4760
4776
  }
4761
4777
 
4762
- var _excluded$x = ["checked", "className", "disabled", "indeterminate", "customValidity", "readOnly", "style"];
4778
+ var _excluded$y = ["checked", "className", "disabled", "indeterminate", "customValidity", "readOnly", "style"];
4763
4779
  var Root$t = styled.div(checkboxBaseStyles);
4764
4780
  var Input$5 = styled.input(inputElementStyles);
4765
4781
  /**
@@ -4774,7 +4790,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef) {
4774
4790
  customValidity = props.customValidity,
4775
4791
  readOnly = props.readOnly,
4776
4792
  style = props.style,
4777
- restProps = _objectWithoutPropertiesLoose(props, _excluded$x);
4793
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$y);
4778
4794
 
4779
4795
  var ref = useForwardedRef(forwardedRef);
4780
4796
  useCustomValidity(ref, customValidity);
@@ -4799,7 +4815,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef) {
4799
4815
  })), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CheckmarkIcon, null), /*#__PURE__*/React.createElement(RemoveIcon, null)));
4800
4816
  });
4801
4817
 
4802
- var _templateObject$r;
4818
+ var _templateObject$q;
4803
4819
 
4804
4820
  function codeSyntaxHighlightingStyle(_ref) {
4805
4821
  var theme = _ref.theme;
@@ -4917,10 +4933,10 @@ function codeSyntaxHighlightingStyle(_ref) {
4917
4933
  }
4918
4934
 
4919
4935
  function codeBaseStyle() {
4920
- return css(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n color: var(--card-code-fg-color);\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ", "\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), codeSyntaxHighlightingStyle);
4936
+ return css(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n color: var(--card-code-fg-color);\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ", "\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), codeSyntaxHighlightingStyle);
4921
4937
  }
4922
4938
 
4923
- var _excluded$w = ["children", "language", "size", "weight"];
4939
+ var _excluded$x = ["children", "language", "size", "weight"];
4924
4940
  var Root$s = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
4925
4941
  /**
4926
4942
  * @public
@@ -4932,7 +4948,7 @@ var Code = /*#__PURE__*/forwardRef(function Code(props, ref) {
4932
4948
  _props$size = props.size,
4933
4949
  size = _props$size === void 0 ? 2 : _props$size,
4934
4950
  weight = props.weight,
4935
- restProps = _objectWithoutPropertiesLoose(props, _excluded$w);
4951
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$x);
4936
4952
 
4937
4953
  var language = typeof languageProp === 'string' ? languageProp : undefined;
4938
4954
  var registered = language ? Refractor.hasLanguage(language) : false;
@@ -4968,7 +4984,7 @@ function responsiveContainerWidthStyle(props) {
4968
4984
  });
4969
4985
  }
4970
4986
 
4971
- var _excluded$v = ["as", "width"];
4987
+ var _excluded$w = ["as", "width"];
4972
4988
  var Root$r = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
4973
4989
  /**
4974
4990
  * @public
@@ -4978,7 +4994,7 @@ var Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
4978
4994
  var as = props.as,
4979
4995
  _props$width = props.width,
4980
4996
  width = _props$width === void 0 ? 2 : _props$width,
4981
- restProps = _objectWithoutPropertiesLoose(props, _excluded$v);
4997
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$w);
4982
4998
 
4983
4999
  return /*#__PURE__*/React.createElement(Root$r, _extends({
4984
5000
  "data-ui": "Container"
@@ -4989,7 +5005,7 @@ var Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
4989
5005
  }));
4990
5006
  });
4991
5007
 
4992
- var _excluded$u = ["as", "autoRows", "autoCols", "autoFlow", "columns", "gap", "gapX", "gapY", "rows", "children"];
5008
+ var _excluded$v = ["as", "autoRows", "autoCols", "autoFlow", "columns", "gap", "gapX", "gapY", "rows", "children"];
4993
5009
  var Root$q = styled(Box)(responsiveGridStyle);
4994
5010
  /**
4995
5011
  * @public
@@ -5006,7 +5022,7 @@ var Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
5006
5022
  gapY = props.gapY,
5007
5023
  rows = props.rows,
5008
5024
  children = props.children,
5009
- restProps = _objectWithoutPropertiesLoose(props, _excluded$u);
5025
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$v);
5010
5026
 
5011
5027
  return /*#__PURE__*/React.createElement(Root$q, _extends({
5012
5028
  "data-as": typeof as === 'string' ? as : undefined,
@@ -5025,19 +5041,19 @@ var Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
5025
5041
  }), children);
5026
5042
  });
5027
5043
 
5028
- var _templateObject$q, _templateObject2$h, _templateObject3$a;
5044
+ var _templateObject$p, _templateObject2$g, _templateObject3$9;
5029
5045
  function headingBaseStyle(props) {
5030
5046
  var $accent = props.$accent,
5031
5047
  $muted = props.$muted,
5032
5048
  theme = props.theme;
5033
- return css(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$h || (_templateObject2$h = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$a || (_templateObject3$a = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
5049
+ return css(_templateObject$p || (_templateObject$p = _taggedTemplateLiteralLoose(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$g || (_templateObject2$g = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$9 || (_templateObject3$9 = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
5034
5050
  }
5035
5051
 
5036
- var _excluded$t = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
5052
+ var _excluded$u = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
5037
5053
 
5038
- var _templateObject$p;
5054
+ var _templateObject$o;
5039
5055
  var Root$p = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
5040
- var SpanWithTextOverflow = styled.span(_templateObject$p || (_templateObject$p = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
5056
+ var SpanWithTextOverflow = styled.span(_templateObject$o || (_templateObject$o = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
5041
5057
  /**
5042
5058
  * @public
5043
5059
  */
@@ -5053,7 +5069,7 @@ var Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
5053
5069
  size = _props$size === void 0 ? 2 : _props$size,
5054
5070
  textOverflow = props.textOverflow,
5055
5071
  weight = props.weight,
5056
- restProps = _objectWithoutPropertiesLoose(props, _excluded$t);
5072
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$u);
5057
5073
 
5058
5074
  var children = childrenProp;
5059
5075
 
@@ -5098,7 +5114,7 @@ function inlineSpaceStyle(props) {
5098
5114
  });
5099
5115
  }
5100
5116
 
5101
- var _excluded$s = ["as", "children", "space"];
5117
+ var _excluded$t = ["as", "children", "space"];
5102
5118
  var Root$o = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
5103
5119
  /**
5104
5120
  * @public
@@ -5108,7 +5124,7 @@ var Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
5108
5124
  var as = props.as,
5109
5125
  childrenProp = props.children,
5110
5126
  space = props.space,
5111
- restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
5127
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$t);
5112
5128
 
5113
5129
  var children = useMemo(function () {
5114
5130
  return childrenToElementArray(childrenProp).filter(Boolean).map(function (child, idx) {
@@ -5126,12 +5142,12 @@ var Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
5126
5142
  }), children);
5127
5143
  });
5128
5144
 
5129
- var _excluded$r = ["children", "fontSize", "padding", "radius"];
5145
+ var _excluded$s = ["children", "fontSize", "padding", "radius"];
5130
5146
 
5131
- var _templateObject$o;
5147
+ var _templateObject$n;
5132
5148
 
5133
5149
  function kbdStyle() {
5134
- return css(_templateObject$o || (_templateObject$o = _taggedTemplateLiteralLoose(["\n background: var(--card-bg-color);\n font: inherit;\n box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
5150
+ return css(_templateObject$n || (_templateObject$n = _taggedTemplateLiteralLoose(["\n background: var(--card-bg-color);\n font: inherit;\n box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
5135
5151
  }
5136
5152
 
5137
5153
  var Root$n = styled.kbd(responsiveRadiusStyle, kbdStyle);
@@ -5147,7 +5163,7 @@ var KBD = /*#__PURE__*/forwardRef(function KBD(props, ref) {
5147
5163
  padding = _props$padding === void 0 ? 1 : _props$padding,
5148
5164
  _props$radius = props.radius,
5149
5165
  radius = _props$radius === void 0 ? 2 : _props$radius,
5150
- restProps = _objectWithoutPropertiesLoose(props, _excluded$r);
5166
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
5151
5167
 
5152
5168
  return /*#__PURE__*/React.createElement(Root$n, _extends({
5153
5169
  "data-ui": "KBD"
@@ -5233,7 +5249,7 @@ function findMinBreakpoints(media, width) {
5233
5249
  return ret;
5234
5250
  }
5235
5251
 
5236
- var _excluded$q = ["children", "media"];
5252
+ var _excluded$r = ["children", "media"];
5237
5253
  /**
5238
5254
  * DO NOT USE IN PRODUCTION.
5239
5255
  * @beta
@@ -5245,7 +5261,7 @@ var ElementQuery = /*#__PURE__*/forwardRef(function ElementQuery(props, ref) {
5245
5261
  var children = props.children,
5246
5262
  _props$media = props.media,
5247
5263
  media = _props$media === void 0 ? theme.sanity.media : _props$media,
5248
- restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
5264
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$r);
5249
5265
 
5250
5266
  var forwardedRef = useForwardedRef(ref);
5251
5267
 
@@ -5402,16 +5418,16 @@ function LayerProvider(props) {
5402
5418
  }, children);
5403
5419
  }
5404
5420
 
5405
- var _excluded$p = ["children", "style"],
5421
+ var _excluded$q = ["children", "style"],
5406
5422
  _excluded2$1 = ["children", "zOffset"];
5407
5423
 
5408
- var _templateObject$n;
5409
- var Root$m = styled.div(_templateObject$n || (_templateObject$n = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
5424
+ var _templateObject$m;
5425
+ var Root$m = styled.div(_templateObject$m || (_templateObject$m = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
5410
5426
  var LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref) {
5411
5427
  var children = props.children,
5412
5428
  _props$style = props.style,
5413
5429
  style = _props$style === void 0 ? EMPTY_RECORD : _props$style,
5414
- restProps = _objectWithoutPropertiesLoose(props, _excluded$p);
5430
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
5415
5431
 
5416
5432
  var _useLayer = useLayer(),
5417
5433
  zIndex = _useLayer.zIndex;
@@ -5559,8 +5575,8 @@ function PortalProvider(props) {
5559
5575
  }, children);
5560
5576
  }
5561
5577
 
5562
- var _templateObject$m;
5563
- var Root$l = styled.div(_templateObject$m || (_templateObject$m = _taggedTemplateLiteralLoose(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
5578
+ var _templateObject$l;
5579
+ var Root$l = styled.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
5564
5580
  /**
5565
5581
  * @public
5566
5582
  */
@@ -5742,11 +5758,11 @@ function _isScrollable(el) {
5742
5758
  return style.overflowX.includes('auto') || style.overflowX.includes('scroll') || style.overflowY.includes('auto') || style.overflowY.includes('scroll');
5743
5759
  }
5744
5760
 
5745
- var _excluded$o = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
5761
+ var _excluded$p = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
5746
5762
 
5747
- var _templateObject$l, _templateObject2$g;
5748
- var Root$k = styled.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
5749
- var ItemWrapper = styled.div(_templateObject2$g || (_templateObject2$g = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
5763
+ var _templateObject$k, _templateObject2$f;
5764
+ var Root$k = styled.div(_templateObject$k || (_templateObject$k = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
5765
+ var ItemWrapper = styled.div(_templateObject2$f || (_templateObject2$f = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
5750
5766
  /**
5751
5767
  * @beta
5752
5768
  */
@@ -5761,7 +5777,7 @@ var VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
5761
5777
  items = _props$items === void 0 ? [] : _props$items,
5762
5778
  onChange = props.onChange,
5763
5779
  renderItem = props.renderItem,
5764
- restProps = _objectWithoutPropertiesLoose(props, _excluded$o);
5780
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$p);
5765
5781
 
5766
5782
  var space = useTheme().sanity.space;
5767
5783
  var forwardedRef = useForwardedRef(ref);
@@ -5890,13 +5906,13 @@ var VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
5890
5906
  }, children));
5891
5907
  });
5892
5908
 
5893
- var _templateObject$k, _templateObject2$f, _templateObject3$9;
5894
- var Root$j = styled.div(_templateObject$k || (_templateObject$k = _taggedTemplateLiteralLoose(["\n position: absolute;\n pointer-events: none;\n width: 27px;\n height: 27px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 13.5px 13.5px;\n }\n\n [data-popper-placement^='top'] > div > & {\n bottom: -27px;\n }\n\n [data-popper-placement^='right'] > div > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-popper-placement^='left'] > div > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-popper-placement^='bottom'] > div > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
5895
- var BorderPath = styled.path(_templateObject2$f || (_templateObject2$f = _taggedTemplateLiteralLoose(["\n fill: var(--card-shadow-outline-color);\n"])));
5896
- var ShapePath = styled.path(_templateObject3$9 || (_templateObject3$9 = _taggedTemplateLiteralLoose(["\n fill: var(--card-bg-color);\n"])));
5909
+ var _templateObject$j, _templateObject2$e, _templateObject3$8;
5910
+ var Root$j = styled.div(_templateObject$j || (_templateObject$j = _taggedTemplateLiteralLoose(["\n position: absolute;\n pointer-events: none;\n width: 27px;\n height: 27px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 13.5px 13.5px;\n }\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
5911
+ var BorderPath = styled.path(_templateObject2$e || (_templateObject2$e = _taggedTemplateLiteralLoose(["\n fill: var(--card-shadow-outline-color);\n"])));
5912
+ var ShapePath = styled.path(_templateObject3$8 || (_templateObject3$8 = _taggedTemplateLiteralLoose(["\n fill: var(--card-bg-color);\n"])));
5897
5913
  var PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
5898
5914
  return /*#__PURE__*/React.createElement(Root$j, _extends({
5899
- "data-ui": "PopoverArrow"
5915
+ "data-ui": "Popover__arrow"
5900
5916
  }, props, {
5901
5917
  ref: ref
5902
5918
  }), /*#__PURE__*/React.createElement("svg", {
@@ -5912,317 +5928,309 @@ var PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
5912
5928
  })));
5913
5929
  });
5914
5930
 
5915
- /*
5916
-
5917
- The order of popper phases:
5931
+ var _excluded$o = ["__unstable_margins", "arrow", "arrowRef", "arrowX", "arrowY", "availableHeight", "availableWidth", "boundaryWidth", "children", "padding", "placement", "overflow", "radius", "referenceWidth", "scheme", "shadow", "strategy", "tone", "width", "x", "y"];
5918
5932
 
5919
- - beforeRead
5920
- - read
5921
- - afterRead
5922
- - beforeMain
5923
- - main
5924
- - afterMain
5925
- - beforeWrite
5926
- - write
5927
- - afterWrite
5933
+ function popoverCardStyle(props) {
5934
+ var $boundaryWidth = props.$boundaryWidth;
5935
+ return {
5936
+ maxWidth: $boundaryWidth ? $boundaryWidth - 16 + "px" : 'calc(100% - 16px)'
5937
+ };
5938
+ }
5928
5939
 
5929
- */
5940
+ var Root$i = /*#__PURE__*/memo(styled(Card)(popoverCardStyle));
5941
+ /**
5942
+ * @internal
5943
+ */
5930
5944
 
5931
- function getPopoverModifiers(props) {
5932
- var allowedAutoPlacements = props.allowedAutoPlacements,
5945
+ var PopoverCard = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function PopoverCard(props, ref) {
5946
+ var marginsProp = props.__unstable_margins,
5933
5947
  arrow = props.arrow,
5934
- arrowElement = props.arrowElement,
5935
- boundaryElement = props.boundaryElement,
5936
- constrainSize = props.constrainSize,
5937
- distance = props.distance,
5938
- fallbackPlacements = props.fallbackPlacements,
5939
- margins = props.margins,
5940
- matchReferenceWidth = props.matchReferenceWidth,
5941
- open = props.open,
5942
- preventOverflow = props.preventOverflow,
5943
- skidding = props.skidding,
5944
- tether = props.tether,
5945
- tetherOffset = props.tetherOffset; // NOTE: For later viewers:
5946
- // Prior to adding this change, the popover would get `maxWidth: 0` the 2nd time it
5947
- // was opened, when used with `constrainSize`. I was looking for a way to "reset"
5948
- // the size of the popover as measured by Popper.js, and this seems to be a workaround.
5949
-
5950
- if (!open) {
5951
- return [];
5952
- }
5948
+ arrowRef = props.arrowRef,
5949
+ arrowX = props.arrowX,
5950
+ arrowY = props.arrowY,
5951
+ availableHeight = props.availableHeight,
5952
+ availableWidth = props.availableWidth,
5953
+ boundaryWidth = props.boundaryWidth,
5954
+ children = props.children,
5955
+ padding = props.padding,
5956
+ placement = props.placement,
5957
+ overflow = props.overflow,
5958
+ radius = props.radius,
5959
+ referenceWidthProp = props.referenceWidth,
5960
+ scheme = props.scheme,
5961
+ shadow = props.shadow,
5962
+ strategy = props.strategy,
5963
+ tone = props.tone,
5964
+ width = props.width,
5965
+ xProp = props.x,
5966
+ yProp = props.y,
5967
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$o);
5953
5968
 
5954
- var detectOverflowOptions = {
5955
- altAxis: !constrainSize,
5956
- boundary: boundaryElement || undefined,
5957
- padding: 8,
5958
- tether: tether,
5959
- tetherOffset: tetherOffset
5960
- };
5961
- return [constrainSize && _extends({}, maxSizeModifier, {
5962
- options: detectOverflowOptions
5963
- }), constrainSize && {
5964
- name: 'applyMaxSize',
5965
- enabled: true,
5966
- phase: 'beforeWrite',
5967
- requires: ['maxSize'],
5968
- fn: function fn(_ref) {
5969
- var state = _ref.state;
5970
- var _state$modifiersData$ = state.modifiersData.maxSize,
5971
- width = _state$modifiersData$.width,
5972
- height = _state$modifiersData$.height;
5973
- state.styles.popper = _extends({}, state.styles.popper, {
5974
- maxWidth: width + "px",
5975
- maxHeight: height + "px"
5976
- });
5977
- }
5978
- }, arrow && {
5979
- name: 'arrow',
5980
- options: {
5981
- element: arrowElement,
5982
- padding: 4
5983
- }
5984
- }, (constrainSize || preventOverflow) && {
5985
- name: 'preventOverflow',
5986
- options: detectOverflowOptions
5987
- }, {
5988
- name: 'offset',
5989
- options: {
5990
- offset: [skidding, distance]
5991
- }
5992
- }, margins && {
5993
- name: 'margins',
5994
- enabled: true,
5995
- phase: 'beforeRead',
5996
- fn: function fn(_ref2) {
5997
- var state = _ref2.state;
5998
- var rects = state.rects;
5999
-
6000
- if (rects.reference) {
6001
- rects.reference.x += margins[3];
6002
- rects.reference.y += margins[1];
6003
- rects.reference.width -= margins[1] + margins[3];
6004
- rects.reference.height -= margins[0] + margins[2];
6005
- }
6006
- }
6007
- }, {
6008
- name: 'flip',
6009
- options: {
6010
- allowedAutoPlacements: allowedAutoPlacements,
6011
- boundary: boundaryElement || undefined,
6012
- fallbackPlacements: fallbackPlacements,
6013
- padding: 8
6014
- }
6015
- }, matchReferenceWidth && {
6016
- name: 'matchWidth',
6017
- enabled: true,
6018
- phase: 'beforeWrite',
6019
- requires: ['computeStyles'],
6020
- fn: function fn(_ref3) {
6021
- var state = _ref3.state;
6022
- var width = state.rects.reference.width;
6023
- state.styles.popper.width = width + "px";
6024
- },
6025
- effect: function effect(_ref4) {
6026
- var state = _ref4.state;
6027
- var refElement = state.elements.reference;
5969
+ var _useLayer = useLayer(),
5970
+ zIndex = _useLayer.zIndex; // top right bottom left
6028
5971
 
6029
- if (refElement instanceof HTMLElement) {
6030
- state.elements.popper.style.width = refElement.offsetWidth - (margins ? margins[1] + margins[3] : 0) + "px";
6031
- }
6032
- }
6033
- }].filter(Boolean);
6034
- }
6035
5972
 
6036
- function usePopoverModifiers(props) {
6037
- var allowedAutoPlacements = props.allowedAutoPlacements,
6038
- arrow = props.arrow,
6039
- arrowElement = props.arrowElement,
6040
- boundaryElement = props.boundaryElement,
6041
- constrainSize = props.constrainSize,
6042
- distance = props.distance,
6043
- fallbackPlacements = props.fallbackPlacements,
6044
- margins = props.margins,
6045
- matchReferenceWidth = props.matchReferenceWidth,
6046
- open = props.open,
6047
- preventOverflow = props.preventOverflow,
6048
- skidding = props.skidding,
6049
- tether = props.tether,
6050
- tetherOffset = props.tetherOffset;
6051
- return useMemo(function () {
6052
- return getPopoverModifiers({
6053
- allowedAutoPlacements: allowedAutoPlacements,
6054
- arrow: arrow,
6055
- arrowElement: arrowElement,
6056
- boundaryElement: boundaryElement,
6057
- constrainSize: constrainSize,
6058
- distance: distance,
6059
- fallbackPlacements: fallbackPlacements,
6060
- margins: margins,
6061
- matchReferenceWidth: matchReferenceWidth,
6062
- open: open,
6063
- preventOverflow: preventOverflow,
6064
- skidding: skidding,
6065
- tether: tether,
6066
- tetherOffset: tetherOffset
6067
- });
6068
- }, [allowedAutoPlacements, arrow, arrowElement, boundaryElement, constrainSize, distance, fallbackPlacements, margins, matchReferenceWidth, open, preventOverflow, skidding, tether, tetherOffset]);
6069
- }
5973
+ var margins = useMemo(function () {
5974
+ return marginsProp || [0, 0, 0, 0];
5975
+ }, [marginsProp]); // translate according to margins
6070
5976
 
6071
- var _excluded$n = ["__unstable_margins", "allowedAutoPlacements", "arrow", "boundaryElement", "children", "content", "constrainSize", "disabled", "fallbackPlacements", "open", "padding", "placement", "portal", "preventOverflow", "radius", "referenceElement", "matchReferenceWidth", "shadow", "scheme", "style", "tether", "tetherOffset", "tone", "width", "zOffset"];
5977
+ var referenceWidth = referenceWidthProp ? referenceWidthProp - margins[1] - margins[3] : undefined;
5978
+ var x = (xProp != null ? xProp : 0) + margins[3];
5979
+ var y = (yProp != null ? yProp : 0) + margins[0];
5980
+ var maxWidth = availableWidth ? Math.min(availableWidth - 8, referenceWidth || Infinity) : undefined;
5981
+ var rootStyle = useMemo(function () {
5982
+ return {
5983
+ position: strategy,
5984
+ top: y,
5985
+ left: x,
5986
+ zIndex: zIndex,
5987
+ width: referenceWidth,
5988
+ maxWidth: referenceWidth ? undefined : maxWidth
5989
+ };
5990
+ }, [referenceWidth, maxWidth, strategy, x, y, zIndex]);
5991
+ var wrapperStyle = useMemo(function () {
5992
+ return {
5993
+ minHeight: 25,
5994
+ maxHeight: availableHeight ? availableHeight - 8 : undefined
5995
+ };
5996
+ }, [availableHeight]);
5997
+ var staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]];
5998
+ var arrowStyle = useMemo(function () {
5999
+ var style = {
6000
+ left: arrowX !== null ? arrowX : undefined,
6001
+ top: arrowY !== null ? arrowY : undefined,
6002
+ right: undefined,
6003
+ bottom: undefined
6004
+ };
6005
+ if (staticSide) style[staticSide] = -27;
6006
+ return style;
6007
+ }, [arrowX, arrowY, staticSide]);
6008
+ return /*#__PURE__*/React.createElement(Root$i, _extends({}, restProps, {
6009
+ "$boundaryWidth": boundaryWidth,
6010
+ "data-placement": placement,
6011
+ "data-ui": "Popover",
6012
+ radius: radius,
6013
+ ref: ref,
6014
+ scheme: scheme,
6015
+ shadow: shadow,
6016
+ style: rootStyle,
6017
+ tone: tone,
6018
+ "$width": width
6019
+ }), /*#__PURE__*/React.createElement(Box, {
6020
+ "data-ui": "Popover__wrapper",
6021
+ overflow: overflow,
6022
+ padding: padding,
6023
+ sizing: "border",
6024
+ style: wrapperStyle
6025
+ }, children), arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
6026
+ ref: arrowRef,
6027
+ style: arrowStyle
6028
+ }));
6029
+ }));
6030
+ PopoverCard.displayName = 'PopoverCard';
6072
6031
 
6073
- var _templateObject$j, _templateObject2$e, _templateObject3$8;
6074
- var Root$i = styled(Layer)(function (_ref) {
6075
- var $preventOverflow = _ref.$preventOverflow;
6076
- return css(_templateObject$j || (_templateObject$j = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n display: flex;\n flex-direction: column;\n max-width: calc(100% - 16px);\n\n & > * {\n min-height: 0;\n }\n\n /* Hide the popover when the reference element is out of bounds */\n ", "\n "])), $preventOverflow && css(_templateObject2$e || (_templateObject2$e = _taggedTemplateLiteralLoose(["\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n "]))));
6077
- });
6078
- var PopoverCard = styled(Card)(function (_ref2) {
6079
- var $constrainSize = _ref2.$constrainSize;
6080
- return css(_templateObject3$8 || (_templateObject3$8 = _taggedTemplateLiteralLoose(["\n flex: 1;\n max-height: ", ";\n pointer-events: all;\n\n && {\n display: flex;\n }\n\n flex-direction: column;\n\n & > * {\n min-height: 0;\n }\n\n ", "\n "])), $constrainSize && '100%', responsiveContainerWidthStyle);
6081
- });
6082
- /**
6083
- * @public
6084
- */
6032
+ var _excluded$n = ["__unstable_margins", "allowedAutoPlacements", "arrow", "boundaryElement", "children", "constrainSize", "content", "disabled", "fallbackPlacements", "matchReferenceWidth", "open", "overflow", "padding", "placement", "portal", "preventOverflow", "radius", "referenceElement", "scheme", "shadow", "tether", "tetherOffset", "tone", "width", "zOffset"];
6085
6033
 
6086
- var Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6087
- var _theme$sanity$layer;
6034
+ function size(scope) {
6035
+ return size$1({
6036
+ apply: function apply(args) {
6037
+ if (scope.constrainSize) {
6038
+ scope.setAvailableWidth(args.availableWidth);
6039
+ scope.setAvailableHeight(args.availableHeight);
6040
+ }
6041
+
6042
+ if (scope.matchReferenceWidth) {
6043
+ scope.setReferenceWidth(args.rects.reference.width);
6044
+ }
6045
+ },
6046
+ boundary: scope.boundaryElement || undefined
6047
+ });
6048
+ }
6049
+
6050
+ var Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Popover(props, ref) {
6051
+ var _theme$sanity$layer, _useElementSize, _middlewareData$arrow, _middlewareData$arrow2;
6088
6052
 
6089
- var boundaryElementContext = useBoundaryElement();
6090
6053
  var theme = useTheme();
6054
+ var boundaryElementContext = useBoundaryElement();
6091
6055
 
6092
6056
  var margins = props.__unstable_margins,
6093
- allowedAutoPlacements = props.allowedAutoPlacements,
6094
6057
  _props$arrow = props.arrow,
6095
- arrow = _props$arrow === void 0 ? true : _props$arrow,
6058
+ arrowProp = _props$arrow === void 0 ? true : _props$arrow,
6096
6059
  _props$boundaryElemen = props.boundaryElement,
6097
- boundaryElementProp = _props$boundaryElemen === void 0 ? boundaryElementContext.element : _props$boundaryElemen,
6098
- child = props.children,
6060
+ boundaryElement = _props$boundaryElemen === void 0 ? boundaryElementContext.element : _props$boundaryElemen,
6061
+ childProp = props.children,
6062
+ _props$constrainSize = props.constrainSize,
6063
+ constrainSize = _props$constrainSize === void 0 ? false : _props$constrainSize,
6099
6064
  content = props.content,
6100
- constrainSize = props.constrainSize,
6101
6065
  disabled = props.disabled,
6102
6066
  fallbackPlacements = props.fallbackPlacements,
6103
- _props$open = props.open,
6104
- open = _props$open === void 0 ? false : _props$open,
6105
- padding = props.padding,
6067
+ matchReferenceWidthProp = props.matchReferenceWidth,
6068
+ open = props.open,
6069
+ _props$overflow = props.overflow,
6070
+ overflow = _props$overflow === void 0 ? props.constrainSize ? 'auto' : undefined : _props$overflow,
6071
+ paddingProp = props.padding,
6106
6072
  _props$placement = props.placement,
6107
- placement = _props$placement === void 0 ? 'bottom' : _props$placement,
6108
- _props$portal = props.portal,
6109
- portalProp = _props$portal === void 0 ? false : _props$portal,
6110
- preventOverflow = props.preventOverflow,
6073
+ placementProp = _props$placement === void 0 ? 'bottom' : _props$placement,
6074
+ portal = props.portal,
6075
+ _props$preventOverflo = props.preventOverflow,
6076
+ preventOverflow = _props$preventOverflo === void 0 ? true : _props$preventOverflo,
6111
6077
  _props$radius = props.radius,
6112
- radius = _props$radius === void 0 ? 3 : _props$radius,
6113
- referenceElementProp = props.referenceElement,
6114
- matchReferenceWidth = props.matchReferenceWidth,
6115
- _props$shadow = props.shadow,
6116
- shadow = _props$shadow === void 0 ? 3 : _props$shadow,
6078
+ radiusProp = _props$radius === void 0 ? 3 : _props$radius,
6079
+ referenceElement = props.referenceElement,
6117
6080
  scheme = props.scheme,
6118
- _props$style = props.style,
6119
- style = _props$style === void 0 ? EMPTY_RECORD : _props$style,
6120
- tether = props.tether,
6121
- tetherOffset = props.tetherOffset,
6081
+ _props$shadow = props.shadow,
6082
+ shadowProp = _props$shadow === void 0 ? 3 : _props$shadow,
6122
6083
  _props$tone = props.tone,
6123
6084
  tone = _props$tone === void 0 ? 'inherit' : _props$tone,
6124
6085
  _props$width = props.width,
6125
- widthProp = _props$width === void 0 ? 0 : _props$width,
6086
+ widthProp = _props$width === void 0 ? undefined : _props$width,
6126
6087
  _props$zOffset = props.zOffset,
6127
- zOffset = _props$zOffset === void 0 ? (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset : _props$zOffset,
6088
+ zOffsetProp = _props$zOffset === void 0 ? (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset : _props$zOffset,
6128
6089
  restProps = _objectWithoutPropertiesLoose(props, _excluded$n);
6129
6090
 
6091
+ var boundarySize = (_useElementSize = useElementSize(boundaryElement)) == null ? void 0 : _useElementSize.border;
6092
+ var padding = useArrayProp(paddingProp);
6093
+ var radius = useArrayProp(radiusProp);
6094
+ var shadow = useArrayProp(shadowProp);
6095
+ var width = useArrayProp(widthProp);
6096
+ var zOffset = useArrayProp(zOffsetProp);
6097
+
6098
+ var _useState = useState(undefined),
6099
+ availableWidth = _useState[0],
6100
+ setAvailableWidth = _useState[1];
6101
+
6102
+ var _useState2 = useState(undefined),
6103
+ availableHeight = _useState2[0],
6104
+ setAvailableHeight = _useState2[1];
6105
+
6106
+ var _useState3 = useState(undefined),
6107
+ referenceWidth = _useState3[0],
6108
+ setReferenceWidth = _useState3[1];
6109
+
6130
6110
  var forwardedRef = useForwardedRef(ref);
6131
- var portal = usePortal();
6111
+ var arrowRef = useRef(null);
6112
+ var rootBoundary = 'viewport';
6113
+ var middleware = useMemo(function () {
6114
+ var ret = []; // Flip the floating element when leaving the boundary box
6132
6115
 
6133
- var _useState = useState(null),
6134
- referenceElement = _useState[0],
6135
- setReferenceElement = _useState[1];
6116
+ if (constrainSize || preventOverflow) {
6117
+ ret.push(flip({
6118
+ boundary: boundaryElement || undefined,
6119
+ fallbackPlacements: fallbackPlacements,
6120
+ padding: 8,
6121
+ rootBoundary: rootBoundary
6122
+ }));
6123
+ } // Track sizes
6136
6124
 
6137
- var _useState2 = useState(null),
6138
- popperElement = _useState2[0],
6139
- setPopperElement = _useState2[1];
6140
6125
 
6141
- var _useState3 = useState(null),
6142
- arrowElement = _useState3[0],
6143
- setArrowElement = _useState3[1];
6126
+ ret.push(size({
6127
+ boundaryElement: boundaryElement,
6128
+ constrainSize: constrainSize,
6129
+ matchReferenceWidth: matchReferenceWidthProp,
6130
+ setAvailableHeight: setAvailableHeight,
6131
+ setAvailableWidth: setAvailableWidth,
6132
+ setReferenceWidth: setReferenceWidth
6133
+ })); // Define distance between reference and floating element
6134
+
6135
+ ret.push(offset({
6136
+ mainAxis: arrowProp ? 4 : 0
6137
+ })); // Shift the popover so its sits with the boundary eleement
6138
+
6139
+ if (preventOverflow) {
6140
+ ret.push(shift({
6141
+ boundary: boundaryElement || undefined,
6142
+ rootBoundary: rootBoundary,
6143
+ padding: 8
6144
+ }));
6145
+ } // Place arrow
6144
6146
 
6145
- var popperReferenceElement = referenceElementProp || referenceElement;
6146
- var width = useArrayProp(widthProp);
6147
- var modifiers = usePopoverModifiers({
6148
- allowedAutoPlacements: allowedAutoPlacements,
6149
- arrow: arrow,
6150
- arrowElement: arrowElement,
6151
- boundaryElement: boundaryElementProp || portal.boundaryElement,
6152
- constrainSize: constrainSize,
6153
- distance: arrow ? 4 : 0,
6154
- fallbackPlacements: fallbackPlacements,
6155
- margins: margins,
6156
- matchReferenceWidth: matchReferenceWidth,
6157
- open: open,
6158
- preventOverflow: preventOverflow,
6159
- skidding: 0,
6160
- tether: tether,
6161
- tetherOffset: tetherOffset
6162
- });
6163
- var popper = usePopper(popperReferenceElement, popperElement, {
6164
- placement: placement,
6165
- modifiers: modifiers
6166
- });
6167
- var attributes = popper.attributes,
6168
- forceUpdate = popper.forceUpdate,
6169
- styles = popper.styles;
6170
- var setRef = useCallback(function (el) {
6171
- var childRef = child.ref;
6172
- setReferenceElement(el);
6147
+
6148
+ if (arrowProp) {
6149
+ ret.push(arrow({
6150
+ element: arrowRef,
6151
+ padding: 4
6152
+ }));
6153
+ }
6154
+
6155
+ return ret;
6156
+ }, [arrowProp, boundaryElement, constrainSize, fallbackPlacements, matchReferenceWidthProp, preventOverflow]);
6157
+
6158
+ var _useFloating = useFloating({
6159
+ middleware: middleware,
6160
+ placement: placementProp,
6161
+ whileElementsMounted: autoUpdate
6162
+ }),
6163
+ x = _useFloating.x,
6164
+ y = _useFloating.y,
6165
+ placement = _useFloating.placement,
6166
+ reference = _useFloating.reference,
6167
+ floating = _useFloating.floating,
6168
+ middlewareData = _useFloating.middlewareData,
6169
+ strategy = _useFloating.strategy;
6170
+
6171
+ var arrowX = (_middlewareData$arrow = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow.x;
6172
+ var arrowY = (_middlewareData$arrow2 = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow2.y;
6173
+ var setArrow = useCallback(function (arrowEl) {
6174
+ arrowRef.current = arrowEl;
6175
+ }, []);
6176
+ var setFloating = useCallback(function (node) {
6177
+ forwardedRef.current = node;
6178
+ floating(node);
6179
+ }, [floating, forwardedRef]);
6180
+ var setReference = useCallback(function (node) {
6181
+ reference(node);
6182
+ var childRef = childProp == null ? void 0 : childProp.ref;
6173
6183
 
6174
6184
  if (typeof childRef === 'function') {
6175
- childRef(el);
6185
+ childRef(node);
6176
6186
  } else if (childRef) {
6177
- childRef.current = el;
6187
+ childRef.current = node;
6178
6188
  }
6179
- }, [child]);
6180
- var setRootRef = useCallback(function (el) {
6181
- setPopperElement(el);
6182
- forwardedRef.current = el;
6183
- }, [forwardedRef]);
6184
- var popoverStyle = useMemo(function () {
6185
- return _extends({}, style, styles.popper);
6186
- }, [style, styles]);
6189
+ }, [childProp, reference]);
6190
+ var child = useMemo(function () {
6191
+ if (!childProp || referenceElement) return null;
6192
+ return /*#__PURE__*/cloneElement(childProp, {
6193
+ ref: setReference
6194
+ });
6195
+ }, [childProp, referenceElement, setReference]);
6187
6196
  useEffect(function () {
6188
- if (forceUpdate) {
6189
- try {
6190
- forceUpdate();
6191
- } catch (_) {// ignore caught error
6192
- }
6193
- }
6194
- }, [content, forceUpdate, open, popperReferenceElement]);
6197
+ if (referenceElement) reference(referenceElement);
6198
+ }, [reference, referenceElement]);
6195
6199
 
6196
6200
  if (disabled) {
6197
- return child || /*#__PURE__*/React.createElement(React.Fragment, null);
6201
+ return childProp || /*#__PURE__*/React.createElement(React.Fragment, null);
6198
6202
  }
6199
6203
 
6200
- var node = /*#__PURE__*/React.createElement(Root$i, _extends({
6201
- "data-ui": "Popover"
6202
- }, restProps, {
6203
- "$preventOverflow": preventOverflow,
6204
- ref: setRootRef,
6205
- style: popoverStyle,
6204
+ var popover = /*#__PURE__*/React.createElement(LayerProvider, {
6206
6205
  zOffset: zOffset
6207
- }, attributes.popper), /*#__PURE__*/React.createElement(PopoverCard, {
6208
- "$constrainSize": constrainSize,
6209
- "$width": width,
6210
- "data-ui": "PopoverCard",
6206
+ }, /*#__PURE__*/React.createElement(PopoverCard, _extends({}, restProps, {
6207
+ __unstable_margins: margins,
6208
+ arrow: arrowProp,
6209
+ arrowRef: setArrow,
6210
+ arrowX: arrowX,
6211
+ arrowY: arrowY,
6212
+ availableWidth: constrainSize ? availableWidth : undefined,
6213
+ availableHeight: constrainSize ? availableHeight : undefined,
6214
+ boundaryWidth: boundarySize == null ? void 0 : boundarySize.width,
6215
+ overflow: overflow,
6211
6216
  padding: padding,
6217
+ placement: placement,
6212
6218
  radius: radius,
6219
+ ref: setFloating,
6220
+ referenceWidth: matchReferenceWidthProp ? referenceWidth : undefined,
6213
6221
  scheme: scheme,
6214
6222
  shadow: shadow,
6215
- tone: tone
6216
- }, arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
6217
- ref: setArrowElement,
6218
- style: styles.arrow
6223
+ strategy: strategy,
6224
+ tone: tone,
6225
+ x: x,
6226
+ y: y,
6227
+ width: width
6219
6228
  }), content));
6220
- return /*#__PURE__*/React.createElement(React.Fragment, null, child && !referenceElementProp ? /*#__PURE__*/cloneElement(child, {
6221
- ref: setRef
6222
- }) : child || /*#__PURE__*/React.createElement(React.Fragment, null), open && /*#__PURE__*/React.createElement(React.Fragment, null, portalProp && /*#__PURE__*/React.createElement(Portal, {
6223
- __unstable_name: typeof portalProp === 'string' ? portalProp : undefined
6224
- }, node), !portalProp && node));
6225
- });
6229
+ return /*#__PURE__*/React.createElement(React.Fragment, null, open && /*#__PURE__*/React.createElement(React.Fragment, null, portal ? /*#__PURE__*/React.createElement(Portal, {
6230
+ __unstable_name: typeof portal === 'string' ? portal : undefined
6231
+ }, popover) : popover), child);
6232
+ }));
6233
+ Popover.displayName = 'Popover';
6226
6234
 
6227
6235
  var _templateObject$i, _templateObject2$d;
6228
6236
  function radioBaseStyle() {
@@ -6764,13 +6772,15 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef)
6764
6772
  });
6765
6773
 
6766
6774
  var _templateObject$d, _templateObject2$9, _templateObject3$4;
6767
- var Root$b = styled.div(_templateObject$d || (_templateObject$d = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n }\n\n [data-popper-placement^='top'] > div > & {\n bottom: -15px;\n }\n\n [data-popper-placement^='right'] > div > & {\n left: -15px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-popper-placement^='left'] > div > & {\n right: -15px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-popper-placement^='bottom'] > div > & {\n top: -15px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
6775
+ var Root$b = styled.div(_templateObject$d || (_templateObject$d = _taggedTemplateLiteralLoose(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
6768
6776
  var Border = styled.path(_templateObject2$9 || (_templateObject2$9 = _taggedTemplateLiteralLoose(["\n fill: var(--card-shadow-outline-color);\n"])));
6769
6777
  var Shape = styled.path(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteralLoose(["\n fill: var(--card-bg-color);\n"])));
6770
6778
  var TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
6771
6779
  var restProps = _extends({}, props);
6772
6780
 
6773
- return /*#__PURE__*/React.createElement(Root$b, _extends({}, restProps, {
6781
+ return /*#__PURE__*/React.createElement(Root$b, _extends({
6782
+ "data-ui": "Tooltip__arrow"
6783
+ }, restProps, {
6774
6784
  ref: ref
6775
6785
  }), /*#__PURE__*/React.createElement("svg", {
6776
6786
  width: "15",
@@ -6783,7 +6793,7 @@ var TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
6783
6793
  })));
6784
6794
  });
6785
6795
 
6786
- var _excluded$g = ["allowedAutoPlacements", "boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "zOffset"];
6796
+ var _excluded$g = ["boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "shadow", "zOffset"];
6787
6797
 
6788
6798
  var _templateObject$c;
6789
6799
  var Root$a = styled(Layer)(_templateObject$c || (_templateObject$c = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n"])));
@@ -6792,22 +6802,23 @@ var Root$a = styled(Layer)(_templateObject$c || (_templateObject$c = _taggedTemp
6792
6802
  */
6793
6803
 
6794
6804
  var Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
6795
- var _theme$sanity$layer;
6805
+ var _theme$sanity$layer, _middlewareData$arrow, _middlewareData$arrow2;
6796
6806
 
6797
6807
  var boundaryElementContext = useBoundaryElement();
6798
6808
  var theme = useTheme();
6799
6809
 
6800
- var allowedAutoPlacements = props.allowedAutoPlacements,
6801
- _props$boundaryElemen = props.boundaryElement,
6810
+ var _props$boundaryElemen = props.boundaryElement,
6802
6811
  boundaryElement = _props$boundaryElemen === void 0 ? boundaryElementContext == null ? void 0 : boundaryElementContext.element : _props$boundaryElemen,
6803
- children = props.children,
6812
+ childProp = props.children,
6804
6813
  content = props.content,
6805
6814
  disabled = props.disabled,
6806
6815
  fallbackPlacementsProp = props.fallbackPlacements,
6807
6816
  _props$placement = props.placement,
6808
- placement = _props$placement === void 0 ? 'bottom' : _props$placement,
6817
+ placementProp = _props$placement === void 0 ? 'bottom' : _props$placement,
6809
6818
  portal = props.portal,
6810
6819
  scheme = props.scheme,
6820
+ _props$shadow = props.shadow,
6821
+ shadow = _props$shadow === void 0 ? 2 : _props$shadow,
6811
6822
  _props$zOffset = props.zOffset,
6812
6823
  zOffset = _props$zOffset === void 0 ? (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.tooltip.zOffset : _props$zOffset,
6813
6824
  restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
@@ -6819,47 +6830,73 @@ var Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
6819
6830
  referenceElement = _useState[0],
6820
6831
  setReferenceElement = _useState[1];
6821
6832
 
6822
- var _useState2 = useState(null),
6823
- popperElement = _useState2[0],
6824
- setPopperElement = _useState2[1];
6833
+ var arrowRef = useRef(null);
6834
+ var rootBoundary = 'viewport';
6835
+ var middleware = useMemo(function () {
6836
+ var ret = []; // Flip the floating element when leaving the boundary box
6825
6837
 
6826
- var _useState3 = useState(null),
6827
- arrowElement = _useState3[0],
6828
- setArrowElement = _useState3[1];
6838
+ ret.push(flip({
6839
+ boundary: boundaryElement || undefined,
6840
+ fallbackPlacements: fallbackPlacements,
6841
+ padding: 4,
6842
+ rootBoundary: rootBoundary
6843
+ })); // Define distance between reference and floating element
6829
6844
 
6830
- var popper = usePopper(referenceElement, popperElement, {
6831
- placement: placement,
6832
- modifiers: [{
6833
- name: 'arrow',
6834
- options: {
6835
- element: arrowElement,
6836
- padding: 4
6837
- }
6838
- }, {
6839
- name: 'preventOverflow',
6840
- options: {
6841
- altAxis: true,
6842
- boundary: boundaryElement || undefined,
6843
- padding: 4
6844
- }
6845
- }, {
6846
- name: 'offset',
6847
- options: {
6848
- offset: [0, 3]
6849
- }
6850
- }, {
6851
- name: 'flip',
6852
- options: {
6853
- allowedAutoPlacements: allowedAutoPlacements,
6854
- fallbackPlacements: fallbackPlacements
6855
- }
6856
- }]
6857
- });
6858
- var forceUpdate = popper.forceUpdate;
6845
+ ret.push(offset({
6846
+ mainAxis: 3
6847
+ })); // Shift the tooltip so its sits with the boundary eleement
6848
+
6849
+ ret.push(shift({
6850
+ boundary: boundaryElement || undefined,
6851
+ rootBoundary: rootBoundary,
6852
+ padding: 4
6853
+ })); // Place arrow
6854
+
6855
+ ret.push(arrow({
6856
+ element: arrowRef,
6857
+ padding: 2
6858
+ }));
6859
+ return ret;
6860
+ }, [boundaryElement, fallbackPlacements]);
6861
+
6862
+ var _useFloating = useFloating({
6863
+ middleware: middleware,
6864
+ placement: placementProp,
6865
+ whileElementsMounted: autoUpdate
6866
+ }),
6867
+ x = _useFloating.x,
6868
+ y = _useFloating.y,
6869
+ placement = _useFloating.placement,
6870
+ reference = _useFloating.reference,
6871
+ floating = _useFloating.floating,
6872
+ middlewareData = _useFloating.middlewareData,
6873
+ update = _useFloating.update,
6874
+ strategy = _useFloating.strategy;
6875
+
6876
+ var rootStyle = useMemo(function () {
6877
+ return {
6878
+ position: strategy,
6879
+ top: y != null ? y : 0,
6880
+ left: x != null ? x : 0
6881
+ };
6882
+ }, [strategy, x, y]);
6883
+ var staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]];
6884
+ var arrowX = (_middlewareData$arrow = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow.x;
6885
+ var arrowY = (_middlewareData$arrow2 = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow2.y;
6886
+ var arrowStyle = useMemo(function () {
6887
+ var style = {
6888
+ left: arrowX !== null ? arrowX : undefined,
6889
+ top: arrowY !== null ? arrowY : undefined,
6890
+ right: undefined,
6891
+ bottom: undefined
6892
+ };
6893
+ if (staticSide) style[staticSide] = -15;
6894
+ return style;
6895
+ }, [arrowX, arrowY, staticSide]);
6859
6896
 
6860
- var _useState4 = useState(false),
6861
- isOpen = _useState4[0],
6862
- setIsOpen = _useState4[1];
6897
+ var _useState2 = useState(false),
6898
+ isOpen = _useState2[0],
6899
+ setIsOpen = _useState2[1];
6863
6900
 
6864
6901
  var handleBlur = useCallback(function () {
6865
6902
  return setIsOpen(false);
@@ -6893,15 +6930,7 @@ var Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
6893
6930
  return function () {
6894
6931
  window.removeEventListener('mousemove', handleWindowMouseMove);
6895
6932
  };
6896
- }, [isOpen, referenceElement]);
6897
- useEffect(function () {
6898
- if (forceUpdate) {
6899
- try {
6900
- forceUpdate();
6901
- } catch (_) {// ignore caught error
6902
- }
6903
- }
6904
- }, [forceUpdate, content]); // Close when `disabled` changes to `true`
6933
+ }, [isOpen, referenceElement]); // Close when `disabled` changes to `true`
6905
6934
 
6906
6935
  useEffect(function () {
6907
6936
  if (disabled) setIsOpen(false);
@@ -6909,40 +6938,61 @@ var Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
6909
6938
 
6910
6939
  useEffect(function () {
6911
6940
  if (!content) setIsOpen(false);
6912
- }, [content]);
6941
+ }, [content]); // Update reference
6913
6942
 
6914
- var setRef = function setRef(el) {
6915
- setPopperElement(el);
6916
- forwardedRef.current = el;
6917
- };
6918
-
6919
- if (!children) return /*#__PURE__*/React.createElement(React.Fragment, null);
6920
- if (disabled) return children;
6921
- var referenceProps = {
6922
- onBlur: handleBlur,
6923
- onFocus: handleFocus,
6924
- onMouseEnter: handleMouseEnter,
6925
- onMouseLeave: handleMouseLeave,
6926
- ref: setReferenceElement
6927
- };
6928
- var referenceNode = /*#__PURE__*/cloneElement(children, referenceProps);
6929
- var popperNode = /*#__PURE__*/React.createElement(Root$a, _extends({
6943
+ useEffect(function () {
6944
+ return reference(referenceElement);
6945
+ }, [reference, referenceElement]);
6946
+ var setArrow = useCallback(function (arrowEl) {
6947
+ arrowRef.current = arrowEl;
6948
+ update();
6949
+ }, [update]);
6950
+ var setFloating = useCallback(function (node) {
6951
+ forwardedRef.current = node;
6952
+ floating(node);
6953
+ }, [floating, forwardedRef]);
6954
+ var childRef = childProp == null ? void 0 : childProp.ref;
6955
+ var setReference = useCallback(function (node) {
6956
+ if (typeof childRef === 'function') {
6957
+ childRef(node);
6958
+ } else if (childRef) {
6959
+ childRef.current = node;
6960
+ } // childRef.current = node
6961
+
6962
+
6963
+ setReferenceElement(node);
6964
+ }, [childRef]);
6965
+ var child = useMemo(function () {
6966
+ if (!childProp) return null;
6967
+ return /*#__PURE__*/cloneElement(childProp, {
6968
+ onBlur: handleBlur,
6969
+ onFocus: handleFocus,
6970
+ onMouseEnter: handleMouseEnter,
6971
+ onMouseLeave: handleMouseLeave,
6972
+ ref: setReference
6973
+ });
6974
+ }, [childProp, handleBlur, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
6975
+ if (!child) return /*#__PURE__*/React.createElement(React.Fragment, null);
6976
+ if (disabled) return child;
6977
+ var root = /*#__PURE__*/React.createElement(Root$a, _extends({
6930
6978
  "data-ui": "Tooltip"
6931
- }, restProps, popper.attributes.popper, {
6932
- ref: setRef,
6933
- style: popper.styles.popper,
6979
+ }, restProps, {
6980
+ ref: setFloating,
6981
+ style: rootStyle,
6934
6982
  zOffset: zOffset
6935
6983
  }), /*#__PURE__*/React.createElement(Card, {
6984
+ "data-ui": "Tooltip__card",
6985
+ "data-placement": placement,
6936
6986
  radius: 2,
6937
6987
  scheme: scheme,
6938
- shadow: 3
6988
+ shadow: shadow
6939
6989
  }, content, /*#__PURE__*/React.createElement(TooltipArrow, {
6940
- ref: setArrowElement,
6941
- style: popper.styles.arrow
6990
+ ref: setArrow,
6991
+ style: arrowStyle
6942
6992
  })));
6943
- return /*#__PURE__*/React.createElement(React.Fragment, null, referenceNode, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, portal && /*#__PURE__*/React.createElement(Portal, {
6993
+ return /*#__PURE__*/React.createElement(React.Fragment, null, child, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, portal ? /*#__PURE__*/React.createElement(Portal, {
6944
6994
  __unstable_name: typeof portal === 'string' ? portal : undefined
6945
- }, popperNode), !portal && popperNode));
6995
+ }, root) : root));
6946
6996
  });
6947
6997
 
6948
6998
  var _templateObject$b, _templateObject2$8, _templateObject3$3, _templateObject4$2, _templateObject5$1;
@@ -6960,7 +7010,7 @@ var ListBox = styled(Box)(_templateObject2$8 || (_templateObject2$8 = _taggedTem
6960
7010
  * @internal
6961
7011
  */
6962
7012
 
6963
- var ResultsPopover = styled(Popover)(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n & > div {\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n }\n\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n"])));
7013
+ var ResultsPopover = styled(Popover)(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n"])));
6964
7014
  var rotate = keyframes(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
6965
7015
  /**
6966
7016
  * @internal
@@ -7076,17 +7126,17 @@ var AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ['Control', 'Shift', 'Alt', 'Enter', 'Hom
7076
7126
  * @internal
7077
7127
  */
7078
7128
 
7079
- var AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 1, 1];
7129
+ var AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 0, 0];
7080
7130
  /**
7081
7131
  * @internal
7082
7132
  */
7083
7133
 
7084
- var AUTOCOMPLETE_POPOVER_PLACEMENT = 'bottom-start';
7134
+ var AUTOCOMPLETE_POPOVER_PLACEMENT = 'bottom';
7085
7135
  /**
7086
7136
  * @internal
7087
7137
  */
7088
7138
 
7089
- var AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ['top-start'];
7139
+ var AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ['bottom', 'top'];
7090
7140
 
7091
7141
  var _excluded$f = ["border", "customValidity", "disabled", "filterOption", "fontSize", "icon", "id", "listBox", "loading", "onBlur", "onChange", "onFocus", "onQueryChange", "onSelect", "openButton", "options", "padding", "popover", "prefix", "radius", "readOnly", "relatedElements", "renderOption", "renderPopover", "renderValue", "suffix", "value"];
7092
7142