@volverjs/ui-vue 0.0.3 → 0.0.4

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 (145) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +52 -13
  3. package/dist/Volver.d.ts +5 -1
  4. package/dist/components/VvAccordion/VvAccordion.es.js +113 -66
  5. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +159 -101
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  8. package/dist/components/VvAction/VvAction.es.js +170 -0
  9. package/dist/components/VvAction/VvAction.umd.js +1 -0
  10. package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
  11. package/dist/components/VvAction/index.d.ts +24 -0
  12. package/dist/components/VvBadge/VvBadge.es.js +86 -16
  13. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  14. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +97 -41
  15. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.es.js +434 -251
  17. package/dist/components/VvButton/VvButton.umd.js +1 -1
  18. package/dist/components/VvButton/VvButton.vue.d.ts +50 -50
  19. package/dist/components/VvButton/index.d.ts +22 -67
  20. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +118 -43
  21. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  22. package/dist/components/VvCard/VvCard.es.js +38 -25
  23. package/dist/components/VvCard/VvCard.umd.js +1 -1
  24. package/dist/components/VvCheckbox/VvCheckbox.es.js +334 -154
  25. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  26. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  27. package/dist/components/VvCheckbox/index.d.ts +1 -1
  28. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +401 -204
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  30. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
  31. package/dist/components/VvCheckboxGroup/index.d.ts +1 -1
  32. package/dist/components/VvCombobox/VvCombobox.es.js +950 -594
  33. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  34. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +54 -30
  35. package/dist/components/VvCombobox/index.d.ts +18 -13
  36. package/dist/components/VvDialog/VvDialog.es.js +139 -64
  37. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  38. package/dist/components/VvDropdown/VvDropdown.es.js +276 -158
  39. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  40. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +9 -9
  41. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
  42. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
  43. package/dist/components/VvDropdown/index.d.ts +6 -9
  44. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +251 -0
  45. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
  46. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +30 -15
  47. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  48. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +176 -0
  49. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
  50. package/dist/components/VvIcon/VvIcon.es.js +48 -32
  51. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  52. package/dist/components/VvInputText/VvInputText.es.js +508 -344
  53. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  54. package/dist/components/VvInputText/VvInputText.vue.d.ts +11 -4
  55. package/dist/components/VvInputText/index.d.ts +13 -2
  56. package/dist/components/VvProgress/VvProgress.es.js +90 -20
  57. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  58. package/dist/components/VvRadio/VvRadio.es.js +305 -125
  59. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  60. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  61. package/dist/components/VvRadio/index.d.ts +1 -1
  62. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +372 -175
  63. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  64. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
  65. package/dist/components/VvRadioGroup/index.d.ts +1 -1
  66. package/dist/components/VvSelect/VvSelect.es.js +371 -216
  67. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  68. package/dist/components/VvSelect/VvSelect.vue.d.ts +11 -4
  69. package/dist/components/VvSelect/index.d.ts +5 -5
  70. package/dist/components/VvTextarea/VvTextarea.es.js +408 -244
  71. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  72. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +11 -4
  73. package/dist/components/VvTextarea/index.d.ts +5 -5
  74. package/dist/components/VvTooltip/VvTooltip.es.js +88 -18
  75. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  76. package/dist/components/index.es.js +1913 -1521
  77. package/dist/components/index.umd.js +1 -1
  78. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  79. package/dist/composables/dropdown/useProvideDropdown.d.ts +2 -2
  80. package/dist/constants.d.ts +30 -0
  81. package/dist/directives/index.es.js +128 -0
  82. package/dist/directives/index.umd.js +1 -0
  83. package/dist/directives/v-tooltip.es.js +126 -0
  84. package/dist/directives/v-tooltip.umd.js +1 -0
  85. package/dist/icons.es.js +3 -3
  86. package/dist/icons.umd.js +1 -1
  87. package/dist/index.es.js +2102 -1761
  88. package/dist/index.umd.js +1 -1
  89. package/dist/props/index.d.ts +179 -11
  90. package/dist/resolvers/unplugin.d.ts +8 -8
  91. package/dist/resolvers/unplugin.es.js +51 -30
  92. package/dist/resolvers/unplugin.umd.js +1 -1
  93. package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
  94. package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
  95. package/package.json +60 -34
  96. package/src/Volver.ts +12 -5
  97. package/src/assets/icons/detailed.json +1 -1
  98. package/src/assets/icons/normal.json +1 -1
  99. package/src/assets/icons/simple.json +1 -1
  100. package/src/components/VvAction/VvAction.vue +144 -0
  101. package/src/components/VvAction/index.ts +5 -0
  102. package/src/components/VvButton/VvButton.vue +31 -114
  103. package/src/components/VvButton/index.ts +6 -79
  104. package/src/components/VvCombobox/VvCombobox.vue +54 -42
  105. package/src/components/VvCombobox/index.ts +11 -9
  106. package/src/components/VvDropdown/VvDropdownAction.vue +44 -0
  107. package/src/components/VvDropdown/VvDropdownOption.vue +65 -0
  108. package/src/components/VvDropdown/index.ts +4 -9
  109. package/src/components/VvSelect/index.ts +2 -4
  110. package/src/composables/dropdown/useInjectDropdown.ts +1 -1
  111. package/src/composables/dropdown/useProvideDropdown.ts +7 -9
  112. package/src/composables/useModifiers.ts +4 -7
  113. package/src/constants.ts +36 -0
  114. package/src/props/index.ts +106 -14
  115. package/src/resolvers/unplugin.ts +81 -48
  116. package/src/stories/Accordion/AccordionSlots.stories.mdx +2 -2
  117. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +2 -1
  118. package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
  119. package/src/stories/Button/Button.stories.mdx +4 -2
  120. package/src/stories/Button/Button.test.ts +3 -1
  121. package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
  122. package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
  123. package/src/stories/Button/ButtonState.stories.mdx +2 -11
  124. package/src/stories/Card/Card.stories.mdx +2 -1
  125. package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
  126. package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
  127. package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
  128. package/src/stories/Combobox/Combobox.settings.ts +44 -0
  129. package/src/stories/Combobox/Combobox.stories.mdx +40 -1
  130. package/src/stories/Dialog/Dialog.stories.mdx +2 -1
  131. package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
  132. package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
  133. package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
  134. package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
  135. package/src/stories/Icon/Icon.stories.mdx +2 -1
  136. package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
  137. package/src/stories/InputText/InputText.stories.mdx +2 -1
  138. package/src/stories/Progress/Progress.stories.mdx +2 -1
  139. package/src/stories/Radio/Radio.stories.mdx +2 -1
  140. package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
  141. package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
  142. package/src/stories/Select/Select.stories.mdx +2 -1
  143. package/src/stories/Textarea/Textarea.stories.mdx +2 -1
  144. package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
  145. package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'VvDropdownAction',
4
+ }
5
+ </script>
6
+
7
+ <script setup lang="ts">
8
+ import VvAction from '@/components/VvAction/VvAction.vue'
9
+ import VvDropdownItem from '@/components/VvDropdown/VvDropdownItem.vue'
10
+ import { ActionProps, ModifiersProps } from '@/props'
11
+
12
+ // props
13
+ const props = defineProps({
14
+ ...ActionProps,
15
+ ...ModifiersProps,
16
+ })
17
+
18
+ /**
19
+ * @description Define component classes with BEM style.
20
+ * @returns {Array} The component classes.
21
+ */
22
+ const { modifiers } = toRefs(props)
23
+ const bemCssClasses = useBemModifiers('vv-dropdown-action', modifiers)
24
+ </script>
25
+
26
+ <template>
27
+ <VvDropdownItem>
28
+ <VvAction
29
+ v-bind="{
30
+ disabled,
31
+ pressed,
32
+ active,
33
+ type,
34
+ to,
35
+ href,
36
+ target,
37
+ rel,
38
+ }"
39
+ :class="bemCssClasses"
40
+ >
41
+ <slot />
42
+ </VvAction>
43
+ </VvDropdownItem>
44
+ </template>
@@ -0,0 +1,65 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'VvDropdownOption',
4
+ }
5
+ </script>
6
+
7
+ <script setup lang="ts">
8
+ import VvDropdownItem from '@/components/VvDropdown/VvDropdownItem.vue'
9
+ import {
10
+ DisabledProps,
11
+ ModifiersProps,
12
+ SelectedProps,
13
+ UnselectableProps,
14
+ } from '@/props'
15
+
16
+ // props
17
+ const props = defineProps({
18
+ ...DisabledProps,
19
+ ...SelectedProps,
20
+ ...UnselectableProps,
21
+ ...ModifiersProps,
22
+ deselectHintLabel: {
23
+ type: String,
24
+ },
25
+ selectHintLabel: {
26
+ type: String,
27
+ },
28
+ selectedHintLabel: {
29
+ type: String,
30
+ },
31
+ })
32
+
33
+ // style
34
+ const { modifiers } = toRefs(props)
35
+ const bemCssClasses = useBemModifiers(
36
+ 'vv-dropdown-option',
37
+ modifiers,
38
+ computed(() => ({
39
+ disabled: props.disabled,
40
+ selected: props.selected,
41
+ unselectable: props.unselectable && props.selected,
42
+ })),
43
+ )
44
+ </script>
45
+
46
+ <template>
47
+ <VvDropdownItem
48
+ :class="bemCssClasses"
49
+ :tabindex="disabled ? -1 : 0"
50
+ :aria-selected="selected"
51
+ :aria-disabled="disabled"
52
+ >
53
+ <slot />
54
+ <span class="vv-dropdown-option__hint">
55
+ <slot name="hint" v-bind="{ disabled, selected, unselectable }">
56
+ <template v-if="selected">
57
+ {{ unselectable ? deselectHintLabel : selectedHintLabel }}
58
+ </template>
59
+ <template v-else-if="!disabled">
60
+ {{ selectHintLabel }}
61
+ </template>
62
+ </slot>
63
+ </span>
64
+ </VvDropdownItem>
65
+ </template>
@@ -1,11 +1,6 @@
1
1
  import { DropdownProps, IdProps, ModifiersProps } from '@/props'
2
2
  import type { PropType } from 'vue'
3
-
4
- export const DROPDOWN_ROLES = ['listbox', 'menu'] as const
5
- export const DROPDOWN_ITEM_ROLES = ['option', 'presentation'] as const
6
-
7
- export type DropdownRole = (typeof DROPDOWN_ROLES)[number]
8
- export type DropdownItemRole = (typeof DROPDOWN_ITEM_ROLES)[number]
3
+ import { DropdownRole } from '@/constants'
9
4
 
10
5
  export const VvDropdownProps = {
11
6
  ...IdProps,
@@ -30,8 +25,8 @@ export const VvDropdownProps = {
30
25
  */
31
26
  role: {
32
27
  type: String as PropType<DropdownRole>,
33
- default: DROPDOWN_ROLES[1],
34
- validator: (value: string) =>
35
- (DROPDOWN_ROLES as ReadonlyArray<string>).includes(value),
28
+ default: DropdownRole.menu,
29
+ validator: (value: DropdownRole) =>
30
+ Object.values(DropdownRole).includes(value),
36
31
  },
37
32
  }
@@ -14,6 +14,7 @@ import {
14
14
  UnselectableProps,
15
15
  AutofocusProps,
16
16
  AutocompleteProps,
17
+ LabelProps,
17
18
  } from '@/props'
18
19
 
19
20
  export const VvSelectProps = {
@@ -32,6 +33,7 @@ export const VvSelectProps = {
32
33
  ...IconProps,
33
34
  ...FloatingLabelProps,
34
35
  ...UnselectableProps,
36
+ ...LabelProps,
35
37
  /**
36
38
  * This Boolean attribute indicates that multiple options can be selected in the list.
37
39
  * If it is not specified, then only one option can be selected at a time.
@@ -58,10 +60,6 @@ export const VvSelectProps = {
58
60
  type: [String, Number, Boolean, Object, Array],
59
61
  default: undefined,
60
62
  },
61
- /**
62
- * <label> value for the select
63
- */
64
- label: String,
65
63
  /**
66
64
  * Select placeholder
67
65
  */
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from 'vue'
2
2
  import type { Emitter, EventType } from 'mitt'
3
- import type { DropdownItemRole } from '@/components/VvDropdown/'
3
+ import type { DropdownItemRole } from '@/constants'
4
4
  import {
5
5
  INJECTION_KEY_DROPDOWN_TRIGGER,
6
6
  INJECTION_KEY_DROPDOWN_ACTION,
@@ -1,14 +1,12 @@
1
1
  import { type Ref, Fragment } from 'vue'
2
2
  import mitt from 'mitt'
3
- import {
4
- type DropdownRole,
5
- DROPDOWN_ROLES,
6
- DROPDOWN_ITEM_ROLES,
7
- } from '@/components/VvDropdown/'
8
3
  import {
9
4
  INJECTION_KEY_DROPDOWN_TRIGGER,
10
5
  INJECTION_KEY_DROPDOWN_ACTION,
11
6
  INJECTION_KEY_DROPDOWN_ITEM,
7
+ DropdownRole,
8
+ DropdownItemRole,
9
+ ActionRoles,
12
10
  } from '@/constants'
13
11
 
14
12
  /**
@@ -70,9 +68,9 @@ export function useProvideDropdownItem({
70
68
  expanded: Ref<boolean>
71
69
  }) {
72
70
  const itemRole = computed(() =>
73
- role.value === DROPDOWN_ROLES[0]
74
- ? DROPDOWN_ITEM_ROLES[0]
75
- : DROPDOWN_ITEM_ROLES[1],
71
+ role.value === DropdownRole.listbox
72
+ ? DropdownItemRole.option
73
+ : DropdownItemRole.presentation,
76
74
  )
77
75
  provide(INJECTION_KEY_DROPDOWN_ITEM, {
78
76
  role: itemRole,
@@ -91,7 +89,7 @@ export function useProvideDropdownAction({
91
89
  expanded: Ref<boolean>
92
90
  }) {
93
91
  provide(INJECTION_KEY_DROPDOWN_ACTION, {
94
- role: 'menuitem',
92
+ role: ActionRoles.menuitem,
95
93
  expanded,
96
94
  })
97
95
  }
@@ -10,14 +10,11 @@ export function useBemModifiers(
10
10
  [prefix]: true,
11
11
  }
12
12
  // props modifiers
13
- let modifiersArray = unref(modifiers)
13
+ const modifiersArray =
14
+ typeof modifiers?.value === 'string'
15
+ ? modifiers.value.split(' ')
16
+ : modifiers?.value
14
17
  if (modifiersArray) {
15
- if (
16
- !Array.isArray(modifiersArray) &&
17
- typeof modifiersArray === 'string'
18
- ) {
19
- modifiersArray = modifiersArray.split(' ')
20
- }
21
18
  if (Array.isArray(modifiersArray)) {
22
19
  modifiersArray.forEach((modifier) => {
23
20
  toReturn[`${prefix}--${modifier}`] = true
package/src/constants.ts CHANGED
@@ -23,6 +23,42 @@ export enum Position {
23
23
  after = 'after',
24
24
  }
25
25
 
26
+ export enum ButtonType {
27
+ button = 'button',
28
+ submit = 'submit',
29
+ reset = 'reset',
30
+ }
31
+
32
+ export enum ActionTag {
33
+ nuxtLink = 'nuxt-link',
34
+ routerLink = 'router-link',
35
+ a = 'a',
36
+ button = 'button',
37
+ }
38
+
39
+ export enum ActionRoles {
40
+ button = 'button',
41
+ link = 'link',
42
+ menuitem = 'menuitem',
43
+ }
44
+
45
+ export enum DropdownRole {
46
+ listbox = 'listbox',
47
+ menu = 'menu',
48
+ }
49
+
50
+ export enum DropdownItemRole {
51
+ option = 'option',
52
+ presentation = 'presentation',
53
+ }
54
+
55
+ export enum AnchorTarget {
56
+ _blank = '_blank',
57
+ _self = '_self',
58
+ _parent = '_parent',
59
+ _top = '_top',
60
+ }
61
+
26
62
  // volver
27
63
  export const INJECTION_KEY_VOLVER = Symbol.for('volver')
28
64
 
@@ -7,21 +7,77 @@ import type {
7
7
  ShiftOptions,
8
8
  SizeOptions,
9
9
  } from '@/types/floating-ui'
10
- import { Placement, Position, Side } from '@/constants'
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
@@ -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
422
  modelValue: [String, Array],
344
- /**
345
- * Input label
346
- */
347
- label: String,
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,
444
+ default: ButtonType.button,
445
+ validator: (value: ButtonType) =>
446
+ Object.values(ButtonType).includes(value),
447
+ },
448
+ }
@@ -14,19 +14,19 @@ 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
  *
@@ -35,18 +35,24 @@ export interface VolverResolverOptions {
35
35
  prefix?: string
36
36
  }
37
37
 
38
- const STYLE_EXCLUDE = ['vv-icon']
38
+ const STYLE_EXCLUDE = ['vv-icon', 'vv-action']
39
39
  const VOLVER_PREFIX = 'vv'
40
+ const DIRECTIVES = ['v-tooltip']
40
41
 
41
42
  const getStyleNames = function (kebabName: string) {
42
43
  if (STYLE_EXCLUDE.includes(kebabName)) {
43
44
  return undefined
44
45
  }
45
46
  if (kebabName === 'vv-dropdown') {
46
- return ['vv-dropdown', 'vv-dropdown-action']
47
+ return ['vv-dropdown', 'vv-dropdown-option', 'vv-dropdown-action']
47
48
  }
48
49
  if (kebabName === 'vv-combobox') {
49
- return ['vv-select', 'vv-dropdown', 'vv-dropdown-action']
50
+ return [
51
+ 'vv-select',
52
+ 'vv-dropdown',
53
+ 'vv-dropdown-option',
54
+ 'vv-dropdown-action',
55
+ ]
50
56
  }
51
57
  if (kebabName === 'vv-accordion-group') {
52
58
  return ['vv-accordion-group', 'vv-accordion']
@@ -57,9 +63,34 @@ const getStyleNames = function (kebabName: string) {
57
63
  if (kebabName === 'vv-radio-group') {
58
64
  return ['vv-radio-group', 'vv-radio']
59
65
  }
66
+ if (kebabName === 'v-tooltip') {
67
+ return ['vv-tooltip']
68
+ }
60
69
  return [kebabName]
61
70
  }
62
71
 
72
+ const getSideEffects = function (kebabName: string, importStyle?: ImportStyle) {
73
+ const sideEffects: SideEffectsInfo = []
74
+
75
+ if (!importStyle) {
76
+ return sideEffects
77
+ }
78
+
79
+ // import component style
80
+ const styleNames = getStyleNames(kebabName)
81
+ if (styleNames) {
82
+ styleNames.forEach((name) => {
83
+ sideEffects.push(
84
+ `@volverjs/style/${
85
+ importStyle === 'scss' ? 'scss/' : ''
86
+ }components/${name}`,
87
+ )
88
+ })
89
+ }
90
+
91
+ return sideEffects
92
+ }
93
+
63
94
  /**
64
95
  * Resolver for @volverjs/ui-vue
65
96
  *
@@ -68,48 +99,50 @@ const getStyleNames = function (kebabName: string) {
68
99
  export function VolverResolver({
69
100
  prefix = VOLVER_PREFIX,
70
101
  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
- )
102
+ directives,
103
+ }: VolverResolverOptions = {}): ComponentResolver[] {
104
+ return [
105
+ {
106
+ type: 'component',
107
+ resolve: (name: string) => {
108
+ if (
109
+ !prefix ||
110
+ !name.toLowerCase().startsWith(prefix.toLowerCase())
111
+ ) {
112
+ return
113
+ }
114
+ const kebabName = kebabCase(name).replace(
115
+ `${prefix}-`,
116
+ `${VOLVER_PREFIX}-`,
117
+ )
88
118
 
89
- if (importStyle) {
90
- // import custom style
91
- if (customStylePath) {
92
- sideEffects.push(customStylePath)
119
+ // import component
120
+ return {
121
+ from: `@volverjs/ui-vue/${kebabName}`,
122
+ sideEffects: getSideEffects(kebabName, importStyle),
93
123
  }
124
+ },
125
+ },
126
+ {
127
+ type: 'directive',
128
+ resolve: (name: string) => {
129
+ if (!directives) {
130
+ return
131
+ }
132
+
133
+ const kebabName = `v-${kebabCase(name)}`
94
134
 
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
- })
135
+ // filter directive
136
+ if (!DIRECTIVES.includes(kebabName)) {
137
+ return
105
138
  }
106
- }
107
139
 
108
- // import component
109
- return {
110
- from: `@volverjs/ui-vue/${kebabName}`,
111
- sideEffects,
112
- }
140
+ // import directive
141
+ return {
142
+ from: `@volverjs/ui-vue/${kebabName}`,
143
+ sideEffects: getSideEffects(kebabName, importStyle),
144
+ }
145
+ },
113
146
  },
114
- }
147
+ ]
115
148
  }
@@ -14,7 +14,7 @@ import { defaultArgs, argTypes } from './Accordion.settings'
14
14
  name="Summary"
15
15
  play={defaultTest}
16
16
  args={{
17
- summary: `<strong data-testId="slot" class="font-bold text-brand">Custom Summary</strong>`,
17
+ summary: `<strong data-testId="slot" class="font-bold text-brand-darken-1">Custom Summary</strong>`,
18
18
  }}
19
19
  argTypes={{
20
20
  title: {
@@ -38,7 +38,7 @@ import { defaultArgs, argTypes } from './Accordion.settings'
38
38
  name="Details"
39
39
  play={defaultTest}
40
40
  args={{
41
- details: `<strong data-testId="slot" class="font-bold text-brand">Custom Details</strong>`,
41
+ details: `<strong data-testId="slot" class="font-bold text-brand-darken-1">Custom Details</strong>`,
42
42
  }}
43
43
  argTypes={{
44
44
  content: {
@@ -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 }
@@ -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>