UNPKG

@aotearoan/neon

Version:

Neon is a lightweight design library of Vue 3 components with minimal dependencies.

62 lines (61 loc) 2.43 kB
import h from "./NeonSwitch.es.js"; import { resolveComponent as c, openBlock as o, createElementBlock as s, normalizeClass as b, withModifiers as t, withKeys as d, createBlock as w, createCommentVNode as l, createElementVNode as a, mergeProps as p, toDisplayString as m } from "vue"; import u from "../../../_virtual/_plugin-vue_export-helper.es.js"; const k = ["aria-checked", "aria-disabled", "role"], g = ["tabindex"], f = /* @__PURE__ */ a("span", { class: "neon-switch__indicator" }, null, -1), y = [ f ], S = ["checked", "disabled"], $ = { key: 2, class: "neon-switch__label" }; function v(e, n, V, C, z, B) { const r = c("neon-icon"); return o(), s("label", { "aria-checked": e.indeterminate ? "mixed" : e.modelValue, "aria-disabled": e.disabled, class: b([[ `neon-switch--${e.switchStyle}`, `neon-switch--${e.size}`, `neon-switch--${e.color}`, `neon-switch--${e.labelPosition}`, { "neon-switch--disabled": e.disabled, "neon-switch--checked": e.modelValue, "neon-switch--indeterminate": e.indeterminate } ], "neon-switch no-style"]), role: e.switchStyle, tabindex: "-1", onClick: n[0] || (n[0] = t((...i) => e.toggleSwitch && e.toggleSwitch(...i), ["stop", "prevent"])), onKeydown: [ n[1] || (n[1] = d(t((...i) => e.toggleSwitch && e.toggleSwitch(...i), ["stop", "prevent"]), ["enter"])), n[2] || (n[2] = d(t((...i) => e.toggleSwitch && e.toggleSwitch(...i), ["stop", "prevent"]), ["space"])) ] }, [ e.switchStyle === "checkbox" ? (o(), w(r, { key: 0, disabled: e.disabled, inverse: !0, name: e.indeterminate ? "dash" : "check", tabindex: !e.disabled && e.label ? 0 : void 0, class: "neon-switch__checkbox" }, null, 8, ["disabled", "name", "tabindex"])) : l("", !0), e.switchStyle === "switch" ? (o(), s("span", { key: 1, tabindex: e.disabled ? void 0 : 0, class: "neon-switch__switch" }, y, 8, g)) : l("", !0), a("input", p({ ref: "checkbox", checked: !e.indeterminate && e.modelValue, disabled: e.disabled, class: "neon-switch__input", type: "checkbox" }, e.sanitizedAttributes), null, 16, S), e.label ? (o(), s("span", $, m(e.label), 1)) : l("", !0) ], 42, k); } const P = /* @__PURE__ */ u(h, [["render", v]]); export { P as default }; //# sourceMappingURL=NeonSwitch.vue.es.js.map