@trackunit/react-components 0.0.163 → 0.0.165
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/components/Alert/Alert.d.ts +1 -1
- package/components/Badge/Badge.d.ts +2 -2
- package/components/Icon/Icon.d.ts +2 -2
- package/components/Indicator/Indicator.d.ts +2 -2
- package/components/PageHeader/PageHeader.d.ts +43 -0
- package/components/PageHeader/index.d.ts +1 -0
- package/components/SectionHeader/SectionHeader.d.ts +24 -0
- package/components/SectionHeader/index.d.ts +1 -0
- package/components/Tag/Tag.d.ts +2 -2
- package/components/Tip/Tip.d.ts +10 -1
- package/components/ValueBar/ValueBarHelper.d.ts +0 -7
- package/components/buttons/shared/ButtonProps.d.ts +1 -1
- package/components/index.d.ts +2 -1
- package/index.css +11 -15
- package/index.d.ts +0 -1
- package/index.js +322 -294
- package/package.json +4 -4
- package/components/PageHeading/PageHeading.d.ts +0 -24
- package/components/PageHeading/index.d.ts +0 -1
- package/constants/colors.d.ts +0 -88
- package/constants/index.d.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { IntentColors } from "@trackunit/ui-design-tokens";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
import { IntentColors } from "../../constants";
|
|
4
4
|
export declare type AlertActionType = "primary" | "secondary";
|
|
5
5
|
export declare type AlertAction = {
|
|
6
6
|
label: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ThemeColors } from "@trackunit/ui-design-tokens";
|
|
2
3
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
import { Colors } from "../../constants/colors";
|
|
4
4
|
export declare type BadgeSize = "medium" | "large";
|
|
5
5
|
interface BaseBadgeProps extends CommonProps {
|
|
6
6
|
/**
|
|
7
7
|
* The color of the badge.
|
|
8
8
|
*/
|
|
9
|
-
color?:
|
|
9
|
+
color?: ThemeColors;
|
|
10
10
|
/**
|
|
11
11
|
* Specifies whether the badge is subtle or not.
|
|
12
12
|
* Subtle badges have a light background color wither a darker text color.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ThemeColors } from "@trackunit/ui-design-tokens";
|
|
1
2
|
import { HeroIconName, TrackunitIconName } from "@trackunit/ui-icons";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { CommonProps, Size } from "../../common/CommonProps";
|
|
4
|
-
import { Colors } from "../../constants/colors";
|
|
5
5
|
export interface IconProps extends CommonProps {
|
|
6
6
|
/**
|
|
7
7
|
* The name of the icon to be rendered.
|
|
@@ -13,7 +13,7 @@ export interface IconProps extends CommonProps {
|
|
|
13
13
|
* Supports any colors from the theme.
|
|
14
14
|
* Custom colors can be used by setting a text color in the className.
|
|
15
15
|
*/
|
|
16
|
-
color?:
|
|
16
|
+
color?: ThemeColors;
|
|
17
17
|
/**
|
|
18
18
|
* The size of the icon.
|
|
19
19
|
* Small = 16x16px, medium = 20x20px, Large = 24x24px.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ThemeColors } from "@trackunit/ui-design-tokens";
|
|
2
3
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
import { Colors } from "../../constants/colors";
|
|
4
4
|
export interface IndicatorProps extends CommonProps {
|
|
5
5
|
/**
|
|
6
6
|
* The icon to be rendered inside the indicator component
|
|
@@ -9,7 +9,7 @@ export interface IndicatorProps extends CommonProps {
|
|
|
9
9
|
/**
|
|
10
10
|
* A color token used to style the icon and the icon background
|
|
11
11
|
*/
|
|
12
|
-
color?:
|
|
12
|
+
color?: ThemeColors;
|
|
13
13
|
/**
|
|
14
14
|
* A text label to be displayed next to the indicator
|
|
15
15
|
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
export interface PageHeaderProps extends CommonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Text to be displayed in the header.
|
|
6
|
+
*/
|
|
7
|
+
title: string | React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The description to be displayed inside the tip.
|
|
10
|
+
*/
|
|
11
|
+
description?: string | React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Additional actions to be rendered along with the header.
|
|
14
|
+
*/
|
|
15
|
+
action?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* A tag that is displayed on the side of the header.
|
|
18
|
+
* A RectNode passed into the tag will be rendered as such.
|
|
19
|
+
* A string passed into the tag will render it using the tag component.
|
|
20
|
+
*/
|
|
21
|
+
tag?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether spinner should be shown while loading the data.
|
|
24
|
+
*/
|
|
25
|
+
showLoading?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Child nodes to be displayed inside the page header.
|
|
28
|
+
*/
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* The link to the previous page which will be rendered inside an IconButton component to the left of the heading.
|
|
32
|
+
*/
|
|
33
|
+
backTo?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Pageheader component is used to display a page header.
|
|
37
|
+
*
|
|
38
|
+
* PageHeader can be used to highlight the page topic, display important information about the page, and carry the action items related to the current page.
|
|
39
|
+
*
|
|
40
|
+
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
41
|
+
* @returns {JSX.Element} PageHeader component
|
|
42
|
+
*/
|
|
43
|
+
export declare const PageHeader: ({ className, dataTestId, action, showLoading, description, title, tag, backTo, children, }: PageHeaderProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PageHeader";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
import "./SectionHeader.css";
|
|
4
|
+
export interface SectionHeaderProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* The title of the section.
|
|
7
|
+
*/
|
|
8
|
+
title: string;
|
|
9
|
+
/**
|
|
10
|
+
* Subtitle of the section.
|
|
11
|
+
*/
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The addon could be used to tell the state of a section header.
|
|
15
|
+
*/
|
|
16
|
+
addon?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The SectionHeader component is used on sections to set the section title.
|
|
20
|
+
*
|
|
21
|
+
* @param {SectionHeaderProps} props - The props for the section header component
|
|
22
|
+
* @returns {JSX.Element} SectionHeader component
|
|
23
|
+
*/
|
|
24
|
+
export declare const SectionHeader: ({ title, subtitle, dataTestId, addon }: SectionHeaderProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SectionHeader";
|
package/components/Tag/Tag.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { ThemeColors } from "@trackunit/ui-design-tokens";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
import { Colors } from "../../constants/colors";
|
|
4
4
|
export declare type TagSize = "small" | "medium";
|
|
5
5
|
export interface TagProps extends CommonProps {
|
|
6
6
|
/**
|
|
7
7
|
* The color of the tag.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
color?:
|
|
10
|
+
color?: ThemeColors;
|
|
11
11
|
/**
|
|
12
12
|
* A handler for a click event triggered on X icon.
|
|
13
13
|
* If not passed then x icon won't be visible.
|
package/components/Tip/Tip.d.ts
CHANGED
|
@@ -15,11 +15,20 @@ export interface TipProps extends CommonProps {
|
|
|
15
15
|
* The props for setting the tooltip on this tip.
|
|
16
16
|
*/
|
|
17
17
|
tooltipProps?: Partial<TooltipProps>;
|
|
18
|
+
/**
|
|
19
|
+
* The element type the tip will be rendered as.
|
|
20
|
+
*/
|
|
21
|
+
renderAs?: keyof JSX.IntrinsicElements;
|
|
22
|
+
/**
|
|
23
|
+
* The href attribute if the tip is rendered as an anchor tag.
|
|
24
|
+
*/
|
|
25
|
+
link?: string | React.ReactNode;
|
|
18
26
|
}
|
|
19
27
|
/**
|
|
20
28
|
* The Tip component is used to show helpful tips or contextual information to the users.
|
|
29
|
+
* The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
|
|
21
30
|
*
|
|
22
31
|
* @param {TipProps} props - The props for the Tip component
|
|
23
32
|
* @returns {JSX.Element} Tip component
|
|
24
33
|
*/
|
|
25
|
-
export declare const Tip: ({ children, iconProps, tooltipProps, dataTestId,
|
|
34
|
+
export declare const Tip: ({ children, iconProps, tooltipProps, dataTestId, link, renderAs, className, }: TipProps) => JSX.Element;
|
|
@@ -15,13 +15,6 @@ export declare const getScore: (value: number, min: number, max: number) => numb
|
|
|
15
15
|
* @returns {string} color value
|
|
16
16
|
*/
|
|
17
17
|
export declare const getDefaultFillColor: (score: number) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Helper function to get normalized color
|
|
20
|
-
*
|
|
21
|
-
* @param {number} levelColor - color, ex --color-green-600
|
|
22
|
-
* @returns {string} normalized color value
|
|
23
|
-
*/
|
|
24
|
-
export declare const getNormalizedLevelColor: (levelColor: string) => string;
|
|
25
18
|
/**
|
|
26
19
|
* Helper function to get custom color used by the ValueBar
|
|
27
20
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
|
|
2
3
|
import { CommonProps, Size } from "../../../common/CommonProps";
|
|
3
|
-
import { GeneralColors, IntentColors } from "../../../constants";
|
|
4
4
|
export declare type ButtonVariant = "filled" | "transparent";
|
|
5
5
|
export declare type ButtonColor = Extract<GeneralColors, "primary" | "secondary"> | Extract<IntentColors, "info" | "warning" | "danger"> | "tertiary";
|
|
6
6
|
export declare type ButtonType = "button" | "submit";
|
package/components/index.d.ts
CHANGED
|
@@ -21,10 +21,11 @@ export * from "./Menu";
|
|
|
21
21
|
export * from "./Modal";
|
|
22
22
|
export * from "./NumberField/NumberField";
|
|
23
23
|
export * from "./NumberInput/NumberInput";
|
|
24
|
-
export * from "./
|
|
24
|
+
export * from "./PageHeader";
|
|
25
25
|
export * from "./Popover";
|
|
26
26
|
export * from "./Prompt";
|
|
27
27
|
export * from "./RadioGroup";
|
|
28
|
+
export * from "./SectionHeader";
|
|
28
29
|
export * from "./Select";
|
|
29
30
|
export * from "./SkeletonLines";
|
|
30
31
|
export * from "./Spacer";
|
package/index.css
CHANGED
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
px-2.5
|
|
21
21
|
h-min
|
|
22
22
|
w-min
|
|
23
|
-
drop-shadow
|
|
24
23
|
focus:ring
|
|
25
24
|
focus:ring-offset-1
|
|
26
25
|
focus:outline-none
|
|
@@ -116,10 +115,6 @@
|
|
|
116
115
|
disabled:text-slate-400;
|
|
117
116
|
}
|
|
118
117
|
|
|
119
|
-
&--transparent {
|
|
120
|
-
@apply drop-shadow-none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
118
|
&--transparent-primary {
|
|
124
119
|
@apply text-primary-600
|
|
125
120
|
hover:text-primary-700
|
|
@@ -213,16 +208,6 @@
|
|
|
213
208
|
}
|
|
214
209
|
}
|
|
215
210
|
|
|
216
|
-
.tu-pageheading {
|
|
217
|
-
@apply w-full;
|
|
218
|
-
|
|
219
|
-
&__flex{
|
|
220
|
-
@apply flex
|
|
221
|
-
items-center
|
|
222
|
-
flex-wrap-reverse
|
|
223
|
-
gap-2;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
211
|
/* CSS related to the RadioGroup component */
|
|
227
212
|
.tu-radiogroup {
|
|
228
213
|
@apply flex
|
|
@@ -334,6 +319,17 @@
|
|
|
334
319
|
}
|
|
335
320
|
}
|
|
336
321
|
|
|
322
|
+
.tu-section-header {
|
|
323
|
+
@apply w-full;
|
|
324
|
+
|
|
325
|
+
&__flex {
|
|
326
|
+
@apply flex
|
|
327
|
+
items-center
|
|
328
|
+
flex-wrap-reverse
|
|
329
|
+
gap-2;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
337
333
|
.tu-textarea {
|
|
338
334
|
@apply tu-input-base
|
|
339
335
|
block
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export { default as ValueType } from 'react-select';
|
|
|
19
19
|
import ReactAsyncCreatableSelect from 'react-select/async-creatable';
|
|
20
20
|
import ReactCreatableSelect from 'react-select/creatable';
|
|
21
21
|
import ReactAsyncSelect from 'react-select/async';
|
|
22
|
-
import {
|
|
22
|
+
import { color } from '@trackunit/ui-design-tokens';
|
|
23
23
|
|
|
24
24
|
const docs = {
|
|
25
25
|
source: {
|
|
@@ -176,11 +176,11 @@ const getStyles = () => ({
|
|
|
176
176
|
warning: tws`tu-button--warning`
|
|
177
177
|
},
|
|
178
178
|
transparent: {
|
|
179
|
-
primary: tws`tu-button--transparent
|
|
180
|
-
secondary: tws`tu-button--transparent
|
|
181
|
-
danger: tws`tu-button--transparent
|
|
182
|
-
tertiary: tws`tu-button--transparent
|
|
183
|
-
warning: tws`tu-button--transparent
|
|
179
|
+
primary: tws`tu-button--transparent-primary`,
|
|
180
|
+
secondary: tws`tu-button--transparent-secondary`,
|
|
181
|
+
danger: tws`tu-button--transparent-danger`,
|
|
182
|
+
tertiary: tws`tu-button--transparent-tertiary`,
|
|
183
|
+
warning: tws`tu-button--transparent-warning`
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
return styles[$variant][$color];
|
|
@@ -303,72 +303,6 @@ const IconContainer$2 = tw.div`
|
|
|
303
303
|
${p => p.$size === "small" ? tws`tu-button__container--small` : null}
|
|
304
304
|
`;
|
|
305
305
|
|
|
306
|
-
/**
|
|
307
|
-
* ? A collection of all the types and tokens related to the named colors in the default theme.
|
|
308
|
-
*/
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* The general color palette
|
|
312
|
-
* Should be available in most if not all colored components
|
|
313
|
-
*/
|
|
314
|
-
const generalColors = {
|
|
315
|
-
PRIMARY: "primary",
|
|
316
|
-
SECONDARY: "secondary",
|
|
317
|
-
ACCENT: "accent",
|
|
318
|
-
NEUTRAL: "neutral"
|
|
319
|
-
};
|
|
320
|
-
/**
|
|
321
|
-
* The intent color palette
|
|
322
|
-
* Should be available for most colored components such as "Button", "Alert", "Indicator", "Badge"
|
|
323
|
-
*/
|
|
324
|
-
|
|
325
|
-
const intentColors = {
|
|
326
|
-
INFO: "info",
|
|
327
|
-
SUCCESS: "success",
|
|
328
|
-
WARNING: "warning",
|
|
329
|
-
DANGER: "danger"
|
|
330
|
-
};
|
|
331
|
-
/**
|
|
332
|
-
* The Criticality color palette
|
|
333
|
-
* Should be available in any component that could be used to display the criticality of an asset or event
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
const criticalityColors = {
|
|
337
|
-
GOOD: "good",
|
|
338
|
-
LOW: "low",
|
|
339
|
-
CRITICAL: "critical"
|
|
340
|
-
};
|
|
341
|
-
/**
|
|
342
|
-
* The Activity color palette
|
|
343
|
-
* Should be available in any component that could be used to display the Activity state of an asset
|
|
344
|
-
*/
|
|
345
|
-
|
|
346
|
-
const activityColors = {
|
|
347
|
-
WORKING: "working",
|
|
348
|
-
IDLE: "idle",
|
|
349
|
-
STOPPED: "stopped",
|
|
350
|
-
UNKNOWN: "unknown"
|
|
351
|
-
};
|
|
352
|
-
/**
|
|
353
|
-
* The Rental status color palette
|
|
354
|
-
* Should be available in any component that could be used to display the rental status of an asset
|
|
355
|
-
*/
|
|
356
|
-
|
|
357
|
-
const rentalStatusColors = {
|
|
358
|
-
ON_RENT: "ON_RENT",
|
|
359
|
-
RETURNED: "RETURNED",
|
|
360
|
-
AVAILABLE: "AVAILABLE",
|
|
361
|
-
PICKUP_READY: "PICKUP_READY",
|
|
362
|
-
TRANSFER: "TRANSFER",
|
|
363
|
-
IN_REPAIR: "IN_REPAIR",
|
|
364
|
-
OTHER_RENTAL_STATUS: "OTHER_RENTAL_STATUS"
|
|
365
|
-
};
|
|
366
|
-
/**
|
|
367
|
-
* The full color palette
|
|
368
|
-
*/
|
|
369
|
-
|
|
370
|
-
const colors = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, generalColors), intentColors), criticalityColors), activityColors), rentalStatusColors);
|
|
371
|
-
|
|
372
306
|
const IconSizeClassMap = {
|
|
373
307
|
small: tws`tu-icon--small`,
|
|
374
308
|
medium: tws`tu-icon--medium`,
|
|
@@ -441,49 +375,49 @@ const Root$4 = tw.span`
|
|
|
441
375
|
$color
|
|
442
376
|
}) => {
|
|
443
377
|
switch ($color) {
|
|
444
|
-
case
|
|
378
|
+
case "primary":
|
|
445
379
|
return tws`tu-icon--primary`;
|
|
446
380
|
|
|
447
|
-
case
|
|
381
|
+
case "secondary":
|
|
448
382
|
return tws`tu-icon--secondary`;
|
|
449
383
|
|
|
450
|
-
case
|
|
384
|
+
case "accent":
|
|
451
385
|
return tws`tu-icon--accent`;
|
|
452
386
|
|
|
453
|
-
case
|
|
387
|
+
case "neutral":
|
|
454
388
|
return tws`tu-icon--neutral`;
|
|
455
389
|
|
|
456
|
-
case
|
|
390
|
+
case "info":
|
|
457
391
|
return tws`tu-icon--info`;
|
|
458
392
|
|
|
459
|
-
case
|
|
393
|
+
case "success":
|
|
460
394
|
return tws`tu-icon--success`;
|
|
461
395
|
|
|
462
|
-
case
|
|
396
|
+
case "warning":
|
|
463
397
|
return tws`tu-icon--warning`;
|
|
464
398
|
|
|
465
|
-
case
|
|
399
|
+
case "danger":
|
|
466
400
|
return tws`tu-icon--danger`;
|
|
467
401
|
|
|
468
|
-
case
|
|
402
|
+
case "good":
|
|
469
403
|
return tws`tu-icon--good`;
|
|
470
404
|
|
|
471
|
-
case
|
|
405
|
+
case "low":
|
|
472
406
|
return tws`tu-icon--low`;
|
|
473
407
|
|
|
474
|
-
case
|
|
408
|
+
case "critical":
|
|
475
409
|
return tws`tu-icon--critical`;
|
|
476
410
|
|
|
477
|
-
case
|
|
411
|
+
case "working":
|
|
478
412
|
return tws`tu-icon--working`;
|
|
479
413
|
|
|
480
|
-
case
|
|
414
|
+
case "idle":
|
|
481
415
|
return tws`tu-icon--idle`;
|
|
482
416
|
|
|
483
|
-
case
|
|
417
|
+
case "stopped":
|
|
484
418
|
return tws`tu-icon--stopped`;
|
|
485
419
|
|
|
486
|
-
case
|
|
420
|
+
case "unknown":
|
|
487
421
|
return tws`tu-icon--unknown`;
|
|
488
422
|
|
|
489
423
|
default:
|
|
@@ -1283,7 +1217,7 @@ const Body = tw.div`
|
|
|
1283
1217
|
* @returns {JSX.Element} Heading component
|
|
1284
1218
|
*/
|
|
1285
1219
|
|
|
1286
|
-
const Heading = ({
|
|
1220
|
+
const Heading$1 = ({
|
|
1287
1221
|
children,
|
|
1288
1222
|
variant = "primary",
|
|
1289
1223
|
inverted = false,
|
|
@@ -1361,13 +1295,13 @@ const CardHeader = ({
|
|
|
1361
1295
|
}, {
|
|
1362
1296
|
children: jsxs(Container$7, {
|
|
1363
1297
|
children: [jsxs("div", {
|
|
1364
|
-
children: [jsxs(HeadingContainer, {
|
|
1365
|
-
children: [jsx(Heading, Object.assign({
|
|
1298
|
+
children: [jsxs(HeadingContainer$1, {
|
|
1299
|
+
children: [jsx(Heading$1, Object.assign({
|
|
1366
1300
|
variant: headingVariant
|
|
1367
1301
|
}, {
|
|
1368
1302
|
children: heading
|
|
1369
1303
|
})), accessories]
|
|
1370
|
-
}), subHeading && jsx(Heading, Object.assign({
|
|
1304
|
+
}), subHeading && jsx(Heading$1, Object.assign({
|
|
1371
1305
|
subtle: true,
|
|
1372
1306
|
variant: "subtitle"
|
|
1373
1307
|
}, {
|
|
@@ -1392,7 +1326,7 @@ const BottomBorderedDensityContainer = twx(DensityContainer)`
|
|
|
1392
1326
|
const Container$7 = tw.div`
|
|
1393
1327
|
tu-card__header
|
|
1394
1328
|
`;
|
|
1395
|
-
const HeadingContainer = tw.div`
|
|
1329
|
+
const HeadingContainer$1 = tw.div`
|
|
1396
1330
|
tu-card__header-heading-container
|
|
1397
1331
|
`;
|
|
1398
1332
|
|
|
@@ -2270,30 +2204,39 @@ const Content = tw.div`
|
|
|
2270
2204
|
|
|
2271
2205
|
/**
|
|
2272
2206
|
* The Tip component is used to show helpful tips or contextual information to the users.
|
|
2207
|
+
* The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
|
|
2273
2208
|
*
|
|
2274
2209
|
* @param {TipProps} props - The props for the Tip component
|
|
2275
2210
|
* @returns {JSX.Element} Tip component
|
|
2276
2211
|
*/
|
|
2277
2212
|
|
|
2278
|
-
const Tip =
|
|
2279
|
-
|
|
2213
|
+
const Tip = ({
|
|
2214
|
+
children,
|
|
2215
|
+
iconProps,
|
|
2216
|
+
tooltipProps,
|
|
2217
|
+
dataTestId,
|
|
2218
|
+
link,
|
|
2219
|
+
renderAs = "span",
|
|
2220
|
+
className
|
|
2221
|
+
}) => {
|
|
2222
|
+
var _a;
|
|
2280
2223
|
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
tooltipProps,
|
|
2285
|
-
dataTestId
|
|
2286
|
-
} = _a,
|
|
2287
|
-
rest = __rest(_a, ["children", "iconProps", "tooltipProps", "dataTestId"]);
|
|
2224
|
+
const ifAnchorTag = () => {
|
|
2225
|
+
return renderAs === "a";
|
|
2226
|
+
};
|
|
2288
2227
|
|
|
2289
2228
|
return jsx(TipContainer, Object.assign({
|
|
2290
|
-
"data-testid": dataTestId
|
|
2291
|
-
|
|
2229
|
+
"data-testid": dataTestId,
|
|
2230
|
+
"$as": renderAs,
|
|
2231
|
+
href: ifAnchorTag() ? link === null || link === void 0 ? void 0 : link.toString() : undefined,
|
|
2232
|
+
target: ifAnchorTag() ? "_blank" : undefined,
|
|
2233
|
+
className: className
|
|
2234
|
+
}, {
|
|
2292
2235
|
children: jsx(Tooltip, Object.assign({
|
|
2293
2236
|
label: children,
|
|
2294
2237
|
dataTestId: `${dataTestId}-tooltip`
|
|
2295
2238
|
}, tooltipProps, {
|
|
2296
|
-
className: `${(
|
|
2239
|
+
className: `${(_a = tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className) !== null && _a !== void 0 ? _a : ""} tu-tip-tooltip`
|
|
2297
2240
|
}, {
|
|
2298
2241
|
children: jsx(Icon$1, Object.assign({
|
|
2299
2242
|
name: "QuestionMarkCircleIcon",
|
|
@@ -2303,7 +2246,7 @@ const Tip = _a => {
|
|
|
2303
2246
|
}))
|
|
2304
2247
|
}));
|
|
2305
2248
|
};
|
|
2306
|
-
const TipContainer = tw.
|
|
2249
|
+
const TipContainer = tw.text`
|
|
2307
2250
|
tu-tip
|
|
2308
2251
|
`;
|
|
2309
2252
|
|
|
@@ -2608,7 +2551,7 @@ const Indicator$1 = _a => {
|
|
|
2608
2551
|
dataTestId,
|
|
2609
2552
|
icon,
|
|
2610
2553
|
label,
|
|
2611
|
-
color =
|
|
2554
|
+
color = "unknown",
|
|
2612
2555
|
withBackground = true,
|
|
2613
2556
|
withLabel = true,
|
|
2614
2557
|
ping = false
|
|
@@ -2641,67 +2584,67 @@ const Container$4 = tw.div`
|
|
|
2641
2584
|
$color
|
|
2642
2585
|
}) => {
|
|
2643
2586
|
switch ($color) {
|
|
2644
|
-
case
|
|
2587
|
+
case "primary":
|
|
2645
2588
|
return tws`tu-indicator--primary`;
|
|
2646
2589
|
|
|
2647
|
-
case
|
|
2590
|
+
case "secondary":
|
|
2648
2591
|
return tws`tu-indicator--secondary`;
|
|
2649
2592
|
|
|
2650
|
-
case
|
|
2593
|
+
case "accent":
|
|
2651
2594
|
return tws`tu-indicator--accent`;
|
|
2652
2595
|
|
|
2653
|
-
case
|
|
2596
|
+
case "neutral":
|
|
2654
2597
|
return tws`tu-indicator--neutral`;
|
|
2655
2598
|
|
|
2656
|
-
case
|
|
2599
|
+
case "info":
|
|
2657
2600
|
return tws`tu-indicator--info`;
|
|
2658
2601
|
|
|
2659
|
-
case
|
|
2602
|
+
case "success":
|
|
2660
2603
|
return tws`tu-indicator--success`;
|
|
2661
2604
|
|
|
2662
|
-
case
|
|
2605
|
+
case "warning":
|
|
2663
2606
|
return tws`tu-indicator--warning`;
|
|
2664
2607
|
|
|
2665
|
-
case
|
|
2608
|
+
case "danger":
|
|
2666
2609
|
return tws`tu-indicator--danger`;
|
|
2667
2610
|
|
|
2668
|
-
case
|
|
2611
|
+
case "good":
|
|
2669
2612
|
return tws`tu-indicator--good`;
|
|
2670
2613
|
|
|
2671
|
-
case
|
|
2614
|
+
case "low":
|
|
2672
2615
|
return tws`tu-indicator--low`;
|
|
2673
2616
|
|
|
2674
|
-
case
|
|
2617
|
+
case "critical":
|
|
2675
2618
|
return tws`tu-indicator--critical`;
|
|
2676
2619
|
|
|
2677
|
-
case
|
|
2620
|
+
case "working":
|
|
2678
2621
|
return tws`tu-indicator--working`;
|
|
2679
2622
|
|
|
2680
|
-
case
|
|
2623
|
+
case "idle":
|
|
2681
2624
|
return tws`tu-indicator--idle`;
|
|
2682
2625
|
|
|
2683
|
-
case
|
|
2626
|
+
case "stopped":
|
|
2684
2627
|
return tws`tu-indicator--stopped`;
|
|
2685
2628
|
|
|
2686
|
-
case
|
|
2629
|
+
case "unknown":
|
|
2687
2630
|
return tws`tu-indicator--unknown`;
|
|
2688
2631
|
|
|
2689
|
-
case
|
|
2632
|
+
case "on_rent":
|
|
2690
2633
|
return tws`tu-indicator--on-rent`;
|
|
2691
2634
|
|
|
2692
|
-
case
|
|
2635
|
+
case "available":
|
|
2693
2636
|
return tws`tu-indicator--available`;
|
|
2694
2637
|
|
|
2695
|
-
case
|
|
2638
|
+
case "pickup_ready":
|
|
2696
2639
|
return tws`tu-indicator--pickup-ready`;
|
|
2697
2640
|
|
|
2698
|
-
case
|
|
2641
|
+
case "transfer":
|
|
2699
2642
|
return tws`tu-indicator--transfer`;
|
|
2700
2643
|
|
|
2701
|
-
case
|
|
2644
|
+
case "in_repair":
|
|
2702
2645
|
return tws`tu-indicator--in-repair`;
|
|
2703
2646
|
|
|
2704
|
-
case
|
|
2647
|
+
case "other_rental_status":
|
|
2705
2648
|
return tws`tu-indicator--other-rental-status`;
|
|
2706
2649
|
|
|
2707
2650
|
default:
|
|
@@ -3112,79 +3055,196 @@ const NumberField = forwardRef((_a, ref) => {
|
|
|
3112
3055
|
});
|
|
3113
3056
|
|
|
3114
3057
|
/**
|
|
3115
|
-
*
|
|
3058
|
+
* The tag component is used to categorize elements in the ui.
|
|
3116
3059
|
*
|
|
3117
|
-
*
|
|
3118
|
-
*
|
|
3060
|
+
* This could be to tell the state of an asset, or label a page as Beta.
|
|
3061
|
+
*
|
|
3062
|
+
* The tag is also used in multiselect components to show selected options.
|
|
3063
|
+
*
|
|
3064
|
+
* **Do:** Use short labels for easy scanning.
|
|
3065
|
+
*
|
|
3066
|
+
* @param {TagProps} props - The props for the tag component
|
|
3067
|
+
* @returns {JSX.Element} tag component
|
|
3119
3068
|
*/
|
|
3120
3069
|
|
|
3121
|
-
const
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3070
|
+
const Tag = React.forwardRef((_a, ref) => {
|
|
3071
|
+
var {
|
|
3072
|
+
className,
|
|
3073
|
+
dataTestId,
|
|
3074
|
+
children,
|
|
3075
|
+
size = "medium",
|
|
3076
|
+
onClose,
|
|
3077
|
+
color = "primary"
|
|
3078
|
+
} = _a;
|
|
3079
|
+
__rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
|
|
3080
|
+
|
|
3081
|
+
return jsxs(StyledText, Object.assign({
|
|
3082
|
+
className: className,
|
|
3083
|
+
"$size": size,
|
|
3084
|
+
"data-testid": `${dataTestId}-tag`,
|
|
3085
|
+
"$as": "span",
|
|
3086
|
+
"$color": color,
|
|
3087
|
+
"$withXIcon": !!onClose,
|
|
3088
|
+
ref: ref
|
|
3089
|
+
}, {
|
|
3090
|
+
children: [children, onClose && // a fix for multiselect deselecting tags working together with fade out animation
|
|
3091
|
+
jsx(IconContainer, Object.assign({
|
|
3092
|
+
onMouseDown: onClose
|
|
3093
|
+
}, {
|
|
3094
|
+
children: jsx(Icon$1, {
|
|
3095
|
+
name: "XCircleIcon",
|
|
3096
|
+
dataTestId: dataTestId + "Icon",
|
|
3097
|
+
type: "solid",
|
|
3098
|
+
style: {
|
|
3099
|
+
WebkitTransition: "-webkit-transform 0.150s"
|
|
3100
|
+
},
|
|
3101
|
+
className: size === "medium" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
|
|
3102
|
+
})
|
|
3103
|
+
}))]
|
|
3104
|
+
}));
|
|
3105
|
+
});
|
|
3106
|
+
|
|
3107
|
+
const getSizeModifierClass = () => ({
|
|
3108
|
+
$size,
|
|
3109
|
+
$withXIcon
|
|
3125
3110
|
}) => {
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3111
|
+
const tagSizeModifierClass = {
|
|
3112
|
+
medium: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
|
|
3113
|
+
small: $withXIcon ? tws`tu-tag--small tu-tag--with-icon` : tws`tu-tag--small`
|
|
3114
|
+
};
|
|
3115
|
+
return tagSizeModifierClass[$size];
|
|
3131
3116
|
};
|
|
3132
3117
|
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3118
|
+
const getColorModifierClass = () => ({
|
|
3119
|
+
$color
|
|
3135
3120
|
}) => {
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3121
|
+
const colorClasses = {
|
|
3122
|
+
primary: tws`tu-tag--primary`,
|
|
3123
|
+
secondary: tws`tu-tag--secondary`,
|
|
3124
|
+
accent: tws`tu-tag--accent`,
|
|
3125
|
+
success: tws`tu-tag--success`,
|
|
3126
|
+
danger: tws`tu-tag--danger`,
|
|
3127
|
+
warning: tws`tu-tag--warning`,
|
|
3128
|
+
info: tws`tu-tag--info`,
|
|
3129
|
+
neutral: tws`tu-tag--neutral`,
|
|
3130
|
+
good: tws`tu-tag--good`,
|
|
3131
|
+
low: tws`tu-tag--low`,
|
|
3132
|
+
critical: tws`tu-tag--critical`,
|
|
3133
|
+
working: tws`tu-tag--working`,
|
|
3134
|
+
idle: tws`tu-tag--idle`,
|
|
3135
|
+
stopped: tws`tu-tag--stopped`,
|
|
3136
|
+
unknown: tws`tu-tag--unknown`
|
|
3137
|
+
};
|
|
3138
|
+
return colorClasses[$color];
|
|
3146
3139
|
};
|
|
3147
3140
|
|
|
3148
|
-
const
|
|
3149
|
-
|
|
3150
|
-
${
|
|
3141
|
+
const StyledText = tw.span`
|
|
3142
|
+
tu-tag
|
|
3143
|
+
${getSizeModifierClass()}
|
|
3144
|
+
${getColorModifierClass()}
|
|
3145
|
+
`;
|
|
3146
|
+
const IconContainer = tw.div`
|
|
3147
|
+
tu-tag__icon-container
|
|
3151
3148
|
`;
|
|
3152
3149
|
|
|
3153
3150
|
/**
|
|
3154
|
-
*
|
|
3151
|
+
* Pageheader component is used to display a page header.
|
|
3155
3152
|
*
|
|
3156
|
-
*
|
|
3157
|
-
*
|
|
3153
|
+
* PageHeader can be used to highlight the page topic, display important information about the page, and carry the action items related to the current page.
|
|
3154
|
+
*
|
|
3155
|
+
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
3156
|
+
* @returns {JSX.Element} PageHeader component
|
|
3158
3157
|
*/
|
|
3159
3158
|
|
|
3160
|
-
const
|
|
3161
|
-
|
|
3162
|
-
subtitle,
|
|
3159
|
+
const PageHeader = ({
|
|
3160
|
+
className,
|
|
3163
3161
|
dataTestId,
|
|
3164
|
-
|
|
3162
|
+
action,
|
|
3163
|
+
showLoading,
|
|
3164
|
+
description,
|
|
3165
|
+
title,
|
|
3166
|
+
tag,
|
|
3167
|
+
backTo,
|
|
3168
|
+
children
|
|
3165
3169
|
}) => {
|
|
3166
|
-
return jsxs(
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3170
|
+
return jsxs(StyledPageHeader, Object.assign({
|
|
3171
|
+
className: className,
|
|
3172
|
+
"data-testid": dataTestId
|
|
3173
|
+
}, {
|
|
3174
|
+
children: [jsxs(HeadingAndAccessoriesContainer, Object.assign({
|
|
3175
|
+
"data-testid": `${dataTestId}-heading-container`
|
|
3176
|
+
}, {
|
|
3177
|
+
children: [jsxs(HeadingContainer, {
|
|
3178
|
+
children: [backTo && jsx(IconButton, {
|
|
3179
|
+
to: backTo,
|
|
3180
|
+
color: "tertiary",
|
|
3181
|
+
variant: "transparent",
|
|
3182
|
+
size: "small",
|
|
3183
|
+
icon: jsx(Icon$1, {
|
|
3184
|
+
name: "ArrowLeftIcon"
|
|
3185
|
+
})
|
|
3186
|
+
}), jsx(Heading, Object.assign({
|
|
3187
|
+
"data-testid": `${dataTestId}-heading`
|
|
3188
|
+
}, {
|
|
3189
|
+
children: title
|
|
3190
|
+
})), description && jsx(StyledTip, Object.assign({
|
|
3191
|
+
link: description,
|
|
3192
|
+
dataTestId: `${dataTestId}-tip`,
|
|
3193
|
+
iconProps: {
|
|
3194
|
+
name: "QuestionMarkCircleIcon"
|
|
3195
|
+
},
|
|
3196
|
+
renderAs: isValidHttpUrl(description) ? "a" : "span"
|
|
3197
|
+
}, {
|
|
3198
|
+
children: isValidHttpUrl(description) ? "Learn more" : description
|
|
3199
|
+
}))]
|
|
3200
|
+
}), tag && jsx(Tag, Object.assign({
|
|
3172
3201
|
dataTestId: dataTestId
|
|
3173
3202
|
}, {
|
|
3174
|
-
children:
|
|
3175
|
-
})),
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
}, {
|
|
3180
|
-
children:
|
|
3181
|
-
})), jsx(Spacer, {
|
|
3182
|
-
minHeight: "normal"
|
|
3203
|
+
children: tag
|
|
3204
|
+
})), showLoading && jsx(Spinner, {
|
|
3205
|
+
dataTestId: `${dataTestId}-spinner`,
|
|
3206
|
+
centered: true
|
|
3207
|
+
}), action]
|
|
3208
|
+
})), jsx(ChildContainer, {
|
|
3209
|
+
children: children
|
|
3183
3210
|
})]
|
|
3184
|
-
});
|
|
3211
|
+
}));
|
|
3212
|
+
};
|
|
3213
|
+
|
|
3214
|
+
const isValidHttpUrl = description => {
|
|
3215
|
+
if (!description || typeof description !== "string") {
|
|
3216
|
+
return false;
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
let url;
|
|
3220
|
+
|
|
3221
|
+
try {
|
|
3222
|
+
url = new URL(description);
|
|
3223
|
+
} catch (_) {
|
|
3224
|
+
return false;
|
|
3225
|
+
}
|
|
3226
|
+
|
|
3227
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
3185
3228
|
};
|
|
3186
|
-
|
|
3187
|
-
const
|
|
3229
|
+
|
|
3230
|
+
const StyledPageHeader = tw.div`
|
|
3231
|
+
tu-page-header
|
|
3232
|
+
`;
|
|
3233
|
+
const HeadingAndAccessoriesContainer = tw.div`
|
|
3234
|
+
tu-page-header__heading-accessories-container
|
|
3235
|
+
`;
|
|
3236
|
+
const HeadingContainer = tw.div`
|
|
3237
|
+
tu-page-header__heading-container
|
|
3238
|
+
`;
|
|
3239
|
+
const Heading = tw.h1`
|
|
3240
|
+
tu-page-header__heading
|
|
3241
|
+
`;
|
|
3242
|
+
const ChildContainer = tw.div`
|
|
3243
|
+
tu-page-header__child-container
|
|
3244
|
+
`;
|
|
3245
|
+
const StyledTip = twx(Tip)`
|
|
3246
|
+
${p => isValidHttpUrl(p.link) ? tws`tu-page-header__tip` : null}
|
|
3247
|
+
`;
|
|
3188
3248
|
|
|
3189
3249
|
function useConfirmExit(confirmExit, when = true) {
|
|
3190
3250
|
const {
|
|
@@ -3382,6 +3442,81 @@ ${({
|
|
|
3382
3442
|
}) => $disabled && tws`tu-radioitem__description--disabled`}
|
|
3383
3443
|
`;
|
|
3384
3444
|
|
|
3445
|
+
/**
|
|
3446
|
+
* The Spacer component is used for adding a bit of space in the ui.
|
|
3447
|
+
*
|
|
3448
|
+
* @param {SpacerProps} props - The props for the Spacer component
|
|
3449
|
+
* @returns {JSX.Element} Spacer component
|
|
3450
|
+
*/
|
|
3451
|
+
|
|
3452
|
+
const Spacer = ({
|
|
3453
|
+
minHeight,
|
|
3454
|
+
border,
|
|
3455
|
+
dataTestId
|
|
3456
|
+
}) => {
|
|
3457
|
+
return jsx(Space, {
|
|
3458
|
+
"data-testid": dataTestId,
|
|
3459
|
+
minHeight: minHeight,
|
|
3460
|
+
border: border
|
|
3461
|
+
});
|
|
3462
|
+
};
|
|
3463
|
+
|
|
3464
|
+
const GetSpacerHeight = () => ({
|
|
3465
|
+
minHeight
|
|
3466
|
+
}) => {
|
|
3467
|
+
switch (minHeight) {
|
|
3468
|
+
case "normal":
|
|
3469
|
+
return tws`tu-spacer--normal`;
|
|
3470
|
+
|
|
3471
|
+
case "large":
|
|
3472
|
+
return tws`tu-spacer--large`;
|
|
3473
|
+
|
|
3474
|
+
default:
|
|
3475
|
+
return "";
|
|
3476
|
+
}
|
|
3477
|
+
};
|
|
3478
|
+
|
|
3479
|
+
const Space = tw.div`
|
|
3480
|
+
${p => `${p.border ? `tu-spacer--border` : null}`}
|
|
3481
|
+
${GetSpacerHeight()}
|
|
3482
|
+
`;
|
|
3483
|
+
|
|
3484
|
+
/**
|
|
3485
|
+
* The SectionHeader component is used on sections to set the section title.
|
|
3486
|
+
*
|
|
3487
|
+
* @param {SectionHeaderProps} props - The props for the section header component
|
|
3488
|
+
* @returns {JSX.Element} SectionHeader component
|
|
3489
|
+
*/
|
|
3490
|
+
|
|
3491
|
+
const SectionHeader = ({
|
|
3492
|
+
title,
|
|
3493
|
+
subtitle,
|
|
3494
|
+
dataTestId,
|
|
3495
|
+
addon
|
|
3496
|
+
}) => {
|
|
3497
|
+
return jsxs(SectionHeaderContainer, {
|
|
3498
|
+
children: [jsx(Helmet, {
|
|
3499
|
+
title: title
|
|
3500
|
+
}), jsxs(StyledFlex, {
|
|
3501
|
+
children: [jsx(Heading$1, Object.assign({
|
|
3502
|
+
variant: "secondary",
|
|
3503
|
+
dataTestId: dataTestId
|
|
3504
|
+
}, {
|
|
3505
|
+
children: title
|
|
3506
|
+
})), addon]
|
|
3507
|
+
}), subtitle && jsx(Heading$1, Object.assign({
|
|
3508
|
+
variant: "subtitle",
|
|
3509
|
+
subtle: true
|
|
3510
|
+
}, {
|
|
3511
|
+
children: subtitle
|
|
3512
|
+
})), jsx(Spacer, {
|
|
3513
|
+
minHeight: "normal"
|
|
3514
|
+
})]
|
|
3515
|
+
});
|
|
3516
|
+
};
|
|
3517
|
+
const SectionHeaderContainer = tw.div`tu-section-header`;
|
|
3518
|
+
const StyledFlex = tw.div`tu-section-header__flex`;
|
|
3519
|
+
|
|
3385
3520
|
/**
|
|
3386
3521
|
* The SelectContainer component.
|
|
3387
3522
|
*
|
|
@@ -3489,99 +3624,6 @@ const SelectPrefix = tw.div`
|
|
|
3489
3624
|
tu-select__prefix
|
|
3490
3625
|
`;
|
|
3491
3626
|
|
|
3492
|
-
/**
|
|
3493
|
-
* The tag component is used to categorize elements in the ui.
|
|
3494
|
-
*
|
|
3495
|
-
* This could be to tell the state of an asset, or label a page as Beta.
|
|
3496
|
-
*
|
|
3497
|
-
* The tag is also used in multiselect components to show selected options.
|
|
3498
|
-
*
|
|
3499
|
-
* **Do:** Use short labels for easy scanning.
|
|
3500
|
-
*
|
|
3501
|
-
* @param {TagProps} props - The props for the tag component
|
|
3502
|
-
* @returns {JSX.Element} tag component
|
|
3503
|
-
*/
|
|
3504
|
-
|
|
3505
|
-
const Tag = React.forwardRef((_a, ref) => {
|
|
3506
|
-
var {
|
|
3507
|
-
className,
|
|
3508
|
-
dataTestId,
|
|
3509
|
-
children,
|
|
3510
|
-
size = "medium",
|
|
3511
|
-
onClose,
|
|
3512
|
-
color = "primary"
|
|
3513
|
-
} = _a;
|
|
3514
|
-
__rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
|
|
3515
|
-
|
|
3516
|
-
return jsxs(StyledText, Object.assign({
|
|
3517
|
-
className: className,
|
|
3518
|
-
"$size": size,
|
|
3519
|
-
"data-testid": `${dataTestId}-tag`,
|
|
3520
|
-
"$as": "span",
|
|
3521
|
-
"$color": color,
|
|
3522
|
-
"$withXIcon": !!onClose,
|
|
3523
|
-
ref: ref
|
|
3524
|
-
}, {
|
|
3525
|
-
children: [children, onClose && // a fix for multiselect deselecting tags working together with fade out animation
|
|
3526
|
-
jsx(IconContainer, Object.assign({
|
|
3527
|
-
onMouseDown: onClose
|
|
3528
|
-
}, {
|
|
3529
|
-
children: jsx(Icon$1, {
|
|
3530
|
-
name: "XCircleIcon",
|
|
3531
|
-
dataTestId: dataTestId + "Icon",
|
|
3532
|
-
type: "solid",
|
|
3533
|
-
style: {
|
|
3534
|
-
WebkitTransition: "-webkit-transform 0.150s"
|
|
3535
|
-
},
|
|
3536
|
-
className: size === "medium" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
|
|
3537
|
-
})
|
|
3538
|
-
}))]
|
|
3539
|
-
}));
|
|
3540
|
-
});
|
|
3541
|
-
|
|
3542
|
-
const getSizeModifierClass = () => ({
|
|
3543
|
-
$size,
|
|
3544
|
-
$withXIcon
|
|
3545
|
-
}) => {
|
|
3546
|
-
const tagSizeModifierClass = {
|
|
3547
|
-
medium: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
|
|
3548
|
-
small: $withXIcon ? tws`tu-tag--small tu-tag--with-icon` : tws`tu-tag--small`
|
|
3549
|
-
};
|
|
3550
|
-
return tagSizeModifierClass[$size];
|
|
3551
|
-
};
|
|
3552
|
-
|
|
3553
|
-
const getColorModifierClass = () => ({
|
|
3554
|
-
$color
|
|
3555
|
-
}) => {
|
|
3556
|
-
const colorClasses = {
|
|
3557
|
-
primary: tws`tu-tag--primary`,
|
|
3558
|
-
secondary: tws`tu-tag--secondary`,
|
|
3559
|
-
accent: tws`tu-tag--accent`,
|
|
3560
|
-
success: tws`tu-tag--success`,
|
|
3561
|
-
danger: tws`tu-tag--danger`,
|
|
3562
|
-
warning: tws`tu-tag--warning`,
|
|
3563
|
-
info: tws`tu-tag--info`,
|
|
3564
|
-
neutral: tws`tu-tag--neutral`,
|
|
3565
|
-
good: tws`tu-tag--good`,
|
|
3566
|
-
low: tws`tu-tag--low`,
|
|
3567
|
-
critical: tws`tu-tag--critical`,
|
|
3568
|
-
working: tws`tu-tag--working`,
|
|
3569
|
-
idle: tws`tu-tag--idle`,
|
|
3570
|
-
stopped: tws`tu-tag--stopped`,
|
|
3571
|
-
unknown: tws`tu-tag--unknown`
|
|
3572
|
-
};
|
|
3573
|
-
return colorClasses[$color];
|
|
3574
|
-
};
|
|
3575
|
-
|
|
3576
|
-
const StyledText = tw.span`
|
|
3577
|
-
tu-tag
|
|
3578
|
-
${getSizeModifierClass()}
|
|
3579
|
-
${getColorModifierClass()}
|
|
3580
|
-
`;
|
|
3581
|
-
const IconContainer = tw.div`
|
|
3582
|
-
tu-tag__icon-container
|
|
3583
|
-
`;
|
|
3584
|
-
|
|
3585
3627
|
/**
|
|
3586
3628
|
* A single select menu item is a basic wrapper around Menu item designed to be used as a single value render in Select list
|
|
3587
3629
|
*
|
|
@@ -4841,28 +4883,14 @@ const getScore = (value, min, max) => {
|
|
|
4841
4883
|
|
|
4842
4884
|
const getDefaultFillColor = score => {
|
|
4843
4885
|
if (score < 0.3) {
|
|
4844
|
-
return
|
|
4886
|
+
return color("DANGER", 500, "CSS");
|
|
4845
4887
|
}
|
|
4846
4888
|
|
|
4847
4889
|
if (score >= 0.6) {
|
|
4848
|
-
return
|
|
4849
|
-
}
|
|
4850
|
-
|
|
4851
|
-
return getColorValue("--color-amber-300");
|
|
4852
|
-
};
|
|
4853
|
-
/**
|
|
4854
|
-
* Helper function to get normalized color
|
|
4855
|
-
*
|
|
4856
|
-
* @param {number} levelColor - color, ex --color-green-600
|
|
4857
|
-
* @returns {string} normalized color value
|
|
4858
|
-
*/
|
|
4859
|
-
|
|
4860
|
-
const getNormalizedLevelColor = levelColor => {
|
|
4861
|
-
if (levelColor.startsWith("--color")) {
|
|
4862
|
-
return getColorValue(levelColor);
|
|
4890
|
+
return color("SUCCESS", 600, "CSS");
|
|
4863
4891
|
}
|
|
4864
4892
|
|
|
4865
|
-
return
|
|
4893
|
+
return color("WARNING", 300, "CSS");
|
|
4866
4894
|
};
|
|
4867
4895
|
/**
|
|
4868
4896
|
* Helper function to get custom color used by the ValueBar
|
|
@@ -4876,14 +4904,14 @@ const getFillColor = (score, levelColors) => {
|
|
|
4876
4904
|
var _a, _b;
|
|
4877
4905
|
|
|
4878
4906
|
if (levelColors.low && score < (levelColors.low.level || 0)) {
|
|
4879
|
-
return
|
|
4907
|
+
return levelColors.low.color;
|
|
4880
4908
|
}
|
|
4881
4909
|
|
|
4882
4910
|
if (levelColors.high && score >= (levelColors.high.level || 0)) {
|
|
4883
|
-
return
|
|
4911
|
+
return levelColors.high.color;
|
|
4884
4912
|
}
|
|
4885
4913
|
|
|
4886
|
-
return
|
|
4914
|
+
return (_b = (_a = levelColors.medium) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : color("WARNING", 300);
|
|
4887
4915
|
};
|
|
4888
4916
|
/**
|
|
4889
4917
|
* Helper function to get color used by the ValueBar
|
|
@@ -4946,7 +4974,7 @@ const ValueBar = ({
|
|
|
4946
4974
|
"$size": size,
|
|
4947
4975
|
x: `${barWidth + 2}%`,
|
|
4948
4976
|
y: "11",
|
|
4949
|
-
fill: valueColor !== null && valueColor !== void 0 ? valueColor :
|
|
4977
|
+
fill: valueColor !== null && valueColor !== void 0 ? valueColor : color("NEUTRAL", 400, "CSS")
|
|
4950
4978
|
}, {
|
|
4951
4979
|
children: [Number(value.toFixed(1)), unit || ""]
|
|
4952
4980
|
}))]
|
|
@@ -5338,4 +5366,4 @@ const Layout = tw.div`
|
|
|
5338
5366
|
tu-layout-TwoColumnLayout
|
|
5339
5367
|
`;
|
|
5340
5368
|
|
|
5341
|
-
export { ActionButton, Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiSelectMenuItem, NumberField, NumberInput,
|
|
5369
|
+
export { ActionButton, Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiSelectMenuItem, NumberField, NumberInput, PageHeader, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, SectionHeader, Select, SelectPrefix, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, ValueBar, docs, getOrderedOptions, getValueBarColorByValue, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.165",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@trackunit/css-core": "0.0.
|
|
7
|
+
"@trackunit/css-core": "0.0.53",
|
|
8
8
|
"@trackunit/tailwind-styled-components": "0.0.46",
|
|
9
9
|
"react": "17.0.2",
|
|
10
|
-
"@trackunit/ui-design-tokens": "0.0.
|
|
10
|
+
"@trackunit/ui-design-tokens": "0.0.45",
|
|
11
11
|
"echarts-for-react": "^3.0.2",
|
|
12
12
|
"echarts": "^5.4.0",
|
|
13
13
|
"uuid": "^8.3.2",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"react-day-picker": "^8.3.0",
|
|
17
17
|
"@trackunit/ui-icons": "0.0.47",
|
|
18
18
|
"react-useportal": "1.0.16",
|
|
19
|
-
"react-helmet": "^6.1.0",
|
|
20
19
|
"@react-spring/web": "9.5.2",
|
|
21
20
|
"react-router-dom": "6.4.1",
|
|
22
21
|
"@popperjs/core": "^2.11.6",
|
|
22
|
+
"react-helmet": "^6.1.0",
|
|
23
23
|
"react-select": "^5.4.0",
|
|
24
24
|
"jest-canvas-mock": "^2.4.0"
|
|
25
25
|
},
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
import "./PageHeading.css";
|
|
4
|
-
export interface PageHeadingProps extends CommonProps {
|
|
5
|
-
/**
|
|
6
|
-
* The title of the page.
|
|
7
|
-
*/
|
|
8
|
-
title: string;
|
|
9
|
-
/**
|
|
10
|
-
* Subtitle of the page.
|
|
11
|
-
*/
|
|
12
|
-
subtitle?: string;
|
|
13
|
-
/**
|
|
14
|
-
* The addon could be used to tell the state of a pageheading.
|
|
15
|
-
*/
|
|
16
|
-
addon?: ReactNode;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* The PageHeading component is used on pages to set the Browser page title.
|
|
20
|
-
*
|
|
21
|
-
* @param {PageHeadingProps} props - The props for the PageHeading component
|
|
22
|
-
* @returns {JSX.Element} PageHeading component
|
|
23
|
-
*/
|
|
24
|
-
export declare const PageHeading: ({ title, subtitle, dataTestId, addon }: PageHeadingProps) => JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./PageHeading";
|
package/constants/colors.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ? A collection of all the types and tokens related to the named colors in the default theme.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* The general color palette
|
|
6
|
-
* Should be available in most if not all colored components
|
|
7
|
-
*/
|
|
8
|
-
export declare const generalColors: {
|
|
9
|
-
readonly PRIMARY: "primary";
|
|
10
|
-
readonly SECONDARY: "secondary";
|
|
11
|
-
readonly ACCENT: "accent";
|
|
12
|
-
readonly NEUTRAL: "neutral";
|
|
13
|
-
};
|
|
14
|
-
export declare type GeneralColors = typeof colors[keyof typeof generalColors];
|
|
15
|
-
/**
|
|
16
|
-
* The intent color palette
|
|
17
|
-
* Should be available for most colored components such as "Button", "Alert", "Indicator", "Badge"
|
|
18
|
-
*/
|
|
19
|
-
export declare const intentColors: {
|
|
20
|
-
readonly INFO: "info";
|
|
21
|
-
readonly SUCCESS: "success";
|
|
22
|
-
readonly WARNING: "warning";
|
|
23
|
-
readonly DANGER: "danger";
|
|
24
|
-
};
|
|
25
|
-
export declare type IntentColors = typeof colors[keyof typeof intentColors];
|
|
26
|
-
/**
|
|
27
|
-
* The Criticality color palette
|
|
28
|
-
* Should be available in any component that could be used to display the criticality of an asset or event
|
|
29
|
-
*/
|
|
30
|
-
export declare const criticalityColors: {
|
|
31
|
-
readonly GOOD: "good";
|
|
32
|
-
readonly LOW: "low";
|
|
33
|
-
readonly CRITICAL: "critical";
|
|
34
|
-
};
|
|
35
|
-
export declare type CriticalityColors = typeof colors[keyof typeof criticalityColors];
|
|
36
|
-
/**
|
|
37
|
-
* The Activity color palette
|
|
38
|
-
* Should be available in any component that could be used to display the Activity state of an asset
|
|
39
|
-
*/
|
|
40
|
-
export declare const activityColors: {
|
|
41
|
-
readonly WORKING: "working";
|
|
42
|
-
readonly IDLE: "idle";
|
|
43
|
-
readonly STOPPED: "stopped";
|
|
44
|
-
readonly UNKNOWN: "unknown";
|
|
45
|
-
};
|
|
46
|
-
export declare type ActivityColors = typeof colors[keyof typeof activityColors];
|
|
47
|
-
/**
|
|
48
|
-
* The Rental status color palette
|
|
49
|
-
* Should be available in any component that could be used to display the rental status of an asset
|
|
50
|
-
*/
|
|
51
|
-
export declare const rentalStatusColors: {
|
|
52
|
-
readonly ON_RENT: "ON_RENT";
|
|
53
|
-
readonly RETURNED: "RETURNED";
|
|
54
|
-
readonly AVAILABLE: "AVAILABLE";
|
|
55
|
-
readonly PICKUP_READY: "PICKUP_READY";
|
|
56
|
-
readonly TRANSFER: "TRANSFER";
|
|
57
|
-
readonly IN_REPAIR: "IN_REPAIR";
|
|
58
|
-
readonly OTHER_RENTAL_STATUS: "OTHER_RENTAL_STATUS";
|
|
59
|
-
};
|
|
60
|
-
export declare type RentalStatusColors = typeof colors[keyof typeof rentalStatusColors];
|
|
61
|
-
/**
|
|
62
|
-
* The full color palette
|
|
63
|
-
*/
|
|
64
|
-
export declare const colors: {
|
|
65
|
-
readonly ON_RENT: "ON_RENT";
|
|
66
|
-
readonly RETURNED: "RETURNED";
|
|
67
|
-
readonly AVAILABLE: "AVAILABLE";
|
|
68
|
-
readonly PICKUP_READY: "PICKUP_READY";
|
|
69
|
-
readonly TRANSFER: "TRANSFER";
|
|
70
|
-
readonly IN_REPAIR: "IN_REPAIR";
|
|
71
|
-
readonly OTHER_RENTAL_STATUS: "OTHER_RENTAL_STATUS";
|
|
72
|
-
readonly WORKING: "working";
|
|
73
|
-
readonly IDLE: "idle";
|
|
74
|
-
readonly STOPPED: "stopped";
|
|
75
|
-
readonly UNKNOWN: "unknown";
|
|
76
|
-
readonly GOOD: "good";
|
|
77
|
-
readonly LOW: "low";
|
|
78
|
-
readonly CRITICAL: "critical";
|
|
79
|
-
readonly INFO: "info";
|
|
80
|
-
readonly SUCCESS: "success";
|
|
81
|
-
readonly WARNING: "warning";
|
|
82
|
-
readonly DANGER: "danger";
|
|
83
|
-
readonly PRIMARY: "primary";
|
|
84
|
-
readonly SECONDARY: "secondary";
|
|
85
|
-
readonly ACCENT: "accent";
|
|
86
|
-
readonly NEUTRAL: "neutral";
|
|
87
|
-
};
|
|
88
|
-
export declare type Colors = typeof colors[keyof typeof colors];
|
package/constants/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./colors";
|