@volverjs/ui-vue 0.0.10-beta.22 → 0.0.10-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VvAccordion/VvAccordion.es.js +119 -79
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +18 -4
- package/dist/components/VvAccordion/index.d.ts +4 -8
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +250 -119
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +18 -6
- package/dist/components/VvAccordionGroup/index.d.ts +3 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +92 -98
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +7 -7
- package/dist/components/VvButton/index.d.ts +11 -11
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -3
- package/dist/components/VvCheckbox/VvCheckbox.es.js +81 -87
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
- package/dist/components/VvCheckbox/index.d.ts +2 -2
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -29
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +5 -5
- package/dist/components/VvCombobox/VvCombobox.es.js +13 -16
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +11 -11
- package/dist/components/VvCombobox/index.d.ts +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +5 -5
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +1 -1
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +1 -1
- package/dist/components/VvDropdown/index.d.ts +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +199 -169
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +55 -9
- package/dist/components/VvInputFile/index.d.ts +24 -3
- package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
- package/dist/components/VvProgress/VvProgress.vue.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +64 -70
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -29
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +5 -5
- package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +5 -5
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +3 -3
- package/dist/components/VvTooltip/index.d.ts +1 -1
- package/dist/components/index.es.js +478 -324
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useInjectAlert.d.ts +1 -6
- package/dist/composables/group/useInjectedGroupState.d.ts +4 -5
- package/dist/composables/group/useProvideGroupState.d.ts +3 -3
- package/dist/constants.d.ts +6 -10
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +3 -2
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +1 -1
- package/dist/resolvers/unplugin.es.js +3 -2
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +38 -14
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +259 -101
- package/dist/types/group.d.ts +37 -15
- package/package.json +37 -36
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +119 -56
- package/src/components/VvAccordion/index.ts +8 -23
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +140 -41
- package/src/components/VvAccordionGroup/index.ts +3 -1
- package/src/components/VvButton/index.ts +7 -12
- package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -2
- package/src/components/VvCheckbox/index.ts +2 -2
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +1 -2
- package/src/components/VvInputFile/VvInputFile.vue +72 -47
- package/src/components/VvInputFile/index.ts +22 -3
- package/src/components/VvRadio/index.ts +5 -5
- package/src/components/VvRadioGroup/VvRadioGroup.vue +1 -2
- package/src/composables/group/useInjectedGroupState.ts +20 -16
- package/src/composables/group/useProvideGroupState.ts +10 -15
- package/src/constants.ts +19 -14
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +15 -9
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +1 -1
- package/src/types/group.ts +22 -14
|
@@ -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(
|
|
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(() =>
|
|
588
|
+
const isInGroup = computed(() => group !== void 0);
|
|
669
589
|
function getGroupOrLocalRef(propName, props, emit) {
|
|
670
|
-
|
|
671
|
-
|
|
590
|
+
const groupPropValue = group == null ? void 0 : group[propName];
|
|
591
|
+
if (groupPropValue) {
|
|
672
592
|
return computed({
|
|
673
593
|
get() {
|
|
674
|
-
return groupPropValue
|
|
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
|
-
|
|
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.
|
|
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<"
|
|
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<"
|
|
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: "
|
|
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 {
|
|
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<"
|
|
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:
|
|
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<"
|
|
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 {
|
|
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(
|
|
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
|
-
|
|
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||{}),
|
|
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
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inject, computed, toRef, toRefs, isRef, defineComponent, h, unref, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps } from "vue";
|
|
2
2
|
import { uid } from "uid";
|
|
3
3
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
4
4
|
Strategy2["absolute"] = "absolute";
|
|
@@ -49,7 +49,9 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
49
49
|
return AnchorTarget2;
|
|
50
50
|
})(AnchorTarget || {});
|
|
51
51
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
52
|
-
const INJECTION_KEY_CHECK_GROUP = Symbol.for(
|
|
52
|
+
const INJECTION_KEY_CHECK_GROUP = Symbol.for(
|
|
53
|
+
"checkGroup"
|
|
54
|
+
);
|
|
53
55
|
const LinkProps = {
|
|
54
56
|
/**
|
|
55
57
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
@@ -375,6 +377,83 @@ const CheckboxRadioProps = {
|
|
|
375
377
|
default: ActionTag.button
|
|
376
378
|
}
|
|
377
379
|
});
|
|
380
|
+
function useInjectedGroupState(groupKey) {
|
|
381
|
+
const group = inject(groupKey, void 0);
|
|
382
|
+
const isInGroup = computed(() => group !== void 0);
|
|
383
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
384
|
+
const groupPropValue = group == null ? void 0 : group[propName];
|
|
385
|
+
if (groupPropValue) {
|
|
386
|
+
return computed({
|
|
387
|
+
get() {
|
|
388
|
+
return groupPropValue.value;
|
|
389
|
+
},
|
|
390
|
+
set(value) {
|
|
391
|
+
groupPropValue.value = value;
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
const propRef = toRef(props, propName);
|
|
396
|
+
return computed({
|
|
397
|
+
get() {
|
|
398
|
+
return propRef.value;
|
|
399
|
+
},
|
|
400
|
+
set(value) {
|
|
401
|
+
if (emit) {
|
|
402
|
+
emit(`update:${propName}`, value);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
group,
|
|
409
|
+
isInGroup,
|
|
410
|
+
getGroupOrLocalRef
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
const VvCheckboxProps = {
|
|
414
|
+
...CheckboxRadioProps,
|
|
415
|
+
...ModifiersProps,
|
|
416
|
+
/**
|
|
417
|
+
* If true, the input will be indeterminated
|
|
418
|
+
*/
|
|
419
|
+
indeterminate: Boolean,
|
|
420
|
+
/**
|
|
421
|
+
* Value associated with the unchecked state
|
|
422
|
+
*/
|
|
423
|
+
uncheckedValue: [String, Number, Boolean],
|
|
424
|
+
/**
|
|
425
|
+
* If true, the input will be displayed as a switch
|
|
426
|
+
*/
|
|
427
|
+
switch: Boolean
|
|
428
|
+
};
|
|
429
|
+
const VvCheckboxEvents = ["click", "update:modelValue", "change", "blur"];
|
|
430
|
+
function useGroupProps(props, emit) {
|
|
431
|
+
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_CHECK_GROUP);
|
|
432
|
+
const { id, switch: propsSwitch, indeterminate } = toRefs(props);
|
|
433
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
434
|
+
const valid = getGroupOrLocalRef("valid", props);
|
|
435
|
+
const invalid = getGroupOrLocalRef("invalid", props);
|
|
436
|
+
const readonly = computed(
|
|
437
|
+
() => Boolean(props.readonly || (group == null ? void 0 : group.readonly.value))
|
|
438
|
+
);
|
|
439
|
+
const disabled = computed(
|
|
440
|
+
() => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
|
|
441
|
+
);
|
|
442
|
+
return {
|
|
443
|
+
// local props
|
|
444
|
+
id,
|
|
445
|
+
propsSwitch,
|
|
446
|
+
indeterminate,
|
|
447
|
+
// global props
|
|
448
|
+
group,
|
|
449
|
+
isInGroup,
|
|
450
|
+
modelValue,
|
|
451
|
+
valid,
|
|
452
|
+
invalid,
|
|
453
|
+
readonly,
|
|
454
|
+
disabled
|
|
455
|
+
};
|
|
456
|
+
}
|
|
378
457
|
function equals(obj1, obj2, field) {
|
|
379
458
|
if (field) {
|
|
380
459
|
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
@@ -454,94 +533,9 @@ function contains(value, list) {
|
|
|
454
533
|
}
|
|
455
534
|
return false;
|
|
456
535
|
}
|
|
457
|
-
function isEmpty(value) {
|
|
458
|
-
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));
|
|
459
|
-
}
|
|
460
536
|
function isString(value) {
|
|
461
537
|
return typeof value === "string" || value instanceof String;
|
|
462
538
|
}
|
|
463
|
-
function useInjectedGroupState(groupKey) {
|
|
464
|
-
const group = inject(groupKey, void 0);
|
|
465
|
-
const isInGroup = computed(() => !isEmpty(group));
|
|
466
|
-
function getGroupOrLocalRef(propName, props, emit) {
|
|
467
|
-
if (group == null ? void 0 : group.value) {
|
|
468
|
-
const groupPropValue = unref(group.value)[propName];
|
|
469
|
-
return computed({
|
|
470
|
-
get() {
|
|
471
|
-
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
472
|
-
},
|
|
473
|
-
set(value) {
|
|
474
|
-
groupPropValue.value = value;
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
const propRef = toRef(props, propName);
|
|
479
|
-
return computed({
|
|
480
|
-
get() {
|
|
481
|
-
return propRef.value;
|
|
482
|
-
},
|
|
483
|
-
set(value) {
|
|
484
|
-
if (emit)
|
|
485
|
-
emit(`update:${propName}`, value);
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
return {
|
|
490
|
-
group,
|
|
491
|
-
isInGroup,
|
|
492
|
-
getGroupOrLocalRef
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
const VvCheckboxProps = {
|
|
496
|
-
...CheckboxRadioProps,
|
|
497
|
-
...ModifiersProps,
|
|
498
|
-
/**
|
|
499
|
-
* If true, the input will be indeterminated
|
|
500
|
-
*/
|
|
501
|
-
indeterminate: Boolean,
|
|
502
|
-
/**
|
|
503
|
-
* Value associated with the unchecked state
|
|
504
|
-
*/
|
|
505
|
-
uncheckedValue: [String, Number, Boolean],
|
|
506
|
-
/**
|
|
507
|
-
* If true, the input will be displayed as a switch
|
|
508
|
-
*/
|
|
509
|
-
switch: Boolean
|
|
510
|
-
};
|
|
511
|
-
const VvCheckboxEvents = ["click", "update:modelValue", "change", "blur"];
|
|
512
|
-
function useGroupProps(props, emit) {
|
|
513
|
-
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_CHECK_GROUP);
|
|
514
|
-
const { id, switch: propsSwitch, indeterminate } = toRefs(props);
|
|
515
|
-
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
516
|
-
const valid = getGroupOrLocalRef("valid", props);
|
|
517
|
-
const invalid = getGroupOrLocalRef("invalid", props);
|
|
518
|
-
const readonly = computed(
|
|
519
|
-
() => {
|
|
520
|
-
var _a;
|
|
521
|
-
return Boolean(props.readonly || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.readonly.value));
|
|
522
|
-
}
|
|
523
|
-
);
|
|
524
|
-
const disabled = computed(
|
|
525
|
-
() => {
|
|
526
|
-
var _a;
|
|
527
|
-
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
528
|
-
}
|
|
529
|
-
);
|
|
530
|
-
return {
|
|
531
|
-
// local props
|
|
532
|
-
id,
|
|
533
|
-
propsSwitch,
|
|
534
|
-
indeterminate,
|
|
535
|
-
// global props
|
|
536
|
-
group,
|
|
537
|
-
isInGroup,
|
|
538
|
-
modelValue,
|
|
539
|
-
valid,
|
|
540
|
-
invalid,
|
|
541
|
-
readonly,
|
|
542
|
-
disabled
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
539
|
function joinLines(items) {
|
|
546
540
|
if (Array.isArray(items)) {
|
|
547
541
|
return items.filter((item) => isString(item)).join(" ");
|