@cerberus-design/react
Version:
The Cerberus Design React component library.
20 lines (17 loc) • 888 B
JavaScript
import { jsxs, jsx } from 'react/jsx-runtime';
import { Show } from '../show/show.js';
import { Text } from '../text/text.js';
import { CheckboxParts } from './parts.js';
import { CheckboxIcon } from './checkbox-icon.js';
function Checkbox(props) {
const { size, children, ...rootProps } = props;
return /* @__PURE__ */ jsxs(CheckboxParts.Root, { ...rootProps, children: [
/* @__PURE__ */ jsx(CheckboxParts.Control, { size, children: /* @__PURE__ */ jsx(CheckboxIcon, { indeterminate: rootProps.checked === "indeterminate" }) }),
/* @__PURE__ */ jsxs(CheckboxParts.Label, { size, children: [
children,
/* @__PURE__ */ jsx(Show, { when: props.required, children: /* @__PURE__ */ jsx(Text, { as: "span", "data-part": "required-indicator", children: "(required)" }) })
] }),
/* @__PURE__ */ jsx(CheckboxParts.HiddenInput, {})
] });
}
export { Checkbox };