@sanity/ui 0.37.10 → 0.37.13

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 (242) hide show
  1. package/lib/dts/src/components/autocomplete/autocomplete.d.ts +2 -2
  2. package/lib/dts/src/components/autocomplete/autocomplete.d.ts.map +1 -1
  3. package/lib/dts/src/components/autocomplete/autocomplete.styles.d.ts.map +1 -1
  4. package/lib/dts/src/components/autocomplete/constants.d.ts +0 -4
  5. package/lib/dts/src/components/autocomplete/constants.d.ts.map +1 -1
  6. package/lib/dts/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
  7. package/lib/dts/src/components/dialog/dialog.d.ts.map +1 -1
  8. package/lib/dts/src/components/dialog/styles.d.ts +1 -1
  9. package/lib/dts/src/components/dialog/styles.d.ts.map +1 -1
  10. package/lib/dts/src/components/hotkeys/hotkeys.d.ts.map +1 -1
  11. package/lib/dts/src/components/menu/menuButton.d.ts.map +1 -1
  12. package/lib/dts/src/components/menu/menuGroup.d.ts.map +1 -1
  13. package/lib/dts/src/components/menu/menuItem.d.ts.map +1 -1
  14. package/lib/dts/src/components/skeleton/skeleton.d.ts.map +1 -1
  15. package/lib/dts/src/hooks/_internal/useUnique.d.ts +2 -3
  16. package/lib/dts/src/hooks/_internal/useUnique.d.ts.map +1 -1
  17. package/lib/dts/src/hooks/index.d.ts +2 -1
  18. package/lib/dts/src/hooks/index.d.ts.map +1 -1
  19. package/lib/dts/src/hooks/useArrayProp.d.ts +7 -0
  20. package/lib/dts/src/hooks/useArrayProp.d.ts.map +1 -0
  21. package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts +1 -1
  22. package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts.map +1 -1
  23. package/lib/dts/src/hooks/useElementSize.d.ts +7 -0
  24. package/lib/dts/src/hooks/useElementSize.d.ts.map +1 -0
  25. package/lib/dts/src/index.d.ts +1 -0
  26. package/lib/dts/src/index.d.ts.map +1 -1
  27. package/lib/dts/src/observers/elementSizeObserver.d.ts +37 -0
  28. package/lib/dts/src/observers/elementSizeObserver.d.ts.map +1 -0
  29. package/lib/dts/src/observers/index.d.ts +3 -0
  30. package/lib/dts/src/observers/index.d.ts.map +1 -0
  31. package/lib/dts/src/observers/resizeObserver.d.ts +5 -0
  32. package/lib/dts/src/observers/resizeObserver.d.ts.map +1 -0
  33. package/lib/dts/src/primitives/_selectable/selectable.d.ts +1 -2
  34. package/lib/dts/src/primitives/_selectable/selectable.d.ts.map +1 -1
  35. package/lib/dts/src/primitives/avatar/avatar.d.ts.map +1 -1
  36. package/lib/dts/src/primitives/avatar/avatarCounter.d.ts +1 -0
  37. package/lib/dts/src/primitives/avatar/avatarCounter.d.ts.map +1 -1
  38. package/lib/dts/src/primitives/avatar/avatarStack.d.ts +1 -0
  39. package/lib/dts/src/primitives/avatar/avatarStack.d.ts.map +1 -1
  40. package/lib/dts/src/primitives/avatar/styles.d.ts.map +1 -1
  41. package/lib/dts/src/primitives/badge/badge.d.ts.map +1 -1
  42. package/lib/dts/src/primitives/box/box.d.ts.map +1 -1
  43. package/lib/dts/src/primitives/button/button.d.ts.map +1 -1
  44. package/lib/dts/src/primitives/card/card.d.ts.map +1 -1
  45. package/lib/dts/src/primitives/code/code.d.ts.map +1 -1
  46. package/lib/dts/src/primitives/container/container.d.ts.map +1 -1
  47. package/lib/dts/src/primitives/container/styles.d.ts.map +1 -1
  48. package/lib/dts/src/primitives/container/types.d.ts +1 -1
  49. package/lib/dts/src/primitives/container/types.d.ts.map +1 -1
  50. package/lib/dts/src/primitives/flex/flex.d.ts.map +1 -1
  51. package/lib/dts/src/primitives/grid/grid.d.ts.map +1 -1
  52. package/lib/dts/src/primitives/heading/heading.d.ts.map +1 -1
  53. package/lib/dts/src/primitives/inline/inline.d.ts.map +1 -1
  54. package/lib/dts/src/primitives/inline/styles.d.ts.map +1 -1
  55. package/lib/dts/src/primitives/inline/types.d.ts +1 -1
  56. package/lib/dts/src/primitives/inline/types.d.ts.map +1 -1
  57. package/lib/dts/src/primitives/kbd/kbd.d.ts.map +1 -1
  58. package/lib/dts/src/primitives/label/label.d.ts.map +1 -1
  59. package/lib/dts/src/primitives/popover/popover.d.ts.map +1 -1
  60. package/lib/dts/src/primitives/select/styles.d.ts +5 -1
  61. package/lib/dts/src/primitives/select/styles.d.ts.map +1 -1
  62. package/lib/dts/src/primitives/stack/stack.d.ts.map +1 -1
  63. package/lib/dts/src/primitives/stack/styles.d.ts +1 -1
  64. package/lib/dts/src/primitives/stack/styles.d.ts.map +1 -1
  65. package/lib/dts/src/primitives/text/text.d.ts.map +1 -1
  66. package/lib/dts/src/primitives/textArea/textArea.d.ts.map +1 -1
  67. package/lib/dts/src/primitives/textInput/textInput.d.ts.map +1 -1
  68. package/lib/dts/src/primitives/tooltip/tooltip.d.ts.map +1 -1
  69. package/lib/dts/src/primitives/types.d.ts +1 -1
  70. package/lib/dts/src/primitives/types.d.ts.map +1 -1
  71. package/lib/dts/src/styles/border/types.d.ts +5 -5
  72. package/lib/dts/src/styles/border/types.d.ts.map +1 -1
  73. package/lib/dts/src/styles/box/types.d.ts +4 -4
  74. package/lib/dts/src/styles/box/types.d.ts.map +1 -1
  75. package/lib/dts/src/styles/flex/flexItemStyle.d.ts.map +1 -1
  76. package/lib/dts/src/styles/flex/types.d.ts +6 -6
  77. package/lib/dts/src/styles/flex/types.d.ts.map +1 -1
  78. package/lib/dts/src/styles/font/responsiveFont.d.ts +1 -1
  79. package/lib/dts/src/styles/font/responsiveFont.d.ts.map +1 -1
  80. package/lib/dts/src/styles/font/types.d.ts +3 -3
  81. package/lib/dts/src/styles/font/types.d.ts.map +1 -1
  82. package/lib/dts/src/styles/grid/types.d.ts +14 -14
  83. package/lib/dts/src/styles/grid/types.d.ts.map +1 -1
  84. package/lib/dts/src/styles/helpers.d.ts +4 -4
  85. package/lib/dts/src/styles/helpers.d.ts.map +1 -1
  86. package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts +12 -12
  87. package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts.map +1 -1
  88. package/lib/dts/src/styles/input/textInputStyle.d.ts +4 -1
  89. package/lib/dts/src/styles/input/textInputStyle.d.ts.map +1 -1
  90. package/lib/dts/src/styles/margin/types.d.ts +7 -7
  91. package/lib/dts/src/styles/margin/types.d.ts.map +1 -1
  92. package/lib/dts/src/styles/padding/types.d.ts +7 -7
  93. package/lib/dts/src/styles/padding/types.d.ts.map +1 -1
  94. package/lib/dts/src/styles/radius/types.d.ts +1 -1
  95. package/lib/dts/src/styles/radius/types.d.ts.map +1 -1
  96. package/lib/dts/src/styles/shadow/shadowStyle.d.ts.map +1 -1
  97. package/lib/dts/src/styles/shadow/types.d.ts +1 -1
  98. package/lib/dts/src/styles/shadow/types.d.ts.map +1 -1
  99. package/lib/dts/src/theme/lib/theme/fonts.d.ts +1 -3
  100. package/lib/dts/src/theme/lib/theme/fonts.d.ts.map +1 -1
  101. package/lib/dts/src/theme/studioTheme/fonts.d.ts.map +1 -1
  102. package/lib/dts/src/types/index.d.ts +2 -1
  103. package/lib/dts/src/types/index.d.ts.map +1 -1
  104. package/lib/dts/src/types/placement.d.ts +7 -0
  105. package/lib/dts/src/types/placement.d.ts.map +1 -0
  106. package/lib/dts/src/types/text.d.ts +5 -0
  107. package/lib/dts/src/types/text.d.ts.map +1 -0
  108. package/lib/dts/src/utils/elementQuery/elementQuery.d.ts.map +1 -1
  109. package/lib/dts/src/utils/index.d.ts +0 -1
  110. package/lib/dts/src/utils/index.d.ts.map +1 -1
  111. package/lib/dts/src/utils/virtualList/virtualList.d.ts.map +1 -1
  112. package/lib/sanity-ui.js +738 -627
  113. package/lib/sanity-ui.js.map +1 -1
  114. package/lib/{sanity-ui.modern.js → sanity-ui.modern.mjs} +736 -616
  115. package/lib/sanity-ui.modern.mjs.map +1 -0
  116. package/lib/sanity-ui.module.js +732 -623
  117. package/lib/sanity-ui.module.js.map +1 -1
  118. package/package.json +11 -11
  119. package/src/__workshop__/color/overview.tsx +9 -11
  120. package/src/components/autocomplete/__workshop__/async.tsx +14 -12
  121. package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +36 -0
  122. package/src/components/autocomplete/autocomplete.styles.tsx +0 -1
  123. package/src/components/autocomplete/autocomplete.tsx +14 -7
  124. package/src/components/autocomplete/constants.ts +0 -5
  125. package/src/components/breadcrumbs/breadcrumbs.tsx +3 -2
  126. package/src/components/dialog/dialog.tsx +17 -9
  127. package/src/components/dialog/styles.ts +3 -3
  128. package/src/components/hotkeys/hotkeys.tsx +3 -1
  129. package/src/components/menu/__workshop__/constrainedInBoundary.tsx +11 -14
  130. package/src/components/menu/__workshop__/groups.tsx +1 -1
  131. package/src/components/menu/menuButton.tsx +21 -13
  132. package/src/components/menu/menuGroup.tsx +3 -2
  133. package/src/components/menu/menuItem.tsx +4 -5
  134. package/src/components/skeleton/skeleton.tsx +10 -1
  135. package/src/components/skeleton/textSkeleton.tsx +7 -7
  136. package/src/hooks/_internal/useUnique.ts +4 -5
  137. package/src/hooks/index.ts +2 -1
  138. package/src/hooks/useArrayProp.ts +23 -0
  139. package/src/hooks/useElementRect/useElementRect.ts +4 -16
  140. package/src/hooks/useElementSize.ts +18 -0
  141. package/src/index.ts +1 -0
  142. package/src/observers/elementSizeObserver.ts +116 -0
  143. package/src/observers/index.ts +2 -0
  144. package/src/{utils → observers}/resizeObserver.ts +1 -4
  145. package/src/primitives/_selectable/selectable.tsx +5 -4
  146. package/src/primitives/avatar/avatar.tsx +7 -5
  147. package/src/primitives/avatar/avatarCounter.tsx +14 -12
  148. package/src/primitives/avatar/avatarStack.tsx +19 -13
  149. package/src/primitives/avatar/styles.ts +2 -2
  150. package/src/primitives/badge/badge.tsx +3 -2
  151. package/src/primitives/box/box.tsx +27 -26
  152. package/src/primitives/button/button.tsx +22 -10
  153. package/src/primitives/card/card.tsx +13 -11
  154. package/src/primitives/checkbox/__workshop__/example.tsx +4 -2
  155. package/src/primitives/checkbox/__workshop__/props.tsx +4 -2
  156. package/src/primitives/checkbox/__workshop__/readOnly.tsx +4 -2
  157. package/src/primitives/code/__workshop__/props.tsx +1 -1
  158. package/src/primitives/code/code.tsx +2 -1
  159. package/src/primitives/container/container.tsx +10 -1
  160. package/src/primitives/container/styles.ts +2 -2
  161. package/src/primitives/container/types.ts +1 -1
  162. package/src/primitives/flex/flex.tsx +6 -5
  163. package/src/primitives/grid/__workshop__/responsive.tsx +13 -12
  164. package/src/primitives/grid/grid.tsx +9 -8
  165. package/src/primitives/heading/__workshop__/opticalAlignment.tsx +19 -7
  166. package/src/primitives/heading/heading.tsx +3 -2
  167. package/src/primitives/inline/inline.tsx +12 -6
  168. package/src/primitives/inline/styles.ts +2 -2
  169. package/src/primitives/inline/types.ts +1 -1
  170. package/src/primitives/kbd/kbd.tsx +2 -1
  171. package/src/primitives/label/label.tsx +4 -3
  172. package/src/primitives/popover/__workshop__/{margins.tsx → MarginsStory.tsx} +1 -1
  173. package/src/primitives/popover/__workshop__/{matchReferenceWidth.tsx → MatchReferenceWidthStory.tsx} +0 -0
  174. package/src/primitives/popover/__workshop__/{plain.tsx → PlainStory.tsx} +12 -14
  175. package/src/primitives/popover/__workshop__/{recursive.tsx → RecursiveStory.tsx} +4 -1
  176. package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +60 -0
  177. package/src/primitives/popover/__workshop__/TestStory.tsx +79 -0
  178. package/src/primitives/popover/__workshop__/index.ts +10 -5
  179. package/src/primitives/popover/popover.tsx +5 -3
  180. package/src/primitives/select/select.tsx +9 -9
  181. package/src/primitives/select/styles.ts +10 -4
  182. package/src/primitives/stack/stack.tsx +2 -1
  183. package/src/primitives/stack/styles.ts +3 -3
  184. package/src/primitives/text/__workshop__/opticalAlignment.tsx +15 -5
  185. package/src/primitives/text/text.tsx +3 -2
  186. package/src/primitives/textArea/__workshop__/plain.tsx +23 -18
  187. package/src/primitives/textArea/textArea.tsx +17 -5
  188. package/src/primitives/textInput/__workshop__/clearButton.tsx +14 -8
  189. package/src/primitives/textInput/__workshop__/index.ts +2 -2
  190. package/src/primitives/textInput/__workshop__/plain.tsx +39 -32
  191. package/src/primitives/textInput/__workshop__/tones.tsx +97 -75
  192. package/src/primitives/textInput/__workshop__/typed.tsx +8 -2
  193. package/src/primitives/textInput/textInput.tsx +43 -12
  194. package/src/primitives/tooltip/__workshop__/props.tsx +5 -1
  195. package/src/primitives/tooltip/tooltip.tsx +3 -2
  196. package/src/primitives/types.ts +1 -1
  197. package/src/styles/border/borderStyle.ts +6 -6
  198. package/src/styles/border/types.ts +5 -5
  199. package/src/styles/box/boxStyle.ts +5 -5
  200. package/src/styles/box/types.ts +4 -4
  201. package/src/styles/flex/flexItemStyle.ts +5 -4
  202. package/src/styles/flex/flexStyle.ts +6 -6
  203. package/src/styles/flex/types.ts +6 -6
  204. package/src/styles/font/responsiveFont.ts +7 -27
  205. package/src/styles/font/textAlignStyle.ts +2 -2
  206. package/src/styles/font/types.ts +4 -3
  207. package/src/styles/grid/gridItemStyle.ts +7 -7
  208. package/src/styles/grid/gridStyle.ts +9 -9
  209. package/src/styles/grid/types.ts +14 -14
  210. package/src/styles/helpers.ts +9 -9
  211. package/src/styles/input/responsiveInputPaddingStyle.ts +24 -27
  212. package/src/styles/input/textInputStyle.ts +89 -79
  213. package/src/styles/margin/marginStyle.ts +8 -8
  214. package/src/styles/margin/marginsStyle.test.ts +1 -1
  215. package/src/styles/margin/types.ts +7 -7
  216. package/src/styles/padding/paddingStyle.test.ts +1 -1
  217. package/src/styles/padding/paddingStyle.ts +8 -8
  218. package/src/styles/padding/types.ts +7 -7
  219. package/src/styles/radius/radiusStyle.ts +2 -2
  220. package/src/styles/radius/types.ts +1 -1
  221. package/src/styles/shadow/shadowStyle.ts +2 -5
  222. package/src/styles/shadow/types.ts +1 -1
  223. package/src/theme/lib/theme/fonts.ts +1 -3
  224. package/src/theme/studioTheme/fonts.ts +5 -9
  225. package/src/types/index.ts +2 -2
  226. package/src/types/placement.ts +18 -0
  227. package/src/types/text.ts +4 -0
  228. package/src/utils/elementQuery/elementQuery.tsx +5 -18
  229. package/src/utils/index.ts +0 -1
  230. package/src/utils/layer/layer.tsx +1 -1
  231. package/src/utils/layer/layerProvider.tsx +2 -2
  232. package/src/utils/virtualList/virtualList.tsx +8 -7
  233. package/lib/dts/src/hooks/useResponsiveProp.d.ts +0 -6
  234. package/lib/dts/src/hooks/useResponsiveProp.d.ts.map +0 -1
  235. package/lib/dts/src/types/common.d.ts +0 -11
  236. package/lib/dts/src/types/common.d.ts.map +0 -1
  237. package/lib/dts/src/utils/resizeObserver.d.ts +0 -6
  238. package/lib/dts/src/utils/resizeObserver.d.ts.map +0 -1
  239. package/lib/sanity-ui.modern.js.map +0 -1
  240. package/src/hooks/useResponsiveProp.ts +0 -10
  241. package/src/primitives/popover/__workshop__/rightAligned.tsx +0 -57
  242. package/src/types/common.ts +0 -12
@@ -1,12 +1,12 @@
1
1
  import { useId } from '@reach/auto-id';
2
- import React, { useState, useRef, useEffect, createContext, useContext, useMemo, useLayoutEffect, forwardRef, useCallback, cloneElement, isValidElement, createElement, useReducer, Children, Fragment, memo } from 'react';
2
+ import React, { useMemo, useState, useRef, useEffect, createContext, useContext, 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';
5
6
  import { white as white$1, black as black$1, hues } from '@sanity/color';
6
7
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
7
8
  import Refractor from 'react-refractor';
8
9
  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';
@@ -45,7 +45,214 @@ function _objectWithoutPropertiesLoose(source, excluded) {
45
45
  }
46
46
 
47
47
  const EMPTY_ARRAY = [];
48
- const EMPTY_RECORD$1 = {};
48
+ const EMPTY_RECORD = {};
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
+ }
49
256
 
50
257
  function _getElements(element, elementsArg) {
51
258
  const ret = [element];
@@ -128,21 +335,107 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
128
335
  }
129
336
 
130
337
  /**
131
- * Subscribe to the rect of a DOM element.
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.
132
419
  * @beta
133
420
  */
134
421
 
135
- function useElementRect(element) {
136
- const [rect, setRect] = useState(null);
422
+ function useElementSize(element) {
423
+ const [size, setSize] = useState(null);
137
424
  useEffect(() => {
138
425
  if (!element) return undefined;
139
- const ro = new ResizeObserver(entries => {
140
- setRect(entries[0].contentRect);
141
- });
142
- ro.observe(element);
143
- return () => ro.disconnect();
426
+ return _elementSizeObserver.subscribe(element, setSize);
144
427
  }, [element]);
145
- return rect;
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;
146
439
  }
147
440
 
148
441
  /**
@@ -2233,8 +2526,7 @@ const color = createColorTheme({
2233
2526
 
2234
2527
  const fonts = {
2235
2528
  code: {
2236
- family: '-apple-system-ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace',
2237
- horizontalOffset: 0.075,
2529
+ family: 'ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace',
2238
2530
  weights: {
2239
2531
  regular: 400,
2240
2532
  medium: 500,
@@ -2280,7 +2572,6 @@ const fonts = {
2280
2572
  },
2281
2573
  heading: {
2282
2574
  family: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
2283
- horizontalOffset: 0.075,
2284
2575
  weights: {
2285
2576
  regular: 700,
2286
2577
  medium: 800,
@@ -2316,15 +2607,15 @@ const fonts = {
2316
2607
  lineHeight: 33,
2317
2608
  letterSpacing: 0
2318
2609
  }, {
2319
- ascenderHeight: 9,
2320
- descenderHeight: 7,
2610
+ ascenderHeight: 8,
2611
+ descenderHeight: 8,
2321
2612
  fontSize: 33,
2322
2613
  iconSize: 49,
2323
2614
  lineHeight: 39,
2324
2615
  letterSpacing: 0
2325
2616
  }, {
2326
- ascenderHeight: 10,
2327
- descenderHeight: 8,
2617
+ ascenderHeight: 9,
2618
+ descenderHeight: 9,
2328
2619
  fontSize: 38,
2329
2620
  iconSize: 53,
2330
2621
  lineHeight: 45,
@@ -2333,7 +2624,6 @@ const fonts = {
2333
2624
  },
2334
2625
  label: {
2335
2626
  family: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
2336
- horizontalOffset: 0.075,
2337
2627
  weights: {
2338
2628
  regular: 600,
2339
2629
  medium: 700,
@@ -2379,7 +2669,6 @@ const fonts = {
2379
2669
  },
2380
2670
  text: {
2381
2671
  family: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
2382
- horizontalOffset: 0.075,
2383
2672
  weights: {
2384
2673
  regular: 400,
2385
2674
  medium: 500,
@@ -2724,306 +3013,97 @@ function _createMediaManager(media) {
2724
3013
 
2725
3014
  return {
2726
3015
  getCurrentIndex,
2727
- subscribe
2728
- };
2729
- }
2730
- /**
2731
- * @internal
2732
- */
2733
-
2734
-
2735
- function _getMediaManager(media) {
2736
- let manager = MEDIA_MANAGER_CACHE.get(media);
2737
-
2738
- if (!manager) {
2739
- manager = _createMediaManager(media);
2740
- MEDIA_MANAGER_CACHE.set(media, manager);
2741
- }
2742
-
2743
- return manager;
2744
- }
2745
-
2746
- /**
2747
- * This API might change. DO NOT USE IN PRODUCTION.
2748
- * @beta
2749
- */
2750
-
2751
- function useMediaIndex() {
2752
- const theme = useTheme();
2753
- const {
2754
- media
2755
- } = theme.sanity;
2756
- const manager = useMemo(() => _getMediaManager(media), [media]);
2757
- const [index, setIndex] = useState(manager.getCurrentIndex);
2758
- useEffect(() => manager.subscribe(setIndex), [manager]);
2759
- return index;
2760
- }
2761
-
2762
- /**
2763
- * @public
2764
- */
2765
-
2766
- function usePrefersDark() {
2767
- const mq = useMemo(() => {
2768
- if (typeof window === 'undefined') return undefined;
2769
- return window.matchMedia('(prefers-color-scheme: dark)');
2770
- }, []);
2771
- const [dark, setDark] = useState((mq == null ? void 0 : mq.matches) || false);
2772
- useEffect(() => {
2773
- if (!mq) return undefined;
2774
- setDark(mq.matches);
2775
-
2776
- const handleChange = () => setDark(mq.matches);
2777
-
2778
- mq.addEventListener('change', handleChange);
2779
- return () => mq.removeEventListener('change', handleChange);
2780
- }, [mq]);
2781
- return dark;
2782
- }
2783
-
2784
- /**
2785
- * @beta
2786
- */
2787
-
2788
- const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
2789
-
2790
- /**
2791
- * @beta
2792
- */
2793
-
2794
- function useForwardedRef(ref) {
2795
- const innerRef = useRef(null);
2796
- useIsomorphicEffect(() => {
2797
- if (!ref) return;
2798
-
2799
- if (typeof ref === 'function') {
2800
- ref(innerRef.current);
2801
- } else {
2802
- ref.current = innerRef.current;
2803
- }
2804
- });
2805
- return innerRef;
2806
- }
2807
-
2808
- /**
2809
- * @beta
2810
- */
2811
-
2812
- function useCustomValidity(ref, customValidity) {
2813
- useEffect(() => {
2814
- if (ref.current) {
2815
- ref.current.setCustomValidity(customValidity || '');
2816
- }
2817
- }, [customValidity, ref]);
2818
- }
2819
-
2820
- /**
2821
- * @internal
2822
- */
2823
-
2824
- function fillCSSObject(propKeys, value) {
2825
- return propKeys.reduce((obj, propKey) => {
2826
- obj[propKey] = value;
2827
- return obj;
2828
- }, {});
2829
- }
2830
- /**
2831
- * @public
2832
- */
2833
-
2834
- function rem(pixelValue) {
2835
- if (pixelValue === 0) return 0;
2836
- return `${pixelValue / 16}rem`;
2837
- }
2838
- /**
2839
- * @internal
2840
- */
2841
-
2842
- function responsive(media, values, callback) {
2843
- const statements = values.map(callback);
2844
- return statements.map((statement, mediaIndex) => {
2845
- if (mediaIndex === 0) return statement;
2846
- return {
2847
- [`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
2848
- };
2849
- });
2850
- }
2851
- /**
2852
- * @internal
2853
- */
2854
-
2855
- function getResponsiveProp(val, defaultVal) {
2856
- if (val === undefined) return defaultVal || EMPTY_ARRAY;
2857
- return Array.isArray(val) ? val : [val];
2858
- }
2859
- /**
2860
- * @internal
2861
- */
2862
-
2863
- function getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
2864
- if (!Array.isArray(spaceIndexes)) {
2865
- throw new Error('the property must be array of numbers');
2866
- }
2867
-
2868
- if (spaceIndexes.length === 0) {
2869
- return null;
2870
- }
2871
-
2872
- return responsive(theme.sanity.media, spaceIndexes, spaceIndex => fillCSSObject(props, rem(theme.sanity.space[spaceIndex])));
2873
- }
2874
-
2875
- /**
2876
- * A utility function getting responsive font styles.
2877
- * @internal
2878
- */
2879
-
2880
- function responsiveFont(fontKey, props) {
2881
- const {
2882
- $size,
2883
- $weight,
2884
- theme
2885
- } = props;
2886
- const {
2887
- fonts,
2888
- media
2889
- } = theme.sanity;
2890
- const {
2891
- family,
2892
- sizes,
2893
- weights,
2894
- horizontalOffset
2895
- } = fonts[fontKey];
2896
- const fontWeight = $weight && weights[$weight] || weights.regular; // @todo: make this configurable
2897
-
2898
- const defaultSize = sizes[2];
2899
- const base = {
2900
- position: 'relative',
2901
- fontFamily: family,
2902
- fontWeight,
2903
- padding: '1px',
2904
- margin: 0,
2905
- '&:before': {
2906
- content: '""',
2907
- display: 'block',
2908
- height: 0
2909
- },
2910
- '&:after': {
2911
- content: '""',
2912
- display: 'block',
2913
- height: 0
2914
- },
2915
- '& > code, & > span': {
2916
- display: 'block'
2917
- },
2918
- '&:not([hidden])': {
2919
- display: 'block'
2920
- }
2921
- };
2922
- const resp = responsive(media, getResponsiveProp($size), sizeIndex => fontSize(sizes[sizeIndex] || defaultSize, horizontalOffset));
2923
- return [base, ...resp];
2924
- }
2925
- function fontSize(size, horizontalOffset) {
2926
- const {
2927
- ascenderHeight,
2928
- descenderHeight,
2929
- fontSize,
2930
- iconSize,
2931
- letterSpacing,
2932
- lineHeight
2933
- } = size;
2934
- const negHeight = ascenderHeight + descenderHeight;
2935
- const capHeight = lineHeight - negHeight;
2936
- const iconOffset = (capHeight - iconSize) / 2;
2937
- const customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1;
2938
- const customIconOffset = (capHeight - customIconSize) / 2;
2939
- return {
2940
- fontSize: rem(fontSize),
2941
- lineHeight: `calc(${lineHeight} / ${fontSize})`,
2942
- letterSpacing: rem(letterSpacing),
2943
- transform: `translateY(${rem(descenderHeight)})`,
2944
- '&:before': {
2945
- marginTop: `calc(${rem(0 - negHeight)} - 1px)`
2946
- },
2947
- '&:after': {
2948
- marginBottom: '-1px'
2949
- },
2950
- '& > code, & > span': {
2951
- margin: horizontalOffset ? `0 calc(${rem(0 - horizontalOffset * fontSize)} - 1px)` : '0 -1px'
2952
- },
2953
- '& svg:not([data-sanity-icon])': {
2954
- fontSize: `calc(${customIconSize} / 16 * 1rem)`,
2955
- margin: [// top & bottom
2956
- rem(customIconOffset), // left & right
2957
- horizontalOffset ? `calc(${rem(customIconOffset)} + ${rem(horizontalOffset * fontSize)})` : rem(customIconOffset)].join(' ')
2958
- },
2959
- '& [data-sanity-icon]': {
2960
- fontSize: `calc(${iconSize} / 16 * 1rem)`,
2961
- margin: [// top & bottom
2962
- rem(iconOffset), // left & right
2963
- horizontalOffset ? `calc(${rem(iconOffset)} + ${rem(horizontalOffset * fontSize)})` : rem(iconOffset)].join(' ')
2964
- }
3016
+ subscribe
2965
3017
  };
2966
3018
  }
2967
-
2968
3019
  /**
2969
- * Get responsive CSS for the `code` font style.
2970
3020
  * @internal
2971
3021
  */
2972
3022
 
2973
- function responsiveCodeFontStyle(props) {
2974
- return responsiveFont('code', props);
3023
+
3024
+ function _getMediaManager(media) {
3025
+ let manager = MEDIA_MANAGER_CACHE.get(media);
3026
+
3027
+ if (!manager) {
3028
+ manager = _createMediaManager(media);
3029
+ MEDIA_MANAGER_CACHE.set(media, manager);
3030
+ }
3031
+
3032
+ return manager;
2975
3033
  }
2976
3034
 
2977
3035
  /**
2978
- * Get responsive CSS for the `heading` font style.
2979
- * @internal
3036
+ * This API might change. DO NOT USE IN PRODUCTION.
3037
+ * @beta
2980
3038
  */
2981
3039
 
2982
- function responsiveHeadingFont(props) {
2983
- return responsiveFont('heading', props);
3040
+ function useMediaIndex() {
3041
+ const theme = useTheme();
3042
+ const {
3043
+ media
3044
+ } = theme.sanity;
3045
+ const manager = useMemo(() => _getMediaManager(media), [media]);
3046
+ const [index, setIndex] = useState(manager.getCurrentIndex);
3047
+ useEffect(() => manager.subscribe(setIndex), [manager]);
3048
+ return index;
2984
3049
  }
2985
3050
 
2986
3051
  /**
2987
- * Get responsive CSS for the `label` font style.
2988
- * @internal
3052
+ * @public
2989
3053
  */
2990
3054
 
2991
- function responsiveLabelFont(props) {
2992
- return responsiveFont('label', props);
3055
+ function usePrefersDark() {
3056
+ const mq = useMemo(() => {
3057
+ if (typeof window === 'undefined') return undefined;
3058
+ return window.matchMedia('(prefers-color-scheme: dark)');
3059
+ }, []);
3060
+ const [dark, setDark] = useState((mq == null ? void 0 : mq.matches) || false);
3061
+ useEffect(() => {
3062
+ if (!mq) return undefined;
3063
+ setDark(mq.matches);
3064
+
3065
+ const handleChange = () => setDark(mq.matches);
3066
+
3067
+ mq.addEventListener('change', handleChange);
3068
+ return () => mq.removeEventListener('change', handleChange);
3069
+ }, [mq]);
3070
+ return dark;
2993
3071
  }
2994
3072
 
2995
3073
  /**
2996
- * Get responsive text align styles.
2997
- * @internal
3074
+ * @beta
2998
3075
  */
2999
3076
 
3000
- function responsiveTextAlignStyle(props) {
3001
- const {
3002
- theme
3003
- } = props;
3004
- return responsive(theme.sanity.media, getResponsiveProp(props.$align), textAlign => {
3005
- return {
3006
- textAlign
3007
- };
3008
- });
3009
- }
3077
+ const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
3010
3078
 
3011
3079
  /**
3012
- * Get responsive CSS for the `text` font style.
3013
- * @internal
3080
+ * @beta
3014
3081
  */
3015
3082
 
3016
- function responsiveTextFont(props) {
3017
- return responsiveFont('text', props);
3083
+ function useForwardedRef(ref) {
3084
+ const innerRef = useRef(null);
3085
+ useIsomorphicEffect(() => {
3086
+ if (!ref) return;
3087
+
3088
+ if (typeof ref === 'function') {
3089
+ ref(innerRef.current);
3090
+ } else {
3091
+ ref.current = innerRef.current;
3092
+ }
3093
+ });
3094
+ return innerRef;
3018
3095
  }
3019
3096
 
3020
3097
  /**
3021
- * This API might change. DO NOT USE IN PRODUCTION.
3022
3098
  * @beta
3023
3099
  */
3024
3100
 
3025
- function useResponsiveProp(val, defaultVal) {
3026
- return useMemo(() => getResponsiveProp(val, defaultVal), [defaultVal, val]);
3101
+ function useCustomValidity(ref, customValidity) {
3102
+ useEffect(() => {
3103
+ if (ref.current) {
3104
+ ref.current.setCustomValidity(customValidity || '');
3105
+ }
3106
+ }, [customValidity, ref]);
3027
3107
  }
3028
3108
 
3029
3109
  const BORDER_VALUE = '1px solid var(--card-border-color)';
@@ -3038,7 +3118,7 @@ function border(props) {
3038
3118
  const {
3039
3119
  media
3040
3120
  } = theme.sanity;
3041
- return responsive(media, getResponsiveProp(props.$border), value => value ? {
3121
+ return _responsive(media, props.$border, value => value ? {
3042
3122
  '&&': {
3043
3123
  border: BORDER_VALUE
3044
3124
  }
@@ -3056,7 +3136,7 @@ function borderTop(props) {
3056
3136
  const {
3057
3137
  media
3058
3138
  } = theme.sanity;
3059
- return responsive(media, getResponsiveProp(props.$borderTop), value => value ? {
3139
+ return _responsive(media, props.$borderTop, value => value ? {
3060
3140
  '&&': {
3061
3141
  borderTop: BORDER_VALUE
3062
3142
  }
@@ -3074,7 +3154,7 @@ function borderRight(props) {
3074
3154
  const {
3075
3155
  media
3076
3156
  } = theme.sanity;
3077
- return responsive(media, getResponsiveProp(props.$borderRight), value => value ? {
3157
+ return _responsive(media, props.$borderRight, value => value ? {
3078
3158
  '&&': {
3079
3159
  borderRight: BORDER_VALUE
3080
3160
  }
@@ -3092,7 +3172,7 @@ function borderBottom(props) {
3092
3172
  const {
3093
3173
  media
3094
3174
  } = theme.sanity;
3095
- return responsive(media, getResponsiveProp(props.$borderBottom), value => value ? {
3175
+ return _responsive(media, props.$borderBottom, value => value ? {
3096
3176
  '&&': {
3097
3177
  borderBottom: BORDER_VALUE
3098
3178
  }
@@ -3110,7 +3190,7 @@ function borderLeft(props) {
3110
3190
  const {
3111
3191
  media
3112
3192
  } = theme.sanity;
3113
- return responsive(media, getResponsiveProp(props.$borderLeft), value => value ? {
3193
+ return _responsive(media, props.$borderLeft, value => value ? {
3114
3194
  '&&': {
3115
3195
  borderLeft: BORDER_VALUE
3116
3196
  }
@@ -3148,7 +3228,7 @@ function responsiveBoxDisplayStyle(props) {
3148
3228
  const {
3149
3229
  media
3150
3230
  } = theme.sanity;
3151
- return responsive(media, getResponsiveProp(props.$display), display => ({
3231
+ return _responsive(media, props.$display, display => ({
3152
3232
  '&:not([hidden])': {
3153
3233
  display
3154
3234
  }
@@ -3162,7 +3242,7 @@ function responsiveBoxSizingStyle(props) {
3162
3242
  const {
3163
3243
  media
3164
3244
  } = theme.sanity;
3165
- return responsive(media, getResponsiveProp(props.$sizing), sizing => ({
3245
+ return _responsive(media, props.$sizing, sizing => ({
3166
3246
  boxSizing: BOX_SIZING[sizing]
3167
3247
  }));
3168
3248
  }
@@ -3174,7 +3254,7 @@ function responsiveBoxHeightStyle(props) {
3174
3254
  const {
3175
3255
  media
3176
3256
  } = theme.sanity;
3177
- return responsive(media, getResponsiveProp(props.$height), height => ({
3257
+ return _responsive(media, props.$height, height => ({
3178
3258
  height: BOX_HEIGHT[height]
3179
3259
  }));
3180
3260
  }
@@ -3186,7 +3266,7 @@ function responsiveBoxOverflowStyle(props) {
3186
3266
  const {
3187
3267
  media
3188
3268
  } = theme.sanity;
3189
- return responsive(media, getResponsiveProp(props.$overflow), overflow => ({
3269
+ return _responsive(media, props.$overflow, overflow => ({
3190
3270
  overflow
3191
3271
  }));
3192
3272
  }
@@ -3206,7 +3286,7 @@ function responsiveFlexAlignStyle(props) {
3206
3286
  const {
3207
3287
  media
3208
3288
  } = theme.sanity;
3209
- return responsive(media, getResponsiveProp(props.$align), align => {
3289
+ return _responsive(media, props.$align, align => {
3210
3290
  return {
3211
3291
  alignItems: align
3212
3292
  };
@@ -3221,7 +3301,7 @@ function responsiveFlexGapStyle(props) {
3221
3301
  media,
3222
3302
  space
3223
3303
  } = theme.sanity;
3224
- return responsive(media, getResponsiveProp(props.$gap), gap => ({
3304
+ return _responsive(media, props.$gap, gap => ({
3225
3305
  gap: gap ? rem(space[gap]) : undefined
3226
3306
  }));
3227
3307
  }
@@ -3233,7 +3313,7 @@ function responsiveFlexWrapStyle(props) {
3233
3313
  const {
3234
3314
  media
3235
3315
  } = theme.sanity;
3236
- return responsive(media, getResponsiveProp(props.$wrap), wrap => {
3316
+ return _responsive(media, props.$wrap, wrap => {
3237
3317
  return {
3238
3318
  flexWrap: wrap
3239
3319
  };
@@ -3246,7 +3326,7 @@ function responsiveFlexJustifyStyle(props) {
3246
3326
  const {
3247
3327
  media
3248
3328
  } = theme.sanity;
3249
- return responsive(media, getResponsiveProp(props.$justify), justify => {
3329
+ return _responsive(media, props.$justify, justify => {
3250
3330
  return {
3251
3331
  justifyContent: justify
3252
3332
  };
@@ -3259,7 +3339,7 @@ function responsiveFlexDirectionStyle(props) {
3259
3339
  const {
3260
3340
  media
3261
3341
  } = theme.sanity;
3262
- return responsive(media, getResponsiveProp(props.$direction), direction => {
3342
+ return _responsive(media, props.$direction, direction => {
3263
3343
  return {
3264
3344
  flexDirection: direction
3265
3345
  };
@@ -3280,11 +3360,10 @@ function responsiveFlexItemStyle(props) {
3280
3360
  const {
3281
3361
  media
3282
3362
  } = theme.sanity;
3283
- return responsive(media, getResponsiveProp(props.$flex), flex => {
3284
- return {
3285
- flex
3286
- };
3287
- });
3363
+ if (!props.$flex) return EMPTY_ARRAY;
3364
+ return _responsive(media, props.$flex, flex => ({
3365
+ flex
3366
+ }));
3288
3367
  }
3289
3368
 
3290
3369
  function focusRingBorderStyle(border) {
@@ -3333,7 +3412,7 @@ function responsiveGridAutoFlowStyle(props) {
3333
3412
  const {
3334
3413
  media
3335
3414
  } = theme.sanity;
3336
- return responsive(media, getResponsiveProp(props.$autoFlow), autoFlow => ({
3415
+ return _responsive(media, props.$autoFlow, autoFlow => ({
3337
3416
  gridAutoFlow: autoFlow
3338
3417
  }));
3339
3418
  }
@@ -3345,7 +3424,7 @@ function responsiveGridAutoRowsStyle(props) {
3345
3424
  const {
3346
3425
  media
3347
3426
  } = theme.sanity;
3348
- return responsive(media, getResponsiveProp(props.$autoRows), autoRows => ({
3427
+ return _responsive(media, props.$autoRows, autoRows => ({
3349
3428
  gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows]
3350
3429
  }));
3351
3430
  }
@@ -3357,7 +3436,7 @@ function responsiveGridAutoColsStyle(props) {
3357
3436
  const {
3358
3437
  media
3359
3438
  } = theme.sanity;
3360
- return responsive(media, getResponsiveProp(props.$autoCols), autoCols => ({
3439
+ return _responsive(media, props.$autoCols, autoCols => ({
3361
3440
  gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols]
3362
3441
  }));
3363
3442
  }
@@ -3369,7 +3448,7 @@ function responsiveGridColumnsStyle(props) {
3369
3448
  const {
3370
3449
  media
3371
3450
  } = theme.sanity;
3372
- return responsive(media, getResponsiveProp(props.$columns), columns => ({
3451
+ return _responsive(media, props.$columns, columns => ({
3373
3452
  gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));`
3374
3453
  }));
3375
3454
  }
@@ -3381,7 +3460,7 @@ function responsiveGridRowsStyle(props) {
3381
3460
  const {
3382
3461
  media
3383
3462
  } = theme.sanity;
3384
- return responsive(media, getResponsiveProp(props.$rows), rows => ({
3463
+ return _responsive(media, props.$rows, rows => ({
3385
3464
  gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));`
3386
3465
  }));
3387
3466
  }
@@ -3394,7 +3473,7 @@ function responsiveGridGapStyle(props) {
3394
3473
  media,
3395
3474
  space
3396
3475
  } = theme.sanity;
3397
- return responsive(media, getResponsiveProp(props.$gap), gap => ({
3476
+ return _responsive(media, props.$gap, gap => ({
3398
3477
  gridGap: gap ? rem(space[gap]) : undefined
3399
3478
  }));
3400
3479
  }
@@ -3407,7 +3486,7 @@ function responsiveGridGapXStyle(props) {
3407
3486
  media,
3408
3487
  space
3409
3488
  } = theme.sanity;
3410
- return responsive(media, getResponsiveProp(props.$gapX), gapX => ({
3489
+ return _responsive(media, props.$gapX, gapX => ({
3411
3490
  columnGap: gapX ? rem(space[gapX]) : undefined
3412
3491
  }));
3413
3492
  }
@@ -3420,7 +3499,7 @@ function responsiveGridGapYStyle(props) {
3420
3499
  media,
3421
3500
  space
3422
3501
  } = theme.sanity;
3423
- return responsive(media, getResponsiveProp(props.$gapY), gapY => ({
3502
+ return _responsive(media, props.$gapY, gapY => ({
3424
3503
  rowGap: gapY ? rem(space[gapY]) : undefined
3425
3504
  }));
3426
3505
  }
@@ -3444,7 +3523,7 @@ function responsiveGridItemRowStyle(props) {
3444
3523
  const {
3445
3524
  media
3446
3525
  } = theme.sanity;
3447
- return responsive(media, getResponsiveProp(props.$row), row => {
3526
+ return _responsive(media, props.$row, row => {
3448
3527
  if (typeof row === 'number') {
3449
3528
  return {
3450
3529
  gridRow: `span ${row} / span ${row}`
@@ -3464,7 +3543,7 @@ function responsiveGridItemRowStartStyle(props) {
3464
3543
  const {
3465
3544
  media
3466
3545
  } = theme.sanity;
3467
- return responsive(media, getResponsiveProp(props.$rowStart), rowStart => ({
3546
+ return _responsive(media, props.$rowStart, rowStart => ({
3468
3547
  gridRowStart: rowStart
3469
3548
  }));
3470
3549
  }
@@ -3476,7 +3555,7 @@ function responsiveGridItemRowEndStyle(props) {
3476
3555
  const {
3477
3556
  media
3478
3557
  } = theme.sanity;
3479
- return responsive(media, getResponsiveProp(props.$rowEnd), rowEnd => ({
3558
+ return _responsive(media, props.$rowEnd, rowEnd => ({
3480
3559
  gridRowEnd: rowEnd
3481
3560
  }));
3482
3561
  }
@@ -3488,7 +3567,7 @@ function responsiveGridItemColumnStyle(props) {
3488
3567
  const {
3489
3568
  media
3490
3569
  } = theme.sanity;
3491
- return responsive(media, getResponsiveProp(props.$column), column => {
3570
+ return _responsive(media, props.$column, column => {
3492
3571
  if (typeof column === 'number') {
3493
3572
  return {
3494
3573
  gridColumn: `span ${column} / span ${column}`
@@ -3508,7 +3587,7 @@ function responsiveGridItemColumnStartStyle(props) {
3508
3587
  const {
3509
3588
  media
3510
3589
  } = theme.sanity;
3511
- return responsive(media, getResponsiveProp(props.$columnStart), columnStart => ({
3590
+ return _responsive(media, props.$columnStart, columnStart => ({
3512
3591
  gridColumnStart: columnStart
3513
3592
  }));
3514
3593
  }
@@ -3520,15 +3599,18 @@ function responsiveGridItemColumnEndStyle(props) {
3520
3599
  const {
3521
3600
  media
3522
3601
  } = theme.sanity;
3523
- return responsive(media, getResponsiveProp(props.$columnEnd), columnEnd => ({
3602
+ return _responsive(media, props.$columnEnd, columnEnd => ({
3524
3603
  gridColumnEnd: columnEnd
3525
3604
  }));
3526
3605
  }
3527
3606
 
3528
3607
  function responsiveInputPaddingStyle(props) {
3529
3608
  const {
3609
+ $fontSize,
3530
3610
  $iconLeft,
3531
3611
  $iconRight,
3612
+ $padding,
3613
+ $space,
3532
3614
  theme
3533
3615
  } = props;
3534
3616
  const {
@@ -3536,29 +3618,26 @@ function responsiveInputPaddingStyle(props) {
3536
3618
  media,
3537
3619
  space: spaceScale
3538
3620
  } = theme.sanity;
3539
- const padding = getResponsiveProp(props.$padding, [0]);
3540
- const space = getResponsiveProp(props.$space, [0]);
3541
- const size = getResponsiveProp(props.$fontSize, [0]);
3542
- const len = Math.max(padding.length, space.length, size.length);
3621
+ const len = Math.max($padding.length, $space.length, $fontSize.length);
3543
3622
  const _padding = [];
3544
3623
  const _space = [];
3545
- const _size = [];
3624
+ const _fontSize = [];
3546
3625
 
3547
3626
  for (let i = 0; i < len; i += 1) {
3548
- _padding[i] = padding[i] === undefined ? _padding[i - 1] : padding[i];
3549
- _space[i] = space[i] === undefined ? _space[i - 1] : space[i];
3550
- _size[i] = size[i] === undefined ? _size[i - 1] : size[i];
3627
+ _fontSize[i] = $fontSize[i] === undefined ? _fontSize[i - 1] : $fontSize[i];
3628
+ _padding[i] = $padding[i] === undefined ? _padding[i - 1] : $padding[i];
3629
+ _space[i] = $space[i] === undefined ? _space[i - 1] : $space[i];
3551
3630
  }
3552
3631
 
3553
- return responsive(media, _padding, (_, i) => {
3554
- const fontSize = fonts.text.sizes[_size[i]] || fonts.text.sizes[2];
3555
- const emSize = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight;
3632
+ return _responsive(media, _padding, (_, i) => {
3633
+ const size = fonts.text.sizes[_fontSize[i]] || fonts.text.sizes[2];
3634
+ const emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight;
3556
3635
  const p = spaceScale[_padding[i]];
3557
3636
  const s = spaceScale[_space[i]];
3558
3637
  const styles = {
3559
- paddingTop: rem(p - fontSize.ascenderHeight),
3638
+ paddingTop: rem(p - size.ascenderHeight),
3560
3639
  paddingRight: rem(p),
3561
- paddingBottom: rem(p - fontSize.descenderHeight),
3640
+ paddingBottom: rem(p - size.descenderHeight),
3562
3641
  paddingLeft: rem(p)
3563
3642
  };
3564
3643
  if ($iconRight) styles.paddingRight = rem(p + emSize + s);
@@ -3589,14 +3668,12 @@ function textInputRootStyle() {
3589
3668
  function textInputBaseStyle(props) {
3590
3669
  const {
3591
3670
  theme,
3671
+ $tone,
3592
3672
  $weight
3593
3673
  } = props;
3594
3674
  const font = theme.sanity.fonts.text;
3595
3675
  const color = theme.sanity.color.input;
3596
3676
  return css(_t2$n || (_t2$n = _$B`
3597
- --input-fg-color: ${0};
3598
- --input-placeholder-color: ${0};
3599
-
3600
3677
  appearance: none;
3601
3678
  background: none;
3602
3679
  border: 0;
@@ -3610,7 +3687,6 @@ function textInputBaseStyle(props) {
3610
3687
  position: relative;
3611
3688
  z-index: 1;
3612
3689
  display: block;
3613
- color: var(--input-fg-color);
3614
3690
 
3615
3691
  /* NOTE: This is a hack to disable Chrome’s autofill styles */
3616
3692
  &:-webkit-autofill,
@@ -3622,39 +3698,46 @@ function textInputBaseStyle(props) {
3622
3698
  transition-delay: 86400s /* 24h */;
3623
3699
  }
3624
3700
 
3625
- &::placeholder {
3626
- color: var(--input-placeholder-color);
3627
- }
3628
-
3629
3701
  /* &:is(textarea) */
3630
3702
  &[data-as='textarea'] {
3631
3703
  resize: none;
3632
3704
  }
3633
3705
 
3634
- /* enabled */
3635
- &:not(:invalid):not(:disabled):not(:read-only) {
3636
- --input-fg-color: ${0};
3637
- --input-placeholder-color: ${0};
3638
- }
3706
+ color: var(--input-fg-color);
3639
3707
 
3640
- /* disabled */
3641
- &:not(:invalid):disabled {
3642
- --input-fg-color: ${0};
3643
- --input-placeholder-color: ${0};
3708
+ &::placeholder {
3709
+ color: var(--input-placeholder-color);
3644
3710
  }
3645
3711
 
3646
- /* invalid */
3647
- &:invalid {
3712
+ &[data-tone='${0}'] {
3648
3713
  --input-fg-color: ${0};
3649
3714
  --input-placeholder-color: ${0};
3650
- }
3651
3715
 
3652
- /* readOnly */
3653
- &:read-only {
3654
- --input-fg-color: ${0};
3655
- --input-placeholder-color: ${0};
3716
+ /* enabled */
3717
+ &:not(:invalid):not(:disabled):not(:read-only) {
3718
+ --input-fg-color: ${0};
3719
+ --input-placeholder-color: ${0};
3720
+ }
3721
+
3722
+ /* disabled */
3723
+ &:not(:invalid):disabled {
3724
+ --input-fg-color: ${0};
3725
+ --input-placeholder-color: ${0};
3726
+ }
3727
+
3728
+ /* invalid */
3729
+ &:invalid {
3730
+ --input-fg-color: ${0};
3731
+ --input-placeholder-color: ${0};
3732
+ }
3733
+
3734
+ /* readOnly */
3735
+ &:read-only {
3736
+ --input-fg-color: ${0};
3737
+ --input-placeholder-color: ${0};
3738
+ }
3656
3739
  }
3657
- `), 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);
3740
+ `), font.family, $weight && font.weights[$weight] || font.weights.regular, $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);
3658
3741
  }
3659
3742
  function textInputFontSizeStyle(props) {
3660
3743
  const {
@@ -3664,7 +3747,7 @@ function textInputFontSizeStyle(props) {
3664
3747
  fonts,
3665
3748
  media
3666
3749
  } = theme.sanity;
3667
- return responsive(media, getResponsiveProp(props.$fontSize, [2]), sizeIndex => {
3750
+ return _responsive(media, props.$fontSize, sizeIndex => {
3668
3751
  const size = fonts.text.sizes[sizeIndex] || fonts.text.sizes[2];
3669
3752
  return {
3670
3753
  fontSize: rem(size.fontSize),
@@ -3677,6 +3760,7 @@ function textInputRepresentationStyle(props) {
3677
3760
  $border,
3678
3761
  $hasPrefix,
3679
3762
  $hasSuffix,
3763
+ $tone,
3680
3764
  theme
3681
3765
  } = props;
3682
3766
  const {
@@ -3685,8 +3769,6 @@ function textInputRepresentationStyle(props) {
3685
3769
  } = theme.sanity;
3686
3770
  const color = theme.sanity.color.input;
3687
3771
  return css(_t3$e || (_t3$e = _$B`
3688
- --card-bg-color: ${0};
3689
- --card-fg-color: ${0};
3690
3772
  --input-box-shadow: none;
3691
3773
 
3692
3774
  position: absolute;
@@ -3697,6 +3779,7 @@ function textInputRepresentationStyle(props) {
3697
3779
  display: block;
3698
3780
  pointer-events: none;
3699
3781
  z-index: 0;
3782
+
3700
3783
  background-color: var(--card-bg-color);
3701
3784
  box-shadow: var(--input-box-shadow);
3702
3785
 
@@ -3705,48 +3788,53 @@ function textInputRepresentationStyle(props) {
3705
3788
  border-top-right-radius: ${0};
3706
3789
  border-bottom-right-radius: ${0};
3707
3790
 
3708
- /* enabled */
3709
- *:not(:disabled) + && {
3710
- --input-box-shadow: ${0};
3711
- }
3712
-
3713
- /* invalid */
3714
- *:not(:disabled):invalid + && {
3791
+ &[data-tone='${0}'] {
3715
3792
  --card-bg-color: ${0};
3716
3793
  --card-fg-color: ${0};
3717
- --input-box-shadow: ${0};
3718
- }
3719
-
3720
- /* focused */
3721
- *:not(:disabled):focus + && {
3722
- --input-box-shadow: ${0};
3723
- }
3724
3794
 
3725
- /* disabled */
3726
- *:disabled + && {
3727
- --card-bg-color: ${0};
3728
- --card-fg-color: ${0};
3729
- --input-box-shadow: ${0};
3730
- }
3795
+ /* enabled */
3796
+ *:not(:disabled) + & {
3797
+ --input-box-shadow: ${0};
3798
+ }
3731
3799
 
3732
- /* hovered */
3733
- @media (hover: hover) {
3734
- *:not(:disabled):not(:read-only):not(:invalid):hover + && {
3800
+ /* invalid */
3801
+ *:not(:disabled):invalid + & {
3735
3802
  --card-bg-color: ${0};
3736
3803
  --card-fg-color: ${0};
3804
+ --input-box-shadow: ${0};
3737
3805
  }
3738
3806
 
3739
- *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + && {
3807
+ /* focused */
3808
+ *:not(:disabled):focus + & {
3740
3809
  --input-box-shadow: ${0};
3741
3810
  }
3742
- }
3743
3811
 
3744
- /* readOnly */
3745
- *:read-only + && {
3746
- --card-bg-color: ${0};
3747
- --card-fg-color: ${0};
3812
+ /* disabled */
3813
+ *:disabled + & {
3814
+ --card-bg-color: ${0} !important;
3815
+ --card-fg-color: ${0} !important;
3816
+ --input-box-shadow: ${0};
3817
+ }
3818
+
3819
+ /* readOnly */
3820
+ *:read-only + & {
3821
+ --card-bg-color: ${0} !important;
3822
+ --card-fg-color: ${0} !important;
3823
+ }
3824
+
3825
+ /* hovered */
3826
+ @media (hover: hover) {
3827
+ *:not(:disabled):not(:read-only):not(:invalid):hover + & {
3828
+ --card-bg-color: ${0};
3829
+ --card-fg-color: ${0};
3830
+ }
3831
+
3832
+ *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + & {
3833
+ --input-box-shadow: ${0};
3834
+ }
3835
+ }
3748
3836
  }
3749
- `), color.default.enabled.bg, color.default.enabled.fg, $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $border ? focusRingBorderStyle({
3837
+ `), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $tone, color.default.enabled.bg, color.default.enabled.fg, $border ? focusRingBorderStyle({
3750
3838
  color: color.default.enabled.border,
3751
3839
  width: input.border.width
3752
3840
  }) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
@@ -3761,24 +3849,24 @@ function textInputRepresentationStyle(props) {
3761
3849
  }), color.default.disabled.bg, color.default.disabled.fg, $border ? focusRingBorderStyle({
3762
3850
  color: color.default.disabled.border,
3763
3851
  width: input.border.width
3764
- }) : 'none', color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
3852
+ }) : 'none', color.default.readOnly.bg, color.default.readOnly.fg, color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
3765
3853
  color: color.default.hovered.border,
3766
3854
  width: input.border.width
3767
- }) : 'none', color.default.readOnly.bg, color.default.readOnly.fg);
3855
+ }) : 'none');
3768
3856
  }
3769
3857
 
3770
3858
  function responsiveMarginStyle(props) {
3771
3859
  const {
3772
3860
  theme
3773
3861
  } = props;
3774
- 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);
3862
+ 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);
3775
3863
  }
3776
3864
 
3777
3865
  function responsivePaddingStyle(props) {
3778
3866
  const {
3779
3867
  theme
3780
3868
  } = props;
3781
- 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);
3869
+ 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);
3782
3870
  }
3783
3871
 
3784
3872
  function responsiveRadiusStyle(props) {
@@ -3789,7 +3877,7 @@ function responsiveRadiusStyle(props) {
3789
3877
  media,
3790
3878
  radius
3791
3879
  } = theme.sanity;
3792
- return responsive(media, getResponsiveProp(props.$radius), radiusIndex => ({
3880
+ return _responsive(media, props.$radius, radiusIndex => ({
3793
3881
  borderRadius: rem(radius[radiusIndex])
3794
3882
  }));
3795
3883
  }
@@ -3799,7 +3887,7 @@ function toBoxShadow(shadow, color) {
3799
3887
  }
3800
3888
 
3801
3889
  function shadowStyle(shadow) {
3802
- if (!shadow) return EMPTY_RECORD$1;
3890
+ if (!shadow) return EMPTY_RECORD;
3803
3891
  const outline = `0 0 0 ${rem(1)} var(--card-shadow-outline-color)`;
3804
3892
  const umbra = toBoxShadow(shadow.umbra, 'var(--card-shadow-umbra-color)');
3805
3893
  const penumbra = toBoxShadow(shadow.penumbra, 'var(--card-shadow-penumbra-color)');
@@ -3817,7 +3905,7 @@ function responsiveShadowStyle(props) {
3817
3905
  media,
3818
3906
  shadows
3819
3907
  } = theme.sanity;
3820
- return responsive(media, getResponsiveProp(props.$shadow), shadow => shadowStyle(shadows[shadow]));
3908
+ return _responsive(media, props.$shadow, shadow => shadowStyle(shadows[shadow]));
3821
3909
  }
3822
3910
 
3823
3911
  let _$A = t => t,
@@ -3919,10 +4007,10 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
3919
4007
  "data-ui": "Text"
3920
4008
  }, restProps, {
3921
4009
  "$accent": accent,
3922
- "$align": align,
4010
+ "$align": useArrayProp(align),
3923
4011
  "$muted": muted,
3924
4012
  ref: ref,
3925
- "$size": size,
4013
+ "$size": useArrayProp(size),
3926
4014
  "$weight": weight
3927
4015
  }), /*#__PURE__*/React.createElement("span", null, children));
3928
4016
  });
@@ -4025,7 +4113,7 @@ function responsiveAvatarSizeStyle(props) {
4025
4113
  avatar,
4026
4114
  media
4027
4115
  } = theme.sanity;
4028
- return responsive(media, props.$size, size => {
4116
+ return _responsive(media, props.$size, size => {
4029
4117
  const avatarSize = avatar.sizes[size] || avatar.sizes[0];
4030
4118
  return {
4031
4119
  width: rem(avatarSize.size),
@@ -4099,12 +4187,12 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4099
4187
  arrowPosition: arrowPositionProp,
4100
4188
  animateArrowFrom,
4101
4189
  status = 'online',
4102
- size: sizeProp
4190
+ size: sizeProp = 0
4103
4191
  } = props,
4104
4192
  restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4105
4193
 
4106
4194
  const as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
4107
- const size = useResponsiveProp(sizeProp, [0]);
4195
+ const size = useArrayProp(sizeProp);
4108
4196
  const theme = useTheme();
4109
4197
  const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray; // @todo: remove this
4110
4198
 
@@ -4133,6 +4221,7 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4133
4221
  onImageLoadError(new Error('Avatar: the image failed to load'));
4134
4222
  }
4135
4223
  }, [onImageLoadError]);
4224
+ const initialsSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
4136
4225
  return /*#__PURE__*/React.createElement(Root$D, _extends({
4137
4226
  as: as,
4138
4227
  "data-as": typeof as === 'string' ? as : undefined,
@@ -4186,14 +4275,14 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
4186
4275
  vectorEffect: "non-scaling-stroke"
4187
4276
  })), (imageFailed || !src) && initials && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Initials, null, /*#__PURE__*/React.createElement(Text, {
4188
4277
  as: "span",
4189
- size: size.map(s => s === 0 ? 0 : s + 1)
4278
+ size: initialsSize
4190
4279
  }, /*#__PURE__*/React.createElement("strong", null, initials)))));
4191
4280
  });
4192
4281
 
4193
4282
  let _$y = t => t,
4194
4283
  _t$A;
4195
4284
 
4196
- function responsiveAvatarCounterSizeStyle(props) {
4285
+ function _responsiveAvatarCounterSizeStyle(props) {
4197
4286
  const {
4198
4287
  theme
4199
4288
  } = props;
@@ -4201,9 +4290,9 @@ function responsiveAvatarCounterSizeStyle(props) {
4201
4290
  avatar,
4202
4291
  media
4203
4292
  } = theme.sanity;
4204
- return responsive(media, props.$size, size => {
4293
+ return _responsive(media, props.$size, size => {
4205
4294
  const avatarSize = avatar.sizes[size];
4206
- if (!avatarSize) return EMPTY_RECORD$1;
4295
+ if (!avatarSize) return EMPTY_RECORD;
4207
4296
  return {
4208
4297
  borderRadius: rem(avatarSize.size / 2),
4209
4298
  minWidth: rem(avatarSize.size),
@@ -4212,7 +4301,7 @@ function responsiveAvatarCounterSizeStyle(props) {
4212
4301
  });
4213
4302
  }
4214
4303
 
4215
- function avatarCounterBaseStyle(props) {
4304
+ function _avatarCounterBaseStyle(props) {
4216
4305
  const {
4217
4306
  theme
4218
4307
  } = props;
@@ -4233,7 +4322,7 @@ function avatarCounterBaseStyle(props) {
4233
4322
  `), rem(theme.sanity.space[2]));
4234
4323
  }
4235
4324
 
4236
- const Root$C = styled.div(responsiveAvatarCounterSizeStyle, avatarCounterBaseStyle);
4325
+ const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
4237
4326
  /**
4238
4327
  * @public
4239
4328
  */
@@ -4241,17 +4330,17 @@ const Root$C = styled.div(responsiveAvatarCounterSizeStyle, avatarCounterBaseSty
4241
4330
  const AvatarCounter = /*#__PURE__*/forwardRef(function AvatarCounter(props, ref) {
4242
4331
  const {
4243
4332
  count,
4244
- size: sizeProp = 0,
4245
- tone
4333
+ size: sizeProp = 0
4246
4334
  } = props;
4247
- const size = useResponsiveProp(sizeProp, [0]);
4335
+ const size = useArrayProp(sizeProp);
4336
+ const counterSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
4248
4337
  return /*#__PURE__*/React.createElement(Root$C, {
4249
4338
  "$size": size,
4250
- "data-tone": tone,
4339
+ "data-ui": "AvatarCounter",
4251
4340
  ref: ref
4252
4341
  }, /*#__PURE__*/React.createElement(Text, {
4253
4342
  as: "span",
4254
- size: size.map(s => s === 0 ? 0 : s + 1)
4343
+ size: counterSize
4255
4344
  }, /*#__PURE__*/React.createElement("strong", null, count)));
4256
4345
  });
4257
4346
 
@@ -4260,7 +4349,7 @@ function childrenToElementArray(children) {
4260
4349
  return childrenArray.filter(node => isElement(node) || isFragment(node) || typeof node === 'string');
4261
4350
  }
4262
4351
 
4263
- const _excluded$E = ["children", "maxLength", "size", "tone"];
4352
+ const _excluded$E = ["children", "maxLength", "size"];
4264
4353
 
4265
4354
  let _$x = t => t,
4266
4355
  _t$z;
@@ -4288,9 +4377,9 @@ function responsiveAvatarStackSizeStyle(props) {
4288
4377
  avatar,
4289
4378
  media
4290
4379
  } = theme.sanity;
4291
- return responsive(media, getResponsiveProp(props.size), size => {
4380
+ return _responsive(media, props.$size, size => {
4292
4381
  const avatarSize = avatar.sizes[size];
4293
- if (!avatarSize) return EMPTY_RECORD$1;
4382
+ if (!avatarSize) return EMPTY_RECORD;
4294
4383
  return {
4295
4384
  '& > div + div': {
4296
4385
  marginLeft: rem(avatarSize.distance)
@@ -4308,13 +4397,13 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4308
4397
  const {
4309
4398
  children: childrenProp,
4310
4399
  maxLength: maxLengthProp = 4,
4311
- size = 0,
4312
- tone
4400
+ size: sizeProp = 0
4313
4401
  } = props,
4314
4402
  restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4315
4403
 
4316
- const maxLength = Math.max(maxLengthProp, 0);
4317
4404
  const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
4405
+ const maxLength = Math.max(maxLengthProp, 0);
4406
+ const size = useArrayProp(sizeProp);
4318
4407
  const len = children.length;
4319
4408
  const visibleCount = maxLength - 1;
4320
4409
  const extraCount = len - visibleCount;
@@ -4323,19 +4412,16 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4323
4412
  "data-ui": "AvatarStack"
4324
4413
  }, restProps, {
4325
4414
  ref: ref,
4326
- size: size
4415
+ "$size": size
4327
4416
  }), len === 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
4328
- count: len,
4329
- tone: tone
4417
+ count: len
4330
4418
  })), len !== 0 && extraCount > 1 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
4331
4419
  count: extraCount,
4332
- size: size,
4333
- tone: tone
4420
+ size: size
4334
4421
  })), visibleChildren.map((child, childIndex) => /*#__PURE__*/React.createElement("div", {
4335
4422
  key: String(childIndex)
4336
4423
  }, /*#__PURE__*/cloneElement(child, {
4337
- size,
4338
- tone
4424
+ size
4339
4425
  }))));
4340
4426
  });
4341
4427
 
@@ -4377,34 +4463,34 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4377
4463
  restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4378
4464
 
4379
4465
  return /*#__PURE__*/React.createElement(Root$A, _extends({
4380
- "data-as": asProp,
4466
+ "data-as": typeof asProp === 'string' ? asProp : undefined,
4381
4467
  "data-ui": "Box"
4382
4468
  }, restProps, {
4383
- "$column": column,
4384
- "$columnStart": columnStart,
4385
- "$columnEnd": columnEnd,
4386
- "$display": display,
4387
- "$flex": flex,
4388
- "$height": height,
4389
- "$margin": margin,
4390
- "$marginX": marginX,
4391
- "$marginY": marginY,
4392
- "$marginTop": marginTop,
4393
- "$marginRight": marginRight,
4394
- "$marginBottom": marginBottom,
4395
- "$marginLeft": marginLeft,
4396
- "$overflow": overflow,
4397
- "$padding": padding,
4398
- "$paddingX": paddingX,
4399
- "$paddingY": paddingY,
4400
- "$paddingTop": paddingTop,
4401
- "$paddingRight": paddingRight,
4402
- "$paddingBottom": paddingBottom,
4403
- "$paddingLeft": paddingLeft,
4404
- "$row": row,
4405
- "$rowStart": rowStart,
4406
- "$rowEnd": rowEnd,
4407
- "$sizing": sizing,
4469
+ "$column": useArrayProp(column),
4470
+ "$columnStart": useArrayProp(columnStart),
4471
+ "$columnEnd": useArrayProp(columnEnd),
4472
+ "$display": useArrayProp(display),
4473
+ "$flex": useArrayProp(flex),
4474
+ "$height": useArrayProp(height),
4475
+ "$margin": useArrayProp(margin),
4476
+ "$marginX": useArrayProp(marginX),
4477
+ "$marginY": useArrayProp(marginY),
4478
+ "$marginTop": useArrayProp(marginTop),
4479
+ "$marginRight": useArrayProp(marginRight),
4480
+ "$marginBottom": useArrayProp(marginBottom),
4481
+ "$marginLeft": useArrayProp(marginLeft),
4482
+ "$overflow": useArrayProp(overflow),
4483
+ "$padding": useArrayProp(padding),
4484
+ "$paddingX": useArrayProp(paddingX),
4485
+ "$paddingY": useArrayProp(paddingY),
4486
+ "$paddingTop": useArrayProp(paddingTop),
4487
+ "$paddingRight": useArrayProp(paddingRight),
4488
+ "$paddingBottom": useArrayProp(paddingBottom),
4489
+ "$paddingLeft": useArrayProp(paddingLeft),
4490
+ "$row": useArrayProp(row),
4491
+ "$rowStart": useArrayProp(rowStart),
4492
+ "$rowEnd": useArrayProp(rowEnd),
4493
+ "$sizing": useArrayProp(sizing),
4408
4494
  as: asProp,
4409
4495
  ref: ref
4410
4496
  }), props.children);
@@ -4489,9 +4575,9 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
4489
4575
  "data-ui": "Label"
4490
4576
  }, restProps, {
4491
4577
  "$accent": accent,
4492
- "$align": align,
4578
+ "$align": useArrayProp(align),
4493
4579
  "$muted": muted,
4494
- "$size": size,
4580
+ "$size": useArrayProp(size),
4495
4581
  "$weight": weight,
4496
4582
  ref: ref
4497
4583
  }), children);
@@ -4538,8 +4624,8 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4538
4624
  }, restProps, {
4539
4625
  "$mode": mode,
4540
4626
  "$tone": tone,
4541
- "$radius": radius,
4542
- padding: padding,
4627
+ "$radius": useArrayProp(radius),
4628
+ padding: useArrayProp(padding),
4543
4629
  ref: ref
4544
4630
  }), /*#__PURE__*/React.createElement(Label, {
4545
4631
  size: fontSize
@@ -4566,11 +4652,11 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4566
4652
  return /*#__PURE__*/React.createElement(Root$x, _extends({
4567
4653
  "data-ui": "Flex"
4568
4654
  }, restProps, {
4569
- "$align": align,
4570
- "$direction": direction,
4571
- "$gap": gap,
4572
- "$justify": justify,
4573
- "$wrap": wrap,
4655
+ "$align": useArrayProp(align),
4656
+ "$direction": useArrayProp(direction),
4657
+ "$gap": useArrayProp(gap),
4658
+ "$justify": useArrayProp(justify),
4659
+ "$wrap": useArrayProp(wrap),
4574
4660
  forwardedAs: as,
4575
4661
  ref: ref
4576
4662
  }));
@@ -4757,19 +4843,19 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4757
4843
  fontSize,
4758
4844
  icon,
4759
4845
  iconRight,
4760
- justify = 'center',
4846
+ justify: justifyProp = 'center',
4761
4847
  loading,
4762
4848
  mode = 'default',
4763
- padding = 3,
4764
- paddingX,
4765
- paddingY,
4766
- paddingTop,
4767
- paddingBottom,
4768
- paddingLeft,
4769
- paddingRight,
4770
- radius = 2,
4849
+ padding: paddingProp = 3,
4850
+ paddingX: paddingXProp,
4851
+ paddingY: paddingYProp,
4852
+ paddingTop: paddingTopProp,
4853
+ paddingBottom: paddingBottomProp,
4854
+ paddingLeft: paddingLeftProp,
4855
+ paddingRight: paddingRightProp,
4856
+ radius: radiusProp = 2,
4771
4857
  selected,
4772
- space = 3,
4858
+ space: spaceProp = 3,
4773
4859
  text,
4774
4860
  textAlign,
4775
4861
  tone = 'default',
@@ -4777,6 +4863,16 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
4777
4863
  } = props,
4778
4864
  restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
4779
4865
 
4866
+ const justify = useArrayProp(justifyProp);
4867
+ const padding = useArrayProp(paddingProp);
4868
+ const paddingX = useArrayProp(paddingXProp);
4869
+ const paddingY = useArrayProp(paddingYProp);
4870
+ const paddingTop = useArrayProp(paddingTopProp);
4871
+ const paddingBottom = useArrayProp(paddingBottomProp);
4872
+ const paddingLeft = useArrayProp(paddingLeftProp);
4873
+ const paddingRight = useArrayProp(paddingRightProp);
4874
+ const radius = useArrayProp(radiusProp);
4875
+ const space = useArrayProp(spaceProp);
4780
4876
  const theme = useTheme();
4781
4877
  const boxProps = useMemo(() => ({
4782
4878
  // flex: 1,
@@ -4983,7 +5079,7 @@ function cardColorStyle(props) {
4983
5079
  }) : undefined, $focusRing ? focusRingBorderStyle(border) : undefined, (_theme$sanity$styles = theme.sanity.styles) == null ? void 0 : (_theme$sanity$styles$ = _theme$sanity$styles.card) == null ? void 0 : _theme$sanity$styles$.root);
4984
5080
  }
4985
5081
 
4986
- const _excluded$y = ["pressed", "__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "radius", "scheme", "selected", "shadow", "tone"];
5082
+ const _excluded$y = ["__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "pressed", "radius", "scheme", "selected", "shadow", "tone"];
4987
5083
  const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
4988
5084
  /**
4989
5085
  * @public
@@ -4991,7 +5087,6 @@ const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, respons
4991
5087
 
4992
5088
  const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
4993
5089
  const {
4994
- pressed = false,
4995
5090
  __unstable_checkered: checkered = false,
4996
5091
  __unstable_focusRing: focusRing = false,
4997
5092
  as: asProp,
@@ -5000,6 +5095,7 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
5000
5095
  borderRight,
5001
5096
  borderBottom,
5002
5097
  borderLeft,
5098
+ pressed,
5003
5099
  radius = 0,
5004
5100
  scheme,
5005
5101
  selected,
@@ -5016,23 +5112,23 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
5016
5112
  tone: tone
5017
5113
  }, /*#__PURE__*/React.createElement(Root$u, _extends({
5018
5114
  "data-as": typeof as === 'string' ? as : undefined,
5019
- "data-checkered": checkered ? '' : undefined,
5020
- "data-pressed": pressed ? '' : undefined,
5021
5115
  "data-scheme": rootTheme.scheme,
5022
- "data-selected": selected ? '' : undefined,
5023
5116
  "data-ui": "Card",
5024
5117
  "data-tone": tone
5025
5118
  }, restProps, {
5026
- "$border": border,
5027
- "$borderTop": borderTop,
5028
- "$borderRight": borderRight,
5029
- "$borderBottom": borderBottom,
5030
- "$borderLeft": borderLeft,
5119
+ "$border": useArrayProp(border),
5120
+ "$borderTop": useArrayProp(borderTop),
5121
+ "$borderRight": useArrayProp(borderRight),
5122
+ "$borderBottom": useArrayProp(borderBottom),
5123
+ "$borderLeft": useArrayProp(borderLeft),
5031
5124
  "$checkered": checkered,
5032
5125
  "$focusRing": focusRing,
5033
- "$radius": radius,
5034
- "$shadow": shadow,
5126
+ "$radius": useArrayProp(radius),
5127
+ "$shadow": useArrayProp(shadow),
5035
5128
  "$tone": tone,
5129
+ "data-checkered": checkered ? '' : undefined,
5130
+ "data-pressed": pressed ? '' : undefined,
5131
+ "data-selected": selected ? '' : undefined,
5036
5132
  forwardedAs: as,
5037
5133
  ref: ref,
5038
5134
  selected: selected
@@ -5348,7 +5444,7 @@ const Code = /*#__PURE__*/forwardRef(function Code(props, ref) {
5348
5444
  return /*#__PURE__*/React.createElement(Root$s, _extends({
5349
5445
  "data-ui": "Code"
5350
5446
  }, restProps, {
5351
- "$size": size,
5447
+ "$size": useArrayProp(size),
5352
5448
  "$weight": weight,
5353
5449
  ref: ref
5354
5450
  }), !(language && registered) && /*#__PURE__*/React.createElement("code", null, children), language && registered && /*#__PURE__*/React.createElement(Refractor, {
@@ -5373,7 +5469,7 @@ function responsiveContainerWidthStyle(props) {
5373
5469
  container,
5374
5470
  media
5375
5471
  } = theme.sanity;
5376
- return responsive(media, getResponsiveProp(props.$width), val => ({
5472
+ return _responsive(media, props.$width, val => ({
5377
5473
  maxWidth: val === 'auto' ? 'none' : rem(container[val])
5378
5474
  }));
5379
5475
  }
@@ -5394,7 +5490,7 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
5394
5490
  return /*#__PURE__*/React.createElement(Root$r, _extends({
5395
5491
  "data-ui": "Container"
5396
5492
  }, restProps, {
5397
- "$width": width,
5493
+ "$width": useArrayProp(width),
5398
5494
  forwardedAs: as,
5399
5495
  ref: ref
5400
5496
  }));
@@ -5425,14 +5521,14 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
5425
5521
  "data-as": typeof as === 'string' ? as : undefined,
5426
5522
  "data-ui": "Grid"
5427
5523
  }, restProps, {
5428
- "$autoRows": autoRows,
5429
- "$autoCols": autoCols,
5430
- "$autoFlow": autoFlow,
5431
- "$columns": columns,
5432
- "$gap": gap,
5433
- "$gapX": gapX,
5434
- "$gapY": gapY,
5435
- "$rows": rows,
5524
+ "$autoRows": useArrayProp(autoRows),
5525
+ "$autoCols": useArrayProp(autoCols),
5526
+ "$autoFlow": useArrayProp(autoFlow),
5527
+ "$columns": useArrayProp(columns),
5528
+ "$gap": useArrayProp(gap),
5529
+ "$gapX": useArrayProp(gapX),
5530
+ "$gapY": useArrayProp(gapY),
5531
+ "$rows": useArrayProp(rows),
5436
5532
  forwardedAs: as,
5437
5533
  ref: ref
5438
5534
  }), children);
@@ -5526,9 +5622,9 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
5526
5622
  "data-ui": "Heading"
5527
5623
  }, restProps, {
5528
5624
  "$accent": accent,
5529
- "$align": align,
5625
+ "$align": useArrayProp(align),
5530
5626
  "$muted": muted,
5531
- "$size": size,
5627
+ "$size": useArrayProp(size),
5532
5628
  "$weight": weight,
5533
5629
  ref: ref
5534
5630
  }), /*#__PURE__*/React.createElement("span", null, children));
@@ -5550,7 +5646,7 @@ function inlineSpaceStyle(props) {
5550
5646
  const {
5551
5647
  theme
5552
5648
  } = props;
5553
- return responsive(theme.sanity.media, getResponsiveProp(props.$space), spaceIndex => {
5649
+ return _responsive(theme.sanity.media, props.$space, spaceIndex => {
5554
5650
  const space = rem(theme.sanity.space[spaceIndex]);
5555
5651
  return {
5556
5652
  margin: `-${space} 0 0 -${space}`,
@@ -5575,16 +5671,16 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
5575
5671
  } = props,
5576
5672
  restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
5577
5673
 
5578
- const children = childrenToElementArray(childrenProp).filter(Boolean);
5674
+ const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /*#__PURE__*/React.createElement("div", {
5675
+ key: idx
5676
+ }, child)), [childrenProp]);
5579
5677
  return /*#__PURE__*/React.createElement(Root$o, _extends({
5580
5678
  "data-ui": "Inline"
5581
5679
  }, restProps, {
5582
- "$space": space,
5680
+ "$space": useArrayProp(space),
5583
5681
  forwardedAs: as,
5584
5682
  ref: ref
5585
- }), children.map((child, idx) => /*#__PURE__*/React.createElement("div", {
5586
- key: idx
5587
- }, child)));
5683
+ }), children);
5588
5684
  });
5589
5685
 
5590
5686
  const _excluded$r = ["children", "fontSize", "padding", "radius"];
@@ -5621,7 +5717,7 @@ const KBD = /*#__PURE__*/forwardRef(function KBD(props, ref) {
5621
5717
  return /*#__PURE__*/React.createElement(Root$n, _extends({
5622
5718
  "data-ui": "KBD"
5623
5719
  }, restProps, {
5624
- "$radius": radius,
5720
+ "$radius": useArrayProp(radius),
5625
5721
  ref: ref
5626
5722
  }), /*#__PURE__*/React.createElement(Box, {
5627
5723
  as: "span",
@@ -5675,12 +5771,6 @@ function useBoundaryElement() {
5675
5771
  return value || DEFAULT_VALUE;
5676
5772
  }
5677
5773
 
5678
- /**
5679
- * @internal
5680
- */
5681
-
5682
- const RO = typeof window !== 'undefined' && window.ResizeObserver ? window.ResizeObserver : ResizeObserver$1;
5683
-
5684
5774
  function findMaxBreakpoints(media, width) {
5685
5775
  const ret = [];
5686
5776
 
@@ -5723,20 +5813,14 @@ const ElementQuery = /*#__PURE__*/forwardRef(function ElementQuery(props, ref) {
5723
5813
  } = props,
5724
5814
  restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
5725
5815
 
5726
- const [width, setWidth] = useState(() => window.innerWidth);
5727
5816
  const forwardedRef = useForwardedRef(ref);
5728
5817
  const [element, setElement] = useState(null);
5729
- useEffect(() => {
5730
- if (!element) return;
5818
+ const elementSize = useElementSize(element);
5819
+ const width = useMemo(() => {
5820
+ var _elementSize$border$w;
5731
5821
 
5732
- const handleResizeEntries = entries => {
5733
- setWidth(entries[0].contentRect.width);
5734
- };
5735
-
5736
- const ro = new RO(handleResizeEntries);
5737
- ro.observe(element);
5738
- return () => ro.disconnect();
5739
- }, [element]);
5822
+ return (_elementSize$border$w = elementSize == null ? void 0 : elementSize.border.width) != null ? _elementSize$border$w : window.innerWidth;
5823
+ }, [elementSize]);
5740
5824
  const max = useMemo(() => findMaxBreakpoints(media, width), [media, width]);
5741
5825
  const min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
5742
5826
  const setRef = useCallback(el => {
@@ -5829,7 +5913,7 @@ function LayerProvider(props) {
5829
5913
  zOffset: zOffsetProp = 0
5830
5914
  } = props;
5831
5915
  const parent = useContext(LayerContext);
5832
- const zOffset = useResponsiveProp(zOffsetProp);
5916
+ const zOffset = useArrayProp(zOffsetProp);
5833
5917
  const maxMediaIndex = zOffset.length - 1;
5834
5918
  const mediaIndex = Math.min(useMediaIndex(), maxMediaIndex);
5835
5919
  const zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
@@ -5866,7 +5950,7 @@ const Root$m = styled.div(_t$n || (_t$n = _$l`
5866
5950
  const LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref) {
5867
5951
  const {
5868
5952
  children,
5869
- style = EMPTY_RECORD$1
5953
+ style = EMPTY_RECORD
5870
5954
  } = props,
5871
5955
  restProps = _objectWithoutPropertiesLoose(props, _excluded$p);
5872
5956
 
@@ -5874,6 +5958,7 @@ const LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref)
5874
5958
  zIndex
5875
5959
  } = useLayer();
5876
5960
  return /*#__PURE__*/React.createElement(Root$m, _extends({}, restProps, {
5961
+ "data-ui": "Layer",
5877
5962
  ref: ref,
5878
5963
  style: _extends({}, style, {
5879
5964
  zIndex
@@ -5969,14 +6054,14 @@ function Portal(props) {
5969
6054
  function useUnique(value) {
5970
6055
  const valueRef = useRef(value);
5971
6056
 
5972
- if (!isEqual(valueRef.current, value)) {
6057
+ if (!_isEqual(valueRef.current, value)) {
5973
6058
  valueRef.current = value;
5974
6059
  }
5975
6060
 
5976
6061
  return valueRef.current;
5977
6062
  }
5978
6063
 
5979
- function isEqual(objA, objB) {
6064
+ function _isEqual(objA, objB) {
5980
6065
  if (!objA || !objB) {
5981
6066
  return objA === objB;
5982
6067
  }
@@ -6273,17 +6358,16 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
6273
6358
  scrollEl.addEventListener('scroll', _handleScroll, {
6274
6359
  passive: true
6275
6360
  });
6276
- const ro = new ResizeObserver(entries => {
6277
- setScrollHeight(entries[0].contentRect.height);
6361
+
6362
+ const disposeElementSizeListener = _elementSizeObserver.subscribe(scrollEl, scrollElementSize => {
6363
+ setScrollHeight(scrollElementSize.content.height);
6278
6364
  });
6279
- ro.observe(scrollEl);
6280
6365
 
6281
6366
  _handleScroll();
6282
6367
 
6283
6368
  return () => {
6284
6369
  scrollEl.removeEventListener('scroll', _handleScroll);
6285
- ro.unobserve(scrollEl);
6286
- ro.disconnect();
6370
+ disposeElementSizeListener();
6287
6371
  };
6288
6372
  }
6289
6373
 
@@ -6675,11 +6759,11 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6675
6759
  matchReferenceWidth,
6676
6760
  shadow = 3,
6677
6761
  scheme,
6678
- style = EMPTY_RECORD$1,
6762
+ style = EMPTY_RECORD,
6679
6763
  tether,
6680
6764
  tetherOffset,
6681
6765
  tone = 'inherit',
6682
- width = 0,
6766
+ width: widthProp = 0,
6683
6767
  zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
6684
6768
  } = props,
6685
6769
  restProps = _objectWithoutPropertiesLoose(props, _excluded$n);
@@ -6690,6 +6774,7 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6690
6774
  const [popperElement, setPopperElement] = useState(null);
6691
6775
  const [arrowElement, setArrowElement] = useState(null);
6692
6776
  const popperReferenceElement = referenceElementProp || referenceElement;
6777
+ const width = useArrayProp(widthProp);
6693
6778
  const modifiers = usePopoverModifiers({
6694
6779
  allowedAutoPlacements,
6695
6780
  arrow,
@@ -6752,13 +6837,13 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
6752
6837
  zOffset: zOffset
6753
6838
  }, attributes.popper), /*#__PURE__*/React.createElement(PopoverCard, {
6754
6839
  "$constrainSize": constrainSize,
6840
+ "$width": width,
6755
6841
  "data-ui": "PopoverCard",
6756
6842
  padding: padding,
6757
6843
  radius: radius,
6758
6844
  scheme: scheme,
6759
6845
  shadow: shadow,
6760
- tone: tone,
6761
- width: width
6846
+ tone: tone
6762
6847
  }, arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
6763
6848
  ref: setArrowElement,
6764
6849
  style: styles.arrow
@@ -7030,7 +7115,7 @@ function inputTextSizeStyle(props) {
7030
7115
  const {
7031
7116
  sizes
7032
7117
  } = theme.sanity.fonts.text;
7033
- return responsive(theme.sanity.media, getResponsiveProp($fontSize), sizeIndex => textSize(sizes[sizeIndex] || sizes[2]));
7118
+ return _responsive(theme.sanity.media, $fontSize, sizeIndex => textSize(sizes[sizeIndex] || sizes[2]));
7034
7119
  }
7035
7120
 
7036
7121
  function inputStyle() {
@@ -7105,10 +7190,10 @@ const Select = /*#__PURE__*/forwardRef(function Select(props, forwardedRef) {
7105
7190
  "data-read-only": !disabled && readOnly ? '' : undefined,
7106
7191
  "data-ui": "Select"
7107
7192
  }, restProps, {
7108
- "$fontSize": fontSize,
7109
- "$padding": padding,
7110
- "$radius": radius,
7111
- "$space": space,
7193
+ "$fontSize": useArrayProp(fontSize),
7194
+ "$padding": useArrayProp(padding),
7195
+ "$radius": useArrayProp(radius),
7196
+ "$space": useArrayProp(space),
7112
7197
  disabled: disabled || readOnly,
7113
7198
  ref: ref
7114
7199
  }), children), /*#__PURE__*/React.createElement(IconBox, {
@@ -7139,7 +7224,7 @@ function responsiveStackSpaceStyle(props) {
7139
7224
  media,
7140
7225
  space
7141
7226
  } = theme.sanity;
7142
- return responsive(media, getResponsiveProp(props.$space), spaceIndex => ({
7227
+ return _responsive(media, props.$space, spaceIndex => ({
7143
7228
  gridGap: rem(space[spaceIndex])
7144
7229
  }));
7145
7230
  }
@@ -7161,7 +7246,7 @@ const Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
7161
7246
  "data-as": typeof as === 'string' ? as : undefined,
7162
7247
  "data-ui": "Stack"
7163
7248
  }, restProps, {
7164
- "$space": space,
7249
+ "$space": useArrayProp(space),
7165
7250
  forwardedAs: as,
7166
7251
  ref: ref
7167
7252
  }));
@@ -7173,7 +7258,7 @@ let _$f = t => t,
7173
7258
  _t3$6,
7174
7259
  _t4$4,
7175
7260
  _t5$3,
7176
- _t6$1,
7261
+ _t6$2,
7177
7262
  _t7;
7178
7263
  /* Root */
7179
7264
 
@@ -7338,7 +7423,7 @@ function switchThumbStyles(props) {
7338
7423
  ${0}
7339
7424
 
7340
7425
  ${0}
7341
- `), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$1 || (_t6$1 = _$f`
7426
+ `), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$2 || (_t6$2 = _$f`
7342
7427
  transform: translate3d(${0}px, 0, 0);
7343
7428
  `), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$f`
7344
7429
  transform: translate3d(${0}px, 0, 0);
@@ -7393,7 +7478,7 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
7393
7478
  })));
7394
7479
  });
7395
7480
 
7396
- const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"];
7481
+ const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"];
7397
7482
 
7398
7483
  let _$e = t => t,
7399
7484
  _t$f;
@@ -7417,39 +7502,50 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
7417
7502
  disabled = false,
7418
7503
  fontSize = 2,
7419
7504
  padding = 3,
7420
- radius = 1
7505
+ radius = 1,
7506
+ weight
7421
7507
  } = props,
7422
7508
  restProps = _objectWithoutPropertiesLoose(props, _excluded$i);
7423
7509
 
7424
7510
  const ref = useForwardedRef(forwardedRef);
7511
+ const rootTheme = useRootTheme();
7425
7512
  useCustomValidity(ref, customValidity);
7426
7513
  return /*#__PURE__*/React.createElement(Root$d, {
7427
7514
  "data-ui": "TextArea"
7428
7515
  }, /*#__PURE__*/React.createElement(InputRoot$1, null, /*#__PURE__*/React.createElement(Input$1, _extends({
7429
- "data-as": "textarea"
7516
+ "data-as": "textarea",
7517
+ "data-tone": rootTheme.tone
7430
7518
  }, restProps, {
7431
- "$fontSize": fontSize,
7432
- "$padding": padding,
7519
+ "$fontSize": useArrayProp(fontSize),
7520
+ "$padding": useArrayProp(padding),
7521
+ "$space": useArrayProp(0),
7522
+ "$tone": rootTheme.tone,
7523
+ "$weight": weight,
7433
7524
  disabled: disabled,
7434
7525
  ref: ref
7435
7526
  })), /*#__PURE__*/React.createElement(Presentation$1, {
7436
7527
  "$border": border,
7437
- "$radius": radius
7528
+ "$radius": useArrayProp(radius),
7529
+ "$tone": rootTheme.tone,
7530
+ "data-tone": rootTheme.tone
7438
7531
  })));
7439
7532
  });
7440
7533
 
7441
- const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"];
7534
+ const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"];
7442
7535
 
7443
7536
  let _$d = t => t,
7444
7537
  _t$e,
7445
7538
  _t2$a,
7446
7539
  _t3$5,
7447
7540
  _t4$3,
7448
- _t5$2;
7541
+ _t5$2,
7542
+ _t6$1;
7449
7543
  const CLEAR_BUTTON_BOX_STYLE = {
7450
7544
  zIndex: 2
7451
7545
  };
7452
- const Root$c = styled.span(textInputRootStyle);
7546
+ const Root$c = styled(Card).attrs({
7547
+ forwardedAs: 'span'
7548
+ })(textInputRootStyle);
7453
7549
  const InputRoot = styled.span(_t$e || (_t$e = _$d`
7454
7550
  flex: 1;
7455
7551
  min-width: 0;
@@ -7485,7 +7581,12 @@ const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$d`
7485
7581
  top: 0;
7486
7582
  left: 0;
7487
7583
  `));
7488
- const RightCard = styled(Card)(_t5$2 || (_t5$2 = _$d`
7584
+ const RightBox = styled(Box)(_t5$2 || (_t5$2 = _$d`
7585
+ position: absolute;
7586
+ top: 0;
7587
+ right: 0;
7588
+ `));
7589
+ const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$d`
7489
7590
  background-color: transparent;
7490
7591
  position: absolute;
7491
7592
  top: 0;
@@ -7500,7 +7601,7 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7500
7601
  border = true,
7501
7602
  clearButton,
7502
7603
  disabled = false,
7503
- fontSize = 2,
7604
+ fontSize: fontSizeProp = 2,
7504
7605
  icon,
7505
7606
  iconRight,
7506
7607
  onClear,
@@ -7508,16 +7609,20 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7508
7609
  prefix,
7509
7610
  radius: radiusProp = 1,
7510
7611
  readOnly,
7511
- space = 3,
7612
+ space: spaceProp = 3,
7512
7613
  suffix,
7513
7614
  customValidity,
7514
- type = 'text'
7615
+ type = 'text',
7616
+ weight
7515
7617
  } = props,
7516
7618
  restProps = _objectWithoutPropertiesLoose(props, _excluded$h);
7517
7619
 
7518
7620
  const ref = useForwardedRef(forwardedRef);
7519
- const padding = useResponsiveProp(paddingProp);
7520
- const radius = useResponsiveProp(radiusProp); // Transient properties
7621
+ const rootTheme = useRootTheme();
7622
+ const fontSize = useArrayProp(fontSizeProp);
7623
+ const padding = useArrayProp(paddingProp);
7624
+ const radius = useArrayProp(radiusProp);
7625
+ const space = useArrayProp(spaceProp); // Transient properties
7521
7626
 
7522
7627
  const $hasClearButton = Boolean(clearButton);
7523
7628
  const $hasIcon = Boolean(icon);
@@ -7553,16 +7658,18 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7553
7658
  "$border": border,
7554
7659
  "$hasPrefix": $hasPrefix,
7555
7660
  "$hasSuffix": $hasSuffix,
7556
- "$radius": radius
7661
+ "$radius": radius,
7662
+ "$tone": rootTheme.tone,
7663
+ "data-tone": rootTheme.tone
7557
7664
  }, icon && /*#__PURE__*/React.createElement(LeftBox, {
7558
7665
  padding: padding
7559
7666
  }, /*#__PURE__*/React.createElement(Text, {
7560
7667
  size: fontSize
7561
- }, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(RightCard, {
7668
+ }, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(RightBox, {
7562
7669
  padding: padding
7563
7670
  }, /*#__PURE__*/React.createElement(Text, {
7564
7671
  size: fontSize
7565
- }, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
7672
+ }, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, rootTheme.tone, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
7566
7673
 
7567
7674
  const clearButtonBoxPadding = useMemo(() => padding.map(v => {
7568
7675
  if (v === 0) return 0;
@@ -7576,7 +7683,7 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7576
7683
  if (v === 2) return 1;
7577
7684
  return v - 1;
7578
7685
  }), [padding]);
7579
- const clearButtonProps = useMemo(() => typeof clearButton === 'object' ? clearButton : EMPTY_RECORD$1, [clearButton]);
7686
+ const clearButtonProps = useMemo(() => typeof clearButton === 'object' ? clearButton : EMPTY_RECORD, [clearButton]);
7580
7687
  const clearButtonNode = useMemo(() => !disabled && !readOnly && clearButton && /*#__PURE__*/React.createElement(RightCard, {
7581
7688
  forwardedAs: "span",
7582
7689
  padding: clearButtonBoxPadding,
@@ -7603,15 +7710,19 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
7603
7710
  tone: "inherit"
7604
7711
  }, /*#__PURE__*/React.createElement("span", null, suffix)), [radius, suffix]);
7605
7712
  return /*#__PURE__*/React.createElement(Root$c, {
7606
- "data-ui": "TextInput"
7713
+ "data-ui": "TextInput",
7714
+ tone: rootTheme.tone
7607
7715
  }, prefixNode, /*#__PURE__*/React.createElement(InputRoot, null, /*#__PURE__*/React.createElement(Input, _extends({
7608
- "data-as": "input"
7716
+ "data-as": "input",
7717
+ "data-tone": rootTheme.tone
7609
7718
  }, restProps, {
7719
+ "$fontSize": fontSize,
7610
7720
  "$iconLeft": $hasIcon,
7611
7721
  "$iconRight": $hasIconRight || $hasClearButton,
7612
7722
  "$padding": padding,
7613
7723
  "$space": space,
7614
- "$fontSize": fontSize,
7724
+ "$tone": rootTheme.tone,
7725
+ "$weight": weight,
7615
7726
  disabled: disabled,
7616
7727
  readOnly: readOnly,
7617
7728
  ref: ref,
@@ -7713,7 +7824,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7713
7824
  children,
7714
7825
  content,
7715
7826
  disabled,
7716
- fallbackPlacements,
7827
+ fallbackPlacements: fallbackPlacementsProp,
7717
7828
  placement = 'bottom',
7718
7829
  portal,
7719
7830
  scheme,
@@ -7721,6 +7832,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
7721
7832
  } = props,
7722
7833
  restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
7723
7834
 
7835
+ const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
7724
7836
  const forwardedRef = useForwardedRef(ref);
7725
7837
  const [referenceElement, setReferenceElement] = useState(null);
7726
7838
  const [popperElement, setPopperElement] = useState(null);
@@ -7844,7 +7956,6 @@ let _$b = t => t,
7844
7956
  */
7845
7957
 
7846
7958
  const Root$9 = styled.div(_t$b || (_t$b = _$b`
7847
- /* position: relative; */
7848
7959
  line-height: 0;
7849
7960
  `));
7850
7961
  /**
@@ -7994,11 +8105,6 @@ function autocompleteReducer(state, msg) {
7994
8105
  /**
7995
8106
  * @internal
7996
8107
  */
7997
- const EMPTY_RECORD = {};
7998
- /**
7999
- * @internal
8000
- */
8001
-
8002
8108
  const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ['Control', 'Shift', 'Alt', 'Enter', 'Home', 'End', 'PageUp', 'PageDown', 'Meta', 'Tab', 'CapsLock'];
8003
8109
  /**
8004
8110
  * @internal
@@ -8092,7 +8198,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
8092
8198
  const popoverMouseWithinRef = useRef(false);
8093
8199
  const listBoxId = `${id}-listbox`;
8094
8200
  const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY;
8095
- const padding = useResponsiveProp(paddingProp);
8201
+ const padding = useArrayProp(paddingProp);
8096
8202
  const currentOption = useMemo(() => value !== null ? options.find(o => o.value === value) : undefined, [options, value]);
8097
8203
  const filteredOptions = useMemo(() => options.filter(option => query ? filterOption(query, option) : true), [filterOption, options, query]);
8098
8204
  const filteredOptionsLen = filteredOptions.length;
@@ -8409,6 +8515,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
8409
8515
  const content = useMemo(() => {
8410
8516
  if (filteredOptions.length === 0) return null;
8411
8517
  return /*#__PURE__*/React.createElement(ListBox, _extends({
8518
+ "data-ui": "AutoComplete__results",
8412
8519
  onKeyDown: handleListBoxKeyDown,
8413
8520
  padding: 1
8414
8521
  }, listBox, {
@@ -8416,6 +8523,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
8416
8523
  }), /*#__PURE__*/React.createElement(Stack, {
8417
8524
  as: "ul",
8418
8525
  "aria-multiselectable": false,
8526
+ "data-ui": "AutoComplete__resultsList",
8419
8527
  id: listBoxId,
8420
8528
  ref: listBoxElementRef,
8421
8529
  role: "listbox",
@@ -8508,10 +8616,11 @@ const Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(props, ref) {
8508
8616
  children,
8509
8617
  maxLength,
8510
8618
  separator,
8511
- space = 2
8619
+ space: spaceRaw = 2
8512
8620
  } = props,
8513
8621
  restProps = _objectWithoutPropertiesLoose(props, _excluded$e);
8514
8622
 
8623
+ const space = useArrayProp(spaceRaw);
8515
8624
  const [open, setOpen] = useState(false);
8516
8625
  const [expandElement, setExpandElement] = useState(null);
8517
8626
  const [popoverElement, setPopoverElement] = useState(null);
@@ -8595,7 +8704,7 @@ function responsiveDialogPositionStyle(props) {
8595
8704
  const {
8596
8705
  media
8597
8706
  } = theme.sanity;
8598
- return responsive(media, getResponsiveProp(props.$position), position => ({
8707
+ return _responsive(media, props.$position, position => ({
8599
8708
  '&&': {
8600
8709
  position
8601
8710
  }
@@ -8691,11 +8800,14 @@ const DialogCard = /*#__PURE__*/forwardRef(function DialogCard(props, ref) {
8691
8800
  id,
8692
8801
  onClickOutside,
8693
8802
  onClose,
8694
- radius,
8803
+ radius: radiusProp,
8695
8804
  scheme,
8696
- shadow,
8697
- width
8805
+ shadow: shadowProp,
8806
+ width: widthProp
8698
8807
  } = props;
8808
+ const radius = useArrayProp(radiusProp);
8809
+ const shadow = useArrayProp(shadowProp);
8810
+ const width = useArrayProp(widthProp);
8699
8811
  const forwardedRef = useForwardedRef(ref);
8700
8812
  const [rootElement, setRootElement] = useState(null);
8701
8813
  const localContentRef = useRef(null);
@@ -8778,7 +8890,7 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
8778
8890
  const {
8779
8891
  __unstable_autoFocus: autoFocus = true,
8780
8892
  __unstable_hideCloseButton: hideCloseButton = false,
8781
- cardRadius = 3,
8893
+ cardRadius: cardRadiusProp = 3,
8782
8894
  cardShadow = 4,
8783
8895
  children,
8784
8896
  contentRef,
@@ -8787,15 +8899,20 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
8787
8899
  id,
8788
8900
  onClickOutside,
8789
8901
  onClose,
8790
- padding = 4,
8902
+ padding: paddingProp = 4,
8791
8903
  portal,
8792
- position = dialog.position || 'fixed',
8904
+ position: positionProp = dialog.position || 'fixed',
8793
8905
  scheme,
8794
- width = 0,
8795
- zOffset = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
8906
+ width: widthProp = 0,
8907
+ zOffset: zOffsetProp = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
8796
8908
  } = props,
8797
8909
  restProps = _objectWithoutPropertiesLoose(props, _excluded$d);
8798
8910
 
8911
+ const cardRadius = useArrayProp(cardRadiusProp);
8912
+ const padding = useArrayProp(paddingProp);
8913
+ const position = useArrayProp(positionProp);
8914
+ const width = useArrayProp(widthProp);
8915
+ const zOffset = useArrayProp(zOffsetProp);
8799
8916
  const preDivRef = useRef(null);
8800
8917
  const postDivRef = useRef(null);
8801
8918
  const cardRef = useRef(null);
@@ -8901,10 +9018,12 @@ const Hotkeys = /*#__PURE__*/forwardRef(function Hotkeys(props, ref) {
8901
9018
  keys,
8902
9019
  padding,
8903
9020
  radius,
8904
- space = 1
9021
+ space: spaceProp = 1
8905
9022
  } = props,
8906
9023
  restProps = _objectWithoutPropertiesLoose(props, _excluded$c);
8907
9024
 
9025
+ const space = useArrayProp(spaceProp);
9026
+
8908
9027
  if (!keys || keys.length === 0) {
8909
9028
  return /*#__PURE__*/React.createElement(React.Fragment, null);
8910
9029
  }
@@ -9292,17 +9411,17 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
9292
9411
  const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(props, ref) {
9293
9412
  const {
9294
9413
  __unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = false,
9295
- boundaryElement,
9414
+ boundaryElement: deprecated_boundaryElement,
9296
9415
  button: buttonProp,
9297
9416
  id,
9298
9417
  menu: menuProp,
9299
9418
  onClose,
9300
- placement,
9301
- popoverScheme,
9302
- portal,
9419
+ placement: deprecated_placement,
9420
+ popoverScheme: deprecated_popoverScheme,
9421
+ portal: deprecated_portal = true,
9303
9422
  popover,
9304
- popoverRadius,
9305
- preventOverflow
9423
+ popoverRadius: deprecated_popoverRadius,
9424
+ preventOverflow: deprecated_preventOverflow
9306
9425
  } = props;
9307
9426
  const [open, setOpen] = useState(false);
9308
9427
  const [shouldFocus, setShouldFocus] = useState(null);
@@ -9424,14 +9543,14 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(props, ref) {
9424
9543
  }) : null, [buttonProp, handleButtonClick, handleButtonKeyDown, id, open, setButtonRef]);
9425
9544
  const popoverProps = useMemo(() => {
9426
9545
  return _extends({
9427
- boundaryElement,
9428
- placement,
9429
- portal,
9430
- radius: popoverRadius,
9431
- overflow: preventOverflow,
9432
- scheme: popoverScheme
9546
+ boundaryElement: deprecated_boundaryElement,
9547
+ placement: deprecated_placement,
9548
+ portal: deprecated_portal,
9549
+ radius: deprecated_popoverRadius,
9550
+ preventOverflow: deprecated_preventOverflow,
9551
+ scheme: deprecated_popoverScheme
9433
9552
  }, popover || {});
9434
- }, [boundaryElement, placement, popover, popoverRadius, portal, preventOverflow, popoverScheme]);
9553
+ }, [deprecated_boundaryElement, deprecated_preventOverflow, deprecated_placement, popover, deprecated_popoverRadius, deprecated_portal, deprecated_popoverScheme]);
9435
9554
  return /*#__PURE__*/React.createElement(Popover, _extends({}, popoverProps, {
9436
9555
  content: menu,
9437
9556
  "data-ui": "MenuButton__popover",
@@ -9564,7 +9683,7 @@ function selectableColorStyle(props) {
9564
9683
  * @internal
9565
9684
  */
9566
9685
 
9567
- const Selectable = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
9686
+ const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
9568
9687
 
9569
9688
  function useMenu() {
9570
9689
  const value = useContext(MenuContext);
@@ -9596,7 +9715,7 @@ function MenuGroup(props) {
9596
9715
  icon,
9597
9716
  onClick,
9598
9717
  padding = 3,
9599
- popover = {},
9718
+ popover,
9600
9719
  radius = 2,
9601
9720
  space = 3,
9602
9721
  text,
@@ -9694,7 +9813,7 @@ function MenuGroup(props) {
9694
9813
  "aria-pressed": as === 'button' ? withinMenu : undefined,
9695
9814
  "data-pressed": as !== 'button' ? withinMenu : undefined,
9696
9815
  "data-selected": !withinMenu && active ? '' : undefined,
9697
- "$radius": radius,
9816
+ "$radius": useArrayProp(radius),
9698
9817
  "$tone": tone,
9699
9818
  onClick: handleClick,
9700
9819
  onKeyDown: handleKeyDown,
@@ -9781,21 +9900,20 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef)
9781
9900
  setRootElement(el);
9782
9901
  }, [ref]);
9783
9902
  return /*#__PURE__*/React.createElement(Selectable, _extends({
9784
- "data-as": as,
9785
- "data-ui": "MenuItem",
9786
- forwardedAs: as
9903
+ "data-ui": "MenuItem"
9787
9904
  }, restProps, {
9788
9905
  "aria-pressed": as === 'button' && pressed,
9789
9906
  "data-pressed": as !== 'button' && pressed ? '' : undefined,
9790
9907
  "data-selected": active ? '' : undefined,
9791
9908
  "data-disabled": disabled ? '' : undefined,
9792
- "$radius": radius,
9909
+ forwardedAs: as,
9910
+ "$radius": useArrayProp(radius),
9911
+ "$padding": useArrayProp(0),
9793
9912
  "$tone": tone,
9794
9913
  disabled: disabled,
9795
9914
  onClick: handleClick,
9796
9915
  onMouseEnter: onItemMouseEnter,
9797
9916
  onMouseLeave: onItemMouseLeave,
9798
- padding: 0,
9799
9917
  ref: setRef,
9800
9918
  role: "menuitem",
9801
9919
  tabIndex: -1,
@@ -9913,7 +10031,7 @@ const Skeleton = /*#__PURE__*/forwardRef(function Skeleton(props, ref) {
9913
10031
  }, [delay]);
9914
10032
  return /*#__PURE__*/React.createElement(Root$4, _extends({}, restProps, {
9915
10033
  "$animated": animated,
9916
- "$radius": radius,
10034
+ "$radius": useArrayProp(radius),
9917
10035
  "$visible": visible,
9918
10036
  ref: ref
9919
10037
  }));
@@ -9932,13 +10050,15 @@ const Root$3 = styled(Skeleton)(({
9932
10050
  media
9933
10051
  } = theme.sanity;
9934
10052
  const font = theme.sanity.fonts[$style];
9935
- const styles = responsive(media, $size, sizeIndex => {
10053
+
10054
+ const styles = _responsive(media, $size, sizeIndex => {
9936
10055
  const fontSize = font.sizes[sizeIndex];
9937
10056
  const capHeight = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight;
9938
10057
  return {
9939
10058
  height: capHeight
9940
10059
  };
9941
10060
  });
10061
+
9942
10062
  return styles;
9943
10063
  });
9944
10064
  /**
@@ -9952,7 +10072,7 @@ const TextSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
9952
10072
  } = props,
9953
10073
  restProps = _objectWithoutPropertiesLoose(props, _excluded$7);
9954
10074
 
9955
- const $size = useResponsiveProp(size);
10075
+ const $size = useArrayProp(size);
9956
10076
  return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
9957
10077
  "$size": $size,
9958
10078
  ref: ref,
@@ -9970,7 +10090,7 @@ const LabelSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref)
9970
10090
  } = props,
9971
10091
  restProps = _objectWithoutPropertiesLoose(props, _excluded2);
9972
10092
 
9973
- const $size = useResponsiveProp(size);
10093
+ const $size = useArrayProp(size);
9974
10094
  return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
9975
10095
  "$size": $size,
9976
10096
  ref: ref,
@@ -9988,7 +10108,7 @@ const HeadingSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref
9988
10108
  } = props,
9989
10109
  restProps = _objectWithoutPropertiesLoose(props, _excluded3);
9990
10110
 
9991
- const $size = useResponsiveProp(size);
10111
+ const $size = useArrayProp(size);
9992
10112
  return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
9993
10113
  "$size": $size,
9994
10114
  ref: ref,
@@ -10006,7 +10126,7 @@ const CodeSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
10006
10126
  } = props,
10007
10127
  restProps = _objectWithoutPropertiesLoose(props, _excluded4);
10008
10128
 
10009
- const $size = useResponsiveProp(size);
10129
+ const $size = useArrayProp(size);
10010
10130
  return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
10011
10131
  "$size": $size,
10012
10132
  ref: ref,
@@ -10958,5 +11078,5 @@ const TreeItem = /*#__PURE__*/memo(function TreeItem(props) {
10958
11078
  }, children)));
10959
11079
  });
10960
11080
 
10961
- 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 };
10962
- //# sourceMappingURL=sanity-ui.modern.js.map
11081
+ 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 };
11082
+ //# sourceMappingURL=sanity-ui.modern.mjs.map