@trackunit/react-components 1.10.49 → 1.10.52
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 +100 -99
- package/index.esm.js +100 -99
- package/package.json +5 -5
- package/src/common/CommonProps.d.ts +1 -1
- package/src/components/Alert/Alert.d.ts +1 -1
- package/src/components/Badge/Badge.d.ts +1 -1
- package/src/components/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/src/components/Breadcrumb/BreadcrumbForLargeScreen.d.ts +1 -1
- package/src/components/Breadcrumb/BreadcrumbForMediumScreen.d.ts +1 -1
- package/src/components/Breadcrumb/BreadcrumbForSmallScreen.d.ts +1 -1
- package/src/components/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/src/components/Card/CardBody.d.ts +1 -1
- package/src/components/Card/CardFooter.d.ts +1 -1
- package/src/components/Card/CardHeader.d.ts +1 -1
- package/src/components/Collapse/Collapse.d.ts +1 -1
- package/src/components/CopyableText/CopyableText.d.ts +1 -1
- package/src/components/EmptyState/EmptyState.d.ts +1 -1
- package/src/components/EmptyValue/EmptyValue.d.ts +1 -1
- package/src/components/ExternalLink/ExternalLink.d.ts +1 -1
- package/src/components/Heading/Heading.d.ts +1 -1
- package/src/components/Highlight/Highlight.d.ts +1 -1
- package/src/components/HorizontalOverflowScroller/HorizontalOverflowScroller.d.ts +2 -2
- package/src/components/HorizontalOverflowScroller/OverflowIndicator.d.ts +1 -1
- package/src/components/Icon/Icon.d.ts +1 -1
- package/src/components/Indicator/Indicator.d.ts +1 -1
- package/src/components/KPI/KPI.d.ts +1 -1
- package/src/components/KPICard/KPICard.d.ts +1 -1
- package/src/components/List/List.d.ts +1 -1
- package/src/components/ListItem/ListItem.d.ts +1 -1
- package/src/components/Menu/MenuItem/MenuItem.d.ts +1 -1
- package/src/components/Menu/MenuList/MenuList.d.ts +1 -1
- package/src/components/Menu/MoreMenu/MoreMenu.d.ts +1 -1
- package/src/components/Notice/Notice.d.ts +1 -1
- package/src/components/Page/Page.d.ts +2 -2
- package/src/components/Page/PageContent.d.ts +1 -1
- package/src/components/PageHeader/PageHeader.d.ts +1 -1
- package/src/components/PageHeader/components/PageHeaderTitle.d.ts +11 -5
- package/src/components/Pagination/Pagination.d.ts +2 -2
- package/src/components/Polygon/Polygon.d.ts +1 -1
- package/src/components/Popover/PopoverContent.d.ts +1 -1
- package/src/components/Popover/PopoverTitle.d.ts +1 -1
- package/src/components/SectionHeader/SectionHeader.d.ts +1 -1
- package/src/components/Sidebar/Sidebar.d.ts +1 -1
- package/src/components/Spacer/Spacer.d.ts +1 -1
- package/src/components/Spinner/Spinner.d.ts +1 -1
- package/src/components/Tabs/Tab.d.ts +2 -2
- package/src/components/Tabs/TabContent.d.ts +2 -2
- package/src/components/Tabs/TabList.d.ts +2 -2
- package/src/components/Tabs/Tabs.d.ts +2 -2
- package/src/components/Tag/Tag.d.ts +1 -1
- package/src/components/Text/Text.d.ts +1 -1
- package/src/components/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/src/components/Tooltip/Tooltip.d.ts +1 -1
- package/src/components/ValueBar/ValueBar.d.ts +1 -1
- package/src/components/ZStack/ZStack.d.ts +1 -1
- package/src/components/buttons/Button/Button.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -134,7 +134,7 @@ const isSafari = () => {
|
|
|
134
134
|
* @param {IconProps} props - The props for the Icon component
|
|
135
135
|
* @returns {ReactElement} Icon component
|
|
136
136
|
*/
|
|
137
|
-
const Icon = ({ name, size = "medium", className, dataTestId, color = undefined, onClick, type = size === "large" ? "outline" : "solid", style, forwardedRef, ariaLabel, fontSize = false, ariaLabelledBy, ariaDescribedBy, ariaHidden, }) => {
|
|
137
|
+
const Icon = ({ name, size = "medium", className, "data-testid": dataTestId, color = undefined, onClick, type = size === "large" ? "outline" : "solid", style, forwardedRef, ariaLabel, fontSize = false, ariaLabelledBy, ariaDescribedBy, ariaHidden, }) => {
|
|
138
138
|
const useTagRef = react.useRef(null);
|
|
139
139
|
const ICON_CONTAINER_ID = sharedUtils.uuidv4();
|
|
140
140
|
const correctIconType = react.useMemo(() => {
|
|
@@ -246,7 +246,7 @@ const cvaTagIcon = cssClassVarianceUtilities.cvaMerge(["cursor-pointer", "transi
|
|
|
246
246
|
* @param {TagProps} props - The props for the Tag component.
|
|
247
247
|
* @returns {ReactElement} The rendered Tag component.
|
|
248
248
|
*/
|
|
249
|
-
const Tag = ({ className, dataTestId, children, size = "medium", onClose, color = "info", disabled = false, ref, icon, onMouseEnter, }) => {
|
|
249
|
+
const Tag = ({ className, "data-testid": dataTestId, children, size = "medium", onClose, color = "info", disabled = false, ref, icon, onMouseEnter, }) => {
|
|
250
250
|
const isSupportedDismissColor = react.useMemo(() => {
|
|
251
251
|
if (color === "neutral" || color === "primary" || color === "white" || color === "info") {
|
|
252
252
|
return true;
|
|
@@ -264,7 +264,7 @@ const Tag = ({ className, dataTestId, children, size = "medium", onClose, color
|
|
|
264
264
|
}, [onClose, isSupportedDismissColor, disabled, icon]);
|
|
265
265
|
return (jsxRuntime.jsxs("div", { className: cvaTag({ className, size, color, layout, border: color === "white" ? "default" : "none" }), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, children: [icon !== null && icon !== undefined && size === "medium" ? (jsxRuntime.jsx("div", { className: cvaTagIconContainer(), children: icon })) : null, jsxRuntime.jsx("span", { className: cvaTagText(), children: children }), Boolean(onClose) && isSupportedDismissColor && size === "medium" && !disabled ? (
|
|
266
266
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
267
|
-
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsxRuntime.jsx(Icon, { className: cvaTagIcon(),
|
|
267
|
+
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsxRuntime.jsx(Icon, { className: cvaTagIcon(), "data-testid": dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
268
268
|
};
|
|
269
269
|
Tag.displayName = "Tag";
|
|
270
270
|
|
|
@@ -381,7 +381,7 @@ const cvaText = cssClassVarianceUtilities.cvaMerge(["text-black", "m-0", "relati
|
|
|
381
381
|
* @param {TextProps} props - The props for the Text component
|
|
382
382
|
* @returns {ReactElement} Text component
|
|
383
383
|
*/
|
|
384
|
-
const Text = ({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId, ref, ...rest }) => {
|
|
384
|
+
const Text = ({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, "data-testid": dataTestId, ref, ...rest }) => {
|
|
385
385
|
return react.createElement(type, {
|
|
386
386
|
ref,
|
|
387
387
|
className: cvaText({
|
|
@@ -453,7 +453,7 @@ const cvaSpinnerLabel = cssClassVarianceUtilities.cvaMerge(["self-center", "text
|
|
|
453
453
|
* @param {SpinnerProps} props - The props for the Spinner component
|
|
454
454
|
* @returns {ReactElement} Spinner component
|
|
455
455
|
*/
|
|
456
|
-
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId = "spinner", label, }) => {
|
|
456
|
+
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, "data-testid": dataTestId = "spinner", label, }) => {
|
|
457
457
|
return (jsxRuntime.jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), children: jsxRuntime.jsxs("div", { className: cvaSpinnerContainerInner(), children: [jsxRuntime.jsx("div", { className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId, role: "spinbutton" }), label ? jsxRuntime.jsx("span", { className: cvaSpinnerLabel(), children: label }) : null] }) }));
|
|
458
458
|
};
|
|
459
459
|
|
|
@@ -740,7 +740,7 @@ const cvaIconButton = cssClassVarianceUtilities.cvaMerge([], {
|
|
|
740
740
|
* @param {ButtonProps} props - The props for the Button component
|
|
741
741
|
* @returns {ReactElement} Button component
|
|
742
742
|
*/
|
|
743
|
-
const Button = ({ onClick, children, loading = false, disabled = false, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, asChild = false, ref, ...rest }) => {
|
|
743
|
+
const Button = ({ onClick, children, loading = false, disabled = false, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, "data-testid": dataTestId, title, role, tabIndex, asChild = false, ref, ...rest }) => {
|
|
744
744
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
745
745
|
const sharedCompProps = {
|
|
746
746
|
ref,
|
|
@@ -870,7 +870,7 @@ const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["shrink-0", "g
|
|
|
870
870
|
* @param {AlertProps} props - The props for the Alert component
|
|
871
871
|
* @returns {ReactElement} Alert component
|
|
872
872
|
*/
|
|
873
|
-
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll = false, actionsInline = false, }) => {
|
|
873
|
+
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, "data-testid": dataTestId, autoScroll = false, actionsInline = false, }) => {
|
|
874
874
|
const ref = react.useRef(null);
|
|
875
875
|
const { isTextWrapping, ref: titleRef } = useIsTextWrapping();
|
|
876
876
|
react.useEffect(() => {
|
|
@@ -885,7 +885,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
885
885
|
}), children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer({
|
|
886
886
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
887
887
|
actionsInline,
|
|
888
|
-
}), children: jsxRuntime.jsx(Icon, { color: color, name: getIconName(color) }) }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? (jsxRuntime.jsx(Text, {
|
|
888
|
+
}), 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] }), onClose !== undefined && !actionsInline ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer({
|
|
889
889
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
890
890
|
actionsInline,
|
|
891
891
|
}), children: jsxRuntime.jsx(IconButton, { className: "!h-5 !min-h-0 !w-5 !p-0", icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), onClick: onClose, 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, onClose !== undefined && actionsInline ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer({
|
|
@@ -971,7 +971,7 @@ const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
|
971
971
|
* @param {BadgeProps} props - The props for the Badge component
|
|
972
972
|
* @returns {ReactElement} Badge component
|
|
973
973
|
*/
|
|
974
|
-
const Badge = ({ color = "primary", size = "default", compact = false, className, count, max, hideZero = false, dataTestId, }) => {
|
|
974
|
+
const Badge = ({ color = "primary", size = "default", compact = false, className, count, max, hideZero = false, "data-testid": dataTestId, }) => {
|
|
975
975
|
if (hideZero && count === 0) {
|
|
976
976
|
return null;
|
|
977
977
|
}
|
|
@@ -2157,7 +2157,7 @@ const cvaBreadcrumbForMediumScreen = cssClassVarianceUtilities.cvaMerge(["flex"]
|
|
|
2157
2157
|
/**
|
|
2158
2158
|
* BreadcrumbItem is a helper component that renders the individual breadcrumb item.
|
|
2159
2159
|
*/
|
|
2160
|
-
const BreadcrumbItem = ({ item, dataTestId }) => {
|
|
2160
|
+
const BreadcrumbItem = ({ item, "data-testid": dataTestId }) => {
|
|
2161
2161
|
const id = sharedUtils.uuidv4();
|
|
2162
2162
|
return (jsxRuntime.jsx("div", { className: cvaBreadcrumbItem(), "data-testid": dataTestId, id: `${item.props.label}-${id}`, children: item }));
|
|
2163
2163
|
};
|
|
@@ -2165,18 +2165,18 @@ const BreadcrumbItem = ({ item, dataTestId }) => {
|
|
|
2165
2165
|
/**
|
|
2166
2166
|
* BreadcrumbForLargeScreen is a helper component that renders the breadcrumb items for large screens.
|
|
2167
2167
|
*/
|
|
2168
|
-
const BreadcrumbForLargeScreen = ({ dataTestId, breadcrumbItems }) => {
|
|
2169
|
-
return (jsxRuntime.jsx("div", { className: cvaBreadcrumbForLargeScreen(), "data-testid": dataTestId, children: breadcrumbItems.map((item, index) => (jsxRuntime.jsx(BreadcrumbItem, {
|
|
2168
|
+
const BreadcrumbForLargeScreen = ({ "data-testid": dataTestId, breadcrumbItems, }) => {
|
|
2169
|
+
return (jsxRuntime.jsx("div", { className: cvaBreadcrumbForLargeScreen(), "data-testid": dataTestId, children: breadcrumbItems.map((item, index) => (jsxRuntime.jsx(BreadcrumbItem, { "data-testid": `BreadcrumbItem-${dataTestId}`, item: item }, `breadcrumbItem-${index}`))) }));
|
|
2170
2170
|
};
|
|
2171
2171
|
|
|
2172
2172
|
/**
|
|
2173
2173
|
* BreadcrumbForMediumScreen is a helper component that renders the breadcrumb items for medium screens.
|
|
2174
2174
|
*/
|
|
2175
|
-
const BreadcrumbForMediumScreen = ({ dataTestId, breadcrumbItems }) => {
|
|
2175
|
+
const BreadcrumbForMediumScreen = ({ "data-testid": dataTestId, breadcrumbItems, }) => {
|
|
2176
2176
|
const [expanded, setExpanded] = react.useState(false);
|
|
2177
2177
|
const getReducedArray = react.useCallback(() => {
|
|
2178
2178
|
let reducedArrayElements = [];
|
|
2179
|
-
const collapsibleButton = (jsxRuntime.jsxs("div", { className: cvaBreadcrumbItem(), children: [jsxRuntime.jsx(IconButton, {
|
|
2179
|
+
const collapsibleButton = (jsxRuntime.jsxs("div", { className: cvaBreadcrumbItem(), children: [jsxRuntime.jsx(IconButton, { "data-testid": `collapsibleButton-${dataTestId}`, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", size: "small" }), onClick: () => setExpanded(true), size: "small", variant: "ghost-neutral" }), jsxRuntime.jsx(Icon, { color: "neutral", name: "Slash", size: "small" })] }));
|
|
2180
2180
|
const firstBreadcrumbItem = breadcrumbItems[0];
|
|
2181
2181
|
if (firstBreadcrumbItem && breadcrumbItems.length > 3) {
|
|
2182
2182
|
const lastTwoBreadcrumbItem = breadcrumbItems.slice(-2);
|
|
@@ -2185,15 +2185,15 @@ const BreadcrumbForMediumScreen = ({ dataTestId, breadcrumbItems }) => {
|
|
|
2185
2185
|
return reducedArrayElements;
|
|
2186
2186
|
}, [breadcrumbItems, dataTestId]);
|
|
2187
2187
|
const reducedArray = getReducedArray();
|
|
2188
|
-
return (jsxRuntime.jsx("div", { className: cvaBreadcrumbForMediumScreen({ expanded }), "data-testid": dataTestId, children: (!expanded && reducedArray.length !== 0 ? reducedArray : breadcrumbItems).map(item => (jsxRuntime.jsx(BreadcrumbItem, {
|
|
2188
|
+
return (jsxRuntime.jsx("div", { className: cvaBreadcrumbForMediumScreen({ expanded }), "data-testid": dataTestId, children: (!expanded && reducedArray.length !== 0 ? reducedArray : breadcrumbItems).map(item => (jsxRuntime.jsx(BreadcrumbItem, { "data-testid": `breadcrumbItem-${dataTestId}`, item: item }, `${item.props.label}-${sharedUtils.uuidv4()}`))) }));
|
|
2189
2189
|
};
|
|
2190
2190
|
|
|
2191
2191
|
/**
|
|
2192
2192
|
* BreadcrumbForSmallScreen is a helper component that renders the breadcrumb items for small screens.
|
|
2193
2193
|
*/
|
|
2194
|
-
const BreadcrumbForSmallScreen = ({ dataTestId, breadcrumbItems }) => {
|
|
2194
|
+
const BreadcrumbForSmallScreen = ({ "data-testid": dataTestId, breadcrumbItems, }) => {
|
|
2195
2195
|
const lastBreadcrumbItem = breadcrumbItems.slice(-1);
|
|
2196
|
-
return (jsxRuntime.jsx("div", { "data-testid": dataTestId, children: lastBreadcrumbItem.map((item, index) => (jsxRuntime.jsx(BreadcrumbItem, {
|
|
2196
|
+
return (jsxRuntime.jsx("div", { "data-testid": dataTestId, children: lastBreadcrumbItem.map((item, index) => (jsxRuntime.jsx(BreadcrumbItem, { "data-testid": `breadcrumbItem-${dataTestId}`, item: item }, `breadcrumbItem-${index}`))) }));
|
|
2197
2197
|
};
|
|
2198
2198
|
|
|
2199
2199
|
/**
|
|
@@ -2223,24 +2223,24 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
|
|
|
2223
2223
|
* @param {BreadcrumbProps} props - The props for the Breadcrumb component
|
|
2224
2224
|
* @returns {ReactElement} Breadcrumb component
|
|
2225
2225
|
*/
|
|
2226
|
-
const Breadcrumb = ({ className, dataTestId, breadcrumbItems, back }) => {
|
|
2226
|
+
const Breadcrumb = ({ className, "data-testid": dataTestId, breadcrumbItems, back, }) => {
|
|
2227
2227
|
const breadCrumbItemsToJSX = useBreadcrumbItemsToRender(breadcrumbItems);
|
|
2228
|
-
return (jsxRuntime.jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(IconButton, {
|
|
2228
|
+
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: back, size: "small", variant: "ghost-neutral" }), jsxRuntime.jsx("div", { children: jsxRuntime.jsx(BreadcrumbContainer, { breadcrumbItems: breadCrumbItemsToJSX, "data-testid": dataTestId }) })] }));
|
|
2229
2229
|
};
|
|
2230
2230
|
/**
|
|
2231
2231
|
* BreadcrumbContainer is a helper component that renders the breadcrumb items based on the screen size.
|
|
2232
2232
|
*
|
|
2233
2233
|
* @param {BreadcrumbContainerProps} props - The props for the BreadcrumbContainer component
|
|
2234
2234
|
*/
|
|
2235
|
-
const BreadcrumbContainer = ({ dataTestId, breadcrumbItems }) => {
|
|
2235
|
+
const BreadcrumbContainer = ({ "data-testid": dataTestId, breadcrumbItems, }) => {
|
|
2236
2236
|
const { isMd: isMediumScreen, isXs: isSmallScreen } = useViewportBreakpoints();
|
|
2237
2237
|
if (isSmallScreen) {
|
|
2238
|
-
return jsxRuntime.jsx(BreadcrumbForSmallScreen, { breadcrumbItems: breadcrumbItems,
|
|
2238
|
+
return jsxRuntime.jsx(BreadcrumbForSmallScreen, { breadcrumbItems: breadcrumbItems, "data-testid": `smallScreen-${dataTestId}` });
|
|
2239
2239
|
}
|
|
2240
2240
|
if (isMediumScreen) {
|
|
2241
|
-
return jsxRuntime.jsx(BreadcrumbForMediumScreen, { breadcrumbItems: breadcrumbItems,
|
|
2241
|
+
return jsxRuntime.jsx(BreadcrumbForMediumScreen, { breadcrumbItems: breadcrumbItems, "data-testid": `mediumScreen-${dataTestId}` });
|
|
2242
2242
|
}
|
|
2243
|
-
return jsxRuntime.jsx(BreadcrumbForLargeScreen, { breadcrumbItems: breadcrumbItems,
|
|
2243
|
+
return jsxRuntime.jsx(BreadcrumbForLargeScreen, { breadcrumbItems: breadcrumbItems, "data-testid": `largeScreen-${dataTestId}` });
|
|
2244
2244
|
};
|
|
2245
2245
|
|
|
2246
2246
|
const cvaCard = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -2350,7 +2350,7 @@ const ROLE_CARD = "region";
|
|
|
2350
2350
|
* @param {CardProps} props - The props for the Card component
|
|
2351
2351
|
* @returns {ReactElement} Card component
|
|
2352
2352
|
*/
|
|
2353
|
-
const Card = react.forwardRef(function Card({ children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, dataTestId, ...rest }, ref) {
|
|
2353
|
+
const Card = react.forwardRef(function Card({ children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, "data-testid": dataTestId, ...rest }, ref) {
|
|
2354
2354
|
return (jsxRuntime.jsx("div", { className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), "data-testid": dataTestId, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: ref, role: ROLE_CARD, ...rest, children: children }));
|
|
2355
2355
|
});
|
|
2356
2356
|
|
|
@@ -2362,7 +2362,7 @@ const Card = react.forwardRef(function Card({ children, onClick, fullHeight = fa
|
|
|
2362
2362
|
* @param {CardBodyProps} props - The props for the CardBody component
|
|
2363
2363
|
* @returns {ReactElement} CardBody component
|
|
2364
2364
|
*/
|
|
2365
|
-
const CardBody = ({ density = "auto", children, dataTestId, className, direction = "column", disableGap = false, id, }) => {
|
|
2365
|
+
const CardBody = ({ density = "auto", children, "data-testid": dataTestId, className, direction = "column", disableGap = false, id, }) => {
|
|
2366
2366
|
return (jsxRuntime.jsx("div", { className: cvaCardBodyDensityContainer$1({ density, disableGap, className, direction }), "data-testid": dataTestId, id: id, children: children }));
|
|
2367
2367
|
};
|
|
2368
2368
|
|
|
@@ -2374,7 +2374,7 @@ const CardBody = ({ density = "auto", children, dataTestId, className, direction
|
|
|
2374
2374
|
* @param {CardFooterProps} props - The props for the CardFooter component
|
|
2375
2375
|
* @returns {ReactElement} CardFooter component
|
|
2376
2376
|
*/
|
|
2377
|
-
const CardFooter = ({ dataTestId, className, children, density = "auto", hideSeparator = false, }) => {
|
|
2377
|
+
const CardFooter = ({ "data-testid": dataTestId, className, children, density = "auto", hideSeparator = false, }) => {
|
|
2378
2378
|
return (jsxRuntime.jsx("div", { className: cvaCardFooterDensityContainer({
|
|
2379
2379
|
density,
|
|
2380
2380
|
border: hideSeparator ? "borderless" : "default",
|
|
@@ -2419,7 +2419,7 @@ const cvaHeading = cssClassVarianceUtilities.cvaMerge(["m-0", "leading-normal",
|
|
|
2419
2419
|
* @param {HeadingProps} props - The props for the Heading component
|
|
2420
2420
|
* @returns {ReactElement} Heading component
|
|
2421
2421
|
*/
|
|
2422
|
-
const Heading = ({ variant = "primary", inverted = false, subtle = false, className, dataTestId, ...rest }) => {
|
|
2422
|
+
const Heading = ({ variant = "primary", inverted = false, subtle = false, className, "data-testid": dataTestId, ...rest }) => {
|
|
2423
2423
|
const semanticType = {
|
|
2424
2424
|
primary: "h1",
|
|
2425
2425
|
secondary: "h2",
|
|
@@ -2439,12 +2439,12 @@ const Heading = ({ variant = "primary", inverted = false, subtle = false, classN
|
|
|
2439
2439
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
2440
2440
|
* @returns {ReactElement} CardHeader component
|
|
2441
2441
|
*/
|
|
2442
|
-
const CardHeader = ({ heading, headingVariant = "secondary", subHeading, onClose, dataTestId, className, children, accessories, actions, density = "auto", hideSeparator = false, }) => {
|
|
2442
|
+
const CardHeader = ({ heading, headingVariant = "secondary", subHeading, onClose, "data-testid": dataTestId, className, children, accessories, actions, density = "auto", hideSeparator = false, }) => {
|
|
2443
2443
|
return (jsxRuntime.jsx("div", { className: cvaCardHeaderDensityContainer({
|
|
2444
2444
|
density,
|
|
2445
2445
|
border: hideSeparator ? "borderless" : "default",
|
|
2446
2446
|
className,
|
|
2447
|
-
}), "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, onClose ? (jsxRuntime.jsx(IconButton, { className: "!h-min",
|
|
2447
|
+
}), "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, onClose ? (jsxRuntime.jsx(IconButton, { className: "!h-min", "data-testid": "card-header-close-button", icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), onClick: onClose, variant: "ghost-neutral" })) : null] })] }) }));
|
|
2448
2448
|
};
|
|
2449
2449
|
|
|
2450
2450
|
const cvaCollapse = cssClassVarianceUtilities.cvaMerge(["flex", "flex-col", "overflow-hidden"], {
|
|
@@ -2590,7 +2590,7 @@ const cvaChevronIcon = cssClassVarianceUtilities.cvaMerge(["transition-transform
|
|
|
2590
2590
|
* @param {CollapseProps} props - The props for the Collapse component
|
|
2591
2591
|
* @returns {ReactElement} Collapse component
|
|
2592
2592
|
*/
|
|
2593
|
-
const Collapse = ({ id, variant = "primary", initialExpanded = false, onToggle, label, children, className, headerClassName, headerAddon, dataTestId, animate = true, extraPadding = true, }) => {
|
|
2593
|
+
const Collapse = ({ id, variant = "primary", initialExpanded = false, onToggle, label, children, className, headerClassName, headerAddon, "data-testid": dataTestId, animate = true, extraPadding = true, }) => {
|
|
2594
2594
|
const LABEL_ID = sharedUtils.uuidv4();
|
|
2595
2595
|
const [expanded, setExpanded] = react.useState(initialExpanded);
|
|
2596
2596
|
const handleClick = react.useCallback((e) => {
|
|
@@ -2663,7 +2663,7 @@ const cvaCopyableText = cssClassVarianceUtilities.cvaMerge([
|
|
|
2663
2663
|
* @param {CopyableTextProps} props - The props for the CopyableText component
|
|
2664
2664
|
* @returns {ReactElement} CopyableText component
|
|
2665
2665
|
*/
|
|
2666
|
-
const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
|
|
2666
|
+
const CopyableText = ({ text, alternativeText, "data-testid": dataTestId, className, }) => {
|
|
2667
2667
|
const value = alternativeText ?? text ?? "";
|
|
2668
2668
|
const [animating, setAnimating] = react.useState(false);
|
|
2669
2669
|
const [, copyToClipboard] = usehooksTs.useCopyToClipboard();
|
|
@@ -2748,7 +2748,7 @@ const cvaSkeletonLine = cssClassVarianceUtilities.cvaMerge([
|
|
|
2748
2748
|
* Display placeholder lines before the data gets loaded to reduce load-time frustration.
|
|
2749
2749
|
* All width values are automatically constrained using CSS min() function to prevent overflow.
|
|
2750
2750
|
*/
|
|
2751
|
-
const SkeletonLines = react.memo(({ lines = 1, height = "0.75rem", width = "100%", gap = 10, maxWidth = "100%", className, dataTestId, }) => {
|
|
2751
|
+
const SkeletonLines = react.memo(({ lines = 1, height = "0.75rem", width = "100%", gap = 10, maxWidth = "100%", className, "data-testid": dataTestId, }) => {
|
|
2752
2752
|
const gapStyle = typeof gap === "number" ? `${gap}px` : gap;
|
|
2753
2753
|
return (jsxRuntime.jsx("div", { "aria-label": `Loading ${lines} ${lines === 1 ? "item" : "items"}`, className: cvaSkeletonContainer({ className }), "data-testid": dataTestId, role: "status", style: { gap: gapStyle }, children: Array.from({ length: lines }, (_, index) => (jsxRuntime.jsx("div", { className: cvaSkeletonLine(), "data-testid": dataTestId ? `${dataTestId}-${index}` : `skeleton-lines-${index}`, "data-type": "loading-skeleton-line", style: {
|
|
2754
2754
|
width: getDimension({ dimension: width, index, direction: "width", maxWidth }),
|
|
@@ -2845,7 +2845,7 @@ WorkerWithSignSVG.displayName = "WorkerWithSignSVG";
|
|
|
2845
2845
|
* - For guidance purposes (e.g., onboarding, adjusting filters, exploring alternative approaches).
|
|
2846
2846
|
* - In celebratory instances (e.g., no new notifications, services up to date).
|
|
2847
2847
|
*/
|
|
2848
|
-
const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc, loading = false, dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, }) => {
|
|
2848
|
+
const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc, loading = false, "data-testid": dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, }) => {
|
|
2849
2849
|
const ImageSource = react.useMemo(() => {
|
|
2850
2850
|
switch (image) {
|
|
2851
2851
|
case "WORKER_WITH_SIGN":
|
|
@@ -2863,7 +2863,7 @@ const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customIma
|
|
|
2863
2863
|
return SearchDocumentSVG;
|
|
2864
2864
|
}
|
|
2865
2865
|
}, [image]);
|
|
2866
|
-
return (jsxRuntime.jsx("div", { className: cvaContainerStyles({ className }), "data-testid": dataTestId ?? "empty-state", children: loading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spinner, { centering: "centered",
|
|
2866
|
+
return (jsxRuntime.jsx("div", { className: cvaContainerStyles({ className }), "data-testid": dataTestId ?? "empty-state", children: loading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spinner, { centering: "centered", "data-testid": "spinner" }), jsxRuntime.jsx(SkeletonLines, { "data-testid": "skeleton-lines", width: 50 })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { 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: "large", children: description })) : null, jsxRuntime.jsxs("div", { className: "mt-4 grid gap-3", children: [jsxRuntime.jsxs("div", { className: "flex gap-3", children: [secondaryAction ? (jsxRuntime.jsx(Button, { "data-testid": "empty-state-secondary-button", disabled: secondaryAction.disabled, onClick: secondaryAction.onClick, variant: "secondary", children: secondaryAction.to ? (jsxRuntime.jsx(reactRouter.Link, { params: secondaryAction.to.parameters, to: secondaryAction.to.pathname, children: secondaryAction.title })) : (secondaryAction.title) })) : null, primaryAction ? (jsxRuntime.jsx(Button, { "data-testid": "empty-state-primary-button", disabled: primaryAction.disabled, onClick: primaryAction.onClick, children: primaryAction.to ? (jsxRuntime.jsx(reactRouter.Link, { params: primaryAction.to.parameters, to: primaryAction.to.pathname, children: primaryAction.title })) : (primaryAction.title) })) : null] }), additionalHelpAction?.to ? (jsxRuntime.jsx(Button, { asChild: true, "data-testid": "empty-state-additional-button", disabled: additionalHelpAction.disabled, onClick: additionalHelpAction.onClick, suffix: jsxRuntime.jsx(Icon, { name: "ArrowTopRightOnSquare", size: "small" }), variant: "ghost", children: jsxRuntime.jsx(reactRouter.Link, { params: additionalHelpAction.to.parameters, target: additionalHelpAction.to.target, to: additionalHelpAction.to.pathname, children: additionalHelpAction.title }) })) : null] })] })) }));
|
|
2867
2867
|
};
|
|
2868
2868
|
|
|
2869
2869
|
const cvaEmptyValue = cssClassVarianceUtilities.cvaMerge(["text-neutral-400"]);
|
|
@@ -2874,7 +2874,7 @@ const cvaEmptyValue = cssClassVarianceUtilities.cvaMerge(["text-neutral-400"]);
|
|
|
2874
2874
|
* @param {EmptyValueProps} props - The props for the EmptyValue component
|
|
2875
2875
|
* @returns {ReactElement} EmptyValue component
|
|
2876
2876
|
*/
|
|
2877
|
-
const EmptyValue = ({ className, dataTestId }) => {
|
|
2877
|
+
const EmptyValue = ({ className, "data-testid": dataTestId }) => {
|
|
2878
2878
|
return (jsxRuntime.jsx("div", { className: cvaEmptyValue({ className }), "data-testid": dataTestId, children: "-" }));
|
|
2879
2879
|
};
|
|
2880
2880
|
|
|
@@ -2915,7 +2915,7 @@ const cvaExternalLink = cssClassVarianceUtilities.cvaMerge(["underline", "decora
|
|
|
2915
2915
|
* @param {ExternalLinkProps} props - The props for the external link component
|
|
2916
2916
|
* @returns {ReactElement} External Link component
|
|
2917
2917
|
*/
|
|
2918
|
-
const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, dataTestId, onClick, color = "primary", }) => {
|
|
2918
|
+
const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, "data-testid": dataTestId, onClick, color = "primary", }) => {
|
|
2919
2919
|
return (jsxRuntime.jsx("a", { className: cvaExternalLink({ className, color }), "data-testid": dataTestId, href: href, onClick: onClick, rel: rel, target: target, title: title, children: children }));
|
|
2920
2920
|
};
|
|
2921
2921
|
|
|
@@ -2966,7 +2966,7 @@ const cvaHighlightText = cssClassVarianceUtilities.cvaMerge(["truncate"]);
|
|
|
2966
2966
|
* @param {HighlightProps} props - The props for the highlight component
|
|
2967
2967
|
* @returns {ReactElement} highlight component
|
|
2968
2968
|
*/
|
|
2969
|
-
const Highlight = ({ className, dataTestId, children, size = "small", color = "warning", ref, }) => {
|
|
2969
|
+
const Highlight = ({ className, "data-testid": dataTestId, children, size = "small", color = "warning", ref, }) => {
|
|
2970
2970
|
return (jsxRuntime.jsx("div", { className: cvaHighlight({ className, size, color }), "data-testid": dataTestId, ref: ref, children: jsxRuntime.jsx("span", { className: cvaHighlightText(), children: children }) }));
|
|
2971
2971
|
};
|
|
2972
2972
|
Highlight.displayName = "Highlight";
|
|
@@ -2981,7 +2981,7 @@ const cvaZStackItem = cssClassVarianceUtilities.cvaMerge(["col-start-1", "col-en
|
|
|
2981
2981
|
* @param { ZStackProps} props - The props for the ZStack component
|
|
2982
2982
|
* @returns {Element} ZStack component
|
|
2983
2983
|
*/
|
|
2984
|
-
const ZStack = ({ children, className, dataTestId }) => {
|
|
2984
|
+
const ZStack = ({ children, className, "data-testid": dataTestId }) => {
|
|
2985
2985
|
return (jsxRuntime.jsx("div", { className: cvaZStackContainer({ className }), "data-testid": dataTestId, children: react.Children.map(children, (child, index) => {
|
|
2986
2986
|
if (!react.isValidElement(child)) {
|
|
2987
2987
|
return child;
|
|
@@ -3039,9 +3039,9 @@ const cvaOverflowIndicatorButton = cssClassVarianceUtilities.cvaMerge([
|
|
|
3039
3039
|
* @param {OverflowIndicatorProps} props - The props for the component
|
|
3040
3040
|
* @returns {ReactElement} OverflowIndicator component
|
|
3041
3041
|
*/
|
|
3042
|
-
const OverflowIndicator = ({ className, dataTestId, direction, onClickScroll, }) => {
|
|
3042
|
+
const OverflowIndicator = ({ className, "data-testid": dataTestId, direction, onClickScroll, }) => {
|
|
3043
3043
|
const iconName = direction === "left" ? "ChevronLeft" : "ChevronRight";
|
|
3044
|
-
return (jsxRuntime.jsxs(ZStack, { className: cvaOverflowIndicatorContainer({ className }),
|
|
3044
|
+
return (jsxRuntime.jsxs(ZStack, { className: cvaOverflowIndicatorContainer({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { className: cvaJustificationContainer({ direction }), children: jsxRuntime.jsx("div", { className: cvaOverflowIndicatorGradient({ direction }), "data-testid": dataTestId ? `${dataTestId}-gradient` : undefined }) }), jsxRuntime.jsx("div", { className: cvaJustificationContainer({ direction }), children: jsxRuntime.jsx(IconButton, { className: cvaOverflowIndicatorButton(), "data-testid": dataTestId ? `${dataTestId}-button` : undefined, icon: jsxRuntime.jsx(Icon, { name: iconName, size: "small" }), onClick: onClickScroll, size: "small", variant: "secondary" }) })] }));
|
|
3045
3045
|
};
|
|
3046
3046
|
|
|
3047
3047
|
/**
|
|
@@ -3051,11 +3051,11 @@ const OverflowIndicator = ({ className, dataTestId, direction, onClickScroll, })
|
|
|
3051
3051
|
* @param props - Component properties
|
|
3052
3052
|
* @param props.children - The content to display in the horizontal scroller
|
|
3053
3053
|
* @param props.className - Optional CSS class name for styling
|
|
3054
|
-
* @param props.
|
|
3054
|
+
* @param props."data-testid" - Optional test ID for testing purposes
|
|
3055
3055
|
* @param props.onScrollStateChange - Optional callback fired when scroll state changes
|
|
3056
3056
|
* @returns {ReactElement} A horizontal overflow scroller component with visual indicators
|
|
3057
3057
|
*/
|
|
3058
|
-
const HorizontalOverflowScroller = ({ className, dataTestId, children, onScrollStateChange, }) => {
|
|
3058
|
+
const HorizontalOverflowScroller = ({ className, "data-testid": dataTestId, children, onScrollStateChange, }) => {
|
|
3059
3059
|
const childrenArray = react.Children.toArray(children);
|
|
3060
3060
|
const { geometry: containerGeometry, ref: measureRef, element } = useMeasure();
|
|
3061
3061
|
const { ref: scrollRef, isScrollable, isAtBeginning, isAtEnd, } = useScrollDetection({
|
|
@@ -3085,7 +3085,7 @@ const HorizontalOverflowScroller = ({ className, dataTestId, children, onScrollS
|
|
|
3085
3085
|
behavior: "smooth",
|
|
3086
3086
|
});
|
|
3087
3087
|
};
|
|
3088
|
-
return (jsxRuntime.jsxs(ZStack, { className: cvaHorizontalOverflowScrollerAndIndicatorsContainer({ className }), children: [jsxRuntime.jsx("div", { className: cvaHorizontalOverflowScroller(), "data-testid": dataTestId, ref: mergedRef, children: childrenArray.map((child, index) => (jsxRuntime.jsx(react.Fragment, { children: child }, index))) }), isScrollable && !isAtBeginning ? (jsxRuntime.jsx(OverflowIndicator, {
|
|
3088
|
+
return (jsxRuntime.jsxs(ZStack, { className: cvaHorizontalOverflowScrollerAndIndicatorsContainer({ className }), children: [jsxRuntime.jsx("div", { className: cvaHorizontalOverflowScroller(), "data-testid": dataTestId, ref: mergedRef, children: childrenArray.map((child, index) => (jsxRuntime.jsx(react.Fragment, { children: child }, index))) }), isScrollable && !isAtBeginning ? (jsxRuntime.jsx(OverflowIndicator, { "data-testid": `${dataTestId}-left-indicator`, direction: "left", onClickScroll: handleScrollLeft })) : null, isScrollable && !isAtEnd ? (jsxRuntime.jsx(OverflowIndicator, { "data-testid": `${dataTestId}-right-indicator`, direction: "right", onClickScroll: handleScrollRight })) : null] }));
|
|
3089
3089
|
};
|
|
3090
3090
|
|
|
3091
3091
|
const PADDING = 12;
|
|
@@ -3363,10 +3363,10 @@ const cvaPopoverTitleText = cssClassVarianceUtilities.cvaMerge(["flex-1", "text-
|
|
|
3363
3363
|
* @param {PopoverContentProps} props - The props for the PopoverContent component
|
|
3364
3364
|
* @returns {ReactElement} The popover content element
|
|
3365
3365
|
*/
|
|
3366
|
-
const PopoverContent = function PopoverContent({ className, dataTestId, children, portalId, ref: propRef, ...props }) {
|
|
3366
|
+
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, ref: propRef, ...props }) {
|
|
3367
3367
|
const { context: floatingContext, customProps, ...context } = usePopoverContext();
|
|
3368
3368
|
const ref = react$1.useMergeRefs([context.refs.setFloating, propRef]);
|
|
3369
|
-
return (jsxRuntime.jsx(Portal, { id: portalId, children: context.isOpen === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, modal: context.isModal, order: ["reference", "content"], returnFocus: true, children: jsxRuntime.jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps
|
|
3369
|
+
return (jsxRuntime.jsx(Portal, { id: portalId, children: context.isOpen === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, modal: context.isModal, order: ["reference", "content"], returnFocus: true, children: jsxRuntime.jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps["data-testid"] ?? "popover-content", ref: ref, style: {
|
|
3370
3370
|
position: context.strategy,
|
|
3371
3371
|
top: context.y,
|
|
3372
3372
|
left: context.x,
|
|
@@ -3381,7 +3381,7 @@ const PopoverContent = function PopoverContent({ className, dataTestId, children
|
|
|
3381
3381
|
* @param {PopoverTitleProps} props - The props for the PopoverTitle component
|
|
3382
3382
|
* @returns {ReactElement} PopoverTitle component
|
|
3383
3383
|
*/
|
|
3384
|
-
const PopoverTitle = ({ children, action, divider = false, className, dataTestId, }) => {
|
|
3384
|
+
const PopoverTitle = ({ children, action, divider = false, className, "data-testid": dataTestId, }) => {
|
|
3385
3385
|
return (jsxRuntime.jsxs("div", { className: cvaPopoverTitleContainer({ divider, className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(Text, { className: cvaPopoverTitleText(), size: "small", subtle: true, type: "div", uppercase: true, weight: "bold", children: children }), action] }));
|
|
3386
3386
|
};
|
|
3387
3387
|
|
|
@@ -3480,7 +3480,7 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
|
|
|
3480
3480
|
* @param {TooltipProps} props - The props for the Tooltip component
|
|
3481
3481
|
* @returns {ReactElement} Tooltip component
|
|
3482
3482
|
*/
|
|
3483
|
-
const Tooltip = ({ children, dataTestId, disabled = false, className, label, placement = "auto", mode = "dark", iconProps, id, style, }) => {
|
|
3483
|
+
const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, className, label, placement = "auto", mode = "dark", iconProps, id, style, }) => {
|
|
3484
3484
|
const [isOpen, setIsOpen] = react.useState(false);
|
|
3485
3485
|
const arrowRef = react.useRef(null);
|
|
3486
3486
|
const { refs, floatingStyles, context } = react$1.useFloating({
|
|
@@ -3513,7 +3513,7 @@ const Tooltip = ({ children, dataTestId, disabled = false, className, label, pla
|
|
|
3513
3513
|
}
|
|
3514
3514
|
setIsOpen(false);
|
|
3515
3515
|
}, [disabled]);
|
|
3516
|
-
return (jsxRuntime.jsxs(Popover, { activation: { hover: true }, className: cvaTooltipPopover(),
|
|
3516
|
+
return (jsxRuntime.jsxs(Popover, { activation: { hover: true }, className: cvaTooltipPopover(), "data-testid": dataTestId, id: id, placement: placement === "auto" ? "bottom" : placement, children: [jsxRuntime.jsx(PopoverTrigger, { className: cvaTooltipIcon({ color: mode, className }), "data-testid": dataTestId ? `${dataTestId}-trigger` : null, onMouseDown: closeTooltip, onMouseEnter: openTooltip, onMouseLeave: closeTooltip, ref: refs.setReference, style: style, children: children === undefined ? (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Icon, { "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps }) })) : (wrappedChildren) }), isMounted ? (jsxRuntime.jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": `${dataTestId}-content`, children: [jsxRuntime.jsx(Text, { "data-testid": `${dataTestId}-text`, inverted: mode === "dark", size: "small", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsxRuntime.jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) })) : null] }));
|
|
3517
3517
|
};
|
|
3518
3518
|
|
|
3519
3519
|
const cvaIndicator = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
@@ -3646,7 +3646,7 @@ const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-
|
|
|
3646
3646
|
* @param {IndicatorProps} props - The props for the Indicator component
|
|
3647
3647
|
* @returns {ReactElement} Indicator component
|
|
3648
3648
|
*/
|
|
3649
|
-
const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, size = "medium", weight = "normal", className, ...rest }) => {
|
|
3649
|
+
const Indicator = ({ "data-testid": dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, size = "medium", weight = "normal", className, ...rest }) => {
|
|
3650
3650
|
return (jsxRuntime.jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxRuntime.jsxs("div", { "aria-label": label, className: cvaIndicator(), "data-testid": dataTestId, ...rest, children: [jsxRuntime.jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping ? (jsxRuntime.jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })) : null, icon] }), label && withLabel ? (jsxRuntime.jsx("div", { className: cvaIndicatorLabel({ size, weight, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-label` : undefined, children: label })) : null] }) }));
|
|
3651
3651
|
};
|
|
3652
3652
|
|
|
@@ -3707,9 +3707,9 @@ const LoadingContent$1 = () => (jsxRuntime.jsx("div", { className: "flex h-11 fl
|
|
|
3707
3707
|
* @param {KPIProps} props - The props for the KPI component
|
|
3708
3708
|
* @returns {ReactElement} KPI component
|
|
3709
3709
|
*/
|
|
3710
|
-
const KPI = ({ title, value, loading = false, unit, className, dataTestId, tooltipLabel, variant = "default", trend, style, ...rest }) => {
|
|
3710
|
+
const KPI = ({ title, value, loading = false, unit, className, "data-testid": dataTestId, tooltipLabel, variant = "default", trend, style, ...rest }) => {
|
|
3711
3711
|
const isSmallVariant = variant === "small";
|
|
3712
|
-
return (jsxRuntime.jsx(Tooltip, {
|
|
3712
|
+
return (jsxRuntime.jsx(Tooltip, { "data-testid": dataTestId ? `${dataTestId}-tooltip` : undefined, disabled: tooltipLabel === undefined || tooltipLabel === "", label: tooltipLabel, placement: "bottom", style: style, children: jsxRuntime.jsx("div", { className: cvaKPI({ variant, className }), "data-testid": dataTestId ? `${dataTestId}` : undefined, ...rest, children: loading ? (jsxRuntime.jsx(LoadingContent$1, {})) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: cvaKPIHeader(), children: jsxRuntime.jsx(Text, { className: cvaKPITitleText(), "data-testid": dataTestId ? `${dataTestId}-title` : undefined, size: isSmallVariant ? "small" : "medium", subtle: true, weight: isSmallVariant ? "normal" : "bold", children: title }) }), jsxRuntime.jsx(Text, { className: cvaKPIvalueText({ variant }), "data-testid": dataTestId ? `${dataTestId}-value` : undefined, size: isSmallVariant ? "small" : "large", type: "div", weight: isSmallVariant ? "bold" : "thick", children: jsxRuntime.jsxs("div", { className: cvaKPIValueContainer({
|
|
3713
3713
|
isDefaultAndHasTrendValue: Boolean(trend !== undefined && trend.value !== undefined && !isSmallVariant),
|
|
3714
3714
|
className,
|
|
3715
3715
|
}), children: [jsxRuntime.jsxs("span", { className: cvaKPIvalueText({ variant }), children: [value, " ", unit] }), jsxRuntime.jsx(TrendIndicator, { isSmallVariant: isSmallVariant, trend: trend, unit: unit })] }) })] })) }) }));
|
|
@@ -3718,7 +3718,7 @@ const TrendIndicator = ({ trend, unit, isSmallVariant }) => {
|
|
|
3718
3718
|
if (!trend) {
|
|
3719
3719
|
return null;
|
|
3720
3720
|
}
|
|
3721
|
-
return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value !== undefined ? (jsxRuntime.jsxs(Text, {
|
|
3721
|
+
return (jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1", "data-testid": "trend-indicator", children: [!isSmallVariant && trend.value !== undefined ? (jsxRuntime.jsxs(Text, { "data-testid": "trend-value", size: "small", weight: "normal", children: [trend.value, " ", unit] })) : null, trend.variant !== undefined && trend.variant.icon !== undefined ? (jsxRuntime.jsx(Icon, { color: trend.variant.color, name: trend.variant.icon, size: "small" })) : null, trend.percentage !== undefined ? (jsxRuntime.jsxs(Text, { className: cvaKPITrendPercentage({ color: trend.variant?.color }), size: "small", weight: "bold", children: [trend.percentage, "%"] })) : null] }));
|
|
3722
3722
|
};
|
|
3723
3723
|
|
|
3724
3724
|
const cvaKPICard = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -3767,13 +3767,13 @@ const cvaCardBodyDensityContainer = cssClassVarianceUtilities.cvaMerge(["grid",
|
|
|
3767
3767
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
3768
3768
|
* @returns {ReactElement} KPICard component
|
|
3769
3769
|
*/
|
|
3770
|
-
const KPICard = ({ isActive = false, onClick, className, dataTestId, children, iconName = undefined, iconColor = "info", loading = false, ...rest }) => {
|
|
3770
|
+
const KPICard = ({ isActive = false, onClick, className, "data-testid": dataTestId, children, iconName = undefined, iconColor = "info", loading = false, ...rest }) => {
|
|
3771
3771
|
const isClickable = Boolean(onClick !== undefined && loading !== true);
|
|
3772
3772
|
return (jsxRuntime.jsx(Card, { className: cvaKPICard({
|
|
3773
3773
|
isClickable,
|
|
3774
3774
|
isActive,
|
|
3775
3775
|
className,
|
|
3776
|
-
}), "data-testid": dataTestId ? dataTestId : undefined, onClick: onClick, children: jsxRuntime.jsxs(CardBody, { className: cvaCardBodyDensityContainer({ iconName: Boolean(iconName) }), density: "none", children: [jsxRuntime.jsx(KPI, { ...rest, className: "p-0",
|
|
3776
|
+
}), "data-testid": dataTestId ? dataTestId : undefined, onClick: onClick, children: jsxRuntime.jsxs(CardBody, { className: cvaCardBodyDensityContainer({ iconName: Boolean(iconName) }), density: "none", children: [jsxRuntime.jsx(KPI, { ...rest, className: "p-0", "data-testid": dataTestId ? `${dataTestId}-kpi` : undefined, loading: loading }), iconName ? (jsxRuntime.jsx("div", { className: cvaKPIIconContainer({ iconColor }), children: jsxRuntime.jsx(Icon, { name: iconName, size: "small", type: "solid" }) })) : null, children] }) }));
|
|
3777
3777
|
};
|
|
3778
3778
|
|
|
3779
3779
|
const cvaListContainer = cssClassVarianceUtilities.cvaMerge(["overflow-y-auto", "overflow-x-hidden", "h-full"], {
|
|
@@ -3946,7 +3946,7 @@ const ListLoadingIndicator = ({ type, hasThumbnail, thumbnailShape, hasDescripti
|
|
|
3946
3946
|
* );
|
|
3947
3947
|
* ```
|
|
3948
3948
|
*/
|
|
3949
|
-
const List = ({ children, className, dataTestId,
|
|
3949
|
+
const List = ({ children, className, "data-testid": dataTestId,
|
|
3950
3950
|
// UseListResult properties
|
|
3951
3951
|
containerRef, listRef, rows, getListItemProps, header, loadingIndicator, shouldShowLoaderAtIndex, count, isScrolling, separator, topSeparatorOnScroll, isAtTop, contentFillsContainer,
|
|
3952
3952
|
// Unused but part of UseListResult interface (can be used from parent)
|
|
@@ -4358,18 +4358,18 @@ const cvaInteractableItem = cssClassVarianceUtilities.cvaMerge("", {
|
|
|
4358
4358
|
* @param { ListItemProps} props - The props for the ListItem component
|
|
4359
4359
|
* @returns {Element} ListItem component
|
|
4360
4360
|
*/
|
|
4361
|
-
const ListItem = ({ className, dataTestId, onClick, details, title, description, meta, thumbnail, thumbnailColor = "info-600", thumbnailBackground = "info-100", ...rest }) => {
|
|
4361
|
+
const ListItem = ({ className, "data-testid": dataTestId, onClick, details, title, description, meta, thumbnail, thumbnailColor = "info-600", thumbnailBackground = "info-100", ...rest }) => {
|
|
4362
4362
|
const baseClass = cvaListItem({ className });
|
|
4363
4363
|
const interactableItemClass = onClick ? tailwindMerge.twMerge(baseClass, cvaInteractableItem({ cursor: "pointer" })) : baseClass;
|
|
4364
4364
|
return (jsxRuntime.jsxs("li", { className: interactableItemClass, "data-testid": dataTestId, onClick: onClick, ...rest, children: [jsxRuntime.jsxs("div", { className: cvaMainInformationClass({ hasThumbnail: !!thumbnail }), children: [thumbnail ? (jsxRuntime.jsx("div", { className: cvaThumbnailContainer({
|
|
4365
4365
|
className: `text-${thumbnailColor} bg-${thumbnailBackground}`,
|
|
4366
|
-
}), children: thumbnail })) : null, jsxRuntime.jsxs("div", { className: "grid-rows-min-fr grid items-center text-sm", children: [jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center text-sm", children: typeof title === "string" ? (jsxRuntime.jsx(Text, { className: "truncate",
|
|
4366
|
+
}), children: thumbnail })) : null, jsxRuntime.jsxs("div", { className: "grid-rows-min-fr grid items-center text-sm", children: [jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center text-sm", children: typeof title === "string" ? (jsxRuntime.jsx(Text, { className: "truncate", "data-testid": dataTestId ? `${dataTestId}-title` : undefined, weight: "bold", children: title })) : (react.cloneElement(title, {
|
|
4367
4367
|
className: tailwindMerge.twMerge(title.props.className, "neutral-900 text-sm font-medium truncate"),
|
|
4368
|
-
|
|
4369
|
-
})) }), description !== undefined && description !== "" ? (jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center", children: typeof description === "string" ? (jsxRuntime.jsx(Text, { className: "truncate text-xs text-neutral-500",
|
|
4368
|
+
"data-testid": !title.props["data-testid"] && dataTestId ? `${dataTestId}-title` : undefined,
|
|
4369
|
+
})) }), description !== undefined && description !== "" ? (jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center", children: typeof description === "string" ? (jsxRuntime.jsx(Text, { className: "truncate text-xs text-neutral-500", "data-testid": dataTestId ? `${dataTestId}-description` : undefined, weight: "bold", children: description })) : (react.cloneElement(description, {
|
|
4370
4370
|
className: tailwindMerge.twMerge(description.props.className, "text-neutral-500 text-xs font-medium truncate"),
|
|
4371
|
-
|
|
4372
|
-
})) })) : null, meta ? (jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center pt-0.5", children: jsxRuntime.jsx(Text, { className: "truncate text-xs text-neutral-400",
|
|
4371
|
+
"data-testid": !description.props["data-testid"] && dataTestId ? `${dataTestId}-description` : undefined,
|
|
4372
|
+
})) })) : null, meta ? (jsxRuntime.jsx("div", { className: "gap-responsive-space-sm flex w-full min-w-0 items-center pt-0.5", children: jsxRuntime.jsx(Text, { className: "truncate text-xs text-neutral-400", "data-testid": dataTestId ? `${dataTestId}-meta` : undefined, weight: "bold", children: meta }) })) : null] })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5 text-nowrap pl-2", children: [details, onClick ? jsxRuntime.jsx(Icon, { color: "neutral", name: "ChevronRight", size: "medium" }) : null] })] }));
|
|
4373
4373
|
};
|
|
4374
4374
|
|
|
4375
4375
|
// These must be two separate divs (menu and menulist) so that the overflow-clip can be applied to the parent and the overflow-y-auto can be applied to the child.
|
|
@@ -4539,7 +4539,7 @@ const cvaMenuItemSuffix = cssClassVarianceUtilities.cvaMerge(["text-neutral-400"
|
|
|
4539
4539
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
4540
4540
|
* @returns {ReactElement} MenuItem component
|
|
4541
4541
|
*/
|
|
4542
|
-
const MenuItem = ({ className, dataTestId, label, children, selected = false, focused = false, prefix, suffix, disabled = false, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, optionPrefix, fieldSize = "medium", variant = "primary", }) => {
|
|
4542
|
+
const MenuItem = ({ className, "data-testid": dataTestId, label, children, selected = false, focused = false, prefix, suffix, disabled = false, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, optionPrefix, fieldSize = "medium", variant = "primary", }) => {
|
|
4543
4543
|
/* Handle tab navigation */
|
|
4544
4544
|
const handleKeyDown = (e) => {
|
|
4545
4545
|
if (e.key === "Enter" && onClick !== undefined && disabled !== true) {
|
|
@@ -4576,7 +4576,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected = false, fo
|
|
|
4576
4576
|
* @param {MenuListProps} props - The props for the MenuList component
|
|
4577
4577
|
* @returns {ReactElement} MenuList component
|
|
4578
4578
|
*/
|
|
4579
|
-
const MenuList = ({ dataTestId, className, children, isMulti = false, selectedItems: controlledSelectedItems, onSelectionChange, ...args }) => {
|
|
4579
|
+
const MenuList = ({ "data-testid": dataTestId, className, children, isMulti = false, selectedItems: controlledSelectedItems, onSelectionChange, ...args }) => {
|
|
4580
4580
|
const childrenArr = react.Children.toArray(children);
|
|
4581
4581
|
const [internalSelectedItems, setInternalSelectedItems] = react.useState(controlledSelectedItems ?? []);
|
|
4582
4582
|
const selectedItems = controlledSelectedItems ?? internalSelectedItems;
|
|
@@ -4626,7 +4626,7 @@ const cvaMoreMenu = cssClassVarianceUtilities.cvaMerge(["p-0"]);
|
|
|
4626
4626
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
4627
4627
|
* @returns {ReactElement} MoreMenu component
|
|
4628
4628
|
*/
|
|
4629
|
-
const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
|
|
4629
|
+
const MoreMenu = ({ className, "data-testid": dataTestId, popoverProps, iconProps = {
|
|
4630
4630
|
size: "medium",
|
|
4631
4631
|
className: "text-neutral-400",
|
|
4632
4632
|
}, iconButtonProps = {
|
|
@@ -4635,7 +4635,7 @@ const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
|
|
|
4635
4635
|
variant: "secondary",
|
|
4636
4636
|
}, customButton, customPortalId, children, }) => {
|
|
4637
4637
|
const actionMenuRef = react.useRef(null);
|
|
4638
|
-
return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId ? dataTestId : undefined, ref: actionMenuRef, children: jsxRuntime.jsxs(Popover, { placement: "bottom-end", ...popoverProps, children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton ?? (jsxRuntime.jsx(IconButton, {
|
|
4638
|
+
return (jsxRuntime.jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId ? dataTestId : undefined, ref: actionMenuRef, children: jsxRuntime.jsxs(Popover, { placement: "bottom-end", ...popoverProps, children: [jsxRuntime.jsx(PopoverTrigger, { children: customButton ?? (jsxRuntime.jsx(IconButton, { "data-testid": "more-menu-icon", ...iconButtonProps, icon: jsxRuntime.jsx(Icon, { name: "EllipsisHorizontal", ...iconProps }) })) }), jsxRuntime.jsx(PopoverContent, { portalId: customPortalId, children: close => (typeof children === "function" ? children(close) : children) })] }) }));
|
|
4639
4639
|
};
|
|
4640
4640
|
|
|
4641
4641
|
const cvaNotice = cssClassVarianceUtilities.cvaMerge(["flex", "items-center"]);
|
|
@@ -4683,7 +4683,7 @@ const cvaNoticeIcon = cssClassVarianceUtilities.cvaMerge(["rounded-full", "items
|
|
|
4683
4683
|
* @param {NoticeProps} props - The props for the Notice component
|
|
4684
4684
|
* @returns {ReactElement} Notice component
|
|
4685
4685
|
*/
|
|
4686
|
-
const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, size = "medium", ...rest }) => {
|
|
4686
|
+
const Notice = ({ "data-testid": dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, size = "medium", ...rest }) => {
|
|
4687
4687
|
return (jsxRuntime.jsx(Tooltip, { className: className, disabled: withTooltip === false, label: tooltipLabel, placement: "bottom", children: jsxRuntime.jsxs("div", { "aria-label": label, className: cvaNotice(), "data-testid": dataTestId, ...rest, children: [jsxRuntime.jsx("div", { className: cvaNoticeIcon({ color }), "data-testid": dataTestId ? `${dataTestId}-icon` : "notice-icon", children: icon }), label && withLabel ? (jsxRuntime.jsx("div", { className: cvaNoticeLabel({ color, size }), "data-testid": dataTestId ? `${dataTestId}-label` : "notice-label", children: label })) : null] }) }));
|
|
4688
4688
|
};
|
|
4689
4689
|
|
|
@@ -4716,7 +4716,7 @@ const cvaPageContent = cssClassVarianceUtilities.cvaMerge(["overflow-auto", "pag
|
|
|
4716
4716
|
/**
|
|
4717
4717
|
* Renders the page component. Adds padding and layout to the page.
|
|
4718
4718
|
*/
|
|
4719
|
-
const Page = ({ layout, className, children, dataTestId }) => {
|
|
4719
|
+
const Page = ({ layout, className, children, "data-testid": dataTestId }) => {
|
|
4720
4720
|
return (jsxRuntime.jsx("div", { className: cvaPage({ className, layout }), "data-testid": dataTestId ? dataTestId : "page", children: children }));
|
|
4721
4721
|
};
|
|
4722
4722
|
|
|
@@ -4727,7 +4727,7 @@ const Page = ({ layout, className, children, dataTestId }) => {
|
|
|
4727
4727
|
* @param {PageContentProps} props - The component props.
|
|
4728
4728
|
* @returns {ReactNode} - The rendered component.
|
|
4729
4729
|
*/
|
|
4730
|
-
const PageContent = ({ className, children, dataTestId, layout }) => {
|
|
4730
|
+
const PageContent = ({ className, children, "data-testid": dataTestId, layout, }) => {
|
|
4731
4731
|
return (jsxRuntime.jsx("div", { className: cvaPageContent({ className, layout }), "data-testid": dataTestId ? dataTestId : "page-content", children: children }));
|
|
4732
4732
|
};
|
|
4733
4733
|
|
|
@@ -4757,13 +4757,13 @@ const PageHeaderKpiMetrics = ({ kpiMetrics }) => {
|
|
|
4757
4757
|
* @returns {ReactElement} ActionRenderer component
|
|
4758
4758
|
*/
|
|
4759
4759
|
function ActionRenderer({ action, isMenuItem = false, externalOnClick }) {
|
|
4760
|
-
const { to, tooltipLabel, prefixIconName, disabled, actionText, actionCallback, dataTestId, target, variant } = action;
|
|
4760
|
+
const { to, tooltipLabel, prefixIconName, disabled, actionText, actionCallback, "data-testid": dataTestId, target, variant, } = action;
|
|
4761
4761
|
// This component handles all the "wrapping" logic for Link/Tooltip
|
|
4762
4762
|
// The "content" is either a Button or a MenuItem, depending on `isMenuItem`
|
|
4763
|
-
const content = isMenuItem ? (jsxRuntime.jsx(MenuItem, {
|
|
4763
|
+
const content = isMenuItem ? (jsxRuntime.jsx(MenuItem, { "data-testid": dataTestId, disabled: disabled, label: actionText, onClick: e => {
|
|
4764
4764
|
actionCallback?.(e);
|
|
4765
4765
|
externalOnClick?.();
|
|
4766
|
-
}, prefix: prefixIconName ? jsxRuntime.jsx(Icon, { name: prefixIconName, size: "medium" }) : null, variant: variant === "secondary-danger" ? "danger" : "primary" })) : (jsxRuntime.jsx(Button, {
|
|
4766
|
+
}, prefix: prefixIconName ? jsxRuntime.jsx(Icon, { name: prefixIconName, size: "medium" }) : null, variant: variant === "secondary-danger" ? "danger" : "primary" })) : (jsxRuntime.jsx(Button, { "data-testid": dataTestId, disabled: disabled, onClick: e => {
|
|
4767
4767
|
actionCallback?.(e);
|
|
4768
4768
|
externalOnClick?.();
|
|
4769
4769
|
}, prefix: prefixIconName ? jsxRuntime.jsx(Icon, { name: prefixIconName, size: "small" }) : undefined, size: "small", variant: variant, children: actionText }));
|
|
@@ -4798,7 +4798,7 @@ const PageHeaderSecondaryActions = ({ actions, hasPrimaryAction = false, groupAc
|
|
|
4798
4798
|
return [danger, [...others, action]];
|
|
4799
4799
|
}
|
|
4800
4800
|
}, [[], []]);
|
|
4801
|
-
return (jsxRuntime.jsx(MoreMenu, {
|
|
4801
|
+
return (jsxRuntime.jsx(MoreMenu, { "data-testid": "secondary-actions-more-menu", iconButtonProps: { size: "small", variant: "secondary" }, children: close => (jsxRuntime.jsxs(MenuList, { className: "min-w-[160px]", children: [otherActions.map((action, index) => (jsxRuntime.jsx(ActionRenderer, { action: action, externalOnClick: close, isMenuItem: true }, `${action.actionText}-${index}`))), dangerActions.length > 0 ? jsxRuntime.jsx(MenuDivider, {}) : null, dangerActions.map((action, index) => (jsxRuntime.jsx(ActionRenderer, { action: action, externalOnClick: close, isMenuItem: true }, `${action.actionText}-${index}`)))] })) }));
|
|
4802
4802
|
}
|
|
4803
4803
|
// Otherwise, render them inline as buttons
|
|
4804
4804
|
return (jsxRuntime.jsx("div", { className: "flex flex-row items-center gap-2", children: enabledActions
|
|
@@ -4830,12 +4830,13 @@ const cvaPageHeaderHeading = cssClassVarianceUtilities.cvaMerge(["text-neutral-9
|
|
|
4830
4830
|
*
|
|
4831
4831
|
* @param {object} props - The props for the PageHeaderTitle component
|
|
4832
4832
|
* @param {string} props.title - The title of the page header
|
|
4833
|
-
* @param {string}
|
|
4833
|
+
* @param {string} props.className - The class name of the page header title
|
|
4834
|
+
* @param {string} [props."data-testid"] - The data test id of the page header title
|
|
4834
4835
|
* @returns {ReactElement} PageHeaderTitle component
|
|
4835
4836
|
*/
|
|
4836
|
-
const PageHeaderTitle = ({ title, dataTestId }) => {
|
|
4837
|
+
const PageHeaderTitle = ({ title, "data-testid": dataTestId, className, }) => {
|
|
4837
4838
|
const { ref, isTextTruncated } = useIsTextTruncated();
|
|
4838
|
-
return (jsxRuntime.jsx("div", { className: "flex flex-row items-center", children: jsxRuntime.jsx(Tooltip, { className: "grid min-w-16", disabled: !isTextTruncated, label: title, placement: "top", children: jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, ref: ref, children: title }) }) }));
|
|
4839
|
+
return (jsxRuntime.jsx("div", { className: "flex flex-row items-center", children: jsxRuntime.jsx(Tooltip, { className: "grid min-w-16", disabled: !isTextTruncated, label: title, placement: "top", children: jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading({ className }), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, ref: ref, children: title }) }) }));
|
|
4839
4840
|
};
|
|
4840
4841
|
|
|
4841
4842
|
/**
|
|
@@ -4848,25 +4849,25 @@ const PageHeaderTitle = ({ title, dataTestId }) => {
|
|
|
4848
4849
|
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
4849
4850
|
* @returns {ReactElement} PageHeader component
|
|
4850
4851
|
*/
|
|
4851
|
-
const PageHeader = ({ className, dataTestId, showLoading = false, description, title, tagLabel, backTo, tagColor, tabsList, descriptionIcon = "QuestionMarkCircle", tagTooltipLabel, ...discriminatedProps }) => {
|
|
4852
|
+
const PageHeader = ({ className, "data-testid": dataTestId, showLoading = false, description, title, tagLabel, backTo, tagColor, tabsList, descriptionIcon = "QuestionMarkCircle", tagTooltipLabel, ...discriminatedProps }) => {
|
|
4852
4853
|
const tagRenderer = react.useMemo(() => {
|
|
4853
4854
|
if (tagLabel === undefined || tagLabel === "" || showLoading) {
|
|
4854
4855
|
return null;
|
|
4855
4856
|
}
|
|
4856
4857
|
// If the user passes a string, we render the string as a tag with props provided.
|
|
4857
|
-
return (jsxRuntime.jsx("div", { className: "ml-auto flex flex-row gap-2", children: jsxRuntime.jsx(Tooltip, {
|
|
4858
|
+
return (jsxRuntime.jsx("div", { className: "ml-auto flex flex-row gap-2", children: jsxRuntime.jsx(Tooltip, { "data-testid": "page-header-tag-tooltip", disabled: tagTooltipLabel === undefined || tagTooltipLabel === "", label: tagTooltipLabel, placement: "top", children: jsxRuntime.jsx(Tag, { color: tagColor, "data-testid": "page-header-tag", children: tagLabel }) }) }));
|
|
4858
4859
|
}, [showLoading, tagColor, tagLabel, tagTooltipLabel]);
|
|
4859
4860
|
return (jsxRuntime.jsxs("div", { className: cvaPageHeaderContainer({
|
|
4860
4861
|
className,
|
|
4861
4862
|
withBorder: tabsList === undefined,
|
|
4862
|
-
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [backTo ? (jsxRuntime.jsx(reactRouter.Link, { to: backTo, children: jsxRuntime.jsx(Button, { className: "mr-4 bg-black/5 hover:bg-black/10", prefix: jsxRuntime.jsx(Icon, { name: "ArrowLeft", size: "small" }), size: "small", square: true, variant: "ghost-neutral" }) })) : undefined, typeof title === "string" ? jsxRuntime.jsx(PageHeaderTitle, {
|
|
4863
|
+
}), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeader(), children: [backTo ? (jsxRuntime.jsx(reactRouter.Link, { to: backTo, children: jsxRuntime.jsx(Button, { className: "mr-4 bg-black/5 hover:bg-black/10", prefix: jsxRuntime.jsx(Icon, { name: "ArrowLeft", size: "small" }), size: "small", square: true, variant: "ghost-neutral" }) })) : undefined, typeof title === "string" ? jsxRuntime.jsx(PageHeaderTitle, { "data-testid": dataTestId, title: title }) : title, tagRenderer || (description !== null && description !== undefined) ? (jsxRuntime.jsxs("div", { className: "mx-2 flex items-center gap-2", children: [description !== null && description !== undefined && !showLoading ? (jsxRuntime.jsx(Tooltip, { "data-testid": dataTestId ? `${dataTestId}-description-tooltip` : undefined, iconProps: {
|
|
4863
4864
|
name: descriptionIcon,
|
|
4864
|
-
|
|
4865
|
+
"data-testid": "page-header-description-icon",
|
|
4865
4866
|
}, label: description, placement: "bottom" })) : undefined, tagRenderer] })) : null, jsxRuntime.jsxs("div", { className: "ml-auto flex gap-2", children: [discriminatedProps.accessoryType === "kpi-metrics" ? (jsxRuntime.jsx(PageHeaderKpiMetrics, { kpiMetrics: discriminatedProps.kpiMetrics })) : null, discriminatedProps.accessoryType === "actions" ? (Array.isArray(discriminatedProps.secondaryActions) ? (jsxRuntime.jsx(PageHeaderSecondaryActions, { actions: discriminatedProps.secondaryActions, groupActions: discriminatedProps.groupSecondaryActions ?? false, hasPrimaryAction: !!discriminatedProps.primaryAction })) : discriminatedProps.secondaryActions !== null && discriminatedProps.secondaryActions !== undefined ? (discriminatedProps.secondaryActions) : null) : null, discriminatedProps.accessoryType === "actions" &&
|
|
4866
4867
|
discriminatedProps.primaryAction !== undefined &&
|
|
4867
4868
|
(discriminatedProps.primaryAction.hidden === false ||
|
|
4868
4869
|
discriminatedProps.primaryAction.hidden === undefined) ? (jsxRuntime.jsx(Tooltip, { disabled: discriminatedProps.primaryAction.tooltipLabel === undefined ||
|
|
4869
|
-
discriminatedProps.primaryAction.tooltipLabel === "", label: discriminatedProps.primaryAction.tooltipLabel, children: jsxRuntime.jsx(Button, {
|
|
4870
|
+
discriminatedProps.primaryAction.tooltipLabel === "", label: discriminatedProps.primaryAction.tooltipLabel, children: jsxRuntime.jsx(Button, { "data-testid": discriminatedProps.primaryAction["data-testid"], disabled: discriminatedProps.primaryAction.disabled, loading: discriminatedProps.primaryAction.loading, onClick: () => discriminatedProps.primaryAction?.actionCallback?.(), prefix: discriminatedProps.primaryAction.prefixIconName !== undefined ? (jsxRuntime.jsx(Icon, { name: discriminatedProps.primaryAction.prefixIconName, size: "small" })) : undefined, size: "small", variant: discriminatedProps.primaryAction.variant, children: discriminatedProps.primaryAction.actionText }) })) : null] })] }), tabsList] }));
|
|
4870
4871
|
};
|
|
4871
4872
|
|
|
4872
4873
|
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -4878,7 +4879,7 @@ const cvaPaginationText = cssClassVarianceUtilities.cvaMerge("whitespace-nowrap"
|
|
|
4878
4879
|
* @param {PaginationProps} props - The props for the Pagination component
|
|
4879
4880
|
* @returns {ReactElement} Pagination component
|
|
4880
4881
|
*/
|
|
4881
|
-
const Pagination = ({ previousPage, nextPage, canPreviousPage = false, canNextPage = false, pageCount, pageIndex, loading = false, className, dataTestId, getTranslatedCount, onPageChange, cursorBase = false, }) => {
|
|
4882
|
+
const Pagination = ({ previousPage, nextPage, canPreviousPage = false, canNextPage = false, pageCount, pageIndex, loading = false, className, "data-testid": dataTestId, getTranslatedCount, onPageChange, cursorBase = false, }) => {
|
|
4882
4883
|
const [page, setPage] = react.useState(pageIndex);
|
|
4883
4884
|
const [currentPage, setCurrentPage] = react.useState(String(pageIndex !== undefined ? pageIndex + 1 : 1));
|
|
4884
4885
|
if (!loading && pageCount === undefined) {
|
|
@@ -4935,7 +4936,7 @@ const STROKE_WIDTH_THRESHOLD = 32;
|
|
|
4935
4936
|
* @param { PolygonProps} props - The props for the Polygon component
|
|
4936
4937
|
* @returns {ReactElement} Polygon component
|
|
4937
4938
|
*/
|
|
4938
|
-
const Polygon = ({ points, size, color = "black", opaque = true, className, dataTestId, }) => {
|
|
4939
|
+
const Polygon = ({ points, size, color = "black", opaque = true, className, "data-testid": dataTestId, }) => {
|
|
4939
4940
|
// Calculate the bounds of the points
|
|
4940
4941
|
const minX = Math.min(...points.map(coord => coord[0]));
|
|
4941
4942
|
const maxX = Math.max(...points.map(coord => coord[0]));
|
|
@@ -5027,7 +5028,7 @@ const cvaSpacer = cssClassVarianceUtilities.cvaMerge([], {
|
|
|
5027
5028
|
* @param {SpacerProps} props - The props for the Spacer component
|
|
5028
5029
|
* @returns {ReactElement} Spacer component
|
|
5029
5030
|
*/
|
|
5030
|
-
const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
|
|
5031
|
+
const Spacer = ({ size = "medium", border = false, "data-testid": dataTestId, className, }) => {
|
|
5031
5032
|
return jsxRuntime.jsx("div", { className: cvaSpacer({ className, border, size }), "data-testid": dataTestId });
|
|
5032
5033
|
};
|
|
5033
5034
|
|
|
@@ -5037,8 +5038,8 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
|
|
|
5037
5038
|
* @param {SectionHeaderProps} props - The props for the section header component
|
|
5038
5039
|
* @returns {ReactElement} SectionHeader component
|
|
5039
5040
|
*/
|
|
5040
|
-
const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
|
|
5041
|
-
return (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(reactHelmetAsync.Helmet, { title: title }) }), jsxRuntime.jsxs("div", { className: "mb-2 flex flex-row gap-2", children: [jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-2", children: [jsxRuntime.jsx(Heading, {
|
|
5041
|
+
const SectionHeader = ({ title, subtitle, "data-testid": dataTestId, addons, }) => {
|
|
5042
|
+
return (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(reactHelmetAsync.Helmet, { title: title }) }), jsxRuntime.jsxs("div", { className: "mb-2 flex flex-row gap-2", children: [jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-2", children: [jsxRuntime.jsx(Heading, { "data-testid": dataTestId, variant: "secondary", children: title }), subtitle ? (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subtitle })) : null] }), addons !== null && addons !== undefined ? jsxRuntime.jsx("div", { className: "flex gap-2", children: addons }) : null] }), jsxRuntime.jsx(Spacer, { size: "small" })] }));
|
|
5042
5043
|
};
|
|
5043
5044
|
|
|
5044
5045
|
const cvaSidebar = cssClassVarianceUtilities.cvaMerge(["apply", "grid", "grid-cols-fr-min", "items-center"]);
|
|
@@ -5120,7 +5121,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
5120
5121
|
* @param {SidebarProps} props - The props for the Sidebar component
|
|
5121
5122
|
* @returns {ReactElement} Sidebar component
|
|
5122
5123
|
*/
|
|
5123
|
-
const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", className, dataTestId = "sidebar", moreMenuProps, menuListProps, overflowThreshold, }) => {
|
|
5124
|
+
const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", className, "data-testid": dataTestId = "sidebar", moreMenuProps, menuListProps, overflowThreshold, }) => {
|
|
5124
5125
|
const { overflowContainerRef, itemOverflowMap } = useOverflowItems({
|
|
5125
5126
|
children,
|
|
5126
5127
|
childUniqueIdentifierAttribute: "id",
|
|
@@ -5139,7 +5140,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
5139
5140
|
});
|
|
5140
5141
|
}) }), overflowItemCount > 0 ? (jsxRuntime.jsx(MoreMenu, { iconButtonProps: {
|
|
5141
5142
|
variant: "ghost-neutral",
|
|
5142
|
-
}, ...moreMenuProps, className: moreMenuProps?.className,
|
|
5143
|
+
}, ...moreMenuProps, className: moreMenuProps?.className, "data-testid": `${dataTestId}-more-menu`, children: close => (jsxRuntime.jsx(MenuList, { ...menuListProps, "data-testid": dataTestId, children: react.Children.map(children, child => {
|
|
5143
5144
|
return itemOverflowMap[child.props.id] === true
|
|
5144
5145
|
? react.cloneElement(child, {
|
|
5145
5146
|
onClick: () => {
|
|
@@ -5203,7 +5204,7 @@ const cvaTab = cssClassVarianceUtilities.cvaMerge([
|
|
|
5203
5204
|
* Wrapper for radix tab component.
|
|
5204
5205
|
* We add a custom implementation of the asChild prop to make it easy to make the child element look like other tabs.
|
|
5205
5206
|
*/
|
|
5206
|
-
const Tab = ({ value, isFullWidth = false, iconName = undefined, dataTestId, className, children, suffix, asChild = false, appendTabStylesToChildIfAsChild = true, ...rest }) => {
|
|
5207
|
+
const Tab = ({ value, isFullWidth = false, iconName = undefined, "data-testid": dataTestId, className, children, suffix, asChild = false, appendTabStylesToChildIfAsChild = true, ...rest }) => {
|
|
5207
5208
|
const renderContent = () => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconName !== undefined ? jsxRuntime.jsx(Icon, { name: iconName, size: "small" }) : null, react.isValidElement(children) ? children.props.children : children, suffix] }));
|
|
5208
5209
|
const commonProps = {
|
|
5209
5210
|
className: appendTabStylesToChildIfAsChild ? cvaTab({ className, isFullWidth }) : className,
|
|
@@ -5218,14 +5219,14 @@ const Tab = ({ value, isFullWidth = false, iconName = undefined, dataTestId, cla
|
|
|
5218
5219
|
/**
|
|
5219
5220
|
* Wrapper for radix tab content component.
|
|
5220
5221
|
*/
|
|
5221
|
-
const TabContent = ({ className, dataTestId, children, ...rest }) => {
|
|
5222
|
+
const TabContent = ({ className, "data-testid": dataTestId, children, ...rest }) => {
|
|
5222
5223
|
return (jsxRuntime.jsx(reactTabs.Content, { className: cvaTabContent({ className }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined, ...rest, children: children }));
|
|
5223
5224
|
};
|
|
5224
5225
|
|
|
5225
5226
|
/**
|
|
5226
5227
|
* Wrapper for radix tab list component.
|
|
5227
5228
|
*/
|
|
5228
|
-
const TabList = ({ className, dataTestId, children, autoScrollToActive = true, ...rest }) => {
|
|
5229
|
+
const TabList = ({ className, "data-testid": dataTestId, children, autoScrollToActive = true, ...rest }) => {
|
|
5229
5230
|
const listRef = react.useRef(null);
|
|
5230
5231
|
react.useEffect(() => {
|
|
5231
5232
|
const element = listRef.current;
|
|
@@ -5271,7 +5272,7 @@ const TabList = ({ className, dataTestId, children, autoScrollToActive = true, .
|
|
|
5271
5272
|
/**
|
|
5272
5273
|
* 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.
|
|
5273
5274
|
*/
|
|
5274
|
-
const Tabs = ({ children, forceRender, className, dataTestId, fullWidth, ...rest }) => {
|
|
5275
|
+
const Tabs = ({ children, forceRender, className, "data-testid": dataTestId, fullWidth, ...rest }) => {
|
|
5275
5276
|
return (jsxRuntime.jsx(reactTabs.Root, { className: cvaTabsRoot({ className }), "data-testid": dataTestId, ...rest, children: children }));
|
|
5276
5277
|
};
|
|
5277
5278
|
|
|
@@ -5395,7 +5396,7 @@ const cvaToggleItemContent = cssClassVarianceUtilities.cvaMerge([], {
|
|
|
5395
5396
|
* @param {ToggleGroupProps} props - The props for the ToggleGroup component
|
|
5396
5397
|
* @returns {ReactElement} ToggleGroup component
|
|
5397
5398
|
*/
|
|
5398
|
-
const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false, size = "medium", isIconOnly = false, className, dataTestId, }) => {
|
|
5399
|
+
const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false, size = "medium", isIconOnly = false, className, "data-testid": dataTestId, }) => {
|
|
5399
5400
|
const [isMounted, setIsMounted] = react.useState(false);
|
|
5400
5401
|
const [slidingLeft, setSlidingLeft] = react.useState(0);
|
|
5401
5402
|
const [slidingWidth, setSlidingWidth] = react.useState(0);
|
|
@@ -5422,23 +5423,23 @@ const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false,
|
|
|
5422
5423
|
"--sliding-left": `${slidingLeft}px`,
|
|
5423
5424
|
"--sliding-width": `${slidingWidth}px`,
|
|
5424
5425
|
"--transition-duration": "200ms",
|
|
5425
|
-
}, children: list.map((item, index) => (jsxRuntime.jsx(ToggleItem, { className: item.className,
|
|
5426
|
+
}, children: list.map((item, index) => (jsxRuntime.jsx(ToggleItem, { className: item.className, "data-testid": item["data-testid"], disabled: disabled, iconName: item.iconName, isIconOnly: isIconOnly, onClick: () => {
|
|
5426
5427
|
setSelected(item.id);
|
|
5427
5428
|
onChange?.(item.id);
|
|
5428
5429
|
}, ref: el => (buttonRefs.current[index] = el), selected: selected === item.id, size: size, text: item.text, title: item.title, tooltip: item.tooltip }, item.id))) }));
|
|
5429
5430
|
};
|
|
5430
|
-
const ToggleItem = ({ title, onClick, disabled, isIconOnly, iconName, size, className, selected, text, tooltip, dataTestId, ref, }) => {
|
|
5431
|
+
const ToggleItem = ({ title, onClick, disabled, isIconOnly, iconName, size, className, selected, text, tooltip, "data-testid": dataTestId, ref, }) => {
|
|
5431
5432
|
return isIconOnly ? (jsxRuntime.jsx(Tooltip, { label: tooltip?.content || title, placement: tooltip?.placement || "top", children: jsxRuntime.jsx(ToggleButton, { className: cvaToggleItem({
|
|
5432
5433
|
className,
|
|
5433
5434
|
selected,
|
|
5434
5435
|
disabled,
|
|
5435
|
-
}),
|
|
5436
|
+
}), "data-testid": dataTestId, disabled: disabled, icon: iconName ? (jsxRuntime.jsx(Icon, { className: cvaToggleItemContent({ selected, disabled }), name: iconName, size: size === "large" ? "medium" : "small" })) : null, isIconOnly: isIconOnly, onClick: onClick, ref: ref, size: size, title: title }) })) : (jsxRuntime.jsx(Tooltip, { disabled: !tooltip?.content && text?.truncate === false, label: tooltip?.content || title, placement: tooltip?.placement || "top", children: jsxRuntime.jsx(ToggleButton, { className: cvaToggleItem({
|
|
5436
5437
|
className,
|
|
5437
5438
|
selected,
|
|
5438
5439
|
disabled,
|
|
5439
|
-
}),
|
|
5440
|
+
}), "data-testid": dataTestId, disabled: disabled, iconPrefix: iconName ? (jsxRuntime.jsx(Icon, { className: cvaToggleItemContent({ selected, disabled }), name: iconName, size: size === "large" ? "medium" : "small" })) : null, isIconOnly: isIconOnly, onClick: onClick, ref: ref, size: size, title: title, children: jsxRuntime.jsx("span", { className: cvaToggleItemText({ maxWidth: text?.maxWidth, selected, disabled }), children: title }) }) }));
|
|
5440
5441
|
};
|
|
5441
|
-
const ToggleButton = ({ title, size, children, dataTestId, className, icon, iconPrefix, isIconOnly, ...rest }) => {
|
|
5442
|
+
const ToggleButton = ({ title, size, children, "data-testid": dataTestId, className, icon, iconPrefix, isIconOnly, ...rest }) => {
|
|
5442
5443
|
const sizeClasses = {
|
|
5443
5444
|
small: "px-2 py-1 text-xs",
|
|
5444
5445
|
medium: "px-2 py-1 text-sm",
|
|
@@ -5559,11 +5560,11 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
|
5559
5560
|
* @param {ValueBarProps} props - The props for the ValueBar component
|
|
5560
5561
|
* @returns {ReactElement} ValueBar component
|
|
5561
5562
|
*/
|
|
5562
|
-
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue = false, className, dataTestId, zeroScoreAllowed = false, }) => {
|
|
5563
|
+
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue = false, className, "data-testid": dataTestId, zeroScoreAllowed = false, }) => {
|
|
5563
5564
|
const score = getScore(value, min, max, zeroScoreAllowed);
|
|
5564
5565
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
5565
5566
|
const valueText = `${Number(value.toFixed(1))}${sharedUtils.nonNullable(unit) ? unit : ""}`;
|
|
5566
|
-
return (jsxRuntime.jsxs("span", { className: "relative flex items-center gap-2", "data-testid": dataTestId, children: [jsxRuntime.jsx("progress", { "aria-label": valueText, className: cvaValueBar({ className, size }), max: 100, style: { color: barFillColor }, value: score * 100 }), showValue && (size === "small" || size === "large") ? (jsxRuntime.jsx(Text, { className: cvaValueBarText({ size }),
|
|
5567
|
+
return (jsxRuntime.jsxs("span", { className: "relative flex items-center gap-2", "data-testid": dataTestId, children: [jsxRuntime.jsx("progress", { "aria-label": valueText, className: cvaValueBar({ className, size }), max: 100, style: { color: barFillColor }, value: score * 100 }), showValue && (size === "small" || size === "large") ? (jsxRuntime.jsx(Text, { className: cvaValueBarText({ size }), "data-testid": dataTestId ? `${dataTestId}-value` : undefined, children: jsxRuntime.jsx("span", { style: valueColor ? { color: valueColor } : undefined, children: valueText }) })) : null] }));
|
|
5567
5568
|
};
|
|
5568
5569
|
|
|
5569
5570
|
const cvaClickable = cssClassVarianceUtilities.cvaMerge([
|