@discourser/design-system 0.9.3 → 0.9.4

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 (268) hide show
  1. package/dist/components/AbsoluteCenter.d.ts +4 -0
  2. package/dist/components/AbsoluteCenter.d.ts.map +1 -0
  3. package/dist/components/Accordion.d.ts +12 -0
  4. package/dist/components/Accordion.d.ts.map +1 -0
  5. package/dist/components/Avatar.d.ts +17 -0
  6. package/dist/components/Avatar.d.ts.map +1 -0
  7. package/dist/components/Badge.d.ts +13 -0
  8. package/dist/components/Badge.d.ts.map +1 -0
  9. package/dist/components/Button.d.ts +39 -0
  10. package/dist/components/Button.d.ts.map +1 -0
  11. package/dist/components/Card.d.ts +17 -0
  12. package/dist/components/Card.d.ts.map +1 -0
  13. package/dist/components/Checkbox.d.ts +507 -0
  14. package/dist/components/Checkbox.d.ts.map +1 -0
  15. package/dist/components/CloseButton.d.ts +4 -0
  16. package/dist/components/CloseButton.d.ts.map +1 -0
  17. package/dist/components/Dialog.d.ts +16 -0
  18. package/dist/components/Dialog.d.ts.map +1 -0
  19. package/dist/components/Drawer.d.ts +17 -0
  20. package/dist/components/Drawer.d.ts.map +1 -0
  21. package/dist/components/Group.d.ts +4 -0
  22. package/dist/components/Group.d.ts.map +1 -0
  23. package/dist/components/Heading.d.ts +10 -0
  24. package/dist/components/Heading.d.ts.map +1 -0
  25. package/dist/components/Icon.d.ts +4 -0
  26. package/dist/components/Icon.d.ts.map +1 -0
  27. package/dist/components/IconButton.d.ts +5 -0
  28. package/dist/components/IconButton.d.ts.map +1 -0
  29. package/dist/components/Input.d.ts +5 -0
  30. package/dist/components/Input.d.ts.map +1 -0
  31. package/dist/components/InputAddon.d.ts +4 -0
  32. package/dist/components/InputAddon.d.ts.map +1 -0
  33. package/dist/components/InputGroup.d.ts +14 -0
  34. package/dist/components/InputGroup.d.ts.map +1 -0
  35. package/dist/components/Loader.d.ts +25 -0
  36. package/dist/components/Loader.d.ts.map +1 -0
  37. package/dist/components/Popover.d.ts +20 -0
  38. package/dist/components/Popover.d.ts.map +1 -0
  39. package/dist/components/Progress.d.ts +14 -0
  40. package/dist/components/Progress.d.ts.map +1 -0
  41. package/dist/components/RadioGroup.d.ts +14 -0
  42. package/dist/components/RadioGroup.d.ts.map +1 -0
  43. package/dist/components/Select.d.ts +26 -0
  44. package/dist/components/Select.d.ts.map +1 -0
  45. package/dist/components/Skeleton.d.ts +16 -0
  46. package/dist/components/Skeleton.d.ts.map +1 -0
  47. package/dist/components/Slider.d.ts +34 -0
  48. package/dist/components/Slider.d.ts.map +1 -0
  49. package/dist/components/Spinner.d.ts +4 -0
  50. package/dist/components/Spinner.d.ts.map +1 -0
  51. package/dist/components/Switch.d.ts +10 -0
  52. package/dist/components/Switch.d.ts.map +1 -0
  53. package/dist/components/Tabs.d.ts +11 -0
  54. package/dist/components/Tabs.d.ts.map +1 -0
  55. package/dist/components/Textarea.d.ts +5 -0
  56. package/dist/components/Textarea.d.ts.map +1 -0
  57. package/dist/components/Toast.d.ts +4 -0
  58. package/dist/components/Toast.d.ts.map +1 -0
  59. package/dist/components/Tooltip.d.ts +19 -0
  60. package/dist/components/Tooltip.d.ts.map +1 -0
  61. package/dist/components/index.d.ts +30 -0
  62. package/dist/components/index.d.ts.map +1 -0
  63. package/dist/contracts/design-language.contract.d.ts +175 -0
  64. package/dist/contracts/design-language.contract.d.ts.map +1 -0
  65. package/dist/index.d.ts +7 -21506
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/languages/index.d.ts +4 -0
  68. package/dist/languages/index.d.ts.map +1 -0
  69. package/dist/languages/material3.language.d.ts +9 -0
  70. package/dist/languages/material3.language.d.ts.map +1 -0
  71. package/dist/languages/transform.d.ts +98 -0
  72. package/dist/languages/transform.d.ts.map +1 -0
  73. package/dist/main.d.ts +2 -0
  74. package/dist/main.d.ts.map +1 -0
  75. package/dist/preset/colors/index.d.ts +1485 -0
  76. package/dist/preset/colors/index.d.ts.map +1 -0
  77. package/dist/preset/colors/m3-error.d.ts +295 -0
  78. package/dist/preset/colors/m3-error.d.ts.map +1 -0
  79. package/dist/preset/colors/m3-neutral.d.ts +301 -0
  80. package/dist/preset/colors/m3-neutral.d.ts.map +1 -0
  81. package/dist/preset/colors/m3-primary.d.ts +312 -0
  82. package/dist/preset/colors/m3-primary.d.ts.map +1 -0
  83. package/dist/preset/index.d.ts +3 -0
  84. package/dist/preset/index.d.ts.map +1 -0
  85. package/dist/preset/layer-styles.d.ts +6 -0
  86. package/dist/preset/layer-styles.d.ts.map +1 -0
  87. package/dist/preset/recipes/absolute-center.d.ts +2 -0
  88. package/dist/preset/recipes/absolute-center.d.ts.map +1 -0
  89. package/dist/preset/recipes/accordion.d.ts +2 -0
  90. package/dist/preset/recipes/accordion.d.ts.map +1 -0
  91. package/dist/preset/recipes/avatar.d.ts +2 -0
  92. package/dist/preset/recipes/avatar.d.ts.map +1 -0
  93. package/dist/preset/recipes/badge.d.ts +2 -0
  94. package/dist/preset/recipes/badge.d.ts.map +1 -0
  95. package/dist/preset/recipes/button.d.ts +2 -0
  96. package/dist/preset/recipes/button.d.ts.map +1 -0
  97. package/dist/preset/recipes/card.d.ts +2 -0
  98. package/dist/preset/recipes/card.d.ts.map +1 -0
  99. package/dist/preset/recipes/checkbox.d.ts +2 -0
  100. package/dist/preset/recipes/checkbox.d.ts.map +1 -0
  101. package/dist/preset/recipes/dialog.d.ts +2 -0
  102. package/dist/preset/recipes/dialog.d.ts.map +1 -0
  103. package/dist/preset/recipes/drawer.d.ts +2 -0
  104. package/dist/preset/recipes/drawer.d.ts.map +1 -0
  105. package/dist/preset/recipes/field.d.ts +2 -0
  106. package/dist/preset/recipes/field.d.ts.map +1 -0
  107. package/dist/preset/recipes/group.d.ts +2 -0
  108. package/dist/preset/recipes/group.d.ts.map +1 -0
  109. package/dist/preset/recipes/heading.d.ts +2 -0
  110. package/dist/preset/recipes/heading.d.ts.map +1 -0
  111. package/dist/preset/recipes/index.d.ts +28 -0
  112. package/dist/preset/recipes/index.d.ts.map +1 -0
  113. package/dist/preset/recipes/input-addon.d.ts +2 -0
  114. package/dist/preset/recipes/input-addon.d.ts.map +1 -0
  115. package/dist/preset/recipes/input-group.d.ts +2 -0
  116. package/dist/preset/recipes/input-group.d.ts.map +1 -0
  117. package/dist/preset/recipes/input.d.ts +114 -0
  118. package/dist/preset/recipes/input.d.ts.map +1 -0
  119. package/dist/preset/recipes/popover.d.ts +2 -0
  120. package/dist/preset/recipes/popover.d.ts.map +1 -0
  121. package/dist/preset/recipes/progress.d.ts +2 -0
  122. package/dist/preset/recipes/progress.d.ts.map +1 -0
  123. package/dist/preset/recipes/radio-group.d.ts +2 -0
  124. package/dist/preset/recipes/radio-group.d.ts.map +1 -0
  125. package/dist/preset/recipes/select.d.ts +2 -0
  126. package/dist/preset/recipes/select.d.ts.map +1 -0
  127. package/dist/preset/recipes/skeleton.d.ts +2 -0
  128. package/dist/preset/recipes/skeleton.d.ts.map +1 -0
  129. package/dist/preset/recipes/slider.d.ts +2 -0
  130. package/dist/preset/recipes/slider.d.ts.map +1 -0
  131. package/dist/preset/recipes/spinner.d.ts +2 -0
  132. package/dist/preset/recipes/spinner.d.ts.map +1 -0
  133. package/dist/preset/recipes/switch.d.ts +2 -0
  134. package/dist/preset/recipes/switch.d.ts.map +1 -0
  135. package/dist/preset/recipes/tabs.d.ts +2 -0
  136. package/dist/preset/recipes/tabs.d.ts.map +1 -0
  137. package/dist/preset/recipes/textarea.d.ts +2 -0
  138. package/dist/preset/recipes/textarea.d.ts.map +1 -0
  139. package/dist/preset/recipes/toast.d.ts +2 -0
  140. package/dist/preset/recipes/toast.d.ts.map +1 -0
  141. package/dist/preset/recipes/tooltip.d.ts +2 -0
  142. package/dist/preset/recipes/tooltip.d.ts.map +1 -0
  143. package/dist/preset/semantic-tokens.d.ts +197 -0
  144. package/dist/preset/semantic-tokens.d.ts.map +1 -0
  145. package/dist/preset/shadows.d.ts +49 -0
  146. package/dist/preset/shadows.d.ts.map +1 -0
  147. package/dist/preset/text-styles.d.ts +6 -0
  148. package/dist/preset/text-styles.d.ts.map +1 -0
  149. package/dist/recipes/button.recipe.d.ts +2 -0
  150. package/dist/recipes/button.recipe.d.ts.map +1 -0
  151. package/dist/recipes/card.recipe.d.ts +2 -0
  152. package/dist/recipes/card.recipe.d.ts.map +1 -0
  153. package/dist/recipes/dialog.recipe.d.ts +2 -0
  154. package/dist/recipes/dialog.recipe.d.ts.map +1 -0
  155. package/dist/recipes/icon-button.recipe.d.ts +2 -0
  156. package/dist/recipes/icon-button.recipe.d.ts.map +1 -0
  157. package/dist/recipes/index.d.ts +7 -0
  158. package/dist/recipes/index.d.ts.map +1 -0
  159. package/dist/recipes/input.recipe.d.ts +2 -0
  160. package/dist/recipes/input.recipe.d.ts.map +1 -0
  161. package/dist/recipes/switch.recipe.d.ts +2 -0
  162. package/dist/recipes/switch.recipe.d.ts.map +1 -0
  163. package/dist/stories/foundations/components/ColorSwatch.d.ts +21 -0
  164. package/dist/stories/foundations/components/ColorSwatch.d.ts.map +1 -0
  165. package/dist/stories/foundations/components/ElevationCard.d.ts +11 -0
  166. package/dist/stories/foundations/components/ElevationCard.d.ts.map +1 -0
  167. package/dist/stories/foundations/components/SpacingBox.d.ts +11 -0
  168. package/dist/stories/foundations/components/SpacingBox.d.ts.map +1 -0
  169. package/dist/stories/foundations/components/TypeSpecimen.d.ts +12 -0
  170. package/dist/stories/foundations/components/TypeSpecimen.d.ts.map +1 -0
  171. package/dist/utils/cn.d.ts +6 -0
  172. package/dist/utils/cn.d.ts.map +1 -0
  173. package/package.json +4 -2
  174. package/src/components/AbsoluteCenter.tsx +7 -0
  175. package/src/components/Accordion.tsx +27 -0
  176. package/src/components/Avatar.tsx +55 -0
  177. package/src/components/Badge.tsx +29 -0
  178. package/src/components/Button.tsx +116 -0
  179. package/src/components/Card.tsx +24 -0
  180. package/src/components/Checkbox.tsx +48 -0
  181. package/src/components/CloseButton.tsx +21 -0
  182. package/src/components/Dialog.tsx +25 -0
  183. package/src/components/Drawer.tsx +29 -0
  184. package/src/components/Group.tsx +7 -0
  185. package/src/components/Heading.tsx +9 -0
  186. package/src/components/Icon.tsx +6 -0
  187. package/src/components/IconButton.tsx +10 -0
  188. package/src/components/Input.tsx +7 -0
  189. package/src/components/InputAddon.tsx +7 -0
  190. package/src/components/InputGroup.tsx +44 -0
  191. package/src/components/Loader.tsx +71 -0
  192. package/src/components/Popover.tsx +34 -0
  193. package/src/components/Progress.tsx +19 -0
  194. package/src/components/RadioGroup.tsx +21 -0
  195. package/src/components/Select.tsx +70 -0
  196. package/src/components/Skeleton.tsx +37 -0
  197. package/src/components/Slider.tsx +156 -0
  198. package/src/components/Spinner.tsx +7 -0
  199. package/src/components/Switch.tsx +19 -0
  200. package/src/components/Tabs.tsx +17 -0
  201. package/src/components/Textarea.tsx +7 -0
  202. package/src/components/Toast.tsx +96 -0
  203. package/src/components/Tooltip.tsx +65 -0
  204. package/src/components/index.ts +48 -0
  205. package/src/contracts/design-language.contract.ts +198 -0
  206. package/src/global.css +4 -0
  207. package/src/index.ts +18 -0
  208. package/src/languages/index.ts +9 -0
  209. package/src/languages/material3.language.ts +379 -0
  210. package/src/languages/transform.ts +131 -0
  211. package/src/main.ts +33 -0
  212. package/src/preset/colors/index.ts +14 -0
  213. package/src/preset/colors/m3-error.ts +76 -0
  214. package/src/preset/colors/m3-neutral.ts +89 -0
  215. package/src/preset/colors/m3-primary.ts +107 -0
  216. package/src/preset/index.ts +189 -0
  217. package/src/preset/layer-styles.ts +14 -0
  218. package/src/preset/recipes/absolute-center.ts +37 -0
  219. package/src/preset/recipes/accordion.ts +92 -0
  220. package/src/preset/recipes/avatar.ts +152 -0
  221. package/src/preset/recipes/badge.ts +49 -0
  222. package/src/preset/recipes/button.ts +110 -0
  223. package/src/preset/recipes/card.ts +69 -0
  224. package/src/preset/recipes/checkbox.ts +109 -0
  225. package/src/preset/recipes/dialog.ts +157 -0
  226. package/src/preset/recipes/drawer.ts +203 -0
  227. package/src/preset/recipes/field.ts +40 -0
  228. package/src/preset/recipes/group.ts +77 -0
  229. package/src/preset/recipes/heading.ts +26 -0
  230. package/src/preset/recipes/index.ts +40 -0
  231. package/src/preset/recipes/input-addon.ts +42 -0
  232. package/src/preset/recipes/input-group.ts +66 -0
  233. package/src/preset/recipes/input.ts +87 -0
  234. package/src/preset/recipes/popover.ts +77 -0
  235. package/src/preset/recipes/progress.ts +120 -0
  236. package/src/preset/recipes/radio-group.ts +99 -0
  237. package/src/preset/recipes/select.ts +175 -0
  238. package/src/preset/recipes/skeleton.ts +64 -0
  239. package/src/preset/recipes/slider.ts +174 -0
  240. package/src/preset/recipes/spinner.ts +33 -0
  241. package/src/preset/recipes/switch.ts +136 -0
  242. package/src/preset/recipes/tabs.ts +177 -0
  243. package/src/preset/recipes/textarea.ts +82 -0
  244. package/src/preset/recipes/toast.ts +51 -0
  245. package/src/preset/recipes/tooltip.ts +38 -0
  246. package/src/preset/semantic-tokens.ts +75 -0
  247. package/src/preset/shadows.ts +50 -0
  248. package/src/preset/text-styles.ts +21 -0
  249. package/src/recipes/button.recipe.ts +120 -0
  250. package/src/recipes/card.recipe.ts +50 -0
  251. package/src/recipes/dialog.recipe.ts +130 -0
  252. package/src/recipes/icon-button.recipe.ts +96 -0
  253. package/src/recipes/index.ts +6 -0
  254. package/src/recipes/input.recipe.ts +93 -0
  255. package/src/recipes/switch.recipe.ts +117 -0
  256. package/src/stories/foundations/Colors.mdx +380 -0
  257. package/src/stories/foundations/Elevation.mdx +292 -0
  258. package/src/stories/foundations/Spacing.mdx +223 -0
  259. package/src/stories/foundations/Typography.mdx +264 -0
  260. package/src/stories/foundations/components/ColorSwatch.tsx +166 -0
  261. package/src/stories/foundations/components/ElevationCard.tsx +81 -0
  262. package/src/stories/foundations/components/SpacingBox.tsx +94 -0
  263. package/src/stories/foundations/components/TypeSpecimen.tsx +117 -0
  264. package/src/test/setup.ts +12 -0
  265. package/src/test/vitest.d.ts +29 -0
  266. package/src/utils/cn.ts +8 -0
  267. package/src/vite-env.d.ts +1 -0
  268. package/dist/index.d.cts +0 -21506
@@ -0,0 +1,223 @@
1
+ import { Meta } from '@storybook/blocks';
2
+ import { SpacingBox } from './components/SpacingBox';
3
+ import { material3Language } from '../../languages/material3.language';
4
+
5
+ <Meta title="Foundations/Spacing" />
6
+
7
+ # Spacing
8
+
9
+ The Discourser Design System uses a consistent spacing scale based on an 8-point grid system. This creates visual rhythm and helps maintain consistent layouts across all components and screens.
10
+
11
+ ## Spacing Scale
12
+
13
+ Our spacing scale ranges from `none` (0px) to `xxxl` (64px), with incremental steps that follow a logical progression.
14
+
15
+ <div style={{ marginTop: '32px', marginBottom: '48px' }}>
16
+ <SpacingBox name="none" value={material3Language.spacing.none} />
17
+ <SpacingBox name="xxs" value={material3Language.spacing.xxs} />
18
+ <SpacingBox name="xs" value={material3Language.spacing.xs} />
19
+ <SpacingBox name="sm" value={material3Language.spacing.sm} />
20
+ <SpacingBox name="md" value={material3Language.spacing.md} />
21
+ <SpacingBox name="lg" value={material3Language.spacing.lg} />
22
+ <SpacingBox name="xl" value={material3Language.spacing.xl} />
23
+ <SpacingBox name="xxl" value={material3Language.spacing.xxl} />
24
+ <SpacingBox name="xxxl" value={material3Language.spacing.xxxl} />
25
+ </div>
26
+
27
+ ---
28
+
29
+ ## Spacing Reference Table
30
+
31
+ | Token | Value | Pixels | Use Case |
32
+ |-------|-------|--------|----------|
33
+ | `none` | {material3Language.spacing.none} | 0px | Reset spacing, remove gaps |
34
+ | `xxs` | {material3Language.spacing.xxs} | 2px | Minimal gaps, fine-tuning |
35
+ | `xs` | {material3Language.spacing.xs} | 4px | Tight spacing within components |
36
+ | `sm` | {material3Language.spacing.sm} | 8px | Component internal spacing |
37
+ | `md` | {material3Language.spacing.md} | 16px | Default spacing, component gaps |
38
+ | `lg` | {material3Language.spacing.lg} | 24px | Section spacing, card padding |
39
+ | `xl` | {material3Language.spacing.xl} | 32px | Large section breaks |
40
+ | `xxl` | {material3Language.spacing.xxl} | 48px | Major section dividers |
41
+ | `xxxl` | {material3Language.spacing.xxxl} | 64px | Page-level spacing |
42
+
43
+ ---
44
+
45
+ ## Usage Guidelines
46
+
47
+ ### Common Patterns
48
+
49
+ **Component Internal Spacing**
50
+ - Icon-to-text gap: `xs` (4px) or `sm` (8px)
51
+ - Button padding: `sm` (8px) vertical, `md` (16px) horizontal
52
+ - Input padding: `md` (16px)
53
+
54
+ **Component Gaps**
55
+ - Between related items: `sm` (8px) or `md` (16px)
56
+ - Between form fields: `md` (16px) or `lg` (24px)
57
+ - Between sections: `lg` (24px) to `xxl` (48px)
58
+
59
+ **Layout Spacing**
60
+ - Card padding: `lg` (24px) or `xl` (32px)
61
+ - Section margins: `xl` (32px) or `xxl` (48px)
62
+ - Page margins: `xxl` (48px) or `xxxl` (64px)
63
+
64
+ ### The 8-Point Grid
65
+
66
+ Most of our spacing values are multiples of 8px, which:
67
+ - Creates visual consistency
68
+ - Simplifies spacing decisions
69
+ - Works well with common screen sizes
70
+ - Aligns with Material Design principles
71
+
72
+ The exceptions (`xxs: 2px`) are provided for fine-tuning and edge cases.
73
+
74
+ ### Responsive Spacing
75
+
76
+ Consider adjusting spacing at different breakpoints:
77
+
78
+ ```tsx
79
+ import { css } from 'styled-system/css';
80
+
81
+ const containerStyle = css({
82
+ padding: {
83
+ base: 'md', // 16px on mobile
84
+ md: 'lg', // 24px on tablet
85
+ lg: 'xl' // 32px on desktop
86
+ }
87
+ });
88
+ ```
89
+
90
+ ### Negative Space
91
+
92
+ Empty space is just as important as filled space. Use larger spacing values to:
93
+ - Create visual breathing room
94
+ - Establish content hierarchy
95
+ - Guide user attention
96
+ - Improve scannability
97
+
98
+ ---
99
+
100
+ ## Example Usage
101
+
102
+ ### Padding
103
+
104
+ ```tsx
105
+ import { css } from 'styled-system/css';
106
+
107
+ // Card padding
108
+ const cardStyle = css({
109
+ padding: 'lg' // 24px all sides
110
+ });
111
+
112
+ // Asymmetric padding
113
+ const headerStyle = css({
114
+ paddingX: 'md', // 16px horizontal
115
+ paddingY: 'sm' // 8px vertical
116
+ });
117
+ ```
118
+
119
+ ### Margins
120
+
121
+ ```tsx
122
+ import { css } from 'styled-system/css';
123
+
124
+ // Section spacing
125
+ const sectionStyle = css({
126
+ marginBottom: 'xxl' // 48px bottom margin
127
+ });
128
+
129
+ // Component gap
130
+ const stackStyle = css({
131
+ display: 'flex',
132
+ flexDirection: 'column',
133
+ gap: 'md' // 16px between children
134
+ });
135
+ ```
136
+
137
+ ### Gap (Flexbox/Grid)
138
+
139
+ ```tsx
140
+ import { css } from 'styled-system/css';
141
+
142
+ // Grid layout
143
+ const gridStyle = css({
144
+ display: 'grid',
145
+ gridTemplateColumns: 'repeat(3, 1fr)',
146
+ gap: 'lg' // 24px between grid items
147
+ });
148
+
149
+ // Flex layout
150
+ const flexStyle = css({
151
+ display: 'flex',
152
+ gap: 'sm' // 8px between flex items
153
+ });
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Visual Examples
159
+
160
+ ### Compact Layout (sm spacing)
161
+
162
+ <div style={{
163
+ display: 'flex',
164
+ flexDirection: 'column',
165
+ gap: material3Language.spacing.sm,
166
+ padding: material3Language.spacing.md,
167
+ backgroundColor: '#f5f5f5',
168
+ borderRadius: '8px',
169
+ marginBottom: '24px'
170
+ }}>
171
+ <div style={{ padding: '12px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
172
+ Item 1 (gap: 8px)
173
+ </div>
174
+ <div style={{ padding: '12px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
175
+ Item 2
176
+ </div>
177
+ <div style={{ padding: '12px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
178
+ Item 3
179
+ </div>
180
+ </div>
181
+
182
+ ### Comfortable Layout (md spacing)
183
+
184
+ <div style={{
185
+ display: 'flex',
186
+ flexDirection: 'column',
187
+ gap: material3Language.spacing.md,
188
+ padding: material3Language.spacing.lg,
189
+ backgroundColor: '#f5f5f5',
190
+ borderRadius: '8px',
191
+ marginBottom: '24px'
192
+ }}>
193
+ <div style={{ padding: '16px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
194
+ Item 1 (gap: 16px)
195
+ </div>
196
+ <div style={{ padding: '16px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
197
+ Item 2
198
+ </div>
199
+ <div style={{ padding: '16px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
200
+ Item 3
201
+ </div>
202
+ </div>
203
+
204
+ ### Spacious Layout (lg spacing)
205
+
206
+ <div style={{
207
+ display: 'flex',
208
+ flexDirection: 'column',
209
+ gap: material3Language.spacing.lg,
210
+ padding: material3Language.spacing.xl,
211
+ backgroundColor: '#f5f5f5',
212
+ borderRadius: '8px'
213
+ }}>
214
+ <div style={{ padding: '20px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
215
+ Item 1 (gap: 24px)
216
+ </div>
217
+ <div style={{ padding: '20px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
218
+ Item 2
219
+ </div>
220
+ <div style={{ padding: '20px', backgroundColor: '#4C662B', color: 'white', borderRadius: '4px' }}>
221
+ Item 3
222
+ </div>
223
+ </div>
@@ -0,0 +1,264 @@
1
+ import { Meta } from '@storybook/blocks';
2
+ import { TypeSpecimen } from './components/TypeSpecimen';
3
+ import { material3Language } from '../../languages/material3.language';
4
+
5
+ <Meta title="Foundations/Typography" />
6
+
7
+ # Typography
8
+
9
+ The Discourser Design System uses Material Design 3's type scale, which provides a comprehensive set of text styles optimized for readability and hierarchy across all screen sizes.
10
+
11
+ ## Font Families
12
+
13
+ The system uses three font families, each serving a specific purpose:
14
+
15
+ <div style={{ marginBottom: '32px', padding: '24px', backgroundColor: '#f5f5f5', borderRadius: '8px' }}>
16
+ <div style={{ marginBottom: '16px' }}>
17
+ <div style={{ fontWeight: '600', marginBottom: '8px' }}>Display</div>
18
+ <div style={{ fontFamily: material3Language.typography.fonts.display, fontSize: '24px', marginBottom: '4px' }}>
19
+ "Fraunces", Georgia, serif
20
+ </div>
21
+ <div style={{ fontSize: '12px', color: '#666' }}>
22
+ Used for display and headline styles. Provides an elegant, editorial feel.
23
+ </div>
24
+ </div>
25
+
26
+ <div style={{ marginBottom: '16px' }}>
27
+ <div style={{ fontWeight: '600', marginBottom: '8px' }}>Body</div>
28
+ <div style={{ fontFamily: material3Language.typography.fonts.body, fontSize: '16px', marginBottom: '4px' }}>
29
+ "Poppins", -apple-system, BlinkMacSystemFont, sans-serif
30
+ </div>
31
+ <div style={{ fontSize: '12px', color: '#666' }}>
32
+ Used for body text, titles, and labels. Optimized for legibility at all sizes.
33
+ </div>
34
+ </div>
35
+
36
+ <div>
37
+ <div style={{ fontWeight: '600', marginBottom: '8px' }}>Monospace</div>
38
+ <div style={{ fontFamily: material3Language.typography.fonts.mono, fontSize: '14px', marginBottom: '4px' }}>
39
+ JetBrains Mono, Fira Code, Consolas, monospace
40
+ </div>
41
+ <div style={{ fontSize: '12px', color: '#666' }}>
42
+ Used for code snippets and technical content. Supports ligatures.
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ ---
48
+
49
+ ## Type Scale
50
+
51
+ Material Design 3's type scale consists of 13 styles across 5 categories: Display, Headline, Title, Body, and Label.
52
+
53
+ ### Display Styles
54
+
55
+ Display styles are the largest text on screen, reserved for short, important text or numerals.
56
+
57
+ <TypeSpecimen
58
+ name="Display Large"
59
+ fontSize={material3Language.typography.scale.displayLarge.fontSize}
60
+ lineHeight={material3Language.typography.scale.displayLarge.lineHeight}
61
+ fontWeight={material3Language.typography.scale.displayLarge.fontWeight}
62
+ letterSpacing={material3Language.typography.scale.displayLarge.letterSpacing}
63
+ fontFamily={material3Language.typography.scale.displayLarge.fontFamily}
64
+ sampleText="Display Large"
65
+ />
66
+
67
+ <TypeSpecimen
68
+ name="Display Medium"
69
+ fontSize={material3Language.typography.scale.displayMedium.fontSize}
70
+ lineHeight={material3Language.typography.scale.displayMedium.lineHeight}
71
+ fontWeight={material3Language.typography.scale.displayMedium.fontWeight}
72
+ letterSpacing={material3Language.typography.scale.displayMedium.letterSpacing}
73
+ fontFamily={material3Language.typography.scale.displayMedium.fontFamily}
74
+ sampleText="Display Medium"
75
+ />
76
+
77
+ <TypeSpecimen
78
+ name="Display Small"
79
+ fontSize={material3Language.typography.scale.displaySmall.fontSize}
80
+ lineHeight={material3Language.typography.scale.displaySmall.lineHeight}
81
+ fontWeight={material3Language.typography.scale.displaySmall.fontWeight}
82
+ letterSpacing={material3Language.typography.scale.displaySmall.letterSpacing}
83
+ fontFamily={material3Language.typography.scale.displaySmall.fontFamily}
84
+ sampleText="Display Small"
85
+ />
86
+
87
+ ### Headline Styles
88
+
89
+ Headlines are for high-emphasis text on smaller screens. They're best-suited for short, high-emphasis text.
90
+
91
+ <TypeSpecimen
92
+ name="Headline Large"
93
+ fontSize={material3Language.typography.scale.headlineLarge.fontSize}
94
+ lineHeight={material3Language.typography.scale.headlineLarge.lineHeight}
95
+ fontWeight={material3Language.typography.scale.headlineLarge.fontWeight}
96
+ letterSpacing={material3Language.typography.scale.headlineLarge.letterSpacing}
97
+ fontFamily={material3Language.typography.scale.headlineLarge.fontFamily}
98
+ sampleText="Headline Large"
99
+ />
100
+
101
+ <TypeSpecimen
102
+ name="Headline Medium"
103
+ fontSize={material3Language.typography.scale.headlineMedium.fontSize}
104
+ lineHeight={material3Language.typography.scale.headlineMedium.lineHeight}
105
+ fontWeight={material3Language.typography.scale.headlineMedium.fontWeight}
106
+ letterSpacing={material3Language.typography.scale.headlineMedium.letterSpacing}
107
+ fontFamily={material3Language.typography.scale.headlineMedium.fontFamily}
108
+ sampleText="Headline Medium"
109
+ />
110
+
111
+ <TypeSpecimen
112
+ name="Headline Small"
113
+ fontSize={material3Language.typography.scale.headlineSmall.fontSize}
114
+ lineHeight={material3Language.typography.scale.headlineSmall.lineHeight}
115
+ fontWeight={material3Language.typography.scale.headlineSmall.fontWeight}
116
+ letterSpacing={material3Language.typography.scale.headlineSmall.letterSpacing}
117
+ fontFamily={material3Language.typography.scale.headlineSmall.fontFamily}
118
+ sampleText="Headline Small"
119
+ />
120
+
121
+ ### Title Styles
122
+
123
+ Titles are for medium-emphasis text that remains relatively short. Use titles for grouping related content or to emphasize important sections.
124
+
125
+ <TypeSpecimen
126
+ name="Title Large"
127
+ fontSize={material3Language.typography.scale.titleLarge.fontSize}
128
+ lineHeight={material3Language.typography.scale.titleLarge.lineHeight}
129
+ fontWeight={material3Language.typography.scale.titleLarge.fontWeight}
130
+ letterSpacing={material3Language.typography.scale.titleLarge.letterSpacing}
131
+ fontFamily={material3Language.typography.scale.titleLarge.fontFamily}
132
+ sampleText="Title Large"
133
+ />
134
+
135
+ <TypeSpecimen
136
+ name="Title Medium"
137
+ fontSize={material3Language.typography.scale.titleMedium.fontSize}
138
+ lineHeight={material3Language.typography.scale.titleMedium.lineHeight}
139
+ fontWeight={material3Language.typography.scale.titleMedium.fontWeight}
140
+ letterSpacing={material3Language.typography.scale.titleMedium.letterSpacing}
141
+ fontFamily={material3Language.typography.scale.titleMedium.fontFamily}
142
+ sampleText="Title Medium"
143
+ />
144
+
145
+ <TypeSpecimen
146
+ name="Title Small"
147
+ fontSize={material3Language.typography.scale.titleSmall.fontSize}
148
+ lineHeight={material3Language.typography.scale.titleSmall.lineHeight}
149
+ fontWeight={material3Language.typography.scale.titleSmall.fontWeight}
150
+ letterSpacing={material3Language.typography.scale.titleSmall.letterSpacing}
151
+ fontFamily={material3Language.typography.scale.titleSmall.fontFamily}
152
+ sampleText="Title Small"
153
+ />
154
+
155
+ ### Body Styles
156
+
157
+ Body styles are used for longer passages of text in your app.
158
+
159
+ <TypeSpecimen
160
+ name="Body Large"
161
+ fontSize={material3Language.typography.scale.bodyLarge.fontSize}
162
+ lineHeight={material3Language.typography.scale.bodyLarge.lineHeight}
163
+ fontWeight={material3Language.typography.scale.bodyLarge.fontWeight}
164
+ letterSpacing={material3Language.typography.scale.bodyLarge.letterSpacing}
165
+ fontFamily={material3Language.typography.scale.bodyLarge.fontFamily}
166
+ sampleText="The quick brown fox jumps over the lazy dog. Body Large is used for longer passages of text that require good readability."
167
+ />
168
+
169
+ <TypeSpecimen
170
+ name="Body Medium"
171
+ fontSize={material3Language.typography.scale.bodyMedium.fontSize}
172
+ lineHeight={material3Language.typography.scale.bodyMedium.lineHeight}
173
+ fontWeight={material3Language.typography.scale.bodyMedium.fontWeight}
174
+ letterSpacing={material3Language.typography.scale.bodyMedium.letterSpacing}
175
+ fontFamily={material3Language.typography.scale.bodyMedium.fontFamily}
176
+ sampleText="The quick brown fox jumps over the lazy dog. Body Medium is the default body text size, balanced for readability and screen real estate."
177
+ />
178
+
179
+ <TypeSpecimen
180
+ name="Body Small"
181
+ fontSize={material3Language.typography.scale.bodySmall.fontSize}
182
+ lineHeight={material3Language.typography.scale.bodySmall.lineHeight}
183
+ fontWeight={material3Language.typography.scale.bodySmall.fontWeight}
184
+ letterSpacing={material3Language.typography.scale.bodySmall.letterSpacing}
185
+ fontFamily={material3Language.typography.scale.bodySmall.fontFamily}
186
+ sampleText="The quick brown fox jumps over the lazy dog. Body Small is used for captions and supporting text that doesn't require much emphasis."
187
+ />
188
+
189
+ ### Label Styles
190
+
191
+ Label styles are for text in components like buttons, tabs, and labels. They're utilitarian and medium-emphasis.
192
+
193
+ <TypeSpecimen
194
+ name="Label Large"
195
+ fontSize={material3Language.typography.scale.labelLarge.fontSize}
196
+ lineHeight={material3Language.typography.scale.labelLarge.lineHeight}
197
+ fontWeight={material3Language.typography.scale.labelLarge.fontWeight}
198
+ letterSpacing={material3Language.typography.scale.labelLarge.letterSpacing}
199
+ fontFamily={material3Language.typography.scale.labelLarge.fontFamily}
200
+ sampleText="Label Large"
201
+ />
202
+
203
+ <TypeSpecimen
204
+ name="Label Medium"
205
+ fontSize={material3Language.typography.scale.labelMedium.fontSize}
206
+ lineHeight={material3Language.typography.scale.labelMedium.lineHeight}
207
+ fontWeight={material3Language.typography.scale.labelMedium.fontWeight}
208
+ letterSpacing={material3Language.typography.scale.labelMedium.letterSpacing}
209
+ fontFamily={material3Language.typography.scale.labelMedium.fontFamily}
210
+ sampleText="Label Medium"
211
+ />
212
+
213
+ <TypeSpecimen
214
+ name="Label Small"
215
+ fontSize={material3Language.typography.scale.labelSmall.fontSize}
216
+ lineHeight={material3Language.typography.scale.labelSmall.lineHeight}
217
+ fontWeight={material3Language.typography.scale.labelSmall.fontWeight}
218
+ letterSpacing={material3Language.typography.scale.labelSmall.letterSpacing}
219
+ fontFamily={material3Language.typography.scale.labelSmall.fontFamily}
220
+ sampleText="Label Small"
221
+ />
222
+
223
+ ---
224
+
225
+ ## Usage Guidelines
226
+
227
+ ### Choosing the Right Style
228
+
229
+ **Display**: Hero text, marketing headlines, featured numbers
230
+ **Headline**: Page titles, section headers, card titles
231
+ **Title**: List item titles, dialog titles, form section headers
232
+ **Body**: Paragraphs, descriptions, long-form content
233
+ **Label**: Buttons, tabs, chips, form labels, captions
234
+
235
+ ### Responsive Typography
236
+
237
+ Consider using different type styles at different breakpoints:
238
+
239
+ - **Mobile**: Prefer smaller display/headline sizes
240
+ - **Tablet**: Use medium sizes for most content
241
+ - **Desktop**: Larger displays can accommodate bigger type
242
+
243
+ ### Accessibility
244
+
245
+ - Maintain minimum 16px font size for body text
246
+ - Ensure sufficient line height (1.5 for body text)
247
+ - Use proper heading hierarchy (h1 → h2 → h3)
248
+ - Test with browser zoom up to 200%
249
+
250
+ ### Example Usage
251
+
252
+ ```tsx
253
+ import { css } from 'styled-system/css';
254
+
255
+ const headingStyle = css({
256
+ textStyle: 'headlineLarge',
257
+ color: 'onSurface'
258
+ });
259
+
260
+ const bodyStyle = css({
261
+ textStyle: 'bodyMedium',
262
+ color: 'onSurfaceVariant'
263
+ });
264
+ ```
@@ -0,0 +1,166 @@
1
+ import { type CSSProperties } from 'react';
2
+
3
+ interface ColorSwatchProps {
4
+ name: string;
5
+ value: string;
6
+ description?: string;
7
+ }
8
+
9
+ export const ColorSwatch = ({ name, value, description }: ColorSwatchProps) => {
10
+ const swatchStyle: CSSProperties = {
11
+ backgroundColor: value,
12
+ width: '100%',
13
+ height: '80px',
14
+ borderRadius: '8px',
15
+ border: '1px solid rgba(0, 0, 0, 0.1)',
16
+ marginBottom: '8px',
17
+ };
18
+
19
+ const containerStyle: CSSProperties = {
20
+ display: 'flex',
21
+ flexDirection: 'column',
22
+ marginBottom: '16px',
23
+ };
24
+
25
+ const labelStyle: CSSProperties = {
26
+ fontSize: '14px',
27
+ fontWeight: '500',
28
+ marginBottom: '4px',
29
+ fontFamily: 'Inter, sans-serif',
30
+ };
31
+
32
+ const valueStyle: CSSProperties = {
33
+ fontSize: '12px',
34
+ fontFamily: 'monospace',
35
+ color: '#666',
36
+ };
37
+
38
+ const descStyle: CSSProperties = {
39
+ fontSize: '12px',
40
+ color: '#666',
41
+ marginTop: '4px',
42
+ };
43
+
44
+ return (
45
+ <div style={containerStyle}>
46
+ <div style={swatchStyle} />
47
+ <div style={labelStyle}>{name}</div>
48
+ <div style={valueStyle}>{value}</div>
49
+ {description && <div style={descStyle}>{description}</div>}
50
+ </div>
51
+ );
52
+ };
53
+
54
+ interface TonalSwatchProps {
55
+ paletteName: string;
56
+ tone: number;
57
+ value: string;
58
+ }
59
+
60
+ export const TonalSwatch = ({ paletteName, tone, value }: TonalSwatchProps) => {
61
+ const swatchStyle: CSSProperties = {
62
+ backgroundColor: value,
63
+ width: '100%',
64
+ height: '60px',
65
+ display: 'flex',
66
+ alignItems: 'center',
67
+ justifyContent: 'center',
68
+ border: '1px solid rgba(0, 0, 0, 0.1)',
69
+ position: 'relative',
70
+ };
71
+
72
+ const labelStyle: CSSProperties = {
73
+ fontSize: '11px',
74
+ fontWeight: '500',
75
+ fontFamily: 'monospace',
76
+ color: tone >= 50 ? '#000' : '#fff',
77
+ mixBlendMode: 'difference',
78
+ };
79
+
80
+ return (
81
+ <div style={swatchStyle} title={`${paletteName}.${tone}: ${value}`}>
82
+ <span style={labelStyle}>{tone}</span>
83
+ </div>
84
+ );
85
+ };
86
+
87
+ interface SemanticSwatchProps {
88
+ name: string;
89
+ lightValue: string;
90
+ darkValue: string;
91
+ description?: string;
92
+ }
93
+
94
+ export const SemanticSwatch = ({
95
+ name,
96
+ lightValue,
97
+ darkValue,
98
+ description,
99
+ }: SemanticSwatchProps) => {
100
+ const containerStyle: CSSProperties = {
101
+ display: 'grid',
102
+ gridTemplateColumns: '1fr 1fr',
103
+ gap: '8px',
104
+ marginBottom: '16px',
105
+ };
106
+
107
+ const swatchContainerStyle: CSSProperties = {
108
+ display: 'flex',
109
+ flexDirection: 'column',
110
+ };
111
+
112
+ const swatchStyle = (color: string): CSSProperties => ({
113
+ backgroundColor: color,
114
+ height: '80px',
115
+ borderRadius: '8px',
116
+ border: '1px solid rgba(0, 0, 0, 0.1)',
117
+ marginBottom: '8px',
118
+ });
119
+
120
+ const labelStyle: CSSProperties = {
121
+ fontSize: '14px',
122
+ fontWeight: '500',
123
+ marginBottom: '4px',
124
+ fontFamily: 'Inter, sans-serif',
125
+ };
126
+
127
+ const valueStyle: CSSProperties = {
128
+ fontSize: '11px',
129
+ fontFamily: 'monospace',
130
+ color: '#666',
131
+ };
132
+
133
+ const modeStyle: CSSProperties = {
134
+ fontSize: '10px',
135
+ textTransform: 'uppercase',
136
+ color: '#999',
137
+ marginBottom: '4px',
138
+ fontWeight: '600',
139
+ };
140
+
141
+ const descStyle: CSSProperties = {
142
+ fontSize: '12px',
143
+ color: '#666',
144
+ marginTop: '8px',
145
+ gridColumn: '1 / -1',
146
+ };
147
+
148
+ return (
149
+ <div>
150
+ <div style={labelStyle}>{name}</div>
151
+ <div style={containerStyle}>
152
+ <div style={swatchContainerStyle}>
153
+ <div style={modeStyle}>Light</div>
154
+ <div style={swatchStyle(lightValue)} />
155
+ <div style={valueStyle}>{lightValue}</div>
156
+ </div>
157
+ <div style={swatchContainerStyle}>
158
+ <div style={modeStyle}>Dark</div>
159
+ <div style={swatchStyle(darkValue)} />
160
+ <div style={valueStyle}>{darkValue}</div>
161
+ </div>
162
+ </div>
163
+ {description && <div style={descStyle}>{description}</div>}
164
+ </div>
165
+ );
166
+ };