@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +54 -15
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +23 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +338 -0
- package/dist/components/VvAction/VvAction.umd.js +1 -0
- package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
- package/dist/components/VvAction/index.d.ts +24 -0
- package/dist/components/VvBadge/VvBadge.es.js +251 -22
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +720 -261
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
- package/dist/components/VvButton/index.d.ts +30 -75
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +60 -28
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckbox/index.d.ts +6 -6
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
- package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
- package/dist/components/VvCombobox/index.d.ts +54 -23
- package/dist/components/VvDialog/VvDialog.es.js +426 -115
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
- package/dist/components/VvDropdown/index.d.ts +35 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
- package/dist/components/VvIcon/VvIcon.es.js +116 -52
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +1054 -376
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +67 -3
- package/dist/components/VvProgress/VvProgress.es.js +254 -23
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +568 -137
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
- package/dist/components/VvRadioGroup/index.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +703 -251
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
- package/dist/components/VvSelect/index.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
- package/dist/components/VvTextarea/index.d.ts +7 -7
- package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3676 -2007
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +30 -0
- package/dist/directives/index.es.js +288 -0
- package/dist/directives/index.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +285 -0
- package/dist/directives/v-tooltip.umd.js +1 -0
- package/dist/icons.es.js +38 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +115 -3269
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +215 -23
- package/dist/resolvers/unplugin.d.ts +14 -8
- package/dist/resolvers/unplugin.es.js +94 -33
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +1 -1
- package/package.json +167 -63
- package/src/Volver.ts +60 -26
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +144 -0
- package/src/components/VvAction/index.ts +5 -0
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +41 -124
- package/src/components/VvButton/index.ts +16 -88
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +85 -57
- package/src/components/VvCombobox/index.ts +12 -10
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +6 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
- package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
- package/src/components/VvDropdown/index.ts +6 -11
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +128 -35
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +3 -5
- package/src/components/VvTextarea/VvTextarea.vue +4 -4
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +9 -11
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +8 -9
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/constants.ts +36 -0
- package/src/directives/index.ts +1 -1
- package/src/directives/v-tooltip.ts +2 -2
- package/src/index.ts +0 -2
- package/src/props/index.ts +111 -19
- package/src/resolvers/unplugin.ts +96 -49
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
- package/src/stories/Button/Button.stories.mdx +4 -2
- package/src/stories/Button/Button.test.ts +3 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
- package/src/stories/Button/ButtonState.stories.mdx +2 -11
- package/src/stories/Card/Card.stories.mdx +2 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
- package/src/stories/Combobox/Combobox.settings.ts +44 -0
- package/src/stories/Combobox/Combobox.stories.mdx +40 -1
- package/src/stories/Dialog/Dialog.stories.mdx +2 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
- package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
- package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
- package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
- package/src/stories/Icon/Icon.stories.mdx +2 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +42 -1
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Progress/Progress.stories.mdx +2 -1
- package/src/stories/Radio/Radio.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
- package/src/stories/Select/Select.stories.mdx +2 -1
- package/src/stories/Textarea/Textarea.stories.mdx +2 -1
- package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
- package/src/stories/argTypes.ts +2 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("vue"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue"],u):(e=typeof globalThis<"u"?globalThis:e||self,e.VvSelect=u(e.vue,e.vue$1))})(this,function(e,u){"use strict";const H={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}},R={name:"VvIcon"},A=e.defineComponent({...R,props:H,setup(t){const i=t,r=ref(!0),c=useVolver(),{modifiers:p}=toRefs(i),g=useBemModifiers("vv-icon",p),s=computed(()=>i.provider||(c==null?void 0:c.provider)),b=computed(()=>{const o=i.name??"",n=`@${s.value}:${i.prefix}:${i.name}`;return u.iconExists(o)?o:u.iconExists(n)?n:(c==null?void 0:c.iconsCollections.find(f=>{const a=`@${s.value}:${f.prefix}:${o}`;if(u.iconExists(a))return a}))||o});function y(o){let n=null;if(typeof window>"u"){const{JSDOM:v}=require("jsdom");n=new v().window}return(n?new n.DOMParser:new window.DOMParser).parseFromString(o,"text/html").querySelector("svg")}function d(o){const n=y(o),f=(n==null?void 0:n.innerHTML.trim())||"";n&&f&&u.addIcon(`@${s.value}:${i.prefix}:${i.name}`,{body:f,height:n.viewBox.baseVal.height,width:n.viewBox.baseVal.width})}return c&&(i.src&&!u.iconExists(`@${s.value}:${i.prefix}:${i.name}`)?(r.value=!1,c.fetchIcon(i.src).then(o=>{o&&(d(o),r.value=!0)}).catch(o=>{throw new Error(`During fetch icon: ${o==null?void 0:o.message}`)})):i.svg&&d(i.svg)),(o,n)=>e.unref(r)?(e.openBlock(),e.createBlock(e.unref(u.Icon),e.mergeProps({key:0,class:e.unref(g)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:o.rotate,color:o.color,onLoad:o.onLoad,icon:e.unref(b)}),null,16,["class"])):e.createCommentVNode("",!0)}});function k(t){return Array.isArray(t)?t.filter(i=>isString(i)).join(" "):t}function T(t,i){const{invalid:r,valid:c,hint:p,loading:g}=i,{hintLabel:s,modelValue:b,valid:y,validLabel:d,invalid:o,invalidLabel:n,...f}=toRefs(t),a=resolveFieldData(f,"loading"),m=resolveFieldData(f,"loadingLabel"),v=computed(()=>o.value?!!(o.value&&r||n!=null&&n.value&&Array.isArray(n.value)&&n.value.length>0||n!=null&&n.value&&!isEmpty(n)):!1),E=computed(()=>!!(s&&s.value||p)),B=computed(()=>!!(d&&d.value||c)),N=computed(()=>!!(a!=null&&a.value&&g||a!=null&&a.value&&(m!=null&&m.value))),V=computed(()=>E.value||B.value||v.value||N.value);return{hasInvalid:v,hasHint:E,hasValid:B,hasLoading:N,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(P){const C=computed(()=>{const S=toReactive({hintLabel:s,modelValue:b,valid:y,validLabel:d,invalid:o,invalidLabel:n,loading:a,loadingLabel:m,...P.params});return o!=null&&o.value?(r==null?void 0:r(S))||k(n==null?void 0:n.value)||(s==null?void 0:s.value):y!=null&&y.value?(c==null?void 0:c(S))||k(d==null?void 0:d.value)||(s==null?void 0:s.value):a!=null&&a.value?(g==null?void 0:g(S))||k(m==null?void 0:m.value)||(s==null?void 0:s.value):(p==null?void 0:p(S))||k(s==null?void 0:s.value)||(s==null?void 0:s.value)});return{isVisible:V,hasInvalid:v,hasValid:B,hintContent:C}},render(){if(this.isVisible)return h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}var w=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(w||{}),D=(t=>(t.topStart="top-start",t.topEnd="top-end",t.bottomStart="bottom-start",t.bottomEnd="bottom-end",t.leftStart="left-start",t.leftEnd="left-end",t.rightStart="right-start",t.rightEnd="right-end",t))(D||{}),F=(t=>(t.before="before",t.after="after",t))(F||{});const K={valid:Boolean,validLabel:[String,Array]},U={invalid:Boolean,invalidLabel:[String,Array]},x={loading:Boolean,loadingLabel:String},J={disabled:Boolean},W={readonly:Boolean},G={modifiers:[String,Array]},Q={hintLabel:{type:String,default:""}},X={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},Y={icon:{type:[String,Object]},iconPosition:{type:String,default:F.before,validation:t=>Object.values(F).includes(t)}},Z={tabindex:{type:[String,Number],default:0}},L={floating:Boolean},ee={unselectable:{type:Boolean,default:!0}},te={id:[String,Number]};w.bottom;const oe={...{...te,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...Z,...K,...U,...Q,...x,...J,...W,...G,...X,...Y,...L,...ee,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},label:String,placeholder:String},ne=["update:modelValue","focus","blur"],re=["for"],se={class:"vv-select__wrapper"},ie={key:0,class:"vv-select__input-before"},le={class:"vv-select__inner"},ae=["id"],ce=["disabled","hidden"],de=["disabled","value"],ue={key:1,class:"vv-select__input-after"},pe={name:"VvSelect"};return e.defineComponent({...pe,props:oe,emits:ne,setup(t,{emit:i}){const r=t,c=useSlots(),p=ref(),{HintSlot:g,hasHint:s,hasInvalid:b}=T(r,c),{id:y,modifiers:d,disabled:o,readonly:n,loading:f,icon:a,iconPosition:m,invalid:v,valid:E,floating:B,multiple:N}=toRefs(r),V=useUniqueId(y),P=computed(()=>`${V.value}-hint`),{focused:C}=useComponentFocus(p,i),S=useElementVisibility(p);watch(S,l=>{l&&r.autofocus&&(C.value=!0)});const{hasIcon:$,hasIconBefore:j,hasIconAfter:q}=useComponentIcon(a,m),fe=computed(()=>!isEmpty(r.modelValue)),z=computed(()=>r.disabled||r.readonly),me=computed(()=>z.value?-1:r.tabindex),ge=computed(()=>{if(r.invalid===!0)return!0;if(r.valid===!0)return!1}),ye=useBemModifiers("vv-select",d,computed(()=>({valid:E.value,invalid:v.value,loading:f.value,disabled:o.value,readonly:n.value,"icon-before":j.value,"icon-after":q.value,dirty:fe.value,focus:C.value,floating:B.value,multiple:N.value}))),he=computed(()=>({name:r.name,tabindex:me.value,disabled:z.value,required:r.required,size:r.size,autocomplete:r.autocomplete,multiple:r.multiple,"aria-invalid":ge.value,"aria-describedby":!b.value&&s.value?P.value:void 0,"aria-errormessage":b.value?P.value:void 0})),M=computed(()=>({valid:r.valid,invalid:r.invalid,modelValue:r.modelValue})),{getOptionLabel:ve,getOptionValue:be,getOptionDisabled:Se}=useOptions(r),O=computed({get:()=>r.modelValue,set:l=>{Array.isArray(l)&&(l=l.filter(I=>I!==void 0)),i("update:modelValue",l)}});return(l,I)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(ye))},[l.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(V)},e.toDisplayString(l.label),9,re)):e.createCommentVNode("",!0),e.createElementVNode("div",se,[l.$slots.before?(e.openBlock(),e.createElementBlock("div",ie,[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(M))))])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.unref(j)?(e.openBlock(),e.createBlock(A,e.mergeProps({key:0,class:"vv-select__icon"},e.unref($)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(V),ref_key:"select",ref:p,"onUpdate:modelValue":I[0]||(I[0]=_=>e.isRef(O)?O.value=_:null)},e.unref(he)),[l.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!l.unselectable,hidden:!l.unselectable},e.toDisplayString(l.placeholder),9,ce)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,(_,Be)=>(e.openBlock(),e.createElementBlock("option",{key:Be,disabled:e.unref(Se)(_),value:e.unref(be)(_)},e.toDisplayString(e.unref(ve)(_)),9,de))),128))],16,ae),[[e.vModelSelect,e.unref(O)]]),e.unref(q)?(e.openBlock(),e.createBlock(A,e.mergeProps({key:1,class:"vv-select__icon vv-select__icon-after"},e.unref($)),null,16)):e.createCommentVNode("",!0)]),l.$slots.after?(e.openBlock(),e.createElementBlock("div",ue,[e.renderSlot(l.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(M))))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(g),{id:e.unref(P),class:"vv-select__hint"},null,8,["id"])],2))}})});
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@iconify/vue"),require("@vueuse/core"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvSelect=l(e.vue,e.vue$1,e.core,e.nanoid)}(this,(function(e,l,o,n){"use strict";const t={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{});const r=Symbol.for("volver");function d(l,o,n){return e.computed((()=>{const t={[l]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(t[`${l}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{t[`${l}--${o}`]=e.unref(n.value[o])})),t}))}const c=e.defineComponent({name:"VvIcon",props:t,setup(o){const n=o,t=e.ref(!0),a=e.inject(r),{modifiers:i}=e.toRefs(n),u=d("vv-icon",i),c=e.computed((()=>n.provider||(null==a?void 0:a.iconsProvider))),s=e.computed((()=>{const e=n.name??"",o=`@${c.value}:${n.prefix}:${n.name}`;return l.iconExists(e)?e:l.iconExists(o)?o:(null==a?void 0:a.iconsCollections.find((o=>{const n=`@${c.value}:${o.prefix}:${e}`;if(l.iconExists(n))return n})))||e}));function v(e){const o=function(e){let l=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");l=(new e).window}return(l?new l.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),t=(null==o?void 0:o.innerHTML.trim())||"";o&&t&&l.addIcon(`@${c.value}:${n.prefix}:${n.name}`,{body:t,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return a&&(n.src&&!l.iconExists(`@${c.value}:${n.prefix}:${n.name}`)?(t.value=!1,a.fetchIcon(n.src).then((e=>{e&&(v(e),t.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):n.svg&&v(n.svg)),(o,n)=>e.unref(t)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:o.rotate,color:o.color,onLoad:o.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("",!0)}});function s(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const o=l.split(".");let n=e;for(let l=0,t=o.length;l<t;++l){if(null==e)return null;n=n[o[l]]}return n}}return null}function v(l){return null==(o=e.unref(l))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}function f(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},y=(Boolean,Boolean,{label:[String,Number]}),h={readonly:Boolean},B={modifiers:[String,Array]},S={hintLabel:{type:String,default:""}},V={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},k={icon:{type:[String,Object]},iconPosition:{type:String,default:i.before,validation:e=>Object.values(i).includes(e)}},$={tabindex:{type:[String,Number],default:0}},w={floating:Boolean},L={unselectable:{type:Boolean,default:!0}},N={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const x={...N,name:{type:String,required:!0}},A={autofocus:Boolean},E={autocomplete:{type:String,default:"off"}};u.button;const I={...x,...A,...E,...$,...p,...m,...S,...b,...g,...h,...B,...V,...k,...w,...L,...y,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},placeholder:String};const O=["for"],_={class:"vv-select__wrapper"},j={key:0,class:"vv-select__input-before"},C={class:"vv-select__inner"},F=["id"],P=["disabled","hidden"],q=["disabled","value"],D={key:1,class:"vv-select__input-after"};return e.defineComponent({name:"VvSelect",props:I,emits:["update:modelValue","focus","blur"],setup(l,{emit:t}){const u=l,r=e.useSlots(),p=e.ref(),{HintSlot:m,hasHint:b,hasInvalid:g}=function(l,n){const{invalid:t,valid:a,hint:i,loading:u}=n,{hintLabel:r,modelValue:d,valid:c,validLabel:p,invalid:m,invalidLabel:b,...g}=e.toRefs(l),y=s(g,"loading"),h=s(g,"loadingLabel"),B=e.computed((()=>!(!m.value||(!m.value||!t)&&!((null==b?void 0:b.value)&&Array.isArray(b.value)&&b.value.length>0)&&(!(null==b?void 0:b.value)||v(b))))),S=e.computed((()=>!!(r&&r.value||i))),V=e.computed((()=>!!(p&&p.value||a))),k=e.computed((()=>!!((null==y?void 0:y.value)&&u||(null==y?void 0:y.value)&&(null==h?void 0:h.value)))),$=e.computed((()=>S.value||V.value||B.value||k.value));return{hasInvalid:B,hasHint:S,hasValid:V,hasLoading:k,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(l){const n=e.computed((()=>{const e=o.toReactive({hintLabel:r,modelValue:d,valid:c,validLabel:p,invalid:m,invalidLabel:b,loading:y,loadingLabel:h,...l.params});return(null==m?void 0:m.value)?(null==t?void 0:t(e))||f(null==b?void 0:b.value)||(null==r?void 0:r.value):(null==c?void 0:c.value)?(null==a?void 0:a(e))||f(null==p?void 0:p.value)||(null==r?void 0:r.value):(null==y?void 0:y.value)?(null==u?void 0:u(e))||f(null==h?void 0:h.value)||(null==r?void 0:r.value):(null==i?void 0:i(e))||f(null==r?void 0:r.value)||(null==r?void 0:r.value)}));return{isVisible:$,hasInvalid:B,hasValid:V,hintContent:n}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}(u,r),{id:y,modifiers:h,disabled:B,readonly:S,loading:V,icon:k,iconPosition:$,invalid:w,valid:L,floating:N,multiple:x}=e.toRefs(u),A=(l=>e.computed((()=>String((null==l?void 0:l.value)||n.nanoid()))))(y),E=e.computed((()=>`${A.value}-hint`)),{focused:I}=function(l,n){const{focused:t}=o.useFocus(l);return e.watch(t,(o=>{n(o?"focus":"blur",e.unref(l))})),{focused:t}}(p,t),z=o.useElementVisibility(p);e.watch(z,(e=>{e&&u.autofocus&&(I.value=!0)}));const{hasIcon:R,hasIconBefore:H,hasIconAfter:K}=function(l,o){const n=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===i.before))),t=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===i.after))),u=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===a.left))),r=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===a.right))),d=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===a.top))),c=e.computed((()=>Boolean((null==l?void 0:l.value)&&o.value===a.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==l?void 0:l.value)?{name:null==l?void 0:l.value}:null==l?void 0:l.value)),hasIconLeft:u,hasIconRight:r,hasIconTop:d,hasIconBottom:c,hasIconBefore:n,hasIconAfter:t}}(k,$),M=e.computed((()=>!v(u.modelValue))),T=e.computed((()=>u.disabled||u.readonly)),J=e.computed((()=>T.value?-1:u.tabindex)),U=e.computed((()=>!0===u.invalid||!0!==u.valid&&void 0)),G=d("vv-select",h,e.computed((()=>({valid:L.value,invalid:w.value,loading:V.value,disabled:B.value,readonly:S.value,"icon-before":H.value,"icon-after":K.value,dirty:M.value,focus:I.value,floating:N.value,multiple:x.value})))),Q=e.computed((()=>({name:u.name,tabindex:J.value,disabled:T.value,required:u.required,size:u.size,autocomplete:u.autocomplete,multiple:u.multiple,"aria-invalid":U.value,"aria-describedby":!g.value&&b.value?E.value:void 0,"aria-errormessage":g.value?E.value:void 0}))),W=e.computed((()=>({valid:u.valid,invalid:u.invalid,modelValue:u.modelValue}))),{getOptionLabel:X,getOptionValue:Y,getOptionDisabled:Z}=function(l){const{options:o,labelKey:n,valueKey:t,disabledKey:a}=e.toRefs(l);return{options:o,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):e[n.value],getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof t.value?t.value(e):e[t.value],getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof a.value?a.value(e):e[a.value])}}(u),ee=e.computed({get:()=>u.modelValue,set:e=>{Array.isArray(e)&&(e=e.filter((e=>void 0!==e))),t("update:modelValue",e)}});return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(G))},[l.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(A)},e.toDisplayString(l.label),9,O)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[l.$slots.before?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(W))))])):e.createCommentVNode("",!0),e.createElementVNode("div",C,[e.unref(H)?(e.openBlock(),e.createBlock(c,e.mergeProps({key:0,class:"vv-select__icon"},e.unref(R)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(A),ref_key:"select",ref:p,"onUpdate:modelValue":o[0]||(o[0]=l=>e.isRef(ee)?ee.value=l:null)},e.unref(Q)),[l.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!l.unselectable,hidden:!l.unselectable},e.toDisplayString(l.placeholder),9,P)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,((l,o)=>(e.openBlock(),e.createElementBlock("option",{key:o,disabled:e.unref(Z)(l),value:e.unref(Y)(l)},e.toDisplayString(e.unref(X)(l)),9,q)))),128))],16,F),[[e.vModelSelect,e.unref(ee)]]),e.unref(K)?(e.openBlock(),e.createBlock(c,e.mergeProps({key:1,class:"vv-select__icon vv-select__icon-after"},e.unref(R)),null,16)):e.createCommentVNode("",!0)]),l.$slots.after?(e.openBlock(),e.createElementBlock("div",D,[e.renderSlot(l.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(W))))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(m),{id:e.unref(E),class:"vv-select__hint"},null,8,["id"])],2))}})}));
|
|
@@ -6,8 +6,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
6
6
|
type: (StringConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor | NumberConstructor)[];
|
|
7
7
|
default: undefined;
|
|
8
8
|
};
|
|
9
|
-
label: StringConstructor;
|
|
10
9
|
placeholder: StringConstructor;
|
|
10
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
11
11
|
unselectable: {
|
|
12
12
|
type: BooleanConstructor;
|
|
13
13
|
default: boolean;
|
|
@@ -17,12 +17,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
17
17
|
type: (StringConstructor | ObjectConstructor)[];
|
|
18
18
|
};
|
|
19
19
|
iconPosition: {
|
|
20
|
-
type:
|
|
21
|
-
default: import("../../constants
|
|
22
|
-
validation: (value: import("../../constants
|
|
20
|
+
type: globalThis.PropType<"before" | "after">;
|
|
21
|
+
default: import("../../constants").Position;
|
|
22
|
+
validation: (value: import("../../constants").Position) => boolean;
|
|
23
23
|
};
|
|
24
24
|
options: {
|
|
25
|
-
type:
|
|
25
|
+
type: globalThis.PropType<(string | import("../../types/generic").Option)[]>;
|
|
26
26
|
default: () => never[];
|
|
27
27
|
};
|
|
28
28
|
labelKey: {
|
|
@@ -37,11 +37,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
37
37
|
type: (StringConstructor | FunctionConstructor)[];
|
|
38
38
|
default: string;
|
|
39
39
|
};
|
|
40
|
-
modifiers:
|
|
40
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
41
41
|
readonly: BooleanConstructor;
|
|
42
42
|
disabled: BooleanConstructor;
|
|
43
43
|
loading: BooleanConstructor;
|
|
44
|
-
loadingLabel:
|
|
44
|
+
loadingLabel: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
45
48
|
hintLabel: {
|
|
46
49
|
type: StringConstructor;
|
|
47
50
|
default: string;
|
|
@@ -72,8 +75,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
72
75
|
type: (StringConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor | NumberConstructor)[];
|
|
73
76
|
default: undefined;
|
|
74
77
|
};
|
|
75
|
-
label: StringConstructor;
|
|
76
78
|
placeholder: StringConstructor;
|
|
79
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
77
80
|
unselectable: {
|
|
78
81
|
type: BooleanConstructor;
|
|
79
82
|
default: boolean;
|
|
@@ -83,12 +86,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
83
86
|
type: (StringConstructor | ObjectConstructor)[];
|
|
84
87
|
};
|
|
85
88
|
iconPosition: {
|
|
86
|
-
type:
|
|
87
|
-
default: import("../../constants
|
|
88
|
-
validation: (value: import("../../constants
|
|
89
|
+
type: globalThis.PropType<"before" | "after">;
|
|
90
|
+
default: import("../../constants").Position;
|
|
91
|
+
validation: (value: import("../../constants").Position) => boolean;
|
|
89
92
|
};
|
|
90
93
|
options: {
|
|
91
|
-
type:
|
|
94
|
+
type: globalThis.PropType<(string | import("../../types/generic").Option)[]>;
|
|
92
95
|
default: () => never[];
|
|
93
96
|
};
|
|
94
97
|
labelKey: {
|
|
@@ -103,11 +106,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
103
106
|
type: (StringConstructor | FunctionConstructor)[];
|
|
104
107
|
default: string;
|
|
105
108
|
};
|
|
106
|
-
modifiers:
|
|
109
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
107
110
|
readonly: BooleanConstructor;
|
|
108
111
|
disabled: BooleanConstructor;
|
|
109
112
|
loading: BooleanConstructor;
|
|
110
|
-
loadingLabel:
|
|
113
|
+
loadingLabel: {
|
|
114
|
+
type: StringConstructor;
|
|
115
|
+
default: string;
|
|
116
|
+
};
|
|
111
117
|
hintLabel: {
|
|
112
118
|
type: StringConstructor;
|
|
113
119
|
default: string;
|
|
@@ -135,10 +141,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
135
141
|
}, {
|
|
136
142
|
modelValue: string | number | boolean | unknown[] | Record<string, any>;
|
|
137
143
|
disabled: boolean;
|
|
138
|
-
options: (string | import("../../types/generic
|
|
144
|
+
options: (string | import("../../types/generic").Option)[];
|
|
145
|
+
floating: boolean;
|
|
139
146
|
required: boolean;
|
|
140
|
-
iconPosition:
|
|
147
|
+
iconPosition: "before" | "after";
|
|
141
148
|
loading: boolean;
|
|
149
|
+
loadingLabel: string;
|
|
142
150
|
unselectable: boolean;
|
|
143
151
|
multiple: boolean;
|
|
144
152
|
readonly: boolean;
|
|
@@ -149,7 +157,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
149
157
|
labelKey: string | Function;
|
|
150
158
|
valueKey: string | Function;
|
|
151
159
|
disabledKey: string | Function;
|
|
152
|
-
floating: boolean;
|
|
153
160
|
autocomplete: string;
|
|
154
161
|
autofocus: boolean;
|
|
155
162
|
}>, {
|
|
@@ -25,14 +25,11 @@ export declare const VvSelectProps: {
|
|
|
25
25
|
type: (StringConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor | NumberConstructor)[];
|
|
26
26
|
default: undefined;
|
|
27
27
|
};
|
|
28
|
-
/**
|
|
29
|
-
* <label> value for the select
|
|
30
|
-
*/
|
|
31
|
-
label: StringConstructor;
|
|
32
28
|
/**
|
|
33
29
|
* Select placeholder
|
|
34
30
|
*/
|
|
35
31
|
placeholder: StringConstructor;
|
|
32
|
+
label: (StringConstructor | NumberConstructor)[];
|
|
36
33
|
unselectable: {
|
|
37
34
|
type: BooleanConstructor;
|
|
38
35
|
default: boolean;
|
|
@@ -42,12 +39,12 @@ export declare const VvSelectProps: {
|
|
|
42
39
|
type: (StringConstructor | ObjectConstructor)[];
|
|
43
40
|
};
|
|
44
41
|
iconPosition: {
|
|
45
|
-
type:
|
|
42
|
+
type: globalThis.PropType<"before" | "after">;
|
|
46
43
|
default: import("../../constants").Position;
|
|
47
44
|
validation: (value: import("../../constants").Position) => boolean;
|
|
48
45
|
};
|
|
49
46
|
options: {
|
|
50
|
-
type:
|
|
47
|
+
type: globalThis.PropType<(string | import("../../types/generic").Option)[]>;
|
|
51
48
|
default: () => never[];
|
|
52
49
|
};
|
|
53
50
|
labelKey: {
|
|
@@ -62,11 +59,14 @@ export declare const VvSelectProps: {
|
|
|
62
59
|
type: (StringConstructor | FunctionConstructor)[];
|
|
63
60
|
default: string;
|
|
64
61
|
};
|
|
65
|
-
modifiers:
|
|
62
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
66
63
|
readonly: BooleanConstructor;
|
|
67
64
|
disabled: BooleanConstructor;
|
|
68
65
|
loading: BooleanConstructor;
|
|
69
|
-
loadingLabel:
|
|
66
|
+
loadingLabel: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
default: string;
|
|
69
|
+
};
|
|
70
70
|
hintLabel: {
|
|
71
71
|
type: StringConstructor;
|
|
72
72
|
default: string;
|