@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1
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/LICENSE +1 -1
- package/README.md +54 -15
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +23 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +338 -0
- package/dist/components/VvAction/VvAction.umd.js +1 -0
- package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
- package/dist/components/VvAction/index.d.ts +24 -0
- package/dist/components/VvBadge/VvBadge.es.js +251 -22
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +720 -261
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
- package/dist/components/VvButton/index.d.ts +30 -75
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +60 -28
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckbox/index.d.ts +6 -6
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
- package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
- package/dist/components/VvCombobox/index.d.ts +54 -23
- package/dist/components/VvDialog/VvDialog.es.js +426 -115
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
- package/dist/components/VvDropdown/index.d.ts +35 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
- package/dist/components/VvIcon/VvIcon.es.js +116 -52
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +1054 -376
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +67 -3
- package/dist/components/VvProgress/VvProgress.es.js +254 -23
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +568 -137
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
- package/dist/components/VvRadioGroup/index.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +703 -251
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
- package/dist/components/VvSelect/index.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
- package/dist/components/VvTextarea/index.d.ts +7 -7
- package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3676 -2007
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +30 -0
- package/dist/directives/index.es.js +288 -0
- package/dist/directives/index.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +285 -0
- package/dist/directives/v-tooltip.umd.js +1 -0
- package/dist/icons.es.js +38 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +115 -3269
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +215 -23
- package/dist/resolvers/unplugin.d.ts +14 -8
- package/dist/resolvers/unplugin.es.js +94 -33
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +1 -1
- package/package.json +167 -63
- package/src/Volver.ts +60 -26
- 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/VvAccordion/VvAccordion.vue +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +144 -0
- package/src/components/VvAction/index.ts +5 -0
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +41 -124
- package/src/components/VvButton/index.ts +16 -88
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +85 -57
- package/src/components/VvCombobox/index.ts +12 -10
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +6 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
- package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
- package/src/components/VvDropdown/index.ts +6 -11
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +128 -35
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +3 -5
- package/src/components/VvTextarea/VvTextarea.vue +4 -4
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +9 -11
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +8 -9
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/constants.ts +36 -0
- package/src/directives/index.ts +1 -1
- package/src/directives/v-tooltip.ts +2 -2
- package/src/index.ts +0 -2
- package/src/props/index.ts +111 -19
- package/src/resolvers/unplugin.ts +96 -49
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
- package/src/stories/Button/Button.stories.mdx +4 -2
- package/src/stories/Button/Button.test.ts +3 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
- package/src/stories/Button/ButtonState.stories.mdx +2 -11
- package/src/stories/Card/Card.stories.mdx +2 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
- package/src/stories/Combobox/Combobox.settings.ts +44 -0
- package/src/stories/Combobox/Combobox.stories.mdx +40 -1
- package/src/stories/Dialog/Dialog.stories.mdx +2 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
- package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
- package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
- package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
- package/src/stories/Icon/Icon.stories.mdx +2 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +42 -1
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Progress/Progress.stories.mdx +2 -1
- package/src/stories/Radio/Radio.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
- package/src/stories/Select/Select.stories.mdx +2 -1
- package/src/stories/Textarea/Textarea.stories.mdx +2 -1
- package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
- package/src/stories/argTypes.ts +2 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,y){typeof exports=="object"&&typeof module<"u"?module.exports=y(require("vue"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue"],y):(e=typeof globalThis<"u"?globalThis:e||self,e.VvInputText=y(e.vue,e.vue$1))})(this,function(e,y){"use strict";function D(o){return Array.isArray(o)?o.filter(s=>isString(s)).join(" "):o}function G(o,s){const{invalid:t,valid:r,hint:d,loading:f}=s,{hintLabel:c,modelValue:I,valid:v,validLabel:m,invalid:i,invalidLabel:a,...b}=toRefs(o),u=resolveFieldData(b,"loading"),S=resolveFieldData(b,"loadingLabel"),w=computed(()=>i.value?!!(i.value&&t||a!=null&&a.value&&Array.isArray(a.value)&&a.value.length>0||a!=null&&a.value&&!isEmpty(a)):!1),T=computed(()=>!!(c&&c.value||d)),g=computed(()=>!!(m&&m.value||r)),P=computed(()=>!!(u!=null&&u.value&&f||u!=null&&u.value&&(S!=null&&S.value))),R=computed(()=>T.value||g.value||w.value||P.value);return{hasInvalid:w,hasHint:T,hasValid:g,hasLoading:P,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(_){const B=computed(()=>{const C=toReactive({hintLabel:c,modelValue:I,valid:v,validLabel:m,invalid:i,invalidLabel:a,loading:u,loadingLabel:S,..._.params});return i!=null&&i.value?(t==null?void 0:t(C))||D(a==null?void 0:a.value)||(c==null?void 0:c.value):v!=null&&v.value?(r==null?void 0:r(C))||D(m==null?void 0:m.value)||(c==null?void 0:c.value):u!=null&&u.value?(f==null?void 0:f(C))||D(S==null?void 0:S.value)||(c==null?void 0:c.value):(d==null?void 0:d(C))||D(c==null?void 0:c.value)||(c==null?void 0:c.value)});return{isVisible:R,hasInvalid:w,hasValid:g,hintContent:B}},render(){if(this.isVisible)return h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}const Q={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]}},Z={name:"VvIcon"},E=e.defineComponent({...Z,props:Q,setup(o){const s=o,t=ref(!0),r=useVolver(),{modifiers:d}=toRefs(s),f=useBemModifiers("vv-icon",d),c=computed(()=>s.provider||(r==null?void 0:r.provider)),I=computed(()=>{const i=s.name??"",a=`@${c.value}:${s.prefix}:${s.name}`;return y.iconExists(i)?i:y.iconExists(a)?a:(r==null?void 0:r.iconsCollections.find(b=>{const u=`@${c.value}:${b.prefix}:${i}`;if(y.iconExists(u))return u}))||i});function v(i){let a=null;if(typeof window>"u"){const{JSDOM:w}=require("jsdom");a=new w().window}return(a?new a.DOMParser:new window.DOMParser).parseFromString(i,"text/html").querySelector("svg")}function m(i){const a=v(i),b=(a==null?void 0:a.innerHTML.trim())||"";a&&b&&y.addIcon(`@${c.value}:${s.prefix}:${s.name}`,{body:b,height:a.viewBox.baseVal.height,width:a.viewBox.baseVal.width})}return r&&(s.src&&!y.iconExists(`@${c.value}:${s.prefix}:${s.name}`)?(t.value=!1,r.fetchIcon(s.src).then(i=>{i&&(m(i),t.value=!0)}).catch(i=>{throw new Error(`During fetch icon: ${i==null?void 0:i.message}`)})):s.svg&&m(s.svg)),(i,a)=>e.unref(t)?(e.openBlock(),e.createBlock(e.unref(y.Icon),e.mergeProps({key:0,class:e.unref(f)},{inline:i.inline,width:i.width,height:i.height,horizontalFlip:i.horizontalFlip,verticalFlip:i.verticalFlip,flip:i.flip,rotate:i.rotate,color:i.color,onLoad:i.onLoad,icon:e.unref(I)}),null,16,["class"])):e.createCommentVNode("",!0)}});var k=(o=>(o.left="left",o.right="right",o.top="top",o.bottom="bottom",o))(k||{}),W=(o=>(o.topStart="top-start",o.topEnd="top-end",o.bottomStart="bottom-start",o.bottomEnd="bottom-end",o.leftStart="left-start",o.leftEnd="left-end",o.rightStart="right-start",o.rightEnd="right-end",o))(W||{}),V=(o=>(o.before="before",o.after="after",o))(V||{});const ee={valid:Boolean,validLabel:[String,Array]},te={invalid:Boolean,invalidLabel:[String,Array]},oe={loading:Boolean,loadingLabel:String},ne={disabled:Boolean},se={readonly:Boolean},ie={modifiers:[String,Array]},ae={hintLabel:{type:String,default:""}},re={count:{type:[Boolean,String],default:!1,validator:o=>[!0,!1,"limit","countdown"].includes(o)}},le={debounce:[Number,String]},ce={icon:{type:[String,Object]},iconPosition:{type:String,default:V.before,validation:o=>Object.values(V).includes(o)}},de={tabindex:{type:[String,Number],default:0}},ue={floating:Boolean},pe={id:[String,Number]};k.bottom;const fe={...{...pe,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...de,...ne,...se,...ee,...te,...ae,...oe,...ie,...re,...le,...ce,...ue,minlength:Number,maxlength:Number,placeholder:String,required:Boolean,label:String},n={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"},A={PASSWORD_SHOW:"eye-on",PASSWORD_HIDE:"eye-off",DATE:"calendar",TIME:"time",COLOR:"color",SEARCH:"close"},me=["update:modelValue","focus","blur","keyup"],he={...fe,modelValue:[String,Number],type:{type:String,default:n.TEXT,validator:o=>Object.values(n).includes(o)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:A.PASSWORD_SHOW},iconHidePassword:{type:String,default:A.PASSWORD_HIDE},iconClear:{type:String,default:A.SEARCH},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"}},$=defineComponent({components:{VvIcon:E},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:A.PASSWORD_SHOW},iconHide:{type:String,default:A.PASSWORD_HIDE}},emits:["toggle-password"],setup(o,{emit:s}){const t=ref(!1),r=computed(()=>t.value?o.iconHide:o.iconShow);function d(f){f==null||f.stopPropagation(),o.disabled||(t.value=!t.value,s("toggle-password",t.value))}return{active:t,activeIcon:r,onClick:d}},render(){const o=h(E,{name:this.activeIcon,class:"vv-input-text__action-icon"});return h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},o)}}),O=defineComponent({components:{VvIcon:E},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:o=>["up","down"].includes(o),default:"up"}},emits:["step-up","step-down"],setup(o,{emit:s}){const t=computed(()=>o.mode==="up");return{isUp:t,onClick:d=>{d==null||d.stopPropagation(),o.disabled||s(t.value?"step-up":"step-down")}}},render(){return h("button",{class:["vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,onClick:this.onClick})}}),F=defineComponent({components:{VvIcon:E},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup(o,{emit:s}){function t(r){r==null||r.stopPropagation(),o.disabled||s("clear")}return{onClick:t}},render(){const o=h(E,{name:this.icon,class:"vv-input-text__action-icon"});return h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},o)}});function x(o,s){return{name:"VvInputTextActions",components:{VvIcon:E,VvInputPasswordAction:$,VvInputStepAction:O,VvInputClearAction:F},setup(){return{isDisabled:computed(()=>s.disabled||s.readonly),labelStepUp:s.labelStepUp,labelStepDown:s.labelStepDown,labelShowPassword:s.labelShowPassword,labelHidePassword:s.labelHidePassword,labelClear:s.labelClear,iconShowPassword:s.iconShowPassword,iconHidePassword:s.iconHidePassword}},render(){let t=null;switch(o){case n.SEARCH:{const{onClear:r}=this.$attrs;t=[h(F,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:r})];break}case n.PASSWORD:{const{onTogglePassword:r}=this.$attrs;t=[h($,{disabled:this.isDisabled,onTogglePassword:r,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case n.NUMBER:{const{onStepUp:r,onStepDown:d}=this.$attrs;t=[h(O,{mode:"up",disabled:this.isDisabled||s.max!==void 0&&s.modelValue===s.max,label:this.labelStepUp,onStepUp:r,onStepDown:d}),h(O,{mode:"down",disabled:this.isDisabled||s.min!==void 0&&s.modelValue===s.min,label:this.labelStepDown,onStepUp:r,onStepDown:d})];break}}return Array.isArray(t)?h("div",{class:"vv-input-text__actions-group"},t):t}}}const Se=["for"],be={class:"vv-input-text__wrapper"},ge={key:0,class:"vv-input-text__input-before"},ye={class:"vv-input-text__inner"},ve=["id"],we={key:1,class:"vv-input-text__input-after"},Ee={key:2,class:"vv-input-text__limit"},Ae={name:"VvInputText"};return e.defineComponent({...Ae,props:he,emits:me,setup(o,{emit:s}){const t=o,r=useSlots(),d=ref(),{id:f,icon:c,iconPosition:I,label:v,modelValue:m,count:i,valid:a,invalid:b,loading:u}=toRefs(t),S=useUniqueId(f),w=computed(()=>`${S.value}-hint`),T=computed(()=>t.floating&&isEmpty(t.placeholder)?" ":t.placeholder),g=useDebouncedInput(m,s,t.debounce),{focused:P}=useComponentFocus(d,s),R=useElementVisibility(d);watch(R,l=>{l&&t.autofocus&&(P.value=!0)});const _=ref(!1),B=computed(()=>t.type===n.PASSWORD),C=()=>{_.value=!_.value},Ce=computed(()=>t.type===n.TIME||t.type===n.DATETIME_LOCAL||t.type===n.DATE||t.type===n.WEEK||t.type===n.MONTH),Pe=computed(()=>t.type===n.NUMBER),j=()=>{M.value&&(d.value.stepUp(),g.value=unref(d).value)},q=()=>{M.value&&(d.value.stepDown(),g.value=unref(d).value)},Ie=computed(()=>t.type===n.SEARCH),z=()=>{g.value=void 0},{hasIcon:X,hasIconBefore:K,hasIconAfter:N}=useComponentIcon(c,I),H=computed(()=>{switch(t.type){case n.COLOR:return{name:A.COLOR};case n.DATE:case n.DATETIME_LOCAL:case n.WEEK:case n.MONTH:return{name:A.DATE};case n.TIME:return{name:A.TIME};default:return""}}),{formatted:_e}=useTextCount(g,{mode:t.count,upperLimit:t.maxlength,lowerLimit:t.minlength}),M=computed(()=>!t.disabled&&!t.readonly),De=computed(()=>M.value?t.tabindex:-1),Y=computed(()=>!isEmpty(m)),Te=computed(()=>{if(b.value===!0)return!0;if(a.value===!0)return!1}),{modifiers:Be}=toRefs(t),ke=useBemModifiers("vv-input-text",Be,computed(()=>({valid:a.value,invalid:b.value,loading:u.value,disabled:t.disabled,readonly:t.readonly,"icon-before":K.value,"icon-after":N.value||!isEmpty(H),floating:t.floating&&!isEmpty(t.label),dirty:Y.value,focus:P.value}))),Ve=computed(()=>{const l=(()=>B.value&&_.value||Ce.value&&!Y.value&&!P.value?n.TEXT:t.type)(),p={type:l,name:t.name,tabindex:De.value,disabled:t.disabled,readonly:t.readonly,required:t.required,autocomplete:t.autocomplete,"aria-invalid":Te.value,"aria-describedby":!J.value&&xe.value?w.value:void 0,"aria-errormessage":J.value?w.value:void 0};return(l===n.DATE||l===n.MONTH||l===n.WEEK||l===n.TIME||l===n.DATETIME_LOCAL||l===n.NUMBER)&&(p.step=t.step,p.max=String(t.max),p.min=String(t.min)),(l===n.TEXT||l===n.SEARCH||l===n.URL||l===n.TEL||l===n.EMAIL||l===n.PASSWORD||l===n.NUMBER)&&(p.placeholder=T.value),(l===n.TEXT||l===n.SEARCH||l===n.URL||l===n.TEL||l===n.EMAIL||l===n.PASSWORD)&&(p.minlength=t.minlength,p.maxlength=t.maxlength,p.pattern=t.pattern),l===n.EMAIL&&(p.multiple=t.multiple),p}),L=computed(()=>({valid:t.valid,invalid:t.invalid,modelValue:t.modelValue,togglePassword:C,stepUp:j,stepDown:q,clear:z})),{HintSlot:Oe,hasHint:xe,hasInvalid:J}=G(t,r),Re=x(n.PASSWORD,t),Ne=x(n.NUMBER,t),He=x(n.SEARCH,t);return(l,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ke))},[e.unref(v)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(S),class:"vv-input-text__label"},e.toDisplayString(e.unref(v)),9,Se)):e.createCommentVNode("",!0),e.createElementVNode("div",be,[l.$slots.before?(e.openBlock(),e.createElementBlock("div",ge,[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])):e.createCommentVNode("",!0),e.createElementVNode("div",ye,[e.unref(K)?(e.openBlock(),e.createBlock(E,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(X)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(S),ref_key:"input",ref:d,"onUpdate:modelValue":p[0]||(p[0]=U=>e.isRef(g)?g.value=U:null)},e.unref(Ve),{onKeyup:p[1]||(p[1]=U=>s("keyup",U))}),null,16,ve),[[e.vModelDynamic,e.unref(g)]]),e.unref(N)||e.unref(H)?(e.openBlock(),e.createBlock(E,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(N)?e.unref(X):e.unref(H)),null,16)):e.unref(B)?(e.openBlock(),e.createBlock(e.unref(Re),{key:2,onTogglePassword:C})):e.unref(Pe)?(e.openBlock(),e.createBlock(e.unref(Ne),{key:3,onStepUp:j,onStepDown:q})):e.unref(Ie)?(e.openBlock(),e.createBlock(e.unref(He),{key:4,onClear:z})):e.createCommentVNode("",!0)]),l.$slots.after?(e.openBlock(),e.createElementBlock("div",we,[e.renderSlot(l.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(L))))])):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createElementBlock("span",Ee,[e.renderSlot(l.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(L))),()=>[e.createTextVNode(e.toDisplayString(e.unref(_e)),1)])])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(Oe),{id:e.unref(w),class:"vv-input-text__hint"},null,8,["id"])],2))}})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("maska"),require("@vueuse/core"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","maska","@vueuse/core","@iconify/vue","nanoid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.maska,e.core,e.vue$1,e.nanoid)}(this,(function(e,t,o,l,n){"use strict";function a(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const o=t.split(".");let l=e;for(let t=0,n=o.length;t<n;++t){if(null==e)return null;l=l[o[t]]}return l}}return null}function i(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 r(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const u={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 d=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(d||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),c=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(c||{});const p=Symbol.for("volver");function v(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 m=e.defineComponent({name:"VvIcon",props:u,setup(t){const o=t,n=e.ref(!0),a=e.inject(p),{modifiers:i}=e.toRefs(o),r=v("vv-icon",i),u=e.computed((()=>o.provider||(null==a?void 0:a.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${u.value}:${o.prefix}:${o.name}`;return l.iconExists(e)?e:l.iconExists(t)?t:(null==a?void 0:a.iconsCollections.find((t=>{const o=`@${u.value}:${t.prefix}:${e}`;if(l.iconExists(o))return o})))||e}));function s(e){const t=function(e){let t=null;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&&l.addIcon(`@${u.value}:${o.prefix}:${o.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return a&&(o.src&&!l.iconExists(`@${u.value}:${o.prefix}:${o.name}`)?(n.value=!1,a.fetchIcon(o.src).then((e=>{e&&(s(e),n.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):o.svg&&s(o.svg)),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(r)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:t.rotate,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},y=(Boolean,Boolean,{label:[String,Number]}),S={readonly:Boolean},w={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},B={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},E={debounce:[Number,String]},x={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},T={tabindex:{type:[String,Number],default:0}},L={floating:Boolean},A={id:[String,Number]};d.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const C={...{...A,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...T,...g,...S,...f,...h,...k,...b,...w,...B,...E,...x,...L,...y,minlength:Number,maxlength:Number,placeholder:String,required:Boolean};c.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"},I="eye-on",V="eye-off",_="calendar",D="time",R="color",N="close",$={...C,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:I},iconHidePassword:{type:String,default:V},iconClear:{type:String,default:N},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}},H=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:I},iconHide:{type:String,default:V}},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(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: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})}}),O=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(o){null==o||o.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 U(t,o){return{name:"VvInputTextActions",components:{VvIcon:m,VvInputPasswordAction:H,VvInputStepAction:M,VvInputClearAction:O},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 P.SEARCH:{const{onClear:t}=this.$attrs;l=[e.h(O,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case P.PASSWORD:{const{onTogglePassword:t}=this.$attrs;l=[e.h(H,{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:n}=this.$attrs;l=[e.h(M,{mode:"up",disabled:this.isDisabled||void 0!==o.max&&o.modelValue===o.max,label:this.labelStepUp,onStepUp:t,onStepDown:n}),e.h(M,{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 j=["for"],W={class:"vv-input-text__wrapper"},q={key:0,class:"vv-input-text__input-before"},F=["onClick"],z=["id"],X={key:1,class:"vv-input-text__unit"},K={key:5,class:"vv-input-text__input-after"},J={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:$,emits:["update:modelValue","focus","blur","keyup"],setup(l,{expose:u,emit:c}){const p=l,f=e.useSlots(),h=e.ref(),b=e.ref();u({$inner:b});const{id:g,icon:y,iconPosition:S,label:w,modelValue:k,count:B,valid:E,invalid:x,loading:T}=e.toRefs(p),L=(t=>e.computed((()=>String((null==t?void 0:t.value)||n.nanoid()))))(g),A=e.computed((()=>`${L.value}-hint`)),C=e.computed((()=>p.floating&&i(p.placeholder)?" ":p.placeholder)),I=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)}})}(k,c,p.debounce,{getter:e=>we.value?we.value.masked(e??""):e,setter:e=>(we.value&&(e=we.value.unmasked(e)),p.type===P.NUMBER?Number(e):e)}),{focused:V}=function(t,l){const{focused:n}=o.useFocus(t);return e.watch(n,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:n}}(h,c),N=e.computed((()=>V.value&&!p.disabled&&!p.readonly)),$=o.useElementVisibility(h);e.watch($,(e=>{e&&p.autofocus&&!p.disabled&&!p.readonly&&(V.value=!0)}));const H=e.ref(!1),M=e.computed((()=>p.type===P.PASSWORD)),O=()=>{H.value=!H.value},G=e.computed((()=>p.type===P.TIME||p.type===P.DATETIME_LOCAL||p.type===P.DATE||p.type===P.WEEK||p.type===P.MONTH)),Q=e.computed((()=>p.type===P.NUMBER)),Y=()=>{re.value&&(h.value.stepUp(),I.value=e.unref(h).value)},Z=()=>{re.value&&(h.value.stepDown(),I.value=e.unref(h).value)},ee=e.computed((()=>p.type===P.SEARCH)),te=()=>{I.value=void 0},{hasIcon:oe,hasIconBefore:le,hasIconAfter:ne}=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===d.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.top))),u=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.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:u,hasIconBefore:l,hasIconAfter:n}}(y,S),ae=e.computed((()=>{switch(p.type){case P.COLOR:return{name:R};case P.DATE:case P.DATETIME_LOCAL:case P.WEEK:case P.MONTH:return{name:_};case P.TIME:return{name:D};default:return""}})),{formatted:ie}=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}}(I,{mode:p.count,upperLimit:p.maxlength,lowerLimit:p.minlength}),re=e.computed((()=>!p.disabled&&!p.readonly)),ue=e.computed((()=>re.value?p.tabindex:-1)),de=e.computed((()=>!i(k))),se=e.computed((()=>!0===x.value||!0!==E.value&&void 0)),{modifiers:ce}=e.toRefs(p),pe=v("vv-input-text",ce,e.computed((()=>({valid:E.value,invalid:x.value,loading:T.value,disabled:p.disabled,readonly:p.readonly,"icon-before":le.value,"icon-after":ne.value||!i(ae),floating:p.floating&&!i(p.label),dirty:de.value,focus:N.value,"auto-width":p.autoWidth})))),ve=e.computed((()=>{const e=M.value&&H.value?P.TEXT:!G.value||de.value||V.value?p.type:P.TEXT,t={type:e,name:p.name,tabindex:ue.value,disabled:p.disabled,readonly:p.readonly,required:p.required,autocomplete:p.autocomplete,"aria-invalid":se.value,"aria-describedby":!be.value&&he.value?A.value:void 0,"aria-errormessage":be.value?A.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=p.step,t.max=void 0!==p.max?String(p.max):void 0,t.min=void 0!==p.min?String(p.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=C.value),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD||(t.minlength=p.minlength,t.maxlength=p.maxlength,t.pattern=p.pattern),e===P.EMAIL&&(t.multiple=p.multiple),t})),me=e.computed((()=>({valid:p.valid,invalid:p.invalid,modelValue:p.modelValue,togglePassword:O,stepUp:Y,stepDown:Z,clear:te}))),{HintSlot:fe,hasHint:he,hasInvalid:be}=function(t,l){const{invalid:n,valid:u,hint:d,loading:s}=l,{hintLabel:c,modelValue:p,valid:v,validLabel:m,invalid:f,invalidLabel:h,...b}=e.toRefs(t),g=a(b,"loading"),y=a(b,"loadingLabel"),S=e.computed((()=>!(!f.value||(!f.value||!n)&&!((null==h?void 0:h.value)&&Array.isArray(h.value)&&h.value.length>0)&&(!(null==h?void 0:h.value)||i(h))))),w=e.computed((()=>!!(c&&c.value||d))),k=e.computed((()=>!!(m&&m.value||u))),B=e.computed((()=>!!((null==g?void 0:g.value)&&s||(null==g?void 0:g.value)&&(null==y?void 0:y.value)))),E=e.computed((()=>w.value||k.value||S.value||B.value));return{hasInvalid:S,hasHint:w,hasValid:k,hasLoading:B,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(t){const l=e.computed((()=>{const e=o.toReactive({hintLabel:c,modelValue:p,valid:v,validLabel:m,invalid:f,invalidLabel:h,loading:g,loadingLabel:y,...t.params});return(null==f?void 0:f.value)?(null==n?void 0:n(e))||r(null==h?void 0:h.value)||(null==c?void 0:c.value):(null==v?void 0:v.value)?(null==u?void 0:u(e))||r(null==m?void 0:m.value)||(null==c?void 0:c.value):(null==g?void 0:g.value)?(null==s?void 0:s(e))||r(null==y?void 0:y.value)||(null==c?void 0:c.value):(null==d?void 0:d(e))||r(null==c?void 0:c.value)||(null==c?void 0:c.value)}));return{isVisible:E,hasInvalid:S,hasValid:k,hintContent:l}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}(p,f),ge=U(P.PASSWORD,p),ye=U(P.NUMBER,p),Se=U(P.SEARCH,p),we=e.ref();e.watch([()=>p.mask,()=>p.type,()=>p.maskEager,()=>p.maskReversed,()=>p.maskTokens,()=>p.maskTokensReplace],(([e,o,l,n,a,i])=>{e&&o===P.TEXT?we.value=new t.Mask({mask:e,eager:l,reversed:n,tokens:a,tokensReplace:i}):we.value=void 0}),{immediate:!0});const ke=()=>{re.value&&(V.value=!0)},Be=e.computed((()=>{if(p.autoWidth)return{width:void 0!==I.value?`${String(I.value).length+1}ch`:void 0}}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(pe))},[e.unref(w)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(L),class:"vv-input-text__label"},e.toDisplayString(e.unref(w)),9,j)):e.createCommentVNode("",!0),e.createElementVNode("div",W,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(me))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:b,class:"vv-input-text__inner",onClick:e.withModifiers(ke,["stop"])},[e.unref(le)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(oe)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(L),ref_key:"inputEl",ref:h,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(I)?I.value=t:null)},e.unref(ve),{style:e.unref(Be),onKeyup:o[1]||(o[1]=e=>c("keyup",e))}),null,16,z),[[e.vModelDynamic,e.unref(I)]]),(t.unit||t.$slots.unit)&&e.unref(de)?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(me))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,F),e.unref(ne)||e.unref(ae)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(ne)?e.unref(oe):e.unref(ae)),null,16)):e.unref(M)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(ge),{key:2,onTogglePassword:O})):e.unref(Q)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(ye),{key:3,onStepUp:Y,onStepDown:Z})):e.unref(ee)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(Se),{key:4,onClear:te})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(me))))])):e.createCommentVNode("",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",J,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(me))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ie)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(fe),{id:e.unref(A),class:"vv-input-text__hint"},null,8,["id"])],2))}})}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
2
2
|
modelValue: (StringConstructor | NumberConstructor)[];
|
|
3
3
|
type: {
|
|
4
|
-
type:
|
|
4
|
+
type: globalThis.PropType<import("../VvInputText").InputType>;
|
|
5
5
|
default: "text";
|
|
6
|
-
validator: (value: import("
|
|
6
|
+
validator: (value: import("../VvInputText").InputType) => boolean;
|
|
7
7
|
};
|
|
8
8
|
min: (StringConstructor | DateConstructor | NumberConstructor)[];
|
|
9
9
|
max: (StringConstructor | DateConstructor | NumberConstructor)[];
|
|
@@ -45,19 +45,50 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
45
45
|
type: StringConstructor;
|
|
46
46
|
default: string;
|
|
47
47
|
};
|
|
48
|
+
mask: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
maskEager: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
56
|
+
maskReversed: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
maskTokens: {
|
|
61
|
+
type: globalThis.PropType<import("maska").MaskTokens>;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
maskTokensReplace: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
68
|
+
autoWidth: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
hideActions: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: boolean;
|
|
75
|
+
};
|
|
76
|
+
unit: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
};
|
|
48
79
|
minlength: NumberConstructor;
|
|
49
80
|
maxlength: NumberConstructor;
|
|
50
81
|
placeholder: StringConstructor;
|
|
51
82
|
required: BooleanConstructor;
|
|
52
|
-
label: StringConstructor;
|
|
83
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
53
84
|
floating: BooleanConstructor;
|
|
54
85
|
icon: {
|
|
55
86
|
type: (StringConstructor | ObjectConstructor)[];
|
|
56
87
|
};
|
|
57
88
|
iconPosition: {
|
|
58
|
-
type:
|
|
59
|
-
default: import("../../constants
|
|
60
|
-
validation: (value: import("../../constants
|
|
89
|
+
type: globalThis.PropType<"before" | "after">;
|
|
90
|
+
default: import("../../constants").Position;
|
|
91
|
+
validation: (value: import("../../constants").Position) => boolean;
|
|
61
92
|
};
|
|
62
93
|
debounce: (StringConstructor | NumberConstructor)[];
|
|
63
94
|
count: {
|
|
@@ -65,9 +96,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
65
96
|
default: boolean;
|
|
66
97
|
validator: (value: string) => boolean;
|
|
67
98
|
};
|
|
68
|
-
modifiers:
|
|
99
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
69
100
|
loading: BooleanConstructor;
|
|
70
|
-
loadingLabel:
|
|
101
|
+
loadingLabel: {
|
|
102
|
+
type: StringConstructor;
|
|
103
|
+
default: string;
|
|
104
|
+
};
|
|
71
105
|
hintLabel: {
|
|
72
106
|
type: StringConstructor;
|
|
73
107
|
default: string;
|
|
@@ -92,12 +126,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
92
126
|
required: boolean;
|
|
93
127
|
};
|
|
94
128
|
id: (StringConstructor | NumberConstructor)[];
|
|
95
|
-
}, {
|
|
129
|
+
}, {
|
|
130
|
+
$inner: globalThis.Ref<any>;
|
|
131
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
96
132
|
modelValue: (StringConstructor | NumberConstructor)[];
|
|
97
133
|
type: {
|
|
98
|
-
type:
|
|
134
|
+
type: globalThis.PropType<import("../VvInputText").InputType>;
|
|
99
135
|
default: "text";
|
|
100
|
-
validator: (value: import("
|
|
136
|
+
validator: (value: import("../VvInputText").InputType) => boolean;
|
|
101
137
|
};
|
|
102
138
|
min: (StringConstructor | DateConstructor | NumberConstructor)[];
|
|
103
139
|
max: (StringConstructor | DateConstructor | NumberConstructor)[];
|
|
@@ -139,19 +175,50 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
139
175
|
type: StringConstructor;
|
|
140
176
|
default: string;
|
|
141
177
|
};
|
|
178
|
+
mask: {
|
|
179
|
+
type: StringConstructor;
|
|
180
|
+
default: undefined;
|
|
181
|
+
};
|
|
182
|
+
maskEager: {
|
|
183
|
+
type: BooleanConstructor;
|
|
184
|
+
default: boolean;
|
|
185
|
+
};
|
|
186
|
+
maskReversed: {
|
|
187
|
+
type: BooleanConstructor;
|
|
188
|
+
default: boolean;
|
|
189
|
+
};
|
|
190
|
+
maskTokens: {
|
|
191
|
+
type: globalThis.PropType<import("maska").MaskTokens>;
|
|
192
|
+
default: undefined;
|
|
193
|
+
};
|
|
194
|
+
maskTokensReplace: {
|
|
195
|
+
type: BooleanConstructor;
|
|
196
|
+
default: boolean;
|
|
197
|
+
};
|
|
198
|
+
autoWidth: {
|
|
199
|
+
type: BooleanConstructor;
|
|
200
|
+
default: boolean;
|
|
201
|
+
};
|
|
202
|
+
hideActions: {
|
|
203
|
+
type: BooleanConstructor;
|
|
204
|
+
default: boolean;
|
|
205
|
+
};
|
|
206
|
+
unit: {
|
|
207
|
+
type: StringConstructor;
|
|
208
|
+
};
|
|
142
209
|
minlength: NumberConstructor;
|
|
143
210
|
maxlength: NumberConstructor;
|
|
144
211
|
placeholder: StringConstructor;
|
|
145
212
|
required: BooleanConstructor;
|
|
146
|
-
label: StringConstructor;
|
|
213
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
147
214
|
floating: BooleanConstructor;
|
|
148
215
|
icon: {
|
|
149
216
|
type: (StringConstructor | ObjectConstructor)[];
|
|
150
217
|
};
|
|
151
218
|
iconPosition: {
|
|
152
|
-
type:
|
|
153
|
-
default: import("../../constants
|
|
154
|
-
validation: (value: import("../../constants
|
|
219
|
+
type: globalThis.PropType<"before" | "after">;
|
|
220
|
+
default: import("../../constants").Position;
|
|
221
|
+
validation: (value: import("../../constants").Position) => boolean;
|
|
155
222
|
};
|
|
156
223
|
debounce: (StringConstructor | NumberConstructor)[];
|
|
157
224
|
count: {
|
|
@@ -159,9 +226,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
159
226
|
default: boolean;
|
|
160
227
|
validator: (value: string) => boolean;
|
|
161
228
|
};
|
|
162
|
-
modifiers:
|
|
229
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
163
230
|
loading: BooleanConstructor;
|
|
164
|
-
loadingLabel:
|
|
231
|
+
loadingLabel: {
|
|
232
|
+
type: StringConstructor;
|
|
233
|
+
default: string;
|
|
234
|
+
};
|
|
165
235
|
hintLabel: {
|
|
166
236
|
type: StringConstructor;
|
|
167
237
|
default: string;
|
|
@@ -190,17 +260,19 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
190
260
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
191
261
|
}, {
|
|
192
262
|
disabled: boolean;
|
|
193
|
-
type: import("
|
|
263
|
+
type: import("../VvInputText").InputType;
|
|
264
|
+
mask: string;
|
|
265
|
+
floating: boolean;
|
|
194
266
|
required: boolean;
|
|
195
|
-
iconPosition:
|
|
267
|
+
iconPosition: "before" | "after";
|
|
196
268
|
loading: boolean;
|
|
269
|
+
loadingLabel: string;
|
|
197
270
|
multiple: boolean;
|
|
198
271
|
readonly: boolean;
|
|
199
272
|
hintLabel: string;
|
|
200
273
|
invalid: boolean;
|
|
201
274
|
valid: boolean;
|
|
202
275
|
tabindex: string | number;
|
|
203
|
-
floating: boolean;
|
|
204
276
|
autocomplete: string;
|
|
205
277
|
autofocus: boolean;
|
|
206
278
|
step: string | number;
|
|
@@ -212,6 +284,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
212
284
|
labelShowPassword: string;
|
|
213
285
|
labelHidePassword: string;
|
|
214
286
|
labelClear: string;
|
|
287
|
+
maskEager: boolean;
|
|
288
|
+
maskReversed: boolean;
|
|
289
|
+
maskTokens: import("maska").MaskTokens;
|
|
290
|
+
maskTokensReplace: boolean;
|
|
291
|
+
autoWidth: boolean;
|
|
292
|
+
hideActions: boolean;
|
|
215
293
|
count: string | boolean;
|
|
216
294
|
}>, {
|
|
217
295
|
before: (_: {
|
|
@@ -223,6 +301,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
223
301
|
stepDown: () => void;
|
|
224
302
|
clear: () => void;
|
|
225
303
|
}) => any;
|
|
304
|
+
default: (_: {
|
|
305
|
+
valid: boolean;
|
|
306
|
+
invalid: boolean;
|
|
307
|
+
modelValue: string | number | undefined;
|
|
308
|
+
togglePassword: () => void;
|
|
309
|
+
stepUp: () => void;
|
|
310
|
+
stepDown: () => void;
|
|
311
|
+
clear: () => void;
|
|
312
|
+
}) => any;
|
|
226
313
|
after: (_: {
|
|
227
314
|
valid: boolean;
|
|
228
315
|
invalid: boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
|
-
import { type VvInputTextPropsTypes } from '
|
|
2
|
+
import { type VvInputTextPropsTypes } from '.';
|
|
3
3
|
export default function VvInputTextActionsFactory(type: string, parentProps: VvInputTextPropsTypes): Component;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { MaskTokens } from 'maska';
|
|
2
3
|
export declare const INPUT_TYPES: {
|
|
3
4
|
readonly TEXT: "text";
|
|
4
5
|
readonly PASSWORD: "password";
|
|
@@ -131,17 +132,77 @@ export declare const VvInputTextProps: {
|
|
|
131
132
|
type: StringConstructor;
|
|
132
133
|
default: string;
|
|
133
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Input mask, only for text type
|
|
137
|
+
* @see https://beholdr.github.io/maska/
|
|
138
|
+
*/
|
|
139
|
+
mask: {
|
|
140
|
+
type: StringConstructor;
|
|
141
|
+
default: undefined;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Show mask before typing
|
|
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
|
|
162
|
+
*/
|
|
163
|
+
maskTokens: {
|
|
164
|
+
type: PropType<MaskTokens>;
|
|
165
|
+
default: undefined;
|
|
166
|
+
};
|
|
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
|
+
/**
|
|
176
|
+
* Adjust input width to content
|
|
177
|
+
*/
|
|
178
|
+
autoWidth: {
|
|
179
|
+
type: BooleanConstructor;
|
|
180
|
+
default: boolean;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Hide type number, password and search actions
|
|
184
|
+
*/
|
|
185
|
+
hideActions: {
|
|
186
|
+
type: BooleanConstructor;
|
|
187
|
+
default: boolean;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Add unit label to input
|
|
191
|
+
*/
|
|
192
|
+
unit: {
|
|
193
|
+
type: StringConstructor;
|
|
194
|
+
};
|
|
134
195
|
minlength: NumberConstructor;
|
|
135
196
|
maxlength: NumberConstructor;
|
|
136
197
|
placeholder: StringConstructor;
|
|
137
198
|
required: BooleanConstructor;
|
|
138
|
-
label: StringConstructor;
|
|
199
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
139
200
|
floating: BooleanConstructor;
|
|
140
201
|
icon: {
|
|
141
202
|
type: (StringConstructor | ObjectConstructor)[];
|
|
142
203
|
};
|
|
143
204
|
iconPosition: {
|
|
144
|
-
type: PropType<
|
|
205
|
+
type: PropType<"before" | "after">;
|
|
145
206
|
default: import("../../constants").Position;
|
|
146
207
|
validation: (value: import("../../constants").Position) => boolean;
|
|
147
208
|
};
|
|
@@ -153,7 +214,10 @@ export declare const VvInputTextProps: {
|
|
|
153
214
|
};
|
|
154
215
|
modifiers: PropType<string | string[]>;
|
|
155
216
|
loading: BooleanConstructor;
|
|
156
|
-
loadingLabel:
|
|
217
|
+
loadingLabel: {
|
|
218
|
+
type: StringConstructor;
|
|
219
|
+
default: string;
|
|
220
|
+
};
|
|
157
221
|
hintLabel: {
|
|
158
222
|
type: StringConstructor;
|
|
159
223
|
default: string;
|