vue3-float-label 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as t, computed as m, watch as I, onMounted as N, onBeforeUnmount as M,
|
|
1
|
+
import { ref as t, computed as m, watch as I, onMounted as N, onBeforeUnmount as M, openBlock as v, createElementBlock as d, normalizeClass as g, renderSlot as W, unref as u, createElementVNode as x, toDisplayString as E, createCommentVNode as q, createTextVNode as A } from "vue";
|
|
2
2
|
const H = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "float-label__label float-label--no-click"
|
|
@@ -48,20 +48,20 @@ const H = {
|
|
|
48
48
|
}, 200)) : r.value = "", h();
|
|
49
49
|
}), M(() => {
|
|
50
50
|
p.value && U();
|
|
51
|
-
}), (l, o) => (
|
|
51
|
+
}), (l, o) => (v(), d("div", {
|
|
52
52
|
class: g(["float-label", { "float-label--fade-anim": L.value, "float-label--on-focus": s.onFocus, "float-label--fixed": w.value }]),
|
|
53
53
|
ref_key: "root",
|
|
54
54
|
ref: b
|
|
55
55
|
}, [
|
|
56
56
|
W(l.$slots, "default"),
|
|
57
|
-
u(a) === "" ? (
|
|
57
|
+
u(a) === "" ? (v(), d("div", H, [
|
|
58
58
|
x("span", R, E(u(c)), 1)
|
|
59
|
-
])) : (
|
|
59
|
+
])) : (v(), d("label", {
|
|
60
60
|
key: 1,
|
|
61
61
|
class: g(["float-label__label", { "float-label--no-click": u(a) === "select" }]),
|
|
62
62
|
for: u(n)
|
|
63
63
|
}, [
|
|
64
|
-
u(a) === "textarea" ? (
|
|
64
|
+
u(a) === "textarea" ? (v(), d("span", D)) : q("", !0),
|
|
65
65
|
o[0] || (o[0] = A()),
|
|
66
66
|
x("span", O, E(u(c)), 1)
|
|
67
67
|
], 10, z))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.Vue3FloatLabel={},o.Vue))})(this,function(o,e){"use strict";const _={key:0,class:"float-label__label float-label--no-click"},h={class:"float-label__label__text"},g=["for"],v={key:0,class:"float-label__label__bg"},E={class:"float-label__label__text"},k="[type=date], [type=datetime-local], [type=datetime], [type=email], [type=month], [type=number], [type=password], [type=search], [type=tel], [type=text], [type=time], [type=url], [type=week], textarea, select",x={__name:"FloatLabel",props:{label:{type:String,default:""},float:{type:Boolean,default:null},onFocus:{type:Boolean,default:!1}},setup(F){const r=F;let p=e.ref(null),u=e.ref(""),s=e.ref(""),B=e.ref(null),l=e.ref({}),c=e.ref(""),a=e.ref(""),f=e.ref(!1),d=e.ref(!1),m=e.ref(!1);const b=e.computed(()=>r.label),L=e.computed(()=>a.value==="select"?!0:s.value&&u.value!==s.value),T=e.computed(()=>{let t=!1;return r.float?t=!0:t=f.value&&f.value!=="0",t}),y=()=>{u.value=b.value?r.label:s.value},V=()=>l.value.getAttribute("id"),S=()=>("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16)),C=()=>{switch(a.value){case"input":case"textarea":return l.value.placeholder;case"select":let t=l.value.querySelector("option:disabled");return t?t.innerHTML:"";default:return""}},w=()=>{c.value||(c.value=S(),l.value.id=c.value)},N=()=>{a.value==="select"?l.value.addEventListener("change",i):l.value.addEventListener("input",i)},U=()=>{a.value==="select"?l.value.removeEventListener("change",i):l.value.removeEventListener("input",i)},i=t=>{f.value=t.target.value.length>0};return e.watch(b,(t,n)=>{y()}),e.onMounted(()=>{B.value=r.label,l.value=p.value.querySelector(k),d.value=!!l.value,m.value=r.float===null,d.value?(c.value=V(),a.value=l.value?l.value.tagName.toLowerCase():"",f.value=!!l.value.value,s.value=C(),w(),m.value===!0&&setTimeout(()=>{N()},200)):s.value="",y()}),e.onBeforeUnmount(()=>{d.value&&U()}),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["float-label",{"float-label--fade-anim":L.value,"float-label--on-focus":r.onFocus,"float-label--fixed":T.value}]),ref_key:"root",ref:p},[e.renderSlot(t.$slots,"default"),e.unref(a)===""?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("span",h,e.toDisplayString(e.unref(u)),1)])):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["float-label__label",{"float-label--no-click":e.unref(a)==="select"}]),for:e.unref(c)},[e.unref(a)==="textarea"?(e.openBlock(),e.createElementBlock("span",v)):e.createCommentVNode("",!0),n[0]||(n[0]=e.createTextVNode()),e.createElementVNode("span",E,e.toDisplayString(e.unref(u)),1)],10,g))],2))}};o.FloatLabel=x,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.Vue3FloatLabel={},o.Vue))})(this,(function(o,e){"use strict";const _={key:0,class:"float-label__label float-label--no-click"},h={class:"float-label__label__text"},g=["for"],v={key:0,class:"float-label__label__bg"},E={class:"float-label__label__text"},k="[type=date], [type=datetime-local], [type=datetime], [type=email], [type=month], [type=number], [type=password], [type=search], [type=tel], [type=text], [type=time], [type=url], [type=week], textarea, select",x={__name:"FloatLabel",props:{label:{type:String,default:""},float:{type:Boolean,default:null},onFocus:{type:Boolean,default:!1}},setup(F){const r=F;let p=e.ref(null),u=e.ref(""),s=e.ref(""),B=e.ref(null),l=e.ref({}),c=e.ref(""),a=e.ref(""),f=e.ref(!1),d=e.ref(!1),m=e.ref(!1);const b=e.computed(()=>r.label),L=e.computed(()=>a.value==="select"?!0:s.value&&u.value!==s.value),T=e.computed(()=>{let t=!1;return r.float?t=!0:t=f.value&&f.value!=="0",t}),y=()=>{u.value=b.value?r.label:s.value},V=()=>l.value.getAttribute("id"),S=()=>("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16)),C=()=>{switch(a.value){case"input":case"textarea":return l.value.placeholder;case"select":let t=l.value.querySelector("option:disabled");return t?t.innerHTML:"";default:return""}},w=()=>{c.value||(c.value=S(),l.value.id=c.value)},N=()=>{a.value==="select"?l.value.addEventListener("change",i):l.value.addEventListener("input",i)},U=()=>{a.value==="select"?l.value.removeEventListener("change",i):l.value.removeEventListener("input",i)},i=t=>{f.value=t.target.value.length>0};return e.watch(b,(t,n)=>{y()}),e.onMounted(()=>{B.value=r.label,l.value=p.value.querySelector(k),d.value=!!l.value,m.value=r.float===null,d.value?(c.value=V(),a.value=l.value?l.value.tagName.toLowerCase():"",f.value=!!l.value.value,s.value=C(),w(),m.value===!0&&setTimeout(()=>{N()},200)):s.value="",y()}),e.onBeforeUnmount(()=>{d.value&&U()}),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["float-label",{"float-label--fade-anim":L.value,"float-label--on-focus":r.onFocus,"float-label--fixed":T.value}]),ref_key:"root",ref:p},[e.renderSlot(t.$slots,"default"),e.unref(a)===""?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("span",h,e.toDisplayString(e.unref(u)),1)])):(e.openBlock(),e.createElementBlock("label",{key:1,class:e.normalizeClass(["float-label__label",{"float-label--no-click":e.unref(a)==="select"}]),for:e.unref(c)},[e.unref(a)==="textarea"?(e.openBlock(),e.createElementBlock("span",v)):e.createCommentVNode("",!0),n[0]||(n[0]=e.createTextVNode()),e.createElementVNode("span",E,e.toDisplayString(e.unref(u)),1)],10,g))],2))}};o.FloatLabel=x,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
|