@discourser/design-system 0.25.3 → 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.
- 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/token-name-mapping.json +614 -42
- package/docs/token-name-mapping.md +117 -29
- package/package.json +1 -1
- 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/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/README.md
CHANGED
|
@@ -81,7 +81,7 @@ import * as Button from '@discourser/design-system';
|
|
|
81
81
|
|
|
82
82
|
<Button.Root variant="filled" size="md">
|
|
83
83
|
Click me
|
|
84
|
-
</Button.Root
|
|
84
|
+
</Button.Root>;
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
**Variants:** `filled` | `outlined` | `text` | `elevated` | `tonal`
|
|
@@ -105,7 +105,7 @@ import * as Card from '@discourser/design-system';
|
|
|
105
105
|
<Card.Footer>
|
|
106
106
|
<Button.Root>Action</Button.Root>
|
|
107
107
|
</Card.Footer>
|
|
108
|
-
</Card.Root
|
|
108
|
+
</Card.Root>;
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
**Variants:** `elevated` | `filled` | `outlined`
|
|
@@ -119,7 +119,7 @@ import * as IconButton from '@discourser/design-system';
|
|
|
119
119
|
|
|
120
120
|
<IconButton.Root variant="filled" size="md" aria-label="Settings">
|
|
121
121
|
<SettingsIcon />
|
|
122
|
-
</IconButton.Root
|
|
122
|
+
</IconButton.Root>;
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
**Variants:** `standard` | `filled` | `tonal` | `outlined`
|
|
@@ -137,7 +137,7 @@ import * as Field from '@discourser/design-system';
|
|
|
137
137
|
<Field.Label>Email</Field.Label>
|
|
138
138
|
<Input.Root variant="outline" size="md" placeholder="you@example.com" />
|
|
139
139
|
<Field.HelperText>We'll never share your email</Field.HelperText>
|
|
140
|
-
</Field.Root
|
|
140
|
+
</Field.Root>;
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
**Variants:** `outline` | `filled` | `flushed`
|
|
@@ -178,7 +178,7 @@ const items = [
|
|
|
178
178
|
</Select.Content>
|
|
179
179
|
</Select.Positioner>
|
|
180
180
|
<Select.HiddenSelect />
|
|
181
|
-
</Select.Root
|
|
181
|
+
</Select.Root>;
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
**Sizes:** `sm` | `md` | `lg`
|
|
@@ -196,7 +196,7 @@ import * as Checkbox from '@discourser/design-system';
|
|
|
196
196
|
</Checkbox.Control>
|
|
197
197
|
<Checkbox.Label>Accept terms and conditions</Checkbox.Label>
|
|
198
198
|
<Checkbox.HiddenInput />
|
|
199
|
-
</Checkbox.Root
|
|
199
|
+
</Checkbox.Root>;
|
|
200
200
|
```
|
|
201
201
|
|
|
202
202
|
**Sizes:** `sm` | `md` | `lg`
|
|
@@ -219,7 +219,7 @@ import * as RadioGroup from '@discourser/design-system';
|
|
|
219
219
|
<RadioGroup.ItemText>Option 2</RadioGroup.ItemText>
|
|
220
220
|
<RadioGroup.HiddenInput />
|
|
221
221
|
</RadioGroup.Item>
|
|
222
|
-
</RadioGroup.Root
|
|
222
|
+
</RadioGroup.Root>;
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
**Sizes:** `sm` | `md` | `lg`
|
|
@@ -241,7 +241,7 @@ import * as Slider from '@discourser/design-system';
|
|
|
241
241
|
<Slider.Thumb index={0} />
|
|
242
242
|
</Slider.Control>
|
|
243
243
|
<Slider.HiddenInput />
|
|
244
|
-
</Slider.Root
|
|
244
|
+
</Slider.Root>;
|
|
245
245
|
```
|
|
246
246
|
|
|
247
247
|
**Sizes:** `sm` | `md` | `lg`
|
|
@@ -260,7 +260,7 @@ import * as Switch from '@discourser/design-system';
|
|
|
260
260
|
</Switch.Control>
|
|
261
261
|
<Switch.Label>Enable notifications</Switch.Label>
|
|
262
262
|
<Switch.HiddenInput />
|
|
263
|
-
</Switch.Root
|
|
263
|
+
</Switch.Root>;
|
|
264
264
|
```
|
|
265
265
|
|
|
266
266
|
**Sizes:** `sm` | `md` | `lg`
|
|
@@ -272,7 +272,7 @@ Multi-line text input field.
|
|
|
272
272
|
```tsx
|
|
273
273
|
import * as Textarea from '@discourser/design-system';
|
|
274
274
|
|
|
275
|
-
<Textarea.Root variant="outline" placeholder="Enter your message..."
|
|
275
|
+
<Textarea.Root variant="outline" placeholder="Enter your message..." />;
|
|
276
276
|
```
|
|
277
277
|
|
|
278
278
|
**Variants:** `outline` | `filled` | `subtle` | `flushed`
|
|
@@ -295,7 +295,7 @@ import * as Tabs from '@discourser/design-system';
|
|
|
295
295
|
</Tabs.List>
|
|
296
296
|
<Tabs.Content value="overview">Overview content</Tabs.Content>
|
|
297
297
|
<Tabs.Content value="details">Details content</Tabs.Content>
|
|
298
|
-
</Tabs.Root
|
|
298
|
+
</Tabs.Root>;
|
|
299
299
|
```
|
|
300
300
|
|
|
301
301
|
**Variants:** `line` | `enclosed` | `outline`
|
|
@@ -314,11 +314,9 @@ import * as Accordion from '@discourser/design-system';
|
|
|
314
314
|
Section 1
|
|
315
315
|
<Accordion.ItemIndicator />
|
|
316
316
|
</Accordion.ItemTrigger>
|
|
317
|
-
<Accordion.ItemContent>
|
|
318
|
-
Content for section 1
|
|
319
|
-
</Accordion.ItemContent>
|
|
317
|
+
<Accordion.ItemContent>Content for section 1</Accordion.ItemContent>
|
|
320
318
|
</Accordion.Item>
|
|
321
|
-
</Accordion.Root
|
|
319
|
+
</Accordion.Root>;
|
|
322
320
|
```
|
|
323
321
|
|
|
324
322
|
**Sizes:** `sm` | `md` | `lg`
|
|
@@ -342,7 +340,7 @@ import * as Dialog from '@discourser/design-system';
|
|
|
342
340
|
<Dialog.CloseTrigger />
|
|
343
341
|
</Dialog.Content>
|
|
344
342
|
</Dialog.Positioner>
|
|
345
|
-
</Dialog.Root
|
|
343
|
+
</Dialog.Root>;
|
|
346
344
|
```
|
|
347
345
|
|
|
348
346
|
**Sizes:** `sm` | `md` | `lg` | `xl` | `full`
|
|
@@ -367,7 +365,7 @@ import * as Drawer from '@discourser/design-system';
|
|
|
367
365
|
<Drawer.Footer>Footer content</Drawer.Footer>
|
|
368
366
|
</Drawer.Content>
|
|
369
367
|
</Drawer.Positioner>
|
|
370
|
-
</Drawer.Root
|
|
368
|
+
</Drawer.Root>;
|
|
371
369
|
```
|
|
372
370
|
|
|
373
371
|
**Placement:** `left` | `right` | `top` | `bottom`
|
|
@@ -391,7 +389,7 @@ import * as Popover from '@discourser/design-system';
|
|
|
391
389
|
<Popover.CloseTrigger />
|
|
392
390
|
</Popover.Content>
|
|
393
391
|
</Popover.Positioner>
|
|
394
|
-
</Popover.Root
|
|
392
|
+
</Popover.Root>;
|
|
395
393
|
```
|
|
396
394
|
|
|
397
395
|
#### Tooltip
|
|
@@ -411,7 +409,7 @@ import * as Tooltip from '@discourser/design-system';
|
|
|
411
409
|
</Tooltip.Arrow>
|
|
412
410
|
</Tooltip.Content>
|
|
413
411
|
</Tooltip.Positioner>
|
|
414
|
-
</Tooltip.Root
|
|
412
|
+
</Tooltip.Root>;
|
|
415
413
|
```
|
|
416
414
|
|
|
417
415
|
### Feedback & Status
|
|
@@ -424,7 +422,7 @@ Temporary notification messages.
|
|
|
424
422
|
import { Toaster, toaster } from '@discourser/design-system';
|
|
425
423
|
|
|
426
424
|
// Add <Toaster /> to your app root
|
|
427
|
-
<Toaster
|
|
425
|
+
<Toaster />;
|
|
428
426
|
|
|
429
427
|
// Trigger toasts from anywhere
|
|
430
428
|
toaster.success({
|
|
@@ -479,7 +477,7 @@ import * as Avatar from '@discourser/design-system';
|
|
|
479
477
|
<Avatar.Root>
|
|
480
478
|
<Avatar.Fallback name="John Doe" />
|
|
481
479
|
<Avatar.Image src="https://i.pravatar.cc/150?img=3" alt="John Doe" />
|
|
482
|
-
</Avatar.Root
|
|
480
|
+
</Avatar.Root>;
|
|
483
481
|
```
|
|
484
482
|
|
|
485
483
|
**Sizes:** `xs` | `sm` | `md` | `lg` | `xl` | `2xl`
|
|
@@ -491,7 +489,7 @@ Small status or label indicator.
|
|
|
491
489
|
```tsx
|
|
492
490
|
import * as Badge from '@discourser/design-system';
|
|
493
491
|
|
|
494
|
-
<Badge.Root>New</Badge.Root
|
|
492
|
+
<Badge.Root>New</Badge.Root>;
|
|
495
493
|
```
|
|
496
494
|
|
|
497
495
|
**Sizes:** `sm` | `md` | `lg`
|
|
@@ -506,7 +504,7 @@ import * as Skeleton from '@discourser/design-system';
|
|
|
506
504
|
<Skeleton.Root>
|
|
507
505
|
<Skeleton.Circle />
|
|
508
506
|
<Skeleton.Text noOfLines={3} />
|
|
509
|
-
</Skeleton.Root
|
|
507
|
+
</Skeleton.Root>;
|
|
510
508
|
```
|
|
511
509
|
|
|
512
510
|
## 🎨 Three-Layer Architecture
|
|
@@ -574,76 +572,75 @@ pnpm test --ui # Open Vitest UI
|
|
|
574
572
|
```
|
|
575
573
|
|
|
576
574
|
**Test Stats:**
|
|
575
|
+
|
|
577
576
|
- 83 tests passing
|
|
578
577
|
- Components: Button (30), Card (24), IconButton (29)
|
|
579
578
|
- 100% of components have tests
|
|
580
579
|
|
|
581
580
|
## 📝 Scripts
|
|
582
581
|
|
|
583
|
-
| Command
|
|
584
|
-
|
|
585
|
-
| `pnpm dev`
|
|
586
|
-
| `pnpm build`
|
|
587
|
-
| `pnpm build:panda`
|
|
588
|
-
| `pnpm build:lib`
|
|
589
|
-
| `pnpm build:storybook` | Build static Storybook
|
|
590
|
-
| `pnpm test`
|
|
591
|
-
| `pnpm test:ui`
|
|
592
|
-
| `pnpm typecheck`
|
|
593
|
-
| `pnpm lint`
|
|
582
|
+
| Command | Description |
|
|
583
|
+
| ---------------------- | ---------------------------- |
|
|
584
|
+
| `pnpm dev` | Start Storybook on port 6006 |
|
|
585
|
+
| `pnpm build` | Build library (Panda + tsup) |
|
|
586
|
+
| `pnpm build:panda` | Generate styled-system |
|
|
587
|
+
| `pnpm build:lib` | Build library only |
|
|
588
|
+
| `pnpm build:storybook` | Build static Storybook |
|
|
589
|
+
| `pnpm test` | Run tests |
|
|
590
|
+
| `pnpm test:ui` | Open Vitest UI |
|
|
591
|
+
| `pnpm typecheck` | TypeScript validation |
|
|
592
|
+
| `pnpm lint` | ESLint |
|
|
594
593
|
|
|
595
594
|
## 🔄 Token Workflow
|
|
596
595
|
|
|
597
|
-
|
|
596
|
+
### DDS → Figma (push tokens into Figma)
|
|
598
597
|
|
|
599
|
-
|
|
598
|
+
Run this after any change to material3.language.ts:
|
|
600
599
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
600
|
+
```bash
|
|
601
|
+
pnpm figma:export
|
|
602
|
+
```
|
|
604
603
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
pnpm organize-tokens
|
|
608
|
-
```
|
|
609
|
-
- Provide paths when prompted
|
|
610
|
-
- Review summary
|
|
604
|
+
This generates three files in tokens/export-to-figma/ AND regenerates
|
|
605
|
+
docs/token-name-mapping.json:
|
|
611
606
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
```
|
|
607
|
+
- figma-variables.json — import via plugin → Import Variables
|
|
608
|
+
- figma-text-styles.json — import via plugin → Import Text Styles
|
|
609
|
+
- figma-effect-styles.json — import via plugin → Import Effect Styles
|
|
616
610
|
|
|
617
|
-
|
|
618
|
-
```bash
|
|
619
|
-
pnpm dev
|
|
620
|
-
```
|
|
611
|
+
Open the figma-token-sync Figma plugin and import each file in order.
|
|
621
612
|
|
|
622
|
-
|
|
623
|
-
```bash
|
|
624
|
-
git add tokens/
|
|
625
|
-
git commit -m "chore: update tokens from Figma"
|
|
626
|
-
```
|
|
613
|
+
### Figma → DDS (pull changes from Figma)
|
|
627
614
|
|
|
628
|
-
|
|
615
|
+
```bash
|
|
616
|
+
# 1. Export from Figma plugin → Export Variables → save files
|
|
617
|
+
# 2. Organise into DDS structure
|
|
618
|
+
pnpm organize-tokens
|
|
619
|
+
# 3. Rebuild Panda tokens
|
|
620
|
+
pnpm build:panda
|
|
621
|
+
```
|
|
629
622
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
623
|
+
### Token name mapping
|
|
624
|
+
|
|
625
|
+
`docs/token-name-mapping.json` maps every Figma variable/style to its
|
|
626
|
+
Panda CSS token and CSS custom property. It is auto-regenerated by
|
|
627
|
+
`pnpm figma:export`. The companion `docs/token-name-mapping.md` is the
|
|
628
|
+
human-readable version — keep it in sync manually after running the script.
|
|
634
629
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
- Browse to `tokens/tokens.json`
|
|
638
|
-
- Plugin creates/updates Figma variables
|
|
630
|
+
This mapping is used by AI design agents (Kai) to resolve Figma MCP
|
|
631
|
+
output back to DDS token names.
|
|
639
632
|
|
|
640
|
-
###
|
|
633
|
+
### Key files
|
|
641
634
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
635
|
+
| File | Purpose | In git? |
|
|
636
|
+
| ----------------------------------------------- | ---------------------------- | ------- |
|
|
637
|
+
| src/languages/material3.language.ts | Source of truth | ✅ |
|
|
638
|
+
| tokens/export-to-figma/figma-variables.json | Figma Variables import | ❌ |
|
|
639
|
+
| tokens/export-to-figma/figma-text-styles.json | Figma Text Styles import | ❌ |
|
|
640
|
+
| tokens/export-to-figma/figma-effect-styles.json | Figma Effect Styles import | ❌ |
|
|
641
|
+
| docs/token-name-mapping.json | AI-readable token map | ✅ |
|
|
642
|
+
| docs/token-name-mapping.md | Human-readable token map | ✅ |
|
|
643
|
+
| tokens/imported-from-figma/ | Figma exports (reverse sync) | ❌ |
|
|
647
644
|
|
|
648
645
|
## 🤝 Contributing
|
|
649
646
|
|
|
@@ -656,6 +653,7 @@ This design system uses [figma-token-sync](https://github.com/yourusername/figma
|
|
|
656
653
|
#### For Team Members (Write Access)
|
|
657
654
|
|
|
658
655
|
1. **Create a feature branch from `dev`:**
|
|
656
|
+
|
|
659
657
|
```bash
|
|
660
658
|
git checkout dev
|
|
661
659
|
git pull
|
|
@@ -663,6 +661,7 @@ This design system uses [figma-token-sync](https://github.com/yourusername/figma
|
|
|
663
661
|
```
|
|
664
662
|
|
|
665
663
|
2. **Make your changes and test:**
|
|
664
|
+
|
|
666
665
|
```bash
|
|
667
666
|
pnpm test --run # Run tests
|
|
668
667
|
pnpm typecheck # Type check
|
|
@@ -671,6 +670,7 @@ This design system uses [figma-token-sync](https://github.com/yourusername/figma
|
|
|
671
670
|
```
|
|
672
671
|
|
|
673
672
|
3. **Create a changeset** (required for any code changes):
|
|
673
|
+
|
|
674
674
|
```bash
|
|
675
675
|
pnpm changeset
|
|
676
676
|
# Select change type:
|
|
@@ -681,6 +681,7 @@ This design system uses [figma-token-sync](https://github.com/yourusername/figma
|
|
|
681
681
|
```
|
|
682
682
|
|
|
683
683
|
4. **Commit and push:**
|
|
684
|
+
|
|
684
685
|
```bash
|
|
685
686
|
git add .
|
|
686
687
|
git commit -m "feat: add amazing feature"
|
|
@@ -702,6 +703,7 @@ This design system uses [figma-token-sync](https://github.com/yourusername/figma
|
|
|
702
703
|
|
|
703
704
|
1. **Fork the repository** on GitHub
|
|
704
705
|
2. **Clone your fork:**
|
|
706
|
+
|
|
705
707
|
```bash
|
|
706
708
|
git clone https://github.com/YOUR_USERNAME/Discourser-Design-System.git
|
|
707
709
|
```
|
|
@@ -721,6 +723,7 @@ We use a Git Flow-inspired branching strategy:
|
|
|
721
723
|
- **`docs/*`** - Documentation (branch from `dev`, PR to `dev`)
|
|
722
724
|
|
|
723
725
|
**Key Rules:**
|
|
726
|
+
|
|
724
727
|
- ✅ Create feature branches from `dev`
|
|
725
728
|
- ✅ Open PRs to `dev` (not `main`)
|
|
726
729
|
- ✅ Only `dev` can merge to `main` (for releases)
|