@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,7 +1,7 @@
1
1
  import {codeSkeleton, type ResponsiveProp} from '@sanity/ui/css'
2
2
  import type {FontCodeSize} from '@sanity/ui/theme'
3
3
 
4
- import type {Props} from '../../types'
4
+ import type {Props} from '../../types/props'
5
5
  import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
6
6
 
7
7
  /** @beta */
@@ -1,7 +1,7 @@
1
1
  import {headingSkeleton, type ResponsiveProp} from '@sanity/ui/css'
2
2
  import type {FontHeadingSize} from '@sanity/ui/theme'
3
3
 
4
- import type {Props} from '../../types'
4
+ import type {Props} from '../../types/props'
5
5
  import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
6
6
 
7
7
  /** @beta */
@@ -1,7 +1,7 @@
1
1
  import {labelSkeleton, type ResponsiveProp} from '@sanity/ui/css'
2
2
  import type {FontLabelSize} from '@sanity/ui/theme'
3
3
 
4
- import type {Props} from '../../types'
4
+ import type {Props} from '../../types/props'
5
5
  import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
6
6
 
7
7
  /** @beta */
@@ -1,8 +1,7 @@
1
1
  import {skeleton, type SkeletonStyleProps} from '@sanity/ui/css'
2
2
  import {useEffect, useState} from 'react'
3
3
 
4
- import {Box, type BoxOwnProps} from '../../primitives'
5
- import type {ComponentType, Props} from '../../types'
4
+ import type {ComponentType, Props} from '../../types/props'
6
5
 
7
6
  /** @beta */
8
7
  export const DEFAULT_SKELETON_ELEMENT = 'div'
@@ -11,11 +10,10 @@ export const DEFAULT_SKELETON_ELEMENT = 'div'
11
10
  * This API might change. DO NOT USE IN PRODUCTION.
12
11
  * @beta
13
12
  */
14
- export type SkeletonOwnProps = BoxOwnProps &
15
- SkeletonStyleProps & {
16
- animated?: boolean
17
- delay?: number
18
- }
13
+ export type SkeletonOwnProps = SkeletonStyleProps & {
14
+ animated?: boolean
15
+ delay?: number
16
+ }
19
17
 
20
18
  /** @beta */
21
19
  export type SkeletonElementType = 'div' | 'span' | ComponentType
@@ -34,6 +32,7 @@ export function Skeleton<E extends SkeletonElementType = typeof DEFAULT_SKELETON
34
32
  props: SkeletonProps<E>,
35
33
  ) {
36
34
  const {
35
+ as: As = DEFAULT_SKELETON_ELEMENT,
37
36
  animated = false,
38
37
  className,
39
38
  delay,
@@ -58,7 +57,7 @@ export function Skeleton<E extends SkeletonElementType = typeof DEFAULT_SKELETON
58
57
  }, [delay])
59
58
 
60
59
  return (
61
- <Box
60
+ <As
62
61
  data-ui="Skeleton"
63
62
  {...rest}
64
63
  className={skeleton({
@@ -1,7 +1,7 @@
1
1
  import {type ResponsiveProp, textSkeleton} from '@sanity/ui/css'
2
2
  import type {FontTextSize} from '@sanity/ui/theme'
3
3
 
4
- import type {Props} from '../../types'
4
+ import type {Props} from '../../types/props'
5
5
  import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
6
6
 
7
7
  /** @beta */
@@ -1,7 +1,7 @@
1
1
  import {type ResponsiveProp, spinner} from '@sanity/ui/css'
2
2
  import type {FontTextSize} from '@sanity/ui/theme'
3
3
 
4
- import type {ComponentType, Props} from '../../types'
4
+ import type {ComponentType, Props} from '../../types/props'
5
5
  import {Text} from '../text'
6
6
  import {AnimatedSpinnerIcon} from './animatedSpinnerIcon'
7
7
 
@@ -1,6 +1,6 @@
1
1
  import {srOnly} from '@sanity/ui/css'
2
2
 
3
- import type {ComponentType, Props} from '../../types'
3
+ import type {ComponentType, Props} from '../../types/props'
4
4
 
5
5
  /** @public */
6
6
  export const DEFAULT_SR_ONLY_ELEMENT = 'span'
@@ -1,7 +1,7 @@
1
1
  import {type ResponsiveProp, stack} from '@sanity/ui/css'
2
2
  import type {Space} from '@sanity/ui/theme'
3
3
 
4
- import type {Props} from '../../types'
4
+ import type {Props} from '../../types/props'
5
5
  import {Box, type BoxElementType, type BoxOwnProps} from '../box'
6
6
 
7
7
  /** @public */
@@ -7,7 +7,7 @@ import {
7
7
  } from '@sanity/ui/css'
8
8
  import {useEffect, useImperativeHandle, useRef} from 'react'
9
9
 
10
- import type {ComponentType, Props} from '../../types'
10
+ import type {ComponentType, Props} from '../../types/props'
11
11
  import {Box} from '../box'
12
12
 
13
13
  /** @public */
@@ -36,7 +36,6 @@ export function Switch<E extends SwitchElementType = typeof DEFAULT_SWITCH_ELEME
36
36
  ) {
37
37
  const {
38
38
  as: Element = DEFAULT_SWITCH_ELEMENT,
39
- checked,
40
39
  className,
41
40
  disabled,
42
41
  indeterminate,
@@ -63,8 +62,6 @@ export function Switch<E extends SwitchElementType = typeof DEFAULT_SWITCH_ELEME
63
62
  return (
64
63
  <Box
65
64
  className={_switch({className})}
66
- data-checked={checked ? '' : undefined}
67
- data-indeterminate={indeterminate ? '' : undefined}
68
65
  data-ui="Switch"
69
66
  display="block"
70
67
  position="relative"
@@ -72,9 +69,7 @@ export function Switch<E extends SwitchElementType = typeof DEFAULT_SWITCH_ELEME
72
69
  >
73
70
  <Element
74
71
  {...rest}
75
- checked={indeterminate !== true && checked}
76
72
  className={_switchElement()}
77
- data-disabled={disabled ? '' : undefined}
78
73
  data-read-only={!disabled && readOnly ? '' : undefined}
79
74
  disabled={disabled || readOnly}
80
75
  type="checkbox"
@@ -1,5 +1,5 @@
1
1
  import {Flex, Text} from '@sanity/ui'
2
- import {varNames, vars} from '@sanity/ui/css'
2
+ import {vars} from '@sanity/ui/css'
3
3
  import type {AvatarColor} from '@sanity/ui/theme'
4
4
  import {useSelect} from '@sanity/ui-workshop'
5
5
  import {styled} from 'styled-components'
@@ -7,7 +7,7 @@ import {styled} from 'styled-components'
7
7
  import {WORKSHOP_AVATAR_COLOR_OPTIONS} from '$workshop'
8
8
 
9
9
  const ColoredText = styled(Text)<{$color: AvatarColor}>`
10
- ${varNames.color.fg}: ${({$color}) => vars.color.avatar[$color].bg};
10
+ ${vars.color.fg.slice(4, -1)}: ${({$color}) => vars.color.avatar[$color].bg};
11
11
  `
12
12
 
13
13
  export default function ColoredTextStory() {
@@ -1,48 +1,23 @@
1
- import {AddCircleIcon} from '@sanity/icons'
2
- import {Box, Card, Flex, Stack, Text} from '@sanity/ui'
1
+ import {CropIcon} from '@sanity/icons'
2
+ import {Box, Stack, Text} from '@sanity/ui'
3
+ import {vars} from '@sanity/ui/css'
4
+ import {FONT_TEXT_SIZE} from '@sanity/ui/theme'
3
5
 
4
6
  export default function OpticalAlignment() {
5
7
  return (
6
- <Box padding={[4, 5, 6]}>
7
- <Stack gap={1}>
8
- <Flex>
9
- <Card padding={0} tone="neutral">
10
- <Text size={4}>Hamburgefonstiv M</Text>
11
- </Card>
12
- </Flex>
13
-
14
- <Flex>
15
- <Card padding={0} tone="neutral">
16
- <Text size={3}>Hamburgefonstiv M</Text>
17
- </Card>
18
- </Flex>
19
-
20
- <Flex>
21
- <Card padding={0} tone="neutral">
22
- <Text size={2}>Hamburgefonstiv M</Text>
23
- </Card>
24
- </Flex>
25
-
26
- <Flex>
27
- <Card padding={0} tone="neutral">
28
- <Text size={1}>Hamburgefonstiv M</Text>
29
- </Card>
30
- </Flex>
31
-
32
- <Flex>
33
- <Card padding={0} tone="neutral">
34
- <Text size={0}>Hamburgefonstiv M</Text>
35
- </Card>
36
- </Flex>
37
-
38
- <Flex>
39
- <Card padding={2} tone="neutral">
40
- <Text>
41
- <AddCircleIcon />
8
+ <Stack gap={4} padding={[4, 5, 6]}>
9
+ {FONT_TEXT_SIZE.map((size) => (
10
+ <Box display="flex" gap={2} key={size}>
11
+ <div style={{outline: `0.5px solid ${vars.color.tinted.suggest.border[4]}`}}>
12
+ <Text size={size}>
13
+ <CropIcon />
42
14
  </Text>
43
- </Card>
44
- </Flex>
45
- </Stack>
46
- </Box>
15
+ </div>
16
+ <div style={{outline: `0.5px solid ${vars.color.tinted.suggest.border[4]}`}}>
17
+ <Text size={size}>Hamburgefonstiv M</Text>
18
+ </div>
19
+ </Box>
20
+ ))}
21
+ </Stack>
47
22
  )
48
23
  }
@@ -1,6 +1,6 @@
1
1
  import {text, textOverflow, type TextOverflowStyleProps, type TextStyleProps} from '@sanity/ui/css'
2
2
 
3
- import type {ComponentType, Props} from '../../types'
3
+ import type {ComponentType, Props} from '../../types/props'
4
4
 
5
5
  /** @public */
6
6
  export const DEFAULT_TEXT_ELEMENT = 'div'
@@ -39,6 +39,7 @@ export function Text<E extends TextElementType = typeof DEFAULT_TEXT_ELEMENT>(pr
39
39
  children,
40
40
  className,
41
41
  flex,
42
+ maxWidth = 'fill',
42
43
  muted,
43
44
  size = 2,
44
45
  textOverflow: textOverflowProp,
@@ -55,6 +56,7 @@ export function Text<E extends TextElementType = typeof DEFAULT_TEXT_ELEMENT>(pr
55
56
  accent,
56
57
  align,
57
58
  flex,
59
+ maxWidth,
58
60
  muted,
59
61
  size,
60
62
  weight,
@@ -26,10 +26,10 @@ export default function PlainStory() {
26
26
 
27
27
  return (
28
28
  <Card
29
- align="center"
29
+ alignItems="center"
30
30
  display="flex"
31
31
  height="fill"
32
- justify="center"
32
+ justifyContent="center"
33
33
  padding={[4, 5, 6]}
34
34
  sizing="border"
35
35
  tone={tone}
@@ -8,8 +8,8 @@ import {
8
8
  import type {Space} from '@sanity/ui/theme'
9
9
  import {useImperativeHandle, useRef} from 'react'
10
10
 
11
- import {useCustomValidity} from '../../hooks'
12
- import type {ComponentType, Props} from '../../types'
11
+ import {useCustomValidity} from '../../hooks/useCustomValidity'
12
+ import type {ComponentType, Props} from '../../types/props'
13
13
 
14
14
  /** @public */
15
15
  export const DEFAULT_TEXT_AREA_ELEMENT = 'textarea'
@@ -23,9 +23,10 @@ import {
23
23
  import {isValidElementType} from 'react-is'
24
24
 
25
25
  import {EMPTY_RECORD} from '../../constants'
26
- import {useCustomValidity, useResponsiveProp} from '../../hooks'
26
+ import {useCustomValidity} from '../../hooks/useCustomValidity'
27
+ import {useResponsiveProp} from '../../hooks/useResponsiveProp'
27
28
  import {isRecord} from '../../lib/isRecord'
28
- import type {ComponentType, Props} from '../../types'
29
+ import type {ComponentType, Props} from '../../types/props'
29
30
  import {Box} from '../box'
30
31
  import {Button, type ButtonProps} from '../button'
31
32
  import {Text} from '../text'
@@ -1,4 +1,4 @@
1
- import type {Placement} from '../../types'
1
+ import type {Placement} from '../../types/placement'
2
2
 
3
3
  export const DEFAULT_TOOLTIP_ARROW_WIDTH = 15
4
4
  export const DEFAULT_TOOLTIP_ARROW_HEIGHT = 6
@@ -31,12 +31,14 @@ import {
31
31
  import {useEffectEvent} from 'use-effect-event'
32
32
 
33
33
  import {Z_OFFSETS} from '../../constants'
34
- import {usePrefersReducedMotion} from '../../hooks'
35
34
  import {useDelayedState} from '../../hooks/useDelayedState'
35
+ import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
36
36
  import {origin} from '../../middleware/origin'
37
- import type {ComponentType, Placement, Props} from '../../types'
38
- import {Portal, useBoundaryElement, usePortal} from '../../utils'
37
+ import type {Placement} from '../../types/placement'
38
+ import type {ComponentType, Props} from '../../types/props'
39
+ import {useBoundaryElement} from '../../utils/boundaryElement'
39
40
  import {getElementRef} from '../../utils/getElementRef'
41
+ import {Portal, usePortal} from '../../utils/portal'
40
42
  import {CardProvider, useCard} from '../card'
41
43
  import type {LayerOwnProps} from '../layer'
42
44
  import type {Delay} from '../types'
@@ -2,7 +2,7 @@ import {motion, type MotionStyle} from 'framer-motion'
2
2
  import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
3
3
 
4
4
  import {POPOVER_MOTION_PROPS} from '../../constants'
5
- import type {Placement} from '../../types'
5
+ import type {Placement} from '../../types/placement'
6
6
  import {Arrow} from '../arrow'
7
7
  import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
8
8
  import {
@@ -1,8 +1,14 @@
1
1
  import type {
2
2
  AlignItems,
3
+ BoxHeight,
4
+ BoxOverflow,
5
+ BoxSizing,
3
6
  Flex,
4
7
  FlexDirection,
5
8
  FlexWrap,
9
+ GridAutoCols,
10
+ GridAutoFlow,
11
+ GridAutoRows,
6
12
  GridItemColumn,
7
13
  GridItemColumnEnd,
8
14
  GridItemColumnStart,
@@ -11,17 +17,9 @@ import type {
11
17
  GridItemRowStart,
12
18
  JustifyContent,
13
19
  } from '@sanity/ui/css'
20
+ import type {Radius} from '@sanity/ui/theme'
14
21
 
15
- import type {
16
- BoxDisplay,
17
- BoxHeight,
18
- BoxOverflow,
19
- BoxSizing,
20
- GridAutoCols,
21
- GridAutoFlow,
22
- GridAutoRows,
23
- Radius,
24
- } from '../types'
22
+ import type {BoxDisplay} from './box/types'
25
23
 
26
24
  /**
27
25
  * @public
@@ -1,7 +1,7 @@
1
1
  export {
2
2
  /**
3
3
  * @public
4
- * @deprecated
4
+ * @deprecated Use `Radius` from `@sanity/ui/theme` instead.
5
5
  */
6
6
  type Radius,
7
7
  } from '@sanity/ui/theme'
@@ -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
 
package/src/css/index.ts CHANGED
@@ -1,14 +1,84 @@
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
 
10
6
  export * from './defaultTheme.css'
11
7
 
8
+ // props
9
+ export * from './props/alignItems'
10
+ export * from './props/border'
11
+ export * from './props/boxSizing'
12
+ export * from './props/display'
13
+ export * from './props/flex'
14
+ export * from './props/flexDirection'
15
+ export * from './props/flexWrap'
16
+ export * from './props/font'
17
+ export * from './props/gap'
18
+ export * from './props/gridAutoColumns'
19
+ export * from './props/gridAutoFlow'
20
+ export * from './props/gridAutoRows'
21
+ export * from './props/gridColumn'
22
+ export * from './props/gridColumnEnd'
23
+ export * from './props/gridColumnStart'
24
+ export * from './props/gridRow'
25
+ export * from './props/gridRowEnd'
26
+ export * from './props/gridRowStart'
27
+ export * from './props/gridTemplateColumns'
28
+ export * from './props/gridTemplateRows'
29
+ export * from './props/height'
30
+ export * from './props/inset'
31
+ export * from './props/justifyContent'
32
+ export * from './props/margin'
33
+ export * from './props/maxWidth'
34
+ export * from './props/minHeight'
35
+ export * from './props/minWidth'
36
+ export * from './props/outline'
37
+ export * from './props/overflow'
38
+ export * from './props/padding'
39
+ export * from './props/pointerEvents'
40
+ export * from './props/position'
41
+ export * from './props/radius'
42
+ export * from './props/shadow'
43
+ export * from './props/textAlign'
44
+ export * from './props/textOverflow'
45
+ export * from './props/width'
46
+
47
+ // primitives
48
+ export * from './primitives/_arrow'
49
+ export * from './primitives/_input'
50
+ export * from './primitives/_selectable'
51
+ export * from './primitives/avatar'
52
+ export * from './primitives/badge'
53
+ export * from './primitives/box'
54
+ export * from './primitives/button'
55
+ export * from './primitives/card'
56
+ export * from './primitives/checkbox'
57
+ export * from './primitives/code'
58
+ export * from './primitives/container'
59
+ export * from './primitives/heading'
60
+ export * from './primitives/kbd'
61
+ export * from './primitives/label'
62
+ export * from './primitives/popover'
63
+ export * from './primitives/radio'
64
+ export * from './primitives/select'
65
+ export * from './primitives/spinner'
66
+ export * from './primitives/srOnly'
67
+ export * from './primitives/stack'
68
+ export * from './primitives/switch'
69
+ export * from './primitives/text'
70
+ export * from './primitives/textArea'
71
+ export * from './primitives/textInput'
72
+ export * from './primitives/tooltip'
73
+
74
+ // components
75
+ export * from './components/breadcrumbs'
76
+ export * from './components/dialog'
77
+ export * from './components/menu'
78
+ export * from './components/skeleton'
79
+ export * from './components/toast'
80
+ export * from './components/tree'
81
+
12
82
  export * from './constants'
13
83
  export * from './types'
14
84
  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