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

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 (217) hide show
  1. package/README.md +1 -1
  2. package/dist/_chunks-cjs/_visual-editing.cjs +710 -840
  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 +705 -834
  7. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  8. package/dist/_chunks-es/refractor.js +1 -1
  9. package/dist/css/layers.css +4 -0
  10. package/dist/css/primitives/popover/popover.css +4 -0
  11. package/dist/css.cjs +58 -49
  12. package/dist/css.cjs.map +1 -1
  13. package/dist/css.d.cts +13 -5
  14. package/dist/css.d.ts +13 -5
  15. package/dist/css.js +58 -49
  16. package/dist/css.js.map +1 -1
  17. package/dist/index.cjs +2006 -1824
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.css +1 -0
  20. package/dist/index.d.cts +34 -17
  21. package/dist/index.d.ts +34 -17
  22. package/dist/index.js +2002 -1821
  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 +10 -15
  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 +13 -17
  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 +7 -2
  59. package/src/core/components/toast/toastLayer.tsx +3 -2
  60. package/src/core/components/toast/toastProvider.tsx +1 -1
  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 +83 -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/select/select.tsx +2 -2
  120. package/src/core/{components → primitives}/skeleton/__workshop__/index.ts +1 -1
  121. package/src/core/{components → primitives}/skeleton/codeSkeleton.tsx +1 -1
  122. package/src/core/{components → primitives}/skeleton/headingSkeleton.tsx +1 -1
  123. package/src/core/{components → primitives}/skeleton/labelSkeleton.tsx +1 -1
  124. package/src/core/{components → primitives}/skeleton/skeleton.tsx +7 -8
  125. package/src/core/{components → primitives}/skeleton/textSkeleton.tsx +1 -1
  126. package/src/core/primitives/spinner/spinner.tsx +1 -1
  127. package/src/core/primitives/srOnly/srOnly.tsx +1 -1
  128. package/src/core/primitives/stack/stack.tsx +1 -1
  129. package/src/core/primitives/switch/switch.tsx +1 -6
  130. package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
  131. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +17 -42
  132. package/src/core/primitives/text/text.tsx +3 -1
  133. package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
  134. package/src/core/primitives/textArea/textArea.tsx +2 -2
  135. package/src/core/primitives/textInput/textInput.tsx +3 -2
  136. package/src/core/primitives/tooltip/constants.ts +1 -1
  137. package/src/core/primitives/tooltip/tooltip.tsx +5 -3
  138. package/src/core/primitives/tooltip/tooltipLayer.tsx +1 -1
  139. package/src/core/primitives/types.ts +8 -10
  140. package/src/core/types/radius.ts +1 -1
  141. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +9 -5
  142. package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
  143. package/src/core/utils/portal/portal.tsx +1 -1
  144. package/src/css/components/dialog/dialog.css.ts +26 -1
  145. package/src/css/components/dialog/dialog.ts +27 -7
  146. package/src/css/components/skeleton/skeleton.ts +3 -1
  147. package/src/css/components/skeleton/types.ts +3 -1
  148. package/src/css/index.ts +75 -5
  149. package/src/css/primitives/_input/input.ts +2 -1
  150. package/src/css/primitives/_input/types.ts +2 -1
  151. package/src/css/primitives/_selectable/_selectable.css.ts +32 -24
  152. package/src/css/primitives/_selectable/selectable.ts +1 -1
  153. package/src/css/primitives/_selectable/types.ts +1 -1
  154. package/src/css/primitives/avatar/avatar.css.ts +8 -4
  155. package/src/css/primitives/avatar/avatar.ts +1 -1
  156. package/src/css/primitives/badge/types.ts +0 -2
  157. package/src/css/primitives/box/box.ts +35 -37
  158. package/src/css/primitives/box/types.ts +34 -36
  159. package/src/css/primitives/button/button.css.ts +4 -0
  160. package/src/css/primitives/button/button.ts +5 -2
  161. package/src/css/primitives/button/types.ts +4 -11
  162. package/src/css/primitives/card/__workshop__/color.tsx +70 -0
  163. package/src/css/primitives/card/__workshop__/index.ts +14 -0
  164. package/src/css/primitives/card/card.css.ts +4 -0
  165. package/src/css/primitives/code/code.ts +3 -1
  166. package/src/css/primitives/code/types.ts +2 -1
  167. package/src/css/primitives/container/container.ts +3 -1
  168. package/src/css/primitives/heading/heading.ts +4 -1
  169. package/src/css/primitives/heading/types.ts +3 -1
  170. package/src/css/primitives/kbd/kbd.ts +1 -1
  171. package/src/css/primitives/kbd/types.ts +1 -1
  172. package/src/css/primitives/label/label.ts +4 -1
  173. package/src/css/primitives/label/types.ts +3 -1
  174. package/src/css/primitives/switch/switch.css.ts +1 -1
  175. package/src/css/primitives/text/text.ts +6 -1
  176. package/src/css/primitives/text/types.ts +5 -2
  177. package/src/theme/v3/defaultFonts.ts +6 -6
  178. package/src/theme/v3/defaultTokens.ts +1 -1
  179. package/bin/sanity-ui.cjs +0 -5
  180. package/dist/ui.css +0 -1
  181. package/src/cli/buildCommand.ts +0 -10
  182. package/src/cli/index.ts +0 -26
  183. package/src/core/components/autocomplete/index.ts +0 -2
  184. package/src/core/components/index.ts +0 -10
  185. package/src/core/helpers/index.ts +0 -5
  186. package/src/core/hooks/index.ts +0 -13
  187. package/src/core/observers/index.ts +0 -2
  188. package/src/core/primitives/index.ts +0 -30
  189. package/src/core/types/avatar.ts +0 -16
  190. package/src/core/types/card.ts +0 -4
  191. package/src/core/types/index.ts +0 -15
  192. package/src/core/types/popover.ts +0 -4
  193. package/src/core/utils/index.ts +0 -4
  194. package/src/css/__theme/index.ts +0 -16
  195. package/src/css/__theme/lib/contract/buildVarContract.ts +0 -78
  196. package/src/css/__theme/lib/contract/index.ts +0 -4
  197. package/src/css/__theme/lib/contract/types.ts +0 -17
  198. package/src/css/__theme/resolveTheme.ts +0 -865
  199. package/src/css/components/index.ts +0 -6
  200. package/src/css/primitives/index.ts +0 -24
  201. package/src/css/props/index.ts +0 -37
  202. package/src/css/utils/srOnly/index.ts +0 -1
  203. /package/src/core/{global.ts → __DEV__.ts} +0 -0
  204. /package/src/core/{types/dialog.ts → components/dialog/types.ts} +0 -0
  205. /package/src/core/observers/{resizeObserver.ts → resize.ts} +0 -0
  206. /package/src/core/{types/badge.ts → primitives/badge/types2.ts} +0 -0
  207. /package/src/core/{types/box.ts → primitives/box/types.ts} +0 -0
  208. /package/src/core/{types/button.ts → primitives/button/types.ts} +0 -0
  209. /package/src/core/{types/flex.ts → primitives/flex/types.ts} +0 -0
  210. /package/src/core/{types/grid.ts → primitives/grid/types.ts} +0 -0
  211. /package/src/core/{components → primitives}/skeleton/__workshop__/delay.tsx +0 -0
  212. /package/src/core/{components → primitives}/skeleton/__workshop__/skeleton.tsx +0 -0
  213. /package/src/core/{components → primitives}/skeleton/index.ts +0 -0
  214. /package/src/core/types/{text.ts → textAlign.ts} +0 -0
  215. /package/src/css/{utils → primitives/srOnly}/index.ts +0 -0
  216. /package/src/css/{utils → primitives}/srOnly/srOnly.css.ts +0 -0
  217. /package/src/css/{utils → primitives}/srOnly/srOnly.ts +0 -0
@@ -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
 
@@ -1,39 +1,37 @@
1
- import type {
2
- AlignItemsStyleProps,
3
- BorderStyleProps,
4
- BoxSizingStyleProps,
5
- DisplayStyleProps,
6
- FlexDirectionStyleProps,
7
- FlexStyleProps,
8
- FlexWrapStyleProps,
9
- GapStyleProps,
10
- GridAutoColumnsStyleProps,
11
- GridAutoFlowStyleProps,
12
- GridAutoRowsStyleProps,
13
- GridColumnEndStyleProps,
14
- GridColumnStartStyleProps,
15
- GridColumnStyleProps,
16
- GridRowEndStyleProps,
17
- GridRowStartStyleProps,
18
- GridRowStyleProps,
19
- GridTemplateColumnsStyleProps,
20
- GridTemplateRowsStyleProps,
21
- HeightStyleProps,
22
- InsetStyleProps,
23
- JustifyContentStyleProps,
24
- MarginStyleProps,
25
- MaxWidthStyleProps,
26
- MinHeightStyleProps,
27
- MinWidthStyleProps,
28
- OverflowStyleProps,
29
- PaddingStyleProps,
30
- PointerEventsStyleProps,
31
- PositionStyleProps,
32
- RadiusStyleProps,
33
- ShadowStyleProps,
34
- TextAlignStyleProps,
35
- WidthStyleProps,
36
- } from '../../props'
1
+ import type {AlignItemsStyleProps} from '../../props/alignItems'
2
+ import type {BorderStyleProps} from '../../props/border'
3
+ import type {BoxSizingStyleProps} from '../../props/boxSizing'
4
+ import type {DisplayStyleProps} from '../../props/display'
5
+ import type {FlexStyleProps} from '../../props/flex'
6
+ import type {FlexDirectionStyleProps} from '../../props/flexDirection'
7
+ import type {FlexWrapStyleProps} from '../../props/flexWrap'
8
+ import type {GapStyleProps} from '../../props/gap'
9
+ import type {GridAutoColumnsStyleProps} from '../../props/gridAutoColumns'
10
+ import type {GridAutoFlowStyleProps} from '../../props/gridAutoFlow'
11
+ import type {GridAutoRowsStyleProps} from '../../props/gridAutoRows'
12
+ import type {GridColumnStyleProps} from '../../props/gridColumn'
13
+ import type {GridColumnEndStyleProps} from '../../props/gridColumnEnd'
14
+ import type {GridColumnStartStyleProps} from '../../props/gridColumnStart'
15
+ import type {GridRowStyleProps} from '../../props/gridRow'
16
+ import type {GridRowEndStyleProps} from '../../props/gridRowEnd'
17
+ import type {GridRowStartStyleProps} from '../../props/gridRowStart'
18
+ import type {GridTemplateColumnsStyleProps} from '../../props/gridTemplateColumns'
19
+ import type {GridTemplateRowsStyleProps} from '../../props/gridTemplateRows'
20
+ import type {HeightStyleProps} from '../../props/height'
21
+ import type {InsetStyleProps} from '../../props/inset'
22
+ import type {JustifyContentStyleProps} from '../../props/justifyContent'
23
+ import type {MarginStyleProps} from '../../props/margin'
24
+ import type {MaxWidthStyleProps} from '../../props/maxWidth'
25
+ import type {MinHeightStyleProps} from '../../props/minHeight'
26
+ import type {MinWidthStyleProps} from '../../props/minWidth'
27
+ import type {OverflowStyleProps} from '../../props/overflow'
28
+ import type {PaddingStyleProps} from '../../props/padding'
29
+ import type {PointerEventsStyleProps} from '../../props/pointerEvents'
30
+ import type {PositionStyleProps} from '../../props/position'
31
+ import type {RadiusStyleProps} from '../../props/radius'
32
+ import type {ShadowStyleProps} from '../../props/shadow'
33
+ import type {TextAlignStyleProps} from '../../props/textAlign'
34
+ import type {WidthStyleProps} from '../../props/width'
37
35
 
38
36
  /** @public */
39
37
  export interface BoxStyleProps
@@ -24,6 +24,10 @@ export const root = _style(layers.primitives, {
24
24
  backgroundColor: vars.color.bg,
25
25
  color: vars.color.fg,
26
26
 
27
+ //
28
+ transition:
29
+ 'background-color 100ms ease-in-out, box-shadow 100ms ease-in-out, color 100ms ease-in-out',
30
+
27
31
  selectors: {
28
32
  '&::-moz-focus-inner': {
29
33
  border: 0,
@@ -1,5 +1,8 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
- import {display, flex, radius, width} from '../../props'
2
+ import {display} from '../../props/display'
3
+ import {flex} from '../../props/flex'
4
+ import {radius} from '../../props/radius'
5
+ import {width} from '../../props/width'
3
6
  import {loadingBox, modes, root, tones} from './button.css'
4
7
  import type {ButtonStyleProps} from './types'
5
8
 
@@ -10,7 +13,7 @@ export function button(props: ButtonStyleProps) {
10
13
  root,
11
14
  modes[props.mode ?? 'default'],
12
15
  tones[props.tone ?? 'default'],
13
- display(props),
16
+ display({display: 'flex'}),
14
17
  flex(props),
15
18
  radius(props),
16
19
  width(props),
@@ -1,18 +1,11 @@
1
1
  import type {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
2
2
 
3
- import type {
4
- DisplayStyleProps,
5
- FlexStyleProps,
6
- RadiusStyleProps,
7
- WidthStyleProps,
8
- } from '../../props'
3
+ import type {FlexStyleProps} from '../../props/flex'
4
+ import type {RadiusStyleProps} from '../../props/radius'
5
+ import type {WidthStyleProps} from '../../props/width'
9
6
 
10
7
  /** @public */
11
- export interface ButtonStyleProps
12
- extends DisplayStyleProps,
13
- FlexStyleProps,
14
- RadiusStyleProps,
15
- WidthStyleProps {
8
+ export interface ButtonStyleProps extends FlexStyleProps, RadiusStyleProps, WidthStyleProps {
16
9
  className?: string
17
10
  mode?: ThemeColorButtonModeKey
18
11
  tone?: ThemeColorStateToneKey
@@ -0,0 +1,70 @@
1
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
2
+
3
+ import {Box, Card, Code} from '@sanity/ui'
4
+ import {vars} from '@sanity/ui/css'
5
+ import {
6
+ COLOR_VARIANTS,
7
+ THEME_COLOR_CARD_TONES,
8
+ THEME_COLOR_SCHEMES,
9
+ type ThemeColorCardToneKey,
10
+ type ThemeColorSchemeKey,
11
+ type ThemeColorVariantKey,
12
+ } from '@sanity/ui/theme'
13
+ import {useState} from 'react'
14
+
15
+ interface ColorRecordNode extends Record<string, ColorNode> {}
16
+
17
+ type ColorNode = string | ColorRecordNode
18
+
19
+ export default function ColorStory() {
20
+ return (
21
+ <Box display="flex" flexDirection="column" gap={4} padding={4}>
22
+ {Object.entries(vars.color).map(([key, value]) => {
23
+ if (key === 'palette') {
24
+ return null
25
+ }
26
+
27
+ if (THEME_COLOR_SCHEMES.includes(key as ThemeColorSchemeKey)) {
28
+ return null
29
+ }
30
+
31
+ if (THEME_COLOR_CARD_TONES.includes(key as ThemeColorCardToneKey)) {
32
+ return null
33
+ }
34
+
35
+ if (COLOR_VARIANTS.includes(key as ThemeColorVariantKey)) {
36
+ // return null
37
+ }
38
+
39
+ return <ColorBox key={key} node={{key, value}} />
40
+ })}
41
+ </Box>
42
+ )
43
+ }
44
+
45
+ function ColorBox({node}: {node: {key: string; value: ColorNode}}) {
46
+ const {key, value} = node
47
+ const [open, setOpen] = useState(true)
48
+
49
+ if (typeof value === 'string') {
50
+ return (
51
+ <Box radius={2} padding={3} style={{backgroundColor: value}}>
52
+ <Code size={1}>{key}</Code>
53
+ </Box>
54
+ )
55
+ }
56
+
57
+ return (
58
+ <Box overflow="hidden" radius={3} shadow={1}>
59
+ <Card as="button" onClick={() => setOpen(!open)} padding={3}>
60
+ <Code size={1}>{`${key} +`}</Code>
61
+ </Card>
62
+
63
+ <Box display="flex" flexDirection="column" gap={3} hidden={!open} padding={3}>
64
+ {Object.entries(value).map(([key, value]) => (
65
+ <ColorBox key={key} node={{key, value}} />
66
+ ))}
67
+ </Box>
68
+ </Box>
69
+ )
70
+ }
@@ -0,0 +1,14 @@
1
+ import {defineScope} from '@sanity/ui-workshop'
2
+ import {lazy} from 'react'
3
+
4
+ export default defineScope({
5
+ name: 'css/card',
6
+ title: 'Card',
7
+ stories: [
8
+ {
9
+ name: 'color',
10
+ title: 'Color',
11
+ component: lazy(() => import('./color')),
12
+ },
13
+ ],
14
+ })
@@ -19,6 +19,10 @@ export const root = _style(layers.primitives, {
19
19
  backgroundColor: vars.color.bg,
20
20
  color: vars.color.fg,
21
21
 
22
+ //
23
+ transition:
24
+ 'background-color 100ms ease-in-out, border-color 100ms, box-shadow 100ms ease-in-out, color 100ms ease-in-out',
25
+
22
26
  vars: {
23
27
  [vars.color.bg]: vars.color.tinted.default.bg[0],
24
28
  [vars.color.border]: vars.color.tinted.default.border[1],
@@ -1,6 +1,8 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
- import {display, flex, font} from '../../props'
3
+ import {display} from '../../props/display'
4
+ import {flex} from '../../props/flex'
5
+ import {font} from '../../props/font'
4
6
  import {root, scale} from './code.css'
5
7
  import type {CodeStyleProps} from './types'
6
8
 
@@ -1,4 +1,5 @@
1
- import type {FlexStyleProps, FontStyleProps} from '../../props'
1
+ import type {FlexStyleProps} from '../../props/flex'
2
+ import type {FontStyleProps} from '../../props/font'
2
3
  import type {ResponsiveProp} from '../../types'
3
4
 
4
5
  /** @public */
@@ -1,5 +1,7 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
- import {margin, maxWidth, width} from '../../props'
2
+ import {margin} from '../../props/margin'
3
+ import {maxWidth} from '../../props/maxWidth'
4
+ import {width} from '../../props/width'
3
5
  import {root} from './container.css'
4
6
  import type {ContainerStyleProps} from './types'
5
7
 
@@ -1,6 +1,9 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
- import {display, flex, font, textAlign} from '../../props'
3
+ import {display} from '../../props/display'
4
+ import {flex} from '../../props/flex'
5
+ import {font} from '../../props/font'
6
+ import {textAlign} from '../../props/textAlign'
4
7
  import {muted, root, sizes} from './heading.css'
5
8
  import type {HeadingStyleProps} from './types'
6
9
 
@@ -1,4 +1,6 @@
1
- import type {FlexStyleProps, FontStyleProps, TextAlignStyleProps} from '../../props'
1
+ import type {FlexStyleProps} from '../../props/flex'
2
+ import type {FontStyleProps} from '../../props/font'
3
+ import type {TextAlignStyleProps} from '../../props/textAlign'
2
4
  import type {ResponsiveProp} from '../../types'
3
5
 
4
6
  /** @public */
@@ -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} from './kbd.css'
4
4
  import type {KBDStyleProps} from './types'
5
5
 
@@ -1,4 +1,4 @@
1
- import type {RadiusStyleProps} from '../../props'
1
+ import type {RadiusStyleProps} from '../../props/radius'
2
2
 
3
3
  /** @public */
4
4
  export interface KBDStyleProps extends RadiusStyleProps {
@@ -1,6 +1,9 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
- import {display, flex, font, textAlign} from '../../props'
3
+ import {display} from '../../props/display'
4
+ import {flex} from '../../props/flex'
5
+ import {font} from '../../props/font'
6
+ import {textAlign} from '../../props/textAlign'
4
7
  import {muted, root, sizes} from './label.css'
5
8
  import type {LabelStyleProps} from './types'
6
9
 
@@ -1,6 +1,8 @@
1
1
  import type {FontLabelSize} from '@sanity/ui/theme'
2
2
 
3
- import type {FlexStyleProps, FontStyleProps, TextAlignStyleProps} from '../../props'
3
+ import type {FlexStyleProps} from '../../props/flex'
4
+ import type {FontStyleProps} from '../../props/font'
5
+ import type {TextAlignStyleProps} from '../../props/textAlign'
4
6
  import type {ResponsiveProp} from '../../types'
5
7
 
6
8
  /**
@@ -55,7 +55,7 @@ export const presentation = _style(layers.primitives, {
55
55
  },
56
56
  },
57
57
 
58
- [`${input}[data-indeterminate] &`]: {
58
+ [`${input}:indeterminate + &`]: {
59
59
  vars: {
60
60
  [vars.input.switch.thumb.offset]:
61
61
  `calc(${vars.input.switch.width} / 2 - ${vars.input.switch.thumb.size} / 2 - ${vars.input.switch.padding})`,
@@ -1,6 +1,10 @@
1
1
  import {_composeClassNames} from '../../_composeClassNames'
2
2
  import {_responsiveClassName} from '../../_responsiveClassName'
3
- import {display, flex, font, textAlign} from '../../props'
3
+ import {display} from '../../props/display'
4
+ import {flex} from '../../props/flex'
5
+ import {font} from '../../props/font'
6
+ import {maxWidth} from '../../props/maxWidth'
7
+ import {textAlign} from '../../props/textAlign'
4
8
  import {muted, root, sizes} from './text.css'
5
9
  import type {TextStyleProps} from './types'
6
10
 
@@ -14,6 +18,7 @@ export function text(props: TextStyleProps): string | undefined {
14
18
  display({display: 'block'}),
15
19
  flex(props),
16
20
  font(props),
21
+ maxWidth(props),
17
22
  textAlign({textAlign: props.align}),
18
23
  )
19
24
  }
@@ -1,11 +1,14 @@
1
- import type {FlexStyleProps, FontStyleProps, TextAlignStyleProps} from '../../props'
1
+ import type {FlexStyleProps} from '../../props/flex'
2
+ import type {FontStyleProps} from '../../props/font'
3
+ import type {MaxWidthStyleProps} from '../../props/maxWidth'
4
+ import type {TextAlignStyleProps} from '../../props/textAlign'
2
5
  import type {ResponsiveProp} from '../../types'
3
6
 
4
7
  /** @public */
5
8
  export type TextSize = number
6
9
 
7
10
  /** @public */
8
- export interface TextStyleProps extends FlexStyleProps, FontStyleProps {
11
+ export interface TextStyleProps extends FlexStyleProps, FontStyleProps, MaxWidthStyleProps {
9
12
  /**
10
13
  * @deprecated Will be removed in next major version
11
14
  */
@@ -40,7 +40,7 @@ export const defaultThemeFonts: ThemeFonts_v3 = {
40
40
  {
41
41
  ascenderHeight: 7,
42
42
  descenderHeight: 7,
43
- fontSize: 19,
43
+ fontSize: 18.75,
44
44
  iconSize: 29,
45
45
  lineHeight: 27,
46
46
  letterSpacing: 0,
@@ -49,7 +49,7 @@ export const defaultThemeFonts: ThemeFonts_v3 = {
49
49
  {
50
50
  ascenderHeight: 8,
51
51
  descenderHeight: 8,
52
- fontSize: 22,
52
+ fontSize: 21.5,
53
53
  iconSize: 33,
54
54
  lineHeight: 31,
55
55
  letterSpacing: 0,
@@ -203,7 +203,7 @@ export const defaultThemeFonts: ThemeFonts_v3 = {
203
203
  {
204
204
  ascenderHeight: 4,
205
205
  descenderHeight: 4,
206
- fontSize: 10,
206
+ fontSize: 9.75,
207
207
  iconSize: 17,
208
208
  lineHeight: 15,
209
209
  letterSpacing: 0,
@@ -212,7 +212,7 @@ export const defaultThemeFonts: ThemeFonts_v3 = {
212
212
  {
213
213
  ascenderHeight: 5,
214
214
  descenderHeight: 5,
215
- fontSize: 13,
215
+ fontSize: 12.5,
216
216
  iconSize: 21,
217
217
  lineHeight: 19,
218
218
  letterSpacing: 0,
@@ -221,7 +221,7 @@ export const defaultThemeFonts: ThemeFonts_v3 = {
221
221
  {
222
222
  ascenderHeight: 6,
223
223
  descenderHeight: 6,
224
- fontSize: 15,
224
+ fontSize: 15.25,
225
225
  iconSize: 25,
226
226
  lineHeight: 23,
227
227
  letterSpacing: 0,
@@ -239,7 +239,7 @@ export const defaultThemeFonts: ThemeFonts_v3 = {
239
239
  {
240
240
  ascenderHeight: 8,
241
241
  descenderHeight: 8,
242
- fontSize: 21,
242
+ fontSize: 20.75,
243
243
  iconSize: 33,
244
244
  lineHeight: 31,
245
245
  letterSpacing: 0,