@trackunit/react-components 0.0.163 → 0.0.164
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/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/Tip/Tip.d.ts +10 -1
- package/components/index.d.ts +2 -1
- package/index.css +11 -15
- package/index.js +277 -169
- package/package.json +2 -2
- package/components/PageHeading/PageHeading.d.ts +0 -24
- package/components/PageHeading/index.d.ts +0 -1
|
@@ -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/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;
|
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.js
CHANGED
|
@@ -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];
|
|
@@ -1283,7 +1283,7 @@ const Body = tw.div`
|
|
|
1283
1283
|
* @returns {JSX.Element} Heading component
|
|
1284
1284
|
*/
|
|
1285
1285
|
|
|
1286
|
-
const Heading = ({
|
|
1286
|
+
const Heading$1 = ({
|
|
1287
1287
|
children,
|
|
1288
1288
|
variant = "primary",
|
|
1289
1289
|
inverted = false,
|
|
@@ -1361,13 +1361,13 @@ const CardHeader = ({
|
|
|
1361
1361
|
}, {
|
|
1362
1362
|
children: jsxs(Container$7, {
|
|
1363
1363
|
children: [jsxs("div", {
|
|
1364
|
-
children: [jsxs(HeadingContainer, {
|
|
1365
|
-
children: [jsx(Heading, Object.assign({
|
|
1364
|
+
children: [jsxs(HeadingContainer$1, {
|
|
1365
|
+
children: [jsx(Heading$1, Object.assign({
|
|
1366
1366
|
variant: headingVariant
|
|
1367
1367
|
}, {
|
|
1368
1368
|
children: heading
|
|
1369
1369
|
})), accessories]
|
|
1370
|
-
}), subHeading && jsx(Heading, Object.assign({
|
|
1370
|
+
}), subHeading && jsx(Heading$1, Object.assign({
|
|
1371
1371
|
subtle: true,
|
|
1372
1372
|
variant: "subtitle"
|
|
1373
1373
|
}, {
|
|
@@ -1392,7 +1392,7 @@ const BottomBorderedDensityContainer = twx(DensityContainer)`
|
|
|
1392
1392
|
const Container$7 = tw.div`
|
|
1393
1393
|
tu-card__header
|
|
1394
1394
|
`;
|
|
1395
|
-
const HeadingContainer = tw.div`
|
|
1395
|
+
const HeadingContainer$1 = tw.div`
|
|
1396
1396
|
tu-card__header-heading-container
|
|
1397
1397
|
`;
|
|
1398
1398
|
|
|
@@ -2270,30 +2270,39 @@ const Content = tw.div`
|
|
|
2270
2270
|
|
|
2271
2271
|
/**
|
|
2272
2272
|
* The Tip component is used to show helpful tips or contextual information to the users.
|
|
2273
|
+
* The tip can optionally be rendered as an anchor tag, which redirects to users to an external link on click.
|
|
2273
2274
|
*
|
|
2274
2275
|
* @param {TipProps} props - The props for the Tip component
|
|
2275
2276
|
* @returns {JSX.Element} Tip component
|
|
2276
2277
|
*/
|
|
2277
2278
|
|
|
2278
|
-
const Tip =
|
|
2279
|
-
|
|
2279
|
+
const Tip = ({
|
|
2280
|
+
children,
|
|
2281
|
+
iconProps,
|
|
2282
|
+
tooltipProps,
|
|
2283
|
+
dataTestId,
|
|
2284
|
+
link,
|
|
2285
|
+
renderAs = "span",
|
|
2286
|
+
className
|
|
2287
|
+
}) => {
|
|
2288
|
+
var _a;
|
|
2280
2289
|
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
tooltipProps,
|
|
2285
|
-
dataTestId
|
|
2286
|
-
} = _a,
|
|
2287
|
-
rest = __rest(_a, ["children", "iconProps", "tooltipProps", "dataTestId"]);
|
|
2290
|
+
const ifAnchorTag = () => {
|
|
2291
|
+
return renderAs === "a";
|
|
2292
|
+
};
|
|
2288
2293
|
|
|
2289
2294
|
return jsx(TipContainer, Object.assign({
|
|
2290
|
-
"data-testid": dataTestId
|
|
2291
|
-
|
|
2295
|
+
"data-testid": dataTestId,
|
|
2296
|
+
"$as": renderAs,
|
|
2297
|
+
href: ifAnchorTag() ? link === null || link === void 0 ? void 0 : link.toString() : undefined,
|
|
2298
|
+
target: ifAnchorTag() ? "_blank" : undefined,
|
|
2299
|
+
className: className
|
|
2300
|
+
}, {
|
|
2292
2301
|
children: jsx(Tooltip, Object.assign({
|
|
2293
2302
|
label: children,
|
|
2294
2303
|
dataTestId: `${dataTestId}-tooltip`
|
|
2295
2304
|
}, tooltipProps, {
|
|
2296
|
-
className: `${(
|
|
2305
|
+
className: `${(_a = tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className) !== null && _a !== void 0 ? _a : ""} tu-tip-tooltip`
|
|
2297
2306
|
}, {
|
|
2298
2307
|
children: jsx(Icon$1, Object.assign({
|
|
2299
2308
|
name: "QuestionMarkCircleIcon",
|
|
@@ -2303,7 +2312,7 @@ const Tip = _a => {
|
|
|
2303
2312
|
}))
|
|
2304
2313
|
}));
|
|
2305
2314
|
};
|
|
2306
|
-
const TipContainer = tw.
|
|
2315
|
+
const TipContainer = tw.text`
|
|
2307
2316
|
tu-tip
|
|
2308
2317
|
`;
|
|
2309
2318
|
|
|
@@ -3112,79 +3121,196 @@ const NumberField = forwardRef((_a, ref) => {
|
|
|
3112
3121
|
});
|
|
3113
3122
|
|
|
3114
3123
|
/**
|
|
3115
|
-
*
|
|
3124
|
+
* The tag component is used to categorize elements in the ui.
|
|
3116
3125
|
*
|
|
3117
|
-
*
|
|
3118
|
-
*
|
|
3126
|
+
* This could be to tell the state of an asset, or label a page as Beta.
|
|
3127
|
+
*
|
|
3128
|
+
* The tag is also used in multiselect components to show selected options.
|
|
3129
|
+
*
|
|
3130
|
+
* **Do:** Use short labels for easy scanning.
|
|
3131
|
+
*
|
|
3132
|
+
* @param {TagProps} props - The props for the tag component
|
|
3133
|
+
* @returns {JSX.Element} tag component
|
|
3119
3134
|
*/
|
|
3120
3135
|
|
|
3121
|
-
const
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3136
|
+
const Tag = React.forwardRef((_a, ref) => {
|
|
3137
|
+
var {
|
|
3138
|
+
className,
|
|
3139
|
+
dataTestId,
|
|
3140
|
+
children,
|
|
3141
|
+
size = "medium",
|
|
3142
|
+
onClose,
|
|
3143
|
+
color = "primary"
|
|
3144
|
+
} = _a;
|
|
3145
|
+
__rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
|
|
3146
|
+
|
|
3147
|
+
return jsxs(StyledText, Object.assign({
|
|
3148
|
+
className: className,
|
|
3149
|
+
"$size": size,
|
|
3150
|
+
"data-testid": `${dataTestId}-tag`,
|
|
3151
|
+
"$as": "span",
|
|
3152
|
+
"$color": color,
|
|
3153
|
+
"$withXIcon": !!onClose,
|
|
3154
|
+
ref: ref
|
|
3155
|
+
}, {
|
|
3156
|
+
children: [children, onClose && // a fix for multiselect deselecting tags working together with fade out animation
|
|
3157
|
+
jsx(IconContainer, Object.assign({
|
|
3158
|
+
onMouseDown: onClose
|
|
3159
|
+
}, {
|
|
3160
|
+
children: jsx(Icon$1, {
|
|
3161
|
+
name: "XCircleIcon",
|
|
3162
|
+
dataTestId: dataTestId + "Icon",
|
|
3163
|
+
type: "solid",
|
|
3164
|
+
style: {
|
|
3165
|
+
WebkitTransition: "-webkit-transform 0.150s"
|
|
3166
|
+
},
|
|
3167
|
+
className: size === "medium" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
|
|
3168
|
+
})
|
|
3169
|
+
}))]
|
|
3170
|
+
}));
|
|
3171
|
+
});
|
|
3172
|
+
|
|
3173
|
+
const getSizeModifierClass = () => ({
|
|
3174
|
+
$size,
|
|
3175
|
+
$withXIcon
|
|
3125
3176
|
}) => {
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3177
|
+
const tagSizeModifierClass = {
|
|
3178
|
+
medium: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
|
|
3179
|
+
small: $withXIcon ? tws`tu-tag--small tu-tag--with-icon` : tws`tu-tag--small`
|
|
3180
|
+
};
|
|
3181
|
+
return tagSizeModifierClass[$size];
|
|
3131
3182
|
};
|
|
3132
3183
|
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3184
|
+
const getColorModifierClass = () => ({
|
|
3185
|
+
$color
|
|
3135
3186
|
}) => {
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3187
|
+
const colorClasses = {
|
|
3188
|
+
primary: tws`tu-tag--primary`,
|
|
3189
|
+
secondary: tws`tu-tag--secondary`,
|
|
3190
|
+
accent: tws`tu-tag--accent`,
|
|
3191
|
+
success: tws`tu-tag--success`,
|
|
3192
|
+
danger: tws`tu-tag--danger`,
|
|
3193
|
+
warning: tws`tu-tag--warning`,
|
|
3194
|
+
info: tws`tu-tag--info`,
|
|
3195
|
+
neutral: tws`tu-tag--neutral`,
|
|
3196
|
+
good: tws`tu-tag--good`,
|
|
3197
|
+
low: tws`tu-tag--low`,
|
|
3198
|
+
critical: tws`tu-tag--critical`,
|
|
3199
|
+
working: tws`tu-tag--working`,
|
|
3200
|
+
idle: tws`tu-tag--idle`,
|
|
3201
|
+
stopped: tws`tu-tag--stopped`,
|
|
3202
|
+
unknown: tws`tu-tag--unknown`
|
|
3203
|
+
};
|
|
3204
|
+
return colorClasses[$color];
|
|
3146
3205
|
};
|
|
3147
3206
|
|
|
3148
|
-
const
|
|
3149
|
-
|
|
3150
|
-
${
|
|
3207
|
+
const StyledText = tw.span`
|
|
3208
|
+
tu-tag
|
|
3209
|
+
${getSizeModifierClass()}
|
|
3210
|
+
${getColorModifierClass()}
|
|
3211
|
+
`;
|
|
3212
|
+
const IconContainer = tw.div`
|
|
3213
|
+
tu-tag__icon-container
|
|
3151
3214
|
`;
|
|
3152
3215
|
|
|
3153
3216
|
/**
|
|
3154
|
-
*
|
|
3217
|
+
* Pageheader component is used to display a page header.
|
|
3155
3218
|
*
|
|
3156
|
-
*
|
|
3157
|
-
*
|
|
3219
|
+
* 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.
|
|
3220
|
+
*
|
|
3221
|
+
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
3222
|
+
* @returns {JSX.Element} PageHeader component
|
|
3158
3223
|
*/
|
|
3159
3224
|
|
|
3160
|
-
const
|
|
3161
|
-
|
|
3162
|
-
subtitle,
|
|
3225
|
+
const PageHeader = ({
|
|
3226
|
+
className,
|
|
3163
3227
|
dataTestId,
|
|
3164
|
-
|
|
3228
|
+
action,
|
|
3229
|
+
showLoading,
|
|
3230
|
+
description,
|
|
3231
|
+
title,
|
|
3232
|
+
tag,
|
|
3233
|
+
backTo,
|
|
3234
|
+
children
|
|
3165
3235
|
}) => {
|
|
3166
|
-
return jsxs(
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3236
|
+
return jsxs(StyledPageHeader, Object.assign({
|
|
3237
|
+
className: className,
|
|
3238
|
+
"data-testid": dataTestId
|
|
3239
|
+
}, {
|
|
3240
|
+
children: [jsxs(HeadingAndAccessoriesContainer, Object.assign({
|
|
3241
|
+
"data-testid": `${dataTestId}-heading-container`
|
|
3242
|
+
}, {
|
|
3243
|
+
children: [jsxs(HeadingContainer, {
|
|
3244
|
+
children: [backTo && jsx(IconButton, {
|
|
3245
|
+
to: backTo,
|
|
3246
|
+
color: "tertiary",
|
|
3247
|
+
variant: "transparent",
|
|
3248
|
+
size: "small",
|
|
3249
|
+
icon: jsx(Icon$1, {
|
|
3250
|
+
name: "ArrowLeftIcon"
|
|
3251
|
+
})
|
|
3252
|
+
}), jsx(Heading, Object.assign({
|
|
3253
|
+
"data-testid": `${dataTestId}-heading`
|
|
3254
|
+
}, {
|
|
3255
|
+
children: title
|
|
3256
|
+
})), description && jsx(StyledTip, Object.assign({
|
|
3257
|
+
link: description,
|
|
3258
|
+
dataTestId: `${dataTestId}-tip`,
|
|
3259
|
+
iconProps: {
|
|
3260
|
+
name: "QuestionMarkCircleIcon"
|
|
3261
|
+
},
|
|
3262
|
+
renderAs: isValidHttpUrl(description) ? "a" : "span"
|
|
3263
|
+
}, {
|
|
3264
|
+
children: isValidHttpUrl(description) ? "Learn more" : description
|
|
3265
|
+
}))]
|
|
3266
|
+
}), tag && jsx(Tag, Object.assign({
|
|
3172
3267
|
dataTestId: dataTestId
|
|
3173
3268
|
}, {
|
|
3174
|
-
children:
|
|
3175
|
-
})),
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
}, {
|
|
3180
|
-
children:
|
|
3181
|
-
})), jsx(Spacer, {
|
|
3182
|
-
minHeight: "normal"
|
|
3269
|
+
children: tag
|
|
3270
|
+
})), showLoading && jsx(Spinner, {
|
|
3271
|
+
dataTestId: `${dataTestId}-spinner`,
|
|
3272
|
+
centered: true
|
|
3273
|
+
}), action]
|
|
3274
|
+
})), jsx(ChildContainer, {
|
|
3275
|
+
children: children
|
|
3183
3276
|
})]
|
|
3184
|
-
});
|
|
3277
|
+
}));
|
|
3185
3278
|
};
|
|
3186
|
-
|
|
3187
|
-
const
|
|
3279
|
+
|
|
3280
|
+
const isValidHttpUrl = description => {
|
|
3281
|
+
if (!description || typeof description !== "string") {
|
|
3282
|
+
return false;
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
let url;
|
|
3286
|
+
|
|
3287
|
+
try {
|
|
3288
|
+
url = new URL(description);
|
|
3289
|
+
} catch (_) {
|
|
3290
|
+
return false;
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
3294
|
+
};
|
|
3295
|
+
|
|
3296
|
+
const StyledPageHeader = tw.div`
|
|
3297
|
+
tu-page-header
|
|
3298
|
+
`;
|
|
3299
|
+
const HeadingAndAccessoriesContainer = tw.div`
|
|
3300
|
+
tu-page-header__heading-accessories-container
|
|
3301
|
+
`;
|
|
3302
|
+
const HeadingContainer = tw.div`
|
|
3303
|
+
tu-page-header__heading-container
|
|
3304
|
+
`;
|
|
3305
|
+
const Heading = tw.h1`
|
|
3306
|
+
tu-page-header__heading
|
|
3307
|
+
`;
|
|
3308
|
+
const ChildContainer = tw.div`
|
|
3309
|
+
tu-page-header__child-container
|
|
3310
|
+
`;
|
|
3311
|
+
const StyledTip = twx(Tip)`
|
|
3312
|
+
${p => isValidHttpUrl(p.link) ? tws`tu-page-header__tip` : null}
|
|
3313
|
+
`;
|
|
3188
3314
|
|
|
3189
3315
|
function useConfirmExit(confirmExit, when = true) {
|
|
3190
3316
|
const {
|
|
@@ -3382,6 +3508,81 @@ ${({
|
|
|
3382
3508
|
}) => $disabled && tws`tu-radioitem__description--disabled`}
|
|
3383
3509
|
`;
|
|
3384
3510
|
|
|
3511
|
+
/**
|
|
3512
|
+
* The Spacer component is used for adding a bit of space in the ui.
|
|
3513
|
+
*
|
|
3514
|
+
* @param {SpacerProps} props - The props for the Spacer component
|
|
3515
|
+
* @returns {JSX.Element} Spacer component
|
|
3516
|
+
*/
|
|
3517
|
+
|
|
3518
|
+
const Spacer = ({
|
|
3519
|
+
minHeight,
|
|
3520
|
+
border,
|
|
3521
|
+
dataTestId
|
|
3522
|
+
}) => {
|
|
3523
|
+
return jsx(Space, {
|
|
3524
|
+
"data-testid": dataTestId,
|
|
3525
|
+
minHeight: minHeight,
|
|
3526
|
+
border: border
|
|
3527
|
+
});
|
|
3528
|
+
};
|
|
3529
|
+
|
|
3530
|
+
const GetSpacerHeight = () => ({
|
|
3531
|
+
minHeight
|
|
3532
|
+
}) => {
|
|
3533
|
+
switch (minHeight) {
|
|
3534
|
+
case "normal":
|
|
3535
|
+
return tws`tu-spacer--normal`;
|
|
3536
|
+
|
|
3537
|
+
case "large":
|
|
3538
|
+
return tws`tu-spacer--large`;
|
|
3539
|
+
|
|
3540
|
+
default:
|
|
3541
|
+
return "";
|
|
3542
|
+
}
|
|
3543
|
+
};
|
|
3544
|
+
|
|
3545
|
+
const Space = tw.div`
|
|
3546
|
+
${p => `${p.border ? `tu-spacer--border` : null}`}
|
|
3547
|
+
${GetSpacerHeight()}
|
|
3548
|
+
`;
|
|
3549
|
+
|
|
3550
|
+
/**
|
|
3551
|
+
* The SectionHeader component is used on sections to set the section title.
|
|
3552
|
+
*
|
|
3553
|
+
* @param {SectionHeaderProps} props - The props for the section header component
|
|
3554
|
+
* @returns {JSX.Element} SectionHeader component
|
|
3555
|
+
*/
|
|
3556
|
+
|
|
3557
|
+
const SectionHeader = ({
|
|
3558
|
+
title,
|
|
3559
|
+
subtitle,
|
|
3560
|
+
dataTestId,
|
|
3561
|
+
addon
|
|
3562
|
+
}) => {
|
|
3563
|
+
return jsxs(SectionHeaderContainer, {
|
|
3564
|
+
children: [jsx(Helmet, {
|
|
3565
|
+
title: title
|
|
3566
|
+
}), jsxs(StyledFlex, {
|
|
3567
|
+
children: [jsx(Heading$1, Object.assign({
|
|
3568
|
+
variant: "secondary",
|
|
3569
|
+
dataTestId: dataTestId
|
|
3570
|
+
}, {
|
|
3571
|
+
children: title
|
|
3572
|
+
})), addon]
|
|
3573
|
+
}), subtitle && jsx(Heading$1, Object.assign({
|
|
3574
|
+
variant: "subtitle",
|
|
3575
|
+
subtle: true
|
|
3576
|
+
}, {
|
|
3577
|
+
children: subtitle
|
|
3578
|
+
})), jsx(Spacer, {
|
|
3579
|
+
minHeight: "normal"
|
|
3580
|
+
})]
|
|
3581
|
+
});
|
|
3582
|
+
};
|
|
3583
|
+
const SectionHeaderContainer = tw.div`tu-section-header`;
|
|
3584
|
+
const StyledFlex = tw.div`tu-section-header__flex`;
|
|
3585
|
+
|
|
3385
3586
|
/**
|
|
3386
3587
|
* The SelectContainer component.
|
|
3387
3588
|
*
|
|
@@ -3489,99 +3690,6 @@ const SelectPrefix = tw.div`
|
|
|
3489
3690
|
tu-select__prefix
|
|
3490
3691
|
`;
|
|
3491
3692
|
|
|
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
3693
|
/**
|
|
3586
3694
|
* 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
3695
|
*
|
|
@@ -5338,4 +5446,4 @@ const Layout = tw.div`
|
|
|
5338
5446
|
tu-layout-TwoColumnLayout
|
|
5339
5447
|
`;
|
|
5340
5448
|
|
|
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,
|
|
5449
|
+
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, activityColors, colors, criticalityColors, docs, generalColors, getOrderedOptions, getValueBarColorByValue, intentColors, isMultiValue, rentalStatusColors, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.164",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -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";
|