@volverjs/ui-vue 0.0.9 → 0.0.10-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -1
- package/auto-imports.d.ts +1 -1
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +34 -19
- package/dist/components/VvAccordion/VvAccordion.es.js +33 -4
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -4
- package/dist/components/VvAccordion/index.d.ts +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +75 -27
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +5 -5
- package/dist/components/VvAction/VvAction.es.js +26 -4
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +17 -4
- package/dist/components/VvAction/index.d.ts +5 -0
- package/dist/components/VvAlert/VvAlert.es.js +96 -45
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +4 -4
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +136 -66
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +4 -4
- package/dist/components/VvAvatar/VvAvatar.es.js +22 -1
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +79 -28
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +39 -8
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +224 -41
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +14 -3
- package/dist/components/VvBreadcrumb/index.d.ts +2 -9
- package/dist/components/VvButton/VvButton.es.js +70 -25
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +25 -9
- package/dist/components/VvButton/index.d.ts +5 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +33 -6
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +6 -6
- package/dist/components/VvCard/VvCard.es.js +47 -16
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +35 -7
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +8 -8
- package/dist/components/VvCheckbox/index.d.ts +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +106 -51
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
- package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +635 -400
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +112 -112
- package/dist/components/VvCombobox/index.d.ts +32 -32
- package/dist/components/VvDialog/VvDialog.es.js +65 -27
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -4
- package/dist/components/VvDropdown/VvDropdown.es.js +87 -46
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +203 -189
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +12 -0
- package/dist/components/VvDropdown/index.d.ts +32 -32
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +46 -12
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +13 -7
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +28 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +40 -8
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +1 -1
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +149 -99
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +10 -10
- package/dist/components/VvInputText/index.d.ts +8 -2
- package/dist/components/VvNav/VvNav.es.js +115 -63
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +31 -12
- package/dist/components/VvNav/VvNavItem.vue.d.ts +9 -0
- package/dist/components/VvNav/index.d.ts +1 -12
- package/dist/components/VvNavItem/VvNavItem.es.js +413 -0
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.es.js +24 -0
- package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -0
- package/dist/components/VvProgress/VvProgress.es.js +33 -6
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +35 -7
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +8 -8
- package/dist/components/VvRadio/index.d.ts +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +106 -51
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
- package/dist/components/VvRadioGroup/index.d.ts +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +159 -99
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
- package/dist/components/VvSelect/index.d.ts +1 -1
- package/dist/components/VvTab/VvTab.es.js +214 -99
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +40 -11
- package/dist/components/VvTab/index.d.ts +9 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +123 -77
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
- package/dist/components/VvTooltip/VvTooltip.es.js +40 -9
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +1593 -1012
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/directives/index.d.ts +3 -5
- package/dist/directives/index.es.js +60 -23
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +58 -18
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +19 -16
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +58 -34
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +50 -15
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +332 -83
- package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
- package/dist/stories/Combobox/ComboboxOptions.stories.d.ts +1 -0
- package/dist/stories/InputText/InputTextMask.stories.d.ts +1 -1
- package/dist/stories/Tab/Tab.settings.d.ts +4 -37
- package/dist/types/alert.d.ts +13 -0
- package/dist/types/floating-ui.d.ts +6 -0
- package/dist/types/generic.d.ts +4 -0
- package/dist/types/group.d.ts +37 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/nav.d.ts +17 -0
- package/package.json +61 -52
- package/src/Volver.ts +22 -16
- 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 +2 -2
- package/src/components/VvAction/VvAction.vue +5 -2
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +20 -19
- package/src/components/VvBreadcrumb/index.ts +2 -8
- package/src/components/VvCombobox/VvCombobox.vue +32 -33
- package/src/components/VvCombobox/index.ts +4 -0
- package/src/components/VvInputText/VvInputText.vue +2 -2
- package/src/components/VvNav/VvNav.vue +30 -50
- package/src/components/VvNav/VvNavItem.vue +18 -0
- package/src/components/VvNav/VvNavSeparator.vue +11 -0
- package/src/components/VvNav/index.ts +2 -15
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvTab/VvTab.vue +63 -35
- package/src/components/VvTab/index.ts +10 -4
- package/src/components/VvTextarea/VvTextarea.vue +1 -1
- package/src/composables/useOptions.ts +2 -2
- package/src/composables/useUniqueId.ts +2 -2
- package/src/directives/index.ts +1 -4
- package/src/directives/v-tooltip.ts +19 -10
- package/src/index.ts +3 -1
- package/src/props/index.ts +27 -3
- package/src/stories/Button/ButtonModifiers.stories.ts +4 -14
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Combobox/ComboboxOptions.stories.ts +18 -0
- package/src/stories/InputText/InputTextMask.stories.ts +1 -1
- package/src/stories/Nav/Nav.settings.ts +3 -4
- package/src/stories/Nav/Nav.test.ts +4 -15
- package/src/stories/Tab/Tab.settings.ts +9 -9
- package/src/stories/Tab/Tab.stories.ts +2 -2
- package/src/stories/Tab/Tab.test.ts +6 -14
- package/src/stories/argTypes.ts +1 -1
- package/src/types/generic.ts +6 -0
- package/src/types/index.ts +5 -0
- package/src/types/nav.ts +19 -0
- package/src/utils/ObjectUtilities.ts +3 -2
- package/dist/components/VvNav/VvNavItemTitle.vue.d.ts +0 -6
- package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +0 -19
- package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +0 -1
- package/src/components/VvNav/VvNavItemTitle.vue +0 -11
- package/src/components/VvNav/VvNavSeparator.ts +0 -8
- package/src/types/generic.d.ts +0 -6
- /package/dist/components/VvNav/{VvNavSeparator.d.ts → VvNavSeparator.vue.d.ts} +0 -0
- /package/src/types/{alert.d.ts → alert.ts} +0 -0
- /package/src/types/{floating-ui.d.ts → floating-ui.ts} +0 -0
- /package/src/types/{group.d.ts → group.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unref, computed, isRef, defineComponent, h, inject, toRef, toRefs, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps, provide, createCommentVNode, Fragment, renderList, createBlock, mergeProps } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { uid } from "uid";
|
|
3
3
|
import { useVModel } from "@vueuse/core";
|
|
4
4
|
import { get } from "ts-dot-prop";
|
|
5
5
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
@@ -36,6 +36,13 @@ var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
|
36
36
|
ButtonType2["reset"] = "reset";
|
|
37
37
|
return ButtonType2;
|
|
38
38
|
})(ButtonType || {});
|
|
39
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
40
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
41
|
+
ActionTag2["routerLink"] = "router-link";
|
|
42
|
+
ActionTag2["a"] = "a";
|
|
43
|
+
ActionTag2["button"] = "button";
|
|
44
|
+
return ActionTag2;
|
|
45
|
+
})(ActionTag || {});
|
|
39
46
|
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
40
47
|
AnchorTarget2["_blank"] = "_blank";
|
|
41
48
|
AnchorTarget2["_self"] = "_self";
|
|
@@ -46,10 +53,10 @@ var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
|
46
53
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
47
54
|
const INJECTION_KEY_CHECK_GROUP = Symbol.for("checkGroup");
|
|
48
55
|
function equals(obj1, obj2, field) {
|
|
49
|
-
if (field)
|
|
56
|
+
if (field) {
|
|
50
57
|
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
}
|
|
59
|
+
return deepEquals(obj1, obj2);
|
|
53
60
|
}
|
|
54
61
|
function deepEquals(a, b) {
|
|
55
62
|
if (a === b)
|
|
@@ -320,6 +327,12 @@ const ActiveProps = {
|
|
|
320
327
|
*/
|
|
321
328
|
active: Boolean
|
|
322
329
|
};
|
|
330
|
+
const CurrentProps = {
|
|
331
|
+
/**
|
|
332
|
+
* Whether the item is current
|
|
333
|
+
*/
|
|
334
|
+
current: Boolean
|
|
335
|
+
};
|
|
323
336
|
const PressedProps = {
|
|
324
337
|
/**
|
|
325
338
|
* Whether the item is pressed
|
|
@@ -547,6 +560,7 @@ const CheckboxRadioGroupProps = {
|
|
|
547
560
|
...LabelProps,
|
|
548
561
|
...PressedProps,
|
|
549
562
|
...ActiveProps,
|
|
563
|
+
...CurrentProps,
|
|
550
564
|
...LinkProps,
|
|
551
565
|
/**
|
|
552
566
|
* Button type
|
|
@@ -562,6 +576,13 @@ const CheckboxRadioGroupProps = {
|
|
|
562
576
|
ariaLabel: {
|
|
563
577
|
type: String,
|
|
564
578
|
default: void 0
|
|
579
|
+
},
|
|
580
|
+
/**
|
|
581
|
+
* Default tag for the action
|
|
582
|
+
*/
|
|
583
|
+
defaultTag: {
|
|
584
|
+
type: String,
|
|
585
|
+
default: ActionTag.button
|
|
565
586
|
}
|
|
566
587
|
});
|
|
567
588
|
function useInjectedGroupState(groupKey) {
|
|
@@ -702,7 +723,7 @@ function useDefaults(componentName, propsDefinition, props) {
|
|
|
702
723
|
}, {});
|
|
703
724
|
});
|
|
704
725
|
}
|
|
705
|
-
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) ||
|
|
726
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || uid()));
|
|
706
727
|
function useModifiers(prefix, modifiers, others) {
|
|
707
728
|
return computed(() => {
|
|
708
729
|
const toReturn = {
|
|
@@ -879,12 +900,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
879
900
|
[vModelCheckbox, unref(localModelValue)]
|
|
880
901
|
]),
|
|
881
902
|
renderSlot(_ctx.$slots, "default", { value: unref(modelValue) }, () => [
|
|
882
|
-
createTextVNode(
|
|
903
|
+
createTextVNode(
|
|
904
|
+
toDisplayString(_ctx.label),
|
|
905
|
+
1
|
|
906
|
+
/* TEXT */
|
|
907
|
+
)
|
|
883
908
|
]),
|
|
884
909
|
createVNode(unref(HintSlot), {
|
|
885
910
|
id: unref(hasHintId),
|
|
886
911
|
class: "vv-checkbox__hint"
|
|
887
|
-
}, createSlots({
|
|
912
|
+
}, createSlots({
|
|
913
|
+
_: 2
|
|
914
|
+
/* DYNAMIC */
|
|
915
|
+
}, [
|
|
888
916
|
_ctx.$slots.hint ? {
|
|
889
917
|
name: "hint",
|
|
890
918
|
fn: withCtx(() => [
|
|
@@ -944,7 +972,7 @@ function useOptions(props) {
|
|
|
944
972
|
return option;
|
|
945
973
|
return typeof valueKey.value === "function" ? valueKey.value(option) : get(option, valueKey.value);
|
|
946
974
|
};
|
|
947
|
-
const
|
|
975
|
+
const isOptionDisabled = (option) => {
|
|
948
976
|
if (typeof option !== "object" && option !== null)
|
|
949
977
|
return false;
|
|
950
978
|
return typeof disabledKey.value === "function" ? disabledKey.value(option) : get(option, disabledKey.value);
|
|
@@ -958,7 +986,7 @@ function useOptions(props) {
|
|
|
958
986
|
options,
|
|
959
987
|
getOptionLabel,
|
|
960
988
|
getOptionValue,
|
|
961
|
-
|
|
989
|
+
isOptionDisabled,
|
|
962
990
|
getOptionGrouped
|
|
963
991
|
};
|
|
964
992
|
}
|
|
@@ -1011,49 +1039,76 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1011
1039
|
};
|
|
1012
1040
|
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|
|
1013
1041
|
return (_ctx, _cache) => {
|
|
1014
|
-
return openBlock(), createElementBlock(
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
key:
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1042
|
+
return openBlock(), createElementBlock(
|
|
1043
|
+
"fieldset",
|
|
1044
|
+
{
|
|
1045
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
1046
|
+
},
|
|
1047
|
+
[
|
|
1048
|
+
_ctx.label ? (openBlock(), createElementBlock("legend", {
|
|
1049
|
+
key: 0,
|
|
1050
|
+
textContent: toDisplayString(_ctx.label)
|
|
1051
|
+
}, null, 8, _hoisted_1)) : createCommentVNode("v-if", true),
|
|
1052
|
+
createElementVNode("div", _hoisted_2, [
|
|
1053
|
+
_ctx.options.length > 0 ? (openBlock(true), createElementBlock(
|
|
1054
|
+
Fragment,
|
|
1055
|
+
{ key: 0 },
|
|
1056
|
+
renderList(_ctx.options, (option, index) => {
|
|
1057
|
+
return openBlock(), createBlock(
|
|
1058
|
+
_sfc_main$1,
|
|
1059
|
+
mergeProps({ key: index }, getOptionProps(option, index)),
|
|
1060
|
+
null,
|
|
1061
|
+
16
|
|
1062
|
+
/* FULL_PROPS */
|
|
1063
|
+
);
|
|
1064
|
+
}),
|
|
1065
|
+
128
|
|
1066
|
+
/* KEYED_FRAGMENT */
|
|
1067
|
+
)) : renderSlot(_ctx.$slots, "default", { key: 1 })
|
|
1068
|
+
]),
|
|
1069
|
+
createVNode(
|
|
1070
|
+
unref(HintSlot),
|
|
1071
|
+
{ class: "vv-checkbox-group__hint" },
|
|
1072
|
+
createSlots({
|
|
1073
|
+
_: 2
|
|
1074
|
+
/* DYNAMIC */
|
|
1075
|
+
}, [
|
|
1076
|
+
_ctx.$slots.hint ? {
|
|
1077
|
+
name: "hint",
|
|
1078
|
+
fn: withCtx(() => [
|
|
1079
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1080
|
+
]),
|
|
1081
|
+
key: "0"
|
|
1082
|
+
} : void 0,
|
|
1083
|
+
_ctx.$slots.loading ? {
|
|
1084
|
+
name: "loading",
|
|
1085
|
+
fn: withCtx(() => [
|
|
1086
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1087
|
+
]),
|
|
1088
|
+
key: "1"
|
|
1089
|
+
} : void 0,
|
|
1090
|
+
_ctx.$slots.valid ? {
|
|
1091
|
+
name: "valid",
|
|
1092
|
+
fn: withCtx(() => [
|
|
1093
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1094
|
+
]),
|
|
1095
|
+
key: "2"
|
|
1096
|
+
} : void 0,
|
|
1097
|
+
_ctx.$slots.invalid ? {
|
|
1098
|
+
name: "invalid",
|
|
1099
|
+
fn: withCtx(() => [
|
|
1100
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1101
|
+
]),
|
|
1102
|
+
key: "3"
|
|
1103
|
+
} : void 0
|
|
1052
1104
|
]),
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1105
|
+
1024
|
|
1106
|
+
/* DYNAMIC_SLOTS */
|
|
1107
|
+
)
|
|
1108
|
+
],
|
|
1109
|
+
2
|
|
1110
|
+
/* CLASS */
|
|
1111
|
+
);
|
|
1057
1112
|
};
|
|
1058
1113
|
}
|
|
1059
1114
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("nanoid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","nanoid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.nanoid,e.core,e.tsDotProp)}(this,(function(e,t,l,a){"use strict";var o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const r=Symbol.for("volver"),u=Symbol.for("checkGroup");function d(e,t,l){return l?v(e,l)===v(t,l):s(e,t)}function s(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,n,i;if(l&&a){if(n=e.length,n!=t.length)return!1;for(o=n;0!=o--;)if(!s(e[o],t[o]))return!1;return!0}if(l!=a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&u)return e.getTime()==t.getTime();const d=e instanceof RegExp,v=t instanceof RegExp;if(d!=v)return!1;if(d&&v)return e.toString()==t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,c[o]))return!1;for(o=n;0!=o--;)if(i=c[o],!s(e[i],t[i]))return!1;return!0}return e!=e&&t!=t}function v(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const l=t.split(".");let a=e;for(let t=0,o=l.length;t<o;++t){if(null==e)return null;a=a[l[t]]}return a}}return null}function c(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function f(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>c(a.value.invalidLabel))),n=e.computed((()=>c(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),m=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:m}}const p={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},h={disabled:Boolean},g=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},S={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},L={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const B={tabindex:{type:[String,Number],default:0}},O={id:[String,Number]};o.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const V={...{...O,name:{type:String,required:!0}},...B,...p,...m,...k,...h,...y,...S,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},x={...p,...m,...L,...k,...h,...y,...S,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function $(t){const l=e.inject(t,void 0),a=e.computed((()=>{return t=l,!(null==(a=e.unref(t))||""===a||Array.isArray(a)&&0===a.length||!(a instanceof Date)&&"object"==typeof a&&0===Object.keys(a).length);var t,a}));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){if(null==l?void 0:l.value){const a=e.unref(l.value)[t];return e.computed({get:()=>null==a?void 0:a.value,set(e){a.value=e}})}const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}i.button;const A={...V,...S,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function C(t,l,a){const o=e.inject(r),n=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function j(t,l,a){return e.computed((()=>{const o={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const w=["for"],R=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],P=e.defineComponent({name:"VvCheckbox",props:A,emits:["click","update:modelValue","change","blur"],setup(l,{emit:a}){const o=l,n=e.useSlots(),i=C("VvCheckbox",A,o),{id:r,disabled:s,readonly:v,valid:c,invalid:p,propsSwitch:m,modelValue:b,indeterminate:h,isInGroup:g}=function(t,l){const{group:a,isInGroup:o,getGroupOrLocalRef:n}=$(u),{id:i,switch:r,indeterminate:d}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==a?void 0:a.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==a?void 0:a.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:d,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(o,a),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.nanoid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:o.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==o.uncheckedValue&&!g.value)),O=e.computed((()=>s.value||v.value)),V=e.computed((()=>!0===p.value||!0!==c.value&&void 0)),x=e.computed((()=>B.value?b.value===o.value:Array.isArray(b.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(d(e,l))return!0;return!1}(o.value,b.value):d(o.value,b.value))),P=e.computed((()=>!!h.value||!(x.value||!B.value||o.uncheckedValue===b.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof o.value)||o.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)b.value=e?o.value:o.uncheckedValue;else if(Array.isArray(b.value)||g.value){const t=new Set(Array.isArray(b.value)?b.value:void 0!==b.value?[b.value]:[]);e?t.add(o.value):t.delete(o.value),b.value=[...t]}else b.value=e?o.value:void 0;a("change",e)}}),{modifiers:_}=e.toRefs(o),z=j("vv-checkbox",_,e.computed((()=>({switch:m.value,valid:c.value,invalid:p.value,disabled:s.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(b.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>P.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{P.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=f(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(E)?E.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(O),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(V),"aria-describedby":e.unref(I)?e.unref(S):void 0,"aria-errormessage":e.unref(D)?e.unref(S):void 0},null,8,R),[[e.vModelCheckbox,e.unref(E)]]),e.renderSlot(t.$slots,"default",{value:e.unref(b)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"3"}:void 0]),1032,["id"])],10,w))}}),N=x;const E=["textContent"],_={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:N,emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,i=e.useSlots(),r=C("VvCheckboxGroup",N,n),d=l.useVModel(n,"modelValue",o),{disabled:s,readonly:v,vertical:c,valid:p,invalid:m,modifiers:b}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:u,modelValue:d,disabled:s,readonly:v,valid:p,invalid:m});const{getOptionLabel:h,getOptionValue:g}=function(t){const{options:l,labelKey:o,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof o.value?o.value(e):a.get(e,o.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):a.get(e,n.value),getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):a.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),y=j("vv-checkbox-group",b,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!c.value,valid:p.value,invalid:m.value})))),{HintSlot:S,hintSlotScope:k}=f(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,E)):e.createCommentVNode("",!0),e.createElementVNode("div",_,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(P,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:h(e),value:g(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("uid"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","uid","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=t(e.vue,e.uid,e.core,e.tsDotProp)}(this,(function(e,t,l,o){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("volver"),d=Symbol.for("checkGroup");function s(e,t,l){return l?c(e,l)===c(t,l):v(e,t)}function v(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,i;if(l&&o){if(n=e.length,n!=t.length)return!1;for(a=n;0!=a--;)if(!v(e[a],t[a]))return!1;return!0}if(l!=o)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!=u)return!1;if(r&&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(n=c.length,n!==Object.keys(t).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(t,c[a]))return!1;for(a=n;0!=a--;)if(i=c[a],!v(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 l=t.split(".");let o=e;for(let t=0,a=l.length;t<a;++t){if(null==e)return null;o=o[l[t]]}return o}}return null}function f(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}function p(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>f(o.value.invalidLabel))),n=e.computed((()=>f(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),b=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:b}}const b={valid:Boolean,validLabel:[String,Array]},m={invalid:Boolean,invalidLabel:[String,Array]},h={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},y=(Boolean,Boolean,Boolean,{label:[String,Number]}),S={readonly:Boolean},k={modifiers:[String,Array]},L={hintLabel:{type:String,default:""}},B={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const O={tabindex:{type:[String,Number],default:0}},V={id:[String,Number]};a.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const x={...{...V,name:{type:String,required:!0}},...O,...b,...m,...L,...g,...S,...k,...y,...h,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},$={...b,...m,...B,...L,...g,...S,...k,...y,...h,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};function A(t){const l=e.inject(t,void 0),o=e.computed((()=>{return t=l,!(null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length);var t,o}));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){if(null==l?void 0:l.value){const o=e.unref(l.value)[t];return e.computed({get:()=>null==o?void 0:o.value,set(e){o.value=e}})}const n=e.toRef(o,t);return e.computed({get:()=>n.value,set(e){a&&a(`update:${t}`,e)}})}}}i.button,r.button;const C={...x,...k,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function j(t,l,o){const a=e.inject(u),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];if(a.length){a[0]===n&&(l[o]=e[o])}}if("function"==typeof t[o]){(0,t[o])()===n&&(l[o]=e[o])}if("object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}function w(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const R=["for"],P=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],N=e.defineComponent({name:"VvCheckbox",props:C,emits:["click","update:modelValue","change","blur"],setup(l,{emit:o}){const a=l,n=e.useSlots(),i=j("VvCheckbox",C,a),{id:r,disabled:u,readonly:v,valid:c,invalid:f,propsSwitch:b,modelValue:m,indeterminate:h,isInGroup:g}=function(t,l){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=A(d),{id:i,switch:r,indeterminate:u}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>{var e;return Boolean(t.readonly||(null==(e=null==o?void 0:o.value)?void 0:e.readonly.value))})),p=e.computed((()=>{var e;return Boolean(t.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{id:i,propsSwitch:r,indeterminate:u,group:o,isInGroup:a,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}(a,o),y=(l=>e.computed((()=>String((null==l?void 0:l.value)||t.uid()))))(r),S=e.computed((()=>`${y.value}-hint`)),k=e.computed((()=>O.value?-1:a.tabindex)),L=e.ref(),B=e.computed((()=>void 0!==a.uncheckedValue&&!g.value)),O=e.computed((()=>u.value||v.value)),V=e.computed((()=>!0===f.value||!0!==c.value&&void 0)),x=e.computed((()=>B.value?m.value===a.value:Array.isArray(m.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(s(e,l))return!0;return!1}(a.value,m.value):s(a.value,m.value))),$=e.computed((()=>!!h.value||!(x.value||!B.value||a.uncheckedValue===m.value))),N=e.computed((()=>{if(!B.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),E=e.computed({get:()=>x.value,set(e){if(B.value)m.value=e?a.value:a.uncheckedValue;else if(Array.isArray(m.value)||g.value){const t=new Set(Array.isArray(m.value)?m.value:void 0!==m.value?[m.value]:[]);e?t.add(a.value):t.delete(a.value),m.value=[...t]}else m.value=e?a.value:void 0;o("change",e)}}),{modifiers:_}=e.toRefs(a),z=w("vv-checkbox",_,e.computed((()=>({switch:b.value,valid:c.value,invalid:f.value,disabled:u.value,readonly:v.value,indeterminate:h.value}))));e.watchEffect((()=>{B.value&&Array.isArray(m.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>$.value),(e=>{L.value.indeterminate=!!e})),e.onMounted((()=>{$.value&&(L.value.indeterminate=!0)}));const{HintSlot:G,hasHintLabelOrSlot:I,hasInvalidLabelOrSlot:D,hintSlotScope:H}=p(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(y)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(y),ref_key:"input",ref:L,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(E)?E.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(O),value:e.unref(N),tabindex:e.unref(k),"aria-invalid":e.unref(V),"aria-describedby":e.unref(I)?e.unref(S):void 0,"aria-errormessage":e.unref(D)?e.unref(S):void 0},null,8,P),[[e.vModelCheckbox,e.unref(E)]]),e.renderSlot(t.$slots,"default",{value:e.unref(m)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(G),{id:e.unref(S),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(H))))])),key:"3"}:void 0]),1032,["id"])],10,R))}}),E=$;const _=["textContent"],z={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:E,emits:["update:modelValue","change"],setup(t,{emit:a}){const n=t,i=e.useSlots(),r=j("VvCheckboxGroup",E,n),u=l.useVModel(n,"modelValue",a),{disabled:s,readonly:v,vertical:c,valid:f,invalid:b,modifiers:m}=e.toRefs(n);!function(t){if(Object.keys(t).some((l=>"key"!==l&&!e.isRef(t[l]))))throw Error("One or more groupState props aren't ref.");e.provide(t.key,e.computed((()=>t)))}({key:d,modelValue:u,disabled:s,readonly:v,valid:f,invalid:b});const{getOptionLabel:h,getOptionValue:g}=function(t){const{options:l,labelKey:a,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:String("function"==typeof a.value?a.value(e):o.get(e,a.value)),getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof n.value?n.value(e):o.get(e,n.value),isOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof i.value?i.value(e):o.get(e,i.value)),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options||[]}}(n),y=w("vv-checkbox-group",m,e.computed((()=>({disabled:s.value,readonly:v.value,horizontal:!c.value,valid:f.value,invalid:b.value})))),{HintSlot:S,hintSlotScope:k}=p(r,i);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,_)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(N,e.mergeProps({key:l},((e,t)=>({id:`${n.name}_opt${t}`,name:n.name,label:h(e),value:g(e)}))(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(S),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(k))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
@@ -39,7 +39,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
39
39
|
invalidLabel: (ArrayConstructor | StringConstructor)[];
|
|
40
40
|
valid: BooleanConstructor;
|
|
41
41
|
validLabel: (ArrayConstructor | StringConstructor)[];
|
|
42
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
42
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
[x: string]: (...args: any[]) => void;
|
|
44
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
43
45
|
modelValue: (SymbolConstructor | ArrayConstructor | StringConstructor | BooleanConstructor | NumberConstructor)[];
|
|
44
46
|
name: {
|
|
45
47
|
type: StringConstructor;
|
|
@@ -79,17 +81,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
79
81
|
invalidLabel: (ArrayConstructor | StringConstructor)[];
|
|
80
82
|
valid: BooleanConstructor;
|
|
81
83
|
validLabel: (ArrayConstructor | StringConstructor)[];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}, {
|
|
84
|
+
}>>, {
|
|
85
|
+
readonly: boolean;
|
|
85
86
|
disabled: boolean;
|
|
87
|
+
valid: boolean;
|
|
88
|
+
invalid: boolean;
|
|
86
89
|
options: (string | Option)[];
|
|
87
90
|
loading: boolean;
|
|
88
91
|
loadingLabel: string;
|
|
89
|
-
readonly: boolean;
|
|
90
92
|
hintLabel: string;
|
|
91
|
-
invalid: boolean;
|
|
92
|
-
valid: boolean;
|
|
93
93
|
vertical: boolean;
|
|
94
94
|
labelKey: string | Function;
|
|
95
95
|
valueKey: string | Function;
|
|
@@ -19,7 +19,7 @@ export declare const VvCheckboxGroupProps: {
|
|
|
19
19
|
default: string;
|
|
20
20
|
};
|
|
21
21
|
options: {
|
|
22
|
-
type: globalThis.PropType<(string | import("
|
|
22
|
+
type: globalThis.PropType<(string | import("../..").Option)[]>;
|
|
23
23
|
default: () => never[];
|
|
24
24
|
};
|
|
25
25
|
labelKey: {
|