@sanity/ui 0.37.20 → 0.37.21

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 (210) hide show
  1. package/lib/dts/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
  2. package/lib/dts/src/components/dialog/dialog.d.ts.map +1 -1
  3. package/lib/dts/src/components/dialog/styles.d.ts +1 -1
  4. package/lib/dts/src/components/dialog/styles.d.ts.map +1 -1
  5. package/lib/dts/src/components/hotkeys/hotkeys.d.ts.map +1 -1
  6. package/lib/dts/src/components/menu/menuGroup.d.ts.map +1 -1
  7. package/lib/dts/src/components/skeleton/skeleton.d.ts.map +1 -1
  8. package/lib/dts/src/hooks/index.d.ts +1 -2
  9. package/lib/dts/src/hooks/index.d.ts.map +1 -1
  10. package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts +1 -1
  11. package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts.map +1 -1
  12. package/lib/dts/src/hooks/useResponsiveProp.d.ts +6 -0
  13. package/lib/dts/src/hooks/useResponsiveProp.d.ts.map +1 -0
  14. package/lib/dts/src/index.d.ts +0 -1
  15. package/lib/dts/src/index.d.ts.map +1 -1
  16. package/lib/dts/src/primitives/_selectable/selectable.d.ts +2 -1
  17. package/lib/dts/src/primitives/_selectable/selectable.d.ts.map +1 -1
  18. package/lib/dts/src/primitives/avatar/avatar.d.ts.map +1 -1
  19. package/lib/dts/src/primitives/avatar/avatarCounter.d.ts.map +1 -1
  20. package/lib/dts/src/primitives/avatar/avatarStack.d.ts.map +1 -1
  21. package/lib/dts/src/primitives/avatar/styles.d.ts.map +1 -1
  22. package/lib/dts/src/primitives/badge/badge.d.ts.map +1 -1
  23. package/lib/dts/src/primitives/box/box.d.ts.map +1 -1
  24. package/lib/dts/src/primitives/button/button.d.ts.map +1 -1
  25. package/lib/dts/src/primitives/card/card.d.ts.map +1 -1
  26. package/lib/dts/src/primitives/code/code.d.ts.map +1 -1
  27. package/lib/dts/src/primitives/container/container.d.ts.map +1 -1
  28. package/lib/dts/src/primitives/container/styles.d.ts.map +1 -1
  29. package/lib/dts/src/primitives/container/types.d.ts +1 -1
  30. package/lib/dts/src/primitives/container/types.d.ts.map +1 -1
  31. package/lib/dts/src/primitives/flex/flex.d.ts.map +1 -1
  32. package/lib/dts/src/primitives/grid/grid.d.ts.map +1 -1
  33. package/lib/dts/src/primitives/heading/heading.d.ts.map +1 -1
  34. package/lib/dts/src/primitives/inline/inline.d.ts.map +1 -1
  35. package/lib/dts/src/primitives/inline/styles.d.ts.map +1 -1
  36. package/lib/dts/src/primitives/inline/types.d.ts +1 -1
  37. package/lib/dts/src/primitives/inline/types.d.ts.map +1 -1
  38. package/lib/dts/src/primitives/kbd/kbd.d.ts.map +1 -1
  39. package/lib/dts/src/primitives/label/label.d.ts.map +1 -1
  40. package/lib/dts/src/primitives/popover/popover.d.ts.map +1 -1
  41. package/lib/dts/src/primitives/select/styles.d.ts +1 -5
  42. package/lib/dts/src/primitives/select/styles.d.ts.map +1 -1
  43. package/lib/dts/src/primitives/stack/stack.d.ts.map +1 -1
  44. package/lib/dts/src/primitives/stack/styles.d.ts +1 -1
  45. package/lib/dts/src/primitives/stack/styles.d.ts.map +1 -1
  46. package/lib/dts/src/primitives/text/text.d.ts.map +1 -1
  47. package/lib/dts/src/primitives/textArea/textArea.d.ts.map +1 -1
  48. package/lib/dts/src/primitives/textInput/textInput.d.ts.map +1 -1
  49. package/lib/dts/src/primitives/tooltip/tooltip.d.ts.map +1 -1
  50. package/lib/dts/src/primitives/types.d.ts +1 -1
  51. package/lib/dts/src/primitives/types.d.ts.map +1 -1
  52. package/lib/dts/src/styles/border/types.d.ts +5 -5
  53. package/lib/dts/src/styles/border/types.d.ts.map +1 -1
  54. package/lib/dts/src/styles/box/types.d.ts +4 -4
  55. package/lib/dts/src/styles/box/types.d.ts.map +1 -1
  56. package/lib/dts/src/styles/flex/flexItemStyle.d.ts.map +1 -1
  57. package/lib/dts/src/styles/flex/types.d.ts +6 -6
  58. package/lib/dts/src/styles/flex/types.d.ts.map +1 -1
  59. package/lib/dts/src/styles/font/responsiveFont.d.ts.map +1 -1
  60. package/lib/dts/src/styles/font/types.d.ts +3 -3
  61. package/lib/dts/src/styles/font/types.d.ts.map +1 -1
  62. package/lib/dts/src/styles/grid/types.d.ts +14 -14
  63. package/lib/dts/src/styles/grid/types.d.ts.map +1 -1
  64. package/lib/dts/src/styles/helpers.d.ts +4 -4
  65. package/lib/dts/src/styles/helpers.d.ts.map +1 -1
  66. package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts +12 -12
  67. package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts.map +1 -1
  68. package/lib/dts/src/styles/input/textInputStyle.d.ts +2 -7
  69. package/lib/dts/src/styles/input/textInputStyle.d.ts.map +1 -1
  70. package/lib/dts/src/styles/margin/types.d.ts +7 -7
  71. package/lib/dts/src/styles/margin/types.d.ts.map +1 -1
  72. package/lib/dts/src/styles/padding/types.d.ts +7 -7
  73. package/lib/dts/src/styles/padding/types.d.ts.map +1 -1
  74. package/lib/dts/src/styles/radius/types.d.ts +1 -1
  75. package/lib/dts/src/styles/radius/types.d.ts.map +1 -1
  76. package/lib/dts/src/styles/shadow/shadowStyle.d.ts.map +1 -1
  77. package/lib/dts/src/styles/shadow/types.d.ts +1 -1
  78. package/lib/dts/src/styles/shadow/types.d.ts.map +1 -1
  79. package/lib/dts/src/theme/studioTheme/color.d.ts.map +1 -1
  80. package/lib/dts/src/utils/elementQuery/elementQuery.d.ts.map +1 -1
  81. package/lib/dts/src/utils/index.d.ts +1 -0
  82. package/lib/dts/src/utils/index.d.ts.map +1 -1
  83. package/lib/dts/src/utils/resizeObserver.d.ts +6 -0
  84. package/lib/dts/src/utils/resizeObserver.d.ts.map +1 -0
  85. package/lib/dts/src/utils/virtualList/virtualList.d.ts.map +1 -1
  86. package/lib/sanity-ui.js +570 -731
  87. package/lib/sanity-ui.js.map +1 -1
  88. package/lib/sanity-ui.modern.js +591 -762
  89. package/lib/sanity-ui.modern.js.map +1 -1
  90. package/lib/sanity-ui.module.js +566 -725
  91. package/lib/sanity-ui.module.js.map +1 -1
  92. package/package.json +11 -11
  93. package/src/__workshop__/color/overview.tsx +11 -9
  94. package/src/components/autocomplete/__workshop__/async.tsx +12 -14
  95. package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -36
  96. package/src/components/autocomplete/autocomplete.tsx +2 -2
  97. package/src/components/breadcrumbs/breadcrumbs.tsx +2 -3
  98. package/src/components/dialog/dialog.tsx +9 -17
  99. package/src/components/dialog/styles.ts +4 -4
  100. package/src/components/hotkeys/hotkeys.tsx +1 -3
  101. package/src/components/menu/__workshop__/constrainedInBoundary.tsx +14 -11
  102. package/src/components/menu/__workshop__/groups.tsx +1 -1
  103. package/src/components/menu/menuGroup.tsx +2 -3
  104. package/src/components/menu/menuItem.tsx +3 -3
  105. package/src/components/skeleton/skeleton.tsx +1 -10
  106. package/src/components/skeleton/textSkeleton.tsx +7 -7
  107. package/src/hooks/index.ts +1 -2
  108. package/src/hooks/useElementRect/useElementRect.ts +16 -4
  109. package/src/hooks/useResponsiveProp.ts +10 -0
  110. package/src/index.ts +0 -1
  111. package/src/primitives/_selectable/selectable.tsx +4 -5
  112. package/src/primitives/avatar/avatar.tsx +5 -7
  113. package/src/primitives/avatar/avatarCounter.tsx +11 -12
  114. package/src/primitives/avatar/avatarStack.tsx +10 -15
  115. package/src/primitives/avatar/styles.ts +2 -2
  116. package/src/primitives/badge/badge.tsx +2 -3
  117. package/src/primitives/box/box.tsx +25 -26
  118. package/src/primitives/button/button.tsx +10 -22
  119. package/src/primitives/card/card.tsx +7 -8
  120. package/src/primitives/checkbox/__workshop__/example.tsx +2 -4
  121. package/src/primitives/checkbox/__workshop__/props.tsx +2 -4
  122. package/src/primitives/checkbox/__workshop__/readOnly.tsx +2 -4
  123. package/src/primitives/code/__workshop__/props.tsx +1 -1
  124. package/src/primitives/code/code.tsx +1 -2
  125. package/src/primitives/container/container.tsx +1 -10
  126. package/src/primitives/container/styles.ts +2 -2
  127. package/src/primitives/container/types.ts +1 -1
  128. package/src/primitives/flex/flex.tsx +5 -6
  129. package/src/primitives/grid/__workshop__/responsive.tsx +12 -13
  130. package/src/primitives/grid/grid.tsx +8 -9
  131. package/src/primitives/heading/__workshop__/opticalAlignment.tsx +7 -19
  132. package/src/primitives/heading/heading.tsx +2 -3
  133. package/src/primitives/inline/inline.tsx +6 -12
  134. package/src/primitives/inline/styles.ts +2 -2
  135. package/src/primitives/inline/types.ts +1 -1
  136. package/src/primitives/kbd/kbd.tsx +1 -2
  137. package/src/primitives/label/label.tsx +3 -4
  138. package/src/primitives/popover/__workshop__/index.ts +5 -10
  139. package/src/primitives/popover/__workshop__/{MarginsStory.tsx → margins.tsx} +1 -1
  140. package/src/primitives/popover/__workshop__/{MatchReferenceWidthStory.tsx → matchReferenceWidth.tsx} +0 -0
  141. package/src/primitives/popover/__workshop__/{PlainStory.tsx → plain.tsx} +14 -12
  142. package/src/primitives/popover/__workshop__/{RecursiveStory.tsx → recursive.tsx} +1 -4
  143. package/src/primitives/popover/__workshop__/rightAligned.tsx +57 -0
  144. package/src/primitives/popover/popover.tsx +10 -29
  145. package/src/primitives/select/select.tsx +9 -9
  146. package/src/primitives/select/styles.ts +4 -10
  147. package/src/primitives/stack/stack.tsx +1 -2
  148. package/src/primitives/stack/styles.ts +3 -3
  149. package/src/primitives/text/__workshop__/opticalAlignment.tsx +5 -15
  150. package/src/primitives/text/text.tsx +2 -3
  151. package/src/primitives/textArea/__workshop__/plain.tsx +18 -23
  152. package/src/primitives/textArea/textArea.tsx +5 -21
  153. package/src/primitives/textInput/__workshop__/clearButton.tsx +8 -14
  154. package/src/primitives/textInput/__workshop__/index.ts +2 -2
  155. package/src/primitives/textInput/__workshop__/plain.tsx +32 -39
  156. package/src/primitives/textInput/__workshop__/tones.tsx +95 -234
  157. package/src/primitives/textInput/__workshop__/typed.tsx +2 -8
  158. package/src/primitives/textInput/textInput.tsx +12 -47
  159. package/src/primitives/tooltip/__workshop__/props.tsx +2 -7
  160. package/src/primitives/tooltip/tooltip.tsx +9 -19
  161. package/src/primitives/types.ts +1 -1
  162. package/src/styles/border/borderStyle.ts +6 -6
  163. package/src/styles/border/types.ts +5 -5
  164. package/src/styles/box/boxStyle.ts +5 -5
  165. package/src/styles/box/types.ts +4 -4
  166. package/src/styles/flex/flexItemStyle.ts +4 -5
  167. package/src/styles/flex/flexStyle.ts +6 -6
  168. package/src/styles/flex/types.ts +6 -6
  169. package/src/styles/font/responsiveFont.ts +4 -2
  170. package/src/styles/font/textAlignStyle.ts +2 -2
  171. package/src/styles/font/types.ts +3 -4
  172. package/src/styles/grid/gridItemStyle.ts +7 -7
  173. package/src/styles/grid/gridStyle.ts +9 -9
  174. package/src/styles/grid/types.ts +14 -14
  175. package/src/styles/helpers.ts +9 -9
  176. package/src/styles/input/responsiveInputPaddingStyle.ts +27 -24
  177. package/src/styles/input/textInputStyle.ts +80 -92
  178. package/src/styles/margin/marginStyle.ts +8 -8
  179. package/src/styles/margin/marginsStyle.test.ts +1 -1
  180. package/src/styles/margin/types.ts +7 -7
  181. package/src/styles/padding/paddingStyle.test.ts +1 -1
  182. package/src/styles/padding/paddingStyle.ts +8 -8
  183. package/src/styles/padding/types.ts +7 -7
  184. package/src/styles/radius/radiusStyle.ts +2 -2
  185. package/src/styles/radius/types.ts +1 -1
  186. package/src/styles/shadow/shadowStyle.ts +5 -2
  187. package/src/styles/shadow/types.ts +1 -1
  188. package/src/theme/studioTheme/color.ts +14 -15
  189. package/src/theme/studioTheme/fonts.ts +4 -4
  190. package/src/utils/elementQuery/elementQuery.tsx +18 -5
  191. package/src/utils/index.ts +1 -0
  192. package/src/utils/layer/layerProvider.tsx +2 -2
  193. package/src/{observers → utils}/resizeObserver.ts +3 -1
  194. package/src/utils/virtualList/virtualList.tsx +1 -3
  195. package/lib/dts/src/hooks/useArrayProp.d.ts +0 -7
  196. package/lib/dts/src/hooks/useArrayProp.d.ts.map +0 -1
  197. package/lib/dts/src/hooks/useElementSize.d.ts +0 -7
  198. package/lib/dts/src/hooks/useElementSize.d.ts.map +0 -1
  199. package/lib/dts/src/observers/elementSizeObserver.d.ts +0 -37
  200. package/lib/dts/src/observers/elementSizeObserver.d.ts.map +0 -1
  201. package/lib/dts/src/observers/index.d.ts +0 -3
  202. package/lib/dts/src/observers/index.d.ts.map +0 -1
  203. package/lib/dts/src/observers/resizeObserver.d.ts +0 -5
  204. package/lib/dts/src/observers/resizeObserver.d.ts.map +0 -1
  205. package/src/hooks/useArrayProp.ts +0 -23
  206. package/src/hooks/useElementSize.ts +0 -18
  207. package/src/observers/elementSizeObserver.ts +0 -116
  208. package/src/observers/index.ts +0 -2
  209. package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +0 -60
  210. package/src/primitives/popover/__workshop__/TestStory.tsx +0 -79
@@ -1,8 +1,8 @@
1
1
  import {useId} from '@reach/auto-id'
2
- import React, {forwardRef, useCallback, useEffect, useMemo, useState} from 'react'
2
+ import React, {forwardRef, useCallback, useEffect, useState} from 'react'
3
3
  import ReactIs from 'react-is'
4
4
  import styled from 'styled-components'
5
- import {useArrayProp} from '../../hooks'
5
+ import {useResponsiveProp} from '../../hooks'
6
6
  import {ThemeColorSpotKey, useTheme} from '../../theme'
7
7
  import {AvatarPosition, AvatarSize, AvatarStatus} from '../../types'
8
8
  import {Text} from '../text'
@@ -58,11 +58,11 @@ export const Avatar = forwardRef(function Avatar(
58
58
  arrowPosition: arrowPositionProp,
59
59
  animateArrowFrom,
60
60
  status = 'online',
61
- size: sizeProp = 0,
61
+ size: sizeProp,
62
62
  ...restProps
63
63
  } = props
64
64
  const as = ReactIs.isValidElementType(asProp) ? asProp : 'div'
65
- const size = useArrayProp(sizeProp)
65
+ const size: AvatarSize[] = useResponsiveProp(sizeProp, [0])
66
66
  const theme = useTheme()
67
67
  const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray
68
68
 
@@ -101,8 +101,6 @@ export const Avatar = forwardRef(function Avatar(
101
101
  }
102
102
  }, [onImageLoadError])
103
103
 
104
- const initialsSize = useMemo(() => size.map((s) => (s === 0 ? 0 : s + 1)), [size])
105
-
106
104
  return (
107
105
  <Root
108
106
  as={as}
@@ -156,7 +154,7 @@ export const Avatar = forwardRef(function Avatar(
156
154
  {(imageFailed || !src) && initials && (
157
155
  <>
158
156
  <Initials>
159
- <Text as="span" size={initialsSize}>
157
+ <Text as="span" size={size.map((s) => (s === 0 ? 0 : s + 1))}>
160
158
  <strong>{initials}</strong>
161
159
  </Text>
162
160
  </Initials>
@@ -1,16 +1,16 @@
1
- import React, {forwardRef, useMemo} from 'react'
1
+ import React, {forwardRef} from 'react'
2
2
  import styled, {css} from 'styled-components'
3
3
  import {EMPTY_RECORD} from '../../constants'
4
- import {useArrayProp} from '../../hooks'
5
- import {rem, _responsive, ThemeProps} from '../../styles'
4
+ import {useResponsiveProp} from '../../hooks'
5
+ import {rem, responsive, ThemeProps} from '../../styles'
6
6
  import {AvatarSize} from '../../types'
7
7
  import {Text} from '../text'
8
8
 
9
- function _responsiveAvatarCounterSizeStyle(props: {$size: AvatarSize[]} & ThemeProps) {
9
+ function responsiveAvatarCounterSizeStyle(props: {$size: AvatarSize[]} & ThemeProps) {
10
10
  const {theme} = props
11
11
  const {avatar, media} = theme.sanity
12
12
 
13
- return _responsive(media, props.$size, (size) => {
13
+ return responsive(media, props.$size, (size) => {
14
14
  const avatarSize = avatar.sizes[size]
15
15
 
16
16
  if (!avatarSize) return EMPTY_RECORD
@@ -23,7 +23,7 @@ function _responsiveAvatarCounterSizeStyle(props: {$size: AvatarSize[]} & ThemeP
23
23
  })
24
24
  }
25
25
 
26
- function _avatarCounterBaseStyle(props: ThemeProps) {
26
+ function avatarCounterBaseStyle(props: ThemeProps) {
27
27
  const {theme} = props
28
28
 
29
29
  return css`
@@ -44,8 +44,8 @@ function _avatarCounterBaseStyle(props: ThemeProps) {
44
44
  }
45
45
 
46
46
  const Root = styled.div<{$size: AvatarSize[]}>(
47
- _responsiveAvatarCounterSizeStyle,
48
- _avatarCounterBaseStyle
47
+ responsiveAvatarCounterSizeStyle,
48
+ avatarCounterBaseStyle
49
49
  )
50
50
 
51
51
  /**
@@ -66,12 +66,11 @@ export const AvatarCounter = forwardRef(function AvatarCounter(
66
66
  ref: React.Ref<HTMLDivElement>
67
67
  ) {
68
68
  const {count, size: sizeProp = 0} = props
69
- const size = useArrayProp(sizeProp)
70
- const counterSize = useMemo(() => size.map((s) => (s === 0 ? 0 : s + 1)), [size])
69
+ const size: AvatarSize[] = useResponsiveProp(sizeProp, [0])
71
70
 
72
71
  return (
73
- <Root $size={size} data-ui="AvatarCounter" ref={ref}>
74
- <Text as="span" size={counterSize}>
72
+ <Root $size={size} ref={ref}>
73
+ <Text as="span" size={size.map((s) => (s === 0 ? 0 : s + 1))}>
75
74
  <strong>{count}</strong>
76
75
  </Text>
77
76
  </Root>
@@ -1,8 +1,7 @@
1
1
  import React, {cloneElement, forwardRef} from 'react'
2
2
  import styled, {css} from 'styled-components'
3
3
  import {EMPTY_RECORD} from '../../constants'
4
- import {useArrayProp} from '../../hooks'
5
- import {rem, _responsive, ThemeProps} from '../../styles'
4
+ import {getResponsiveProp, rem, responsive, ThemeProps} from '../../styles'
6
5
  import {AvatarSize} from '../../types'
7
6
  import {childrenToElementArray} from '../helpers'
8
7
  import {AvatarCounter} from './avatarCounter'
@@ -23,11 +22,11 @@ function avatarStackStyle() {
23
22
  return BASE_STYLES
24
23
  }
25
24
 
26
- function responsiveAvatarStackSizeStyle(props: {$size: AvatarSize[]} & ThemeProps) {
25
+ function responsiveAvatarStackSizeStyle(props: {size: AvatarSize | AvatarSize[]} & ThemeProps) {
27
26
  const {theme} = props
28
27
  const {avatar, media} = theme.sanity
29
28
 
30
- return _responsive(media, props.$size, (size) => {
29
+ return responsive(media, getResponsiveProp(props.size), (size) => {
31
30
  const avatarSize = avatar.sizes[size]
32
31
 
33
32
  if (!avatarSize) return EMPTY_RECORD
@@ -40,7 +39,10 @@ function responsiveAvatarStackSizeStyle(props: {$size: AvatarSize[]} & ThemeProp
40
39
  })
41
40
  }
42
41
 
43
- const Root = styled.div<{$size: AvatarSize[]}>(responsiveAvatarStackSizeStyle, avatarStackStyle)
42
+ const Root = styled.div<{size: AvatarSize | AvatarSize[]}>(
43
+ responsiveAvatarStackSizeStyle,
44
+ avatarStackStyle
45
+ )
44
46
 
45
47
  /**
46
48
  * @public
@@ -60,25 +62,18 @@ export const AvatarStack = forwardRef(function AvatarStack(
60
62
  props: AvatarStackProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'ref'>,
61
63
  ref: React.ForwardedRef<HTMLDivElement>
62
64
  ) {
63
- const {
64
- children: childrenProp,
65
- maxLength: maxLengthProp = 4,
66
- size: sizeProp = 0,
67
- ...restProps
68
- } = props
65
+ const {children: childrenProp, maxLength: maxLengthProp = 4, size = 0, tone, ...restProps} = props
66
+ const maxLength = Math.max(maxLengthProp, 0)
69
67
  const children = childrenToElementArray(childrenProp).filter(
70
68
  (child) => typeof child !== 'string'
71
69
  ) as React.ReactElement[]
72
- const maxLength = Math.max(maxLengthProp, 0)
73
- const size = useArrayProp(sizeProp)
74
-
75
70
  const len = children.length
76
71
  const visibleCount = maxLength - 1
77
72
  const extraCount = len - visibleCount
78
73
  const visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children
79
74
 
80
75
  return (
81
- <Root data-ui="AvatarStack" {...restProps} ref={ref} $size={size}>
76
+ <Root data-ui="AvatarStack" {...restProps} ref={ref} size={size}>
82
77
  {len === 0 && (
83
78
  <div>
84
79
  <AvatarCounter count={len} />
@@ -1,5 +1,5 @@
1
1
  import {CSSObject} from 'styled-components'
2
- import {rem, _responsive, ThemeProps} from '../../styles'
2
+ import {rem, responsive, ThemeProps} from '../../styles'
3
3
  import {focusRingStyle} from '../../styles/internal'
4
4
  import {AvatarRootStyleProps, ResponsiveAvatarSizeStyleProps} from './types'
5
5
 
@@ -103,7 +103,7 @@ export function responsiveAvatarSizeStyle(
103
103
  const {theme} = props
104
104
  const {avatar, media} = theme.sanity
105
105
 
106
- return _responsive(media, props.$size, (size) => {
106
+ return responsive(media, props.$size, (size) => {
107
107
  const avatarSize = avatar.sizes[size] || avatar.sizes[0]
108
108
 
109
109
  return {
@@ -1,6 +1,5 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
- import {useArrayProp} from '../../hooks'
4
3
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
5
4
  import {BadgeMode, BadgeTone} from '../../types'
6
5
  import {Box, BoxProps} from '../box'
@@ -47,8 +46,8 @@ export const Badge = forwardRef(function Badge(
47
46
  {...restProps}
48
47
  $mode={mode}
49
48
  $tone={tone}
50
- $radius={useArrayProp(radius)}
51
- padding={useArrayProp(padding)}
49
+ $radius={radius}
50
+ padding={padding}
52
51
  ref={ref}
53
52
  >
54
53
  <Label size={fontSize}>{children}</Label>
@@ -1,6 +1,5 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
- import {useArrayProp} from '../../hooks'
4
3
  import {
5
4
  boxStyle,
6
5
  flexItemStyle,
@@ -91,31 +90,31 @@ export const Box = forwardRef(function Box(
91
90
  data-as={typeof asProp === 'string' ? asProp : undefined}
92
91
  data-ui="Box"
93
92
  {...restProps}
94
- $column={useArrayProp(column)}
95
- $columnStart={useArrayProp(columnStart)}
96
- $columnEnd={useArrayProp(columnEnd)}
97
- $display={useArrayProp(display)}
98
- $flex={useArrayProp(flex)}
99
- $height={useArrayProp(height)}
100
- $margin={useArrayProp(margin)}
101
- $marginX={useArrayProp(marginX)}
102
- $marginY={useArrayProp(marginY)}
103
- $marginTop={useArrayProp(marginTop)}
104
- $marginRight={useArrayProp(marginRight)}
105
- $marginBottom={useArrayProp(marginBottom)}
106
- $marginLeft={useArrayProp(marginLeft)}
107
- $overflow={useArrayProp(overflow)}
108
- $padding={useArrayProp(padding)}
109
- $paddingX={useArrayProp(paddingX)}
110
- $paddingY={useArrayProp(paddingY)}
111
- $paddingTop={useArrayProp(paddingTop)}
112
- $paddingRight={useArrayProp(paddingRight)}
113
- $paddingBottom={useArrayProp(paddingBottom)}
114
- $paddingLeft={useArrayProp(paddingLeft)}
115
- $row={useArrayProp(row)}
116
- $rowStart={useArrayProp(rowStart)}
117
- $rowEnd={useArrayProp(rowEnd)}
118
- $sizing={useArrayProp(sizing)}
93
+ $column={column}
94
+ $columnStart={columnStart}
95
+ $columnEnd={columnEnd}
96
+ $display={display}
97
+ $flex={flex}
98
+ $height={height}
99
+ $margin={margin}
100
+ $marginX={marginX}
101
+ $marginY={marginY}
102
+ $marginTop={marginTop}
103
+ $marginRight={marginRight}
104
+ $marginBottom={marginBottom}
105
+ $marginLeft={marginLeft}
106
+ $overflow={overflow}
107
+ $padding={padding}
108
+ $paddingX={paddingX}
109
+ $paddingY={paddingY}
110
+ $paddingTop={paddingTop}
111
+ $paddingRight={paddingRight}
112
+ $paddingBottom={paddingBottom}
113
+ $paddingLeft={paddingLeft}
114
+ $row={row}
115
+ $rowStart={rowStart}
116
+ $rowEnd={rowEnd}
117
+ $sizing={sizing}
119
118
  as={asProp}
120
119
  ref={ref}
121
120
  >
@@ -1,7 +1,6 @@
1
1
  import React, {createElement, forwardRef, isValidElement, useMemo} from 'react'
2
2
  import {isValidElementType} from 'react-is'
3
3
  import styled from 'styled-components'
4
- import {useArrayProp} from '../../hooks'
5
4
  import {ThemeProps} from '../../styles'
6
5
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
7
6
  import {useTheme} from '../../theme'
@@ -67,19 +66,19 @@ export const Button = forwardRef(function Button(
67
66
  fontSize,
68
67
  icon,
69
68
  iconRight,
70
- justify: justifyProp = 'center',
69
+ justify = 'center',
71
70
  loading,
72
71
  mode = 'default',
73
- padding: paddingProp = 3,
74
- paddingX: paddingXProp,
75
- paddingY: paddingYProp,
76
- paddingTop: paddingTopProp,
77
- paddingBottom: paddingBottomProp,
78
- paddingLeft: paddingLeftProp,
79
- paddingRight: paddingRightProp,
80
- radius: radiusProp = 2,
72
+ padding = 3,
73
+ paddingX,
74
+ paddingY,
75
+ paddingTop,
76
+ paddingBottom,
77
+ paddingLeft,
78
+ paddingRight,
79
+ radius = 2,
81
80
  selected,
82
- space: spaceProp = 3,
81
+ space = 3,
83
82
  text,
84
83
  textAlign,
85
84
  tone = 'default',
@@ -87,17 +86,6 @@ export const Button = forwardRef(function Button(
87
86
  ...restProps
88
87
  } = props
89
88
 
90
- const justify = useArrayProp(justifyProp)
91
- const padding = useArrayProp(paddingProp)
92
- const paddingX = useArrayProp(paddingXProp)
93
- const paddingY = useArrayProp(paddingYProp)
94
- const paddingTop = useArrayProp(paddingTopProp)
95
- const paddingBottom = useArrayProp(paddingBottomProp)
96
- const paddingLeft = useArrayProp(paddingLeftProp)
97
- const paddingRight = useArrayProp(paddingRightProp)
98
- const radius = useArrayProp(radiusProp)
99
- const space = useArrayProp(spaceProp)
100
-
101
89
  const theme = useTheme()
102
90
 
103
91
  const boxProps = useMemo(
@@ -1,7 +1,6 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import {isValidElementType} from 'react-is'
3
3
  import styled from 'styled-components'
4
- import {useArrayProp} from '../../hooks'
5
4
  import {
6
5
  responsiveBorderStyle,
7
6
  ResponsiveBorderStyleProps,
@@ -84,15 +83,15 @@ export const Card = forwardRef(function Card(
84
83
  data-ui="Card"
85
84
  data-tone={tone}
86
85
  {...restProps}
87
- $border={useArrayProp(border)}
88
- $borderTop={useArrayProp(borderTop)}
89
- $borderRight={useArrayProp(borderRight)}
90
- $borderBottom={useArrayProp(borderBottom)}
91
- $borderLeft={useArrayProp(borderLeft)}
86
+ $border={border}
87
+ $borderTop={borderTop}
88
+ $borderRight={borderRight}
89
+ $borderBottom={borderBottom}
90
+ $borderLeft={borderLeft}
92
91
  $checkered={checkered}
93
92
  $focusRing={focusRing}
94
- $radius={useArrayProp(radius)}
95
- $shadow={useArrayProp(shadow)}
93
+ $radius={radius}
94
+ $shadow={shadow}
96
95
  $tone={tone}
97
96
  data-checkered={checkered ? '' : undefined}
98
97
  data-pressed={pressed ? '' : undefined}
@@ -14,10 +14,8 @@ export default function ExampleStory() {
14
14
  indeterminate={indeterminate}
15
15
  onChange={handleChange}
16
16
  />
17
- <Box marginLeft={2}>
18
- <Text size={1} weight="semibold">
19
- Toggle
20
- </Text>
17
+ <Box marginLeft={3}>
18
+ <Text>Label</Text>
21
19
  </Box>
22
20
  </Flex>
23
21
  </Flex>
@@ -23,10 +23,8 @@ export default function PropsStory() {
23
23
  onBlur={onBlur}
24
24
  readOnly={readOnly}
25
25
  />
26
- <Box marginLeft={2}>
27
- <Text size={1} weight="semibold">
28
- Toggle
29
- </Text>
26
+ <Box marginLeft={3}>
27
+ <Text>Label</Text>
30
28
  </Box>
31
29
  </Flex>
32
30
  </Flex>
@@ -6,10 +6,8 @@ export default function ReadOnlyStory() {
6
6
  <Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
7
7
  <Flex align="center" as="label">
8
8
  <Checkbox id="checkbox-example" readOnly />
9
- <Box marginLeft={2}>
10
- <Text size={1} weight="semibold">
11
- Toggle
12
- </Text>
9
+ <Box marginLeft={3}>
10
+ <Text>Label</Text>
13
11
  </Box>
14
12
  </Flex>
15
13
  </Flex>
@@ -9,7 +9,7 @@ import {
9
9
  export default function PropsStory() {
10
10
  const code = useText('Code', `console.log('Hello, world')`, 'Props')
11
11
  const language = useSelect('Language', WORKSHOP_CODE_LANGUAGE_OPTIONS, 'typescript', 'Props')
12
- const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2, 'Props')
12
+ const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, undefined, 'Props')
13
13
 
14
14
  return (
15
15
  <Box padding={[4, 5, 6]}>
@@ -1,7 +1,6 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import Refractor from 'react-refractor'
3
3
  import styled from 'styled-components'
4
- import {useArrayProp} from '../../hooks'
5
4
  import {responsiveCodeFontStyle, ResponsiveFontStyleProps} from '../../styles/internal'
6
5
  import {codeBaseStyle} from './styles'
7
6
 
@@ -29,7 +28,7 @@ export const Code = forwardRef(function Code(
29
28
  const registered = language ? Refractor.hasLanguage(language as any) : false
30
29
 
31
30
  return (
32
- <Root data-ui="Code" {...restProps} $size={useArrayProp(size)} $weight={weight} ref={ref}>
31
+ <Root data-ui="Code" {...restProps} $size={size} $weight={weight} ref={ref}>
33
32
  {!(language && registered) && <code>{children}</code>}
34
33
  {language && registered && <Refractor inline language={language} value={String(children)} />}
35
34
  </Root>
@@ -1,6 +1,5 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
- import {useArrayProp} from '../../hooks'
4
3
  import {Box, BoxProps} from '../box'
5
4
  import {ResponsiveWidthProps} from '../types'
6
5
  import {containerBaseStyle, responsiveContainerWidthStyle} from './styles'
@@ -25,13 +24,5 @@ export const Container = forwardRef(function Container(
25
24
  ) {
26
25
  const {as, width = 2, ...restProps} = props
27
26
 
28
- return (
29
- <Root
30
- data-ui="Container"
31
- {...restProps}
32
- $width={useArrayProp(width)}
33
- forwardedAs={as}
34
- ref={ref}
35
- />
36
- )
27
+ return <Root data-ui="Container" {...restProps} $width={width} forwardedAs={as} ref={ref} />
37
28
  })
@@ -1,5 +1,5 @@
1
1
  import {CSSObject} from 'styled-components'
2
- import {rem, _responsive, ThemeProps} from '../../styles'
2
+ import {getResponsiveProp, rem, responsive, ThemeProps} from '../../styles'
3
3
  import {ResponsiveWidthStyleProps} from './types'
4
4
 
5
5
  const BASE_STYLE: CSSObject = {
@@ -17,7 +17,7 @@ export function responsiveContainerWidthStyle(
17
17
  const {theme} = props
18
18
  const {container, media} = theme.sanity
19
19
 
20
- return _responsive(media, props.$width, (val) => ({
20
+ return responsive(media, getResponsiveProp(props.$width), (val) => ({
21
21
  maxWidth: val === 'auto' ? 'none' : rem(container[val]),
22
22
  }))
23
23
  }
@@ -2,5 +2,5 @@
2
2
  * @internal
3
3
  */
4
4
  export interface ResponsiveWidthStyleProps {
5
- $width: (number | 'auto')[]
5
+ $width?: number | number[] | 'auto'
6
6
  }
@@ -1,6 +1,5 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
- import {useArrayProp} from '../../hooks'
4
3
  import {
5
4
  flexItemStyle,
6
5
  FlexItemStyleProps,
@@ -38,11 +37,11 @@ export const Flex = forwardRef(function Flex(
38
37
  <Root
39
38
  data-ui="Flex"
40
39
  {...restProps}
41
- $align={useArrayProp(align)}
42
- $direction={useArrayProp(direction)}
43
- $gap={useArrayProp(gap)}
44
- $justify={useArrayProp(justify)}
45
- $wrap={useArrayProp(wrap)}
40
+ $align={align}
41
+ $direction={direction}
42
+ $gap={gap}
43
+ $justify={justify}
44
+ $wrap={wrap}
46
45
  forwardedAs={as}
47
46
  ref={ref}
48
47
  />
@@ -10,42 +10,41 @@ export default function ResponsiveStory() {
10
10
  columns={[1, 2, 3, 4, 5, 6, 7]}
11
11
  gap={[0, 1, 2, 3, 4, 5, 6]}
12
12
  rows={[1, 2, 3, 4, 5, 6, 7]}
13
- style={{textAlign: 'center'}}
14
13
  >
15
- <Card padding={[1, 2, 3]} tone="transparent">
14
+ <Card tone="transparent">
16
15
  <Code>1</Code>
17
16
  </Card>
18
- <Card padding={[1, 2, 3]} tone="transparent">
17
+ <Card tone="transparent">
19
18
  <Code>2</Code>
20
19
  </Card>
21
- <Card padding={[1, 2, 3]} tone="transparent">
20
+ <Card tone="transparent">
22
21
  <Code>3</Code>
23
22
  </Card>
24
- <Card padding={[1, 2, 3]} tone="transparent">
23
+ <Card tone="transparent">
25
24
  <Code>4</Code>
26
25
  </Card>
27
- <Card padding={[1, 2, 3]} tone="transparent">
26
+ <Card tone="transparent">
28
27
  <Code>5</Code>
29
28
  </Card>
30
- <Card padding={[1, 2, 3]} tone="transparent">
29
+ <Card tone="transparent">
31
30
  <Code>6</Code>
32
31
  </Card>
33
- <Card padding={[1, 2, 3]} tone="transparent">
32
+ <Card tone="transparent">
34
33
  <Code>7</Code>
35
34
  </Card>
36
- <Card padding={[1, 2, 3]} tone="transparent">
35
+ <Card tone="transparent">
37
36
  <Code>8</Code>
38
37
  </Card>
39
- <Card padding={[1, 2, 3]} tone="transparent">
38
+ <Card tone="transparent">
40
39
  <Code>9</Code>
41
40
  </Card>
42
- <Card padding={[1, 2, 3]} tone="transparent">
41
+ <Card tone="transparent">
43
42
  <Code>10</Code>
44
43
  </Card>
45
- <Card padding={[1, 2, 3]} tone="transparent">
44
+ <Card tone="transparent">
46
45
  <Code>11</Code>
47
46
  </Card>
48
- <Card padding={[1, 2, 3]} tone="transparent">
47
+ <Card tone="transparent">
49
48
  <Code>12</Code>
50
49
  </Card>
51
50
  </Grid>
@@ -1,6 +1,5 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
- import {useArrayProp} from '../../hooks'
4
3
  import {responsiveGridStyle, ResponsiveGridStyleProps} from '../../styles/internal'
5
4
  import {Box, BoxProps} from '../box'
6
5
  import {ResponsiveGridProps} from '../types'
@@ -27,14 +26,14 @@ export const Grid = forwardRef(function Grid(
27
26
  data-as={typeof as === 'string' ? as : undefined}
28
27
  data-ui="Grid"
29
28
  {...restProps}
30
- $autoRows={useArrayProp(autoRows)}
31
- $autoCols={useArrayProp(autoCols)}
32
- $autoFlow={useArrayProp(autoFlow)}
33
- $columns={useArrayProp(columns)}
34
- $gap={useArrayProp(gap)}
35
- $gapX={useArrayProp(gapX)}
36
- $gapY={useArrayProp(gapY)}
37
- $rows={useArrayProp(rows)}
29
+ $autoRows={autoRows}
30
+ $autoCols={autoCols}
31
+ $autoFlow={autoFlow}
32
+ $columns={columns}
33
+ $gap={gap}
34
+ $gapX={gapX}
35
+ $gapY={gapY}
36
+ $rows={rows}
38
37
  forwardedAs={as}
39
38
  ref={ref}
40
39
  >
@@ -8,55 +8,43 @@ export default function OpticalAlignment() {
8
8
  <Stack space={1}>
9
9
  <Flex>
10
10
  <Card padding={0} scheme="dark">
11
- <Heading accent size={5}>
12
- Hamburgefonstiv M
13
- </Heading>
11
+ <Heading size={5}>Hamburgefonstiv M</Heading>
14
12
  </Card>
15
13
  </Flex>
16
14
 
17
15
  <Flex>
18
16
  <Card padding={0} scheme="dark">
19
- <Heading accent size={4}>
20
- Hamburgefonstiv M
21
- </Heading>
17
+ <Heading size={4}>Hamburgefonstiv M</Heading>
22
18
  </Card>
23
19
  </Flex>
24
20
 
25
21
  <Flex>
26
22
  <Card padding={0} scheme="dark">
27
- <Heading accent size={3}>
28
- Hamburgefonstiv M
29
- </Heading>
23
+ <Heading size={3}>Hamburgefonstiv M</Heading>
30
24
  </Card>
31
25
  </Flex>
32
26
 
33
27
  <Flex>
34
28
  <Card padding={0} scheme="dark">
35
- <Heading accent size={2}>
36
- Hamburgefonstiv M
37
- </Heading>
29
+ <Heading size={2}>Hamburgefonstiv M</Heading>
38
30
  </Card>
39
31
  </Flex>
40
32
 
41
33
  <Flex>
42
34
  <Card padding={0} scheme="dark">
43
- <Heading accent size={1}>
44
- Hamburgefonstiv M
45
- </Heading>
35
+ <Heading size={1}>Hamburgefonstiv M</Heading>
46
36
  </Card>
47
37
  </Flex>
48
38
 
49
39
  <Flex>
50
40
  <Card padding={0} scheme="dark">
51
- <Heading accent size={0}>
52
- Hamburgefonstiv M
53
- </Heading>
41
+ <Heading size={0}>Hamburgefonstiv M</Heading>
54
42
  </Card>
55
43
  </Flex>
56
44
 
57
45
  <Flex>
58
46
  <Card padding={2} scheme="dark">
59
- <Heading accent>
47
+ <Heading>
60
48
  <AddCircleIcon />
61
49
  </Heading>
62
50
  </Card>
@@ -1,6 +1,5 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
- import {useArrayProp} from '../../hooks'
4
3
  import {
5
4
  ResponsiveFontStyleProps,
6
5
  responsiveHeadingFont,
@@ -70,9 +69,9 @@ export const Heading = forwardRef(function Heading(
70
69
  data-ui="Heading"
71
70
  {...restProps}
72
71
  $accent={accent}
73
- $align={useArrayProp(align)}
72
+ $align={align}
74
73
  $muted={muted}
75
- $size={useArrayProp(size)}
74
+ $size={size}
76
75
  $weight={weight}
77
76
  ref={ref}
78
77
  >