@discourser/design-system 0.22.0 → 0.22.2

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 (33) hide show
  1. package/dist/{chunk-VJN7TIGL.js → chunk-GLPWI7OF.js} +3 -3
  2. package/dist/chunk-GLPWI7OF.js.map +1 -0
  3. package/dist/{chunk-IGCGVSG4.cjs → chunk-NN4YW27E.cjs} +3 -3
  4. package/dist/chunk-NN4YW27E.cjs.map +1 -0
  5. package/dist/figma-codex.json +2 -2
  6. package/dist/index.cjs +4 -4
  7. package/dist/index.js +1 -1
  8. package/dist/languages/transform.d.ts +1 -1
  9. package/dist/preset/index.cjs +2 -2
  10. package/dist/preset/index.js +1 -1
  11. package/dist/stories/foundations/components/ColorSwatch.d.ts +1 -15
  12. package/dist/stories/foundations/components/ColorSwatch.d.ts.map +1 -1
  13. package/dist/stories/foundations/components/ElevationCard.d.ts +3 -6
  14. package/dist/stories/foundations/components/ElevationCard.d.ts.map +1 -1
  15. package/dist/stories/foundations/components/SpacingBox.d.ts.map +1 -1
  16. package/dist/stories/foundations/components/TypeSpecimen.d.ts +2 -1
  17. package/dist/stories/foundations/components/TypeSpecimen.d.ts.map +1 -1
  18. package/package.json +4 -3
  19. package/src/languages/transform.ts +1 -1
  20. package/src/stories/foundations/Borders.stories.tsx +138 -0
  21. package/src/stories/foundations/ColorScale.stories.tsx +737 -0
  22. package/src/stories/foundations/Colors.mdx +2 -131
  23. package/src/stories/foundations/Elevation.mdx +26 -45
  24. package/src/stories/foundations/Motion.stories.tsx +306 -0
  25. package/src/stories/foundations/Shape.stories.tsx +159 -0
  26. package/src/stories/foundations/Spacing.mdx +24 -25
  27. package/src/stories/foundations/Typography.mdx +93 -79
  28. package/src/stories/foundations/components/ColorSwatch.tsx +72 -109
  29. package/src/stories/foundations/components/ElevationCard.tsx +19 -22
  30. package/src/stories/foundations/components/SpacingBox.tsx +15 -2
  31. package/src/stories/foundations/components/TypeSpecimen.tsx +20 -21
  32. package/dist/chunk-IGCGVSG4.cjs.map +0 -1
  33. package/dist/chunk-VJN7TIGL.js.map +0 -1
@@ -1,6 +1,5 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import { TypeSpecimen } from './components/TypeSpecimen';
3
- import { material3Language } from '../../languages/material3.language';
4
3
 
5
4
  <Meta title="Foundations/Typography" />
6
5
 
@@ -15,7 +14,7 @@ The system uses three font families, each serving a specific purpose:
15
14
  <div style={{ marginBottom: '32px', padding: '24px', backgroundColor: '#f5f5f5', borderRadius: '8px' }}>
16
15
  <div style={{ marginBottom: '16px' }}>
17
16
  <div style={{ fontWeight: '600', marginBottom: '8px' }}>Display</div>
18
- <div style={{ fontFamily: material3Language.typography.fonts.display, fontSize: '24px', marginBottom: '4px' }}>
17
+ <div style={{ fontFamily: '"Fraunces", Georgia, serif', fontSize: '24px', marginBottom: '4px' }}>
19
18
  "Fraunces", Georgia, serif
20
19
  </div>
21
20
  <div style={{ fontSize: '12px', color: '#666' }}>
@@ -25,7 +24,7 @@ The system uses three font families, each serving a specific purpose:
25
24
 
26
25
  <div style={{ marginBottom: '16px' }}>
27
26
  <div style={{ fontWeight: '600', marginBottom: '8px' }}>Body</div>
28
- <div style={{ fontFamily: material3Language.typography.fonts.body, fontSize: '16px', marginBottom: '4px' }}>
27
+ <div style={{ fontFamily: '"Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', fontSize: '16px', marginBottom: '4px' }}>
29
28
  "Poppins", -apple-system, BlinkMacSystemFont, sans-serif
30
29
  </div>
31
30
  <div style={{ fontSize: '12px', color: '#666' }}>
@@ -35,7 +34,7 @@ The system uses three font families, each serving a specific purpose:
35
34
 
36
35
  <div>
37
36
  <div style={{ fontWeight: '600', marginBottom: '8px' }}>Monospace</div>
38
- <div style={{ fontFamily: material3Language.typography.fonts.mono, fontSize: '14px', marginBottom: '4px' }}>
37
+ <div style={{ fontFamily: '"JetBrains Mono", "Fira Code", Consolas, monospace', fontSize: '14px', marginBottom: '4px' }}>
39
38
  JetBrains Mono, Fira Code, Consolas, monospace
40
39
  </div>
41
40
  <div style={{ fontSize: '12px', color: '#666' }}>
@@ -55,32 +54,35 @@ Material Design 3's type scale consists of 13 styles across 5 categories: Displa
55
54
  Display styles are the largest text on screen, reserved for short, important text or numerals.
56
55
 
57
56
  <TypeSpecimen
57
+ styleName="displayLarge"
58
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}
59
+ fontSize="57px"
60
+ lineHeight="64px"
61
+ fontWeight="400"
62
+ letterSpacing="-0.25px"
63
+ fontFamily="display"
64
64
  sampleText="Display Large"
65
65
  />
66
66
 
67
67
  <TypeSpecimen
68
+ styleName="displayMedium"
68
69
  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}
70
+ fontSize="45px"
71
+ lineHeight="52px"
72
+ fontWeight="400"
73
+ letterSpacing="0px"
74
+ fontFamily="display"
74
75
  sampleText="Display Medium"
75
76
  />
76
77
 
77
78
  <TypeSpecimen
79
+ styleName="displaySmall"
78
80
  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}
81
+ fontSize="36px"
82
+ lineHeight="44px"
83
+ fontWeight="400"
84
+ letterSpacing="0px"
85
+ fontFamily="display"
84
86
  sampleText="Display Small"
85
87
  />
86
88
 
@@ -89,32 +91,35 @@ Display styles are the largest text on screen, reserved for short, important tex
89
91
  Headlines are for high-emphasis text on smaller screens. They're best-suited for short, high-emphasis text.
90
92
 
91
93
  <TypeSpecimen
94
+ styleName="headlineLarge"
92
95
  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}
96
+ fontSize="32px"
97
+ lineHeight="40px"
98
+ fontWeight="400"
99
+ letterSpacing="0px"
100
+ fontFamily="display"
98
101
  sampleText="Headline Large"
99
102
  />
100
103
 
101
104
  <TypeSpecimen
105
+ styleName="headlineMedium"
102
106
  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}
107
+ fontSize="28px"
108
+ lineHeight="36px"
109
+ fontWeight="400"
110
+ letterSpacing="0px"
111
+ fontFamily="display"
108
112
  sampleText="Headline Medium"
109
113
  />
110
114
 
111
115
  <TypeSpecimen
116
+ styleName="headlineSmall"
112
117
  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
+ fontSize="24px"
119
+ lineHeight="32px"
120
+ fontWeight="400"
121
+ letterSpacing="0px"
122
+ fontFamily="display"
118
123
  sampleText="Headline Small"
119
124
  />
120
125
 
@@ -123,32 +128,35 @@ Headlines are for high-emphasis text on smaller screens. They're best-suited for
123
128
  Titles are for medium-emphasis text that remains relatively short. Use titles for grouping related content or to emphasize important sections.
124
129
 
125
130
  <TypeSpecimen
131
+ styleName="titleLarge"
126
132
  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}
133
+ fontSize="22px"
134
+ lineHeight="28px"
135
+ fontWeight="500"
136
+ letterSpacing="0px"
137
+ fontFamily="body"
132
138
  sampleText="Title Large"
133
139
  />
134
140
 
135
141
  <TypeSpecimen
142
+ styleName="titleMedium"
136
143
  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}
144
+ fontSize="16px"
145
+ lineHeight="24px"
146
+ fontWeight="500"
147
+ letterSpacing="0.15px"
148
+ fontFamily="body"
142
149
  sampleText="Title Medium"
143
150
  />
144
151
 
145
152
  <TypeSpecimen
153
+ styleName="titleSmall"
146
154
  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}
155
+ fontSize="14px"
156
+ lineHeight="20px"
157
+ fontWeight="500"
158
+ letterSpacing="0.1px"
159
+ fontFamily="body"
152
160
  sampleText="Title Small"
153
161
  />
154
162
 
@@ -157,32 +165,35 @@ Titles are for medium-emphasis text that remains relatively short. Use titles fo
157
165
  Body styles are used for longer passages of text in your app.
158
166
 
159
167
  <TypeSpecimen
168
+ styleName="bodyLarge"
160
169
  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}
170
+ fontSize="16px"
171
+ lineHeight="24px"
172
+ fontWeight="400"
173
+ letterSpacing="0.5px"
174
+ fontFamily="body"
166
175
  sampleText="The quick brown fox jumps over the lazy dog. Body Large is used for longer passages of text that require good readability."
167
176
  />
168
177
 
169
178
  <TypeSpecimen
179
+ styleName="bodyMedium"
170
180
  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}
181
+ fontSize="14px"
182
+ lineHeight="20px"
183
+ fontWeight="400"
184
+ letterSpacing="0.25px"
185
+ fontFamily="body"
176
186
  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
187
  />
178
188
 
179
189
  <TypeSpecimen
190
+ styleName="bodySmall"
180
191
  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}
192
+ fontSize="12px"
193
+ lineHeight="16px"
194
+ fontWeight="400"
195
+ letterSpacing="0.4px"
196
+ fontFamily="body"
186
197
  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
198
  />
188
199
 
@@ -191,32 +202,35 @@ Body styles are used for longer passages of text in your app.
191
202
  Label styles are for text in components like buttons, tabs, and labels. They're utilitarian and medium-emphasis.
192
203
 
193
204
  <TypeSpecimen
205
+ styleName="labelLarge"
194
206
  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}
207
+ fontSize="14px"
208
+ lineHeight="20px"
209
+ fontWeight="500"
210
+ letterSpacing="0.1px"
211
+ fontFamily="body"
200
212
  sampleText="Label Large"
201
213
  />
202
214
 
203
215
  <TypeSpecimen
216
+ styleName="labelMedium"
204
217
  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}
218
+ fontSize="12px"
219
+ lineHeight="16px"
220
+ fontWeight="500"
221
+ letterSpacing="0.5px"
222
+ fontFamily="body"
210
223
  sampleText="Label Medium"
211
224
  />
212
225
 
213
226
  <TypeSpecimen
227
+ styleName="labelSmall"
214
228
  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}
229
+ fontSize="11px"
230
+ lineHeight="16px"
231
+ fontWeight="500"
232
+ letterSpacing="0.5px"
233
+ fontFamily="body"
220
234
  sampleText="Label Small"
221
235
  />
222
236
 
@@ -1,163 +1,126 @@
1
1
  import { type CSSProperties } from 'react';
2
+ import { css } from 'styled-system/css';
3
+
4
+ // ── Pre-declared css() lookups — Panda CSS statically extracts these ─────────
5
+ // Keys match the `name` prop passed from Colors.mdx (M3 semantic role names).
6
+ // Values use the Panda semantic token path from src/preset/semantic-tokens.ts.
7
+ const semanticBg: Record<string, string> = {
8
+ // Primary
9
+ primary: css({ bg: 'primary' }),
10
+ onPrimary: css({ bg: 'onPrimary' }),
11
+ primaryContainer: css({ bg: 'primary.container' }),
12
+ onPrimaryContainer: css({ bg: 'onPrimary.container' }),
13
+ // Secondary
14
+ secondary: css({ bg: 'secondary' }),
15
+ onSecondary: css({ bg: 'onSecondary' }),
16
+ secondaryContainer: css({ bg: 'secondary.container' }),
17
+ onSecondaryContainer: css({ bg: 'onSecondary.container' }),
18
+ // Tertiary
19
+ tertiary: css({ bg: 'tertiary' }),
20
+ onTertiary: css({ bg: 'onTertiary' }),
21
+ tertiaryContainer: css({ bg: 'tertiary.container' }),
22
+ onTertiaryContainer: css({ bg: 'onTertiary.container' }),
23
+ // Error
24
+ error: css({ bg: 'error' }),
25
+ onError: css({ bg: 'onError' }),
26
+ errorContainer: css({ bg: 'error.container' }),
27
+ onErrorContainer: css({ bg: 'onError.container' }),
28
+ // Surface
29
+ surface: css({ bg: 'surface' }),
30
+ onSurface: css({ bg: 'onSurface' }),
31
+ surfaceVariant: css({ bg: 'surfaceVariant' }),
32
+ onSurfaceVariant: css({ bg: 'onSurface.variant' }),
33
+ // Surface containers
34
+ surfaceContainerLowest: css({ bg: 'surface.container.lowest' }),
35
+ surfaceContainerLow: css({ bg: 'surface.container.low' }),
36
+ surfaceContainer: css({ bg: 'surface.container' }),
37
+ surfaceContainerHigh: css({ bg: 'surface.container.high' }),
38
+ surfaceContainerHighest: css({ bg: 'surface.container.highest' }),
39
+ // Outline
40
+ outline: css({ bg: 'outline' }),
41
+ outlineVariant: css({ bg: 'outline.variant' }),
42
+ // Inverse
43
+ inverseSurface: css({ bg: 'inverseSurface' }),
44
+ inverseOnSurface: css({ bg: 'inverseOnSurface' }),
45
+ inversePrimary: css({ bg: 'inversePrimary' }),
46
+ // Utility
47
+ background: css({ bg: 'background' }),
48
+ onBackground: css({ bg: 'onBackground' }),
49
+ scrim: css({ bg: 'scrim' }),
50
+ shadow: css({ bg: 'shadow' }),
51
+ };
2
52
 
3
- interface ColorSwatchProps {
53
+ interface SemanticSwatchProps {
4
54
  name: string;
5
- value: string;
6
55
  description?: string;
7
56
  }
8
57
 
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
- };
58
+ export const SemanticSwatch = ({ name, description }: SemanticSwatchProps) => {
59
+ const bgClass = semanticBg[name] ?? '';
18
60
 
19
61
  const containerStyle: CSSProperties = {
20
- display: 'flex',
21
- flexDirection: 'column',
22
62
  marginBottom: '16px',
23
63
  };
24
64
 
25
65
  const labelStyle: CSSProperties = {
26
66
  fontSize: '14px',
27
67
  fontWeight: '500',
28
- marginBottom: '4px',
68
+ marginBottom: '8px',
29
69
  fontFamily: 'Inter, sans-serif',
30
70
  };
31
71
 
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 = {
72
+ const swatchRowStyle: CSSProperties = {
101
73
  display: 'grid',
102
74
  gridTemplateColumns: '1fr 1fr',
103
75
  gap: '8px',
104
- marginBottom: '16px',
105
76
  };
106
77
 
107
78
  const swatchContainerStyle: CSSProperties = {
108
79
  display: 'flex',
109
80
  flexDirection: 'column',
81
+ gap: '4px',
110
82
  };
111
83
 
112
- const swatchStyle = (color: string): CSSProperties => ({
113
- backgroundColor: color,
84
+ const swatchStyle: CSSProperties = {
114
85
  height: '80px',
115
86
  borderRadius: '8px',
116
87
  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
88
  };
132
89
 
133
90
  const modeStyle: CSSProperties = {
134
91
  fontSize: '10px',
135
92
  textTransform: 'uppercase',
136
93
  color: '#999',
137
- marginBottom: '4px',
138
94
  fontWeight: '600',
139
95
  };
140
96
 
97
+ const tokenStyle: CSSProperties = {
98
+ fontSize: '11px',
99
+ fontFamily: 'monospace',
100
+ color: '#666',
101
+ };
102
+
141
103
  const descStyle: CSSProperties = {
142
104
  fontSize: '12px',
143
105
  color: '#666',
144
106
  marginTop: '8px',
145
- gridColumn: '1 / -1',
146
107
  };
147
108
 
148
109
  return (
149
- <div>
110
+ <div style={containerStyle}>
150
111
  <div style={labelStyle}>{name}</div>
151
- <div style={containerStyle}>
112
+ <div style={swatchRowStyle}>
113
+ {/* Light mode swatch — inherits default theme */}
152
114
  <div style={swatchContainerStyle}>
153
115
  <div style={modeStyle}>Light</div>
154
- <div style={swatchStyle(lightValue)} />
155
- <div style={valueStyle}>{lightValue}</div>
116
+ <div className={bgClass} style={swatchStyle} />
117
+ <div style={tokenStyle}>{name}</div>
156
118
  </div>
157
- <div style={swatchContainerStyle}>
119
+ {/* Dark mode swatch — forced via data-theme="dark" */}
120
+ <div style={swatchContainerStyle} data-theme="dark">
158
121
  <div style={modeStyle}>Dark</div>
159
- <div style={swatchStyle(darkValue)} />
160
- <div style={valueStyle}>{darkValue}</div>
122
+ <div className={bgClass} style={swatchStyle} />
123
+ <div style={tokenStyle}>{name} [dark]</div>
161
124
  </div>
162
125
  </div>
163
126
  {description && <div style={descStyle}>{description}</div>}
@@ -1,11 +1,21 @@
1
1
  import { type CSSProperties } from 'react';
2
+ import { css } from 'styled-system/css';
3
+
4
+ // ── Pre-declared css() calls — Panda CSS statically extracts these ─────────
5
+ export const elevationClasses: Record<string, string> = {
6
+ level0: css({ boxShadow: 'level0' }),
7
+ level1: css({ boxShadow: 'level1' }),
8
+ level2: css({ boxShadow: 'level2' }),
9
+ level3: css({ boxShadow: 'level3' }),
10
+ level4: css({ boxShadow: 'level4' }),
11
+ level5: css({ boxShadow: 'level5' }),
12
+ };
2
13
 
3
14
  interface ElevationCardProps {
4
15
  level: string;
5
- shadow: string;
6
16
  }
7
17
 
8
- export const ElevationCard = ({ level, shadow }: ElevationCardProps) => {
18
+ export const ElevationCard = ({ level }: ElevationCardProps) => {
9
19
  const containerStyle: CSSProperties = {
10
20
  display: 'flex',
11
21
  flexDirection: 'column',
@@ -22,7 +32,7 @@ export const ElevationCard = ({ level, shadow }: ElevationCardProps) => {
22
32
  alignItems: 'center',
23
33
  justifyContent: 'center',
24
34
  marginBottom: '16px',
25
- boxShadow: shadow === 'none' ? 'none' : shadow,
35
+ // boxShadow applied via className reads from Panda CSS variable
26
36
  };
27
37
 
28
38
  const labelStyle: CSSProperties = {
@@ -33,34 +43,19 @@ export const ElevationCard = ({ level, shadow }: ElevationCardProps) => {
33
43
  color: '#333',
34
44
  };
35
45
 
36
- const shadowValueStyle: CSSProperties = {
37
- fontSize: '11px',
38
- fontFamily: 'monospace',
39
- color: '#666',
40
- maxWidth: '300px',
41
- textAlign: 'center',
42
- wordBreak: 'break-word',
43
- lineHeight: '1.5',
44
- };
45
-
46
46
  return (
47
47
  <div style={containerStyle}>
48
48
  <div style={labelStyle}>{level}</div>
49
- <div style={cardStyle}>
49
+ <div style={cardStyle} className={elevationClasses[level]}>
50
50
  <span style={{ color: '#999', fontSize: '14px' }}>
51
51
  {level === 'level0' ? 'No shadow' : 'Elevation'}
52
52
  </span>
53
53
  </div>
54
- <div style={shadowValueStyle}>{shadow === 'none' ? 'none' : shadow}</div>
55
54
  </div>
56
55
  );
57
56
  };
58
57
 
59
- interface ElevationGridProps {
60
- elevations: Record<string, string>;
61
- }
62
-
63
- export const ElevationGrid = ({ elevations }: ElevationGridProps) => {
58
+ export const ElevationGrid = () => {
64
59
  const gridStyle: CSSProperties = {
65
60
  display: 'grid',
66
61
  gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))',
@@ -73,8 +68,10 @@ export const ElevationGrid = ({ elevations }: ElevationGridProps) => {
73
68
 
74
69
  return (
75
70
  <div style={gridStyle}>
76
- {Object.entries(elevations).map(([level, shadow]) => (
77
- <ElevationCard key={level} level={level} shadow={shadow} />
71
+ {(
72
+ ['level0', 'level1', 'level2', 'level3', 'level4', 'level5'] as const
73
+ ).map((level) => (
74
+ <ElevationCard key={level} level={level} />
78
75
  ))}
79
76
  </div>
80
77
  );
@@ -1,4 +1,18 @@
1
1
  import { type CSSProperties } from 'react';
2
+ import { css } from 'styled-system/css';
3
+
4
+ // ── Pre-declared css() calls — Panda CSS statically extracts these ─────────
5
+ const spacingWidthClasses: Record<string, string> = {
6
+ none: css({ width: 'none' }),
7
+ xxs: css({ width: 'xxs' }),
8
+ xs: css({ width: 'xs' }),
9
+ sm: css({ width: 'sm' }),
10
+ md: css({ width: 'md' }),
11
+ lg: css({ width: 'lg' }),
12
+ xl: css({ width: 'xl' }),
13
+ xxl: css({ width: 'xxl' }),
14
+ xxxl: css({ width: 'xxxl' }),
15
+ };
2
16
 
3
17
  interface SpacingBoxProps {
4
18
  name: string;
@@ -39,7 +53,6 @@ export const SpacingBox = ({ name, value }: SpacingBoxProps) => {
39
53
  };
40
54
 
41
55
  const boxStyle: CSSProperties = {
42
- width: value,
43
56
  height: '40px',
44
57
  backgroundColor: '#4C662B',
45
58
  borderRadius: '4px',
@@ -64,7 +77,7 @@ export const SpacingBox = ({ name, value }: SpacingBoxProps) => {
64
77
  <div style={valueStyle}>{value}</div>
65
78
  </div>
66
79
  <div style={boxContainerStyle}>
67
- <div style={boxStyle}>
80
+ <div style={boxStyle} className={spacingWidthClasses[name]}>
68
81
  <div style={dimensionStyle}>{value}</div>
69
82
  </div>
70
83
  </div>