@sanity/ui 3.0.0-static.29 → 3.0.0-static.30

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 (232) hide show
  1. package/README.md +1 -1
  2. package/dist/_chunks-cjs/_visual-editing.cjs +293 -293
  3. package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
  4. package/dist/_chunks-es/_visual-editing.js +294 -294
  5. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  6. package/dist/css/index.cjs.map +1 -1
  7. package/dist/css/index.css +1 -1
  8. package/dist/css/index.js.map +1 -1
  9. package/dist/index.cjs +47 -37
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +12 -0
  12. package/dist/index.d.ts +12 -0
  13. package/dist/index.js +48 -38
  14. package/dist/index.js.map +1 -1
  15. package/dist/theme.cjs +6 -6
  16. package/dist/theme.cjs.map +1 -1
  17. package/dist/theme.js +6 -6
  18. package/dist/theme.js.map +1 -1
  19. package/package.json +1 -1
  20. package/src/core/components/autocomplete/autocomplete.tsx +7 -7
  21. package/src/core/components/autocomplete/constants.ts +0 -2
  22. package/src/core/components/autocomplete/types.ts +1 -1
  23. package/src/core/components/breadcrumbs/breadcrumbs.tsx +6 -6
  24. package/src/core/components/dialog/__workshop__/activate.tsx +1 -2
  25. package/src/core/components/dialog/dialog.tsx +6 -5
  26. package/src/core/components/dialog/dialogCard.tsx +8 -8
  27. package/src/core/components/hotkeys/hotkeys.tsx +2 -2
  28. package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +1 -2
  29. package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -5
  30. package/src/core/components/menu/menu.tsx +3 -3
  31. package/src/core/components/menu/menuButton.tsx +2 -2
  32. package/src/core/components/menu/menuGroup.tsx +5 -5
  33. package/src/core/components/menu/menuItem.tsx +5 -5
  34. package/src/core/components/tab/tab.tsx +1 -1
  35. package/src/core/components/tab/tabList.tsx +1 -1
  36. package/src/core/components/tab/tabPanel.tsx +1 -1
  37. package/src/core/components/toast/toast.tsx +6 -6
  38. package/src/core/components/toast/toastLayer.tsx +2 -2
  39. package/src/core/components/toast/toastProvider.tsx +1 -1
  40. package/src/core/components/tree/tree.tsx +1 -1
  41. package/src/core/components/tree/treeGroup.tsx +1 -1
  42. package/src/core/components/tree/treeItem.tsx +5 -5
  43. package/src/core/components/virtualList/virtualList.tsx +1 -1
  44. package/src/core/index.ts +95 -44
  45. package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -9
  46. package/src/core/primitives/avatar/avatar.tsx +2 -2
  47. package/src/core/primitives/avatar/avatarCounter.tsx +2 -2
  48. package/src/core/primitives/avatar/avatarStack.tsx +1 -1
  49. package/src/core/primitives/badge/badge.tsx +2 -2
  50. package/src/core/primitives/button/__workshop__/disabled.tsx +1 -7
  51. package/src/core/primitives/button/button.tsx +3 -4
  52. package/src/core/primitives/card/__workshop__/listNavigation.tsx +1 -3
  53. package/src/core/primitives/card/card.tsx +1 -1
  54. package/src/core/primitives/container/container.tsx +1 -1
  55. package/src/core/primitives/flex/flex.tsx +1 -1
  56. package/src/core/primitives/grid/grid.tsx +1 -1
  57. package/src/core/primitives/inline/inline.tsx +1 -1
  58. package/src/core/primitives/kbd/kbd.tsx +4 -4
  59. package/src/core/primitives/layer/layer.tsx +1 -1
  60. package/src/core/primitives/layer/layerCard.tsx +1 -1
  61. package/src/core/primitives/layer/layerProvider.tsx +1 -1
  62. package/src/core/primitives/popover/popover.tsx +6 -4
  63. package/src/core/primitives/popover/popoverLayer.tsx +3 -3
  64. package/src/core/primitives/root/Root.tsx +11 -16
  65. package/src/core/primitives/root/RootProvider.tsx +40 -0
  66. package/src/core/primitives/select/select.tsx +2 -2
  67. package/src/core/primitives/{_selectable → selectable}/selectable.tsx +1 -1
  68. package/src/core/primitives/spinner/spinner.tsx +1 -1
  69. package/src/core/primitives/stack/stack.tsx +1 -1
  70. package/src/core/primitives/switch/switch.tsx +1 -1
  71. package/src/core/primitives/textInput/textInput.tsx +3 -3
  72. package/src/core/primitives/tooltip/tooltip.test.tsx +2 -2
  73. package/src/core/primitives/tooltip/tooltip.tsx +6 -4
  74. package/src/core/primitives/tooltip/tooltipLayer.tsx +2 -2
  75. package/src/core/utils/errorBoundary.tsx +1 -1
  76. package/src/core/utils/portal/portal.tsx +2 -1
  77. package/src/css/components/dialog/dialog.ts +1 -1
  78. package/src/css/components/skeleton/skeleton.ts +3 -3
  79. package/src/css/components/skeleton/types.ts +3 -3
  80. package/src/css/defaultTheme.css.ts +1 -1
  81. package/src/css/index.ts +126 -69
  82. package/src/css/primitives/_input/input.ts +2 -2
  83. package/src/css/primitives/_input/types.ts +2 -2
  84. package/src/css/primitives/_selectable/selectable.ts +1 -1
  85. package/src/css/primitives/_selectable/types.ts +1 -1
  86. package/src/css/primitives/avatar/avatar.ts +1 -1
  87. package/src/css/primitives/box/box.ts +35 -35
  88. package/src/css/primitives/box/types.ts +34 -34
  89. package/src/css/primitives/button/button.css.ts +8 -8
  90. package/src/css/primitives/button/button.ts +4 -4
  91. package/src/css/primitives/button/types.ts +3 -3
  92. package/src/css/primitives/card/__workshop__/color.tsx +8 -3
  93. package/src/css/primitives/code/code.ts +3 -3
  94. package/src/css/primitives/code/types.ts +2 -2
  95. package/src/css/primitives/container/container.ts +3 -3
  96. package/src/css/primitives/heading/heading.ts +4 -4
  97. package/src/css/primitives/heading/types.ts +3 -3
  98. package/src/css/primitives/kbd/kbd.ts +1 -1
  99. package/src/css/primitives/kbd/types.ts +1 -1
  100. package/src/css/primitives/label/label.ts +4 -4
  101. package/src/css/primitives/label/types.ts +3 -3
  102. package/src/css/primitives/root/root.ts +2 -2
  103. package/src/css/primitives/root/types.ts +1 -1
  104. package/src/css/primitives/select/select.ts +1 -1
  105. package/src/css/primitives/select/types.ts +1 -1
  106. package/src/css/primitives/text/text.ts +5 -5
  107. package/src/css/primitives/text/types.ts +4 -4
  108. package/src/css/primitives/textArea/textArea.ts +1 -1
  109. package/src/css/primitives/textArea/types.ts +1 -1
  110. package/src/css/primitives/textInput/textInput.ts +1 -1
  111. package/src/css/primitives/textInput/types.ts +1 -1
  112. package/src/css/primitives/tooltip/tooltip.css.ts +1 -3
  113. package/src/css/primitives/tooltip/tooltip.ts +0 -2
  114. package/src/theme/v3/defaultTokens.ts +6 -6
  115. package/src/core/_compat/index.ts +0 -4
  116. package/src/core/_compat/styles/index.ts +0 -1
  117. package/src/core/_compat/theme/index.ts +0 -5
  118. package/src/core/components/breadcrumbs/index.ts +0 -1
  119. package/src/core/components/dialog/index.ts +0 -5
  120. package/src/core/components/hotkeys/index.ts +0 -1
  121. package/src/core/components/menu/index.ts +0 -5
  122. package/src/core/components/tab/index.ts +0 -3
  123. package/src/core/components/toast/index.ts +0 -4
  124. package/src/core/components/tree/index.ts +0 -4
  125. package/src/core/components/virtualList/index.ts +0 -1
  126. package/src/core/hooks/useElementRect/index.ts +0 -1
  127. package/src/core/hooks/useMediaIndex/index.ts +0 -1
  128. package/src/core/primitives/_selectable/index.ts +0 -2
  129. package/src/core/primitives/arrow/index.ts +0 -1
  130. package/src/core/primitives/avatar/index.ts +0 -4
  131. package/src/core/primitives/badge/index.ts +0 -1
  132. package/src/core/primitives/badge/types2.ts +0 -10
  133. package/src/core/primitives/box/index.ts +0 -2
  134. package/src/core/primitives/button/index.ts +0 -2
  135. package/src/core/primitives/card/index.ts +0 -4
  136. package/src/core/primitives/checkbox/index.ts +0 -1
  137. package/src/core/primitives/code/index.ts +0 -1
  138. package/src/core/primitives/container/index.ts +0 -2
  139. package/src/core/primitives/flex/index.ts +0 -2
  140. package/src/core/primitives/grid/index.ts +0 -2
  141. package/src/core/primitives/heading/index.ts +0 -1
  142. package/src/core/primitives/inline/index.ts +0 -1
  143. package/src/core/primitives/inline/types.ts +0 -7
  144. package/src/core/primitives/kbd/index.ts +0 -1
  145. package/src/core/primitives/label/index.ts +0 -1
  146. package/src/core/primitives/layer/index.ts +0 -4
  147. package/src/core/primitives/popover/index.ts +0 -2
  148. package/src/core/primitives/radio/index.ts +0 -1
  149. package/src/core/primitives/root/index.ts +0 -1
  150. package/src/core/primitives/select/index.ts +0 -1
  151. package/src/core/primitives/skeleton/index.ts +0 -5
  152. package/src/core/primitives/spinner/index.ts +0 -1
  153. package/src/core/primitives/srOnly/index.ts +0 -1
  154. package/src/core/primitives/stack/index.ts +0 -1
  155. package/src/core/primitives/switch/index.ts +0 -1
  156. package/src/core/primitives/text/index.ts +0 -1
  157. package/src/core/primitives/textArea/index.ts +0 -1
  158. package/src/core/primitives/textInput/index.ts +0 -1
  159. package/src/core/primitives/tooltip/index.ts +0 -2
  160. package/src/core/utils/boundaryElement/index.ts +0 -3
  161. package/src/core/utils/elementQuery/index.ts +0 -1
  162. package/src/core/utils/portal/index.ts +0 -4
  163. package/src/css/components/breadcrumbs/index.ts +0 -1
  164. package/src/css/components/dialog/index.ts +0 -1
  165. package/src/css/components/menu/index.ts +0 -1
  166. package/src/css/components/skeleton/index.ts +0 -2
  167. package/src/css/components/toast/index.ts +0 -1
  168. package/src/css/components/tree/index.ts +0 -1
  169. package/src/css/primitives/_arrow/index.ts +0 -1
  170. package/src/css/primitives/_input/index.ts +0 -2
  171. package/src/css/primitives/_selectable/index.ts +0 -2
  172. package/src/css/primitives/avatar/index.ts +0 -2
  173. package/src/css/primitives/badge/index.ts +0 -2
  174. package/src/css/primitives/box/index.ts +0 -2
  175. package/src/css/primitives/button/index.ts +0 -2
  176. package/src/css/primitives/card/index.ts +0 -2
  177. package/src/css/primitives/checkbox/index.ts +0 -1
  178. package/src/css/primitives/code/index.ts +0 -2
  179. package/src/css/primitives/container/index.ts +0 -2
  180. package/src/css/primitives/heading/index.ts +0 -2
  181. package/src/css/primitives/kbd/index.ts +0 -2
  182. package/src/css/primitives/label/index.ts +0 -2
  183. package/src/css/primitives/popover/index.ts +0 -1
  184. package/src/css/primitives/radio/index.ts +0 -1
  185. package/src/css/primitives/root/index.ts +0 -2
  186. package/src/css/primitives/select/index.ts +0 -2
  187. package/src/css/primitives/spinner/index.ts +0 -2
  188. package/src/css/primitives/srOnly/index.ts +0 -1
  189. package/src/css/primitives/stack/index.ts +0 -1
  190. package/src/css/primitives/switch/index.ts +0 -1
  191. package/src/css/primitives/text/index.ts +0 -2
  192. package/src/css/primitives/textArea/index.ts +0 -2
  193. package/src/css/primitives/textInput/index.ts +0 -2
  194. package/src/css/primitives/tooltip/index.ts +0 -2
  195. package/src/css/props/alignItems/index.ts +0 -2
  196. package/src/css/props/border/index.ts +0 -2
  197. package/src/css/props/boxSizing/index.ts +0 -2
  198. package/src/css/props/display/index.ts +0 -2
  199. package/src/css/props/flex/index.ts +0 -2
  200. package/src/css/props/flexDirection/index.ts +0 -2
  201. package/src/css/props/flexWrap/index.ts +0 -2
  202. package/src/css/props/font/index.ts +0 -2
  203. package/src/css/props/gap/index.ts +0 -2
  204. package/src/css/props/gridAutoColumns/index.ts +0 -2
  205. package/src/css/props/gridAutoFlow/index.ts +0 -2
  206. package/src/css/props/gridAutoRows/index.ts +0 -2
  207. package/src/css/props/gridColumn/index.ts +0 -2
  208. package/src/css/props/gridColumnEnd/index.ts +0 -2
  209. package/src/css/props/gridColumnStart/index.ts +0 -2
  210. package/src/css/props/gridRow/index.ts +0 -2
  211. package/src/css/props/gridRowEnd/index.ts +0 -2
  212. package/src/css/props/gridRowStart/index.ts +0 -2
  213. package/src/css/props/gridTemplateColumns/index.ts +0 -2
  214. package/src/css/props/gridTemplateRows/index.ts +0 -2
  215. package/src/css/props/height/index.ts +0 -2
  216. package/src/css/props/inset/index.ts +0 -2
  217. package/src/css/props/justifyContent/index.ts +0 -2
  218. package/src/css/props/margin/index.ts +0 -2
  219. package/src/css/props/maxWidth/index.ts +0 -2
  220. package/src/css/props/minHeight/index.ts +0 -2
  221. package/src/css/props/minWidth/index.ts +0 -2
  222. package/src/css/props/outline/index.ts +0 -2
  223. package/src/css/props/overflow/index.ts +0 -2
  224. package/src/css/props/padding/index.ts +0 -2
  225. package/src/css/props/pointerEvents/index.ts +0 -2
  226. package/src/css/props/position/index.ts +0 -2
  227. package/src/css/props/radius/index.ts +0 -2
  228. package/src/css/props/shadow/index.ts +0 -2
  229. package/src/css/props/textAlign/index.ts +0 -2
  230. package/src/css/props/textOverflow/index.ts +0 -2
  231. package/src/css/props/width/index.ts +0 -2
  232. /package/src/core/primitives/{_selectable → selectable}/types.ts +0 -0
@@ -1,6 +1,4 @@
1
- import {Box, Card, Flex, Text} from '@sanity/ui'
2
-
3
- import {Stack} from '../../stack'
1
+ import {Box, Card, Flex, Stack, Text} from '@sanity/ui'
4
2
 
5
3
  export default function ListNavigationStory() {
6
4
  return (
@@ -1,7 +1,7 @@
1
1
  import {card, type CardStyleProps} from '@sanity/ui/css'
2
2
 
3
3
  import type {Props} from '../../types/props'
4
- import {Box, type BoxElementType, type BoxOwnProps} from '../box'
4
+ import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
5
5
  import {CardProvider} from './cardProvider'
6
6
  import {useCard} from './useCard'
7
7
 
@@ -1,7 +1,7 @@
1
1
  import {container, type ContainerStyleProps} from '@sanity/ui/css'
2
2
 
3
3
  import type {Props} from '../../types/props'
4
- import {Box, type BoxElementType, type BoxOwnProps} from '../box'
4
+ import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
5
5
 
6
6
  /** @public */
7
7
  export const DEFAULT_CONTAINER_ELEMENT = 'div'
@@ -7,7 +7,7 @@ import type {
7
7
  } from '@sanity/ui/css'
8
8
 
9
9
  import type {Props} from '../../types/props'
10
- import {Box, type BoxElementType, type BoxOwnProps} from '../box'
10
+ import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
11
11
 
12
12
  /** @public */
13
13
  export const DEFAULT_FLEX_ELEMENT = 'div'
@@ -1,5 +1,5 @@
1
1
  import type {Props} from '../../types/props'
2
- import {Box, type BoxElementType, type BoxOwnProps} from '../box'
2
+ import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
3
3
 
4
4
  /** @public */
5
5
  export const DEFAULT_GRID_ELEMENT = 'div'
@@ -2,7 +2,7 @@ import type {ResponsiveProp} from '@sanity/ui/css'
2
2
  import type {Space} from '@sanity/ui/theme'
3
3
 
4
4
  import type {Props} from '../../types/props'
5
- import {Box, type BoxElementType, type BoxOwnProps} from '../box'
5
+ import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
6
6
 
7
7
  /** @public */
8
8
  export const DEFAULT_INLINE_ELEMENT = 'div'
@@ -2,8 +2,8 @@ import {kbd, type RadiusStyleProps, type ResponsiveProp} from '@sanity/ui/css'
2
2
  import type {FontTextSize} from '@sanity/ui/theme'
3
3
 
4
4
  import type {ComponentType, Props} from '../../types/props'
5
- import {Box, type BoxElementType, type BoxOwnProps} from '../box'
6
- import {Text} from '../text'
5
+ import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
6
+ import {Text} from '../text/text'
7
7
 
8
8
  /** @public */
9
9
  export const DEFAULT_KBD_ELEMENT = 'kbd'
@@ -31,7 +31,7 @@ export function KBD<E extends KBDElementType = typeof DEFAULT_KBD_ELEMENT>(props
31
31
  children,
32
32
  className,
33
33
  display = 'inline-block',
34
- fontSize = 0,
34
+ fontSize = 1,
35
35
  padding = 1,
36
36
  radius = 2,
37
37
  ...rest
@@ -47,7 +47,7 @@ export function KBD<E extends KBDElementType = typeof DEFAULT_KBD_ELEMENT>(props
47
47
  muted
48
48
  padding={padding}
49
49
  >
50
- <Text as="span" muted size={fontSize} weight="semibold">
50
+ <Text as="span" muted size={fontSize} weight="medium">
51
51
  {children}
52
52
  </Text>
53
53
  </Box>
@@ -1,6 +1,6 @@
1
1
  import type {ResponsiveProp} from '@sanity/ui/css'
2
2
 
3
- import type {CardElementType, CardOwnProps} from '../../primitives/card'
3
+ import type {CardElementType, CardOwnProps} from '../../primitives/card/card'
4
4
  import type {Props} from '../../types/props'
5
5
  import {LayerCard} from './layerCard'
6
6
  import {LayerProvider} from './layerProvider'
@@ -2,7 +2,7 @@ import {type FocusEvent, useCallback, useEffect, useImperativeHandle, useRef} fr
2
2
 
3
3
  import {EMPTY_RECORD} from '../../constants'
4
4
  import {containsOrEqualsElement, isHTMLElement} from '../../helpers/element'
5
- import {Card, type CardElementType} from '../../primitives/card'
5
+ import {Card, type CardElementType} from '../../primitives/card/card'
6
6
  import type {Props} from '../../types/props'
7
7
  import type {LayerElementType, LayerOwnProps} from './layer'
8
8
  import {useLayer} from './useLayer'
@@ -9,7 +9,7 @@ import {
9
9
  useState,
10
10
  } from 'react'
11
11
 
12
- import {useMediaIndex} from '../../hooks/useMediaIndex'
12
+ import {useMediaIndex} from '../../hooks/useMediaIndex/useMediaIndex'
13
13
  import {useResponsiveProp} from '../../hooks/useResponsiveProp'
14
14
  import {getLayerContext} from './getLayerContext'
15
15
  import {LayerContext} from './layerContext'
@@ -30,10 +30,12 @@ import {useResponsiveProp} from '../../hooks/useResponsiveProp'
30
30
  import {origin} from '../../middleware/origin'
31
31
  import type {Placement} from '../../types/placement'
32
32
  import type {ComponentType, Props} from '../../types/props'
33
- import {useBoundaryElement} from '../../utils/boundaryElement'
34
- import {Portal} from '../../utils/portal'
35
- import {CardProvider, useCard} from '../card'
36
- import {type LayerOwnProps, useLayer} from '../layer'
33
+ import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
34
+ import {Portal} from '../../utils/portal/portal'
35
+ import {CardProvider} from '../card/cardProvider'
36
+ import {useCard} from '../card/useCard'
37
+ import {type LayerOwnProps} from '../layer/layer'
38
+ import {useLayer} from '../layer/useLayer'
37
39
  import {
38
40
  DEFAULT_FALLBACK_PLACEMENTS,
39
41
  DEFAULT_POPOVER_DISTANCE,
@@ -5,9 +5,9 @@ import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
5
5
 
6
6
  import {POPOVER_MOTION_PROPS} from '../../constants'
7
7
  import type {Placement} from '../../types/placement'
8
- import {Arrow} from '../arrow'
9
- import {Flex} from '../flex'
10
- import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
8
+ import {Arrow} from '../arrow/arrow'
9
+ import {Flex} from '../flex/flex'
10
+ import {Layer, type LayerOwnProps, type LayerProps} from '../layer/layer'
11
11
  import {
12
12
  DEFAULT_POPOVER_ARROW_HEIGHT,
13
13
  DEFAULT_POPOVER_ARROW_RADIUS,
@@ -1,13 +1,9 @@
1
1
  import {box, root, type RootStyleProps} from '@sanity/ui/css'
2
2
  import {useCallback, useImperativeHandle, useRef, useState} from 'react'
3
3
 
4
- import {ToastProvider} from '../../components/toast'
5
4
  import type {Props} from '../../types/props'
6
- import {BoundaryElementProvider} from '../../utils/boundaryElement'
7
- import {PortalProvider} from '../../utils/portal'
8
- import {Box, type BoxOwnProps} from '../box'
9
- import {CardProvider} from '../card'
10
- import {LayerProvider} from '../layer'
5
+ import {Box, type BoxOwnProps} from '../box/box'
6
+ import {RootProvider} from './RootProvider'
11
7
 
12
8
  /** @public */
13
9
  export const DEFAULT_ROOT_ELEMENT = 'html'
@@ -54,16 +50,15 @@ export function Root<E extends RootElementType = typeof DEFAULT_ROOT_ELEMENT>(pr
54
50
  }, [])
55
51
 
56
52
  let node = (
57
- <LayerProvider>
58
- <CardProvider scheme={scheme} tone={tone}>
59
- <ToastProvider>
60
- <BoundaryElementProvider element={boundaryElement}>
61
- <PortalProvider element={portalElement}>{children}</PortalProvider>
62
- </BoundaryElementProvider>
63
- <div data-portal="" ref={setPortalElement} />
64
- </ToastProvider>
65
- </CardProvider>
66
- </LayerProvider>
53
+ <RootProvider
54
+ boundaryElement={boundaryElement}
55
+ portalElement={portalElement}
56
+ scheme={scheme}
57
+ tone={tone}
58
+ >
59
+ {children}
60
+ <div data-portal="" ref={setPortalElement} />
61
+ </RootProvider>
67
62
  )
68
63
 
69
64
  if (as === 'html') {
@@ -0,0 +1,40 @@
1
+ import type {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
2
+ import type {ReactNode} from 'react'
3
+
4
+ import {ToastProvider} from '../../components/toast/toastProvider'
5
+ import {BoundaryElementProvider} from '../../utils/boundaryElement/boundaryElementProvider'
6
+ import {PortalProvider} from '../../utils/portal/portalProvider'
7
+ import {CardProvider} from '../card/cardProvider'
8
+ import {LayerProvider} from '../layer/layerProvider'
9
+
10
+ /** @public */
11
+ export interface RootProviderProps {
12
+ boundaryElement?: HTMLElement | null
13
+ children?: ReactNode
14
+ portalElement?: HTMLElement | null
15
+ scheme?: ThemeColorSchemeKey
16
+ tone?: ThemeColorCardToneKey
17
+ }
18
+
19
+ /** @public */
20
+ export function RootProvider(props: RootProviderProps) {
21
+ const {
22
+ boundaryElement = null,
23
+ children,
24
+ portalElement = null,
25
+ scheme = 'light',
26
+ tone = 'transparent',
27
+ } = props
28
+
29
+ return (
30
+ <LayerProvider>
31
+ <CardProvider scheme={scheme} tone={tone}>
32
+ <ToastProvider>
33
+ <BoundaryElementProvider element={boundaryElement}>
34
+ <PortalProvider element={portalElement}>{children}</PortalProvider>
35
+ </BoundaryElementProvider>
36
+ </ToastProvider>
37
+ </CardProvider>
38
+ </LayerProvider>
39
+ )
40
+ }
@@ -11,8 +11,8 @@ import {useImperativeHandle, useRef} from 'react'
11
11
 
12
12
  import {useCustomValidity} from '../../hooks/useCustomValidity'
13
13
  import type {ComponentType, Props} from '../../types/props'
14
- import {Box} from '../box'
15
- import {Text} from '../text'
14
+ import {Box} from '../box/box'
15
+ import {Text} from '../text/text'
16
16
 
17
17
  /** @public */
18
18
  export const DEFAULT_SELECT_ELEMENT = 'select'
@@ -2,7 +2,7 @@ import {_selectable, type SelectableStyleProps} from '@sanity/ui/css'
2
2
  import type {ThemeColorStateToneKey} from '@sanity/ui/theme'
3
3
 
4
4
  import type {ComponentType, Props} from '../../types/props'
5
- import {Box, type BoxOwnProps} from '../box'
5
+ import {Box, type BoxOwnProps} from '../box/box'
6
6
 
7
7
  /** @internal */
8
8
  export const DEFAULT_SELECTABLE_ELEMENT = 'button'
@@ -2,7 +2,7 @@ import {type ResponsiveProp, spinner} from '@sanity/ui/css'
2
2
  import type {FontTextSize} from '@sanity/ui/theme'
3
3
 
4
4
  import type {ComponentType, Props} from '../../types/props'
5
- import {Text} from '../text'
5
+ import {Text} from '../text/text'
6
6
  import {AnimatedSpinnerIcon} from './animatedSpinnerIcon'
7
7
 
8
8
  /** @public */
@@ -2,7 +2,7 @@ import {type ResponsiveProp, stack} from '@sanity/ui/css'
2
2
  import type {Space} from '@sanity/ui/theme'
3
3
 
4
4
  import type {Props} from '../../types/props'
5
- import {Box, type BoxElementType, type BoxOwnProps} from '../box'
5
+ import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
6
6
 
7
7
  /** @public */
8
8
  export const DEFAULT_STACK_ELEMENT = 'div'
@@ -8,7 +8,7 @@ import {
8
8
  import {useEffect, useImperativeHandle, useRef} from 'react'
9
9
 
10
10
  import type {ComponentType, Props} from '../../types/props'
11
- import {Box} from '../box'
11
+ import {Box} from '../box/box'
12
12
 
13
13
  /** @public */
14
14
  export const DEFAULT_SWITCH_ELEMENT = 'input'
@@ -27,9 +27,9 @@ import {useCustomValidity} from '../../hooks/useCustomValidity'
27
27
  import {useResponsiveProp} from '../../hooks/useResponsiveProp'
28
28
  import {isRecord} from '../../lib/isRecord'
29
29
  import type {ComponentType, Props} from '../../types/props'
30
- import {Box} from '../box'
31
- import {Button, type ButtonProps} from '../button'
32
- import {Text} from '../text'
30
+ import {Box} from '../box/box'
31
+ import {Button, type ButtonProps} from '../button/button'
32
+ import {Text} from '../text/text'
33
33
 
34
34
  /** @public */
35
35
  export const DEFAULT_TEXT_INPUT_ELEMENT = 'input'
@@ -5,8 +5,8 @@ import {act, fireEvent, screen} from '@testing-library/react'
5
5
  import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest'
6
6
 
7
7
  import {render} from '../../../../test'
8
- import {Button} from '../button'
9
- import {Text} from '../text'
8
+ import {Button} from '../button/button'
9
+ import {Text} from '../text/text'
10
10
  import {Tooltip} from './tooltip'
11
11
  import {TooltipDelayGroupProvider} from './tooltipDelayGroup'
12
12
 
@@ -36,11 +36,13 @@ import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
36
36
  import {origin} from '../../middleware/origin'
37
37
  import type {Placement} from '../../types/placement'
38
38
  import type {ComponentType, Props} from '../../types/props'
39
- import {useBoundaryElement} from '../../utils/boundaryElement'
39
+ import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
40
40
  import {getElementRef} from '../../utils/getElementRef'
41
- import {Portal, usePortal} from '../../utils/portal'
42
- import {CardProvider, useCard} from '../card'
43
- import type {LayerOwnProps} from '../layer'
41
+ import {Portal} from '../../utils/portal/portal'
42
+ import {usePortal} from '../../utils/portal/usePortal'
43
+ import {CardProvider} from '../card/cardProvider'
44
+ import {useCard} from '../card/useCard'
45
+ import type {LayerOwnProps} from '../layer/layer'
44
46
  import type {Delay} from '../types'
45
47
  import {
46
48
  DEFAULT_FALLBACK_PLACEMENTS,
@@ -3,8 +3,8 @@ import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
3
3
 
4
4
  import {POPOVER_MOTION_PROPS} from '../../constants'
5
5
  import type {Placement} from '../../types/placement'
6
- import {Arrow} from '../arrow'
7
- import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
6
+ import {Arrow} from '../arrow/arrow'
7
+ import {Layer, type LayerOwnProps, type LayerProps} from '../layer/layer'
8
8
  import {
9
9
  DEFAULT_TOOLTIP_ARROW_HEIGHT,
10
10
  DEFAULT_TOOLTIP_ARROW_RADIUS,
@@ -1,6 +1,6 @@
1
1
  import {Component, type ErrorInfo, type PropsWithChildren, type ReactNode} from 'react'
2
2
 
3
- import {Code} from '../primitives/code'
3
+ import {Code} from '../primitives/code/code'
4
4
 
5
5
  /**
6
6
  * DO NOT USE IN PRODUCTION
@@ -1,7 +1,8 @@
1
1
  import type {ReactNode, ReactPortal} from 'react'
2
2
  import {createPortal} from 'react-dom'
3
3
 
4
- import {CardProvider, useCard} from '../../primitives/card'
4
+ import {CardProvider} from '../../primitives/card/cardProvider'
5
+ import {useCard} from '../../primitives/card/useCard'
5
6
  import {usePortal} from './usePortal'
6
7
 
7
8
  /** @public */
@@ -1,5 +1,5 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
- import {inset} from '../../props/inset'
2
+ import {inset} from '../../props/inset/inset'
3
3
  import {
4
4
  card,
5
5
  container,
@@ -1,8 +1,8 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
- import {flex} from '../../props/flex'
4
- import {margin} from '../../props/margin'
5
- import {radius} from '../../props/radius'
3
+ import {flex} from '../../props/flex/flex'
4
+ import {margin} from '../../props/margin/margin'
5
+ import {radius} from '../../props/radius/radius'
6
6
  import {codeScale, font, headingScale, labelScale, root, textScale} from './skeleton.css'
7
7
  import type {
8
8
  CodeSkeletonStyleProps,
@@ -1,8 +1,8 @@
1
1
  import type {FontCodeSize, FontHeadingSize, FontLabelSize, FontTextSize} from '@sanity/ui/theme'
2
2
 
3
- import type {FlexStyleProps} from '../../props/flex'
4
- import type {MarginStyleProps} from '../../props/margin'
5
- import type {RadiusStyleProps} from '../../props/radius'
3
+ import type {FlexStyleProps} from '../../props/flex/types'
4
+ import type {MarginStyleProps} from '../../props/margin/types'
5
+ import type {RadiusStyleProps} from '../../props/radius/types'
6
6
  import type {ResponsiveProp} from '../../types'
7
7
 
8
8
  /** @beta */
@@ -33,7 +33,7 @@ import type {CSSTheme, CSSThemeColorCard} from './types'
33
33
  import {px, toBoxShadow} from './util'
34
34
  import {paletteVars, themeVars} from './vars.css'
35
35
 
36
- const fontDisplay: FontDisplay = 'auto'
36
+ const fontDisplay: FontDisplay = 'swap'
37
37
 
38
38
  globalFontFace('Inter', [
39
39
  {
package/src/css/index.ts CHANGED
@@ -7,79 +7,136 @@ export * from './vars.css'
7
7
  export * from './defaultTheme.css'
8
8
 
9
9
  // props
10
- export * from './props/alignItems'
11
- export * from './props/border'
12
- export * from './props/boxSizing'
13
- export * from './props/display'
14
- export * from './props/flex'
15
- export * from './props/flexDirection'
16
- export * from './props/flexWrap'
17
- export * from './props/font'
18
- export * from './props/gap'
19
- export * from './props/gridAutoColumns'
20
- export * from './props/gridAutoFlow'
21
- export * from './props/gridAutoRows'
22
- export * from './props/gridColumn'
23
- export * from './props/gridColumnEnd'
24
- export * from './props/gridColumnStart'
25
- export * from './props/gridRow'
26
- export * from './props/gridRowEnd'
27
- export * from './props/gridRowStart'
28
- export * from './props/gridTemplateColumns'
29
- export * from './props/gridTemplateRows'
30
- export * from './props/height'
31
- export * from './props/inset'
32
- export * from './props/justifyContent'
33
- export * from './props/margin'
34
- export * from './props/maxWidth'
35
- export * from './props/minHeight'
36
- export * from './props/minWidth'
37
- export * from './props/outline'
38
- export * from './props/overflow'
39
- export * from './props/padding'
40
- export * from './props/pointerEvents'
41
- export * from './props/position'
42
- export * from './props/radius'
43
- export * from './props/shadow'
44
- export * from './props/textAlign'
45
- export * from './props/textOverflow'
46
- export * from './props/width'
10
+ export * from './props/alignItems/alignItems'
11
+ export * from './props/alignItems/types'
12
+ export * from './props/border/border'
13
+ export * from './props/border/types'
14
+ export * from './props/boxSizing/boxSizing'
15
+ export * from './props/boxSizing/types'
16
+ export * from './props/display/display'
17
+ export * from './props/display/types'
18
+ export * from './props/flex/flex'
19
+ export * from './props/flex/types'
20
+ export * from './props/flexDirection/flexDirection'
21
+ export * from './props/flexDirection/types'
22
+ export * from './props/flexWrap/flexWrap'
23
+ export * from './props/flexWrap/types'
24
+ export * from './props/font/font'
25
+ export * from './props/font/types'
26
+ export * from './props/gap/gap'
27
+ export * from './props/gap/types'
28
+ export * from './props/gridAutoColumns/gridAutoColumns'
29
+ export * from './props/gridAutoColumns/types'
30
+ export * from './props/gridAutoFlow/gridAutoFlow'
31
+ export * from './props/gridAutoFlow/types'
32
+ export * from './props/gridAutoRows/gridAutoRows'
33
+ export * from './props/gridAutoRows/types'
34
+ export * from './props/gridColumn/gridColumn'
35
+ export * from './props/gridColumn/types'
36
+ export * from './props/gridColumnEnd/gridColumnEnd'
37
+ export * from './props/gridColumnEnd/types'
38
+ export * from './props/gridColumnStart/gridColumnStart'
39
+ export * from './props/gridColumnStart/types'
40
+ export * from './props/gridRow/gridRow'
41
+ export * from './props/gridRow/types'
42
+ export * from './props/gridRowEnd/gridRowEnd'
43
+ export * from './props/gridRowEnd/types'
44
+ export * from './props/gridRowStart/gridRowStart'
45
+ export * from './props/gridRowStart/types'
46
+ export * from './props/gridTemplateColumns/gridTemplateColumns'
47
+ export * from './props/gridTemplateColumns/types'
48
+ export * from './props/gridTemplateRows/gridTemplateRows'
49
+ export * from './props/gridTemplateRows/types'
50
+ export * from './props/height/height'
51
+ export * from './props/height/types'
52
+ export * from './props/inset/inset'
53
+ export * from './props/inset/types'
54
+ export * from './props/justifyContent/justifyContent'
55
+ export * from './props/justifyContent/types'
56
+ export * from './props/margin/margin'
57
+ export * from './props/margin/types'
58
+ export * from './props/maxWidth/maxWidth'
59
+ export * from './props/maxWidth/types'
60
+ export * from './props/minHeight/minHeight'
61
+ export * from './props/minHeight/types'
62
+ export * from './props/minWidth/minWidth'
63
+ export * from './props/minWidth/types'
64
+ export * from './props/outline/outline'
65
+ export * from './props/outline/types'
66
+ export * from './props/overflow/overflow'
67
+ export * from './props/overflow/types'
68
+ export * from './props/padding/padding'
69
+ export * from './props/padding/types'
70
+ export * from './props/pointerEvents/pointerEvents'
71
+ export * from './props/pointerEvents/types'
72
+ export * from './props/position/position'
73
+ export * from './props/position/types'
74
+ export * from './props/radius/radius'
75
+ export * from './props/radius/types'
76
+ export * from './props/shadow/shadow'
77
+ export * from './props/shadow/types'
78
+ export * from './props/textAlign/textAlign'
79
+ export * from './props/textAlign/types'
80
+ export * from './props/textOverflow/textOverflow'
81
+ export * from './props/textOverflow/types'
82
+ export * from './props/width/width'
83
+ export * from './props/width/types'
47
84
 
48
85
  // primitives
49
- export * from './primitives/_arrow'
50
- export * from './primitives/_input'
51
- export * from './primitives/_selectable'
52
- export * from './primitives/avatar'
53
- export * from './primitives/badge'
54
- export * from './primitives/box'
55
- export * from './primitives/button'
56
- export * from './primitives/card'
57
- export * from './primitives/checkbox'
58
- export * from './primitives/code'
59
- export * from './primitives/container'
60
- export * from './primitives/heading'
61
- export * from './primitives/kbd'
62
- export * from './primitives/label'
63
- export * from './primitives/popover'
64
- export * from './primitives/radio'
65
- export * from './primitives/root'
66
- export * from './primitives/select'
67
- export * from './primitives/spinner'
68
- export * from './primitives/srOnly'
69
- export * from './primitives/stack'
70
- export * from './primitives/switch'
71
- export * from './primitives/text'
72
- export * from './primitives/textArea'
73
- export * from './primitives/textInput'
74
- export * from './primitives/tooltip'
86
+ export * from './primitives/_arrow/_arrow'
87
+ export * from './primitives/_input/input'
88
+ export * from './primitives/_input/types'
89
+ export * from './primitives/_selectable/selectable'
90
+ export * from './primitives/_selectable/types'
91
+ export * from './primitives/avatar/avatar'
92
+ export * from './primitives/avatar/types'
93
+ export * from './primitives/badge/badge'
94
+ export * from './primitives/badge/types'
95
+ export * from './primitives/box/box'
96
+ export * from './primitives/box/types'
97
+ export * from './primitives/button/button'
98
+ export * from './primitives/button/types'
99
+ export * from './primitives/card/card'
100
+ export * from './primitives/card/types'
101
+ export * from './primitives/checkbox/checkbox'
102
+ export * from './primitives/code/code'
103
+ export * from './primitives/code/types'
104
+ export * from './primitives/container/container'
105
+ export * from './primitives/container/types'
106
+ export * from './primitives/heading/heading'
107
+ export * from './primitives/heading/types'
108
+ export * from './primitives/kbd/kbd'
109
+ export * from './primitives/kbd/types'
110
+ export * from './primitives/label/label'
111
+ export * from './primitives/label/types'
112
+ export * from './primitives/popover/popover'
113
+ export * from './primitives/radio/radio'
114
+ export * from './primitives/root/root'
115
+ export * from './primitives/root/types'
116
+ export * from './primitives/select/select'
117
+ export * from './primitives/select/types'
118
+ export * from './primitives/spinner/spinner'
119
+ export * from './primitives/spinner/types'
120
+ export * from './primitives/srOnly/srOnly'
121
+ export * from './primitives/stack/stack'
122
+ export * from './primitives/switch/switch'
123
+ export * from './primitives/text/text'
124
+ export * from './primitives/text/types'
125
+ export * from './primitives/textArea/textArea'
126
+ export * from './primitives/textArea/types'
127
+ export * from './primitives/textInput/textInput'
128
+ export * from './primitives/textInput/types'
129
+ export * from './primitives/tooltip/tooltip'
130
+ export * from './primitives/tooltip/types'
75
131
 
76
132
  // components
77
- export * from './components/breadcrumbs'
78
- export * from './components/dialog'
79
- export * from './components/menu'
80
- export * from './components/skeleton'
81
- export * from './components/toast'
82
- export * from './components/tree'
133
+ export * from './components/breadcrumbs/breadcrumbs'
134
+ export * from './components/dialog/dialog'
135
+ export * from './components/menu/menu'
136
+ export * from './components/skeleton/skeleton'
137
+ export * from './components/skeleton/types'
138
+ export * from './components/toast/toast'
139
+ export * from './components/tree/tree'
83
140
 
84
141
  export * from './constants'
85
142
  export * from './types'
@@ -1,7 +1,7 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
- import {radius} from '../../props/radius'
4
- import {width} from '../../props/width'
3
+ import {radius} from '../../props/radius/radius'
4
+ import {width} from '../../props/width/width'
5
5
  import {border, element, fontSize, gap, padding, presentation, root} from './_input.css'
6
6
  import type {InputStyleProps} from './types'
7
7