@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
@@ -1,4 +1,4 @@
1
- import { IdProps } from '@/props'
1
+ import { IdProps } from '../../props'
2
2
 
3
3
  export const VvDialogEvents = ['open', 'close', 'update:modelValue']
4
4
 
@@ -11,7 +11,10 @@ export const VvDialogProps = {
11
11
  /**
12
12
  * Show / hide dialog programmatically
13
13
  */
14
- modelValue: Boolean,
14
+ modelValue: {
15
+ type: Boolean,
16
+ default: undefined,
17
+ },
15
18
  /**
16
19
  * Dialog transition
17
20
  */
@@ -17,14 +17,15 @@
17
17
  arrow,
18
18
  size,
19
19
  } from '@floating-ui/vue'
20
- import { VvDropdownProps } from '@/components/VvDropdown'
20
+ import { VvDropdownProps } from '.'
21
21
  import type {
22
22
  AutoPlacementOptions,
23
23
  FlipOptions,
24
24
  OffsetOptions,
25
25
  ShiftOptions,
26
26
  SizeOptions,
27
- } from '@/types/floating-ui'
27
+ } from '../../types/floating-ui'
28
+ import type { Placement } from '@/constants'
28
29
 
29
30
  // props, emit and attrs
30
31
  const props = defineProps(VvDropdownProps)
@@ -127,7 +128,7 @@
127
128
  floatingEl,
128
129
  {
129
130
  whileElementsMounted: autoUpdate,
130
- placement: props.placement,
131
+ placement: props.placement as Placement,
131
132
  middleware,
132
133
  },
133
134
  )
@@ -219,7 +220,7 @@
219
220
 
220
221
  // aria
221
222
  const hasAriaLabelledby = computed(() => {
222
- return referenceEl.value?.getAttribute('id') ?? undefined
223
+ return referenceEl.value?.getAttribute?.('id') ?? undefined
223
224
  })
224
225
  const referenceAria = computed(() => ({
225
226
  'aria-controls': hasId.value,
@@ -242,7 +243,7 @@
242
243
  const { itemRole } = useProvideDropdownItem({ role, expanded })
243
244
 
244
245
  // styles
245
- const bemCssClasses = useBemModifiers(
246
+ const bemCssClasses = useModifiers(
246
247
  'vv-dropdown',
247
248
  modifiers,
248
249
  computed(() => ({
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'VvDropdownAction',
4
+ }
5
+ </script>
6
+
7
+ <script setup lang="ts">
8
+ import VvAction from '../VvAction/VvAction.vue'
9
+ import VvDropdownItem from '../VvDropdown/VvDropdownItem.vue'
10
+ import { ActionProps, ModifiersProps } from '../../props'
11
+
12
+ // props
13
+ const props = defineProps({
14
+ ...ActionProps,
15
+ ...ModifiersProps,
16
+ })
17
+
18
+ /**
19
+ * @description Define component classes with BEM style.
20
+ * @returns {Array} The component classes.
21
+ */
22
+ const { modifiers } = toRefs(props)
23
+ const bemCssClasses = useModifiers('vv-dropdown-action', modifiers)
24
+ </script>
25
+
26
+ <template>
27
+ <VvDropdownItem>
28
+ <VvAction
29
+ v-bind="{
30
+ disabled,
31
+ pressed,
32
+ active,
33
+ type,
34
+ to,
35
+ href,
36
+ target,
37
+ rel,
38
+ }"
39
+ :class="bemCssClasses"
40
+ >
41
+ <slot>
42
+ {{ label }}
43
+ </slot>
44
+ </VvAction>
45
+ </VvDropdownItem>
46
+ </template>
@@ -0,0 +1,72 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'VvDropdownOption',
4
+ }
5
+ </script>
6
+
7
+ <script setup lang="ts">
8
+ import VvDropdownItem from './VvDropdownItem.vue'
9
+ import {
10
+ DisabledProps,
11
+ ModifiersProps,
12
+ SelectedProps,
13
+ UnselectableProps,
14
+ } from '../../props'
15
+
16
+ // props
17
+ const props = defineProps({
18
+ ...DisabledProps,
19
+ ...SelectedProps,
20
+ ...UnselectableProps,
21
+ ...ModifiersProps,
22
+ deselectHintLabel: {
23
+ type: String,
24
+ },
25
+ selectHintLabel: {
26
+ type: String,
27
+ },
28
+ selectedHintLabel: {
29
+ type: String,
30
+ },
31
+ })
32
+
33
+ // style
34
+ const { modifiers } = toRefs(props)
35
+ const bemCssClasses = useModifiers(
36
+ 'vv-dropdown-option',
37
+ modifiers,
38
+ computed(() => ({
39
+ disabled: props.disabled,
40
+ selected: props.selected,
41
+ unselectable: props.unselectable && props.selected,
42
+ })),
43
+ )
44
+
45
+ // hint
46
+ const hintLabel = computed(() => {
47
+ if (props.selected) {
48
+ return props.unselectable
49
+ ? props.deselectHintLabel
50
+ : props.selectedHintLabel
51
+ }
52
+ if (!props.disabled) {
53
+ return props.selectHintLabel
54
+ }
55
+ })
56
+ </script>
57
+
58
+ <template>
59
+ <VvDropdownItem
60
+ :class="bemCssClasses"
61
+ :tabindex="disabled ? -1 : 0"
62
+ :aria-selected="selected"
63
+ :aria-disabled="disabled"
64
+ >
65
+ <slot />
66
+ <span class="vv-dropdown-option__hint" :title="hintLabel">
67
+ <slot name="hint" v-bind="{ disabled, selected, unselectable }">
68
+ {{ hintLabel }}
69
+ </slot>
70
+ </span>
71
+ </VvDropdownItem>
72
+ </template>
@@ -1,11 +1,6 @@
1
- import { DropdownProps, IdProps, ModifiersProps } from '@/props'
2
1
  import type { PropType } from 'vue'
3
-
4
- export const DROPDOWN_ROLES = ['listbox', 'menu'] as const
5
- export const DROPDOWN_ITEM_ROLES = ['option', 'presentation'] as const
6
-
7
- export type DropdownRole = (typeof DROPDOWN_ROLES)[number]
8
- export type DropdownItemRole = (typeof DROPDOWN_ITEM_ROLES)[number]
2
+ import { DropdownProps, IdProps, ModifiersProps } from '../../props'
3
+ import { DropdownRole } from '../../constants'
9
4
 
10
5
  export const VvDropdownProps = {
11
6
  ...IdProps,
@@ -29,9 +24,9 @@ export const VvDropdownProps = {
29
24
  * Dropdown role
30
25
  */
31
26
  role: {
32
- type: String as PropType<DropdownRole>,
33
- default: DROPDOWN_ROLES[1],
34
- validator: (value: string) =>
35
- (DROPDOWN_ROLES as ReadonlyArray<string>).includes(value),
27
+ type: String as PropType<`${DropdownRole}`>,
28
+ default: DropdownRole.menu,
29
+ validator: (value: DropdownRole) =>
30
+ Object.values(DropdownRole).includes(value),
36
31
  },
37
32
  }
@@ -6,7 +6,7 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import { Icon, addIcon, iconExists, type IconifyJSON } from '@iconify/vue'
9
- import { VvIconProps } from '@/components/VvIcon'
9
+ import { VvIconProps } from '.'
10
10
 
11
11
  // props
12
12
  const props = defineProps(VvIconProps)
@@ -19,13 +19,13 @@
19
19
 
20
20
  // classes
21
21
  const { modifiers } = toRefs(props)
22
- const bemCssClasses = useBemModifiers('vv-icon', modifiers)
22
+ const bemCssClasses = useModifiers('vv-icon', modifiers)
23
23
 
24
24
  /**
25
25
  * Provider name
26
26
  */
27
27
  const provider = computed(() => {
28
- return props.provider || volver?.provider
28
+ return props.provider || volver?.iconsProvider
29
29
  })
30
30
 
31
31
  /**
@@ -1,7 +1,7 @@
1
1
  import type { PropType } from 'vue'
2
2
  import type { IconifyRenderMode } from '@iconify/vue'
3
3
 
4
- export enum PREFIX {
4
+ export enum IconPrefix {
5
5
  simple = 'simple',
6
6
  normal = 'normal',
7
7
  detailed = 'detailed',
@@ -46,7 +46,7 @@ export const VvIconProps = {
46
46
  * Icon default options prefix: simple | normal | detailed
47
47
  */
48
48
  prefix: {
49
- type: String as PropType<PREFIX>,
49
+ type: String as PropType<`${IconPrefix}` | string>,
50
50
  default: 'normal',
51
51
  },
52
52
  /**
@@ -74,7 +74,7 @@ export const VvIconProps = {
74
74
  * 'svg' = svg
75
75
  * Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
76
76
  */
77
- mode: String as PropType<IconifyRenderMode>,
77
+ mode: String as PropType<`${IconifyRenderMode}`>,
78
78
  /**
79
79
  * Toggles inline or block mode
80
80
  * Example https://docs.iconify.design/icon-components/vue/inline.html
@@ -1,4 +1,4 @@
1
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
1
+ import VvIcon from '../VvIcon/VvIcon.vue'
2
2
 
3
3
  export default defineComponent({
4
4
  components: {
@@ -34,7 +34,7 @@ export default defineComponent({
34
34
  render() {
35
35
  const icon = h(VvIcon, {
36
36
  name: this.icon,
37
- class: 'vv-input-text__action-icon',
37
+ class: 'vv-input-text__icon',
38
38
  })
39
39
 
40
40
  return h(
@@ -1,5 +1,5 @@
1
- import { TYPES_ICON } from '@/components/VvInputText'
2
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
1
+ import { TYPES_ICON } from '../VvInputText'
2
+ import VvIcon from '../VvIcon/VvIcon.vue'
3
3
 
4
4
  export default defineComponent({
5
5
  components: {
@@ -51,9 +51,8 @@ export default defineComponent({
51
51
  render() {
52
52
  const icon = h(VvIcon, {
53
53
  name: this.activeIcon,
54
- class: 'vv-input-text__action-icon',
54
+ class: 'vv-input-text__icon',
55
55
  })
56
-
57
56
  return h(
58
57
  'button',
59
58
  {
@@ -1,4 +1,4 @@
1
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
1
+ import VvIcon from '../VvIcon/VvIcon.vue'
2
2
 
3
3
  export default defineComponent({
4
4
  components: {
@@ -37,11 +37,12 @@ export default defineComponent({
37
37
  render() {
38
38
  return h('button', {
39
39
  class: [
40
- 'vv-input-text__action-chevron',
40
+ 'vv-input-text__action vv-input-text__action-chevron',
41
41
  this.isUp && 'vv-input-text__action-chevron-up',
42
42
  ],
43
43
  disabled: this.disabled,
44
44
  ariaLabel: this.label,
45
+ type: 'button',
45
46
  onClick: this.onClick,
46
47
  })
47
48
  },
@@ -6,15 +6,16 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import type { InputHTMLAttributes } from 'vue'
9
- import HintSlotFactory from '@/components/common/HintSlot'
10
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
11
- import VvInputTextActionsFactory from '@/components/VvInputText/VvInputTextActions'
9
+ import { Mask } from 'maska'
10
+ import HintSlotFactory from '../common/HintSlot'
11
+ import VvIcon from '../VvIcon/VvIcon.vue'
12
+ import VvInputTextActionsFactory from '../VvInputText/VvInputTextActions'
12
13
  import {
13
14
  VvInputTextEvents,
14
15
  VvInputTextProps,
15
16
  INPUT_TYPES,
16
17
  TYPES_ICON,
17
- } from '@/components/VvInputText'
18
+ } from '../VvInputText'
18
19
 
19
20
  // props, emit, slots and attrs
20
21
  const props = defineProps(VvInputTextProps)
@@ -22,7 +23,10 @@
22
23
  const slots = useSlots()
23
24
 
24
25
  // template refs
25
- const input = ref()
26
+ const inputEl = ref()
27
+ const innerEl = ref()
28
+
29
+ defineExpose({ $inner: innerEl })
26
30
 
27
31
  // data
28
32
  const {
@@ -44,15 +48,39 @@
44
48
  )
45
49
 
46
50
  // debounce
47
- const localModelValue = useDebouncedInput(modelValue, emit, props.debounce)
51
+ const localModelValue = useDebouncedInput(
52
+ modelValue,
53
+ emit,
54
+ props.debounce,
55
+ {
56
+ getter: (value) => {
57
+ if (mask.value) {
58
+ return mask.value.masked(value ?? '')
59
+ }
60
+ return value
61
+ },
62
+ setter: (value) => {
63
+ if (mask.value) {
64
+ value = mask.value.unmasked(value)
65
+ }
66
+ if (props.type === INPUT_TYPES.NUMBER) {
67
+ return Number(value)
68
+ }
69
+ return value
70
+ },
71
+ },
72
+ )
48
73
 
49
74
  // focus
50
- const { focused } = useComponentFocus(input, emit)
75
+ const { focused } = useComponentFocus(inputEl, emit)
76
+ const isFocused = computed(
77
+ () => focused.value && !props.disabled && !props.readonly,
78
+ )
51
79
 
52
80
  // visibility
53
- const isVisible = useElementVisibility(input)
81
+ const isVisible = useElementVisibility(inputEl)
54
82
  watch(isVisible, (newValue) => {
55
- if (newValue && props.autofocus) {
83
+ if (newValue && props.autofocus && !props.disabled && !props.readonly) {
56
84
  focused.value = true
57
85
  }
58
86
  })
@@ -78,14 +106,14 @@
78
106
  const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER)
79
107
  const onStepUp = () => {
80
108
  if (isClickable.value) {
81
- input.value.stepUp()
82
- localModelValue.value = unref(input).value
109
+ inputEl.value.stepUp()
110
+ localModelValue.value = unref(inputEl).value
83
111
  }
84
112
  }
85
113
  const onStepDown = () => {
86
114
  if (isClickable.value) {
87
- input.value.stepDown()
88
- localModelValue.value = unref(input).value
115
+ inputEl.value.stepDown()
116
+ localModelValue.value = unref(inputEl).value
89
117
  }
90
118
  }
91
119
 
@@ -145,7 +173,7 @@
145
173
 
146
174
  // styles
147
175
  const { modifiers } = toRefs(props)
148
- const bemCssClasses = useBemModifiers(
176
+ const bemCssClasses = useModifiers(
149
177
  'vv-input-text',
150
178
  modifiers,
151
179
  computed(() => ({
@@ -158,7 +186,8 @@
158
186
  'icon-after': hasIconAfter.value || !isEmpty(defaultAfterIcon),
159
187
  floating: props.floating && !isEmpty(props.label),
160
188
  dirty: isDirty.value,
161
- focus: focused.value,
189
+ focus: isFocused.value,
190
+ 'auto-width': props.autoWidth,
162
191
  })),
163
192
  )
164
193
 
@@ -199,8 +228,10 @@
199
228
  type === INPUT_TYPES.NUMBER
200
229
  ) {
201
230
  toReturn.step = props.step
202
- toReturn.max = String(props.max)
203
- toReturn.min = String(props.min)
231
+ toReturn.max =
232
+ props.max !== undefined ? String(props.max) : undefined
233
+ toReturn.min =
234
+ props.min !== undefined ? String(props.min) : undefined
204
235
  }
205
236
  if (
206
237
  type === INPUT_TYPES.TEXT ||
@@ -256,6 +287,51 @@
256
287
  INPUT_TYPES.SEARCH,
257
288
  props,
258
289
  )
290
+
291
+ // mask
292
+ const mask = ref()
293
+ watch(
294
+ [
295
+ () => props.mask,
296
+ () => props.type,
297
+ () => props.maskEager,
298
+ () => props.maskReversed,
299
+ () => props.maskTokens,
300
+ () => props.maskTokensReplace,
301
+ ],
302
+ ([newMask, newType, eager, reversed, tokens, tokensReplace]) => {
303
+ if (newMask && newType === INPUT_TYPES.TEXT) {
304
+ mask.value = new Mask({
305
+ mask: newMask,
306
+ eager,
307
+ reversed,
308
+ tokens,
309
+ tokensReplace,
310
+ })
311
+ return
312
+ }
313
+ mask.value = undefined
314
+ },
315
+ { immediate: true },
316
+ )
317
+
318
+ // auto-width
319
+ const onClickInner = () => {
320
+ if (isClickable.value) {
321
+ focused.value = true
322
+ }
323
+ }
324
+ const hasStyle = computed(() => {
325
+ if (!props.autoWidth) {
326
+ return undefined
327
+ }
328
+ return {
329
+ width:
330
+ localModelValue.value !== undefined
331
+ ? `${String(localModelValue.value).length + 1}ch`
332
+ : undefined,
333
+ }
334
+ })
259
335
  </script>
260
336
 
261
337
  <template>
@@ -268,7 +344,11 @@
268
344
  <!-- @slot Slot before input icon -->
269
345
  <slot name="before" v-bind="slotProps" />
270
346
  </div>
271
- <div class="vv-input-text__inner">
347
+ <div
348
+ ref="innerEl"
349
+ class="vv-input-text__inner"
350
+ @click.stop="onClickInner"
351
+ >
272
352
  <VvIcon
273
353
  v-if="hasIconBefore"
274
354
  class="vv-input-text__icon"
@@ -276,28 +356,41 @@
276
356
  />
277
357
  <input
278
358
  :id="hasId"
279
- ref="input"
359
+ ref="inputEl"
280
360
  v-model="localModelValue"
281
361
  v-bind="hasAttrs"
362
+ :style="hasStyle"
282
363
  @keyup="emit('keyup', $event)"
283
364
  />
284
- <!-- @slot Slot to replace right icon -->
285
- <VvIcon
286
- v-if="hasIconAfter || defaultAfterIcon"
287
- class="vv-input-text__icon vv-input-text__icon-after"
288
- v-bind="hasIconAfter ? hasIcon : defaultAfterIcon"
289
- />
290
- <PasswordInputActions
291
- v-else-if="isPassword"
292
- @toggle-password="onTogglePassword"
293
- />
294
- <NumberInputActions
295
- v-else-if="isNumber"
296
- @step-up="onStepUp"
297
- @step-down="onStepDown"
298
- />
299
- <SearchInputActions v-else-if="isSearch" @clear="onClear" />
365
+ <div
366
+ v-if="(unit || $slots.unit) && isDirty"
367
+ class="vv-input-text__unit"
368
+ >
369
+ <!-- @slot Slot to replace unit-->
370
+ <slot name v-bind="slotProps">
371
+ {{ unit }}
372
+ </slot>
373
+ </div>
300
374
  </div>
375
+ <!-- @slot Slot to replace right icon -->
376
+ <VvIcon
377
+ v-if="hasIconAfter || defaultAfterIcon"
378
+ class="vv-input-text__icon vv-input-text__icon-after"
379
+ v-bind="hasIconAfter ? hasIcon : defaultAfterIcon"
380
+ />
381
+ <PasswordInputActions
382
+ v-else-if="isPassword && !hideActions && isClickable"
383
+ @toggle-password="onTogglePassword"
384
+ />
385
+ <NumberInputActions
386
+ v-else-if="isNumber && !hideActions && isClickable"
387
+ @step-up="onStepUp"
388
+ @step-down="onStepDown"
389
+ />
390
+ <SearchInputActions
391
+ v-else-if="isSearch && !hideActions && isClickable"
392
+ @clear="onClear"
393
+ />
301
394
  <!-- @slot Slot after input -->
302
395
  <div v-if="$slots.after" class="vv-input-text__input-after">
303
396
  <!-- @slot Slot before input icon -->
@@ -1,12 +1,9 @@
1
1
  import type { Component } from 'vue'
2
- import {
3
- type VvInputTextPropsTypes,
4
- INPUT_TYPES,
5
- } from '@/components/VvInputText'
6
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
7
- import VvInputPasswordAction from '@/components/VvInputText/VvInputPasswordAction'
8
- import VvInputStepAction from '@/components/VvInputText/VvInputStepAction'
9
- import VvInputClearAction from '@/components/VvInputText/VvInputClearAction'
2
+ import { type VvInputTextPropsTypes, INPUT_TYPES } from '.'
3
+ import VvIcon from '../VvIcon/VvIcon.vue'
4
+ import VvInputPasswordAction from '../VvInputText/VvInputPasswordAction'
5
+ import VvInputStepAction from '../VvInputText/VvInputStepAction'
6
+ import VvInputClearAction from '../VvInputText/VvInputClearAction'
10
7
 
11
8
  export default function VvInputTextActionsFactory(
12
9
  type: string,
@@ -1,5 +1,6 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue'
2
- import { InputTextareaProps } from '@/props'
2
+ import type { MaskTokens } from 'maska'
3
+ import { InputTextareaProps } from '../../props'
3
4
 
4
5
  export const INPUT_TYPES = {
5
6
  TEXT: 'text',
@@ -135,6 +136,66 @@ export const VvInputTextProps = {
135
136
  type: String,
136
137
  default: 'Clear',
137
138
  },
139
+ /**
140
+ * Input mask, only for text type
141
+ * @see https://beholdr.github.io/maska/
142
+ */
143
+ mask: {
144
+ type: String,
145
+ default: undefined,
146
+ },
147
+ /**
148
+ * Show mask before typing
149
+ * @see https://beholdr.github.io/maska/#/?id=maskinput-options
150
+ */
151
+ maskEager: {
152
+ type: Boolean,
153
+ default: false,
154
+ },
155
+ /**
156
+ * Write values reverse (ex. for numbers)
157
+ * @see https://beholdr.github.io/maska/#/?id=maskinput-options
158
+ */
159
+ maskReversed: {
160
+ type: Boolean,
161
+ default: false,
162
+ },
163
+ /**
164
+ * Add mask custom tokens
165
+ * @see https://beholdr.github.io/maska/#/?id=custom-tokens
166
+ */
167
+ maskTokens: {
168
+ type: Object as PropType<MaskTokens>,
169
+ default: undefined,
170
+ },
171
+ /**
172
+ * Replace default tokens
173
+ * @see https://beholdr.github.io/maska/#/?id=custom-tokens
174
+ */
175
+ maskTokensReplace: {
176
+ type: Boolean,
177
+ default: false,
178
+ },
179
+ /**
180
+ * Adjust input width to content
181
+ */
182
+ autoWidth: {
183
+ type: Boolean,
184
+ default: false,
185
+ },
186
+ /**
187
+ * Hide type number, password and search actions
188
+ */
189
+ hideActions: {
190
+ type: Boolean,
191
+ default: false,
192
+ },
193
+ /**
194
+ * Add unit label to input
195
+ */
196
+ unit: {
197
+ type: String,
198
+ },
138
199
  }
139
200
 
140
201
  export type VvInputTextPropsTypes = ExtractPropTypes<typeof VvInputTextProps>
@@ -5,7 +5,7 @@
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import { VvProgressProps } from '@/components/VvProgress'
8
+ import { VvProgressProps } from '.'
9
9
 
10
10
  // props
11
11
  const props = defineProps(VvProgressProps)
@@ -14,7 +14,7 @@
14
14
 
15
15
  // styles
16
16
  const { modifiers } = toRefs(props)
17
- const bemCssClasses = useBemModifiers(
17
+ const bemCssClasses = useModifiers(
18
18
  'vv-progress',
19
19
  modifiers,
20
20
  computed(() => ({ indeterminate: indeterminate.value })),
@@ -1,4 +1,4 @@
1
- import { ModifiersProps } from '@/props'
1
+ import { ModifiersProps } from '../../props'
2
2
 
3
3
  export const VvProgressProps = {
4
4
  ...ModifiersProps,