@volverjs/ui-vue 0.0.10-beta.50 → 0.0.10-beta.52

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 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=t(e.vue,e.vue$1,e.core)}(this,(function(e,t,l){"use strict";var o=(e=>(e.local="local",e.session="session",e))(o||{}),a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("volver"),d={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},s={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},v={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},c={disabled:{type:Boolean,default:!1}},f=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),p={readonly:{type:Boolean,default:!1}},m={modifiers:{type:[String,Array],default:void 0}},h={hintLabel:{type:String,default:""}},g={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},b={debounce:{type:[Number,String],default:void 0}},y={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:i.before,validation:e=>Object.values(i).includes(e)}},S={tabindex:{type:[String,Number],default:0}},L={floating:{type:Boolean,default:!1}},B={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const x={...{...B,name:{type:String,required:!0}},...{autofocus:{type:Boolean,default:!1}},...{autocomplete:{type:String,default:"off"}},...S,...c,...p,...d,...s,...h,...v,...m,...g,...b,...y,...L,...f,minlength:{type:[String,Number],default:void 0},maxlength:{type:[String,Number],default:void 0},placeholder:{type:String,default:void 0},required:{type:Boolean,default:!1}};n.button,r.button,o.local;const $={...x,modelValue:String,cols:{type:[String,Number],default:20},rows:{type:[String,Number],default:2},wrap:{type:String,default:"soft"},spellcheck:{type:[Boolean,String],default:"default"},resizable:Boolean};function k(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function w(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const V={prefix:"normal"};function N(){return e.inject(u)}function O(t,l,o){return e.computed((()=>{const a={[t]:!0},i="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return i&&Array.isArray(i)&&i.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const P=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},V),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),i=e.ref(!0),n=N(),{modifiers:r}=e.toRefs(o),u=O("vv-icon",r),d=e.computed((()=>o.provider||(null==n?void 0:n.iconsProvider))),s=e.computed((()=>{const e=o.name??"",l=`@${d.value}:${o.prefix}:${e}`;if(t.iconExists(l))return l;const a=null==n?void 0:n.iconsCollections.find((l=>{const o=`@${d.value}:${l.prefix}:${e}`;return t.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function v(e){const l=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return n&&o.src&&!t.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(i.value=!1,n.fetchIcon(o.src).then((e=>{e&&(v(e),i.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(l,o)=>e.unref(i)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,onLoad:l.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}});const _=["for"],I={class:"vv-textarea__wrapper"},C={key:0,class:"vv-textarea__input-before"},E={class:"vv-textarea__inner"},z=["id"],A={key:1,class:"vv-textarea__input-after"},j={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:$,emits:["update:modelValue","focus","blur","keyup"],setup(t,{emit:o}){const n=t,r=o,u=e.useSlots(),d=function(t,l,o){const a=N(),i=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===i.value)return o;const e=i.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const i=a[o];if(l[o]=i,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===i&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===i&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(i)&&(l[o]=e[o]):a===i&&(l[o]=e[o])}}return l}),{})}))}("VvTextarea",$,n),s=e.ref(),{id:v,icon:c,iconPosition:f,label:p,modelValue:m,count:h,valid:g,invalid:b,loading:y,modifiers:S,debounce:L,minlength:B,maxlength:x}=e.toRefs(n),V=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(v),R=e.computed((()=>`${V.value}-hint`)),T=e.computed((()=>n.floating&&k(n.placeholder)?" ":n.placeholder)),F=function(t,l,o=0,{getter:a=e=>e,setter:i=e=>e}={}){let n;return"string"==typeof o&&(o=Number.parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{n&&clearTimeout(n),n=setTimeout((()=>{l("update:modelValue",i(e))}),o)}})}(m,r,null==L?void 0:L.value),{hasIconBefore:q,hasIconAfter:D}=function(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),n=e.computed((()=>(null==l?void 0:l.value)===i.before?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===i.after?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===a.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===a.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===a.top?o.value:void 0)),v=e.computed((()=>(null==l?void 0:l.value)===a.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:v,hasIconBefore:n,hasIconAfter:r}}(c,f),{focused:H}=function(t,o){const{focused:a}=l.useFocus(t);return e.watch(a,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:a}}(s,r),M=l.useElementVisibility(s);e.watch(M,(e=>{e&&n.autofocus&&(H.value=!0)}));const{formatted:J}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),i=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:i}}(F,{mode:null==h?void 0:h.value,upperLimit:Number(null==x?void 0:x.value),lowerLimit:Number(null==B?void 0:B.value)}),K=e.computed((()=>!n.disabled&&!n.readonly)),U=e.computed((()=>K.value?n.tabindex:-1)),G=e.computed((()=>!k(m))),Q=e.computed((()=>!0===n.invalid||!0!==n.valid&&void 0)),{HintSlot:W,hasHintLabelOrSlot:X,hasInvalidLabelOrSlot:Y,hintSlotScope:Z}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>w(o.value.invalidLabel))),i=e.computed((()=>w(o.value.validLabel))),n=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||n.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(l.valid||i.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:a,validLabel:i,loadingLabel:n,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,o,a,i,n,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(i=this.$slots).valid)?void 0:n.call(i))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(d,u),ee=O("vv-textarea",S,e.computed((()=>({valid:g.value,invalid:b.value,loading:y.value,disabled:n.disabled,readonly:n.readonly,"icon-before":void 0!==q.value,"icon-after":void 0!==D.value,floating:n.floating&&!k(n.label),dirty:G.value,focus:H.value,resizable:n.resizable})))),te=e.computed((()=>({name:n.name,placeholder:T.value,tabindex:U.value,disabled:n.disabled,readonly:n.readonly,required:n.required,autocomplete:n.autocomplete,minlength:n.minlength,maxlength:n.maxlength,cols:n.cols,rows:n.rows,wrap:n.wrap,spellcheck:n.spellcheck,"aria-invalid":Q.value,"aria-describedby":X.value?R.value:void 0,"aria-errormessage":Y.value?R.value:void 0}))),le=e.computed((()=>({valid:n.valid,invalid:n.invalid,modelValue:n.modelValue,hintLabel:n.hintLabel,maxlength:n.maxlength,minlength:n.minlength,clear:oe})));function oe(){F.value=void 0}return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ee))},[e.unref(p)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(V),class:"vv-textarea__label"},e.toDisplayString(e.unref(p)),9,_)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",I,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",C,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",E,[e.unref(q)?(e.openBlock(),e.createBlock(P,e.mergeProps({key:0},e.unref(q),{class:"vv-textarea__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(V),ref_key:"textarea",ref:s,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(F)?F.value=t:null)},e.unref(te),{onKeyup:l[1]||(l[1]=e=>r("keyup",e))}),null,16,z),[[e.vModelText,e.unref(F)]]),e.unref(D)?(e.openBlock(),e.createBlock(P,e.mergeProps({key:1},e.unref(D),{class:"vv-textarea__icon vv-textarea__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.unref(h)?(e.openBlock(),e.createElementBlock("span",j,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(le))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(J)),1)]))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(W),{id:e.unref(R),class:"vv-textarea__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=t(e.vue,e.vue$1,e.core)}(this,(function(e,t,l){"use strict";function o(t){return null==(l=e.unref(t))||""===l||Array.isArray(l)&&0===l.length||!(l instanceof Date)&&"object"==typeof l&&0===Object.keys(l).length;var l}function a(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const i={prefix:"normal"};var n=(e=>(e.local="local",e.session="session",e))(n||{}),r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),u=(e=>(e.before="before",e.after="after",e))(u||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{}),s=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(s||{});const v=Symbol.for("volver");function c(){return e.inject(v)}function f(t,l,o){return e.computed((()=>{const a={[t]:!0},i="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return i&&Array.isArray(i)&&i.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const p=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},i),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),i=e.ref(!0),n=c(),{modifiers:r}=e.toRefs(o),u=f("vv-icon",r),d=e.computed((()=>o.provider||(null==n?void 0:n.iconsProvider))),s=e.computed((()=>{const e=o.name??"",l=`@${d.value}:${o.prefix}:${e}`;if(t.iconExists(l))return l;const a=null==n?void 0:n.iconsCollections.find((l=>{const o=`@${d.value}:${l.prefix}:${e}`;return t.iconExists(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function v(e){const l=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return n&&o.src&&!t.iconExists(`@${d.value}:${o.prefix}:${o.name}`)&&(i.value=!1,n.fetchIcon(o.src).then((e=>{e&&(v(e),i.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&v(o.svg),(l,o)=>e.unref(i)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,onLoad:l.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),m={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},h={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},g={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},b={disabled:{type:Boolean,default:!1}},y={required:{type:Boolean,default:!1}},S=(Boolean,Boolean,Boolean,{label:{type:[String,Number],default:void 0}}),L={readonly:{type:Boolean,default:!1}},B={modifiers:{type:[String,Array],default:void 0}},x={hintLabel:{type:String,default:""}},$={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},k={debounce:{type:[Number,String],default:void 0}},w={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:u.before,validation:e=>Object.values(u).includes(e)}},V={tabindex:{type:[String,Number],default:0}},N={floating:{type:Boolean,default:!1}},O={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const P={...{...O,name:{type:String,required:!0}},...{autofocus:{type:Boolean,default:!1}},...{autocomplete:{type:String,default:"off"}},...V,...b,...L,...m,...h,...x,...g,...B,...$,...k,...w,...N,...S,minlength:{type:[String,Number],default:void 0},maxlength:{type:[String,Number],default:void 0},placeholder:{type:String,default:void 0},...y};d.button,s.button,n.local;const _={...P,modelValue:String,cols:{type:[String,Number],default:20},rows:{type:[String,Number],default:2},wrap:{type:String,default:"soft"},spellcheck:{type:[Boolean,String],default:"default"},resizable:Boolean};const I=["for"],C={class:"vv-textarea__wrapper"},E={key:0,class:"vv-textarea__input-before"},z={class:"vv-textarea__inner"},A=["id"],j={key:1,class:"vv-textarea__input-after"},R={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:_,emits:["update:modelValue","focus","blur","keyup"],setup(t,{emit:i}){const n=t,d=i,s=e.useSlots(),v=function(t,l,o){const a=c(),i=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===i.value)return o;const e=i.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const i=a[o];if(l[o]=i,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===i&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===i&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(i)&&(l[o]=e[o]):a===i&&(l[o]=e[o])}}return l}),{})}))}("VvTextarea",_,n),m=e.ref(),{id:h,icon:g,iconPosition:b,label:y,modelValue:S,count:L,valid:B,invalid:x,loading:$,modifiers:k,debounce:w,minlength:V,maxlength:N}=e.toRefs(n),O=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(h),P=e.computed((()=>`${O.value}-hint`)),T=e.computed((()=>n.floating&&o(n.placeholder)?" ":n.placeholder)),F=function(t,l,o=0,{getter:a=e=>e,setter:i=e=>e}={}){let n;return"string"==typeof o&&(o=Number.parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{n&&clearTimeout(n),n=setTimeout((()=>{l("update:modelValue",i(e))}),o)}})}(S,d,null==w?void 0:w.value),{hasIconBefore:q,hasIconAfter:D}=function(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==l?void 0:l.value)===u.before?o.value:void 0)),i=e.computed((()=>(null==l?void 0:l.value)===u.after?o.value:void 0)),n=e.computed((()=>(null==l?void 0:l.value)===r.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===r.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===r.top?o.value:void 0)),v=e.computed((()=>(null==l?void 0:l.value)===r.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:n,hasIconRight:d,hasIconTop:s,hasIconBottom:v,hasIconBefore:a,hasIconAfter:i}}(g,b),{focused:H}=function(t,o){const{focused:a}=l.useFocus(t);return e.watch(a,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:a}}(m,d),M=l.useElementVisibility(m);e.watch(M,(e=>{e&&n.autofocus&&(H.value=!0)}));const{formatted:J}=function(t,l){const o=e.computed((()=>(e.unref(t)??"").length)),a=e.computed((()=>void 0!==(null==l?void 0:l.lowerLimit)&&o.value<(null==l?void 0:l.lowerLimit)?o.value-l.lowerLimit:void 0!==(null==l?void 0:l.upperLimit)&&o.value<(null==l?void 0:l.upperLimit)?l.upperLimit-o.value:0)),i=e.computed((()=>{if(!1===(null==l?void 0:l.mode))return"";if("limit"===(null==l?void 0:l.mode)&&(null==l?void 0:l.upperLimit))return`${o.value} / ${l.lowerLimit?`${l.lowerLimit}-`:""}${l.upperLimit}`;if("countdown"===(null==l?void 0:l.mode)){if(0===a.value)return;return a}return o.value}));return{length:o,gap:a,formatted:i}}(F,{mode:null==L?void 0:L.value,upperLimit:Number(null==N?void 0:N.value),lowerLimit:Number(null==V?void 0:V.value)}),K=e.computed((()=>!n.disabled&&!n.readonly)),U=e.computed((()=>K.value?n.tabindex:-1)),G=e.computed((()=>!o(S))),Q=e.computed((()=>!0===n.invalid||!0!==n.valid&&void 0)),{HintSlot:W,hasHintLabelOrSlot:X,hasInvalidLabelOrSlot:Y,hintSlotScope:Z}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),i=e.computed((()=>a(o.value.invalidLabel))),n=e.computed((()=>a(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),u=e.computed((()=>o.value.hintLabel)),d=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.value)))),s=e.computed((()=>!d.value&&Boolean(o.value.invalid&&(l.invalid||i.value)))),v=e.computed((()=>!d.value&&!s.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!d.value&&!s.value&&!v.value&&Boolean(l.hint||u.value))),f=e.computed((()=>s.value||v.value||d.value||c.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:i,validLabel:n,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:d,hasHintLabelOrSlot:c}),render(){var t,l,o,a,i,n,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(i=this.$slots).valid)?void 0:n.call(i))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:v,hasLoadingLabelOrSlot:d,hintSlotScope:p,HintSlot:m}}(v,s),ee=f("vv-textarea",k,e.computed((()=>({valid:B.value,invalid:x.value,loading:$.value,disabled:n.disabled,readonly:n.readonly,"icon-before":void 0!==q.value,"icon-after":void 0!==D.value,floating:n.floating&&!o(n.label),dirty:G.value,focus:H.value,resizable:n.resizable})))),te=e.computed((()=>({name:n.name,placeholder:T.value,tabindex:U.value,disabled:n.disabled,readonly:n.readonly,required:n.required,autocomplete:n.autocomplete,minlength:n.minlength,maxlength:n.maxlength,cols:n.cols,rows:n.rows,wrap:n.wrap,spellcheck:n.spellcheck,"aria-invalid":Q.value,"aria-describedby":X.value?P.value:void 0,"aria-errormessage":Y.value?P.value:void 0}))),le=e.computed((()=>({valid:n.valid,invalid:n.invalid,modelValue:n.modelValue,hintLabel:n.hintLabel,maxlength:n.maxlength,minlength:n.minlength,clear:oe})));function oe(){F.value=void 0}return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ee))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(O),class:"vv-textarea__label"},e.toDisplayString(e.unref(y)),9,I)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",C,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",E,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[e.unref(q)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0},e.unref(q),{class:"vv-textarea__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(O),ref_key:"textarea",ref:m,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(F)?F.value=t:null)},e.unref(te),{onKeyup:l[1]||(l[1]=e=>d("keyup",e))}),null,16,A),[[e.vModelText,e.unref(F)]]),e.unref(D)?(e.openBlock(),e.createBlock(p,e.mergeProps({key:1},e.unref(D),{class:"vv-textarea__icon vv-textarea__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),t.$slots.after?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(le))))])):e.createCommentVNode("v-if",!0),e.unref(L)?(e.openBlock(),e.createElementBlock("span",R,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(le))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(J)),1)]))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(W),{id:e.unref(P),class:"vv-textarea__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(Z))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
@@ -17,6 +17,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<gl
17
17
  default: string;
18
18
  };
19
19
  resizable: BooleanConstructor;
20
+ required: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
20
24
  minlength: {
21
25
  type: (StringConstructor | NumberConstructor)[];
22
26
  default: undefined;
@@ -29,10 +33,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<gl
29
33
  type: StringConstructor;
30
34
  default: undefined;
31
35
  };
32
- required: {
33
- type: BooleanConstructor;
34
- default: boolean;
35
- };
36
36
  label: {
37
37
  type: (StringConstructor | NumberConstructor)[];
38
38
  default: undefined;
@@ -135,6 +135,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<gl
135
135
  default: string;
136
136
  };
137
137
  resizable: BooleanConstructor;
138
+ required: {
139
+ type: BooleanConstructor;
140
+ default: boolean;
141
+ };
138
142
  minlength: {
139
143
  type: (StringConstructor | NumberConstructor)[];
140
144
  default: undefined;
@@ -147,10 +151,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<gl
147
151
  type: StringConstructor;
148
152
  default: undefined;
149
153
  };
150
- required: {
151
- type: BooleanConstructor;
152
- default: boolean;
153
- };
154
154
  label: {
155
155
  type: (StringConstructor | NumberConstructor)[];
156
156
  default: undefined;
@@ -51,6 +51,10 @@ export declare const VvTextareaProps: {
51
51
  * If true, the textarea will be resizable
52
52
  */
53
53
  resizable: BooleanConstructor;
54
+ required: {
55
+ type: BooleanConstructor;
56
+ default: boolean;
57
+ };
54
58
  minlength: {
55
59
  type: (StringConstructor | NumberConstructor)[];
56
60
  default: undefined;
@@ -63,10 +67,6 @@ export declare const VvTextareaProps: {
63
67
  type: StringConstructor;
64
68
  default: undefined;
65
69
  };
66
- required: {
67
- type: BooleanConstructor;
68
- default: boolean;
69
- };
70
70
  label: {
71
71
  type: (StringConstructor | NumberConstructor)[];
72
72
  default: undefined;
@@ -170,6 +170,15 @@ const DisabledProps = {
170
170
  default: false
171
171
  }
172
172
  };
173
+ const RequiredProps = {
174
+ /**
175
+ * Whether the form control is required
176
+ */
177
+ required: {
178
+ type: Boolean,
179
+ default: false
180
+ }
181
+ };
173
182
  const SelectedProps = {
174
183
  /**
175
184
  * Whether the item is selected
@@ -490,10 +499,7 @@ const InputTextareaProps = {
490
499
  * Available for all input types except color
491
500
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
492
501
  */
493
- required: {
494
- type: Boolean,
495
- default: false
496
- }
502
+ ...RequiredProps
497
503
  };
498
504
  const CheckboxRadioProps = {
499
505
  ...IdNameProps,
@@ -3310,180 +3316,6 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3310
3316
  };
3311
3317
  }
3312
3318
  });
3313
- const VvComboboxProps = {
3314
- ...IdNameProps,
3315
- ...TabindexProps,
3316
- ...ValidProps,
3317
- ...InvalidProps,
3318
- ...HintProps,
3319
- ...LoadingProps,
3320
- ...DisabledProps,
3321
- ...ReadonlyProps,
3322
- ...ModifiersProps,
3323
- ...OptionsProps,
3324
- ...IconProps,
3325
- ...FloatingLabelProps,
3326
- ...DropdownProps,
3327
- ...LabelProps,
3328
- /**
3329
- * Dropdown show / hide transition name
3330
- */
3331
- transitionName: {
3332
- type: String,
3333
- default: "vv-dropdown--mobile-fade-block"
3334
- },
3335
- /**
3336
- * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
3337
- */
3338
- modelValue: {
3339
- type: [String, Number, Boolean, Object, Array],
3340
- default: void 0
3341
- },
3342
- /**
3343
- * Label for no search results
3344
- */
3345
- noResultsLabel: { type: String, default: "No results" },
3346
- /**
3347
- * Label for no options available
3348
- */
3349
- noOptionsLabel: { type: String, default: "No options available" },
3350
- /**
3351
- * Label for selected option hint
3352
- */
3353
- selectedHintLabel: { type: String, default: "Selected" },
3354
- /**
3355
- * Label for deselect action button
3356
- */
3357
- deselectActionLabel: { type: String, default: "Deselect" },
3358
- /**
3359
- * Label for select option hint
3360
- */
3361
- selectHintLabel: { type: String, default: "Press enter to select" },
3362
- /**
3363
- * Label for deselected option hint
3364
- */
3365
- deselectHintLabel: { type: String, default: "Press enter to remove" },
3366
- /**
3367
- * Label close button
3368
- */
3369
- closeLabel: { type: String, default: "Close" },
3370
- /**
3371
- * Select input placeholder
3372
- */
3373
- placeholder: String,
3374
- /**
3375
- * Use input text to search on options
3376
- */
3377
- searchable: Boolean,
3378
- /**
3379
- * Search function to filter options
3380
- */
3381
- searchFunction: {
3382
- type: Function,
3383
- default: void 0
3384
- },
3385
- /**
3386
- * On searchable select is the input search placeholder
3387
- */
3388
- searchPlaceholder: {
3389
- type: String,
3390
- default: "Search..."
3391
- },
3392
- /**
3393
- * The input search debounce time in ms
3394
- */
3395
- debounceSearch: {
3396
- type: [Number, String],
3397
- default: 0
3398
- },
3399
- /**
3400
- * Manage modelValue as string[] or object[]
3401
- */
3402
- multiple: Boolean,
3403
- /**
3404
- * The min number of selected values
3405
- */
3406
- minValues: {
3407
- type: [Number, String],
3408
- default: 0
3409
- },
3410
- /**
3411
- * The max number of selected values
3412
- */
3413
- maxValues: [Number, String],
3414
- /**
3415
- * If true the input will be unselectable
3416
- * @deprecated use minValues instead
3417
- */
3418
- unselectable: { type: Boolean, default: true },
3419
- /**
3420
- * The select label separator visible to the user
3421
- */
3422
- separator: { type: String, default: ", " },
3423
- /**
3424
- * Show native select
3425
- */
3426
- native: Boolean,
3427
- /**
3428
- * Show badges
3429
- */
3430
- badges: Boolean,
3431
- /**
3432
- * Badge modifiers
3433
- */
3434
- badgeModifiers: {
3435
- type: [String, Array],
3436
- default: "action sm"
3437
- },
3438
- /**
3439
- * Set dropdown width to the same as the trigger
3440
- */
3441
- triggerWidth: {
3442
- ...DropdownProps.triggerWidth,
3443
- default: true
3444
- },
3445
- /**
3446
- * Dropdown modifiers
3447
- */
3448
- dropdownModifiers: {
3449
- type: [String, Array],
3450
- default: "mobile"
3451
- },
3452
- /**
3453
- * Open dropdown on focus
3454
- */
3455
- autoOpen: {
3456
- type: Boolean,
3457
- default: false
3458
- },
3459
- /**
3460
- * Select first option automatically
3461
- */
3462
- autoselectFirst: {
3463
- type: Boolean,
3464
- default: false
3465
- },
3466
- /**
3467
- * Keep open dropdown on single select
3468
- */
3469
- keepOpen: {
3470
- type: Boolean,
3471
- default: false
3472
- }
3473
- };
3474
- function useVvComboboxProps() {
3475
- return {
3476
- ...VvComboboxProps,
3477
- options: {
3478
- ...VvComboboxProps.options,
3479
- type: Array
3480
- },
3481
- searchFunction: {
3482
- ...VvComboboxProps.searchFunction,
3483
- type: Function
3484
- }
3485
- };
3486
- }
3487
3319
  const VvDropdownProps = {
3488
3320
  ...IdProps,
3489
3321
  ...DropdownProps,
@@ -4503,6 +4335,181 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4503
4335
  };
4504
4336
  }
4505
4337
  });
4338
+ const VvComboboxProps = {
4339
+ ...IdNameProps,
4340
+ ...TabindexProps,
4341
+ ...ValidProps,
4342
+ ...InvalidProps,
4343
+ ...HintProps,
4344
+ ...LoadingProps,
4345
+ ...DisabledProps,
4346
+ ...ReadonlyProps,
4347
+ ...ModifiersProps,
4348
+ ...OptionsProps,
4349
+ ...IconProps,
4350
+ ...FloatingLabelProps,
4351
+ ...DropdownProps,
4352
+ ...LabelProps,
4353
+ ...RequiredProps,
4354
+ /**
4355
+ * Dropdown show / hide transition name
4356
+ */
4357
+ transitionName: {
4358
+ type: String,
4359
+ default: "vv-dropdown--mobile-fade-block"
4360
+ },
4361
+ /**
4362
+ * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
4363
+ */
4364
+ modelValue: {
4365
+ type: [String, Number, Boolean, Object, Array],
4366
+ default: void 0
4367
+ },
4368
+ /**
4369
+ * Label for no search results
4370
+ */
4371
+ noResultsLabel: { type: String, default: "No results" },
4372
+ /**
4373
+ * Label for no options available
4374
+ */
4375
+ noOptionsLabel: { type: String, default: "No options available" },
4376
+ /**
4377
+ * Label for selected option hint
4378
+ */
4379
+ selectedHintLabel: { type: String, default: "Selected" },
4380
+ /**
4381
+ * Label for deselect action button
4382
+ */
4383
+ deselectActionLabel: { type: String, default: "Deselect" },
4384
+ /**
4385
+ * Label for select option hint
4386
+ */
4387
+ selectHintLabel: { type: String, default: "Press enter to select" },
4388
+ /**
4389
+ * Label for deselected option hint
4390
+ */
4391
+ deselectHintLabel: { type: String, default: "Press enter to remove" },
4392
+ /**
4393
+ * Label close button
4394
+ */
4395
+ closeLabel: { type: String, default: "Close" },
4396
+ /**
4397
+ * Select input placeholder
4398
+ */
4399
+ placeholder: String,
4400
+ /**
4401
+ * Use input text to search on options
4402
+ */
4403
+ searchable: Boolean,
4404
+ /**
4405
+ * Search function to filter options
4406
+ */
4407
+ searchFunction: {
4408
+ type: Function,
4409
+ default: void 0
4410
+ },
4411
+ /**
4412
+ * On searchable select is the input search placeholder
4413
+ */
4414
+ searchPlaceholder: {
4415
+ type: String,
4416
+ default: "Search..."
4417
+ },
4418
+ /**
4419
+ * The input search debounce time in ms
4420
+ */
4421
+ debounceSearch: {
4422
+ type: [Number, String],
4423
+ default: 0
4424
+ },
4425
+ /**
4426
+ * Manage modelValue as string[] or object[]
4427
+ */
4428
+ multiple: Boolean,
4429
+ /**
4430
+ * The min number of selected values
4431
+ */
4432
+ minValues: {
4433
+ type: [Number, String],
4434
+ default: 0
4435
+ },
4436
+ /**
4437
+ * The max number of selected values
4438
+ */
4439
+ maxValues: [Number, String],
4440
+ /**
4441
+ * If true the input will be unselectable
4442
+ * @deprecated use minValues instead
4443
+ */
4444
+ unselectable: { type: Boolean, default: true },
4445
+ /**
4446
+ * The select label separator visible to the user
4447
+ */
4448
+ separator: { type: String, default: ", " },
4449
+ /**
4450
+ * Show native select
4451
+ */
4452
+ native: Boolean,
4453
+ /**
4454
+ * Show badges
4455
+ */
4456
+ badges: Boolean,
4457
+ /**
4458
+ * Badge modifiers
4459
+ */
4460
+ badgeModifiers: {
4461
+ type: [String, Array],
4462
+ default: "action sm"
4463
+ },
4464
+ /**
4465
+ * Set dropdown width to the same as the trigger
4466
+ */
4467
+ triggerWidth: {
4468
+ ...DropdownProps.triggerWidth,
4469
+ default: true
4470
+ },
4471
+ /**
4472
+ * Dropdown modifiers
4473
+ */
4474
+ dropdownModifiers: {
4475
+ type: [String, Array],
4476
+ default: "mobile"
4477
+ },
4478
+ /**
4479
+ * Open dropdown on focus
4480
+ */
4481
+ autoOpen: {
4482
+ type: Boolean,
4483
+ default: false
4484
+ },
4485
+ /**
4486
+ * Select first option automatically
4487
+ */
4488
+ autoselectFirst: {
4489
+ type: Boolean,
4490
+ default: false
4491
+ },
4492
+ /**
4493
+ * Keep open dropdown on single select
4494
+ */
4495
+ keepOpen: {
4496
+ type: Boolean,
4497
+ default: false
4498
+ }
4499
+ };
4500
+ function useVvComboboxProps() {
4501
+ return {
4502
+ ...VvComboboxProps,
4503
+ options: {
4504
+ ...VvComboboxProps.options,
4505
+ type: Array
4506
+ },
4507
+ searchFunction: {
4508
+ ...VvComboboxProps.searchFunction,
4509
+ type: Function
4510
+ }
4511
+ };
4512
+ }
4506
4513
  const _hoisted_1$8 = ["id"];
4507
4514
  const _hoisted_2$6 = ["id", "for"];
4508
4515
  const _hoisted_3$4 = ["id", "aria-controls", "placeholder"];
@@ -4625,6 +4632,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4625
4632
  iconPosition,
4626
4633
  modifiers,
4627
4634
  disabled,
4635
+ required,
4628
4636
  readonly,
4629
4637
  loading,
4630
4638
  valid,
@@ -4688,6 +4696,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4688
4696
  modifiers,
4689
4697
  computed(() => ({
4690
4698
  "disabled": disabled.value,
4699
+ "required": required.value,
4691
4700
  "loading": isLoading.value,
4692
4701
  "readonly": readonly.value,
4693
4702
  "icon-before": hasIconBefore.value !== void 0,
@@ -6836,6 +6845,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6836
6845
  "invalid": invalid.value,
6837
6846
  "loading": loading.value,
6838
6847
  "disabled": props.disabled,
6848
+ "required": props.required,
6839
6849
  "readonly": props.readonly,
6840
6850
  "icon-before": !!hasIconBefore.value,
6841
6851
  "icon-after": !!iconAfter.value,