@antify/ui 3.0.0 → 3.1.0
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/AntToast.vue +6 -6
- package/dist/components/AntToaster.vue +42 -15
- package/dist/components/__stories/AntToaster.stories.js +2 -2
- package/dist/components/__stories/AntToaster.stories.mjs +2 -2
- package/dist/composables/useToaster.d.ts +1 -0
- package/dist/composables/useToaster.js +7 -4
- package/dist/composables/useToaster.mjs +7 -4
- package/package.json +1 -1
|
@@ -43,15 +43,15 @@ const icons = {
|
|
|
43
43
|
const _icon = computed(() => icons[props.state]);
|
|
44
44
|
const classes = computed(() => {
|
|
45
45
|
const variants: Record<InputState, string> = {
|
|
46
|
-
[InputState.base]: '
|
|
47
|
-
[InputState.danger]: '
|
|
48
|
-
[InputState.info]: '
|
|
49
|
-
[InputState.success]: '
|
|
50
|
-
[InputState.warning]: '
|
|
46
|
+
[InputState.base]: 'border-base-500 text-base-500',
|
|
47
|
+
[InputState.danger]: 'border-danger-500 text-danger-500',
|
|
48
|
+
[InputState.info]: 'border-info-500 text-info-500',
|
|
49
|
+
[InputState.success]: 'border-success-500 text-success-500',
|
|
50
|
+
[InputState.warning]: 'border-warning-500 text-warning-500',
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
return {
|
|
54
|
-
'inline-flex flex-col gap-2 rounded-md p-2 border transition-colors shadow-md': true,
|
|
54
|
+
'bg-white inline-flex flex-col gap-2 rounded-md p-2 border transition-colors shadow-md': true,
|
|
55
55
|
[variants[props.state]]: true,
|
|
56
56
|
};
|
|
57
57
|
});
|
|
@@ -21,6 +21,24 @@ const props = withDefaults(defineProps<{
|
|
|
21
21
|
position: CornerPosition.bottomLeft,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
const _toasts = computed(() => {
|
|
25
|
+
if(props.position === CornerPosition.topLeft || props.position === CornerPosition.topRight) {
|
|
26
|
+
return props.toasts;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
...props.toasts,
|
|
31
|
+
].reverse();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const transitionName = computed(() => {
|
|
35
|
+
if(props.position === CornerPosition.topLeft || props.position === CornerPosition.topRight) {
|
|
36
|
+
return 'list-top';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return 'list-bottom';
|
|
40
|
+
});
|
|
41
|
+
|
|
24
42
|
const classes = computed(() => ({
|
|
25
43
|
'left-0 top-0 items-start': props.position === CornerPosition.topLeft,
|
|
26
44
|
'right-0 top-0 items-end': props.position === CornerPosition.topRight,
|
|
@@ -35,9 +53,9 @@ const classes = computed(() => ({
|
|
|
35
53
|
:class="classes"
|
|
36
54
|
data-e2e="toaster"
|
|
37
55
|
>
|
|
38
|
-
<TransitionGroup name="
|
|
56
|
+
<TransitionGroup :name="transitionName">
|
|
39
57
|
<AntToast
|
|
40
|
-
v-for="toast of
|
|
58
|
+
v-for="toast of _toasts"
|
|
41
59
|
:key="`ant-toast-${toast.id}`"
|
|
42
60
|
:title="toast.title"
|
|
43
61
|
:state="toast.type"
|
|
@@ -56,24 +74,33 @@ const classes = computed(() => ({
|
|
|
56
74
|
</template>
|
|
57
75
|
|
|
58
76
|
<style>
|
|
59
|
-
.list-move {
|
|
60
|
-
transition:
|
|
77
|
+
.list-top-move, .list-bottom-move {
|
|
78
|
+
transition: transform 0.3s ease, opacity 0.3s ease;
|
|
79
|
+
}
|
|
80
|
+
.list-top-enter-active,
|
|
81
|
+
.list-top-leave-active,
|
|
82
|
+
.list-bottom-enter-active,
|
|
83
|
+
.list-bottom-leave-active {
|
|
84
|
+
transition: opacity 0.3s, transform 0.3s;
|
|
61
85
|
}
|
|
62
86
|
|
|
63
|
-
.list-enter-
|
|
64
|
-
|
|
87
|
+
.list-top-enter-from,
|
|
88
|
+
.list-top-leave-to {
|
|
89
|
+
opacity: 0;
|
|
90
|
+
transform: scale(0.8) translateY(-20px);
|
|
65
91
|
}
|
|
66
92
|
|
|
67
|
-
.list-
|
|
68
|
-
|
|
93
|
+
.list-bottom-enter-from,
|
|
94
|
+
.list-bottom-leave-to {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
transform: scale(0.8) translateY(20px);
|
|
69
97
|
}
|
|
70
98
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
99
|
+
.list-top-enter-to,
|
|
100
|
+
.list-top-leave-from,
|
|
101
|
+
.list-bottom-enter-to,
|
|
102
|
+
.list-bottom-leave-from {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
transform: scale(1) translateY(0);
|
|
78
105
|
}
|
|
79
106
|
</style>
|
|
@@ -60,7 +60,7 @@ const Docs = exports.Docs = {
|
|
|
60
60
|
},
|
|
61
61
|
template: `
|
|
62
62
|
<div class="dashed h-60 relative">
|
|
63
|
-
<AntToaster v-bind="args"/>
|
|
63
|
+
<AntToaster v-bind="args" />
|
|
64
64
|
</div>
|
|
65
65
|
`
|
|
66
66
|
}),
|
|
@@ -122,7 +122,7 @@ const UseToaster = exports.UseToaster = {
|
|
|
122
122
|
</AntButton>
|
|
123
123
|
</AntFormGroup>
|
|
124
124
|
|
|
125
|
-
<AntToaster v-bind="args" :toasts="toaster.getToasts()"/>
|
|
125
|
+
<AntToaster v-bind="args" :toasts="toaster.getToasts()" />
|
|
126
126
|
`
|
|
127
127
|
})
|
|
128
128
|
};
|
|
@@ -60,7 +60,7 @@ export const Docs = {
|
|
|
60
60
|
},
|
|
61
61
|
template: `
|
|
62
62
|
<div class="dashed h-60 relative">
|
|
63
|
-
<AntToaster v-bind="args"/>
|
|
63
|
+
<AntToaster v-bind="args" />
|
|
64
64
|
</div>
|
|
65
65
|
`
|
|
66
66
|
}),
|
|
@@ -130,7 +130,7 @@ export const UseToaster = {
|
|
|
130
130
|
</AntButton>
|
|
131
131
|
</AntFormGroup>
|
|
132
132
|
|
|
133
|
-
<AntToaster v-bind="args" :toasts="toaster.getToasts()"/>
|
|
133
|
+
<AntToaster v-bind="args" :toasts="toaster.getToasts()" />
|
|
134
134
|
`
|
|
135
135
|
})
|
|
136
136
|
};
|
|
@@ -56,16 +56,19 @@ const useToaster = () => {
|
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
58
|
toastDeleted() {
|
|
59
|
-
this.toastSuccess("
|
|
59
|
+
this.toastSuccess("Gel\xF6scht");
|
|
60
60
|
},
|
|
61
61
|
toastCreated() {
|
|
62
|
-
this.toastSuccess("
|
|
62
|
+
this.toastSuccess("Gespeichert");
|
|
63
63
|
},
|
|
64
64
|
toastUpdated() {
|
|
65
|
-
this.toastSuccess("
|
|
65
|
+
this.toastSuccess("Gespeichert");
|
|
66
66
|
},
|
|
67
67
|
toastDuplicated() {
|
|
68
|
-
this.toastSuccess("
|
|
68
|
+
this.toastSuccess("Dupliziert");
|
|
69
|
+
},
|
|
70
|
+
toastInvalidFormInfo() {
|
|
71
|
+
this.toastInfo("Das Formular enth\xE4lt Fehler.\nBitte \xFCberpr\xFCfe alle Felder und behebe die Fehler.");
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
74
|
};
|
|
@@ -56,16 +56,19 @@ export const useToaster = () => {
|
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
58
|
toastDeleted() {
|
|
59
|
-
this.toastSuccess("
|
|
59
|
+
this.toastSuccess("Gel\xF6scht");
|
|
60
60
|
},
|
|
61
61
|
toastCreated() {
|
|
62
|
-
this.toastSuccess("
|
|
62
|
+
this.toastSuccess("Gespeichert");
|
|
63
63
|
},
|
|
64
64
|
toastUpdated() {
|
|
65
|
-
this.toastSuccess("
|
|
65
|
+
this.toastSuccess("Gespeichert");
|
|
66
66
|
},
|
|
67
67
|
toastDuplicated() {
|
|
68
|
-
this.toastSuccess("
|
|
68
|
+
this.toastSuccess("Dupliziert");
|
|
69
|
+
},
|
|
70
|
+
toastInvalidFormInfo() {
|
|
71
|
+
this.toastInfo("Das Formular enth\xE4lt Fehler.\nBitte \xFCberpr\xFCfe alle Felder und behebe die Fehler.");
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
74
|
};
|