UNPKG

braid-design-system

Version:
22 lines (21 loc) 795 B
import { jsx } from "react/jsx-runtime"; import { forwardRef } from "react"; import { Box } from "../Box/Box.mjs"; import { TextContext } from "../Text/TextContext.mjs"; import { StyledInput } from "../private/InlineField/StyledInput.mjs"; import { resolveCheckedGroup } from "./resolveCheckedGroup.mjs"; const CheckboxStandalone = forwardRef(({ checked, ...restProps }, ref) => { const calculatedChecked = Array.isArray(checked) ? resolveCheckedGroup(checked) : checked; return /* @__PURE__ */ jsx(Box, { position: "relative", children: /* @__PURE__ */ jsx(TextContext.Provider, { value: null, children: /* @__PURE__ */ jsx( StyledInput, { ...restProps, checked: calculatedChecked, type: "checkbox", ref } ) }) }); }); export { CheckboxStandalone };