@discourser/design-system 0.20.0 → 0.21.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 (42) hide show
  1. package/dist/{chunk-SNUJBT5R.js → chunk-3HS2YGGX.js} +213 -83
  2. package/dist/chunk-3HS2YGGX.js.map +1 -0
  3. package/dist/{chunk-52D45DUF.js → chunk-NU6GI57K.js} +25 -13
  4. package/dist/chunk-NU6GI57K.js.map +1 -0
  5. package/dist/{chunk-PFWU7QSM.cjs → chunk-OZBQAALG.cjs} +213 -83
  6. package/dist/chunk-OZBQAALG.cjs.map +1 -0
  7. package/dist/{chunk-4QASRPVX.cjs → chunk-WSJLKVXZ.cjs} +25 -13
  8. package/dist/chunk-WSJLKVXZ.cjs.map +1 -0
  9. package/dist/components/Breadcrumb.d.ts +8 -3
  10. package/dist/components/Breadcrumb.d.ts.map +1 -1
  11. package/dist/components/Checkbox.d.ts +3 -3
  12. package/dist/components/Icons/TrashIcon.d.ts +6 -0
  13. package/dist/components/Icons/TrashIcon.d.ts.map +1 -0
  14. package/dist/components/Icons/index.d.ts +1 -0
  15. package/dist/components/Icons/index.d.ts.map +1 -1
  16. package/dist/components/index.cjs +69 -69
  17. package/dist/components/index.js +1 -1
  18. package/dist/figma-codex.json +2 -7
  19. package/dist/index.cjs +73 -73
  20. package/dist/index.js +2 -2
  21. package/dist/languages/transform.d.ts +1 -8
  22. package/dist/languages/transform.d.ts.map +1 -1
  23. package/dist/preset/index.cjs +2 -2
  24. package/dist/preset/index.d.ts.map +1 -1
  25. package/dist/preset/index.js +1 -1
  26. package/dist/preset/recipes/breadcrumb.d.ts.map +1 -1
  27. package/dist/preset/semantic-tokens.d.ts +186 -45
  28. package/dist/preset/semantic-tokens.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/__tests__/token-contract.test.ts +168 -0
  31. package/src/components/Breadcrumb.tsx +39 -13
  32. package/src/components/Icons/TrashIcon.tsx +34 -0
  33. package/src/components/Icons/index.ts +1 -0
  34. package/src/components/__tests__/Breadcrumb.test.tsx +82 -0
  35. package/src/languages/transform.ts +74 -52
  36. package/src/preset/index.ts +15 -3
  37. package/src/preset/recipes/breadcrumb.ts +22 -0
  38. package/src/preset/semantic-tokens.ts +164 -53
  39. package/dist/chunk-4QASRPVX.cjs.map +0 -1
  40. package/dist/chunk-52D45DUF.js.map +0 -1
  41. package/dist/chunk-PFWU7QSM.cjs.map +0 -1
  42. package/dist/chunk-SNUJBT5R.js.map +0 -1
@@ -351,45 +351,55 @@ var material3Language = {
351
351
  function transformToPandaTheme(language) {
352
352
  return {
353
353
  tokens: transformTokens(language),
354
- semanticTokens: transformSemanticTokens(language),
354
+ semanticTokens: transformSemanticTokens(),
355
355
  textStyles: transformTextStyles(language)
356
356
  };
357
357
  }
358
358
  function transformTokens(language) {
359
359
  return {
360
- colors: transformColorPalettes(language.colors),
360
+ colors: transformColorPalettes(
361
+ language.colors
362
+ ),
361
363
  fonts: {
362
364
  display: { value: language.typography.fonts.display },
363
365
  body: { value: language.typography.fonts.body },
364
366
  mono: { value: language.typography.fonts.mono }
365
367
  },
366
- fontSizes: extractFontSizes(language.typography.scale),
367
- lineHeights: extractLineHeights(language.typography.scale),
368
- fontWeights: extractFontWeights(language.typography.scale),
369
- letterSpacings: extractLetterSpacings(language.typography.scale),
370
- spacing: objectToTokens(language.spacing),
371
- radii: objectToTokens(language.shape.radii),
372
- shadows: objectToTokens(language.elevation.levels),
373
- durations: objectToTokens(language.motion.durations),
374
- easings: objectToTokens(language.motion.easings),
375
- borderWidths: objectToTokens(language.border.widths)
368
+ fontSizes: extractFontSizes(
369
+ language.typography.scale
370
+ ),
371
+ lineHeights: extractLineHeights(
372
+ language.typography.scale
373
+ ),
374
+ fontWeights: extractFontWeights(
375
+ language.typography.scale
376
+ ),
377
+ letterSpacings: extractLetterSpacings(
378
+ language.typography.scale
379
+ ),
380
+ spacing: objectToTokens(
381
+ language.spacing
382
+ ),
383
+ radii: objectToTokens(
384
+ language.shape.radii
385
+ ),
386
+ shadows: objectToTokens(
387
+ language.elevation.levels
388
+ ),
389
+ durations: objectToTokens(
390
+ language.motion.durations
391
+ ),
392
+ easings: objectToTokens(
393
+ language.motion.easings
394
+ ),
395
+ borderWidths: objectToTokens(
396
+ language.border.widths
397
+ )
376
398
  };
377
399
  }
378
- function transformSemanticTokens(language) {
379
- const light = language.semantic;
380
- const dark = language.semanticDark || light;
400
+ function transformSemanticTokens(_language) {
381
401
  return {
382
- colors: Object.fromEntries(
383
- Object.entries(light).map(([key, lightValue]) => [
384
- key,
385
- {
386
- value: {
387
- base: lightValue,
388
- _dark: dark[key] || lightValue
389
- }
390
- }
391
- ])
392
- )
402
+ colors: {}
393
403
  };
394
404
  }
395
405
  function transformTextStyles(language) {
@@ -414,10 +424,7 @@ function transformColorPalettes(palettes) {
414
424
  Object.entries(palettes).map(([name, palette]) => [
415
425
  name,
416
426
  Object.fromEntries(
417
- Object.entries(palette).map(([tone, value]) => [
418
- tone,
419
- { value }
420
- ])
427
+ Object.entries(palette).map(([tone, value]) => [tone, { value }])
421
428
  )
422
429
  ])
423
430
  );
@@ -449,10 +456,7 @@ function extractFontWeights(scale) {
449
456
  weights.set(style.fontWeight, style.fontWeight);
450
457
  });
451
458
  return Object.fromEntries(
452
- Array.from(weights.entries()).map(([key, value]) => [
453
- key,
454
- { value }
455
- ])
459
+ Array.from(weights.entries()).map(([key, value]) => [key, { value }])
456
460
  );
457
461
  }
458
462
  function extractLetterSpacings(scale) {
@@ -712,68 +716,162 @@ var colors = {
712
716
  // Map red to error for Park UI compatibility
713
717
  red: error
714
718
  };
715
- var semantic = material3Language.semantic;
716
- var semanticDark = material3Language.semanticDark;
717
- var m3SemanticTokens = defineSemanticTokens.colors({
718
- // M3 Surface System
719
+ var s = material3Language.semantic;
720
+ var d = material3Language.semanticDark;
721
+ var semanticColorTokens = defineSemanticTokens.colors({
722
+ // Primary
723
+ primary: {
724
+ DEFAULT: { value: { base: s.primary, _dark: d.primary } },
725
+ container: {
726
+ value: { base: s.primaryContainer, _dark: d.primaryContainer }
727
+ }
728
+ },
729
+ onPrimary: {
730
+ DEFAULT: { value: { base: s.onPrimary, _dark: d.onPrimary } },
731
+ container: {
732
+ value: { base: s.onPrimaryContainer, _dark: d.onPrimaryContainer }
733
+ }
734
+ },
735
+ // Secondary
736
+ secondary: {
737
+ DEFAULT: { value: { base: s.secondary, _dark: d.secondary } },
738
+ container: {
739
+ value: { base: s.secondaryContainer, _dark: d.secondaryContainer }
740
+ }
741
+ },
742
+ onSecondary: {
743
+ DEFAULT: { value: { base: s.onSecondary, _dark: d.onSecondary } },
744
+ container: {
745
+ value: { base: s.onSecondaryContainer, _dark: d.onSecondaryContainer }
746
+ }
747
+ },
748
+ // Tertiary
749
+ tertiary: {
750
+ DEFAULT: { value: { base: s.tertiary, _dark: d.tertiary } },
751
+ container: {
752
+ value: { base: s.tertiaryContainer, _dark: d.tertiaryContainer }
753
+ }
754
+ },
755
+ onTertiary: {
756
+ DEFAULT: { value: { base: s.onTertiary, _dark: d.onTertiary } },
757
+ container: {
758
+ value: { base: s.onTertiaryContainer, _dark: d.onTertiaryContainer }
759
+ }
760
+ },
761
+ // Error
762
+ error: {
763
+ DEFAULT: { value: { base: s.error, _dark: d.error } },
764
+ container: { value: { base: s.errorContainer, _dark: d.errorContainer } }
765
+ },
766
+ onError: {
767
+ DEFAULT: { value: { base: s.onError, _dark: d.onError } },
768
+ container: {
769
+ value: { base: s.onErrorContainer, _dark: d.onErrorContainer }
770
+ }
771
+ },
772
+ // Surface system
719
773
  surface: {
720
- DEFAULT: { value: { base: semantic.surface, _dark: semanticDark.surface } },
721
- dim: { value: { base: semantic.surfaceContainerLow, _dark: semanticDark.surfaceContainerLow } },
722
- bright: { value: { base: semantic.surfaceContainerHigh, _dark: semanticDark.surfaceContainerHigh } },
774
+ DEFAULT: { value: { base: s.surface, _dark: d.surface } },
775
+ dim: {
776
+ value: { base: s.surfaceContainerLow, _dark: d.surfaceContainerLow }
777
+ },
778
+ bright: {
779
+ value: { base: s.surfaceContainerHigh, _dark: d.surfaceContainerHigh }
780
+ },
723
781
  container: {
724
- DEFAULT: { value: { base: semantic.surfaceContainer, _dark: semanticDark.surfaceContainer } },
725
- low: { value: { base: semantic.surfaceContainerLow, _dark: semanticDark.surfaceContainerLow } },
726
- lowest: { value: { base: semantic.surfaceContainerLowest, _dark: semanticDark.surfaceContainerLowest } },
727
- high: { value: { base: semantic.surfaceContainerHigh, _dark: semanticDark.surfaceContainerHigh } },
728
- highest: { value: { base: semantic.surfaceContainerHighest, _dark: semanticDark.surfaceContainerHighest } }
782
+ DEFAULT: {
783
+ value: { base: s.surfaceContainer, _dark: d.surfaceContainer }
784
+ },
785
+ low: {
786
+ value: { base: s.surfaceContainerLow, _dark: d.surfaceContainerLow }
787
+ },
788
+ lowest: {
789
+ value: {
790
+ base: s.surfaceContainerLowest,
791
+ _dark: d.surfaceContainerLowest
792
+ }
793
+ },
794
+ high: {
795
+ value: { base: s.surfaceContainerHigh, _dark: d.surfaceContainerHigh }
796
+ },
797
+ highest: {
798
+ value: {
799
+ base: s.surfaceContainerHighest,
800
+ _dark: d.surfaceContainerHighest
801
+ }
802
+ }
729
803
  }
730
804
  },
731
805
  onSurface: {
732
- DEFAULT: { value: { base: semantic.onSurface, _dark: semanticDark.onSurface } },
733
- variant: { value: { base: semantic.onSurfaceVariant, _dark: semanticDark.onSurfaceVariant } }
806
+ DEFAULT: { value: { base: s.onSurface, _dark: d.onSurface } },
807
+ variant: { value: { base: s.onSurfaceVariant, _dark: d.onSurfaceVariant } }
808
+ },
809
+ surfaceVariant: {
810
+ value: { base: s.surfaceVariant, _dark: d.surfaceVariant }
734
811
  },
735
- // M3 Primary tokens (for explicit M3 usage)
812
+ // Background
813
+ background: { value: { base: s.background, _dark: d.background } },
814
+ onBackground: { value: { base: s.onBackground, _dark: d.onBackground } },
815
+ // Outline
816
+ outline: {
817
+ DEFAULT: { value: { base: s.outline, _dark: d.outline } },
818
+ variant: { value: { base: s.outlineVariant, _dark: d.outlineVariant } }
819
+ },
820
+ // Inverse
821
+ inverseSurface: {
822
+ value: { base: s.inverseSurface, _dark: d.inverseSurface }
823
+ },
824
+ inverseOnSurface: {
825
+ value: { base: s.inverseOnSurface, _dark: d.inverseOnSurface }
826
+ },
827
+ inversePrimary: {
828
+ value: { base: s.inversePrimary, _dark: d.inversePrimary }
829
+ },
830
+ // Not standard M3 tokens, but follow inversePrimary's pattern:
831
+ // light mode = dark-palette value, dark mode = light-palette value.
832
+ inverseSecondary: { value: { base: d.secondary, _dark: s.secondary } },
833
+ inverseTertiary: { value: { base: d.tertiary, _dark: s.tertiary } },
834
+ // Utility
835
+ scrim: { value: { base: s.scrim, _dark: d.scrim } },
836
+ shadow: { value: { base: s.shadow, _dark: d.shadow } }
837
+ });
838
+ var m3SemanticTokens = defineSemanticTokens.colors({
736
839
  m3Primary: {
737
- DEFAULT: { value: { base: semantic.primary, _dark: semanticDark.primary } },
738
- container: { value: { base: semantic.primaryContainer, _dark: semanticDark.primaryContainer } }
840
+ DEFAULT: { value: { base: s.primary, _dark: d.primary } },
841
+ container: {
842
+ value: { base: s.primaryContainer, _dark: d.primaryContainer }
843
+ }
739
844
  },
740
845
  onM3Primary: {
741
- DEFAULT: { value: { base: semantic.onPrimary, _dark: semanticDark.onPrimary } },
742
- container: { value: { base: semantic.onPrimaryContainer, _dark: semanticDark.onPrimaryContainer } }
846
+ DEFAULT: { value: { base: s.onPrimary, _dark: d.onPrimary } },
847
+ container: {
848
+ value: { base: s.onPrimaryContainer, _dark: d.onPrimaryContainer }
849
+ }
743
850
  },
744
- // M3 Secondary (prefixed to avoid conflict with Park UI Radix-scale bridge)
745
851
  m3Secondary: {
746
- DEFAULT: { value: { base: semantic.secondary, _dark: semanticDark.secondary } },
747
- container: { value: { base: semantic.secondaryContainer, _dark: semanticDark.secondaryContainer } }
852
+ DEFAULT: { value: { base: s.secondary, _dark: d.secondary } },
853
+ container: {
854
+ value: { base: s.secondaryContainer, _dark: d.secondaryContainer }
855
+ }
748
856
  },
749
857
  onM3Secondary: {
750
- DEFAULT: { value: { base: semantic.onSecondary, _dark: semanticDark.onSecondary } },
751
- container: { value: { base: semantic.onSecondaryContainer, _dark: semanticDark.onSecondaryContainer } }
858
+ DEFAULT: { value: { base: s.onSecondary, _dark: d.onSecondary } },
859
+ container: {
860
+ value: { base: s.onSecondaryContainer, _dark: d.onSecondaryContainer }
861
+ }
752
862
  },
753
- // M3 Tertiary (prefixed to avoid conflict with Park UI Radix-scale bridge)
754
863
  m3Tertiary: {
755
- DEFAULT: { value: { base: semantic.tertiary, _dark: semanticDark.tertiary } },
756
- container: { value: { base: semantic.tertiaryContainer, _dark: semanticDark.tertiaryContainer } }
864
+ DEFAULT: { value: { base: s.tertiary, _dark: d.tertiary } },
865
+ container: {
866
+ value: { base: s.tertiaryContainer, _dark: d.tertiaryContainer }
867
+ }
757
868
  },
758
869
  onM3Tertiary: {
759
- DEFAULT: { value: { base: semantic.onTertiary, _dark: semanticDark.onTertiary } },
760
- container: { value: { base: semantic.onTertiaryContainer, _dark: semanticDark.onTertiaryContainer } }
761
- },
762
- // M3 Outline
763
- outline: {
764
- DEFAULT: { value: { base: semantic.outline, _dark: semanticDark.outline } },
765
- variant: { value: { base: semantic.outlineVariant, _dark: semanticDark.outlineVariant } }
766
- },
767
- // M3 Inverse
768
- inverseSurface: { value: { base: semantic.inverseSurface, _dark: semanticDark.inverseSurface } },
769
- inverseOnSurface: { value: { base: semantic.inverseOnSurface, _dark: semanticDark.inverseOnSurface } },
770
- inversePrimary: { value: { base: semantic.inversePrimary, _dark: semanticDark.inversePrimary } },
771
- // Not standard M3 tokens, but follow inversePrimary's pattern:
772
- // light mode = dark-palette value, dark mode = light-palette value.
773
- inverseSecondary: { value: { base: semanticDark.secondary, _dark: semantic.secondary } },
774
- inverseTertiary: { value: { base: semanticDark.tertiary, _dark: semantic.tertiary } },
775
- // Scrim/Shadow
776
- scrim: { value: { base: semantic.scrim, _dark: semanticDark.scrim } }
870
+ DEFAULT: { value: { base: s.onTertiary, _dark: d.onTertiary } },
871
+ container: {
872
+ value: { base: s.onTertiaryContainer, _dark: d.onTertiaryContainer }
873
+ }
874
+ }
777
875
  });
778
876
  var button = defineRecipe({
779
877
  className: "button",
@@ -1900,6 +1998,27 @@ var breadcrumb = defineSlotRecipe({
1900
1998
  lg: { list: { gap: "2", textStyle: "lg" } }
1901
1999
  }
1902
2000
  },
2001
+ compoundVariants: [
2002
+ {
2003
+ variant: "discourser",
2004
+ css: {
2005
+ link: {
2006
+ "&[data-disabled]": {
2007
+ color: "fg.subtle",
2008
+ opacity: 0.45,
2009
+ pointerEvents: "none",
2010
+ cursor: "default",
2011
+ _hover: { color: "fg.subtle" }
2012
+ }
2013
+ },
2014
+ item: {
2015
+ "&[data-disabled]": {
2016
+ opacity: 0.45
2017
+ }
2018
+ }
2019
+ }
2020
+ }
2021
+ ],
1903
2022
  defaultVariants: {
1904
2023
  variant: "plain",
1905
2024
  size: "md"
@@ -4288,8 +4407,19 @@ var discourserPandaPreset = definePreset({
4288
4407
  // Semantic tokens: M3 colors + Park UI aliases + shadows + radii
4289
4408
  semanticTokens: {
4290
4409
  colors: {
4291
- // M3-to-Radix color bridges
4410
+ // Non-conflicting M3 semantic tokens land here first
4411
+ // (onPrimary, onSecondary, surface, outline, etc.)
4412
+ ...semanticColorTokens,
4413
+ // M3-to-Radix color bridges — overwrite conflicting top-level keys,
4414
+ // then re-merge the M3 semantic DEFAULT+container back in
4292
4415
  ...colors,
4416
+ primary: { ...colors.primary, ...semanticColorTokens.primary },
4417
+ secondary: {
4418
+ ...colors.secondary,
4419
+ ...semanticColorTokens.secondary
4420
+ },
4421
+ tertiary: { ...colors.tertiary, ...semanticColorTokens.tertiary },
4422
+ error: { ...colors.error, ...semanticColorTokens.error },
4293
4423
  // Park UI-style aliases for component compatibility
4294
4424
  fg: {
4295
4425
  default: {
@@ -4308,7 +4438,7 @@ var discourserPandaPreset = definePreset({
4308
4438
  border: {
4309
4439
  value: { base: "{colors.gray.6}", _dark: "{colors.gray.6}" }
4310
4440
  },
4311
- // M3 semantic tokens (surface, onSurface, etc.)
4441
+ // DEPRECATED: m3-prefixed aliases (still needed by discourser.ai)
4312
4442
  ...m3SemanticTokens,
4313
4443
  // Base colors
4314
4444
  white: { value: "#FFFFFF" },
@@ -4395,5 +4525,5 @@ var discourserPandaPreset = definePreset({
4395
4525
  });
4396
4526
 
4397
4527
  export { discourserPandaPreset, material3Language, transformToPandaTheme };
4398
- //# sourceMappingURL=chunk-SNUJBT5R.js.map
4399
- //# sourceMappingURL=chunk-SNUJBT5R.js.map
4528
+ //# sourceMappingURL=chunk-3HS2YGGX.js.map
4529
+ //# sourceMappingURL=chunk-3HS2YGGX.js.map