UNPKG

fui-fancyui

Version:
33 lines (32 loc) 940 B
"use client"; import { jsx as a } from "react/jsx-runtime"; import { forwardRef as f, useState as u, useId as k } from "react"; import p from "../../molecules/Switch/Switch.js"; import g from "../../molecules/FancySelectWrapper/FancySelectWrapper.js"; const F = f((n, d) => { const { label: s, onChange: e, align: S = "center", alignSwitch: o = "right", description: h, ...c } = n, [i, l] = u(c.checked || !1), m = k(), r = n.id ? n.id : m; return /* @__PURE__ */ a( g, { id: r, label: s, description: h, align: "center", alignInput: o, onClick: () => { if (c.disabled) return; const t = !i; l(t), e == null || e(t); }, externalStyle: { alignItems: "center" }, inputElement: /* @__PURE__ */ a(p, { ref: d, id: r, onChange: (t) => { l(t), e == null || e(t); }, checked: i, ...c }) } ); }); export { F as default };