@trackunit/react-components 0.1.140 → 0.1.144

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
@@ -720,6 +720,32 @@ const cvaCardHeaderDensityContainer = cssClassVarianceUtilities.cvaMerge(["borde
720
720
  border: "default",
721
721
  },
722
722
  });
723
+ const cvaCardDensityContainer = cssClassVarianceUtilities.cvaMerge(["flex"], {
724
+ variants: {
725
+ disableGap: {
726
+ true: "gap-0",
727
+ false: "",
728
+ },
729
+ direction: {
730
+ row: "flex-row",
731
+ "row-reverse": "flex-row-reverse",
732
+ column: "flex-col",
733
+ "column-reverse": "flex-col-reverse",
734
+ },
735
+ density: {
736
+ none: "",
737
+ compact: "gap-3 p-3",
738
+ comfortable: "gap-4 p-4",
739
+ spacious: "gap-4 p-6",
740
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
741
+ },
742
+ },
743
+ defaultVariants: {
744
+ disableGap: false,
745
+ direction: "column",
746
+ density: "auto",
747
+ },
748
+ });
723
749
 
724
750
  const ROLE_CARD = "region";
725
751
  /**
@@ -743,44 +769,8 @@ const Card = (_a) => {
743
769
  * @returns {JSX.Element} DensityContainer component
744
770
  */
745
771
  const DensityContainer = ({ children, className, dataTestId, density, disableGap, direction, }) => {
746
- return (jsxRuntime.jsx(StyledDensityContainer, { "$disableGap": disableGap, "$density": density, "$direction": direction, "data-testid": dataTestId, className: className, children: children }));
747
- };
748
- const getDirection = () => ({ $direction }) => {
749
- $direction = $direction !== null && $direction !== void 0 ? $direction : "column";
750
- const directions = {
751
- row: tailwindStyledComponents.tws `flex-row`,
752
- "row-reverse": tailwindStyledComponents.tws `flex-row-reverse`,
753
- column: tailwindStyledComponents.tws `flex-col`,
754
- "column-reverse": tailwindStyledComponents.tws `flex-col-reverse`,
755
- };
756
- return directions[$direction];
757
- };
758
- const densityAuto = tailwindStyledComponents.tws `
759
- component-card-spacing
760
- sm:component-card-spacing-sm
761
- md:component-card-spacing-md
762
- `;
763
- const DensityFinder = ({ $density }) => {
764
- switch ($density) {
765
- case "none":
766
- return;
767
- case "compact":
768
- return tailwindStyledComponents.tws `gap-3 p-3`;
769
- case "comfortable":
770
- return tailwindStyledComponents.tws `gap-4 p-4`;
771
- case "spacious":
772
- return tailwindStyledComponents.tws `gap-4 p-6`;
773
- case "auto":
774
- default:
775
- return densityAuto;
776
- }
777
- };
778
- const StyledDensityContainer = tailwindStyledComponents.tw.div `
779
- flex
780
- ${getDirection()}
781
- ${p => (p.$disableGap ? tailwindStyledComponents.tws `gap-0` : null)}
782
- ${DensityFinder}
783
- `;
772
+ return (jsxRuntime.jsx("div", { className: cvaCardDensityContainer({ className, disableGap, density, direction }), "data-testid": dataTestId, children: children }));
773
+ };
784
774
 
785
775
  /**
786
776
  * The CardBody component should be used to inform the user of important information.
@@ -18969,6 +18959,7 @@ const cvaIndicatorPing = cssClassVarianceUtilities.cvaMerge(["animate-ping-sm",
18969
18959
  unused: "bg-unused-400",
18970
18960
  utilized: "bg-utilized-600",
18971
18961
  heavily_utilized: "bg-heavily_utilized-500",
18962
+ unknown_utilization: "bg-unknown_utilization-600",
18972
18963
  available: "bg-available-600",
18973
18964
  on_rent: "bg-on_rent-600",
18974
18965
  pickup_ready: "bg-pickup_ready-600",
@@ -19005,6 +18996,7 @@ const cvaIndicatorIconBackground = cssClassVarianceUtilities.cvaMerge(["rounded-
19005
18996
  unused: "bg-unused-300 text-unused-400",
19006
18997
  utilized: "bg-utilized-400 text-utilized-600",
19007
18998
  heavily_utilized: "bg-heavily_utilized-300 text-heavily_utilized-500",
18999
+ unknown_utilization: "bg-unknown_utilization-300 text-unknown_utilization-600",
19008
19000
  available: "bg-available-100 text-available-600",
19009
19001
  on_rent: "bg-on_rent-100 text-on_rent-600",
19010
19002
  pickup_ready: "bg-pickup_ready-100 text-pickup_ready-600",
@@ -38683,16 +38675,8 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
38683
38675
  * @returns {JSX.Element} SectionHeader component
38684
38676
  */
38685
38677
  const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
38686
- return (jsxRuntime.jsxs(SectionHeaderContainer, { children: [jsxRuntime.jsx(q, { children: jsxRuntime.jsx(W, { title: title }) }), jsxRuntime.jsxs(StyledFlex, { className: "flex-row mb-2", children: [jsxRuntime.jsxs(StyledFlex, { className: "flex-col grow", children: [jsxRuntime.jsx(Heading, { variant: "secondary", dataTestId: dataTestId, children: title }), subtitle && (jsxRuntime.jsx(Heading, { variant: "subtitle", subtle: true, children: subtitle }))] }), addons && jsxRuntime.jsx(StyledFlex, { children: addons })] }), jsxRuntime.jsx(Spacer, { size: "small" })] }));
38678
+ return (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(q, { children: jsxRuntime.jsx(W, { title: title }) }), jsxRuntime.jsxs("div", { className: "flex gap-2 flex-row mb-2", children: [jsxRuntime.jsxs("div", { className: "flex gap-2 flex-col grow", children: [jsxRuntime.jsx(Heading, { variant: "secondary", dataTestId: dataTestId, children: title }), subtitle && (jsxRuntime.jsx(Heading, { variant: "subtitle", subtle: true, children: subtitle }))] }), addons && jsxRuntime.jsx("div", { className: "flex gap-2", children: addons })] }), jsxRuntime.jsx(Spacer, { size: "small" })] }));
38687
38679
  };
38688
- const SectionHeaderContainer = tailwindStyledComponents.tw.div `
38689
- flex
38690
- flex-col
38691
- `;
38692
- const StyledFlex = tailwindStyledComponents.tw.div `
38693
- flex
38694
- gap-2
38695
- `;
38696
38680
 
38697
38681
  const cvaSidebar = cssClassVarianceUtilities.cvaMerge(["apply grid", "grid-cols-fr-min", "items-center"]);
38698
38682
  const cvaSidebarChildContainer = cssClassVarianceUtilities.cvaMerge(["apply flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
@@ -38782,9 +38766,9 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
38782
38766
  const overflowItemCount = Object.values(itemOverflowMap).filter(isOverflowing => isOverflowing).length;
38783
38767
  const itemVisibilityClassName = (id) => {
38784
38768
  if (itemOverflowMap[id]) {
38785
- return tailwindStyledComponents.tws `invisible`;
38769
+ return "invisible";
38786
38770
  }
38787
- return tailwindStyledComponents.tws `visible`;
38771
+ return "visible";
38788
38772
  };
38789
38773
  return (jsxRuntime.jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx("div", { ref: overflowContainerRef, className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId && `${dataTestId}-child-container`, children: React__default["default"].Children.map(children, child => {
38790
38774
  return React__default["default"].cloneElement(child, {
@@ -38839,7 +38823,7 @@ const Timeline = ({ className, dataTestId, children }) => {
38839
38823
  * @param {TimeLineElementProps} props the props
38840
38824
  * @returns {JSX.Element} component
38841
38825
  */
38842
- const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", headerClassName, dot = jsxRuntime.jsx(Indicator, { className: tailwindStyledComponents.tws `mt-[-1px]`, color: "neutral", icon: jsxRuntime.jsx(Icon, { name: "CalendarIcon", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
38826
+ 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, }) => {
38843
38827
  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 }) })] }));
38844
38828
  };
38845
38829
  function defaultHeader(date, showTime) {
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  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
- import { tw, tws } from '@trackunit/tailwind-styled-components';
4
+ import { tw } from '@trackunit/tailwind-styled-components';
5
5
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
6
6
  import { HeroIconsArray, heroIconLookup, TrackunitSolidIconsArray, TrackunitOutlineIconsArray, trackunitIconLookup } from '@trackunit/ui-icons';
7
7
  import * as ReactDOM from 'react-dom';
@@ -693,6 +693,32 @@ const cvaCardHeaderDensityContainer = cvaMerge(["border-b-2", "border-neutral-20
693
693
  border: "default",
694
694
  },
695
695
  });
696
+ const cvaCardDensityContainer = cvaMerge(["flex"], {
697
+ variants: {
698
+ disableGap: {
699
+ true: "gap-0",
700
+ false: "",
701
+ },
702
+ direction: {
703
+ row: "flex-row",
704
+ "row-reverse": "flex-row-reverse",
705
+ column: "flex-col",
706
+ "column-reverse": "flex-col-reverse",
707
+ },
708
+ density: {
709
+ none: "",
710
+ compact: "gap-3 p-3",
711
+ comfortable: "gap-4 p-4",
712
+ spacious: "gap-4 p-6",
713
+ auto: " component-card-spacing sm:component-card-spacing-sm md:component-card-spacing-md",
714
+ },
715
+ },
716
+ defaultVariants: {
717
+ disableGap: false,
718
+ direction: "column",
719
+ density: "auto",
720
+ },
721
+ });
696
722
 
697
723
  const ROLE_CARD = "region";
698
724
  /**
@@ -716,44 +742,8 @@ const Card = (_a) => {
716
742
  * @returns {JSX.Element} DensityContainer component
717
743
  */
718
744
  const DensityContainer = ({ children, className, dataTestId, density, disableGap, direction, }) => {
719
- return (jsx(StyledDensityContainer, { "$disableGap": disableGap, "$density": density, "$direction": direction, "data-testid": dataTestId, className: className, children: children }));
720
- };
721
- const getDirection = () => ({ $direction }) => {
722
- $direction = $direction !== null && $direction !== void 0 ? $direction : "column";
723
- const directions = {
724
- row: tws `flex-row`,
725
- "row-reverse": tws `flex-row-reverse`,
726
- column: tws `flex-col`,
727
- "column-reverse": tws `flex-col-reverse`,
728
- };
729
- return directions[$direction];
730
- };
731
- const densityAuto = tws `
732
- component-card-spacing
733
- sm:component-card-spacing-sm
734
- md:component-card-spacing-md
735
- `;
736
- const DensityFinder = ({ $density }) => {
737
- switch ($density) {
738
- case "none":
739
- return;
740
- case "compact":
741
- return tws `gap-3 p-3`;
742
- case "comfortable":
743
- return tws `gap-4 p-4`;
744
- case "spacious":
745
- return tws `gap-4 p-6`;
746
- case "auto":
747
- default:
748
- return densityAuto;
749
- }
750
- };
751
- const StyledDensityContainer = tw.div `
752
- flex
753
- ${getDirection()}
754
- ${p => (p.$disableGap ? tws `gap-0` : null)}
755
- ${DensityFinder}
756
- `;
745
+ return (jsx("div", { className: cvaCardDensityContainer({ className, disableGap, density, direction }), "data-testid": dataTestId, children: children }));
746
+ };
757
747
 
758
748
  /**
759
749
  * The CardBody component should be used to inform the user of important information.
@@ -18942,6 +18932,7 @@ const cvaIndicatorPing = cvaMerge(["animate-ping-sm", "absolute", "inline-flex",
18942
18932
  unused: "bg-unused-400",
18943
18933
  utilized: "bg-utilized-600",
18944
18934
  heavily_utilized: "bg-heavily_utilized-500",
18935
+ unknown_utilization: "bg-unknown_utilization-600",
18945
18936
  available: "bg-available-600",
18946
18937
  on_rent: "bg-on_rent-600",
18947
18938
  pickup_ready: "bg-pickup_ready-600",
@@ -18978,6 +18969,7 @@ const cvaIndicatorIconBackground = cvaMerge(["rounded-full", "items-center", "ju
18978
18969
  unused: "bg-unused-300 text-unused-400",
18979
18970
  utilized: "bg-utilized-400 text-utilized-600",
18980
18971
  heavily_utilized: "bg-heavily_utilized-300 text-heavily_utilized-500",
18972
+ unknown_utilization: "bg-unknown_utilization-300 text-unknown_utilization-600",
18981
18973
  available: "bg-available-100 text-available-600",
18982
18974
  on_rent: "bg-on_rent-100 text-on_rent-600",
18983
18975
  pickup_ready: "bg-pickup_ready-100 text-pickup_ready-600",
@@ -38656,16 +38648,8 @@ const Spacer = ({ size = "medium", border = false, dataTestId, className }) => {
38656
38648
  * @returns {JSX.Element} SectionHeader component
38657
38649
  */
38658
38650
  const SectionHeader = ({ title, subtitle, dataTestId, addons }) => {
38659
- return (jsxs(SectionHeaderContainer, { children: [jsx(q, { children: jsx(W, { title: title }) }), jsxs(StyledFlex, { className: "flex-row mb-2", children: [jsxs(StyledFlex, { className: "flex-col grow", children: [jsx(Heading, { variant: "secondary", dataTestId: dataTestId, children: title }), subtitle && (jsx(Heading, { variant: "subtitle", subtle: true, children: subtitle }))] }), addons && jsx(StyledFlex, { children: addons })] }), jsx(Spacer, { size: "small" })] }));
38651
+ return (jsxs("div", { className: "flex flex-col", children: [jsx(q, { children: jsx(W, { title: title }) }), jsxs("div", { className: "flex gap-2 flex-row mb-2", children: [jsxs("div", { className: "flex gap-2 flex-col grow", children: [jsx(Heading, { variant: "secondary", dataTestId: dataTestId, children: title }), subtitle && (jsx(Heading, { variant: "subtitle", subtle: true, children: subtitle }))] }), addons && jsx("div", { className: "flex gap-2", children: addons })] }), jsx(Spacer, { size: "small" })] }));
38660
38652
  };
38661
- const SectionHeaderContainer = tw.div `
38662
- flex
38663
- flex-col
38664
- `;
38665
- const StyledFlex = tw.div `
38666
- flex
38667
- gap-2
38668
- `;
38669
38653
 
38670
38654
  const cvaSidebar = cvaMerge(["apply grid", "grid-cols-fr-min", "items-center"]);
38671
38655
  const cvaSidebarChildContainer = cvaMerge(["apply flex", "overflow-hidden", "gap-2", "p-1", "max-w-full"], {
@@ -38755,9 +38739,9 @@ const Sidebar = ({ childContainerClassName, children, breakpoint = "lg", classNa
38755
38739
  const overflowItemCount = Object.values(itemOverflowMap).filter(isOverflowing => isOverflowing).length;
38756
38740
  const itemVisibilityClassName = (id) => {
38757
38741
  if (itemOverflowMap[id]) {
38758
- return tws `invisible`;
38742
+ return "invisible";
38759
38743
  }
38760
- return tws `visible`;
38744
+ return "visible";
38761
38745
  };
38762
38746
  return (jsxs("div", { className: cvaSidebar({ className }), "data-testid": dataTestId, children: [jsx("div", { ref: overflowContainerRef, className: cvaSidebarChildContainer({ breakpoint, className: childContainerClassName }), "data-testid": dataTestId && `${dataTestId}-child-container`, children: React__default.Children.map(children, child => {
38763
38747
  return React__default.cloneElement(child, {
@@ -38812,7 +38796,7 @@ const Timeline = ({ className, dataTestId, children }) => {
38812
38796
  * @param {TimeLineElementProps} props the props
38813
38797
  * @returns {JSX.Element} component
38814
38798
  */
38815
- const TimelineElement = ({ date, showTime, children, className, dataTestId = "timeline-date", headerClassName, dot = jsx(Indicator, { className: tws `mt-[-1px]`, color: "neutral", icon: jsx(Icon, { name: "CalendarIcon", size: "large" }) }), header = defaultHeader(date, showTime), onClick, }) => {
38799
+ 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, }) => {
38816
38800
  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 }) })] }));
38817
38801
  };
38818
38802
  function defaultHeader(date, showTime) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.140",
3
+ "version": "0.1.144",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,10 +9,10 @@
9
9
  "dependencies": {
10
10
  "@floating-ui/react": "0.22.2",
11
11
  "@trackunit/css-class-variance-utilities": "0.0.11",
12
- "@trackunit/css-core": "0.0.91",
12
+ "@trackunit/css-core": "0.0.92",
13
13
  "@trackunit/tailwind-styled-components": "0.0.60",
14
- "@trackunit/ui-design-tokens": "0.0.74",
15
- "@trackunit/ui-icons": "0.0.71",
14
+ "@trackunit/ui-design-tokens": "0.0.75",
15
+ "@trackunit/ui-icons": "0.0.72",
16
16
  "date-fns": "2.29.3",
17
17
  "lodash": "4.17.21",
18
18
  "react": "18.2.0",
@@ -20,7 +20,7 @@
20
20
  "react-helmet-async": "1.3.0",
21
21
  "react-router-dom": "6.11.2",
22
22
  "react-use": "17.4.0",
23
- "react-useportal": "1.0.17",
23
+ "react-useportal": "1.0.18",
24
24
  "zod": "3.14.1"
25
25
  },
26
26
  "module": "./index.esm.js",
@@ -11,3 +11,8 @@ export declare const cvaCardHeaderHeadingContainer: (props?: import("class-varia
11
11
  export declare const cvaCardHeaderDensityContainer: (props?: ({
12
12
  border?: "default" | "borderless" | null | undefined;
13
13
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
14
+ export declare const cvaCardDensityContainer: (props?: ({
15
+ disableGap?: boolean | null | undefined;
16
+ direction?: "row" | "row-reverse" | "column" | "column-reverse" | null | undefined;
17
+ density?: "none" | "compact" | "comfortable" | "spacious" | "auto" | null | undefined;
18
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -2,9 +2,9 @@ export declare const cvaIndicator: (props?: import("class-variance-authority/dis
2
2
  export declare const cvaIndicatorIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
3
  export declare const cvaIndicatorLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
4
4
  export declare const cvaIndicatorPing: (props?: ({
5
- color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "moving" | "active" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "available" | "on_rent" | "pickup_ready" | "transfer" | "in_repair" | "returned" | "other_rental_status" | "site" | "white" | "black" | null | undefined;
5
+ color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "moving" | "active" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "unknown_utilization" | "available" | "on_rent" | "pickup_ready" | "transfer" | "in_repair" | "returned" | "other_rental_status" | "site" | "white" | "black" | null | undefined;
6
6
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
7
  export declare const cvaIndicatorIconBackground: (props?: ({
8
- color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "moving" | "active" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "available" | "on_rent" | "pickup_ready" | "transfer" | "in_repair" | "returned" | "other_rental_status" | "site" | "white" | "black" | null | undefined;
8
+ color?: "primary" | "secondary" | "accent" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "stopped" | "moving" | "active" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "unknown_utilization" | "available" | "on_rent" | "pickup_ready" | "transfer" | "in_repair" | "returned" | "other_rental_status" | "site" | "white" | "black" | null | undefined;
9
9
  background?: "visible" | "hidden" | null | undefined;
10
10
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;