@sanity/ui 4.2.0 → 5.0.0-alpha.10

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 (339) hide show
  1. package/README.md +194 -28
  2. package/bin/sanity-ui.js +14 -0
  3. package/dist/_chunks-es/LazyRefractor.js +20 -0
  4. package/dist/_chunks-es/LazyRefractor.js.map +1 -0
  5. package/dist/cli/checks.js +148 -0
  6. package/dist/cli/config.js +23 -0
  7. package/dist/cli/detect.js +181 -0
  8. package/dist/cli/doctor.js +49 -0
  9. package/dist/cli/index.js +69 -0
  10. package/dist/cli/init.js +189 -0
  11. package/dist/cli/install.js +79 -0
  12. package/dist/cli/log.js +66 -0
  13. package/dist/cli/selfPackage.js +11 -0
  14. package/dist/cli/styles.js +185 -0
  15. package/dist/cli/test-utils.js +8 -0
  16. package/dist/cli/tsconfig.js +236 -0
  17. package/dist/cli/types.js +1 -0
  18. package/dist/cli/versions.js +45 -0
  19. package/dist/index.d.ts +1203 -1469
  20. package/dist/index.js +2123 -1989
  21. package/dist/index.js.map +1 -1
  22. package/dist/polyfills.d.ts +1 -0
  23. package/dist/polyfills.js +5 -0
  24. package/dist/polyfills.js.map +1 -0
  25. package/dist/styles.css +1 -547
  26. package/package.json +57 -58
  27. package/src/cli/checks.test.ts +38 -0
  28. package/src/cli/checks.ts +200 -0
  29. package/src/cli/config.ts +44 -0
  30. package/src/cli/detect.test.ts +191 -0
  31. package/src/cli/detect.ts +205 -0
  32. package/src/cli/doctor.test.ts +52 -0
  33. package/src/cli/doctor.ts +65 -0
  34. package/src/cli/index.ts +77 -0
  35. package/src/cli/init.ts +225 -0
  36. package/src/cli/install.test.ts +52 -0
  37. package/src/cli/install.ts +108 -0
  38. package/src/cli/log.ts +79 -0
  39. package/src/cli/selfPackage.ts +14 -0
  40. package/src/cli/styles.test.ts +130 -0
  41. package/src/cli/styles.ts +205 -0
  42. package/src/cli/test-utils.ts +10 -0
  43. package/src/cli/tsconfig.test.ts +174 -0
  44. package/src/cli/tsconfig.ts +282 -0
  45. package/src/cli/types.ts +77 -0
  46. package/src/cli/versions.test.ts +35 -0
  47. package/src/cli/versions.ts +41 -0
  48. package/src/components/badge/Badge.tsx +53 -0
  49. package/src/components/badge/badge.css +6 -0
  50. package/src/components/badge/badge.props.ts +31 -0
  51. package/src/components/box/Box.tsx +30 -0
  52. package/src/components/box/box.css +4 -0
  53. package/src/components/box/box.props.ts +29 -0
  54. package/src/components/button/Button.tsx +78 -0
  55. package/src/components/button/button.css +72 -0
  56. package/src/components/button/button.props.ts +122 -0
  57. package/src/components/card/Card.tsx +31 -0
  58. package/src/components/card/card.css +4 -0
  59. package/src/components/card/card.props.ts +58 -0
  60. package/src/components/checkbox/Checkbox.tsx +64 -0
  61. package/src/components/checkbox/checkbox.css +100 -0
  62. package/src/components/checkbox/checkbox.props.ts +33 -0
  63. package/src/components/code/Code.tsx +38 -0
  64. package/src/components/code/LazyRefractor.tsx +9 -0
  65. package/src/components/code/code.css +40 -0
  66. package/src/components/code/code.props.ts +44 -0
  67. package/src/components/container/Container.tsx +30 -0
  68. package/src/components/container/container.css +4 -0
  69. package/src/components/container/container.props.ts +28 -0
  70. package/src/components/dialog/Dialog.tsx +139 -0
  71. package/src/components/dialog/dialog.css +49 -0
  72. package/src/components/dialog/dialog.props.ts +45 -0
  73. package/src/components/divider/Divider.tsx +23 -0
  74. package/src/components/divider/divider.props.ts +9 -0
  75. package/src/components/eyebrow/Eyebrow.tsx +54 -0
  76. package/src/components/eyebrow/eyebrow.css +11 -0
  77. package/src/components/eyebrow/eyebrow.props.ts +28 -0
  78. package/src/components/flex/Flex.tsx +30 -0
  79. package/src/components/flex/flex.css +4 -0
  80. package/src/components/flex/flex.props.ts +33 -0
  81. package/src/components/grid/Grid.tsx +30 -0
  82. package/src/components/grid/grid.css +4 -0
  83. package/src/components/grid/grid.props.ts +33 -0
  84. package/src/components/h-stack/HStack.tsx +34 -0
  85. package/src/components/h-stack/hStack.props.ts +17 -0
  86. package/src/components/heading/Heading.tsx +54 -0
  87. package/src/components/heading/heading.css +9 -0
  88. package/src/components/heading/heading.props.ts +31 -0
  89. package/src/components/icon/Icon.tsx +24 -0
  90. package/src/components/icon/icon.css +17 -0
  91. package/src/components/icon/icon.props.ts +35 -0
  92. package/src/components/icon-button/IconButton.tsx +32 -0
  93. package/src/components/icon-button/iconButton.props.ts +31 -0
  94. package/src/components/index.css +28 -0
  95. package/src/components/indicator/Indicator.tsx +42 -0
  96. package/src/components/indicator/indicator.css +4 -0
  97. package/src/components/indicator/indicator.props.ts +24 -0
  98. package/src/components/indicator-stack/IndicatorStack.tsx +31 -0
  99. package/src/components/indicator-stack/indicator-stack.css +7 -0
  100. package/src/components/indicator-stack/indicatorStack.props.ts +15 -0
  101. package/src/components/inline/Inline.tsx +38 -0
  102. package/src/components/inline/inline.css +4 -0
  103. package/src/components/inline/inline.props.ts +100 -0
  104. package/src/components/label/Label.tsx +34 -0
  105. package/src/components/label/label.css +3 -0
  106. package/src/components/label/label.props.ts +25 -0
  107. package/src/components/link/Link.tsx +29 -0
  108. package/src/components/link/link.css +12 -0
  109. package/src/components/link/link.props.ts +23 -0
  110. package/src/components/list/List.tsx +167 -0
  111. package/src/components/list/list.css +25 -0
  112. package/src/components/list/list.props.ts +130 -0
  113. package/src/components/popover/Popover.tsx +85 -0
  114. package/src/components/popover/popover.css +21 -0
  115. package/src/components/popover/popover.props.ts +38 -0
  116. package/src/components/press-area/PressArea.tsx +29 -0
  117. package/src/components/press-area/press-area.css +22 -0
  118. package/src/components/press-area/pressArea.props.ts +16 -0
  119. package/src/components/radio/Radio.tsx +48 -0
  120. package/src/components/radio/radio.css +97 -0
  121. package/src/components/radio/radio.props.ts +25 -0
  122. package/src/components/skip-to-content/SkipToContent.tsx +35 -0
  123. package/src/components/skip-to-content/skip-to-content.css +9 -0
  124. package/src/components/skip-to-content/skipToContent.props.ts +25 -0
  125. package/src/components/spinner/Spinner.tsx +28 -0
  126. package/src/components/spinner/spinner.css +10 -0
  127. package/src/components/spinner/spinner.props.ts +19 -0
  128. package/src/components/switch/Switch.tsx +48 -0
  129. package/src/components/switch/switch.css +119 -0
  130. package/src/components/switch/switch.props.ts +25 -0
  131. package/src/components/text/Text.tsx +53 -0
  132. package/src/components/text/text.css +9 -0
  133. package/src/components/text/text.props.ts +28 -0
  134. package/src/components/tooltip/Tooltip.tsx +97 -0
  135. package/src/components/tooltip/tooltip.css +31 -0
  136. package/src/components/tooltip/tooltip.props.ts +36 -0
  137. package/src/components/tooltip-group/TooltipGroup.tsx +64 -0
  138. package/src/components/tooltip-group/tooltipGroup.props.ts +15 -0
  139. package/src/components/v-stack/VStack.tsx +32 -0
  140. package/src/components/v-stack/vStack.props.ts +17 -0
  141. package/src/components/visually-hidden/VisuallyHidden.tsx +29 -0
  142. package/src/components/visually-hidden/visually-hidden.css +9 -0
  143. package/src/components/visually-hidden/visuallyHidden.props.ts +23 -0
  144. package/src/css/classes/dynamic/flex-child.css +5 -0
  145. package/src/css/classes/dynamic/grid-child.css +8 -0
  146. package/src/css/classes/dynamic/grid-parent.css +6 -0
  147. package/src/css/classes/dynamic/height.css +5 -0
  148. package/src/css/classes/dynamic/index.css +7 -0
  149. package/src/css/classes/dynamic/line-clamp.css +5 -0
  150. package/src/css/classes/dynamic/readme.md +3 -0
  151. package/src/css/classes/dynamic/width.css +7 -0
  152. package/src/css/classes/dynamic/z-index.css +3 -0
  153. package/src/css/classes/generic/display.css +10 -0
  154. package/src/css/classes/generic/flex.css +24 -0
  155. package/src/css/classes/generic/grid.css +7 -0
  156. package/src/css/classes/generic/index.css +7 -0
  157. package/src/css/classes/generic/overflow.css +19 -0
  158. package/src/css/classes/generic/placement.css +202 -0
  159. package/src/css/classes/generic/position.css +7 -0
  160. package/src/css/classes/generic/readme.md +3 -0
  161. package/src/css/classes/generic/text-align.css +5 -0
  162. package/src/css/classes/index.css +4 -0
  163. package/src/css/classes/local/animation.css +4 -0
  164. package/src/css/classes/local/border.css +20 -0
  165. package/src/css/classes/local/index.css +6 -0
  166. package/src/css/classes/local/readme.md +3 -0
  167. package/src/css/classes/local/text-overflow.css +5 -0
  168. package/src/css/classes/local/text-trim.css +45 -0
  169. package/src/css/classes/local/tone.css +75 -0
  170. package/src/css/classes/local/top-anchor.css +4 -0
  171. package/src/css/classes/system/color.css +223 -0
  172. package/src/css/classes/system/container.css +8 -0
  173. package/src/css/classes/system/font-family.css +2 -0
  174. package/src/css/classes/system/font-weight.css +4 -0
  175. package/src/css/classes/system/gap.css +37 -0
  176. package/src/css/classes/system/index.css +10 -0
  177. package/src/css/classes/system/inset.css +56 -0
  178. package/src/css/classes/system/margin.css +148 -0
  179. package/src/css/classes/system/padding.css +78 -0
  180. package/src/css/classes/system/radius.css +10 -0
  181. package/src/css/classes/system/readme.md +3 -0
  182. package/src/css/classes/system/shadow.css +6 -0
  183. package/src/css/classes/system/typography.css +31 -0
  184. package/src/css/global/font-face.css +20 -0
  185. package/src/css/global/index.css +2 -0
  186. package/src/css/global/reset.css +76 -0
  187. package/src/css/tokens/index.css +3 -0
  188. package/src/css/tokens/opacity.css +6 -0
  189. package/src/css/tokens/semantic.css +25 -0
  190. package/src/css/tokens/surface.css +27 -0
  191. package/src/hooks/useIsClient.ts +10 -0
  192. package/src/index.css +18 -0
  193. package/src/index.ts +65 -0
  194. package/src/polyfills.ts +15 -0
  195. package/src/props/border.ts +51 -0
  196. package/src/props/flexChild.ts +29 -0
  197. package/src/props/flexParent.ts +47 -0
  198. package/src/props/gap.ts +31 -0
  199. package/src/props/gridChild.ts +50 -0
  200. package/src/props/gridParent.ts +45 -0
  201. package/src/props/height.ts +29 -0
  202. package/src/props/layout.ts +44 -0
  203. package/src/props/margin.ts +59 -0
  204. package/src/props/overflow.ts +30 -0
  205. package/src/props/padding.ts +59 -0
  206. package/src/props/placement.ts +16 -0
  207. package/src/props/position.ts +52 -0
  208. package/src/props/shadow.ts +15 -0
  209. package/src/props/tone.ts +15 -0
  210. package/src/props/typography.ts +62 -0
  211. package/src/props/width.ts +29 -0
  212. package/src/props/zIndex.ts +15 -0
  213. package/src/styles.css.d.ts +1 -0
  214. package/src/styles.css.node.js +2 -0
  215. package/src/styles.css.test.ts +24 -0
  216. package/src/types/Button.ts +8 -0
  217. package/src/types/Code.ts +6 -0
  218. package/src/types/Container.ts +3 -0
  219. package/src/types/Density.ts +3 -0
  220. package/src/types/Display.ts +11 -0
  221. package/src/types/Eyebrow.ts +3 -0
  222. package/src/types/Flex.ts +22 -0
  223. package/src/types/FontWeight.ts +3 -0
  224. package/src/types/Grid.ts +3 -0
  225. package/src/types/Heading.ts +6 -0
  226. package/src/types/Icon.ts +3 -0
  227. package/src/types/Interactive.ts +8 -0
  228. package/src/types/List.ts +2 -0
  229. package/src/types/Overflow.ts +3 -0
  230. package/src/types/Placement.ts +16 -0
  231. package/src/types/Position.ts +3 -0
  232. package/src/types/PropDef.ts +73 -0
  233. package/src/types/Radius.ts +3 -0
  234. package/src/types/Responsive.ts +10 -0
  235. package/src/types/Shadow.ts +3 -0
  236. package/src/types/Space.ts +15 -0
  237. package/src/types/Text.ts +3 -0
  238. package/src/types/TextAlign.ts +3 -0
  239. package/src/types/Tone.ts +3 -0
  240. package/src/utils/getProps.test.ts +156 -0
  241. package/src/utils/getProps.ts +156 -0
  242. package/src/utils/mergeTriggerProps.ts +66 -0
  243. package/src/utils/renderPortal.tsx +14 -0
  244. package/src/utils/suffixClassName.ts +5 -0
  245. package/src/version.ts +3 -0
  246. package/LICENSE +0 -21
  247. package/dist/_system-CTe2lb5l.d.ts +0 -40
  248. package/dist/_system-CTe2lb5l.d.ts.map +0 -1
  249. package/dist/arrow-BmX6qbAS.js +0 -170
  250. package/dist/arrow-BmX6qbAS.js.map +0 -1
  251. package/dist/autocomplete.d.ts +0 -140
  252. package/dist/autocomplete.d.ts.map +0 -1
  253. package/dist/autocomplete.js +0 -470
  254. package/dist/autocomplete.js.map +0 -1
  255. package/dist/breadcrumbs.d.ts +0 -18
  256. package/dist/breadcrumbs.d.ts.map +0 -1
  257. package/dist/breadcrumbs.js +0 -119
  258. package/dist/breadcrumbs.js.map +0 -1
  259. package/dist/button-BNyKSDyA.js +0 -180
  260. package/dist/button-BNyKSDyA.js.map +0 -1
  261. package/dist/button-dnqMFkWg.d.ts +0 -76
  262. package/dist/button-dnqMFkWg.d.ts.map +0 -1
  263. package/dist/card-C0a0wQTc.d.ts +0 -7
  264. package/dist/card-C0a0wQTc.d.ts.map +0 -1
  265. package/dist/code.d.ts +0 -20
  266. package/dist/code.d.ts.map +0 -1
  267. package/dist/code.js +0 -90
  268. package/dist/code.js.map +0 -1
  269. package/dist/codeFontStyle-84SMhFtI.js +0 -11
  270. package/dist/codeFontStyle-84SMhFtI.js.map +0 -1
  271. package/dist/component-DVlwaWB-.d.ts +0 -25
  272. package/dist/component-DVlwaWB-.d.ts.map +0 -1
  273. package/dist/element-BYgCE_iK.js +0 -51
  274. package/dist/element-BYgCE_iK.js.map +0 -1
  275. package/dist/factory-BzXTX8_Q.js +0 -3056
  276. package/dist/factory-BzXTX8_Q.js.map +0 -1
  277. package/dist/flex-DmbDG2ks.js +0 -76
  278. package/dist/flex-DmbDG2ks.js.map +0 -1
  279. package/dist/font-EtfxKPUz.d.ts +0 -49
  280. package/dist/font-EtfxKPUz.d.ts.map +0 -1
  281. package/dist/getElementRef-Jw7gY0eV.js +0 -102
  282. package/dist/getElementRef-Jw7gY0eV.js.map +0 -1
  283. package/dist/getScopedTheme-C-sZsyAz.js +0 -267
  284. package/dist/getScopedTheme-C-sZsyAz.js.map +0 -1
  285. package/dist/getTheme_v2-y09KqtEb.js +0 -487
  286. package/dist/getTheme_v2-y09KqtEb.js.map +0 -1
  287. package/dist/grid-6JSgMj1O.js +0 -115
  288. package/dist/grid-6JSgMj1O.js.map +0 -1
  289. package/dist/helpers-C8xxXAQC.js +0 -63
  290. package/dist/helpers-C8xxXAQC.js.map +0 -1
  291. package/dist/hotkeys-CaHsQlsO.js +0 -168
  292. package/dist/hotkeys-CaHsQlsO.js.map +0 -1
  293. package/dist/index.d.ts.map +0 -1
  294. package/dist/layer-Bl5R3uNR.js +0 -61
  295. package/dist/layer-Bl5R3uNR.js.map +0 -1
  296. package/dist/layer-ChlP9Ik6.d.ts +0 -242
  297. package/dist/layer-ChlP9Ik6.d.ts.map +0 -1
  298. package/dist/menu.d.ts +0 -146
  299. package/dist/menu.d.ts.map +0 -1
  300. package/dist/menu.js +0 -626
  301. package/dist/menu.js.map +0 -1
  302. package/dist/popover-B7-28L8y.js +0 -408
  303. package/dist/popover-B7-28L8y.js.map +0 -1
  304. package/dist/popover-CMlQeKn0.d.ts +0 -96
  305. package/dist/popover-CMlQeKn0.d.ts.map +0 -1
  306. package/dist/popover.d.ts +0 -2
  307. package/dist/popover.js +0 -3
  308. package/dist/refractor-CC48DwHi.js +0 -20
  309. package/dist/refractor-CC48DwHi.js.map +0 -1
  310. package/dist/responsiveFont-CilwaORG.js +0 -55
  311. package/dist/responsiveFont-CilwaORG.js.map +0 -1
  312. package/dist/rgba-BSYaEUW6.d.ts +0 -846
  313. package/dist/rgba-BSYaEUW6.d.ts.map +0 -1
  314. package/dist/selectable-B0GUIL74.d.ts +0 -7
  315. package/dist/selectable-B0GUIL74.d.ts.map +0 -1
  316. package/dist/stack-rsNFPq2-.js +0 -112
  317. package/dist/stack-rsNFPq2-.js.map +0 -1
  318. package/dist/styles-css.d.ts +0 -2
  319. package/dist/styles-css.js +0 -4
  320. package/dist/textInput-pSfQjkmx.js +0 -313
  321. package/dist/textInput-pSfQjkmx.js.map +0 -1
  322. package/dist/theme.d.ts +0 -280
  323. package/dist/theme.d.ts.map +0 -1
  324. package/dist/theme.js +0 -55
  325. package/dist/theme.js.map +0 -1
  326. package/dist/toast.d.ts +0 -73
  327. package/dist/toast.d.ts.map +0 -1
  328. package/dist/toast.js +0 -302
  329. package/dist/toast.js.map +0 -1
  330. package/dist/tooltip.d.ts +0 -88
  331. package/dist/tooltip.d.ts.map +0 -1
  332. package/dist/tooltip.js +0 -435
  333. package/dist/tooltip.js.map +0 -1
  334. package/dist/useClickOutsideEvent-wGLGWBZN.js +0 -36
  335. package/dist/useClickOutsideEvent-wGLGWBZN.js.map +0 -1
  336. package/dist/useElementSize-BJvbGHq8.js +0 -51
  337. package/dist/useElementSize-BJvbGHq8.js.map +0 -1
  338. package/dist/useLayer-D1usxIE0.js +0 -712
  339. package/dist/useLayer-D1usxIE0.js.map +0 -1
@@ -0,0 +1,36 @@
1
+ import {type PlacementProps, placementProps} from '../../props/placement'
2
+ import {type PropDef} from '../../types/PropDef'
3
+
4
+ /** @beta */
5
+ export interface TooltipProps
6
+ extends Omit<React.ComponentProps<'div'>, 'children' | 'content'>, PlacementProps {
7
+ /**
8
+ * Shared anchor identifier.
9
+ */
10
+ anchorName?: React.ReactNode
11
+ /**
12
+ * The trigger element.
13
+ */
14
+ children: React.ReactElement<Record<string, unknown>>
15
+ /**
16
+ * The tooltip label.
17
+ */
18
+ content?: React.ReactNode
19
+ /**
20
+ * Renders the label into `document.body` through a React portal instead of inline.
21
+ */
22
+ portal?: boolean
23
+ }
24
+
25
+ export const tooltipProps: Record<string, PropDef> = {
26
+ anchorName: {
27
+ type: 'string',
28
+ },
29
+ content: {
30
+ type: 'string',
31
+ },
32
+ portal: {
33
+ type: 'boolean',
34
+ },
35
+ ...placementProps,
36
+ }
@@ -0,0 +1,64 @@
1
+ import clsx from 'clsx'
2
+ import {type ComponentPropsWithRef, type ElementType, useRef, useState} from 'react'
3
+
4
+ import {getProps} from '../../utils/getProps'
5
+ import {suffixClassName} from '../../utils/suffixClassName'
6
+ import {type TooltipGroupProps, tooltipGroupProps} from './tooltipGroup.props'
7
+
8
+ const tooltipGroupClassName = suffixClassName('sui-TooltipGroup')
9
+
10
+ /** @public */
11
+ export function TooltipGroup<T extends ElementType = 'div'>(
12
+ props: TooltipGroupProps<T> & Omit<ComponentPropsWithRef<T>, keyof TooltipGroupProps<T>>,
13
+ ) {
14
+ const {as, children, className, style, ...rest} = getProps(props, tooltipGroupProps)
15
+ const Component = as || 'div'
16
+ const ref = useRef<HTMLElement>(null)
17
+ const [isActive, setIsActive] = useState(false)
18
+
19
+ const handleTransitionEnd = (e: TransitionEvent) => {
20
+ const tooltip = (e.target as Element).closest('[data-ui="Tooltip"]')
21
+
22
+ if (!tooltip) {
23
+ return
24
+ }
25
+
26
+ if (e.propertyName === 'opacity' && window.getComputedStyle(tooltip).opacity !== '0') {
27
+ setIsActive(true)
28
+ }
29
+ }
30
+
31
+ const handleMouseLeave = () => {
32
+ setIsActive(false)
33
+ }
34
+
35
+ const handleBlur = (e: FocusEvent) => {
36
+ if (ref.current && ref.current.contains(e.relatedTarget as Node)) {
37
+ return
38
+ }
39
+
40
+ setIsActive(false)
41
+ }
42
+
43
+ return (
44
+ <Component
45
+ className={clsx(tooltipGroupClassName, className)}
46
+ style={{
47
+ ...style,
48
+ ...(isActive && {
49
+ '--tooltip-delay-group': '0ms',
50
+ }),
51
+ }}
52
+ data-ui="TooltipGroup"
53
+ ref={ref}
54
+ onTransitionEnd={handleTransitionEnd}
55
+ onMouseLeave={handleMouseLeave}
56
+ onBlur={handleBlur}
57
+ {...rest}
58
+ >
59
+ {children}
60
+ </Component>
61
+ )
62
+ }
63
+
64
+ export type {TooltipGroupProps}
@@ -0,0 +1,15 @@
1
+ import {type PropDef} from '../../types/PropDef'
2
+
3
+ /** @public */
4
+ export interface TooltipGroupProps<T extends React.ElementType = 'div'> {
5
+ /**
6
+ * HTML element to render.
7
+ */
8
+ as?: T
9
+ }
10
+
11
+ export const tooltipGroupProps: Record<string, PropDef> = {
12
+ as: {
13
+ type: 'string',
14
+ },
15
+ }
@@ -0,0 +1,32 @@
1
+ import clsx from 'clsx'
2
+ import type {ComponentPropsWithRef, ElementType} from 'react'
3
+
4
+ import {getProps} from '../../utils/getProps'
5
+ import {suffixClassName} from '../../utils/suffixClassName'
6
+ import {Flex} from '../flex/Flex'
7
+ import {type VStackProps, vStackProps} from './vStack.props'
8
+
9
+ const vStackClassName = suffixClassName('sui-VStack')
10
+
11
+ /** @public */
12
+ export function VStack<T extends ElementType = 'div'>(
13
+ props: VStackProps<T> & Omit<ComponentPropsWithRef<T>, keyof VStackProps<T>>,
14
+ ) {
15
+ const {as, children, className, style, ...rest} = getProps(props, vStackProps)
16
+ const Component = as || 'div'
17
+
18
+ return (
19
+ <Flex
20
+ as={Component}
21
+ className={clsx(vStackClassName, className)}
22
+ style={style}
23
+ data-ui="VStack"
24
+ flexDirection="column"
25
+ {...rest}
26
+ >
27
+ {children}
28
+ </Flex>
29
+ )
30
+ }
31
+
32
+ export type {VStackProps}
@@ -0,0 +1,17 @@
1
+ import {type GapProps, gapProps} from '../../props/gap'
2
+ import {type PropDef} from '../../types/PropDef'
3
+
4
+ /** @public */
5
+ export interface VStackProps<T extends React.ElementType = 'div'> extends Pick<GapProps, 'gap'> {
6
+ /**
7
+ * HTML element or component to render.
8
+ */
9
+ as?: T
10
+ }
11
+
12
+ export const vStackProps: Record<string, PropDef> = {
13
+ as: {
14
+ type: 'string',
15
+ },
16
+ gap: gapProps['gap'] as PropDef,
17
+ }
@@ -0,0 +1,29 @@
1
+ import clsx from 'clsx'
2
+ import type {ComponentPropsWithRef, ElementType} from 'react'
3
+
4
+ import {getProps} from '../../utils/getProps'
5
+ import {suffixClassName} from '../../utils/suffixClassName'
6
+ import {type VisuallyHiddenProps, visuallyHiddenProps} from './visuallyHidden.props'
7
+
8
+ const visuallyHiddenClassName = suffixClassName('sui-VisuallyHidden')
9
+
10
+ /** @public */
11
+ export function VisuallyHidden<T extends ElementType = 'span'>(
12
+ props: VisuallyHiddenProps<T> & Omit<ComponentPropsWithRef<T>, keyof VisuallyHiddenProps<T>>,
13
+ ) {
14
+ const {as, children, className, style, ...rest} = getProps(props, visuallyHiddenProps)
15
+ const Component = as || 'span'
16
+
17
+ return (
18
+ <Component
19
+ className={clsx(visuallyHiddenClassName, className)}
20
+ style={style}
21
+ data-ui="VisuallyHidden"
22
+ {...rest}
23
+ >
24
+ {children}
25
+ </Component>
26
+ )
27
+ }
28
+
29
+ export type {VisuallyHiddenProps}
@@ -0,0 +1,9 @@
1
+ .sui-VisuallyHidden:not(.sui-visually-hidden-visible:focus-visible) {
2
+ width: 1px;
3
+ height: 1px;
4
+ clip: rect(0 0 0 0);
5
+ clip-path: inset(50%);
6
+ overflow: hidden;
7
+ position: absolute;
8
+ white-space: nowrap;
9
+ }
@@ -0,0 +1,23 @@
1
+ import {type PropDef} from '../../types/PropDef'
2
+
3
+ /** @public */
4
+ export interface VisuallyHiddenProps<T extends React.ElementType = 'span'> {
5
+ /**
6
+ * HTML element to render.
7
+ */
8
+ as?: T
9
+ /**
10
+ * If true, the element becomes visible on `:focus-visible`.
11
+ */
12
+ visibleOnFocus?: boolean
13
+ }
14
+
15
+ export const visuallyHiddenProps: Record<string, PropDef> = {
16
+ as: {
17
+ type: 'string',
18
+ },
19
+ visibleOnFocus: {
20
+ type: 'boolean',
21
+ className: 'sui-visually-hidden-visible',
22
+ },
23
+ }
@@ -0,0 +1,5 @@
1
+ @breakpoints {
2
+ .sui-flex-basis { flex-basis: var(--flex-basis); }
3
+ .sui-flex-grow { flex-grow: var(--flex-grow); }
4
+ .sui-flex-shrink { flex-shrink: var(--flex-shrink); }
5
+ }
@@ -0,0 +1,8 @@
1
+ @breakpoints {
2
+ .sui-grid-column { grid-column: var(--grid-column); }
3
+ .sui-grid-column-start { grid-column-start: var(--grid-column-start); }
4
+ .sui-grid-column-end { grid-column-end: var(--grid-column-end); }
5
+ .sui-grid-row { grid-row: var(--grid-row); }
6
+ .sui-grid-row-start { grid-row-start: var(--grid-row-start); }
7
+ .sui-grid-row-end { grid-row-end: var(--grid-row-end); }
8
+ }
@@ -0,0 +1,6 @@
1
+ @breakpoints {
2
+ .sui-grid-auto-columns { grid-auto-columns: var(--grid-auto-columns); }
3
+ .sui-grid-auto-rows { grid-auto-rows: var(--grid-auto-rows); }
4
+ .sui-grid-template-columns { grid-template-columns: var(--grid-template-columns); }
5
+ .sui-grid-template-rows { grid-template-rows: var(--grid-template-rows); }
6
+ }
@@ -0,0 +1,5 @@
1
+ @breakpoints {
2
+ .sui-height { height: var(--height); }
3
+ .sui-min-height { min-height: var(--min-height); }
4
+ .sui-max-height { max-height: var(--max-height); }
5
+ }
@@ -0,0 +1,7 @@
1
+ @import './flex-child.css';
2
+ @import './grid-child.css';
3
+ @import './grid-parent.css';
4
+ @import './height.css';
5
+ @import './width.css';
6
+ @import './line-clamp.css';
7
+ @import './z-index.css';
@@ -0,0 +1,5 @@
1
+ .sui-line-clamp {
2
+ display: -webkit-box;
3
+ -webkit-line-clamp: var(--line-clamp);
4
+ -webkit-box-orient: vertical;
5
+ }
@@ -0,0 +1,3 @@
1
+ # Dynamic classes
2
+
3
+ Dynamic classes apply a custom property that is defined at runtime via a component's `style` attribute.
@@ -0,0 +1,7 @@
1
+ @breakpoints {
2
+ .sui-width { width: var(--width); }
3
+ .sui-min-width { min-width: var(--min-width); }
4
+ .sui-max-width { max-width: var(--max-width); }
5
+ .sui-width-full { width: 100%; }
6
+ .sui-width-auto { width: auto; }
7
+ }
@@ -0,0 +1,3 @@
1
+ @breakpoints {
2
+ .sui-z-index { z-index: var(--z-index); }
3
+ }
@@ -0,0 +1,10 @@
1
+ @breakpoints {
2
+ .sui-display-block:not([hidden]) { display: block; }
3
+ .sui-display-inline-block:not([hidden]) { display: inline-block; }
4
+ .sui-display-inline:not([hidden]) { display: inline; }
5
+ .sui-display-flex:not([hidden]) { display: flex; }
6
+ .sui-display-inline-flex:not([hidden]) { display: inline-flex; }
7
+ .sui-display-grid:not([hidden]) { display: grid; }
8
+ .sui-display-inline-grid:not([hidden]) { display: inline-grid; }
9
+ .sui-display-none:not([hidden]) { display: none; }
10
+ }
@@ -0,0 +1,24 @@
1
+ @breakpoints {
2
+ .sui-align-items-flex-start { align-items: flex-start; }
3
+ .sui-align-items-center { align-items: center; }
4
+ .sui-align-items-flex-end { align-items: flex-end; }
5
+ .sui-align-items-baseline { align-items: baseline; }
6
+ .sui-align-items-stretch { align-items: stretch; }
7
+
8
+ .sui-justify-content-flex-start { justify-content: flex-start; }
9
+ .sui-justify-content-center { justify-content: center; }
10
+ .sui-justify-content-flex-end { justify-content: flex-end; }
11
+ .sui-justify-content-space-between { justify-content: space-between; }
12
+ .sui-justify-content-space-around { justify-content: space-around; }
13
+ .sui-justify-content-space-evenly { justify-content: space-evenly; }
14
+ .sui-justify-content-stretch { justify-content: stretch; }
15
+
16
+ .sui-flex-direction-row { flex-direction: row; }
17
+ .sui-flex-direction-row-reverse { flex-direction: row-reverse; }
18
+ .sui-flex-direction-column { flex-direction: column; }
19
+ .sui-flex-direction-column-reverse { flex-direction: column-reverse; }
20
+
21
+ .sui-flex-wrap { flex-wrap: wrap; }
22
+ .sui-flex-nowrap { flex-wrap: nowrap; }
23
+ .sui-flex-wrap-reverse { flex-wrap: wrap-reverse; }
24
+ }
@@ -0,0 +1,7 @@
1
+ @breakpoints {
2
+ .sui-grid-auto-flow-row { grid-auto-flow: row; }
3
+ .sui-grid-auto-flow-row-dense { grid-auto-flow: row dense; }
4
+ .sui-grid-auto-flow-column { grid-auto-flow: column; }
5
+ .sui-grid-auto-flow-column-dense { grid-auto-flow: column dense; }
6
+ .sui-grid-auto-flow-dense { grid-auto-flow: dense; }
7
+ }
@@ -0,0 +1,7 @@
1
+ @import './display.css';
2
+ @import './flex.css';
3
+ @import './grid.css';
4
+ @import './overflow.css';
5
+ @import './placement.css';
6
+ @import './position.css';
7
+ @import './text-align.css';
@@ -0,0 +1,19 @@
1
+ @breakpoints {
2
+ .sui-overflow-visible { overflow: visible; }
3
+ .sui-overflow-scroll { overflow: scroll; }
4
+ .sui-overflow-clip { overflow: clip; }
5
+ .sui-overflow-hidden { overflow: hidden; }
6
+ .sui-overflow-auto { overflow: auto; }
7
+
8
+ .sui-overflow-x-visible { overflow-x: visible; }
9
+ .sui-overflow-x-scroll { overflow-x: scroll; }
10
+ .sui-overflow-x-clip { overflow-x: clip; }
11
+ .sui-overflow-x-hidden { overflow-x: hidden; }
12
+ .sui-overflow-x-auto { overflow-x: auto; }
13
+
14
+ .sui-overflow-y-visible { overflow-y: visible; }
15
+ .sui-overflow-y-scroll { overflow-y: scroll; }
16
+ .sui-overflow-y-clip { overflow-y: clip; }
17
+ .sui-overflow-y-hidden { overflow-y: hidden; }
18
+ .sui-overflow-y-auto { overflow-y: auto; }
19
+ }
@@ -0,0 +1,202 @@
1
+ [class*='placement-'] {
2
+ inset: auto;
3
+ margin: 0;
4
+ }
5
+
6
+ @position-try --top-center {
7
+ top: auto;
8
+ right: auto;
9
+ bottom: anchor(top);
10
+ left: anchor(center);
11
+ translate: -50% 0;
12
+ }
13
+
14
+ @position-try --top-start {
15
+ top: auto;
16
+ right: auto;
17
+ bottom: anchor(top);
18
+ left: anchor(left);
19
+ translate: none;
20
+ }
21
+
22
+ @position-try --top-end {
23
+ top: auto;
24
+ left: auto;
25
+ bottom: anchor(top);
26
+ right: anchor(right);
27
+ translate: none;
28
+ }
29
+
30
+ @position-try --bottom-center {
31
+ bottom: auto;
32
+ right: auto;
33
+ top: anchor(bottom);
34
+ left: anchor(center);
35
+ translate: -50% 0;
36
+ }
37
+
38
+ @position-try --bottom-start {
39
+ bottom: auto;
40
+ right: auto;
41
+ top: anchor(bottom);
42
+ left: anchor(left);
43
+ translate: none;
44
+ }
45
+
46
+ @position-try --bottom-end {
47
+ bottom: auto;
48
+ left: auto;
49
+ top: anchor(bottom);
50
+ right: anchor(right);
51
+ translate: none;
52
+ }
53
+
54
+ @position-try --right-center {
55
+ right: auto;
56
+ bottom: auto;
57
+ left: anchor(right);
58
+ top: anchor(center);
59
+ translate: 0 -50%;
60
+ }
61
+
62
+ @position-try --right-start {
63
+ right: auto;
64
+ bottom: auto;
65
+ left: anchor(right);
66
+ top: anchor(top);
67
+ translate: none;
68
+ }
69
+
70
+ @position-try --right-end {
71
+ right: auto;
72
+ top: auto;
73
+ left: anchor(right);
74
+ bottom: anchor(bottom);
75
+ translate: none;
76
+ }
77
+
78
+ @position-try --left-center {
79
+ left: auto;
80
+ bottom: auto;
81
+ right: anchor(left);
82
+ top: anchor(center);
83
+ translate: 0 -50%;
84
+ }
85
+
86
+ @position-try --left-start {
87
+ left: auto;
88
+ bottom: auto;
89
+ right: anchor(left);
90
+ top: anchor(top);
91
+ translate: none;
92
+ }
93
+
94
+ @position-try --left-end {
95
+ left: auto;
96
+ top: auto;
97
+ right: anchor(left);
98
+ bottom: anchor(bottom);
99
+ translate: none;
100
+ }
101
+
102
+ .sui-placement-bottom {
103
+ top: anchor(bottom);
104
+ left: anchor(center);
105
+ translate: -50% 0;
106
+ position-try-fallbacks: --top-center;
107
+ }
108
+
109
+ .sui-placement-bottom-start {
110
+ top: anchor(bottom);
111
+ left: anchor(left);
112
+ position-try-fallbacks: --top-start;
113
+ }
114
+
115
+ .sui-placement-bottom-end {
116
+ top: anchor(bottom);
117
+ right: anchor(right);
118
+ position-try-fallbacks: --top-end;
119
+ }
120
+
121
+ .sui-placement-top {
122
+ bottom: anchor(top);
123
+ left: anchor(center);
124
+ translate: -50% 0;
125
+ position-try-fallbacks: --bottom-center;
126
+ }
127
+
128
+ .sui-placement-top-start {
129
+ bottom: anchor(top);
130
+ left: anchor(left);
131
+ position-try-fallbacks: --bottom-start;
132
+ }
133
+
134
+ .sui-placement-top-end {
135
+ bottom: anchor(top);
136
+ right: anchor(right);
137
+ position-try-fallbacks: --bottom-end;
138
+ }
139
+
140
+ .sui-placement-left {
141
+ right: anchor(left);
142
+ top: anchor(center);
143
+ translate: 0 -50%;
144
+ position-try-fallbacks: --right-center;
145
+ }
146
+
147
+ .sui-placement-left-start {
148
+ right: anchor(left);
149
+ top: anchor(top);
150
+ position-try-fallbacks: --right-start;
151
+ }
152
+
153
+ .sui-placement-left-end {
154
+ right: anchor(left);
155
+ bottom: anchor(bottom);
156
+ position-try-fallbacks: --right-end;
157
+ }
158
+
159
+ .sui-placement-right {
160
+ left: anchor(right);
161
+ top: anchor(center);
162
+ translate: 0 -50%;
163
+ position-try-fallbacks: --left-center;
164
+ }
165
+
166
+ .sui-placement-right-start {
167
+ left: anchor(right);
168
+ top: anchor(top);
169
+ position-try-fallbacks: --left-start;
170
+ }
171
+
172
+ .sui-placement-right-end {
173
+ left: anchor(right);
174
+ bottom: anchor(bottom);
175
+ position-try-fallbacks: --left-end;
176
+ }
177
+
178
+ [class*="placement-bottom"],
179
+ [class*="placement-top"] {
180
+ margin-block: var(--space-1);
181
+ }
182
+
183
+ [class*="placement-left"],
184
+ [class*="placement-right"] {
185
+ margin-inline: var(--space-1);
186
+ }
187
+
188
+ [class*="placement-bottom"] {
189
+ transform-origin: center top;
190
+ }
191
+
192
+ [class*="placement-top"] {
193
+ transform-origin: center bottom;
194
+ }
195
+
196
+ [class*="placement-left"] {
197
+ transform-origin: right center;
198
+ }
199
+
200
+ [class*="placement-right"] {
201
+ transform-origin: left center;
202
+ }
@@ -0,0 +1,7 @@
1
+ @breakpoints {
2
+ .sui-position-static { position: static; }
3
+ .sui-position-relative { position: relative; }
4
+ .sui-position-absolute { position: absolute; }
5
+ .sui-position-fixed { position: fixed; }
6
+ .sui-position-sticky { position: sticky; }
7
+ }
@@ -0,0 +1,3 @@
1
+ # Generic classes
2
+
3
+ Generic classes apply a ‘generic’ CSS style — that is, a property with a CSS keyword value. They do not use custom properties.
@@ -0,0 +1,5 @@
1
+ @breakpoints {
2
+ .sui-text-left { text-align: left; }
3
+ .sui-text-center { text-align: center; }
4
+ .sui-text-right { text-align: right; }
5
+ }
@@ -0,0 +1,4 @@
1
+ @import './dynamic/index.css';
2
+ @import './generic/index.css';
3
+ @import './local/index.css';
4
+ @import './system/index.css';
@@ -0,0 +1,4 @@
1
+ :root {
2
+ --timing-linear: linear;
3
+ --timing-curve: cubic-bezier(0.34, 1.2, 0.64, 1);
4
+ }
@@ -0,0 +1,20 @@
1
+ [class*='sui-border'] {
2
+ border-color: var(--separator-low, light-dark(var(--gray-200), var(--gray-800)));
3
+ }
4
+
5
+ @breakpoints {
6
+ .sui-border { border-width: 1px; border-style: solid; }
7
+ .sui-border-none { border-style: none; }
8
+
9
+ .sui-border-top { border-top-width: 1px; border-top-style: solid; }
10
+ .sui-border-top-none { border-top-style: none; }
11
+
12
+ .sui-border-right { border-right-width: 1px; border-right-style: solid; }
13
+ .sui-border-right-none { border-right-style: none; }
14
+
15
+ .sui-border-bottom { border-bottom-width: 1px; border-bottom-style: solid; }
16
+ .sui-border-bottom-none { border-bottom-style: none; }
17
+
18
+ .sui-border-left { border-left-width: 1px; border-left-style: solid; }
19
+ .sui-border-left-none { border-left-style: none; }
20
+ }
@@ -0,0 +1,6 @@
1
+ @import './animation.css';
2
+ @import './border.css';
3
+ @import './text-overflow.css';
4
+ @import './text-trim.css';
5
+ @import './tone.css';
6
+ @import './top-anchor.css';
@@ -0,0 +1,3 @@
1
+ # Local classes
2
+
3
+ Local classes apply custom properties defined locally to the component library. They do not apply custom properties defined at the design system level (those that are imported from our design tokens library). They may additionally apply CSS keyword values or other values, but the emphasis is the application of locally defined tokens.
@@ -0,0 +1,5 @@
1
+ .sui-text-overflow {
2
+ display: block;
3
+ text-overflow: ellipsis;
4
+ white-space: nowrap;
5
+ }