@anoki/fse-marche-ui
Version:
FSE UI components library
76 lines (75 loc) • 1.96 kB
JavaScript
import { j as e } from "./index.es137.js";
import { Root as l, Thumb as c } from "./index.es208.js";
import { Row as x } from "./index.es9.js";
import './components/ui/Switch/Switch.css';/* empty css */
const p = ({
id: t = void 0,
label: s = "",
checked: o = !1,
setValue: r,
name: i,
disabled: n = !1
}) => {
const h = () => /* @__PURE__ */ e.jsx(
"svg",
{
width: "12",
height: "12",
viewBox: "0 0 12 12",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
"aria-hidden": "true",
children: /* @__PURE__ */ e.jsx(
"path",
{
d: "M9 3L3 9M3 3L9 9",
stroke: "rgba(255, 255, 255, 0.5)",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}
)
}
), a = () => /* @__PURE__ */ e.jsx(
"svg",
{
width: "12",
height: "12",
viewBox: "0 0 12 12",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
"aria-hidden": "true",
children: /* @__PURE__ */ e.jsx(
"path",
{
d: "M10 3L4.5 8.5L2 6",
stroke: "rgba(255, 255, 255, 0.5)",
strokeWidth: "2",
strokeLinecap: "round",
strokeLinejoin: "round"
}
)
}
);
return /* @__PURE__ */ e.jsxs(x, { alignItems: "center", gap: "x16", children: [
s && /* @__PURE__ */ e.jsx("label", { className: "text-muted fs-6 fw-bold", htmlFor: t, children: s }),
/* @__PURE__ */ e.jsx(
l,
{
id: t,
disabled: n,
checked: o,
onCheckedChange: (d) => {
r(i ?? "", d);
},
className: "ui-switch",
"aria-label": s,
children: /* @__PURE__ */ e.jsx(c, { className: "ui-switch-thumb", children: o ? /* @__PURE__ */ e.jsx(a, {}) : /* @__PURE__ */ e.jsx(h, {}) })
}
)
] });
};
export {
p as Switch
};
//# sourceMappingURL=index.es47.js.map