@trackunit/react-components 0.1.110 → 0.1.111
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 +32 -22
- package/index.js +32 -22
- package/package.json +1 -1
- package/src/components/Collapse/Collapse.variants.d.ts +8 -0
package/index.cjs
CHANGED
|
@@ -688,6 +688,35 @@ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose,
|
|
|
688
688
|
return (jsxRuntime.jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeader() }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: cvaCardHeaderHeadingContainer() }, { children: [jsxRuntime.jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] })), subHeading && (jsxRuntime.jsx(Heading$1, Object.assign({ 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" }))] })) })));
|
|
689
689
|
};
|
|
690
690
|
|
|
691
|
+
const cvaCollapse = cssClassVarianceUtilities.cvaMerge([
|
|
692
|
+
"block",
|
|
693
|
+
"w-full",
|
|
694
|
+
"border-b",
|
|
695
|
+
"border-solid",
|
|
696
|
+
"border-neutral-100",
|
|
697
|
+
"pb-3",
|
|
698
|
+
"mb-4",
|
|
699
|
+
"last:border-0",
|
|
700
|
+
"last:m-0",
|
|
701
|
+
"only:border-0",
|
|
702
|
+
"only:m-0",
|
|
703
|
+
]);
|
|
704
|
+
const cvaCollapseLabel = cssClassVarianceUtilities.cvaMerge(["block", "w-full", "cursor-pointer"]);
|
|
705
|
+
const cvaCollapseLabelContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-center", "justify-between"]);
|
|
706
|
+
cssClassVarianceUtilities.cvaMerge(["block", "relative", "w-full", "mt-1", "p-1"]);
|
|
707
|
+
const cvaCollapseAnimated = cssClassVarianceUtilities.cvaMerge(["overflow-y-hidden", "transition-all"]);
|
|
708
|
+
const cvaCollapseIcon = cssClassVarianceUtilities.cvaMerge(["ease-in-out", "duration-200"], {
|
|
709
|
+
variants: {
|
|
710
|
+
expanded: {
|
|
711
|
+
false: "",
|
|
712
|
+
true: "rotate-180",
|
|
713
|
+
},
|
|
714
|
+
},
|
|
715
|
+
defaultVariants: {
|
|
716
|
+
expanded: false,
|
|
717
|
+
},
|
|
718
|
+
});
|
|
719
|
+
|
|
691
720
|
/**
|
|
692
721
|
* The Collapse component is used to condense non-important information.
|
|
693
722
|
*
|
|
@@ -702,31 +731,12 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
702
731
|
}
|
|
703
732
|
setExpanded(!expanded);
|
|
704
733
|
}, [expanded, onToggle]);
|
|
705
|
-
return (jsxRuntime.jsxs(
|
|
734
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapse({ className }), "data-testid": dataTestId }, { children: [jsxRuntime.jsx("div", Object.assign({ className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxRuntime.jsxs("div", Object.assign({ className: cvaCollapseLabelContainer() }, { children: [jsxRuntime.jsx(Text$1, Object.assign({ 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, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
|
|
706
735
|
};
|
|
707
|
-
const Rotate = tailwindStyledComponents.twx(Icon) `
|
|
708
|
-
${p => (p.$expanded ? tailwindStyledComponents.tws `tu-icon--animated-rotate-expanded` : null)}
|
|
709
|
-
tu-icon--animated-rotate
|
|
710
|
-
`;
|
|
711
|
-
const StyledCollapse = tailwindStyledComponents.tw.div `
|
|
712
|
-
tu-collapse
|
|
713
|
-
`;
|
|
714
|
-
const CollapseLabel = tailwindStyledComponents.tw.div `
|
|
715
|
-
tu-collapse__label
|
|
716
|
-
`;
|
|
717
|
-
const LabelContainer = tailwindStyledComponents.tw.div `
|
|
718
|
-
tu-collapse__label__container
|
|
719
|
-
`;
|
|
720
736
|
const Collapsible = ({ children, expanded, id }) => {
|
|
721
737
|
const [ref, { height }] = reactUse.useMeasure();
|
|
722
|
-
return (jsxRuntime.jsx(
|
|
723
|
-
};
|
|
724
|
-
const AnimatedCollapsible = tailwindStyledComponents.tw.div `
|
|
725
|
-
tu-collapsible--animated
|
|
726
|
-
`;
|
|
727
|
-
const StyledCollapsible = tailwindStyledComponents.tw.div `
|
|
728
|
-
tu-collapsible
|
|
729
|
-
`;
|
|
738
|
+
return (jsxRuntime.jsx("div", Object.assign({ className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" } }, { children: jsxRuntime.jsx("div", Object.assign({ className: cvaCollapse(), ref: ref }, { children: children })) })));
|
|
739
|
+
};
|
|
730
740
|
|
|
731
741
|
const cvaCopyableText = cssClassVarianceUtilities.cvaMerge([
|
|
732
742
|
"py-1",
|
package/index.js
CHANGED
|
@@ -661,6 +661,35 @@ const CardHeader = ({ heading, headingVariant = "primary", subHeading, onClose,
|
|
|
661
661
|
return (jsx(DensityContainer, Object.assign({ dataTestId: dataTestId, className: cvaCardHeaderDensityContainer({ border: hideSeparator ? "borderless" : "default", className }), density: density }, { children: jsxs("div", Object.assign({ className: cvaCardHeader() }, { children: [jsxs("div", Object.assign({ className: extraClassName }, { children: [jsxs("div", Object.assign({ className: cvaCardHeaderHeadingContainer() }, { children: [jsx(Heading$1, Object.assign({ className: "self-center", variant: headingVariant }, { children: heading })), accessories] })), subHeading && (jsx(Heading$1, Object.assign({ 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" }))] })) })));
|
|
662
662
|
};
|
|
663
663
|
|
|
664
|
+
const cvaCollapse = cvaMerge([
|
|
665
|
+
"block",
|
|
666
|
+
"w-full",
|
|
667
|
+
"border-b",
|
|
668
|
+
"border-solid",
|
|
669
|
+
"border-neutral-100",
|
|
670
|
+
"pb-3",
|
|
671
|
+
"mb-4",
|
|
672
|
+
"last:border-0",
|
|
673
|
+
"last:m-0",
|
|
674
|
+
"only:border-0",
|
|
675
|
+
"only:m-0",
|
|
676
|
+
]);
|
|
677
|
+
const cvaCollapseLabel = cvaMerge(["block", "w-full", "cursor-pointer"]);
|
|
678
|
+
const cvaCollapseLabelContainer = cvaMerge(["flex", "items-center", "justify-between"]);
|
|
679
|
+
cvaMerge(["block", "relative", "w-full", "mt-1", "p-1"]);
|
|
680
|
+
const cvaCollapseAnimated = cvaMerge(["overflow-y-hidden", "transition-all"]);
|
|
681
|
+
const cvaCollapseIcon = cvaMerge(["ease-in-out", "duration-200"], {
|
|
682
|
+
variants: {
|
|
683
|
+
expanded: {
|
|
684
|
+
false: "",
|
|
685
|
+
true: "rotate-180",
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
defaultVariants: {
|
|
689
|
+
expanded: false,
|
|
690
|
+
},
|
|
691
|
+
});
|
|
692
|
+
|
|
664
693
|
/**
|
|
665
694
|
* The Collapse component is used to condense non-important information.
|
|
666
695
|
*
|
|
@@ -675,31 +704,12 @@ const Collapse = ({ id, initialExpanded = false, onToggle, label, children, clas
|
|
|
675
704
|
}
|
|
676
705
|
setExpanded(!expanded);
|
|
677
706
|
}, [expanded, onToggle]);
|
|
678
|
-
return (jsxs(
|
|
707
|
+
return (jsxs("div", Object.assign({ className: cvaCollapse({ className }), "data-testid": dataTestId }, { children: [jsx("div", Object.assign({ className: cvaCollapseLabel(), role: "button", "aria-expanded": expanded, "aria-controls": id, onClick: handleClick }, { children: jsxs("div", Object.assign({ className: cvaCollapseLabelContainer() }, { children: [jsx(Text$1, Object.assign({ weight: "bold" }, { children: label })), jsx(IconButton, { icon: jsx(Icon, { className: cvaCollapseIcon({ expanded }), name: "ChevronDownIcon", size: "small" }), size: "medium", variant: "transparent", color: "secondary" })] })) })), jsx(Collapsible, Object.assign({ expanded: expanded, id: id }, { children: children }))] })));
|
|
679
708
|
};
|
|
680
|
-
const Rotate = twx(Icon) `
|
|
681
|
-
${p => (p.$expanded ? tws `tu-icon--animated-rotate-expanded` : null)}
|
|
682
|
-
tu-icon--animated-rotate
|
|
683
|
-
`;
|
|
684
|
-
const StyledCollapse = tw.div `
|
|
685
|
-
tu-collapse
|
|
686
|
-
`;
|
|
687
|
-
const CollapseLabel = tw.div `
|
|
688
|
-
tu-collapse__label
|
|
689
|
-
`;
|
|
690
|
-
const LabelContainer = tw.div `
|
|
691
|
-
tu-collapse__label__container
|
|
692
|
-
`;
|
|
693
709
|
const Collapsible = ({ children, expanded, id }) => {
|
|
694
710
|
const [ref, { height }] = useMeasure();
|
|
695
|
-
return (jsx(
|
|
696
|
-
};
|
|
697
|
-
const AnimatedCollapsible = tw.div `
|
|
698
|
-
tu-collapsible--animated
|
|
699
|
-
`;
|
|
700
|
-
const StyledCollapsible = tw.div `
|
|
701
|
-
tu-collapsible
|
|
702
|
-
`;
|
|
711
|
+
return (jsx("div", Object.assign({ className: cvaCollapseAnimated(), id: id, style: { height: expanded ? height : "0" } }, { children: jsx("div", Object.assign({ className: cvaCollapse(), ref: ref }, { children: children })) })));
|
|
712
|
+
};
|
|
703
713
|
|
|
704
714
|
const cvaCopyableText = cvaMerge([
|
|
705
715
|
"py-1",
|
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const cvaCollapse: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const cvaCollapseLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const cvaCollapseLabelContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
4
|
+
export declare const cvaCollapsible: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
5
|
+
export declare const cvaCollapseAnimated: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
|
|
6
|
+
export declare const cvaCollapseIcon: (props?: ({
|
|
7
|
+
expanded?: boolean | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|