@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +54 -15
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +23 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +338 -0
- package/dist/components/VvAction/VvAction.umd.js +1 -0
- package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
- package/dist/components/VvAction/index.d.ts +24 -0
- package/dist/components/VvBadge/VvBadge.es.js +251 -22
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +720 -261
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
- package/dist/components/VvButton/index.d.ts +30 -75
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +60 -28
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckbox/index.d.ts +6 -6
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
- package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
- package/dist/components/VvCombobox/index.d.ts +54 -23
- package/dist/components/VvDialog/VvDialog.es.js +426 -115
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
- package/dist/components/VvDropdown/index.d.ts +35 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
- package/dist/components/VvIcon/VvIcon.es.js +116 -52
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +1054 -376
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +67 -3
- package/dist/components/VvProgress/VvProgress.es.js +254 -23
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +568 -137
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
- package/dist/components/VvRadioGroup/index.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +703 -251
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
- package/dist/components/VvSelect/index.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
- package/dist/components/VvTextarea/index.d.ts +7 -7
- package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3676 -2007
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +30 -0
- package/dist/directives/index.es.js +288 -0
- package/dist/directives/index.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +285 -0
- package/dist/directives/v-tooltip.umd.js +1 -0
- package/dist/icons.es.js +38 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +115 -3269
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +215 -23
- package/dist/resolvers/unplugin.d.ts +14 -8
- package/dist/resolvers/unplugin.es.js +94 -33
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +1 -1
- package/package.json +167 -63
- package/src/Volver.ts +60 -26
- 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 +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +144 -0
- package/src/components/VvAction/index.ts +5 -0
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +41 -124
- package/src/components/VvButton/index.ts +16 -88
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +85 -57
- package/src/components/VvCombobox/index.ts +12 -10
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +6 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
- package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
- package/src/components/VvDropdown/index.ts +6 -11
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +128 -35
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +3 -5
- package/src/components/VvTextarea/VvTextarea.vue +4 -4
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +9 -11
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +8 -9
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/constants.ts +36 -0
- package/src/directives/index.ts +1 -1
- package/src/directives/v-tooltip.ts +2 -2
- package/src/index.ts +0 -2
- package/src/props/index.ts +111 -19
- package/src/resolvers/unplugin.ts +96 -49
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
- package/src/stories/Button/Button.stories.mdx +4 -2
- package/src/stories/Button/Button.test.ts +3 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
- package/src/stories/Button/ButtonState.stories.mdx +2 -11
- package/src/stories/Card/Card.stories.mdx +2 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
- package/src/stories/Combobox/Combobox.settings.ts +44 -0
- package/src/stories/Combobox/Combobox.stories.mdx +40 -1
- package/src/stories/Dialog/Dialog.stories.mdx +2 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
- package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
- package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
- package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
- package/src/stories/Icon/Icon.stories.mdx +2 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +42 -1
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Progress/Progress.stories.mdx +2 -1
- package/src/stories/Radio/Radio.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
- package/src/stories/Select/Select.stories.mdx +2 -1
- package/src/stories/Textarea/Textarea.stories.mdx +2 -1
- package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
- package/src/stories/argTypes.ts +2 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { iconExists
|
|
3
|
-
|
|
1
|
+
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString, toRef, useAttrs, useSlots, createElementBlock, Fragment } from "vue";
|
|
2
|
+
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
|
+
import { nanoid } from "nanoid";
|
|
4
|
+
const VvIconProps = {
|
|
4
5
|
/**
|
|
5
6
|
* Color
|
|
6
7
|
*/
|
|
@@ -24,7 +25,7 @@ const oe = {
|
|
|
24
25
|
*/
|
|
25
26
|
name: {
|
|
26
27
|
type: String,
|
|
27
|
-
required:
|
|
28
|
+
required: true
|
|
28
29
|
},
|
|
29
30
|
/**
|
|
30
31
|
* By default 'vv'
|
|
@@ -93,352 +94,810 @@ const oe = {
|
|
|
93
94
|
modifiers: {
|
|
94
95
|
type: [String, Array]
|
|
95
96
|
}
|
|
96
|
-
}
|
|
97
|
+
};
|
|
98
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
99
|
+
Side2["left"] = "left";
|
|
100
|
+
Side2["right"] = "right";
|
|
101
|
+
Side2["top"] = "top";
|
|
102
|
+
Side2["bottom"] = "bottom";
|
|
103
|
+
return Side2;
|
|
104
|
+
})(Side || {});
|
|
105
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
106
|
+
Placement2["topStart"] = "top-start";
|
|
107
|
+
Placement2["topEnd"] = "top-end";
|
|
108
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
109
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
110
|
+
Placement2["leftStart"] = "left-start";
|
|
111
|
+
Placement2["leftEnd"] = "left-end";
|
|
112
|
+
Placement2["rightStart"] = "right-start";
|
|
113
|
+
Placement2["rightEnd"] = "right-end";
|
|
114
|
+
return Placement2;
|
|
115
|
+
})(Placement || {});
|
|
116
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
117
|
+
Position2["before"] = "before";
|
|
118
|
+
Position2["after"] = "after";
|
|
119
|
+
return Position2;
|
|
120
|
+
})(Position || {});
|
|
121
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
122
|
+
ButtonType2["button"] = "button";
|
|
123
|
+
ButtonType2["submit"] = "submit";
|
|
124
|
+
ButtonType2["reset"] = "reset";
|
|
125
|
+
return ButtonType2;
|
|
126
|
+
})(ButtonType || {});
|
|
127
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
128
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
129
|
+
ActionTag2["routerLink"] = "router-link";
|
|
130
|
+
ActionTag2["a"] = "a";
|
|
131
|
+
ActionTag2["button"] = "button";
|
|
132
|
+
return ActionTag2;
|
|
133
|
+
})(ActionTag || {});
|
|
134
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
135
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
136
|
+
AnchorTarget2["_self"] = "_self";
|
|
137
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
138
|
+
AnchorTarget2["_top"] = "_top";
|
|
139
|
+
return AnchorTarget2;
|
|
140
|
+
})(AnchorTarget || {});
|
|
141
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
142
|
+
const INJECTION_KEY_BUTTON_GROUP = Symbol.for("buttonGroup");
|
|
143
|
+
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for("dropdownTrigger");
|
|
144
|
+
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
|
|
145
|
+
function useVolver() {
|
|
146
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
147
|
+
}
|
|
148
|
+
function useModifiers(prefix, modifiers, others) {
|
|
149
|
+
return computed(() => {
|
|
150
|
+
const toReturn = {
|
|
151
|
+
[prefix]: true
|
|
152
|
+
};
|
|
153
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
154
|
+
if (modifiersArray) {
|
|
155
|
+
if (Array.isArray(modifiersArray)) {
|
|
156
|
+
modifiersArray.forEach((modifier) => {
|
|
157
|
+
if (modifier) {
|
|
158
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (others) {
|
|
164
|
+
Object.keys(others.value).forEach((key) => {
|
|
165
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return toReturn;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const __default__$2 = {
|
|
97
172
|
name: "VvIcon"
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
173
|
+
};
|
|
174
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
175
|
+
...__default__$2,
|
|
176
|
+
props: VvIconProps,
|
|
177
|
+
setup(__props) {
|
|
178
|
+
const props = __props;
|
|
179
|
+
const show = ref(true);
|
|
180
|
+
const volver = useVolver();
|
|
181
|
+
const { modifiers } = toRefs(props);
|
|
182
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
183
|
+
const provider = computed(() => {
|
|
184
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
185
|
+
});
|
|
186
|
+
const icon = computed(() => {
|
|
187
|
+
const _name = props.name ?? "";
|
|
188
|
+
const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
|
|
189
|
+
if (iconExists(_name)) {
|
|
190
|
+
return _name;
|
|
191
|
+
} else if (iconExists(iconName)) {
|
|
192
|
+
return iconName;
|
|
193
|
+
} else {
|
|
194
|
+
return (volver == null ? void 0 : volver.iconsCollections.find(
|
|
195
|
+
(iconsCollection) => {
|
|
196
|
+
const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
|
|
197
|
+
if (iconExists(icon2)) {
|
|
198
|
+
return icon2;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
)) || _name;
|
|
202
|
+
}
|
|
111
203
|
});
|
|
112
|
-
function
|
|
113
|
-
let
|
|
114
|
-
if (typeof window
|
|
115
|
-
const { JSDOM
|
|
116
|
-
|
|
204
|
+
function getSvgContent(svg) {
|
|
205
|
+
let dom = null;
|
|
206
|
+
if (typeof window === "undefined") {
|
|
207
|
+
const { JSDOM } = require("jsdom");
|
|
208
|
+
dom = new JSDOM().window;
|
|
117
209
|
}
|
|
118
|
-
|
|
210
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
211
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
212
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
213
|
+
return svgEl;
|
|
119
214
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
215
|
+
function addIconFromSvg(svg) {
|
|
216
|
+
const svgContentEl = getSvgContent(svg);
|
|
217
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
218
|
+
if (svgContentEl && svgContent) {
|
|
219
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
220
|
+
body: svgContent,
|
|
221
|
+
// Set height and width from svg content
|
|
222
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
223
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (volver) {
|
|
228
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
229
|
+
show.value = false;
|
|
230
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
231
|
+
if (svg) {
|
|
232
|
+
addIconFromSvg(svg);
|
|
233
|
+
show.value = true;
|
|
234
|
+
}
|
|
235
|
+
}).catch((e) => {
|
|
236
|
+
throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
|
|
237
|
+
});
|
|
238
|
+
} else if (props.svg) {
|
|
239
|
+
addIconFromSvg(props.svg);
|
|
240
|
+
}
|
|
128
241
|
}
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
icon: c(_)
|
|
147
|
-
}), null, 16, ["class"])) : I("", !0);
|
|
242
|
+
return (_ctx, _cache) => {
|
|
243
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
244
|
+
key: 0,
|
|
245
|
+
class: unref(bemCssClasses)
|
|
246
|
+
}, {
|
|
247
|
+
inline: _ctx.inline,
|
|
248
|
+
width: _ctx.width,
|
|
249
|
+
height: _ctx.height,
|
|
250
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
251
|
+
verticalFlip: _ctx.verticalFlip,
|
|
252
|
+
flip: _ctx.flip,
|
|
253
|
+
rotate: _ctx.rotate,
|
|
254
|
+
color: _ctx.color,
|
|
255
|
+
onLoad: _ctx.onLoad,
|
|
256
|
+
icon: unref(icon)
|
|
257
|
+
}), null, 16, ["class"])) : createCommentVNode("", true);
|
|
258
|
+
};
|
|
148
259
|
}
|
|
149
260
|
});
|
|
150
|
-
|
|
151
|
-
|
|
261
|
+
const LinkProps = {
|
|
262
|
+
/**
|
|
263
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
264
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
265
|
+
*/
|
|
266
|
+
to: {
|
|
267
|
+
type: [String, Object]
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* Anchor href
|
|
271
|
+
*/
|
|
272
|
+
href: String,
|
|
273
|
+
/**
|
|
274
|
+
* Anchor target
|
|
275
|
+
*/
|
|
276
|
+
target: {
|
|
277
|
+
type: String,
|
|
278
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
* Anchor rel
|
|
282
|
+
*/
|
|
283
|
+
rel: {
|
|
284
|
+
type: String,
|
|
285
|
+
default: "noopener noreferrer"
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
const LoadingProps = {
|
|
289
|
+
/**
|
|
290
|
+
* Loading status
|
|
291
|
+
*/
|
|
292
|
+
loading: Boolean,
|
|
293
|
+
/**
|
|
294
|
+
* Loading label
|
|
295
|
+
*/
|
|
296
|
+
loadingLabel: {
|
|
297
|
+
type: String,
|
|
298
|
+
default: "Loading..."
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const DisabledProps = {
|
|
152
302
|
/**
|
|
153
303
|
* Whether the form control is disabled
|
|
154
304
|
*/
|
|
155
305
|
disabled: Boolean
|
|
156
|
-
}
|
|
306
|
+
};
|
|
307
|
+
const ActiveProps = {
|
|
308
|
+
/**
|
|
309
|
+
* Whether the item is active
|
|
310
|
+
*/
|
|
311
|
+
active: Boolean
|
|
312
|
+
};
|
|
313
|
+
const PressedProps = {
|
|
314
|
+
/**
|
|
315
|
+
* Whether the item is pressed
|
|
316
|
+
*/
|
|
317
|
+
pressed: Boolean
|
|
318
|
+
};
|
|
319
|
+
const LabelProps = {
|
|
320
|
+
/**
|
|
321
|
+
* The item label
|
|
322
|
+
*/
|
|
323
|
+
label: [String, Number]
|
|
324
|
+
};
|
|
325
|
+
const ModifiersProps = {
|
|
157
326
|
/**
|
|
158
327
|
* Component BEM modifiers
|
|
159
328
|
*/
|
|
160
329
|
modifiers: [String, Array]
|
|
161
330
|
};
|
|
162
|
-
|
|
163
|
-
|
|
331
|
+
({
|
|
332
|
+
/**
|
|
333
|
+
* VvIcon name or props
|
|
334
|
+
* @see VVIcon
|
|
335
|
+
*/
|
|
336
|
+
icon: { type: [String, Object] },
|
|
337
|
+
/**
|
|
338
|
+
* VvIcon position
|
|
339
|
+
*/
|
|
340
|
+
iconPosition: {
|
|
341
|
+
type: String,
|
|
342
|
+
default: Position.before,
|
|
343
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
const UnselectableProps = {
|
|
164
347
|
/**
|
|
165
348
|
* If true the input will be unselectable
|
|
166
349
|
*/
|
|
167
|
-
unselectable: { type: Boolean, default:
|
|
168
|
-
}
|
|
350
|
+
unselectable: { type: Boolean, default: true }
|
|
351
|
+
};
|
|
352
|
+
const IdProps = {
|
|
169
353
|
/**
|
|
170
354
|
* Global attribute id
|
|
171
355
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
172
356
|
*/
|
|
173
357
|
id: [String, Number]
|
|
174
358
|
};
|
|
175
|
-
|
|
176
|
-
var R = /* @__PURE__ */ ((e) => (e.button = "button", e.submit = "submit", e.reset = "reset", e))(R || {}), v = /* @__PURE__ */ ((e) => (e.nuxtLink = "nuxt-link", e.routerLink = "router-link", e.a = "a", e.button = "button", e))(v || {}), z = /* @__PURE__ */ ((e) => (e._blank = "_blank", e._self = "_self", e._parent = "_parent", e._top = "_top", e))(z || {});
|
|
177
|
-
const ue = ["update:modelValue"], ce = {
|
|
178
|
-
...ie,
|
|
179
|
-
...le,
|
|
180
|
-
...ae,
|
|
181
|
-
...se,
|
|
359
|
+
({
|
|
182
360
|
/**
|
|
183
|
-
*
|
|
361
|
+
* Dropdown placement
|
|
184
362
|
*/
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Button icon position
|
|
188
|
-
*/
|
|
189
|
-
iconPosition: {
|
|
363
|
+
placement: {
|
|
190
364
|
type: String,
|
|
191
|
-
default:
|
|
192
|
-
validator: (
|
|
365
|
+
default: Side.bottom,
|
|
366
|
+
validator: (value) => {
|
|
367
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
368
|
+
}
|
|
193
369
|
},
|
|
194
370
|
/**
|
|
195
|
-
*
|
|
371
|
+
* Dropdown show / hide transition name
|
|
196
372
|
*/
|
|
197
|
-
|
|
373
|
+
transitionName: {
|
|
374
|
+
type: String
|
|
375
|
+
},
|
|
198
376
|
/**
|
|
199
|
-
*
|
|
377
|
+
* Offset of the dropdown from the trigger
|
|
378
|
+
* @see https://floating-ui.com/docs/offset
|
|
200
379
|
*/
|
|
201
|
-
|
|
380
|
+
offset: {
|
|
381
|
+
type: [Number, String, Object],
|
|
382
|
+
default: 0
|
|
383
|
+
},
|
|
202
384
|
/**
|
|
203
|
-
*
|
|
385
|
+
* Move dropdown to the side if there is no space in the default position
|
|
386
|
+
* @see https://floating-ui.com/docs/shift
|
|
204
387
|
*/
|
|
205
|
-
|
|
388
|
+
shift: {
|
|
389
|
+
type: [Boolean, Object],
|
|
390
|
+
default: false
|
|
391
|
+
},
|
|
206
392
|
/**
|
|
207
|
-
*
|
|
393
|
+
* Flip dropdown position if there is no space in the default position
|
|
394
|
+
* @see https://floating-ui.com/docs/flip
|
|
208
395
|
*/
|
|
209
|
-
|
|
210
|
-
type:
|
|
211
|
-
default:
|
|
396
|
+
flip: {
|
|
397
|
+
type: [Boolean, Object],
|
|
398
|
+
default: true
|
|
212
399
|
},
|
|
213
400
|
/**
|
|
214
|
-
*
|
|
215
|
-
* @see
|
|
401
|
+
* Size of the dropdown
|
|
402
|
+
* @see https://floating-ui.com/docs/size
|
|
216
403
|
*/
|
|
217
|
-
|
|
218
|
-
type: [
|
|
404
|
+
size: {
|
|
405
|
+
type: [Boolean, Object],
|
|
406
|
+
default: () => ({ padding: 10 })
|
|
219
407
|
},
|
|
220
408
|
/**
|
|
221
|
-
*
|
|
409
|
+
* Automatically change the position of the dropdown
|
|
410
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
222
411
|
*/
|
|
223
|
-
|
|
412
|
+
autoPlacement: {
|
|
413
|
+
type: [Boolean, Object],
|
|
414
|
+
default: false
|
|
415
|
+
},
|
|
224
416
|
/**
|
|
225
|
-
*
|
|
417
|
+
* Add arrow to the dropdown
|
|
418
|
+
* @see https://floating-ui.com/docs/arrow
|
|
226
419
|
*/
|
|
227
|
-
|
|
228
|
-
type:
|
|
229
|
-
|
|
420
|
+
arrow: {
|
|
421
|
+
type: Boolean,
|
|
422
|
+
default: false
|
|
230
423
|
},
|
|
231
|
-
active: Boolean,
|
|
232
424
|
/**
|
|
233
|
-
*
|
|
425
|
+
* Close dropdown on click outside
|
|
234
426
|
*/
|
|
235
|
-
|
|
427
|
+
autoClose: {
|
|
428
|
+
type: Boolean,
|
|
429
|
+
default: true
|
|
430
|
+
},
|
|
236
431
|
/**
|
|
237
|
-
*
|
|
432
|
+
* Autofocus first item on dropdown open
|
|
238
433
|
*/
|
|
239
|
-
|
|
240
|
-
type:
|
|
241
|
-
default:
|
|
434
|
+
autofocusFirst: {
|
|
435
|
+
type: Boolean,
|
|
436
|
+
default: true
|
|
242
437
|
},
|
|
438
|
+
/**
|
|
439
|
+
* Set dropdown width to the same as the trigger
|
|
440
|
+
*/
|
|
441
|
+
triggerWidth: {
|
|
442
|
+
type: Boolean
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
const ActionProps = {
|
|
446
|
+
...DisabledProps,
|
|
447
|
+
...LabelProps,
|
|
448
|
+
...PressedProps,
|
|
449
|
+
...ActiveProps,
|
|
450
|
+
...LinkProps,
|
|
243
451
|
/**
|
|
244
452
|
* Button type
|
|
245
453
|
*/
|
|
246
454
|
type: {
|
|
247
455
|
type: String,
|
|
248
|
-
default:
|
|
249
|
-
validator: (
|
|
456
|
+
default: ButtonType.button,
|
|
457
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
461
|
+
const VvActionProps = ActionProps;
|
|
462
|
+
function useInjectedDropdownTrigger() {
|
|
463
|
+
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
464
|
+
}
|
|
465
|
+
function useInjectedDropdownAction() {
|
|
466
|
+
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
467
|
+
}
|
|
468
|
+
const __default__$1 = {
|
|
469
|
+
name: "VvAction"
|
|
470
|
+
};
|
|
471
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
472
|
+
...__default__$1,
|
|
473
|
+
props: VvActionProps,
|
|
474
|
+
emits: VvActionEvents,
|
|
475
|
+
setup(__props, { expose, emit }) {
|
|
476
|
+
const props = __props;
|
|
477
|
+
const volver = useVolver();
|
|
478
|
+
const element = ref(null);
|
|
479
|
+
expose({ $el: element });
|
|
480
|
+
const {
|
|
481
|
+
reference: dropdownTriggerReference,
|
|
482
|
+
bus: dropdownEventBus,
|
|
483
|
+
aria: dropdownAria,
|
|
484
|
+
expanded: dropdownExpanded
|
|
485
|
+
} = useInjectedDropdownTrigger();
|
|
486
|
+
watch(
|
|
487
|
+
() => element.value,
|
|
488
|
+
(newValue) => {
|
|
489
|
+
if (dropdownTriggerReference) {
|
|
490
|
+
dropdownTriggerReference.value = newValue;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
const pressed = computed(() => {
|
|
495
|
+
return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
|
|
496
|
+
});
|
|
497
|
+
const { role } = useInjectedDropdownAction();
|
|
498
|
+
const hasTag = computed(() => {
|
|
499
|
+
switch (true) {
|
|
500
|
+
case props.disabled:
|
|
501
|
+
return ActionTag.button;
|
|
502
|
+
case props.to !== void 0:
|
|
503
|
+
return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
|
|
504
|
+
case props.href !== void 0:
|
|
505
|
+
return ActionTag.a;
|
|
506
|
+
default:
|
|
507
|
+
return ActionTag.button;
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
const hasProps = computed(() => {
|
|
511
|
+
const toReturn = {
|
|
512
|
+
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
513
|
+
"aria-pressed": pressed.value ? true : void 0,
|
|
514
|
+
role
|
|
515
|
+
};
|
|
516
|
+
switch (hasTag.value) {
|
|
517
|
+
case ActionTag.a:
|
|
518
|
+
return {
|
|
519
|
+
...toReturn,
|
|
520
|
+
href: props.href,
|
|
521
|
+
target: props.target,
|
|
522
|
+
rel: props.rel
|
|
523
|
+
};
|
|
524
|
+
case ActionTag.routerLink:
|
|
525
|
+
case ActionTag.nuxtLink:
|
|
526
|
+
return {
|
|
527
|
+
...toReturn,
|
|
528
|
+
to: props.to,
|
|
529
|
+
target: props.target
|
|
530
|
+
};
|
|
531
|
+
default:
|
|
532
|
+
return {
|
|
533
|
+
...toReturn,
|
|
534
|
+
type: props.type,
|
|
535
|
+
disabled: props.disabled
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
const onClick = (e) => {
|
|
540
|
+
if (props.disabled) {
|
|
541
|
+
e.preventDefault();
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
545
|
+
emit("click", e);
|
|
546
|
+
};
|
|
547
|
+
const onMouseover = (e) => {
|
|
548
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
549
|
+
emit("mouseover", e);
|
|
550
|
+
};
|
|
551
|
+
const onMouseleave = (e) => {
|
|
552
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
553
|
+
emit("mouseleave", e);
|
|
554
|
+
};
|
|
555
|
+
return (_ctx, _cache) => {
|
|
556
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
557
|
+
ref_key: "element",
|
|
558
|
+
ref: element,
|
|
559
|
+
class: {
|
|
560
|
+
active: _ctx.active,
|
|
561
|
+
pressed: unref(pressed),
|
|
562
|
+
disabled: _ctx.disabled
|
|
563
|
+
},
|
|
564
|
+
onClickPassive: onClick,
|
|
565
|
+
onMouseoverPassive: onMouseover,
|
|
566
|
+
onMouseleavePassive: onMouseleave
|
|
567
|
+
}), {
|
|
568
|
+
default: withCtx(() => [
|
|
569
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
570
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
571
|
+
])
|
|
572
|
+
]),
|
|
573
|
+
_: 3
|
|
574
|
+
}, 16, ["class"]);
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
function equals(obj1, obj2, field) {
|
|
579
|
+
if (field)
|
|
580
|
+
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
581
|
+
else
|
|
582
|
+
return deepEquals(obj1, obj2);
|
|
583
|
+
}
|
|
584
|
+
function deepEquals(a, b) {
|
|
585
|
+
if (a === b)
|
|
586
|
+
return true;
|
|
587
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
588
|
+
const arrA = Array.isArray(a);
|
|
589
|
+
const arrB = Array.isArray(b);
|
|
590
|
+
let i, length, key;
|
|
591
|
+
if (arrA && arrB) {
|
|
592
|
+
length = a.length;
|
|
593
|
+
if (length != b.length)
|
|
594
|
+
return false;
|
|
595
|
+
for (i = length; i-- !== 0; )
|
|
596
|
+
if (!deepEquals(a[i], b[i]))
|
|
597
|
+
return false;
|
|
598
|
+
return true;
|
|
599
|
+
}
|
|
600
|
+
if (arrA != arrB)
|
|
601
|
+
return false;
|
|
602
|
+
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
603
|
+
if (dateA != dateB)
|
|
604
|
+
return false;
|
|
605
|
+
if (dateA && dateB)
|
|
606
|
+
return a.getTime() == b.getTime();
|
|
607
|
+
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
608
|
+
if (regexpA != regexpB)
|
|
609
|
+
return false;
|
|
610
|
+
if (regexpA && regexpB)
|
|
611
|
+
return a.toString() == b.toString();
|
|
612
|
+
const keys = Object.keys(a);
|
|
613
|
+
length = keys.length;
|
|
614
|
+
if (length !== Object.keys(b).length)
|
|
615
|
+
return false;
|
|
616
|
+
for (i = length; i-- !== 0; )
|
|
617
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
618
|
+
return false;
|
|
619
|
+
for (i = length; i-- !== 0; ) {
|
|
620
|
+
key = keys[i];
|
|
621
|
+
if (!deepEquals(a[key], b[key]))
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
624
|
+
return true;
|
|
625
|
+
}
|
|
626
|
+
return a !== a && b !== b;
|
|
627
|
+
}
|
|
628
|
+
function resolveFieldData(data, field) {
|
|
629
|
+
if (data && Object.keys(data).length && field) {
|
|
630
|
+
if (field.indexOf(".") === -1) {
|
|
631
|
+
return data[field];
|
|
632
|
+
} else {
|
|
633
|
+
const fields = field.split(".");
|
|
634
|
+
let value = data;
|
|
635
|
+
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
636
|
+
if (data == null) {
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
value = value[fields[i]];
|
|
640
|
+
}
|
|
641
|
+
return value;
|
|
642
|
+
}
|
|
643
|
+
} else {
|
|
644
|
+
return null;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function contains(value, list) {
|
|
648
|
+
if (value != null && list && list.length) {
|
|
649
|
+
for (const val of list) {
|
|
650
|
+
if (equals(value, val)) {
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
return false;
|
|
656
|
+
}
|
|
657
|
+
function isEmpty(value) {
|
|
658
|
+
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));
|
|
659
|
+
}
|
|
660
|
+
function useInjectedGroupState(groupKey) {
|
|
661
|
+
const group = inject(groupKey, void 0);
|
|
662
|
+
const isInGroup = computed(() => !isEmpty(group));
|
|
663
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
664
|
+
if (group == null ? void 0 : group.value) {
|
|
665
|
+
const groupPropValue = unref(group.value)[propName];
|
|
666
|
+
return computed({
|
|
667
|
+
get() {
|
|
668
|
+
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
669
|
+
},
|
|
670
|
+
set(value) {
|
|
671
|
+
groupPropValue.value = value;
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
const propRef = toRef(props, propName);
|
|
676
|
+
return computed({
|
|
677
|
+
get() {
|
|
678
|
+
return propRef.value;
|
|
679
|
+
},
|
|
680
|
+
set(value) {
|
|
681
|
+
if (emit)
|
|
682
|
+
emit(`update:${propName}`, value);
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
return {
|
|
687
|
+
group,
|
|
688
|
+
isInGroup,
|
|
689
|
+
getGroupOrLocalRef
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
const VvButtonEvents = ["update:modelValue"];
|
|
693
|
+
const VvButtonProps = {
|
|
694
|
+
...ActionProps,
|
|
695
|
+
...IdProps,
|
|
696
|
+
...ModifiersProps,
|
|
697
|
+
...UnselectableProps,
|
|
698
|
+
...LoadingProps,
|
|
699
|
+
/**
|
|
700
|
+
* Button icon
|
|
701
|
+
*/
|
|
702
|
+
icon: [String, Object],
|
|
703
|
+
/**
|
|
704
|
+
* Button icon position
|
|
705
|
+
*/
|
|
706
|
+
iconPosition: {
|
|
707
|
+
type: String,
|
|
708
|
+
default: Side.left,
|
|
709
|
+
validator: (value) => Object.values(Side).includes(value)
|
|
250
710
|
},
|
|
711
|
+
/**
|
|
712
|
+
* Loading icon
|
|
713
|
+
*/
|
|
714
|
+
loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
|
|
251
715
|
toggle: {
|
|
252
716
|
type: Boolean,
|
|
253
|
-
default:
|
|
717
|
+
default: false
|
|
254
718
|
},
|
|
255
719
|
modelValue: String
|
|
256
720
|
};
|
|
257
|
-
function
|
|
258
|
-
|
|
259
|
-
const {
|
|
260
|
-
id
|
|
261
|
-
iconPosition
|
|
262
|
-
icon
|
|
263
|
-
label
|
|
264
|
-
pressed
|
|
265
|
-
modifiers:
|
|
266
|
-
} = toRefs(
|
|
721
|
+
function useGroupProps(props, emit) {
|
|
722
|
+
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_BUTTON_GROUP);
|
|
723
|
+
const {
|
|
724
|
+
id,
|
|
725
|
+
iconPosition,
|
|
726
|
+
icon,
|
|
727
|
+
label,
|
|
728
|
+
pressed,
|
|
729
|
+
modifiers: localModifiers
|
|
730
|
+
} = toRefs(props);
|
|
731
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
732
|
+
const toggle = getGroupOrLocalRef("toggle", props);
|
|
733
|
+
const unselectable = getGroupOrLocalRef(
|
|
267
734
|
"unselectable",
|
|
268
|
-
|
|
269
|
-
)
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
735
|
+
props
|
|
736
|
+
);
|
|
737
|
+
const multiple = computed(() => (group == null ? void 0 : group.value.multiple.value) ?? false);
|
|
738
|
+
const modifiers = computed(() => {
|
|
739
|
+
var _a;
|
|
740
|
+
const localValue = (localModifiers == null ? void 0 : localModifiers.value) ? Array.isArray(localModifiers.value) ? localModifiers.value : localModifiers.value.split(" ") : [];
|
|
741
|
+
const groupValue = ((_a = group == null ? void 0 : group.value.itemModifiers) == null ? void 0 : _a.value) ? Array.isArray(group.value.itemModifiers.value) ? group.value.itemModifiers.value : group.value.itemModifiers.value.split(" ") : [];
|
|
742
|
+
return [...localValue, ...groupValue];
|
|
273
743
|
});
|
|
744
|
+
const disabled = computed(
|
|
745
|
+
() => {
|
|
746
|
+
var _a;
|
|
747
|
+
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
748
|
+
}
|
|
749
|
+
);
|
|
274
750
|
return {
|
|
275
751
|
// group props
|
|
276
|
-
group
|
|
277
|
-
isInGroup
|
|
278
|
-
modelValue
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
752
|
+
group,
|
|
753
|
+
isInGroup,
|
|
754
|
+
modelValue,
|
|
755
|
+
toggle,
|
|
756
|
+
unselectable,
|
|
757
|
+
multiple,
|
|
758
|
+
modifiers,
|
|
759
|
+
disabled,
|
|
283
760
|
// local props
|
|
284
|
-
id
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
label: y
|
|
761
|
+
id,
|
|
762
|
+
pressed,
|
|
763
|
+
iconPosition,
|
|
764
|
+
icon,
|
|
765
|
+
label
|
|
290
766
|
};
|
|
291
767
|
}
|
|
292
|
-
const
|
|
768
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
769
|
+
const _hoisted_1 = {
|
|
293
770
|
key: 1,
|
|
294
771
|
class: "vv-button__label"
|
|
295
|
-
}
|
|
772
|
+
};
|
|
773
|
+
const _hoisted_2 = {
|
|
296
774
|
key: 1,
|
|
297
775
|
class: "vv-button__label"
|
|
298
|
-
}
|
|
776
|
+
};
|
|
777
|
+
const __default__ = {
|
|
299
778
|
name: "VvButton"
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
icon: a,
|
|
310
|
-
label: t,
|
|
311
|
-
modelValue: o,
|
|
312
|
-
disabled: u,
|
|
313
|
-
toggle: g,
|
|
314
|
-
unselectable: O
|
|
315
|
-
} = de(n, s), h = useUniqueId(m), f = computed(() => (d == null ? void 0 : d.name) || h.value), S = useVolver(), $ = ref(null);
|
|
316
|
-
l({ $el: $ });
|
|
779
|
+
};
|
|
780
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
781
|
+
...__default__,
|
|
782
|
+
props: VvButtonProps,
|
|
783
|
+
emits: VvButtonEvents,
|
|
784
|
+
setup(__props, { expose, emit }) {
|
|
785
|
+
const props = __props;
|
|
786
|
+
const attrs = useAttrs();
|
|
787
|
+
const slots = useSlots();
|
|
317
788
|
const {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
789
|
+
id,
|
|
790
|
+
modifiers,
|
|
791
|
+
iconPosition,
|
|
792
|
+
icon,
|
|
793
|
+
label,
|
|
794
|
+
modelValue,
|
|
795
|
+
disabled,
|
|
796
|
+
toggle,
|
|
797
|
+
unselectable
|
|
798
|
+
} = useGroupProps(props, emit);
|
|
799
|
+
const hasId = useUniqueId(id);
|
|
800
|
+
const name = computed(() => (attrs == null ? void 0 : attrs.name) || hasId.value);
|
|
801
|
+
const element = ref(null);
|
|
802
|
+
const $el = computed(() => {
|
|
803
|
+
var _a;
|
|
804
|
+
return (_a = element.value) == null ? void 0 : _a.$el;
|
|
805
|
+
});
|
|
806
|
+
expose({ $el });
|
|
807
|
+
const pressed = computed(() => {
|
|
808
|
+
if (!toggle.value) {
|
|
809
|
+
return props.pressed;
|
|
326
810
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
switch (!0) {
|
|
330
|
-
case u.value:
|
|
331
|
-
return v.button;
|
|
332
|
-
case n.to !== void 0:
|
|
333
|
-
return S != null && S.nuxt ? v.nuxtLink : v.routerLink;
|
|
334
|
-
case n.href !== void 0:
|
|
335
|
-
return v.a;
|
|
336
|
-
default:
|
|
337
|
-
return v.button;
|
|
811
|
+
if (Array.isArray(modelValue.value)) {
|
|
812
|
+
return contains(name.value, modelValue.value);
|
|
338
813
|
}
|
|
339
|
-
|
|
814
|
+
return equals(name.value, modelValue.value);
|
|
815
|
+
});
|
|
816
|
+
const bemCssClasses = useModifiers(
|
|
340
817
|
"vv-button",
|
|
341
|
-
|
|
818
|
+
modifiers,
|
|
342
819
|
computed(() => ({
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
820
|
+
reverse: [Side.right, Side.bottom].includes(
|
|
821
|
+
iconPosition.value
|
|
822
|
+
),
|
|
823
|
+
column: [Side.top, Side.bottom].includes(
|
|
824
|
+
iconPosition.value
|
|
825
|
+
),
|
|
826
|
+
"icon-only": Boolean(
|
|
827
|
+
(icon == null ? void 0 : icon.value) && !(label == null ? void 0 : label.value) && !slots.default
|
|
828
|
+
)
|
|
349
829
|
}))
|
|
350
|
-
)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
role: r.role ?? "button",
|
|
364
|
-
href: n.href,
|
|
365
|
-
target: n.target,
|
|
366
|
-
rel: n.rel
|
|
367
|
-
};
|
|
368
|
-
case v.routerLink:
|
|
369
|
-
case v.nuxtLink:
|
|
370
|
-
return {
|
|
371
|
-
...r,
|
|
372
|
-
role: r.role ?? "button",
|
|
373
|
-
to: n.to,
|
|
374
|
-
target: n.target
|
|
375
|
-
};
|
|
376
|
-
default:
|
|
377
|
-
return {
|
|
378
|
-
...r,
|
|
379
|
-
type: n.type,
|
|
380
|
-
disabled: u.value
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
}), W = (r) => {
|
|
384
|
-
if (i == null || i.emit("click", r), g.value) {
|
|
385
|
-
if (Array.isArray(o.value)) {
|
|
386
|
-
if (contains(f.value, o.value)) {
|
|
387
|
-
O.value && (o.value = o.value.filter(
|
|
388
|
-
(D) => D !== f.value
|
|
389
|
-
));
|
|
830
|
+
);
|
|
831
|
+
const hasIconProps = computed(
|
|
832
|
+
() => typeof (icon == null ? void 0 : icon.value) === "string" ? { name: icon == null ? void 0 : icon.value } : icon == null ? void 0 : icon.value
|
|
833
|
+
);
|
|
834
|
+
const onClick = () => {
|
|
835
|
+
if (toggle.value) {
|
|
836
|
+
if (Array.isArray(modelValue.value)) {
|
|
837
|
+
if (contains(name.value, modelValue.value)) {
|
|
838
|
+
if (unselectable.value) {
|
|
839
|
+
modelValue.value = modelValue.value.filter(
|
|
840
|
+
(n) => n !== name.value
|
|
841
|
+
);
|
|
842
|
+
}
|
|
390
843
|
return;
|
|
391
844
|
}
|
|
392
|
-
|
|
845
|
+
modelValue.value.push(name.value);
|
|
393
846
|
return;
|
|
394
847
|
}
|
|
395
|
-
if (equals(
|
|
396
|
-
|
|
848
|
+
if (equals(name.value, modelValue.value) && unselectable.value) {
|
|
849
|
+
modelValue.value = void 0;
|
|
397
850
|
return;
|
|
398
851
|
}
|
|
399
|
-
|
|
852
|
+
modelValue.value = name.value;
|
|
400
853
|
}
|
|
401
|
-
}, Y = (r) => {
|
|
402
|
-
i == null || i.emit("mouseover", r);
|
|
403
|
-
}, x = (r) => {
|
|
404
|
-
i == null || i.emit("mouseleave", r);
|
|
405
854
|
};
|
|
406
|
-
return (
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
855
|
+
return (_ctx, _cache) => {
|
|
856
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
857
|
+
disabled: unref(disabled),
|
|
858
|
+
pressed: unref(pressed),
|
|
859
|
+
active: _ctx.active,
|
|
860
|
+
type: _ctx.type,
|
|
861
|
+
to: _ctx.to,
|
|
862
|
+
href: _ctx.href,
|
|
863
|
+
target: _ctx.target,
|
|
864
|
+
rel: _ctx.rel
|
|
865
|
+
}, {
|
|
866
|
+
id: unref(hasId),
|
|
867
|
+
ref_key: "element",
|
|
868
|
+
ref: element,
|
|
869
|
+
class: unref(bemCssClasses),
|
|
870
|
+
onClick
|
|
871
|
+
}), {
|
|
872
|
+
default: withCtx(() => [
|
|
873
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
874
|
+
_ctx.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
|
|
875
|
+
_ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$2, {
|
|
876
|
+
key: 0,
|
|
877
|
+
class: "vv-button__loading-icon",
|
|
878
|
+
name: _ctx.loadingIcon
|
|
879
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
880
|
+
_ctx.loadingLabel ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(_ctx.loadingLabel), 1)) : createCommentVNode("", true)
|
|
881
|
+
]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
882
|
+
renderSlot(_ctx.$slots, "before"),
|
|
883
|
+
unref(icon) ? (openBlock(), createBlock(_sfc_main$2, mergeProps({
|
|
884
|
+
key: 0,
|
|
885
|
+
class: "vv-button__icon"
|
|
886
|
+
}, unref(hasIconProps)), null, 16)) : createCommentVNode("", true),
|
|
887
|
+
unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2, [
|
|
888
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
889
|
+
createTextVNode(toDisplayString(unref(label)), 1)
|
|
890
|
+
])
|
|
891
|
+
])) : createCommentVNode("", true),
|
|
892
|
+
renderSlot(_ctx.$slots, "after")
|
|
893
|
+
], 64))
|
|
894
|
+
])
|
|
895
|
+
]),
|
|
896
|
+
_: 3
|
|
897
|
+
}, 16, ["id", "class"]);
|
|
898
|
+
};
|
|
440
899
|
}
|
|
441
900
|
});
|
|
442
901
|
export {
|
|
443
|
-
|
|
902
|
+
_sfc_main as default
|
|
444
903
|
};
|