@trackunit/react-components 1.16.6 → 1.16.7
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 +16 -16
- package/index.esm.js +16 -16
- package/package.json +5 -5
- package/src/components/Alert/Alert.d.ts +5 -5
- package/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/src/components/Breadcrumb/utils/types.d.ts +2 -2
- package/src/components/Card/CardHeader.d.ts +2 -2
- package/src/components/EmptyState/EmptyState.d.ts +2 -2
- package/src/components/HorizontalOverflowScroller/OverflowIndicator.d.ts +2 -2
- package/src/components/Icon/Icon.d.ts +2 -2
- package/src/components/KPICard/KPICard.d.ts +2 -2
- package/src/components/List/useList.d.ts +3 -3
- package/src/components/ListItem/ListItem.d.ts +1 -1
- package/src/components/Menu/MenuList/MenuList.d.ts +2 -2
- package/src/components/Sidebar/Sidebar.d.ts +2 -2
- package/src/components/Tag/Tag.d.ts +3 -3
- package/src/components/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/src/components/buttons/Button/Button.d.ts +2 -1
- package/src/components/buttons/StarButton/StarButton.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -277,7 +277,7 @@ const TAG_TEXT_MIN_WIDTH_PX = sharedUtils.parseTailwindArbitraryValue(TAG_TEXT_M
|
|
|
277
277
|
* <Tag
|
|
278
278
|
* color="primary"
|
|
279
279
|
* icon={<Icon name="Funnel" size="small" />}
|
|
280
|
-
*
|
|
280
|
+
* onClickClose={onRemove}
|
|
281
281
|
* >
|
|
282
282
|
* {label}
|
|
283
283
|
* </Tag>
|
|
@@ -286,7 +286,7 @@ const TAG_TEXT_MIN_WIDTH_PX = sharedUtils.parseTailwindArbitraryValue(TAG_TEXT_M
|
|
|
286
286
|
* @param {TagProps} props - The props for the Tag component.
|
|
287
287
|
* @returns {ReactElement} The rendered Tag component.
|
|
288
288
|
*/
|
|
289
|
-
const Tag = ({ className, "data-testid": dataTestId, children, size = "medium",
|
|
289
|
+
const Tag = ({ className, "data-testid": dataTestId, children, size = "medium", onClickClose, color = "info", disabled = false, ref, icon, onMouseEnter, }) => {
|
|
290
290
|
const textRef = react.useRef(null);
|
|
291
291
|
const [shouldTruncate, setShouldTruncate] = react.useState(false);
|
|
292
292
|
react.useLayoutEffect(() => {
|
|
@@ -307,23 +307,23 @@ const Tag = ({ className, "data-testid": dataTestId, children, size = "medium",
|
|
|
307
307
|
return false;
|
|
308
308
|
}, [color]);
|
|
309
309
|
const layout = react.useMemo(() => {
|
|
310
|
-
if (
|
|
310
|
+
if (onClickClose !== undefined && isSupportedDismissColor && !disabled) {
|
|
311
311
|
return "containsDismiss";
|
|
312
312
|
}
|
|
313
313
|
if (icon !== null && icon !== undefined) {
|
|
314
314
|
return "containsIcon";
|
|
315
315
|
}
|
|
316
316
|
return "default";
|
|
317
|
-
}, [
|
|
317
|
+
}, [onClickClose, isSupportedDismissColor, disabled, icon]);
|
|
318
318
|
return (jsxRuntime.jsxs("div", { className: cvaTag({
|
|
319
319
|
className,
|
|
320
320
|
size,
|
|
321
321
|
color,
|
|
322
322
|
layout,
|
|
323
323
|
border: color === "white" ? "default" : "none",
|
|
324
|
-
}), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, children: [icon !== null && icon !== undefined && size === "medium" ? (jsxRuntime.jsx("div", { className: cvaTagIconContainer(), "data-slot": "icon", children: icon })) : null, jsxRuntime.jsx("span", { className: cvaTagText({ truncate: shouldTruncate }), ref: textRef, children: children }), Boolean(
|
|
324
|
+
}), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, children: [icon !== null && icon !== undefined && size === "medium" ? (jsxRuntime.jsx("div", { className: cvaTagIconContainer(), "data-slot": "icon", children: icon })) : null, jsxRuntime.jsx("span", { className: cvaTagText({ truncate: shouldTruncate }), ref: textRef, children: children }), Boolean(onClickClose) && isSupportedDismissColor && size === "medium" && !disabled ? (
|
|
325
325
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
326
|
-
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), "data-slot": "dismiss",
|
|
326
|
+
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), "data-slot": "dismiss", onClick: onClickClose, children: jsxRuntime.jsx(Icon, { className: cvaTagIcon(), "data-testid": dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
327
327
|
};
|
|
328
328
|
|
|
329
329
|
/**
|
|
@@ -1054,7 +1054,7 @@ const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["shrink-0", "g
|
|
|
1054
1054
|
* @param {AlertProps} props - The props for the Alert component
|
|
1055
1055
|
* @returns {ReactElement} Alert component
|
|
1056
1056
|
*/
|
|
1057
|
-
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction,
|
|
1057
|
+
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClickClose, "data-testid": dataTestId, autoScroll = false, actionsInline = false, }) => {
|
|
1058
1058
|
const ref = react.useRef(null);
|
|
1059
1059
|
const { isTextWrapping, ref: titleRef } = useIsTextWrapping();
|
|
1060
1060
|
react.useEffect(() => {
|
|
@@ -1069,13 +1069,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
1069
1069
|
}), children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer({
|
|
1070
1070
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
1071
1071
|
actionsInline,
|
|
1072
|
-
}), children: jsxRuntime.jsx(Icon, { color: color, name: getIconName(color) }) }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? (jsxRuntime.jsx(Text, { "data-testid": `${dataTestId}-title`, ref: titleRef, weight: "bold", children: title })) : null, children !== null && children !== undefined ? (jsxRuntime.jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: "normal", children: children })) : null] }),
|
|
1072
|
+
}), children: jsxRuntime.jsx(Icon, { color: color, name: getIconName(color) }) }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? (jsxRuntime.jsx(Text, { "data-testid": `${dataTestId}-title`, ref: titleRef, weight: "bold", children: title })) : null, children !== null && children !== undefined ? (jsxRuntime.jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: "normal", children: children })) : null] }), onClickClose !== undefined && !actionsInline ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer({
|
|
1073
1073
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
1074
1074
|
actionsInline,
|
|
1075
|
-
}), children: jsxRuntime.jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), onClick:
|
|
1075
|
+
}), children: jsxRuntime.jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), onClick: onClickClose, size: "small", title: "Close Alert", variant: "ghost-neutral" }) })) : null] }), primaryAction !== undefined || secondaryAction !== undefined ? (jsxRuntime.jsxs("div", { className: cvaAlertActionsContainer({ actionsInline }), children: [secondaryAction !== undefined ? (jsxRuntime.jsx(Button, { loading: secondaryAction.loading, onClick: secondaryAction.onClick, size: "small", variant: "ghost-neutral", children: secondaryAction.label })) : null, primaryAction !== undefined ? (jsxRuntime.jsx(Button, { loading: primaryAction.loading, onClick: primaryAction.onClick, size: "small", variant: color === "danger" ? "primary-danger" : "primary", children: primaryAction.label })) : null] })) : null, onClickClose !== undefined && actionsInline ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer({
|
|
1076
1076
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
1077
1077
|
actionsInline,
|
|
1078
|
-
}), children: jsxRuntime.jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), onClick:
|
|
1078
|
+
}), children: jsxRuntime.jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), onClick: onClickClose, size: "small", title: "Close Alert", variant: "ghost-neutral" }) })) : null] }));
|
|
1079
1079
|
};
|
|
1080
1080
|
const getIconName = (color) => {
|
|
1081
1081
|
switch (color) {
|
|
@@ -1389,9 +1389,9 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
|
|
|
1389
1389
|
* @param {BreadcrumbProps} props - The props for the Breadcrumb component
|
|
1390
1390
|
* @returns {ReactElement} Breadcrumb component
|
|
1391
1391
|
*/
|
|
1392
|
-
const Breadcrumb = ({ className, "data-testid": dataTestId, breadcrumbItems,
|
|
1392
|
+
const Breadcrumb = ({ className, "data-testid": dataTestId, breadcrumbItems, onClickBack, }) => {
|
|
1393
1393
|
const breadCrumbItemsToJSX = useBreadcrumbItemsToRender(breadcrumbItems);
|
|
1394
|
-
return (jsxRuntime.jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(IconButton, { "data-testid": `backButton-${dataTestId}`, icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick:
|
|
1394
|
+
return (jsxRuntime.jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(IconButton, { "data-testid": `backButton-${dataTestId}`, icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick: onClickBack, size: "small", variant: "ghost-neutral" }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(BreadcrumbContainer, { breadcrumbItems: breadCrumbItemsToJSX, "data-testid": dataTestId }) })] }));
|
|
1395
1395
|
};
|
|
1396
1396
|
/**
|
|
1397
1397
|
* BreadcrumbContainer is a helper component that renders the breadcrumb items based on the screen size.
|
|
@@ -1647,12 +1647,12 @@ const Heading = ({ variant = "primary", inverted = false, subtle = false, classN
|
|
|
1647
1647
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
1648
1648
|
* @returns {ReactElement} CardHeader component
|
|
1649
1649
|
*/
|
|
1650
|
-
const CardHeader = ({ heading, headingVariant = "secondary", subHeading,
|
|
1650
|
+
const CardHeader = ({ heading, headingVariant = "secondary", subHeading, onClickClose, "data-testid": dataTestId, className, children, accessories, actions, padding = "default", hideSeparator = false, }) => {
|
|
1651
1651
|
return (jsxRuntime.jsx("div", { className: cvaCardHeaderContainer({
|
|
1652
1652
|
border: hideSeparator ? "borderless" : "default",
|
|
1653
1653
|
padding,
|
|
1654
1654
|
className,
|
|
1655
|
-
}), "data-card-header": true, "data-testid": dataTestId, children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading !== null && subHeading !== undefined ? (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxRuntime.jsxs("div", { className: "flex place-items-center gap-x-2 gap-y-1", children: [actions,
|
|
1655
|
+
}), "data-card-header": true, "data-testid": dataTestId, children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading !== null && subHeading !== undefined ? (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxRuntime.jsxs("div", { className: "flex place-items-center gap-x-2 gap-y-1", children: [actions, onClickClose ? (jsxRuntime.jsx(IconButton, { className: "!h-min", "data-testid": "card-header-close-button", icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), onClick: onClickClose, variant: "ghost-neutral" })) : null] })] }) }));
|
|
1656
1656
|
};
|
|
1657
1657
|
|
|
1658
1658
|
const cvaClickable = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -6622,8 +6622,8 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
6622
6622
|
}, ...moreMenuProps, className: moreMenuProps?.className, "data-testid": `${dataTestId}-more-menu`, children: close => (jsxRuntime.jsx(MenuList, { ...menuListProps, "data-testid": dataTestId, children: react.Children.map(children, child => {
|
|
6623
6623
|
return itemOverflowMap[child.props.id] === true
|
|
6624
6624
|
? react.cloneElement(child, {
|
|
6625
|
-
onClick:
|
|
6626
|
-
child.props.onClick?.();
|
|
6625
|
+
onClick: e => {
|
|
6626
|
+
child.props.onClick?.(e);
|
|
6627
6627
|
close();
|
|
6628
6628
|
},
|
|
6629
6629
|
className: "w-full",
|
package/index.esm.js
CHANGED
|
@@ -275,7 +275,7 @@ const TAG_TEXT_MIN_WIDTH_PX = parseTailwindArbitraryValue(TAG_TEXT_MIN_WIDTH_CLA
|
|
|
275
275
|
* <Tag
|
|
276
276
|
* color="primary"
|
|
277
277
|
* icon={<Icon name="Funnel" size="small" />}
|
|
278
|
-
*
|
|
278
|
+
* onClickClose={onRemove}
|
|
279
279
|
* >
|
|
280
280
|
* {label}
|
|
281
281
|
* </Tag>
|
|
@@ -284,7 +284,7 @@ const TAG_TEXT_MIN_WIDTH_PX = parseTailwindArbitraryValue(TAG_TEXT_MIN_WIDTH_CLA
|
|
|
284
284
|
* @param {TagProps} props - The props for the Tag component.
|
|
285
285
|
* @returns {ReactElement} The rendered Tag component.
|
|
286
286
|
*/
|
|
287
|
-
const Tag = ({ className, "data-testid": dataTestId, children, size = "medium",
|
|
287
|
+
const Tag = ({ className, "data-testid": dataTestId, children, size = "medium", onClickClose, color = "info", disabled = false, ref, icon, onMouseEnter, }) => {
|
|
288
288
|
const textRef = useRef(null);
|
|
289
289
|
const [shouldTruncate, setShouldTruncate] = useState(false);
|
|
290
290
|
useLayoutEffect(() => {
|
|
@@ -305,23 +305,23 @@ const Tag = ({ className, "data-testid": dataTestId, children, size = "medium",
|
|
|
305
305
|
return false;
|
|
306
306
|
}, [color]);
|
|
307
307
|
const layout = useMemo(() => {
|
|
308
|
-
if (
|
|
308
|
+
if (onClickClose !== undefined && isSupportedDismissColor && !disabled) {
|
|
309
309
|
return "containsDismiss";
|
|
310
310
|
}
|
|
311
311
|
if (icon !== null && icon !== undefined) {
|
|
312
312
|
return "containsIcon";
|
|
313
313
|
}
|
|
314
314
|
return "default";
|
|
315
|
-
}, [
|
|
315
|
+
}, [onClickClose, isSupportedDismissColor, disabled, icon]);
|
|
316
316
|
return (jsxs("div", { className: cvaTag({
|
|
317
317
|
className,
|
|
318
318
|
size,
|
|
319
319
|
color,
|
|
320
320
|
layout,
|
|
321
321
|
border: color === "white" ? "default" : "none",
|
|
322
|
-
}), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, children: [icon !== null && icon !== undefined && size === "medium" ? (jsx("div", { className: cvaTagIconContainer(), "data-slot": "icon", children: icon })) : null, jsx("span", { className: cvaTagText({ truncate: shouldTruncate }), ref: textRef, children: children }), Boolean(
|
|
322
|
+
}), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, children: [icon !== null && icon !== undefined && size === "medium" ? (jsx("div", { className: cvaTagIconContainer(), "data-slot": "icon", children: icon })) : null, jsx("span", { className: cvaTagText({ truncate: shouldTruncate }), ref: textRef, children: children }), Boolean(onClickClose) && isSupportedDismissColor && size === "medium" && !disabled ? (
|
|
323
323
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
324
|
-
jsx("div", { className: cvaTagIconContainer(), "data-slot": "dismiss",
|
|
324
|
+
jsx("div", { className: cvaTagIconContainer(), "data-slot": "dismiss", onClick: onClickClose, children: jsx(Icon, { className: cvaTagIcon(), "data-testid": dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
325
325
|
};
|
|
326
326
|
|
|
327
327
|
/**
|
|
@@ -1052,7 +1052,7 @@ const cvaAlertIconContainer = cvaMerge(["shrink-0", "grid", "w-min", "flex"], {
|
|
|
1052
1052
|
* @param {AlertProps} props - The props for the Alert component
|
|
1053
1053
|
* @returns {ReactElement} Alert component
|
|
1054
1054
|
*/
|
|
1055
|
-
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction,
|
|
1055
|
+
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClickClose, "data-testid": dataTestId, autoScroll = false, actionsInline = false, }) => {
|
|
1056
1056
|
const ref = useRef(null);
|
|
1057
1057
|
const { isTextWrapping, ref: titleRef } = useIsTextWrapping();
|
|
1058
1058
|
useEffect(() => {
|
|
@@ -1067,13 +1067,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
1067
1067
|
}), children: [jsx("div", { className: cvaAlertIconContainer({
|
|
1068
1068
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
1069
1069
|
actionsInline,
|
|
1070
|
-
}), children: jsx(Icon, { color: color, name: getIconName(color) }) }), jsxs("div", { className: cvaContent(), children: [title ? (jsx(Text, { "data-testid": `${dataTestId}-title`, ref: titleRef, weight: "bold", children: title })) : null, children !== null && children !== undefined ? (jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: "normal", children: children })) : null] }),
|
|
1070
|
+
}), children: jsx(Icon, { color: color, name: getIconName(color) }) }), jsxs("div", { className: cvaContent(), children: [title ? (jsx(Text, { "data-testid": `${dataTestId}-title`, ref: titleRef, weight: "bold", children: title })) : null, children !== null && children !== undefined ? (jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: "normal", children: children })) : null] }), onClickClose !== undefined && !actionsInline ? (jsx("div", { className: cvaAlertCloseButtonContainer({
|
|
1071
1071
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
1072
1072
|
actionsInline,
|
|
1073
|
-
}), children: jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsx(Icon, { name: "XMark", size: "small" }), onClick:
|
|
1073
|
+
}), children: jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsx(Icon, { name: "XMark", size: "small" }), onClick: onClickClose, size: "small", title: "Close Alert", variant: "ghost-neutral" }) })) : null] }), primaryAction !== undefined || secondaryAction !== undefined ? (jsxs("div", { className: cvaAlertActionsContainer({ actionsInline }), children: [secondaryAction !== undefined ? (jsx(Button, { loading: secondaryAction.loading, onClick: secondaryAction.onClick, size: "small", variant: "ghost-neutral", children: secondaryAction.label })) : null, primaryAction !== undefined ? (jsx(Button, { loading: primaryAction.loading, onClick: primaryAction.onClick, size: "small", variant: color === "danger" ? "primary-danger" : "primary", children: primaryAction.label })) : null] })) : null, onClickClose !== undefined && actionsInline ? (jsx("div", { className: cvaAlertCloseButtonContainer({
|
|
1074
1074
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
1075
1075
|
actionsInline,
|
|
1076
|
-
}), children: jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsx(Icon, { name: "XMark", size: "small" }), onClick:
|
|
1076
|
+
}), children: jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsx(Icon, { name: "XMark", size: "small" }), onClick: onClickClose, size: "small", title: "Close Alert", variant: "ghost-neutral" }) })) : null] }));
|
|
1077
1077
|
};
|
|
1078
1078
|
const getIconName = (color) => {
|
|
1079
1079
|
switch (color) {
|
|
@@ -1387,9 +1387,9 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
|
|
|
1387
1387
|
* @param {BreadcrumbProps} props - The props for the Breadcrumb component
|
|
1388
1388
|
* @returns {ReactElement} Breadcrumb component
|
|
1389
1389
|
*/
|
|
1390
|
-
const Breadcrumb = ({ className, "data-testid": dataTestId, breadcrumbItems,
|
|
1390
|
+
const Breadcrumb = ({ className, "data-testid": dataTestId, breadcrumbItems, onClickBack, }) => {
|
|
1391
1391
|
const breadCrumbItemsToJSX = useBreadcrumbItemsToRender(breadcrumbItems);
|
|
1392
|
-
return (jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsx(IconButton, { "data-testid": `backButton-${dataTestId}`, icon: jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick:
|
|
1392
|
+
return (jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsx(IconButton, { "data-testid": `backButton-${dataTestId}`, icon: jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick: onClickBack, size: "small", variant: "ghost-neutral" }), jsx("div", { children: jsx(BreadcrumbContainer, { breadcrumbItems: breadCrumbItemsToJSX, "data-testid": dataTestId }) })] }));
|
|
1393
1393
|
};
|
|
1394
1394
|
/**
|
|
1395
1395
|
* BreadcrumbContainer is a helper component that renders the breadcrumb items based on the screen size.
|
|
@@ -1645,12 +1645,12 @@ const Heading = ({ variant = "primary", inverted = false, subtle = false, classN
|
|
|
1645
1645
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
1646
1646
|
* @returns {ReactElement} CardHeader component
|
|
1647
1647
|
*/
|
|
1648
|
-
const CardHeader = ({ heading, headingVariant = "secondary", subHeading,
|
|
1648
|
+
const CardHeader = ({ heading, headingVariant = "secondary", subHeading, onClickClose, "data-testid": dataTestId, className, children, accessories, actions, padding = "default", hideSeparator = false, }) => {
|
|
1649
1649
|
return (jsx("div", { className: cvaCardHeaderContainer({
|
|
1650
1650
|
border: hideSeparator ? "borderless" : "default",
|
|
1651
1651
|
padding,
|
|
1652
1652
|
className,
|
|
1653
|
-
}), "data-card-header": true, "data-testid": dataTestId, children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading !== null && subHeading !== undefined ? (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxs("div", { className: "flex place-items-center gap-x-2 gap-y-1", children: [actions,
|
|
1653
|
+
}), "data-card-header": true, "data-testid": dataTestId, children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading !== null && subHeading !== undefined ? (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxs("div", { className: "flex place-items-center gap-x-2 gap-y-1", children: [actions, onClickClose ? (jsx(IconButton, { className: "!h-min", "data-testid": "card-header-close-button", icon: jsx(Icon, { name: "XMark", size: "small" }), onClick: onClickClose, variant: "ghost-neutral" })) : null] })] }) }));
|
|
1654
1654
|
};
|
|
1655
1655
|
|
|
1656
1656
|
const cvaClickable = cvaMerge([
|
|
@@ -6620,8 +6620,8 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
6620
6620
|
}, ...moreMenuProps, className: moreMenuProps?.className, "data-testid": `${dataTestId}-more-menu`, children: close => (jsx(MenuList, { ...menuListProps, "data-testid": dataTestId, children: Children.map(children, child => {
|
|
6621
6621
|
return itemOverflowMap[child.props.id] === true
|
|
6622
6622
|
? cloneElement(child, {
|
|
6623
|
-
onClick:
|
|
6624
|
-
child.props.onClick?.();
|
|
6623
|
+
onClick: e => {
|
|
6624
|
+
child.props.onClick?.(e);
|
|
6625
6625
|
close();
|
|
6626
6626
|
},
|
|
6627
6627
|
className: "w-full",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.7",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"@floating-ui/react": "^0.26.25",
|
|
15
15
|
"string-ts": "^2.0.0",
|
|
16
16
|
"tailwind-merge": "^2.0.0",
|
|
17
|
-
"@trackunit/ui-design-tokens": "1.11.
|
|
18
|
-
"@trackunit/css-class-variance-utilities": "1.11.
|
|
19
|
-
"@trackunit/shared-utils": "1.13.
|
|
20
|
-
"@trackunit/ui-icons": "1.11.
|
|
17
|
+
"@trackunit/ui-design-tokens": "1.11.26",
|
|
18
|
+
"@trackunit/css-class-variance-utilities": "1.11.26",
|
|
19
|
+
"@trackunit/shared-utils": "1.13.26",
|
|
20
|
+
"@trackunit/ui-icons": "1.11.25",
|
|
21
21
|
"@tanstack/react-router": "1.114.29",
|
|
22
22
|
"es-toolkit": "^1.39.10",
|
|
23
23
|
"@tanstack/react-virtual": "3.13.12",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
1
|
+
import { MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
export type AlertColors = "info" | "success" | "warning" | "danger" | "neutral";
|
|
4
4
|
export type AlertActionType = "primary" | "secondary";
|
|
5
5
|
export type AlertAction = {
|
|
6
6
|
label: string;
|
|
7
|
-
onClick:
|
|
7
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export interface AlertProps extends CommonProps {
|
|
@@ -30,9 +30,9 @@ export interface AlertProps extends CommonProps {
|
|
|
30
30
|
*/
|
|
31
31
|
secondaryAction?: AlertAction;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* OnClickClose Event - handler for the close button click.
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
onClickClose?: MouseEventHandler<HTMLButtonElement>;
|
|
36
36
|
/**
|
|
37
37
|
* A prop to enable autoscroll to alert element
|
|
38
38
|
*
|
|
@@ -108,4 +108,4 @@ export interface AlertProps extends CommonProps {
|
|
|
108
108
|
* @param {AlertProps} props - The props for the Alert component
|
|
109
109
|
* @returns {ReactElement} Alert component
|
|
110
110
|
*/
|
|
111
|
-
export declare const Alert: ({ color, title, className, children, primaryAction, secondaryAction,
|
|
111
|
+
export declare const Alert: ({ color, title, className, children, primaryAction, secondaryAction, onClickClose, "data-testid": dataTestId, autoScroll, actionsInline, }: AlertProps) => ReactElement;
|
|
@@ -33,7 +33,7 @@ import { BreadcrumbContainerProps, BreadcrumbProps } from "./utils/types";
|
|
|
33
33
|
* @param {BreadcrumbProps} props - The props for the Breadcrumb component
|
|
34
34
|
* @returns {ReactElement} Breadcrumb component
|
|
35
35
|
*/
|
|
36
|
-
export declare const Breadcrumb: ({ className, "data-testid": dataTestId, breadcrumbItems,
|
|
36
|
+
export declare const Breadcrumb: ({ className, "data-testid": dataTestId, breadcrumbItems, onClickBack, }: BreadcrumbProps) => ReactElement;
|
|
37
37
|
/**
|
|
38
38
|
* BreadcrumbContainer is a helper component that renders the breadcrumb items based on the screen size.
|
|
39
39
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { MouseEventHandler, ReactElement } from "react";
|
|
1
2
|
import { CommonProps } from "../../../common/CommonProps";
|
|
2
|
-
import { ReactElement } from "react";
|
|
3
3
|
export interface BreadcrumbItemProps {
|
|
4
4
|
label: string;
|
|
5
5
|
to: string;
|
|
6
6
|
}
|
|
7
7
|
export interface BreadcrumbProps extends CommonProps {
|
|
8
8
|
breadcrumbItems: Array<BreadcrumbItemProps>;
|
|
9
|
-
|
|
9
|
+
onClickBack: MouseEventHandler<HTMLButtonElement>;
|
|
10
10
|
}
|
|
11
11
|
export interface BreadcrumbContainerProps extends CommonProps {
|
|
12
12
|
breadcrumbItems: Array<ReactElement<BreadcrumbItemProps>>;
|
|
@@ -27,7 +27,7 @@ export interface CardHeaderProps extends CommonProps {
|
|
|
27
27
|
* @deprecated Use `actions` to render a custom close button and handle its `onClick` instead.
|
|
28
28
|
* Function to call when the close button is clicked.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
onClickClose?: MouseEventHandler<HTMLButtonElement>;
|
|
31
31
|
/**
|
|
32
32
|
* Children to render in the header.
|
|
33
33
|
*/
|
|
@@ -47,4 +47,4 @@ export interface CardHeaderProps extends CommonProps {
|
|
|
47
47
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
48
48
|
* @returns {ReactElement} CardHeader component
|
|
49
49
|
*/
|
|
50
|
-
export declare const CardHeader: ({ heading, headingVariant, subHeading,
|
|
50
|
+
export declare const CardHeader: ({ heading, headingVariant, subHeading, onClickClose, "data-testid": dataTestId, className, children, accessories, actions, padding, hideSeparator, }: CardHeaderProps) => ReactElement;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
1
|
+
import { MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
type EmptyStateImage = "WORKER_WITH_SIGN" | "ROAD_BLOCK" | "BUILDING_ERROR" | "WALL_CONSTRUCTION" | "PHONE_LOCK_SECURITY" | "SEARCH_DOCUMENT";
|
|
4
4
|
type EmptyStateButtonAction = {
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
onClick?:
|
|
6
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
7
7
|
title: string;
|
|
8
8
|
to?: {
|
|
9
9
|
pathname: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MouseEventHandler, ReactElement } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
type OverflowDirection = "left" | "right";
|
|
4
4
|
export interface OverflowIndicatorProps extends CommonProps {
|
|
@@ -9,7 +9,7 @@ export interface OverflowIndicatorProps extends CommonProps {
|
|
|
9
9
|
/**
|
|
10
10
|
* Callback function to handle scroll action
|
|
11
11
|
*/
|
|
12
|
-
onClickScroll?:
|
|
12
|
+
onClickScroll?: MouseEventHandler<HTMLButtonElement>;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Overflow indicator component that shows visual cues when content extends beyond visible area
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActivityColors, CriticalityColors, GeneralColors, IntentColors, RentalStatusColors, SitesColors, UtilizationColors } from "@trackunit/ui-design-tokens";
|
|
2
2
|
import { IconName } from "@trackunit/ui-icons";
|
|
3
|
-
import { CSSProperties,
|
|
3
|
+
import { CSSProperties, MouseEventHandler, ReactElement, RefObject } from "react";
|
|
4
4
|
import { AriaProps } from "../../common/AriaProps";
|
|
5
5
|
import { CommonProps } from "../../common/CommonProps";
|
|
6
6
|
import { Size } from "../../common/Size";
|
|
@@ -278,7 +278,7 @@ export type IconProps = DiscriminatedIconProps & CommonProps & AriaProps & {
|
|
|
278
278
|
* The type value depends on the size prop, the small and medium size are always solid, the large size is either solid or outline.
|
|
279
279
|
*/
|
|
280
280
|
type?: "solid" | "outline" | "mini";
|
|
281
|
-
onClick?:
|
|
281
|
+
onClick?: MouseEventHandler<HTMLSpanElement>;
|
|
282
282
|
/**
|
|
283
283
|
* Ref forwarded to the span element
|
|
284
284
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MappedOmit } from "@trackunit/shared-utils";
|
|
2
2
|
import { IconName } from "@trackunit/ui-icons";
|
|
3
|
-
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
import { MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
4
4
|
import { IconColors } from "../Icon/Icon";
|
|
5
5
|
import { KPIProps } from "../KPI/KPI";
|
|
6
6
|
import { NoticeProps } from "../Notice/Notice";
|
|
@@ -14,7 +14,7 @@ export interface KPICardProps extends MappedOmit<KPIProps, "variant"> {
|
|
|
14
14
|
/**
|
|
15
15
|
* On kpi card click handler
|
|
16
16
|
*/
|
|
17
|
-
onClick?:
|
|
17
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
18
18
|
/**
|
|
19
19
|
* Children to be rendered
|
|
20
20
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
|
|
2
|
-
import { ReactElement, RefObject } from "react";
|
|
2
|
+
import { MouseEventHandler, ReactElement, RefObject } from "react";
|
|
3
3
|
import { RelayPagination } from "../../hooks/useRelayPagination";
|
|
4
4
|
import { ListLoadingIndicatorProps } from "./ListLoadingIndicator";
|
|
5
5
|
declare const DEFAULT_LOADING_INDICATOR_CONFIG: Extract<ListLoadingIndicatorProps, {
|
|
@@ -17,7 +17,7 @@ export interface VirtualizationListItemProps {
|
|
|
17
17
|
/** Element ref for virtualization measurement and setting positioning transform styles */
|
|
18
18
|
ref: (node: HTMLLIElement | null) => void;
|
|
19
19
|
/** Click handler for row-level interactions */
|
|
20
|
-
onClick?:
|
|
20
|
+
onClick?: MouseEventHandler<HTMLLIElement>;
|
|
21
21
|
/** Data attribute for accessibility and debugging */
|
|
22
22
|
"data-index": number;
|
|
23
23
|
/** Tab index for keyboard navigation */
|
|
@@ -136,7 +136,7 @@ export interface UseListResult<TItem> extends Pick<Virtualizer<HTMLDivElement, H
|
|
|
136
136
|
/** Helper to create list item props for a given row */
|
|
137
137
|
readonly getListItemProps: (row: ListRow<TItem>, options: {
|
|
138
138
|
className: string;
|
|
139
|
-
onClick?:
|
|
139
|
+
onClick?: MouseEventHandler<HTMLLIElement>;
|
|
140
140
|
}) => VirtualizationListItemProps;
|
|
141
141
|
/** Header element (if provided) */
|
|
142
142
|
readonly header?: ReactElement;
|
|
@@ -25,7 +25,7 @@ export interface ListItemProps extends CommonProps, ListItemVirtualizationProps,
|
|
|
25
25
|
/**Optional thumbnail for the ListItem. Can be used to display an image or icon. */
|
|
26
26
|
thumbnail?: ReactElement;
|
|
27
27
|
/**Makes the items interactive. Can be used to navigate to a different page when an item is clicked. */
|
|
28
|
-
onClick?: MouseEventHandler<
|
|
28
|
+
onClick?: MouseEventHandler<HTMLLIElement>;
|
|
29
29
|
/**Details can be used to nest a component on the right side of the ListItem (can be used to display a tag, icon, highlight, text, etc.) */
|
|
30
30
|
details?: ReactNode;
|
|
31
31
|
/**If an icon is chosen as thumbnail, use this to set the color of the icon. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
1
|
+
import { MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
2
2
|
import { CommonProps } from "../../../common/CommonProps";
|
|
3
3
|
export interface MenuListProps extends CommonProps {
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ export interface MenuListProps extends CommonProps {
|
|
|
6
6
|
*/
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
/** Click handler - typically used to trigger close action. when propagation is NOT prevented on menuItem */
|
|
9
|
-
onClick?:
|
|
9
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
10
10
|
/**
|
|
11
11
|
* Enable multi-selection in the menu list.
|
|
12
12
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps, ReactElement } from "react";
|
|
1
|
+
import { ComponentProps, MouseEventHandler, ReactElement } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
import { MenuList } from "../Menu/MenuList/MenuList";
|
|
4
4
|
import { MoreMenu } from "../Menu/MoreMenu/MoreMenu";
|
|
@@ -9,7 +9,7 @@ export interface SidebarItemProps extends CommonProps {
|
|
|
9
9
|
*/
|
|
10
10
|
id: string;
|
|
11
11
|
/** Optional onClick */
|
|
12
|
-
onClick?:
|
|
12
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
13
13
|
}
|
|
14
14
|
export type Breakpoints = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
15
15
|
export interface SidebarProps extends CommonProps {
|
|
@@ -16,7 +16,7 @@ export interface TagProps extends CommonProps {
|
|
|
16
16
|
* Available only for neutral, primary and white tags.
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
onClickClose?: MouseEventHandler<HTMLDivElement>;
|
|
20
20
|
/**
|
|
21
21
|
* Child nodes of the tag.
|
|
22
22
|
*
|
|
@@ -76,7 +76,7 @@ export interface TagProps extends CommonProps {
|
|
|
76
76
|
* <Tag
|
|
77
77
|
* color="primary"
|
|
78
78
|
* icon={<Icon name="Funnel" size="small" />}
|
|
79
|
-
*
|
|
79
|
+
* onClickClose={onRemove}
|
|
80
80
|
* >
|
|
81
81
|
* {label}
|
|
82
82
|
* </Tag>
|
|
@@ -85,4 +85,4 @@ export interface TagProps extends CommonProps {
|
|
|
85
85
|
* @param {TagProps} props - The props for the Tag component.
|
|
86
86
|
* @returns {ReactElement} The rendered Tag component.
|
|
87
87
|
*/
|
|
88
|
-
export declare const Tag: ({ className, "data-testid": dataTestId, children, size,
|
|
88
|
+
export declare const Tag: ({ className, "data-testid": dataTestId, children, size, onClickClose, color, disabled, ref, icon, onMouseEnter, }: TagProps) => ReactElement;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from "@trackunit/css-class-variance-utilities";
|
|
2
2
|
import { MappedOmit } from "@trackunit/shared-utils";
|
|
3
3
|
import { IconName } from "@trackunit/ui-icons";
|
|
4
|
-
import { Dispatch,
|
|
4
|
+
import { Dispatch, MouseEventHandler, ReactElement, SetStateAction } from "react";
|
|
5
5
|
import { CommonProps } from "../../common/CommonProps";
|
|
6
6
|
import { TooltipPlacement } from "../Tooltip/Tooltip";
|
|
7
7
|
import { cvaToggleGroup } from "./ToggleGroup.variants";
|
|
@@ -73,7 +73,7 @@ export interface ToggleItemProps extends CommonProps, MappedOmit<BasicToggleGrou
|
|
|
73
73
|
content?: string;
|
|
74
74
|
placement?: TooltipPlacement;
|
|
75
75
|
};
|
|
76
|
-
onClick:
|
|
76
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
77
77
|
selected: boolean;
|
|
78
78
|
disabled: boolean;
|
|
79
79
|
size: "small" | "medium" | "large";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { MappedOmit } from "@trackunit/shared-utils";
|
|
1
2
|
import { ReactElement, ReactNode, Ref } from "react";
|
|
2
3
|
import { Size } from "../../../common/Size";
|
|
3
4
|
import { ButtonCommonProps, ButtonType } from "../shared/ButtonProps";
|
|
4
|
-
export interface ButtonProps extends
|
|
5
|
+
export interface ButtonProps extends MappedOmit<ButtonCommonProps, "size"> {
|
|
5
6
|
/**
|
|
6
7
|
* Child nodes. Can be used to pass in text to be displayed on the button.
|
|
7
8
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MouseEventHandler, ReactElement } from "react";
|
|
2
2
|
interface StarButtonProps {
|
|
3
3
|
starred: boolean;
|
|
4
|
-
onClick:
|
|
4
|
+
onClick: MouseEventHandler<HTMLDivElement>;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* The StarButton component is used for favorite actions or similar.
|