@trackunit/react-components 0.1.151-alpha-d7497395ac.0 → 0.1.151

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
@@ -6,9 +6,9 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
7
  var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
8
8
  var uiIcons = require('@trackunit/ui-icons');
9
+ var uiDesignTokens = require('@trackunit/ui-design-tokens');
9
10
  var ReactDOM = require('react-dom');
10
11
  var reactRouterDom = require('react-router-dom');
11
- var uiDesignTokens = require('@trackunit/ui-design-tokens');
12
12
 
13
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
14
 
@@ -387,6 +387,32 @@ const cvaIcon = cssClassVarianceUtilities.cvaMerge(["aspect-square", "inline-gri
387
387
  default: "text-current",
388
388
  black: "text-black",
389
389
  white: "text-white",
390
+ unused: {
391
+ 300: "text-red-300",
392
+ 400: "text-red-400",
393
+ },
394
+ utilized: { 400: "text-blue-400", 600: "text-blue-600" },
395
+ heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
396
+ unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
397
+ site: {
398
+ area: "text-blue-600",
399
+ classic_poi: "text-neutral-500",
400
+ classic_zone: "text-neutral-500",
401
+ depot: "text-emerald-500",
402
+ work_place: "text-violet-600",
403
+ construction_site: "text-amber-500",
404
+ unknown: "text-neutral-500",
405
+ },
406
+ on_rent: { 100: uiDesignTokens.rentalStatusPalette.ON_RENT[100], 600: uiDesignTokens.rentalStatusPalette.ON_RENT[600] },
407
+ returned: { 100: uiDesignTokens.rentalStatusPalette.RETURNED[100], 600: uiDesignTokens.rentalStatusPalette.RETURNED[600] },
408
+ available: { 100: uiDesignTokens.rentalStatusPalette.AVAILABLE[100], 600: uiDesignTokens.rentalStatusPalette.AVAILABLE[600] },
409
+ pickup_ready: { 100: uiDesignTokens.rentalStatusPalette.PICKUP_READY[100], 600: uiDesignTokens.rentalStatusPalette.PICKUP_READY[600] },
410
+ transfer: { 100: uiDesignTokens.rentalStatusPalette.TRANSFER[100], 600: uiDesignTokens.rentalStatusPalette.TRANSFER[600] },
411
+ in_repair: { 100: uiDesignTokens.rentalStatusPalette.IN_REPAIR[100], 600: uiDesignTokens.rentalStatusPalette.IN_REPAIR[600] },
412
+ other_rental_status: {
413
+ 100: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
414
+ 600: uiDesignTokens.rentalStatusPalette.OTHER_RENTAL_STATUS[100],
415
+ },
390
416
  },
391
417
  size: {
392
418
  small: "w-4",
@@ -651,6 +677,7 @@ const cvaBadge = cssClassVarianceUtilities.cvaMerge([
651
677
  color: {
652
678
  primary: "bg-primary-600 text-white",
653
679
  danger: "bg-danger-700 text-white",
680
+ warning: "bg-warning-700 text-white",
654
681
  },
655
682
  },
656
683
  defaultVariants: {
@@ -18927,14 +18954,16 @@ const EmptyState = ({ title, description, altText, image, customImageSrc, action
18927
18954
  return (jsxRuntime.jsx("div", { className: `${cvaContainerStyles()} ${className}`, "data-testid": dataTestId !== null && dataTestId !== void 0 ? dataTestId : "empty-state", children: loading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spinner, { dataTestId: "spinner", size: "large", centering: "centered" }), jsxRuntime.jsx(SkeletonLines, { dataTestId: "skeleton-lines", width: 50 })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { className: cvaImgStyles(), width: 200, height: 200, src: customImageSrc ? customImageSrc : imageSource, alt: altText }), jsxRuntime.jsxs("div", { className: cvaTextStyles(), children: [jsxRuntime.jsx(Heading, { variant: "secondary", children: title }), jsxRuntime.jsx(Text, { align: "center", children: description })] }), action] })) }));
18928
18955
  };
18929
18956
 
18957
+ const cvaExternalLink = cssClassVarianceUtilities.cvaMerge(["underline", "text-primary-600", "hover:text-primary-500"]);
18958
+
18930
18959
  /**
18931
18960
  * The external link component is used to link to an external page outside the Trackunit Manager.
18932
18961
  *
18933
18962
  * @param {ExternalLinkProps} props - The props for the external link component
18934
18963
  * @returns {JSX.Element} External Link component
18935
18964
  */
18936
- const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, dataTestId, }) => {
18937
- return (jsxRuntime.jsx("a", { "data-testid": dataTestId, className: className, title: title, href: href, rel: rel, target: target, children: children }));
18965
+ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, dataTestId, onClick, }) => {
18966
+ return (jsxRuntime.jsx("a", { onClick: onClick, "data-testid": dataTestId, className: cvaExternalLink({ className }), title: title, href: href, rel: rel, target: target, children: children }));
18938
18967
  };
18939
18968
 
18940
18969
  const cvaTooltipFlexContainer = cssClassVarianceUtilities.cvaMerge("inline-flex");
@@ -19155,7 +19184,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, focused, p
19155
19184
  const cvaMenuList = cssClassVarianceUtilities.cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
19156
19185
  variants: {
19157
19186
  stickyHeader: {
19158
- true: "grid grid-rows-min-fr !p-0",
19187
+ true: "grid grid-rows-min-fr !p-0 overflow-y-hidden",
19159
19188
  false: "",
19160
19189
  },
19161
19190
  },
package/index.esm.js CHANGED
@@ -3,10 +3,10 @@ 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
5
  import { HeroIconsArray, heroIconLookup, TrackunitSolidIconsArray, TrackunitOutlineIconsArray, trackunitIconLookup } from '@trackunit/ui-icons';
6
+ import { rentalStatusPalette, color } from '@trackunit/ui-design-tokens';
6
7
  import * as ReactDOM from 'react-dom';
7
8
  import ReactDOM__default, { createPortal } from 'react-dom';
8
9
  import { UNSAFE_NavigationContext } from 'react-router-dom';
9
- import { color } from '@trackunit/ui-design-tokens';
10
10
 
11
11
  const docs = {
12
12
  source: {
@@ -360,6 +360,32 @@ const cvaIcon = cvaMerge(["aspect-square", "inline-grid", "relative"], {
360
360
  default: "text-current",
361
361
  black: "text-black",
362
362
  white: "text-white",
363
+ unused: {
364
+ 300: "text-red-300",
365
+ 400: "text-red-400",
366
+ },
367
+ utilized: { 400: "text-blue-400", 600: "text-blue-600" },
368
+ heavily_utilized: { 300: "text-amber-300", 500: "text-amber-500" },
369
+ unknown_utilization: { 300: "text-neutral-300", 600: "text-neutral-600" },
370
+ site: {
371
+ area: "text-blue-600",
372
+ classic_poi: "text-neutral-500",
373
+ classic_zone: "text-neutral-500",
374
+ depot: "text-emerald-500",
375
+ work_place: "text-violet-600",
376
+ construction_site: "text-amber-500",
377
+ unknown: "text-neutral-500",
378
+ },
379
+ on_rent: { 100: rentalStatusPalette.ON_RENT[100], 600: rentalStatusPalette.ON_RENT[600] },
380
+ returned: { 100: rentalStatusPalette.RETURNED[100], 600: rentalStatusPalette.RETURNED[600] },
381
+ available: { 100: rentalStatusPalette.AVAILABLE[100], 600: rentalStatusPalette.AVAILABLE[600] },
382
+ pickup_ready: { 100: rentalStatusPalette.PICKUP_READY[100], 600: rentalStatusPalette.PICKUP_READY[600] },
383
+ transfer: { 100: rentalStatusPalette.TRANSFER[100], 600: rentalStatusPalette.TRANSFER[600] },
384
+ in_repair: { 100: rentalStatusPalette.IN_REPAIR[100], 600: rentalStatusPalette.IN_REPAIR[600] },
385
+ other_rental_status: {
386
+ 100: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
387
+ 600: rentalStatusPalette.OTHER_RENTAL_STATUS[100],
388
+ },
363
389
  },
364
390
  size: {
365
391
  small: "w-4",
@@ -624,6 +650,7 @@ const cvaBadge = cvaMerge([
624
650
  color: {
625
651
  primary: "bg-primary-600 text-white",
626
652
  danger: "bg-danger-700 text-white",
653
+ warning: "bg-warning-700 text-white",
627
654
  },
628
655
  },
629
656
  defaultVariants: {
@@ -18900,14 +18927,16 @@ const EmptyState = ({ title, description, altText, image, customImageSrc, action
18900
18927
  return (jsx("div", { className: `${cvaContainerStyles()} ${className}`, "data-testid": dataTestId !== null && dataTestId !== void 0 ? dataTestId : "empty-state", children: loading ? (jsxs(Fragment, { children: [jsx(Spinner, { dataTestId: "spinner", size: "large", centering: "centered" }), jsx(SkeletonLines, { dataTestId: "skeleton-lines", width: 50 })] })) : (jsxs(Fragment, { children: [jsx("img", { className: cvaImgStyles(), width: 200, height: 200, src: customImageSrc ? customImageSrc : imageSource, alt: altText }), jsxs("div", { className: cvaTextStyles(), children: [jsx(Heading, { variant: "secondary", children: title }), jsx(Text, { align: "center", children: description })] }), action] })) }));
18901
18928
  };
18902
18929
 
18930
+ const cvaExternalLink = cvaMerge(["underline", "text-primary-600", "hover:text-primary-500"]);
18931
+
18903
18932
  /**
18904
18933
  * The external link component is used to link to an external page outside the Trackunit Manager.
18905
18934
  *
18906
18935
  * @param {ExternalLinkProps} props - The props for the external link component
18907
18936
  * @returns {JSX.Element} External Link component
18908
18937
  */
18909
- const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, dataTestId, }) => {
18910
- return (jsx("a", { "data-testid": dataTestId, className: className, title: title, href: href, rel: rel, target: target, children: children }));
18938
+ const ExternalLink = ({ rel = "noreferrer", target = "_blank", href, className, children = href, title = href, dataTestId, onClick, }) => {
18939
+ return (jsx("a", { onClick: onClick, "data-testid": dataTestId, className: cvaExternalLink({ className }), title: title, href: href, rel: rel, target: target, children: children }));
18911
18940
  };
18912
18941
 
18913
18942
  const cvaTooltipFlexContainer = cvaMerge("inline-flex");
@@ -19128,7 +19157,7 @@ const MenuItem = ({ className, dataTestId, label, children, selected, focused, p
19128
19157
  const cvaMenuList = cvaMerge(["shadow-md", "rounded-lg", "z-20", "bg-white", "p-1", "border", "border-slate-300", "gap-1", "grid"], {
19129
19158
  variants: {
19130
19159
  stickyHeader: {
19131
- true: "grid grid-rows-min-fr !p-0",
19160
+ true: "grid grid-rows-min-fr !p-0 overflow-y-hidden",
19132
19161
  false: "",
19133
19162
  },
19134
19163
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.151-alpha-d7497395ac.0",
3
+ "version": "0.1.151",
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.13-alpha-d7497395ac.0",
12
- "@trackunit/css-core": "0.0.94-alpha-d7497395ac.0",
13
- "@trackunit/ui-design-tokens": "0.0.76-alpha-d7497395ac.0",
14
- "@trackunit/ui-icons": "0.0.74-alpha-d7497395ac.0",
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",
15
15
  "date-fns": "2.29.3",
16
16
  "lodash": "4.17.21",
17
17
  "react": "18.2.0",
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ThemeColors } from "@trackunit/ui-design-tokens";
3
3
  import { CommonProps } from "../../common/CommonProps";
4
- type BadgeColors = Extract<ThemeColors, "primary" | "danger">;
4
+ type BadgeColors = Extract<ThemeColors, "primary" | "danger" | "warning">;
5
5
  interface BaseBadgeProps extends CommonProps {
6
6
  /**
7
7
  * The color of the badge.
@@ -26,6 +26,10 @@ interface BaseBadgeProps extends CommonProps {
26
26
  * If enabled the badge is shown even if the count is 0.
27
27
  */
28
28
  hideZero?: boolean;
29
+ /**
30
+ * Child nodes.
31
+ */
32
+ children?: React.ReactNode;
29
33
  }
30
34
  export type BadgeProps = BaseBadgeProps;
31
35
  /**
@@ -1,3 +1,3 @@
1
1
  export declare const cvaBadge: (props?: ({
2
- color?: "primary" | "danger" | null | undefined;
2
+ color?: "primary" | "danger" | "warning" | null | undefined;
3
3
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -21,6 +21,7 @@ export interface ExternalLinkProps extends CommonProps {
21
21
  * Used to specify the relationship between the link and the current document. Defaults to "noreferrer".
22
22
  */
23
23
  rel?: string;
24
+ onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
24
25
  }
25
26
  /**
26
27
  * The external link component is used to link to an external page outside the Trackunit Manager.
@@ -28,4 +29,4 @@ export interface ExternalLinkProps extends CommonProps {
28
29
  * @param {ExternalLinkProps} props - The props for the external link component
29
30
  * @returns {JSX.Element} External Link component
30
31
  */
31
- export declare const ExternalLink: ({ rel, target, href, className, children, title, dataTestId, }: ExternalLinkProps) => JSX.Element;
32
+ export declare const ExternalLink: ({ rel, target, href, className, children, title, dataTestId, onClick, }: ExternalLinkProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const cvaExternalLink: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -1,8 +1,8 @@
1
- import { ActivityColors, CriticalityColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
1
+ import { ActivityColors, CriticalityColors, GeneralColors, IntentColors, RentalStatusColors, SitesColors, UtilizationColors } from "@trackunit/ui-design-tokens";
2
2
  import { HeroIconName, TrackunitIconName } from "@trackunit/ui-icons";
3
3
  import * as React from "react";
4
4
  import { CommonProps, Size } from "../../common/CommonProps";
5
- export type IconColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors;
5
+ export type IconColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors | UtilizationColors | SitesColors | RentalStatusColors;
6
6
  export interface IconProps extends CommonProps {
7
7
  /**
8
8
  * The name of the icon to be rendered.
@@ -1,5 +1,5 @@
1
1
  export declare const cvaIcon: (props?: ({
2
- color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "moving" | "active" | "stopped" | "unknown" | "default" | "black" | "white" | null | undefined;
2
+ color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "moving" | "active" | "stopped" | "unknown" | "default" | "black" | "white" | "unused" | "utilized" | "heavily_utilized" | "unknown_utilization" | "site" | "on_rent" | "returned" | "available" | "pickup_ready" | "transfer" | "in_repair" | "other_rental_status" | null | undefined;
3
3
  size?: "small" | "medium" | "large" | "font" | null | undefined;
4
4
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
5
  export declare const cvaIconComponent: (props?: ({