@trackunit/react-components 0.1.152 → 0.1.153-alpha-48d16c736e.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 CHANGED
@@ -5,8 +5,8 @@ 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
10
  var ReactDOM = require('react-dom');
11
11
  var reactRouterDom = require('react-router-dom');
12
12
 
@@ -426,7 +426,7 @@ const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-gri
426
426
  size: "large",
427
427
  },
428
428
  });
429
- const cvaIconComponent = cssClassVarianceUtilities.cvaMerge([], {
429
+ cssClassVarianceUtilities.cvaMerge([], {
430
430
  variants: {
431
431
  iconType: {
432
432
  solid: "fill-current stroke-transparent",
@@ -434,7 +434,7 @@ const cvaIconComponent = cssClassVarianceUtilities.cvaMerge([], {
434
434
  },
435
435
  },
436
436
  });
437
- const cvaLoadingDot = cssClassVarianceUtilities.cvaMerge([
437
+ cssClassVarianceUtilities.cvaMerge([
438
438
  "relative",
439
439
  "aspect-square",
440
440
  "after:content-['']",
@@ -449,30 +449,27 @@ const cvaLoadingDot = cssClassVarianceUtilities.cvaMerge([
449
449
  "after:opacity-50",
450
450
  ]);
451
451
 
452
+ 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);
453
+ const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This is uses the object in the Object.keys() to infer the type of the keys.
452
454
  /**
453
455
  * - The Icon component is used to display an Icon.
454
456
  * - 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 TrackUnit icons are available.
457
+ * - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
456
458
  *
457
459
  * @param {IconProps} props - The props for the Icon component
458
460
  * @returns {JSX.Element} Icon component
459
461
  */
460
462
  const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
461
463
  const correctIconType = React__namespace.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
462
- let IconComponent = null;
463
- if (uiIcons.HeroIconsArray.find(icon => icon === name)) {
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) {
464
+ const iconName = uiIcons.iconNames[name];
465
+ if (!iconName) {
471
466
  return null;
472
467
  }
473
- return (jsxRuntime.jsx(React__namespace.Suspense, { fallback: jsxRuntime.jsx("span", { className: cvaLoadingDot(), "data-testid": dataTestId }), children: jsxRuntime.jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsxRuntime.jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: cvaIconComponent({
474
- iconType: correctIconType,
475
- }), style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) }) }));
468
+ const href = {
469
+ solid: `${uiIcons.IconSpriteSolid}#${iconName}`,
470
+ outline: `${uiIcons.IconSpriteOutline}#${iconName}`,
471
+ };
472
+ 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
473
  };
477
474
 
478
475
  /**
@@ -482,7 +479,7 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
482
479
  * @returns {JSX.Element} StarButton component
483
480
  */
484
481
  const StarButton = ({ starred, onClick }) => {
485
- return (jsxRuntime.jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsxRuntime.jsx(Icon, { name: "StarIcon", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) }));
482
+ 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
483
  };
487
484
 
488
485
  const cvaText = cssClassVarianceUtilities.cvaMerge(["m-0", "relative", "text-sm", "font-normal"], {
@@ -624,13 +621,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
624
621
  const getIconFromColor = () => {
625
622
  switch (color) {
626
623
  case "danger":
627
- return jsxRuntime.jsx(Icon, { name: "ExclamationTriangleIcon", color: "danger" });
624
+ return jsxRuntime.jsx(Icon, { name: "ExclamationTriangle", color: "danger" });
628
625
  case "warning":
629
- return jsxRuntime.jsx(Icon, { name: "ExclamationCircleIcon", color: "warning" });
626
+ return jsxRuntime.jsx(Icon, { name: "ExclamationCircle", color: "warning" });
630
627
  case "success":
631
- return jsxRuntime.jsx(Icon, { name: "CheckCircleIcon", color: "success" });
628
+ return jsxRuntime.jsx(Icon, { name: "CheckCircle", color: "success" });
632
629
  default:
633
- return jsxRuntime.jsx(Icon, { name: "InformationCircleIcon" });
630
+ return jsxRuntime.jsx(Icon, { name: "InformationCircle" });
634
631
  }
635
632
  };
636
633
  const getButtonColor = () => {
@@ -650,7 +647,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
650
647
  }
651
648
  }, [ref, autoScroll]);
652
649
  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: "XMarkIcon", 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: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) })) : null] }))] })] }));
650
+ 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
651
  };
655
652
 
656
653
  const cvaBadge = cssClassVarianceUtilities.cvaMerge([
@@ -882,7 +879,7 @@ const Heading = (_a) => {
882
879
  * @returns {JSX.Element} CardHeader component
883
880
  */
884
881
  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: "XMarkIcon", size: "small" }), className: "!h-min" }))] }) }));
882
+ 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
883
  };
887
884
 
888
885
  function useMountedState() {
@@ -1221,7 +1218,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, layo
1221
1218
  }
1222
1219
  setExpanded(!expanded);
1223
1220
  }, [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: "ChevronDownIcon", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] }) }), jsxRuntime.jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
1221
+ 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
1222
  };
1226
1223
  const Collapsible = ({ children, expanded, id }) => {
1227
1224
  const [ref, { height }] = useMeasure$1();
@@ -18781,7 +18778,7 @@ const PopoverTrigger = React.forwardRef(function PopoverTrigger(_a, propRef) {
18781
18778
  * @returns {JSX.Element} DayPickerPopover component
18782
18779
  */
18783
18780
  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: "CalendarIcon", 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 }) }) })] }));
18781
+ 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
18782
  };
18786
18783
 
18787
18784
  /**
@@ -36799,7 +36796,7 @@ const cvaMoreMenu = cssClassVarianceUtilities.cvaMerge(["p-4"]);
36799
36796
  */
36800
36797
  const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
36801
36798
  size: "medium",
36802
- name: "EllipsisHorizontalIcon",
36799
+ name: "EllipsisHorizontal",
36803
36800
  }, iconButtonProps = {
36804
36801
  size: "small",
36805
36802
  circular: true,
@@ -37222,7 +37219,7 @@ const Tag = React__namespace.forwardRef((_a, ref) => {
37222
37219
  var { className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false } = _a; __rest$1(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "disabled"]);
37223
37220
  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
37221
  // 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: "XCircleIcon", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) }))] }));
37222
+ 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
37223
  });
37227
37224
 
37228
37225
  const cvaTip = cssClassVarianceUtilities.cvaMerge("flex transition text-slate-300 hover:text-slate-500");
@@ -37246,7 +37243,7 @@ const cvaTipContent = cssClassVarianceUtilities.cvaMerge("p-2 rounded max-w-sm f
37246
37243
  * @returns {JSX.Element} Tip component
37247
37244
  */
37248
37245
  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: "QuestionMarkCircleIcon", 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: "ArrowRightCircleIcon" }) })) : null] }) })] }) }));
37246
+ 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
37247
  };
37251
37248
 
37252
37249
  const cvaPageHeader = cssClassVarianceUtilities.cvaMerge([
@@ -37284,7 +37281,7 @@ const cvaPageHeaderChildContainer = cssClassVarianceUtilities.cvaMerge(["flex",
37284
37281
  * @returns {JSX.Element} PageHeader component
37285
37282
  */
37286
37283
  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: "ArrowLeftIcon" }) })), jsxRuntime.jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsxRuntime.jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircleIcon" }, 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 })] }));
37284
+ 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
37285
  };
37289
37286
 
37290
37287
  const cvaPagination = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "gap-1"]);
@@ -37333,9 +37330,9 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
37333
37330
  if (loading) {
37334
37331
  return (jsxRuntime.jsx("div", { className: cvaPagination({ className }), children: jsxRuntime.jsx(SkeletonLines, { height: 16, width: 150 }) }));
37335
37332
  }
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: "ChevronLeftIcon", 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
37333
+ 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
37334
  ? !canNextPage || false
37338
- : page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsxRuntime.jsx(Icon, { name: "ChevronRightIcon", size: "small" }), size: "small", color: "secondary", variant: "transparent" })] }));
37335
+ : 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
37336
  };
37340
37337
 
37341
37338
  function useConfirmExit(confirmExit, when = true) {
@@ -38917,7 +38914,7 @@ const Timeline = ({ className, dataTestId, children }) => {
38917
38914
  * @param {TimeLineElementProps} props the props
38918
38915
  * @returns {JSX.Element} component
38919
38916
  */
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: "CalendarIcon", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
38917
+ 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
38918
  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
38919
  };
38923
38920
  function defaultHeader(date, showTime) {
@@ -39122,6 +39119,8 @@ exports.cvaMenuItemSuffix = cvaMenuItemSuffix;
39122
39119
  exports.docs = docs;
39123
39120
  exports.getDevicePixelRatio = getDevicePixelRatio;
39124
39121
  exports.getValueBarColorByValue = getValueBarColorByValue;
39122
+ exports.iconColorNames = iconColorNames;
39123
+ exports.iconPalette = iconPalette;
39125
39124
  exports.setLocalStorage = setLocalStorage;
39126
39125
  exports.useClickOutside = useClickOutside;
39127
39126
  exports.useContainerProps = useContainerProps;
package/index.esm.js CHANGED
@@ -2,8 +2,8 @@ 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 { HeroIconsArray, heroIconLookup, TrackunitSolidIconsArray, TrackunitOutlineIconsArray, trackunitIconLookup } from '@trackunit/ui-icons';
6
- import { rentalStatusPalette, color } from '@trackunit/ui-design-tokens';
5
+ import { rentalStatusPalette, intentPalette, generalPalette, criticalityPalette, activityPalette, utilizationPalette, sitesPalette, color } from '@trackunit/ui-design-tokens';
6
+ import { iconNames, IconSpriteSolid, IconSpriteOutline } from '@trackunit/ui-icons';
7
7
  import * as ReactDOM from 'react-dom';
8
8
  import ReactDOM__default, { createPortal } from 'react-dom';
9
9
  import { UNSAFE_NavigationContext } from 'react-router-dom';
@@ -399,7 +399,7 @@ const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
399
399
  size: "large",
400
400
  },
401
401
  });
402
- const cvaIconComponent = cvaMerge([], {
402
+ cvaMerge([], {
403
403
  variants: {
404
404
  iconType: {
405
405
  solid: "fill-current stroke-transparent",
@@ -407,7 +407,7 @@ const cvaIconComponent = cvaMerge([], {
407
407
  },
408
408
  },
409
409
  });
410
- const cvaLoadingDot = cvaMerge([
410
+ cvaMerge([
411
411
  "relative",
412
412
  "aspect-square",
413
413
  "after:content-['']",
@@ -422,30 +422,27 @@ const cvaLoadingDot = cvaMerge([
422
422
  "after:opacity-50",
423
423
  ]);
424
424
 
425
+ const iconPalette = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, intentPalette), generalPalette), criticalityPalette), activityPalette), utilizationPalette), sitesPalette), rentalStatusPalette);
426
+ const iconColorNames = Object.keys(iconPalette).map(key => key.toLowerCase()); // This is uses the object in the Object.keys() to infer the type of the keys.
425
427
  /**
426
428
  * - The Icon component is used to display an Icon.
427
429
  * - 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 TrackUnit icons are available.
430
+ * - All the [HeroIcons](https://heroicons.dev/) as well as custom Trackunit icons are available.
429
431
  *
430
432
  * @param {IconProps} props - The props for the Icon component
431
433
  * @returns {JSX.Element} Icon component
432
434
  */
433
435
  const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }) => {
434
436
  const correctIconType = React.useMemo(() => (type ? type : size === "large" ? "outline" : "solid"), [type, size]);
435
- let IconComponent = null;
436
- if (HeroIconsArray.find(icon => icon === name)) {
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) {
437
+ const iconName = iconNames[name];
438
+ if (!iconName) {
444
439
  return null;
445
440
  }
446
- return (jsx(React.Suspense, { fallback: jsx("span", { className: cvaLoadingDot(), "data-testid": dataTestId }), children: jsx("span", { className: cvaIcon({ color, size, className }), onClick: onClick, "data-testid": dataTestId, ref: forwardedRef, children: jsx(IconComponent, { "data-testid": dataTestId ? `${dataTestId}-${name}` : name, className: cvaIconComponent({
447
- iconType: correctIconType,
448
- }), style: fillColor ? Object.assign(Object.assign({}, style), { fill: fillColor }) : Object.assign({}, style) }) }) }));
441
+ const href = {
442
+ solid: `${IconSpriteSolid}#${iconName}`,
443
+ outline: `${IconSpriteOutline}#${iconName}`,
444
+ };
445
+ 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
446
  };
450
447
 
451
448
  /**
@@ -455,7 +452,7 @@ const Icon = ({ name, size = "large", className, dataTestId, color, onClick, fil
455
452
  * @returns {JSX.Element} StarButton component
456
453
  */
457
454
  const StarButton = ({ starred, onClick }) => {
458
- return (jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsx(Icon, { name: "StarIcon", color: starred ? "primary" : "neutral", type: starred ? "solid" : "outline", size: "medium" }) }));
455
+ 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
456
  };
460
457
 
461
458
  const cvaText = cvaMerge(["m-0", "relative", "text-sm", "font-normal"], {
@@ -597,13 +594,13 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
597
594
  const getIconFromColor = () => {
598
595
  switch (color) {
599
596
  case "danger":
600
- return jsx(Icon, { name: "ExclamationTriangleIcon", color: "danger" });
597
+ return jsx(Icon, { name: "ExclamationTriangle", color: "danger" });
601
598
  case "warning":
602
- return jsx(Icon, { name: "ExclamationCircleIcon", color: "warning" });
599
+ return jsx(Icon, { name: "ExclamationCircle", color: "warning" });
603
600
  case "success":
604
- return jsx(Icon, { name: "CheckCircleIcon", color: "success" });
601
+ return jsx(Icon, { name: "CheckCircle", color: "success" });
605
602
  default:
606
- return jsx(Icon, { name: "InformationCircleIcon" });
603
+ return jsx(Icon, { name: "InformationCircle" });
607
604
  }
608
605
  };
609
606
  const getButtonColor = () => {
@@ -623,7 +620,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
623
620
  }
624
621
  }, [ref, autoScroll]);
625
622
  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: "XMarkIcon", 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: "XMarkIcon", size: "small" }), title: "Close Alert", circular: true }) })) : null] }))] })] }));
623
+ 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
624
  };
628
625
 
629
626
  const cvaBadge = cvaMerge([
@@ -855,7 +852,7 @@ const Heading = (_a) => {
855
852
  * @returns {JSX.Element} CardHeader component
856
853
  */
857
854
  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: "XMarkIcon", size: "small" }), className: "!h-min" }))] }) }));
855
+ 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
856
  };
860
857
 
861
858
  function useMountedState() {
@@ -1194,7 +1191,7 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, layo
1194
1191
  }
1195
1192
  setExpanded(!expanded);
1196
1193
  }, [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: "ChevronDownIcon", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] }) }), jsx(Collapsible, { expanded: expanded, id: id, children: children })] }));
1194
+ 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
1195
  };
1199
1196
  const Collapsible = ({ children, expanded, id }) => {
1200
1197
  const [ref, { height }] = useMeasure$1();
@@ -18754,7 +18751,7 @@ const PopoverTrigger = forwardRef(function PopoverTrigger(_a, propRef) {
18754
18751
  * @returns {JSX.Element} DayPickerPopover component
18755
18752
  */
18756
18753
  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: "CalendarIcon", 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 }) }) })] }));
18754
+ 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
18755
  };
18759
18756
 
18760
18757
  /**
@@ -36772,7 +36769,7 @@ const cvaMoreMenu = cvaMerge(["p-4"]);
36772
36769
  */
36773
36770
  const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
36774
36771
  size: "medium",
36775
- name: "EllipsisHorizontalIcon",
36772
+ name: "EllipsisHorizontal",
36776
36773
  }, iconButtonProps = {
36777
36774
  size: "small",
36778
36775
  circular: true,
@@ -37195,7 +37192,7 @@ const Tag = React.forwardRef((_a, ref) => {
37195
37192
  var { className, dataTestId, children, size = "medium", onClose, color = "primary", disabled = false } = _a; __rest$1(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "disabled"]);
37196
37193
  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
37194
  // a fix for multiselect deselecting tags working together with fade out animation
37198
- jsx("div", { className: cvaTagIconContainer(), onMouseDown: onClose, children: jsx(Icon, { name: "XCircleIcon", dataTestId: dataTestId + "Icon", type: "solid", size: size, style: { WebkitTransition: "-webkit-transform 0.150s" }, className: cvaTagIcon() }) }))] }));
37195
+ 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
37196
  });
37200
37197
 
37201
37198
  const cvaTip = cvaMerge("flex transition text-slate-300 hover:text-slate-500");
@@ -37219,7 +37216,7 @@ const cvaTipContent = cvaMerge("p-2 rounded max-w-sm flex gap-2 items-center tex
37219
37216
  * @returns {JSX.Element} Tip component
37220
37217
  */
37221
37218
  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: "QuestionMarkCircleIcon", 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: "ArrowRightCircleIcon" }) })) : null] }) })] }) }));
37219
+ 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
37220
  };
37224
37221
 
37225
37222
  const cvaPageHeader = cvaMerge([
@@ -37257,7 +37254,7 @@ const cvaPageHeaderChildContainer = cvaMerge(["flex", "flex-wrap", "gap-x-6", "i
37257
37254
  * @returns {JSX.Element} PageHeader component
37258
37255
  */
37259
37256
  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: "ArrowLeftIcon" }) })), jsx("h1", { className: cvaPageHeaderHeading(), "data-testid": dataTestId && `${dataTestId}-heading`, children: title }), description && !showLoading && (jsx(Tip, { dataTestId: dataTestId && `${dataTestId}-tip`, iconProps: { name: "QuestionMarkCircleIcon" }, 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 })] }));
37257
+ 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
37258
  };
37262
37259
 
37263
37260
  const cvaPagination = cvaMerge(["flex", "items-center", "gap-1"]);
@@ -37306,9 +37303,9 @@ const Pagination = ({ previousPage, nextPage, canPreviousPage, canNextPage, page
37306
37303
  if (loading) {
37307
37304
  return (jsx("div", { className: cvaPagination({ className }), children: jsx(SkeletonLines, { height: 16, width: 150 }) }));
37308
37305
  }
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: "ChevronLeftIcon", 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
37306
+ 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
37307
  ? !canNextPage || false
37311
- : page !== undefined && pageCount !== undefined && pageCount !== null && page >= pageCount - 1, "data-testid": "next-page", icon: jsx(Icon, { name: "ChevronRightIcon", size: "small" }), size: "small", color: "secondary", variant: "transparent" })] }));
37308
+ : 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
37309
  };
37313
37310
 
37314
37311
  function useConfirmExit(confirmExit, when = true) {
@@ -38890,7 +38887,7 @@ const Timeline = ({ className, dataTestId, children }) => {
38890
38887
  * @param {TimeLineElementProps} props the props
38891
38888
  * @returns {JSX.Element} component
38892
38889
  */
38893
- const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", headerClassName, dot = jsx(Indicator, { className: "mt-[-1px]", color: "neutral", icon: jsx(Icon, { name: "CalendarIcon", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
38890
+ 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
38891
  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
38892
  };
38896
38893
  function defaultHeader(date, showTime) {
@@ -39033,4 +39030,4 @@ const cvaClickable = cvaMerge([
39033
39030
  },
39034
39031
  });
39035
39032
 
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 };
39033
+ 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.152",
3
+ "version": "0.1.153-alpha-48d16c736e.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",
12
- "@trackunit/css-core": "0.0.93",
13
- "@trackunit/ui-design-tokens": "0.0.75",
14
- "@trackunit/ui-icons": "0.0.73",
11
+ "@trackunit/css-class-variance-utilities": "0.0.13-alpha-48d16c736e.0",
12
+ "@trackunit/css-core": "0.0.94-alpha-48d16c736e.0",
13
+ "@trackunit/ui-design-tokens": "0.0.76-alpha-48d16c736e.0",
14
+ "@trackunit/ui-icons": "0.0.74-alpha-48d16c736e.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 { HeroIconName, TrackunitIconName } from "@trackunit/ui-icons";
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: TrackunitIconName | HeroIconName;
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 TrackUnit icons are available.
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