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

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 (229) hide show
  1. package/README.md +5 -8
  2. package/dist/_chunks-cjs/_visual-editing.cjs +744 -874
  3. package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
  4. package/dist/_chunks-cjs/refractor.cjs +2 -2
  5. package/dist/_chunks-cjs/refractor.cjs.map +1 -1
  6. package/dist/_chunks-es/_visual-editing.js +788 -917
  7. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  8. package/dist/_chunks-es/refractor.js +1 -1
  9. package/dist/{css.cjs → css/index.cjs} +72 -53
  10. package/dist/css/index.cjs.map +1 -0
  11. package/dist/css/index.css +1 -0
  12. package/dist/{css.d.ts → css/index.d.cts} +26 -8
  13. package/dist/{css.d.cts → css/index.d.ts} +26 -8
  14. package/dist/{css.js → css/index.js} +72 -53
  15. package/dist/css/index.js.map +1 -0
  16. package/dist/css/layers.css +4 -0
  17. package/dist/css/primitives/popover/popover.css +4 -0
  18. package/dist/index.cjs +2049 -1811
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +62 -26
  21. package/dist/index.d.ts +62 -26
  22. package/dist/index.js +2056 -1819
  23. package/dist/index.js.map +1 -1
  24. package/dist/theme.cjs +7 -7
  25. package/dist/theme.cjs.map +1 -1
  26. package/dist/theme.js +7 -7
  27. package/dist/theme.js.map +1 -1
  28. package/exports/_visual-editing.ts +1 -1
  29. package/package.json +14 -19
  30. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  31. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
  32. package/src/core/components/autocomplete/autocomplete.tsx +15 -19
  33. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  34. package/src/core/components/autocomplete/constants.ts +3 -1
  35. package/src/core/components/autocomplete/types.ts +1 -1
  36. package/src/core/components/breadcrumbs/breadcrumbs.tsx +8 -3
  37. package/src/core/components/dialog/__workshop__/activate.tsx +11 -3
  38. package/src/core/components/dialog/__workshop__/panes.tsx +12 -5
  39. package/src/core/components/dialog/dialog.tsx +12 -6
  40. package/src/core/components/dialog/dialogCard.tsx +89 -54
  41. package/src/core/components/dialog/dialogContext.ts +1 -1
  42. package/src/core/components/dialog/dialogProvider.tsx +1 -1
  43. package/src/core/components/dialog/index.ts +1 -0
  44. package/src/core/components/dialog/isTargetWithinScope.ts +1 -1
  45. package/src/core/components/hotkeys/hotkeys.tsx +3 -2
  46. package/src/core/components/menu/__workshop__/avatarMenu.tsx +12 -6
  47. package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -5
  48. package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -2
  49. package/src/core/components/menu/helpers.ts +1 -1
  50. package/src/core/components/menu/menu.tsx +6 -3
  51. package/src/core/components/menu/menuButton.tsx +5 -3
  52. package/src/core/components/menu/menuDivider.tsx +1 -1
  53. package/src/core/components/menu/menuGroup.tsx +8 -4
  54. package/src/core/components/menu/menuItem.tsx +4 -2
  55. package/src/core/components/tab/tab.tsx +2 -2
  56. package/src/core/components/tab/tabList.tsx +2 -2
  57. package/src/core/components/tab/tabPanel.tsx +2 -2
  58. package/src/core/components/toast/toast.tsx +21 -17
  59. package/src/core/components/toast/toastLayer.tsx +3 -2
  60. package/src/core/components/toast/toastProvider.tsx +15 -11
  61. package/src/core/components/tree/tree.tsx +2 -2
  62. package/src/core/components/tree/treeGroup.tsx +2 -2
  63. package/src/core/components/tree/treeItem.tsx +13 -6
  64. package/src/core/components/tree/types.ts +0 -1
  65. package/src/core/components/virtualList/virtualList.tsx +10 -5
  66. package/src/core/helpers/focus.ts +0 -8
  67. package/src/core/hooks/useArrayProp.ts +1 -1
  68. package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -3
  69. package/src/core/hooks/useElementSize.ts +1 -1
  70. package/src/core/hooks/useResponsiveProp.ts +1 -1
  71. package/src/core/index.ts +84 -7
  72. package/src/core/observers/{elementSizeObserver.ts → elementSize.ts} +1 -1
  73. package/src/core/primitives/_selectable/index.ts +1 -0
  74. package/src/core/primitives/_selectable/selectable.tsx +13 -3
  75. package/src/core/{types/selectable.ts → primitives/_selectable/types.ts} +1 -1
  76. package/src/core/primitives/arrow/arrow.tsx +1 -1
  77. package/src/core/primitives/avatar/avatar.tsx +4 -3
  78. package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
  79. package/src/core/primitives/avatar/avatarStack.tsx +4 -4
  80. package/src/core/primitives/avatar/types.ts +17 -0
  81. package/src/core/primitives/badge/badge.tsx +2 -1
  82. package/src/core/primitives/badge/types.ts +11 -2
  83. package/src/core/primitives/box/__workshop__/responsive.tsx +0 -1
  84. package/src/core/primitives/box/box.tsx +1 -1
  85. package/src/core/primitives/box/index.ts +1 -0
  86. package/src/core/primitives/button/__workshop__/disabled.tsx +37 -51
  87. package/src/core/primitives/button/__workshop__/index.ts +5 -0
  88. package/src/core/primitives/button/__workshop__/textOverflow.tsx +13 -0
  89. package/src/core/primitives/button/button.tsx +15 -14
  90. package/src/core/primitives/button/index.ts +1 -0
  91. package/src/core/primitives/card/__workshop__/listNavigation.tsx +2 -2
  92. package/src/core/primitives/card/card.tsx +1 -1
  93. package/src/core/primitives/card/types.ts +3 -0
  94. package/src/core/primitives/checkbox/__workshop__/tones.tsx +9 -1
  95. package/src/core/primitives/checkbox/checkbox.tsx +3 -4
  96. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +17 -42
  97. package/src/core/primitives/code/code.tsx +1 -1
  98. package/src/core/primitives/container/container.tsx +1 -1
  99. package/src/core/primitives/flex/flex.tsx +1 -1
  100. package/src/core/primitives/flex/index.ts +1 -0
  101. package/src/core/primitives/grid/grid.tsx +1 -1
  102. package/src/core/primitives/grid/index.ts +1 -0
  103. package/src/core/primitives/heading/heading.tsx +1 -1
  104. package/src/core/primitives/inline/inline.tsx +1 -1
  105. package/src/core/primitives/kbd/kbd.tsx +1 -1
  106. package/src/core/primitives/label/label.tsx +1 -1
  107. package/src/core/primitives/layer/layer.test.tsx +1 -1
  108. package/src/core/primitives/layer/layer.tsx +2 -2
  109. package/src/core/primitives/layer/layerCard.tsx +3 -3
  110. package/src/core/primitives/layer/layerProvider.tsx +2 -1
  111. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +12 -10
  112. package/src/core/primitives/popover/__workshop__/TestStory.tsx +9 -8
  113. package/src/core/primitives/popover/constants.ts +1 -1
  114. package/src/core/primitives/popover/floating-ui/size.ts +1 -1
  115. package/src/core/primitives/popover/popover.tsx +7 -4
  116. package/src/core/primitives/popover/popoverLayer.tsx +2 -1
  117. package/src/core/primitives/popover/types.ts +5 -0
  118. package/src/core/primitives/radio/radio.tsx +2 -2
  119. package/src/core/primitives/root/Root.tsx +89 -0
  120. package/src/core/primitives/root/__workshop__/boundary.tsx +5 -0
  121. package/src/core/primitives/root/__workshop__/index.ts +8 -0
  122. package/src/core/primitives/root/index.ts +1 -0
  123. package/src/core/primitives/select/select.tsx +2 -2
  124. package/src/core/{components → primitives}/skeleton/__workshop__/index.ts +1 -1
  125. package/src/core/{components → primitives}/skeleton/codeSkeleton.tsx +1 -1
  126. package/src/core/{components → primitives}/skeleton/headingSkeleton.tsx +1 -1
  127. package/src/core/{components → primitives}/skeleton/labelSkeleton.tsx +1 -1
  128. package/src/core/{components → primitives}/skeleton/skeleton.tsx +7 -8
  129. package/src/core/{components → primitives}/skeleton/textSkeleton.tsx +1 -1
  130. package/src/core/primitives/spinner/spinner.tsx +1 -1
  131. package/src/core/primitives/srOnly/srOnly.tsx +1 -1
  132. package/src/core/primitives/stack/stack.tsx +1 -1
  133. package/src/core/primitives/switch/switch.tsx +1 -6
  134. package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
  135. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +17 -42
  136. package/src/core/primitives/text/text.tsx +3 -1
  137. package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
  138. package/src/core/primitives/textArea/textArea.tsx +2 -2
  139. package/src/core/primitives/textInput/textInput.tsx +3 -2
  140. package/src/core/primitives/tooltip/constants.ts +1 -1
  141. package/src/core/primitives/tooltip/tooltip.tsx +5 -3
  142. package/src/core/primitives/tooltip/tooltipLayer.tsx +1 -1
  143. package/src/core/primitives/types.ts +8 -10
  144. package/src/core/types/radius.ts +1 -1
  145. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +9 -5
  146. package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
  147. package/src/core/utils/portal/portal.tsx +1 -1
  148. package/src/css/components/dialog/dialog.css.ts +26 -1
  149. package/src/css/components/dialog/dialog.ts +27 -7
  150. package/src/css/components/skeleton/skeleton.ts +3 -1
  151. package/src/css/components/skeleton/types.ts +3 -1
  152. package/src/css/components/toast/toast.css.ts +1 -0
  153. package/src/css/defaultTheme.css.ts +55 -2
  154. package/src/css/index.ts +77 -5
  155. package/src/css/primitives/_input/input.ts +2 -1
  156. package/src/css/primitives/_input/types.ts +2 -1
  157. package/src/css/primitives/_selectable/_selectable.css.ts +32 -24
  158. package/src/css/primitives/_selectable/selectable.ts +1 -1
  159. package/src/css/primitives/_selectable/types.ts +1 -1
  160. package/src/css/primitives/avatar/avatar.css.ts +8 -4
  161. package/src/css/primitives/avatar/avatar.ts +1 -1
  162. package/src/css/primitives/badge/types.ts +0 -2
  163. package/src/css/primitives/box/box.ts +35 -37
  164. package/src/css/primitives/box/types.ts +34 -36
  165. package/src/css/primitives/button/button.css.ts +4 -0
  166. package/src/css/primitives/button/button.ts +5 -2
  167. package/src/css/primitives/button/types.ts +4 -11
  168. package/src/css/primitives/card/__workshop__/color.tsx +70 -0
  169. package/src/css/primitives/card/__workshop__/index.ts +14 -0
  170. package/src/css/primitives/card/card.css.ts +4 -0
  171. package/src/css/primitives/code/code.ts +3 -1
  172. package/src/css/primitives/code/types.ts +2 -1
  173. package/src/css/primitives/container/container.ts +3 -1
  174. package/src/css/primitives/heading/heading.ts +4 -1
  175. package/src/css/primitives/heading/types.ts +3 -1
  176. package/src/css/primitives/kbd/kbd.ts +1 -1
  177. package/src/css/primitives/kbd/types.ts +1 -1
  178. package/src/css/primitives/label/label.ts +4 -1
  179. package/src/css/primitives/label/types.ts +3 -1
  180. package/src/css/primitives/root/index.ts +2 -0
  181. package/src/css/primitives/root/root.css.ts +15 -0
  182. package/src/css/primitives/root/root.ts +17 -0
  183. package/src/css/primitives/root/types.ts +10 -0
  184. package/src/css/primitives/switch/switch.css.ts +1 -1
  185. package/src/css/primitives/text/text.ts +6 -1
  186. package/src/css/primitives/text/types.ts +5 -2
  187. package/src/theme/v3/defaultFonts.ts +6 -6
  188. package/src/theme/v3/defaultTokens.ts +1 -1
  189. package/bin/sanity-ui.cjs +0 -5
  190. package/dist/css.cjs.map +0 -1
  191. package/dist/css.js.map +0 -1
  192. package/dist/ui.css +0 -1
  193. package/src/cli/buildCommand.ts +0 -10
  194. package/src/cli/index.ts +0 -26
  195. package/src/core/components/autocomplete/index.ts +0 -2
  196. package/src/core/components/index.ts +0 -10
  197. package/src/core/helpers/index.ts +0 -5
  198. package/src/core/hooks/index.ts +0 -13
  199. package/src/core/observers/index.ts +0 -2
  200. package/src/core/primitives/index.ts +0 -30
  201. package/src/core/types/avatar.ts +0 -16
  202. package/src/core/types/card.ts +0 -4
  203. package/src/core/types/index.ts +0 -15
  204. package/src/core/types/popover.ts +0 -4
  205. package/src/core/utils/index.ts +0 -4
  206. package/src/css/__theme/index.ts +0 -16
  207. package/src/css/__theme/lib/contract/buildVarContract.ts +0 -78
  208. package/src/css/__theme/lib/contract/index.ts +0 -4
  209. package/src/css/__theme/lib/contract/types.ts +0 -17
  210. package/src/css/__theme/resolveTheme.ts +0 -865
  211. package/src/css/components/index.ts +0 -6
  212. package/src/css/primitives/index.ts +0 -24
  213. package/src/css/props/index.ts +0 -37
  214. package/src/css/utils/srOnly/index.ts +0 -1
  215. /package/src/core/{global.ts → __DEV__.ts} +0 -0
  216. /package/src/core/{types/dialog.ts → components/dialog/types.ts} +0 -0
  217. /package/src/core/observers/{resizeObserver.ts → resize.ts} +0 -0
  218. /package/src/core/{types/badge.ts → primitives/badge/types2.ts} +0 -0
  219. /package/src/core/{types/box.ts → primitives/box/types.ts} +0 -0
  220. /package/src/core/{types/button.ts → primitives/button/types.ts} +0 -0
  221. /package/src/core/{types/flex.ts → primitives/flex/types.ts} +0 -0
  222. /package/src/core/{types/grid.ts → primitives/grid/types.ts} +0 -0
  223. /package/src/core/{components → primitives}/skeleton/__workshop__/delay.tsx +0 -0
  224. /package/src/core/{components → primitives}/skeleton/__workshop__/skeleton.tsx +0 -0
  225. /package/src/core/{components → primitives}/skeleton/index.ts +0 -0
  226. /package/src/core/types/{text.ts → textAlign.ts} +0 -0
  227. /package/src/css/{utils → primitives/srOnly}/index.ts +0 -0
  228. /package/src/css/{utils → primitives}/srOnly/srOnly.css.ts +0 -0
  229. /package/src/css/{utils → primitives}/srOnly/srOnly.ts +0 -0
@@ -1,22 +1,26 @@
1
1
  import {Box, Card, ElementQuery, Text} from '@sanity/ui'
2
- import {varNames, vars} from '@sanity/ui/css'
2
+ import {vars} from '@sanity/ui/css'
3
3
  import {styled} from 'styled-components'
4
4
 
5
5
  const TestCard = styled(Card)`
6
6
  [data-eq-min~='0'] > & {
7
- ${varNames.color.fg}: light-dark(${vars.palette.orange[600]}, ${vars.palette.orange[400]});
7
+ ${vars.color.fg.slice(4, -1)}: light-dark(${vars.color.palette.orange[600]}, ${vars.color
8
+ .palette.orange[400]});
8
9
  }
9
10
 
10
11
  [data-eq-min~='1'] > & {
11
- ${varNames.color.fg}: light-dark(${vars.palette.red[600]}, ${vars.palette.red[400]});
12
+ ${vars.color.fg.slice(4, -1)}: light-dark(${vars.color.palette.red[600]}, ${vars.color.palette
13
+ .red[400]});
12
14
  }
13
15
 
14
16
  [data-eq-min~='2'] > & {
15
- ${varNames.color.fg}: light-dark(${vars.palette.magenta[600]}, ${vars.palette.magenta[400]});
17
+ ${vars.color.fg.slice(4, -1)}: light-dark(${vars.color.palette.magenta[600]}, ${vars.color
18
+ .palette.magenta[400]});
16
19
  }
17
20
 
18
21
  [data-eq-min~='3'] > & {
19
- ${varNames.color.fg}: light-dark(${vars.palette.purple[600]}, ${vars.palette.purple[400]});
22
+ ${vars.color.fg.slice(4, -1)}: light-dark(${vars.color.palette.purple[600]}, ${vars.color
23
+ .palette.purple[400]});
20
24
  }
21
25
  `
22
26
 
@@ -1,8 +1,8 @@
1
1
  import {BREAKPOINTS} from '@sanity/ui/css'
2
2
  import {useImperativeHandle, useMemo, useState} from 'react'
3
3
 
4
- import {useElementSize} from '../../hooks'
5
- import type {ComponentType, Props} from '../../types'
4
+ import {useElementSize} from '../../hooks/useElementSize'
5
+ import type {ComponentType, Props} from '../../types/props'
6
6
  import {findMaxBreakpoints, findMinBreakpoints} from './helpers'
7
7
 
8
8
  /** @beta */
@@ -1,7 +1,7 @@
1
1
  import type {ReactNode, ReactPortal} from 'react'
2
2
  import {createPortal} from 'react-dom'
3
3
 
4
- import {CardProvider, useCard} from '../../primitives'
4
+ import {CardProvider, useCard} from '../../primitives/card'
5
5
  import {usePortal} from './usePortal'
6
6
 
7
7
  /** @public */
@@ -63,8 +63,33 @@ export const container = _style(layers.components, {
63
63
  height: '100%',
64
64
  })
65
65
 
66
- export const layout = _style(layers.components, {
66
+ export const scroller = _style(layers.components, {
67
67
  width: '100%',
68
+ height: '100%',
69
+ // overflow: 'auto',
70
+ outline: 'none',
71
+ })
72
+
73
+ export const scrollerShadowTop = _style(layers.components, {
74
+ position: 'absolute',
75
+ top: 0,
76
+ left: 0,
77
+ right: 0,
78
+ height: 8,
79
+ background: `linear-gradient(to top, color-mix(in srgb,transparent, ${vars.color.shadow.penumbra} 0%) 0%, color-mix(in srgb, ${vars.color.shadow.umbra} 100%, transparent 100%) 100%)`,
80
+ boxShadow: `inset 0 0.5px 0 color-mix(in srgb, transparent, ${vars.color.shadow.outline} 50%)`,
81
+ pointerEvents: 'none',
82
+ })
83
+
84
+ export const scrollerShadowBottom = _style(layers.components, {
85
+ position: 'absolute',
86
+ bottom: 0,
87
+ left: 0,
88
+ right: 0,
89
+ height: 8,
90
+ background: `linear-gradient(to bottom, color-mix(in srgb,transparent, ${vars.color.shadow.penumbra} 0%) 0%, color-mix(in srgb, ${vars.color.shadow.umbra} 100%, transparent 100%) 100%)`,
91
+ boxShadow: `inset 0 -0.5px 0 color-mix(in srgb, transparent, ${vars.color.shadow.outline} 50%)`,
92
+ pointerEvents: 'none',
68
93
  })
69
94
 
70
95
  export const header = _style(layers.components, {
@@ -1,6 +1,16 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
- import {inset} from '../../props'
3
- import {card, container, content, footer, header, layout, root} from './dialog.css'
2
+ import {inset} from '../../props/inset'
3
+ import {
4
+ card,
5
+ container,
6
+ content,
7
+ footer,
8
+ header,
9
+ root,
10
+ scroller,
11
+ scrollerShadowBottom,
12
+ scrollerShadowTop,
13
+ } from './dialog.css'
4
14
 
5
15
  /** @public */
6
16
  export function dialog(props: {className?: string}): string | undefined {
@@ -17,11 +27,6 @@ export function dialogContainer(): string | undefined {
17
27
  return container
18
28
  }
19
29
 
20
- /** @public */
21
- export function dialogLayout(): string | undefined {
22
- return layout
23
- }
24
-
25
30
  /** @public */
26
31
  export function dialogHeader(): string | undefined {
27
32
  return header
@@ -32,6 +37,21 @@ export function dialogContent(): string | undefined {
32
37
  return content
33
38
  }
34
39
 
40
+ /** @public */
41
+ export function dialogScroller(): string | undefined {
42
+ return scroller
43
+ }
44
+
45
+ /** @public */
46
+ export function dialogScrollerShadowTop(): string | undefined {
47
+ return scrollerShadowTop
48
+ }
49
+
50
+ /** @public */
51
+ export function dialogScrollerShadowBottom(): string | undefined {
52
+ return scrollerShadowBottom
53
+ }
54
+
35
55
  /** @public */
36
56
  export function dialogFooter(): string | undefined {
37
57
  return footer
@@ -1,5 +1,7 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
+ import {flex} from '../../props/flex'
4
+ import {margin} from '../../props/margin'
3
5
  import {radius} from '../../props/radius'
4
6
  import {codeScale, font, headingScale, labelScale, root, textScale} from './skeleton.css'
5
7
  import type {
@@ -12,7 +14,7 @@ import type {
12
14
 
13
15
  /** @beta */
14
16
  export function skeleton(props: SkeletonStyleProps): string | undefined {
15
- return _composeClassNames(props.className, root, radius(props))
17
+ return _composeClassNames(props.className, root, flex(props), radius(props), margin(props))
16
18
  }
17
19
 
18
20
  /** @beta */
@@ -1,11 +1,13 @@
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'
3
5
  import type {RadiusStyleProps} from '../../props/radius'
4
6
  import type {ResponsiveProp} from '../../types'
5
7
 
6
8
  /** @beta */
7
9
 
8
- export interface SkeletonStyleProps extends RadiusStyleProps {
10
+ export interface SkeletonStyleProps extends FlexStyleProps, MarginStyleProps, RadiusStyleProps {
9
11
  className?: string
10
12
  }
11
13
 
@@ -6,6 +6,7 @@ export const layer = _style(layers.components, {
6
6
  right: 0,
7
7
  bottom: 0,
8
8
  pointerEvents: 'none',
9
+ minWidth: `${320 / 16}rem`, // 320px
9
10
  maxWidth: `${420 / 16}rem`, // 420px
10
11
  width: '100%',
11
12
  })
@@ -25,7 +25,7 @@ import {
25
25
  type ThemeColorVariantKey,
26
26
  TINTS,
27
27
  } from '@sanity/ui/theme'
28
- import {createTheme} from '@vanilla-extract/css'
28
+ import {createTheme, globalFontFace} from '@vanilla-extract/css'
29
29
 
30
30
  import {_fromEntries} from './_fromEntries'
31
31
  import {layers} from './layers.css'
@@ -33,6 +33,59 @@ 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'
37
+
38
+ globalFontFace('Inter', [
39
+ {
40
+ src: `url('https://studio-static.sanity.io/Inter-Regular.woff2') format('woff2')`,
41
+ fontDisplay,
42
+ fontStyle: 'normal',
43
+ fontWeight: '400',
44
+ },
45
+ {
46
+ src: `url('https://studio-static.sanity.io/Inter-Italic.woff2') format('woff2')`,
47
+ fontDisplay,
48
+ fontStyle: 'italic',
49
+ fontWeight: '400',
50
+ },
51
+ {
52
+ src: `url('https://studio-static.sanity.io/Inter-Medium.woff2') format('woff2')`,
53
+ fontDisplay,
54
+ fontStyle: 'normal',
55
+ fontWeight: '500',
56
+ },
57
+ {
58
+ src: `url('https://studio-static.sanity.io/Inter-MediumItalic.woff2') format('woff2')`,
59
+ fontDisplay,
60
+ fontStyle: 'italic',
61
+ fontWeight: '500',
62
+ },
63
+ {
64
+ src: `url('https://studio-static.sanity.io/Inter-SemiBold.woff2') format('woff2')`,
65
+ fontDisplay,
66
+ fontStyle: 'normal',
67
+ fontWeight: '600',
68
+ },
69
+ {
70
+ src: `url('https://studio-static.sanity.io/Inter-SemiBoldItalic.woff2') format('woff2')`,
71
+ fontDisplay,
72
+ fontStyle: 'italic',
73
+ fontWeight: '600',
74
+ },
75
+ {
76
+ src: `url('https://studio-static.sanity.io/Inter-Bold.woff2') format('woff2')`,
77
+ fontDisplay,
78
+ fontStyle: 'normal',
79
+ fontWeight: '700',
80
+ },
81
+ {
82
+ src: `url('https://studio-static.sanity.io/Inter-BoldItalic.woff2') format('woff2')`,
83
+ fontDisplay,
84
+ fontStyle: 'italic',
85
+ fontWeight: '700',
86
+ },
87
+ ])
88
+
36
89
  const theme = buildTheme_v3()
37
90
 
38
91
  const themeValue: CSSTheme = {
@@ -253,7 +306,7 @@ const themeValue: CSSTheme = {
253
306
  } as const
254
307
 
255
308
  /** @public */
256
- export const defaultTheme = createTheme(themeVars, themeValue)
309
+ export const themeClassName = createTheme(themeVars, themeValue)
257
310
 
258
311
  function renderColorScheme(options: {scheme: ThemeColorSchemeKey}) {
259
312
  const {scheme} = options
package/src/css/index.ts CHANGED
@@ -1,14 +1,86 @@
1
- /* eslint-disable */
1
+ /* eslint-disable simple-import-sort/exports */
2
2
 
3
3
  export * from './layers.css'
4
4
  export * from './vars.css'
5
- export * from './props'
6
- export * from './utils'
7
- export * from './primitives'
8
- export * from './components'
9
5
 
6
+ // theme
10
7
  export * from './defaultTheme.css'
11
8
 
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'
47
+
48
+ // 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'
75
+
76
+ // 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'
83
+
12
84
  export * from './constants'
13
85
  export * from './types'
14
86
  export * from './util'
@@ -1,6 +1,7 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
- import {radius, width} from '../../props'
3
+ import {radius} from '../../props/radius'
4
+ import {width} from '../../props/width'
4
5
  import {border, element, fontSize, gap, padding, presentation, root} from './_input.css'
5
6
  import type {InputStyleProps} from './types'
6
7
 
@@ -1,6 +1,7 @@
1
1
  import type {FontTextSize, Space} from '@sanity/ui/theme'
2
2
 
3
- import type {RadiusStyleProps, WidthStyleProps} from '../../props'
3
+ import type {RadiusStyleProps} from '../../props/radius'
4
+ import type {WidthStyleProps} from '../../props/width'
4
5
  import type {ResponsiveProp} from '../../types'
5
6
 
6
7
  /** @public */
@@ -46,33 +46,32 @@ export const tones = {
46
46
 
47
47
  '@media': {
48
48
  '(hover: hover)': {
49
- ':hover': {
50
- vars: {
51
- [vars.color.bg]: tinted.bg[1],
52
- },
53
- },
54
-
55
- 'selectors': {
56
- '&:not([data-disabled])': {
57
- cursor: 'pointer',
58
- },
59
-
60
- '&:not([data-disabled]):hover': {
61
- vars: {
62
- [vars.color.bg]: tinted.bg[1],
63
- [vars.color.border]: tinted.border[3],
64
- [vars.color.fg]: tinted.fg[1],
65
- [vars.color.muted.bg]: tinted.bg[2],
66
- [vars.color.muted.fg]: tinted.fg[4],
49
+ selectors: {
50
+ '&:not([data-pressed]):not([data-selected]):not([data-focused]):not([data-disabled]):not(:active):not(:focus):hover':
51
+ {
52
+ vars: {
53
+ [vars.color.bg]: tinted.bg[1],
54
+ [vars.color.border]: tinted.border[1],
55
+ [vars.color.fg]: tinted.fg[1],
56
+ },
67
57
  },
68
- },
58
+
59
+ // '&:not([data-disabled]):hover': {
60
+ // vars: {
61
+ // [vars.color.bg]: tinted.bg[1],
62
+ // [vars.color.border]: tinted.border[3],
63
+ // [vars.color.fg]: tinted.fg[1],
64
+ // [vars.color.muted.bg]: tinted.bg[2],
65
+ // [vars.color.muted.fg]: tinted.fg[4],
66
+ // },
67
+ // },
69
68
  },
70
69
  },
71
70
  },
72
71
 
73
72
  'selectors': {
74
- // pressed
75
- '&:not([data-disabled]):active, &:not([data-disabled])[aria-pressed="true"], &:not([data-disabled])[data-pressed]':
73
+ // selected
74
+ '&:not([data-disabled]):active, &:not([data-disabled])[aria-pressed="true"], &:not([data-disabled])[data-selected]':
76
75
  {
77
76
  vars: {
78
77
  [vars.color.bg]: tinted.bg[2],
@@ -93,9 +92,7 @@ export const tones = {
93
92
  [vars.color.muted.fg]: focused.fg[3],
94
93
  },
95
94
  },
96
-
97
- // selected
98
- '&:not([data-disabled])[data-selected]': {
95
+ '&:not([data-disabled])[data-focused]': {
99
96
  vars: {
100
97
  [vars.color.bg]: focused.bg[0],
101
98
  [vars.color.border]: focused.border[1],
@@ -105,6 +102,17 @@ export const tones = {
105
102
  },
106
103
  },
107
104
 
105
+ // // selected
106
+ // '&:not([data-disabled])[data-selected]': {
107
+ // vars: {
108
+ // [vars.color.bg]: focused.bg[0],
109
+ // [vars.color.border]: focused.border[1],
110
+ // [vars.color.fg]: focused.fg[0],
111
+ // [vars.color.muted.bg]: focused.bg[1],
112
+ // [vars.color.muted.fg]: focused.fg[3],
113
+ // },
114
+ // },
115
+
108
116
  // disabled
109
117
  '&[data-disabled]': {
110
118
  vars: {
@@ -1,5 +1,5 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
- import {radius} from '../../props'
2
+ import {radius} from '../../props/radius'
3
3
  import {root, tones} from './_selectable.css'
4
4
  import type {SelectableStyleProps} from './types'
5
5
 
@@ -1,6 +1,6 @@
1
1
  import type {ThemeColorStateToneKey} from '@sanity/ui/theme'
2
2
 
3
- import type {RadiusStyleProps} from '../../props'
3
+ import type {RadiusStyleProps} from '../../props/radius'
4
4
 
5
5
  /** @internal */
6
6
  export interface SelectableStyleProps extends RadiusStyleProps {
@@ -10,6 +10,14 @@ import {vars} from '../../vars.css'
10
10
 
11
11
  export const stack = _style(layers.primitives, {})
12
12
 
13
+ globalStyle(`${stack} > * + *`, {
14
+ '@layer': {
15
+ [layers.primitives]: {
16
+ marginLeft: vars.avatar.distance,
17
+ },
18
+ },
19
+ })
20
+
13
21
  export const root = _style(layers.primitives, {
14
22
  // display: 'block',
15
23
  backgroundColor: vars.color.avatar.bg,
@@ -31,10 +39,6 @@ export const root = _style(layers.primitives, {
31
39
  display: 'block',
32
40
  },
33
41
 
34
- [`${stack} > & + &`]: {
35
- marginLeft: vars.avatar.distance,
36
- },
37
-
38
42
  'button.&': {
39
43
  WebkitFontSmoothing: 'inherit',
40
44
  appearance: 'none',
@@ -1,6 +1,6 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
- import {flex} from '../../props'
3
+ import {flex} from '../../props/flex'
4
4
  import {
5
5
  arrow,
6
6
  arrowSvg,
@@ -1,7 +1,5 @@
1
1
  import type {ThemeColorStateToneKey} from '@sanity/ui/theme'
2
2
 
3
- // import type {RadiusStyleProps} from '../../props'
4
-
5
3
  /** @public */
6
4
  export interface BadgeStyleProps {
7
5
  className?: string
@@ -1,41 +1,39 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
- import {
3
- alignItems,
4
- border,
5
- boxSizing,
6
- display,
7
- flex,
8
- flexDirection,
9
- flexWrap,
10
- gap,
11
- gridAutoColumns,
12
- gridAutoFlow,
13
- gridAutoRows,
14
- gridColumn,
15
- gridColumnEnd,
16
- gridColumnStart,
17
- gridRow,
18
- gridRowEnd,
19
- gridRowStart,
20
- gridTemplateColumns,
21
- gridTemplateRows,
22
- height,
23
- inset,
24
- justifyContent,
25
- margin,
26
- maxWidth,
27
- minHeight,
28
- minWidth,
29
- outline,
30
- overflow,
31
- padding,
32
- pointerEvents,
33
- position,
34
- radius,
35
- shadow,
36
- textAlign,
37
- width,
38
- } from '../../props'
2
+ import {alignItems} from '../../props/alignItems'
3
+ import {border} from '../../props/border'
4
+ import {boxSizing} from '../../props/boxSizing'
5
+ import {display} from '../../props/display'
6
+ import {flex} from '../../props/flex'
7
+ import {flexDirection} from '../../props/flexDirection'
8
+ import {flexWrap} from '../../props/flexWrap'
9
+ import {gap} from '../../props/gap'
10
+ import {gridAutoColumns} from '../../props/gridAutoColumns'
11
+ import {gridAutoFlow} from '../../props/gridAutoFlow'
12
+ import {gridAutoRows} from '../../props/gridAutoRows'
13
+ import {gridColumn} from '../../props/gridColumn'
14
+ import {gridColumnEnd} from '../../props/gridColumnEnd'
15
+ import {gridColumnStart} from '../../props/gridColumnStart'
16
+ import {gridRow} from '../../props/gridRow'
17
+ import {gridRowEnd} from '../../props/gridRowEnd'
18
+ import {gridRowStart} from '../../props/gridRowStart'
19
+ import {gridTemplateColumns} from '../../props/gridTemplateColumns'
20
+ import {gridTemplateRows} from '../../props/gridTemplateRows'
21
+ import {height} from '../../props/height'
22
+ import {inset} from '../../props/inset'
23
+ import {justifyContent} from '../../props/justifyContent'
24
+ import {margin} from '../../props/margin'
25
+ import {maxWidth} from '../../props/maxWidth'
26
+ import {minHeight} from '../../props/minHeight'
27
+ import {minWidth} from '../../props/minWidth'
28
+ import {outline} from '../../props/outline'
29
+ import {overflow} from '../../props/overflow'
30
+ import {padding} from '../../props/padding'
31
+ import {pointerEvents} from '../../props/pointerEvents'
32
+ import {position} from '../../props/position'
33
+ import {radius} from '../../props/radius'
34
+ import {shadow} from '../../props/shadow'
35
+ import {textAlign} from '../../props/textAlign'
36
+ import {width} from '../../props/width'
39
37
  import {muted, root} from './box.css'
40
38
  import type {BoxStyleProps} from './types'
41
39