@volverjs/ui-vue 0.0.4 → 0.0.5-beta.2
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/README.md +2 -2
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +19 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
- 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 +264 -164
- 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 +276 -98
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
- package/dist/components/VvAction/index.d.ts +2 -2
- package/dist/components/VvBadge/VvBadge.es.js +213 -44
- 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 +247 -75
- 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 +646 -360
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
- package/dist/components/VvButton/index.d.ts +13 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +261 -79
- 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 +57 -38
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +562 -274
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
- package/dist/components/VvCheckbox/index.d.ts +5 -5
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +661 -340
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
- package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
- package/dist/components/VvCombobox/VvCombobox.es.js +1546 -983
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +138 -51
- package/dist/components/VvCombobox/index.d.ts +41 -10
- package/dist/components/VvDialog/VvDialog.es.js +387 -141
- 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 +452 -244
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +130 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
- package/dist/components/VvDropdown/index.d.ts +40 -11
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +373 -160
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +285 -90
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +113 -65
- 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 +986 -462
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +100 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +66 -13
- package/dist/components/VvProgress/VvProgress.es.js +216 -45
- 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 +499 -238
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
- package/dist/components/VvRadio/index.d.ts +5 -5
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +598 -304
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
- package/dist/components/VvRadioGroup/index.d.ts +3 -3
- package/dist/components/VvSelect/VvSelect.es.js +631 -324
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
- package/dist/components/VvSelect/index.d.ts +3 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +676 -355
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +20 -20
- package/dist/components/VvTextarea/index.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +215 -47
- 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 +3522 -2231
- 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/directives/index.d.ts +1 -0
- package/dist/directives/index.es.js +264 -55
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.d.ts +3 -0
- package/dist/directives/v-contextmenu.es.js +42 -0
- package/dist/directives/v-contextmenu.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +222 -53
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.d.ts +3 -1
- package/dist/icons.es.js +40 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +112 -3607
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +50 -18
- package/dist/resolvers/unplugin.d.ts +7 -1
- package/dist/resolvers/unplugin.es.js +77 -37
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +13 -1
- package/package.json +126 -40
- package/src/Volver.ts +49 -22
- 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 +7 -7
- package/src/components/VvAction/index.ts +1 -1
- 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 +11 -11
- package/src/components/VvButton/index.ts +10 -9
- 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 +44 -26
- package/src/components/VvCombobox/index.ts +1 -1
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +7 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
- package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
- package/src/components/VvDropdown/index.ts +3 -3
- 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 +130 -37
- 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 +1 -1
- package/src/components/VvTextarea/VvTextarea.vue +6 -6
- 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 +2 -2
- 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 +4 -2
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/directives/index.ts +3 -1
- package/src/directives/v-contextmenu.ts +40 -0
- package/src/directives/v-tooltip.ts +2 -2
- package/src/icons.ts +1 -1
- package/src/index.ts +0 -2
- package/src/props/index.ts +20 -10
- package/src/resolvers/unplugin.ts +15 -1
- 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 +1 -1
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +40 -0
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
- package/src/stories/argTypes.ts +12 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","nanoid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvButton=t(e.vue,e.vue$1,e.nanoid)}(this,(function(e,t,o){"use strict";const n={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 r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{}),a=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(a||{});const s=Symbol.for("volver"),c=Symbol.for("buttonGroup"),d=Symbol.for("dropdownTrigger"),v=Symbol.for("dropdownAction");function f(){return e.inject(s)}function p(t,o,n){return e.computed((()=>{const r={[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&&(r[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{r[`${t}--${o}`]=e.unref(n.value[o])})),r}))}const m=e.defineComponent({name:"VvIcon",props:n,setup(o){const n=o,r=e.ref(!0),l=f(),{modifiers:i}=e.toRefs(n),u=p("vv-icon",i),a=e.computed((()=>n.provider||(null==l?void 0:l.iconsProvider))),s=e.computed((()=>{const e=n.name??"",o=`@${a.value}:${n.prefix}:${n.name}`;return t.iconExists(e)?e:t.iconExists(o)?o:(null==l?void 0:l.iconsCollections.find((o=>{const n=`@${a.value}:${o.prefix}:${e}`;if(t.iconExists(n))return n})))||e}));function c(e){const o=function(e){let t=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),r=(null==o?void 0:o.innerHTML.trim())||"";o&&r&&t.addIcon(`@${a.value}:${n.prefix}:${n.name}`,{body:r,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return l&&(n.src&&!t.iconExists(`@${a.value}:${n.prefix}:${n.name}`)?(r.value=!1,l.fetchIcon(n.src).then((e=>{e&&(c(e),r.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):n.svg&&c(n.svg)),(o,n)=>e.unref(r)?(e.openBlock(),e.createBlock(e.unref(t.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)}}),g={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(a).includes(e)},rel:{type:String,default:"noopener noreferrer"}},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},y={disabled:Boolean},h={active:Boolean},k={pressed:Boolean},S={label:[String,Number]},B={modifiers:[String,Array]};l.before;const x={unselectable:{type:Boolean,default:!0}},$={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const w={...y,...S,...k,...h,...g,type:{type:String,default:i.button,validator:e=>Object.values(i).includes(e)}},A=w;const j=e.defineComponent({name:"VvAction",props:A,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:n}){const r=t,l=f(),i=e.ref(null);o({$el:i});const{reference:a,bus:s,aria:c,expanded:p}=e.inject(d,{});e.watch((()=>i.value),(e=>{a&&(a.value=e)}));const m=e.computed((()=>r.pressed||(null==p?void 0:p.value))),{role:g}=e.inject(v,{}),b=e.computed((()=>{switch(!0){case r.disabled:return u.button;case void 0!==r.to:return(null==l?void 0:l.nuxt)?u.nuxtLink:u.routerLink;case void 0!==r.href:return u.a;default:return u.button}})),y=e.computed((()=>{const e={...null==c?void 0:c.value,"aria-pressed":!!m.value||void 0,role:g};switch(b.value){case u.a:return{...e,href:r.href,target:r.target,rel:r.rel};case u.routerLink:case u.nuxtLink:return{...e,to:r.to,target:r.target};default:return{...e,type:r.type,disabled:r.disabled}}})),h=e=>{r.disabled?e.preventDefault():(null==s||s.emit("click",e),n("click",e))},k=e=>{null==s||s.emit("mouseover",e),n("mouseover",e)},S=e=>{null==s||s.emit("mouseleave",e),n("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.mergeProps(e.unref(y),{ref_key:"element",ref:i,class:{active:t.active,pressed:e.unref(m),disabled:t.disabled},onClickPassive:h,onMouseoverPassive:k,onMouseleavePassive:S}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function _(e,t,o){return o?V(e,o)===V(t,o):O(e,t)}function O(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const o=Array.isArray(e),n=Array.isArray(t);let r,l,i;if(o&&n){if(l=e.length,l!=t.length)return!1;for(r=l;0!=r--;)if(!O(e[r],t[r]))return!1;return!0}if(o!=n)return!1;const u=e instanceof Date,a=t instanceof Date;if(u!=a)return!1;if(u&&a)return e.getTime()==t.getTime();const s=e instanceof RegExp,c=t instanceof RegExp;if(s!=c)return!1;if(s&&c)return e.toString()==t.toString();const d=Object.keys(e);if(l=d.length,l!==Object.keys(t).length)return!1;for(r=l;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,d[r]))return!1;for(r=l;0!=r--;)if(i=d[r],!O(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 o=t.split(".");let n=e;for(let t=0,r=o.length;t<r;++t){if(null==e)return null;n=n[o[t]]}return n}}return null}function L(e,t){if(null!=e&&t&&t.length)for(const o of t)if(_(e,o))return!0;return!1}function P(t){const o=e.inject(t,void 0),n=e.computed((()=>{return t=o,!(null==(n=e.unref(t))||""===n||Array.isArray(n)&&0===n.length||!(n instanceof Date)&&"object"==typeof n&&0===Object.keys(n).length);var t,n}));return{group:o,isInGroup:n,getGroupOrLocalRef:function(t,n,r){if(null==o?void 0:o.value){const n=e.unref(o.value)[t];return e.computed({get:()=>null==n?void 0:n.value,set(e){n.value=e}})}const l=e.toRef(n,t);return e.computed({get:()=>l.value,set(e){r&&r(`update:${t}`,e)}})}}}const C={...w,...$,...B,...x,...b,icon:[String,Object],iconPosition:{type:String,default:r.left,validator:e=>Object.values(r).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},modelValue:String};const D={key:1,class:"vv-button__label"},E={key:1,class:"vv-button__label"};return e.defineComponent({name:"VvButton",props:C,emits:["update:modelValue"],setup(t,{expose:n,emit:l}){const i=t,u=e.useAttrs(),a=e.useSlots(),{id:s,modifiers:d,iconPosition:v,icon:f,label:g,modelValue:b,disabled:y,toggle:h,unselectable:k}=function(t,o){const{group:n,isInGroup:r,getGroupOrLocalRef:l}=P(c),{id:i,iconPosition:u,icon:a,label:s,pressed:d,modifiers:v}=e.toRefs(t),f=l("modelValue",t,o),p=l("toggle",t),m=l("unselectable",t),g=e.computed((()=>(null==n?void 0:n.value.multiple.value)??!1)),b=e.computed((()=>{var e;return[...(null==v?void 0:v.value)?Array.isArray(v.value)?v.value:v.value.split(" "):[],...(null==(e=null==n?void 0:n.value.itemModifiers)?void 0:e.value)?Array.isArray(n.value.itemModifiers.value)?n.value.itemModifiers.value:n.value.itemModifiers.value.split(" "):[]]})),y=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==n?void 0:n.value)?void 0:e.disabled.value))}));return{group:n,isInGroup:r,modelValue:f,toggle:p,unselectable:m,multiple:g,modifiers:b,disabled:y,id:i,pressed:d,iconPosition:u,icon:a,label:s}}(i,l),S=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(s),B=e.computed((()=>(null==u?void 0:u.name)||S.value)),x=e.ref(null);n({$el:e.computed((()=>{var e;return null==(e=x.value)?void 0:e.$el}))});const $=e.computed((()=>h.value?Array.isArray(b.value)?L(B.value,b.value):_(B.value,b.value):i.pressed)),w=p("vv-button",d,e.computed((()=>({reverse:[r.right,r.bottom].includes(v.value),column:[r.top,r.bottom].includes(v.value),"icon-only":Boolean((null==f?void 0:f.value)&&!(null==g?void 0:g.value)&&!a.default)})))),A=e.computed((()=>"string"==typeof(null==f?void 0:f.value)?{name:null==f?void 0:f.value}:null==f?void 0:f.value)),O=()=>{if(h.value){if(Array.isArray(b.value))return L(B.value,b.value)?void(k.value&&(b.value=b.value.filter((e=>e!==B.value)))):void b.value.push(B.value);if(_(B.value,b.value)&&k.value)return void(b.value=void 0);b.value=B.value}};return(t,o)=>(e.openBlock(),e.createBlock(j,e.mergeProps({disabled:e.unref(y),pressed:e.unref($),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel},{id:e.unref(S),ref_key:"element",ref:x,class:e.unref(w),onClick:O}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(m,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",D,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(f)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-button__icon"},e.unref(A)),null,16)):e.createCommentVNode("",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("span",E,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(g)),1)]))])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}})}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Side } from '
|
|
1
|
+
import { Side } from '../../constants';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
3
|
icon: (StringConstructor | ObjectConstructor)[];
|
|
4
4
|
iconPosition: {
|
|
5
|
-
type:
|
|
5
|
+
type: globalThis.PropType<"left" | "right" | "top" | "bottom">;
|
|
6
6
|
default: Side;
|
|
7
7
|
validator: (value: Side) => boolean;
|
|
8
8
|
};
|
|
@@ -24,20 +24,20 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
24
24
|
type: BooleanConstructor;
|
|
25
25
|
default: boolean;
|
|
26
26
|
};
|
|
27
|
-
modifiers:
|
|
27
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
28
28
|
id: (StringConstructor | NumberConstructor)[];
|
|
29
29
|
type: {
|
|
30
|
-
type:
|
|
31
|
-
default: import("
|
|
32
|
-
validator: (value: import("
|
|
30
|
+
type: globalThis.PropType<"button" | "submit" | "reset">;
|
|
31
|
+
default: import("../../constants").ButtonType;
|
|
32
|
+
validator: (value: import("../../constants").ButtonType) => boolean;
|
|
33
33
|
};
|
|
34
34
|
to: {
|
|
35
35
|
type: (StringConstructor | ObjectConstructor)[];
|
|
36
36
|
};
|
|
37
37
|
href: StringConstructor;
|
|
38
38
|
target: {
|
|
39
|
-
type:
|
|
40
|
-
validator: (value: import("
|
|
39
|
+
type: globalThis.PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
40
|
+
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
41
41
|
};
|
|
42
42
|
rel: {
|
|
43
43
|
type: StringConstructor;
|
|
@@ -48,11 +48,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
48
48
|
label: (StringConstructor | NumberConstructor)[];
|
|
49
49
|
disabled: BooleanConstructor;
|
|
50
50
|
}, {
|
|
51
|
-
$el:
|
|
51
|
+
$el: globalThis.ComputedRef<HTMLElement | undefined>;
|
|
52
52
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
53
|
icon: (StringConstructor | ObjectConstructor)[];
|
|
54
54
|
iconPosition: {
|
|
55
|
-
type:
|
|
55
|
+
type: globalThis.PropType<"left" | "right" | "top" | "bottom">;
|
|
56
56
|
default: Side;
|
|
57
57
|
validator: (value: Side) => boolean;
|
|
58
58
|
};
|
|
@@ -74,20 +74,20 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
74
74
|
type: BooleanConstructor;
|
|
75
75
|
default: boolean;
|
|
76
76
|
};
|
|
77
|
-
modifiers:
|
|
77
|
+
modifiers: globalThis.PropType<string | string[]>;
|
|
78
78
|
id: (StringConstructor | NumberConstructor)[];
|
|
79
79
|
type: {
|
|
80
|
-
type:
|
|
81
|
-
default: import("
|
|
82
|
-
validator: (value: import("
|
|
80
|
+
type: globalThis.PropType<"button" | "submit" | "reset">;
|
|
81
|
+
default: import("../../constants").ButtonType;
|
|
82
|
+
validator: (value: import("../../constants").ButtonType) => boolean;
|
|
83
83
|
};
|
|
84
84
|
to: {
|
|
85
85
|
type: (StringConstructor | ObjectConstructor)[];
|
|
86
86
|
};
|
|
87
87
|
href: StringConstructor;
|
|
88
88
|
target: {
|
|
89
|
-
type:
|
|
90
|
-
validator: (value: import("
|
|
89
|
+
type: globalThis.PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
90
|
+
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
91
91
|
};
|
|
92
92
|
rel: {
|
|
93
93
|
type: StringConstructor;
|
|
@@ -101,11 +101,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
101
101
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
102
102
|
}, {
|
|
103
103
|
disabled: boolean;
|
|
104
|
-
type:
|
|
104
|
+
type: "button" | "submit" | "reset";
|
|
105
105
|
rel: string;
|
|
106
106
|
active: boolean;
|
|
107
107
|
pressed: boolean;
|
|
108
|
-
iconPosition:
|
|
108
|
+
iconPosition: "left" | "right" | "top" | "bottom";
|
|
109
109
|
loadingIcon: string;
|
|
110
110
|
toggle: boolean;
|
|
111
111
|
loading: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref, PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
import type { ButtonGroupState } from '
|
|
3
|
-
import { Side } from '
|
|
2
|
+
import type { ButtonGroupState } from '../../types/group';
|
|
3
|
+
import { Side } from '../../constants';
|
|
4
4
|
export declare const VvButtonEvents: string[];
|
|
5
5
|
export declare const VvButtonProps: {
|
|
6
6
|
/**
|
|
@@ -11,7 +11,7 @@ export declare const VvButtonProps: {
|
|
|
11
11
|
* Button icon position
|
|
12
12
|
*/
|
|
13
13
|
iconPosition: {
|
|
14
|
-
type: PropType<
|
|
14
|
+
type: PropType<"left" | "right" | "top" | "bottom">;
|
|
15
15
|
default: Side;
|
|
16
16
|
validator: (value: Side) => boolean;
|
|
17
17
|
};
|
|
@@ -39,17 +39,17 @@ export declare const VvButtonProps: {
|
|
|
39
39
|
modifiers: PropType<string | string[]>;
|
|
40
40
|
id: (StringConstructor | NumberConstructor)[];
|
|
41
41
|
type: {
|
|
42
|
-
type:
|
|
43
|
-
default: import("
|
|
44
|
-
validator: (value: import("
|
|
42
|
+
type: PropType<"button" | "submit" | "reset">;
|
|
43
|
+
default: import("../../constants").ButtonType;
|
|
44
|
+
validator: (value: import("../../constants").ButtonType) => boolean;
|
|
45
45
|
};
|
|
46
46
|
to: {
|
|
47
47
|
type: (StringConstructor | ObjectConstructor)[];
|
|
48
48
|
};
|
|
49
49
|
href: StringConstructor;
|
|
50
50
|
target: {
|
|
51
|
-
type: PropType<
|
|
52
|
-
validator: (value: import("
|
|
51
|
+
type: PropType<"_blank" | "_self" | "_parent" | "_top">;
|
|
52
|
+
validator: (value: import("../../constants").AnchorTarget) => boolean;
|
|
53
53
|
};
|
|
54
54
|
rel: {
|
|
55
55
|
type: StringConstructor;
|
|
@@ -66,16 +66,16 @@ export type VvButtonPropsTypes = ExtractPropTypes<typeof VvButtonProps>;
|
|
|
66
66
|
*/
|
|
67
67
|
export declare function useGroupProps(props: VvButtonPropsTypes, emit: (event: (typeof VvButtonEvents)[number], value: unknown) => void): {
|
|
68
68
|
group: Ref<ButtonGroupState> | undefined;
|
|
69
|
-
isInGroup:
|
|
69
|
+
isInGroup: globalThis.ComputedRef<boolean>;
|
|
70
70
|
modelValue: Ref<string | string[] | undefined>;
|
|
71
|
-
disabled: Ref<boolean>;
|
|
72
71
|
toggle: Ref<boolean>;
|
|
73
72
|
unselectable: Ref<boolean>;
|
|
74
|
-
multiple:
|
|
73
|
+
multiple: globalThis.ComputedRef<boolean>;
|
|
74
|
+
modifiers: globalThis.ComputedRef<string[]>;
|
|
75
|
+
disabled: globalThis.ComputedRef<boolean>;
|
|
75
76
|
id: Ref<string | number | undefined> | undefined;
|
|
76
|
-
modifiers: import("vue").ComputedRef<string[]>;
|
|
77
77
|
pressed: Ref<boolean>;
|
|
78
|
-
iconPosition: Ref<
|
|
78
|
+
iconPosition: Ref<"left" | "right" | "top" | "bottom">;
|
|
79
79
|
icon: Ref<string | Record<string, any> | undefined> | undefined;
|
|
80
80
|
label: Ref<string | number | undefined> | undefined;
|
|
81
81
|
};
|
|
@@ -1,6 +1,42 @@
|
|
|
1
|
-
import { isRef
|
|
2
|
-
var
|
|
3
|
-
|
|
1
|
+
import { isRef, provide, computed, unref, defineComponent, toRefs, watchEffect, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
|
|
2
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
3
|
+
Side2["left"] = "left";
|
|
4
|
+
Side2["right"] = "right";
|
|
5
|
+
Side2["top"] = "top";
|
|
6
|
+
Side2["bottom"] = "bottom";
|
|
7
|
+
return Side2;
|
|
8
|
+
})(Side || {});
|
|
9
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
10
|
+
Placement2["topStart"] = "top-start";
|
|
11
|
+
Placement2["topEnd"] = "top-end";
|
|
12
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
13
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
14
|
+
Placement2["leftStart"] = "left-start";
|
|
15
|
+
Placement2["leftEnd"] = "left-end";
|
|
16
|
+
Placement2["rightStart"] = "right-start";
|
|
17
|
+
Placement2["rightEnd"] = "right-end";
|
|
18
|
+
return Placement2;
|
|
19
|
+
})(Placement || {});
|
|
20
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
21
|
+
Position2["before"] = "before";
|
|
22
|
+
Position2["after"] = "after";
|
|
23
|
+
return Position2;
|
|
24
|
+
})(Position || {});
|
|
25
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
26
|
+
ButtonType2["button"] = "button";
|
|
27
|
+
ButtonType2["submit"] = "submit";
|
|
28
|
+
ButtonType2["reset"] = "reset";
|
|
29
|
+
return ButtonType2;
|
|
30
|
+
})(ButtonType || {});
|
|
31
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
32
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
33
|
+
AnchorTarget2["_self"] = "_self";
|
|
34
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
35
|
+
AnchorTarget2["_top"] = "_top";
|
|
36
|
+
return AnchorTarget2;
|
|
37
|
+
})(AnchorTarget || {});
|
|
38
|
+
const INJECTION_KEY_BUTTON_GROUP = Symbol.for("buttonGroup");
|
|
39
|
+
const LinkProps = {
|
|
4
40
|
/**
|
|
5
41
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
6
42
|
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
@@ -17,7 +53,7 @@ const G = Symbol.for("buttonGroup"), C = {
|
|
|
17
53
|
*/
|
|
18
54
|
target: {
|
|
19
55
|
type: String,
|
|
20
|
-
validator: (
|
|
56
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
21
57
|
},
|
|
22
58
|
/**
|
|
23
59
|
* Anchor rel
|
|
@@ -26,127 +62,273 @@ const G = Symbol.for("buttonGroup"), C = {
|
|
|
26
62
|
type: String,
|
|
27
63
|
default: "noopener noreferrer"
|
|
28
64
|
}
|
|
29
|
-
}
|
|
65
|
+
};
|
|
66
|
+
const DisabledProps = {
|
|
30
67
|
/**
|
|
31
68
|
* Whether the form control is disabled
|
|
32
69
|
*/
|
|
33
70
|
disabled: Boolean
|
|
34
|
-
}
|
|
71
|
+
};
|
|
72
|
+
const ActiveProps = {
|
|
35
73
|
/**
|
|
36
74
|
* Whether the item is active
|
|
37
75
|
*/
|
|
38
76
|
active: Boolean
|
|
39
|
-
}
|
|
77
|
+
};
|
|
78
|
+
const PressedProps = {
|
|
40
79
|
/**
|
|
41
80
|
* Whether the item is pressed
|
|
42
81
|
*/
|
|
43
82
|
pressed: Boolean
|
|
44
|
-
}
|
|
83
|
+
};
|
|
84
|
+
const LabelProps = {
|
|
45
85
|
/**
|
|
46
86
|
* The item label
|
|
47
87
|
*/
|
|
48
88
|
label: [String, Number]
|
|
49
|
-
}
|
|
89
|
+
};
|
|
90
|
+
const ModifiersProps = {
|
|
50
91
|
/**
|
|
51
92
|
* Component BEM modifiers
|
|
52
93
|
*/
|
|
53
94
|
modifiers: [String, Array]
|
|
54
95
|
};
|
|
55
|
-
|
|
56
|
-
|
|
96
|
+
({
|
|
97
|
+
/**
|
|
98
|
+
* VvIcon name or props
|
|
99
|
+
* @see VVIcon
|
|
100
|
+
*/
|
|
101
|
+
icon: { type: [String, Object] },
|
|
102
|
+
/**
|
|
103
|
+
* VvIcon position
|
|
104
|
+
*/
|
|
105
|
+
iconPosition: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: Position.before,
|
|
108
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const UnselectableProps = {
|
|
57
112
|
/**
|
|
58
113
|
* If true the input will be unselectable
|
|
59
114
|
*/
|
|
60
|
-
unselectable: { type: Boolean, default:
|
|
115
|
+
unselectable: { type: Boolean, default: true }
|
|
61
116
|
};
|
|
62
|
-
u.bottom;
|
|
63
117
|
({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Dropdown placement
|
|
120
|
+
*/
|
|
121
|
+
placement: {
|
|
122
|
+
type: String,
|
|
123
|
+
default: Side.bottom,
|
|
124
|
+
validator: (value) => {
|
|
125
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* Dropdown strategy
|
|
130
|
+
*/
|
|
131
|
+
strategy: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: "absolute",
|
|
134
|
+
validator: (value) => {
|
|
135
|
+
return ["fixed", "absolute"].includes(value);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Dropdown show / hide transition name
|
|
140
|
+
*/
|
|
141
|
+
transitionName: {
|
|
142
|
+
type: String
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Offset of the dropdown from the trigger
|
|
146
|
+
* @see https://floating-ui.com/docs/offset
|
|
147
|
+
*/
|
|
148
|
+
offset: {
|
|
149
|
+
type: [Number, String, Object],
|
|
150
|
+
default: 0
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* Move dropdown to the side if there is no space in the default position
|
|
154
|
+
* @see https://floating-ui.com/docs/shift
|
|
155
|
+
*/
|
|
156
|
+
shift: {
|
|
157
|
+
type: [Boolean, Object],
|
|
158
|
+
default: false
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* Flip dropdown position if there is no space in the default position
|
|
162
|
+
* @see https://floating-ui.com/docs/flip
|
|
163
|
+
*/
|
|
164
|
+
flip: {
|
|
165
|
+
type: [Boolean, Object],
|
|
166
|
+
default: true
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Size of the dropdown
|
|
170
|
+
* @see https://floating-ui.com/docs/size
|
|
171
|
+
*/
|
|
172
|
+
size: {
|
|
173
|
+
type: [Boolean, Object],
|
|
174
|
+
default: () => ({ padding: 10 })
|
|
175
|
+
},
|
|
176
|
+
/**
|
|
177
|
+
* Automatically change the position of the dropdown
|
|
178
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
179
|
+
*/
|
|
180
|
+
autoPlacement: {
|
|
181
|
+
type: [Boolean, Object],
|
|
182
|
+
default: false
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* Add arrow to the dropdown
|
|
186
|
+
* @see https://floating-ui.com/docs/arrow
|
|
187
|
+
*/
|
|
188
|
+
arrow: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
default: false
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Close dropdown on click outside
|
|
194
|
+
*/
|
|
195
|
+
autoClose: {
|
|
196
|
+
type: Boolean,
|
|
197
|
+
default: true
|
|
198
|
+
},
|
|
199
|
+
/**
|
|
200
|
+
* Autofocus first item on dropdown open
|
|
201
|
+
*/
|
|
202
|
+
autofocusFirst: {
|
|
203
|
+
type: Boolean,
|
|
204
|
+
default: true
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* Set dropdown width to the same as the trigger
|
|
208
|
+
*/
|
|
209
|
+
triggerWidth: {
|
|
210
|
+
type: Boolean
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
({
|
|
214
|
+
...DisabledProps,
|
|
215
|
+
...LabelProps,
|
|
216
|
+
...PressedProps,
|
|
217
|
+
...ActiveProps,
|
|
218
|
+
...LinkProps,
|
|
69
219
|
/**
|
|
70
220
|
* Button type
|
|
71
221
|
*/
|
|
72
|
-
type:
|
|
222
|
+
type: {
|
|
223
|
+
type: String,
|
|
224
|
+
default: ButtonType.button,
|
|
225
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
226
|
+
}
|
|
73
227
|
});
|
|
74
|
-
const
|
|
75
|
-
...
|
|
76
|
-
...
|
|
77
|
-
...
|
|
228
|
+
const VvButtonGroupProps = {
|
|
229
|
+
...ModifiersProps,
|
|
230
|
+
...DisabledProps,
|
|
231
|
+
...UnselectableProps,
|
|
78
232
|
/**
|
|
79
233
|
* String or String[] of css classes (modifiers) that will be provided to each button'
|
|
80
234
|
*/
|
|
81
235
|
itemModifiers: { type: [String, Array], default: void 0 },
|
|
82
|
-
toggle: { type: Boolean, default:
|
|
83
|
-
multiple: { type: Boolean, default:
|
|
236
|
+
toggle: { type: Boolean, default: false },
|
|
237
|
+
multiple: { type: Boolean, default: false },
|
|
84
238
|
modelValue: { type: [String, Array], default: void 0 }
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
239
|
+
};
|
|
240
|
+
const VvButtonGroupEvents = ["update:modelValue"];
|
|
241
|
+
function useProvideGroupState(groupState) {
|
|
242
|
+
if (Object.keys(groupState).some(
|
|
243
|
+
(k) => k !== "key" && !isRef(groupState[k])
|
|
89
244
|
))
|
|
90
245
|
throw Error("One or more groupState props aren't ref.");
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
246
|
+
provide(
|
|
247
|
+
groupState.key,
|
|
248
|
+
computed(() => groupState)
|
|
94
249
|
);
|
|
95
250
|
}
|
|
96
|
-
function
|
|
97
|
-
return
|
|
98
|
-
const
|
|
99
|
-
[
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
251
|
+
function useModifiers(prefix, modifiers, others) {
|
|
252
|
+
return computed(() => {
|
|
253
|
+
const toReturn = {
|
|
254
|
+
[prefix]: true
|
|
255
|
+
};
|
|
256
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
257
|
+
if (modifiersArray) {
|
|
258
|
+
if (Array.isArray(modifiersArray)) {
|
|
259
|
+
modifiersArray.forEach((modifier) => {
|
|
260
|
+
if (modifier) {
|
|
261
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (others) {
|
|
267
|
+
Object.keys(others.value).forEach((key) => {
|
|
268
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return toReturn;
|
|
106
272
|
});
|
|
107
273
|
}
|
|
108
|
-
const
|
|
274
|
+
const __default__ = {
|
|
109
275
|
name: "VvButtonGroup"
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
)
|
|
276
|
+
};
|
|
277
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
278
|
+
...__default__,
|
|
279
|
+
props: VvButtonGroupProps,
|
|
280
|
+
emits: VvButtonGroupEvents,
|
|
281
|
+
setup(__props, { emit }) {
|
|
282
|
+
const props = __props;
|
|
283
|
+
const {
|
|
284
|
+
disabled,
|
|
285
|
+
toggle,
|
|
286
|
+
modifiers,
|
|
287
|
+
multiple,
|
|
288
|
+
unselectable,
|
|
289
|
+
itemModifiers
|
|
290
|
+
} = toRefs(props);
|
|
291
|
+
watchEffect(() => {
|
|
292
|
+
if (typeof props.modelValue === "string" && multiple.value) {
|
|
293
|
+
console.warn(
|
|
294
|
+
`[VvButtonGroup]: modelValue is a string but multiple is true.`
|
|
295
|
+
);
|
|
296
|
+
}
|
|
127
297
|
});
|
|
128
|
-
const
|
|
129
|
-
get: () =>
|
|
130
|
-
|
|
298
|
+
const modelValue = computed({
|
|
299
|
+
get: () => {
|
|
300
|
+
if (!multiple.value) {
|
|
301
|
+
return Array.isArray(props.modelValue) ? props.modelValue[0] : props.modelValue;
|
|
302
|
+
}
|
|
303
|
+
return props.modelValue;
|
|
304
|
+
},
|
|
305
|
+
set: (newValue) => {
|
|
306
|
+
if (newValue !== void 0 && (Array.isArray(props.modelValue) || multiple.value) && !Array.isArray(newValue)) {
|
|
307
|
+
newValue = [newValue];
|
|
308
|
+
}
|
|
309
|
+
return emit("update:modelValue", newValue);
|
|
310
|
+
}
|
|
131
311
|
});
|
|
132
|
-
|
|
133
|
-
key:
|
|
134
|
-
modelValue
|
|
135
|
-
disabled
|
|
136
|
-
toggle
|
|
137
|
-
multiple
|
|
138
|
-
unselectable
|
|
139
|
-
itemModifiers
|
|
312
|
+
useProvideGroupState({
|
|
313
|
+
key: INJECTION_KEY_BUTTON_GROUP,
|
|
314
|
+
modelValue,
|
|
315
|
+
disabled,
|
|
316
|
+
toggle,
|
|
317
|
+
multiple,
|
|
318
|
+
unselectable,
|
|
319
|
+
itemModifiers
|
|
140
320
|
});
|
|
141
|
-
const
|
|
142
|
-
return (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
321
|
+
const bemCssClasses = useModifiers("vv-button-group", modifiers);
|
|
322
|
+
return (_ctx, _cache) => {
|
|
323
|
+
return openBlock(), createElementBlock("div", {
|
|
324
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
325
|
+
role: "group"
|
|
326
|
+
}, [
|
|
327
|
+
renderSlot(_ctx.$slots, "default")
|
|
328
|
+
], 2);
|
|
329
|
+
};
|
|
148
330
|
}
|
|
149
331
|
});
|
|
150
332
|
export {
|
|
151
|
-
|
|
333
|
+
_sfc_main as default
|
|
152
334
|
};
|