@volverjs/ui-vue 0.0.4 → 0.0.5-beta.2

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 (215) hide show
  1. package/README.md +2 -2
  2. package/auto-imports.d.ts +12 -3
  3. package/bin/icons.cjs +1 -73
  4. package/dist/Volver.d.ts +19 -11
  5. package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
  6. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  7. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
  8. package/dist/components/VvAccordion/index.d.ts +8 -3
  9. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +264 -164
  10. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  11. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
  12. package/dist/components/VvAccordionGroup/index.d.ts +8 -0
  13. package/dist/components/VvAction/VvAction.es.js +276 -98
  14. package/dist/components/VvAction/VvAction.umd.js +1 -1
  15. package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
  16. package/dist/components/VvAction/index.d.ts +2 -2
  17. package/dist/components/VvBadge/VvBadge.es.js +213 -44
  18. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  19. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  20. package/dist/components/VvBadge/index.d.ts +1 -1
  21. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +247 -75
  22. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  23. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
  24. package/dist/components/VvBreadcrumb/index.d.ts +1 -1
  25. package/dist/components/VvButton/VvButton.es.js +646 -360
  26. package/dist/components/VvButton/VvButton.umd.js +1 -1
  27. package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
  28. package/dist/components/VvButton/index.d.ts +13 -13
  29. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +261 -79
  30. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  31. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
  32. package/dist/components/VvButtonGroup/index.d.ts +1 -1
  33. package/dist/components/VvCard/VvCard.es.js +57 -38
  34. package/dist/components/VvCard/VvCard.umd.js +1 -1
  35. package/dist/components/VvCheckbox/VvCheckbox.es.js +562 -274
  36. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  37. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
  38. package/dist/components/VvCheckbox/index.d.ts +5 -5
  39. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +661 -340
  40. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  41. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
  42. package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
  43. package/dist/components/VvCombobox/VvCombobox.es.js +1546 -983
  44. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  45. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +138 -51
  46. package/dist/components/VvCombobox/index.d.ts +41 -10
  47. package/dist/components/VvDialog/VvDialog.es.js +387 -141
  48. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  49. package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
  50. package/dist/components/VvDialog/index.d.ts +4 -1
  51. package/dist/components/VvDropdown/VvDropdown.es.js +452 -244
  52. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  53. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +130 -42
  54. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
  55. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
  56. package/dist/components/VvDropdown/index.d.ts +40 -11
  57. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +373 -160
  58. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  59. package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
  60. package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
  61. package/dist/components/VvDropdownOption/VvDropdownOption.es.js +285 -90
  62. package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
  63. package/dist/components/VvIcon/VvIcon.es.js +113 -65
  64. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  65. package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
  66. package/dist/components/VvIcon/index.d.ts +2 -2
  67. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
  68. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  69. package/dist/components/VvInputText/VvInputText.es.js +986 -462
  70. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  71. package/dist/components/VvInputText/VvInputText.vue.d.ts +100 -20
  72. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  73. package/dist/components/VvInputText/index.d.ts +66 -13
  74. package/dist/components/VvProgress/VvProgress.es.js +216 -45
  75. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  76. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  77. package/dist/components/VvProgress/index.d.ts +1 -1
  78. package/dist/components/VvRadio/VvRadio.es.js +499 -238
  79. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  80. package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
  81. package/dist/components/VvRadio/index.d.ts +5 -5
  82. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +598 -304
  83. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  84. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
  85. package/dist/components/VvRadioGroup/index.d.ts +3 -3
  86. package/dist/components/VvSelect/VvSelect.es.js +631 -324
  87. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  88. package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
  89. package/dist/components/VvSelect/index.d.ts +3 -3
  90. package/dist/components/VvTextarea/VvTextarea.es.js +676 -355
  91. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  92. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +20 -20
  93. package/dist/components/VvTextarea/index.d.ts +4 -4
  94. package/dist/components/VvTooltip/VvTooltip.es.js +215 -47
  95. package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
  96. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
  97. package/dist/components/VvTooltip/index.d.ts +2 -2
  98. package/dist/components/index.es.js +3522 -2231
  99. package/dist/components/index.umd.js +1 -1
  100. package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
  101. package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
  102. package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
  103. package/dist/composables/group/useProvideGroupState.d.ts +1 -1
  104. package/dist/composables/useComponentFocus.d.ts +1 -1
  105. package/dist/composables/useComponentIcon.d.ts +7 -7
  106. package/dist/composables/useDebouncedInput.d.ts +4 -1
  107. package/dist/composables/useDefaults.d.ts +2 -0
  108. package/dist/composables/useModifiers.d.ts +1 -1
  109. package/dist/composables/useOptions.d.ts +2 -2
  110. package/dist/composables/useTextCount.d.ts +3 -3
  111. package/dist/composables/useUniqueId.d.ts +1 -1
  112. package/dist/composables/useVolver.d.ts +1 -1
  113. package/dist/directives/index.d.ts +1 -0
  114. package/dist/directives/index.es.js +264 -55
  115. package/dist/directives/index.umd.js +1 -1
  116. package/dist/directives/v-contextmenu.d.ts +3 -0
  117. package/dist/directives/v-contextmenu.es.js +42 -0
  118. package/dist/directives/v-contextmenu.umd.js +1 -0
  119. package/dist/directives/v-tooltip.es.js +222 -53
  120. package/dist/directives/v-tooltip.umd.js +1 -1
  121. package/dist/icons.d.ts +3 -1
  122. package/dist/icons.es.js +40 -23
  123. package/dist/icons.umd.js +1 -1
  124. package/dist/index.d.ts +0 -1
  125. package/dist/index.es.js +112 -3607
  126. package/dist/index.umd.js +1 -1
  127. package/dist/props/index.d.ts +50 -18
  128. package/dist/resolvers/unplugin.d.ts +7 -1
  129. package/dist/resolvers/unplugin.es.js +77 -37
  130. package/dist/resolvers/unplugin.umd.js +1 -1
  131. package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
  132. package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
  133. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  134. package/dist/stories/argTypes.d.ts +13 -1
  135. package/package.json +126 -40
  136. package/src/Volver.ts +49 -22
  137. package/src/assets/icons/detailed.json +1 -1
  138. package/src/assets/icons/normal.json +1 -1
  139. package/src/assets/icons/simple.json +1 -1
  140. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  141. package/src/components/VvAccordion/index.ts +12 -4
  142. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  143. package/src/components/VvAccordionGroup/index.ts +8 -0
  144. package/src/components/VvAction/VvAction.vue +7 -7
  145. package/src/components/VvAction/index.ts +1 -1
  146. package/src/components/VvBadge/VvBadge.vue +2 -2
  147. package/src/components/VvBadge/index.ts +1 -1
  148. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  149. package/src/components/VvButton/VvButton.vue +11 -11
  150. package/src/components/VvButton/index.ts +10 -9
  151. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  152. package/src/components/VvButtonGroup/index.ts +1 -1
  153. package/src/components/VvCard/VvCard.vue +2 -2
  154. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  155. package/src/components/VvCheckbox/index.ts +11 -7
  156. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  157. package/src/components/VvCheckboxGroup/index.ts +1 -1
  158. package/src/components/VvCombobox/VvCombobox.vue +44 -26
  159. package/src/components/VvCombobox/index.ts +1 -1
  160. package/src/components/VvDialog/VvDialog.vue +28 -11
  161. package/src/components/VvDialog/index.ts +5 -2
  162. package/src/components/VvDropdown/VvDropdown.vue +7 -5
  163. package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
  164. package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
  165. package/src/components/VvDropdown/index.ts +3 -3
  166. package/src/components/VvIcon/VvIcon.vue +3 -3
  167. package/src/components/VvIcon/index.ts +3 -3
  168. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  169. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  170. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  171. package/src/components/VvInputText/VvInputText.vue +130 -37
  172. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  173. package/src/components/VvInputText/index.ts +62 -1
  174. package/src/components/VvProgress/VvProgress.vue +2 -2
  175. package/src/components/VvProgress/index.ts +1 -1
  176. package/src/components/VvRadio/VvRadio.vue +3 -7
  177. package/src/components/VvRadio/index.ts +11 -7
  178. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  179. package/src/components/VvRadioGroup/index.ts +1 -1
  180. package/src/components/VvSelect/VvSelect.vue +4 -4
  181. package/src/components/VvSelect/index.ts +1 -1
  182. package/src/components/VvTextarea/VvTextarea.vue +6 -6
  183. package/src/components/VvTextarea/index.ts +1 -1
  184. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  185. package/src/components/VvTooltip/index.ts +3 -3
  186. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  187. package/src/composables/dropdown/useProvideDropdown.ts +2 -2
  188. package/src/composables/group/useInjectedGroupState.ts +1 -1
  189. package/src/composables/group/useProvideGroupState.ts +1 -1
  190. package/src/composables/useComponentIcon.ts +1 -1
  191. package/src/composables/useDebouncedInput.ts +10 -3
  192. package/src/composables/useDefaults.ts +89 -0
  193. package/src/composables/useModifiers.ts +4 -2
  194. package/src/composables/useOptions.ts +1 -1
  195. package/src/composables/useVolver.ts +2 -2
  196. package/src/directives/index.ts +3 -1
  197. package/src/directives/v-contextmenu.ts +40 -0
  198. package/src/directives/v-tooltip.ts +2 -2
  199. package/src/icons.ts +1 -1
  200. package/src/index.ts +0 -2
  201. package/src/props/index.ts +20 -10
  202. package/src/resolvers/unplugin.ts +15 -1
  203. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  204. package/src/stories/Accordion/Accordion.test.ts +21 -15
  205. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  206. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  207. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  208. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  209. package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
  210. package/src/stories/InputText/InputText.settings.ts +53 -0
  211. package/src/stories/InputText/InputText.stories.mdx +40 -0
  212. package/src/stories/InputText/InputText.test.ts +5 -2
  213. package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
  214. package/src/stories/argTypes.ts +12 -2
  215. package/src/types/group.d.ts +5 -0
@@ -0,0 +1,89 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue'
2
+
3
+ type VueProp =
4
+ | StringConstructor
5
+ | NumberConstructor
6
+ | ObjectConstructor
7
+ | FunctionConstructor
8
+ | SymbolConstructor
9
+ | ArrayConstructor
10
+ | BooleanConstructor
11
+ | PropType<unknown>
12
+
13
+ export function useDefaults<Definition>(
14
+ componentName: string,
15
+ propsDefinition: Definition,
16
+ props: Readonly<ExtractPropTypes<Definition>>,
17
+ ) {
18
+ const volver = useVolver()
19
+
20
+ const volverComponentDefaults = computed(() => {
21
+ if (!volver || !volver.defaults.value?.[componentName]) {
22
+ return undefined
23
+ }
24
+ return volver.defaults.value[componentName]
25
+ })
26
+
27
+ return computed(() => {
28
+ if (volverComponentDefaults.value === undefined) {
29
+ return props
30
+ }
31
+ const componentDefaults = volverComponentDefaults.value
32
+ const simplifiedPropsDefinition = propsDefinition as {
33
+ [key: string]:
34
+ | VueProp
35
+ | VueProp[]
36
+ | { type: VueProp | VueProp[]; default?: unknown }
37
+ }
38
+ const simplifiedProps = props as Record<string, unknown>
39
+ return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
40
+ const propValue = simplifiedProps[key]
41
+ acc[key] = propValue
42
+ if (key in componentDefaults) {
43
+ // array of types
44
+ if (Array.isArray(simplifiedPropsDefinition[key])) {
45
+ const typeArray = simplifiedPropsDefinition[
46
+ key
47
+ ] as VueProp[]
48
+ if (typeArray.length) {
49
+ const typeFunction = typeArray[0] as <T>() => T
50
+ if (typeFunction === propValue) {
51
+ acc[key] = componentDefaults[key]
52
+ }
53
+ }
54
+ }
55
+ // single type
56
+ if (typeof simplifiedPropsDefinition[key] === 'function') {
57
+ const typeFunction = simplifiedPropsDefinition[key] as <
58
+ T,
59
+ >() => T
60
+ if (typeFunction() === propValue) {
61
+ acc[key] = componentDefaults[key]
62
+ }
63
+ }
64
+ // object with type and default
65
+ if (typeof simplifiedPropsDefinition[key] === 'object') {
66
+ let defaultValue = (
67
+ simplifiedPropsDefinition[key] as { default: unknown }
68
+ ).default
69
+ if (typeof defaultValue === 'function') {
70
+ defaultValue = defaultValue()
71
+ }
72
+ if (typeof defaultValue === 'object') {
73
+ if (
74
+ JSON.stringify(defaultValue) ===
75
+ JSON.stringify(propValue)
76
+ ) {
77
+ acc[key] = componentDefaults[key]
78
+ }
79
+ } else if (defaultValue === propValue) {
80
+ acc[key] = componentDefaults[key]
81
+ }
82
+ }
83
+ }
84
+ return acc
85
+ }, {} as Record<string, unknown>) as Readonly<
86
+ ExtractPropTypes<Definition>
87
+ >
88
+ })
89
+ }
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from 'vue'
2
2
 
3
- export function useBemModifiers(
3
+ export function useModifiers(
4
4
  prefix: string,
5
5
  modifiers?: Ref<string | string[] | unknown | unknown[] | undefined>,
6
6
  others?: Ref<Record<string, boolean>>,
@@ -17,7 +17,9 @@ export function useBemModifiers(
17
17
  if (modifiersArray) {
18
18
  if (Array.isArray(modifiersArray)) {
19
19
  modifiersArray.forEach((modifier) => {
20
- toReturn[`${prefix}--${modifier}`] = true
20
+ if (modifier) {
21
+ toReturn[`${prefix}--${modifier}`] = true
22
+ }
21
23
  })
22
24
  }
23
25
  }
@@ -1,4 +1,4 @@
1
- import type { Option } from '@/types/generic'
1
+ import type { Option } from '../types/generic'
2
2
 
3
3
  // eslint-disable-next-line
4
4
  export function useOptions(props: any) {
@@ -1,5 +1,5 @@
1
- import { INJECTION_KEY_VOLVER } from '@/constants'
2
- import type { VolverInterface } from '@/Volver'
1
+ import { INJECTION_KEY_VOLVER } from '../constants'
2
+ import type { VolverInterface } from '../Volver'
3
3
 
4
4
  export function useVolver() {
5
5
  return inject<VolverInterface>(INJECTION_KEY_VOLVER)
@@ -1,5 +1,7 @@
1
- import tooltip from '@/directives/v-tooltip'
1
+ import tooltip from '../directives/v-tooltip'
2
+ import contextmenu from '../directives/v-contextmenu'
2
3
 
3
4
  export default {
4
5
  tooltip,
6
+ contextmenu,
5
7
  }
@@ -0,0 +1,40 @@
1
+ import type { Directive, DirectiveBinding } from 'vue'
2
+
3
+ const contextmenu: Directive = {
4
+ beforeUpdate(el: HTMLElement, binding: DirectiveBinding) {
5
+ const clientX = ref(0)
6
+ const clientY = ref(0)
7
+ const virtualEl = {
8
+ getBoundingClientRect() {
9
+ return {
10
+ width: 0,
11
+ height: 0,
12
+ x: clientX.value,
13
+ y: clientY.value,
14
+ top: clientY.value,
15
+ left: clientX.value,
16
+ right: clientX.value,
17
+ bottom: clientY.value,
18
+ }
19
+ },
20
+ }
21
+ if (binding.value?.init) {
22
+ binding.value.init?.(virtualEl)
23
+ }
24
+ el.addEventListener(
25
+ 'contextmenu',
26
+ function (ev) {
27
+ if (binding.value?.show) {
28
+ ev.preventDefault()
29
+ clientX.value = ev.clientX
30
+ clientY.value = ev.clientY
31
+ binding.value.show?.()
32
+ return false
33
+ }
34
+ },
35
+ false,
36
+ )
37
+ },
38
+ }
39
+
40
+ export default contextmenu
@@ -1,6 +1,6 @@
1
1
  import { render, type Directive, type DirectiveBinding } from 'vue'
2
- import VvTooltip from '@/components/VvTooltip/VvTooltip.vue'
3
- import type { Side } from '@/constants'
2
+ import VvTooltip from '../components/VvTooltip/VvTooltip.vue'
3
+ import type { Side } from '../constants'
4
4
 
5
5
  const tooltip: Directive = {
6
6
  beforeMount(el: HTMLElement, binding: DirectiveBinding) {
package/src/icons.ts CHANGED
@@ -4,4 +4,4 @@ import simple from './assets/icons/simple.json'
4
4
 
5
5
  export default [normal, detailed, simple]
6
6
 
7
- export { normal }
7
+ export { normal, detailed, simple }
package/src/index.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import VolverPlugin from './Volver'
2
2
  import type { Volver } from './Volver'
3
3
 
4
- // export all components as vue plugin
5
- export * from './components/index'
6
4
  export { VolverPlugin }
7
5
 
8
6
  // https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties
@@ -1,19 +1,19 @@
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'
9
+ } from '../types/floating-ui'
10
10
  import {
11
11
  Placement,
12
12
  Position,
13
13
  Side,
14
14
  AnchorTarget,
15
15
  ButtonType,
16
- } from '@/constants'
16
+ } from '../constants'
17
17
 
18
18
  export const LinkProps = {
19
19
  /**
@@ -31,7 +31,7 @@ export const LinkProps = {
31
31
  * Anchor target
32
32
  */
33
33
  target: {
34
- type: String as PropType<AnchorTarget>,
34
+ type: String as PropType<`${AnchorTarget}`>,
35
35
  validator: (value: AnchorTarget) =>
36
36
  Object.values(AnchorTarget).includes(value),
37
37
  },
@@ -184,7 +184,7 @@ export const IconProps = {
184
184
  * VvIcon position
185
185
  */
186
186
  iconPosition: {
187
- type: String as PropType<Position>,
187
+ type: String as PropType<`${Position}`>,
188
188
  default: Position.before,
189
189
  validation: (value: Position) =>
190
190
  Object.values(Position).includes(value),
@@ -226,7 +226,7 @@ export const DropdownProps = {
226
226
  * Dropdown placement
227
227
  */
228
228
  placement: {
229
- type: String as PropType<Side | Placement>,
229
+ type: String as PropType<`${Side}` | `${Placement}`>,
230
230
  default: Side.bottom,
231
231
  validator: (value: Side & Placement) => {
232
232
  return (
@@ -235,6 +235,16 @@ export const DropdownProps = {
235
235
  )
236
236
  },
237
237
  },
238
+ /**
239
+ * Dropdown strategy
240
+ */
241
+ strategy: {
242
+ type: String as PropType<'fixed' | 'absolute'>,
243
+ default: 'absolute',
244
+ validator: (value: 'fixed' | 'absolute') => {
245
+ return ['fixed', 'absolute'].includes(value)
246
+ },
247
+ },
238
248
  /**
239
249
  * Dropdown show / hide transition name
240
250
  */
@@ -362,14 +372,14 @@ export const InputTextareaProps = {
362
372
  * Available for input types: text, search, url, tel, email, password
363
373
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
364
374
  */
365
- minlength: Number,
375
+ minlength: [String, Number],
366
376
  /**
367
377
  * Input / Textarea maxlength
368
378
  * Maximum length (number of characters) of value
369
379
  * Available for input types: text, search, url, tel, email, password
370
380
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
371
381
  */
372
- maxlength: Number,
382
+ maxlength: [String, Number],
373
383
  /**
374
384
  * Input / Textarea placeholder
375
385
  * Text that appears in the form control when it has no value set
@@ -419,7 +429,7 @@ export const CheckboxRadioGroupProps = {
419
429
  /**
420
430
  * Input value
421
431
  */
422
- modelValue: [String, Array],
432
+ modelValue: [String, Array, Boolean, Number, Symbol],
423
433
  /**
424
434
  * Input name
425
435
  */
@@ -440,7 +450,7 @@ export const ActionProps = {
440
450
  * Button type
441
451
  */
442
452
  type: {
443
- type: String,
453
+ type: String as PropType<`${ButtonType}`>,
444
454
  default: ButtonType.button,
445
455
  validator: (value: ButtonType) =>
446
456
  Object.values(ButtonType).includes(value),
@@ -33,13 +33,18 @@ export interface VolverResolverOptions {
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
43
  const STYLE_EXCLUDE = ['vv-icon', 'vv-action']
39
44
  const VOLVER_PREFIX = 'vv'
40
45
  const DIRECTIVES = ['v-tooltip']
41
46
 
42
- const getStyleNames = function (kebabName: string) {
47
+ export const getStyleNames = function (kebabName: string) {
43
48
  if (STYLE_EXCLUDE.includes(kebabName)) {
44
49
  return undefined
45
50
  }
@@ -100,6 +105,7 @@ export function VolverResolver({
100
105
  prefix = VOLVER_PREFIX,
101
106
  importStyle,
102
107
  directives,
108
+ ignore,
103
109
  }: VolverResolverOptions = {}): ComponentResolver[] {
104
110
  return [
105
111
  {
@@ -116,6 +122,10 @@ export function VolverResolver({
116
122
  `${VOLVER_PREFIX}-`,
117
123
  )
118
124
 
125
+ if (ignore && ignore.includes(kebabName)) {
126
+ return
127
+ }
128
+
119
129
  // import component
120
130
  return {
121
131
  from: `@volverjs/ui-vue/${kebabName}`,
@@ -137,6 +147,10 @@ export function VolverResolver({
137
147
  return
138
148
  }
139
149
 
150
+ if (ignore && ignore.includes(kebabName)) {
151
+ return
152
+ }
153
+
140
154
  // import directive
141
155
  return {
142
156
  from: `@volverjs/ui-vue/${kebabName}`,
@@ -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-darken-1">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-darken-1">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
@@ -50,7 +50,7 @@ import { defaultArgs, argTypes } from './AccordionGroup.settings'
50
50
  <vv-accordion name="a-3" title="Details 3" :content="content" />
51
51
  </vv-accordion-group>
52
52
  <div class="mt-24" >
53
- Selected: <span data-testId="value">{{ selected }}</span>
53
+ Opened: <span data-testId="value">{{ selected }}</span>
54
54
  </div>
55
55
  `,
56
56
  }
@@ -0,0 +1,41 @@
1
+ import { ref } from 'vue'
2
+ import { Meta, Story, Canvas } from '@storybook/addon-docs'
3
+ import { defaultArgs, argTypes } from './Dropdown.settings'
4
+ import VvDropdown from '@/components/VvDropdown/VvDropdown.vue'
5
+ import VvDropdownAction from '@/components/VvDropdown/VvDropdownAction.vue'
6
+ import VvIcon from '@/components/VvIcon/VvIcon.vue'
7
+
8
+ <Meta title="Directives/Contextmenu" args={defaultArgs} argTypes={argTypes} />
9
+
10
+ export const Template = (args, { argTypes }) => ({
11
+ props: Object.keys(argTypes),
12
+ components: { VvDropdown, VvDropdownAction, VvIcon },
13
+ setup() {
14
+ const dropdownEl = ref(null)
15
+ return { args, dropdownEl }
16
+ },
17
+ template: /* html */ `
18
+ <div v-contextmenu="dropdownEl" class="w-full h-320 bg-surface-1 flex items-center justify-center">
19
+ <div class="text-word-2 text-18 uppercase w-150 text-center">Right click context menu</div>
20
+ </div>
21
+ <vv-dropdown v-bind="args" ref="dropdownEl">
22
+ <template #items>
23
+ <vv-dropdown-action>
24
+ <vv-icon name="add" /> Create
25
+ </vv-dropdown-action>
26
+ <vv-dropdown-action>
27
+ <vv-icon name="edit" /> Update
28
+ </vv-dropdown-action>
29
+ <vv-dropdown-action>
30
+ <vv-icon name="trash" /> Delete
31
+ </vv-dropdown-action>
32
+ </template>
33
+ </vv-dropdown>
34
+ `,
35
+ })
36
+
37
+ <Canvas>
38
+ <Story name="Default" args={{ placement: 'bottom-start' }}>
39
+ {Template.bind()}
40
+ </Story>
41
+ </Canvas>
@@ -196,6 +196,59 @@ export const argTypes = {
196
196
  },
197
197
  },
198
198
  },
199
+ mask: {
200
+ description: 'Input mask, only for text type',
201
+ type: {
202
+ summary: 'string',
203
+ },
204
+ control: {
205
+ type: 'text',
206
+ },
207
+ },
208
+ maskEager: {
209
+ description: 'Show mask before typing',
210
+ type: {
211
+ summary: 'boolean',
212
+ },
213
+ table: {
214
+ defaultValue: {
215
+ summary: false,
216
+ },
217
+ },
218
+ },
219
+ maskReversed: {
220
+ description: 'Write typing reverse (ex. for numbers)',
221
+ type: {
222
+ summary: 'boolean',
223
+ },
224
+ table: {
225
+ defaultValue: {
226
+ summary: false,
227
+ },
228
+ },
229
+ },
230
+ maskTokens: {
231
+ description: 'Add mask custom tokens',
232
+ type: {
233
+ summary: 'Object',
234
+ },
235
+ table: {
236
+ defaultValue: {
237
+ summary: 'undefined',
238
+ },
239
+ },
240
+ },
241
+ maskTokensReplace: {
242
+ description: 'Replace default tokens',
243
+ type: {
244
+ summary: 'boolean',
245
+ },
246
+ table: {
247
+ defaultValue: {
248
+ summary: false,
249
+ },
250
+ },
251
+ },
199
252
  before: {
200
253
  control: {
201
254
  type: 'text',