@commercetools/nimbus 0.0.1 → 0.0.3-alpha.2

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 (302) hide show
  1. package/dist/index.d.ts +1412 -0
  2. package/dist/index.js +22451 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.umd.cjs +27 -0
  5. package/dist/index.umd.cjs.map +1 -0
  6. package/package.json +74 -40
  7. package/.storybook/apca-check/index.ts +0 -150
  8. package/.storybook/main.ts +0 -64
  9. package/.storybook/preview.tsx +0 -92
  10. package/.storybook/vitest.setup.ts +0 -13
  11. package/docs/architecture-decisions/adr-0001-consumer-component-apis.md +0 -177
  12. package/docs/architecture-decisions/adr-0002-compound-component-extraction.md +0 -82
  13. package/src/components/accordion/accordion-context.tsx +0 -17
  14. package/src/components/accordion/accordion.mdx +0 -172
  15. package/src/components/accordion/accordion.recipe.tsx +0 -98
  16. package/src/components/accordion/accordion.slots.tsx +0 -39
  17. package/src/components/accordion/accordion.stories.tsx +0 -188
  18. package/src/components/accordion/accordion.tsx +0 -16
  19. package/src/components/accordion/accordion.types.tsx +0 -54
  20. package/src/components/accordion/components/accordion-content.tsx +0 -28
  21. package/src/components/accordion/components/accordion-group.tsx +0 -27
  22. package/src/components/accordion/components/accordion-header.tsx +0 -63
  23. package/src/components/accordion/components/accordion-item.tsx +0 -87
  24. package/src/components/accordion/index.ts +0 -2
  25. package/src/components/alert/alert.mdx +0 -92
  26. package/src/components/alert/alert.recipe.tsx +0 -65
  27. package/src/components/alert/alert.slots.tsx +0 -46
  28. package/src/components/alert/alert.stories.tsx +0 -308
  29. package/src/components/alert/alert.tsx +0 -18
  30. package/src/components/alert/alert.types.tsx +0 -70
  31. package/src/components/alert/components/alert.actions.tsx +0 -27
  32. package/src/components/alert/components/alert.description.tsx +0 -27
  33. package/src/components/alert/components/alert.dismiss-button.tsx +0 -41
  34. package/src/components/alert/components/alert.root.tsx +0 -92
  35. package/src/components/alert/components/alert.title.tsx +0 -29
  36. package/src/components/alert/index.ts +0 -2
  37. package/src/components/avatar/avatar.mdx +0 -80
  38. package/src/components/avatar/avatar.recipe.tsx +0 -36
  39. package/src/components/avatar/avatar.slots.tsx +0 -16
  40. package/src/components/avatar/avatar.stories.tsx +0 -136
  41. package/src/components/avatar/avatar.tsx +0 -34
  42. package/src/components/avatar/avatar.types.ts +0 -33
  43. package/src/components/avatar/index.ts +0 -2
  44. package/src/components/badge/badge.mdx +0 -91
  45. package/src/components/badge/badge.recipe.tsx +0 -72
  46. package/src/components/badge/badge.slots.tsx +0 -8
  47. package/src/components/badge/badge.stories.tsx +0 -124
  48. package/src/components/badge/badge.tsx +0 -35
  49. package/src/components/badge/badge.types.tsx +0 -40
  50. package/src/components/badge/index.ts +0 -2
  51. package/src/components/bleed/bleed.tsx +0 -1
  52. package/src/components/bleed/index.ts +0 -1
  53. package/src/components/box/box.mdx +0 -115
  54. package/src/components/box/box.stories.tsx +0 -71
  55. package/src/components/box/box.tsx +0 -11
  56. package/src/components/box/index.ts +0 -1
  57. package/src/components/button/button.mdx +0 -169
  58. package/src/components/button/button.recipe.ts +0 -185
  59. package/src/components/button/button.slots.tsx +0 -45
  60. package/src/components/button/button.stories.tsx +0 -369
  61. package/src/components/button/button.tsx +0 -37
  62. package/src/components/button/button.types.ts +0 -14
  63. package/src/components/button/index.ts +0 -2
  64. package/src/components/card/card.mdx +0 -92
  65. package/src/components/card/card.recipe.tsx +0 -71
  66. package/src/components/card/card.slots.tsx +0 -50
  67. package/src/components/card/card.stories.tsx +0 -175
  68. package/src/components/card/card.tsx +0 -9
  69. package/src/components/card/card.types.ts +0 -22
  70. package/src/components/card/components/card.content.tsx +0 -29
  71. package/src/components/card/components/card.header.tsx +0 -28
  72. package/src/components/card/components/card.root.tsx +0 -62
  73. package/src/components/card/index.ts +0 -2
  74. package/src/components/checkbox/checkbox.mdx +0 -78
  75. package/src/components/checkbox/checkbox.recipe.tsx +0 -116
  76. package/src/components/checkbox/checkbox.slots.tsx +0 -33
  77. package/src/components/checkbox/checkbox.stories.tsx +0 -200
  78. package/src/components/checkbox/checkbox.tsx +0 -77
  79. package/src/components/checkbox/checkbox.types.tsx +0 -22
  80. package/src/components/checkbox/index.ts +0 -2
  81. package/src/components/code/code.mdx +0 -17
  82. package/src/components/code/code.recipe.ts +0 -63
  83. package/src/components/code/code.tsx +0 -1
  84. package/src/components/code/index.ts +0 -1
  85. package/src/components/dialog/dialog.mdx +0 -20
  86. package/src/components/dialog/dialog.recipe.ts +0 -254
  87. package/src/components/dialog/dialog.tsx +0 -61
  88. package/src/components/dialog/index.ts +0 -1
  89. package/src/components/em/em.mdx +0 -17
  90. package/src/components/em/em.tsx +0 -1
  91. package/src/components/em/index.ts +0 -1
  92. package/src/components/flex/flex.mdx +0 -41
  93. package/src/components/flex/flex.tsx +0 -1
  94. package/src/components/flex/index.ts +0 -1
  95. package/src/components/grid/grid.mdx +0 -156
  96. package/src/components/grid/grid.stories.tsx +0 -151
  97. package/src/components/grid/grid.tsx +0 -29
  98. package/src/components/grid/index.ts +0 -1
  99. package/src/components/heading/heading.mdx +0 -23
  100. package/src/components/heading/heading.recipe.ts +0 -49
  101. package/src/components/heading/heading.tsx +0 -1
  102. package/src/components/heading/index.ts +0 -1
  103. package/src/components/highlight/highlight.mdx +0 -18
  104. package/src/components/highlight/highlight.tsx +0 -1
  105. package/src/components/highlight/index.ts +0 -1
  106. package/src/components/icon-button/icon-button.mdx +0 -98
  107. package/src/components/icon-button/icon-button.stories.tsx +0 -188
  108. package/src/components/icon-button/icon-button.tsx +0 -21
  109. package/src/components/icon-button/icon-button.types.tsx +0 -10
  110. package/src/components/icon-button/index.ts +0 -2
  111. package/src/components/index.ts +0 -33
  112. package/src/components/input/index.ts +0 -1
  113. package/src/components/input/input.mdx +0 -20
  114. package/src/components/input/input.recipe.ts +0 -95
  115. package/src/components/input/input.tsx +0 -1
  116. package/src/components/input-group/index.ts +0 -1
  117. package/src/components/input-group/input-group.mdx +0 -20
  118. package/src/components/input-group/input-group.tsx +0 -44
  119. package/src/components/kbd/index.ts +0 -1
  120. package/src/components/kbd/kbd.mdx +0 -18
  121. package/src/components/kbd/kbd.recipe.ts +0 -57
  122. package/src/components/kbd/kbd.tsx +0 -1
  123. package/src/components/link/index.ts +0 -2
  124. package/src/components/link/link.mdx +0 -77
  125. package/src/components/link/link.recipe.ts +0 -52
  126. package/src/components/link/link.slots.tsx +0 -29
  127. package/src/components/link/link.stories.tsx +0 -204
  128. package/src/components/link/link.tsx +0 -38
  129. package/src/components/link/link.types.tsx +0 -26
  130. package/src/components/list/index.ts +0 -1
  131. package/src/components/list/list.mdx +0 -18
  132. package/src/components/list/list.recipe.ts +0 -68
  133. package/src/components/list/list.tsx +0 -9
  134. package/src/components/loading-spinner/index.ts +0 -2
  135. package/src/components/loading-spinner/loading-spinner.mdx +0 -92
  136. package/src/components/loading-spinner/loading-spinner.recipe.tsx +0 -70
  137. package/src/components/loading-spinner/loading-spinner.slots.tsx +0 -38
  138. package/src/components/loading-spinner/loading-spinner.stories.tsx +0 -97
  139. package/src/components/loading-spinner/loading-spinner.tsx +0 -50
  140. package/src/components/loading-spinner/loading-spinner.types.tsx +0 -21
  141. package/src/components/nimbus-provider/color-mode.tsx +0 -32
  142. package/src/components/nimbus-provider/index.ts +0 -2
  143. package/src/components/nimbus-provider/nimbus-provider.mdx +0 -21
  144. package/src/components/nimbus-provider/nimbus-provider.tsx +0 -51
  145. package/src/components/select/components/select.clear-button.tsx +0 -31
  146. package/src/components/select/components/select.option-group.tsx +0 -48
  147. package/src/components/select/components/select.option.tsx +0 -21
  148. package/src/components/select/components/select.options.tsx +0 -23
  149. package/src/components/select/components/select.root.tsx +0 -81
  150. package/src/components/select/index.ts +0 -2
  151. package/src/components/select/select.mdx +0 -170
  152. package/src/components/select/select.recipe.tsx +0 -216
  153. package/src/components/select/select.slots.tsx +0 -58
  154. package/src/components/select/select.stories.tsx +0 -841
  155. package/src/components/select/select.tsx +0 -18
  156. package/src/components/select/select.types.tsx +0 -37
  157. package/src/components/simple-grid/index.ts +0 -1
  158. package/src/components/simple-grid/simple-grid.mdx +0 -133
  159. package/src/components/simple-grid/simple-grid.stories.tsx +0 -143
  160. package/src/components/simple-grid/simple-grid.tsx +0 -31
  161. package/src/components/stack/index.ts +0 -1
  162. package/src/components/stack/stack.mdx +0 -88
  163. package/src/components/stack/stack.stories.tsx +0 -82
  164. package/src/components/stack/stack.tsx +0 -15
  165. package/src/components/table/index.ts +0 -1
  166. package/src/components/table/table.mdx +0 -23
  167. package/src/components/table/table.recipe.ts +0 -170
  168. package/src/components/table/table.tsx +0 -43
  169. package/src/components/text/index.ts +0 -1
  170. package/src/components/text/text.mdx +0 -244
  171. package/src/components/text/text.tsx +0 -23
  172. package/src/components/text-input/index.ts +0 -2
  173. package/src/components/text-input/text-input.mdx +0 -118
  174. package/src/components/text-input/text-input.recipe.tsx +0 -68
  175. package/src/components/text-input/text-input.slots.tsx +0 -24
  176. package/src/components/text-input/text-input.stories.tsx +0 -282
  177. package/src/components/text-input/text-input.tsx +0 -39
  178. package/src/components/text-input/text-input.types.ts +0 -7
  179. package/src/components/toggle-button-group/components/toggle-button-group.button.tsx +0 -14
  180. package/src/components/toggle-button-group/components/toggle-button-group.root.tsx +0 -15
  181. package/src/components/toggle-button-group/index.ts +0 -2
  182. package/src/components/toggle-button-group/toggle-button-group.mdx +0 -94
  183. package/src/components/toggle-button-group/toggle-button-group.recipe.tsx +0 -64
  184. package/src/components/toggle-button-group/toggle-button-group.slots.tsx +0 -26
  185. package/src/components/toggle-button-group/toggle-button-group.stories.tsx +0 -311
  186. package/src/components/toggle-button-group/toggle-button-group.tsx +0 -12
  187. package/src/components/toggle-button-group/toggle-button-group.types.tsx +0 -62
  188. package/src/components/tooltip/index.ts +0 -4
  189. package/src/components/tooltip/make-element-focusable.stories.tsx +0 -56
  190. package/src/components/tooltip/make-element-focusable.tsx +0 -57
  191. package/src/components/tooltip/tooltip-trigger.stories.tsx +0 -157
  192. package/src/components/tooltip/tooltip-trigger.tsx +0 -15
  193. package/src/components/tooltip/tooltip.mdx +0 -48
  194. package/src/components/tooltip/tooltip.recipe.ts +0 -26
  195. package/src/components/tooltip/tooltip.slots.ts +0 -35
  196. package/src/components/tooltip/tooltip.stories.tsx +0 -139
  197. package/src/components/tooltip/tooltip.tsx +0 -31
  198. package/src/components/tooltip/tooltip.types.ts +0 -44
  199. package/src/components/visually-hidden/index.ts +0 -1
  200. package/src/components/visually-hidden/visually-hidden.mdx +0 -61
  201. package/src/components/visually-hidden/visually-hidden.stories.tsx +0 -124
  202. package/src/components/visually-hidden/visually-hidden.tsx +0 -18
  203. package/src/docs/accessibility.mdx +0 -21
  204. package/src/docs/background.mdx +0 -154
  205. package/src/docs/border.mdx +0 -226
  206. package/src/docs/changelog.mdx +0 -17
  207. package/src/docs/components-layout.mdx +0 -22
  208. package/src/docs/components.mdx +0 -17
  209. package/src/docs/data-display.mdx +0 -23
  210. package/src/docs/display.mdx +0 -55
  211. package/src/docs/effects.mdx +0 -73
  212. package/src/docs/feedback.mdx +0 -22
  213. package/src/docs/filters.mdx +0 -268
  214. package/src/docs/flex-and-grid.mdx +0 -445
  215. package/src/docs/forms.mdx +0 -22
  216. package/src/docs/generated/index.mdx +0 -16
  217. package/src/docs/getting-started.mdx +0 -17
  218. package/src/docs/home.mdx +0 -56
  219. package/src/docs/hooks.mdx +0 -16
  220. package/src/docs/inputs.mdx +0 -21
  221. package/src/docs/installation.mdx +0 -60
  222. package/src/docs/interactivity.mdx +0 -278
  223. package/src/docs/known-issues.mdx +0 -19
  224. package/src/docs/layout.mdx +0 -301
  225. package/src/docs/list.mdx +0 -82
  226. package/src/docs/markdown.mdx +0 -234
  227. package/src/docs/media.mdx +0 -22
  228. package/src/docs/naivgation.mdx +0 -22
  229. package/src/docs/playground.mdx +0 -16
  230. package/src/docs/rfcs-component-structure-rfcs.mdx +0 -17
  231. package/src/docs/rfcs-component-structure.mdx +0 -74
  232. package/src/docs/rfcs-hook-structure.mdx +0 -59
  233. package/src/docs/sizing.mdx +0 -210
  234. package/src/docs/spacing.mdx +0 -193
  235. package/src/docs/style-props-typography.mdx +0 -373
  236. package/src/docs/style-props.mdx +0 -15
  237. package/src/docs/svg.mdx +0 -58
  238. package/src/docs/tables.mdx +0 -95
  239. package/src/docs/toc.mdx +0 -39
  240. package/src/docs/tokens/animations.mdx +0 -68
  241. package/src/docs/tokens/aspect-ratios.mdx +0 -21
  242. package/src/docs/tokens/blurs.mdx +0 -20
  243. package/src/docs/tokens/borders.mdx +0 -25
  244. package/src/docs/tokens/breakpoints.mdx +0 -35
  245. package/src/docs/tokens/colors.mdx +0 -86
  246. package/src/docs/tokens/cursors.mdx +0 -21
  247. package/src/docs/tokens/radii.mdx +0 -23
  248. package/src/docs/tokens/shadows.mdx +0 -21
  249. package/src/docs/tokens/sizes.mdx +0 -54
  250. package/src/docs/tokens/spacing.mdx +0 -35
  251. package/src/docs/tokens/typography.mdx +0 -61
  252. package/src/docs/tokens/z-indices.mdx +0 -23
  253. package/src/docs/tokens-other.mdx +0 -17
  254. package/src/docs/tokens.mdx +0 -16
  255. package/src/docs/transforms.mdx +0 -150
  256. package/src/docs/transitions.mdx +0 -164
  257. package/src/docs/typography.mdx +0 -17
  258. package/src/docs/utilities.mdx +0 -17
  259. package/src/hooks/index.ts +0 -2
  260. package/src/hooks/use-copy-to-clipboard/use-copy-to-clipboard.mdx +0 -54
  261. package/src/hooks/use-copy-to-clipboard/use-copy-to-clipboard.ts +0 -1
  262. package/src/hooks/use-hotkeys/use-hotkeys.mdx +0 -48
  263. package/src/hooks/use-hotkeys/use-hotkeys.stories.tsx +0 -69
  264. package/src/hooks/use-hotkeys/use-hotkeys.ts +0 -1
  265. package/src/index.ts +0 -3
  266. package/src/test/utils.tsx +0 -20
  267. package/src/theme/animation-styles.ts +0 -52
  268. package/src/theme/breakpoints.ts +0 -32
  269. package/src/theme/global-css.ts +0 -53
  270. package/src/theme/index.ts +0 -35
  271. package/src/theme/keyframes.ts +0 -192
  272. package/src/theme/layer-styles.ts +0 -12
  273. package/src/theme/recipes/index.ts +0 -21
  274. package/src/theme/semantic-tokens/colors.ts +0 -55
  275. package/src/theme/semantic-tokens/index.ts +0 -9
  276. package/src/theme/semantic-tokens/radii.ts +0 -3
  277. package/src/theme/semantic-tokens/shadows.ts +0 -4
  278. package/src/theme/slot-recipes/index.ts +0 -15
  279. package/src/theme/text-styles.ts +0 -8
  280. package/src/theme/tokens/animations.ts +0 -4
  281. package/src/theme/tokens/aspect-ratios.ts +0 -5
  282. package/src/theme/tokens/blurs.ts +0 -5
  283. package/src/theme/tokens/borders.ts +0 -4
  284. package/src/theme/tokens/colors.ts +0 -8
  285. package/src/theme/tokens/cursor.ts +0 -4
  286. package/src/theme/tokens/durations.ts +0 -4
  287. package/src/theme/tokens/easings.ts +0 -4
  288. package/src/theme/tokens/font-sizes.ts +0 -4
  289. package/src/theme/tokens/font-weights.ts +0 -4
  290. package/src/theme/tokens/fonts.ts +0 -4
  291. package/src/theme/tokens/index.ts +0 -57
  292. package/src/theme/tokens/letter-spacings.ts +0 -24
  293. package/src/theme/tokens/line-heights.ts +0 -4
  294. package/src/theme/tokens/radii.ts +0 -4
  295. package/src/theme/tokens/sizes.ts +0 -120
  296. package/src/theme/tokens/spacing.ts +0 -4
  297. package/src/theme/tokens/z-index.ts +0 -4
  298. package/src/utils/extractStyleProps.ts +0 -26
  299. package/src/utils/fixedForwardRef.ts +0 -17
  300. package/tsconfig.json +0 -38
  301. package/vite.config.ts +0 -54
  302. package/vitest.config.ts +0 -50
@@ -1,74 +0,0 @@
1
- ---
2
- id: WIP-Component Structure
3
- title: Component Structure
4
- description: Working out the process from idea to published component
5
- documentState: InitialDraft
6
- documentAudiences:
7
- - Maintainer
8
- order: 999
9
- menu:
10
- - RFCs
11
- - Component Structure
12
- tags:
13
- - document
14
- ---
15
-
16
- # React Component Anatomy
17
-
18
- ## Basic Structure
19
-
20
- ```bash
21
- /components
22
- /component-name
23
- │ # Files
24
- ├── component-name.types.ts # typescript type exports
25
- ├── component-name.recipe.ts # a recipe file covering basic styles, sizes & variants
26
- ├── component-name.slots.tsx # optional, for multi-part components
27
- ├── component-name.figma.tsx # code to figma export instructions/definition
28
- ├── component-name.tsx # component implementation
29
- ├── component-name.mdx # component documentation
30
- ├── index.ts # barrel file for exports
31
- │ # Folders
32
- ├── hooks # optional, folder for react hooks
33
- ├── components # optional, folder for sub-components
34
- ├── tests # unit tests
35
- ├── stories # storybook stories (screenshot tests)
36
- ```
37
-
38
- ### component-name.types.ts
39
-
40
- Exports and/or contains the type definitions for the component.
41
-
42
- ### component-name.recipe.ts
43
-
44
- Contains a single or multi-slot recipe. Covering default styles, sizes, variants
45
- and compound variants for a single or multiple _slots_.
46
-
47
- ### component-name.slots.ts
48
-
49
- A component that has multiple parts, like a Modal (header, body, footer, etc.),
50
- will have a .slot.tsx file. This file will create components with styles
51
- attached to them, and will be used in the main component file.
52
-
53
- ### component-name.tsx
54
-
55
- Free of any styling concerns, this file imports the slot-components and connects
56
- those with the headless ui-components.
57
-
58
- ### component-name.mdx
59
-
60
- Contains the documentation for the component. Will provide examples, usage,
61
- props, etc.
62
-
63
- ### index.ts
64
-
65
- Exports the component and any other files that need to be exported.
66
-
67
- ### components
68
-
69
- Optional, can contain components that are only used by the parent component.
70
- Structure is the same basic folder structure.
71
-
72
- ### tests
73
-
74
- ### stories
@@ -1,59 +0,0 @@
1
- ---
2
- id: Organisation-Hook Structure
3
- title: Hook Structure
4
- description: Basic structure of a react hook
5
- documentState: InitialDraft
6
- documentAudiences:
7
- - Maintainer
8
- order: 999
9
- menu:
10
- - RFCs
11
- - Hook Structure
12
- tags:
13
- - document
14
- ---
15
-
16
- # React Hook Anatomy
17
-
18
- ## Basic Structure
19
-
20
- ```bash
21
- /hooks
22
- /use-hook-name
23
- │ # Files
24
- ├── use-hook-name.types.ts # typescript type exports
25
- ├── use-hook-name.ts # hook implementation
26
- ├── use-hook-name.utils.ts # optional, utility functions for the hook
27
- ├── use-hook-name.test.ts # unit tests for the hook
28
- ├── use-hook-name.mdx # documentation for the hook
29
- ├── index.ts # barrel file for exports
30
- ```
31
-
32
- ### useHookName.types.ts
33
-
34
- Contains type definitions relevant to the hook, such as inputs, outputs, and
35
- custom types it uses.
36
-
37
- ### useHookName.ts
38
-
39
- The core implementation of the hook. It defines and exports the hook's logic and
40
- any dependencies it might require.
41
-
42
- ### useHookName.utils.ts
43
-
44
- Optional file containing reusable utility functions that support the hook's
45
- implementation.
46
-
47
- ### useHookName.test.ts
48
-
49
- Contains unit tests for the hook to ensure its functionality and edge cases are
50
- covered.
51
-
52
- ### useHookName.mdx
53
-
54
- Documentation file for the hook, detailing its purpose, usage, and examples.
55
-
56
- ### index.ts
57
-
58
- Exports the hook and any other files (e.g., utilities or types) that should be
59
- publicly accessible.
@@ -1,210 +0,0 @@
1
- ---
2
- id: Style Props-Sizing
3
- title: Sizing
4
- description: JSX style props for sizing an element
5
- documentState: InitialDraft
6
- order: 999
7
- menu:
8
- - Style Props
9
- - Sizing
10
- tags:
11
- - document
12
- ---
13
-
14
- # Sizing
15
-
16
- JSX style props for sizing an element
17
-
18
- ## Width
19
-
20
- Use the `width` or `w` property to set the width of an element.
21
-
22
- ```jsx
23
- // hardcoded values
24
- <Box width="64px" />
25
- <Box w="4rem" />
26
-
27
- // token values
28
- <Box width="5" />
29
- <Box w="5" />
30
- ```
31
-
32
- ### Fractional width
33
-
34
- Use can set fractional widths using the `width` or `w` property.
35
-
36
- Values can be within the following ranges:
37
-
38
- - Thirds: `1/3` to `2/3`
39
- - Fourths: `1/4` to `3/4`
40
- - Fifths: `1/5` to `4/5`
41
- - Sixths: `1/6` to `5/6`
42
- - Twelfths: `1/12` to `11/12`
43
-
44
- ```jsx
45
- // half width
46
- <Flex>
47
- <Box width="1/2" />
48
- <Box width="1/2" />
49
- </Flex>
50
-
51
- // thirds
52
- <Flex>
53
- <Box width="1/3" />
54
- <Box width="2/3" />
55
- </Flex>
56
-
57
- // fourths
58
- <Flex>
59
- <Box width="1/4" />
60
- <Box width="3/4" />
61
- </Flex>
62
-
63
- // fifths
64
- <Flex>
65
- <Box width="1/5" />
66
- <Box width="4/5" />
67
- </Flex>
68
-
69
- // sixths
70
- <Flex>
71
- <Box width="1/6" />
72
- <Box width="5/6" />
73
- </Flex>
74
-
75
- // twelfths
76
- <Flex>
77
- <Box width="3/12" />
78
- <Box width="9/12" />
79
- </Flex>
80
- ```
81
-
82
- ### Viewport width
83
-
84
- Use the modern viewport width values `dvw`, `svw`, `lvw`.
85
-
86
- > [!NOTE]
87
- > `dvw` maps to `100dvw`, `svw` maps to `100svw`, `lvw` maps to `100lvw`.
88
-
89
- ```jsx
90
- <Box width="dvw" />
91
- <Box w="dvw" /> // shorthand
92
- ```
93
-
94
- | Prop | CSS Property | Token Category |
95
- | ------------ | ------------ | -------------- |
96
- | `w`, `width` | `width` | `sizes` |
97
-
98
- ## Max width
99
-
100
- Use the `maxWidth` or `maxW` property to set the maximum width of an element.
101
-
102
- ```jsx
103
- // hardcoded values
104
- <Box maxWidth="640px" />
105
- <Box maxW="4rem" /> // shorthand
106
-
107
- // token values
108
- <Box maxWidth="xl" />
109
- <Box maxW="2xl" /> // shorthand
110
- ```
111
-
112
- | Prop | CSS Property | Token Category |
113
- | ------------------ | ------------ | -------------- |
114
- | `maxW`, `maxWidth` | `max-width` | `sizes` |
115
-
116
- ## Min width
117
-
118
- Use the `minWidth` or `minW` property to set the minimum width of an element.
119
-
120
- ```jsx
121
- // hardcoded values
122
- <Box minWidth="64px" />
123
- <Box minW="4rem" /> // shorthand
124
-
125
- // token values
126
- <Box minWidth="8" />
127
- <Box minW="10" /> // shorthand
128
- ```
129
-
130
- | Prop | CSS Property | Token Category |
131
- | ------------------ | ------------ | -------------- |
132
- | `w`, `width` | `width` | `sizing` |
133
- | `maxW`, `maxWidth` | `max-width` | `sizing` |
134
- | `minW`, `minWidth` | `min-width` | `sizing` |
135
-
136
- ## Height
137
-
138
- Use the `height` or `h` property to set the height of an element.
139
-
140
- ```jsx
141
- // hardcoded values
142
- <Box height="40px" />
143
- <Box h="0.4rem" /> // shorthand
144
-
145
- // token values
146
- <Box height="5" />
147
- <Box h="5" /> // shorthand
148
- ```
149
-
150
- ### Fractional height
151
-
152
- Use can set fractional heights using the `height` or `h` property.
153
-
154
- Values can be within the following ranges:
155
-
156
- - Thirds: `1/3` to `2/3`
157
- - Fourths: `1/4` to `3/4`
158
- - Fifths: `1/5` to `4/5`
159
- - Sixths: `1/6` to `5/6`
160
-
161
- ```jsx
162
- <Box height="1/2" />
163
- <Box h="1/2" /> // shorthand
164
- ```
165
-
166
- ### Relative heights
167
-
168
- Use the modern relative height values `dvh`, `svh`, `lvh`.
169
-
170
- > [!NOTE]
171
- > `dvh` maps to `100dvh`, `svh` maps to `100svh`, `lvh` maps to `100lvh`.
172
-
173
- ```jsx
174
- <Box height="dvh" />
175
- <Box h="dvh" /> // shorthand
176
- ```
177
-
178
- ## Max height
179
-
180
- Use the `maxHeight` or `maxH` property to set the maximum height of an element.
181
-
182
- ```jsx
183
- // hardcoded values
184
- <Box maxHeight="40px" />
185
- <Box maxH="0.4rem" /> // shorthand
186
-
187
- // token values
188
- <Box maxHeight="8" />
189
- <Box maxH="10" /> // shorthand
190
- ```
191
-
192
- ## Min height
193
-
194
- Use the `minHeight` or `minH` property to set the minimum height of an element.
195
-
196
- ```jsx
197
- // hardcoded values
198
- <Box minHeight="40px" />
199
- <Box minH="0.4rem" /> // shorthand
200
-
201
- // token values
202
- <Box minHeight="8" />
203
- <Box minH="10" /> // shorthand
204
- ```
205
-
206
- | Prop | CSS Property | Token Category |
207
- | ------------------- | ------------ | -------------- |
208
- | `h`, `height` | `height` | `sizes` |
209
- | `maxH`, `maxHeight` | `max-height` | `sizes` |
210
- | `minH`, `minHeight` | `min-height` | `sizes` |
@@ -1,193 +0,0 @@
1
- ---
2
- id: Style Props-Spacing
3
- title: Spacing
4
- description:
5
- JSX style props for controlling the padding and margin of an element.
6
- documentState: InitialDraft
7
- order: 999
8
- menu:
9
- - Style Props
10
- - Spacing
11
- tags:
12
- - document
13
- ---
14
-
15
- # Spacing
16
-
17
- JSX style props for controlling the padding and margin of an element.
18
-
19
- ## Padding
20
-
21
- ### All sides
22
-
23
- Use the `padding` prop to apply padding on all sides of an element
24
-
25
- ```jsx
26
- // raw value
27
- <Box padding="40px" />
28
- <Box p="40px" /> // shorthand
29
-
30
- // token value
31
- <Box padding="4" />
32
- <Box p="4" /> // shorthand
33
- ```
34
-
35
- | Prop | CSS Property | Token Category |
36
- | ------------- | ------------ | -------------- |
37
- | `p`,`padding` | `padding` | `spacing` |
38
-
39
- ### Specific side
40
-
41
- Use the `padding{Left,Right,Top,Bottom}` to apply padding on one side of an
42
- element
43
-
44
- ```jsx
45
- <Box paddingLeft="3" />
46
- <Box pl="3" /> // shorthand
47
-
48
- <Box paddingTop="3" />
49
- <Box pt="3" /> // shorthand
50
- ```
51
-
52
- Use the `padding{Start,End}` props to apply padding on the logical axis of an
53
- element based on the text direction.
54
-
55
- ```jsx
56
- <div className={css({ paddingStart: '8' })} />
57
- <div className={css({ ps: '8' })} /> // shorthand
58
-
59
- <div className={css({ paddingEnd: '8' })} />
60
- <div className={css({ pe: '8' })} /> // shorthand
61
- ```
62
-
63
- | Prop | CSS Property | Token Category |
64
- | --------------------- | ---------------------- | -------------- |
65
- | `pl`, `paddingLeft` | `padding-left` | `spacing` |
66
- | `pr`, `paddingRight` | `padding-right` | `spacing` |
67
- | `pt`, `paddingTop` | `padding-top` | `spacing` |
68
- | `pb`, `paddingBottom` | `padding-bottom` | `spacing` |
69
- | `ps`, `paddingStart` | `padding-inline-start` | `spacing` |
70
- | `pe`, `paddingEnd` | `padding-inline-end` | `spacing` |
71
-
72
- ### Horizontal and Vertical padding
73
-
74
- Use the `padding{X,Y}` props to apply padding on the horizontal and vertical
75
- axis of an element
76
-
77
- ```jsx
78
- <Box paddingX="8" />
79
- <Box px="8" /> // shorthand
80
-
81
- <Box paddingY="8" />
82
- <Box py="8" /> // shorthand
83
- ```
84
-
85
- | Prop | CSS Property | Token Category |
86
- | --------------------- | ---------------------- | -------------- |
87
- | `p`,`padding` | `padding` | `spacing` |
88
- | `pl`, `paddingLeft` | `padding-left` | `spacing` |
89
- | `pr`, `paddingRight` | `padding-right` | `spacing` |
90
- | `pt`, `paddingTop` | `padding-top` | `spacing` |
91
- | `pb`, `paddingBottom` | `padding-bottom` | `spacing` |
92
- | `px`, `paddingX` | `padding-inline` | `spacing` |
93
- | `py`, `paddingY` | `padding-block` | `spacing` |
94
- | `ps`, `paddingStart` | `padding-inline-start` | `spacing` |
95
- | `pe`, `paddingEnd` | `padding-inline-end` | `spacing` |
96
-
97
- ## Margin
98
-
99
- ### All sides
100
-
101
- Use the `margin` prop to apply margin on all sides of an element
102
-
103
- ```jsx
104
- <Box margin="5" />
105
- <Box m="5" /> // shorthand
106
- ```
107
-
108
- | Prop | CSS Property | Token Category |
109
- | ------------ | ------------ | -------------- |
110
- | `m`,`margin` | `margin` | `spacing` |
111
-
112
- ### Specific side
113
-
114
- Use the `margin{Left,Right,Top,Bottom}` to apply margin on one side of an
115
- element
116
-
117
- ```jsx
118
- <Box marginLeft="3" />
119
- <Box ml="3" /> // shorthand
120
-
121
- <Box marginTop="3" />
122
- <Box mt="3" /> // shorthand
123
- ```
124
-
125
- Use the `margin{Start,End}` properties to apply margin on the logical axis of an
126
- element based on the text direction.
127
-
128
- ```jsx
129
- <Box marginStart="8" />
130
- <Box ms="8" /> // shorthand
131
-
132
- <Box marginEnd="8" />
133
- <Box me="8" /> // shorthand
134
- ```
135
-
136
- | Prop | CSS Property | Token Category |
137
- | -------------------- | --------------------- | -------------- |
138
- | `ml`, `marginLeft` | `margin-left` | `spacing` |
139
- | `mr`, `marginRight` | `margin-right` | `spacing` |
140
- | `mt`, `marginTop` | `margin-top` | `spacing` |
141
- | `mb`, `marginBottom` | `margin-bottom` | `spacing` |
142
- | `ms`, `marginStart` | `margin-inline-start` | `spacing` |
143
- | `me`, `marginEnd` | `margin-inline-end` | `spacing` |
144
-
145
- ### Horizontal and Vertical margin
146
-
147
- Use the `margin{X,Y}` properties to apply margin on the horizontal and vertical
148
- axis of an element
149
-
150
- ```jsx
151
- <Box marginX="8" />
152
- <Box mx="8" /> // shorthand
153
-
154
- <Box marginY="8" />
155
- <Box my="8" /> // shorthand
156
- ```
157
-
158
- | Prop | CSS Property | Token Category |
159
- | --------------- | ------------- | -------------- |
160
- | `mx`, `marginX` | `margin-left` | `spacing` |
161
- | `my`, `marginY` | `margin-top` | `spacing` |
162
-
163
- ## Spacing Between
164
-
165
- Use the `space{X,Y}` props to apply spacing between elements. This approach uses
166
- the owl selector `> * + *` to apply the spacing between the elements using
167
- `margin*` properties.
168
-
169
- :::info
170
-
171
- It's recommended to use the `space` prop over the `gap` prop for spacing when
172
- you need negative spacing.
173
-
174
- :::
175
-
176
- ```jsx
177
- <Box display="flex" spaceX="8">
178
- <Box>Item 1</Box>
179
- <Box>Item 2</Box>
180
- <Box>Item 3</Box>
181
- </Box>
182
-
183
- <Box display="flex" spaceY="8">
184
- <Box>Item 1</Box>
185
- <Box>Item 2</Box>
186
- <Box>Item 3</Box>
187
- </Box>
188
- ```
189
-
190
- | Prop | CSS Property | Token Category |
191
- | -------- | --------------------- | -------------- |
192
- | `spaceX` | `margin-inline-start` | `spacing` |
193
- | `spaceY` | `margin-block-start` | `spacing` |