@sanity/ui 0.37.14-next.6 → 0.37.16

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 (54) 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/textArea/textArea.d.ts.map +1 -1
  19. package/lib/dts/src/primitives/textInput/textInput.d.ts.map +1 -1
  20. package/lib/dts/src/primitives/tooltip/tooltip.d.ts +0 -2
  21. package/lib/dts/src/primitives/tooltip/tooltip.d.ts.map +1 -1
  22. package/lib/dts/src/primitives/tooltip/tooltipArrow.d.ts.map +1 -1
  23. package/lib/dts/src/styles/input/textInputStyle.d.ts +3 -1
  24. package/lib/dts/src/styles/input/textInputStyle.d.ts.map +1 -1
  25. package/lib/sanity-ui.js +465 -490
  26. package/lib/sanity-ui.js.map +1 -1
  27. package/lib/sanity-ui.modern.mjs +584 -566
  28. package/lib/sanity-ui.modern.mjs.map +1 -1
  29. package/lib/sanity-ui.module.js +465 -491
  30. package/lib/sanity-ui.module.js.map +1 -1
  31. package/package.json +6 -5
  32. package/src/components/autocomplete/autocomplete.styles.tsx +5 -0
  33. package/src/components/autocomplete/constants.ts +3 -3
  34. package/src/constants.ts +0 -17
  35. package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
  36. package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +0 -1
  37. package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
  38. package/src/primitives/popover/{popoverArrow.tsx → arrow.tsx} +5 -5
  39. package/src/primitives/popover/modifiers/getPopoverModifiers.ts +137 -0
  40. package/src/primitives/popover/modifiers/index.ts +1 -0
  41. package/src/primitives/popover/modifiers/types.ts +18 -0
  42. package/src/primitives/popover/modifiers/usePopoverModifiers.ts +58 -0
  43. package/src/primitives/popover/popover.tsx +196 -229
  44. package/src/primitives/textArea/textArea.tsx +2 -0
  45. package/src/primitives/textInput/__workshop__/tones.tsx +222 -105
  46. package/src/primitives/textInput/textInput.tsx +5 -1
  47. package/src/primitives/tooltip/__workshop__/props.tsx +4 -5
  48. package/src/primitives/tooltip/tooltip.tsx +92 -159
  49. package/src/primitives/tooltip/tooltipArrow.tsx +10 -25
  50. package/src/styles/input/textInputStyle.ts +7 -5
  51. package/lib/dts/src/primitives/popover/popoverArrow.d.ts.map +0 -1
  52. package/lib/dts/src/primitives/popover/popoverCard.d.ts +0 -33
  53. package/lib/dts/src/primitives/popover/popoverCard.d.ts.map +0 -1
  54. 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
  }
@@ -3684,12 +3668,13 @@ function textInputRootStyle() {
3684
3668
  function textInputBaseStyle(props) {
3685
3669
  const {
3686
3670
  theme,
3671
+ $scheme,
3687
3672
  $tone,
3688
3673
  $weight
3689
3674
  } = props;
3690
3675
  const font = theme.sanity.fonts.text;
3691
3676
  const color = theme.sanity.color.input;
3692
- return css(_t2$m || (_t2$m = _$C`
3677
+ return css(_t2$n || (_t2$n = _$B`
3693
3678
  appearance: none;
3694
3679
  background: none;
3695
3680
  border: 0;
@@ -3725,7 +3710,7 @@ function textInputBaseStyle(props) {
3725
3710
  color: var(--input-placeholder-color);
3726
3711
  }
3727
3712
 
3728
- &[data-tone='${0}'] {
3713
+ &[data-scheme='${0}'][data-tone='${0}'] {
3729
3714
  --input-fg-color: ${0};
3730
3715
  --input-placeholder-color: ${0};
3731
3716
 
@@ -3753,7 +3738,7 @@ function textInputBaseStyle(props) {
3753
3738
  --input-placeholder-color: ${0};
3754
3739
  }
3755
3740
  }
3756
- `), font.family, $weight && font.weights[$weight] || font.weights.regular, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
3741
+ `), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
3757
3742
  }
3758
3743
  function textInputFontSizeStyle(props) {
3759
3744
  const {
@@ -3776,6 +3761,7 @@ function textInputRepresentationStyle(props) {
3776
3761
  $border,
3777
3762
  $hasPrefix,
3778
3763
  $hasSuffix,
3764
+ $scheme,
3779
3765
  $tone,
3780
3766
  theme
3781
3767
  } = props;
@@ -3784,7 +3770,7 @@ function textInputRepresentationStyle(props) {
3784
3770
  input
3785
3771
  } = theme.sanity;
3786
3772
  const color = theme.sanity.color.input;
3787
- return css(_t3$d || (_t3$d = _$C`
3773
+ return css(_t3$e || (_t3$e = _$B`
3788
3774
  --input-box-shadow: none;
3789
3775
 
3790
3776
  position: absolute;
@@ -3804,7 +3790,7 @@ function textInputRepresentationStyle(props) {
3804
3790
  border-top-right-radius: ${0};
3805
3791
  border-bottom-right-radius: ${0};
3806
3792
 
3807
- &[data-tone='${0}'] {
3793
+ &[data-scheme='${0}'][data-tone='${0}'] {
3808
3794
  --card-bg-color: ${0};
3809
3795
  --card-fg-color: ${0};
3810
3796
 
@@ -3850,7 +3836,7 @@ function textInputRepresentationStyle(props) {
3850
3836
  }
3851
3837
  }
3852
3838
  }
3853
- `), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $tone, color.default.enabled.bg, color.default.enabled.fg, $border ? focusRingBorderStyle({
3839
+ `), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $scheme, $tone, color.default.enabled.bg, color.default.enabled.fg, $border ? focusRingBorderStyle({
3854
3840
  color: color.default.enabled.border,
3855
3841
  width: input.border.width
3856
3842
  }) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
@@ -3924,10 +3910,10 @@ function responsiveShadowStyle(props) {
3924
3910
  return _responsive(media, props.$shadow, shadow => shadowStyle(shadows[shadow]));
3925
3911
  }
3926
3912
 
3927
- let _$B = t => t,
3928
- _t$B,
3929
- _t2$l,
3930
- _t3$c;
3913
+ let _$A = t => t,
3914
+ _t$C,
3915
+ _t2$m,
3916
+ _t3$d;
3931
3917
  function textBaseStyle(props) {
3932
3918
  const {
3933
3919
  $accent,
@@ -3937,7 +3923,7 @@ function textBaseStyle(props) {
3937
3923
  const {
3938
3924
  weights
3939
3925
  } = theme.sanity.fonts.text;
3940
- return css(_t$B || (_t$B = _$B`
3926
+ return css(_t$C || (_t$C = _$A`
3941
3927
  color: var(--card-fg-color);
3942
3928
 
3943
3929
  ${0}
@@ -3979,19 +3965,19 @@ function textBaseStyle(props) {
3979
3965
  & [data-sanity-icon] {
3980
3966
  vertical-align: baseline;
3981
3967
  }
3982
- `), $accent && css(_t2$l || (_t2$l = _$B`
3968
+ `), $accent && css(_t2$m || (_t2$m = _$A`
3983
3969
  color: var(--card-accent-fg-color);
3984
- `)), $muted && css(_t3$c || (_t3$c = _$B`
3970
+ `)), $muted && css(_t3$d || (_t3$d = _$A`
3985
3971
  color: var(--card-muted-fg-color);
3986
3972
  `)), theme.sanity.fonts.code.family, weights.bold);
3987
3973
  }
3988
3974
 
3989
- const _excluded$H = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
3975
+ const _excluded$G = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
3990
3976
 
3991
- let _$A = t => t,
3992
- _t$A;
3977
+ let _$z = t => t,
3978
+ _t$B;
3993
3979
  const Root$E = styled.div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
3994
- const SpanWithTextOverflow$2 = styled.span(_t$A || (_t$A = _$A`
3980
+ const SpanWithTextOverflow$2 = styled.span(_t$B || (_t$B = _$z`
3995
3981
  display: block;
3996
3982
  white-space: nowrap;
3997
3983
  text-overflow: ellipsis;
@@ -4011,7 +3997,7 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
4011
3997
  textOverflow,
4012
3998
  weight
4013
3999
  } = props,
4014
- restProps = _objectWithoutPropertiesLoose(props, _excluded$H);
4000
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
4015
4001
 
4016
4002
  let children = childrenProp;
4017
4003
 
@@ -4182,7 +4168,7 @@ function avatarStrokeStyle() {
4182
4168
  };
4183
4169
  }
4184
4170
 
4185
- const _excluded$G = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
4171
+ const _excluded$F = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
4186
4172
  const Root$D = styled.div(responsiveAvatarSizeStyle, avatarStyle.root);
4187
4173
  const Arrow = styled.div(avatarStyle.arrow);
4188
4174
  const BgStroke = styled.ellipse(avatarStyle.bgStroke);
@@ -4205,7 +4191,7 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4205
4191
  status = 'online',
4206
4192
  size: sizeProp = 0
4207
4193
  } = props,
4208
- restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
4194
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4209
4195
 
4210
4196
  const as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
4211
4197
  const size = useArrayProp(sizeProp);
@@ -4295,8 +4281,8 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4295
4281
  }, /*#__PURE__*/React.createElement("strong", null, initials)))));
4296
4282
  });
4297
4283
 
4298
- let _$z = t => t,
4299
- _t$z;
4284
+ let _$y = t => t,
4285
+ _t$A;
4300
4286
 
4301
4287
  function _responsiveAvatarCounterSizeStyle(props) {
4302
4288
  const {
@@ -4321,7 +4307,7 @@ function _avatarCounterBaseStyle(props) {
4321
4307
  const {
4322
4308
  theme
4323
4309
  } = props;
4324
- return css(_t$z || (_t$z = _$z`
4310
+ return css(_t$A || (_t$A = _$y`
4325
4311
  align-items: center;
4326
4312
  justify-content: center;
4327
4313
  box-sizing: border-box;
@@ -4365,11 +4351,11 @@ function childrenToElementArray(children) {
4365
4351
  return childrenArray.filter(node => isElement(node) || isFragment(node) || typeof node === 'string');
4366
4352
  }
4367
4353
 
4368
- const _excluded$F = ["children", "maxLength", "size"];
4354
+ const _excluded$E = ["children", "maxLength", "size"];
4369
4355
 
4370
- let _$y = t => t,
4371
- _t$y;
4372
- const BASE_STYLES = css(_t$y || (_t$y = _$y`
4356
+ let _$x = t => t,
4357
+ _t$z;
4358
+ const BASE_STYLES = css(_t$z || (_t$z = _$x`
4373
4359
  white-space: nowrap;
4374
4360
 
4375
4361
  & > div {
@@ -4415,7 +4401,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4415
4401
  maxLength: maxLengthProp = 4,
4416
4402
  size: sizeProp = 0
4417
4403
  } = props,
4418
- restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4404
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4419
4405
 
4420
4406
  const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
4421
4407
  const maxLength = Math.max(maxLengthProp, 0);
@@ -4441,7 +4427,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4441
4427
  }))));
4442
4428
  });
4443
4429
 
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"];
4430
+ 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
4431
  const Root$A = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle);
4446
4432
  /**
4447
4433
  * @public
@@ -4476,7 +4462,7 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4476
4462
  rowEnd,
4477
4463
  sizing
4478
4464
  } = props,
4479
- restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4465
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4480
4466
 
4481
4467
  return /*#__PURE__*/React.createElement(Root$A, _extends({
4482
4468
  "data-as": typeof asProp === 'string' ? asProp : undefined,
@@ -4512,10 +4498,10 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4512
4498
  }), props.children);
4513
4499
  });
4514
4500
 
4515
- let _$x = t => t,
4516
- _t$x,
4517
- _t2$k,
4518
- _t3$b;
4501
+ let _$w = t => t,
4502
+ _t$y,
4503
+ _t2$l,
4504
+ _t3$c;
4519
4505
  function labelBaseStyle(props) {
4520
4506
  const {
4521
4507
  $accent,
@@ -4525,7 +4511,7 @@ function labelBaseStyle(props) {
4525
4511
  const {
4526
4512
  fonts
4527
4513
  } = theme.sanity;
4528
- return css(_t$x || (_t$x = _$x`
4514
+ return css(_t$y || (_t$y = _$w`
4529
4515
  text-transform: uppercase;
4530
4516
 
4531
4517
  ${0}
@@ -4545,19 +4531,19 @@ function labelBaseStyle(props) {
4545
4531
  & [data-sanity-icon] {
4546
4532
  vertical-align: baseline;
4547
4533
  }
4548
- `), $accent && css(_t2$k || (_t2$k = _$x`
4534
+ `), $accent && css(_t2$l || (_t2$l = _$w`
4549
4535
  color: var(--card-accent-fg-color);
4550
- `)), $muted && css(_t3$b || (_t3$b = _$x`
4536
+ `)), $muted && css(_t3$c || (_t3$c = _$w`
4551
4537
  color: var(--card-muted-fg-color);
4552
4538
  `)), fonts.code.family);
4553
4539
  }
4554
4540
 
4555
- const _excluded$D = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
4541
+ const _excluded$C = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
4556
4542
 
4557
- let _$w = t => t,
4558
- _t$w;
4543
+ let _$v = t => t,
4544
+ _t$x;
4559
4545
  const Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
4560
- const SpanWithTextOverflow$1 = styled.span(_t$w || (_t$w = _$w`
4546
+ const SpanWithTextOverflow$1 = styled.span(_t$x || (_t$x = _$v`
4561
4547
  display: block;
4562
4548
  white-space: nowrap;
4563
4549
  text-overflow: ellipsis;
@@ -4577,7 +4563,7 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
4577
4563
  textOverflow,
4578
4564
  weight
4579
4565
  } = props,
4580
- restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4566
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
4581
4567
 
4582
4568
  let children = childrenProp;
4583
4569
 
@@ -4618,7 +4604,7 @@ function badgeStyle(props) {
4618
4604
  };
4619
4605
  }
4620
4606
 
4621
- const _excluded$C = ["children", "fontSize", "mode", "padding", "radius", "tone"];
4607
+ const _excluded$B = ["children", "fontSize", "mode", "padding", "radius", "tone"];
4622
4608
  const Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
4623
4609
  /**
4624
4610
  * @public
@@ -4633,7 +4619,7 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4633
4619
  radius = 2,
4634
4620
  tone = 'default'
4635
4621
  } = props,
4636
- restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
4622
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
4637
4623
 
4638
4624
  return /*#__PURE__*/React.createElement(Root$y, _extends({
4639
4625
  "data-ui": "Badge"
@@ -4648,7 +4634,7 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4648
4634
  }, children));
4649
4635
  });
4650
4636
 
4651
- const _excluded$B = ["align", "as", "direction", "gap", "justify", "wrap"];
4637
+ const _excluded$A = ["align", "as", "direction", "gap", "justify", "wrap"];
4652
4638
  const Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
4653
4639
  /**
4654
4640
  * @public
@@ -4663,7 +4649,7 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4663
4649
  justify,
4664
4650
  wrap
4665
4651
  } = props,
4666
- restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
4652
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
4667
4653
 
4668
4654
  return /*#__PURE__*/React.createElement(Root$x, _extends({
4669
4655
  "data-ui": "Flex"
@@ -4678,10 +4664,10 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4678
4664
  }));
4679
4665
  });
4680
4666
 
4681
- let _$v = t => t,
4682
- _t$v,
4683
- _t2$j;
4684
- const rotate$1 = keyframes(_t$v || (_t$v = _$v`
4667
+ let _$u = t => t,
4668
+ _t$w,
4669
+ _t2$k;
4670
+ const rotate$1 = keyframes(_t$w || (_t$w = _$u`
4685
4671
  from {
4686
4672
  transform: rotate(0deg);
4687
4673
  }
@@ -4690,7 +4676,7 @@ const rotate$1 = keyframes(_t$v || (_t$v = _$v`
4690
4676
  transform: rotate(360deg);
4691
4677
  }
4692
4678
  `));
4693
- const Root$w = styled(Text)(_t2$j || (_t2$j = _$v`
4679
+ const Root$w = styled(Text)(_t2$k || (_t2$k = _$u`
4694
4680
  & > span > svg {
4695
4681
  animation: ${0} 500ms linear infinite;
4696
4682
  }
@@ -4740,14 +4726,14 @@ function _colorVarsStyle(base, color, checkered = false) {
4740
4726
  };
4741
4727
  }
4742
4728
 
4743
- let _$u = t => t,
4744
- _t$u;
4729
+ let _$t = t => t,
4730
+ _t$v;
4745
4731
  /**
4746
4732
  * @internal
4747
4733
  */
4748
4734
 
4749
4735
  function buttonBaseStyles() {
4750
- return css(_t$u || (_t$u = _$u`
4736
+ return css(_t$v || (_t$v = _$t`
4751
4737
  -webkit-font-smoothing: inherit;
4752
4738
  appearance: none;
4753
4739
  display: inline-flex;
@@ -4829,12 +4815,12 @@ function buttonColorStyles(props) {
4829
4815
  }, (_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
4816
  }
4831
4817
 
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"];
4818
+ 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
4819
 
4834
- let _$t = t => t,
4835
- _t$t;
4820
+ let _$s = t => t,
4821
+ _t$u;
4836
4822
  const Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
4837
- const LoadingBox = styled.div(_t$t || (_t$t = _$t`
4823
+ const LoadingBox = styled.div(_t$u || (_t$u = _$s`
4838
4824
  position: absolute;
4839
4825
  top: 0;
4840
4826
  left: 0;
@@ -4877,7 +4863,7 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4877
4863
  tone = 'default',
4878
4864
  type = 'button'
4879
4865
  } = props,
4880
- restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
4866
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
4881
4867
 
4882
4868
  const justify = useArrayProp(justifyProp);
4883
4869
  const padding = useArrayProp(paddingProp);
@@ -4934,10 +4920,10 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4934
4920
  }, boxProps), children));
4935
4921
  });
4936
4922
 
4937
- let _$s = t => t,
4938
- _t$s,
4939
- _t2$i,
4940
- _t3$a;
4923
+ let _$r = t => t,
4924
+ _t$t,
4925
+ _t2$j,
4926
+ _t3$b;
4941
4927
  function cardStyle(props) {
4942
4928
  return [cardBaseStyle(props), cardColorStyle(props)];
4943
4929
  }
@@ -4947,7 +4933,7 @@ function cardBaseStyle(props) {
4947
4933
  theme
4948
4934
  } = props;
4949
4935
  const space = theme.sanity.space;
4950
- return css(_t$s || (_t$s = _$s`
4936
+ return css(_t$t || (_t$t = _$r`
4951
4937
  ${0}
4952
4938
 
4953
4939
  &[data-as='button'] {
@@ -4970,7 +4956,7 @@ function cardBaseStyle(props) {
4970
4956
  &[data-as='pre'] {
4971
4957
  font: inherit;
4972
4958
  }
4973
- `), $checkered && css(_t2$i || (_t2$i = _$s`
4959
+ `), $checkered && css(_t2$j || (_t2$j = _$r`
4974
4960
  background-size: ${0}px ${0}px;
4975
4961
  background-position: 50% 50%;
4976
4962
  background-image: var(--card-bg-image);
@@ -4995,7 +4981,7 @@ function cardColorStyle(props) {
4995
4981
  width: 0,
4996
4982
  color: 'var(--card-border-color)'
4997
4983
  };
4998
- return css(_t3$a || (_t3$a = _$s`
4984
+ return css(_t3$b || (_t3$b = _$r`
4999
4985
  ${0}
5000
4986
 
5001
4987
  background-color: var(--card-bg-color);
@@ -5095,7 +5081,7 @@ function cardColorStyle(props) {
5095
5081
  }) : 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
5082
  }
5097
5083
 
5098
- const _excluded$z = ["__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "pressed", "radius", "scheme", "selected", "shadow", "tone"];
5084
+ const _excluded$y = ["__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "pressed", "radius", "scheme", "selected", "shadow", "tone"];
5099
5085
  const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
5100
5086
  /**
5101
5087
  * @public
@@ -5118,7 +5104,7 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
5118
5104
  shadow,
5119
5105
  tone: toneProp = 'default'
5120
5106
  } = props,
5121
- restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
5107
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$y);
5122
5108
 
5123
5109
  const as = isValidElementType(asProp) ? asProp : 'div';
5124
5110
  const rootTheme = useRootTheme();
@@ -5151,11 +5137,11 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
5151
5137
  })));
5152
5138
  });
5153
5139
 
5154
- let _$r = t => t,
5155
- _t$r,
5156
- _t2$h;
5140
+ let _$q = t => t,
5141
+ _t$s,
5142
+ _t2$i;
5157
5143
  function checkboxBaseStyles() {
5158
- return css(_t$r || (_t$r = _$r`
5144
+ return css(_t$s || (_t$s = _$q`
5159
5145
  position: relative;
5160
5146
  display: inline-block;
5161
5147
  `));
@@ -5170,7 +5156,7 @@ function inputElementStyles(props) {
5170
5156
  input,
5171
5157
  radius
5172
5158
  } = theme.sanity;
5173
- return css(_t2$h || (_t2$h = _$r`
5159
+ return css(_t2$i || (_t2$i = _$q`
5174
5160
  position: absolute;
5175
5161
  top: 0;
5176
5162
  left: 0;
@@ -5255,7 +5241,7 @@ function inputElementStyles(props) {
5255
5241
  }), color.default.disabled.fg);
5256
5242
  }
5257
5243
 
5258
- const _excluded$y = ["checked", "className", "disabled", "indeterminate", "customValidity", "readOnly", "style"];
5244
+ const _excluded$x = ["checked", "className", "disabled", "indeterminate", "customValidity", "readOnly", "style"];
5259
5245
  const Root$t = styled.div(checkboxBaseStyles);
5260
5246
  const Input$5 = styled.input(inputElementStyles);
5261
5247
  /**
@@ -5272,7 +5258,7 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef)
5272
5258
  readOnly,
5273
5259
  style
5274
5260
  } = props,
5275
- restProps = _objectWithoutPropertiesLoose(props, _excluded$y);
5261
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$x);
5276
5262
 
5277
5263
  const ref = useForwardedRef(forwardedRef);
5278
5264
  useCustomValidity(ref, customValidity);
@@ -5297,8 +5283,8 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef)
5297
5283
  })), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CheckmarkIcon, null), /*#__PURE__*/React.createElement(RemoveIcon, null)));
5298
5284
  });
5299
5285
 
5300
- let _$q = t => t,
5301
- _t$q;
5286
+ let _$p = t => t,
5287
+ _t$r;
5302
5288
 
5303
5289
  function codeSyntaxHighlightingStyle({
5304
5290
  theme
@@ -5417,7 +5403,7 @@ function codeSyntaxHighlightingStyle({
5417
5403
  }
5418
5404
 
5419
5405
  function codeBaseStyle() {
5420
- return css(_t$q || (_t$q = _$q`
5406
+ return css(_t$r || (_t$r = _$p`
5421
5407
  color: var(--card-code-fg-color);
5422
5408
 
5423
5409
  & code {
@@ -5440,7 +5426,7 @@ function codeBaseStyle() {
5440
5426
  `), codeSyntaxHighlightingStyle);
5441
5427
  }
5442
5428
 
5443
- const _excluded$x = ["children", "language", "size", "weight"];
5429
+ const _excluded$w = ["children", "language", "size", "weight"];
5444
5430
  const Root$s = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
5445
5431
  /**
5446
5432
  * @public
@@ -5453,7 +5439,7 @@ const Code = /*#__PURE__*/forwardRef(function Code(props, ref) {
5453
5439
  size = 2,
5454
5440
  weight
5455
5441
  } = props,
5456
- restProps = _objectWithoutPropertiesLoose(props, _excluded$x);
5442
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$w);
5457
5443
 
5458
5444
  const language = typeof languageProp === 'string' ? languageProp : undefined;
5459
5445
  const registered = language ? Refractor.hasLanguage(language) : false;
@@ -5490,7 +5476,7 @@ function responsiveContainerWidthStyle(props) {
5490
5476
  }));
5491
5477
  }
5492
5478
 
5493
- const _excluded$w = ["as", "width"];
5479
+ const _excluded$v = ["as", "width"];
5494
5480
  const Root$r = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
5495
5481
  /**
5496
5482
  * @public
@@ -5501,7 +5487,7 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
5501
5487
  as,
5502
5488
  width = 2
5503
5489
  } = props,
5504
- restProps = _objectWithoutPropertiesLoose(props, _excluded$w);
5490
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$v);
5505
5491
 
5506
5492
  return /*#__PURE__*/React.createElement(Root$r, _extends({
5507
5493
  "data-ui": "Container"
@@ -5512,7 +5498,7 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
5512
5498
  }));
5513
5499
  });
5514
5500
 
5515
- const _excluded$v = ["as", "autoRows", "autoCols", "autoFlow", "columns", "gap", "gapX", "gapY", "rows", "children"];
5501
+ const _excluded$u = ["as", "autoRows", "autoCols", "autoFlow", "columns", "gap", "gapX", "gapY", "rows", "children"];
5516
5502
  const Root$q = styled(Box)(responsiveGridStyle);
5517
5503
  /**
5518
5504
  * @public
@@ -5531,7 +5517,7 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
5531
5517
  rows,
5532
5518
  children
5533
5519
  } = props,
5534
- restProps = _objectWithoutPropertiesLoose(props, _excluded$v);
5520
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$u);
5535
5521
 
5536
5522
  return /*#__PURE__*/React.createElement(Root$q, _extends({
5537
5523
  "data-as": typeof as === 'string' ? as : undefined,
@@ -5550,17 +5536,17 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
5550
5536
  }), children);
5551
5537
  });
5552
5538
 
5553
- let _$p = t => t,
5554
- _t$p,
5555
- _t2$g,
5556
- _t3$9;
5539
+ let _$o = t => t,
5540
+ _t$q,
5541
+ _t2$h,
5542
+ _t3$a;
5557
5543
  function headingBaseStyle(props) {
5558
5544
  const {
5559
5545
  $accent,
5560
5546
  $muted,
5561
5547
  theme
5562
5548
  } = props;
5563
- return css(_t$p || (_t$p = _$p`
5549
+ return css(_t$q || (_t$q = _$o`
5564
5550
  ${0}
5565
5551
 
5566
5552
  ${0}
@@ -5594,19 +5580,19 @@ function headingBaseStyle(props) {
5594
5580
  & [data-sanity-icon] {
5595
5581
  vertical-align: baseline;
5596
5582
  }
5597
- `), $accent && css(_t2$g || (_t2$g = _$p`
5583
+ `), $accent && css(_t2$h || (_t2$h = _$o`
5598
5584
  color: var(--card-accent-fg-color);
5599
- `)), $muted && css(_t3$9 || (_t3$9 = _$p`
5585
+ `)), $muted && css(_t3$a || (_t3$a = _$o`
5600
5586
  color: var(--card-muted-fg-color);
5601
5587
  `)), theme.sanity.fonts.code.family);
5602
5588
  }
5603
5589
 
5604
- const _excluded$u = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
5590
+ const _excluded$t = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
5605
5591
 
5606
- let _$o = t => t,
5607
- _t$o;
5592
+ let _$n = t => t,
5593
+ _t$p;
5608
5594
  const Root$p = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
5609
- const SpanWithTextOverflow = styled.span(_t$o || (_t$o = _$o`
5595
+ const SpanWithTextOverflow = styled.span(_t$p || (_t$p = _$n`
5610
5596
  display: block;
5611
5597
  white-space: nowrap;
5612
5598
  text-overflow: ellipsis;
@@ -5626,7 +5612,7 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
5626
5612
  textOverflow,
5627
5613
  weight
5628
5614
  } = props,
5629
- restProps = _objectWithoutPropertiesLoose(props, _excluded$u);
5615
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$t);
5630
5616
 
5631
5617
  let children = childrenProp;
5632
5618
 
@@ -5673,7 +5659,7 @@ function inlineSpaceStyle(props) {
5673
5659
  });
5674
5660
  }
5675
5661
 
5676
- const _excluded$t = ["as", "children", "space"];
5662
+ const _excluded$s = ["as", "children", "space"];
5677
5663
  const Root$o = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
5678
5664
  /**
5679
5665
  * @public
@@ -5685,7 +5671,7 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
5685
5671
  children: childrenProp,
5686
5672
  space
5687
5673
  } = props,
5688
- restProps = _objectWithoutPropertiesLoose(props, _excluded$t);
5674
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
5689
5675
 
5690
5676
  const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /*#__PURE__*/React.createElement("div", {
5691
5677
  key: idx
@@ -5699,13 +5685,13 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
5699
5685
  }), children);
5700
5686
  });
5701
5687
 
5702
- const _excluded$s = ["children", "fontSize", "padding", "radius"];
5688
+ const _excluded$r = ["children", "fontSize", "padding", "radius"];
5703
5689
 
5704
- let _$n = t => t,
5705
- _t$n;
5690
+ let _$m = t => t,
5691
+ _t$o;
5706
5692
 
5707
5693
  function kbdStyle() {
5708
- return css(_t$n || (_t$n = _$n`
5694
+ return css(_t$o || (_t$o = _$m`
5709
5695
  background: var(--card-bg-color);
5710
5696
  font: inherit;
5711
5697
  box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);
@@ -5728,7 +5714,7 @@ const KBD = /*#__PURE__*/forwardRef(function KBD(props, ref) {
5728
5714
  padding = 1,
5729
5715
  radius = 2
5730
5716
  } = props,
5731
- restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
5717
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$r);
5732
5718
 
5733
5719
  return /*#__PURE__*/React.createElement(Root$n, _extends({
5734
5720
  "data-ui": "KBD"
@@ -5814,7 +5800,7 @@ function findMinBreakpoints(media, width) {
5814
5800
  return ret;
5815
5801
  }
5816
5802
 
5817
- const _excluded$r = ["children", "media"];
5803
+ const _excluded$q = ["children", "media"];
5818
5804
  /**
5819
5805
  * DO NOT USE IN PRODUCTION.
5820
5806
  * @beta
@@ -5827,7 +5813,7 @@ const ElementQuery = /*#__PURE__*/forwardRef(function ElementQuery(props, ref) {
5827
5813
  children,
5828
5814
  media = theme.sanity.media
5829
5815
  } = props,
5830
- restProps = _objectWithoutPropertiesLoose(props, _excluded$r);
5816
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
5831
5817
 
5832
5818
  const forwardedRef = useForwardedRef(ref);
5833
5819
  const [element, setElement] = useState(null);
@@ -5955,12 +5941,12 @@ function LayerProvider(props) {
5955
5941
  }, children);
5956
5942
  }
5957
5943
 
5958
- const _excluded$q = ["children", "style"],
5944
+ const _excluded$p = ["children", "style"],
5959
5945
  _excluded2$1 = ["children", "zOffset"];
5960
5946
 
5961
- let _$m = t => t,
5962
- _t$m;
5963
- const Root$m = styled.div(_t$m || (_t$m = _$m`
5947
+ let _$l = t => t,
5948
+ _t$n;
5949
+ const Root$m = styled.div(_t$n || (_t$n = _$l`
5964
5950
  position: relative;
5965
5951
  `));
5966
5952
  const LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref) {
@@ -5968,7 +5954,7 @@ const LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref)
5968
5954
  children,
5969
5955
  style = EMPTY_RECORD
5970
5956
  } = props,
5971
- restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
5957
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$p);
5972
5958
 
5973
5959
  const {
5974
5960
  zIndex
@@ -6119,9 +6105,9 @@ function PortalProvider(props) {
6119
6105
  }, children);
6120
6106
  }
6121
6107
 
6122
- let _$l = t => t,
6123
- _t$l;
6124
- const Root$l = styled.div(_t$l || (_t$l = _$l`
6108
+ let _$k = t => t,
6109
+ _t$m;
6110
+ const Root$l = styled.div(_t$m || (_t$m = _$k`
6125
6111
  display: block;
6126
6112
  width: 0;
6127
6113
  height: 0;
@@ -6311,15 +6297,15 @@ function _isScrollable(el) {
6311
6297
  return style.overflowX.includes('auto') || style.overflowX.includes('scroll') || style.overflowY.includes('auto') || style.overflowY.includes('scroll');
6312
6298
  }
6313
6299
 
6314
- const _excluded$p = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
6300
+ const _excluded$o = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
6315
6301
 
6316
- let _$k = t => t,
6317
- _t$k,
6318
- _t2$f;
6319
- const Root$k = styled.div(_t$k || (_t$k = _$k`
6302
+ let _$j = t => t,
6303
+ _t$l,
6304
+ _t2$g;
6305
+ const Root$k = styled.div(_t$l || (_t$l = _$j`
6320
6306
  position: relative;
6321
6307
  `));
6322
- const ItemWrapper = styled.div(_t2$f || (_t2$f = _$k`
6308
+ const ItemWrapper = styled.div(_t2$g || (_t2$g = _$j`
6323
6309
  position: absolute;
6324
6310
  left: 0;
6325
6311
  right: 0;
@@ -6337,7 +6323,7 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
6337
6323
  onChange,
6338
6324
  renderItem
6339
6325
  } = props,
6340
- restProps = _objectWithoutPropertiesLoose(props, _excluded$p);
6326
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$o);
6341
6327
 
6342
6328
  const {
6343
6329
  space
@@ -6456,11 +6442,11 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
6456
6442
  }, children));
6457
6443
  });
6458
6444
 
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`
6445
+ let _$i = t => t,
6446
+ _t$k,
6447
+ _t2$f,
6448
+ _t3$9;
6449
+ const Root$j = styled.div(_t$k || (_t$k = _$i`
6464
6450
  position: absolute;
6465
6451
  pointer-events: none;
6466
6452
  width: 27px;
@@ -6476,11 +6462,11 @@ const Root$j = styled.div(_t$j || (_t$j = _$j`
6476
6462
  transform-origin: 13.5px 13.5px;
6477
6463
  }
6478
6464
 
6479
- [data-placement^='top'] > & {
6465
+ [data-popper-placement^='top'] > div > & {
6480
6466
  bottom: -27px;
6481
6467
  }
6482
6468
 
6483
- [data-placement^='right'] > & {
6469
+ [data-popper-placement^='right'] > div > & {
6484
6470
  left: -27px;
6485
6471
 
6486
6472
  & > svg {
@@ -6488,7 +6474,7 @@ const Root$j = styled.div(_t$j || (_t$j = _$j`
6488
6474
  }
6489
6475
  }
6490
6476
 
6491
- [data-placement^='left'] > & {
6477
+ [data-popper-placement^='left'] > div > & {
6492
6478
  right: -27px;
6493
6479
 
6494
6480
  & > svg {
@@ -6496,7 +6482,7 @@ const Root$j = styled.div(_t$j || (_t$j = _$j`
6496
6482
  }
6497
6483
  }
6498
6484
 
6499
- [data-placement^='bottom'] > & {
6485
+ [data-popper-placement^='bottom'] > div > & {
6500
6486
  top: -27px;
6501
6487
 
6502
6488
  & > svg {
@@ -6504,15 +6490,15 @@ const Root$j = styled.div(_t$j || (_t$j = _$j`
6504
6490
  }
6505
6491
  }
6506
6492
  `));
6507
- const BorderPath = styled.path(_t2$e || (_t2$e = _$j`
6493
+ const BorderPath = styled.path(_t2$f || (_t2$f = _$i`
6508
6494
  fill: var(--card-shadow-outline-color);
6509
6495
  `));
6510
- const ShapePath = styled.path(_t3$8 || (_t3$8 = _$j`
6496
+ const ShapePath = styled.path(_t3$9 || (_t3$9 = _$i`
6511
6497
  fill: var(--card-bg-color);
6512
6498
  `));
6513
6499
  const PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
6514
6500
  return /*#__PURE__*/React.createElement(Root$j, _extends({
6515
- "data-ui": "Popover__arrow"
6501
+ "data-ui": "PopoverArrow"
6516
6502
  }, props, {
6517
6503
  ref: ref
6518
6504
  }), /*#__PURE__*/React.createElement("svg", {
@@ -6528,294 +6514,362 @@ const PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
6528
6514
  })));
6529
6515
  });
6530
6516
 
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"];
6517
+ /*
6518
+
6519
+ The order of popper phases:
6532
6520
 
6533
- function popoverCardStyle(props) {
6521
+ - beforeRead
6522
+ - read
6523
+ - afterRead
6524
+ - beforeMain
6525
+ - main
6526
+ - afterMain
6527
+ - beforeWrite
6528
+ - write
6529
+ - afterWrite
6530
+
6531
+ */
6532
+
6533
+ function getPopoverModifiers(props) {
6534
6534
  const {
6535
- $boundaryWidth
6536
- } = props;
6537
- return {
6538
- maxWidth: $boundaryWidth ? `${$boundaryWidth - 16}px` : 'calc(100% - 16px)'
6535
+ allowedAutoPlacements,
6536
+ arrow,
6537
+ arrowElement,
6538
+ boundaryElement,
6539
+ constrainSize,
6540
+ distance,
6541
+ fallbackPlacements,
6542
+ margins,
6543
+ matchReferenceWidth,
6544
+ open,
6545
+ preventOverflow,
6546
+ skidding,
6547
+ tether,
6548
+ tetherOffset
6549
+ } = props; // NOTE: For later viewers:
6550
+ // Prior to adding this change, the popover would get `maxWidth: 0` the 2nd time it
6551
+ // was opened, when used with `constrainSize`. I was looking for a way to "reset"
6552
+ // the size of the popover as measured by Popper.js, and this seems to be a workaround.
6553
+
6554
+ if (!open) {
6555
+ return [];
6556
+ }
6557
+
6558
+ const detectOverflowOptions = {
6559
+ altAxis: !constrainSize,
6560
+ boundary: boundaryElement || undefined,
6561
+ padding: 8,
6562
+ tether,
6563
+ tetherOffset
6539
6564
  };
6540
- }
6565
+ return [constrainSize && _extends({}, maxSizeModifier, {
6566
+ options: detectOverflowOptions
6567
+ }), constrainSize && {
6568
+ name: 'applyMaxSize',
6569
+ enabled: true,
6570
+ phase: 'beforeWrite',
6571
+ requires: ['maxSize'],
6572
+
6573
+ fn({
6574
+ state
6575
+ }) {
6576
+ const {
6577
+ width,
6578
+ height
6579
+ } = state.modifiersData.maxSize;
6580
+ state.styles.popper = _extends({}, state.styles.popper, {
6581
+ maxWidth: `${width}px`,
6582
+ maxHeight: `${height}px`
6583
+ });
6584
+ }
6541
6585
 
6542
- const Root$i = /*#__PURE__*/memo(styled(Card)(popoverCardStyle));
6543
- /**
6544
- * @internal
6545
- */
6586
+ }, arrow && {
6587
+ name: 'arrow',
6588
+ options: {
6589
+ element: arrowElement,
6590
+ padding: 4
6591
+ }
6592
+ }, (constrainSize || preventOverflow) && {
6593
+ name: 'preventOverflow',
6594
+ options: detectOverflowOptions
6595
+ }, {
6596
+ name: 'offset',
6597
+ options: {
6598
+ offset: [skidding, distance]
6599
+ }
6600
+ }, margins && {
6601
+ name: 'margins',
6602
+ enabled: true,
6603
+ phase: 'beforeRead',
6604
+ fn: ({
6605
+ state
6606
+ }) => {
6607
+ const {
6608
+ rects
6609
+ } = state;
6610
+
6611
+ if (rects.reference) {
6612
+ rects.reference.x += margins[3];
6613
+ rects.reference.y += margins[1];
6614
+ rects.reference.width -= margins[1] + margins[3];
6615
+ rects.reference.height -= margins[0] + margins[2];
6616
+ }
6617
+ }
6618
+ }, {
6619
+ name: 'flip',
6620
+ options: {
6621
+ allowedAutoPlacements,
6622
+ boundary: boundaryElement || undefined,
6623
+ fallbackPlacements,
6624
+ padding: 8
6625
+ }
6626
+ }, matchReferenceWidth && {
6627
+ name: 'matchWidth',
6628
+ enabled: true,
6629
+ phase: 'beforeWrite',
6630
+ requires: ['computeStyles'],
6631
+
6632
+ fn({
6633
+ state
6634
+ }) {
6635
+ const {
6636
+ width
6637
+ } = state.rects.reference;
6638
+ state.styles.popper.width = `${width}px`;
6639
+ },
6640
+
6641
+ effect: ({
6642
+ state
6643
+ }) => {
6644
+ const refElement = state.elements.reference;
6645
+
6646
+ if (refElement instanceof HTMLElement) {
6647
+ state.elements.popper.style.width = `${refElement.offsetWidth - (margins ? margins[1] + margins[3] : 0)}px`;
6648
+ }
6649
+ }
6650
+ }].filter(Boolean);
6651
+ }
6546
6652
 
6547
- const PopoverCard = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function PopoverCard(props, ref) {
6653
+ function usePopoverModifiers(props) {
6548
6654
  const {
6549
- __unstable_margins: marginsProp,
6655
+ allowedAutoPlacements,
6550
6656
  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);
6657
+ arrowElement,
6658
+ boundaryElement,
6659
+ constrainSize,
6660
+ distance,
6661
+ fallbackPlacements,
6662
+ margins,
6663
+ matchReferenceWidth,
6664
+ open,
6665
+ preventOverflow,
6666
+ skidding,
6667
+ tether,
6668
+ tetherOffset
6669
+ } = props;
6670
+ return useMemo(() => {
6671
+ return getPopoverModifiers({
6672
+ allowedAutoPlacements,
6673
+ arrow,
6674
+ arrowElement,
6675
+ boundaryElement,
6676
+ constrainSize,
6677
+ distance,
6678
+ fallbackPlacements,
6679
+ margins,
6680
+ matchReferenceWidth,
6681
+ open,
6682
+ preventOverflow,
6683
+ skidding,
6684
+ tether,
6685
+ tetherOffset
6686
+ });
6687
+ }, [allowedAutoPlacements, arrow, arrowElement, boundaryElement, constrainSize, distance, fallbackPlacements, margins, matchReferenceWidth, open, preventOverflow, skidding, tether, tetherOffset]);
6688
+ }
6572
6689
 
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';
6690
+ 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
6691
 
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"];
6692
+ let _2$1 = t => t,
6693
+ _t$j,
6694
+ _t2$e,
6695
+ _t3$8;
6696
+ const Root$i = styled(Layer)(({
6697
+ $preventOverflow
6698
+ }) => css(_t$j || (_t$j = _2$1`
6699
+ pointer-events: none;
6700
+ display: flex;
6701
+ flex-direction: column;
6702
+ max-width: calc(100% - 16px);
6631
6703
 
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
- }
6704
+ & > * {
6705
+ min-height: 0;
6706
+ }
6639
6707
 
6640
- if (scope.matchReferenceWidth) {
6641
- scope.setReferenceWidth(args.rects.reference.width);
6708
+ /* Hide the popover when the reference element is out of bounds */
6709
+ ${0}
6710
+ `), $preventOverflow && css(_t2$e || (_t2$e = _2$1`
6711
+ &[data-popper-reference-hidden='true'] {
6712
+ display: none;
6642
6713
  }
6643
- },
6714
+ `))));
6715
+ const PopoverCard = styled(Card)(({
6716
+ $constrainSize
6717
+ }) => css(_t3$8 || (_t3$8 = _2$1`
6718
+ flex: 1;
6719
+ max-height: ${0};
6720
+ pointer-events: all;
6721
+
6722
+ && {
6723
+ display: flex;
6724
+ }
6644
6725
 
6645
- boundary: scope.boundaryElement || undefined
6646
- });
6647
- }
6726
+ flex-direction: column;
6648
6727
 
6649
- const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Popover(props, ref) {
6650
- var _theme$sanity$layer, _useElementSize, _middlewareData$arrow, _middlewareData$arrow2;
6728
+ & > * {
6729
+ min-height: 0;
6730
+ }
6731
+
6732
+ ${0}
6733
+ `), $constrainSize && '100%', responsiveContainerWidthStyle));
6734
+ /**
6735
+ * @public
6736
+ */
6737
+
6738
+ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6739
+ var _theme$sanity$layer;
6651
6740
 
6652
- const theme = useTheme();
6653
6741
  const boundaryElementContext = useBoundaryElement();
6742
+ const theme = useTheme();
6654
6743
 
6655
6744
  const {
6656
6745
  __unstable_margins: margins,
6657
- arrow: arrowProp = true,
6658
- boundaryElement = boundaryElementContext.element,
6659
- children: childProp,
6660
- constrainSize = false,
6746
+ allowedAutoPlacements,
6747
+ arrow = true,
6748
+ boundaryElement: boundaryElementProp = boundaryElementContext.element,
6749
+ children: child,
6661
6750
  content,
6751
+ constrainSize,
6662
6752
  disabled,
6663
6753
  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,
6754
+ open = false,
6755
+ padding,
6756
+ placement = 'bottom',
6757
+ portal: portalProp = false,
6758
+ preventOverflow,
6759
+ radius = 3,
6760
+ referenceElement: referenceElementProp,
6761
+ matchReferenceWidth,
6762
+ shadow = 3,
6673
6763
  scheme,
6674
- shadow: shadowProp = 3,
6764
+ style = EMPTY_RECORD,
6765
+ tether,
6766
+ tetherOffset,
6675
6767
  tone = 'inherit',
6676
- width: widthProp = undefined,
6677
- zOffset: zOffsetProp = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
6768
+ width: widthProp = 0,
6769
+ zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
6678
6770
  } = props,
6679
6771
  restProps = _objectWithoutPropertiesLoose(props, _excluded$n);
6680
6772
 
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
6773
  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,
6774
+ const portal = usePortal();
6775
+ const [referenceElement, setReferenceElement] = useState(null);
6776
+ const [popperElement, setPopperElement] = useState(null);
6777
+ const [arrowElement, setArrowElement] = useState(null);
6778
+ const popperReferenceElement = referenceElementProp || referenceElement;
6779
+ const width = useArrayProp(matchReferenceWidth ? 'auto' : widthProp);
6780
+ const modifiers = usePopoverModifiers({
6781
+ allowedAutoPlacements,
6782
+ arrow,
6783
+ arrowElement,
6784
+ boundaryElement: boundaryElementProp || portal.boundaryElement,
6785
+ constrainSize,
6786
+ distance: arrow ? 4 : 0,
6787
+ fallbackPlacements,
6788
+ margins,
6789
+ matchReferenceWidth,
6790
+ open,
6791
+ preventOverflow,
6792
+ skidding: 0,
6793
+ tether,
6794
+ tetherOffset
6795
+ });
6796
+ const popper = usePopper(popperReferenceElement, popperElement, {
6740
6797
  placement,
6741
- reference,
6742
- floating,
6743
- middlewareData,
6744
- strategy
6745
- } = useFloating({
6746
- middleware,
6747
- placement: placementProp,
6748
- whileElementsMounted: autoUpdate
6798
+ modifiers
6749
6799
  });
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;
6800
+ const {
6801
+ attributes,
6802
+ forceUpdate,
6803
+ styles
6804
+ } = popper;
6805
+ const setRef = useCallback(el => {
6806
+ const childRef = child.ref;
6807
+ setReferenceElement(el);
6762
6808
 
6763
6809
  if (typeof childRef === 'function') {
6764
- childRef(node);
6810
+ childRef(el);
6765
6811
  } else if (childRef) {
6766
- childRef.current = node;
6812
+ childRef.current = el;
6767
6813
  }
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]);
6814
+ }, [child]);
6815
+ const setRootRef = useCallback(el => {
6816
+ setPopperElement(el);
6817
+ forwardedRef.current = el;
6818
+ }, [forwardedRef]);
6819
+ const popoverStyle = useMemo(() => _extends({}, style, styles.popper), [style, styles]);
6820
+ const updateTimeoutRef = useRef(null);
6775
6821
  useEffect(() => {
6776
- if (referenceElement) reference(referenceElement);
6777
- }, [reference, referenceElement]);
6822
+ if (updateTimeoutRef.current) {
6823
+ clearTimeout(updateTimeoutRef.current);
6824
+ updateTimeoutRef.current = null;
6825
+ }
6826
+
6827
+ updateTimeoutRef.current = setTimeout(() => {
6828
+ if (forceUpdate) {
6829
+ try {
6830
+ forceUpdate();
6831
+ } catch (_) {// ignore caught error
6832
+ }
6833
+ }
6834
+ }, 0);
6835
+ }, [content, forceUpdate, open, popperReferenceElement]);
6778
6836
 
6779
6837
  if (disabled) {
6780
- return childProp || /*#__PURE__*/React.createElement(React.Fragment, null);
6838
+ return child || /*#__PURE__*/React.createElement(React.Fragment, null);
6781
6839
  }
6782
6840
 
6783
- const popover = /*#__PURE__*/React.createElement(LayerProvider, {
6841
+ const node = /*#__PURE__*/React.createElement(Root$i, _extends({
6842
+ "data-ui": "Popover"
6843
+ }, restProps, {
6844
+ "$preventOverflow": preventOverflow,
6845
+ ref: setRootRef,
6846
+ style: popoverStyle,
6784
6847
  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,
6848
+ }, attributes.popper), /*#__PURE__*/React.createElement(PopoverCard, {
6849
+ "$constrainSize": constrainSize,
6850
+ "$width": width,
6851
+ "data-ui": "PopoverCard",
6795
6852
  padding: padding,
6796
- placement: placement,
6797
6853
  radius: radius,
6798
- ref: setFloating,
6799
- referenceWidth: matchReferenceWidthProp ? referenceWidth : undefined,
6800
6854
  scheme: scheme,
6801
6855
  shadow: shadow,
6802
- strategy: strategy,
6803
- tone: tone,
6804
- x: x,
6805
- y: y,
6806
- width: width
6856
+ tone: tone
6857
+ }, arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
6858
+ ref: setArrowElement,
6859
+ style: styles.arrow
6807
6860
  }), 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';
6861
+ return /*#__PURE__*/React.createElement(React.Fragment, null, child && !referenceElementProp ? /*#__PURE__*/cloneElement(child, {
6862
+ ref: setRef
6863
+ }) : child || /*#__PURE__*/React.createElement(React.Fragment, null), open && /*#__PURE__*/React.createElement(React.Fragment, null, portalProp && /*#__PURE__*/React.createElement(Portal, {
6864
+ __unstable_name: typeof portalProp === 'string' ? portalProp : undefined
6865
+ }, node), !portalProp && node));
6866
+ });
6813
6867
 
6814
- let _$i = t => t,
6868
+ let _$h = t => t,
6815
6869
  _t$i,
6816
6870
  _t2$d;
6817
6871
  function radioBaseStyle() {
6818
- return css(_t$i || (_t$i = _$i`
6872
+ return css(_t$i || (_t$i = _$h`
6819
6873
  position: relative;
6820
6874
 
6821
6875
  &:not([hidden]) {
@@ -6837,7 +6891,7 @@ function inputElementStyle(props) {
6837
6891
  } = theme.sanity;
6838
6892
  const color = theme.sanity.color.input;
6839
6893
  const dist = (input.radio.size - input.radio.markSize) / 2;
6840
- return css(_t2$d || (_t2$d = _$i`
6894
+ return css(_t2$d || (_t2$d = _$h`
6841
6895
  appearance: none;
6842
6896
  position: absolute;
6843
6897
  top: 0;
@@ -6955,14 +7009,14 @@ const Radio = /*#__PURE__*/forwardRef(function Radio(props, forwardedRef) {
6955
7009
  })), /*#__PURE__*/React.createElement("span", null));
6956
7010
  });
6957
7011
 
6958
- let _$h = t => t,
7012
+ let _$g = t => t,
6959
7013
  _t$h,
6960
7014
  _t2$c,
6961
7015
  _t3$7,
6962
7016
  _t4$5;
6963
7017
 
6964
7018
  function rootStyle() {
6965
- return css(_t$h || (_t$h = _$h`
7019
+ return css(_t$h || (_t$h = _$g`
6966
7020
  position: relative;
6967
7021
  width: stretch;
6968
7022
 
@@ -6977,7 +7031,7 @@ function inputBaseStyle(props) {
6977
7031
  theme
6978
7032
  } = props;
6979
7033
  const font = theme.sanity.fonts.text;
6980
- return css(_t2$c || (_t2$c = _$h`
7034
+ return css(_t2$c || (_t2$c = _$g`
6981
7035
  -webkit-font-smoothing: antialiased;
6982
7036
  appearance: none;
6983
7037
  border: 0;
@@ -7002,7 +7056,7 @@ function inputColorStyle(props) {
7002
7056
  input
7003
7057
  } = theme.sanity;
7004
7058
  const color = theme.sanity.color.input;
7005
- return css(_t3$7 || (_t3$7 = _$h`
7059
+ return css(_t3$7 || (_t3$7 = _$g`
7006
7060
  /* enabled */
7007
7061
  background-color: ${0};
7008
7062
  color: ${0};
@@ -7083,7 +7137,7 @@ function iconBoxStyle(props) {
7083
7137
  theme
7084
7138
  } = props;
7085
7139
  const color = theme.sanity.color.input;
7086
- return css(_t4$5 || (_t4$5 = _$h`
7140
+ return css(_t4$5 || (_t4$5 = _$g`
7087
7141
  pointer-events: none;
7088
7142
  position: absolute;
7089
7143
  top: 0;
@@ -7208,7 +7262,7 @@ const Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
7208
7262
  }));
7209
7263
  });
7210
7264
 
7211
- let _$g = t => t,
7265
+ let _$f = t => t,
7212
7266
  _t$g,
7213
7267
  _t2$b,
7214
7268
  _t3$6,
@@ -7219,7 +7273,7 @@ let _$g = t => t,
7219
7273
  /* Root */
7220
7274
 
7221
7275
  function switchBaseStyles() {
7222
- return css(_t$g || (_t$g = _$g`
7276
+ return css(_t$g || (_t$g = _$f`
7223
7277
  position: relative;
7224
7278
  &:not([hidden]) {
7225
7279
  display: inline-block;
@@ -7230,7 +7284,7 @@ function switchBaseStyles() {
7230
7284
 
7231
7285
  function switchInputStyles() {
7232
7286
  // Visually hide the input element while keeping it interactive
7233
- return css(_t2$b || (_t2$b = _$g`
7287
+ return css(_t2$b || (_t2$b = _$f`
7234
7288
  position: absolute;
7235
7289
  top: 0;
7236
7290
  right: 0;
@@ -7258,7 +7312,7 @@ function switchRepresentationStyles(props) {
7258
7312
  input
7259
7313
  } = theme.sanity;
7260
7314
  const color = theme.sanity.color.button.default;
7261
- return css(_t3$6 || (_t3$6 = _$g`
7315
+ return css(_t3$6 || (_t3$6 = _$f`
7262
7316
  --switch-bg-color: ${0};
7263
7317
  --switch-fg-color: ${0};
7264
7318
  --switch-box-shadow: none;
@@ -7330,7 +7384,7 @@ function switchTrackStyles(props) {
7330
7384
  const {
7331
7385
  input
7332
7386
  } = theme.sanity;
7333
- return css(_t4$4 || (_t4$4 = _$g`
7387
+ return css(_t4$4 || (_t4$4 = _$f`
7334
7388
  &:not([hidden]) {
7335
7389
  display: block;
7336
7390
  }
@@ -7360,7 +7414,7 @@ function switchThumbStyles(props) {
7360
7414
  const checkedOffset = trackWidth - trackPadding * 2 - size;
7361
7415
  const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
7362
7416
  const checked = $indeterminate !== true && props.$checked === true;
7363
- return css(_t5$3 || (_t5$3 = _$g`
7417
+ return css(_t5$3 || (_t5$3 = _$f`
7364
7418
  &:not([hidden]) {
7365
7419
  display: block;
7366
7420
  }
@@ -7379,9 +7433,9 @@ function switchThumbStyles(props) {
7379
7433
  ${0}
7380
7434
 
7381
7435
  ${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`
7436
+ `), 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
7437
  transform: translate3d(${0}px, 0, 0);
7384
- `), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$g`
7438
+ `), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$f`
7385
7439
  transform: translate3d(${0}px, 0, 0);
7386
7440
  `), indeterminateOffset));
7387
7441
  }
@@ -7436,10 +7490,10 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
7436
7490
 
7437
7491
  const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"];
7438
7492
 
7439
- let _$f = t => t,
7493
+ let _$e = t => t,
7440
7494
  _t$f;
7441
7495
  const Root$d = styled.span(textInputRootStyle);
7442
- const InputRoot$1 = styled.span(_t$f || (_t$f = _$f`
7496
+ const InputRoot$1 = styled.span(_t$f || (_t$f = _$e`
7443
7497
  flex: 1;
7444
7498
  min-width: 0;
7445
7499
  display: block;
@@ -7474,6 +7528,7 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
7474
7528
  }, restProps, {
7475
7529
  "$fontSize": useArrayProp(fontSize),
7476
7530
  "$padding": useArrayProp(padding),
7531
+ "$scheme": rootTheme.scheme,
7477
7532
  "$space": useArrayProp(0),
7478
7533
  "$tone": rootTheme.tone,
7479
7534
  "$weight": weight,
@@ -7482,6 +7537,7 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
7482
7537
  })), /*#__PURE__*/React.createElement(Presentation$1, {
7483
7538
  "$border": border,
7484
7539
  "$radius": useArrayProp(radius),
7540
+ "$scheme": rootTheme.scheme,
7485
7541
  "$tone": rootTheme.tone,
7486
7542
  "data-tone": rootTheme.tone
7487
7543
  })));
@@ -7489,7 +7545,7 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
7489
7545
 
7490
7546
  const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"];
7491
7547
 
7492
- let _$e = t => t,
7548
+ let _$d = t => t,
7493
7549
  _t$e,
7494
7550
  _t2$a,
7495
7551
  _t3$5,
@@ -7502,7 +7558,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
7502
7558
  const Root$c = styled(Card).attrs({
7503
7559
  forwardedAs: 'span'
7504
7560
  })(textInputRootStyle);
7505
- const InputRoot = styled.span(_t$e || (_t$e = _$e`
7561
+ const InputRoot = styled.span(_t$e || (_t$e = _$d`
7506
7562
  flex: 1;
7507
7563
  min-width: 0;
7508
7564
  display: block;
@@ -7510,7 +7566,7 @@ const InputRoot = styled.span(_t$e || (_t$e = _$e`
7510
7566
  `));
7511
7567
  const Prefix = styled(Card).attrs({
7512
7568
  forwardedAs: 'span'
7513
- })(_t2$a || (_t2$a = _$e`
7569
+ })(_t2$a || (_t2$a = _$d`
7514
7570
  border-top-right-radius: 0;
7515
7571
  border-bottom-right-radius: 0;
7516
7572
 
@@ -7521,7 +7577,7 @@ const Prefix = styled(Card).attrs({
7521
7577
  `));
7522
7578
  const Suffix = styled(Card).attrs({
7523
7579
  forwardedAs: 'span'
7524
- })(_t3$5 || (_t3$5 = _$e`
7580
+ })(_t3$5 || (_t3$5 = _$d`
7525
7581
  border-top-left-radius: 0;
7526
7582
  border-bottom-left-radius: 0;
7527
7583
 
@@ -7532,17 +7588,17 @@ const Suffix = styled(Card).attrs({
7532
7588
  `));
7533
7589
  const Input = styled.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
7534
7590
  const Presentation = styled.span(responsiveRadiusStyle, textInputRepresentationStyle);
7535
- const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$e`
7591
+ const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$d`
7536
7592
  position: absolute;
7537
7593
  top: 0;
7538
7594
  left: 0;
7539
7595
  `));
7540
- const RightBox = styled(Box)(_t5$2 || (_t5$2 = _$e`
7596
+ const RightBox = styled(Box)(_t5$2 || (_t5$2 = _$d`
7541
7597
  position: absolute;
7542
7598
  top: 0;
7543
7599
  right: 0;
7544
7600
  `));
7545
- const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$e`
7601
+ const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$d`
7546
7602
  background-color: transparent;
7547
7603
  position: absolute;
7548
7604
  top: 0;
@@ -7615,7 +7671,9 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7615
7671
  "$hasPrefix": $hasPrefix,
7616
7672
  "$hasSuffix": $hasSuffix,
7617
7673
  "$radius": radius,
7674
+ "$scheme": rootTheme.scheme,
7618
7675
  "$tone": rootTheme.tone,
7676
+ "data-scheme": rootTheme.scheme,
7619
7677
  "data-tone": rootTheme.tone
7620
7678
  }, icon && /*#__PURE__*/React.createElement(LeftBox, {
7621
7679
  padding: padding
@@ -7625,7 +7683,7 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7625
7683
  padding: padding
7626
7684
  }, /*#__PURE__*/React.createElement(Text, {
7627
7685
  size: fontSize
7628
- }, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, rootTheme.tone, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
7686
+ }, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
7629
7687
 
7630
7688
  const clearButtonBoxPadding = useMemo(() => padding.map(v => {
7631
7689
  if (v === 0) return 0;
@@ -7670,12 +7728,14 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7670
7728
  tone: rootTheme.tone
7671
7729
  }, prefixNode, /*#__PURE__*/React.createElement(InputRoot, null, /*#__PURE__*/React.createElement(Input, _extends({
7672
7730
  "data-as": "input",
7731
+ "data-scheme": rootTheme.scheme,
7673
7732
  "data-tone": rootTheme.tone
7674
7733
  }, restProps, {
7675
7734
  "$fontSize": fontSize,
7676
7735
  "$iconLeft": $hasIcon,
7677
7736
  "$iconRight": $hasIconRight || $hasClearButton,
7678
7737
  "$padding": padding,
7738
+ "$scheme": rootTheme.scheme,
7679
7739
  "$space": space,
7680
7740
  "$tone": rootTheme.tone,
7681
7741
  "$weight": weight,
@@ -7686,27 +7746,12 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7686
7746
  })), presentationNode, clearButtonNode), suffixNode);
7687
7747
  });
7688
7748
 
7689
- let _$d = t => t,
7749
+ let _$c = t => t,
7690
7750
  _t$d,
7691
7751
  _t2$9,
7692
7752
  _t3$4;
7693
- const Root$b = styled.div(_t$d || (_t$d = _$d`
7753
+ const Root$b = styled.div(_t$d || (_t$d = _$c`
7694
7754
  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
7755
  width: 15px;
7711
7756
  height: 15px;
7712
7757
  fill: none;
@@ -7720,48 +7765,46 @@ const Root$b = styled.div(_t$d || (_t$d = _$d`
7720
7765
  display: block;
7721
7766
  }
7722
7767
  transform-origin: 7.5px 7.5px;
7723
- } */
7768
+ }
7724
7769
 
7725
- [data-placement^='top'] > & {
7726
- bottom: -27px;
7770
+ [data-popper-placement^='top'] > div > & {
7771
+ bottom: -15px;
7727
7772
  }
7728
7773
 
7729
- [data-placement^='right'] > & {
7730
- left: -27px;
7774
+ [data-popper-placement^='right'] > div > & {
7775
+ left: -15px;
7731
7776
 
7732
7777
  & > svg {
7733
7778
  transform: rotate(90deg);
7734
7779
  }
7735
7780
  }
7736
7781
 
7737
- [data-placement^='left'] > & {
7738
- right: -27px;
7782
+ [data-popper-placement^='left'] > div > & {
7783
+ right: -15px;
7739
7784
 
7740
7785
  & > svg {
7741
7786
  transform: rotate(-90deg);
7742
7787
  }
7743
7788
  }
7744
7789
 
7745
- [data-placement^='bottom'] > & {
7746
- top: -27px;
7790
+ [data-popper-placement^='bottom'] > div > & {
7791
+ top: -15px;
7747
7792
 
7748
7793
  & > svg {
7749
7794
  transform: rotate(180deg);
7750
7795
  }
7751
7796
  }
7752
7797
  `));
7753
- const Border = styled.path(_t2$9 || (_t2$9 = _$d`
7798
+ const Border = styled.path(_t2$9 || (_t2$9 = _$c`
7754
7799
  fill: var(--card-shadow-outline-color);
7755
7800
  `));
7756
- const Shape = styled.path(_t3$4 || (_t3$4 = _$d`
7801
+ const Shape = styled.path(_t3$4 || (_t3$4 = _$c`
7757
7802
  fill: var(--card-bg-color);
7758
7803
  `));
7759
7804
  const TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
7760
7805
  const restProps = _extends({}, props);
7761
7806
 
7762
- return /*#__PURE__*/React.createElement(Root$b, _extends({
7763
- "data-ui": "Tooltip__arrow"
7764
- }, restProps, {
7807
+ return /*#__PURE__*/React.createElement(Root$b, _extends({}, restProps, {
7765
7808
  ref: ref
7766
7809
  }), /*#__PURE__*/React.createElement("svg", {
7767
7810
  width: "15",
@@ -7774,11 +7817,11 @@ const TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
7774
7817
  })));
7775
7818
  });
7776
7819
 
7777
- const _excluded$g = ["boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "shadow", "zOffset"];
7820
+ const _excluded$g = ["allowedAutoPlacements", "boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "zOffset"];
7778
7821
 
7779
- let _$c = t => t,
7822
+ let _2 = t => t,
7780
7823
  _t$c;
7781
- const Root$a = styled(Layer)(_t$c || (_t$c = _$c`
7824
+ const Root$a = styled(Layer)(_t$c || (_t$c = _2`
7782
7825
  pointer-events: none;
7783
7826
  `));
7784
7827
  /**
@@ -7786,21 +7829,21 @@ const Root$a = styled(Layer)(_t$c || (_t$c = _$c`
7786
7829
  */
7787
7830
 
7788
7831
  const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7789
- var _theme$sanity$layer, _middlewareData$arrow, _middlewareData$arrow2;
7832
+ var _theme$sanity$layer;
7790
7833
 
7791
7834
  const boundaryElementContext = useBoundaryElement();
7792
7835
  const theme = useTheme();
7793
7836
 
7794
7837
  const {
7838
+ allowedAutoPlacements,
7795
7839
  boundaryElement = boundaryElementContext == null ? void 0 : boundaryElementContext.element,
7796
- children: childProp,
7840
+ children,
7797
7841
  content,
7798
7842
  disabled,
7799
7843
  fallbackPlacements: fallbackPlacementsProp,
7800
- placement: placementProp = 'bottom',
7844
+ placement = 'bottom',
7801
7845
  portal,
7802
7846
  scheme,
7803
- shadow = 2,
7804
7847
  zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.tooltip.zOffset
7805
7848
  } = props,
7806
7849
  restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
@@ -7808,66 +7851,39 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7808
7851
  const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
7809
7852
  const forwardedRef = useForwardedRef(ref);
7810
7853
  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,
7854
+ const [popperElement, setPopperElement] = useState(null);
7855
+ const [arrowElement, setArrowElement] = useState(null);
7856
+ const popper = usePopper(referenceElement, popperElement, {
7842
7857
  placement,
7843
- reference,
7844
- floating,
7845
- middlewareData,
7846
- update,
7847
- strategy
7848
- } = useFloating({
7849
- middleware,
7850
- placement: placementProp,
7851
- whileElementsMounted: autoUpdate
7858
+ modifiers: [{
7859
+ name: 'arrow',
7860
+ options: {
7861
+ element: arrowElement,
7862
+ padding: 4
7863
+ }
7864
+ }, {
7865
+ name: 'preventOverflow',
7866
+ options: {
7867
+ altAxis: true,
7868
+ boundary: boundaryElement || undefined,
7869
+ padding: 4
7870
+ }
7871
+ }, {
7872
+ name: 'offset',
7873
+ options: {
7874
+ offset: [0, 3]
7875
+ }
7876
+ }, {
7877
+ name: 'flip',
7878
+ options: {
7879
+ allowedAutoPlacements,
7880
+ fallbackPlacements
7881
+ }
7882
+ }]
7852
7883
  });
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]);
7884
+ const {
7885
+ forceUpdate
7886
+ } = popper;
7871
7887
  const [isOpen, setIsOpen] = useState(false);
7872
7888
  const handleBlur = useCallback(() => setIsOpen(false), []);
7873
7889
  const handleFocus = useCallback(() => setIsOpen(true), []);
@@ -7893,7 +7909,23 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7893
7909
  return () => {
7894
7910
  window.removeEventListener('mousemove', handleWindowMouseMove);
7895
7911
  };
7896
- }, [isOpen, referenceElement]); // Close when `disabled` changes to `true`
7912
+ }, [isOpen, referenceElement]);
7913
+ const updateTimeoutRef = useRef(null);
7914
+ useEffect(() => {
7915
+ if (updateTimeoutRef.current) {
7916
+ clearTimeout(updateTimeoutRef.current);
7917
+ updateTimeoutRef.current = null;
7918
+ }
7919
+
7920
+ updateTimeoutRef.current = setTimeout(() => {
7921
+ if (forceUpdate) {
7922
+ try {
7923
+ forceUpdate();
7924
+ } catch (_) {// ignore caught error
7925
+ }
7926
+ }
7927
+ }, 0);
7928
+ }, [forceUpdate, content]); // Close when `disabled` changes to `true`
7897
7929
 
7898
7930
  useEffect(() => {
7899
7931
  if (disabled) setIsOpen(false);
@@ -7901,59 +7933,40 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7901
7933
 
7902
7934
  useEffect(() => {
7903
7935
  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({
7936
+ }, [content]);
7937
+
7938
+ const setRef = el => {
7939
+ setPopperElement(el);
7940
+ forwardedRef.current = el;
7941
+ };
7942
+
7943
+ if (!children) return /*#__PURE__*/React.createElement(React.Fragment, null);
7944
+ if (disabled) return children;
7945
+ const referenceProps = {
7946
+ onBlur: handleBlur,
7947
+ onFocus: handleFocus,
7948
+ onMouseEnter: handleMouseEnter,
7949
+ onMouseLeave: handleMouseLeave,
7950
+ ref: setReferenceElement
7951
+ };
7952
+ const referenceNode = /*#__PURE__*/cloneElement(children, referenceProps);
7953
+ const popperNode = /*#__PURE__*/React.createElement(Root$a, _extends({
7939
7954
  "data-ui": "Tooltip"
7940
- }, restProps, {
7941
- ref: setFloating,
7942
- style: rootStyle,
7955
+ }, restProps, popper.attributes.popper, {
7956
+ ref: setRef,
7957
+ style: popper.styles.popper,
7943
7958
  zOffset: zOffset
7944
7959
  }), /*#__PURE__*/React.createElement(Card, {
7945
- "data-ui": "Tooltip__card",
7946
- "data-placement": placement,
7947
7960
  radius: 2,
7948
7961
  scheme: scheme,
7949
- shadow: shadow
7962
+ shadow: 3
7950
7963
  }, content, /*#__PURE__*/React.createElement(TooltipArrow, {
7951
- ref: setArrow,
7952
- style: arrowStyle
7964
+ ref: setArrowElement,
7965
+ style: popper.styles.arrow
7953
7966
  })));
7954
- return /*#__PURE__*/React.createElement(React.Fragment, null, child, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, portal ? /*#__PURE__*/React.createElement(Portal, {
7967
+ return /*#__PURE__*/React.createElement(React.Fragment, null, referenceNode, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, portal && /*#__PURE__*/React.createElement(Portal, {
7955
7968
  __unstable_name: typeof portal === 'string' ? portal : undefined
7956
- }, root) : root));
7969
+ }, popperNode), !portal && popperNode));
7957
7970
  });
7958
7971
 
7959
7972
  let _$b = t => t,
@@ -7985,6 +7998,11 @@ const ListBox = styled(Box)(_t2$8 || (_t2$8 = _$b`
7985
7998
  */
7986
7999
 
7987
8000
  const ResultsPopover = styled(Popover)(_t3$3 || (_t3$3 = _$b`
8001
+ & > div {
8002
+ overflow: auto;
8003
+ -webkit-overflow-scrolling: touch;
8004
+ }
8005
+
7988
8006
  &[data-popper-reference-hidden='true'] {
7989
8007
  display: none;
7990
8008
  }
@@ -8116,17 +8134,17 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ['Control', 'Shift', 'Alt', 'Enter', 'H
8116
8134
  * @internal
8117
8135
  */
8118
8136
 
8119
- const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 0, 0];
8137
+ const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 1, 1];
8120
8138
  /**
8121
8139
  * @internal
8122
8140
  */
8123
8141
 
8124
- const AUTOCOMPLETE_POPOVER_PLACEMENT = 'bottom';
8142
+ const AUTOCOMPLETE_POPOVER_PLACEMENT = 'bottom-start';
8125
8143
  /**
8126
8144
  * @internal
8127
8145
  */
8128
8146
 
8129
- const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ['bottom', 'top'];
8147
+ const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ['top-start'];
8130
8148
 
8131
8149
  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
8150