@volverjs/ui-vue 0.0.1-beta.5 → 0.0.1-beta.8

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.
Files changed (82) hide show
  1. package/README.md +61 -2
  2. package/dist/components/VvButton/vv-button.es.js +56 -58
  3. package/dist/components/VvButton/vv-button.umd.js +1 -1
  4. package/dist/components/VvCheckGroup/vv-check-group.es.js +221 -203
  5. package/dist/components/VvCheckGroup/vv-check-group.umd.js +2 -2
  6. package/dist/components/VvInputText/VvInputText.d.ts +14 -0
  7. package/dist/components/VvInputText/VvInputText.vue.d.ts +36 -1
  8. package/dist/components/VvInputText/VvInputTextActions.d.ts +3 -0
  9. package/dist/components/VvInputText/vv-input-text.es.js +509 -380
  10. package/dist/components/VvInputText/vv-input-text.umd.js +2 -2
  11. package/dist/components/VvNativeSelect/vv-native-select.es.js +180 -161
  12. package/dist/components/VvNativeSelect/vv-native-select.umd.js +2 -2
  13. package/dist/components/VvRadioGroup/vv-radio-group.es.js +211 -193
  14. package/dist/components/VvRadioGroup/vv-radio-group.umd.js +2 -2
  15. package/dist/components/VvSelect/vv-select.es.js +189 -171
  16. package/dist/components/VvSelect/vv-select.umd.js +2 -2
  17. package/dist/components/VvTextarea/VvTextarea.d.ts +43 -22
  18. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +140 -85
  19. package/dist/components/VvTextarea/vv-textarea.es.js +364 -288
  20. package/dist/components/VvTextarea/vv-textarea.umd.js +2 -2
  21. package/dist/composables/debouncedInput/useDebouncedInput.d.ts +2 -0
  22. package/dist/composables/icons/useComponentIcons.d.ts +6 -0
  23. package/dist/composables/textLimit/useTextLimit.d.ts +14 -0
  24. package/dist/composables/useModifiers.d.ts +3 -2
  25. package/dist/icons.es.js +3 -3
  26. package/dist/icons.umd.js +1 -1
  27. package/dist/props/index.d.ts +42 -0
  28. package/dist/stories/utils.d.ts +5 -0
  29. package/dist/ui-vue.es.js +417 -401
  30. package/dist/ui-vue.umd.js +2 -2
  31. package/package.json +3 -1
  32. package/src/assets/icons/detailed.json +1 -1
  33. package/src/assets/icons/normal.json +1 -1
  34. package/src/assets/icons/simple.json +1 -1
  35. package/src/components/VvButton/VvButton.vue +1 -2
  36. package/src/components/VvInputText/VvInputText.ts +19 -2
  37. package/src/components/VvInputText/VvInputText.vue +123 -149
  38. package/src/components/VvInputText/VvInputTextActions.ts +151 -0
  39. package/src/components/VvTextarea/VvTextarea.ts +25 -16
  40. package/src/components/VvTextarea/VvTextarea.vue +89 -93
  41. package/src/components/common/HintSlot.ts +31 -13
  42. package/src/composables/debouncedInput/useDebouncedInput.ts +19 -0
  43. package/src/composables/icons/useComponentIcons.ts +35 -0
  44. package/src/composables/textLimit/useTextLimit.ts +44 -0
  45. package/src/composables/useModifiers.ts +47 -1
  46. package/src/props/index.ts +39 -0
  47. package/src/stories/InputText/InputTextMaxLength.stories.mdx +21 -0
  48. package/src/stories/Textarea/Textarea.stories.mdx +33 -51
  49. package/src/stories/Textarea/TextareaAutoclear.stories.mdx +23 -0
  50. package/src/stories/Textarea/TextareaAutocomplete.stories.mdx +10 -2
  51. package/src/stories/Textarea/TextareaAutofocus.stories.mdx +5 -1
  52. package/src/stories/Textarea/TextareaDebounce.stories.mdx +23 -0
  53. package/src/stories/Textarea/TextareaDisabled.stories.mdx +5 -1
  54. package/src/stories/Textarea/TextareaError.stories.mdx +6 -3
  55. package/src/stories/Textarea/TextareaErrorLabel.stories.mdx +37 -0
  56. package/src/stories/Textarea/TextareaFloating.stories.mdx +7 -2
  57. package/src/stories/Textarea/TextareaHintLabel.stories.mdx +5 -1
  58. package/src/stories/Textarea/TextareaIcon.stories.mdx +5 -1
  59. package/src/stories/Textarea/TextareaIconPosition.stories.mdx +9 -1
  60. package/src/stories/Textarea/TextareaId.stories.mdx +19 -0
  61. package/src/stories/Textarea/TextareaLabel.stories.mdx +5 -1
  62. package/src/stories/Textarea/TextareaLimit.stories.mdx +50 -0
  63. package/src/stories/Textarea/TextareaLoading.stories.mdx +6 -3
  64. package/src/stories/Textarea/TextareaLoadingLabel.stories.mdx +23 -0
  65. package/src/stories/Textarea/TextareaMaxLength.stories.mdx +6 -2
  66. package/src/stories/Textarea/TextareaMinLength.stories.mdx +5 -1
  67. package/src/stories/Textarea/TextareaModifiers.stories.mdx +24 -0
  68. package/src/stories/Textarea/TextareaName.stories.mdx +23 -0
  69. package/src/stories/Textarea/TextareaPlaceholder.stories.mdx +5 -1
  70. package/src/stories/Textarea/TextareaReadonly.stories.mdx +5 -1
  71. package/src/stories/Textarea/TextareaRequired.stories.mdx +22 -0
  72. package/src/stories/Textarea/TextareaResizable.stories.mdx +22 -0
  73. package/src/stories/Textarea/TextareaRowsCols.stories.mdx +9 -1
  74. package/src/stories/Textarea/TextareaValid.stories.mdx +7 -4
  75. package/src/stories/Textarea/TextareaValidLabel.stories.mdx +35 -0
  76. package/src/stories/stories.scss +11 -0
  77. package/src/stories/utils.ts +12 -0
  78. package/src/stories/volver-ui-vue.stories.mdx +7 -1
  79. package/dist/components/VvInputText/useInputNumber.d.ts +0 -16
  80. package/dist/components/VvInputText/useInputPassword.d.ts +0 -16
  81. package/src/components/VvInputText/useInputNumber.ts +0 -40
  82. package/src/components/VvInputText/useInputPassword.ts +0 -38
@@ -1,2 +1,2 @@
1
- (function(e,P){typeof exports=="object"&&typeof module<"u"?module.exports=P(require("vue"),require("@iconify/vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],P):(e=typeof globalThis<"u"?globalThis:e||self,e.VvInputText=P(e.vue,e.vue$1,e.core))})(this,function(e,P,D){"use strict";const E={equals(t,n,r){return r?this.resolveFieldData(t,r)===this.resolveFieldData(n,r):this.deepEquals(t,n)},deepEquals(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){const r=Array.isArray(t),s=Array.isArray(n);let o,c,a;if(r&&s){if(c=t.length,c!=n.length)return!1;for(o=c;o--!==0;)if(!this.deepEquals(t[o],n[o]))return!1;return!0}if(r!=s)return!1;const i=t instanceof Date,p=n instanceof Date;if(i!=p)return!1;if(i&&p)return t.getTime()==n.getTime();const m=t instanceof RegExp,l=n instanceof RegExp;if(m!=l)return!1;if(m&&l)return t.toString()==n.toString();const u=Object.keys(t);if(c=u.length,c!==Object.keys(n).length)return!1;for(o=c;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,u[o]))return!1;for(o=c;o--!==0;)if(a=u[o],!this.deepEquals(t[a],n[a]))return!1;return!0}return t!==t&&n!==n},resolveFieldData(t,n){if(t&&Object.keys(t).length&&n){if(n.indexOf(".")===-1)return t[n];{const r=n.split(".");let s=t;for(let o=0,c=r.length;o<c;++o){if(t==null)return null;s=s[r[o]]}return s}}else return null},isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},findIndexInList(t,n){let r=-1;if(n){for(let s=0;s<n.length;s++)if(this.equals(n[s],t)){r=s;break}}return r},contains(t,n){if(t!=null&&n&&n.length){for(const r of n)if(this.equals(t,r))return!0}return!1},isEmpty(t){return t==null||t===""||Array.isArray(t)&&t.length===0||!(t instanceof Date)&&typeof t=="object"&&Object.keys(t).length===0},isNotEmpty(t){return!this.isEmpty(t)},pickBy(t,n){return Object.fromEntries(Object.entries(t).filter(([r])=>n(r)))},removeFromList(t,n){const r=this.findIndexInList(t,n);return r>-1?n.filter((s,o)=>o!==r):n},isString(t){return typeof t=="string"||t instanceof String},propsToObject(t){return Object.keys(t).reduce((n,r)=>{var s,o,c,a,i;return this.isFunction(t[r])?n[r]=t[r]():Array.isArray(t[r])?n[r]=t[r][0]():(s=t[r])!=null&&s.type&&(Array.isArray(t[r].type)?n[r]=((o=t[r])==null?void 0:o.default)||((c=t[r])==null?void 0:c.type[0]()):n[r]=((a=t[r])==null?void 0:a.default)||((i=t[r])==null?void 0:i.type())),n},{})},filterArray(t,n,r){return t.filter(s=>n.some(o=>typeof o=="string"?s[r]==o:this.equals(s[r],o[r])))},kebabCase(t){var n,r;if(t)return(r=(n=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:n.join("-"))==null?void 0:r.toLowerCase()}},j={valid:Boolean,validLabel:[String,Array]},H={error:Boolean,errorLabel:[String,Array]},q={loading:Boolean,loadingLabel:String},U={hintLabel:{type:String,default:""}},N={TEXT:"text",PASSWORD:"password",DATE:"date",DATETIME_LOCAL:"datetime-local",NUMBER:"number",TIME:"time",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",FILE:"file"},b={LEFT:"left",RIGHT:"right"},S={TYPES:N,ICON_POSITIONS:b,TYPES_ICON:{PASSWORD_ON:"eye-on",PASSWORD_OFF:"eye-off",DATE:"calendar",TIME:"time",COLOR:"color",SEARCH:"search"}},W=["update:modelValue","focus","blur"],L={...j,...H,...U,...q,modelValue:null,type:{type:String,default:N.TEXT,validator:t=>Object.values(N).includes(t)},id:String,name:{type:String,required:!0},autocomplete:{type:String,default:"off"},autofocus:Boolean,minlength:Number,maxlength:Number,min:[Number,Date],max:[Number,Date],step:Number,label:String,disabled:Boolean,readonly:Boolean,placeholder:String,icon:{type:String,default:""},iconPosition:{type:String,validation:t=>Object.values(b).includes(t),default:b.RIGHT},floating:Boolean,debounce:Number},z={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};function B(t,n){const r={[`${t}`]:!0};return{bemCssClasses:e.computed(()=>Object.keys(n).reduce((o,c)=>{const a=e.unref(n[c])||!1;if(!a)return o;if(c==="modifiers"){const i=Array.isArray(a)?a:[a];return{...o,...i.reduce((p,m)=>({...p,[`${t}--${E.kebabCase(m)}`]:!0}),{})}}else return{...o,[`${t}--${E.kebabCase(c)}`]:a}},r)||{})}}const w=e.defineComponent({__name:"VvIcon",props:z,setup(t){const n=t,r=e.ref(!0),{modifiers:s}=e.toRefs(n),o=e.inject("ds"),{bemCssClasses:c}=B("vv-icon",{modifiers:s}),a=e.computed(()=>n.provider||(o==null?void 0:o.provider)),i=e.computed(()=>{const l=n.name||"",u=`@${a.value}:${n.prefix}:${n.name}`;return P.iconExists(l)?l:P.iconExists(u)?u:(o==null?void 0:o.iconsCollections.find(d=>{const y=`@${a.value}:${d.prefix}:${l}`;if(P.iconExists(y))return y}))||l});function p(l){let u=null;if(typeof window>"u"){const{JSDOM:T}=require("jsdom");u=new T().window}return(u?new u.DOMParser:new window.DOMParser).parseFromString(l,"text/html").querySelector("svg")}function m(l){const u=p(l),d=(u==null?void 0:u.innerHTML.trim())||"";u&&d&&P.addIcon(`@${a.value}:${n.prefix}:${n.name}`,{body:d,height:u.viewBox.baseVal.height,width:u.viewBox.baseVal.width})}return o&&(n.src?(r.value=!1,o.fetchIcon(n.src).then(l=>{l&&(m(l),r.value=!0)}).catch(l=>{throw new Error(`During fetch icon: ${l==null?void 0:l.message}`)})):n.svg&&m(n.svg)),(l,u)=>r.value?(e.openBlock(),e.createBlock(e.unref(P.Icon),e.mergeProps({key:0,class:e.unref(c)},{...l.$props,provider:e.unref(a),icon:e.unref(i)}),null,16,["class"])):e.createCommentVNode("",!0)}});function Z(t){return Array.isArray(t)?t.filter(n=>E.isString(n)).reduce((n,r)=>n.length>0?n+`
2
- `+r:r,""):t}function G(t,n){return{name:"HintSlot",setup(){const r=e.toRefs(t),{error:s,valid:o,hint:c,loading:a}=n,{hintLabel:i,modelValue:p,valid:m,validLabel:l,error:u,errorLabel:d}=r,y=E.resolveFieldData(r,"loading"),_=E.resolveFieldData(r,"loadingLabel"),T=e.computed(()=>u.value?!!(u.value&&s||(d==null?void 0:d.value)&&Array.isArray(d.value)&&d.value.length>0||(d==null?void 0:d.value)&&E.isNotEmpty(d.value)):!1),A=e.computed(()=>!!(i&&i.value||c||o||l&&l.value||T.value||(y==null?void 0:y.value)&&a||(y==null?void 0:y.value)&&(_==null?void 0:_.value))),C=e.computed(()=>Array.isArray(d==null?void 0:d.value)?Z((d==null?void 0:d.value)||""):d==null?void 0:d.value),O=e.computed(()=>{const I={modelValue:p,error:u,valid:m};return u!=null&&u.value?(s==null?void 0:s(I))||(C==null?void 0:C.value)||(i==null?void 0:i.value):m!=null&&m.value?(o==null?void 0:o(I))||(l==null?void 0:l.value)||(i==null?void 0:i.value):y!=null&&y.value?(a==null?void 0:a(I))||(_==null?void 0:_.value)||(i==null?void 0:i.value):(c==null?void 0:c(I))||(i==null?void 0:i.value)||(i==null?void 0:i.value)});return{hasHint:A,hintContent:O}},render(){if(this.hasHint)return e.h("span",null,this.hintContent)}}}function X(t){const{type:n,disabled:r,readonly:s}=t,o=e.ref(!0),c=e.computed(()=>n.value===S.TYPES.PASSWORD),a=e.computed(()=>!o.value),i=e.computed(()=>a.value?S.TYPES_ICON.PASSWORD_OFF:S.TYPES_ICON.PASSWORD_ON);function p(){!r.value&&!s.value&&(o.value=!o.value)}return{isPassword:c,isPasswordVisible:a,passwordButtonIcon:i,toggleShowHidePassword:p}}function J(t,n){const{type:r,disabled:s,readonly:o,inputTemplateRef:c}=n,a=e.computed(()=>r.value===S.TYPES.NUMBER);function i(){!s.value&&!o.value&&(c.value.stepUp(),t.value=e.unref(c.value).value)}function p(){!s.value&&!o.value&&(c.value.stepDown(),t.value=e.unref(c.value).value)}return{isNumber:a,stepUp:i,stepDown:p}}function K(t,n){const{icon:r,iconPosition:s}=t,o=e.computed(()=>!!(r.value&&s.value==="left"||n.iconLeft)),c=e.computed(()=>!!(r.value&&s.value==="right"||n.iconRight)),a=e.computed(()=>!!(r.value&&s.value==="top"||n.iconTop)),i=e.computed(()=>!!(r.value&&s.value==="bottom"||n.iconBottom));return{icon:r,iconPosition:s,hasIconLeft:o,hasIconRight:c,hasIconTop:a,hasIconBottom:i}}function Q(t,n){const{focused:r}=D.useFocus(t);return e.watch(r,s=>{n(s?"focus":"blur",t.value)}),{focused:r}}const ee=["for"],te={class:"vv-input-text__wrapper"},ne={key:0,class:"vv-input-text__actions-group"},re=["disabled"],oe={key:1,class:"vv-input-text__actions-group"},se=["disabled"],ie=["disabled"],ce={inheritAttrs:!1};return e.defineComponent({...ce,__name:"VvInputText",props:L,emits:W,setup(t,{emit:n}){const r=t,s=e.useSlots(),o=e.useAttrs(),c=e.ref(),a=e.ref(r.modelValue),{disabled:i,readonly:p,type:m,icon:l,iconPosition:u,valid:d,error:y,loading:_,floating:T,label:A,modelValue:C}=e.toRefs(r),O=e.computed(()=>i.value||p.value),I=D.refDebounced(a,r.debounce||0);e.watch(I,g=>n("update:modelValue",g));const ae={icon:l,iconPosition:u},le={iconLeft:s["icon-left"],iconRight:s["icon-right"]},{hasIconLeft:v,hasIconRight:ue}=K(ae,le),x=e.computed(()=>{if(ue.value)return r.icon;switch(r.type){case S.TYPES.PASSWORD:return pe.value;case S.TYPES.COLOR:return S.TYPES_ICON.COLOR;case S.TYPES.DATE:case S.TYPES.DATETIME_LOCAL:return S.TYPES_ICON.DATE;case S.TYPES.TIME:return S.TYPES_ICON.TIME;case S.TYPES.SEARCH:return S.TYPES_ICON.SEARCH;default:return""}}),de={type:m,disabled:i,readonly:p},{isPassword:k,isPasswordVisible:fe,passwordButtonIcon:pe,toggleShowHidePassword:R}=X(de),me={disabled:i,readonly:p,type:m,inputTemplateRef:c},{isNumber:ye,stepUp:ge,stepDown:he}=J(a,me),{focused:V}=Q(c,n),{bemCssClasses:Se}=B("vv-input-text",{readonly:p,valid:d,invalid:y,loading:_,iconLeft:v,iconRight:e.computed(()=>E.isNotEmpty(x.value)),floating:e.computed(()=>T.value&&E.isNotEmpty(A==null?void 0:A.value)),dirty:e.computed(()=>E.isNotEmpty(C))}),Ee=e.computed(()=>{const{class:g}=o;return{class:g,...Se.value}}),Pe=e.computed(()=>{const{style:g}=o,f=E.pickBy(o,h=>h.startsWith("data-"));return{style:g,...f}}),F=e.computed(()=>{const{id:g,name:f,type:h,autocomplete:Ae,minlength:Ie,maxlength:Te,min:Ce,max:Oe,step:Ne,disabled:be,readonly:we,floating:xe,placeholder:Y}=r,De=g||f,Be=k.value&&fe.value?"text":h,ve=xe&&E.isEmpty(Y)?" ":Y;return{id:De,type:Be,placeholder:ve,name:f,autocomplete:Ae,disabled:be,readonly:we,minlength:Ie,maxlength:Te,min:Ce,max:Oe,step:Ne,...$.value}}),$=e.computed(()=>{const{name:g}=o,f=E.pickBy(o,h=>h.startsWith("aria-"));return{"aria-label":g,"aria-describedby":`${g}-hint`,"aria-invalid":r.error,...f}}),M=e.computed(()=>{const{modelValue:g,valid:f,error:h}=r;return{valid:f,error:h,modelValue:g}}),_e=G(r,s);return e.onMounted(()=>{r.autofocus&&(V.value=!0),console.log("Focused",V.value)}),(g,f)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps(e.unref(Pe),{class:e.unref(Ee)}),[e.unref(A)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(F).id},e.toDisplayString(e.unref(A)),9,ee)):e.createCommentVNode("",!0),e.createElementVNode("div",te,[e.unref(v)?e.renderSlot(g.$slots,"icon-left",e.normalizeProps(e.mergeProps({key:0},e.unref(M))),()=>[e.createVNode(w,{class:"vv-input-text__icon-left",name:e.unref(l)},null,8,["name"])]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref_key:"input",ref:c},e.unref(F),{"onUpdate:modelValue":f[0]||(f[0]=h=>a.value=h),onInput:f[1]||(f[1]=h=>n("input",h))}),null,16),[[e.vModelDynamic,a.value]]),e.renderSlot(g.$slots,"icon-right",e.normalizeProps(e.guardReactiveProps(e.unref(M))),()=>[e.unref(k)?(e.openBlock(),e.createElementBlock("div",ne,[e.createElementVNode("button",{class:"vv-input-text__action",disabled:e.unref(O),onClick:f[2]||(f[2]=e.withModifiers((...h)=>e.unref(R)&&e.unref(R)(...h),["prevent"]))},[e.createVNode(w,{name:e.unref(x)},null,8,["name"])],8,re)])):e.unref(ye)?(e.openBlock(),e.createElementBlock("div",oe,[e.createElementVNode("button",{type:"button",class:"vv-input-text__action-chevron vv-input-text__action-chevron-up",disabled:e.unref(O),onClick:f[3]||(f[3]=e.withModifiers(h=>e.unref(ge)(),["prevent"]))},null,8,se),e.createElementVNode("button",{type:"button",class:"vv-input-text__action-chevron",disabled:e.unref(O),onClick:f[4]||(f[4]=e.withModifiers(h=>e.unref(he)(),["prevent"]))},null,8,ie)])):(e.openBlock(),e.createBlock(w,{key:2,name:e.unref(x)},null,8,["name"]))])]),e.createVNode(e.unref(_e),{id:e.unref($)["aria-describedby"],class:"vv-input-text__hint"},null,8,["id"])],16))}})});
1
+ (function(e,P){typeof exports=="object"&&typeof module<"u"?module.exports=P(require("vue"),require("@iconify/vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],P):(e=typeof globalThis<"u"?globalThis:e||self,e.VvInputText=P(e.vue,e.vue$1,e.core))})(this,function(e,P,O){"use strict";const S={equals(n,r,t){return t?this.resolveFieldData(n,t)===this.resolveFieldData(r,t):this.deepEquals(n,r)},deepEquals(n,r){if(n===r)return!0;if(n&&r&&typeof n=="object"&&typeof r=="object"){const t=Array.isArray(n),s=Array.isArray(r);let o,i,a;if(t&&s){if(i=n.length,i!=r.length)return!1;for(o=i;o--!==0;)if(!this.deepEquals(n[o],r[o]))return!1;return!0}if(t!=s)return!1;const f=n instanceof Date,c=r instanceof Date;if(f!=c)return!1;if(f&&c)return n.getTime()==r.getTime();const A=n instanceof RegExp,l=r instanceof RegExp;if(A!=l)return!1;if(A&&l)return n.toString()==r.toString();const u=Object.keys(n);if(i=u.length,i!==Object.keys(r).length)return!1;for(o=i;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,u[o]))return!1;for(o=i;o--!==0;)if(a=u[o],!this.deepEquals(n[a],r[a]))return!1;return!0}return n!==n&&r!==r},resolveFieldData(n,r){if(n&&Object.keys(n).length&&r){if(r.indexOf(".")===-1)return n[r];{const t=r.split(".");let s=n;for(let o=0,i=t.length;o<i;++o){if(n==null)return null;s=s[t[o]]}return s}}else return null},isFunction(n){return!!(n&&n.constructor&&n.call&&n.apply)},findIndexInList(n,r){let t=-1;if(r){for(let s=0;s<r.length;s++)if(this.equals(r[s],n)){t=s;break}}return t},contains(n,r){if(n!=null&&r&&r.length){for(const t of r)if(this.equals(n,t))return!0}return!1},isEmpty(n){return n==null||n===""||Array.isArray(n)&&n.length===0||!(n instanceof Date)&&typeof n=="object"&&Object.keys(n).length===0},isNotEmpty(n){return!this.isEmpty(n)},pickBy(n,r){return Object.fromEntries(Object.entries(n).filter(([t])=>r(t)))},removeFromList(n,r){const t=this.findIndexInList(n,r);return t>-1?r.filter((s,o)=>o!==t):r},isString(n){return typeof n=="string"||n instanceof String},propsToObject(n){return Object.keys(n).reduce((r,t)=>{var s,o,i,a,f;return this.isFunction(n[t])?r[t]=n[t]():Array.isArray(n[t])?r[t]=n[t][0]():(s=n[t])!=null&&s.type&&(Array.isArray(n[t].type)?r[t]=((o=n[t])==null?void 0:o.default)||((i=n[t])==null?void 0:i.type[0]()):r[t]=((a=n[t])==null?void 0:a.default)||((f=n[t])==null?void 0:f.type())),r},{})},filterArray(n,r,t){return n.filter(s=>r.some(o=>typeof o=="string"?s[t]==o:this.equals(s[t],o[t])))},kebabCase(n){var r,t;if(n)return(t=(r=n.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:r.join("-"))==null?void 0:t.toLowerCase()}},Y={valid:Boolean,validLabel:[String,Array]},q={error:Boolean,errorLabel:[String,Array]},H={loading:Boolean,loadingLabel:String},U={modifiers:[String,Array]},W={hintLabel:{type:String,default:""}},z={limit:{type:[Boolean,String],default:!1,validator:n=>[!0,!1,"countdown"].includes(n)}},_={TEXT:"text",PASSWORD:"password",DATE:"date",DATETIME_LOCAL:"datetime-local",NUMBER:"number",TIME:"time",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",FILE:"file"},k={LEFT:"left",RIGHT:"right"},w={PASSWORD_ON:"eye-on",PASSWORD_OFF:"eye-off",DATE:"calendar",TIME:"time",COLOR:"color",SEARCH:"search"},m={TYPES:_,ICON_POSITIONS:k,TYPES_ICON:w},Z=["update:modelValue","focus","blur"],G={...Y,...q,...W,...H,...U,...z,modelValue:null,type:{type:String,default:_.TEXT,validator:n=>Object.values(_).includes(n)},id:String,name:{type:String,required:!0},autocomplete:{type:String,default:"off"},autofocus:Boolean,minlength:Number,maxlength:Number,min:[Number,Date],max:[Number,Date],step:Number,label:String,disabled:Boolean,readonly:Boolean,placeholder:String,icon:{type:String,default:""},iconPosition:{type:String,validation:n=>Object.values(k).includes(n),default:k.RIGHT},floating:Boolean,debounce:Number,autoclear:Boolean},X={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};function J(n,r){const t={[`${n}`]:!0};return{bemCssClasses:e.computed(()=>Object.keys(r).reduce((o,i)=>{const a=e.unref(r[i])||!1;if(!a)return o;if(i==="modifiers"){const f=Array.isArray(a)?a:[a];return{...o,...f.reduce((c,A)=>({...c,[`${n}--${S.kebabCase(A)}`]:!0}),{})}}else return{...o,[`${n}--${S.kebabCase(i)}`]:a}},t)||{})}}function K(n,r){const t={[`${n}`]:!0};return Object.keys(r).reduce((s,o)=>{const i=e.unref(r[o])||!1;if(!i)return s;if(o==="modifiers"){const a=Array.isArray(i)?i:[i];return{...s,...a.reduce((f,c)=>({...f,[`${n}--${S.kebabCase(c)}`]:!0}),{})}}else return{...s,[`${n}--${S.kebabCase(o)}`]:i}},t)||{}}const T=e.defineComponent({__name:"VvIcon",props:X,setup(n){const r=n,t=e.ref(!0),{modifiers:s}=e.toRefs(r),o=e.inject("ds"),{bemCssClasses:i}=J("vv-icon",{modifiers:s}),a=e.computed(()=>r.provider||(o==null?void 0:o.provider)),f=e.computed(()=>{const l=r.name||"",u=`@${a.value}:${r.prefix}:${r.name}`;return P.iconExists(l)?l:P.iconExists(u)?u:(o==null?void 0:o.iconsCollections.find(h=>{const d=`@${a.value}:${h.prefix}:${l}`;if(P.iconExists(d))return d}))||l});function c(l){let u=null;if(typeof window>"u"){const{JSDOM:b}=require("jsdom");u=new b().window}return(u?new u.DOMParser:new window.DOMParser).parseFromString(l,"text/html").querySelector("svg")}function A(l){const u=c(l),h=(u==null?void 0:u.innerHTML.trim())||"";u&&h&&P.addIcon(`@${a.value}:${r.prefix}:${r.name}`,{body:h,height:u.viewBox.baseVal.height,width:u.viewBox.baseVal.width})}return o&&(r.src?(t.value=!1,o.fetchIcon(r.src).then(l=>{l&&(A(l),t.value=!0)}).catch(l=>{throw new Error(`During fetch icon: ${l==null?void 0:l.message}`)})):r.svg&&A(r.svg)),(l,u)=>t.value?(e.openBlock(),e.createBlock(e.unref(P.Icon),e.mergeProps({key:0,class:e.unref(i)},{...l.$props,provider:e.unref(a),icon:e.unref(f)}),null,16,["class"])):e.createCommentVNode("",!0)}});function D(n){return Array.isArray(n)?n.filter(r=>S.isString(r)).reduce((r,t)=>r.length>0?r+`
2
+ `+t:t,""):n}function Q(n,r){return{name:"HintSlot",props:{params:{type:Object,default:()=>{}}},setup(t){const s=e.toRefs(n),{error:o,valid:i,hint:a,loading:f}=r,{hintLabel:c,modelValue:A,valid:l,validLabel:u,error:h,errorLabel:d}=s,y=S.resolveFieldData(s,"loading"),b=S.resolveFieldData(s,"loadingLabel"),I=e.computed(()=>h.value?!!(h.value&&o||(d==null?void 0:d.value)&&Array.isArray(d.value)&&d.value.length>0||(d==null?void 0:d.value)&&S.isNotEmpty(d.value)):!1),x=e.computed(()=>!!(c&&c.value||a||i||u&&u.value||I.value||(y==null?void 0:y.value)&&f||(y==null?void 0:y.value)&&(b==null?void 0:b.value))),B=e.computed(()=>{const C=O.toReactive({hintLabel:c,modelValue:A,valid:l,validLabel:u,error:h,errorLabel:d,loading:y,loadingLabel:b,...t.params});return h!=null&&h.value?(o==null?void 0:o(C))||D(d==null?void 0:d.value)||(c==null?void 0:c.value):l!=null&&l.value?(i==null?void 0:i(C))||D(u==null?void 0:u.value)||(c==null?void 0:c.value):y!=null&&y.value?(f==null?void 0:f(C))||D(b==null?void 0:b.value)||(c==null?void 0:c.value):(a==null?void 0:a(C))||D(c==null?void 0:c.value)||(c==null?void 0:c.value)});return{hasHint:x,hintContent:B}},render(){if(this.hasHint)return e.h("pre",{style:{"white-space":"pre"}},this.hintContent)}}}const $=e.defineComponent({components:{VvIcon:T},props:{disabled:Boolean},setup(n,{emit:r}){const t=e.ref(!1),s=e.computed(()=>t.value?w.PASSWORD_OFF:w.PASSWORD_ON);function o(){n.disabled||(t.value=!t.value,r(t.value?"action-password-on":"action-password-off"))}return{activeIcon:s,onClick:o}},render(){const n=e.h(T,{name:this.activeIcon});return e.h("button",{disabled:this.disabled,class:["vv-input-text__action"],onClick:this.onClick},n)}}),N=e.defineComponent({components:{VvIcon:T},props:{disabled:Boolean,mode:{type:String,validator:n=>["up","down"].includes(n),default:"up"}},setup(n,{emit:r}){function t(){n.disabled||r(n.mode==="up"?"action-step-up":"action-step-down")}return{onClick:t}},render(){return e.h("button",{class:["vv-input-text__action-chevron",this.mode==="up"&&"vv-input-text__action-chevron-up"],disabled:this.disabled,onClick:this.onClick})}});function L(n,r){return{name:"VvInputTextActions",components:{VvIcon:T,VvInputPasswordAction:$,VvInputStepAction:N},setup(){return{isDisabled:e.computed(()=>r.disabled||r.readonly)}},render(){let t=null;switch(n){case _.PASSWORD:{const{onActionPasswordOn:s,onActionPasswordOff:o}=this.$attrs;t=[e.h($,{disabled:this.isDisabled,onActionPasswordOn:s,onActionPasswordOff:o})];break}case _.NUMBER:{const{onActionStepUp:s,onActionStepDown:o}=this.$attrs;t=[e.h(N,{mode:"up",disabled:this.isDisabled,onActionStepUp:s,onActionStepDown:o}),e.h(N,{mode:"down",disabled:this.isDisabled,onActionStepUp:s,onActionStepDown:o})];break}default:{t=null;break}}return Array.isArray(t)?e.h("div",{class:"vv-input-text__actions-group"},t):t}}}function ee(n,r,t){const s=e.computed(()=>!!(n.value&&r.value==="left"||t.iconLeft)),o=e.computed(()=>!!(n.value&&r.value==="right"||t.iconRight)),i=e.computed(()=>!!(n.value&&r.value==="top"||t.iconTop)),a=e.computed(()=>!!(n.value&&r.value==="bottom"||t.iconBottom));return{hasIconLeft:s,hasIconRight:o,hasIconTop:i,hasIconBottom:a}}function te(n,r){const{focused:t}=O.useFocus(n);return e.watch(t,s=>{r(s?"focus":"blur",n.value)}),{focused:t}}function ne(n,r,t){const s=e.ref(n==null?void 0:n.value),o=O.refDebounced(s,r||0);return e.watch(o,i=>t("update:modelValue",i)),s}function re(n,r){const t=e.computed(()=>{const i=e.unref(n);return O.isString(i)?i.length:0}),s=e.computed(()=>{const i=e.unref(n)||"";return!O.isString(i)||r.mode===!1?0:r.mode===!0?i.length:e.unref(r.upperLimit)-i.length}),o=e.computed(()=>r.mode===!1?"":r.mode===!0&&r.upperLimit&&r.upperLimit>0?`${s.value}/${e.unref(r.upperLimit)}`:s.value);return{textLength:t,textLimitLength:s,formattedTextLimitLength:o}}const oe=["for"],se={class:"vv-input-text__wrapper"},ie={key:2,class:"vv-input-text__limit"},ae={inheritAttrs:!1};return e.defineComponent({...ae,__name:"VvInputText",props:G,emits:Z,setup(n,{emit:r}){const t=n,s=e.useSlots(),o=e.useAttrs(),i=e.ref(),{icon:a,iconPosition:f,label:c,modelValue:A,autoclear:l,limit:u}=e.toRefs(t),h=t.id||t.name,d=`${t.name}-label`,y=`${t.name}-hint`,b=e.computed(()=>t.floating&&S.isEmpty(t.placeholder)?" ":t.placeholder),I=ne(A,t.debounce,r),x=e.ref(!1),B=e.computed(()=>t.type===m.TYPES.PASSWORD),C=e.computed(()=>t.type===m.TYPES.NUMBER);function ce(){const g=t.max;!j.value&&I.value+1<=g&&(i.value.stepUp(),I.value=e.unref(i.value).value)}function le(){const g=t.min;!j.value&&I.value-1<=g&&(i.value.stepDown(),I.value=e.unref(i.value).value)}const{hasIconLeft:V,hasIconRight:F}=ee(a,f,{iconLeft:s["icon-left"],iconRight:s["icon-right"]}),R=e.computed(()=>{switch(t.type){case m.TYPES.PASSWORD:return m.TYPES_ICON.PASSWORD_OFF;case m.TYPES.COLOR:return m.TYPES_ICON.COLOR;case m.TYPES.DATE:case m.TYPES.DATETIME_LOCAL:return m.TYPES_ICON.DATE;case m.TYPES.TIME:return m.TYPES_ICON.TIME;case m.TYPES.SEARCH:return m.TYPES_ICON.SEARCH;default:return""}}),{textLength:ue,formattedTextLimitLength:de}=re(I,{mode:t.limit,upperLimit:t.maxlength||0}),{focused:M}=te(i,r),j=e.computed(()=>t.disabled||t.readonly),fe=e.computed(()=>{const g=F.value||S.isNotEmpty(R.value),p=t.floating&&S.isNotEmpty(t.label),E=S.isNotEmpty(A==null?void 0:A.value);return[K("vv-input-text",{modifiers:t.modifiers,readonly:t.readonly,valid:t.valid,invalid:t.error,loading:t.loading,iconLeft:V,iconRight:g,floating:p,dirty:E}),o.class]}),pe=e.computed(()=>{const{style:g}=o,p=S.pickBy(o,E=>E.startsWith("data-"));return{style:g,...p}}),me=e.computed(()=>{const g=B.value&&x.value?"text":t.type,p=S.pickBy(o,E=>E.startsWith("aria-"));return{id:h,type:g,placeholder:b.value,name:t.name,autocomplete:t.autocomplete,disabled:t.disabled,readonly:t.readonly,minlength:t.minlength,maxlength:t.maxlength,min:t.min,max:t.max,step:t.step,"aria-invalid":t.error,"aria-valid":!t.valid,"aria-labeledby":d,"aria-describedby":y,"aria-errormessage":y,...p}}),v=e.computed(()=>{const{modelValue:g,valid:p,error:E}=t;return{valid:p,error:E,modelValue:g}}),he=Q(t,s),ye=L(m.TYPES.PASSWORD,t),ge=L(m.TYPES.NUMBER,t);function Se(){I.value=null}return e.onMounted(()=>{t.autofocus&&(M.value=!0),console.log("Focused",M.value)}),(g,p)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps(e.unref(pe),{class:e.unref(fe)}),[e.unref(c)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(h)},e.toDisplayString(e.unref(c)),9,oe)):e.createCommentVNode("",!0),e.createElementVNode("div",se,[e.unref(V)?e.renderSlot(g.$slots,"icon-left",e.normalizeProps(e.mergeProps({key:0},e.unref(v))),()=>[e.createVNode(T,{class:"vv-input-text__icon-left",name:e.unref(a)},null,8,["name"])]):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref_key:"input",ref:i},e.unref(me),{"onUpdate:modelValue":p[0]||(p[0]=E=>e.isRef(I)?I.value=E:null),onInput:p[1]||(p[1]=E=>r("input",E))}),null,16),[[e.vModelDynamic,e.unref(I)]]),e.unref(l)&&e.unref(ue)>0?(e.openBlock(),e.createElementBlock("button",{key:1,class:"vv-button vv-button--ghost",onClick:Se},[e.createVNode(T,{name:"clear-field"})])):e.createCommentVNode("",!0),e.renderSlot(g.$slots,"icon-right",e.normalizeProps(e.guardReactiveProps(e.unref(v))),()=>[e.unref(B)?(e.openBlock(),e.createBlock(e.unref(ye),{key:0,onActionPasswordOn:p[2]||(p[2]=E=>x.value=!0),onActionPasswordOff:p[3]||(p[3]=E=>x.value=!1)})):e.unref(C)?(e.openBlock(),e.createBlock(e.unref(ge),{key:1,onActionStepUp:ce,onActionStepDown:le})):e.unref(F)||e.unref(R)?(e.openBlock(),e.createBlock(T,{key:2,name:e.unref(a)||e.unref(R)},null,8,["name"])):e.createCommentVNode("",!0)]),e.unref(u)?(e.openBlock(),e.createElementBlock("span",ie,[e.renderSlot(g.$slots,"limit",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(de)),1)])])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(he),{id:y,class:"vv-input-text__hint"})],16))}})});
@@ -1,7 +1,8 @@
1
- import { computed as S, unref as d, defineComponent as I, ref as R, toRefs as F, inject as x, openBlock as h, createBlock as D, mergeProps as K, createCommentVNode as w, h as M, useSlots as T, createElementBlock as b, normalizeClass as z, toDisplayString as P, createElementVNode as q, renderSlot as V, Fragment as Z, renderList as J, createVNode as U } from "vue";
2
- import { v4 as G } from "uuid";
3
- import { iconExists as _, Icon as Q, addIcon as W } from "@iconify/vue";
4
- const A = {
1
+ import { computed as A, unref as p, defineComponent as R, ref as M, toRefs as q, inject as x, openBlock as S, createBlock as F, mergeProps as K, createCommentVNode as w, h as T, useSlots as z, createElementBlock as O, normalizeClass as Z, toDisplayString as _, createElementVNode as V, renderSlot as N, Fragment as J, renderList as U, createVNode as G } from "vue";
2
+ import { v4 as Q } from "uuid";
3
+ import { iconExists as D, Icon as W, addIcon as X } from "@iconify/vue";
4
+ import { toReactive as Y } from "@vueuse/core";
5
+ const b = {
5
6
  equals(e, t, r) {
6
7
  return r ? this.resolveFieldData(e, r) === this.resolveFieldData(t, r) : this.deepEquals(e, t);
7
8
  },
@@ -9,36 +10,36 @@ const A = {
9
10
  if (e === t)
10
11
  return !0;
11
12
  if (e && t && typeof e == "object" && typeof t == "object") {
12
- const r = Array.isArray(e), o = Array.isArray(t);
13
- let n, c, u;
14
- if (r && o) {
15
- if (c = e.length, c != t.length)
13
+ const r = Array.isArray(e), i = Array.isArray(t);
14
+ let n, u, a;
15
+ if (r && i) {
16
+ if (u = e.length, u != t.length)
16
17
  return !1;
17
- for (n = c; n-- !== 0; )
18
+ for (n = u; n-- !== 0; )
18
19
  if (!this.deepEquals(e[n], t[n]))
19
20
  return !1;
20
21
  return !0;
21
22
  }
22
- if (r != o)
23
+ if (r != i)
23
24
  return !1;
24
- const s = e instanceof Date, m = t instanceof Date;
25
- if (s != m)
25
+ const d = e instanceof Date, o = t instanceof Date;
26
+ if (d != o)
26
27
  return !1;
27
- if (s && m)
28
+ if (d && o)
28
29
  return e.getTime() == t.getTime();
29
- const y = e instanceof RegExp, i = t instanceof RegExp;
30
- if (y != i)
30
+ const m = e instanceof RegExp, s = t instanceof RegExp;
31
+ if (m != s)
31
32
  return !1;
32
- if (y && i)
33
+ if (m && s)
33
34
  return e.toString() == t.toString();
34
35
  const l = Object.keys(e);
35
- if (c = l.length, c !== Object.keys(t).length)
36
+ if (u = l.length, u !== Object.keys(t).length)
36
37
  return !1;
37
- for (n = c; n-- !== 0; )
38
+ for (n = u; n-- !== 0; )
38
39
  if (!Object.prototype.hasOwnProperty.call(t, l[n]))
39
40
  return !1;
40
- for (n = c; n-- !== 0; )
41
- if (u = l[n], !this.deepEquals(e[u], t[u]))
41
+ for (n = u; n-- !== 0; )
42
+ if (a = l[n], !this.deepEquals(e[a], t[a]))
42
43
  return !1;
43
44
  return !0;
44
45
  }
@@ -50,13 +51,13 @@ const A = {
50
51
  return e[t];
51
52
  {
52
53
  const r = t.split(".");
53
- let o = e;
54
- for (let n = 0, c = r.length; n < c; ++n) {
54
+ let i = e;
55
+ for (let n = 0, u = r.length; n < u; ++n) {
55
56
  if (e == null)
56
57
  return null;
57
- o = o[r[n]];
58
+ i = i[r[n]];
58
59
  }
59
- return o;
60
+ return i;
60
61
  }
61
62
  } else
62
63
  return null;
@@ -67,9 +68,9 @@ const A = {
67
68
  findIndexInList(e, t) {
68
69
  let r = -1;
69
70
  if (t) {
70
- for (let o = 0; o < t.length; o++)
71
- if (this.equals(t[o], e)) {
72
- r = o;
71
+ for (let i = 0; i < t.length; i++)
72
+ if (this.equals(t[i], e)) {
73
+ r = i;
73
74
  break;
74
75
  }
75
76
  }
@@ -96,20 +97,20 @@ const A = {
96
97
  },
97
98
  removeFromList(e, t) {
98
99
  const r = this.findIndexInList(e, t);
99
- return r > -1 ? t.filter((o, n) => n !== r) : t;
100
+ return r > -1 ? t.filter((i, n) => n !== r) : t;
100
101
  },
101
102
  isString(e) {
102
103
  return typeof e == "string" || e instanceof String;
103
104
  },
104
105
  propsToObject(e) {
105
106
  return Object.keys(e).reduce((t, r) => {
106
- var o, n, c, u, s;
107
- return this.isFunction(e[r]) ? t[r] = e[r]() : Array.isArray(e[r]) ? t[r] = e[r][0]() : (o = e[r]) != null && o.type && (Array.isArray(e[r].type) ? t[r] = ((n = e[r]) == null ? void 0 : n.default) || ((c = e[r]) == null ? void 0 : c.type[0]()) : t[r] = ((u = e[r]) == null ? void 0 : u.default) || ((s = e[r]) == null ? void 0 : s.type())), t;
107
+ var i, n, u, a, d;
108
+ return this.isFunction(e[r]) ? t[r] = e[r]() : Array.isArray(e[r]) ? t[r] = e[r][0]() : (i = e[r]) != null && i.type && (Array.isArray(e[r].type) ? t[r] = ((n = e[r]) == null ? void 0 : n.default) || ((u = e[r]) == null ? void 0 : u.type[0]()) : t[r] = ((a = e[r]) == null ? void 0 : a.default) || ((d = e[r]) == null ? void 0 : d.type())), t;
108
109
  }, {});
109
110
  },
110
111
  filterArray(e, t, r) {
111
- return e.filter((o) => t.some((n) => typeof n == "string" ? o[r] == n : this.equals(
112
- o[r],
112
+ return e.filter((i) => t.some((n) => typeof n == "string" ? i[r] == n : this.equals(
113
+ i[r],
113
114
  n[r]
114
115
  )));
115
116
  },
@@ -120,31 +121,31 @@ const A = {
120
121
  /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g
121
122
  )) == null ? void 0 : t.join("-")) == null ? void 0 : r.toLowerCase();
122
123
  }
123
- }, X = {
124
+ }, L = {
124
125
  valid: Boolean,
125
126
  validLabel: [String, Array]
126
- }, Y = {
127
+ }, ee = {
127
128
  error: Boolean,
128
129
  errorLabel: [String, Array]
129
- }, L = {
130
+ }, te = {
130
131
  loading: Boolean,
131
132
  loadingLabel: String
132
- }, ee = {
133
+ }, re = {
133
134
  disabled: Boolean
134
- }, te = {
135
+ }, ne = {
135
136
  readonly: Boolean
136
- }, re = {
137
+ }, se = {
137
138
  modifiers: [String, Array]
138
- }, ne = {
139
+ }, ie = {
139
140
  hintLabel: { type: String, default: "" }
140
- }, se = {
141
- ...X,
142
- ...Y,
143
- ...ne,
141
+ }, oe = {
144
142
  ...L,
145
143
  ...ee,
144
+ ...ie,
146
145
  ...te,
147
146
  ...re,
147
+ ...ne,
148
+ ...se,
148
149
  modelValue: {
149
150
  type: [String, Object],
150
151
  required: !0
@@ -161,7 +162,7 @@ const A = {
161
162
  iconLeft: String,
162
163
  iconRight: String,
163
164
  modifiers: [String, Array]
164
- }, ie = {
165
+ }, le = {
165
166
  color: String,
166
167
  width: {
167
168
  type: [String, Number]
@@ -196,19 +197,19 @@ const A = {
196
197
  function H(e, t) {
197
198
  const r = { [`${e}`]: !0 };
198
199
  return {
199
- bemCssClasses: S(() => Object.keys(t).reduce((n, c) => {
200
- const u = d(t[c]) || !1;
201
- if (!u)
200
+ bemCssClasses: A(() => Object.keys(t).reduce((n, u) => {
201
+ const a = p(t[u]) || !1;
202
+ if (!a)
202
203
  return n;
203
- if (c === "modifiers") {
204
- const s = Array.isArray(u) ? u : [u];
204
+ if (u === "modifiers") {
205
+ const d = Array.isArray(a) ? a : [a];
205
206
  return {
206
207
  ...n,
207
- ...s.reduce(
208
- (m, y) => ({
209
- ...m,
210
- [`${e}--${A.kebabCase(
211
- y
208
+ ...d.reduce(
209
+ (o, m) => ({
210
+ ...o,
211
+ [`${e}--${b.kebabCase(
212
+ m
212
213
  )}`]: !0
213
214
  }),
214
215
  {}
@@ -217,179 +218,197 @@ function H(e, t) {
217
218
  } else
218
219
  return {
219
220
  ...n,
220
- [`${e}--${A.kebabCase(c)}`]: u
221
+ [`${e}--${b.kebabCase(u)}`]: a
221
222
  };
222
223
  }, r) || {})
223
224
  };
224
225
  }
225
- const N = /* @__PURE__ */ I({
226
+ const I = /* @__PURE__ */ R({
226
227
  __name: "VvIcon",
227
- props: ie,
228
+ props: le,
228
229
  setup(e) {
229
- const t = e, r = R(!0), { modifiers: o } = F(t), n = x("ds"), { bemCssClasses: c } = H("vv-icon", {
230
- modifiers: o
231
- }), u = S(() => t.provider || (n == null ? void 0 : n.provider)), s = S(() => {
232
- const i = t.name || "", l = `@${u.value}:${t.prefix}:${t.name}`;
233
- return _(i) ? i : _(l) ? l : (n == null ? void 0 : n.iconsCollections.find((a) => {
234
- const g = `@${u.value}:${a.prefix}:${i}`;
235
- if (_(g))
236
- return g;
237
- })) || i;
230
+ const t = e, r = M(!0), { modifiers: i } = q(t), n = x("ds"), { bemCssClasses: u } = H("vv-icon", {
231
+ modifiers: i
232
+ }), a = A(() => t.provider || (n == null ? void 0 : n.provider)), d = A(() => {
233
+ const s = t.name || "", l = `@${a.value}:${t.prefix}:${t.name}`;
234
+ return D(s) ? s : D(l) ? l : (n == null ? void 0 : n.iconsCollections.find((y) => {
235
+ const f = `@${a.value}:${y.prefix}:${s}`;
236
+ if (D(f))
237
+ return f;
238
+ })) || s;
238
239
  });
239
- function m(i) {
240
+ function o(s) {
240
241
  let l = null;
241
242
  if (typeof window > "u") {
242
- const { JSDOM: E } = require("jsdom");
243
- l = new E().window;
243
+ const { JSDOM: v } = require("jsdom");
244
+ l = new v().window;
244
245
  }
245
- return (l ? new l.DOMParser() : new window.DOMParser()).parseFromString(i, "text/html").querySelector("svg");
246
+ return (l ? new l.DOMParser() : new window.DOMParser()).parseFromString(s, "text/html").querySelector("svg");
246
247
  }
247
- function y(i) {
248
- const l = m(i), a = (l == null ? void 0 : l.innerHTML.trim()) || "";
249
- l && a && W(`@${u.value}:${t.prefix}:${t.name}`, {
250
- body: a,
248
+ function m(s) {
249
+ const l = o(s), y = (l == null ? void 0 : l.innerHTML.trim()) || "";
250
+ l && y && X(`@${a.value}:${t.prefix}:${t.name}`, {
251
+ body: y,
251
252
  height: l.viewBox.baseVal.height,
252
253
  width: l.viewBox.baseVal.width
253
254
  });
254
255
  }
255
- return n && (t.src ? (r.value = !1, n.fetchIcon(t.src).then((i) => {
256
- i && (y(i), r.value = !0);
257
- }).catch((i) => {
258
- throw new Error(`During fetch icon: ${i == null ? void 0 : i.message}`);
259
- })) : t.svg && y(t.svg)), (i, l) => r.value ? (h(), D(d(Q), K({
256
+ return n && (t.src ? (r.value = !1, n.fetchIcon(t.src).then((s) => {
257
+ s && (m(s), r.value = !0);
258
+ }).catch((s) => {
259
+ throw new Error(`During fetch icon: ${s == null ? void 0 : s.message}`);
260
+ })) : t.svg && m(t.svg)), (s, l) => r.value ? (S(), F(p(W), K({
260
261
  key: 0,
261
- class: d(c)
262
+ class: p(u)
262
263
  }, {
263
- ...i.$props,
264
- provider: d(u),
265
- icon: d(s)
264
+ ...s.$props,
265
+ provider: p(a),
266
+ icon: p(d)
266
267
  }), null, 16, ["class"])) : w("", !0);
267
268
  }
268
269
  });
269
- function oe(e) {
270
- return Array.isArray(e) ? e.filter((t) => A.isString(t)).reduce((t, r) => t.length > 0 ? t + `
270
+ function B(e) {
271
+ return Array.isArray(e) ? e.filter((t) => b.isString(t)).reduce((t, r) => t.length > 0 ? t + `
271
272
  ` + r : r, "") : e;
272
273
  }
273
- function le(e, t) {
274
+ function ae(e, t) {
274
275
  return {
275
276
  name: "HintSlot",
276
- setup() {
277
- const r = F(e), {
278
- error: o,
279
- valid: n,
280
- hint: c,
281
- loading: u
277
+ props: {
278
+ params: { type: Object, default: () => {
279
+ } }
280
+ },
281
+ setup(r) {
282
+ const i = q(e), {
283
+ error: n,
284
+ valid: u,
285
+ hint: a,
286
+ loading: d
282
287
  } = t, {
283
- hintLabel: s,
288
+ hintLabel: o,
284
289
  modelValue: m,
285
- valid: y,
286
- validLabel: i,
287
- error: l,
288
- errorLabel: a
289
- } = r, g = A.resolveFieldData(r, "loading"), p = A.resolveFieldData(
290
- r,
290
+ valid: s,
291
+ validLabel: l,
292
+ error: y,
293
+ errorLabel: f
294
+ } = i, g = b.resolveFieldData(i, "loading"), v = b.resolveFieldData(
295
+ i,
291
296
  "loadingLabel"
292
- ), E = S(() => l.value ? !!(l.value && o || (a == null ? void 0 : a.value) && Array.isArray(a.value) && a.value.length > 0 || (a == null ? void 0 : a.value) && A.isNotEmpty(a.value)) : !1), $ = S(() => !!(s && s.value || c || n || i && i.value || E.value || (g == null ? void 0 : g.value) && u || (g == null ? void 0 : g.value) && (p == null ? void 0 : p.value))), O = S(() => Array.isArray(a == null ? void 0 : a.value) ? oe((a == null ? void 0 : a.value) || "") : a == null ? void 0 : a.value), f = S(() => {
293
- const v = { modelValue: m, error: l, valid: y };
294
- return l != null && l.value ? (o == null ? void 0 : o(v)) || (O == null ? void 0 : O.value) || (s == null ? void 0 : s.value) : y != null && y.value ? (n == null ? void 0 : n(v)) || (i == null ? void 0 : i.value) || (s == null ? void 0 : s.value) : g != null && g.value ? (u == null ? void 0 : u(v)) || (p == null ? void 0 : p.value) || (s == null ? void 0 : s.value) : (c == null ? void 0 : c(v)) || (s == null ? void 0 : s.value) || (s == null ? void 0 : s.value);
297
+ ), $ = A(() => y.value ? !!(y.value && n || (f == null ? void 0 : f.value) && Array.isArray(f.value) && f.value.length > 0 || (f == null ? void 0 : f.value) && b.isNotEmpty(f.value)) : !1), k = A(() => !!(o && o.value || a || u || l && l.value || $.value || (g == null ? void 0 : g.value) && d || (g == null ? void 0 : g.value) && (v == null ? void 0 : v.value))), c = A(() => {
298
+ const h = Y({
299
+ hintLabel: o,
300
+ modelValue: m,
301
+ valid: s,
302
+ validLabel: l,
303
+ error: y,
304
+ errorLabel: f,
305
+ loading: g,
306
+ loadingLabel: v,
307
+ ...r.params
308
+ });
309
+ return y != null && y.value ? (n == null ? void 0 : n(h)) || B(f == null ? void 0 : f.value) || (o == null ? void 0 : o.value) : s != null && s.value ? (u == null ? void 0 : u(h)) || B(l == null ? void 0 : l.value) || (o == null ? void 0 : o.value) : g != null && g.value ? (d == null ? void 0 : d(h)) || B(v == null ? void 0 : v.value) || (o == null ? void 0 : o.value) : (a == null ? void 0 : a(h)) || B(o == null ? void 0 : o.value) || (o == null ? void 0 : o.value);
295
310
  });
296
311
  return {
297
- hasHint: $,
298
- hintContent: f
312
+ hasHint: k,
313
+ hintContent: c
299
314
  };
300
315
  },
301
316
  render() {
302
317
  if (this.hasHint)
303
- return M("span", null, this.hintContent);
318
+ return T(
319
+ "pre",
320
+ { style: { "white-space": "pre" } },
321
+ this.hintContent
322
+ );
304
323
  }
305
324
  };
306
325
  }
307
- const ue = ["for"], ae = { class: "vv-select__wrapper" }, ce = ["id", "value", "disabled"], fe = {
326
+ const ue = ["for"], ce = { class: "vv-select__wrapper" }, fe = ["id", "value", "disabled"], de = {
308
327
  key: 0,
309
328
  value: "",
310
329
  disabled: "",
311
330
  selected: ""
312
- }, de = ["disabled", "value"], pe = /* @__PURE__ */ I({
331
+ }, pe = ["disabled", "value"], he = /* @__PURE__ */ R({
313
332
  __name: "VvNativeSelect",
314
- props: se,
333
+ props: oe,
315
334
  emits: ["update:modelValue"],
316
335
  setup(e, { emit: t }) {
317
- const r = e, o = T(), n = le(r, o), {
318
- modifiers: c,
319
- disabled: u,
320
- readonly: s,
321
- loading: m,
322
- iconLeft: y,
323
- iconRight: i,
336
+ const r = e, i = z(), n = ae(r, i), {
337
+ modifiers: u,
338
+ disabled: a,
339
+ readonly: d,
340
+ loading: o,
341
+ iconLeft: m,
342
+ iconRight: s,
324
343
  error: l,
325
- valid: a
326
- } = F(r), g = G(), { bemCssClasses: p } = H("vv-select", {
327
- modifiers: c,
328
- loading: m,
329
- readonly: s,
330
- iconLeft: y,
331
- iconRight: i,
332
- valid: a,
344
+ valid: y
345
+ } = q(r), f = Q(), { bemCssClasses: g } = H("vv-select", {
346
+ modifiers: u,
347
+ loading: o,
348
+ readonly: d,
349
+ iconLeft: m,
350
+ iconRight: s,
351
+ valid: y,
333
352
  invalid: l,
334
- dirty: S(() => A.isNotEmpty(r.modelValue))
353
+ dirty: A(() => b.isNotEmpty(r.modelValue))
335
354
  });
336
- function E(f) {
337
- return typeof f == "string" ? f : f[r.valueKey];
355
+ function v(c) {
356
+ return typeof c == "string" ? c : c[r.valueKey];
338
357
  }
339
- function $(f) {
340
- return typeof f == "string" ? f : f[r.labelKey];
358
+ function $(c) {
359
+ return typeof c == "string" ? c : c[r.labelKey];
341
360
  }
342
- function O(f) {
361
+ function k(c) {
343
362
  var j;
344
- const v = f.target, C = (r.useObject ? (j = r.options) == null ? void 0 : j.find(
345
- (B) => B[r.valueKey] == v.value
346
- ) : null) || v.value;
363
+ const h = c.target, C = (r.useObject ? (j = r.options) == null ? void 0 : j.find(
364
+ (E) => E[r.valueKey] == h.value
365
+ ) : null) || h.value;
347
366
  t("update:modelValue", C);
348
367
  }
349
- return (f, v) => {
350
- var k;
351
- return h(), b("div", {
352
- class: z(d(p))
368
+ return (c, h) => {
369
+ var P;
370
+ return S(), O("div", {
371
+ class: Z(p(g))
353
372
  }, [
354
- f.label ? (h(), b("label", {
373
+ c.label ? (S(), O("label", {
355
374
  key: 0,
356
- for: d(g)
357
- }, P(f.label), 9, ue)) : w("", !0),
358
- q("div", ae, [
359
- V(f.$slots, "icon-left", {}, () => [
360
- d(y) ? (h(), D(N, {
375
+ for: p(f)
376
+ }, _(c.label), 9, ue)) : w("", !0),
377
+ V("div", ce, [
378
+ N(c.$slots, "icon-left", {}, () => [
379
+ p(m) ? (S(), F(I, {
361
380
  key: 0,
362
- name: d(y)
381
+ name: p(m)
363
382
  }, null, 8, ["name"])) : w("", !0)
364
383
  ]),
365
- q("select", {
366
- id: d(g),
367
- value: typeof f.modelValue == "string" ? f.modelValue : (k = f.modelValue) == null ? void 0 : k[f.valueKey],
368
- disabled: d(u) || d(s),
369
- onInput: O
384
+ V("select", {
385
+ id: p(f),
386
+ value: typeof c.modelValue == "string" ? c.modelValue : (P = c.modelValue) == null ? void 0 : P[c.valueKey],
387
+ disabled: p(a) || p(d),
388
+ onInput: k
370
389
  }, [
371
- f.placeholder ? (h(), b("option", fe, P(f.placeholder), 1)) : w("", !0),
372
- (h(!0), b(Z, null, J(f.options, (C, j) => {
373
- var B;
374
- return h(), b("option", {
390
+ c.placeholder ? (S(), O("option", de, _(c.placeholder), 1)) : w("", !0),
391
+ (S(!0), O(J, null, U(c.options, (C, j) => {
392
+ var E;
393
+ return S(), O("option", {
375
394
  key: j,
376
- disabled: typeof C == "object" ? (B = C.disabled) != null ? B : d(u) : d(u),
377
- value: E(C)
378
- }, P($(C)), 9, de);
395
+ disabled: typeof C == "object" ? (E = C.disabled) != null ? E : p(a) : p(a),
396
+ value: v(C)
397
+ }, _($(C)), 9, pe);
379
398
  }), 128))
380
- ], 40, ce),
381
- V(f.$slots, "icon-right", {}, () => [
382
- d(i) ? (h(), D(N, {
399
+ ], 40, fe),
400
+ N(c.$slots, "icon-right", {}, () => [
401
+ p(s) ? (S(), F(I, {
383
402
  key: 0,
384
- name: d(i)
403
+ name: p(s)
385
404
  }, null, 8, ["name"])) : w("", !0)
386
405
  ])
387
406
  ]),
388
- U(d(n), { class: "vv-select__hint" })
407
+ G(p(n), { class: "vv-select__hint" })
389
408
  ], 2);
390
409
  };
391
410
  }
392
411
  });
393
412
  export {
394
- pe as default
413
+ he as default
395
414
  };