@trackunit/ui-design-tokens 0.0.50 → 0.0.52
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/index.js +4 -35
- package/package.json +2 -2
- /package/{index.d.ts → src/index.d.ts} +0 -0
- /package/{scripts → src/scripts}/generate-css.d.ts +0 -0
- /package/{tokens → src/tokens}/chartColorsDefault.d.ts +0 -0
- /package/{tokens → src/tokens}/colors/color.d.ts +0 -0
- /package/{tokens → src/tokens}/colors/colors.d.ts +0 -0
- /package/{tokens → src/tokens}/colors/index.d.ts +0 -0
- /package/{tokens → src/tokens}/colors/tailwindPalette.d.ts +0 -0
- /package/{tokens → src/tokens}/colors/trackunitPalette.d.ts +0 -0
- /package/{tokens → src/tokens}/elevation.d.ts +0 -0
- /package/{tokens → src/tokens}/size.d.ts +0 -0
- /package/{tokens → src/tokens}/tokens.d.ts +0 -0
- /package/{tokens → src/tokens}/typography.d.ts +0 -0
- /package/{tokens → src/tokens}/utils/colorVariableToCss.d.ts +0 -0
- /package/{tokens → src/tokens}/utils/getHEX.d.ts +0 -0
- /package/{tokens → src/tokens}/utils/getValuesFromDesignToken.d.ts +0 -0
- /package/{tokens → src/tokens}/zIndex.d.ts +0 -0
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const DEFAULT_CHART_COLORS = ["#2580C7", "#36A2DA", "#3FBCEA", "#06708D", "#01B7A9", "#A2DEDA", "#F9E9A0", "#FDD008", "#FBB385", "#FF7373", "#E6BCF3", "#9D96F5", "#8378EA", "#96BFFF", "#979A9A", "#0065E5", "#FF5A5A", "#00A658", "#5AC8fA", "#5E5CE6", "#2066FF", "#FF9500"];
|
|
2
|
-
const getReorderedChartColors = () => [
|
|
2
|
+
const getReorderedChartColors = () => [
|
|
3
|
+
// re-ordered to make the first ones more visually different
|
|
3
4
|
DEFAULT_CHART_COLORS[0], DEFAULT_CHART_COLORS[4], DEFAULT_CHART_COLORS[7], DEFAULT_CHART_COLORS[9], DEFAULT_CHART_COLORS[12], DEFAULT_CHART_COLORS[5], DEFAULT_CHART_COLORS[6], DEFAULT_CHART_COLORS[8], DEFAULT_CHART_COLORS[10], DEFAULT_CHART_COLORS[1], DEFAULT_CHART_COLORS[11], DEFAULT_CHART_COLORS[3], DEFAULT_CHART_COLORS[2], DEFAULT_CHART_COLORS[13]];
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -21,16 +22,13 @@ function componentToHex(c) {
|
|
|
21
22
|
if (c === null || c === undefined) {
|
|
22
23
|
return "00";
|
|
23
24
|
}
|
|
24
|
-
|
|
25
25
|
const hex = c.toString(16);
|
|
26
26
|
return hex.length === 1 ? "0" + hex : hex;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
28
|
function rgbToHex(r, g, b) {
|
|
30
29
|
if (isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
31
30
|
return "#000000";
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
@@ -42,11 +40,8 @@ function rgbToHex(r, g, b) {
|
|
|
42
40
|
* @param variable A color from the `colors` object of the Theme
|
|
43
41
|
* @returns HEX color
|
|
44
42
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
43
|
const getHEX = variable => {
|
|
48
44
|
var _a, _b;
|
|
49
|
-
|
|
50
45
|
const regex = /rgb\(var\((.*?)\) \/ var\(--tw-bg-opacity\)\)/g;
|
|
51
46
|
const root = document.documentElement;
|
|
52
47
|
const match = regex.exec(variable);
|
|
@@ -330,7 +325,6 @@ const tailwindPalette = {
|
|
|
330
325
|
* The general color palette
|
|
331
326
|
* Should be available in most if not all colored components
|
|
332
327
|
*/
|
|
333
|
-
|
|
334
328
|
const generalPalette = {
|
|
335
329
|
PRIMARY: tailwindPalette.blue,
|
|
336
330
|
SECONDARY: tailwindPalette.slate,
|
|
@@ -347,7 +341,6 @@ const generalPalette = {
|
|
|
347
341
|
* The intent color palette
|
|
348
342
|
* Should be available for most colored components such as "Button", "Alert", "Indicator", "Badge"
|
|
349
343
|
*/
|
|
350
|
-
|
|
351
344
|
const intentPalette = {
|
|
352
345
|
INFO: tailwindPalette.blue,
|
|
353
346
|
SUCCESS: tailwindPalette.green,
|
|
@@ -358,7 +351,6 @@ const intentPalette = {
|
|
|
358
351
|
* The Criticality color palette
|
|
359
352
|
* Should be available in any component that could be used to display the criticality of an asset or event
|
|
360
353
|
*/
|
|
361
|
-
|
|
362
354
|
const criticalityPalette = {
|
|
363
355
|
GOOD: tailwindPalette.emerald,
|
|
364
356
|
LOW: tailwindPalette.amber,
|
|
@@ -368,7 +360,6 @@ const criticalityPalette = {
|
|
|
368
360
|
* The Activity color palette
|
|
369
361
|
* Should be available in any component that could be used to display the Activity state of an asset
|
|
370
362
|
*/
|
|
371
|
-
|
|
372
363
|
const activityPalette = {
|
|
373
364
|
WORKING: tailwindPalette.blue,
|
|
374
365
|
IDLE: tailwindPalette.orange,
|
|
@@ -385,7 +376,6 @@ const activityPalette = {
|
|
|
385
376
|
* The Rental status color palette
|
|
386
377
|
* Should be available in any component that could be used to display the rental status of an asset
|
|
387
378
|
*/
|
|
388
|
-
|
|
389
379
|
const rentalStatusPalette = {
|
|
390
380
|
ON_RENT: {
|
|
391
381
|
100: "223 244 254",
|
|
@@ -419,7 +409,6 @@ const rentalStatusPalette = {
|
|
|
419
409
|
/**
|
|
420
410
|
* Grouped Theme Colors
|
|
421
411
|
*/
|
|
422
|
-
|
|
423
412
|
const groupedPalettes = {
|
|
424
413
|
// General
|
|
425
414
|
GENERAL: generalPalette,
|
|
@@ -435,7 +424,6 @@ const groupedPalettes = {
|
|
|
435
424
|
/**
|
|
436
425
|
* The full theme color palette (flattened)
|
|
437
426
|
*/
|
|
438
|
-
|
|
439
427
|
const trackunitPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, generalPalette), intentPalette), criticalityPalette), activityPalette), rentalStatusPalette);
|
|
440
428
|
|
|
441
429
|
/**
|
|
@@ -445,7 +433,6 @@ const trackunitPalette = Object.assign(Object.assign(Object.assign(Object.assign
|
|
|
445
433
|
* An object of all the Trackunit Theme colors and their available variants.
|
|
446
434
|
* These colors does not include the default tailwind colors.
|
|
447
435
|
*/
|
|
448
|
-
|
|
449
436
|
const themeColors = {
|
|
450
437
|
PRIMARY: {
|
|
451
438
|
name: "primary",
|
|
@@ -558,42 +545,33 @@ const themeColors = {
|
|
|
558
545
|
};
|
|
559
546
|
|
|
560
547
|
const outputOptions = ["HEX", "CSS"];
|
|
561
|
-
|
|
562
548
|
function color(ColorKey, arg2, arg3) {
|
|
563
549
|
var _a, _b;
|
|
564
|
-
|
|
565
550
|
const colorName = themeColors[ColorKey].name;
|
|
566
|
-
const colorVariants = themeColors[ColorKey].variants;
|
|
567
|
-
|
|
551
|
+
const colorVariants = themeColors[ColorKey].variants;
|
|
552
|
+
// defaultVariant or 600 or the "middel" value available.
|
|
568
553
|
const defaultVariant = (_b = (_a = themeColors[ColorKey].defaultVariant) !== null && _a !== void 0 ? _a : colorVariants[600] && 600) !== null && _b !== void 0 ? _b : Object.keys(colorVariants)[Math.floor(Object.keys(colorVariants).length / 2)];
|
|
569
554
|
let variant = defaultVariant;
|
|
570
555
|
let output = "CSS";
|
|
571
|
-
|
|
572
556
|
if (isOutputOption(arg2)) {
|
|
573
557
|
output = arg2;
|
|
574
558
|
} else {
|
|
575
559
|
if (isOutputOption(arg3)) {
|
|
576
560
|
output = arg3;
|
|
577
561
|
}
|
|
578
|
-
|
|
579
562
|
if (isValidVariant(colorVariants, arg2)) {
|
|
580
563
|
variant = arg2;
|
|
581
564
|
}
|
|
582
565
|
}
|
|
583
|
-
|
|
584
566
|
if (output === "CSS") {
|
|
585
567
|
return colorVariableToCss(`--color-${colorName}-${String(variant)}`);
|
|
586
568
|
}
|
|
587
|
-
|
|
588
569
|
if (output === "HEX") {
|
|
589
570
|
return getHEX(`--color-${colorName}-${String(variant)}`);
|
|
590
571
|
}
|
|
591
|
-
|
|
592
572
|
return colorName;
|
|
593
573
|
}
|
|
594
|
-
|
|
595
574
|
const isOutputOption = something => typeof something === "string" && outputOptions.includes(something);
|
|
596
|
-
|
|
597
575
|
const isValidVariant = (availableVariants, something) => Boolean(availableVariants[something]);
|
|
598
576
|
|
|
599
577
|
/**
|
|
@@ -612,25 +590,18 @@ const elevation = {
|
|
|
612
590
|
const size = {
|
|
613
591
|
/** --spacing-0: 0px; */
|
|
614
592
|
none: "var(--spacing-0)",
|
|
615
|
-
|
|
616
593
|
/** --spacing-1: 0.25rem; */
|
|
617
594
|
tiny: "var(--spacing-1)",
|
|
618
|
-
|
|
619
595
|
/** --spacing-2: 0.5rem; */
|
|
620
596
|
mini: "var(--spacing-2)",
|
|
621
|
-
|
|
622
597
|
/** --spacing-3: 0.75rem; */
|
|
623
598
|
small: "var(--spacing-3)",
|
|
624
|
-
|
|
625
599
|
/** --spacing-4: 1rem; */
|
|
626
600
|
medium: "var(--spacing-4)",
|
|
627
|
-
|
|
628
601
|
/** --spacing-6: 1.5rem; */
|
|
629
602
|
large: "var(--spacing-6)",
|
|
630
|
-
|
|
631
603
|
/** --spacing-8: 2rem; */
|
|
632
604
|
giant: "var(--spacing-8)",
|
|
633
|
-
|
|
634
605
|
/** --spacing-10: 2.5rem; */
|
|
635
606
|
enormous: "var(--spacing-10)"
|
|
636
607
|
};
|
|
@@ -645,12 +616,10 @@ const fontSize = {
|
|
|
645
616
|
subtitle: "var(--font-size-base)",
|
|
646
617
|
body: "var(--font-size-sm)",
|
|
647
618
|
small: "var(--font-size-xs)" // 12px
|
|
648
|
-
|
|
649
619
|
};
|
|
650
620
|
/**
|
|
651
621
|
* Primary font weights.
|
|
652
622
|
*/
|
|
653
|
-
|
|
654
623
|
const fontWeight = {
|
|
655
624
|
normal: 400,
|
|
656
625
|
bold: 600
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/ui-design-tokens",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"module": "./index.js",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"types": "./index.d.ts"
|
|
9
|
+
"types": "./src/index.d.ts"
|
|
10
10
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|