@repobit/dex-system-design 0.25.11 → 0.26.0

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 (336) hide show
  1. package/CHANGELOG.md +195 -0
  2. package/README.md +131 -8
  3. package/package.json +95 -13
  4. package/schemas/component-manifest.json +3294 -405
  5. package/schemas/manifest-omissions.json +173 -0
  6. package/src/blog/src/breakpoints.js +6 -6
  7. package/src/blog/src/content/blog-atoms-showcase.js +1 -1
  8. package/src/blog/src/content/blog-page-layout.js +2 -2
  9. package/src/blog/src/lib/article-toc.js +7 -7
  10. package/src/blog/src/shell/blog-shell.js +1 -1
  11. package/src/blog/src/tokens/blog.js +2 -2
  12. package/src/blog/src/tokens/core.js +34 -35
  13. package/src/blog/src/tokens/legacy.js +0 -9
  14. package/src/blog/tokens/blog.js +2 -2
  15. package/src/blog/tokens/core.js +34 -35
  16. package/src/blog/tokens/legacy.js +0 -9
  17. package/src/blog/tokens.css +36 -46
  18. package/src/components/accordion/accordion-bg.css.js +83 -59
  19. package/src/components/accordion/accordion-bg.js +29 -10
  20. package/src/components/accordion/accordion-bg.stories.js +67 -67
  21. package/src/components/accordion/accordion-keyboard.js +80 -0
  22. package/src/components/accordion/accordion.css.js +142 -80
  23. package/src/components/accordion/accordion.js +37 -10
  24. package/src/components/accordion/accordion.stories.js +7 -7
  25. package/src/components/agent-endpoints/agent-endpoints.css.js +36 -39
  26. package/src/components/agent-endpoints/agent-endpoints.js +30 -20
  27. package/src/components/agent-endpoints/agent-endpoints.stories.js +1 -1
  28. package/src/components/ai-guardian-demo.stories.js +91 -91
  29. package/src/components/alert/alert.css.js +198 -0
  30. package/src/components/alert/alert.js +103 -0
  31. package/src/components/alert/alert.stories.js +206 -0
  32. package/src/components/anchor/anchor-nav.css.js +213 -101
  33. package/src/components/anchor/anchor-nav.js +26 -40
  34. package/src/components/anchor/anchor.stories.js +22 -12
  35. package/src/components/annotation/annotation.css.js +58 -0
  36. package/src/components/annotation/annotation.js +67 -0
  37. package/src/components/annotation/annotation.stories.js +63 -0
  38. package/src/components/architecture.stories.js +285 -0
  39. package/src/components/atoms.stories.js +342 -0
  40. package/src/components/avatar/avatar.css.js +67 -0
  41. package/src/components/avatar/avatar.js +42 -0
  42. package/src/components/avatar/avatar.stories.js +95 -0
  43. package/src/components/awards/awards-flex.css.js +209 -23
  44. package/src/components/awards/awards-flex.js +66 -7
  45. package/src/components/awards/awards-flex.stories.js +1 -1
  46. package/src/components/awards/{awards-light.stories.js → awards-summary.stories.js} +54 -64
  47. package/src/components/awards/awards.css.js +116 -58
  48. package/src/components/awards/awards.js +102 -28
  49. package/src/components/awards/awards.stories.js +1 -1
  50. package/src/components/back/back.css.js +51 -22
  51. package/src/components/back/back.js +28 -7
  52. package/src/components/back/back.stories.js +9 -3
  53. package/src/components/badge/badge.css.js +158 -46
  54. package/src/components/badge/badge.js +62 -74
  55. package/src/components/badge/badge.stories.js +176 -248
  56. package/src/components/bento-grid/bento-grid.css.js +21 -16
  57. package/src/components/bento-grid/bento-grid.js +16 -4
  58. package/src/components/bento-grid/bento-grid.stories.js +19 -18
  59. package/src/components/bento-grid/bento-item.css.js +52 -28
  60. package/src/components/bento-grid/bento-item.js +2 -2
  61. package/src/components/blockquote/blockquote.css.js +47 -0
  62. package/src/components/blockquote/blockquote.js +29 -0
  63. package/src/components/blockquote/blockquote.stories.js +62 -0
  64. package/src/components/breadcrumb/breadcrumb.css.js +92 -22
  65. package/src/components/breadcrumb/breadcrumb.js +56 -11
  66. package/src/components/button/button.css.js +531 -161
  67. package/src/components/button/button.js +206 -214
  68. package/src/components/button/button.stories.js +322 -174
  69. package/src/components/caption/caption.css.js +21 -0
  70. package/src/components/caption/caption.js +31 -0
  71. package/src/components/caption/caption.stories.js +62 -0
  72. package/src/components/card-features/card-features.css.js +14 -22
  73. package/src/components/card-features/card-features.js +68 -9
  74. package/src/components/card-features/card-features.stories.js +11 -11
  75. package/src/components/cards/card.css.js +60 -81
  76. package/src/components/cards/card.js +56 -25
  77. package/src/components/cards/card.stories.js +39 -39
  78. package/src/components/carousel/carousel.css.js +93 -99
  79. package/src/components/carousel/carousel.js +32 -4
  80. package/src/components/checkbox/checkbox.css.js +111 -93
  81. package/src/components/checkbox/checkbox.js +64 -90
  82. package/src/components/checkbox/checkbox.stories.js +96 -29
  83. package/src/components/code/code.css.js +70 -0
  84. package/src/components/code/code.js +40 -0
  85. package/src/components/code/code.stories.js +73 -0
  86. package/src/components/compare/compare.css.js +179 -43
  87. package/src/components/compare/compare.js +52 -25
  88. package/src/components/compare/compare.stories.js +61 -4
  89. package/src/components/comparison-panel/comparison-panel.css.js +38 -51
  90. package/src/components/comparison-panel/comparison-panel.js +5 -4
  91. package/src/components/comparison-panel/comparison-panel.stories.js +1 -1
  92. package/src/components/compatibility-table/compatibility-table.css.js +180 -80
  93. package/src/components/compatibility-table/compatibility-table.js +37 -9
  94. package/src/components/control-alignment.stories.js +393 -0
  95. package/src/components/cta-banner/cta-banner.css.js +41 -13
  96. package/src/components/cta-banner/cta-banner.js +6 -5
  97. package/src/components/cta-banner/cta-banner.stories.js +43 -98
  98. package/src/components/display/display.css.js +25 -1
  99. package/src/components/display/display.js +46 -13
  100. package/src/components/display/display.stories.js +270 -40
  101. package/src/components/divider/divider-horizontal.js +21 -5
  102. package/src/components/divider/divider-vertical.js +15 -7
  103. package/src/components/divider/divider.css.js +2 -2
  104. package/src/components/divider/divider.stories.js +38 -34
  105. package/src/components/dropdown/dropdown.css.js +93 -126
  106. package/src/components/dropdown/dropdown.js +114 -34
  107. package/src/components/dropdown/dropdown.stories.js +56 -24
  108. package/src/components/features/features.css.js +24 -11
  109. package/src/components/features/features.js +7 -3
  110. package/src/components/features/features.stories.js +37 -37
  111. package/src/components/features-tab/features-tab.css.js +19 -8
  112. package/src/components/features-tab/features-tab.js +6 -5
  113. package/src/components/features-tab/features-tab.stories.js +23 -23
  114. package/src/components/fieldset/fieldset.css.js +30 -0
  115. package/src/components/fieldset/fieldset.js +28 -0
  116. package/src/components/fieldset/fieldset.stories.js +84 -0
  117. package/src/components/footer/footer-links-group.css.js +10 -14
  118. package/src/components/footer/footer-links-group.js +4 -3
  119. package/src/components/footer/footer-lp.css.js +59 -30
  120. package/src/components/footer/footer-lp.js +17 -12
  121. package/src/components/footer/footer-lp.stories.js +63 -75
  122. package/src/components/footer/footer-nav-menu.css.js +26 -4
  123. package/src/components/footer/footer-nav-menu.js +3 -2
  124. package/src/components/footer/footer.css.js +146 -264
  125. package/src/components/footer/footer.js +176 -106
  126. package/src/components/footer/footer.stories.js +9 -9
  127. package/src/components/footer/localeMap.js +1 -1
  128. package/src/components/grid/grid.css.js +1 -1
  129. package/src/components/grid/grid.js +49 -7
  130. package/src/components/grid/grid.stories.js +111 -0
  131. package/src/components/header/header-code.css.js +61 -51
  132. package/src/components/header/header-code.js +28 -14
  133. package/src/components/header/header-code.stories.js +5 -5
  134. package/src/components/header/header.css.js +655 -176
  135. package/src/components/header/header.js +269 -36
  136. package/src/components/header/header.stories.js +841 -18
  137. package/src/components/heading/heading.css.js +14 -17
  138. package/src/components/heading/heading.js +48 -33
  139. package/src/components/heading/heading.stories.js +27 -25
  140. package/src/components/help-text/help-text.css.js +21 -0
  141. package/src/components/help-text/help-text.js +25 -0
  142. package/src/components/help-text/help-text.stories.js +66 -0
  143. package/src/components/highlight/highlight.css.js +86 -64
  144. package/src/components/highlight/highlight.js +18 -27
  145. package/src/components/highlight/highlight.stories.js +14 -3
  146. package/src/components/icons/analysis-icon.js +6 -16
  147. package/src/components/icons/arrow-down-icon.js +6 -19
  148. package/src/components/icons/arrow-icon.js +44 -0
  149. package/src/components/icons/arrow-right-icon.js +30 -23
  150. package/src/components/icons/arrow-up-icon.js +19 -18
  151. package/src/components/icons/bd-ai-icon.js +1 -1
  152. package/src/components/icons/brand-marks.stories.js +279 -0
  153. package/src/components/icons/brand-signature-icon.js +42 -0
  154. package/src/components/icons/check-icon.js +27 -0
  155. package/src/components/icons/circle-info-icon.js +33 -0
  156. package/src/components/icons/close-icon.js +6 -18
  157. package/src/components/icons/family-icon.js +8 -20
  158. package/src/components/icons/globe-icon.js +6 -18
  159. package/src/components/icons/guide-icon.js +6 -18
  160. package/src/components/icons/icon-element.js +99 -0
  161. package/src/components/icons/icons.js +36 -0
  162. package/src/components/icons/icons.stories.js +184 -52
  163. package/src/components/icons/individual-icon.js +6 -18
  164. package/src/components/icons/laurel-icon.js +9 -19
  165. package/src/components/icons/machine-learning-icon.js +6 -17
  166. package/src/components/icons/marks.js +41 -0
  167. package/src/components/icons/minus-icon.js +7 -21
  168. package/src/components/icons/missing-icon.js +52 -0
  169. package/src/components/icons/plus-icon.js +7 -21
  170. package/src/components/icons/quote-icon.js +19 -19
  171. package/src/components/image/image.css.js +72 -25
  172. package/src/components/image/image.js +11 -6
  173. package/src/components/image/image.stories.js +2 -2
  174. package/src/components/input/custom-form.stories.js +214 -62
  175. package/src/components/input/input-clipboard.css.js +51 -144
  176. package/src/components/input/input-clipboard.js +31 -15
  177. package/src/components/input/input.css.js +8 -146
  178. package/src/components/input/input.js +93 -38
  179. package/src/components/install-options/install-options.css.js +84 -77
  180. package/src/components/install-options/install-options.js +33 -30
  181. package/src/components/install-options/install-options.stories.js +3 -3
  182. package/src/components/label/label.css.js +35 -0
  183. package/src/components/label/label.js +38 -0
  184. package/src/components/label/label.stories.js +82 -0
  185. package/src/components/light-carousel/light-carousel.css.js +111 -63
  186. package/src/components/light-carousel/light-carousel.js +85 -11
  187. package/src/components/light-carousel/light-carousel.stories.js +126 -82
  188. package/src/components/link/link.css.js +150 -99
  189. package/src/components/link/link.js +86 -11
  190. package/src/components/link/link.stories.js +124 -30
  191. package/src/components/list/list-item/list-item.css.js +74 -22
  192. package/src/components/list/list-item/list-item.js +32 -10
  193. package/src/components/list/list-item/list-item.stories.js +23 -23
  194. package/src/components/list/list.css.js +8 -2
  195. package/src/components/list/list.js +3 -2
  196. package/src/components/list/list.stories.js +222 -0
  197. package/src/components/modal/modal.css.js +114 -24
  198. package/src/components/modal/modal.js +83 -7
  199. package/src/components/modal/modal.stories.js +9 -9
  200. package/src/components/overview/overview.css.js +19 -14
  201. package/src/components/overview/overview.js +6 -5
  202. package/src/components/overview/overview.stories.js +10 -10
  203. package/src/components/page-switcher/page-switcher.css.js +97 -40
  204. package/src/components/page-switcher/page-switcher.js +28 -5
  205. package/src/components/page-switcher/page-switcher.stories.js +95 -0
  206. package/src/components/paragraph/paragraph.css.js +15 -10
  207. package/src/components/paragraph/paragraph.js +41 -44
  208. package/src/components/paragraph/paragraph.stories.js +56 -21
  209. package/src/components/picture/picture.css.js +103 -44
  210. package/src/components/picture/picture.js +100 -30
  211. package/src/components/picture/picture.stories.js +1 -1
  212. package/src/components/pricing-cards/new-pricing-card.js +3 -3
  213. package/src/components/pricing-cards/new-pricing.css.js +24 -15
  214. package/src/components/pricing-cards/pricing-card-actions.css.js +1 -1
  215. package/src/components/pricing-cards/pricing-card-actions.js +3 -4
  216. package/src/components/pricing-cards/pricing-card-container.css.js +3 -3
  217. package/src/components/pricing-cards/pricing-card-container.js +3 -2
  218. package/src/components/pricing-cards/pricing-card-header.css.js +10 -8
  219. package/src/components/pricing-cards/pricing-card-header.js +6 -7
  220. package/src/components/pricing-cards/pricing-card-pricing.css.js +16 -9
  221. package/src/components/pricing-cards/pricing-card-pricing.js +8 -6
  222. package/src/components/pricing-cards/pricing-card-show-more.css.js +11 -3
  223. package/src/components/pricing-cards/pricing-card-show-more.js +8 -3
  224. package/src/components/pricing-cards/pricing-card.css.js +244 -190
  225. package/src/components/pricing-cards/pricing-card.js +54 -70
  226. package/src/components/pricing-cards/pricing-feature-item.css.js +25 -8
  227. package/src/components/pricing-cards/pricing-feature-item.js +8 -3
  228. package/src/components/process-steps/process-steps.css.js +26 -14
  229. package/src/components/process-steps/process-steps.js +23 -6
  230. package/src/components/process-steps/process-steps.stories.js +1 -1
  231. package/src/components/progress/progress.css.js +80 -0
  232. package/src/components/progress/progress.js +42 -0
  233. package/src/components/progress/progress.stories.js +79 -0
  234. package/src/components/quick-answer/quick-answer.css.js +75 -13
  235. package/src/components/quick-answer/quick-answer.js +8 -3
  236. package/src/components/radio/radio.css.js +92 -128
  237. package/src/components/radio/radio.js +106 -127
  238. package/src/components/radio/radio.stories.js +54 -19
  239. package/src/components/review/review-grid.css.js +5 -6
  240. package/src/components/review/review-grid.js +14 -11
  241. package/src/components/review/review.css.js +11 -6
  242. package/src/components/review/review.js +3 -8
  243. package/src/components/shared/ensemble.css.js +93 -0
  244. package/src/components/shared/form-field.css.js +206 -0
  245. package/src/components/shared/prop-vocabulary.js +48 -0
  246. package/src/components/shared/token-scales.js +306 -0
  247. package/src/components/skeleton/skeleton.css.js +34 -0
  248. package/src/components/skeleton/skeleton.js +32 -0
  249. package/src/components/skeleton/skeleton.stories.js +70 -0
  250. package/src/components/spinner/spinner.css.js +62 -0
  251. package/src/components/spinner/spinner.js +38 -0
  252. package/src/components/spinner/spinner.stories.js +92 -0
  253. package/src/components/spotlight-section/spotlight-section.css.js +14 -13
  254. package/src/components/spotlight-section/spotlight-section.js +42 -39
  255. package/src/components/switch/switch.css.js +103 -0
  256. package/src/components/switch/switch.js +44 -0
  257. package/src/components/switch/switch.stories.js +86 -0
  258. package/src/components/tab-list/content-switcher.stories.js +189 -0
  259. package/src/components/tab-list/tab-list.css.js +250 -0
  260. package/src/components/tab-list/tab-list.js +184 -0
  261. package/src/components/tab-list/tab-list.stories.js +221 -0
  262. package/src/components/tabs/tabs.css.js +14 -123
  263. package/src/components/tabs/tabs.js +16 -19
  264. package/src/components/tabs/tabs.stories.js +95 -95
  265. package/src/components/tag/tag.css.js +54 -0
  266. package/src/components/tag/tag.js +32 -0
  267. package/src/components/tag/tag.stories.js +126 -0
  268. package/src/components/terminal/terminal-message.css.js +164 -60
  269. package/src/components/terminal/terminal-message.js +5 -5
  270. package/src/components/terminal/terminal-message.stories.js +70 -1
  271. package/src/components/termsOfUse/terms.css.js +25 -20
  272. package/src/components/termsOfUse/terms.js +13 -9
  273. package/src/components/termsOfUse/terms.stories.js +1 -1
  274. package/src/components/textarea/textarea.css.js +51 -0
  275. package/src/components/textarea/textarea.js +136 -0
  276. package/src/components/textarea/textarea.stories.js +191 -0
  277. package/src/components/tooltip/tooltip.css.js +75 -0
  278. package/src/components/tooltip/tooltip.js +156 -0
  279. package/src/components/tooltip/tooltip.stories.js +161 -0
  280. package/src/components/trust-panel/trust-panel.css.js +85 -33
  281. package/src/components/trust-panel/trust-panel.js +18 -10
  282. package/src/components/trust-panel/trust-panel.stories.js +1 -1
  283. package/src/components/ultimate-security-demo.stories.js +431 -0
  284. package/src/components/video/video.css.js +17 -0
  285. package/src/components/video/video.js +40 -0
  286. package/src/components/video/video.stories.js +106 -0
  287. package/src/components/video-player/video-player.css.js +67 -11
  288. package/src/components/video-player/video-player.js +35 -4
  289. package/src/components/video-player/video-player.stories.js +1 -1
  290. package/src/components/visual-alignment.stories.js +411 -0
  291. package/src/components/visually-hidden/visually-hidden.css.js +24 -0
  292. package/src/components/visually-hidden/visually-hidden.js +16 -0
  293. package/src/components/visually-hidden/visually-hidden.stories.js +56 -0
  294. package/src/stories/Button.stories.js +17 -17
  295. package/src/stories/Header.stories.js +10 -10
  296. package/src/stories/Page.js +1 -1
  297. package/src/stories/Page.stories.js +6 -6
  298. package/src/tokens/borders.stories.js +339 -0
  299. package/src/tokens/color-responsibilities.stories.js +227 -0
  300. package/src/tokens/dark-derivation.js +309 -0
  301. package/src/tokens/dark-findings.js +197 -0
  302. package/src/tokens/dark-mode.stories.js +207 -0
  303. package/src/tokens/dimension.stories.js +251 -0
  304. package/src/tokens/elevation.stories.js +143 -0
  305. package/src/tokens/focus.stories.js +276 -0
  306. package/src/tokens/fonts.css +20 -20
  307. package/src/tokens/fonts.stories.js +354 -374
  308. package/src/tokens/layout.css +25 -11
  309. package/src/tokens/motion.stories.js +231 -0
  310. package/src/tokens/shape.stories.js +272 -0
  311. package/src/tokens/spacing-rhythm.stories.js +359 -0
  312. package/src/tokens/spacing.stories.js +208 -703
  313. package/src/tokens/story-chrome.js +503 -0
  314. package/src/tokens/surfaces.stories.js +224 -0
  315. package/src/tokens/text-on-surface.stories.js +164 -0
  316. package/src/tokens/token-map.js +220 -0
  317. package/src/tokens/token-map.stories.js +257 -0
  318. package/src/tokens/token-purposes.js +266 -0
  319. package/src/tokens/tokens-grid.stories.js +388 -900
  320. package/src/tokens/tokens.css +1633 -1045
  321. package/src/tokens/tokens.js +1130 -492
  322. package/src/tokens/tokens.stories.js +137 -47
  323. package/src/tokens/type-ceiling-words.js +299 -0
  324. package/src/tokens/typography.stories.js +1003 -965
  325. package/src/tokens/vertical-rhythm.stories.js +224 -0
  326. package/src/components/awards/awards-icon.js +0 -56
  327. package/src/components/awards/awards-light.js +0 -240
  328. package/src/components/banner/banner.js +0 -60
  329. package/src/components/banner/banner.stories.js +0 -51
  330. package/src/components/button/icons.js +0 -24
  331. package/src/components/input/index.js +0 -0
  332. package/src/components/light-carousel/light-carousel-simple.css.js +0 -183
  333. package/src/components/light-carousel/light-carousel-simple.js +0 -74
  334. package/src/tokens/colors.js +0 -121
  335. package/src/tokens/typography.css.js +0 -207
  336. package/src/tokens/typography.js +0 -0
@@ -1,723 +1,228 @@
1
1
  import { html } from 'lit';
2
+ import {
3
+ copyToken,
4
+ discoverConsumers,
5
+ discoverTokens,
6
+ docsPage,
7
+ readAllCssText,
8
+ refSection,
9
+ resolve,
10
+ usageCell
11
+ } from './story-chrome.js';
2
12
 
3
13
  export default {
4
- title: 'Design Tokens/Spacing',
5
- tags : ['autodocs'],
6
-
7
- args: {
8
- spaceNone: 'var(--space-none, 0)',
9
- space4xs : 'var(--space-4xs, 0.125rem)',
10
- space3xs : 'var(--space-3xs, 0.25rem)',
11
- space2xs : 'var(--space-2xs, 0.5rem)',
12
- spaceXs : 'var(--space-xs, 0.75rem)',
13
- spaceSm : 'var(--space-sm, 1rem)',
14
- spaceMd : 'var(--space-md, 1.5rem)',
15
- spaceLg : 'var(--space-lg, 2rem)',
16
- spaceXl : 'var(--space-xl, 2.5rem)',
17
- space2xl : 'var(--space-2xl, 3rem)',
18
- space3xl : 'var(--space-3xl, 4rem)',
19
- space4xl : 'var(--space-4xl, 6rem)',
20
- space5xl : 'var(--space-5xl, 8rem)'
21
- },
22
-
23
- argTypes: {
24
- spaceNone: {
25
- control : 'text',
26
- name : '--space-none',
27
- description: 'No spacing (0)',
28
- table : {
29
- type : { summary: 'string' },
30
- defaultValue: { summary: '0' }
31
- }
32
- },
33
- space4xs: {
34
- control : 'text',
35
- name : '--space-4xs',
36
- description: 'Extra extra extra small spacing',
37
- table : {
38
- type : { summary: 'string' },
39
- defaultValue: { summary: '0.125rem (2px)' }
40
- }
41
- },
42
- space3xs: {
43
- control : 'text',
44
- name : '--space-3xs',
45
- description: 'Extra extra small spacing',
46
- table : {
47
- type : { summary: 'string' },
48
- defaultValue: { summary: '0.25rem (4px)' }
49
- }
50
- },
51
- space2xs: {
52
- control : 'text',
53
- name : '--space-2xs',
54
- description: 'Extra small spacing',
55
- table : {
56
- type : { summary: 'string' },
57
- defaultValue: { summary: '0.5rem (8px)' }
58
- }
59
- },
60
- spaceXs: {
61
- control : 'text',
62
- name : '--space-xs',
63
- description: 'Extra small spacing',
64
- table : {
65
- type : { summary: 'string' },
66
- defaultValue: { summary: '0.75rem (12px)' }
67
- }
68
- },
69
- spaceSm: {
70
- control : 'text',
71
- name : '--space-sm',
72
- description: 'Small spacing',
73
- table : {
74
- type : { summary: 'string' },
75
- defaultValue: { summary: '1rem (16px)' }
76
- }
77
- },
78
- spaceMd: {
79
- control : 'text',
80
- name : '--space-md',
81
- description: 'Medium spacing',
82
- table : {
83
- type : { summary: 'string' },
84
- defaultValue: { summary: '1.5rem (24px)' }
85
- }
86
- },
87
- spaceLg: {
88
- control : 'text',
89
- name : '--space-lg',
90
- description: 'Large spacing',
91
- table : {
92
- type : { summary: 'string' },
93
- defaultValue: { summary: '2rem (32px)' }
94
- }
95
- },
96
- spaceXl: {
97
- control : 'text',
98
- name : '--space-xl',
99
- description: 'Extra large spacing',
100
- table : {
101
- type : { summary: 'string' },
102
- defaultValue: { summary: '2.5rem (40px)' }
103
- }
104
- },
105
- space2xl: {
106
- control : 'text',
107
- name : '--space-2xl',
108
- description: 'Extra extra large spacing',
109
- table : {
110
- type : { summary: 'string' },
111
- defaultValue: { summary: '3rem (48px)' }
112
- }
113
- },
114
- space3xl: {
115
- control : 'text',
116
- name : '--space-3xl',
117
- description: 'Extra extra extra large spacing',
118
- table : {
119
- type : { summary: 'string' },
120
- defaultValue: { summary: '4rem (64px)' }
121
- }
122
- },
123
- space4xl: {
124
- control : 'text',
125
- name : '--space-4xl',
126
- description: 'Huge spacing',
127
- table : {
128
- type : { summary: 'string' },
129
- defaultValue: { summary: '6rem (96px)' }
130
- }
131
- },
132
- space5xl: {
133
- control : 'text',
134
- name : '--space-5xl',
135
- description: 'Extra huge spacing',
136
- table : {
137
- type : { summary: 'string' },
138
- defaultValue: { summary: '8rem (128px)' }
139
- }
140
- }
141
- },
142
-
143
- parameters: {
144
- docs: {
145
- description: {
146
- component: `
147
- # Spacing Design Tokens
148
-
149
- Consistent spacing system using CSS custom properties for margin, padding, and gaps.
150
-
151
- ## Overview
152
-
153
- The spacing system provides a consistent scale of spacing values based on rem units. Using CSS custom properties ensures consistency across the entire application and makes responsive design easier.
154
-
155
- ## Spacing Scale
156
-
157
- The system follows a t-shirt size naming convention (xs, sm, md, lg, xl) with additional granularity for smaller increments.
158
-
159
- ## Usage
160
-
161
- ### Direct CSS Custom Properties
162
- \`\`\`css
163
- /* Using spacing tokens */
164
- .element {
165
- margin: var(--space-md);
166
- padding: var(--space-sm) var(--space-lg);
167
- gap: var(--space-xs);
168
- }
169
-
170
- /* Multiple values */
171
- .container {
172
- padding: var(--space-sm) var(--space-md) var(--space-lg) var(--space-xl);
173
- }
174
-
175
- /* Specific properties */
176
- .card {
177
- margin-top: var(--space-2xl);
178
- margin-bottom: var(--space-lg);
179
- }
180
- \`\`\`
181
-
182
- ### In Component Properties
183
- \`\`\`html
184
- <style>
185
- .custom-component {
186
- --component-padding: var(--space-md);
187
- --component-gap: var(--space-sm);
188
- }
189
- </style>
190
- \`\`\`
191
-
192
- ## Spacing Tokens Reference
193
-
194
- | Token | Value (rem) | Value (px) | Use Case |
195
- |-------|-------------|------------|----------|
196
- | \`--space-none\` | 0 | 0px | No spacing, reset margins/padding |
197
- | \`--space-4xs\` | 0.125rem | 2px | Minimal spacing, tight layouts |
198
- | \`--space-3xs\` | 0.25rem | 4px | Small spacing, icon padding |
199
- | \`--space-2xs\` | 0.5rem | 8px | Compact spacing, dense UI |
200
- | \`--space-xs\` | 0.75rem | 12px | Standard small spacing |
201
- | \`--space-sm\` | 1rem | 16px | Small spacing, component padding |
202
- | \`--space-md\` | 1.5rem | 24px | Medium spacing, default gap |
203
- | \`--space-lg\` | 2rem | 32px | Large spacing, section margins |
204
- | \`--space-xl\` | 2.5rem | 40px | Extra large spacing |
205
- | \`--space-2xl\` | 3rem | 48px | Page section spacing |
206
- | \`--space-3xl\` | 4rem | 64px | Large section spacing |
207
- | \`--space-4xl\` | 6rem | 96px | Hero section spacing |
208
- | \`--space-5xl\` | 8rem | 128px | Maximum spacing, full page |
209
-
210
- ## Base Unit
211
-
212
- The system uses **rem** units based on the root font size (typically 16px). This ensures:
213
-
214
- 1. **Accessibility**: Respects user's browser font size settings
215
- 2. **Consistency**: Maintains proportional relationships
216
- 3. **Responsive**: Scales appropriately across breakpoints
217
-
218
- ## Best Practices
219
-
220
- ### 1. Use Tokens Consistently
221
- \`\`\`css
222
- /* Good ✅ */
223
- margin: var(--space-md);
224
- padding: var(--space-sm);
225
-
226
- /* Bad ❌ */
227
- margin: 16px;
228
- padding: 1rem;
229
- \`\`\`
230
-
231
- ### 2. Combine Tokens for Complex Spacing
232
- \`\`\`css
233
- /* Multi-direction spacing */
234
- .element {
235
- margin: var(--space-sm) var(--space-md);
236
- padding: var(--space-xs) var(--space-lg);
237
- }
238
-
239
- /* Stacking with gap */
240
- .grid {
241
- display: grid;
242
- gap: var(--space-md);
243
- }
244
- \`\`\`
245
-
246
- ### 3. Responsive Spacing
247
- \`\`\`css
248
- .container {
249
- padding: var(--space-sm);
250
-
251
- @media (min-width: 768px) {
252
- padding: var(--space-md);
253
- }
254
-
255
- @media (min-width: 1024px) {
256
- padding: var(--space-lg);
257
- }
258
- }
259
- \`\`\`
260
-
261
- ### 4. Semantic Spacing
262
- \`\`\`css
263
- :root {
264
- /* Define semantic spacing for components */
265
- --button-padding: var(--space-xs) var(--space-sm);
266
- --card-padding: var(--space-md);
267
- --section-margin: var(--space-xl);
268
- --form-gap: var(--space-sm);
269
- }
270
- \`\`\`
271
-
272
- ## Examples
273
-
274
- ### Button Spacing
275
- \`\`\`css
276
- .button {
277
- padding: var(--space-xs) var(--space-sm);
278
- margin-right: var(--space-xs);
279
- }
280
- \`\`\`
281
-
282
- ### Card Layout
283
- \`\`\`css
284
- .card {
285
- padding: var(--space-md);
286
- margin-bottom: var(--space-lg);
287
- }
288
-
289
- .card-content {
290
- margin-top: var(--space-sm);
291
- }
292
- \`\`\`
293
-
294
- ### Grid System
295
- \`\`\`css
296
- .grid-container {
297
- display: grid;
298
- gap: var(--space-md);
299
- padding: var(--space-lg);
300
- }
301
-
302
- .grid-item {
303
- margin-bottom: var(--space-sm);
304
- }
305
- \`\`\`
306
-
307
- ### Form Layout
308
- \`\`\`css
309
- .form-group {
310
- margin-bottom: var(--space-md);
311
- }
312
-
313
- .form-label {
314
- margin-bottom: var(--space-xs);
315
- }
316
-
317
- .form-input {
318
- padding: var(--space-xs) var(--space-sm);
319
- }
320
- \`\`\`
321
-
322
- ## Browser Support
323
-
324
- CSS Custom Properties are supported in:
325
- - Chrome 49+
326
- - Firefox 31+
327
- - Safari 9.1+
328
- - Edge 16+
329
-
330
- For older browsers, provide fallbacks:
331
- \`\`\`css
332
- .element {
333
- margin: 1rem; /* Fallback */
334
- margin: var(--space-sm);
335
- }
336
- \`\`\`
337
-
338
- ## Testing Visual Balance
339
-
340
- Use the visualizer in this story to ensure spacing creates proper visual hierarchy and breathing room between elements. Each token is demonstrated with its actual spacing applied as padding.
341
- `
342
- }
343
- }
344
- }
14
+ title: 'Foundations/Spacing',
15
+ tags : ['autodocs']
345
16
  };
346
17
 
347
- export const AllSpacings = (args) => html`
18
+ const barStyles = html`
348
19
  <style>
349
- :root {
350
- --color-neutral-100: #f8f9fa;
351
- --color-neutral-200: #e9ecef;
352
- --color-neutral-300: #dee2e6;
353
- --color-primary: #007bff;
354
- }
355
-
356
- .spacing-container {
357
- max-width: 800px;
358
- margin: 0 auto;
359
- padding: var(--space-lg);
360
- background: white;
361
- border-radius: 8px;
362
- box-shadow: 0 2px 8px rgba(0,0,0,0.1);
363
- }
364
-
365
- .spacing-header {
366
- margin-bottom: var(--space-xl);
367
- padding-bottom: var(--space-sm);
368
- border-bottom: 2px solid var(--color-neutral-300);
20
+ .bar-cell {
21
+ width: 40%;
22
+ min-width: 180px;
369
23
  }
370
-
371
- .spacing-title {
372
- font-family: var(--font-family-sans, sans-serif);
373
- font-size: 1.5rem;
374
- font-weight: 600;
375
- color: #212529;
376
- margin: 0 0 var(--space-xs) 0;
377
- }
378
-
379
- .spacing-subtitle {
380
- font-family: var(--font-family-sans, sans-serif);
381
- font-size: 0.9rem;
382
- color: #6c757d;
383
- margin: 0;
384
- }
385
-
386
- .spacing-box {
387
- background-color: var(--color-neutral-200);
388
- margin-bottom: var(--space-md);
389
- border-radius: 4px;
390
- border: 1px dashed var(--color-neutral-300);
391
- transition: all 0.2s ease;
392
- position: relative;
393
- overflow: hidden;
24
+
25
+ .bar {
26
+ height: var(--spacing-12);
27
+ background: var(--color-blue-500);
28
+ border-radius: var(--radius-sm);
29
+ /* zero-width tokens still need to be visible as a hairline */
30
+ min-width: 1px;
394
31
  }
395
-
396
- .spacing-box:hover {
397
- background-color: var(--color-neutral-300);
398
- transform: translateY(-2px);
399
- box-shadow: 0 4px 12px rgba(0,0,0,0.1);
32
+
33
+ .bar--alias {
34
+ background: var(--color-neutral-400);
400
35
  }
401
-
402
- .spacing-content {
403
- font-family: var(--font-family-mono, monospace);
404
- font-size: 0.9rem;
405
- color: #495057;
406
- line-height: 1.4;
36
+
37
+ .composite {
38
+ font-family: var(--typography-fontFamily-mono);
39
+ color: var(--color-neutral-700);
40
+ white-space: nowrap;
407
41
  }
408
-
409
- .spacing-token {
410
- font-weight: 600;
411
- color: var(--color-primary);
42
+
43
+ .box-demo {
412
44
  display: inline-block;
413
- background: white;
414
- padding: 2px 6px;
415
- border-radius: 3px;
416
- border: 1px solid var(--color-neutral-300);
417
- margin-right: var(--space-xs);
418
- }
419
-
420
- .spacing-value {
421
- color: #6c757d;
422
- }
423
-
424
- .spacing-visual {
425
- position: absolute;
426
- top: 0;
427
- right: 0;
428
- bottom: 0;
429
- width: 60px;
430
- background: repeating-linear-gradient(
431
- 45deg,
432
- var(--color-neutral-300),
433
- var(--color-neutral-300) 1px,
434
- transparent 1px,
435
- transparent 8px
436
- );
437
- opacity: 0.3;
438
- }
439
-
440
- .legend {
441
- display: flex;
442
- align-items: center;
443
- gap: var(--space-sm);
444
- margin-top: var(--space-2xl);
445
- padding: var(--space-md);
446
- background: var(--color-neutral-100);
447
- border-radius: 4px;
448
- border-left: 4px solid var(--color-primary);
449
- }
450
-
451
- .legend-item {
452
- display: flex;
453
- align-items: center;
454
- gap: var(--space-xs);
45
+ background: var(--color-blue-50);
46
+ border: var(--border-width-1) dashed var(--color-blue-300);
47
+ border-radius: var(--radius-sm);
455
48
  }
456
-
457
- .legend-color {
458
- width: 12px;
459
- height: 12px;
460
- border-radius: 2px;
461
- }
462
-
463
- .legend-text {
464
- font-family: var(--font-family-sans, sans-serif);
465
- font-size: 0.85rem;
466
- color: #495057;
467
- }
468
-
469
- .usage-example {
470
- margin-top: var(--space-xl);
471
- padding: var(--space-md);
472
- background: var(--color-neutral-100);
473
- border-radius: 4px;
474
- }
475
-
476
- .usage-title {
477
- font-family: var(--font-family-sans, sans-serif);
478
- font-weight: 600;
479
- color: #212529;
480
- margin: 0 0 var(--space-sm) 0;
481
- }
482
-
483
- .code-block {
484
- background: #1a1a1a;
485
- color: #f8f8f2;
486
- padding: var(--space-md);
487
- border-radius: 4px;
488
- font-family: var(--font-family-mono, monospace);
489
- font-size: 0.85rem;
490
- line-height: 1.5;
491
- overflow-x: auto;
492
- }
493
-
494
- .code-comment { color: #6272a4; }
495
- .code-property { color: #50fa7b; }
496
- .code-value { color: #f1fa8c; }
497
- .code-punctuation { color: #f8f8f2; }
498
- </style>
499
-
500
- <div class="spacing-container">
501
- <div class="spacing-header">
502
- <h1 class="spacing-title">Spacing Tokens</h1>
503
- <p class="spacing-subtitle">Visual reference for all spacing design tokens</p>
504
- </div>
505
-
506
- <section>
507
- ${Object.entries(args).map(([key, value]) => html`
508
- <div class="spacing-box" style="padding: ${value}">
509
- <div class="spacing-visual"></div>
510
- <div class="spacing-content">
511
- <span class="spacing-token">${key.replace('space', '--space-').toLowerCase()}</span>
512
- <span class="spacing-value">${value}</span>
513
- </div>
514
- </div>
515
- `)}
516
- </section>
517
-
518
- <div class="legend">
519
- <div class="legend-item">
520
- <div class="legend-color" style="background: var(--color-neutral-200);"></div>
521
- <span class="legend-text">Box background shows applied padding</span>
522
- </div>
523
- <div class="legend-item">
524
- <div class="legend-color" style="background: repeating-linear-gradient(45deg, #dee2e6, #dee2e6 1px, transparent 1px, transparent 8px);"></div>
525
- <span class="legend-text">Diagonal pattern indicates spacing area</span>
526
- </div>
527
- </div>
528
-
529
- <div class="usage-example">
530
- <h3 class="usage-title">Usage Example</h3>
531
- <div class="code-block">
532
- <span class="code-comment">/* Using spacing tokens in CSS */</span><br>
533
- <span class="code-property">.card</span> {<br>
534
- &nbsp;&nbsp;<span class="code-property">padding</span>: <span class="code-value">var(--space-md)</span><span class="code-punctuation">;</span><br>
535
- &nbsp;&nbsp;<span class="code-property">margin-bottom</span>: <span class="code-value">var(--space-lg)</span><span class="code-punctuation">;</span><br>
536
- }<br><br>
537
- <span class="code-comment">/* Responsive spacing */</span><br>
538
- <span class="code-property">.container</span> {<br>
539
- &nbsp;&nbsp;<span class="code-property">padding</span>: <span class="code-value">var(--space-sm)</span><span class="code-punctuation">;</span><br>
540
- }<br>
541
- <span class="code-property">@media</span> (<span class="code-property">min-width</span>: <span class="code-value">768px</span>) {<br>
542
- &nbsp;&nbsp;<span class="code-property">.container</span> {<br>
543
- &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-property">padding</span>: <span class="code-value">var(--space-lg)</span><span class="code-punctuation">;</span><br>
544
- &nbsp;&nbsp;}<br>
545
- }
546
- </div>
547
- </div>
548
- </div>
549
- `;
550
49
 
551
- export const SpacingExamples = () => html`
552
- <style>
553
- .examples-container {
554
- max-width: 800px;
555
- margin: 0 auto;
556
- padding: var(--space-lg);
557
- }
558
-
559
- .example-section {
560
- margin-bottom: var(--space-xl);
561
- padding: var(--space-lg);
562
- background: white;
563
- border-radius: 8px;
564
- box-shadow: 0 2px 8px rgba(0,0,0,0.1);
565
- }
566
-
567
- .example-title {
568
- font-family: var(--font-family-sans, sans-serif);
569
- font-size: 1.25rem;
570
- font-weight: 600;
571
- color: #212529;
572
- margin: 0 0 var(--space-md) 0;
573
- }
574
-
575
- .button-group {
576
- display: flex;
577
- gap: var(--space-sm);
578
- flex-wrap: wrap;
579
- margin-bottom: var(--space-md);
580
- }
581
-
582
- .button {
583
- padding: var(--space-xs) var(--space-sm);
584
- background: #007bff;
585
- color: white;
586
- border: none;
587
- border-radius: 4px;
588
- font-family: var(--font-family-sans, sans-serif);
589
- font-size: 0.9rem;
590
- cursor: pointer;
591
- transition: background 0.2s;
592
- }
593
-
594
- .button:hover {
595
- background: #0056b3;
596
- }
597
-
598
- .card-grid {
599
- display: grid;
600
- grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
601
- gap: var(--space-md);
602
- }
603
-
604
- .card {
605
- padding: var(--space-md);
606
- background: var(--color-neutral-100, #f8f9fa);
607
- border-radius: 6px;
608
- border: 1px solid var(--color-neutral-300, #dee2e6);
609
- }
610
-
611
- .card-title {
612
- font-family: var(--font-family-sans, sans-serif);
613
- font-weight: 600;
614
- margin: 0 0 var(--space-xs) 0;
615
- color: #212529;
616
- }
617
-
618
- .card-content {
619
- font-family: var(--font-family-sans, sans-serif);
620
- font-size: 0.9rem;
621
- color: #6c757d;
622
- margin: 0;
623
- }
624
-
625
- .form-group {
626
- margin-bottom: var(--space-md);
627
- }
628
-
629
- .form-label {
50
+ .box-demo > span {
630
51
  display: block;
631
- font-family: var(--font-family-sans, sans-serif);
632
- font-weight: 600;
633
- margin-bottom: var(--space-xs);
634
- color: #495057;
635
- }
636
-
637
- .form-input {
638
- width: 100%;
639
- padding: var(--space-xs) var(--space-sm);
640
- border: 1px solid var(--color-neutral-300, #dee2e6);
641
- border-radius: 4px;
642
- font-family: var(--font-family-sans, sans-serif);
643
- font-size: 0.9rem;
644
- }
645
-
646
- .spacing-visual {
647
- display: flex;
648
- align-items: center;
649
- gap: var(--space-md);
650
- padding: var(--space-lg);
651
- background: linear-gradient(45deg, #f8f9fa, #e9ecef);
652
- border-radius: 6px;
653
- }
654
-
655
- .spacing-dot {
656
- width: var(--space-sm);
657
- height: var(--space-sm);
658
- background: #007bff;
659
- border-radius: 50%;
660
- }
661
-
662
- .spacing-label {
663
- font-family: var(--font-family-mono, monospace);
664
- font-size: 0.85rem;
665
- color: #495057;
666
- background: white;
667
- padding: 2px 6px;
668
- border-radius: 3px;
669
- border: 1px solid #dee2e6;
52
+ background: var(--color-neutral-0);
53
+ border: var(--border-width-1) solid var(--color-neutral-200);
54
+ border-radius: var(--radius-sm);
55
+ font-family: var(--typography-fontFamily-mono);
56
+ font-size: var(--typography-fontSize-xxs);
57
+ color: var(--color-neutral-700);
58
+ padding: var(--spacing-4) var(--spacing-8);
670
59
  }
671
60
  </style>
61
+ `;
672
62
 
673
- <div class="examples-container">
674
- <div class="example-section">
675
- <h3 class="example-title">Button Spacing</h3>
676
- <div class="button-group">
677
- <button class="button" style="padding: var(--space-xs) var(--space-sm);">Small Button</button>
678
- <button class="button" style="padding: var(--space-sm) var(--space-md);">Medium Button</button>
679
- <button class="button" style="padding: var(--space-md) var(--space-lg);">Large Button</button>
680
- </div>
681
- <p style="font-family: var(--font-family-sans, sans-serif); color: #6c757d; font-size: 0.9rem;">
682
- Buttons use consistent padding tokens: --space-xs/--space-sm, --space-sm/--space-md, --space-md/--space-lg
683
- </p>
684
- </div>
685
-
686
- <div class="example-section">
687
- <h3 class="example-title">Card Grid</h3>
688
- <div class="card-grid">
689
- ${[1, 2, 3].map(i => html`
690
- <div class="card">
691
- <h4 class="card-title">Card ${i}</h4>
692
- <p class="card-content">This card uses --space-md for padding and the grid uses --space-md for gaps.</p>
693
- </div>
694
- `)}
695
- </div>
63
+ /** px equivalent of a rem/px length, for the reference column. */
64
+ function toPx(value) {
65
+ const probe = document.createElement('div');
66
+ probe.style.cssText = `position:absolute;visibility:hidden;width:${value}`;
67
+ document.body.appendChild(probe);
68
+ const px = getComputedStyle(probe).width;
69
+ probe.remove();
70
+ return px;
71
+ }
72
+
73
+ /** Longest value in a set, used to scale the visual bars proportionally. */
74
+ function widestPx(values) {
75
+ return Math.max(...values.map(v => parseFloat(toPx(v)) || 0), 1);
76
+ }
77
+
78
+ function scaleTable({ caption, tokens, consumers, alias = false }) {
79
+ const resolved = tokens.map(token => ({ token, value: resolve(token) })).filter(row => row.value);
80
+ const simple = resolved.filter(row => !row.value.includes(' '));
81
+ const max = widestPx(simple.map(row => row.value));
82
+
83
+ return html`
84
+ <div class="table-scroll">
85
+ <table>
86
+ <caption>${caption}</caption>
87
+ <thead>
88
+ <tr>
89
+ <th scope="col">Token</th>
90
+ <th scope="col">Value</th>
91
+ <th scope="col">px</th>
92
+ <th scope="col">Scale</th>
93
+ <th scope="col">Used by</th>
94
+ </tr>
95
+ </thead>
96
+ <tbody>
97
+ ${resolved.map(({ token, value }) => {
98
+ const composite = value.includes(' ');
99
+ const px = composite ? '—' : toPx(value);
100
+ const width = composite ? 0 : (parseFloat(px) / max) * 100;
101
+
102
+ return html`
103
+ <tr>
104
+ <td>${copyToken(token)}</td>
105
+ <td class="${composite ? 'composite' : 'num'}">${value}</td>
106
+ <td class="num muted">${px}</td>
107
+ <td class="bar-cell">
108
+ ${composite
109
+ ? html`<span class="muted">composite</span>`
110
+ : html`<div
111
+ class="bar ${alias ? 'bar--alias' : ''}"
112
+ style="width: ${width}%"
113
+ role="img"
114
+ aria-label="${px} wide"
115
+ ></div>`}
116
+ </td>
117
+ <td>${usageCell(consumers.get(token))}</td>
118
+ </tr>
119
+ `;
120
+ })}
121
+ </tbody>
122
+ </table>
696
123
  </div>
124
+ `;
125
+ }
126
+
127
+ /** Tokens matching a prefix, in declaration order, read from the loaded CSS. */
128
+ function tokensFor(cssText, prefix) {
129
+ const pattern = new RegExp(`(--${prefix}[A-Za-z0-9-]*)\\s*:`, 'g');
130
+ return discoverTokens(cssText, pattern).map(match => match[1]);
131
+ }
132
+
133
+ export const AllSpacings = () => {
134
+ const cssText = readAllCssText();
135
+ const consumers = discoverConsumers(cssText);
136
+
137
+ const spacing = tokensFor(cssText, 'spacing-').sort(
138
+ (a, b) => Number(a.replace(/\D/g, '')) - Number(b.replace(/\D/g, ''))
139
+ );
140
+
141
+ return html`
142
+ ${barStyles}
143
+ ${docsPage({
144
+ title: 'Spacing',
145
+ lede : html`Values are read from the loaded token CSS at render time, so this page always
146
+ matches <code>src/tokens/tokens.css</code>. Click a token name to copy its
147
+ <code>var()</code> reference.`,
148
+ note: html`One scale, named after its pixel value. There used to be a second,
149
+ <code>--space-*</code>, a t-shirt scale of thirteen duplicates that existed mainly so
150
+ <code>bd-grid</code> could build a token name from its <code>gap</code> and
151
+ <code>padding</code> props. Those props still take t-shirt names; the mapping moved to
152
+ <code>SPACE_STEPS</code> in <code>shared/token-scales.js</code>, where a prop
153
+ vocabulary belongs, and the duplicate scale is gone.
154
+ <br><br>
155
+ Note that <code>--spacing-1</code> is <b>1px</b>, not one grid unit — reach for
156
+ <code>--spacing-4</code> when you want 4px. Reading the number as a position rather
157
+ than a value is what left a form stacking its fields 6px apart.`,
158
+ children: html`
159
+ ${refSection({
160
+ name : 'Primitive scale',
161
+ meta : `${spacing.length} steps · --spacing-*`,
162
+ children: scaleTable({ caption: 'Primitive spacing scale', tokens: spacing, consumers })
163
+ })}
164
+ `
165
+ })}
166
+ `;
167
+ };
697
168
 
698
- <div class="example-section">
699
- <h3 class="example-title">Form Layout</h3>
700
- <div class="form-group">
701
- <label class="form-label">Email Address</label>
702
- <input type="email" class="form-input" placeholder="Enter your email">
703
- </div>
704
- <div class="form-group">
705
- <label class="form-label">Password</label>
706
- <input type="password" class="form-input" placeholder="Enter your password">
707
- </div>
708
- <button class="button" style="margin-top: var(--space-md);">Submit</button>
709
- </div>
169
+ export const SemanticSpacing = () => {
170
+ const cssText = readAllCssText();
171
+ const consumers = discoverConsumers(cssText);
172
+
173
+ const groups = [
174
+ { name: 'Inset (padding on all sides)', prefix: 'inset-' },
175
+ { name: 'Stack (vertical rhythm)', prefix: 'stack-' },
176
+ { name: 'Inline (horizontal rhythm)', prefix: 'inline-' },
177
+ { name: 'Component padding', prefix: 'padding-' },
178
+ { name: 'Container padding', prefix: 'container-padding' }
179
+ ];
180
+
181
+ return html`
182
+ ${barStyles}
183
+ ${docsPage({
184
+ title: 'Semantic spacing',
185
+ lede : html`Named roles layered over the primitive scale. These express intent — an inset,
186
+ a stack, a container gutter — so a component does not have to pick a raw step.`,
187
+ note: html`Every token here is defined but the <b>Used by</b> column shows how few are
188
+ actually referenced. Components mostly reach past this layer straight to
189
+ <code>--spacing-*</code>, which is worth knowing before you rely on one of these.`,
190
+ children: groups.map(({ name, prefix }) => {
191
+ const tokens = tokensFor(cssText, prefix);
192
+ if (!tokens.length) return html``;
193
+ return refSection({
194
+ name,
195
+ meta : `${tokens.length} tokens · --${prefix}*`,
196
+ children: scaleTable({ caption: name, tokens, consumers, alias: true })
197
+ });
198
+ })
199
+ })}
200
+ `;
201
+ };
710
202
 
711
- <div class="example-section">
712
- <h3 class="example-title">Spacing Visualization</h3>
713
- <div class="spacing-visual">
714
- <div class="spacing-dot"></div>
715
- <span class="spacing-label">--space-sm (1rem)</span>
716
- <div class="spacing-dot" style="width: var(--space-md); height: var(--space-md);"></div>
717
- <span class="spacing-label">--space-md (1.5rem)</span>
718
- <div class="spacing-dot" style="width: var(--space-lg); height: var(--space-lg);"></div>
719
- <span class="spacing-label">--space-lg (2rem)</span>
720
- </div>
721
- </div>
722
- </div>
723
- `;
203
+ export const SpacingExamples = () => {
204
+ const insets = ['--spacing-8', '--spacing-16', '--spacing-24', '--spacing-32'];
205
+
206
+ return html`
207
+ ${barStyles}
208
+ ${docsPage({
209
+ title : 'Spacing applied',
210
+ lede : 'The same scale used as padding, so the steps can be judged against real content rather than as bars.',
211
+ children: refSection({
212
+ name : 'Inset padding',
213
+ meta : 'padding applied to a box',
214
+ children: html`
215
+ <div class="specimen">
216
+ ${insets.map(
217
+ token => html`
218
+ <div class="box-demo" style="padding: var(${token}); margin: 0 var(--spacing-12) var(--spacing-12) 0">
219
+ <span>${token}</span>
220
+ </div>
221
+ `
222
+ )}
223
+ </div>
224
+ `
225
+ })
226
+ })}
227
+ `;
228
+ };