@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,d){typeof exports=="object"&&typeof module<"u"?module.exports=d(require("vue"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue"],d):(e=typeof globalThis<"u"?globalThis:e||self,e.VvTextarea=d(e.vue,e.vue$1))})(this,function(e,d){"use strict";function _(o){return Array.isArray(o)?o.filter(s=>isString(s)).join(" "):o}function j(o,s){const{invalid:t,valid:l,hint:u,loading:y}=s,{hintLabel:a,modelValue:P,valid:m,validLabel:c,invalid:r,invalidLabel:n,...p}=toRefs(o),i=resolveFieldData(p,"loading"),f=resolveFieldData(p,"loadingLabel"),g=computed(()=>r.value?!!(r.value&&t||n!=null&&n.value&&Array.isArray(n.value)&&n.value.length>0||n!=null&&n.value&&!isEmpty(n)):!1),B=computed(()=>!!(a&&a.value||u)),V=computed(()=>!!(c&&c.value||l)),v=computed(()=>!!(i!=null&&i.value&&y||i!=null&&i.value&&(f!=null&&f.value))),x=computed(()=>B.value||V.value||g.value||v.value);return{hasInvalid:g,hasHint:B,hasValid:V,hasLoading:v,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(w){const k=computed(()=>{const b=toReactive({hintLabel:a,modelValue:P,valid:m,validLabel:c,invalid:r,invalidLabel:n,loading:i,loadingLabel:f,...w.params});return r!=null&&r.value?(t==null?void 0:t(b))||_(n==null?void 0:n.value)||(a==null?void 0:a.value):m!=null&&m.value?(l==null?void 0:l(b))||_(c==null?void 0:c.value)||(a==null?void 0:a.value):i!=null&&i.value?(y==null?void 0:y(b))||_(f==null?void 0:f.value)||(a==null?void 0:a.value):(u==null?void 0:u(b))||_(a==null?void 0:a.value)||(a==null?void 0:a.value)});return{isVisible:x,hasInvalid:g,hasValid:V,hintContent:k}},render(){if(this.isVisible)return h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}const O={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]}},T={name:"VvIcon"},D=e.defineComponent({...T,props:O,setup(o){const s=o,t=ref(!0),l=useVolver(),{modifiers:u}=toRefs(s),y=useBemModifiers("vv-icon",u),a=computed(()=>s.provider||(l==null?void 0:l.provider)),P=computed(()=>{const r=s.name??"",n=`@${a.value}:${s.prefix}:${s.name}`;return d.iconExists(r)?r:d.iconExists(n)?n:(l==null?void 0:l.iconsCollections.find(p=>{const i=`@${a.value}:${p.prefix}:${r}`;if(d.iconExists(i))return i}))||r});function m(r){let n=null;if(typeof window>"u"){const{JSDOM:g}=require("jsdom");n=new g().window}return(n?new n.DOMParser:new window.DOMParser).parseFromString(r,"text/html").querySelector("svg")}function c(r){const n=m(r),p=(n==null?void 0:n.innerHTML.trim())||"";n&&p&&d.addIcon(`@${a.value}:${s.prefix}:${s.name}`,{body:p,height:n.viewBox.baseVal.height,width:n.viewBox.baseVal.width})}return l&&(s.src&&!d.iconExists(`@${a.value}:${s.prefix}:${s.name}`)?(t.value=!1,l.fetchIcon(s.src).then(r=>{r&&(c(r),t.value=!0)}).catch(r=>{throw new Error(`During fetch icon: ${r==null?void 0:r.message}`)})):s.svg&&c(s.svg)),(r,n)=>e.unref(t)?(e.openBlock(),e.createBlock(e.unref(d.Icon),e.mergeProps({key:0,class:e.unref(y)},{inline:r.inline,width:r.width,height:r.height,horizontalFlip:r.horizontalFlip,verticalFlip:r.verticalFlip,flip:r.flip,rotate:r.rotate,color:r.color,onLoad:r.onLoad,icon:e.unref(P)}),null,16,["class"])):e.createCommentVNode("",!0)}});var N=(o=>(o.left="left",o.right="right",o.top="top",o.bottom="bottom",o))(N||{}),F=(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))(F||{}),E=(o=>(o.before="before",o.after="after",o))(E||{});const z={valid:Boolean,validLabel:[String,Array]},q={invalid:Boolean,invalidLabel:[String,Array]},R={loading:Boolean,loadingLabel:String},H={disabled:Boolean},M={readonly:Boolean},K={modifiers:[String,Array]},U={hintLabel:{type:String,default:""}},W={count:{type:[Boolean,String],default:!1,validator:o=>[!0,!1,"limit","countdown"].includes(o)}},J={debounce:[Number,String]},L={icon:{type:[String,Object]},iconPosition:{type:String,default:E.before,validation:o=>Object.values(E).includes(o)}},G={tabindex:{type:[String,Number],default:0}},Q={floating:Boolean},X={id:[String,Number]};N.bottom;const Y={...{...X,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...G,...H,...M,...z,...q,...U,...R,...K,...W,...J,...L,...Q,minlength:Number,maxlength:Number,placeholder:String,required:Boolean,label:String},Z={hard:"hard",soft:"soft"},ee={true:!0,false:!1,default:"default"},te=["update:modelValue","focus","blur","keyup"],oe={...Y,modelValue:String,cols:{type:[String,Number],default:20},rows:{type:[String,Number],default:2},wrap:{type:String,default:Z.soft},spellcheck:{type:[Boolean,String],default:ee.default},resizable:Boolean},re=["for"],ne={class:"vv-textarea__wrapper"},ae={key:0,class:"vv-textarea__input-before"},se={class:"vv-textarea__inner"},ie=["id"],le={key:1,class:"vv-textarea__input-after"},ce={key:2,class:"vv-textarea__limit"},de={name:"VvTextarea"};return e.defineComponent({...de,props:oe,emits:te,setup(o,{emit:s}){const t=o,l=useSlots(),u=ref(),{id:y,icon:a,iconPosition:P,label:m,modelValue:c,count:r,valid:n,invalid:p,loading:i,modifiers:f}=toRefs(t),g=useUniqueId(y),B=computed(()=>`${g.value}-hint`),V=computed(()=>t.floating&&isEmpty(t.placeholder)?" ":t.placeholder),v=useDebouncedInput(c,s,t.debounce),{hasIcon:x,hasIconBefore:w,hasIconAfter:k}=useComponentIcon(a,P),{focused:b}=useComponentFocus(u,s),ue=useElementVisibility(u);watch(ue,S=>{S&&t.autofocus&&(b.value=!0)});const{formatted:pe}=useTextCount(v,{mode:t.count,upperLimit:t.maxlength,lowerLimit:t.minlength}),fe=computed(()=>!t.disabled&&!t.readonly),me=computed(()=>fe.value?t.tabindex:-1),ge=computed(()=>!isEmpty(c)),he=computed(()=>{if(t.invalid===!0)return!0;if(t.valid===!0)return!1}),{HintSlot:ye,hasHint:ve,hasInvalid:A}=j(t,l),be=useBemModifiers("vv-textarea",f,computed(()=>({valid:n.value,invalid:p.value,loading:i.value,disabled:t.disabled,readonly:t.readonly,"icon-before":w.value,"icon-after":k.value,floating:t.floating&&!isEmpty(t.label),dirty:ge.value,focused:b.value,resizable:t.resizable}))),Se=computed(()=>({name:t.name,placeholder:V.value,tabindex:me.value,disabled:t.disabled,readonly:t.readonly,required:t.required,autocomplete:t.autocomplete,minlength:t.minlength,maxlength:t.maxlength,cols:t.cols,rows:t.rows,wrap:t.wrap,spellcheck:t.spellcheck,"aria-invalid":he.value,"aria-describedby":!A.value&&ve.value?B.value:void 0,"aria-errormessage":A.value?B.value:void 0})),I=computed(()=>({valid:t.valid,invalid:t.invalid,modelValue:t.modelValue,hintLabel:t.hintLabel,maxlength:t.maxlength,minlength:t.minlength,clear:Be})),Be=()=>{v.value=void 0};return(S,C)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(be))},[e.unref(m)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(g),class:"vv-textarea__label"},e.toDisplayString(e.unref(m)),9,re)):e.createCommentVNode("",!0),e.createElementVNode("div",ne,[S.$slots.before?(e.openBlock(),e.createElementBlock("div",ae,[e.renderSlot(S.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])):e.createCommentVNode("",!0),e.createElementVNode("div",se,[e.unref(w)?(e.openBlock(),e.createBlock(D,e.mergeProps({key:0,class:"vv-textarea__icon"},e.unref(x)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(g),ref_key:"textarea",ref:u,"onUpdate:modelValue":C[0]||(C[0]=$=>e.isRef(v)?v.value=$:null)},e.unref(Se),{onKeyup:C[1]||(C[1]=$=>s("keyup",$))}),null,16,ie),[[e.vModelText,e.unref(v)]]),e.unref(k)?(e.openBlock(),e.createBlock(D,e.mergeProps({key:1,class:"vv-textarea__icon vv-textarea__icon-after"},e.unref(x)),null,16)):e.createCommentVNode("",!0)]),S.$slots.after?(e.openBlock(),e.createElementBlock("div",le,[e.renderSlot(S.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])):e.createCommentVNode("",!0),e.unref(r)?(e.openBlock(),e.createElementBlock("span",ce,[e.renderSlot(S.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(I))),()=>[e.createTextVNode(e.toDisplayString(e.unref(pe)),1)])])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(ye),{id:e.unref(B),class:"vv-textarea__hint"},null,8,["id"])],2))}})});
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","@iconify/vue","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTextarea=l(e.vue,e.core,e.vue$1,e.nanoid)}(this,(function(e,l,o,t){"use strict";function n(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const o=l.split(".");let t=e;for(let l=0,n=o.length;l<n;++l){if(null==e)return null;t=t[o[l]]}return t}}return null}function a(l){return null==(o=e.unref(l))||""===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(l=e)||l instanceof String;var l})).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||{}),d=(e=>(e.before="before",e.after="after",e))(d||{}),v=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(v||{});const c=Symbol.for("volver");function s(l,o,t){return e.computed((()=>{const n={[l]:!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[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((o=>{n[`${l}--${o}`]=e.unref(t.value[o])})),n}))}const m=e.defineComponent({name:"VvIcon",props:r,setup(l){const t=l,n=e.ref(!0),a=e.inject(c),{modifiers:i}=e.toRefs(t),r=s("vv-icon",i),u=e.computed((()=>t.provider||(null==a?void 0:a.iconsProvider))),d=e.computed((()=>{const e=t.name??"",l=`@${u.value}:${t.prefix}:${t.name}`;return o.iconExists(e)?e:o.iconExists(l)?l:(null==a?void 0:a.iconsCollections.find((l=>{const t=`@${u.value}:${l.prefix}:${e}`;if(o.iconExists(t))return t})))||e}));function v(e){const l=function(e){let l=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");l=(new e).window}return(l?new l.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),n=(null==l?void 0:l.innerHTML.trim())||"";l&&n&&o.addIcon(`@${u.value}:${t.prefix}:${t.name}`,{body:n,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return a&&(t.src&&!o.iconExists(`@${u.value}:${t.prefix}:${t.name}`)?(n.value=!1,a.fetchIcon(t.src).then((e=>{e&&(v(e),n.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):t.svg&&v(t.svg)),(l,t)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(r)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:l.rotate,color:l.color,onLoad:l.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},g={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},B={modifiers:[String,Array]},S={hintLabel:{type:String,default:""}},x={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},w={debounce:[Number,String]},L={icon:{type:[String,Object]},iconPosition:{type:String,default:d.before,validation:e=>Object.values(d).includes(e)}},k={tabindex:{type:[String,Number],default:0}},V={floating:Boolean},$={id:[String,Number]};u.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const N={...{...$,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...k,...h,...y,...f,...p,...S,...g,...B,...x,...w,...L,...V,...b,minlength:Number,maxlength:Number,placeholder:String,required:Boolean};v.button;const _={...N,modelValue:String,cols:{type:[String,Number],default:20},rows:{type:[String,Number],default:2},wrap:{type:String,default:"soft"},spellcheck:{type:[Boolean,String],default:"default"},resizable:Boolean};const I=["for"],E={class:"vv-textarea__wrapper"},P={key:0,class:"vv-textarea__input-before"},A={class:"vv-textarea__inner"},C=["id"],j={key:1,class:"vv-textarea__input-after"},q={key:2,class:"vv-textarea__limit"};return e.defineComponent({name:"VvTextarea",props:_,emits:["update:modelValue","focus","blur","keyup"],setup(o,{emit:r}){const v=o,c=e.useSlots(),f=e.ref(),{id:p,icon:g,iconPosition:h,label:b,modelValue:y,count:B,valid:S,invalid:x,loading:w,modifiers:L}=e.toRefs(v),k=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(p),V=e.computed((()=>`${k.value}-hint`)),$=e.computed((()=>v.floating&&a(v.placeholder)?" ":v.placeholder)),N=function(l,o,t=0,{getter:n=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof t&&(t=parseInt(t)),e.computed({get:()=>n(null==l?void 0:l.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),t)}})}(y,r,v.debounce),{hasIcon:_,hasIconBefore:z,hasIconAfter:O}=function(l,o){const t=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===d.before))),n=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===d.after))),a=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.left))),i=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.right))),r=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.top))),v=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===u.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==l?void 0:l.value)?{name:null==l?void 0:l.value}:null==l?void 0:l.value)),hasIconLeft:a,hasIconRight:i,hasIconTop:r,hasIconBottom:v,hasIconBefore:t,hasIconAfter:n}}(g,h),{focused:T}=function(o,t){const{focused:n}=l.useFocus(o);return e.watch(n,(l=>{t(l?"focus":"blur",e.unref(o))})),{focused:n}}(f,r),F=l.useElementVisibility(f);e.watch(F,(e=>{e&&v.autofocus&&(T.value=!0)}));const{formatted:R}=function(l,o){const t=e.computed((()=>(e.unref(l)??"").length)),n=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&t.value<(null==o?void 0:o.lowerLimit)?t.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&t.value<(null==o?void 0:o.upperLimit)?o.upperLimit-t.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`${t.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===n.value)return;return n}return t.value}));return{length:t,gap:n,formatted:a}}(N,{mode:v.count,upperLimit:v.maxlength,lowerLimit:v.minlength}),D=e.computed((()=>!v.disabled&&!v.readonly)),H=e.computed((()=>D.value?v.tabindex:-1)),M=e.computed((()=>!a(y))),J=e.computed((()=>!0===v.invalid||!0!==v.valid&&void 0)),{HintSlot:K,hasHint:U,hasInvalid:G}=function(o,t){const{invalid:r,valid:u,hint:d,loading:v}=t,{hintLabel:c,modelValue:s,valid:m,validLabel:f,invalid:p,invalidLabel:g,...h}=e.toRefs(o),b=n(h,"loading"),y=n(h,"loadingLabel"),B=e.computed((()=>!(!p.value||(!p.value||!r)&&!((null==g?void 0:g.value)&&Array.isArray(g.value)&&g.value.length>0)&&(!(null==g?void 0:g.value)||a(g))))),S=e.computed((()=>!!(c&&c.value||d))),x=e.computed((()=>!!(f&&f.value||u))),w=e.computed((()=>!!((null==b?void 0:b.value)&&v||(null==b?void 0:b.value)&&(null==y?void 0:y.value)))),L=e.computed((()=>S.value||x.value||B.value||w.value));return{hasInvalid:B,hasHint:S,hasValid:x,hasLoading:w,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(o){const t=e.computed((()=>{const e=l.toReactive({hintLabel:c,modelValue:s,valid:m,validLabel:f,invalid:p,invalidLabel:g,loading:b,loadingLabel:y,...o.params});return(null==p?void 0:p.value)?(null==r?void 0:r(e))||i(null==g?void 0:g.value)||(null==c?void 0:c.value):(null==m?void 0:m.value)?(null==u?void 0:u(e))||i(null==f?void 0:f.value)||(null==c?void 0:c.value):(null==b?void 0:b.value)?(null==v?void 0:v(e))||i(null==y?void 0:y.value)||(null==c?void 0:c.value):(null==d?void 0:d(e))||i(null==c?void 0:c.value)||(null==c?void 0:c.value)}));return{isVisible:L,hasInvalid:B,hasValid:x,hintContent:t}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}(v,c),Q=s("vv-textarea",L,e.computed((()=>({valid:S.value,invalid:x.value,loading:w.value,disabled:v.disabled,readonly:v.readonly,"icon-before":z.value,"icon-after":O.value,floating:v.floating&&!a(v.label),dirty:M.value,focused:T.value,resizable:v.resizable})))),W=e.computed((()=>({name:v.name,placeholder:$.value,tabindex:H.value,disabled:v.disabled,readonly:v.readonly,required:v.required,autocomplete:v.autocomplete,minlength:v.minlength,maxlength:v.maxlength,cols:v.cols,rows:v.rows,wrap:v.wrap,spellcheck:v.spellcheck,"aria-invalid":J.value,"aria-describedby":!G.value&&U.value?V.value:void 0,"aria-errormessage":G.value?V.value:void 0}))),X=e.computed((()=>({valid:v.valid,invalid:v.invalid,modelValue:v.modelValue,hintLabel:v.hintLabel,maxlength:v.maxlength,minlength:v.minlength,clear:Y}))),Y=()=>{N.value=void 0};return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(Q))},[e.unref(b)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(k),class:"vv-textarea__label"},e.toDisplayString(e.unref(b)),9,I)):e.createCommentVNode("",!0),e.createElementVNode("div",E,[l.$slots.before?(e.openBlock(),e.createElementBlock("div",P,[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.createElementVNode("div",A,[e.unref(z)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-textarea__icon"},e.unref(_)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("textarea",e.mergeProps({id:e.unref(k),ref_key:"textarea",ref:f,"onUpdate:modelValue":o[0]||(o[0]=l=>e.isRef(N)?N.value=l:null)},e.unref(W),{onKeyup:o[1]||(o[1]=e=>r("keyup",e))}),null,16,C),[[e.vModelText,e.unref(N)]]),e.unref(O)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-textarea__icon vv-textarea__icon-after"},e.unref(_)),null,16)):e.createCommentVNode("",!0)]),l.$slots.after?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(l.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(X))))])):e.createCommentVNode("",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",q,[e.renderSlot(l.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(X))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(R)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(K),{id:e.unref(V),class:"vv-textarea__hint"},null,8,["id"])],2))}})}));
|
|
@@ -21,15 +21,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
21
21
|
maxlength: NumberConstructor;
|
|
22
22
|
placeholder: StringConstructor;
|
|
23
23
|
required: BooleanConstructor;
|
|
24
|
-
label: StringConstructor;
|
|
24
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
25
25
|
floating: BooleanConstructor;
|
|
26
26
|
icon: {
|
|
27
27
|
type: (StringConstructor | ObjectConstructor)[];
|
|
28
28
|
};
|
|
29
29
|
iconPosition: {
|
|
30
|
-
type:
|
|
31
|
-
default: import("../../constants
|
|
32
|
-
validation: (value: import("../../constants
|
|
30
|
+
type: globalThis.PropType<"before" | "after">;
|
|
31
|
+
default: import("../../constants").Position;
|
|
32
|
+
validation: (value: import("../../constants").Position) => boolean;
|
|
33
33
|
};
|
|
34
34
|
debounce: (StringConstructor | NumberConstructor)[];
|
|
35
35
|
count: {
|
|
@@ -37,9 +37,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
37
37
|
default: boolean;
|
|
38
38
|
validator: (value: string) => boolean;
|
|
39
39
|
};
|
|
40
|
-
modifiers:
|
|
40
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
41
41
|
loading: BooleanConstructor;
|
|
42
|
-
loadingLabel:
|
|
42
|
+
loadingLabel: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
default: string;
|
|
45
|
+
};
|
|
43
46
|
hintLabel: {
|
|
44
47
|
type: StringConstructor;
|
|
45
48
|
default: string;
|
|
@@ -87,15 +90,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
87
90
|
maxlength: NumberConstructor;
|
|
88
91
|
placeholder: StringConstructor;
|
|
89
92
|
required: BooleanConstructor;
|
|
90
|
-
label: StringConstructor;
|
|
93
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
91
94
|
floating: BooleanConstructor;
|
|
92
95
|
icon: {
|
|
93
96
|
type: (StringConstructor | ObjectConstructor)[];
|
|
94
97
|
};
|
|
95
98
|
iconPosition: {
|
|
96
|
-
type:
|
|
97
|
-
default: import("../../constants
|
|
98
|
-
validation: (value: import("../../constants
|
|
99
|
+
type: globalThis.PropType<"before" | "after">;
|
|
100
|
+
default: import("../../constants").Position;
|
|
101
|
+
validation: (value: import("../../constants").Position) => boolean;
|
|
99
102
|
};
|
|
100
103
|
debounce: (StringConstructor | NumberConstructor)[];
|
|
101
104
|
count: {
|
|
@@ -103,9 +106,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
103
106
|
default: boolean;
|
|
104
107
|
validator: (value: string) => boolean;
|
|
105
108
|
};
|
|
106
|
-
modifiers:
|
|
109
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
107
110
|
loading: BooleanConstructor;
|
|
108
|
-
loadingLabel:
|
|
111
|
+
loadingLabel: {
|
|
112
|
+
type: StringConstructor;
|
|
113
|
+
default: string;
|
|
114
|
+
};
|
|
109
115
|
hintLabel: {
|
|
110
116
|
type: StringConstructor;
|
|
111
117
|
default: string;
|
|
@@ -134,15 +140,16 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
134
140
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
135
141
|
}, {
|
|
136
142
|
disabled: boolean;
|
|
143
|
+
floating: boolean;
|
|
137
144
|
required: boolean;
|
|
138
|
-
iconPosition:
|
|
145
|
+
iconPosition: "before" | "after";
|
|
139
146
|
loading: boolean;
|
|
147
|
+
loadingLabel: string;
|
|
140
148
|
readonly: boolean;
|
|
141
149
|
hintLabel: string;
|
|
142
150
|
invalid: boolean;
|
|
143
151
|
valid: boolean;
|
|
144
152
|
tabindex: string | number;
|
|
145
|
-
floating: boolean;
|
|
146
153
|
autocomplete: string;
|
|
147
154
|
autofocus: boolean;
|
|
148
155
|
count: string | boolean;
|
|
@@ -55,13 +55,13 @@ export declare const VvTextareaProps: {
|
|
|
55
55
|
maxlength: NumberConstructor;
|
|
56
56
|
placeholder: StringConstructor;
|
|
57
57
|
required: BooleanConstructor;
|
|
58
|
-
label: StringConstructor;
|
|
58
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
59
59
|
floating: BooleanConstructor;
|
|
60
60
|
icon: {
|
|
61
61
|
type: (StringConstructor | ObjectConstructor)[];
|
|
62
62
|
};
|
|
63
63
|
iconPosition: {
|
|
64
|
-
type:
|
|
64
|
+
type: globalThis.PropType<"before" | "after">;
|
|
65
65
|
default: import("../../constants").Position;
|
|
66
66
|
validation: (value: import("../../constants").Position) => boolean;
|
|
67
67
|
};
|
|
@@ -71,12 +71,12 @@ export declare const VvTextareaProps: {
|
|
|
71
71
|
default: boolean;
|
|
72
72
|
validator: (value: string) => boolean;
|
|
73
73
|
};
|
|
74
|
-
modifiers:
|
|
74
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
75
75
|
loading: BooleanConstructor;
|
|
76
|
-
loadingLabel:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
loadingLabel: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
default: string;
|
|
79
|
+
};
|
|
80
80
|
hintLabel: {
|
|
81
81
|
type: StringConstructor;
|
|
82
82
|
default: string;
|
|
@@ -1,48 +1,276 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
import { computed, unref, defineComponent, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
3
|
+
Side2["left"] = "left";
|
|
4
|
+
Side2["right"] = "right";
|
|
5
|
+
Side2["top"] = "top";
|
|
6
|
+
Side2["bottom"] = "bottom";
|
|
7
|
+
return Side2;
|
|
8
|
+
})(Side || {});
|
|
9
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
10
|
+
Placement2["topStart"] = "top-start";
|
|
11
|
+
Placement2["topEnd"] = "top-end";
|
|
12
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
13
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
14
|
+
Placement2["leftStart"] = "left-start";
|
|
15
|
+
Placement2["leftEnd"] = "left-end";
|
|
16
|
+
Placement2["rightStart"] = "right-start";
|
|
17
|
+
Placement2["rightEnd"] = "right-end";
|
|
18
|
+
return Placement2;
|
|
19
|
+
})(Placement || {});
|
|
20
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
21
|
+
Position2["before"] = "before";
|
|
22
|
+
Position2["after"] = "after";
|
|
23
|
+
return Position2;
|
|
24
|
+
})(Position || {});
|
|
25
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
26
|
+
ButtonType2["button"] = "button";
|
|
27
|
+
ButtonType2["submit"] = "submit";
|
|
28
|
+
ButtonType2["reset"] = "reset";
|
|
29
|
+
return ButtonType2;
|
|
30
|
+
})(ButtonType || {});
|
|
31
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
32
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
33
|
+
AnchorTarget2["_self"] = "_self";
|
|
34
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
35
|
+
AnchorTarget2["_top"] = "_top";
|
|
36
|
+
return AnchorTarget2;
|
|
37
|
+
})(AnchorTarget || {});
|
|
38
|
+
const LinkProps = {
|
|
39
|
+
/**
|
|
40
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
41
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
42
|
+
*/
|
|
43
|
+
to: {
|
|
44
|
+
type: [String, Object]
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Anchor href
|
|
48
|
+
*/
|
|
49
|
+
href: String,
|
|
50
|
+
/**
|
|
51
|
+
* Anchor target
|
|
52
|
+
*/
|
|
53
|
+
target: {
|
|
54
|
+
type: String,
|
|
55
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Anchor rel
|
|
59
|
+
*/
|
|
60
|
+
rel: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "noopener noreferrer"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const DisabledProps = {
|
|
66
|
+
/**
|
|
67
|
+
* Whether the form control is disabled
|
|
68
|
+
*/
|
|
69
|
+
disabled: Boolean
|
|
70
|
+
};
|
|
71
|
+
const ActiveProps = {
|
|
72
|
+
/**
|
|
73
|
+
* Whether the item is active
|
|
74
|
+
*/
|
|
75
|
+
active: Boolean
|
|
76
|
+
};
|
|
77
|
+
const PressedProps = {
|
|
78
|
+
/**
|
|
79
|
+
* Whether the item is pressed
|
|
80
|
+
*/
|
|
81
|
+
pressed: Boolean
|
|
82
|
+
};
|
|
83
|
+
const LabelProps = {
|
|
84
|
+
/**
|
|
85
|
+
* The item label
|
|
86
|
+
*/
|
|
87
|
+
label: [String, Number]
|
|
88
|
+
};
|
|
89
|
+
const ModifiersProps = {
|
|
4
90
|
/**
|
|
5
91
|
* Component BEM modifiers
|
|
6
92
|
*/
|
|
7
93
|
modifiers: [String, Array]
|
|
8
94
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
95
|
+
({
|
|
96
|
+
/**
|
|
97
|
+
* VvIcon name or props
|
|
98
|
+
* @see VVIcon
|
|
99
|
+
*/
|
|
100
|
+
icon: { type: [String, Object] },
|
|
101
|
+
/**
|
|
102
|
+
* VvIcon position
|
|
103
|
+
*/
|
|
104
|
+
iconPosition: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: Position.before,
|
|
107
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
({
|
|
111
|
+
/**
|
|
112
|
+
* Dropdown placement
|
|
113
|
+
*/
|
|
114
|
+
placement: {
|
|
115
|
+
type: String,
|
|
116
|
+
default: Side.bottom,
|
|
117
|
+
validator: (value) => {
|
|
118
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* Dropdown show / hide transition name
|
|
123
|
+
*/
|
|
124
|
+
transitionName: {
|
|
125
|
+
type: String
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Offset of the dropdown from the trigger
|
|
129
|
+
* @see https://floating-ui.com/docs/offset
|
|
130
|
+
*/
|
|
131
|
+
offset: {
|
|
132
|
+
type: [Number, String, Object],
|
|
133
|
+
default: 0
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Move dropdown to the side if there is no space in the default position
|
|
137
|
+
* @see https://floating-ui.com/docs/shift
|
|
138
|
+
*/
|
|
139
|
+
shift: {
|
|
140
|
+
type: [Boolean, Object],
|
|
141
|
+
default: false
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* Flip dropdown position if there is no space in the default position
|
|
145
|
+
* @see https://floating-ui.com/docs/flip
|
|
146
|
+
*/
|
|
147
|
+
flip: {
|
|
148
|
+
type: [Boolean, Object],
|
|
149
|
+
default: true
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Size of the dropdown
|
|
153
|
+
* @see https://floating-ui.com/docs/size
|
|
154
|
+
*/
|
|
155
|
+
size: {
|
|
156
|
+
type: [Boolean, Object],
|
|
157
|
+
default: () => ({ padding: 10 })
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* Automatically change the position of the dropdown
|
|
161
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
162
|
+
*/
|
|
163
|
+
autoPlacement: {
|
|
164
|
+
type: [Boolean, Object],
|
|
165
|
+
default: false
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Add arrow to the dropdown
|
|
169
|
+
* @see https://floating-ui.com/docs/arrow
|
|
170
|
+
*/
|
|
171
|
+
arrow: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: false
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Close dropdown on click outside
|
|
177
|
+
*/
|
|
178
|
+
autoClose: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: true
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Autofocus first item on dropdown open
|
|
184
|
+
*/
|
|
185
|
+
autofocusFirst: {
|
|
186
|
+
type: Boolean,
|
|
187
|
+
default: true
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* Set dropdown width to the same as the trigger
|
|
191
|
+
*/
|
|
192
|
+
triggerWidth: {
|
|
193
|
+
type: Boolean
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
({
|
|
197
|
+
...DisabledProps,
|
|
198
|
+
...LabelProps,
|
|
199
|
+
...PressedProps,
|
|
200
|
+
...ActiveProps,
|
|
201
|
+
...LinkProps,
|
|
202
|
+
/**
|
|
203
|
+
* Button type
|
|
204
|
+
*/
|
|
205
|
+
type: {
|
|
206
|
+
type: String,
|
|
207
|
+
default: ButtonType.button,
|
|
208
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
const VvTooltipProps = {
|
|
212
|
+
...ModifiersProps,
|
|
13
213
|
/**
|
|
14
214
|
* Define the tooltip position
|
|
15
215
|
* @default Side.bottom
|
|
16
216
|
*/
|
|
17
217
|
position: {
|
|
18
218
|
type: String,
|
|
19
|
-
default:
|
|
219
|
+
default: Side.bottom
|
|
20
220
|
},
|
|
21
221
|
value: {
|
|
22
222
|
type: String
|
|
23
223
|
}
|
|
24
|
-
}
|
|
224
|
+
};
|
|
225
|
+
function useModifiers(prefix, modifiers, others) {
|
|
226
|
+
return computed(() => {
|
|
227
|
+
const toReturn = {
|
|
228
|
+
[prefix]: true
|
|
229
|
+
};
|
|
230
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
231
|
+
if (modifiersArray) {
|
|
232
|
+
if (Array.isArray(modifiersArray)) {
|
|
233
|
+
modifiersArray.forEach((modifier) => {
|
|
234
|
+
if (modifier) {
|
|
235
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (others) {
|
|
241
|
+
Object.keys(others.value).forEach((key) => {
|
|
242
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
return toReturn;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25
249
|
__name: "VvTooltip",
|
|
26
|
-
props:
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
250
|
+
props: VvTooltipProps,
|
|
251
|
+
setup(__props) {
|
|
252
|
+
const props = __props;
|
|
253
|
+
const { modifiers } = toRefs(props);
|
|
254
|
+
const bemCssClasses = useModifiers(
|
|
29
255
|
"vv-tooltip",
|
|
30
|
-
|
|
256
|
+
modifiers,
|
|
31
257
|
computed(() => ({
|
|
32
|
-
[
|
|
258
|
+
[props.position]: true
|
|
33
259
|
}))
|
|
34
260
|
);
|
|
35
|
-
return (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
261
|
+
return (_ctx, _cache) => {
|
|
262
|
+
return openBlock(), createElementBlock("span", {
|
|
263
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
264
|
+
role: "tooltip",
|
|
265
|
+
inert: ""
|
|
266
|
+
}, [
|
|
267
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
268
|
+
createTextVNode(toDisplayString(_ctx.value), 1)
|
|
269
|
+
])
|
|
270
|
+
], 2);
|
|
271
|
+
};
|
|
44
272
|
}
|
|
45
273
|
});
|
|
46
274
|
export {
|
|
47
|
-
|
|
275
|
+
_sfc_main as default
|
|
48
276
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTooltip=o(e.vue)}(this,(function(e){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),t=(e=>(e.before="before",e.after="after",e))(t||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{});Boolean,Boolean,Boolean;const l={modifiers:[String,Array]};t.before,o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,n.button;const r={...l,position:{type:String,default:o.bottom},value:{type:String}};return e.defineComponent({__name:"VvTooltip",props:r,setup(o){const t=o,{modifiers:n}=e.toRefs(t),l=function(o,t,n){return e.computed((()=>{const l={[o]:!0},r="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return r&&Array.isArray(r)&&r.forEach((e=>{e&&(l[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{l[`${o}--${t}`]=e.unref(n.value[t])})),l}))}("vv-tooltip",n,e.computed((()=>({[t.position]:!0}))));return(o,t)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(l)),role:"tooltip",inert:""},[e.renderSlot(o.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(o.value),1)]))],2))}})}));
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
2
2
|
position: {
|
|
3
|
-
type:
|
|
4
|
-
default: import("../../constants
|
|
3
|
+
type: globalThis.PropType<"left" | "right" | "top" | "bottom">;
|
|
4
|
+
default: import("../../constants").Side;
|
|
5
5
|
};
|
|
6
6
|
value: {
|
|
7
7
|
type: StringConstructor;
|
|
8
8
|
};
|
|
9
|
-
modifiers:
|
|
9
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
10
10
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
11
|
position: {
|
|
12
|
-
type:
|
|
13
|
-
default: import("../../constants
|
|
12
|
+
type: globalThis.PropType<"left" | "right" | "top" | "bottom">;
|
|
13
|
+
default: import("../../constants").Side;
|
|
14
14
|
};
|
|
15
15
|
value: {
|
|
16
16
|
type: StringConstructor;
|
|
17
17
|
};
|
|
18
|
-
modifiers:
|
|
18
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
19
19
|
}>>, {
|
|
20
|
-
position:
|
|
20
|
+
position: "left" | "right" | "top" | "bottom";
|
|
21
21
|
}>, {
|
|
22
22
|
default: (_: {}) => any;
|
|
23
23
|
}>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Side } from '@/constants';
|
|
2
1
|
import type { PropType } from 'vue';
|
|
2
|
+
import { Side } from '../../constants';
|
|
3
3
|
export declare const VvTooltipProps: {
|
|
4
4
|
/**
|
|
5
5
|
* Define the tooltip position
|
|
6
6
|
* @default Side.bottom
|
|
7
7
|
*/
|
|
8
8
|
position: {
|
|
9
|
-
type: PropType<
|
|
9
|
+
type: PropType<"left" | "right" | "top" | "bottom">;
|
|
10
10
|
default: Side;
|
|
11
11
|
};
|
|
12
12
|
value: {
|