@phcdevworks/spectre-tokens 2.7.0 → 2.9.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.
package/dist/index.js CHANGED
@@ -62,6 +62,61 @@ var coreTokens = {
62
62
  "starFilled": "{colors.warning.500}",
63
63
  "starEmpty": "{colors.neutral.200}",
64
64
  "text": "{colors.neutral.500}"
65
+ },
66
+ "nav": {
67
+ "bg": "{colors.white}",
68
+ "text": "{colors.neutral.900}",
69
+ "link": "{colors.neutral.700}",
70
+ "linkHover": "{colors.brand.600}",
71
+ "linkActive": "{colors.brand.700}",
72
+ "border": "{colors.neutral.200}"
73
+ },
74
+ "modal": {
75
+ "bg": "{colors.white}",
76
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
77
+ "border": "{colors.neutral.200}",
78
+ "overlay": "{colors.black} / 0.6"
79
+ },
80
+ "toast": {
81
+ "success": {
82
+ "bg": "{colors.success.50}",
83
+ "text": "{colors.success.800}",
84
+ "border": "{colors.success.200}",
85
+ "icon": "{colors.success.600}"
86
+ },
87
+ "warning": {
88
+ "bg": "{colors.warning.50}",
89
+ "text": "{colors.warning.800}",
90
+ "border": "{colors.warning.200}",
91
+ "icon": "{colors.warning.600}"
92
+ },
93
+ "danger": {
94
+ "bg": "{colors.error.50}",
95
+ "text": "{colors.error.800}",
96
+ "border": "{colors.error.200}",
97
+ "icon": "{colors.error.600}"
98
+ },
99
+ "info": {
100
+ "bg": "{colors.info.50}",
101
+ "text": "{colors.info.800}",
102
+ "border": "{colors.info.200}",
103
+ "icon": "{colors.info.600}"
104
+ }
105
+ },
106
+ "tooltip": {
107
+ "bg": "{colors.neutral.900}",
108
+ "text": "{colors.white}",
109
+ "border": "{colors.neutral.700}"
110
+ },
111
+ "dropdown": {
112
+ "bg": "{colors.white}",
113
+ "border": "{colors.neutral.200}",
114
+ "item": {
115
+ "default": "transparent",
116
+ "hover": "{colors.neutral.100}",
117
+ "active": "{colors.info.50}",
118
+ "text": "{colors.neutral.900}"
119
+ }
65
120
  }
66
121
  },
67
122
  "buttons": {
@@ -104,7 +159,8 @@ var coreTokens = {
104
159
  "bgDisabled": "{colors.error.200}",
105
160
  "text": "{colors.white}",
106
161
  "textDisabled": "{colors.neutral.400}",
107
- "focusRing": "{colors.error.500} / 0.4"
162
+ "focusRing": "{colors.error.500} / 0.4",
163
+ "focusVisible": "{colors.error.500} / 0.4"
108
164
  },
109
165
  "success": {
110
166
  "bg": "{colors.success.700}",
@@ -113,7 +169,8 @@ var coreTokens = {
113
169
  "bgDisabled": "{colors.success.200}",
114
170
  "text": "{colors.white}",
115
171
  "textDisabled": "{colors.neutral.400}",
116
- "focusRing": "{colors.success.500} / 0.4"
172
+ "focusRing": "{colors.success.500} / 0.4",
173
+ "focusVisible": "{colors.success.500} / 0.4"
117
174
  },
118
175
  "cta": {
119
176
  "bg": "{colors.brand.600}",
@@ -178,7 +235,11 @@ var coreTokens = {
178
235
  "input": "{colors.white}",
179
236
  "overlay": "{colors.black} / 0.6",
180
237
  "alternate": "{colors.neutral.100}",
181
- "hero": "linear-gradient(135deg, {colors.indigo.500} 0%, {colors.violet.600} 100%)"
238
+ "hero": "linear-gradient(135deg, {colors.indigo.500} 0%, {colors.violet.600} 100%)",
239
+ "hover": "{colors.neutral.100}",
240
+ "selected": "{colors.info.50}",
241
+ "active": "{colors.neutral.200}",
242
+ "divider": "{colors.neutral.200}"
182
243
  },
183
244
  "text": {
184
245
  "onPage": {
@@ -255,6 +316,61 @@ var coreTokens = {
255
316
  "starFilled": "{colors.warning.500}",
256
317
  "starEmpty": "{colors.neutral.200}",
257
318
  "text": "{colors.neutral.500}"
319
+ },
320
+ "nav": {
321
+ "bg": "{colors.white}",
322
+ "text": "{colors.neutral.900}",
323
+ "link": "{colors.neutral.700}",
324
+ "linkHover": "{colors.brand.600}",
325
+ "linkActive": "{colors.brand.700}",
326
+ "border": "{colors.neutral.200}"
327
+ },
328
+ "modal": {
329
+ "bg": "{colors.white}",
330
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
331
+ "border": "{colors.neutral.200}",
332
+ "overlay": "{colors.black} / 0.6"
333
+ },
334
+ "toast": {
335
+ "success": {
336
+ "bg": "{colors.success.50}",
337
+ "text": "{colors.success.800}",
338
+ "border": "{colors.success.200}",
339
+ "icon": "{colors.success.600}"
340
+ },
341
+ "warning": {
342
+ "bg": "{colors.warning.50}",
343
+ "text": "{colors.warning.800}",
344
+ "border": "{colors.warning.200}",
345
+ "icon": "{colors.warning.600}"
346
+ },
347
+ "danger": {
348
+ "bg": "{colors.error.50}",
349
+ "text": "{colors.error.800}",
350
+ "border": "{colors.error.200}",
351
+ "icon": "{colors.error.600}"
352
+ },
353
+ "info": {
354
+ "bg": "{colors.info.50}",
355
+ "text": "{colors.info.800}",
356
+ "border": "{colors.info.200}",
357
+ "icon": "{colors.info.600}"
358
+ }
359
+ },
360
+ "tooltip": {
361
+ "bg": "{colors.neutral.900}",
362
+ "text": "{colors.white}",
363
+ "border": "{colors.neutral.700}"
364
+ },
365
+ "dropdown": {
366
+ "bg": "{colors.white}",
367
+ "border": "{colors.neutral.200}",
368
+ "item": {
369
+ "default": "transparent",
370
+ "hover": "{colors.neutral.100}",
371
+ "active": "{colors.info.50}",
372
+ "text": "{colors.neutral.900}"
373
+ }
258
374
  }
259
375
  }
260
376
  },
@@ -265,7 +381,11 @@ var coreTokens = {
265
381
  "input": "{colors.neutral.700}",
266
382
  "overlay": "{colors.black} / 0.6",
267
383
  "alternate": "{colors.neutral.800}",
268
- "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)"
384
+ "hero": "linear-gradient(135deg, {colors.accent.700} 0%, {colors.accent.900} 100%)",
385
+ "hover": "{colors.neutral.700}",
386
+ "selected": "{colors.info.900}",
387
+ "active": "{colors.neutral.600}",
388
+ "divider": "{colors.neutral.700}"
269
389
  },
270
390
  "text": {
271
391
  "onPage": {
@@ -345,6 +465,61 @@ var coreTokens = {
345
465
  "starFilled": "{colors.warning.400}",
346
466
  "starEmpty": "{colors.neutral.700}",
347
467
  "text": "{colors.neutral.400}"
468
+ },
469
+ "nav": {
470
+ "bg": "{colors.neutral.900}",
471
+ "text": "{colors.neutral.50}",
472
+ "link": "{colors.neutral.300}",
473
+ "linkHover": "{colors.brand.400}",
474
+ "linkActive": "{colors.brand.300}",
475
+ "border": "{colors.neutral.700}"
476
+ },
477
+ "modal": {
478
+ "bg": "{colors.neutral.800}",
479
+ "shadow": "0 20px 48px -12px {colors.black} / 0.20",
480
+ "border": "{colors.neutral.700}",
481
+ "overlay": "{colors.black} / 0.6"
482
+ },
483
+ "toast": {
484
+ "success": {
485
+ "bg": "{colors.success.900}",
486
+ "text": "{colors.success.100}",
487
+ "border": "{colors.success.700}",
488
+ "icon": "{colors.success.400}"
489
+ },
490
+ "warning": {
491
+ "bg": "{colors.warning.900}",
492
+ "text": "{colors.warning.100}",
493
+ "border": "{colors.warning.700}",
494
+ "icon": "{colors.warning.400}"
495
+ },
496
+ "danger": {
497
+ "bg": "{colors.error.900}",
498
+ "text": "{colors.error.100}",
499
+ "border": "{colors.error.700}",
500
+ "icon": "{colors.error.400}"
501
+ },
502
+ "info": {
503
+ "bg": "{colors.info.900}",
504
+ "text": "{colors.info.100}",
505
+ "border": "{colors.info.700}",
506
+ "icon": "{colors.info.400}"
507
+ }
508
+ },
509
+ "tooltip": {
510
+ "bg": "{colors.neutral.50}",
511
+ "text": "{colors.neutral.900}",
512
+ "border": "{colors.neutral.300}"
513
+ },
514
+ "dropdown": {
515
+ "bg": "{colors.neutral.800}",
516
+ "border": "{colors.neutral.700}",
517
+ "item": {
518
+ "default": "transparent",
519
+ "hover": "{colors.neutral.700}",
520
+ "active": "{colors.info.900}",
521
+ "text": "{colors.neutral.100}"
522
+ }
348
523
  }
349
524
  }
350
525
  }
@@ -442,26 +617,33 @@ var coreTokens = {
442
617
  "600": "#6f3fd7"
443
618
  },
444
619
  "focus": {
445
- "primary": "#336df4",
446
- "error": "#ef4444",
447
- "info": "#0369a1"
620
+ "primary": "{colors.brand.500}",
621
+ "error": "{colors.error.500}",
622
+ "info": "{colors.info.600}"
448
623
  },
449
624
  "white": "#ffffff",
450
625
  "black": "#000000"
451
626
  },
452
627
  "space": {
453
628
  "0": "0rem",
629
+ "1": "0.0625rem",
630
+ "2": "0.125rem",
454
631
  "4": "0.25rem",
632
+ "6": "0.375rem",
455
633
  "8": "0.5rem",
634
+ "10": "0.625rem",
456
635
  "12": "0.75rem",
636
+ "14": "0.875rem",
457
637
  "16": "1rem",
458
638
  "20": "1.25rem",
459
639
  "24": "1.5rem",
640
+ "28": "1.75rem",
460
641
  "32": "2rem",
461
642
  "40": "2.5rem",
462
643
  "48": "3rem",
463
644
  "56": "3.5rem",
464
645
  "64": "4rem",
646
+ "72": "4.5rem",
465
647
  "80": "5rem",
466
648
  "96": "6rem"
467
649
  },
@@ -472,6 +654,8 @@ var coreTokens = {
472
654
  "lg": "8px",
473
655
  "xl": "12px",
474
656
  "2xl": "16px",
657
+ "3xl": "24px",
658
+ "4xl": "32px",
475
659
  "pill": "999px"
476
660
  },
477
661
  "shadows": {
@@ -502,6 +686,7 @@ var coreTokens = {
502
686
  },
503
687
  "transitions": {
504
688
  "duration": {
689
+ "reduced": "0.01ms",
505
690
  "instant": "75ms",
506
691
  "fast": "150ms",
507
692
  "base": "200ms",
@@ -561,6 +746,48 @@ var coreTokens = {
561
746
  "duration": "{transitions.duration.slowest}",
562
747
  "easing": "{transitions.easing.spring}",
563
748
  "keyframes": "pulse"
749
+ },
750
+ "reducedMotion": {
751
+ "fadeIn": {
752
+ "duration": "{transitions.duration.reduced}",
753
+ "easing": "{transitions.easing.linear}",
754
+ "keyframes": "fade-in"
755
+ },
756
+ "fadeOut": {
757
+ "duration": "{transitions.duration.reduced}",
758
+ "easing": "{transitions.easing.linear}",
759
+ "keyframes": "fade-out"
760
+ },
761
+ "slideUp": {
762
+ "duration": "{transitions.duration.reduced}",
763
+ "easing": "{transitions.easing.linear}",
764
+ "keyframes": "slide-up"
765
+ },
766
+ "slideDown": {
767
+ "duration": "{transitions.duration.reduced}",
768
+ "easing": "{transitions.easing.linear}",
769
+ "keyframes": "slide-down"
770
+ },
771
+ "scaleIn": {
772
+ "duration": "{transitions.duration.reduced}",
773
+ "easing": "{transitions.easing.linear}",
774
+ "keyframes": "scale-in"
775
+ },
776
+ "bounce": {
777
+ "duration": "{transitions.duration.reduced}",
778
+ "easing": "{transitions.easing.linear}",
779
+ "keyframes": "bounce"
780
+ },
781
+ "shake": {
782
+ "duration": "{transitions.duration.reduced}",
783
+ "easing": "{transitions.easing.linear}",
784
+ "keyframes": "shake"
785
+ },
786
+ "pulse": {
787
+ "duration": "{transitions.duration.reduced}",
788
+ "easing": "{transitions.easing.linear}",
789
+ "keyframes": "pulse"
790
+ }
564
791
  }
565
792
  },
566
793
  "opacity": {
@@ -596,24 +823,39 @@ var coreTokens = {
596
823
  "offset": "2px",
597
824
  "style": "solid"
598
825
  },
826
+ "reducedMotion": "{transitions.duration.reduced}",
827
+ "forcedColors": "auto",
599
828
  "minTouchTarget": "44px",
600
829
  "minTextSize": "16px"
601
830
  },
602
831
  "border": {
603
832
  "width": {
833
+ "none": "0",
604
834
  "base": "1px",
605
835
  "thick": "2px"
606
836
  },
607
837
  "style": {
608
838
  "none": "none",
609
- "solid": "solid"
839
+ "solid": "solid",
840
+ "dashed": "dashed",
841
+ "dotted": "dotted"
610
842
  }
611
843
  },
612
844
  "surface": {
613
845
  "page": "{colors.neutral.50}",
614
846
  "card": "{colors.white}",
615
847
  "input": "{colors.white}",
616
- "overlay": "{colors.black} / 0.6"
848
+ "overlay": "{colors.black} / 0.6",
849
+ "hover": "{colors.neutral.100}",
850
+ "selected": "{colors.info.50}",
851
+ "active": "{colors.neutral.200}",
852
+ "divider": "{colors.neutral.200}"
853
+ },
854
+ "link": {
855
+ "default": "{colors.brand.600}",
856
+ "hover": "{colors.brand.700}",
857
+ "active": "{colors.brand.800}",
858
+ "visited": "{colors.accent.700}"
617
859
  },
618
860
  "text": {
619
861
  "onPage": {
@@ -816,6 +1058,42 @@ var ICON_BOX_FIELDS = [
816
1058
  { name: "icon-warning", tokenKey: "iconWarning" },
817
1059
  { name: "icon-danger", tokenKey: "iconDanger" }
818
1060
  ];
1061
+ var NAV_FIELDS = [
1062
+ { name: "bg", tokenKey: "bg" },
1063
+ { name: "text", tokenKey: "text" },
1064
+ { name: "link", tokenKey: "link" },
1065
+ { name: "link-hover", tokenKey: "linkHover" },
1066
+ { name: "link-active", tokenKey: "linkActive" },
1067
+ { name: "border", tokenKey: "border" }
1068
+ ];
1069
+ var MODAL_FIELDS = [
1070
+ { name: "bg", tokenKey: "bg" },
1071
+ { name: "shadow", tokenKey: "shadow" },
1072
+ { name: "border", tokenKey: "border" },
1073
+ { name: "overlay", tokenKey: "overlay" }
1074
+ ];
1075
+ var TOAST_VARIANTS = ["success", "warning", "danger", "info"].map((variant) => ({
1076
+ variant,
1077
+ fields: [
1078
+ { name: "bg", tokenKey: "bg" },
1079
+ { name: "text", tokenKey: "text" },
1080
+ { name: "border", tokenKey: "border" },
1081
+ { name: "icon", tokenKey: "icon" }
1082
+ ]
1083
+ }));
1084
+ var TOOLTIP_FIELDS = [
1085
+ { name: "bg", tokenKey: "bg" },
1086
+ { name: "text", tokenKey: "text" },
1087
+ { name: "border", tokenKey: "border" }
1088
+ ];
1089
+ var DROPDOWN_FIELDS = [
1090
+ { name: "bg", modePath: ["bg"], aliasPath: ["bg"] },
1091
+ { name: "border", modePath: ["border"], aliasPath: ["border"] },
1092
+ { name: "item-default", modePath: ["item", "default"], aliasPath: ["item", "default"] },
1093
+ { name: "item-hover", modePath: ["item", "hover"], aliasPath: ["item", "hover"] },
1094
+ { name: "item-active", modePath: ["item", "active"], aliasPath: ["item", "active"] },
1095
+ { name: "item-text", modePath: ["item", "text"], aliasPath: ["item", "text"] }
1096
+ ];
819
1097
  var resolveTokenReference = (tokens2, reference) => {
820
1098
  const path = reference.slice(1, -1).split(".");
821
1099
  let current = tokens2;
@@ -983,6 +1261,7 @@ var createCssVariableMap = (tokens2, options = {}) => {
983
1261
  assign(toVariableName(prefix, "focus-ring-style"), baseTokens.accessibility.focusRing.style);
984
1262
  assign(toVariableName(prefix, "min-touch-target"), baseTokens.accessibility.minTouchTarget);
985
1263
  assign(toVariableName(prefix, "min-text-size"), baseTokens.accessibility.minTextSize);
1264
+ assign(toVariableName(prefix, "reduced-motion"), baseTokens.accessibility.reducedMotion);
986
1265
  Object.entries(baseTokens.buttons).forEach(([variant, states]) => {
987
1266
  Object.entries(states).forEach(([state, value]) => {
988
1267
  assign(toVariableName(prefix, "button", variant, state), value);
@@ -994,11 +1273,22 @@ var createCssVariableMap = (tokens2, options = {}) => {
994
1273
  });
995
1274
  });
996
1275
  if (baseTokens.animations) {
997
- Object.entries(baseTokens.animations).forEach(([name, animation]) => {
998
- assign(toVariableName(prefix, "animation", name, "duration"), animation.duration);
999
- assign(toVariableName(prefix, "animation", name, "easing"), animation.easing);
1000
- assign(toVariableName(prefix, "animation", name, "keyframes"), animation.keyframes);
1001
- });
1276
+ Object.entries(baseTokens.animations).forEach(
1277
+ ([name, animation]) => {
1278
+ if (name === "reducedMotion") {
1279
+ Object.entries(animation).forEach(([subName, subAnimation]) => {
1280
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "duration"), subAnimation.duration);
1281
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "easing"), subAnimation.easing);
1282
+ assign(toVariableName(prefix, "animation", "reduced-motion", subName, "keyframes"), subAnimation.keyframes);
1283
+ });
1284
+ } else {
1285
+ const entry = animation;
1286
+ assign(toVariableName(prefix, "animation", name, "duration"), entry.duration);
1287
+ assign(toVariableName(prefix, "animation", name, "easing"), entry.easing);
1288
+ assign(toVariableName(prefix, "animation", name, "keyframes"), entry.keyframes);
1289
+ }
1290
+ }
1291
+ );
1002
1292
  }
1003
1293
  return map;
1004
1294
  };
@@ -1044,6 +1334,36 @@ var generateCssVariables = (tokens2, options = {}) => {
1044
1334
  modePath: ["component", "iconBox", tokenKey],
1045
1335
  aliasSrc: componentAliases,
1046
1336
  aliasPath: ["iconBox", tokenKey]
1337
+ })),
1338
+ ...NAV_FIELDS.map(({ name, tokenKey }) => ({
1339
+ varParts: ["nav", name],
1340
+ modePath: ["component", "nav", tokenKey],
1341
+ aliasSrc: componentAliases,
1342
+ aliasPath: ["nav", tokenKey]
1343
+ })),
1344
+ ...MODAL_FIELDS.map(({ name, tokenKey }) => ({
1345
+ varParts: ["modal", name],
1346
+ modePath: ["component", "modal", tokenKey],
1347
+ aliasSrc: componentAliases,
1348
+ aliasPath: ["modal", tokenKey]
1349
+ })),
1350
+ ...TOAST_VARIANTS.flatMap(({ variant, fields }) => fields.map(({ name, tokenKey }) => ({
1351
+ varParts: ["toast", variant, name],
1352
+ modePath: ["component", "toast", variant, tokenKey],
1353
+ aliasSrc: componentAliases,
1354
+ aliasPath: ["toast", variant, tokenKey]
1355
+ }))),
1356
+ ...TOOLTIP_FIELDS.map(({ name, tokenKey }) => ({
1357
+ varParts: ["tooltip", name],
1358
+ modePath: ["component", "tooltip", tokenKey],
1359
+ aliasSrc: componentAliases,
1360
+ aliasPath: ["tooltip", tokenKey]
1361
+ })),
1362
+ ...DROPDOWN_FIELDS.map(({ name, modePath, aliasPath }) => ({
1363
+ varParts: ["dropdown", name],
1364
+ modePath: ["component", "dropdown", ...modePath],
1365
+ aliasSrc: componentAliases,
1366
+ aliasPath: ["dropdown", ...aliasPath]
1047
1367
  }))
1048
1368
  ];
1049
1369
  const baseLines = [];