@trackunit/react-components 1.7.7 → 1.7.12
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 +40 -26
- package/index.esm.js +40 -26
- package/package.json +8 -8
- package/src/components/EmptyValue/EmptyValue.d.ts +1 -2
- package/src/components/Highlight/Highlight.d.ts +5 -1
- package/src/components/Highlight/Highlight.variants.d.ts +1 -0
- package/src/components/Sidebar/useOverflowItems.d.ts +1 -1
- package/src/components/ZStack/ZStack.d.ts +1 -1
- package/src/test-utils/hooks.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -51,24 +51,24 @@ const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-gri
|
|
|
51
51
|
default: "text-current",
|
|
52
52
|
black: "text-black",
|
|
53
53
|
white: "text-white",
|
|
54
|
-
unused: "text-unused-
|
|
54
|
+
unused: "text-unused-400",
|
|
55
55
|
utilized: "text-utilized-600",
|
|
56
56
|
heavily_utilized: "text-heavily_utilized-500",
|
|
57
|
-
unknown_utilization: "text-
|
|
57
|
+
unknown_utilization: "text-unknown_utilization-600",
|
|
58
58
|
site_area: "text-site_area-600",
|
|
59
|
-
site_classic_poi: "text-site_classic_poi-
|
|
60
|
-
site_classic_zone: "text-site_classic_zone-
|
|
59
|
+
site_classic_poi: "text-site_classic_poi-600",
|
|
60
|
+
site_classic_zone: "text-site_classic_zone-600",
|
|
61
61
|
site_depot: "text-site_depot-500",
|
|
62
62
|
site_work_place: "text-site_work_place-600",
|
|
63
63
|
site_construction_site: "text-site_construction_site-500",
|
|
64
|
-
site_unknown: "text-site_unknown-
|
|
65
|
-
on_rent: "text-on_rent-
|
|
66
|
-
returned: "text-returned-
|
|
67
|
-
available: "text-available-
|
|
68
|
-
pickup_ready: "text-pickup_ready-
|
|
69
|
-
transfer: "text-transfer-
|
|
70
|
-
in_repair: "text-in_repair-
|
|
71
|
-
other_rental_status: "text-other_rental_status-
|
|
64
|
+
site_unknown: "text-site_unknown-600",
|
|
65
|
+
on_rent: "text-on_rent-400",
|
|
66
|
+
returned: "text-returned-500",
|
|
67
|
+
available: "text-available-500",
|
|
68
|
+
pickup_ready: "text-pickup_ready-500",
|
|
69
|
+
transfer: "text-transfer-300",
|
|
70
|
+
in_repair: "text-in_repair-400",
|
|
71
|
+
other_rental_status: "text-other_rental_status-500",
|
|
72
72
|
},
|
|
73
73
|
size: {
|
|
74
74
|
small: "w-4",
|
|
@@ -1046,7 +1046,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1046
1046
|
const callback = react.useRef(onTimeout);
|
|
1047
1047
|
const startTimeout = react.useCallback(() => {
|
|
1048
1048
|
ready.current = false;
|
|
1049
|
-
|
|
1049
|
+
if (timeout.current) {
|
|
1050
|
+
clearTimeout(timeout.current);
|
|
1051
|
+
}
|
|
1050
1052
|
timeout.current = setTimeout(() => {
|
|
1051
1053
|
ready.current = true;
|
|
1052
1054
|
callback.current();
|
|
@@ -1054,7 +1056,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1054
1056
|
}, [duration]);
|
|
1055
1057
|
const stopTimeout = react.useCallback(() => {
|
|
1056
1058
|
ready.current = null;
|
|
1057
|
-
|
|
1059
|
+
if (timeout.current) {
|
|
1060
|
+
clearTimeout(timeout.current);
|
|
1061
|
+
}
|
|
1058
1062
|
}, []);
|
|
1059
1063
|
react.useEffect(() => {
|
|
1060
1064
|
// Use the latest callback function provided by the parent component.
|
|
@@ -1063,7 +1067,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1063
1067
|
react.useEffect(() => {
|
|
1064
1068
|
// Cleanup function to clear the timeout when component unmounts
|
|
1065
1069
|
return () => {
|
|
1066
|
-
|
|
1070
|
+
if (timeout.current) {
|
|
1071
|
+
clearTimeout(timeout.current);
|
|
1072
|
+
}
|
|
1067
1073
|
};
|
|
1068
1074
|
}, []);
|
|
1069
1075
|
return { startTimeout, stopTimeout };
|
|
@@ -1681,7 +1687,7 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
|
|
|
1681
1687
|
*/
|
|
1682
1688
|
const Breadcrumb = ({ className, dataTestId, breadcrumbItems, back }) => {
|
|
1683
1689
|
const breadCrumbItemsToJSX = useBreadcrumbItemsToRender(breadcrumbItems);
|
|
1684
|
-
return (jsxRuntime.jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(IconButton, { dataTestId: `backButton-${dataTestId}`, icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick:
|
|
1690
|
+
return (jsxRuntime.jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(IconButton, { dataTestId: `backButton-${dataTestId}`, icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick: back, size: "small", variant: "ghost-neutral" }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(BreadcrumbContainer, { breadcrumbItems: breadCrumbItemsToJSX, dataTestId: dataTestId }) })] }));
|
|
1685
1691
|
};
|
|
1686
1692
|
/**
|
|
1687
1693
|
* BreadcrumbContainer is a helper component that renders the breadcrumb items based on the screen size.
|
|
@@ -2055,7 +2061,7 @@ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
|
|
|
2055
2061
|
const [animating, setAnimating] = react.useState(false);
|
|
2056
2062
|
const [, copyToClipboard] = usehooksTs.useCopyToClipboard();
|
|
2057
2063
|
const handleOnClick = () => {
|
|
2058
|
-
copyToClipboard(value);
|
|
2064
|
+
void copyToClipboard(value);
|
|
2059
2065
|
setAnimating(true);
|
|
2060
2066
|
};
|
|
2061
2067
|
return (jsxRuntime.jsx("span", { className: cvaCopyableText({ animating, className }), "data-testid": dataTestId, onAnimationEnd: () => setAnimating(false), onClick: handleOnClick, title: value, children: text }));
|
|
@@ -2230,9 +2236,12 @@ const cvaHighlight = cssClassVarianceUtilities.cvaMerge([
|
|
|
2230
2236
|
"truncate",
|
|
2231
2237
|
"max-w-full",
|
|
2232
2238
|
"w-fit",
|
|
2233
|
-
"text-xs",
|
|
2234
2239
|
], {
|
|
2235
2240
|
variants: {
|
|
2241
|
+
size: {
|
|
2242
|
+
small: ["text-xs"],
|
|
2243
|
+
medium: ["text-sm"],
|
|
2244
|
+
},
|
|
2236
2245
|
color: {
|
|
2237
2246
|
info: ["bg-info-100", "text-info-700"],
|
|
2238
2247
|
success: ["bg-success-100", "text-success-700"],
|
|
@@ -2242,6 +2251,7 @@ const cvaHighlight = cssClassVarianceUtilities.cvaMerge([
|
|
|
2242
2251
|
},
|
|
2243
2252
|
},
|
|
2244
2253
|
defaultVariants: {
|
|
2254
|
+
size: "small",
|
|
2245
2255
|
color: "warning",
|
|
2246
2256
|
},
|
|
2247
2257
|
});
|
|
@@ -2258,8 +2268,8 @@ const cvaHighlightText = cssClassVarianceUtilities.cvaMerge(["truncate"]);
|
|
|
2258
2268
|
* @param {HighlightProps} props - The props for the highlight component
|
|
2259
2269
|
* @returns {ReactElement} highlight component
|
|
2260
2270
|
*/
|
|
2261
|
-
const Highlight = ({ className, dataTestId, children, color = "warning", ref }) => {
|
|
2262
|
-
return (jsxRuntime.jsx("div", { className: cvaHighlight({ className, color }), "data-testid": dataTestId, ref: ref, children: jsxRuntime.jsx("span", { className: cvaHighlightText(), children: children }) }));
|
|
2271
|
+
const Highlight = ({ className, dataTestId, children, size = "small", color = "warning", ref, }) => {
|
|
2272
|
+
return (jsxRuntime.jsx("div", { className: cvaHighlight({ className, size, color }), "data-testid": dataTestId, ref: ref, children: jsxRuntime.jsx("span", { className: cvaHighlightText(), children: children }) }));
|
|
2263
2273
|
};
|
|
2264
2274
|
Highlight.displayName = "Highlight";
|
|
2265
2275
|
|
|
@@ -3161,7 +3171,9 @@ const MenuItem = ({ className, dataTestId, label, children, selected, focused, p
|
|
|
3161
3171
|
/* Handle tab navigation */
|
|
3162
3172
|
const handleKeyDown = (e) => {
|
|
3163
3173
|
if (e.key === "Enter" && onClick && !disabled) {
|
|
3164
|
-
|
|
3174
|
+
if (stopPropagation) {
|
|
3175
|
+
e.stopPropagation();
|
|
3176
|
+
}
|
|
3165
3177
|
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
3166
3178
|
onClick(e);
|
|
3167
3179
|
}
|
|
@@ -3174,7 +3186,9 @@ const MenuItem = ({ className, dataTestId, label, children, selected, focused, p
|
|
|
3174
3186
|
variant,
|
|
3175
3187
|
focused,
|
|
3176
3188
|
}), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
|
|
3177
|
-
|
|
3189
|
+
if (stopPropagation) {
|
|
3190
|
+
e.stopPropagation();
|
|
3191
|
+
}
|
|
3178
3192
|
onClick?.(e);
|
|
3179
3193
|
}, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : (tabIndex ?? 0), children: [prefix ? (jsxRuntime.jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxRuntime.jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children ?? label, optionLabelDescription ? jsxRuntime.jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsxRuntime.jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled, className: "flex items-center" }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
|
|
3180
3194
|
};
|
|
@@ -3630,7 +3644,7 @@ const cvaSidebarChildContainer = cssClassVarianceUtilities.cvaMerge(["apply", "f
|
|
|
3630
3644
|
* A hook used to detect what children are overflowing a container.
|
|
3631
3645
|
*
|
|
3632
3646
|
* @param {OverflowItemsOptions} root0 The options for the hook.
|
|
3633
|
-
* @param {
|
|
3647
|
+
* @param {number | Array<number>} root0.threshold The threshold for the intersection observer.
|
|
3634
3648
|
* @returns {object} The overflow items and the ref to the container.
|
|
3635
3649
|
*/
|
|
3636
3650
|
const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id", children, }) => {
|
|
@@ -3640,7 +3654,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
3640
3654
|
const handleIntersection = react.useCallback(entries => {
|
|
3641
3655
|
const updatedEntries = {};
|
|
3642
3656
|
entries.forEach(entry => {
|
|
3643
|
-
// @ts-
|
|
3657
|
+
// @ts-expect-error - suppressImplicitAnyIndexErrors
|
|
3644
3658
|
const targetElementId = entry.target[childUniqueIdentifierAttribute];
|
|
3645
3659
|
if (targetElementId) {
|
|
3646
3660
|
updatedEntries[targetElementId] = entry.isIntersecting ? false : true;
|
|
@@ -4033,7 +4047,7 @@ const VirtualizedList = ({ count, rowHeight = 40, pagination, children, classNam
|
|
|
4033
4047
|
scrollParent.removeEventListener("scroll", handleScroll);
|
|
4034
4048
|
};
|
|
4035
4049
|
}
|
|
4036
|
-
return
|
|
4050
|
+
return undefined;
|
|
4037
4051
|
}, [scrollParent, fetchMoreOnBottomReached]);
|
|
4038
4052
|
return (jsxRuntime.jsx("div", { className: cvaVirtualizedListContainer({ parentControlledScrollable, className }), "data-testid": dataTestId, ref: containerRef, children: jsxRuntime.jsx("ul", { className: cvaVirtualizedList(), ref: listRef, style: { height: `${getTotalSize()}px`, outline: "none" }, children: getVirtualItems().map(virtualRow => {
|
|
4039
4053
|
const isLoaderRow = virtualRow.index > count - 1;
|
|
@@ -4051,7 +4065,7 @@ const cvaZStackItem = cssClassVarianceUtilities.cvaMerge(["col-start-1", "col-en
|
|
|
4051
4065
|
* Is a good alternative to "position: absolute" that avoids some of the unfortunate side effects of absolute positioning.
|
|
4052
4066
|
*
|
|
4053
4067
|
* @param { ZStackProps} props - The props for the ZStack component
|
|
4054
|
-
* @returns {
|
|
4068
|
+
* @returns {Element} ZStack component
|
|
4055
4069
|
*/
|
|
4056
4070
|
const ZStack = ({ children, className, dataTestId }) => {
|
|
4057
4071
|
return (jsxRuntime.jsx("div", { className: cvaZStackContainer({ className }), "data-testid": dataTestId, children: react.Children.map(children, (child, index) => {
|
package/index.esm.js
CHANGED
|
@@ -49,24 +49,24 @@ const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
|
49
49
|
default: "text-current",
|
|
50
50
|
black: "text-black",
|
|
51
51
|
white: "text-white",
|
|
52
|
-
unused: "text-unused-
|
|
52
|
+
unused: "text-unused-400",
|
|
53
53
|
utilized: "text-utilized-600",
|
|
54
54
|
heavily_utilized: "text-heavily_utilized-500",
|
|
55
|
-
unknown_utilization: "text-
|
|
55
|
+
unknown_utilization: "text-unknown_utilization-600",
|
|
56
56
|
site_area: "text-site_area-600",
|
|
57
|
-
site_classic_poi: "text-site_classic_poi-
|
|
58
|
-
site_classic_zone: "text-site_classic_zone-
|
|
57
|
+
site_classic_poi: "text-site_classic_poi-600",
|
|
58
|
+
site_classic_zone: "text-site_classic_zone-600",
|
|
59
59
|
site_depot: "text-site_depot-500",
|
|
60
60
|
site_work_place: "text-site_work_place-600",
|
|
61
61
|
site_construction_site: "text-site_construction_site-500",
|
|
62
|
-
site_unknown: "text-site_unknown-
|
|
63
|
-
on_rent: "text-on_rent-
|
|
64
|
-
returned: "text-returned-
|
|
65
|
-
available: "text-available-
|
|
66
|
-
pickup_ready: "text-pickup_ready-
|
|
67
|
-
transfer: "text-transfer-
|
|
68
|
-
in_repair: "text-in_repair-
|
|
69
|
-
other_rental_status: "text-other_rental_status-
|
|
62
|
+
site_unknown: "text-site_unknown-600",
|
|
63
|
+
on_rent: "text-on_rent-400",
|
|
64
|
+
returned: "text-returned-500",
|
|
65
|
+
available: "text-available-500",
|
|
66
|
+
pickup_ready: "text-pickup_ready-500",
|
|
67
|
+
transfer: "text-transfer-300",
|
|
68
|
+
in_repair: "text-in_repair-400",
|
|
69
|
+
other_rental_status: "text-other_rental_status-500",
|
|
70
70
|
},
|
|
71
71
|
size: {
|
|
72
72
|
small: "w-4",
|
|
@@ -1044,7 +1044,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1044
1044
|
const callback = useRef(onTimeout);
|
|
1045
1045
|
const startTimeout = useCallback(() => {
|
|
1046
1046
|
ready.current = false;
|
|
1047
|
-
|
|
1047
|
+
if (timeout.current) {
|
|
1048
|
+
clearTimeout(timeout.current);
|
|
1049
|
+
}
|
|
1048
1050
|
timeout.current = setTimeout(() => {
|
|
1049
1051
|
ready.current = true;
|
|
1050
1052
|
callback.current();
|
|
@@ -1052,7 +1054,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1052
1054
|
}, [duration]);
|
|
1053
1055
|
const stopTimeout = useCallback(() => {
|
|
1054
1056
|
ready.current = null;
|
|
1055
|
-
|
|
1057
|
+
if (timeout.current) {
|
|
1058
|
+
clearTimeout(timeout.current);
|
|
1059
|
+
}
|
|
1056
1060
|
}, []);
|
|
1057
1061
|
useEffect(() => {
|
|
1058
1062
|
// Use the latest callback function provided by the parent component.
|
|
@@ -1061,7 +1065,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1061
1065
|
useEffect(() => {
|
|
1062
1066
|
// Cleanup function to clear the timeout when component unmounts
|
|
1063
1067
|
return () => {
|
|
1064
|
-
|
|
1068
|
+
if (timeout.current) {
|
|
1069
|
+
clearTimeout(timeout.current);
|
|
1070
|
+
}
|
|
1065
1071
|
};
|
|
1066
1072
|
}, []);
|
|
1067
1073
|
return { startTimeout, stopTimeout };
|
|
@@ -1679,7 +1685,7 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
|
|
|
1679
1685
|
*/
|
|
1680
1686
|
const Breadcrumb = ({ className, dataTestId, breadcrumbItems, back }) => {
|
|
1681
1687
|
const breadCrumbItemsToJSX = useBreadcrumbItemsToRender(breadcrumbItems);
|
|
1682
|
-
return (jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsx(IconButton, { dataTestId: `backButton-${dataTestId}`, icon: jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick:
|
|
1688
|
+
return (jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsx(IconButton, { dataTestId: `backButton-${dataTestId}`, icon: jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick: back, size: "small", variant: "ghost-neutral" }), jsx("div", { children: jsx(BreadcrumbContainer, { breadcrumbItems: breadCrumbItemsToJSX, dataTestId: dataTestId }) })] }));
|
|
1683
1689
|
};
|
|
1684
1690
|
/**
|
|
1685
1691
|
* BreadcrumbContainer is a helper component that renders the breadcrumb items based on the screen size.
|
|
@@ -2053,7 +2059,7 @@ const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
|
|
|
2053
2059
|
const [animating, setAnimating] = useState(false);
|
|
2054
2060
|
const [, copyToClipboard] = useCopyToClipboard();
|
|
2055
2061
|
const handleOnClick = () => {
|
|
2056
|
-
copyToClipboard(value);
|
|
2062
|
+
void copyToClipboard(value);
|
|
2057
2063
|
setAnimating(true);
|
|
2058
2064
|
};
|
|
2059
2065
|
return (jsx("span", { className: cvaCopyableText({ animating, className }), "data-testid": dataTestId, onAnimationEnd: () => setAnimating(false), onClick: handleOnClick, title: value, children: text }));
|
|
@@ -2228,9 +2234,12 @@ const cvaHighlight = cvaMerge([
|
|
|
2228
2234
|
"truncate",
|
|
2229
2235
|
"max-w-full",
|
|
2230
2236
|
"w-fit",
|
|
2231
|
-
"text-xs",
|
|
2232
2237
|
], {
|
|
2233
2238
|
variants: {
|
|
2239
|
+
size: {
|
|
2240
|
+
small: ["text-xs"],
|
|
2241
|
+
medium: ["text-sm"],
|
|
2242
|
+
},
|
|
2234
2243
|
color: {
|
|
2235
2244
|
info: ["bg-info-100", "text-info-700"],
|
|
2236
2245
|
success: ["bg-success-100", "text-success-700"],
|
|
@@ -2240,6 +2249,7 @@ const cvaHighlight = cvaMerge([
|
|
|
2240
2249
|
},
|
|
2241
2250
|
},
|
|
2242
2251
|
defaultVariants: {
|
|
2252
|
+
size: "small",
|
|
2243
2253
|
color: "warning",
|
|
2244
2254
|
},
|
|
2245
2255
|
});
|
|
@@ -2256,8 +2266,8 @@ const cvaHighlightText = cvaMerge(["truncate"]);
|
|
|
2256
2266
|
* @param {HighlightProps} props - The props for the highlight component
|
|
2257
2267
|
* @returns {ReactElement} highlight component
|
|
2258
2268
|
*/
|
|
2259
|
-
const Highlight = ({ className, dataTestId, children, color = "warning", ref }) => {
|
|
2260
|
-
return (jsx("div", { className: cvaHighlight({ className, color }), "data-testid": dataTestId, ref: ref, children: jsx("span", { className: cvaHighlightText(), children: children }) }));
|
|
2269
|
+
const Highlight = ({ className, dataTestId, children, size = "small", color = "warning", ref, }) => {
|
|
2270
|
+
return (jsx("div", { className: cvaHighlight({ className, size, color }), "data-testid": dataTestId, ref: ref, children: jsx("span", { className: cvaHighlightText(), children: children }) }));
|
|
2261
2271
|
};
|
|
2262
2272
|
Highlight.displayName = "Highlight";
|
|
2263
2273
|
|
|
@@ -3159,7 +3169,9 @@ const MenuItem = ({ className, dataTestId, label, children, selected, focused, p
|
|
|
3159
3169
|
/* Handle tab navigation */
|
|
3160
3170
|
const handleKeyDown = (e) => {
|
|
3161
3171
|
if (e.key === "Enter" && onClick && !disabled) {
|
|
3162
|
-
|
|
3172
|
+
if (stopPropagation) {
|
|
3173
|
+
e.stopPropagation();
|
|
3174
|
+
}
|
|
3163
3175
|
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
3164
3176
|
onClick(e);
|
|
3165
3177
|
}
|
|
@@ -3172,7 +3184,9 @@ const MenuItem = ({ className, dataTestId, label, children, selected, focused, p
|
|
|
3172
3184
|
variant,
|
|
3173
3185
|
focused,
|
|
3174
3186
|
}), "data-testid": dataTestId ? `${dataTestId}-menu-item` : "menu-item", id: id, onClick: e => {
|
|
3175
|
-
|
|
3187
|
+
if (stopPropagation) {
|
|
3188
|
+
e.stopPropagation();
|
|
3189
|
+
}
|
|
3176
3190
|
onClick?.(e);
|
|
3177
3191
|
}, onKeyDown: handleKeyDown, role: "menuitem", tabIndex: disabled ? -1 : (tabIndex ?? 0), children: [prefix ? (jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children && typeof children !== "string" ? (children) : (jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [children ?? label, optionLabelDescription ? jsxs("span", { className: "text-secondary-400 ml-1", children: ["(", optionLabelDescription, ")"] }) : null] })), suffix ? (jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled, className: "flex items-center" }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
|
|
3178
3192
|
};
|
|
@@ -3628,7 +3642,7 @@ const cvaSidebarChildContainer = cvaMerge(["apply", "flex", "overflow-hidden", "
|
|
|
3628
3642
|
* A hook used to detect what children are overflowing a container.
|
|
3629
3643
|
*
|
|
3630
3644
|
* @param {OverflowItemsOptions} root0 The options for the hook.
|
|
3631
|
-
* @param {
|
|
3645
|
+
* @param {number | Array<number>} root0.threshold The threshold for the intersection observer.
|
|
3632
3646
|
* @returns {object} The overflow items and the ref to the container.
|
|
3633
3647
|
*/
|
|
3634
3648
|
const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id", children, }) => {
|
|
@@ -3638,7 +3652,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
3638
3652
|
const handleIntersection = useCallback(entries => {
|
|
3639
3653
|
const updatedEntries = {};
|
|
3640
3654
|
entries.forEach(entry => {
|
|
3641
|
-
// @ts-
|
|
3655
|
+
// @ts-expect-error - suppressImplicitAnyIndexErrors
|
|
3642
3656
|
const targetElementId = entry.target[childUniqueIdentifierAttribute];
|
|
3643
3657
|
if (targetElementId) {
|
|
3644
3658
|
updatedEntries[targetElementId] = entry.isIntersecting ? false : true;
|
|
@@ -4031,7 +4045,7 @@ const VirtualizedList = ({ count, rowHeight = 40, pagination, children, classNam
|
|
|
4031
4045
|
scrollParent.removeEventListener("scroll", handleScroll);
|
|
4032
4046
|
};
|
|
4033
4047
|
}
|
|
4034
|
-
return
|
|
4048
|
+
return undefined;
|
|
4035
4049
|
}, [scrollParent, fetchMoreOnBottomReached]);
|
|
4036
4050
|
return (jsx("div", { className: cvaVirtualizedListContainer({ parentControlledScrollable, className }), "data-testid": dataTestId, ref: containerRef, children: jsx("ul", { className: cvaVirtualizedList(), ref: listRef, style: { height: `${getTotalSize()}px`, outline: "none" }, children: getVirtualItems().map(virtualRow => {
|
|
4037
4051
|
const isLoaderRow = virtualRow.index > count - 1;
|
|
@@ -4049,7 +4063,7 @@ const cvaZStackItem = cvaMerge(["col-start-1", "col-end-1", "row-start-1", "row-
|
|
|
4049
4063
|
* Is a good alternative to "position: absolute" that avoids some of the unfortunate side effects of absolute positioning.
|
|
4050
4064
|
*
|
|
4051
4065
|
* @param { ZStackProps} props - The props for the ZStack component
|
|
4052
|
-
* @returns {
|
|
4066
|
+
* @returns {Element} ZStack component
|
|
4053
4067
|
*/
|
|
4054
4068
|
const ZStack = ({ children, className, dataTestId }) => {
|
|
4055
4069
|
return (jsx("div", { className: cvaZStackContainer({ className }), "data-testid": dataTestId, children: Children.map(children, (child, index) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.12",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"lodash": "4.17.21",
|
|
16
16
|
"@testing-library/react": "16.2.0",
|
|
17
17
|
"@floating-ui/react": "^0.26.25",
|
|
18
|
-
"@tanstack/react-router": "1.114.29",
|
|
19
18
|
"string-ts": "^2.0.0",
|
|
20
19
|
"tailwind-merge": "^2.0.0",
|
|
21
|
-
"@trackunit/ui-design-tokens": "1.6.
|
|
22
|
-
"@trackunit/css-class-variance-utilities": "1.6.
|
|
23
|
-
"@trackunit/shared-utils": "1.8.
|
|
24
|
-
"@trackunit/ui-icons": "1.6.
|
|
25
|
-
"@trackunit/react-table-pagination": "1.6.
|
|
26
|
-
"@trackunit/react-test-setup": "1.3.
|
|
20
|
+
"@trackunit/ui-design-tokens": "1.6.10",
|
|
21
|
+
"@trackunit/css-class-variance-utilities": "1.6.10",
|
|
22
|
+
"@trackunit/shared-utils": "1.8.10",
|
|
23
|
+
"@trackunit/ui-icons": "1.6.9",
|
|
24
|
+
"@trackunit/react-table-pagination": "1.6.9",
|
|
25
|
+
"@trackunit/react-test-setup": "1.3.10",
|
|
26
|
+
"@tanstack/react-router": "1.114.29"
|
|
27
27
|
},
|
|
28
28
|
"module": "./index.esm.js",
|
|
29
29
|
"main": "./index.cjs.js",
|
|
@@ -2,6 +2,10 @@ import { ReactNode, Ref } from "react";
|
|
|
2
2
|
import { CommonProps, Size } from "../../common";
|
|
3
3
|
export type HighlightSize = Extract<Size, "small" | "medium">;
|
|
4
4
|
export interface HighlightProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* The size of the highlight. Allowed values: "small" (text-xs), "medium" (text-sm).
|
|
7
|
+
*/
|
|
8
|
+
size?: HighlightSize;
|
|
5
9
|
/**
|
|
6
10
|
* The color of the highlight. Allowed values: "primary", "success", "warning", "danger", "unknown".
|
|
7
11
|
*/
|
|
@@ -27,6 +31,6 @@ export interface HighlightProps extends CommonProps {
|
|
|
27
31
|
* @returns {ReactElement} highlight component
|
|
28
32
|
*/
|
|
29
33
|
export declare const Highlight: {
|
|
30
|
-
({ className, dataTestId, children, color, ref }: HighlightProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
({ className, dataTestId, children, size, color, ref, }: HighlightProps): import("react/jsx-runtime").JSX.Element;
|
|
31
35
|
displayName: string;
|
|
32
36
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const cvaHighlight: (props?: ({
|
|
2
|
+
size?: "small" | "medium" | null | undefined;
|
|
2
3
|
color?: "info" | "success" | "warning" | "danger" | "unknown" | null | undefined;
|
|
3
4
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
4
5
|
export declare const cvaHighlightText: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
@@ -30,7 +30,7 @@ export type OverflowMap = {
|
|
|
30
30
|
* A hook used to detect what children are overflowing a container.
|
|
31
31
|
*
|
|
32
32
|
* @param {OverflowItemsOptions} root0 The options for the hook.
|
|
33
|
-
* @param {
|
|
33
|
+
* @param {number | Array<number>} root0.threshold The threshold for the intersection observer.
|
|
34
34
|
* @returns {object} The overflow items and the ref to the container.
|
|
35
35
|
*/
|
|
36
36
|
export declare const useOverflowItems: ({ threshold, childUniqueIdentifierAttribute, children, }: OverflowItemsOptions) => {
|
|
@@ -8,6 +8,6 @@ export type ZStackProps = CommonProps & {
|
|
|
8
8
|
* Is a good alternative to "position: absolute" that avoids some of the unfortunate side effects of absolute positioning.
|
|
9
9
|
*
|
|
10
10
|
* @param { ZStackProps} props - The props for the ZStack component
|
|
11
|
-
* @returns {
|
|
11
|
+
* @returns {Element} ZStack component
|
|
12
12
|
*/
|
|
13
13
|
export declare const ZStack: ({ children, className, dataTestId }: ZStackProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RenderHookOptions } from "@testing-library/react";
|
|
1
|
+
import { RenderHookOptions, RenderHookResult } from "@testing-library/react";
|
|
2
2
|
/**
|
|
3
3
|
* Custom renderHook function to avoid boilerplate
|
|
4
4
|
*
|
|
@@ -7,6 +7,6 @@ import { RenderHookOptions } from "@testing-library/react";
|
|
|
7
7
|
* @param {(props: T) => K} callback - callback function
|
|
8
8
|
* @param {RenderHookOptions<T>} [options] - options
|
|
9
9
|
*/
|
|
10
|
-
declare const customRenderHook: <TProps, TReturn>(callback: (props: TProps) => TReturn, options?: RenderHookOptions<TProps>) =>
|
|
10
|
+
declare const customRenderHook: <TProps, TReturn>(callback: (props: TProps) => TReturn, options?: RenderHookOptions<TProps>) => RenderHookResult<TReturn, TProps>;
|
|
11
11
|
export * from "@testing-library/react";
|
|
12
12
|
export { customRenderHook as renderHook };
|