@trackunit/react-components 1.4.23 → 1.4.28
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 +89 -75
- package/index.esm.js +89 -75
- package/package.json +8 -8
- package/src/components/Alert/Alert.d.ts +2 -2
- package/src/components/Badge/Badge.d.ts +1 -1
- package/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/src/components/Card/Card.d.ts +2 -2
- package/src/components/Card/CardBody.d.ts +1 -1
- package/src/components/Card/CardFooter.d.ts +2 -2
- package/src/components/Card/CardHeader.d.ts +2 -2
- package/src/components/Collapse/Collapse.d.ts +1 -1
- package/src/components/CopyableText/CopyableText.d.ts +1 -1
- package/src/components/EmptyValue/EmptyValue.d.ts +3 -2
- package/src/components/ExternalLink/ExternalLink.d.ts +5 -4
- package/src/components/Heading/Heading.d.ts +4 -4
- package/src/components/Icon/Icon.d.ts +1 -1
- package/src/components/Indicator/Indicator.d.ts +4 -3
- package/src/components/KPICard/KPICard.d.ts +3 -3
- package/src/components/Menu/MenuItem/MenuItem.d.ts +6 -5
- package/src/components/Menu/MenuList/MenuList.d.ts +4 -3
- package/src/components/Menu/MoreMenu/MoreMenu.d.ts +1 -1
- package/src/components/Notice/Notice.d.ts +4 -3
- package/src/components/PageHeader/PageHeader.d.ts +1 -1
- package/src/components/Pagination/Pagination.d.ts +1 -1
- package/src/components/Polygon/Polygon.d.ts +1 -1
- package/src/components/Popover/Popover.d.ts +1 -1
- package/src/components/Popover/PopoverContent.d.ts +9 -2
- package/src/components/Popover/PopoverTitle.d.ts +2 -2
- package/src/components/Popover/PopoverTrigger.d.ts +14 -4
- package/src/components/Popover/PopoverTypes.d.ts +6 -4
- package/src/components/SectionHeader/SectionHeader.d.ts +3 -3
- package/src/components/Sidebar/Sidebar.d.ts +2 -2
- package/src/components/Sidebar/useOverflowItems.d.ts +1 -1
- package/src/components/Spacer/Spacer.d.ts +1 -1
- package/src/components/Spinner/Spinner.d.ts +1 -1
- package/src/components/Tabs/Tab.d.ts +1 -1
- package/src/components/Tabs/TabContent.d.ts +1 -1
- package/src/components/Tag/Tag.d.ts +11 -4
- package/src/components/Text/Text.d.ts +11 -4
- package/src/components/ToggleGroup/ToggleGroup.d.ts +1 -1
- package/src/components/Tooltip/Tooltip.d.ts +3 -3
- package/src/components/ValueBar/ValueBar.d.ts +1 -1
- package/src/components/ValueBar/ValueBarHelper.d.ts +1 -1
- package/src/components/VirtualizedList/VirtualizedList.d.ts +3 -2
- package/src/components/Widget/WidgetBody.d.ts +1 -1
- package/src/components/buttons/Button/Button.d.ts +10 -3
- package/src/components/buttons/IconButton/IconButton.d.ts +12 -2
- package/src/components/buttons/StarButton/StarButton.d.ts +2 -2
- package/src/hooks/useClickOutside.d.ts +1 -1
- package/src/hooks/useContainerBreakpoints.d.ts +1 -1
- package/src/hooks/useElevatedReducer.d.ts +2 -2
- package/src/hooks/useGeometry.d.ts +1 -1
- package/src/hooks/useIsTextTruncated.d.ts +3 -3
- package/src/hooks/useIsTextWrapping.d.ts +1 -1
- package/src/hooks/useScrollDetection.d.ts +1 -1
- package/src/hooks/useSelfUpdatingRef.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef, useMemo, useEffect, forwardRef, useState, useCallback, createElement, useReducer, memo, createContext, useContext, isValidElement, cloneElement, Children } from 'react';
|
|
3
2
|
import { objectKeys, uuidv4, objectEntries, objectValues } from '@trackunit/shared-utils';
|
|
4
3
|
import { intentPalette, generalPalette, criticalityPalette, activityPalette, utilizationPalette, sitesPalette, rentalStatusPalette, themeScreenSizeAsNumber, color } from '@trackunit/ui-design-tokens';
|
|
5
4
|
import { iconNames } from '@trackunit/ui-icons';
|
|
@@ -7,6 +6,7 @@ import IconSpriteMicro from '@trackunit/ui-icons/icons-sprite-micro.svg';
|
|
|
7
6
|
import IconSpriteMini from '@trackunit/ui-icons/icons-sprite-mini.svg';
|
|
8
7
|
import IconSpriteOutline from '@trackunit/ui-icons/icons-sprite-outline.svg';
|
|
9
8
|
import IconSpriteSolid from '@trackunit/ui-icons/icons-sprite-solid.svg';
|
|
9
|
+
import { useRef, useMemo, useEffect, useState, useCallback, createElement, useReducer, memo, forwardRef, createContext, useContext, isValidElement, cloneElement, Children } from 'react';
|
|
10
10
|
import { snakeCase, titleCase } from 'string-ts';
|
|
11
11
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
12
12
|
import { Slottable, Slot } from '@radix-ui/react-slot';
|
|
@@ -130,7 +130,7 @@ const isSafari = () => {
|
|
|
130
130
|
* - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
|
|
131
131
|
*
|
|
132
132
|
* @param {IconProps} props - The props for the Icon component
|
|
133
|
-
* @returns {
|
|
133
|
+
* @returns {ReactElement} Icon component
|
|
134
134
|
*/
|
|
135
135
|
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, type, style, forwardedRef, ariaLabel, fontSize, ariaLabelledBy, ariaDescribedBy, }) => {
|
|
136
136
|
const useTagRef = useRef(null);
|
|
@@ -238,15 +238,15 @@ const cvaTagIcon = cvaMerge(["cursor-pointer", "transition-opacity", "hover:opac
|
|
|
238
238
|
* The tag is also used in multiselect components to show selected options.
|
|
239
239
|
*
|
|
240
240
|
* **Do:** Use short labels for easy scanning.
|
|
241
|
-
|
|
241
|
+
*
|
|
242
242
|
* @param {TagProps} props - The props for the tag component
|
|
243
|
-
* @returns {
|
|
243
|
+
* @returns {ReactElement} tag component
|
|
244
244
|
*/
|
|
245
|
-
const Tag =
|
|
245
|
+
const Tag = ({ className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false, ref, }) => {
|
|
246
246
|
return (jsxs("span", { className: cvaTag({ className, size, color, layout: onClose ? "withIcon" : "default" }), "data-testid": dataTestId, ref: ref, children: [children, Boolean(onClose) && !disabled ? (
|
|
247
247
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
248
248
|
jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { className: cvaTagIcon(), dataTestId: dataTestId + "Icon", name: "XCircle", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
249
|
-
}
|
|
249
|
+
};
|
|
250
250
|
Tag.displayName = "Tag";
|
|
251
251
|
|
|
252
252
|
/**
|
|
@@ -355,11 +355,11 @@ const cvaText = cvaMerge(["text-black", "m-0", "relative", "text-sm", "font-norm
|
|
|
355
355
|
* ### When to use
|
|
356
356
|
*
|
|
357
357
|
* Use Text when you want to show a text section, use Heading if you want to show a heading.
|
|
358
|
-
|
|
358
|
+
*
|
|
359
359
|
* @param {TextProps} props - The props for the Text component
|
|
360
|
-
* @returns {
|
|
360
|
+
* @returns {ReactElement} Text component
|
|
361
361
|
*/
|
|
362
|
-
const Text =
|
|
362
|
+
const Text = ({ children, type = "p", size = "medium", align = "left", weight = "normal", underline = false, inverted = false, subtle = false, italicize = false, uppercase = false, disabled = false, className, dataTestId, ref, ...rest }) => {
|
|
363
363
|
return createElement(type, {
|
|
364
364
|
ref,
|
|
365
365
|
className: cvaText({
|
|
@@ -377,7 +377,7 @@ const Text = forwardRef(({ children, type = "p", size = "medium", align = "left"
|
|
|
377
377
|
"data-testid": dataTestId,
|
|
378
378
|
...rest,
|
|
379
379
|
}, children);
|
|
380
|
-
}
|
|
380
|
+
};
|
|
381
381
|
Text.displayName = "Text";
|
|
382
382
|
|
|
383
383
|
const cvaSpinner = cvaMerge(["bg-transparent", "rounded-full", "border-2", "border-solid", "inline-block", "animate-spin", "cursor-wait"], {
|
|
@@ -429,7 +429,7 @@ const cvaSpinnerLabel = cvaMerge(["self-center", "text-center", "text-current"])
|
|
|
429
429
|
* Use when retrieving or refreshing small data amounts, such as status.
|
|
430
430
|
|
|
431
431
|
* @param {SpinnerProps} props - The props for the Spinner component
|
|
432
|
-
* @returns {
|
|
432
|
+
* @returns {ReactElement} Spinner component
|
|
433
433
|
*/
|
|
434
434
|
const Spinner = ({ mode = "light", size = "medium", centering = "centered", className, containerClassName, dataTestId = "spinner", label, }) => {
|
|
435
435
|
return (jsx("div", { className: cvaSpinnerContainer({ centering, className: containerClassName }), children: jsxs("div", { className: cvaSpinnerContainerInner(), children: [jsx("div", { className: cvaSpinner({ size, mode, className }), "data-testid": dataTestId, role: "spinbutton" }), label ? jsx("span", { className: cvaSpinnerLabel(), children: label }) : null] }) }));
|
|
@@ -699,9 +699,9 @@ const cvaIconButton = cvaMerge([], {
|
|
|
699
699
|
* Do not use buttons as navigational elements. Instead, use [Links](https://www.notion.so/Links-49638788b6c042698b40b94a318361f1?pvs=21) when the desired action is to take the user to a new page.
|
|
700
700
|
*
|
|
701
701
|
* @param {ButtonProps} props - The props for the Button component
|
|
702
|
-
* @returns {
|
|
702
|
+
* @returns {ReactElement} Button component
|
|
703
703
|
*/
|
|
704
|
-
const Button =
|
|
704
|
+
const Button = ({ onClick, children, loading, disabled, className, fullWidth = false, prefix, suffix, variant = "primary", type = "button", size = "medium", square = false, dataTestId, title, role, tabIndex, asChild = false, circular, ref, ...rest }) => {
|
|
705
705
|
const Comp = asChild ? Slot : "button";
|
|
706
706
|
const sharedCompProps = {
|
|
707
707
|
ref,
|
|
@@ -720,24 +720,27 @@ const Button = forwardRef(({ onClick, children, loading, disabled, className, fu
|
|
|
720
720
|
type,
|
|
721
721
|
};
|
|
722
722
|
return (jsxs(Comp, { ...sharedCompProps, ...(asChild ? {} : buttonSpecificProps), children: [loading ? (jsx(Spinner, { centering: "vertically", className: cvaButtonSpinner({ variant }), containerClassName: cvaButtonSpinnerContainer(), size: "small" })) : null, prefix && !loading ? jsx("div", { className: cvaButtonPrefixSuffix({ size, variant }), children: prefix }) : null, jsx(Slottable, { children: children }), suffix && !loading ? jsx("div", { className: cvaButtonPrefixSuffix({ size, variant }), children: suffix }) : null] }));
|
|
723
|
-
}
|
|
723
|
+
};
|
|
724
724
|
Button.displayName = "Button";
|
|
725
725
|
|
|
726
726
|
/**
|
|
727
727
|
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. The Icon Button is a version of the standard Button component without the text label.
|
|
728
728
|
*/
|
|
729
|
-
|
|
729
|
+
/**
|
|
730
|
+
*
|
|
731
|
+
*/
|
|
732
|
+
const IconButton = ({ icon, size = "medium", square = true, loading, disabled, className, ref, ...rest }) => {
|
|
730
733
|
return (jsx(Button, { className: cvaIconButton({ size: size, className }), disabled: disabled || loading, loading: loading,
|
|
731
734
|
// eslint-disable-next-line local-rules/design-guideline-button-icon-size-match
|
|
732
735
|
prefix: !loading ? icon : undefined, ref: ref, size: size, square: square, ...rest }));
|
|
733
|
-
}
|
|
736
|
+
};
|
|
734
737
|
IconButton.displayName = "IconButton";
|
|
735
738
|
|
|
736
739
|
/**
|
|
737
740
|
* The StarButton component is used for favorite actions or similar.
|
|
738
|
-
|
|
741
|
+
*
|
|
739
742
|
* @param {StarButtonProps} props - The props for the StarButton component
|
|
740
|
-
* @returns {
|
|
743
|
+
* @returns {ReactElement} StarButton component
|
|
741
744
|
*/
|
|
742
745
|
const StarButton = ({ starred, onClick }) => {
|
|
743
746
|
return (jsx("div", { "data-test-id": "starred-filter", onClick: onClick, children: jsx(Icon, { color: starred ? "primary" : "neutral", name: "Star", size: "medium" }) }));
|
|
@@ -771,9 +774,9 @@ const cvaAlertIconContainer = cvaMerge(["self-start", "shrink-0", "grid", "w-min
|
|
|
771
774
|
|
|
772
775
|
/**
|
|
773
776
|
* The Alert component should be used to inform the user of important information.
|
|
774
|
-
|
|
777
|
+
*
|
|
775
778
|
* @param {AlertProps} props - The props for the Alert component
|
|
776
|
-
* @returns {
|
|
779
|
+
* @returns {ReactElement} Alert component
|
|
777
780
|
*/
|
|
778
781
|
const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, }) => {
|
|
779
782
|
const ref = useRef(null);
|
|
@@ -838,7 +841,7 @@ const cvaBadge = cvaMerge([
|
|
|
838
841
|
* The Badge component is used to display a notification badge with an optional number value.
|
|
839
842
|
|
|
840
843
|
* @param {BadgeProps} props - The props for the Badge component
|
|
841
|
-
* @returns {
|
|
844
|
+
* @returns {ReactElement} Badge component
|
|
842
845
|
*/
|
|
843
846
|
const Badge = ({ color = "primary", className, count, max, hideZero = false, dataTestId }) => {
|
|
844
847
|
if (hideZero && count === 0) {
|
|
@@ -981,7 +984,7 @@ const useContainerBreakpoints = (ref) => {
|
|
|
981
984
|
*/
|
|
982
985
|
const useTimeout = ({ onTimeout, duration }) => {
|
|
983
986
|
const ready = useRef(false);
|
|
984
|
-
const timeout = useRef();
|
|
987
|
+
const timeout = useRef(null);
|
|
985
988
|
const callback = useRef(onTimeout);
|
|
986
989
|
const startTimeout = useCallback(() => {
|
|
987
990
|
ready.current = false;
|
|
@@ -1267,7 +1270,7 @@ const useIsFullscreen = () => {
|
|
|
1267
1270
|
* @param {string} [text] - (Optional) Text used to trigger a re-check of truncation,
|
|
1268
1271
|
* especially if the text is dynamic (such as an input's value).
|
|
1269
1272
|
* @returns {{
|
|
1270
|
-
* ref:
|
|
1273
|
+
* ref: Ref<TElement | null>;
|
|
1271
1274
|
* isTooltipVisible: boolean;
|
|
1272
1275
|
* }} An object with:
|
|
1273
1276
|
* - `ref`: a ref to attach to the element you want to observe for truncation.
|
|
@@ -1353,9 +1356,9 @@ const useScrollDetection = (elementRef) => {
|
|
|
1353
1356
|
const [isAtTop, setIsAtTop] = useState(true);
|
|
1354
1357
|
const [isAtBottom, setIsAtBottom] = useState(false);
|
|
1355
1358
|
const [scrollPosition, setScrollPosition] = useState({ top: 0, bottom: 0 });
|
|
1356
|
-
const observerRef = useRef();
|
|
1359
|
+
const observerRef = useRef(null);
|
|
1357
1360
|
const checkScrollable = useCallback(() => {
|
|
1358
|
-
const element = elementRef
|
|
1361
|
+
const element = elementRef?.current;
|
|
1359
1362
|
if (!element) {
|
|
1360
1363
|
return;
|
|
1361
1364
|
}
|
|
@@ -1363,7 +1366,7 @@ const useScrollDetection = (elementRef) => {
|
|
|
1363
1366
|
setIsScrollable(hasOverflow);
|
|
1364
1367
|
}, [elementRef]);
|
|
1365
1368
|
const checkScrollPosition = useCallback(() => {
|
|
1366
|
-
const element = elementRef
|
|
1369
|
+
const element = elementRef?.current;
|
|
1367
1370
|
if (!element) {
|
|
1368
1371
|
return;
|
|
1369
1372
|
}
|
|
@@ -1374,7 +1377,7 @@ const useScrollDetection = (elementRef) => {
|
|
|
1374
1377
|
}, [elementRef]);
|
|
1375
1378
|
const debouncedCheckScrollPosition = useDebounceCallback(checkScrollPosition, SCROLL_DEBOUNCE_TIME);
|
|
1376
1379
|
useEffect(() => {
|
|
1377
|
-
const element = elementRef
|
|
1380
|
+
const element = elementRef?.current;
|
|
1378
1381
|
if (!element) {
|
|
1379
1382
|
return;
|
|
1380
1383
|
}
|
|
@@ -1589,7 +1592,7 @@ const useBreadcrumbItemsToRender = (breadcrumbItems) => {
|
|
|
1589
1592
|
* Avoid using breadcrumbs to indicate forthcoming steps. For processes with sequential steps, use a wizard flow instead.
|
|
1590
1593
|
*
|
|
1591
1594
|
* @param {BreadcrumbProps} props - The props for the Breadcrumb component
|
|
1592
|
-
* @returns {
|
|
1595
|
+
* @returns {ReactElement} Breadcrumb component
|
|
1593
1596
|
*/
|
|
1594
1597
|
const Breadcrumb = ({ className, dataTestId, breadcrumbItems, back }) => {
|
|
1595
1598
|
const breadCrumbItemsToJSX = useBreadcrumbItemsToRender(breadcrumbItems);
|
|
@@ -1711,9 +1714,9 @@ const ROLE_CARD = "region";
|
|
|
1711
1714
|
/**
|
|
1712
1715
|
* The Card component is a container for UI elements, and is the main component of the modal.
|
|
1713
1716
|
* To get the most out of the Card, use it in combination with the CardHeader, CardBody and CardFooter.
|
|
1714
|
-
|
|
1717
|
+
*
|
|
1715
1718
|
* @param {CardProps} props - The props for the Card component
|
|
1716
|
-
* @returns {
|
|
1719
|
+
* @returns {ReactElement} Card component
|
|
1717
1720
|
*/
|
|
1718
1721
|
const Card = ({ children, onClick, fullHeight = false, onMouseEnter, onMouseLeave, className, dataTestId, ...rest }) => {
|
|
1719
1722
|
return (jsx("div", { className: cvaCard({ fullHeight, clickable: Boolean(onClick), className }), "data-testid": dataTestId, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, role: ROLE_CARD, ...rest, children: children }));
|
|
@@ -1725,7 +1728,7 @@ const Card = ({ children, onClick, fullHeight = false, onMouseEnter, onMouseLeav
|
|
|
1725
1728
|
* @summary For applying padding and gap to a Card.
|
|
1726
1729
|
* @description The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
|
|
1727
1730
|
* @param {CardBodyProps} props - The props for the CardBody component
|
|
1728
|
-
* @returns {
|
|
1731
|
+
* @returns {ReactElement} CardBody component
|
|
1729
1732
|
*/
|
|
1730
1733
|
const CardBody = ({ density = "auto", children, dataTestId, className, direction, disableGap, id, }) => {
|
|
1731
1734
|
return (jsx("div", { className: cvaCardBodyDensityContainer({ density, disableGap, className, direction }), "data-testid": dataTestId, id: id, children: children }));
|
|
@@ -1735,9 +1738,9 @@ const CardBody = ({ density = "auto", children, dataTestId, className, direction
|
|
|
1735
1738
|
* A simple footer intended to use with Cards and Modals.
|
|
1736
1739
|
* Currently only intended to contain Buttons.
|
|
1737
1740
|
* The buttons justifies to the right, but if you style a button with "margin-right: auto" it will move to the left
|
|
1738
|
-
|
|
1741
|
+
*
|
|
1739
1742
|
* @param {CardFooterProps} props - The props for the CardFooter component
|
|
1740
|
-
* @returns {
|
|
1743
|
+
* @returns {ReactElement} CardFooter component
|
|
1741
1744
|
*/
|
|
1742
1745
|
const CardFooter = ({ dataTestId, className, children, density, hideSeparator = false }) => {
|
|
1743
1746
|
return (jsx("div", { className: cvaCardFooterDensityContainer({
|
|
@@ -1780,9 +1783,9 @@ const cvaHeading = cvaMerge(["m-0", "leading-normal", "text-black"], {
|
|
|
1780
1783
|
|
|
1781
1784
|
/**
|
|
1782
1785
|
* The Heading is used for a heading of a section (h1,h2,h3,h4).
|
|
1783
|
-
|
|
1786
|
+
*
|
|
1784
1787
|
* @param {HeadingProps} props - The props for the Heading component
|
|
1785
|
-
* @returns {
|
|
1788
|
+
* @returns {ReactElement} Heading component
|
|
1786
1789
|
*/
|
|
1787
1790
|
const Heading = ({ variant = "primary", inverted = false, subtle = false, className, dataTestId, ...rest }) => {
|
|
1788
1791
|
const semanticType = {
|
|
@@ -1800,9 +1803,9 @@ const Heading = ({ variant = "primary", inverted = false, subtle = false, classN
|
|
|
1800
1803
|
|
|
1801
1804
|
/**
|
|
1802
1805
|
* Header for Cards and Modals.
|
|
1803
|
-
|
|
1806
|
+
*
|
|
1804
1807
|
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
1805
|
-
* @returns {
|
|
1808
|
+
* @returns {ReactElement} CardHeader component
|
|
1806
1809
|
*/
|
|
1807
1810
|
const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, actions, density, hideSeparator = false, }) => {
|
|
1808
1811
|
return (jsx("div", { className: cvaCardHeaderDensityContainer({
|
|
@@ -1884,7 +1887,7 @@ const cvaChevronIcon = cvaMerge(["transition-transform"], {
|
|
|
1884
1887
|
* - To creating hierarchy levels by nesting them within each other.
|
|
1885
1888
|
*
|
|
1886
1889
|
* @param {CollapseProps} props - The props for the Collapse component
|
|
1887
|
-
* @returns {
|
|
1890
|
+
* @returns {ReactElement} Collapse component
|
|
1888
1891
|
*/
|
|
1889
1892
|
const Collapse = ({ id, initialExpanded = false, onToggle, label, children, className, headerClassName, headerAddon, dataTestId, animate = true, extraPadding = true, }) => {
|
|
1890
1893
|
const LABEL_ID = uuidv4();
|
|
@@ -1958,7 +1961,7 @@ const cvaCopyableText = cvaMerge([
|
|
|
1958
1961
|
* The CopyableText component is used where the user should have easy access to copy information.
|
|
1959
1962
|
|
|
1960
1963
|
* @param {CopyableTextProps} props - The props for the CopyableText component
|
|
1961
|
-
* @returns {
|
|
1964
|
+
* @returns {ReactElement} CopyableText component
|
|
1962
1965
|
*/
|
|
1963
1966
|
const CopyableText = ({ text, alternativeText, dataTestId, className }) => {
|
|
1964
1967
|
const value = alternativeText ?? text ?? "";
|
|
@@ -2108,7 +2111,7 @@ const cvaEmptyValue = cvaMerge(["text-gray-400"]);
|
|
|
2108
2111
|
* Show intentionality in empty values in the UI
|
|
2109
2112
|
*
|
|
2110
2113
|
* @param {EmptyValueProps} props - The props for the EmptyValue component
|
|
2111
|
-
* @returns {
|
|
2114
|
+
* @returns {ReactElement} EmptyValue component
|
|
2112
2115
|
*/
|
|
2113
2116
|
const EmptyValue = ({ className, dataTestId }) => {
|
|
2114
2117
|
return (jsx("div", { className: cvaEmptyValue({ className }), "data-testid": dataTestId, children: "-" }));
|
|
@@ -2120,7 +2123,7 @@ const cvaExternalLink = cvaMerge(["underline", "text-primary-600", "hover:text-p
|
|
|
2120
2123
|
* The external link component is used to link to an external page outside the Trackunit Manager.
|
|
2121
2124
|
|
|
2122
2125
|
* @param {ExternalLinkProps} props - The props for the external link component
|
|
2123
|
-
* @returns {
|
|
2126
|
+
* @returns {ReactElement} External Link component
|
|
2124
2127
|
*/
|
|
2125
2128
|
const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, dataTestId, onClick, }) => {
|
|
2126
2129
|
return (jsx("a", { className: cvaExternalLink({ className }), "data-testid": dataTestId, href: href, onClick: onClick, rel: rel, target: target, title: title, children: children }));
|
|
@@ -2286,6 +2289,7 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
|
|
|
2286
2289
|
const resolvedDismissal = typeof dismissal === "function" ? dismissal(DEFAULT_DISMISSAL) : dismissal;
|
|
2287
2290
|
const clickInteraction = useClick(popoverContext, {
|
|
2288
2291
|
enabled: resolvedActivation.click,
|
|
2292
|
+
keyboardHandlers: resolvedActivation.keyboardHandlers,
|
|
2289
2293
|
});
|
|
2290
2294
|
const dismissInteraction = useDismiss(popoverContext, resolvedDismissal);
|
|
2291
2295
|
const hoverInteraction = useHover$1(popoverContext, {
|
|
@@ -2344,7 +2348,7 @@ const usePopoverContext = () => {
|
|
|
2344
2348
|
* To render the content of the popover, use the `<PopoverContent />` component.
|
|
2345
2349
|
*
|
|
2346
2350
|
* @param {PopoverProps} props The props for the popover
|
|
2347
|
-
* @returns {
|
|
2351
|
+
* @returns {ReactElement} A Popover Context Provider containing the children
|
|
2348
2352
|
*/
|
|
2349
2353
|
const Popover = ({ children, isModal = false, ...restOptions }) => {
|
|
2350
2354
|
const popover = usePopover({ isModal, ...restOptions });
|
|
@@ -2391,7 +2395,10 @@ const cvaPopoverTitleContainer = cvaMerge(["flex", "items-center", "px-2", "py-1
|
|
|
2391
2395
|
});
|
|
2392
2396
|
const cvaPopoverTitleText = cvaMerge(["flex-1", "text-neutral-500"]);
|
|
2393
2397
|
|
|
2394
|
-
|
|
2398
|
+
/**
|
|
2399
|
+
*
|
|
2400
|
+
*/
|
|
2401
|
+
const PopoverContent = function PopoverContent({ className, dataTestId, children, portalId, ref: propRef, ...props }) {
|
|
2395
2402
|
const { context: floatingContext, customProps, ...context } = usePopoverContext();
|
|
2396
2403
|
const ref = useMergeRefs([context.refs.setFloating, propRef]);
|
|
2397
2404
|
return (jsx(Portal, { id: portalId, children: context.isOpen ? (jsx(FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, modal: context.isModal, order: ["reference", "content"], returnFocus: true, children: jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps.dataTestId ?? "popover-content", ref: ref, style: {
|
|
@@ -2401,23 +2408,27 @@ const PopoverContent = forwardRef(function PopoverContent({ className, dataTestI
|
|
|
2401
2408
|
width: "max-content",
|
|
2402
2409
|
...props.style,
|
|
2403
2410
|
}, ...context.getFloatingProps(props), children: typeof children === "function" ? children(() => context.setIsOpen(false)) : children }) })) : null }));
|
|
2404
|
-
}
|
|
2411
|
+
};
|
|
2405
2412
|
|
|
2406
2413
|
/**
|
|
2407
2414
|
* The PopoverTitle component.
|
|
2408
|
-
|
|
2415
|
+
*
|
|
2409
2416
|
* @param {PopoverTitleProps} props - The props for the PopoverTitle component
|
|
2410
|
-
* @returns {
|
|
2417
|
+
* @returns {ReactElement} PopoverTitle component
|
|
2411
2418
|
*/
|
|
2412
2419
|
const PopoverTitle = ({ children, action, divider = false, className, dataTestId }) => {
|
|
2413
2420
|
return (jsxs("div", { className: cvaPopoverTitleContainer({ divider, className }), "data-testid": dataTestId, children: [jsx(Text, { className: cvaPopoverTitleText(), size: "small", subtle: true, type: "div", uppercase: true, weight: "bold", children: children }), action] }));
|
|
2414
2421
|
};
|
|
2415
2422
|
|
|
2416
|
-
|
|
2423
|
+
/**
|
|
2424
|
+
* The PopoverTrigger component is used to trigger the popover.
|
|
2425
|
+
*
|
|
2426
|
+
* @param {PopoverTriggerProps} props - The props for the PopoverTrigger component
|
|
2427
|
+
* @returns {ReactElement} PopoverTrigger component
|
|
2428
|
+
*/
|
|
2429
|
+
const PopoverTrigger = function PopoverTrigger({ children, renderButton, ref: propRef, ...props }) {
|
|
2417
2430
|
const context = usePopoverContext();
|
|
2418
|
-
|
|
2419
|
-
const childrenRef = children.ref;
|
|
2420
|
-
const ref = useMergeRefs([context.refs.setReference, propRef, childrenRef]);
|
|
2431
|
+
const ref = useMergeRefs([context.refs.setReference, propRef]);
|
|
2421
2432
|
if (!renderButton && isValidElement(children)) {
|
|
2422
2433
|
return cloneElement(children, context.getReferenceProps({
|
|
2423
2434
|
ref,
|
|
@@ -2426,10 +2437,8 @@ const PopoverTrigger = forwardRef(function PopoverTrigger({ children, renderButt
|
|
|
2426
2437
|
"data-state": context.isOpen ? "open" : "closed",
|
|
2427
2438
|
}));
|
|
2428
2439
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
}
|
|
2432
|
-
});
|
|
2440
|
+
return (jsx(Button, { "data-state": context.isOpen ? "open" : "closed", ref: ref, type: "button", ...context.getReferenceProps(props), children: children }));
|
|
2441
|
+
};
|
|
2433
2442
|
|
|
2434
2443
|
const cvaTooltipContainer = cvaMerge(["flex", "leading-5"]);
|
|
2435
2444
|
const cvaTooltipIcon = cvaMerge(["flex", "h-max", "w-fit", "text-slate-300", "transition", "hover:cursor-pointer", "hover:text-slate-400"], {
|
|
@@ -2486,7 +2495,7 @@ const cvaTooltipPopoverContent = cvaMerge(["max-w-sm", "rounded", "p-2"], {
|
|
|
2486
2495
|
/**
|
|
2487
2496
|
*
|
|
2488
2497
|
* @description Adding Tooltip Arrow
|
|
2489
|
-
* @returns {
|
|
2498
|
+
* @returns {ReactElement} Tooltip floating Arrow
|
|
2490
2499
|
*/
|
|
2491
2500
|
const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
|
|
2492
2501
|
const { context: floatingContext } = usePopoverContext();
|
|
@@ -2502,7 +2511,7 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
|
|
|
2502
2511
|
* **Do not use** tooltips to include information that is necessary for the user to complete their task. Use helper text that is always visible and accessible for vital information.
|
|
2503
2512
|
*
|
|
2504
2513
|
* @param {TooltipProps} props - The props for the Tooltip component
|
|
2505
|
-
* @returns {
|
|
2514
|
+
* @returns {ReactElement} Tooltip component
|
|
2506
2515
|
*/
|
|
2507
2516
|
const Tooltip = ({ children, dataTestId = "tool-tip", disabled, className, label, placement = "auto", mode = "dark", iconProps, id, }) => {
|
|
2508
2517
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -2657,7 +2666,7 @@ const cvaIndicatorIconBackground = cvaMerge(["rounded-full", "items-center", "ju
|
|
|
2657
2666
|
* _**Do not use** indicators for non-essential information, or to communicate information unrelated to the state of an asset._
|
|
2658
2667
|
|
|
2659
2668
|
* @param {IndicatorProps} props - The props for the Indicator component
|
|
2660
|
-
* @returns {
|
|
2669
|
+
* @returns {ReactElement} Indicator component
|
|
2661
2670
|
*/
|
|
2662
2671
|
const Indicator = ({ dataTestId, icon, label, color = "unknown", withBackground = true, withLabel = true, ping = false, size, className, ...rest }) => {
|
|
2663
2672
|
return (jsx(Tooltip, { className: className, disabled: withLabel, label: label, placement: "bottom", children: jsxs("div", { "aria-label": label, className: cvaIndicator(), "data-testid": dataTestId, ...rest, children: [jsxs("div", { className: cvaIndicatorIconBackground({ color, background: withBackground ? "visible" : "hidden" }), "data-testid": dataTestId ? `${dataTestId}-background` : "indicator-background", children: [ping ? (jsx("div", { className: cvaIndicatorPing({ color }), "data-testid": dataTestId ? `${dataTestId}-ping` : "indicator-ping" })) : null, icon] }), label !== undefined && withLabel ? (jsx("div", { className: cvaIndicatorLabel({ size }), "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label", children: label })) : null] }) }));
|
|
@@ -2724,7 +2733,7 @@ const LoadingContent$1 = () => (jsx("div", { className: "flex flex-row items-cen
|
|
|
2724
2733
|
* The KPICard component is used to display KPIs.
|
|
2725
2734
|
*
|
|
2726
2735
|
* @param {KPICardProps} props - The props for the KPICard component
|
|
2727
|
-
* @returns {
|
|
2736
|
+
* @returns {ReactElement} KPICard component
|
|
2728
2737
|
*/
|
|
2729
2738
|
const KPICard = ({ asChild = false, title, value, loading, unit, className, dataTestId, tooltipLabel, isActive, variant = "default", trend, onClick, ...rest }) => {
|
|
2730
2739
|
const Comp = asChild ? Slot : "div";
|
|
@@ -2931,7 +2940,7 @@ const cvaMenuItemSuffix = cvaMerge(["text-secondary-400", "text-sm"], {
|
|
|
2931
2940
|
* The MenuItem component is used to display a menu, primarily meant to be used in a list form.
|
|
2932
2941
|
*
|
|
2933
2942
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
2934
|
-
* @returns {
|
|
2943
|
+
* @returns {ReactElement} MenuItem component
|
|
2935
2944
|
*/
|
|
2936
2945
|
const MenuItem = ({ className, dataTestId, label, children, selected, prefix, suffix, disabled, onClick, stopPropagation = true, id, tabIndex, optionLabelDescription, fieldSize = "medium", variant = "primary", }) => {
|
|
2937
2946
|
/* Handle tab navigation */
|
|
@@ -2963,7 +2972,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, prefix, su
|
|
|
2963
2972
|
* - Don’t use the MenuList to display single or multi-select items within form components. For dropdowns within select components, use SelectDropdown (component not available yet).
|
|
2964
2973
|
*
|
|
2965
2974
|
* @param {MenuListProps} props - The props for the MenuList component
|
|
2966
|
-
* @returns {
|
|
2975
|
+
* @returns {ReactElement} MenuList component
|
|
2967
2976
|
*/
|
|
2968
2977
|
const MenuList = ({ dataTestId, className, children, withStickyHeader = false, isMulti = false, selectedItems: controlledSelectedItems, onSelectionChange, ...args }) => {
|
|
2969
2978
|
const childrenArr = Children.toArray(children);
|
|
@@ -3014,7 +3023,7 @@ const cvaMoreMenu = cvaMerge(["p-0"]);
|
|
|
3014
3023
|
* Advice: fill it with MenuList
|
|
3015
3024
|
*
|
|
3016
3025
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
3017
|
-
* @returns {
|
|
3026
|
+
* @returns {ReactElement} MoreMenu component
|
|
3018
3027
|
*/
|
|
3019
3028
|
const MoreMenu = ({ className, dataTestId, popoverProps, iconProps = {
|
|
3020
3029
|
size: "medium",
|
|
@@ -3085,7 +3094,7 @@ const cvaNoticeIcon = cvaMerge(["rounded-full", "items-center", "justify-center"
|
|
|
3085
3094
|
* _**Do not use** notices for essential information (use `<Alert/>` instead), or to communicate information related to the state of an asset (use `<Indicator/>` instead)._
|
|
3086
3095
|
|
|
3087
3096
|
* @param {NoticeProps} props - The props for the Notice component
|
|
3088
|
-
* @returns {
|
|
3097
|
+
* @returns {ReactElement} Notice component
|
|
3089
3098
|
*/
|
|
3090
3099
|
const Notice = ({ dataTestId, icon, label, color = "neutral", withLabel = true, className, tooltipLabel = label, withTooltip = false, size = "medium", ...rest }) => {
|
|
3091
3100
|
return (jsx(Tooltip, { className: className, disabled: !withTooltip, label: tooltipLabel, placement: "bottom", children: jsxs("div", { "aria-label": label, className: cvaNotice(), "data-testid": dataTestId, ...rest, children: [jsx("div", { className: cvaNoticeIcon({ color }), "data-testid": dataTestId ? `${dataTestId}-icon` : "notice-icon", children: icon }), label !== undefined && withLabel ? (jsx("div", { className: cvaNoticeLabel({ color, size }), "data-testid": dataTestId ? `${dataTestId}-label` : "notice-label", children: label })) : null] }) }));
|
|
@@ -3216,7 +3225,7 @@ const PageHeaderTitle = ({ title, dataTestId }) => {
|
|
|
3216
3225
|
* Tabs can be added to the PageHeader to allow users to navigate between different sections of the page.
|
|
3217
3226
|
*
|
|
3218
3227
|
* @param {PageHeaderProps} props - The props for the PageHeader component
|
|
3219
|
-
* @returns {
|
|
3228
|
+
* @returns {ReactElement} PageHeader component
|
|
3220
3229
|
*/
|
|
3221
3230
|
const PageHeader = ({ className, dataTestId, secondaryActions, showLoading, description, title, tagLabel, backTo, tagColor, tabsList, descriptionIcon, kpiMetrics, tagTooltipLabel, primaryAction, }) => {
|
|
3222
3231
|
const tagRenderer = useMemo(() => {
|
|
@@ -3242,7 +3251,7 @@ const cvaPaginationText = cvaMerge("whitespace-nowrap");
|
|
|
3242
3251
|
* Pagination Description. It could be used when you need navigation for your paging feature.
|
|
3243
3252
|
|
|
3244
3253
|
* @param {PaginationProps} props - The props for the Pagination component
|
|
3245
|
-
* @returns {
|
|
3254
|
+
* @returns {ReactElement} Pagination component
|
|
3246
3255
|
*/
|
|
3247
3256
|
const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, pageCount, pageIndex, loading, className, dataTestId, getTranslatedCount, onPageChange, cursorBase, }) => {
|
|
3248
3257
|
const [page, setPage] = useState(pageIndex);
|
|
@@ -3291,7 +3300,7 @@ const STROKE_WIDTH_THRESHOLD = 32;
|
|
|
3291
3300
|
* Draws an svg Polygon from a set of points.
|
|
3292
3301
|
*
|
|
3293
3302
|
* @param { PolygonProps} props - The props for the Polygon component
|
|
3294
|
-
* @returns {
|
|
3303
|
+
* @returns {ReactElement} Polygon component
|
|
3295
3304
|
*/
|
|
3296
3305
|
const Polygon = ({ points, size, color = "black", opaque = true, className, dataTestId }) => {
|
|
3297
3306
|
// Calculate the bounds of the points
|
|
@@ -3303,7 +3312,12 @@ const Polygon = ({ points, size, color = "black", opaque = true, className, data
|
|
|
3303
3312
|
const sizeToNormalizeAgainst = size - strokeWidth * 2; // because strole is centered, so will be clipped on the outside otherwise
|
|
3304
3313
|
// Normalize the points to fit within the viewBox
|
|
3305
3314
|
const normalizedPoints = points
|
|
3306
|
-
.map(([x, y]) => `${normalize({ value: x, min: minX, max: maxX, size: sizeToNormalizeAgainst })},${normalize({
|
|
3315
|
+
.map(([x, y]) => `${normalize({ value: x, min: minX, max: maxX, size: sizeToNormalizeAgainst })},${normalize({
|
|
3316
|
+
value: y,
|
|
3317
|
+
min: minY,
|
|
3318
|
+
max: maxY,
|
|
3319
|
+
size: sizeToNormalizeAgainst,
|
|
3320
|
+
})}`)
|
|
3307
3321
|
.join(" ");
|
|
3308
3322
|
return (jsx("svg", { className: className, "data-testid": dataTestId, height: size, 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: {
|
|
3309
3323
|
fill: color,
|
|
@@ -3378,7 +3392,7 @@ const cvaSpacer = cvaMerge([], {
|
|
|
3378
3392
|
* The Spacer component is used for adding a bit of space in the ui.
|
|
3379
3393
|
|
|
3380
3394
|
* @param {SpacerProps} props - The props for the Spacer component
|
|
3381
|
-
* @returns {
|
|
3395
|
+
* @returns {ReactElement} Spacer component
|
|
3382
3396
|
*/
|
|
3383
3397
|
const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
|
|
3384
3398
|
return jsx("div", { className: cvaSpacer({ className, border, size }), "data-testid": dataTestId });
|
|
@@ -3388,7 +3402,7 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
|
|
|
3388
3402
|
* The SectionHeader component is used on sections to set the section title.
|
|
3389
3403
|
|
|
3390
3404
|
* @param {SectionHeaderProps} props - The props for the section header component
|
|
3391
|
-
* @returns {
|
|
3405
|
+
* @returns {ReactElement} SectionHeader component
|
|
3392
3406
|
*/
|
|
3393
3407
|
const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
|
|
3394
3408
|
return (jsxs("div", { className: "flex flex-col", children: [jsx(HelmetProvider, { children: jsx(Helmet, { title: title }) }), jsxs("div", { className: "mb-2 flex flex-row gap-2", children: [jsxs("div", { className: "flex grow flex-col gap-2", children: [jsx(Heading, { dataTestId: dataTestId, variant: "secondary", children: title }), subtitle ? (jsx(Heading, { subtle: true, variant: "subtitle", children: subtitle })) : null] }), addons ? jsx("div", { className: "flex gap-2", children: addons }) : null] }), jsx(Spacer, { size: "small" })] }));
|
|
@@ -3469,9 +3483,9 @@ const useOverflowItems = ({ threshold = 1, childUniqueIdentifierAttribute = "id"
|
|
|
3469
3483
|
* - **_The sidebar is just a wrapper. You are responsible for styling the children._**
|
|
3470
3484
|
*
|
|
3471
3485
|
* When using this component make sure to add `setupIntersectionObserver();` to your jest.setup.ts file.
|
|
3472
|
-
|
|
3486
|
+
*
|
|
3473
3487
|
* @param {SidebarProps} props - The props for the Sidebar component
|
|
3474
|
-
* @returns {
|
|
3488
|
+
* @returns {ReactElement} Sidebar component
|
|
3475
3489
|
*/
|
|
3476
3490
|
const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", className, dataTestId = "sidebar", moreMenuProps, menuListProps, overflowThreshold, }) => {
|
|
3477
3491
|
const { overflowContainerRef, itemOverflowMap } = useOverflowItems({
|
|
@@ -3615,7 +3629,7 @@ const cvaToggleItemText = cvaMerge(["text-ellipsis", "truncate", "flex-grow"], {
|
|
|
3615
3629
|
* Toggle Group allows users to toggle between two or more closely related options, and immediately apply that selection.
|
|
3616
3630
|
*
|
|
3617
3631
|
* @param {ToggleGroupProps} props - The props for the ToggleGroup component
|
|
3618
|
-
* @returns {
|
|
3632
|
+
* @returns {ReactElement} ToggleGroup component
|
|
3619
3633
|
*/
|
|
3620
3634
|
const ToggleGroup = ({ list, selected, setSelected, onChange, disabled = false, size = "medium", isIconOnly = false, className, dataTestId, }) => {
|
|
3621
3635
|
return (jsx("div", { className: cvaToggleGroup(), "data-testid": dataTestId, children: list.map((item, index) => (jsx(ToggleItem, { className: twMerge(className, index === 0 ? ["rounded-l-md", "border-l"] : "", index === list.length - 1 ? ["rounded-r-md", "border-r"] : ""), dataTestId: item.dataTestId, disabled: disabled, iconName: item.iconName, isIconOnly: isIconOnly, onClick: () => {
|
|
@@ -3725,7 +3739,7 @@ const getFillColor = (score, levelColors) => {
|
|
|
3725
3739
|
* @param {number} min - min range value
|
|
3726
3740
|
* @param {number} max - max range value
|
|
3727
3741
|
* @param {LevelColors} levelColors - level colors used to coloring the bar
|
|
3728
|
-
* @returns {
|
|
3742
|
+
* @returns {ReactElement} ValueBar component
|
|
3729
3743
|
*/
|
|
3730
3744
|
const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
3731
3745
|
const score = getScore(value, min, max);
|
|
@@ -3736,7 +3750,7 @@ const getValueBarColorByValue = (value, min, max, levelColors) => {
|
|
|
3736
3750
|
* ValueBar component is used to display value on a colorful bar within provided range.
|
|
3737
3751
|
|
|
3738
3752
|
* @param {ValueBarProps} props - The props for the ValueBar component
|
|
3739
|
-
* @returns {
|
|
3753
|
+
* @returns {ReactElement} ValueBar component
|
|
3740
3754
|
*/
|
|
3741
3755
|
const ValueBar = ({ value, min = 0, max = 100, unit, size = "small", levelColors, valueColor, showValue, className, dataTestId, zeroScoreAllowed, }) => {
|
|
3742
3756
|
const score = getScore(value, min, max, zeroScoreAllowed);
|
|
@@ -3768,7 +3782,7 @@ const cvaVirtualizedListItem = cvaMerge(["absolute", "top-0", "left-0", "w-full"
|
|
|
3768
3782
|
* @property {number} [rowHeight="40"] - The estimated height of each row in the list.
|
|
3769
3783
|
* @property {RelayPagination | undefined} pagination - Pagination configuration for the list.
|
|
3770
3784
|
* @property {separator} [separator="line"] - The separator style between items in the list.
|
|
3771
|
-
* @property {(index: number) =>
|
|
3785
|
+
* @property {(index: number) =>ReactElement} children - A function that takes an index and returns the JSX element to be rendered at said index.
|
|
3772
3786
|
* @property {loadingIndicator} [loadingIndicator="spinner"] - The type of loading indicator in the list.
|
|
3773
3787
|
* @property {skeletonLinesHeight} [skeletonLinesHeight="2rem"] - The height of the skeleton lines.
|
|
3774
3788
|
*/
|
|
@@ -3835,7 +3849,7 @@ const cvaWidgetBodyDensityContainer = cvaMerge([
|
|
|
3835
3849
|
* @summary For applying padding and gap to a Widget.
|
|
3836
3850
|
* @description The padding must live here, and not on the Widget itself, as to not inset the scrollbar in case of overflow
|
|
3837
3851
|
* @param {WidgetBodyProps} props - The props for the WidgetBody component
|
|
3838
|
-
* @returns {
|
|
3852
|
+
* @returns {ReactElement} WidgetBody component
|
|
3839
3853
|
*/
|
|
3840
3854
|
const WidgetBody = ({ density = "auto", children, dataTestId, className, disableGap }) => {
|
|
3841
3855
|
return (jsx("div", { className: cvaWidgetBodyDensityContainer({ density, disableGap, className }), "data-testid": dataTestId, children: children }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.28",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,22 +8,22 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@radix-ui/react-slot": "^1.0.2",
|
|
11
|
-
"react": "
|
|
11
|
+
"react": "19.0.0",
|
|
12
12
|
"usehooks-ts": "^3.1.0",
|
|
13
13
|
"@radix-ui/react-tabs": "^1.0.4",
|
|
14
14
|
"react-helmet-async": "^1.3.0",
|
|
15
15
|
"lodash": "4.17.21",
|
|
16
16
|
"jest-fetch-mock": "^3.0.3",
|
|
17
|
-
"@testing-library/react": "
|
|
17
|
+
"@testing-library/react": "16.2.0",
|
|
18
18
|
"@floating-ui/react": "^0.26.25",
|
|
19
19
|
"@tanstack/react-router": "1.47.1",
|
|
20
20
|
"string-ts": "^2.0.0",
|
|
21
21
|
"tailwind-merge": "^2.0.0",
|
|
22
|
-
"@trackunit/ui-design-tokens": "1.3.
|
|
23
|
-
"@trackunit/css-class-variance-utilities": "1.3.
|
|
24
|
-
"@trackunit/shared-utils": "1.5.
|
|
25
|
-
"@trackunit/ui-icons": "1.3.
|
|
26
|
-
"@trackunit/react-table-pagination": "1.3.
|
|
22
|
+
"@trackunit/ui-design-tokens": "1.3.28",
|
|
23
|
+
"@trackunit/css-class-variance-utilities": "1.3.28",
|
|
24
|
+
"@trackunit/shared-utils": "1.5.28",
|
|
25
|
+
"@trackunit/ui-icons": "1.3.28",
|
|
26
|
+
"@trackunit/react-table-pagination": "1.3.28"
|
|
27
27
|
},
|
|
28
28
|
"module": "./index.esm.js",
|
|
29
29
|
"main": "./index.cjs.js",
|
|
@@ -42,8 +42,8 @@ export interface AlertProps extends CommonProps {
|
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* The Alert component should be used to inform the user of important information.
|
|
45
|
-
|
|
45
|
+
*
|
|
46
46
|
* @param {AlertProps} props - The props for the Alert component
|
|
47
|
-
* @returns {
|
|
47
|
+
* @returns {ReactElement} Alert component
|
|
48
48
|
*/
|
|
49
49
|
export declare const Alert: ({ color, title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, }: AlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -31,7 +31,7 @@ export type BadgeProps = BaseBadgeProps;
|
|
|
31
31
|
* The Badge component is used to display a notification badge with an optional number value.
|
|
32
32
|
|
|
33
33
|
* @param {BadgeProps} props - The props for the Badge component
|
|
34
|
-
* @returns {
|
|
34
|
+
* @returns {ReactElement} Badge component
|
|
35
35
|
*/
|
|
36
36
|
export declare const Badge: ({ color, className, count, max, hideZero, dataTestId }: BadgeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
37
37
|
export {};
|
|
@@ -10,7 +10,7 @@ import { BreadcrumbContainerProps, BreadcrumbProps } from "./utils/types";
|
|
|
10
10
|
* Avoid using breadcrumbs to indicate forthcoming steps. For processes with sequential steps, use a wizard flow instead.
|
|
11
11
|
*
|
|
12
12
|
* @param {BreadcrumbProps} props - The props for the Breadcrumb component
|
|
13
|
-
* @returns {
|
|
13
|
+
* @returns {ReactElement} Breadcrumb component
|
|
14
14
|
*/
|
|
15
15
|
export declare const Breadcrumb: ({ className, dataTestId, breadcrumbItems, back }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
/**
|
|
@@ -26,8 +26,8 @@ export interface CardProps extends CommonProps, InputHTMLAttributes<HTMLDivEleme
|
|
|
26
26
|
/**
|
|
27
27
|
* The Card component is a container for UI elements, and is the main component of the modal.
|
|
28
28
|
* To get the most out of the Card, use it in combination with the CardHeader, CardBody and CardFooter.
|
|
29
|
-
|
|
29
|
+
*
|
|
30
30
|
* @param {CardProps} props - The props for the Card component
|
|
31
|
-
* @returns {
|
|
31
|
+
* @returns {ReactElement} Card component
|
|
32
32
|
*/
|
|
33
33
|
export declare const Card: ({ children, onClick, fullHeight, onMouseEnter, onMouseLeave, className, dataTestId, ...rest }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -28,6 +28,6 @@ export interface CardBodyProps extends CommonProps {
|
|
|
28
28
|
* @summary For applying padding and gap to a Card.
|
|
29
29
|
* @description The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
|
|
30
30
|
* @param {CardBodyProps} props - The props for the CardBody component
|
|
31
|
-
* @returns {
|
|
31
|
+
* @returns {ReactElement} CardBody component
|
|
32
32
|
*/
|
|
33
33
|
export declare const CardBody: ({ density, children, dataTestId, className, direction, disableGap, id, }: CardBodyProps) => import("react/jsx-runtime").JSX.Element;
|