@volverjs/ui-vue 0.0.9-beta.2 → 0.0.9-beta.21
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.
- package/README.md +3 -3
- package/auto-imports.d.ts +2 -0
- package/dist/components/VvAccordion/VvAccordion.es.js +15 -7
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +15 -7
- package/dist/components/VvAction/VvAction.es.js +17 -8
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +9 -0
- package/dist/components/VvAction/index.d.ts +4 -0
- package/dist/components/VvAlert/VvAlert.es.js +22 -13
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
- package/dist/components/VvAlert/index.d.ts +3 -3
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +22 -13
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +6 -6
- package/dist/components/VvAlertGroup/index.d.ts +2 -2
- package/dist/components/VvAvatar/VvAvatar.es.js +15 -7
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +15 -7
- package/dist/components/VvBadge/VvBadge.es.js +15 -7
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +15 -7
- package/dist/components/VvButton/VvButton.es.js +19 -9
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +9 -0
- package/dist/components/VvButton/index.d.ts +4 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +15 -7
- package/dist/components/VvCard/VvCard.es.js +15 -7
- package/dist/components/VvCheckbox/VvCheckbox.es.js +99 -21
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +105 -22
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +256 -191
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +329 -101
- package/dist/components/VvCombobox/index.d.ts +123 -37
- package/dist/components/VvDialog/VvDialog.es.js +50 -37
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +32 -18
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +300 -92
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +9 -0
- package/dist/components/VvDropdown/index.d.ts +99 -30
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +17 -8
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +15 -7
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +15 -7
- package/dist/components/VvInputText/VvInputText.es.js +279 -116
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +23 -41
- package/dist/components/VvInputText/index.d.ts +15 -33
- package/dist/components/VvNav/VvNav.es.js +18 -9
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/index.d.ts +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +15 -7
- package/dist/components/VvRadio/VvRadio.es.js +99 -21
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +105 -22
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +95 -21
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +5 -5
- package/dist/components/VvTab/VvTab.es.js +18 -9
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +103 -26
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +15 -7
- package/dist/components/common/HintSlot.d.ts +4 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.es.js +1212 -626
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlert.d.ts +27 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.es.js +81 -0
- package/dist/composables/index.umd.js +1 -0
- package/dist/constants.d.ts +14 -0
- package/dist/directives/index.es.js +15 -7
- package/dist/directives/v-tooltip.es.js +15 -7
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +107 -31
- package/dist/resolvers/unplugin.es.js +3 -0
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +54 -269
- package/dist/stories/Alert/Alert.settings.d.ts +3 -7
- package/dist/stories/AlertGroup/AlertGroupSlots.stories.d.ts +2 -2
- package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +6 -0
- package/dist/stories/Button/Button.settings.d.ts +3 -13
- package/dist/stories/Combobox/Combobox.settings.d.ts +117 -19
- package/dist/stories/InputText/InputText.settings.d.ts +31 -9
- package/dist/stories/InputText/InputText.stories.d.ts +0 -1
- package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
- package/dist/stories/Nav/Nav.settings.d.ts +3 -21
- package/package.json +75 -66
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAction/VvAction.vue +2 -1
- package/src/components/VvAlert/VvAlert.vue +5 -1
- package/src/components/VvAlert/index.ts +3 -3
- package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
- package/src/components/VvButton/VvButton.vue +1 -0
- package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
- package/src/components/VvCombobox/VvCombobox.vue +43 -23
- package/src/components/VvCombobox/index.ts +24 -0
- package/src/components/VvDialog/VvDialog.vue +22 -19
- package/src/components/VvDropdown/VvDropdown.vue +24 -18
- package/src/components/VvInputText/VvInputText.vue +177 -55
- package/src/components/VvInputText/index.ts +32 -34
- package/src/components/VvNav/VvNav.vue +1 -1
- package/src/components/VvNav/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +8 -1
- package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
- package/src/components/VvSelect/VvSelect.vue +8 -1
- package/src/components/VvTextarea/VvTextarea.vue +16 -6
- package/src/components/common/HintSlot.ts +26 -13
- package/src/components/index.ts +5 -0
- package/src/composables/alert/useAlert.ts +103 -0
- package/src/composables/index.ts +1 -0
- package/src/constants.ts +26 -0
- package/src/props/index.ts +14 -11
- package/src/resolvers/unplugin.ts +3 -0
- package/src/stories/Alert/Alert.settings.ts +3 -1
- package/src/stories/AlertGroup/AlertGroup.test.ts +13 -0
- package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +3 -3
- package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +118 -0
- package/src/stories/Button/Button.settings.ts +5 -3
- package/src/stories/Combobox/Combobox.settings.ts +119 -2
- package/src/stories/Combobox/Combobox.test.ts +1 -1
- package/src/stories/InputText/InputText.settings.ts +36 -15
- package/src/stories/InputText/InputText.stories.ts +4 -12
- package/src/stories/InputText/InputText.test.ts +31 -15
- package/src/stories/InputText/InputTextMask.stories.ts +122 -0
- package/src/stories/Nav/Nav.settings.ts +3 -1
- package/src/stories/Tab/Tab.stories.ts +3 -3
- package/src/stories/Textarea/TextareaLength.stories.ts +1 -1
- package/src/types/alert.d.ts +20 -0
- /package/dist/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue.d.ts +0 -0
- /package/dist/components/{VvNavSeparator → VvNav}/VvNavSeparator.d.ts +0 -0
- /package/src/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue +0 -0
- /package/src/components/{VvNavSeparator → VvNav}/VvNavSeparator.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("maska"),require("@iconify/vue"),require("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","maska","@iconify/vue","nanoid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.maska,e.vue$1,e.nanoid,e.core)}(this,(function(e,t,o,l,n){"use strict";function a(t){return null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}function i(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const r={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]}};var u=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(u||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{});const c=Symbol.for("volver");function p(t,o,l){return e.computed((()=>{const n={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((o=>{n[`${t}--${o}`]=e.unref(l.value[o])})),n}))}const v=e.defineComponent({name:"VvIcon",props:r,setup(t){const l=t,n=e.computed((()=>"string"==typeof l.rotate?parseFloat(l.rotate):l.rotate)),a=e.ref(!0),i=e.inject(c),{modifiers:r}=e.toRefs(l),u=p("vv-icon",r),s=e.computed((()=>l.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=l.name??"",t=`@${s.value}:${l.prefix}:${e}`;if(o.iconExists(t))return t;const n=null==i?void 0:i.iconsCollections.find((t=>{const l=`@${s.value}:${t.prefix}:${e}`;return o.iconExists(l)}));return n?`@${s.value}:${n.prefix}:${e}`:e}));function v(e){const t=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),n=(null==t?void 0:t.innerHTML.trim())||"";t&&n&&o.addIcon(`@${s.value}:${l.prefix}:${l.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&l.src&&!o.iconExists(`@${s.value}:${l.prefix}:${l.name}`)&&(a.value=!1,i.fetchIcon(l.src).then((e=>{e&&(v(e),a.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),l.svg&&v(l.svg),(t,l)=>e.unref(a)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(n),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),m={valid:Boolean,validLabel:[String,Array]},f={invalid:Boolean,invalidLabel:[String,Array]},h={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},b={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),S={readonly:Boolean},y={modifiers:[String,Array]},w={hintLabel:{type:String,default:""}},k={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},B={debounce:[Number,String]},L={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},E={tabindex:{type:[String,Number],default:0}},x={floating:Boolean},P={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const T={...{...P,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...E,...b,...S,...m,...f,...w,...h,...y,...k,...B,...L,...x,...g,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button;const C={TEXT:"text",PASSWORD:"password",NUMBER:"number",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",DATE:"date",TIME:"time",DATETIME_LOCAL:"datetime-local",MONTH:"month",WEEK:"week"},$="eye-on",A="eye-off",I="calendar",V="time",_="color",O={...T,modelValue:[String,Number],type:{type:String,default:C.TEXT,validator:e=>Object.values(C).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:$},iconHidePassword:{type:String,default:A},iconClear:{type:String,default:"close"},labelStepUp:{type:String,default:"Increase value"},labelStepDown:{type:String,default:"Decrease value"},labelShowPassword:{type:String,default:"Show password"},labelHidePassword:{type:String,default:"Hide password"},labelClear:{type:String,default:"Clear"},mask:{type:String,default:void 0},maskEager:{type:Boolean,default:!1},maskReversed:{type:Boolean,default:!1},maskTokens:{type:Object,default:void 0},maskTokensReplace:{type:Boolean,default:!1},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String}},R=e.defineComponent({components:{VvIcon:v},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:$},iconHide:{type:String,default:A}},emits:["toggle-password"],setup(t,{emit:o}){const l=e.ref(!1),n=e.computed((()=>l.value?t.iconHide:t.iconShow));return{active:l,activeIcon:n,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(l.value=!l.value,o("toggle-password",l.value))}}},render(){const t=e.h(v,{name:this.activeIcon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},t)}}),D=e.defineComponent({components:{VvIcon:v},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:e=>["up","down"].includes(e),default:"up"}},emits:["step-up","step-down"],setup(t,{emit:o}){const l=e.computed((()=>"up"===t.mode));return{isUp:l,onClick:e=>{null==e||e.stopPropagation(),t.disabled||o(l.value?"step-up":"step-down")}}},render(){return e.h("button",{class:["vv-input-text__action vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,type:"button",onClick:this.onClick})}}),N=e.defineComponent({components:{VvIcon:v},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(o){null==o||o.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(v,{name:this.icon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});function H(t,o){return{name:"VvInputTextActions",components:{VvIcon:v,VvInputPasswordAction:R,VvInputStepAction:D,VvInputClearAction:N},setup:()=>({isDisabled:e.computed((()=>o.disabled||o.readonly)),labelStepUp:o.labelStepUp,labelStepDown:o.labelStepDown,labelShowPassword:o.labelShowPassword,labelHidePassword:o.labelHidePassword,labelClear:o.labelClear,iconShowPassword:o.iconShowPassword,iconHidePassword:o.iconHidePassword}),render(){let l=null;switch(t){case C.SEARCH:{const{onClear:t}=this.$attrs;l=[e.h(N,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case C.PASSWORD:{const{onTogglePassword:t}=this.$attrs;l=[e.h(R,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case C.NUMBER:{const{onStepUp:t,onStepDown:n}=this.$attrs;l=[e.h(D,{mode:"up",disabled:this.isDisabled||void 0!==o.max&&o.modelValue===o.max,label:this.labelStepUp,onStepUp:t,onStepDown:n}),e.h(D,{mode:"down",disabled:this.isDisabled||void 0!==o.min&&o.modelValue===o.min,label:this.labelStepDown,onStepUp:t,onStepDown:n})];break}}return Array.isArray(l)?e.h("div",{class:"vv-input-text__actions-group"},l):l}}}const M=["for"],U={class:"vv-input-text__wrapper"},W={key:0,class:"vv-input-text__input-before"},q=["onClick"],z=["id"],j={key:1,class:"vv-input-text__unit"},F={key:5,class:"vv-input-text__input-after"},X={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:O,emits:["update:modelValue","focus","blur","keyup"],setup(o,{expose:r,emit:d}){const c=o,m=e.useSlots(),f=e.ref(),h=e.ref();r({$inner:h});const{id:b,icon:g,iconPosition:S,label:y,modelValue:w,count:k,valid:B,invalid:L,loading:E}=e.toRefs(c),x=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(b),P=e.computed((()=>`${x.value}-hint`)),T=e.computed((()=>c.floating&&a(c.placeholder)?" ":c.placeholder)),$=function(t,o,l=0,{getter:n=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof l&&(l=parseInt(l)),e.computed({get:()=>n(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),l)}})}(w,d,c.debounce,{getter:e=>we.value?we.value.masked(e??""):e,setter:e=>(we.value&&(e=we.value.unmasked(e)),c.type===C.NUMBER?Number(e):e)}),{focused:A}=function(t,o){const{focused:l}=n.useFocus(t);return e.watch(l,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:l}}(f,d),O=e.computed((()=>A.value&&!c.disabled&&!c.readonly)),R=n.useElementVisibility(f);e.watch(R,(e=>{e&&c.autofocus&&!c.disabled&&!c.readonly&&(A.value=!0)}));const D=e.ref(!1),N=e.computed((()=>c.type===C.PASSWORD)),K=()=>{D.value=!D.value},J=e.computed((()=>c.type===C.TIME||c.type===C.DATETIME_LOCAL||c.type===C.DATE||c.type===C.WEEK||c.type===C.MONTH)),G=e.computed((()=>c.type===C.NUMBER)),Q=()=>{ie.value&&(f.value.stepUp(),$.value=e.unref(f).value)},Y=()=>{ie.value&&(f.value.stepDown(),$.value=e.unref(f).value)},Z=e.computed((()=>c.type===C.SEARCH)),ee=()=>{$.value=void 0},{hasIcon:te,hasIconBefore:oe,hasIconAfter:le}=function(t,o){const l=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.before))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.after))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.top))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===u.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:a,hasIconRight:i,hasIconTop:r,hasIconBottom:d,hasIconBefore:l,hasIconAfter:n}}(g,S),ne=e.computed((()=>{switch(c.type){case C.COLOR:return{name:_};case C.DATE:case C.DATETIME_LOCAL:case C.WEEK:case C.MONTH:return{name:I};case C.TIME:return{name:V};default:return""}})),{formatted:ae}=function(t,o){const l=e.computed((()=>(e.unref(t)??"").length)),n=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&l.value<(null==o?void 0:o.lowerLimit)?l.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&l.value<(null==o?void 0:o.upperLimit)?o.upperLimit-l.value:0)),a=e.computed((()=>{if(!1===(null==o?void 0:o.mode))return"";if("limit"===(null==o?void 0:o.mode)&&(null==o?void 0:o.upperLimit))return`${l.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===n.value)return;return n}return l.value}));return{length:l,gap:n,formatted:a}}($,{mode:c.count,upperLimit:Number(c.maxlength),lowerLimit:Number(c.minlength)}),ie=e.computed((()=>!c.disabled&&!c.readonly)),re=e.computed((()=>ie.value?c.tabindex:-1)),ue=e.computed((()=>!a(w))),se=e.computed((()=>!0===L.value||!0!==B.value&&void 0)),{modifiers:de}=e.toRefs(c),ce=p("vv-input-text",de,e.computed((()=>({valid:B.value,invalid:L.value,loading:E.value,disabled:c.disabled,readonly:c.readonly,"icon-before":oe.value,"icon-after":le.value||!a(ne),floating:c.floating&&!a(c.label),dirty:ue.value,focus:O.value,"auto-width":c.autoWidth})))),pe=e.computed((()=>{const e=N.value&&D.value?C.TEXT:!J.value||ue.value||A.value?c.type:C.TEXT,t={type:e,name:c.name,tabindex:re.value,disabled:c.disabled,readonly:c.readonly,required:c.required,autocomplete:c.autocomplete,"aria-invalid":se.value,"aria-describedby":fe.value?P.value:void 0,"aria-errormessage":he.value?P.value:void 0};return e!==C.DATE&&e!==C.MONTH&&e!==C.WEEK&&e!==C.TIME&&e!==C.DATETIME_LOCAL&&e!==C.NUMBER||(t.step=c.step,t.max=void 0!==c.max?String(c.max):void 0,t.min=void 0!==c.min?String(c.min):void 0),e!==C.TEXT&&e!==C.SEARCH&&e!==C.URL&&e!==C.TEL&&e!==C.EMAIL&&e!==C.PASSWORD&&e!==C.NUMBER||(t.placeholder=T.value),e!==C.TEXT&&e!==C.SEARCH&&e!==C.URL&&e!==C.TEL&&e!==C.EMAIL&&e!==C.PASSWORD||(t.minlength=c.minlength,t.maxlength=c.maxlength,t.pattern=c.pattern),e===C.EMAIL&&(t.multiple=c.multiple),t})),ve=e.computed((()=>({valid:c.valid,invalid:c.invalid,modelValue:c.modelValue,togglePassword:K,stepUp:Q,stepDown:Y,clear:ee}))),{HintSlot:me,hasHintLabelOrSlot:fe,hasInvalidLabelOrSlot:he,hintSlotScope:be}=function(t,o){const l=e.computed((()=>i(t.invalidLabel))),n=e.computed((()=>i(t.validLabel))),a=e.computed((()=>t.loadingLabel)),r=e.computed((()=>t.hintLabel)),u=e.computed((()=>Boolean(t.loading&&(o.loading||a.value)))),s=e.computed((()=>!u.value&&Boolean(t.invalid&&(o.invalid||l.value)))),d=e.computed((()=>!u.value&&!s.value&&Boolean(t.valid&&(o.valid||n.value)))),c=e.computed((()=>!u.value&&!s.value&&!d.value&&Boolean(o.hint||r.value))),p=e.computed((()=>s.value||d.value||u.value||c.value)),v=e.computed((()=>({modelValue:t.modelValue,valid:t.valid,invalid:t.invalid,loading:t.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:p,invalidLabel:l,validLabel:n,loadingLabel:a,hintLabel:r,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,o,l,n,a,i,r,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(o=(t=this.$slots).loading)?void 0:o.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(n=(l=this.$slots).invalid)?void 0:n.call(l))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(a=this.$slots).valid)?void 0:i.call(a))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hintSlotScope:v,HintSlot:m}}(c,m),ge=H(C.PASSWORD,c),Se=H(C.NUMBER,c),ye=H(C.SEARCH,c),we=e.ref();e.watch([()=>c.mask,()=>c.type,()=>c.maskEager,()=>c.maskReversed,()=>c.maskTokens,()=>c.maskTokensReplace],(([e,o,l,n,a,i])=>{we.value=e&&o===C.TEXT?new t.Mask({mask:e,eager:l,reversed:n,tokens:a,tokensReplace:i}):void 0}),{immediate:!0});const ke=()=>{ie.value&&(A.value=!0)},Be=e.computed((()=>{if(c.autoWidth)return{width:void 0!==$.value?`${String($.value).length+1}ch`:void 0}}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ce))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(x),class:"vv-input-text__label"},e.toDisplayString(e.unref(y)),9,M)):e.createCommentVNode("",!0),e.createElementVNode("div",U,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",W,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(ve))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:h,class:"vv-input-text__inner",onClick:e.withModifiers(ke,["stop"])},[e.unref(oe)?(e.openBlock(),e.createBlock(v,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(te)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(x),ref_key:"inputEl",ref:f,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef($)?$.value=t:null)},e.unref(pe),{style:e.unref(Be),onKeyup:o[1]||(o[1]=e=>d("keyup",e))}),null,16,z),[[e.vModelDynamic,e.unref($)]]),(t.unit||t.$slots.unit)&&e.unref(ue)?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(ve))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,q),e.unref(le)||e.unref(ne)?(e.openBlock(),e.createBlock(v,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(le)?e.unref(te):e.unref(ne)),null,16)):e.unref(N)&&!t.hideActions&&e.unref(ie)?(e.openBlock(),e.createBlock(e.unref(ge),{key:2,onTogglePassword:K})):e.unref(G)&&!t.hideActions&&e.unref(ie)?(e.openBlock(),e.createBlock(e.unref(Se),{key:3,onStepUp:Q,onStepDown:Y})):e.unref(Z)&&!t.hideActions&&e.unref(ie)?(e.openBlock(),e.createBlock(e.unref(ye),{key:4,onClear:ee})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(ve))))])):e.createCommentVNode("",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",X,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(ve))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ae)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(me),{id:e.unref(P),class:"vv-input-text__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(be))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(be))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(be))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(be))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("vue-imask"),require("@iconify/vue"),require("nanoid"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","vue-imask","@iconify/vue","nanoid","@vueuse/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.vueImask,e.vue$1,e.nanoid,e.core)}(this,(function(e,t,l,o,a){"use strict";function n(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 i(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const r={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]}};var u=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(u||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),d=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(d||{});const c=Symbol.for("volver");function v(){return e.inject(c)}function p(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const m=e.defineComponent({name:"VvIcon",props:r,setup(t){const o=t,a=e.computed((()=>"string"==typeof o.rotate?parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=v(),{modifiers:r}=e.toRefs(o),u=p("vv-icon",r),s=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${s.value}:${o.prefix}:${e}`;if(l.iconExists(t))return t;const a=null==i?void 0:i.iconsCollections.find((t=>{const o=`@${s.value}:${t.prefix}:${e}`;return l.iconExists(o)}));return a?`@${s.value}:${a.prefix}:${e}`:e}));function c(e){const t=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==t?void 0:t.innerHTML.trim())||"";t&&a&&l.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return i&&o.src&&!l.iconExists(`@${s.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(o.svg),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},h={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},S=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},w={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},B={debounce:[Number,String]},E={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},$={tabindex:{type:[String,Number],default:0}},x={floating:Boolean},A={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const T={...{...A,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...$,...g,...y,...f,...h,...k,...b,...w,...L,...B,...E,...x,...S,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};d.button;const P={TEXT:"text",PASSWORD:"password",NUMBER:"number",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",DATE:"date",TIME:"time",DATETIME_LOCAL:"datetime-local",MONTH:"month",WEEK:"week"},C="eye-on",D="eye-off",I="calendar",O="time",V="color",_={...T,modelValue:[String,Number],type:{type:String,default:P.TEXT,validator:e=>Object.values(P).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:C},iconHidePassword:{type:String,default:D},iconClear:{type:String,default:"close"},labelStepUp:{type:String,default:"Increase value"},labelStepDown:{type:String,default:"Decrease value"},labelShowPassword:{type:String,default:"Show password"},labelHidePassword:{type:String,default:"Hide password"},labelClear:{type:String,default:"Clear"},iMask:{type:Object,default:void 0},masked:{type:String,default:void 0},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String},selectOnFocus:{type:Boolean,default:!1}},N=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:C},iconHide:{type:String,default:D}},emits:["toggle-password"],setup(t,{emit:l}){const o=e.ref(!1),a=e.computed((()=>o.value?t.iconHide:t.iconShow));return{active:o,activeIcon:a,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(o.value=!o.value,l("toggle-password",o.value))}}},render(){const t=e.h(m,{name:this.activeIcon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},t)}}),M=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:e=>["up","down"].includes(e),default:"up"}},emits:["step-up","step-down"],setup(t,{emit:l}){const o=e.computed((()=>"up"===t.mode));return{isUp:o,onClick:e=>{null==e||e.stopPropagation(),t.disabled||l(o.value?"step-up":"step-down")}}},render(){return e.h("button",{class:["vv-input-text__action vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,type:"button",onClick:this.onClick})}}),R=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(l){null==l||l.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(m,{name:this.icon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});function H(t,l){return{name:"VvInputTextActions",components:{VvIcon:m,VvInputPasswordAction:N,VvInputStepAction:M,VvInputClearAction:R},setup:()=>({isDisabled:e.computed((()=>l.disabled||l.readonly)),labelStepUp:l.labelStepUp,labelStepDown:l.labelStepDown,labelShowPassword:l.labelShowPassword,labelHidePassword:l.labelHidePassword,labelClear:l.labelClear,iconShowPassword:l.iconShowPassword,iconHidePassword:l.iconHidePassword}),render(){let o=null;switch(t){case P.SEARCH:{const{onClear:t}=this.$attrs;o=[e.h(R,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case P.PASSWORD:{const{onTogglePassword:t}=this.$attrs;o=[e.h(N,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case P.NUMBER:{const{onStepUp:t,onStepDown:a}=this.$attrs;o=[e.h(M,{mode:"up",disabled:this.isDisabled||void 0!==l.max&&l.modelValue===l.max,label:this.labelStepUp,onStepUp:t,onStepDown:a}),e.h(M,{mode:"down",disabled:this.isDisabled||void 0!==l.min&&l.modelValue===l.min,label:this.labelStepDown,onStepUp:t,onStepDown:a})];break}}return Array.isArray(o)?e.h("div",{class:"vv-input-text__actions-group"},o):o}}}const U=["for"],j={class:"vv-input-text__wrapper"},F={key:0,class:"vv-input-text__input-before"},W=["onClick"],q=["id"],z={key:1,class:"vv-input-text__unit"},K={key:5,class:"vv-input-text__input-after"},X={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:_,emits:["update:modelValue","update:masked","accept","accept:typed","accept:masked","accept:unmasked","complete","complete:typed","complete:masked","complete:unmasked","focus","blur","keyup","keydown","keypress"],setup(l,{expose:r,emit:d}){const c=l,f=e.useSlots(),h=function(t,l,o){const a=v(),n=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===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(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(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvInputText",_,c),{id:b,icon:g,iconPosition:S,label:y,modelValue:w,count:k,valid:L,invalid:B,loading:E,debounce:$,maxlength:x,minlength:A,type:T,iMask:C,step:D}=e.toRefs(c),N=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(b),M=e.computed((()=>`${N.value}-hint`)),R=e.computed((()=>c.floating&&n(c.placeholder)?" ":c.placeholder)),J=e.ref(!1),{el:Y,mask:G,typed:Q,masked:Z,unmasked:ee}=t.useIMask(e.computed((()=>(null==C?void 0:C.value)??{mask:/./})),{emit:d,onAccept:()=>{if(J.value){if(d("update:masked",Z.value),T.value===P.NUMBER){if(""===Z.value){if(null===oe.value||void 0===oe.value)return;return void(oe.value=void 0)}return"number"!=typeof Q.value?void(oe.value=Number(Q.value)):void(oe.value=Q.value)}if(T.value===P.DATE){if(Y.value instanceof HTMLInputElement&&"date"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return e instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}`)}if(T.value===P.DATETIME_LOCAL){if(Y.value instanceof HTMLInputElement&&"datetime-local"===Y.value.type)return void(oe.value=Y.value.value);let e=Q.value;if(null===e||""===e){if(!oe.value)return;return void(oe.value="")}return Q.value instanceof Date||(e=new Date(e)),void(oe.value=`${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)}T${("0"+e.getHours()).slice(-2)}:${("0"+e.getMinutes()).slice(-2)}`)}(oe.value||ee.value)&&(oe.value=ee.value)}}});e.onMounted((()=>{G.value&&(J.value=!0,Q.value=oe.value??"")})),e.watch((()=>c.modelValue),(e=>{var t;G.value&&(Q.value=e&&(null==(t=null==C?void 0:C.value)?void 0:t.mask)===Date?new Date(e):e??"")})),e.watch((()=>c.masked),(e=>{Z.value=e??""}));const te=Y,le=e.ref();r({$inner:le});const oe=function(t,l,o=0,{getter:a=(e=>e),setter:n=(e=>e)}={}){let i;return"string"==typeof o&&(o=parseInt(o)),e.computed({get:()=>a(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{l("update:modelValue",n(e))}),o)}})}(w,d,(null==$?void 0:$.value)??0),{focused:ae}=function(t,l){const{focused:o}=a.useFocus(t);return e.watch(o,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:o}}(te,d),ne=e.computed((()=>ae.value&&!c.disabled&&!c.readonly));e.watch(ne,(e=>{e&&h.value.selectOnFocus&&te.value&&te.value.select()}));const ie=a.useElementVisibility(te);e.watch(ie,(e=>{e&&c.autofocus&&!c.disabled&&!c.readonly&&(ae.value=!0)}));const re=e.ref(!1),ue=e.computed((()=>c.type===P.PASSWORD)),se=()=>{re.value=!re.value},de=e.computed((()=>c.type===P.TIME||c.type===P.DATETIME_LOCAL||c.type===P.DATE||c.type===P.WEEK||c.type===P.MONTH)),ce=e.computed((()=>c.type===P.NUMBER)),ve=()=>{if(we.value){if(null==C?void 0:C.value)return void(Q.value=Q.value+Number((null==D?void 0:D.value)??1));te.value.stepUp(),oe.value=e.unref(te).value}},pe=()=>{if(we.value){if(null==C?void 0:C.value)return void(Q.value=Q.value-Number((null==D?void 0:D.value)??1));te.value.stepDown(),oe.value=e.unref(te).value}},me=e.computed((()=>c.type===P.SEARCH)),fe=()=>{oe.value=""},{hasIcon:he,hasIconBefore:be,hasIconAfter:ge}=function(t,l){const o=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===s.before))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===s.after))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.top))),d=e.computed((()=>Boolean((null==t?void 0:t.value)&&l.value===u.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:n,hasIconRight:i,hasIconTop:r,hasIconBottom:d,hasIconBefore:o,hasIconAfter:a}}(g,S),Se=e.computed((()=>{switch(c.type){case P.COLOR:return{name:V};case P.DATE:case P.DATETIME_LOCAL:case P.WEEK:case P.MONTH:return{name:I};case P.TIME:return{name:O};default:return""}})),{formatted:ye}=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)),n=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:n}}(oe,{mode:k.value,upperLimit:Number(null==x?void 0:x.value),lowerLimit:Number(null==A?void 0:A.value)}),we=e.computed((()=>!c.disabled&&!c.readonly)),ke=e.computed((()=>we.value?c.tabindex:-1)),Le=e.computed((()=>!n(w))),Be=e.computed((()=>!0===B.value||!0!==L.value&&void 0)),{modifiers:Ee}=e.toRefs(c),$e=p("vv-input-text",Ee,e.computed((()=>({valid:L.value,invalid:B.value,loading:E.value,disabled:c.disabled,readonly:c.readonly,"icon-before":be.value,"icon-after":ge.value||!n(Se),floating:c.floating&&!n(c.label),dirty:Le.value,focus:ne.value,"auto-width":c.autoWidth})))),xe=e.computed((()=>{const e=ue.value&&re.value?P.TEXT:!de.value||Le.value||ae.value?(null==C?void 0:C.value)?P.TEXT:c.type:P.TEXT,t={type:e,name:c.name,tabindex:ke.value,disabled:c.disabled,readonly:c.readonly,required:c.required,autocomplete:c.autocomplete,"aria-invalid":Be.value,"aria-describedby":Pe.value?M.value:void 0,"aria-errormessage":Ce.value?M.value:void 0};return e!==P.DATE&&e!==P.MONTH&&e!==P.WEEK&&e!==P.TIME&&e!==P.DATETIME_LOCAL&&e!==P.NUMBER||(t.step=c.step,t.max=void 0!==c.max?String(c.max):void 0,t.min=void 0!==c.min?String(c.min):void 0),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD&&e!==P.NUMBER||(t.placeholder=R.value),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD||(t.minlength=c.minlength,t.maxlength=c.maxlength,t.pattern=c.pattern),e===P.EMAIL&&(t.multiple=c.multiple),t})),Ae=e.computed((()=>({valid:c.valid,invalid:c.invalid,modelValue:c.modelValue,togglePassword:se,stepUp:ve,stepDown:pe,clear:fe}))),{HintSlot:Te,hasHintLabelOrSlot:Pe,hasInvalidLabelOrSlot:Ce,hintSlotScope:De}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>i(o.value.invalidLabel))),n=e.computed((()=>i(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),u=e.computed((()=>o.value.hintLabel)),s=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.value)))),d=e.computed((()=>!s.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),c=e.computed((()=>!s.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!s.value&&!d.value&&!c.value&&Boolean(l.hint||u.value))),p=e.computed((()=>d.value||c.value||s.value||v.value)),m=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:p,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:u,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:s,hasHintLabelOrSlot:v}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:c,hasLoadingLabelOrSlot:s,hintSlotScope:m,HintSlot:f}}(h,f),Ie=H(P.PASSWORD,c),Oe=H(P.NUMBER,c),Ve=H(P.SEARCH,c),_e=()=>{we.value&&(ae.value=!0)},Ne=e.computed((()=>{if(c.autoWidth)return{width:void 0!==oe.value?`${String(oe.value).length+1}ch`:void 0}})),Me=e=>{switch(e.code){case"ArrowUp":ce.value&&(ve(),e.preventDefault());break;case"ArrowDown":ce.value&&(pe(),e.preventDefault())}d("keydown",e)};return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref($e))},[e.unref(y)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(N),class:"vv-input-text__label"},e.toDisplayString(e.unref(y)),9,U)):e.createCommentVNode("",!0),e.createElementVNode("div",j,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:le,class:"vv-input-text__inner",onClick:e.withModifiers(_e,["stop"])},[e.unref(be)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(he)),null,16)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(N),ref_key:"inputEl",ref:te},e.unref(xe),{style:e.unref(Ne),onKeyup:l[0]||(l[0]=e=>d("keyup",e)),onKeydown:Me,onKeypress:l[1]||(l[1]=e=>d("keypress",e))}),null,16,q),(t.unit||t.$slots.unit)&&e.unref(Le)?(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,W),e.unref(ge)||e.unref(Se)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(ge)?e.unref(he):e.unref(Se)),null,16)):e.unref(ue)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ie),{key:2,onTogglePassword:se})):e.unref(ce)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Oe),{key:3,onStepUp:ve,onStepDown:pe})):e.unref(me)&&!t.hideActions&&e.unref(we)?(e.openBlock(),e.createBlock(e.unref(Ve),{key:4,onClear:fe})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",X,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ye)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(Te),{id:e.unref(M),class:"vv-input-text__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(De))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
@@ -45,26 +45,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
45
45
|
type: StringConstructor;
|
|
46
46
|
default: string;
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
type:
|
|
48
|
+
iMask: {
|
|
49
|
+
type: globalThis.PropType<import("imask/esm/index").FactoryOpts>;
|
|
50
50
|
default: undefined;
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
type:
|
|
54
|
-
default: boolean;
|
|
55
|
-
};
|
|
56
|
-
maskReversed: {
|
|
57
|
-
type: BooleanConstructor;
|
|
58
|
-
default: boolean;
|
|
59
|
-
};
|
|
60
|
-
maskTokens: {
|
|
61
|
-
type: globalThis.PropType<import("maska").MaskTokens>;
|
|
52
|
+
masked: {
|
|
53
|
+
type: StringConstructor;
|
|
62
54
|
default: undefined;
|
|
63
55
|
};
|
|
64
|
-
maskTokensReplace: {
|
|
65
|
-
type: BooleanConstructor;
|
|
66
|
-
default: boolean;
|
|
67
|
-
};
|
|
68
56
|
autoWidth: {
|
|
69
57
|
type: BooleanConstructor;
|
|
70
58
|
default: boolean;
|
|
@@ -76,6 +64,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
76
64
|
unit: {
|
|
77
65
|
type: StringConstructor;
|
|
78
66
|
};
|
|
67
|
+
selectOnFocus: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
79
71
|
minlength: (StringConstructor | NumberConstructor)[];
|
|
80
72
|
maxlength: (StringConstructor | NumberConstructor)[];
|
|
81
73
|
placeholder: StringConstructor;
|
|
@@ -175,26 +167,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
175
167
|
type: StringConstructor;
|
|
176
168
|
default: string;
|
|
177
169
|
};
|
|
178
|
-
|
|
179
|
-
type:
|
|
170
|
+
iMask: {
|
|
171
|
+
type: globalThis.PropType<import("imask/esm/index").FactoryOpts>;
|
|
180
172
|
default: undefined;
|
|
181
173
|
};
|
|
182
|
-
|
|
183
|
-
type:
|
|
184
|
-
default: boolean;
|
|
185
|
-
};
|
|
186
|
-
maskReversed: {
|
|
187
|
-
type: BooleanConstructor;
|
|
188
|
-
default: boolean;
|
|
189
|
-
};
|
|
190
|
-
maskTokens: {
|
|
191
|
-
type: globalThis.PropType<import("maska").MaskTokens>;
|
|
174
|
+
masked: {
|
|
175
|
+
type: StringConstructor;
|
|
192
176
|
default: undefined;
|
|
193
177
|
};
|
|
194
|
-
maskTokensReplace: {
|
|
195
|
-
type: BooleanConstructor;
|
|
196
|
-
default: boolean;
|
|
197
|
-
};
|
|
198
178
|
autoWidth: {
|
|
199
179
|
type: BooleanConstructor;
|
|
200
180
|
default: boolean;
|
|
@@ -206,6 +186,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
206
186
|
unit: {
|
|
207
187
|
type: StringConstructor;
|
|
208
188
|
};
|
|
189
|
+
selectOnFocus: {
|
|
190
|
+
type: BooleanConstructor;
|
|
191
|
+
default: boolean;
|
|
192
|
+
};
|
|
209
193
|
minlength: (StringConstructor | NumberConstructor)[];
|
|
210
194
|
maxlength: (StringConstructor | NumberConstructor)[];
|
|
211
195
|
placeholder: StringConstructor;
|
|
@@ -262,7 +246,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
262
246
|
disabled: boolean;
|
|
263
247
|
floating: boolean;
|
|
264
248
|
type: import("../VvInputText").InputType;
|
|
265
|
-
mask: string;
|
|
266
249
|
tabindex: string | number;
|
|
267
250
|
required: boolean;
|
|
268
251
|
iconPosition: "before" | "after";
|
|
@@ -284,12 +267,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
284
267
|
labelShowPassword: string;
|
|
285
268
|
labelHidePassword: string;
|
|
286
269
|
labelClear: string;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
maskTokens: import("maska").MaskTokens;
|
|
290
|
-
maskTokensReplace: boolean;
|
|
270
|
+
iMask: import("imask/esm/index").FactoryOpts;
|
|
271
|
+
masked: string;
|
|
291
272
|
autoWidth: boolean;
|
|
292
273
|
hideActions: boolean;
|
|
274
|
+
selectOnFocus: boolean;
|
|
293
275
|
count: string | boolean;
|
|
294
276
|
}, {}>, {
|
|
295
277
|
before?(_: {
|
|
@@ -329,25 +311,25 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
329
311
|
clear: () => void;
|
|
330
312
|
}): any;
|
|
331
313
|
hint?(_: {
|
|
332
|
-
modelValue:
|
|
314
|
+
modelValue: unknown;
|
|
333
315
|
valid: boolean;
|
|
334
316
|
invalid: boolean;
|
|
335
317
|
loading: boolean;
|
|
336
318
|
}): any;
|
|
337
319
|
loading?(_: {
|
|
338
|
-
modelValue:
|
|
320
|
+
modelValue: unknown;
|
|
339
321
|
valid: boolean;
|
|
340
322
|
invalid: boolean;
|
|
341
323
|
loading: boolean;
|
|
342
324
|
}): any;
|
|
343
325
|
valid?(_: {
|
|
344
|
-
modelValue:
|
|
326
|
+
modelValue: unknown;
|
|
345
327
|
valid: boolean;
|
|
346
328
|
invalid: boolean;
|
|
347
329
|
loading: boolean;
|
|
348
330
|
}): any;
|
|
349
331
|
invalid?(_: {
|
|
350
|
-
modelValue:
|
|
332
|
+
modelValue: unknown;
|
|
351
333
|
valid: boolean;
|
|
352
334
|
invalid: boolean;
|
|
353
335
|
loading: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FactoryOpts } from 'imask';
|
|
3
3
|
export declare const INPUT_TYPES: {
|
|
4
4
|
readonly TEXT: "text";
|
|
5
5
|
readonly PASSWORD: "password";
|
|
@@ -133,45 +133,20 @@ export declare const VvInputTextProps: {
|
|
|
133
133
|
default: string;
|
|
134
134
|
};
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @see https://
|
|
136
|
+
* iMask options
|
|
137
|
+
* @see https://imask.js.org/guide.html
|
|
138
138
|
*/
|
|
139
|
-
|
|
140
|
-
type:
|
|
139
|
+
iMask: {
|
|
140
|
+
type: PropType<FactoryOpts>;
|
|
141
141
|
default: undefined;
|
|
142
142
|
};
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
145
|
-
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
146
|
-
*/
|
|
147
|
-
maskEager: {
|
|
148
|
-
type: BooleanConstructor;
|
|
149
|
-
default: boolean;
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Write values reverse (ex. for numbers)
|
|
153
|
-
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
154
|
-
*/
|
|
155
|
-
maskReversed: {
|
|
156
|
-
type: BooleanConstructor;
|
|
157
|
-
default: boolean;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Add mask custom tokens
|
|
161
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
144
|
+
* Masked value
|
|
162
145
|
*/
|
|
163
|
-
|
|
164
|
-
type:
|
|
146
|
+
masked: {
|
|
147
|
+
type: StringConstructor;
|
|
165
148
|
default: undefined;
|
|
166
149
|
};
|
|
167
|
-
/**
|
|
168
|
-
* Replace default tokens
|
|
169
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
170
|
-
*/
|
|
171
|
-
maskTokensReplace: {
|
|
172
|
-
type: BooleanConstructor;
|
|
173
|
-
default: boolean;
|
|
174
|
-
};
|
|
175
150
|
/**
|
|
176
151
|
* Adjust input width to content
|
|
177
152
|
*/
|
|
@@ -192,6 +167,13 @@ export declare const VvInputTextProps: {
|
|
|
192
167
|
unit: {
|
|
193
168
|
type: StringConstructor;
|
|
194
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* Select input text on focus
|
|
172
|
+
*/
|
|
173
|
+
selectOnFocus: {
|
|
174
|
+
type: BooleanConstructor;
|
|
175
|
+
default: boolean;
|
|
176
|
+
};
|
|
195
177
|
minlength: (StringConstructor | NumberConstructor)[];
|
|
196
178
|
maxlength: (StringConstructor | NumberConstructor)[];
|
|
197
179
|
placeholder: StringConstructor;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { inject, defineComponent, ref, watch, computed, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, toRefs, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, createVNode, toHandlers } from "vue";
|
|
2
|
+
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
3
|
+
Strategy2["absolute"] = "absolute";
|
|
4
|
+
Strategy2["fixed"] = "fixed";
|
|
5
|
+
return Strategy2;
|
|
6
|
+
})(Strategy || {});
|
|
2
7
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
3
8
|
Side2["left"] = "left";
|
|
4
9
|
Side2["right"] = "right";
|
|
@@ -128,19 +133,15 @@ const ModifiersProps = {
|
|
|
128
133
|
placement: {
|
|
129
134
|
type: String,
|
|
130
135
|
default: Side.bottom,
|
|
131
|
-
validator: (value) =>
|
|
132
|
-
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
133
|
-
}
|
|
136
|
+
validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
|
|
134
137
|
},
|
|
135
138
|
/**
|
|
136
139
|
* Dropdown strategy
|
|
137
140
|
*/
|
|
138
141
|
strategy: {
|
|
139
142
|
type: String,
|
|
140
|
-
default:
|
|
141
|
-
validator: (value) =>
|
|
142
|
-
return ["fixed", "absolute"].includes(value);
|
|
143
|
-
}
|
|
143
|
+
default: void 0,
|
|
144
|
+
validator: (value) => Object.values(Strategy).includes(value)
|
|
144
145
|
},
|
|
145
146
|
/**
|
|
146
147
|
* Dropdown show / hide transition name
|
|
@@ -230,6 +231,13 @@ const ActionProps = {
|
|
|
230
231
|
type: String,
|
|
231
232
|
default: ButtonType.button,
|
|
232
233
|
validator: (value) => Object.values(ButtonType).includes(value)
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
* Button aria-label
|
|
237
|
+
*/
|
|
238
|
+
ariaLabel: {
|
|
239
|
+
type: String,
|
|
240
|
+
default: void 0
|
|
233
241
|
}
|
|
234
242
|
};
|
|
235
243
|
const VvNavProps = {
|
|
@@ -297,7 +305,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
297
305
|
const hasProps = computed(() => {
|
|
298
306
|
const toReturn = {
|
|
299
307
|
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
300
|
-
|
|
308
|
+
ariaPressed: pressed.value ? true : void 0,
|
|
309
|
+
ariaLabel: props.ariaLabel,
|
|
301
310
|
role: role == null ? void 0 : role.value
|
|
302
311
|
};
|
|
303
312
|
switch (hasTag.value) {
|
|
@@ -434,7 +443,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
434
443
|
current: unref(activeItem) == navItem.id,
|
|
435
444
|
disabled: navItem.disabled
|
|
436
445
|
}, "vv-nav__item-label"]
|
|
437
|
-
}, toHandlers(navItem.on
|
|
446
|
+
}, toHandlers(navItem.on), {
|
|
438
447
|
onClick: ($event) => onClick(navItem)
|
|
439
448
|
}), {
|
|
440
449
|
default: withCtx(() => [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvNav=t(e.vue)}(this,(function(e){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvNav=t(e.vue)}(this,(function(e){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),n=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(n||{}),l=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(l||{});const a=Symbol.for("volver"),i=Symbol.for("dropdownTrigger"),s=Symbol.for("dropdownAction"),u={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(l).includes(e)},rel:{type:String,default:"noopener noreferrer"}},d={disabled:Boolean},c={active:Boolean},v={pressed:Boolean},f={label:[String,Number]},p={modifiers:[String,Array]};o.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const m={...d,...f,...v,...c,...u,type:{type:String,default:r.button,validator:e=>Object.values(r).includes(e)},ariaLabel:{type:String,default:void 0}},b={...p,items:{type:Array,required:!0,default:()=>[]}},k=m;const y=e.defineComponent({name:"VvAction",props:k,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:r}){const l=t,u=e.inject(a),d=e.ref(null);o({$el:d});const{reference:c,bus:v,aria:f,expanded:p}=e.inject(i,{});e.watch((()=>d.value),(e=>{c&&(c.value=e)}));const m=e.computed((()=>l.pressed||(null==p?void 0:p.value))),{role:b}=e.inject(s,{}),k=e.computed((()=>{switch(!0){case l.disabled:return n.button;case void 0!==l.to:return(null==u?void 0:u.nuxt)?n.nuxtLink:n.routerLink;case void 0!==l.href:return n.a;default:return n.button}})),y=e.computed((()=>{const e={...null==f?void 0:f.value,ariaPressed:!!m.value||void 0,ariaLabel:l.ariaLabel,role:null==b?void 0:b.value};switch(k.value){case n.a:return{...e,href:l.href,target:l.target,rel:l.rel};case n.routerLink:case n.nuxtLink:return{...e,to:l.to,target:l.target};default:return{...e,type:l.type,disabled:l.disabled}}})),g=e=>{l.disabled?e.preventDefault():(null==v||v.emit("click",e),r("click",e))},_=e=>{null==v||v.emit("mouseover",e),r("mouseover",e)},B=e=>{null==v||v.emit("mouseleave",e),r("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k)),e.mergeProps(e.unref(y),{ref_key:"element",ref:d,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled},onClickPassive:g,onMouseoverPassive:_,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});const g={class:"vv-nav__menu",role:"menu","aria-busy":"true"};return e.defineComponent({__name:"VvNav",props:b,emits:["click"],setup(t,{emit:o}){const r=t,{modifiers:n,items:l}=e.toRefs(r),a=e.ref(null),i=function(t,o,r){return e.computed((()=>{const n={[t]:!0},l="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{n[`${t}--${o}`]=e.unref(r.value[o])})),n}))}("vv-nav",n),s=e.computed((()=>l.value.map(((e,t)=>({...e,id:e.id||`nav-item_${t}`})))));return(t,r)=>(e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(e.unref(i))},[e.createElementVNode("ul",g,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),(t=>(e.openBlock(),e.createElementBlock("li",{key:t.id,class:"vv-nav__item",role:"presentation"},[e.createVNode(y,e.mergeProps({disabled:t.disabled,to:t.to,href:t.href,tabindex:0},{class:[{current:e.unref(a)==t.id,disabled:t.disabled},"vv-nav__item-label"]},e.toHandlers(t.on),{onClick:e=>{var r;(r=t).disabled||(o("click",r),a.value=r.id)}}),{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(t.title),1)])),_:2},1040,["class","onClick"])])))),128))])],2))}})}));
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { computed, unref, defineComponent, toRefs, openBlock, createElementBlock, mergeProps } from "vue";
|
|
2
|
+
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
3
|
+
Strategy2["absolute"] = "absolute";
|
|
4
|
+
Strategy2["fixed"] = "fixed";
|
|
5
|
+
return Strategy2;
|
|
6
|
+
})(Strategy || {});
|
|
2
7
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
3
8
|
Side2["left"] = "left";
|
|
4
9
|
Side2["right"] = "right";
|
|
@@ -114,19 +119,15 @@ const ModifiersProps = {
|
|
|
114
119
|
placement: {
|
|
115
120
|
type: String,
|
|
116
121
|
default: Side.bottom,
|
|
117
|
-
validator: (value) =>
|
|
118
|
-
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
119
|
-
}
|
|
122
|
+
validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
|
|
120
123
|
},
|
|
121
124
|
/**
|
|
122
125
|
* Dropdown strategy
|
|
123
126
|
*/
|
|
124
127
|
strategy: {
|
|
125
128
|
type: String,
|
|
126
|
-
default:
|
|
127
|
-
validator: (value) =>
|
|
128
|
-
return ["fixed", "absolute"].includes(value);
|
|
129
|
-
}
|
|
129
|
+
default: void 0,
|
|
130
|
+
validator: (value) => Object.values(Strategy).includes(value)
|
|
130
131
|
},
|
|
131
132
|
/**
|
|
132
133
|
* Dropdown show / hide transition name
|
|
@@ -216,6 +217,13 @@ const ModifiersProps = {
|
|
|
216
217
|
type: String,
|
|
217
218
|
default: ButtonType.button,
|
|
218
219
|
validator: (value) => Object.values(ButtonType).includes(value)
|
|
220
|
+
},
|
|
221
|
+
/**
|
|
222
|
+
* Button aria-label
|
|
223
|
+
*/
|
|
224
|
+
ariaLabel: {
|
|
225
|
+
type: String,
|
|
226
|
+
default: void 0
|
|
219
227
|
}
|
|
220
228
|
});
|
|
221
229
|
const VvProgressProps = {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { unref, inject, computed, toRef, toRefs, defineComponent, h, useSlots, ref, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode,
|
|
1
|
+
import { unref, inject, computed, toRef, toRefs, isRef, defineComponent, h, useSlots, ref, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelRadio, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps } from "vue";
|
|
2
2
|
import { nanoid } from "nanoid";
|
|
3
|
+
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
4
|
+
Strategy2["absolute"] = "absolute";
|
|
5
|
+
Strategy2["fixed"] = "fixed";
|
|
6
|
+
return Strategy2;
|
|
7
|
+
})(Strategy || {});
|
|
3
8
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
4
9
|
Side2["left"] = "left";
|
|
5
10
|
Side2["right"] = "right";
|
|
@@ -36,6 +41,7 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
36
41
|
AnchorTarget2["_top"] = "_top";
|
|
37
42
|
return AnchorTarget2;
|
|
38
43
|
})(AnchorTarget || {});
|
|
44
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
39
45
|
const INJECTION_KEY_RADIO_GROUP = Symbol.for("radioGroup");
|
|
40
46
|
const LinkProps = {
|
|
41
47
|
/**
|
|
@@ -172,19 +178,15 @@ const IdProps = {
|
|
|
172
178
|
placement: {
|
|
173
179
|
type: String,
|
|
174
180
|
default: Side.bottom,
|
|
175
|
-
validator: (value) =>
|
|
176
|
-
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
177
|
-
}
|
|
181
|
+
validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
|
|
178
182
|
},
|
|
179
183
|
/**
|
|
180
184
|
* Dropdown strategy
|
|
181
185
|
*/
|
|
182
186
|
strategy: {
|
|
183
187
|
type: String,
|
|
184
|
-
default:
|
|
185
|
-
validator: (value) =>
|
|
186
|
-
return ["fixed", "absolute"].includes(value);
|
|
187
|
-
}
|
|
188
|
+
default: void 0,
|
|
189
|
+
validator: (value) => Object.values(Strategy).includes(value)
|
|
188
190
|
},
|
|
189
191
|
/**
|
|
190
192
|
* Dropdown show / hide transition name
|
|
@@ -304,6 +306,13 @@ const CheckboxRadioProps = {
|
|
|
304
306
|
type: String,
|
|
305
307
|
default: ButtonType.button,
|
|
306
308
|
validator: (value) => Object.values(ButtonType).includes(value)
|
|
309
|
+
},
|
|
310
|
+
/**
|
|
311
|
+
* Button aria-label
|
|
312
|
+
*/
|
|
313
|
+
ariaLabel: {
|
|
314
|
+
type: String,
|
|
315
|
+
default: void 0
|
|
307
316
|
}
|
|
308
317
|
});
|
|
309
318
|
function equals(obj1, obj2, field) {
|
|
@@ -462,19 +471,27 @@ function joinLines(items) {
|
|
|
462
471
|
}
|
|
463
472
|
return items;
|
|
464
473
|
}
|
|
465
|
-
function HintSlotFactory(
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
474
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
475
|
+
const props = computed(() => {
|
|
476
|
+
if (isRef(propsOrRef)) {
|
|
477
|
+
return propsOrRef.value;
|
|
478
|
+
}
|
|
479
|
+
return propsOrRef;
|
|
480
|
+
});
|
|
481
|
+
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
482
|
+
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
483
|
+
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
484
|
+
const hintLabel = computed(() => props.value.hintLabel);
|
|
470
485
|
const hasLoadingLabelOrSlot = computed(
|
|
471
|
-
() => Boolean(props.loading && (slots.loading || loadingLabel.value))
|
|
486
|
+
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
472
487
|
);
|
|
473
488
|
const hasInvalidLabelOrSlot = computed(
|
|
474
|
-
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
489
|
+
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
490
|
+
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
491
|
+
)
|
|
475
492
|
);
|
|
476
493
|
const hasValidLabelOrSlot = computed(
|
|
477
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
|
|
494
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
478
495
|
);
|
|
479
496
|
const hasHintLabelOrSlot = computed(
|
|
480
497
|
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
@@ -483,10 +500,10 @@ function HintSlotFactory(props, slots) {
|
|
|
483
500
|
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
484
501
|
);
|
|
485
502
|
const hintSlotScope = computed(() => ({
|
|
486
|
-
modelValue: props.modelValue,
|
|
487
|
-
valid: props.valid,
|
|
488
|
-
invalid: props.invalid,
|
|
489
|
-
loading: props.loading
|
|
503
|
+
modelValue: props.value.modelValue,
|
|
504
|
+
valid: props.value.valid,
|
|
505
|
+
invalid: props.value.invalid,
|
|
506
|
+
loading: props.value.loading
|
|
490
507
|
}));
|
|
491
508
|
const HintSlot = defineComponent({
|
|
492
509
|
name: "HintSlot",
|
|
@@ -566,6 +583,62 @@ function HintSlotFactory(props, slots) {
|
|
|
566
583
|
HintSlot
|
|
567
584
|
};
|
|
568
585
|
}
|
|
586
|
+
function useVolver() {
|
|
587
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
588
|
+
}
|
|
589
|
+
function useDefaults(componentName, propsDefinition, props) {
|
|
590
|
+
const volver = useVolver();
|
|
591
|
+
const volverComponentDefaults = computed(() => {
|
|
592
|
+
var _a;
|
|
593
|
+
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
594
|
+
return void 0;
|
|
595
|
+
}
|
|
596
|
+
return volver.defaults.value[componentName];
|
|
597
|
+
});
|
|
598
|
+
return computed(() => {
|
|
599
|
+
if (volverComponentDefaults.value === void 0) {
|
|
600
|
+
return props;
|
|
601
|
+
}
|
|
602
|
+
const componentDefaults = volverComponentDefaults.value;
|
|
603
|
+
const simplifiedPropsDefinition = propsDefinition;
|
|
604
|
+
const simplifiedProps = props;
|
|
605
|
+
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
606
|
+
const propValue = simplifiedProps[key];
|
|
607
|
+
acc[key] = propValue;
|
|
608
|
+
if (key in componentDefaults) {
|
|
609
|
+
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
610
|
+
const typeArray = simplifiedPropsDefinition[key];
|
|
611
|
+
if (typeArray.length) {
|
|
612
|
+
const typeFunction = typeArray[0];
|
|
613
|
+
if (typeFunction === propValue) {
|
|
614
|
+
acc[key] = componentDefaults[key];
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
619
|
+
const typeFunction = simplifiedPropsDefinition[key];
|
|
620
|
+
if (typeFunction() === propValue) {
|
|
621
|
+
acc[key] = componentDefaults[key];
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
625
|
+
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
626
|
+
if (typeof defaultValue === "function") {
|
|
627
|
+
defaultValue = defaultValue();
|
|
628
|
+
}
|
|
629
|
+
if (typeof defaultValue === "object") {
|
|
630
|
+
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
631
|
+
acc[key] = componentDefaults[key];
|
|
632
|
+
}
|
|
633
|
+
} else if (defaultValue === propValue) {
|
|
634
|
+
acc[key] = componentDefaults[key];
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return acc;
|
|
639
|
+
}, {});
|
|
640
|
+
});
|
|
641
|
+
}
|
|
569
642
|
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
570
643
|
function useModifiers(prefix, modifiers, others) {
|
|
571
644
|
return computed(() => {
|
|
@@ -602,6 +675,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
602
675
|
setup(__props, { emit }) {
|
|
603
676
|
const props = __props;
|
|
604
677
|
const slots = useSlots();
|
|
678
|
+
const propsDefaults = useDefaults(
|
|
679
|
+
"VvRadio",
|
|
680
|
+
VvRadioProps,
|
|
681
|
+
props
|
|
682
|
+
);
|
|
605
683
|
const { id, disabled, readonly, modelValue, valid, invalid } = useGroupProps(props, emit);
|
|
606
684
|
const hasId = useUniqueId(id);
|
|
607
685
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
@@ -652,7 +730,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
652
730
|
hasHintLabelOrSlot,
|
|
653
731
|
hasInvalidLabelOrSlot,
|
|
654
732
|
hintSlotScope
|
|
655
|
-
} = HintSlotFactory(
|
|
733
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
656
734
|
return (_ctx, _cache) => {
|
|
657
735
|
return openBlock(), createElementBlock("label", {
|
|
658
736
|
class: normalizeClass(unref(bemCssClasses)),
|