@volverjs/ui-vue 0.0.11 → 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.
Files changed (55) hide show
  1. package/bin/icons.js +1 -93
  2. package/dist/components/VvAccordion/VvAccordion.es.js +1 -366
  3. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +2 -702
  4. package/dist/components/VvAction/VvAction.es.js +1 -302
  5. package/dist/components/VvAlert/VvAlert.es.js +1 -527
  6. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +1 -730
  7. package/dist/components/VvAvatar/VvAvatar.es.js +1 -132
  8. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +1 -250
  9. package/dist/components/VvBadge/VvBadge.es.js +1 -131
  10. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +1 -410
  11. package/dist/components/VvButton/VvButton.es.js +1 -882
  12. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +1 -214
  13. package/dist/components/VvCard/VvCard.es.js +1 -152
  14. package/dist/components/VvCheckbox/VvCheckbox.es.js +1 -741
  15. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +1 -981
  16. package/dist/components/VvCombobox/VvCombobox.es.js +1 -3463
  17. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  18. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +8 -1
  19. package/dist/components/VvDialog/VvDialog.es.js +1 -317
  20. package/dist/components/VvDropdown/VvDropdown.es.js +1 -750
  21. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -2
  22. package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +9 -2
  23. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +1 -448
  24. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +1 -149
  25. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +1 -104
  26. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  27. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +1 -281
  28. package/dist/components/VvIcon/VvIcon.es.js +1 -143
  29. package/dist/components/VvInputFile/VvInputFile.es.js +1 -1704
  30. package/dist/components/VvInputText/VvInputText.es.js +4 -2790
  31. package/dist/components/VvNav/VvNav.es.js +1 -438
  32. package/dist/components/VvNavItem/VvNavItem.es.js +1 -337
  33. package/dist/components/VvNavSeparator/VvNavSeparator.es.js +1 -24
  34. package/dist/components/VvProgress/VvProgress.es.js +1 -163
  35. package/dist/components/VvRadio/VvRadio.es.js +1 -661
  36. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +1 -901
  37. package/dist/components/VvSelect/VvSelect.es.js +1 -1103
  38. package/dist/components/VvSelect/VvSelect.vue.d.ts +3 -1
  39. package/dist/components/VvTab/VvTab.es.js +1 -558
  40. package/dist/components/VvTextarea/VvTextarea.es.js +2 -1989
  41. package/dist/components/VvTooltip/VvTooltip.es.js +1 -154
  42. package/dist/components/index.es.js +6 -8558
  43. package/dist/components/index.umd.js +1 -1
  44. package/dist/composables/index.es.js +2 -247
  45. package/dist/composables/index.umd.js +1 -1
  46. package/dist/directives/index.es.js +2 -311
  47. package/dist/directives/index.umd.js +1 -1
  48. package/dist/directives/v-contextmenu.es.js +2 -142
  49. package/dist/directives/v-contextmenu.umd.js +1 -1
  50. package/dist/directives/v-tooltip.es.js +1 -172
  51. package/dist/icons.es.js +1 -39
  52. package/dist/icons.umd.js +1 -1
  53. package/dist/index.es.js +1 -219
  54. package/dist/resolvers/unplugin.es.js +1 -187
  55. package/package.json +33 -33
@@ -1,730 +1 @@
1
- import { provide, computed, unref, inject, useId, watch, ref, defineComponent, mergeDefaults, toRefs, createBlock, createCommentVNode, openBlock, mergeProps, createElementBlock, normalizeProps, guardReactiveProps, renderSlot, createTextVNode, toDisplayString, withModifiers, createElementVNode, createVNode, TransitionGroup, toHandlers, withCtx, Fragment, renderList } from "vue";
2
- import mitt from "mitt";
3
- import { iconLoaded, Icon, addIcon } from "@iconify/vue";
4
- const VvIconPropsDefaults = {
5
- prefix: "normal"
6
- /* normal */
7
- };
8
- var StorageType = /* @__PURE__ */ ((StorageType2) => {
9
- StorageType2["local"] = "local";
10
- StorageType2["session"] = "session";
11
- return StorageType2;
12
- })(StorageType || {});
13
- var Side = /* @__PURE__ */ ((Side2) => {
14
- Side2["left"] = "left";
15
- Side2["right"] = "right";
16
- Side2["top"] = "top";
17
- Side2["bottom"] = "bottom";
18
- return Side2;
19
- })(Side || {});
20
- var Position = /* @__PURE__ */ ((Position2) => {
21
- Position2["before"] = "before";
22
- Position2["after"] = "after";
23
- return Position2;
24
- })(Position || {});
25
- var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
26
- ButtonType2["button"] = "button";
27
- ButtonType2["submit"] = "submit";
28
- ButtonType2["reset"] = "reset";
29
- return ButtonType2;
30
- })(ButtonType || {});
31
- var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
32
- ActionTag2["nuxtLink"] = "nuxt-link";
33
- ActionTag2["routerLink"] = "router-link";
34
- ActionTag2["a"] = "a";
35
- ActionTag2["button"] = "button";
36
- return ActionTag2;
37
- })(ActionTag || {});
38
- var AlertRole = /* @__PURE__ */ ((AlertRole2) => {
39
- AlertRole2["alert"] = "alert";
40
- AlertRole2["alertdialog"] = "alertdialog";
41
- return AlertRole2;
42
- })(AlertRole || {});
43
- const INJECTION_KEY_VOLVER = Symbol.for("volver");
44
- const INJECTION_KEY_ALERT_GROUP = Symbol.for(
45
- "alertGroup"
46
- );
47
- const ModifiersProps = {
48
- /**
49
- * Component BEM modifiers
50
- */
51
- modifiers: {
52
- type: [String, Array],
53
- default: void 0
54
- }
55
- };
56
- const IconProps = {
57
- /**
58
- * VvIcon name or props
59
- * @see VvIcon
60
- */
61
- icon: {
62
- type: [String, Object],
63
- default: void 0
64
- },
65
- /**
66
- * VvIcon position
67
- */
68
- iconPosition: {
69
- type: String,
70
- default: Position.before,
71
- validation: (value) => Object.values(Position).includes(value)
72
- }
73
- };
74
- const IdProps = {
75
- /**
76
- * Global attribute id
77
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
78
- */
79
- id: [String, Number]
80
- };
81
- ({
82
- /**
83
- * Dropdown placement
84
- */
85
- placement: {
86
- default: Side.bottom
87
- }
88
- });
89
- ({
90
- /**
91
- * Button type
92
- */
93
- type: {
94
- default: ButtonType.button
95
- },
96
- /**
97
- * Default tag for the action
98
- */
99
- defaultTag: {
100
- default: ActionTag.button
101
- }
102
- });
103
- ({
104
- storageType: {
105
- default: StorageType.local
106
- }
107
- });
108
- function useAlertProvideGroup({
109
- name
110
- }) {
111
- const bus = mitt();
112
- provide(INJECTION_KEY_ALERT_GROUP, {
113
- name,
114
- bus
115
- });
116
- return bus;
117
- }
118
- function useModifiers(prefix, modifiers, others) {
119
- return computed(() => {
120
- const toReturn = {
121
- [prefix]: true
122
- };
123
- const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
124
- if (modifiersArray) {
125
- if (Array.isArray(modifiersArray)) {
126
- modifiersArray.forEach((modifier) => {
127
- if (modifier) {
128
- toReturn[`${prefix}--${modifier}`] = true;
129
- }
130
- });
131
- }
132
- }
133
- if (others) {
134
- Object.keys(others.value).forEach((key) => {
135
- toReturn[`${prefix}--${key}`] = unref(others.value[key]);
136
- });
137
- }
138
- return toReturn;
139
- });
140
- }
141
- const VvAlertGroupProps = {
142
- ...ModifiersProps,
143
- name: {
144
- type: String,
145
- required: true
146
- },
147
- items: {
148
- type: Array,
149
- default: () => []
150
- },
151
- stack: {
152
- type: Boolean,
153
- default: false
154
- },
155
- reverse: {
156
- type: Boolean,
157
- default: false
158
- },
159
- inline: {
160
- type: String,
161
- default: void 0
162
- },
163
- block: {
164
- type: String,
165
- default: void 0
166
- },
167
- position: {
168
- type: String,
169
- default: void 0
170
- },
171
- transition: {
172
- type: String,
173
- default: void 0
174
- }
175
- };
176
- const VvAlertGroupEvents = [
177
- "close",
178
- "beforeEnter",
179
- "afterLeave",
180
- "enter",
181
- "afterEnter",
182
- "enterCancelled",
183
- "beforeLeave",
184
- "leave",
185
- "leaveCancelled"
186
- ];
187
- function useVvAlertGroup(props, emit) {
188
- const bus = useAlertProvideGroup({ name: computed(() => props.name) });
189
- if (props.block && !props.inline || !props.block && props.inline) {
190
- console.warn(
191
- `[VvAlertGroup]: block and inline props must coexist at the same time.`
192
- );
193
- }
194
- const hasClass = computed(() => {
195
- const toReturn = [
196
- useModifiers(
197
- "vv-alert-group",
198
- computed(() => props.modifiers),
199
- computed(() => ({
200
- stack: props.stack,
201
- reverse: props.reverse,
202
- absolute: props.position === "absolute",
203
- fixed: props.position === "fixed"
204
- }))
205
- ).value
206
- ];
207
- if (props.inline && props.block) {
208
- toReturn.push(`vv-alert-group--${props.block}-${props.inline}`);
209
- }
210
- return toReturn;
211
- });
212
- const hasTransition = computed(() => {
213
- if (props.transition) {
214
- return props.transition;
215
- }
216
- if (!props.position) {
217
- return "vv-alert--fade";
218
- }
219
- if (props.inline === "start") {
220
- return "vv-alert--fade-inline-start";
221
- }
222
- if (props.inline === "end") {
223
- return "vv-alert--fade-inline-end";
224
- }
225
- if (props.block === "top") {
226
- return "vv-alert--fade-block-top";
227
- }
228
- if (props.block === "bottom") {
229
- return "vv-alert--fade-block-bottom";
230
- }
231
- return "vv-alert--fade";
232
- });
233
- bus.on("close", (id) => {
234
- emit("close", id);
235
- });
236
- return {
237
- hasTransition,
238
- hasProps: computed(() => ({
239
- class: hasClass.value
240
- }))
241
- };
242
- }
243
- function useInjectedAlertGroup() {
244
- return inject(INJECTION_KEY_ALERT_GROUP, {});
245
- }
246
- function useUniqueId(id) {
247
- return computed(() => String(id?.value || useId()));
248
- }
249
- function useComponentIcon(icon, iconPosition) {
250
- const hasIcon = computed(() => {
251
- if (typeof icon?.value === "string") {
252
- return { name: icon?.value };
253
- }
254
- return icon?.value;
255
- });
256
- const hasIconBefore = computed(
257
- () => iconPosition?.value === Position.before ? hasIcon.value : void 0
258
- );
259
- const hasIconAfter = computed(
260
- () => iconPosition?.value === Position.after ? hasIcon.value : void 0
261
- );
262
- const hasIconLeft = computed(
263
- () => iconPosition?.value === Side.left ? hasIcon.value : void 0
264
- );
265
- const hasIconRight = computed(
266
- () => iconPosition?.value === Side.right ? hasIcon.value : void 0
267
- );
268
- const hasIconTop = computed(
269
- () => iconPosition?.value === Side.top ? hasIcon.value : void 0
270
- );
271
- const hasIconBottom = computed(
272
- () => iconPosition?.value === Side.bottom ? hasIcon.value : void 0
273
- );
274
- return {
275
- hasIcon,
276
- hasIconLeft,
277
- hasIconRight,
278
- hasIconTop,
279
- hasIconBottom,
280
- hasIconBefore,
281
- hasIconAfter
282
- };
283
- }
284
- const VvAlertProps = {
285
- ...IdProps,
286
- ...IconProps,
287
- /**
288
- * Component BEM modifiers
289
- */
290
- modifiers: {
291
- type: [String, Array],
292
- default: void 0
293
- },
294
- /**
295
- * The alert is dismissable
296
- * @default false
297
- * @type boolean
298
- */
299
- dismissable: {
300
- type: Boolean,
301
- default: false
302
- },
303
- /**
304
- * The alert auto close after the specified time in milliseconds
305
- * @default 0
306
- * @type number
307
- */
308
- autoClose: {
309
- type: Number,
310
- default: 0
311
- },
312
- /**
313
- * The alert close label
314
- * @default 'Close'
315
- * @type string
316
- */
317
- closeLabel: {
318
- type: String,
319
- default: "Close"
320
- },
321
- /**
322
- * The alert title
323
- * @default ''
324
- * @type string
325
- */
326
- title: {
327
- type: String,
328
- default: void 0
329
- },
330
- /**
331
- * The alert content
332
- * @default ''
333
- * @type string
334
- */
335
- content: {
336
- type: String,
337
- default: void 0
338
- },
339
- /**
340
- * The alert footer
341
- * @default ''
342
- * @type string
343
- */
344
- footer: {
345
- type: String,
346
- default: void 0
347
- },
348
- /**
349
- * The alert role
350
- * @default 'alert'
351
- * @type string
352
- * @values 'alert', 'alertdialog'
353
- * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Alert_Role
354
- * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Alertdialog_role
355
- */
356
- role: {
357
- type: String,
358
- default: AlertRole.alert
359
- }
360
- };
361
- const VvAlertEvents = ["close"];
362
- function useVvAlert(props, emit) {
363
- const { bus } = useInjectedAlertGroup();
364
- const hasId = useUniqueId(computed(() => props.id));
365
- const hasTitleId = computed(() => `${hasId.value}-title`);
366
- let timeout;
367
- const close = () => {
368
- if (timeout) {
369
- clearTimeout(timeout);
370
- }
371
- emit("close", hasId.value);
372
- bus?.emit("close", hasId.value);
373
- };
374
- watch(
375
- () => props.autoClose,
376
- (value) => {
377
- if (value > 0) {
378
- timeout = setTimeout(close, value);
379
- return;
380
- }
381
- if (timeout) {
382
- clearTimeout(timeout);
383
- }
384
- },
385
- {
386
- immediate: true
387
- }
388
- );
389
- const isMouseover = ref(false);
390
- const onMouseover = () => {
391
- isMouseover.value = true;
392
- if (timeout) {
393
- clearTimeout(timeout);
394
- }
395
- };
396
- const onMouseleave = () => {
397
- isMouseover.value = false;
398
- if (props.autoClose > 0) {
399
- timeout = setTimeout(close, props.autoClose);
400
- }
401
- };
402
- const { hasIcon } = useComponentIcon(computed(() => props.icon));
403
- const hasClass = useModifiers(
404
- "vv-alert",
405
- computed(() => props.modifiers),
406
- computed(() => ({
407
- "dismissable": props.autoClose > 0 || props.dismissable,
408
- "auto-close": props.autoClose > 0,
409
- "hover": isMouseover.value
410
- }))
411
- );
412
- const hasStyle = computed(() => ({
413
- "--alert-duration": `${props.autoClose}ms`
414
- }));
415
- return {
416
- close,
417
- hasIcon,
418
- hasTitleId,
419
- hasProps: computed(() => ({
420
- onMouseover,
421
- onMouseleave,
422
- "class": hasClass.value,
423
- "style": hasStyle.value,
424
- "role": props.role,
425
- "aria-labelledby": hasTitleId.value
426
- }))
427
- };
428
- }
429
- function useVolver() {
430
- return inject(INJECTION_KEY_VOLVER, void 0);
431
- }
432
- const __default__$2 = {
433
- name: "VvIcon"
434
- };
435
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
436
- ...__default__$2,
437
- props: /* @__PURE__ */ mergeDefaults({
438
- name: {},
439
- color: {},
440
- width: {},
441
- height: {},
442
- provider: {},
443
- prefix: {},
444
- src: {},
445
- horizontalFlip: { type: Boolean },
446
- verticalFlip: { type: Boolean },
447
- flip: {},
448
- mode: {},
449
- inline: { type: Boolean },
450
- rotate: {},
451
- onLoad: { type: Function },
452
- svg: {},
453
- modifiers: {}
454
- }, VvIconPropsDefaults),
455
- setup(__props) {
456
- const props = __props;
457
- const hasRotate = computed(() => {
458
- if (typeof props.rotate === "string") {
459
- return Number.parseFloat(props.rotate);
460
- }
461
- return props.rotate;
462
- });
463
- const show = ref(true);
464
- const volver = useVolver();
465
- const { modifiers } = toRefs(props);
466
- const bemCssClasses = useModifiers("vv-icon", modifiers);
467
- const provider = computed(() => {
468
- return props.provider || volver?.iconsProvider;
469
- });
470
- const icon = computed(() => {
471
- const name = props.name ?? "";
472
- const iconName = `@${provider.value}:${props.prefix}:${name}`;
473
- if (iconLoaded(iconName)) {
474
- return iconName;
475
- }
476
- const iconsCollection = volver?.iconsCollections.find(
477
- (iconsCollection2) => {
478
- const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
479
- return iconLoaded(icon2);
480
- }
481
- );
482
- if (iconsCollection) {
483
- return `@${provider.value}:${iconsCollection.prefix}:${name}`;
484
- }
485
- return name;
486
- });
487
- function getSvgContent(svg) {
488
- let dom;
489
- if (typeof window === "undefined") {
490
- const { JSDOM } = require("jsdom");
491
- dom = new JSDOM().window;
492
- }
493
- const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
494
- const svgDomString = domParser.parseFromString(svg, "text/html");
495
- const svgEl = svgDomString.querySelector("svg");
496
- return svgEl;
497
- }
498
- function addIconFromSvg(svg) {
499
- const svgContentEl = getSvgContent(svg);
500
- const svgContent = svgContentEl?.innerHTML.trim() || "";
501
- if (svgContentEl && svgContent) {
502
- addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
503
- body: svgContent,
504
- // Set height and width from svg content
505
- height: svgContentEl.viewBox.baseVal.height,
506
- width: svgContentEl.viewBox.baseVal.width
507
- });
508
- }
509
- }
510
- if (volver) {
511
- if (props.src && !iconLoaded(`@${provider.value}:${props.prefix}:${props.name}`)) {
512
- show.value = false;
513
- volver.fetchIcon(props.src).then((svg) => {
514
- if (svg) {
515
- addIconFromSvg(svg);
516
- show.value = true;
517
- }
518
- }).catch((e) => {
519
- throw new Error(`Error during fetch icon: ${e?.message}`);
520
- });
521
- }
522
- }
523
- if (props.svg) {
524
- addIconFromSvg(props.svg);
525
- }
526
- return (_ctx, _cache) => {
527
- return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
528
- key: 0,
529
- class: unref(bemCssClasses)
530
- }, {
531
- inline: __props.inline,
532
- width: __props.width,
533
- height: __props.height,
534
- horizontalFlip: __props.horizontalFlip,
535
- verticalFlip: __props.verticalFlip,
536
- flip: __props.flip,
537
- rotate: unref(hasRotate),
538
- color: __props.color,
539
- icon: unref(icon)
540
- }, { onLoad: __props.onLoad }), null, 16, ["class", "onLoad"])) : createCommentVNode("v-if", true);
541
- };
542
- }
543
- });
544
- const _hoisted_1 = {
545
- key: 0,
546
- class: "vv-alert__header"
547
- };
548
- const _hoisted_2 = ["id"];
549
- const _hoisted_3 = ["aria-label"];
550
- const _hoisted_4 = {
551
- key: 1,
552
- class: "vv-alert__content"
553
- };
554
- const _hoisted_5 = {
555
- key: 2,
556
- class: "vv-alert__footer"
557
- };
558
- const __default__$1 = {
559
- name: "VvAlert"
560
- };
561
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
562
- ...__default__$1,
563
- props: VvAlertProps,
564
- emits: VvAlertEvents,
565
- setup(__props, { expose: __expose, emit: __emit }) {
566
- const props = __props;
567
- const emit = __emit;
568
- const { hasProps, hasTitleId, hasIcon, close } = useVvAlert(props, emit);
569
- __expose({ close });
570
- return (_ctx, _cache) => {
571
- return openBlock(), createElementBlock(
572
- "div",
573
- normalizeProps(guardReactiveProps(unref(hasProps))),
574
- [
575
- _ctx.$slots.header || _ctx.$slots.title || _ctx.$slots.close || _ctx.$slots["title::before"] || _ctx.$slots["title::after"] || _ctx.title || unref(hasIcon) || _ctx.dismissable || _ctx.autoClose ? (openBlock(), createElementBlock("div", _hoisted_1, [
576
- unref(hasIcon) ? (openBlock(), createBlock(
577
- _sfc_main$2,
578
- mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-alert__icon" }),
579
- null,
580
- 16
581
- /* FULL_PROPS */
582
- )) : createCommentVNode("v-if", true),
583
- renderSlot(_ctx.$slots, "header", {}, () => [
584
- renderSlot(_ctx.$slots, "title::before"),
585
- _ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("strong", {
586
- key: 0,
587
- id: unref(hasTitleId),
588
- class: "vv-alert__title"
589
- }, [
590
- renderSlot(_ctx.$slots, "title", {}, () => [
591
- createTextVNode(
592
- toDisplayString(_ctx.title),
593
- 1
594
- /* TEXT */
595
- )
596
- ])
597
- ], 8, _hoisted_2)) : createCommentVNode("v-if", true),
598
- renderSlot(_ctx.$slots, "title::after")
599
- ]),
600
- renderSlot(_ctx.$slots, "close", normalizeProps(guardReactiveProps({ close: unref(close) })), () => [
601
- _ctx.dismissable || _ctx.autoClose ? (openBlock(), createElementBlock("button", {
602
- key: 0,
603
- class: "vv-alert__close",
604
- type: "button",
605
- "aria-label": _ctx.closeLabel,
606
- onClick: _cache[0] || (_cache[0] = withModifiers(
607
- //@ts-ignore
608
- (...args) => unref(close) && unref(close)(...args),
609
- ["stop"]
610
- ))
611
- }, [..._cache[1] || (_cache[1] = [
612
- createElementVNode(
613
- "div",
614
- { class: "vv-alert__close-mask" },
615
- null,
616
- -1
617
- /* CACHED */
618
- )
619
- ])], 8, _hoisted_3)) : createCommentVNode("v-if", true)
620
- ])
621
- ])) : createCommentVNode("v-if", true),
622
- _ctx.$slots.default || _ctx.content ? (openBlock(), createElementBlock("div", _hoisted_4, [
623
- renderSlot(_ctx.$slots, "default", {}, () => [
624
- createTextVNode(
625
- toDisplayString(_ctx.content),
626
- 1
627
- /* TEXT */
628
- )
629
- ])
630
- ])) : createCommentVNode("v-if", true),
631
- _ctx.$slots.footer || _ctx.footer ? (openBlock(), createElementBlock("div", _hoisted_5, [
632
- renderSlot(_ctx.$slots, "footer", {}, () => [
633
- createTextVNode(
634
- toDisplayString(_ctx.footer),
635
- 1
636
- /* TEXT */
637
- )
638
- ])
639
- ])) : createCommentVNode("v-if", true)
640
- ],
641
- 16
642
- /* FULL_PROPS */
643
- );
644
- };
645
- }
646
- });
647
- const __default__ = {
648
- name: "VvAlertGroup"
649
- };
650
- const _sfc_main = /* @__PURE__ */ defineComponent({
651
- ...__default__,
652
- props: VvAlertGroupProps,
653
- emits: VvAlertGroupEvents,
654
- setup(__props, { emit: __emit }) {
655
- const props = __props;
656
- const emit = __emit;
657
- const { hasProps, hasTransition } = useVvAlertGroup(props, emit);
658
- const alertGroupTransitionHandlers = {
659
- "before-enter": () => {
660
- emit("beforeEnter");
661
- },
662
- "after-leave": () => {
663
- emit("afterLeave");
664
- },
665
- "enter": () => {
666
- emit("enter");
667
- },
668
- "after-enter": () => {
669
- emit("afterEnter");
670
- },
671
- "enter-cancelled": () => {
672
- emit("enterCancelled");
673
- },
674
- "before-leave": () => {
675
- emit("beforeLeave");
676
- },
677
- "leave": () => {
678
- emit("leave");
679
- },
680
- "leave-cancelled": () => {
681
- emit("leaveCancelled");
682
- }
683
- };
684
- return (_ctx, _cache) => {
685
- return openBlock(), createElementBlock(
686
- "div",
687
- normalizeProps(guardReactiveProps(unref(hasProps))),
688
- [
689
- renderSlot(_ctx.$slots, "before"),
690
- createVNode(TransitionGroup, mergeProps({
691
- tag: "div",
692
- role: "group",
693
- name: unref(hasTransition),
694
- class: "vv-alert-group__list"
695
- }, toHandlers(alertGroupTransitionHandlers)), {
696
- default: withCtx(() => [
697
- renderSlot(_ctx.$slots, "default", {}, () => [
698
- (openBlock(true), createElementBlock(
699
- Fragment,
700
- null,
701
- renderList(_ctx.items, (item) => {
702
- return openBlock(), createBlock(
703
- _sfc_main$1,
704
- mergeProps({ ref_for: true }, item, {
705
- key: item.id
706
- }),
707
- null,
708
- 16
709
- /* FULL_PROPS */
710
- );
711
- }),
712
- 128
713
- /* KEYED_FRAGMENT */
714
- ))
715
- ])
716
- ]),
717
- _: 3
718
- /* FORWARDED */
719
- }, 16, ["name"]),
720
- renderSlot(_ctx.$slots, "after")
721
- ],
722
- 16
723
- /* FULL_PROPS */
724
- );
725
- };
726
- }
727
- });
728
- export {
729
- _sfc_main as default
730
- };
1
+ import{provide as e,computed as t,unref as o,inject as l,useId as a,watch as r,ref as i,defineComponent as n,mergeDefaults as s,toRefs as u,createBlock as v,createCommentVNode as c,openBlock as f,mergeProps as d,createElementBlock as p,normalizeProps as m,guardReactiveProps as b,renderSlot as h,createTextVNode as y,toDisplayString as g,withModifiers as $,createElementVNode as k,createVNode as S,TransitionGroup as w,toHandlers as _,withCtx as x,Fragment as C,renderList as I}from"vue";import L from"mitt";import{iconLoaded as T,Icon as B,addIcon as A}from"@iconify/vue";const F={prefix:"normal"};var E=/* @__PURE__ */(e=>(e.local="local",e.session="session",e))(E||{}),P=/* @__PURE__ */(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(P||{}),M=/* @__PURE__ */(e=>(e.before="before",e.after="after",e))(M||{}),O=/* @__PURE__ */(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(O||{}),V=/* @__PURE__ */(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(V||{}),j=/* @__PURE__ */(e=>(e.alert="alert",e.alertdialog="alertdialog",e))(j||{});const q=Symbol.for("volver"),z=Symbol.for("alertGroup"),D={modifiers:{type:[String,Array],default:void 0}},G={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:M.before,validation:e=>Object.values(M).includes(e)}},N={id:[String,Number]};function H(e,l,a){return t(()=>{const t={[e]:!0},r="string"==typeof l?.value?l.value.split(" "):l?.value;return r&&Array.isArray(r)&&r.forEach(o=>{o&&(t[`${e}--${o}`]=!0)}),a&&Object.keys(a.value).forEach(l=>{t[`${e}--${l}`]=o(a.value[l])}),t})}P.bottom,O.button,V.button,E.local;const J={...D,name:{type:String,required:!0},items:{type:Array,default:()=>[]},stack:{type:Boolean,default:!1},reverse:{type:Boolean,default:!1},inline:{type:String,default:void 0},block:{type:String,default:void 0},position:{type:String,default:void 0},transition:{type:String,default:void 0}};function R(o,l){const a=function({name:t}){const o=L();return e(z,{name:t,bus:o}),o}({name:t(()=>o.name)});(o.block&&!o.inline||!o.block&&o.inline)&&console.warn("[VvAlertGroup]: block and inline props must coexist at the same time.");const r=t(()=>{const e=[H("vv-alert-group",t(()=>o.modifiers),t(()=>({stack:o.stack,reverse:o.reverse,absolute:"absolute"===o.position,fixed:"fixed"===o.position}))).value];return o.inline&&o.block&&e.push(`vv-alert-group--${o.block}-${o.inline}`),e}),i=t(()=>o.transition?o.transition:o.position?"start"===o.inline?"vv-alert--fade-inline-start":"end"===o.inline?"vv-alert--fade-inline-end":"top"===o.block?"vv-alert--fade-block-top":"bottom"===o.block?"vv-alert--fade-block-bottom":"vv-alert--fade":"vv-alert--fade");return a.on("close",e=>{l("close",e)}),{hasTransition:i,hasProps:t(()=>({class:r.value}))}}const K={...N,...G,modifiers:{type:[String,Array],default:void 0},dismissable:{type:Boolean,default:!1},autoClose:{type:Number,default:0},closeLabel:{type:String,default:"Close"},title:{type:String,default:void 0},content:{type:String,default:void 0},footer:{type:String,default:void 0},role:{type:String,default:j.alert}};function Q(e,o){const{bus:n}=l(z,{}),s=(u=t(()=>e.id),t(()=>String(u?.value||a())));var u;const v=t(()=>`${s.value}-title`);let c;const f=()=>{c&&clearTimeout(c),o("close",s.value),n?.emit("close",s.value)};r(()=>e.autoClose,e=>{e>0?c=setTimeout(f,e):c&&clearTimeout(c)},{immediate:!0});const d=i(!1),p=()=>{d.value=!0,c&&clearTimeout(c)},m=()=>{d.value=!1,e.autoClose>0&&(c=setTimeout(f,e.autoClose))},{hasIcon:b}=function(e,o){const l=t(()=>"string"==typeof e?.value?{name:e?.value}:e?.value),a=t(()=>o?.value===M.before?l.value:void 0),r=t(()=>o?.value===M.after?l.value:void 0),i=t(()=>o?.value===P.left?l.value:void 0),n=t(()=>o?.value===P.right?l.value:void 0),s=t(()=>o?.value===P.top?l.value:void 0),u=t(()=>o?.value===P.bottom?l.value:void 0);return{hasIcon:l,hasIconLeft:i,hasIconRight:n,hasIconTop:s,hasIconBottom:u,hasIconBefore:a,hasIconAfter:r}}(t(()=>e.icon)),h=H("vv-alert",t(()=>e.modifiers),t(()=>({dismissable:e.autoClose>0||e.dismissable,"auto-close":e.autoClose>0,hover:d.value}))),y=t(()=>({"--alert-duration":`${e.autoClose}ms`}));return{close:f,hasIcon:b,hasTitleId:v,hasProps:t(()=>({onMouseover:p,onMouseleave:m,class:h.value,style:y.value,role:e.role,"aria-labelledby":v.value}))}}const U=/* @__PURE__ */n({name:"VvIcon",props:/* @__PURE__ */s({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},F),setup(e){const a=e,r=t(()=>"string"==typeof a.rotate?Number.parseFloat(a.rotate):a.rotate),n=i(!0),s=l(q,void 0),{modifiers:p}=u(a),m=H("vv-icon",p),b=t(()=>a.provider||s?.iconsProvider),h=t(()=>{const e=a.name??"",t=`@${b.value}:${a.prefix}:${e}`;if(T(t))return t;const o=s?.iconsCollections.find(t=>{const o=`@${b.value}:${t.prefix}:${e}`;return T(o)});return o?`@${b.value}:${o.prefix}:${e}`:e});function y(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),o=t?.innerHTML.trim()||"";t&&o&&A(`@${b.value}:${a.prefix}:${a.name}`,{body:o,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return s&&a.src&&!T(`@${b.value}:${a.prefix}:${a.name}`)&&(n.value=!1,s.fetchIcon(a.src).then(e=>{e&&(y(e),n.value=!0)}).catch(e=>{throw new Error(`Error during fetch icon: ${e?.message}`)})),a.svg&&y(a.svg),(t,l)=>o(n)?(f(),v(o(B),d({key:0,class:o(m)},{inline:e.inline,width:e.width,height:e.height,horizontalFlip:e.horizontalFlip,verticalFlip:e.verticalFlip,flip:e.flip,rotate:o(r),color:e.color,icon:o(h)},{onLoad:e.onLoad}),null,16,["class","onLoad"])):c("v-if",!0)}}),W={key:0,class:"vv-alert__header"},X=["id"],Y=["aria-label"],Z={key:1,class:"vv-alert__content"},ee={key:2,class:"vv-alert__footer"},te=/* @__PURE__ */n({name:"VvAlert",props:K,emits:["close"],setup(e,{expose:t,emit:l}){const a=e,r=l,{hasProps:i,hasTitleId:n,hasIcon:s,close:u}=Q(a,r);return t({close:u}),(e,t)=>(f(),p("div",m(b(o(i))),[e.$slots.header||e.$slots.title||e.$slots.close||e.$slots["title::before"]||e.$slots["title::after"]||e.title||o(s)||e.dismissable||e.autoClose?(f(),p("div",W,[o(s)?(f(),v(U,d({key:0},o(s),{class:"vv-alert__icon"}),null,16)):c("v-if",!0),h(e.$slots,"header",{},()=>[h(e.$slots,"title::before"),e.$slots.title||e.title?(f(),p("strong",{key:0,id:o(n),class:"vv-alert__title"},[h(e.$slots,"title",{},()=>[y(g(e.title),1)])],8,X)):c("v-if",!0),h(e.$slots,"title::after")]),h(e.$slots,"close",m(b({close:o(u)})),()=>[e.dismissable||e.autoClose?(f(),p("button",{key:0,class:"vv-alert__close",type:"button","aria-label":e.closeLabel,onClick:t[0]||(t[0]=$((...e)=>o(u)&&o(u)(...e),["stop"]))},[...t[1]||(t[1]=[k("div",{class:"vv-alert__close-mask"},null,-1)])],8,Y)):c("v-if",!0)])])):c("v-if",!0),e.$slots.default||e.content?(f(),p("div",Z,[h(e.$slots,"default",{},()=>[y(g(e.content),1)])])):c("v-if",!0),e.$slots.footer||e.footer?(f(),p("div",ee,[h(e.$slots,"footer",{},()=>[y(g(e.footer),1)])])):c("v-if",!0)],16))}}),oe=/* @__PURE__ */n({name:"VvAlertGroup",props:J,emits:["close","beforeEnter","afterLeave","enter","afterEnter","enterCancelled","beforeLeave","leave","leaveCancelled"],setup(e,{emit:t}){const l=e,a=t,{hasProps:r,hasTransition:i}=R(l,a),n={"before-enter":()=>{a("beforeEnter")},"after-leave":()=>{a("afterLeave")},enter:()=>{a("enter")},"after-enter":()=>{a("afterEnter")},"enter-cancelled":()=>{a("enterCancelled")},"before-leave":()=>{a("beforeLeave")},leave:()=>{a("leave")},"leave-cancelled":()=>{a("leaveCancelled")}};return(e,t)=>(f(),p("div",m(b(o(r))),[h(e.$slots,"before"),S(w,d({tag:"div",role:"group",name:o(i),class:"vv-alert-group__list"},_(n)),{default:x(()=>[h(e.$slots,"default",{},()=>[(f(!0),p(C,null,I(e.items,e=>(f(),v(te,d({ref_for:!0},e,{key:e.id}),null,16))),128))])]),_:3},16,["name"]),h(e.$slots,"after")],16))}});export{oe as default};