@volverjs/ui-vue 0.0.10-beta.71 → 0.0.10-beta.72
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/dist/components/VvAlert/VvAlert.es.js +4 -4
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +4 -4
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +4 -4
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +141 -71
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +10 -3
- package/dist/components/VvCombobox/index.d.ts +35 -19
- package/dist/components/VvDropdown/VvDropdown.es.js +41 -22
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +4 -0
- package/dist/components/VvInputFile/VvInputFile.es.js +9 -9
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +54 -35
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +34 -24
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +3 -1
- package/dist/components/VvSelect/index.d.ts +12 -19
- package/dist/components/VvTextarea/VvTextarea.es.js +48 -29
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/index.es.js +150 -80
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +24 -0
- package/dist/stories/Combobox/Combobox.stories.d.ts +1 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@floating-ui/vue"),require("@vueuse/core"),require("mitt"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@floating-ui/vue","@vueuse/core","mitt","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCombobox=t(e.vue,e.vue$1,e.vue$2,e.core,e.mitt,e.tsDotProp)}(this,(function(e,t,l,o,a,n){"use strict";var r=(e=>(e.local="local",e.session="session",e))(r||{}),i=(e=>(e.absolute="absolute",e.fixed="fixed",e))(i||{}),u=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(u||{}),s=(e=>(e.topStart="top-start",e.topEnd="top-end",e.bottomStart="bottom-start",e.bottomEnd="bottom-end",e.leftStart="left-start",e.leftEnd="left-end",e.rightStart="right-start",e.rightEnd="right-end",e))(s||{}),d=(e=>(e.before="before",e.after="after",e))(d||{}),c=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(c||{}),v=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(v||{}),f=(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(f||{}),p=(e=>(e.listbox="listbox",e.menu="menu",e))(p||{}),m=(e=>(e.option="option",e.presentation="presentation",e))(m||{});const b=Symbol.for("volver"),g=Symbol.for("buttonGroup"),y=Symbol.for("dropdownTrigger"),h=Symbol.for("dropdownItem"),k=Symbol.for("dropdownAction"),S={to:{type:[String,Object]},href:String,target:String,rel:{type:String,default:"noopener noreferrer"}},B={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},V={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},w={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},x={disabled:{type:Boolean,default:!1}},L={required:{type:Boolean,default:!1}},C={selected:{type:Boolean,default:!1}},P={active:{type:Boolean,default:!1}},O={current:{type:Boolean,default:!1}},$={pressed:{type:Boolean,default:!1}},N={label:{type:[String,Number],default:void 0}},_={readonly:{type:Boolean,default:!1}},E={modifiers:{type:[String,Array],default:void 0}},A={hintLabel:{type:String,default:""}},F={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},D={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:d.before,validation:e=>Object.values(d).includes(e)}},H={tabindex:{type:[String,Number],default:0}},j={floating:{type:Boolean,default:!1}},R={unselectable:{type:Boolean,default:!0}},I={id:[String,Number]},z={placement:{type:String,default:u.bottom,validator:e=>Object.values(u).includes(e)||Object.values(s).includes(e)},strategy:{type:String,default:void 0,validator:e=>Object.values(i).includes(e)},transitionName:{type:String,default:void 0},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean,default:!1}},T={...I,name:{type:String,required:!0}},M={autofocus:{type:Boolean,default:!1}},q={autocomplete:{type:String,default:"off"}},K={...x,...N,...$,...P,...O,...S,type:{type:String,default:c.button,validator:e=>Object.values(c).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:v.button}};r.local;const W="close",G={prefix:"normal"},J={...T,...H,...B,...V,...A,...w,...x,..._,...E,...F,...D,...j,...z,...N,...L,transitionName:{type:String,default:"vv-dropdown--mobile-fade-block"},modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},noResultsLabel:{type:String,default:"No results"},noOptionsLabel:{type:String,default:"No options available"},selectedHintLabel:{type:String,default:"Selected"},deselectActionLabel:{type:String,default:"Deselect"},selectHintLabel:{type:String,default:"Press enter to select"},deselectHintLabel:{type:String,default:"Press enter to remove"},closeLabel:{type:String,default:"Close"},placeholder:String,searchable:Boolean,searchFunction:{type:Function,default:void 0},searchPlaceholder:{type:String,default:"Search..."},debounceSearch:{type:[Number,String],default:0},multiple:Boolean,minValues:{type:[Number,String],default:0},maxValues:[Number,String],unselectable:{type:Boolean,default:!0},separator:{type:String,default:", "},native:Boolean,badges:Boolean,badgeModifiers:{type:[String,Array],default:"action sm"},triggerWidth:{...z.triggerWidth,default:!0},dropdownModifiers:{type:[String,Array],default:"mobile"},autoOpen:{type:Boolean,default:!1},autoselectFirst:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},focusOnHover:{type:Boolean,default:!0},iconClear:{type:[String,Object],default:W},labelClear:{type:String,default:"Clear"}};function U(){return{...J,options:{...J.options,type:Array},searchFunction:{...J.searchFunction,type:Function}}}function Q(e,t,l){return X(e,t)}function X(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,r;if(l&&o){if(n=e.length,n!==t.length)return!1;for(a=n;0!==a--;)if(!X(e[a],t[a]))return!1;return!0}if(l!==o)return!1;const i=e instanceof Date,u=t instanceof Date;if(i!==u)return!1;if(i&&u)return e.getTime()===t.getTime();const s=e instanceof RegExp,d=t instanceof RegExp;if(s!==d)return!1;if(s&&d)return e.toString()===t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(a=n;0!==a--;)if(!Object.prototype.hasOwnProperty.call(t,c[a]))return!1;for(a=n;0!==a--;)if(r=c[a],!X(e[r],t[r]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function Y(e,t){if(null!=e&&t&&t.length)for(const l of t)if(Q(e,l))return!0;return!1}function Z(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}function ee(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>Z(o.value.invalidLabel))),n=e.computed((()=>Z(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),i=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.value)))),s=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),d=e.computed((()=>!u.value&&!s.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!u.value&&!s.value&&!d.value&&Boolean(l.hint||i.value))),v=e.computed((()=>s.value||d.value||u.value||c.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:i,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,r,i,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(r=(n=this.$slots).valid)?void 0:r.call(n))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(i=this.$slots).hint)?void 0:u.call(i))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}function te(){return e.inject(b,void 0)}function le(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const oe=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},G),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),n=e.ref(!0),r=te(),{modifiers:i}=e.toRefs(o),u=le("vv-icon",i),s=e.computed((()=>o.provider||(null==r?void 0:r.iconsProvider))),d=e.computed((()=>{const e=o.name??"",l=`@${s.value}:${o.prefix}:${e}`;if(t.iconLoaded(l))return l;const a=null==r?void 0:r.iconsCollections.find((l=>{const o=`@${s.value}:${l.prefix}:${e}`;return t.iconLoaded(o)}));return a?`@${s.value}:${a.prefix}:${e}`:e}));function c(e){const l=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return r&&o.src&&!t.iconLoaded(`@${s.value}:${o.prefix}:${o.name}`)&&(n.value=!1,r.fetchIcon(o.src).then((e=>{e&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(o.svg),(l,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,icon:e.unref(d)},{onLoad:l.onLoad}),null,16,["class","onLoad"])):e.createCommentVNode("v-if",!0)}});function ae(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==l?void 0:l.value)===d.before?o.value:void 0)),n=e.computed((()=>(null==l?void 0:l.value)===d.after?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===u.left?o.value:void 0)),i=e.computed((()=>(null==l?void 0:l.value)===u.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===u.top?o.value:void 0)),c=e.computed((()=>(null==l?void 0:l.value)===u.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:r,hasIconRight:i,hasIconTop:s,hasIconBottom:c,hasIconBefore:a,hasIconAfter:n}}const ne=e.defineComponent({components:{VvIcon:oe},props:{inputType:{type:String,default:"input-text"},disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:[String,Object],default:"close"}},emits:["clear"],setup(t,{emit:l}){const{hasIcon:o}=ae(e.computed((()=>t.icon)));return{hasIcon:o,onClick:function(e){null==e||e.stopPropagation(),t.disabled||l("clear")}}},render(){const t=this.hasIcon?e.h(oe,{...this.hasIcon,class:`vv-${this.inputType}__icon`}):void 0;return e.h("button",{disabled:this.disabled,class:`vv-${this.inputType}__action`,ariaLabel:this.label,type:"button",onClick:this.onClick},t)}}),re={...E,value:[String,Number]},ie=e.defineComponent({name:"VvBadge",props:re,setup(t){const l=t,{modifiers:o}=e.toRefs(l),a=le("vv-badge",o);return(t,l)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(a))},[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.value),1)]))],2))}});const ue={...K,...I,...E,...R,...w,...D,iconPosition:{type:String,default:u.left,validator:e=>Object.values(u).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};function se(t,l){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=function(t){const l=e.inject(t,void 0),o=e.computed((()=>void 0!==l));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){const n=null==l?void 0:l[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const r=e.toRef(o,t);return e.computed({get:()=>r.value,set(e){a&&a(`update:${t}`,e)}})}}}(g),{id:r,iconPosition:i,icon:u,label:s,pressed:d}=e.toRefs(t),c=n("modelValue",t,l),v=n("toggle",t),f=n("unselectable",t),p=e.computed((()=>(null==o?void 0:o.multiple.value)??!1)),m=e.computed((()=>{let e=t.modifiers,l=null==o?void 0:o.modifiers.value;const a=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>a.add(e)))),l&&(Array.isArray(l)||(l=l.split(" ")),l.forEach((e=>a.add(e)))),Array.from(a)})),b=e.computed((()=>Boolean(t.disabled||(null==o?void 0:o.disabled.value))));return{group:o,isInGroup:a,modelValue:c,toggle:v,unselectable:f,multiple:p,modifiers:m,disabled:b,id:r,pressed:d,iconPosition:i,icon:u,label:s}}const de=K;const ce=e.defineComponent({name:"VvAction",props:de,emits:["click","mouseover","mouseleave"],setup(t,{expose:l,emit:o}){const a=t,n=o,r=e.getCurrentInstance(),i=te(),u=e.ref(null);l({$el:u});const{reference:s,bus:d,aria:c,expanded:f}=e.inject(y,{});e.watch((()=>u.value),(e=>{s&&(s.value=e)}));const p=e.computed((()=>a.pressed||(null==f?void 0:f.value))),{role:m}=e.inject(k,{}),b=e.computed((()=>{switch(!0){case a.disabled:return v.button;case void 0!==a.to:return(null==i?void 0:i.nuxt)?e.resolveComponent(v.nuxtLink):v.routerLink;case void 0!==a.href:return v.a;default:return a.defaultTag}})),g=e.computed((()=>{const e={...null==c?void 0:c.value,ariaPressed:!!p.value||void 0,ariaLabel:a.ariaLabel,role:null==m?void 0:m.value};switch(b.value){case v.a:return{...e,href:a.href,target:a.target,rel:a.rel};case v.routerLink:case v.nuxtLink:return{...e,to:a.to,target:a.target};case v.button:return{...e,type:a.type,disabled:a.disabled};default:return e}}));function h(e){var t;a.disabled?e.preventDefault():(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onClick)?n("click",e):null==d||d.emit("click",e)}function S(e){var t;(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onMouseover)?n("mouseover",e):null==d||d.emit("mouseover",e)}function B(e){var t;(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onMouseleave)?n("mouseleave",e):null==d||d.emit("mouseleave",e)}return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.mergeProps(e.unref(g),{ref_key:"element",ref:u,class:{active:t.active,pressed:e.unref(p),disabled:t.disabled,current:t.current},onClickPassive:h,onMouseoverPassive:S,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function ve(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}const fe={key:1,class:"vv-button__label"},pe={key:1,class:"vv-button__label"},me=e.defineComponent({name:"VvButton",inheritAttrs:!1,props:ue,emits:["update:modelValue"],setup(t,{expose:l,emit:o}){const a=t,n=o,r=e.useAttrs(),i=e.useSlots(),{id:s,modifiers:d,iconPosition:c,icon:v,label:f,modelValue:p,disabled:m,toggle:b,unselectable:g}=se(a,n),y=ve(s),h=e.computed((()=>(null==r?void 0:r.name)||y.value)),k=e.ref(null);l({$el:e.computed((()=>{var e;return null==(e=k.value)?void 0:e.$el}))});const S=e.computed((()=>b.value?Array.isArray(p.value)?Y(h.value,p.value):Q(h.value,p.value):a.pressed)),B=le("vv-button",d,e.computed((()=>({reverse:[u.right,u.bottom].includes(c.value),column:[u.top,u.bottom].includes(c.value),"icon-only":Boolean((null==v?void 0:v.value)&&!(null==f?void 0:f.value)&&!i.default)})))),{hasIcon:V}=ae(v),w=e.computed((()=>void 0!==a.value?a.value:h.value)),x=e.computed((()=>{if(b.value)return{onClick:L}}));function L(){if(b.value){if(Array.isArray(p.value))return Y(w.value,p.value)?void(g.value&&(p.value=p.value.filter((e=>e!==w.value)))):void p.value.push(w.value);if(w.value===p.value&&g.value)return void(p.value=a.uncheckedValue);p.value=w.value}}return(t,l)=>(e.openBlock(),e.createBlock(ce,e.mergeProps({...e.unref(r),...e.unref(x),disabled:e.unref(m),pressed:e.unref(S),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(y),ref_key:"element",ref:k,class:e.unref(B)}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(oe,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",fe,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(V)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:0},e.unref(V),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(f)?(e.openBlock(),e.createElementBlock("span",pe,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}}),be={...I,...z,...E,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:p.menu,validator:e=>Object.values(p).includes(e)}},ge={focusOnHover:{type:Boolean,default:!1}},ye={...x,...C,...R,...E,deselectHintLabel:{type:String},selectHintLabel:{type:String},selectedHintLabel:{type:String},focusOnHover:{type:Boolean,default:!1}};const he=["id","tabindex","role","aria-labelledby"],ke=e.defineComponent({name:"VvDropdown",inheritAttrs:!1,props:be,emits:["update:modelValue","beforeEnter","afterLeave","beforeExpand","beforeCollapse","afterExpand","afterCollapse","before-enter","after-leave","enter","afterEnter","enterCancelled","beforeLeave","leave","leaveCancelled"],setup(t,{expose:n,emit:r}){const s=t,d=r,{id:c}=e.toRefs(s),v=ve(c),f=e.useAttrs(),b=e.ref("auto"),g=e.ref("auto"),k=e.ref(),S=e.ref(),B=e.ref(),V=e.ref(),w=e.computed({get:()=>s.reference??k.value,set:e=>{k.value=e}}),x=e.ref(!1);e.onMounted((()=>{o.useMutationObserver(S.value,(()=>{var e;x.value="true"===(null==(e=window.getComputedStyle(S.value).getPropertyValue("--dropdown-custom-position"))?void 0:e.trim())}),{attributeFilter:["style"],window:window})}));const L=e.computed((()=>{const e=[];if(s.autoPlacement?"boolean"==typeof s.autoPlacement?e.push(l.autoPlacement()):e.push(l.autoPlacement(s.autoPlacement)):s.flip&&("boolean"==typeof s.flip?e.push(l.flip({fallbackStrategy:"initialPlacement"})):e.push(l.flip(s.flip))),s.shift&&("boolean"==typeof s.shift?e.push(l.shift()):e.push(l.shift(s.shift))),s.size){const t=({availableWidth:e,availableHeight:t})=>{b.value=`${e}px`,g.value=`${t}px`};"boolean"==typeof s.size?e.push(l.size({apply:t})):e.push(l.size({...s.size,apply:t}))}return s.offset&&(e.push(l.offset(Number(s.offset))),["string","number"].includes(typeof s.offset)?e.push(l.offset(Number(s.offset))):e.push(l.offset(s.offset))),s.arrow&&e.push(l.arrow({element:B})),e})),{x:C,y:P,middlewareData:O,placement:$,strategy:N}=l.useFloating(w,S,{whileElementsMounted:(...e)=>l.autoUpdate(...e,{animationFrame:s.strategy===i.fixed}),placement:e.computed((()=>s.placement)),strategy:e.computed((()=>s.strategy)),middleware:L}),_=e.computed((()=>{var e;if(x.value)return;const t=s.triggerWidth&&w.value?`${null==(e=w.value)?void 0:e.offsetWidth}px`:void 0;return{position:N.value,top:`${P.value??0}px`,left:`${C.value??0}px`,maxWidth:t?void 0:b.value,maxHeight:g.value,width:t}})),E=e.computed((()=>$.value.split("-")[0])),A=e.computed((()=>{var e,t,l,o,a;if(x.value)return;const n={[u.top]:u.bottom,[u.right]:u.left,[u.bottom]:u.top,[u.left]:u.right}[E.value];return{left:void 0!==(null==(e=O.value.arrow)?void 0:e.x)?`${null==(t=O.value.arrow)?void 0:t.x}px`:void 0,top:void 0!==(null==(l=O.value.arrow)?void 0:l.y)?`${null==(o=O.value.arrow)?void 0:o.y}px`:void 0,[n]:-((null==(a=B.value)?void 0:a.offsetWidth)??0)/2+"px"}})),F=o.useVModel(s,"modelValue",d),D=e.ref(!1),H=e.computed({get:()=>F.value??D.value,set:e=>{void 0!==F.value?F.value=e:D.value=e}});function j(){H.value=!0}function R(){H.value=!1}function I(){H.value=!H.value}function z(e){w.value=e}n({toggle:I,show:j,hide:R,init:z,customPosition:x}),e.watch(H,(t=>{t&&s.autofocusFirst&&e.nextTick((()=>{const e=Q(S.value);e.length>0&&e[0].focus({preventScroll:!0})}))})),o.onClickOutside(S,(()=>{!s.keepOpen&&H.value&&(H.value=!1)}),{ignore:[w]});const T=e.computed((()=>{var e,t;return(null==(t=null==(e=w.value)?void 0:e.getAttribute)?void 0:t.call(e,"id"))??void 0})),M=e.computed((()=>({"aria-controls":v.value,"aria-haspopup":!0,"aria-expanded":H.value}))),{component:q,bus:K}=function({reference:t,id:l,expanded:o,aria:n}){const r=a(),i=e.defineComponent({name:"VvDropdownTriggerProvider",setup(){e.provide(y,{reference:t,id:l,expanded:o,aria:n,bus:r})},render(){var t,l;return e.h(e.Fragment,{},null==(l=(t=this.$slots).default)?void 0:l.call(t))}});return{bus:r,component:i}}({reference:w,id:v,expanded:H,aria:M});K.on("click",I);const{role:W,modifiers:G}=e.toRefs(s),J=le("vv-dropdown",G,e.computed((()=>({arrow:s.arrow})))),{focused:U}=o.useFocusWithin(S);function Q(e){return e?[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden"))):[]}const X=o.useElementHover(S),{itemRole:Y}=function({role:t,...l}){const o=e.computed((()=>t.value===p.listbox?m.option:m.presentation));return e.provide(h,{role:o,...l}),{itemRole:o}}({role:W,expanded:H,focused:U,hovered:X});o.onKeyStroke("Escape",(e=>{H.value&&(e.preventDefault(),R())})),o.onKeyStroke("ArrowDown",(t=>{H.value&&U.value&&(t.preventDefault(),e.nextTick((()=>{if(U.value){const e=Q(S.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t<e.length-1?e[t+1].focus({preventScroll:!0}):e[0].focus({preventScroll:!0})}})))})),o.onKeyStroke("ArrowUp",(t=>{H.value&&U.value&&(t.preventDefault(),e.nextTick((()=>{if(U.value){const e=Q(S.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t>0?e[t-1].focus({preventScroll:!0}):e[e.length-1].focus({preventScroll:!0})}})))})),o.onKeyStroke([" ","Enter"],(e=>{const t=e.target;H.value&&U.value&&t&&(null==t||t.click())}));const Z={"before-enter":()=>{d(H.value?"beforeExpand":"beforeCollapse"),d("beforeEnter")},"after-leave":()=>{d(H.value?"afterExpand":"afterCollapse"),d("afterLeave")},enter:()=>{d("enter")},"after-enter":()=>{d("afterEnter")},"enter-cancelled":()=>{d("enterCancelled")},"before-leave":()=>{d("beforeLeave")},leave:()=>{d("leave")},"leave-cancelled":()=>{d("leaveCancelled")}};return(t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(q),null,{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps({init:z,show:j,hide:R,toggle:I,expanded:e.unref(H),aria:e.unref(M)})))])),_:3}),e.createVNode(e.Transition,e.mergeProps({name:t.transitionName},e.toHandlers(Z),{persisted:""}),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:S,style:e.normalizeStyle(e.unref(_)),class:e.normalizeClass(e.unref(J))},[s.arrow?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"arrowEl",ref:B,style:e.normalizeStyle(e.unref(A)),class:"vv-dropdown__arrow"},null,4)):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(H)}))),e.createElementVNode("div",e.mergeProps(e.unref(f),{id:e.unref(v),ref_key:"listEl",ref:V,tabindex:e.unref(H)?void 0:-1,role:e.unref(W),"aria-labelledby":e.unref(T),class:"vv-dropdown__list"}),[e.renderSlot(t.$slots,"items",e.normalizeProps(e.guardReactiveProps({role:e.unref(Y)})))],16,he),e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(H)})))],6),[[e.vShow,e.unref(H)]])])),_:3},16,["name"])],64))}}),Se={class:"vv-dropdown-optgroup",role:"presentation",tabindex:"-1"},Be=e.defineComponent({name:"VvDropdownOptgroup",props:{...N},setup(t){const l=t;return(t,o)=>(e.openBlock(),e.createElementBlock("li",Se,e.toDisplayString(l.label),1))}}),Ve=e.defineComponent({name:"VvDropdownItem",props:ge,setup(t){const l=t,{role:a,expanded:n}=e.inject(h,{}),r=e.ref(null);!function({expanded:t}){e.provide(k,{role:e.ref(f.menuitem),expanded:t})}({expanded:n});const i=o.useElementHover(r),{focused:u}=o.useFocus(r),{focused:s}=o.useFocusWithin(r);return e.watch(i,(e=>{e&&l.focusOnHover&&(u.value=!0)})),(t,l)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({role:e.unref(a)},{ref_key:"element",ref:r,class:["vv-dropdown__item",{"focus-visible":e.unref(u)||e.unref(s)}]}),[e.renderSlot(t.$slots,"default")],16))}}),we=["title"],xe=e.defineComponent({name:"VvDropdownOption",props:ye,setup(t){const l=t,{modifiers:o}=e.toRefs(l),a=le("vv-dropdown-option",o,e.computed((()=>({disabled:l.disabled,selected:l.selected,unselectable:l.unselectable&&l.selected})))),n=e.computed((()=>l.selected?l.unselectable?l.deselectHintLabel:l.selectedHintLabel:l.disabled?"":l.selectHintLabel));return(t,l)=>(e.openBlock(),e.createBlock(Ve,{class:e.normalizeClass(e.unref(a)),tabindex:t.disabled?-1:0,"aria-selected":t.selected,"aria-disabled":t.disabled,"focus-on-hover":t.focusOnHover},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default"),e.createElementVNode("span",{class:"vv-dropdown-option__hint",title:e.unref(n)},[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps({disabled:t.disabled,selected:t.selected,unselectable:t.unselectable})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)),1)]))],8,we)])),_:3},8,["class","tabindex","aria-selected","aria-disabled","focus-on-hover"]))}}),Le={...T,...M,...q,...H,...B,...V,...A,...w,...x,..._,...E,...F,...D,...j,...R,...N,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},autoselectFirst:{type:Boolean,default:!1},placeholder:String,iconClear:{type:[String,Object],default:W},labelClear:{type:String,default:"Clear"}};function Ce(){return{...Le,options:{...Le.options,type:Array,default:()=>[]}}}function Pe(t,l,o){const a=te(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];if(a.length){a[0]===n&&(l[o]=e[o])}}if("function"==typeof t[o]){(0,t[o])()===n&&(l[o]=e[o])}if("object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}function Oe(t,l){const{focused:a}=o.useFocus(t);return e.watch(a,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:a}}function $e(t){const{options:l,labelKey:o,valueKey:a,disabledKey:r}=e.toRefs(t);return{options:l,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof o.value?o.value(e):String(o.value?n.get(e,o.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof a.value?a.value(e):a.value?n.get(e,a.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof r.value?r.value(e):!!r.value&&n.get(e,r.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}const Ne=["for"],_e={class:"vv-select__wrapper"},Ee={key:0,class:"vv-select__input-before"},Ae={class:"vv-select__inner"},Fe=["id"],De=["disabled","hidden"],He=["disabled","value"],je=["disabled","label"],Re=["disabled","value"],Ie={key:2,class:"vv-select__input-after"},ze=e.defineComponent({name:"VvSelect",props:Ce(),emits:["update:modelValue","focus","blur","clear"],setup(t,{emit:l}){const a=t,n=l,r=e.useSlots(),i=Pe("VvSelect",Ce(),a),u=e.ref(),{HintSlot:s,hasHintLabelOrSlot:d,hasInvalidLabelOrSlot:c,hintSlotScope:v}=ee(i,r),{focused:f}=Oe(u,n);function p(e){var t;return"string"!=typeof e&&(null==(t=e.options)?void 0:t.length)}const{id:m,modifiers:b,disabled:g,readonly:y,loading:h,icon:k,iconPosition:S,invalid:B,valid:V,floating:w,multiple:x}=e.toRefs(a),L=ve(m),C=e.computed((()=>`${L.value}-hint`)),P=e.computed((()=>a.disabled||a.readonly)),O=e.computed((()=>P.value?-1:a.tabindex)),$=e.computed({get:()=>a.modelValue,set:e=>{Array.isArray(e)&&0===(e=e.filter((e=>void 0!==e))).length&&!a.unselectable&&u.value?u.value.value=String(a.modelValue):n("update:modelValue",e)}}),N=e.computed((()=>Array.isArray($.value)?$.value.length>0:void 0!==$.value&&null!==$.value)),_=e.computed((()=>!P.value&&a.unselectable)),E=o.useElementVisibility(u);e.watch(E,(e=>{e&&a.autofocus&&(f.value=!0)}));const{hasIconBefore:A,hasIconAfter:F}=ae(k,S),D=e.computed((()=>!0===a.invalid||!0!==a.valid&&void 0)),H=le("vv-select",b,e.computed((()=>({valid:V.value,invalid:B.value,loading:h.value,disabled:g.value,readonly:y.value,"icon-before":void 0!==A.value,"icon-after":void 0!==F.value,dirty:N.value,focus:f.value&&!P.value,floating:w.value,multiple:x.value})))),{getOptionLabel:j,getOptionValue:R,isOptionDisabled:I,getOptionGrouped:z}=$e(a);function T(){Array.isArray($.value)?$.value=[]:$.value=void 0,n("clear")}e.watch((()=>a.options),(e=>{if((null==e?void 0:e.length)&&a.autoselectFirst&&!N.value){const t=R(e[0]);$.value=a.multiple?[t]:t}}),{immediate:!0});const M=e.computed((()=>({name:a.name,tabindex:O.value,disabled:P.value,required:a.required,size:a.size,autocomplete:a.autocomplete,multiple:a.multiple,"aria-invalid":D.value,"aria-describedby":d.value?C.value:void 0,"aria-errormessage":c.value?C.value:void 0}))),q=e.computed((()=>({valid:a.valid,invalid:a.invalid,modelValue:a.modelValue})));return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(H))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(L)},e.toDisplayString(t.label),9,Ne)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",_e,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(q))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Ae,[e.unref(A)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:0},e.unref(A),{class:"vv-select__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(L),ref_key:"selectEl",ref:u},e.unref(M),{"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef($)?$.value=t:null)}),[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!e.unref(_),hidden:!e.unref(_)},e.toDisplayString(t.placeholder),9,De)):e.createCommentVNode("v-if",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,((t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[p(t)?(e.openBlock(),e.createElementBlock("optgroup",{key:`group-${l}`,disabled:e.unref(I)(t),label:e.unref(j)(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(z)(t),((t,o)=>(e.openBlock(),e.createElementBlock("option",{key:`group-${l}-item-${o}`,disabled:e.unref(I)(t),value:e.unref(R)(t)},e.toDisplayString(e.unref(j)(t)),9,Re)))),128))],8,je)):(e.openBlock(),e.createElementBlock("option",{key:l,disabled:e.unref(I)(t),value:e.unref(R)(t)},e.toDisplayString(e.unref(j)(t)),9,He))],64)))),256))],16,Fe),[[e.vModelSelect,e.unref($)]]),e.unref(F)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:1},e.unref(F),{class:"vv-select__icon vv-select__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),e.unref(_)?(e.openBlock(),e.createBlock(e.unref(ne),{key:1,"input-type":"select",label:t.labelClear,icon:t.iconClear,disabled:!e.unref(N),onClear:T},null,8,["label","icon","disabled"])):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",Ie,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(q))))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(s),{id:e.unref(C),class:"vv-select__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(v))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(v))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(v))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(v))))])),key:"3"}:void 0]),1032,["id"])],2))}}),Te=["id"],Me=["id","for"],qe=["id","aria-controls","placeholder"],Ke={key:0,class:"vv-select__input-before"},We={class:"vv-select__inner"},Ge=["aria-controls","aria-expanded","aria-labelledby","aria-describedby","aria-errormessage","tabindex"],Je={key:0,class:"vv-select__value"},Ue=["aria-label","onClick"],Qe={key:2,class:"vv-select__input-after"},Xe={name:"VvCombobox",components:{VvDropdown:ke,VvDropdownOption:xe,VvDropdownOptgroup:Be,VvButton:me}};return e.defineComponent({...Xe,props:U(),emits:["update:modelValue","update:search","focus","blur","clear","change:search"],setup(t,{emit:l}){const a=t,n=l,r=e.useSlots(),i=Pe("VvCombobox",U(),a),u=e.ref(null),s=e.ref(null),d=e.ref(null),c=e.ref(),{HintSlot:v,hasHintLabelOrSlot:f,hasInvalidLabelOrSlot:m,hintSlotScope:b}=ee(i,r),{focused:g}=Oe(u,n),{focused:y}=o.useFocusWithin(d);e.watch(g,(e=>{a.autoOpen&&(!e||S.value?e||!S.value||y.value||w():V())})),e.watch(y,(e=>{g.value||e||!S.value||w()}));const h=e.ref(""),k=o.refDebounced(h,e.computed((()=>Number(a.debounceSearch))));e.watch(k,(()=>{n("update:search",k.value),n("change:search",k.value)}));const S=e.ref(!1);function B(){q.value||(S.value=!S.value)}function V(){q.value||S.value||(S.value=!0)}function w(){!q.value&&S.value&&(S.value=!1)}function x(){i.value.searchable&&s.value&&s.value.focus({preventScroll:!0})}function L(){i.value.searchable&&(h.value="")}function C(e){var t;return"string"!=typeof e&&(null==(t=e.options)?void 0:t.length)}const{id:P,icon:O,iconPosition:$,modifiers:N,disabled:_,required:E,readonly:A,loading:F,valid:D,invalid:H,floating:j}=e.toRefs(a),R=ve(P),I=e.computed((()=>`${R.value}-hint`)),z=e.computed((()=>`${R.value}-dropdown`)),T=e.computed((()=>`${R.value}-search`)),M=e.computed((()=>`${R.value}-label`)),q=e.computed((()=>a.disabled||a.readonly)),K=e.computed((()=>q.value?-1:a.tabindex)),W=e.computed({get:()=>Array.isArray(a.modelValue)?a.modelValue:void 0!==a.modelValue&&null!==a.modelValue?[a.modelValue]:[],set:e=>{n("update:modelValue",a.multiple||Array.isArray(a.modelValue)?e:e.pop())}}),G=e.computed((()=>W.value.length)),J=e.computed((()=>G.value>0)),Q=e.computed((()=>a.multiple?void 0===a.maxValues?1/0:Number(a.maxValues):1)),X=e.computed((()=>!q.value&&(!!a.unselectable&&(0===Number(a.minValues)||G.value>Number(a.minValues))))),Y=e.computed((()=>!q.value&&(!a.multiple||G.value<Q.value))),Z=e.ref(!1),te=e.computed((()=>Z.value||F.value)),{hasIconBefore:re,hasIconAfter:ue}=ae(O,$),se=le("vv-select",N,e.computed((()=>({disabled:_.value,required:E.value,loading:te.value,readonly:A.value,"icon-before":void 0!==re.value,"icon-after":void 0!==ue.value,valid:D.value,invalid:H.value,dirty:J.value,focus:(g.value||y.value||S.value)&&!q.value,floating:j.value,badges:a.badges})))),{getOptionLabel:de,getOptionValue:ce,getOptionGrouped:fe,isOptionDisabled:pe}=$e(a);function be(e){return pe(e)||!Y.value&&!ye(e)}const ge=o.computedAsync((async()=>{var e;if(i.value.searchFunction){Z.value=!0;const e=await Promise.resolve(i.value.searchFunction(k.value,a.options));return Z.value=!1,e}return null==(e=a.options)?void 0:e.filter((e=>de(e).toLowerCase().includes(k.value.toLowerCase().trim())))}));function ye(e){const t=ce(e);return"object"==typeof t?W.value.some((e=>"object"==typeof e&&JSON.stringify(e)===JSON.stringify(t))):W.value.includes(t)}const he=e.computed((()=>a.options.reduce(((e,t)=>C(t)?[...e,...fe(t)]:[...e,t]),[]).filter((e=>ye(e))))),Se=e.computed((()=>he.value.map((e=>de(e))).join(a.separator)));function Ve(){a.autoOpen?V():B()}function we(e){const t=ye(e),l=ce(e);t&&X.value?W.value=W.value.filter((e=>"object"==typeof l&&"object"==typeof e?JSON.stringify(e)!==JSON.stringify(l):e!==l)):!t&&Y.value&&(a.multiple?W.value=[...W.value,l]:W.value=[l]),a.multiple||a.keepOpen||w()}function Le(){W.value=[],n("update:search",""),n("clear")}e.watch((()=>a.options),(e=>{(null==e?void 0:e.length)&&a.autoselectFirst&&!J.value&&we(e[0])}),{immediate:!0});const Ce=e.computed((()=>({id:R.value,name:a.name,tabindex:K.value,valid:D.value,validLabel:i.value.validLabel,invalid:H.value,invalidLabel:i.value.invalidLabel,hintLabel:i.value.hintLabel,loading:te.value,loadingLabel:i.value.loadingLabel,disabled:_.value,readonly:A.value,modifiers:i.value.modifiers,options:i.value.options,labelKey:i.value.labelKey,valueKey:i.value.valueKey,icon:i.value.icon,iconPosition:i.value.iconPosition,floating:i.value.floating,unselectable:X.value,autoselectFirst:i.value.autoselectFirst,multiple:i.value.multiple,label:i.value.label,placeholder:i.value.placeholder,modelValue:a.modelValue}))),Ne=e.computed((()=>({id:z.value,reference:d.value,placement:i.value.placement,strategy:i.value.strategy,transitionName:i.value.transitionName,offset:i.value.offset,shift:i.value.shift,flip:i.value.flip,autoPlacement:i.value.autoPlacement,arrow:i.value.arrow,autofocusFirst:!!i.value.searchable||i.value.autofocusFirst,triggerWidth:i.value.triggerWidth,modifiers:i.value.dropdownModifiers}))),_e=e.computed((()=>({valid:a.valid,invalid:a.invalid,modelValue:a.modelValue})));return o.onKeyStroke([" ","Enter"],(e=>{a.autoOpen||!S.value&&g.value&&(e.preventDefault(),e.stopImmediatePropagation(),B())}),{target:u}),(t,l)=>t.native?(e.openBlock(),e.createBlock(ze,e.mergeProps({key:1},e.unref(Ce),{"onUpdate:modelValue":l[3]||(l[3]=e=>n("update:modelValue",e))}),null,16)):(e.openBlock(),e.createElementBlock("div",{key:0,id:e.unref(R),class:e.normalizeClass(e.unref(se))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,id:e.unref(M),for:e.unref(i).searchable?e.unref(T):void 0},e.toDisplayString(t.label),9,Me)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{ref_key:"wrapperEl",ref:d,class:"vv-select__wrapper"},[e.createVNode(ke,e.mergeProps({ref_key:"dropdownEl",ref:c,modelValue:e.unref(S),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(S)?S.value=t:null)},e.unref(Ne),{role:e.unref(p).listbox,onAfterExpand:x,onAfterCollapse:L}),e.createSlots({default:e.withCtx((({aria:l})=>[t.$slots.before?(e.openBlock(),e.createElementBlock("div",Ke,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(_e))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",We,[e.unref(re)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:0},e.unref(re),{class:"vv-select__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",e.mergeProps({ref_key:"inputEl",ref:u},l,{class:"vv-select__input",role:"combobox","aria-controls":e.unref(z),"aria-expanded":e.unref(S),"aria-labelledby":e.unref(M),"aria-describedby":e.unref(f)?e.unref(I):void 0,"aria-errormessage":e.unref(m)?e.unref(I):void 0,tabindex:e.unref(K),onClickPassive:Ve}),[e.renderSlot(t.$slots,"value",e.normalizeProps(e.guardReactiveProps({selectedOptions:e.unref(he),onInput:we})),(()=>[e.unref(Se)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.badges?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(he),((l,o)=>(e.openBlock(),e.createBlock(ie,{key:o,modifiers:t.badgeModifiers,class:"vv-select__badge"},{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(e.unref(de)(l))+" ",1),e.unref(X)?(e.openBlock(),e.createElementBlock("button",{key:0,"aria-label":e.unref(i).deselectActionLabel,type:"button",onClick:e.withModifiers((e=>we(l)),["stop"])},[e.createVNode(oe,{name:"close"})],8,Ue)):e.createCommentVNode("v-if",!0)])),_:2},1032,["modifiers"])))),128)):(e.openBlock(),e.createElementBlock("div",Je,e.toDisplayString(e.unref(Se)),1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.placeholder),1)],64))]))],16,Ge),e.unref(ue)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:1},e.unref(ue),{class:"vv-select__icon vv-select__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),e.unref(X)?(e.openBlock(),e.createBlock(e.unref(ne),{key:1,"input-type":"select",label:t.labelClear,icon:t.iconClear,disabled:!e.unref(J),onClear:Le},null,8,["label","icon","disabled"])):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",Qe,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(_e))))])):e.createCommentVNode("v-if",!0)])),items:e.withCtx((()=>{var l;return[!e.unref(_)&&(null==(l=e.unref(ge))?void 0:l.length)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(ge),((l,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[C(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Be,{label:e.unref(de)(l)},null,8,["label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(fe)(l),((o,a)=>(e.openBlock(),e.createBlock(xe,e.mergeProps({ref_for:!0},{selected:ye(o),disabled:be(o),unselectable:e.unref(X),deselectHintLabel:e.unref(i).deselectHintLabel,selectHintLabel:e.unref(i).selectHintLabel,selectedHintLabel:e.unref(i).selectedHintLabel,focusOnHover:t.focusOnHover},{key:a,class:"vv-dropdown-option",onClickPassive:e=>we(o)}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"option",e.mergeProps({ref_for:!0},{option:l,selectedOptions:e.unref(he),selected:ye(o),disabled:be(o)}),(()=>[e.createTextVNode(e.toDisplayString(e.unref(de)(o)),1)]))])),_:2},1040,["onClickPassive"])))),128))],64)):(e.openBlock(),e.createBlock(xe,e.mergeProps({key:1,ref_for:!0},{selected:ye(l),disabled:be(l),unselectable:e.unref(X),deselectHintLabel:e.unref(i).deselectHintLabel,selectHintLabel:e.unref(i).selectHintLabel,selectedHintLabel:e.unref(i).selectedHintLabel,focusOnHover:t.focusOnHover},{class:"vv-dropdown-option",onClickPassive:e=>we(l)}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"option",e.mergeProps({ref_for:!0},{option:l,selectedOptions:e.unref(he),selected:ye(l),disabled:be(l)}),(()=>[e.createTextVNode(e.toDisplayString(e.unref(de)(l)),1)]))])),_:2},1040,["onClickPassive"]))],64)))),128)):t.options.length?e.unref(_)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(xe,{key:2,modifiers:"inert"},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"no-results",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(i).noResultsLabel),1)]))])),_:3})):(e.openBlock(),e.createBlock(xe,{key:1,modifiers:"inert"},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"no-options",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(i).noOptionsLabel),1)]))])),_:3}))]})),after:e.withCtx((()=>[e.renderSlot(t.$slots,"dropdown::after",{},(()=>{var t;return[(null==(t=e.unref(c))?void 0:t.customPosition)?(e.openBlock(),e.createBlock(me,{key:0,label:e.unref(i).closeLabel,modifiers:"secondary",onClick:l[1]||(l[1]=t=>e.unref(c).hide())},null,8,["label"])):e.createCommentVNode("v-if",!0)]}))])),_:2},[e.unref(i).searchable||t.$slots["dropdown::before"]?{name:"before",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"dropdown::before"),e.unref(i).searchable&&!e.unref(_)?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,id:e.unref(T),ref_key:"inputSearchEl",ref:s,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(h)?h.value=t:null),"aria-autocomplete":"list","aria-controls":e.unref(z),autocomplete:"off",spellcheck:"false",type:"search",class:"vv-dropdown__search",placeholder:e.unref(i).searchPlaceholder},null,8,qe)),[[e.vModelText,e.unref(h)]]):e.createCommentVNode("v-if",!0)])),key:"0"}:void 0]),1040,["modelValue","role"])],512),e.createVNode(e.unref(v),{id:e.unref(I),class:"vv-select__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"3"}:void 0]),1032,["id"])],10,Te))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@floating-ui/vue"),require("@vueuse/core"),require("mitt"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@floating-ui/vue","@vueuse/core","mitt","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCombobox=t(e.vue,e.vue$1,e.vue$2,e.core,e.mitt,e.tsDotProp)}(this,(function(e,t,l,o,a,n){"use strict";const r={prefix:"normal"};var i=(e=>(e.local="local",e.session="session",e))(i||{}),u=(e=>(e.absolute="absolute",e.fixed="fixed",e))(u||{}),s=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(s||{}),d=(e=>(e.topStart="top-start",e.topEnd="top-end",e.bottomStart="bottom-start",e.bottomEnd="bottom-end",e.leftStart="left-start",e.leftEnd="left-end",e.rightStart="right-start",e.rightEnd="right-end",e))(d||{}),c=(e=>(e.before="before",e.after="after",e))(c||{}),v=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(v||{}),f=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(f||{}),p=(e=>(e.button="button",e.link="link",e.menuitem="menuitem",e))(p||{}),m=(e=>(e.listbox="listbox",e.menu="menu",e))(m||{}),b=(e=>(e.option="option",e.presentation="presentation",e))(b||{});const g=Symbol.for("volver"),y=Symbol.for("buttonGroup"),h=Symbol.for("dropdownTrigger"),k=Symbol.for("dropdownItem"),S=Symbol.for("dropdownAction"),B={to:{type:[String,Object]},href:String,target:String,rel:{type:String,default:"noopener noreferrer"}},w={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},V={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},x={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},L={disabled:{type:Boolean,default:!1}},C={required:{type:Boolean,default:!1}},P={selected:{type:Boolean,default:!1}},O={active:{type:Boolean,default:!1}},$={current:{type:Boolean,default:!1}},N={showClearAction:{type:Boolean,default:!1},iconClear:{type:[String,Object],default:"close"},labelClear:{type:String,default:"Clear"}},_={pressed:{type:Boolean,default:!1}},E={label:{type:[String,Number],default:void 0}},A={readonly:{type:Boolean,default:!1}},F={modifiers:{type:[String,Array],default:void 0}},D={hintLabel:{type:String,default:""}},H={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},j={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:c.before,validation:e=>Object.values(c).includes(e)}},R={tabindex:{type:[String,Number],default:0}},I={floating:{type:Boolean,default:!1}},z={unselectable:{type:Boolean,default:!0}},T={id:[String,Number]},M={placement:{type:String,default:s.bottom,validator:e=>Object.values(s).includes(e)||Object.values(d).includes(e)},strategy:{type:String,default:void 0,validator:e=>Object.values(u).includes(e)},transitionName:{type:String,default:void 0},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean,default:!1}},K={...T,name:{type:String,required:!0}},q={autofocus:{type:Boolean,default:!1}},W={autocomplete:{type:String,default:"off"}},G={...L,...E,..._,...O,...$,...B,type:{type:String,default:v.button,validator:e=>Object.values(v).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:f.button}};i.local;const J={...K,...R,...w,...V,...D,...x,...L,...A,...F,...H,...j,...I,...M,...E,...C,...N,transitionName:{type:String,default:"vv-dropdown--mobile-fade-block"},modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},noResultsLabel:{type:String,default:"No results"},noOptionsLabel:{type:String,default:"No options available"},selectedHintLabel:{type:String,default:"Selected"},deselectActionLabel:{type:String,default:"Deselect"},selectHintLabel:{type:String,default:"Press enter to select"},deselectHintLabel:{type:String,default:"Press enter to remove"},addOptionHintLabel:{type:String,default:"Press enter to add"},closeLabel:{type:String,default:"Close"},placeholder:String,addable:Boolean,searchable:Boolean,searchFunction:{type:Function,default:void 0},searchPlaceholder:{type:String,default:"Search..."},debounceSearch:{type:[Number,String],default:0},multiple:Boolean,minValues:{type:[Number,String],default:0},maxValues:[Number,String],unselectable:{type:Boolean,default:!0},separator:{type:String,default:", "},native:Boolean,badges:Boolean,badgeModifiers:{type:[String,Array],default:"action sm"},triggerWidth:{...M.triggerWidth,default:!0},dropdownModifiers:{type:[String,Array],default:"mobile"},autoOpen:{type:Boolean,default:!1},autoselectFirst:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},focusOnHover:{type:Boolean,default:!0}};function U(){return{...J,options:{...J.options,type:Array},searchFunction:{...J.searchFunction,type:Function}}}function Q(e,t,l){return X(e,t)}function X(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,r;if(l&&o){if(n=e.length,n!==t.length)return!1;for(a=n;0!==a--;)if(!X(e[a],t[a]))return!1;return!0}if(l!==o)return!1;const i=e instanceof Date,u=t instanceof Date;if(i!==u)return!1;if(i&&u)return e.getTime()===t.getTime();const s=e instanceof RegExp,d=t instanceof RegExp;if(s!==d)return!1;if(s&&d)return e.toString()===t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(a=n;0!==a--;)if(!Object.prototype.hasOwnProperty.call(t,c[a]))return!1;for(a=n;0!==a--;)if(r=c[a],!X(e[r],t[r]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function Y(e,t){if(null!=e&&t&&t.length)for(const l of t)if(Q(e,l))return!0;return!1}function Z(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}function ee(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>Z(o.value.invalidLabel))),n=e.computed((()=>Z(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),i=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.value)))),s=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),d=e.computed((()=>!u.value&&!s.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!u.value&&!s.value&&!d.value&&Boolean(l.hint||i.value))),v=e.computed((()=>s.value||d.value||u.value||c.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:i,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,r,i,u;if(this.isVisible){let s;return this.hasInvalidLabelOrSlot&&(s="alert"),this.hasValidLabelOrSlot&&(s="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:s},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:s},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:s},(null==(r=(n=this.$slots).valid)?void 0:r.call(n))??this.validLabel):e.h(this.tag,{role:s},(null==(u=(i=this.$slots).hint)?void 0:u.call(i))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}function te(){return e.inject(g,void 0)}function le(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const oe=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},r),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),n=e.ref(!0),r=te(),{modifiers:i}=e.toRefs(o),u=le("vv-icon",i),s=e.computed((()=>o.provider||(null==r?void 0:r.iconsProvider))),d=e.computed((()=>{const e=o.name??"",l=`@${s.value}:${o.prefix}:${e}`;if(t.iconLoaded(l))return l;const a=null==r?void 0:r.iconsCollections.find((l=>{const o=`@${s.value}:${l.prefix}:${e}`;return t.iconLoaded(o)}));return a?`@${s.value}:${a.prefix}:${e}`:e}));function c(e){const l=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return r&&o.src&&!t.iconLoaded(`@${s.value}:${o.prefix}:${o.name}`)&&(n.value=!1,r.fetchIcon(o.src).then((e=>{e&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(o.svg),(l,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,icon:e.unref(d)},{onLoad:l.onLoad}),null,16,["class","onLoad"])):e.createCommentVNode("v-if",!0)}});function ae(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==l?void 0:l.value)===c.before?o.value:void 0)),n=e.computed((()=>(null==l?void 0:l.value)===c.after?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===s.left?o.value:void 0)),i=e.computed((()=>(null==l?void 0:l.value)===s.right?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===s.top?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===s.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:r,hasIconRight:i,hasIconTop:u,hasIconBottom:d,hasIconBefore:a,hasIconAfter:n}}const ne=e.defineComponent({components:{VvIcon:oe},props:{inputType:{type:String,default:"input-text"},disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:[String,Object],default:"close"}},emits:["clear"],setup(t,{emit:l}){const{hasIcon:o}=ae(e.computed((()=>t.icon)));return{hasIcon:o,onClick:function(e){null==e||e.stopPropagation(),t.disabled||l("clear")}}},render(){const t=this.hasIcon?e.h(oe,{...this.hasIcon,class:`vv-${this.inputType}__icon`}):void 0;return e.h("button",{disabled:this.disabled,class:`vv-${this.inputType}__action`,ariaLabel:this.label,type:"button",onClick:this.onClick},t)}}),re={...F,value:[String,Number]},ie=e.defineComponent({name:"VvBadge",props:re,setup(t){const l=t,{modifiers:o}=e.toRefs(l),a=le("vv-badge",o);return(t,l)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(a))},[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.value),1)]))],2))}});const ue={...G,...T,...F,...z,...x,...j,iconPosition:{type:String,default:s.left,validator:e=>Object.values(s).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};function se(t,l){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=function(t){const l=e.inject(t,void 0),o=e.computed((()=>void 0!==l));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){const n=null==l?void 0:l[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const r=e.toRef(o,t);return e.computed({get:()=>r.value,set(e){a&&a(`update:${t}`,e)}})}}}(y),{id:r,iconPosition:i,icon:u,label:s,pressed:d}=e.toRefs(t),c=n("modelValue",t,l),v=n("toggle",t),f=n("unselectable",t),p=e.computed((()=>(null==o?void 0:o.multiple.value)??!1)),m=e.computed((()=>{let e=t.modifiers,l=null==o?void 0:o.modifiers.value;const a=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>a.add(e)))),l&&(Array.isArray(l)||(l=l.split(" ")),l.forEach((e=>a.add(e)))),Array.from(a)})),b=e.computed((()=>Boolean(t.disabled||(null==o?void 0:o.disabled.value))));return{group:o,isInGroup:a,modelValue:c,toggle:v,unselectable:f,multiple:p,modifiers:m,disabled:b,id:r,pressed:d,iconPosition:i,icon:u,label:s}}const de=G;const ce=e.defineComponent({name:"VvAction",props:de,emits:["click","mouseover","mouseleave"],setup(t,{expose:l,emit:o}){const a=t,n=o,r=e.getCurrentInstance(),i=te(),u=e.ref(null);l({$el:u});const{reference:s,bus:d,aria:c,expanded:v}=e.inject(h,{});e.watch((()=>u.value),(e=>{s&&(s.value=e)}));const p=e.computed((()=>a.pressed||(null==v?void 0:v.value))),{role:m}=e.inject(S,{}),b=e.computed((()=>{switch(!0){case a.disabled:return f.button;case void 0!==a.to:return(null==i?void 0:i.nuxt)?e.resolveComponent(f.nuxtLink):f.routerLink;case void 0!==a.href:return f.a;default:return a.defaultTag}})),g=e.computed((()=>{const e={...null==c?void 0:c.value,ariaPressed:!!p.value||void 0,ariaLabel:a.ariaLabel,role:null==m?void 0:m.value};switch(b.value){case f.a:return{...e,href:a.href,target:a.target,rel:a.rel};case f.routerLink:case f.nuxtLink:return{...e,to:a.to,target:a.target};case f.button:return{...e,type:a.type,disabled:a.disabled};default:return e}}));function y(e){var t;a.disabled?e.preventDefault():(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onClick)?n("click",e):null==d||d.emit("click",e)}function k(e){var t;(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onMouseover)?n("mouseover",e):null==d||d.emit("mouseover",e)}function B(e){var t;(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onMouseleave)?n("mouseleave",e):null==d||d.emit("mouseleave",e)}return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.mergeProps(e.unref(g),{ref_key:"element",ref:u,class:{active:t.active,pressed:e.unref(p),disabled:t.disabled,current:t.current},onClickPassive:y,onMouseoverPassive:k,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function ve(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}const fe={key:1,class:"vv-button__label"},pe={key:1,class:"vv-button__label"},me=e.defineComponent({name:"VvButton",inheritAttrs:!1,props:ue,emits:["update:modelValue"],setup(t,{expose:l,emit:o}){const a=t,n=o,r=e.useAttrs(),i=e.useSlots(),{id:u,modifiers:d,iconPosition:c,icon:v,label:f,modelValue:p,disabled:m,toggle:b,unselectable:g}=se(a,n),y=ve(u),h=e.computed((()=>(null==r?void 0:r.name)||y.value)),k=e.ref(null);l({$el:e.computed((()=>{var e;return null==(e=k.value)?void 0:e.$el}))});const S=e.computed((()=>b.value?Array.isArray(p.value)?Y(h.value,p.value):Q(h.value,p.value):a.pressed)),B=le("vv-button",d,e.computed((()=>({reverse:[s.right,s.bottom].includes(c.value),column:[s.top,s.bottom].includes(c.value),"icon-only":Boolean((null==v?void 0:v.value)&&!(null==f?void 0:f.value)&&!i.default)})))),{hasIcon:w}=ae(v),V=e.computed((()=>void 0!==a.value?a.value:h.value)),x=e.computed((()=>{if(b.value)return{onClick:L}}));function L(){if(b.value){if(Array.isArray(p.value))return Y(V.value,p.value)?void(g.value&&(p.value=p.value.filter((e=>e!==V.value)))):void p.value.push(V.value);if(V.value===p.value&&g.value)return void(p.value=a.uncheckedValue);p.value=V.value}}return(t,l)=>(e.openBlock(),e.createBlock(ce,e.mergeProps({...e.unref(r),...e.unref(x),disabled:e.unref(m),pressed:e.unref(S),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(y),ref_key:"element",ref:k,class:e.unref(B)}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(oe,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",fe,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(w)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:0},e.unref(w),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(f)?(e.openBlock(),e.createElementBlock("span",pe,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}}),be={...T,...M,...F,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:m.menu,validator:e=>Object.values(m).includes(e)}},ge={focusOnHover:{type:Boolean,default:!1}},ye={...L,...P,...z,...F,deselectHintLabel:{type:String},selectHintLabel:{type:String},selectedHintLabel:{type:String},focusOnHover:{type:Boolean,default:!1}};const he=["id","tabindex","role","aria-labelledby"],ke=e.defineComponent({name:"VvDropdown",inheritAttrs:!1,props:be,emits:["update:modelValue","beforeEnter","afterLeave","beforeExpand","beforeCollapse","afterExpand","afterCollapse","before-enter","after-leave","enter","afterEnter","enterCancelled","beforeLeave","leave","leaveCancelled"],setup(t,{expose:n,emit:r}){const i=t,d=r,{id:c}=e.toRefs(i),v=ve(c),f=e.useAttrs(),p=e.ref("auto"),g=e.ref("auto"),y=e.ref(),S=e.ref(),B=e.ref(),w=e.ref(),V=e.computed({get:()=>i.reference??y.value,set:e=>{y.value=e}}),x=e.ref(!1);e.onMounted((()=>{o.useMutationObserver(S.value,(()=>{var e;x.value="true"===(null==(e=window.getComputedStyle(S.value).getPropertyValue("--dropdown-custom-position"))?void 0:e.trim())}),{attributeFilter:["style"],window:window})}));const L=e.computed((()=>{const e=[];if(i.autoPlacement?"boolean"==typeof i.autoPlacement?e.push(l.autoPlacement()):e.push(l.autoPlacement(i.autoPlacement)):i.flip&&("boolean"==typeof i.flip?e.push(l.flip({fallbackStrategy:"initialPlacement"})):e.push(l.flip(i.flip))),i.shift&&("boolean"==typeof i.shift?e.push(l.shift()):e.push(l.shift(i.shift))),i.size){const t=({availableWidth:e,availableHeight:t})=>{p.value=`${e}px`,g.value=`${t}px`};"boolean"==typeof i.size?e.push(l.size({apply:t})):e.push(l.size({...i.size,apply:t}))}return i.offset&&(e.push(l.offset(Number(i.offset))),["string","number"].includes(typeof i.offset)?e.push(l.offset(Number(i.offset))):e.push(l.offset(i.offset))),i.arrow&&e.push(l.arrow({element:B})),e})),{x:C,y:P,middlewareData:O,placement:$,strategy:N}=l.useFloating(V,S,{whileElementsMounted:(...e)=>l.autoUpdate(...e,{animationFrame:i.strategy===u.fixed}),placement:e.computed((()=>i.placement)),strategy:e.computed((()=>i.strategy)),middleware:L}),_=e.computed((()=>{var e;if(x.value)return;const t=i.triggerWidth&&V.value?`${null==(e=V.value)?void 0:e.offsetWidth}px`:void 0;return{position:N.value,top:`${P.value??0}px`,left:`${C.value??0}px`,maxWidth:t?void 0:p.value,maxHeight:g.value,width:t}})),E=e.computed((()=>$.value.split("-")[0])),A=e.computed((()=>{var e,t,l,o,a;if(x.value)return;const n={[s.top]:s.bottom,[s.right]:s.left,[s.bottom]:s.top,[s.left]:s.right}[E.value];return{left:void 0!==(null==(e=O.value.arrow)?void 0:e.x)?`${null==(t=O.value.arrow)?void 0:t.x}px`:void 0,top:void 0!==(null==(l=O.value.arrow)?void 0:l.y)?`${null==(o=O.value.arrow)?void 0:o.y}px`:void 0,[n]:-((null==(a=B.value)?void 0:a.offsetWidth)??0)/2+"px"}})),F=o.useVModel(i,"modelValue",d),D=e.ref(!1),H=e.computed({get:()=>F.value??D.value,set:e=>{void 0!==F.value?F.value=e:D.value=e}});function j(){H.value=!0}function R(){H.value=!1}function I(){H.value=!H.value}function z(e){V.value=e}o.onClickOutside(S,(()=>{!i.keepOpen&&H.value&&(H.value=!1)}),{ignore:[V]});const T=e.computed((()=>{var e,t;return(null==(t=null==(e=V.value)?void 0:e.getAttribute)?void 0:t.call(e,"id"))??void 0})),M=e.computed((()=>({"aria-controls":v.value,"aria-haspopup":!0,"aria-expanded":H.value}))),{component:K,bus:q}=function({reference:t,id:l,expanded:o,aria:n}){const r=a(),i=e.defineComponent({name:"VvDropdownTriggerProvider",setup(){e.provide(h,{reference:t,id:l,expanded:o,aria:n,bus:r})},render(){var t,l;return e.h(e.Fragment,{},null==(l=(t=this.$slots).default)?void 0:l.call(t))}});return{bus:r,component:i}}({reference:V,id:v,expanded:H,aria:M});q.on("click",I);const{role:W,modifiers:G}=e.toRefs(i),J=le("vv-dropdown",G,e.computed((()=>({arrow:i.arrow})))),{focused:U}=o.useFocusWithin(S);function Q(e){return e?[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden"))):[]}function X(){e.nextTick((()=>{const e=Q(S.value);e.length>0&&e[0].focus({preventScroll:!0})}))}function Y(){e.nextTick((()=>{if(U.value){const e=Q(S.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t<e.length-1?e[t+1].focus({preventScroll:!0}):e[0].focus({preventScroll:!0})}}))}function Z(){e.nextTick((()=>{if(U.value){const e=Q(S.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t>0?e[t-1].focus({preventScroll:!0}):e[e.length-1].focus({preventScroll:!0})}}))}e.watch(H,(e=>{e&&i.autofocusFirst&&X()})),n({toggle:I,show:j,hide:R,init:z,focusFirst:X,focusFirstListElement:function(){e.nextTick((()=>{const e=Q(w.value);e.length>0&&e[0].focus({preventScroll:!0})}))},focusNext:Y,focusPrev:Z,customPosition:x});const ee=o.useElementHover(S),{itemRole:te}=function({role:t,...l}){const o=e.computed((()=>t.value===m.listbox?b.option:b.presentation));return e.provide(k,{role:o,...l}),{itemRole:o}}({role:W,expanded:H,focused:U,hovered:ee});o.onKeyStroke("Escape",(e=>{H.value&&(e.preventDefault(),R())})),o.onKeyStroke("ArrowDown",(e=>{H.value&&U.value&&(e.preventDefault(),Y())})),o.onKeyStroke("ArrowUp",(e=>{H.value&&U.value&&(e.preventDefault(),Z())})),o.onKeyStroke([" ","Enter"],(e=>{const t=e.target;H.value&&U.value&&t&&(null==t||t.click())}));const oe={"before-enter":()=>{d(H.value?"beforeExpand":"beforeCollapse"),d("beforeEnter")},"after-leave":()=>{d(H.value?"afterExpand":"afterCollapse"),d("afterLeave")},enter:()=>{d("enter")},"after-enter":()=>{d("afterEnter")},"enter-cancelled":()=>{d("enterCancelled")},"before-leave":()=>{d("beforeLeave")},leave:()=>{d("leave")},"leave-cancelled":()=>{d("leaveCancelled")}};return(t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(K),null,{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps({init:z,show:j,hide:R,toggle:I,expanded:e.unref(H),aria:e.unref(M)})))])),_:3}),e.createVNode(e.Transition,e.mergeProps({name:t.transitionName},e.toHandlers(oe),{persisted:""}),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:S,style:e.normalizeStyle(e.unref(_)),class:e.normalizeClass(e.unref(J))},[i.arrow?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"arrowEl",ref:B,style:e.normalizeStyle(e.unref(A)),class:"vv-dropdown__arrow"},null,4)):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(H)}))),e.createElementVNode("div",e.mergeProps(e.unref(f),{id:e.unref(v),ref_key:"listEl",ref:w,tabindex:e.unref(H)?void 0:-1,role:e.unref(W),"aria-labelledby":e.unref(T),class:"vv-dropdown__list"}),[e.renderSlot(t.$slots,"items",e.normalizeProps(e.guardReactiveProps({role:e.unref(te)})))],16,he),e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(H)})))],6),[[e.vShow,e.unref(H)]])])),_:3},16,["name"])],64))}}),Se={class:"vv-dropdown-optgroup",role:"presentation",tabindex:"-1"},Be=e.defineComponent({name:"VvDropdownOptgroup",props:{...E},setup(t){const l=t;return(t,o)=>(e.openBlock(),e.createElementBlock("li",Se,e.toDisplayString(l.label),1))}}),we=e.defineComponent({name:"VvDropdownItem",props:ge,setup(t){const l=t,{role:a,expanded:n}=e.inject(k,{}),r=e.ref(null);!function({expanded:t}){e.provide(S,{role:e.ref(p.menuitem),expanded:t})}({expanded:n});const i=o.useElementHover(r),{focused:u}=o.useFocus(r),{focused:s}=o.useFocusWithin(r);return e.watch(i,(e=>{e&&l.focusOnHover&&(u.value=!0)})),(t,l)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({role:e.unref(a)},{ref_key:"element",ref:r,class:["vv-dropdown__item",{"focus-visible":e.unref(u)||e.unref(s)}]}),[e.renderSlot(t.$slots,"default")],16))}}),Ve=["title"],xe=e.defineComponent({name:"VvDropdownOption",props:ye,setup(t){const l=t,{modifiers:o}=e.toRefs(l),a=le("vv-dropdown-option",o,e.computed((()=>({disabled:l.disabled,selected:l.selected,unselectable:l.unselectable&&l.selected})))),n=e.computed((()=>l.selected?l.unselectable?l.deselectHintLabel:l.selectedHintLabel:l.disabled?"":l.selectHintLabel));return(t,l)=>(e.openBlock(),e.createBlock(we,{class:e.normalizeClass(e.unref(a)),tabindex:t.disabled?-1:0,"aria-selected":t.selected,"aria-disabled":t.disabled,"focus-on-hover":t.focusOnHover},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default"),e.createElementVNode("span",{class:"vv-dropdown-option__hint",title:e.unref(n)},[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps({disabled:t.disabled,selected:t.selected,unselectable:t.unselectable})),(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)),1)]))],8,Ve)])),_:3},8,["class","tabindex","aria-selected","aria-disabled","focus-on-hover"]))}}),Le={...K,...q,...W,...R,...w,...V,...D,...x,...L,...A,...F,...H,...j,...I,...z,...E,...N,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},autoselectFirst:{type:Boolean,default:!1},placeholder:String};function Ce(){return{...Le,options:{...Le.options,type:Array,default:()=>[]}}}function Pe(t,l,o){const a=te(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];if(a.length){a[0]===n&&(l[o]=e[o])}}if("function"==typeof t[o]){(0,t[o])()===n&&(l[o]=e[o])}if("object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}function Oe(t,l){const{focused:a}=o.useFocus(t);return e.watch(a,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:a}}function $e(t){const{options:l,labelKey:o,valueKey:a,disabledKey:r}=e.toRefs(t);return{options:l,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof o.value?o.value(e):String(o.value?n.get(e,o.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof a.value?a.value(e):a.value?n.get(e,a.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof r.value?r.value(e):!!r.value&&n.get(e,r.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}const Ne=["for"],_e={class:"vv-select__wrapper"},Ee={key:0,class:"vv-select__input-before"},Ae={class:"vv-select__inner"},Fe=["id"],De=["disabled","hidden"],He=["disabled","value"],je=["disabled","label"],Re=["disabled","value"],Ie={key:2,class:"vv-select__input-after"},ze=e.defineComponent({name:"VvSelect",props:Ce(),emits:["update:modelValue","focus","blur","clear"],setup(t,{emit:l}){const a=t,n=l,r=e.useSlots(),i=Pe("VvSelect",Ce(),a),u=e.ref(),{HintSlot:s,hasHintLabelOrSlot:d,hasInvalidLabelOrSlot:c,hintSlotScope:v}=ee(i,r),{focused:f}=Oe(u,n);function p(e){var t;return"string"!=typeof e&&(null==(t=e.options)?void 0:t.length)}const{id:m,modifiers:b,disabled:g,readonly:y,loading:h,icon:k,iconPosition:S,invalid:B,valid:w,floating:V,multiple:x}=e.toRefs(a),L=ve(m),C=e.computed((()=>`${L.value}-hint`)),P=e.computed((()=>a.disabled||a.readonly)),O=e.computed((()=>P.value?-1:a.tabindex)),$=e.computed({get:()=>a.modelValue,set:e=>{Array.isArray(e)&&0===(e=e.filter((e=>void 0!==e))).length&&!a.unselectable&&u.value?u.value.value=String(a.modelValue):n("update:modelValue",e)}}),N=e.computed((()=>Array.isArray($.value)?$.value.length>0:void 0!==$.value&&null!==$.value)),_=e.computed((()=>!P.value&&a.unselectable)),E=o.useElementVisibility(u);e.watch(E,(e=>{e&&a.autofocus&&(f.value=!0)}));const{hasIconBefore:A,hasIconAfter:F}=ae(k,S),D=e.computed((()=>!0===a.invalid||!0!==a.valid&&void 0)),H=le("vv-select",b,e.computed((()=>({valid:w.value,invalid:B.value,loading:h.value,disabled:g.value,readonly:y.value,"icon-before":void 0!==A.value,"icon-after":void 0!==F.value,dirty:N.value,focus:f.value&&!P.value,floating:V.value,multiple:x.value})))),{getOptionLabel:j,getOptionValue:R,isOptionDisabled:I,getOptionGrouped:z}=$e(a);function T(){Array.isArray($.value)?$.value=[]:$.value=void 0,n("clear")}e.watch((()=>a.options),(e=>{if((null==e?void 0:e.length)&&a.autoselectFirst&&!N.value){const t=R(e[0]);$.value=a.multiple?[t]:t}}),{immediate:!0});const M=e.computed((()=>({name:a.name,tabindex:O.value,disabled:P.value,required:a.required,size:a.size,autocomplete:a.autocomplete,multiple:a.multiple,"aria-invalid":D.value,"aria-describedby":d.value?C.value:void 0,"aria-errormessage":c.value?C.value:void 0}))),K=e.computed((()=>({valid:a.valid,invalid:a.invalid,modelValue:a.modelValue})));return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(H))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(L)},e.toDisplayString(t.label),9,Ne)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",_e,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(K))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",Ae,[e.unref(A)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:0},e.unref(A),{class:"vv-select__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(L),ref_key:"selectEl",ref:u},e.unref(M),{"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef($)?$.value=t:null)}),[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!e.unref(_),hidden:!e.unref(_)},e.toDisplayString(t.placeholder),9,De)):e.createCommentVNode("v-if",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,((t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[p(t)?(e.openBlock(),e.createElementBlock("optgroup",{key:`group-${l}`,disabled:e.unref(I)(t),label:e.unref(j)(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(z)(t),((t,o)=>(e.openBlock(),e.createElementBlock("option",{key:`group-${l}-item-${o}`,disabled:e.unref(I)(t),value:e.unref(R)(t)},e.toDisplayString(e.unref(j)(t)),9,Re)))),128))],8,je)):(e.openBlock(),e.createElementBlock("option",{key:l,disabled:e.unref(I)(t),value:e.unref(R)(t)},e.toDisplayString(e.unref(j)(t)),9,He))],64)))),256))],16,Fe),[[e.vModelSelect,e.unref($)]]),e.unref(F)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:1},e.unref(F),{class:"vv-select__icon vv-select__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),e.unref(_)&&e.unref(i).showClearAction?(e.openBlock(),e.createBlock(e.unref(ne),{key:1,"input-type":"select",label:t.labelClear,icon:t.iconClear,disabled:!e.unref(N),onClear:T},null,8,["label","icon","disabled"])):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",Ie,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(K))))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(s),{id:e.unref(C),class:"vv-select__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(v))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(v))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(v))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(v))))])),key:"3"}:void 0]),1032,["id"])],2))}}),Te=["id"],Me=["id","for"],Ke=["id","aria-controls","placeholder"],qe={key:0,class:"vv-select__input-before"},We={class:"vv-select__inner"},Ge=["aria-controls","aria-expanded","aria-labelledby","aria-describedby","aria-errormessage","tabindex"],Je={key:0,class:"vv-select__value"},Ue=["aria-label","onClick"],Qe={key:2,class:"vv-select__input-after"},Xe={name:"VvCombobox",components:{VvDropdown:ke,VvDropdownOption:xe,VvDropdownOptgroup:Be,VvButton:me}};return e.defineComponent({...Xe,props:U(),emits:["update:modelValue","update:search","update:options","focus","blur","clear","change:search"],setup(t,{emit:l}){const a=t,n=l,r=e.useSlots(),i=Pe("VvCombobox",U(),a),u=e.ref(null),s=e.ref(null),d=e.ref(null),c=e.ref(),{HintSlot:v,hasHintLabelOrSlot:f,hasInvalidLabelOrSlot:p,hintSlotScope:b}=ee(i,r),{focused:g}=Oe(u,n),{focused:y}=o.useFocusWithin(d);e.watch(g,(e=>{a.autoOpen&&(!e||S.value?e||!S.value||y.value||V():w())})),e.watch(y,(e=>{g.value||e||!S.value||V()}));const h=e.ref(""),k=o.refDebounced(h,e.computed((()=>Number(a.debounceSearch))));e.watch(k,(()=>{n("update:search",k.value),n("change:search",k.value)}));const S=e.ref(!1);function B(){K.value||(S.value=!S.value)}function w(){K.value||S.value||(S.value=!0)}function V(){!K.value&&S.value&&(S.value=!1)}function x(){i.value.searchable&&s.value&&s.value.focus({preventScroll:!0})}function L(){i.value.searchable&&(h.value="")}function C(e){var t;return"string"!=typeof e&&(null==(t=e.options)?void 0:t.length)}const{id:P,icon:O,iconPosition:$,modifiers:N,disabled:_,required:E,readonly:A,loading:F,valid:D,invalid:H,floating:j}=e.toRefs(a),R=ve(P),I=e.computed((()=>`${R.value}-hint`)),z=e.computed((()=>`${R.value}-dropdown`)),T=e.computed((()=>`${R.value}-search`)),M=e.computed((()=>`${R.value}-label`)),K=e.computed((()=>a.disabled||a.readonly)),q=e.computed((()=>K.value?-1:a.tabindex)),W=e.computed({get:()=>Array.isArray(a.modelValue)?a.modelValue:void 0!==a.modelValue&&null!==a.modelValue?[a.modelValue]:[],set:e=>{n("update:modelValue",a.multiple||Array.isArray(a.modelValue)?e:e.pop())}}),G=e.computed((()=>W.value.length)),J=e.computed((()=>G.value>0)),Q=e.computed((()=>a.multiple?void 0===a.maxValues?1/0:Number(a.maxValues):1)),X=e.computed((()=>!K.value&&(!!a.unselectable&&(0===Number(a.minValues)||G.value>Number(a.minValues))))),Y=e.computed((()=>!K.value&&(!a.multiple||G.value<Q.value))),Z=e.ref(!1),te=e.computed((()=>Z.value||F.value)),{hasIconBefore:re,hasIconAfter:ue}=ae(O,$),se=le("vv-select",N,e.computed((()=>({disabled:_.value,required:E.value,loading:te.value,readonly:A.value,"icon-before":void 0!==re.value,"icon-after":void 0!==ue.value,valid:D.value,invalid:H.value,dirty:J.value,focus:(g.value||y.value||S.value)&&!K.value,floating:j.value,badges:a.badges})))),de=e.ref(new Set),{getOptionLabel:ce,getOptionValue:fe,getOptionGrouped:pe,isOptionDisabled:be}=$e(a),ge=e.computed((()=>{const e=[...a.options,...de.value];for(const t of W.value)e.some((e=>{const l=fe(e);return"object"==typeof l?JSON.stringify(l)===JSON.stringify(t):l===t}))||e.push(t);return e}));function ye(e){return be(e)||!Y.value&&!Se(e)}e.watch(de,(e=>{e.size>0&&n("update:options",ge.value)}));const he=o.computedAsync((async()=>{var e;if(i.value.searchFunction){Z.value=!0;const e=await Promise.resolve(i.value.searchFunction(k.value,ge.value));return Z.value=!1,e}return null==(e=ge.value)?void 0:e.filter((e=>ce(e).toLowerCase().includes(k.value.toLowerCase().trim())))}));function Se(e){const t=fe(e);return"object"==typeof t?W.value.some((e=>"object"==typeof e&&JSON.stringify(e)===JSON.stringify(t))):W.value.includes(t)}const we=e.computed((()=>ge.value.reduce(((e,t)=>C(t)?[...e,...pe(t)]:[...e,t]),[]).filter((e=>Se(e))))),Ve=e.computed((()=>we.value.map((e=>ce(e))).join(a.separator)));function Le(){a.autoOpen?w():B()}function Ce(e){const t=Se(e),l=fe(e);t&&X.value?W.value=W.value.filter((e=>"object"==typeof l&&"object"==typeof e?JSON.stringify(e)!==JSON.stringify(l):e!==l)):!t&&Y.value&&(a.multiple?W.value=[...W.value,l]:W.value=[l]),a.multiple||a.keepOpen||V()}function Ne(){W.value=[],n("update:search",""),n("clear")}e.watch(ge,(e=>{(null==e?void 0:e.length)&&a.autoselectFirst&&!J.value&&Ce(e[0])}),{immediate:!0});const _e=e.computed((()=>({id:R.value,name:a.name,tabindex:q.value,valid:D.value,validLabel:i.value.validLabel,invalid:H.value,invalidLabel:i.value.invalidLabel,hintLabel:i.value.hintLabel,loading:te.value,loadingLabel:i.value.loadingLabel,disabled:_.value,readonly:A.value,modifiers:i.value.modifiers,options:i.value.options,labelKey:i.value.labelKey,valueKey:i.value.valueKey,icon:i.value.icon,iconPosition:i.value.iconPosition,floating:i.value.floating,unselectable:X.value,autoselectFirst:i.value.autoselectFirst,multiple:i.value.multiple,label:i.value.label,placeholder:i.value.placeholder,modelValue:a.modelValue}))),Ee=e.computed((()=>({id:z.value,reference:d.value,placement:i.value.placement,strategy:i.value.strategy,transitionName:i.value.transitionName,offset:i.value.offset,shift:i.value.shift,flip:i.value.flip,autoPlacement:i.value.autoPlacement,arrow:i.value.arrow,autofocusFirst:!!i.value.searchable||i.value.autofocusFirst,triggerWidth:i.value.triggerWidth,modifiers:i.value.dropdownModifiers}))),Ae=e.computed((()=>({valid:a.valid,invalid:a.invalid,modelValue:a.modelValue})));function Fe(){var e,t;if(null==(e=he.value)?void 0:e.length)return 1===he.value.length?void Ce(he.value[0]):void(null==(t=c.value)||t.focusFirstListElement());if(i.value.addable){const e=h.value.trim();if(!e)return;if(ge.value.some((t=>ce(t).toLowerCase()===e.toLowerCase())))return;de.value.add(e),Ce(e)}}return o.onKeyStroke([" ","Enter"],(e=>{a.autoOpen||!S.value&&g.value&&(e.preventDefault(),e.stopImmediatePropagation(),B())}),{target:u}),(t,l)=>t.native?(e.openBlock(),e.createBlock(ze,e.mergeProps({key:1},e.unref(_e),{"onUpdate:modelValue":l[3]||(l[3]=e=>n("update:modelValue",e))}),null,16)):(e.openBlock(),e.createElementBlock("div",{key:0,id:e.unref(R),class:e.normalizeClass(e.unref(se))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,id:e.unref(M),for:e.unref(i).searchable?e.unref(T):void 0},e.toDisplayString(t.label),9,Me)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{ref_key:"wrapperEl",ref:d,class:"vv-select__wrapper"},[e.createVNode(ke,e.mergeProps({ref_key:"dropdownEl",ref:c,modelValue:e.unref(S),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(S)?S.value=t:null)},e.unref(Ee),{role:e.unref(m).listbox,onAfterExpand:x,onAfterCollapse:L}),e.createSlots({default:e.withCtx((({aria:l})=>[t.$slots.before?(e.openBlock(),e.createElementBlock("div",qe,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",We,[e.unref(re)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:0},e.unref(re),{class:"vv-select__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",e.mergeProps({ref_key:"inputEl",ref:u},l,{class:"vv-select__input",role:"combobox","aria-controls":e.unref(z),"aria-expanded":e.unref(S),"aria-labelledby":e.unref(M),"aria-describedby":e.unref(f)?e.unref(I):void 0,"aria-errormessage":e.unref(p)?e.unref(I):void 0,tabindex:e.unref(q),onClickPassive:Le}),[e.renderSlot(t.$slots,"value",e.normalizeProps(e.guardReactiveProps({selectedOptions:e.unref(we),onInput:Ce})),(()=>[e.unref(Ve)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.badges?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(we),((l,o)=>(e.openBlock(),e.createBlock(ie,{key:o,modifiers:t.badgeModifiers,class:"vv-select__badge"},{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(e.unref(ce)(l))+" ",1),e.unref(X)?(e.openBlock(),e.createElementBlock("button",{key:0,"aria-label":e.unref(i).deselectActionLabel,type:"button",onClick:e.withModifiers((e=>Ce(l)),["stop"])},[e.createVNode(oe,{name:"close"})],8,Ue)):e.createCommentVNode("v-if",!0)])),_:2},1032,["modifiers"])))),128)):(e.openBlock(),e.createElementBlock("div",Je,e.toDisplayString(e.unref(Ve)),1))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.placeholder),1)],64))]))],16,Ge),e.unref(ue)?(e.openBlock(),e.createBlock(oe,e.mergeProps({key:1},e.unref(ue),{class:"vv-select__icon vv-select__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),e.unref(X)&&e.unref(i).showClearAction?(e.openBlock(),e.createBlock(e.unref(ne),{key:1,"input-type":"select",label:t.labelClear,icon:t.iconClear,disabled:!e.unref(J),onClear:Ne},null,8,["label","icon","disabled"])):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",Qe,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(Ae))))])):e.createCommentVNode("v-if",!0)])),items:e.withCtx((()=>{var l;return[!e.unref(_)&&(null==(l=e.unref(he))?void 0:l.length)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(he),((l,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o},[C(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Be,{label:e.unref(ce)(l)},null,8,["label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(pe)(l),((o,a)=>(e.openBlock(),e.createBlock(xe,e.mergeProps({ref_for:!0},{selected:Se(o),disabled:ye(o),unselectable:e.unref(X),deselectHintLabel:e.unref(i).deselectHintLabel,selectHintLabel:e.unref(i).selectHintLabel,selectedHintLabel:e.unref(i).selectedHintLabel,focusOnHover:t.focusOnHover},{key:a,class:"vv-dropdown-option",onClickPassive:e=>Ce(o)}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"option",e.mergeProps({ref_for:!0},{option:l,selectedOptions:e.unref(we),selected:Se(o),disabled:ye(o)}),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ce)(o)),1)]))])),_:2},1040,["onClickPassive"])))),128))],64)):(e.openBlock(),e.createBlock(xe,e.mergeProps({key:1,ref_for:!0},{selected:Se(l),disabled:ye(l),unselectable:e.unref(X),deselectHintLabel:e.unref(i).deselectHintLabel,selectHintLabel:e.unref(i).selectHintLabel,selectedHintLabel:e.unref(i).selectedHintLabel,focusOnHover:t.focusOnHover},{class:"vv-dropdown-option",onClickPassive:e=>Ce(l)}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"option",e.mergeProps({ref_for:!0},{option:l,selectedOptions:e.unref(we),selected:Se(l),disabled:ye(l)}),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ce)(l)),1)]))])),_:2},1040,["onClickPassive"]))],64)))),128)):t.options.length?e.unref(_)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(xe,{key:2,modifiers:"inert"},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"no-results",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(i).addable?e.unref(i).addOptionHintLabel:e.unref(i).noResultsLabel),1)]))])),_:3})):(e.openBlock(),e.createBlock(xe,{key:1,modifiers:"inert"},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"no-options",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(i).noOptionsLabel),1)]))])),_:3}))]})),after:e.withCtx((()=>[e.renderSlot(t.$slots,"dropdown::after",{},(()=>{var t;return[(null==(t=e.unref(c))?void 0:t.customPosition)?(e.openBlock(),e.createBlock(me,{key:0,label:e.unref(i).closeLabel,modifiers:"secondary",onClick:l[1]||(l[1]=t=>e.unref(c).hide())},null,8,["label"])):e.createCommentVNode("v-if",!0)]}))])),_:2},[e.unref(i).searchable||t.$slots["dropdown::before"]?{name:"before",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"dropdown::before"),e.unref(i).searchable&&!e.unref(_)?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,id:e.unref(T),ref_key:"inputSearchEl",ref:s,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(h)?h.value=t:null),"aria-autocomplete":"list","aria-controls":e.unref(z),autocomplete:"off",spellcheck:"false",type:"search",class:"vv-dropdown__search",placeholder:e.unref(i).searchPlaceholder,onKeyup:e.withKeys(Fe,["enter"])},null,40,Ke)),[[e.vModelText,e.unref(h)]]):e.createCommentVNode("v-if",!0)])),key:"0"}:void 0]),1040,["modelValue","role"])],512),e.createVNode(e.unref(v),{id:e.unref(I),class:"vv-select__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(b))))])),key:"3"}:void 0]),1032,["id"])],10,Te))}})}));
|
|
@@ -130,12 +130,15 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
|
|
|
130
130
|
selectHintLabel: string;
|
|
131
131
|
selectedHintLabel: string;
|
|
132
132
|
autoselectFirst: boolean;
|
|
133
|
+
showClearAction: boolean;
|
|
133
134
|
iconClear: string | import("../VvIcon").VvIconProps;
|
|
134
135
|
labelClear: string;
|
|
135
136
|
searchFunction: (search: string, options: T[]) => T[] | Promise<T[]>;
|
|
136
137
|
noResultsLabel: string;
|
|
137
138
|
noOptionsLabel: string;
|
|
138
139
|
deselectActionLabel: string;
|
|
140
|
+
addOptionHintLabel: string;
|
|
141
|
+
addable: boolean;
|
|
139
142
|
searchable: boolean;
|
|
140
143
|
searchPlaceholder: string;
|
|
141
144
|
debounceSearch: string | number;
|
|
@@ -269,11 +272,14 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
|
|
|
269
272
|
readonly selectHintLabel: string;
|
|
270
273
|
readonly selectedHintLabel: string;
|
|
271
274
|
readonly autoselectFirst: boolean;
|
|
275
|
+
readonly showClearAction: boolean;
|
|
272
276
|
readonly iconClear: string | import("../VvIcon").VvIconProps;
|
|
273
277
|
readonly labelClear: string;
|
|
274
278
|
readonly noResultsLabel: string;
|
|
275
279
|
readonly noOptionsLabel: string;
|
|
276
280
|
readonly deselectActionLabel: string;
|
|
281
|
+
readonly addOptionHintLabel: string;
|
|
282
|
+
readonly addable: boolean;
|
|
277
283
|
readonly searchable: boolean;
|
|
278
284
|
readonly searchPlaceholder: string;
|
|
279
285
|
readonly debounceSearch: string | number;
|
|
@@ -301,8 +307,9 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
|
|
|
301
307
|
readonly onBlur?: ((args_0: import("@vueuse/core").MaybeElement) => any) | undefined;
|
|
302
308
|
readonly onFocus?: ((args_0: import("@vueuse/core").MaybeElement) => any) | undefined;
|
|
303
309
|
readonly "onUpdate:search"?: ((args_0: string) => any) | undefined;
|
|
310
|
+
readonly "onUpdate:options"?: ((args_0: (string | Option)[]) => any) | undefined;
|
|
304
311
|
readonly "onChange:search"?: ((args_0: string) => any) | undefined;
|
|
305
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "floating" | "placement" | "strategy" | "size" | "shift" | "label" | "disabled" | "modelValue" | "modifiers" | "closeLabel" | "icon" | "iconPosition" | "flip" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "transitionName" | "offset" | "autoPlacement" | "arrow" | "keepOpen" | "autofocusFirst" | "triggerWidth" | "focusOnHover" | "deselectHintLabel" | "selectHintLabel" | "selectedHintLabel" | "autoselectFirst" | "iconClear" | "labelClear" | "searchFunction" | "noResultsLabel" | "noOptionsLabel" | "deselectActionLabel" | "searchable" | "searchPlaceholder" | "debounceSearch" | "minValues" | "separator" | "native" | "badges" | "badgeModifiers" | "dropdownModifiers" | "autoOpen">, "name" | "id" | "onFocus" | "onBlur" | "onClear" | "onUpdate:modelValue" | "placeholder" | "maxValues" | "onUpdate:search" | "onChange:search" | ("floating" | "placement" | "strategy" | "size" | "shift" | "label" | "disabled" | "modelValue" | "modifiers" | "closeLabel" | "icon" | "iconPosition" | "flip" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "transitionName" | "offset" | "autoPlacement" | "arrow" | "keepOpen" | "autofocusFirst" | "triggerWidth" | "focusOnHover" | "deselectHintLabel" | "selectHintLabel" | "selectedHintLabel" | "autoselectFirst" | "iconClear" | "labelClear" | "searchFunction" | "noResultsLabel" | "noOptionsLabel" | "deselectActionLabel" | "searchable" | "searchPlaceholder" | "debounceSearch" | "minValues" | "separator" | "native" | "badges" | "badgeModifiers" | "dropdownModifiers" | "autoOpen")> & {} & Partial<{}>> & import("vue").PublicProps;
|
|
312
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "floating" | "placement" | "strategy" | "size" | "shift" | "label" | "disabled" | "modelValue" | "modifiers" | "closeLabel" | "icon" | "iconPosition" | "flip" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "transitionName" | "offset" | "autoPlacement" | "arrow" | "keepOpen" | "autofocusFirst" | "triggerWidth" | "focusOnHover" | "deselectHintLabel" | "selectHintLabel" | "selectedHintLabel" | "autoselectFirst" | "showClearAction" | "iconClear" | "labelClear" | "searchFunction" | "noResultsLabel" | "noOptionsLabel" | "deselectActionLabel" | "addOptionHintLabel" | "addable" | "searchable" | "searchPlaceholder" | "debounceSearch" | "minValues" | "separator" | "native" | "badges" | "badgeModifiers" | "dropdownModifiers" | "autoOpen">, "name" | "id" | "onFocus" | "onBlur" | "onClear" | "onUpdate:modelValue" | "placeholder" | "maxValues" | "onUpdate:search" | "onUpdate:options" | "onChange:search" | ("floating" | "placement" | "strategy" | "size" | "shift" | "label" | "disabled" | "modelValue" | "modifiers" | "closeLabel" | "icon" | "iconPosition" | "flip" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "transitionName" | "offset" | "autoPlacement" | "arrow" | "keepOpen" | "autofocusFirst" | "triggerWidth" | "focusOnHover" | "deselectHintLabel" | "selectHintLabel" | "selectedHintLabel" | "autoselectFirst" | "showClearAction" | "iconClear" | "labelClear" | "searchFunction" | "noResultsLabel" | "noOptionsLabel" | "deselectActionLabel" | "addOptionHintLabel" | "addable" | "searchable" | "searchPlaceholder" | "debounceSearch" | "minValues" | "separator" | "native" | "badges" | "badgeModifiers" | "dropdownModifiers" | "autoOpen")> & {} & Partial<{}>> & import("vue").PublicProps;
|
|
306
313
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
307
314
|
attrs: any;
|
|
308
315
|
slots: {
|
|
@@ -316,7 +323,7 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
|
|
|
316
323
|
} & {
|
|
317
324
|
value?: (props: {
|
|
318
325
|
selectedOptions: T[];
|
|
319
|
-
onInput: (option:
|
|
326
|
+
onInput: (option: string | Option) => void;
|
|
320
327
|
}) => any;
|
|
321
328
|
} & {
|
|
322
329
|
after?: (props: {
|
|
@@ -373,7 +380,7 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
|
|
|
373
380
|
loading: boolean;
|
|
374
381
|
}) => any;
|
|
375
382
|
};
|
|
376
|
-
emit: ((evt: "clear") => void) & ((evt: "update:modelValue", args_0: any) => void) & ((evt: "blur", args_0: import("@vueuse/core").MaybeElement) => void) & ((evt: "focus", args_0: import("@vueuse/core").MaybeElement) => void) & ((evt: "update:search", args_0: string) => void) & ((evt: "change:search", args_0: string) => void);
|
|
383
|
+
emit: ((evt: "clear") => void) & ((evt: "update:modelValue", args_0: any) => void) & ((evt: "blur", args_0: import("@vueuse/core").MaybeElement) => void) & ((evt: "focus", args_0: import("@vueuse/core").MaybeElement) => void) & ((evt: "update:search", args_0: string) => void) & ((evt: "update:options", args_0: (string | Option)[]) => void) & ((evt: "change:search", args_0: string) => void);
|
|
377
384
|
}>) => import("vue").VNode & {
|
|
378
385
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
379
386
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { MaybeElement } from '@vueuse/core';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
import type { Option } from '../../types/generic';
|
|
4
|
-
import type { VvIconProps } from '../VvIcon';
|
|
5
4
|
export type VvComboboxEvents = {
|
|
6
5
|
'update:modelValue': [any];
|
|
7
6
|
'update:search': [string];
|
|
7
|
+
'update:options': [(Option | string)[]];
|
|
8
8
|
'focus': [MaybeElement];
|
|
9
9
|
'blur': [MaybeElement];
|
|
10
10
|
'clear': [];
|
|
@@ -70,6 +70,13 @@ export declare const VvComboboxProps: {
|
|
|
70
70
|
type: StringConstructor;
|
|
71
71
|
default: string;
|
|
72
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Label for add new option hint
|
|
75
|
+
*/
|
|
76
|
+
addOptionHintLabel: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
default: string;
|
|
79
|
+
};
|
|
73
80
|
/**
|
|
74
81
|
* Label close button
|
|
75
82
|
*/
|
|
@@ -81,6 +88,10 @@ export declare const VvComboboxProps: {
|
|
|
81
88
|
* Select input placeholder
|
|
82
89
|
*/
|
|
83
90
|
placeholder: StringConstructor;
|
|
91
|
+
/**
|
|
92
|
+
* The options to add new options
|
|
93
|
+
*/
|
|
94
|
+
addable: BooleanConstructor;
|
|
84
95
|
/**
|
|
85
96
|
* Use input text to search on options
|
|
86
97
|
*/
|
|
@@ -193,17 +204,14 @@ export declare const VvComboboxProps: {
|
|
|
193
204
|
type: BooleanConstructor;
|
|
194
205
|
default: boolean;
|
|
195
206
|
};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
207
|
+
showClearAction: {
|
|
208
|
+
type: BooleanConstructor;
|
|
209
|
+
default: boolean;
|
|
210
|
+
};
|
|
200
211
|
iconClear: {
|
|
201
|
-
type: PropType<string | VvIconProps>;
|
|
212
|
+
type: PropType<string | import("../VvIcon").VvIconProps>;
|
|
202
213
|
default: "close";
|
|
203
214
|
};
|
|
204
|
-
/**
|
|
205
|
-
* Label for clear button
|
|
206
|
-
*/
|
|
207
215
|
labelClear: {
|
|
208
216
|
type: StringConstructor;
|
|
209
217
|
default: string;
|
|
@@ -261,7 +269,7 @@ export declare const VvComboboxProps: {
|
|
|
261
269
|
default: boolean;
|
|
262
270
|
};
|
|
263
271
|
icon: {
|
|
264
|
-
type: PropType<string | VvIconProps>;
|
|
272
|
+
type: PropType<string | import("../VvIcon").VvIconProps>;
|
|
265
273
|
default: undefined;
|
|
266
274
|
};
|
|
267
275
|
iconPosition: {
|
|
@@ -400,6 +408,13 @@ export declare function useVvComboboxProps<T extends Option | string>(): {
|
|
|
400
408
|
type: StringConstructor;
|
|
401
409
|
default: string;
|
|
402
410
|
};
|
|
411
|
+
/**
|
|
412
|
+
* Label for add new option hint
|
|
413
|
+
*/
|
|
414
|
+
addOptionHintLabel: {
|
|
415
|
+
type: StringConstructor;
|
|
416
|
+
default: string;
|
|
417
|
+
};
|
|
403
418
|
/**
|
|
404
419
|
* Label close button
|
|
405
420
|
*/
|
|
@@ -411,6 +426,10 @@ export declare function useVvComboboxProps<T extends Option | string>(): {
|
|
|
411
426
|
* Select input placeholder
|
|
412
427
|
*/
|
|
413
428
|
placeholder: StringConstructor;
|
|
429
|
+
/**
|
|
430
|
+
* The options to add new options
|
|
431
|
+
*/
|
|
432
|
+
addable: BooleanConstructor;
|
|
414
433
|
/**
|
|
415
434
|
* Use input text to search on options
|
|
416
435
|
*/
|
|
@@ -516,17 +535,14 @@ export declare function useVvComboboxProps<T extends Option | string>(): {
|
|
|
516
535
|
type: BooleanConstructor;
|
|
517
536
|
default: boolean;
|
|
518
537
|
};
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
538
|
+
showClearAction: {
|
|
539
|
+
type: BooleanConstructor;
|
|
540
|
+
default: boolean;
|
|
541
|
+
};
|
|
523
542
|
iconClear: {
|
|
524
|
-
type: PropType<string | VvIconProps>;
|
|
543
|
+
type: PropType<string | import("../VvIcon").VvIconProps>;
|
|
525
544
|
default: "close";
|
|
526
545
|
};
|
|
527
|
-
/**
|
|
528
|
-
* Label for clear button
|
|
529
|
-
*/
|
|
530
546
|
labelClear: {
|
|
531
547
|
type: StringConstructor;
|
|
532
548
|
default: string;
|
|
@@ -584,7 +600,7 @@ export declare function useVvComboboxProps<T extends Option | string>(): {
|
|
|
584
600
|
default: boolean;
|
|
585
601
|
};
|
|
586
602
|
icon: {
|
|
587
|
-
type: PropType<string | VvIconProps>;
|
|
603
|
+
type: PropType<string | import("../VvIcon").VvIconProps>;
|
|
588
604
|
default: undefined;
|
|
589
605
|
};
|
|
590
606
|
iconPosition: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, useId, defineComponent, h, Fragment, provide, unref, toRefs, useAttrs, ref, onMounted, watch,
|
|
1
|
+
import { computed, useId, defineComponent, h, Fragment, provide, unref, toRefs, useAttrs, ref, onMounted, watch, createElementBlock, openBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, mergeProps, toHandlers, withDirectives, createElementVNode, normalizeClass, normalizeStyle, createCommentVNode, vShow, nextTick } from "vue";
|
|
2
2
|
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
3
3
|
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke } from "@vueuse/core";
|
|
4
4
|
import mitt from "mitt";
|
|
@@ -489,27 +489,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
489
489
|
function init(el) {
|
|
490
490
|
referenceEl.value = el;
|
|
491
491
|
}
|
|
492
|
-
__expose({
|
|
493
|
-
toggle,
|
|
494
|
-
show,
|
|
495
|
-
hide,
|
|
496
|
-
init,
|
|
497
|
-
customPosition: hasCustomPosition
|
|
498
|
-
});
|
|
499
|
-
watch(expanded, (newValue) => {
|
|
500
|
-
if (newValue && props.autofocusFirst) {
|
|
501
|
-
nextTick(() => {
|
|
502
|
-
const focusableElements = getKeyboardFocusableElements(
|
|
503
|
-
floatingEl.value
|
|
504
|
-
);
|
|
505
|
-
if (focusableElements.length > 0) {
|
|
506
|
-
focusableElements[0].focus({
|
|
507
|
-
preventScroll: true
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
492
|
onClickOutside(
|
|
514
493
|
floatingEl,
|
|
515
494
|
() => {
|
|
@@ -556,6 +535,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
556
535
|
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
557
536
|
);
|
|
558
537
|
}
|
|
538
|
+
function focusFirst() {
|
|
539
|
+
nextTick(() => {
|
|
540
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
541
|
+
floatingEl.value
|
|
542
|
+
);
|
|
543
|
+
if (focusableElements.length > 0) {
|
|
544
|
+
focusableElements[0].focus({
|
|
545
|
+
preventScroll: true
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
function focusFirstListElement() {
|
|
551
|
+
nextTick(() => {
|
|
552
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
553
|
+
listEl.value
|
|
554
|
+
);
|
|
555
|
+
if (focusableElements.length > 0) {
|
|
556
|
+
focusableElements[0].focus({
|
|
557
|
+
preventScroll: true
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
559
562
|
function focusNext() {
|
|
560
563
|
nextTick(() => {
|
|
561
564
|
if (focused.value) {
|
|
@@ -604,6 +607,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
604
607
|
}
|
|
605
608
|
});
|
|
606
609
|
}
|
|
610
|
+
watch(expanded, (newValue) => {
|
|
611
|
+
if (newValue && props.autofocusFirst) {
|
|
612
|
+
focusFirst();
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
__expose({
|
|
616
|
+
toggle,
|
|
617
|
+
show,
|
|
618
|
+
hide,
|
|
619
|
+
init,
|
|
620
|
+
focusFirst,
|
|
621
|
+
focusFirstListElement,
|
|
622
|
+
focusNext,
|
|
623
|
+
focusPrev,
|
|
624
|
+
customPosition: hasCustomPosition
|
|
625
|
+
});
|
|
607
626
|
const hovered = useElementHover(floatingEl);
|
|
608
627
|
const { itemRole } = useDropdownProvideItem({
|
|
609
628
|
role,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@floating-ui/vue"),require("@vueuse/core"),require("mitt")):"function"==typeof define&&define.amd?define(["vue","@floating-ui/vue","@vueuse/core","mitt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdown=t(e.vue,e.vue$1,e.core,e.mitt)}(this,(function(e,t,o,r){"use strict";var
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@floating-ui/vue"),require("@vueuse/core"),require("mitt")):"function"==typeof define&&define.amd?define(["vue","@floating-ui/vue","@vueuse/core","mitt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdown=t(e.vue,e.vue$1,e.core,e.mitt)}(this,(function(e,t,o,r){"use strict";var n=(e=>(e.local="local",e.session="session",e))(n||{}),l=(e=>(e.absolute="absolute",e.fixed="fixed",e))(l||{}),a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),u=(e=>(e.topStart="top-start",e.topEnd="top-end",e.bottomStart="bottom-start",e.bottomEnd="bottom-end",e.leftStart="left-start",e.leftEnd="left-end",e.rightStart="right-start",e.rightEnd="right-end",e))(u||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),s=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(s||{}),d=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(d||{}),f=(e=>(e.listbox="listbox",e.menu="menu",e))(f||{}),c=(e=>(e.option="option",e.presentation="presentation",e))(c||{});const p=Symbol.for("dropdownTrigger"),v=Symbol.for("dropdownItem"),m={modifiers:{type:[String,Array],default:void 0}};i.before;const b={id:[String,Number]},g={placement:{type:String,default:a.bottom,validator:e=>Object.values(a).includes(e)||Object.values(u).includes(e)},strategy:{type:String,default:void 0,validator:e=>Object.values(l).includes(e)},transitionName:{type:String,default:void 0},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean,default:!1}};s.button,d.button,n.local;const h={...b,...g,...m,modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:f.menu,validator:e=>Object.values(f).includes(e)}};const y=["id","tabindex","role","aria-labelledby"];return e.defineComponent({name:"VvDropdown",inheritAttrs:!1,props:h,emits:["update:modelValue","beforeEnter","afterLeave","beforeExpand","beforeCollapse","afterExpand","afterCollapse","before-enter","after-leave","enter","afterEnter","enterCancelled","beforeLeave","leave","leaveCancelled"],setup(n,{expose:u,emit:i}){const s=n,d=i,{id:m}=e.toRefs(s),b=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(m),g=e.useAttrs(),h=e.ref("auto"),x=e.ref("auto"),w=e.ref(),S=e.ref(),E=e.ref(),k=e.ref(),P=e.computed({get:()=>s.reference??w.value,set:e=>{w.value=e}}),O=e.ref(!1);e.onMounted((()=>{o.useMutationObserver(S.value,(()=>{var e;O.value="true"===(null==(e=window.getComputedStyle(S.value).getPropertyValue("--dropdown-custom-position"))?void 0:e.trim())}),{attributeFilter:["style"],window:window})}));const $=e.computed((()=>{const e=[];if(s.autoPlacement?"boolean"==typeof s.autoPlacement?e.push(t.autoPlacement()):e.push(t.autoPlacement(s.autoPlacement)):s.flip&&("boolean"==typeof s.flip?e.push(t.flip({fallbackStrategy:"initialPlacement"})):e.push(t.flip(s.flip))),s.shift&&("boolean"==typeof s.shift?e.push(t.shift()):e.push(t.shift(s.shift))),s.size){const o=({availableWidth:e,availableHeight:t})=>{h.value=`${e}px`,x.value=`${t}px`};"boolean"==typeof s.size?e.push(t.size({apply:o})):e.push(t.size({...s.size,apply:o}))}return s.offset&&(e.push(t.offset(Number(s.offset))),["string","number"].includes(typeof s.offset)?e.push(t.offset(Number(s.offset))):e.push(t.offset(s.offset))),s.arrow&&e.push(t.arrow({element:E})),e})),{x:C,y:z,middlewareData:B,placement:V,strategy:j}=t.useFloating(P,S,{whileElementsMounted:(...e)=>t.autoUpdate(...e,{animationFrame:s.strategy===l.fixed}),placement:e.computed((()=>s.placement)),strategy:e.computed((()=>s.strategy)),middleware:$}),N=e.computed((()=>{var e;if(O.value)return;const t=s.triggerWidth&&P.value?`${null==(e=P.value)?void 0:e.offsetWidth}px`:void 0;return{position:j.value,top:`${z.value??0}px`,left:`${C.value??0}px`,maxWidth:t?void 0:h.value,maxHeight:x.value,width:t}})),A=e.computed((()=>V.value.split("-")[0])),F=e.computed((()=>{var e,t,o,r,n;if(O.value)return;const l={[a.top]:a.bottom,[a.right]:a.left,[a.bottom]:a.top,[a.left]:a.right}[A.value];return{left:void 0!==(null==(e=B.value.arrow)?void 0:e.x)?`${null==(t=B.value.arrow)?void 0:t.x}px`:void 0,top:void 0!==(null==(o=B.value.arrow)?void 0:o.y)?`${null==(r=B.value.arrow)?void 0:r.y}px`:void 0,[l]:-((null==(n=E.value)?void 0:n.offsetWidth)??0)/2+"px"}})),D=o.useVModel(s,"modelValue",d),T=e.ref(!1),_=e.computed({get:()=>D.value??T.value,set:e=>{void 0!==D.value?D.value=e:T.value=e}});function R(){_.value=!0}function L(){_.value=!1}function W(){_.value=!_.value}function q(e){P.value=e}o.onClickOutside(S,(()=>{!s.keepOpen&&_.value&&(_.value=!1)}),{ignore:[P]});const H=e.computed((()=>{var e,t;return(null==(t=null==(e=P.value)?void 0:e.getAttribute)?void 0:t.call(e,"id"))??void 0})),K=e.computed((()=>({"aria-controls":b.value,"aria-haspopup":!0,"aria-expanded":_.value}))),{component:M,bus:I}=function({reference:t,id:o,expanded:n,aria:l}){const a=r(),u=e.defineComponent({name:"VvDropdownTriggerProvider",setup(){e.provide(p,{reference:t,id:o,expanded:n,aria:l,bus:a})},render(){var t,o;return e.h(e.Fragment,{},null==(o=(t=this.$slots).default)?void 0:o.call(t))}});return{bus:a,component:u}}({reference:P,id:b,expanded:_,aria:K});I.on("click",W);const{role:U,modifiers:G}=e.toRefs(s),J=function(t,o,r){return e.computed((()=>{const n={[t]:!0},l="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{n[`${t}--${o}`]=e.unref(r.value[o])})),n}))}("vv-dropdown",G,e.computed((()=>({arrow:s.arrow})))),{focused:Q}=o.useFocusWithin(S);function X(e){return e?[...e.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden"))):[]}function Y(){e.nextTick((()=>{const e=X(S.value);e.length>0&&e[0].focus({preventScroll:!0})}))}function Z(){e.nextTick((()=>{if(Q.value){const e=X(S.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t<e.length-1?e[t+1].focus({preventScroll:!0}):e[0].focus({preventScroll:!0})}}))}function ee(){e.nextTick((()=>{if(Q.value){const e=X(S.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t>0?e[t-1].focus({preventScroll:!0}):e[e.length-1].focus({preventScroll:!0})}}))}e.watch(_,(e=>{e&&s.autofocusFirst&&Y()})),u({toggle:W,show:R,hide:L,init:q,focusFirst:Y,focusFirstListElement:function(){e.nextTick((()=>{const e=X(k.value);e.length>0&&e[0].focus({preventScroll:!0})}))},focusNext:Z,focusPrev:ee,customPosition:O});const te=o.useElementHover(S),{itemRole:oe}=function({role:t,...o}){const r=e.computed((()=>t.value===f.listbox?c.option:c.presentation));return e.provide(v,{role:r,...o}),{itemRole:r}}({role:U,expanded:_,focused:Q,hovered:te});o.onKeyStroke("Escape",(e=>{_.value&&(e.preventDefault(),L())})),o.onKeyStroke("ArrowDown",(e=>{_.value&&Q.value&&(e.preventDefault(),Z())})),o.onKeyStroke("ArrowUp",(e=>{_.value&&Q.value&&(e.preventDefault(),ee())})),o.onKeyStroke([" ","Enter"],(e=>{const t=e.target;_.value&&Q.value&&t&&(null==t||t.click())}));const re={"before-enter":()=>{d(_.value?"beforeExpand":"beforeCollapse"),d("beforeEnter")},"after-leave":()=>{d(_.value?"afterExpand":"afterCollapse"),d("afterLeave")},enter:()=>{d("enter")},"after-enter":()=>{d("afterEnter")},"enter-cancelled":()=>{d("enterCancelled")},"before-leave":()=>{d("beforeLeave")},leave:()=>{d("leave")},"leave-cancelled":()=>{d("leaveCancelled")}};return(t,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(M),null,{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps({init:q,show:R,hide:L,toggle:W,expanded:e.unref(_),aria:e.unref(K)})))])),_:3}),e.createVNode(e.Transition,e.mergeProps({name:t.transitionName},e.toHandlers(re),{persisted:""}),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:S,style:e.normalizeStyle(e.unref(N)),class:e.normalizeClass(e.unref(J))},[s.arrow?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"arrowEl",ref:E,style:e.normalizeStyle(e.unref(F)),class:"vv-dropdown__arrow"},null,4)):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(_)}))),e.createElementVNode("div",e.mergeProps(e.unref(g),{id:e.unref(b),ref_key:"listEl",ref:k,tabindex:e.unref(_)?void 0:-1,role:e.unref(U),"aria-labelledby":e.unref(H),class:"vv-dropdown__list"}),[e.renderSlot(t.$slots,"items",e.normalizeProps(e.guardReactiveProps({role:e.unref(oe)})))],16,y),e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(_)})))],6),[[e.vShow,e.unref(_)]])])),_:3},16,["name"])],64))}})}));
|
|
@@ -77,6 +77,10 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<globalThis
|
|
|
77
77
|
show: () => void;
|
|
78
78
|
hide: () => void;
|
|
79
79
|
init: (el: HTMLElement) => void;
|
|
80
|
+
focusFirst: () => void;
|
|
81
|
+
focusFirstListElement: () => void;
|
|
82
|
+
focusNext: () => void;
|
|
83
|
+
focusPrev: () => void;
|
|
80
84
|
customPosition: Ref<boolean, boolean>;
|
|
81
85
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
82
86
|
"update:modelValue": (...args: any[]) => void;
|
|
@@ -2,6 +2,15 @@ import { computed, isRef, defineComponent, h, inject, toRef, toRefs, getCurrentI
|
|
|
2
2
|
import { useVModel } from "@vueuse/core";
|
|
3
3
|
import Sortable from "vuedraggable";
|
|
4
4
|
import { iconLoaded, Icon, addIcon } from "@iconify/vue";
|
|
5
|
+
const ACTION_ICONS = {
|
|
6
|
+
add: "add",
|
|
7
|
+
edit: "edit",
|
|
8
|
+
download: "download"
|
|
9
|
+
};
|
|
10
|
+
const VvIconPropsDefaults = {
|
|
11
|
+
prefix: "normal"
|
|
12
|
+
/* normal */
|
|
13
|
+
};
|
|
5
14
|
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
6
15
|
StorageType2["local"] = "local";
|
|
7
16
|
StorageType2["session"] = "session";
|
|
@@ -263,15 +272,6 @@ const ActionProps = {
|
|
|
263
272
|
default: StorageType.local
|
|
264
273
|
}
|
|
265
274
|
});
|
|
266
|
-
const ACTION_ICONS = {
|
|
267
|
-
add: "add",
|
|
268
|
-
edit: "edit",
|
|
269
|
-
download: "download"
|
|
270
|
-
};
|
|
271
|
-
const VvIconPropsDefaults = {
|
|
272
|
-
prefix: "normal"
|
|
273
|
-
/* normal */
|
|
274
|
-
};
|
|
275
275
|
const VvInputFileProps = {
|
|
276
276
|
...IdNameProps,
|
|
277
277
|
...ModifiersProps,
|