@volverjs/ui-vue 0.0.1-beta.12 → 0.0.1-beta.17

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 (432) hide show
  1. package/README.md +1 -1
  2. package/bin/icons.cjs +73 -0
  3. package/bin/icons.js +75 -0
  4. package/dist/Volver.d.ts +15 -2
  5. package/dist/components/VvAccordion/VvAccordion.es.js +133 -236
  6. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  7. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +32 -97
  8. package/dist/components/VvAccordion/index.d.ts +46 -0
  9. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +199 -277
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +44 -151
  12. package/dist/components/VvAccordionGroup/{VvAccordionGroup.d.ts → index.d.ts} +9 -13
  13. package/dist/components/VvBadge/VvBadge.es.js +42 -151
  14. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  15. package/dist/components/VvBadge/VvBadge.vue.d.ts +12 -53
  16. package/dist/components/VvBadge/{VvBadge.d.ts → index.d.ts} +0 -0
  17. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +55 -168
  18. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  19. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +24 -104
  20. package/dist/components/VvBreadcrumb/{VvBreadcrumb.d.ts → index.d.ts} +1 -1
  21. package/dist/components/VvButton/VvButton.es.js +298 -312
  22. package/dist/components/VvButton/VvButton.umd.js +1 -1
  23. package/dist/components/VvButton/VvButton.vue.d.ts +91 -163
  24. package/dist/components/VvButton/{VvButton.d.ts → index.d.ts} +46 -9
  25. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +59 -172
  26. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  27. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +30 -125
  28. package/dist/components/VvButtonGroup/{VvButtonGroup.d.ts → index.d.ts} +0 -0
  29. package/dist/components/VvCard/VvCard.es.js +55 -166
  30. package/dist/components/VvCard/VvCard.umd.js +1 -1
  31. package/dist/components/VvCard/VvCard.vue.d.ts +16 -61
  32. package/dist/components/VvCard/{VvCard.d.ts → index.d.ts} +1 -1
  33. package/dist/components/VvCheckbox/VvCheckbox.es.js +344 -0
  34. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -0
  35. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +87 -0
  36. package/dist/components/VvCheckbox/index.d.ts +86 -0
  37. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +415 -0
  38. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -0
  39. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +113 -0
  40. package/dist/components/{VvCheckGroup/VvCheckGroup.d.ts → VvCheckboxGroup/index.d.ts} +10 -10
  41. package/dist/components/VvDialog/VvDialog.es.js +108 -230
  42. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  43. package/dist/components/VvDialog/VvDialog.vue.d.ts +28 -132
  44. package/dist/components/VvDialog/{VvDialog.d.ts → index.d.ts} +2 -6
  45. package/dist/components/VvDropdown/VvDropdown.es.js +167 -186
  46. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  47. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +34 -136
  48. package/dist/components/VvDropdown/{VvDropdown.d.ts → index.d.ts} +7 -3
  49. package/dist/components/VvIcon/VvIcon.es.js +62 -174
  50. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  51. package/dist/components/VvIcon/VvIcon.vue.d.ts +36 -150
  52. package/dist/components/VvIcon/{VvIcon.d.ts → index.d.ts} +9 -0
  53. package/dist/components/VvInputText/VvInputClearAction.d.ts +36 -0
  54. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +56 -0
  55. package/dist/components/VvInputText/VvInputStepAction.d.ts +37 -0
  56. package/dist/components/VvInputText/VvInputText.es.js +586 -577
  57. package/dist/components/VvInputText/VvInputText.umd.js +1 -2
  58. package/dist/components/VvInputText/VvInputText.vue.d.ts +187 -275
  59. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  60. package/dist/components/VvInputText/index.d.ts +175 -0
  61. package/dist/components/VvNativeSelect/VvNativeSelect.es.js +299 -347
  62. package/dist/components/VvNativeSelect/VvNativeSelect.umd.js +1 -2
  63. package/dist/components/VvNativeSelect/VvNativeSelect.vue.d.ts +78 -190
  64. package/dist/components/VvNativeSelect/{VvNativeSelect.d.ts → index.d.ts} +35 -8
  65. package/dist/components/VvProgress/VvProgress.es.js +45 -162
  66. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  67. package/dist/components/VvProgress/VvProgress.vue.d.ts +17 -103
  68. package/dist/components/VvProgress/{VvProgress.d.ts → index.d.ts} +1 -7
  69. package/dist/components/VvRadio/VvRadio.es.js +292 -267
  70. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  71. package/dist/components/VvRadio/VvRadio.vue.d.ts +52 -122
  72. package/dist/components/VvRadio/index.d.ts +64 -0
  73. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +342 -380
  74. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -2
  75. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +58 -213
  76. package/dist/components/VvRadioGroup/{VvRadioGroup.d.ts → index.d.ts} +2 -2
  77. package/dist/components/VvSelect/VvSelect.es.js +556 -510
  78. package/dist/components/VvSelect/VvSelect.umd.js +1 -2
  79. package/dist/components/VvSelect/VvSelect.vue.d.ts +75 -240
  80. package/dist/components/VvSelect/{VvSelect.d.ts → index.d.ts} +12 -5
  81. package/dist/components/VvTextarea/VvTextarea.es.js +372 -481
  82. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -2
  83. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +103 -299
  84. package/dist/components/VvTextarea/{VvTextarea.d.ts → index.d.ts} +36 -13
  85. package/dist/components/common/HintSlot.d.ts +10 -4
  86. package/dist/components/index.d.ts +13 -6
  87. package/dist/components/index.es.js +2070 -895
  88. package/dist/components/index.umd.js +1 -2
  89. package/dist/composables/debouncedInput/useDebouncedInput.d.ts +2 -2
  90. package/dist/composables/focus/useComponentFocus.d.ts +3 -3
  91. package/dist/composables/group/types/IAccordionGroupState.d.ts +1 -3
  92. package/dist/composables/group/types/IGroupState.d.ts +2 -2
  93. package/dist/composables/group/useInjectedGroupState.d.ts +4 -4
  94. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  95. package/dist/composables/icons/useComponentIcons.d.ts +2 -2
  96. package/dist/composables/textLimit/useTextLimit.d.ts +0 -3
  97. package/dist/constants.d.ts +4 -4
  98. package/dist/icons.d.ts +1881 -0
  99. package/dist/icons.es.js +4 -6
  100. package/dist/icons.umd.js +1 -1
  101. package/dist/index.es.js +2113 -932
  102. package/dist/index.umd.js +1 -2
  103. package/dist/props/index.d.ts +9 -3
  104. package/dist/resolvers/unplugin.d.ts +27 -0
  105. package/dist/resolvers/unplugin.es.js +40 -0
  106. package/dist/resolvers/unplugin.umd.js +1 -0
  107. package/dist/stories/Accordion/Accordion.test.d.ts +4 -0
  108. package/dist/stories/Badge/Badge.test.d.ts +2 -0
  109. package/dist/stories/Breadcrumb/Breadcrumb.test.d.ts +2 -0
  110. package/dist/stories/Button/Button.test.d.ts +3 -8
  111. package/dist/stories/Card/Card.test.d.ts +3 -0
  112. package/dist/stories/Dialog/Dialog.test.d.ts +2 -0
  113. package/dist/stories/Dropdown/Dropdown.test.d.ts +2 -0
  114. package/dist/stories/Icon/IconList.vue.d.ts +1 -43
  115. package/dist/stories/InputText/InputText.test.d.ts +6 -0
  116. package/dist/stories/Radio/Radio.test.d.ts +3 -0
  117. package/dist/stories/RadioGroup/RadioGroup.test.d.ts +8 -0
  118. package/dist/stories/Select/Select.test.d.ts +3 -0
  119. package/dist/stories/Textarea/Textarea.test.d.ts +8 -0
  120. package/dist/stories/utils.d.ts +1 -3
  121. package/dist/test/sleep.d.ts +1 -0
  122. package/dist/utils/ObjectUtilities.d.ts +82 -95
  123. package/env.d.ts +1 -0
  124. package/package.json +103 -68
  125. package/src/Volver.ts +32 -3
  126. package/src/assets/icons/detailed.json +1 -1
  127. package/src/assets/icons/normal.json +1 -1
  128. package/src/assets/icons/simple.json +1 -1
  129. package/src/components/VvAccordion/VvAccordion.vue +80 -76
  130. package/src/components/VvAccordion/index.ts +69 -0
  131. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +77 -41
  132. package/src/components/VvAccordionGroup/{VvAccordionGroup.ts → index.ts} +8 -12
  133. package/src/components/VvBadge/VvBadge.vue +14 -10
  134. package/src/components/VvBadge/{VvBadge.ts → index.ts} +0 -0
  135. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +18 -19
  136. package/src/components/VvBreadcrumb/{VvBreadcrumb.ts → index.ts} +1 -1
  137. package/src/components/VvButton/VvButton.vue +123 -113
  138. package/src/components/VvButton/index.ts +147 -0
  139. package/src/components/VvButtonGroup/VvButtonGroup.vue +21 -17
  140. package/src/components/VvButtonGroup/{VvButtonGroup.ts → index.ts} +0 -0
  141. package/src/components/VvCard/VvCard.vue +20 -22
  142. package/src/components/VvCard/{VvCard.ts → index.ts} +0 -0
  143. package/src/components/VvCheckbox/VvCheckbox.vue +124 -0
  144. package/src/components/VvCheckbox/index.ts +94 -0
  145. package/src/components/{VvCheckGroup/VvCheckGroup.vue → VvCheckboxGroup/VvCheckboxGroup.vue} +49 -54
  146. package/src/components/{VvCheckGroup/VvCheckGroup.ts → VvCheckboxGroup/index.ts} +9 -9
  147. package/src/components/VvDialog/VvDialog.vue +47 -50
  148. package/src/components/VvDialog/index.ts +10 -0
  149. package/src/components/VvDropdown/VvDropdown.vue +61 -40
  150. package/src/components/VvDropdown/{VvDropdown.ts → index.ts} +8 -4
  151. package/src/components/VvIcon/VvIcon.vue +31 -25
  152. package/src/components/VvIcon/{VvIcon.ts → index.ts} +9 -0
  153. package/src/components/VvInputText/VvInputClearAction.ts +53 -0
  154. package/src/components/VvInputText/VvInputPasswordAction.ts +70 -0
  155. package/src/components/VvInputText/VvInputStepAction.ts +49 -0
  156. package/src/components/VvInputText/VvInputText.vue +168 -170
  157. package/src/components/VvInputText/VvInputTextActions.ts +54 -108
  158. package/src/components/VvInputText/index.ts +135 -0
  159. package/src/components/VvNativeSelect/VvNativeSelect.vue +130 -68
  160. package/src/components/VvNativeSelect/{VvNativeSelect.ts → index.ts} +26 -7
  161. package/src/components/VvProgress/VvProgress.vue +25 -26
  162. package/src/components/VvProgress/{VvProgress.ts → index.ts} +4 -7
  163. package/src/components/VvRadio/VvRadio.vue +81 -108
  164. package/src/components/VvRadio/index.ts +78 -0
  165. package/src/components/VvRadioGroup/VvRadioGroup.vue +45 -45
  166. package/src/components/VvRadioGroup/{VvRadioGroup.ts → index.ts} +1 -1
  167. package/src/components/VvSelect/VvSelect.vue +90 -69
  168. package/src/components/VvSelect/{VvSelect.ts → index.ts} +12 -5
  169. package/src/components/VvTextarea/VvTextarea.vue +121 -128
  170. package/src/components/VvTextarea/{VvTextarea.ts → index.ts} +31 -11
  171. package/src/components/common/HintSlot.ts +157 -136
  172. package/src/components/index.ts +13 -6
  173. package/src/composables/debouncedInput/useDebouncedInput.ts +21 -15
  174. package/src/composables/focus/useComponentFocus.ts +6 -8
  175. package/src/composables/group/types/IAccordionGroupState.ts +1 -3
  176. package/src/composables/group/types/IGroupState.ts +2 -2
  177. package/src/composables/group/useInjectedGroupState.ts +20 -30
  178. package/src/composables/group/useProvideGroupState.ts +1 -2
  179. package/src/composables/icons/useComponentIcons.ts +2 -3
  180. package/src/composables/options/useOptions.ts +3 -0
  181. package/src/composables/textLimit/useTextLimit.ts +1 -4
  182. package/src/composables/useModifiers.ts +13 -15
  183. package/src/constants.ts +5 -7
  184. package/src/directives/{.README → .gitkeep} +0 -0
  185. package/src/icons.ts +7 -0
  186. package/src/index.ts +0 -1
  187. package/src/props/index.ts +7 -1
  188. package/src/resolvers/unplugin.ts +103 -0
  189. package/src/shims.d.ts +11 -0
  190. package/src/stories/Accordion/Accordion.stories.mdx +10 -9
  191. package/src/stories/Accordion/Accordion.test.ts +37 -0
  192. package/src/stories/Accordion/AccordionSlots.stories.mdx +40 -25
  193. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +10 -16
  194. package/src/stories/AccordionGroup/{accordionGroupTest.js → AccordionGroup.test.js} +15 -17
  195. package/src/stories/AccordionGroup/AccordionGroupCollapse.stories.mdx +38 -0
  196. package/src/stories/AccordionGroup/{AccordionItems.stories.mdx → AccordionGroupItems.stories.mdx} +7 -13
  197. package/src/stories/Badge/Badge.stories.mdx +8 -8
  198. package/src/stories/Badge/Badge.test.ts +16 -0
  199. package/src/stories/Badge/BadgeColor.stories.mdx +6 -7
  200. package/src/stories/Badge/BadgeDot.stories.mdx +4 -3
  201. package/src/stories/Badge/BadgeModifiers.stories.mdx +7 -6
  202. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +15 -7
  203. package/src/stories/Breadcrumb/Breadcrumb.test.ts +49 -0
  204. package/src/stories/Breadcrumb/BreadcrumbMultiline.stories.mdx +15 -7
  205. package/src/stories/Button/Button.stories.mdx +16 -17
  206. package/src/stories/Button/Button.test.ts +8 -12
  207. package/src/stories/Button/ButtonActive.stories.mdx +2 -1
  208. package/src/stories/Button/ButtonBadge.stories.mdx +2 -2
  209. package/src/stories/Button/ButtonDisabled.stories.mdx +1 -1
  210. package/src/stories/Button/ButtonIcon.stories.mdx +6 -3
  211. package/src/stories/Button/ButtonIconPosition.stories.mdx +1 -1
  212. package/src/stories/Button/ButtonLink.stories.mdx +1 -19
  213. package/src/stories/Button/ButtonLoading.stories.mdx +4 -4
  214. package/src/stories/Button/ButtonModifiers.stories.mdx +1 -1
  215. package/src/stories/Button/ButtonPressed.stories.mdx +31 -0
  216. package/src/stories/Button/ButtonSlots.stories.mdx +1 -1
  217. package/src/stories/ButtonGroup/ButtonGroup.stories.mdx +5 -6
  218. package/src/stories/ButtonGroup/{ButtonGroupTest.js → ButtonGroup.test.js} +6 -28
  219. package/src/stories/ButtonGroup/ButtonGroupAction.stories.mdx +5 -6
  220. package/src/stories/ButtonGroup/ButtonGroupActionQuiet.stories.mdx +3 -4
  221. package/src/stories/ButtonGroup/ButtonGroupBlock.stories.mdx +3 -4
  222. package/src/stories/ButtonGroup/ButtonGroupCompact.stories.mdx +3 -4
  223. package/src/stories/ButtonGroup/ButtonGroupRounded.stories.mdx +3 -4
  224. package/src/stories/ButtonGroup/ButtonGroupToggle.stories.mdx +11 -12
  225. package/src/stories/ButtonGroup/ButtonGroupVertical.stories.mdx +3 -4
  226. package/src/stories/Card/Card.stories.mdx +7 -5
  227. package/src/stories/Card/Card.test.ts +26 -0
  228. package/src/stories/Card/CardSlots.stories.mdx +5 -5
  229. package/src/stories/Card/CardVariant.stories.mdx +5 -4
  230. package/src/stories/Checkbox/Checkbox.stories.mdx +51 -0
  231. package/src/stories/Checkbox/Checkbox.test.js +115 -0
  232. package/src/stories/Checkbox/CheckboxBinary.stories.mdx +76 -0
  233. package/src/stories/{Check/CheckDisabled.stories.mdx → Checkbox/CheckboxDisabled.stories.mdx} +7 -7
  234. package/src/stories/Checkbox/CheckboxError.stories.mdx +43 -0
  235. package/src/stories/Checkbox/CheckboxHintLabel.stories.mdx +35 -0
  236. package/src/stories/{Check/CheckReadonly.stories.mdx → Checkbox/CheckboxReadonly.stories.mdx} +6 -8
  237. package/src/stories/Checkbox/CheckboxSlots.stories.mdx +69 -0
  238. package/src/stories/{Check/CheckSwitch.stories.mdx → Checkbox/CheckboxSwitch.stories.mdx} +8 -8
  239. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +69 -0
  240. package/src/stories/CheckboxGroup/CheckboxGroupDisabled.stories.mdx +26 -0
  241. package/src/stories/CheckboxGroup/CheckboxGroupError.stories.mdx +28 -0
  242. package/src/stories/CheckboxGroup/CheckboxGroupHintLabel.stories.mdx +27 -0
  243. package/src/stories/CheckboxGroup/CheckboxGroupLabel.stories.mdx +26 -0
  244. package/src/stories/{CheckGroup/CheckGroupOptionLabel.stories.mdx → CheckboxGroup/CheckboxGroupOptionLabel.stories.mdx} +14 -11
  245. package/src/stories/{CheckGroup/CheckGroupOptionValue.stories.mdx → CheckboxGroup/CheckboxGroupOptionValue.stories.mdx} +13 -10
  246. package/src/stories/{CheckGroup/CheckGroupOptions.stories.mdx → CheckboxGroup/CheckboxGroupOptions.stories.mdx} +8 -8
  247. package/src/stories/CheckboxGroup/CheckboxGroupReadonly.stories.mdx +26 -0
  248. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +152 -0
  249. package/src/stories/CheckboxGroup/CheckboxGroupValid.stories.mdx +28 -0
  250. package/src/stories/CheckboxGroup/CheckboxGroupVertical.stories.mdx +26 -0
  251. package/src/stories/Dialog/Dialog.stories.mdx +5 -5
  252. package/src/stories/Dialog/Dialog.test.ts +26 -0
  253. package/src/stories/Dialog/DialogAutoClose.stories.mdx +1 -1
  254. package/src/stories/Dialog/DialogSize.stories.mdx +1 -1
  255. package/src/stories/Dropdown/Dropdown.stories.mdx +11 -7
  256. package/src/stories/Dropdown/Dropdown.test.ts +80 -0
  257. package/src/stories/Dropdown/DropdownDisabled.stories.mdx +9 -2
  258. package/src/stories/Dropdown/DropdownLabelNoResults.stories.mdx +2 -2
  259. package/src/stories/Dropdown/DropdownMaxValues.stories.mdx +4 -2
  260. package/src/stories/Dropdown/DropdownMultiple.stories.mdx +4 -2
  261. package/src/stories/Dropdown/DropdownOptions.stories.mdx +4 -4
  262. package/src/stories/Dropdown/DropdownUseObject.stories.mdx +4 -2
  263. package/src/stories/Icon/Icon.stories.mdx +8 -8
  264. package/src/stories/Icon/{IconTest.js → Icon.test.js} +2 -5
  265. package/src/stories/Icon/IconList.vue +5 -6
  266. package/src/stories/Icon/IconPrefix.stories.mdx +2 -2
  267. package/src/stories/Icon/IconRemote.stories.mdx +2 -2
  268. package/src/stories/Icon/IconsList.stories.mdx +2 -18
  269. package/src/stories/InputText/InputText.stories.mdx +25 -19
  270. package/src/stories/InputText/InputText.test.ts +156 -0
  271. package/src/stories/InputText/InputTextAutocomplete.stories.mdx +9 -2
  272. package/src/stories/InputText/InputTextAutofocus.stories.mdx +6 -3
  273. package/src/stories/InputText/InputTextDisabled.stories.mdx +10 -2
  274. package/src/stories/InputText/InputTextError.stories.mdx +10 -2
  275. package/src/stories/InputText/InputTextFloating.stories.mdx +10 -3
  276. package/src/stories/InputText/InputTextHintLabel.stories.mdx +10 -2
  277. package/src/stories/InputText/InputTextIcon.stories.mdx +6 -2
  278. package/src/stories/InputText/InputTextIconPosition.stories.mdx +10 -3
  279. package/src/stories/InputText/InputTextLabel.stories.mdx +8 -2
  280. package/src/stories/InputText/InputTextLoading.stories.mdx +10 -2
  281. package/src/stories/InputText/InputTextMax.stories.mdx +10 -3
  282. package/src/stories/InputText/InputTextMaxLength.stories.mdx +22 -5
  283. package/src/stories/InputText/InputTextMin.stories.mdx +10 -3
  284. package/src/stories/InputText/InputTextMinLength.stories.mdx +9 -2
  285. package/src/stories/InputText/InputTextPlaceholder.stories.mdx +8 -2
  286. package/src/stories/InputText/InputTextReadonly.stories.mdx +6 -2
  287. package/src/stories/InputText/InputTextSlots.stories.mdx +4 -5
  288. package/src/stories/InputText/InputTextStep.stories.mdx +9 -3
  289. package/src/stories/InputText/InputTextType.stories.mdx +110 -13
  290. package/src/stories/InputText/InputTextValid.stories.mdx +10 -2
  291. package/src/stories/NativeSelect/NativeSelect.stories.mdx +15 -11
  292. package/src/stories/NativeSelect/NativeSelect.test.js +151 -0
  293. package/src/stories/NativeSelect/NativeSelectDisabled.stories.mdx +6 -7
  294. package/src/stories/NativeSelect/NativeSelectError.stories.mdx +7 -3
  295. package/src/stories/NativeSelect/NativeSelectHintLabel.stories.mdx +7 -3
  296. package/src/stories/NativeSelect/NativeSelectIconLeftRight.stories.mdx +14 -12
  297. package/src/stories/NativeSelect/NativeSelectLoading.stories.mdx +7 -3
  298. package/src/stories/NativeSelect/NativeSelectOptions.stories.mdx +44 -38
  299. package/src/stories/NativeSelect/NativeSelectReadonly.stories.mdx +19 -11
  300. package/src/stories/NativeSelect/NativeSelectUseObject.stories.mdx +26 -30
  301. package/src/stories/NativeSelect/NativeSelectValid.stories.mdx +7 -3
  302. package/src/stories/NativeSelect/NativeSelectValueKey.stories.mdx +30 -30
  303. package/src/stories/Progress/Progress.stories.mdx +8 -11
  304. package/src/stories/Progress/{ProgressTest.js → Progress.test.js} +4 -10
  305. package/src/stories/Progress/ProgressDeterminate.stories.mdx +3 -6
  306. package/src/stories/Radio/Radio.stories.mdx +11 -17
  307. package/src/stories/Radio/Radio.test.ts +52 -0
  308. package/src/stories/Radio/RadioDisabled.stories.mdx +4 -7
  309. package/src/stories/Radio/RadioError.stories.mdx +8 -28
  310. package/src/stories/Radio/RadioHintLabel.stories.mdx +6 -7
  311. package/src/stories/Radio/RadioSlots.stories.mdx +21 -7
  312. package/src/stories/RadioGroup/RadioGroup.stories.mdx +20 -27
  313. package/src/stories/RadioGroup/RadioGroup.test.ts +139 -0
  314. package/src/stories/RadioGroup/RadioGroupDisabled.stories.mdx +6 -8
  315. package/src/stories/RadioGroup/RadioGroupError.stories.mdx +9 -11
  316. package/src/stories/RadioGroup/RadioGroupHintLabel.stories.mdx +8 -10
  317. package/src/stories/RadioGroup/RadioGroupLabel.stories.mdx +6 -8
  318. package/src/stories/RadioGroup/RadioGroupOptionLabel.stories.mdx +11 -13
  319. package/src/stories/RadioGroup/RadioGroupOptionValue.stories.mdx +9 -11
  320. package/src/stories/RadioGroup/RadioGroupOptions.stories.mdx +7 -9
  321. package/src/stories/RadioGroup/RadioGroupReadonly.stories.mdx +6 -8
  322. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +39 -62
  323. package/src/stories/RadioGroup/RadioGroupValid.stories.mdx +9 -11
  324. package/src/stories/RadioGroup/RadioGroupVertical.stories.mdx +6 -8
  325. package/src/stories/Select/Select.stories.mdx +32 -29
  326. package/src/stories/Select/Select.test.ts +104 -0
  327. package/src/stories/Select/SelectDisabled.stories.mdx +3 -3
  328. package/src/stories/Select/SelectMaxValues.stories.mdx +3 -3
  329. package/src/stories/Select/SelectMultiple.stories.mdx +5 -6
  330. package/src/stories/Select/SelectNative.stories.mdx +6 -8
  331. package/src/stories/Select/SelectOptions.stories.mdx +4 -4
  332. package/src/stories/Select/SelectSearchable.stories.mdx +13 -12
  333. package/src/stories/Select/SelectSeparator.stories.mdx +3 -3
  334. package/src/stories/Select/SelectUseObject.stories.mdx +3 -3
  335. package/src/stories/Textarea/Textarea.stories.mdx +6 -10
  336. package/src/stories/Textarea/Textarea.test.ts +204 -0
  337. package/src/stories/Textarea/TextareaAutoclear.stories.mdx +3 -2
  338. package/src/stories/Textarea/TextareaAutocomplete.stories.mdx +3 -2
  339. package/src/stories/Textarea/TextareaAutofocus.stories.mdx +3 -2
  340. package/src/stories/Textarea/TextareaDebounce.stories.mdx +7 -6
  341. package/src/stories/Textarea/TextareaDisabled.stories.mdx +9 -3
  342. package/src/stories/Textarea/TextareaError.stories.mdx +7 -2
  343. package/src/stories/Textarea/TextareaErrorLabel.stories.mdx +12 -2
  344. package/src/stories/Textarea/TextareaFloating.stories.mdx +7 -2
  345. package/src/stories/Textarea/TextareaHintLabel.stories.mdx +7 -2
  346. package/src/stories/Textarea/TextareaIcon.stories.mdx +3 -2
  347. package/src/stories/Textarea/TextareaIconPosition.stories.mdx +4 -2
  348. package/src/stories/Textarea/TextareaId.stories.mdx +3 -2
  349. package/src/stories/Textarea/TextareaLabel.stories.mdx +3 -2
  350. package/src/stories/Textarea/TextareaLimit.stories.mdx +5 -2
  351. package/src/stories/Textarea/TextareaLoading.stories.mdx +7 -2
  352. package/src/stories/Textarea/TextareaLoadingLabel.stories.mdx +9 -3
  353. package/src/stories/Textarea/TextareaMaxLength.stories.mdx +5 -4
  354. package/src/stories/Textarea/TextareaMinLength.stories.mdx +3 -2
  355. package/src/stories/Textarea/TextareaModifiers.stories.mdx +10 -2
  356. package/src/stories/Textarea/TextareaName.stories.mdx +3 -2
  357. package/src/stories/Textarea/TextareaPlaceholder.stories.mdx +4 -3
  358. package/src/stories/Textarea/TextareaReadonly.stories.mdx +8 -3
  359. package/src/stories/Textarea/TextareaRequired.stories.mdx +3 -2
  360. package/src/stories/Textarea/TextareaResizable.stories.mdx +7 -2
  361. package/src/stories/Textarea/TextareaRowsCols.stories.mdx +4 -2
  362. package/src/stories/Textarea/TextareaSlots.stories.mdx +7 -8
  363. package/src/stories/Textarea/TextareaValid.stories.mdx +7 -1
  364. package/src/stories/Textarea/TextareaValidLabel.stories.mdx +14 -4
  365. package/src/stories/utils.ts +1 -1
  366. package/src/stories/volver-ui-vue.stories.mdx +1 -1
  367. package/src/test/expect.ts +3 -1
  368. package/src/test/sleep.ts +2 -0
  369. package/src/test/types.d.ts +14 -1
  370. package/src/types/{.README → .gitkeep} +0 -0
  371. package/src/utils/ObjectUtilities.ts +247 -241
  372. package/dist/components/VvAccordion/VvAccordion.d.ts +0 -32
  373. package/dist/components/VvAccordion/useAccordionProps.d.ts +0 -16
  374. package/dist/components/VvButton/useButtonGroupProps.d.ts +0 -18
  375. package/dist/components/VvCheck/VvCheck.d.ts +0 -47
  376. package/dist/components/VvCheck/VvCheck.es.js +0 -318
  377. package/dist/components/VvCheck/VvCheck.umd.js +0 -1
  378. package/dist/components/VvCheck/VvCheck.vue.d.ts +0 -165
  379. package/dist/components/VvCheck/useCheckProps.d.ts +0 -16
  380. package/dist/components/VvCheckGroup/VvCheckGroup.es.js +0 -451
  381. package/dist/components/VvCheckGroup/VvCheckGroup.umd.js +0 -2
  382. package/dist/components/VvCheckGroup/VvCheckGroup.vue.d.ts +0 -272
  383. package/dist/components/VvDialog/constants.d.ts +0 -5
  384. package/dist/components/VvInputText/VvInputText.d.ts +0 -73
  385. package/dist/components/VvInputText/constants.d.ts +0 -55
  386. package/dist/components/VvRadio/VvRadio.d.ts +0 -22
  387. package/dist/components/VvRadio/useRadioProps.d.ts +0 -15
  388. package/dist/components/VvTextarea/constants.d.ts +0 -19
  389. package/dist/stories/RadioGroup/RadioOption.test.d.ts +0 -4
  390. package/dist/stories/RadioGroup/RadioProperty.test.d.ts +0 -12
  391. package/dist/stories/RadioGroup/RadioSlots.test.d.ts +0 -6
  392. package/src/assets/icons/index.js +0 -7
  393. package/src/components/VvAccordion/VvAccordion.ts +0 -34
  394. package/src/components/VvAccordion/useAccordionProps.ts +0 -45
  395. package/src/components/VvButton/VvButton.ts +0 -87
  396. package/src/components/VvButton/useButtonGroupProps.ts +0 -43
  397. package/src/components/VvCheck/VvCheck.ts +0 -48
  398. package/src/components/VvCheck/VvCheck.vue +0 -147
  399. package/src/components/VvCheck/useCheckProps.ts +0 -41
  400. package/src/components/VvDialog/VvDialog.ts +0 -17
  401. package/src/components/VvDialog/constants.ts +0 -5
  402. package/src/components/VvInputText/VvInputText.ts +0 -66
  403. package/src/components/VvInputText/constants.ts +0 -34
  404. package/src/components/VvRadio/VvRadio.ts +0 -25
  405. package/src/components/VvRadio/useRadioProps.ts +0 -40
  406. package/src/components/VvTextarea/constants.ts +0 -14
  407. package/src/stories/Accordion/AccordionBordered.stories.mdx +0 -26
  408. package/src/stories/Accordion/AccordionIconRight.stories.mdx +0 -32
  409. package/src/stories/Accordion/accordionTest.js +0 -36
  410. package/src/stories/AccordionGroup/Accordion.stories.mdx +0 -42
  411. package/src/stories/Badge/BadgeTest.js +0 -21
  412. package/src/stories/Button/ButtonSelected.stories.mdx +0 -30
  413. package/src/stories/Check/Check.stories.mdx +0 -62
  414. package/src/stories/Check/CheckBinary.stories.mdx +0 -75
  415. package/src/stories/Check/CheckError.stories.mdx +0 -64
  416. package/src/stories/Check/CheckErrorTests.js +0 -74
  417. package/src/stories/Check/CheckHintLabel.stories.mdx +0 -30
  418. package/src/stories/Check/CheckPropertyTest.js +0 -102
  419. package/src/stories/Check/CheckSlots.stories.mdx +0 -51
  420. package/src/stories/CheckGroup/CheckGroup.stories.mdx +0 -69
  421. package/src/stories/CheckGroup/CheckGroupDisabled.stories.mdx +0 -26
  422. package/src/stories/CheckGroup/CheckGroupError.stories.mdx +0 -28
  423. package/src/stories/CheckGroup/CheckGroupHintLabel.stories.mdx +0 -27
  424. package/src/stories/CheckGroup/CheckGroupLabel.stories.mdx +0 -26
  425. package/src/stories/CheckGroup/CheckGroupReadonly.stories.mdx +0 -26
  426. package/src/stories/CheckGroup/CheckGroupSlots.stories.mdx +0 -152
  427. package/src/stories/CheckGroup/CheckGroupValid.stories.mdx +0 -28
  428. package/src/stories/CheckGroup/CheckGroupVertical.stories.mdx +0 -26
  429. package/src/stories/RadioGroup/RadioOption.test.ts +0 -45
  430. package/src/stories/RadioGroup/RadioProperty.test.ts +0 -87
  431. package/src/stories/RadioGroup/RadioSlots.test.ts +0 -29
  432. package/src/stories/stories.scss +0 -13
@@ -1,88 +1,9 @@
1
- /* eslint-disable vue/one-component-per-file */
2
- import type { VvInputTextPropsTypes } from './VvInputText'
3
- import { computed, type Component } from 'vue'
4
-
5
- import { h, ref, defineComponent } from 'vue'
6
- import VvIcon from '../VvIcon/VvIcon.vue'
7
- import { TYPES, TYPES_ICON } from './constants'
8
-
9
- const VvInputPasswordAction = defineComponent({
10
- components: {
11
- VvIcon
12
- },
13
- props: {
14
- disabled: Boolean
15
- },
16
- setup(props, { emit }) {
17
- const active = ref(false)
18
- const activeIcon = computed(() =>
19
- active.value ? TYPES_ICON.PASSWORD_OFF : TYPES_ICON.PASSWORD_ON
20
- )
21
-
22
- function onClick() {
23
- if (!props.disabled) {
24
- active.value = !active.value
25
- emit(
26
- active.value ? 'action-password-on' : 'action-password-off'
27
- )
28
- }
29
- }
30
-
31
- return {
32
- activeIcon,
33
- onClick
34
- }
35
- },
36
- render() {
37
- const icon = h(VvIcon, { name: this.activeIcon })
38
-
39
- return h(
40
- 'button',
41
- {
42
- disabled: this.disabled,
43
- class: ['vv-input-text__action'],
44
- onClick: this.onClick
45
- },
46
- icon
47
- )
48
- }
49
- })
50
- const VvInputStepAction = defineComponent({
51
- components: {
52
- VvIcon
53
- },
54
- props: {
55
- disabled: Boolean,
56
- mode: {
57
- type: String,
58
- validator: (v: string) => ['up', 'down'].includes(v),
59
- default: 'up'
60
- }
61
- },
62
- setup(props, { emit }) {
63
- function onClick() {
64
- if (!props.disabled) {
65
- emit(
66
- props.mode === 'up' ? 'action-step-up' : 'action-step-down'
67
- )
68
- }
69
- }
70
-
71
- return {
72
- onClick
73
- }
74
- },
75
- render() {
76
- return h('button', {
77
- class: [
78
- 'vv-input-text__action-chevron',
79
- this.mode === 'up' && 'vv-input-text__action-chevron-up'
80
- ],
81
- disabled: this.disabled,
82
- onClick: this.onClick
83
- })
84
- }
85
- })
1
+ import { type Component, h, computed } from 'vue'
2
+ import { type VvInputTextPropsTypes, TYPES } from '@/components/VvInputText'
3
+ import VvIcon from '@/components/VvIcon/VvIcon.vue'
4
+ import VvInputPasswordAction from '@/components/VvInputText/VvInputPasswordAction'
5
+ import VvInputStepAction from '@/components/VvInputText/VvInputStepAction'
6
+ import VvInputClearAction from '@/components/VvInputText/VvInputClearAction'
86
7
 
87
8
  export default function VvInputTextActionsFactory(
88
9
  type: string,
@@ -93,7 +14,8 @@ export default function VvInputTextActionsFactory(
93
14
  components: {
94
15
  VvIcon,
95
16
  VvInputPasswordAction,
96
- VvInputStepAction
17
+ VvInputStepAction,
18
+ VvInputClearAction
97
19
  },
98
20
  setup() {
99
21
  const isDisabled = computed(() => {
@@ -101,51 +23,75 @@ export default function VvInputTextActionsFactory(
101
23
  })
102
24
 
103
25
  return {
104
- isDisabled
26
+ isDisabled,
27
+ labelStepUp: parentProps.labelStepUp,
28
+ labelStepDown: parentProps.labelStepDown,
29
+ labelShowPassword: parentProps.labelShowPassword,
30
+ labelHidePassword: parentProps.labelHidePassword,
31
+ labelClear: parentProps.labelClear,
32
+ iconShowPassword: parentProps.iconShowPassword,
33
+ iconHidePassword: parentProps.iconHidePassword
105
34
  }
106
35
  },
107
36
  render() {
108
- let _actions = null
37
+ let actions = null
109
38
  switch (type) {
39
+ case TYPES.SEARCH: {
40
+ const { onClear } = this.$attrs
41
+ actions = [
42
+ h(VvInputClearAction, {
43
+ disabled: this.isDisabled,
44
+ label: this.labelShowPassword,
45
+ onClear
46
+ })
47
+ ]
48
+ break
49
+ }
110
50
  case TYPES.PASSWORD: {
111
- const { onActionPasswordOn, onActionPasswordOff } =
112
- this.$attrs
113
- _actions = [
51
+ const { onTogglePassword } = this.$attrs
52
+ actions = [
114
53
  h(VvInputPasswordAction, {
115
54
  disabled: this.isDisabled,
116
- onActionPasswordOn,
117
- onActionPasswordOff
55
+ onTogglePassword,
56
+ labelShow: this.labelShowPassword,
57
+ labelHide: this.labelHidePassword,
58
+ iconShow: this.iconShowPassword,
59
+ iconHide: this.iconHidePassword
118
60
  })
119
61
  ]
120
62
  break
121
63
  }
122
64
  case TYPES.NUMBER: {
123
- const { onActionStepUp, onActionStepDown } = this.$attrs
124
- _actions = [
65
+ const { onStepUp, onStepDown } = this.$attrs
66
+ actions = [
125
67
  h(VvInputStepAction, {
126
68
  mode: 'up',
127
- disabled: this.isDisabled,
128
- onActionStepUp,
129
- onActionStepDown
69
+ disabled:
70
+ this.isDisabled ||
71
+ (parentProps.max !== undefined &&
72
+ parentProps.modelValue === parentProps.max),
73
+ label: this.labelStepUp,
74
+ onStepUp,
75
+ onStepDown
130
76
  }),
131
77
  h(VvInputStepAction, {
132
78
  mode: 'down',
133
- disabled: this.isDisabled,
134
- onActionStepUp,
135
- onActionStepDown
79
+ disabled:
80
+ this.isDisabled ||
81
+ (parentProps.min !== undefined &&
82
+ parentProps.modelValue === parentProps.min),
83
+ label: this.labelStepDown,
84
+ onStepUp,
85
+ onStepDown
136
86
  })
137
87
  ]
138
88
  break
139
89
  }
140
- default: {
141
- _actions = null
142
- break
143
- }
144
90
  }
145
91
 
146
- return Array.isArray(_actions)
147
- ? h('div', { class: 'vv-input-text__actions-group' }, _actions)
148
- : _actions
92
+ return Array.isArray(actions)
93
+ ? h('div', { class: 'vv-input-text__actions-group' }, actions)
94
+ : actions
149
95
  }
150
96
  }
151
97
  }
@@ -0,0 +1,135 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+ import {
3
+ ValidProps,
4
+ ErrorProps,
5
+ HintProps,
6
+ LoadingProps,
7
+ ModifiersProps,
8
+ LimitProps,
9
+ InputProps
10
+ } from '@/props'
11
+
12
+ export const TYPES = {
13
+ TEXT: 'text',
14
+ PASSWORD: 'password',
15
+ DATE: 'date',
16
+ DATETIME_LOCAL: 'datetime-local',
17
+ NUMBER: 'number',
18
+ TIME: 'time',
19
+ EMAIL: 'email',
20
+ TEL: 'tel',
21
+ URL: 'url',
22
+ COLOR: 'color',
23
+ SEARCH: 'search',
24
+ FILE: 'file'
25
+ }
26
+
27
+ export const ICON_POSITIONS = {
28
+ LEFT: 'left',
29
+ RIGHT: 'right'
30
+ }
31
+
32
+ export const TYPES_ICON = {
33
+ PASSWORD_SHOW: 'eye-on',
34
+ PASSWORD_HIDE: 'eye-off',
35
+ DATE: 'calendar',
36
+ TIME: 'time',
37
+ COLOR: 'color',
38
+ SEARCH: 'close'
39
+ }
40
+
41
+ export const INPUT = {
42
+ TYPES,
43
+ ICON_POSITIONS,
44
+ TYPES_ICON
45
+ }
46
+
47
+ export const VvInputTextEvents = ['update:modelValue', 'focus', 'blur', 'keyup']
48
+
49
+ export const VvInputTextProps = {
50
+ ...ValidProps,
51
+ ...ErrorProps,
52
+ ...HintProps,
53
+ ...LoadingProps,
54
+ ...ModifiersProps,
55
+ ...LimitProps,
56
+ ...InputProps,
57
+ /**
58
+ * Input value
59
+ */
60
+ modelValue: {
61
+ type: [String, Number],
62
+ default: undefined
63
+ },
64
+ /**
65
+ * Input type
66
+ */
67
+ type: {
68
+ type: String,
69
+ default: TYPES.TEXT,
70
+ validator: (value: string) => Object.values(TYPES).includes(value)
71
+ },
72
+ min: [Number, Date],
73
+ max: [Number, Date],
74
+ step: { type: Number, default: 1 },
75
+ labelStepUp: {
76
+ type: String,
77
+ default: 'Increase value'
78
+ },
79
+ labelStepDown: {
80
+ type: String,
81
+ default: 'Decrease value'
82
+ },
83
+ labelShowPassword: {
84
+ type: String,
85
+ default: 'Show password'
86
+ },
87
+ labelHidePassword: {
88
+ type: String,
89
+ default: 'Hide password'
90
+ },
91
+ labelClear: {
92
+ type: String,
93
+ default: 'Clear'
94
+ },
95
+ iconShowPassword: {
96
+ type: String,
97
+ default: TYPES_ICON.PASSWORD_SHOW
98
+ },
99
+ iconHidePassword: {
100
+ type: String,
101
+ default: TYPES_ICON.PASSWORD_HIDE
102
+ },
103
+ iconClear: {
104
+ type: String,
105
+ default: TYPES_ICON.SEARCH
106
+ },
107
+ /**
108
+ * Icon name
109
+ * @see DsIcon
110
+ */
111
+ icon: {
112
+ type: [String, Object],
113
+ default: ''
114
+ },
115
+ /**
116
+ * Icon position
117
+ */
118
+ iconPosition: {
119
+ type: String,
120
+ validation: (value: string) =>
121
+ Object.values(ICON_POSITIONS).includes(value),
122
+ default: ICON_POSITIONS.RIGHT
123
+ },
124
+ /**
125
+ * If true the label will be floating
126
+ */
127
+ floating: Boolean,
128
+ debounce: [String, Number],
129
+ /**
130
+ * Sequential keyboard navigation
131
+ */
132
+ tabindex: { type: [String, Number], default: 0 }
133
+ }
134
+
135
+ export type VvInputTextPropsTypes = ExtractPropTypes<typeof VvInputTextProps>
@@ -1,58 +1,29 @@
1
- <template>
2
- <div :class="selectClasses">
3
- <label v-if="label" :for="id">{{ label }}</label>
4
- <!-- #region native select -->
5
- <div class="vv-select__wrapper">
6
- <slot name="icon-left">
7
- <vv-icon v-if="iconLeft" :name="iconLeft" />
8
- </slot>
9
- <select
10
- :id="id"
11
- :value="
12
- typeof modelValue === 'string'
13
- ? modelValue
14
- : modelValue?.[valueKey]
15
- "
16
- :disabled="disabled || readonly"
17
- @input="onInput">
18
- <option v-if="placeholder" value="" disabled selected>
19
- {{ placeholder }}
20
- </option>
21
- <option
22
- v-for="(option, index) in options"
23
- :key="index"
24
- :disabled="
25
- typeof option === 'object'
26
- ? option.disabled ?? disabled
27
- : disabled
28
- "
29
- :value="getValue(option)">
30
- {{ getLabel(option) }}
31
- </option>
32
- </select>
33
- <slot name="icon-right">
34
- <vv-icon v-if="iconRight" :name="iconRight" />
35
- </slot>
36
- </div>
37
- <!-- #endregion native select -->
38
- <HintSlot class="vv-select__hint" />
39
- </div>
40
- </template>
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'VvNativeSelect'
4
+ }
5
+ </script>
41
6
 
42
7
  <script setup lang="ts">
43
- import { computed, toRefs, useSlots } from 'vue'
44
- import { v4 as uuidv4 } from 'uuid'
45
- import ObjectUtilities from '../../utils/ObjectUtilities'
46
- import { VvNativeSelectProps, type Option } from './VvNativeSelect'
47
- import VvIcon from '../VvIcon/VvIcon.vue'
48
- import HintSlotFactory from '../common/HintSlot'
49
- import { useBemModifiers } from '../../composables/useModifiers'
8
+ import { computed, toRefs, useSlots, type InputHTMLAttributes } from 'vue'
9
+ import { nanoid } from 'nanoid'
10
+ import { isEmpty } from '@/utils/ObjectUtilities'
11
+ import VvIcon from '@/components/VvIcon/VvIcon.vue'
12
+ import HintSlotFactory from '@/components/common/HintSlot'
13
+ import { useBemModifiers } from '@/composables/useModifiers'
14
+ import {
15
+ type Option,
16
+ VvNativeSelectProps,
17
+ VvNativeSelectEmits
18
+ } from '@/components/VvNativeSelect'
50
19
 
20
+ // props, emit and slots
51
21
  const props = defineProps(VvNativeSelectProps)
22
+ const emit = defineEmits(VvNativeSelectEmits)
52
23
  const slots = useSlots()
53
- const emit = defineEmits(['update:modelValue'])
54
- //Hint component
55
- const HintSlot = HintSlotFactory(props, slots)
24
+
25
+ // hint
26
+ const { HintSlot, hasHint, hasErrors } = HintSlotFactory(props, slots)
56
27
 
57
28
  // data
58
29
  const {
@@ -66,10 +37,32 @@ const {
66
37
  valid
67
38
  } = toRefs(props)
68
39
 
69
- const id = uuidv4()
40
+ // computed
41
+ const hasId = computed(() => String(props.id || nanoid()))
42
+ const hasDescribedBy = computed(() => `${hasId.value}-hint`)
43
+
44
+ // dirty
45
+ const isDirty = computed(() => !isEmpty(props.modelValue))
46
+
47
+ // disabled
48
+ const isDisabled = computed(() => props.disabled || props.readonly)
49
+ const hasTabindex = computed(() => {
50
+ return isDisabled.value ? -1 : props.tabindex
51
+ })
52
+
53
+ // invalid
54
+ const isInvalid = computed(() => {
55
+ if (props.error === true) {
56
+ return true
57
+ }
58
+ if (props.valid === true) {
59
+ return false
60
+ }
61
+ return undefined
62
+ })
70
63
 
71
- //Styles & css classes modifiers
72
- const { bemCssClasses: selectClasses } = useBemModifiers('vv-select', {
64
+ // styles
65
+ const { bemCssClasses } = useBemModifiers('vv-select', {
73
66
  modifiers,
74
67
  loading,
75
68
  readonly,
@@ -77,30 +70,99 @@ const { bemCssClasses: selectClasses } = useBemModifiers('vv-select', {
77
70
  iconRight,
78
71
  valid,
79
72
  invalid: error,
80
- dirty: computed(() => ObjectUtilities.isNotEmpty(props.modelValue))
73
+ dirty: isDirty
81
74
  })
82
75
 
76
+ // attrs
77
+ const hasAttrs = computed(() => {
78
+ return {
79
+ name: props.name,
80
+ tabindex: hasTabindex.value,
81
+ 'aria-invalid': isInvalid.value,
82
+ 'aria-describedby':
83
+ !hasErrors.value && hasHint.value
84
+ ? hasDescribedBy.value
85
+ : undefined,
86
+ 'aria-errormessage': hasErrors.value ? hasDescribedBy.value : undefined
87
+ } as InputHTMLAttributes
88
+ })
89
+
90
+ /**
91
+ * Retrieve the option value based on prop "valueKey" or the option if it is a string
92
+ * @param {String | Option} option
93
+ */
83
94
  function getValue(option: string | Option) {
84
95
  return typeof option === 'string' ? option : option[props.valueKey]
85
96
  }
86
97
 
98
+ /**
99
+ * Retrieve the option label based on prop "labelKey" or the option if it is a string
100
+ * @param {String | Option} option
101
+ */
87
102
  function getLabel(option: string | Option) {
88
103
  return typeof option === 'string' ? option : option[props.labelKey]
89
104
  }
90
105
 
91
- function onInput(event: Event) {
92
- const target = event.target as HTMLSelectElement
93
-
94
- // Find option object if useObject prop is true
95
- const valueObject = props.useObject
96
- ? props.options?.find(
97
- (option) => (option as Option)[props.valueKey] == target.value
98
- )
99
- : null
100
-
101
- // use valueObject if exist or the target value
102
- const value = valueObject || target.value
103
-
104
- emit('update:modelValue', value)
106
+ /**
107
+ * Retrieve the disabled state of an option based on prop "disabled" or the disabled attribute
108
+ * @param {String | Option} option
109
+ */
110
+ function getDisabled(option: string | Option): boolean {
111
+ if (typeof option === 'string' || option.disabled === undefined) {
112
+ return disabled.value
113
+ }
114
+ return option.disabled
105
115
  }
116
+
117
+ const localModelValue = computed({
118
+ get: () => {
119
+ return typeof props.modelValue === 'object'
120
+ ? (props.modelValue as Record<string, unknown>)?.[props.valueKey]
121
+ : props.modelValue
122
+ },
123
+ set: (newValue) => {
124
+ // find option object if useObject prop is true
125
+ const valueObject = props.useObject
126
+ ? props.options?.find(
127
+ (option) => (option as Option)[props.valueKey] === newValue
128
+ )
129
+ : undefined
130
+ // use valueObject if exist or the target value
131
+ emit('update:modelValue', valueObject ?? newValue)
132
+ }
133
+ })
106
134
  </script>
135
+
136
+ <template>
137
+ <div :class="bemCssClasses">
138
+ <label v-if="label" :for="hasId">{{ label }}</label>
139
+ <!-- #region native select -->
140
+ <div class="vv-select__wrapper">
141
+ <slot name="icon-left">
142
+ <vv-icon v-if="iconLeft" :name="iconLeft" />
143
+ </slot>
144
+ <select
145
+ :id="hasId"
146
+ v-model="localModelValue"
147
+ v-bind="hasAttrs"
148
+ :disabled="isDisabled"
149
+ :required="required">
150
+ <option v-if="placeholder" :value="undefined" disabled>
151
+ {{ placeholder }}
152
+ </option>
153
+ <option
154
+ v-for="(option, index) in options"
155
+ :key="index"
156
+ :disabled="getDisabled(option)"
157
+ :value="getValue(option)">
158
+ {{ getLabel(option) }}
159
+ </option>
160
+ </select>
161
+ <slot name="icon-right">
162
+ <vv-icon v-if="iconRight" :name="iconRight" />
163
+ </slot>
164
+ </div>
165
+ <!-- #endregion native select -->
166
+ <HintSlot :id="hasDescribedBy" class="vv-select__hint" />
167
+ </div>
168
+ </template>
@@ -7,10 +7,11 @@ import {
7
7
  DisabledProps,
8
8
  ReadonlyProps,
9
9
  ModifiersProps
10
- } from '../../props'
10
+ } from '@/props'
11
11
 
12
12
  export interface Option {
13
- [key: string]: any
13
+ [key: string]: unknown
14
+ disabled?: boolean
14
15
  }
15
16
 
16
17
  export const VvNativeSelectProps = {
@@ -22,16 +23,28 @@ export const VvNativeSelectProps = {
22
23
  ...ReadonlyProps,
23
24
  ...ModifiersProps,
24
25
  /**
25
- * modelValue can be an Object, a String or an Array of Object/String
26
+ * Select id
27
+ */
28
+ id: [String, Number],
29
+ /**
30
+ * Select name
31
+ */
32
+ name: { type: String, required: true },
33
+ /**
34
+ * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
26
35
  */
27
36
  modelValue: {
28
- type: [String, Object],
29
- required: true
37
+ type: [String, Number, Boolean, Object, Array],
38
+ default: undefined
30
39
  },
31
40
  /**
32
- * Select input label
41
+ * Select label
33
42
  */
34
43
  label: String,
44
+ /**
45
+ * Select required
46
+ */
47
+ required: Boolean,
35
48
  /**
36
49
  * Select input placeholder
37
50
  */
@@ -66,5 +79,11 @@ export const VvNativeSelectProps = {
66
79
  /**
67
80
  * String or String[] of css classes (modifiers) that will be concatenated to prefix 'vv-native-select--'
68
81
  */
69
- modifiers: [String, Array]
82
+ modifiers: [String, Array],
83
+ /**
84
+ * Sequential keyboard navigation
85
+ */
86
+ tabindex: { type: [String, Number], default: 0 }
70
87
  }
88
+
89
+ export const VvNativeSelectEmits = ['update:modelValue']
@@ -1,34 +1,33 @@
1
- <template>
2
- <progress ref="progress" aria-label="progressbar" v-bind="properties" />
3
- </template>
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'VvProgress'
4
+ }
5
+ </script>
4
6
 
5
7
  <script setup lang="ts">
6
- import { useBemModifiers } from '../../composables/useModifiers'
7
8
  import { computed, toRefs } from 'vue'
8
- import { VvProgressProps } from './VvProgress'
9
+ import { useBemModifiers } from '@/composables/useModifiers'
10
+ import { VvProgressProps } from '@/components/VvProgress'
9
11
 
10
- //Props, emits, slots, attrs
12
+ // props
11
13
  const props = defineProps(VvProgressProps)
14
+ const { value, max, ariaLabel } = toRefs(props)
15
+ const indeterminate = computed(() => props.value === undefined)
12
16
 
13
- // data
14
- const { modifiers } = toRefs(props)
15
-
16
- //Styles & bindings
17
- const { bemCssClasses: progressClass } = useBemModifiers('vv-progress', {
18
- modifiers,
19
- indeterminate: computed(() => !props.determinate)
20
- })
21
-
22
- /**
23
- * Compute component properties
24
- */
25
- const properties = computed(() => {
26
- return {
27
- 'aria-label': props.ariaLabel,
28
- role: 'progressbar',
29
- class: progressClass.value,
30
- value: props.value,
31
- max: props.max
32
- }
17
+ // styles
18
+ const { bemCssClasses: hasClass } = useBemModifiers('vv-progress', {
19
+ modifiers: props.modifiers,
20
+ indeterminate
33
21
  })
34
22
  </script>
23
+
24
+ <template>
25
+ <progress
26
+ role="progressbar"
27
+ v-bind="{
28
+ class: hasClass,
29
+ ariaLabel,
30
+ max,
31
+ value
32
+ }" />
33
+ </template>