@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() {
@@ -44,8 +43,25 @@ function _objectWithoutPropertiesLoose(source, excluded) {
44
43
  return target;
45
44
  }
46
45
 
46
+ /**
47
+ * @internal
48
+ */
47
49
  const EMPTY_ARRAY = [];
50
+ /**
51
+ * @internal
52
+ */
53
+
48
54
  const EMPTY_RECORD = {};
55
+ /**
56
+ * @internal
57
+ */
58
+
59
+ const FLOATING_STATIC_SIDES = {
60
+ top: 'bottom',
61
+ right: 'left',
62
+ bottom: 'top',
63
+ left: 'right'
64
+ };
49
65
 
50
66
  /**
51
67
  * @internal
@@ -2837,7 +2853,7 @@ globalScope[key$7] = globalScope[key$7] || /*#__PURE__*/createContext(null);
2837
2853
 
2838
2854
  const ThemeContext = globalScope[key$7];
2839
2855
 
2840
- const _excluded$H = ["color", "layer"];
2856
+ const _excluded$I = ["color", "layer"];
2841
2857
  /**
2842
2858
  * @public
2843
2859
  */
@@ -2857,7 +2873,7 @@ function ThemeProvider(props) {
2857
2873
  color: rootColor,
2858
2874
  layer: rootLayer
2859
2875
  } = themeProp,
2860
- restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$H);
2876
+ restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$I);
2861
2877
 
2862
2878
  const colorScheme = rootColor[scheme] || rootColor.light;
2863
2879
  const color = colorScheme[tone] || colorScheme.default;
@@ -3651,11 +3667,11 @@ function responsiveInputPaddingIconRightStyle(props) {
3651
3667
  }));
3652
3668
  }
3653
3669
 
3654
- let _$B = t => t,
3655
- _t$D,
3656
- _t2$n,
3657
- _t3$e;
3658
- const ROOT_STYLE = css(_t$D || (_t$D = _$B`
3670
+ let _$C = t => t,
3671
+ _t$C,
3672
+ _t2$m,
3673
+ _t3$d;
3674
+ const ROOT_STYLE = css(_t$C || (_t$C = _$C`
3659
3675
  &:not([hidden]) {
3660
3676
  display: flex;
3661
3677
  }
@@ -3673,7 +3689,7 @@ function textInputBaseStyle(props) {
3673
3689
  } = props;
3674
3690
  const font = theme.sanity.fonts.text;
3675
3691
  const color = theme.sanity.color.input;
3676
- return css(_t2$n || (_t2$n = _$B`
3692
+ return css(_t2$m || (_t2$m = _$C`
3677
3693
  appearance: none;
3678
3694
  background: none;
3679
3695
  border: 0;
@@ -3768,7 +3784,7 @@ function textInputRepresentationStyle(props) {
3768
3784
  input
3769
3785
  } = theme.sanity;
3770
3786
  const color = theme.sanity.color.input;
3771
- return css(_t3$e || (_t3$e = _$B`
3787
+ return css(_t3$d || (_t3$d = _$C`
3772
3788
  --input-box-shadow: none;
3773
3789
 
3774
3790
  position: absolute;
@@ -3908,10 +3924,10 @@ function responsiveShadowStyle(props) {
3908
3924
  return _responsive(media, props.$shadow, shadow => shadowStyle(shadows[shadow]));
3909
3925
  }
3910
3926
 
3911
- let _$A = t => t,
3912
- _t$C,
3913
- _t2$m,
3914
- _t3$d;
3927
+ let _$B = t => t,
3928
+ _t$B,
3929
+ _t2$l,
3930
+ _t3$c;
3915
3931
  function textBaseStyle(props) {
3916
3932
  const {
3917
3933
  $accent,
@@ -3921,7 +3937,7 @@ function textBaseStyle(props) {
3921
3937
  const {
3922
3938
  weights
3923
3939
  } = theme.sanity.fonts.text;
3924
- return css(_t$C || (_t$C = _$A`
3940
+ return css(_t$B || (_t$B = _$B`
3925
3941
  color: var(--card-fg-color);
3926
3942
 
3927
3943
  ${0}
@@ -3963,19 +3979,19 @@ function textBaseStyle(props) {
3963
3979
  & [data-sanity-icon] {
3964
3980
  vertical-align: baseline;
3965
3981
  }
3966
- `), $accent && css(_t2$m || (_t2$m = _$A`
3982
+ `), $accent && css(_t2$l || (_t2$l = _$B`
3967
3983
  color: var(--card-accent-fg-color);
3968
- `)), $muted && css(_t3$d || (_t3$d = _$A`
3984
+ `)), $muted && css(_t3$c || (_t3$c = _$B`
3969
3985
  color: var(--card-muted-fg-color);
3970
3986
  `)), theme.sanity.fonts.code.family, weights.bold);
3971
3987
  }
3972
3988
 
3973
- const _excluded$G = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
3989
+ const _excluded$H = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
3974
3990
 
3975
- let _$z = t => t,
3976
- _t$B;
3991
+ let _$A = t => t,
3992
+ _t$A;
3977
3993
  const Root$E = styled.div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
3978
- const SpanWithTextOverflow$2 = styled.span(_t$B || (_t$B = _$z`
3994
+ const SpanWithTextOverflow$2 = styled.span(_t$A || (_t$A = _$A`
3979
3995
  display: block;
3980
3996
  white-space: nowrap;
3981
3997
  text-overflow: ellipsis;
@@ -3995,7 +4011,7 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
3995
4011
  textOverflow,
3996
4012
  weight
3997
4013
  } = props,
3998
- restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
4014
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$H);
3999
4015
 
4000
4016
  let children = childrenProp;
4001
4017
 
@@ -4166,7 +4182,7 @@ function avatarStrokeStyle() {
4166
4182
  };
4167
4183
  }
4168
4184
 
4169
- const _excluded$F = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
4185
+ const _excluded$G = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
4170
4186
  const Root$D = styled.div(responsiveAvatarSizeStyle, avatarStyle.root);
4171
4187
  const Arrow = styled.div(avatarStyle.arrow);
4172
4188
  const BgStroke = styled.ellipse(avatarStyle.bgStroke);
@@ -4189,7 +4205,7 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4189
4205
  status = 'online',
4190
4206
  size: sizeProp = 0
4191
4207
  } = props,
4192
- restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4208
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
4193
4209
 
4194
4210
  const as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
4195
4211
  const size = useArrayProp(sizeProp);
@@ -4279,8 +4295,8 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4279
4295
  }, /*#__PURE__*/React.createElement("strong", null, initials)))));
4280
4296
  });
4281
4297
 
4282
- let _$y = t => t,
4283
- _t$A;
4298
+ let _$z = t => t,
4299
+ _t$z;
4284
4300
 
4285
4301
  function _responsiveAvatarCounterSizeStyle(props) {
4286
4302
  const {
@@ -4305,7 +4321,7 @@ function _avatarCounterBaseStyle(props) {
4305
4321
  const {
4306
4322
  theme
4307
4323
  } = props;
4308
- return css(_t$A || (_t$A = _$y`
4324
+ return css(_t$z || (_t$z = _$z`
4309
4325
  align-items: center;
4310
4326
  justify-content: center;
4311
4327
  box-sizing: border-box;
@@ -4349,11 +4365,11 @@ function childrenToElementArray(children) {
4349
4365
  return childrenArray.filter(node => isElement(node) || isFragment(node) || typeof node === 'string');
4350
4366
  }
4351
4367
 
4352
- const _excluded$E = ["children", "maxLength", "size"];
4368
+ const _excluded$F = ["children", "maxLength", "size"];
4353
4369
 
4354
- let _$x = t => t,
4355
- _t$z;
4356
- const BASE_STYLES = css(_t$z || (_t$z = _$x`
4370
+ let _$y = t => t,
4371
+ _t$y;
4372
+ const BASE_STYLES = css(_t$y || (_t$y = _$y`
4357
4373
  white-space: nowrap;
4358
4374
 
4359
4375
  & > div {
@@ -4399,7 +4415,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4399
4415
  maxLength: maxLengthProp = 4,
4400
4416
  size: sizeProp = 0
4401
4417
  } = props,
4402
- restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4418
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4403
4419
 
4404
4420
  const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
4405
4421
  const maxLength = Math.max(maxLengthProp, 0);
@@ -4425,7 +4441,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4425
4441
  }))));
4426
4442
  });
4427
4443
 
4428
- const _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"];
4444
+ const _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"];
4429
4445
  const Root$A = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle);
4430
4446
  /**
4431
4447
  * @public
@@ -4460,7 +4476,7 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4460
4476
  rowEnd,
4461
4477
  sizing
4462
4478
  } = props,
4463
- restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4479
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4464
4480
 
4465
4481
  return /*#__PURE__*/React.createElement(Root$A, _extends({
4466
4482
  "data-as": typeof asProp === 'string' ? asProp : undefined,
@@ -4496,10 +4512,10 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4496
4512
  }), props.children);
4497
4513
  });
4498
4514
 
4499
- let _$w = t => t,
4500
- _t$y,
4501
- _t2$l,
4502
- _t3$c;
4515
+ let _$x = t => t,
4516
+ _t$x,
4517
+ _t2$k,
4518
+ _t3$b;
4503
4519
  function labelBaseStyle(props) {
4504
4520
  const {
4505
4521
  $accent,
@@ -4509,7 +4525,7 @@ function labelBaseStyle(props) {
4509
4525
  const {
4510
4526
  fonts
4511
4527
  } = theme.sanity;
4512
- return css(_t$y || (_t$y = _$w`
4528
+ return css(_t$x || (_t$x = _$x`
4513
4529
  text-transform: uppercase;
4514
4530
 
4515
4531
  ${0}
@@ -4529,19 +4545,19 @@ function labelBaseStyle(props) {
4529
4545
  & [data-sanity-icon] {
4530
4546
  vertical-align: baseline;
4531
4547
  }
4532
- `), $accent && css(_t2$l || (_t2$l = _$w`
4548
+ `), $accent && css(_t2$k || (_t2$k = _$x`
4533
4549
  color: var(--card-accent-fg-color);
4534
- `)), $muted && css(_t3$c || (_t3$c = _$w`
4550
+ `)), $muted && css(_t3$b || (_t3$b = _$x`
4535
4551
  color: var(--card-muted-fg-color);
4536
4552
  `)), fonts.code.family);
4537
4553
  }
4538
4554
 
4539
- const _excluded$C = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
4555
+ const _excluded$D = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
4540
4556
 
4541
- let _$v = t => t,
4542
- _t$x;
4557
+ let _$w = t => t,
4558
+ _t$w;
4543
4559
  const Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
4544
- const SpanWithTextOverflow$1 = styled.span(_t$x || (_t$x = _$v`
4560
+ const SpanWithTextOverflow$1 = styled.span(_t$w || (_t$w = _$w`
4545
4561
  display: block;
4546
4562
  white-space: nowrap;
4547
4563
  text-overflow: ellipsis;
@@ -4561,7 +4577,7 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
4561
4577
  textOverflow,
4562
4578
  weight
4563
4579
  } = props,
4564
- restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
4580
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4565
4581
 
4566
4582
  let children = childrenProp;
4567
4583
 
@@ -4602,7 +4618,7 @@ function badgeStyle(props) {
4602
4618
  };
4603
4619
  }
4604
4620
 
4605
- const _excluded$B = ["children", "fontSize", "mode", "padding", "radius", "tone"];
4621
+ const _excluded$C = ["children", "fontSize", "mode", "padding", "radius", "tone"];
4606
4622
  const Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
4607
4623
  /**
4608
4624
  * @public
@@ -4617,7 +4633,7 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4617
4633
  radius = 2,
4618
4634
  tone = 'default'
4619
4635
  } = props,
4620
- restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
4636
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
4621
4637
 
4622
4638
  return /*#__PURE__*/React.createElement(Root$y, _extends({
4623
4639
  "data-ui": "Badge"
@@ -4632,7 +4648,7 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4632
4648
  }, children));
4633
4649
  });
4634
4650
 
4635
- const _excluded$A = ["align", "as", "direction", "gap", "justify", "wrap"];
4651
+ const _excluded$B = ["align", "as", "direction", "gap", "justify", "wrap"];
4636
4652
  const Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
4637
4653
  /**
4638
4654
  * @public
@@ -4647,7 +4663,7 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4647
4663
  justify,
4648
4664
  wrap
4649
4665
  } = props,
4650
- restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
4666
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
4651
4667
 
4652
4668
  return /*#__PURE__*/React.createElement(Root$x, _extends({
4653
4669
  "data-ui": "Flex"
@@ -4662,10 +4678,10 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4662
4678
  }));
4663
4679
  });
4664
4680
 
4665
- let _$u = t => t,
4666
- _t$w,
4667
- _t2$k;
4668
- const rotate$1 = keyframes(_t$w || (_t$w = _$u`
4681
+ let _$v = t => t,
4682
+ _t$v,
4683
+ _t2$j;
4684
+ const rotate$1 = keyframes(_t$v || (_t$v = _$v`
4669
4685
  from {
4670
4686
  transform: rotate(0deg);
4671
4687
  }
@@ -4674,7 +4690,7 @@ const rotate$1 = keyframes(_t$w || (_t$w = _$u`
4674
4690
  transform: rotate(360deg);
4675
4691
  }
4676
4692
  `));
4677
- const Root$w = styled(Text)(_t2$k || (_t2$k = _$u`
4693
+ const Root$w = styled(Text)(_t2$j || (_t2$j = _$v`
4678
4694
  & > span > svg {
4679
4695
  animation: ${0} 500ms linear infinite;
4680
4696
  }
@@ -4724,14 +4740,14 @@ function _colorVarsStyle(base, color, checkered = false) {
4724
4740
  };
4725
4741
  }
4726
4742
 
4727
- let _$t = t => t,
4728
- _t$v;
4743
+ let _$u = t => t,
4744
+ _t$u;
4729
4745
  /**
4730
4746
  * @internal
4731
4747
  */
4732
4748
 
4733
4749
  function buttonBaseStyles() {
4734
- return css(_t$v || (_t$v = _$t`
4750
+ return css(_t$u || (_t$u = _$u`
4735
4751
  -webkit-font-smoothing: inherit;
4736
4752
  appearance: none;
4737
4753
  display: inline-flex;
@@ -4813,12 +4829,12 @@ function buttonColorStyles(props) {
4813
4829
  }, (_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);
4814
4830
  }
4815
4831
 
4816
- const _excluded$z = ["children", "disabled", "fontSize", "icon", "iconRight", "justify", "loading", "mode", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "radius", "selected", "space", "text", "textAlign", "tone", "type"];
4832
+ const _excluded$A = ["children", "disabled", "fontSize", "icon", "iconRight", "justify", "loading", "mode", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "radius", "selected", "space", "text", "textAlign", "tone", "type"];
4817
4833
 
4818
- let _$s = t => t,
4819
- _t$u;
4834
+ let _$t = t => t,
4835
+ _t$t;
4820
4836
  const Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
4821
- const LoadingBox = styled.div(_t$u || (_t$u = _$s`
4837
+ const LoadingBox = styled.div(_t$t || (_t$t = _$t`
4822
4838
  position: absolute;
4823
4839
  top: 0;
4824
4840
  left: 0;
@@ -4861,7 +4877,7 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4861
4877
  tone = 'default',
4862
4878
  type = 'button'
4863
4879
  } = props,
4864
- restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
4880
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
4865
4881
 
4866
4882
  const justify = useArrayProp(justifyProp);
4867
4883
  const padding = useArrayProp(paddingProp);
@@ -4918,10 +4934,10 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4918
4934
  }, boxProps), children));
4919
4935
  });
4920
4936
 
4921
- let _$r = t => t,
4922
- _t$t,
4923
- _t2$j,
4924
- _t3$b;
4937
+ let _$s = t => t,
4938
+ _t$s,
4939
+ _t2$i,
4940
+ _t3$a;
4925
4941
  function cardStyle(props) {
4926
4942
  return [cardBaseStyle(props), cardColorStyle(props)];
4927
4943
  }
@@ -4931,7 +4947,7 @@ function cardBaseStyle(props) {
4931
4947
  theme
4932
4948
  } = props;
4933
4949
  const space = theme.sanity.space;
4934
- return css(_t$t || (_t$t = _$r`
4950
+ return css(_t$s || (_t$s = _$s`
4935
4951
  ${0}
4936
4952
 
4937
4953
  &[data-as='button'] {
@@ -4954,7 +4970,7 @@ function cardBaseStyle(props) {
4954
4970
  &[data-as='pre'] {
4955
4971
  font: inherit;
4956
4972
  }
4957
- `), $checkered && css(_t2$j || (_t2$j = _$r`
4973
+ `), $checkered && css(_t2$i || (_t2$i = _$s`
4958
4974
  background-size: ${0}px ${0}px;
4959
4975
  background-position: 50% 50%;
4960
4976
  background-image: var(--card-bg-image);
@@ -4979,7 +4995,7 @@ function cardColorStyle(props) {
4979
4995
  width: 0,
4980
4996
  color: 'var(--card-border-color)'
4981
4997
  };
4982
- return css(_t3$b || (_t3$b = _$r`
4998
+ return css(_t3$a || (_t3$a = _$s`
4983
4999
  ${0}
4984
5000
 
4985
5001
  background-color: var(--card-bg-color);
@@ -5079,7 +5095,7 @@ function cardColorStyle(props) {
5079
5095
  }) : 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);
5080
5096
  }
5081
5097
 
5082
- const _excluded$y = ["__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "pressed", "radius", "scheme", "selected", "shadow", "tone"];
5098
+ const _excluded$z = ["__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "pressed", "radius", "scheme", "selected", "shadow", "tone"];
5083
5099
  const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
5084
5100
  /**
5085
5101
  * @public
@@ -5102,7 +5118,7 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
5102
5118
  shadow,
5103
5119
  tone: toneProp = 'default'
5104
5120
  } = props,
5105
- restProps = _objectWithoutPropertiesLoose(props, _excluded$y);
5121
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
5106
5122
 
5107
5123
  const as = isValidElementType(asProp) ? asProp : 'div';
5108
5124
  const rootTheme = useRootTheme();
@@ -5135,11 +5151,11 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
5135
5151
  })));
5136
5152
  });
5137
5153
 
5138
- let _$q = t => t,
5139
- _t$s,
5140
- _t2$i;
5154
+ let _$r = t => t,
5155
+ _t$r,
5156
+ _t2$h;
5141
5157
  function checkboxBaseStyles() {
5142
- return css(_t$s || (_t$s = _$q`
5158
+ return css(_t$r || (_t$r = _$r`
5143
5159
  position: relative;
5144
5160
  display: inline-block;
5145
5161
  `));
@@ -5154,7 +5170,7 @@ function inputElementStyles(props) {
5154
5170
  input,
5155
5171
  radius
5156
5172
  } = theme.sanity;
5157
- return css(_t2$i || (_t2$i = _$q`
5173
+ return css(_t2$h || (_t2$h = _$r`
5158
5174
  position: absolute;
5159
5175
  top: 0;
5160
5176
  left: 0;
@@ -5239,7 +5255,7 @@ function inputElementStyles(props) {
5239
5255
  }), color.default.disabled.fg);
5240
5256
  }
5241
5257
 
5242
- const _excluded$x = ["checked", "className", "disabled", "indeterminate", "customValidity", "readOnly", "style"];
5258
+ const _excluded$y = ["checked", "className", "disabled", "indeterminate", "customValidity", "readOnly", "style"];
5243
5259
  const Root$t = styled.div(checkboxBaseStyles);
5244
5260
  const Input$5 = styled.input(inputElementStyles);
5245
5261
  /**
@@ -5256,7 +5272,7 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef)
5256
5272
  readOnly,
5257
5273
  style
5258
5274
  } = props,
5259
- restProps = _objectWithoutPropertiesLoose(props, _excluded$x);
5275
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$y);
5260
5276
 
5261
5277
  const ref = useForwardedRef(forwardedRef);
5262
5278
  useCustomValidity(ref, customValidity);
@@ -5281,8 +5297,8 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef)
5281
5297
  })), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CheckmarkIcon, null), /*#__PURE__*/React.createElement(RemoveIcon, null)));
5282
5298
  });
5283
5299
 
5284
- let _$p = t => t,
5285
- _t$r;
5300
+ let _$q = t => t,
5301
+ _t$q;
5286
5302
 
5287
5303
  function codeSyntaxHighlightingStyle({
5288
5304
  theme
@@ -5401,7 +5417,7 @@ function codeSyntaxHighlightingStyle({
5401
5417
  }
5402
5418
 
5403
5419
  function codeBaseStyle() {
5404
- return css(_t$r || (_t$r = _$p`
5420
+ return css(_t$q || (_t$q = _$q`
5405
5421
  color: var(--card-code-fg-color);
5406
5422
 
5407
5423
  & code {
@@ -5424,7 +5440,7 @@ function codeBaseStyle() {
5424
5440
  `), codeSyntaxHighlightingStyle);
5425
5441
  }
5426
5442
 
5427
- const _excluded$w = ["children", "language", "size", "weight"];
5443
+ const _excluded$x = ["children", "language", "size", "weight"];
5428
5444
  const Root$s = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
5429
5445
  /**
5430
5446
  * @public
@@ -5437,7 +5453,7 @@ const Code = /*#__PURE__*/forwardRef(function Code(props, ref) {
5437
5453
  size = 2,
5438
5454
  weight
5439
5455
  } = props,
5440
- restProps = _objectWithoutPropertiesLoose(props, _excluded$w);
5456
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$x);
5441
5457
 
5442
5458
  const language = typeof languageProp === 'string' ? languageProp : undefined;
5443
5459
  const registered = language ? Refractor.hasLanguage(language) : false;
@@ -5474,7 +5490,7 @@ function responsiveContainerWidthStyle(props) {
5474
5490
  }));
5475
5491
  }
5476
5492
 
5477
- const _excluded$v = ["as", "width"];
5493
+ const _excluded$w = ["as", "width"];
5478
5494
  const Root$r = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
5479
5495
  /**
5480
5496
  * @public
@@ -5485,7 +5501,7 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
5485
5501
  as,
5486
5502
  width = 2
5487
5503
  } = props,
5488
- restProps = _objectWithoutPropertiesLoose(props, _excluded$v);
5504
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$w);
5489
5505
 
5490
5506
  return /*#__PURE__*/React.createElement(Root$r, _extends({
5491
5507
  "data-ui": "Container"
@@ -5496,7 +5512,7 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
5496
5512
  }));
5497
5513
  });
5498
5514
 
5499
- const _excluded$u = ["as", "autoRows", "autoCols", "autoFlow", "columns", "gap", "gapX", "gapY", "rows", "children"];
5515
+ const _excluded$v = ["as", "autoRows", "autoCols", "autoFlow", "columns", "gap", "gapX", "gapY", "rows", "children"];
5500
5516
  const Root$q = styled(Box)(responsiveGridStyle);
5501
5517
  /**
5502
5518
  * @public
@@ -5515,7 +5531,7 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
5515
5531
  rows,
5516
5532
  children
5517
5533
  } = props,
5518
- restProps = _objectWithoutPropertiesLoose(props, _excluded$u);
5534
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$v);
5519
5535
 
5520
5536
  return /*#__PURE__*/React.createElement(Root$q, _extends({
5521
5537
  "data-as": typeof as === 'string' ? as : undefined,
@@ -5534,17 +5550,17 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
5534
5550
  }), children);
5535
5551
  });
5536
5552
 
5537
- let _$o = t => t,
5538
- _t$q,
5539
- _t2$h,
5540
- _t3$a;
5553
+ let _$p = t => t,
5554
+ _t$p,
5555
+ _t2$g,
5556
+ _t3$9;
5541
5557
  function headingBaseStyle(props) {
5542
5558
  const {
5543
5559
  $accent,
5544
5560
  $muted,
5545
5561
  theme
5546
5562
  } = props;
5547
- return css(_t$q || (_t$q = _$o`
5563
+ return css(_t$p || (_t$p = _$p`
5548
5564
  ${0}
5549
5565
 
5550
5566
  ${0}
@@ -5578,19 +5594,19 @@ function headingBaseStyle(props) {
5578
5594
  & [data-sanity-icon] {
5579
5595
  vertical-align: baseline;
5580
5596
  }
5581
- `), $accent && css(_t2$h || (_t2$h = _$o`
5597
+ `), $accent && css(_t2$g || (_t2$g = _$p`
5582
5598
  color: var(--card-accent-fg-color);
5583
- `)), $muted && css(_t3$a || (_t3$a = _$o`
5599
+ `)), $muted && css(_t3$9 || (_t3$9 = _$p`
5584
5600
  color: var(--card-muted-fg-color);
5585
5601
  `)), theme.sanity.fonts.code.family);
5586
5602
  }
5587
5603
 
5588
- const _excluded$t = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
5604
+ const _excluded$u = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
5589
5605
 
5590
- let _$n = t => t,
5591
- _t$p;
5606
+ let _$o = t => t,
5607
+ _t$o;
5592
5608
  const Root$p = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
5593
- const SpanWithTextOverflow = styled.span(_t$p || (_t$p = _$n`
5609
+ const SpanWithTextOverflow = styled.span(_t$o || (_t$o = _$o`
5594
5610
  display: block;
5595
5611
  white-space: nowrap;
5596
5612
  text-overflow: ellipsis;
@@ -5610,7 +5626,7 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
5610
5626
  textOverflow,
5611
5627
  weight
5612
5628
  } = props,
5613
- restProps = _objectWithoutPropertiesLoose(props, _excluded$t);
5629
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$u);
5614
5630
 
5615
5631
  let children = childrenProp;
5616
5632
 
@@ -5657,7 +5673,7 @@ function inlineSpaceStyle(props) {
5657
5673
  });
5658
5674
  }
5659
5675
 
5660
- const _excluded$s = ["as", "children", "space"];
5676
+ const _excluded$t = ["as", "children", "space"];
5661
5677
  const Root$o = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
5662
5678
  /**
5663
5679
  * @public
@@ -5669,7 +5685,7 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
5669
5685
  children: childrenProp,
5670
5686
  space
5671
5687
  } = props,
5672
- restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
5688
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$t);
5673
5689
 
5674
5690
  const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /*#__PURE__*/React.createElement("div", {
5675
5691
  key: idx
@@ -5683,13 +5699,13 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
5683
5699
  }), children);
5684
5700
  });
5685
5701
 
5686
- const _excluded$r = ["children", "fontSize", "padding", "radius"];
5702
+ const _excluded$s = ["children", "fontSize", "padding", "radius"];
5687
5703
 
5688
- let _$m = t => t,
5689
- _t$o;
5704
+ let _$n = t => t,
5705
+ _t$n;
5690
5706
 
5691
5707
  function kbdStyle() {
5692
- return css(_t$o || (_t$o = _$m`
5708
+ return css(_t$n || (_t$n = _$n`
5693
5709
  background: var(--card-bg-color);
5694
5710
  font: inherit;
5695
5711
  box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);
@@ -5712,7 +5728,7 @@ const KBD = /*#__PURE__*/forwardRef(function KBD(props, ref) {
5712
5728
  padding = 1,
5713
5729
  radius = 2
5714
5730
  } = props,
5715
- restProps = _objectWithoutPropertiesLoose(props, _excluded$r);
5731
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
5716
5732
 
5717
5733
  return /*#__PURE__*/React.createElement(Root$n, _extends({
5718
5734
  "data-ui": "KBD"
@@ -5798,7 +5814,7 @@ function findMinBreakpoints(media, width) {
5798
5814
  return ret;
5799
5815
  }
5800
5816
 
5801
- const _excluded$q = ["children", "media"];
5817
+ const _excluded$r = ["children", "media"];
5802
5818
  /**
5803
5819
  * DO NOT USE IN PRODUCTION.
5804
5820
  * @beta
@@ -5811,7 +5827,7 @@ const ElementQuery = /*#__PURE__*/forwardRef(function ElementQuery(props, ref) {
5811
5827
  children,
5812
5828
  media = theme.sanity.media
5813
5829
  } = props,
5814
- restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
5830
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$r);
5815
5831
 
5816
5832
  const forwardedRef = useForwardedRef(ref);
5817
5833
  const [element, setElement] = useState(null);
@@ -5939,12 +5955,12 @@ function LayerProvider(props) {
5939
5955
  }, children);
5940
5956
  }
5941
5957
 
5942
- const _excluded$p = ["children", "style"],
5958
+ const _excluded$q = ["children", "style"],
5943
5959
  _excluded2$1 = ["children", "zOffset"];
5944
5960
 
5945
- let _$l = t => t,
5946
- _t$n;
5947
- const Root$m = styled.div(_t$n || (_t$n = _$l`
5961
+ let _$m = t => t,
5962
+ _t$m;
5963
+ const Root$m = styled.div(_t$m || (_t$m = _$m`
5948
5964
  position: relative;
5949
5965
  `));
5950
5966
  const LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref) {
@@ -5952,7 +5968,7 @@ const LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref)
5952
5968
  children,
5953
5969
  style = EMPTY_RECORD
5954
5970
  } = props,
5955
- restProps = _objectWithoutPropertiesLoose(props, _excluded$p);
5971
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
5956
5972
 
5957
5973
  const {
5958
5974
  zIndex
@@ -6103,9 +6119,9 @@ function PortalProvider(props) {
6103
6119
  }, children);
6104
6120
  }
6105
6121
 
6106
- let _$k = t => t,
6107
- _t$m;
6108
- const Root$l = styled.div(_t$m || (_t$m = _$k`
6122
+ let _$l = t => t,
6123
+ _t$l;
6124
+ const Root$l = styled.div(_t$l || (_t$l = _$l`
6109
6125
  display: block;
6110
6126
  width: 0;
6111
6127
  height: 0;
@@ -6295,15 +6311,15 @@ function _isScrollable(el) {
6295
6311
  return style.overflowX.includes('auto') || style.overflowX.includes('scroll') || style.overflowY.includes('auto') || style.overflowY.includes('scroll');
6296
6312
  }
6297
6313
 
6298
- const _excluded$o = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
6314
+ const _excluded$p = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
6299
6315
 
6300
- let _$j = t => t,
6301
- _t$l,
6302
- _t2$g;
6303
- const Root$k = styled.div(_t$l || (_t$l = _$j`
6316
+ let _$k = t => t,
6317
+ _t$k,
6318
+ _t2$f;
6319
+ const Root$k = styled.div(_t$k || (_t$k = _$k`
6304
6320
  position: relative;
6305
6321
  `));
6306
- const ItemWrapper = styled.div(_t2$g || (_t2$g = _$j`
6322
+ const ItemWrapper = styled.div(_t2$f || (_t2$f = _$k`
6307
6323
  position: absolute;
6308
6324
  left: 0;
6309
6325
  right: 0;
@@ -6321,7 +6337,7 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
6321
6337
  onChange,
6322
6338
  renderItem
6323
6339
  } = props,
6324
- restProps = _objectWithoutPropertiesLoose(props, _excluded$o);
6340
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$p);
6325
6341
 
6326
6342
  const {
6327
6343
  space
@@ -6440,11 +6456,11 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
6440
6456
  }, children));
6441
6457
  });
6442
6458
 
6443
- let _$i = t => t,
6444
- _t$k,
6445
- _t2$f,
6446
- _t3$9;
6447
- const Root$j = styled.div(_t$k || (_t$k = _$i`
6459
+ let _$j = t => t,
6460
+ _t$j,
6461
+ _t2$e,
6462
+ _t3$8;
6463
+ const Root$j = styled.div(_t$j || (_t$j = _$j`
6448
6464
  position: absolute;
6449
6465
  pointer-events: none;
6450
6466
  width: 27px;
@@ -6460,11 +6476,11 @@ const Root$j = styled.div(_t$k || (_t$k = _$i`
6460
6476
  transform-origin: 13.5px 13.5px;
6461
6477
  }
6462
6478
 
6463
- [data-popper-placement^='top'] > div > & {
6479
+ [data-placement^='top'] > & {
6464
6480
  bottom: -27px;
6465
6481
  }
6466
6482
 
6467
- [data-popper-placement^='right'] > div > & {
6483
+ [data-placement^='right'] > & {
6468
6484
  left: -27px;
6469
6485
 
6470
6486
  & > svg {
@@ -6472,7 +6488,7 @@ const Root$j = styled.div(_t$k || (_t$k = _$i`
6472
6488
  }
6473
6489
  }
6474
6490
 
6475
- [data-popper-placement^='left'] > div > & {
6491
+ [data-placement^='left'] > & {
6476
6492
  right: -27px;
6477
6493
 
6478
6494
  & > svg {
@@ -6480,7 +6496,7 @@ const Root$j = styled.div(_t$k || (_t$k = _$i`
6480
6496
  }
6481
6497
  }
6482
6498
 
6483
- [data-popper-placement^='bottom'] > div > & {
6499
+ [data-placement^='bottom'] > & {
6484
6500
  top: -27px;
6485
6501
 
6486
6502
  & > svg {
@@ -6488,15 +6504,15 @@ const Root$j = styled.div(_t$k || (_t$k = _$i`
6488
6504
  }
6489
6505
  }
6490
6506
  `));
6491
- const BorderPath = styled.path(_t2$f || (_t2$f = _$i`
6507
+ const BorderPath = styled.path(_t2$e || (_t2$e = _$j`
6492
6508
  fill: var(--card-shadow-outline-color);
6493
6509
  `));
6494
- const ShapePath = styled.path(_t3$9 || (_t3$9 = _$i`
6510
+ const ShapePath = styled.path(_t3$8 || (_t3$8 = _$j`
6495
6511
  fill: var(--card-bg-color);
6496
6512
  `));
6497
6513
  const PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
6498
6514
  return /*#__PURE__*/React.createElement(Root$j, _extends({
6499
- "data-ui": "PopoverArrow"
6515
+ "data-ui": "Popover__arrow"
6500
6516
  }, props, {
6501
6517
  ref: ref
6502
6518
  }), /*#__PURE__*/React.createElement("svg", {
@@ -6512,354 +6528,294 @@ const PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
6512
6528
  })));
6513
6529
  });
6514
6530
 
6515
- /*
6516
-
6517
- The order of popper phases:
6531
+ const _excluded$o = ["__unstable_margins", "arrow", "arrowRef", "arrowX", "arrowY", "availableHeight", "availableWidth", "boundaryWidth", "children", "padding", "placement", "overflow", "radius", "referenceWidth", "scheme", "shadow", "strategy", "tone", "width", "x", "y"];
6518
6532
 
6519
- - beforeRead
6520
- - read
6521
- - afterRead
6522
- - beforeMain
6523
- - main
6524
- - afterMain
6525
- - beforeWrite
6526
- - write
6527
- - afterWrite
6528
-
6529
- */
6530
-
6531
- function getPopoverModifiers(props) {
6533
+ function popoverCardStyle(props) {
6532
6534
  const {
6533
- allowedAutoPlacements,
6534
- arrow,
6535
- arrowElement,
6536
- boundaryElement,
6537
- constrainSize,
6538
- distance,
6539
- fallbackPlacements,
6540
- margins,
6541
- matchReferenceWidth,
6542
- open,
6543
- preventOverflow,
6544
- skidding,
6545
- tether,
6546
- tetherOffset
6547
- } = props; // NOTE: For later viewers:
6548
- // Prior to adding this change, the popover would get `maxWidth: 0` the 2nd time it
6549
- // was opened, when used with `constrainSize`. I was looking for a way to "reset"
6550
- // the size of the popover as measured by Popper.js, and this seems to be a workaround.
6551
-
6552
- if (!open) {
6553
- return [];
6554
- }
6555
-
6556
- const detectOverflowOptions = {
6557
- altAxis: !constrainSize,
6558
- boundary: boundaryElement || undefined,
6559
- padding: 8,
6560
- tether,
6561
- tetherOffset
6535
+ $boundaryWidth
6536
+ } = props;
6537
+ return {
6538
+ maxWidth: $boundaryWidth ? `${$boundaryWidth - 16}px` : 'calc(100% - 16px)'
6562
6539
  };
6563
- return [constrainSize && _extends({}, maxSizeModifier, {
6564
- options: detectOverflowOptions
6565
- }), constrainSize && {
6566
- name: 'applyMaxSize',
6567
- enabled: true,
6568
- phase: 'beforeWrite',
6569
- requires: ['maxSize'],
6570
-
6571
- fn({
6572
- state
6573
- }) {
6574
- const {
6575
- width,
6576
- height
6577
- } = state.modifiersData.maxSize;
6578
- state.styles.popper = _extends({}, state.styles.popper, {
6579
- maxWidth: `${width}px`,
6580
- maxHeight: `${height}px`
6581
- });
6582
- }
6583
-
6584
- }, arrow && {
6585
- name: 'arrow',
6586
- options: {
6587
- element: arrowElement,
6588
- padding: 4
6589
- }
6590
- }, (constrainSize || preventOverflow) && {
6591
- name: 'preventOverflow',
6592
- options: detectOverflowOptions
6593
- }, {
6594
- name: 'offset',
6595
- options: {
6596
- offset: [skidding, distance]
6597
- }
6598
- }, margins && {
6599
- name: 'margins',
6600
- enabled: true,
6601
- phase: 'beforeRead',
6602
- fn: ({
6603
- state
6604
- }) => {
6605
- const {
6606
- rects
6607
- } = state;
6608
-
6609
- if (rects.reference) {
6610
- rects.reference.x += margins[3];
6611
- rects.reference.y += margins[1];
6612
- rects.reference.width -= margins[1] + margins[3];
6613
- rects.reference.height -= margins[0] + margins[2];
6614
- }
6615
- }
6616
- }, {
6617
- name: 'flip',
6618
- options: {
6619
- allowedAutoPlacements,
6620
- boundary: boundaryElement || undefined,
6621
- fallbackPlacements,
6622
- padding: 8
6623
- }
6624
- }, matchReferenceWidth && {
6625
- name: 'matchWidth',
6626
- enabled: true,
6627
- phase: 'beforeWrite',
6628
- requires: ['computeStyles'],
6629
-
6630
- fn({
6631
- state
6632
- }) {
6633
- const {
6634
- width
6635
- } = state.rects.reference;
6636
- state.styles.popper.width = `${width}px`;
6637
- },
6638
-
6639
- effect: ({
6640
- state
6641
- }) => {
6642
- const refElement = state.elements.reference;
6643
-
6644
- if (refElement instanceof HTMLElement) {
6645
- state.elements.popper.style.width = `${refElement.offsetWidth - (margins ? margins[1] + margins[3] : 0)}px`;
6646
- }
6647
- }
6648
- }].filter(Boolean);
6649
6540
  }
6650
6541
 
6651
- function usePopoverModifiers(props) {
6542
+ const Root$i = /*#__PURE__*/memo(styled(Card)(popoverCardStyle));
6543
+ /**
6544
+ * @internal
6545
+ */
6546
+
6547
+ const PopoverCard = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function PopoverCard(props, ref) {
6652
6548
  const {
6653
- allowedAutoPlacements,
6549
+ __unstable_margins: marginsProp,
6654
6550
  arrow,
6655
- arrowElement,
6656
- boundaryElement,
6657
- constrainSize,
6658
- distance,
6659
- fallbackPlacements,
6660
- margins,
6661
- matchReferenceWidth,
6662
- open,
6663
- preventOverflow,
6664
- skidding,
6665
- tether,
6666
- tetherOffset
6667
- } = props;
6668
- return useMemo(() => {
6669
- return getPopoverModifiers({
6670
- allowedAutoPlacements,
6671
- arrow,
6672
- arrowElement,
6673
- boundaryElement,
6674
- constrainSize,
6675
- distance,
6676
- fallbackPlacements,
6677
- margins,
6678
- matchReferenceWidth,
6679
- open,
6680
- preventOverflow,
6681
- skidding,
6682
- tether,
6683
- tetherOffset
6684
- });
6685
- }, [allowedAutoPlacements, arrow, arrowElement, boundaryElement, constrainSize, distance, fallbackPlacements, margins, matchReferenceWidth, open, preventOverflow, skidding, tether, tetherOffset]);
6686
- }
6687
-
6688
- const _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"];
6551
+ arrowRef,
6552
+ arrowX,
6553
+ arrowY,
6554
+ availableHeight,
6555
+ availableWidth,
6556
+ boundaryWidth,
6557
+ children,
6558
+ padding,
6559
+ placement,
6560
+ overflow,
6561
+ radius,
6562
+ referenceWidth: referenceWidthProp,
6563
+ scheme,
6564
+ shadow,
6565
+ strategy,
6566
+ tone,
6567
+ width,
6568
+ x: xProp,
6569
+ y: yProp
6570
+ } = props,
6571
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$o);
6689
6572
 
6690
- let _2$1 = t => t,
6691
- _t$j,
6692
- _t2$e,
6693
- _t3$8;
6694
- const Root$i = styled(Layer)(({
6695
- $preventOverflow
6696
- }) => css(_t$j || (_t$j = _2$1`
6697
- pointer-events: none;
6698
- display: flex;
6699
- flex-direction: column;
6700
- max-width: calc(100% - 16px);
6573
+ const {
6574
+ zIndex
6575
+ } = useLayer(); // top right bottom left
6576
+
6577
+ const margins = useMemo(() => marginsProp || [0, 0, 0, 0], [marginsProp]); // translate according to margins
6578
+
6579
+ const referenceWidth = referenceWidthProp ? referenceWidthProp - margins[1] - margins[3] : undefined;
6580
+ const x = (xProp != null ? xProp : 0) + margins[3];
6581
+ const y = (yProp != null ? yProp : 0) + margins[0];
6582
+ const maxWidth = availableWidth ? Math.min(availableWidth - 8, referenceWidth || Infinity) : undefined;
6583
+ const rootStyle = useMemo(() => ({
6584
+ position: strategy,
6585
+ top: y,
6586
+ left: x,
6587
+ zIndex,
6588
+ width: referenceWidth,
6589
+ maxWidth: referenceWidth ? undefined : maxWidth
6590
+ }), [referenceWidth, maxWidth, strategy, x, y, zIndex]);
6591
+ const wrapperStyle = useMemo(() => ({
6592
+ minHeight: 25,
6593
+ maxHeight: availableHeight ? availableHeight - 8 : undefined
6594
+ }), [availableHeight]);
6595
+ const staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]];
6596
+ const arrowStyle = useMemo(() => {
6597
+ const style = {
6598
+ left: arrowX !== null ? arrowX : undefined,
6599
+ top: arrowY !== null ? arrowY : undefined,
6600
+ right: undefined,
6601
+ bottom: undefined
6602
+ };
6603
+ if (staticSide) style[staticSide] = -27;
6604
+ return style;
6605
+ }, [arrowX, arrowY, staticSide]);
6606
+ return /*#__PURE__*/React.createElement(Root$i, _extends({}, restProps, {
6607
+ "$boundaryWidth": boundaryWidth,
6608
+ "data-placement": placement,
6609
+ "data-ui": "Popover",
6610
+ radius: radius,
6611
+ ref: ref,
6612
+ scheme: scheme,
6613
+ shadow: shadow,
6614
+ style: rootStyle,
6615
+ tone: tone,
6616
+ "$width": width
6617
+ }), /*#__PURE__*/React.createElement(Box, {
6618
+ "data-ui": "Popover__wrapper",
6619
+ overflow: overflow,
6620
+ padding: padding,
6621
+ sizing: "border",
6622
+ style: wrapperStyle
6623
+ }, children), arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
6624
+ ref: arrowRef,
6625
+ style: arrowStyle
6626
+ }));
6627
+ }));
6628
+ PopoverCard.displayName = 'PopoverCard';
6701
6629
 
6702
- & > * {
6703
- min-height: 0;
6704
- }
6630
+ const _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"];
6705
6631
 
6706
- /* Hide the popover when the reference element is out of bounds */
6707
- ${0}
6708
- `), $preventOverflow && css(_t2$e || (_t2$e = _2$1`
6709
- &[data-popper-reference-hidden='true'] {
6710
- display: none;
6632
+ function size(scope) {
6633
+ return size$1({
6634
+ apply(args) {
6635
+ if (scope.constrainSize) {
6636
+ scope.setAvailableWidth(args.availableWidth);
6637
+ scope.setAvailableHeight(args.availableHeight);
6711
6638
  }
6712
- `))));
6713
- const PopoverCard = styled(Card)(({
6714
- $constrainSize
6715
- }) => css(_t3$8 || (_t3$8 = _2$1`
6716
- flex: 1;
6717
- max-height: ${0};
6718
- pointer-events: all;
6719
-
6720
- && {
6721
- display: flex;
6722
- }
6723
-
6724
- flex-direction: column;
6725
6639
 
6726
- & > * {
6727
- min-height: 0;
6728
- }
6640
+ if (scope.matchReferenceWidth) {
6641
+ scope.setReferenceWidth(args.rects.reference.width);
6642
+ }
6643
+ },
6729
6644
 
6730
- ${0}
6731
- `), $constrainSize && '100%', responsiveContainerWidthStyle));
6732
- /**
6733
- * @public
6734
- */
6645
+ boundary: scope.boundaryElement || undefined
6646
+ });
6647
+ }
6735
6648
 
6736
- const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6737
- var _theme$sanity$layer;
6649
+ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Popover(props, ref) {
6650
+ var _theme$sanity$layer, _useElementSize, _middlewareData$arrow, _middlewareData$arrow2;
6738
6651
 
6739
- const boundaryElementContext = useBoundaryElement();
6740
6652
  const theme = useTheme();
6653
+ const boundaryElementContext = useBoundaryElement();
6741
6654
 
6742
6655
  const {
6743
6656
  __unstable_margins: margins,
6744
- allowedAutoPlacements,
6745
- arrow = true,
6746
- boundaryElement: boundaryElementProp = boundaryElementContext.element,
6747
- children: child,
6657
+ arrow: arrowProp = true,
6658
+ boundaryElement = boundaryElementContext.element,
6659
+ children: childProp,
6660
+ constrainSize = false,
6748
6661
  content,
6749
- constrainSize,
6750
6662
  disabled,
6751
6663
  fallbackPlacements,
6752
- open = false,
6753
- padding,
6754
- placement = 'bottom',
6755
- portal: portalProp = false,
6756
- preventOverflow,
6757
- radius = 3,
6758
- referenceElement: referenceElementProp,
6759
- matchReferenceWidth,
6760
- shadow = 3,
6664
+ matchReferenceWidth: matchReferenceWidthProp,
6665
+ open,
6666
+ overflow = props.constrainSize ? 'auto' : undefined,
6667
+ padding: paddingProp,
6668
+ placement: placementProp = 'bottom',
6669
+ portal,
6670
+ preventOverflow = true,
6671
+ radius: radiusProp = 3,
6672
+ referenceElement,
6761
6673
  scheme,
6762
- style = EMPTY_RECORD,
6763
- tether,
6764
- tetherOffset,
6674
+ shadow: shadowProp = 3,
6765
6675
  tone = 'inherit',
6766
- width: widthProp = 0,
6767
- zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
6676
+ width: widthProp = undefined,
6677
+ zOffset: zOffsetProp = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
6768
6678
  } = props,
6769
6679
  restProps = _objectWithoutPropertiesLoose(props, _excluded$n);
6770
6680
 
6771
- const forwardedRef = useForwardedRef(ref);
6772
- const portal = usePortal();
6773
- const [referenceElement, setReferenceElement] = useState(null);
6774
- const [popperElement, setPopperElement] = useState(null);
6775
- const [arrowElement, setArrowElement] = useState(null);
6776
- const popperReferenceElement = referenceElementProp || referenceElement;
6681
+ const boundarySize = (_useElementSize = useElementSize(boundaryElement)) == null ? void 0 : _useElementSize.border;
6682
+ const padding = useArrayProp(paddingProp);
6683
+ const radius = useArrayProp(radiusProp);
6684
+ const shadow = useArrayProp(shadowProp);
6777
6685
  const width = useArrayProp(widthProp);
6778
- const modifiers = usePopoverModifiers({
6779
- allowedAutoPlacements,
6780
- arrow,
6781
- arrowElement,
6782
- boundaryElement: boundaryElementProp || portal.boundaryElement,
6783
- constrainSize,
6784
- distance: arrow ? 4 : 0,
6785
- fallbackPlacements,
6786
- margins,
6787
- matchReferenceWidth,
6788
- open,
6789
- preventOverflow,
6790
- skidding: 0,
6791
- tether,
6792
- tetherOffset
6793
- });
6794
- const popper = usePopper(popperReferenceElement, popperElement, {
6686
+ const zOffset = useArrayProp(zOffsetProp);
6687
+ const [availableWidth, setAvailableWidth] = useState(undefined);
6688
+ const [availableHeight, setAvailableHeight] = useState(undefined);
6689
+ const [referenceWidth, setReferenceWidth] = useState(undefined);
6690
+ const forwardedRef = useForwardedRef(ref);
6691
+ const arrowRef = useRef(null);
6692
+ const rootBoundary = 'viewport';
6693
+ const middleware = useMemo(() => {
6694
+ const ret = []; // Flip the floating element when leaving the boundary box
6695
+
6696
+ if (constrainSize || preventOverflow) {
6697
+ ret.push(flip({
6698
+ boundary: boundaryElement || undefined,
6699
+ fallbackPlacements,
6700
+ padding: 8,
6701
+ rootBoundary
6702
+ }));
6703
+ } // Track sizes
6704
+
6705
+
6706
+ ret.push(size({
6707
+ boundaryElement,
6708
+ constrainSize,
6709
+ matchReferenceWidth: matchReferenceWidthProp,
6710
+ setAvailableHeight,
6711
+ setAvailableWidth,
6712
+ setReferenceWidth
6713
+ })); // Define distance between reference and floating element
6714
+
6715
+ ret.push(offset({
6716
+ mainAxis: arrowProp ? 4 : 0
6717
+ })); // Shift the popover so its sits with the boundary eleement
6718
+
6719
+ if (preventOverflow) {
6720
+ ret.push(shift({
6721
+ boundary: boundaryElement || undefined,
6722
+ rootBoundary,
6723
+ padding: 8
6724
+ }));
6725
+ } // Place arrow
6726
+
6727
+
6728
+ if (arrowProp) {
6729
+ ret.push(arrow({
6730
+ element: arrowRef,
6731
+ padding: 4
6732
+ }));
6733
+ }
6734
+
6735
+ return ret;
6736
+ }, [arrowProp, boundaryElement, constrainSize, fallbackPlacements, matchReferenceWidthProp, preventOverflow]);
6737
+ const {
6738
+ x,
6739
+ y,
6795
6740
  placement,
6796
- modifiers
6741
+ reference,
6742
+ floating,
6743
+ middlewareData,
6744
+ strategy
6745
+ } = useFloating({
6746
+ middleware,
6747
+ placement: placementProp,
6748
+ whileElementsMounted: autoUpdate
6797
6749
  });
6798
- const {
6799
- attributes,
6800
- forceUpdate,
6801
- styles
6802
- } = popper;
6803
- const setRef = useCallback(el => {
6804
- const childRef = child.ref;
6805
- setReferenceElement(el);
6750
+ const arrowX = (_middlewareData$arrow = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow.x;
6751
+ const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow2.y;
6752
+ const setArrow = useCallback(arrowEl => {
6753
+ arrowRef.current = arrowEl;
6754
+ }, []);
6755
+ const setFloating = useCallback(node => {
6756
+ forwardedRef.current = node;
6757
+ floating(node);
6758
+ }, [floating, forwardedRef]);
6759
+ const setReference = useCallback(node => {
6760
+ reference(node);
6761
+ const childRef = childProp == null ? void 0 : childProp.ref;
6806
6762
 
6807
6763
  if (typeof childRef === 'function') {
6808
- childRef(el);
6764
+ childRef(node);
6809
6765
  } else if (childRef) {
6810
- childRef.current = el;
6766
+ childRef.current = node;
6811
6767
  }
6812
- }, [child]);
6813
- const setRootRef = useCallback(el => {
6814
- setPopperElement(el);
6815
- forwardedRef.current = el;
6816
- }, [forwardedRef]);
6817
- const popoverStyle = useMemo(() => _extends({}, style, styles.popper), [style, styles]);
6768
+ }, [childProp, reference]);
6769
+ const child = useMemo(() => {
6770
+ if (!childProp || referenceElement) return null;
6771
+ return /*#__PURE__*/cloneElement(childProp, {
6772
+ ref: setReference
6773
+ });
6774
+ }, [childProp, referenceElement, setReference]);
6818
6775
  useEffect(() => {
6819
- if (forceUpdate) {
6820
- try {
6821
- forceUpdate();
6822
- } catch (_) {// ignore caught error
6823
- }
6824
- }
6825
- }, [content, forceUpdate, open, popperReferenceElement]);
6776
+ if (referenceElement) reference(referenceElement);
6777
+ }, [reference, referenceElement]);
6826
6778
 
6827
6779
  if (disabled) {
6828
- return child || /*#__PURE__*/React.createElement(React.Fragment, null);
6780
+ return childProp || /*#__PURE__*/React.createElement(React.Fragment, null);
6829
6781
  }
6830
6782
 
6831
- const node = /*#__PURE__*/React.createElement(Root$i, _extends({
6832
- "data-ui": "Popover"
6833
- }, restProps, {
6834
- "$preventOverflow": preventOverflow,
6835
- ref: setRootRef,
6836
- style: popoverStyle,
6783
+ const popover = /*#__PURE__*/React.createElement(LayerProvider, {
6837
6784
  zOffset: zOffset
6838
- }, attributes.popper), /*#__PURE__*/React.createElement(PopoverCard, {
6839
- "$constrainSize": constrainSize,
6840
- "$width": width,
6841
- "data-ui": "PopoverCard",
6785
+ }, /*#__PURE__*/React.createElement(PopoverCard, _extends({}, restProps, {
6786
+ __unstable_margins: margins,
6787
+ arrow: arrowProp,
6788
+ arrowRef: setArrow,
6789
+ arrowX: arrowX,
6790
+ arrowY: arrowY,
6791
+ availableWidth: constrainSize ? availableWidth : undefined,
6792
+ availableHeight: constrainSize ? availableHeight : undefined,
6793
+ boundaryWidth: boundarySize == null ? void 0 : boundarySize.width,
6794
+ overflow: overflow,
6842
6795
  padding: padding,
6796
+ placement: placement,
6843
6797
  radius: radius,
6798
+ ref: setFloating,
6799
+ referenceWidth: matchReferenceWidthProp ? referenceWidth : undefined,
6844
6800
  scheme: scheme,
6845
6801
  shadow: shadow,
6846
- tone: tone
6847
- }, arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
6848
- ref: setArrowElement,
6849
- style: styles.arrow
6802
+ strategy: strategy,
6803
+ tone: tone,
6804
+ x: x,
6805
+ y: y,
6806
+ width: width
6850
6807
  }), content));
6851
- return /*#__PURE__*/React.createElement(React.Fragment, null, child && !referenceElementProp ? /*#__PURE__*/cloneElement(child, {
6852
- ref: setRef
6853
- }) : child || /*#__PURE__*/React.createElement(React.Fragment, null), open && /*#__PURE__*/React.createElement(React.Fragment, null, portalProp && /*#__PURE__*/React.createElement(Portal, {
6854
- __unstable_name: typeof portalProp === 'string' ? portalProp : undefined
6855
- }, node), !portalProp && node));
6856
- });
6808
+ return /*#__PURE__*/React.createElement(React.Fragment, null, open && /*#__PURE__*/React.createElement(React.Fragment, null, portal ? /*#__PURE__*/React.createElement(Portal, {
6809
+ __unstable_name: typeof portal === 'string' ? portal : undefined
6810
+ }, popover) : popover), child);
6811
+ }));
6812
+ Popover.displayName = 'Popover';
6857
6813
 
6858
- let _$h = t => t,
6814
+ let _$i = t => t,
6859
6815
  _t$i,
6860
6816
  _t2$d;
6861
6817
  function radioBaseStyle() {
6862
- return css(_t$i || (_t$i = _$h`
6818
+ return css(_t$i || (_t$i = _$i`
6863
6819
  position: relative;
6864
6820
 
6865
6821
  &:not([hidden]) {
@@ -6881,7 +6837,7 @@ function inputElementStyle(props) {
6881
6837
  } = theme.sanity;
6882
6838
  const color = theme.sanity.color.input;
6883
6839
  const dist = (input.radio.size - input.radio.markSize) / 2;
6884
- return css(_t2$d || (_t2$d = _$h`
6840
+ return css(_t2$d || (_t2$d = _$i`
6885
6841
  appearance: none;
6886
6842
  position: absolute;
6887
6843
  top: 0;
@@ -6999,14 +6955,14 @@ const Radio = /*#__PURE__*/forwardRef(function Radio(props, forwardedRef) {
6999
6955
  })), /*#__PURE__*/React.createElement("span", null));
7000
6956
  });
7001
6957
 
7002
- let _$g = t => t,
6958
+ let _$h = t => t,
7003
6959
  _t$h,
7004
6960
  _t2$c,
7005
6961
  _t3$7,
7006
6962
  _t4$5;
7007
6963
 
7008
6964
  function rootStyle() {
7009
- return css(_t$h || (_t$h = _$g`
6965
+ return css(_t$h || (_t$h = _$h`
7010
6966
  position: relative;
7011
6967
  width: stretch;
7012
6968
 
@@ -7021,7 +6977,7 @@ function inputBaseStyle(props) {
7021
6977
  theme
7022
6978
  } = props;
7023
6979
  const font = theme.sanity.fonts.text;
7024
- return css(_t2$c || (_t2$c = _$g`
6980
+ return css(_t2$c || (_t2$c = _$h`
7025
6981
  -webkit-font-smoothing: antialiased;
7026
6982
  appearance: none;
7027
6983
  border: 0;
@@ -7046,7 +7002,7 @@ function inputColorStyle(props) {
7046
7002
  input
7047
7003
  } = theme.sanity;
7048
7004
  const color = theme.sanity.color.input;
7049
- return css(_t3$7 || (_t3$7 = _$g`
7005
+ return css(_t3$7 || (_t3$7 = _$h`
7050
7006
  /* enabled */
7051
7007
  background-color: ${0};
7052
7008
  color: ${0};
@@ -7127,7 +7083,7 @@ function iconBoxStyle(props) {
7127
7083
  theme
7128
7084
  } = props;
7129
7085
  const color = theme.sanity.color.input;
7130
- return css(_t4$5 || (_t4$5 = _$g`
7086
+ return css(_t4$5 || (_t4$5 = _$h`
7131
7087
  pointer-events: none;
7132
7088
  position: absolute;
7133
7089
  top: 0;
@@ -7252,7 +7208,7 @@ const Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
7252
7208
  }));
7253
7209
  });
7254
7210
 
7255
- let _$f = t => t,
7211
+ let _$g = t => t,
7256
7212
  _t$g,
7257
7213
  _t2$b,
7258
7214
  _t3$6,
@@ -7263,7 +7219,7 @@ let _$f = t => t,
7263
7219
  /* Root */
7264
7220
 
7265
7221
  function switchBaseStyles() {
7266
- return css(_t$g || (_t$g = _$f`
7222
+ return css(_t$g || (_t$g = _$g`
7267
7223
  position: relative;
7268
7224
  &:not([hidden]) {
7269
7225
  display: inline-block;
@@ -7274,7 +7230,7 @@ function switchBaseStyles() {
7274
7230
 
7275
7231
  function switchInputStyles() {
7276
7232
  // Visually hide the input element while keeping it interactive
7277
- return css(_t2$b || (_t2$b = _$f`
7233
+ return css(_t2$b || (_t2$b = _$g`
7278
7234
  position: absolute;
7279
7235
  top: 0;
7280
7236
  right: 0;
@@ -7302,7 +7258,7 @@ function switchRepresentationStyles(props) {
7302
7258
  input
7303
7259
  } = theme.sanity;
7304
7260
  const color = theme.sanity.color.button.default;
7305
- return css(_t3$6 || (_t3$6 = _$f`
7261
+ return css(_t3$6 || (_t3$6 = _$g`
7306
7262
  --switch-bg-color: ${0};
7307
7263
  --switch-fg-color: ${0};
7308
7264
  --switch-box-shadow: none;
@@ -7374,7 +7330,7 @@ function switchTrackStyles(props) {
7374
7330
  const {
7375
7331
  input
7376
7332
  } = theme.sanity;
7377
- return css(_t4$4 || (_t4$4 = _$f`
7333
+ return css(_t4$4 || (_t4$4 = _$g`
7378
7334
  &:not([hidden]) {
7379
7335
  display: block;
7380
7336
  }
@@ -7404,7 +7360,7 @@ function switchThumbStyles(props) {
7404
7360
  const checkedOffset = trackWidth - trackPadding * 2 - size;
7405
7361
  const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
7406
7362
  const checked = $indeterminate !== true && props.$checked === true;
7407
- return css(_t5$3 || (_t5$3 = _$f`
7363
+ return css(_t5$3 || (_t5$3 = _$g`
7408
7364
  &:not([hidden]) {
7409
7365
  display: block;
7410
7366
  }
@@ -7423,9 +7379,9 @@ function switchThumbStyles(props) {
7423
7379
  ${0}
7424
7380
 
7425
7381
  ${0}
7426
- `), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$2 || (_t6$2 = _$f`
7382
+ `), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$2 || (_t6$2 = _$g`
7427
7383
  transform: translate3d(${0}px, 0, 0);
7428
- `), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$f`
7384
+ `), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$g`
7429
7385
  transform: translate3d(${0}px, 0, 0);
7430
7386
  `), indeterminateOffset));
7431
7387
  }
@@ -7480,10 +7436,10 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
7480
7436
 
7481
7437
  const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"];
7482
7438
 
7483
- let _$e = t => t,
7439
+ let _$f = t => t,
7484
7440
  _t$f;
7485
7441
  const Root$d = styled.span(textInputRootStyle);
7486
- const InputRoot$1 = styled.span(_t$f || (_t$f = _$e`
7442
+ const InputRoot$1 = styled.span(_t$f || (_t$f = _$f`
7487
7443
  flex: 1;
7488
7444
  min-width: 0;
7489
7445
  display: block;
@@ -7533,7 +7489,7 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
7533
7489
 
7534
7490
  const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"];
7535
7491
 
7536
- let _$d = t => t,
7492
+ let _$e = t => t,
7537
7493
  _t$e,
7538
7494
  _t2$a,
7539
7495
  _t3$5,
@@ -7546,7 +7502,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
7546
7502
  const Root$c = styled(Card).attrs({
7547
7503
  forwardedAs: 'span'
7548
7504
  })(textInputRootStyle);
7549
- const InputRoot = styled.span(_t$e || (_t$e = _$d`
7505
+ const InputRoot = styled.span(_t$e || (_t$e = _$e`
7550
7506
  flex: 1;
7551
7507
  min-width: 0;
7552
7508
  display: block;
@@ -7554,7 +7510,7 @@ const InputRoot = styled.span(_t$e || (_t$e = _$d`
7554
7510
  `));
7555
7511
  const Prefix = styled(Card).attrs({
7556
7512
  forwardedAs: 'span'
7557
- })(_t2$a || (_t2$a = _$d`
7513
+ })(_t2$a || (_t2$a = _$e`
7558
7514
  border-top-right-radius: 0;
7559
7515
  border-bottom-right-radius: 0;
7560
7516
 
@@ -7565,7 +7521,7 @@ const Prefix = styled(Card).attrs({
7565
7521
  `));
7566
7522
  const Suffix = styled(Card).attrs({
7567
7523
  forwardedAs: 'span'
7568
- })(_t3$5 || (_t3$5 = _$d`
7524
+ })(_t3$5 || (_t3$5 = _$e`
7569
7525
  border-top-left-radius: 0;
7570
7526
  border-bottom-left-radius: 0;
7571
7527
 
@@ -7576,17 +7532,17 @@ const Suffix = styled(Card).attrs({
7576
7532
  `));
7577
7533
  const Input = styled.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
7578
7534
  const Presentation = styled.span(responsiveRadiusStyle, textInputRepresentationStyle);
7579
- const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$d`
7535
+ const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$e`
7580
7536
  position: absolute;
7581
7537
  top: 0;
7582
7538
  left: 0;
7583
7539
  `));
7584
- const RightBox = styled(Box)(_t5$2 || (_t5$2 = _$d`
7540
+ const RightBox = styled(Box)(_t5$2 || (_t5$2 = _$e`
7585
7541
  position: absolute;
7586
7542
  top: 0;
7587
7543
  right: 0;
7588
7544
  `));
7589
- const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$d`
7545
+ const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$e`
7590
7546
  background-color: transparent;
7591
7547
  position: absolute;
7592
7548
  top: 0;
@@ -7730,12 +7686,27 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7730
7686
  })), presentationNode, clearButtonNode), suffixNode);
7731
7687
  });
7732
7688
 
7733
- let _$c = t => t,
7689
+ let _$d = t => t,
7734
7690
  _t$d,
7735
7691
  _t2$9,
7736
7692
  _t3$4;
7737
- const Root$b = styled.div(_t$d || (_t$d = _$c`
7693
+ const Root$b = styled.div(_t$d || (_t$d = _$d`
7738
7694
  position: absolute;
7695
+ pointer-events: none;
7696
+ width: 15px;
7697
+ height: 15px;
7698
+ fill: none;
7699
+
7700
+ :empty + & {
7701
+ display: none;
7702
+ }
7703
+
7704
+ & > svg {
7705
+ display: block;
7706
+ transform-origin: 7.5px 7.5px;
7707
+ }
7708
+
7709
+ /* position: absolute;
7739
7710
  width: 15px;
7740
7711
  height: 15px;
7741
7712
  fill: none;
@@ -7749,46 +7720,48 @@ const Root$b = styled.div(_t$d || (_t$d = _$c`
7749
7720
  display: block;
7750
7721
  }
7751
7722
  transform-origin: 7.5px 7.5px;
7752
- }
7723
+ } */
7753
7724
 
7754
- [data-popper-placement^='top'] > div > & {
7755
- bottom: -15px;
7725
+ [data-placement^='top'] > & {
7726
+ bottom: -27px;
7756
7727
  }
7757
7728
 
7758
- [data-popper-placement^='right'] > div > & {
7759
- left: -15px;
7729
+ [data-placement^='right'] > & {
7730
+ left: -27px;
7760
7731
 
7761
7732
  & > svg {
7762
7733
  transform: rotate(90deg);
7763
7734
  }
7764
7735
  }
7765
7736
 
7766
- [data-popper-placement^='left'] > div > & {
7767
- right: -15px;
7737
+ [data-placement^='left'] > & {
7738
+ right: -27px;
7768
7739
 
7769
7740
  & > svg {
7770
7741
  transform: rotate(-90deg);
7771
7742
  }
7772
7743
  }
7773
7744
 
7774
- [data-popper-placement^='bottom'] > div > & {
7775
- top: -15px;
7745
+ [data-placement^='bottom'] > & {
7746
+ top: -27px;
7776
7747
 
7777
7748
  & > svg {
7778
7749
  transform: rotate(180deg);
7779
7750
  }
7780
7751
  }
7781
7752
  `));
7782
- const Border = styled.path(_t2$9 || (_t2$9 = _$c`
7753
+ const Border = styled.path(_t2$9 || (_t2$9 = _$d`
7783
7754
  fill: var(--card-shadow-outline-color);
7784
7755
  `));
7785
- const Shape = styled.path(_t3$4 || (_t3$4 = _$c`
7756
+ const Shape = styled.path(_t3$4 || (_t3$4 = _$d`
7786
7757
  fill: var(--card-bg-color);
7787
7758
  `));
7788
7759
  const TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
7789
7760
  const restProps = _extends({}, props);
7790
7761
 
7791
- return /*#__PURE__*/React.createElement(Root$b, _extends({}, restProps, {
7762
+ return /*#__PURE__*/React.createElement(Root$b, _extends({
7763
+ "data-ui": "Tooltip__arrow"
7764
+ }, restProps, {
7792
7765
  ref: ref
7793
7766
  }), /*#__PURE__*/React.createElement("svg", {
7794
7767
  width: "15",
@@ -7801,11 +7774,11 @@ const TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
7801
7774
  })));
7802
7775
  });
7803
7776
 
7804
- const _excluded$g = ["allowedAutoPlacements", "boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "zOffset"];
7777
+ const _excluded$g = ["boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "shadow", "zOffset"];
7805
7778
 
7806
- let _2 = t => t,
7779
+ let _$c = t => t,
7807
7780
  _t$c;
7808
- const Root$a = styled(Layer)(_t$c || (_t$c = _2`
7781
+ const Root$a = styled(Layer)(_t$c || (_t$c = _$c`
7809
7782
  pointer-events: none;
7810
7783
  `));
7811
7784
  /**
@@ -7813,21 +7786,21 @@ const Root$a = styled(Layer)(_t$c || (_t$c = _2`
7813
7786
  */
7814
7787
 
7815
7788
  const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7816
- var _theme$sanity$layer;
7789
+ var _theme$sanity$layer, _middlewareData$arrow, _middlewareData$arrow2;
7817
7790
 
7818
7791
  const boundaryElementContext = useBoundaryElement();
7819
7792
  const theme = useTheme();
7820
7793
 
7821
7794
  const {
7822
- allowedAutoPlacements,
7823
7795
  boundaryElement = boundaryElementContext == null ? void 0 : boundaryElementContext.element,
7824
- children,
7796
+ children: childProp,
7825
7797
  content,
7826
7798
  disabled,
7827
7799
  fallbackPlacements: fallbackPlacementsProp,
7828
- placement = 'bottom',
7800
+ placement: placementProp = 'bottom',
7829
7801
  portal,
7830
7802
  scheme,
7803
+ shadow = 2,
7831
7804
  zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.tooltip.zOffset
7832
7805
  } = props,
7833
7806
  restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
@@ -7835,39 +7808,66 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7835
7808
  const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
7836
7809
  const forwardedRef = useForwardedRef(ref);
7837
7810
  const [referenceElement, setReferenceElement] = useState(null);
7838
- const [popperElement, setPopperElement] = useState(null);
7839
- const [arrowElement, setArrowElement] = useState(null);
7840
- const popper = usePopper(referenceElement, popperElement, {
7811
+ const arrowRef = useRef(null);
7812
+ const rootBoundary = 'viewport';
7813
+ const middleware = useMemo(() => {
7814
+ const ret = []; // Flip the floating element when leaving the boundary box
7815
+
7816
+ ret.push(flip({
7817
+ boundary: boundaryElement || undefined,
7818
+ fallbackPlacements,
7819
+ padding: 4,
7820
+ rootBoundary
7821
+ })); // Define distance between reference and floating element
7822
+
7823
+ ret.push(offset({
7824
+ mainAxis: 3
7825
+ })); // Shift the tooltip so its sits with the boundary eleement
7826
+
7827
+ ret.push(shift({
7828
+ boundary: boundaryElement || undefined,
7829
+ rootBoundary,
7830
+ padding: 4
7831
+ })); // Place arrow
7832
+
7833
+ ret.push(arrow({
7834
+ element: arrowRef,
7835
+ padding: 2
7836
+ }));
7837
+ return ret;
7838
+ }, [boundaryElement, fallbackPlacements]);
7839
+ const {
7840
+ x,
7841
+ y,
7841
7842
  placement,
7842
- modifiers: [{
7843
- name: 'arrow',
7844
- options: {
7845
- element: arrowElement,
7846
- padding: 4
7847
- }
7848
- }, {
7849
- name: 'preventOverflow',
7850
- options: {
7851
- altAxis: true,
7852
- boundary: boundaryElement || undefined,
7853
- padding: 4
7854
- }
7855
- }, {
7856
- name: 'offset',
7857
- options: {
7858
- offset: [0, 3]
7859
- }
7860
- }, {
7861
- name: 'flip',
7862
- options: {
7863
- allowedAutoPlacements,
7864
- fallbackPlacements
7865
- }
7866
- }]
7843
+ reference,
7844
+ floating,
7845
+ middlewareData,
7846
+ update,
7847
+ strategy
7848
+ } = useFloating({
7849
+ middleware,
7850
+ placement: placementProp,
7851
+ whileElementsMounted: autoUpdate
7867
7852
  });
7868
- const {
7869
- forceUpdate
7870
- } = popper;
7853
+ const rootStyle = useMemo(() => ({
7854
+ position: strategy,
7855
+ top: y != null ? y : 0,
7856
+ left: x != null ? x : 0
7857
+ }), [strategy, x, y]);
7858
+ const staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]];
7859
+ const arrowX = (_middlewareData$arrow = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow.x;
7860
+ const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow2.y;
7861
+ const arrowStyle = useMemo(() => {
7862
+ const style = {
7863
+ left: arrowX !== null ? arrowX : undefined,
7864
+ top: arrowY !== null ? arrowY : undefined,
7865
+ right: undefined,
7866
+ bottom: undefined
7867
+ };
7868
+ if (staticSide) style[staticSide] = -15;
7869
+ return style;
7870
+ }, [arrowX, arrowY, staticSide]);
7871
7871
  const [isOpen, setIsOpen] = useState(false);
7872
7872
  const handleBlur = useCallback(() => setIsOpen(false), []);
7873
7873
  const handleFocus = useCallback(() => setIsOpen(true), []);
@@ -7893,15 +7893,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7893
7893
  return () => {
7894
7894
  window.removeEventListener('mousemove', handleWindowMouseMove);
7895
7895
  };
7896
- }, [isOpen, referenceElement]);
7897
- useEffect(() => {
7898
- if (forceUpdate) {
7899
- try {
7900
- forceUpdate();
7901
- } catch (_) {// ignore caught error
7902
- }
7903
- }
7904
- }, [forceUpdate, content]); // Close when `disabled` changes to `true`
7896
+ }, [isOpen, referenceElement]); // Close when `disabled` changes to `true`
7905
7897
 
7906
7898
  useEffect(() => {
7907
7899
  if (disabled) setIsOpen(false);
@@ -7909,40 +7901,59 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7909
7901
 
7910
7902
  useEffect(() => {
7911
7903
  if (!content) setIsOpen(false);
7912
- }, [content]);
7913
-
7914
- const setRef = el => {
7915
- setPopperElement(el);
7916
- forwardedRef.current = el;
7917
- };
7918
-
7919
- if (!children) return /*#__PURE__*/React.createElement(React.Fragment, null);
7920
- if (disabled) return children;
7921
- const referenceProps = {
7922
- onBlur: handleBlur,
7923
- onFocus: handleFocus,
7924
- onMouseEnter: handleMouseEnter,
7925
- onMouseLeave: handleMouseLeave,
7926
- ref: setReferenceElement
7927
- };
7928
- const referenceNode = /*#__PURE__*/cloneElement(children, referenceProps);
7929
- const popperNode = /*#__PURE__*/React.createElement(Root$a, _extends({
7904
+ }, [content]); // Update reference
7905
+
7906
+ useEffect(() => reference(referenceElement), [reference, referenceElement]);
7907
+ const setArrow = useCallback(arrowEl => {
7908
+ arrowRef.current = arrowEl;
7909
+ update();
7910
+ }, [update]);
7911
+ const setFloating = useCallback(node => {
7912
+ forwardedRef.current = node;
7913
+ floating(node);
7914
+ }, [floating, forwardedRef]);
7915
+ const childRef = childProp == null ? void 0 : childProp.ref;
7916
+ const setReference = useCallback(node => {
7917
+ if (typeof childRef === 'function') {
7918
+ childRef(node);
7919
+ } else if (childRef) {
7920
+ childRef.current = node;
7921
+ } // childRef.current = node
7922
+
7923
+
7924
+ setReferenceElement(node);
7925
+ }, [childRef]);
7926
+ const child = useMemo(() => {
7927
+ if (!childProp) return null;
7928
+ return /*#__PURE__*/cloneElement(childProp, {
7929
+ onBlur: handleBlur,
7930
+ onFocus: handleFocus,
7931
+ onMouseEnter: handleMouseEnter,
7932
+ onMouseLeave: handleMouseLeave,
7933
+ ref: setReference
7934
+ });
7935
+ }, [childProp, handleBlur, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
7936
+ if (!child) return /*#__PURE__*/React.createElement(React.Fragment, null);
7937
+ if (disabled) return child;
7938
+ const root = /*#__PURE__*/React.createElement(Root$a, _extends({
7930
7939
  "data-ui": "Tooltip"
7931
- }, restProps, popper.attributes.popper, {
7932
- ref: setRef,
7933
- style: popper.styles.popper,
7940
+ }, restProps, {
7941
+ ref: setFloating,
7942
+ style: rootStyle,
7934
7943
  zOffset: zOffset
7935
7944
  }), /*#__PURE__*/React.createElement(Card, {
7945
+ "data-ui": "Tooltip__card",
7946
+ "data-placement": placement,
7936
7947
  radius: 2,
7937
7948
  scheme: scheme,
7938
- shadow: 3
7949
+ shadow: shadow
7939
7950
  }, content, /*#__PURE__*/React.createElement(TooltipArrow, {
7940
- ref: setArrowElement,
7941
- style: popper.styles.arrow
7951
+ ref: setArrow,
7952
+ style: arrowStyle
7942
7953
  })));
7943
- return /*#__PURE__*/React.createElement(React.Fragment, null, referenceNode, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, portal && /*#__PURE__*/React.createElement(Portal, {
7954
+ return /*#__PURE__*/React.createElement(React.Fragment, null, child, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, portal ? /*#__PURE__*/React.createElement(Portal, {
7944
7955
  __unstable_name: typeof portal === 'string' ? portal : undefined
7945
- }, popperNode), !portal && popperNode));
7956
+ }, root) : root));
7946
7957
  });
7947
7958
 
7948
7959
  let _$b = t => t,
@@ -7974,11 +7985,6 @@ const ListBox = styled(Box)(_t2$8 || (_t2$8 = _$b`
7974
7985
  */
7975
7986
 
7976
7987
  const ResultsPopover = styled(Popover)(_t3$3 || (_t3$3 = _$b`
7977
- & > div {
7978
- overflow: auto;
7979
- -webkit-overflow-scrolling: touch;
7980
- }
7981
-
7982
7988
  &[data-popper-reference-hidden='true'] {
7983
7989
  display: none;
7984
7990
  }
@@ -8110,17 +8116,17 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ['Control', 'Shift', 'Alt', 'Enter', 'H
8110
8116
  * @internal
8111
8117
  */
8112
8118
 
8113
- const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 1, 1];
8119
+ const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 0, 0];
8114
8120
  /**
8115
8121
  * @internal
8116
8122
  */
8117
8123
 
8118
- const AUTOCOMPLETE_POPOVER_PLACEMENT = 'bottom-start';
8124
+ const AUTOCOMPLETE_POPOVER_PLACEMENT = 'bottom';
8119
8125
  /**
8120
8126
  * @internal
8121
8127
  */
8122
8128
 
8123
- const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ['top-start'];
8129
+ const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ['bottom', 'top'];
8124
8130
 
8125
8131
  const _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"];
8126
8132