@trackunit/ui-design-tokens 0.0.43 → 0.0.45

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 CHANGED
@@ -1,119 +1,21 @@
1
- import { generateMedia } from 'styled-media-query';
2
-
3
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"];
4
2
  const getReorderedChartColors = () => [// re-ordered to make the first ones more visually different
5
3
  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]];
6
4
 
7
5
  /**
8
- * The values assigned are loosely based on the hue/neutral's
9
- * respective relative luminance, where 0% is black and 100% is white.
10
- * However, it is slightly adjusted to be in reverse, where X0 will
11
- * always represent the lightest version, while X100 will present the
12
- * darkest version of a hue/neutral.
6
+ * Convert a css custom property from our design tokens to a useable css string.
7
+ *
8
+ * Our custom properties are saved as "rrr ggg bbb" rather than a full css color.
9
+ *
10
+ * This allows us to modify them with opacity values and more.
11
+ *
12
+ * @param variable CSS custom property for color
13
+ * @returns Full css for using the color
14
+ * @example "--color-primart-400" --> "rgb(var(--color-primary-400) / var(--tw-bg-opacity)))"
13
15
  */
14
- function getColorValue(variable) {
16
+ function colorVariableToCss(variable) {
15
17
  return `rgb(var(${variable}) / var(--tw-bg-opacity))`;
16
18
  }
17
- const black = "#1a1b1c";
18
- const white = "#fff";
19
- const neutral = {
20
- N5: getColorValue("--color-neutral-50"),
21
- N10: getColorValue("--color-neutral-100"),
22
- N20: getColorValue("--color-neutral-200"),
23
- N30: getColorValue("--color-neutral-300"),
24
- N40: getColorValue("--color-neutral-400"),
25
- N50: getColorValue("--color-neutral-500"),
26
- N60: getColorValue("--color-neutral-600"),
27
- N70: getColorValue("--color-neutral-700"),
28
- N80: getColorValue("--color-neutral-800"),
29
- N90: getColorValue("--color-neutral-900")
30
- };
31
- const blue = {
32
- B5: getColorValue("--color-blue-50"),
33
- B10: getColorValue("--color-blue-100"),
34
- B20: getColorValue("--color-blue-200"),
35
- B30: getColorValue("--color-blue-300"),
36
- B40: getColorValue("--color-blue-400"),
37
- B50: getColorValue("--color-blue-500"),
38
- B60: getColorValue("--color-blue-600"),
39
- B70: getColorValue("--color-blue-700"),
40
- B80: getColorValue("--color-blue-800"),
41
- B90: getColorValue("--color-blue-900")
42
- };
43
- const green = {
44
- G5: getColorValue("--color-green-50"),
45
- G10: getColorValue("--color-green-100"),
46
- G20: getColorValue("--color-green-200"),
47
- G30: getColorValue("--color-green-300"),
48
- G40: getColorValue("--color-green-400"),
49
- G50: getColorValue("--color-green-500"),
50
- G60: getColorValue("--color-green-600"),
51
- G70: getColorValue("--color-green-700"),
52
- G80: getColorValue("--color-green-800"),
53
- G90: getColorValue("--color-green-900")
54
- };
55
- const red = {
56
- R5: getColorValue("--color-red-50"),
57
- R10: getColorValue("--color-red-100"),
58
- R20: getColorValue("--color-red-200"),
59
- R30: getColorValue("--color-red-300"),
60
- R40: getColorValue("--color-red-400"),
61
- R50: getColorValue("--color-red-500"),
62
- R60: getColorValue("--color-red-600"),
63
- R70: getColorValue("--color-red-700"),
64
- R80: getColorValue("--color-red-800"),
65
- R90: getColorValue("--color-red-900")
66
- };
67
- const orange = {
68
- O5: getColorValue("--color-amber-50"),
69
- O10: getColorValue("--color-amber-100"),
70
- O20: getColorValue("--color-amber-200"),
71
- O30: getColorValue("--color-amber-300"),
72
- O40: getColorValue("--color-amber-400"),
73
- O50: getColorValue("--color-amber-500"),
74
- O60: getColorValue("--color-amber-600"),
75
- O70: getColorValue("--color-amber-700"),
76
- O80: getColorValue("--color-amber-800"),
77
- O90: getColorValue("--color-amber-900")
78
- };
79
- const purple = {
80
- P5: getColorValue("--color-violet-50"),
81
- P10: getColorValue("--color-violet-100"),
82
- P20: getColorValue("--color-violet-200"),
83
- P30: getColorValue("--color-violet-300"),
84
- P40: getColorValue("--color-violet-400"),
85
- P50: getColorValue("--color-violet-500"),
86
- P60: getColorValue("--color-violet-600"),
87
- P70: getColorValue("--color-violet-700"),
88
- P80: getColorValue("--color-violet-800"),
89
- P90: getColorValue("--color-violet-900")
90
- };
91
- const utilization = {
92
- working: "#2EC5E9",
93
- moving: "#E690B1",
94
- idling: "#FDDD0E",
95
- stopped: "#6577DB",
96
- active: "#3FDB93",
97
- operating: "#65ACDB"
98
- };
99
- const colors = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, neutral), blue), green), red), orange), purple), {
100
- utilization,
101
- black,
102
- white
103
- });
104
-
105
- /**
106
- * Elevation is based on N100 with an alpha channel. E(X)A variants
107
- * are for active versions(e.g. hover).
108
- */
109
- const elevation = {
110
- E05: "var(--box-shadow-sm)",
111
- E10: "var(--box-shadow-DEFAULT)",
112
- E10A: "var(--box-shadow-md)",
113
- E20: "var(--box-shadow-lg)",
114
- E30: "var(--box-shadow-xl)",
115
- E40: "var(--box-shadow-2xl)"
116
- };
117
19
 
118
20
  function componentToHex(c) {
119
21
  if (c === null || c === undefined) {
@@ -135,7 +37,7 @@ function rgbToHex(r, g, b) {
135
37
  * Returns the HEX color based on a Color from the theme.
136
38
  * Reads the RGB value from the underlying CSS variable and convert to HEX.
137
39
  *
138
- * Example: getHEX(theme.colors.B50) -> #3b82f6
40
+ * Example: color("PRIMARY", 500, "HEX") -> #3b82f6
139
41
  *
140
42
  * @param variable A color from the `colors` object of the Theme
141
43
  * @returns HEX color
@@ -154,94 +56,558 @@ const getHEX = variable => {
154
56
  };
155
57
 
156
58
  /**
157
- * Reads the value of the CSS custom Property connected to the design torken.
158
- * ATTENTION: For colors use getHEX
59
+ * The Tailwind color palette.
60
+ * Contains the full tailwind default color theme.
61
+ */
62
+ const tailwindPalette = {
63
+ slate: {
64
+ 50: "248 250 252",
65
+ 100: "241 245 249",
66
+ 200: "226 232 240",
67
+ 300: "203 213 225",
68
+ 400: "148 163 184",
69
+ 500: "100 116 139",
70
+ 600: "71 85 105",
71
+ 700: "51 65 85",
72
+ 800: "30 41 59",
73
+ 900: "15 23 42"
74
+ },
75
+ gray: {
76
+ 50: "249 250 251",
77
+ 100: "243 244 246",
78
+ 200: "229 231 235",
79
+ 300: "209 213 219",
80
+ 400: "156 163 175",
81
+ 500: "107 114 128",
82
+ 600: "75 85 99",
83
+ 700: "55 65 81",
84
+ 800: "31 41 55",
85
+ 900: "17 24 39"
86
+ },
87
+ zinc: {
88
+ 50: "250 250 250",
89
+ 100: "244 244 245",
90
+ 200: "228 228 231",
91
+ 300: "212 212 216",
92
+ 400: "161 161 170",
93
+ 500: "113 113 122",
94
+ 600: "82 82 91",
95
+ 700: "63 63 70",
96
+ 800: "39 39 42",
97
+ 900: "24 24 27"
98
+ },
99
+ neutral: {
100
+ 50: "250 250 250",
101
+ 100: "245 245 245",
102
+ 200: "229 229 229",
103
+ 300: "212 212 212",
104
+ 400: "163 163 163",
105
+ 500: "115 115 115",
106
+ 600: "82 82 82",
107
+ 700: "64 64 64",
108
+ 800: "38 38 38",
109
+ 900: "23 23 23"
110
+ },
111
+ stone: {
112
+ 50: "250 250 249",
113
+ 100: "245 245 244",
114
+ 200: "231 229 228",
115
+ 300: "214 211 209",
116
+ 400: "168 162 158",
117
+ 500: "120 113 108",
118
+ 600: "87 83 78",
119
+ 700: "68 64 60",
120
+ 800: "41 37 36",
121
+ 900: "28 25 23"
122
+ },
123
+ red: {
124
+ 50: "254 242 242",
125
+ 100: "254 226 226",
126
+ 200: "254 202 202",
127
+ 300: "252 165 165",
128
+ 400: "248 113 113",
129
+ 500: "239 68 68",
130
+ 600: "220 38 38",
131
+ 700: "185 28 28",
132
+ 800: "153 27 27",
133
+ 900: "127 29 29"
134
+ },
135
+ orange: {
136
+ 50: "255 247 237",
137
+ 100: "255 237 213",
138
+ 200: "254 215 170",
139
+ 300: "253 186 116",
140
+ 400: "251 146 60",
141
+ 500: "249 115 22",
142
+ 600: "234 88 12",
143
+ 700: "194 65 12",
144
+ 800: "154 52 18",
145
+ 900: "124 45 18"
146
+ },
147
+ amber: {
148
+ 50: "255 251 235",
149
+ 100: "254 243 199",
150
+ 200: "253 230 138",
151
+ 300: "252 211 77",
152
+ 400: "251 191 36",
153
+ 500: "245 158 11",
154
+ 600: "217 119 6",
155
+ 700: "180 83 9",
156
+ 800: "146 64 14",
157
+ 900: "120 53 15"
158
+ },
159
+ yellow: {
160
+ 50: "254 252 232",
161
+ 100: "254 249 195",
162
+ 200: "254 240 138",
163
+ 300: "253 224 71",
164
+ 400: "250 204 21",
165
+ 500: "234 179 8",
166
+ 600: "202 138 4",
167
+ 700: "161 98 7",
168
+ 800: "133 77 14",
169
+ 900: "113 63 18"
170
+ },
171
+ lime: {
172
+ 50: "247 254 231",
173
+ 100: "236 252 203",
174
+ 200: "217 249 157",
175
+ 300: "190 242 100",
176
+ 400: "163 230 53",
177
+ 500: "132 204 22",
178
+ 600: "101 163 13",
179
+ 700: "77 124 15",
180
+ 800: "63 98 18",
181
+ 900: "54 83 20"
182
+ },
183
+ green: {
184
+ 50: "240 253 244",
185
+ 100: "220 252 231",
186
+ 200: "187 247 208",
187
+ 300: "134 239 172",
188
+ 400: "74 222 128",
189
+ 500: "34 197 94",
190
+ 600: "22 163 74",
191
+ 700: "21 128 61",
192
+ 800: "22 101 52",
193
+ 900: "20 83 45"
194
+ },
195
+ emerald: {
196
+ 50: "236 253 245",
197
+ 100: "209 250 229",
198
+ 200: "167 243 208",
199
+ 300: "110 231 183",
200
+ 400: "52 211 153",
201
+ 500: "16 185 129",
202
+ 600: "5 150 105",
203
+ 700: "4 120 87",
204
+ 800: "6 95 70",
205
+ 900: "6 78 59"
206
+ },
207
+ teal: {
208
+ 50: "240 253 250",
209
+ 100: "204 251 241",
210
+ 200: "153 246 228",
211
+ 300: "94 234 212",
212
+ 400: "45 212 191",
213
+ 500: "20 184 166",
214
+ 600: "13 148 136",
215
+ 700: "15 118 110",
216
+ 800: "17 94 89",
217
+ 900: "19 78 74"
218
+ },
219
+ cyan: {
220
+ 50: "236 254 255",
221
+ 100: "207 250 254",
222
+ 200: "165 243 252",
223
+ 300: "103 232 249",
224
+ 400: "34 211 238",
225
+ 500: "6 182 212",
226
+ 600: "8 145 178",
227
+ 700: "14 116 144",
228
+ 800: "21 94 117",
229
+ 900: "22 78 99"
230
+ },
231
+ sky: {
232
+ 50: "240 249 255",
233
+ 100: "224 242 254",
234
+ 200: "186 230 253",
235
+ 300: "125 211 252",
236
+ 400: "56 189 248",
237
+ 500: "14 165 233",
238
+ 600: "2 132 199",
239
+ 700: "3 105 161",
240
+ 800: "7 89 133",
241
+ 900: "12 74 110"
242
+ },
243
+ blue: {
244
+ 50: "239 246 255",
245
+ 100: "219 234 254",
246
+ 200: "191 219 254",
247
+ 300: "147 197 253",
248
+ 400: "96 165 250",
249
+ 500: "59 130 246",
250
+ 600: "37 99 235",
251
+ 700: "29 78 216",
252
+ 800: "30 64 175",
253
+ 900: "30 58 138"
254
+ },
255
+ indigo: {
256
+ 50: "238 242 255",
257
+ 100: "224 231 255",
258
+ 200: "199 210 254",
259
+ 300: "165 180 252",
260
+ 400: "129 140 248",
261
+ 500: "99 102 241",
262
+ 600: "79 70 229",
263
+ 700: "67 56 202",
264
+ 800: "55 48 163",
265
+ 900: "49 46 129"
266
+ },
267
+ violet: {
268
+ 50: "245 243 255",
269
+ 100: "237 233 254",
270
+ 200: "221 214 254",
271
+ 300: "196 181 253",
272
+ 400: "167 139 250",
273
+ 500: "139 92 246",
274
+ 600: "124 58 237",
275
+ 700: "109 40 217",
276
+ 800: "91 33 182",
277
+ 900: "76 29 149"
278
+ },
279
+ purple: {
280
+ 50: "250 245 255",
281
+ 100: "243 232 255",
282
+ 200: "233 213 255",
283
+ 300: "216 180 254",
284
+ 400: "192 132 252",
285
+ 500: "168 85 247",
286
+ 600: "147 51 234",
287
+ 700: "126 34 206",
288
+ 800: "107 33 168",
289
+ 900: "88 28 135"
290
+ },
291
+ fuchsia: {
292
+ 50: "253 244 255",
293
+ 100: "250 232 255",
294
+ 200: "245 208 254",
295
+ 300: "240 171 252",
296
+ 400: "232 121 249",
297
+ 500: "217 70 239",
298
+ 600: "192 38 211",
299
+ 700: "162 28 175",
300
+ 800: "134 25 143",
301
+ 900: "112 26 117"
302
+ },
303
+ pink: {
304
+ 50: "253 242 248",
305
+ 100: "252 231 243",
306
+ 200: "251 207 232",
307
+ 300: "249 168 212",
308
+ 400: "244 114 182",
309
+ 500: "236 72 153",
310
+ 600: "219 39 119",
311
+ 700: "190 24 93",
312
+ 800: "157 23 77",
313
+ 900: "131 24 67"
314
+ },
315
+ rose: {
316
+ 50: "255 241 242",
317
+ 100: "255 228 230",
318
+ 200: "254 205 211",
319
+ 300: "253 164 175",
320
+ 400: "251 113 133",
321
+ 500: "244 63 94",
322
+ 600: "225 29 72",
323
+ 700: "190 18 60",
324
+ 800: "159 18 57",
325
+ 900: "136 19 55"
326
+ }
327
+ };
328
+
329
+ /**
330
+ * The general color palette
331
+ * Should be available in most if not all colored components
159
332
  */
160
- function getValuesFromDesignToken(designToken) {
161
- var _a;
162
-
163
- if (typeof designToken === "string" && designToken.includes("var(")) {
164
- const regex = /var\((.*?)\)/g;
165
- const root = document.documentElement;
166
- const match = regex.exec(designToken);
167
- const tokenValue = getComputedStyle(root).getPropertyValue((_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : designToken);
168
- return tokenValue;
333
+
334
+ const generalPalette = {
335
+ PRIMARY: tailwindPalette.blue,
336
+ SECONDARY: tailwindPalette.slate,
337
+ ACCENT: tailwindPalette.cyan,
338
+ NEUTRAL: tailwindPalette.neutral,
339
+ BLACK: {
340
+ DEFAULT: "26 27 28"
341
+ },
342
+ WHITE: {
343
+ DEFAULT: "255 255 255"
169
344
  }
345
+ };
346
+ /**
347
+ * The intent color palette
348
+ * Should be available for most colored components such as "Button", "Alert", "Indicator", "Badge"
349
+ */
170
350
 
171
- return designToken;
172
- }
351
+ const intentPalette = {
352
+ INFO: tailwindPalette.blue,
353
+ SUCCESS: tailwindPalette.green,
354
+ WARNING: tailwindPalette.amber,
355
+ DANGER: tailwindPalette.red
356
+ };
357
+ /**
358
+ * The Criticality color palette
359
+ * Should be available in any component that could be used to display the criticality of an asset or event
360
+ */
361
+
362
+ const criticalityPalette = {
363
+ GOOD: tailwindPalette.emerald,
364
+ LOW: tailwindPalette.amber,
365
+ CRITICAL: tailwindPalette.red
366
+ };
367
+ /**
368
+ * The Activity color palette
369
+ * Should be available in any component that could be used to display the Activity state of an asset
370
+ */
371
+
372
+ const activityPalette = {
373
+ WORKING: tailwindPalette.blue,
374
+ IDLE: tailwindPalette.orange,
375
+ STOPPED: tailwindPalette.violet,
376
+ UNKNOWN: tailwindPalette.neutral,
377
+ MOVING: {
378
+ DEFAULT: "230 144 177"
379
+ },
380
+ ACTIVE: {
381
+ DEFAULT: "63 219 147"
382
+ }
383
+ };
384
+ /**
385
+ * The Rental status color palette
386
+ * Should be available in any component that could be used to display the rental status of an asset
387
+ */
173
388
 
174
- const breakpoints = {
175
- xs: 0,
176
- sm: 480,
177
- md: 768,
178
- lg: 1024,
179
- xl: 1200,
180
- xxl: 1600,
181
- xxxl: 1900 // full HD
389
+ const rentalStatusPalette = {
390
+ ON_RENT: {
391
+ 100: "223 244 254",
392
+ 600: "90 200 250"
393
+ },
394
+ RETURNED: {
395
+ 100: "230 202 255",
396
+ 600: "176 90 255"
397
+ },
398
+ AVAILABLE: {
399
+ 100: "206 255 232",
400
+ 600: "0 166 88"
401
+ },
402
+ PICKUP_READY: {
403
+ 100: "255 236 209",
404
+ 600: "255 149 0"
405
+ },
406
+ TRANSFER: {
407
+ 100: "255 248 217",
408
+ 600: "253 208 8"
409
+ },
410
+ IN_REPAIR: {
411
+ 100: "255 233 233",
412
+ 600: "255 90 90"
413
+ },
414
+ OTHER_RENTAL_STATUS: {
415
+ 100: "238 239 239",
416
+ 600: "151 154 154"
417
+ }
418
+ };
419
+ /**
420
+ * Grouped Theme Colors
421
+ */
182
422
 
423
+ const groupedPalettes = {
424
+ // General
425
+ GENERAL: generalPalette,
426
+ // UI Intent
427
+ INTENT: intentPalette,
428
+ // Asset Criticality
429
+ CRITICALITY: criticalityPalette,
430
+ // Activity
431
+ ACTIVITY: activityPalette,
432
+ // Rental
433
+ RENTAL: rentalStatusPalette
183
434
  };
184
435
  /**
185
- * Track units media queries.
436
+ * The full theme color palette (flattened)
437
+ */
438
+
439
+ const trackunitPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, generalPalette), intentPalette), criticalityPalette), activityPalette), rentalStatusPalette);
440
+
441
+ /**
442
+ * A collection of all the tokens related to the named colors in the default theme.
443
+ */
444
+ /**
445
+ * An object of all the Trackunit Theme colors and their available variants.
446
+ * These colors does not include the default tailwind colors.
186
447
  */
187
448
 
188
- const mediaQuery = generateMedia({
189
- xs: breakpoints.xs + "px",
190
- sm: breakpoints.sm + "px",
191
- md: breakpoints.md + "px",
192
- lg: breakpoints.lg + "px",
193
- xl: breakpoints.xl + "px",
194
- xxl: breakpoints.xxl + "px",
195
- xxxl: breakpoints.xxxl + "px" // full HD
196
-
197
- });
198
- const windowWidth = {
199
- lessThan: size => {
200
- return window.innerWidth < breakpoints[size];
201
- },
202
- greaterThan: size => {
203
- return window.innerWidth > breakpoints[size];
204
- },
205
- between: (first, second) => {
206
- return window.innerWidth < breakpoints[first] && window.innerWidth < breakpoints[second];
449
+ const themeColors = {
450
+ PRIMARY: {
451
+ name: "primary",
452
+ variants: trackunitPalette.PRIMARY
453
+ },
454
+ SECONDARY: {
455
+ name: "secondary",
456
+ variants: trackunitPalette.SECONDARY
457
+ },
458
+ ACCENT: {
459
+ name: "accent",
460
+ variants: trackunitPalette.ACCENT
461
+ },
462
+ NEUTRAL: {
463
+ name: "neutral",
464
+ variants: trackunitPalette.NEUTRAL
465
+ },
466
+ BLACK: {
467
+ name: "black",
468
+ variants: trackunitPalette.BLACK,
469
+ defaultVariant: "DEFAULT"
470
+ },
471
+ WHITE: {
472
+ name: "white",
473
+ variants: trackunitPalette.WHITE,
474
+ defaultVariant: "DEFAULT"
475
+ },
476
+ INFO: {
477
+ name: "info",
478
+ variants: trackunitPalette.INFO
479
+ },
480
+ SUCCESS: {
481
+ name: "success",
482
+ variants: trackunitPalette.SUCCESS
483
+ },
484
+ WARNING: {
485
+ name: "warning",
486
+ variants: trackunitPalette.WARNING
487
+ },
488
+ DANGER: {
489
+ name: "danger",
490
+ variants: trackunitPalette.DANGER
491
+ },
492
+ GOOD: {
493
+ name: "good",
494
+ variants: trackunitPalette.GOOD
495
+ },
496
+ LOW: {
497
+ name: "low",
498
+ variants: trackunitPalette.LOW
499
+ },
500
+ CRITICAL: {
501
+ name: "critical",
502
+ variants: trackunitPalette.CRITICAL
503
+ },
504
+ WORKING: {
505
+ name: "working",
506
+ variants: trackunitPalette.WORKING
507
+ },
508
+ IDLE: {
509
+ name: "idle",
510
+ variants: trackunitPalette.IDLE
511
+ },
512
+ STOPPED: {
513
+ name: "stopped",
514
+ variants: trackunitPalette.STOPPED
515
+ },
516
+ ACTIVE: {
517
+ name: "active",
518
+ variants: trackunitPalette.ACTIVE,
519
+ defaultVariant: "DEFAULT"
520
+ },
521
+ MOVING: {
522
+ name: "moving",
523
+ variants: trackunitPalette.MOVING,
524
+ defaultVariant: "DEFAULT"
525
+ },
526
+ UNKNOWN: {
527
+ name: "unknown",
528
+ variants: trackunitPalette.UNKNOWN
529
+ },
530
+ AVAILABLE: {
531
+ name: "available",
532
+ variants: trackunitPalette.AVAILABLE
533
+ },
534
+ IN_REPAIR: {
535
+ name: "in_repair",
536
+ variants: trackunitPalette.IN_REPAIR
537
+ },
538
+ ON_RENT: {
539
+ name: "on_rent",
540
+ variants: trackunitPalette.ON_RENT
541
+ },
542
+ OTHER_RENTAL_STATUS: {
543
+ name: "other_rental_status",
544
+ variants: trackunitPalette.OTHER_RENTAL_STATUS
545
+ },
546
+ PICKUP_READY: {
547
+ name: "pickup_ready",
548
+ variants: trackunitPalette.PICKUP_READY
549
+ },
550
+ RETURNED: {
551
+ name: "returned",
552
+ variants: trackunitPalette.RETURNED
553
+ },
554
+ TRANSFER: {
555
+ name: "transfer",
556
+ variants: trackunitPalette.TRANSFER
207
557
  }
208
558
  };
209
- /*
210
- --------
211
- TAILWIND
212
- --------
213
- sm 640px @media (min-width: 640px) { ... }
214
- md 768px @media (min-width: 768px) { ... }
215
- lg 1024px @media (min-width: 1024px) { ... }
216
- xl 1280px @media (min-width: 1280px) { ... }
217
- 2xl 1536px @media (min-width: 1536px) { ... }
218
- */
219
-
220
- /*
221
- --------
222
- FLUENTUI
223
- --------
224
- small 320px - 479px
225
- medium 480px - 639px
226
- large 640px - 1023px
227
- extra large 1024px - 1365px
228
- extra extra large 1366px - 1919px
229
- extra extra extra large 1920px and up
230
- */
559
+
560
+ const outputOptions = ["HEX", "CSS"];
561
+
562
+ function color(ColorKey, arg2, arg3) {
563
+ var _a, _b;
564
+
565
+ const colorName = themeColors[ColorKey].name;
566
+ const colorVariants = themeColors[ColorKey].variants; // defaultVariant or 600 or the "middel" value available.
567
+
568
+ 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
+ let variant = defaultVariant;
570
+ let output = "CSS";
571
+
572
+ if (isOutputOption(arg2)) {
573
+ output = arg2;
574
+ } else {
575
+ if (isOutputOption(arg3)) {
576
+ output = arg3;
577
+ }
578
+
579
+ if (isValidVariant(colorVariants, arg2)) {
580
+ variant = arg2;
581
+ }
582
+ }
583
+
584
+ if (output === "CSS") {
585
+ return colorVariableToCss(`--color-${colorName}-${String(variant)}`);
586
+ }
587
+
588
+ if (output === "HEX") {
589
+ return getHEX(`--color-${colorName}-${String(variant)}`);
590
+ }
591
+
592
+ return colorName;
593
+ }
594
+
595
+ const isOutputOption = something => typeof something === "string" && outputOptions.includes(something);
596
+
597
+ const isValidVariant = (availableVariants, something) => Boolean(availableVariants[something]);
231
598
 
232
599
  /**
233
- --------
234
- BOOTSTRAP
235
- --------
236
- grid-breakpoints: (
237
- xs: 0,
238
- sm: 576px,
239
- md: 768px,
240
- lg: 992px,
241
- xl: 1200px,
242
- xxl: 1400px
243
- );
600
+ * Elevation is based on N100 with an alpha channel. E(X)A variants
601
+ * are for active versions(e.g. hover).
244
602
  */
603
+ const elevation = {
604
+ E05: "var(--box-shadow-sm)",
605
+ E10: "var(--box-shadow-DEFAULT)",
606
+ E10A: "var(--box-shadow-md)",
607
+ E20: "var(--box-shadow-lg)",
608
+ E30: "var(--box-shadow-xl)",
609
+ E40: "var(--box-shadow-2xl)"
610
+ };
245
611
 
246
612
  const size = {
247
613
  /** --spacing-0: 0px; */
@@ -300,7 +666,6 @@ const zIndex = {
300
666
  };
301
667
 
302
668
  const tokens = {
303
- colors,
304
669
  size,
305
670
  fontSize,
306
671
  fontWeight,
@@ -309,4 +674,4 @@ const tokens = {
309
674
  fontFamily: `'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif`
310
675
  };
311
676
 
312
- export { DEFAULT_CHART_COLORS, black, blue, breakpoints, colors, elevation, fontSize, fontWeight, getColorValue, getHEX, getReorderedChartColors, getValuesFromDesignToken, green, mediaQuery, neutral, orange, purple, red, size, tokens, utilization, white, windowWidth, zIndex };
677
+ export { DEFAULT_CHART_COLORS, activityPalette, color, criticalityPalette, elevation, fontSize, fontWeight, generalPalette, getReorderedChartColors, groupedPalettes, intentPalette, rentalStatusPalette, tailwindPalette, themeColors, tokens, trackunitPalette };