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

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 (258) 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 +70 -14
  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 +117 -38
  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 +58 -13
  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 +195 -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 +240 -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 +73 -17
  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 +259 -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 +187 -141
  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 +69 -16
  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 +84 -25
  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 +91 -22
  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 +180 -67
  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 +758 -531
  64. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  65. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +181 -108
  66. package/dist/components/VvCombobox/index.d.ts +53 -22
  67. package/dist/components/VvDialog/VvDialog.es.js +136 -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 +101 -75
  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 +82 -22
  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 +33 -48
  89. package/dist/components/VvInputFile/VvInputFile.es.js +1734 -0
  90. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -0
  91. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +313 -0
  92. package/dist/components/VvInputFile/index.d.ts +179 -0
  93. package/dist/components/VvInputText/VvInputClearAction.d.ts +7 -5
  94. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +10 -8
  95. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  96. package/dist/components/VvInputText/VvInputText.es.js +331 -293
  97. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  98. package/dist/components/VvInputText/VvInputText.vue.d.ts +162 -55
  99. package/dist/components/VvInputText/index.d.ts +71 -29
  100. package/dist/components/VvNav/VvNav.es.js +151 -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.vue.d.ts +2 -0
  105. package/dist/components/VvNav/index.d.ts +5 -13
  106. package/dist/components/VvNavItem/VvNavItem.es.js +436 -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 +180 -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 +248 -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 +256 -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 +229 -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/common/HintSlot.d.ts +1 -1
  139. package/dist/components/index.d.ts +10 -0
  140. package/dist/components/index.es.js +2902 -1329
  141. package/dist/components/index.umd.js +1 -1
  142. package/dist/composables/alert/useAlert.d.ts +37 -4
  143. package/dist/composables/dropdown/useProvideDropdown.d.ts +1 -1
  144. package/dist/composables/index.d.ts +1 -0
  145. package/dist/composables/index.es.js +88 -1
  146. package/dist/composables/index.umd.js +1 -1
  147. package/dist/composables/useBlurhash.d.ts +7 -0
  148. package/dist/composables/useComponentIcon.d.ts +9 -8
  149. package/dist/composables/useVolver.d.ts +1 -1
  150. package/dist/directives/index.d.ts +3 -5
  151. package/dist/directives/index.es.js +92 -31
  152. package/dist/directives/index.umd.js +1 -1
  153. package/dist/directives/v-tooltip.es.js +90 -26
  154. package/dist/directives/v-tooltip.umd.js +1 -1
  155. package/dist/icons.es.js +210 -210
  156. package/dist/icons.umd.js +1 -1
  157. package/dist/index.d.ts +3 -1
  158. package/dist/index.es.js +81 -16
  159. package/dist/index.umd.js +1 -1
  160. package/dist/props/index.d.ts +287 -73
  161. package/dist/resolvers/unplugin.d.ts +6 -1
  162. package/dist/resolvers/unplugin.es.js +78 -10
  163. package/dist/resolvers/unplugin.umd.js +1 -1
  164. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +72 -84
  165. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +623 -461
  166. package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +1 -1
  167. package/dist/stories/Blurhash/BlurhashComposable.stories.d.ts +4 -0
  168. package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
  169. package/dist/stories/Icon/Icon.settings.d.ts +1 -0
  170. package/dist/stories/InputFile/InputFile.settings.d.ts +56 -0
  171. package/dist/stories/InputFile/InputFile.stories.d.ts +12 -0
  172. package/dist/stories/InputFile/InputFileDropArea.stories.d.ts +9 -0
  173. package/dist/stories/InputFile/InputFileIconPosition.stories.d.ts +8 -0
  174. package/dist/stories/InputFile/InputFileSlots.stories.d.ts +7 -0
  175. package/dist/stories/Tab/Tab.settings.d.ts +4 -37
  176. package/dist/types/alert.d.ts +13 -0
  177. package/dist/types/blurhash.d.ts +12 -0
  178. package/dist/types/floating-ui.d.ts +6 -0
  179. package/dist/types/generic.d.ts +4 -0
  180. package/dist/types/group.d.ts +37 -0
  181. package/dist/types/index.d.ts +7 -0
  182. package/dist/types/input-file.d.ts +16 -0
  183. package/dist/types/nav.d.ts +18 -0
  184. package/dist/utils/ObjectUtilities.d.ts +0 -1
  185. package/dist/workers/blurhash.d.ts +1 -0
  186. package/package.json +97 -80
  187. package/src/Volver.ts +31 -20
  188. package/src/assets/icons/detailed.json +1 -1
  189. package/src/assets/icons/normal.json +1 -1
  190. package/src/assets/icons/simple.json +1 -1
  191. package/src/components/VvAccordion/VvAccordion.vue +2 -2
  192. package/src/components/VvAction/VvAction.vue +5 -2
  193. package/src/components/VvAlert/index.ts +1 -3
  194. package/src/components/VvAlertGroup/index.ts +2 -1
  195. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +20 -19
  196. package/src/components/VvBreadcrumb/index.ts +2 -8
  197. package/src/components/VvButton/VvButton.vue +6 -6
  198. package/src/components/VvButton/index.ts +2 -4
  199. package/src/components/VvCombobox/VvCombobox.vue +24 -16
  200. package/src/components/VvCombobox/index.ts +4 -0
  201. package/src/components/VvIcon/VvIcon.vue +2 -2
  202. package/src/components/VvIcon/index.ts +35 -48
  203. package/src/components/VvInputFile/VvInputFile.vue +365 -0
  204. package/src/components/VvInputFile/index.ts +116 -0
  205. package/src/components/VvInputText/VvInputClearAction.ts +10 -6
  206. package/src/components/VvInputText/VvInputPasswordAction.ts +13 -9
  207. package/src/components/VvInputText/VvInputText.vue +17 -18
  208. package/src/components/VvInputText/index.ts +7 -15
  209. package/src/components/VvNav/VvNav.vue +30 -50
  210. package/src/components/VvNav/VvNavItem.vue +18 -0
  211. package/src/components/VvNav/VvNavSeparator.vue +11 -0
  212. package/src/components/VvNav/index.ts +2 -15
  213. package/src/components/VvSelect/VvSelect.vue +5 -8
  214. package/src/components/VvTab/VvTab.vue +63 -35
  215. package/src/components/VvTab/index.ts +10 -4
  216. package/src/components/VvTextarea/VvTextarea.vue +6 -9
  217. package/src/components/index.ts +10 -0
  218. package/src/composables/index.ts +1 -0
  219. package/src/composables/useBlurhash.ts +76 -0
  220. package/src/composables/useComponentIcon.ts +15 -14
  221. package/src/composables/useUniqueId.ts +2 -2
  222. package/src/directives/index.ts +3 -6
  223. package/src/directives/v-tooltip.ts +19 -10
  224. package/src/index.ts +3 -1
  225. package/src/props/index.ts +115 -27
  226. package/src/resolvers/unplugin.ts +24 -14
  227. package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +2 -2
  228. package/src/stories/Blurhash/BlurhashComposable.stories.ts +195 -0
  229. package/src/stories/Combobox/Combobox.settings.ts +8 -0
  230. package/src/stories/Icon/Icon.settings.ts +3 -3
  231. package/src/stories/InputFile/InputFile.settings.ts +36 -0
  232. package/src/stories/InputFile/InputFile.stories.ts +89 -0
  233. package/src/stories/InputFile/InputFileDropArea.stories.ts +56 -0
  234. package/src/stories/InputFile/InputFileIconPosition.stories.ts +43 -0
  235. package/src/stories/InputFile/InputFileSlots.stories.ts +33 -0
  236. package/src/stories/Nav/Nav.settings.ts +3 -4
  237. package/src/stories/Nav/Nav.test.ts +4 -15
  238. package/src/stories/Tab/Tab.settings.ts +9 -9
  239. package/src/stories/Tab/Tab.stories.ts +2 -2
  240. package/src/stories/Tab/Tab.test.ts +6 -14
  241. package/src/stories/argTypes.ts +1 -1
  242. package/src/types/blurhash.ts +21 -0
  243. package/src/types/generic.ts +6 -0
  244. package/src/types/index.ts +7 -0
  245. package/src/types/input-file.ts +18 -0
  246. package/src/types/nav.ts +20 -0
  247. package/src/utils/ObjectUtilities.ts +0 -11
  248. package/src/workers/blurhash.ts +9 -0
  249. package/dist/components/VvNav/VvNavItemTitle.vue.d.ts +0 -6
  250. package/dist/components/VvNav/VvNavSeparator.d.ts +0 -2
  251. package/dist/components/VvNavItemTitle/VvNavItemTitle.es.js +0 -19
  252. package/dist/components/VvNavItemTitle/VvNavItemTitle.umd.js +0 -1
  253. package/src/components/VvNav/VvNavItemTitle.vue +0 -11
  254. package/src/components/VvNav/VvNavSeparator.ts +0 -8
  255. package/src/types/generic.d.ts +0 -6
  256. /package/src/types/{alert.d.ts → alert.ts} +0 -0
  257. /package/src/types/{floating-ui.d.ts → floating-ui.ts} +0 -0
  258. /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,71 +1,56 @@
1
- import type { PropType } from 'vue'
2
1
  import type { IconifyIconOnLoad, IconifyRenderMode } from '@iconify/vue'
3
2
 
3
+ export const ACTION_ICONS = {
4
+ showPassword: 'eye-on',
5
+ hidePassword: 'eye-off',
6
+ showDatePicker: 'calendar',
7
+ showTimePicker: 'time',
8
+ showColorPicker: 'color',
9
+ clear: 'close',
10
+ add: 'add',
11
+ remove: 'trash',
12
+ edit: 'edit',
13
+ download: 'download',
14
+ } as const
15
+
4
16
  export enum IconPrefix {
5
17
  simple = 'simple',
6
18
  normal = 'normal',
7
19
  detailed = 'detailed',
8
20
  }
9
21
 
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
- },
22
+ export type VvIconProps = {
27
23
  /**
28
24
  * Icon name
29
25
  * Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
30
26
  * https://docs.iconify.design/api/providers.html#provider-in-icon-name
31
27
  */
32
- name: {
33
- type: String,
34
- required: true,
35
- },
28
+ name: string
29
+ color?: string
30
+ width?: string | number
31
+ height?: string | number
36
32
  /**
37
- * By default 'vv'
38
33
  * If custom collection is not added with "addCollection" DS class method, this prop could not be used
39
34
  * Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
40
35
  */
41
- provider: {
42
- type: String,
43
- },
36
+ provider?: string
44
37
  /**
38
+ * @default 'normal'
45
39
  * The name of icon set.
46
40
  * Icon default options prefix: simple | normal | detailed
47
41
  */
48
- prefix: {
49
- type: String as PropType<`${IconPrefix}` | string>,
50
- default: 'normal',
51
- },
42
+ prefix?: IconPrefix | string
52
43
  /**
53
44
  * Url remote SVG icon
54
45
  */
55
- src: String,
56
- /**
57
- * Horizontal flip
58
- */
59
- horizontalFlip: Boolean,
60
- /**
61
- * Vertical flip
62
- */
63
- verticalFlip: Boolean,
46
+ src?: string
47
+ horizontalFlip?: boolean
48
+ verticalFlip?: boolean
64
49
  /**
65
50
  * String alternative to "horizontalFlip" and "verticalFlip".
66
51
  * Example: https://docs.iconify.design/icon-components/vue/transform.html
67
52
  */
68
- flip: String,
53
+ flip?: string
69
54
  /**
70
55
  * Icon render mode
71
56
  * 'style' = 'bg' or 'mask', depending on icon content
@@ -74,30 +59,32 @@ export const VvIconProps = {
74
59
  * 'svg' = svg
75
60
  * Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
76
61
  */
77
- mode: String as PropType<`${IconifyRenderMode}`>,
62
+ mode?: IconifyRenderMode
78
63
  /**
79
64
  * Toggles inline or block mode
80
65
  * Example https://docs.iconify.design/icon-components/vue/inline.html
81
66
  */
82
- inline: Boolean,
67
+ inline?: boolean
83
68
  /**
84
69
  * rotates icon
85
70
  * Example https://docs.iconify.design/icon-components/vue/transform.html
86
71
  */
87
- rotate: [Number, String],
72
+ rotate?: number | string
88
73
  /**
89
74
  * A callback that is called when icon data has been loaded
90
75
  */
91
- onLoad: Function as PropType<IconifyIconOnLoad>,
76
+ onLoad?: IconifyIconOnLoad
92
77
  /**
93
78
  * SVG icon string
94
79
  */
95
- svg: String,
80
+ svg?: string
96
81
  /**
97
82
  * Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
98
83
  * @values string | string[]
99
84
  */
100
- modifiers: {
101
- type: [String, Array] as PropType<string | string[]>,
102
- },
85
+ modifiers?: string | string[]
86
+ }
87
+
88
+ export const VvIconPropsDefaults = {
89
+ prefix: IconPrefix.normal,
103
90
  }