@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
@@ -0,0 +1,306 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { css } from 'styled-system/css';
3
+
4
+ const meta = {
5
+ title: 'Foundations/Motion',
6
+ parameters: { layout: 'padded' },
7
+ } satisfies Meta;
8
+
9
+ export default meta;
10
+ type Story = StoryObj<typeof meta>;
11
+
12
+ // ── Pre-declared css() calls — Panda CSS statically extracts these ─────────────
13
+ // (dynamic template literals cannot be extracted; explicit literals are required)
14
+
15
+ const durationBox: Record<string, string> = {
16
+ instant: css({
17
+ transitionDuration: 'instant',
18
+ transitionProperty: 'background',
19
+ transitionTimingFunction: 'standard',
20
+ bg: 'neutral.3',
21
+ }),
22
+ fast: css({
23
+ transitionDuration: 'fast',
24
+ transitionProperty: 'background',
25
+ transitionTimingFunction: 'standard',
26
+ bg: 'neutral.3',
27
+ }),
28
+ normal: css({
29
+ transitionDuration: 'normal',
30
+ transitionProperty: 'background',
31
+ transitionTimingFunction: 'standard',
32
+ bg: 'neutral.3',
33
+ }),
34
+ slow: css({
35
+ transitionDuration: 'slow',
36
+ transitionProperty: 'background',
37
+ transitionTimingFunction: 'standard',
38
+ bg: 'neutral.3',
39
+ }),
40
+ slower: css({
41
+ transitionDuration: 'slower',
42
+ transitionProperty: 'background',
43
+ transitionTimingFunction: 'standard',
44
+ bg: 'neutral.3',
45
+ }),
46
+ };
47
+
48
+ const durationBoxHover: Record<string, string> = {
49
+ instant: css({ _hover: { bg: 'primary.9' } }),
50
+ fast: css({ _hover: { bg: 'primary.9' } }),
51
+ normal: css({ _hover: { bg: 'primary.9' } }),
52
+ slow: css({ _hover: { bg: 'primary.9' } }),
53
+ slower: css({ _hover: { bg: 'primary.9' } }),
54
+ };
55
+
56
+ const easingBox: Record<string, string> = {
57
+ standard: css({
58
+ transitionTimingFunction: 'standard',
59
+ transitionDuration: 'normal',
60
+ transitionProperty: 'transform',
61
+ bg: 'primary.subtle.bg',
62
+ borderColor: 'primary.outline.border',
63
+ }),
64
+ standardDecelerate: css({
65
+ transitionTimingFunction: 'standardDecelerate',
66
+ transitionDuration: 'normal',
67
+ transitionProperty: 'transform',
68
+ bg: 'primary.subtle.bg',
69
+ borderColor: 'primary.outline.border',
70
+ }),
71
+ standardAccelerate: css({
72
+ transitionTimingFunction: 'standardAccelerate',
73
+ transitionDuration: 'normal',
74
+ transitionProperty: 'transform',
75
+ bg: 'primary.subtle.bg',
76
+ borderColor: 'primary.outline.border',
77
+ }),
78
+ emphasized: css({
79
+ transitionTimingFunction: 'emphasized',
80
+ transitionDuration: 'normal',
81
+ transitionProperty: 'transform',
82
+ bg: 'primary.subtle.bg',
83
+ borderColor: 'primary.outline.border',
84
+ }),
85
+ emphasizedDecelerate: css({
86
+ transitionTimingFunction: 'emphasizedDecelerate',
87
+ transitionDuration: 'normal',
88
+ transitionProperty: 'transform',
89
+ bg: 'primary.subtle.bg',
90
+ borderColor: 'primary.outline.border',
91
+ }),
92
+ emphasizedAccelerate: css({
93
+ transitionTimingFunction: 'emphasizedAccelerate',
94
+ transitionDuration: 'normal',
95
+ transitionProperty: 'transform',
96
+ bg: 'primary.subtle.bg',
97
+ borderColor: 'primary.outline.border',
98
+ }),
99
+ };
100
+
101
+ const easingBoxHover: Record<string, string> = {
102
+ standard: css({ _hover: { transform: 'translateX(40px)' } }),
103
+ standardDecelerate: css({ _hover: { transform: 'translateX(40px)' } }),
104
+ standardAccelerate: css({ _hover: { transform: 'translateX(40px)' } }),
105
+ emphasized: css({ _hover: { transform: 'translateX(40px)' } }),
106
+ emphasizedDecelerate: css({ _hover: { transform: 'translateX(40px)' } }),
107
+ emphasizedAccelerate: css({ _hover: { transform: 'translateX(40px)' } }),
108
+ };
109
+
110
+ // ── Data ────────────────────────────────────────────────────────────────────────
111
+
112
+ const DURATIONS: { token: string; value: string }[] = [
113
+ { token: 'instant', value: '0ms' },
114
+ { token: 'fast', value: '100ms' },
115
+ { token: 'normal', value: '200ms' },
116
+ { token: 'slow', value: '300ms' },
117
+ { token: 'slower', value: '500ms' },
118
+ ];
119
+
120
+ const EASINGS: { token: string }[] = [
121
+ { token: 'standard' },
122
+ { token: 'standardDecelerate' },
123
+ { token: 'standardAccelerate' },
124
+ { token: 'emphasized' },
125
+ { token: 'emphasizedDecelerate' },
126
+ { token: 'emphasizedAccelerate' },
127
+ ];
128
+
129
+ // ── Shared helpers ──────────────────────────────────────────────────────────────
130
+
131
+ function SectionHeading({
132
+ title,
133
+ description,
134
+ }: {
135
+ title: string;
136
+ description: string;
137
+ }) {
138
+ return (
139
+ <div style={{ marginBottom: '24px' }}>
140
+ <h2
141
+ style={{
142
+ fontSize: '18px',
143
+ fontWeight: '600',
144
+ margin: '0 0 8px',
145
+ fontFamily: 'Inter, system-ui, sans-serif',
146
+ }}
147
+ >
148
+ {title}
149
+ </h2>
150
+ <p
151
+ style={{ fontSize: '14px', color: '#666', margin: 0, lineHeight: 1.5 }}
152
+ >
153
+ {description}
154
+ </p>
155
+ </div>
156
+ );
157
+ }
158
+
159
+ // ── Story 1: Duration Tokens ───────────────────────────────────────────────────
160
+
161
+ export const DurationTokens: Story = {
162
+ name: '1 · Duration Tokens',
163
+ render: () => (
164
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
165
+ <SectionHeading
166
+ title="Duration Tokens"
167
+ description="Controls how long a transition takes. Hover each box to see the background transition from neutral to primary. All boxes use the same standard easing — only the duration changes."
168
+ />
169
+ <div
170
+ style={{
171
+ display: 'flex',
172
+ gap: '16px',
173
+ flexWrap: 'wrap',
174
+ alignItems: 'flex-start',
175
+ }}
176
+ >
177
+ {DURATIONS.map(({ token, value }) => (
178
+ <div
179
+ key={token}
180
+ style={{
181
+ display: 'flex',
182
+ flexDirection: 'column',
183
+ alignItems: 'center',
184
+ gap: '8px',
185
+ }}
186
+ >
187
+ <div
188
+ className={`${durationBox[token]} ${durationBoxHover[token]}`}
189
+ style={{
190
+ width: '80px',
191
+ height: '80px',
192
+ borderRadius: '8px',
193
+ border: '1px solid rgba(0,0,0,0.08)',
194
+ flexShrink: 0,
195
+ }}
196
+ title={`transitionDuration: ${token}`}
197
+ />
198
+ <span
199
+ style={{
200
+ fontSize: '11px',
201
+ fontFamily: 'monospace',
202
+ color: '#444',
203
+ textAlign: 'center',
204
+ lineHeight: 1.3,
205
+ }}
206
+ >
207
+ {token}
208
+ </span>
209
+ <span
210
+ style={{
211
+ fontSize: '10px',
212
+ fontFamily: 'monospace',
213
+ color: '#888',
214
+ textAlign: 'center',
215
+ }}
216
+ >
217
+ {value}
218
+ </span>
219
+ </div>
220
+ ))}
221
+ </div>
222
+ <p
223
+ style={{
224
+ fontSize: '12px',
225
+ color: '#999',
226
+ fontFamily: 'Inter, system-ui, sans-serif',
227
+ margin: 0,
228
+ }}
229
+ >
230
+ Note: <code style={{ fontFamily: 'monospace' }}>instant (0ms)</code>{' '}
231
+ produces no visible transition.
232
+ </p>
233
+ </div>
234
+ ),
235
+ };
236
+
237
+ // ── Story 2: Easing Tokens ─────────────────────────────────────────────────────
238
+
239
+ export const EasingTokens: Story = {
240
+ name: '2 · Easing Tokens',
241
+ render: () => (
242
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
243
+ <SectionHeading
244
+ title="Easing Tokens"
245
+ description="Controls the acceleration curve of a transition. All demos use normal (200ms) duration. Hover each box to see it translate — the same distance in the same time, but with a different feel."
246
+ />
247
+ <div
248
+ style={{
249
+ display: 'grid',
250
+ gridTemplateColumns: 'repeat(2, 200px)',
251
+ gap: '20px 32px',
252
+ }}
253
+ >
254
+ {EASINGS.map(({ token }) => (
255
+ <div
256
+ key={token}
257
+ style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}
258
+ >
259
+ <div
260
+ style={{
261
+ overflow: 'hidden',
262
+ borderRadius: '8px',
263
+ padding: '8px',
264
+ background: 'rgba(0,0,0,0.03)',
265
+ }}
266
+ >
267
+ <div
268
+ className={`${easingBox[token]} ${easingBoxHover[token]}`}
269
+ style={{
270
+ width: '72px',
271
+ height: '52px',
272
+ borderRadius: '6px',
273
+ border: '1px solid',
274
+ flexShrink: 0,
275
+ }}
276
+ title={`transitionTimingFunction: ${token}`}
277
+ />
278
+ </div>
279
+ <span
280
+ style={{
281
+ fontSize: '11px',
282
+ fontFamily: 'monospace',
283
+ color: '#444',
284
+ lineHeight: 1.3,
285
+ }}
286
+ >
287
+ {token}
288
+ </span>
289
+ </div>
290
+ ))}
291
+ </div>
292
+ <p
293
+ style={{
294
+ fontSize: '12px',
295
+ color: '#888',
296
+ fontFamily: 'Inter, system-ui, sans-serif',
297
+ margin: 0,
298
+ }}
299
+ >
300
+ All demos use{' '}
301
+ <code style={{ fontFamily: 'monospace' }}>normal (200ms)</code>. Hover
302
+ each box to compare easing curves.
303
+ </p>
304
+ </div>
305
+ ),
306
+ };
@@ -0,0 +1,159 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { css } from 'styled-system/css';
3
+
4
+ const meta = {
5
+ title: 'Foundations/Shape',
6
+ parameters: { layout: 'padded' },
7
+ } satisfies Meta;
8
+
9
+ export default meta;
10
+ type Story = StoryObj<typeof meta>;
11
+
12
+ // ── Pre-declared css() calls — Panda CSS statically extracts these ─────────────
13
+ // (dynamic template literals cannot be extracted; explicit literals are required)
14
+
15
+ const radiusBox: Record<string, string> = {
16
+ none: css({
17
+ borderRadius: 'none',
18
+ bg: 'primary.subtle.bg',
19
+ borderColor: 'primary.outline.border',
20
+ }),
21
+ extraSmall: css({
22
+ borderRadius: 'extraSmall',
23
+ bg: 'primary.subtle.bg',
24
+ borderColor: 'primary.outline.border',
25
+ }),
26
+ small: css({
27
+ borderRadius: 'small',
28
+ bg: 'primary.subtle.bg',
29
+ borderColor: 'primary.outline.border',
30
+ }),
31
+ medium: css({
32
+ borderRadius: 'medium',
33
+ bg: 'primary.subtle.bg',
34
+ borderColor: 'primary.outline.border',
35
+ }),
36
+ large: css({
37
+ borderRadius: 'large',
38
+ bg: 'primary.subtle.bg',
39
+ borderColor: 'primary.outline.border',
40
+ }),
41
+ extraLarge: css({
42
+ borderRadius: 'extraLarge',
43
+ bg: 'primary.subtle.bg',
44
+ borderColor: 'primary.outline.border',
45
+ }),
46
+ full: css({
47
+ borderRadius: 'full',
48
+ bg: 'primary.subtle.bg',
49
+ borderColor: 'primary.outline.border',
50
+ }),
51
+ };
52
+
53
+ // ── Data ────────────────────────────────────────────────────────────────────────
54
+
55
+ const RADII: { token: string; value: string; wide?: boolean }[] = [
56
+ { token: 'none', value: '0px' },
57
+ { token: 'extraSmall', value: '4px' },
58
+ { token: 'small', value: '8px' },
59
+ { token: 'medium', value: '12px' },
60
+ { token: 'large', value: '16px' },
61
+ { token: 'extraLarge', value: '28px' },
62
+ { token: 'full', value: '9999px', wide: true },
63
+ ];
64
+
65
+ // ── Shared helpers ──────────────────────────────────────────────────────────────
66
+
67
+ function SectionHeading({
68
+ title,
69
+ description,
70
+ }: {
71
+ title: string;
72
+ description: string;
73
+ }) {
74
+ return (
75
+ <div style={{ marginBottom: '24px' }}>
76
+ <h2
77
+ style={{
78
+ fontSize: '18px',
79
+ fontWeight: '600',
80
+ margin: '0 0 8px',
81
+ fontFamily: 'Inter, system-ui, sans-serif',
82
+ }}
83
+ >
84
+ {title}
85
+ </h2>
86
+ <p
87
+ style={{ fontSize: '14px', color: '#666', margin: 0, lineHeight: 1.5 }}
88
+ >
89
+ {description}
90
+ </p>
91
+ </div>
92
+ );
93
+ }
94
+
95
+ // ── Story 1: Radii Tokens ──────────────────────────────────────────────────────
96
+
97
+ export const RadiiTokens: Story = {
98
+ name: '1 · Border Radius Tokens',
99
+ render: () => (
100
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
101
+ <SectionHeading
102
+ title="Border Radius Tokens"
103
+ description="Seven radii tokens from sharp corners to fully circular. Use these in recipes via borderRadius token names — never raw pixel values."
104
+ />
105
+ <div
106
+ style={{
107
+ display: 'flex',
108
+ gap: '16px',
109
+ flexWrap: 'wrap',
110
+ alignItems: 'flex-start',
111
+ }}
112
+ >
113
+ {RADII.map(({ token, value, wide }) => (
114
+ <div
115
+ key={token}
116
+ style={{
117
+ display: 'flex',
118
+ flexDirection: 'column',
119
+ alignItems: 'center',
120
+ gap: '8px',
121
+ }}
122
+ >
123
+ <div
124
+ className={radiusBox[token]}
125
+ style={{
126
+ width: wide ? '120px' : '72px',
127
+ height: wide ? '52px' : '72px',
128
+ border: '1px solid',
129
+ flexShrink: 0,
130
+ }}
131
+ title={`borderRadius: ${token}`}
132
+ />
133
+ <span
134
+ style={{
135
+ fontSize: '11px',
136
+ fontFamily: 'monospace',
137
+ color: '#444',
138
+ textAlign: 'center',
139
+ lineHeight: 1.3,
140
+ }}
141
+ >
142
+ {token}
143
+ </span>
144
+ <span
145
+ style={{
146
+ fontSize: '10px',
147
+ fontFamily: 'monospace',
148
+ color: '#888',
149
+ textAlign: 'center',
150
+ }}
151
+ >
152
+ {value}
153
+ </span>
154
+ </div>
155
+ ))}
156
+ </div>
157
+ </div>
158
+ ),
159
+ };
@@ -1,6 +1,5 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import { SpacingBox } from './components/SpacingBox';
3
- import { material3Language } from '../../languages/material3.language';
4
3
 
5
4
  <Meta title="Foundations/Spacing" />
6
5
 
@@ -13,15 +12,15 @@ The Discourser Design System uses a consistent spacing scale based on an 8-point
13
12
  Our spacing scale ranges from `none` (0px) to `xxxl` (64px), with incremental steps that follow a logical progression.
14
13
 
15
14
  <div style={{ marginTop: '32px', marginBottom: '48px' }}>
16
- <SpacingBox name="none" value={material3Language.spacing.none} />
17
- <SpacingBox name="xxs" value={material3Language.spacing.xxs} />
18
- <SpacingBox name="xs" value={material3Language.spacing.xs} />
19
- <SpacingBox name="sm" value={material3Language.spacing.sm} />
20
- <SpacingBox name="md" value={material3Language.spacing.md} />
21
- <SpacingBox name="lg" value={material3Language.spacing.lg} />
22
- <SpacingBox name="xl" value={material3Language.spacing.xl} />
23
- <SpacingBox name="xxl" value={material3Language.spacing.xxl} />
24
- <SpacingBox name="xxxl" value={material3Language.spacing.xxxl} />
15
+ <SpacingBox name="none" value="0px" />
16
+ <SpacingBox name="xxs" value="2px" />
17
+ <SpacingBox name="xs" value="4px" />
18
+ <SpacingBox name="sm" value="8px" />
19
+ <SpacingBox name="md" value="16px" />
20
+ <SpacingBox name="lg" value="24px" />
21
+ <SpacingBox name="xl" value="32px" />
22
+ <SpacingBox name="xxl" value="48px" />
23
+ <SpacingBox name="xxxl" value="64px" />
25
24
  </div>
26
25
 
27
26
  ---
@@ -30,15 +29,15 @@ Our spacing scale ranges from `none` (0px) to `xxxl` (64px), with incremental st
30
29
 
31
30
  | Token | Value | Pixels | Use Case |
32
31
  |-------|-------|--------|----------|
33
- | `none` | {material3Language.spacing.none} | 0px | Reset spacing, remove gaps |
34
- | `xxs` | {material3Language.spacing.xxs} | 2px | Minimal gaps, fine-tuning |
35
- | `xs` | {material3Language.spacing.xs} | 4px | Tight spacing within components |
36
- | `sm` | {material3Language.spacing.sm} | 8px | Component internal spacing |
37
- | `md` | {material3Language.spacing.md} | 16px | Default spacing, component gaps |
38
- | `lg` | {material3Language.spacing.lg} | 24px | Section spacing, card padding |
39
- | `xl` | {material3Language.spacing.xl} | 32px | Large section breaks |
40
- | `xxl` | {material3Language.spacing.xxl} | 48px | Major section dividers |
41
- | `xxxl` | {material3Language.spacing.xxxl} | 64px | Page-level spacing |
32
+ | `none` | 0px | 0px | Reset spacing, remove gaps |
33
+ | `xxs` | 2px | 2px | Minimal gaps, fine-tuning |
34
+ | `xs` | 4px | 4px | Tight spacing within components |
35
+ | `sm` | 8px | 8px | Component internal spacing |
36
+ | `md` | 16px | 16px | Default spacing, component gaps |
37
+ | `lg` | 24px | 24px | Section spacing, card padding |
38
+ | `xl` | 32px | 32px | Large section breaks |
39
+ | `xxl` | 48px | 48px | Major section dividers |
40
+ | `xxxl` | 64px | 64px | Page-level spacing |
42
41
 
43
42
  ---
44
43
 
@@ -162,8 +161,8 @@ const flexStyle = css({
162
161
  <div style={{
163
162
  display: 'flex',
164
163
  flexDirection: 'column',
165
- gap: material3Language.spacing.sm,
166
- padding: material3Language.spacing.md,
164
+ gap: '8px',
165
+ padding: '16px',
167
166
  backgroundColor: '#f5f5f5',
168
167
  borderRadius: '8px',
169
168
  marginBottom: '24px'
@@ -184,8 +183,8 @@ const flexStyle = css({
184
183
  <div style={{
185
184
  display: 'flex',
186
185
  flexDirection: 'column',
187
- gap: material3Language.spacing.md,
188
- padding: material3Language.spacing.lg,
186
+ gap: '16px',
187
+ padding: '24px',
189
188
  backgroundColor: '#f5f5f5',
190
189
  borderRadius: '8px',
191
190
  marginBottom: '24px'
@@ -206,8 +205,8 @@ const flexStyle = css({
206
205
  <div style={{
207
206
  display: 'flex',
208
207
  flexDirection: 'column',
209
- gap: material3Language.spacing.lg,
210
- padding: material3Language.spacing.xl,
208
+ gap: '24px',
209
+ padding: '32px',
211
210
  backgroundColor: '#f5f5f5',
212
211
  borderRadius: '8px'
213
212
  }}>