vue-form-kit
Version:
  
125 lines (124 loc) • 3.24 kB
JavaScript
import { ref as m, openBlock as i, createBlock as f, resolveDynamicComponent as g, createSlots as c, withCtx as u, createElementBlock as y, withModifiers as h, renderSlot as r, createTextVNode as o, createCommentVNode as p, createElementVNode as S, normalizeClass as b, renderList as w, normalizeProps as k, guardReactiveProps as P } from "vue";
import { _ as x } from "./_plugin-vue_export-helper.9d74fd37.js";
const C = {
name: "FormPassword",
props: {
modelValue: {
type: String,
default: ""
},
dusk: {
type: String,
default: null
},
inputClass: {
type: [String, Array, Object],
default: null
},
tabindex: {
type: String,
default: null
},
label: {
type: String,
default: null
},
placeholder: {
type: String,
default: null
},
error: {
type: String,
default: null
},
id: {
type: String,
default: null
},
name: {
type: String,
default: null
},
autocomplete: {
type: String,
default: null
},
required: {
type: [String, Boolean],
default: !1
},
disabled: {
type: [String, Boolean],
default: !1
},
maxlength: {
type: String,
default: null
},
minlength: {
type: String,
default: null
},
inputWrapClass: {
type: [String, Object, Array],
default: null
}
},
emits: ["update:modelValue"],
setup() {
return {
hidePassword: m(!0)
};
}
}, V = ["id", "value", "dusk", "tabindex", "name", "type", "autocomplete", "required", "disabled", "placeholder", "maxlength", "minlength"];
function q(t, l, e, a, v, B) {
return i(), f(g(`${t.$formKitConfigs.componentPrefix}FormInputWrapper`), {
id: e.id,
label: e.label,
error: e.error,
required: e.required,
"input-wrap-class": e.inputWrapClass
}, c({
default: u(() => [
e.modelValue ? (i(), y("span", {
key: 0,
class: "form-input-action",
onClick: l[0] || (l[0] = h((n) => a.hidePassword = !a.hidePassword, ["prevent"]))
}, [
a.hidePassword ? r(t.$slots, "show-button", { key: 0 }, () => [
o(" Show ")
]) : r(t.$slots, "hide-button", { key: 1 }, () => [
o(" Hide ")
])
])) : p("", !0),
S("input", {
id: e.id,
value: e.modelValue,
dusk: e.dusk || `form--${e.name || e.id || "input"}`,
tabindex: e.tabindex,
name: e.name,
type: a.hidePassword ? "password" : "text",
autocomplete: e.autocomplete,
required: e.required,
disabled: e.disabled,
class: b(["form-input-text w-full", e.inputClass]),
placeholder: e.placeholder,
maxlength: e.maxlength,
minlength: e.minlength,
onInput: l[1] || (l[1] = (n) => t.$emit("update:modelValue", n.target.value))
}, null, 42, V)
]),
_: 2
}, [
w(t.$slots, (n, d) => ({
name: d,
fn: u((s) => [
r(t.$slots, d, k(P(s)))
])
}))
]), 1032, ["id", "label", "error", "required", "input-wrap-class"]);
}
const j = /* @__PURE__ */ x(C, [["render", q]]);
export {
j as default
};