@volverjs/ui-vue 0.0.10-beta.27 → 0.0.10-beta.29
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/README.md +8 -7
- package/dist/components/VvAction/VvAction.es.js +17 -4
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.es.js +13 -11
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +17 -17
- package/dist/components/VvAlert/index.d.ts +12 -8
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +13 -2
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +3 -3
- package/dist/components/VvAlertGroup/index.d.ts +2 -14
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +17 -4
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +30 -7
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +3 -3
- package/dist/components/VvCombobox/VvCombobox.es.js +31 -7
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +5 -5
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +1 -1
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +6 -6
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +17 -4
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +1 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +11 -11
- package/dist/components/VvInputFile/VvInputFile.es.js +30 -7
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +1 -0
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +1 -1
- package/dist/components/VvNav/VvNav.es.js +17 -4
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +3 -3
- package/dist/components/VvNavItem/VvNavItem.es.js +17 -4
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
- package/dist/components/VvTab/VvTab.es.js +17 -4
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +1 -1
- package/dist/components/index.es.js +44 -9
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlert.d.ts +80 -18
- package/dist/composables/index.es.js +6 -4
- package/dist/composables/index.umd.js +1 -1
- package/dist/composables/usePersistence.d.ts +1 -1
- package/dist/constants.d.ts +5 -2
- package/dist/icons.es.js +226 -226
- package/dist/icons.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +8 -8
- package/dist/test/expect.d.ts +1 -1
- package/dist/types/alert.d.ts +9 -7
- package/package.json +43 -53
- 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/VvAction/VvAction.vue +13 -3
- package/src/components/VvAlert/index.ts +13 -6
- package/src/components/VvAlertGroup/index.ts +3 -16
- package/src/components/VvButton/VvButton.vue +11 -1
- package/src/components/VvDropdown/VvDropdownOption.vue +1 -0
- package/src/composables/alert/useAlert.ts +12 -9
- package/src/constants.ts +7 -2
- package/src/stories/Accordion/Accordion.test.ts +1 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +1 -1
- package/src/stories/Alert/Alert.test.ts +1 -1
- package/src/stories/AlertGroup/AlertGroup.test.ts +1 -1
- package/src/stories/Avatar/Avatar.test.ts +1 -1
- package/src/stories/AvatarGroup/AvatarGroup.test.ts +1 -1
- package/src/stories/Badge/Badge.test.ts +1 -1
- package/src/stories/Button/Button.test.ts +1 -1
- package/src/stories/ButtonGroup/ButtonGroup.test.ts +1 -1
- package/src/stories/Card/Card.test.ts +1 -1
- package/src/stories/Checkbox/Checkbox.test.ts +1 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.test.ts +1 -1
- package/src/stories/Combobox/Combobox.test.ts +1 -1
- package/src/stories/Dialog/Dialog.test.ts +2 -2
- package/src/stories/Dropdown/Dropdown.test.ts +1 -1
- package/src/stories/InputText/InputText.test.ts +1 -1
- package/src/stories/Nav/Nav.test.ts +1 -1
- package/src/stories/Progress/Progress.test.ts +1 -1
- package/src/stories/Radio/Radio.test.ts +1 -1
- package/src/stories/RadioGroup/RadioGroup.test.ts +1 -1
- package/src/stories/Select/Select.test.ts +1 -1
- package/src/stories/Tab/Tab.test.ts +1 -1
- package/src/stories/Textarea/Textarea.test.ts +1 -1
- package/src/stories/Tooltip/Tooltip.test.ts +1 -1
- package/src/test/expect.ts +2 -4
- package/src/types/alert.ts +11 -7
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// props and emit
|
|
12
12
|
const props = defineProps(VvActionProps)
|
|
13
13
|
const emit = defineEmits(VvActionEvents)
|
|
14
|
+
const instance = getCurrentInstance()
|
|
14
15
|
|
|
15
16
|
// inject plugin
|
|
16
17
|
const volver = useVolver()
|
|
@@ -104,24 +105,33 @@
|
|
|
104
105
|
e.preventDefault()
|
|
105
106
|
return
|
|
106
107
|
}
|
|
108
|
+
if (instance?.vnode.props?.onClick) {
|
|
109
|
+
emit('click', e)
|
|
110
|
+
return
|
|
111
|
+
}
|
|
107
112
|
dropdownEventBus?.emit('click', e)
|
|
108
|
-
emit('click', e)
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
/**
|
|
112
116
|
* @description Catch mouseover event
|
|
113
117
|
*/
|
|
114
118
|
const onMouseover = (e: Event) => {
|
|
119
|
+
if (instance?.vnode.props?.onMouseover) {
|
|
120
|
+
emit('mouseover', e)
|
|
121
|
+
return
|
|
122
|
+
}
|
|
115
123
|
dropdownEventBus?.emit('mouseover', e)
|
|
116
|
-
emit('mouseover', e)
|
|
117
124
|
}
|
|
118
125
|
|
|
119
126
|
/**
|
|
120
127
|
* @description Catch mouseleave event
|
|
121
128
|
*/
|
|
122
129
|
const onMouseleave = (e: Event) => {
|
|
130
|
+
if (instance?.vnode.props?.onMouseleave) {
|
|
131
|
+
emit('mouseleave', e)
|
|
132
|
+
return
|
|
133
|
+
}
|
|
123
134
|
dropdownEventBus?.emit('mouseleave', e)
|
|
124
|
-
emit('mouseleave', e)
|
|
125
135
|
}
|
|
126
136
|
</script>
|
|
127
137
|
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { type ExtractPropTypes, type PropType, withModifiers } from 'vue'
|
|
2
|
+
import { AlertRole } from '@/constants'
|
|
3
|
+
import { IconProps, IdProps } from '@/props'
|
|
4
|
+
import type { AlertModifier } from '@/types'
|
|
4
5
|
|
|
5
6
|
export const VvAlertProps = {
|
|
6
7
|
...IdProps,
|
|
7
|
-
...ModifiersProps,
|
|
8
8
|
...IconProps,
|
|
9
|
+
/**
|
|
10
|
+
* Component BEM modifiers
|
|
11
|
+
*/
|
|
12
|
+
modifiers: {
|
|
13
|
+
type: [String, Array] as PropType<AlertModifier | AlertModifier[]>,
|
|
14
|
+
default: undefined,
|
|
15
|
+
},
|
|
9
16
|
/**
|
|
10
17
|
* The alert is dismissable
|
|
11
18
|
* @default false
|
|
@@ -69,8 +76,8 @@ export const VvAlertProps = {
|
|
|
69
76
|
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Alertdialog_role
|
|
70
77
|
*/
|
|
71
78
|
role: {
|
|
72
|
-
type: String as PropType
|
|
73
|
-
default:
|
|
79
|
+
type: String as PropType<`${AlertRole}`>,
|
|
80
|
+
default: AlertRole.alert,
|
|
74
81
|
},
|
|
75
82
|
}
|
|
76
83
|
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import { ModifiersProps } from '@/props'
|
|
2
1
|
import type { ExtractPropTypes } from 'vue'
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
export type AlertItem = {
|
|
6
|
-
id: string | number
|
|
7
|
-
title?: string
|
|
8
|
-
icon?: string | VvIconProps
|
|
9
|
-
content?: string
|
|
10
|
-
footer?: string
|
|
11
|
-
modifiers?: string | string[]
|
|
12
|
-
dismissable?: boolean
|
|
13
|
-
autoClose?: number
|
|
14
|
-
closeLabel?: string
|
|
15
|
-
role?: 'alert' | 'alertdialog'
|
|
16
|
-
}
|
|
2
|
+
import type { Alert } from '@/types'
|
|
3
|
+
import { ModifiersProps } from '@/props'
|
|
17
4
|
|
|
18
5
|
export const VvAlertGroupProps = {
|
|
19
6
|
...ModifiersProps,
|
|
@@ -22,7 +9,7 @@ export const VvAlertGroupProps = {
|
|
|
22
9
|
required: true,
|
|
23
10
|
},
|
|
24
11
|
items: {
|
|
25
|
-
type: Array as PropType<
|
|
12
|
+
type: Array as PropType<Alert[]>,
|
|
26
13
|
default: () => [],
|
|
27
14
|
},
|
|
28
15
|
stack: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
export default {
|
|
3
3
|
name: 'VvButton',
|
|
4
|
+
inheritAttrs: false,
|
|
4
5
|
}
|
|
5
6
|
</script>
|
|
6
7
|
|
|
@@ -82,6 +83,14 @@
|
|
|
82
83
|
const toggleValue = computed(() => {
|
|
83
84
|
return props.value !== undefined ? props.value : name.value
|
|
84
85
|
})
|
|
86
|
+
const hasListeners = computed(() => {
|
|
87
|
+
if (!toggle.value) {
|
|
88
|
+
return undefined
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
onClick,
|
|
92
|
+
}
|
|
93
|
+
})
|
|
85
94
|
const onClick = () => {
|
|
86
95
|
if (toggle.value) {
|
|
87
96
|
if (Array.isArray(modelValue.value)) {
|
|
@@ -108,6 +117,8 @@
|
|
|
108
117
|
<template>
|
|
109
118
|
<VvAction
|
|
110
119
|
v-bind="{
|
|
120
|
+
...attrs,
|
|
121
|
+
...hasListeners,
|
|
111
122
|
disabled,
|
|
112
123
|
pressed,
|
|
113
124
|
active,
|
|
@@ -121,7 +132,6 @@
|
|
|
121
132
|
:id="hasId"
|
|
122
133
|
ref="element"
|
|
123
134
|
:class="bemCssClasses"
|
|
124
|
-
@click="onClick"
|
|
125
135
|
>
|
|
126
136
|
<!-- @slot Default slot -->
|
|
127
137
|
<slot>
|
|
@@ -6,11 +6,13 @@ import {
|
|
|
6
6
|
DEFAULT_ALERT_INFO_ICON,
|
|
7
7
|
DefaultAlertIconMap,
|
|
8
8
|
} from '@/constants'
|
|
9
|
-
import type { Alert,
|
|
9
|
+
import type { Alert, AlertModifier } from '@/types/alert'
|
|
10
|
+
|
|
11
|
+
type AlertInGroup = Alert & { timestamp: number; group: string }
|
|
10
12
|
|
|
11
13
|
const groups = reactive(
|
|
12
|
-
new Map<string, Map<string,
|
|
13
|
-
[DEFAULT_ALERT_GROUP, new Map<string,
|
|
14
|
+
new Map<string, Map<string, AlertInGroup>>([
|
|
15
|
+
[DEFAULT_ALERT_GROUP, new Map<string, AlertInGroup>()],
|
|
14
16
|
]),
|
|
15
17
|
)
|
|
16
18
|
|
|
@@ -45,10 +47,11 @@ export const useAlert = () => {
|
|
|
45
47
|
modifiers = DEFAULT_ALERT_MODIFIERS,
|
|
46
48
|
dismissable = DEFAULT_ALERT_DISMISSABLE,
|
|
47
49
|
autoClose = DEFAULT_ALERT_AUTO_CLOSE,
|
|
48
|
-
|
|
50
|
+
timestamp = Date.now(),
|
|
51
|
+
} = {} as Partial<AlertInGroup>,
|
|
49
52
|
) => {
|
|
50
53
|
if (!groups.has(group)) {
|
|
51
|
-
groups.set(group, new Map<string,
|
|
54
|
+
groups.set(group, new Map<string, AlertInGroup>())
|
|
52
55
|
}
|
|
53
56
|
const groupMap = groups.get(group)
|
|
54
57
|
const normalizedModifiers =
|
|
@@ -56,8 +59,8 @@ export const useAlert = () => {
|
|
|
56
59
|
|
|
57
60
|
if (!icon) {
|
|
58
61
|
const alertModifier = normalizedModifiers.find((modifier) =>
|
|
59
|
-
DefaultAlertIconMap.has(modifier as
|
|
60
|
-
) as
|
|
62
|
+
DefaultAlertIconMap.has(modifier as AlertModifier),
|
|
63
|
+
) as AlertModifier | undefined
|
|
61
64
|
|
|
62
65
|
if (alertModifier) {
|
|
63
66
|
icon = DefaultAlertIconMap.get(alertModifier) as string
|
|
@@ -73,7 +76,7 @@ export const useAlert = () => {
|
|
|
73
76
|
modifiers,
|
|
74
77
|
dismissable,
|
|
75
78
|
autoClose,
|
|
76
|
-
timestamp
|
|
79
|
+
timestamp,
|
|
77
80
|
})
|
|
78
81
|
}
|
|
79
82
|
|
|
@@ -88,7 +91,7 @@ export const useAlert = () => {
|
|
|
88
91
|
return groupMap && groupMap instanceof Map
|
|
89
92
|
? Array.from(groupMap?.values()).sort(
|
|
90
93
|
(a, b) => a.timestamp - b.timestamp,
|
|
91
|
-
|
|
94
|
+
)
|
|
92
95
|
: []
|
|
93
96
|
})
|
|
94
97
|
}
|
package/src/constants.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { InjectionKey, Ref } from 'vue'
|
|
2
2
|
import type { Emitter } from 'mitt'
|
|
3
3
|
import type { Volver } from './Volver'
|
|
4
|
-
import type { AlertModifiers } from './types/alert'
|
|
5
4
|
import type {
|
|
6
5
|
AccordionGroupState,
|
|
7
6
|
InputGroupState,
|
|
8
7
|
ButtonGroupState,
|
|
9
8
|
AlertGroupState,
|
|
9
|
+
AlertModifier,
|
|
10
10
|
} from './types'
|
|
11
11
|
|
|
12
12
|
export const DEFAULT_ICONIFY_PROVIDER = 'vv'
|
|
@@ -73,6 +73,11 @@ export enum DropdownItemRole {
|
|
|
73
73
|
presentation = 'presentation',
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
export enum AlertRole {
|
|
77
|
+
alert = 'alert',
|
|
78
|
+
alertdialog = 'alertdialog',
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
// volver
|
|
77
82
|
export const INJECTION_KEY_VOLVER = Symbol.for('volver') as InjectionKey<Volver>
|
|
78
83
|
|
|
@@ -140,7 +145,7 @@ export const DEFAULT_ALERT_INFO_ICON = 'information'
|
|
|
140
145
|
export const DEFAULT_ALERT_SUCCESS_ICON = 'check-circle'
|
|
141
146
|
export const DEFAULT_ALERT_WARNING_ICON = 'warning'
|
|
142
147
|
export const DEFAULT_ALERT_DANGER_ICON = 'error'
|
|
143
|
-
export const DefaultAlertIconMap = new Map<
|
|
148
|
+
export const DefaultAlertIconMap = new Map<AlertModifier, string>([
|
|
144
149
|
['success', DEFAULT_ALERT_SUCCESS_ICON],
|
|
145
150
|
['info', DEFAULT_ALERT_INFO_ICON],
|
|
146
151
|
['warning', DEFAULT_ALERT_WARNING_ICON],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within } from '@storybook/
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
|
|
6
6
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
7
7
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within } from '@storybook/
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
|
|
6
6
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
7
7
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
|
-
import { within } from '@storybook/
|
|
2
|
+
import { within } from '@storybook/test'
|
|
3
3
|
import { expect } from '@/test/expect'
|
|
4
4
|
|
|
5
5
|
export const defaultTest = async ({ canvasElement, args }: PlayAttributes) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest(
|
|
6
6
|
{ canvasElement, args }: PlayAttributes = {} as PlayAttributes,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaulTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within } from '@storybook/
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
|
|
6
6
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
7
7
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within } from '@storybook/
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
import { getOptionValue } from '@/test/options'
|
|
6
6
|
|
|
7
7
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
import { sleep } from '@/test/sleep'
|
|
5
5
|
import { defaultTest as selectDefaultTest } from '@/stories/Select/Select.test'
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { userEvent } from '@storybook/
|
|
4
|
-
import { within } from '@storybook/
|
|
3
|
+
import { userEvent } from '@storybook/test'
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
import { sleep } from '@/test/sleep'
|
|
6
6
|
|
|
7
7
|
export async function defaultTest(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within } from '@storybook/
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
|
|
6
6
|
export async function defaultTest({ canvasElement }: PlayAttributes) {
|
|
7
7
|
const wrapper = (await within(canvasElement).findByTestId(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within, userEvent } from '@storybook/
|
|
4
|
+
import { within, userEvent } from '@storybook/test'
|
|
5
5
|
import { INPUT_TYPES, type InputType } from '@/components/VvInputText'
|
|
6
6
|
|
|
7
7
|
const valueByType = (type: InputType, mask?: string, id?: string) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from '@/test/expect'
|
|
2
2
|
import type { PlayAttributes } from '@/test/types'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement }: PlayAttributes) {
|
|
6
6
|
const progress = await within(canvasElement).findByRole('progressbar')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within } from '@storybook/
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
|
|
6
6
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
7
7
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within } from '@storybook/
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
import { getOptionValue } from '@/test/options'
|
|
6
6
|
|
|
7
7
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
|
-
import { within } from '@storybook/
|
|
3
|
+
import { within } from '@storybook/test'
|
|
4
4
|
|
|
5
5
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
6
6
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within, userEvent } from '@storybook/
|
|
4
|
+
import { within, userEvent } from '@storybook/test'
|
|
5
5
|
|
|
6
6
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
7
7
|
const element = (await within(canvasElement).findByTestId(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlayAttributes } from '@/test/types'
|
|
2
2
|
import { expect } from '@/test/expect'
|
|
3
3
|
import { sleep } from '@/test/sleep'
|
|
4
|
-
import { within } from '@storybook/
|
|
4
|
+
import { within } from '@storybook/test'
|
|
5
5
|
|
|
6
6
|
export async function defaultTest({ canvasElement, args }: PlayAttributes) {
|
|
7
7
|
const parentElement = (await within(canvasElement).findByTestId(
|
package/src/test/expect.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { expect } from '@storybook/
|
|
2
|
-
import { userEvent } from '@storybook/testing-library'
|
|
1
|
+
import { userEvent, expect } from '@storybook/test'
|
|
3
2
|
import { axe } from 'jest-axe'
|
|
4
3
|
import { sleep } from '@/test/sleep'
|
|
5
4
|
|
|
@@ -79,8 +78,7 @@ expect.extend({
|
|
|
79
78
|
const img = element.getElementsByTagName(imgTag)
|
|
80
79
|
return {
|
|
81
80
|
pass: img.length === 1,
|
|
82
|
-
message: () =>
|
|
83
|
-
`${imgTag} not exist!`,
|
|
81
|
+
message: () => `${imgTag} not exist!`,
|
|
84
82
|
}
|
|
85
83
|
},
|
|
86
84
|
})
|
package/src/types/alert.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import type { VvIconProps } from '@/components/VvIcon'
|
|
2
|
+
import { AlertRole } from '@/constants'
|
|
3
|
+
|
|
4
|
+
export type AlertModifier =
|
|
2
5
|
| 'success'
|
|
3
6
|
| 'info'
|
|
4
7
|
| 'warning'
|
|
5
8
|
| 'danger'
|
|
6
9
|
| 'brand'
|
|
7
10
|
| 'accent'
|
|
11
|
+
| string
|
|
8
12
|
|
|
9
13
|
export type Alert = {
|
|
10
14
|
id: string | number
|
|
11
|
-
group: string
|
|
12
15
|
title?: string
|
|
13
|
-
icon
|
|
16
|
+
icon?: string | VvIconProps
|
|
14
17
|
content?: string
|
|
15
18
|
footer?: string
|
|
16
|
-
modifiers
|
|
17
|
-
dismissable
|
|
18
|
-
autoClose
|
|
19
|
-
|
|
19
|
+
modifiers?: AlertModifier | AlertModifier[]
|
|
20
|
+
dismissable?: boolean
|
|
21
|
+
autoClose?: number
|
|
22
|
+
closeLabel?: string
|
|
23
|
+
role?: AlertRole
|
|
20
24
|
}
|