@trackunit/react-components 0.1.152 → 0.1.153-alpha-f3842b2375.0
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 +35 -32
- package/index.esm.js +33 -34
- package/package.json +5 -5
- package/src/components/Icon/Icon.d.ts +251 -3
package/index.cjs.js
CHANGED
|
@@ -5,8 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
|
|
8
|
-
var uiIcons = require('@trackunit/ui-icons');
|
|
9
8
|
var uiDesignTokens = require('@trackunit/ui-design-tokens');
|
|
9
|
+
var uiIcons = require('@trackunit/ui-icons');
|
|
10
|
+
var IconSpriteOutline = require('@trackunit/ui-icons/icons-sprite-outline.svg');
|
|
11
|
+
var IconSpriteSolid = require('@trackunit/ui-icons/icons-sprite-solid.svg');
|
|
10
12
|
var ReactDOM = require('react-dom');
|
|
11
13
|
var reactRouterDom = require('react-router-dom');
|
|
12
14
|
|
|
@@ -32,6 +34,8 @@ function _interopNamespace(e) {
|
|
|
32
34
|
|
|
33
35
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
36
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
37
|
+
var IconSpriteOutline__default = /*#__PURE__*/_interopDefaultLegacy(IconSpriteOutline);
|
|
38
|
+
var IconSpriteSolid__default = /*#__PURE__*/_interopDefaultLegacy(IconSpriteSolid);
|
|
35
39
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
36
40
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
37
41
|
|
|
@@ -426,7 +430,7 @@ const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-gri
|
|
|
426
430
|
size: "large",
|
|
427
431
|
},
|
|
428
432
|
});
|
|
429
|
-
|
|
433
|
+
cssClassVarianceUtilities.cvaMerge([], {
|
|
430
434
|
variants: {
|
|
431
435
|
iconType: {
|
|
432
436
|
solid: "fill-current stroke-transparent",
|
|
@@ -434,7 +438,7 @@ const cvaIconComponent = cssClassVarianceUtilities.cvaMerge([], {
|
|
|
434
438
|
},
|
|
435
439
|
},
|
|
436
440
|
});
|
|
437
|
-
|
|
441
|
+
cssClassVarianceUtilities.cvaMerge([
|
|
438
442
|
"relative",
|
|
439
443
|
"aspect-square",
|
|
440
444
|
"after:content-['']",
|
|
@@ -449,30 +453,27 @@ const cvaLoadingDot = cssClassVarianceUtilities.cvaMerge([
|
|
|
449
453
|
"after:opacity-50",
|
|
450
454
|
]);
|
|
451
455
|
|
|
456
|
+
const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, uiDesignTokens.intentPalette), uiDesignTokens.generalPalette), uiDesignTokens.criticalityPalette), uiDesignTokens.activityPalette), uiDesignTokens.utilizationPalette), uiDesignTokens.sitesPalette), uiDesignTokens.rentalStatusPalette);
|
|
457
|
+
const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
|
|
452
458
|
/**
|
|
453
459
|
* - The Icon component is used to display an Icon.
|
|
454
460
|
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
455
|
-
* - All the [HeroIcons](https://heroicons.dev/) as well as custom
|
|
461
|
+
* - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
|
|
456
462
|
*
|
|
457
463
|
* @param {IconProps} props - The props for the Icon component
|
|
458
464
|
* @returns {JSX.Element} Icon component
|
|
459
465
|
*/
|
|
460
466
|
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
|
|
461
467
|
const correctIconType = React__namespace.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
|
|
462
|
-
|
|
463
|
-
if (
|
|
464
|
-
IconComponent = uiIcons.heroIconLookup(name, correctIconType);
|
|
465
|
-
}
|
|
466
|
-
else if (uiIcons.TrackunitSolidIconsArray.find(icon => icon === name) ||
|
|
467
|
-
uiIcons.TrackunitOutlineIconsArray.find(icon => icon === name)) {
|
|
468
|
-
IconComponent = uiIcons.trackunitIconLookup(name, correctIconType);
|
|
469
|
-
}
|
|
470
|
-
if (!IconComponent) {
|
|
468
|
+
const iconName = uiIcons.iconNames[name];
|
|
469
|
+
if (!iconName) {
|
|
471
470
|
return null;
|
|
472
471
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
472
|
+
const href = {
|
|
473
|
+
solid: `${IconSpriteSolid__default["default"]}#${iconName}`,
|
|
474
|
+
outline: `${IconSpriteOutline__default["default"]}#${iconName}`,
|
|
475
|
+
};
|
|
476
|
+
return (jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsxRuntime.jsx("use", { href: href[correctIconType] }) }) }));
|
|
476
477
|
};
|
|
477
478
|
|
|
478
479
|
/**
|
|
@@ -482,7 +483,7 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
|
|
|
482
483
|
* @returns {JSX.Element} StarButton component
|
|
483
484
|
*/
|
|
484
485
|
const StarButton = ({ starred, onClick }) => {
|
|
485
|
-
return (jsxRuntime.jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsxRuntime.jsx(Icon, { name: "
|
|
486
|
+
return (jsxRuntime.jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsxRuntime.jsx(Icon, { name: "Star", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) }));
|
|
486
487
|
};
|
|
487
488
|
|
|
488
489
|
const cvaText = cssClassVarianceUtilities.cvaMerge(["m-0", "relative", "text-sm", "font-normal"], {
|
|
@@ -624,13 +625,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
624
625
|
const getIconFromColor = () => {
|
|
625
626
|
switch (color) {
|
|
626
627
|
case "danger":
|
|
627
|
-
return jsxRuntime.jsx(Icon, { name: "
|
|
628
|
+
return jsxRuntime.jsx(Icon, { name: "ExclamationTriangle", color: "danger" });
|
|
628
629
|
case "warning":
|
|
629
|
-
return jsxRuntime.jsx(Icon, { name: "
|
|
630
|
+
return jsxRuntime.jsx(Icon, { name: "ExclamationCircle", color: "warning" });
|
|
630
631
|
case "success":
|
|
631
|
-
return jsxRuntime.jsx(Icon, { name: "
|
|
632
|
+
return jsxRuntime.jsx(Icon, { name: "CheckCircle", color: "success" });
|
|
632
633
|
default:
|
|
633
|
-
return jsxRuntime.jsx(Icon, { name: "
|
|
634
|
+
return jsxRuntime.jsx(Icon, { name: "InformationCircle" });
|
|
634
635
|
}
|
|
635
636
|
};
|
|
636
637
|
const getButtonColor = () => {
|
|
@@ -650,7 +651,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
650
651
|
}
|
|
651
652
|
}, [ref, autoScroll]);
|
|
652
653
|
const layout = inline ? "inline" : "default";
|
|
653
|
-
return (jsxRuntime.jsxs("div", { className: cvaAlert({ color, layout, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer({ layout }), children: getIconFromColor() }), jsxRuntime.jsxs("div", { className: cvaAlertContent({ layout }), children: [jsxRuntime.jsxs("div", { className: cvaAlertDetails(), children: [jsxRuntime.jsx("div", { className: cvaAlertContentBody(), children: body }), onClose && !inline ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer({ layout }), children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "
|
|
654
|
+
return (jsxRuntime.jsxs("div", { className: cvaAlert({ color, layout, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer({ layout }), children: getIconFromColor() }), jsxRuntime.jsxs("div", { className: cvaAlertContent({ layout }), children: [jsxRuntime.jsxs("div", { className: cvaAlertDetails(), children: [jsxRuntime.jsx("div", { className: cvaAlertContentBody(), children: body }), onClose && !inline ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer({ layout }), children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }), (primaryAction || secondaryAction || onClose) && (jsxRuntime.jsxs("div", { className: cvaAlertRightAligned({ layout }), children: [secondaryAction && (jsxRuntime.jsx(Button$1, { size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading, children: secondaryAction.label })), primaryAction && (jsxRuntime.jsx(Button$1, { size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading, children: primaryAction.label })), onClose && inline ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer({ layout }), children: jsxRuntime.jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }))] })] }));
|
|
654
655
|
};
|
|
655
656
|
|
|
656
657
|
const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -882,7 +883,7 @@ const Heading = (_a) => {
|
|
|
882
883
|
* @returns {JSX.Element} CardHeader component
|
|
883
884
|
*/
|
|
884
885
|
const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
|
|
885
|
-
return (jsxRuntime.jsx(DensityContainer, { dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { className: extraClassName, children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })), children] }), onClose && (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "
|
|
886
|
+
return (jsxRuntime.jsx(DensityContainer, { dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, children: jsxRuntime.jsxs("div", { className: cvaCardHeader(), children: [jsxRuntime.jsxs("div", { className: extraClassName, children: [jsxRuntime.jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsxRuntime.jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsxRuntime.jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })), children] }), onClose && (jsxRuntime.jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsxRuntime.jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" }))] }) }));
|
|
886
887
|
};
|
|
887
888
|
|
|
888
889
|
function useMountedState() {
|
|
@@ -1221,7 +1222,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, layo
|
|
|
1221
1222
|
}
|
|
1222
1223
|
setExpanded(!expanded);
|
|
1223
1224
|
}, [expanded, onToggle]);
|
|
1224
|
-
return (jsxRuntime.jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: jsxRuntime.jsxs("div", { className: cvaCollapseLabelContainer({ layout }), children: [jsxRuntime.jsx(Text, { type: "span", weight: "bold", children: label }), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "
|
|
1225
|
+
return (jsxRuntime.jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: jsxRuntime.jsxs("div", { className: cvaCollapseLabelContainer({ layout }), children: [jsxRuntime.jsx(Text, { type: "span", weight: "bold", children: label }), jsxRuntime.jsx(IconButton, { icon: jsxRuntime.jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDown", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] }) }), jsxRuntime.jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
|
|
1225
1226
|
};
|
|
1226
1227
|
const Collapsible = ({ children, expanded, id }) => {
|
|
1227
1228
|
const [ref, { height }] = useMeasure$1();
|
|
@@ -18781,7 +18782,7 @@ const PopoverTrigger = React.forwardRef(function PopoverTrigger(_a, propRef) {
|
|
|
18781
18782
|
* @returns {JSX.Element} DayPickerPopover component
|
|
18782
18783
|
*/
|
|
18783
18784
|
const DayPickerPopover = ({ disabledDays, className, dataTestId, selectedDay, onDaySelect, color = "secondary", placement, size = "small", buttonContent, language, }) => {
|
|
18784
|
-
return (jsxRuntime.jsxs(Popover, { placement: placement, children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(Button$1, { color: color, size: size, className: className, prefix: jsxRuntime.jsx(Icon, { name: "
|
|
18785
|
+
return (jsxRuntime.jsxs(Popover, { placement: placement, children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(Button$1, { color: color, size: size, className: className, prefix: jsxRuntime.jsx(Icon, { name: "Calendar", size: "small" }), dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "show-day-picker", children: buttonContent }) }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsx(Card, { children: jsxRuntime.jsx(DayPicker, { disabledDays: disabledDays, onDaySelect: onDaySelect, selectedDays: selectedDay, language: language }) }) })] }));
|
|
18785
18786
|
};
|
|
18786
18787
|
|
|
18787
18788
|
/**
|
|
@@ -36799,7 +36800,7 @@ const cvaMoreMenu = cssClassVarianceUtilities.cvaMerge(["p-4"]);
|
|
|
36799
36800
|
*/
|
|
36800
36801
|
const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
|
|
36801
36802
|
size: "medium",
|
|
36802
|
-
name: "
|
|
36803
|
+
name: "EllipsisHorizontal",
|
|
36803
36804
|
}, iconButtonProps = {
|
|
36804
36805
|
size: "small",
|
|
36805
36806
|
circular: true,
|
|
@@ -37222,7 +37223,7 @@ const Tag = React__namespace.forwardRef((_a, ref) => {
|
|
|
37222
37223
|
var { className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false } = _a; __rest$1(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "disabled"]);
|
|
37223
37224
|
return (jsxRuntime.jsxs("span", { className: cvaTag({ className, size, color, layout: Boolean(onClose) ? "withIcon" : "default" }), "data-testid": dataTestId && `${dataTestId}-tag`, ref: ref, children: [children, Boolean(onClose) && !disabled && (
|
|
37224
37225
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
37225
|
-
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsxRuntime.jsx(Icon, { name: "
|
|
37226
|
+
jsxRuntime.jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsxRuntime.jsx(Icon, { name: "XCircle", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) }))] }));
|
|
37226
37227
|
});
|
|
37227
37228
|
|
|
37228
37229
|
const cvaTip = cssClassVarianceUtilities.cvaMerge("flex transition text-slate-300 hover:text-slate-500");
|
|
@@ -37246,7 +37247,7 @@ const cvaTipContent = cssClassVarianceUtilities.cvaMerge("p-2 rounded max-w-sm f
|
|
|
37246
37247
|
* @returns {JSX.Element} Tip component
|
|
37247
37248
|
*/
|
|
37248
37249
|
const Tip = ({ children, iconProps, dataTestId, className, placement = "bottom", mode = "dark", link, }) => {
|
|
37249
|
-
return (jsxRuntime.jsx("span", { "data-testid": dataTestId, className: cvaTip({ className }), children: jsxRuntime.jsxs(Popover, { placement: placement, activation: { click: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx("div", { "data-testid": dataTestId && `${dataTestId}-trigger`, children: jsxRuntime.jsx(Icon, Object.assign({ name: "
|
|
37250
|
+
return (jsxRuntime.jsx("span", { "data-testid": dataTestId, className: cvaTip({ className }), children: jsxRuntime.jsxs(Popover, { placement: placement, activation: { click: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx("div", { "data-testid": dataTestId && `${dataTestId}-trigger`, children: jsxRuntime.jsx(Icon, Object.assign({ name: "QuestionMarkCircle", size: "medium", dataTestId: dataTestId && `${dataTestId}-icon` }, iconProps)) }) }), jsxRuntime.jsx(PopoverContent, { children: jsxRuntime.jsxs("div", { className: cvaTipContent({ color: mode }), children: [jsxRuntime.jsx("div", { children: typeof children === "string" ? jsxRuntime.jsx("p", { children: children }) : children }), link ? (jsxRuntime.jsx("a", { href: link, children: jsxRuntime.jsx(Icon, { name: "ArrowRightCircle" }) })) : null] }) })] }) }));
|
|
37250
37251
|
};
|
|
37251
37252
|
|
|
37252
37253
|
const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
|
|
@@ -37284,7 +37285,7 @@ const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex",
|
|
|
37284
37285
|
* @returns {JSX.Element} PageHeader component
|
|
37285
37286
|
*/
|
|
37286
37287
|
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, }) => {
|
|
37287
|
-
return (jsxRuntime.jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsxRuntime.jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "
|
|
37288
|
+
return (jsxRuntime.jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxRuntime.jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsxRuntime.jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsxRuntime.jsx(Icon, { name: "ArrowLeft" }) })), jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsxRuntime.jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && jsxRuntime.jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag }), showLoading && jsxRuntime.jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsxRuntime.jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
|
|
37288
37289
|
};
|
|
37289
37290
|
|
|
37290
37291
|
const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -37333,9 +37334,9 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
37333
37334
|
if (loading) {
|
|
37334
37335
|
return (jsxRuntime.jsx("div", { className: cvaPagination({ className }), children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) }));
|
|
37335
37336
|
}
|
|
37336
|
-
return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsxRuntime.jsx(Icon, { name: "
|
|
37337
|
+
return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small", color: "secondary", variant: "transparent" }), !cursorBase && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: cvaPaginationText(), "data-testid": "current-page", children: currentPage }), jsxRuntime.jsx("div", { className: cvaPaginationText(), "data-testid": "page-count", children: pageCount !== null && pageCount !== undefined && getTranslatedCount && getTranslatedCount(pageCount) })] })), jsxRuntime.jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
|
|
37337
37338
|
? !canNextPage || false
|
|
37338
|
-
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsxRuntime.jsx(Icon, { name: "
|
|
37339
|
+
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronRight", size: "small" }), size: "small", color: "secondary", variant: "transparent" })] }));
|
|
37339
37340
|
};
|
|
37340
37341
|
|
|
37341
37342
|
function useConfirmExit(confirmExit, when = true) {
|
|
@@ -38917,7 +38918,7 @@ const Timeline = ({ className, dataTestId, children }) => {
|
|
|
38917
38918
|
* @param {TimeLineElementProps} props the props
|
|
38918
38919
|
* @returns {JSX.Element} component
|
|
38919
38920
|
*/
|
|
38920
|
-
const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", headerClassName, dot = jsxRuntime.jsx(Indicator, { className: "mt-[-1px]", color: "neutral", icon: jsxRuntime.jsx(Icon, { name: "
|
|
38921
|
+
const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", headerClassName, dot = jsxRuntime.jsx(Indicator, { className: "mt-[-1px]", color: "neutral", icon: jsxRuntime.jsx(Icon, { name: "Calendar", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
|
|
38921
38922
|
return (jsxRuntime.jsxs("li", { className: cvaTimelineElement({ className }), "data-date": `${date}`, "data-testid": dataTestId && `${dataTestId}`, onClick: () => onClick && onClick(), children: [jsxRuntime.jsx("div", { className: cvaTimelineDot(), children: dot }), jsxRuntime.jsx("div", { children: header }), jsxRuntime.jsx("div", {}), jsxRuntime.jsx("div", { children: jsxRuntime.jsx("div", { children: children }) })] }));
|
|
38922
38923
|
};
|
|
38923
38924
|
function defaultHeader(date, showTime) {
|
|
@@ -39122,6 +39123,8 @@ exports.cvaMenuItemSuffix = cvaMenuItemSuffix;
|
|
|
39122
39123
|
exports.docs = docs;
|
|
39123
39124
|
exports.getDevicePixelRatio = getDevicePixelRatio;
|
|
39124
39125
|
exports.getValueBarColorByValue = getValueBarColorByValue;
|
|
39126
|
+
exports.iconColorNames = iconColorNames;
|
|
39127
|
+
exports.iconPalette = iconPalette;
|
|
39125
39128
|
exports.setLocalStorage = setLocalStorage;
|
|
39126
39129
|
exports.useClickOutside = useClickOutside;
|
|
39127
39130
|
exports.useContainerProps = useContainerProps;
|
package/index.esm.js
CHANGED
|
@@ -2,8 +2,10 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useRef, useCallback, useEffect, useState, useLayoutEffect, useMemo, createContext, forwardRef, useContext, isValidElement, cloneElement, memo, Children, useReducer, Component } from 'react';
|
|
4
4
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { rentalStatusPalette, intentPalette, generalPalette, criticalityPalette, activityPalette, utilizationPalette, sitesPalette, color } from '@trackunit/ui-design-tokens';
|
|
6
|
+
import { iconNames } from '@trackunit/ui-icons';
|
|
7
|
+
import IconSpriteOutline from '@trackunit/ui-icons/icons-sprite-outline.svg';
|
|
8
|
+
import IconSpriteSolid from '@trackunit/ui-icons/icons-sprite-solid.svg';
|
|
7
9
|
import * as ReactDOM from 'react-dom';
|
|
8
10
|
import ReactDOM__default, { createPortal } from 'react-dom';
|
|
9
11
|
import { UNSAFE_NavigationContext } from 'react-router-dom';
|
|
@@ -399,7 +401,7 @@ const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
|
|
|
399
401
|
size: "large",
|
|
400
402
|
},
|
|
401
403
|
});
|
|
402
|
-
|
|
404
|
+
cvaMerge([], {
|
|
403
405
|
variants: {
|
|
404
406
|
iconType: {
|
|
405
407
|
solid: "fill-current stroke-transparent",
|
|
@@ -407,7 +409,7 @@ const cvaIconComponent = cvaMerge([], {
|
|
|
407
409
|
},
|
|
408
410
|
},
|
|
409
411
|
});
|
|
410
|
-
|
|
412
|
+
cvaMerge([
|
|
411
413
|
"relative",
|
|
412
414
|
"aspect-square",
|
|
413
415
|
"after:content-['']",
|
|
@@ -422,30 +424,27 @@ const cvaLoadingDot = cvaMerge([
|
|
|
422
424
|
"after:opacity-50",
|
|
423
425
|
]);
|
|
424
426
|
|
|
427
|
+
const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, intentPalette), generalPalette), criticalityPalette), activityPalette), utilizationPalette), sitesPalette), rentalStatusPalette);
|
|
428
|
+
const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This users the object in the Object.keys() to infer the type of the keys.
|
|
425
429
|
/**
|
|
426
430
|
* - The Icon component is used to display an Icon.
|
|
427
431
|
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
428
|
-
* - All the [HeroIcons](https://heroicons.dev/) as well as custom
|
|
432
|
+
* - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
|
|
429
433
|
*
|
|
430
434
|
* @param {IconProps} props - The props for the Icon component
|
|
431
435
|
* @returns {JSX.Element} Icon component
|
|
432
436
|
*/
|
|
433
437
|
const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
|
|
434
438
|
const correctIconType = React.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
|
|
435
|
-
|
|
436
|
-
if (
|
|
437
|
-
IconComponent = heroIconLookup(name, correctIconType);
|
|
438
|
-
}
|
|
439
|
-
else if (TrackunitSolidIconsArray.find(icon => icon === name) ||
|
|
440
|
-
TrackunitOutlineIconsArray.find(icon => icon === name)) {
|
|
441
|
-
IconComponent = trackunitIconLookup(name, correctIconType);
|
|
442
|
-
}
|
|
443
|
-
if (!IconComponent) {
|
|
439
|
+
const iconName = iconNames[name];
|
|
440
|
+
if (!iconName) {
|
|
444
441
|
return null;
|
|
445
442
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
443
|
+
const href = {
|
|
444
|
+
solid: `${IconSpriteSolid}#${iconName}`,
|
|
445
|
+
outline: `${IconSpriteOutline}#${iconName}`,
|
|
446
|
+
};
|
|
447
|
+
return (jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsx("svg", { viewBox: "0 0 24 24", "data-testid": dataTestId ? `${dataTestId}-${iconName}` : iconName, style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style), children: jsx("use", { href: href[correctIconType] }) }) }));
|
|
449
448
|
};
|
|
450
449
|
|
|
451
450
|
/**
|
|
@@ -455,7 +454,7 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
|
|
|
455
454
|
* @returns {JSX.Element} StarButton component
|
|
456
455
|
*/
|
|
457
456
|
const StarButton = ({ starred, onClick }) => {
|
|
458
|
-
return (jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsx(Icon, { name: "
|
|
457
|
+
return (jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsx(Icon, { name: "Star", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) }));
|
|
459
458
|
};
|
|
460
459
|
|
|
461
460
|
const cvaText = cvaMerge(["m-0", "relative", "text-sm", "font-normal"], {
|
|
@@ -597,13 +596,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
597
596
|
const getIconFromColor = () => {
|
|
598
597
|
switch (color) {
|
|
599
598
|
case "danger":
|
|
600
|
-
return jsx(Icon, { name: "
|
|
599
|
+
return jsx(Icon, { name: "ExclamationTriangle", color: "danger" });
|
|
601
600
|
case "warning":
|
|
602
|
-
return jsx(Icon, { name: "
|
|
601
|
+
return jsx(Icon, { name: "ExclamationCircle", color: "warning" });
|
|
603
602
|
case "success":
|
|
604
|
-
return jsx(Icon, { name: "
|
|
603
|
+
return jsx(Icon, { name: "CheckCircle", color: "success" });
|
|
605
604
|
default:
|
|
606
|
-
return jsx(Icon, { name: "
|
|
605
|
+
return jsx(Icon, { name: "InformationCircle" });
|
|
607
606
|
}
|
|
608
607
|
};
|
|
609
608
|
const getButtonColor = () => {
|
|
@@ -623,7 +622,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
623
622
|
}
|
|
624
623
|
}, [ref, autoScroll]);
|
|
625
624
|
const layout = inline ? "inline" : "default";
|
|
626
|
-
return (jsxs("div", { className: cvaAlert({ color, layout, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsx("div", { className: cvaAlertIconContainer({ layout }), children: getIconFromColor() }), jsxs("div", { className: cvaAlertContent({ layout }), children: [jsxs("div", { className: cvaAlertDetails(), children: [jsx("div", { className: cvaAlertContentBody(), children: body }), onClose && !inline ? (jsx("div", { className: cvaAlertCloseButtonContainer({ layout }), children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "
|
|
625
|
+
return (jsxs("div", { className: cvaAlert({ color, layout, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsx("div", { className: cvaAlertIconContainer({ layout }), children: getIconFromColor() }), jsxs("div", { className: cvaAlertContent({ layout }), children: [jsxs("div", { className: cvaAlertDetails(), children: [jsx("div", { className: cvaAlertContentBody(), children: body }), onClose && !inline ? (jsx("div", { className: cvaAlertCloseButtonContainer({ layout }), children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }), (primaryAction || secondaryAction || onClose) && (jsxs("div", { className: cvaAlertRightAligned({ layout }), children: [secondaryAction && (jsx(Button$1, { size: "small", variant: "transparent", color: getButtonColor(), onClick: secondaryAction.onClick, loading: secondaryAction === null || secondaryAction === void 0 ? void 0 : secondaryAction.loading, children: secondaryAction.label })), primaryAction && (jsx(Button$1, { size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading, children: primaryAction.label })), onClose && inline ? (jsx("div", { className: cvaAlertCloseButtonContainer({ layout }), children: jsx(IconButton, { size: "small", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), title: "Close Alert", circular: true }) })) : null] }))] })] }));
|
|
627
626
|
};
|
|
628
627
|
|
|
629
628
|
const cvaBadge = cvaMerge([
|
|
@@ -855,7 +854,7 @@ const Heading = (_a) => {
|
|
|
855
854
|
* @returns {JSX.Element} CardHeader component
|
|
856
855
|
*/
|
|
857
856
|
const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose, dataTestId, className, children, accessories, density, extraClassName, hideSeparator = false, }) => {
|
|
858
|
-
return (jsx(DensityContainer, { dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { className: extraClassName, children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })), children] }), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "
|
|
857
|
+
return (jsx(DensityContainer, { dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density, children: jsxs("div", { className: cvaCardHeader(), children: [jsxs("div", { className: extraClassName, children: [jsxs("div", { className: cvaCardHeaderHeadingContainer(), children: [jsx(Heading, { className: "self-center", variant: headingVariant, children: heading }), accessories] }), subHeading && (jsx(Heading, { subtle: true, variant: "subtitle", children: subHeading })), children] }), onClose && (jsx(IconButton, { dataTestId: "card-header-close-button", variant: "transparent", color: "secondary", onClick: onClose, icon: jsx(Icon, { name: "XMark", size: "small" }), className: "!h-min" }))] }) }));
|
|
859
858
|
};
|
|
860
859
|
|
|
861
860
|
function useMountedState() {
|
|
@@ -1194,7 +1193,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, layo
|
|
|
1194
1193
|
}
|
|
1195
1194
|
setExpanded(!expanded);
|
|
1196
1195
|
}, [expanded, onToggle]);
|
|
1197
|
-
return (jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsx("div", { className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: jsxs("div", { className: cvaCollapseLabelContainer({ layout }), children: [jsx(Text, { type: "span", weight: "bold", children: label }), jsx(IconButton, { icon: jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "
|
|
1196
|
+
return (jsxs("div", { className: cvaCollapse({ className }), "data-testid": dataTestId, children: [jsx("div", { className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick, children: jsxs("div", { className: cvaCollapseLabelContainer({ layout }), children: [jsx(Text, { type: "span", weight: "bold", children: label }), jsx(IconButton, { icon: jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDown", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] }) }), jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
|
|
1198
1197
|
};
|
|
1199
1198
|
const Collapsible = ({ children, expanded, id }) => {
|
|
1200
1199
|
const [ref, { height }] = useMeasure$1();
|
|
@@ -18754,7 +18753,7 @@ const PopoverTrigger = forwardRef(function PopoverTrigger(_a, propRef) {
|
|
|
18754
18753
|
* @returns {JSX.Element} DayPickerPopover component
|
|
18755
18754
|
*/
|
|
18756
18755
|
const DayPickerPopover = ({ disabledDays, className, dataTestId, selectedDay, onDaySelect, color = "secondary", placement, size = "small", buttonContent, language, }) => {
|
|
18757
|
-
return (jsxs(Popover, { placement: placement, children: [jsx(PopoverTrigger, { children: jsx(Button$1, { color: color, size: size, className: className, prefix: jsx(Icon, { name: "
|
|
18756
|
+
return (jsxs(Popover, { placement: placement, children: [jsx(PopoverTrigger, { children: jsx(Button$1, { color: color, size: size, className: className, prefix: jsx(Icon, { name: "Calendar", size: "small" }), dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "show-day-picker", children: buttonContent }) }), jsx(PopoverContent, { children: jsx(Card, { children: jsx(DayPicker, { disabledDays: disabledDays, onDaySelect: onDaySelect, selectedDays: selectedDay, language: language }) }) })] }));
|
|
18758
18757
|
};
|
|
18759
18758
|
|
|
18760
18759
|
/**
|
|
@@ -36772,7 +36771,7 @@ const cvaMoreMenu = cvaMerge(["p-4"]);
|
|
|
36772
36771
|
*/
|
|
36773
36772
|
const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
|
|
36774
36773
|
size: "medium",
|
|
36775
|
-
name: "
|
|
36774
|
+
name: "EllipsisHorizontal",
|
|
36776
36775
|
}, iconButtonProps = {
|
|
36777
36776
|
size: "small",
|
|
36778
36777
|
circular: true,
|
|
@@ -37195,7 +37194,7 @@ const Tag = React.forwardRef((_a, ref) => {
|
|
|
37195
37194
|
var { className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false } = _a; __rest$1(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "disabled"]);
|
|
37196
37195
|
return (jsxs("span", { className: cvaTag({ className, size, color, layout: Boolean(onClose) ? "withIcon" : "default" }), "data-testid": dataTestId && `${dataTestId}-tag`, ref: ref, children: [children, Boolean(onClose) && !disabled && (
|
|
37197
37196
|
// a fix for multiselect deselecting tags working together with fade out animation
|
|
37198
|
-
jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { name: "
|
|
37197
|
+
jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { name: "XCircle", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) }))] }));
|
|
37199
37198
|
});
|
|
37200
37199
|
|
|
37201
37200
|
const cvaTip = cvaMerge("flex transition text-slate-300 hover:text-slate-500");
|
|
@@ -37219,7 +37218,7 @@ const cvaTipContent = cvaMerge("p-2 rounded max-w-sm flex gap-2 items-center tex
|
|
|
37219
37218
|
* @returns {JSX.Element} Tip component
|
|
37220
37219
|
*/
|
|
37221
37220
|
const Tip = ({ children, iconProps, dataTestId, className, placement = "bottom", mode = "dark", link, }) => {
|
|
37222
|
-
return (jsx("span", { "data-testid": dataTestId, className: cvaTip({ className }), children: jsxs(Popover, { placement: placement, activation: { click: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsx(PopoverTrigger, { children: jsx("div", { "data-testid": dataTestId && `${dataTestId}-trigger`, children: jsx(Icon, Object.assign({ name: "
|
|
37221
|
+
return (jsx("span", { "data-testid": dataTestId, className: cvaTip({ className }), children: jsxs(Popover, { placement: placement, activation: { click: true }, dataTestId: dataTestId !== null && dataTestId !== void 0 ? dataTestId : "", children: [jsx(PopoverTrigger, { children: jsx("div", { "data-testid": dataTestId && `${dataTestId}-trigger`, children: jsx(Icon, Object.assign({ name: "QuestionMarkCircle", size: "medium", dataTestId: dataTestId && `${dataTestId}-icon` }, iconProps)) }) }), jsx(PopoverContent, { children: jsxs("div", { className: cvaTipContent({ color: mode }), children: [jsx("div", { children: typeof children === "string" ? jsx("p", { children: children }) : children }), link ? (jsx("a", { href: link, children: jsx(Icon, { name: "ArrowRightCircle" }) })) : null] }) })] }) }));
|
|
37223
37222
|
};
|
|
37224
37223
|
|
|
37225
37224
|
const cvaPageHeader = cvaMerge([
|
|
@@ -37257,7 +37256,7 @@ const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "i
|
|
|
37257
37256
|
* @returns {JSX.Element} PageHeader component
|
|
37258
37257
|
*/
|
|
37259
37258
|
const PageHeader = ({ className, dataTestId, action, showLoading, description, link, title, tag, backTo, tagColor, children, }) => {
|
|
37260
|
-
return (jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "
|
|
37259
|
+
return (jsxs("div", { className: cvaPageHeader({ className: `${className} tu-page-header` }), "data-testid": dataTestId, children: [jsxs("div", { className: cvaPageHeaderHeadingAccessoriesContainer(), "data-testid": dataTestId && `${dataTestId}-heading-container`, children: [jsxs("div", { className: cvaPageHeaderHeadingContainer(), children: [backTo && (jsx(IconButton, { to: backTo, color: "tertiary", variant: "transparent", size: "small", icon: jsx(Icon, { name: "ArrowLeft" }) })), jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircle" }, link: link, children: description }))] }), tag && !showLoading && jsx(Tag, { dataTestId: dataTestId, color: tagColor, children: tag }), showLoading && jsx(Spinner, { dataTestId: dataTestId && `${dataTestId}-spinner`, centering: "vertically" }), action] }), jsx("div", { className: cvaPageHeaderChildContainer(), children: children })] }));
|
|
37261
37260
|
};
|
|
37262
37261
|
|
|
37263
37262
|
const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
|
|
@@ -37306,9 +37305,9 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
|
|
|
37306
37305
|
if (loading) {
|
|
37307
37306
|
return (jsx("div", { className: cvaPagination({ className }), children: jsx(SkeletonLines, { height: 16, width: 150 }) }));
|
|
37308
37307
|
}
|
|
37309
|
-
return (jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsx(Icon, { name: "
|
|
37308
|
+
return (jsxs("div", { "data-testid": dataTestId, className: cvaPagination({ className }), children: [jsx(IconButton, { onClick: () => handlePageChange("prev"), disabled: cursorBase ? !canPreviousPage || false : page !== undefined && page <= 0, "data-testid": "prev-page", icon: jsx(Icon, { name: "ChevronLeft", size: "small" }), size: "small", color: "secondary", variant: "transparent" }), !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) })] })), jsx(IconButton, { onClick: () => handlePageChange("next"), disabled: cursorBase
|
|
37310
37309
|
? !canNextPage || false
|
|
37311
|
-
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsx(Icon, { name: "
|
|
37310
|
+
: page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsx(Icon, { name: "ChevronRight", size: "small" }), size: "small", color: "secondary", variant: "transparent" })] }));
|
|
37312
37311
|
};
|
|
37313
37312
|
|
|
37314
37313
|
function useConfirmExit(confirmExit, when = true) {
|
|
@@ -38890,7 +38889,7 @@ const Timeline = ({ className, dataTestId, children }) => {
|
|
|
38890
38889
|
* @param {TimeLineElementProps} props the props
|
|
38891
38890
|
* @returns {JSX.Element} component
|
|
38892
38891
|
*/
|
|
38893
|
-
const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", headerClassName, dot = jsx(Indicator, { className: "mt-[-1px]", color: "neutral", icon: jsx(Icon, { name: "
|
|
38892
|
+
const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", headerClassName, dot = jsx(Indicator, { className: "mt-[-1px]", color: "neutral", icon: jsx(Icon, { name: "Calendar", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
|
|
38894
38893
|
return (jsxs("li", { className: cvaTimelineElement({ className }), "data-date": `${date}`, "data-testid": dataTestId && `${dataTestId}`, onClick: () => onClick && onClick(), children: [jsx("div", { className: cvaTimelineDot(), children: dot }), jsx("div", { children: header }), jsx("div", {}), jsx("div", { children: jsx("div", { children: children }) })] }));
|
|
38895
38894
|
};
|
|
38896
38895
|
function defaultHeader(date, showTime) {
|
|
@@ -39033,4 +39032,4 @@ const cvaClickable = cvaMerge([
|
|
|
39033
39032
|
},
|
|
39034
39033
|
});
|
|
39035
39034
|
|
|
39036
|
-
export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, setLocalStorage, useClickOutside, useContainerProps, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };
|
|
39035
|
+
export { Alert, Badge, Button$1 as Button, Card, CardBody, CardFooter, CardHeader, Collapse, CopyableText, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, EmptyState, ExternalLink, Heading, Icon, IconButton, Indicator, MenuItem, MenuList, Modal, ModalBackdrop, MoreMenu, PageHeader, Pagination, Popover, PopoverContent, PopoverTitle, PopoverTrigger, Prompt, ROLE_CARD, SectionHeader, Sidebar, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, Timeline, TimelineElement, Tip, Tooltip, ValueBar, cvaButton, cvaButtonSpinner, cvaClickable, cvaIconButtonContainer, cvaIndicator, cvaIndicatorIcon, cvaIndicatorIconBackground, cvaIndicatorLabel, cvaIndicatorPing, cvaMenuItem, cvaMenuItemLabel, cvaMenuItemPrefix, cvaMenuItemSuffix, docs, getDevicePixelRatio, getValueBarColorByValue, iconColorNames, iconPalette, setLocalStorage, useClickOutside, useContainerProps, useDebounce, useDevicePixelRatio, useHover, useIsFirstRender, useLocalStorage, useLocalStorageReducer, useModal, usePopoverContext, usePrompt, useResize, useTimeout, useVisibilityChange };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.153-alpha-f3842b2375.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@floating-ui/react": "0.22.2",
|
|
11
|
-
"@trackunit/css-class-variance-utilities": "0.0.
|
|
12
|
-
"@trackunit/css-core": "0.0.
|
|
13
|
-
"@trackunit/ui-design-tokens": "0.0.
|
|
14
|
-
"@trackunit/ui-icons": "0.0.
|
|
11
|
+
"@trackunit/css-class-variance-utilities": "0.0.13-alpha-f3842b2375.0",
|
|
12
|
+
"@trackunit/css-core": "0.0.94-alpha-f3842b2375.0",
|
|
13
|
+
"@trackunit/ui-design-tokens": "0.0.76-alpha-f3842b2375.0",
|
|
14
|
+
"@trackunit/ui-icons": "0.0.74-alpha-f3842b2375.0",
|
|
15
15
|
"date-fns": "2.29.3",
|
|
16
16
|
"lodash": "4.17.21",
|
|
17
17
|
"react": "18.2.0",
|
|
@@ -1,14 +1,262 @@
|
|
|
1
1
|
import { ActivityColors, CriticalityColors, GeneralColors, IntentColors, RentalStatusColors, SitesColors, UtilizationColors } from "@trackunit/ui-design-tokens";
|
|
2
|
-
import {
|
|
2
|
+
import { IconName } from "@trackunit/ui-icons";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { CommonProps, Size } from "../../common/CommonProps";
|
|
5
5
|
export type IconColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors | UtilizationColors | SitesColors | RentalStatusColors;
|
|
6
|
+
export declare const iconPalette: {
|
|
7
|
+
ON_RENT: {
|
|
8
|
+
readonly 100: "223 244 254";
|
|
9
|
+
readonly 600: "90 200 250";
|
|
10
|
+
};
|
|
11
|
+
RETURNED: {
|
|
12
|
+
readonly 100: "230 202 255";
|
|
13
|
+
readonly 600: "176 90 255";
|
|
14
|
+
};
|
|
15
|
+
AVAILABLE: {
|
|
16
|
+
readonly 100: "206 255 232";
|
|
17
|
+
readonly 600: "0 166 88";
|
|
18
|
+
};
|
|
19
|
+
PICKUP_READY: {
|
|
20
|
+
readonly 100: "255 236 209";
|
|
21
|
+
readonly 600: "255 149 0";
|
|
22
|
+
};
|
|
23
|
+
TRANSFER: {
|
|
24
|
+
readonly 100: "255 248 217";
|
|
25
|
+
readonly 600: "253 208 8";
|
|
26
|
+
};
|
|
27
|
+
IN_REPAIR: {
|
|
28
|
+
readonly 100: "255 233 233";
|
|
29
|
+
readonly 600: "255 90 90";
|
|
30
|
+
};
|
|
31
|
+
OTHER_RENTAL_STATUS: {
|
|
32
|
+
readonly 100: "238 239 239";
|
|
33
|
+
readonly 600: "151 154 154";
|
|
34
|
+
};
|
|
35
|
+
SITE: {
|
|
36
|
+
readonly AREA: "37 99 235";
|
|
37
|
+
readonly CLASSIC_POI: "115 115 115";
|
|
38
|
+
readonly CLASSIC_ZONE: "115 115 115";
|
|
39
|
+
readonly DEPOT: "16 185 129";
|
|
40
|
+
readonly WORK_PLACE: "124 58 237";
|
|
41
|
+
readonly CONSTRUCTION_SITE: "245 158 11";
|
|
42
|
+
readonly UNKNOWN: "115 115 115";
|
|
43
|
+
};
|
|
44
|
+
UNUSED: {
|
|
45
|
+
readonly 300: "252 165 165";
|
|
46
|
+
readonly 400: "248 113 113";
|
|
47
|
+
};
|
|
48
|
+
UTILIZED: {
|
|
49
|
+
readonly 400: "96 165 250";
|
|
50
|
+
readonly 600: "37 99 235";
|
|
51
|
+
};
|
|
52
|
+
HEAVILY_UTILIZED: {
|
|
53
|
+
readonly 300: "252 211 77";
|
|
54
|
+
readonly 500: "245 158 11";
|
|
55
|
+
};
|
|
56
|
+
UNKNOWN_UTILIZATION: {
|
|
57
|
+
readonly 300: "212 212 212";
|
|
58
|
+
readonly 600: "82 82 82";
|
|
59
|
+
};
|
|
60
|
+
WORKING: {
|
|
61
|
+
readonly 50: "239 246 255";
|
|
62
|
+
readonly 100: "219 234 254";
|
|
63
|
+
readonly 200: "191 219 254";
|
|
64
|
+
readonly 300: "147 197 253";
|
|
65
|
+
readonly 400: "96 165 250";
|
|
66
|
+
readonly 500: "59 130 246";
|
|
67
|
+
readonly 600: "37 99 235";
|
|
68
|
+
readonly 700: "29 78 216";
|
|
69
|
+
readonly 800: "30 64 175";
|
|
70
|
+
readonly 900: "30 58 138";
|
|
71
|
+
};
|
|
72
|
+
IDLE: {
|
|
73
|
+
readonly 50: "255 247 237";
|
|
74
|
+
readonly 100: "255 237 213";
|
|
75
|
+
readonly 200: "254 215 170";
|
|
76
|
+
readonly 300: "253 186 116";
|
|
77
|
+
readonly 400: "251 146 60";
|
|
78
|
+
readonly 500: "249 115 22";
|
|
79
|
+
readonly 600: "234 88 12";
|
|
80
|
+
readonly 700: "194 65 12";
|
|
81
|
+
readonly 800: "154 52 18";
|
|
82
|
+
readonly 900: "124 45 18";
|
|
83
|
+
};
|
|
84
|
+
STOPPED: {
|
|
85
|
+
readonly 50: "245 243 255";
|
|
86
|
+
readonly 100: "237 233 254";
|
|
87
|
+
readonly 200: "221 214 254";
|
|
88
|
+
readonly 300: "196 181 253";
|
|
89
|
+
readonly 400: "167 139 250";
|
|
90
|
+
readonly 500: "139 92 246";
|
|
91
|
+
readonly 600: "124 58 237";
|
|
92
|
+
readonly 700: "109 40 217";
|
|
93
|
+
readonly 800: "91 33 182";
|
|
94
|
+
readonly 900: "76 29 149";
|
|
95
|
+
};
|
|
96
|
+
UNKNOWN: {
|
|
97
|
+
readonly 50: "250 250 250";
|
|
98
|
+
readonly 100: "245 245 245";
|
|
99
|
+
readonly 200: "229 229 229";
|
|
100
|
+
readonly 300: "212 212 212";
|
|
101
|
+
readonly 400: "163 163 163";
|
|
102
|
+
readonly 500: "115 115 115";
|
|
103
|
+
readonly 600: "82 82 82";
|
|
104
|
+
readonly 700: "64 64 64";
|
|
105
|
+
readonly 800: "38 38 38";
|
|
106
|
+
readonly 900: "23 23 23";
|
|
107
|
+
};
|
|
108
|
+
MOVING: {
|
|
109
|
+
readonly DEFAULT: "230 144 177";
|
|
110
|
+
};
|
|
111
|
+
ACTIVE: {
|
|
112
|
+
readonly DEFAULT: "63 219 147";
|
|
113
|
+
};
|
|
114
|
+
GOOD: {
|
|
115
|
+
readonly 50: "236 253 245";
|
|
116
|
+
readonly 100: "209 250 229";
|
|
117
|
+
readonly 200: "167 243 208";
|
|
118
|
+
readonly 300: "110 231 183";
|
|
119
|
+
readonly 400: "52 211 153";
|
|
120
|
+
readonly 500: "16 185 129";
|
|
121
|
+
readonly 600: "5 150 105";
|
|
122
|
+
readonly 700: "4 120 87";
|
|
123
|
+
readonly 800: "6 95 70";
|
|
124
|
+
readonly 900: "6 78 59";
|
|
125
|
+
};
|
|
126
|
+
LOW: {
|
|
127
|
+
readonly 50: "255 251 235";
|
|
128
|
+
readonly 100: "254 243 199";
|
|
129
|
+
readonly 200: "253 230 138";
|
|
130
|
+
readonly 300: "252 211 77";
|
|
131
|
+
readonly 400: "251 191 36";
|
|
132
|
+
readonly 500: "245 158 11";
|
|
133
|
+
readonly 600: "217 119 6";
|
|
134
|
+
readonly 700: "180 83 9";
|
|
135
|
+
readonly 800: "146 64 14";
|
|
136
|
+
readonly 900: "120 53 15";
|
|
137
|
+
};
|
|
138
|
+
CRITICAL: {
|
|
139
|
+
readonly 50: "254 242 242";
|
|
140
|
+
readonly 100: "254 226 226";
|
|
141
|
+
readonly 200: "254 202 202";
|
|
142
|
+
readonly 300: "252 165 165";
|
|
143
|
+
readonly 400: "248 113 113";
|
|
144
|
+
readonly 500: "239 68 68";
|
|
145
|
+
readonly 600: "220 38 38";
|
|
146
|
+
readonly 700: "185 28 28";
|
|
147
|
+
readonly 800: "153 27 27";
|
|
148
|
+
readonly 900: "127 29 29";
|
|
149
|
+
};
|
|
150
|
+
PRIMARY: {
|
|
151
|
+
readonly 50: "239 246 255";
|
|
152
|
+
readonly 100: "219 234 254";
|
|
153
|
+
readonly 200: "191 219 254";
|
|
154
|
+
readonly 300: "147 197 253";
|
|
155
|
+
readonly 400: "96 165 250";
|
|
156
|
+
readonly 500: "59 130 246";
|
|
157
|
+
readonly 600: "37 99 235";
|
|
158
|
+
readonly 700: "29 78 216";
|
|
159
|
+
readonly 800: "30 64 175";
|
|
160
|
+
readonly 900: "30 58 138";
|
|
161
|
+
};
|
|
162
|
+
SECONDARY: {
|
|
163
|
+
readonly 50: "248 250 252";
|
|
164
|
+
readonly 100: "241 245 249";
|
|
165
|
+
readonly 200: "226 232 240";
|
|
166
|
+
readonly 300: "203 213 225";
|
|
167
|
+
readonly 400: "148 163 184";
|
|
168
|
+
readonly 500: "100 116 139";
|
|
169
|
+
readonly 600: "71 85 105";
|
|
170
|
+
readonly 700: "51 65 85";
|
|
171
|
+
readonly 800: "30 41 59";
|
|
172
|
+
readonly 900: "15 23 42";
|
|
173
|
+
};
|
|
174
|
+
ACCENT: {
|
|
175
|
+
readonly 50: "236 254 255";
|
|
176
|
+
readonly 100: "207 250 254";
|
|
177
|
+
readonly 200: "165 243 252";
|
|
178
|
+
readonly 300: "103 232 249";
|
|
179
|
+
readonly 400: "34 211 238";
|
|
180
|
+
readonly 500: "6 182 212";
|
|
181
|
+
readonly 600: "8 145 178";
|
|
182
|
+
readonly 700: "14 116 144";
|
|
183
|
+
readonly 800: "21 94 117";
|
|
184
|
+
readonly 900: "22 78 99";
|
|
185
|
+
};
|
|
186
|
+
NEUTRAL: {
|
|
187
|
+
readonly 50: "250 250 250";
|
|
188
|
+
readonly 100: "245 245 245";
|
|
189
|
+
readonly 200: "229 229 229";
|
|
190
|
+
readonly 300: "212 212 212";
|
|
191
|
+
readonly 400: "163 163 163";
|
|
192
|
+
readonly 500: "115 115 115";
|
|
193
|
+
readonly 600: "82 82 82";
|
|
194
|
+
readonly 700: "64 64 64";
|
|
195
|
+
readonly 800: "38 38 38";
|
|
196
|
+
readonly 900: "23 23 23";
|
|
197
|
+
};
|
|
198
|
+
BLACK: {
|
|
199
|
+
readonly DEFAULT: "26 27 28";
|
|
200
|
+
};
|
|
201
|
+
WHITE: {
|
|
202
|
+
readonly DEFAULT: "255 255 255";
|
|
203
|
+
};
|
|
204
|
+
INFO: {
|
|
205
|
+
readonly 50: "239 246 255";
|
|
206
|
+
readonly 100: "219 234 254";
|
|
207
|
+
readonly 200: "191 219 254";
|
|
208
|
+
readonly 300: "147 197 253";
|
|
209
|
+
readonly 400: "96 165 250";
|
|
210
|
+
readonly 500: "59 130 246";
|
|
211
|
+
readonly 600: "37 99 235";
|
|
212
|
+
readonly 700: "29 78 216";
|
|
213
|
+
readonly 800: "30 64 175";
|
|
214
|
+
readonly 900: "30 58 138";
|
|
215
|
+
};
|
|
216
|
+
SUCCESS: {
|
|
217
|
+
readonly 50: "240 253 244";
|
|
218
|
+
readonly 100: "220 252 231";
|
|
219
|
+
readonly 200: "187 247 208";
|
|
220
|
+
readonly 300: "134 239 172";
|
|
221
|
+
readonly 400: "74 222 128";
|
|
222
|
+
readonly 500: "34 197 94";
|
|
223
|
+
readonly 600: "22 163 74";
|
|
224
|
+
readonly 700: "21 128 61";
|
|
225
|
+
readonly 800: "22 101 52";
|
|
226
|
+
readonly 900: "20 83 45";
|
|
227
|
+
};
|
|
228
|
+
WARNING: {
|
|
229
|
+
readonly 50: "255 251 235";
|
|
230
|
+
readonly 100: "254 243 199";
|
|
231
|
+
readonly 200: "253 230 138";
|
|
232
|
+
readonly 300: "252 211 77";
|
|
233
|
+
readonly 400: "251 191 36";
|
|
234
|
+
readonly 500: "245 158 11";
|
|
235
|
+
readonly 600: "217 119 6";
|
|
236
|
+
readonly 700: "180 83 9";
|
|
237
|
+
readonly 800: "146 64 14";
|
|
238
|
+
readonly 900: "120 53 15";
|
|
239
|
+
};
|
|
240
|
+
DANGER: {
|
|
241
|
+
readonly 50: "254 242 242";
|
|
242
|
+
readonly 100: "254 226 226";
|
|
243
|
+
readonly 200: "254 202 202";
|
|
244
|
+
readonly 300: "252 165 165";
|
|
245
|
+
readonly 400: "248 113 113";
|
|
246
|
+
readonly 500: "239 68 68";
|
|
247
|
+
readonly 600: "220 38 38";
|
|
248
|
+
readonly 700: "185 28 28";
|
|
249
|
+
readonly 800: "153 27 27";
|
|
250
|
+
readonly 900: "127 29 29";
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export declare const iconColorNames: ("info" | "success" | "warning" | "danger" | "primary" | "secondary" | "accent" | "neutral" | "black" | "white" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "unknown" | "moving" | "active" | "unused" | "utilized" | "heavily_utilized" | "unknown_utilization" | "site" | "on_rent" | "returned" | "available" | "pickup_ready" | "transfer" | "in_repair" | "other_rental_status")[];
|
|
6
254
|
export interface IconProps extends CommonProps {
|
|
7
255
|
/**
|
|
8
256
|
* The name of the icon to be rendered.
|
|
9
257
|
* HeroIconName and TrackunitIconName are supported.
|
|
10
258
|
*/
|
|
11
|
-
name:
|
|
259
|
+
name: IconName;
|
|
12
260
|
/**
|
|
13
261
|
* The color of the icon.
|
|
14
262
|
* Supports any colors from the theme.
|
|
@@ -44,7 +292,7 @@ export interface IconProps extends CommonProps {
|
|
|
44
292
|
/**
|
|
45
293
|
* - The Icon component is used to display an Icon.
|
|
46
294
|
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
47
|
-
* - All the [HeroIcons](https://heroicons.dev/) as well as custom
|
|
295
|
+
* - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
|
|
48
296
|
*
|
|
49
297
|
* @param {IconProps} props - The props for the Icon component
|
|
50
298
|
* @returns {JSX.Element} Icon component
|