@sanity/ui 3.0.13 → 3.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +805 -609
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +807 -611
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/index.d.mts +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +182 -142
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +183 -143
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/src/core/components/autocomplete/autocomplete.tsx +10 -14
  13. package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -2
  14. package/src/core/components/dialog/dialog.tsx +10 -14
  15. package/src/core/components/hotkeys/hotkeys.tsx +2 -2
  16. package/src/core/components/menu/menuGroup.tsx +2 -2
  17. package/src/core/components/menu/menuItem.tsx +4 -4
  18. package/src/core/components/skeleton/skeleton.tsx +2 -2
  19. package/src/core/components/skeleton/textSkeleton.tsx +5 -6
  20. package/src/core/hooks/index.ts +1 -1
  21. package/src/core/hooks/useArrayProp.ts +3 -17
  22. package/src/core/primitives/avatar/avatar.tsx +14 -16
  23. package/src/core/primitives/avatar/avatarCounter.tsx +14 -17
  24. package/src/core/primitives/avatar/avatarStack.tsx +2 -3
  25. package/src/core/primitives/badge/badge.tsx +3 -3
  26. package/src/core/primitives/box/box.tsx +26 -26
  27. package/src/core/primitives/button/button.tsx +11 -12
  28. package/src/core/primitives/card/card.tsx +8 -8
  29. package/src/core/primitives/code/code.tsx +8 -2
  30. package/src/core/primitives/container/container.tsx +2 -2
  31. package/src/core/primitives/flex/flex.tsx +6 -6
  32. package/src/core/primitives/grid/grid.tsx +9 -9
  33. package/src/core/primitives/heading/heading.tsx +3 -3
  34. package/src/core/primitives/inline/inline.tsx +2 -2
  35. package/src/core/primitives/kbd/kbd.tsx +2 -2
  36. package/src/core/primitives/label/label.tsx +3 -3
  37. package/src/core/primitives/popover/popover.tsx +7 -6
  38. package/src/core/primitives/select/select.tsx +6 -5
  39. package/src/core/primitives/stack/stack.tsx +2 -2
  40. package/src/core/primitives/text/text.tsx +3 -3
  41. package/src/core/primitives/textArea/textArea.tsx +6 -5
  42. package/src/core/primitives/textInput/textInput.tsx +6 -5
  43. package/src/core/primitives/tooltip/tooltip.tsx +3 -2
  44. package/src/core/utils/layer/layerProvider.tsx +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "3.0.13",
3
+ "version": "3.0.14",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -21,7 +21,6 @@ import {
21
21
 
22
22
  import {EMPTY_ARRAY, EMPTY_RECORD} from '../../constants'
23
23
  import {_hasFocus, _raf, focusFirstDescendant} from '../../helpers'
24
- import {useArrayProp} from '../../hooks'
25
24
  import {
26
25
  Box,
27
26
  BoxProps,
@@ -33,6 +32,7 @@ import {
33
32
  Text,
34
33
  TextInput,
35
34
  } from '../../primitives'
35
+ import {_getArrayProp} from '../../styles'
36
36
  import {Radius} from '../../types'
37
37
  import {AnimatedSpinnerIcon, ListBox, StyledAutocomplete} from './autocomplete.styles'
38
38
  import {AutocompleteOption} from './autocompleteOption'
@@ -214,7 +214,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
214
214
 
215
215
  const listBoxId = `${id}-listbox`
216
216
  const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY
217
- const padding = useArrayProp(paddingProp)
217
+ const padding = _getArrayProp(paddingProp)
218
218
  const currentOption = useMemo(
219
219
  () => (value !== null ? options.find((o) => o.value === value) : undefined),
220
220
  [options, value],
@@ -470,18 +470,14 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
470
470
  return undefined
471
471
  }, [disabled, handleClearButtonFocus, loading, value])
472
472
 
473
- const openButtonBoxPadding = useMemo(
474
- () =>
475
- padding.map((v) => {
476
- if (v === 0) return 0
477
- if (v === 1) return 1
478
- if (v === 2) return 1
479
-
480
- return v - 2
481
- }),
482
- [padding],
483
- )
484
- const openButtonPadding = useMemo(() => padding.map((v) => Math.max(v - 1, 0)), [padding])
473
+ const openButtonBoxPadding = padding.map((v) => {
474
+ if (v === 0) return 0
475
+ if (v === 1) return 1
476
+ if (v === 2) return 1
477
+
478
+ return v - 2
479
+ })
480
+ const openButtonPadding = padding.map((v) => Math.max(v - 1, 0))
485
481
  const openButtonProps: AutocompleteOpenButtonProps = useMemo(
486
482
  () => (typeof openButton === 'object' ? openButton : EMPTY_RECORD),
487
483
  [openButton],
@@ -9,8 +9,9 @@ import {
9
9
  useState,
10
10
  } from 'react'
11
11
 
12
- import {useArrayProp, useClickOutsideEvent} from '../../hooks'
12
+ import {useClickOutsideEvent} from '../../hooks'
13
13
  import {Box, Popover, Stack, Text} from '../../primitives'
14
+ import {_getArrayProp} from '../../styles'
14
15
  import {ExpandButton, StyledBreadcrumbs} from './breadcrumbs.styles'
15
16
 
16
17
  /**
@@ -30,7 +31,7 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
30
31
  ref: React.ForwardedRef<HTMLOListElement>,
31
32
  ) {
32
33
  const {children, maxLength, separator, space: spaceRaw = 2, ...restProps} = props
33
- const space = useArrayProp(spaceRaw)
34
+ const space = _getArrayProp(spaceRaw)
34
35
  const [open, setOpen] = useState(false)
35
36
  const expandElementRef = useRef<HTMLButtonElement | null>(null)
36
37
  const popoverElementRef = useRef<HTMLDivElement | null>(null)
@@ -9,14 +9,10 @@ import {
9
9
  focusLastDescendant,
10
10
  isHTMLElement,
11
11
  } from '../../helpers'
12
- import {
13
- useArrayProp,
14
- useClickOutsideEvent,
15
- useGlobalKeyDown,
16
- usePrefersReducedMotion,
17
- } from '../../hooks'
12
+ import {useClickOutsideEvent, useGlobalKeyDown, usePrefersReducedMotion} from '../../hooks'
18
13
  import {Box, Button, Card, Container, Flex, Text} from '../../primitives'
19
14
  import {ResponsivePaddingProps, ResponsiveWidthProps} from '../../primitives/types'
15
+ import {_getArrayProp} from '../../styles'
20
16
  import {responsivePaddingStyle, ResponsivePaddingStyleProps} from '../../styles/internal'
21
17
  import {useTheme_v2} from '../../theme'
22
18
  import {DialogPosition, Radius} from '../../types'
@@ -172,9 +168,9 @@ const DialogCard = forwardRef(function DialogCard(
172
168
  const portal = usePortal()
173
169
  const portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element
174
170
  const boundaryElement = useBoundaryElement().element
175
- const radius = useArrayProp(radiusProp)
176
- const shadow = useArrayProp(shadowProp)
177
- const width = useArrayProp(widthProp)
171
+ const radius = _getArrayProp(radiusProp)
172
+ const shadow = _getArrayProp(shadowProp)
173
+ const width = _getArrayProp(widthProp)
178
174
  const ref = useRef<HTMLDivElement | null>(null)
179
175
  const contentRef = useRef<HTMLDivElement | null>(null)
180
176
  const layer = useLayer()
@@ -320,11 +316,11 @@ export const Dialog = forwardRef(function Dialog(
320
316
  const portal = usePortal()
321
317
  const portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element
322
318
  const boundaryElement = useBoundaryElement().element
323
- const cardRadius = useArrayProp(cardRadiusProp)
324
- const padding = useArrayProp(paddingProp)
325
- const position = useArrayProp(positionProp)
326
- const width = useArrayProp(widthProp)
327
- const zOffset = useArrayProp(zOffsetProp)
319
+ const cardRadius = _getArrayProp(cardRadiusProp)
320
+ const padding = _getArrayProp(paddingProp)
321
+ const position = _getArrayProp(positionProp)
322
+ const width = _getArrayProp(widthProp)
323
+ const zOffset = _getArrayProp(zOffsetProp)
328
324
  const preDivRef = useRef<HTMLDivElement | null>(null)
329
325
  const postDivRef = useRef<HTMLDivElement | null>(null)
330
326
  const cardRef = useRef<HTMLDivElement | null>(null)
@@ -1,8 +1,8 @@
1
1
  import {forwardRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
3
 
4
- import {useArrayProp} from '../../hooks'
5
4
  import {Inline, KBD} from '../../primitives'
5
+ import {_getArrayProp} from '../../styles'
6
6
  import {Radius} from '../../types'
7
7
 
8
8
  /**
@@ -41,7 +41,7 @@ export const Hotkeys = forwardRef(function Hotkeys(
41
41
  ref: React.Ref<HTMLElement>,
42
42
  ) {
43
43
  const {fontSize, keys, padding, radius, space: spaceProp = 0.5, ...restProps} = props
44
- const space = useArrayProp(spaceProp)
44
+ const space = _getArrayProp(spaceProp)
45
45
 
46
46
  if (!keys || keys.length === 0) {
47
47
  return <></>
@@ -2,9 +2,9 @@ import {ChevronRightIcon} from '@sanity/icons'
2
2
  import {isValidElement, useCallback, useEffect, useState} from 'react'
3
3
  import {isValidElementType} from 'react-is'
4
4
 
5
- import {useArrayProp} from '../../hooks'
6
5
  import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
7
6
  import {Selectable} from '../../primitives/_selectable'
7
+ import {_getArrayProp} from '../../styles'
8
8
  import {useRootTheme} from '../../theme'
9
9
  import {Radius, SelectableTone} from '../../types'
10
10
  import {Menu, MenuProps} from './menu'
@@ -183,7 +183,7 @@ export function MenuGroup(
183
183
  aria-pressed={as === 'button' ? withinMenu : undefined}
184
184
  data-pressed={as !== 'button' ? withinMenu : undefined}
185
185
  data-selected={!withinMenu && active ? '' : undefined}
186
- $radius={useArrayProp(radius)}
186
+ $radius={_getArrayProp(radius)}
187
187
  $tone={tone}
188
188
  $scheme={scheme}
189
189
  onClick={handleClick}
@@ -10,10 +10,10 @@ import {
10
10
  } from 'react'
11
11
  import {isValidElementType} from 'react-is'
12
12
 
13
- import {useArrayProp} from '../../hooks'
14
13
  import {Box, Flex, Text} from '../../primitives'
15
14
  import {Selectable} from '../../primitives/_selectable'
16
15
  import {ResponsivePaddingProps, ResponsiveRadiusProps} from '../../primitives/types'
16
+ import {_getArrayProp} from '../../styles'
17
17
  import {useRootTheme} from '../../theme'
18
18
  import {SelectableTone} from '../../types/selectable'
19
19
  import {Hotkeys} from '../hotkeys'
@@ -108,7 +108,7 @@ export const MenuItem = forwardRef(function MenuItem(
108
108
  [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft],
109
109
  )
110
110
 
111
- const hotkeysFontSize = useArrayProp(fontSize).map((s) => s - 1)
111
+ const hotkeysFontSize = _getArrayProp(fontSize).map((s) => s - 1)
112
112
 
113
113
  const setRef = useCallback((el: HTMLDivElement | null) => {
114
114
  ref.current = el
@@ -124,8 +124,8 @@ export const MenuItem = forwardRef(function MenuItem(
124
124
  data-selected={active ? '' : undefined}
125
125
  data-disabled={disabled ? '' : undefined}
126
126
  forwardedAs={as}
127
- $radius={useArrayProp(radius)}
128
- $padding={useArrayProp(0)}
127
+ $radius={_getArrayProp(radius)}
128
+ $padding={_getArrayProp(0)}
129
129
  $tone={disabled ? 'default' : tone}
130
130
  $scheme={scheme}
131
131
  disabled={disabled}
@@ -1,8 +1,8 @@
1
1
  import {forwardRef, useEffect, useState} from 'react'
2
2
  import {styled} from 'styled-components'
3
3
 
4
- import {useArrayProp} from '../../hooks'
5
4
  import {Box, BoxProps, ResponsiveRadiusProps} from '../../primitives'
5
+ import {_getArrayProp} from '../../styles'
6
6
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
7
7
  import {skeletonStyle} from './styles'
8
8
 
@@ -48,7 +48,7 @@ export const Skeleton = forwardRef(function Skeleton(
48
48
  <StyledSkeleton
49
49
  {...restProps}
50
50
  $animated={animated}
51
- $radius={useArrayProp(radius)}
51
+ $radius={_getArrayProp(radius)}
52
52
  $visible={delay ? visible : true}
53
53
  ref={ref}
54
54
  />
@@ -2,8 +2,7 @@ import {getTheme_v2, ThemeFontKey} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
4
 
5
- import {useArrayProp} from '../../hooks'
6
- import {_responsive, ThemeProps} from '../../styles'
5
+ import {_getArrayProp, _responsive, ThemeProps} from '../../styles'
7
6
  import {Skeleton, SkeletonProps} from './skeleton'
8
7
 
9
8
  const StyledSkeleton = styled(Skeleton)<{$size: number[]; $style: ThemeFontKey}>((
@@ -68,7 +67,7 @@ export const TextSkeleton = forwardRef(function TextSkeleton(
68
67
  ref: React.Ref<HTMLDivElement>,
69
68
  ) {
70
69
  const {size = 2, ...restProps} = props
71
- const $size = useArrayProp(size)
70
+ const $size = _getArrayProp(size)
72
71
 
73
72
  return <StyledSkeleton {...restProps} $size={$size} ref={ref} $style="text" />
74
73
  })
@@ -84,7 +83,7 @@ export const LabelSkeleton = forwardRef(function TextSkeleton(
84
83
  ref: React.Ref<HTMLDivElement>,
85
84
  ) {
86
85
  const {size = 2, ...restProps} = props
87
- const $size = useArrayProp(size)
86
+ const $size = _getArrayProp(size)
88
87
 
89
88
  return <StyledSkeleton {...restProps} $size={$size} ref={ref} $style="label" />
90
89
  })
@@ -100,7 +99,7 @@ export const HeadingSkeleton = forwardRef(function TextSkeleton(
100
99
  ref: React.Ref<HTMLDivElement>,
101
100
  ) {
102
101
  const {size = 2, ...restProps} = props
103
- const $size = useArrayProp(size)
102
+ const $size = _getArrayProp(size)
104
103
 
105
104
  return <StyledSkeleton {...restProps} $size={$size} ref={ref} $style="heading" />
106
105
  })
@@ -116,7 +115,7 @@ export const CodeSkeleton = forwardRef(function TextSkeleton(
116
115
  ref: React.Ref<HTMLDivElement>,
117
116
  ) {
118
117
  const {size = 2, ...restProps} = props
119
- const $size = useArrayProp(size)
118
+ const $size = _getArrayProp(size)
120
119
 
121
120
  return <StyledSkeleton {...restProps} $size={$size} ref={ref} $style="code" />
122
121
  })
@@ -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,12 @@ 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
  }
@@ -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 '../../styles'
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
@@ -114,18 +114,6 @@ export const Avatar = forwardRef(function Avatar(
114
114
  }
115
115
  }, [onImageLoadError])
116
116
 
117
- const initialsSize = useMemo(
118
- () =>
119
- size.map((s) => {
120
- if (s === 1) return 1
121
- if (s === 2) return 3
122
- if (s === 3) return 5
123
-
124
- return 0
125
- }),
126
- [size],
127
- )
128
-
129
117
  return (
130
118
  <StyledAvatar
131
119
  as={as}
@@ -182,7 +170,17 @@ export const Avatar = forwardRef(function Avatar(
182
170
  {(imageFailed || !src) && initials && (
183
171
  <>
184
172
  <Initials>
185
- <InitialsLabel forwardedAs="span" size={initialsSize} weight="medium">
173
+ <InitialsLabel
174
+ forwardedAs="span"
175
+ size={size.map((s) => {
176
+ if (s === 1) return 1
177
+ if (s === 2) return 3
178
+ if (s === 3) return 5
179
+
180
+ return 0
181
+ })}
182
+ weight="medium"
183
+ >
186
184
  {initials}
187
185
  </InitialsLabel>
188
186
  </Initials>
@@ -1,10 +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'
7
- import {_responsive, rem, ThemeProps} from '../../styles'
6
+ import {_getArrayProp, _responsive, rem, ThemeProps} from '../../styles'
8
7
  import {AvatarSize} from '../../types'
9
8
  import {Label} from '../label'
10
9
 
@@ -69,23 +68,21 @@ export const AvatarCounter = forwardRef(function AvatarCounter(
69
68
  ref: React.Ref<HTMLDivElement>,
70
69
  ) {
71
70
  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
- )
71
+ const size = _getArrayProp(sizeProp)
85
72
 
86
73
  return (
87
74
  <StyledAvatarCounter $size={size} data-ui="AvatarCounter" ref={ref}>
88
- <Label as="span" size={fontSize} weight="medium">
75
+ <Label
76
+ as="span"
77
+ size={size.map((s) => {
78
+ if (s === 1) return 1
79
+ if (s === 2) return 3
80
+ if (s === 3) return 5
81
+
82
+ return 0
83
+ })}
84
+ weight="medium"
85
+ >
89
86
  {count}
90
87
  </Label>
91
88
  </StyledAvatarCounter>
@@ -3,8 +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'
7
- import {_responsive, rem, ThemeProps} from '../../styles'
6
+ import {_getArrayProp, _responsive, rem, ThemeProps} from '../../styles'
8
7
  import {AvatarSize} from '../../types'
9
8
  import {AvatarCounter} from './avatarCounter'
10
9
 
@@ -71,7 +70,7 @@ export const AvatarStack = forwardRef(function AvatarStack(
71
70
  } = props
72
71
  const children: React.JSX.Element[] = Children.toArray(childrenProp).filter(isValidElement)
73
72
  const maxLength = Math.max(maxLengthProp, 0)
74
- const size = useArrayProp(sizeProp)
73
+ const size = _getArrayProp(sizeProp)
75
74
 
76
75
  const len = children.length
77
76
  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 '../../styles'
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>
@@ -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 '../../styles'
5
5
  import {
6
6
  boxStyle,
7
7
  flexItemStyle,
@@ -96,31 +96,31 @@ export const Box = forwardRef(function Box(
96
96
  data-as={typeof asProp === 'string' ? asProp : undefined}
97
97
  data-ui="Box"
98
98
  {...restProps}
99
- $column={useArrayProp(column)}
100
- $columnStart={useArrayProp(columnStart)}
101
- $columnEnd={useArrayProp(columnEnd)}
102
- $display={useArrayProp(display)}
103
- $flex={useArrayProp(flex)}
104
- $height={useArrayProp(height)}
105
- $margin={useArrayProp(margin)}
106
- $marginX={useArrayProp(marginX)}
107
- $marginY={useArrayProp(marginY)}
108
- $marginTop={useArrayProp(marginTop)}
109
- $marginRight={useArrayProp(marginRight)}
110
- $marginBottom={useArrayProp(marginBottom)}
111
- $marginLeft={useArrayProp(marginLeft)}
112
- $overflow={useArrayProp(overflow)}
113
- $padding={useArrayProp(padding)}
114
- $paddingX={useArrayProp(paddingX)}
115
- $paddingY={useArrayProp(paddingY)}
116
- $paddingTop={useArrayProp(paddingTop)}
117
- $paddingRight={useArrayProp(paddingRight)}
118
- $paddingBottom={useArrayProp(paddingBottom)}
119
- $paddingLeft={useArrayProp(paddingLeft)}
120
- $row={useArrayProp(row)}
121
- $rowStart={useArrayProp(rowStart)}
122
- $rowEnd={useArrayProp(rowEnd)}
123
- $sizing={useArrayProp(sizing)}
99
+ $column={_getArrayProp(column)}
100
+ $columnStart={_getArrayProp(columnStart)}
101
+ $columnEnd={_getArrayProp(columnEnd)}
102
+ $display={_getArrayProp(display)}
103
+ $flex={_getArrayProp(flex)}
104
+ $height={_getArrayProp(height)}
105
+ $margin={_getArrayProp(margin)}
106
+ $marginX={_getArrayProp(marginX)}
107
+ $marginY={_getArrayProp(marginY)}
108
+ $marginTop={_getArrayProp(marginTop)}
109
+ $marginRight={_getArrayProp(marginRight)}
110
+ $marginBottom={_getArrayProp(marginBottom)}
111
+ $marginLeft={_getArrayProp(marginLeft)}
112
+ $overflow={_getArrayProp(overflow)}
113
+ $padding={_getArrayProp(padding)}
114
+ $paddingX={_getArrayProp(paddingX)}
115
+ $paddingY={_getArrayProp(paddingY)}
116
+ $paddingTop={_getArrayProp(paddingTop)}
117
+ $paddingRight={_getArrayProp(paddingRight)}
118
+ $paddingBottom={_getArrayProp(paddingBottom)}
119
+ $paddingLeft={_getArrayProp(paddingLeft)}
120
+ $row={_getArrayProp(row)}
121
+ $rowStart={_getArrayProp(rowStart)}
122
+ $rowEnd={_getArrayProp(rowEnd)}
123
+ $sizing={_getArrayProp(sizing)}
124
124
  as={asProp}
125
125
  ref={ref}
126
126
  >
@@ -3,8 +3,7 @@ import {forwardRef, isValidElement, useMemo} from 'react'
3
3
  import {isValidElementType} from 'react-is'
4
4
  import {styled} from 'styled-components'
5
5
 
6
- import {useArrayProp} from '../../hooks'
7
- import {ThemeProps} from '../../styles'
6
+ import {_getArrayProp, ThemeProps} from '../../styles'
8
7
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
9
8
  import {useTheme_v2} from '../../theme'
10
9
  import {ButtonMode, ButtonTextAlign, ButtonTone, ButtonWidth, FlexJustify} from '../../types'
@@ -97,16 +96,16 @@ export const Button = forwardRef(function Button(
97
96
  } = props
98
97
  const {button} = useTheme_v2()
99
98
 
100
- const justify = useArrayProp(justifyProp)
101
- const padding = useArrayProp(paddingProp)
102
- const paddingX = useArrayProp(paddingXProp)
103
- const paddingY = useArrayProp(paddingYProp)
104
- const paddingTop = useArrayProp(paddingTopProp)
105
- const paddingBottom = useArrayProp(paddingBottomProp)
106
- const paddingLeft = useArrayProp(paddingLeftProp)
107
- const paddingRight = useArrayProp(paddingRightProp)
108
- const radius = useArrayProp(radiusProp)
109
- const space = useArrayProp(spaceProp)
99
+ const justify = _getArrayProp(justifyProp)
100
+ const padding = _getArrayProp(paddingProp)
101
+ const paddingX = _getArrayProp(paddingXProp)
102
+ const paddingY = _getArrayProp(paddingYProp)
103
+ const paddingTop = _getArrayProp(paddingTopProp)
104
+ const paddingBottom = _getArrayProp(paddingBottomProp)
105
+ const paddingLeft = _getArrayProp(paddingLeftProp)
106
+ const paddingRight = _getArrayProp(paddingRightProp)
107
+ const radius = _getArrayProp(radiusProp)
108
+ const space = _getArrayProp(spaceProp)
110
109
 
111
110
  const boxProps = useMemo(
112
111
  () => ({
@@ -3,7 +3,7 @@ import {forwardRef} from 'react'
3
3
  import {isValidElementType} from 'react-is'
4
4
  import {styled} from 'styled-components'
5
5
 
6
- import {useArrayProp} from '../../hooks'
6
+ import {_getArrayProp} from '../../styles'
7
7
  import {
8
8
  responsiveBorderStyle,
9
9
  ResponsiveBorderStyleProps,
@@ -93,16 +93,16 @@ export const Card = forwardRef(function Card(
93
93
  data-ui="Card"
94
94
  data-tone={tone}
95
95
  {...restProps}
96
- $border={useArrayProp(border)}
97
- $borderTop={useArrayProp(borderTop)}
98
- $borderRight={useArrayProp(borderRight)}
99
- $borderBottom={useArrayProp(borderBottom)}
100
- $borderLeft={useArrayProp(borderLeft)}
96
+ $border={_getArrayProp(border)}
97
+ $borderTop={_getArrayProp(borderTop)}
98
+ $borderRight={_getArrayProp(borderRight)}
99
+ $borderBottom={_getArrayProp(borderBottom)}
100
+ $borderLeft={_getArrayProp(borderLeft)}
101
101
  $checkered={checkered}
102
102
  $focusRing={focusRing}
103
103
  $muted={muted}
104
- $radius={useArrayProp(radius)}
105
- $shadow={useArrayProp(shadow)}
104
+ $radius={_getArrayProp(radius)}
105
+ $shadow={_getArrayProp(shadow)}
106
106
  $tone={tone}
107
107
  data-checkered={checkered ? '' : undefined}
108
108
  data-pressed={pressed ? '' : undefined}
@@ -1,7 +1,7 @@
1
1
  import {forwardRef, lazy, Suspense} from 'react'
2
2
  import {styled} from 'styled-components'
3
3
 
4
- import {useArrayProp} from '../../hooks'
4
+ import {_getArrayProp} from '../../styles'
5
5
  import {responsiveCodeFontStyle, ResponsiveFontStyleProps} from '../../styles/internal'
6
6
  import {codeBaseStyle} from './styles'
7
7
 
@@ -30,7 +30,13 @@ export const Code = forwardRef(function Code(
30
30
  const {children, language, size = 2, weight, ...restProps} = props
31
31
 
32
32
  return (
33
- <StyledCode data-ui="Code" {...restProps} $size={useArrayProp(size)} $weight={weight} ref={ref}>
33
+ <StyledCode
34
+ data-ui="Code"
35
+ {...restProps}
36
+ $size={_getArrayProp(size)}
37
+ $weight={weight}
38
+ ref={ref}
39
+ >
34
40
  <Suspense fallback={<code>{children}</code>}>
35
41
  <LazyRefractor language={language} value={children} />
36
42
  </Suspense>
@@ -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 '../../styles'
5
5
  import {Box, BoxProps} from '../box'
6
6
  import {ResponsiveWidthProps} from '../types'
7
7
  import {containerBaseStyle, responsiveContainerWidthStyle} from './styles'
@@ -32,7 +32,7 @@ export const Container = forwardRef(function Container(
32
32
  <StyledContainer
33
33
  data-ui="Container"
34
34
  {...restProps}
35
- $width={useArrayProp(width)}
35
+ $width={_getArrayProp(width)}
36
36
  forwardedAs={as}
37
37
  ref={ref}
38
38
  />