@trackunit/react-form-components 0.0.396-alpha-811f31928e6.0 → 0.0.397
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
|
@@ -848,7 +848,7 @@ const cvaOptionCardContainer = cssClassVarianceUtilities.cvaMerge(["contents"]);
|
|
|
848
848
|
const OptionCard = React.forwardRef((_a, ref) => {
|
|
849
849
|
var { icon, heading, subheading, description, disabled, id, value, className, dataTestId, customImage } = _a, rest = __rest(_a, ["icon", "heading", "subheading", "description", "disabled", "id", "value", "className", "dataTestId", "customImage"]);
|
|
850
850
|
const htmlForId = id !== null && id !== void 0 ? id : "option-card-" + uuid.v4();
|
|
851
|
-
return (jsxRuntime.jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsxRuntime.jsx("input", Object.assign({ className: "peer
|
|
851
|
+
return (jsxRuntime.jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsxRuntime.jsx("input", Object.assign({ className: "peer absolute h-0 w-0 opacity-0", id: htmlForId, ref: ref, type: "radio", value: value }, rest)), jsxRuntime.jsxs("label", { className: cvaOptionCardLabel({ className, disabled }), htmlFor: htmlForId, children: [disabled &&
|
|
852
852
|
icon &&
|
|
853
853
|
!customImage &&
|
|
854
854
|
React.cloneElement(icon, { className: `${icon.props.className} text-secondary-400` }), disabled && customImage && jsxRuntime.jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }), !disabled && !customImage && icon, !disabled && customImage && jsxRuntime.jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }), heading && (jsxRuntime.jsx(reactComponents.Heading, { subtle: disabled, variant: "secondary", children: heading })), (subheading || description) && (jsxRuntime.jsxs("div", { className: cvaOptionCardContent(), children: [subheading && (jsxRuntime.jsx(reactComponents.Text, { align: "center", subtle: disabled, type: "span", weight: "thick", children: subheading })), description && (jsxRuntime.jsx(reactComponents.Text, { align: "center", subtle: true, type: "span", children: description }))] }))] })] }));
|
package/index.esm.js
CHANGED
|
@@ -818,7 +818,7 @@ const cvaOptionCardContainer = cvaMerge(["contents"]);
|
|
|
818
818
|
const OptionCard = forwardRef((_a, ref) => {
|
|
819
819
|
var { icon, heading, subheading, description, disabled, id, value, className, dataTestId, customImage } = _a, rest = __rest(_a, ["icon", "heading", "subheading", "description", "disabled", "id", "value", "className", "dataTestId", "customImage"]);
|
|
820
820
|
const htmlForId = id !== null && id !== void 0 ? id : "option-card-" + v4();
|
|
821
|
-
return (jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsx("input", Object.assign({ className: "peer
|
|
821
|
+
return (jsxs("div", { className: cvaOptionCardContainer(), "data-testid": dataTestId, children: [jsx("input", Object.assign({ className: "peer absolute h-0 w-0 opacity-0", id: htmlForId, ref: ref, type: "radio", value: value }, rest)), jsxs("label", { className: cvaOptionCardLabel({ className, disabled }), htmlFor: htmlForId, children: [disabled &&
|
|
822
822
|
icon &&
|
|
823
823
|
!customImage &&
|
|
824
824
|
cloneElement(icon, { className: `${icon.props.className} text-secondary-400` }), disabled && customImage && jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }), !disabled && !customImage && icon, !disabled && customImage && jsx("img", { alt: "logo", className: customImage.className, src: customImage.src }), heading && (jsx(Heading, { subtle: disabled, variant: "secondary", children: heading })), (subheading || description) && (jsxs("div", { className: cvaOptionCardContent(), children: [subheading && (jsx(Text, { align: "center", subtle: disabled, type: "span", weight: "thick", children: subheading })), description && (jsx(Text, { align: "center", subtle: true, type: "span", children: description }))] }))] })] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonProps, IconProps } from "@trackunit/react-components";
|
|
2
2
|
import { InputHTMLAttributes, ReactElement } from "react";
|
|
3
|
-
export interface
|
|
3
|
+
export interface OptionCardProps extends InputHTMLAttributes<HTMLInputElement>, CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* Icon displayed at the top inside the OptionCard.
|
|
6
6
|
*/
|
|
@@ -29,5 +29,5 @@ interface CustomImage {
|
|
|
29
29
|
/**
|
|
30
30
|
* A card version of a radio button that includes an icon, headings and a description.
|
|
31
31
|
*/
|
|
32
|
-
export declare const OptionCard: import("react").ForwardRefExoticComponent<
|
|
32
|
+
export declare const OptionCard: import("react").ForwardRefExoticComponent<OptionCardProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
33
33
|
export {};
|