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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +98 -3
  3. package/auto-imports.d.ts +6 -2
  4. package/bin/icons.cjs +1 -1
  5. package/bin/icons.js +23 -16
  6. package/dist/Volver.d.ts +1 -1
  7. package/dist/components/VvAccordion/VvAccordion.es.js +67 -13
  8. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  9. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +13 -6
  10. package/dist/components/VvAccordion/index.d.ts +4 -1
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +111 -37
  12. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  13. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -8
  14. package/dist/components/VvAccordionGroup/index.d.ts +4 -1
  15. package/dist/components/VvAction/VvAction.es.js +56 -12
  16. package/dist/components/VvAction/VvAction.umd.js +1 -1
  17. package/dist/components/VvAction/VvAction.vue.d.ts +59 -12
  18. package/dist/components/VvAction/index.d.ts +25 -4
  19. package/dist/components/VvAlert/VvAlert.es.js +188 -152
  20. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  21. package/dist/components/VvAlert/VvAlert.vue.d.ts +18 -8
  22. package/dist/components/VvAlert/index.d.ts +9 -5
  23. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +230 -174
  24. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  25. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +13 -6
  26. package/dist/components/VvAlertGroup/index.d.ts +6 -2
  27. package/dist/components/VvAvatar/VvAvatar.es.js +54 -9
  28. package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
  29. package/dist/components/VvAvatar/VvAvatar.vue.d.ts +12 -4
  30. package/dist/components/VvAvatar/index.d.ts +4 -1
  31. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +111 -36
  32. package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
  33. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +10 -3
  34. package/dist/components/VvAvatarGroup/index.d.ts +4 -1
  35. package/dist/components/VvBadge/VvBadge.es.js +71 -16
  36. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  37. package/dist/components/VvBadge/VvBadge.vue.d.ts +12 -4
  38. package/dist/components/VvBadge/index.d.ts +4 -1
  39. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +257 -49
  40. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  41. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +27 -7
  42. package/dist/components/VvBreadcrumb/index.d.ts +6 -10
  43. package/dist/components/VvButton/VvButton.es.js +165 -137
  44. package/dist/components/VvButton/VvButton.umd.js +1 -1
  45. package/dist/components/VvButton/VvButton.vue.d.ts +101 -27
  46. package/dist/components/VvButton/index.d.ts +41 -14
  47. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +67 -15
  48. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  49. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +23 -10
  50. package/dist/components/VvButtonGroup/index.d.ts +8 -2
  51. package/dist/components/VvCard/VvCard.es.js +79 -24
  52. package/dist/components/VvCard/VvCard.umd.js +1 -1
  53. package/dist/components/VvCard/VvCard.vue.d.ts +12 -4
  54. package/dist/components/VvCard/index.d.ts +4 -1
  55. package/dist/components/VvCheckbox/VvCheckbox.es.js +89 -21
  56. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  57. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +104 -32
  58. package/dist/components/VvCheckbox/index.d.ts +45 -12
  59. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +168 -66
  60. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  61. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +100 -29
  62. package/dist/components/VvCheckboxGroup/index.d.ts +45 -12
  63. package/dist/components/VvCombobox/VvCombobox.es.js +721 -527
  64. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  65. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +145 -72
  66. package/dist/components/VvCombobox/index.d.ts +53 -22
  67. package/dist/components/VvDialog/VvDialog.es.js +133 -141
  68. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  69. package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -4
  70. package/dist/components/VvDropdown/VvDropdown.es.js +121 -55
  71. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  72. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +61 -35
  73. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +72 -11
  74. package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +1 -1
  75. package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +12 -4
  76. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +26 -7
  77. package/dist/components/VvDropdown/index.d.ts +16 -11
  78. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +80 -21
  79. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  80. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +13 -7
  81. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +56 -8
  82. package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
  83. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +76 -17
  84. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  85. package/dist/components/VvIcon/VvIcon.es.js +23 -96
  86. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  87. package/dist/components/VvIcon/VvIcon.vue.d.ts +23 -66
  88. package/dist/components/VvIcon/index.d.ts +21 -48
  89. package/dist/components/VvInputFile/VvInputFile.es.js +1558 -0
  90. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -0
  91. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +190 -0
  92. package/dist/components/VvInputFile/index.d.ts +74 -0
  93. package/dist/components/VvInputText/VvInputClearAction.d.ts +2 -2
  94. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +1 -1
  95. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  96. package/dist/components/VvInputText/VvInputText.es.js +266 -242
  97. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  98. package/dist/components/VvInputText/VvInputText.vue.d.ts +153 -46
  99. package/dist/components/VvInputText/index.d.ts +69 -18
  100. package/dist/components/VvNav/VvNav.es.js +150 -73
  101. package/dist/components/VvNav/VvNav.umd.js +1 -1
  102. package/dist/components/VvNav/VvNav.vue.d.ts +41 -14
  103. package/dist/components/VvNav/VvNavItem.vue.d.ts +9 -0
  104. package/dist/components/VvNav/{VvNavSeparator.d.ts → VvNavSeparator.vue.d.ts} +1 -1
  105. package/dist/components/VvNav/index.d.ts +5 -13
  106. package/dist/components/VvNavItem/VvNavItem.es.js +435 -0
  107. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -0
  108. package/dist/components/VvNavSeparator/VvNavSeparator.es.js +24 -0
  109. package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -0
  110. package/dist/components/VvProgress/VvProgress.es.js +65 -14
  111. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  112. package/dist/components/VvProgress/VvProgress.vue.d.ts +10 -3
  113. package/dist/components/VvProgress/index.d.ts +4 -1
  114. package/dist/components/VvRadio/VvRadio.es.js +89 -21
  115. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  116. package/dist/components/VvRadio/VvRadio.vue.d.ts +102 -30
  117. package/dist/components/VvRadio/index.d.ts +44 -11
  118. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +168 -66
  119. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  120. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +100 -29
  121. package/dist/components/VvRadioGroup/index.d.ts +45 -12
  122. package/dist/components/VvSelect/VvSelect.es.js +244 -226
  123. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  124. package/dist/components/VvSelect/VvSelect.vue.d.ts +112 -39
  125. package/dist/components/VvSelect/index.d.ts +48 -14
  126. package/dist/components/VvTab/VvTab.es.js +251 -110
  127. package/dist/components/VvTab/VvTab.umd.js +1 -1
  128. package/dist/components/VvTab/VvTab.vue.d.ts +50 -13
  129. package/dist/components/VvTab/index.d.ts +13 -4
  130. package/dist/components/VvTextarea/VvTextarea.es.js +225 -212
  131. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  132. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +155 -48
  133. package/dist/components/VvTextarea/index.d.ts +68 -19
  134. package/dist/components/VvTooltip/VvTooltip.es.js +72 -17
  135. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  136. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +10 -3
  137. package/dist/components/VvTooltip/index.d.ts +4 -1
  138. package/dist/components/index.d.ts +10 -0
  139. package/dist/components/index.es.js +2635 -1301
  140. package/dist/components/index.umd.js +1 -1
  141. package/dist/composables/alert/useAlert.d.ts +37 -4
  142. package/dist/composables/dropdown/useProvideDropdown.d.ts +1 -1
  143. package/dist/composables/index.d.ts +1 -0
  144. package/dist/composables/index.es.js +88 -1
  145. package/dist/composables/index.umd.js +1 -1
  146. package/dist/composables/useBlurhash.d.ts +7 -0
  147. package/dist/composables/useComponentIcon.d.ts +9 -8
  148. package/dist/composables/useVolver.d.ts +1 -1
  149. package/dist/directives/index.d.ts +3 -5
  150. package/dist/directives/index.es.js +92 -31
  151. package/dist/directives/index.umd.js +1 -1
  152. package/dist/directives/v-tooltip.es.js +90 -26
  153. package/dist/directives/v-tooltip.umd.js +1 -1
  154. package/dist/icons.es.js +6 -6
  155. package/dist/icons.umd.js +1 -1
  156. package/dist/index.d.ts +3 -1
  157. package/dist/index.es.js +81 -16
  158. package/dist/index.umd.js +1 -1
  159. package/dist/props/index.d.ts +287 -73
  160. package/dist/resolvers/unplugin.d.ts +6 -1
  161. package/dist/resolvers/unplugin.es.js +78 -10
  162. package/dist/resolvers/unplugin.umd.js +1 -1
  163. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +72 -84
  164. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +623 -461
  165. package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +1 -1
  166. package/dist/stories/Blurhash/BlurhashComposable.stories.d.ts +4 -0
  167. package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
  168. package/dist/stories/Icon/Icon.settings.d.ts +1 -0
  169. package/dist/stories/InputFile/InputFile.settings.d.ts +56 -0
  170. package/dist/stories/InputFile/InputFile.stories.d.ts +13 -0
  171. package/dist/stories/InputFile/InputFileModifiers.stories.d.ts +9 -0
  172. package/dist/stories/InputFile/InputFileSlots.stories.d.ts +6 -0
  173. package/dist/stories/Tab/Tab.settings.d.ts +4 -37
  174. package/dist/types/alert.d.ts +13 -0
  175. package/dist/types/blurhash.d.ts +12 -0
  176. package/dist/types/floating-ui.d.ts +6 -0
  177. package/dist/types/generic.d.ts +4 -0
  178. package/dist/types/group.d.ts +37 -0
  179. package/dist/types/index.d.ts +7 -0
  180. package/dist/types/input-file.d.ts +14 -0
  181. package/dist/types/nav.d.ts +18 -0
  182. package/dist/utils/ObjectUtilities.d.ts +0 -1
  183. package/dist/workers/blurhash.d.ts +1 -0
  184. package/package.json +91 -74
  185. package/src/Volver.ts +31 -20
  186. package/src/assets/icons/detailed.json +1 -1
  187. package/src/assets/icons/normal.json +1 -1
  188. package/src/assets/icons/simple.json +1 -1
  189. package/src/components/VvAccordion/VvAccordion.vue +2 -2
  190. package/src/components/VvAction/VvAction.vue +5 -2
  191. package/src/components/VvAlert/index.ts +1 -3
  192. package/src/components/VvAlertGroup/index.ts +2 -1
  193. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +20 -19
  194. package/src/components/VvBreadcrumb/index.ts +2 -8
  195. package/src/components/VvButton/VvButton.vue +6 -6
  196. package/src/components/VvButton/index.ts +2 -4
  197. package/src/components/VvCombobox/VvCombobox.vue +24 -16
  198. package/src/components/VvCombobox/index.ts +4 -0
  199. package/src/components/VvIcon/VvIcon.vue +2 -2
  200. package/src/components/VvIcon/index.ts +22 -48
  201. package/src/components/VvInputFile/VvInputFile.vue +302 -0
  202. package/src/components/VvInputFile/index.ts +38 -0
  203. package/src/components/VvInputText/VvInputText.vue +13 -14
  204. package/src/components/VvNav/VvNav.vue +30 -50
  205. package/src/components/VvNav/VvNavItem.vue +18 -0
  206. package/src/components/VvNav/VvNavSeparator.vue +11 -0
  207. package/src/components/VvNav/index.ts +2 -15
  208. package/src/components/VvSelect/VvSelect.vue +5 -8
  209. package/src/components/VvTab/VvTab.vue +63 -35
  210. package/src/components/VvTab/index.ts +10 -4
  211. package/src/components/VvTextarea/VvTextarea.vue +6 -9
  212. package/src/components/index.ts +10 -0
  213. package/src/composables/index.ts +1 -0
  214. package/src/composables/useBlurhash.ts +76 -0
  215. package/src/composables/useComponentIcon.ts +15 -14
  216. package/src/composables/useUniqueId.ts +2 -2
  217. package/src/directives/index.ts +3 -6
  218. package/src/directives/v-tooltip.ts +19 -10
  219. package/src/index.ts +3 -1
  220. package/src/props/index.ts +115 -27
  221. package/src/resolvers/unplugin.ts +24 -14
  222. package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +2 -2
  223. package/src/stories/Blurhash/BlurhashComposable.stories.ts +195 -0
  224. package/src/stories/Combobox/Combobox.settings.ts +8 -0
  225. package/src/stories/Icon/Icon.settings.ts +3 -3
  226. package/src/stories/InputFile/InputFile.settings.ts +36 -0
  227. package/src/stories/InputFile/InputFile.stories.ts +98 -0
  228. package/src/stories/InputFile/InputFileModifiers.stories.ts +51 -0
  229. package/src/stories/InputFile/InputFileSlots.stories.ts +25 -0
  230. package/src/stories/Nav/Nav.settings.ts +3 -4
  231. package/src/stories/Nav/Nav.test.ts +4 -15
  232. package/src/stories/Tab/Tab.settings.ts +9 -9
  233. package/src/stories/Tab/Tab.stories.ts +2 -2
  234. package/src/stories/Tab/Tab.test.ts +6 -14
  235. package/src/stories/argTypes.ts +1 -1
  236. package/src/types/blurhash.ts +21 -0
  237. package/src/types/generic.ts +6 -0
  238. package/src/types/index.ts +7 -0
  239. package/src/types/input-file.ts +16 -0
  240. package/src/types/nav.ts +20 -0
  241. package/src/utils/ObjectUtilities.ts +0 -11
  242. package/src/workers/blurhash.ts +9 -0
  243. package/dist/components/VvNav/VvNavItemTitle.vue.d.ts +0 -6
  244. package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +0 -19
  245. package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +0 -1
  246. package/src/components/VvNav/VvNavItemTitle.vue +0 -11
  247. package/src/components/VvNav/VvNavSeparator.ts +0 -8
  248. package/src/types/generic.d.ts +0 -6
  249. /package/src/types/{alert.d.ts → alert.ts} +0 -0
  250. /package/src/types/{floating-ui.d.ts → floating-ui.ts} +0 -0
  251. /package/src/types/{group.d.ts → group.ts} +0 -0
@@ -5,7 +5,7 @@
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import { nanoid } from 'nanoid'
8
+ import { uid } from 'uid'
9
9
  import { VvAccordionEvents, VvAccordionProps, useGroupProps } from '.'
10
10
 
11
11
  // props, attrs and emit
@@ -15,7 +15,7 @@
15
15
 
16
16
  // data
17
17
  const accordionName = computed(
18
- () => props.name || (attrs?.id as string) || nanoid(),
18
+ () => props.name || (attrs?.id as string) || uid(),
19
19
  )
20
20
  const {
21
21
  modifiers,
@@ -55,7 +55,7 @@
55
55
  case props.href !== undefined:
56
56
  return ActionTag.a
57
57
  default:
58
- return ActionTag.button
58
+ return props.defaultTag // button
59
59
  }
60
60
  })
61
61
 
@@ -85,12 +85,14 @@
85
85
  to: props.to,
86
86
  target: props.target,
87
87
  }
88
- default:
88
+ case ActionTag.button:
89
89
  return {
90
90
  ...toReturn,
91
91
  type: props.type,
92
92
  disabled: props.disabled,
93
93
  }
94
+ default:
95
+ return toReturn
94
96
  }
95
97
  })
96
98
 
@@ -132,6 +134,7 @@
132
134
  active,
133
135
  pressed,
134
136
  disabled,
137
+ current,
135
138
  }"
136
139
  @click.passive="onClick"
137
140
  @mouseover.passive="onMouseover"
@@ -86,9 +86,7 @@ export const useVvAlert = (
86
86
  const hasTitleId = computed(() => `${hasId.value}-title`)
87
87
 
88
88
  // icon
89
- const hasIcon = computed(() =>
90
- typeof props.icon === 'string' ? { name: props.icon } : props.icon,
91
- )
89
+ const { hasIcon } = useComponentIcon(computed(() => props.icon))
92
90
 
93
91
  // props
94
92
  const hasClass = useModifiers(
@@ -1,10 +1,11 @@
1
1
  import { ModifiersProps } from '@/props'
2
2
  import type { ExtractPropTypes } from 'vue'
3
+ import type { VvIconProps } from '../VvIcon'
3
4
 
4
5
  export type AlertItem = {
5
6
  id: string | number
6
7
  title?: string
7
- icon?: string | Record<string, unknown>
8
+ icon?: string | VvIconProps
8
9
  content?: string
9
10
  footer?: string
10
11
  modifiers?: string | string[]
@@ -7,46 +7,47 @@
7
7
  <script setup lang="ts">
8
8
  import { useModifiers } from '../../composables/useModifiers'
9
9
  import { VvBreadcrumbProps } from '.'
10
+ import VvAction from '../VvAction/VvAction.vue'
10
11
 
11
12
  const props = defineProps(VvBreadcrumbProps)
12
13
  const { modifiers } = toRefs(props)
13
14
  const bemCssClasses = useModifiers('vv-breadcrumb', modifiers)
15
+ const length = computed(() => props.routes?.length ?? 0)
16
+
17
+ const isLast = (index: number) => index === length.value - 1
14
18
  </script>
15
19
 
16
20
  <template>
17
21
  <nav :class="bemCssClasses" aria-label="breadcrumbs">
18
22
  <ol class="vv-breadcrumb__list">
19
23
  <li
20
- v-for="(route, index) in routes"
21
- :key="`${route.label}-${index}`"
22
- :class="{
23
- 'vv-breadcrumb__item': index < Number(routes?.length) - 1,
24
- 'vv-breadcrumb__item-active':
25
- index === Number(routes?.length) - 1,
26
- }"
24
+ v-for="({ label, ...route }, index) in routes"
25
+ :key="`${label}-${index}`"
26
+ :class="
27
+ !isLast(index)
28
+ ? 'vv-breadcrumb__item'
29
+ : 'vv-breadcrumb__item-active'
30
+ "
27
31
  itemprop="itemListElement"
28
32
  itemtype="https://schema.org/ListItem"
29
33
  itemscope
30
34
  >
31
- <Component
32
- :is="route.to ? 'router-link' : route.href ? 'a' : 'span'"
35
+ <VvAction
33
36
  v-bind="route"
34
- :class="{
35
- 'vv-breadcrumb__link':
36
- index < Number(routes?.length) - 1,
37
- }"
38
- :aria-current="
39
- index === Number(routes?.length) - 1
40
- ? 'page'
41
- : undefined
37
+ :class="
38
+ !isLast(index)
39
+ ? 'vv-breadcrumb__link'
40
+ : 'vv-breadcrumb__label'
42
41
  "
42
+ :aria-current="isLast(index) ? 'page' : undefined"
43
43
  itemprop="item"
44
+ default-tag="span"
44
45
  >
45
46
  <!-- @slot Slot for label -->
46
47
  <slot name="label" v-bind="{ route, index }">
47
- {{ route.label }}
48
+ {{ label }}
48
49
  </slot>
49
- </Component>
50
+ </VvAction>
50
51
  <meta itemprop="position" :content="`${index + 1}`" />
51
52
  </li>
52
53
  </ol>
@@ -1,13 +1,7 @@
1
1
  import { ModifiersProps } from '../../props'
2
-
3
- export interface Route {
4
- label: string
5
- to?: string | { [key: string]: unknown }
6
- title?: string
7
- href?: string
8
- }
2
+ import type { NavItem } from '../../types'
9
3
 
10
4
  export const VvBreadcrumbProps = {
11
5
  ...ModifiersProps,
12
- routes: Array as PropType<Route[]>,
6
+ routes: Array as PropType<NavItem[]>,
13
7
  }
@@ -74,9 +74,7 @@
74
74
  * @description Define icon attributes.
75
75
  * @returns {Object} The icon attributes.
76
76
  */
77
- const hasIconProps = computed(() =>
78
- typeof icon?.value === 'string' ? { name: icon?.value } : icon?.value,
79
- )
77
+ const { hasIcon } = useComponentIcon(icon)
80
78
 
81
79
  /**
82
80
  * @description Catch click event
@@ -146,9 +144,11 @@
146
144
  <template v-else>
147
145
  <!-- @slot Before label and icon -->
148
146
  <slot name="before" />
149
- <template v-if="icon">
150
- <VvIcon class="vv-button__icon" v-bind="hasIconProps" />
151
- </template>
147
+ <VvIcon
148
+ v-if="hasIcon"
149
+ v-bind="hasIcon"
150
+ class="vv-button__icon"
151
+ />
152
152
  <span v-if="label" class="vv-button__label">
153
153
  <!-- @slot Use this slot for button label -->
154
154
  <slot name="label">
@@ -6,6 +6,7 @@ import {
6
6
  LoadingProps,
7
7
  ModifiersProps,
8
8
  UnselectableProps,
9
+ IconProps,
9
10
  } from '../../props'
10
11
  import { INJECTION_KEY_BUTTON_GROUP, Side } from '../../constants'
11
12
 
@@ -17,10 +18,7 @@ export const VvButtonProps = {
17
18
  ...ModifiersProps,
18
19
  ...UnselectableProps,
19
20
  ...LoadingProps,
20
- /**
21
- * Button icon
22
- */
23
- icon: [String, Object],
21
+ ...IconProps,
24
22
  /**
25
23
  * Button icon position
26
24
  */
@@ -87,9 +87,13 @@
87
87
  searchText,
88
88
  computed(() => Number(props.debounceSearch)),
89
89
  )
90
- watch(debouncedSearchText, () =>
91
- emit('change:search', debouncedSearchText.value),
92
- )
90
+ watch(debouncedSearchText, () => {
91
+ emit('update:search', debouncedSearchText.value)
92
+ /**
93
+ * @deprecated change:search should not be used, use update:search instead
94
+ */
95
+ emit('change:search', debouncedSearchText.value)
96
+ })
93
97
 
94
98
  // expanded
95
99
  const expanded = ref(false)
@@ -147,10 +151,7 @@
147
151
  const dropdownEl = ref()
148
152
 
149
153
  // icons
150
- const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
151
- icon,
152
- iconPosition,
153
- )
154
+ const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
154
155
 
155
156
  // dirty
156
157
  const isDirty = computed(() => !isEmpty(props.modelValue))
@@ -168,12 +169,12 @@
168
169
  disabled: disabled.value,
169
170
  loading: isLoading.value,
170
171
  readonly: readonly.value,
171
- 'icon-before': Boolean(hasIconBefore.value),
172
- 'icon-after': Boolean(hasIconAfter.value),
172
+ 'icon-before': hasIconBefore.value !== undefined,
173
+ 'icon-after': hasIconAfter.value !== undefined,
173
174
  valid: valid.value,
174
175
  invalid: invalid.value,
175
176
  dirty: isDirty.value,
176
- focus: focused.value,
177
+ focus: focused.value || focusedWithin.value || expanded.value,
177
178
  floating: floating.value,
178
179
  badges: props.badges,
179
180
  })),
@@ -266,12 +267,13 @@
266
267
  return
267
268
  }
268
269
 
270
+ // get option value
269
271
  const value = getOptionValue(option)
270
-
271
272
  let toReturn: string | string[] | Option | Option[] | undefined = value
272
- // Check multiple prop, override value with array and remove or add the value
273
+
274
+ // check multiple prop, override value with array and remove or add the value
273
275
  if (props.multiple) {
274
- // check maxValues prop and block check new values
276
+ // check max-values prop and block check new values
275
277
  if (Array.isArray(props.modelValue)) {
276
278
  const maxValues = Number(props.maxValues)
277
279
  if (
@@ -294,7 +296,13 @@
294
296
  if (!props.keepOpen) {
295
297
  collapse()
296
298
  }
297
- if (props.unselectable && value === props.modelValue) {
299
+ if (Array.isArray(props.modelValue)) {
300
+ if (props.unselectable && props.modelValue.includes(value)) {
301
+ toReturn = []
302
+ } else {
303
+ toReturn = [value]
304
+ }
305
+ } else if (props.unselectable && value === props.modelValue) {
298
306
  toReturn = undefined
299
307
  }
300
308
  }
@@ -418,8 +426,8 @@
418
426
  <div class="vv-select__inner">
419
427
  <VvIcon
420
428
  v-if="hasIconBefore"
429
+ v-bind="hasIconBefore"
421
430
  class="vv-select__icon"
422
- v-bind="hasIcon"
423
431
  />
424
432
  <div
425
433
  ref="inputEl"
@@ -482,8 +490,8 @@
482
490
  </div>
483
491
  <VvIcon
484
492
  v-if="hasIconAfter"
493
+ v-bind="hasIconAfter"
485
494
  class="vv-select__icon vv-select__icon-after"
486
- v-bind="hasIcon"
487
495
  />
488
496
  </div>
489
497
  <div v-if="$slots.after" class="vv-select__input-after">
@@ -20,6 +20,10 @@ import type { Option } from '../../types/generic'
20
20
 
21
21
  export const VvComboboxEvents = [
22
22
  'update:modelValue',
23
+ 'update:search',
24
+ /**
25
+ * @deprecated change:search should not be used, use update:search instead
26
+ */
23
27
  'change:search',
24
28
  'focus',
25
29
  'blur',
@@ -6,10 +6,10 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import { Icon, addIcon, iconExists } from '@iconify/vue'
9
- import { VvIconProps } from '.'
9
+ import { type VvIconProps, VvIconPropsDefaults } from '.'
10
10
 
11
11
  // props
12
- const props = defineProps(VvIconProps)
12
+ const props = withDefaults(defineProps<VvIconProps>(), VvIconPropsDefaults)
13
13
 
14
14
  const hasRotate = computed(() => {
15
15
  if (typeof props.rotate === 'string') {
@@ -1,4 +1,3 @@
1
- import type { PropType } from 'vue'
2
1
  import type { IconifyIconOnLoad, IconifyRenderMode } from '@iconify/vue'
3
2
 
4
3
  export enum IconPrefix {
@@ -7,65 +6,38 @@ export enum IconPrefix {
7
6
  detailed = 'detailed',
8
7
  }
9
8
 
10
- export const VvIconProps = {
11
- /**
12
- * Color
13
- */
14
- color: String,
15
- /**
16
- * Width
17
- */
18
- width: {
19
- type: [String, Number],
20
- },
21
- /**
22
- * Height
23
- */
24
- height: {
25
- type: [String, Number],
26
- },
9
+ export type VvIconProps = {
27
10
  /**
28
11
  * Icon name
29
12
  * Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
30
13
  * https://docs.iconify.design/api/providers.html#provider-in-icon-name
31
14
  */
32
- name: {
33
- type: String,
34
- required: true,
35
- },
15
+ name: string
16
+ color?: string
17
+ width?: string | number
18
+ height?: string | number
36
19
  /**
37
- * By default 'vv'
38
20
  * If custom collection is not added with "addCollection" DS class method, this prop could not be used
39
21
  * Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
40
22
  */
41
- provider: {
42
- type: String,
43
- },
23
+ provider?: string
44
24
  /**
25
+ * @default 'normal'
45
26
  * The name of icon set.
46
27
  * Icon default options prefix: simple | normal | detailed
47
28
  */
48
- prefix: {
49
- type: String as PropType<`${IconPrefix}` | string>,
50
- default: 'normal',
51
- },
29
+ prefix?: IconPrefix | string
52
30
  /**
53
31
  * Url remote SVG icon
54
32
  */
55
- src: String,
56
- /**
57
- * Horizontal flip
58
- */
59
- horizontalFlip: Boolean,
60
- /**
61
- * Vertical flip
62
- */
63
- verticalFlip: Boolean,
33
+ src?: string
34
+ horizontalFlip?: boolean
35
+ verticalFlip?: boolean
64
36
  /**
65
37
  * String alternative to "horizontalFlip" and "verticalFlip".
66
38
  * Example: https://docs.iconify.design/icon-components/vue/transform.html
67
39
  */
68
- flip: String,
40
+ flip?: string
69
41
  /**
70
42
  * Icon render mode
71
43
  * 'style' = 'bg' or 'mask', depending on icon content
@@ -74,30 +46,32 @@ export const VvIconProps = {
74
46
  * 'svg' = svg
75
47
  * Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
76
48
  */
77
- mode: String as PropType<`${IconifyRenderMode}`>,
49
+ mode?: IconifyRenderMode
78
50
  /**
79
51
  * Toggles inline or block mode
80
52
  * Example https://docs.iconify.design/icon-components/vue/inline.html
81
53
  */
82
- inline: Boolean,
54
+ inline?: boolean
83
55
  /**
84
56
  * rotates icon
85
57
  * Example https://docs.iconify.design/icon-components/vue/transform.html
86
58
  */
87
- rotate: [Number, String],
59
+ rotate?: number | string
88
60
  /**
89
61
  * A callback that is called when icon data has been loaded
90
62
  */
91
- onLoad: Function as PropType<IconifyIconOnLoad>,
63
+ onLoad?: IconifyIconOnLoad
92
64
  /**
93
65
  * SVG icon string
94
66
  */
95
- svg: String,
67
+ svg?: string
96
68
  /**
97
69
  * Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
98
70
  * @values string | string[]
99
71
  */
100
- modifiers: {
101
- type: [String, Array] as PropType<string | string[]>,
102
- },
72
+ modifiers?: string | string[]
73
+ }
74
+
75
+ export const VvIconPropsDefaults = {
76
+ prefix: IconPrefix.normal,
103
77
  }