@lanaco/lnc-react-ui
Version:
React component library
74 lines (73 loc) • 1.45 kB
JavaScript
import { jsx as l } from "react/jsx-runtime";
import { forwardRef as R, useState as k, useEffect as z } from "react";
import { s as P } from "./emotion-styled.browser.esm-DfbrHHed.js";
import j from "./RadioInput.js";
import { u as E } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
const G = P.div`
display: inline-flex;
flex-direction: ${(o) => o.inline === !0 ? "row" : "column"};
gap: 1.5rem;
width: fit-content;
box-sizing: border-box;
`, q = R((o, n) => {
const {
id: t = "",
name: i,
value: r = null,
disabled: s = !1,
readOnly: d = !1,
items: m = [],
radioProps: f,
inline: u = !0,
//----------------
onChange: a = () => {
},
//----------------
className: c = "",
style: p = {},
size: h = "small",
color: b = "primary",
...v
} = o;
var x = E();
const [g, y] = k(null);
z(() => {
r !== g && y(r);
}, [r]);
var C = {
color: b,
theme: x,
size: h,
disabled: s,
readOnly: d
};
const w = (e) => {
a && a(e);
};
return /* @__PURE__ */ l(
G,
{
ref: n,
id: t,
inline: u,
style: p,
className: c,
...v,
children: m.map((e, I) => /* @__PURE__ */ l(
j,
{
...C,
label: e.label,
value: e.value,
...f,
onChange: w,
name: i
},
I
))
}
);
});
export {
q as default
};