@volverjs/ui-vue 0.0.9-beta.2 → 0.0.9-beta.20

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 (146) hide show
  1. package/README.md +3 -3
  2. package/auto-imports.d.ts +2 -0
  3. package/dist/components/VvAccordion/VvAccordion.es.js +7 -0
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +7 -0
  5. package/dist/components/VvAction/VvAction.es.js +9 -1
  6. package/dist/components/VvAction/VvAction.umd.js +1 -1
  7. package/dist/components/VvAction/VvAction.vue.d.ts +9 -0
  8. package/dist/components/VvAction/index.d.ts +4 -0
  9. package/dist/components/VvAlert/VvAlert.es.js +14 -6
  10. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  11. package/dist/components/VvAlert/VvAlert.vue.d.ts +6 -6
  12. package/dist/components/VvAlert/index.d.ts +3 -3
  13. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +14 -6
  14. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  15. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +3 -3
  16. package/dist/components/VvAlertGroup/index.d.ts +1 -1
  17. package/dist/components/VvAvatar/VvAvatar.es.js +7 -0
  18. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -0
  19. package/dist/components/VvBadge/VvBadge.es.js +7 -0
  20. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +7 -0
  21. package/dist/components/VvButton/VvButton.es.js +11 -2
  22. package/dist/components/VvButton/VvButton.umd.js +1 -1
  23. package/dist/components/VvButton/VvButton.vue.d.ts +9 -0
  24. package/dist/components/VvButton/index.d.ts +4 -0
  25. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -0
  26. package/dist/components/VvCard/VvCard.es.js +7 -0
  27. package/dist/components/VvCheckbox/VvCheckbox.es.js +91 -14
  28. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  29. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +97 -15
  31. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  32. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +4 -4
  33. package/dist/components/VvCombobox/VvCombobox.es.js +243 -179
  34. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  35. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +323 -95
  36. package/dist/components/VvCombobox/index.d.ts +123 -35
  37. package/dist/components/VvDialog/VvDialog.es.js +42 -30
  38. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  39. package/dist/components/VvDropdown/VvDropdown.es.js +19 -6
  40. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  41. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +291 -84
  42. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +9 -0
  43. package/dist/components/VvDropdown/index.d.ts +96 -27
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +9 -1
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  46. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +7 -0
  47. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +7 -0
  48. package/dist/components/VvInputText/VvInputText.es.js +271 -109
  49. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  50. package/dist/components/VvInputText/VvInputText.vue.d.ts +23 -41
  51. package/dist/components/VvInputText/index.d.ts +25 -35
  52. package/dist/components/VvNav/VvNav.es.js +10 -2
  53. package/dist/components/VvNav/VvNav.umd.js +1 -1
  54. package/dist/components/VvNav/index.d.ts +1 -1
  55. package/dist/components/VvProgress/VvProgress.es.js +7 -0
  56. package/dist/components/VvRadio/VvRadio.es.js +91 -14
  57. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  59. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +97 -15
  60. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  61. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +4 -4
  62. package/dist/components/VvSelect/VvSelect.es.js +87 -14
  63. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  64. package/dist/components/VvSelect/VvSelect.vue.d.ts +5 -5
  65. package/dist/components/VvTab/VvTab.es.js +10 -2
  66. package/dist/components/VvTab/VvTab.umd.js +1 -1
  67. package/dist/components/VvTextarea/VvTextarea.es.js +95 -19
  68. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  69. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +4 -4
  70. package/dist/components/VvTooltip/VvTooltip.es.js +7 -0
  71. package/dist/components/common/HintSlot.d.ts +4 -3
  72. package/dist/components/index.d.ts +5 -0
  73. package/dist/components/index.es.js +1199 -614
  74. package/dist/components/index.umd.js +1 -1
  75. package/dist/composables/alert/useAlert.d.ts +27 -0
  76. package/dist/composables/index.d.ts +1 -0
  77. package/dist/composables/index.es.js +81 -0
  78. package/dist/composables/index.umd.js +1 -0
  79. package/dist/constants.d.ts +10 -0
  80. package/dist/directives/index.es.js +7 -0
  81. package/dist/directives/v-tooltip.es.js +7 -0
  82. package/dist/icons.es.js +3 -3
  83. package/dist/icons.umd.js +1 -1
  84. package/dist/props/index.d.ts +103 -27
  85. package/dist/resolvers/unplugin.es.js +3 -0
  86. package/dist/resolvers/unplugin.umd.js +1 -1
  87. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
  88. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +54 -269
  89. package/dist/stories/Alert/Alert.settings.d.ts +3 -7
  90. package/dist/stories/AlertGroup/AlertGroupSlots.stories.d.ts +2 -2
  91. package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +6 -0
  92. package/dist/stories/Button/Button.settings.d.ts +3 -13
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +117 -19
  94. package/dist/stories/InputText/InputText.settings.d.ts +31 -9
  95. package/dist/stories/InputText/InputText.stories.d.ts +0 -1
  96. package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
  97. package/dist/stories/Nav/Nav.settings.d.ts +3 -21
  98. package/package.json +75 -66
  99. package/src/assets/icons/detailed.json +1 -1
  100. package/src/assets/icons/normal.json +1 -1
  101. package/src/assets/icons/simple.json +1 -1
  102. package/src/components/VvAction/VvAction.vue +2 -1
  103. package/src/components/VvAlert/VvAlert.vue +5 -1
  104. package/src/components/VvAlert/index.ts +3 -3
  105. package/src/components/VvAlertGroup/VvAlertGroup.vue +2 -0
  106. package/src/components/VvButton/VvButton.vue +1 -0
  107. package/src/components/VvCheckbox/VvCheckbox.vue +8 -1
  108. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +8 -1
  109. package/src/components/VvCombobox/VvCombobox.vue +43 -23
  110. package/src/components/VvCombobox/index.ts +24 -0
  111. package/src/components/VvDialog/VvDialog.vue +22 -19
  112. package/src/components/VvDropdown/VvDropdown.vue +14 -9
  113. package/src/components/VvInputText/VvInputText.vue +177 -55
  114. package/src/components/VvInputText/index.ts +32 -34
  115. package/src/components/VvNav/VvNav.vue +1 -1
  116. package/src/components/VvNav/index.ts +1 -1
  117. package/src/components/VvRadio/VvRadio.vue +8 -1
  118. package/src/components/VvRadioGroup/VvRadioGroup.vue +8 -1
  119. package/src/components/VvSelect/VvSelect.vue +8 -1
  120. package/src/components/VvTextarea/VvTextarea.vue +16 -6
  121. package/src/components/common/HintSlot.ts +26 -13
  122. package/src/components/index.ts +5 -0
  123. package/src/composables/alert/useAlert.ts +103 -0
  124. package/src/composables/index.ts +1 -0
  125. package/src/constants.ts +21 -0
  126. package/src/props/index.ts +7 -0
  127. package/src/resolvers/unplugin.ts +3 -0
  128. package/src/stories/Alert/Alert.settings.ts +3 -1
  129. package/src/stories/AlertGroup/AlertGroup.test.ts +13 -0
  130. package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +3 -3
  131. package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +118 -0
  132. package/src/stories/Button/Button.settings.ts +5 -3
  133. package/src/stories/Combobox/Combobox.settings.ts +119 -2
  134. package/src/stories/Combobox/Combobox.test.ts +1 -1
  135. package/src/stories/InputText/InputText.settings.ts +36 -15
  136. package/src/stories/InputText/InputText.stories.ts +4 -12
  137. package/src/stories/InputText/InputText.test.ts +31 -15
  138. package/src/stories/InputText/InputTextMask.stories.ts +122 -0
  139. package/src/stories/Nav/Nav.settings.ts +3 -1
  140. package/src/stories/Tab/Tab.stories.ts +3 -3
  141. package/src/stories/Textarea/TextareaLength.stories.ts +1 -1
  142. package/src/types/alert.d.ts +20 -0
  143. /package/dist/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue.d.ts +0 -0
  144. /package/dist/components/{VvNavSeparator → VvNav}/VvNavSeparator.d.ts +0 -0
  145. /package/src/components/{VvNavItemTitle → VvNav}/VvNavItemTitle.vue +0 -0
  146. /package/src/components/{VvNavSeparator → VvNav}/VvNavSeparator.ts +0 -0
@@ -1,8 +1,8 @@
1
- import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, provide, h, Fragment, useAttrs, onMounted, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, useSlots, isRef, renderList, vModelSelect, createSlots, resolveDynamicComponent, toRef, withModifiers, vModelText } from "vue";
1
+ import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, provide, h, Fragment, useAttrs, onMounted, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, isRef, useSlots, renderList, vModelSelect, createSlots, resolveDynamicComponent, toRef, withModifiers, vModelText } from "vue";
2
2
  import { iconExists, Icon, addIcon } from "@iconify/vue";
3
3
  import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
4
4
  import { nanoid } from "nanoid";
5
- import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced } from "@vueuse/core";
5
+ import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
6
6
  import mitt from "mitt";
7
7
  import { get } from "ts-dot-prop";
8
8
  var Side = /* @__PURE__ */ ((Side2) => {
@@ -374,6 +374,13 @@ const ActionProps = {
374
374
  type: String,
375
375
  default: ButtonType.button,
376
376
  validator: (value) => Object.values(ButtonType).includes(value)
377
+ },
378
+ /**
379
+ * Button aria-label
380
+ */
381
+ ariaLabel: {
382
+ type: String,
383
+ default: void 0
377
384
  }
378
385
  };
379
386
  const VvComboboxEvents = [
@@ -398,6 +405,13 @@ const VvComboboxProps = {
398
405
  ...UnselectableProps,
399
406
  ...DropdownProps,
400
407
  ...LabelProps,
408
+ /**
409
+ * Dropdown show / hide transition name
410
+ */
411
+ transitionName: {
412
+ type: String,
413
+ default: "vv-dropdown--mobile-fade-block"
414
+ },
401
415
  /**
402
416
  * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
403
417
  */
@@ -429,6 +443,10 @@ const VvComboboxProps = {
429
443
  * Label for deselected option hint
430
444
  */
431
445
  deselectHintLabel: { type: String, default: "Press enter to remove" },
446
+ /**
447
+ * Label close button
448
+ */
449
+ closeLabel: { type: String, default: "Close" },
432
450
  /**
433
451
  * Select input placeholder
434
452
  */
@@ -437,6 +455,13 @@ const VvComboboxProps = {
437
455
  * Use input text to search on options
438
456
  */
439
457
  searchable: Boolean,
458
+ /**
459
+ * Search function to filter options
460
+ */
461
+ searchFunction: {
462
+ type: Function,
463
+ default: void 0
464
+ },
440
465
  /**
441
466
  * On searchable select is the input search placeholder
442
467
  */
@@ -866,7 +891,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
866
891
  }
867
892
  } else if (props.flip) {
868
893
  if (typeof props.flip === "boolean") {
869
- toReturn.push(flip());
894
+ toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
870
895
  } else {
871
896
  toReturn.push(flip(props.flip));
872
897
  }
@@ -922,23 +947,29 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
922
947
  referenceEl,
923
948
  floatingEl,
924
949
  {
925
- whileElementsMounted: autoUpdate,
950
+ whileElementsMounted: (...args) => {
951
+ return autoUpdate(...args, {
952
+ animationFrame: props.strategy === "fixed"
953
+ });
954
+ },
926
955
  placement: computed(() => props.placement),
927
956
  strategy: computed(() => props.strategy),
928
957
  middleware
929
958
  }
930
959
  );
931
960
  const dropdownPlacement = computed(() => {
961
+ var _a;
932
962
  if (hasCustomPosition.value) {
933
963
  return void 0;
934
964
  }
965
+ const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
935
966
  return {
936
967
  position: strategy.value,
937
968
  top: `${y.value ?? 0}px`,
938
969
  left: `${x.value ?? 0}px`,
939
- maxWidth: maxWidth.value,
970
+ maxWidth: width ? void 0 : maxWidth.value,
940
971
  maxHeight: maxHeight.value,
941
- width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
972
+ width
942
973
  };
943
974
  });
944
975
  const side = computed(
@@ -1009,7 +1040,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1009
1040
  onClickOutside(
1010
1041
  floatingEl,
1011
1042
  () => {
1012
- if (!props.keepOpen) {
1043
+ if (!props.keepOpen && expanded.value) {
1013
1044
  expanded.value = false;
1014
1045
  }
1015
1046
  },
@@ -1047,7 +1078,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1047
1078
  }
1048
1079
  return [
1049
1080
  ...element.querySelectorAll(
1050
- 'a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
1081
+ 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
1051
1082
  )
1052
1083
  ].filter(
1053
1084
  (el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
@@ -1433,19 +1464,27 @@ function joinLines(items) {
1433
1464
  }
1434
1465
  return items;
1435
1466
  }
1436
- function HintSlotFactory(props, slots) {
1437
- const invalidLabel = computed(() => joinLines(props.invalidLabel));
1438
- const validLabel = computed(() => joinLines(props.validLabel));
1439
- const loadingLabel = computed(() => props.loadingLabel);
1440
- const hintLabel = computed(() => props.hintLabel);
1467
+ function HintSlotFactory(propsOrRef, slots) {
1468
+ const props = computed(() => {
1469
+ if (isRef(propsOrRef)) {
1470
+ return propsOrRef.value;
1471
+ }
1472
+ return propsOrRef;
1473
+ });
1474
+ const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
1475
+ const validLabel = computed(() => joinLines(props.value.validLabel));
1476
+ const loadingLabel = computed(() => props.value.loadingLabel);
1477
+ const hintLabel = computed(() => props.value.hintLabel);
1441
1478
  const hasLoadingLabelOrSlot = computed(
1442
- () => Boolean(props.loading && (slots.loading || loadingLabel.value))
1479
+ () => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
1443
1480
  );
1444
1481
  const hasInvalidLabelOrSlot = computed(
1445
- () => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
1482
+ () => !hasLoadingLabelOrSlot.value && Boolean(
1483
+ props.value.invalid && (slots.invalid || invalidLabel.value)
1484
+ )
1446
1485
  );
1447
1486
  const hasValidLabelOrSlot = computed(
1448
- () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
1487
+ () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
1449
1488
  );
1450
1489
  const hasHintLabelOrSlot = computed(
1451
1490
  () => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
@@ -1454,10 +1493,10 @@ function HintSlotFactory(props, slots) {
1454
1493
  () => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
1455
1494
  );
1456
1495
  const hintSlotScope = computed(() => ({
1457
- modelValue: props.modelValue,
1458
- valid: props.valid,
1459
- invalid: props.invalid,
1460
- loading: props.loading
1496
+ modelValue: props.value.modelValue,
1497
+ valid: props.value.valid,
1498
+ invalid: props.value.invalid,
1499
+ loading: props.value.loading
1461
1500
  }));
1462
1501
  const HintSlot = defineComponent({
1463
1502
  name: "HintSlot",
@@ -1586,6 +1625,59 @@ const VvSelectProps = {
1586
1625
  placeholder: String
1587
1626
  };
1588
1627
  const VvSelectEmits = ["update:modelValue", "focus", "blur"];
1628
+ function useDefaults(componentName, propsDefinition, props) {
1629
+ const volver = useVolver();
1630
+ const volverComponentDefaults = computed(() => {
1631
+ var _a;
1632
+ if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
1633
+ return void 0;
1634
+ }
1635
+ return volver.defaults.value[componentName];
1636
+ });
1637
+ return computed(() => {
1638
+ if (volverComponentDefaults.value === void 0) {
1639
+ return props;
1640
+ }
1641
+ const componentDefaults = volverComponentDefaults.value;
1642
+ const simplifiedPropsDefinition = propsDefinition;
1643
+ const simplifiedProps = props;
1644
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
1645
+ const propValue = simplifiedProps[key];
1646
+ acc[key] = propValue;
1647
+ if (key in componentDefaults) {
1648
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
1649
+ const typeArray = simplifiedPropsDefinition[key];
1650
+ if (typeArray.length) {
1651
+ const typeFunction = typeArray[0];
1652
+ if (typeFunction === propValue) {
1653
+ acc[key] = componentDefaults[key];
1654
+ }
1655
+ }
1656
+ }
1657
+ if (typeof simplifiedPropsDefinition[key] === "function") {
1658
+ const typeFunction = simplifiedPropsDefinition[key];
1659
+ if (typeFunction() === propValue) {
1660
+ acc[key] = componentDefaults[key];
1661
+ }
1662
+ }
1663
+ if (typeof simplifiedPropsDefinition[key] === "object") {
1664
+ let defaultValue = simplifiedPropsDefinition[key].default;
1665
+ if (typeof defaultValue === "function") {
1666
+ defaultValue = defaultValue();
1667
+ }
1668
+ if (typeof defaultValue === "object") {
1669
+ if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
1670
+ acc[key] = componentDefaults[key];
1671
+ }
1672
+ } else if (defaultValue === propValue) {
1673
+ acc[key] = componentDefaults[key];
1674
+ }
1675
+ }
1676
+ }
1677
+ return acc;
1678
+ }, {});
1679
+ });
1680
+ }
1589
1681
  function useComponentFocus(inputTemplateRef, emit) {
1590
1682
  const { focused } = useFocus(inputTemplateRef);
1591
1683
  watch(focused, (newValue) => {
@@ -1688,13 +1780,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1688
1780
  setup(__props, { emit }) {
1689
1781
  const props = __props;
1690
1782
  const slots = useSlots();
1783
+ const propsDefaults = useDefaults(
1784
+ "VvSelect",
1785
+ VvSelectProps,
1786
+ props
1787
+ );
1691
1788
  const select = ref();
1692
1789
  const {
1693
1790
  HintSlot,
1694
1791
  hasHintLabelOrSlot,
1695
1792
  hasInvalidLabelOrSlot,
1696
1793
  hintSlotScope
1697
- } = HintSlotFactory(props, slots);
1794
+ } = HintSlotFactory(propsDefaults, slots);
1698
1795
  const {
1699
1796
  id,
1700
1797
  modifiers,
@@ -1965,7 +2062,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1965
2062
  const hasProps = computed(() => {
1966
2063
  const toReturn = {
1967
2064
  ...dropdownAria == null ? void 0 : dropdownAria.value,
1968
- "aria-pressed": pressed.value ? true : void 0,
2065
+ ariaPressed: pressed.value ? true : void 0,
2066
+ ariaLabel: props.ariaLabel,
1969
2067
  role: role == null ? void 0 : role.value
1970
2068
  };
1971
2069
  switch (hasTag.value) {
@@ -2264,7 +2362,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2264
2362
  to: _ctx.to,
2265
2363
  href: _ctx.href,
2266
2364
  target: _ctx.target,
2267
- rel: _ctx.rel
2365
+ rel: _ctx.rel,
2366
+ ariaLabel: _ctx.ariaLabel
2268
2367
  }, {
2269
2368
  id: unref(hasId),
2270
2369
  ref_key: "element",
@@ -2301,59 +2400,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2301
2400
  };
2302
2401
  }
2303
2402
  });
2304
- function useDefaults(componentName, propsDefinition, props) {
2305
- const volver = useVolver();
2306
- const volverComponentDefaults = computed(() => {
2307
- var _a;
2308
- if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
2309
- return void 0;
2310
- }
2311
- return volver.defaults.value[componentName];
2312
- });
2313
- return computed(() => {
2314
- if (volverComponentDefaults.value === void 0) {
2315
- return props;
2316
- }
2317
- const componentDefaults = volverComponentDefaults.value;
2318
- const simplifiedPropsDefinition = propsDefinition;
2319
- const simplifiedProps = props;
2320
- return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
2321
- const propValue = simplifiedProps[key];
2322
- acc[key] = propValue;
2323
- if (key in componentDefaults) {
2324
- if (Array.isArray(simplifiedPropsDefinition[key])) {
2325
- const typeArray = simplifiedPropsDefinition[key];
2326
- if (typeArray.length) {
2327
- const typeFunction = typeArray[0];
2328
- if (typeFunction === propValue) {
2329
- acc[key] = componentDefaults[key];
2330
- }
2331
- }
2332
- }
2333
- if (typeof simplifiedPropsDefinition[key] === "function") {
2334
- const typeFunction = simplifiedPropsDefinition[key];
2335
- if (typeFunction() === propValue) {
2336
- acc[key] = componentDefaults[key];
2337
- }
2338
- }
2339
- if (typeof simplifiedPropsDefinition[key] === "object") {
2340
- let defaultValue = simplifiedPropsDefinition[key].default;
2341
- if (typeof defaultValue === "function") {
2342
- defaultValue = defaultValue();
2343
- }
2344
- if (typeof defaultValue === "object") {
2345
- if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
2346
- acc[key] = componentDefaults[key];
2347
- }
2348
- } else if (defaultValue === propValue) {
2349
- acc[key] = componentDefaults[key];
2350
- }
2351
- }
2352
- }
2353
- return acc;
2354
- }, {});
2355
- });
2356
- }
2357
2403
  const _hoisted_1 = ["id"];
2358
2404
  const _hoisted_2 = ["id", "for"];
2359
2405
  const _hoisted_3 = ["id", "aria-controls", "placeholder"];
@@ -2404,7 +2450,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2404
2450
  hasHintLabelOrSlot,
2405
2451
  hasInvalidLabelOrSlot,
2406
2452
  hintSlotScope
2407
- } = HintSlotFactory(props, slots);
2453
+ } = HintSlotFactory(propsDefaults, slots);
2408
2454
  const inputEl = ref(null);
2409
2455
  const inputSearchEl = ref(null);
2410
2456
  const wrapperEl = ref(null);
@@ -2430,7 +2476,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2430
2476
  const searchText = ref("");
2431
2477
  const debouncedSearchText = refDebounced(
2432
2478
  searchText,
2433
- Number(props.debounceSearch)
2479
+ computed(() => Number(props.debounceSearch))
2434
2480
  );
2435
2481
  watch(
2436
2482
  debouncedSearchText,
@@ -2453,7 +2499,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2453
2499
  expanded.value = false;
2454
2500
  };
2455
2501
  const onAfterExpand = () => {
2456
- if (searchable.value) {
2502
+ if (propsDefaults.value.searchable) {
2457
2503
  if (inputSearchEl.value) {
2458
2504
  inputSearchEl.value.focus({
2459
2505
  preventScroll: true
@@ -2462,7 +2508,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2462
2508
  }
2463
2509
  };
2464
2510
  const onAfterCollapse = () => {
2465
- if (searchable.value) {
2511
+ if (propsDefaults.value.searchable) {
2466
2512
  searchText.value = "";
2467
2513
  }
2468
2514
  };
@@ -2476,14 +2522,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2476
2522
  loading,
2477
2523
  valid,
2478
2524
  invalid,
2479
- floating,
2480
- searchable
2525
+ floating
2481
2526
  } = toRefs(props);
2482
2527
  const hasId = useUniqueId(id);
2483
2528
  const hasHintId = computed(() => `${hasId.value}-hint`);
2484
2529
  const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
2485
2530
  const hasSearchId = computed(() => `${hasId.value}-search`);
2486
2531
  const hasLabelId = computed(() => `${hasId.value}-label`);
2532
+ const localLoading = ref(false);
2533
+ const isLoading = computed(() => localLoading.value || loading.value);
2487
2534
  const dropdownEl = ref();
2488
2535
  const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
2489
2536
  icon,
@@ -2498,7 +2545,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2498
2545
  modifiers,
2499
2546
  computed(() => ({
2500
2547
  disabled: disabled.value,
2501
- loading: loading.value,
2548
+ loading: isLoading.value,
2502
2549
  readonly: readonly.value,
2503
2550
  "icon-before": Boolean(hasIconBefore.value),
2504
2551
  "icon-after": Boolean(hasIconAfter.value),
@@ -2516,8 +2563,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2516
2563
  getOptionDisabled,
2517
2564
  getOptionGrouped
2518
2565
  } = useOptions(props);
2519
- const filteredOptions = computed(() => {
2566
+ const filteredOptions = computedAsync(async () => {
2520
2567
  var _a;
2568
+ if (propsDefaults.value.searchFunction) {
2569
+ localLoading.value = true;
2570
+ const toReturn = await Promise.resolve(
2571
+ propsDefaults.value.searchFunction(
2572
+ debouncedSearchText.value,
2573
+ props.options
2574
+ )
2575
+ );
2576
+ localLoading.value = false;
2577
+ return toReturn;
2578
+ }
2521
2579
  return (_a = props.options) == null ? void 0 : _a.filter((option) => {
2522
2580
  return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
2523
2581
  });
@@ -2535,12 +2593,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2535
2593
  } else if (props.modelValue) {
2536
2594
  selectedValues = [props.modelValue];
2537
2595
  }
2538
- const options = props.options.reduce((acc, value) => {
2539
- if (isGroup(value)) {
2540
- return [...acc, ...getOptionGrouped(value)];
2541
- }
2542
- return [...acc, value];
2543
- }, []);
2596
+ const options = props.options.reduce(
2597
+ (acc, value) => {
2598
+ if (isGroup(value)) {
2599
+ return [...acc, ...getOptionGrouped(value)];
2600
+ }
2601
+ return [...acc, value];
2602
+ },
2603
+ []
2604
+ );
2544
2605
  return options.filter((option) => {
2545
2606
  if (isGroup(option)) {
2546
2607
  return getOptionGrouped(option).some(
@@ -2594,7 +2655,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2594
2655
  invalid: invalid.value,
2595
2656
  invalidLabel: propsDefaults.value.invalidLabel,
2596
2657
  hintLabel: propsDefaults.value.hintLabel,
2597
- loading: loading.value,
2658
+ loading: isLoading.value,
2598
2659
  loadingLabel: propsDefaults.value.loadingLabel,
2599
2660
  disabled: disabled.value,
2600
2661
  readonly: readonly.value,
@@ -2622,7 +2683,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2622
2683
  flip: propsDefaults.value.flip,
2623
2684
  autoPlacement: propsDefaults.value.autoPlacement,
2624
2685
  arrow: propsDefaults.value.arrow,
2625
- autofocusFirst: searchable.value ? false : propsDefaults.value.autofocusFirst,
2686
+ autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
2626
2687
  triggerWidth: propsDefaults.value.triggerWidth,
2627
2688
  modifiers: propsDefaults.value.dropdownModifiers
2628
2689
  }));
@@ -2654,7 +2715,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2654
2715
  _ctx.label ? (openBlock(), createElementBlock("label", {
2655
2716
  key: 0,
2656
2717
  id: unref(hasLabelId),
2657
- for: unref(searchable) ? unref(hasSearchId) : void 0
2718
+ for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
2658
2719
  }, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("", true),
2659
2720
  createElementVNode("div", {
2660
2721
  ref_key: "wrapperEl",
@@ -2706,6 +2767,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2706
2767
  _ctx.unselectable && !unref(readonly) && !unref(disabled) ? (openBlock(), createElementBlock("button", {
2707
2768
  key: 0,
2708
2769
  "aria-label": unref(propsDefaults).deselectActionLabel,
2770
+ type: "button",
2709
2771
  onClick: withModifiers(($event) => onInput(option), ["stop"])
2710
2772
  }, [
2711
2773
  createVNode(_sfc_main$9, { name: "close" })
@@ -2728,107 +2790,110 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2728
2790
  renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
2729
2791
  ])) : createCommentVNode("", true)
2730
2792
  ]),
2731
- items: withCtx(() => [
2732
- unref(filteredOptions).length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
2733
- return openBlock(), createElementBlock(Fragment, { key: index }, [
2734
- isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2735
- createVNode(_sfc_main$5, {
2736
- label: unref(getOptionLabel)(option)
2737
- }, null, 8, ["label"]),
2738
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
2739
- option
2740
- ), (item, i) => {
2741
- return openBlock(), createBlock(_sfc_main$6, mergeProps({
2742
- disabled: unref(getOptionDisabled)(item),
2743
- selected: getOptionSelected(item),
2744
- unselectable: _ctx.unselectable,
2745
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2746
- selectHintLabel: unref(propsDefaults).selectHintLabel,
2747
- selectedHintLabel: unref(propsDefaults).selectedHintLabel
2748
- }, {
2749
- key: i,
2750
- class: "vv-dropdown-option",
2751
- onClickPassive: ($event) => onInput(item)
2752
- }), {
2753
- default: withCtx(() => [
2754
- renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2755
- option,
2756
- selectedOptions: unref(selectedOptions),
2757
- selected: getOptionSelected(item),
2758
- disabled: unref(getOptionDisabled)(item)
2759
- })), () => [
2760
- createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
2761
- ])
2762
- ]),
2763
- _: 2
2764
- }, 1040, ["onClickPassive"]);
2765
- }), 128))
2766
- ], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
2767
- disabled: unref(getOptionDisabled)(option),
2768
- selected: getOptionSelected(option),
2769
- unselectable: _ctx.unselectable,
2770
- deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2771
- selectHintLabel: unref(propsDefaults).selectHintLabel,
2772
- selectedHintLabel: unref(propsDefaults).selectedHintLabel
2773
- }, {
2774
- class: "vv-dropdown-option",
2775
- onClickPassive: ($event) => onInput(option)
2776
- }), {
2777
- default: withCtx(() => [
2778
- renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2779
- option,
2780
- selectedOptions: unref(selectedOptions),
2781
- selected: getOptionSelected(option),
2782
- disabled: unref(getOptionDisabled)(option)
2783
- })), () => [
2784
- createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
2785
- ])
2786
- ]),
2787
- _: 2
2788
- }, 1040, ["onClickPassive"]))
2789
- ], 64);
2790
- }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
2791
- key: 1,
2792
- modifiers: "inert"
2793
- }, {
2794
- default: withCtx(() => [
2795
- renderSlot(_ctx.$slots, "no-options", {}, () => [
2796
- createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
2797
- ])
2798
- ]),
2799
- _: 3
2800
- })) : (openBlock(), createBlock(_sfc_main$6, {
2801
- key: 2,
2802
- modifiers: "inert"
2803
- }, {
2804
- default: withCtx(() => [
2805
- renderSlot(_ctx.$slots, "no-results", {}, () => [
2806
- createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
2807
- ])
2808
- ]),
2809
- _: 3
2810
- }))
2811
- ]),
2793
+ items: withCtx(() => {
2794
+ var _a;
2795
+ return [
2796
+ !unref(disabled) && ((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
2797
+ return openBlock(), createElementBlock(Fragment, { key: index }, [
2798
+ isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2799
+ createVNode(_sfc_main$5, {
2800
+ label: unref(getOptionLabel)(option)
2801
+ }, null, 8, ["label"]),
2802
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
2803
+ option
2804
+ ), (item, i) => {
2805
+ return openBlock(), createBlock(_sfc_main$6, mergeProps({
2806
+ disabled: unref(getOptionDisabled)(item),
2807
+ selected: getOptionSelected(item),
2808
+ unselectable: _ctx.unselectable,
2809
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2810
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
2811
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
2812
+ }, {
2813
+ key: i,
2814
+ class: "vv-dropdown-option",
2815
+ onClickPassive: ($event) => onInput(item)
2816
+ }), {
2817
+ default: withCtx(() => [
2818
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2819
+ option,
2820
+ selectedOptions: unref(selectedOptions),
2821
+ selected: getOptionSelected(item),
2822
+ disabled: unref(getOptionDisabled)(item)
2823
+ })), () => [
2824
+ createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
2825
+ ])
2826
+ ]),
2827
+ _: 2
2828
+ }, 1040, ["onClickPassive"]);
2829
+ }), 128))
2830
+ ], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
2831
+ disabled: unref(getOptionDisabled)(option),
2832
+ selected: getOptionSelected(option),
2833
+ unselectable: _ctx.unselectable,
2834
+ deselectHintLabel: unref(propsDefaults).deselectHintLabel,
2835
+ selectHintLabel: unref(propsDefaults).selectHintLabel,
2836
+ selectedHintLabel: unref(propsDefaults).selectedHintLabel
2837
+ }, {
2838
+ class: "vv-dropdown-option",
2839
+ onClickPassive: ($event) => onInput(option)
2840
+ }), {
2841
+ default: withCtx(() => [
2842
+ renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
2843
+ option,
2844
+ selectedOptions: unref(selectedOptions),
2845
+ selected: getOptionSelected(option),
2846
+ disabled: unref(getOptionDisabled)(option)
2847
+ })), () => [
2848
+ createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
2849
+ ])
2850
+ ]),
2851
+ _: 2
2852
+ }, 1040, ["onClickPassive"]))
2853
+ ], 64);
2854
+ }), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
2855
+ key: 1,
2856
+ modifiers: "inert"
2857
+ }, {
2858
+ default: withCtx(() => [
2859
+ renderSlot(_ctx.$slots, "no-options", {}, () => [
2860
+ createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
2861
+ ])
2862
+ ]),
2863
+ _: 3
2864
+ })) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$6, {
2865
+ key: 2,
2866
+ modifiers: "inert"
2867
+ }, {
2868
+ default: withCtx(() => [
2869
+ renderSlot(_ctx.$slots, "no-results", {}, () => [
2870
+ createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
2871
+ ])
2872
+ ]),
2873
+ _: 3
2874
+ })) : createCommentVNode("", true)
2875
+ ];
2876
+ }),
2812
2877
  after: withCtx(() => [
2813
2878
  renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
2814
2879
  var _a;
2815
2880
  return [
2816
2881
  ((_a = unref(dropdownEl)) == null ? void 0 : _a.customPosition) ? (openBlock(), createBlock(_sfc_main$1, {
2817
2882
  key: 0,
2818
- label: "Close",
2883
+ label: unref(propsDefaults).closeLabel,
2819
2884
  modifiers: "secondary",
2820
2885
  onClick: _cache[1] || (_cache[1] = ($event) => unref(dropdownEl).hide())
2821
- })) : createCommentVNode("", true)
2886
+ }, null, 8, ["label"])) : createCommentVNode("", true)
2822
2887
  ];
2823
2888
  })
2824
2889
  ]),
2825
2890
  _: 2
2826
2891
  }, [
2827
- unref(searchable) || _ctx.$slots["dropdown::before"] ? {
2892
+ unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
2828
2893
  name: "before",
2829
2894
  fn: withCtx(() => [
2830
2895
  renderSlot(_ctx.$slots, "dropdown::before"),
2831
- unref(searchable) ? withDirectives((openBlock(), createElementBlock("input", {
2896
+ unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
2832
2897
  key: 0,
2833
2898
  id: unref(hasSearchId),
2834
2899
  ref_key: "inputSearchEl",
@@ -2842,7 +2907,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2842
2907
  class: "vv-dropdown__search",
2843
2908
  placeholder: unref(propsDefaults).searchPlaceholder
2844
2909
  }, null, 8, _hoisted_3)), [
2845
- [vShow, unref(expanded)],
2846
2910
  [vModelText, unref(searchText)]
2847
2911
  ]) : createCommentVNode("", true)
2848
2912
  ]),