@volverjs/ui-vue 0.0.3 → 0.0.4

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 (145) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +52 -13
  3. package/dist/Volver.d.ts +5 -1
  4. package/dist/components/VvAccordion/VvAccordion.es.js +113 -66
  5. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +159 -101
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  8. package/dist/components/VvAction/VvAction.es.js +170 -0
  9. package/dist/components/VvAction/VvAction.umd.js +1 -0
  10. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  11. package/dist/components/VvAction/index.d.ts +24 -0
  12. package/dist/components/VvBadge/VvBadge.es.js +86 -16
  13. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  14. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +97 -41
  15. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.es.js +434 -251
  17. package/dist/components/VvButton/VvButton.umd.js +1 -1
  18. package/dist/components/VvButton/VvButton.vue.d.ts +50 -50
  19. package/dist/components/VvButton/index.d.ts +22 -67
  20. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +118 -43
  21. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  22. package/dist/components/VvCard/VvCard.es.js +38 -25
  23. package/dist/components/VvCard/VvCard.umd.js +1 -1
  24. package/dist/components/VvCheckbox/VvCheckbox.es.js +334 -154
  25. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  26. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  27. package/dist/components/VvCheckbox/index.d.ts +1 -1
  28. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +401 -204
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
  31. package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
  32. package/dist/components/VvCombobox/VvCombobox.es.js +950 -594
  33. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  34. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +54 -30
  35. package/dist/components/VvCombobox/index.d.ts +18 -13
  36. package/dist/components/VvDialog/VvDialog.es.js +139 -64
  37. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  38. package/dist/components/VvDropdown/VvDropdown.es.js +276 -158
  39. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  40. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +9 -9
  41. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  42. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  43. package/dist/components/VvDropdown/index.d.ts +6 -9
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +251 -0
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  46. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +30 -15
  47. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  48. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +176 -0
  49. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  50. package/dist/components/VvIcon/VvIcon.es.js +48 -32
  51. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  52. package/dist/components/VvInputText/VvInputText.es.js +508 -344
  53. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  54. package/dist/components/VvInputText/VvInputText.vue.d.ts +11 -4
  55. package/dist/components/VvInputText/index.d.ts +13 -2
  56. package/dist/components/VvProgress/VvProgress.es.js +90 -20
  57. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.es.js +305 -125
  59. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  60. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  61. package/dist/components/VvRadio/index.d.ts +1 -1
  62. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +372 -175
  63. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  64. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
  65. package/dist/components/VvRadioGroup/index.d.ts +1 -1
  66. package/dist/components/VvSelect/VvSelect.es.js +371 -216
  67. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  68. package/dist/components/VvSelect/VvSelect.vue.d.ts +11 -4
  69. package/dist/components/VvSelect/index.d.ts +5 -5
  70. package/dist/components/VvTextarea/VvTextarea.es.js +408 -244
  71. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  72. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +11 -4
  73. package/dist/components/VvTextarea/index.d.ts +5 -5
  74. package/dist/components/VvTooltip/VvTooltip.es.js +88 -18
  75. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  76. package/dist/components/index.es.js +1913 -1521
  77. package/dist/components/index.umd.js +1 -1
  78. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  79. package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -2
  80. package/dist/constants.d.ts +30 -0
  81. package/dist/directives/index.es.js +128 -0
  82. package/dist/directives/index.umd.js +1 -0
  83. package/dist/directives/v-tooltip.es.js +126 -0
  84. package/dist/directives/v-tooltip.umd.js +1 -0
  85. package/dist/icons.es.js +3 -3
  86. package/dist/icons.umd.js +1 -1
  87. package/dist/index.es.js +2102 -1761
  88. package/dist/index.umd.js +1 -1
  89. package/dist/props/index.d.ts +179 -11
  90. package/dist/resolvers/unplugin.d.ts +8 -8
  91. package/dist/resolvers/unplugin.es.js +51 -30
  92. package/dist/resolvers/unplugin.umd.js +1 -1
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  94. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  95. package/package.json +60 -34
  96. package/src/Volver.ts +12 -5
  97. package/src/assets/icons/detailed.json +1 -1
  98. package/src/assets/icons/normal.json +1 -1
  99. package/src/assets/icons/simple.json +1 -1
  100. package/src/components/VvAction/VvAction.vue +144 -0
  101. package/src/components/VvAction/index.ts +5 -0
  102. package/src/components/VvButton/VvButton.vue +31 -114
  103. package/src/components/VvButton/index.ts +6 -79
  104. package/src/components/VvCombobox/VvCombobox.vue +54 -42
  105. package/src/components/VvCombobox/index.ts +11 -9
  106. package/src/components/VvDropdown/VvDropdownAction.vue +44 -0
  107. package/src/components/VvDropdown/VvDropdownOption.vue +65 -0
  108. package/src/components/VvDropdown/index.ts +4 -9
  109. package/src/components/VvSelect/index.ts +2 -4
  110. package/src/composables/dropdown/useInjectDropdown.ts +1 -1
  111. package/src/composables/dropdown/useProvideDropdown.ts +7 -9
  112. package/src/composables/useModifiers.ts +4 -7
  113. package/src/constants.ts +36 -0
  114. package/src/props/index.ts +106 -14
  115. package/src/resolvers/unplugin.ts +81 -48
  116. package/src/stories/Accordion/AccordionSlots.stories.mdx +2 -2
  117. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +2 -1
  118. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  119. package/src/stories/Button/Button.stories.mdx +4 -2
  120. package/src/stories/Button/Button.test.ts +3 -1
  121. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  122. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  123. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  124. package/src/stories/Card/Card.stories.mdx +2 -1
  125. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  126. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  127. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  128. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  129. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  130. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  131. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  132. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  133. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  134. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  135. package/src/stories/Icon/Icon.stories.mdx +2 -1
  136. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  137. package/src/stories/InputText/InputText.stories.mdx +2 -1
  138. package/src/stories/Progress/Progress.stories.mdx +2 -1
  139. package/src/stories/Radio/Radio.stories.mdx +2 -1
  140. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  141. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  142. package/src/stories/Select/Select.stories.mdx +2 -1
  143. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  144. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  145. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
@@ -1 +1 @@
1
- (function(t,d){typeof exports=="object"&&typeof module<"u"?module.exports=d(require("vue"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue"],d):(t=typeof globalThis<"u"?globalThis:t||self,t.VvButton=d(t.vue,t.vue$1))})(this,function(t,d){"use strict";const D={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]}},A={name:"VvIcon"},C=t.defineComponent({...A,props:D,setup(e){const s=e,i=ref(!0),l=useVolver(),{modifiers:f}=toRefs(s),k=useBemModifiers("vv-icon",f),b=computed(()=>s.provider||(l==null?void 0:l.provider)),B=computed(()=>{const o=s.name??"",n=`@${b.value}:${s.prefix}:${s.name}`;return d.iconExists(o)?o:d.iconExists(n)?n:(l==null?void 0:l.iconsCollections.find(c=>{const v=`@${b.value}:${c.prefix}:${o}`;if(d.iconExists(v))return v}))||o});function y(o){let n=null;if(typeof window>"u"){const{JSDOM:h}=require("jsdom");n=new h().window}return(n?new n.DOMParser:new window.DOMParser).parseFromString(o,"text/html").querySelector("svg")}function a(o){const n=y(o),c=(n==null?void 0:n.innerHTML.trim())||"";n&&c&&d.addIcon(`@${b.value}:${s.prefix}:${s.name}`,{body:c,height:n.viewBox.baseVal.height,width:n.viewBox.baseVal.width})}return l&&(s.src&&!d.iconExists(`@${b.value}:${s.prefix}:${s.name}`)?(i.value=!1,l.fetchIcon(s.src).then(o=>{o&&(a(o),i.value=!0)}).catch(o=>{throw new Error(`During fetch icon: ${o==null?void 0:o.message}`)})):s.svg&&a(s.svg)),(o,n)=>t.unref(i)?(t.openBlock(),t.createBlock(t.unref(d.Icon),t.mergeProps({key:0,class:t.unref(k)},{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:t.unref(B)}),null,16,["class"])):t.createCommentVNode("",!0)}});var p=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(p||{}),I=(e=>(e.topStart="top-start",e.topEnd="top-end",e.bottomStart="bottom-start",e.bottomEnd="bottom-end",e.leftStart="left-start",e.leftEnd="left-end",e.rightStart="right-start",e.rightEnd="right-end",e))(I||{}),w=(e=>(e.before="before",e.after="after",e))(w||{});const E=Symbol.for("buttonGroup"),F={disabled:Boolean},q={modifiers:[String,Array]};w.before;const G={unselectable:{type:Boolean,default:!0}},R={id:[String,Number]};p.bottom;var P=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(P||{}),m=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(m||{}),$=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))($||{});const x=["update:modelValue"],z={...R,...q,...F,...G,icon:[String,Object],iconPosition:{type:String,default:p.left,validator:e=>Object.values(p).includes(e)},label:[String,Number],loading:Boolean,loadingIcon:{type:String,default:"eos-icons:bubble-loading"},loadingLabel:{type:String,default:"Loading..."},to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values($).includes(e)},active:Boolean,pressed:Boolean,rel:{type:String,default:"noopener noreferrer"},type:{type:String,default:"button",validator:e=>Object.values(P).includes(e)},toggle:{type:Boolean,default:!1},modelValue:String};function U(e,s){var S;const{group:i,isInGroup:l,getGroupOrLocalRef:f}=useInjectedGroupState(E),{id:k,iconPosition:b,icon:B,label:y,pressed:a,modifiers:o}=toRefs(e),n=f("modelValue",e,s),c=f("disabled",e),v=f("toggle",e),_=f("unselectable",e),h=((S=i==null?void 0:i.value)==null?void 0:S.multiple)??ref(!1),g=computed(()=>{var u;const V=o!=null&&o.value?Array.isArray(o.value)?o.value:[o.value]:[],O=(u=i==null?void 0:i.value.itemModifiers)!=null&&u.value?Array.isArray(i.value.itemModifiers.value)?i.value.itemModifiers.value:[i.value.itemModifiers.value]:[];return[...V,...O]});return{group:i,isInGroup:l,modelValue:n,disabled:c,toggle:v,unselectable:_,multiple:h,id:k,modifiers:g,pressed:a,iconPosition:b,icon:B,label:y}}const J={key:1,class:"vv-button__label"},T={key:1,class:"vv-button__label"},H={name:"VvButton"};return t.defineComponent({...H,props:z,emits:x,setup(e,{expose:s,emit:i}){const l=e,f=useAttrs(),k=useSlots(),{id:b,modifiers:B,iconPosition:y,icon:a,label:o,modelValue:n,disabled:c,toggle:v,unselectable:_}=U(l,i),h=useUniqueId(b),g=computed(()=>(f==null?void 0:f.name)||h.value),S=useVolver(),V=ref(null);s({$el:V});const{reference:O,bus:u,aria:j}=useInjectedDropdownTrigger();watch(()=>V.value,r=>{O&&(O.value=r)});const{role:K}=useInjectedDropdownAction(),N=computed(()=>{switch(!0){case c.value:return m.button;case l.to!==void 0:return S!=null&&S.nuxt?m.nuxtLink:m.routerLink;case l.href!==void 0:return m.a;default:return m.button}}),L=computed(()=>v.value?Array.isArray(n.value)?contains(g.value,n.value):equals(g.value,n.value):l.pressed),W=useBemModifiers("vv-button",B,computed(()=>({active:l.active,pressed:L.value,disabled:c.value,reverse:[p.right,p.bottom].includes(y.value),column:[p.top,p.bottom].includes(y.value),iconOnly:Boolean((a==null?void 0:a.value)&&!(o!=null&&o.value)&&!k.default)}))),Y=computed(()=>typeof(a==null?void 0:a.value)=="string"?{name:a==null?void 0:a.value}:a==null?void 0:a.value),Q=computed(()=>{const r={...j==null?void 0:j.value,"aria-pressed":L.value?!0:void 0,class:W.value,role:K};switch(N.value){case m.a:return{...r,role:r.role??"button",href:l.href,target:l.target,rel:l.rel};case m.routerLink:case m.nuxtLink:return{...r,role:r.role??"button",to:l.to,target:l.target};default:return{...r,type:l.type,disabled:c.value}}}),X=r=>{if(u==null||u.emit("click",r),v.value){if(Array.isArray(n.value)){if(contains(g.value,n.value)){_.value&&(n.value=n.value.filter(M=>M!==g.value));return}n.value.push(g.value);return}if(equals(g,n.value)&&_.value){n.value=void 0;return}n.value=g.value}},Z=r=>{u==null||u.emit("mouseover",r)},ee=r=>{u==null||u.emit("mouseleave",r)};return(r,M)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(N)),t.mergeProps(t.unref(Q),{id:t.unref(h),ref_key:"$el",ref:V,onClickPassive:X,onMouseoverPassive:Z,onMouseleavePassive:ee}),{default:t.withCtx(()=>[t.renderSlot(r.$slots,"default",{},()=>[r.loading?t.renderSlot(r.$slots,"loading",{key:0},()=>[r.loadingIcon?(t.openBlock(),t.createBlock(C,{key:0,class:"vv-button__loading-icon",name:r.loadingIcon},null,8,["name"])):t.createCommentVNode("",!0),r.loadingLabel?(t.openBlock(),t.createElementBlock("span",J,t.toDisplayString(r.loadingLabel),1)):t.createCommentVNode("",!0)]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.renderSlot(r.$slots,"before"),t.unref(a)?(t.openBlock(),t.createBlock(C,t.mergeProps({key:0,class:"vv-button__icon"},t.unref(Y)),null,16)):t.createCommentVNode("",!0),t.unref(o)?(t.openBlock(),t.createElementBlock("span",T,[t.renderSlot(r.$slots,"label",{},()=>[t.createTextVNode(t.toDisplayString(t.unref(o)),1)])])):t.createCommentVNode("",!0),t.renderSlot(r.$slots,"after")],64))])]),_:3},16,["id"]))}})});
1
+ (function(e,b){typeof exports=="object"&&typeof module<"u"?module.exports=b(require("vue"),require("@iconify/vue"),require("nanoid")):typeof define=="function"&&define.amd?define(["vue","@iconify/vue","nanoid"],b):(e=typeof globalThis<"u"?globalThis:e||self,e.VvButton=b(e.vue,e.vue$1,e.nanoid))})(this,function(e,b,M){"use strict";const F={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 S=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(S||{}),C=(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))(C||{}),j=(t=>(t.before="before",t.after="after",t))(j||{}),I=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(I||{}),k=(t=>(t.nuxtLink="nuxt-link",t.routerLink="router-link",t.a="a",t.button="button",t))(k||{}),E=(t=>(t._blank="_blank",t._self="_self",t._parent="_parent",t._top="_top",t))(E||{});const T=Symbol.for("volver"),G=Symbol.for("buttonGroup"),q=Symbol.for("dropdownTrigger"),J=Symbol.for("dropdownAction");function N(){return e.inject(T)}function w(t,n,s){return e.computed(()=>{const o={[t]:!0},l=typeof(n==null?void 0:n.value)=="string"?n.value.split(" "):n==null?void 0:n.value;return l&&Array.isArray(l)&&l.forEach(c=>{o[`${t}--${c}`]=!0}),s&&Object.keys(s.value).forEach(c=>{o[`${t}--${c}`]=e.unref(s.value[c])}),o})}const z={name:"VvIcon"},A=e.defineComponent({...z,props:F,setup(t){const n=t,s=e.ref(!0),o=N(),{modifiers:l}=e.toRefs(n),c=w("vv-icon",l),m=e.computed(()=>n.provider||(o==null?void 0:o.provider)),d=e.computed(()=>{const r=n.name??"",i=`@${m.value}:${n.prefix}:${n.name}`;return b.iconExists(r)?r:b.iconExists(i)?i:(o==null?void 0:o.iconsCollections.find(g=>{const h=`@${m.value}:${g.prefix}:${r}`;if(b.iconExists(h))return h}))||r});function p(r){let i=null;if(typeof window>"u"){const{JSDOM:v}=require("jsdom");i=new v().window}return(i?new i.DOMParser:new window.DOMParser).parseFromString(r,"text/html").querySelector("svg")}function a(r){const i=p(r),g=(i==null?void 0:i.innerHTML.trim())||"";i&&g&&b.addIcon(`@${m.value}:${n.prefix}:${n.name}`,{body:g,height:i.viewBox.baseVal.height,width:i.viewBox.baseVal.width})}return o&&(n.src&&!b.iconExists(`@${m.value}:${n.prefix}:${n.name}`)?(s.value=!1,o.fetchIcon(n.src).then(r=>{r&&(a(r),s.value=!0)}).catch(r=>{throw new Error(`During fetch icon: ${r==null?void 0:r.message}`)})):n.svg&&a(n.svg)),(r,i)=>e.unref(s)?(e.openBlock(),e.createBlock(e.unref(b.Icon),e.mergeProps({key:0,class:e.unref(c)},{inline:r.inline,width:r.width,height:r.height,horizontalFlip:r.horizontalFlip,verticalFlip:r.verticalFlip,flip:r.flip,rotate:r.rotate,color:r.color,onLoad:r.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),K={to:{type:[String,Object]},href:String,target:{type:String,validator:t=>Object.values(E).includes(t)},rel:{type:String,default:"noopener noreferrer"}},U={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},Y={disabled:Boolean},W={active:Boolean},H={pressed:Boolean},x={label:[String,Number]},Q={modifiers:[String,Array]};j.before;const X={unselectable:{type:Boolean,default:!0}},Z={id:[String,Number]};S.bottom;const D={...Y,...x,...H,...W,...K,type:{type:String,default:I.button,validator:t=>Object.values(I).includes(t)}},ee=["click","mouseover","mouseleave"],te=D;function ne(){return e.inject(q,{})}function re(){return e.inject(J,{})}const oe={name:"VvAction"},se=e.defineComponent({...oe,props:te,emits:ee,setup(t,{expose:n,emit:s}){const o=t,l=N(),c=e.ref(null);n({$el:c});const{reference:m,bus:d,aria:p,expanded:a}=ne();e.watch(()=>c.value,u=>{m&&(m.value=u)});const r=e.computed(()=>o.pressed||(a==null?void 0:a.value)),{role:i}=re(),g=e.computed(()=>{switch(!0){case o.disabled:return k.button;case o.to!==void 0:return l!=null&&l.nuxt?k.nuxtLink:k.routerLink;case o.href!==void 0:return k.a;default:return k.button}}),h=e.computed(()=>{const u={...p==null?void 0:p.value,"aria-pressed":r.value?!0:void 0,role:i};switch(g.value){case k.a:return{...u,href:o.href,target:o.target,rel:o.rel};case k.routerLink:case k.nuxtLink:return{...u,to:o.to,target:o.target};default:return{...u,type:o.type,disabled:o.disabled}}}),O=u=>{if(o.disabled){u.preventDefault();return}d==null||d.emit("click",u),s("click",u)},v=u=>{d==null||d.emit("mouseover",u),s("mouseover",u)},y=u=>{d==null||d.emit("mouseleave",u),s("mouseleave",u)};return(u,B)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(g)),e.mergeProps(e.unref(h),{ref_key:"element",ref:c,class:{active:u.active,pressed:e.unref(r),disabled:u.disabled},onClickPassive:O,onMouseoverPassive:v,onMouseleavePassive:y}),{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(u.label),1)])]),_:3},16,["class"]))}});function P(t,n,s){return s?L(t,s)===L(n,s):V(t,n)}function V(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){const s=Array.isArray(t),o=Array.isArray(n);let l,c,m;if(s&&o){if(c=t.length,c!=n.length)return!1;for(l=c;l--!==0;)if(!V(t[l],n[l]))return!1;return!0}if(s!=o)return!1;const d=t instanceof Date,p=n instanceof Date;if(d!=p)return!1;if(d&&p)return t.getTime()==n.getTime();const a=t instanceof RegExp,r=n instanceof RegExp;if(a!=r)return!1;if(a&&r)return t.toString()==n.toString();const i=Object.keys(t);if(c=i.length,c!==Object.keys(n).length)return!1;for(l=c;l--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[l]))return!1;for(l=c;l--!==0;)if(m=i[l],!V(t[m],n[m]))return!1;return!0}return t!==t&&n!==n}function L(t,n){if(t&&Object.keys(t).length&&n){if(n.indexOf(".")===-1)return t[n];{const s=n.split(".");let o=t;for(let l=0,c=s.length;l<c;++l){if(t==null)return null;o=o[s[l]]}return o}}else return null}function R(t,n){if(t!=null&&n&&n.length){for(const s of n)if(P(t,s))return!0}return!1}function le(t){return(n=>n==null||n===""||Array.isArray(n)&&n.length===0||!(n instanceof Date)&&typeof n=="object"&&Object.keys(n).length===0)(e.unref(t))}function ie(t){const n=e.inject(t,void 0),s=e.computed(()=>!le(n));function o(l,c,m){if(n!=null&&n.value){const p=e.unref(n.value)[l];return e.computed({get(){return p==null?void 0:p.value},set(a){p.value=a}})}const d=e.toRef(c,l);return e.computed({get(){return d.value},set(p){m&&m(`update:${l}`,p)}})}return{group:n,isInGroup:s,getGroupOrLocalRef:o}}const ae=["update:modelValue"],ce={...D,...Z,...Q,...X,...U,icon:[String,Object],iconPosition:{type:String,default:S.left,validator:t=>Object.values(S).includes(t)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},modelValue:String};function ue(t,n){var u;const{group:s,isInGroup:o,getGroupOrLocalRef:l}=ie(G),{id:c,iconPosition:m,icon:d,label:p,pressed:a,modifiers:r}=e.toRefs(t),i=l("modelValue",t,n),g=l("disabled",t),h=l("toggle",t),O=l("unselectable",t),v=((u=s==null?void 0:s.value)==null?void 0:u.multiple)??e.ref(!1),y=e.computed(()=>{var _;const B=r!=null&&r.value?Array.isArray(r.value)?r.value:r.value.split(" "):[],$=(_=s==null?void 0:s.value.itemModifiers)!=null&&_.value?Array.isArray(s.value.itemModifiers.value)?s.value.itemModifiers.value:s.value.itemModifiers.value.split(" "):[];return[...B,...$]});return{group:s,isInGroup:o,modelValue:i,disabled:g,toggle:h,unselectable:O,multiple:v,id:c,modifiers:y,pressed:a,iconPosition:m,icon:d,label:p}}const fe=t=>e.computed(()=>String((t==null?void 0:t.value)||M.nanoid())),de={key:1,class:"vv-button__label"},pe={key:1,class:"vv-button__label"},me={name:"VvButton"};return e.defineComponent({...me,props:ce,emits:ae,setup(t,{expose:n,emit:s}){const o=t,l=e.useAttrs(),c=e.useSlots(),{id:m,modifiers:d,iconPosition:p,icon:a,label:r,modelValue:i,disabled:g,toggle:h,unselectable:O}=ue(o,s),v=fe(m),y=e.computed(()=>(l==null?void 0:l.name)||v.value),u=e.ref(null),B=e.computed(()=>{var f;return(f=u.value)==null?void 0:f.$el});n({$el:B});const $=e.computed(()=>h.value?Array.isArray(i.value)?R(y.value,i.value):P(y.value,i.value):o.pressed),_=w("vv-button",d,e.computed(()=>({reverse:[S.right,S.bottom].includes(p.value),column:[S.top,S.bottom].includes(p.value),"icon-only":Boolean((a==null?void 0:a.value)&&!(r!=null&&r.value)&&!c.default)}))),ge=e.computed(()=>typeof(a==null?void 0:a.value)=="string"?{name:a==null?void 0:a.value}:a==null?void 0:a.value),ye=()=>{if(h.value){if(Array.isArray(i.value)){if(R(y.value,i.value)){O.value&&(i.value=i.value.filter(f=>f!==y.value));return}i.value.push(y.value);return}if(P(y.value,i.value)&&O.value){i.value=void 0;return}i.value=y.value}};return(f,he)=>(e.openBlock(),e.createBlock(se,e.mergeProps({disabled:e.unref(g),pressed:e.unref($),active:f.active,type:f.type,to:f.to,href:f.href,target:f.target,rel:f.rel},{id:e.unref(v),ref_key:"element",ref:u,class:e.unref(_),onClick:ye}),{default:e.withCtx(()=>[e.renderSlot(f.$slots,"default",{},()=>[f.loading?e.renderSlot(f.$slots,"loading",{key:0},()=>[f.loadingIcon?(e.openBlock(),e.createBlock(A,{key:0,class:"vv-button__loading-icon",name:f.loadingIcon},null,8,["name"])):e.createCommentVNode("",!0),f.loadingLabel?(e.openBlock(),e.createElementBlock("span",de,e.toDisplayString(f.loadingLabel),1)):e.createCommentVNode("",!0)]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(f.$slots,"before"),e.unref(a)?(e.openBlock(),e.createBlock(A,e.mergeProps({key:0,class:"vv-button__icon"},e.unref(ge)),null,16)):e.createCommentVNode("",!0),e.unref(r)?(e.openBlock(),e.createElementBlock("span",pe,[e.renderSlot(f.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(r)),1)])])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"after")],64))])]),_:3},16,["id","class"]))}})});
@@ -6,49 +6,49 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
6
6
  default: Side;
7
7
  validator: (value: Side) => boolean;
8
8
  };
9
- label: (StringConstructor | NumberConstructor)[];
10
- loading: BooleanConstructor;
11
9
  loadingIcon: {
12
10
  type: StringConstructor;
13
11
  default: string;
14
12
  };
13
+ toggle: {
14
+ type: BooleanConstructor;
15
+ default: boolean;
16
+ };
17
+ modelValue: StringConstructor;
18
+ loading: BooleanConstructor;
15
19
  loadingLabel: {
16
20
  type: StringConstructor;
17
21
  default: string;
18
22
  };
23
+ unselectable: {
24
+ type: BooleanConstructor;
25
+ default: boolean;
26
+ };
27
+ modifiers: import("vue").PropType<string | string[]>;
28
+ id: (StringConstructor | NumberConstructor)[];
29
+ type: {
30
+ type: StringConstructor;
31
+ default: import("@/constants").ButtonType;
32
+ validator: (value: import("@/constants").ButtonType) => boolean;
33
+ };
19
34
  to: {
20
35
  type: (StringConstructor | ObjectConstructor)[];
21
36
  };
22
37
  href: StringConstructor;
23
38
  target: {
24
- type: import("vue").PropType<import("@/components/VvButton").ButtonTarget>;
25
- validator: (value: import("@/components/VvButton").ButtonTarget) => boolean;
39
+ type: import("vue").PropType<import("@/constants").AnchorTarget>;
40
+ validator: (value: import("@/constants").AnchorTarget) => boolean;
26
41
  };
27
- active: BooleanConstructor;
28
- pressed: BooleanConstructor;
29
42
  rel: {
30
43
  type: StringConstructor;
31
44
  default: string;
32
45
  };
33
- type: {
34
- type: StringConstructor;
35
- default: import("@/components/VvButton").ButtonType;
36
- validator: (value: import("@/components/VvButton").ButtonType) => boolean;
37
- };
38
- toggle: {
39
- type: BooleanConstructor;
40
- default: boolean;
41
- };
42
- modelValue: StringConstructor;
43
- unselectable: {
44
- type: BooleanConstructor;
45
- default: boolean;
46
- };
46
+ active: BooleanConstructor;
47
+ pressed: BooleanConstructor;
48
+ label: (StringConstructor | NumberConstructor)[];
47
49
  disabled: BooleanConstructor;
48
- modifiers: import("vue").PropType<string | string[]>;
49
- id: (StringConstructor | NumberConstructor)[];
50
50
  }, {
51
- $el: import("vue").Ref<HTMLElement | null>;
51
+ $el: import("vue").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: {
@@ -56,60 +56,60 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
56
56
  default: Side;
57
57
  validator: (value: Side) => boolean;
58
58
  };
59
- label: (StringConstructor | NumberConstructor)[];
60
- loading: BooleanConstructor;
61
59
  loadingIcon: {
62
60
  type: StringConstructor;
63
61
  default: string;
64
62
  };
63
+ toggle: {
64
+ type: BooleanConstructor;
65
+ default: boolean;
66
+ };
67
+ modelValue: StringConstructor;
68
+ loading: BooleanConstructor;
65
69
  loadingLabel: {
66
70
  type: StringConstructor;
67
71
  default: string;
68
72
  };
73
+ unselectable: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ modifiers: import("vue").PropType<string | string[]>;
78
+ id: (StringConstructor | NumberConstructor)[];
79
+ type: {
80
+ type: StringConstructor;
81
+ default: import("@/constants").ButtonType;
82
+ validator: (value: import("@/constants").ButtonType) => boolean;
83
+ };
69
84
  to: {
70
85
  type: (StringConstructor | ObjectConstructor)[];
71
86
  };
72
87
  href: StringConstructor;
73
88
  target: {
74
- type: import("vue").PropType<import("@/components/VvButton").ButtonTarget>;
75
- validator: (value: import("@/components/VvButton").ButtonTarget) => boolean;
89
+ type: import("vue").PropType<import("@/constants").AnchorTarget>;
90
+ validator: (value: import("@/constants").AnchorTarget) => boolean;
76
91
  };
77
- active: BooleanConstructor;
78
- pressed: BooleanConstructor;
79
92
  rel: {
80
93
  type: StringConstructor;
81
94
  default: string;
82
95
  };
83
- type: {
84
- type: StringConstructor;
85
- default: import("@/components/VvButton").ButtonType;
86
- validator: (value: import("@/components/VvButton").ButtonType) => boolean;
87
- };
88
- toggle: {
89
- type: BooleanConstructor;
90
- default: boolean;
91
- };
92
- modelValue: StringConstructor;
93
- unselectable: {
94
- type: BooleanConstructor;
95
- default: boolean;
96
- };
96
+ active: BooleanConstructor;
97
+ pressed: BooleanConstructor;
98
+ label: (StringConstructor | NumberConstructor)[];
97
99
  disabled: BooleanConstructor;
98
- modifiers: import("vue").PropType<string | string[]>;
99
- id: (StringConstructor | NumberConstructor)[];
100
100
  }>> & {
101
101
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
102
102
  }, {
103
103
  disabled: boolean;
104
104
  type: string;
105
- iconPosition: Side;
106
- loading: boolean;
107
- loadingIcon: string;
108
- loadingLabel: string;
105
+ rel: string;
109
106
  active: boolean;
110
107
  pressed: boolean;
111
- rel: string;
108
+ iconPosition: Side;
109
+ loadingIcon: string;
112
110
  toggle: boolean;
111
+ loading: boolean;
112
+ loadingLabel: string;
113
113
  unselectable: boolean;
114
114
  }>, {
115
115
  default: (_: {}) => any;
@@ -1,23 +1,6 @@
1
1
  import type { Ref, PropType, ExtractPropTypes } from 'vue';
2
2
  import type { ButtonGroupState } from '@/types/group';
3
3
  import { Side } from '@/constants';
4
- export declare enum ButtonType {
5
- button = "button",
6
- submit = "submit",
7
- reset = "reset"
8
- }
9
- export declare enum ButtonTag {
10
- nuxtLink = "nuxt-link",
11
- routerLink = "router-link",
12
- a = "a",
13
- button = "button"
14
- }
15
- export declare enum ButtonTarget {
16
- _blank = "_blank",
17
- _self = "_self",
18
- _parent = "_parent",
19
- _top = "_top"
20
- }
21
4
  export declare const VvButtonEvents: string[];
22
5
  export declare const VvButtonProps: {
23
6
  /**
@@ -32,14 +15,6 @@ export declare const VvButtonProps: {
32
15
  default: Side;
33
16
  validator: (value: Side) => boolean;
34
17
  };
35
- /**
36
- * Button label
37
- */
38
- label: (StringConstructor | NumberConstructor)[];
39
- /**
40
- * Loading status
41
- */
42
- loading: BooleanConstructor;
43
18
  /**
44
19
  * Loading icon
45
20
  */
@@ -47,63 +22,43 @@ export declare const VvButtonProps: {
47
22
  type: StringConstructor;
48
23
  default: string;
49
24
  };
50
- /**
51
- * Loading label
52
- */
25
+ toggle: {
26
+ type: BooleanConstructor;
27
+ default: boolean;
28
+ };
29
+ modelValue: StringConstructor;
30
+ loading: BooleanConstructor;
53
31
  loadingLabel: {
54
32
  type: StringConstructor;
55
33
  default: string;
56
34
  };
57
- /**
58
- * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
59
- * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
60
- */
35
+ unselectable: {
36
+ type: BooleanConstructor;
37
+ default: boolean;
38
+ };
39
+ modifiers: PropType<string | string[]>;
40
+ id: (StringConstructor | NumberConstructor)[];
41
+ type: {
42
+ type: StringConstructor;
43
+ default: import("@/constants").ButtonType;
44
+ validator: (value: import("@/constants").ButtonType) => boolean;
45
+ };
61
46
  to: {
62
47
  type: (StringConstructor | ObjectConstructor)[];
63
48
  };
64
- /**
65
- * Link href
66
- */
67
49
  href: StringConstructor;
68
- /**
69
- * Link target
70
- */
71
50
  target: {
72
- type: PropType<ButtonTarget>;
73
- validator: (value: ButtonTarget) => boolean;
51
+ type: PropType<import("@/constants").AnchorTarget>;
52
+ validator: (value: import("@/constants").AnchorTarget) => boolean;
74
53
  };
75
- active: BooleanConstructor;
76
- /**
77
- * Button pressed mode
78
- */
79
- pressed: BooleanConstructor;
80
- /**
81
- * Link rel
82
- */
83
54
  rel: {
84
55
  type: StringConstructor;
85
56
  default: string;
86
57
  };
87
- /**
88
- * Button type
89
- */
90
- type: {
91
- type: StringConstructor;
92
- default: ButtonType;
93
- validator: (value: ButtonType) => boolean;
94
- };
95
- toggle: {
96
- type: BooleanConstructor;
97
- default: boolean;
98
- };
99
- modelValue: StringConstructor;
100
- unselectable: {
101
- type: BooleanConstructor;
102
- default: boolean;
103
- };
58
+ active: BooleanConstructor;
59
+ pressed: BooleanConstructor;
60
+ label: (StringConstructor | NumberConstructor)[];
104
61
  disabled: BooleanConstructor;
105
- modifiers: PropType<string | string[]>;
106
- id: (StringConstructor | NumberConstructor)[];
107
62
  };
108
63
  export type VvButtonPropsTypes = ExtractPropTypes<typeof VvButtonProps>;
109
64
  /**
@@ -1,28 +1,80 @@
1
- import { defineComponent as b, openBlock as y, createElementBlock as g, normalizeClass as v, unref as B, renderSlot as O } from "vue";
2
- var a = /* @__PURE__ */ ((t) => (t.left = "left", t.right = "right", t.top = "top", t.bottom = "bottom", t))(a || {}), s = /* @__PURE__ */ ((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))(s || {}), l = /* @__PURE__ */ ((t) => (t.before = "before", t.after = "after", t))(l || {});
3
- const S = Symbol.for("buttonGroup"), V = {
1
+ import { isRef as O, provide as _, computed as d, unref as f, defineComponent as S, toRefs as j, watchEffect as E, openBlock as V, createElementBlock as A, normalizeClass as h, renderSlot as k } from "vue";
2
+ var u = /* @__PURE__ */ ((t) => (t.left = "left", t.right = "right", t.top = "top", t.bottom = "bottom", t))(u || {}), c = /* @__PURE__ */ ((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))(c || {}), i = /* @__PURE__ */ ((t) => (t.before = "before", t.after = "after", t))(i || {}), p = /* @__PURE__ */ ((t) => (t.button = "button", t.submit = "submit", t.reset = "reset", t))(p || {}), b = /* @__PURE__ */ ((t) => (t._blank = "_blank", t._self = "_self", t._parent = "_parent", t._top = "_top", t))(b || {});
3
+ const G = Symbol.for("buttonGroup"), C = {
4
+ /**
5
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
6
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
7
+ */
8
+ to: {
9
+ type: [String, Object]
10
+ },
11
+ /**
12
+ * Anchor href
13
+ */
14
+ href: String,
15
+ /**
16
+ * Anchor target
17
+ */
18
+ target: {
19
+ type: String,
20
+ validator: (t) => Object.values(b).includes(t)
21
+ },
22
+ /**
23
+ * Anchor rel
24
+ */
25
+ rel: {
26
+ type: String,
27
+ default: "noopener noreferrer"
28
+ }
29
+ }, y = {
4
30
  /**
5
31
  * Whether the form control is disabled
6
32
  */
7
33
  disabled: Boolean
8
- }, h = {
34
+ }, N = {
35
+ /**
36
+ * Whether the item is active
37
+ */
38
+ active: Boolean
39
+ }, P = {
40
+ /**
41
+ * Whether the item is pressed
42
+ */
43
+ pressed: Boolean
44
+ }, $ = {
45
+ /**
46
+ * The item label
47
+ */
48
+ label: [String, Number]
49
+ }, M = {
9
50
  /**
10
51
  * Component BEM modifiers
11
52
  */
12
53
  modifiers: [String, Array]
13
54
  };
14
- l.before;
15
- const _ = {
55
+ i.before;
56
+ const R = {
16
57
  /**
17
58
  * If true the input will be unselectable
18
59
  */
19
60
  unselectable: { type: Boolean, default: !0 }
20
61
  };
21
- a.bottom;
22
- const j = {
23
- ...h,
24
- ...V,
25
- ..._,
62
+ u.bottom;
63
+ ({
64
+ ...y,
65
+ ...$,
66
+ ...P,
67
+ ...N,
68
+ ...C,
69
+ /**
70
+ * Button type
71
+ */
72
+ type: p.button
73
+ });
74
+ const U = {
75
+ ...M,
76
+ ...y,
77
+ ...R,
26
78
  /**
27
79
  * String or String[] of css classes (modifiers) that will be provided to each button'
28
80
  */
@@ -30,48 +82,71 @@ const j = {
30
82
  toggle: { type: Boolean, default: !1 },
31
83
  multiple: { type: Boolean, default: !1 },
32
84
  modelValue: { type: [String, Array], default: void 0 }
33
- }, A = ["update:modelValue"], E = {
85
+ }, z = ["update:modelValue"];
86
+ function I(t) {
87
+ if (Object.keys(t).some(
88
+ (e) => e !== "key" && !O(t[e])
89
+ ))
90
+ throw Error("One or more groupState props aren't ref.");
91
+ _(
92
+ t.key,
93
+ d(() => t)
94
+ );
95
+ }
96
+ function L(t, e, o) {
97
+ return d(() => {
98
+ const l = {
99
+ [t]: !0
100
+ }, n = typeof (e == null ? void 0 : e.value) == "string" ? e.value.split(" ") : e == null ? void 0 : e.value;
101
+ return n && Array.isArray(n) && n.forEach((a) => {
102
+ l[`${t}--${a}`] = !0;
103
+ }), o && Object.keys(o.value).forEach((a) => {
104
+ l[`${t}--${a}`] = f(o.value[a]);
105
+ }), l;
106
+ });
107
+ }
108
+ const D = {
34
109
  name: "VvButtonGroup"
35
- }, N = /* @__PURE__ */ b({
36
- ...E,
37
- props: j,
38
- emits: A,
39
- setup(t, { emit: u }) {
40
- const e = t, {
41
- disabled: n,
42
- toggle: i,
43
- modifiers: d,
44
- multiple: r,
45
- unselectable: f,
46
- itemModifiers: p
47
- } = toRefs(e);
48
- watchEffect(() => {
49
- typeof e.modelValue == "string" && r.value && console.warn(
110
+ }, K = /* @__PURE__ */ S({
111
+ ...D,
112
+ props: U,
113
+ emits: z,
114
+ setup(t, { emit: e }) {
115
+ const o = t, {
116
+ disabled: l,
117
+ toggle: n,
118
+ modifiers: a,
119
+ multiple: s,
120
+ unselectable: v,
121
+ itemModifiers: m
122
+ } = j(o);
123
+ E(() => {
124
+ typeof o.modelValue == "string" && s.value && console.warn(
50
125
  "[VvButtonGroup]: modelValue is a string but multiple is true."
51
126
  );
52
127
  });
53
- const c = computed({
54
- get: () => r.value ? e.modelValue : Array.isArray(e.modelValue) ? e.modelValue[0] : e.modelValue,
55
- set: (o) => (o !== void 0 && (Array.isArray(e.modelValue) || r.value) && !Array.isArray(o) && (o = [o]), u("update:modelValue", o))
128
+ const g = d({
129
+ get: () => s.value ? o.modelValue : Array.isArray(o.modelValue) ? o.modelValue[0] : o.modelValue,
130
+ set: (r) => (r !== void 0 && (Array.isArray(o.modelValue) || s.value) && !Array.isArray(r) && (r = [r]), e("update:modelValue", r))
56
131
  });
57
- useProvideGroupState({
58
- key: S,
59
- modelValue: c,
60
- disabled: n,
61
- toggle: i,
62
- multiple: r,
63
- unselectable: f,
64
- itemModifiers: p
132
+ I({
133
+ key: G,
134
+ modelValue: g,
135
+ disabled: l,
136
+ toggle: n,
137
+ multiple: s,
138
+ unselectable: v,
139
+ itemModifiers: m
65
140
  });
66
- const m = useBemModifiers("vv-button-group", d);
67
- return (o, G) => (y(), g("div", {
68
- class: v(B(m)),
141
+ const B = L("vv-button-group", a);
142
+ return (r, F) => (V(), A("div", {
143
+ class: h(f(B)),
69
144
  role: "group"
70
145
  }, [
71
- O(o.$slots, "default")
146
+ k(r.$slots, "default")
72
147
  ], 2));
73
148
  }
74
149
  });
75
150
  export {
76
- N as default
151
+ K as default
77
152
  };
@@ -1 +1 @@
1
- (function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o(require("vue")):typeof define=="function"&&define.amd?define(["vue"],o):(e=typeof globalThis<"u"?globalThis:e||self,e.VvButtonGroup=o(e.vue))})(this,function(e){"use strict";var o=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(o||{}),s=(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))(s||{}),n=(t=>(t.before="before",t.after="after",t))(n||{});const u=Symbol.for("buttonGroup"),i={disabled:Boolean},d={modifiers:[String,Array]};n.before;const f={unselectable:{type:Boolean,default:!0}};o.bottom;const p={...d,...i,...f,itemModifiers:{type:[String,Array],default:void 0},toggle:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},modelValue:{type:[String,Array],default:void 0}},c=["update:modelValue"],m={name:"VvButtonGroup"};return e.defineComponent({...m,props:p,emits:c,setup(t,{emit:y}){const r=t,{disabled:b,toggle:g,modifiers:v,multiple:a,unselectable:B,itemModifiers:h}=toRefs(r);watchEffect(()=>{typeof r.modelValue=="string"&&a.value&&console.warn("[VvButtonGroup]: modelValue is a string but multiple is true.")});const O=computed({get:()=>a.value?r.modelValue:Array.isArray(r.modelValue)?r.modelValue[0]:r.modelValue,set:l=>(l!==void 0&&(Array.isArray(r.modelValue)||a.value)&&!Array.isArray(l)&&(l=[l]),y("update:modelValue",l))});useProvideGroupState({key:u,modelValue:O,disabled:b,toggle:g,multiple:a,unselectable:B,itemModifiers:h});const S=useBemModifiers("vv-button-group",v);return(l,_)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(S)),role:"group"},[e.renderSlot(l.$slots,"default")],2))}})});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("vue")):typeof define=="function"&&define.amd?define(["vue"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.VvButtonGroup=n(e.vue))})(this,function(e){"use strict";var n=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(n||{}),f=(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))(f||{}),p=(t=>(t.before="before",t.after="after",t))(p||{}),d=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(d||{}),c=(t=>(t._blank="_blank",t._self="_self",t._parent="_parent",t._top="_top",t))(c||{});const y=Symbol.for("buttonGroup"),m={to:{type:[String,Object]},href:String,target:{type:String,validator:t=>Object.values(c).includes(t)},rel:{type:String,default:"noopener noreferrer"}},b={disabled:Boolean},g={active:Boolean},v={pressed:Boolean},B={label:[String,Number]},_={modifiers:[String,Array]};p.before;const O={unselectable:{type:Boolean,default:!0}};n.bottom,{...b,...B,...v,...g,...m,type:d.button};const S={..._,...b,...O,itemModifiers:{type:[String,Array],default:void 0},toggle:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},modelValue:{type:[String,Array],default:void 0}},j=["update:modelValue"];function h(t){if(Object.keys(t).some(o=>o!=="key"&&!e.isRef(t[o])))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed(()=>t))}function E(t,o,r){return e.computed(()=>{const s={[t]:!0},u=typeof(o==null?void 0:o.value)=="string"?o.value.split(" "):o==null?void 0:o.value;return u&&Array.isArray(u)&&u.forEach(l=>{s[`${t}--${l}`]=!0}),r&&Object.keys(r.value).forEach(l=>{s[`${t}--${l}`]=e.unref(r.value[l])}),s})}const V={name:"VvButtonGroup"};return e.defineComponent({...V,props:S,emits:j,setup(t,{emit:o}){const r=t,{disabled:s,toggle:u,modifiers:l,multiple:i,unselectable:A,itemModifiers:k}=e.toRefs(r);e.watchEffect(()=>{typeof r.modelValue=="string"&&i.value&&console.warn("[VvButtonGroup]: modelValue is a string but multiple is true.")});const G=e.computed({get:()=>i.value?r.modelValue:Array.isArray(r.modelValue)?r.modelValue[0]:r.modelValue,set:a=>(a!==void 0&&(Array.isArray(r.modelValue)||i.value)&&!Array.isArray(a)&&(a=[a]),o("update:modelValue",a))});h({key:y,modelValue:G,disabled:s,toggle:u,multiple:i,unselectable:A,itemModifiers:k});const C=E("vv-button-group",l);return(a,P)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(C)),role:"group"},[e.renderSlot(a.$slots,"default")],2))}})});
@@ -1,41 +1,54 @@
1
- import { defineComponent as i, openBlock as s, createElementBlock as t, normalizeClass as c, unref as f, renderSlot as o, createTextVNode as m, toDisplayString as p, createCommentVNode as r } from "vue";
2
- const u = {
1
+ import { computed as v, unref as d, defineComponent as p, toRefs as f, openBlock as n, createElementBlock as l, normalizeClass as _, renderSlot as c, createTextVNode as $, toDisplayString as i, createCommentVNode as u } from "vue";
2
+ const y = {
3
3
  title: String,
4
4
  modifiers: [String, Array]
5
- }, v = {
5
+ };
6
+ function h(o, t, s) {
7
+ return v(() => {
8
+ const r = {
9
+ [o]: !0
10
+ }, e = typeof (t == null ? void 0 : t.value) == "string" ? t.value.split(" ") : t == null ? void 0 : t.value;
11
+ return e && Array.isArray(e) && e.forEach((a) => {
12
+ r[`${o}--${a}`] = !0;
13
+ }), s && Object.keys(s.value).forEach((a) => {
14
+ r[`${o}--${a}`] = d(s.value[a]);
15
+ }), r;
16
+ });
17
+ }
18
+ const C = {
6
19
  key: 0,
7
20
  class: "vv-card__header"
8
- }, _ = {
21
+ }, k = {
9
22
  key: 1,
10
23
  class: "vv-card__content"
11
- }, h = {
24
+ }, m = {
12
25
  key: 2,
13
26
  class: "vv-card__footer"
14
- }, C = {
27
+ }, g = {
15
28
  name: "VvCard"
16
- }, y = /* @__PURE__ */ i({
17
- ...C,
18
- props: u,
19
- setup(n) {
20
- const a = n, { modifiers: l } = toRefs(a), d = useBemModifiers("vv-card", l);
21
- return (e, $) => (s(), t("article", {
22
- class: c(f(d))
29
+ }, S = /* @__PURE__ */ p({
30
+ ...g,
31
+ props: y,
32
+ setup(o) {
33
+ const t = o, { modifiers: s } = f(t), r = h("vv-card", s);
34
+ return (e, a) => (n(), l("article", {
35
+ class: _(d(r))
23
36
  }, [
24
- e.$slots.header || e.title ? (s(), t("header", v, [
25
- o(e.$slots, "header", {}, () => [
26
- m(p(e.title), 1)
37
+ e.$slots.header || e.title ? (n(), l("header", C, [
38
+ c(e.$slots, "header", {}, () => [
39
+ $(i(e.title), 1)
27
40
  ])
28
- ])) : r("", !0),
29
- o(e.$slots, "default"),
30
- e.$slots.content ? (s(), t("div", _, [
31
- o(e.$slots, "content")
32
- ])) : r("", !0),
33
- e.$slots.footer ? (s(), t("footer", h, [
34
- o(e.$slots, "footer")
35
- ])) : r("", !0)
41
+ ])) : u("", !0),
42
+ c(e.$slots, "default"),
43
+ e.$slots.content ? (n(), l("div", k, [
44
+ c(e.$slots, "content")
45
+ ])) : u("", !0),
46
+ e.$slots.footer ? (n(), l("footer", m, [
47
+ c(e.$slots, "footer")
48
+ ])) : u("", !0)
36
49
  ], 2));
37
50
  }
38
51
  });
39
52
  export {
40
- y as default
53
+ S as default
41
54
  };
@@ -1 +1 @@
1
- (function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o(require("vue")):typeof define=="function"&&define.amd?define(["vue"],o):(e=typeof globalThis<"u"?globalThis:e||self,e.VvCard=o(e.vue))})(this,function(e){"use strict";const o={title:String,modifiers:[String,Array]},s={key:0,class:"vv-card__header"},n={key:1,class:"vv-card__content"},r={key:2,class:"vv-card__footer"},d={name:"VvCard"};return e.defineComponent({...d,props:o,setup(l){const c=l,{modifiers:i}=toRefs(c),a=useBemModifiers("vv-card",i);return(t,m)=>(e.openBlock(),e.createElementBlock("article",{class:e.normalizeClass(e.unref(a))},[t.$slots.header||t.title?(e.openBlock(),e.createElementBlock("header",s,[e.renderSlot(t.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default"),t.$slots.content?(e.openBlock(),e.createElementBlock("div",n,[e.renderSlot(t.$slots,"content")])):e.createCommentVNode("",!0),t.$slots.footer?(e.openBlock(),e.createElementBlock("footer",r,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0)],2))}})});
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("vue")):typeof define=="function"&&define.amd?define(["vue"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.VvCard=n(e.vue))})(this,function(e){"use strict";const n={title:String,modifiers:[String,Array]};function c(r,o,s){return e.computed(()=>{const l={[r]:!0},t=typeof(o==null?void 0:o.value)=="string"?o.value.split(" "):o==null?void 0:o.value;return t&&Array.isArray(t)&&t.forEach(a=>{l[`${r}--${a}`]=!0}),s&&Object.keys(s.value).forEach(a=>{l[`${r}--${a}`]=e.unref(s.value[a])}),l})}const d={key:0,class:"vv-card__header"},f={key:1,class:"vv-card__content"},i={key:2,class:"vv-card__footer"},p={name:"VvCard"};return e.defineComponent({...p,props:n,setup(r){const o=r,{modifiers:s}=e.toRefs(o),l=c("vv-card",s);return(t,a)=>(e.openBlock(),e.createElementBlock("article",{class:e.normalizeClass(e.unref(l))},[t.$slots.header||t.title?(e.openBlock(),e.createElementBlock("header",d,[e.renderSlot(t.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default"),t.$slots.content?(e.openBlock(),e.createElementBlock("div",f,[e.renderSlot(t.$slots,"content")])):e.createCommentVNode("",!0),t.$slots.footer?(e.openBlock(),e.createElementBlock("footer",i,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0)],2))}})});