@sanity/ui 3.0.11 → 3.0.12-canary.1

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 (53) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +1124 -628
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +1127 -631
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/_visual-editing.d.mts +3 -7
  6. package/dist/_visual-editing.d.ts +3 -7
  7. package/dist/index.d.mts +11 -12
  8. package/dist/index.d.ts +11 -12
  9. package/dist/index.js +252 -295
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +254 -297
  12. package/dist/index.mjs.map +1 -1
  13. package/package.json +26 -40
  14. package/src/core/components/autocomplete/autocomplete.tsx +2 -2
  15. package/src/core/components/breadcrumbs/breadcrumbs.tsx +70 -40
  16. package/src/core/components/dialog/dialog.tsx +10 -14
  17. package/src/core/components/hotkeys/hotkeys.tsx +2 -2
  18. package/src/core/components/menu/menuGroup.tsx +2 -2
  19. package/src/core/components/menu/menuItem.tsx +4 -4
  20. package/src/core/components/skeleton/skeleton.tsx +2 -2
  21. package/src/core/components/skeleton/textSkeleton.tsx +5 -5
  22. package/src/core/components/tree/tree.tsx +176 -182
  23. package/src/core/components/tree/treeGroup.tsx +2 -4
  24. package/src/core/components/tree/treeItem.tsx +5 -5
  25. package/src/core/hooks/index.ts +1 -1
  26. package/src/core/hooks/useArrayProp.ts +5 -17
  27. package/src/core/primitives/avatar/avatar.tsx +14 -16
  28. package/src/core/primitives/avatar/avatarCounter.tsx +14 -16
  29. package/src/core/primitives/avatar/avatarStack.tsx +2 -2
  30. package/src/core/primitives/badge/badge.tsx +3 -3
  31. package/src/core/primitives/box/box.tsx +26 -26
  32. package/src/core/primitives/button/button.tsx +11 -11
  33. package/src/core/primitives/card/card.tsx +8 -8
  34. package/src/core/primitives/code/code.tsx +2 -2
  35. package/src/core/primitives/container/container.tsx +2 -2
  36. package/src/core/primitives/flex/flex.tsx +6 -6
  37. package/src/core/primitives/grid/grid.tsx +9 -9
  38. package/src/core/primitives/heading/heading.tsx +3 -3
  39. package/src/core/primitives/inline/inline.tsx +2 -2
  40. package/src/core/primitives/kbd/kbd.tsx +2 -2
  41. package/src/core/primitives/label/label.tsx +3 -3
  42. package/src/core/primitives/popover/floating-ui/size.ts +32 -16
  43. package/src/core/primitives/popover/popover.tsx +355 -328
  44. package/src/core/primitives/popover/popoverCard.tsx +123 -125
  45. package/src/core/primitives/select/select.tsx +6 -5
  46. package/src/core/primitives/stack/stack.tsx +2 -2
  47. package/src/core/primitives/text/text.tsx +3 -3
  48. package/src/core/primitives/textArea/textArea.tsx +6 -5
  49. package/src/core/primitives/textInput/textInput.tsx +6 -5
  50. package/src/core/primitives/tooltip/tooltip.tsx +73 -44
  51. package/src/core/primitives/tooltip/tooltipCard.tsx +83 -85
  52. package/src/core/utils/layer/layerProvider.tsx +3 -2
  53. package/src/core/utils/virtualList/virtualList.tsx +48 -23
@@ -1,7 +1,7 @@
1
1
  import {Strategy} from '@floating-ui/react-dom'
2
2
  import {ThemeColorSchemeKey} from '@sanity/ui/theme'
3
3
  import {motion, type MotionProps} from 'framer-motion'
4
- import React, {CSSProperties, forwardRef, memo, useMemo} from 'react'
4
+ import React, {CSSProperties, forwardRef, useMemo} from 'react'
5
5
  import {styled} from 'styled-components'
6
6
 
7
7
  import {POPOVER_MOTION_PROPS} from '../../constants'
@@ -33,136 +33,134 @@ const MotionFlex = styled(motion.create(Flex))`
33
33
  /**
34
34
  * @internal
35
35
  */
36
- export const PopoverCard = memo(
37
- forwardRef(function PopoverCard(
38
- props: {
39
- /** @beta*/
40
- __unstable_margins?: PopoverMargins
41
- animate?: boolean
42
- arrow: boolean
43
- arrowRef: React.Ref<HTMLDivElement>
44
- arrowX?: number
45
- arrowY?: number
46
- originX?: number
47
- originY?: number
48
- overflow?: BoxOverflow
49
- padding?: number | number[]
50
- placement: Placement
51
- radius?: Radius | Radius[]
52
- scheme?: ThemeColorSchemeKey
53
- shadow?: number | number[]
54
- strategy: Strategy
55
- tone: CardTone
56
- width: number | undefined
57
- x: number | null
58
- y: number | null
59
- } & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,
60
- ref: React.ForwardedRef<HTMLDivElement>,
61
- ) {
62
- const {
63
- __unstable_margins: marginsProp,
64
- animate,
65
- arrow,
66
- arrowRef,
67
- arrowX,
68
- arrowY,
69
- children,
70
- padding,
71
- placement,
72
- originX,
73
- originY,
74
- overflow,
75
- radius,
76
- scheme,
77
- shadow,
78
- strategy,
79
- style,
80
- tone,
81
- width,
82
- x: xProp,
83
- y: yProp,
84
- ...restProps
85
- } = props
36
+ export const PopoverCard = forwardRef(function PopoverCard(
37
+ props: {
38
+ /** @beta*/
39
+ __unstable_margins?: PopoverMargins
40
+ animate?: boolean
41
+ arrow: boolean
42
+ arrowRef: React.Ref<HTMLDivElement>
43
+ arrowX?: number
44
+ arrowY?: number
45
+ originX?: number
46
+ originY?: number
47
+ overflow?: BoxOverflow
48
+ padding?: number | number[]
49
+ placement: Placement
50
+ radius?: Radius | Radius[]
51
+ scheme?: ThemeColorSchemeKey
52
+ shadow?: number | number[]
53
+ strategy: Strategy
54
+ tone: CardTone
55
+ width: number | undefined
56
+ x: number | null
57
+ y: number | null
58
+ } & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,
59
+ ref: React.ForwardedRef<HTMLDivElement>,
60
+ ) {
61
+ const {
62
+ __unstable_margins: marginsProp,
63
+ animate,
64
+ arrow,
65
+ arrowRef,
66
+ arrowX,
67
+ arrowY,
68
+ children,
69
+ padding,
70
+ placement,
71
+ originX,
72
+ originY,
73
+ overflow,
74
+ radius,
75
+ scheme,
76
+ shadow,
77
+ strategy,
78
+ style,
79
+ tone,
80
+ width,
81
+ x: xProp,
82
+ y: yProp,
83
+ ...restProps
84
+ } = props
86
85
 
87
- const {zIndex} = useLayer()
86
+ const {zIndex} = useLayer()
88
87
 
89
- // Get margins: [top, right, bottom, left]
90
- const margins: PopoverMargins = useMemo(
91
- () => marginsProp || DEFAULT_POPOVER_MARGINS,
92
- [marginsProp],
93
- )
88
+ // Get margins: [top, right, bottom, left]
89
+ const margins: PopoverMargins = useMemo(
90
+ () => marginsProp || DEFAULT_POPOVER_MARGINS,
91
+ [marginsProp],
92
+ )
94
93
 
95
- // Translate according to margins
96
- const x = (xProp ?? 0) + margins[3]
97
- const y = (yProp ?? 0) + margins[0]
94
+ // Translate according to margins
95
+ const x = (xProp ?? 0) + margins[3]
96
+ const y = (yProp ?? 0) + margins[0]
98
97
 
99
- const rootStyle: CSSProperties = useMemo(
100
- () => ({
101
- left: x,
102
- originX,
103
- originY,
104
- position: strategy,
105
- top: y,
106
- width,
107
- zIndex,
108
- willChange: animate ? 'transform' : undefined,
109
- ...style,
110
- }),
111
- [animate, originX, originY, strategy, style, width, x, y, zIndex],
112
- )
98
+ const rootStyle: CSSProperties = useMemo(
99
+ () => ({
100
+ left: x,
101
+ originX,
102
+ originY,
103
+ position: strategy,
104
+ top: y,
105
+ width,
106
+ zIndex,
107
+ willChange: animate ? 'transform' : undefined,
108
+ ...style,
109
+ }),
110
+ [animate, originX, originY, strategy, style, width, x, y, zIndex],
111
+ )
113
112
 
114
- const arrowStyle: CSSProperties = useMemo(
115
- () => ({
116
- left: arrowX !== null ? arrowX : undefined,
117
- top: arrowY !== null ? arrowY : undefined,
118
- right: undefined,
119
- bottom: undefined,
120
- }),
121
- [arrowX, arrowY],
122
- )
113
+ const arrowStyle: CSSProperties = useMemo(
114
+ () => ({
115
+ left: arrowX !== null ? arrowX : undefined,
116
+ top: arrowY !== null ? arrowY : undefined,
117
+ right: undefined,
118
+ bottom: undefined,
119
+ }),
120
+ [arrowX, arrowY],
121
+ )
123
122
 
124
- return (
125
- <MotionCard
126
- data-ui="Popover"
127
- {...(restProps as CardProps & MotionProps)}
128
- data-placement={placement}
129
- radius={radius}
130
- ref={ref}
131
- scheme={scheme}
132
- shadow={shadow}
133
- sizing="border"
134
- style={rootStyle}
135
- tone={tone}
136
- variants={POPOVER_MOTION_PROPS.card}
123
+ return (
124
+ <MotionCard
125
+ data-ui="Popover"
126
+ {...(restProps as CardProps & MotionProps)}
127
+ data-placement={placement}
128
+ radius={radius}
129
+ ref={ref}
130
+ scheme={scheme}
131
+ shadow={shadow}
132
+ sizing="border"
133
+ style={rootStyle}
134
+ tone={tone}
135
+ variants={POPOVER_MOTION_PROPS.card}
136
+ transition={POPOVER_MOTION_PROPS.transition}
137
+ initial={animate ? ['hidden', 'initial'] : undefined}
138
+ animate={animate ? ['visible', 'scaleIn'] : undefined}
139
+ exit={animate ? ['hidden', 'scaleOut'] : undefined}
140
+ >
141
+ <MotionFlex
142
+ data-ui="Popover__wrapper"
143
+ direction="column"
144
+ flex={1}
145
+ overflow={overflow}
146
+ variants={POPOVER_MOTION_PROPS.children}
137
147
  transition={POPOVER_MOTION_PROPS.transition}
138
- initial={animate ? ['hidden', 'initial'] : undefined}
139
- animate={animate ? ['visible', 'scaleIn'] : undefined}
140
- exit={animate ? ['hidden', 'scaleOut'] : undefined}
141
148
  >
142
- <MotionFlex
143
- data-ui="Popover__wrapper"
144
- direction="column"
145
- flex={1}
146
- overflow={overflow}
147
- variants={POPOVER_MOTION_PROPS.children}
148
- transition={POPOVER_MOTION_PROPS.transition}
149
- >
150
- <Flex direction="column" flex={1} padding={padding}>
151
- {children}
152
- </Flex>
153
- </MotionFlex>
149
+ <Flex direction="column" flex={1} padding={padding}>
150
+ {children}
151
+ </Flex>
152
+ </MotionFlex>
154
153
 
155
- {arrow && (
156
- <Arrow
157
- ref={arrowRef}
158
- style={arrowStyle}
159
- width={DEFAULT_POPOVER_ARROW_WIDTH}
160
- height={DEFAULT_POPOVER_ARROW_HEIGHT}
161
- radius={DEFAULT_POPOVER_ARROW_RADIUS}
162
- />
163
- )}
164
- </MotionCard>
165
- )
166
- }),
167
- )
168
- PopoverCard.displayName = 'Memo(ForwardRef(PopoverCard))'
154
+ {arrow && (
155
+ <Arrow
156
+ ref={arrowRef}
157
+ style={arrowStyle}
158
+ width={DEFAULT_POPOVER_ARROW_WIDTH}
159
+ height={DEFAULT_POPOVER_ARROW_HEIGHT}
160
+ radius={DEFAULT_POPOVER_ARROW_RADIUS}
161
+ />
162
+ )}
163
+ </MotionCard>
164
+ )
165
+ })
166
+ PopoverCard.displayName = 'ForwardRef(PopoverCard)'
@@ -2,7 +2,8 @@ import {ChevronDownIcon} from '@sanity/icons'
2
2
  import {forwardRef, useImperativeHandle, useRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
4
 
5
- import {useArrayProp, useCustomValidity} from '../../hooks'
5
+ import {useCustomValidity} from '../../hooks'
6
+ import {getArrayProp} from '../../hooks/useArrayProp'
6
7
  import {Radius} from '../../types'
7
8
  import {Box} from '../box'
8
9
  import {Text} from '../text'
@@ -66,10 +67,10 @@ export const Select = forwardRef(function Select(
66
67
  data-read-only={!disabled && readOnly ? '' : undefined}
67
68
  data-ui="Select"
68
69
  {...restProps}
69
- $fontSize={useArrayProp(fontSize)}
70
- $padding={useArrayProp(padding)}
71
- $radius={useArrayProp(radius)}
72
- $space={useArrayProp(space)}
70
+ $fontSize={getArrayProp(fontSize)}
71
+ $padding={getArrayProp(padding)}
72
+ $radius={getArrayProp(radius)}
73
+ $space={getArrayProp(space)}
73
74
  disabled={disabled || readOnly}
74
75
  ref={ref}
75
76
  >
@@ -1,7 +1,7 @@
1
1
  import {forwardRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
3
 
4
- import {useArrayProp} from '../../hooks'
4
+ import {getArrayProp} from '../../hooks/useArrayProp'
5
5
  import {Box, BoxProps} from '../box'
6
6
  import {responsiveStackSpaceStyle, ResponsiveStackSpaceStyleProps, stackBaseStyle} from './styles'
7
7
 
@@ -34,7 +34,7 @@ export const Stack = forwardRef(function Stack(
34
34
  data-as={typeof as === 'string' ? as : undefined}
35
35
  data-ui="Stack"
36
36
  {...restProps}
37
- $space={useArrayProp(space)}
37
+ $space={getArrayProp(space)}
38
38
  forwardedAs={as}
39
39
  ref={ref}
40
40
  />
@@ -2,7 +2,7 @@ import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
4
 
5
- import {useArrayProp} from '../../hooks'
5
+ import {getArrayProp} from '../../hooks/useArrayProp'
6
6
  import {
7
7
  ResponsiveFontStyleProps,
8
8
  responsiveTextAlignStyle,
@@ -68,10 +68,10 @@ export const Text = forwardRef(function Text(
68
68
  data-ui="Text"
69
69
  {...restProps}
70
70
  $accent={accent}
71
- $align={useArrayProp(align)}
71
+ $align={getArrayProp(align)}
72
72
  $muted={muted}
73
73
  ref={ref}
74
- $size={useArrayProp(size)}
74
+ $size={getArrayProp(size)}
75
75
  $weight={weight}
76
76
  >
77
77
  <span>{children}</span>
@@ -2,7 +2,8 @@ import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
2
  import {forwardRef, useImperativeHandle, useRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
4
 
5
- import {useArrayProp, useCustomValidity} from '../../hooks'
5
+ import {useCustomValidity} from '../../hooks'
6
+ import {getArrayProp} from '../../hooks/useArrayProp'
6
7
  import {
7
8
  responsiveInputPaddingStyle,
8
9
  responsiveRadiusStyle,
@@ -94,17 +95,17 @@ export const TextArea = forwardRef(function TextArea(
94
95
  data-scheme={rootTheme.scheme}
95
96
  data-tone={rootTheme.tone}
96
97
  {...restProps}
97
- $fontSize={useArrayProp(fontSize)}
98
- $padding={useArrayProp(padding)}
98
+ $fontSize={getArrayProp(fontSize)}
99
+ $padding={getArrayProp(padding)}
99
100
  $scheme={rootTheme.scheme}
100
- $space={useArrayProp(0)}
101
+ $space={getArrayProp(0)}
101
102
  $tone={rootTheme.tone}
102
103
  $weight={weight}
103
104
  disabled={disabled}
104
105
  ref={ref}
105
106
  />
106
107
  <Presentation
107
- $radius={useArrayProp(radius)}
108
+ $radius={getArrayProp(radius)}
108
109
  $unstableDisableFocusRing={__unstable_disableFocusRing}
109
110
  $scheme={rootTheme.scheme}
110
111
  $tone={rootTheme.tone}
@@ -5,7 +5,8 @@ import {isValidElementType} from 'react-is'
5
5
  import {styled} from 'styled-components'
6
6
 
7
7
  import {EMPTY_RECORD} from '../../constants'
8
- import {useArrayProp, useCustomValidity} from '../../hooks'
8
+ import {useCustomValidity} from '../../hooks'
9
+ import {getArrayProp} from '../../hooks/useArrayProp'
9
10
  import {
10
11
  responsiveInputPaddingStyle,
11
12
  responsiveRadiusStyle,
@@ -179,10 +180,10 @@ export const TextInput = forwardRef(function TextInput(
179
180
 
180
181
  const rootTheme = useRootTheme()
181
182
 
182
- const fontSize = useArrayProp(fontSizeProp)
183
- const padding = useArrayProp(paddingProp)
184
- const radius = useArrayProp(radiusProp)
185
- const space = useArrayProp(spaceProp)
183
+ const fontSize = getArrayProp(fontSizeProp)
184
+ const padding = getArrayProp(paddingProp)
185
+ const radius = getArrayProp(radiusProp)
186
+ const space = getArrayProp(spaceProp)
186
187
 
187
188
  // Transient properties
188
189
  const $hasClearButton = Boolean(clearButton)
@@ -25,7 +25,8 @@ import {
25
25
  import {styled} from 'styled-components'
26
26
  import {useEffectEvent} from 'use-effect-event'
27
27
 
28
- import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
28
+ import {usePrefersReducedMotion} from '../../hooks'
29
+ import {getArrayProp} from '../../hooks/useArrayProp'
29
30
  import {useDelayedState} from '../../hooks/useDelayedState'
30
31
  import {origin} from '../../middleware/origin'
31
32
  import {useTheme_v2} from '../../theme'
@@ -98,25 +99,28 @@ export const Tooltip = forwardRef(function Tooltip(
98
99
  const {
99
100
  animate: _animate = false,
100
101
  arrow: arrowProp = false,
101
- boundaryElement = boundaryElementContext?.element,
102
+ boundaryElement: _boundaryElement,
102
103
  children: childProp,
103
104
  content,
104
105
  disabled,
105
- fallbackPlacements: fallbackPlacementsProp = props.fallbackPlacements ??
106
- DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom'],
106
+ fallbackPlacements: _fallbackPlacementsProp,
107
107
  padding = 2,
108
108
  placement: placementProp = 'bottom',
109
109
  portal: portalProp,
110
110
  radius = 2,
111
111
  scheme,
112
112
  shadow = 2,
113
- zOffset = layer.tooltip.zOffset,
113
+ zOffset: _zOffset,
114
114
  delay,
115
115
  ...restProps
116
116
  } = props
117
+ const boundaryElement = _boundaryElement ?? boundaryElementContext?.element
118
+ const fallbackPlacementsProp =
119
+ _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom']
120
+ const zOffset = _zOffset ?? layer.tooltip.zOffset
117
121
  const prefersReducedMotion = usePrefersReducedMotion()
118
122
  const animate = prefersReducedMotion ? false : _animate
119
- const fallbackPlacements = useArrayProp(fallbackPlacementsProp)
123
+ const fallbackPlacements = getArrayProp(fallbackPlacementsProp)
120
124
  const ref = useRef<HTMLDivElement | null>(null)
121
125
  const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null)
122
126
  const arrowRef = useRef<HTMLDivElement | null>(null)
@@ -129,44 +133,14 @@ export const Tooltip = forwardRef(function Tooltip(
129
133
  const portalElement =
130
134
  typeof portalProp === 'string' ? portal.elements?.[portalProp] || null : portal.element
131
135
 
132
- const middleware = useMemo(() => {
133
- const ret: Middleware[] = []
134
-
135
- // Flip the floating element when leaving the boundary box
136
- ret.push(
137
- flip({
138
- boundary: boundaryElement || undefined,
139
- fallbackPlacements,
140
- padding: DEFAULT_TOOLTIP_PADDING,
141
- rootBoundary,
142
- }),
143
- )
144
-
145
- // Define distance between reference and floating element
146
- ret.push(offset({mainAxis: DEFAULT_TOOLTIP_DISTANCE}))
147
-
148
- // Shift the tooltip so its sits with the boundary element
149
- ret.push(
150
- shift({
151
- boundary: boundaryElement || undefined,
152
- rootBoundary,
153
- padding: DEFAULT_TOOLTIP_PADDING,
154
- }),
155
- )
156
-
157
- // Place arrow
158
- if (arrowProp) {
159
- ret.push(arrow({element: arrowRef, padding: DEFAULT_TOOLTIP_PADDING}))
160
- }
161
-
162
- // Determine the origin to scale from.
163
- // Must be placed after `@sanity/ui/size` and `shift` middleware.
164
- if (animate) {
165
- ret.push(origin)
166
- }
167
-
168
- return ret
169
- }, [animate, arrowProp, boundaryElement, fallbackPlacements])
136
+ const middleware = useMiddleware({
137
+ animate,
138
+ arrowProp,
139
+ arrowRef,
140
+ boundaryElement,
141
+ fallbackPlacements,
142
+ rootBoundary,
143
+ })
170
144
 
171
145
  const {floatingStyles, placement, middlewareData, refs, update} = useFloating({
172
146
  middleware,
@@ -417,6 +391,61 @@ export const Tooltip = forwardRef(function Tooltip(
417
391
  })
418
392
  Tooltip.displayName = 'ForwardRef(Tooltip)'
419
393
 
394
+ function useMiddleware({
395
+ animate,
396
+ arrowProp,
397
+ arrowRef,
398
+ boundaryElement,
399
+ fallbackPlacements,
400
+ rootBoundary,
401
+ }: {
402
+ animate: boolean
403
+ arrowProp: boolean
404
+ arrowRef: React.RefObject<HTMLDivElement | null>
405
+ boundaryElement: HTMLElement | null
406
+ fallbackPlacements: Placement[]
407
+ rootBoundary: RootBoundary
408
+ }) {
409
+ return useMemo(() => {
410
+ const ret: Middleware[] = []
411
+
412
+ // Flip the floating element when leaving the boundary box
413
+ ret.push(
414
+ flip({
415
+ boundary: boundaryElement || undefined,
416
+ fallbackPlacements,
417
+ padding: DEFAULT_TOOLTIP_PADDING,
418
+ rootBoundary,
419
+ }),
420
+ )
421
+
422
+ // Define distance between reference and floating element
423
+ ret.push(offset({mainAxis: DEFAULT_TOOLTIP_DISTANCE}))
424
+
425
+ // Shift the tooltip so its sits with the boundary element
426
+ ret.push(
427
+ shift({
428
+ boundary: boundaryElement || undefined,
429
+ rootBoundary,
430
+ padding: DEFAULT_TOOLTIP_PADDING,
431
+ }),
432
+ )
433
+
434
+ // Place arrow
435
+ if (arrowProp) {
436
+ ret.push(arrow({element: arrowRef, padding: DEFAULT_TOOLTIP_PADDING}))
437
+ }
438
+
439
+ // Determine the origin to scale from.
440
+ // Must be placed after `@sanity/ui/size` and `shift` middleware.
441
+ if (animate) {
442
+ ret.push(origin)
443
+ }
444
+
445
+ return ret
446
+ }, [animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary])
447
+ }
448
+
420
449
  /**
421
450
  * As `useEffectEvent` should never be passed to other components or hooks, this custom hook groups together the `useEffectEvent` and the `useEffect` hook using it.
422
451
  * @see https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events:~:text=Never%20pass%20them%20to%20other%20components%20or%20Hooks