@volverjs/ui-vue 0.0.4 → 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 (204) 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 +266 -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 +203 -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 +237 -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 +636 -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 +251 -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 +552 -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 +651 -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 +1532 -983
  44. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  45. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +125 -51
  46. package/dist/components/VvCombobox/index.d.ts +36 -10
  47. package/dist/components/VvDialog/VvDialog.es.js +377 -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 +440 -244
  52. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  53. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +113 -41
  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 +35 -11
  57. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +363 -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 +275 -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 +974 -460
  70. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  71. package/dist/components/VvInputText/VvInputText.vue.d.ts +96 -16
  72. package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
  73. package/dist/components/VvInputText/index.d.ts +64 -11
  74. package/dist/components/VvProgress/VvProgress.es.js +206 -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 +489 -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 +588 -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 +621 -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 +664 -353
  91. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  92. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
  93. package/dist/components/VvTextarea/index.d.ts +2 -2
  94. package/dist/components/VvTooltip/VvTooltip.es.js +205 -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 +3508 -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.es.js +215 -55
  114. package/dist/directives/index.umd.js +1 -1
  115. package/dist/directives/v-tooltip.es.js +212 -53
  116. package/dist/directives/v-tooltip.umd.js +1 -1
  117. package/dist/icons.es.js +38 -23
  118. package/dist/icons.umd.js +1 -1
  119. package/dist/index.d.ts +0 -1
  120. package/dist/index.es.js +112 -3607
  121. package/dist/index.umd.js +1 -1
  122. package/dist/props/index.d.ts +40 -16
  123. package/dist/resolvers/unplugin.d.ts +7 -1
  124. package/dist/resolvers/unplugin.es.js +77 -37
  125. package/dist/resolvers/unplugin.umd.js +1 -1
  126. package/dist/stories/InputText/InputText.settings.d.ts +53 -0
  127. package/dist/stories/argTypes.d.ts +1 -1
  128. package/package.json +114 -36
  129. package/src/Volver.ts +49 -22
  130. package/src/assets/icons/detailed.json +1 -1
  131. package/src/assets/icons/normal.json +1 -1
  132. package/src/assets/icons/simple.json +1 -1
  133. package/src/components/VvAccordion/VvAccordion.vue +19 -22
  134. package/src/components/VvAccordion/index.ts +12 -4
  135. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
  136. package/src/components/VvAccordionGroup/index.ts +8 -0
  137. package/src/components/VvAction/VvAction.vue +7 -7
  138. package/src/components/VvAction/index.ts +1 -1
  139. package/src/components/VvBadge/VvBadge.vue +2 -2
  140. package/src/components/VvBadge/index.ts +1 -1
  141. package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
  142. package/src/components/VvButton/VvButton.vue +11 -11
  143. package/src/components/VvButton/index.ts +10 -9
  144. package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
  145. package/src/components/VvButtonGroup/index.ts +1 -1
  146. package/src/components/VvCard/VvCard.vue +2 -2
  147. package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
  148. package/src/components/VvCheckbox/index.ts +11 -7
  149. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
  150. package/src/components/VvCheckboxGroup/index.ts +1 -1
  151. package/src/components/VvCombobox/VvCombobox.vue +39 -23
  152. package/src/components/VvCombobox/index.ts +1 -1
  153. package/src/components/VvDialog/VvDialog.vue +28 -11
  154. package/src/components/VvDialog/index.ts +5 -2
  155. package/src/components/VvDropdown/VvDropdown.vue +6 -5
  156. package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
  157. package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
  158. package/src/components/VvDropdown/index.ts +3 -3
  159. package/src/components/VvIcon/VvIcon.vue +3 -3
  160. package/src/components/VvIcon/index.ts +3 -3
  161. package/src/components/VvInputText/VvInputClearAction.ts +2 -2
  162. package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
  163. package/src/components/VvInputText/VvInputStepAction.ts +3 -2
  164. package/src/components/VvInputText/VvInputText.vue +128 -35
  165. package/src/components/VvInputText/VvInputTextActions.ts +5 -8
  166. package/src/components/VvInputText/index.ts +62 -1
  167. package/src/components/VvProgress/VvProgress.vue +2 -2
  168. package/src/components/VvProgress/index.ts +1 -1
  169. package/src/components/VvRadio/VvRadio.vue +3 -7
  170. package/src/components/VvRadio/index.ts +11 -7
  171. package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
  172. package/src/components/VvRadioGroup/index.ts +1 -1
  173. package/src/components/VvSelect/VvSelect.vue +4 -4
  174. package/src/components/VvSelect/index.ts +1 -1
  175. package/src/components/VvTextarea/VvTextarea.vue +4 -4
  176. package/src/components/VvTextarea/index.ts +1 -1
  177. package/src/components/VvTooltip/VvTooltip.vue +2 -2
  178. package/src/components/VvTooltip/index.ts +3 -3
  179. package/src/composables/dropdown/useInjectDropdown.ts +2 -2
  180. package/src/composables/dropdown/useProvideDropdown.ts +2 -2
  181. package/src/composables/group/useInjectedGroupState.ts +1 -1
  182. package/src/composables/group/useProvideGroupState.ts +1 -1
  183. package/src/composables/useComponentIcon.ts +1 -1
  184. package/src/composables/useDebouncedInput.ts +10 -3
  185. package/src/composables/useDefaults.ts +89 -0
  186. package/src/composables/useModifiers.ts +4 -2
  187. package/src/composables/useOptions.ts +1 -1
  188. package/src/composables/useVolver.ts +2 -2
  189. package/src/directives/index.ts +1 -1
  190. package/src/directives/v-tooltip.ts +2 -2
  191. package/src/index.ts +0 -2
  192. package/src/props/index.ts +8 -8
  193. package/src/resolvers/unplugin.ts +15 -1
  194. package/src/stories/Accordion/Accordion.stories.mdx +8 -2
  195. package/src/stories/Accordion/Accordion.test.ts +21 -15
  196. package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
  197. package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
  198. package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
  199. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
  200. package/src/stories/InputText/InputText.settings.ts +53 -0
  201. package/src/stories/InputText/InputText.stories.mdx +40 -0
  202. package/src/stories/InputText/InputText.test.ts +5 -2
  203. package/src/stories/argTypes.ts +2 -2
  204. 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,4 +1,4 @@
1
- import tooltip from '@/directives/v-tooltip'
1
+ import tooltip from '../directives/v-tooltip'
2
2
 
3
3
  export default {
4
4
  tooltip,
@@ -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/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 (
@@ -419,7 +419,7 @@ export const CheckboxRadioGroupProps = {
419
419
  /**
420
420
  * Input value
421
421
  */
422
- modelValue: [String, Array],
422
+ modelValue: [String, Array, Boolean, Number, Symbol],
423
423
  /**
424
424
  * Input name
425
425
  */
@@ -440,7 +440,7 @@ export const ActionProps = {
440
440
  * Button type
441
441
  */
442
442
  type: {
443
- type: String,
443
+ type: String as PropType<`${ButtonType}`>,
444
444
  default: ButtonType.button,
445
445
  validator: (value: ButtonType) =>
446
446
  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
  }
@@ -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',
@@ -169,3 +169,43 @@ export const Template = (args, { argTypes }) => ({
169
169
  {Template.bind()}
170
170
  </Story>
171
171
  </Canvas>
172
+
173
+ <Canvas>
174
+ <Story
175
+ name="Mask"
176
+ args={{
177
+ mask: '##-###-##',
178
+ }}
179
+ argTypes={{
180
+ mask: {
181
+ control: {
182
+ disable: true,
183
+ },
184
+ },
185
+ }}
186
+ play={defaultTest}
187
+ >
188
+ {Template.bind()}
189
+ </Story>
190
+ </Canvas>
191
+
192
+ <Canvas>
193
+ <Story
194
+ name="Unit"
195
+ args={{
196
+ unit: 'km',
197
+ autoWidth: true,
198
+ type: 'number',
199
+ }}
200
+ argTypes={{
201
+ unit: {
202
+ control: {
203
+ disable: true,
204
+ },
205
+ },
206
+ }}
207
+ play={defaultTest}
208
+ >
209
+ {Template.bind()}
210
+ </Story>
211
+ </Canvas>
@@ -4,7 +4,10 @@ import { sleep } from '@/test/sleep'
4
4
  import { within, userEvent } from '@storybook/testing-library'
5
5
  import { INPUT_TYPES, type InputType } from '@/components/VvInputText'
6
6
 
7
- const valueByType = (type: InputType) => {
7
+ const valueByType = (type: InputType, mask?: string) => {
8
+ if (mask) {
9
+ return '1234567'
10
+ }
8
11
  switch (type) {
9
12
  case INPUT_TYPES.TEXT:
10
13
  case INPUT_TYPES.PASSWORD:
@@ -42,7 +45,7 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
42
45
 
43
46
  // value
44
47
  if (!args.invalid && !args.disabled && !args.readonly) {
45
- const inputValue = valueByType(args.type)
48
+ const inputValue = valueByType(args.type, args.mask)
46
49
  if (inputValue) {
47
50
  await expect(input).toBeClicked()
48
51
  await userEvent.keyboard(inputValue)
@@ -1,5 +1,5 @@
1
- import normal from '@/assets/icons/normal.json'
2
- import { Placement, Position, Side } from '@/constants'
1
+ import normal from '../assets/icons/normal.json'
2
+ import { Placement, Position, Side } from '../constants'
3
3
 
4
4
  export const ValidArgTypes = {
5
5
  valid: {
@@ -14,6 +14,9 @@ export default interface GroupState {
14
14
  */
15
15
  export interface InputGroupState extends GroupState {
16
16
  readonly: Ref<boolean>
17
+ disabled: Ref<boolean>
18
+ valid: Ref<boolean>
19
+ invalid: Ref<boolean>
17
20
  }
18
21
 
19
22
  /**
@@ -33,5 +36,7 @@ export interface ButtonGroupState extends GroupState {
33
36
  */
34
37
  export interface AccordionGroupState extends GroupState {
35
38
  collapse: Ref<boolean>
39
+ disabled: Ref<boolean>
36
40
  modifiers: Ref<Array<string> | string | undefined>
41
+ not: Ref<boolean>
37
42
  }