@trackunit/react-components 0.0.172 → 0.0.173
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 +5 -1
- package/components/Tip/Tip.d.ts +1 -1
- package/index.css +9 -3
- package/index.js +10 -9
- package/package.json +3 -3
|
@@ -9,6 +9,10 @@ export interface PageHeaderProps extends CommonProps {
|
|
|
9
9
|
* The description to be displayed inside the tip.
|
|
10
10
|
*/
|
|
11
11
|
description?: string | React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The link to which user is redirected to if user clicks on the tip.
|
|
14
|
+
*/
|
|
15
|
+
link?: string;
|
|
12
16
|
/**
|
|
13
17
|
* Additional actions to be rendered along with the header.
|
|
14
18
|
*/
|
|
@@ -40,4 +44,4 @@ export interface PageHeaderProps extends CommonProps {
|
|
|
40
44
|
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
41
45
|
* @returns {JSX.Element} PageHeader component
|
|
42
46
|
*/
|
|
43
|
-
export declare const PageHeader: ({ className, dataTestId, action, showLoading, description, title, tag, backTo, children, }: PageHeaderProps) => JSX.Element;
|
|
47
|
+
export declare const PageHeader: ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, children, }: PageHeaderProps) => JSX.Element;
|
package/components/Tip/Tip.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface TipProps extends CommonProps {
|
|
|
22
22
|
/**
|
|
23
23
|
* The href attribute if the tip is rendered as an anchor tag.
|
|
24
24
|
*/
|
|
25
|
-
link?: string
|
|
25
|
+
link?: string;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* The Tip component is used to show helpful tips or contextual information to the users.
|
package/index.css
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
px-2.5
|
|
21
21
|
h-min
|
|
22
22
|
w-min
|
|
23
|
+
max-h-8
|
|
23
24
|
focus:ring
|
|
24
25
|
focus:ring-offset-1
|
|
25
26
|
focus:outline-none
|
|
@@ -46,15 +47,20 @@
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
&--full-width {
|
|
49
|
-
@apply w-full
|
|
50
|
+
@apply w-full
|
|
51
|
+
flex-auto;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
&--small {
|
|
53
|
-
@apply py-1
|
|
55
|
+
@apply py-1
|
|
56
|
+
px-2
|
|
57
|
+
max-h-7;
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
&--large {
|
|
57
|
-
@apply py-2
|
|
61
|
+
@apply py-2
|
|
62
|
+
px-4
|
|
63
|
+
max-h-9;
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
&--primary {
|
package/index.js
CHANGED
|
@@ -2229,7 +2229,7 @@ const Tip = ({
|
|
|
2229
2229
|
return jsx(TipContainer, Object.assign({
|
|
2230
2230
|
"data-testid": dataTestId,
|
|
2231
2231
|
"$as": renderAs,
|
|
2232
|
-
href: ifAnchorTag() ? link
|
|
2232
|
+
href: ifAnchorTag() ? link : undefined,
|
|
2233
2233
|
target: ifAnchorTag() ? "_blank" : undefined,
|
|
2234
2234
|
className: className
|
|
2235
2235
|
}, {
|
|
@@ -3163,6 +3163,7 @@ const PageHeader = ({
|
|
|
3163
3163
|
action,
|
|
3164
3164
|
showLoading,
|
|
3165
3165
|
description,
|
|
3166
|
+
link,
|
|
3166
3167
|
title,
|
|
3167
3168
|
tag,
|
|
3168
3169
|
backTo,
|
|
@@ -3189,14 +3190,14 @@ const PageHeader = ({
|
|
|
3189
3190
|
}, {
|
|
3190
3191
|
children: title
|
|
3191
3192
|
})), description && jsx(StyledTip, Object.assign({
|
|
3192
|
-
link:
|
|
3193
|
+
link: isValidHttpUrl(link) ? link : undefined,
|
|
3193
3194
|
dataTestId: `${dataTestId}-tip`,
|
|
3194
3195
|
iconProps: {
|
|
3195
3196
|
name: "QuestionMarkCircleIcon"
|
|
3196
3197
|
},
|
|
3197
|
-
renderAs:
|
|
3198
|
+
renderAs: link ? "a" : "span"
|
|
3198
3199
|
}, {
|
|
3199
|
-
children:
|
|
3200
|
+
children: description
|
|
3200
3201
|
}))]
|
|
3201
3202
|
}), tag && jsx(Tag, Object.assign({
|
|
3202
3203
|
dataTestId: dataTestId
|
|
@@ -3212,21 +3213,21 @@ const PageHeader = ({
|
|
|
3212
3213
|
}));
|
|
3213
3214
|
};
|
|
3214
3215
|
|
|
3215
|
-
|
|
3216
|
-
if (!
|
|
3216
|
+
function isValidHttpUrl(link) {
|
|
3217
|
+
if (!link) {
|
|
3217
3218
|
return false;
|
|
3218
3219
|
}
|
|
3219
3220
|
|
|
3220
3221
|
let url;
|
|
3221
3222
|
|
|
3222
3223
|
try {
|
|
3223
|
-
url = new URL(
|
|
3224
|
+
url = new URL(link);
|
|
3224
3225
|
} catch (_) {
|
|
3225
3226
|
return false;
|
|
3226
3227
|
}
|
|
3227
3228
|
|
|
3228
3229
|
return url.protocol === "http:" || url.protocol === "https:";
|
|
3229
|
-
}
|
|
3230
|
+
}
|
|
3230
3231
|
|
|
3231
3232
|
const StyledPageHeader = tw.div`
|
|
3232
3233
|
tu-page-header
|
|
@@ -3244,7 +3245,7 @@ const ChildContainer = tw.div`
|
|
|
3244
3245
|
tu-page-header__child-container
|
|
3245
3246
|
`;
|
|
3246
3247
|
const StyledTip = twx(Tip)`
|
|
3247
|
-
${p =>
|
|
3248
|
+
${p => p.link ? tws`tu-page-header__tip` : null}
|
|
3248
3249
|
`;
|
|
3249
3250
|
|
|
3250
3251
|
function useConfirmExit(confirmExit, when = true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.173",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"date-fns": "^2.29.3",
|
|
16
16
|
"react-day-picker": "^8.3.0",
|
|
17
17
|
"@trackunit/ui-icons": "0.0.48",
|
|
18
|
-
"react-useportal": "1.0.
|
|
19
|
-
"@react-spring/web": "9.5.
|
|
18
|
+
"react-useportal": "1.0.17",
|
|
19
|
+
"@react-spring/web": "9.5.4",
|
|
20
20
|
"react-router-dom": "6.4.1",
|
|
21
21
|
"@popperjs/core": "^2.11.6",
|
|
22
22
|
"react-helmet": "^6.1.0",
|