@discourser/design-system 0.22.2 → 0.22.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 (75) hide show
  1. package/dist/figma-codex.json +2 -2
  2. package/docs/CSS_USAGE.md +235 -0
  3. package/docs/FIGMA_MAKE_SETUP.md +339 -0
  4. package/docs/GUIDELINES_REVIEW.md +728 -0
  5. package/docs/MAINTAINER_CHECKLIST.md +265 -0
  6. package/docs/TESTING_QUICK_REFERENCE.md +159 -0
  7. package/docs/TESTING_TOKENS.md +340 -0
  8. package/docs/active-stories/README.md +29 -0
  9. package/docs/active-stories/STORY-006a-figma-translation-foundations.md +324 -0
  10. package/docs/active-stories/STORY-006b-figma-translation-components.md +201 -0
  11. package/docs/active-stories/STORY-006c-figma-translation-layout-extension.md +258 -0
  12. package/docs/active-stories/STORY-008-kai-sidecar-fragments.md +137 -0
  13. package/docs/active-stories/STORY-011-verify-translation-docs.md +182 -0
  14. package/docs/archive/ARCHITECTURE-discourser-design-system.md +448 -0
  15. package/docs/claude-feed-back/ARCHITECTURE_DIAGRAM.md +243 -0
  16. package/docs/claude-feed-back/STYLING_VERIFICATION.md +89 -0
  17. package/docs/claude-feed-back/TEST_RESULTS.md +182 -0
  18. package/docs/context-share/ELEVATION_FIX_PLAN.md +903 -0
  19. package/docs/context-share/STORY-001-VALIDATION-PASSED.md +192 -0
  20. package/docs/context-share/STORY-002-IMPLEMENTATION-COMPLETE.md +161 -0
  21. package/docs/context-share/STORYBOOK_MCP_STRATEGY.md +867 -0
  22. package/docs/context-share/TESTING_GAPS_FILLED.md +353 -0
  23. package/docs/context-share/TOKEN_TESTING_SUMMARY.md +388 -0
  24. package/docs/context-share/code-connect-prompt.md +90 -0
  25. package/docs/context-share/dds-autonomous-pipeline.md +765 -0
  26. package/docs/context-share/fix-checkbox-radio-tokens.md +145 -0
  27. package/docs/context-share/icon-component-prompt.md +154 -0
  28. package/docs/context-share/icons/Audience.svg +3 -0
  29. package/docs/context-share/icons/AudioSpeaker.svg +3 -0
  30. package/docs/context-share/icons/BookmarkPlus.svg +3 -0
  31. package/docs/context-share/icons/ClipBoard.svg +8 -0
  32. package/docs/context-share/icons/DiscourserLogo.svg +4 -0
  33. package/docs/context-share/icons/ExitStudio.svg +4 -0
  34. package/docs/context-share/icons/Microphone.svg +5 -0
  35. package/docs/context-share/icons/NotebookPen.svg +3 -0
  36. package/docs/context-share/icons/PausePlay.svg +5 -0
  37. package/docs/context-share/icons/Play.svg +4 -0
  38. package/docs/context-share/icons/Record.svg +6 -0
  39. package/docs/context-share/icons/RepeatQuestion.svg +3 -0
  40. package/docs/context-share/icons/ScrollText.svg +3 -0
  41. package/docs/context-share/icons/Sparkles.svg +3 -0
  42. package/docs/context-share/icons/Speech.svg +3 -0
  43. package/docs/context-share/icons/StopPlay.svg +4 -0
  44. package/docs/context-share/icons/Timer.svg +3 -0
  45. package/docs/context-share/icons/UserProfile.svg +3 -0
  46. package/docs/context-share/m3-token-pipeline-audit.md +125 -0
  47. package/docs/context-share/storybook-mcp-kai-agent-revised-summary.md +211 -0
  48. package/docs/discourser-design-system-prd.md +3698 -0
  49. package/docs/figma-captures/01-typography.png +0 -0
  50. package/docs/figma-captures/02-button-iconbutton.png +0 -0
  51. package/docs/figma-captures/03-form-inputs.png +0 -0
  52. package/docs/figma-captures/04-form-controls.png +0 -0
  53. package/docs/figma-captures/05-data-display.png +0 -0
  54. package/docs/figma-captures/06-feedback.png +0 -0
  55. package/docs/figma-captures/07-overlays.png +0 -0
  56. package/docs/figma-captures/08-navigation-layout.png +0 -0
  57. package/docs/figma-captures/09-custom-components.png +0 -0
  58. package/docs/figma-captures/10-scenario-queue.png +0 -0
  59. package/docs/figma-captures/11-icon-library.png +0 -0
  60. package/docs/figma-make-docs/01-understanding-templates.md +235 -0
  61. package/docs/figma-make-docs/02-prerequisites.md +266 -0
  62. package/docs/figma-make-docs/03-creating-template.md +306 -0
  63. package/docs/figma-make-docs/04-adding-guidelines.md +448 -0
  64. package/docs/figma-make-docs/05-example-starter-code.md +590 -0
  65. package/docs/figma-make-docs/06-publishing-template.md +417 -0
  66. package/docs/figma-make-docs/07-maintenance.md +536 -0
  67. package/docs/figma-make-docs/08-faq.md +490 -0
  68. package/docs/figma-make-docs/README.md +95 -0
  69. package/docs/material-theme.json +418 -0
  70. package/docs/plans/2026-03-12-figma-token-export-rewrite.md +504 -0
  71. package/docs/plans/2026-03-12-step7-panda-token-resolution-design.md +119 -0
  72. package/docs/plans/2026-03-12-step7-panda-token-resolution.md +993 -0
  73. package/docs/token-name-mapping.json +850 -0
  74. package/docs/token-name-mapping.md +251 -0
  75. package/package.json +3 -2
@@ -0,0 +1,903 @@
1
+ # Elevation & Shadow System Fix Plan
2
+
3
+ > **Document Purpose:** Step-by-step plan to fix elevation/shadow issues in the design system
4
+ >
5
+ > **Status:** Planning Phase - UPDATED with correct architectural understanding
6
+ > **Created:** 2026-02-10
7
+ > **Updated:** 2026-02-10
8
+ > **Related:** STORYBOOK_MCP_STRATEGY.md
9
+
10
+ ---
11
+
12
+ ## ⚠️ Architectural Philosophy
13
+
14
+ **CRITICAL:** This design system follows a **three-layer aesthetic-agnostic architecture**:
15
+
16
+ ```
17
+ Layer 1: Infrastructure (Panda CSS / Park UI) - UNCHANGING
18
+ ├── Token names: xs, sm, md, lg, xl, 2xl
19
+ └── Components ALWAYS use these names
20
+
21
+ Layer 2: Design Language (Material 3) - SWAPPABLE
22
+ ├── M3 elevation levels: level0-5
23
+ └── MAPS values TO → Panda token names
24
+
25
+ Layer 3: Components - DECOUPLED FROM AESTHETIC
26
+ └── Reference Layer 1 tokens only: boxShadow: 'lg'
27
+ ```
28
+
29
+ **This means:**
30
+ - ✅ Components use **Panda/Park UI token names** (`xs`, `sm`, `md`, `lg`)
31
+ - ✅ Material 3 **provides values** that get mapped to those names
32
+ - ✅ Swapping M3 for another design language = change values, NOT component code
33
+
34
+ ---
35
+
36
+ ## Table of Contents
37
+
38
+ 1. [Issues Summary](#issues-summary)
39
+ 2. [Fix Plan Overview](#fix-plan-overview)
40
+ 3. [Issue 1: Inline Shadow Values](#issue-1-inline-shadow-values)
41
+ 4. [Issue 2: Token Naming Violation](#issue-2-token-naming-violation)
42
+ 5. [Issue 3: Missing Elevation Props](#issue-3-missing-elevation-props)
43
+ 6. [Implementation Timeline](#implementation-timeline)
44
+ 7. [Testing Strategy](#testing-strategy)
45
+ 8. [Breaking Changes & Migration](#breaking-changes--migration)
46
+
47
+ ---
48
+
49
+ ## Issues Summary
50
+
51
+ ### Issue 1: Inline Shadow Values (Minor) ⚠️
52
+
53
+ **Problem:** 3 components use inline shadow values instead of semantic tokens
54
+
55
+ **Affected Components:**
56
+ - `Input.tsx` - Flushed variant uses `'0 1px 0 0 var(--shadow-color)'`
57
+ - `Textarea.tsx` - Flushed variant uses `'0 1px 0 0 var(--shadow-color)'`
58
+ - `RadioGroup.tsx` - Uses `'inset 0 0 0 1px var(--shadow-color)'`
59
+
60
+ **Impact:** Low (works, but not using semantic tokens)
61
+
62
+ ---
63
+
64
+ ### Issue 2: Token Naming Violation (Major) ⚠️⚠️⚠️
65
+
66
+ **Problem:** Button recipe violates architectural philosophy by using M3-specific token names
67
+
68
+ **Correct (Infrastructure Layer - Park UI/Panda):**
69
+ ```typescript
70
+ // All other components correctly use Panda names
71
+ boxShadow: 'sm' // Card
72
+ boxShadow: 'lg' // Dialog
73
+ boxShadow: 'md' // Select
74
+ ```
75
+
76
+ **Incorrect (Design Language Layer - M3-specific):**
77
+ ```typescript
78
+ // Button incorrectly uses M3 names
79
+ boxShadow: 'level2' // ❌ Couples to M3
80
+ boxShadow: 'level3' // ❌ Can't swap design language
81
+ ```
82
+
83
+ **Why this is wrong:**
84
+ - Breaks aesthetic-agnostic architecture
85
+ - If we swap M3 for Fluent Design, Button would break
86
+ - Other components would work fine (they use Panda names)
87
+
88
+ **Impact:** High (architectural violation, blocks design language swapping)
89
+
90
+ ---
91
+
92
+ ### Issue 3: Missing Elevation Props (Medium) ⚠️⚠️
93
+
94
+ **Problem:** Components don't expose elevation as props
95
+
96
+ **Components with Hardcoded Elevation:**
97
+ - Dialog → `lg`
98
+ - Drawer → `lg`
99
+ - Popover → `lg`
100
+ - Select → `md` (dropdown)
101
+ - Slider → `xs` (thumb)
102
+ - Stepper → `sm` (indicator)
103
+ - Switch → `xs` (thumb)
104
+ - Toast → `lg`
105
+ - Tooltip → `sm`
106
+
107
+ **Only 2 Components with Elevation Variants:**
108
+ - Button → `variant="elevated"` (but using wrong token names)
109
+ - Card → `variant="elevated"` ✅
110
+
111
+ **Impact:** Medium (limits consumer flexibility)
112
+
113
+ ---
114
+
115
+ ## Fix Plan Overview
116
+
117
+ ### Phase 1: Fix Architectural Violation (1 hour)
118
+ 1. Update Button recipe to use Panda token names
119
+ 2. Verify M3 language mapping provides correct values
120
+ 3. Test Button variants
121
+
122
+ ### Phase 2: Fix Inline Shadows (30 minutes)
123
+ 1. Create semantic tokens for Input/Textarea flushed variant
124
+ 2. Create semantic token for RadioGroup border
125
+ 3. Update recipes to use new tokens
126
+
127
+ ### Phase 3: Add Elevation Variants (2-3 hours)
128
+ 1. Add elevation variants to high-priority recipes
129
+ 2. Update component TypeScript interfaces
130
+ 3. Update stories with elevation examples
131
+ 4. Document elevation usage
132
+
133
+ ### Phase 4: Testing & Documentation (1-2 hours)
134
+ 1. Visual regression testing
135
+ 2. Update Storybook docs
136
+ 3. Update agent knowledge base
137
+
138
+ **Total Estimated Time:** 4.5-6.5 hours
139
+
140
+ ---
141
+
142
+ ## Issue 1: Inline Shadow Values
143
+
144
+ ### Current State
145
+
146
+ **Input & Textarea - Flushed Variant:**
147
+ ```typescript
148
+ // src/preset/recipes/input.ts
149
+ flushed: {
150
+ borderWidth: '0px 0px 1px 0px',
151
+ _focusVisible: {
152
+ borderColor: 'colorPalette.default',
153
+ boxShadow: '0 1px 0 0 var(--shadow-color)', // ← Inline value
154
+ }
155
+ }
156
+ ```
157
+
158
+ **RadioGroup - Border:**
159
+ ```typescript
160
+ // src/preset/recipes/radio-group.ts
161
+ control: {
162
+ boxShadow: 'inset 0 0 0 1px var(--shadow-color)', // ← Inline value
163
+ }
164
+ ```
165
+
166
+ ### Fix Strategy
167
+
168
+ #### Step 1: Add Semantic Shadow Tokens
169
+
170
+ **File:** `src/preset/shadows.ts`
171
+
172
+ Add new Panda tokens (using Park UI naming convention):
173
+
174
+ ```typescript
175
+ export const shadows = {
176
+ // ... existing tokens (xs, sm, md, lg, xl, 2xl)
177
+
178
+ // Input focus underline - uses Panda naming
179
+ 'focus-underline': {
180
+ value: {
181
+ base: '0 1px 0 0 {colors.neutral.a4}',
182
+ _dark: '0 1px 0 0 {colors.neutral.a8}'
183
+ }
184
+ },
185
+
186
+ // Inset border for form controls - uses Panda naming
187
+ 'inset-border': {
188
+ value: {
189
+ base: 'inset 0 0 0 1px {colors.neutral.a4}',
190
+ _dark: 'inset 0 0 0 1px {colors.neutral.a8}'
191
+ }
192
+ },
193
+ };
194
+ ```
195
+
196
+ #### Step 2: Update Recipes
197
+
198
+ **Input & Textarea:**
199
+ ```typescript
200
+ // Before
201
+ _focusVisible: {
202
+ borderColor: 'colorPalette.default',
203
+ boxShadow: '0 1px 0 0 var(--shadow-color)',
204
+ }
205
+
206
+ // After - using Panda token
207
+ _focusVisible: {
208
+ borderColor: 'colorPalette.default',
209
+ boxShadow: 'focus-underline',
210
+ }
211
+ ```
212
+
213
+ **RadioGroup:**
214
+ ```typescript
215
+ // Before
216
+ control: {
217
+ boxShadow: 'inset 0 0 0 1px var(--shadow-color)',
218
+ }
219
+
220
+ // After - using Panda token
221
+ control: {
222
+ boxShadow: 'inset-border',
223
+ }
224
+ ```
225
+
226
+ #### Step 3: Verify
227
+
228
+ - [ ] Run `pnpm build:panda`
229
+ - [ ] Check generated `styled-system/tokens/shadows.mjs`
230
+ - [ ] Test Input flushed variant focus state
231
+ - [ ] Test Textarea flushed variant focus state
232
+ - [ ] Test RadioGroup appearance
233
+ - [ ] Verify light/dark theme switching
234
+
235
+ ---
236
+
237
+ ## Issue 2: Token Naming Violation
238
+
239
+ ### The Problem: Button Breaks Architecture
240
+
241
+ **Current Button Recipe (WRONG):**
242
+ ```typescript
243
+ // src/preset/recipes/button.ts
244
+ elevated: {
245
+ base: {
246
+ boxShadow: 'level2', // ❌ M3-specific name
247
+ },
248
+ _hover: {
249
+ boxShadow: 'level3', // ❌ M3-specific name
250
+ },
251
+ _active: {
252
+ boxShadow: 'level1', // ❌ M3-specific name
253
+ }
254
+ }
255
+ ```
256
+
257
+ **Why this is wrong:**
258
+ - `level2`, `level3`, `level1` are M3 design language names
259
+ - If we swap M3 for Fluent Design, Button code must change
260
+ - Violates aesthetic-agnostic architecture
261
+
262
+ **Other Components (CORRECT):**
263
+ ```typescript
264
+ // Card, Dialog, Drawer, etc. correctly use Panda names
265
+ boxShadow: 'lg' // ✅ Panda/Park UI name
266
+ boxShadow: 'sm' // ✅ Panda/Park UI name
267
+ boxShadow: 'md' // ✅ Panda/Park UI name
268
+ ```
269
+
270
+ ---
271
+
272
+ ### The Fix: Use Panda Token Names
273
+
274
+ #### Step 1: Map M3 Elevation Semantics to Panda Names
275
+
276
+ **M3 Elevation Levels → Panda Token Mapping:**
277
+
278
+ | M3 Level | M3 Use Case | Panda Token | Panda Use Case |
279
+ |----------|-------------|-------------|----------------|
280
+ | level0 | No elevation | `none` | Flat surfaces |
281
+ | level1 | Subtle depth | `xs` | Minimal shadow |
282
+ | level2 | Moderate depth | `sm` | Small shadow |
283
+ | level3 | Prominent | `md` | Medium shadow |
284
+ | level4 | High | `lg` | Large shadow |
285
+ | level5 | Highest | `xl` or `2xl` | Extra large shadow |
286
+
287
+ **For Button's Elevated Variant:**
288
+ - Default state (M3 level2) → Use `sm`
289
+ - Hover state (M3 level3) → Use `md`
290
+ - Active state (M3 level1) → Use `xs`
291
+
292
+ #### Step 2: Update Button Recipe
293
+
294
+ **File:** `src/preset/recipes/button.ts`
295
+
296
+ ```typescript
297
+ // Before (M3-specific names)
298
+ elevated: {
299
+ base: {
300
+ boxShadow: 'level2',
301
+ },
302
+ _hover: {
303
+ boxShadow: 'level3',
304
+ },
305
+ _active: {
306
+ boxShadow: 'level1',
307
+ }
308
+ }
309
+
310
+ // After (Panda names - aesthetic-agnostic)
311
+ elevated: {
312
+ base: {
313
+ boxShadow: 'sm', // ✅ Panda token
314
+ },
315
+ _hover: {
316
+ boxShadow: 'md', // ✅ Panda token
317
+ },
318
+ _active: {
319
+ boxShadow: 'xs', // ✅ Panda token
320
+ }
321
+ }
322
+ ```
323
+
324
+ #### Step 3: Verify M3 Language Provides Values
325
+
326
+ **File:** `src/languages/material3.language.ts`
327
+
328
+ The M3 language file should provide the VALUES for Panda tokens:
329
+
330
+ ```typescript
331
+ // This is the TRANSFORM layer
332
+ // M3 elevation values map TO Panda token names
333
+
334
+ export const material3Language: DesignLanguageContract = {
335
+ // ... colors, spacing, etc.
336
+
337
+ // M3 defines what 'xs', 'sm', 'md', 'lg' MEAN in M3 context
338
+ shadows: {
339
+ xs: '0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15)', // M3 level1
340
+ sm: '0px 1px 2px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15)', // M3 level2
341
+ md: '0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px rgba(0, 0, 0, 0.3)', // M3 level3
342
+ lg: '0px 6px 10px 4px rgba(0, 0, 0, 0.15), 0px 2px 3px rgba(0, 0, 0, 0.3)', // M3 level4
343
+ xl: '0px 8px 12px 6px rgba(0, 0, 0, 0.15), 0px 4px 4px rgba(0, 0, 0, 0.3)', // M3 level5
344
+ }
345
+ }
346
+ ```
347
+
348
+ **Note:** This transformation might already exist in your preset layer. The key is that components reference `'sm'`, `'md'`, etc., and the M3 language provides the actual shadow values.
349
+
350
+ #### Step 4: Update Documentation
351
+
352
+ **File:** `src/stories/foundations/Elevation.mdx`
353
+
354
+ Update to clarify the architecture:
355
+
356
+ ```markdown
357
+ ## Elevation Token Architecture
358
+
359
+ ### Three-Layer System
360
+
361
+ **Layer 1: Panda CSS Infrastructure (Unchanging)**
362
+ - Token names: `xs`, `sm`, `md`, `lg`, `xl`, `2xl`
363
+ - Components always use these names
364
+
365
+ **Layer 2: Material Design 3 Language (Swappable)**
366
+ - Defines what those tokens MEAN in M3 context
367
+ - Maps M3 elevation levels to Panda token values
368
+
369
+ **Layer 3: Components (Decoupled)**
370
+ - Reference Layer 1 tokens only
371
+
372
+ ### Usage in Components
373
+
374
+ ```tsx
375
+ import { css } from 'styled-system/css'
376
+
377
+ // ✅ CORRECT - Uses Panda token name
378
+ const cardStyle = css({
379
+ boxShadow: 'sm',
380
+ _hover: {
381
+ boxShadow: 'md'
382
+ }
383
+ })
384
+
385
+ // ❌ WRONG - Uses design language name
386
+ const cardStyle = css({
387
+ boxShadow: 'level2', // Couples to M3
388
+ })
389
+ ```
390
+
391
+ ### M3 Elevation Mapping
392
+
393
+ | Panda Token | M3 Level | Use Case |
394
+ |-------------|----------|----------|
395
+ | `none` | level0 | Flat surfaces |
396
+ | `xs` | level1 | Subtle depth (cards at rest) |
397
+ | `sm` | level2 | Moderate depth (elevated buttons) |
398
+ | `md` | level3 | Prominent (dialogs, menus) |
399
+ | `lg` | level4 | High (drawers, sheets) |
400
+ | `xl` | level5 | Highest (FABs, tooltips) |
401
+
402
+ **Why this matters:** If we swap M3 for another design language (Fluent, Carbon, etc.), components don't change—only the values in Layer 2 change.
403
+ ```
404
+
405
+ #### Step 5: Generate and Test
406
+
407
+ ```bash
408
+ # Regenerate Panda CSS
409
+ pnpm build:panda
410
+
411
+ # Run Storybook
412
+ pnpm dev
413
+
414
+ # Test Button elevated variant:
415
+ # - Default should have subtle shadow
416
+ # - Hover should increase shadow
417
+ # - Active should reduce shadow
418
+ # - Light/dark mode should work
419
+ ```
420
+
421
+ ---
422
+
423
+ ## Issue 3: Missing Elevation Props
424
+
425
+ ### Strategy
426
+
427
+ Add elevation variants to high-priority recipes that would benefit from flexibility.
428
+
429
+ ### Priority Components
430
+
431
+ **High Priority (Add First):**
432
+ - Dialog - Often needs different elevations
433
+ - Drawer - Side sheets vs full drawers
434
+ - Popover - Context menus vs tooltips
435
+ - Toast - Different urgency levels
436
+
437
+ **Medium Priority (Add Later):**
438
+ - Select - Dropdown menu elevation
439
+ - Tooltip - May need subtle vs prominent
440
+
441
+ **Low Priority (Keep Hardcoded):**
442
+ - Slider - Thumb elevation is fixed
443
+ - Switch - Thumb elevation is fixed
444
+ - Stepper - Indicator elevation is fixed
445
+
446
+ ---
447
+
448
+ ### Implementation Example: Dialog
449
+
450
+ #### Step 1: Add Elevation Variant to Recipe
451
+
452
+ **File:** `src/preset/recipes/dialog.ts`
453
+
454
+ ```typescript
455
+ import { defineRecipe } from '@pandacss/dev';
456
+
457
+ export const dialog = defineRecipe({
458
+ className: 'dialog',
459
+
460
+ slots: ['backdrop', 'positioner', 'content', 'title', 'description', 'closeTrigger'],
461
+
462
+ base: {
463
+ // ... existing base styles
464
+ },
465
+
466
+ variants: {
467
+ // ... existing variants (size, placement, scrollBehavior)
468
+
469
+ // NEW: Elevation variant (using Panda token names)
470
+ elevation: {
471
+ subtle: {
472
+ content: {
473
+ boxShadow: 'sm' // ✅ Panda token
474
+ }
475
+ },
476
+ moderate: {
477
+ content: {
478
+ boxShadow: 'md' // ✅ Panda token
479
+ }
480
+ },
481
+ prominent: {
482
+ content: {
483
+ boxShadow: 'lg' // ✅ Panda token
484
+ }
485
+ }
486
+ }
487
+ },
488
+
489
+ defaultVariants: {
490
+ size: 'md',
491
+ scrollBehavior: 'outside',
492
+ placement: 'center',
493
+ elevation: 'moderate', // Default to md
494
+ },
495
+ });
496
+ ```
497
+
498
+ #### Step 2: Update Component TypeScript Interface
499
+
500
+ **File:** `src/components/Dialog.tsx`
501
+
502
+ ```typescript
503
+ import type { DialogVariantProps } from 'styled-system/recipes';
504
+
505
+ interface DialogRootProps extends Dialog.RootProps {
506
+ elevation?: 'subtle' | 'moderate' | 'prominent';
507
+ // ... existing props
508
+ }
509
+ ```
510
+
511
+ #### Step 3: Update Story with Elevation Examples
512
+
513
+ **File:** `stories/Dialog.stories.tsx`
514
+
515
+ ```typescript
516
+ export const ElevationVariants: Story = {
517
+ render: () => (
518
+ <VStack gap="4">
519
+ <Dialog elevation="subtle">
520
+ <DialogTrigger>Subtle Elevation</DialogTrigger>
521
+ <DialogContent>
522
+ <DialogHeader>
523
+ <DialogTitle>Subtle Dialog</DialogTitle>
524
+ </DialogHeader>
525
+ <DialogBody>Lower elevation for less prominent dialogs</DialogBody>
526
+ </DialogContent>
527
+ </Dialog>
528
+
529
+ <Dialog elevation="moderate">
530
+ <DialogTrigger>Moderate Elevation (Default)</DialogTrigger>
531
+ <DialogContent>
532
+ <DialogHeader>
533
+ <DialogTitle>Standard Dialog</DialogTitle>
534
+ </DialogHeader>
535
+ <DialogBody>Default elevation for most dialogs</DialogBody>
536
+ </DialogContent>
537
+ </Dialog>
538
+
539
+ <Dialog elevation="prominent">
540
+ <DialogTrigger>Prominent Elevation</DialogTrigger>
541
+ <DialogContent>
542
+ <DialogHeader>
543
+ <DialogTitle>Important Dialog</DialogTitle>
544
+ </DialogHeader>
545
+ <DialogBody>Higher elevation for critical actions</DialogBody>
546
+ </DialogContent>
547
+ </Dialog>
548
+ </VStack>
549
+ )
550
+ };
551
+ ```
552
+
553
+ #### Step 4: Document in Storybook
554
+
555
+ Add to dialog component docs:
556
+
557
+ ```markdown
558
+ ## Elevation
559
+
560
+ Dialogs support three elevation levels:
561
+
562
+ - **subtle** (`sm`) - For less prominent dialogs
563
+ - **moderate** (`md`) - Default, for standard dialogs
564
+ - **prominent** (`lg`) - For critical/important dialogs
565
+
566
+ Match the elevation to the dialog's importance in the user flow.
567
+ ```
568
+
569
+ ---
570
+
571
+ ### Apply Same Pattern to Other Components
572
+
573
+ #### Drawer
574
+
575
+ ```typescript
576
+ elevation: {
577
+ moderate: { content: { boxShadow: 'md' } }, // ✅ Panda tokens
578
+ high: { content: { boxShadow: 'lg' } }, // ✅ Panda tokens
579
+ }
580
+ defaultVariants: { elevation: 'high' }
581
+ ```
582
+
583
+ #### Popover
584
+
585
+ ```typescript
586
+ elevation: {
587
+ subtle: { content: { boxShadow: 'sm' } }, // ✅ Panda tokens
588
+ moderate: { content: { boxShadow: 'md' } }, // ✅ Panda tokens
589
+ }
590
+ defaultVariants: { elevation: 'moderate' }
591
+ ```
592
+
593
+ #### Toast
594
+
595
+ ```typescript
596
+ elevation: {
597
+ high: { root: { boxShadow: 'lg' } }, // ✅ Panda tokens
598
+ highest: { root: { boxShadow: 'xl' } }, // ✅ Panda tokens
599
+ }
600
+ defaultVariants: { elevation: 'highest' }
601
+ ```
602
+
603
+ ---
604
+
605
+ ## Implementation Timeline
606
+
607
+ ### Day 1: Fix Architectural Violation (1 hour)
608
+
609
+ **Morning:**
610
+ - [ ] Update Button recipe: `level2/3/1` → `sm/md/xs`
611
+ - [ ] Run `pnpm build:panda`
612
+ - [ ] Test Button elevated variant in Storybook
613
+ - [ ] Verify no visual regression
614
+
615
+ ### Day 2: Fix Inline Shadows (30 minutes)
616
+
617
+ **Morning:**
618
+ - [ ] Add `focus-underline` and `inset-border` tokens to shadows.ts
619
+ - [ ] Update Input, Textarea, RadioGroup recipes
620
+ - [ ] Run `pnpm build:panda`
621
+ - [ ] Test all three components
622
+
623
+ ### Day 3: Add Elevation Variants (2-3 hours)
624
+
625
+ **Morning:**
626
+ - [ ] Dialog - add elevation variant
627
+ - [ ] Drawer - add elevation variant
628
+
629
+ **Afternoon:**
630
+ - [ ] Popover - add elevation variant
631
+ - [ ] Toast - add elevation variant
632
+
633
+ ### Day 4: Stories & Documentation (1-2 hours)
634
+
635
+ **Morning:**
636
+ - [ ] Update Dialog, Drawer, Popover, Toast stories
637
+ - [ ] Add elevation examples to each
638
+
639
+ **Afternoon:**
640
+ - [ ] Update `Elevation.mdx` with architecture explanation
641
+ - [ ] Document Panda token usage
642
+ - [ ] Update component-specific elevation docs
643
+
644
+ ### Day 5: Final Testing (1 hour)
645
+
646
+ - [ ] Visual regression testing (all components)
647
+ - [ ] Test light/dark mode
648
+ - [ ] Test interactive states
649
+ - [ ] Verify Storybook builds successfully
650
+
651
+ **Total Time:** 5.5-7.5 hours over 5 days
652
+
653
+ ---
654
+
655
+ ## Testing Strategy
656
+
657
+ ### Visual Regression Testing
658
+
659
+ **Manual Checklist:**
660
+
661
+ ```
662
+ Components to Verify:
663
+ [ ] Button - elevated variant (sm → md on hover → xs on active)
664
+ [ ] Card - elevated variant (lg)
665
+ [ ] Dialog - content shadow (md or custom)
666
+ [ ] Drawer - content shadow (lg or custom)
667
+ [ ] Popover - content shadow (md or custom)
668
+ [ ] Select - dropdown shadow (md)
669
+ [ ] Slider - thumb shadow (xs)
670
+ [ ] Stepper - indicator shadow (sm)
671
+ [ ] Switch - thumb shadow (xs)
672
+ [ ] Toast - root shadow (xl or custom)
673
+ [ ] Tooltip - content shadow (sm)
674
+ [ ] Input - flushed variant focus (focus-underline)
675
+ [ ] Textarea - flushed variant focus (focus-underline)
676
+ [ ] RadioGroup - border (inset-border)
677
+
678
+ States to Test:
679
+ [ ] Default state
680
+ [ ] Hover state
681
+ [ ] Active/pressed state
682
+ [ ] Focus state
683
+ [ ] Disabled state
684
+ [ ] Light theme
685
+ [ ] Dark theme
686
+ ```
687
+
688
+ ### Verify Architecture
689
+
690
+ **Token Name Audit:**
691
+
692
+ ```bash
693
+ # Find any remaining M3-specific token usage
694
+ grep -r "boxShadow: 'level" src/preset/recipes/
695
+ grep -r 'boxShadow: "level' src/preset/recipes/
696
+
697
+ # Should return ZERO results after fix
698
+ ```
699
+
700
+ **Expected Result:** All recipes use Panda token names (`xs`, `sm`, `md`, `lg`, `xl`, `2xl`)
701
+
702
+ ---
703
+
704
+ ## Breaking Changes & Migration
705
+
706
+ ### Breaking Changes
707
+
708
+ #### For Component Consumers
709
+
710
+ **✅ NO BREAKING CHANGES for normal component usage**
711
+
712
+ Components work the same:
713
+ ```typescript
714
+ // Still works exactly the same
715
+ <Button variant="elevated" />
716
+ <Card variant="elevated" />
717
+ <Dialog />
718
+ ```
719
+
720
+ **⚠️ BREAKING: Only if using css() directly with old tokens**
721
+
722
+ If consumers were using M3 token names directly:
723
+
724
+ ```typescript
725
+ // Before (if anyone was doing this)
726
+ <div className={css({ boxShadow: 'level2' })} />
727
+
728
+ // After - won't work, must use Panda names
729
+ <div className={css({ boxShadow: 'sm' })} />
730
+ ```
731
+
732
+ **But this is unlikely** since M3 levels weren't in Panda preset (only in material3Language file).
733
+
734
+ ---
735
+
736
+ ### Migration Guide
737
+
738
+ **For Consumers of Design System:**
739
+
740
+ ```markdown
741
+ # Migration Guide: Shadow Tokens v0.13 → v0.14
742
+
743
+ ## Component Usage (No Changes)
744
+
745
+ ✅ All components work the same:
746
+ ```tsx
747
+ <Button variant="elevated" />
748
+ <Card variant="elevated" />
749
+ <Dialog />
750
+ ```
751
+
752
+ No action needed for normal component usage.
753
+
754
+ ## New Features
755
+
756
+ ### Elevation Variants (New)
757
+
758
+ Some components now support elevation props:
759
+
760
+ ```tsx
761
+ <Dialog elevation="moderate" />
762
+ <Drawer elevation="high" />
763
+ <Popover elevation="subtle" />
764
+ <Toast elevation="highest" />
765
+ ```
766
+
767
+ Available levels: `subtle`, `moderate`, `prominent`, `high`, `highest`
768
+ (varies by component - check component docs)
769
+
770
+ ## Internal Changes (Design System Only)
771
+
772
+ For design system maintainers:
773
+ - Button recipe updated to use Panda token names internally
774
+ - All recipes now use consistent Panda/Park UI naming
775
+ - M3 language provides values for those tokens
776
+ ```
777
+
778
+ ---
779
+
780
+ ## Success Criteria
781
+
782
+ ### Phase 1: Architecture Fix ✅
783
+
784
+ - [ ] Button uses Panda token names (`sm`, `md`, `xs`)
785
+ - [ ] Zero recipes use M3-specific names (`level0-5`)
786
+ - [ ] All shadow tokens use Panda naming convention
787
+ - [ ] M3 language provides values for Panda tokens
788
+ - [ ] Architecture audit passes (grep returns 0 results)
789
+
790
+ ### Phase 2: Semantic Tokens ✅
791
+
792
+ - [ ] No inline shadow values
793
+ - [ ] `focus-underline` token created
794
+ - [ ] `inset-border` token created
795
+ - [ ] Input/Textarea/RadioGroup use new tokens
796
+
797
+ ### Phase 3: Elevation Variants ✅
798
+
799
+ - [ ] 4+ components support elevation variants
800
+ - [ ] All elevation variants use Panda token names
801
+ - [ ] All elevation variants have story examples
802
+ - [ ] TypeScript interfaces include elevation props
803
+
804
+ ### Phase 4: Documentation ✅
805
+
806
+ - [ ] Elevation.mdx explains three-layer architecture
807
+ - [ ] Component docs include elevation guidance
808
+ - [ ] Storybook MCP includes elevation knowledge
809
+ - [ ] Agent can understand Panda token usage
810
+
811
+ ---
812
+
813
+ ## Rollout Plan
814
+
815
+ ### Step 1: Internal Fix (Day 1-3)
816
+ - [ ] Fix Button recipe (Panda tokens)
817
+ - [ ] Add semantic tokens
818
+ - [ ] Test all components
819
+
820
+ ### Step 2: Enhancement (Day 4-5)
821
+ - [ ] Add elevation variants
822
+ - [ ] Update stories
823
+ - [ ] Update documentation
824
+
825
+ ### Step 3: Release (Day 6)
826
+ - [ ] Publish as minor version (internal fix, no breaking changes)
827
+ - [ ] Update changelog
828
+ - [ ] Announce new elevation variants feature
829
+
830
+ ---
831
+
832
+ ## Architecture Validation
833
+
834
+ ### Before Fix (Architectural Violation)
835
+
836
+ ```
837
+ Button Recipe:
838
+ ├── boxShadow: 'level2' ❌ M3-specific (Layer 2)
839
+ ├── boxShadow: 'level3' ❌ M3-specific (Layer 2)
840
+ └── boxShadow: 'level1' ❌ M3-specific (Layer 2)
841
+
842
+ Other Recipes:
843
+ ├── boxShadow: 'sm' ✅ Panda token (Layer 1)
844
+ ├── boxShadow: 'md' ✅ Panda token (Layer 1)
845
+ └── boxShadow: 'lg' ✅ Panda token (Layer 1)
846
+
847
+ Problem: Inconsistent architecture
848
+ ```
849
+
850
+ ### After Fix (Aesthetic-Agnostic)
851
+
852
+ ```
853
+ ALL Recipes:
854
+ ├── boxShadow: 'xs' ✅ Panda token (Layer 1)
855
+ ├── boxShadow: 'sm' ✅ Panda token (Layer 1)
856
+ ├── boxShadow: 'md' ✅ Panda token (Layer 1)
857
+ ├── boxShadow: 'lg' ✅ Panda token (Layer 1)
858
+ └── boxShadow: 'xl' ✅ Panda token (Layer 1)
859
+
860
+ Material3 Language (Layer 2):
861
+ └── Provides VALUES for xs, sm, md, lg, xl
862
+
863
+ Result: Can swap M3 for any design language
864
+ ```
865
+
866
+ ---
867
+
868
+ ## Related Documents
869
+
870
+ - **Architectural Philosophy:** `CLAUDE.md` (three-layer system)
871
+ - **Storybook MCP Strategy:** `STORYBOOK_MCP_STRATEGY.md`
872
+ - **Material Theme JSON:** `docs/material-theme.json`
873
+ - **Elevation Documentation:** `src/stories/foundations/Elevation.mdx`
874
+ - **Shadow Preset:** `src/preset/shadows.ts`
875
+
876
+ ---
877
+
878
+ ## Key Takeaway
879
+
880
+ **The fix is simple:**
881
+ - Change Button from M3 names → Panda names
882
+ - Everything else already follows correct architecture
883
+ - Add semantic tokens for inline shadows
884
+ - Add elevation variants for flexibility
885
+
886
+ **The insight is profound:**
887
+ - Design language (M3) provides VALUES
888
+ - Infrastructure (Panda) provides NAMES
889
+ - Components reference infrastructure only
890
+ - This enables aesthetic swapping
891
+
892
+ ---
893
+
894
+ **Next Actions:**
895
+
896
+ 1. [ ] Confirm architectural understanding with team
897
+ 2. [ ] Execute Phase 1 (Button fix)
898
+ 3. [ ] Execute Phase 2 (semantic tokens)
899
+ 4. [ ] Execute Phase 3 (elevation variants)
900
+ 5. [ ] Update documentation and MCP resources
901
+
902
+ **Document maintained by:** Design System Team
903
+ **Updated:** 2026-02-10 with corrected architectural understanding