@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,6 +1,5 @@
1
1
  import {
2
2
  forwardRef,
3
- memo,
4
3
  useCallback,
5
4
  useEffect,
6
5
  useImperativeHandle,
@@ -26,212 +25,207 @@ export interface TreeProps {
26
25
  * This API might change. DO NOT USE IN PRODUCTION.
27
26
  * @beta
28
27
  */
29
- export const Tree = memo(
30
- forwardRef(function Tree(
31
- props: TreeProps &
32
- Omit<React.HTMLProps<HTMLDivElement>, 'align' | 'as' | 'height' | 'ref' | 'role' | 'wrap'>,
33
- forwardedRef: React.ForwardedRef<HTMLDivElement>,
34
- ): React.JSX.Element {
35
- const {children, space = 1, onFocus, ...restProps} = props
36
- const ref = useRef<HTMLDivElement | null>(null)
37
- const [focusedElement, setFocusedElement] = useState<HTMLElement | null>(null)
38
- const focusedElementRef = useRef(focusedElement)
39
- const path: string[] = useMemo(() => [], [])
40
- const [itemElements, setItemElements] = useState<HTMLElement[]>([])
41
- const [state, setState] = useState<TreeState>({})
42
- const stateRef = useRef(state)
43
-
44
- useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(
45
- forwardedRef,
46
- () => ref.current,
47
- )
48
-
49
- useEffect(() => {
50
- focusedElementRef.current = focusedElement
51
- }, [focusedElement])
52
-
53
- useEffect(() => {
54
- stateRef.current = state
55
- }, [state])
56
-
57
- const registerItem = useCallback(
58
- (element: HTMLElement, path: string, expanded: boolean, selected: boolean) => {
59
- setState((s) => ({...s, [path]: {element, expanded}}))
60
-
61
- if (selected) {
62
- setFocusedElement(element)
28
+ export const Tree = forwardRef(function Tree(
29
+ props: TreeProps &
30
+ Omit<React.HTMLProps<HTMLDivElement>, 'align' | 'as' | 'height' | 'ref' | 'role' | 'wrap'>,
31
+ forwardedRef: React.ForwardedRef<HTMLDivElement>,
32
+ ): React.JSX.Element {
33
+ const {children, space = 1, onFocus, ...restProps} = props
34
+ const ref = useRef<HTMLDivElement | null>(null)
35
+ const [focusedElement, setFocusedElement] = useState<HTMLElement | null>(null)
36
+ const focusedElementRef = useRef(focusedElement)
37
+ const path: string[] = useMemo(() => [], [])
38
+ const [itemElements, setItemElements] = useState<HTMLElement[]>([])
39
+ const [state, setState] = useState<TreeState>({})
40
+ const stateRef = useRef(state)
41
+
42
+ useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)
43
+
44
+ useEffect(() => {
45
+ focusedElementRef.current = focusedElement
46
+ }, [focusedElement])
47
+
48
+ useEffect(() => {
49
+ stateRef.current = state
50
+ }, [state])
51
+
52
+ const registerItem = useCallback(
53
+ (element: HTMLElement, path: string, expanded: boolean, selected: boolean) => {
54
+ setState((s) => ({...s, [path]: {element, expanded}}))
55
+
56
+ if (selected) {
57
+ setFocusedElement(element)
58
+ }
59
+
60
+ return () => {
61
+ setState((s) => {
62
+ const newState = {...s}
63
+
64
+ delete newState[path]
65
+
66
+ return newState
67
+ })
68
+ }
69
+ },
70
+ [],
71
+ )
72
+
73
+ const setExpanded = useCallback((path: string, expanded: boolean) => {
74
+ setState((s) => {
75
+ const itemState = s[path]
76
+
77
+ if (!itemState) return s
78
+
79
+ return {...s, [path]: {...itemState, expanded}}
80
+ })
81
+ }, [])
82
+
83
+ const contextValue: TreeContextValue = useMemo(
84
+ () => ({
85
+ version: 0.0,
86
+ focusedElement: focusedElement || itemElements[0] || null,
87
+ level: 0,
88
+ path,
89
+ registerItem,
90
+ setExpanded,
91
+ setFocusedElement,
92
+ space,
93
+ state,
94
+ }),
95
+ [focusedElement, itemElements, path, registerItem, setExpanded, space, state],
96
+ )
97
+
98
+ const handleKeyDown = useCallback(
99
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
100
+ if (!focusedElementRef.current) return
101
+
102
+ if (event.key === 'ArrowDown') {
103
+ event.preventDefault()
104
+
105
+ const nextEl = _findNextItemElement(
106
+ stateRef.current,
107
+ itemElements,
108
+ focusedElementRef.current,
109
+ )
110
+
111
+ if (nextEl) {
112
+ _focusItemElement(nextEl)
113
+ setFocusedElement(nextEl)
63
114
  }
64
115
 
65
- return () => {
66
- setState((s) => {
67
- const newState = {...s}
116
+ return
117
+ }
68
118
 
69
- delete newState[path]
119
+ if (event.key === 'ArrowUp') {
120
+ event.preventDefault()
70
121
 
71
- return newState
72
- })
73
- }
74
- },
75
- [],
76
- )
77
-
78
- const setExpanded = useCallback((path: string, expanded: boolean) => {
79
- setState((s) => {
80
- const itemState = s[path]
81
-
82
- if (!itemState) return s
83
-
84
- return {...s, [path]: {...itemState, expanded}}
85
- })
86
- }, [])
87
-
88
- const contextValue: TreeContextValue = useMemo(
89
- () => ({
90
- version: 0.0,
91
- focusedElement: focusedElement || itemElements[0] || null,
92
- level: 0,
93
- path,
94
- registerItem,
95
- setExpanded,
96
- setFocusedElement,
97
- space,
98
- state,
99
- }),
100
- [focusedElement, itemElements, path, registerItem, setExpanded, space, state],
101
- )
102
-
103
- const handleKeyDown = useCallback(
104
- (event: React.KeyboardEvent<HTMLDivElement>) => {
105
- if (!focusedElementRef.current) return
106
-
107
- if (event.key === 'ArrowDown') {
108
- event.preventDefault()
109
-
110
- const nextEl = _findNextItemElement(
111
- stateRef.current,
112
- itemElements,
113
- focusedElementRef.current,
114
- )
115
-
116
- if (nextEl) {
117
- _focusItemElement(nextEl)
118
- setFocusedElement(nextEl)
119
- }
122
+ const prevEl = _findPrevItemElement(
123
+ stateRef.current,
124
+ itemElements,
125
+ focusedElementRef.current,
126
+ )
120
127
 
121
- return
128
+ if (prevEl) {
129
+ _focusItemElement(prevEl)
130
+ setFocusedElement(prevEl)
122
131
  }
123
132
 
124
- if (event.key === 'ArrowUp') {
125
- event.preventDefault()
126
-
127
- const prevEl = _findPrevItemElement(
128
- stateRef.current,
129
- itemElements,
130
- focusedElementRef.current,
131
- )
132
-
133
- if (prevEl) {
134
- _focusItemElement(prevEl)
135
- setFocusedElement(prevEl)
136
- }
137
-
138
- return
139
- }
133
+ return
134
+ }
140
135
 
141
- if (event.key === 'ArrowLeft') {
142
- event.preventDefault()
136
+ if (event.key === 'ArrowLeft') {
137
+ event.preventDefault()
143
138
 
144
- const itemKey = focusedElementRef.current.getAttribute('data-tree-key')
139
+ const itemKey = focusedElementRef.current.getAttribute('data-tree-key')
145
140
 
146
- if (!itemKey) return
141
+ if (!itemKey) return
147
142
 
148
- const itemState = stateRef.current[itemKey]
143
+ const itemState = stateRef.current[itemKey]
149
144
 
150
- if (!itemState) return
145
+ if (!itemState) return
151
146
 
152
- if (itemState.expanded) {
153
- setState((s) => {
154
- const itemState = s[itemKey]
147
+ if (itemState.expanded) {
148
+ setState((s) => {
149
+ const itemState = s[itemKey]
155
150
 
156
- if (!itemState) return s
151
+ if (!itemState) return s
157
152
 
158
- return {...s, [itemKey]: {...itemState, expanded: false}}
159
- })
160
- } else {
161
- const itemPath = itemKey.split('/')
153
+ return {...s, [itemKey]: {...itemState, expanded: false}}
154
+ })
155
+ } else {
156
+ const itemPath = itemKey.split('/')
162
157
 
163
- itemPath.pop()
158
+ itemPath.pop()
164
159
 
165
- const parentKey = itemPath.join('/')
166
- const parentState = parentKey && stateRef.current[parentKey]
160
+ const parentKey = itemPath.join('/')
161
+ const parentState = parentKey && stateRef.current[parentKey]
167
162
 
168
- if (parentState) {
169
- parentState.element.focus()
170
- setFocusedElement(parentState.element)
171
- }
163
+ if (parentState) {
164
+ parentState.element.focus()
165
+ setFocusedElement(parentState.element)
172
166
  }
173
-
174
- return
175
167
  }
176
168
 
177
- if (event.key === 'ArrowRight') {
178
- event.preventDefault()
169
+ return
170
+ }
179
171
 
180
- const focusedKey = focusedElementRef.current.getAttribute('data-tree-key')
172
+ if (event.key === 'ArrowRight') {
173
+ event.preventDefault()
181
174
 
182
- if (!focusedKey) return
175
+ const focusedKey = focusedElementRef.current.getAttribute('data-tree-key')
183
176
 
184
- if (!stateRef.current[focusedKey]?.expanded) {
185
- setState((s) => {
186
- const itemState = s[focusedKey]
177
+ if (!focusedKey) return
187
178
 
188
- if (!itemState) return s
179
+ if (!stateRef.current[focusedKey]?.expanded) {
180
+ setState((s) => {
181
+ const itemState = s[focusedKey]
189
182
 
190
- return {...s, [focusedKey]: {...itemState, expanded: true}}
191
- })
192
- }
183
+ if (!itemState) return s
193
184
 
194
- return
185
+ return {...s, [focusedKey]: {...itemState, expanded: true}}
186
+ })
195
187
  }
196
- },
197
- [itemElements],
198
- )
199
-
200
- const handleFocus = useCallback(
201
- (event: React.FocusEvent<HTMLDivElement>) => {
202
- setFocusedElement(event.target)
203
-
204
- // Call the element's `focus` handler
205
- onFocus?.(event)
206
- },
207
- [onFocus],
208
- )
209
-
210
- useEffect(() => {
211
- if (!ref.current) return
212
- const _itemElements = Array.from(
213
- ref.current.querySelectorAll('[data-ui="TreeItem"]'),
214
- ) as HTMLElement[]
215
-
216
- setItemElements(_itemElements)
217
- }, [children])
218
-
219
- return (
220
- <TreeContext.Provider value={contextValue}>
221
- <Stack
222
- as="ul"
223
- data-ui="Tree"
224
- {...restProps}
225
- onFocus={handleFocus}
226
- onKeyDown={handleKeyDown}
227
- ref={ref}
228
- role="tree"
229
- space={space}
230
- >
231
- {children}
232
- </Stack>
233
- </TreeContext.Provider>
234
- )
235
- }),
236
- )
237
- Tree.displayName = 'Memo(ForwardRef(Tree))'
188
+
189
+ return
190
+ }
191
+ },
192
+ [itemElements],
193
+ )
194
+
195
+ const handleFocus = useCallback(
196
+ (event: React.FocusEvent<HTMLDivElement>) => {
197
+ setFocusedElement(event.target)
198
+
199
+ // Call the element's `focus` handler
200
+ onFocus?.(event)
201
+ },
202
+ [onFocus],
203
+ )
204
+
205
+ useEffect(() => {
206
+ if (!ref.current) return
207
+ const _itemElements = Array.from(
208
+ ref.current.querySelectorAll('[data-ui="TreeItem"]'),
209
+ ) as HTMLElement[]
210
+
211
+ setItemElements(_itemElements)
212
+ }, [children])
213
+
214
+ return (
215
+ <TreeContext.Provider value={contextValue}>
216
+ <Stack
217
+ as="ul"
218
+ data-ui="Tree"
219
+ {...restProps}
220
+ onFocus={handleFocus}
221
+ onKeyDown={handleKeyDown}
222
+ ref={ref}
223
+ role="tree"
224
+ space={space}
225
+ >
226
+ {children}
227
+ </Stack>
228
+ </TreeContext.Provider>
229
+ )
230
+ })
231
+ Tree.displayName = 'ForwardRef(Tree)'
@@ -1,5 +1,3 @@
1
- import {memo} from 'react'
2
-
3
1
  import {Stack} from '../../primitives'
4
2
  import {useTree} from './useTree'
5
3
 
@@ -7,7 +5,7 @@ export interface TreeGroupProps {
7
5
  expanded?: boolean
8
6
  }
9
7
 
10
- export const TreeGroup = memo(function TreeGroup(
8
+ export function TreeGroup(
11
9
  props: TreeGroupProps &
12
10
  Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'role' | 'wrap'>,
13
11
  ): React.JSX.Element {
@@ -27,4 +25,4 @@ export const TreeGroup = memo(function TreeGroup(
27
25
  {children}
28
26
  </Stack>
29
27
  )
30
- })
28
+ }
@@ -1,6 +1,6 @@
1
1
  import {ToggleArrowRightIcon} from '@sanity/icons'
2
2
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
3
- import {memo, useCallback, useEffect, useId, useMemo, useRef, useState} from 'react'
3
+ import {useCallback, useEffect, useId, useMemo, useRef, useState} from 'react'
4
4
  import {styled} from 'styled-components'
5
5
 
6
6
  import {Box, BoxProps, Flex, Text} from '../../primitives'
@@ -31,7 +31,7 @@ export interface TreeItemProps {
31
31
  weight?: ThemeFontWeightKey
32
32
  }
33
33
 
34
- const StyledTreeItem = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle))
34
+ const StyledTreeItem = styled.li(treeItemRootStyle, treeItemRootColorStyle)
35
35
 
36
36
  const TreeItemBox = styled(Box).attrs({forwardedAs: 'a'})<TreeItemBoxStyleProps>(treeItemBoxStyle)
37
37
 
@@ -45,7 +45,7 @@ const ToggleArrowText = styled(Text)`
45
45
  * This API might change. DO NOT USE IN PRODUCTION.
46
46
  * @beta
47
47
  */
48
- export const TreeItem = memo(function TreeItem(
48
+ export function TreeItem(
49
49
  props: TreeItemProps & Omit<React.HTMLProps<HTMLLIElement>, 'as' | 'ref' | 'role'>,
50
50
  ): React.JSX.Element {
51
51
  const {
@@ -203,5 +203,5 @@ export const TreeItem = memo(function TreeItem(
203
203
  </TreeContext.Provider>
204
204
  </StyledTreeItem>
205
205
  )
206
- })
207
- TreeItem.displayName = 'Memo(TreeItem)'
206
+ }
207
+ TreeItem.displayName = 'TreeItem'
@@ -1,4 +1,4 @@
1
- export * from './useArrayProp'
1
+ export {type ArrayPropPrimitive, useArrayProp} from './useArrayProp'
2
2
  export * from './useClickOutside'
3
3
  export * from './useClickOutsideEvent'
4
4
  export * from './useCustomValidity'
@@ -1,4 +1,4 @@
1
- import {useState} from 'react'
1
+ import {useMemo} from 'react'
2
2
 
3
3
  import {_getArrayProp} from '../styles'
4
4
 
@@ -6,26 +6,14 @@ import {_getArrayProp} from '../styles'
6
6
  export type ArrayPropPrimitive = string | number | boolean | undefined | null
7
7
 
8
8
  /**
9
- * This API might change. DO NOT USE IN PRODUCTION.
9
+ * @deprecated instead of `useArrayProp(width)` use `Array.isArray(width) ? width : [width]` instead
10
10
  * @beta
11
11
  */
12
12
  export function useArrayProp<T extends ArrayPropPrimitive = ArrayPropPrimitive>(
13
13
  val: T | T[] | undefined,
14
14
  defaultVal?: T[],
15
15
  ): T[] {
16
- const [[cachedVal, cachedHash], setCache] = useState<[T[], string]>(() => [
17
- _getArrayProp(val, defaultVal),
18
- JSON.stringify(val ?? defaultVal),
19
- ])
20
-
21
- const hash = JSON.stringify(val ?? defaultVal)
22
-
23
- if (hash !== cachedHash) {
24
- // If the cached hash has changed, update the cache right away.
25
- // Calling setState during render is fine in this case, and preferred over a useEffect loop
26
- // https://19.react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes
27
- setCache([_getArrayProp(val, defaultVal), hash])
28
- }
29
-
30
- return cachedVal
16
+ return useMemo(() => _getArrayProp(val, defaultVal), [val, defaultVal])
31
17
  }
18
+
19
+ export {_getArrayProp as getArrayProp}
@@ -1,9 +1,9 @@
1
1
  import {ThemeColorAvatarColorKey} from '@sanity/ui/theme'
2
- import {forwardRef, useCallback, useEffect, useId, useMemo, useState} from 'react'
2
+ import {forwardRef, useCallback, useEffect, useId, useState} from 'react'
3
3
  import ReactIs from 'react-is'
4
4
  import {styled} from 'styled-components'
5
5
 
6
- import {useArrayProp} from '../../hooks'
6
+ import {getArrayProp} from '../../hooks/useArrayProp'
7
7
  import {useTheme_v2} from '../../theme'
8
8
  import {AvatarPosition, AvatarSize, AvatarStatus} from '../../types'
9
9
  import {Label} from '../label'
@@ -75,7 +75,7 @@ export const Avatar = forwardRef(function Avatar(
75
75
  } = props
76
76
  const {avatar} = useTheme_v2()
77
77
  const as = ReactIs.isValidElementType(asProp) ? asProp : 'div'
78
- const size = useArrayProp(sizeProp)
78
+ const size = getArrayProp(sizeProp)
79
79
 
80
80
  // eslint-disable-next-line no-warning-comments
81
81
  // @todo: remove this
@@ -113,18 +113,6 @@ export const Avatar = forwardRef(function Avatar(
113
113
  }
114
114
  }, [onImageLoadError])
115
115
 
116
- const initialsSize = useMemo(
117
- () =>
118
- size.map((s) => {
119
- if (s === 1) return 1
120
- if (s === 2) return 3
121
- if (s === 3) return 5
122
-
123
- return 0
124
- }),
125
- [size],
126
- )
127
-
128
116
  return (
129
117
  <StyledAvatar
130
118
  as={as}
@@ -181,7 +169,17 @@ export const Avatar = forwardRef(function Avatar(
181
169
  {(imageFailed || !src) && initials && (
182
170
  <>
183
171
  <Initials>
184
- <InitialsLabel forwardedAs="span" size={initialsSize} weight="medium">
172
+ <InitialsLabel
173
+ forwardedAs="span"
174
+ size={size.map((s) => {
175
+ if (s === 1) return 1
176
+ if (s === 2) return 3
177
+ if (s === 3) return 5
178
+
179
+ return 0
180
+ })}
181
+ weight="medium"
182
+ >
185
183
  {initials}
186
184
  </InitialsLabel>
187
185
  </Initials>
@@ -1,9 +1,9 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
- import {forwardRef, useMemo} from 'react'
2
+ import {forwardRef} from 'react'
3
3
  import {css, styled} from 'styled-components'
4
4
 
5
5
  import {EMPTY_RECORD} from '../../constants'
6
- import {useArrayProp} from '../../hooks'
6
+ import {getArrayProp} from '../../hooks/useArrayProp'
7
7
  import {_responsive, rem, ThemeProps} from '../../styles'
8
8
  import {AvatarSize} from '../../types'
9
9
  import {Label} from '../label'
@@ -69,23 +69,21 @@ export const AvatarCounter = forwardRef(function AvatarCounter(
69
69
  ref: React.Ref<HTMLDivElement>,
70
70
  ) {
71
71
  const {count, size: sizeProp = 1} = props
72
- const size = useArrayProp(sizeProp)
73
-
74
- const fontSize = useMemo(
75
- () =>
76
- size.map((s) => {
77
- if (s === 1) return 1
78
- if (s === 2) return 3
79
- if (s === 3) return 5
80
-
81
- return 0
82
- }),
83
- [size],
84
- )
72
+ const size = getArrayProp(sizeProp)
85
73
 
86
74
  return (
87
75
  <StyledAvatarCounter $size={size} data-ui="AvatarCounter" ref={ref}>
88
- <Label as="span" size={fontSize} weight="medium">
76
+ <Label
77
+ as="span"
78
+ size={size.map((s) => {
79
+ if (s === 1) return 1
80
+ if (s === 2) return 3
81
+ if (s === 3) return 5
82
+
83
+ return 0
84
+ })}
85
+ weight="medium"
86
+ >
89
87
  {count}
90
88
  </Label>
91
89
  </StyledAvatarCounter>
@@ -3,7 +3,7 @@ import {Children, cloneElement, forwardRef, isValidElement} from 'react'
3
3
  import {css, styled} from 'styled-components'
4
4
 
5
5
  import {EMPTY_RECORD} from '../../constants'
6
- import {useArrayProp} from '../../hooks'
6
+ import {getArrayProp} from '../../hooks/useArrayProp'
7
7
  import {_responsive, rem, ThemeProps} from '../../styles'
8
8
  import {AvatarSize} from '../../types'
9
9
  import {AvatarCounter} from './avatarCounter'
@@ -71,7 +71,7 @@ export const AvatarStack = forwardRef(function AvatarStack(
71
71
  } = props
72
72
  const children: React.JSX.Element[] = Children.toArray(childrenProp).filter(isValidElement)
73
73
  const maxLength = Math.max(maxLengthProp, 0)
74
- const size = useArrayProp(sizeProp)
74
+ const size = getArrayProp(sizeProp)
75
75
 
76
76
  const len = children.length
77
77
  const visibleCount = maxLength - 1
@@ -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 {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
6
6
  import {BadgeMode, BadgeTone} from '../../types'
7
7
  import {Box, BoxProps} from '../box'
@@ -51,8 +51,8 @@ export const Badge = forwardRef(function Badge(
51
51
  data-ui="Badge"
52
52
  {...restProps}
53
53
  $tone={tone}
54
- $radius={useArrayProp(radius)}
55
- padding={useArrayProp(padding)}
54
+ $radius={getArrayProp(radius)}
55
+ padding={getArrayProp(padding)}
56
56
  ref={ref}
57
57
  >
58
58
  <Text size={fontSize}>{children}</Text>