@discourser/design-system 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{chunk-BQAXPMOR.js → chunk-F7LHARS4.js} +2 -2
  2. package/dist/{chunk-BQAXPMOR.js.map → chunk-F7LHARS4.js.map} +1 -1
  3. package/dist/{chunk-ZNAYN5UV.js → chunk-M7J7WKJY.js} +178 -242
  4. package/dist/chunk-M7J7WKJY.js.map +1 -0
  5. package/dist/{chunk-XSX6TKJZ.cjs → chunk-QC44JPCA.cjs} +178 -242
  6. package/dist/chunk-QC44JPCA.cjs.map +1 -0
  7. package/dist/{chunk-MIBEMJNS.cjs → chunk-QP4EJI3G.cjs} +2 -2
  8. package/dist/{chunk-MIBEMJNS.cjs.map → chunk-QP4EJI3G.cjs.map} +1 -1
  9. package/dist/components/Badge.d.ts +1 -1
  10. package/dist/components/Badge.d.ts.map +1 -1
  11. package/dist/components/Checkbox.d.ts +2 -2
  12. package/dist/components/index.cjs +33 -33
  13. package/dist/components/index.js +1 -1
  14. package/dist/index.cjs +37 -37
  15. package/dist/index.js +2 -2
  16. package/dist/preset/colors/create-palette-bridge.d.ts +45 -0
  17. package/dist/preset/colors/create-palette-bridge.d.ts.map +1 -0
  18. package/dist/preset/colors/index.d.ts +13 -926
  19. package/dist/preset/colors/index.d.ts.map +1 -1
  20. package/dist/preset/colors/m3-error.d.ts +4 -306
  21. package/dist/preset/colors/m3-error.d.ts.map +1 -1
  22. package/dist/preset/colors/m3-primary.d.ts +1 -306
  23. package/dist/preset/colors/m3-primary.d.ts.map +1 -1
  24. package/dist/preset/colors/m3-secondary.d.ts +7 -0
  25. package/dist/preset/colors/m3-secondary.d.ts.map +1 -0
  26. package/dist/preset/colors/m3-tertiary.d.ts +7 -0
  27. package/dist/preset/colors/m3-tertiary.d.ts.map +1 -0
  28. package/dist/preset/index.cjs +2 -2
  29. package/dist/preset/index.d.ts.map +1 -1
  30. package/dist/preset/index.js +1 -1
  31. package/dist/preset/recipes/radio-group.d.ts.map +1 -1
  32. package/dist/preset/semantic-tokens.d.ts +4 -4
  33. package/dist/preset/shadows.d.ts +12 -26
  34. package/dist/preset/shadows.d.ts.map +1 -1
  35. package/package.json +8 -7
  36. package/src/components/Badge.tsx +1 -1
  37. package/src/languages/__tests__/transform.test.ts +100 -0
  38. package/src/preset/__tests__/shadows.test.ts +83 -0
  39. package/src/preset/__tests__/token-resolution.test.ts +247 -0
  40. package/src/preset/colors/create-palette-bridge.ts +156 -0
  41. package/src/preset/colors/index.ts +4 -0
  42. package/src/preset/colors/m3-error.ts +12 -77
  43. package/src/preset/colors/m3-primary.ts +5 -90
  44. package/src/preset/colors/m3-secondary.ts +13 -0
  45. package/src/preset/colors/m3-tertiary.ts +13 -0
  46. package/src/preset/index.ts +1 -6
  47. package/src/preset/recipes/__tests__/recipe-shadows.test.ts +238 -0
  48. package/src/preset/recipes/button.ts +3 -3
  49. package/src/preset/recipes/radio-group.ts +12 -11
  50. package/src/preset/semantic-tokens.ts +6 -6
  51. package/src/preset/shadows.ts +12 -26
  52. package/src/stories/foundations/Colors.mdx +1 -1
  53. package/src/stories/foundations/Elevation.mdx +37 -8
  54. package/src/stories/foundations/Spacing.mdx +1 -1
  55. package/src/stories/foundations/Typography.mdx +1 -1
  56. package/dist/chunk-XSX6TKJZ.cjs.map +0 -1
  57. package/dist/chunk-ZNAYN5UV.js.map +0 -1
@@ -17,8 +17,6 @@ export const radioGroup = defineSlotRecipe({
17
17
  flexShrink: 0,
18
18
  justifyContent: 'center',
19
19
  verticalAlign: 'top',
20
- boxShadow: 'inset 0 0 0 1px var(--shadow-color)',
21
- boxShadowColor: 'gray.surface.border',
22
20
  _after: {
23
21
  content: '""',
24
22
  display: 'block',
@@ -28,14 +26,6 @@ export const radioGroup = defineSlotRecipe({
28
26
  _focusVisible: {
29
27
  focusVisibleRing: 'outside',
30
28
  },
31
- _checked: {
32
- bg: 'colorPalette.solid.bg',
33
- color: 'colorPalette.solid.fg',
34
- boxShadowColor: 'colorPalette.solid.bg',
35
- _after: {
36
- background: 'colorPalette.solid.fg',
37
- },
38
- },
39
29
  },
40
30
  item: {
41
31
  alignItems: 'center',
@@ -63,7 +53,18 @@ export const radioGroup = defineSlotRecipe({
63
53
  variants: {
64
54
  variant: {
65
55
  solid: {
66
- itemControl: {},
56
+ itemControl: {
57
+ boxShadow: 'inset 0 0 0 1px var(--shadow-color)',
58
+ boxShadowColor: 'gray.surface.border',
59
+ _checked: {
60
+ bg: 'colorPalette.solid.bg',
61
+ color: 'colorPalette.solid.fg',
62
+ boxShadowColor: 'colorPalette.solid.bg',
63
+ _after: {
64
+ background: 'colorPalette.solid.fg',
65
+ },
66
+ },
67
+ },
67
68
  },
68
69
  },
69
70
  size: {
@@ -39,22 +39,22 @@ export const m3SemanticTokens = defineSemanticTokens.colors({
39
39
  container: { value: { base: semantic.onPrimaryContainer, _dark: semanticDark.onPrimaryContainer } },
40
40
  },
41
41
 
42
- // M3 Secondary
43
- secondary: {
42
+ // M3 Secondary (prefixed to avoid conflict with Park UI Radix-scale bridge)
43
+ m3Secondary: {
44
44
  DEFAULT: { value: { base: semantic.secondary, _dark: semanticDark.secondary } },
45
45
  container: { value: { base: semantic.secondaryContainer, _dark: semanticDark.secondaryContainer } },
46
46
  },
47
- onSecondary: {
47
+ onM3Secondary: {
48
48
  DEFAULT: { value: { base: semantic.onSecondary, _dark: semanticDark.onSecondary } },
49
49
  container: { value: { base: semantic.onSecondaryContainer, _dark: semanticDark.onSecondaryContainer } },
50
50
  },
51
51
 
52
- // M3 Tertiary
53
- tertiary: {
52
+ // M3 Tertiary (prefixed to avoid conflict with Park UI Radix-scale bridge)
53
+ m3Tertiary: {
54
54
  DEFAULT: { value: { base: semantic.tertiary, _dark: semanticDark.tertiary } },
55
55
  container: { value: { base: semantic.tertiaryContainer, _dark: semanticDark.tertiaryContainer } },
56
56
  },
57
- onTertiary: {
57
+ onM3Tertiary: {
58
58
  DEFAULT: { value: { base: semantic.onTertiary, _dark: semanticDark.onTertiary } },
59
59
  container: { value: { base: semantic.onTertiaryContainer, _dark: semanticDark.onTertiaryContainer } },
60
60
  },
@@ -1,45 +1,31 @@
1
1
  import { defineSemanticTokens } from '@pandacss/dev';
2
2
 
3
3
  /**
4
- * Shadow semantic tokens from Park UI
5
- * Adjusted to use 'base' instead of '_light' and neutral.a* instead of black.a*
4
+ * Shadow semantic tokens - chained to M3 base elevation tokens
5
+ *
6
+ * Three-layer architecture:
7
+ * 1. Base tokens (level0-5): M3 elevation values defined in transform.ts
8
+ * 2. Semantic tokens (xs-2xl): Reference base tokens for consistency
9
+ * 3. Components: Use semantic tokens for flexibility
6
10
  */
7
11
  export const shadows = defineSemanticTokens.shadows({
8
12
  xs: {
9
- value: {
10
- base: '0px 1px 2px {colors.neutral.a6}, 0px 0px 1px {colors.neutral.a7}',
11
- _dark: '0px 1px 1px {colors.neutral.a8}, 0px 0px 1px inset {colors.neutral.a8}',
12
- },
13
+ value: '{shadows.level1}',
13
14
  },
14
15
  sm: {
15
- value: {
16
- base: '0px 2px 4px {colors.neutral.a4}, 0px 0px 1px {colors.neutral.a4}',
17
- _dark: '0px 2px 4px {colors.neutral.a8}, 0px 0px 1px inset {colors.neutral.a8}',
18
- },
16
+ value: '{shadows.level2}',
19
17
  },
20
18
  md: {
21
- value: {
22
- base: '0px 4px 8px {colors.neutral.a4}, 0px 0px 1px {colors.neutral.a4}',
23
- _dark: '0px 4px 8px {colors.neutral.a8}, 0px 0px 1px inset {colors.neutral.a8}',
24
- },
19
+ value: '{shadows.level3}',
25
20
  },
26
21
  lg: {
27
- value: {
28
- base: '0px 8px 16px {colors.neutral.a4}, 0px 0px 1px {colors.neutral.a4}',
29
- _dark: '0px 8px 16px {colors.neutral.a8}, 0px 0px 1px inset {colors.neutral.a8}',
30
- },
22
+ value: '{shadows.level4}',
31
23
  },
32
24
  xl: {
33
- value: {
34
- base: '0px 16px 24px {colors.neutral.a4}, 0px 0px 1px {colors.neutral.a4}',
35
- _dark: '0px 16px 24px {colors.neutral.a8}, 0px 0px 1px inset {colors.neutral.a8}',
36
- },
25
+ value: '{shadows.level5}',
37
26
  },
38
27
  '2xl': {
39
- value: {
40
- base: '0px 24px 40px {colors.neutral.a4}, 0px 0px 1px {colors.neutral.a4}',
41
- _dark: '0px 24px 40px {colors.neutral.a8}, 0px 0px 1px inset {colors.neutral.a8}',
42
- },
28
+ value: '{shadows.level5}',
43
29
  },
44
30
  inset: {
45
31
  value: {
@@ -1,4 +1,4 @@
1
- import { Meta } from '@storybook/blocks';
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import { ColorSwatch, TonalSwatch, SemanticSwatch } from './components/ColorSwatch';
3
3
  import { material3Language } from '../../languages/material3.language';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Meta } from '@storybook/blocks';
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import { ElevationGrid } from './components/ElevationCard';
3
3
  import { material3Language } from '../../languages/material3.language';
4
4
 
@@ -8,6 +8,35 @@ import { material3Language } from '../../languages/material3.language';
8
8
 
9
9
  Elevation in Material Design 3 creates depth and hierarchy through the use of shadows. The Discourser Design System provides 6 elevation levels, from no elevation to the highest prominence.
10
10
 
11
+ ## Token Architecture
12
+
13
+ The elevation system uses a **three-layer architecture** for flexibility and consistency:
14
+
15
+ ### Layer 1: Base Tokens (Material 3 Values)
16
+ The foundation layer contains actual M3 elevation values:
17
+ - `level0` through `level5` — Registered via `transform.ts`
18
+ - Contains raw shadow CSS values from Material Design 3 spec
19
+ - **Do not use directly in components**
20
+
21
+ ### Layer 2: Semantic Tokens (Design Intent)
22
+ The middle layer maps design intent to base tokens:
23
+ - `xs`, `sm`, `md`, `lg`, `xl`, `2xl` — Defined in `src/preset/shadows.ts`
24
+ - Each semantic token references a base token (e.g., `sm` → `{shadows.level2}`)
25
+ - Provides meaningful names that express elevation purpose
26
+
27
+ ### Layer 3: Component Usage
28
+ Components use semantic tokens for flexibility:
29
+ ```tsx
30
+ // ✅ Use semantic tokens in components
31
+ boxShadow: 'sm'
32
+ boxShadow: 'md'
33
+
34
+ // ❌ Don't use base tokens directly
35
+ boxShadow: 'level2'
36
+ ```
37
+
38
+ This architecture allows the design language to be swapped by changing which base tokens the semantic layer references, without touching component code.
39
+
11
40
  ## Elevation Scale
12
41
 
13
42
  <ElevationGrid elevations={material3Language.elevation.levels} />
@@ -76,10 +105,10 @@ Use elevation changes to indicate interactivity:
76
105
  import { css } from 'styled-system/css';
77
106
 
78
107
  const interactiveCardStyle = css({
79
- boxShadow: 'level1',
108
+ boxShadow: 'xs',
80
109
  transition: 'box-shadow 200ms',
81
110
  _hover: {
82
- boxShadow: 'level2'
111
+ boxShadow: 'sm'
83
112
  }
84
113
  });
85
114
  ```
@@ -202,7 +231,7 @@ Elevation works differently in dark themes:
202
231
  import { css } from 'styled-system/css';
203
232
 
204
233
  const cardStyle = css({
205
- boxShadow: 'level1',
234
+ boxShadow: 'xs',
206
235
  borderRadius: 'medium',
207
236
  padding: 'lg'
208
237
  });
@@ -214,14 +243,14 @@ const cardStyle = css({
214
243
  import { css } from 'styled-system/css';
215
244
 
216
245
  const elevatedButtonStyle = css({
217
- boxShadow: 'level2',
246
+ boxShadow: 'sm',
218
247
  transition: 'all',
219
248
  transitionDuration: 'fast',
220
249
  _hover: {
221
- boxShadow: 'level3'
250
+ boxShadow: 'md'
222
251
  },
223
252
  _active: {
224
- boxShadow: 'level1'
253
+ boxShadow: 'xs'
225
254
  }
226
255
  });
227
256
  ```
@@ -236,7 +265,7 @@ const modalStyle = css({
236
265
  top: '50%',
237
266
  left: '50%',
238
267
  transform: 'translate(-50%, -50%)',
239
- boxShadow: 'level3',
268
+ boxShadow: 'md',
240
269
  borderRadius: 'large',
241
270
  backgroundColor: 'surface',
242
271
  padding: 'xl'
@@ -1,4 +1,4 @@
1
- import { Meta } from '@storybook/blocks';
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import { SpacingBox } from './components/SpacingBox';
3
3
  import { material3Language } from '../../languages/material3.language';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Meta } from '@storybook/blocks';
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import { TypeSpecimen } from './components/TypeSpecimen';
3
3
  import { material3Language } from '../../languages/material3.language';
4
4