@trackunit/react-components 1.22.2 → 1.22.5
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 +166 -132
- package/index.esm.js +167 -133
- package/package.json +5 -5
- package/src/common/Styleable.d.ts +5 -1
- package/src/components/Alert/Alert.d.ts +3 -2
- package/src/components/Badge/Badge.d.ts +3 -2
- package/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- 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/Breadcrumb/utils/types.d.ts +4 -3
- package/src/components/Card/Card.d.ts +2 -1
- package/src/components/Card/CardBody.d.ts +3 -2
- package/src/components/Card/CardFooter.d.ts +3 -2
- package/src/components/Card/CardHeader.d.ts +3 -2
- package/src/components/Collapse/Collapse.d.ts +3 -2
- package/src/components/CompletionStatusIndicator/CompletionStatusIndicator.d.ts +2 -1
- package/src/components/CopyableText/CopyableText.d.ts +3 -2
- package/src/components/DetailsList/DetailsList.d.ts +4 -3
- package/src/components/EmptyState/EmptyState.d.ts +3 -2
- package/src/components/EmptyValue/EmptyValue.d.ts +3 -2
- package/src/components/ExternalLink/ExternalLink.d.ts +3 -2
- package/src/components/GridAreas/GridAreas.d.ts +3 -2
- package/src/components/Heading/Heading.d.ts +2 -1
- package/src/components/Highlight/Highlight.d.ts +3 -2
- package/src/components/HorizontalOverflowScroller/HorizontalOverflowScroller.d.ts +2 -2
- package/src/components/HorizontalOverflowScroller/OverflowIndicator.d.ts +3 -2
- package/src/components/Icon/Icon.d.ts +3 -8
- package/src/components/Indicator/Indicator.d.ts +2 -1
- package/src/components/KPI/KPI.d.ts +1 -1
- package/src/components/KPI/KPISkeleton.d.ts +1 -1
- package/src/components/KPICard/KPICardSkeleton.d.ts +1 -1
- package/src/components/KPICard/components/TrendIndicator/TrendIndicator.d.ts +3 -2
- package/src/components/KPICard/components/TrendIndicators.d.ts +3 -2
- package/src/components/List/List.d.ts +3 -2
- package/src/components/List/ListLoadingIndicator.d.ts +3 -2
- package/src/components/List/useList.d.ts +2 -1
- package/src/components/ListItem/ListItem.d.ts +2 -1
- package/src/components/ListItem/ListItemSkeleton.d.ts +4 -2
- package/src/components/Menu/MenuDivider/MenuDivider.d.ts +3 -1
- package/src/components/Menu/MenuItem/MenuItem.d.ts +3 -2
- package/src/components/Menu/MenuList/MenuList.d.ts +3 -2
- package/src/components/Menu/MoreMenu/MoreMenu.d.ts +3 -2
- package/src/components/Notice/Notice.d.ts +2 -1
- package/src/components/Page/Page.d.ts +3 -2
- package/src/components/Page/PageContent.d.ts +3 -2
- package/src/components/PageHeader/PageHeader.d.ts +1 -1
- package/src/components/PageHeader/components/PageHeaderKpiMetrics.d.ts +7 -2
- package/src/components/PageHeader/components/PageHeaderTitle.d.ts +4 -2
- package/src/components/PageHeader/types.d.ts +3 -2
- package/src/components/Pagination/Pagination.d.ts +4 -10
- package/src/components/Polygon/Polygon.d.ts +3 -2
- package/src/components/Popover/PopoverTitle.d.ts +3 -2
- package/src/components/PreferenceCard/PreferenceCard.d.ts +3 -2
- package/src/components/PreferenceCard/PreferenceCardSkeleton.d.ts +4 -2
- package/src/components/SectionHeader/SectionHeader.d.ts +3 -2
- package/src/components/Sheet/Sheet.d.ts +1 -1
- package/src/components/Sheet/sheet-types.d.ts +2 -1
- package/src/components/Sidebar/Sidebar.d.ts +4 -3
- package/src/components/Skeleton/SkeletonBlock/SkeletonBlock.d.ts +2 -1
- package/src/components/Skeleton/SkeletonLabel/SkeletonLabel.d.ts +2 -1
- package/src/components/SkeletonLines/SkeletonLines.d.ts +4 -3
- package/src/components/Spacer/Spacer.d.ts +3 -2
- package/src/components/Spinner/Spinner.d.ts +3 -2
- package/src/components/Tag/Tag.d.ts +3 -2
- package/src/components/Text/Text.d.ts +2 -1
- package/src/components/ToggleGroup/ToggleGroup.d.ts +5 -4
- package/src/components/Tooltip/Tooltip.d.ts +1 -1
- package/src/components/ValueBar/SegmentedValueBar.d.ts +3 -2
- package/src/components/ValueBar/ValueBar.d.ts +3 -2
- package/src/components/ZStack/ZStack.d.ts +3 -2
- package/src/components/buttons/shared/ButtonProps.d.ts +2 -1
- package/src/index.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -10,7 +10,7 @@ import IconSpriteSolid from '@trackunit/ui-icons/icons-sprite-solid.svg';
|
|
|
10
10
|
import { snakeCase, titleCase } from 'string-ts';
|
|
11
11
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
12
12
|
import { Slot, Slottable } from '@radix-ui/react-slot';
|
|
13
|
-
import { Link, useBlocker, useNavigate, useLocation, useSearch } from '@tanstack/react-router';
|
|
13
|
+
import { Link, useBlocker, useNavigate, useLocation, useRouter, useSearch } from '@tanstack/react-router';
|
|
14
14
|
import { isEqual, omit } from 'es-toolkit';
|
|
15
15
|
import { useFloating, offset, flip, shift, size, autoUpdate, useClick, useDismiss, useHover as useHover$1, safePolygon, useRole, useInteractions, FloatingPortal, useMergeRefs as useMergeRefs$1, FloatingFocusManager, arrow, useTransitionStatus, FloatingArrow } from '@floating-ui/react';
|
|
16
16
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -158,7 +158,7 @@ const Icon = ({ name, size = "medium", className, "data-testid": dataTestId, col
|
|
|
158
158
|
useTagRef.current.setAttribute("href", href[correctIconType]);
|
|
159
159
|
}
|
|
160
160
|
}, [correctIconType, href]);
|
|
161
|
-
return (jsx("span", { ...rest, "aria-describedby": ariaDescribedBy, "aria-hidden": ariaHidden, "aria-label": ariaLabel ? ariaLabel : titleCase(iconName), "aria-labelledby": ariaLabelledBy, className: cvaIcon({ color, size, fontSize, className }), "data-testid": dataTestId, id: iconContainerId, onClick: onClick, ref: ref, children: jsx("svg", { "aria-labelledby": iconContainerId, "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, role: "img",
|
|
161
|
+
return (jsx("span", { ...rest, "aria-describedby": ariaDescribedBy, "aria-hidden": ariaHidden, "aria-label": ariaLabel ? ariaLabel : titleCase(iconName), "aria-labelledby": ariaLabelledBy, className: cvaIcon({ color, size, fontSize, className }), "data-testid": dataTestId, id: iconContainerId, onClick: onClick, ref: ref, style: style, children: jsx("svg", { "aria-labelledby": iconContainerId, "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, role: "img", viewBox: correctViewBox, children: jsx("use", { href: href[correctIconType], ref: useTagRef }) }) }));
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -289,7 +289,7 @@ const TAG_TEXT_MIN_WIDTH_PX = parseTailwindArbitraryValue(TAG_TEXT_MIN_WIDTH_CLA
|
|
|
289
289
|
* @param {TagProps} props - The props for the Tag component.
|
|
290
290
|
* @returns {ReactElement} The rendered Tag component.
|
|
291
291
|
*/
|
|
292
|
-
const Tag = ({ className, "data-testid": dataTestId, children, size = "medium", onClickClose, color = "info", disabled = false, ref, icon, onMouseEnter, }) => {
|
|
292
|
+
const Tag = ({ className, "data-testid": dataTestId, children, size = "medium", onClickClose, color = "info", disabled = false, ref, icon, onMouseEnter, style, }) => {
|
|
293
293
|
const textRef = useRef(null);
|
|
294
294
|
const [shouldTruncate, setShouldTruncate] = useState(false);
|
|
295
295
|
useLayoutEffect(() => {
|
|
@@ -324,7 +324,7 @@ const Tag = ({ className, "data-testid": dataTestId, children, size = "medium",
|
|
|
324
324
|
color,
|
|
325
325
|
layout,
|
|
326
326
|
border: color === "white" ? "default" : "none",
|
|
327
|
-
}), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, children: [icon !== null && icon !== undefined && size === "medium" ? (jsx("div", { className: cvaTagIconContainer(), "data-slot": "icon", children: icon })) : null, jsx("span", { className: cvaTagText({ truncate: shouldTruncate }), ref: textRef, children: children }), Boolean(onClickClose) && isSupportedDismissColor && size === "medium" && !disabled ? (jsx("div", { className: cvaTagIconContainer(), "data-slot": "dismiss", onClick: onClickClose, children: jsx(Icon, { className: cvaTagIcon(), "data-testid": dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
327
|
+
}), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, style: style, children: [icon !== null && icon !== undefined && size === "medium" ? (jsx("div", { className: cvaTagIconContainer(), "data-slot": "icon", children: icon })) : null, jsx("span", { className: cvaTagText({ truncate: shouldTruncate }), ref: textRef, children: children }), Boolean(onClickClose) && isSupportedDismissColor && size === "medium" && !disabled ? (jsx("div", { className: cvaTagIconContainer(), "data-slot": "dismiss", onClick: onClickClose, children: jsx(Icon, { className: cvaTagIcon(), "data-testid": dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
328
328
|
};
|
|
329
329
|
|
|
330
330
|
/**
|
|
@@ -629,8 +629,8 @@ const cvaSpinnerLabel = cvaMerge(["self-center", "text-center", "text-current"])
|
|
|
629
629
|
* @param {SpinnerProps} props - The props for the Spinner component
|
|
630
630
|
* @returns {ReactElement} Spinner component
|
|
631
631
|
*/
|
|
632
|
-
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, "data-testid": dataTestId = "spinner", label, ref, }) => {
|
|
633
|
-
return (jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), ref: ref, 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] }) }));
|
|
632
|
+
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, "data-testid": dataTestId = "spinner", label, style, ref, }) => {
|
|
633
|
+
return (jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), ref: ref, style: style, 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] }) }));
|
|
634
634
|
};
|
|
635
635
|
|
|
636
636
|
const cvaButton = cvaMerge([
|
|
@@ -1159,7 +1159,7 @@ const cvaAlertIconContainer = cvaMerge(["shrink-0", "grid", "w-min", "flex"], {
|
|
|
1159
1159
|
* @param {AlertProps} props - The props for the Alert component
|
|
1160
1160
|
* @returns {ReactElement} Alert component
|
|
1161
1161
|
*/
|
|
1162
|
-
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClickClose, "data-testid": dataTestId, autoScroll = false, actionsInline = false, ref, }) => {
|
|
1162
|
+
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClickClose, "data-testid": dataTestId, autoScroll = false, actionsInline = false, style, ref, }) => {
|
|
1163
1163
|
const scrollRef = useRef(null);
|
|
1164
1164
|
const mergedRef = useMergeRefs([scrollRef, ref]);
|
|
1165
1165
|
const { isTextWrapping, ref: titleRef } = useIsTextWrapping();
|
|
@@ -1171,7 +1171,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
1171
1171
|
}
|
|
1172
1172
|
}
|
|
1173
1173
|
}, [autoScroll]);
|
|
1174
|
-
return (jsxs("div", { className: cvaAlert({ color, actionsInline, className }), "data-testid": dataTestId, ref: mergedRef, role: "alert", children: [jsxs("div", { className: cvaAlertContentContainer({
|
|
1174
|
+
return (jsxs("div", { className: cvaAlert({ color, actionsInline, className }), "data-testid": dataTestId, ref: mergedRef, role: "alert", style: style, children: [jsxs("div", { className: cvaAlertContentContainer({
|
|
1175
1175
|
inline: !isTextWrapping && (children === null || children === undefined),
|
|
1176
1176
|
actionsInline,
|
|
1177
1177
|
}), children: [jsx("div", { className: cvaAlertIconContainer({
|
|
@@ -1293,7 +1293,7 @@ const cvaBadge = cvaMerge([
|
|
|
1293
1293
|
* @param {BadgeProps} props - The props for the Badge component
|
|
1294
1294
|
* @returns {ReactElement} Badge component
|
|
1295
1295
|
*/
|
|
1296
|
-
const Badge = ({ color = "primary", size = "default", compact = false, className, count, max, hideZero = false, "data-testid": dataTestId, ref, }) => {
|
|
1296
|
+
const Badge = ({ color = "primary", size = "default", compact = false, className, count, max, hideZero = false, "data-testid": dataTestId, style, ref, }) => {
|
|
1297
1297
|
if (hideZero && count === 0) {
|
|
1298
1298
|
return null;
|
|
1299
1299
|
}
|
|
@@ -1303,7 +1303,7 @@ const Badge = ({ color = "primary", size = "default", compact = false, className
|
|
|
1303
1303
|
: count
|
|
1304
1304
|
: count;
|
|
1305
1305
|
const isSingleChar = displayedCount?.toString().length === 1;
|
|
1306
|
-
return (jsx("span", { className: cvaBadge({ color, size, className, compact, isSingleChar }), "data-testid": dataTestId, ref: ref, children: compact ? null : displayedCount }));
|
|
1306
|
+
return (jsx("span", { className: cvaBadge({ color, size, className, compact, isSingleChar }), "data-testid": dataTestId, ref: ref, style: style, children: compact ? null : displayedCount }));
|
|
1307
1307
|
};
|
|
1308
1308
|
|
|
1309
1309
|
/**
|
|
@@ -1414,22 +1414,22 @@ const cvaBreadcrumbForMediumScreen = cvaMerge(["flex", "items-center"], {
|
|
|
1414
1414
|
/**
|
|
1415
1415
|
* BreadcrumbItem is a helper component that renders the individual breadcrumb item.
|
|
1416
1416
|
*/
|
|
1417
|
-
const BreadcrumbItem = ({ item, "data-testid": dataTestId }) => {
|
|
1417
|
+
const BreadcrumbItem = ({ item, "data-testid": dataTestId, className, style, }) => {
|
|
1418
1418
|
const id = uuidv4();
|
|
1419
|
-
return (jsx("div", { className: cvaBreadcrumbItem(), "data-testid": dataTestId, id: `${item.props.label}-${id}`, children: item }));
|
|
1419
|
+
return (jsx("div", { className: cvaBreadcrumbItem({ className }), "data-testid": dataTestId, id: `${item.props.label}-${id}`, style: style, children: item }));
|
|
1420
1420
|
};
|
|
1421
1421
|
|
|
1422
1422
|
/**
|
|
1423
1423
|
* BreadcrumbForLargeScreen is a helper component that renders the breadcrumb items for large screens.
|
|
1424
1424
|
*/
|
|
1425
|
-
const BreadcrumbForLargeScreen = ({ "data-testid": dataTestId, breadcrumbItems, }) => {
|
|
1426
|
-
return (jsx("div", { className: cvaBreadcrumbForLargeScreen(), "data-testid": dataTestId, children: breadcrumbItems.map((item, index) => (jsx(BreadcrumbItem, { "data-testid": `BreadcrumbItem-${dataTestId}`, item: item }, `breadcrumbItem-${index}`))) }));
|
|
1425
|
+
const BreadcrumbForLargeScreen = ({ "data-testid": dataTestId, breadcrumbItems, className, style, }) => {
|
|
1426
|
+
return (jsx("div", { className: cvaBreadcrumbForLargeScreen({ className }), "data-testid": dataTestId, style: style, children: breadcrumbItems.map((item, index) => (jsx(BreadcrumbItem, { "data-testid": `BreadcrumbItem-${dataTestId}`, item: item }, `breadcrumbItem-${index}`))) }));
|
|
1427
1427
|
};
|
|
1428
1428
|
|
|
1429
1429
|
/**
|
|
1430
1430
|
* BreadcrumbForMediumScreen is a helper component that renders the breadcrumb items for medium screens.
|
|
1431
1431
|
*/
|
|
1432
|
-
const BreadcrumbForMediumScreen = ({ "data-testid": dataTestId, breadcrumbItems, }) => {
|
|
1432
|
+
const BreadcrumbForMediumScreen = ({ "data-testid": dataTestId, breadcrumbItems, className, style, }) => {
|
|
1433
1433
|
const [expanded, setExpanded] = useState(false);
|
|
1434
1434
|
const getReducedArray = useCallback(() => {
|
|
1435
1435
|
let reducedArrayElements = [];
|
|
@@ -1442,15 +1442,15 @@ const BreadcrumbForMediumScreen = ({ "data-testid": dataTestId, breadcrumbItems,
|
|
|
1442
1442
|
return reducedArrayElements;
|
|
1443
1443
|
}, [breadcrumbItems, dataTestId]);
|
|
1444
1444
|
const reducedArray = getReducedArray();
|
|
1445
|
-
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()}`))) }));
|
|
1445
|
+
return (jsx("div", { className: cvaBreadcrumbForMediumScreen({ className, expanded }), "data-testid": dataTestId, style: style, children: (!expanded && reducedArray.length !== 0 ? reducedArray : breadcrumbItems).map(item => (jsx(BreadcrumbItem, { "data-testid": `breadcrumbItem-${dataTestId}`, item: item }, `${item.props.label}-${uuidv4()}`))) }));
|
|
1446
1446
|
};
|
|
1447
1447
|
|
|
1448
1448
|
/**
|
|
1449
1449
|
* BreadcrumbForSmallScreen is a helper component that renders the breadcrumb items for small screens.
|
|
1450
1450
|
*/
|
|
1451
|
-
const BreadcrumbForSmallScreen = ({ "data-testid": dataTestId, breadcrumbItems, }) => {
|
|
1451
|
+
const BreadcrumbForSmallScreen = ({ "data-testid": dataTestId, breadcrumbItems, className, style, }) => {
|
|
1452
1452
|
const lastBreadcrumbItem = breadcrumbItems.slice(-1);
|
|
1453
|
-
return (jsx("div", { "data-testid": dataTestId, children: lastBreadcrumbItem.map((item, index) => (jsx(BreadcrumbItem, { "data-testid": `breadcrumbItem-${dataTestId}`, item: item }, `breadcrumbItem-${index}`))) }));
|
|
1453
|
+
return (jsx("div", { className: className, "data-testid": dataTestId, style: style, children: lastBreadcrumbItem.map((item, index) => (jsx(BreadcrumbItem, { "data-testid": `breadcrumbItem-${dataTestId}`, item: item }, `breadcrumbItem-${index}`))) }));
|
|
1454
1454
|
};
|
|
1455
1455
|
|
|
1456
1456
|
/**
|
|
@@ -1502,9 +1502,9 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
|
|
|
1502
1502
|
* @param {BreadcrumbProps} props - The props for the Breadcrumb component
|
|
1503
1503
|
* @returns {ReactElement} Breadcrumb component
|
|
1504
1504
|
*/
|
|
1505
|
-
const Breadcrumb = ({ className, "data-testid": dataTestId, breadcrumbItems, onClickBack, ref, }) => {
|
|
1505
|
+
const Breadcrumb = ({ className, "data-testid": dataTestId, breadcrumbItems, onClickBack, style, ref, }) => {
|
|
1506
1506
|
const breadCrumbItemsToJSX = useBreadcrumbItemsToRender(breadcrumbItems);
|
|
1507
|
-
return (jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, ref: ref, children: [jsx(IconButton, { "data-testid": `backButton-${dataTestId}`, icon: jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick: onClickBack, size: "small", variant: "ghost-neutral" }), jsx("div", { children: jsx(BreadcrumbContainer, { breadcrumbItems: breadCrumbItemsToJSX, "data-testid": dataTestId }) })] }));
|
|
1507
|
+
return (jsxs("div", { className: cvaBreadcrumb({ className }), "data-testid": dataTestId, ref: ref, style: style, children: [jsx(IconButton, { "data-testid": `backButton-${dataTestId}`, icon: jsx(Icon, { name: "ArrowLeft", size: "small" }), onClick: onClickBack, size: "small", variant: "ghost-neutral" }), jsx("div", { children: jsx(BreadcrumbContainer, { breadcrumbItems: breadCrumbItemsToJSX, "data-testid": dataTestId }) })] }));
|
|
1508
1508
|
};
|
|
1509
1509
|
/**
|
|
1510
1510
|
* BreadcrumbContainer is a helper component that renders the breadcrumb items based on the screen size.
|
|
@@ -1731,13 +1731,13 @@ Card.displayName = "Card";
|
|
|
1731
1731
|
* @param {CardBodyProps} props - The props for the CardBody component
|
|
1732
1732
|
* @returns {ReactElement} CardBody component
|
|
1733
1733
|
*/
|
|
1734
|
-
const CardBody = ({ children, "data-testid": dataTestId, className, direction = "column", gap = "default", padding = "default", id, ref, }) => {
|
|
1734
|
+
const CardBody = ({ children, "data-testid": dataTestId, className, direction = "column", gap = "default", padding = "default", id, style, ref, }) => {
|
|
1735
1735
|
return (jsx("div", { className: cvaCardBodyContainer({
|
|
1736
1736
|
gap,
|
|
1737
1737
|
padding,
|
|
1738
1738
|
className,
|
|
1739
1739
|
direction,
|
|
1740
|
-
}), "data-card-body": true, "data-testid": dataTestId, id: id, ref: ref, children: children }));
|
|
1740
|
+
}), "data-card-body": true, "data-testid": dataTestId, id: id, ref: ref, style: style, children: children }));
|
|
1741
1741
|
};
|
|
1742
1742
|
|
|
1743
1743
|
/**
|
|
@@ -1789,12 +1789,12 @@ const CardBody = ({ children, "data-testid": dataTestId, className, direction =
|
|
|
1789
1789
|
* @param {CardFooterProps} props - The props for the CardFooter component
|
|
1790
1790
|
* @returns {ReactElement} CardFooter component
|
|
1791
1791
|
*/
|
|
1792
|
-
const CardFooter = ({ "data-testid": dataTestId, className, children, padding = "default", hideSeparator = false, ref, }) => {
|
|
1792
|
+
const CardFooter = ({ "data-testid": dataTestId, className, children, padding = "default", hideSeparator = false, style, ref, }) => {
|
|
1793
1793
|
return (jsx("div", { className: cvaCardFooterContainerRoot({
|
|
1794
1794
|
border: hideSeparator ? "borderless" : "default",
|
|
1795
1795
|
padding,
|
|
1796
1796
|
className,
|
|
1797
|
-
}), "data-card-footer": true, "data-testid": dataTestId, ref: ref, children: jsx("div", { className: cvaCardFooterContainer(), children: children }) }));
|
|
1797
|
+
}), "data-card-footer": true, "data-testid": dataTestId, ref: ref, style: style, children: jsx("div", { className: cvaCardFooterContainer(), children: children }) }));
|
|
1798
1798
|
};
|
|
1799
1799
|
|
|
1800
1800
|
const cvaHeading = cvaMerge(["m-0", "leading-normal", "text-black"], {
|
|
@@ -1917,12 +1917,12 @@ const Heading = ({ variant = "primary", inverted = false, subtle = false, classN
|
|
|
1917
1917
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
1918
1918
|
* @returns {ReactElement} CardHeader component
|
|
1919
1919
|
*/
|
|
1920
|
-
const CardHeader = ({ heading, headingVariant = "secondary", subHeading, onClickClose, "data-testid": dataTestId, className, children, accessories, actions, padding = "default", hideSeparator = false, ref, }) => {
|
|
1920
|
+
const CardHeader = ({ heading, headingVariant = "secondary", subHeading, onClickClose, "data-testid": dataTestId, className, children, accessories, actions, padding = "default", hideSeparator = false, style, ref, }) => {
|
|
1921
1921
|
return (jsx("div", { className: cvaCardHeaderContainer({
|
|
1922
1922
|
border: hideSeparator ? "borderless" : "default",
|
|
1923
1923
|
padding,
|
|
1924
1924
|
className,
|
|
1925
|
-
}), "data-card-header": true, "data-testid": dataTestId, ref: ref, children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading !== null && subHeading !== undefined ? (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxs("div", { className: "flex place-items-center gap-x-2 gap-y-1", children: [actions, onClickClose ? (jsx(IconButton, { className: "!h-min", "data-testid": "card-header-close-button", icon: jsx(Icon, { name: "XMark", size: "small" }), onClick: onClickClose, variant: "ghost-neutral" })) : null] })] }) }));
|
|
1925
|
+
}), "data-card-header": true, "data-testid": dataTestId, ref: ref, style: style, children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading !== null && subHeading !== undefined ? (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })) : null, children] }), jsxs("div", { className: "flex place-items-center gap-x-2 gap-y-1", children: [actions, onClickClose ? (jsx(IconButton, { className: "!h-min", "data-testid": "card-header-close-button", icon: jsx(Icon, { name: "XMark", size: "small" }), onClick: onClickClose, variant: "ghost-neutral" })) : null] })] }) }));
|
|
1926
1926
|
};
|
|
1927
1927
|
|
|
1928
1928
|
const cvaClickable = cvaMerge([
|
|
@@ -2193,7 +2193,7 @@ const cvaChevronIcon = cvaMerge(["transition-transform"], {
|
|
|
2193
2193
|
* @param {CollapseProps} props - The props for the Collapse component
|
|
2194
2194
|
* @returns {ReactElement} Collapse component
|
|
2195
2195
|
*/
|
|
2196
|
-
const Collapse = ({ id, variant = "primary", initialExpanded = false, onToggle, label, children, className, headerClassName, headerAddon, "data-testid": dataTestId, animate = true, extraPadding = true, ref, }) => {
|
|
2196
|
+
const Collapse = ({ id, variant = "primary", initialExpanded = false, onToggle, label, children, className, headerClassName, headerAddon, "data-testid": dataTestId, animate = true, extraPadding = true, style, ref, }) => {
|
|
2197
2197
|
const LABEL_ID = uuidv4();
|
|
2198
2198
|
const [expanded, setExpanded] = useState(initialExpanded);
|
|
2199
2199
|
const handleClick = useCallback((e) => {
|
|
@@ -2202,7 +2202,7 @@ const Collapse = ({ id, variant = "primary", initialExpanded = false, onToggle,
|
|
|
2202
2202
|
}
|
|
2203
2203
|
setExpanded(!expanded);
|
|
2204
2204
|
}, [expanded, onToggle]);
|
|
2205
|
-
return (jsxs("div", { className: cvaCollapse({ variant: variant, className }), "data-testid": dataTestId, ref: ref, children: [jsx("div", { "aria-controls": id, "aria-expanded": expanded, className: cvaCollapseHeader({ expanded, variant, extraPadding, className: headerClassName }), onClick: handleClick, role: "button", children: jsxs("div", { className: cvaCollapseLabelContainer({ variant }), children: [jsx(Text, { className: cvaCollapseLabel({ variant }), id: LABEL_ID, size: variant === "secondary" ? "small" : "medium", type: "span", weight: "bold", children: label }), jsxs("div", { className: "flex items-center gap-2", children: [headerAddon !== null && headerAddon !== undefined && variant !== "secondary" ? headerAddon : null, jsx(Icon, { ariaLabelledBy: LABEL_ID, className: cvaChevronIcon({ expanded }), name: "ChevronDown", size: variant === "secondary" ? "small" : "medium" })] })] }) }), jsx(Collapsible, { expanded: expanded, extraPadding: extraPadding, id: id, variant: variant, children: expanded || animate ? children : null })] }));
|
|
2205
|
+
return (jsxs("div", { className: cvaCollapse({ variant: variant, className }), "data-testid": dataTestId, ref: ref, style: style, children: [jsx("div", { "aria-controls": id, "aria-expanded": expanded, className: cvaCollapseHeader({ expanded, variant, extraPadding, className: headerClassName }), onClick: handleClick, role: "button", children: jsxs("div", { className: cvaCollapseLabelContainer({ variant }), children: [jsx(Text, { className: cvaCollapseLabel({ variant }), id: LABEL_ID, size: variant === "secondary" ? "small" : "medium", type: "span", weight: "bold", children: label }), jsxs("div", { className: "flex items-center gap-2", children: [headerAddon !== null && headerAddon !== undefined && variant !== "secondary" ? headerAddon : null, jsx(Icon, { ariaLabelledBy: LABEL_ID, className: cvaChevronIcon({ expanded }), name: "ChevronDown", size: variant === "secondary" ? "small" : "medium" })] })] }) }), jsx(Collapsible, { expanded: expanded, extraPadding: extraPadding, id: id, variant: variant, children: expanded || animate ? children : null })] }));
|
|
2206
2206
|
};
|
|
2207
2207
|
const Collapsible = ({ children, expanded, id, variant, extraPadding }) => {
|
|
2208
2208
|
const { geometry, ref } = useMeasure();
|
|
@@ -2555,9 +2555,20 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
2555
2555
|
customProps: {
|
|
2556
2556
|
id,
|
|
2557
2557
|
className,
|
|
2558
|
-
"data-testid": dataTestId
|
|
2558
|
+
"data-testid": dataTestId,
|
|
2559
2559
|
},
|
|
2560
|
-
}), [
|
|
2560
|
+
}), [
|
|
2561
|
+
isOpen,
|
|
2562
|
+
setUncontrolledIsOpen,
|
|
2563
|
+
combinedInteractions,
|
|
2564
|
+
popoverData,
|
|
2565
|
+
isModal,
|
|
2566
|
+
labelId,
|
|
2567
|
+
descriptionId,
|
|
2568
|
+
id,
|
|
2569
|
+
className,
|
|
2570
|
+
dataTestId,
|
|
2571
|
+
]);
|
|
2561
2572
|
};
|
|
2562
2573
|
|
|
2563
2574
|
const PopoverContext = createContext(null);
|
|
@@ -2995,7 +3006,7 @@ const Content = ({ text, withIcon, }) => {
|
|
|
2995
3006
|
* @param {CopyableTextProps} props - The props for the CopyableText component
|
|
2996
3007
|
* @returns {ReactElement} CopyableText component
|
|
2997
3008
|
*/
|
|
2998
|
-
const CopyableText = ({ text, withIcon = true, size = "sm", copyLabel = "Copy", copiedLabel = "Copied!", "data-testid": dataTestId, className, ref, }) => {
|
|
3009
|
+
const CopyableText = ({ text, withIcon = true, size = "sm", copyLabel = "Copy", copiedLabel = "Copied!", "data-testid": dataTestId, className, style, ref, }) => {
|
|
2999
3010
|
const [animating, setAnimating] = useState(false);
|
|
3000
3011
|
const [showCopied, setShowCopied] = useState(false);
|
|
3001
3012
|
const [, copyToClipboard] = useCopyToClipboard();
|
|
@@ -3020,7 +3031,7 @@ const CopyableText = ({ text, withIcon = true, size = "sm", copyLabel = "Copy",
|
|
|
3020
3031
|
if (hovering) {
|
|
3021
3032
|
e.currentTarget.blur();
|
|
3022
3033
|
}
|
|
3023
|
-
}, onMouseEnter: onMouseEnter, onMouseLeave: handleMouseLeave, ref: ref, type: "button", children: jsx(Content, { text: text, withIcon: withIcon }) }) }));
|
|
3034
|
+
}, onMouseEnter: onMouseEnter, onMouseLeave: handleMouseLeave, ref: ref, style: style, type: "button", children: jsx(Content, { text: text, withIcon: withIcon }) }) }));
|
|
3024
3035
|
};
|
|
3025
3036
|
|
|
3026
3037
|
const cvaDetailsList = cvaMerge(["flex", "w-full", "min-w-0", "items-center", "truncate", "text-xs", "text-neutral-600", "font-medium", "pt-0"], {
|
|
@@ -3066,10 +3077,26 @@ const cvaDetailsListItem = cvaMerge(["last:truncate"]);
|
|
|
3066
3077
|
* @param {DetailsListProps} props - The props for the DetailsList component
|
|
3067
3078
|
* @returns {ReactElement} DetailsList component
|
|
3068
3079
|
*/
|
|
3069
|
-
const DetailsList = ({ details, className, hasLink = false, ref }) => {
|
|
3070
|
-
return (jsx("div", { className: cvaDetailsList({ className, hasLink }), ref: ref, children: details.map((value, index, array) => (jsxs(Fragment$1, { children: [jsx("span", { className: cvaDetailsListItem({ className }), children: value }), index < array.length - 1 && (jsx("div", { className: "mx-0.5 flex items-center", children: jsx(Icon, { className: "w-4 text-neutral-300", color: "neutral", name: "Slash", size: "small" }) }))] }, index))) }));
|
|
3080
|
+
const DetailsList = ({ details, className, "data-testid": dataTestId, hasLink = false, style, ref, }) => {
|
|
3081
|
+
return (jsx("div", { className: cvaDetailsList({ className, hasLink }), "data-testid": dataTestId, ref: ref, style: style, children: details.map((value, index, array) => (jsxs(Fragment$1, { children: [jsx("span", { className: cvaDetailsListItem({ className }), children: value }), index < array.length - 1 && (jsx("div", { className: "mx-0.5 flex items-center", children: jsx(Icon, { className: "w-4 text-neutral-300", color: "neutral", name: "Slash", size: "small" }) }))] }, index))) }));
|
|
3071
3082
|
};
|
|
3072
3083
|
|
|
3084
|
+
/**
|
|
3085
|
+
* Merges inline styles where `base` defines component defaults and `override` (typically from props) wins on conflicts.
|
|
3086
|
+
*/
|
|
3087
|
+
function mergeDomStyles(base, override) {
|
|
3088
|
+
if (base === undefined && override === undefined) {
|
|
3089
|
+
return undefined;
|
|
3090
|
+
}
|
|
3091
|
+
if (base === undefined) {
|
|
3092
|
+
return override;
|
|
3093
|
+
}
|
|
3094
|
+
if (override === undefined) {
|
|
3095
|
+
return base;
|
|
3096
|
+
}
|
|
3097
|
+
return { ...base, ...override };
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3073
3100
|
const VALID_SIZE_KEYS = [
|
|
3074
3101
|
"xs",
|
|
3075
3102
|
"sm",
|
|
@@ -3225,14 +3252,14 @@ const cvaSkeleton = cvaMerge([
|
|
|
3225
3252
|
* @returns {ReactElement} SkeletonLabel component
|
|
3226
3253
|
*/
|
|
3227
3254
|
const SkeletonLabel = memo((props) => {
|
|
3228
|
-
const { width = "100%", textSize = "text-base", flexibleWidth = true, className, "data-testid": dataTestId, children, ref, } = props;
|
|
3255
|
+
const { width = "100%", textSize = "text-base", flexibleWidth = true, className, "data-testid": dataTestId, children, style, ref, } = props;
|
|
3229
3256
|
const widthValue = typeof width === "number" ? `${width}px` : width;
|
|
3230
3257
|
const heightValue = getHeightValue(textSize);
|
|
3231
|
-
return (jsx("div", { "aria-label": "Loading", className: cvaSkeleton({ textSize, className }), "data-testid": dataTestId, ref: ref, role: "status", style: {
|
|
3258
|
+
return (jsx("div", { "aria-label": "Loading", className: cvaSkeleton({ textSize, className }), "data-testid": dataTestId, ref: ref, role: "status", style: mergeDomStyles({
|
|
3232
3259
|
width: flexibleWidth ? "100%" : widthValue,
|
|
3233
3260
|
maxWidth: flexibleWidth ? widthValue : undefined,
|
|
3234
3261
|
height: heightValue,
|
|
3235
|
-
}, children: children }));
|
|
3262
|
+
}, style), children: children }));
|
|
3236
3263
|
});
|
|
3237
3264
|
SkeletonLabel.displayName = "SkeletonLabel";
|
|
3238
3265
|
|
|
@@ -3348,7 +3375,7 @@ WorkerWithSignSVG.displayName = "WorkerWithSignSVG";
|
|
|
3348
3375
|
* );
|
|
3349
3376
|
* ```
|
|
3350
3377
|
*/
|
|
3351
|
-
const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc, loading = false, "data-testid": dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, }) => {
|
|
3378
|
+
const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customImageSrc, loading = false, "data-testid": dataTestId, className, primaryAction, secondaryAction, additionalHelpAction, style, ref, }) => {
|
|
3352
3379
|
const ImageSource = useMemo(() => {
|
|
3353
3380
|
switch (image) {
|
|
3354
3381
|
case "WORKER_WITH_SIGN":
|
|
@@ -3366,7 +3393,7 @@ const EmptyState = ({ description, altText, image = "SEARCH_DOCUMENT", customIma
|
|
|
3366
3393
|
return SearchDocumentSVG;
|
|
3367
3394
|
}
|
|
3368
3395
|
}, [image]);
|
|
3369
|
-
return (jsx("div", { className: cvaContainerStyles({ className }), "data-testid": dataTestId ?? "empty-state", children: loading ? (jsxs("div", { className: "flex w-full flex-col items-center gap-4", children: [jsx(Spinner, { centering: "centered", "data-testid": "spinner" }), jsx(SkeletonLabel, { textSize: "text-base", width: "clamp(20%, 200px, 80%)" })] })) : (jsxs(Fragment, { children: [customImageSrc !== null && customImageSrc !== undefined ? (typeof customImageSrc === "string" ? (jsx("img", { alt: altText, className: cvaImgStyles(), height: 200, src: customImageSrc, width: 200 })) : (customImageSrc)) : (typeof ImageSource !== "undefined" && (jsx(ImageSource, { "data-testid": "empty-state-image", height: 200, width: 200 }, image))), description !== undefined && description !== "" ? (jsx(Text, { align: "center", size: "medium", children: description })) : null, jsxs("div", { className: "mt-4 grid gap-3", children: [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] })] })) }));
|
|
3396
|
+
return (jsx("div", { className: cvaContainerStyles({ className }), "data-testid": dataTestId ?? "empty-state", ref: ref, style: style, children: loading ? (jsxs("div", { className: "flex w-full flex-col items-center gap-4", children: [jsx(Spinner, { centering: "centered", "data-testid": "spinner" }), jsx(SkeletonLabel, { textSize: "text-base", width: "clamp(20%, 200px, 80%)" })] })) : (jsxs(Fragment, { children: [customImageSrc !== null && customImageSrc !== undefined ? (typeof customImageSrc === "string" ? (jsx("img", { alt: altText, className: cvaImgStyles(), height: 200, src: customImageSrc, width: 200 })) : (customImageSrc)) : (typeof ImageSource !== "undefined" && (jsx(ImageSource, { "data-testid": "empty-state-image", height: 200, width: 200 }, image))), description !== undefined && description !== "" ? (jsx(Text, { align: "center", size: "medium", children: description })) : null, jsxs("div", { className: "mt-4 grid gap-3", children: [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] })] })) }));
|
|
3370
3397
|
};
|
|
3371
3398
|
|
|
3372
3399
|
const cvaEmptyValue = cvaMerge(["text-neutral-400"]);
|
|
@@ -3395,8 +3422,8 @@ const cvaEmptyValue = cvaMerge(["text-neutral-400"]);
|
|
|
3395
3422
|
* @param {EmptyValueProps} props - The props for the EmptyValue component
|
|
3396
3423
|
* @returns {ReactElement} EmptyValue component
|
|
3397
3424
|
*/
|
|
3398
|
-
const EmptyValue = ({ className, "data-testid": dataTestId }) => {
|
|
3399
|
-
return (jsx("div", { className: cvaEmptyValue({ className }), "data-testid": dataTestId, children: "-" }));
|
|
3425
|
+
const EmptyValue = ({ className, "data-testid": dataTestId, style, ref }) => {
|
|
3426
|
+
return (jsx("div", { className: cvaEmptyValue({ className }), "data-testid": dataTestId, ref: ref, style: style, children: "-" }));
|
|
3400
3427
|
};
|
|
3401
3428
|
|
|
3402
3429
|
const cvaExternalLink = cvaMerge(["underline", "decoration-[1.5px]", "underline-offset-2", "text-sm"], {
|
|
@@ -3467,8 +3494,8 @@ const cvaExternalLink = cvaMerge(["underline", "decoration-[1.5px]", "underline-
|
|
|
3467
3494
|
* @param {ExternalLinkProps} props - The props for the ExternalLink component
|
|
3468
3495
|
* @returns {ReactElement} ExternalLink component
|
|
3469
3496
|
*/
|
|
3470
|
-
const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, "data-testid": dataTestId, onClick, color = "primary", ref, }) => {
|
|
3471
|
-
return (jsx("a", { className: cvaExternalLink({ className, color }), "data-testid": dataTestId, href: href, onClick: onClick, ref: ref, rel: rel, target: target, title: title, children: children }));
|
|
3497
|
+
const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, "data-testid": dataTestId, onClick, color = "primary", style, ref, }) => {
|
|
3498
|
+
return (jsx("a", { className: cvaExternalLink({ className, color }), "data-testid": dataTestId, href: href, onClick: onClick, ref: ref, rel: rel, style: style, target: target, title: title, children: children }));
|
|
3472
3499
|
};
|
|
3473
3500
|
|
|
3474
3501
|
// =============================================================================
|
|
@@ -3611,9 +3638,9 @@ function createGrid() {
|
|
|
3611
3638
|
* }
|
|
3612
3639
|
* ```
|
|
3613
3640
|
*/
|
|
3614
|
-
function GridAreas({ slots, css, containerProps, validationRef, className, children, asChild = false, }) {
|
|
3641
|
+
function GridAreas({ slots, css, containerProps, validationRef, className, style, children, asChild = false, }) {
|
|
3615
3642
|
const Comp = asChild ? Slot : "div";
|
|
3616
|
-
return (jsxs(Fragment, { children: [jsx("style", { children: css }), jsx(Comp, { ref: validationRef, ...containerProps, className: twMerge("@container grid", className), children: children(slots) })] }));
|
|
3643
|
+
return (jsxs(Fragment, { children: [jsx("style", { children: css }), jsx(Comp, { ref: validationRef, ...containerProps, className: twMerge("@container grid", className), style: style, children: children(slots) })] }));
|
|
3617
3644
|
}
|
|
3618
3645
|
|
|
3619
3646
|
/**
|
|
@@ -4292,8 +4319,8 @@ const cvaHighlightText = cvaMerge(["truncate"]);
|
|
|
4292
4319
|
* @param {HighlightProps} props - The props for the Highlight component
|
|
4293
4320
|
* @returns {ReactElement} Highlight component
|
|
4294
4321
|
*/
|
|
4295
|
-
const Highlight = ({ className, "data-testid": dataTestId, children, size = "small", color = "warning", ref, }) => {
|
|
4296
|
-
return (jsx("div", { className: cvaHighlight({ className, size, color }), "data-testid": dataTestId, ref: ref, children: jsx("span", { className: cvaHighlightText(), children: children }) }));
|
|
4322
|
+
const Highlight = ({ className, "data-testid": dataTestId, children, size = "small", color = "warning", style, ref, }) => {
|
|
4323
|
+
return (jsx("div", { className: cvaHighlight({ className, size, color }), "data-testid": dataTestId, ref: ref, style: style, children: jsx("span", { className: cvaHighlightText(), children: children }) }));
|
|
4297
4324
|
};
|
|
4298
4325
|
Highlight.displayName = "Highlight";
|
|
4299
4326
|
|
|
@@ -4577,8 +4604,8 @@ const cvaZStackItem = cvaMerge(["col-start-1", "col-end-1", "row-start-1", "row-
|
|
|
4577
4604
|
* @param {ZStackProps} props - The props for the ZStack component
|
|
4578
4605
|
* @returns {ReactElement} ZStack component
|
|
4579
4606
|
*/
|
|
4580
|
-
const ZStack = ({ children, className, "data-testid": dataTestId, ref }) => {
|
|
4581
|
-
return (jsx("div", { className: cvaZStackContainer({ className }), "data-testid": dataTestId, ref: ref, children: Children.map(children, (child, index) => {
|
|
4607
|
+
const ZStack = ({ children, className, "data-testid": dataTestId, style, ref }) => {
|
|
4608
|
+
return (jsx("div", { className: cvaZStackContainer({ className }), "data-testid": dataTestId, ref: ref, style: style, children: Children.map(children, (child, index) => {
|
|
4582
4609
|
if (!isValidElement(child)) {
|
|
4583
4610
|
return child;
|
|
4584
4611
|
}
|
|
@@ -4646,9 +4673,9 @@ const cvaOverflowIndicatorButton = cvaMerge([
|
|
|
4646
4673
|
* @param {OverflowIndicatorProps} props - The props for the component
|
|
4647
4674
|
* @returns {ReactElement} OverflowIndicator component
|
|
4648
4675
|
*/
|
|
4649
|
-
const OverflowIndicator = ({ className, "data-testid": dataTestId, direction, onClickScroll, }) => {
|
|
4676
|
+
const OverflowIndicator = ({ className, "data-testid": dataTestId, direction, onClickScroll, style, }) => {
|
|
4650
4677
|
const iconName = direction === "left" ? "ChevronLeft" : "ChevronRight";
|
|
4651
|
-
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" }) })] }));
|
|
4678
|
+
return (jsxs(ZStack, { className: cvaOverflowIndicatorContainer({ className }), "data-testid": dataTestId, style: style, 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" }) })] }));
|
|
4652
4679
|
};
|
|
4653
4680
|
|
|
4654
4681
|
/**
|
|
@@ -4678,7 +4705,7 @@ const OverflowIndicator = ({ className, "data-testid": dataTestId, direction, on
|
|
|
4678
4705
|
* @param {HorizontalOverflowScrollerProps} props - The props for the HorizontalOverflowScroller component
|
|
4679
4706
|
* @returns {ReactElement} HorizontalOverflowScroller component
|
|
4680
4707
|
*/
|
|
4681
|
-
const HorizontalOverflowScroller = ({ className, "data-testid": dataTestId, children, onScrollStateChange, ref, }) => {
|
|
4708
|
+
const HorizontalOverflowScroller = ({ className, "data-testid": dataTestId, children, onScrollStateChange, style, ref, }) => {
|
|
4682
4709
|
const childrenArray = Children.toArray(children);
|
|
4683
4710
|
const { geometry: containerGeometry, ref: measureRef, element } = useMeasure();
|
|
4684
4711
|
const { ref: scrollRef, isScrollable, isAtBeginning, isAtEnd, } = useScrollDetection({
|
|
@@ -4708,7 +4735,7 @@ const HorizontalOverflowScroller = ({ className, "data-testid": dataTestId, chil
|
|
|
4708
4735
|
behavior: "smooth",
|
|
4709
4736
|
});
|
|
4710
4737
|
};
|
|
4711
|
-
return (jsxs(ZStack, { className: cvaHorizontalOverflowScrollerAndIndicatorsContainer({ className }), children: [jsx("div", { className: cvaHorizontalOverflowScroller(), "data-testid": dataTestId, ref: mergedRef, children: childrenArray.map((child, index) => (jsx(Fragment$1, { 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] }));
|
|
4738
|
+
return (jsxs(ZStack, { className: cvaHorizontalOverflowScrollerAndIndicatorsContainer({ className }), style: style, children: [jsx("div", { className: cvaHorizontalOverflowScroller(), "data-testid": dataTestId, ref: mergedRef, children: childrenArray.map((child, index) => (jsx(Fragment$1, { 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] }));
|
|
4712
4739
|
};
|
|
4713
4740
|
|
|
4714
4741
|
const cvaIndicator = cvaMerge(["inline-flex", "items-center"]);
|
|
@@ -5042,8 +5069,8 @@ const KPISkeleton = ({ variant = "default", className, "data-testid": dataTestId
|
|
|
5042
5069
|
* @param {TrendIndicatorProps} props - The props for the TrendIndicator component
|
|
5043
5070
|
* @returns {ReactElement} TrendIndicator component
|
|
5044
5071
|
*/
|
|
5045
|
-
const TrendIndicator = ({ value, trend, label, icon = undefined, color = undefined, "data-testid": dataTestId, className, ref, }) => {
|
|
5046
|
-
return (jsxs("div", { className: twMerge("flex flex-row items-center gap-1", className), "data-testid": dataTestId, ref: ref, children: [value !== undefined ? (jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-value` : undefined, size: "small", weight: "normal", children: value })) : null, jsxs("div", { className: "flex items-center", children: [icon ? (jsx(Icon, { color: color, "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: icon, size: "small" })) : null, jsx(Text, { className: cvaKPITrendPercentage({ color }), "data-testid": dataTestId ? `${dataTestId}-trend` : undefined, size: "small", weight: "bold", children: trend })] }), jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-label` : undefined, size: "small", weight: "normal", children: label })] }));
|
|
5072
|
+
const TrendIndicator = ({ value, trend, label, icon = undefined, color = undefined, "data-testid": dataTestId, className, style, ref, }) => {
|
|
5073
|
+
return (jsxs("div", { className: twMerge("flex flex-row items-center gap-1", className), "data-testid": dataTestId, ref: ref, style: style, children: [value !== undefined ? (jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-value` : undefined, size: "small", weight: "normal", children: value })) : null, jsxs("div", { className: "flex items-center", children: [icon ? (jsx(Icon, { color: color, "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: icon, size: "small" })) : null, jsx(Text, { className: cvaKPITrendPercentage({ color }), "data-testid": dataTestId ? `${dataTestId}-trend` : undefined, size: "small", weight: "bold", children: trend })] }), jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-label` : undefined, size: "small", weight: "normal", children: label })] }));
|
|
5047
5074
|
};
|
|
5048
5075
|
|
|
5049
5076
|
/**
|
|
@@ -5052,8 +5079,8 @@ const TrendIndicator = ({ value, trend, label, icon = undefined, color = undefin
|
|
|
5052
5079
|
* @param {TrendIndicatorsProps} props - The props for the TrendIndicators component
|
|
5053
5080
|
* @returns {ReactElement} TrendIndicators component
|
|
5054
5081
|
*/
|
|
5055
|
-
const TrendIndicators = ({ trends, "data-testid": dataTestId, className, ref, }) => {
|
|
5056
|
-
return (jsx("span", { className: twMerge("flex flex-row items-center gap-1", className), "data-testid": dataTestId, ref: ref, children: trends.map((trend, index) => (jsx(TrendIndicator, { "data-testid": dataTestId ? `${dataTestId}-trend-indicator-${index}` : undefined, ...trend }, index))) }));
|
|
5082
|
+
const TrendIndicators = ({ trends, "data-testid": dataTestId, className, style, ref, }) => {
|
|
5083
|
+
return (jsx("span", { className: twMerge("flex flex-row items-center gap-1", className), "data-testid": dataTestId, ref: ref, style: style, children: trends.map((trend, index) => (jsx(TrendIndicator, { "data-testid": dataTestId ? `${dataTestId}-trend-indicator-${index}` : undefined, ...trend }, index))) }));
|
|
5057
5084
|
};
|
|
5058
5085
|
|
|
5059
5086
|
const valueBarContainerClassName = "relative flex w-full items-center gap-2";
|
|
@@ -5200,11 +5227,11 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
|
5200
5227
|
* @param {ValueBarProps} props - The props for the ValueBar component
|
|
5201
5228
|
* @returns {ReactElement} ValueBar component
|
|
5202
5229
|
*/
|
|
5203
|
-
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue = false, className, "data-testid": dataTestId, zeroScoreAllowed = false, ref, }) => {
|
|
5230
|
+
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue = false, className, "data-testid": dataTestId, zeroScoreAllowed = false, style, ref, }) => {
|
|
5204
5231
|
const score = getScore(value, min, max, zeroScoreAllowed);
|
|
5205
5232
|
const barFillColor = levelColors ? getFillColor(score, levelColors) : getDefaultFillColor(score);
|
|
5206
5233
|
const valueText = `${Number(value.toFixed(1))}${nonNullable(unit) ? unit : ""}`;
|
|
5207
|
-
return (jsxs("span", { className: valueBarContainerClassName, "data-testid": dataTestId, ref: ref, 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] }));
|
|
5234
|
+
return (jsxs("span", { className: valueBarContainerClassName, "data-testid": dataTestId, ref: ref, style: style, 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] }));
|
|
5208
5235
|
};
|
|
5209
5236
|
|
|
5210
5237
|
const cvaKPICard = cvaMerge([
|
|
@@ -5328,14 +5355,14 @@ const KPICard = ({ isActive = false, onClick, className, "data-testid": dataTest
|
|
|
5328
5355
|
* @returns {ReactElement} SkeletonBlock component
|
|
5329
5356
|
*/
|
|
5330
5357
|
const SkeletonBlock = memo((props) => {
|
|
5331
|
-
const { width = "100%", height = 16, flexibleWidth = false, className, "data-testid": dataTestId, children, ref, } = props;
|
|
5358
|
+
const { width = "100%", height = 16, flexibleWidth = false, className, "data-testid": dataTestId, children, style, ref, } = props;
|
|
5332
5359
|
const widthValue = typeof width === "number" ? `${width}px` : width;
|
|
5333
5360
|
const heightValue = typeof height === "number" ? `${height}px` : height;
|
|
5334
|
-
return (jsx("div", { "aria-label": "Loading", className: cvaSkeleton({ className }), "data-testid": dataTestId, ref: ref, role: "status", style: {
|
|
5361
|
+
return (jsx("div", { "aria-label": "Loading", className: cvaSkeleton({ className }), "data-testid": dataTestId, ref: ref, role: "status", style: mergeDomStyles({
|
|
5335
5362
|
width: flexibleWidth ? "100%" : widthValue,
|
|
5336
5363
|
maxWidth: flexibleWidth ? widthValue : undefined,
|
|
5337
5364
|
height: heightValue,
|
|
5338
|
-
}, children: children }));
|
|
5365
|
+
}, style), children: children }));
|
|
5339
5366
|
});
|
|
5340
5367
|
SkeletonBlock.displayName = "SkeletonBlock";
|
|
5341
5368
|
|
|
@@ -5467,29 +5494,29 @@ const DEFAULT_SKELETON_LIST_ITEM_PROPS = {
|
|
|
5467
5494
|
* @param {ListItemSkeletonProps} props - The props for the ListItemSkeleton component
|
|
5468
5495
|
* @returns {ReactElement} ListItemSkeleton component
|
|
5469
5496
|
*/
|
|
5470
|
-
const ListItemSkeleton = ({ hasThumbnail = DEFAULT_SKELETON_LIST_ITEM_PROPS.hasThumbnail, thumbnailShape = "circle", hasDescription = DEFAULT_SKELETON_LIST_ITEM_PROPS.hasDescription, hasMeta = DEFAULT_SKELETON_LIST_ITEM_PROPS.hasMeta, hasDetails = DEFAULT_SKELETON_LIST_ITEM_PROPS.hasDetails, }) => {
|
|
5497
|
+
const ListItemSkeleton = ({ hasThumbnail = DEFAULT_SKELETON_LIST_ITEM_PROPS.hasThumbnail, thumbnailShape = "circle", hasDescription = DEFAULT_SKELETON_LIST_ITEM_PROPS.hasDescription, hasMeta = DEFAULT_SKELETON_LIST_ITEM_PROPS.hasMeta, hasDetails = DEFAULT_SKELETON_LIST_ITEM_PROPS.hasDetails, className, "data-testid": dataTestId, style, }) => {
|
|
5471
5498
|
// Generate stable random widths once and never change them
|
|
5472
5499
|
const [titleWidth, descriptionWidth, metaWidth, detailsWidth] = useRandomCSSLengths({
|
|
5473
5500
|
count: 4,
|
|
5474
5501
|
min: 25,
|
|
5475
5502
|
max: 85,
|
|
5476
5503
|
});
|
|
5477
|
-
return (jsxs("div", { className: cvaListItem({ className: "w-full" }), children: [jsxs("div", { className: cvaMainInformationClass({ hasThumbnail, className: "w-full" }), children: [hasThumbnail ? (jsx("div", { className: cvaThumbnailContainer({ className: "bg-gray-200" }), children: jsx("div", { className: twMerge("bg-neutral-300", thumbnailShape === "circle" ? "rounded-full" : "rounded"), style: { width: 20, height: 20 } }) })) : null, jsxs("div", { className: cvaTextContainer(), children: [jsx("div", { className: cvaTitleRow(), children: jsx(SkeletonLabel, { textSize: "text-sm", width: titleWidth }) }), hasDescription ? (jsx("div", { className: cvaDescriptionRow(), children: jsx(SkeletonLabel, { textSize: "text-xs", width: descriptionWidth }) })) : null, hasMeta ? (jsx("div", { className: cvaMetaRow(), children: jsx(SkeletonLabel, { textSize: "text-xs", width: metaWidth }) })) : null] })] }), hasDetails ? (jsx("div", { className: cvaDetailsContainer(), children: jsx(SkeletonLabel, { textSize: "text-sm", width: detailsWidth }) })) : null] }));
|
|
5504
|
+
return (jsxs("div", { className: cvaListItem({ className: twMerge("w-full", className) }), "data-testid": dataTestId, style: style, children: [jsxs("div", { className: cvaMainInformationClass({ hasThumbnail, className: "w-full" }), children: [hasThumbnail ? (jsx("div", { className: cvaThumbnailContainer({ className: "bg-gray-200" }), children: jsx("div", { className: twMerge("bg-neutral-300", thumbnailShape === "circle" ? "rounded-full" : "rounded"), style: { width: 20, height: 20 } }) })) : null, jsxs("div", { className: cvaTextContainer(), children: [jsx("div", { className: cvaTitleRow(), children: jsx(SkeletonLabel, { textSize: "text-sm", width: titleWidth }) }), hasDescription ? (jsx("div", { className: cvaDescriptionRow(), children: jsx(SkeletonLabel, { textSize: "text-xs", width: descriptionWidth }) })) : null, hasMeta ? (jsx("div", { className: cvaMetaRow(), children: jsx(SkeletonLabel, { textSize: "text-xs", width: metaWidth }) })) : null] })] }), hasDetails ? (jsx("div", { className: cvaDetailsContainer(), children: jsx(SkeletonLabel, { textSize: "text-sm", width: detailsWidth }) })) : null] }));
|
|
5478
5505
|
};
|
|
5479
5506
|
|
|
5480
5507
|
/**
|
|
5481
5508
|
*
|
|
5482
5509
|
*/
|
|
5483
|
-
const ListLoadingIndicator = ({ type, hasThumbnail, thumbnailShape, hasDescription, component, hasMeta, hasDetails, }) => {
|
|
5510
|
+
const ListLoadingIndicator = ({ type, hasThumbnail, thumbnailShape, hasDescription, component, hasMeta, hasDetails, style, }) => {
|
|
5484
5511
|
switch (type) {
|
|
5485
5512
|
case "none":
|
|
5486
5513
|
return null;
|
|
5487
5514
|
case "spinner":
|
|
5488
|
-
return jsx(Spinner, { centering: "horizontally", containerClassName: "p-4" });
|
|
5515
|
+
return jsx(Spinner, { centering: "horizontally", containerClassName: "p-4", style: style });
|
|
5489
5516
|
case "custom":
|
|
5490
|
-
return component;
|
|
5517
|
+
return (jsx("div", { className: "flex w-full justify-center p-4", style: style, children: component }));
|
|
5491
5518
|
case "skeleton":
|
|
5492
|
-
return (jsx(ListItemSkeleton, { hasDescription: hasDescription, hasDetails: hasDetails, hasMeta: hasMeta, hasThumbnail: hasThumbnail, thumbnailShape: thumbnailShape }));
|
|
5519
|
+
return (jsx(ListItemSkeleton, { hasDescription: hasDescription, hasDetails: hasDetails, hasMeta: hasMeta, hasThumbnail: hasThumbnail, style: style, thumbnailShape: thumbnailShape }));
|
|
5493
5520
|
default: {
|
|
5494
5521
|
throw new Error(`${type} is not known`);
|
|
5495
5522
|
}
|
|
@@ -5563,7 +5590,7 @@ const ListLoadingIndicator = ({ type, hasThumbnail, thumbnailShape, hasDescripti
|
|
|
5563
5590
|
* );
|
|
5564
5591
|
* ```
|
|
5565
5592
|
*/
|
|
5566
|
-
const List = ({ children, className, "data-testid": dataTestId,
|
|
5593
|
+
const List = ({ children, className, "data-testid": dataTestId, style,
|
|
5567
5594
|
// UseListResult properties
|
|
5568
5595
|
containerRef, listRef, rows, getListItemProps, header, loadingIndicator, shouldShowLoaderAtIndex, count, isScrolling, separator, topSeparatorOnScroll, isAtTop, contentFillsContainer,
|
|
5569
5596
|
// Unused but part of UseListResult interface (can be used from parent)
|
|
@@ -5571,7 +5598,7 @@ scrollOffset: _scrollOffset, getTotalSize: _getTotalSize, getVirtualItems: _getV
|
|
|
5571
5598
|
return (jsx("div", { className: cvaListContainer({
|
|
5572
5599
|
withTopSeparator: topSeparatorOnScroll && !isAtTop,
|
|
5573
5600
|
className,
|
|
5574
|
-
}), "data-is-scrolling": isScrolling, "data-testid": dataTestId, ref: containerRef, children: jsx("ul", { className: cvaList(), ref: listRef, children: rows.map(row => {
|
|
5601
|
+
}), "data-is-scrolling": isScrolling, "data-testid": dataTestId, ref: containerRef, style: style, children: jsx("ul", { className: cvaList(), ref: listRef, children: rows.map(row => {
|
|
5575
5602
|
// Generate list item props with clean separator styling
|
|
5576
5603
|
const listItemProps = getListItemProps(row, {
|
|
5577
5604
|
className: cvaListItem$1({
|
|
@@ -6113,8 +6140,8 @@ const cvaMenuListItem = cvaMerge("max-w-full");
|
|
|
6113
6140
|
* ```
|
|
6114
6141
|
* @returns {ReactElement} MenuDivider component
|
|
6115
6142
|
*/
|
|
6116
|
-
const MenuDivider = () => {
|
|
6117
|
-
return jsx("div", { className: cvaMenuListDivider(), "data-testid": "menu-divider" });
|
|
6143
|
+
const MenuDivider = ({ style }) => {
|
|
6144
|
+
return jsx("div", { className: cvaMenuListDivider(), "data-testid": "menu-divider", style: style });
|
|
6118
6145
|
};
|
|
6119
6146
|
|
|
6120
6147
|
/**
|
|
@@ -6271,7 +6298,7 @@ const cvaMenuItemSuffix = cvaMerge(["text-neutral-400", "text-sm", "flex", "item
|
|
|
6271
6298
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
6272
6299
|
* @returns {ReactElement} MenuItem component
|
|
6273
6300
|
*/
|
|
6274
|
-
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", ref, }) => {
|
|
6301
|
+
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", style, ref, }) => {
|
|
6275
6302
|
/* Handle tab navigation */
|
|
6276
6303
|
const handleKeyDown = (e) => {
|
|
6277
6304
|
if (e.key === "Enter" && onClick !== undefined && disabled !== true) {
|
|
@@ -6294,7 +6321,7 @@ const MenuItem = ({ className, "data-testid": dataTestId, label, children, selec
|
|
|
6294
6321
|
e.stopPropagation();
|
|
6295
6322
|
}
|
|
6296
6323
|
onClick?.(e);
|
|
6297
|
-
}, onKeyDown: handleKeyDown, ref: ref, role: "menuitem", tabIndex: disabled ? -1 : (tabIndex ?? 0), children: [prefix !== null && prefix !== undefined ? (jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children !== null && children !== undefined && typeof children !== "string" ? (children) : (jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [optionPrefix !== null && optionPrefix !== undefined ? optionPrefix : null, children ?? label, optionLabelDescription !== undefined && optionLabelDescription !== "" ? (jsxs("span", { className: "ml-1 text-neutral-400", children: ["(", optionLabelDescription, ")"] })) : null] })), suffix !== null && suffix !== undefined ? (jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
|
|
6324
|
+
}, onKeyDown: handleKeyDown, ref: ref, role: "menuitem", style: style, tabIndex: disabled ? -1 : (tabIndex ?? 0), children: [prefix !== null && prefix !== undefined ? (jsx("div", { className: cvaMenuItemPrefix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-prefix` : "menu-item-prefix", children: prefix })) : null, children !== null && children !== undefined && typeof children !== "string" ? (children) : (jsxs("div", { className: cvaMenuItemLabel({ variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-label` : "menu-item-label", children: [optionPrefix !== null && optionPrefix !== undefined ? optionPrefix : null, children ?? label, optionLabelDescription !== undefined && optionLabelDescription !== "" ? (jsxs("span", { className: "ml-1 text-neutral-400", children: ["(", optionLabelDescription, ")"] })) : null] })), suffix !== null && suffix !== undefined ? (jsx("div", { className: cvaMenuItemSuffix({ selected, variant, disabled }), "data-testid": dataTestId ? `${dataTestId}-suffix` : "menu-item-suffix", children: suffix })) : null] }));
|
|
6298
6325
|
};
|
|
6299
6326
|
|
|
6300
6327
|
/**
|
|
@@ -6353,7 +6380,7 @@ const MenuItem = ({ className, "data-testid": dataTestId, label, children, selec
|
|
|
6353
6380
|
* @param {MenuListProps} props - The props for the MenuList component
|
|
6354
6381
|
* @returns {ReactElement} MenuList component
|
|
6355
6382
|
*/
|
|
6356
|
-
const MenuList = ({ "data-testid": dataTestId, className, children, isMulti = false, selectedItems: controlledSelectedItems, onSelectionChange, ref, ...args }) => {
|
|
6383
|
+
const MenuList = ({ "data-testid": dataTestId, className, children, isMulti = false, selectedItems: controlledSelectedItems, onSelectionChange, style, ref, ...args }) => {
|
|
6357
6384
|
const childrenArr = Children.toArray(children);
|
|
6358
6385
|
const [internalSelectedItems, setInternalSelectedItems] = useState(controlledSelectedItems ?? []);
|
|
6359
6386
|
const selectedItems = controlledSelectedItems ?? internalSelectedItems;
|
|
@@ -6370,7 +6397,7 @@ const MenuList = ({ "data-testid": dataTestId, className, children, isMulti = fa
|
|
|
6370
6397
|
setInternalSelectedItems(newSelectedItems);
|
|
6371
6398
|
}
|
|
6372
6399
|
}, [isMulti, selectedItems, onSelectionChange]);
|
|
6373
|
-
return (jsx("div", { className: cvaMenu({ className, limitWidth: true }), "data-testid": dataTestId ? `${dataTestId}-menu-list` : "menu-list", onClick: args.onClick, ref: ref, role: "list", tabIndex: 0, children: jsx("div", { className: cvaMenuList(), children: childrenArr.map((menuItem, index) => {
|
|
6400
|
+
return (jsx("div", { className: cvaMenu({ className, limitWidth: true }), "data-testid": dataTestId ? `${dataTestId}-menu-list` : "menu-list", onClick: args.onClick, ref: ref, role: "list", style: style, tabIndex: 0, children: jsx("div", { className: cvaMenuList(), children: childrenArr.map((menuItem, index) => {
|
|
6374
6401
|
if (isValidElement(menuItem)) {
|
|
6375
6402
|
const isSelected = (selectedItems.includes(menuItem.props.id ?? `${index}`) || menuItem.props.selected) ?? false;
|
|
6376
6403
|
return cloneElement(menuItem, {
|
|
@@ -6446,10 +6473,10 @@ const MoreMenu = ({ className, "data-testid": dataTestId, popoverProps, iconProp
|
|
|
6446
6473
|
size: "medium",
|
|
6447
6474
|
square: true,
|
|
6448
6475
|
variant: "secondary",
|
|
6449
|
-
}, customButton, customPortalId, children, ref, }) => {
|
|
6476
|
+
}, customButton, customPortalId, children, style, ref, }) => {
|
|
6450
6477
|
const actionMenuRef = useRef(null);
|
|
6451
6478
|
const mergedRef = useMergeRefs([actionMenuRef, ref]);
|
|
6452
|
-
return (jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId ? dataTestId : undefined, ref: mergedRef, 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) })] }) }));
|
|
6479
|
+
return (jsx("div", { className: cvaMoreMenu({ className }), "data-testid": dataTestId ? dataTestId : undefined, ref: mergedRef, style: style, 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) })] }) }));
|
|
6453
6480
|
};
|
|
6454
6481
|
|
|
6455
6482
|
const cvaNotice = cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -6587,8 +6614,8 @@ const cvaPageContent = cvaMerge(["overflow-auto", "page-content", "grid", "gap-r
|
|
|
6587
6614
|
* @param {PageProps} props - The props for the Page component
|
|
6588
6615
|
* @returns {ReactElement} Page component
|
|
6589
6616
|
*/
|
|
6590
|
-
const Page = ({ layout, className, children, "data-testid": dataTestId, ref }) => {
|
|
6591
|
-
return (jsx("div", { className: cvaPage({ className, layout }), "data-testid": dataTestId ? dataTestId : "page", ref: ref, children: children }));
|
|
6617
|
+
const Page = ({ layout, className, children, "data-testid": dataTestId, style, ref, }) => {
|
|
6618
|
+
return (jsx("div", { className: cvaPage({ className, layout }), "data-testid": dataTestId ? dataTestId : "page", ref: ref, style: style, children: children }));
|
|
6592
6619
|
};
|
|
6593
6620
|
|
|
6594
6621
|
/**
|
|
@@ -6621,8 +6648,8 @@ const Page = ({ layout, className, children, "data-testid": dataTestId, ref }) =
|
|
|
6621
6648
|
* @param {PageContentProps} props - The props for the PageContent component
|
|
6622
6649
|
* @returns {ReactElement} PageContent component
|
|
6623
6650
|
*/
|
|
6624
|
-
const PageContent = ({ className, children, "data-testid": dataTestId, layout, ref, }) => {
|
|
6625
|
-
return (jsx("div", { className: cvaPageContent({ className, layout }), "data-testid": dataTestId ? dataTestId : "page-content", ref: ref, children: children }));
|
|
6651
|
+
const PageContent = ({ className, children, "data-testid": dataTestId, layout, style, ref, }) => {
|
|
6652
|
+
return (jsx("div", { className: cvaPageContent({ className, layout }), "data-testid": dataTestId ? dataTestId : "page-content", ref: ref, style: style, children: children }));
|
|
6626
6653
|
};
|
|
6627
6654
|
|
|
6628
6655
|
/**
|
|
@@ -6707,7 +6734,7 @@ const cvaSkeletonContainer = cvaMerge(["flex", "flex-col"]);
|
|
|
6707
6734
|
* <SkeletonLines variant="preset" preset="title-paragraph" />
|
|
6708
6735
|
*/
|
|
6709
6736
|
const SkeletonLines = memo((props) => {
|
|
6710
|
-
const { className, "data-testid": dataTestId, ref } = props;
|
|
6737
|
+
const { className, "data-testid": dataTestId, style, ref } = props;
|
|
6711
6738
|
// Generate line configs based on variant
|
|
6712
6739
|
let lineConfigs;
|
|
6713
6740
|
if (props.variant === "preset") {
|
|
@@ -6728,24 +6755,27 @@ const SkeletonLines = memo((props) => {
|
|
|
6728
6755
|
}));
|
|
6729
6756
|
}
|
|
6730
6757
|
const lineCount = lineConfigs.length;
|
|
6731
|
-
return (jsx("div", { "aria-label": `Loading ${lineCount} ${lineCount === 1 ? "item" : "items"}`, className: cvaSkeletonContainer({ className }), "data-testid": dataTestId, "data-variant": props.variant, ref: ref, role: "status", ...(props.variant === "preset" && { "data-preset": props.preset }), children: lineConfigs.map((config, index) => (jsx(SkeletonLabel, { className: config.className, "data-testid": dataTestId ? `${dataTestId}-${index}` : undefined, flexibleWidth: config.flexibleWidth ?? true, textSize: config.textSize ?? "text-base", width: config.width ?? "100%" }, index))) }));
|
|
6758
|
+
return (jsx("div", { "aria-label": `Loading ${lineCount} ${lineCount === 1 ? "item" : "items"}`, className: cvaSkeletonContainer({ className }), "data-testid": dataTestId, "data-variant": props.variant, ref: ref, role: "status", style: style, ...(props.variant === "preset" && { "data-preset": props.preset }), children: lineConfigs.map((config, index) => (jsx(SkeletonLabel, { className: config.className, "data-testid": dataTestId ? `${dataTestId}-${index}` : undefined, flexibleWidth: config.flexibleWidth ?? true, textSize: config.textSize ?? "text-base", width: config.width ?? "100%" }, index))) }));
|
|
6732
6759
|
});
|
|
6733
6760
|
SkeletonLines.displayName = "SkeletonLines";
|
|
6734
6761
|
|
|
6735
|
-
const LoadingContent = () => (jsx(
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6762
|
+
const LoadingContent = () => (jsx(SkeletonLines, { "data-testid": "kpi-card-loading-content", lines: [
|
|
6763
|
+
{ textSize: "text-xs", width: 50, flexibleWidth: false },
|
|
6764
|
+
{ textSize: "text-lg", width: 40, flexibleWidth: false },
|
|
6765
|
+
], variant: "custom" }));
|
|
6739
6766
|
/**
|
|
6740
6767
|
* Renders KPI metrics in the PageHeader component.
|
|
6741
6768
|
*
|
|
6742
6769
|
* @param {object} props - The props for the PageHeaderKpiMetrics component
|
|
6743
6770
|
* @param {Array<PageHeaderKpiMetricsType>} props.kpiMetrics - The KPI metrics to render
|
|
6771
|
+
* @param {string} [props.className] - Additional class names for the metrics row
|
|
6772
|
+
* @param {string} [props."data-testid"] - Test id for the metrics row
|
|
6773
|
+
* @param {import("react").CSSProperties} [props.style] - Inline styles for the metrics row
|
|
6744
6774
|
* @param [props.ref] - Ref forwarded to the root element
|
|
6745
6775
|
* @returns {ReactElement} PageHeaderKpiMetrics component
|
|
6746
6776
|
*/
|
|
6747
|
-
const PageHeaderKpiMetrics = ({ kpiMetrics, ref, }) => {
|
|
6748
|
-
return (jsx("div", { className: "hidden items-center gap-4 md:flex", ref: ref, children: kpiMetrics
|
|
6777
|
+
const PageHeaderKpiMetrics = ({ kpiMetrics, className, "data-testid": dataTestId, style, ref, }) => {
|
|
6778
|
+
return (jsx("div", { className: twMerge("hidden items-center gap-4 md:flex", className), "data-testid": dataTestId, ref: ref, style: style, children: kpiMetrics
|
|
6749
6779
|
.filter(kpi => kpi.hidden === false || kpi.hidden === undefined)
|
|
6750
6780
|
.map((kpi, index) => {
|
|
6751
6781
|
if (kpi.loading === true) {
|
|
@@ -6762,16 +6792,16 @@ const PageHeaderKpiMetrics = ({ kpiMetrics, ref, }) => {
|
|
|
6762
6792
|
* @returns {ReactElement} ActionRenderer component
|
|
6763
6793
|
*/
|
|
6764
6794
|
function ActionRenderer({ action, isMenuItem = false, externalOnClick }) {
|
|
6765
|
-
const { to, tooltipLabel, prefixIconName, disabled, actionText, actionCallback, "data-testid": dataTestId, target, variant, } = action;
|
|
6795
|
+
const { to, tooltipLabel, prefixIconName, disabled, actionText, actionCallback, "data-testid": dataTestId, target, style, variant, } = action;
|
|
6766
6796
|
// This component handles all the "wrapping" logic for Link/Tooltip
|
|
6767
6797
|
// The "content" is either a Button or a MenuItem, depending on `isMenuItem`
|
|
6768
6798
|
const content = isMenuItem ? (jsx(MenuItem, { "data-testid": dataTestId, disabled: disabled, label: actionText, onClick: e => {
|
|
6769
6799
|
actionCallback?.(e);
|
|
6770
6800
|
externalOnClick?.();
|
|
6771
|
-
}, prefix: prefixIconName ? jsx(Icon, { name: prefixIconName, size: "medium" }) : null, variant: variant === "secondary-danger" ? "danger" : "primary" })) : (jsx(Button, { "data-testid": dataTestId, disabled: disabled, onClick: e => {
|
|
6801
|
+
}, prefix: prefixIconName ? jsx(Icon, { name: prefixIconName, size: "medium" }) : null, style: style, variant: variant === "secondary-danger" ? "danger" : "primary" })) : (jsx(Button, { "data-testid": dataTestId, disabled: disabled, onClick: e => {
|
|
6772
6802
|
actionCallback?.(e);
|
|
6773
6803
|
externalOnClick?.();
|
|
6774
|
-
}, prefix: prefixIconName ? jsx(Icon, { name: prefixIconName, size: "small" }) : undefined, size: "small", variant: variant, children: actionText }));
|
|
6804
|
+
}, prefix: prefixIconName ? jsx(Icon, { name: prefixIconName, size: "small" }) : undefined, size: "small", style: style, variant: variant, children: actionText }));
|
|
6775
6805
|
// Wrap `content` with Tooltip
|
|
6776
6806
|
const wrappedWithTooltip = tooltipLabel ? (jsx(Tooltip, { label: tooltipLabel, children: jsx("span", { className: "block", children: content }) })) : (content);
|
|
6777
6807
|
// Finally, wrap with Link if `to` is provided
|
|
@@ -6887,12 +6917,13 @@ const cvaPageHeaderHeading = cvaMerge(["text-neutral-900", "text-xl", "font-semi
|
|
|
6887
6917
|
* @param {string} props.title - The title of the page header
|
|
6888
6918
|
* @param {string} props.className - The class name of the page header title
|
|
6889
6919
|
* @param {string} [props."data-testid"] - The data test id of the page header title
|
|
6920
|
+
* @param {import("react").CSSProperties} [props.style] - Inline styles for the title wrapper
|
|
6890
6921
|
* @param [props.ref] - Ref forwarded to the root element
|
|
6891
6922
|
* @returns {ReactElement} PageHeaderTitle component
|
|
6892
6923
|
*/
|
|
6893
|
-
const PageHeaderTitle = ({ title, "data-testid": dataTestId, className, ref: forwardedRef, }) => {
|
|
6924
|
+
const PageHeaderTitle = ({ title, "data-testid": dataTestId, className, style, ref: forwardedRef, }) => {
|
|
6894
6925
|
const { ref, isTextTruncated } = useIsTextTruncated();
|
|
6895
|
-
return (jsx("div", { className: "flex flex-row items-center", ref: forwardedRef, children: jsx(Tooltip, { disabled: !isTextTruncated, label: title, placement: "top", children: jsx("div", { className: "min-w-16 grid", children: jsx("h1", { className: cvaPageHeaderHeading({ className }), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, ref: ref, children: title }) }) }) }));
|
|
6926
|
+
return (jsx("div", { className: "flex flex-row items-center", ref: forwardedRef, style: style, children: jsx(Tooltip, { disabled: !isTextTruncated, label: title, placement: "top", children: jsx("div", { className: "min-w-16 grid", children: jsx("h1", { className: cvaPageHeaderHeading({ className }), "data-testid": dataTestId ? `${dataTestId}-heading` : undefined, ref: ref, children: title }) }) }) }));
|
|
6896
6927
|
};
|
|
6897
6928
|
|
|
6898
6929
|
/**
|
|
@@ -6948,7 +6979,7 @@ const PageHeaderTitle = ({ title, "data-testid": dataTestId, className, ref: for
|
|
|
6948
6979
|
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
6949
6980
|
* @returns {ReactElement} PageHeader component
|
|
6950
6981
|
*/
|
|
6951
|
-
const PageHeader = ({ className, "data-testid": dataTestId, showLoading = false, description, title, tagLabel, backTo, tagColor, tabsList, descriptionIcon = "QuestionMarkCircle", tagTooltipLabel, ref, ...discriminatedProps }) => {
|
|
6982
|
+
const PageHeader = ({ className, "data-testid": dataTestId, showLoading = false, description, title, tagLabel, backTo, tagColor, tabsList, descriptionIcon = "QuestionMarkCircle", tagTooltipLabel, style, ref, ...discriminatedProps }) => {
|
|
6952
6983
|
const tagRenderer = useMemo(() => {
|
|
6953
6984
|
if (tagLabel === undefined || tagLabel === "" || showLoading) {
|
|
6954
6985
|
return null;
|
|
@@ -6959,14 +6990,14 @@ const PageHeader = ({ className, "data-testid": dataTestId, showLoading = false,
|
|
|
6959
6990
|
return (jsxs("div", { className: cvaPageHeaderContainer({
|
|
6960
6991
|
className,
|
|
6961
6992
|
withBorder: tabsList === undefined,
|
|
6962
|
-
}), "data-testid": dataTestId, ref: ref, 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: {
|
|
6993
|
+
}), "data-testid": dataTestId, ref: ref, style: style, 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: {
|
|
6963
6994
|
name: descriptionIcon,
|
|
6964
6995
|
"data-testid": "page-header-description-icon",
|
|
6965
6996
|
}, 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" &&
|
|
6966
6997
|
discriminatedProps.primaryAction !== undefined &&
|
|
6967
6998
|
(discriminatedProps.primaryAction.hidden === false ||
|
|
6968
6999
|
discriminatedProps.primaryAction.hidden === undefined) ? (jsx(Tooltip, { disabled: discriminatedProps.primaryAction.tooltipLabel === undefined ||
|
|
6969
|
-
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] }));
|
|
7000
|
+
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", style: discriminatedProps.primaryAction.style, variant: discriminatedProps.primaryAction.variant, children: discriminatedProps.primaryAction.actionText }) })) : null] })] }), tabsList] }));
|
|
6970
7001
|
};
|
|
6971
7002
|
|
|
6972
7003
|
const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -7007,7 +7038,7 @@ const cvaPaginationText = cvaMerge("whitespace-nowrap");
|
|
|
7007
7038
|
* @param {PaginationProps} props - The props for the Pagination component
|
|
7008
7039
|
* @returns {ReactElement} Pagination component
|
|
7009
7040
|
*/
|
|
7010
|
-
const Pagination = ({ previousPage, nextPage, canPreviousPage = false, canNextPage = false, pageCount, pageIndex, loading = false, className, "data-testid": dataTestId, getTranslatedCount, onPageChange, cursorBase = false, ref, }) => {
|
|
7041
|
+
const Pagination = ({ previousPage, nextPage, canPreviousPage = false, canNextPage = false, pageCount, pageIndex, loading = false, className, "data-testid": dataTestId, style, getTranslatedCount, onPageChange, cursorBase = false, ref, }) => {
|
|
7011
7042
|
const [page, setPage] = useState(pageIndex);
|
|
7012
7043
|
const [currentPage, setCurrentPage] = useState(String(pageIndex !== undefined ? pageIndex + 1 : 1));
|
|
7013
7044
|
if (!loading && pageCount === undefined) {
|
|
@@ -7050,9 +7081,9 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage = false, canNextPa
|
|
|
7050
7081
|
onPageChange?.({ from, to, description });
|
|
7051
7082
|
}, [page, onPageChange, previousPage, nextPage]);
|
|
7052
7083
|
if (loading) {
|
|
7053
|
-
return (jsx("div", { className: cvaPagination({ className }), ref: ref, children: jsx(SkeletonLabel, { textSize: "text-sm", width: 150 }) }));
|
|
7084
|
+
return (jsx("div", { className: cvaPagination({ className }), ref: ref, style: style, children: jsx(SkeletonLabel, { textSize: "text-sm", width: 150 }) }));
|
|
7054
7085
|
}
|
|
7055
|
-
return (jsxs("div", { className: cvaPagination({ className }), "data-testid": dataTestId, ref: ref, children: [jsx(IconButton, { "data-testid": "prev-page", disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, icon: jsx(Icon, { name: "ChevronLeft", size: "small" }), onClick: () => handlePageChange("prev"), size: "small", variant: "ghost-neutral" }), !cursorBase && (jsxs(Fragment, { children: [jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount ? getTranslatedCount(pageCount) : null })] })), jsx(IconButton, { "data-testid": "next-page", disabled: cursorBase
|
|
7086
|
+
return (jsxs("div", { className: cvaPagination({ className }), "data-testid": dataTestId, ref: ref, style: style, children: [jsx(IconButton, { "data-testid": "prev-page", disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, icon: jsx(Icon, { name: "ChevronLeft", size: "small" }), onClick: () => handlePageChange("prev"), size: "small", variant: "ghost-neutral" }), !cursorBase && (jsxs(Fragment, { children: [jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount ? getTranslatedCount(pageCount) : null })] })), jsx(IconButton, { "data-testid": "next-page", disabled: cursorBase
|
|
7056
7087
|
? !canNextPage || false
|
|
7057
7088
|
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, icon: jsx(Icon, { name: "ChevronRight", size: "small" }), onClick: () => handlePageChange("next"), size: "small", variant: "ghost-neutral" })] }));
|
|
7058
7089
|
};
|
|
@@ -7083,7 +7114,7 @@ const STROKE_WIDTH_THRESHOLD = 32;
|
|
|
7083
7114
|
* @param {PolygonProps} props - The props for the Polygon component
|
|
7084
7115
|
* @returns {ReactElement} Polygon component
|
|
7085
7116
|
*/
|
|
7086
|
-
const Polygon = ({ points, size, color = "black", opaque = true, className, "data-testid": dataTestId, ref, }) => {
|
|
7117
|
+
const Polygon = ({ points, size, color = "black", opaque = true, className, "data-testid": dataTestId, style, ref, }) => {
|
|
7087
7118
|
// Calculate the bounds of the points
|
|
7088
7119
|
const minX = Math.min(...points.map(coord => coord[0]));
|
|
7089
7120
|
const maxX = Math.max(...points.map(coord => coord[0]));
|
|
@@ -7100,7 +7131,7 @@ const Polygon = ({ points, size, color = "black", opaque = true, className, "dat
|
|
|
7100
7131
|
size: sizeToNormalizeAgainst,
|
|
7101
7132
|
})}`)
|
|
7102
7133
|
.join(" ");
|
|
7103
|
-
return (jsx("svg", { className: className, "data-testid": dataTestId, height: size, ref: ref, style: { width: `${size}px`, height: `${size}px` }, viewBox: `0 0 ${size} ${size}`, width: size, xmlns: "http://www.w3.org/2000/svg", children: jsx("polygon", { points: normalizedPoints, style: {
|
|
7134
|
+
return (jsx("svg", { className: className, "data-testid": dataTestId, height: size, ref: ref, style: mergeDomStyles({ width: `${size}px`, height: `${size}px` }, style), viewBox: `0 0 ${size} ${size}`, width: size, xmlns: "http://www.w3.org/2000/svg", children: jsx("polygon", { points: normalizedPoints, style: {
|
|
7104
7135
|
fill: color,
|
|
7105
7136
|
fillOpacity: opaque ? 0.2 : undefined,
|
|
7106
7137
|
stroke: color,
|
|
@@ -7147,8 +7178,8 @@ const normalize = ({ value, min, max, size }) => ((value - min) / (max - min)) *
|
|
|
7147
7178
|
* @param {PopoverTitleProps} props - The props for the PopoverTitle component
|
|
7148
7179
|
* @returns {ReactElement} PopoverTitle component
|
|
7149
7180
|
*/
|
|
7150
|
-
const PopoverTitle = ({ children, action, divider = false, className, "data-testid": dataTestId, ref, }) => {
|
|
7151
|
-
return (jsxs("div", { className: cvaPopoverTitleContainer({ divider, className }), "data-testid": dataTestId, ref: ref, children: [jsx(Text, { className: cvaPopoverTitleText(), size: "small", subtle: true, type: "div", uppercase: true, weight: "bold", children: children }), action] }));
|
|
7181
|
+
const PopoverTitle = ({ children, action, divider = false, className, "data-testid": dataTestId, style, ref, }) => {
|
|
7182
|
+
return (jsxs("div", { className: cvaPopoverTitleContainer({ divider, className }), "data-testid": dataTestId, ref: ref, style: style, children: [jsx(Text, { className: cvaPopoverTitleText(), size: "small", subtle: true, type: "div", uppercase: true, weight: "bold", children: children }), action] }));
|
|
7152
7183
|
};
|
|
7153
7184
|
|
|
7154
7185
|
const cvaPreferenceCard = cvaMerge([
|
|
@@ -7312,14 +7343,14 @@ const preferenceCardGrid = createGrid()
|
|
|
7312
7343
|
* @param {PreferenceCardProps} props - The props for the PreferenceCard component
|
|
7313
7344
|
* @returns {ReactNode} PreferenceCard component
|
|
7314
7345
|
*/
|
|
7315
|
-
const PreferenceCard = ({ title, description, icon, input, titleTag, cardTag, disabled = false, className, "data-testid": dataTestId, children, ref: forwardedRef, }) => {
|
|
7346
|
+
const PreferenceCard = ({ title, description, icon, input, titleTag, cardTag, disabled = false, className, "data-testid": dataTestId, style, children, ref: forwardedRef, }) => {
|
|
7316
7347
|
const { ref: measureRef, geometry } = useMeasure();
|
|
7317
7348
|
const ref = useMergeRefs([measureRef, forwardedRef]);
|
|
7318
7349
|
const gridAreas = useGridAreas(preferenceCardGrid);
|
|
7319
7350
|
return (jsxs("div", { className: cvaPreferenceCard({
|
|
7320
7351
|
disabled,
|
|
7321
7352
|
className,
|
|
7322
|
-
}), "data-testid": dataTestId, ref: ref, children: [input ? (jsx("label", { className: twMerge(cvaInputContainer({
|
|
7353
|
+
}), "data-testid": dataTestId, ref: ref, style: style, children: [input ? (jsx("label", { className: twMerge(cvaInputContainer({
|
|
7323
7354
|
itemPlacement: geometry && geometry.height < CENTER_INPUT_HEIGHT_THRESHOLD ? "center" : "start",
|
|
7324
7355
|
}), cvaInteractableItem({
|
|
7325
7356
|
disabled,
|
|
@@ -7384,7 +7415,7 @@ const getRandomWidth = (min, max) => {
|
|
|
7384
7415
|
* @param {PreferenceCardSkeletonProps} props - The props for the PreferenceCardSkeleton component
|
|
7385
7416
|
* @returns {ReactElement} PreferenceCardSkeleton component
|
|
7386
7417
|
*/
|
|
7387
|
-
const PreferenceCardSkeleton = ({ hasIcon = DEFAULT_SKELETON_PREFERENCE_CARD_PROPS.hasIcon, hasTitleTag = DEFAULT_SKELETON_PREFERENCE_CARD_PROPS.hasTitleTag, hasCardTag = DEFAULT_SKELETON_PREFERENCE_CARD_PROPS.hasCardTag, hasInput = DEFAULT_SKELETON_PREFERENCE_CARD_PROPS.hasInput, ref, }) => {
|
|
7418
|
+
const PreferenceCardSkeleton = ({ hasIcon = DEFAULT_SKELETON_PREFERENCE_CARD_PROPS.hasIcon, hasTitleTag = DEFAULT_SKELETON_PREFERENCE_CARD_PROPS.hasTitleTag, hasCardTag = DEFAULT_SKELETON_PREFERENCE_CARD_PROPS.hasCardTag, hasInput = DEFAULT_SKELETON_PREFERENCE_CARD_PROPS.hasInput, className, "data-testid": dataTestId, style, ref, }) => {
|
|
7388
7419
|
const gridAreas = useGridAreas(preferenceCardGrid);
|
|
7389
7420
|
// Generate stable random widths once and never change them
|
|
7390
7421
|
const lineWidths = useMemo(() => {
|
|
@@ -7393,7 +7424,7 @@ const PreferenceCardSkeleton = ({ hasIcon = DEFAULT_SKELETON_PREFERENCE_CARD_PRO
|
|
|
7393
7424
|
description: getRandomWidth(160, 240),
|
|
7394
7425
|
};
|
|
7395
7426
|
}, []);
|
|
7396
|
-
return (jsxs("div", { className: cvaPreferenceCard(), ref: ref, children: [hasInput ? (jsx("div", { className: cvaInputContainer({ itemPlacement: "center" }), children: jsx(SkeletonBlock, { height: 20, width: 20 }) })) : null, jsx("div", { className: cvaContentWrapper(), children: jsx(GridAreas, { ...gridAreas, className: cvaContentContainer({ itemPlacement: "center" }), children: slots => (jsxs(Fragment, { children: [hasIcon ? (jsx("div", { ...slots.icon, children: jsx(SkeletonBlock, { className: cvaIconBackground({ disabled: false }), height: 32, width: 32 }) })) : null, jsxs("div", { ...slots.information, className: "min-w-0 flex-1", children: [jsx("div", { className: "grid min-w-0 grid-cols-[1fr_auto] items-center gap-2", children: jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [jsx(SkeletonLabel, { textSize: "text-sm", width: lineWidths.title }), hasTitleTag ? jsx(TagSkeleton, { size: "small" }) : null] }) }), jsx(SkeletonLabel, { textSize: "text-xs", width: lineWidths.description })] }), hasCardTag ? (jsx("div", { ...slots.cardTag, className: "justify-self-end", children: jsx(TagSkeleton, { size: "medium" }) })) : null] })) }) })] }));
|
|
7427
|
+
return (jsxs("div", { className: cvaPreferenceCard({ className }), "data-testid": dataTestId, ref: ref, style: style, children: [hasInput ? (jsx("div", { className: cvaInputContainer({ itemPlacement: "center" }), children: jsx(SkeletonBlock, { height: 20, width: 20 }) })) : null, jsx("div", { className: cvaContentWrapper(), children: jsx(GridAreas, { ...gridAreas, className: cvaContentContainer({ itemPlacement: "center" }), children: slots => (jsxs(Fragment, { children: [hasIcon ? (jsx("div", { ...slots.icon, children: jsx(SkeletonBlock, { className: cvaIconBackground({ disabled: false }), height: 32, width: 32 }) })) : null, jsxs("div", { ...slots.information, className: "min-w-0 flex-1", children: [jsx("div", { className: "grid min-w-0 grid-cols-[1fr_auto] items-center gap-2", children: jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [jsx(SkeletonLabel, { textSize: "text-sm", width: lineWidths.title }), hasTitleTag ? jsx(TagSkeleton, { size: "small" }) : null] }) }), jsx(SkeletonLabel, { textSize: "text-xs", width: lineWidths.description })] }), hasCardTag ? (jsx("div", { ...slots.cardTag, className: "justify-self-end", children: jsx(TagSkeleton, { size: "medium" }) })) : null] })) }) })] }));
|
|
7397
7428
|
};
|
|
7398
7429
|
/**
|
|
7399
7430
|
* Simple tag skeleton for use within PreferenceCardSkeleton.
|
|
@@ -7522,8 +7553,8 @@ const cvaSpacer = cvaMerge([], {
|
|
|
7522
7553
|
* @param {SpacerProps} props - The props for the Spacer component
|
|
7523
7554
|
* @returns {ReactElement} Spacer component
|
|
7524
7555
|
*/
|
|
7525
|
-
const Spacer = ({ size = "medium", border = false, "data-testid": dataTestId, className, ref, }) => {
|
|
7526
|
-
return jsx("div", { className: cvaSpacer({ className, border, size }), "data-testid": dataTestId, ref: ref });
|
|
7556
|
+
const Spacer = ({ size = "medium", border = false, "data-testid": dataTestId, className, style, ref, }) => {
|
|
7557
|
+
return jsx("div", { className: cvaSpacer({ className, border, size }), "data-testid": dataTestId, ref: ref, style: style });
|
|
7527
7558
|
};
|
|
7528
7559
|
|
|
7529
7560
|
/**
|
|
@@ -7552,8 +7583,8 @@ const Spacer = ({ size = "medium", border = false, "data-testid": dataTestId, cl
|
|
|
7552
7583
|
* @param {SectionHeaderProps} props - The props for the SectionHeader component
|
|
7553
7584
|
* @returns {ReactElement} SectionHeader component
|
|
7554
7585
|
*/
|
|
7555
|
-
const SectionHeader = ({ title, subtitle, "data-testid": dataTestId, addons, ref, }) => {
|
|
7556
|
-
return (jsxs("div", { className: "flex flex-col", ref: ref, 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" })] }));
|
|
7586
|
+
const SectionHeader = ({ title, subtitle, "data-testid": dataTestId, addons, style, ref, }) => {
|
|
7587
|
+
return (jsxs("div", { className: "flex flex-col", ref: ref, style: style, 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" })] }));
|
|
7557
7588
|
};
|
|
7558
7589
|
|
|
7559
7590
|
/**
|
|
@@ -9137,7 +9168,7 @@ const useSheetMotionOverflow = ({ panelEl, isDragging, scrollAreaEl, separatorEl
|
|
|
9137
9168
|
* CSS transitions on transform; the component stays mounted during the
|
|
9138
9169
|
* close animation and unmounts after the transition completes.
|
|
9139
9170
|
*/
|
|
9140
|
-
const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, onCloseGesture, floatingUi, ref, anchor = "center", snapping = true, resizable = true, variant = "default", trapFocus = true, container, dockedContent, persistentContent, className, "data-testid": dataTestId, onCloseComplete, entryAnimation = "subsequent", children, }) => {
|
|
9171
|
+
const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, onCloseGesture, floatingUi, ref, anchor = "center", snapping = true, resizable = true, variant = "default", trapFocus = true, container, dockedContent, persistentContent, className, style, "data-testid": dataTestId, onCloseComplete, entryAnimation = "subsequent", children, }) => {
|
|
9141
9172
|
const isFirstRender = useIsFirstRender();
|
|
9142
9173
|
const skipEntryAnimation = entryAnimation === "never" || (entryAnimation === "subsequent" && isFirstRender);
|
|
9143
9174
|
const effectiveSnapping = resizable && snapping;
|
|
@@ -9243,7 +9274,7 @@ const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, o
|
|
|
9243
9274
|
onLostPointerCapture: gestures.onLostPointerCapture,
|
|
9244
9275
|
}
|
|
9245
9276
|
: {};
|
|
9246
|
-
const panel = (jsxs(Card, { ...(shouldTrapFocus === true ? { "aria-modal": true, role: "dialog" } : {}), ...(floatingUi?.getFloatingProps() ?? {}), className: cvaSheetPanel({ anchor, variant, className }), "data-testid": dataTestId, onTransitionEnd: handleTransitionEnd, ref: panelRefWithFloating, style: getSheetPanelStyle({
|
|
9277
|
+
const panel = (jsxs(Card, { ...(shouldTrapFocus === true ? { "aria-modal": true, role: "dialog" } : {}), ...(floatingUi?.getFloatingProps() ?? {}), className: cvaSheetPanel({ anchor, variant, className }), "data-testid": dataTestId, onTransitionEnd: handleTransitionEnd, ref: panelRefWithFloating, style: mergeDomStyles(getSheetPanelStyle({
|
|
9247
9278
|
autoHeight: state.sizingMode === "fit" && !fitHeightMeasured,
|
|
9248
9279
|
closePhase: animState.closePhase,
|
|
9249
9280
|
isDragging: gestures.isDragging,
|
|
@@ -9252,7 +9283,7 @@ const Sheet = ({ isOpen, state, snap, onGeometryChange, onSnap, onClickHandle, o
|
|
|
9252
9283
|
snapHeight: snapHeightCss,
|
|
9253
9284
|
suppressTransition: skipEntryAnimation && animState.visuallyOpen,
|
|
9254
9285
|
variant,
|
|
9255
|
-
}), children: [resizable ? (jsx(SheetHandle, { "data-testid": dataTestId !== undefined ? `${dataTestId}-handle` : undefined, isDragging: gestures.isDragging, onClick: handleClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ...gestureHandlers })) : null, jsx("div", { className: "h-px shrink-0 bg-neutral-200 opacity-0 transition-opacity duration-200", ref: setSeparatorEl }), jsxs("div", { className: cvaSheetScrollArea({ fillHeight: state.sizingMode !== "fit" }), "data-sheet-scroll-area": true, ref: setScrollAreaEl, children: [persistentContent, state.sizingMode === "docked" ? dockedContent : children] })] }));
|
|
9286
|
+
}), style), children: [resizable ? (jsx(SheetHandle, { "data-testid": dataTestId !== undefined ? `${dataTestId}-handle` : undefined, isDragging: gestures.isDragging, onClick: handleClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ...gestureHandlers })) : null, jsx("div", { className: "h-px shrink-0 bg-neutral-200 opacity-0 transition-opacity duration-200", ref: setSeparatorEl }), jsxs("div", { className: cvaSheetScrollArea({ fillHeight: state.sizingMode !== "fit" }), "data-sheet-scroll-area": true, ref: setScrollAreaEl, children: [persistentContent, state.sizingMode === "docked" ? dockedContent : children] })] }));
|
|
9256
9287
|
return (jsx(Portal, { root: container, children: jsxs("div", { className: cvaSheetContainer({
|
|
9257
9288
|
docked: state.sizingMode === "docked",
|
|
9258
9289
|
}), "data-testid": dataTestId !== undefined ? `${dataTestId}-container` : undefined, ref: containerRef, children: [jsx(SheetOverlay, { "data-testid": dataTestId !== undefined ? `${dataTestId}-overlay` : undefined, visible: showOverlay }), shouldTrapFocus === true ? (jsx(FloatingFocusManager, { context: floatingUi.context, children: panel })) : (panel)] }) }));
|
|
@@ -9703,7 +9734,7 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
9703
9734
|
* @param {SidebarProps} props - The props for the Sidebar component
|
|
9704
9735
|
* @returns {ReactElement} Sidebar component
|
|
9705
9736
|
*/
|
|
9706
|
-
const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", className, "data-testid": dataTestId = "sidebar", moreMenuProps, menuListProps, overflowThreshold, ref, }) => {
|
|
9737
|
+
const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", className, "data-testid": dataTestId = "sidebar", moreMenuProps, menuListProps, overflowThreshold, style, ref, }) => {
|
|
9707
9738
|
const { overflowContainerRef, itemOverflowMap } = useOverflowItems({
|
|
9708
9739
|
children,
|
|
9709
9740
|
childUniqueIdentifierAttribute: "id",
|
|
@@ -9716,7 +9747,7 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
|
|
|
9716
9747
|
}
|
|
9717
9748
|
return "visible";
|
|
9718
9749
|
};
|
|
9719
|
-
return (jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, ref: ref, children: [jsx("div", { className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": `${dataTestId}-child-container`, ref: overflowContainerRef, children: Children.map(children, child => {
|
|
9750
|
+
return (jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, ref: ref, style: style, children: [jsx("div", { className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": `${dataTestId}-child-container`, ref: overflowContainerRef, children: Children.map(children, child => {
|
|
9720
9751
|
return cloneElement(child, {
|
|
9721
9752
|
className: twMerge(child.props.className, itemVisibilityClassName(child.props.id)),
|
|
9722
9753
|
});
|
|
@@ -10149,7 +10180,7 @@ const cvaToggleItemContent = cvaMerge([], {
|
|
|
10149
10180
|
* @param {ToggleGroupProps} props - The props for the ToggleGroup component
|
|
10150
10181
|
* @returns {ReactElement} ToggleGroup component
|
|
10151
10182
|
*/
|
|
10152
|
-
const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false, size = "medium", isIconOnly = false, className, "data-testid": dataTestId, ref, }) => {
|
|
10183
|
+
const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false, size = "medium", isIconOnly = false, className, "data-testid": dataTestId, style, ref, }) => {
|
|
10153
10184
|
const [isMounted, setIsMounted] = useState(false);
|
|
10154
10185
|
const [slidingLeft, setSlidingLeft] = useState(0);
|
|
10155
10186
|
const [slidingWidth, setSlidingWidth] = useState(0);
|
|
@@ -10170,27 +10201,26 @@ const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false,
|
|
|
10170
10201
|
setSlidingLeft(left);
|
|
10171
10202
|
setSlidingWidth(width);
|
|
10172
10203
|
}, [validIndex]);
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
{
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
}, children: list.map((item, index) => (jsx(ToggleItem, { className: item.className, "data-testid": item["data-testid"], disabled: disabled, iconName: item.iconName, isIconOnly: isIconOnly, onClick: () => {
|
|
10204
|
+
const slidingIndicatorStyle = {
|
|
10205
|
+
"--sliding-left": `${slidingLeft}px`,
|
|
10206
|
+
"--sliding-width": `${slidingWidth}px`,
|
|
10207
|
+
"--transition-duration": "200ms",
|
|
10208
|
+
};
|
|
10209
|
+
return (jsx("div", { className: twMerge(cvaToggleGroup({ className }), cvaToggleGroupWithSlidingBackground({ isMounted })), "data-testid": dataTestId, ref: ref, style: mergeDomStyles(style, slidingIndicatorStyle), children: list.map((item, index) => (jsx(ToggleItem, { className: item.className, "data-testid": item["data-testid"], disabled: disabled, iconName: item.iconName, isIconOnly: isIconOnly, onClick: () => {
|
|
10180
10210
|
setSelected(item.id);
|
|
10181
10211
|
onChange?.(item.id);
|
|
10182
|
-
}, ref: el => (buttonRefs.current[index] = el), selected: selected === item.id, size: size, text: item.text, title: item.title, tooltip: item.tooltip }, item.id))) }));
|
|
10212
|
+
}, ref: el => (buttonRefs.current[index] = el), selected: selected === item.id, size: size, style: item.style, text: item.text, title: item.title, tooltip: item.tooltip }, item.id))) }));
|
|
10183
10213
|
};
|
|
10184
|
-
const ToggleItem = ({ title, onClick, disabled, isIconOnly, iconName = undefined, size, className, selected, text, tooltip, "data-testid": dataTestId, ref, }) => {
|
|
10214
|
+
const ToggleItem = ({ title, onClick, disabled, isIconOnly, iconName = undefined, size, className, selected, text, tooltip, "data-testid": dataTestId, style, ref, }) => {
|
|
10185
10215
|
return isIconOnly ? (jsx(Tooltip, { label: tooltip?.content || title, placement: tooltip?.placement || "top", children: jsx(ToggleButton, { className: cvaToggleItem({
|
|
10186
10216
|
className,
|
|
10187
10217
|
selected,
|
|
10188
10218
|
disabled,
|
|
10189
|
-
}), "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({
|
|
10219
|
+
}), "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, style: style, title: title }) })) : (jsx(Tooltip, { disabled: !tooltip?.content && text?.truncate === false, label: tooltip?.content || title, placement: tooltip?.placement || "top", children: jsx(ToggleButton, { className: cvaToggleItem({
|
|
10190
10220
|
className,
|
|
10191
10221
|
selected,
|
|
10192
10222
|
disabled,
|
|
10193
|
-
}), "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 }) }) }));
|
|
10223
|
+
}), "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, style: style, title: title, children: jsx("span", { className: cvaToggleItemText({ maxWidth: text?.maxWidth, selected, disabled }), children: title }) }) }));
|
|
10194
10224
|
};
|
|
10195
10225
|
const ToggleButton = ({ title, size, children, "data-testid": dataTestId, className, icon, iconPrefix, isIconOnly, ...rest }) => {
|
|
10196
10226
|
const sizeClasses = {
|
|
@@ -10267,13 +10297,13 @@ const getValueTextVariant = (size, sum, segments, total) => {
|
|
|
10267
10297
|
* SegmentedValueBar displays multiple colored segments on a bar to visualize values relative to a total.
|
|
10268
10298
|
* Supports optional tooltips per segment, showing value and optionally a label.
|
|
10269
10299
|
*/
|
|
10270
|
-
const SegmentedValueBar = ({ segments, total, size = "small", showValue = false, displayValue, unit, valueColor, showTooltip = false, tooltipUnit, valueWidth, className, "data-testid": dataTestId, }) => {
|
|
10300
|
+
const SegmentedValueBar = ({ segments, total, size = "small", showValue = false, displayValue, unit, valueColor, showTooltip = false, tooltipUnit, valueWidth, className, "data-testid": dataTestId, style, }) => {
|
|
10271
10301
|
const computedSegments = computeSegments(segments, total);
|
|
10272
10302
|
const sum = total > 0 ? computeSum(segments) : 0;
|
|
10273
10303
|
const valueText = formatValue(displayValue ?? sum, unit);
|
|
10274
10304
|
const canShowValue = showValue && size !== "extraSmall";
|
|
10275
10305
|
const valueTextClassName = cvaSegmentedValueBarText({ size: getValueTextVariant(size, sum, segments, total) });
|
|
10276
|
-
return (jsxs("span", { className: valueBarContainerClassName, "data-testid": dataTestId, children: [jsx("div", { "aria-label": valueText, className: cvaSegmentedValueBar({ className, size }), "data-testid": dataTestId ? `${dataTestId}-track` : undefined, children: computedSegments.map((segment, index) => {
|
|
10306
|
+
return (jsxs("span", { className: valueBarContainerClassName, "data-testid": dataTestId, style: style, children: [jsx("div", { "aria-label": valueText, className: cvaSegmentedValueBar({ className, size }), "data-testid": dataTestId ? `${dataTestId}-track` : undefined, children: computedSegments.map((segment, index) => {
|
|
10277
10307
|
const tooltipLabel = segment.label
|
|
10278
10308
|
? `${segment.label}: ${formatValue(segment.value, tooltipUnit ?? unit)}`
|
|
10279
10309
|
: formatValue(segment.value, tooltipUnit ?? unit);
|
|
@@ -11012,6 +11042,7 @@ const MAX_URL_LENGTH = 5000;
|
|
|
11012
11042
|
const useSearchParamSync = ({ key, enabled = true, onExternalChange, replace: replaceOption, }) => {
|
|
11013
11043
|
const navigate = useNavigate();
|
|
11014
11044
|
const location = useLocation();
|
|
11045
|
+
const router = useRouter();
|
|
11015
11046
|
const search = useSearch({ strict: false, shouldThrow: false });
|
|
11016
11047
|
const lastWrittenRef = useRef(undefined);
|
|
11017
11048
|
const onExternalChangeRef = useRef(onExternalChange);
|
|
@@ -11069,6 +11100,9 @@ const useSearchParamSync = ({ key, enabled = true, onExternalChange, replace: re
|
|
|
11069
11100
|
return;
|
|
11070
11101
|
}
|
|
11071
11102
|
requestAnimationFrame(() => {
|
|
11103
|
+
if (router.state.status === "pending") {
|
|
11104
|
+
return;
|
|
11105
|
+
}
|
|
11072
11106
|
const shouldReplace = options?.replace ?? replaceOption ?? !Boolean(currentSearchValue);
|
|
11073
11107
|
void navigate({
|
|
11074
11108
|
to: ".",
|
|
@@ -11084,7 +11118,7 @@ const useSearchParamSync = ({ key, enabled = true, onExternalChange, replace: re
|
|
|
11084
11118
|
replace: shouldReplace,
|
|
11085
11119
|
});
|
|
11086
11120
|
});
|
|
11087
|
-
}, [enabled, navigate, key, replaceOption, location.hash, getUrlLengthWithSearchParam, currentSearchValue]);
|
|
11121
|
+
}, [enabled, navigate, key, replaceOption, location.hash, getUrlLengthWithSearchParam, currentSearchValue, router.state.status]);
|
|
11088
11122
|
return useMemo(() => ({ searchValue: currentSearchValue, updateSearchParam }), [currentSearchValue, updateSearchParam]);
|
|
11089
11123
|
};
|
|
11090
11124
|
|