@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,27 +1,83 @@
1
1
  import type { PropType } from 'vue'
2
- import type { Option } from '@/types/generic'
2
+ import type { Option } from '../types/generic'
3
3
  import type {
4
4
  AutoPlacementOptions,
5
5
  FlipOptions,
6
6
  OffsetOptions,
7
7
  ShiftOptions,
8
8
  SizeOptions,
9
- } from '@/types/floating-ui'
10
- import { Placement, Position, Side } from '@/constants'
9
+ } from '../types/floating-ui'
10
+ import {
11
+ Placement,
12
+ Position,
13
+ Side,
14
+ AnchorTarget,
15
+ ButtonType,
16
+ } from '../constants'
17
+
18
+ export const LinkProps = {
19
+ /**
20
+ * The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
21
+ * @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
22
+ */
23
+ to: {
24
+ type: [String, Object],
25
+ },
26
+ /**
27
+ * Anchor href
28
+ */
29
+ href: String,
30
+ /**
31
+ * Anchor target
32
+ */
33
+ target: {
34
+ type: String as PropType<`${AnchorTarget}`>,
35
+ validator: (value: AnchorTarget) =>
36
+ Object.values(AnchorTarget).includes(value),
37
+ },
38
+ /**
39
+ * Anchor rel
40
+ */
41
+ rel: {
42
+ type: String,
43
+ default: 'noopener noreferrer',
44
+ },
45
+ }
11
46
 
12
47
  export const ValidProps = {
48
+ /**
49
+ * Valid status
50
+ */
13
51
  valid: Boolean,
52
+ /**
53
+ * Valid label
54
+ */
14
55
  validLabel: [String, Array],
15
56
  }
16
57
 
17
58
  export const InvalidProps = {
59
+ /**
60
+ * Invalid status
61
+ */
18
62
  invalid: Boolean,
63
+ /**
64
+ * Invalid label
65
+ */
19
66
  invalidLabel: [String, Array],
20
67
  }
21
68
 
22
69
  export const LoadingProps = {
70
+ /**
71
+ * Loading status
72
+ */
23
73
  loading: Boolean,
24
- loadingLabel: String,
74
+ /**
75
+ * Loading label
76
+ */
77
+ loadingLabel: {
78
+ type: String,
79
+ default: 'Loading...',
80
+ },
25
81
  }
26
82
 
27
83
  export const DisabledProps = {
@@ -31,6 +87,34 @@ export const DisabledProps = {
31
87
  disabled: Boolean,
32
88
  }
33
89
 
90
+ export const SelectedProps = {
91
+ /**
92
+ * Whether the item is selected
93
+ */
94
+ selected: Boolean,
95
+ }
96
+
97
+ export const ActiveProps = {
98
+ /**
99
+ * Whether the item is active
100
+ */
101
+ active: Boolean,
102
+ }
103
+
104
+ export const PressedProps = {
105
+ /**
106
+ * Whether the item is pressed
107
+ */
108
+ pressed: Boolean,
109
+ }
110
+
111
+ export const LabelProps = {
112
+ /**
113
+ * The item label
114
+ */
115
+ label: [String, Number],
116
+ }
117
+
34
118
  export const ReadonlyProps = {
35
119
  /**
36
120
  * The value is not editable
@@ -100,7 +184,7 @@ export const IconProps = {
100
184
  * VvIcon position
101
185
  */
102
186
  iconPosition: {
103
- type: String as PropType<Position>,
187
+ type: String as PropType<`${Position}`>,
104
188
  default: Position.before,
105
189
  validation: (value: Position) =>
106
190
  Object.values(Position).includes(value),
@@ -142,7 +226,7 @@ export const DropdownProps = {
142
226
  * Dropdown placement
143
227
  */
144
228
  placement: {
145
- type: String as PropType<Side | Placement>,
229
+ type: String as PropType<`${Side}` | `${Placement}`>,
146
230
  default: Side.bottom,
147
231
  validator: (value: Side & Placement) => {
148
232
  return (
@@ -271,6 +355,7 @@ export const InputTextareaProps = {
271
355
  ...DebounceProps,
272
356
  ...IconProps,
273
357
  ...FloatingLabelProps,
358
+ ...LabelProps,
274
359
  /**
275
360
  * Input / Textarea minlength
276
361
  * Minimum length (number of characters) of value
@@ -299,10 +384,6 @@ export const InputTextareaProps = {
299
384
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
300
385
  */
301
386
  required: Boolean,
302
- /**
303
- * <label> value for the Input / Textarea
304
- */
305
- label: String,
306
387
  }
307
388
 
308
389
  export const CheckboxRadioProps = {
@@ -314,6 +395,7 @@ export const CheckboxRadioProps = {
314
395
  ...DisabledProps,
315
396
  ...ReadonlyProps,
316
397
  ...ModifiersProps,
398
+ ...LabelProps,
317
399
  /**
318
400
  * Input value
319
401
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
@@ -323,10 +405,6 @@ export const CheckboxRadioProps = {
323
405
  * Input value
324
406
  */
325
407
  modelValue: [Object, Number, Boolean, String],
326
- /**
327
- * <label> for input
328
- */
329
- label: String,
330
408
  }
331
409
 
332
410
  export const CheckboxRadioGroupProps = {
@@ -337,14 +415,11 @@ export const CheckboxRadioGroupProps = {
337
415
  ...DisabledProps,
338
416
  ...ReadonlyProps,
339
417
  ...ModifiersProps,
418
+ ...LabelProps,
340
419
  /**
341
420
  * Input value
342
421
  */
343
- modelValue: [String, Array],
344
- /**
345
- * Input label
346
- */
347
- label: String,
422
+ modelValue: [String, Array, Boolean, Number, Symbol],
348
423
  /**
349
424
  * Input name
350
425
  */
@@ -354,3 +429,20 @@ export const CheckboxRadioGroupProps = {
354
429
  */
355
430
  vertical: Boolean,
356
431
  }
432
+
433
+ export const ActionProps = {
434
+ ...DisabledProps,
435
+ ...LabelProps,
436
+ ...PressedProps,
437
+ ...ActiveProps,
438
+ ...LinkProps,
439
+ /**
440
+ * Button type
441
+ */
442
+ type: {
443
+ type: String as PropType<`${ButtonType}`>,
444
+ default: ButtonType.button,
445
+ validator: (value: ButtonType) =>
446
+ Object.values(ButtonType).includes(value),
447
+ },
448
+ }
@@ -14,39 +14,50 @@ function kebabCase(str: string, options?: { condense: boolean }) {
14
14
  .toLowerCase()
15
15
  }
16
16
 
17
+ type ImportStyle = boolean | 'css' | 'scss'
18
+
17
19
  export interface VolverResolverOptions {
18
20
  /**
19
21
  * import style along with components
20
- *
21
- * @default 'css'
22
+ * @default undefined
22
23
  */
23
- importStyle?: boolean | 'css' | 'scss'
24
+ importStyle?: ImportStyle
24
25
  /**
25
- * import custom style path
26
- *
27
- * @default ''
26
+ * enable/disable directives
27
+ * @default undefined
28
28
  */
29
- customStylePath?: string
29
+ directives?: boolean
30
30
  /**
31
31
  * prefix for components (e.g. 'vv' to resolve Button from VvButton)
32
32
  *
33
33
  * @default 'vv'
34
34
  */
35
35
  prefix?: string
36
+ /**
37
+ * ignore components (kebab-case)
38
+ * @default undefined
39
+ */
40
+ ignore?: string[]
36
41
  }
37
42
 
38
- const STYLE_EXCLUDE = ['vv-icon']
43
+ const STYLE_EXCLUDE = ['vv-icon', 'vv-action']
39
44
  const VOLVER_PREFIX = 'vv'
45
+ const DIRECTIVES = ['v-tooltip']
40
46
 
41
- const getStyleNames = function (kebabName: string) {
47
+ export const getStyleNames = function (kebabName: string) {
42
48
  if (STYLE_EXCLUDE.includes(kebabName)) {
43
49
  return undefined
44
50
  }
45
51
  if (kebabName === 'vv-dropdown') {
46
- return ['vv-dropdown', 'vv-dropdown-action']
52
+ return ['vv-dropdown', 'vv-dropdown-option', 'vv-dropdown-action']
47
53
  }
48
54
  if (kebabName === 'vv-combobox') {
49
- return ['vv-select', 'vv-dropdown', 'vv-dropdown-action']
55
+ return [
56
+ 'vv-select',
57
+ 'vv-dropdown',
58
+ 'vv-dropdown-option',
59
+ 'vv-dropdown-action',
60
+ ]
50
61
  }
51
62
  if (kebabName === 'vv-accordion-group') {
52
63
  return ['vv-accordion-group', 'vv-accordion']
@@ -57,9 +68,34 @@ const getStyleNames = function (kebabName: string) {
57
68
  if (kebabName === 'vv-radio-group') {
58
69
  return ['vv-radio-group', 'vv-radio']
59
70
  }
71
+ if (kebabName === 'v-tooltip') {
72
+ return ['vv-tooltip']
73
+ }
60
74
  return [kebabName]
61
75
  }
62
76
 
77
+ const getSideEffects = function (kebabName: string, importStyle?: ImportStyle) {
78
+ const sideEffects: SideEffectsInfo = []
79
+
80
+ if (!importStyle) {
81
+ return sideEffects
82
+ }
83
+
84
+ // import component style
85
+ const styleNames = getStyleNames(kebabName)
86
+ if (styleNames) {
87
+ styleNames.forEach((name) => {
88
+ sideEffects.push(
89
+ `@volverjs/style/${
90
+ importStyle === 'scss' ? 'scss/' : ''
91
+ }components/${name}`,
92
+ )
93
+ })
94
+ }
95
+
96
+ return sideEffects
97
+ }
98
+
63
99
  /**
64
100
  * Resolver for @volverjs/ui-vue
65
101
  *
@@ -68,48 +104,59 @@ const getStyleNames = function (kebabName: string) {
68
104
  export function VolverResolver({
69
105
  prefix = VOLVER_PREFIX,
70
106
  importStyle,
71
- customStylePath,
72
- }: VolverResolverOptions = {}): ComponentResolver {
73
- return {
74
- type: 'component',
75
- resolve: (name: string) => {
76
- if (
77
- !prefix ||
78
- !name.toLowerCase().startsWith(prefix.toLowerCase())
79
- ) {
80
- return
81
- }
82
-
83
- const sideEffects: SideEffectsInfo = []
84
- const kebabName = kebabCase(name).replace(
85
- `${prefix}-`,
86
- `${VOLVER_PREFIX}-`,
87
- )
107
+ directives,
108
+ ignore,
109
+ }: VolverResolverOptions = {}): ComponentResolver[] {
110
+ return [
111
+ {
112
+ type: 'component',
113
+ resolve: (name: string) => {
114
+ if (
115
+ !prefix ||
116
+ !name.toLowerCase().startsWith(prefix.toLowerCase())
117
+ ) {
118
+ return
119
+ }
120
+ const kebabName = kebabCase(name).replace(
121
+ `${prefix}-`,
122
+ `${VOLVER_PREFIX}-`,
123
+ )
124
+
125
+ if (ignore && ignore.includes(kebabName)) {
126
+ return
127
+ }
128
+
129
+ // import component
130
+ return {
131
+ from: `@volverjs/ui-vue/${kebabName}`,
132
+ sideEffects: getSideEffects(kebabName, importStyle),
133
+ }
134
+ },
135
+ },
136
+ {
137
+ type: 'directive',
138
+ resolve: (name: string) => {
139
+ if (!directives) {
140
+ return
141
+ }
88
142
 
89
- if (importStyle) {
90
- // import custom style
91
- if (customStylePath) {
92
- sideEffects.push(customStylePath)
143
+ const kebabName = `v-${kebabCase(name)}`
144
+
145
+ // filter directive
146
+ if (!DIRECTIVES.includes(kebabName)) {
147
+ return
93
148
  }
94
149
 
95
- // import component style
96
- const styleNames = getStyleNames(kebabName)
97
- if (styleNames) {
98
- styleNames.forEach((name) => {
99
- sideEffects.push(
100
- `@volverjs/style/${
101
- importStyle === 'scss' ? 'scss/' : ''
102
- }components/${name}`,
103
- )
104
- })
150
+ if (ignore && ignore.includes(kebabName)) {
151
+ return
105
152
  }
106
- }
107
153
 
108
- // import component
109
- return {
110
- from: `@volverjs/ui-vue/${kebabName}`,
111
- sideEffects,
112
- }
154
+ // import directive
155
+ return {
156
+ from: `@volverjs/ui-vue/${kebabName}`,
157
+ sideEffects: getSideEffects(kebabName, importStyle),
158
+ }
159
+ },
113
160
  },
114
- }
161
+ ]
115
162
  }
@@ -24,10 +24,10 @@ export const Template = (args, { argTypes }) => ({
24
24
  template: /*html*/ `
25
25
  <vv-accordion data-testId="element" v-bind="args" v-model="open">
26
26
  <template #summary v-if="args.summary"><div v-html="args.summary"></div></template>
27
- <template #details v-if="args.details"><div v-html="args.details"></div></template>
27
+ <template #default v-if="args.default"><div v-html="args.default"></div></template>
28
28
  </vv-accordion>
29
29
  <div class="mt-24">
30
- Open: <span data-testId="value">{{ open }}</span>
30
+ {{ args.not ? 'Closed' : 'Opened'}}: <span data-testId="value">{{ open }}</span>
31
31
  </div>
32
32
  `,
33
33
  })
@@ -37,3 +37,9 @@ export const Template = (args, { argTypes }) => ({
37
37
  {Template.bind()}
38
38
  </Story>
39
39
  </Canvas>
40
+
41
+ <Canvas>
42
+ <Story name="Not" play={defaultTest} args={{ not: true }}>
43
+ {Template.bind()}
44
+ </Story>
45
+ </Canvas>
@@ -9,7 +9,7 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
9
9
  )) as HTMLDetailsElement
10
10
  const summary = element.getElementsByTagName('summary')[0]
11
11
  const content = element.getElementsByClassName(
12
- 'vv-collapse__content',
12
+ 'vv-accordion__content',
13
13
  )[0] as HTMLElement
14
14
 
15
15
  const modifiers =
@@ -30,30 +30,36 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
30
30
  if (args.summary) {
31
31
  const div = document.createElement('div')
32
32
  div.innerHTML = args.summary
33
- expect(summary).toHaveClass('vv-collapse__summary')
33
+ expect(summary).toHaveClass('vv-accordion__summary')
34
34
  expect(summary.innerText).toEqual(div.innerText)
35
35
  } else if (args.title) {
36
- expect(summary).toHaveClass('vv-collapse__summary')
36
+ expect(summary).toHaveClass('vv-accordion__summary')
37
37
  expect(summary.innerText).toEqual(args.title)
38
38
  }
39
39
 
40
40
  // open
41
41
  if (!args.disabled) {
42
- expect(element.open).toBe(false)
43
- expect(element).toBeClicked()
42
+ expect(element.open).toBe(args.not ? true : false)
43
+ expect(summary).toBeClicked()
44
44
  await sleep()
45
- expect(element.open).toBeTruthy()
46
- expect(summary.getAttribute('aria-expanded')).toBe('true')
47
- expect(content.getAttribute('aria-hidden')).toBe('false')
45
+ expect(element.open).toBe(args.not ? false : true)
46
+ expect(summary.getAttribute('aria-expanded')).toBe(
47
+ args.not ? 'false' : 'true',
48
+ )
49
+ expect(content.getAttribute('aria-hidden')).toBe(
50
+ args.not ? 'true' : 'false',
51
+ )
48
52
  }
49
53
 
50
- // details slot / content
51
- if (args.details) {
52
- const div = document.createElement('div')
53
- div.innerHTML = args.details
54
- expect(content.innerText).toEqual(div.innerText)
55
- } else if (args.content) {
56
- expect(content.innerText).toEqual(args.content)
54
+ // default slot / content
55
+ if (element.open) {
56
+ if (args.default) {
57
+ const div = document.createElement('div')
58
+ div.innerHTML = args.default
59
+ expect(content.innerText).toEqual(div.innerText)
60
+ } else if (args.content) {
61
+ expect(content.innerText).toEqual(args.content)
62
+ }
57
63
  }
58
64
 
59
65
  // accessibility
@@ -11,18 +11,18 @@ import { defaultArgs, argTypes } from './Accordion.settings'
11
11
 
12
12
  <Canvas>
13
13
  <Story
14
- name="Summary"
14
+ name="Default"
15
15
  play={defaultTest}
16
16
  args={{
17
- summary: `<strong data-testId="slot" class="font-bold text-brand">Custom Summary</strong>`,
17
+ default: `<strong data-testId="slot" class="font-bold text-brand-darken-1">Custom Details</strong>`,
18
18
  }}
19
19
  argTypes={{
20
- title: {
20
+ content: {
21
21
  control: {
22
22
  disable: true,
23
23
  },
24
24
  },
25
- details: {
25
+ summary: {
26
26
  control: {
27
27
  disable: true,
28
28
  },
@@ -35,18 +35,18 @@ import { defaultArgs, argTypes } from './Accordion.settings'
35
35
 
36
36
  <Canvas>
37
37
  <Story
38
- name="Details"
38
+ name="Summary"
39
39
  play={defaultTest}
40
40
  args={{
41
- details: `<strong data-testId="slot" class="font-bold text-brand">Custom Details</strong>`,
41
+ summary: `<strong data-testId="slot" class="font-bold text-brand-darken-1">Custom Summary</strong>`,
42
42
  }}
43
43
  argTypes={{
44
- content: {
44
+ title: {
45
45
  control: {
46
46
  disable: true,
47
47
  },
48
48
  },
49
- summary: {
49
+ details: {
50
50
  control: {
51
51
  disable: true,
52
52
  },
@@ -24,7 +24,7 @@ export const Template = (args, { argTypes }) => ({
24
24
  template: /*html*/ `
25
25
  <vv-accordion-group data-testId="element" v-bind="args" v-model="selected" />
26
26
  <div class="mt-24">
27
- Selected: <span data-testId="value">{{ selected }}</span>
27
+ {{ args.not ? 'Closed' : 'Opened'}}: <span data-testId="value">{{ selected }}</span>
28
28
  </div>
29
29
  `,
30
30
  })
@@ -35,8 +35,24 @@ export const Template = (args, { argTypes }) => ({
35
35
  </Story>
36
36
  </Canvas>
37
37
 
38
+ <Canvas>
39
+ <Story name="Not" play={defaultTest} args={{ not: true }}>
40
+ {Template.bind()}
41
+ </Story>
42
+ </Canvas>
43
+
38
44
  <Canvas>
39
45
  <Story name="Collapse" play={defaultTest} args={{ collapse: true }}>
40
46
  {Template.bind()}
41
47
  </Story>
42
48
  </Canvas>
49
+
50
+ <Canvas>
51
+ <Story
52
+ name="Collapse Not"
53
+ play={defaultTest}
54
+ args={{ collapse: true, not: true }}
55
+ >
56
+ {Template.bind()}
57
+ </Story>
58
+ </Canvas>
@@ -8,6 +8,7 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
8
8
  'element',
9
9
  )) as HTMLElement
10
10
  const firstChild = element.children[0] as HTMLDetailsElement
11
+ const firstChildSummary = firstChild.getElementsByTagName('summary')[0]
11
12
  const value = (await within(canvasElement).findByTestId(
12
13
  'value',
13
14
  )) as HTMLElement
@@ -28,21 +29,26 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
28
29
 
29
30
  // open
30
31
  if (!args.disabled && args.items && args.items.length > 0) {
31
- expect(firstChild.open).toBe(false)
32
- expect(firstChild).toBeClicked()
32
+ expect(firstChild.open).toBe(args.not ? true : false)
33
+ expect(firstChildSummary).toBeClicked()
33
34
  await sleep()
34
- expect(firstChild.open).toBeTruthy()
35
- if (args.collapse) {
36
- expect(JSON.stringify(JSON.parse(value.innerText))).toBe(
37
- JSON.stringify([args.items[0].name]),
38
- )
39
- } else {
40
- expect(value.innerText).toBe(args.items[0].name)
35
+ expect(firstChild.open).toBe(args.not ? false : true)
36
+ if (firstChild.open) {
37
+ if (args.collapse) {
38
+ expect(JSON.stringify(JSON.parse(value.innerText))).toBe(
39
+ JSON.stringify([args.items[0].name]),
40
+ )
41
+ } else {
42
+ expect(value.innerText).toBe(args.items[0].name)
43
+ }
41
44
  }
42
- const summary = firstChild.firstChild as HTMLElement
45
+ expect(firstChildSummary.getAttribute('aria-expanded')).toBe(
46
+ args.not ? 'false' : 'true',
47
+ )
43
48
  const content = firstChild.lastChild as HTMLElement
44
- expect(summary.getAttribute('aria-expanded')).toBe('true')
45
- expect(content.getAttribute('aria-hidden')).toBe('false')
49
+ expect(content.getAttribute('aria-hidden')).toBe(
50
+ args.not ? 'true' : 'false',
51
+ )
46
52
  }
47
53
 
48
54
  // accessibility
@@ -29,8 +29,9 @@ import { defaultArgs, argTypes } from './AccordionGroup.settings'
29
29
  },
30
30
  }}
31
31
  >
32
- {(args) => {
32
+ {(args, { argTypes }) => {
33
33
  return {
34
+ props: Object.keys(argTypes),
34
35
  components: { VvAccordionGroup, VvAccordion },
35
36
  setup() {
36
37
  return { args }
@@ -49,7 +50,7 @@ import { defaultArgs, argTypes } from './AccordionGroup.settings'
49
50
  <vv-accordion name="a-3" title="Details 3" :content="content" />
50
51
  </vv-accordion-group>
51
52
  <div class="mt-24" >
52
- Selected: <span data-testId="value">{{ selected }}</span>
53
+ Opened: <span data-testId="value">{{ selected }}</span>
53
54
  </div>
54
55
  `,
55
56
  }
@@ -10,7 +10,8 @@ import { defaultArgs, argTypes } from './Breadcrumb.settings'
10
10
  argTypes={argTypes}
11
11
  />
12
12
 
13
- export const Template = (args) => ({
13
+ export const Template = (args, { argTypes }) => ({
14
+ props: Object.keys(argTypes),
14
15
  components: { VvBreadcrumb },
15
16
  setup() {
16
17
  return { args }
@@ -10,15 +10,17 @@ import { argTypes, defaultArgs } from './Button.settings'
10
10
  argTypes={argTypes}
11
11
  />
12
12
 
13
- export const Template = (args) => ({
13
+ export const Template = (args, { argTypes }) => ({
14
+ props: Object.keys(argTypes),
14
15
  data() {
15
16
  return { value: undefined }
16
17
  },
17
18
  setup() {
18
19
  return { args }
19
20
  },
21
+ components: { VvButton },
20
22
  template: /*html*/ `
21
- <vv-button v-bind="args" v-model="value" name="my-button">
23
+ <vv-button v-bind="args" v-model="value" name="my-button" data-testId="element">
22
24
  <template #before v-if="args.before"><div v-html="args.before"></div></template>
23
25
  <template #default v-if="args.default"><div v-html="args.default"></div></template>
24
26
  <template #after v-if="args.after"><div v-html="args.after"></div></template>
@@ -5,7 +5,9 @@ import { expect } from '@/test/expect'
5
5
  export async function defaultTest(
6
6
  { canvasElement, args }: PlayAttributes = {} as PlayAttributes,
7
7
  ) {
8
- const element = await within(canvasElement).findByRole('button')
8
+ const element = (await within(canvasElement).findByTestId(
9
+ 'element',
10
+ )) as HTMLElement
9
11
 
10
12
  const modifiers =
11
13
  !args.modifiers || Array.isArray(args.modifiers)