@trackunit/react-components 6.1.10 → 7.0.1-alpha-52afdafac12.0
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
CHANGED
|
@@ -1494,11 +1494,11 @@ const useSyncedSpinDelay = (ref, durationMs = DEFAULT_SPIN_DURATION_MS) => {
|
|
|
1494
1494
|
* during short operations (1-5 seconds) such as saving, loading, or refreshing data.
|
|
1495
1495
|
*
|
|
1496
1496
|
* ### When to use
|
|
1497
|
-
* Use Spinner for short-duration loading states: button actions, table refreshes, inline data fetches,
|
|
1497
|
+
* Use Spinner for short-duration loading states: button actions, table refreshes, inline data fetches, modal content loading, or full-page loading when the page layout isn't known yet (a centered Spinner in a full-height container).
|
|
1498
|
+
* Show `EmptyState` only once loading has finished with nothing to show.
|
|
1498
1499
|
*
|
|
1499
1500
|
* ### When not to use
|
|
1500
1501
|
* Do not use Spinner for long loading states where content structure is known — use `SkeletonBlock` or `SkeletonLabel` instead.
|
|
1501
|
-
* Do not use Spinner for full-page loading — use `EmptyState` with `loading` prop.
|
|
1502
1502
|
*
|
|
1503
1503
|
* @example Centered spinner during data load
|
|
1504
1504
|
* ```tsx
|
|
@@ -4848,6 +4848,9 @@ WorkerWithSignSVG.displayName = "WorkerWithSignSVG";
|
|
|
4848
4848
|
* - For guidance purposes (e.g., onboarding, adjusting filters, exploring alternative approaches).
|
|
4849
4849
|
* - In celebratory instances (e.g., no new notifications, services up to date).
|
|
4850
4850
|
*
|
|
4851
|
+
* ## **When not to use**
|
|
4852
|
+
* - While content is loading. Show a `Spinner` (or a skeleton when the shape of the content is known) and render the empty state only once loading has finished with nothing to show.
|
|
4853
|
+
*
|
|
4851
4854
|
* @example Empty state with actions for no search results
|
|
4852
4855
|
* ```tsx
|
|
4853
4856
|
* import { EmptyState } from "@trackunit/react-components";
|
|
@@ -4887,7 +4890,7 @@ WorkerWithSignSVG.displayName = "WorkerWithSignSVG";
|
|
|
4887
4890
|
* );
|
|
4888
4891
|
* ```
|
|
4889
4892
|
*/
|
|
4890
|
-
const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc,
|
|
4893
|
+
const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc, "data-testid": dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, style, ref, }) => {
|
|
4891
4894
|
const ImageSource = react.useMemo(() => {
|
|
4892
4895
|
switch (image) {
|
|
4893
4896
|
case "WORKER_WITH_SIGN":
|
|
@@ -4910,7 +4913,7 @@ const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customIma
|
|
|
4910
4913
|
const secondaryLink = secondaryAction?.disabled ? undefined : secondaryAction?.to;
|
|
4911
4914
|
const primaryLink = primaryAction?.disabled ? undefined : primaryAction?.to;
|
|
4912
4915
|
const helpLink = additionalHelpAction?.disabled ? undefined : additionalHelpAction?.to;
|
|
4913
|
-
return (jsxRuntime.
|
|
4916
|
+
return (jsxRuntime.jsxs("div", { className: cvaContainerStyles({ className }), "data-testid": dataTestId ?? "empty-state", ref: ref, style: style, children: [customImageSrc !== null && customImageSrc !== undefined ? (typeof customImageSrc === "string" ? (jsxRuntime.jsx("img", { alt: altText, className: cvaImgStyles(), height: 200, src: customImageSrc, width: 200 })) : (customImageSrc)) : (typeof ImageSource !== "undefined" && (jsxRuntime.jsx(ImageSource, { "data-testid": "empty-state-image", height: 200, width: 200 }, image))), description !== undefined && description !== "" ? (jsxRuntime.jsx(Text, { align: "center", size: "medium", children: description })) : null, jsxRuntime.jsxs("div", { className: "mt-4 grid gap-3", children: [primaryAction || secondaryAction ? (jsxRuntime.jsxs("div", { className: "flex justify-center gap-3", "data-testid": "empty-state-actions", children: [secondaryAction ? (jsxRuntime.jsx(Button, { asChild: Boolean(secondaryLink), "data-testid": "empty-state-secondary-button", disabled: secondaryAction.disabled, onClick: secondaryAction.onClick, variant: "secondary", children: secondaryLink ? (jsxRuntime.jsx(reactRouter.Link, { params: secondaryLink.parameters, to: secondaryLink.pathname, children: secondaryAction.title })) : (secondaryAction.title) })) : null, primaryAction ? (jsxRuntime.jsx(Button, { asChild: Boolean(primaryLink), "data-testid": "empty-state-primary-button", disabled: primaryAction.disabled, onClick: primaryAction.onClick, children: primaryLink ? (jsxRuntime.jsx(reactRouter.Link, { params: primaryLink.parameters, to: primaryLink.pathname, children: primaryAction.title })) : (primaryAction.title) })) : null] })) : null, additionalHelpAction?.to ? (jsxRuntime.jsx(Button, { asChild: Boolean(helpLink), "data-testid": "empty-state-additional-button", disabled: additionalHelpAction.disabled, onClick: additionalHelpAction.onClick, suffix: jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" }), variant: "ghost", children: helpLink ? (jsxRuntime.jsx(reactRouter.Link, { params: helpLink.parameters, target: helpLink.target, to: helpLink.pathname, children: additionalHelpAction.title })) : (additionalHelpAction.title) })) : null] })] }));
|
|
4914
4917
|
};
|
|
4915
4918
|
|
|
4916
4919
|
const cvaExternalLink = cssClassVarianceUtilities.cva({
|
package/index.esm.js
CHANGED
|
@@ -1493,11 +1493,11 @@ const useSyncedSpinDelay = (ref, durationMs = DEFAULT_SPIN_DURATION_MS) => {
|
|
|
1493
1493
|
* during short operations (1-5 seconds) such as saving, loading, or refreshing data.
|
|
1494
1494
|
*
|
|
1495
1495
|
* ### When to use
|
|
1496
|
-
* Use Spinner for short-duration loading states: button actions, table refreshes, inline data fetches,
|
|
1496
|
+
* Use Spinner for short-duration loading states: button actions, table refreshes, inline data fetches, modal content loading, or full-page loading when the page layout isn't known yet (a centered Spinner in a full-height container).
|
|
1497
|
+
* Show `EmptyState` only once loading has finished with nothing to show.
|
|
1497
1498
|
*
|
|
1498
1499
|
* ### When not to use
|
|
1499
1500
|
* Do not use Spinner for long loading states where content structure is known — use `SkeletonBlock` or `SkeletonLabel` instead.
|
|
1500
|
-
* Do not use Spinner for full-page loading — use `EmptyState` with `loading` prop.
|
|
1501
1501
|
*
|
|
1502
1502
|
* @example Centered spinner during data load
|
|
1503
1503
|
* ```tsx
|
|
@@ -4847,6 +4847,9 @@ WorkerWithSignSVG.displayName = "WorkerWithSignSVG";
|
|
|
4847
4847
|
* - For guidance purposes (e.g., onboarding, adjusting filters, exploring alternative approaches).
|
|
4848
4848
|
* - In celebratory instances (e.g., no new notifications, services up to date).
|
|
4849
4849
|
*
|
|
4850
|
+
* ## **When not to use**
|
|
4851
|
+
* - While content is loading. Show a `Spinner` (or a skeleton when the shape of the content is known) and render the empty state only once loading has finished with nothing to show.
|
|
4852
|
+
*
|
|
4850
4853
|
* @example Empty state with actions for no search results
|
|
4851
4854
|
* ```tsx
|
|
4852
4855
|
* import { EmptyState } from "@trackunit/react-components";
|
|
@@ -4886,7 +4889,7 @@ WorkerWithSignSVG.displayName = "WorkerWithSignSVG";
|
|
|
4886
4889
|
* );
|
|
4887
4890
|
* ```
|
|
4888
4891
|
*/
|
|
4889
|
-
const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc,
|
|
4892
|
+
const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc, "data-testid": dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, style, ref, }) => {
|
|
4890
4893
|
const ImageSource = useMemo(() => {
|
|
4891
4894
|
switch (image) {
|
|
4892
4895
|
case "WORKER_WITH_SIGN":
|
|
@@ -4909,7 +4912,7 @@ const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customIma
|
|
|
4909
4912
|
const secondaryLink = secondaryAction?.disabled ? undefined : secondaryAction?.to;
|
|
4910
4913
|
const primaryLink = primaryAction?.disabled ? undefined : primaryAction?.to;
|
|
4911
4914
|
const helpLink = additionalHelpAction?.disabled ? undefined : additionalHelpAction?.to;
|
|
4912
|
-
return (
|
|
4915
|
+
return (jsxs("div", { className: cvaContainerStyles({ className }), "data-testid": dataTestId ?? "empty-state", ref: ref, style: style, children: [customImageSrc !== null && customImageSrc !== undefined ? (typeof customImageSrc === "string" ? (jsx("img", { alt: altText, className: cvaImgStyles(), height: 200, src: customImageSrc, width: 200 })) : (customImageSrc)) : (typeof ImageSource !== "undefined" && (jsx(ImageSource, { "data-testid": "empty-state-image", height: 200, width: 200 }, image))), description !== undefined && description !== "" ? (jsx(Text, { align: "center", size: "medium", children: description })) : null, jsxs("div", { className: "mt-4 grid gap-3", children: [primaryAction || secondaryAction ? (jsxs("div", { className: "flex justify-center gap-3", "data-testid": "empty-state-actions", children: [secondaryAction ? (jsx(Button, { asChild: Boolean(secondaryLink), "data-testid": "empty-state-secondary-button", disabled: secondaryAction.disabled, onClick: secondaryAction.onClick, variant: "secondary", children: secondaryLink ? (jsx(Link, { params: secondaryLink.parameters, to: secondaryLink.pathname, children: secondaryAction.title })) : (secondaryAction.title) })) : null, primaryAction ? (jsx(Button, { asChild: Boolean(primaryLink), "data-testid": "empty-state-primary-button", disabled: primaryAction.disabled, onClick: primaryAction.onClick, children: primaryLink ? (jsx(Link, { params: primaryLink.parameters, to: primaryLink.pathname, children: primaryAction.title })) : (primaryAction.title) })) : null] })) : null, additionalHelpAction?.to ? (jsx(Button, { asChild: Boolean(helpLink), "data-testid": "empty-state-additional-button", disabled: additionalHelpAction.disabled, onClick: additionalHelpAction.onClick, suffix: jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" }), variant: "ghost", children: helpLink ? (jsx(Link, { params: helpLink.parameters, target: helpLink.target, to: helpLink.pathname, children: additionalHelpAction.title })) : (additionalHelpAction.title) })) : null] })] }));
|
|
4913
4916
|
};
|
|
4914
4917
|
|
|
4915
4918
|
const cvaExternalLink = cva({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-router-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.1-alpha-52afdafac12.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/css-class-variance-utilities": "
|
|
11
|
-
"@trackunit/i18n-library-translation": "
|
|
12
|
-
"@trackunit/react-components": "
|
|
13
|
-
"@trackunit/react-drawer": "
|
|
14
|
-
"@trackunit/shared-utils": "
|
|
10
|
+
"@trackunit/css-class-variance-utilities": "2.6.57-alpha-52afdafac12.0",
|
|
11
|
+
"@trackunit/i18n-library-translation": "2.14.50-alpha-52afdafac12.0",
|
|
12
|
+
"@trackunit/react-components": "7.0.1-alpha-52afdafac12.0",
|
|
13
|
+
"@trackunit/react-drawer": "3.0.1-alpha-52afdafac12.0",
|
|
14
|
+
"@trackunit/shared-utils": "1.22.57-alpha-52afdafac12.0",
|
|
15
15
|
"dequal": "^2.0.3",
|
|
16
16
|
"zod": "^3.25.76"
|
|
17
17
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1-alpha-52afdafac12.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"migrations": "./migrations.json",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"@floating-ui/react": "^0.26.25",
|
|
15
15
|
"string-ts": "^2.0.0",
|
|
16
16
|
"tailwind-merge": "^3.7.0",
|
|
17
|
-
"@trackunit/ui-design-tokens": "
|
|
18
|
-
"@trackunit/css-class-variance-utilities": "
|
|
19
|
-
"@trackunit/shared-utils": "
|
|
20
|
-
"@trackunit/ui-icons": "
|
|
17
|
+
"@trackunit/ui-design-tokens": "1.21.54-alpha-52afdafac12.0",
|
|
18
|
+
"@trackunit/css-class-variance-utilities": "2.6.57-alpha-52afdafac12.0",
|
|
19
|
+
"@trackunit/shared-utils": "1.22.57-alpha-52afdafac12.0",
|
|
20
|
+
"@trackunit/ui-icons": "1.20.54-alpha-52afdafac12.0",
|
|
21
21
|
"es-toolkit": "^1.52.0",
|
|
22
22
|
"@tanstack/react-virtual": "^3.14.13",
|
|
23
23
|
"fflate": "^0.8.3",
|
|
24
24
|
"zod": "^3.25.76",
|
|
25
|
-
"@trackunit/i18n-library-translation": "
|
|
25
|
+
"@trackunit/i18n-library-translation": "2.14.50-alpha-52afdafac12.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^19.0.0",
|
|
@@ -42,10 +42,6 @@ export interface EmptyStateProps extends CommonProps, Styleable, Refable<HTMLDiv
|
|
|
42
42
|
* Additional help action (e.g., a link to external documentation or support). Only rendered when `to` is set.
|
|
43
43
|
*/
|
|
44
44
|
additionalHelpAction?: EmptyStateButtonAction;
|
|
45
|
-
/**
|
|
46
|
-
* Whether the component is in a loading state. Shows a spinner and skeleton text instead of the illustration.
|
|
47
|
-
*/
|
|
48
|
-
loading?: boolean;
|
|
49
45
|
}
|
|
50
46
|
/**
|
|
51
47
|
*
|
|
@@ -57,6 +53,9 @@ export interface EmptyStateProps extends CommonProps, Styleable, Refable<HTMLDiv
|
|
|
57
53
|
* - For guidance purposes (e.g., onboarding, adjusting filters, exploring alternative approaches).
|
|
58
54
|
* - In celebratory instances (e.g., no new notifications, services up to date).
|
|
59
55
|
*
|
|
56
|
+
* ## **When not to use**
|
|
57
|
+
* - While content is loading. Show a `Spinner` (or a skeleton when the shape of the content is known) and render the empty state only once loading has finished with nothing to show.
|
|
58
|
+
*
|
|
60
59
|
* @example Empty state with actions for no search results
|
|
61
60
|
* ```tsx
|
|
62
61
|
* import { EmptyState } from "@trackunit/react-components";
|
|
@@ -96,5 +95,5 @@ export interface EmptyStateProps extends CommonProps, Styleable, Refable<HTMLDiv
|
|
|
96
95
|
* );
|
|
97
96
|
* ```
|
|
98
97
|
*/
|
|
99
|
-
export declare const EmptyState: ({ description, altText, image, customImageSrc,
|
|
98
|
+
export declare const EmptyState: ({ description, altText, image, customImageSrc, "data-testid": dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, style, ref, }: EmptyStateProps) => ReactElement;
|
|
100
99
|
export {};
|
|
@@ -33,11 +33,11 @@ export interface SpinnerProps extends CommonProps, Styleable, Refable<HTMLDivEle
|
|
|
33
33
|
* during short operations (1-5 seconds) such as saving, loading, or refreshing data.
|
|
34
34
|
*
|
|
35
35
|
* ### When to use
|
|
36
|
-
* Use Spinner for short-duration loading states: button actions, table refreshes, inline data fetches,
|
|
36
|
+
* Use Spinner for short-duration loading states: button actions, table refreshes, inline data fetches, modal content loading, or full-page loading when the page layout isn't known yet (a centered Spinner in a full-height container).
|
|
37
|
+
* Show `EmptyState` only once loading has finished with nothing to show.
|
|
37
38
|
*
|
|
38
39
|
* ### When not to use
|
|
39
40
|
* Do not use Spinner for long loading states where content structure is known — use `SkeletonBlock` or `SkeletonLabel` instead.
|
|
40
|
-
* Do not use Spinner for full-page loading — use `EmptyState` with `loading` prop.
|
|
41
41
|
*
|
|
42
42
|
* @example Centered spinner during data load
|
|
43
43
|
* ```tsx
|