UNPKG

vue-form-kit

Version:

![NPM License](https://img.shields.io/npm/l/vue-form-kit) ![NPM Downloads](https://img.shields.io/npm/dt/vue-form-kit) ![NPM Version](https://img.shields.io/npm/v/vue-form-kit)

103 lines (102 loc) 2.96 kB
import { ref as b, watch as o, openBlock as s, createElementBlock as c, createElementVNode as n, withDirectives as m, vModelDynamic as f, renderSlot as i, normalizeProps as r, guardReactiveProps as u, normalizeClass as y, createCommentVNode as g } from "vue"; import { _ as h } from "./_plugin-vue_export-helper.9d74fd37.js"; const _ = { name: "FormCheckbox", props: { modelValue: { type: [String, Boolean, Array], default: null }, error: { type: String, default: null }, type: { type: String, default: "checkbox" }, label: { type: String, default: null }, labelClass: { type: [String, Object], default: null }, dusk: { type: String, default: null }, id: { type: String, default: null }, tabindex: { type: String, default: null }, name: { type: String, default: null }, value: { type: [String, Boolean, Number], default: null }, required: { type: String, default: null }, disabled: { type: [String, Boolean], default: null } }, emits: ["update:modelValue", "change"], setup(l, { emit: t }) { const e = b(l.modelValue); return o(e, (a) => t("update:modelValue", a)), o(() => l.modelValue, (a) => e.value = a), { checkboxValue: e }; } }, k = { class: "form-input-wrap" }, v = { class: "control control-checkbox relative" }, x = ["id", "dusk", "tabindex", "type", "name", "required", "disabled", "value"], S = /* @__PURE__ */ n("div", { class: "control_indicator" }, null, -1), q = { class: "flex" }, V = ["innerHTML"], C = ["innerHTML"]; function B(l, t, e, a, M, H) { return s(), c("div", k, [ n("label", v, [ m(n("input", { id: e.id, "onUpdate:modelValue": t[0] || (t[0] = (d) => a.checkboxValue = d), dusk: e.dusk || `form--${e.name || e.id || "input"}`, tabindex: e.tabindex, type: e.type, name: e.name, required: e.required, disabled: e.disabled, value: e.value, onChange: t[1] || (t[1] = (d) => l.$emit("change", d)) }, null, 40, x), [ [f, a.checkboxValue] ]), S, n("div", q, [ i(l.$slots, "label-prefix", r(u({ required: e.required, label: e.label }))), i(l.$slots, "label", r(u({ required: e.required, label: e.label })), () => [ n("span", { class: y(["pl-2", [e.required !== null ? "form-label--required" : "", e.labelClass]]), innerHTML: e.label }, null, 10, V) ]), i(l.$slots, "label-suffix", r(u({ required: e.required, label: e.label }))) ]) ]), e.error ? (s(), c("div", { key: 0, class: "form-validation-error", innerHTML: e.error }, null, 8, C)) : g("", !0) ]); } const w = /* @__PURE__ */ h(_, [["render", B]]); export { w as default };