@trackunit/react-components 0.1.171 → 0.1.172
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 +189 -189
- package/index.esm.js +189 -189
- package/package.json +5 -5
- package/src/components/DayPicker/DayPickerPopover.d.ts +1 -1
- package/src/components/Icon/Icon.d.ts +6 -1
- package/src/components/Menu/MenuList/MenuList.d.ts +1 -1
- package/src/components/ValueBar/index.d.ts +1 -1
- package/src/components/buttons/index.d.ts +1 -1
- package/src/components/index.d.ts +1 -1
- package/src/index.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
|
|
8
7
|
var uiDesignTokens = require('@trackunit/ui-design-tokens');
|
|
9
8
|
var uiIcons = require('@trackunit/ui-icons');
|
|
10
9
|
var IconSpriteOutline = require('@trackunit/ui-icons/icons-sprite-outline.svg');
|
|
11
10
|
var IconSpriteSolid = require('@trackunit/ui-icons/icons-sprite-solid.svg');
|
|
11
|
+
var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
|
|
12
12
|
var ReactDOM = require('react-dom');
|
|
13
13
|
var reactRouterDom = require('react-router-dom');
|
|
14
14
|
|
|
@@ -65,6 +65,114 @@ const useContainerProps = ({ className, dataTestId }) => {
|
|
|
65
65
|
return containerProps;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
69
|
+
variants: {
|
|
70
|
+
color: {
|
|
71
|
+
primary: "text-primary-600",
|
|
72
|
+
secondary: "text-secondary-600",
|
|
73
|
+
accent: "text-accent-600",
|
|
74
|
+
neutral: "text-neutral-600",
|
|
75
|
+
info: "text-info-600",
|
|
76
|
+
success: "text-success-600",
|
|
77
|
+
warning: "text-warning-600",
|
|
78
|
+
danger: "text-danger-600",
|
|
79
|
+
good: "text-good-600",
|
|
80
|
+
low: "text-low-600",
|
|
81
|
+
critical: "text-critical-600",
|
|
82
|
+
working: "text-working-600",
|
|
83
|
+
idle: "text-idle-600",
|
|
84
|
+
moving: "text-moving",
|
|
85
|
+
active: "text-active",
|
|
86
|
+
stopped: "text-stopped-600",
|
|
87
|
+
unknown: "text-unknown-600",
|
|
88
|
+
default: "text-current",
|
|
89
|
+
black: "text-black",
|
|
90
|
+
white: "text-white",
|
|
91
|
+
unused: {
|
|
92
|
+
300: "text-red-300",
|
|
93
|
+
400: "text-red-400",
|
|
94
|
+
},
|
|
95
|
+
utilized: { 400: "text-blue-400", 600: "text-blue-600" },
|
|
96
|
+
heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
|
|
97
|
+
unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
|
|
98
|
+
site: {
|
|
99
|
+
area: "text-blue-600",
|
|
100
|
+
classic_poi: "text-neutral-500",
|
|
101
|
+
classic_zone: "text-neutral-500",
|
|
102
|
+
depot: "text-emerald-500",
|
|
103
|
+
work_place: "text-violet-600",
|
|
104
|
+
construction_site: "text-amber-500",
|
|
105
|
+
unknown: "text-neutral-500",
|
|
106
|
+
},
|
|
107
|
+
on_rent: { 100: uiDesignTokens.rentalStatusPalette.ON_RENT[100], 600: uiDesignTokens.rentalStatusPalette.ON_RENT[600] },
|
|
108
|
+
returned: { 100: uiDesignTokens.rentalStatusPalette.RETURNED[100], 600: uiDesignTokens.rentalStatusPalette.RETURNED[600] },
|
|
109
|
+
available: { 100: uiDesignTokens.rentalStatusPalette.AVAILABLE[100], 600: uiDesignTokens.rentalStatusPalette.AVAILABLE[600] },
|
|
110
|
+
pickup_ready: { 100: uiDesignTokens.rentalStatusPalette.PICKUP_READY[100], 600: uiDesignTokens.rentalStatusPalette.PICKUP_READY[600] },
|
|
111
|
+
transfer: { 100: uiDesignTokens.rentalStatusPalette.TRANSFER[100], 600: uiDesignTokens.rentalStatusPalette.TRANSFER[600] },
|
|
112
|
+
in_repair: { 100: uiDesignTokens.rentalStatusPalette.IN_REPAIR[100], 600: uiDesignTokens.rentalStatusPalette.IN_REPAIR[600] },
|
|
113
|
+
other_rental_status: {
|
|
114
|
+
100: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
|
|
115
|
+
600: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
size: {
|
|
119
|
+
small: "w-4",
|
|
120
|
+
medium: "w-5",
|
|
121
|
+
large: "w-6",
|
|
122
|
+
font: "w-[1em]",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
defaultVariants: {
|
|
126
|
+
color: "default",
|
|
127
|
+
size: "large",
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
cssClassVarianceUtilities.cvaMerge([], {
|
|
131
|
+
variants: {
|
|
132
|
+
iconType: {
|
|
133
|
+
solid: "fill-current stroke-transparent",
|
|
134
|
+
outline: "fill-transparent stroke-current",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
cssClassVarianceUtilities.cvaMerge([
|
|
139
|
+
"relative",
|
|
140
|
+
"aspect-square",
|
|
141
|
+
"after:content-['']",
|
|
142
|
+
"after:absolute",
|
|
143
|
+
"after:h-2",
|
|
144
|
+
"after:w-2",
|
|
145
|
+
"after:bg-current",
|
|
146
|
+
"after:rounded-full",
|
|
147
|
+
"after:inset-1/2",
|
|
148
|
+
"after:-translate-x-1/2",
|
|
149
|
+
"after:-translate-y-1/2",
|
|
150
|
+
"after:opacity-50",
|
|
151
|
+
]);
|
|
152
|
+
|
|
153
|
+
const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, uiDesignTokens.intentPalette), uiDesignTokens.generalPalette), uiDesignTokens.criticalityPalette), uiDesignTokens.activityPalette), uiDesignTokens.utilizationPalette), uiDesignTokens.sitesPalette), uiDesignTokens.rentalStatusPalette);
|
|
154
|
+
const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
|
|
155
|
+
/**
|
|
156
|
+
* - The Icon component is used to display an Icon.
|
|
157
|
+
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
158
|
+
* - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
|
|
159
|
+
*
|
|
160
|
+
* @param {IconProps} props - The props for the Icon component
|
|
161
|
+
* @returns {JSX.Element} Icon component
|
|
162
|
+
*/
|
|
163
|
+
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
|
|
164
|
+
const correctIconType = React__namespace.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
|
|
165
|
+
const iconName = uiIcons.iconNames[name];
|
|
166
|
+
if (!iconName) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const href = {
|
|
170
|
+
solid: `${IconSpriteSolid__default["default"]}#${iconName}`,
|
|
171
|
+
outline: `${IconSpriteOutline__default["default"]}#${iconName}`,
|
|
172
|
+
};
|
|
173
|
+
return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsxRuntime.jsx("use", { href: href[correctIconType] }) }) }));
|
|
174
|
+
};
|
|
175
|
+
|
|
68
176
|
/******************************************************************************
|
|
69
177
|
Copyright (c) Microsoft Corporation.
|
|
70
178
|
|
|
@@ -102,6 +210,85 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
102
210
|
});
|
|
103
211
|
}
|
|
104
212
|
|
|
213
|
+
const cvaText = cssClassVarianceUtilities.cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
|
|
214
|
+
variants: {
|
|
215
|
+
align: {
|
|
216
|
+
left: "text-left",
|
|
217
|
+
right: "text-right",
|
|
218
|
+
center: "text-center",
|
|
219
|
+
},
|
|
220
|
+
italic: {
|
|
221
|
+
true: "italic",
|
|
222
|
+
false: "",
|
|
223
|
+
},
|
|
224
|
+
uppercase: {
|
|
225
|
+
true: "uppercase",
|
|
226
|
+
false: "",
|
|
227
|
+
},
|
|
228
|
+
underline: {
|
|
229
|
+
true: [
|
|
230
|
+
"underline",
|
|
231
|
+
"after:bg-inherit",
|
|
232
|
+
"after:content-none",
|
|
233
|
+
"after:absolute",
|
|
234
|
+
"after:w-full",
|
|
235
|
+
"after:h-0.5",
|
|
236
|
+
"after:bottom-0",
|
|
237
|
+
"after:left-0",
|
|
238
|
+
],
|
|
239
|
+
false: "",
|
|
240
|
+
},
|
|
241
|
+
weight: {
|
|
242
|
+
normal: "font-normal",
|
|
243
|
+
bold: "font-medium",
|
|
244
|
+
thick: "font-semibold",
|
|
245
|
+
},
|
|
246
|
+
size: {
|
|
247
|
+
small: "text-xs",
|
|
248
|
+
medium: "text-sm",
|
|
249
|
+
large: "text-base",
|
|
250
|
+
},
|
|
251
|
+
inverted: {
|
|
252
|
+
true: "text-white",
|
|
253
|
+
false: "",
|
|
254
|
+
},
|
|
255
|
+
subtle: {
|
|
256
|
+
true: "opacity-70",
|
|
257
|
+
false: "",
|
|
258
|
+
},
|
|
259
|
+
disabled: {
|
|
260
|
+
true: "opacity-50",
|
|
261
|
+
false: "",
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* The Text component is used to apply Trackunit default typography styles to text.
|
|
268
|
+
*
|
|
269
|
+
* ### When to use
|
|
270
|
+
*
|
|
271
|
+
* Use Text when you want to show a text section, use Heading if you want to show a heading.
|
|
272
|
+
*
|
|
273
|
+
* @param {TextProps} props - The props for the Text component
|
|
274
|
+
* @returns {JSX.Element} Text component
|
|
275
|
+
*/
|
|
276
|
+
const Text = (_a) => {
|
|
277
|
+
var { children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId } = _a, rest = __rest$1(_a, ["children", "type", "size", "align", "weight", "underline", "inverted", "subtle", "italicize", "uppercase", "disabled", "className", "dataTestId"]);
|
|
278
|
+
return React__namespace.createElement(type, Object.assign({ className: cvaText({
|
|
279
|
+
inverted,
|
|
280
|
+
uppercase,
|
|
281
|
+
align,
|
|
282
|
+
italic: italicize,
|
|
283
|
+
size,
|
|
284
|
+
underline,
|
|
285
|
+
weight,
|
|
286
|
+
subtle,
|
|
287
|
+
disabled,
|
|
288
|
+
className,
|
|
289
|
+
}), "data-testid": dataTestId, children }, rest));
|
|
290
|
+
};
|
|
291
|
+
|
|
105
292
|
const cvaSpinner = cssClassVarianceUtilities.cvaMerge([
|
|
106
293
|
"bg-transparent",
|
|
107
294
|
"rounded-full",
|
|
@@ -368,114 +555,6 @@ const IconButton = React__namespace.forwardRef((_a, ref) => {
|
|
|
368
555
|
return (jsxRuntime.jsx(Button$1, Object.assign({ size: size, square: square, disabled: disabled || loading, ref: ref }, rest, { children: jsxRuntime.jsx("div", { className: cvaIconButtonContainer({ size }), children: loading ? jsxRuntime.jsx(Spinner, { size: size }) : icon }) })));
|
|
369
556
|
});
|
|
370
557
|
|
|
371
|
-
const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
372
|
-
variants: {
|
|
373
|
-
color: {
|
|
374
|
-
primary: "text-primary-600",
|
|
375
|
-
secondary: "text-secondary-600",
|
|
376
|
-
accent: "text-accent-600",
|
|
377
|
-
neutral: "text-neutral-600",
|
|
378
|
-
info: "text-info-600",
|
|
379
|
-
success: "text-success-600",
|
|
380
|
-
warning: "text-warning-600",
|
|
381
|
-
danger: "text-danger-600",
|
|
382
|
-
good: "text-good-600",
|
|
383
|
-
low: "text-low-600",
|
|
384
|
-
critical: "text-critical-600",
|
|
385
|
-
working: "text-working-600",
|
|
386
|
-
idle: "text-idle-600",
|
|
387
|
-
moving: "text-moving",
|
|
388
|
-
active: "text-active",
|
|
389
|
-
stopped: "text-stopped-600",
|
|
390
|
-
unknown: "text-unknown-600",
|
|
391
|
-
default: "text-current",
|
|
392
|
-
black: "text-black",
|
|
393
|
-
white: "text-white",
|
|
394
|
-
unused: {
|
|
395
|
-
300: "text-red-300",
|
|
396
|
-
400: "text-red-400",
|
|
397
|
-
},
|
|
398
|
-
utilized: { 400: "text-blue-400", 600: "text-blue-600" },
|
|
399
|
-
heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
|
|
400
|
-
unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
|
|
401
|
-
site: {
|
|
402
|
-
area: "text-blue-600",
|
|
403
|
-
classic_poi: "text-neutral-500",
|
|
404
|
-
classic_zone: "text-neutral-500",
|
|
405
|
-
depot: "text-emerald-500",
|
|
406
|
-
work_place: "text-violet-600",
|
|
407
|
-
construction_site: "text-amber-500",
|
|
408
|
-
unknown: "text-neutral-500",
|
|
409
|
-
},
|
|
410
|
-
on_rent: { 100: uiDesignTokens.rentalStatusPalette.ON_RENT[100], 600: uiDesignTokens.rentalStatusPalette.ON_RENT[600] },
|
|
411
|
-
returned: { 100: uiDesignTokens.rentalStatusPalette.RETURNED[100], 600: uiDesignTokens.rentalStatusPalette.RETURNED[600] },
|
|
412
|
-
available: { 100: uiDesignTokens.rentalStatusPalette.AVAILABLE[100], 600: uiDesignTokens.rentalStatusPalette.AVAILABLE[600] },
|
|
413
|
-
pickup_ready: { 100: uiDesignTokens.rentalStatusPalette.PICKUP_READY[100], 600: uiDesignTokens.rentalStatusPalette.PICKUP_READY[600] },
|
|
414
|
-
transfer: { 100: uiDesignTokens.rentalStatusPalette.TRANSFER[100], 600: uiDesignTokens.rentalStatusPalette.TRANSFER[600] },
|
|
415
|
-
in_repair: { 100: uiDesignTokens.rentalStatusPalette.IN_REPAIR[100], 600: uiDesignTokens.rentalStatusPalette.IN_REPAIR[600] },
|
|
416
|
-
other_rental_status: {
|
|
417
|
-
100: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
|
|
418
|
-
600: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
|
|
419
|
-
},
|
|
420
|
-
},
|
|
421
|
-
size: {
|
|
422
|
-
small: "w-4",
|
|
423
|
-
medium: "w-5",
|
|
424
|
-
large: "w-6",
|
|
425
|
-
font: "w-[1em]",
|
|
426
|
-
},
|
|
427
|
-
},
|
|
428
|
-
defaultVariants: {
|
|
429
|
-
color: "default",
|
|
430
|
-
size: "large",
|
|
431
|
-
},
|
|
432
|
-
});
|
|
433
|
-
cssClassVarianceUtilities.cvaMerge([], {
|
|
434
|
-
variants: {
|
|
435
|
-
iconType: {
|
|
436
|
-
solid: "fill-current stroke-transparent",
|
|
437
|
-
outline: "fill-transparent stroke-current",
|
|
438
|
-
},
|
|
439
|
-
},
|
|
440
|
-
});
|
|
441
|
-
cssClassVarianceUtilities.cvaMerge([
|
|
442
|
-
"relative",
|
|
443
|
-
"aspect-square",
|
|
444
|
-
"after:content-['']",
|
|
445
|
-
"after:absolute",
|
|
446
|
-
"after:h-2",
|
|
447
|
-
"after:w-2",
|
|
448
|
-
"after:bg-current",
|
|
449
|
-
"after:rounded-full",
|
|
450
|
-
"after:inset-1/2",
|
|
451
|
-
"after:-translate-x-1/2",
|
|
452
|
-
"after:-translate-y-1/2",
|
|
453
|
-
"after:opacity-50",
|
|
454
|
-
]);
|
|
455
|
-
|
|
456
|
-
const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, uiDesignTokens.intentPalette), uiDesignTokens.generalPalette), uiDesignTokens.criticalityPalette), uiDesignTokens.activityPalette), uiDesignTokens.utilizationPalette), uiDesignTokens.sitesPalette), uiDesignTokens.rentalStatusPalette);
|
|
457
|
-
const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
|
|
458
|
-
/**
|
|
459
|
-
* - The Icon component is used to display an Icon.
|
|
460
|
-
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
461
|
-
* - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
|
|
462
|
-
*
|
|
463
|
-
* @param {IconProps} props - The props for the Icon component
|
|
464
|
-
* @returns {JSX.Element} Icon component
|
|
465
|
-
*/
|
|
466
|
-
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
|
|
467
|
-
const correctIconType = React__namespace.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
|
|
468
|
-
const iconName = uiIcons.iconNames[name];
|
|
469
|
-
if (!iconName) {
|
|
470
|
-
return null;
|
|
471
|
-
}
|
|
472
|
-
const href = {
|
|
473
|
-
solid: `${IconSpriteSolid__default["default"]}#${iconName}`,
|
|
474
|
-
outline: `${IconSpriteOutline__default["default"]}#${iconName}`,
|
|
475
|
-
};
|
|
476
|
-
return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsxRuntime.jsx("use", { href: href[correctIconType] }) }) }));
|
|
477
|
-
};
|
|
478
|
-
|
|
479
558
|
/**
|
|
480
559
|
* The StarButton component is used for favorite actions or similar.
|
|
481
560
|
*
|
|
@@ -486,85 +565,6 @@ const StarButton = ({ starred, onClick }) => {
|
|
|
486
565
|
return (jsxRuntime.jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsxRuntime.jsx(Icon, { name: "Star", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) }));
|
|
487
566
|
};
|
|
488
567
|
|
|
489
|
-
const cvaText = cssClassVarianceUtilities.cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
|
|
490
|
-
variants: {
|
|
491
|
-
align: {
|
|
492
|
-
left: "text-left",
|
|
493
|
-
right: "text-right",
|
|
494
|
-
center: "text-center",
|
|
495
|
-
},
|
|
496
|
-
italic: {
|
|
497
|
-
true: "italic",
|
|
498
|
-
false: "",
|
|
499
|
-
},
|
|
500
|
-
uppercase: {
|
|
501
|
-
true: "uppercase",
|
|
502
|
-
false: "",
|
|
503
|
-
},
|
|
504
|
-
underline: {
|
|
505
|
-
true: [
|
|
506
|
-
"underline",
|
|
507
|
-
"after:bg-inherit",
|
|
508
|
-
"after:content-none",
|
|
509
|
-
"after:absolute",
|
|
510
|
-
"after:w-full",
|
|
511
|
-
"after:h-0.5",
|
|
512
|
-
"after:bottom-0",
|
|
513
|
-
"after:left-0",
|
|
514
|
-
],
|
|
515
|
-
false: "",
|
|
516
|
-
},
|
|
517
|
-
weight: {
|
|
518
|
-
normal: "font-normal",
|
|
519
|
-
bold: "font-medium",
|
|
520
|
-
thick: "font-semibold",
|
|
521
|
-
},
|
|
522
|
-
size: {
|
|
523
|
-
small: "text-xs",
|
|
524
|
-
medium: "text-sm",
|
|
525
|
-
large: "text-base",
|
|
526
|
-
},
|
|
527
|
-
inverted: {
|
|
528
|
-
true: "text-white",
|
|
529
|
-
false: "",
|
|
530
|
-
},
|
|
531
|
-
subtle: {
|
|
532
|
-
true: "opacity-70",
|
|
533
|
-
false: "",
|
|
534
|
-
},
|
|
535
|
-
disabled: {
|
|
536
|
-
true: "opacity-50",
|
|
537
|
-
false: "",
|
|
538
|
-
},
|
|
539
|
-
},
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* The Text component is used to apply Trackunit default typography styles to text.
|
|
544
|
-
*
|
|
545
|
-
* ### When to use
|
|
546
|
-
*
|
|
547
|
-
* Use Text when you want to show a text section, use Heading if you want to show a heading.
|
|
548
|
-
*
|
|
549
|
-
* @param {TextProps} props - The props for the Text component
|
|
550
|
-
* @returns {JSX.Element} Text component
|
|
551
|
-
*/
|
|
552
|
-
const Text = (_a) => {
|
|
553
|
-
var { children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId } = _a, rest = __rest$1(_a, ["children", "type", "size", "align", "weight", "underline", "inverted", "subtle", "italicize", "uppercase", "disabled", "className", "dataTestId"]);
|
|
554
|
-
return React__namespace.createElement(type, Object.assign({ className: cvaText({
|
|
555
|
-
inverted,
|
|
556
|
-
uppercase,
|
|
557
|
-
align,
|
|
558
|
-
italic: italicize,
|
|
559
|
-
size,
|
|
560
|
-
underline,
|
|
561
|
-
weight,
|
|
562
|
-
subtle,
|
|
563
|
-
disabled,
|
|
564
|
-
className,
|
|
565
|
-
}), "data-testid": dataTestId, children }, rest));
|
|
566
|
-
};
|
|
567
|
-
|
|
568
568
|
const cvaAlert = cssClassVarianceUtilities.cvaMerge(["flex", "relative", "p-4", "rounded"], {
|
|
569
569
|
variants: {
|
|
570
570
|
color: {
|
|
@@ -19803,7 +19803,7 @@ const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex",
|
|
|
19803
19803
|
* @returns {JSX.Element} PageHeader component
|
|
19804
19804
|
*/
|
|
19805
19805
|
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, }) => {
|
|
19806
|
-
return (jsxRuntime.jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsxRuntime.jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }) })), jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsxRuntime.jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && jsxRuntime.jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag }), showLoading && jsxRuntime.jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
|
|
19806
|
+
return (jsxRuntime.jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsxRuntime.jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }) })), jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsxRuntime.jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && (jsxRuntime.jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag })), showLoading && jsxRuntime.jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
|
|
19807
19807
|
};
|
|
19808
19808
|
|
|
19809
19809
|
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
package/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useRef, useCallback, useEffect, useState, useLayoutEffect, useMemo, createContext, forwardRef, useContext, isValidElement, cloneElement, memo, Children, Component, useReducer } from 'react';
|
|
4
|
-
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
5
4
|
import { rentalStatusPalette, intentPalette, generalPalette, criticalityPalette, activityPalette, utilizationPalette, sitesPalette, color } from '@trackunit/ui-design-tokens';
|
|
6
5
|
import { iconNames } from '@trackunit/ui-icons';
|
|
7
6
|
import IconSpriteOutline from '@trackunit/ui-icons/icons-sprite-outline.svg';
|
|
8
7
|
import IconSpriteSolid from '@trackunit/ui-icons/icons-sprite-solid.svg';
|
|
8
|
+
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
9
9
|
import * as ReactDOM from 'react-dom';
|
|
10
10
|
import ReactDOM__default, { createPortal } from 'react-dom';
|
|
11
11
|
import { UNSAFE_NavigationContext } from 'react-router-dom';
|
|
@@ -36,6 +36,114 @@ const useContainerProps = ({ className, dataTestId }) => {
|
|
|
36
36
|
return containerProps;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
40
|
+
variants: {
|
|
41
|
+
color: {
|
|
42
|
+
primary: "text-primary-600",
|
|
43
|
+
secondary: "text-secondary-600",
|
|
44
|
+
accent: "text-accent-600",
|
|
45
|
+
neutral: "text-neutral-600",
|
|
46
|
+
info: "text-info-600",
|
|
47
|
+
success: "text-success-600",
|
|
48
|
+
warning: "text-warning-600",
|
|
49
|
+
danger: "text-danger-600",
|
|
50
|
+
good: "text-good-600",
|
|
51
|
+
low: "text-low-600",
|
|
52
|
+
critical: "text-critical-600",
|
|
53
|
+
working: "text-working-600",
|
|
54
|
+
idle: "text-idle-600",
|
|
55
|
+
moving: "text-moving",
|
|
56
|
+
active: "text-active",
|
|
57
|
+
stopped: "text-stopped-600",
|
|
58
|
+
unknown: "text-unknown-600",
|
|
59
|
+
default: "text-current",
|
|
60
|
+
black: "text-black",
|
|
61
|
+
white: "text-white",
|
|
62
|
+
unused: {
|
|
63
|
+
300: "text-red-300",
|
|
64
|
+
400: "text-red-400",
|
|
65
|
+
},
|
|
66
|
+
utilized: { 400: "text-blue-400", 600: "text-blue-600" },
|
|
67
|
+
heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
|
|
68
|
+
unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
|
|
69
|
+
site: {
|
|
70
|
+
area: "text-blue-600",
|
|
71
|
+
classic_poi: "text-neutral-500",
|
|
72
|
+
classic_zone: "text-neutral-500",
|
|
73
|
+
depot: "text-emerald-500",
|
|
74
|
+
work_place: "text-violet-600",
|
|
75
|
+
construction_site: "text-amber-500",
|
|
76
|
+
unknown: "text-neutral-500",
|
|
77
|
+
},
|
|
78
|
+
on_rent: { 100: rentalStatusPalette.ON_RENT[100], 600: rentalStatusPalette.ON_RENT[600] },
|
|
79
|
+
returned: { 100: rentalStatusPalette.RETURNED[100], 600: rentalStatusPalette.RETURNED[600] },
|
|
80
|
+
available: { 100: rentalStatusPalette.AVAILABLE[100], 600: rentalStatusPalette.AVAILABLE[600] },
|
|
81
|
+
pickup_ready: { 100: rentalStatusPalette.PICKUP_READY[100], 600: rentalStatusPalette.PICKUP_READY[600] },
|
|
82
|
+
transfer: { 100: rentalStatusPalette.TRANSFER[100], 600: rentalStatusPalette.TRANSFER[600] },
|
|
83
|
+
in_repair: { 100: rentalStatusPalette.IN_REPAIR[100], 600: rentalStatusPalette.IN_REPAIR[600] },
|
|
84
|
+
other_rental_status: {
|
|
85
|
+
100: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
|
|
86
|
+
600: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
size: {
|
|
90
|
+
small: "w-4",
|
|
91
|
+
medium: "w-5",
|
|
92
|
+
large: "w-6",
|
|
93
|
+
font: "w-[1em]",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
defaultVariants: {
|
|
97
|
+
color: "default",
|
|
98
|
+
size: "large",
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
cvaMerge([], {
|
|
102
|
+
variants: {
|
|
103
|
+
iconType: {
|
|
104
|
+
solid: "fill-current stroke-transparent",
|
|
105
|
+
outline: "fill-transparent stroke-current",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
cvaMerge([
|
|
110
|
+
"relative",
|
|
111
|
+
"aspect-square",
|
|
112
|
+
"after:content-['']",
|
|
113
|
+
"after:absolute",
|
|
114
|
+
"after:h-2",
|
|
115
|
+
"after:w-2",
|
|
116
|
+
"after:bg-current",
|
|
117
|
+
"after:rounded-full",
|
|
118
|
+
"after:inset-1/2",
|
|
119
|
+
"after:-translate-x-1/2",
|
|
120
|
+
"after:-translate-y-1/2",
|
|
121
|
+
"after:opacity-50",
|
|
122
|
+
]);
|
|
123
|
+
|
|
124
|
+
const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, intentPalette), generalPalette), criticalityPalette), activityPalette), utilizationPalette), sitesPalette), rentalStatusPalette);
|
|
125
|
+
const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
|
|
126
|
+
/**
|
|
127
|
+
* - The Icon component is used to display an Icon.
|
|
128
|
+
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
129
|
+
* - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
|
|
130
|
+
*
|
|
131
|
+
* @param {IconProps} props - The props for the Icon component
|
|
132
|
+
* @returns {JSX.Element} Icon component
|
|
133
|
+
*/
|
|
134
|
+
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
|
|
135
|
+
const correctIconType = React.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
|
|
136
|
+
const iconName = iconNames[name];
|
|
137
|
+
if (!iconName) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
const href = {
|
|
141
|
+
solid: `${IconSpriteSolid}#${iconName}`,
|
|
142
|
+
outline: `${IconSpriteOutline}#${iconName}`,
|
|
143
|
+
};
|
|
144
|
+
return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsx("use", { href: href[correctIconType] }) }) }));
|
|
145
|
+
};
|
|
146
|
+
|
|
39
147
|
/******************************************************************************
|
|
40
148
|
Copyright (c) Microsoft Corporation.
|
|
41
149
|
|
|
@@ -73,6 +181,85 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
73
181
|
});
|
|
74
182
|
}
|
|
75
183
|
|
|
184
|
+
const cvaText = cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
|
|
185
|
+
variants: {
|
|
186
|
+
align: {
|
|
187
|
+
left: "text-left",
|
|
188
|
+
right: "text-right",
|
|
189
|
+
center: "text-center",
|
|
190
|
+
},
|
|
191
|
+
italic: {
|
|
192
|
+
true: "italic",
|
|
193
|
+
false: "",
|
|
194
|
+
},
|
|
195
|
+
uppercase: {
|
|
196
|
+
true: "uppercase",
|
|
197
|
+
false: "",
|
|
198
|
+
},
|
|
199
|
+
underline: {
|
|
200
|
+
true: [
|
|
201
|
+
"underline",
|
|
202
|
+
"after:bg-inherit",
|
|
203
|
+
"after:content-none",
|
|
204
|
+
"after:absolute",
|
|
205
|
+
"after:w-full",
|
|
206
|
+
"after:h-0.5",
|
|
207
|
+
"after:bottom-0",
|
|
208
|
+
"after:left-0",
|
|
209
|
+
],
|
|
210
|
+
false: "",
|
|
211
|
+
},
|
|
212
|
+
weight: {
|
|
213
|
+
normal: "font-normal",
|
|
214
|
+
bold: "font-medium",
|
|
215
|
+
thick: "font-semibold",
|
|
216
|
+
},
|
|
217
|
+
size: {
|
|
218
|
+
small: "text-xs",
|
|
219
|
+
medium: "text-sm",
|
|
220
|
+
large: "text-base",
|
|
221
|
+
},
|
|
222
|
+
inverted: {
|
|
223
|
+
true: "text-white",
|
|
224
|
+
false: "",
|
|
225
|
+
},
|
|
226
|
+
subtle: {
|
|
227
|
+
true: "opacity-70",
|
|
228
|
+
false: "",
|
|
229
|
+
},
|
|
230
|
+
disabled: {
|
|
231
|
+
true: "opacity-50",
|
|
232
|
+
false: "",
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The Text component is used to apply Trackunit default typography styles to text.
|
|
239
|
+
*
|
|
240
|
+
* ### When to use
|
|
241
|
+
*
|
|
242
|
+
* Use Text when you want to show a text section, use Heading if you want to show a heading.
|
|
243
|
+
*
|
|
244
|
+
* @param {TextProps} props - The props for the Text component
|
|
245
|
+
* @returns {JSX.Element} Text component
|
|
246
|
+
*/
|
|
247
|
+
const Text = (_a) => {
|
|
248
|
+
var { children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId } = _a, rest = __rest$1(_a, ["children", "type", "size", "align", "weight", "underline", "inverted", "subtle", "italicize", "uppercase", "disabled", "className", "dataTestId"]);
|
|
249
|
+
return React.createElement(type, Object.assign({ className: cvaText({
|
|
250
|
+
inverted,
|
|
251
|
+
uppercase,
|
|
252
|
+
align,
|
|
253
|
+
italic: italicize,
|
|
254
|
+
size,
|
|
255
|
+
underline,
|
|
256
|
+
weight,
|
|
257
|
+
subtle,
|
|
258
|
+
disabled,
|
|
259
|
+
className,
|
|
260
|
+
}), "data-testid": dataTestId, children }, rest));
|
|
261
|
+
};
|
|
262
|
+
|
|
76
263
|
const cvaSpinner = cvaMerge([
|
|
77
264
|
"bg-transparent",
|
|
78
265
|
"rounded-full",
|
|
@@ -339,114 +526,6 @@ const IconButton = React.forwardRef((_a, ref) => {
|
|
|
339
526
|
return (jsx(Button$1, Object.assign({ size: size, square: square, disabled: disabled || loading, ref: ref }, rest, { children: jsx("div", { className: cvaIconButtonContainer({ size }), children: loading ? jsx(Spinner, { size: size }) : icon }) })));
|
|
340
527
|
});
|
|
341
528
|
|
|
342
|
-
const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
343
|
-
variants: {
|
|
344
|
-
color: {
|
|
345
|
-
primary: "text-primary-600",
|
|
346
|
-
secondary: "text-secondary-600",
|
|
347
|
-
accent: "text-accent-600",
|
|
348
|
-
neutral: "text-neutral-600",
|
|
349
|
-
info: "text-info-600",
|
|
350
|
-
success: "text-success-600",
|
|
351
|
-
warning: "text-warning-600",
|
|
352
|
-
danger: "text-danger-600",
|
|
353
|
-
good: "text-good-600",
|
|
354
|
-
low: "text-low-600",
|
|
355
|
-
critical: "text-critical-600",
|
|
356
|
-
working: "text-working-600",
|
|
357
|
-
idle: "text-idle-600",
|
|
358
|
-
moving: "text-moving",
|
|
359
|
-
active: "text-active",
|
|
360
|
-
stopped: "text-stopped-600",
|
|
361
|
-
unknown: "text-unknown-600",
|
|
362
|
-
default: "text-current",
|
|
363
|
-
black: "text-black",
|
|
364
|
-
white: "text-white",
|
|
365
|
-
unused: {
|
|
366
|
-
300: "text-red-300",
|
|
367
|
-
400: "text-red-400",
|
|
368
|
-
},
|
|
369
|
-
utilized: { 400: "text-blue-400", 600: "text-blue-600" },
|
|
370
|
-
heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
|
|
371
|
-
unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
|
|
372
|
-
site: {
|
|
373
|
-
area: "text-blue-600",
|
|
374
|
-
classic_poi: "text-neutral-500",
|
|
375
|
-
classic_zone: "text-neutral-500",
|
|
376
|
-
depot: "text-emerald-500",
|
|
377
|
-
work_place: "text-violet-600",
|
|
378
|
-
construction_site: "text-amber-500",
|
|
379
|
-
unknown: "text-neutral-500",
|
|
380
|
-
},
|
|
381
|
-
on_rent: { 100: rentalStatusPalette.ON_RENT[100], 600: rentalStatusPalette.ON_RENT[600] },
|
|
382
|
-
returned: { 100: rentalStatusPalette.RETURNED[100], 600: rentalStatusPalette.RETURNED[600] },
|
|
383
|
-
available: { 100: rentalStatusPalette.AVAILABLE[100], 600: rentalStatusPalette.AVAILABLE[600] },
|
|
384
|
-
pickup_ready: { 100: rentalStatusPalette.PICKUP_READY[100], 600: rentalStatusPalette.PICKUP_READY[600] },
|
|
385
|
-
transfer: { 100: rentalStatusPalette.TRANSFER[100], 600: rentalStatusPalette.TRANSFER[600] },
|
|
386
|
-
in_repair: { 100: rentalStatusPalette.IN_REPAIR[100], 600: rentalStatusPalette.IN_REPAIR[600] },
|
|
387
|
-
other_rental_status: {
|
|
388
|
-
100: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
|
|
389
|
-
600: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
|
-
size: {
|
|
393
|
-
small: "w-4",
|
|
394
|
-
medium: "w-5",
|
|
395
|
-
large: "w-6",
|
|
396
|
-
font: "w-[1em]",
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
|
-
defaultVariants: {
|
|
400
|
-
color: "default",
|
|
401
|
-
size: "large",
|
|
402
|
-
},
|
|
403
|
-
});
|
|
404
|
-
cvaMerge([], {
|
|
405
|
-
variants: {
|
|
406
|
-
iconType: {
|
|
407
|
-
solid: "fill-current stroke-transparent",
|
|
408
|
-
outline: "fill-transparent stroke-current",
|
|
409
|
-
},
|
|
410
|
-
},
|
|
411
|
-
});
|
|
412
|
-
cvaMerge([
|
|
413
|
-
"relative",
|
|
414
|
-
"aspect-square",
|
|
415
|
-
"after:content-['']",
|
|
416
|
-
"after:absolute",
|
|
417
|
-
"after:h-2",
|
|
418
|
-
"after:w-2",
|
|
419
|
-
"after:bg-current",
|
|
420
|
-
"after:rounded-full",
|
|
421
|
-
"after:inset-1/2",
|
|
422
|
-
"after:-translate-x-1/2",
|
|
423
|
-
"after:-translate-y-1/2",
|
|
424
|
-
"after:opacity-50",
|
|
425
|
-
]);
|
|
426
|
-
|
|
427
|
-
const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, intentPalette), generalPalette), criticalityPalette), activityPalette), utilizationPalette), sitesPalette), rentalStatusPalette);
|
|
428
|
-
const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
|
|
429
|
-
/**
|
|
430
|
-
* - The Icon component is used to display an Icon.
|
|
431
|
-
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
432
|
-
* - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
|
|
433
|
-
*
|
|
434
|
-
* @param {IconProps} props - The props for the Icon component
|
|
435
|
-
* @returns {JSX.Element} Icon component
|
|
436
|
-
*/
|
|
437
|
-
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
|
|
438
|
-
const correctIconType = React.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
|
|
439
|
-
const iconName = iconNames[name];
|
|
440
|
-
if (!iconName) {
|
|
441
|
-
return null;
|
|
442
|
-
}
|
|
443
|
-
const href = {
|
|
444
|
-
solid: `${IconSpriteSolid}#${iconName}`,
|
|
445
|
-
outline: `${IconSpriteOutline}#${iconName}`,
|
|
446
|
-
};
|
|
447
|
-
return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsx("use", { href: href[correctIconType] }) }) }));
|
|
448
|
-
};
|
|
449
|
-
|
|
450
529
|
/**
|
|
451
530
|
* The StarButton component is used for favorite actions or similar.
|
|
452
531
|
*
|
|
@@ -457,85 +536,6 @@ const StarButton = ({ starred, onClick }) => {
|
|
|
457
536
|
return (jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsx(Icon, { name: "Star", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) }));
|
|
458
537
|
};
|
|
459
538
|
|
|
460
|
-
const cvaText = cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-normal"], {
|
|
461
|
-
variants: {
|
|
462
|
-
align: {
|
|
463
|
-
left: "text-left",
|
|
464
|
-
right: "text-right",
|
|
465
|
-
center: "text-center",
|
|
466
|
-
},
|
|
467
|
-
italic: {
|
|
468
|
-
true: "italic",
|
|
469
|
-
false: "",
|
|
470
|
-
},
|
|
471
|
-
uppercase: {
|
|
472
|
-
true: "uppercase",
|
|
473
|
-
false: "",
|
|
474
|
-
},
|
|
475
|
-
underline: {
|
|
476
|
-
true: [
|
|
477
|
-
"underline",
|
|
478
|
-
"after:bg-inherit",
|
|
479
|
-
"after:content-none",
|
|
480
|
-
"after:absolute",
|
|
481
|
-
"after:w-full",
|
|
482
|
-
"after:h-0.5",
|
|
483
|
-
"after:bottom-0",
|
|
484
|
-
"after:left-0",
|
|
485
|
-
],
|
|
486
|
-
false: "",
|
|
487
|
-
},
|
|
488
|
-
weight: {
|
|
489
|
-
normal: "font-normal",
|
|
490
|
-
bold: "font-medium",
|
|
491
|
-
thick: "font-semibold",
|
|
492
|
-
},
|
|
493
|
-
size: {
|
|
494
|
-
small: "text-xs",
|
|
495
|
-
medium: "text-sm",
|
|
496
|
-
large: "text-base",
|
|
497
|
-
},
|
|
498
|
-
inverted: {
|
|
499
|
-
true: "text-white",
|
|
500
|
-
false: "",
|
|
501
|
-
},
|
|
502
|
-
subtle: {
|
|
503
|
-
true: "opacity-70",
|
|
504
|
-
false: "",
|
|
505
|
-
},
|
|
506
|
-
disabled: {
|
|
507
|
-
true: "opacity-50",
|
|
508
|
-
false: "",
|
|
509
|
-
},
|
|
510
|
-
},
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* The Text component is used to apply Trackunit default typography styles to text.
|
|
515
|
-
*
|
|
516
|
-
* ### When to use
|
|
517
|
-
*
|
|
518
|
-
* Use Text when you want to show a text section, use Heading if you want to show a heading.
|
|
519
|
-
*
|
|
520
|
-
* @param {TextProps} props - The props for the Text component
|
|
521
|
-
* @returns {JSX.Element} Text component
|
|
522
|
-
*/
|
|
523
|
-
const Text = (_a) => {
|
|
524
|
-
var { children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId } = _a, rest = __rest$1(_a, ["children", "type", "size", "align", "weight", "underline", "inverted", "subtle", "italicize", "uppercase", "disabled", "className", "dataTestId"]);
|
|
525
|
-
return React.createElement(type, Object.assign({ className: cvaText({
|
|
526
|
-
inverted,
|
|
527
|
-
uppercase,
|
|
528
|
-
align,
|
|
529
|
-
italic: italicize,
|
|
530
|
-
size,
|
|
531
|
-
underline,
|
|
532
|
-
weight,
|
|
533
|
-
subtle,
|
|
534
|
-
disabled,
|
|
535
|
-
className,
|
|
536
|
-
}), "data-testid": dataTestId, children }, rest));
|
|
537
|
-
};
|
|
538
|
-
|
|
539
539
|
const cvaAlert = cvaMerge(["flex", "relative", "p-4", "rounded"], {
|
|
540
540
|
variants: {
|
|
541
541
|
color: {
|
|
@@ -19774,7 +19774,7 @@ const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "i
|
|
|
19774
19774
|
* @returns {JSX.Element} PageHeader component
|
|
19775
19775
|
*/
|
|
19776
19776
|
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, }) => {
|
|
19777
|
-
return (jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "ArrowLeft" }) })), jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag }), showLoading && jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
|
|
19777
|
+
return (jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "ArrowLeft" }) })), jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && (jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag })), showLoading && jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
|
|
19778
19778
|
};
|
|
19779
19779
|
|
|
19780
19780
|
const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.172",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@floating-ui/react": "0.25.4",
|
|
11
11
|
"@trackunit/css-class-variance-utilities": "0.0.14",
|
|
12
|
-
"@trackunit/css-core": "0.0.
|
|
13
|
-
"@trackunit/shared-utils": "0.0.
|
|
14
|
-
"@trackunit/ui-design-tokens": "0.0.
|
|
15
|
-
"@trackunit/ui-icons": "0.0.
|
|
12
|
+
"@trackunit/css-core": "0.0.96",
|
|
13
|
+
"@trackunit/shared-utils": "0.0.11",
|
|
14
|
+
"@trackunit/ui-design-tokens": "0.0.78",
|
|
15
|
+
"@trackunit/ui-icons": "0.0.78",
|
|
16
16
|
"date-fns": "2.29.3",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
18
|
"react": "18.2.0",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Matcher } from "react-day-picker";
|
|
3
3
|
import { CommonProps, Size } from "../../common/CommonProps";
|
|
4
|
-
import { ButtonColor } from "../buttons";
|
|
5
4
|
import { PopoverPlacement } from "../Popover";
|
|
5
|
+
import { ButtonColor } from "../buttons";
|
|
6
6
|
export interface DayPickerPopoverProps extends CommonProps {
|
|
7
7
|
disabledDays?: Matcher | Matcher[] | undefined;
|
|
8
8
|
onDaySelect: (day: Date) => void;
|
|
@@ -190,7 +190,12 @@ export declare const iconPalette: {
|
|
|
190
190
|
readonly 300: "212 212 212";
|
|
191
191
|
readonly 400: "163 163 163";
|
|
192
192
|
readonly 500: "115 115 115";
|
|
193
|
-
readonly 600: "82 82 82";
|
|
193
|
+
readonly 600: "82 82 82"; /**
|
|
194
|
+
* The size of the icon.
|
|
195
|
+
* Small = 16x16px, medium = 20x20px, Large = 24x24px.
|
|
196
|
+
* Default value is Large.
|
|
197
|
+
* If a custom size is needed, set it in the className.
|
|
198
|
+
*/
|
|
194
199
|
readonly 700: "64 64 64";
|
|
195
200
|
readonly 800: "38 38 38";
|
|
196
201
|
readonly 900: "23 23 23";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { MenuItemProps } from "../MenuItem/MenuItem";
|
|
3
2
|
import { CommonProps } from "../../../common";
|
|
3
|
+
import { MenuItemProps } from "../MenuItem/MenuItem";
|
|
4
4
|
export interface MenuListItemProps extends MenuItemProps {
|
|
5
5
|
showDivider?: boolean;
|
|
6
6
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./Alert";
|
|
2
2
|
export * from "./Badge";
|
|
3
|
-
export * from "./buttons";
|
|
4
3
|
export * from "./Card";
|
|
5
4
|
export * from "./Collapse";
|
|
6
5
|
export * from "./CopyableText";
|
|
@@ -29,3 +28,4 @@ export * from "./Timeline/Timeline";
|
|
|
29
28
|
export * from "./Tip";
|
|
30
29
|
export * from "./Tooltip";
|
|
31
30
|
export * from "./ValueBar";
|
|
31
|
+
export * from "./buttons";
|
package/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./common";
|
|
2
2
|
export * from "./components";
|
|
3
|
-
export * from "./components/buttons/shared/Button.variants";
|
|
4
3
|
export * from "./components/Clickable/Clickable.variants";
|
|
5
4
|
export * from "./components/Indicator/Indicator.variants";
|
|
6
5
|
export * from "./components/Menu/MenuItem/MenuItem.variants";
|
|
6
|
+
export * from "./components/buttons/shared/Button.variants";
|
|
7
7
|
export * from "./hooks";
|