@discourser/design-system 0.25.3 → 0.27.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.
- package/README.md +76 -73
- package/dist/{chunk-ZPECW4N2.js → chunk-4XOWPACJ.js} +257 -105
- package/dist/chunk-4XOWPACJ.js.map +1 -0
- package/dist/{chunk-QNCZYFUJ.cjs → chunk-AZ6QU2L2.cjs} +257 -105
- package/dist/chunk-AZ6QU2L2.cjs.map +1 -0
- package/dist/{chunk-TBLDQATQ.cjs → chunk-EBDNCZF6.cjs} +94 -54
- package/dist/chunk-EBDNCZF6.cjs.map +1 -0
- package/dist/{chunk-UHSL4N44.js → chunk-MAVUSE4F.js} +94 -55
- package/dist/chunk-MAVUSE4F.js.map +1 -0
- package/dist/components/Checkbox.d.ts +1 -1
- package/dist/components/Icons/LeftArrowIcon.d.ts +6 -0
- package/dist/components/Icons/LeftArrowIcon.d.ts.map +1 -0
- package/dist/components/Icons/RightArrowIcon.d.ts.map +1 -1
- package/dist/components/Icons/index.d.ts +1 -0
- package/dist/components/Icons/index.d.ts.map +1 -1
- package/dist/components/index.cjs +79 -75
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/contracts/design-language.contract.d.ts +52 -18
- package/dist/contracts/design-language.contract.d.ts.map +1 -1
- package/dist/figma-codex.json +2 -2
- package/dist/index.cjs +83 -79
- package/dist/index.js +2 -2
- package/dist/languages/material3.language.d.ts.map +1 -1
- package/dist/languages/transform.d.ts +5 -5
- package/dist/languages/transform.d.ts.map +1 -1
- package/dist/preset/index.cjs +2 -2
- package/dist/preset/index.js +1 -1
- package/docs/component-catalog.md +469 -0
- package/docs/superpowers/plans/2026-04-03-component-catalog-pipeline.md +667 -0
- package/docs/token-name-mapping.json +614 -42
- package/docs/token-name-mapping.md +117 -29
- package/package.json +3 -2
- package/src/components/Icons/LeftArrowIcon.tsx +28 -0
- package/src/components/Icons/RightArrowIcon.tsx +7 -2
- package/src/components/Icons/index.ts +1 -0
- package/src/components/__tests__/AbsoluteCenter.test.tsx +31 -0
- package/src/components/__tests__/Divider.test.tsx +38 -0
- package/src/components/__tests__/Group.test.tsx +34 -0
- package/src/components/__tests__/Icon.test.tsx +31 -0
- package/src/components/__tests__/SettingsPopover.test.tsx +39 -0
- package/src/components/__tests__/StudioControls.test.tsx +59 -0
- package/src/components/__tests__/Toaster.test.tsx +24 -0
- package/src/components/index.ts +1 -0
- package/src/contracts/design-language.contract.ts +69 -20
- package/src/languages/material3.language.ts +249 -80
- package/src/languages/transform.ts +45 -48
- package/src/preset/__tests__/translation-token-accuracy.test.ts +13 -0
- package/src/stories/foundations/Colors.mdx +9 -1
- package/src/stories/foundations/Elevation.mdx +23 -17
- package/src/stories/foundations/TokenReference.stories.tsx +970 -0
- package/src/stories/foundations/TonalPaletteDerivation.stories.tsx +782 -0
- package/src/stories/foundations/Typography.mdx +125 -25
- package/dist/chunk-QNCZYFUJ.cjs.map +0 -1
- package/dist/chunk-TBLDQATQ.cjs.map +0 -1
- package/dist/chunk-UHSL4N44.js.map +0 -1
- package/dist/chunk-ZPECW4N2.js.map +0 -1
- package/docs/context-share/ELEVATION_FIX_PLAN.md +0 -903
- package/docs/context-share/fix-checkbox-radio-tokens.md +0 -145
- package/docs/context-share/icon-component-prompt.md +0 -154
|
@@ -13,32 +13,35 @@ The system uses three font families, each serving a specific purpose:
|
|
|
13
13
|
|
|
14
14
|
<div style={{ marginBottom: '32px', padding: '24px', backgroundColor: '#f5f5f5', borderRadius: '8px' }}>
|
|
15
15
|
<div style={{ marginBottom: '16px' }}>
|
|
16
|
-
<div style={{ fontWeight: '600', marginBottom: '8px' }}>Display</div>
|
|
16
|
+
<div style={{ fontWeight: '600', marginBottom: '8px' }}>Display — Fraunces</div>
|
|
17
17
|
<div style={{ fontFamily: '"Fraunces", Georgia, serif', fontSize: '24px', marginBottom: '4px' }}>
|
|
18
|
-
|
|
18
|
+
The quick brown fox jumps over the lazy dog
|
|
19
19
|
</div>
|
|
20
20
|
<div style={{ fontSize: '12px', color: '#666' }}>
|
|
21
|
-
Used for display and headline styles. Provides an elegant, editorial feel
|
|
21
|
+
Used for display and headline styles. Provides an elegant, editorial feel.<br />
|
|
22
|
+
Available weights: Thin (100), Light (300), Regular (400), Medium (500), SemiBold (600), Bold (700)
|
|
22
23
|
</div>
|
|
23
24
|
</div>
|
|
24
25
|
|
|
25
26
|
<div style={{ marginBottom: '16px' }}>
|
|
26
|
-
<div style={{ fontWeight: '600', marginBottom: '8px' }}>Body</div>
|
|
27
|
+
<div style={{ fontWeight: '600', marginBottom: '8px' }}>Body — Poppins</div>
|
|
27
28
|
<div style={{ fontFamily: '"Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', fontSize: '16px', marginBottom: '4px' }}>
|
|
28
|
-
|
|
29
|
+
The quick brown fox jumps over the lazy dog
|
|
29
30
|
</div>
|
|
30
31
|
<div style={{ fontSize: '12px', color: '#666' }}>
|
|
31
|
-
Used for body text, titles, and labels. Optimized for legibility at all sizes
|
|
32
|
+
Used for body text, titles, and labels. Optimized for legibility at all sizes.<br />
|
|
33
|
+
Available weights: Thin (100), Light (300), Regular (400), Medium (500), SemiBold (600), Bold (700)
|
|
32
34
|
</div>
|
|
33
35
|
</div>
|
|
34
36
|
|
|
35
37
|
<div>
|
|
36
|
-
<div style={{ fontWeight: '600', marginBottom: '8px' }}>Monospace</div>
|
|
38
|
+
<div style={{ fontWeight: '600', marginBottom: '8px' }}>Monospace — JetBrains Mono</div>
|
|
37
39
|
<div style={{ fontFamily: '"JetBrains Mono", "Fira Code", Consolas, monospace', fontSize: '14px', marginBottom: '4px' }}>
|
|
38
|
-
|
|
40
|
+
The quick brown fox jumps over the lazy dog
|
|
39
41
|
</div>
|
|
40
42
|
<div style={{ fontSize: '12px', color: '#666' }}>
|
|
41
|
-
Used for code snippets and technical content. Supports ligatures
|
|
43
|
+
Used for code snippets and technical content. Supports ligatures.<br />
|
|
44
|
+
Available weights: Regular (400), Bold (700)
|
|
42
45
|
</div>
|
|
43
46
|
</div>
|
|
44
47
|
</div>
|
|
@@ -47,11 +50,11 @@ The system uses three font families, each serving a specific purpose:
|
|
|
47
50
|
|
|
48
51
|
## Type Scale
|
|
49
52
|
|
|
50
|
-
Material Design 3's type scale consists of
|
|
53
|
+
Material Design 3's type scale consists of 15 styles across 5 categories: Display, Headline, Title, Body, and Label.
|
|
51
54
|
|
|
52
55
|
### Display Styles
|
|
53
56
|
|
|
54
|
-
Display styles are the largest text on screen, reserved for short, important text or numerals.
|
|
57
|
+
Display styles are the largest text on screen, reserved for short, important text or numerals. Uses **Fraunces** (display font family). Default weight: **regular (400)**.
|
|
55
58
|
|
|
56
59
|
<TypeSpecimen
|
|
57
60
|
styleName="displayLarge"
|
|
@@ -88,7 +91,7 @@ Display styles are the largest text on screen, reserved for short, important tex
|
|
|
88
91
|
|
|
89
92
|
### Headline Styles
|
|
90
93
|
|
|
91
|
-
Headlines are for high-emphasis text on smaller screens.
|
|
94
|
+
Headlines are for high-emphasis text on smaller screens. Uses **Fraunces** (display font family). Default weight: **regular (400)**.
|
|
92
95
|
|
|
93
96
|
<TypeSpecimen
|
|
94
97
|
styleName="headlineLarge"
|
|
@@ -125,7 +128,7 @@ Headlines are for high-emphasis text on smaller screens. They're best-suited for
|
|
|
125
128
|
|
|
126
129
|
### Title Styles
|
|
127
130
|
|
|
128
|
-
Titles are for medium-emphasis text that remains relatively short.
|
|
131
|
+
Titles are for medium-emphasis text that remains relatively short. Uses **Poppins** (body font family). Default weight: **medium (500)**.
|
|
129
132
|
|
|
130
133
|
<TypeSpecimen
|
|
131
134
|
styleName="titleLarge"
|
|
@@ -162,10 +165,9 @@ Titles are for medium-emphasis text that remains relatively short. Use titles fo
|
|
|
162
165
|
|
|
163
166
|
### Body Styles
|
|
164
167
|
|
|
165
|
-
Body styles are used for longer passages of text in your app.
|
|
168
|
+
Body styles are used for longer passages of text in your app. Uses **Poppins** (body font family). Default weight: **regular (400)**.
|
|
166
169
|
|
|
167
|
-
> **Note:** `bodyLarge` is a custom override from the M3 default
|
|
168
|
-
> This provides better readability for primary content at Discourser's reading densities.
|
|
170
|
+
> **Note:** `bodyLarge` is a custom DDS override from the M3 default. Size bumped from 16px/24px → **18px/28px** for better readability at Discourser's content densities.
|
|
169
171
|
|
|
170
172
|
<TypeSpecimen
|
|
171
173
|
styleName="bodyLarge"
|
|
@@ -202,7 +204,7 @@ Body styles are used for longer passages of text in your app.
|
|
|
202
204
|
|
|
203
205
|
### Label Styles
|
|
204
206
|
|
|
205
|
-
Label styles are for text in components like buttons, tabs, and labels.
|
|
207
|
+
Label styles are for text in components like buttons, tabs, and labels. Uses **Poppins** (body font family). Default weight: **medium (500)**.
|
|
206
208
|
|
|
207
209
|
<TypeSpecimen
|
|
208
210
|
styleName="labelLarge"
|
|
@@ -239,15 +241,108 @@ Label styles are for text in components like buttons, tabs, and labels. They're
|
|
|
239
241
|
|
|
240
242
|
---
|
|
241
243
|
|
|
244
|
+
## Available Weights Per Style
|
|
245
|
+
|
|
246
|
+
Each text style has a defined set of valid weights sourced from `material3.language.ts`. Applying a weight outside this set produces inconsistent results — don't assume all weights are available for all styles.
|
|
247
|
+
|
|
248
|
+
The **default weight** is what `textStyle` renders without a `fontWeight` override.
|
|
249
|
+
|
|
250
|
+
### Display & Headline (Fraunces)
|
|
251
|
+
|
|
252
|
+
| Style | Default | light (300) | regular (400) | medium (500) | semiBold (600) | bold (700) |
|
|
253
|
+
|---|---|---|---|---|---|---|
|
|
254
|
+
| `displayLarge` | regular | — | ✅ | — | ✅ | — |
|
|
255
|
+
| `displayMedium` | regular | — | ✅ | — | ✅ | — |
|
|
256
|
+
| `displaySmall` | regular | — | ✅ | — | ✅ | — |
|
|
257
|
+
| `headlineLarge` | regular | ✅ | ✅ | — | ✅ | — |
|
|
258
|
+
| `headlineMedium` | regular | ✅ | ✅ | — | ✅ | — |
|
|
259
|
+
| `headlineSmall` | regular | ✅ | ✅ | — | ✅ | — |
|
|
260
|
+
|
|
261
|
+
> Display styles intentionally omit `bold` — Fraunces at display sizes is expressive enough at semiBold.
|
|
262
|
+
|
|
263
|
+
### Title (Poppins)
|
|
264
|
+
|
|
265
|
+
| Style | Default | light (300) | regular (400) | medium (500) | semiBold (600) | bold (700) |
|
|
266
|
+
|---|---|---|---|---|---|---|
|
|
267
|
+
| `titleLarge` | medium | — | ✅ | ✅ | ✅ | ✅ |
|
|
268
|
+
| `titleMedium` | medium | — | ✅ | ✅ | ✅ | ✅ |
|
|
269
|
+
| `titleSmall` | medium | — | ✅ | ✅ | ✅ | ✅ |
|
|
270
|
+
|
|
271
|
+
> Titles have the widest weight range — they're the most flexible styles for expressing hierarchy within UI components.
|
|
272
|
+
|
|
273
|
+
### Body (Poppins)
|
|
274
|
+
|
|
275
|
+
| Style | Default | light (300) | regular (400) | medium (500) | semiBold (600) | bold (700) |
|
|
276
|
+
|---|---|---|---|---|---|---|
|
|
277
|
+
| `bodyLarge` | regular | ✅ | ✅ | ✅ | ✅ | — |
|
|
278
|
+
| `bodyMedium` | regular | ✅ | ✅ | ✅ | ✅ | — |
|
|
279
|
+
| `bodySmall` | regular | ✅ | ✅ | ✅ | ✅ | — |
|
|
280
|
+
|
|
281
|
+
> Body styles cap at semiBold. Bold body text at paragraph sizes degrades readability.
|
|
282
|
+
|
|
283
|
+
### Label (Poppins)
|
|
284
|
+
|
|
285
|
+
| Style | Default | light (300) | regular (400) | medium (500) | semiBold (600) | bold (700) |
|
|
286
|
+
|---|---|---|---|---|---|---|
|
|
287
|
+
| `labelLarge` | medium | ✅ | — | ✅ | ✅ | ✅ |
|
|
288
|
+
| `labelMedium` | medium | ✅ | — | ✅ | ✅ | ✅ |
|
|
289
|
+
| `labelSmall` | medium | ✅ | — | ✅ | ✅ | ✅ |
|
|
290
|
+
|
|
291
|
+
> Labels skip `regular` — at small sizes, 400 weight is visually indistinct from medium and can appear too thin in UI contexts.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Applying Weight Overrides in Code
|
|
296
|
+
|
|
297
|
+
Use the `fontWeight` Panda CSS prop to override the default weight. Always stay within the valid weights for that style (see tables above).
|
|
298
|
+
|
|
299
|
+
```tsx
|
|
300
|
+
import { css } from 'styled-system/css';
|
|
301
|
+
|
|
302
|
+
// Use the default weight (no override needed)
|
|
303
|
+
<Text textStyle="bodyLarge">Normal body text</Text>
|
|
304
|
+
|
|
305
|
+
// Override to semiBold (valid for bodyLarge)
|
|
306
|
+
<Text textStyle="bodyLarge" fontWeight="semibold">Emphasized body</Text>
|
|
307
|
+
|
|
308
|
+
// Headline with light weight (valid for headlineLarge)
|
|
309
|
+
<Text textStyle="headlineLarge" fontWeight="light">Delicate headline</Text>
|
|
310
|
+
|
|
311
|
+
// Title with bold weight (valid for titleLarge)
|
|
312
|
+
<Text textStyle="titleLarge" fontWeight="bold">Strong title</Text>
|
|
313
|
+
|
|
314
|
+
// In css() calls
|
|
315
|
+
const emphasisStyle = css({
|
|
316
|
+
textStyle: 'bodyMedium',
|
|
317
|
+
fontWeight: 'medium', // valid: bumps from default 400 → 500
|
|
318
|
+
});
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Panda CSS fontWeight token names:**
|
|
322
|
+
|
|
323
|
+
| Weight value | Panda CSS token |
|
|
324
|
+
|---|---|
|
|
325
|
+
| 300 | `light` |
|
|
326
|
+
| 400 | `normal` |
|
|
327
|
+
| 500 | `medium` |
|
|
328
|
+
| 600 | `semibold` |
|
|
329
|
+
| 700 | `bold` |
|
|
330
|
+
|
|
331
|
+
> Note: Panda uses `semibold` (lowercase, no space) while the language file uses `semiBold` (camelCase). Always use Panda's token name in component code.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
242
335
|
## Usage Guidelines
|
|
243
336
|
|
|
244
337
|
### Choosing the Right Style
|
|
245
338
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
**
|
|
249
|
-
**
|
|
250
|
-
**
|
|
339
|
+
| Category | Use for |
|
|
340
|
+
|---|---|
|
|
341
|
+
| **Display** | Hero text, marketing headlines, featured numerals |
|
|
342
|
+
| **Headline** | Page titles, section headers, card titles |
|
|
343
|
+
| **Title** | List item titles, dialog titles, form section headers |
|
|
344
|
+
| **Body** | Paragraphs, descriptions, long-form content |
|
|
345
|
+
| **Label** | Buttons, tabs, chips, form labels, captions |
|
|
251
346
|
|
|
252
347
|
### Responsive Typography
|
|
253
348
|
|
|
@@ -259,8 +354,8 @@ Consider using different type styles at different breakpoints:
|
|
|
259
354
|
|
|
260
355
|
### Accessibility
|
|
261
356
|
|
|
262
|
-
- Maintain minimum 16px font size for body text
|
|
263
|
-
- Ensure sufficient line height (1.5
|
|
357
|
+
- Maintain minimum 16px font size for body text (bodyLarge at 18px, bodyMedium at 14px for secondary content)
|
|
358
|
+
- Ensure sufficient line height (bodyLarge: 28px gives 1.56 ratio — above the 1.5 WCAG recommendation)
|
|
264
359
|
- Use proper heading hierarchy (h1 → h2 → h3)
|
|
265
360
|
- Test with browser zoom up to 200%
|
|
266
361
|
|
|
@@ -276,6 +371,11 @@ const headingStyle = css({
|
|
|
276
371
|
|
|
277
372
|
const bodyStyle = css({
|
|
278
373
|
textStyle: 'bodyMedium',
|
|
279
|
-
color: '
|
|
374
|
+
color: 'onSurface.variant'
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
const buttonLabelStyle = css({
|
|
378
|
+
textStyle: 'labelLarge',
|
|
379
|
+
color: 'onPrimary'
|
|
280
380
|
});
|
|
281
381
|
```
|