@volverjs/ui-vue 0.0.4 → 0.0.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +2 -2
  2. package/auto-imports.d.ts +12 -3
  3. package/bin/icons.cjs +1 -73
  4. package/dist/Volver.d.ts +19 -11
  5. package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
  6. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  7. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  8. package/dist/components/VvAccordion/index.d.ts +8 -3
  9. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +264 -164
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  12. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  13. package/dist/components/VvAction/VvAction.es.js +266 -98
  14. package/dist/components/VvAction/VvAction.umd.js +1 -1
  15. package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
  16. package/dist/components/VvAction/index.d.ts +2 -2
  17. package/dist/components/VvBadge/VvBadge.es.js +203 -44
  18. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  19. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  20. package/dist/components/VvBadge/index.d.ts +1 -1
  21. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +237 -75
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  24. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  25. package/dist/components/VvButton/VvButton.es.js +636 -360
  26. package/dist/components/VvButton/VvButton.umd.js +1 -1
  27. package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
  28. package/dist/components/VvButton/index.d.ts +13 -13
  29. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +251 -79
  30. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  31. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  32. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  33. package/dist/components/VvCard/VvCard.es.js +57 -38
  34. package/dist/components/VvCard/VvCard.umd.js +1 -1
  35. package/dist/components/VvCheckbox/VvCheckbox.es.js +552 -274
  36. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  37. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  38. package/dist/components/VvCheckbox/index.d.ts +5 -5
  39. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +651 -340
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
  42. package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
  43. package/dist/components/VvCombobox/VvCombobox.es.js +1532 -983
  44. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  45. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +125 -51
  46. package/dist/components/VvCombobox/index.d.ts +36 -10
  47. package/dist/components/VvDialog/VvDialog.es.js +377 -141
  48. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  49. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  50. package/dist/components/VvDialog/index.d.ts +4 -1
  51. package/dist/components/VvDropdown/VvDropdown.es.js +440 -244
  52. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  53. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +113 -41
  54. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
  55. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
  56. package/dist/components/VvDropdown/index.d.ts +35 -11
  57. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +363 -160
  58. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  59. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
  60. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  61. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +275 -90
  62. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  63. package/dist/components/VvIcon/VvIcon.es.js +113 -65
  64. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  65. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  66. package/dist/components/VvIcon/index.d.ts +2 -2
  67. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  69. package/dist/components/VvInputText/VvInputText.es.js +974 -460
  70. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  71. package/dist/components/VvInputText/VvInputText.vue.d.ts +96 -16
  72. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  73. package/dist/components/VvInputText/index.d.ts +64 -11
  74. package/dist/components/VvProgress/VvProgress.es.js +206 -45
  75. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  76. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  77. package/dist/components/VvProgress/index.d.ts +1 -1
  78. package/dist/components/VvRadio/VvRadio.es.js +489 -238
  79. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  80. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  81. package/dist/components/VvRadio/index.d.ts +5 -5
  82. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +588 -304
  83. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  84. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
  85. package/dist/components/VvRadioGroup/index.d.ts +3 -3
  86. package/dist/components/VvSelect/VvSelect.es.js +621 -324
  87. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  88. package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
  89. package/dist/components/VvSelect/index.d.ts +3 -3
  90. package/dist/components/VvTextarea/VvTextarea.es.js +664 -353
  91. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  92. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
  93. package/dist/components/VvTextarea/index.d.ts +2 -2
  94. package/dist/components/VvTooltip/VvTooltip.es.js +205 -47
  95. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  96. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  97. package/dist/components/VvTooltip/index.d.ts +2 -2
  98. package/dist/components/index.es.js +3508 -2231
  99. package/dist/components/index.umd.js +1 -1
  100. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  101. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  102. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  103. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  104. package/dist/composables/useComponentFocus.d.ts +1 -1
  105. package/dist/composables/useComponentIcon.d.ts +7 -7
  106. package/dist/composables/useDebouncedInput.d.ts +4 -1
  107. package/dist/composables/useDefaults.d.ts +2 -0
  108. package/dist/composables/useModifiers.d.ts +1 -1
  109. package/dist/composables/useOptions.d.ts +2 -2
  110. package/dist/composables/useTextCount.d.ts +3 -3
  111. package/dist/composables/useUniqueId.d.ts +1 -1
  112. package/dist/composables/useVolver.d.ts +1 -1
  113. package/dist/directives/index.es.js +215 -55
  114. package/dist/directives/index.umd.js +1 -1
  115. package/dist/directives/v-tooltip.es.js +212 -53
  116. package/dist/directives/v-tooltip.umd.js +1 -1
  117. package/dist/icons.es.js +38 -23
  118. package/dist/icons.umd.js +1 -1
  119. package/dist/index.d.ts +0 -1
  120. package/dist/index.es.js +112 -3607
  121. package/dist/index.umd.js +1 -1
  122. package/dist/props/index.d.ts +40 -16
  123. package/dist/resolvers/unplugin.d.ts +7 -1
  124. package/dist/resolvers/unplugin.es.js +77 -37
  125. package/dist/resolvers/unplugin.umd.js +1 -1
  126. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  127. package/dist/stories/argTypes.d.ts +1 -1
  128. package/package.json +114 -36
  129. package/src/Volver.ts +49 -22
  130. package/src/assets/icons/detailed.json +1 -1
  131. package/src/assets/icons/normal.json +1 -1
  132. package/src/assets/icons/simple.json +1 -1
  133. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  134. package/src/components/VvAccordion/index.ts +12 -4
  135. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  136. package/src/components/VvAccordionGroup/index.ts +8 -0
  137. package/src/components/VvAction/VvAction.vue +7 -7
  138. package/src/components/VvAction/index.ts +1 -1
  139. package/src/components/VvBadge/VvBadge.vue +2 -2
  140. package/src/components/VvBadge/index.ts +1 -1
  141. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  142. package/src/components/VvButton/VvButton.vue +11 -11
  143. package/src/components/VvButton/index.ts +10 -9
  144. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  145. package/src/components/VvButtonGroup/index.ts +1 -1
  146. package/src/components/VvCard/VvCard.vue +2 -2
  147. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  148. package/src/components/VvCheckbox/index.ts +11 -7
  149. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  150. package/src/components/VvCheckboxGroup/index.ts +1 -1
  151. package/src/components/VvCombobox/VvCombobox.vue +39 -23
  152. package/src/components/VvCombobox/index.ts +1 -1
  153. package/src/components/VvDialog/VvDialog.vue +28 -11
  154. package/src/components/VvDialog/index.ts +5 -2
  155. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  156. package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
  157. package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
  158. package/src/components/VvDropdown/index.ts +3 -3
  159. package/src/components/VvIcon/VvIcon.vue +3 -3
  160. package/src/components/VvIcon/index.ts +3 -3
  161. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  162. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  163. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  164. package/src/components/VvInputText/VvInputText.vue +128 -35
  165. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  166. package/src/components/VvInputText/index.ts +62 -1
  167. package/src/components/VvProgress/VvProgress.vue +2 -2
  168. package/src/components/VvProgress/index.ts +1 -1
  169. package/src/components/VvRadio/VvRadio.vue +3 -7
  170. package/src/components/VvRadio/index.ts +11 -7
  171. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  172. package/src/components/VvRadioGroup/index.ts +1 -1
  173. package/src/components/VvSelect/VvSelect.vue +4 -4
  174. package/src/components/VvSelect/index.ts +1 -1
  175. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  176. package/src/components/VvTextarea/index.ts +1 -1
  177. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  178. package/src/components/VvTooltip/index.ts +3 -3
  179. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  180. package/src/composables/dropdown/useProvideDropdown.ts +2 -2
  181. package/src/composables/group/useInjectedGroupState.ts +1 -1
  182. package/src/composables/group/useProvideGroupState.ts +1 -1
  183. package/src/composables/useComponentIcon.ts +1 -1
  184. package/src/composables/useDebouncedInput.ts +10 -3
  185. package/src/composables/useDefaults.ts +89 -0
  186. package/src/composables/useModifiers.ts +4 -2
  187. package/src/composables/useOptions.ts +1 -1
  188. package/src/composables/useVolver.ts +2 -2
  189. package/src/directives/index.ts +1 -1
  190. package/src/directives/v-tooltip.ts +2 -2
  191. package/src/index.ts +0 -2
  192. package/src/props/index.ts +8 -8
  193. package/src/resolvers/unplugin.ts +15 -1
  194. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  195. package/src/stories/Accordion/Accordion.test.ts +21 -15
  196. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  197. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  198. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  199. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  200. package/src/stories/InputText/InputText.settings.ts +53 -0
  201. package/src/stories/InputText/InputText.stories.mdx +40 -0
  202. package/src/stories/InputText/InputText.test.ts +5 -2
  203. package/src/stories/argTypes.ts +2 -2
  204. package/src/types/group.d.ts +5 -0
@@ -1 +1 @@
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"]))}})});
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 '@/constants';
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: import("vue").PropType<Side>;
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: import("vue").PropType<string | string[]>;
27
+ modifiers: globalThis.PropType<string | string[]>;
28
28
  id: (StringConstructor | NumberConstructor)[];
29
29
  type: {
30
- type: StringConstructor;
31
- default: import("@/constants").ButtonType;
32
- validator: (value: import("@/constants").ButtonType) => boolean;
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: import("vue").PropType<import("@/constants").AnchorTarget>;
40
- validator: (value: import("@/constants").AnchorTarget) => boolean;
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: import("vue").ComputedRef<HTMLElement | undefined>;
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: import("vue").PropType<Side>;
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: import("vue").PropType<string | string[]>;
77
+ modifiers: globalThis.PropType<string | string[]>;
78
78
  id: (StringConstructor | NumberConstructor)[];
79
79
  type: {
80
- type: StringConstructor;
81
- default: import("@/constants").ButtonType;
82
- validator: (value: import("@/constants").ButtonType) => boolean;
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: import("vue").PropType<import("@/constants").AnchorTarget>;
90
- validator: (value: import("@/constants").AnchorTarget) => boolean;
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: string;
104
+ type: "button" | "submit" | "reset";
105
105
  rel: string;
106
106
  active: boolean;
107
107
  pressed: boolean;
108
- iconPosition: Side;
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 '@/types/group';
3
- import { Side } from '@/constants';
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<Side>;
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: StringConstructor;
43
- default: import("@/constants").ButtonType;
44
- validator: (value: import("@/constants").ButtonType) => boolean;
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<import("@/constants").AnchorTarget>;
52
- validator: (value: import("@/constants").AnchorTarget) => boolean;
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: import("vue").ComputedRef<boolean>;
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: Ref<boolean>;
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<Side>;
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 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 = {
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: (t) => Object.values(b).includes(t)
56
+ validator: (value) => Object.values(AnchorTarget).includes(value)
21
57
  },
22
58
  /**
23
59
  * Anchor rel
@@ -26,127 +62,263 @@ const G = Symbol.for("buttonGroup"), C = {
26
62
  type: String,
27
63
  default: "noopener noreferrer"
28
64
  }
29
- }, y = {
65
+ };
66
+ const DisabledProps = {
30
67
  /**
31
68
  * Whether the form control is disabled
32
69
  */
33
70
  disabled: Boolean
34
- }, N = {
71
+ };
72
+ const ActiveProps = {
35
73
  /**
36
74
  * Whether the item is active
37
75
  */
38
76
  active: Boolean
39
- }, P = {
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
- }, M = {
89
+ };
90
+ const ModifiersProps = {
50
91
  /**
51
92
  * Component BEM modifiers
52
93
  */
53
94
  modifiers: [String, Array]
54
95
  };
55
- i.before;
56
- const R = {
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: !0 }
115
+ unselectable: { type: Boolean, default: true }
61
116
  };
62
- u.bottom;
63
117
  ({
64
- ...y,
65
- ...$,
66
- ...P,
67
- ...N,
68
- ...C,
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 show / hide transition name
130
+ */
131
+ transitionName: {
132
+ type: String
133
+ },
134
+ /**
135
+ * Offset of the dropdown from the trigger
136
+ * @see https://floating-ui.com/docs/offset
137
+ */
138
+ offset: {
139
+ type: [Number, String, Object],
140
+ default: 0
141
+ },
142
+ /**
143
+ * Move dropdown to the side if there is no space in the default position
144
+ * @see https://floating-ui.com/docs/shift
145
+ */
146
+ shift: {
147
+ type: [Boolean, Object],
148
+ default: false
149
+ },
150
+ /**
151
+ * Flip dropdown position if there is no space in the default position
152
+ * @see https://floating-ui.com/docs/flip
153
+ */
154
+ flip: {
155
+ type: [Boolean, Object],
156
+ default: true
157
+ },
158
+ /**
159
+ * Size of the dropdown
160
+ * @see https://floating-ui.com/docs/size
161
+ */
162
+ size: {
163
+ type: [Boolean, Object],
164
+ default: () => ({ padding: 10 })
165
+ },
166
+ /**
167
+ * Automatically change the position of the dropdown
168
+ * @see https://floating-ui.com/docs/autoPlacement
169
+ */
170
+ autoPlacement: {
171
+ type: [Boolean, Object],
172
+ default: false
173
+ },
174
+ /**
175
+ * Add arrow to the dropdown
176
+ * @see https://floating-ui.com/docs/arrow
177
+ */
178
+ arrow: {
179
+ type: Boolean,
180
+ default: false
181
+ },
182
+ /**
183
+ * Close dropdown on click outside
184
+ */
185
+ autoClose: {
186
+ type: Boolean,
187
+ default: true
188
+ },
189
+ /**
190
+ * Autofocus first item on dropdown open
191
+ */
192
+ autofocusFirst: {
193
+ type: Boolean,
194
+ default: true
195
+ },
196
+ /**
197
+ * Set dropdown width to the same as the trigger
198
+ */
199
+ triggerWidth: {
200
+ type: Boolean
201
+ }
202
+ });
203
+ ({
204
+ ...DisabledProps,
205
+ ...LabelProps,
206
+ ...PressedProps,
207
+ ...ActiveProps,
208
+ ...LinkProps,
69
209
  /**
70
210
  * Button type
71
211
  */
72
- type: p.button
212
+ type: {
213
+ type: String,
214
+ default: ButtonType.button,
215
+ validator: (value) => Object.values(ButtonType).includes(value)
216
+ }
73
217
  });
74
- const U = {
75
- ...M,
76
- ...y,
77
- ...R,
218
+ const VvButtonGroupProps = {
219
+ ...ModifiersProps,
220
+ ...DisabledProps,
221
+ ...UnselectableProps,
78
222
  /**
79
223
  * String or String[] of css classes (modifiers) that will be provided to each button'
80
224
  */
81
225
  itemModifiers: { type: [String, Array], default: void 0 },
82
- toggle: { type: Boolean, default: !1 },
83
- multiple: { type: Boolean, default: !1 },
226
+ toggle: { type: Boolean, default: false },
227
+ multiple: { type: Boolean, default: false },
84
228
  modelValue: { type: [String, Array], default: void 0 }
85
- }, z = ["update:modelValue"];
86
- function I(t) {
87
- if (Object.keys(t).some(
88
- (e) => e !== "key" && !O(t[e])
229
+ };
230
+ const VvButtonGroupEvents = ["update:modelValue"];
231
+ function useProvideGroupState(groupState) {
232
+ if (Object.keys(groupState).some(
233
+ (k) => k !== "key" && !isRef(groupState[k])
89
234
  ))
90
235
  throw Error("One or more groupState props aren't ref.");
91
- _(
92
- t.key,
93
- d(() => t)
236
+ provide(
237
+ groupState.key,
238
+ computed(() => groupState)
94
239
  );
95
240
  }
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;
241
+ function useModifiers(prefix, modifiers, others) {
242
+ return computed(() => {
243
+ const toReturn = {
244
+ [prefix]: true
245
+ };
246
+ const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
247
+ if (modifiersArray) {
248
+ if (Array.isArray(modifiersArray)) {
249
+ modifiersArray.forEach((modifier) => {
250
+ if (modifier) {
251
+ toReturn[`${prefix}--${modifier}`] = true;
252
+ }
253
+ });
254
+ }
255
+ }
256
+ if (others) {
257
+ Object.keys(others.value).forEach((key) => {
258
+ toReturn[`${prefix}--${key}`] = unref(others.value[key]);
259
+ });
260
+ }
261
+ return toReturn;
106
262
  });
107
263
  }
108
- const D = {
264
+ const __default__ = {
109
265
  name: "VvButtonGroup"
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(
125
- "[VvButtonGroup]: modelValue is a string but multiple is true."
126
- );
266
+ };
267
+ const _sfc_main = /* @__PURE__ */ defineComponent({
268
+ ...__default__,
269
+ props: VvButtonGroupProps,
270
+ emits: VvButtonGroupEvents,
271
+ setup(__props, { emit }) {
272
+ const props = __props;
273
+ const {
274
+ disabled,
275
+ toggle,
276
+ modifiers,
277
+ multiple,
278
+ unselectable,
279
+ itemModifiers
280
+ } = toRefs(props);
281
+ watchEffect(() => {
282
+ if (typeof props.modelValue === "string" && multiple.value) {
283
+ console.warn(
284
+ `[VvButtonGroup]: modelValue is a string but multiple is true.`
285
+ );
286
+ }
127
287
  });
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))
288
+ const modelValue = computed({
289
+ get: () => {
290
+ if (!multiple.value) {
291
+ return Array.isArray(props.modelValue) ? props.modelValue[0] : props.modelValue;
292
+ }
293
+ return props.modelValue;
294
+ },
295
+ set: (newValue) => {
296
+ if (newValue !== void 0 && (Array.isArray(props.modelValue) || multiple.value) && !Array.isArray(newValue)) {
297
+ newValue = [newValue];
298
+ }
299
+ return emit("update:modelValue", newValue);
300
+ }
131
301
  });
132
- I({
133
- key: G,
134
- modelValue: g,
135
- disabled: l,
136
- toggle: n,
137
- multiple: s,
138
- unselectable: v,
139
- itemModifiers: m
302
+ useProvideGroupState({
303
+ key: INJECTION_KEY_BUTTON_GROUP,
304
+ modelValue,
305
+ disabled,
306
+ toggle,
307
+ multiple,
308
+ unselectable,
309
+ itemModifiers
140
310
  });
141
- const B = L("vv-button-group", a);
142
- return (r, F) => (V(), A("div", {
143
- class: h(f(B)),
144
- role: "group"
145
- }, [
146
- k(r.$slots, "default")
147
- ], 2));
311
+ const bemCssClasses = useModifiers("vv-button-group", modifiers);
312
+ return (_ctx, _cache) => {
313
+ return openBlock(), createElementBlock("div", {
314
+ class: normalizeClass(unref(bemCssClasses)),
315
+ role: "group"
316
+ }, [
317
+ renderSlot(_ctx.$slots, "default")
318
+ ], 2);
319
+ };
148
320
  }
149
321
  });
150
322
  export {
151
- K as default
323
+ _sfc_main as default
152
324
  };
@@ -1 +1 @@
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
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue")):"function"==typeof define&&define.amd?define(["vue"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvButtonGroup=o(e.vue)}(this,(function(e){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),t=(e=>(e.before="before",e.after="after",e))(t||{}),l=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(l||{});const r=Symbol.for("buttonGroup"),u={disabled:Boolean},a=(Boolean,Boolean,{modifiers:[String,Array]});t.before;const n={unselectable:{type:Boolean,default:!0}};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,l.button;const i={...a,...u,...n,itemModifiers:{type:[String,Array],default:void 0},toggle:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},modelValue:{type:[String,Array],default:void 0}};return e.defineComponent({name:"VvButtonGroup",props:i,emits:["update:modelValue"],setup(o,{emit:t}){const l=o,{disabled:u,toggle:a,modifiers:n,multiple:i,unselectable:s,itemModifiers:d}=e.toRefs(l);e.watchEffect((()=>{"string"==typeof l.modelValue&&i.value&&console.warn("[VvButtonGroup]: modelValue is a string but multiple is true.")}));const f=e.computed({get:()=>i.value?l.modelValue:Array.isArray(l.modelValue)?l.modelValue[0]:l.modelValue,set:e=>(void 0===e||!Array.isArray(l.modelValue)&&!i.value||Array.isArray(e)||(e=[e]),t("update:modelValue",e))});!function(o){if(Object.keys(o).some((t=>"key"!==t&&!e.isRef(o[t]))))throw Error("One or more groupState props aren't ref.");e.provide(o.key,e.computed((()=>o)))}({key:r,modelValue:f,disabled:u,toggle:a,multiple:i,unselectable:s,itemModifiers:d});const m=function(o,t,l){return e.computed((()=>{const r={[o]:!0},u="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return u&&Array.isArray(u)&&u.forEach((e=>{e&&(r[`${o}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((t=>{r[`${o}--${t}`]=e.unref(l.value[t])})),r}))}("vv-button-group",n);return(o,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(m)),role:"group"},[e.renderSlot(o.$slots,"default")],2))}})}));