@uva-glass/component-library
Version:
React components UvA
67 lines (66 loc) • 2.04 kB
JavaScript
import { jsx as l, jsxs as _ } from "react/jsx-runtime";
import { c as a } from "../../clsx-OuTLNxxd.js";
import '../../assets/ToggleSwitch.css';const t = {
"toggle-switch": "_toggle-switch_1df21_1",
"toggle-switch__visible": "_toggle-switch__visible_1df21_9",
"toggle-switch--disabled": "_toggle-switch--disabled_1df21_54",
"toggle-switch--loading": "_toggle-switch--loading_1df21_64",
"toggle-switch--visually-hidden": "_toggle-switch--visually-hidden_1df21_74",
"toggle-switch--disabled-label": "_toggle-switch--disabled-label_1df21_87",
"toggle-switch--loading-cursor": "_toggle-switch--loading-cursor_1df21_91",
"toggle-switch--extra-left-gap": "_toggle-switch--extra-left-gap_1df21_95"
};
function n({
condition: i,
wrapper: g,
children: e
}) {
return i ? g(e) : e;
}
function f({
label: i,
labelPosition: g = "after",
labelVisible: e = !0,
loading: o = !1,
extraLeftGap: d,
...s
}) {
const c = /* @__PURE__ */ l(
"span",
{
className: a(
{ [t["toggle-switch--visually-hidden"]]: !e },
{ [t["toggle-switch--disabled-label"]]: s.disabled }
),
children: i
}
);
return /* @__PURE__ */ l(
n,
{
condition: o,
wrapper: (h) => /* @__PURE__ */ l("div", { className: t["toggle-switch--loading-cursor"], children: h }),
children: /* @__PURE__ */ _(
"label",
{
className: a(
t["toggle-switch"],
{ [t["toggle-switch--disabled"]]: s.disabled },
{ [t["toggle-switch--loading"]]: o },
{ [t["toggle-switch--extra-left-gap"]]: d }
),
children: [
g === "before" && c,
/* @__PURE__ */ l("input", { className: t["toggle-switch--visually-hidden"], ...s, type: "checkbox" }),
/* @__PURE__ */ l("span", { className: t["toggle-switch__visible"], title: e ? "" : i }),
g === "after" && c
]
}
)
}
);
}
export {
f as ToggleSwitch
};
//# sourceMappingURL=ToggleSwitch.js.map