@volverjs/ui-vue 0.0.4 → 0.0.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +19 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
- 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 +264 -164
- 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 +266 -98
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
- package/dist/components/VvAction/index.d.ts +2 -2
- package/dist/components/VvBadge/VvBadge.es.js +203 -44
- 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 +237 -75
- 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 +636 -360
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
- package/dist/components/VvButton/index.d.ts +13 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +251 -79
- 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 +57 -38
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +552 -274
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
- package/dist/components/VvCheckbox/index.d.ts +5 -5
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +651 -340
- 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 +3 -3
- package/dist/components/VvCombobox/VvCombobox.es.js +1532 -983
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +125 -51
- package/dist/components/VvCombobox/index.d.ts +36 -10
- package/dist/components/VvDialog/VvDialog.es.js +377 -141
- 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 +440 -244
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +113 -41
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
- package/dist/components/VvDropdown/index.d.ts +35 -11
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +363 -160
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +275 -90
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +113 -65
- 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 +974 -460
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +96 -16
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +64 -11
- package/dist/components/VvProgress/VvProgress.es.js +206 -45
- 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 +489 -238
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
- package/dist/components/VvRadio/index.d.ts +5 -5
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +588 -304
- 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 +3 -3
- package/dist/components/VvSelect/VvSelect.es.js +621 -324
- 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 +3 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +664 -353
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
- package/dist/components/VvTextarea/index.d.ts +2 -2
- package/dist/components/VvTooltip/VvTooltip.es.js +205 -47
- 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 +3508 -2231
- 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/directives/index.es.js +215 -55
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +212 -53
- package/dist/directives/v-tooltip.umd.js +1 -1
- 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 +112 -3607
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +40 -16
- package/dist/resolvers/unplugin.d.ts +7 -1
- package/dist/resolvers/unplugin.es.js +77 -37
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +1 -1
- package/package.json +114 -36
- package/src/Volver.ts +49 -22
- 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 +7 -7
- package/src/components/VvAction/index.ts +1 -1
- 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 +11 -11
- package/src/components/VvButton/index.ts +10 -9
- 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 +39 -23
- package/src/components/VvCombobox/index.ts +1 -1
- 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 +7 -5
- package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
- package/src/components/VvDropdown/index.ts +3 -3
- 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 +1 -1
- 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 +2 -2
- 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 +4 -2
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- 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 +8 -8
- package/src/resolvers/unplugin.ts +15 -1
- 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 +1 -1
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +40 -0
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/argTypes.ts +2 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { inject
|
|
2
|
-
import { iconExists
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, Transition, toHandlers, withCtx, withDirectives, createElementVNode, createElementBlock, renderSlot, createTextVNode, toDisplayString, createVNode, vShow } from "vue";
|
|
2
|
+
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
|
+
import { onClickOutside, onKeyStroke } from "@vueuse/core";
|
|
4
|
+
const VvIconProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Color
|
|
7
7
|
*/
|
|
@@ -25,7 +25,7 @@ const G = {
|
|
|
25
25
|
*/
|
|
26
26
|
name: {
|
|
27
27
|
type: String,
|
|
28
|
-
required:
|
|
28
|
+
required: true
|
|
29
29
|
},
|
|
30
30
|
/**
|
|
31
31
|
* By default 'vv'
|
|
@@ -95,77 +95,160 @@ const G = {
|
|
|
95
95
|
type: [String, Array]
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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 AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
128
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
129
|
+
AnchorTarget2["_self"] = "_self";
|
|
130
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
131
|
+
AnchorTarget2["_top"] = "_top";
|
|
132
|
+
return AnchorTarget2;
|
|
133
|
+
})(AnchorTarget || {});
|
|
134
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
135
|
+
function useVolver() {
|
|
136
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
102
137
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
105
|
-
const
|
|
106
|
-
[
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
138
|
+
function useModifiers(prefix, modifiers, others) {
|
|
139
|
+
return computed(() => {
|
|
140
|
+
const toReturn = {
|
|
141
|
+
[prefix]: true
|
|
142
|
+
};
|
|
143
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
144
|
+
if (modifiersArray) {
|
|
145
|
+
if (Array.isArray(modifiersArray)) {
|
|
146
|
+
modifiersArray.forEach((modifier) => {
|
|
147
|
+
if (modifier) {
|
|
148
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (others) {
|
|
154
|
+
Object.keys(others.value).forEach((key) => {
|
|
155
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return toReturn;
|
|
113
159
|
});
|
|
114
160
|
}
|
|
115
|
-
const
|
|
161
|
+
const __default__$1 = {
|
|
116
162
|
name: "VvIcon"
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
163
|
+
};
|
|
164
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
165
|
+
...__default__$1,
|
|
166
|
+
props: VvIconProps,
|
|
167
|
+
setup(__props) {
|
|
168
|
+
const props = __props;
|
|
169
|
+
const show = ref(true);
|
|
170
|
+
const volver = useVolver();
|
|
171
|
+
const { modifiers } = toRefs(props);
|
|
172
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
173
|
+
const provider = computed(() => {
|
|
174
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
175
|
+
});
|
|
176
|
+
const icon = computed(() => {
|
|
177
|
+
const _name = props.name ?? "";
|
|
178
|
+
const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
|
|
179
|
+
if (iconExists(_name)) {
|
|
180
|
+
return _name;
|
|
181
|
+
} else if (iconExists(iconName)) {
|
|
182
|
+
return iconName;
|
|
183
|
+
} else {
|
|
184
|
+
return (volver == null ? void 0 : volver.iconsCollections.find(
|
|
185
|
+
(iconsCollection) => {
|
|
186
|
+
const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
|
|
187
|
+
if (iconExists(icon2)) {
|
|
188
|
+
return icon2;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
)) || _name;
|
|
192
|
+
}
|
|
130
193
|
});
|
|
131
|
-
function
|
|
132
|
-
let
|
|
133
|
-
if (typeof window
|
|
134
|
-
const { JSDOM
|
|
135
|
-
|
|
194
|
+
function getSvgContent(svg) {
|
|
195
|
+
let dom = null;
|
|
196
|
+
if (typeof window === "undefined") {
|
|
197
|
+
const { JSDOM } = require("jsdom");
|
|
198
|
+
dom = new JSDOM().window;
|
|
136
199
|
}
|
|
137
|
-
|
|
200
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
201
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
202
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
203
|
+
return svgEl;
|
|
138
204
|
}
|
|
139
|
-
function
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
205
|
+
function addIconFromSvg(svg) {
|
|
206
|
+
const svgContentEl = getSvgContent(svg);
|
|
207
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
208
|
+
if (svgContentEl && svgContent) {
|
|
209
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
210
|
+
body: svgContent,
|
|
211
|
+
// Set height and width from svg content
|
|
212
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
213
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
214
|
+
});
|
|
215
|
+
}
|
|
147
216
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
217
|
+
if (volver) {
|
|
218
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
219
|
+
show.value = false;
|
|
220
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
221
|
+
if (svg) {
|
|
222
|
+
addIconFromSvg(svg);
|
|
223
|
+
show.value = true;
|
|
224
|
+
}
|
|
225
|
+
}).catch((e) => {
|
|
226
|
+
throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
|
|
227
|
+
});
|
|
228
|
+
} else if (props.svg) {
|
|
229
|
+
addIconFromSvg(props.svg);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return (_ctx, _cache) => {
|
|
233
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
234
|
+
key: 0,
|
|
235
|
+
class: unref(bemCssClasses)
|
|
236
|
+
}, {
|
|
237
|
+
inline: _ctx.inline,
|
|
238
|
+
width: _ctx.width,
|
|
239
|
+
height: _ctx.height,
|
|
240
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
241
|
+
verticalFlip: _ctx.verticalFlip,
|
|
242
|
+
flip: _ctx.flip,
|
|
243
|
+
rotate: _ctx.rotate,
|
|
244
|
+
color: _ctx.color,
|
|
245
|
+
onLoad: _ctx.onLoad,
|
|
246
|
+
icon: unref(icon)
|
|
247
|
+
}), null, 16, ["class"])) : createCommentVNode("", true);
|
|
248
|
+
};
|
|
167
249
|
}
|
|
168
|
-
})
|
|
250
|
+
});
|
|
251
|
+
const LinkProps = {
|
|
169
252
|
/**
|
|
170
253
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
171
254
|
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
@@ -182,7 +265,7 @@ const X = {
|
|
|
182
265
|
*/
|
|
183
266
|
target: {
|
|
184
267
|
type: String,
|
|
185
|
-
validator: (
|
|
268
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
186
269
|
},
|
|
187
270
|
/**
|
|
188
271
|
* Anchor rel
|
|
@@ -191,49 +274,157 @@ const X = {
|
|
|
191
274
|
type: String,
|
|
192
275
|
default: "noopener noreferrer"
|
|
193
276
|
}
|
|
194
|
-
}
|
|
277
|
+
};
|
|
278
|
+
const DisabledProps = {
|
|
195
279
|
/**
|
|
196
280
|
* Whether the form control is disabled
|
|
197
281
|
*/
|
|
198
282
|
disabled: Boolean
|
|
199
|
-
}
|
|
283
|
+
};
|
|
284
|
+
const ActiveProps = {
|
|
200
285
|
/**
|
|
201
286
|
* Whether the item is active
|
|
202
287
|
*/
|
|
203
288
|
active: Boolean
|
|
204
|
-
}
|
|
289
|
+
};
|
|
290
|
+
const PressedProps = {
|
|
205
291
|
/**
|
|
206
292
|
* Whether the item is pressed
|
|
207
293
|
*/
|
|
208
294
|
pressed: Boolean
|
|
209
|
-
}
|
|
295
|
+
};
|
|
296
|
+
const LabelProps = {
|
|
210
297
|
/**
|
|
211
298
|
* The item label
|
|
212
299
|
*/
|
|
213
300
|
label: [String, Number]
|
|
214
301
|
};
|
|
215
|
-
|
|
216
|
-
|
|
302
|
+
({
|
|
303
|
+
/**
|
|
304
|
+
* VvIcon name or props
|
|
305
|
+
* @see VVIcon
|
|
306
|
+
*/
|
|
307
|
+
icon: { type: [String, Object] },
|
|
308
|
+
/**
|
|
309
|
+
* VvIcon position
|
|
310
|
+
*/
|
|
311
|
+
iconPosition: {
|
|
312
|
+
type: String,
|
|
313
|
+
default: Position.before,
|
|
314
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
const IdProps = {
|
|
217
318
|
/**
|
|
218
319
|
* Global attribute id
|
|
219
320
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
220
321
|
*/
|
|
221
322
|
id: [String, Number]
|
|
222
323
|
};
|
|
223
|
-
w.bottom;
|
|
224
324
|
({
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
325
|
+
/**
|
|
326
|
+
* Dropdown placement
|
|
327
|
+
*/
|
|
328
|
+
placement: {
|
|
329
|
+
type: String,
|
|
330
|
+
default: Side.bottom,
|
|
331
|
+
validator: (value) => {
|
|
332
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
/**
|
|
336
|
+
* Dropdown show / hide transition name
|
|
337
|
+
*/
|
|
338
|
+
transitionName: {
|
|
339
|
+
type: String
|
|
340
|
+
},
|
|
341
|
+
/**
|
|
342
|
+
* Offset of the dropdown from the trigger
|
|
343
|
+
* @see https://floating-ui.com/docs/offset
|
|
344
|
+
*/
|
|
345
|
+
offset: {
|
|
346
|
+
type: [Number, String, Object],
|
|
347
|
+
default: 0
|
|
348
|
+
},
|
|
349
|
+
/**
|
|
350
|
+
* Move dropdown to the side if there is no space in the default position
|
|
351
|
+
* @see https://floating-ui.com/docs/shift
|
|
352
|
+
*/
|
|
353
|
+
shift: {
|
|
354
|
+
type: [Boolean, Object],
|
|
355
|
+
default: false
|
|
356
|
+
},
|
|
357
|
+
/**
|
|
358
|
+
* Flip dropdown position if there is no space in the default position
|
|
359
|
+
* @see https://floating-ui.com/docs/flip
|
|
360
|
+
*/
|
|
361
|
+
flip: {
|
|
362
|
+
type: [Boolean, Object],
|
|
363
|
+
default: true
|
|
364
|
+
},
|
|
365
|
+
/**
|
|
366
|
+
* Size of the dropdown
|
|
367
|
+
* @see https://floating-ui.com/docs/size
|
|
368
|
+
*/
|
|
369
|
+
size: {
|
|
370
|
+
type: [Boolean, Object],
|
|
371
|
+
default: () => ({ padding: 10 })
|
|
372
|
+
},
|
|
373
|
+
/**
|
|
374
|
+
* Automatically change the position of the dropdown
|
|
375
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
376
|
+
*/
|
|
377
|
+
autoPlacement: {
|
|
378
|
+
type: [Boolean, Object],
|
|
379
|
+
default: false
|
|
380
|
+
},
|
|
381
|
+
/**
|
|
382
|
+
* Add arrow to the dropdown
|
|
383
|
+
* @see https://floating-ui.com/docs/arrow
|
|
384
|
+
*/
|
|
385
|
+
arrow: {
|
|
386
|
+
type: Boolean,
|
|
387
|
+
default: false
|
|
388
|
+
},
|
|
389
|
+
/**
|
|
390
|
+
* Close dropdown on click outside
|
|
391
|
+
*/
|
|
392
|
+
autoClose: {
|
|
393
|
+
type: Boolean,
|
|
394
|
+
default: true
|
|
395
|
+
},
|
|
396
|
+
/**
|
|
397
|
+
* Autofocus first item on dropdown open
|
|
398
|
+
*/
|
|
399
|
+
autofocusFirst: {
|
|
400
|
+
type: Boolean,
|
|
401
|
+
default: true
|
|
402
|
+
},
|
|
403
|
+
/**
|
|
404
|
+
* Set dropdown width to the same as the trigger
|
|
405
|
+
*/
|
|
406
|
+
triggerWidth: {
|
|
407
|
+
type: Boolean
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
({
|
|
411
|
+
...DisabledProps,
|
|
412
|
+
...LabelProps,
|
|
413
|
+
...PressedProps,
|
|
414
|
+
...ActiveProps,
|
|
415
|
+
...LinkProps,
|
|
230
416
|
/**
|
|
231
417
|
* Button type
|
|
232
418
|
*/
|
|
233
|
-
type:
|
|
419
|
+
type: {
|
|
420
|
+
type: String,
|
|
421
|
+
default: ButtonType.button,
|
|
422
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
423
|
+
}
|
|
234
424
|
});
|
|
235
|
-
const
|
|
236
|
-
|
|
425
|
+
const VvDialogEvents = ["open", "close", "update:modelValue"];
|
|
426
|
+
const VvDialogProps = {
|
|
427
|
+
...IdProps,
|
|
237
428
|
/**
|
|
238
429
|
* Dialog title
|
|
239
430
|
*/
|
|
@@ -241,7 +432,10 @@ const ae = ["open", "close", "update:modelValue"], le = {
|
|
|
241
432
|
/**
|
|
242
433
|
* Show / hide dialog programmatically
|
|
243
434
|
*/
|
|
244
|
-
modelValue:
|
|
435
|
+
modelValue: {
|
|
436
|
+
type: Boolean,
|
|
437
|
+
default: void 0
|
|
438
|
+
},
|
|
245
439
|
/**
|
|
246
440
|
* Dialog transition
|
|
247
441
|
*/
|
|
@@ -253,78 +447,120 @@ const ae = ["open", "close", "update:modelValue"], le = {
|
|
|
253
447
|
/**
|
|
254
448
|
* Close dialog on click outside
|
|
255
449
|
*/
|
|
256
|
-
autoClose: { type: Boolean, default:
|
|
257
|
-
}
|
|
450
|
+
autoClose: { type: Boolean, default: true }
|
|
451
|
+
};
|
|
452
|
+
const _hoisted_1 = {
|
|
258
453
|
key: 0,
|
|
259
454
|
class: "vv-dialog__header"
|
|
260
|
-
}
|
|
455
|
+
};
|
|
456
|
+
const _hoisted_2 = { class: "vv-dialog__content" };
|
|
457
|
+
const _hoisted_3 = {
|
|
261
458
|
key: 1,
|
|
262
459
|
class: "vv-dialog__footer"
|
|
263
|
-
}
|
|
460
|
+
};
|
|
461
|
+
const __default__ = {
|
|
264
462
|
name: "VvDialog"
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
463
|
+
};
|
|
464
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
465
|
+
...__default__,
|
|
466
|
+
props: VvDialogProps,
|
|
467
|
+
emits: VvDialogEvents,
|
|
468
|
+
setup(__props, { expose, emit }) {
|
|
469
|
+
const props = __props;
|
|
470
|
+
const localModelValue = ref(false);
|
|
471
|
+
const modelValue = computed({
|
|
472
|
+
get() {
|
|
473
|
+
return props.modelValue ?? localModelValue.value;
|
|
474
|
+
},
|
|
475
|
+
set(value) {
|
|
476
|
+
if (props.modelValue === void 0) {
|
|
477
|
+
localModelValue.value = value;
|
|
478
|
+
}
|
|
479
|
+
emit("update:modelValue", value);
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
const htmlAttrIsOpen = ref(true);
|
|
483
|
+
const modalWrapper = ref(null);
|
|
484
|
+
const dialogAttrs = computed(() => {
|
|
485
|
+
const { id } = props;
|
|
272
486
|
return {
|
|
273
|
-
id
|
|
274
|
-
open:
|
|
487
|
+
id,
|
|
488
|
+
open: htmlAttrIsOpen.value
|
|
275
489
|
};
|
|
276
|
-
})
|
|
490
|
+
});
|
|
491
|
+
const dialogClass = computed(() => {
|
|
492
|
+
if (!props.size) {
|
|
493
|
+
return "vv-dialog";
|
|
494
|
+
}
|
|
495
|
+
return ["vv-dialog", `vv-dialog--${props.size}`];
|
|
496
|
+
});
|
|
497
|
+
const transitioName = computed(() => `vv-dialog--${props.transition}`);
|
|
498
|
+
const dialogTransitionHandlers = {
|
|
277
499
|
"before-enter": () => {
|
|
278
|
-
|
|
500
|
+
htmlAttrIsOpen.value = true;
|
|
501
|
+
emit("open");
|
|
279
502
|
},
|
|
280
503
|
"after-leave": () => {
|
|
281
|
-
|
|
504
|
+
htmlAttrIsOpen.value = false;
|
|
505
|
+
emit("close");
|
|
282
506
|
}
|
|
283
507
|
};
|
|
284
|
-
|
|
285
|
-
|
|
508
|
+
onClickOutside(modalWrapper, () => {
|
|
509
|
+
if (props.autoClose) {
|
|
510
|
+
modelValue.value = false;
|
|
511
|
+
}
|
|
286
512
|
});
|
|
287
|
-
function
|
|
288
|
-
|
|
513
|
+
function close() {
|
|
514
|
+
modelValue.value = false;
|
|
515
|
+
}
|
|
516
|
+
function open() {
|
|
517
|
+
modelValue.value = true;
|
|
289
518
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
519
|
+
expose({ close, open });
|
|
520
|
+
onKeyStroke("Escape", (e) => {
|
|
521
|
+
if (modelValue.value) {
|
|
522
|
+
e.preventDefault();
|
|
523
|
+
close();
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
return (_ctx, _cache) => {
|
|
527
|
+
return openBlock(), createBlock(Transition, mergeProps({ name: unref(transitioName) }, toHandlers(dialogTransitionHandlers)), {
|
|
528
|
+
default: withCtx(() => [
|
|
529
|
+
withDirectives(createElementVNode("dialog", mergeProps(unref(dialogAttrs), { class: unref(dialogClass) }), [
|
|
530
|
+
createElementVNode("article", {
|
|
531
|
+
ref_key: "modalWrapper",
|
|
532
|
+
ref: modalWrapper,
|
|
533
|
+
class: "vv-dialog__wrapper"
|
|
534
|
+
}, [
|
|
535
|
+
_ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header", _hoisted_1, [
|
|
536
|
+
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
537
|
+
createTextVNode(toDisplayString(_ctx.title) + " ", 1),
|
|
538
|
+
createElementVNode("button", {
|
|
539
|
+
type: "button",
|
|
540
|
+
"aria-label": "Close",
|
|
541
|
+
class: "vv-dialog__close",
|
|
542
|
+
onClickPassive: close
|
|
543
|
+
}, [
|
|
544
|
+
createVNode(_sfc_main$1, { name: "close" })
|
|
545
|
+
], 32)
|
|
546
|
+
])
|
|
547
|
+
])) : createCommentVNode("", true),
|
|
548
|
+
createElementVNode("div", _hoisted_2, [
|
|
549
|
+
renderSlot(_ctx.$slots, "default")
|
|
550
|
+
]),
|
|
551
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_3, [
|
|
552
|
+
renderSlot(_ctx.$slots, "footer")
|
|
553
|
+
])) : createCommentVNode("", true)
|
|
554
|
+
], 512)
|
|
555
|
+
], 16), [
|
|
556
|
+
[vShow, unref(modelValue)]
|
|
557
|
+
])
|
|
558
|
+
]),
|
|
559
|
+
_: 3
|
|
560
|
+
}, 16, ["name"]);
|
|
561
|
+
};
|
|
326
562
|
}
|
|
327
563
|
});
|
|
328
564
|
export {
|
|
329
|
-
|
|
565
|
+
_sfc_main as default
|
|
330
566
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("vue"),require("@iconify/vue"),require("@vueuse/core")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDialog=o(e.vue,e.vue$1,e.core)}(this,(function(e,o,t){"use strict";const n={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var r=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(r||{}),l=(e=>(e.before="before",e.after="after",e))(l||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{});const a=Symbol.for("volver");const s=e.defineComponent({name:"VvIcon",props:n,setup(t){const n=t,r=e.ref(!0),l=e.inject(a),{modifiers:i}=e.toRefs(n),s=function(o,t,n){return e.computed((()=>{const r={[o]:!0},l="string"==typeof(null==t?void 0:t.value)?t.value.split(" "):null==t?void 0:t.value;return l&&Array.isArray(l)&&l.forEach((e=>{e&&(r[`${o}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((t=>{r[`${o}--${t}`]=e.unref(n.value[t])})),r}))}("vv-icon",i),u=e.computed((()=>n.provider||(null==l?void 0:l.iconsProvider))),c=e.computed((()=>{const e=n.name??"",t=`@${u.value}:${n.prefix}:${n.name}`;return o.iconExists(e)?e:o.iconExists(t)?t:(null==l?void 0:l.iconsCollections.find((t=>{const n=`@${u.value}:${t.prefix}:${e}`;if(o.iconExists(n))return n})))||e}));function d(e){const t=function(e){let o=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");o=(new e).window}return(o?new o.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),r=(null==t?void 0:t.innerHTML.trim())||"";t&&r&&o.addIcon(`@${u.value}:${n.prefix}:${n.name}`,{body:r,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return l&&(n.src&&!o.iconExists(`@${u.value}:${n.prefix}:${n.name}`)?(r.value=!1,l.fetchIcon(n.src).then((e=>{e&&(d(e),r.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):n.svg&&d(n.svg)),(t,n)=>e.unref(r)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(s)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:t.rotate,color:t.color,onLoad:t.onLoad,icon:e.unref(c)}),null,16,["class"])):e.createCommentVNode("",!0)}});Boolean,Boolean,Boolean;l.before;const u={id:[String,Number]};r.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,i.button;const c={...u,title:String,modelValue:{type:Boolean,default:void 0},transition:{type:String,default:"fade-block"},size:String,autoClose:{type:Boolean,default:!0}},d={key:0,class:"vv-dialog__header"},f={class:"vv-dialog__content"},v={key:1,class:"vv-dialog__footer"};return e.defineComponent({name:"VvDialog",props:c,emits:["open","close","update:modelValue"],setup(o,{expose:n,emit:r}){const l=o,i=e.ref(!1),a=e.computed({get:()=>l.modelValue??i.value,set(e){void 0===l.modelValue&&(i.value=e),r("update:modelValue",e)}}),u=e.ref(!0),c=e.ref(null),p=e.computed((()=>{const{id:e}=l;return{id:e,open:u.value}})),m=e.computed((()=>l.size?["vv-dialog",`vv-dialog--${l.size}`]:"vv-dialog")),g=e.computed((()=>`vv-dialog--${l.transition}`)),h={"before-enter":()=>{u.value=!0,r("open")},"after-leave":()=>{u.value=!1,r("close")}};function y(){a.value=!1}return t.onClickOutside(c,(()=>{l.autoClose&&(a.value=!1)})),n({close:y,open:function(){a.value=!0}}),t.onKeyStroke("Escape",(e=>{a.value&&(e.preventDefault(),y())})),(o,t)=>(e.openBlock(),e.createBlock(e.Transition,e.mergeProps({name:e.unref(g)},e.toHandlers(h)),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("dialog",e.mergeProps(e.unref(p),{class:e.unref(m)}),[e.createElementVNode("article",{ref_key:"modalWrapper",ref:c,class:"vv-dialog__wrapper"},[o.$slots.header||o.title?(e.openBlock(),e.createElementBlock("header",d,[e.renderSlot(o.$slots,"header",{},(()=>[e.createTextVNode(e.toDisplayString(o.title)+" ",1),e.createElementVNode("button",{type:"button","aria-label":"Close",class:"vv-dialog__close",onClickPassive:y},[e.createVNode(s,{name:"close"})],32)]))])):e.createCommentVNode("",!0),e.createElementVNode("div",f,[e.renderSlot(o.$slots,"default")]),o.$slots.footer?(e.openBlock(),e.createElementBlock("footer",v,[e.renderSlot(o.$slots,"footer")])):e.createCommentVNode("",!0)],512)],16),[[e.vShow,e.unref(a)]])])),_:3},16,["name"]))}})}));
|