UNPKG

@craterapp/vue-sdk

Version:

Embedded Invoicing & Bill Pay for platforms.

130 lines (129 loc) 4.26 kB
import { u as F, c as b, t as m, r as f, a as $, d as V, b as x } from "./index-IlzZ4Xqv.js"; import { defineComponent as w, computed as g, resolveDirective as _, openBlock as i, createBlock as a, unref as o, withCtx as k, createElementVNode as l, withDirectives as y, createCommentVNode as p } from "vue"; const D = { class: "flex -space-x-px" }, M = { class: "min-w-0" }, S = /* @__PURE__ */ l("label", { for: "card-expiration-date", class: "sr-only" }, " Month ", -1), B = { class: "min-w-0" }, Y = /* @__PURE__ */ l("label", { for: "card-expiration-date", class: "sr-only" }, " Day ", -1), z = { class: "min-w-0" }, C = /* @__PURE__ */ l("label", { for: "card-expiration-date", class: "sr-only" }, " Year ", -1), U = /* @__PURE__ */ w({ __name: "DOBType", props: { modelValue: { type: String, default: null }, requirements: { type: Array, default: () => [] }, field: { type: Object, required: !0 }, placeholder: { type: String, default: "" }, validationScope: { type: String, required: !0 }, step: { type: Object, required: !0 } }, setup(d) { const n = d; F(); const h = { subFields: { [e("dob.day")]: { required: b.withMessage( m("validation.required"), f(e("dob.day")) ) }, [e("dob.month")]: { required: b.withMessage( m("validation.required"), f(e("dob.month")) ) }, [e("dob.year")]: { required: b.withMessage( m("validation.required"), f(e("dob.year")) ) } } }, r = $( h, g(() => n.field), { $scope: n.validationScope } ); function e(v) { return n.requirements.find((t) => t.includes(v)); } return (v, t) => { const u = V, q = x, c = _("maska"); return i(), a(q, { label: d.field.label, required: !!d.field.is_required, error: o(r).subFields[e("dob.day")].$error && o(r).subFields[e("dob.day")].$errors[0].$message || o(r).subFields[e("dob.month")].$error && o(r).subFields[e("dob.month")].$errors[0].$message || o(r).subFields[e("dob.year")].$error && o(r).subFields[e("dob.year")].$errors[0].$message }, { default: k(() => [ l("div", D, [ l("div", M, [ S, e("dob.month") ? y((i(), a(u, { key: 0, modelValue: d.field.subFields[e("dob.month")], "onUpdate:modelValue": t[0] || (t[0] = (s) => d.field.subFields[e("dob.month")] = s), placeholder: "MM", class: "w-14 text-center rounded-r-none relative focus:z-10", invalid: o(r).subFields[e("dob.month")].$error }, null, 8, ["modelValue", "invalid"])), [ [c, "##"] ]) : p("", !0) ]), l("div", B, [ Y, e("dob.day") ? y((i(), a(u, { key: 0, modelValue: d.field.subFields[e("dob.day")], "onUpdate:modelValue": t[1] || (t[1] = (s) => d.field.subFields[e("dob.day")] = s), placeholder: "DD", class: "w-14 text-center rounded-none relative focus:z-10", invalid: o(r).subFields[e("dob.day")].$error }, null, 8, ["modelValue", "invalid"])), [ [c, "##"] ]) : p("", !0) ]), l("div", z, [ C, e("dob.year") ? y((i(), a(u, { key: 0, modelValue: d.field.subFields[e("dob.year")], "onUpdate:modelValue": t[2] || (t[2] = (s) => d.field.subFields[e("dob.year")] = s), placeholder: "YYYY", class: "w-16 text-center rounded-l-none relative focus:z-10", invalid: o(r).subFields[e("dob.year")].$error }, null, 8, ["modelValue", "invalid"])), [ [c, "####"] ]) : p("", !0) ]) ]) ]), _: 1 }, 8, ["label", "required", "error"]); }; } }); export { U as default };