@sanity/ui 2.15.8 → 2.15.9

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 (262) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +134 -134
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +134 -134
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/_visual-editing.d.mts +1 -1
  6. package/dist/_visual-editing.d.ts +1 -1
  7. package/dist/index.d.mts +1 -1
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +48 -48
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +48 -49
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/theme.js +431 -40
  14. package/dist/theme.js.map +1 -1
  15. package/dist/theme.mjs +393 -4
  16. package/dist/theme.mjs.map +1 -1
  17. package/exports/_visual-editing.ts +15 -15
  18. package/package.json +31 -27
  19. package/src/core/_compat.ts +11 -11
  20. package/src/core/components/autocomplete/__mocks__/apiStore.ts +1 -1
  21. package/src/core/components/autocomplete/__workshop__/async.tsx +1 -0
  22. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -1
  23. package/src/core/components/autocomplete/__workshop__/custom.tsx +2 -1
  24. package/src/core/components/autocomplete/__workshop__/example.tsx +2 -1
  25. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -0
  26. package/src/core/components/autocomplete/autocomplete.styles.tsx +2 -1
  27. package/src/core/components/autocomplete/autocomplete.tsx +3 -2
  28. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -0
  29. package/src/core/components/breadcrumbs/__workshop__/example.tsx +7 -0
  30. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +1 -0
  31. package/src/core/components/breadcrumbs/breadcrumbs.tsx +1 -0
  32. package/src/core/components/dialog/__workshop__/activate.tsx +2 -1
  33. package/src/core/components/dialog/__workshop__/panes.tsx +1 -0
  34. package/src/core/components/dialog/__workshop__/position.tsx +1 -0
  35. package/src/core/components/dialog/__workshop__/props.tsx +1 -0
  36. package/src/core/components/dialog/__workshop__/wrapped.tsx +1 -3
  37. package/src/core/components/dialog/dialog.tsx +3 -0
  38. package/src/core/components/dialog/dialogProvider.tsx +1 -0
  39. package/src/core/components/dialog/styles.ts +1 -0
  40. package/src/core/components/dialog/useDialog.ts +1 -0
  41. package/src/core/components/hotkeys/hotkeys.tsx +1 -0
  42. package/src/core/components/menu/__workshop__/asComponent.tsx +1 -0
  43. package/src/core/components/menu/__workshop__/avatarMenu.tsx +1 -0
  44. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +1 -0
  45. package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -0
  46. package/src/core/components/menu/__workshop__/menuButton.tsx +1 -0
  47. package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -0
  48. package/src/core/components/menu/__workshop__/tones.tsx +1 -0
  49. package/src/core/components/menu/menu.test.tsx +1 -0
  50. package/src/core/components/menu/menu.tsx +1 -0
  51. package/src/core/components/menu/menuButton.tsx +4 -3
  52. package/src/core/components/menu/menuGroup.tsx +1 -0
  53. package/src/core/components/menu/menuItem.tsx +1 -1
  54. package/src/core/components/menu/useMenu.ts +1 -0
  55. package/src/core/components/menu/useMenuController.ts +1 -0
  56. package/src/core/components/skeleton/__workshop__/delay.tsx +1 -0
  57. package/src/core/components/skeleton/__workshop__/skeleton.tsx +1 -0
  58. package/src/core/components/skeleton/skeleton.tsx +2 -2
  59. package/src/core/components/skeleton/textSkeleton.tsx +3 -2
  60. package/src/core/components/tab/tab.tsx +1 -0
  61. package/src/core/components/tab/tabList.tsx +2 -1
  62. package/src/core/components/tab/tabPanel.tsx +1 -0
  63. package/src/core/components/toast/__workshop__/toast.tsx +1 -0
  64. package/src/core/components/toast/styles.ts +2 -1
  65. package/src/core/components/toast/toast.tsx +4 -4
  66. package/src/core/components/toast/toastLayer.tsx +1 -0
  67. package/src/core/components/toast/toastProvider.tsx +1 -0
  68. package/src/core/components/toast/useToast.ts +1 -0
  69. package/src/core/components/tree/__workshop__/basic.tsx +1 -0
  70. package/src/core/components/tree/__workshop__/tabFromElement.tsx +2 -1
  71. package/src/core/components/tree/style.ts +1 -0
  72. package/src/core/components/tree/tree.tsx +1 -0
  73. package/src/core/components/tree/treeGroup.tsx +1 -0
  74. package/src/core/components/tree/treeItem.tsx +3 -2
  75. package/src/core/components/tree/useTree.ts +1 -0
  76. package/src/core/helpers/focus.ts +2 -2
  77. package/src/core/hooks/useArrayProp.ts +1 -0
  78. package/src/core/hooks/useClickOutside.test.tsx +0 -1
  79. package/src/core/hooks/useClickOutside.ts +1 -0
  80. package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -1
  81. package/src/core/hooks/useClickOutsideEvent.ts +1 -0
  82. package/src/core/hooks/useDelayed.test.ts +2 -1
  83. package/src/core/hooks/useDelayedState.ts +1 -2
  84. package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -0
  85. package/src/core/hooks/useElementSize.ts +2 -1
  86. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +2 -1
  87. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +1 -0
  88. package/src/core/hooks/usePrefersDark.test.tsx +2 -1
  89. package/src/core/hooks/usePrefersReducedMotion.test.tsx +2 -1
  90. package/src/core/index.ts +1 -2
  91. package/src/core/lib/createGlobalScopedContext.ts +2 -1
  92. package/src/core/primitives/_selectable/selectable.tsx +1 -0
  93. package/src/core/primitives/_selectable/style.ts +1 -0
  94. package/src/core/primitives/avatar/__workshop__/asButton.tsx +1 -0
  95. package/src/core/primitives/avatar/__workshop__/stack.tsx +1 -0
  96. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -0
  97. package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +1 -0
  98. package/src/core/primitives/avatar/avatar.tsx +2 -7
  99. package/src/core/primitives/avatar/avatarCounter.tsx +3 -2
  100. package/src/core/primitives/avatar/avatarStack.tsx +3 -2
  101. package/src/core/primitives/avatar/styles.ts +2 -1
  102. package/src/core/primitives/avatar/types.ts +1 -0
  103. package/src/core/primitives/badge/__workshop__/props.tsx +1 -0
  104. package/src/core/primitives/badge/__workshop__/tones.tsx +1 -0
  105. package/src/core/primitives/badge/badge.test.tsx +1 -0
  106. package/src/core/primitives/badge/badge.tsx +1 -0
  107. package/src/core/primitives/badge/styles.ts +1 -0
  108. package/src/core/primitives/box/__workshop__/props.tsx +1 -0
  109. package/src/core/primitives/box/box.tsx +3 -2
  110. package/src/core/primitives/button/__workshop__/custom.tsx +3 -0
  111. package/src/core/primitives/button/__workshop__/disabled.tsx +1 -0
  112. package/src/core/primitives/button/__workshop__/props.tsx +2 -1
  113. package/src/core/primitives/button/__workshop__/stacked.tsx +1 -0
  114. package/src/core/primitives/button/button.test.tsx +1 -0
  115. package/src/core/primitives/button/button.tsx +1 -0
  116. package/src/core/primitives/button/styles.ts +1 -0
  117. package/src/core/primitives/card/__workshop__/asButton.tsx +1 -0
  118. package/src/core/primitives/card/__workshop__/listNavigation.tsx +1 -0
  119. package/src/core/primitives/card/__workshop__/props.tsx +3 -1
  120. package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
  121. package/src/core/primitives/card/card.tsx +1 -0
  122. package/src/core/primitives/card/styles.ts +1 -0
  123. package/src/core/primitives/checkbox/checkbox.tsx +1 -0
  124. package/src/core/primitives/checkbox/styles.ts +1 -0
  125. package/src/core/primitives/code/__workshop__/props.tsx +1 -0
  126. package/src/core/primitives/code/code.tsx +2 -1
  127. package/src/core/primitives/container/__workshop__/example.tsx +1 -0
  128. package/src/core/primitives/container/container.tsx +1 -0
  129. package/src/core/primitives/container/styles.ts +2 -1
  130. package/src/core/primitives/flex/__workshop__/example.tsx +1 -0
  131. package/src/core/primitives/flex/flex.tsx +2 -1
  132. package/src/core/primitives/grid/grid.tsx +1 -0
  133. package/src/core/primitives/heading/__workshop__/plain.tsx +2 -1
  134. package/src/core/primitives/heading/heading.tsx +1 -0
  135. package/src/core/primitives/heading/styles.ts +1 -0
  136. package/src/core/primitives/inline/__workshop__/plain.tsx +1 -0
  137. package/src/core/primitives/inline/inline.tsx +2 -1
  138. package/src/core/primitives/inline/styles.ts +2 -1
  139. package/src/core/primitives/kbd/kbd.tsx +2 -1
  140. package/src/core/primitives/label/__workshop__/plain.tsx +2 -1
  141. package/src/core/primitives/label/label.tsx +1 -0
  142. package/src/core/primitives/label/styles.ts +1 -0
  143. package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +1 -0
  144. package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +1 -0
  145. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +1 -0
  146. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +4 -1
  147. package/src/core/primitives/popover/__workshop__/TestStory.tsx +1 -0
  148. package/src/core/primitives/popover/floating-ui/size.ts +2 -1
  149. package/src/core/primitives/popover/popover.tsx +6 -7
  150. package/src/core/primitives/popover/popoverCard.tsx +2 -1
  151. package/src/core/primitives/radio/radio.tsx +2 -1
  152. package/src/core/primitives/radio/styles.ts +1 -0
  153. package/src/core/primitives/select/select.tsx +2 -1
  154. package/src/core/primitives/select/styles.ts +3 -3
  155. package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -0
  156. package/src/core/primitives/spinner/spinner.tsx +2 -1
  157. package/src/core/primitives/stack/__workshop__/plain.tsx +1 -0
  158. package/src/core/primitives/stack/stack.tsx +2 -1
  159. package/src/core/primitives/stack/styles.ts +2 -1
  160. package/src/core/primitives/switch/styles.ts +1 -0
  161. package/src/core/primitives/switch/switch.tsx +2 -1
  162. package/src/core/primitives/text/__workshop__/colored.tsx +3 -2
  163. package/src/core/primitives/text/__workshop__/example.tsx +1 -0
  164. package/src/core/primitives/text/styles.ts +1 -0
  165. package/src/core/primitives/text/text.tsx +1 -0
  166. package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -0
  167. package/src/core/primitives/textArea/textArea.tsx +6 -5
  168. package/src/core/primitives/textInput/__workshop__/plain.tsx +2 -1
  169. package/src/core/primitives/textInput/__workshop__/typed.tsx +1 -0
  170. package/src/core/primitives/textInput/textInput.tsx +1 -0
  171. package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +1 -0
  172. package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -0
  173. package/src/core/primitives/tooltip/__workshop__/props.tsx +3 -2
  174. package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +1 -0
  175. package/src/core/primitives/tooltip/tooltip.test.tsx +4 -2
  176. package/src/core/primitives/tooltip/tooltip.tsx +6 -5
  177. package/src/core/primitives/tooltip/tooltipCard.tsx +2 -1
  178. package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +1 -1
  179. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -0
  180. package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +1 -0
  181. package/src/core/styles/border/borderStyle.ts +1 -0
  182. package/src/core/styles/box/boxStyle.ts +1 -0
  183. package/src/core/styles/card/_cardColorStyle.ts +1 -2
  184. package/src/core/styles/flex/flexItemStyle.ts +1 -0
  185. package/src/core/styles/flex/flexStyle.ts +2 -1
  186. package/src/core/styles/flex/index.ts +1 -1
  187. package/src/core/styles/flex/types.ts +1 -0
  188. package/src/core/styles/font/codeFontStyle.ts +1 -0
  189. package/src/core/styles/font/headingFontStyle.ts +1 -0
  190. package/src/core/styles/font/labelFontStyle.ts +1 -0
  191. package/src/core/styles/font/responsiveFont.ts +3 -3
  192. package/src/core/styles/font/textAlignStyle.ts +1 -0
  193. package/src/core/styles/font/textFontStyle.ts +1 -0
  194. package/src/core/styles/font/types.ts +1 -0
  195. package/src/core/styles/grid/gridItemStyle.ts +1 -0
  196. package/src/core/styles/grid/gridStyle.ts +2 -1
  197. package/src/core/styles/grid/index.ts +1 -1
  198. package/src/core/styles/helpers.ts +2 -2
  199. package/src/core/styles/input/responsiveInputPaddingStyle.ts +2 -1
  200. package/src/core/styles/input/textInputStyle.ts +3 -3
  201. package/src/core/styles/margin/marginStyle.ts +1 -0
  202. package/src/core/styles/margin/marginsStyle.test.ts +1 -0
  203. package/src/core/styles/padding/paddingStyle.test.ts +1 -0
  204. package/src/core/styles/padding/paddingStyle.ts +1 -0
  205. package/src/core/styles/radius/radiusStyle.ts +1 -0
  206. package/src/core/styles/shadow/shadowStyle.ts +3 -3
  207. package/src/core/theme/__workshop__/build/Root.tsx +1 -1
  208. package/src/core/theme/__workshop__/build/story.tsx +18 -9
  209. package/src/core/theme/__workshop__/canvas.tsx +7 -6
  210. package/src/core/theme/__workshop__/debug/story.tsx +5 -3
  211. package/src/core/theme/index.ts +1 -1
  212. package/src/core/theme/theme.test.tsx +1 -0
  213. package/src/core/theme/themeColorProvider.tsx +1 -0
  214. package/src/core/theme/themeProvider.tsx +3 -2
  215. package/src/core/theme/useRootTheme.ts +1 -0
  216. package/src/core/theme/useTheme.ts +1 -1
  217. package/src/core/utils/arrow/arrow.tsx +4 -3
  218. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +1 -0
  219. package/src/core/utils/boundaryElement/index.ts +1 -1
  220. package/src/core/utils/boundaryElement/useBoundaryElement.ts +1 -0
  221. package/src/core/utils/elementQuery/elementQuery.tsx +1 -0
  222. package/src/core/utils/errorBoundary.tsx +1 -0
  223. package/src/core/utils/layer/__workshop__/multipleRoots.tsx +1 -0
  224. package/src/core/utils/layer/__workshop__/nested.tsx +1 -0
  225. package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +1 -0
  226. package/src/core/utils/layer/index.ts +1 -1
  227. package/src/core/utils/layer/layer.tsx +1 -0
  228. package/src/core/utils/layer/layerProvider.tsx +2 -1
  229. package/src/core/utils/layer/useLayer.ts +1 -0
  230. package/src/core/utils/portal/portal.ts +1 -0
  231. package/src/core/utils/portal/portalProvider.tsx +1 -0
  232. package/src/core/utils/portal/usePortal.ts +1 -0
  233. package/src/core/utils/virtualList/virtualList.tsx +1 -0
  234. package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +1 -1
  235. package/src/theme/build/_deprecated/color/card/createCardStates.ts +1 -1
  236. package/src/theme/build/_deprecated/color/factory.ts +6 -6
  237. package/src/theme/build/buildColorTheme.ts +15 -15
  238. package/src/theme/build/colorToken/colorToken.ts +1 -1
  239. package/src/theme/build/mixThemeColor.ts +1 -1
  240. package/src/theme/build/renderColorTheme.ts +7 -6
  241. package/src/theme/build/renderColorValue.ts +3 -2
  242. package/src/theme/build/resolveColorTokens.ts +5 -4
  243. package/src/theme/config/helpers.ts +2 -2
  244. package/src/theme/config/system.ts +2 -1
  245. package/src/theme/config/tokens/color/types.ts +2 -1
  246. package/src/theme/config/tokens/types.ts +2 -1
  247. package/src/theme/config/types.ts +2 -1
  248. package/src/theme/system/color/_helpers.ts +1 -0
  249. package/src/theme/system/color/_system.ts +1 -1
  250. package/src/theme/system/color/color.ts +1 -1
  251. package/src/theme/system/index.ts +1 -2
  252. package/src/theme/system/theme.ts +2 -2
  253. package/src/theme/system/v0/color/index.ts +1 -1
  254. package/src/theme/system/v0/index.ts +1 -1
  255. package/src/theme/versioning/themeColor_v0_v2.ts +5 -5
  256. package/dist/_chunks-cjs/getTheme_v2.js +0 -397
  257. package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
  258. package/dist/_chunks-es/getTheme_v2.mjs +0 -398
  259. package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
  260. package/src/core/__workshop__/fontsPlugin.tsx +0 -76
  261. /package/src/core/components/autocomplete/{__fixtures__ → __mocks__}/countries.ts +0 -0
  262. /package/src/core/primitives/kbd/{index.tsx → index.ts} +0 -0
@@ -1,5 +1,6 @@
1
1
  import {Card, Flex, Stack, Text} from '@sanity/ui'
2
2
  import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
3
+
3
4
  import {
4
5
  WORKSHOP_CARD_AS_OPTIONS,
5
6
  WORKSHOP_CARD_TONE_OPTIONS,
@@ -39,7 +40,8 @@ export default function PropsStory() {
39
40
  <code>shadow={shadow}</code>.
40
41
  </Text>
41
42
  <Text size={1}>
42
- Text with <a>link</a>.
43
+ Text with {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
44
+ <a href="#">link</a>.
43
45
  </Text>
44
46
  <Text accent size={1}>
45
47
  Text with accent color.
@@ -1,8 +1,8 @@
1
1
  import {EditIcon, PublishIcon} from '@sanity/icons'
2
2
  import {Box, Card, Container, Flex, Inline, Stack, Text, ThemeProps, useRootTheme} from '@sanity/ui'
3
- import {ThemeColorStateToneKey, getTheme_v2} from '@sanity/ui/theme'
3
+ import {getTheme_v2, ThemeColorStateToneKey} from '@sanity/ui/theme'
4
4
  import {useBoolean} from '@sanity/ui-workshop'
5
- import {styled, css} from 'styled-components'
5
+ import {css, styled} from 'styled-components'
6
6
 
7
7
  const TextWithTone = styled(Text)<{$tone: ThemeColorStateToneKey}>((
8
8
  props: {
@@ -2,6 +2,7 @@ import {ThemeColorSchemeKey} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
3
  import {isValidElementType} from 'react-is'
4
4
  import {styled} from 'styled-components'
5
+
5
6
  import {useArrayProp} from '../../hooks'
6
7
  import {
7
8
  responsiveBorderStyle,
@@ -1,5 +1,6 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
+
3
4
  import {ThemeProps} from '../../styles'
4
5
  import {_cardColorStyle} from '../../styles/card'
5
6
  import {focusRingStyle} from '../../styles/focusRing'
@@ -1,6 +1,7 @@
1
1
  import {CheckmarkIcon, RemoveIcon} from '@sanity/icons'
2
2
  import {forwardRef, useEffect, useImperativeHandle, useRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
+
4
5
  import {useCustomValidity} from '../../hooks'
5
6
  import {checkboxBaseStyles, inputElementStyles} from './styles'
6
7
 
@@ -1,5 +1,6 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
+
3
4
  import {rem, ThemeProps} from '../../styles'
4
5
  import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
5
6
 
@@ -1,5 +1,6 @@
1
1
  import {Box, Code} from '@sanity/ui'
2
2
  import {useSelect, useText} from '@sanity/ui-workshop'
3
+
3
4
  import {
4
5
  WORKSHOP_CODE_LANGUAGE_OPTIONS,
5
6
  WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
@@ -1,5 +1,6 @@
1
- import {forwardRef, Suspense, lazy} from 'react'
1
+ import {forwardRef, lazy, Suspense} from 'react'
2
2
  import {styled} from 'styled-components'
3
+
3
4
  import {useArrayProp} from '../../hooks'
4
5
  import {responsiveCodeFontStyle, ResponsiveFontStyleProps} from '../../styles/internal'
5
6
  import {codeBaseStyle} from './styles'
@@ -1,5 +1,6 @@
1
1
  import {Card, Container, Flex, Text} from '@sanity/ui'
2
2
  import {useAction, useSelect} from '@sanity/ui-workshop'
3
+
3
4
  import {WORKSHOP_CONTAINER_WIDTH_OPTIONS} from '../../../__workshop__/constants'
4
5
 
5
6
  export default function PlainStory() {
@@ -1,5 +1,6 @@
1
1
  import {forwardRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
+
3
4
  import {useArrayProp} from '../../hooks'
4
5
  import {Box, BoxProps} from '../box'
5
6
  import {ResponsiveWidthProps} from '../types'
@@ -1,5 +1,6 @@
1
1
  import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
2
- import {rem, _responsive, ThemeProps} from '../../styles'
2
+
3
+ import {_responsive, rem, ThemeProps} from '../../styles'
3
4
  import {ResponsiveWidthStyleProps} from './types'
4
5
 
5
6
  const BASE_STYLE: CSSObject = {
@@ -1,6 +1,7 @@
1
1
  import {Card, Code, Flex} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
3
  import {styled} from 'styled-components'
4
+
4
5
  import {WORKSHOP_FLEX_DIRECTION_OPTIONS} from '../../../__workshop__/constants'
5
6
 
6
7
  const DebugCard = styled(Card)`
@@ -1,5 +1,6 @@
1
1
  import {forwardRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
+
3
4
  import {useArrayProp} from '../../hooks'
4
5
  import {
5
6
  flexItemStyle,
@@ -8,7 +9,7 @@ import {
8
9
  ResponsiveFlexStyleProps,
9
10
  } from '../../styles/internal'
10
11
  import {Box, BoxProps} from '../box'
11
- import {ResponsiveFlexProps, ResponsiveFlexItemProps} from '../types'
12
+ import {ResponsiveFlexItemProps, ResponsiveFlexProps} from '../types'
12
13
 
13
14
  /**
14
15
  * @public
@@ -1,5 +1,6 @@
1
1
  import {forwardRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
+
3
4
  import {useArrayProp} from '../../hooks'
4
5
  import {responsiveGridStyle, ResponsiveGridStyleProps} from '../../styles/internal'
5
6
  import {Box, BoxProps} from '../box'
@@ -1,8 +1,9 @@
1
1
  import {Flex, Heading} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
+
3
4
  import {
4
- WORKSHOP_HEADING_FONT_SIZE_OPTIONS,
5
5
  WORKSHOP_FONT_WEIGHT_OPTIONS,
6
+ WORKSHOP_HEADING_FONT_SIZE_OPTIONS,
6
7
  WORKSHOP_TEXT_OVERFLOW_OPTIONS,
7
8
  } from '../../../__workshop__/constants'
8
9
 
@@ -1,6 +1,7 @@
1
1
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
+
4
5
  import {useArrayProp} from '../../hooks'
5
6
  import {
6
7
  ResponsiveFontStyleProps,
@@ -1,5 +1,6 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
+
3
4
  import {ThemeProps} from '../../styles'
4
5
  import {HeadingStyleProps} from './types'
5
6
 
@@ -1,5 +1,6 @@
1
1
  import {Card, Flex, Inline, Text} from '@sanity/ui'
2
2
  import {useAction, useSelect} from '@sanity/ui-workshop'
3
+
3
4
  import {WORKSHOP_SPACE_OPTIONS} from '../../../__workshop__/constants'
4
5
 
5
6
  export default function PlainStory() {
@@ -1,5 +1,6 @@
1
- import {forwardRef, useMemo, Children} from 'react'
1
+ import {Children, forwardRef, useMemo} from 'react'
2
2
  import {styled} from 'styled-components'
3
+
3
4
  import {useArrayProp} from '../../hooks'
4
5
  import {Box, BoxProps} from '../box'
5
6
  import {inlineBaseStyle, inlineSpaceStyle} from './styles'
@@ -1,5 +1,6 @@
1
1
  import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
2
- import {rem, _responsive, ThemeProps} from '../../styles'
2
+
3
+ import {_responsive, rem, ThemeProps} from '../../styles'
3
4
  import {ResponsiveInlineSpaceStyleProps} from './types'
4
5
 
5
6
  export function inlineBaseStyle(): CSSObject {
@@ -1,5 +1,6 @@
1
1
  import {forwardRef} from 'react'
2
- import {styled, css} from 'styled-components'
2
+ import {css, styled} from 'styled-components'
3
+
3
4
  import {useArrayProp} from '../../hooks'
4
5
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
5
6
  import {Radius} from '../../types'
@@ -1,8 +1,9 @@
1
1
  import {Flex, Label} from '@sanity/ui'
2
2
  import {useSelect, useText} from '@sanity/ui-workshop'
3
+
3
4
  import {
4
- WORKSHOP_LABEL_FONT_SIZE_OPTIONS,
5
5
  WORKSHOP_FONT_WEIGHT_OPTIONS,
6
+ WORKSHOP_LABEL_FONT_SIZE_OPTIONS,
6
7
  WORKSHOP_TEXT_OVERFLOW_OPTIONS,
7
8
  } from '../../../__workshop__/constants'
8
9
 
@@ -1,6 +1,7 @@
1
1
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
+
4
5
  import {useArrayProp} from '../../hooks'
5
6
  import {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
6
7
  import {TextAlign} from '../../types'
@@ -1,5 +1,6 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
+
3
4
  import {ThemeProps} from '../../styles'
4
5
 
5
6
  export function labelBaseStyle(
@@ -2,6 +2,7 @@ import {EllipsisVerticalIcon} from '@sanity/icons'
2
2
  import {Button, Card, Flex, Popover, Text, useClickOutsideEvent} from '@sanity/ui'
3
3
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
4
4
  import {useCallback, useRef, useState} from 'react'
5
+
5
6
  import {
6
7
  WORKSHOP_FLEX_ALIGN_OPTIONS,
7
8
  WORKSHOP_FLEX_JUSTIFY_OPTIONS,
@@ -1,5 +1,6 @@
1
1
  import {Box, Button, Container, Flex, Popover, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
+
3
4
  import {WORKSHOP_PLACEMENT_OPTIONS} from '../../../__workshop__/constants'
4
5
 
5
6
  export default function MatchReferenceWidthStory() {
@@ -1,6 +1,7 @@
1
1
  import {Button, Card, Popover, PortalProvider, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
3
  import {useState} from 'react'
4
+
4
5
  import {
5
6
  WORKSHOP_CONTAINER_WIDTH_OPTIONS,
6
7
  WORKSHOP_PLACEMENT_OPTIONS,
@@ -1,12 +1,14 @@
1
1
  import {useSelect} from '@sanity/ui-workshop'
2
2
  import {useCallback, useEffect, useRef, useState} from 'react'
3
+
3
4
  import {BoundaryElementProvider} from '../../../utils'
4
5
  import {Box} from '../../box'
5
6
  import {Card} from '../../card'
6
7
  import {Flex} from '../../flex'
7
8
  import {Stack} from '../../stack'
8
9
  import {Text} from '../../text'
9
- import {Popover, PopoverProps, PopoverUpdateCallback} from '../popover'
10
+ import {Popover, PopoverProps} from '../popover'
11
+ import {PopoverUpdateCallback} from '../types'
10
12
 
11
13
  const SIDE_PANEL_WIDTH = {
12
14
  sm: 300,
@@ -80,6 +82,7 @@ function InlineObject(props: {updateRef?: PopoverProps['updateRef']}) {
80
82
  width={0}
81
83
  updateRef={updateRef}
82
84
  >
85
+ {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions */}
83
86
  <code onClick={handleClick}>reference</code>
84
87
  </Popover>
85
88
  )
@@ -1,5 +1,6 @@
1
1
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
2
2
  import {useRef, useState} from 'react'
3
+
3
4
  import {
4
5
  WORKSHOP_CONTAINER_WIDTH_OPTIONS,
5
6
  WORKSHOP_PLACEMENT_OPTIONS,
@@ -1,4 +1,5 @@
1
- import {Elements, Middleware, detectOverflow} from '@floating-ui/react-dom'
1
+ import {detectOverflow, Elements, Middleware} from '@floating-ui/react-dom'
2
+
2
3
  import {PopoverMargins} from '../../../types'
3
4
 
4
5
  export interface SizeMiddlewareApplyOptions {
@@ -1,28 +1,29 @@
1
1
  import {
2
- Middleware,
3
- RootBoundary,
4
2
  arrow,
5
3
  autoUpdate,
6
4
  flip,
7
5
  hide,
6
+ Middleware,
8
7
  offset,
8
+ RootBoundary,
9
9
  shift,
10
10
  useFloating,
11
11
  } from '@floating-ui/react-dom'
12
12
  import {ThemeColorSchemeKey} from '@sanity/ui/theme'
13
13
  import {AnimatePresence} from 'framer-motion'
14
14
  import {
15
- MutableRefObject,
16
- RefCallback,
17
15
  cloneElement,
18
16
  forwardRef,
19
17
  memo,
18
+ MutableRefObject,
19
+ RefCallback,
20
20
  useCallback,
21
21
  useEffect,
22
22
  useImperativeHandle,
23
23
  useMemo,
24
24
  useRef,
25
25
  } from 'react'
26
+
26
27
  import {useArrayProp, useElementSize, useMediaIndex, usePrefersReducedMotion} from '../../hooks'
27
28
  import {origin} from '../../middleware/origin'
28
29
  import {useTheme_v2} from '../../theme'
@@ -31,9 +32,9 @@ import {LayerProps, LayerProvider, Portal, useBoundaryElement, useLayer} from '.
31
32
  import {getElementRef} from '../../utils/getElementRef'
32
33
  import {ResponsiveRadiusProps, ResponsiveShadowProps} from '../types'
33
34
  import {
35
+ DEFAULT_FALLBACK_PLACEMENTS,
34
36
  DEFAULT_POPOVER_DISTANCE,
35
37
  DEFAULT_POPOVER_MARGINS,
36
- DEFAULT_FALLBACK_PLACEMENTS,
37
38
  DEFAULT_POPOVER_PADDING,
38
39
  } from './constants'
39
40
  import {size} from './floating-ui/size'
@@ -41,8 +42,6 @@ import {calcCurrentWidth, calcMaxWidth} from './helpers'
41
42
  import {PopoverCard} from './popoverCard'
42
43
  import {PopoverUpdateCallback, PopoverWidth} from './types'
43
44
 
44
- export type {PopoverUpdateCallback}
45
-
46
45
  /** @public */
47
46
  export interface PopoverProps
48
47
  extends Omit<LayerProps, 'as'>,
@@ -1,8 +1,9 @@
1
1
  import {Strategy} from '@floating-ui/react-dom'
2
2
  import {ThemeColorSchemeKey} from '@sanity/ui/theme'
3
- import {type MotionProps, motion} from 'framer-motion'
3
+ import {motion, type MotionProps} from 'framer-motion'
4
4
  import React, {CSSProperties, forwardRef, memo, useMemo} from 'react'
5
5
  import {styled} from 'styled-components'
6
+
6
7
  import {POPOVER_MOTION_PROPS} from '../../constants'
7
8
  import {BoxOverflow, CardTone, Placement, PopoverMargins, Radius} from '../../types'
8
9
  import {Arrow, useLayer} from '../../utils'
@@ -1,7 +1,8 @@
1
1
  import {forwardRef, useImperativeHandle, useRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
+
3
4
  import {useCustomValidity} from '../../hooks'
4
- import {radioBaseStyle, inputElementStyle} from './styles'
5
+ import {inputElementStyle, radioBaseStyle} from './styles'
5
6
 
6
7
  /**
7
8
  * @public
@@ -1,5 +1,6 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
+
3
4
  import {rem, ThemeProps} from '../../styles'
4
5
  import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
5
6
 
@@ -1,7 +1,8 @@
1
1
  import {ChevronDownIcon} from '@sanity/icons'
2
2
  import {forwardRef, useImperativeHandle, useRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
- import {useCustomValidity, useArrayProp} from '../../hooks'
4
+
5
+ import {useArrayProp, useCustomValidity} from '../../hooks'
5
6
  import {Radius} from '../../types'
6
7
  import {Box} from '../box'
7
8
  import {Text} from '../text'
@@ -1,7 +1,7 @@
1
- import {ThemeFontSize, getTheme_v2} from '@sanity/ui/theme'
2
- import {CSSObject} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2, ThemeFontSize} from '@sanity/ui/theme'
3
2
  import {css} from 'styled-components'
4
- import {rem, _responsive, ThemeProps} from '../../styles'
3
+
4
+ import {_responsive, rem, ThemeProps} from '../../styles'
5
5
  import {
6
6
  focusRingBorderStyle,
7
7
  focusRingStyle,
@@ -1,5 +1,6 @@
1
1
  import {Flex, Spinner} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
+
3
4
  import {WORKSHOP_TEXT_SIZE_OPTIONS} from '../../../__workshop__/constants'
4
5
 
5
6
  export default function Props() {
@@ -1,6 +1,7 @@
1
1
  import {SpinnerIcon} from '@sanity/icons'
2
2
  import {forwardRef} from 'react'
3
- import {styled, keyframes} from 'styled-components'
3
+ import {keyframes, styled} from 'styled-components'
4
+
4
5
  import {Text} from '../text'
5
6
 
6
7
  /**
@@ -1,5 +1,6 @@
1
1
  import {Card, Container, Flex, Stack, Text} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
+
3
4
  import {WORKSHOP_SPACE_OPTIONS} from '../../../__workshop__/constants'
4
5
 
5
6
  export default function PlainStory() {
@@ -1,8 +1,9 @@
1
1
  import {forwardRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
+
3
4
  import {useArrayProp} from '../../hooks'
4
5
  import {Box, BoxProps} from '../box'
5
- import {stackBaseStyle, responsiveStackSpaceStyle, ResponsiveStackSpaceStyleProps} from './styles'
6
+ import {responsiveStackSpaceStyle, ResponsiveStackSpaceStyleProps, stackBaseStyle} from './styles'
6
7
 
7
8
  /**
8
9
  * @public
@@ -1,5 +1,6 @@
1
1
  import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
2
- import {rem, _responsive, ThemeProps} from '../../styles'
2
+
3
+ import {_responsive, rem, ThemeProps} from '../../styles'
3
4
 
4
5
  export interface ResponsiveStackSpaceStyleProps {
5
6
  $space: number[]
@@ -1,5 +1,6 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
+
3
4
  import {rem, ThemeProps} from '../../styles'
4
5
  import {focusRingStyle} from '../../styles/internal'
5
6
 
@@ -1,11 +1,12 @@
1
1
  import {forwardRef, useEffect, useImperativeHandle, useRef} from 'react'
2
2
  import {styled} from 'styled-components'
3
+
3
4
  import {
4
5
  switchBaseStyles,
6
+ switchInputStyles,
5
7
  switchRepresentationStyles,
6
8
  switchThumbStyles,
7
9
  switchTrackStyles,
8
- switchInputStyles,
9
10
  } from './styles'
10
11
 
11
12
  /**
@@ -1,7 +1,8 @@
1
1
  import {Flex, Text, ThemeProps} from '@sanity/ui'
2
- import {ThemeColorAvatarColorKey, ThemeColorSpotKey, getTheme_v2} from '@sanity/ui/theme'
2
+ import {getTheme_v2, ThemeColorAvatarColorKey, ThemeColorSpotKey} from '@sanity/ui/theme'
3
3
  import {useSelect} from '@sanity/ui-workshop'
4
- import {styled, css} from 'styled-components'
4
+ import {css, styled} from 'styled-components'
5
+
5
6
  import {WORKSHOP_SPOT_COLOR_OPTIONS} from '../../../__workshop__/constants'
6
7
 
7
8
  const ColoredText = styled(Text)<{$color?: ThemeColorSpotKey}>((
@@ -1,5 +1,6 @@
1
1
  import {Container, Flex, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
+
3
4
  import {
4
5
  WORKSHOP_TEXT_ALIGN_OPTIONS,
5
6
  WORKSHOP_TEXT_OVERFLOW_OPTIONS,
@@ -1,5 +1,6 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
+
3
4
  import {ThemeProps} from '../../styles'
4
5
 
5
6
  export function textBaseStyle(
@@ -1,6 +1,7 @@
1
1
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
+
4
5
  import {useArrayProp} from '../../hooks'
5
6
  import {
6
7
  ResponsiveFontStyleProps,
@@ -1,5 +1,6 @@
1
1
  import {Card, Container, Flex, Stack, Text, TextArea} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
+
3
4
  import {
4
5
  WORKSHOP_CARD_TONE_OPTIONS,
5
6
  WORKSHOP_FONT_WEIGHT_OPTIONS,
@@ -1,18 +1,19 @@
1
1
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
2
  import {forwardRef, useImperativeHandle, useRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
- import {useCustomValidity, useArrayProp} from '../../hooks'
4
+
5
+ import {useArrayProp, useCustomValidity} from '../../hooks'
5
6
  import {
6
7
  responsiveInputPaddingStyle,
7
8
  responsiveRadiusStyle,
8
9
  ResponsiveRadiusStyleProps,
9
- TextInputResponsivePaddingStyleProps,
10
- TextInputInputStyleProps,
11
- TextInputRepresentationStyleProps,
12
- textInputRootStyle,
13
10
  textInputBaseStyle,
14
11
  textInputFontSizeStyle,
12
+ TextInputInputStyleProps,
15
13
  textInputRepresentationStyle,
14
+ TextInputRepresentationStyleProps,
15
+ TextInputResponsivePaddingStyleProps,
16
+ textInputRootStyle,
16
17
  } from '../../styles/internal'
17
18
  import {useRootTheme} from '../../theme'
18
19
  import {ResponsiveRadiusProps} from '../types'
@@ -4,12 +4,13 @@ import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
4
4
  import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
5
5
  import {fireEvent} from '@testing-library/dom'
6
6
  import {useCallback, useState} from 'react'
7
+
7
8
  import {
8
- WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
9
9
  WORKSHOP_FONT_WEIGHT_OPTIONS,
10
10
  WORKSHOP_ICON_SYMBOL_OPTIONS,
11
11
  WORKSHOP_RADIUS_OPTIONS,
12
12
  WORKSHOP_SPACE_OPTIONS,
13
+ WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
13
14
  } from '../../../__workshop__/constants'
14
15
 
15
16
  const typingPerfTest: PerfTestProps<HTMLInputElement> = {
@@ -1,6 +1,7 @@
1
1
  import {Box, Container, TextInput} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
3
  import {useCallback, useState} from 'react'
4
+
4
5
  import {WORKSHOP_TEXT_INPUT_TYPE_OPTIONS} from '../../../__workshop__/constants'
5
6
 
6
7
  export default function TypedStory() {
@@ -3,6 +3,7 @@ import {ThemeFontWeightKey} from '@sanity/ui/theme'
3
3
  import {forwardRef, isValidElement, useCallback, useImperativeHandle, useMemo, useRef} from 'react'
4
4
  import {isValidElementType} from 'react-is'
5
5
  import {styled} from 'styled-components'
6
+
6
7
  import {EMPTY_RECORD} from '../../constants'
7
8
  import {useArrayProp, useCustomValidity} from '../../hooks'
8
9
  import {
@@ -11,6 +11,7 @@ import {
11
11
  } from '@sanity/ui'
12
12
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
13
13
  import {useMemo, useState} from 'react'
14
+
14
15
  import {WORKSHOP_PLACEMENT_OPTIONS} from '../../../__workshop__/constants'
15
16
 
16
17
  const PORTAL_OPTIONS = {
@@ -1,6 +1,7 @@
1
1
  import {BoundaryElementProvider, Button, Card, Code, Flex, Stack, Text, Tooltip} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
3
  import {useCallback, useState} from 'react'
4
+
4
5
  import {WORKSHOP_PLACEMENT_OPTIONS} from '../../../__workshop__/constants'
5
6
 
6
7
  export default function OverflowingBoundaryStory() {
@@ -1,5 +1,6 @@
1
- import {Button, Card, Flex, Text, Tooltip, TooltipDelayGroupProvider, Stack} from '@sanity/ui'
2
- import {useBoolean, useSelect, useText, useNumber} from '@sanity/ui-workshop'
1
+ import {Button, Card, Flex, Stack, Text, Tooltip, TooltipDelayGroupProvider} from '@sanity/ui'
2
+ import {useBoolean, useNumber, useSelect, useText} from '@sanity/ui-workshop'
3
+
3
4
  import {
4
5
  WORKSHOP_PLACEMENT_OPTIONS,
5
6
  WORKSHOP_SHADOW_OPTIONS,
@@ -1,6 +1,7 @@
1
1
  import {BoundaryElementProvider, Button, Card, Code, Flex, Text, Tooltip} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
3
  import {useState} from 'react'
4
+
4
5
  import {WORKSHOP_PLACEMENT_OPTIONS} from '../../../__workshop__/constants'
5
6
 
6
7
  export default function ResizableBoundaryStory() {