@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +54 -15
  3. package/auto-imports.d.ts +12 -3
  4. package/bin/icons.cjs +1 -73
  5. package/dist/Volver.d.ts +23 -11
  6. package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
  7. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  8. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  9. package/dist/components/VvAccordion/index.d.ts +8 -3
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  12. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  13. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  14. package/dist/components/VvAction/VvAction.es.js +338 -0
  15. package/dist/components/VvAction/VvAction.umd.js +1 -0
  16. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  17. package/dist/components/VvAction/index.d.ts +24 -0
  18. package/dist/components/VvBadge/VvBadge.es.js +251 -22
  19. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  20. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  21. package/dist/components/VvBadge/index.d.ts +1 -1
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  24. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  25. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  26. package/dist/components/VvButton/VvButton.es.js +720 -261
  27. package/dist/components/VvButton/VvButton.umd.js +1 -1
  28. package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
  29. package/dist/components/VvButton/index.d.ts +30 -75
  30. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
  31. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  32. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  33. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  34. package/dist/components/VvCard/VvCard.es.js +60 -28
  35. package/dist/components/VvCard/VvCard.umd.js +1 -1
  36. package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
  37. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  38. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
  39. package/dist/components/VvCheckbox/index.d.ts +6 -6
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  42. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
  43. package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
  44. package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
  45. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  46. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
  47. package/dist/components/VvCombobox/index.d.ts +54 -23
  48. package/dist/components/VvDialog/VvDialog.es.js +426 -115
  49. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  50. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  51. package/dist/components/VvDialog/index.d.ts +4 -1
  52. package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
  53. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  54. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
  55. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  56. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  57. package/dist/components/VvDropdown/index.d.ts +35 -14
  58. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
  59. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  60. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
  61. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  62. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
  63. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  64. package/dist/components/VvIcon/VvIcon.es.js +116 -52
  65. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  66. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  67. package/dist/components/VvIcon/index.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  69. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  70. package/dist/components/VvInputText/VvInputText.es.js +1054 -376
  71. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  72. package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
  73. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  74. package/dist/components/VvInputText/index.d.ts +67 -3
  75. package/dist/components/VvProgress/VvProgress.es.js +254 -23
  76. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  77. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  78. package/dist/components/VvProgress/index.d.ts +1 -1
  79. package/dist/components/VvRadio/VvRadio.es.js +568 -137
  80. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  81. package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
  82. package/dist/components/VvRadio/index.d.ts +6 -6
  83. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
  84. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  85. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
  86. package/dist/components/VvRadioGroup/index.d.ts +4 -4
  87. package/dist/components/VvSelect/VvSelect.es.js +703 -251
  88. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  89. package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
  90. package/dist/components/VvSelect/index.d.ts +8 -8
  91. package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
  92. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  93. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
  94. package/dist/components/VvTextarea/index.d.ts +7 -7
  95. package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
  96. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  97. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  98. package/dist/components/VvTooltip/index.d.ts +2 -2
  99. package/dist/components/index.es.js +3676 -2007
  100. package/dist/components/index.umd.js +1 -1
  101. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  102. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  103. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  104. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  105. package/dist/composables/useComponentFocus.d.ts +1 -1
  106. package/dist/composables/useComponentIcon.d.ts +7 -7
  107. package/dist/composables/useDebouncedInput.d.ts +4 -1
  108. package/dist/composables/useDefaults.d.ts +2 -0
  109. package/dist/composables/useModifiers.d.ts +1 -1
  110. package/dist/composables/useOptions.d.ts +2 -2
  111. package/dist/composables/useTextCount.d.ts +3 -3
  112. package/dist/composables/useUniqueId.d.ts +1 -1
  113. package/dist/composables/useVolver.d.ts +1 -1
  114. package/dist/constants.d.ts +30 -0
  115. package/dist/directives/index.es.js +288 -0
  116. package/dist/directives/index.umd.js +1 -0
  117. package/dist/directives/v-tooltip.es.js +285 -0
  118. package/dist/directives/v-tooltip.umd.js +1 -0
  119. package/dist/icons.es.js +38 -23
  120. package/dist/icons.umd.js +1 -1
  121. package/dist/index.d.ts +0 -1
  122. package/dist/index.es.js +115 -3269
  123. package/dist/index.umd.js +1 -1
  124. package/dist/props/index.d.ts +215 -23
  125. package/dist/resolvers/unplugin.d.ts +14 -8
  126. package/dist/resolvers/unplugin.es.js +94 -33
  127. package/dist/resolvers/unplugin.umd.js +1 -1
  128. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  129. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  130. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  131. package/dist/stories/argTypes.d.ts +1 -1
  132. package/package.json +167 -63
  133. package/src/Volver.ts +60 -26
  134. package/src/assets/icons/detailed.json +1 -1
  135. package/src/assets/icons/normal.json +1 -1
  136. package/src/assets/icons/simple.json +1 -1
  137. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  138. package/src/components/VvAccordion/index.ts +12 -4
  139. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  140. package/src/components/VvAccordionGroup/index.ts +8 -0
  141. package/src/components/VvAction/VvAction.vue +144 -0
  142. package/src/components/VvAction/index.ts +5 -0
  143. package/src/components/VvBadge/VvBadge.vue +2 -2
  144. package/src/components/VvBadge/index.ts +1 -1
  145. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  146. package/src/components/VvButton/VvButton.vue +41 -124
  147. package/src/components/VvButton/index.ts +16 -88
  148. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  149. package/src/components/VvButtonGroup/index.ts +1 -1
  150. package/src/components/VvCard/VvCard.vue +2 -2
  151. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  152. package/src/components/VvCheckbox/index.ts +11 -7
  153. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  154. package/src/components/VvCheckboxGroup/index.ts +1 -1
  155. package/src/components/VvCombobox/VvCombobox.vue +85 -57
  156. package/src/components/VvCombobox/index.ts +12 -10
  157. package/src/components/VvDialog/VvDialog.vue +28 -11
  158. package/src/components/VvDialog/index.ts +5 -2
  159. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  160. package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
  161. package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
  162. package/src/components/VvDropdown/index.ts +6 -11
  163. package/src/components/VvIcon/VvIcon.vue +3 -3
  164. package/src/components/VvIcon/index.ts +3 -3
  165. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  166. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  167. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  168. package/src/components/VvInputText/VvInputText.vue +128 -35
  169. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  170. package/src/components/VvInputText/index.ts +62 -1
  171. package/src/components/VvProgress/VvProgress.vue +2 -2
  172. package/src/components/VvProgress/index.ts +1 -1
  173. package/src/components/VvRadio/VvRadio.vue +3 -7
  174. package/src/components/VvRadio/index.ts +11 -7
  175. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  176. package/src/components/VvRadioGroup/index.ts +1 -1
  177. package/src/components/VvSelect/VvSelect.vue +4 -4
  178. package/src/components/VvSelect/index.ts +3 -5
  179. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  180. package/src/components/VvTextarea/index.ts +1 -1
  181. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  182. package/src/components/VvTooltip/index.ts +3 -3
  183. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  184. package/src/composables/dropdown/useProvideDropdown.ts +9 -11
  185. package/src/composables/group/useInjectedGroupState.ts +1 -1
  186. package/src/composables/group/useProvideGroupState.ts +1 -1
  187. package/src/composables/useComponentIcon.ts +1 -1
  188. package/src/composables/useDebouncedInput.ts +10 -3
  189. package/src/composables/useDefaults.ts +89 -0
  190. package/src/composables/useModifiers.ts +8 -9
  191. package/src/composables/useOptions.ts +1 -1
  192. package/src/composables/useVolver.ts +2 -2
  193. package/src/constants.ts +36 -0
  194. package/src/directives/index.ts +1 -1
  195. package/src/directives/v-tooltip.ts +2 -2
  196. package/src/index.ts +0 -2
  197. package/src/props/index.ts +111 -19
  198. package/src/resolvers/unplugin.ts +96 -49
  199. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  200. package/src/stories/Accordion/Accordion.test.ts +21 -15
  201. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  202. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  203. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  204. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
  205. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  206. package/src/stories/Button/Button.stories.mdx +4 -2
  207. package/src/stories/Button/Button.test.ts +3 -1
  208. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  209. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  210. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  211. package/src/stories/Card/Card.stories.mdx +2 -1
  212. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  213. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  214. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  215. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  216. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  217. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  218. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  219. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  220. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  221. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  222. package/src/stories/Icon/Icon.stories.mdx +2 -1
  223. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  224. package/src/stories/InputText/InputText.settings.ts +53 -0
  225. package/src/stories/InputText/InputText.stories.mdx +42 -1
  226. package/src/stories/InputText/InputText.test.ts +5 -2
  227. package/src/stories/Progress/Progress.stories.mdx +2 -1
  228. package/src/stories/Radio/Radio.stories.mdx +2 -1
  229. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  230. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  231. package/src/stories/Select/Select.stories.mdx +2 -1
  232. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  233. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  234. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
  235. package/src/stories/argTypes.ts +2 -2
  236. package/src/types/group.d.ts +5 -0
@@ -1,40 +1,22 @@
1
1
  import type { Ref, PropType, ExtractPropTypes } from 'vue'
2
- import type { ButtonGroupState } from '@/types/group'
2
+ import type { ButtonGroupState } from '../../types/group'
3
3
  import {
4
- DisabledProps,
4
+ ActionProps,
5
5
  IdProps,
6
+ LoadingProps,
6
7
  ModifiersProps,
7
8
  UnselectableProps,
8
- } from '@/props'
9
- import { INJECTION_KEY_BUTTON_GROUP, Side } from '@/constants'
10
-
11
- export enum ButtonType {
12
- button = 'button',
13
- submit = 'submit',
14
- reset = 'reset',
15
- }
16
-
17
- export enum ButtonTag {
18
- nuxtLink = 'nuxt-link',
19
- routerLink = 'router-link',
20
- a = 'a',
21
- button = 'button',
22
- }
23
-
24
- export enum ButtonTarget {
25
- _blank = '_blank',
26
- _self = '_self',
27
- _parent = '_parent',
28
- _top = '_top',
29
- }
9
+ } from '../../props'
10
+ import { INJECTION_KEY_BUTTON_GROUP, Side } from '../../constants'
30
11
 
31
12
  export const VvButtonEvents = ['update:modelValue']
32
13
 
33
14
  export const VvButtonProps = {
15
+ ...ActionProps,
34
16
  ...IdProps,
35
17
  ...ModifiersProps,
36
- ...DisabledProps,
37
18
  ...UnselectableProps,
19
+ ...LoadingProps,
38
20
  /**
39
21
  * Button icon
40
22
  */
@@ -43,69 +25,14 @@ export const VvButtonProps = {
43
25
  * Button icon position
44
26
  */
45
27
  iconPosition: {
46
- type: String as PropType<Side>,
28
+ type: String as PropType<`${Side}`>,
47
29
  default: Side.left,
48
30
  validator: (value: Side) => Object.values(Side).includes(value),
49
31
  },
50
- /**
51
- * Button label
52
- */
53
- label: [String, Number],
54
- /**
55
- * Loading status
56
- */
57
- loading: Boolean,
58
32
  /**
59
33
  * Loading icon
60
34
  */
61
35
  loadingIcon: { type: String, default: 'eos-icons:bubble-loading' },
62
- /**
63
- * Loading label
64
- */
65
- loadingLabel: {
66
- type: String,
67
- default: 'Loading...',
68
- },
69
- /**
70
- * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
71
- * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
72
- */
73
- to: {
74
- type: [String, Object],
75
- },
76
- /**
77
- * Link href
78
- */
79
- href: String,
80
- /**
81
- * Link target
82
- */
83
- target: {
84
- type: String as PropType<ButtonTarget>,
85
- validator: (value: ButtonTarget) =>
86
- Object.values(ButtonTarget).includes(value),
87
- },
88
- active: Boolean,
89
- /**
90
- * Button pressed mode
91
- */
92
- pressed: Boolean,
93
- /**
94
- * Link rel
95
- */
96
- rel: {
97
- type: String,
98
- default: 'noopener noreferrer',
99
- },
100
- /**
101
- * Button type
102
- */
103
- type: {
104
- type: String,
105
- default: ButtonType.button,
106
- validator: (value: ButtonType) =>
107
- Object.values(ButtonType).includes(value),
108
- },
109
36
  toggle: {
110
37
  type: Boolean,
111
38
  default: false,
@@ -139,40 +66,41 @@ export function useGroupProps(
139
66
  const modelValue = getGroupOrLocalRef('modelValue', props, emit) as Ref<
140
67
  string | Array<string> | undefined
141
68
  >
142
- const disabled = getGroupOrLocalRef('disabled', props) as Ref<boolean>
143
69
  const toggle = getGroupOrLocalRef('toggle', props) as Ref<boolean>
144
70
  const unselectable = getGroupOrLocalRef(
145
71
  'unselectable',
146
72
  props,
147
73
  ) as Ref<boolean>
148
- const multiple = group?.value?.multiple ?? ref(false)
149
-
74
+ const multiple = computed(() => group?.value.multiple.value ?? false)
150
75
  const modifiers = computed(() => {
151
76
  const localValue = localModifiers?.value
152
77
  ? Array.isArray(localModifiers.value)
153
78
  ? localModifiers.value
154
- : [localModifiers.value]
79
+ : localModifiers.value.split(' ')
155
80
  : []
156
81
  const groupValue = group?.value.itemModifiers?.value
157
82
  ? Array.isArray(group.value.itemModifiers.value)
158
83
  ? group.value.itemModifiers.value
159
- : [group.value.itemModifiers.value]
84
+ : group.value.itemModifiers.value.split(' ')
160
85
  : []
161
86
  return [...localValue, ...groupValue]
162
87
  })
88
+ const disabled = computed(() =>
89
+ Boolean(props.disabled || group?.value?.disabled.value),
90
+ )
163
91
 
164
92
  return {
165
93
  // group props
166
94
  group,
167
95
  isInGroup,
168
96
  modelValue,
169
- disabled,
170
97
  toggle,
171
98
  unselectable,
172
99
  multiple,
100
+ modifiers,
101
+ disabled,
173
102
  // local props
174
103
  id,
175
- modifiers,
176
104
  pressed,
177
105
  iconPosition,
178
106
  icon,
@@ -5,12 +5,9 @@
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import type { ButtonGroupState } from '@/types/group'
9
- import { INJECTION_KEY_BUTTON_GROUP } from '@/constants'
10
- import {
11
- VvButtonGroupProps,
12
- VvButtonGroupEvents,
13
- } from '@/components/VvButtonGroup'
8
+ import type { ButtonGroupState } from '../../types/group'
9
+ import { INJECTION_KEY_BUTTON_GROUP } from '../../constants'
10
+ import { VvButtonGroupProps, VvButtonGroupEvents } from '.'
14
11
 
15
12
  // emit and props
16
13
  const emit = defineEmits(VvButtonGroupEvents)
@@ -66,7 +63,7 @@
66
63
  })
67
64
 
68
65
  // style
69
- const bemCssClasses = useBemModifiers('vv-button-group', modifiers)
66
+ const bemCssClasses = useModifiers('vv-button-group', modifiers)
70
67
  </script>
71
68
 
72
69
  <template>
@@ -1,4 +1,4 @@
1
- import { DisabledProps, ModifiersProps, UnselectableProps } from '@/props'
1
+ import { DisabledProps, ModifiersProps, UnselectableProps } from '../../props'
2
2
 
3
3
  export const VvButtonGroupProps = {
4
4
  ...ModifiersProps,
@@ -5,14 +5,14 @@
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import { VvCardProps } from '@/components/VvCard'
8
+ import { VvCardProps } from '.'
9
9
 
10
10
  // props and attrs
11
11
  const props = defineProps(VvCardProps)
12
12
 
13
13
  // styles
14
14
  const { modifiers } = toRefs(props)
15
- const bemCssClasses = useBemModifiers('vv-card', modifiers)
15
+ const bemCssClasses = useModifiers('vv-card', modifiers)
16
16
  </script>
17
17
 
18
18
  <template>
@@ -5,12 +5,8 @@
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import {
9
- VvCheckboxProps,
10
- VvCheckboxEvents,
11
- useGroupProps,
12
- } from '@/components/VvCheckbox'
13
- import { HintSlotFactory } from '@/components/common/HintSlot'
8
+ import { VvCheckboxProps, VvCheckboxEvents, useGroupProps } from '.'
9
+ import { HintSlotFactory } from '../common/HintSlot'
14
10
 
15
11
  // props, emits and slots
16
12
  const props = defineProps(VvCheckboxProps)
@@ -108,7 +104,7 @@
108
104
 
109
105
  // styles
110
106
  const { modifiers } = toRefs(props)
111
- const bemCssClasses = useBemModifiers(
107
+ const bemCssClasses = useModifiers(
112
108
  'vv-checkbox',
113
109
  modifiers,
114
110
  computed(() => ({
@@ -1,7 +1,7 @@
1
1
  import type { ExtractPropTypes, Ref } from 'vue'
2
- import type { InputGroupState } from '@/types/group'
3
- import { CheckboxRadioProps, ModifiersProps } from '@/props'
4
- import { INJECTION_KEY_CHECK_GROUP } from '@/constants'
2
+ import type { InputGroupState } from '../../types/group'
3
+ import { CheckboxRadioProps, ModifiersProps } from '../../props'
4
+ import { INJECTION_KEY_CHECK_GROUP } from '../../constants'
5
5
 
6
6
  export const VvCheckboxProps = {
7
7
  ...CheckboxRadioProps,
@@ -39,10 +39,14 @@ export function useGroupProps(
39
39
 
40
40
  // global props
41
41
  const modelValue = getGroupOrLocalRef('modelValue', props, emit)
42
- const readonly = getGroupOrLocalRef('readonly', props) as Ref<boolean>
43
- const disabled = getGroupOrLocalRef('disabled', props) as Ref<boolean>
44
42
  const valid = getGroupOrLocalRef('valid', props) as Ref<boolean>
45
43
  const invalid = getGroupOrLocalRef('invalid', props) as Ref<boolean>
44
+ const readonly = computed(() =>
45
+ Boolean(props.readonly || group?.value?.disabled.value),
46
+ )
47
+ const disabled = computed(() =>
48
+ Boolean(props.disabled || group?.value?.disabled.value),
49
+ )
46
50
 
47
51
  return {
48
52
  // local props
@@ -53,9 +57,9 @@ export function useGroupProps(
53
57
  group,
54
58
  isInGroup,
55
59
  modelValue,
56
- readonly,
57
- disabled,
58
60
  valid,
59
61
  invalid,
62
+ readonly,
63
+ disabled,
60
64
  }
61
65
  }
@@ -5,15 +5,12 @@
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import type { Option } from '@/types/generic'
9
- import type { InputGroupState } from '@/types/group'
10
- import { INJECTION_KEY_CHECK_GROUP } from '@/constants'
11
- import { HintSlotFactory } from '@/components/common/HintSlot'
12
- import VvCheckbox from '@/components/VvCheckbox/VvCheckbox.vue'
13
- import {
14
- VvCheckboxGroupProps,
15
- VvCheckboxGroupEvents,
16
- } from '@/components/VvCheckboxGroup'
8
+ import type { Option } from '../../types/generic'
9
+ import type { InputGroupState } from '../../types/group'
10
+ import { INJECTION_KEY_CHECK_GROUP } from '../../constants'
11
+ import { HintSlotFactory } from '../common/HintSlot'
12
+ import VvCheckbox from '../VvCheckbox/VvCheckbox.vue'
13
+ import { VvCheckboxGroupProps, VvCheckboxGroupEvents } from '.'
17
14
 
18
15
  // props, emit and slots
19
16
  const props = defineProps(VvCheckboxGroupProps)
@@ -38,7 +35,7 @@
38
35
  const { getOptionLabel, getOptionValue } = useOptions(props)
39
36
 
40
37
  // stypes
41
- const bemCssClasses = useBemModifiers(
38
+ const bemCssClasses = useModifiers(
42
39
  'vv-checkbox-group',
43
40
  modifiers,
44
41
  computed(() => ({
@@ -1,4 +1,4 @@
1
- import { CheckboxRadioGroupProps } from '@/props'
1
+ import { CheckboxRadioGroupProps } from '../../props'
2
2
 
3
3
  export const VvCheckboxGroupProps = CheckboxRadioGroupProps
4
4
 
@@ -1,26 +1,34 @@
1
1
  <script lang="ts">
2
2
  export default {
3
3
  name: 'VvCombobox',
4
- components: { VvDropdown, VvDropdownItem },
4
+ components: { VvDropdown, VvDropdownOption },
5
5
  }
6
6
  </script>
7
7
 
8
8
  <script setup lang="ts">
9
9
  import type { Ref } from 'vue'
10
- import { VvComboboxProps, VvComboboxEvents } from '@/components/VvCombobox'
11
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
12
- import VvDropdown from '@/components/VvDropdown/VvDropdown.vue'
13
- import VvDropdownItem from '@/components/VvDropdown/VvDropdownItem.vue'
14
- import VvSelect from '@/components/VvSelect/VvSelect.vue'
15
- import VvBadge from '@/components/VvBadge/VvBadge.vue'
16
- import HintSlotFactory from '@/components/common/HintSlot'
17
- import type { Option } from '@/types/generic'
10
+ import { VvComboboxProps, VvComboboxEvents } from '.'
11
+ import VvIcon from '../VvIcon/VvIcon.vue'
12
+ import VvDropdown from '../VvDropdown/VvDropdown.vue'
13
+ import VvDropdownOption from '../VvDropdown/VvDropdownOption.vue'
14
+ import VvSelect from '../VvSelect/VvSelect.vue'
15
+ import VvBadge from '../VvBadge/VvBadge.vue'
16
+ import HintSlotFactory from '../common/HintSlot'
17
+ import type { Option } from '../../types/generic'
18
+ import { DropdownRole } from '../../constants'
18
19
 
19
20
  // props, emit and slots
20
21
  const props = defineProps(VvComboboxProps)
21
22
  const emit = defineEmits(VvComboboxEvents)
22
23
  const slots = useSlots()
23
24
 
25
+ // props merged with volver defaults (now only for labels)
26
+ const propsDefaults = useDefaults<typeof VvComboboxProps>(
27
+ 'VvCombobox',
28
+ VvComboboxProps,
29
+ props,
30
+ )
31
+
24
32
  // hint slot
25
33
  const { HintSlot } = HintSlotFactory(props, slots)
26
34
 
@@ -125,7 +133,7 @@
125
133
  })
126
134
 
127
135
  // styles
128
- const bemCssClasses = useBemModifiers(
136
+ const bemCssClasses = useModifiers(
129
137
  'vv-select',
130
138
  modifiers,
131
139
  computed(() => ({
@@ -245,8 +253,13 @@
245
253
  } else {
246
254
  toReturn = [value as Option]
247
255
  }
248
- } else if (props.unselectable && value === props.modelValue) {
249
- toReturn = undefined
256
+ } else {
257
+ if (props.autoClose) {
258
+ collapse()
259
+ }
260
+ if (props.unselectable && value === props.modelValue) {
261
+ toReturn = undefined
262
+ }
250
263
  }
251
264
  emit('update:modelValue', toReturn)
252
265
  }
@@ -256,12 +269,12 @@
256
269
  name: props.name,
257
270
  tabindex: hasTabindex.value,
258
271
  valid: valid.value,
259
- validLabel: props.validLabel,
272
+ validLabel: propsDefaults.value.validLabel,
260
273
  invalid: invalid.value,
261
- invalidLabel: props.invalidLabel,
262
- hintLabel: props.hintLabel,
274
+ invalidLabel: propsDefaults.value.invalidLabel,
275
+ hintLabel: propsDefaults.value.hintLabel,
263
276
  loading: loading.value,
264
- loadingLabel: props.loadingLabel,
277
+ loadingLabel: propsDefaults.value.loadingLabel,
265
278
  disabled: disabled.value,
266
279
  readonly: readonly.value,
267
280
  modifiers: props.modifiers,
@@ -327,9 +340,14 @@
327
340
  <VvDropdown
328
341
  v-model="expanded"
329
342
  v-bind="dropdownProps"
330
- role="listbox"
343
+ :role="DropdownRole.listbox"
331
344
  >
332
- <template v-if="searchable" #before>
345
+ <template
346
+ v-if="searchable || $slots['dropdown::before']"
347
+ #before
348
+ >
349
+ <!-- @slot Slot before dropdown items -->
350
+ <slot name="dropdown::before" />
333
351
  <input
334
352
  v-if="searchable"
335
353
  v-show="expanded"
@@ -344,7 +362,7 @@
344
362
  spellcheck="false"
345
363
  type="search"
346
364
  class="vv-dropdown__search"
347
- :placeholder="searchPlaceholder"
365
+ :placeholder="propsDefaults.searchPlaceholder"
348
366
  />
349
367
  </template>
350
368
  <template #default="{ aria }">
@@ -392,7 +410,9 @@
392
410
  !readonly &&
393
411
  !disabled
394
412
  "
395
- :aria-label="deselectLabel"
413
+ :aria-label="
414
+ propsDefaults.deselectActionLabel
415
+ "
396
416
  @click.stop="onInput(option)"
397
417
  >
398
418
  <VvIcon name="close" />
@@ -416,48 +436,56 @@
416
436
  </div>
417
437
  </template>
418
438
  <template #items>
419
- <VvDropdownItem
420
- v-for="(option, index) in filteredOptions"
421
- :key="index"
422
- class="vv-dropdown-action"
423
- :tabindex="getOptionDisabled(option) ? -1 : 0"
424
- :class="{
425
- disabled: getOptionDisabled(option),
426
- selected: getOptionSelected(option),
427
- 'vv-dropdown-action--unselectable':
428
- unselectable && getOptionSelected(option),
429
- }"
430
- :aria-selected="getOptionSelected(option)"
431
- :aria-disabled="getOptionDisabled(option)"
432
- @click.passive="onInput(option)"
433
- >
434
- <!-- @slot Slot for option customization -->
435
- <slot
436
- name="option"
439
+ <template v-if="filteredOptions.length">
440
+ <VvDropdownOption
441
+ v-for="(option, index) in filteredOptions"
437
442
  v-bind="{
438
- option,
439
- selectedOptions,
440
- selected: getOptionSelected(option),
441
443
  disabled: getOptionDisabled(option),
444
+ selected: getOptionSelected(option),
445
+ unselectable,
446
+ deselectHintLabel:
447
+ propsDefaults.deselectHintLabel,
448
+ selectHintLabel: propsDefaults.selectHintLabel,
449
+ selectedHintLabel:
450
+ propsDefaults.selectedHintLabel,
442
451
  }"
452
+ :key="index"
453
+ class="vv-dropdown-option"
454
+ @click.passive="onInput(option)"
443
455
  >
444
- {{ getOptionLabel(option) }}
445
- <span class="vv-dropdown-action__hint">
446
- <template v-if="getOptionSelected(option)">
447
- {{
448
- unselectable
449
- ? pressToDeselectLabel
450
- : selectedLabel
451
- }}
452
- </template>
453
- <template
454
- v-else-if="!getOptionDisabled(option)"
455
- >
456
- {{ pressToSelectLabel }}
457
- </template>
458
- </span>
456
+ <!-- @slot Slot for option customization -->
457
+ <slot
458
+ name="option"
459
+ v-bind="{
460
+ option,
461
+ selectedOptions,
462
+ selected: getOptionSelected(option),
463
+ disabled: getOptionDisabled(option),
464
+ }"
465
+ >
466
+ {{ getOptionLabel(option) }}
467
+ </slot>
468
+ </VvDropdownOption>
469
+ </template>
470
+ <VvDropdownOption
471
+ v-else-if="!options.length"
472
+ modifiers="inert"
473
+ >
474
+ <!-- @slot Slot for no options available -->
475
+ <slot name="no-options">
476
+ {{ propsDefaults.noOptionsLabel }}
459
477
  </slot>
460
- </VvDropdownItem>
478
+ </VvDropdownOption>
479
+ <VvDropdownOption v-else modifiers="inert">
480
+ <!-- @slot Slot for no results available -->
481
+ <slot name="no-results">
482
+ {{ propsDefaults.noResultsLabel }}
483
+ </slot>
484
+ </VvDropdownOption>
485
+ </template>
486
+ <template v-if="$slots['dropdown::after']" #after>
487
+ <!-- @slot Slot after dropdown items -->
488
+ <slot name="dropdown::after" />
461
489
  </template>
462
490
  </VvDropdown>
463
491
  </div>
@@ -14,7 +14,8 @@ import {
14
14
  UnselectableProps,
15
15
  IdNameProps,
16
16
  DropdownProps,
17
- } from '@/props'
17
+ LabelProps,
18
+ } from '../../props'
18
19
 
19
20
  export const VvComboboxEvents = [
20
21
  'update:modelValue',
@@ -38,6 +39,7 @@ export const VvComboboxProps = {
38
39
  ...FloatingLabelProps,
39
40
  ...UnselectableProps,
40
41
  ...DropdownProps,
42
+ ...LabelProps,
41
43
  /**
42
44
  * modelValue can be a string, number, boolean, object or array of string, number, boolean, object
43
45
  */
@@ -45,30 +47,30 @@ export const VvComboboxProps = {
45
47
  type: [String, Number, Boolean, Object, Array],
46
48
  default: undefined,
47
49
  },
48
- /**
49
- * Select input label
50
- */
51
- label: String,
52
50
  /**
53
51
  * Label for no search results
54
52
  */
55
53
  noResultsLabel: { type: String, default: 'No results' },
54
+ /**
55
+ * Label for no options available
56
+ */
57
+ noOptionsLabel: { type: String, default: 'No options available' },
56
58
  /**
57
59
  * Label for selected option hint
58
60
  */
59
- selectedLabel: { type: String, default: 'Selected' },
61
+ selectedHintLabel: { type: String, default: 'Selected' },
60
62
  /**
61
- * Label for deselect button
63
+ * Label for deselect action button
62
64
  */
63
- deselectLabel: { type: String, default: 'Deselect' },
65
+ deselectActionLabel: { type: String, default: 'Deselect' },
64
66
  /**
65
67
  * Label for select option hint
66
68
  */
67
- pressToSelectLabel: { type: String, default: 'Press enter to select' },
69
+ selectHintLabel: { type: String, default: 'Press enter to select' },
68
70
  /**
69
71
  * Label for deselected option hint
70
72
  */
71
- pressToDeselectLabel: { type: String, default: 'Press enter to remove' },
73
+ deselectHintLabel: { type: String, default: 'Press enter to remove' },
72
74
  /**
73
75
  * Select input placeholder
74
76
  */
@@ -6,15 +6,26 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import type { DialogHTMLAttributes } from 'vue'
9
- import VvIcon from '@/components/VvIcon/VvIcon.vue'
10
- import { VvDialogEvents, VvDialogProps } from '@/components/VvDialog'
9
+ import VvIcon from '../VvIcon/VvIcon.vue'
10
+ import { VvDialogEvents, VvDialogProps } from '.'
11
11
 
12
- // props, emit
12
+ // props and emit
13
13
  const props = defineProps(VvDialogProps)
14
14
  const emit = defineEmits(VvDialogEvents)
15
15
 
16
16
  // data
17
- const isVisible = useVModel(props, 'modelValue', emit)
17
+ const localModelValue = ref(false)
18
+ const modelValue = computed({
19
+ get() {
20
+ return props.modelValue ?? localModelValue.value
21
+ },
22
+ set(value) {
23
+ if (props.modelValue === undefined) {
24
+ localModelValue.value = value
25
+ }
26
+ emit('update:modelValue', value)
27
+ },
28
+ })
18
29
  const htmlAttrIsOpen = ref(true)
19
30
 
20
31
  // template ref
@@ -51,26 +62,32 @@
51
62
  // methods
52
63
  onClickOutside(modalWrapper, () => {
53
64
  if (props.autoClose) {
54
- isVisible.value = false
65
+ modelValue.value = false
55
66
  }
56
67
  })
57
68
 
58
- function closeDialog() {
59
- isVisible.value = false
69
+ function close() {
70
+ modelValue.value = false
60
71
  }
61
72
 
73
+ function open() {
74
+ modelValue.value = true
75
+ }
76
+
77
+ defineExpose({ close, open })
78
+
62
79
  // keyboard
63
80
  onKeyStroke('Escape', (e) => {
64
- if (isVisible.value) {
81
+ if (modelValue.value) {
65
82
  e.preventDefault()
66
- closeDialog()
83
+ close()
67
84
  }
68
85
  })
69
86
  </script>
70
87
 
71
88
  <template>
72
89
  <Transition :name="transitioName" v-on="dialogTransitionHandlers">
73
- <dialog v-show="isVisible" v-bind="dialogAttrs" :class="dialogClass">
90
+ <dialog v-show="modelValue" v-bind="dialogAttrs" :class="dialogClass">
74
91
  <article ref="modalWrapper" class="vv-dialog__wrapper">
75
92
  <header v-if="$slots.header || title" class="vv-dialog__header">
76
93
  <!-- @slot Header slot -->
@@ -80,7 +97,7 @@
80
97
  type="button"
81
98
  aria-label="Close"
82
99
  class="vv-dialog__close"
83
- @click.passive="closeDialog"
100
+ @click.passive="close"
84
101
  >
85
102
  <VvIcon name="close" />
86
103
  </button>