@volverjs/ui-vue 0.0.10-beta.23 → 0.0.10-beta.25

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 (90) hide show
  1. package/dist/components/VvAccordion/VvAccordion.es.js +119 -79
  2. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  3. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +18 -4
  4. package/dist/components/VvAccordion/index.d.ts +4 -8
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +282 -124
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +34 -7
  8. package/dist/components/VvAccordionGroup/index.d.ts +4 -1
  9. package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
  10. package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
  11. package/dist/components/VvButton/VvButton.es.js +92 -98
  12. package/dist/components/VvButton/VvButton.umd.js +1 -1
  13. package/dist/components/VvButton/VvButton.vue.d.ts +7 -7
  14. package/dist/components/VvButton/index.d.ts +11 -11
  15. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -13
  16. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  17. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -3
  18. package/dist/components/VvCheckbox/VvCheckbox.es.js +81 -87
  19. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  20. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
  21. package/dist/components/VvCheckbox/index.d.ts +2 -2
  22. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -29
  23. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  24. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +5 -5
  25. package/dist/components/VvCombobox/VvCombobox.es.js +13 -16
  26. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  27. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +11 -11
  28. package/dist/components/VvCombobox/index.d.ts +1 -1
  29. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +5 -5
  30. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +1 -1
  31. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +1 -1
  32. package/dist/components/VvDropdown/index.d.ts +1 -1
  33. package/dist/components/VvInputFile/VvInputFile.es.js +183 -168
  34. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  35. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +16 -9
  36. package/dist/components/VvInputFile/index.d.ts +12 -3
  37. package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
  38. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  39. package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
  40. package/dist/components/VvProgress/VvProgress.vue.d.ts +1 -1
  41. package/dist/components/VvRadio/VvRadio.es.js +64 -70
  42. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  43. package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
  44. package/dist/components/VvRadio/index.d.ts +6 -6
  45. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -29
  46. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  47. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +5 -5
  48. package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
  49. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +5 -5
  50. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +3 -3
  51. package/dist/components/VvTooltip/index.d.ts +1 -1
  52. package/dist/components/index.es.js +494 -328
  53. package/dist/components/index.umd.js +1 -1
  54. package/dist/composables/alert/useInjectAlert.d.ts +1 -6
  55. package/dist/composables/group/useInjectedGroupState.d.ts +4 -5
  56. package/dist/composables/group/useProvideGroupState.d.ts +3 -3
  57. package/dist/constants.d.ts +6 -10
  58. package/dist/icons.es.js +3 -3
  59. package/dist/icons.umd.js +1 -1
  60. package/dist/index.es.js +3 -2
  61. package/dist/index.umd.js +1 -1
  62. package/dist/props/index.d.ts +1 -1
  63. package/dist/resolvers/unplugin.es.js +3 -2
  64. package/dist/resolvers/unplugin.umd.js +1 -1
  65. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +58 -15
  66. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +381 -107
  67. package/dist/types/group.d.ts +37 -15
  68. package/package.json +37 -36
  69. package/src/assets/icons/detailed.json +1 -1
  70. package/src/assets/icons/normal.json +1 -1
  71. package/src/assets/icons/simple.json +1 -1
  72. package/src/components/VvAccordion/VvAccordion.vue +119 -56
  73. package/src/components/VvAccordion/index.ts +8 -23
  74. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +164 -42
  75. package/src/components/VvAccordionGroup/index.ts +4 -1
  76. package/src/components/VvButton/index.ts +7 -12
  77. package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -2
  78. package/src/components/VvCheckbox/index.ts +2 -2
  79. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +1 -2
  80. package/src/components/VvInputFile/VvInputFile.vue +71 -47
  81. package/src/components/VvInputFile/index.ts +5 -4
  82. package/src/components/VvRadio/index.ts +5 -5
  83. package/src/components/VvRadioGroup/VvRadioGroup.vue +1 -2
  84. package/src/composables/group/useInjectedGroupState.ts +20 -16
  85. package/src/composables/group/useProvideGroupState.ts +10 -15
  86. package/src/constants.ts +19 -14
  87. package/src/stories/AccordionGroup/AccordionGroup.settings.ts +2 -2
  88. package/src/stories/AccordionGroup/AccordionGroup.test.ts +16 -10
  89. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +1 -1
  90. package/src/types/group.ts +22 -14
@@ -1,5 +1,8 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
- modelValue: (ArrayConstructor | StringConstructor)[];
2
+ modelValue: {
3
+ type: globalThis.PropType<string | string[] | undefined>;
4
+ default: undefined;
5
+ };
3
6
  items: {
4
7
  type: globalThis.PropType<import(".").VvAccordionGroupItem[]>;
5
8
  default: () => never[];
@@ -16,10 +19,17 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
16
19
  type: globalThis.PropType<string | string[]>;
17
20
  default: undefined;
18
21
  };
19
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
22
+ }, {
23
+ expandedAccordions: globalThis.WritableComputedRef<Set<string>>;
24
+ expand: (name?: string | string[]) => void;
25
+ collapse: (name?: string | string[]) => void;
26
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
27
  [x: string]: (...args: any[]) => void;
21
28
  }, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<{
22
- modelValue: (ArrayConstructor | StringConstructor)[];
29
+ modelValue: {
30
+ type: globalThis.PropType<string | string[] | undefined>;
31
+ default: undefined;
32
+ };
23
33
  items: {
24
34
  type: globalThis.PropType<import(".").VvAccordionGroupItem[]>;
25
35
  default: () => never[];
@@ -37,14 +47,31 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
37
47
  default: undefined;
38
48
  };
39
49
  }>>, {
40
- disabled: boolean;
41
- modifiers: string | string[];
42
50
  collapse: boolean;
51
+ disabled: boolean;
52
+ modelValue: string | string[] | undefined;
43
53
  not: boolean;
54
+ modifiers: string | string[];
44
55
  items: import(".").VvAccordionGroupItem[];
45
56
  itemModifiers: string | string[];
46
- }, {}>, Partial<Record<`header::${string}`, (_: any) => any>> & Partial<Record<`details::${string}`, (_: any) => any>> & {
47
- default?(_: {}): any;
57
+ }, {}>, Partial<Record<`summary::${string}`, (_: {
58
+ isExpanded: boolean;
59
+ expand: () => void;
60
+ collapse: () => void;
61
+ groupExpand: (name?: string | string[] | undefined) => void;
62
+ groupCollapse: (name?: string | string[] | undefined) => void;
63
+ }) => any>> & Partial<Record<`content::${string}`, (_: {
64
+ isExpanded: boolean;
65
+ expand: () => void;
66
+ collapse: () => void;
67
+ groupExpand: (name?: string | string[] | undefined) => void;
68
+ groupCollapse: (name?: string | string[] | undefined) => void;
69
+ }) => any>> & {
70
+ default?(_: {
71
+ expandedAccordions: Set<string>;
72
+ expand: (name?: string | string[]) => void;
73
+ collapse: (name?: string | string[]) => void;
74
+ }): any;
48
75
  }>;
49
76
  export default _default;
50
77
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -9,7 +9,10 @@ export declare const VvAccordionGroupProps: {
9
9
  /**
10
10
  * VModel
11
11
  */
12
- modelValue: (ArrayConstructor | StringConstructor)[];
12
+ modelValue: {
13
+ type: globalThis.PropType<string | string[] | undefined>;
14
+ default: undefined;
15
+ };
13
16
  /**
14
17
  * Accordion items
15
18
  * @type VvAccordionGroupItem
@@ -98,8 +98,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
98
98
  default: boolean;
99
99
  };
100
100
  }>>, {
101
- disabled: boolean;
102
101
  label: string | number;
102
+ disabled: boolean;
103
103
  type: "button" | "submit" | "reset";
104
104
  target: "_blank" | "_self" | "_parent" | "_top";
105
105
  ariaLabel: string;
@@ -89,9 +89,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
89
89
  };
90
90
  id: (StringConstructor | NumberConstructor)[];
91
91
  }>>, {
92
- modifiers: string | string[];
93
92
  title: string;
94
93
  content: string;
94
+ modifiers: string | string[];
95
95
  footer: string;
96
96
  role: "alert" | "alertdialog";
97
97
  icon: string | import("../VvIcon").VvIconProps;
@@ -54,7 +54,9 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
54
54
  return AnchorTarget2;
55
55
  })(AnchorTarget || {});
56
56
  const INJECTION_KEY_VOLVER = Symbol.for("volver");
57
- const INJECTION_KEY_BUTTON_GROUP = Symbol.for("buttonGroup");
57
+ const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
58
+ "buttonGroup"
59
+ );
58
60
  const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
59
61
  "dropdownTrigger"
60
62
  );
@@ -581,97 +583,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
581
583
  };
582
584
  }
583
585
  });
584
- function equals(obj1, obj2, field) {
585
- if (field) {
586
- return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
587
- }
588
- return deepEquals(obj1, obj2);
589
- }
590
- function deepEquals(a, b) {
591
- if (a === b)
592
- return true;
593
- if (a && b && typeof a == "object" && typeof b == "object") {
594
- const arrA = Array.isArray(a);
595
- const arrB = Array.isArray(b);
596
- let i, length, key;
597
- if (arrA && arrB) {
598
- length = a.length;
599
- if (length != b.length)
600
- return false;
601
- for (i = length; i-- !== 0; )
602
- if (!deepEquals(a[i], b[i]))
603
- return false;
604
- return true;
605
- }
606
- if (arrA != arrB)
607
- return false;
608
- const dateA = a instanceof Date, dateB = b instanceof Date;
609
- if (dateA != dateB)
610
- return false;
611
- if (dateA && dateB)
612
- return a.getTime() == b.getTime();
613
- const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
614
- if (regexpA != regexpB)
615
- return false;
616
- if (regexpA && regexpB)
617
- return a.toString() == b.toString();
618
- const keys = Object.keys(a);
619
- length = keys.length;
620
- if (length !== Object.keys(b).length)
621
- return false;
622
- for (i = length; i-- !== 0; )
623
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
624
- return false;
625
- for (i = length; i-- !== 0; ) {
626
- key = keys[i];
627
- if (!deepEquals(a[key], b[key]))
628
- return false;
629
- }
630
- return true;
631
- }
632
- return a !== a && b !== b;
633
- }
634
- function resolveFieldData(data, field) {
635
- if (data && Object.keys(data).length && field) {
636
- if (field.indexOf(".") === -1) {
637
- return data[field];
638
- } else {
639
- const fields = field.split(".");
640
- let value = data;
641
- for (let i = 0, len = fields.length; i < len; ++i) {
642
- if (data == null) {
643
- return null;
644
- }
645
- value = value[fields[i]];
646
- }
647
- return value;
648
- }
649
- } else {
650
- return null;
651
- }
652
- }
653
- function contains(value, list) {
654
- if (value != null && list && list.length) {
655
- for (const val of list) {
656
- if (equals(value, val)) {
657
- return true;
658
- }
659
- }
660
- }
661
- return false;
662
- }
663
- function isEmpty(value) {
664
- return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
665
- }
666
586
  function useInjectedGroupState(groupKey) {
667
587
  const group = inject(groupKey, void 0);
668
- const isInGroup = computed(() => !isEmpty(group));
588
+ const isInGroup = computed(() => group !== void 0);
669
589
  function getGroupOrLocalRef(propName, props, emit) {
670
- if (group == null ? void 0 : group.value) {
671
- const groupPropValue = unref(group.value)[propName];
590
+ const groupPropValue = group == null ? void 0 : group[propName];
591
+ if (groupPropValue) {
672
592
  return computed({
673
593
  get() {
674
- return groupPropValue == null ? void 0 : groupPropValue.value;
594
+ return groupPropValue.value;
675
595
  },
676
596
  set(value) {
677
597
  groupPropValue.value = value;
@@ -684,8 +604,9 @@ function useInjectedGroupState(groupKey) {
684
604
  return propRef.value;
685
605
  },
686
606
  set(value) {
687
- if (emit)
607
+ if (emit) {
688
608
  emit(`update:${propName}`, value);
609
+ }
689
610
  }
690
611
  });
691
612
  }
@@ -749,14 +670,11 @@ function useGroupProps(props, emit) {
749
670
  const { id, iconPosition, icon, label, pressed } = toRefs(props);
750
671
  const modelValue = getGroupOrLocalRef("modelValue", props, emit);
751
672
  const toggle = getGroupOrLocalRef("toggle", props);
752
- const unselectable = getGroupOrLocalRef(
753
- "unselectable",
754
- props
755
- );
756
- const multiple = computed(() => (group == null ? void 0 : group.value.multiple.value) ?? false);
673
+ const unselectable = getGroupOrLocalRef("unselectable", props);
674
+ const multiple = computed(() => (group == null ? void 0 : group.multiple.value) ?? false);
757
675
  const modifiers = computed(() => {
758
676
  let localModifiers = props.modifiers;
759
- let groupModifiers = group == null ? void 0 : group.value.modifiers.value;
677
+ let groupModifiers = group == null ? void 0 : group.modifiers.value;
760
678
  const toReturn = /* @__PURE__ */ new Set();
761
679
  if (localModifiers) {
762
680
  if (!Array.isArray(localModifiers)) {
@@ -773,10 +691,7 @@ function useGroupProps(props, emit) {
773
691
  return Array.from(toReturn);
774
692
  });
775
693
  const disabled = computed(
776
- () => {
777
- var _a;
778
- return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
779
- }
694
+ () => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
780
695
  );
781
696
  return {
782
697
  // group props
@@ -797,6 +712,85 @@ function useGroupProps(props, emit) {
797
712
  };
798
713
  }
799
714
  const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
715
+ function equals(obj1, obj2, field) {
716
+ if (field) {
717
+ return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
718
+ }
719
+ return deepEquals(obj1, obj2);
720
+ }
721
+ function deepEquals(a, b) {
722
+ if (a === b)
723
+ return true;
724
+ if (a && b && typeof a == "object" && typeof b == "object") {
725
+ const arrA = Array.isArray(a);
726
+ const arrB = Array.isArray(b);
727
+ let i, length, key;
728
+ if (arrA && arrB) {
729
+ length = a.length;
730
+ if (length != b.length)
731
+ return false;
732
+ for (i = length; i-- !== 0; )
733
+ if (!deepEquals(a[i], b[i]))
734
+ return false;
735
+ return true;
736
+ }
737
+ if (arrA != arrB)
738
+ return false;
739
+ const dateA = a instanceof Date, dateB = b instanceof Date;
740
+ if (dateA != dateB)
741
+ return false;
742
+ if (dateA && dateB)
743
+ return a.getTime() == b.getTime();
744
+ const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
745
+ if (regexpA != regexpB)
746
+ return false;
747
+ if (regexpA && regexpB)
748
+ return a.toString() == b.toString();
749
+ const keys = Object.keys(a);
750
+ length = keys.length;
751
+ if (length !== Object.keys(b).length)
752
+ return false;
753
+ for (i = length; i-- !== 0; )
754
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
755
+ return false;
756
+ for (i = length; i-- !== 0; ) {
757
+ key = keys[i];
758
+ if (!deepEquals(a[key], b[key]))
759
+ return false;
760
+ }
761
+ return true;
762
+ }
763
+ return a !== a && b !== b;
764
+ }
765
+ function resolveFieldData(data, field) {
766
+ if (data && Object.keys(data).length && field) {
767
+ if (field.indexOf(".") === -1) {
768
+ return data[field];
769
+ } else {
770
+ const fields = field.split(".");
771
+ let value = data;
772
+ for (let i = 0, len = fields.length; i < len; ++i) {
773
+ if (data == null) {
774
+ return null;
775
+ }
776
+ value = value[fields[i]];
777
+ }
778
+ return value;
779
+ }
780
+ } else {
781
+ return null;
782
+ }
783
+ }
784
+ function contains(value, list) {
785
+ if (value != null && list && list.length) {
786
+ for (const val of list) {
787
+ if (equals(value, val)) {
788
+ return true;
789
+ }
790
+ }
791
+ }
792
+ return false;
793
+ }
800
794
  function useComponentIcon(icon, iconPosition) {
801
795
  const hasIcon = computed(() => {
802
796
  if (typeof (icon == null ? void 0 : icon.value) === "string") {
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("uid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvButton=t(e.vue,e.vue$1,e.uid)}(this,(function(e,t,o){"use strict";const n={prefix:"normal"};var l=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(l||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),a=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(a||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{}),i=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(i||{});const s=Symbol.for("volver"),d=Symbol.for("buttonGroup"),c=Symbol.for("dropdownTrigger"),v=Symbol.for("dropdownAction");function f(){return e.inject(s)}function p(t,o,n){return e.computed((()=>{const l={[t]:!0},r="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return r&&Array.isArray(r)&&r.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{l[`${t}--${o}`]=e.unref(n.value[o])})),l}))}const m=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},n),setup(o){const n=o,l=e.computed((()=>"string"==typeof n.rotate?parseFloat(n.rotate):n.rotate)),r=e.ref(!0),a=f(),{modifiers:u}=e.toRefs(n),i=p("vv-icon",u),s=e.computed((()=>n.provider||(null==a?void 0:a.iconsProvider))),d=e.computed((()=>{const e=n.name??"",o=`@${s.value}:${n.prefix}:${e}`;if(t.iconExists(o))return o;const l=null==a?void 0:a.iconsCollections.find((o=>{const n=`@${s.value}:${o.prefix}:${e}`;return t.iconExists(n)}));return l?`@${s.value}:${l.prefix}:${e}`:e}));function c(e){const o=function(e){let t;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),l=(null==o?void 0:o.innerHTML.trim())||"";o&&l&&t.addIcon(`@${s.value}:${n.prefix}:${n.name}`,{body:l,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return a&&n.src&&!t.iconExists(`@${s.value}:${n.prefix}:${n.name}`)&&(r.value=!1,a.fetchIcon(n.src).then((e=>{e&&(c(e),r.value=!0)})).catch((e=>{throw new Error(`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(i)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:e.unref(l),color:o.color,onLoad:o.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),g={to:{type:[String,Object]},href:String,target:{type:String,default:void 0,validator:e=>Object.values(i).includes(e)},rel:{type:String,default:"noopener noreferrer"}},b={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},y={disabled:{type:Boolean,default:!1}},h={active:{type:Boolean,default:!1}},k={current:{type:Boolean,default:!1}},B={pressed:{type:Boolean,default:!1}},S={label:{type:[String,Number],default:void 0}},$={modifiers:{type:[String,Array],default:void 0}},x={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},w={unselectable:{type:Boolean,default:!0}},A={id:[String,Number]};l.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const L={...y,...S,...B,...h,...k,...g,type:{type:String,default:a.button,validator:e=>Object.values(a).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:u.button}},j=L;const V=e.defineComponent({name:"VvAction",props:j,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:n}){const l=t,r=n,a=f(),i=e.ref(null);o({$el:i});const{reference:s,bus:d,aria:p,expanded:m}=e.inject(c,{});e.watch((()=>i.value),(e=>{s&&(s.value=e)}));const g=e.computed((()=>l.pressed||(null==m?void 0:m.value))),{role:b}=e.inject(v,{}),y=e.computed((()=>{switch(!0){case l.disabled:return u.button;case void 0!==l.to:return(null==a?void 0:a.nuxt)?u.nuxtLink:u.routerLink;case void 0!==l.href:return u.a;default:return l.defaultTag}})),h=e.computed((()=>{const e={...null==p?void 0:p.value,ariaPressed:!!g.value||void 0,ariaLabel:l.ariaLabel,role:null==b?void 0:b.value};switch(y.value){case u.a:return{...e,href:l.href,target:l.target,rel:l.rel};case u.routerLink:case u.nuxtLink:return{...e,to:l.to,target:l.target};case u.button:return{...e,type:l.type,disabled:l.disabled};default:return e}})),k=e=>{l.disabled?e.preventDefault():(null==d||d.emit("click",e),r("click",e))},B=e=>{null==d||d.emit("mouseover",e),r("mouseover",e)},S=e=>{null==d||d.emit("mouseleave",e),r("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps(e.unref(h),{ref_key:"element",ref:i,class:{active:t.active,pressed:e.unref(g),disabled:t.disabled,current:t.current},onClickPassive:k,onMouseoverPassive:B,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?I(e,o)===I(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 l,r,a;if(o&&n){if(r=e.length,r!=t.length)return!1;for(l=r;0!=l--;)if(!O(e[l],t[l]))return!1;return!0}if(o!=n)return!1;const u=e instanceof Date,i=t instanceof Date;if(u!=i)return!1;if(u&&i)return e.getTime()==t.getTime();const s=e instanceof RegExp,d=t instanceof RegExp;if(s!=d)return!1;if(s&&d)return e.toString()==t.toString();const c=Object.keys(e);if(r=c.length,r!==Object.keys(t).length)return!1;for(l=r;0!=l--;)if(!Object.prototype.hasOwnProperty.call(t,c[l]))return!1;for(l=r;0!=l--;)if(a=c[l],!O(e[a],t[a]))return!1;return!0}return e!=e&&t!=t}function I(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,l=o.length;t<l;++t){if(null==e)return null;n=n[o[t]]}return n}}return null}function P(e,t){if(null!=e&&t&&t.length)for(const o of t)if(_(e,o))return!0;return!1}function C(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,l){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 r=e.toRef(n,t);return e.computed({get:()=>r.value,set(e){l&&l(`update:${t}`,e)}})}}}const E={...L,...A,...$,...w,...b,...x,iconPosition:{type:String,default:l.left,validator:e=>Object.values(l).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};const D={key:1,class:"vv-button__label"},N={key:1,class:"vv-button__label"};return e.defineComponent({name:"VvButton",props:E,emits:["update:modelValue"],setup(t,{expose:n,emit:a}){const u=t,i=e.useAttrs(),s=e.useSlots(),c=a,{id:v,modifiers:f,iconPosition:g,icon:b,label:y,modelValue:h,disabled:k,toggle:B,unselectable:S}=function(t,o){const{group:n,isInGroup:l,getGroupOrLocalRef:r}=C(d),{id:a,iconPosition:u,icon:i,label:s,pressed:c}=e.toRefs(t),v=r("modelValue",t,o),f=r("toggle",t),p=r("unselectable",t),m=e.computed((()=>(null==n?void 0:n.value.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,o=null==n?void 0:n.value.modifiers.value;const l=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>l.add(e)))),o&&(Array.isArray(o)||(o=o.split(" ")),o.forEach((e=>l.add(e)))),Array.from(l)})),b=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:l,modelValue:v,toggle:f,unselectable:p,multiple:m,modifiers:g,disabled:b,id:a,pressed:c,iconPosition:u,icon:i,label:s}}(u,c),$=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid()))))(v),x=e.computed((()=>(null==i?void 0:i.name)||$.value)),w=e.ref(null);n({$el:e.computed((()=>{var e;return null==(e=w.value)?void 0:e.$el}))});const A=e.computed((()=>B.value?Array.isArray(h.value)?P(x.value,h.value):_(x.value,h.value):u.pressed)),L=p("vv-button",f,e.computed((()=>({reverse:[l.right,l.bottom].includes(g.value),column:[l.top,l.bottom].includes(g.value),"icon-only":Boolean((null==b?void 0:b.value)&&!(null==y?void 0:y.value)&&!s.default)})))),{hasIcon:j}=function(t,o){const n=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==o?void 0:o.value)===r.before?n.value:void 0)),u=e.computed((()=>(null==o?void 0:o.value)===r.after?n.value:void 0)),i=e.computed((()=>(null==o?void 0:o.value)===l.left?n.value:void 0)),s=e.computed((()=>(null==o?void 0:o.value)===l.right?n.value:void 0)),d=e.computed((()=>(null==o?void 0:o.value)===l.top?n.value:void 0)),c=e.computed((()=>(null==o?void 0:o.value)===l.bottom?n.value:void 0));return{hasIcon:n,hasIconLeft:i,hasIconRight:s,hasIconTop:d,hasIconBottom:c,hasIconBefore:a,hasIconAfter:u}}(b),O=e.computed((()=>void 0!==u.value?u.value:x.value)),I=()=>{if(B.value){if(Array.isArray(h.value))return P(O.value,h.value)?void(S.value&&(h.value=h.value.filter((e=>e!==O.value)))):void h.value.push(O.value);if(O.value===h.value&&S.value)return void(h.value=u.uncheckedValue);h.value=O.value}};return(t,o)=>(e.openBlock(),e.createBlock(V,e.mergeProps({disabled:e.unref(k),pressed:e.unref(A),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref($),ref_key:"element",ref:w,class:e.unref(L),onClick:I}),{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("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",D,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(j)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0},e.unref(j),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(y)?(e.openBlock(),e.createElementBlock("span",N,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(y)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$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("uid")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","uid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvButton=t(e.vue,e.vue$1,e.uid)}(this,(function(e,t,o){"use strict";const n={prefix:"normal"};var l=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(l||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),a=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(a||{}),u=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(u||{});const d=Symbol.for("volver"),s=Symbol.for("buttonGroup"),c=Symbol.for("dropdownTrigger"),f=Symbol.for("dropdownAction");function v(){return e.inject(d)}function p(t,o,n){return e.computed((()=>{const l={[t]:!0},r="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return r&&Array.isArray(r)&&r.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{l[`${t}--${o}`]=e.unref(n.value[o])})),l}))}const m=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},n),setup(o){const n=o,l=e.computed((()=>"string"==typeof n.rotate?parseFloat(n.rotate):n.rotate)),r=e.ref(!0),i=v(),{modifiers:a}=e.toRefs(n),u=p("vv-icon",a),d=e.computed((()=>n.provider||(null==i?void 0:i.iconsProvider))),s=e.computed((()=>{const e=n.name??"",o=`@${d.value}:${n.prefix}:${e}`;if(t.iconExists(o))return o;const l=null==i?void 0:i.iconsCollections.find((o=>{const n=`@${d.value}:${o.prefix}:${e}`;return t.iconExists(n)}));return l?`@${d.value}:${l.prefix}:${e}`:e}));function c(e){const o=function(e){let t;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),l=(null==o?void 0:o.innerHTML.trim())||"";o&&l&&t.addIcon(`@${d.value}:${n.prefix}:${n.name}`,{body:l,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&n.src&&!t.iconExists(`@${d.value}:${n.prefix}:${n.name}`)&&(r.value=!1,i.fetchIcon(n.src).then((e=>{e&&(c(e),r.value=!0)})).catch((e=>{throw new Error(`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:e.unref(l),color:o.color,onLoad:o.onLoad,icon:e.unref(s)}),null,16,["class"])):e.createCommentVNode("v-if",!0)}}),g={to:{type:[String,Object]},href:String,target:{type:String,default:void 0,validator:e=>Object.values(u).includes(e)},rel:{type:String,default:"noopener noreferrer"}},b={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},y={disabled:{type:Boolean,default:!1}},h={active:{type:Boolean,default:!1}},k={current:{type:Boolean,default:!1}},B={pressed:{type:Boolean,default:!1}},S={label:{type:[String,Number],default:void 0}},$={modifiers:{type:[String,Array],default:void 0}},x={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},w={unselectable:{type:Boolean,default:!0}},L={id:[String,Number]};l.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const A={...y,...S,...B,...h,...k,...g,type:{type:String,default:i.button,validator:e=>Object.values(i).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:a.button}},V=A;const _=e.defineComponent({name:"VvAction",props:V,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:n}){const l=t,r=n,i=v(),u=e.ref(null);o({$el:u});const{reference:d,bus:s,aria:p,expanded:m}=e.inject(c,{});e.watch((()=>u.value),(e=>{d&&(d.value=e)}));const g=e.computed((()=>l.pressed||(null==m?void 0:m.value))),{role:b}=e.inject(f,{}),y=e.computed((()=>{switch(!0){case l.disabled:return a.button;case void 0!==l.to:return(null==i?void 0:i.nuxt)?a.nuxtLink:a.routerLink;case void 0!==l.href:return a.a;default:return l.defaultTag}})),h=e.computed((()=>{const e={...null==p?void 0:p.value,ariaPressed:!!g.value||void 0,ariaLabel:l.ariaLabel,role:null==b?void 0:b.value};switch(y.value){case a.a:return{...e,href:l.href,target:l.target,rel:l.rel};case a.routerLink:case a.nuxtLink:return{...e,to:l.to,target:l.target};case a.button:return{...e,type:l.type,disabled:l.disabled};default:return e}})),k=e=>{l.disabled?e.preventDefault():(null==s||s.emit("click",e),r("click",e))},B=e=>{null==s||s.emit("mouseover",e),r("mouseover",e)},S=e=>{null==s||s.emit("mouseleave",e),r("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps(e.unref(h),{ref_key:"element",ref:u,class:{active:t.active,pressed:e.unref(g),disabled:t.disabled,current:t.current},onClickPassive:k,onMouseoverPassive:B,onMouseleavePassive:S}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});const j={...A,...L,...$,...w,...b,...x,iconPosition:{type:String,default:l.left,validator:e=>Object.values(l).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};function I(t,o){const{group:n,isInGroup:l,getGroupOrLocalRef:r}=function(t){const o=e.inject(t,void 0),n=e.computed((()=>void 0!==o));return{group:o,isInGroup:n,getGroupOrLocalRef:function(t,n,l){const r=null==o?void 0:o[t];if(r)return e.computed({get:()=>r.value,set(e){r.value=e}});const i=e.toRef(n,t);return e.computed({get:()=>i.value,set(e){l&&l(`update:${t}`,e)}})}}}(s),{id:i,iconPosition:a,icon:u,label:d,pressed:c}=e.toRefs(t),f=r("modelValue",t,o),v=r("toggle",t),p=r("unselectable",t),m=e.computed((()=>(null==n?void 0:n.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,o=null==n?void 0:n.modifiers.value;const l=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>l.add(e)))),o&&(Array.isArray(o)||(o=o.split(" ")),o.forEach((e=>l.add(e)))),Array.from(l)})),b=e.computed((()=>Boolean(t.disabled||(null==n?void 0:n.disabled.value))));return{group:n,isInGroup:l,modelValue:f,toggle:v,unselectable:p,multiple:m,modifiers:g,disabled:b,id:i,pressed:c,iconPosition:a,icon:u,label:d}}function O(e,t,o){return o?C(e,o)===C(t,o):P(e,t)}function P(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 l,r,i;if(o&&n){if(r=e.length,r!=t.length)return!1;for(l=r;0!=l--;)if(!P(e[l],t[l]))return!1;return!0}if(o!=n)return!1;const a=e instanceof Date,u=t instanceof Date;if(a!=u)return!1;if(a&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!=s)return!1;if(d&&s)return e.toString()==t.toString();const c=Object.keys(e);if(r=c.length,r!==Object.keys(t).length)return!1;for(l=r;0!=l--;)if(!Object.prototype.hasOwnProperty.call(t,c[l]))return!1;for(l=r;0!=l--;)if(i=c[l],!P(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function C(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,l=o.length;t<l;++t){if(null==e)return null;n=n[o[t]]}return n}}return null}function E(e,t){if(null!=e&&t&&t.length)for(const o of t)if(O(e,o))return!0;return!1}const N={key:1,class:"vv-button__label"},D={key:1,class:"vv-button__label"};return e.defineComponent({name:"VvButton",props:j,emits:["update:modelValue"],setup(t,{expose:n,emit:i}){const a=t,u=e.useAttrs(),d=e.useSlots(),s=i,{id:c,modifiers:f,iconPosition:v,icon:g,label:b,modelValue:y,disabled:h,toggle:k,unselectable:B}=I(a,s),S=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.uid()))))(c),$=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 w=e.computed((()=>k.value?Array.isArray(y.value)?E($.value,y.value):O($.value,y.value):a.pressed)),L=p("vv-button",f,e.computed((()=>({reverse:[l.right,l.bottom].includes(v.value),column:[l.top,l.bottom].includes(v.value),"icon-only":Boolean((null==g?void 0:g.value)&&!(null==b?void 0:b.value)&&!d.default)})))),{hasIcon:A}=function(t,o){const n=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),i=e.computed((()=>(null==o?void 0:o.value)===r.before?n.value:void 0)),a=e.computed((()=>(null==o?void 0:o.value)===r.after?n.value:void 0)),u=e.computed((()=>(null==o?void 0:o.value)===l.left?n.value:void 0)),d=e.computed((()=>(null==o?void 0:o.value)===l.right?n.value:void 0)),s=e.computed((()=>(null==o?void 0:o.value)===l.top?n.value:void 0)),c=e.computed((()=>(null==o?void 0:o.value)===l.bottom?n.value:void 0));return{hasIcon:n,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:c,hasIconBefore:i,hasIconAfter:a}}(g),V=e.computed((()=>void 0!==a.value?a.value:$.value)),j=()=>{if(k.value){if(Array.isArray(y.value))return E(V.value,y.value)?void(B.value&&(y.value=y.value.filter((e=>e!==V.value)))):void y.value.push(V.value);if(V.value===y.value&&B.value)return void(y.value=a.uncheckedValue);y.value=V.value}};return(t,o)=>(e.openBlock(),e.createBlock(_,e.mergeProps({disabled:e.unref(h),pressed:e.unref(w),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(S),ref_key:"element",ref:x,class:e.unref(L),onClick:j}),{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("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",N,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(A)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0},e.unref(A),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(b)?(e.openBlock(),e.createElementBlock("span",D,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(b)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}})}));
@@ -1,7 +1,7 @@
1
1
  import { Side } from '../../constants';
2
2
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
3
3
  iconPosition: {
4
- type: globalThis.PropType<"left" | "right" | "top" | "bottom">;
4
+ type: globalThis.PropType<"top" | "right" | "bottom" | "left">;
5
5
  default: Side;
6
6
  validator: (value: Side) => boolean;
7
7
  };
@@ -102,7 +102,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
102
102
  [x: string]: (...args: any[]) => void;
103
103
  }, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<{
104
104
  iconPosition: {
105
- type: globalThis.PropType<"left" | "right" | "top" | "bottom">;
105
+ type: globalThis.PropType<"top" | "right" | "bottom" | "left">;
106
106
  default: Side;
107
107
  validator: (value: Side) => boolean;
108
108
  };
@@ -198,13 +198,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
198
198
  default: boolean;
199
199
  };
200
200
  }>>, {
201
- disabled: boolean;
202
- modelValue: string | number | boolean;
203
201
  toggle: boolean;
204
- unselectable: boolean;
205
- modifiers: string | string[];
206
202
  label: string | number;
207
203
  value: string | number | boolean;
204
+ disabled: boolean;
205
+ modelValue: string | number | boolean;
206
+ modifiers: string | string[];
208
207
  type: "button" | "submit" | "reset";
209
208
  target: "_blank" | "_self" | "_parent" | "_top";
210
209
  ariaLabel: string;
@@ -214,11 +213,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
214
213
  active: boolean;
215
214
  pressed: boolean;
216
215
  icon: string | import("../VvIcon").VvIconProps;
217
- iconPosition: "left" | "right" | "top" | "bottom";
216
+ iconPosition: "top" | "right" | "bottom" | "left";
218
217
  loadingIcon: string;
219
218
  uncheckedValue: string | number | boolean;
220
219
  loading: boolean;
221
220
  loadingLabel: string;
221
+ unselectable: boolean;
222
222
  }, {}>, {
223
223
  default?(_: {}): any;
224
224
  loading?(_: {}): any;
@@ -1,4 +1,4 @@
1
- import type { Ref, PropType, ExtractPropTypes } from 'vue';
1
+ import type { PropType, ExtractPropTypes } from 'vue';
2
2
  import type { ButtonGroupState } from '../../types/group';
3
3
  import { Side } from '../../constants';
4
4
  export declare const VvButtonEvents: string[];
@@ -7,7 +7,7 @@ export declare const VvButtonProps: {
7
7
  * Button icon position
8
8
  */
9
9
  iconPosition: {
10
- type: PropType<"left" | "right" | "top" | "bottom">;
10
+ type: PropType<"top" | "right" | "bottom" | "left">;
11
11
  default: Side;
12
12
  validator: (value: Side) => boolean;
13
13
  };
@@ -119,17 +119,17 @@ export type VvButtonPropsTypes = ExtractPropTypes<typeof VvButtonProps>;
119
119
  * Merges local and group props
120
120
  */
121
121
  export declare function useGroupProps(props: VvButtonPropsTypes, emit: (event: (typeof VvButtonEvents)[number], value: unknown) => void): {
122
- group: Ref<ButtonGroupState> | undefined;
122
+ group: ButtonGroupState | undefined;
123
123
  isInGroup: globalThis.ComputedRef<boolean>;
124
- modelValue: Ref<string | number | boolean | (string | number | boolean)[] | undefined>;
125
- toggle: Ref<boolean>;
126
- unselectable: Ref<boolean>;
124
+ modelValue: globalThis.Ref<string | number | boolean | (string | number | boolean)[] | undefined>;
125
+ toggle: globalThis.Ref<boolean>;
126
+ unselectable: globalThis.Ref<boolean>;
127
127
  multiple: globalThis.ComputedRef<boolean>;
128
128
  modifiers: globalThis.ComputedRef<string[]>;
129
129
  disabled: globalThis.ComputedRef<boolean>;
130
- id: Ref<string | number | undefined> | undefined;
131
- pressed: Ref<boolean>;
132
- iconPosition: Ref<"left" | "right" | "top" | "bottom">;
133
- icon: Ref<string | import("../VvIcon").VvIconProps | undefined> | undefined;
134
- label: Ref<string | number | undefined> | undefined;
130
+ id: globalThis.Ref<string | number | undefined> | undefined;
131
+ pressed: globalThis.Ref<boolean>;
132
+ iconPosition: globalThis.Ref<"top" | "right" | "bottom" | "left">;
133
+ icon: globalThis.Ref<string | import("../VvIcon").VvIconProps | undefined> | undefined;
134
+ label: globalThis.Ref<string | number | undefined> | undefined;
135
135
  };
@@ -1,4 +1,4 @@
1
- import { isRef, provide, computed, unref, defineComponent, toRefs, watchEffect, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
1
+ import { provide, computed, unref, defineComponent, toRefs, watchEffect, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
2
2
  var Strategy = /* @__PURE__ */ ((Strategy2) => {
3
3
  Strategy2["absolute"] = "absolute";
4
4
  Strategy2["fixed"] = "fixed";
@@ -47,7 +47,9 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
47
47
  AnchorTarget2["_top"] = "_top";
48
48
  return AnchorTarget2;
49
49
  })(AnchorTarget || {});
50
- const INJECTION_KEY_BUTTON_GROUP = Symbol.for("buttonGroup");
50
+ const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
51
+ "buttonGroup"
52
+ );
51
53
  const LinkProps = {
52
54
  /**
53
55
  * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
@@ -297,15 +299,8 @@ const VvButtonGroupProps = {
297
299
  }
298
300
  };
299
301
  const VvButtonGroupEvents = ["update:modelValue"];
300
- function useProvideGroupState(groupState) {
301
- if (Object.keys(groupState).some(
302
- (k) => k !== "key" && !isRef(groupState[k])
303
- ))
304
- throw Error("One or more groupState props aren't ref.");
305
- provide(
306
- groupState.key,
307
- computed(() => groupState)
308
- );
302
+ function useProvideGroupState(key, groupState) {
303
+ provide(key, groupState);
309
304
  }
310
305
  function useModifiers(prefix, modifiers, others) {
311
306
  return computed(() => {
@@ -369,8 +364,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
369
364
  return emit("update:modelValue", newValue);
370
365
  }
371
366
  });
372
- useProvideGroupState({
373
- key: INJECTION_KEY_BUTTON_GROUP,
367
+ useProvideGroupState(INJECTION_KEY_BUTTON_GROUP, {
374
368
  modelValue,
375
369
  disabled,
376
370
  toggle,
@@ -1 +1 @@
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||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("buttonGroup"),n={disabled:{type:Boolean,default:!1}},a=(Boolean,Boolean,Boolean,{modifiers:{type:[String,Array],default:void 0}});t.before;const i={unselectable:{type:Boolean,default:!0}};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,l.button,r.button;const s={...a,...n,...i,itemModifiers:{type:[String,Array],default:""},toggle:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},modelValue:{type:[String,Number,Boolean,Array],default:void 0}};return e.defineComponent({name:"VvButtonGroup",props:s,emits:["update:modelValue"],setup(o,{emit:t}){const l=t,r=o,{disabled:n,toggle:a,modifiers:i,multiple:s,unselectable:d,itemModifiers:f}=e.toRefs(r);e.watchEffect((()=>{"string"==typeof r.modelValue&&s.value&&console.warn("[VvButtonGroup]: modelValue is a string but multiple is true.")}));const p=e.computed({get:()=>s.value?r.modelValue:Array.isArray(r.modelValue)?r.modelValue[0]:r.modelValue,set:e=>void 0===e||!Array.isArray(r.modelValue)&&!s.value||Array.isArray(e)?l("update:modelValue",e):l("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:u,modelValue:p,disabled:n,toggle:a,multiple:s,unselectable:d,modifiers:f});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",i);return(o,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(m)),role:"group"},[e.renderSlot(o.$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||{}),u=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(u||{});const a=Symbol.for("buttonGroup"),n={disabled:{type:Boolean,default:!1}},r=(Boolean,Boolean,Boolean,{modifiers:{type:[String,Array],default:void 0}});t.before;const i={unselectable:{type:Boolean,default:!0}};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,l.button,u.button;const d={...r,...n,...i,itemModifiers:{type:[String,Array],default:""},toggle:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},modelValue:{type:[String,Number,Boolean,Array],default:void 0}};return e.defineComponent({name:"VvButtonGroup",props:d,emits:["update:modelValue"],setup(o,{emit:t}){const l=t,u=o,{disabled:n,toggle:r,modifiers:i,multiple:d,unselectable:s,itemModifiers:f}=e.toRefs(u);e.watchEffect((()=>{"string"==typeof u.modelValue&&d.value&&console.warn("[VvButtonGroup]: modelValue is a string but multiple is true.")}));const m=e.computed({get:()=>d.value?u.modelValue:Array.isArray(u.modelValue)?u.modelValue[0]:u.modelValue,set:e=>void 0===e||!Array.isArray(u.modelValue)&&!d.value||Array.isArray(e)?l("update:modelValue",e):l("update:modelValue",[e])});var p,b;p=a,b={modelValue:m,disabled:n,toggle:r,multiple:d,unselectable:s,modifiers:f},e.provide(p,b);const c=function(o,t,l){return e.computed((()=>{const u={[o]:!0},a="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(u[`${o}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((t=>{u[`${o}--${t}`]=e.unref(l.value[t])})),u}))}("vv-button-group",i);return(o,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(c)),role:"group"},[e.renderSlot(o.$slots,"default")],2))}})}));
@@ -59,13 +59,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
59
59
  default: undefined;
60
60
  };
61
61
  }>>, {
62
+ toggle: boolean;
62
63
  disabled: boolean;
63
64
  modelValue: string | number | boolean | (string | number | boolean)[] | undefined;
64
- toggle: boolean;
65
- multiple: boolean;
66
- unselectable: boolean;
67
65
  modifiers: string | string[];
68
66
  itemModifiers: string | string[];
67
+ unselectable: boolean;
68
+ multiple: boolean;
69
69
  }, {}>, {
70
70
  default?(_: {}): any;
71
71
  }>;