@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.
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +1 -131
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +4 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.es.js +5 -5
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +6 -7
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +1 -6
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +4 -8
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +2 -8
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +3 -8
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +0 -22
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +16 -7
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +7 -0
- package/dist/components/VvButtonGroup/index.d.ts +3 -0
- package/dist/components/VvCard/VvCard.es.js +1 -6
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +2 -23
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +6 -24
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +12 -31
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +29 -23
- package/dist/components/VvCombobox/index.d.ts +7 -7
- package/dist/components/VvDialog/VvDialog.es.js +1 -6
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +23 -23
- package/dist/components/VvDropdown/index.d.ts +7 -7
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +0 -5
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +1 -6
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +0 -22
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +11 -3
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvNav/VvNav.es.js +8 -10
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +4 -1
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +3 -3
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +0 -22
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +4 -23
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvTab/VvTab.es.js +7 -9
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/index.es.js +82 -68
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +7 -7
- package/dist/stories/Accordion/Accordion.settings.d.ts +2 -57
- package/dist/stories/AccordionGroup/AccordionGroup.settings.d.ts +2 -66
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -181
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +370 -11
- package/dist/stories/Alert/Alert.settings.d.ts +2 -109
- package/dist/stories/AlertGroup/AlertGroup.settings.d.ts +2 -85
- package/dist/stories/AvatarGroup/AvatarGroup.settings.d.ts +2 -38
- package/dist/stories/Badge/Badge.settings.d.ts +2 -26
- package/dist/stories/Breadcrumb/Breadcrumb.settings.d.ts +2 -18
- package/dist/stories/Breadcrumb/Breadcrumb.test.d.ts +1 -1
- package/dist/stories/Button/Button.settings.d.ts +2 -193
- package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +2 -40
- package/dist/stories/Card/Card.settings.d.ts +2 -63
- package/dist/stories/Checkbox/Checkbox.settings.d.ts +2 -132
- package/dist/stories/CheckboxGroup/CheckboxGroup.settings.d.ts +1 -141
- package/dist/stories/Combobox/Combobox.settings.d.ts +2 -617
- package/dist/stories/Dialog/Dialog.settings.d.ts +2 -47
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +2 -205
- package/dist/stories/Icon/Icon.settings.d.ts +2 -68
- package/dist/stories/InputFile/InputFile.settings.d.ts +2 -52
- package/dist/stories/InputText/InputText.settings.d.ts +2 -438
- package/dist/stories/Nav/Nav.settings.d.ts +2 -10
- package/dist/stories/Progress/Progress.settings.d.ts +2 -27
- package/dist/stories/Radio/Radio.settings.d.ts +1 -110
- package/dist/stories/RadioGroup/RadioGroup.settings.d.ts +1 -141
- package/dist/stories/Select/Select.settings.d.ts +2 -246
- package/dist/stories/Textarea/Textarea.settings.d.ts +2 -287
- package/dist/stories/argTypes.d.ts +27 -866
- package/package.json +45 -45
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAlert/index.ts +4 -4
- package/src/components/VvAlertGroup/VvAlertGroup.vue +0 -1
- package/src/components/VvBadge/VvBadge.vue +1 -1
- package/src/components/VvButtonGroup/VvButtonGroup.vue +11 -2
- package/src/components/VvButtonGroup/index.ts +1 -0
- package/src/components/VvCheckbox/VvCheckbox.vue +2 -5
- package/src/components/VvCombobox/VvCombobox.vue +2 -1
- package/src/components/VvInputText/VvInputText.vue +15 -4
- package/src/components/VvNav/VvNav.vue +1 -6
- package/src/components/VvNav/VvNavItem.vue +1 -1
- package/src/components/VvProgress/VvProgress.vue +0 -1
- package/src/composables/alert/useAlert.ts +3 -3
- package/src/stories/Accordion/Accordion.settings.ts +3 -2
- package/src/stories/AccordionGroup/AccordionGroup.settings.ts +4 -3
- package/src/stories/AccordionGroup/AccordionGroup.stories.ts +4 -2
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +2 -6
- package/src/stories/Alert/Alert.settings.ts +8 -7
- package/src/stories/Alert/Alert.test.ts +1 -3
- package/src/stories/AlertGroup/AlertGroup.settings.ts +3 -1
- package/src/stories/AlertGroup/AlertGroup.test.ts +5 -7
- package/src/stories/Avatar/Avatar.test.ts +1 -3
- package/src/stories/Avatar/AvatarModifiers.stories.ts +1 -0
- package/src/stories/AvatarGroup/AvatarGroup.settings.ts +2 -1
- package/src/stories/AvatarGroup/AvatarGroup.test.ts +1 -3
- package/src/stories/AvatarGroup/AvatarGroupModifiers.stories.ts +1 -0
- package/src/stories/Badge/Badge.settings.ts +2 -1
- package/src/stories/Badge/Badge.stories.ts +2 -2
- package/src/stories/Badge/Badge.test.ts +1 -1
- package/src/stories/Breadcrumb/Breadcrumb.settings.ts +2 -1
- package/src/stories/Breadcrumb/Breadcrumb.stories.ts +1 -1
- package/src/stories/Breadcrumb/Breadcrumb.test.ts +1 -1
- package/src/stories/Button/Button.settings.ts +6 -6
- package/src/stories/Button/Button.stories.ts +1 -1
- package/src/stories/Button/Button.test.ts +1 -3
- package/src/stories/ButtonGroup/ButtonGroup.settings.ts +11 -1
- package/src/stories/ButtonGroup/ButtonGroup.stories.ts +1 -1
- package/src/stories/ButtonGroup/ButtonGroup.test.ts +2 -6
- package/src/stories/Card/Card.settings.ts +2 -1
- package/src/stories/Card/Card.test.ts +1 -3
- package/src/stories/Checkbox/Checkbox.settings.ts +5 -3
- package/src/stories/Checkbox/Checkbox.test.ts +2 -6
- package/src/stories/Checkbox/CheckboxBinary.stories.ts +1 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.test.ts +2 -6
- package/src/stories/Combobox/Combobox.settings.ts +10 -10
- package/src/stories/Combobox/Combobox.test.ts +2 -6
- package/src/stories/Dialog/Dialog.settings.ts +2 -1
- package/src/stories/Dialog/Dialog.test.ts +3 -8
- package/src/stories/Dropdown/Dropdown.settings.ts +2 -1
- package/src/stories/Dropdown/Dropdown.test.ts +2 -6
- package/src/stories/Dropdown/DropdownSlots.stories.ts +1 -1
- package/src/stories/Icon/Icon.settings.ts +2 -1
- package/src/stories/Icon/Icon.stories.ts +0 -1
- package/src/stories/InputFile/InputFile.settings.ts +2 -1
- package/src/stories/InputText/InputText.settings.ts +8 -6
- package/src/stories/InputText/InputText.test.ts +2 -6
- package/src/stories/InputText/InputTextMinMax.stories.ts +1 -1
- package/src/stories/Nav/Nav.settings.ts +2 -2
- package/src/stories/Nav/Nav.stories.ts +1 -1
- package/src/stories/Nav/Nav.test.ts +2 -4
- package/src/stories/Progress/Progress.settings.ts +2 -1
- package/src/stories/Radio/Radio.test.ts +2 -6
- package/src/stories/RadioGroup/RadioGroup.stories.ts +1 -2
- package/src/stories/RadioGroup/RadioGroup.test.ts +2 -6
- package/src/stories/RadioGroup/RadioGroupOptions.stories.ts +1 -1
- package/src/stories/Select/Select.settings.ts +4 -3
- package/src/stories/Select/Select.test.ts +3 -9
- package/src/stories/Select/SelectIconPosition.stories.ts +2 -2
- package/src/stories/Select/SelectOptions.stories.ts +0 -1
- package/src/stories/Tab/Tab.test.ts +3 -5
- package/src/stories/Textarea/Textarea.settings.ts +5 -3
- package/src/stories/Textarea/Textarea.test.ts +2 -6
- package/src/stories/Tooltip/Tooltip.settings.ts +1 -1
- package/src/stories/Tooltip/Tooltip.test.ts +3 -5
- 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 =
|
|
141
|
+
const onMouseover = () => {
|
|
142
142
|
isMouseover.value = true
|
|
143
143
|
if (timeout) {
|
|
144
144
|
clearTimeout(timeout)
|
|
145
145
|
}
|
|
146
|
-
}
|
|
147
|
-
const onMouseleave =
|
|
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
|
-
}
|
|
152
|
+
}
|
|
153
153
|
|
|
154
154
|
return {
|
|
155
155
|
close,
|
|
@@ -66,8 +66,17 @@
|
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
68
|
<template>
|
|
69
|
-
<
|
|
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
|
-
</
|
|
81
|
+
</fieldset>
|
|
73
82
|
</template>
|
|
@@ -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(
|
|
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 (
|
|
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"
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
DEFAULT_ALERT_INFO_ICON,
|
|
7
7
|
DefaultAlertIconMap,
|
|
8
8
|
} from '@/constants'
|
|
9
|
-
import type { 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
|
|
63
|
-
)
|
|
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
|
-
|
|
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
|
-
}
|
|
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 =
|
|
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 =
|
|
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:
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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 (
|
|
79
|
-
const button =
|
|
80
|
-
await
|
|
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 =
|
|
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) {
|
|
@@ -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 =
|
|
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) {
|
|
@@ -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).
|
|
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'],
|
|
@@ -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
|
-
|
|
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: {
|
|
@@ -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 =
|
|
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
|
-
|
|
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
|
}
|