@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,12 +1,12 @@
1
1
  import { useId } from '@reach/auto-id';
2
- import React, { useMemo, useState, useRef, useEffect, createContext, useContext, useLayoutEffect, forwardRef, useCallback, cloneElement, isValidElement, createElement, useReducer, Children, Fragment, memo } from 'react';
2
+ import React, { useState, useRef, useEffect, createContext, useContext, useMemo, useLayoutEffect, forwardRef, useCallback, cloneElement, isValidElement, createElement, useReducer, Children, Fragment, memo } from 'react';
3
3
  import ReactIs, { isElement, isFragment, isValidElementType } from 'react-is';
4
4
  import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
5
- import { ResizeObserver } from '@juggle/resize-observer';
6
5
  import { white as white$1, black as black$1, hues } from '@sanity/color';
7
6
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
8
7
  import Refractor from 'react-refractor';
9
8
  import { usePopper } from 'react-popper';
9
+ import { ResizeObserver as ResizeObserver$1 } from '@juggle/resize-observer';
10
10
  import ReactDOM from 'react-dom';
11
11
  import maxSizeModifier from 'popper-max-size-modifier';
12
12
  import { AnimatePresence, motion } from 'framer-motion';
@@ -47,213 +47,6 @@ function _objectWithoutPropertiesLoose(source, excluded) {
47
47
  const EMPTY_ARRAY = [];
48
48
  const EMPTY_RECORD = {};
49
49
 
50
- /**
51
- * @internal
52
- */
53
-
54
- function _fillCSSObject(keys, value) {
55
- return keys.reduce((style, key) => {
56
- style[key] = value;
57
- return style;
58
- }, {});
59
- }
60
- /**
61
- * @public
62
- */
63
-
64
- function rem(pixelValue) {
65
- if (pixelValue === 0) return 0;
66
- return `${pixelValue / 16}rem`;
67
- }
68
- /**
69
- * @internal
70
- */
71
-
72
- function _responsive(media, values, callback) {
73
- const statements = values.map(callback);
74
- return statements.map((statement, mediaIndex) => {
75
- if (mediaIndex === 0) return statement;
76
- return {
77
- [`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
78
- };
79
- });
80
- }
81
- /**
82
- * @internal
83
- */
84
-
85
- function _getArrayProp(val, defaultVal) {
86
- if (val === undefined) return defaultVal || EMPTY_ARRAY;
87
- return Array.isArray(val) ? val : [val];
88
- }
89
- /**
90
- * @internal
91
- */
92
-
93
- function _getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
94
- if (!Array.isArray(spaceIndexes)) {
95
- throw new Error('the property must be array of numbers');
96
- }
97
-
98
- if (spaceIndexes.length === 0) {
99
- return null;
100
- }
101
-
102
- return _responsive(theme.sanity.media, spaceIndexes, spaceIndex => _fillCSSObject(props, rem(theme.sanity.space[spaceIndex])));
103
- }
104
-
105
- /**
106
- * A utility function getting responsive font styles.
107
- * @internal
108
- */
109
-
110
- function responsiveFont(fontKey, props) {
111
- const {
112
- $size,
113
- $weight,
114
- theme
115
- } = props;
116
- const {
117
- fonts,
118
- media
119
- } = theme.sanity;
120
- const {
121
- family,
122
- sizes,
123
- weights
124
- } = fonts[fontKey];
125
- const fontWeight = $weight && weights[$weight] || weights.regular; // @todo: make this configurable
126
-
127
- const defaultSize = sizes[2];
128
- const base = {
129
- position: 'relative',
130
- fontFamily: family,
131
- fontWeight,
132
- padding: '1px 0',
133
- margin: 0,
134
- '&:before': {
135
- content: '""',
136
- display: 'block',
137
- height: 0
138
- },
139
- '&:after': {
140
- content: '""',
141
- display: 'block',
142
- height: 0
143
- },
144
- '& > code, & > span': {
145
- display: 'block'
146
- },
147
- '&:not([hidden])': {
148
- display: 'block'
149
- }
150
- };
151
-
152
- const resp = _responsive(media, $size, sizeIndex => fontSize(sizes[sizeIndex] || defaultSize));
153
-
154
- return [base, ...resp];
155
- }
156
- function fontSize(size) {
157
- const {
158
- ascenderHeight,
159
- descenderHeight,
160
- fontSize,
161
- iconSize,
162
- letterSpacing,
163
- lineHeight
164
- } = size;
165
- const negHeight = ascenderHeight + descenderHeight;
166
- const capHeight = lineHeight - negHeight;
167
- const iconOffset = (capHeight - iconSize) / 2;
168
- const customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1;
169
- const customIconOffset = (capHeight - customIconSize) / 2;
170
- return {
171
- fontSize: rem(fontSize),
172
- lineHeight: `calc(${lineHeight} / ${fontSize})`,
173
- letterSpacing: rem(letterSpacing),
174
- transform: `translateY(${rem(descenderHeight)})`,
175
- '&:before': {
176
- marginTop: `calc(${rem(0 - negHeight)} - 1px)`
177
- },
178
- '&:after': {
179
- marginBottom: '-1px'
180
- },
181
- '& svg:not([data-sanity-icon])': {
182
- fontSize: `calc(${customIconSize} / 16 * 1rem)`,
183
- margin: rem(customIconOffset)
184
- },
185
- '& [data-sanity-icon]': {
186
- fontSize: `calc(${iconSize} / 16 * 1rem)`,
187
- margin: rem(iconOffset)
188
- }
189
- };
190
- }
191
-
192
- /**
193
- * Get responsive CSS for the `code` font style.
194
- * @internal
195
- */
196
-
197
- function responsiveCodeFontStyle(props) {
198
- return responsiveFont('code', props);
199
- }
200
-
201
- /**
202
- * Get responsive CSS for the `heading` font style.
203
- * @internal
204
- */
205
-
206
- function responsiveHeadingFont(props) {
207
- return responsiveFont('heading', props);
208
- }
209
-
210
- /**
211
- * Get responsive CSS for the `label` font style.
212
- * @internal
213
- */
214
-
215
- function responsiveLabelFont(props) {
216
- return responsiveFont('label', props);
217
- }
218
-
219
- /**
220
- * Get responsive text align styles.
221
- * @internal
222
- */
223
-
224
- function responsiveTextAlignStyle(props) {
225
- const {
226
- theme
227
- } = props;
228
- return _responsive(theme.sanity.media, props.$align, textAlign => {
229
- return {
230
- textAlign
231
- };
232
- });
233
- }
234
-
235
- /**
236
- * Get responsive CSS for the `text` font style.
237
- * @internal
238
- */
239
-
240
- function responsiveTextFont(props) {
241
- return responsiveFont('text', props);
242
- }
243
-
244
- /**
245
- * This API might change. DO NOT USE IN PRODUCTION.
246
- * @beta
247
- */
248
-
249
- function useArrayProp(val, defaultVal) {
250
- const __perf_hash__ = JSON.stringify(val != null ? val : defaultVal);
251
-
252
- return useMemo(() => _getArrayProp(val, defaultVal), // Improve performance: Keep object identify for a given hash of the value
253
- // eslint-disable-next-line react-hooks/exhaustive-deps
254
- [__perf_hash__]);
255
- }
256
-
257
50
  function _getElements(element, elementsArg) {
258
51
  const ret = [element];
259
52
 
@@ -335,107 +128,21 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
335
128
  }
336
129
 
337
130
  /**
338
- * @internal
339
- */
340
-
341
- const _ResizeObserver = typeof window !== 'undefined' && window.ResizeObserver ? window.ResizeObserver : ResizeObserver;
342
-
343
- // NOTE: this should NOT have size effects
344
-
345
- /**
346
- * @internal
347
- */
348
-
349
- const _elementSizeObserver = _createElementSizeObserver();
350
-
351
- function _createElementRectValueListener() {
352
- return {
353
- subscribe(element, subscriber) {
354
- const resizeObserver = new _ResizeObserver(([entry]) => {
355
- subscriber({
356
- _contentRect: entry.contentRect,
357
- border: {
358
- width: entry.borderBoxSize[0].inlineSize,
359
- height: entry.borderBoxSize[0].blockSize
360
- },
361
- content: {
362
- width: entry.contentRect.width,
363
- height: entry.contentRect.height
364
- }
365
- });
366
- });
367
- resizeObserver.observe(element);
368
- return () => {
369
- resizeObserver.unobserve(element);
370
- resizeObserver.disconnect();
371
- };
372
- }
373
-
374
- };
375
- }
376
-
377
- function _createElementSizeObserver() {
378
- const disposeCache = new WeakMap();
379
- const subscribersCache = new WeakMap();
380
- return {
381
- subscribe(element, subscriber) {
382
- const subscribers = subscribersCache.get(element) || [];
383
- let dispose = disposeCache.get(element);
384
-
385
- if (!subscribersCache.has(element)) {
386
- subscribersCache.set(element, subscribers);
387
-
388
- const listener = _createElementRectValueListener(); // listen
389
-
390
-
391
- dispose = listener.subscribe(element, elementRect => {
392
- for (const sub of subscribers) {
393
- sub(elementRect);
394
- }
395
- });
396
- }
397
-
398
- subscribers.push(subscriber);
399
- return () => {
400
- // dispose
401
- const idx = subscribers.indexOf(subscriber);
402
-
403
- if (idx > -1) {
404
- subscribers.splice(idx, 1);
405
- }
406
-
407
- if (subscribers.length === 0) {
408
- // unlisten
409
- if (dispose) dispose();
410
- }
411
- };
412
- }
413
-
414
- };
415
- }
416
-
417
- /**
418
- * Subscribe to the size of a DOM element.
131
+ * Subscribe to the rect of a DOM element.
419
132
  * @beta
420
133
  */
421
134
 
422
- function useElementSize(element) {
423
- const [size, setSize] = useState(null);
135
+ function useElementRect(element) {
136
+ const [rect, setRect] = useState(null);
424
137
  useEffect(() => {
425
138
  if (!element) return undefined;
426
- return _elementSizeObserver.subscribe(element, setSize);
139
+ const ro = new ResizeObserver(entries => {
140
+ setRect(entries[0].contentRect);
141
+ });
142
+ ro.observe(element);
143
+ return () => ro.disconnect();
427
144
  }, [element]);
428
- return size;
429
- }
430
-
431
- /**
432
- * Subscribe to the rect of a DOM element.
433
- * @deprecated Use `useElementSize` instead
434
- */
435
-
436
- function useElementRect(element) {
437
- const elementSize = useElementSize(element);
438
- return (elementSize == null ? void 0 : elementSize._contentRect) || null;
145
+ return rect;
439
146
  }
440
147
 
441
148
  /**
@@ -1884,20 +1591,18 @@ const color = createColorTheme({
1884
1591
  name
1885
1592
  }) => {
1886
1593
  if (name === 'default') {
1887
- const _tints = hues.gray;
1888
-
1889
- const _skeletonFrom = dark ? _tints[900].hex : _tints[100].hex;
1594
+ const _skeletonFrom = dark ? hues.gray[900].hex : hues.gray[100].hex;
1890
1595
 
1891
1596
  return {
1892
1597
  fg: dark ? white$1.hex : black$1.hex,
1893
1598
  bg: dark ? black$1.hex : white$1.hex,
1894
- border: _tints[dark ? 800 : 200].hex,
1599
+ border: hues.gray[dark ? 800 : 200].hex,
1895
1600
  focusRing: hues.blue[dark ? 500 : 500].hex,
1896
1601
  shadow: {
1897
- outline: rgba(_tints[500].hex, 0.4),
1898
- umbra: dark ? rgba(_tints[950].hex, 0.4) : rgba(_tints[500].hex, 0.2),
1899
- penumbra: dark ? rgba(_tints[950].hex, 0.28) : rgba(_tints[500].hex, 0.14),
1900
- ambient: dark ? rgba(_tints[950].hex, 0.24) : rgba(_tints[500].hex, 0.12)
1602
+ outline: rgba(hues.gray[500].hex, 0.4),
1603
+ umbra: rgba(dark ? black$1.hex : hues.gray[500].hex, 0.2),
1604
+ penumbra: rgba(dark ? black$1.hex : hues.gray[500].hex, 0.14),
1605
+ ambient: rgba(dark ? black$1.hex : hues.gray[500].hex, 0.12)
1901
1606
  },
1902
1607
  skeleton: {
1903
1608
  from: _skeletonFrom,
@@ -1907,18 +1612,18 @@ const color = createColorTheme({
1907
1612
  }
1908
1613
 
1909
1614
  if (name === 'transparent') {
1910
- const _tints2 = tones.default;
1911
- const _skeletonFrom2 = _tints2[dark ? 800 : 200].hex;
1615
+ const _tints = tones.default;
1616
+ const _skeletonFrom2 = _tints[dark ? 800 : 200].hex;
1912
1617
  return {
1913
- fg: _tints2[dark ? 100 : 900].hex,
1914
- bg: _tints2[dark ? 950 : 50].hex,
1915
- border: _tints2[dark ? 800 : 300].hex,
1618
+ fg: _tints[dark ? 100 : 900].hex,
1619
+ bg: _tints[dark ? 950 : 50].hex,
1620
+ border: _tints[dark ? 800 : 300].hex,
1916
1621
  focusRing: hues.blue[500].hex,
1917
1622
  shadow: {
1918
- outline: rgba(_tints2[500].hex, 0.4),
1919
- umbra: dark ? rgba(_tints2[900].hex, 0.4) : rgba(_tints2[500].hex, 0.2),
1920
- penumbra: dark ? rgba(_tints2[900].hex, 0.28) : rgba(_tints2[500].hex, 0.14),
1921
- ambient: dark ? rgba(_tints2[900].hex, 0.24) : rgba(_tints2[500].hex, 0.12)
1623
+ outline: rgba(_tints[500].hex, dark ? 0.2 : 0.4),
1624
+ umbra: rgba(dark ? black$1.hex : _tints[500].hex, 0.2),
1625
+ penumbra: rgba(dark ? black$1.hex : _tints[500].hex, 0.14),
1626
+ ambient: rgba(dark ? black$1.hex : _tints[500].hex, 0.12)
1922
1627
  },
1923
1628
  skeleton: {
1924
1629
  from: _skeletonFrom2,
@@ -1935,10 +1640,10 @@ const color = createColorTheme({
1935
1640
  border: tints[dark ? 800 : 200].hex,
1936
1641
  focusRing: tints[500].hex,
1937
1642
  shadow: {
1938
- outline: rgba(tints[500].hex, 0.4),
1939
- umbra: dark ? rgba(tints[900].hex, 0.4) : rgba(tints[500].hex, 0.2),
1940
- penumbra: dark ? rgba(tints[900].hex, 0.28) : rgba(tints[500].hex, 0.14),
1941
- ambient: dark ? rgba(tints[900].hex, 0.24) : rgba(tints[500].hex, 0.12)
1643
+ outline: rgba(tints[500].hex, dark ? 0.2 : 0.4),
1644
+ umbra: rgba(dark ? black$1.hex : tints[500].hex, 0.2),
1645
+ penumbra: rgba(dark ? black$1.hex : tints[500].hex, 0.14),
1646
+ ambient: rgba(dark ? black$1.hex : tints[500].hex, 0.12)
1942
1647
  },
1943
1648
  skeleton: {
1944
1649
  from: skeletonFrom,
@@ -2609,15 +2314,15 @@ const fonts = {
2609
2314
  lineHeight: 33,
2610
2315
  letterSpacing: 0
2611
2316
  }, {
2612
- ascenderHeight: 8,
2613
- descenderHeight: 8,
2317
+ ascenderHeight: 9,
2318
+ descenderHeight: 7,
2614
2319
  fontSize: 33,
2615
2320
  iconSize: 49,
2616
2321
  lineHeight: 39,
2617
2322
  letterSpacing: 0
2618
2323
  }, {
2619
- ascenderHeight: 9,
2620
- descenderHeight: 9,
2324
+ ascenderHeight: 10,
2325
+ descenderHeight: 8,
2621
2326
  fontSize: 38,
2622
2327
  iconSize: 53,
2623
2328
  lineHeight: 45,
@@ -3005,107 +2710,308 @@ function _createMediaManager(media) {
3005
2710
  }
3006
2711
  });
3007
2712
  }
3008
-
3009
- return () => {
3010
- for (const disposeFn of disposeFns) {
3011
- disposeFn();
3012
- }
3013
- };
3014
- };
3015
-
3016
- return {
3017
- getCurrentIndex,
3018
- subscribe
2713
+
2714
+ return () => {
2715
+ for (const disposeFn of disposeFns) {
2716
+ disposeFn();
2717
+ }
2718
+ };
2719
+ };
2720
+
2721
+ return {
2722
+ getCurrentIndex,
2723
+ subscribe
2724
+ };
2725
+ }
2726
+ /**
2727
+ * @internal
2728
+ */
2729
+
2730
+
2731
+ function _getMediaManager(media) {
2732
+ let manager = MEDIA_MANAGER_CACHE.get(media);
2733
+
2734
+ if (!manager) {
2735
+ manager = _createMediaManager(media);
2736
+ MEDIA_MANAGER_CACHE.set(media, manager);
2737
+ }
2738
+
2739
+ return manager;
2740
+ }
2741
+
2742
+ /**
2743
+ * This API might change. DO NOT USE IN PRODUCTION.
2744
+ * @beta
2745
+ */
2746
+
2747
+ function useMediaIndex() {
2748
+ const theme = useTheme();
2749
+ const {
2750
+ media
2751
+ } = theme.sanity;
2752
+ const manager = useMemo(() => _getMediaManager(media), [media]);
2753
+ const [index, setIndex] = useState(manager.getCurrentIndex);
2754
+ useEffect(() => manager.subscribe(setIndex), [manager]);
2755
+ return index;
2756
+ }
2757
+
2758
+ /**
2759
+ * @public
2760
+ */
2761
+
2762
+ function usePrefersDark() {
2763
+ const mq = useMemo(() => {
2764
+ if (typeof window === 'undefined') return undefined;
2765
+ return window.matchMedia('(prefers-color-scheme: dark)');
2766
+ }, []);
2767
+ const [dark, setDark] = useState((mq == null ? void 0 : mq.matches) || false);
2768
+ useEffect(() => {
2769
+ if (!mq) return undefined;
2770
+ setDark(mq.matches);
2771
+
2772
+ const handleChange = () => setDark(mq.matches);
2773
+
2774
+ mq.addEventListener('change', handleChange);
2775
+ return () => mq.removeEventListener('change', handleChange);
2776
+ }, [mq]);
2777
+ return dark;
2778
+ }
2779
+
2780
+ /**
2781
+ * @beta
2782
+ */
2783
+
2784
+ const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2785
+
2786
+ /**
2787
+ * @beta
2788
+ */
2789
+
2790
+ function useForwardedRef(ref) {
2791
+ const innerRef = useRef(null);
2792
+ useIsomorphicEffect(() => {
2793
+ if (!ref) return;
2794
+
2795
+ if (typeof ref === 'function') {
2796
+ ref(innerRef.current);
2797
+ } else {
2798
+ ref.current = innerRef.current;
2799
+ }
2800
+ });
2801
+ return innerRef;
2802
+ }
2803
+
2804
+ /**
2805
+ * @beta
2806
+ */
2807
+
2808
+ function useCustomValidity(ref, customValidity) {
2809
+ useEffect(() => {
2810
+ if (ref.current) {
2811
+ ref.current.setCustomValidity(customValidity || '');
2812
+ }
2813
+ }, [customValidity, ref]);
2814
+ }
2815
+
2816
+ /**
2817
+ * @internal
2818
+ */
2819
+
2820
+ function fillCSSObject(propKeys, value) {
2821
+ return propKeys.reduce((obj, propKey) => {
2822
+ obj[propKey] = value;
2823
+ return obj;
2824
+ }, {});
2825
+ }
2826
+ /**
2827
+ * @public
2828
+ */
2829
+
2830
+ function rem(pixelValue) {
2831
+ if (pixelValue === 0) return 0;
2832
+ return `${pixelValue / 16}rem`;
2833
+ }
2834
+ /**
2835
+ * @internal
2836
+ */
2837
+
2838
+ function responsive(media, values, callback) {
2839
+ const statements = values.map(callback);
2840
+ return statements.map((statement, mediaIndex) => {
2841
+ if (mediaIndex === 0) return statement;
2842
+ return {
2843
+ [`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
2844
+ };
2845
+ });
2846
+ }
2847
+ /**
2848
+ * @internal
2849
+ */
2850
+
2851
+ function getResponsiveProp(val, defaultVal) {
2852
+ if (val === undefined) return defaultVal || EMPTY_ARRAY;
2853
+ return Array.isArray(val) ? val : [val];
2854
+ }
2855
+ /**
2856
+ * @internal
2857
+ */
2858
+
2859
+ function getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
2860
+ if (!Array.isArray(spaceIndexes)) {
2861
+ throw new Error('the property must be array of numbers');
2862
+ }
2863
+
2864
+ if (spaceIndexes.length === 0) {
2865
+ return null;
2866
+ }
2867
+
2868
+ return responsive(theme.sanity.media, spaceIndexes, spaceIndex => fillCSSObject(props, rem(theme.sanity.space[spaceIndex])));
2869
+ }
2870
+
2871
+ /**
2872
+ * A utility function getting responsive font styles.
2873
+ * @internal
2874
+ */
2875
+
2876
+ function responsiveFont(fontKey, props) {
2877
+ const {
2878
+ $size,
2879
+ $weight,
2880
+ theme
2881
+ } = props;
2882
+ const {
2883
+ fonts,
2884
+ media
2885
+ } = theme.sanity;
2886
+ const {
2887
+ family,
2888
+ sizes,
2889
+ weights
2890
+ } = fonts[fontKey];
2891
+ const fontWeight = $weight && weights[$weight] || weights.regular; // @todo: make this configurable
2892
+
2893
+ const defaultSize = sizes[2];
2894
+ const base = {
2895
+ position: 'relative',
2896
+ fontFamily: family,
2897
+ fontWeight,
2898
+ padding: '1px 0',
2899
+ margin: 0,
2900
+ '&:before': {
2901
+ content: '""',
2902
+ display: 'block',
2903
+ height: 0
2904
+ },
2905
+ '&:after': {
2906
+ content: '""',
2907
+ display: 'block',
2908
+ height: 0
2909
+ },
2910
+ '& > code, & > span': {
2911
+ display: 'block'
2912
+ },
2913
+ '&:not([hidden])': {
2914
+ display: 'block'
2915
+ }
2916
+ };
2917
+ const resp = responsive(media, getResponsiveProp($size), sizeIndex => fontSize(sizes[sizeIndex] || defaultSize));
2918
+ return [base, ...resp];
2919
+ }
2920
+ function fontSize(size) {
2921
+ const {
2922
+ ascenderHeight,
2923
+ descenderHeight,
2924
+ fontSize,
2925
+ iconSize,
2926
+ letterSpacing,
2927
+ lineHeight
2928
+ } = size;
2929
+ const negHeight = ascenderHeight + descenderHeight;
2930
+ const capHeight = lineHeight - negHeight;
2931
+ const iconOffset = (capHeight - iconSize) / 2;
2932
+ const customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1;
2933
+ const customIconOffset = (capHeight - customIconSize) / 2;
2934
+ return {
2935
+ fontSize: rem(fontSize),
2936
+ lineHeight: `calc(${lineHeight} / ${fontSize})`,
2937
+ letterSpacing: rem(letterSpacing),
2938
+ transform: `translateY(${rem(descenderHeight)})`,
2939
+ '&:before': {
2940
+ marginTop: `calc(${rem(0 - negHeight)} - 1px)`
2941
+ },
2942
+ '&:after': {
2943
+ marginBottom: '-1px'
2944
+ },
2945
+ '& svg:not([data-sanity-icon])': {
2946
+ fontSize: `calc(${customIconSize} / 16 * 1rem)`,
2947
+ margin: rem(customIconOffset)
2948
+ },
2949
+ '& [data-sanity-icon]': {
2950
+ fontSize: `calc(${iconSize} / 16 * 1rem)`,
2951
+ margin: rem(iconOffset)
2952
+ }
3019
2953
  };
3020
2954
  }
2955
+
3021
2956
  /**
2957
+ * Get responsive CSS for the `code` font style.
3022
2958
  * @internal
3023
2959
  */
3024
2960
 
3025
-
3026
- function _getMediaManager(media) {
3027
- let manager = MEDIA_MANAGER_CACHE.get(media);
3028
-
3029
- if (!manager) {
3030
- manager = _createMediaManager(media);
3031
- MEDIA_MANAGER_CACHE.set(media, manager);
3032
- }
3033
-
3034
- return manager;
2961
+ function responsiveCodeFontStyle(props) {
2962
+ return responsiveFont('code', props);
3035
2963
  }
3036
2964
 
3037
2965
  /**
3038
- * This API might change. DO NOT USE IN PRODUCTION.
3039
- * @beta
2966
+ * Get responsive CSS for the `heading` font style.
2967
+ * @internal
3040
2968
  */
3041
2969
 
3042
- function useMediaIndex() {
3043
- const theme = useTheme();
3044
- const {
3045
- media
3046
- } = theme.sanity;
3047
- const manager = useMemo(() => _getMediaManager(media), [media]);
3048
- const [index, setIndex] = useState(manager.getCurrentIndex);
3049
- useEffect(() => manager.subscribe(setIndex), [manager]);
3050
- return index;
2970
+ function responsiveHeadingFont(props) {
2971
+ return responsiveFont('heading', props);
3051
2972
  }
3052
2973
 
3053
2974
  /**
3054
- * @public
2975
+ * Get responsive CSS for the `label` font style.
2976
+ * @internal
3055
2977
  */
3056
2978
 
3057
- function usePrefersDark() {
3058
- const mq = useMemo(() => {
3059
- if (typeof window === 'undefined') return undefined;
3060
- return window.matchMedia('(prefers-color-scheme: dark)');
3061
- }, []);
3062
- const [dark, setDark] = useState((mq == null ? void 0 : mq.matches) || false);
3063
- useEffect(() => {
3064
- if (!mq) return undefined;
3065
- setDark(mq.matches);
3066
-
3067
- const handleChange = () => setDark(mq.matches);
3068
-
3069
- mq.addEventListener('change', handleChange);
3070
- return () => mq.removeEventListener('change', handleChange);
3071
- }, [mq]);
3072
- return dark;
2979
+ function responsiveLabelFont(props) {
2980
+ return responsiveFont('label', props);
3073
2981
  }
3074
2982
 
3075
2983
  /**
3076
- * @beta
2984
+ * Get responsive text align styles.
2985
+ * @internal
3077
2986
  */
3078
2987
 
3079
- const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2988
+ function responsiveTextAlignStyle(props) {
2989
+ const {
2990
+ theme
2991
+ } = props;
2992
+ return responsive(theme.sanity.media, getResponsiveProp(props.$align), textAlign => {
2993
+ return {
2994
+ textAlign
2995
+ };
2996
+ });
2997
+ }
3080
2998
 
3081
2999
  /**
3082
- * @beta
3000
+ * Get responsive CSS for the `text` font style.
3001
+ * @internal
3083
3002
  */
3084
3003
 
3085
- function useForwardedRef(ref) {
3086
- const innerRef = useRef(null);
3087
- useIsomorphicEffect(() => {
3088
- if (!ref) return;
3089
-
3090
- if (typeof ref === 'function') {
3091
- ref(innerRef.current);
3092
- } else {
3093
- ref.current = innerRef.current;
3094
- }
3095
- });
3096
- return innerRef;
3004
+ function responsiveTextFont(props) {
3005
+ return responsiveFont('text', props);
3097
3006
  }
3098
3007
 
3099
3008
  /**
3009
+ * This API might change. DO NOT USE IN PRODUCTION.
3100
3010
  * @beta
3101
3011
  */
3102
3012
 
3103
- function useCustomValidity(ref, customValidity) {
3104
- useEffect(() => {
3105
- if (ref.current) {
3106
- ref.current.setCustomValidity(customValidity || '');
3107
- }
3108
- }, [customValidity, ref]);
3013
+ function useResponsiveProp(val, defaultVal) {
3014
+ return useMemo(() => getResponsiveProp(val, defaultVal), [defaultVal, val]);
3109
3015
  }
3110
3016
 
3111
3017
  const BORDER_VALUE = '1px solid var(--card-border-color)';
@@ -3120,7 +3026,7 @@ function border(props) {
3120
3026
  const {
3121
3027
  media
3122
3028
  } = theme.sanity;
3123
- return _responsive(media, props.$border, value => value ? {
3029
+ return responsive(media, getResponsiveProp(props.$border), value => value ? {
3124
3030
  '&&': {
3125
3031
  border: BORDER_VALUE
3126
3032
  }
@@ -3138,7 +3044,7 @@ function borderTop(props) {
3138
3044
  const {
3139
3045
  media
3140
3046
  } = theme.sanity;
3141
- return _responsive(media, props.$borderTop, value => value ? {
3047
+ return responsive(media, getResponsiveProp(props.$borderTop), value => value ? {
3142
3048
  '&&': {
3143
3049
  borderTop: BORDER_VALUE
3144
3050
  }
@@ -3156,7 +3062,7 @@ function borderRight(props) {
3156
3062
  const {
3157
3063
  media
3158
3064
  } = theme.sanity;
3159
- return _responsive(media, props.$borderRight, value => value ? {
3065
+ return responsive(media, getResponsiveProp(props.$borderRight), value => value ? {
3160
3066
  '&&': {
3161
3067
  borderRight: BORDER_VALUE
3162
3068
  }
@@ -3174,7 +3080,7 @@ function borderBottom(props) {
3174
3080
  const {
3175
3081
  media
3176
3082
  } = theme.sanity;
3177
- return _responsive(media, props.$borderBottom, value => value ? {
3083
+ return responsive(media, getResponsiveProp(props.$borderBottom), value => value ? {
3178
3084
  '&&': {
3179
3085
  borderBottom: BORDER_VALUE
3180
3086
  }
@@ -3192,7 +3098,7 @@ function borderLeft(props) {
3192
3098
  const {
3193
3099
  media
3194
3100
  } = theme.sanity;
3195
- return _responsive(media, props.$borderLeft, value => value ? {
3101
+ return responsive(media, getResponsiveProp(props.$borderLeft), value => value ? {
3196
3102
  '&&': {
3197
3103
  borderLeft: BORDER_VALUE
3198
3104
  }
@@ -3230,7 +3136,7 @@ function responsiveBoxDisplayStyle(props) {
3230
3136
  const {
3231
3137
  media
3232
3138
  } = theme.sanity;
3233
- return _responsive(media, props.$display, display => ({
3139
+ return responsive(media, getResponsiveProp(props.$display), display => ({
3234
3140
  '&:not([hidden])': {
3235
3141
  display
3236
3142
  }
@@ -3244,7 +3150,7 @@ function responsiveBoxSizingStyle(props) {
3244
3150
  const {
3245
3151
  media
3246
3152
  } = theme.sanity;
3247
- return _responsive(media, props.$sizing, sizing => ({
3153
+ return responsive(media, getResponsiveProp(props.$sizing), sizing => ({
3248
3154
  boxSizing: BOX_SIZING[sizing]
3249
3155
  }));
3250
3156
  }
@@ -3256,7 +3162,7 @@ function responsiveBoxHeightStyle(props) {
3256
3162
  const {
3257
3163
  media
3258
3164
  } = theme.sanity;
3259
- return _responsive(media, props.$height, height => ({
3165
+ return responsive(media, getResponsiveProp(props.$height), height => ({
3260
3166
  height: BOX_HEIGHT[height]
3261
3167
  }));
3262
3168
  }
@@ -3268,7 +3174,7 @@ function responsiveBoxOverflowStyle(props) {
3268
3174
  const {
3269
3175
  media
3270
3176
  } = theme.sanity;
3271
- return _responsive(media, props.$overflow, overflow => ({
3177
+ return responsive(media, getResponsiveProp(props.$overflow), overflow => ({
3272
3178
  overflow
3273
3179
  }));
3274
3180
  }
@@ -3288,7 +3194,7 @@ function responsiveFlexAlignStyle(props) {
3288
3194
  const {
3289
3195
  media
3290
3196
  } = theme.sanity;
3291
- return _responsive(media, props.$align, align => {
3197
+ return responsive(media, getResponsiveProp(props.$align), align => {
3292
3198
  return {
3293
3199
  alignItems: align
3294
3200
  };
@@ -3303,7 +3209,7 @@ function responsiveFlexGapStyle(props) {
3303
3209
  media,
3304
3210
  space
3305
3211
  } = theme.sanity;
3306
- return _responsive(media, props.$gap, gap => ({
3212
+ return responsive(media, getResponsiveProp(props.$gap), gap => ({
3307
3213
  gap: gap ? rem(space[gap]) : undefined
3308
3214
  }));
3309
3215
  }
@@ -3315,7 +3221,7 @@ function responsiveFlexWrapStyle(props) {
3315
3221
  const {
3316
3222
  media
3317
3223
  } = theme.sanity;
3318
- return _responsive(media, props.$wrap, wrap => {
3224
+ return responsive(media, getResponsiveProp(props.$wrap), wrap => {
3319
3225
  return {
3320
3226
  flexWrap: wrap
3321
3227
  };
@@ -3328,7 +3234,7 @@ function responsiveFlexJustifyStyle(props) {
3328
3234
  const {
3329
3235
  media
3330
3236
  } = theme.sanity;
3331
- return _responsive(media, props.$justify, justify => {
3237
+ return responsive(media, getResponsiveProp(props.$justify), justify => {
3332
3238
  return {
3333
3239
  justifyContent: justify
3334
3240
  };
@@ -3341,7 +3247,7 @@ function responsiveFlexDirectionStyle(props) {
3341
3247
  const {
3342
3248
  media
3343
3249
  } = theme.sanity;
3344
- return _responsive(media, props.$direction, direction => {
3250
+ return responsive(media, getResponsiveProp(props.$direction), direction => {
3345
3251
  return {
3346
3252
  flexDirection: direction
3347
3253
  };
@@ -3362,10 +3268,11 @@ function responsiveFlexItemStyle(props) {
3362
3268
  const {
3363
3269
  media
3364
3270
  } = theme.sanity;
3365
- if (!props.$flex) return EMPTY_ARRAY;
3366
- return _responsive(media, props.$flex, flex => ({
3367
- flex
3368
- }));
3271
+ return responsive(media, getResponsiveProp(props.$flex), flex => {
3272
+ return {
3273
+ flex
3274
+ };
3275
+ });
3369
3276
  }
3370
3277
 
3371
3278
  function focusRingBorderStyle(border) {
@@ -3414,7 +3321,7 @@ function responsiveGridAutoFlowStyle(props) {
3414
3321
  const {
3415
3322
  media
3416
3323
  } = theme.sanity;
3417
- return _responsive(media, props.$autoFlow, autoFlow => ({
3324
+ return responsive(media, getResponsiveProp(props.$autoFlow), autoFlow => ({
3418
3325
  gridAutoFlow: autoFlow
3419
3326
  }));
3420
3327
  }
@@ -3426,7 +3333,7 @@ function responsiveGridAutoRowsStyle(props) {
3426
3333
  const {
3427
3334
  media
3428
3335
  } = theme.sanity;
3429
- return _responsive(media, props.$autoRows, autoRows => ({
3336
+ return responsive(media, getResponsiveProp(props.$autoRows), autoRows => ({
3430
3337
  gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows]
3431
3338
  }));
3432
3339
  }
@@ -3438,7 +3345,7 @@ function responsiveGridAutoColsStyle(props) {
3438
3345
  const {
3439
3346
  media
3440
3347
  } = theme.sanity;
3441
- return _responsive(media, props.$autoCols, autoCols => ({
3348
+ return responsive(media, getResponsiveProp(props.$autoCols), autoCols => ({
3442
3349
  gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols]
3443
3350
  }));
3444
3351
  }
@@ -3450,7 +3357,7 @@ function responsiveGridColumnsStyle(props) {
3450
3357
  const {
3451
3358
  media
3452
3359
  } = theme.sanity;
3453
- return _responsive(media, props.$columns, columns => ({
3360
+ return responsive(media, getResponsiveProp(props.$columns), columns => ({
3454
3361
  gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));`
3455
3362
  }));
3456
3363
  }
@@ -3462,7 +3369,7 @@ function responsiveGridRowsStyle(props) {
3462
3369
  const {
3463
3370
  media
3464
3371
  } = theme.sanity;
3465
- return _responsive(media, props.$rows, rows => ({
3372
+ return responsive(media, getResponsiveProp(props.$rows), rows => ({
3466
3373
  gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));`
3467
3374
  }));
3468
3375
  }
@@ -3475,7 +3382,7 @@ function responsiveGridGapStyle(props) {
3475
3382
  media,
3476
3383
  space
3477
3384
  } = theme.sanity;
3478
- return _responsive(media, props.$gap, gap => ({
3385
+ return responsive(media, getResponsiveProp(props.$gap), gap => ({
3479
3386
  gridGap: gap ? rem(space[gap]) : undefined
3480
3387
  }));
3481
3388
  }
@@ -3488,7 +3395,7 @@ function responsiveGridGapXStyle(props) {
3488
3395
  media,
3489
3396
  space
3490
3397
  } = theme.sanity;
3491
- return _responsive(media, props.$gapX, gapX => ({
3398
+ return responsive(media, getResponsiveProp(props.$gapX), gapX => ({
3492
3399
  columnGap: gapX ? rem(space[gapX]) : undefined
3493
3400
  }));
3494
3401
  }
@@ -3501,7 +3408,7 @@ function responsiveGridGapYStyle(props) {
3501
3408
  media,
3502
3409
  space
3503
3410
  } = theme.sanity;
3504
- return _responsive(media, props.$gapY, gapY => ({
3411
+ return responsive(media, getResponsiveProp(props.$gapY), gapY => ({
3505
3412
  rowGap: gapY ? rem(space[gapY]) : undefined
3506
3413
  }));
3507
3414
  }
@@ -3525,7 +3432,7 @@ function responsiveGridItemRowStyle(props) {
3525
3432
  const {
3526
3433
  media
3527
3434
  } = theme.sanity;
3528
- return _responsive(media, props.$row, row => {
3435
+ return responsive(media, getResponsiveProp(props.$row), row => {
3529
3436
  if (typeof row === 'number') {
3530
3437
  return {
3531
3438
  gridRow: `span ${row} / span ${row}`
@@ -3545,7 +3452,7 @@ function responsiveGridItemRowStartStyle(props) {
3545
3452
  const {
3546
3453
  media
3547
3454
  } = theme.sanity;
3548
- return _responsive(media, props.$rowStart, rowStart => ({
3455
+ return responsive(media, getResponsiveProp(props.$rowStart), rowStart => ({
3549
3456
  gridRowStart: rowStart
3550
3457
  }));
3551
3458
  }
@@ -3557,7 +3464,7 @@ function responsiveGridItemRowEndStyle(props) {
3557
3464
  const {
3558
3465
  media
3559
3466
  } = theme.sanity;
3560
- return _responsive(media, props.$rowEnd, rowEnd => ({
3467
+ return responsive(media, getResponsiveProp(props.$rowEnd), rowEnd => ({
3561
3468
  gridRowEnd: rowEnd
3562
3469
  }));
3563
3470
  }
@@ -3569,7 +3476,7 @@ function responsiveGridItemColumnStyle(props) {
3569
3476
  const {
3570
3477
  media
3571
3478
  } = theme.sanity;
3572
- return _responsive(media, props.$column, column => {
3479
+ return responsive(media, getResponsiveProp(props.$column), column => {
3573
3480
  if (typeof column === 'number') {
3574
3481
  return {
3575
3482
  gridColumn: `span ${column} / span ${column}`
@@ -3589,7 +3496,7 @@ function responsiveGridItemColumnStartStyle(props) {
3589
3496
  const {
3590
3497
  media
3591
3498
  } = theme.sanity;
3592
- return _responsive(media, props.$columnStart, columnStart => ({
3499
+ return responsive(media, getResponsiveProp(props.$columnStart), columnStart => ({
3593
3500
  gridColumnStart: columnStart
3594
3501
  }));
3595
3502
  }
@@ -3601,18 +3508,15 @@ function responsiveGridItemColumnEndStyle(props) {
3601
3508
  const {
3602
3509
  media
3603
3510
  } = theme.sanity;
3604
- return _responsive(media, props.$columnEnd, columnEnd => ({
3511
+ return responsive(media, getResponsiveProp(props.$columnEnd), columnEnd => ({
3605
3512
  gridColumnEnd: columnEnd
3606
3513
  }));
3607
3514
  }
3608
3515
 
3609
3516
  function responsiveInputPaddingStyle(props) {
3610
3517
  const {
3611
- $fontSize,
3612
3518
  $iconLeft,
3613
3519
  $iconRight,
3614
- $padding,
3615
- $space,
3616
3520
  theme
3617
3521
  } = props;
3618
3522
  const {
@@ -3620,26 +3524,29 @@ function responsiveInputPaddingStyle(props) {
3620
3524
  media,
3621
3525
  space: spaceScale
3622
3526
  } = theme.sanity;
3623
- const len = Math.max($padding.length, $space.length, $fontSize.length);
3527
+ const padding = getResponsiveProp(props.$padding, [0]);
3528
+ const space = getResponsiveProp(props.$space, [0]);
3529
+ const size = getResponsiveProp(props.$fontSize, [0]);
3530
+ const len = Math.max(padding.length, space.length, size.length);
3624
3531
  const _padding = [];
3625
3532
  const _space = [];
3626
- const _fontSize = [];
3533
+ const _size = [];
3627
3534
 
3628
3535
  for (let i = 0; i < len; i += 1) {
3629
- _fontSize[i] = $fontSize[i] === undefined ? _fontSize[i - 1] : $fontSize[i];
3630
- _padding[i] = $padding[i] === undefined ? _padding[i - 1] : $padding[i];
3631
- _space[i] = $space[i] === undefined ? _space[i - 1] : $space[i];
3536
+ _padding[i] = padding[i] === undefined ? _padding[i - 1] : padding[i];
3537
+ _space[i] = space[i] === undefined ? _space[i - 1] : space[i];
3538
+ _size[i] = size[i] === undefined ? _size[i - 1] : size[i];
3632
3539
  }
3633
3540
 
3634
- return _responsive(media, _padding, (_, i) => {
3635
- const size = fonts.text.sizes[_fontSize[i]] || fonts.text.sizes[2];
3636
- const emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight;
3541
+ return responsive(media, _padding, (_, i) => {
3542
+ const fontSize = fonts.text.sizes[_size[i]] || fonts.text.sizes[2];
3543
+ const emSize = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight;
3637
3544
  const p = spaceScale[_padding[i]];
3638
3545
  const s = spaceScale[_space[i]];
3639
3546
  const styles = {
3640
- paddingTop: rem(p - size.ascenderHeight),
3547
+ paddingTop: rem(p - fontSize.ascenderHeight),
3641
3548
  paddingRight: rem(p),
3642
- paddingBottom: rem(p - size.descenderHeight),
3549
+ paddingBottom: rem(p - fontSize.descenderHeight),
3643
3550
  paddingLeft: rem(p)
3644
3551
  };
3645
3552
  if ($iconRight) styles.paddingRight = rem(p + emSize + s);
@@ -3670,13 +3577,14 @@ function textInputRootStyle() {
3670
3577
  function textInputBaseStyle(props) {
3671
3578
  const {
3672
3579
  theme,
3673
- $scheme,
3674
- $tone,
3675
3580
  $weight
3676
3581
  } = props;
3677
3582
  const font = theme.sanity.fonts.text;
3678
3583
  const color = theme.sanity.color.input;
3679
3584
  return css(_t2$n || (_t2$n = _$B`
3585
+ --input-fg-color: ${0};
3586
+ --input-placeholder-color: ${0};
3587
+
3680
3588
  appearance: none;
3681
3589
  background: none;
3682
3590
  border: 0;
@@ -3690,6 +3598,7 @@ function textInputBaseStyle(props) {
3690
3598
  position: relative;
3691
3599
  z-index: 1;
3692
3600
  display: block;
3601
+ color: var(--input-fg-color);
3693
3602
 
3694
3603
  /* NOTE: This is a hack to disable Chrome’s autofill styles */
3695
3604
  &:-webkit-autofill,
@@ -3701,46 +3610,39 @@ function textInputBaseStyle(props) {
3701
3610
  transition-delay: 86400s /* 24h */;
3702
3611
  }
3703
3612
 
3613
+ &::placeholder {
3614
+ color: var(--input-placeholder-color);
3615
+ }
3616
+
3704
3617
  /* &:is(textarea) */
3705
3618
  &[data-as='textarea'] {
3706
3619
  resize: none;
3707
3620
  }
3708
3621
 
3709
- color: var(--input-fg-color);
3710
-
3711
- &::placeholder {
3712
- color: var(--input-placeholder-color);
3622
+ /* enabled */
3623
+ &:not(:invalid):not(:disabled):not(:read-only) {
3624
+ --input-fg-color: ${0};
3625
+ --input-placeholder-color: ${0};
3713
3626
  }
3714
3627
 
3715
- &[data-scheme='${0}'][data-tone='${0}'] {
3628
+ /* disabled */
3629
+ &:not(:invalid):disabled {
3716
3630
  --input-fg-color: ${0};
3717
3631
  --input-placeholder-color: ${0};
3632
+ }
3718
3633
 
3719
- /* enabled */
3720
- &:not(:invalid):not(:disabled):not(:read-only) {
3721
- --input-fg-color: ${0};
3722
- --input-placeholder-color: ${0};
3723
- }
3724
-
3725
- /* disabled */
3726
- &:not(:invalid):disabled {
3727
- --input-fg-color: ${0};
3728
- --input-placeholder-color: ${0};
3729
- }
3730
-
3731
- /* invalid */
3732
- &:invalid {
3733
- --input-fg-color: ${0};
3734
- --input-placeholder-color: ${0};
3735
- }
3634
+ /* invalid */
3635
+ &:invalid {
3636
+ --input-fg-color: ${0};
3637
+ --input-placeholder-color: ${0};
3638
+ }
3736
3639
 
3737
- /* readOnly */
3738
- &:read-only {
3739
- --input-fg-color: ${0};
3740
- --input-placeholder-color: ${0};
3741
- }
3640
+ /* readOnly */
3641
+ &:read-only {
3642
+ --input-fg-color: ${0};
3643
+ --input-placeholder-color: ${0};
3742
3644
  }
3743
- `), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
3645
+ `), color.default.enabled.fg, color.default.enabled.placeholder, font.family, $weight && font.weights[$weight] || font.weights.regular, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
3744
3646
  }
3745
3647
  function textInputFontSizeStyle(props) {
3746
3648
  const {
@@ -3750,7 +3652,7 @@ function textInputFontSizeStyle(props) {
3750
3652
  fonts,
3751
3653
  media
3752
3654
  } = theme.sanity;
3753
- return _responsive(media, props.$fontSize, sizeIndex => {
3655
+ return responsive(media, getResponsiveProp(props.$fontSize, [2]), sizeIndex => {
3754
3656
  const size = fonts.text.sizes[sizeIndex] || fonts.text.sizes[2];
3755
3657
  return {
3756
3658
  fontSize: rem(size.fontSize),
@@ -3763,8 +3665,6 @@ function textInputRepresentationStyle(props) {
3763
3665
  $border,
3764
3666
  $hasPrefix,
3765
3667
  $hasSuffix,
3766
- $scheme,
3767
- $tone,
3768
3668
  theme
3769
3669
  } = props;
3770
3670
  const {
@@ -3773,6 +3673,8 @@ function textInputRepresentationStyle(props) {
3773
3673
  } = theme.sanity;
3774
3674
  const color = theme.sanity.color.input;
3775
3675
  return css(_t3$e || (_t3$e = _$B`
3676
+ --card-bg-color: ${0};
3677
+ --card-fg-color: ${0};
3776
3678
  --input-box-shadow: none;
3777
3679
 
3778
3680
  position: absolute;
@@ -3783,7 +3685,6 @@ function textInputRepresentationStyle(props) {
3783
3685
  display: block;
3784
3686
  pointer-events: none;
3785
3687
  z-index: 0;
3786
-
3787
3688
  background-color: var(--card-bg-color);
3788
3689
  box-shadow: var(--input-box-shadow);
3789
3690
 
@@ -3792,53 +3693,48 @@ function textInputRepresentationStyle(props) {
3792
3693
  border-top-right-radius: ${0};
3793
3694
  border-bottom-right-radius: ${0};
3794
3695
 
3795
- &[data-scheme='${0}'][data-tone='${0}'] {
3696
+ /* enabled */
3697
+ *:not(:disabled) + && {
3698
+ --input-box-shadow: ${0};
3699
+ }
3700
+
3701
+ /* invalid */
3702
+ *:not(:disabled):invalid + && {
3796
3703
  --card-bg-color: ${0};
3797
3704
  --card-fg-color: ${0};
3705
+ --input-box-shadow: ${0};
3706
+ }
3798
3707
 
3799
- /* enabled */
3800
- *:not(:disabled) + & {
3801
- --input-box-shadow: ${0};
3802
- }
3708
+ /* focused */
3709
+ *:not(:disabled):focus + && {
3710
+ --input-box-shadow: ${0};
3711
+ }
3712
+
3713
+ /* disabled */
3714
+ *:disabled + && {
3715
+ --card-bg-color: ${0};
3716
+ --card-fg-color: ${0};
3717
+ --input-box-shadow: ${0};
3718
+ }
3803
3719
 
3804
- /* invalid */
3805
- *:not(:disabled):invalid + & {
3720
+ /* hovered */
3721
+ @media (hover: hover) {
3722
+ *:not(:disabled):not(:read-only):not(:invalid):hover + && {
3806
3723
  --card-bg-color: ${0};
3807
3724
  --card-fg-color: ${0};
3808
- --input-box-shadow: ${0};
3809
- }
3810
-
3811
- /* focused */
3812
- *:not(:disabled):focus + & {
3813
- --input-box-shadow: ${0};
3814
3725
  }
3815
3726
 
3816
- /* disabled */
3817
- *:disabled + & {
3818
- --card-bg-color: ${0} !important;
3819
- --card-fg-color: ${0} !important;
3727
+ *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + && {
3820
3728
  --input-box-shadow: ${0};
3821
3729
  }
3730
+ }
3822
3731
 
3823
- /* readOnly */
3824
- *:read-only + & {
3825
- --card-bg-color: ${0} !important;
3826
- --card-fg-color: ${0} !important;
3827
- }
3828
-
3829
- /* hovered */
3830
- @media (hover: hover) {
3831
- *:not(:disabled):not(:read-only):not(:invalid):hover + & {
3832
- --card-bg-color: ${0};
3833
- --card-fg-color: ${0};
3834
- }
3835
-
3836
- *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + & {
3837
- --input-box-shadow: ${0};
3838
- }
3839
- }
3732
+ /* readOnly */
3733
+ *:read-only + && {
3734
+ --card-bg-color: ${0};
3735
+ --card-fg-color: ${0};
3840
3736
  }
3841
- `), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $scheme, $tone, color.default.enabled.bg, color.default.enabled.fg, $border ? focusRingBorderStyle({
3737
+ `), color.default.enabled.bg, color.default.enabled.fg, $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $border ? focusRingBorderStyle({
3842
3738
  color: color.default.enabled.border,
3843
3739
  width: input.border.width
3844
3740
  }) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
@@ -3853,24 +3749,24 @@ function textInputRepresentationStyle(props) {
3853
3749
  }), color.default.disabled.bg, color.default.disabled.fg, $border ? focusRingBorderStyle({
3854
3750
  color: color.default.disabled.border,
3855
3751
  width: input.border.width
3856
- }) : 'none', color.default.readOnly.bg, color.default.readOnly.fg, color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
3752
+ }) : 'none', color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
3857
3753
  color: color.default.hovered.border,
3858
3754
  width: input.border.width
3859
- }) : 'none');
3755
+ }) : 'none', color.default.readOnly.bg, color.default.readOnly.fg);
3860
3756
  }
3861
3757
 
3862
3758
  function responsiveMarginStyle(props) {
3863
3759
  const {
3864
3760
  theme
3865
3761
  } = props;
3866
- return [_getResponsiveSpace(theme, ['margin'], props.$margin), _getResponsiveSpace(theme, ['marginLeft', 'marginRight'], props.$marginX), _getResponsiveSpace(theme, ['marginTop', 'marginBottom'], props.$marginY), _getResponsiveSpace(theme, ['marginTop'], props.$marginTop), _getResponsiveSpace(theme, ['marginRight'], props.$marginRight), _getResponsiveSpace(theme, ['marginBottom'], props.$marginBottom), _getResponsiveSpace(theme, ['marginLeft'], props.$marginLeft)].filter(Boolean);
3762
+ return [getResponsiveSpace(theme, ['margin'], getResponsiveProp(props.$margin)), getResponsiveSpace(theme, ['marginLeft', 'marginRight'], getResponsiveProp(props.$marginX)), getResponsiveSpace(theme, ['marginTop', 'marginBottom'], getResponsiveProp(props.$marginY)), getResponsiveSpace(theme, ['marginTop'], getResponsiveProp(props.$marginTop)), getResponsiveSpace(theme, ['marginRight'], getResponsiveProp(props.$marginRight)), getResponsiveSpace(theme, ['marginBottom'], getResponsiveProp(props.$marginBottom)), getResponsiveSpace(theme, ['marginLeft'], getResponsiveProp(props.$marginLeft))].filter(Boolean);
3867
3763
  }
3868
3764
 
3869
3765
  function responsivePaddingStyle(props) {
3870
3766
  const {
3871
3767
  theme
3872
3768
  } = props;
3873
- return [_getResponsiveSpace(theme, ['padding'], props.$padding), _getResponsiveSpace(theme, ['paddingLeft', 'paddingRight'], props.$paddingX), _getResponsiveSpace(theme, ['paddingTop', 'paddingBottom'], props.$paddingY), _getResponsiveSpace(theme, ['paddingTop'], props.$paddingTop), _getResponsiveSpace(theme, ['paddingRight'], props.$paddingRight), _getResponsiveSpace(theme, ['paddingBottom'], props.$paddingBottom), _getResponsiveSpace(theme, ['paddingLeft'], props.$paddingLeft)].filter(Boolean);
3769
+ return [getResponsiveSpace(theme, ['padding'], getResponsiveProp(props.$padding)), getResponsiveSpace(theme, ['paddingLeft', 'paddingRight'], getResponsiveProp(props.$paddingX)), getResponsiveSpace(theme, ['paddingTop', 'paddingBottom'], getResponsiveProp(props.$paddingY)), getResponsiveSpace(theme, ['paddingTop'], getResponsiveProp(props.$paddingTop)), getResponsiveSpace(theme, ['paddingRight'], getResponsiveProp(props.$paddingRight)), getResponsiveSpace(theme, ['paddingBottom'], getResponsiveProp(props.$paddingBottom)), getResponsiveSpace(theme, ['paddingLeft'], getResponsiveProp(props.$paddingLeft))].filter(Boolean);
3874
3770
  }
3875
3771
 
3876
3772
  function responsiveRadiusStyle(props) {
@@ -3881,7 +3777,7 @@ function responsiveRadiusStyle(props) {
3881
3777
  media,
3882
3778
  radius
3883
3779
  } = theme.sanity;
3884
- return _responsive(media, props.$radius, radiusIndex => ({
3780
+ return responsive(media, getResponsiveProp(props.$radius), radiusIndex => ({
3885
3781
  borderRadius: rem(radius[radiusIndex])
3886
3782
  }));
3887
3783
  }
@@ -3909,7 +3805,7 @@ function responsiveShadowStyle(props) {
3909
3805
  media,
3910
3806
  shadows
3911
3807
  } = theme.sanity;
3912
- return _responsive(media, props.$shadow, shadow => shadowStyle(shadows[shadow]));
3808
+ return responsive(media, getResponsiveProp(props.$shadow), shadow => shadowStyle(shadows[shadow]));
3913
3809
  }
3914
3810
 
3915
3811
  let _$A = t => t,
@@ -4011,10 +3907,10 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
4011
3907
  "data-ui": "Text"
4012
3908
  }, restProps, {
4013
3909
  "$accent": accent,
4014
- "$align": useArrayProp(align),
3910
+ "$align": align,
4015
3911
  "$muted": muted,
4016
3912
  ref: ref,
4017
- "$size": useArrayProp(size),
3913
+ "$size": size,
4018
3914
  "$weight": weight
4019
3915
  }), /*#__PURE__*/React.createElement("span", null, children));
4020
3916
  });
@@ -4117,7 +4013,7 @@ function responsiveAvatarSizeStyle(props) {
4117
4013
  avatar,
4118
4014
  media
4119
4015
  } = theme.sanity;
4120
- return _responsive(media, props.$size, size => {
4016
+ return responsive(media, props.$size, size => {
4121
4017
  const avatarSize = avatar.sizes[size] || avatar.sizes[0];
4122
4018
  return {
4123
4019
  width: rem(avatarSize.size),
@@ -4191,12 +4087,12 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4191
4087
  arrowPosition: arrowPositionProp,
4192
4088
  animateArrowFrom,
4193
4089
  status = 'online',
4194
- size: sizeProp = 0
4090
+ size: sizeProp
4195
4091
  } = props,
4196
4092
  restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4197
4093
 
4198
4094
  const as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
4199
- const size = useArrayProp(sizeProp);
4095
+ const size = useResponsiveProp(sizeProp, [0]);
4200
4096
  const theme = useTheme();
4201
4097
  const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray; // @todo: remove this
4202
4098
 
@@ -4225,7 +4121,6 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4225
4121
  onImageLoadError(new Error('Avatar: the image failed to load'));
4226
4122
  }
4227
4123
  }, [onImageLoadError]);
4228
- const initialsSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
4229
4124
  return /*#__PURE__*/React.createElement(Root$D, _extends({
4230
4125
  as: as,
4231
4126
  "data-as": typeof as === 'string' ? as : undefined,
@@ -4279,14 +4174,14 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4279
4174
  vectorEffect: "non-scaling-stroke"
4280
4175
  })), (imageFailed || !src) && initials && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Initials, null, /*#__PURE__*/React.createElement(Text, {
4281
4176
  as: "span",
4282
- size: initialsSize
4177
+ size: size.map(s => s === 0 ? 0 : s + 1)
4283
4178
  }, /*#__PURE__*/React.createElement("strong", null, initials)))));
4284
4179
  });
4285
4180
 
4286
4181
  let _$y = t => t,
4287
4182
  _t$A;
4288
4183
 
4289
- function _responsiveAvatarCounterSizeStyle(props) {
4184
+ function responsiveAvatarCounterSizeStyle(props) {
4290
4185
  const {
4291
4186
  theme
4292
4187
  } = props;
@@ -4294,7 +4189,7 @@ function _responsiveAvatarCounterSizeStyle(props) {
4294
4189
  avatar,
4295
4190
  media
4296
4191
  } = theme.sanity;
4297
- return _responsive(media, props.$size, size => {
4192
+ return responsive(media, props.$size, size => {
4298
4193
  const avatarSize = avatar.sizes[size];
4299
4194
  if (!avatarSize) return EMPTY_RECORD;
4300
4195
  return {
@@ -4305,7 +4200,7 @@ function _responsiveAvatarCounterSizeStyle(props) {
4305
4200
  });
4306
4201
  }
4307
4202
 
4308
- function _avatarCounterBaseStyle(props) {
4203
+ function avatarCounterBaseStyle(props) {
4309
4204
  const {
4310
4205
  theme
4311
4206
  } = props;
@@ -4326,7 +4221,7 @@ function _avatarCounterBaseStyle(props) {
4326
4221
  `), rem(theme.sanity.space[2]));
4327
4222
  }
4328
4223
 
4329
- const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
4224
+ const Root$C = styled.div(responsiveAvatarCounterSizeStyle, avatarCounterBaseStyle);
4330
4225
  /**
4331
4226
  * @public
4332
4227
  */
@@ -4336,15 +4231,13 @@ const AvatarCounter = /*#__PURE__*/forwardRef(function AvatarCounter(props, ref)
4336
4231
  count,
4337
4232
  size: sizeProp = 0
4338
4233
  } = props;
4339
- const size = useArrayProp(sizeProp);
4340
- const counterSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
4234
+ const size = useResponsiveProp(sizeProp, [0]);
4341
4235
  return /*#__PURE__*/React.createElement(Root$C, {
4342
4236
  "$size": size,
4343
- "data-ui": "AvatarCounter",
4344
4237
  ref: ref
4345
4238
  }, /*#__PURE__*/React.createElement(Text, {
4346
4239
  as: "span",
4347
- size: counterSize
4240
+ size: size.map(s => s === 0 ? 0 : s + 1)
4348
4241
  }, /*#__PURE__*/React.createElement("strong", null, count)));
4349
4242
  });
4350
4243
 
@@ -4353,7 +4246,7 @@ function childrenToElementArray(children) {
4353
4246
  return childrenArray.filter(node => isElement(node) || isFragment(node) || typeof node === 'string');
4354
4247
  }
4355
4248
 
4356
- const _excluded$E = ["children", "maxLength", "size"];
4249
+ const _excluded$E = ["children", "maxLength", "size", "tone"];
4357
4250
 
4358
4251
  let _$x = t => t,
4359
4252
  _t$z;
@@ -4381,7 +4274,7 @@ function responsiveAvatarStackSizeStyle(props) {
4381
4274
  avatar,
4382
4275
  media
4383
4276
  } = theme.sanity;
4384
- return _responsive(media, props.$size, size => {
4277
+ return responsive(media, getResponsiveProp(props.size), size => {
4385
4278
  const avatarSize = avatar.sizes[size];
4386
4279
  if (!avatarSize) return EMPTY_RECORD;
4387
4280
  return {
@@ -4401,13 +4294,12 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4401
4294
  const {
4402
4295
  children: childrenProp,
4403
4296
  maxLength: maxLengthProp = 4,
4404
- size: sizeProp = 0
4297
+ size = 0
4405
4298
  } = props,
4406
4299
  restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4407
4300
 
4408
- const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
4409
4301
  const maxLength = Math.max(maxLengthProp, 0);
4410
- const size = useArrayProp(sizeProp);
4302
+ const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
4411
4303
  const len = children.length;
4412
4304
  const visibleCount = maxLength - 1;
4413
4305
  const extraCount = len - visibleCount;
@@ -4416,7 +4308,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4416
4308
  "data-ui": "AvatarStack"
4417
4309
  }, restProps, {
4418
4310
  ref: ref,
4419
- "$size": size
4311
+ size: size
4420
4312
  }), len === 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
4421
4313
  count: len
4422
4314
  })), len !== 0 && extraCount > 1 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
@@ -4470,31 +4362,31 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4470
4362
  "data-as": typeof asProp === 'string' ? asProp : undefined,
4471
4363
  "data-ui": "Box"
4472
4364
  }, restProps, {
4473
- "$column": useArrayProp(column),
4474
- "$columnStart": useArrayProp(columnStart),
4475
- "$columnEnd": useArrayProp(columnEnd),
4476
- "$display": useArrayProp(display),
4477
- "$flex": useArrayProp(flex),
4478
- "$height": useArrayProp(height),
4479
- "$margin": useArrayProp(margin),
4480
- "$marginX": useArrayProp(marginX),
4481
- "$marginY": useArrayProp(marginY),
4482
- "$marginTop": useArrayProp(marginTop),
4483
- "$marginRight": useArrayProp(marginRight),
4484
- "$marginBottom": useArrayProp(marginBottom),
4485
- "$marginLeft": useArrayProp(marginLeft),
4486
- "$overflow": useArrayProp(overflow),
4487
- "$padding": useArrayProp(padding),
4488
- "$paddingX": useArrayProp(paddingX),
4489
- "$paddingY": useArrayProp(paddingY),
4490
- "$paddingTop": useArrayProp(paddingTop),
4491
- "$paddingRight": useArrayProp(paddingRight),
4492
- "$paddingBottom": useArrayProp(paddingBottom),
4493
- "$paddingLeft": useArrayProp(paddingLeft),
4494
- "$row": useArrayProp(row),
4495
- "$rowStart": useArrayProp(rowStart),
4496
- "$rowEnd": useArrayProp(rowEnd),
4497
- "$sizing": useArrayProp(sizing),
4365
+ "$column": column,
4366
+ "$columnStart": columnStart,
4367
+ "$columnEnd": columnEnd,
4368
+ "$display": display,
4369
+ "$flex": flex,
4370
+ "$height": height,
4371
+ "$margin": margin,
4372
+ "$marginX": marginX,
4373
+ "$marginY": marginY,
4374
+ "$marginTop": marginTop,
4375
+ "$marginRight": marginRight,
4376
+ "$marginBottom": marginBottom,
4377
+ "$marginLeft": marginLeft,
4378
+ "$overflow": overflow,
4379
+ "$padding": padding,
4380
+ "$paddingX": paddingX,
4381
+ "$paddingY": paddingY,
4382
+ "$paddingTop": paddingTop,
4383
+ "$paddingRight": paddingRight,
4384
+ "$paddingBottom": paddingBottom,
4385
+ "$paddingLeft": paddingLeft,
4386
+ "$row": row,
4387
+ "$rowStart": rowStart,
4388
+ "$rowEnd": rowEnd,
4389
+ "$sizing": sizing,
4498
4390
  as: asProp,
4499
4391
  ref: ref
4500
4392
  }), props.children);
@@ -4579,9 +4471,9 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
4579
4471
  "data-ui": "Label"
4580
4472
  }, restProps, {
4581
4473
  "$accent": accent,
4582
- "$align": useArrayProp(align),
4474
+ "$align": align,
4583
4475
  "$muted": muted,
4584
- "$size": useArrayProp(size),
4476
+ "$size": size,
4585
4477
  "$weight": weight,
4586
4478
  ref: ref
4587
4479
  }), children);
@@ -4628,8 +4520,8 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4628
4520
  }, restProps, {
4629
4521
  "$mode": mode,
4630
4522
  "$tone": tone,
4631
- "$radius": useArrayProp(radius),
4632
- padding: useArrayProp(padding),
4523
+ "$radius": radius,
4524
+ padding: padding,
4633
4525
  ref: ref
4634
4526
  }), /*#__PURE__*/React.createElement(Label, {
4635
4527
  size: fontSize
@@ -4656,11 +4548,11 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4656
4548
  return /*#__PURE__*/React.createElement(Root$x, _extends({
4657
4549
  "data-ui": "Flex"
4658
4550
  }, restProps, {
4659
- "$align": useArrayProp(align),
4660
- "$direction": useArrayProp(direction),
4661
- "$gap": useArrayProp(gap),
4662
- "$justify": useArrayProp(justify),
4663
- "$wrap": useArrayProp(wrap),
4551
+ "$align": align,
4552
+ "$direction": direction,
4553
+ "$gap": gap,
4554
+ "$justify": justify,
4555
+ "$wrap": wrap,
4664
4556
  forwardedAs: as,
4665
4557
  ref: ref
4666
4558
  }));
@@ -4847,19 +4739,19 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4847
4739
  fontSize,
4848
4740
  icon,
4849
4741
  iconRight,
4850
- justify: justifyProp = 'center',
4742
+ justify = 'center',
4851
4743
  loading,
4852
4744
  mode = 'default',
4853
- padding: paddingProp = 3,
4854
- paddingX: paddingXProp,
4855
- paddingY: paddingYProp,
4856
- paddingTop: paddingTopProp,
4857
- paddingBottom: paddingBottomProp,
4858
- paddingLeft: paddingLeftProp,
4859
- paddingRight: paddingRightProp,
4860
- radius: radiusProp = 2,
4745
+ padding = 3,
4746
+ paddingX,
4747
+ paddingY,
4748
+ paddingTop,
4749
+ paddingBottom,
4750
+ paddingLeft,
4751
+ paddingRight,
4752
+ radius = 2,
4861
4753
  selected,
4862
- space: spaceProp = 3,
4754
+ space = 3,
4863
4755
  text,
4864
4756
  textAlign,
4865
4757
  tone = 'default',
@@ -4867,16 +4759,6 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4867
4759
  } = props,
4868
4760
  restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
4869
4761
 
4870
- const justify = useArrayProp(justifyProp);
4871
- const padding = useArrayProp(paddingProp);
4872
- const paddingX = useArrayProp(paddingXProp);
4873
- const paddingY = useArrayProp(paddingYProp);
4874
- const paddingTop = useArrayProp(paddingTopProp);
4875
- const paddingBottom = useArrayProp(paddingBottomProp);
4876
- const paddingLeft = useArrayProp(paddingLeftProp);
4877
- const paddingRight = useArrayProp(paddingRightProp);
4878
- const radius = useArrayProp(radiusProp);
4879
- const space = useArrayProp(spaceProp);
4880
4762
  const theme = useTheme();
4881
4763
  const boxProps = useMemo(() => ({
4882
4764
  // flex: 1,
@@ -5120,15 +5002,15 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
5120
5002
  "data-ui": "Card",
5121
5003
  "data-tone": tone
5122
5004
  }, restProps, {
5123
- "$border": useArrayProp(border),
5124
- "$borderTop": useArrayProp(borderTop),
5125
- "$borderRight": useArrayProp(borderRight),
5126
- "$borderBottom": useArrayProp(borderBottom),
5127
- "$borderLeft": useArrayProp(borderLeft),
5005
+ "$border": border,
5006
+ "$borderTop": borderTop,
5007
+ "$borderRight": borderRight,
5008
+ "$borderBottom": borderBottom,
5009
+ "$borderLeft": borderLeft,
5128
5010
  "$checkered": checkered,
5129
5011
  "$focusRing": focusRing,
5130
- "$radius": useArrayProp(radius),
5131
- "$shadow": useArrayProp(shadow),
5012
+ "$radius": radius,
5013
+ "$shadow": shadow,
5132
5014
  "$tone": tone,
5133
5015
  "data-checkered": checkered ? '' : undefined,
5134
5016
  "data-pressed": pressed ? '' : undefined,
@@ -5448,7 +5330,7 @@ const Code = /*#__PURE__*/forwardRef(function Code(props, ref) {
5448
5330
  return /*#__PURE__*/React.createElement(Root$s, _extends({
5449
5331
  "data-ui": "Code"
5450
5332
  }, restProps, {
5451
- "$size": useArrayProp(size),
5333
+ "$size": size,
5452
5334
  "$weight": weight,
5453
5335
  ref: ref
5454
5336
  }), !(language && registered) && /*#__PURE__*/React.createElement("code", null, children), language && registered && /*#__PURE__*/React.createElement(Refractor, {
@@ -5473,7 +5355,7 @@ function responsiveContainerWidthStyle(props) {
5473
5355
  container,
5474
5356
  media
5475
5357
  } = theme.sanity;
5476
- return _responsive(media, props.$width, val => ({
5358
+ return responsive(media, getResponsiveProp(props.$width), val => ({
5477
5359
  maxWidth: val === 'auto' ? 'none' : rem(container[val])
5478
5360
  }));
5479
5361
  }
@@ -5494,7 +5376,7 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
5494
5376
  return /*#__PURE__*/React.createElement(Root$r, _extends({
5495
5377
  "data-ui": "Container"
5496
5378
  }, restProps, {
5497
- "$width": useArrayProp(width),
5379
+ "$width": width,
5498
5380
  forwardedAs: as,
5499
5381
  ref: ref
5500
5382
  }));
@@ -5525,14 +5407,14 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
5525
5407
  "data-as": typeof as === 'string' ? as : undefined,
5526
5408
  "data-ui": "Grid"
5527
5409
  }, restProps, {
5528
- "$autoRows": useArrayProp(autoRows),
5529
- "$autoCols": useArrayProp(autoCols),
5530
- "$autoFlow": useArrayProp(autoFlow),
5531
- "$columns": useArrayProp(columns),
5532
- "$gap": useArrayProp(gap),
5533
- "$gapX": useArrayProp(gapX),
5534
- "$gapY": useArrayProp(gapY),
5535
- "$rows": useArrayProp(rows),
5410
+ "$autoRows": autoRows,
5411
+ "$autoCols": autoCols,
5412
+ "$autoFlow": autoFlow,
5413
+ "$columns": columns,
5414
+ "$gap": gap,
5415
+ "$gapX": gapX,
5416
+ "$gapY": gapY,
5417
+ "$rows": rows,
5536
5418
  forwardedAs: as,
5537
5419
  ref: ref
5538
5420
  }), children);
@@ -5626,9 +5508,9 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
5626
5508
  "data-ui": "Heading"
5627
5509
  }, restProps, {
5628
5510
  "$accent": accent,
5629
- "$align": useArrayProp(align),
5511
+ "$align": align,
5630
5512
  "$muted": muted,
5631
- "$size": useArrayProp(size),
5513
+ "$size": size,
5632
5514
  "$weight": weight,
5633
5515
  ref: ref
5634
5516
  }), /*#__PURE__*/React.createElement("span", null, children));
@@ -5650,7 +5532,7 @@ function inlineSpaceStyle(props) {
5650
5532
  const {
5651
5533
  theme
5652
5534
  } = props;
5653
- return _responsive(theme.sanity.media, props.$space, spaceIndex => {
5535
+ return responsive(theme.sanity.media, getResponsiveProp(props.$space), spaceIndex => {
5654
5536
  const space = rem(theme.sanity.space[spaceIndex]);
5655
5537
  return {
5656
5538
  margin: `-${space} 0 0 -${space}`,
@@ -5675,16 +5557,16 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
5675
5557
  } = props,
5676
5558
  restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
5677
5559
 
5678
- const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /*#__PURE__*/React.createElement("div", {
5679
- key: idx
5680
- }, child)), [childrenProp]);
5560
+ const children = childrenToElementArray(childrenProp).filter(Boolean);
5681
5561
  return /*#__PURE__*/React.createElement(Root$o, _extends({
5682
5562
  "data-ui": "Inline"
5683
5563
  }, restProps, {
5684
- "$space": useArrayProp(space),
5564
+ "$space": space,
5685
5565
  forwardedAs: as,
5686
5566
  ref: ref
5687
- }), children);
5567
+ }), children.map((child, idx) => /*#__PURE__*/React.createElement("div", {
5568
+ key: idx
5569
+ }, child)));
5688
5570
  });
5689
5571
 
5690
5572
  const _excluded$r = ["children", "fontSize", "padding", "radius"];
@@ -5721,7 +5603,7 @@ const KBD = /*#__PURE__*/forwardRef(function KBD(props, ref) {
5721
5603
  return /*#__PURE__*/React.createElement(Root$n, _extends({
5722
5604
  "data-ui": "KBD"
5723
5605
  }, restProps, {
5724
- "$radius": useArrayProp(radius),
5606
+ "$radius": radius,
5725
5607
  ref: ref
5726
5608
  }), /*#__PURE__*/React.createElement(Box, {
5727
5609
  as: "span",
@@ -5775,6 +5657,12 @@ function useBoundaryElement() {
5775
5657
  return value || DEFAULT_VALUE;
5776
5658
  }
5777
5659
 
5660
+ /**
5661
+ * @internal
5662
+ */
5663
+
5664
+ const RO = typeof window !== 'undefined' && window.ResizeObserver ? window.ResizeObserver : ResizeObserver$1;
5665
+
5778
5666
  function findMaxBreakpoints(media, width) {
5779
5667
  const ret = [];
5780
5668
 
@@ -5817,14 +5705,20 @@ const ElementQuery = /*#__PURE__*/forwardRef(function ElementQuery(props, ref) {
5817
5705
  } = props,
5818
5706
  restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
5819
5707
 
5708
+ const [width, setWidth] = useState(() => window.innerWidth);
5820
5709
  const forwardedRef = useForwardedRef(ref);
5821
5710
  const [element, setElement] = useState(null);
5822
- const elementSize = useElementSize(element);
5823
- const width = useMemo(() => {
5824
- var _elementSize$border$w;
5711
+ useEffect(() => {
5712
+ if (!element) return;
5713
+
5714
+ const handleResizeEntries = entries => {
5715
+ setWidth(entries[0].contentRect.width);
5716
+ };
5825
5717
 
5826
- return (_elementSize$border$w = elementSize == null ? void 0 : elementSize.border.width) != null ? _elementSize$border$w : window.innerWidth;
5827
- }, [elementSize]);
5718
+ const ro = new RO(handleResizeEntries);
5719
+ ro.observe(element);
5720
+ return () => ro.disconnect();
5721
+ }, [element]);
5828
5722
  const max = useMemo(() => findMaxBreakpoints(media, width), [media, width]);
5829
5723
  const min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
5830
5724
  const setRef = useCallback(el => {
@@ -5917,7 +5811,7 @@ function LayerProvider(props) {
5917
5811
  zOffset: zOffsetProp = 0
5918
5812
  } = props;
5919
5813
  const parent = useContext(LayerContext);
5920
- const zOffset = useArrayProp(zOffsetProp);
5814
+ const zOffset = useResponsiveProp(zOffsetProp);
5921
5815
  const maxMediaIndex = zOffset.length - 1;
5922
5816
  const mediaIndex = Math.min(useMediaIndex(), maxMediaIndex);
5923
5817
  const zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
@@ -6362,7 +6256,7 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
6362
6256
  scrollEl.addEventListener('scroll', _handleScroll, {
6363
6257
  passive: true
6364
6258
  });
6365
- const ro = new _ResizeObserver(entries => {
6259
+ const ro = new ResizeObserver(entries => {
6366
6260
  setScrollHeight(entries[0].contentRect.height);
6367
6261
  });
6368
6262
  ro.observe(scrollEl);
@@ -6768,7 +6662,7 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6768
6662
  tether,
6769
6663
  tetherOffset,
6770
6664
  tone = 'inherit',
6771
- width: widthProp = 0,
6665
+ width = 0,
6772
6666
  zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
6773
6667
  } = props,
6774
6668
  restProps = _objectWithoutPropertiesLoose(props, _excluded$n);
@@ -6779,7 +6673,6 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6779
6673
  const [popperElement, setPopperElement] = useState(null);
6780
6674
  const [arrowElement, setArrowElement] = useState(null);
6781
6675
  const popperReferenceElement = referenceElementProp || referenceElement;
6782
- const width = useArrayProp(matchReferenceWidth ? 'auto' : widthProp);
6783
6676
  const modifiers = usePopoverModifiers({
6784
6677
  allowedAutoPlacements,
6785
6678
  arrow,
@@ -6820,21 +6713,13 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6820
6713
  forwardedRef.current = el;
6821
6714
  }, [forwardedRef]);
6822
6715
  const popoverStyle = useMemo(() => _extends({}, style, styles.popper), [style, styles]);
6823
- const updateTimeoutRef = useRef(null);
6824
6716
  useEffect(() => {
6825
- if (updateTimeoutRef.current) {
6826
- clearTimeout(updateTimeoutRef.current);
6827
- updateTimeoutRef.current = null;
6828
- }
6829
-
6830
- updateTimeoutRef.current = setTimeout(() => {
6831
- if (forceUpdate) {
6832
- try {
6833
- forceUpdate();
6834
- } catch (_) {// ignore caught error
6835
- }
6717
+ if (forceUpdate) {
6718
+ try {
6719
+ forceUpdate();
6720
+ } catch (_) {// ignore caught error
6836
6721
  }
6837
- }, 0);
6722
+ }
6838
6723
  }, [content, forceUpdate, open, popperReferenceElement]);
6839
6724
 
6840
6725
  if (disabled) {
@@ -6850,13 +6735,13 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6850
6735
  zOffset: zOffset
6851
6736
  }, attributes.popper), /*#__PURE__*/React.createElement(PopoverCard, {
6852
6737
  "$constrainSize": constrainSize,
6853
- "$width": width,
6854
6738
  "data-ui": "PopoverCard",
6855
6739
  padding: padding,
6856
6740
  radius: radius,
6857
6741
  scheme: scheme,
6858
6742
  shadow: shadow,
6859
- tone: tone
6743
+ tone: tone,
6744
+ width: width
6860
6745
  }, arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
6861
6746
  ref: setArrowElement,
6862
6747
  style: styles.arrow
@@ -7128,7 +7013,7 @@ function inputTextSizeStyle(props) {
7128
7013
  const {
7129
7014
  sizes
7130
7015
  } = theme.sanity.fonts.text;
7131
- return _responsive(theme.sanity.media, $fontSize, sizeIndex => textSize(sizes[sizeIndex] || sizes[2]));
7016
+ return responsive(theme.sanity.media, getResponsiveProp($fontSize), sizeIndex => textSize(sizes[sizeIndex] || sizes[2]));
7132
7017
  }
7133
7018
 
7134
7019
  function inputStyle() {
@@ -7203,10 +7088,10 @@ const Select = /*#__PURE__*/forwardRef(function Select(props, forwardedRef) {
7203
7088
  "data-read-only": !disabled && readOnly ? '' : undefined,
7204
7089
  "data-ui": "Select"
7205
7090
  }, restProps, {
7206
- "$fontSize": useArrayProp(fontSize),
7207
- "$padding": useArrayProp(padding),
7208
- "$radius": useArrayProp(radius),
7209
- "$space": useArrayProp(space),
7091
+ "$fontSize": fontSize,
7092
+ "$padding": padding,
7093
+ "$radius": radius,
7094
+ "$space": space,
7210
7095
  disabled: disabled || readOnly,
7211
7096
  ref: ref
7212
7097
  }), children), /*#__PURE__*/React.createElement(IconBox, {
@@ -7237,7 +7122,7 @@ function responsiveStackSpaceStyle(props) {
7237
7122
  media,
7238
7123
  space
7239
7124
  } = theme.sanity;
7240
- return _responsive(media, props.$space, spaceIndex => ({
7125
+ return responsive(media, getResponsiveProp(props.$space), spaceIndex => ({
7241
7126
  gridGap: rem(space[spaceIndex])
7242
7127
  }));
7243
7128
  }
@@ -7259,7 +7144,7 @@ const Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
7259
7144
  "data-as": typeof as === 'string' ? as : undefined,
7260
7145
  "data-ui": "Stack"
7261
7146
  }, restProps, {
7262
- "$space": useArrayProp(space),
7147
+ "$space": space,
7263
7148
  forwardedAs: as,
7264
7149
  ref: ref
7265
7150
  }));
@@ -7271,7 +7156,7 @@ let _$f = t => t,
7271
7156
  _t3$6,
7272
7157
  _t4$4,
7273
7158
  _t5$3,
7274
- _t6$2,
7159
+ _t6$1,
7275
7160
  _t7;
7276
7161
  /* Root */
7277
7162
 
@@ -7436,7 +7321,7 @@ function switchThumbStyles(props) {
7436
7321
  ${0}
7437
7322
 
7438
7323
  ${0}
7439
- `), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$2 || (_t6$2 = _$f`
7324
+ `), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$1 || (_t6$1 = _$f`
7440
7325
  transform: translate3d(${0}px, 0, 0);
7441
7326
  `), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$f`
7442
7327
  transform: translate3d(${0}px, 0, 0);
@@ -7491,7 +7376,7 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
7491
7376
  })));
7492
7377
  });
7493
7378
 
7494
- const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"];
7379
+ const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"];
7495
7380
 
7496
7381
  let _$e = t => t,
7497
7382
  _t$f;
@@ -7515,54 +7400,39 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
7515
7400
  disabled = false,
7516
7401
  fontSize = 2,
7517
7402
  padding = 3,
7518
- radius = 1,
7519
- weight
7403
+ radius = 1
7520
7404
  } = props,
7521
7405
  restProps = _objectWithoutPropertiesLoose(props, _excluded$i);
7522
7406
 
7523
7407
  const ref = useForwardedRef(forwardedRef);
7524
- const rootTheme = useRootTheme();
7525
7408
  useCustomValidity(ref, customValidity);
7526
7409
  return /*#__PURE__*/React.createElement(Root$d, {
7527
7410
  "data-ui": "TextArea"
7528
7411
  }, /*#__PURE__*/React.createElement(InputRoot$1, null, /*#__PURE__*/React.createElement(Input$1, _extends({
7529
- "data-as": "textarea",
7530
- "data-scheme": rootTheme.scheme,
7531
- "data-tone": rootTheme.tone
7412
+ "data-as": "textarea"
7532
7413
  }, restProps, {
7533
- "$fontSize": useArrayProp(fontSize),
7534
- "$padding": useArrayProp(padding),
7535
- "$scheme": rootTheme.scheme,
7536
- "$space": useArrayProp(0),
7537
- "$tone": rootTheme.tone,
7538
- "$weight": weight,
7414
+ "$fontSize": fontSize,
7415
+ "$padding": padding,
7539
7416
  disabled: disabled,
7540
7417
  ref: ref
7541
7418
  })), /*#__PURE__*/React.createElement(Presentation$1, {
7542
7419
  "$border": border,
7543
- "$radius": useArrayProp(radius),
7544
- "$scheme": rootTheme.scheme,
7545
- "$tone": rootTheme.tone,
7546
- "data-scheme": rootTheme.scheme,
7547
- "data-tone": rootTheme.tone
7420
+ "$radius": radius
7548
7421
  })));
7549
7422
  });
7550
7423
 
7551
- const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"];
7424
+ const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"];
7552
7425
 
7553
7426
  let _$d = t => t,
7554
7427
  _t$e,
7555
7428
  _t2$a,
7556
7429
  _t3$5,
7557
7430
  _t4$3,
7558
- _t5$2,
7559
- _t6$1;
7431
+ _t5$2;
7560
7432
  const CLEAR_BUTTON_BOX_STYLE = {
7561
7433
  zIndex: 2
7562
7434
  };
7563
- const Root$c = styled(Card).attrs({
7564
- forwardedAs: 'span'
7565
- })(textInputRootStyle);
7435
+ const Root$c = styled.span(textInputRootStyle);
7566
7436
  const InputRoot = styled.span(_t$e || (_t$e = _$d`
7567
7437
  flex: 1;
7568
7438
  min-width: 0;
@@ -7598,12 +7468,7 @@ const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$d`
7598
7468
  top: 0;
7599
7469
  left: 0;
7600
7470
  `));
7601
- const RightBox = styled(Box)(_t5$2 || (_t5$2 = _$d`
7602
- position: absolute;
7603
- top: 0;
7604
- right: 0;
7605
- `));
7606
- const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$d`
7471
+ const RightCard = styled(Card)(_t5$2 || (_t5$2 = _$d`
7607
7472
  background-color: transparent;
7608
7473
  position: absolute;
7609
7474
  top: 0;
@@ -7618,7 +7483,7 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7618
7483
  border = true,
7619
7484
  clearButton,
7620
7485
  disabled = false,
7621
- fontSize: fontSizeProp = 2,
7486
+ fontSize = 2,
7622
7487
  icon,
7623
7488
  iconRight,
7624
7489
  onClear,
@@ -7626,20 +7491,16 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7626
7491
  prefix,
7627
7492
  radius: radiusProp = 1,
7628
7493
  readOnly,
7629
- space: spaceProp = 3,
7494
+ space = 3,
7630
7495
  suffix,
7631
7496
  customValidity,
7632
- type = 'text',
7633
- weight
7497
+ type = 'text'
7634
7498
  } = props,
7635
7499
  restProps = _objectWithoutPropertiesLoose(props, _excluded$h);
7636
7500
 
7637
7501
  const ref = useForwardedRef(forwardedRef);
7638
- const rootTheme = useRootTheme();
7639
- const fontSize = useArrayProp(fontSizeProp);
7640
- const padding = useArrayProp(paddingProp);
7641
- const radius = useArrayProp(radiusProp);
7642
- const space = useArrayProp(spaceProp); // Transient properties
7502
+ const padding = useResponsiveProp(paddingProp);
7503
+ const radius = useResponsiveProp(radiusProp); // Transient properties
7643
7504
 
7644
7505
  const $hasClearButton = Boolean(clearButton);
7645
7506
  const $hasIcon = Boolean(icon);
@@ -7675,20 +7536,16 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7675
7536
  "$border": border,
7676
7537
  "$hasPrefix": $hasPrefix,
7677
7538
  "$hasSuffix": $hasSuffix,
7678
- "$radius": radius,
7679
- "$scheme": rootTheme.scheme,
7680
- "$tone": rootTheme.tone,
7681
- "data-scheme": rootTheme.scheme,
7682
- "data-tone": rootTheme.tone
7539
+ "$radius": radius
7683
7540
  }, icon && /*#__PURE__*/React.createElement(LeftBox, {
7684
7541
  padding: padding
7685
7542
  }, /*#__PURE__*/React.createElement(Text, {
7686
7543
  size: fontSize
7687
- }, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(RightBox, {
7544
+ }, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(RightCard, {
7688
7545
  padding: padding
7689
7546
  }, /*#__PURE__*/React.createElement(Text, {
7690
7547
  size: fontSize
7691
- }, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
7548
+ }, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
7692
7549
 
7693
7550
  const clearButtonBoxPadding = useMemo(() => padding.map(v => {
7694
7551
  if (v === 0) return 0;
@@ -7729,21 +7586,15 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7729
7586
  tone: "inherit"
7730
7587
  }, /*#__PURE__*/React.createElement("span", null, suffix)), [radius, suffix]);
7731
7588
  return /*#__PURE__*/React.createElement(Root$c, {
7732
- "data-ui": "TextInput",
7733
- tone: rootTheme.tone
7589
+ "data-ui": "TextInput"
7734
7590
  }, prefixNode, /*#__PURE__*/React.createElement(InputRoot, null, /*#__PURE__*/React.createElement(Input, _extends({
7735
- "data-as": "input",
7736
- "data-scheme": rootTheme.scheme,
7737
- "data-tone": rootTheme.tone
7591
+ "data-as": "input"
7738
7592
  }, restProps, {
7739
- "$fontSize": fontSize,
7740
7593
  "$iconLeft": $hasIcon,
7741
7594
  "$iconRight": $hasIconRight || $hasClearButton,
7742
7595
  "$padding": padding,
7743
- "$scheme": rootTheme.scheme,
7744
7596
  "$space": space,
7745
- "$tone": rootTheme.tone,
7746
- "$weight": weight,
7597
+ "$fontSize": fontSize,
7747
7598
  disabled: disabled,
7748
7599
  readOnly: readOnly,
7749
7600
  ref: ref,
@@ -7845,7 +7696,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7845
7696
  children,
7846
7697
  content,
7847
7698
  disabled,
7848
- fallbackPlacements: fallbackPlacementsProp,
7699
+ fallbackPlacements,
7849
7700
  placement = 'bottom',
7850
7701
  portal,
7851
7702
  scheme,
@@ -7853,7 +7704,6 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7853
7704
  } = props,
7854
7705
  restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
7855
7706
 
7856
- const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
7857
7707
  const forwardedRef = useForwardedRef(ref);
7858
7708
  const [referenceElement, setReferenceElement] = useState(null);
7859
7709
  const [popperElement, setPopperElement] = useState(null);
@@ -7915,21 +7765,13 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7915
7765
  window.removeEventListener('mousemove', handleWindowMouseMove);
7916
7766
  };
7917
7767
  }, [isOpen, referenceElement]);
7918
- const updateTimeoutRef = useRef(null);
7919
7768
  useEffect(() => {
7920
- if (updateTimeoutRef.current) {
7921
- clearTimeout(updateTimeoutRef.current);
7922
- updateTimeoutRef.current = null;
7923
- }
7924
-
7925
- updateTimeoutRef.current = setTimeout(() => {
7926
- if (forceUpdate) {
7927
- try {
7928
- forceUpdate();
7929
- } catch (_) {// ignore caught error
7930
- }
7769
+ if (forceUpdate) {
7770
+ try {
7771
+ forceUpdate();
7772
+ } catch (_) {// ignore caught error
7931
7773
  }
7932
- }, 0);
7774
+ }
7933
7775
  }, [forceUpdate, content]); // Close when `disabled` changes to `true`
7934
7776
 
7935
7777
  useEffect(() => {
@@ -8227,7 +8069,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
8227
8069
  const popoverMouseWithinRef = useRef(false);
8228
8070
  const listBoxId = `${id}-listbox`;
8229
8071
  const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY;
8230
- const padding = useArrayProp(paddingProp);
8072
+ const padding = useResponsiveProp(paddingProp);
8231
8073
  const currentOption = useMemo(() => value !== null ? options.find(o => o.value === value) : undefined, [options, value]);
8232
8074
  const filteredOptions = useMemo(() => options.filter(option => query ? filterOption(query, option) : true), [filterOption, options, query]);
8233
8075
  const filteredOptionsLen = filteredOptions.length;
@@ -8645,11 +8487,10 @@ const Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(props, ref) {
8645
8487
  children,
8646
8488
  maxLength,
8647
8489
  separator,
8648
- space: spaceRaw = 2
8490
+ space = 2
8649
8491
  } = props,
8650
8492
  restProps = _objectWithoutPropertiesLoose(props, _excluded$e);
8651
8493
 
8652
- const space = useArrayProp(spaceRaw);
8653
8494
  const [open, setOpen] = useState(false);
8654
8495
  const [expandElement, setExpandElement] = useState(null);
8655
8496
  const [popoverElement, setPopoverElement] = useState(null);
@@ -8723,7 +8564,7 @@ function dialogStyle({
8723
8564
  alignItems: 'center',
8724
8565
  justifyContent: 'center',
8725
8566
  outline: 'none',
8726
- background: color.shadow.umbra
8567
+ background: color.shadow.penumbra
8727
8568
  };
8728
8569
  }
8729
8570
  function responsiveDialogPositionStyle(props) {
@@ -8733,7 +8574,7 @@ function responsiveDialogPositionStyle(props) {
8733
8574
  const {
8734
8575
  media
8735
8576
  } = theme.sanity;
8736
- return _responsive(media, props.$position, position => ({
8577
+ return responsive(media, getResponsiveProp(props.$position), position => ({
8737
8578
  '&&': {
8738
8579
  position
8739
8580
  }
@@ -8829,14 +8670,11 @@ const DialogCard = /*#__PURE__*/forwardRef(function DialogCard(props, ref) {
8829
8670
  id,
8830
8671
  onClickOutside,
8831
8672
  onClose,
8832
- radius: radiusProp,
8673
+ radius,
8833
8674
  scheme,
8834
- shadow: shadowProp,
8835
- width: widthProp
8675
+ shadow,
8676
+ width
8836
8677
  } = props;
8837
- const radius = useArrayProp(radiusProp);
8838
- const shadow = useArrayProp(shadowProp);
8839
- const width = useArrayProp(widthProp);
8840
8678
  const forwardedRef = useForwardedRef(ref);
8841
8679
  const [rootElement, setRootElement] = useState(null);
8842
8680
  const localContentRef = useRef(null);
@@ -8919,7 +8757,7 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
8919
8757
  const {
8920
8758
  __unstable_autoFocus: autoFocus = true,
8921
8759
  __unstable_hideCloseButton: hideCloseButton = false,
8922
- cardRadius: cardRadiusProp = 3,
8760
+ cardRadius = 3,
8923
8761
  cardShadow = 4,
8924
8762
  children,
8925
8763
  contentRef,
@@ -8928,20 +8766,15 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
8928
8766
  id,
8929
8767
  onClickOutside,
8930
8768
  onClose,
8931
- padding: paddingProp = 4,
8769
+ padding = 4,
8932
8770
  portal,
8933
- position: positionProp = dialog.position || 'fixed',
8771
+ position = dialog.position || 'fixed',
8934
8772
  scheme,
8935
- width: widthProp = 0,
8936
- zOffset: zOffsetProp = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
8773
+ width = 0,
8774
+ zOffset = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
8937
8775
  } = props,
8938
8776
  restProps = _objectWithoutPropertiesLoose(props, _excluded$d);
8939
8777
 
8940
- const cardRadius = useArrayProp(cardRadiusProp);
8941
- const padding = useArrayProp(paddingProp);
8942
- const position = useArrayProp(positionProp);
8943
- const width = useArrayProp(widthProp);
8944
- const zOffset = useArrayProp(zOffsetProp);
8945
8778
  const preDivRef = useRef(null);
8946
8779
  const postDivRef = useRef(null);
8947
8780
  const cardRef = useRef(null);
@@ -9047,12 +8880,10 @@ const Hotkeys = /*#__PURE__*/forwardRef(function Hotkeys(props, ref) {
9047
8880
  keys,
9048
8881
  padding,
9049
8882
  radius,
9050
- space: spaceProp = 1
8883
+ space = 1
9051
8884
  } = props,
9052
8885
  restProps = _objectWithoutPropertiesLoose(props, _excluded$c);
9053
8886
 
9054
- const space = useArrayProp(spaceProp);
9055
-
9056
8887
  if (!keys || keys.length === 0) {
9057
8888
  return /*#__PURE__*/React.createElement(React.Fragment, null);
9058
8889
  }
@@ -9712,7 +9543,7 @@ function selectableColorStyle(props) {
9712
9543
  * @internal
9713
9544
  */
9714
9545
 
9715
- const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
9546
+ const Selectable = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
9716
9547
 
9717
9548
  function useMenu() {
9718
9549
  const value = useContext(MenuContext);
@@ -9744,7 +9575,7 @@ function MenuGroup(props) {
9744
9575
  icon,
9745
9576
  onClick,
9746
9577
  padding = 3,
9747
- popover,
9578
+ popover = {},
9748
9579
  radius = 2,
9749
9580
  space = 3,
9750
9581
  text,
@@ -9842,7 +9673,7 @@ function MenuGroup(props) {
9842
9673
  "aria-pressed": as === 'button' ? withinMenu : undefined,
9843
9674
  "data-pressed": as !== 'button' ? withinMenu : undefined,
9844
9675
  "data-selected": !withinMenu && active ? '' : undefined,
9845
- "$radius": useArrayProp(radius),
9676
+ "$radius": radius,
9846
9677
  "$tone": tone,
9847
9678
  onClick: handleClick,
9848
9679
  onKeyDown: handleKeyDown,
@@ -9936,13 +9767,13 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef)
9936
9767
  "data-selected": active ? '' : undefined,
9937
9768
  "data-disabled": disabled ? '' : undefined,
9938
9769
  forwardedAs: as,
9939
- "$radius": useArrayProp(radius),
9940
- "$padding": useArrayProp(0),
9770
+ "$radius": radius,
9941
9771
  "$tone": tone,
9942
9772
  disabled: disabled,
9943
9773
  onClick: handleClick,
9944
9774
  onMouseEnter: onItemMouseEnter,
9945
9775
  onMouseLeave: onItemMouseLeave,
9776
+ padding: 0,
9946
9777
  ref: setRef,
9947
9778
  role: "menuitem",
9948
9779
  tabIndex: -1,
@@ -10060,7 +9891,7 @@ const Skeleton = /*#__PURE__*/forwardRef(function Skeleton(props, ref) {
10060
9891
  }, [delay]);
10061
9892
  return /*#__PURE__*/React.createElement(Root$4, _extends({}, restProps, {
10062
9893
  "$animated": animated,
10063
- "$radius": useArrayProp(radius),
9894
+ "$radius": radius,
10064
9895
  "$visible": visible,
10065
9896
  ref: ref
10066
9897
  }));
@@ -10079,15 +9910,13 @@ const Root$3 = styled(Skeleton)(({
10079
9910
  media
10080
9911
  } = theme.sanity;
10081
9912
  const font = theme.sanity.fonts[$style];
10082
-
10083
- const styles = _responsive(media, $size, sizeIndex => {
9913
+ const styles = responsive(media, $size, sizeIndex => {
10084
9914
  const fontSize = font.sizes[sizeIndex];
10085
9915
  const capHeight = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight;
10086
9916
  return {
10087
9917
  height: capHeight
10088
9918
  };
10089
9919
  });
10090
-
10091
9920
  return styles;
10092
9921
  });
10093
9922
  /**
@@ -10101,7 +9930,7 @@ const TextSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
10101
9930
  } = props,
10102
9931
  restProps = _objectWithoutPropertiesLoose(props, _excluded$7);
10103
9932
 
10104
- const $size = useArrayProp(size);
9933
+ const $size = useResponsiveProp(size);
10105
9934
  return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
10106
9935
  "$size": $size,
10107
9936
  ref: ref,
@@ -10119,7 +9948,7 @@ const LabelSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref)
10119
9948
  } = props,
10120
9949
  restProps = _objectWithoutPropertiesLoose(props, _excluded2);
10121
9950
 
10122
- const $size = useArrayProp(size);
9951
+ const $size = useResponsiveProp(size);
10123
9952
  return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
10124
9953
  "$size": $size,
10125
9954
  ref: ref,
@@ -10137,7 +9966,7 @@ const HeadingSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref
10137
9966
  } = props,
10138
9967
  restProps = _objectWithoutPropertiesLoose(props, _excluded3);
10139
9968
 
10140
- const $size = useArrayProp(size);
9969
+ const $size = useResponsiveProp(size);
10141
9970
  return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
10142
9971
  "$size": $size,
10143
9972
  ref: ref,
@@ -10155,7 +9984,7 @@ const CodeSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
10155
9984
  } = props,
10156
9985
  restProps = _objectWithoutPropertiesLoose(props, _excluded4);
10157
9986
 
10158
- const $size = useArrayProp(size);
9987
+ const $size = useResponsiveProp(size);
10159
9988
  return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
10160
9989
  "$size": $size,
10161
9990
  ref: ref,
@@ -11107,5 +10936,5 @@ const TreeItem = /*#__PURE__*/memo(function TreeItem(props) {
11107
10936
  }, children)));
11108
10937
  });
11109
10938
 
11110
- export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, useRootTheme, useTheme, useToast, useTree };
10939
+ export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, RO as ResizeObserver, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, Tree, TreeItem, VirtualList, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, attemptFocus, createColorTheme, fillCSSObject, focusFirstDescendant, focusLastDescendant, getResponsiveProp, getResponsiveSpace, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsive, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, useResponsiveProp, useRootTheme, useTheme, useToast, useTree };
11111
10940
  //# sourceMappingURL=sanity-ui.modern.js.map