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