@volverjs/ui-vue 0.0.9-beta.9 → 0.0.10-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/auto-imports.d.ts +2 -2
  2. package/dist/components/VvAccordion/VvAccordion.es.js +8 -7
  3. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +8 -7
  4. package/dist/components/VvAction/VvAction.es.js +8 -7
  5. package/dist/components/VvAlert/VvAlert.es.js +8 -7
  6. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +8 -7
  7. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +6 -6
  8. package/dist/components/VvAlertGroup/index.d.ts +2 -2
  9. package/dist/components/VvAvatar/VvAvatar.es.js +8 -7
  10. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +8 -7
  11. package/dist/components/VvBadge/VvBadge.es.js +8 -7
  12. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +8 -7
  13. package/dist/components/VvButton/VvButton.es.js +11 -10
  14. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +8 -7
  15. package/dist/components/VvCard/VvCard.es.js +8 -7
  16. package/dist/components/VvCheckbox/VvCheckbox.es.js +11 -10
  17. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +13 -12
  18. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  19. package/dist/components/VvCombobox/VvCombobox.es.js +158 -140
  20. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  21. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +306 -90
  22. package/dist/components/VvCombobox/index.d.ts +108 -31
  23. package/dist/components/VvDialog/VvDialog.es.js +16 -11
  24. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  25. package/dist/components/VvDropdown/VvDropdown.es.js +19 -16
  26. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  27. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +299 -91
  28. package/dist/components/VvDropdown/index.d.ts +99 -30
  29. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +8 -7
  30. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +8 -7
  31. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +8 -7
  32. package/dist/components/VvInputText/VvInputText.es.js +193 -103
  33. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  34. package/dist/components/VvInputText/VvInputText.vue.d.ts +19 -37
  35. package/dist/components/VvInputText/index.d.ts +15 -33
  36. package/dist/components/VvNav/VvNav.es.js +8 -7
  37. package/dist/components/VvProgress/VvProgress.es.js +8 -7
  38. package/dist/components/VvRadio/VvRadio.es.js +11 -10
  39. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +13 -12
  40. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  41. package/dist/components/VvSelect/VvSelect.es.js +14 -13
  42. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  43. package/dist/components/VvSelect/VvSelect.vue.d.ts +1 -1
  44. package/dist/components/VvTab/VvTab.es.js +8 -7
  45. package/dist/components/VvTextarea/VvTextarea.es.js +16 -12
  46. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  47. package/dist/components/VvTooltip/VvTooltip.es.js +8 -7
  48. package/dist/components/index.es.js +359 -245
  49. package/dist/components/index.umd.js +1 -1
  50. package/dist/composables/useOptions.d.ts +1 -1
  51. package/dist/constants.d.ts +4 -0
  52. package/dist/directives/index.es.js +8 -7
  53. package/dist/directives/v-tooltip.es.js +8 -7
  54. package/dist/icons.es.js +3 -3
  55. package/dist/icons.umd.js +1 -1
  56. package/dist/props/index.d.ts +100 -31
  57. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
  58. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +18 -18
  59. package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
  60. package/dist/stories/Combobox/ComboboxOptions.stories.d.ts +1 -0
  61. package/dist/stories/InputText/InputText.settings.d.ts +31 -9
  62. package/dist/stories/InputText/InputText.stories.d.ts +0 -1
  63. package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
  64. package/package.json +61 -60
  65. package/src/assets/icons/detailed.json +1 -1
  66. package/src/assets/icons/normal.json +1 -1
  67. package/src/assets/icons/simple.json +1 -1
  68. package/src/components/VvCombobox/VvCombobox.vue +51 -42
  69. package/src/components/VvCombobox/index.ts +13 -0
  70. package/src/components/VvDialog/VvDialog.vue +6 -2
  71. package/src/components/VvDropdown/VvDropdown.vue +18 -16
  72. package/src/components/VvInputText/VvInputText.vue +170 -55
  73. package/src/components/VvInputText/index.ts +32 -34
  74. package/src/components/VvSelect/VvSelect.vue +4 -4
  75. package/src/components/VvTextarea/VvTextarea.vue +8 -5
  76. package/src/composables/useOptions.ts +2 -2
  77. package/src/constants.ts +5 -0
  78. package/src/props/index.ts +7 -11
  79. package/src/stories/Combobox/Combobox.settings.ts +8 -0
  80. package/src/stories/Combobox/Combobox.test.ts +1 -1
  81. package/src/stories/Combobox/ComboboxOptions.stories.ts +18 -0
  82. package/src/stories/InputText/InputText.settings.ts +36 -15
  83. package/src/stories/InputText/InputText.stories.ts +4 -12
  84. package/src/stories/InputText/InputText.test.ts +31 -15
  85. package/src/stories/InputText/InputTextMask.stories.ts +122 -0
  86. package/src/utils/ObjectUtilities.ts +3 -2
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.nanoid,e.core,e.tsDotProp)}(this,(function(e,t,l,a){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const r=Symbol.for("volver"),u=Symbol.for("checkGroup");function d(e,t,l){return l?v(e,l)===v(t,l):s(e,t)}function s(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!=t.length)return!1;for(o=n;0!=o--;)if(!s(e[o],t[o]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,v=t instanceof RegExp;if(d!=v)return!1;if(d&&v)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,c[o]))return!1;for(o=n;0!=o--;)if(i=c[o],!s(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function v(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,o=l.length;t<o;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function f(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>c(a.value.invalidLabel))),n=e.computed((()=>c(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:m}}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},S={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const B={tabindex:{type:[String,Number],default:0}},O={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...O,name:{type:String,required:!0}},...B,...p,...m,...k,...h,...y,...S,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},x={...p,...m,...L,...k,...h,...y,...S,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function $(t){const l=e.inject(t,void 0),a=e.computed((()=>{return t=l,!(null==(a=e.unref(t))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var t,a}));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){if(null==l?void 0:l.value){const a=e.unref(l.value)[t];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}i.button;const A={...V,...S,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(t,l,a){const o=e.inject(r),n=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function j(t,l,a){return e.computed((()=>{const o={[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&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const w=["for"],R=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],P=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=e.useSlots(),i=C("VvCheckbox",A,o),{id:r,disabled:s,readonly:v,valid:c,invalid:p,propsSwitch:m,modelValue:b,indeterminate:h,isInGroup:g}=function(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=$(u),{id:i,switch:r,indeterminate:d}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(o,a),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!g.value)),O=e.computed((()=>s.value||v.value)),V=e.computed((()=>!0===p.value||!0!==c.value&&void 0)),x=e.computed((()=>B.value?b.value===o.value:Array.isArray(b.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(d(e,l))return!0;return!1}(o.value,b.value):d(o.value,b.value))),P=e.computed((()=>!!h.value||!(x.value||!B.value||o.uncheckedValue===b.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)b.value=e?o.value:o.uncheckedValue;else if(Array.isArray(b.value)||g.value){const t=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?t.add(o.value):t.delete(o.value),b.value=[...t]}else b.value=e?o.value:void 0;a("change",e)}}),{modifiers:_}=e.toRefs(o),z=j("vv-checkbox",_,e.computed((()=>({switch:m.value,valid:c.value,invalid:p.value,disabled:s.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(b.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>P.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{P.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=f(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(E)?E.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(O),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(V),"aria-describedby":e.unref(I)?e.unref(S):void 0,"aria-errormessage":e.unref(D)?e.unref(S):void 0},null,8,R),[[e.vModelCheckbox,e.unref(E)]]),e.renderSlot(t.$slots,"default",{value:e.unref(b)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"3"}:void 0]),1032,["id"])],10,w))}}),N=x;const E=["textContent"],_={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:N,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=e.useSlots(),r=C("VvCheckboxGroup",N,n),d=l.useVModel(n,"modelValue",o),{disabled:s,readonly:v,vertical:c,valid:p,invalid:m,modifiers:b}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:h,getOptionValue:g}=function(t){const{options:l,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),y=j("vv-checkbox-group",b,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!c.value,valid:p.value,invalid:m.value})))),{HintSlot:S,hintSlotScope:k}=f(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,E)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(P,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:h(e),value:g(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.nanoid,e.core,e.tsDotProp)}(this,(function(e,t,l,a){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const r=Symbol.for("volver"),u=Symbol.for("checkGroup");function d(e,t,l){return l?v(e,l)===v(t,l):s(e,t)}function s(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!=t.length)return!1;for(o=n;0!=o--;)if(!s(e[o],t[o]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,v=t instanceof RegExp;if(d!=v)return!1;if(d&&v)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,c[o]))return!1;for(o=n;0!=o--;)if(i=c[o],!s(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function v(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,o=l.length;t<o;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function f(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>c(a.value.invalidLabel))),n=e.computed((()=>c(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:m}}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},S={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const B={tabindex:{type:[String,Number],default:0}},O={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...O,name:{type:String,required:!0}},...B,...p,...m,...k,...h,...y,...S,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},x={...p,...m,...L,...k,...h,...y,...S,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function $(t){const l=e.inject(t,void 0),a=e.computed((()=>{return t=l,!(null==(a=e.unref(t))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var t,a}));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){if(null==l?void 0:l.value){const a=e.unref(l.value)[t];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}i.button;const A={...V,...S,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(t,l,a){const o=e.inject(r),n=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function j(t,l,a){return e.computed((()=>{const o={[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&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const w=["for"],R=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],P=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=e.useSlots(),i=C("VvCheckbox",A,o),{id:r,disabled:s,readonly:v,valid:c,invalid:p,propsSwitch:m,modelValue:b,indeterminate:h,isInGroup:g}=function(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=$(u),{id:i,switch:r,indeterminate:d}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(o,a),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!g.value)),O=e.computed((()=>s.value||v.value)),V=e.computed((()=>!0===p.value||!0!==c.value&&void 0)),x=e.computed((()=>B.value?b.value===o.value:Array.isArray(b.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(d(e,l))return!0;return!1}(o.value,b.value):d(o.value,b.value))),P=e.computed((()=>!!h.value||!(x.value||!B.value||o.uncheckedValue===b.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)b.value=e?o.value:o.uncheckedValue;else if(Array.isArray(b.value)||g.value){const t=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?t.add(o.value):t.delete(o.value),b.value=[...t]}else b.value=e?o.value:void 0;a("change",e)}}),{modifiers:_}=e.toRefs(o),z=j("vv-checkbox",_,e.computed((()=>({switch:m.value,valid:c.value,invalid:p.value,disabled:s.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(b.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>P.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{P.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=f(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(E)?E.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(O),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(V),"aria-describedby":e.unref(I)?e.unref(S):void 0,"aria-errormessage":e.unref(D)?e.unref(S):void 0},null,8,R),[[e.vModelCheckbox,e.unref(E)]]),e.renderSlot(t.$slots,"default",{value:e.unref(b)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"3"}:void 0]),1032,["id"])],10,w))}}),N=x;const E=["textContent"],_={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:N,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=e.useSlots(),r=C("VvCheckboxGroup",N,n),d=l.useVModel(n,"modelValue",o),{disabled:s,readonly:v,vertical:c,valid:p,invalid:m,modifiers:b}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:h,getOptionValue:g}=function(t){const{options:l,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),y=j("vv-checkbox-group",b,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!c.value,valid:p.value,invalid:m.value})))),{HintSlot:S,hintSlotScope:k}=f(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,E)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(P,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:h(e),value:g(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
@@ -2,9 +2,14 @@ import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, creat
2
2
  import { iconExists, Icon, addIcon } from "@iconify/vue";
3
3
  import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
4
4
  import { nanoid } from "nanoid";
5
- import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced } from "@vueuse/core";
5
+ import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
6
6
  import mitt from "mitt";
7
7
  import { get } from "ts-dot-prop";
8
+ var Strategy = /* @__PURE__ */ ((Strategy2) => {
9
+ Strategy2["absolute"] = "absolute";
10
+ Strategy2["fixed"] = "fixed";
11
+ return Strategy2;
12
+ })(Strategy || {});
8
13
  var Side = /* @__PURE__ */ ((Side2) => {
9
14
  Side2["left"] = "left";
10
15
  Side2["right"] = "right";
@@ -249,19 +254,15 @@ const DropdownProps = {
249
254
  placement: {
250
255
  type: String,
251
256
  default: Side.bottom,
252
- validator: (value) => {
253
- return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
254
- }
257
+ validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
255
258
  },
256
259
  /**
257
260
  * Dropdown strategy
258
261
  */
259
262
  strategy: {
260
263
  type: String,
261
- default: "absolute",
262
- validator: (value) => {
263
- return ["fixed", "absolute"].includes(value);
264
- }
264
+ default: void 0,
265
+ validator: (value) => Object.values(Strategy).includes(value)
265
266
  },
266
267
  /**
267
268
  * Dropdown show / hide transition name
@@ -455,6 +456,13 @@ const VvComboboxProps = {
455
456
  * Use input text to search on options
456
457
  */
457
458
  searchable: Boolean,
459
+ /**
460
+ * Search function to filter options
461
+ */
462
+ searchFunction: {
463
+ type: Function,
464
+ default: void 0
465
+ },
458
466
  /**
459
467
  * On searchable select is the input search placeholder
460
468
  */
@@ -884,7 +892,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
884
892
  }
885
893
  } else if (props.flip) {
886
894
  if (typeof props.flip === "boolean") {
887
- toReturn.push(flip());
895
+ toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
888
896
  } else {
889
897
  toReturn.push(flip(props.flip));
890
898
  }
@@ -936,13 +944,13 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
936
944
  }
937
945
  return toReturn;
938
946
  });
939
- const { x, y, strategy, middlewareData, placement } = useFloating(
947
+ const { x, y, middlewareData, placement, strategy } = useFloating(
940
948
  referenceEl,
941
949
  floatingEl,
942
950
  {
943
951
  whileElementsMounted: (...args) => {
944
952
  return autoUpdate(...args, {
945
- animationFrame: props.strategy === "fixed"
953
+ animationFrame: props.strategy === Strategy.fixed
946
954
  });
947
955
  },
948
956
  placement: computed(() => props.placement),
@@ -951,16 +959,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
951
959
  }
952
960
  );
953
961
  const dropdownPlacement = computed(() => {
962
+ var _a;
954
963
  if (hasCustomPosition.value) {
955
964
  return void 0;
956
965
  }
966
+ const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
957
967
  return {
958
968
  position: strategy.value,
959
969
  top: `${y.value ?? 0}px`,
960
970
  left: `${x.value ?? 0}px`,
961
- maxWidth: maxWidth.value,
971
+ maxWidth: width ? void 0 : maxWidth.value,
962
972
  maxHeight: maxHeight.value,
963
- width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
973
+ width
964
974
  };
965
975
  });
966
976
  const side = computed(
@@ -972,10 +982,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
972
982
  return void 0;
973
983
  }
974
984
  const staticSide = {
975
- top: "bottom",
976
- right: "left",
977
- bottom: "top",
978
- left: "right"
985
+ [Side.top]: Side.bottom,
986
+ [Side.right]: Side.left,
987
+ [Side.bottom]: Side.top,
988
+ [Side.left]: Side.right
979
989
  }[side.value];
980
990
  return {
981
991
  left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
@@ -1345,10 +1355,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1345
1355
  }
1346
1356
  });
1347
1357
  function equals(obj1, obj2, field) {
1348
- if (field)
1358
+ if (field) {
1349
1359
  return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
1350
- else
1351
- return deepEquals(obj1, obj2);
1360
+ }
1361
+ return deepEquals(obj1, obj2);
1352
1362
  }
1353
1363
  function deepEquals(a, b) {
1354
1364
  if (a === b)
@@ -1727,7 +1737,7 @@ function useOptions(props) {
1727
1737
  return option;
1728
1738
  return typeof valueKey.value === "function" ? valueKey.value(option) : get(option, valueKey.value);
1729
1739
  };
1730
- const getOptionDisabled = (option) => {
1740
+ const isOptionDisabled = (option) => {
1731
1741
  if (typeof option !== "object" && option !== null)
1732
1742
  return false;
1733
1743
  return typeof disabledKey.value === "function" ? disabledKey.value(option) : get(option, disabledKey.value);
@@ -1741,7 +1751,7 @@ function useOptions(props) {
1741
1751
  options,
1742
1752
  getOptionLabel,
1743
1753
  getOptionValue,
1744
- getOptionDisabled,
1754
+ isOptionDisabled,
1745
1755
  getOptionGrouped
1746
1756
  };
1747
1757
  }
@@ -1862,7 +1872,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1862
1872
  const {
1863
1873
  getOptionLabel,
1864
1874
  getOptionValue,
1865
- getOptionDisabled,
1875
+ isOptionDisabled,
1866
1876
  getOptionGrouped
1867
1877
  } = useOptions(props);
1868
1878
  const localModelValue = computed({
@@ -1914,17 +1924,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1914
1924
  return openBlock(), createElementBlock(Fragment, null, [
1915
1925
  !isGroup(option) ? (openBlock(), createElementBlock("option", {
1916
1926
  key: index,
1917
- disabled: unref(getOptionDisabled)(option),
1927
+ disabled: unref(isOptionDisabled)(option),
1918
1928
  value: unref(getOptionValue)(option)
1919
1929
  }, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1)) : (openBlock(), createElementBlock("optgroup", {
1920
1930
  key: `group-${index}`,
1921
- disabled: unref(getOptionDisabled)(option),
1931
+ disabled: unref(isOptionDisabled)(option),
1922
1932
  label: unref(getOptionLabel)(option)
1923
1933
  }, [
1924
1934
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(option), (item, i) => {
1925
1935
  return openBlock(), createElementBlock("option", {
1926
1936
  key: `group-${index}-item-${i}`,
1927
- disabled: unref(getOptionDisabled)(item),
1937
+ disabled: unref(isOptionDisabled)(item),
1928
1938
  value: unref(getOptionValue)(item)
1929
1939
  }, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9$1);
1930
1940
  }), 128))
@@ -2467,7 +2477,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2467
2477
  const searchText = ref("");
2468
2478
  const debouncedSearchText = refDebounced(
2469
2479
  searchText,
2470
- Number(props.debounceSearch)
2480
+ computed(() => Number(props.debounceSearch))
2471
2481
  );
2472
2482
  watch(
2473
2483
  debouncedSearchText,
@@ -2490,7 +2500,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2490
2500
  expanded.value = false;
2491
2501
  };
2492
2502
  const onAfterExpand = () => {
2493
- if (searchable.value) {
2503
+ if (propsDefaults.value.searchable) {
2494
2504
  if (inputSearchEl.value) {
2495
2505
  inputSearchEl.value.focus({
2496
2506
  preventScroll: true
@@ -2499,7 +2509,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2499
2509
  }
2500
2510
  };
2501
2511
  const onAfterCollapse = () => {
2502
- if (searchable.value) {
2512
+ if (propsDefaults.value.searchable) {
2503
2513
  searchText.value = "";
2504
2514
  }
2505
2515
  };
@@ -2513,14 +2523,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2513
2523
  loading,
2514
2524
  valid,
2515
2525
  invalid,
2516
- floating,
2517
- searchable
2526
+ floating
2518
2527
  } = toRefs(props);
2519
2528
  const hasId = useUniqueId(id);
2520
2529
  const hasHintId = computed(() => `${hasId.value}-hint`);
2521
2530
  const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
2522
2531
  const hasSearchId = computed(() => `${hasId.value}-search`);
2523
2532
  const hasLabelId = computed(() => `${hasId.value}-label`);
2533
+ const localLoading = ref(false);
2534
+ const isLoading = computed(() => localLoading.value || loading.value);
2524
2535
  const dropdownEl = ref();
2525
2536
  const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
2526
2537
  icon,
@@ -2535,7 +2546,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2535
2546
  modifiers,
2536
2547
  computed(() => ({
2537
2548
  disabled: disabled.value,
2538
- loading: loading.value,
2549
+ loading: isLoading.value,
2539
2550
  readonly: readonly.value,
2540
2551
  "icon-before": Boolean(hasIconBefore.value),
2541
2552
  "icon-after": Boolean(hasIconAfter.value),
@@ -2550,41 +2561,44 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2550
2561
  const {
2551
2562
  getOptionLabel,
2552
2563
  getOptionValue,
2553
- getOptionDisabled,
2554
- getOptionGrouped
2564
+ getOptionGrouped,
2565
+ isOptionDisabled
2555
2566
  } = useOptions(props);
2556
- const filteredOptions = computed(() => {
2567
+ const filteredOptions = computedAsync(async () => {
2557
2568
  var _a;
2569
+ if (propsDefaults.value.searchFunction) {
2570
+ localLoading.value = true;
2571
+ const toReturn = await Promise.resolve(
2572
+ propsDefaults.value.searchFunction(
2573
+ debouncedSearchText.value,
2574
+ props.options
2575
+ )
2576
+ );
2577
+ localLoading.value = false;
2578
+ return toReturn;
2579
+ }
2558
2580
  return (_a = props.options) == null ? void 0 : _a.filter((option) => {
2559
2581
  return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
2560
2582
  });
2561
2583
  });
2562
- function getOptionSelected(option) {
2584
+ function isOptionSelected(option) {
2563
2585
  if (Array.isArray(props.modelValue)) {
2564
2586
  return contains(option, props.modelValue) || contains(getOptionValue(option), props.modelValue);
2565
2587
  }
2566
2588
  return equals(option, props.modelValue) || equals(getOptionValue(option), props.modelValue);
2567
2589
  }
2568
2590
  const selectedOptions = computed(() => {
2569
- let selectedValues = [];
2570
- if (Array.isArray(props.modelValue)) {
2571
- selectedValues = props.modelValue;
2572
- } else if (props.modelValue) {
2573
- selectedValues = [props.modelValue];
2574
- }
2575
- const options = props.options.reduce((acc, value) => {
2576
- if (isGroup(value)) {
2577
- return [...acc, ...getOptionGrouped(value)];
2578
- }
2579
- return [...acc, value];
2580
- }, []);
2591
+ const options = props.options.reduce(
2592
+ (acc, value) => {
2593
+ if (isGroup(value)) {
2594
+ return [...acc, ...getOptionGrouped(value)];
2595
+ }
2596
+ return [...acc, value];
2597
+ },
2598
+ []
2599
+ );
2581
2600
  return options.filter((option) => {
2582
- if (isGroup(option)) {
2583
- return getOptionGrouped(option).some(
2584
- (item) => selectedValues.includes(getOptionValue(item))
2585
- );
2586
- }
2587
- return selectedValues.includes(getOptionValue(option));
2601
+ return isOptionSelected(option);
2588
2602
  });
2589
2603
  });
2590
2604
  const hasValue = computed(() => {
@@ -2631,7 +2645,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2631
2645
  invalid: invalid.value,
2632
2646
  invalidLabel: propsDefaults.value.invalidLabel,
2633
2647
  hintLabel: propsDefaults.value.hintLabel,
2634
- loading: loading.value,
2648
+ loading: isLoading.value,
2635
2649
  loadingLabel: propsDefaults.value.loadingLabel,
2636
2650
  disabled: disabled.value,
2637
2651
  readonly: readonly.value,
@@ -2659,7 +2673,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2659
2673
  flip: propsDefaults.value.flip,
2660
2674
  autoPlacement: propsDefaults.value.autoPlacement,
2661
2675
  arrow: propsDefaults.value.arrow,
2662
- autofocusFirst: searchable.value ? true : propsDefaults.value.autofocusFirst,
2676
+ autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
2663
2677
  triggerWidth: propsDefaults.value.triggerWidth,
2664
2678
  modifiers: propsDefaults.value.dropdownModifiers
2665
2679
  }));
@@ -2691,7 +2705,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2691
2705
  _ctx.label ? (openBlock(), createElementBlock("label", {
2692
2706
  key: 0,
2693
2707
  id: unref(hasLabelId),
2694
- for: unref(searchable) ? unref(hasSearchId) : void 0
2708
+ for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
2695
2709
  }, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("", true),
2696
2710
  createElementVNode("div", {
2697
2711
  ref_key: "wrapperEl",
@@ -2743,6 +2757,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2743
2757
  _ctx.unselectable && !unref(readonly) && !unref(disabled) ? (openBlock(), createElementBlock("button", {
2744
2758
  key: 0,
2745
2759
  "aria-label": unref(propsDefaults).deselectActionLabel,
2760
+ type: "button",
2746
2761
  onClick: withModifiers(($event) => onInput(option), ["stop"])
2747
2762
  }, [
2748
2763
  createVNode(_sfc_main$9, { name: "close" })
@@ -2765,87 +2780,90 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2765
2780
  renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
2766
2781
  ])) : createCommentVNode("", true)
2767
2782
  ]),
2768
- items: withCtx(() => [
2769
- unref(filteredOptions).length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
2770
- return openBlock(), createElementBlock(Fragment, { key: index }, [
2771
- isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2772
- createVNode(_sfc_main$5, {
2773
- label: unref(getOptionLabel)(option)
2774
- }, null, 8, ["label"]),
2775
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
2776
- option
2777
- ), (item, i) => {
2778
- return openBlock(), createBlock(_sfc_main$6, mergeProps({
2779
- disabled: unref(getOptionDisabled)(item),
2780
- selected: getOptionSelected(item),
2781
- unselectable: _ctx.unselectable,
2782
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2783
- selectHintLabel: unref(propsDefaults).selectHintLabel,
2784
- selectedHintLabel: unref(propsDefaults).selectedHintLabel
2785
- }, {
2786
- key: i,
2787
- class: "vv-dropdown-option",
2788
- onClickPassive: ($event) => onInput(item)
2789
- }), {
2790
- default: withCtx(() => [
2791
- renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2792
- option,
2793
- selectedOptions: unref(selectedOptions),
2794
- selected: getOptionSelected(item),
2795
- disabled: unref(getOptionDisabled)(item)
2796
- })), () => [
2797
- createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
2798
- ])
2799
- ]),
2800
- _: 2
2801
- }, 1040, ["onClickPassive"]);
2802
- }), 128))
2803
- ], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
2804
- disabled: unref(getOptionDisabled)(option),
2805
- selected: getOptionSelected(option),
2806
- unselectable: _ctx.unselectable,
2807
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2808
- selectHintLabel: unref(propsDefaults).selectHintLabel,
2809
- selectedHintLabel: unref(propsDefaults).selectedHintLabel
2810
- }, {
2811
- class: "vv-dropdown-option",
2812
- onClickPassive: ($event) => onInput(option)
2813
- }), {
2814
- default: withCtx(() => [
2815
- renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2816
- option,
2817
- selectedOptions: unref(selectedOptions),
2818
- selected: getOptionSelected(option),
2819
- disabled: unref(getOptionDisabled)(option)
2820
- })), () => [
2821
- createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
2822
- ])
2823
- ]),
2824
- _: 2
2825
- }, 1040, ["onClickPassive"]))
2826
- ], 64);
2827
- }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
2828
- key: 1,
2829
- modifiers: "inert"
2830
- }, {
2831
- default: withCtx(() => [
2832
- renderSlot(_ctx.$slots, "no-options", {}, () => [
2833
- createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
2834
- ])
2835
- ]),
2836
- _: 3
2837
- })) : (openBlock(), createBlock(_sfc_main$6, {
2838
- key: 2,
2839
- modifiers: "inert"
2840
- }, {
2841
- default: withCtx(() => [
2842
- renderSlot(_ctx.$slots, "no-results", {}, () => [
2843
- createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
2844
- ])
2845
- ]),
2846
- _: 3
2847
- }))
2848
- ]),
2783
+ items: withCtx(() => {
2784
+ var _a;
2785
+ return [
2786
+ !unref(disabled) && ((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
2787
+ return openBlock(), createElementBlock(Fragment, { key: index }, [
2788
+ isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2789
+ createVNode(_sfc_main$5, {
2790
+ label: unref(getOptionLabel)(option)
2791
+ }, null, 8, ["label"]),
2792
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
2793
+ option
2794
+ ), (item, i) => {
2795
+ return openBlock(), createBlock(_sfc_main$6, mergeProps({
2796
+ selected: isOptionSelected(item),
2797
+ disabled: unref(isOptionDisabled)(item),
2798
+ unselectable: _ctx.unselectable,
2799
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2800
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
2801
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
2802
+ }, {
2803
+ key: i,
2804
+ class: "vv-dropdown-option",
2805
+ onClickPassive: ($event) => onInput(item)
2806
+ }), {
2807
+ default: withCtx(() => [
2808
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2809
+ option,
2810
+ selectedOptions: unref(selectedOptions),
2811
+ selected: isOptionSelected(item),
2812
+ disabled: unref(isOptionDisabled)(item)
2813
+ })), () => [
2814
+ createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
2815
+ ])
2816
+ ]),
2817
+ _: 2
2818
+ }, 1040, ["onClickPassive"]);
2819
+ }), 128))
2820
+ ], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
2821
+ selected: isOptionSelected(option),
2822
+ disabled: unref(isOptionDisabled)(option),
2823
+ unselectable: _ctx.unselectable,
2824
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2825
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
2826
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
2827
+ }, {
2828
+ class: "vv-dropdown-option",
2829
+ onClickPassive: ($event) => onInput(option)
2830
+ }), {
2831
+ default: withCtx(() => [
2832
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2833
+ option,
2834
+ selectedOptions: unref(selectedOptions),
2835
+ selected: isOptionSelected(option),
2836
+ disabled: unref(isOptionDisabled)(option)
2837
+ })), () => [
2838
+ createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
2839
+ ])
2840
+ ]),
2841
+ _: 2
2842
+ }, 1040, ["onClickPassive"]))
2843
+ ], 64);
2844
+ }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
2845
+ key: 1,
2846
+ modifiers: "inert"
2847
+ }, {
2848
+ default: withCtx(() => [
2849
+ renderSlot(_ctx.$slots, "no-options", {}, () => [
2850
+ createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
2851
+ ])
2852
+ ]),
2853
+ _: 3
2854
+ })) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$6, {
2855
+ key: 2,
2856
+ modifiers: "inert"
2857
+ }, {
2858
+ default: withCtx(() => [
2859
+ renderSlot(_ctx.$slots, "no-results", {}, () => [
2860
+ createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
2861
+ ])
2862
+ ]),
2863
+ _: 3
2864
+ })) : createCommentVNode("", true)
2865
+ ];
2866
+ }),
2849
2867
  after: withCtx(() => [
2850
2868
  renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
2851
2869
  var _a;
@@ -2861,11 +2879,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2861
2879
  ]),
2862
2880
  _: 2
2863
2881
  }, [
2864
- unref(searchable) || _ctx.$slots["dropdown::before"] ? {
2882
+ unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
2865
2883
  name: "before",
2866
2884
  fn: withCtx(() => [
2867
2885
  renderSlot(_ctx.$slots, "dropdown::before"),
2868
- unref(searchable) ? withDirectives((openBlock(), createElementBlock("input", {
2886
+ unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
2869
2887
  key: 0,
2870
2888
  id: unref(hasSearchId),
2871
2889
  ref_key: "inputSearchEl",