@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.
Files changed (94) hide show
  1. package/bin/icons.js +1 -93
  2. package/dist/components/VvAccordion/VvAccordion.es.js +1 -366
  3. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +2 -1
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +2 -702
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +3 -2
  6. package/dist/components/VvAction/VvAction.es.js +1 -302
  7. package/dist/components/VvAction/VvAction.vue.d.ts +2 -1
  8. package/dist/components/VvAlert/VvAlert.es.js +1 -527
  9. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  10. package/dist/components/VvAlert/VvAlert.vue.d.ts +2 -1
  11. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +1 -730
  12. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  13. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +2 -1
  14. package/dist/components/VvAvatar/VvAvatar.es.js +1 -132
  15. package/dist/components/VvAvatar/VvAvatar.vue.d.ts +2 -1
  16. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +1 -250
  17. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +2 -1
  18. package/dist/components/VvBadge/VvBadge.es.js +1 -131
  19. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -1
  20. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +1 -410
  21. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +2 -1
  22. package/dist/components/VvButton/VvButton.es.js +1 -882
  23. package/dist/components/VvButton/VvButton.umd.js +1 -1
  24. package/dist/components/VvButton/VvButton.vue.d.ts +2 -1
  25. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +1 -214
  26. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -1
  27. package/dist/components/VvCard/VvCard.es.js +1 -152
  28. package/dist/components/VvCard/VvCard.vue.d.ts +2 -1
  29. package/dist/components/VvCheckbox/VvCheckbox.es.js +1 -741
  30. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +3 -2
  31. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +1 -981
  32. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -1
  33. package/dist/components/VvCombobox/VvCombobox.es.js +1 -3463
  34. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  35. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +263 -317
  36. package/dist/components/VvDialog/VvDialog.es.js +1 -317
  37. package/dist/components/VvDialog/VvDialog.vue.d.ts +2 -1
  38. package/dist/components/VvDropdown/VvDropdown.es.js +1 -750
  39. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -1
  40. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +5 -4
  41. package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +2 -1
  42. package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +10 -2
  43. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -1
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +1 -448
  45. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +1 -149
  46. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +1 -104
  47. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  48. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +1 -281
  49. package/dist/components/VvIcon/VvIcon.es.js +1 -143
  50. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  51. package/dist/components/VvIcon/VvIcon.vue.d.ts +2 -1
  52. package/dist/components/VvInputFile/VvInputFile.es.js +1 -1704
  53. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  54. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +2 -1
  55. package/dist/components/VvInputText/VvInputText.es.js +4 -2790
  56. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  57. package/dist/components/VvInputText/VvInputText.vue.d.ts +2 -1
  58. package/dist/components/VvNav/VvNav.es.js +1 -438
  59. package/dist/components/VvNav/VvNav.vue.d.ts +2 -1
  60. package/dist/components/VvNav/VvNavItem.vue.d.ts +2 -1
  61. package/dist/components/VvNav/VvNavSeparator.vue.d.ts +2 -1
  62. package/dist/components/VvNavItem/VvNavItem.es.js +1 -337
  63. package/dist/components/VvNavSeparator/VvNavSeparator.es.js +1 -24
  64. package/dist/components/VvProgress/VvProgress.es.js +1 -163
  65. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -1
  66. package/dist/components/VvRadio/VvRadio.es.js +1 -661
  67. package/dist/components/VvRadio/VvRadio.vue.d.ts +3 -2
  68. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +1 -901
  69. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -1
  70. package/dist/components/VvSelect/VvSelect.es.js +1 -1103
  71. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  72. package/dist/components/VvSelect/VvSelect.vue.d.ts +130 -71
  73. package/dist/components/VvTab/VvTab.es.js +1 -558
  74. package/dist/components/VvTab/VvTab.vue.d.ts +2 -1
  75. package/dist/components/VvTextarea/VvTextarea.es.js +2 -1989
  76. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  77. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +2 -1
  78. package/dist/components/VvTooltip/VvTooltip.es.js +1 -154
  79. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +2 -1
  80. package/dist/components/index.es.js +6 -8558
  81. package/dist/components/index.umd.js +1 -1
  82. package/dist/composables/index.es.js +2 -247
  83. package/dist/composables/index.umd.js +1 -1
  84. package/dist/directives/index.es.js +2 -311
  85. package/dist/directives/index.umd.js +1 -1
  86. package/dist/directives/v-contextmenu.es.js +2 -142
  87. package/dist/directives/v-contextmenu.umd.js +1 -1
  88. package/dist/directives/v-tooltip.es.js +1 -172
  89. package/dist/icons.es.js +1 -39
  90. package/dist/icons.umd.js +1 -1
  91. package/dist/index.es.js +1 -219
  92. package/dist/resolvers/unplugin.es.js +1 -187
  93. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +14 -14
  94. package/package.json +37 -37
@@ -1,558 +1 @@
1
- import { inject, defineComponent, getCurrentInstance, ref, watch, computed, resolveComponent, createBlock, openBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, createElementBlock, createVNode, toRefs, normalizeClass, createElementVNode, withModifiers, Fragment, renderList, toHandlers, normalizeProps, guardReactiveProps, createCommentVNode } from "vue";
2
- var StorageType = /* @__PURE__ */ ((StorageType2) => {
3
- StorageType2["local"] = "local";
4
- StorageType2["session"] = "session";
5
- return StorageType2;
6
- })(StorageType || {});
7
- var Side = /* @__PURE__ */ ((Side2) => {
8
- Side2["left"] = "left";
9
- Side2["right"] = "right";
10
- Side2["top"] = "top";
11
- Side2["bottom"] = "bottom";
12
- return Side2;
13
- })(Side || {});
14
- var Position = /* @__PURE__ */ ((Position2) => {
15
- Position2["before"] = "before";
16
- Position2["after"] = "after";
17
- return Position2;
18
- })(Position || {});
19
- var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
20
- ButtonType2["button"] = "button";
21
- ButtonType2["submit"] = "submit";
22
- ButtonType2["reset"] = "reset";
23
- return ButtonType2;
24
- })(ButtonType || {});
25
- var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
26
- ActionTag2["nuxtLink"] = "nuxt-link";
27
- ActionTag2["routerLink"] = "router-link";
28
- ActionTag2["a"] = "a";
29
- ActionTag2["button"] = "button";
30
- return ActionTag2;
31
- })(ActionTag || {});
32
- const INJECTION_KEY_VOLVER = Symbol.for("volver");
33
- const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
34
- "dropdownTrigger"
35
- );
36
- const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
37
- "dropdownAction"
38
- );
39
- const LinkProps = {
40
- /**
41
- * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
42
- * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
43
- */
44
- to: {
45
- type: [String, Object]
46
- },
47
- /**
48
- * Anchor href
49
- */
50
- href: String,
51
- /**
52
- * Anchor target
53
- */
54
- target: String,
55
- /**
56
- * Anchor rel
57
- */
58
- rel: {
59
- type: String,
60
- default: "noopener noreferrer"
61
- }
62
- };
63
- const DisabledProps = {
64
- /**
65
- * Whether the form control is disabled
66
- */
67
- disabled: {
68
- type: Boolean,
69
- default: false
70
- }
71
- };
72
- const ActiveProps = {
73
- /**
74
- * Whether the item is active
75
- */
76
- active: {
77
- type: Boolean,
78
- default: false
79
- }
80
- };
81
- const CurrentProps = {
82
- /**
83
- * Whether the item is current
84
- */
85
- current: {
86
- type: Boolean,
87
- default: false
88
- }
89
- };
90
- const PressedProps = {
91
- /**
92
- * Whether the item is pressed
93
- */
94
- pressed: {
95
- type: Boolean,
96
- default: false
97
- }
98
- };
99
- const LabelProps = {
100
- /**
101
- * The item label
102
- */
103
- label: {
104
- type: [String, Number],
105
- default: void 0
106
- }
107
- };
108
- const ModifiersProps = {
109
- /**
110
- * Component BEM modifiers
111
- */
112
- modifiers: {
113
- type: [String, Array],
114
- default: void 0
115
- }
116
- };
117
- ({
118
- /**
119
- * VvIcon position
120
- */
121
- iconPosition: {
122
- default: Position.before
123
- }
124
- });
125
- ({
126
- /**
127
- * Dropdown placement
128
- */
129
- placement: {
130
- default: Side.bottom
131
- }
132
- });
133
- const ActionProps = {
134
- ...DisabledProps,
135
- ...LabelProps,
136
- ...PressedProps,
137
- ...ActiveProps,
138
- ...CurrentProps,
139
- ...LinkProps,
140
- /**
141
- * Button type
142
- */
143
- type: {
144
- type: String,
145
- default: ButtonType.button,
146
- validator: (value) => Object.values(ButtonType).includes(value)
147
- },
148
- /**
149
- * Button aria-label
150
- */
151
- ariaLabel: {
152
- type: String,
153
- default: void 0
154
- },
155
- /**
156
- * Default tag for the action
157
- */
158
- defaultTag: {
159
- type: String,
160
- default: ActionTag.button
161
- }
162
- };
163
- const NavProps = {
164
- items: {
165
- type: Array,
166
- default: () => []
167
- }
168
- };
169
- ({
170
- storageType: {
171
- default: StorageType.local
172
- }
173
- });
174
- const VvNavProps = {
175
- ...ModifiersProps,
176
- ...NavProps
177
- };
178
- const VvNavEvents = ["click"];
179
- const VvActionEvents = ["click", "mouseover", "mouseleave"];
180
- const VvActionProps = ActionProps;
181
- function useVolver() {
182
- return inject(INJECTION_KEY_VOLVER, void 0);
183
- }
184
- function useInjectedDropdownTrigger() {
185
- return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
186
- }
187
- function useInjectedDropdownAction() {
188
- return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
189
- }
190
- const __default__$3 = {
191
- name: "VvAction"
192
- };
193
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
194
- ...__default__$3,
195
- props: VvActionProps,
196
- emits: VvActionEvents,
197
- setup(__props, { expose: __expose, emit: __emit }) {
198
- const props = __props;
199
- const emit = __emit;
200
- const instance = getCurrentInstance();
201
- const volver = useVolver();
202
- const element = ref(null);
203
- __expose({ $el: element });
204
- const {
205
- reference: dropdownTriggerReference,
206
- bus: dropdownEventBus,
207
- aria: dropdownAria,
208
- expanded: dropdownExpanded
209
- } = useInjectedDropdownTrigger();
210
- watch(
211
- () => element.value,
212
- (newValue) => {
213
- if (dropdownTriggerReference) {
214
- dropdownTriggerReference.value = newValue;
215
- }
216
- }
217
- );
218
- const pressed = computed(() => {
219
- return props.pressed || dropdownExpanded?.value;
220
- });
221
- const { role } = useInjectedDropdownAction();
222
- const hasTag = computed(() => {
223
- switch (true) {
224
- case props.disabled:
225
- return ActionTag.button;
226
- case props.to !== void 0:
227
- return volver?.nuxt ? resolveComponent(ActionTag.nuxtLink) : ActionTag.routerLink;
228
- case props.href !== void 0:
229
- return ActionTag.a;
230
- default:
231
- return props.defaultTag;
232
- }
233
- });
234
- const hasProps = computed(() => {
235
- const toReturn = {
236
- ...dropdownAria?.value,
237
- ariaPressed: pressed.value ? true : void 0,
238
- ariaLabel: props.ariaLabel,
239
- role: role?.value
240
- };
241
- switch (hasTag.value) {
242
- case ActionTag.a:
243
- return {
244
- ...toReturn,
245
- href: props.href,
246
- target: props.target,
247
- rel: props.rel
248
- };
249
- case ActionTag.routerLink:
250
- case ActionTag.nuxtLink:
251
- return {
252
- ...toReturn,
253
- to: props.to,
254
- target: props.target
255
- };
256
- case ActionTag.button:
257
- return {
258
- ...toReturn,
259
- type: props.type,
260
- disabled: props.disabled
261
- };
262
- default:
263
- return toReturn;
264
- }
265
- });
266
- function onClick(e) {
267
- if (props.disabled) {
268
- e.preventDefault();
269
- return;
270
- }
271
- if (instance?.vnode.props?.onClick) {
272
- emit("click", e);
273
- return;
274
- }
275
- dropdownEventBus?.emit("click", e);
276
- }
277
- function onMouseover(e) {
278
- if (instance?.vnode.props?.onMouseover) {
279
- emit("mouseover", e);
280
- return;
281
- }
282
- dropdownEventBus?.emit("mouseover", e);
283
- }
284
- function onMouseleave(e) {
285
- if (instance?.vnode.props?.onMouseleave) {
286
- emit("mouseleave", e);
287
- return;
288
- }
289
- dropdownEventBus?.emit("mouseleave", e);
290
- }
291
- return (_ctx, _cache) => {
292
- return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
293
- ref_key: "element",
294
- ref: element,
295
- class: {
296
- active: _ctx.active,
297
- pressed: unref(pressed),
298
- disabled: _ctx.disabled,
299
- current: _ctx.current
300
- },
301
- onClickPassive: onClick,
302
- onMouseoverPassive: onMouseover,
303
- onMouseleavePassive: onMouseleave
304
- }), {
305
- default: withCtx(() => [
306
- renderSlot(_ctx.$slots, "default", {}, () => [
307
- createTextVNode(
308
- toDisplayString(_ctx.label),
309
- 1
310
- /* TEXT */
311
- )
312
- ])
313
- ]),
314
- _: 3
315
- /* FORWARDED */
316
- }, 16, ["class"]);
317
- };
318
- }
319
- });
320
- const _hoisted_1 = {
321
- class: "vv-nav__item",
322
- role: "presentation"
323
- };
324
- const __default__$2 = {
325
- name: "VvNavItem",
326
- inheritAttrs: false
327
- };
328
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
329
- ...__default__$2,
330
- setup(__props) {
331
- return (_ctx, _cache) => {
332
- return openBlock(), createElementBlock("li", _hoisted_1, [
333
- renderSlot(_ctx.$slots, "before"),
334
- createVNode(
335
- _sfc_main$3,
336
- mergeProps(_ctx.$attrs, {
337
- class: "vv-nav__item-label",
338
- role: "menuitem"
339
- }),
340
- {
341
- default: withCtx(() => [
342
- renderSlot(_ctx.$slots, "default")
343
- ]),
344
- _: 3
345
- /* FORWARDED */
346
- },
347
- 16
348
- /* FULL_PROPS */
349
- ),
350
- renderSlot(_ctx.$slots, "after")
351
- ]);
352
- };
353
- }
354
- });
355
- function useModifiers(prefix, modifiers, others) {
356
- return computed(() => {
357
- const toReturn = {
358
- [prefix]: true
359
- };
360
- const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
361
- if (modifiersArray) {
362
- if (Array.isArray(modifiersArray)) {
363
- modifiersArray.forEach((modifier) => {
364
- if (modifier) {
365
- toReturn[`${prefix}--${modifier}`] = true;
366
- }
367
- });
368
- }
369
- }
370
- return toReturn;
371
- });
372
- }
373
- const __default__$1 = {
374
- name: "VvNav"
375
- };
376
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
377
- ...__default__$1,
378
- props: VvNavProps,
379
- emits: VvNavEvents,
380
- setup(__props, { emit: __emit }) {
381
- const props = __props;
382
- const emit = __emit;
383
- const { modifiers } = toRefs(props);
384
- function onClick(event) {
385
- const target = event.target;
386
- if (target?.dataset.index) {
387
- const index = Number.parseInt(target.dataset.index);
388
- const item = props.items?.[index];
389
- if (!item || item?.disabled) {
390
- return;
391
- }
392
- emit("click", item);
393
- }
394
- }
395
- const bemCssClasses = useModifiers("vv-nav", modifiers);
396
- return (_ctx, _cache) => {
397
- return openBlock(), createElementBlock(
398
- "nav",
399
- {
400
- class: normalizeClass(unref(bemCssClasses))
401
- },
402
- [
403
- createElementVNode("ul", {
404
- class: "vv-nav__menu",
405
- role: "menu",
406
- onClick: withModifiers(onClick, ["stop"])
407
- }, [
408
- renderSlot(_ctx.$slots, "default", {}, () => [
409
- (openBlock(true), createElementBlock(
410
- Fragment,
411
- null,
412
- renderList(_ctx.items, ({ on = {}, data, ...item }, index) => {
413
- return openBlock(), createBlock(_sfc_main$2, mergeProps({
414
- key: index,
415
- "data-index": index
416
- }, { ref_for: true }, item, toHandlers(on)), {
417
- default: withCtx(() => [
418
- renderSlot(_ctx.$slots, "item", mergeProps({ ref_for: true }, { item, data, index }))
419
- ]),
420
- _: 2
421
- /* DYNAMIC */
422
- }, 1040, ["data-index"]);
423
- }),
424
- 128
425
- /* KEYED_FRAGMENT */
426
- ))
427
- ])
428
- ])
429
- ],
430
- 2
431
- /* CLASS */
432
- );
433
- };
434
- }
435
- });
436
- const VvTabProps = {
437
- ...ModifiersProps,
438
- navModifiers: {
439
- type: [String, Array]
440
- },
441
- modelValue: {
442
- type: String,
443
- default: ""
444
- },
445
- items: {
446
- type: Array,
447
- default: () => []
448
- }
449
- };
450
- const VvTabEvents = ["update:modelValue"];
451
- const __default__ = {
452
- name: "VvTab"
453
- };
454
- const _sfc_main = /* @__PURE__ */ defineComponent({
455
- ...__default__,
456
- props: VvTabProps,
457
- emits: VvTabEvents,
458
- setup(__props, { emit: __emit }) {
459
- const props = __props;
460
- const emit = __emit;
461
- const { modifiers, items } = toRefs(props);
462
- const tabKeys = computed(() => {
463
- return items.value.reduce((acc, item) => {
464
- if (item.tab) {
465
- acc.push(item.tab);
466
- }
467
- return acc;
468
- }, []);
469
- });
470
- const localModelValue = ref();
471
- const activeTabKey = computed({
472
- get: () => {
473
- return props.modelValue || localModelValue.value || tabKeys.value?.[0];
474
- },
475
- set: (newValue) => {
476
- localModelValue.value = newValue;
477
- emit("update:modelValue", newValue);
478
- }
479
- });
480
- const hasNavModifiers = computed(() => {
481
- return [
482
- "tabs",
483
- ...Array.isArray(props.navModifiers) ? props.navModifiers : props.navModifiers?.split(" ") ?? []
484
- ];
485
- });
486
- function onNavClick(item) {
487
- if (item.tab) {
488
- activeTabKey.value = item.tab;
489
- }
490
- }
491
- const navItems = computed(
492
- () => props.items.map((item) => ({
493
- current: item.tab === activeTabKey.value,
494
- ...item
495
- }))
496
- );
497
- const bemCssClasses = useModifiers("vv-tab", modifiers);
498
- return (_ctx, _cache) => {
499
- return openBlock(), createElementBlock(
500
- "div",
501
- {
502
- class: normalizeClass(unref(bemCssClasses))
503
- },
504
- [
505
- createVNode(
506
- _sfc_main$1,
507
- mergeProps({
508
- items: unref(navItems),
509
- modifiers: unref(hasNavModifiers)
510
- }, { onClick: onNavClick }),
511
- {
512
- item: withCtx(({ item, data, index }) => [
513
- renderSlot(_ctx.$slots, "nav-item", normalizeProps(guardReactiveProps({ item, data, index })))
514
- ]),
515
- _: 3
516
- /* FORWARDED */
517
- },
518
- 16
519
- /* FULL_PROPS */
520
- ),
521
- (openBlock(true), createElementBlock(
522
- Fragment,
523
- null,
524
- renderList(unref(items), (item, index) => {
525
- return openBlock(), createElementBlock(
526
- Fragment,
527
- { key: index },
528
- [
529
- item.tab ? (openBlock(), createElementBlock(
530
- "article",
531
- {
532
- key: 0,
533
- class: normalizeClass([{ target: unref(activeTabKey) === item.tab }, "vv-tab__panel"])
534
- },
535
- [
536
- renderSlot(_ctx.$slots, `panel::${item.tab}`)
537
- ],
538
- 2
539
- /* CLASS */
540
- )) : createCommentVNode("v-if", true)
541
- ],
542
- 64
543
- /* STABLE_FRAGMENT */
544
- );
545
- }),
546
- 128
547
- /* KEYED_FRAGMENT */
548
- ))
549
- ],
550
- 2
551
- /* CLASS */
552
- );
553
- };
554
- }
555
- });
556
- export {
557
- _sfc_main as default
558
- };
1
+ import{inject as e,defineComponent as t,getCurrentInstance as a,ref as r,watch as o,computed as s,resolveComponent as n,createBlock as l,openBlock as i,resolveDynamicComponent as u,unref as d,mergeProps as v,withCtx as c,renderSlot as f,createTextVNode as m,toDisplayString as p,createElementBlock as b,createVNode as y,toRefs as g,normalizeClass as k,createElementVNode as x,withModifiers as _,Fragment as S,renderList as $,toHandlers as h,normalizeProps as A,guardReactiveProps as L,createCommentVNode as M}from"vue";var V=/* @__PURE__ */(e=>(e.local="local",e.session="session",e))(V||{}),w=/* @__PURE__ */(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(w||{}),B=/* @__PURE__ */(e=>(e.before="before",e.after="after",e))(B||{}),C=/* @__PURE__ */(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(C||{}),N=/* @__PURE__ */(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(N||{});const P=Symbol.for("volver"),T=Symbol.for("dropdownTrigger"),j=Symbol.for("dropdownAction"),I={to:{type:[String,Object]},href:String,target:String,rel:{type:String,default:"noopener noreferrer"}},O={disabled:{type:Boolean,default:!1}},D={active:{type:Boolean,default:!1}},E={current:{type:Boolean,default:!1}},q={pressed:{type:Boolean,default:!1}},z={label:{type:[String,Number],default:void 0}},F={modifiers:{type:[String,Array],default:void 0}};B.before,w.bottom;const G={...O,...z,...q,...D,...E,...I,type:{type:String,default:C.button,validator:e=>Object.values(C).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:N.button}},H={items:{type:Array,default:()=>[]}};V.local;const J={...F,...H};const K=/* @__PURE__ */t({name:"VvAction",props:G,emits:["click","mouseover","mouseleave"],setup(t,{expose:b,emit:y}){const g=t,k=y,x=a(),_=e(P,void 0),S=r(null);b({$el:S});const{reference:$,bus:h,aria:A,expanded:L}=e(T,{});o(()=>S.value,e=>{$&&($.value=e)});const M=s(()=>g.pressed||L?.value),{role:V}=e(j,{}),w=s(()=>{switch(!0){case g.disabled:return N.button;case void 0!==g.to:return _?.nuxt?n(N.nuxtLink):N.routerLink;case void 0!==g.href:return N.a;default:return g.defaultTag}}),B=s(()=>{const e={...A?.value,ariaPressed:!!M.value||void 0,ariaLabel:g.ariaLabel,role:V?.value};switch(w.value){case N.a:return{...e,href:g.href,target:g.target,rel:g.rel};case N.routerLink:case N.nuxtLink:return{...e,to:g.to,target:g.target};case N.button:return{...e,type:g.type,disabled:g.disabled};default:return e}});function C(e){g.disabled?e.preventDefault():x?.vnode.props?.onClick?k("click",e):h?.emit("click",e)}function I(e){x?.vnode.props?.onMouseover?k("mouseover",e):h?.emit("mouseover",e)}function O(e){x?.vnode.props?.onMouseleave?k("mouseleave",e):h?.emit("mouseleave",e)}return(e,t)=>(i(),l(u(d(w)),v(d(B),{ref_key:"element",ref:S,class:{active:e.active,pressed:d(M),disabled:e.disabled,current:e.current},onClickPassive:C,onMouseoverPassive:I,onMouseleavePassive:O}),{default:c(()=>[f(e.$slots,"default",{},()=>[m(p(e.label),1)])]),_:3},16,["class"]))}}),Q={class:"vv-nav__item",role:"presentation"},R=/* @__PURE__ */t({name:"VvNavItem",inheritAttrs:!1,setup:e=>(e,t)=>(i(),b("li",Q,[f(e.$slots,"before"),y(K,v(e.$attrs,{class:"vv-nav__item-label",role:"menuitem"}),{default:c(()=>[f(e.$slots,"default")]),_:3},16),f(e.$slots,"after")]))});function U(e,t,a){return s(()=>{const a={[e]:!0},r="string"==typeof t?.value?t.value.split(" "):t?.value;return r&&Array.isArray(r)&&r.forEach(t=>{t&&(a[`${e}--${t}`]=!0)}),a})}const W=/* @__PURE__ */t({name:"VvNav",props:J,emits:["click"],setup(e,{emit:t}){const a=e,r=t,{modifiers:o}=g(a);function s(e){const t=e.target;if(t?.dataset.index){const e=Number.parseInt(t.dataset.index),o=a.items?.[e];if(!o||o?.disabled)return;r("click",o)}}const n=U("vv-nav",o);return(e,t)=>(i(),b("nav",{class:k(d(n))},[x("ul",{class:"vv-nav__menu",role:"menu",onClick:_(s,["stop"])},[f(e.$slots,"default",{},()=>[(i(!0),b(S,null,$(e.items,({on:t={},data:a,...r},o)=>(i(),l(R,v({key:o,"data-index":o},{ref_for:!0},r,h(t)),{default:c(()=>[f(e.$slots,"item",v({ref_for:!0},{item:r,data:a,index:o}))]),_:2},1040,["data-index"]))),128))])])],2))}}),X=/* @__PURE__ */t({name:"VvTab",props:{...F,navModifiers:{type:[String,Array]},modelValue:{type:String,default:""},items:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,o=t,{modifiers:n,items:l}=g(a),u=s(()=>l.value.reduce((e,t)=>(t.tab&&e.push(t.tab),e),[])),m=r(),p=s({get:()=>a.modelValue||m.value||u.value?.[0],set:e=>{m.value=e,o("update:modelValue",e)}}),x=s(()=>["tabs",...Array.isArray(a.navModifiers)?a.navModifiers:a.navModifiers?.split(" ")??[]]);function _(e){e.tab&&(p.value=e.tab)}const h=s(()=>a.items.map(e=>({current:e.tab===p.value,...e}))),V=U("vv-tab",n);return(e,t)=>(i(),b("div",{class:k(d(V))},[y(W,v({items:d(h),modifiers:d(x)},{onClick:_}),{item:c(({item:t,data:a,index:r})=>[f(e.$slots,"nav-item",A(L({item:t,data:a,index:r})))]),_:3},16),(i(!0),b(S,null,$(d(l),(t,a)=>(i(),b(S,{key:a},[t.tab?(i(),b("article",{key:0,class:k([{target:d(p)===t.tab},"vv-tab__panel"])},[f(e.$slots,`panel::${t.tab}`)],2)):M("v-if",!0)],64))),128))],2))}});export{X as default};
@@ -1,5 +1,5 @@
1
1
  import type { NavItemTab } from '@/types/nav';
2
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<globalThis.ExtractPropTypes<{
2
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<globalThis.ExtractPropTypes<{
3
3
  navModifiers: {
4
4
  type: PropType<string | string[]>;
5
5
  };
@@ -55,6 +55,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<globalThis
55
55
  index: number;
56
56
  }) => any;
57
57
  }>;
58
+ declare const _default: typeof __VLS_export;
58
59
  export default _default;
59
60
  type __VLS_WithSlots<T, S> = T & {
60
61
  new (): {