UNPKG

@aotearoan/neon

Version:

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

66 lines (65 loc) 1.77 kB
import { defineComponent as u, useAttrs as s, ref as p, computed as d } from "vue"; import { NeonToggleChipSize as m } from "../../../model/user-input/toggle/NeonToggleChipSize.es.js"; import { NeonFunctionalColor as c } from "../../../model/common/color/NeonFunctionalColor.es.js"; import f from "../../presentation/icon/NeonIcon.vue.es.js"; const S = u({ name: "NeonToggleChip", components: { NeonIcon: f }, props: { /** * The toggle chip model. */ modelValue: { type: Boolean, required: !0 }, /** * The toggle label. Required unless overriding the slot contents. */ label: { type: String }, /** * The size of the toggle chip. */ size: { type: String, default: m.Medium }, /** * The toggle chip color. */ color: { type: String, default: c.Primary }, /** * Whether to display a checked icon on the toggle chip when it is 'on'. */ showCheck: { type: Boolean, default: !0 }, /** * Disabled state of the toggle chip. */ disabled: { type: Boolean, default: !1 } }, emits: [ /** * Emitted when the toggle chip is toggled on or off. * * @type {boolean} The state of the switch. */ "update:modelValue" ], setup(t, { emit: l }) { const a = s(), o = p(null), n = (i) => { var e; l("update:modelValue", i), (e = o.value) == null || e.blur(); }; return { sanitizedAttributes: d(() => { const { onClick: i, type: e, tabindex: b, ...r } = a; return { ...r }; }), toggleChipLabel: o, emitInput: n, toggleChip: () => { t.disabled || n(!t.modelValue); } }; } }); export { S as default }; //# sourceMappingURL=NeonToggleChip.es.js.map