@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1

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 (236) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +54 -15
  3. package/auto-imports.d.ts +12 -3
  4. package/bin/icons.cjs +1 -73
  5. package/dist/Volver.d.ts +23 -11
  6. package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
  7. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  8. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  9. package/dist/components/VvAccordion/index.d.ts +8 -3
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  12. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  13. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  14. package/dist/components/VvAction/VvAction.es.js +338 -0
  15. package/dist/components/VvAction/VvAction.umd.js +1 -0
  16. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  17. package/dist/components/VvAction/index.d.ts +24 -0
  18. package/dist/components/VvBadge/VvBadge.es.js +251 -22
  19. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  20. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  21. package/dist/components/VvBadge/index.d.ts +1 -1
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  24. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  25. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  26. package/dist/components/VvButton/VvButton.es.js +720 -261
  27. package/dist/components/VvButton/VvButton.umd.js +1 -1
  28. package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
  29. package/dist/components/VvButton/index.d.ts +30 -75
  30. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
  31. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  32. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  33. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  34. package/dist/components/VvCard/VvCard.es.js +60 -28
  35. package/dist/components/VvCard/VvCard.umd.js +1 -1
  36. package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
  37. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  38. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  39. package/dist/components/VvCheckbox/index.d.ts +6 -6
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  42. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
  43. package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
  44. package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
  45. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  46. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
  47. package/dist/components/VvCombobox/index.d.ts +54 -23
  48. package/dist/components/VvDialog/VvDialog.es.js +426 -115
  49. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  50. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  51. package/dist/components/VvDialog/index.d.ts +4 -1
  52. package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
  53. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  54. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
  55. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  56. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  57. package/dist/components/VvDropdown/index.d.ts +35 -14
  58. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
  59. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  60. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
  61. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  62. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
  63. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  64. package/dist/components/VvIcon/VvIcon.es.js +116 -52
  65. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  66. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  67. package/dist/components/VvIcon/index.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  69. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  70. package/dist/components/VvInputText/VvInputText.es.js +1054 -376
  71. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  72. package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
  73. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  74. package/dist/components/VvInputText/index.d.ts +67 -3
  75. package/dist/components/VvProgress/VvProgress.es.js +254 -23
  76. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  77. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  78. package/dist/components/VvProgress/index.d.ts +1 -1
  79. package/dist/components/VvRadio/VvRadio.es.js +568 -137
  80. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  81. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  82. package/dist/components/VvRadio/index.d.ts +6 -6
  83. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
  84. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  85. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
  86. package/dist/components/VvRadioGroup/index.d.ts +4 -4
  87. package/dist/components/VvSelect/VvSelect.es.js +703 -251
  88. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  89. package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
  90. package/dist/components/VvSelect/index.d.ts +8 -8
  91. package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
  92. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  93. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
  94. package/dist/components/VvTextarea/index.d.ts +7 -7
  95. package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
  96. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  97. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  98. package/dist/components/VvTooltip/index.d.ts +2 -2
  99. package/dist/components/index.es.js +3676 -2007
  100. package/dist/components/index.umd.js +1 -1
  101. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  102. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  103. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  104. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  105. package/dist/composables/useComponentFocus.d.ts +1 -1
  106. package/dist/composables/useComponentIcon.d.ts +7 -7
  107. package/dist/composables/useDebouncedInput.d.ts +4 -1
  108. package/dist/composables/useDefaults.d.ts +2 -0
  109. package/dist/composables/useModifiers.d.ts +1 -1
  110. package/dist/composables/useOptions.d.ts +2 -2
  111. package/dist/composables/useTextCount.d.ts +3 -3
  112. package/dist/composables/useUniqueId.d.ts +1 -1
  113. package/dist/composables/useVolver.d.ts +1 -1
  114. package/dist/constants.d.ts +30 -0
  115. package/dist/directives/index.es.js +288 -0
  116. package/dist/directives/index.umd.js +1 -0
  117. package/dist/directives/v-tooltip.es.js +285 -0
  118. package/dist/directives/v-tooltip.umd.js +1 -0
  119. package/dist/icons.es.js +38 -23
  120. package/dist/icons.umd.js +1 -1
  121. package/dist/index.d.ts +0 -1
  122. package/dist/index.es.js +115 -3269
  123. package/dist/index.umd.js +1 -1
  124. package/dist/props/index.d.ts +215 -23
  125. package/dist/resolvers/unplugin.d.ts +14 -8
  126. package/dist/resolvers/unplugin.es.js +94 -33
  127. package/dist/resolvers/unplugin.umd.js +1 -1
  128. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  129. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  130. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  131. package/dist/stories/argTypes.d.ts +1 -1
  132. package/package.json +167 -63
  133. package/src/Volver.ts +60 -26
  134. package/src/assets/icons/detailed.json +1 -1
  135. package/src/assets/icons/normal.json +1 -1
  136. package/src/assets/icons/simple.json +1 -1
  137. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  138. package/src/components/VvAccordion/index.ts +12 -4
  139. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  140. package/src/components/VvAccordionGroup/index.ts +8 -0
  141. package/src/components/VvAction/VvAction.vue +144 -0
  142. package/src/components/VvAction/index.ts +5 -0
  143. package/src/components/VvBadge/VvBadge.vue +2 -2
  144. package/src/components/VvBadge/index.ts +1 -1
  145. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  146. package/src/components/VvButton/VvButton.vue +41 -124
  147. package/src/components/VvButton/index.ts +16 -88
  148. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  149. package/src/components/VvButtonGroup/index.ts +1 -1
  150. package/src/components/VvCard/VvCard.vue +2 -2
  151. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  152. package/src/components/VvCheckbox/index.ts +11 -7
  153. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  154. package/src/components/VvCheckboxGroup/index.ts +1 -1
  155. package/src/components/VvCombobox/VvCombobox.vue +85 -57
  156. package/src/components/VvCombobox/index.ts +12 -10
  157. package/src/components/VvDialog/VvDialog.vue +28 -11
  158. package/src/components/VvDialog/index.ts +5 -2
  159. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  160. package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
  161. package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
  162. package/src/components/VvDropdown/index.ts +6 -11
  163. package/src/components/VvIcon/VvIcon.vue +3 -3
  164. package/src/components/VvIcon/index.ts +3 -3
  165. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  166. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  167. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  168. package/src/components/VvInputText/VvInputText.vue +128 -35
  169. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  170. package/src/components/VvInputText/index.ts +62 -1
  171. package/src/components/VvProgress/VvProgress.vue +2 -2
  172. package/src/components/VvProgress/index.ts +1 -1
  173. package/src/components/VvRadio/VvRadio.vue +3 -7
  174. package/src/components/VvRadio/index.ts +11 -7
  175. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  176. package/src/components/VvRadioGroup/index.ts +1 -1
  177. package/src/components/VvSelect/VvSelect.vue +4 -4
  178. package/src/components/VvSelect/index.ts +3 -5
  179. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  180. package/src/components/VvTextarea/index.ts +1 -1
  181. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  182. package/src/components/VvTooltip/index.ts +3 -3
  183. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  184. package/src/composables/dropdown/useProvideDropdown.ts +9 -11
  185. package/src/composables/group/useInjectedGroupState.ts +1 -1
  186. package/src/composables/group/useProvideGroupState.ts +1 -1
  187. package/src/composables/useComponentIcon.ts +1 -1
  188. package/src/composables/useDebouncedInput.ts +10 -3
  189. package/src/composables/useDefaults.ts +89 -0
  190. package/src/composables/useModifiers.ts +8 -9
  191. package/src/composables/useOptions.ts +1 -1
  192. package/src/composables/useVolver.ts +2 -2
  193. package/src/constants.ts +36 -0
  194. package/src/directives/index.ts +1 -1
  195. package/src/directives/v-tooltip.ts +2 -2
  196. package/src/index.ts +0 -2
  197. package/src/props/index.ts +111 -19
  198. package/src/resolvers/unplugin.ts +96 -49
  199. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  200. package/src/stories/Accordion/Accordion.test.ts +21 -15
  201. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  202. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  203. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  204. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
  205. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  206. package/src/stories/Button/Button.stories.mdx +4 -2
  207. package/src/stories/Button/Button.test.ts +3 -1
  208. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  209. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  210. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  211. package/src/stories/Card/Card.stories.mdx +2 -1
  212. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  213. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  214. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  215. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  216. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  217. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  218. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  219. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  220. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  221. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  222. package/src/stories/Icon/Icon.stories.mdx +2 -1
  223. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  224. package/src/stories/InputText/InputText.settings.ts +53 -0
  225. package/src/stories/InputText/InputText.stories.mdx +42 -1
  226. package/src/stories/InputText/InputText.test.ts +5 -2
  227. package/src/stories/Progress/Progress.stories.mdx +2 -1
  228. package/src/stories/Radio/Radio.stories.mdx +2 -1
  229. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  230. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  231. package/src/stories/Select/Select.stories.mdx +2 -1
  232. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  233. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  234. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
  235. package/src/stories/argTypes.ts +2 -2
  236. package/src/types/group.d.ts +5 -0
@@ -5,12 +5,8 @@
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import {
9
- VvRadioProps,
10
- VvRadioEvents,
11
- useGroupProps,
12
- } from '@/components/VvRadio'
13
- import { HintSlotFactory } from '@/components/common/HintSlot'
8
+ import { VvRadioProps, VvRadioEvents, useGroupProps } from '.'
9
+ import { HintSlotFactory } from '../common/HintSlot'
14
10
 
15
11
  // props, emit and slots
16
12
  const props = defineProps(VvRadioProps)
@@ -63,7 +59,7 @@
63
59
 
64
60
  // styles
65
61
  const { modifiers } = toRefs(props)
66
- const bemCssClasses = useBemModifiers(
62
+ const bemCssClasses = useModifiers(
67
63
  'vv-radio',
68
64
  modifiers,
69
65
  computed(() => ({
@@ -1,7 +1,7 @@
1
1
  import type { ExtractPropTypes, Ref } from 'vue'
2
- import type { InputGroupState } from '@/types/group'
3
- import { CheckboxRadioProps } from '@/props'
4
- import { INJECTION_KEY_RADIO_GROUP } from '@/constants'
2
+ import type { InputGroupState } from '../../types/group'
3
+ import { CheckboxRadioProps } from '../../props'
4
+ import { INJECTION_KEY_RADIO_GROUP } from '../../constants'
5
5
 
6
6
  export const VvRadioProps = CheckboxRadioProps
7
7
 
@@ -22,10 +22,14 @@ export function useGroupProps(
22
22
 
23
23
  // global props
24
24
  const modelValue = getGroupOrLocalRef('modelValue', props, emit)
25
- const readonly = getGroupOrLocalRef('readonly', props) as Ref<boolean>
26
- const disabled = getGroupOrLocalRef('disabled', props) as Ref<boolean>
27
25
  const valid = getGroupOrLocalRef('valid', props) as Ref<boolean>
28
26
  const invalid = getGroupOrLocalRef('invalid', props) as Ref<boolean>
27
+ const readonly = computed(() =>
28
+ Boolean(props.readonly || group?.value?.disabled.value),
29
+ )
30
+ const disabled = computed(() =>
31
+ Boolean(props.disabled || group?.value?.disabled.value),
32
+ )
29
33
 
30
34
  return {
31
35
  // local props
@@ -34,9 +38,9 @@ export function useGroupProps(
34
38
  group,
35
39
  isInGroup,
36
40
  modelValue,
37
- readonly,
38
- disabled,
39
41
  valid,
40
42
  invalid,
43
+ readonly,
44
+ disabled,
41
45
  }
42
46
  }
@@ -5,15 +5,12 @@
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import type { Option } from '@/types/generic'
9
- import type { InputGroupState } from '@/types/group'
10
- import { INJECTION_KEY_RADIO_GROUP } from '@/constants'
11
- import { HintSlotFactory } from '@/components/common/HintSlot'
12
- import VvRadio from '@/components/VvRadio/VvRadio.vue'
13
- import {
14
- VvRadioGroupProps,
15
- VvRadioGroupEvents,
16
- } from '@/components/VvRadioGroup'
8
+ import type { Option } from '../../types/generic'
9
+ import type { InputGroupState } from '../../types/group'
10
+ import { INJECTION_KEY_RADIO_GROUP } from '../../constants'
11
+ import { HintSlotFactory } from '../common/HintSlot'
12
+ import VvRadio from '../VvRadio/VvRadio.vue'
13
+ import { VvRadioGroupProps, VvRadioGroupEvents } from '.'
17
14
 
18
15
  // props, emit and slots
19
16
  const props = defineProps(VvRadioGroupProps)
@@ -38,7 +35,7 @@
38
35
  const { getOptionLabel, getOptionValue } = useOptions(props)
39
36
 
40
37
  // styles
41
- const bemCssClasses = useBemModifiers(
38
+ const bemCssClasses = useModifiers(
42
39
  'vv-radio-group',
43
40
  modifiers,
44
41
  computed(() => ({
@@ -1,4 +1,4 @@
1
- import { CheckboxRadioGroupProps } from '@/props'
1
+ import { CheckboxRadioGroupProps } from '../../props'
2
2
 
3
3
  export const VvRadioGroupProps = CheckboxRadioGroupProps
4
4
 
@@ -6,9 +6,9 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import type { SelectHTMLAttributes } from 'vue'
9
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
10
- import HintSlotFactory from '@/components/common/HintSlot'
11
- import { VvSelectProps, VvSelectEmits } from '@/components/VvSelect'
9
+ import VvIcon from '../VvIcon/VvIcon.vue'
10
+ import HintSlotFactory from '../common/HintSlot'
11
+ import { VvSelectProps, VvSelectEmits } from '.'
12
12
 
13
13
  // props, emit and slots
14
14
  const props = defineProps(VvSelectProps)
@@ -78,7 +78,7 @@
78
78
  })
79
79
 
80
80
  // styles
81
- const bemCssClasses = useBemModifiers(
81
+ const bemCssClasses = useModifiers(
82
82
  'vv-select',
83
83
  modifiers,
84
84
  computed(() => ({
@@ -14,7 +14,8 @@ import {
14
14
  UnselectableProps,
15
15
  AutofocusProps,
16
16
  AutocompleteProps,
17
- } from '@/props'
17
+ LabelProps,
18
+ } from '../../props'
18
19
 
19
20
  export const VvSelectProps = {
20
21
  ...IdNameProps,
@@ -32,6 +33,7 @@ export const VvSelectProps = {
32
33
  ...IconProps,
33
34
  ...FloatingLabelProps,
34
35
  ...UnselectableProps,
36
+ ...LabelProps,
35
37
  /**
36
38
  * This Boolean attribute indicates that multiple options can be selected in the list.
37
39
  * If it is not specified, then only one option can be selected at a time.
@@ -58,10 +60,6 @@ export const VvSelectProps = {
58
60
  type: [String, Number, Boolean, Object, Array],
59
61
  default: undefined,
60
62
  },
61
- /**
62
- * <label> value for the select
63
- */
64
- label: String,
65
63
  /**
66
64
  * Select placeholder
67
65
  */
@@ -6,9 +6,9 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import type { TextareaHTMLAttributes } from 'vue'
9
- import HintSlotFactory from '@/components/common/HintSlot'
10
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
11
- import { VvTextareaProps, VvTextareaEvents } from '@/components/VvTextarea'
9
+ import HintSlotFactory from '../common/HintSlot'
10
+ import VvIcon from '../VvIcon/VvIcon.vue'
11
+ import { VvTextareaProps, VvTextareaEvents } from '.'
12
12
 
13
13
  // props, emit and slots
14
14
  const props = defineProps(VvTextareaProps)
@@ -89,7 +89,7 @@
89
89
  const { HintSlot, hasHint, hasInvalid } = HintSlotFactory(props, slots)
90
90
 
91
91
  // styles
92
- const bemCssClasses = useBemModifiers(
92
+ const bemCssClasses = useModifiers(
93
93
  'vv-textarea',
94
94
  modifiers,
95
95
  computed(() => ({
@@ -1,5 +1,5 @@
1
1
  import type { ExtractPropTypes } from 'vue'
2
- import { InputTextareaProps } from '@/props'
2
+ import { InputTextareaProps } from '../../props'
3
3
 
4
4
  export const WRAP = {
5
5
  hard: 'hard',
@@ -1,11 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { VvTooltipProps } from '@/components/VvTooltip'
2
+ import { VvTooltipProps } from '.'
3
3
 
4
4
  const props = defineProps(VvTooltipProps)
5
5
  const { modifiers } = toRefs(props)
6
6
 
7
7
  // styles
8
- const bemCssClasses = useBemModifiers(
8
+ const bemCssClasses = useModifiers(
9
9
  'vv-tooltip',
10
10
  modifiers,
11
11
  computed(() => ({
@@ -1,6 +1,6 @@
1
- import { Side } from '@/constants'
2
- import { ModifiersProps } from '@/props'
3
1
  import type { PropType } from 'vue'
2
+ import { Side } from '../../constants'
3
+ import { ModifiersProps } from '../../props'
4
4
 
5
5
  export const VvTooltipProps = {
6
6
  ...ModifiersProps,
@@ -9,7 +9,7 @@ export const VvTooltipProps = {
9
9
  * @default Side.bottom
10
10
  */
11
11
  position: {
12
- type: String as PropType<Side>,
12
+ type: String as PropType<`${Side}`>,
13
13
  default: Side.bottom,
14
14
  },
15
15
  value: {
@@ -1,11 +1,11 @@
1
1
  import type { Ref } from 'vue'
2
2
  import type { Emitter, EventType } from 'mitt'
3
- import type { DropdownItemRole } from '@/components/VvDropdown/'
4
3
  import {
4
+ type DropdownItemRole,
5
5
  INJECTION_KEY_DROPDOWN_TRIGGER,
6
6
  INJECTION_KEY_DROPDOWN_ACTION,
7
7
  INJECTION_KEY_DROPDOWN_ITEM,
8
- } from '@/constants'
8
+ } from '../../constants'
9
9
 
10
10
  /**
11
11
  * Injects dropdown reference and the event bus
@@ -1,15 +1,13 @@
1
1
  import { type Ref, Fragment } from 'vue'
2
2
  import mitt from 'mitt'
3
- import {
4
- type DropdownRole,
5
- DROPDOWN_ROLES,
6
- DROPDOWN_ITEM_ROLES,
7
- } from '@/components/VvDropdown/'
8
3
  import {
9
4
  INJECTION_KEY_DROPDOWN_TRIGGER,
10
5
  INJECTION_KEY_DROPDOWN_ACTION,
11
6
  INJECTION_KEY_DROPDOWN_ITEM,
12
- } from '@/constants'
7
+ DropdownRole,
8
+ DropdownItemRole,
9
+ ActionRoles,
10
+ } from '../../constants'
13
11
 
14
12
  /**
15
13
  * Share the dropdown reference and the event bus with all its children.
@@ -66,13 +64,13 @@ export function useProvideDropdownItem({
66
64
  role,
67
65
  expanded,
68
66
  }: {
69
- role: Ref<DropdownRole>
67
+ role: Ref<`${DropdownRole}`>
70
68
  expanded: Ref<boolean>
71
69
  }) {
72
70
  const itemRole = computed(() =>
73
- role.value === DROPDOWN_ROLES[0]
74
- ? DROPDOWN_ITEM_ROLES[0]
75
- : DROPDOWN_ITEM_ROLES[1],
71
+ role.value === DropdownRole.listbox
72
+ ? DropdownItemRole.option
73
+ : DropdownItemRole.presentation,
76
74
  )
77
75
  provide(INJECTION_KEY_DROPDOWN_ITEM, {
78
76
  role: itemRole,
@@ -91,7 +89,7 @@ export function useProvideDropdownAction({
91
89
  expanded: Ref<boolean>
92
90
  }) {
93
91
  provide(INJECTION_KEY_DROPDOWN_ACTION, {
94
- role: 'menuitem',
92
+ role: ActionRoles.menuitem,
95
93
  expanded,
96
94
  })
97
95
  }
@@ -1,5 +1,5 @@
1
1
  import type { Ref } from 'vue'
2
- import type GroupState from '@/types/group'
2
+ import type GroupState from '../../types/group'
3
3
 
4
4
  /**
5
5
  * Injects a group state
@@ -1,4 +1,4 @@
1
- import type GroupState from '@/types/group'
1
+ import type GroupState from '../../types/group'
2
2
 
3
3
  /**
4
4
  * Share part of the state of the component with all its children.
@@ -1,5 +1,5 @@
1
- import { Position, Side } from '@/constants'
2
1
  import type { Ref } from 'vue'
2
+ import { Position, Side } from '../constants'
3
3
 
4
4
  export function useComponentIcon(
5
5
  icon: Ref<string | object | undefined> | undefined,
@@ -2,8 +2,15 @@ import type { Ref } from 'vue'
2
2
 
3
3
  export function useDebouncedInput(
4
4
  modelValue: Ref | undefined,
5
- emit: (event: string, value: unknown) => void,
5
+ emit: (event: string, value: string | number) => void,
6
6
  ms: string | number = 0,
7
+ {
8
+ getter = (value) => value,
9
+ setter = (value) => value,
10
+ }: {
11
+ getter?: (value: string | number) => string | number
12
+ setter?: (value: string | number) => string | number
13
+ } = {},
7
14
  ): Ref {
8
15
  let timeout: NodeJS.Timeout
9
16
 
@@ -12,13 +19,13 @@ export function useDebouncedInput(
12
19
  }
13
20
 
14
21
  return computed({
15
- get: () => modelValue?.value,
22
+ get: () => getter(modelValue?.value),
16
23
  set: (value) => {
17
24
  if (timeout) {
18
25
  clearTimeout(timeout)
19
26
  }
20
27
  timeout = setTimeout(() => {
21
- emit('update:modelValue', value)
28
+ emit('update:modelValue', setter(value))
22
29
  }, ms as number)
23
30
  },
24
31
  })
@@ -0,0 +1,89 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue'
2
+
3
+ type VueProp =
4
+ | StringConstructor
5
+ | NumberConstructor
6
+ | ObjectConstructor
7
+ | FunctionConstructor
8
+ | SymbolConstructor
9
+ | ArrayConstructor
10
+ | BooleanConstructor
11
+ | PropType<unknown>
12
+
13
+ export function useDefaults<Definition>(
14
+ componentName: string,
15
+ propsDefinition: Definition,
16
+ props: Readonly<ExtractPropTypes<Definition>>,
17
+ ) {
18
+ const volver = useVolver()
19
+
20
+ const volverComponentDefaults = computed(() => {
21
+ if (!volver || !volver.defaults.value?.[componentName]) {
22
+ return undefined
23
+ }
24
+ return volver.defaults.value[componentName]
25
+ })
26
+
27
+ return computed(() => {
28
+ if (volverComponentDefaults.value === undefined) {
29
+ return props
30
+ }
31
+ const componentDefaults = volverComponentDefaults.value
32
+ const simplifiedPropsDefinition = propsDefinition as {
33
+ [key: string]:
34
+ | VueProp
35
+ | VueProp[]
36
+ | { type: VueProp | VueProp[]; default?: unknown }
37
+ }
38
+ const simplifiedProps = props as Record<string, unknown>
39
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
40
+ const propValue = simplifiedProps[key]
41
+ acc[key] = propValue
42
+ if (key in componentDefaults) {
43
+ // array of types
44
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
45
+ const typeArray = simplifiedPropsDefinition[
46
+ key
47
+ ] as VueProp[]
48
+ if (typeArray.length) {
49
+ const typeFunction = typeArray[0] as <T>() => T
50
+ if (typeFunction === propValue) {
51
+ acc[key] = componentDefaults[key]
52
+ }
53
+ }
54
+ }
55
+ // single type
56
+ if (typeof simplifiedPropsDefinition[key] === 'function') {
57
+ const typeFunction = simplifiedPropsDefinition[key] as <
58
+ T,
59
+ >() => T
60
+ if (typeFunction() === propValue) {
61
+ acc[key] = componentDefaults[key]
62
+ }
63
+ }
64
+ // object with type and default
65
+ if (typeof simplifiedPropsDefinition[key] === 'object') {
66
+ let defaultValue = (
67
+ simplifiedPropsDefinition[key] as { default: unknown }
68
+ ).default
69
+ if (typeof defaultValue === 'function') {
70
+ defaultValue = defaultValue()
71
+ }
72
+ if (typeof defaultValue === 'object') {
73
+ if (
74
+ JSON.stringify(defaultValue) ===
75
+ JSON.stringify(propValue)
76
+ ) {
77
+ acc[key] = componentDefaults[key]
78
+ }
79
+ } else if (defaultValue === propValue) {
80
+ acc[key] = componentDefaults[key]
81
+ }
82
+ }
83
+ }
84
+ return acc
85
+ }, {} as Record<string, unknown>) as Readonly<
86
+ ExtractPropTypes<Definition>
87
+ >
88
+ })
89
+ }
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from 'vue'
2
2
 
3
- export function useBemModifiers(
3
+ export function useModifiers(
4
4
  prefix: string,
5
5
  modifiers?: Ref<string | string[] | unknown | unknown[] | undefined>,
6
6
  others?: Ref<Record<string, boolean>>,
@@ -10,17 +10,16 @@ export function useBemModifiers(
10
10
  [prefix]: true,
11
11
  }
12
12
  // props modifiers
13
- let modifiersArray = unref(modifiers)
13
+ const modifiersArray =
14
+ typeof modifiers?.value === 'string'
15
+ ? modifiers.value.split(' ')
16
+ : modifiers?.value
14
17
  if (modifiersArray) {
15
- if (
16
- !Array.isArray(modifiersArray) &&
17
- typeof modifiersArray === 'string'
18
- ) {
19
- modifiersArray = modifiersArray.split(' ')
20
- }
21
18
  if (Array.isArray(modifiersArray)) {
22
19
  modifiersArray.forEach((modifier) => {
23
- toReturn[`${prefix}--${modifier}`] = true
20
+ if (modifier) {
21
+ toReturn[`${prefix}--${modifier}`] = true
22
+ }
24
23
  })
25
24
  }
26
25
  }
@@ -1,4 +1,4 @@
1
- import type { Option } from '@/types/generic'
1
+ import type { Option } from '../types/generic'
2
2
 
3
3
  // eslint-disable-next-line
4
4
  export function useOptions(props: any) {
@@ -1,5 +1,5 @@
1
- import { INJECTION_KEY_VOLVER } from '@/constants'
2
- import type { VolverInterface } from '@/Volver'
1
+ import { INJECTION_KEY_VOLVER } from '../constants'
2
+ import type { VolverInterface } from '../Volver'
3
3
 
4
4
  export function useVolver() {
5
5
  return inject<VolverInterface>(INJECTION_KEY_VOLVER)
package/src/constants.ts CHANGED
@@ -23,6 +23,42 @@ export enum Position {
23
23
  after = 'after',
24
24
  }
25
25
 
26
+ export enum ButtonType {
27
+ button = 'button',
28
+ submit = 'submit',
29
+ reset = 'reset',
30
+ }
31
+
32
+ export enum ActionTag {
33
+ nuxtLink = 'nuxt-link',
34
+ routerLink = 'router-link',
35
+ a = 'a',
36
+ button = 'button',
37
+ }
38
+
39
+ export enum ActionRoles {
40
+ button = 'button',
41
+ link = 'link',
42
+ menuitem = 'menuitem',
43
+ }
44
+
45
+ export enum DropdownRole {
46
+ listbox = 'listbox',
47
+ menu = 'menu',
48
+ }
49
+
50
+ export enum DropdownItemRole {
51
+ option = 'option',
52
+ presentation = 'presentation',
53
+ }
54
+
55
+ export enum AnchorTarget {
56
+ _blank = '_blank',
57
+ _self = '_self',
58
+ _parent = '_parent',
59
+ _top = '_top',
60
+ }
61
+
26
62
  // volver
27
63
  export const INJECTION_KEY_VOLVER = Symbol.for('volver')
28
64
 
@@ -1,4 +1,4 @@
1
- import tooltip from '@/directives/v-tooltip'
1
+ import tooltip from '../directives/v-tooltip'
2
2
 
3
3
  export default {
4
4
  tooltip,
@@ -1,6 +1,6 @@
1
1
  import { render, type Directive, type DirectiveBinding } from 'vue'
2
- import VvTooltip from '@/components/VvTooltip/VvTooltip.vue'
3
- import type { Side } from '@/constants'
2
+ import VvTooltip from '../components/VvTooltip/VvTooltip.vue'
3
+ import type { Side } from '../constants'
4
4
 
5
5
  const tooltip: Directive = {
6
6
  beforeMount(el: HTMLElement, binding: DirectiveBinding) {
package/src/index.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import VolverPlugin from './Volver'
2
2
  import type { Volver } from './Volver'
3
3
 
4
- // export all components as vue plugin
5
- export * from './components/index'
6
4
  export { VolverPlugin }
7
5
 
8
6
  // https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties