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