@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
@@ -1,6 +1,7 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue'
2
2
  import type { FactoryOpts } from 'imask'
3
3
  import { InputTextareaProps } from '../../props'
4
+ import { type VvIconProps, ACTION_ICONS } from '../VvIcon'
4
5
 
5
6
  export const INPUT_TYPES = {
6
7
  TEXT: 'text',
@@ -19,15 +20,6 @@ export const INPUT_TYPES = {
19
20
  } as const
20
21
  export type InputType = ValueOf<typeof INPUT_TYPES>
21
22
 
22
- export const TYPES_ICON = {
23
- PASSWORD_SHOW: 'eye-on',
24
- PASSWORD_HIDE: 'eye-off',
25
- DATE: 'calendar',
26
- TIME: 'time',
27
- COLOR: 'color',
28
- SEARCH: 'close',
29
- } as const
30
-
31
23
  export const VvInputTextEvents = [
32
24
  'update:modelValue',
33
25
  'update:masked',
@@ -98,24 +90,24 @@ export const VvInputTextProps = {
98
90
  * @see VVIcon
99
91
  */
100
92
  iconShowPassword: {
101
- type: String,
102
- default: TYPES_ICON.PASSWORD_SHOW,
93
+ type: [String, Object] as PropType<string | VvIconProps>,
94
+ default: ACTION_ICONS.showPassword,
103
95
  },
104
96
  /**
105
97
  * VvIcon name for hide password button
106
98
  * @see VVIcon
107
99
  */
108
100
  iconHidePassword: {
109
- type: String,
110
- default: TYPES_ICON.PASSWORD_HIDE,
101
+ type: [String, Object] as PropType<string | VvIconProps>,
102
+ default: ACTION_ICONS.hidePassword,
111
103
  },
112
104
  /**
113
105
  * VvIcon name for clear button
114
106
  * @see VVIcon
115
107
  */
116
108
  iconClear: {
117
- type: String,
118
- default: TYPES_ICON.SEARCH,
109
+ type: [String, Object] as PropType<string | VvIconProps>,
110
+ default: ACTION_ICONS.clear,
119
111
  },
120
112
  /**
121
113
  * Label for step up button
@@ -1,66 +1,46 @@
1
1
  <script setup lang="ts">
2
- import { VvNavProps, VvNavEvents, type NavItem } from '@/components/VvNav'
3
- import VvAction from '@/components/VvAction/VvAction.vue'
2
+ import { VvNavProps, VvNavEvents } from '@/components/VvNav'
3
+ import VvNavItem from './VvNavItem.vue'
4
4
 
5
5
  const props = defineProps(VvNavProps)
6
- const emit = defineEmits(VvNavEvents)
7
- const { modifiers, items } = toRefs(props)
8
- const activeItem: Ref<string | null> = ref(null)
6
+ const { modifiers } = toRefs(props)
9
7
 
10
- // bem css classes
11
- const bemCssClasses = useModifiers('vv-nav', modifiers)
12
-
13
- const localItems = computed(() => {
14
- return items.value.map((item, index) => {
15
- return {
16
- ...item,
17
- id: item.id || `nav-item_${index}`,
8
+ const emit = defineEmits(VvNavEvents)
9
+ const onClick = (event: Event) => {
10
+ const target = event.target as HTMLElement
11
+ if (target?.dataset.index) {
12
+ const index = parseInt(target.dataset.index)
13
+ const item = props.items?.[index]
14
+ if (!item || item?.disabled) {
15
+ return
18
16
  }
19
- })
20
- })
21
-
22
- /**
23
- * Triggers when the item is clicked.
24
- * @private
25
- * @event click
26
- * @param [NavItem, string] item - the clicked item
27
- */
28
- function onClick(item: NavItem) {
29
- if (!item.disabled) {
30
17
  emit('click', item)
31
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32
- activeItem.value = item.id!
33
18
  }
34
19
  }
20
+
21
+ // bem css classes
22
+ const bemCssClasses = useModifiers('vv-nav', modifiers)
35
23
  </script>
36
24
 
37
25
  <template>
38
26
  <nav :class="bemCssClasses">
39
- <ul class="vv-nav__menu" role="menu" aria-busy="true">
40
- <li
41
- v-for="navItem in localItems"
42
- :key="navItem.id"
43
- class="vv-nav__item"
44
- role="presentation"
45
- >
46
- <VvAction
47
- v-bind="{
48
- disabled: navItem.disabled,
49
- to: navItem.to,
50
- href: navItem.href,
51
- tabindex: 0,
52
- }"
53
- :class="{
54
- current: activeItem == navItem.id,
55
- disabled: navItem.disabled,
56
- }"
57
- class="vv-nav__item-label"
58
- v-on="navItem.on"
59
- @click="onClick(navItem)"
27
+ <ul
28
+ class="vv-nav__menu"
29
+ role="menu"
30
+ aria-busy="true"
31
+ @click.stop="onClick"
32
+ >
33
+ <slot>
34
+ <VvNavItem
35
+ v-for="({ on = {}, data, ...item }, index) in items"
36
+ :key="index"
37
+ :data-index="index"
38
+ v-bind="item"
39
+ v-on="on"
60
40
  >
61
- {{ navItem.title }}
62
- </VvAction>
63
- </li>
41
+ <slot name="item" v-bind="{ item, data, index }" />
42
+ </VvNavItem>
43
+ </slot>
64
44
  </ul>
65
45
  </nav>
66
46
  </template>
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'VvNavItem',
4
+ inheritAttrs: false,
5
+ }
6
+ </script>
7
+
8
+ <script setup lang="ts">
9
+ import VvAction from '@/components/VvAction/VvAction.vue'
10
+ </script>
11
+
12
+ <template>
13
+ <li class="vv-nav__item" role="presentation">
14
+ <VvAction v-bind="$attrs" class="vv-nav__item-label">
15
+ <slot />
16
+ </VvAction>
17
+ </li>
18
+ </template>
@@ -0,0 +1,11 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'VvNavSeparator',
4
+ }
5
+ </script>
6
+
7
+ <template>
8
+ <li class="vv-nav__separator" role="separator">
9
+ <slot />
10
+ </li>
11
+ </template>
@@ -1,21 +1,8 @@
1
- import { ModifiersProps } from '@/props'
2
-
3
- export type NavItem = {
4
- id?: string
5
- title: string
6
- to?: string | { [key: string]: unknown }
7
- href?: string
8
- disabled?: boolean
9
- on?: Record<string, () => void>
10
- }
1
+ import { ModifiersProps, NavProps } from '@/props'
11
2
 
12
3
  export const VvNavProps = {
13
4
  ...ModifiersProps,
14
- items: {
15
- type: Array as PropType<NavItem[]>,
16
- required: true,
17
- default: () => [],
18
- },
5
+ ...NavProps,
19
6
  }
20
7
 
21
8
  export const VvNavEvents = ['click']
@@ -65,10 +65,7 @@
65
65
  })
66
66
 
67
67
  // icons
68
- const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
69
- icon,
70
- iconPosition,
71
- )
68
+ const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
72
69
 
73
70
  // dirty
74
71
  const isDirty = computed(() => !isEmpty(props.modelValue))
@@ -100,8 +97,8 @@
100
97
  loading: loading.value,
101
98
  disabled: disabled.value,
102
99
  readonly: readonly.value,
103
- 'icon-before': hasIconBefore.value,
104
- 'icon-after': hasIconAfter.value,
100
+ 'icon-before': hasIconBefore.value !== undefined,
101
+ 'icon-after': hasIconAfter.value !== undefined,
105
102
  dirty: isDirty.value,
106
103
  focus: focused.value,
107
104
  floating: floating.value,
@@ -174,8 +171,8 @@
174
171
  <div class="vv-select__inner">
175
172
  <VvIcon
176
173
  v-if="hasIconBefore"
174
+ v-bind="hasIconBefore"
177
175
  class="vv-select__icon"
178
- v-bind="hasIcon"
179
176
  />
180
177
  <select
181
178
  :id="hasId"
@@ -219,8 +216,8 @@
219
216
  </select>
220
217
  <VvIcon
221
218
  v-if="hasIconAfter"
219
+ v-bind="hasIconAfter"
222
220
  class="vv-select__icon vv-select__icon-after"
223
- v-bind="hasIcon"
224
221
  />
225
222
  </div>
226
223
  <div v-if="$slots.after" class="vv-select__input-after">
@@ -1,53 +1,81 @@
1
1
  <script setup lang="ts">
2
2
  import { VvTabProps, VvTabEvents } from '@/components/VvTab'
3
- import type { NavItem } from '@/components/VvNav'
4
3
  import VvNav from '@/components/VvNav/VvNav.vue'
4
+ import type { NavItemTab } from '@/types/nav'
5
5
 
6
6
  const props = defineProps(VvTabProps)
7
7
  const emit = defineEmits(VvTabEvents)
8
8
  const { modifiers, items } = toRefs(props)
9
- const activeTab: Ref<string | null> = ref(null)
10
-
11
- // bem css classes
12
- const bemCssClasses = useModifiers('vv-tab', modifiers)
13
-
14
- const localItems = computed(() => {
15
- return items.value.map((item, index) => {
16
- return {
17
- ...item,
18
- id: item.id || `tab-item_${index}`,
9
+ const tabKeys = computed(() => {
10
+ return items.value.reduce<string[]>((acc, item) => {
11
+ if (item.tab) {
12
+ acc.push(item.tab)
19
13
  }
20
- })
14
+ return acc
15
+ }, [])
21
16
  })
22
-
23
- /**
24
- * Triggers when the item is clicked.
25
- * @private
26
- * @event click
27
- * @param [NavItem, string] item - the clicked item
28
- */
29
- function onClick(item: NavItem) {
30
- if (!item.disabled) {
31
- emit('click', item)
32
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
33
- activeTab.value = item.id!
17
+ const localModelValue = ref<string | undefined>()
18
+ const activeTabKey = computed({
19
+ get: () => {
20
+ return (
21
+ props.modelValue || localModelValue.value || tabKeys.value?.[0]
22
+ )
23
+ },
24
+ set: (newValue) => {
25
+ localModelValue.value = newValue
26
+ emit('update:modelValue', newValue)
27
+ },
28
+ })
29
+ const hasNavModifiers = computed(() => {
30
+ return [
31
+ 'tabs',
32
+ ...(Array.isArray(props.navModifiers)
33
+ ? props.navModifiers
34
+ : props.navModifiers?.split(' ') ?? []),
35
+ ]
36
+ })
37
+ const onNavClick = (item: NavItemTab) => {
38
+ if (item.tab) {
39
+ activeTabKey.value = item.tab
34
40
  }
35
41
  }
42
+ const navItems = computed(() =>
43
+ props.items.map((item) => ({
44
+ current: item.tab === activeTabKey.value,
45
+ ...item,
46
+ })),
47
+ )
48
+
49
+ // bem css classes
50
+ const bemCssClasses = useModifiers('vv-tab', modifiers)
36
51
  </script>
37
52
 
38
53
  <template>
39
54
  <div :class="bemCssClasses">
40
- <VvNav :items="localItems" modifiers="tabs full" @click="onClick" />
41
- <!-- #region tab content -->
42
- <article
43
- v-for="item in localItems"
44
- :id="item.id"
45
- :key="item.id"
46
- :class="{ target: activeTab === item.id }"
47
- class="vv-tab__panel"
55
+ <!-- #region nav -->
56
+ <VvNav
57
+ v-bind="{
58
+ items: navItems,
59
+ modifiers: hasNavModifiers,
60
+ }"
61
+ @click="onNavClick"
48
62
  >
49
- <slot :name="`${item.id}`" />
50
- </article>
51
- <!-- #endregion tab content -->
63
+ <template #item="{ item, data, index }">
64
+ <slot name="nav-item" v-bind="{ item, data, index }" />
65
+ </template>
66
+ </VvNav>
67
+ <!-- #endregion -->
68
+
69
+ <!-- #region panels -->
70
+ <template v-for="(item, index) in items" :key="index">
71
+ <article
72
+ v-if="item.tab"
73
+ :class="{ target: activeTabKey === item.tab }"
74
+ class="vv-tab__panel"
75
+ >
76
+ <slot :name="`panel::${item.tab}`" />
77
+ </article>
78
+ </template>
79
+ <!-- #endregion -->
52
80
  </div>
53
81
  </template>
@@ -1,13 +1,19 @@
1
1
  import { ModifiersProps } from '@/props'
2
- import type { NavItem } from '../VvNav'
2
+ import type { NavItemTab } from '@/types/nav'
3
3
 
4
4
  export const VvTabProps = {
5
5
  ...ModifiersProps,
6
+ navModifiers: {
7
+ type: [String, Array] as PropType<string | string[]>,
8
+ },
9
+ modelValue: {
10
+ type: String,
11
+ default: '',
12
+ },
6
13
  items: {
7
- type: Array as PropType<NavItem[]>,
8
- required: true,
14
+ type: Array as PropType<NavItemTab[]>,
9
15
  default: () => [],
10
16
  },
11
17
  }
12
18
 
13
- export const VvTabEvents = ['click']
19
+ export const VvTabEvents = ['update:modelValue']
@@ -52,10 +52,7 @@
52
52
  const localModelValue = useDebouncedInput(modelValue, emit, debounce?.value)
53
53
 
54
54
  // icons
55
- const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
56
- icon,
57
- iconPosition,
58
- )
55
+ const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
59
56
 
60
57
  // focus
61
58
  const { focused } = useComponentFocus(textarea, emit)
@@ -113,11 +110,11 @@
113
110
  loading: loading.value,
114
111
  disabled: props.disabled,
115
112
  readonly: props.readonly,
116
- 'icon-before': hasIconBefore.value,
117
- 'icon-after': hasIconAfter.value,
113
+ 'icon-before': hasIconBefore.value !== undefined,
114
+ 'icon-after': hasIconAfter.value !== undefined,
118
115
  floating: props.floating && !isEmpty(props.label),
119
116
  dirty: isDirty.value,
120
- focused: focused.value,
117
+ focus: focused.value,
121
118
  resizable: props.resizable,
122
119
  })),
123
120
  )
@@ -180,8 +177,8 @@
180
177
  <div class="vv-textarea__inner">
181
178
  <VvIcon
182
179
  v-if="hasIconBefore"
180
+ v-bind="hasIconBefore"
183
181
  class="vv-textarea__icon"
184
- v-bind="hasIcon"
185
182
  />
186
183
  <textarea
187
184
  :id="hasId"
@@ -192,8 +189,8 @@
192
189
  />
193
190
  <VvIcon
194
191
  v-if="hasIconAfter"
192
+ v-bind="hasIconAfter"
195
193
  class="vv-textarea__icon vv-textarea__icon-after"
196
- v-bind="hasIcon"
197
194
  />
198
195
  </div>
199
196
  <div v-if="$slots.after" class="vv-textarea__input-after">
@@ -2,6 +2,9 @@ export { default as VvAccordion } from './VvAccordion/VvAccordion.vue'
2
2
  export { default as VvAccordionGroup } from './VvAccordionGroup/VvAccordionGroup.vue'
3
3
  export { default as VvAction } from './VvAction/VvAction.vue'
4
4
  export { default as VvAlert } from './VvAlert/VvAlert.vue'
5
+ export { default as VvAlertGroup } from './VvAlertGroup/VvAlertGroup.vue'
6
+ export { default as VvAvatar } from './VvAvatar/VvAvatar.vue'
7
+ export { default as VvAvatarGroup } from './VvAvatarGroup/VvAvatarGroup.vue'
5
8
  export { default as VvBadge } from './VvBadge/VvBadge.vue'
6
9
  export { default as VvBreadcrumb } from './VvBreadcrumb/VvBreadcrumb.vue'
7
10
  export { default as VvButton } from './VvButton/VvButton.vue'
@@ -12,9 +15,15 @@ export { default as VvCheckboxGroup } from './VvCheckboxGroup/VvCheckboxGroup.vu
12
15
  export { default as VvCombobox } from './VvCombobox/VvCombobox.vue'
13
16
  export { default as VvDialog } from './VvDialog/VvDialog.vue'
14
17
  export { default as VvDropdown } from './VvDropdown/VvDropdown.vue'
18
+ export { default as VvDropdownAction } from './VvDropdown/VvDropdownAction.vue'
19
+ export { default as VvDropdownItem } from './VvDropdown/VvDropdownItem.vue'
20
+ export { default as VvDropdownOptgroup } from './VvDropdown/VvDropdownOptgroup.vue'
21
+ export { default as VvDropdownOption } from './VvDropdown/VvDropdownOption.vue'
15
22
  export { default as VvIcon } from './VvIcon/VvIcon.vue'
16
23
  export { default as VvInputText } from './VvInputText/VvInputText.vue'
17
24
  export { default as VvNav } from './VvNav/VvNav.vue'
25
+ export { default as VvNavItem } from './VvNav/VvNavItem.vue'
26
+ export { default as VvNavSeparator } from './VvNav/VvNavSeparator.vue'
18
27
  export { default as VvProgress } from './VvProgress/VvProgress.vue'
19
28
  export { default as VvRadio } from './VvRadio/VvRadio.vue'
20
29
  export { default as VvRadioGroup } from './VvRadioGroup/VvRadioGroup.vue'
@@ -22,3 +31,4 @@ export { default as VvSelect } from './VvSelect/VvSelect.vue'
22
31
  export { default as VvTab } from './VvTab/VvTab.vue'
23
32
  export { default as VvTextarea } from './VvTextarea/VvTextarea.vue'
24
33
  export { default as VvTooltip } from './VvTooltip/VvTooltip.vue'
34
+ export { default as VvInputFile } from './VvInputFile/VvInputFile.vue'
@@ -1 +1,2 @@
1
1
  export { useAlert } from './alert/useAlert'
2
+ export { useBlurhash } from './useBlurhash'
@@ -0,0 +1,76 @@
1
+ import { wrap } from 'comlink'
2
+ import pica from 'pica'
3
+ import type { BlurhashWorkerType } from '@/types/blurhash'
4
+ import BlurhashWorker from '@/workers/blurhash?worker&inline'
5
+
6
+ const remoteFunction = wrap<BlurhashWorkerType>(new BlurhashWorker())
7
+
8
+ function loadImage(src: string): Promise<CanvasImageSource> {
9
+ return new Promise((resolve, reject) => {
10
+ const img = new Image()
11
+ img.onload = () => resolve(img)
12
+ img.onerror = (...args) => reject(args)
13
+ img.src = src
14
+ })
15
+ }
16
+
17
+ const getWidthHeightFromMaxSize = (
18
+ width: number,
19
+ height: number,
20
+ maxSize: number,
21
+ ) => {
22
+ if (width > height) {
23
+ return {
24
+ width: maxSize,
25
+ height: Math.round(maxSize * (height / width)),
26
+ }
27
+ }
28
+ return {
29
+ width: Math.round(maxSize * (width / height)),
30
+ height: maxSize,
31
+ }
32
+ }
33
+
34
+ const resizeImage = async (
35
+ image: ImageBitmap | HTMLImageElement | HTMLCanvasElement | File | Blob,
36
+ width: number,
37
+ height: number,
38
+ ) => {
39
+ const resizer = new pica()
40
+ const canvas = document.createElement('canvas')
41
+ canvas.width = width
42
+ canvas.height = height
43
+ const result = await resizer.resize(image, canvas)
44
+ return result.getContext('2d')?.getImageData(0, 0, width, height).data
45
+ }
46
+
47
+ export const useBlurhash = () => {
48
+ async function encode(file: File) {
49
+ const imageUrl = URL.createObjectURL(file)
50
+ const image = await loadImage(imageUrl)
51
+ if ('width' in image && 'height' in image) {
52
+ const { width: newWidth, height: newHeight } =
53
+ getWidthHeightFromMaxSize(
54
+ image.width as number,
55
+ image.height as number,
56
+ 32,
57
+ )
58
+ const imageData = await resizeImage(
59
+ image as ImageBitmap,
60
+ newWidth,
61
+ newHeight,
62
+ )
63
+ if (imageData) {
64
+ return remoteFunction.encode(
65
+ imageData,
66
+ newWidth,
67
+ newHeight,
68
+ 4,
69
+ 4,
70
+ )
71
+ }
72
+ }
73
+ }
74
+
75
+ return { encode, decode: remoteFunction.decode, loadImage }
76
+ }
@@ -1,34 +1,35 @@
1
1
  import type { Ref } from 'vue'
2
+ import type { VvIconProps } from '../components/VvIcon'
2
3
  import { Position, Side } from '../constants'
3
4
 
4
5
  export function useComponentIcon(
5
- icon: Ref<string | object | undefined> | undefined,
6
- iconPosition: Ref<string>,
6
+ icon?: Ref<string | VvIconProps | undefined>,
7
+ iconPosition?: Ref<string | undefined>,
7
8
  ) {
9
+ const hasIcon = computed(() => {
10
+ if (typeof icon?.value === 'string') {
11
+ return { name: icon?.value }
12
+ }
13
+ return icon?.value
14
+ })
8
15
  const hasIconBefore = computed(() =>
9
- Boolean(icon?.value && iconPosition.value === Position.before),
16
+ iconPosition?.value === Position.before ? hasIcon.value : undefined,
10
17
  )
11
18
  const hasIconAfter = computed(() =>
12
- Boolean(icon?.value && iconPosition.value === Position.after),
19
+ iconPosition?.value === Position.after ? hasIcon.value : undefined,
13
20
  )
14
21
  const hasIconLeft = computed(() =>
15
- Boolean(icon?.value && iconPosition.value === Side.left),
22
+ iconPosition?.value === Side.left ? hasIcon.value : undefined,
16
23
  )
17
24
  const hasIconRight = computed(() =>
18
- Boolean(icon?.value && iconPosition.value === Side.right),
25
+ iconPosition?.value === Side.right ? hasIcon.value : undefined,
19
26
  )
20
27
  const hasIconTop = computed(() =>
21
- Boolean(icon?.value && iconPosition.value === Side.top),
28
+ iconPosition?.value === Side.top ? hasIcon.value : undefined,
22
29
  )
23
30
  const hasIconBottom = computed(() =>
24
- Boolean(icon?.value && iconPosition.value === Side.bottom),
31
+ iconPosition?.value === Side.bottom ? hasIcon.value : undefined,
25
32
  )
26
- const hasIcon = computed(() => {
27
- if (typeof icon?.value === 'string') {
28
- return { name: icon?.value }
29
- }
30
- return icon?.value
31
- })
32
33
  return {
33
34
  hasIcon,
34
35
  hasIconLeft,
@@ -1,5 +1,5 @@
1
- import { nanoid } from 'nanoid'
1
+ import { uid } from 'uid'
2
2
  import type { Ref } from 'vue'
3
3
 
4
4
  export const useUniqueId = (id?: Ref<string | number | undefined>) =>
5
- computed(() => String(id?.value || nanoid()))
5
+ computed(() => String(id?.value || uid()))
@@ -1,7 +1,4 @@
1
- import tooltip from '../directives/v-tooltip'
2
- import contextmenu from '../directives/v-contextmenu'
1
+ import vTooltip from '../directives/v-tooltip'
2
+ import vContextmenu from '../directives/v-contextmenu'
3
3
 
4
- export default {
5
- tooltip,
6
- contextmenu,
7
- }
4
+ export { vTooltip, vContextmenu }
@@ -1,15 +1,24 @@
1
1
  import { render, type Directive, type DirectiveBinding } from 'vue'
2
2
  import VvTooltip from '../components/VvTooltip/VvTooltip.vue'
3
- import type { Side } from '../constants'
3
+ import { Side } from '../constants'
4
4
 
5
- const tooltip: Directive = {
6
- beforeMount(el: HTMLElement, binding: DirectiveBinding) {
7
- const tooltip = h(VvTooltip, {
8
- value: binding.value,
9
- position: binding.arg as Side,
10
- })
11
- render(tooltip, el)
12
- },
13
- }
5
+ const tooltip: Directive = (() => {
6
+ return {
7
+ beforeMount(el: HTMLElement, binding: DirectiveBinding) {
8
+ const tooltip = h(VvTooltip, {
9
+ value: binding.value,
10
+ position: binding.arg as Side,
11
+ })
12
+ render(tooltip, el)
13
+ },
14
+ updated(el: HTMLElement, binding: DirectiveBinding) {
15
+ const tooltip = h(VvTooltip, {
16
+ value: binding.value,
17
+ position: binding.arg as Side,
18
+ })
19
+ render(tooltip, el)
20
+ },
21
+ }
22
+ })()
14
23
 
15
24
  export default tooltip
package/src/index.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import VolverPlugin from './Volver'
2
- import type { Volver } from './Volver'
2
+ import type { Volver, VolverOptions } from './Volver'
3
3
 
4
4
  export { VolverPlugin }
5
+ export * from './types'
6
+ export type { Volver, VolverOptions }
5
7
 
6
8
  // https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties
7
9
  // Add custom property and extend vue type definition