@trackunit/react-components 0.1.255-alpha-52ec6ef4f8.0 → 0.1.256
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 +1 -21
- package/index.esm.js +1 -21
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -753,16 +753,6 @@ const cvaAlertContentContainer = cssClassVarianceUtilities.cvaMerge(["flex", "fl
|
|
|
753
753
|
const cvaAlertCloseButtonContainer = cssClassVarianceUtilities.cvaMerge(["flex", "self-start", "w-min", "shrink-0"]);
|
|
754
754
|
const cvaAlertIconContainer = cssClassVarianceUtilities.cvaMerge(["self-start", "shrink-0", "grid", "w-min", "hidden", "@2xs:block"]);
|
|
755
755
|
|
|
756
|
-
const getSecondaryActionVariant = (color) => {
|
|
757
|
-
switch (color) {
|
|
758
|
-
case "danger":
|
|
759
|
-
return "secondary-danger";
|
|
760
|
-
case "warning":
|
|
761
|
-
return "ghost-neutral";
|
|
762
|
-
default:
|
|
763
|
-
return "ghost";
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
756
|
/**
|
|
767
757
|
* The Alert component should be used to inform the user of important information.
|
|
768
758
|
|
|
@@ -785,16 +775,6 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
785
775
|
return jsxRuntime.jsx(Icon, { name: "InformationCircle" });
|
|
786
776
|
}
|
|
787
777
|
};
|
|
788
|
-
const getButtonColor = () => {
|
|
789
|
-
switch (color) {
|
|
790
|
-
case "danger":
|
|
791
|
-
return "primary-danger";
|
|
792
|
-
case "warning":
|
|
793
|
-
return "secondary-danger";
|
|
794
|
-
default:
|
|
795
|
-
return "primary";
|
|
796
|
-
}
|
|
797
|
-
};
|
|
798
778
|
React__namespace.useEffect(() => {
|
|
799
779
|
var _a, _b;
|
|
800
780
|
if (autoScroll) {
|
|
@@ -802,7 +782,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
802
782
|
(_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
803
783
|
}
|
|
804
784
|
}, [ref, autoScroll]);
|
|
805
|
-
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, { dataTestId: `${dataTestId}-title`, 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: "ghost-neutral", 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:
|
|
785
|
+
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, { dataTestId: `${dataTestId}-title`, 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: "ghost-neutral", 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: "ghost-neutral", onClick: secondaryAction.onClick, loading: secondaryAction.loading, children: secondaryAction.label })) : null, primaryAction ? (jsxRuntime.jsx(Button, { size: "small", variant: color === "danger" ? "primary-danger" : "primary", onClick: primaryAction.onClick, loading: primaryAction.loading, children: primaryAction.label })) : null] })) : null] }));
|
|
806
786
|
};
|
|
807
787
|
|
|
808
788
|
const cvaBadge = cssClassVarianceUtilities.cvaMerge([
|
package/index.esm.js
CHANGED
|
@@ -722,16 +722,6 @@ const cvaAlertContentContainer = cvaMerge(["flex", "flex-row", "h-full", "gap-2"
|
|
|
722
722
|
const cvaAlertCloseButtonContainer = cvaMerge(["flex", "self-start", "w-min", "shrink-0"]);
|
|
723
723
|
const cvaAlertIconContainer = cvaMerge(["self-start", "shrink-0", "grid", "w-min", "hidden", "@2xs:block"]);
|
|
724
724
|
|
|
725
|
-
const getSecondaryActionVariant = (color) => {
|
|
726
|
-
switch (color) {
|
|
727
|
-
case "danger":
|
|
728
|
-
return "secondary-danger";
|
|
729
|
-
case "warning":
|
|
730
|
-
return "ghost-neutral";
|
|
731
|
-
default:
|
|
732
|
-
return "ghost";
|
|
733
|
-
}
|
|
734
|
-
};
|
|
735
725
|
/**
|
|
736
726
|
* The Alert component should be used to inform the user of important information.
|
|
737
727
|
|
|
@@ -754,16 +744,6 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
754
744
|
return jsx(Icon, { name: "InformationCircle" });
|
|
755
745
|
}
|
|
756
746
|
};
|
|
757
|
-
const getButtonColor = () => {
|
|
758
|
-
switch (color) {
|
|
759
|
-
case "danger":
|
|
760
|
-
return "primary-danger";
|
|
761
|
-
case "warning":
|
|
762
|
-
return "secondary-danger";
|
|
763
|
-
default:
|
|
764
|
-
return "primary";
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
747
|
React.useEffect(() => {
|
|
768
748
|
var _a, _b;
|
|
769
749
|
if (autoScroll) {
|
|
@@ -771,7 +751,7 @@ const Alert = ({ color = "info", title, className, children, primaryAction, seco
|
|
|
771
751
|
(_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
772
752
|
}
|
|
773
753
|
}, [ref, autoScroll]);
|
|
774
|
-
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, { dataTestId: `${dataTestId}-title`, 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: "ghost-neutral", 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:
|
|
754
|
+
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, { dataTestId: `${dataTestId}-title`, 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: "ghost-neutral", 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: "ghost-neutral", onClick: secondaryAction.onClick, loading: secondaryAction.loading, children: secondaryAction.label })) : null, primaryAction ? (jsx(Button, { size: "small", variant: color === "danger" ? "primary-danger" : "primary", onClick: primaryAction.onClick, loading: primaryAction.loading, children: primaryAction.label })) : null] })) : null] }));
|
|
775
755
|
};
|
|
776
756
|
|
|
777
757
|
const cvaBadge = cvaMerge([
|