@trackunit/react-components 0.1.219 → 0.1.221

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
@@ -679,70 +679,24 @@ const StarButton = ({ starred, onClick }) => {
679
679
  return (jsxRuntime.jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsxRuntime.jsx(Icon, { name: "Star", color: starred ? "primary" : "neutral", size: "medium" }) }));
680
680
  };
681
681
 
682
- const cvaAlert = cssClassVarianceUtilities.cvaMerge(["flex", "relative", "p-4", "rounded"], {
682
+ const cvaAlert = cssClassVarianceUtilities.cvaMerge(["flex", "flex-col", "gap-3", "relative", "p-3", "rounded-lg", "border", "@container"], {
683
683
  variants: {
684
684
  color: {
685
- danger: "bg-danger-100",
686
- warning: "bg-warning-100",
687
- success: "bg-success-100",
688
- info: "bg-info-100",
689
- },
690
- layout: {
691
- default: "items-start",
692
- inline: "items-center",
685
+ danger: ["bg-danger-100", "border-danger-300"],
686
+ warning: ["bg-warning-100", "border-warning-300"],
687
+ success: ["bg-success-100", "border-success-300"],
688
+ info: ["bg-info-100", "border-info-300"],
693
689
  },
694
690
  },
695
691
  defaultVariants: {
696
- layout: "default",
697
692
  color: "info",
698
693
  },
699
694
  });
700
- const cvaAlertDetails = cssClassVarianceUtilities.cvaMerge(["flex"]);
701
- const cvaAlertContentBody = cssClassVarianceUtilities.cvaMerge(["grid", "gap-2", "flex-grow"]);
702
- const cvaAlertRightAligned = cssClassVarianceUtilities.cvaMerge(["flex", "justify-end", "gap-2", "ml-2", "mt-4"], {
703
- variants: {
704
- layout: {
705
- default: "",
706
- inline: "mt-0 ml-auto items-center",
707
- },
708
- },
709
- defaultVariants: {
710
- layout: "default",
711
- },
712
- });
713
- const cvaAlertContent = cssClassVarianceUtilities.cvaMerge(["grow"], {
714
- variants: {
715
- layout: {
716
- default: "",
717
- inline: "flex w-full items-center",
718
- },
719
- },
720
- defaultVariants: {
721
- layout: "default",
722
- },
723
- });
724
- const cvaAlertCloseButtonContainer = cssClassVarianceUtilities.cvaMerge(["flex", "self-start", "w-min", "shrink-0"], {
725
- variants: {
726
- layout: {
727
- default: "",
728
- inline: "ml-4",
729
- },
730
- },
731
- defaultVariants: {
732
- layout: "default",
733
- },
734
- });
735
- const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["self-start", "mr-3", "shrink-0", "grid", "w-min"], {
736
- variants: {
737
- layout: {
738
- default: "",
739
- inline: "self-center",
740
- },
741
- },
742
- defaultVariants: {
743
- layout: "default",
744
- },
745
- });
695
+ const cvaAlertActionsContainer = cssClassVarianceUtilities.cvaMerge(["flex", "justify-end", "gap-2"]);
696
+ const cvaContent = cssClassVarianceUtilities.cvaMerge(["flex-grow"]);
697
+ const cvaAlertContentContainer = cssClassVarianceUtilities.cvaMerge(["flex", "flex-row", "h-full", "gap-2"]);
698
+ const cvaAlertCloseButtonContainer = cssClassVarianceUtilities.cvaMerge(["flex", "self-start", "w-min", "shrink-0"]);
699
+ const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["self-start", "shrink-0", "grid", "w-min", "hidden", "@2xs:block"]);
746
700
 
747
701
  /**
748
702
  * The Alert component should be used to inform the user of important information.
@@ -750,7 +704,7 @@ const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["self-start",
750
704
  * @param {AlertProps} props - The props for the Alert component
751
705
  * @returns {JSX.Element} Alert component
752
706
  */
753
- const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, inline = false, }) => {
707
+ const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, }) => {
754
708
  const ref = React__namespace.useRef(null);
755
709
  const getIconFromColor = () => {
756
710
  switch (color) {
@@ -760,6 +714,8 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
760
714
  return jsxRuntime.jsx(Icon, { name: "ExclamationCircle", color: "warning" });
761
715
  case "success":
762
716
  return jsxRuntime.jsx(Icon, { name: "CheckCircle", color: "success" });
717
+ case "info":
718
+ return jsxRuntime.jsx(Icon, { name: "InformationCircle", color: "info" });
763
719
  default:
764
720
  return jsxRuntime.jsx(Icon, { name: "InformationCircle" });
765
721
  }
@@ -774,14 +730,12 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
774
730
  return "primary";
775
731
  }
776
732
  };
777
- const body = inline ? (jsxRuntime.jsxs("div", { children: [title && jsxRuntime.jsx(Text, { weight: "bold", children: title !== null && title !== void 0 ? title : children }), children && jsxRuntime.jsx(Text, { weight: !title ? "bold" : "normal", children: children })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [title && jsxRuntime.jsx(Text, { weight: "bold", children: title !== null && title !== void 0 ? title : children }), children && jsxRuntime.jsx(Text, { weight: !title ? "bold" : "normal", children: children })] }));
778
733
  React__namespace.useEffect(() => {
779
734
  if (autoScroll) {
780
735
  ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
781
736
  }
782
737
  }, [ref, autoScroll]);
783
- const layout = inline ? "inline" : "default";
784
- 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, { 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, { 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] }))] })] }));
738
+ return (jsxRuntime.jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxRuntime.jsxs("div", { className: cvaAlertContentContainer(), children: [jsxRuntime.jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxRuntime.jsxs("div", { className: cvaContent(), children: [title ? jsxRuntime.jsx(Text, { weight: "bold", children: title }) : null, children ? (jsxRuntime.jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsxRuntime.jsx("div", { className: cvaAlertCloseButtonContainer(), 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) && (jsxRuntime.jsxs("div", { className: cvaAlertActionsContainer(), children: [secondaryAction && (jsxRuntime.jsx(Button, { 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, { size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading, children: primaryAction.label }))] }))] }));
785
739
  };
786
740
 
787
741
  const cvaBadge = cssClassVarianceUtilities.cvaMerge([
package/index.esm.js CHANGED
@@ -649,70 +649,24 @@ const StarButton = ({ starred, onClick }) => {
649
649
  return (jsx("div", { onClick: onClick, "data-test-id": "starred-filter", children: jsx(Icon, { name: "Star", color: starred ? "primary" : "neutral", size: "medium" }) }));
650
650
  };
651
651
 
652
- const cvaAlert = cvaMerge(["flex", "relative", "p-4", "rounded"], {
652
+ const cvaAlert = cvaMerge(["flex", "flex-col", "gap-3", "relative", "p-3", "rounded-lg", "border", "@container"], {
653
653
  variants: {
654
654
  color: {
655
- danger: "bg-danger-100",
656
- warning: "bg-warning-100",
657
- success: "bg-success-100",
658
- info: "bg-info-100",
659
- },
660
- layout: {
661
- default: "items-start",
662
- inline: "items-center",
655
+ danger: ["bg-danger-100", "border-danger-300"],
656
+ warning: ["bg-warning-100", "border-warning-300"],
657
+ success: ["bg-success-100", "border-success-300"],
658
+ info: ["bg-info-100", "border-info-300"],
663
659
  },
664
660
  },
665
661
  defaultVariants: {
666
- layout: "default",
667
662
  color: "info",
668
663
  },
669
664
  });
670
- const cvaAlertDetails = cvaMerge(["flex"]);
671
- const cvaAlertContentBody = cvaMerge(["grid", "gap-2", "flex-grow"]);
672
- const cvaAlertRightAligned = cvaMerge(["flex", "justify-end", "gap-2", "ml-2", "mt-4"], {
673
- variants: {
674
- layout: {
675
- default: "",
676
- inline: "mt-0 ml-auto items-center",
677
- },
678
- },
679
- defaultVariants: {
680
- layout: "default",
681
- },
682
- });
683
- const cvaAlertContent = cvaMerge(["grow"], {
684
- variants: {
685
- layout: {
686
- default: "",
687
- inline: "flex w-full items-center",
688
- },
689
- },
690
- defaultVariants: {
691
- layout: "default",
692
- },
693
- });
694
- const cvaAlertCloseButtonContainer = cvaMerge(["flex", "self-start", "w-min", "shrink-0"], {
695
- variants: {
696
- layout: {
697
- default: "",
698
- inline: "ml-4",
699
- },
700
- },
701
- defaultVariants: {
702
- layout: "default",
703
- },
704
- });
705
- const cvaAlertIconContainer = cvaMerge(["self-start", "mr-3", "shrink-0", "grid", "w-min"], {
706
- variants: {
707
- layout: {
708
- default: "",
709
- inline: "self-center",
710
- },
711
- },
712
- defaultVariants: {
713
- layout: "default",
714
- },
715
- });
665
+ const cvaAlertActionsContainer = cvaMerge(["flex", "justify-end", "gap-2"]);
666
+ const cvaContent = cvaMerge(["flex-grow"]);
667
+ const cvaAlertContentContainer = cvaMerge(["flex", "flex-row", "h-full", "gap-2"]);
668
+ const cvaAlertCloseButtonContainer = cvaMerge(["flex", "self-start", "w-min", "shrink-0"]);
669
+ const cvaAlertIconContainer = cvaMerge(["self-start", "shrink-0", "grid", "w-min", "hidden", "@2xs:block"]);
716
670
 
717
671
  /**
718
672
  * The Alert component should be used to inform the user of important information.
@@ -720,7 +674,7 @@ const cvaAlertIconContainer = cvaMerge(["self-start", "mr-3", "shrink-0", "grid"
720
674
  * @param {AlertProps} props - The props for the Alert component
721
675
  * @returns {JSX.Element} Alert component
722
676
  */
723
- const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, inline = false, }) => {
677
+ const Alert = ({ color = "info", title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, }) => {
724
678
  const ref = React.useRef(null);
725
679
  const getIconFromColor = () => {
726
680
  switch (color) {
@@ -730,6 +684,8 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
730
684
  return jsx(Icon, { name: "ExclamationCircle", color: "warning" });
731
685
  case "success":
732
686
  return jsx(Icon, { name: "CheckCircle", color: "success" });
687
+ case "info":
688
+ return jsx(Icon, { name: "InformationCircle", color: "info" });
733
689
  default:
734
690
  return jsx(Icon, { name: "InformationCircle" });
735
691
  }
@@ -744,14 +700,12 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
744
700
  return "primary";
745
701
  }
746
702
  };
747
- const body = inline ? (jsxs("div", { children: [title && jsx(Text, { weight: "bold", children: title !== null && title !== void 0 ? title : children }), children && jsx(Text, { weight: !title ? "bold" : "normal", children: children })] })) : (jsxs(Fragment, { children: [title && jsx(Text, { weight: "bold", children: title !== null && title !== void 0 ? title : children }), children && jsx(Text, { weight: !title ? "bold" : "normal", children: children })] }));
748
703
  React.useEffect(() => {
749
704
  if (autoScroll) {
750
705
  ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
751
706
  }
752
707
  }, [ref, autoScroll]);
753
- const layout = inline ? "inline" : "default";
754
- 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, { 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, { 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] }))] })] }));
708
+ return (jsxs("div", { className: cvaAlert({ color, className }), "data-testid": dataTestId, ref: ref, role: "alert", children: [jsxs("div", { className: cvaAlertContentContainer(), children: [jsx("div", { className: cvaAlertIconContainer(), children: getIconFromColor() }), jsxs("div", { className: cvaContent(), children: [title ? jsx(Text, { weight: "bold", children: title }) : null, children ? (jsx(Text, { type: typeof children === "string" || typeof children === "number" ? "p" : "span", weight: !title ? "bold" : "normal", children: children })) : null] }), onClose ? (jsx("div", { className: cvaAlertCloseButtonContainer(), 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) && (jsxs("div", { className: cvaAlertActionsContainer(), children: [secondaryAction && (jsx(Button, { 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, { size: "small", color: getButtonColor(), onClick: primaryAction.onClick, loading: primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.loading, children: primaryAction.label }))] }))] }));
755
709
  };
756
710
 
757
711
  const cvaBadge = cvaMerge([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.219",
3
+ "version": "0.1.221",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -33,10 +33,6 @@ export interface AlertProps extends CommonProps {
33
33
  * OnClose Event.
34
34
  */
35
35
  onClose?: () => void;
36
- /**
37
- * Whether the contents should be displayed inline or not.
38
- */
39
- inline?: boolean;
40
36
  /**
41
37
  * A prop to enable autoscroll to alert element
42
38
  *
@@ -50,4 +46,4 @@ export interface AlertProps extends CommonProps {
50
46
  * @param {AlertProps} props - The props for the Alert component
51
47
  * @returns {JSX.Element} Alert component
52
48
  */
53
- export declare const Alert: ({ color, title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, inline, }: AlertProps) => JSX.Element;
49
+ export declare const Alert: ({ color, title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, }: AlertProps) => JSX.Element;
@@ -1,18 +1,8 @@
1
1
  export declare const cvaAlert: (props?: ({
2
2
  color?: "danger" | "warning" | "success" | "info" | null | undefined;
3
- layout?: "default" | "inline" | null | undefined;
4
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
- export declare const cvaAlertDetails: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
6
- export declare const cvaAlertContentBody: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
7
- export declare const cvaAlertRightAligned: (props?: ({
8
- layout?: "default" | "inline" | null | undefined;
9
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
10
- export declare const cvaAlertContent: (props?: ({
11
- layout?: "default" | "inline" | null | undefined;
12
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
13
- export declare const cvaAlertCloseButtonContainer: (props?: ({
14
- layout?: "default" | "inline" | null | undefined;
15
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
16
- export declare const cvaAlertIconContainer: (props?: ({
17
- layout?: "default" | "inline" | null | undefined;
18
3
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
+ export declare const cvaAlertActionsContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
5
+ export declare const cvaContent: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
6
+ export declare const cvaAlertContentContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
7
+ export declare const cvaAlertCloseButtonContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
8
+ export declare const cvaAlertIconContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;