@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
74 lines (73 loc) • 2.76 kB
JavaScript
import g from "./NeonToggle.es.js";
import { resolveComponent as b, openBlock as n, createElementBlock as o, normalizeClass as s, Fragment as u, renderList as c, withKeys as i, withModifiers as m, createElementVNode as k, mergeProps as y, createCommentVNode as d, renderSlot as h, createBlock as _, toDisplayString as $ } from "vue";
import v from "../../../_virtual/_plugin-vue_export-helper.es.js";
const f = ["aria-checked", "aria-disabled", "tabindex", "onKeydown"], w = ["checked", "disabled", "name", "value", "onClick"], p = {
key: 0,
class: "neon-toggle__radio-button"
}, V = {
key: 0,
class: "neon-toggle__radio-button-indicator"
}, C = { key: 1 };
function S(e, z, B, K, N, E) {
const t = b("neon-icon");
return n(), o("div", {
class: s([[
`neon-toggle--${e.toggleStyle}`,
`neon-toggle--${e.disabled ? "low-contrast" : e.color}`,
`neon-toggle--${e.orientation}`,
`neon-toggle--${e.size}`,
{ "neon-toggle--disabled": e.disabled }
], "neon-toggle"]),
role: "radiogroup"
}, [
(n(!0), o(u, null, c(e.model, (l, r) => (n(), o("label", {
key: l.key,
"aria-checked": l.key === e.modelValue,
"aria-disabled": e.disabled || l.disabled,
class: s([{
"neon-toggle__label--disabled": e.disabled || l.disabled,
"neon-toggle__label--checked": l.key === e.modelValue,
"neon-toggle__label--with-icon": l.icon,
"neon-toggle__label--with-slot-override": e.slots.option,
"neon-toggle__label--with-text": l.label
}, "neon-toggle__label no-style"]),
tabindex: !e.disabled && !l.disabled ? 0 : void 0,
role: "radio",
onKeydown: [
i((a) => e.selectOption(l), ["enter"]),
i(m((a) => e.selectOption(l), ["prevent"]), ["space"])
]
}, [
k("input", y({
checked: l.key === e.modelValue,
disabled: e.disabled || l.disabled,
name: e.name,
tabindex: -1,
value: l.key,
class: "neon-toggle__input",
type: "radio"
}, e.sanitizedAttributes, {
onClick: (a) => e.onInput(l.key)
}), null, 16, w),
e.toggleStyle === "radio-buttons" ? (n(), o("div", p, [
l.key === e.modelValue ? (n(), o("div", V)) : d("", !0)
])) : d("", !0),
h(e.$slots, "option", {
index: r,
option: l
}, () => [
l.icon ? (n(), _(t, {
key: 0,
disabled: e.disabled || l.disabled,
name: l.icon
}, null, 8, ["disabled", "name"])) : d("", !0),
l.label ? (n(), o("span", C, $(l.label), 1)) : d("", !0)
])
], 42, f))), 128))
], 2);
}
const F = /* @__PURE__ */ v(g, [["render", S]]);
export {
F as default
};
//# sourceMappingURL=NeonToggle.vue.es.js.map