UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

24 lines (19 loc) 1.11 kB
'use strict'; Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const jsxRuntime = require('react/jsx-runtime'); const show = require('../show/show.cjs'); const text = require('../text/text.cjs'); const parts = require('./parts.cjs'); const checkboxIcon = require('./checkbox-icon.cjs'); function Checkbox(props) { const { size, children, ...rootProps } = props; return /* @__PURE__ */ jsxRuntime.jsxs(parts.CheckboxParts.Root, { ...rootProps, children: [ /* @__PURE__ */ jsxRuntime.jsx(parts.CheckboxParts.Control, { size, children: /* @__PURE__ */ jsxRuntime.jsx(checkboxIcon.CheckboxIcon, { indeterminate: rootProps.checked === "indeterminate" }) }), /* @__PURE__ */ jsxRuntime.jsxs(parts.CheckboxParts.Label, { size, children: [ children, /* @__PURE__ */ jsxRuntime.jsx(show.Show, { when: props.required, children: /* @__PURE__ */ jsxRuntime.jsx(text.Text, { as: "span", "data-part": "required-indicator", children: "(required)" }) }) ] }), /* @__PURE__ */ jsxRuntime.jsx(parts.CheckboxParts.HiddenInput, {}) ] }); } exports.Checkbox = Checkbox;