UNPKG

@intility/bifrost-react

Version:

React library for Intility's design system, Bifrost.

49 lines (48 loc) 1.91 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { forwardRef } from "react"; import classNames from "classnames"; import CheckboxIcon from "../common/CheckboxIcon.internal.js"; /** * A card rendered as a Checkbox or Radio button */ const CheckboxCard = /*#__PURE__*/ forwardRef(({ type = "checkbox", align = "right", label, children, style, className, header, inputClassName, inputStyle, indeterminate, ...props }, ref)=>{ return /*#__PURE__*/ _jsxs("label", { className: classNames("bf-checkboxcard", className, { "bf-switch-wrapper": type === "switch", "bf-checkboxcard-no-children": !children, "bf-checkboxcard-left": align === "left" }), htmlFor: props.id, style: style, children: [ /*#__PURE__*/ _jsx("input", { type: type === "radio" ? "radio" : "checkbox", ...props, ref: ref, className: inputClassName, style: inputStyle }), header && /*#__PURE__*/ _jsx("header", { className: "bf-checkboxcard-header", children: header }), /*#__PURE__*/ _jsxs("div", { className: "bf-checkboxcard-content", children: [ /*#__PURE__*/ _jsxs("span", { className: "bf-checkboxcard-label-text", children: [ /*#__PURE__*/ _jsx(CheckboxIcon, { type: type, indeterminate: indeterminate }), label ] }), children ] }) ] }); }); CheckboxCard.displayName = "CheckboxCard"; export default CheckboxCard;