@sanity/ui 2.8.5 → 2.8.7

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 (73) hide show
  1. package/dist/index.d.mts +48 -0
  2. package/dist/index.d.ts +48 -0
  3. package/dist/index.esm.js +154 -82
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +154 -82
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +154 -82
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +2 -2
  10. package/src/core/components/autocomplete/autocomplete.tsx +2 -0
  11. package/src/core/components/breadcrumbs/breadcrumbs.tsx +1 -0
  12. package/src/core/components/dialog/dialog.tsx +3 -0
  13. package/src/core/components/dialog/dialogProvider.tsx +2 -0
  14. package/src/core/components/hotkeys/hotkeys.tsx +1 -0
  15. package/src/core/components/menu/menu.tsx +21 -20
  16. package/src/core/components/menu/menuButton.tsx +2 -5
  17. package/src/core/components/menu/menuDivider.ts +1 -0
  18. package/src/core/components/menu/menuGroup.tsx +19 -17
  19. package/src/core/components/menu/menuItem.tsx +1 -0
  20. package/src/core/components/menu/useMenuController.ts +13 -23
  21. package/src/core/components/skeleton/skeleton.tsx +1 -0
  22. package/src/core/components/skeleton/textSkeleton.tsx +4 -0
  23. package/src/core/components/tab/tab.tsx +1 -0
  24. package/src/core/components/tab/tabList.tsx +1 -0
  25. package/src/core/components/tab/tabPanel.tsx +1 -0
  26. package/src/core/components/toast/styles.ts +1 -1
  27. package/src/core/components/toast/toast.tsx +2 -0
  28. package/src/core/components/toast/toastProvider.tsx +2 -0
  29. package/src/core/components/tree/tree.tsx +1 -2
  30. package/src/core/components/tree/treeItem.tsx +1 -0
  31. package/src/core/hooks/useClickOutsideEvent.ts +2 -4
  32. package/src/core/primitives/_selectable/selectable.tsx +1 -0
  33. package/src/core/primitives/avatar/avatar.tsx +1 -0
  34. package/src/core/primitives/avatar/avatarCounter.tsx +1 -0
  35. package/src/core/primitives/avatar/avatarStack.tsx +1 -0
  36. package/src/core/primitives/badge/badge.tsx +1 -0
  37. package/src/core/primitives/box/box.tsx +1 -0
  38. package/src/core/primitives/button/button.tsx +1 -0
  39. package/src/core/primitives/card/card.tsx +1 -0
  40. package/src/core/primitives/checkbox/checkbox.tsx +1 -0
  41. package/src/core/primitives/code/code.tsx +1 -0
  42. package/src/core/primitives/container/container.tsx +1 -0
  43. package/src/core/primitives/flex/flex.tsx +1 -0
  44. package/src/core/primitives/grid/grid.tsx +1 -0
  45. package/src/core/primitives/heading/heading.tsx +1 -0
  46. package/src/core/primitives/inline/inline.tsx +1 -0
  47. package/src/core/primitives/kbd/kbd.tsx +1 -0
  48. package/src/core/primitives/label/label.tsx +1 -0
  49. package/src/core/primitives/popover/popover.tsx +1 -2
  50. package/src/core/primitives/popover/popoverCard.tsx +1 -2
  51. package/src/core/primitives/radio/radio.tsx +1 -0
  52. package/src/core/primitives/select/select.tsx +1 -0
  53. package/src/core/primitives/spinner/spinner.tsx +1 -0
  54. package/src/core/primitives/stack/stack.tsx +1 -0
  55. package/src/core/primitives/switch/switch.tsx +1 -0
  56. package/src/core/primitives/text/text.tsx +1 -0
  57. package/src/core/primitives/textArea/textArea.tsx +1 -0
  58. package/src/core/primitives/textInput/textInput.tsx +1 -0
  59. package/src/core/primitives/tooltip/tooltip.tsx +1 -0
  60. package/src/core/primitives/tooltip/tooltipCard.tsx +1 -2
  61. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +2 -0
  62. package/src/core/theme/themeColorProvider.tsx +2 -0
  63. package/src/core/theme/themeProvider.tsx +2 -0
  64. package/src/core/utils/arrow/arrow.tsx +1 -0
  65. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -0
  66. package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +2 -0
  67. package/src/core/utils/elementQuery/elementQuery.tsx +1 -0
  68. package/src/core/utils/layer/layer.tsx +1 -0
  69. package/src/core/utils/layer/layerProvider.tsx +2 -0
  70. package/src/core/utils/portal/portal.ts +2 -0
  71. package/src/core/utils/portal/portalProvider.tsx +2 -0
  72. package/src/core/utils/srOnly/srOnly.tsx +1 -0
  73. package/src/core/utils/virtualList/virtualList.tsx +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.8.5",
3
+ "version": "2.8.7",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -121,7 +121,7 @@
121
121
  "@commitlint/cli": "^19.3.0",
122
122
  "@commitlint/config-conventional": "^19.2.2",
123
123
  "@juggle/resize-observer": "^3.4.0",
124
- "@sanity/pkg-utils": "^6.10.4",
124
+ "@sanity/pkg-utils": "^6.10.6",
125
125
  "@sanity/prettier-config": "^1.0.2",
126
126
  "@sanity/semantic-release-preset": "^5.0.0",
127
127
  "@sanity/ui-workshop": "^2.0.15",
@@ -691,6 +691,8 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
691
691
  )
692
692
  })
693
693
 
694
+ InnerAutocomplete.displayName = 'ForwardRef(Autocomplete)'
695
+
694
696
  /**
695
697
  * The Autocomplete component is typically used for search components.
696
698
  * It consists of a text input for writing a query, and properties for rendering suggestions.
@@ -95,3 +95,4 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
95
95
  </Root>
96
96
  )
97
97
  })
98
+ Breadcrumbs.displayName = 'ForwardRef(Breadcrumbs)'
@@ -276,6 +276,8 @@ const DialogCard = forwardRef(function DialogCard(
276
276
  )
277
277
  })
278
278
 
279
+ DialogCard.displayName = 'ForwardRef(DialogCard)'
280
+
279
281
  /**
280
282
  * The Dialog component.
281
283
  *
@@ -424,3 +426,4 @@ export const Dialog = forwardRef(function Dialog(
424
426
  </Portal>
425
427
  )
426
428
  })
429
+ Dialog.displayName = 'ForwardRef(Dialog)'
@@ -30,3 +30,5 @@ export function DialogProvider(props: DialogProviderProps): React.ReactElement {
30
30
 
31
31
  return <DialogContext.Provider value={contextValue}>{children}</DialogContext.Provider>
32
32
  }
33
+
34
+ DialogProvider.displayName = 'DialogProvider'
@@ -58,3 +58,4 @@ export const Hotkeys = forwardRef(function Hotkeys(
58
58
  </Root>
59
59
  )
60
60
  })
61
+ Hotkeys.displayName = 'ForwardRef(Hotkeys)'
@@ -1,6 +1,6 @@
1
1
  import {forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
- import {useClickOutside, useGlobalKeyDown} from '../../hooks'
3
+ import {useClickOutsideEvent, useGlobalKeyDown} from '../../hooks'
4
4
  import {Box, Stack} from '../../primitives'
5
5
  import {ResponsivePaddingProps} from '../../primitives/types'
6
6
  import {useLayer} from '../../utils'
@@ -75,16 +75,29 @@ export const Menu = forwardRef(function Menu(
75
75
  handleItemMouseLeave,
76
76
  handleKeyDown,
77
77
  mount,
78
- rootElement,
79
- setRootElement,
80
- } = useMenuController({onKeyDown, originElement, shouldFocus})
78
+ } = useMenuController({onKeyDown, originElement, shouldFocus, rootElementRef: ref})
81
79
 
80
+ const unregisterElementRef = useRef<(() => void) | null>(null)
82
81
  const handleRefChange = useCallback(
83
82
  (el: HTMLDivElement | null) => {
84
- setRootElement(el)
83
+ // Run cleanup of previously registered elements
84
+ if (unregisterElementRef.current) {
85
+ // The `registerElement` callback were originally used in a `useEffect`, so it returns a cleanup function that is a bit gnarly to handle in a ref callback.
86
+ // Since we can't change the `registerElement` implementation itself without making breaking change,
87
+ // that is explained in the code comments for createGlobalScopedContext.tsx,
88
+ // we need to handle with a ref that holds on to the cleanup function last returned when the ref callback is called.
89
+ unregisterElementRef.current()
90
+ unregisterElementRef.current = null
91
+ }
92
+
85
93
  ref.current = el
94
+
95
+ // Register root element (for nested menus)
96
+ if (ref.current && registerElement) {
97
+ unregisterElementRef.current = registerElement(ref.current)
98
+ }
86
99
  },
87
- [setRootElement],
100
+ [registerElement],
88
101
  )
89
102
 
90
103
  // Trigger `onItemSelect` when active index changes
@@ -93,13 +106,7 @@ export const Menu = forwardRef(function Menu(
93
106
  }, [activeIndex, onItemSelect])
94
107
 
95
108
  // Close menu when clicking outside
96
- useClickOutside(
97
- useCallback(
98
- (event) => isTopLayer && onClickOutside && onClickOutside(event),
99
- [isTopLayer, onClickOutside],
100
- ),
101
- [rootElement],
102
- )
109
+ useClickOutsideEvent(isTopLayer && onClickOutside, () => [ref.current])
103
110
 
104
111
  // Close menu when pressing Escape
105
112
  useGlobalKeyDown(
@@ -116,13 +123,6 @@ export const Menu = forwardRef(function Menu(
116
123
  ),
117
124
  )
118
125
 
119
- // Register root element (for nested menus)
120
- useEffect(() => {
121
- if (!rootElement || !registerElement) return
122
-
123
- return registerElement(rootElement)
124
- }, [registerElement, rootElement])
125
-
126
126
  const value: MenuContextValue = useMemo(
127
127
  () => ({
128
128
  version: 0.0,
@@ -169,3 +169,4 @@ export const Menu = forwardRef(function Menu(
169
169
  </MenuContext.Provider>
170
170
  )
171
171
  })
172
+ Menu.displayName = 'ForwardRef(Menu)'
@@ -196,11 +196,7 @@ export const MenuButton = forwardRef(function MenuButton(
196
196
  const registerElement = useCallback((el: HTMLElement) => {
197
197
  setChildMenuElements((els) => els.concat([el]))
198
198
 
199
- return () => {
200
- setChildMenuElements((els) => {
201
- return els.filter((_el) => _el !== el)
202
- })
203
- }
199
+ return () => setChildMenuElements((els) => els.filter((_el) => _el !== el))
204
200
  }, [])
205
201
 
206
202
  const menuProps: MenuProps = useMemo(
@@ -290,3 +286,4 @@ export const MenuButton = forwardRef(function MenuButton(
290
286
  </Popover>
291
287
  )
292
288
  })
289
+ MenuButton.displayName = 'ForwardRef(MenuButton)'
@@ -9,3 +9,4 @@ export const MenuDivider = styled.hr`
9
9
  background: var(--card-hairline-soft-color);
10
10
  margin: 0;
11
11
  `
12
+ MenuDivider.displayName = 'MenuDivider'
@@ -1,5 +1,5 @@
1
1
  import {ChevronRightIcon} from '@sanity/icons'
2
- import {isValidElement, useCallback, useEffect, useRef, useState} from 'react'
2
+ import {isValidElement, useCallback, useEffect, useState} from 'react'
3
3
  import {isValidElementType} from 'react-is'
4
4
  import {useArrayProp} from '../../hooks'
5
5
  import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
@@ -58,7 +58,7 @@ export function MenuGroup(
58
58
  } = menu
59
59
  const [rootElement, setRootElement] = useState<HTMLButtonElement | HTMLDivElement | null>(null)
60
60
  const [open, setOpen] = useState(false)
61
- const shouldFocusRef = useRef<'first' | 'last' | null>(null)
61
+ const [shouldFocus, setShouldFocus] = useState<'first' | 'last' | null>(null)
62
62
  const active = Boolean(activeElement) && activeElement === rootElement
63
63
  const [withinMenu, setWithinMenu] = useState(false)
64
64
 
@@ -88,22 +88,17 @@ export function MenuGroup(
88
88
 
89
89
  const handleClick = useCallback(
90
90
  (event: React.MouseEvent<HTMLDivElement>) => {
91
- if (onClick) onClick(event)
92
-
93
- shouldFocusRef.current = 'first'
91
+ onClick?.(event)
94
92
 
93
+ setShouldFocus('first')
95
94
  setOpen(true)
96
-
97
- requestAnimationFrame(() => {
98
- shouldFocusRef.current = null
99
- })
100
95
  },
101
96
  [onClick],
102
97
  )
103
98
 
104
99
  const handleChildItemClick = useCallback(() => {
105
100
  setOpen(false)
106
- if (onItemClick) onItemClick()
101
+ onItemClick?.()
107
102
  }, [onItemClick])
108
103
 
109
104
  const handleMenuMouseEnter = useCallback(() => setWithinMenu(true), [])
@@ -121,6 +116,16 @@ export function MenuGroup(
121
116
  if (!open) setWithinMenu(false)
122
117
  }, [open])
123
118
 
119
+ // Reset the shouldFocus state after it has been used
120
+ useEffect(() => {
121
+ if (!shouldFocus) return
122
+ // The useMenuController effect that handles `shouldFocus` schedules a request animation frame where it's processed.
123
+ // By doing the same here, we ensure that the reset is processed after the focus change.
124
+ const rafId = requestAnimationFrame(() => setShouldFocus(null))
125
+
126
+ return () => cancelAnimationFrame(rafId)
127
+ }, [shouldFocus])
128
+
124
129
  const childMenu = (
125
130
  <Menu
126
131
  onClickOutside={onClickOutside}
@@ -129,7 +134,7 @@ export function MenuGroup(
129
134
  onKeyDown={handleMenuKeyDown}
130
135
  onMouseEnter={handleMenuMouseEnter}
131
136
  registerElement={registerElement}
132
- shouldFocus={shouldFocusRef.current}
137
+ shouldFocus={shouldFocus}
133
138
  >
134
139
  {children}
135
140
  </Menu>
@@ -143,15 +148,10 @@ export function MenuGroup(
143
148
  }
144
149
 
145
150
  if (event.key === 'ArrowRight') {
146
- shouldFocusRef.current = 'first'
147
-
151
+ setShouldFocus('first')
148
152
  setOpen(true)
149
153
  setWithinMenu(true)
150
154
 
151
- requestAnimationFrame(() => {
152
- shouldFocusRef.current = null
153
- })
154
-
155
155
  return
156
156
  }
157
157
  }, [])
@@ -198,3 +198,5 @@ export function MenuGroup(
198
198
  </Popover>
199
199
  )
200
200
  }
201
+
202
+ MenuGroup.displayName = 'MenuGroup'
@@ -175,3 +175,4 @@ export const MenuItem = forwardRef(function MenuItem(
175
175
  </Selectable>
176
176
  )
177
177
  })
178
+ MenuItem.displayName = 'ForwardRef(MenuItem)'
@@ -1,4 +1,4 @@
1
- import {useCallback, useEffect, useRef, useState} from 'react'
1
+ import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
2
2
  import {_getFocusableElements, _sortElements} from './helpers'
3
3
 
4
4
  /**
@@ -11,8 +11,6 @@ export interface MenuController {
11
11
  handleItemMouseLeave: () => void
12
12
  handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void
13
13
  mount: (element: HTMLElement | null, selected?: boolean) => () => void
14
- rootElement: HTMLDivElement | null
15
- setRootElement: (el: HTMLDivElement | null) => void
16
14
  }
17
15
 
18
16
  /**
@@ -24,14 +22,14 @@ export function useMenuController(props: {
24
22
  onKeyDown?: React.KeyboardEventHandler
25
23
  originElement?: HTMLElement | null
26
24
  shouldFocus: 'first' | 'last' | null
25
+ rootElementRef: React.MutableRefObject<HTMLDivElement | null>
27
26
  }): MenuController {
28
- const {onKeyDown, originElement, shouldFocus} = props
27
+ const {onKeyDown, originElement, shouldFocus, rootElementRef} = props
29
28
  const elementsRef = useRef<HTMLElement[]>([])
30
- const [rootElement, setRootElement] = useState<HTMLDivElement | null>(null)
31
29
  const [activeIndex, _setActiveIndex] = useState(-1)
32
30
  const activeIndexRef = useRef(activeIndex)
33
- const activeElement = elementsRef.current[activeIndex] || null
34
- const mounted = Boolean(rootElement)
31
+ const activeElement = useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex])
32
+ const mounted = Boolean(rootElementRef.current)
35
33
 
36
34
  const setActiveIndex = useCallback((nextActiveIndex: number) => {
37
35
  _setActiveIndex(nextActiveIndex)
@@ -44,7 +42,7 @@ export function useMenuController(props: {
44
42
 
45
43
  if (elementsRef.current.indexOf(element) === -1) {
46
44
  elementsRef.current.push(element)
47
- _sortElements(rootElement, elementsRef.current)
45
+ _sortElements(rootElementRef.current, elementsRef.current)
48
46
  }
49
47
 
50
48
  if (selected) {
@@ -61,7 +59,7 @@ export function useMenuController(props: {
61
59
  }
62
60
  }
63
61
  },
64
- [rootElement, setActiveIndex],
62
+ [rootElementRef, setActiveIndex],
65
63
  )
66
64
 
67
65
  const handleKeyDown = useCallback(
@@ -179,17 +177,15 @@ export function useMenuController(props: {
179
177
  // which would be incorrect when the user hovers over a gap
180
178
  // between two menu items or a menu divider.
181
179
  setActiveIndex(-2)
182
- rootElement?.focus()
183
- }, [setActiveIndex, rootElement])
180
+ rootElementRef.current?.focus()
181
+ }, [rootElementRef, setActiveIndex])
184
182
 
185
183
  // Set focus on the currently active element
186
184
  useEffect(() => {
187
185
  if (!mounted) return
188
186
 
189
- const rafId = window.requestAnimationFrame(() => {
190
- const _activeIndex = activeIndexRef.current
191
-
192
- if (_activeIndex === -1) {
187
+ const rafId = requestAnimationFrame(() => {
188
+ if (activeIndex === -1) {
193
189
  if (shouldFocus === 'first') {
194
190
  const focusableElements = _getFocusableElements(elementsRef.current)
195
191
  const el = focusableElements[0]
@@ -198,7 +194,6 @@ export function useMenuController(props: {
198
194
  const currentIndex = elementsRef.current.indexOf(el)
199
195
 
200
196
  setActiveIndex(currentIndex)
201
- activeIndexRef.current = currentIndex
202
197
  }
203
198
  }
204
199
 
@@ -210,21 +205,18 @@ export function useMenuController(props: {
210
205
  const currentIndex = elementsRef.current.indexOf(el)
211
206
 
212
207
  setActiveIndex(currentIndex)
213
- activeIndexRef.current = currentIndex
214
208
  }
215
209
  }
216
210
 
217
211
  return
218
212
  }
219
213
 
220
- const element = elementsRef.current[_activeIndex] || null
214
+ const element = elementsRef.current[activeIndex] || null
221
215
 
222
216
  element?.focus()
223
217
  })
224
218
 
225
- return () => {
226
- window.cancelAnimationFrame(rafId)
227
- }
219
+ return () => cancelAnimationFrame(rafId)
228
220
  }, [activeIndex, mounted, setActiveIndex, shouldFocus])
229
221
 
230
222
  return {
@@ -234,7 +226,5 @@ export function useMenuController(props: {
234
226
  handleItemMouseLeave,
235
227
  handleKeyDown,
236
228
  mount,
237
- rootElement,
238
- setRootElement,
239
229
  }
240
230
  }
@@ -55,3 +55,4 @@ export const Skeleton = forwardRef(function Skeleton(
55
55
  />
56
56
  )
57
57
  })
58
+ Skeleton.displayName = 'ForwardRef(Skeleton)'
@@ -71,6 +71,7 @@ export const TextSkeleton = forwardRef(function TextSkeleton(
71
71
 
72
72
  return <Root {...restProps} $size={$size} ref={ref} $style="text" />
73
73
  })
74
+ TextSkeleton.displayName = 'ForwardRef(TextSkeleton)'
74
75
 
75
76
  /**
76
77
  * This API might change. DO NOT USE IN PRODUCTION.
@@ -86,6 +87,7 @@ export const LabelSkeleton = forwardRef(function TextSkeleton(
86
87
 
87
88
  return <Root {...restProps} $size={$size} ref={ref} $style="label" />
88
89
  })
90
+ LabelSkeleton.displayName = 'ForwardRef(LabelSkeleton)'
89
91
 
90
92
  /**
91
93
  * This API might change. DO NOT USE IN PRODUCTION.
@@ -101,6 +103,7 @@ export const HeadingSkeleton = forwardRef(function TextSkeleton(
101
103
 
102
104
  return <Root {...restProps} $size={$size} ref={ref} $style="heading" />
103
105
  })
106
+ HeadingSkeleton.displayName = 'ForwardRef(HeadingSkeleton)'
104
107
 
105
108
  /**
106
109
  * This API might change. DO NOT USE IN PRODUCTION.
@@ -116,3 +119,4 @@ export const CodeSkeleton = forwardRef(function TextSkeleton(
116
119
 
117
120
  return <Root {...restProps} $size={$size} ref={ref} $style="code" />
118
121
  })
122
+ CodeSkeleton.displayName = 'ForwardRef(CodeSkeleton)'
@@ -97,3 +97,4 @@ export const Tab = forwardRef(function Tab(
97
97
  />
98
98
  )
99
99
  })
100
+ Tab.displayName = 'ForwardRef(Tab)'
@@ -74,3 +74,4 @@ export const TabList = forwardRef(function TabList(
74
74
  </CustomInline>
75
75
  )
76
76
  })
77
+ TabList.displayName = 'ForwardRef(TabList)'
@@ -35,3 +35,4 @@ export const TabPanel = forwardRef(function TabPanel(
35
35
  </Box>
36
36
  )
37
37
  })
38
+ TabPanel.displayName = 'ForwardRef(TabPanel)'
@@ -14,7 +14,7 @@ const loadingAnimation = keyframes`
14
14
  }
15
15
  100% {
16
16
  width: 100%;
17
- }
17
+ }
18
18
  `
19
19
 
20
20
  const LOADING_BAR_HEIGHT = 2
@@ -103,3 +103,5 @@ export function Toast(
103
103
  </Root>
104
104
  )
105
105
  }
106
+
107
+ Toast.displayName = 'Toast'
@@ -189,3 +189,5 @@ export function ToastProvider(props: ToastProviderProps): React.ReactElement {
189
189
  </ToastContext.Provider>
190
190
  )
191
191
  }
192
+
193
+ ToastProvider.displayName = 'ToastProvider'
@@ -233,5 +233,4 @@ export const Tree = memo(
233
233
  )
234
234
  }),
235
235
  )
236
-
237
- Tree.displayName = 'Tree'
236
+ Tree.displayName = 'Memo(ForwardRef(Tree))'
@@ -201,3 +201,4 @@ export const TreeItem = memo(function TreeItem(
201
201
  </Root>
202
202
  )
203
203
  })
204
+ TreeItem.displayName = 'Memo(TreeItem)'
@@ -35,15 +35,13 @@ export function useClickOutsideEvent(
35
35
  return
36
36
  }
37
37
 
38
- const resolvedBoundaryElement =
39
- typeof boundaryElement === 'function' ? boundaryElement() : boundaryElement
38
+ const resolvedBoundaryElement = boundaryElement?.()
40
39
 
41
40
  if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target)) {
42
41
  return
43
42
  }
44
43
 
45
- const resolvedElements = Array.isArray(elementsArg) ? elementsArg : elementsArg()
46
- const elements = resolvedElements.flat()
44
+ const elements = elementsArg().flat()
47
45
 
48
46
  for (const el of elements) {
49
47
  if (!el) continue
@@ -11,3 +11,4 @@ export const Selectable = styled(Box)<SelectableStyleProps & ResponsiveRadiusSty
11
11
  selectableBaseStyle,
12
12
  selectableColorStyle,
13
13
  )
14
+ Selectable.displayName = 'Selectable'
@@ -194,3 +194,4 @@ export const Avatar = forwardRef(function Avatar(
194
194
  </Root>
195
195
  )
196
196
  })
197
+ Avatar.displayName = 'ForwardRef(Avatar)'
@@ -90,3 +90,4 @@ export const AvatarCounter = forwardRef(function AvatarCounter(
90
90
  </Root>
91
91
  )
92
92
  })
93
+ AvatarCounter.displayName = 'ForwardRef(AvatarCounter)'
@@ -97,3 +97,4 @@ export const AvatarStack = forwardRef(function AvatarStack(
97
97
  </Root>
98
98
  )
99
99
  })
100
+ AvatarStack.displayName = 'ForwardRef(AvatarStack)'
@@ -58,3 +58,4 @@ export const Badge = forwardRef(function Badge(
58
58
  </Root>
59
59
  )
60
60
  })
61
+ Badge.displayName = 'ForwardRef(Badge)'
@@ -127,3 +127,4 @@ export const Box = forwardRef(function Box(
127
127
  </Root>
128
128
  )
129
129
  })
130
+ Box.displayName = 'ForwardRef(Box)'
@@ -178,3 +178,4 @@ export const Button = forwardRef(function Button(
178
178
  </Root>
179
179
  )
180
180
  })
181
+ Button.displayName = 'ForwardRef(Button)'
@@ -112,3 +112,4 @@ export const Card = forwardRef(function Card(
112
112
  </ThemeColorProvider>
113
113
  )
114
114
  })
115
+ Card.displayName = 'ForwardRef(Card)'
@@ -69,3 +69,4 @@ export const Checkbox = forwardRef(function Checkbox(
69
69
  </Root>
70
70
  )
71
71
  })
72
+ Checkbox.displayName = 'ForwardRef(Checkbox)'
@@ -37,3 +37,4 @@ export const Code = forwardRef(function Code(
37
37
  </Root>
38
38
  )
39
39
  })
40
+ Code.displayName = 'ForwardRef(Code)'
@@ -37,3 +37,4 @@ export const Container = forwardRef(function Container(
37
37
  />
38
38
  )
39
39
  })
40
+ Container.displayName = 'ForwardRef(Container)'
@@ -50,3 +50,4 @@ export const Flex = forwardRef(function Flex(
50
50
  />
51
51
  )
52
52
  })
53
+ Flex.displayName = 'ForwardRef(Flex)'
@@ -44,3 +44,4 @@ export const Grid = forwardRef(function Grid(
44
44
  </Root>
45
45
  )
46
46
  })
47
+ Grid.displayName = 'ForwardRef(Grid)'
@@ -83,3 +83,4 @@ export const Heading = forwardRef(function Heading(
83
83
  </Root>
84
84
  )
85
85
  })
86
+ Heading.displayName = 'ForwardRef(Heading)'
@@ -44,3 +44,4 @@ export const Inline = forwardRef(function Inline(
44
44
  </Root>
45
45
  )
46
46
  })
47
+ Inline.displayName = 'ForwardRef(Inline)'
@@ -57,3 +57,4 @@ export const KBD = forwardRef(function KBD(
57
57
  </Root>
58
58
  )
59
59
  })
60
+ KBD.displayName = 'ForwardRef(KBD)'
@@ -82,3 +82,4 @@ export const Label = forwardRef(function Label(
82
82
  </Root>
83
83
  )
84
84
  })
85
+ Label.displayName = 'ForwardRef(Label)'
@@ -454,5 +454,4 @@ export const Popover = memo(
454
454
  )
455
455
  }),
456
456
  )
457
-
458
- Popover.displayName = 'Popover'
457
+ Popover.displayName = 'Memo(ForwardRef(Popover))'
@@ -152,5 +152,4 @@ export const PopoverCard = memo(
152
152
  )
153
153
  }),
154
154
  )
155
-
156
- PopoverCard.displayName = 'PopoverCard'
155
+ PopoverCard.displayName = 'Memo(ForwardRef(PopoverCard))'
@@ -47,3 +47,4 @@ export const Radio = forwardRef(function Radio(
47
47
  </Root>
48
48
  )
49
49
  })
50
+ Radio.displayName = 'ForwardRef(Radio)'
@@ -83,3 +83,4 @@ export const Select = forwardRef(function Select(
83
83
  </Root>
84
84
  )
85
85
  })
86
+ Select.displayName = 'ForwardRef(Select)'
@@ -42,3 +42,4 @@ export const Spinner = forwardRef(function Spinner(
42
42
  </Root>
43
43
  )
44
44
  })
45
+ Spinner.displayName = 'ForwardRef(Spinner)'
@@ -36,3 +36,4 @@ export const Stack = forwardRef(function Stack(
36
36
  />
37
37
  )
38
38
  })
39
+ Stack.displayName = 'ForwardRef(Stack)'
@@ -64,3 +64,4 @@ export const Switch = forwardRef(function Switch(
64
64
  </Root>
65
65
  )
66
66
  })
67
+ Switch.displayName = 'ForwardRef(Switch)'
@@ -84,3 +84,4 @@ export const Text = forwardRef(function Text(
84
84
  </Root>
85
85
  )
86
86
  })
87
+ Text.displayName = 'ForwardRef(Text)'
@@ -115,3 +115,4 @@ export const TextArea = forwardRef(function TextArea(
115
115
  </Root>
116
116
  )
117
117
  })
118
+ TextArea.displayName = 'ForwardRef(TextArea)'
@@ -384,3 +384,4 @@ export const TextInput = forwardRef(function TextInput(
384
384
  </Root>
385
385
  )
386
386
  })
387
+ TextInput.displayName = 'ForwardRef(TextInput)'