@volverjs/ui-vue 0.0.10-beta.32 → 0.0.10-beta.33

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 (166) hide show
  1. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +1 -131
  2. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +4 -3
  3. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  4. package/dist/components/VvAlert/VvAlert.es.js +5 -5
  5. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  6. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +6 -7
  7. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  8. package/dist/components/VvAvatar/VvAvatar.es.js +1 -6
  9. package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
  10. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +4 -8
  11. package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
  12. package/dist/components/VvBadge/VvBadge.es.js +2 -8
  13. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  14. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +3 -8
  15. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  16. package/dist/components/VvButton/VvButton.es.js +0 -22
  17. package/dist/components/VvButton/VvButton.umd.js +1 -1
  18. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +16 -7
  19. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  20. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +7 -0
  21. package/dist/components/VvButtonGroup/index.d.ts +3 -0
  22. package/dist/components/VvCard/VvCard.es.js +1 -6
  23. package/dist/components/VvCard/VvCard.umd.js +1 -1
  24. package/dist/components/VvCheckbox/VvCheckbox.es.js +2 -23
  25. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  26. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +6 -24
  27. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  28. package/dist/components/VvCombobox/VvCombobox.es.js +12 -31
  29. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  30. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +29 -23
  31. package/dist/components/VvCombobox/index.d.ts +7 -7
  32. package/dist/components/VvDialog/VvDialog.es.js +1 -6
  33. package/dist/components/VvDialog/VvDialog.umd.js +1 -1
  34. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +23 -23
  35. package/dist/components/VvDropdown/index.d.ts +7 -7
  36. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +0 -5
  37. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  38. package/dist/components/VvIcon/VvIcon.es.js +1 -6
  39. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  40. package/dist/components/VvInputFile/VvInputFile.es.js +0 -22
  41. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  42. package/dist/components/VvInputText/VvInputText.es.js +11 -3
  43. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  44. package/dist/components/VvNav/VvNav.es.js +8 -10
  45. package/dist/components/VvNav/VvNav.umd.js +1 -1
  46. package/dist/components/VvNavItem/VvNavItem.es.js +4 -1
  47. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
  48. package/dist/components/VvProgress/VvProgress.es.js +3 -3
  49. package/dist/components/VvProgress/VvProgress.umd.js +1 -1
  50. package/dist/components/VvRadio/VvRadio.es.js +0 -22
  51. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  52. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +4 -23
  53. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  54. package/dist/components/VvTab/VvTab.es.js +7 -9
  55. package/dist/components/VvTab/VvTab.umd.js +1 -1
  56. package/dist/components/index.es.js +82 -68
  57. package/dist/components/index.umd.js +1 -1
  58. package/dist/icons.es.js +3 -3
  59. package/dist/icons.umd.js +1 -1
  60. package/dist/props/index.d.ts +7 -7
  61. package/dist/stories/Accordion/Accordion.settings.d.ts +2 -57
  62. package/dist/stories/AccordionGroup/AccordionGroup.settings.d.ts +2 -66
  63. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -181
  64. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +370 -11
  65. package/dist/stories/Alert/Alert.settings.d.ts +2 -109
  66. package/dist/stories/AlertGroup/AlertGroup.settings.d.ts +2 -85
  67. package/dist/stories/AvatarGroup/AvatarGroup.settings.d.ts +2 -38
  68. package/dist/stories/Badge/Badge.settings.d.ts +2 -26
  69. package/dist/stories/Breadcrumb/Breadcrumb.settings.d.ts +2 -18
  70. package/dist/stories/Breadcrumb/Breadcrumb.test.d.ts +1 -1
  71. package/dist/stories/Button/Button.settings.d.ts +2 -193
  72. package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +2 -40
  73. package/dist/stories/Card/Card.settings.d.ts +2 -63
  74. package/dist/stories/Checkbox/Checkbox.settings.d.ts +2 -132
  75. package/dist/stories/CheckboxGroup/CheckboxGroup.settings.d.ts +1 -141
  76. package/dist/stories/Combobox/Combobox.settings.d.ts +2 -617
  77. package/dist/stories/Dialog/Dialog.settings.d.ts +2 -47
  78. package/dist/stories/Dropdown/Dropdown.settings.d.ts +2 -205
  79. package/dist/stories/Icon/Icon.settings.d.ts +2 -68
  80. package/dist/stories/InputFile/InputFile.settings.d.ts +2 -52
  81. package/dist/stories/InputText/InputText.settings.d.ts +2 -438
  82. package/dist/stories/Nav/Nav.settings.d.ts +2 -10
  83. package/dist/stories/Progress/Progress.settings.d.ts +2 -27
  84. package/dist/stories/Radio/Radio.settings.d.ts +1 -110
  85. package/dist/stories/RadioGroup/RadioGroup.settings.d.ts +1 -141
  86. package/dist/stories/Select/Select.settings.d.ts +2 -246
  87. package/dist/stories/Textarea/Textarea.settings.d.ts +2 -287
  88. package/dist/stories/argTypes.d.ts +27 -866
  89. package/package.json +45 -45
  90. package/src/assets/icons/detailed.json +1 -1
  91. package/src/assets/icons/normal.json +1 -1
  92. package/src/assets/icons/simple.json +1 -1
  93. package/src/components/VvAlert/index.ts +4 -4
  94. package/src/components/VvAlertGroup/VvAlertGroup.vue +0 -1
  95. package/src/components/VvBadge/VvBadge.vue +1 -1
  96. package/src/components/VvButtonGroup/VvButtonGroup.vue +11 -2
  97. package/src/components/VvButtonGroup/index.ts +1 -0
  98. package/src/components/VvCheckbox/VvCheckbox.vue +2 -5
  99. package/src/components/VvCombobox/VvCombobox.vue +2 -1
  100. package/src/components/VvInputText/VvInputText.vue +15 -4
  101. package/src/components/VvNav/VvNav.vue +1 -6
  102. package/src/components/VvNav/VvNavItem.vue +1 -1
  103. package/src/components/VvProgress/VvProgress.vue +0 -1
  104. package/src/composables/alert/useAlert.ts +3 -3
  105. package/src/stories/Accordion/Accordion.settings.ts +3 -2
  106. package/src/stories/AccordionGroup/AccordionGroup.settings.ts +4 -3
  107. package/src/stories/AccordionGroup/AccordionGroup.stories.ts +4 -2
  108. package/src/stories/AccordionGroup/AccordionGroup.test.ts +2 -6
  109. package/src/stories/Alert/Alert.settings.ts +8 -7
  110. package/src/stories/Alert/Alert.test.ts +1 -3
  111. package/src/stories/AlertGroup/AlertGroup.settings.ts +3 -1
  112. package/src/stories/AlertGroup/AlertGroup.test.ts +5 -7
  113. package/src/stories/Avatar/Avatar.test.ts +1 -3
  114. package/src/stories/Avatar/AvatarModifiers.stories.ts +1 -0
  115. package/src/stories/AvatarGroup/AvatarGroup.settings.ts +2 -1
  116. package/src/stories/AvatarGroup/AvatarGroup.test.ts +1 -3
  117. package/src/stories/AvatarGroup/AvatarGroupModifiers.stories.ts +1 -0
  118. package/src/stories/Badge/Badge.settings.ts +2 -1
  119. package/src/stories/Badge/Badge.stories.ts +2 -2
  120. package/src/stories/Badge/Badge.test.ts +1 -1
  121. package/src/stories/Breadcrumb/Breadcrumb.settings.ts +2 -1
  122. package/src/stories/Breadcrumb/Breadcrumb.stories.ts +1 -1
  123. package/src/stories/Breadcrumb/Breadcrumb.test.ts +1 -1
  124. package/src/stories/Button/Button.settings.ts +6 -6
  125. package/src/stories/Button/Button.stories.ts +1 -1
  126. package/src/stories/Button/Button.test.ts +1 -3
  127. package/src/stories/ButtonGroup/ButtonGroup.settings.ts +11 -1
  128. package/src/stories/ButtonGroup/ButtonGroup.stories.ts +1 -1
  129. package/src/stories/ButtonGroup/ButtonGroup.test.ts +2 -6
  130. package/src/stories/Card/Card.settings.ts +2 -1
  131. package/src/stories/Card/Card.test.ts +1 -3
  132. package/src/stories/Checkbox/Checkbox.settings.ts +5 -3
  133. package/src/stories/Checkbox/Checkbox.test.ts +2 -6
  134. package/src/stories/Checkbox/CheckboxBinary.stories.ts +1 -1
  135. package/src/stories/CheckboxGroup/CheckboxGroup.test.ts +2 -6
  136. package/src/stories/Combobox/Combobox.settings.ts +10 -10
  137. package/src/stories/Combobox/Combobox.test.ts +2 -6
  138. package/src/stories/Dialog/Dialog.settings.ts +2 -1
  139. package/src/stories/Dialog/Dialog.test.ts +3 -8
  140. package/src/stories/Dropdown/Dropdown.settings.ts +2 -1
  141. package/src/stories/Dropdown/Dropdown.test.ts +2 -6
  142. package/src/stories/Dropdown/DropdownSlots.stories.ts +1 -1
  143. package/src/stories/Icon/Icon.settings.ts +2 -1
  144. package/src/stories/Icon/Icon.stories.ts +0 -1
  145. package/src/stories/InputFile/InputFile.settings.ts +2 -1
  146. package/src/stories/InputText/InputText.settings.ts +8 -6
  147. package/src/stories/InputText/InputText.test.ts +2 -6
  148. package/src/stories/InputText/InputTextMinMax.stories.ts +1 -1
  149. package/src/stories/Nav/Nav.settings.ts +2 -2
  150. package/src/stories/Nav/Nav.stories.ts +1 -1
  151. package/src/stories/Nav/Nav.test.ts +2 -4
  152. package/src/stories/Progress/Progress.settings.ts +2 -1
  153. package/src/stories/Radio/Radio.test.ts +2 -6
  154. package/src/stories/RadioGroup/RadioGroup.stories.ts +1 -2
  155. package/src/stories/RadioGroup/RadioGroup.test.ts +2 -6
  156. package/src/stories/RadioGroup/RadioGroupOptions.stories.ts +1 -1
  157. package/src/stories/Select/Select.settings.ts +4 -3
  158. package/src/stories/Select/Select.test.ts +3 -9
  159. package/src/stories/Select/SelectIconPosition.stories.ts +2 -2
  160. package/src/stories/Select/SelectOptions.stories.ts +0 -1
  161. package/src/stories/Tab/Tab.test.ts +3 -5
  162. package/src/stories/Textarea/Textarea.settings.ts +5 -3
  163. package/src/stories/Textarea/Textarea.test.ts +2 -6
  164. package/src/stories/Tooltip/Tooltip.settings.ts +1 -1
  165. package/src/stories/Tooltip/Tooltip.test.ts +3 -5
  166. package/src/stories/argTypes.ts +47 -46
@@ -138,18 +138,18 @@ export const useVvAlert = (
138
138
 
139
139
  // listeners
140
140
  const isMouseover = ref(false)
141
- const onMouseover = withModifiers(() => {
141
+ const onMouseover = () => {
142
142
  isMouseover.value = true
143
143
  if (timeout) {
144
144
  clearTimeout(timeout)
145
145
  }
146
- }, ['passive'])
147
- const onMouseleave = withModifiers(() => {
146
+ }
147
+ const onMouseleave = () => {
148
148
  isMouseover.value = false
149
149
  if (props.autoClose > 0) {
150
150
  timeout = setTimeout(close, props.autoClose)
151
151
  }
152
- }, ['passive'])
152
+ }
153
153
 
154
154
  return {
155
155
  close,
@@ -48,7 +48,6 @@
48
48
  <slot name="before" />
49
49
  <TransitionGroup
50
50
  tag="div"
51
- role="group"
52
51
  :name="hasTransition"
53
52
  class="vv-alert-group__list"
54
53
  v-on="alertGroupTransitionHandlers"
@@ -13,7 +13,7 @@
13
13
  </script>
14
14
 
15
15
  <template>
16
- <span :class="bemCssClasses" role="status">
16
+ <span :class="bemCssClasses">
17
17
  <!-- @slot Default slot -->
18
18
  <slot>{{ value }}</slot>
19
19
  </span>
@@ -66,8 +66,17 @@
66
66
  </script>
67
67
 
68
68
  <template>
69
- <div :class="bemCssClasses" role="group">
69
+ <fieldset :class="bemCssClasses" role="group">
70
+ <legend
71
+ v-if="$slots.legend || legendLabel"
72
+ class="vv-button-group__legend"
73
+ >
74
+ <!-- @slot Legend slot -->
75
+ <slot name="legend">
76
+ {{ legendLabel }}
77
+ </slot>
78
+ </legend>
70
79
  <!-- @slot Default slot -->
71
80
  <slot />
72
- </div>
81
+ </fieldset>
73
82
  </template>
@@ -4,6 +4,7 @@ export const VvButtonGroupProps = {
4
4
  ...ModifiersProps,
5
5
  ...DisabledProps,
6
6
  ...UnselectableProps,
7
+ legendLabel: { type: String },
7
8
  /**
8
9
  * String or String[] of css classes (modifiers) that will be provided to each button'
9
10
  */
@@ -90,12 +90,9 @@
90
90
  if (isBinary.value) {
91
91
  modelValue.value = newValue ? props.value : props.uncheckedValue
92
92
  } else if (Array.isArray(modelValue.value) || isInGroup.value) {
93
+ const currentValue = modelValue.value ?? []
93
94
  const toReturn = new Set(
94
- Array.isArray(modelValue.value)
95
- ? modelValue.value
96
- : modelValue.value !== undefined
97
- ? [modelValue.value]
98
- : [],
95
+ Array.isArray(currentValue) ? currentValue : [currentValue],
99
96
  )
100
97
  if (newValue) {
101
98
  toReturn.add(props.value)
@@ -247,7 +247,7 @@
247
247
 
248
248
  const hasValue = computed(() => {
249
249
  return selectedOptions.value
250
- .map((option) => getOptionLabel(option))
250
+ .map((option: string | Option) => getOptionLabel(option))
251
251
  .join(props.separator)
252
252
  })
253
253
 
@@ -434,6 +434,7 @@
434
434
  v-bind="aria"
435
435
  class="vv-select__input"
436
436
  role="combobox"
437
+ :aria-controls="hasDropdownId"
437
438
  :aria-expanded="expanded"
438
439
  :aria-labelledby="hasLabelId"
439
440
  :aria-describedby="
@@ -67,6 +67,7 @@
67
67
  )
68
68
 
69
69
  // mask
70
+ const NEGATIVE_ZERO_REGEX = /^-0?[.,]?[0*]?$/
70
71
  const maskReady = ref(false)
71
72
  const { el, mask, typed, masked, unmasked } = useIMask(
72
73
  computed(
@@ -83,7 +84,7 @@
83
84
  }
84
85
  emit('update:masked', masked.value)
85
86
  if (type.value === INPUT_TYPES.NUMBER) {
86
- if (masked.value === '') {
87
+ if (/^-$|^$/.test(unmasked.value)) {
87
88
  if (
88
89
  localModelValue.value === null ||
89
90
  localModelValue.value === undefined
@@ -93,6 +94,10 @@
93
94
  localModelValue.value = undefined
94
95
  return
95
96
  }
97
+ if (NEGATIVE_ZERO_REGEX.test(unmasked.value)) {
98
+ localModelValue.value = 0
99
+ return
100
+ }
96
101
  if (typeof typed.value !== 'number') {
97
102
  localModelValue.value = Number(typed.value)
98
103
  return
@@ -170,6 +175,13 @@
170
175
  typed.value = new Date(newValue)
171
176
  return
172
177
  }
178
+ if (
179
+ type.value === INPUT_TYPES.NUMBER &&
180
+ NEGATIVE_ZERO_REGEX.test(unmasked.value) &&
181
+ newValue === 0
182
+ ) {
183
+ return
184
+ }
173
185
  typed.value = newValue
174
186
  unmasked.value = `${typed.value}`
175
187
  }
@@ -432,12 +444,11 @@
432
444
  type === INPUT_TYPES.NUMBER
433
445
  ) {
434
446
  let max = props.max
435
- if(type === INPUT_TYPES.DATE && !max) {
447
+ if (type === INPUT_TYPES.DATE && !max) {
436
448
  max = '9999-12-31'
437
449
  }
438
450
  toReturn.step = props.step
439
- toReturn.max =
440
- max !== undefined ? String(max) : undefined
451
+ toReturn.max = max !== undefined ? String(max) : undefined
441
452
  toReturn.min =
442
453
  props.min !== undefined ? String(props.min) : undefined
443
454
  }
@@ -24,12 +24,7 @@
24
24
 
25
25
  <template>
26
26
  <nav :class="bemCssClasses">
27
- <ul
28
- class="vv-nav__menu"
29
- role="menu"
30
- aria-busy="true"
31
- @click.stop="onClick"
32
- >
27
+ <ul class="vv-nav__menu" role="menu" @click.stop="onClick">
33
28
  <slot>
34
29
  <VvNavItem
35
30
  v-for="({ on = {}, data, ...item }, index) in items"
@@ -11,7 +11,7 @@
11
11
 
12
12
  <template>
13
13
  <li class="vv-nav__item" role="presentation">
14
- <VvAction v-bind="$attrs" class="vv-nav__item-label">
14
+ <VvAction v-bind="$attrs" class="vv-nav__item-label" role="menuitem">
15
15
  <slot />
16
16
  </VvAction>
17
17
  </li>
@@ -23,7 +23,6 @@
23
23
 
24
24
  <template>
25
25
  <progress
26
- role="progressbar"
27
26
  v-bind="{
28
27
  class: bemCssClasses,
29
28
  ariaLabel,
@@ -6,7 +6,7 @@ import {
6
6
  DEFAULT_ALERT_INFO_ICON,
7
7
  DefaultAlertIconMap,
8
8
  } from '@/constants'
9
- import type { Alert, AlertModifier } from '@/types/alert'
9
+ import type { Alert } from '@/types/alert'
10
10
 
11
11
  type AlertInGroup = Alert & { timestamp: number; group: string }
12
12
 
@@ -59,8 +59,8 @@ export const useAlert = () => {
59
59
 
60
60
  if (!icon) {
61
61
  const alertModifier = normalizedModifiers.find((modifier) =>
62
- DefaultAlertIconMap.has(modifier as AlertModifier),
63
- ) as AlertModifier | undefined
62
+ DefaultAlertIconMap.has(modifier),
63
+ )
64
64
 
65
65
  if (alertModifier) {
66
66
  icon = DefaultAlertIconMap.get(alertModifier) as string
@@ -1,3 +1,4 @@
1
+ import type { ArgTypes } from '@storybook/types'
1
2
  import { DisabledArgTypes, ModifiersArgTypes } from '@/stories/argTypes'
2
3
 
3
4
  export const defaultArgs = {
@@ -9,7 +10,7 @@ export const defaultArgs = {
9
10
  not: false,
10
11
  }
11
12
 
12
- export const argTypes = {
13
+ export const argTypes: ArgTypes = {
13
14
  summary: {
14
15
  description: 'The title slot',
15
16
  control: {
@@ -49,7 +50,7 @@ export const argTypes = {
49
50
  control: 'boolean',
50
51
  table: {
51
52
  defaultValue: {
52
- summary: false,
53
+ summary: `false`,
53
54
  },
54
55
  },
55
56
  },
@@ -3,6 +3,7 @@ import {
3
3
  DisabledArgTypes,
4
4
  ModifiersArgTypes,
5
5
  } from '@/stories/argTypes'
6
+ import type { ArgTypes } from '@storybook/vue3'
6
7
 
7
8
  export const defaultArgs = {
8
9
  collapse: false,
@@ -31,7 +32,7 @@ export const defaultArgs = {
31
32
  itemModifiers: [],
32
33
  }
33
34
 
34
- export const argTypes = {
35
+ export const argTypes: ArgTypes = {
35
36
  '`details::${item.name}`': {
36
37
  table: {
37
38
  disable: true,
@@ -50,7 +51,7 @@ export const argTypes = {
50
51
  control: 'boolean',
51
52
  table: {
52
53
  defaultValue: {
53
- summary: false,
54
+ summary: 'false',
54
55
  },
55
56
  },
56
57
  },
@@ -59,7 +60,7 @@ export const argTypes = {
59
60
  control: 'boolean',
60
61
  table: {
61
62
  defaultValue: {
62
- summary: false,
63
+ summary: 'false',
63
64
  },
64
65
  },
65
66
  },
@@ -3,13 +3,15 @@ import VvAccordionGroup from '@/components/VvAccordionGroup/VvAccordionGroup.vue
3
3
  import { defaultTest } from './AccordionGroup.test'
4
4
  import { defaultArgs, argTypes } from './AccordionGroup.settings'
5
5
 
6
- export default {
6
+ const meta: Meta<typeof VvAccordionGroup> = {
7
7
  title: 'Components/AccordionGroup',
8
8
  component: VvAccordionGroup,
9
9
  args: defaultArgs,
10
10
  argTypes,
11
11
  tags: ['autodocs'],
12
- } as Meta<typeof VvAccordionGroup>
12
+ }
13
+
14
+ export default meta
13
15
 
14
16
  export type Story = StoryObj<typeof VvAccordionGroup>
15
17
 
@@ -4,14 +4,10 @@ import { sleep } from '@/test/sleep'
4
4
  import { within } from '@storybook/test'
5
5
 
6
6
  export async function defaultTest({ canvasElement, args }: PlayAttributes) {
7
- const element = (await within(canvasElement).findByTestId(
8
- 'element',
9
- )) as HTMLElement
7
+ const element = await within(canvasElement).findByTestId('element')
10
8
  const firstChild = element.children[0] as HTMLDetailsElement
11
9
  const firstChildSummary = firstChild.getElementsByTagName('summary')[0]
12
- const value = (await within(canvasElement).findByTestId(
13
- 'value',
14
- )) as HTMLElement
10
+ const value = await within(canvasElement).findByTestId('value')
15
11
 
16
12
  const modifiers =
17
13
  !args.modifiers || Array.isArray(args.modifiers)
@@ -1,7 +1,6 @@
1
- import type { Meta } from '@storybook/vue3'
1
+ import type { ArgTypes, Meta } from '@storybook/vue3'
2
2
  import type { VvAlert } from '@/components'
3
- import { IconArgTypes } from '../argTypes'
4
- import { ModifiersArgTypes } from '../argTypes'
3
+ import { IconArgTypes, ModifiersArgTypes } from '../argTypes'
5
4
 
6
5
  export const defaultArgs: Meta<typeof VvAlert>['args'] = {
7
6
  title: 'Alert title!',
@@ -11,7 +10,7 @@ export const defaultArgs: Meta<typeof VvAlert>['args'] = {
11
10
  role: 'alert',
12
11
  }
13
12
 
14
- export const argTypes = {
13
+ export const argTypes: ArgTypes = {
15
14
  title: {
16
15
  description: 'The alert title',
17
16
  },
@@ -23,7 +22,7 @@ export const argTypes = {
23
22
  control: 'boolean',
24
23
  table: {
25
24
  defaultValue: {
26
- summary: false,
25
+ summary: 'false',
27
26
  },
28
27
  },
29
28
  },
@@ -32,7 +31,7 @@ export const argTypes = {
32
31
  control: 'number',
33
32
  table: {
34
33
  defaultValue: {
35
- summary: 0,
34
+ summary: '0',
36
35
  },
37
36
  },
38
37
  },
@@ -55,7 +54,9 @@ export const argTypes = {
55
54
  control: 'radio',
56
55
  options: ['alert', 'alertdialog'],
57
56
  table: {
58
- defaultValue: 'alert',
57
+ defaultValue: {
58
+ summary: 'alert',
59
+ },
59
60
  },
60
61
  },
61
62
  // slots
@@ -3,9 +3,7 @@ import { expect } from '@/test/expect'
3
3
  import { within } from '@storybook/test'
4
4
 
5
5
  export async function defaultTest({ canvasElement, args }: PlayAttributes) {
6
- const element = (await within(canvasElement).findByTestId(
7
- 'element',
8
- )) as HTMLElement
6
+ const element = await within(canvasElement).findByTestId('element')
9
7
 
10
8
  expect(element).toHaveClass('vv-alert')
11
9
 
@@ -1,3 +1,4 @@
1
+ import type { ArgTypes } from '@storybook/vue3'
1
2
  import { ModifiersArgTypes } from '../argTypes'
2
3
 
3
4
  export const defaultArgs = {
@@ -28,7 +29,8 @@ export const defaultArgs = {
28
29
  stack: false,
29
30
  reverse: false,
30
31
  }
31
- export const argTypes = {
32
+
33
+ export const argTypes: ArgTypes = {
32
34
  name: {
33
35
  description: 'The alert group name',
34
36
  },
@@ -1,11 +1,9 @@
1
1
  import type { PlayAttributes } from '@/test/types'
2
2
  import { expect } from '@/test/expect'
3
- import { within } from '@storybook/test'
3
+ import { userEvent, within } from '@storybook/test'
4
4
 
5
5
  export async function defaultTest({ canvasElement, args }: PlayAttributes) {
6
- const element = (await within(canvasElement).findByTestId(
7
- 'element',
8
- )) as HTMLElement
6
+ const element = await within(canvasElement).findByTestId('element')
9
7
  const buttons =
10
8
  canvasElement.getElementsByClassName('buttons-container')?.[0]
11
9
 
@@ -75,9 +73,9 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
75
73
 
76
74
  if (buttons) {
77
75
  // click every button child and expect to have alert with correct css class
78
- for (let i = 0; i < buttons.children.length; i++) {
79
- const button = buttons.children[i] as HTMLElement
80
- await button.click()
76
+ for (const element of buttons.children) {
77
+ const button = element as HTMLElement
78
+ await userEvent.click(button)
81
79
  expect(alertGroupList.lastElementChild).toHaveClass(
82
80
  `vv-alert--${button.id}`,
83
81
  )
@@ -3,9 +3,7 @@ import { expect } from '@/test/expect'
3
3
  import { within } from '@storybook/test'
4
4
 
5
5
  export async function defaultTest({ canvasElement, args }: PlayAttributes) {
6
- const element = (await within(canvasElement).findByTestId(
7
- 'element',
8
- )) as HTMLElement
6
+ const element = await within(canvasElement).findByTestId('element')
9
7
 
10
8
  // slot default
11
9
  if (!args.default && !args.imgSrc) {
@@ -94,6 +94,7 @@ export const CustomColor: Story = {
94
94
  ...argTypes,
95
95
  modifiers: {
96
96
  ...argTypes.modifiers,
97
+ //@ts-ignore
97
98
  options: [...argTypes.modifiers.options, 'accent'],
98
99
  },
99
100
  },
@@ -1,5 +1,6 @@
1
1
  import { VvAvatarGroupProps } from '@/components/VvAvatarGroup'
2
2
  import { DefaultSlotArgTypes, ModifiersArgTypes } from '@/stories/argTypes'
3
+ import type { ArgTypes } from '@storybook/vue3'
3
4
 
4
5
  export const defaultArgs = {
5
6
  ...propsToObject(VvAvatarGroupProps),
@@ -25,7 +26,7 @@ export const defaultArgs = {
25
26
  avatarModifiers: 'rounded',
26
27
  }
27
28
 
28
- export const argTypes = {
29
+ export const argTypes: ArgTypes = {
29
30
  ...DefaultSlotArgTypes,
30
31
  default: {
31
32
  description: 'Default slot',
@@ -3,9 +3,7 @@ import { expect } from '@/test/expect'
3
3
  import { within } from '@storybook/test'
4
4
 
5
5
  export async function defaultTest({ canvasElement, args }: PlayAttributes) {
6
- const element = (await within(canvasElement).findByTestId(
7
- 'element',
8
- )) as HTMLElement
6
+ const element = await within(canvasElement).findByTestId('element')
9
7
 
10
8
  // slot default
11
9
  if (!args.default && !args.items && !args.items?.length) {
@@ -7,6 +7,7 @@ const meta: Meta<typeof VvAvatarGroup> = {
7
7
  title: 'Components/AvatarGroup/Modifiers',
8
8
  component: VvAvatarGroup,
9
9
  args: defaultArgs,
10
+ // @ts-ignore
10
11
  argTypes,
11
12
  }
12
13
 
@@ -1,10 +1,11 @@
1
1
  import { DefaultSlotArgTypes, ModifiersArgTypes } from '@/stories/argTypes'
2
+ import type { ArgTypes } from '@storybook/vue3'
2
3
 
3
4
  export const defaultArgs = {
4
5
  modifiers: [],
5
6
  }
6
7
 
7
- export const argTypes = {
8
+ export const argTypes: ArgTypes = {
8
9
  value: {
9
10
  control: { type: 'text' },
10
11
  },
@@ -18,7 +18,7 @@ type Story = StoryObj<typeof VvBadge>
18
18
  export const Default: Story = {
19
19
  args: {
20
20
  ...defaultArgs,
21
- value: 14
21
+ value: 14,
22
22
  },
23
23
  render: (args) => ({
24
24
  components: { VvBadge },
@@ -26,7 +26,7 @@ export const Default: Story = {
26
26
  return { args }
27
27
  },
28
28
  template: /*html*/ `
29
- <vv-badge v-bind="args">
29
+ <vv-badge v-bind="args" data-testId="element">
30
30
  <template #default v-if="args.default"><span v-html="args.default"></span></template>
31
31
  </vv-badge>
32
32
  `,
@@ -3,7 +3,7 @@ import { within } from '@storybook/test'
3
3
  import { expect } from '@/test/expect'
4
4
 
5
5
  export const defaultTest = async ({ canvasElement, args }: PlayAttributes) => {
6
- const badge = await within(canvasElement).findByRole('status')
6
+ const badge = await within(canvasElement).findByTestId('element')
7
7
  expect(badge).toHaveClass('vv-badge')
8
8
  if (args.modifiers.length > 0) {
9
9
  expect(badge).toHaveClass(`vv-badge--${args.modifiers}`)
@@ -1,4 +1,5 @@
1
1
  import { VvBreadcrumbProps } from '@/components/VvBreadcrumb'
2
+ import type { ArgTypes } from '@storybook/vue3'
2
3
 
3
4
  export const defaultArgs = {
4
5
  ...propsToObject(VvBreadcrumbProps),
@@ -20,7 +21,7 @@ export const defaultArgs = {
20
21
  ],
21
22
  }
22
23
 
23
- export const argTypes = {
24
+ export const argTypes: ArgTypes = {
24
25
  modifiers: {
25
26
  control: 'check',
26
27
  options: ['multiline'],
@@ -38,4 +38,4 @@ export const Multiline: Story = {
38
38
  ...defaultArgs,
39
39
  modifiers: 'multiline',
40
40
  },
41
- }
41
+ }
@@ -7,7 +7,7 @@ function linkClick(event: Event) {
7
7
 
8
8
  export async function defaultTest(
9
9
  data: PlayAttributes = {} as PlayAttributes,
10
- customSlot: boolean,
10
+ customSlot: boolean = false,
11
11
  ) {
12
12
  const breadcrumb = document.getElementsByClassName('vv-breadcrumb')[0]
13
13
 
@@ -1,4 +1,4 @@
1
- import type { Meta } from '@storybook/vue3'
1
+ import type { ArgTypes, Meta } from '@storybook/vue3'
2
2
  import type { VvButton } from '@/components'
3
3
  import {
4
4
  DefaultSlotArgTypes,
@@ -23,7 +23,8 @@ export const defaultArgs: Meta<typeof VvButton>['args'] = {
23
23
  icon: undefined,
24
24
  }
25
25
 
26
- export const argTypes = {
26
+ // @ts-ignore
27
+ export const argTypes: ArgTypes = {
27
28
  modifiers: {
28
29
  ...ModifiersArgTypes.modifiers,
29
30
  options: [
@@ -59,7 +60,6 @@ export const argTypes = {
59
60
  label: {
60
61
  table: {
61
62
  category: '',
62
- type: '',
63
63
  },
64
64
  description: 'The label of the button',
65
65
  control: { type: 'text' },
@@ -68,7 +68,7 @@ export const argTypes = {
68
68
  description: 'Whether the button is toggleable',
69
69
  control: { type: 'boolean' },
70
70
  table: {
71
- defaultValue: { summary: false },
71
+ defaultValue: { summary: 'false' },
72
72
  },
73
73
  },
74
74
  value: {
@@ -90,14 +90,14 @@ export const argTypes = {
90
90
  description: 'Whether the button is pressed',
91
91
  control: { type: 'boolean' },
92
92
  table: {
93
- defaultValue: { summary: false },
93
+ defaultValue: { summary: 'false' },
94
94
  },
95
95
  },
96
96
  active: {
97
97
  description: 'Whether the button is active',
98
98
  control: { type: 'boolean' },
99
99
  table: {
100
- defaultValue: { summary: false },
100
+ defaultValue: { summary: 'false' },
101
101
  },
102
102
  },
103
103
  rel: {
@@ -35,4 +35,4 @@ export const Default: Story = {
35
35
  `,
36
36
  }),
37
37
  play: defaultTest,
38
- }
38
+ }
@@ -5,9 +5,7 @@ import { expect } from '@/test/expect'
5
5
  export async function defaultTest(
6
6
  { canvasElement, args }: PlayAttributes = {} as PlayAttributes,
7
7
  ) {
8
- const element = (await within(canvasElement).findByTestId(
9
- 'element',
10
- )) as HTMLElement
8
+ const element = await within(canvasElement).findByTestId('element')
11
9
 
12
10
  const modifiers =
13
11
  !args.modifiers || Array.isArray(args.modifiers)
@@ -5,13 +5,15 @@ import {
5
5
  } from '@/stories/argTypes'
6
6
  import { VvButtonGroupProps } from '@/components/VvButtonGroup'
7
7
  import { argTypes as buttonArgTypes } from '../Button/Button.settings'
8
+ import type { ArgTypes } from '@storybook/vue3'
8
9
 
9
10
  export const defaultArgs = {
10
11
  ...propsToObject(VvButtonGroupProps),
11
12
  modifiers: [],
12
13
  }
13
14
 
14
- export const argTypes = {
15
+ // @ts-ignore
16
+ export const argTypes: ArgTypes = {
15
17
  modelValue: {
16
18
  table: {
17
19
  disable: true,
@@ -27,6 +29,14 @@ export const argTypes = {
27
29
  type: 'check',
28
30
  },
29
31
  },
32
+ legend: {
33
+ control: {
34
+ type: 'text',
35
+ table: {
36
+ category: 'Slots',
37
+ },
38
+ },
39
+ },
30
40
  ...UnselectableArgTypes,
31
41
  ...DefaultSlotArgTypes,
32
42
  }
@@ -36,4 +36,4 @@ export const Default: Story = {
36
36
  `,
37
37
  }),
38
38
  play: defaultTest,
39
- }
39
+ }