@trackunit/react-components 0.1.274 → 0.1.275
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 +4 -19
- package/index.esm.js +4 -19
- package/package.json +2 -2
- package/src/components/Tabs/Tabs.d.ts +1 -7
package/index.cjs.js
CHANGED
|
@@ -18,7 +18,7 @@ var locale = require('date-fns/locale');
|
|
|
18
18
|
var react = require('@floating-ui/react');
|
|
19
19
|
var lodash = require('lodash');
|
|
20
20
|
var usePortal = require('react-useportal');
|
|
21
|
-
var
|
|
21
|
+
var reactRouter = require('@tanstack/react-router');
|
|
22
22
|
var reactHelmetAsync = require('react-helmet-async');
|
|
23
23
|
var reactTabs = require('@radix-ui/react-tabs');
|
|
24
24
|
var dateFns = require('date-fns');
|
|
@@ -2048,7 +2048,7 @@ const PageHeader = ({ className, dataTestId, action, showLoading, description, l
|
|
|
2048
2048
|
return (jsxRuntime.jsxs("div", { className: cvaPageHeaderContainer({
|
|
2049
2049
|
className,
|
|
2050
2050
|
withBorder: !tabsList,
|
|
2051
|
-
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }), renderAs:
|
|
2051
|
+
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }), renderAs: reactRouter.Link, size: "small", to: backTo, variant: "ghost-neutral" })) : undefined, jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxRuntime.jsxs("div", { className: cvaPageHeaderDescriptionAndLinkContainer(), children: [jsxRuntime.jsx(Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: "QuestionMarkCircle" }, label: description, placement: "bottom" }), link ? (jsxRuntime.jsxs(reactRouter.Link, { className: cvaPageHeaderLink(), "data-testid": "tooltip-link", params: prev => prev, target: "_blank", to: link, children: [linkText, jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] })) : undefined] }), tag && !showLoading ? (jsxRuntime.jsx(Tag, { color: tagColor, dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, children: tag })) : undefined, showLoading ? (jsxRuntime.jsx(Spinner, { centering: "vertically", dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined })) : null, action] }), children ? jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
|
|
2052
2052
|
};
|
|
2053
2053
|
|
|
2054
2054
|
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -2103,22 +2103,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
2103
2103
|
};
|
|
2104
2104
|
|
|
2105
2105
|
function useConfirmExit(confirmExit, when = true) {
|
|
2106
|
-
|
|
2107
|
-
React.useEffect(() => {
|
|
2108
|
-
if (!when) {
|
|
2109
|
-
return;
|
|
2110
|
-
}
|
|
2111
|
-
const push = navigator.push;
|
|
2112
|
-
navigator.push = (...args) => {
|
|
2113
|
-
const result = confirmExit();
|
|
2114
|
-
if (result !== false) {
|
|
2115
|
-
push(...args);
|
|
2116
|
-
}
|
|
2117
|
-
};
|
|
2118
|
-
return () => {
|
|
2119
|
-
navigator.push = push;
|
|
2120
|
-
};
|
|
2121
|
-
}, [navigator, confirmExit, when]);
|
|
2106
|
+
reactRouter.useBlocker(confirmExit, when);
|
|
2122
2107
|
}
|
|
2123
2108
|
/**
|
|
2124
2109
|
* The usePrompt hook.
|
|
@@ -2386,7 +2371,7 @@ const TabList = (_a) => {
|
|
|
2386
2371
|
* Tabs are used to group different but related content, allowing users to navigate views without leaving the page. They always contain at least two items and one tab is active at a time. Tabs can be used on full page layouts or in components such as modals or tables.
|
|
2387
2372
|
*/
|
|
2388
2373
|
const Tabs = (_a) => {
|
|
2389
|
-
var { children, forceRender, className, dataTestId, fullWidth
|
|
2374
|
+
var { children, forceRender, className, dataTestId, fullWidth } = _a, rest = __rest(_a, ["children", "forceRender", "className", "dataTestId", "fullWidth"]);
|
|
2390
2375
|
return (jsxRuntime.jsx(reactTabs.Root, Object.assign({ className: cvaTabsRoot({ className }), "data-testid": dataTestId }, rest, { children: children })));
|
|
2391
2376
|
};
|
|
2392
2377
|
|
package/index.esm.js
CHANGED
|
@@ -15,7 +15,7 @@ import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv,
|
|
|
15
15
|
import { useFloating, FloatingFocusManager, autoUpdate, offset, flip, shift, size, useClick, useDismiss, useHover as useHover$1, useRole, useInteractions, useMergeRefs, FloatingPortal, arrow, useTransitionStatus, FloatingArrow } from '@floating-ui/react';
|
|
16
16
|
import { omit } from 'lodash';
|
|
17
17
|
import usePortal from 'react-useportal';
|
|
18
|
-
import { Link,
|
|
18
|
+
import { Link, useBlocker } from '@tanstack/react-router';
|
|
19
19
|
import { HelmetProvider, Helmet } from 'react-helmet-async';
|
|
20
20
|
import { Trigger, Content, List, Root } from '@radix-ui/react-tabs';
|
|
21
21
|
import { format, formatDistance } from 'date-fns';
|
|
@@ -2017,7 +2017,7 @@ const PageHeader = ({ className, dataTestId, action, showLoading, description, l
|
|
|
2017
2017
|
return (jsxs("div", { className: cvaPageHeaderContainer({
|
|
2018
2018
|
className,
|
|
2019
2019
|
withBorder: !tabsList,
|
|
2020
|
-
}), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeader(), children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsx(IconButton, { icon: jsx(Icon, { name: "ArrowLeft" }), renderAs: Link, size: "small", to: backTo, variant: "ghost-neutral" })) : undefined, jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxs("div", { className: cvaPageHeaderDescriptionAndLinkContainer(), children: [jsx(Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: "QuestionMarkCircle" }, label: description, placement: "bottom" }), link ? (jsxs(Link, { className: cvaPageHeaderLink(), "data-testid": "tooltip-link", target: "_blank", to: link, children: [linkText, jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] })) : undefined] }), tag && !showLoading ? (jsx(Tag, { color: tagColor, dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, children: tag })) : undefined, showLoading ? (jsx(Spinner, { centering: "vertically", dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined })) : null, action] }), children ? jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
|
|
2020
|
+
}), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeader(), children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId ? `${dataTestId}-heading-container` : undefined, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo ? (jsx(IconButton, { icon: jsx(Icon, { name: "ArrowLeft" }), renderAs: Link, size: "small", to: backTo, variant: "ghost-neutral" })) : undefined, jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, children: title }), description && !showLoading ? (jsxs("div", { className: cvaPageHeaderDescriptionAndLinkContainer(), children: [jsx(Tooltip, { dataTestId: dataTestId ? `${dataTestId}-tooltip` : undefined, iconProps: { name: "QuestionMarkCircle" }, label: description, placement: "bottom" }), link ? (jsxs(Link, { className: cvaPageHeaderLink(), "data-testid": "tooltip-link", params: prev => prev, target: "_blank", to: link, children: [linkText, jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" })] })) : undefined] })) : undefined] }), tag && !showLoading ? (jsx(Tag, { color: tagColor, dataTestId: dataTestId ? `${dataTestId}-tag` : undefined, children: tag })) : undefined, showLoading ? (jsx(Spinner, { centering: "vertically", dataTestId: dataTestId ? `${dataTestId}-spinner` : undefined })) : null, action] }), children ? jsx("div", { className: cvaPageHeaderChildContainer(), children: children }) : null] }), tabsList] }));
|
|
2021
2021
|
};
|
|
2022
2022
|
|
|
2023
2023
|
const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -2072,22 +2072,7 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
2072
2072
|
};
|
|
2073
2073
|
|
|
2074
2074
|
function useConfirmExit(confirmExit, when = true) {
|
|
2075
|
-
|
|
2076
|
-
useEffect(() => {
|
|
2077
|
-
if (!when) {
|
|
2078
|
-
return;
|
|
2079
|
-
}
|
|
2080
|
-
const push = navigator.push;
|
|
2081
|
-
navigator.push = (...args) => {
|
|
2082
|
-
const result = confirmExit();
|
|
2083
|
-
if (result !== false) {
|
|
2084
|
-
push(...args);
|
|
2085
|
-
}
|
|
2086
|
-
};
|
|
2087
|
-
return () => {
|
|
2088
|
-
navigator.push = push;
|
|
2089
|
-
};
|
|
2090
|
-
}, [navigator, confirmExit, when]);
|
|
2075
|
+
useBlocker(confirmExit, when);
|
|
2091
2076
|
}
|
|
2092
2077
|
/**
|
|
2093
2078
|
* The usePrompt hook.
|
|
@@ -2355,7 +2340,7 @@ const TabList = (_a) => {
|
|
|
2355
2340
|
* Tabs are used to group different but related content, allowing users to navigate views without leaving the page. They always contain at least two items and one tab is active at a time. Tabs can be used on full page layouts or in components such as modals or tables.
|
|
2356
2341
|
*/
|
|
2357
2342
|
const Tabs = (_a) => {
|
|
2358
|
-
var { children, forceRender, className, dataTestId, fullWidth
|
|
2343
|
+
var { children, forceRender, className, dataTestId, fullWidth } = _a, rest = __rest(_a, ["children", "forceRender", "className", "dataTestId", "fullWidth"]);
|
|
2359
2344
|
return (jsx(Root, Object.assign({ className: cvaTabsRoot({ className }), "data-testid": dataTestId }, rest, { children: children })));
|
|
2360
2345
|
};
|
|
2361
2346
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.275",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"@trackunit/ui-icons": "*",
|
|
18
18
|
"@trackunit/shared-utils": "*",
|
|
19
19
|
"react-useportal": "1.0.18",
|
|
20
|
-
"react-router-dom": "6.18.0",
|
|
21
20
|
"react-helmet-async": "^1.3.0",
|
|
22
21
|
"zod": "3.22.4",
|
|
23
22
|
"lodash": "4.17.21",
|
|
24
23
|
"jest-fetch-mock": "^3.0.3",
|
|
25
24
|
"@testing-library/react": "14.0.0",
|
|
26
25
|
"@floating-ui/react": "^0.26.6",
|
|
26
|
+
"@tanstack/react-router": "1.19.1",
|
|
27
27
|
"string-ts": "^2.0.0"
|
|
28
28
|
},
|
|
29
29
|
"module": "./index.esm.js",
|
|
@@ -21,14 +21,8 @@ export interface TabsProps extends TabsRootProps {
|
|
|
21
21
|
* An ID that can be used in tests to locate the component.
|
|
22
22
|
*/
|
|
23
23
|
dataTestId?: string;
|
|
24
|
-
/**
|
|
25
|
-
* A callback function invoked when the selected tab changes.
|
|
26
|
-
*
|
|
27
|
-
* @param id - ID of the selected tab.
|
|
28
|
-
*/
|
|
29
|
-
onSelectedTabChanged?: (id: string | number) => void;
|
|
30
24
|
}
|
|
31
25
|
/**
|
|
32
26
|
* Tabs are used to group different but related content, allowing users to navigate views without leaving the page. They always contain at least two items and one tab is active at a time. Tabs can be used on full page layouts or in components such as modals or tables.
|
|
33
27
|
*/
|
|
34
|
-
export declare const Tabs: ({ children, forceRender, className, dataTestId, fullWidth,
|
|
28
|
+
export declare const Tabs: ({ children, forceRender, className, dataTestId, fullWidth, ...rest }: TabsProps) => JSX.Element;
|