@sanity/ui 0.37.14-next.6 → 0.37.14

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