@trackunit/ui-design-tokens 1.3.71 → 1.3.73

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.cjs.js CHANGED
@@ -15,56 +15,6 @@ const themeBorderRadius = {
15
15
  full: "9999px",
16
16
  };
17
17
 
18
- const DEFAULT_CHART_COLORS = [
19
- "#2580C7",
20
- "#36A2DA",
21
- "#3FBCEA",
22
- "#06708D",
23
- "#01B7A9",
24
- "#A2DEDA",
25
- "#F9E9A0",
26
- "#FDD008",
27
- "#FBB385",
28
- "#FF7373",
29
- "#E6BCF3",
30
- "#9D96F5",
31
- "#8378EA",
32
- "#96BFFF",
33
- "#979A9A",
34
- "#0065E5",
35
- "#FF5A5A",
36
- "#00A658",
37
- "#5AC8fA",
38
- "#5E5CE6",
39
- "#2066FF",
40
- "#FF9500",
41
- "#E2E8F0",
42
- ];
43
- /**
44
- * Re-ordered chart colors to ensure that adjacent colors are visually different.
45
- *
46
- * @returns {string[]} The reordered chart colors.
47
- */
48
- const getReorderedChartColors = () => [
49
- // DO NOT reorder the colors, or add new colors in the middle of the array until you verify that adjacent colors are visually different.
50
- // If you want to add a new color, you should almost always add it at the end of the array.
51
- DEFAULT_CHART_COLORS[0],
52
- DEFAULT_CHART_COLORS[4],
53
- DEFAULT_CHART_COLORS[7],
54
- DEFAULT_CHART_COLORS[9],
55
- DEFAULT_CHART_COLORS[12],
56
- DEFAULT_CHART_COLORS[5],
57
- DEFAULT_CHART_COLORS[6],
58
- DEFAULT_CHART_COLORS[8],
59
- DEFAULT_CHART_COLORS[10],
60
- DEFAULT_CHART_COLORS[1],
61
- DEFAULT_CHART_COLORS[11],
62
- DEFAULT_CHART_COLORS[3],
63
- DEFAULT_CHART_COLORS[2],
64
- DEFAULT_CHART_COLORS[13],
65
- DEFAULT_CHART_COLORS[22],
66
- ];
67
-
68
18
  /**
69
19
  * Convert a css custom property from our design tokens to a useable css string.
70
20
  *
@@ -93,6 +43,26 @@ function rgbToHex(r, g, b) {
93
43
  }
94
44
  return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
95
45
  }
46
+ /**
47
+ * Convert a string to a HEX color.
48
+ *
49
+ * @param colorString - The string to convert to a HEX color. defaults to "#000000" if the string is not a valid RGB color.
50
+ * @returns {string} HEX color
51
+ */
52
+ const rgbStringToHex = (colorString) => {
53
+ if (colorString.split(" ").length === 3) {
54
+ const [r, g, b] = colorString.split(" ").map(Number);
55
+ //check if the values are valid numbers
56
+ if (typeof r !== "number" || typeof g !== "number" || typeof b !== "number") {
57
+ return "#000000";
58
+ }
59
+ if (isNaN(r) || isNaN(g) || isNaN(b)) {
60
+ return "#000000";
61
+ }
62
+ return rgbToHex(r, g, b);
63
+ }
64
+ return "#000000";
65
+ };
96
66
  /**
97
67
  * Returns the HEX color based on a Color from the theme.
98
68
  * Reads the RGB value from the underlying CSS variable and convert to HEX.
@@ -646,6 +616,26 @@ function color(ColorKey, arg2, arg3) {
646
616
  const isOutputOption = (something) => typeof something === "string" && outputOptions.includes(something);
647
617
  const isValidVariant = (availableVariants, something) => Boolean(availableVariants[something]);
648
618
 
619
+ const DEFAULT_CHART_OTHER = rgbStringToHex(tailwindPalette.gray[400]);
620
+ // https://www.figma.com/design/rKXIGyQNzplUJNB51EJY19/Widgets-Library?node-id=4634-13353&t=E95Ey1UXtgTWs17D-0
621
+ const DEFAULT_CHART_COLORS = [
622
+ rgbStringToHex(tailwindPalette.blue[500]),
623
+ rgbStringToHex(tailwindPalette.teal[500]),
624
+ rgbStringToHex(tailwindPalette.yellow[400]),
625
+ rgbStringToHex(tailwindPalette.violet[400]),
626
+ rgbStringToHex(tailwindPalette.orange[500]),
627
+ rgbStringToHex(tailwindPalette.lime[400]),
628
+ ];
629
+ const { CRITICAL, LOW, GOOD, WORKING, IDLE, STOPPED } = themeColors;
630
+ const CHART_STATUS_COLORS = {
631
+ CRITICAL: rgbStringToHex(CRITICAL.variants[500]),
632
+ LOW: rgbStringToHex(LOW.variants[500]),
633
+ GOOD: rgbStringToHex(GOOD.variants[500]),
634
+ WORKING: rgbStringToHex(WORKING.variants[500]),
635
+ IDLE: rgbStringToHex(IDLE.variants[500]),
636
+ STOPPED: rgbStringToHex(STOPPED.variants[500]),
637
+ };
638
+
649
639
  /**
650
640
  * A collection of all the tokens related to elevation in the theme.
651
641
  */
@@ -836,7 +826,9 @@ const zIndex = {
836
826
  toast: themeZIndex.toast,
837
827
  };
838
828
 
829
+ exports.CHART_STATUS_COLORS = CHART_STATUS_COLORS;
839
830
  exports.DEFAULT_CHART_COLORS = DEFAULT_CHART_COLORS;
831
+ exports.DEFAULT_CHART_OTHER = DEFAULT_CHART_OTHER;
840
832
  exports.activityPalette = activityPalette;
841
833
  exports.color = color;
842
834
  exports.criticalityPalette = criticalityPalette;
@@ -845,7 +837,6 @@ exports.fontFamily = fontFamily;
845
837
  exports.fontSize = fontSize;
846
838
  exports.fontWeight = fontWeight;
847
839
  exports.generalPalette = generalPalette;
848
- exports.getReorderedChartColors = getReorderedChartColors;
849
840
  exports.groupedPalettes = groupedPalettes;
850
841
  exports.intentPalette = intentPalette;
851
842
  exports.otherPalette = otherPalette;
package/index.esm.js CHANGED
@@ -13,56 +13,6 @@ const themeBorderRadius = {
13
13
  full: "9999px",
14
14
  };
15
15
 
16
- const DEFAULT_CHART_COLORS = [
17
- "#2580C7",
18
- "#36A2DA",
19
- "#3FBCEA",
20
- "#06708D",
21
- "#01B7A9",
22
- "#A2DEDA",
23
- "#F9E9A0",
24
- "#FDD008",
25
- "#FBB385",
26
- "#FF7373",
27
- "#E6BCF3",
28
- "#9D96F5",
29
- "#8378EA",
30
- "#96BFFF",
31
- "#979A9A",
32
- "#0065E5",
33
- "#FF5A5A",
34
- "#00A658",
35
- "#5AC8fA",
36
- "#5E5CE6",
37
- "#2066FF",
38
- "#FF9500",
39
- "#E2E8F0",
40
- ];
41
- /**
42
- * Re-ordered chart colors to ensure that adjacent colors are visually different.
43
- *
44
- * @returns {string[]} The reordered chart colors.
45
- */
46
- const getReorderedChartColors = () => [
47
- // DO NOT reorder the colors, or add new colors in the middle of the array until you verify that adjacent colors are visually different.
48
- // If you want to add a new color, you should almost always add it at the end of the array.
49
- DEFAULT_CHART_COLORS[0],
50
- DEFAULT_CHART_COLORS[4],
51
- DEFAULT_CHART_COLORS[7],
52
- DEFAULT_CHART_COLORS[9],
53
- DEFAULT_CHART_COLORS[12],
54
- DEFAULT_CHART_COLORS[5],
55
- DEFAULT_CHART_COLORS[6],
56
- DEFAULT_CHART_COLORS[8],
57
- DEFAULT_CHART_COLORS[10],
58
- DEFAULT_CHART_COLORS[1],
59
- DEFAULT_CHART_COLORS[11],
60
- DEFAULT_CHART_COLORS[3],
61
- DEFAULT_CHART_COLORS[2],
62
- DEFAULT_CHART_COLORS[13],
63
- DEFAULT_CHART_COLORS[22],
64
- ];
65
-
66
16
  /**
67
17
  * Convert a css custom property from our design tokens to a useable css string.
68
18
  *
@@ -91,6 +41,26 @@ function rgbToHex(r, g, b) {
91
41
  }
92
42
  return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
93
43
  }
44
+ /**
45
+ * Convert a string to a HEX color.
46
+ *
47
+ * @param colorString - The string to convert to a HEX color. defaults to "#000000" if the string is not a valid RGB color.
48
+ * @returns {string} HEX color
49
+ */
50
+ const rgbStringToHex = (colorString) => {
51
+ if (colorString.split(" ").length === 3) {
52
+ const [r, g, b] = colorString.split(" ").map(Number);
53
+ //check if the values are valid numbers
54
+ if (typeof r !== "number" || typeof g !== "number" || typeof b !== "number") {
55
+ return "#000000";
56
+ }
57
+ if (isNaN(r) || isNaN(g) || isNaN(b)) {
58
+ return "#000000";
59
+ }
60
+ return rgbToHex(r, g, b);
61
+ }
62
+ return "#000000";
63
+ };
94
64
  /**
95
65
  * Returns the HEX color based on a Color from the theme.
96
66
  * Reads the RGB value from the underlying CSS variable and convert to HEX.
@@ -644,6 +614,26 @@ function color(ColorKey, arg2, arg3) {
644
614
  const isOutputOption = (something) => typeof something === "string" && outputOptions.includes(something);
645
615
  const isValidVariant = (availableVariants, something) => Boolean(availableVariants[something]);
646
616
 
617
+ const DEFAULT_CHART_OTHER = rgbStringToHex(tailwindPalette.gray[400]);
618
+ // https://www.figma.com/design/rKXIGyQNzplUJNB51EJY19/Widgets-Library?node-id=4634-13353&t=E95Ey1UXtgTWs17D-0
619
+ const DEFAULT_CHART_COLORS = [
620
+ rgbStringToHex(tailwindPalette.blue[500]),
621
+ rgbStringToHex(tailwindPalette.teal[500]),
622
+ rgbStringToHex(tailwindPalette.yellow[400]),
623
+ rgbStringToHex(tailwindPalette.violet[400]),
624
+ rgbStringToHex(tailwindPalette.orange[500]),
625
+ rgbStringToHex(tailwindPalette.lime[400]),
626
+ ];
627
+ const { CRITICAL, LOW, GOOD, WORKING, IDLE, STOPPED } = themeColors;
628
+ const CHART_STATUS_COLORS = {
629
+ CRITICAL: rgbStringToHex(CRITICAL.variants[500]),
630
+ LOW: rgbStringToHex(LOW.variants[500]),
631
+ GOOD: rgbStringToHex(GOOD.variants[500]),
632
+ WORKING: rgbStringToHex(WORKING.variants[500]),
633
+ IDLE: rgbStringToHex(IDLE.variants[500]),
634
+ STOPPED: rgbStringToHex(STOPPED.variants[500]),
635
+ };
636
+
647
637
  /**
648
638
  * A collection of all the tokens related to elevation in the theme.
649
639
  */
@@ -834,4 +824,4 @@ const zIndex = {
834
824
  toast: themeZIndex.toast,
835
825
  };
836
826
 
837
- export { DEFAULT_CHART_COLORS, activityPalette, color, criticalityPalette, elevation, fontFamily, fontSize, fontWeight, generalPalette, getReorderedChartColors, groupedPalettes, intentPalette, otherPalette, rentalStatusPalette, sitesPalette, size, tailwindPalette, themeBorderRadius, themeBoxShadow, themeColors, themeFontSize, themeFontWeight, themeLineHeight, themeScreenSize, themeScreenSizeAsNumber, themeSpacing, themeZIndex, themedPalette, trackunitPalette, utilizationPalette, zIndex };
827
+ export { CHART_STATUS_COLORS, DEFAULT_CHART_COLORS, DEFAULT_CHART_OTHER, activityPalette, color, criticalityPalette, elevation, fontFamily, fontSize, fontWeight, generalPalette, groupedPalettes, intentPalette, otherPalette, rentalStatusPalette, sitesPalette, size, tailwindPalette, themeBorderRadius, themeBoxShadow, themeColors, themeFontSize, themeFontWeight, themeLineHeight, themeScreenSize, themeScreenSizeAsNumber, themeSpacing, themeZIndex, themedPalette, trackunitPalette, utilizationPalette, zIndex };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/ui-design-tokens",
3
- "version": "1.3.71",
3
+ "version": "1.3.73",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1,7 +1,13 @@
1
- export declare 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", "#E2E8F0"];
2
- /**
3
- * Re-ordered chart colors to ensure that adjacent colors are visually different.
4
- *
5
- * @returns {string[]} The reordered chart colors.
6
- */
7
- export declare const getReorderedChartColors: () => ("#2580C7" | "#36A2DA" | "#3FBCEA" | "#06708D" | "#01B7A9" | "#A2DEDA" | "#F9E9A0" | "#FDD008" | "#FBB385" | "#FF7373" | "#E6BCF3" | "#9D96F5" | "#8378EA" | "#96BFFF" | "#E2E8F0")[];
1
+ declare type ColorString = string;
2
+ export declare const DEFAULT_CHART_OTHER: ColorString;
3
+ export declare const DEFAULT_CHART_COLORS: [string, string, string, string, string, string];
4
+ export type ChartStatus = "CRITICAL" | "LOW" | "GOOD" | "WORKING" | "IDLE" | "STOPPED";
5
+ export declare const CHART_STATUS_COLORS: {
6
+ readonly CRITICAL: string;
7
+ readonly LOW: string;
8
+ readonly GOOD: string;
9
+ readonly WORKING: string;
10
+ readonly IDLE: string;
11
+ readonly STOPPED: string;
12
+ };
13
+ export {};
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Convert a string to a HEX color.
3
+ *
4
+ * @param colorString - The string to convert to a HEX color. defaults to "#000000" if the string is not a valid RGB color.
5
+ * @returns {string} HEX color
6
+ */
7
+ export declare const rgbStringToHex: (colorString: string) => string;
1
8
  /**
2
9
  * Returns the HEX color based on a Color from the theme.
3
10
  * Reads the RGB value from the underlying CSS variable and convert to HEX.