@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.
- package/dist/{chunk-VJN7TIGL.js → chunk-GLPWI7OF.js} +3 -3
- package/dist/chunk-GLPWI7OF.js.map +1 -0
- package/dist/{chunk-IGCGVSG4.cjs → chunk-NN4YW27E.cjs} +3 -3
- package/dist/chunk-NN4YW27E.cjs.map +1 -0
- package/dist/figma-codex.json +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.js +1 -1
- package/dist/languages/transform.d.ts +1 -1
- package/dist/preset/index.cjs +2 -2
- package/dist/preset/index.js +1 -1
- package/dist/stories/foundations/components/ColorSwatch.d.ts +1 -15
- package/dist/stories/foundations/components/ColorSwatch.d.ts.map +1 -1
- package/dist/stories/foundations/components/ElevationCard.d.ts +3 -6
- package/dist/stories/foundations/components/ElevationCard.d.ts.map +1 -1
- package/dist/stories/foundations/components/SpacingBox.d.ts.map +1 -1
- package/dist/stories/foundations/components/TypeSpecimen.d.ts +2 -1
- package/dist/stories/foundations/components/TypeSpecimen.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/languages/transform.ts +1 -1
- package/src/stories/foundations/Borders.stories.tsx +138 -0
- package/src/stories/foundations/ColorScale.stories.tsx +737 -0
- package/src/stories/foundations/Colors.mdx +2 -131
- package/src/stories/foundations/Elevation.mdx +26 -45
- package/src/stories/foundations/Motion.stories.tsx +306 -0
- package/src/stories/foundations/Shape.stories.tsx +159 -0
- package/src/stories/foundations/Spacing.mdx +24 -25
- package/src/stories/foundations/Typography.mdx +93 -79
- package/src/stories/foundations/components/ColorSwatch.tsx +72 -109
- package/src/stories/foundations/components/ElevationCard.tsx +19 -22
- package/src/stories/foundations/components/SpacingBox.tsx +15 -2
- package/src/stories/foundations/components/TypeSpecimen.tsx +20 -21
- package/dist/chunk-IGCGVSG4.cjs.map +0 -1
- 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:
|
|
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:
|
|
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:
|
|
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=
|
|
60
|
-
lineHeight=
|
|
61
|
-
fontWeight=
|
|
62
|
-
letterSpacing=
|
|
63
|
-
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=
|
|
70
|
-
lineHeight=
|
|
71
|
-
fontWeight=
|
|
72
|
-
letterSpacing=
|
|
73
|
-
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=
|
|
80
|
-
lineHeight=
|
|
81
|
-
fontWeight=
|
|
82
|
-
letterSpacing=
|
|
83
|
-
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=
|
|
94
|
-
lineHeight=
|
|
95
|
-
fontWeight=
|
|
96
|
-
letterSpacing=
|
|
97
|
-
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=
|
|
104
|
-
lineHeight=
|
|
105
|
-
fontWeight=
|
|
106
|
-
letterSpacing=
|
|
107
|
-
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=
|
|
114
|
-
lineHeight=
|
|
115
|
-
fontWeight=
|
|
116
|
-
letterSpacing=
|
|
117
|
-
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=
|
|
128
|
-
lineHeight=
|
|
129
|
-
fontWeight=
|
|
130
|
-
letterSpacing=
|
|
131
|
-
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=
|
|
138
|
-
lineHeight=
|
|
139
|
-
fontWeight=
|
|
140
|
-
letterSpacing=
|
|
141
|
-
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=
|
|
148
|
-
lineHeight=
|
|
149
|
-
fontWeight=
|
|
150
|
-
letterSpacing=
|
|
151
|
-
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=
|
|
162
|
-
lineHeight=
|
|
163
|
-
fontWeight=
|
|
164
|
-
letterSpacing=
|
|
165
|
-
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=
|
|
172
|
-
lineHeight=
|
|
173
|
-
fontWeight=
|
|
174
|
-
letterSpacing=
|
|
175
|
-
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=
|
|
182
|
-
lineHeight=
|
|
183
|
-
fontWeight=
|
|
184
|
-
letterSpacing=
|
|
185
|
-
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=
|
|
196
|
-
lineHeight=
|
|
197
|
-
fontWeight=
|
|
198
|
-
letterSpacing=
|
|
199
|
-
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=
|
|
206
|
-
lineHeight=
|
|
207
|
-
fontWeight=
|
|
208
|
-
letterSpacing=
|
|
209
|
-
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=
|
|
216
|
-
lineHeight=
|
|
217
|
-
fontWeight=
|
|
218
|
-
letterSpacing=
|
|
219
|
-
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
|
|
53
|
+
interface SemanticSwatchProps {
|
|
4
54
|
name: string;
|
|
5
|
-
value: string;
|
|
6
55
|
description?: string;
|
|
7
56
|
}
|
|
8
57
|
|
|
9
|
-
export const
|
|
10
|
-
const
|
|
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: '
|
|
68
|
+
marginBottom: '8px',
|
|
29
69
|
fontFamily: 'Inter, sans-serif',
|
|
30
70
|
};
|
|
31
71
|
|
|
32
|
-
const
|
|
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
|
|
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={
|
|
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
|
|
155
|
-
<div style={
|
|
116
|
+
<div className={bgClass} style={swatchStyle} />
|
|
117
|
+
<div style={tokenStyle}>{name}</div>
|
|
156
118
|
</div>
|
|
157
|
-
|
|
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
|
|
160
|
-
<div style={
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
{
|
|
77
|
-
|
|
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>
|