@volverjs/ui-vue 0.0.9 → 0.0.10-beta.10

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 (184) hide show
  1. package/README.md +64 -1
  2. package/auto-imports.d.ts +1 -1
  3. package/bin/icons.cjs +1 -1
  4. package/bin/icons.js +34 -19
  5. package/dist/components/VvAccordion/VvAccordion.es.js +33 -4
  6. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  7. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -4
  8. package/dist/components/VvAccordion/index.d.ts +1 -1
  9. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +75 -27
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +5 -5
  12. package/dist/components/VvAction/VvAction.es.js +26 -4
  13. package/dist/components/VvAction/VvAction.umd.js +1 -1
  14. package/dist/components/VvAction/VvAction.vue.d.ts +17 -4
  15. package/dist/components/VvAction/index.d.ts +5 -0
  16. package/dist/components/VvAlert/VvAlert.es.js +96 -45
  17. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  18. package/dist/components/VvAlert/VvAlert.vue.d.ts +4 -4
  19. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +136 -66
  20. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  21. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +4 -4
  22. package/dist/components/VvAvatar/VvAvatar.es.js +22 -1
  23. package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
  24. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +79 -28
  25. package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
  26. package/dist/components/VvBadge/VvBadge.es.js +39 -8
  27. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  28. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +224 -41
  29. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  30. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +14 -3
  31. package/dist/components/VvBreadcrumb/index.d.ts +2 -9
  32. package/dist/components/VvButton/VvButton.es.js +70 -25
  33. package/dist/components/VvButton/VvButton.umd.js +1 -1
  34. package/dist/components/VvButton/VvButton.vue.d.ts +25 -9
  35. package/dist/components/VvButton/index.d.ts +5 -0
  36. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +33 -6
  37. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  38. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +6 -6
  39. package/dist/components/VvCard/VvCard.es.js +47 -16
  40. package/dist/components/VvCard/VvCard.umd.js +1 -1
  41. package/dist/components/VvCheckbox/VvCheckbox.es.js +35 -7
  42. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  43. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +8 -8
  44. package/dist/components/VvCheckbox/index.d.ts +1 -1
  45. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +106 -51
  46. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  47. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
  48. package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
  49. package/dist/components/VvCombobox/VvCombobox.es.js +635 -400
  50. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  51. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +112 -112
  52. package/dist/components/VvCombobox/index.d.ts +32 -32
  53. package/dist/components/VvDialog/VvDialog.es.js +65 -27
  54. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  55. package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -4
  56. package/dist/components/VvDropdown/VvDropdown.es.js +87 -46
  57. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  58. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +203 -189
  59. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +12 -0
  60. package/dist/components/VvDropdown/index.d.ts +32 -32
  61. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +46 -12
  62. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  63. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +13 -7
  64. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +28 -1
  65. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  66. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +40 -8
  67. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  68. package/dist/components/VvIcon/VvIcon.es.js +1 -1
  69. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  70. package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
  71. package/dist/components/VvInputText/VvInputText.es.js +149 -99
  72. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  73. package/dist/components/VvInputText/VvInputText.vue.d.ts +10 -10
  74. package/dist/components/VvInputText/index.d.ts +8 -2
  75. package/dist/components/VvNav/VvNav.es.js +115 -63
  76. package/dist/components/VvNav/VvNav.umd.js +1 -1
  77. package/dist/components/VvNav/VvNav.vue.d.ts +31 -12
  78. package/dist/components/VvNav/VvNavItem.vue.d.ts +9 -0
  79. package/dist/components/VvNav/index.d.ts +1 -12
  80. package/dist/components/VvNavItem/VvNavItem.es.js +413 -0
  81. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -0
  82. package/dist/components/VvNavSeparator/VvNavSeparator.es.js +24 -0
  83. package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -0
  84. package/dist/components/VvProgress/VvProgress.es.js +33 -6
  85. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  86. package/dist/components/VvRadio/VvRadio.es.js +35 -7
  87. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  88. package/dist/components/VvRadio/VvRadio.vue.d.ts +8 -8
  89. package/dist/components/VvRadio/index.d.ts +1 -1
  90. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +106 -51
  91. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  92. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
  93. package/dist/components/VvRadioGroup/index.d.ts +1 -1
  94. package/dist/components/VvSelect/VvSelect.es.js +159 -99
  95. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  96. package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
  97. package/dist/components/VvSelect/index.d.ts +1 -1
  98. package/dist/components/VvTab/VvTab.es.js +214 -99
  99. package/dist/components/VvTab/VvTab.umd.js +1 -1
  100. package/dist/components/VvTab/VvTab.vue.d.ts +40 -11
  101. package/dist/components/VvTab/index.d.ts +9 -3
  102. package/dist/components/VvTextarea/VvTextarea.es.js +123 -77
  103. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  104. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
  105. package/dist/components/VvTooltip/VvTooltip.es.js +40 -9
  106. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  107. package/dist/components/index.es.js +1593 -1012
  108. package/dist/components/index.umd.js +1 -1
  109. package/dist/composables/group/useInjectedGroupState.d.ts +1 -1
  110. package/dist/composables/useOptions.d.ts +1 -1
  111. package/dist/composables/useVolver.d.ts +1 -1
  112. package/dist/directives/index.d.ts +3 -5
  113. package/dist/directives/index.es.js +60 -23
  114. package/dist/directives/index.umd.js +1 -1
  115. package/dist/directives/v-tooltip.es.js +58 -18
  116. package/dist/directives/v-tooltip.umd.js +1 -1
  117. package/dist/icons.es.js +3 -3
  118. package/dist/icons.umd.js +1 -1
  119. package/dist/index.d.ts +3 -1
  120. package/dist/index.es.js +19 -16
  121. package/dist/index.umd.js +1 -1
  122. package/dist/props/index.d.ts +58 -34
  123. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +50 -15
  124. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +332 -83
  125. package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
  126. package/dist/stories/Combobox/ComboboxOptions.stories.d.ts +1 -0
  127. package/dist/stories/InputText/InputTextMask.stories.d.ts +1 -1
  128. package/dist/stories/Tab/Tab.settings.d.ts +4 -37
  129. package/dist/types/alert.d.ts +13 -0
  130. package/dist/types/floating-ui.d.ts +6 -0
  131. package/dist/types/generic.d.ts +4 -0
  132. package/dist/types/group.d.ts +37 -0
  133. package/dist/types/index.d.ts +5 -0
  134. package/dist/types/nav.d.ts +17 -0
  135. package/package.json +61 -52
  136. package/src/Volver.ts +22 -16
  137. package/src/assets/icons/detailed.json +1 -1
  138. package/src/assets/icons/normal.json +1 -1
  139. package/src/assets/icons/simple.json +1 -1
  140. package/src/components/VvAccordion/VvAccordion.vue +2 -2
  141. package/src/components/VvAction/VvAction.vue +5 -2
  142. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +20 -19
  143. package/src/components/VvBreadcrumb/index.ts +2 -8
  144. package/src/components/VvCombobox/VvCombobox.vue +32 -33
  145. package/src/components/VvCombobox/index.ts +4 -0
  146. package/src/components/VvInputText/VvInputText.vue +2 -2
  147. package/src/components/VvNav/VvNav.vue +30 -50
  148. package/src/components/VvNav/VvNavItem.vue +18 -0
  149. package/src/components/VvNav/VvNavSeparator.vue +11 -0
  150. package/src/components/VvNav/index.ts +2 -15
  151. package/src/components/VvSelect/VvSelect.vue +4 -4
  152. package/src/components/VvTab/VvTab.vue +63 -35
  153. package/src/components/VvTab/index.ts +10 -4
  154. package/src/components/VvTextarea/VvTextarea.vue +1 -1
  155. package/src/composables/useOptions.ts +2 -2
  156. package/src/composables/useUniqueId.ts +2 -2
  157. package/src/directives/index.ts +1 -4
  158. package/src/directives/v-tooltip.ts +19 -10
  159. package/src/index.ts +3 -1
  160. package/src/props/index.ts +27 -3
  161. package/src/stories/Button/ButtonModifiers.stories.ts +4 -14
  162. package/src/stories/Combobox/Combobox.settings.ts +8 -0
  163. package/src/stories/Combobox/ComboboxOptions.stories.ts +18 -0
  164. package/src/stories/InputText/InputTextMask.stories.ts +1 -1
  165. package/src/stories/Nav/Nav.settings.ts +3 -4
  166. package/src/stories/Nav/Nav.test.ts +4 -15
  167. package/src/stories/Tab/Tab.settings.ts +9 -9
  168. package/src/stories/Tab/Tab.stories.ts +2 -2
  169. package/src/stories/Tab/Tab.test.ts +6 -14
  170. package/src/stories/argTypes.ts +1 -1
  171. package/src/types/generic.ts +6 -0
  172. package/src/types/index.ts +5 -0
  173. package/src/types/nav.ts +19 -0
  174. package/src/utils/ObjectUtilities.ts +3 -2
  175. package/dist/components/VvNav/VvNavItemTitle.vue.d.ts +0 -6
  176. package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +0 -19
  177. package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +0 -1
  178. package/src/components/VvNav/VvNavItemTitle.vue +0 -11
  179. package/src/components/VvNav/VvNavSeparator.ts +0 -8
  180. package/src/types/generic.d.ts +0 -6
  181. /package/dist/components/VvNav/{VvNavSeparator.d.ts → VvNavSeparator.vue.d.ts} +0 -0
  182. /package/src/types/{alert.d.ts → alert.ts} +0 -0
  183. /package/src/types/{floating-ui.d.ts → floating-ui.ts} +0 -0
  184. /package/src/types/{group.d.ts → group.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { inject, defineComponent, ref, watch, computed, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, toRefs, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, createVNode, toHandlers } from "vue";
1
+ import { inject, defineComponent, ref, watch, computed, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, createElementBlock, createVNode, toRefs, normalizeClass, createElementVNode, withModifiers, Fragment, renderList, toHandlers, normalizeProps, guardReactiveProps, createCommentVNode } from "vue";
2
2
  var Strategy = /* @__PURE__ */ ((Strategy2) => {
3
3
  Strategy2["absolute"] = "absolute";
4
4
  Strategy2["fixed"] = "fixed";
@@ -93,6 +93,12 @@ const ActiveProps = {
93
93
  */
94
94
  active: Boolean
95
95
  };
96
+ const CurrentProps = {
97
+ /**
98
+ * Whether the item is current
99
+ */
100
+ current: Boolean
101
+ };
96
102
  const PressedProps = {
97
103
  /**
98
104
  * Whether the item is pressed
@@ -223,6 +229,7 @@ const ActionProps = {
223
229
  ...LabelProps,
224
230
  ...PressedProps,
225
231
  ...ActiveProps,
232
+ ...CurrentProps,
226
233
  ...LinkProps,
227
234
  /**
228
235
  * Button type
@@ -238,25 +245,40 @@ const ActionProps = {
238
245
  ariaLabel: {
239
246
  type: String,
240
247
  default: void 0
248
+ },
249
+ /**
250
+ * Default tag for the action
251
+ */
252
+ defaultTag: {
253
+ type: String,
254
+ default: ActionTag.button
241
255
  }
242
256
  };
243
- const VvTabProps = {
244
- ...ModifiersProps,
257
+ const NavProps = {
245
258
  items: {
246
259
  type: Array,
247
- required: true,
248
260
  default: () => []
249
261
  }
250
262
  };
251
- const VvTabEvents = ["click"];
252
- const VvNavProps = {
263
+ const VvTabProps = {
253
264
  ...ModifiersProps,
265
+ navModifiers: {
266
+ type: [String, Array]
267
+ },
268
+ modelValue: {
269
+ type: String,
270
+ default: ""
271
+ },
254
272
  items: {
255
273
  type: Array,
256
- required: true,
257
274
  default: () => []
258
275
  }
259
276
  };
277
+ const VvTabEvents = ["update:modelValue"];
278
+ const VvNavProps = {
279
+ ...ModifiersProps,
280
+ ...NavProps
281
+ };
260
282
  const VvNavEvents = ["click"];
261
283
  const VvActionEvents = ["click", "mouseover", "mouseleave"];
262
284
  const VvActionProps = ActionProps;
@@ -269,11 +291,11 @@ function useInjectedDropdownTrigger() {
269
291
  function useInjectedDropdownAction() {
270
292
  return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
271
293
  }
272
- const __default__ = {
294
+ const __default__$1 = {
273
295
  name: "VvAction"
274
296
  };
275
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
276
- ...__default__,
297
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
298
+ ...__default__$1,
277
299
  props: VvActionProps,
278
300
  emits: VvActionEvents,
279
301
  setup(__props, { expose: __expose, emit }) {
@@ -308,7 +330,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
308
330
  case props.href !== void 0:
309
331
  return ActionTag.a;
310
332
  default:
311
- return ActionTag.button;
333
+ return props.defaultTag;
312
334
  }
313
335
  });
314
336
  const hasProps = computed(() => {
@@ -333,12 +355,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
333
355
  to: props.to,
334
356
  target: props.target
335
357
  };
336
- default:
358
+ case ActionTag.button:
337
359
  return {
338
360
  ...toReturn,
339
361
  type: props.type,
340
362
  disabled: props.disabled
341
363
  };
364
+ default:
365
+ return toReturn;
342
366
  }
343
367
  });
344
368
  const onClick = (e) => {
@@ -364,7 +388,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
364
388
  class: {
365
389
  active: _ctx.active,
366
390
  pressed: unref(pressed),
367
- disabled: _ctx.disabled
391
+ disabled: _ctx.disabled,
392
+ current: _ctx.current
368
393
  },
369
394
  onClickPassive: onClick,
370
395
  onMouseoverPassive: onMouseover,
@@ -372,14 +397,49 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
372
397
  }), {
373
398
  default: withCtx(() => [
374
399
  renderSlot(_ctx.$slots, "default", {}, () => [
375
- createTextVNode(toDisplayString(_ctx.label), 1)
400
+ createTextVNode(
401
+ toDisplayString(_ctx.label),
402
+ 1
403
+ /* TEXT */
404
+ )
376
405
  ])
377
406
  ]),
378
407
  _: 3
408
+ /* FORWARDED */
379
409
  }, 16, ["class"]);
380
410
  };
381
411
  }
382
412
  });
413
+ const _hoisted_1$1 = {
414
+ class: "vv-nav__item",
415
+ role: "presentation"
416
+ };
417
+ const __default__ = {
418
+ name: "VvNavItem",
419
+ inheritAttrs: false
420
+ };
421
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
422
+ ...__default__,
423
+ setup(__props) {
424
+ return (_ctx, _cache) => {
425
+ return openBlock(), createElementBlock("li", _hoisted_1$1, [
426
+ createVNode(
427
+ _sfc_main$3,
428
+ mergeProps(_ctx.$attrs, { class: "vv-nav__item-label" }),
429
+ {
430
+ default: withCtx(() => [
431
+ renderSlot(_ctx.$slots, "default")
432
+ ]),
433
+ _: 3
434
+ /* FORWARDED */
435
+ },
436
+ 16
437
+ /* FULL_PROPS */
438
+ )
439
+ ]);
440
+ };
441
+ }
442
+ });
383
443
  function useModifiers(prefix, modifiers, others) {
384
444
  return computed(() => {
385
445
  const toReturn = {
@@ -403,71 +463,68 @@ function useModifiers(prefix, modifiers, others) {
403
463
  return toReturn;
404
464
  });
405
465
  }
406
- const _hoisted_1$1 = {
407
- class: "vv-nav__menu",
408
- role: "menu",
409
- "aria-busy": "true"
410
- };
466
+ const _hoisted_1 = ["onClick"];
411
467
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
412
468
  __name: "VvNav",
413
469
  props: VvNavProps,
414
470
  emits: VvNavEvents,
415
471
  setup(__props, { emit }) {
416
472
  const props = __props;
417
- const { modifiers, items } = toRefs(props);
418
- const activeItem = ref(null);
419
- const bemCssClasses = useModifiers("vv-nav", modifiers);
420
- const localItems = computed(() => {
421
- return items.value.map((item, index) => {
422
- return {
423
- ...item,
424
- id: item.id || `nav-item_${index}`
425
- };
426
- });
427
- });
428
- function onClick(item) {
429
- if (!item.disabled) {
473
+ const { modifiers } = toRefs(props);
474
+ const onClick = (event) => {
475
+ var _a;
476
+ const target = event.target;
477
+ if (target == null ? void 0 : target.dataset.index) {
478
+ const index = parseInt(target.dataset.index);
479
+ const item = (_a = props.items) == null ? void 0 : _a[index];
480
+ if (!item || (item == null ? void 0 : item.disabled)) {
481
+ return;
482
+ }
430
483
  emit("click", item);
431
- activeItem.value = item.id;
432
484
  }
433
- }
485
+ };
486
+ const bemCssClasses = useModifiers("vv-nav", modifiers);
434
487
  return (_ctx, _cache) => {
435
- return openBlock(), createElementBlock("nav", {
436
- class: normalizeClass(unref(bemCssClasses))
437
- }, [
438
- createElementVNode("ul", _hoisted_1$1, [
439
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(localItems), (navItem) => {
440
- return openBlock(), createElementBlock("li", {
441
- key: navItem.id,
442
- class: "vv-nav__item",
443
- role: "presentation"
444
- }, [
445
- createVNode(_sfc_main$2, mergeProps({
446
- disabled: navItem.disabled,
447
- to: navItem.to,
448
- href: navItem.href,
449
- tabindex: 0
450
- }, {
451
- class: [{
452
- current: unref(activeItem) == navItem.id,
453
- disabled: navItem.disabled
454
- }, "vv-nav__item-label"]
455
- }, toHandlers(navItem.on), {
456
- onClick: ($event) => onClick(navItem)
457
- }), {
458
- default: withCtx(() => [
459
- createTextVNode(toDisplayString(navItem.title), 1)
460
- ]),
461
- _: 2
462
- }, 1040, ["class", "onClick"])
463
- ]);
464
- }), 128))
465
- ])
466
- ], 2);
488
+ return openBlock(), createElementBlock(
489
+ "nav",
490
+ {
491
+ class: normalizeClass(unref(bemCssClasses))
492
+ },
493
+ [
494
+ createElementVNode("ul", {
495
+ class: "vv-nav__menu",
496
+ role: "menu",
497
+ "aria-busy": "true",
498
+ onClick: withModifiers(onClick, ["stop"])
499
+ }, [
500
+ renderSlot(_ctx.$slots, "default", {}, () => [
501
+ (openBlock(true), createElementBlock(
502
+ Fragment,
503
+ null,
504
+ renderList(_ctx.items, ({ on = {}, ...item }, index) => {
505
+ return openBlock(), createBlock(_sfc_main$2, mergeProps({
506
+ key: index,
507
+ "data-index": index
508
+ }, item, toHandlers(on)), {
509
+ default: withCtx(() => [
510
+ renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps({ item, index })))
511
+ ]),
512
+ _: 2
513
+ /* DYNAMIC */
514
+ }, 1040, ["data-index"]);
515
+ }),
516
+ 128
517
+ /* KEYED_FRAGMENT */
518
+ ))
519
+ ])
520
+ ], 8, _hoisted_1)
521
+ ],
522
+ 2
523
+ /* CLASS */
524
+ );
467
525
  };
468
526
  }
469
527
  });
470
- const _hoisted_1 = ["id"];
471
528
  const _sfc_main = /* @__PURE__ */ defineComponent({
472
529
  __name: "VvTab",
473
530
  props: VvTabProps,
@@ -475,41 +532,99 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
475
532
  setup(__props, { emit }) {
476
533
  const props = __props;
477
534
  const { modifiers, items } = toRefs(props);
478
- const activeTab = ref(null);
479
- const bemCssClasses = useModifiers("vv-tab", modifiers);
480
- const localItems = computed(() => {
481
- return items.value.map((item, index) => {
482
- return {
483
- ...item,
484
- id: item.id || `tab-item_${index}`
485
- };
486
- });
535
+ const tabKeys = computed(() => {
536
+ return items.value.reduce((acc, item) => {
537
+ if (item.tab) {
538
+ acc.push(item.tab);
539
+ }
540
+ return acc;
541
+ }, []);
487
542
  });
488
- function onClick(item) {
489
- if (!item.disabled) {
490
- emit("click", item);
491
- activeTab.value = item.id;
543
+ const localModelValue = ref();
544
+ const activeTabKey = computed({
545
+ get: () => {
546
+ var _a;
547
+ return props.modelValue || localModelValue.value || ((_a = tabKeys.value) == null ? void 0 : _a[0]);
548
+ },
549
+ set: (newValue) => {
550
+ localModelValue.value = newValue;
551
+ emit("update:modelValue", newValue);
492
552
  }
493
- }
553
+ });
554
+ const hasNavModifiers = computed(() => {
555
+ var _a;
556
+ return [
557
+ "tabs",
558
+ ...Array.isArray(props.navModifiers) ? props.navModifiers : ((_a = props.navModifiers) == null ? void 0 : _a.split(" ")) ?? []
559
+ ];
560
+ });
561
+ const onNavClick = (item) => {
562
+ if (item.tab) {
563
+ activeTabKey.value = item.tab;
564
+ }
565
+ };
566
+ const navItems = computed(
567
+ () => props.items.map((item) => ({
568
+ current: item.tab === activeTabKey.value,
569
+ ...item
570
+ }))
571
+ );
572
+ const bemCssClasses = useModifiers("vv-tab", modifiers);
494
573
  return (_ctx, _cache) => {
495
- return openBlock(), createElementBlock("div", {
496
- class: normalizeClass(unref(bemCssClasses))
497
- }, [
498
- createVNode(_sfc_main$1, {
499
- items: unref(localItems),
500
- modifiers: "tabs full",
501
- onClick
502
- }, null, 8, ["items"]),
503
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(localItems), (item) => {
504
- return openBlock(), createElementBlock("article", {
505
- id: item.id,
506
- key: item.id,
507
- class: normalizeClass([{ target: unref(activeTab) === item.id }, "vv-tab__panel"])
508
- }, [
509
- renderSlot(_ctx.$slots, `${item.id}`)
510
- ], 10, _hoisted_1);
511
- }), 128))
512
- ], 2);
574
+ return openBlock(), createElementBlock(
575
+ "div",
576
+ {
577
+ class: normalizeClass(unref(bemCssClasses))
578
+ },
579
+ [
580
+ createVNode(
581
+ _sfc_main$1,
582
+ mergeProps({
583
+ items: unref(navItems),
584
+ modifiers: unref(hasNavModifiers)
585
+ }, { onClick: onNavClick }),
586
+ {
587
+ item: withCtx(({ item, index }) => [
588
+ renderSlot(_ctx.$slots, "nav-item", normalizeProps(guardReactiveProps({ item, index })))
589
+ ]),
590
+ _: 3
591
+ /* FORWARDED */
592
+ },
593
+ 16
594
+ /* FULL_PROPS */
595
+ ),
596
+ (openBlock(true), createElementBlock(
597
+ Fragment,
598
+ null,
599
+ renderList(unref(items), (item, index) => {
600
+ return openBlock(), createElementBlock(
601
+ Fragment,
602
+ { key: index },
603
+ [
604
+ item.tab ? (openBlock(), createElementBlock(
605
+ "article",
606
+ {
607
+ key: 0,
608
+ class: normalizeClass([{ target: unref(activeTabKey) === item.tab }, "vv-tab__panel"])
609
+ },
610
+ [
611
+ renderSlot(_ctx.$slots, `panel::${item.tab}`)
612
+ ],
613
+ 2
614
+ /* CLASS */
615
+ )) : createCommentVNode("v-if", true)
616
+ ],
617
+ 64
618
+ /* STABLE_FRAGMENT */
619
+ );
620
+ }),
621
+ 128
622
+ /* KEYED_FRAGMENT */
623
+ ))
624
+ ],
625
+ 2
626
+ /* CLASS */
627
+ );
513
628
  };
514
629
  }
515
630
  });
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTab=t(e.vue)}(this,(function(e){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),l=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(l||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{}),n=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(n||{});const a=Symbol.for("volver"),i=Symbol.for("dropdownTrigger"),s=Symbol.for("dropdownAction"),u={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(n).includes(e)},rel:{type:String,default:"noopener noreferrer"}},d={disabled:Boolean},c={active:Boolean},v={pressed:Boolean},f={label:[String,Number]},m={modifiers:[String,Array]};o.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const p={...d,...f,...v,...c,...u,type:{type:String,default:l.button,validator:e=>Object.values(l).includes(e)},ariaLabel:{type:String,default:void 0}},b={...m,items:{type:Array,required:!0,default:()=>[]}},k={...m,items:{type:Array,required:!0,default:()=>[]}},y=p;const g=e.defineComponent({name:"VvAction",props:y,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:l}){const n=t,u=e.inject(a),d=e.ref(null);o({$el:d});const{reference:c,bus:v,aria:f,expanded:m}=e.inject(i,{});e.watch((()=>d.value),(e=>{c&&(c.value=e)}));const p=e.computed((()=>n.pressed||(null==m?void 0:m.value))),{role:b}=e.inject(s,{}),k=e.computed((()=>{switch(!0){case n.disabled:return r.button;case void 0!==n.to:return(null==u?void 0:u.nuxt)?r.nuxtLink:r.routerLink;case void 0!==n.href:return r.a;default:return r.button}})),y=e.computed((()=>{const e={...null==f?void 0:f.value,ariaPressed:!!p.value||void 0,ariaLabel:n.ariaLabel,role:null==b?void 0:b.value};switch(k.value){case r.a:return{...e,href:n.href,target:n.target,rel:n.rel};case r.routerLink:case r.nuxtLink:return{...e,to:n.to,target:n.target};default:return{...e,type:n.type,disabled:n.disabled}}})),g=e=>{n.disabled?e.preventDefault():(null==v||v.emit("click",e),l("click",e))},B=e=>{null==v||v.emit("mouseover",e),l("mouseover",e)},_=e=>{null==v||v.emit("mouseleave",e),l("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k)),e.mergeProps(e.unref(y),{ref_key:"element",ref:d,class:{active:t.active,pressed:e.unref(p),disabled:t.disabled},onClickPassive:g,onMouseoverPassive:B,onMouseleavePassive:_}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function B(t,o,l){return e.computed((()=>{const r={[t]:!0},n="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(r[`${t}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((o=>{r[`${t}--${o}`]=e.unref(l.value[o])})),r}))}const _={class:"vv-nav__menu",role:"menu","aria-busy":"true"},h=e.defineComponent({__name:"VvNav",props:k,emits:["click"],setup(t,{emit:o}){const l=t,{modifiers:r,items:n}=e.toRefs(l),a=e.ref(null),i=B("vv-nav",r),s=e.computed((()=>n.value.map(((e,t)=>({...e,id:e.id||`nav-item_${t}`})))));return(t,l)=>(e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(e.unref(i))},[e.createElementVNode("ul",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),(t=>(e.openBlock(),e.createElementBlock("li",{key:t.id,class:"vv-nav__item",role:"presentation"},[e.createVNode(g,e.mergeProps({disabled:t.disabled,to:t.to,href:t.href,tabindex:0},{class:[{current:e.unref(a)==t.id,disabled:t.disabled},"vv-nav__item-label"]},e.toHandlers(t.on),{onClick:e=>{var l;(l=t).disabled||(o("click",l),a.value=l.id)}}),{default:e.withCtx((()=>[e.createTextVNode(e.toDisplayString(t.title),1)])),_:2},1040,["class","onClick"])])))),128))])],2))}}),S=["id"];return e.defineComponent({__name:"VvTab",props:b,emits:["click"],setup(t,{emit:o}){const l=t,{modifiers:r,items:n}=e.toRefs(l),a=e.ref(null),i=B("vv-tab",r),s=e.computed((()=>n.value.map(((e,t)=>({...e,id:e.id||`tab-item_${t}`})))));function u(e){e.disabled||(o("click",e),a.value=e.id)}return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(i))},[e.createVNode(h,{items:e.unref(s),modifiers:"tabs full",onClick:u},null,8,["items"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),(o=>(e.openBlock(),e.createElementBlock("article",{id:o.id,key:o.id,class:e.normalizeClass([{target:e.unref(a)===o.id},"vv-tab__panel"])},[e.renderSlot(t.$slots,`${o.id}`)],10,S)))),128))],2))}})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvTab=t(e.vue)}(this,(function(e){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),r=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(r||{}),n=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(n||{}),a=(e=>(e._blank="_blank",e._self="_self",e._parent="_parent",e._top="_top",e))(a||{});const l=Symbol.for("volver"),i=Symbol.for("dropdownTrigger"),s=Symbol.for("dropdownAction"),u={to:{type:[String,Object]},href:String,target:{type:String,validator:e=>Object.values(a).includes(e)},rel:{type:String,default:"noopener noreferrer"}},d={disabled:Boolean},c={active:Boolean},m={current:Boolean},v={pressed:Boolean},p={label:[String,Number]},f={modifiers:[String,Array]};o.before,t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const b={...d,...p,...v,...c,...m,...u,type:{type:String,default:r.button,validator:e=>Object.values(r).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:n.button}},k={items:{type:Array,default:()=>[]}},g={...f,navModifiers:{type:[String,Array]},modelValue:{type:String,default:""},items:{type:Array,default:()=>[]}},y={...f,...k},B=b;const _=e.defineComponent({name:"VvAction",props:B,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:r}){const a=t,u=e.inject(l),d=e.ref(null);o({$el:d});const{reference:c,bus:m,aria:v,expanded:p}=e.inject(i,{});e.watch((()=>d.value),(e=>{c&&(c.value=e)}));const f=e.computed((()=>a.pressed||(null==p?void 0:p.value))),{role:b}=e.inject(s,{}),k=e.computed((()=>{switch(!0){case a.disabled:return n.button;case void 0!==a.to:return(null==u?void 0:u.nuxt)?n.nuxtLink:n.routerLink;case void 0!==a.href:return n.a;default:return a.defaultTag}})),g=e.computed((()=>{const e={...null==v?void 0:v.value,ariaPressed:!!f.value||void 0,ariaLabel:a.ariaLabel,role:null==b?void 0:b.value};switch(k.value){case n.a:return{...e,href:a.href,target:a.target,rel:a.rel};case n.routerLink:case n.nuxtLink:return{...e,to:a.to,target:a.target};case n.button:return{...e,type:a.type,disabled:a.disabled};default:return e}})),y=e=>{a.disabled?e.preventDefault():(null==m||m.emit("click",e),r("click",e))},B=e=>{null==m||m.emit("mouseover",e),r("mouseover",e)},_=e=>{null==m||m.emit("mouseleave",e),r("mouseleave",e)};return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(k)),e.mergeProps(e.unref(g),{ref_key:"element",ref:d,class:{active:t.active,pressed:e.unref(f),disabled:t.disabled,current:t.current},onClickPassive:y,onMouseoverPassive:B,onMouseleavePassive:_}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}}),h={class:"vv-nav__item",role:"presentation"},x=e.defineComponent({name:"VvNavItem",inheritAttrs:!1,setup:t=>(t,o)=>(e.openBlock(),e.createElementBlock("li",h,[e.createVNode(_,e.mergeProps(t.$attrs,{class:"vv-nav__item-label"}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default")])),_:3},16)]))});function S(t,o,r){return e.computed((()=>{const n={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{n[`${t}--${o}`]=e.unref(r.value[o])})),n}))}const C=["onClick"],V=e.defineComponent({__name:"VvNav",props:y,emits:["click"],setup(t,{emit:o}){const r=t,{modifiers:n}=e.toRefs(r),a=e=>{var t;const n=e.target;if(null==n?void 0:n.dataset.index){const e=parseInt(n.dataset.index),a=null==(t=r.items)?void 0:t[e];if(!a||(null==a?void 0:a.disabled))return;o("click",a)}},l=S("vv-nav",n);return(t,o)=>(e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(e.unref(l))},[e.createElementVNode("ul",{class:"vv-nav__menu",role:"menu","aria-busy":"true",onClick:e.withModifiers(a,["stop"])},[e.renderSlot(t.$slots,"default",{},(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(({on:o={},...r},n)=>(e.openBlock(),e.createBlock(x,e.mergeProps({key:n,"data-index":n},r,e.toHandlers(o)),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"item",e.normalizeProps(e.guardReactiveProps({item:r,index:n})))])),_:2},1040,["data-index"])))),128))]))],8,C)],2))}});return e.defineComponent({__name:"VvTab",props:g,emits:["update:modelValue"],setup(t,{emit:o}){const r=t,{modifiers:n,items:a}=e.toRefs(r),l=e.computed((()=>a.value.reduce(((e,t)=>(t.tab&&e.push(t.tab),e)),[]))),i=e.ref(),s=e.computed({get:()=>{var e;return r.modelValue||i.value||(null==(e=l.value)?void 0:e[0])},set:e=>{i.value=e,o("update:modelValue",e)}}),u=e.computed((()=>{var e;return["tabs",...Array.isArray(r.navModifiers)?r.navModifiers:(null==(e=r.navModifiers)?void 0:e.split(" "))??[]]})),d=e=>{e.tab&&(s.value=e.tab)},c=e.computed((()=>r.items.map((e=>({current:e.tab===s.value,...e}))))),m=S("vv-tab",n);return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(m))},[e.createVNode(V,e.mergeProps({items:e.unref(c),modifiers:e.unref(u)},{onClick:d}),{item:e.withCtx((({item:o,index:r})=>[e.renderSlot(t.$slots,"nav-item",e.normalizeProps(e.guardReactiveProps({item:o,index:r})))])),_:3},16),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),((o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r},[o.tab?(e.openBlock(),e.createElementBlock("article",{key:0,class:e.normalizeClass([{target:e.unref(s)===o.tab},"vv-tab__panel"])},[e.renderSlot(t.$slots,`panel::${o.tab}`)],2)):e.createCommentVNode("v-if",!0)],64)))),128))],2))}})}));
@@ -1,23 +1,52 @@
1
- import type { NavItem } from '@/components/VvNav';
1
+ import type { NavItemTab } from '@/types/nav';
2
2
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
3
+ navModifiers: {
4
+ type: globalThis.PropType<string | string[]>;
5
+ };
6
+ modelValue: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
3
10
  items: {
4
- type: globalThis.PropType<NavItem[]>;
5
- required: boolean;
11
+ type: globalThis.PropType<NavItemTab[]>;
6
12
  default: () => never[];
7
13
  };
8
14
  modifiers: globalThis.PropType<string | string[]>;
9
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, string[], string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ [x: string]: (...args: any[]) => void;
17
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
18
+ navModifiers: {
19
+ type: globalThis.PropType<string | string[]>;
20
+ };
21
+ modelValue: {
22
+ type: StringConstructor;
23
+ default: string;
24
+ };
10
25
  items: {
11
- type: globalThis.PropType<NavItem[]>;
12
- required: boolean;
26
+ type: globalThis.PropType<NavItemTab[]>;
13
27
  default: () => never[];
14
28
  };
15
29
  modifiers: globalThis.PropType<string | string[]>;
16
- }>> & {
17
- [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
18
- }, {
19
- items: NavItem[];
20
- }, {}>, Partial<Record<string, (_: {}) => any>>>;
30
+ }>>, {
31
+ modelValue: string;
32
+ items: NavItemTab[];
33
+ }, {}>, Partial<Record<string, (_: {}) => any>> & {
34
+ "nav-item"?(_: {
35
+ item: {
36
+ label: string;
37
+ ariaLabel?: string | undefined;
38
+ title?: string | undefined;
39
+ to?: string | Record<string, unknown> | undefined;
40
+ href?: string | undefined;
41
+ target?: "_blank" | "_self" | "_parent" | "_top" | undefined;
42
+ rel?: string | undefined;
43
+ disabled?: boolean | undefined;
44
+ current?: boolean | undefined;
45
+ class?: string | string[] | undefined;
46
+ };
47
+ index: number;
48
+ }): any;
49
+ }>;
21
50
  export default _default;
22
51
  type __VLS_WithTemplateSlots<T, S> = T & {
23
52
  new (): {
@@ -1,8 +1,14 @@
1
- import type { NavItem } from '../VvNav';
1
+ import type { NavItemTab } from '@/types/nav';
2
2
  export declare const VvTabProps: {
3
+ navModifiers: {
4
+ type: globalThis.PropType<string | string[]>;
5
+ };
6
+ modelValue: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
3
10
  items: {
4
- type: globalThis.PropType<NavItem[]>;
5
- required: boolean;
11
+ type: globalThis.PropType<NavItemTab[]>;
6
12
  default: () => never[];
7
13
  };
8
14
  modifiers: globalThis.PropType<string | string[]>;