UNPKG

@stratakit/react

Version:

A React component library for StrataKit

33 lines (32 loc) 1.02 kB
import { jsx, jsxs } from "react/jsx-runtime"; import * as React from "react"; import { Field, Radio as SkRadio } from "@stratakit/bricks"; import { useCompatProps } from "./~utils.js"; const Radio = React.forwardRef((props, forwardedRef) => { const { label, labelProps, wrapperProps, value = "on", // biome-ignore-start lint/correctness/noUnusedVariables: NOT IMPLEMENTED status, // biome-ignore-end lint/correctness/noUnusedVariables: NOT IMPLEMENTED ...rest } = useCompatProps(props); if (label) { return /* @__PURE__ */ jsxs(Field.Root, { render: /* @__PURE__ */ jsx(Field.Label, { ...wrapperProps }), children: [ /* @__PURE__ */ jsx( Field.Control, { ref: forwardedRef, render: /* @__PURE__ */ jsx(SkRadio, { ...rest, value }) } ), /* @__PURE__ */ jsx("span", { ...labelProps, children: label }) ] }); } return /* @__PURE__ */ jsx(SkRadio, { ...rest, value, ref: forwardedRef }); }); export { Radio };