@antify/ui 3.0.0 → 3.1.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.
@@ -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]: 'bg-base-100 border-base-500 text-base-500',
47
- [InputState.danger]: 'bg-danger-100 border-danger-500 text-danger-500',
48
- [InputState.info]: 'bg-info-100 border-info-500 text-info-500',
49
- [InputState.success]: 'bg-success-100 border-success-500 text-success-500',
50
- [InputState.warning]: 'bg-warning-100 border-warning-500 text-warning-500',
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="list">
56
+ <TransitionGroup :name="transitionName">
39
57
  <AntToast
40
- v-for="toast of toasts"
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: all 0.5s ease;
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-active {
64
- animation: fade-in .6s;
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-leave-active {
68
- animation: fade-in .4s reverse;
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
- @keyframes fade-in {
72
- 0% {
73
- opacity: 0;
74
- }
75
- 100% {
76
- opacity: 1;
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
  };
@@ -18,4 +18,5 @@ export declare const useToaster: () => {
18
18
  toastCreated(): void;
19
19
  toastUpdated(): void;
20
20
  toastDuplicated(): void;
21
+ toastInvalidFormInfo(): void;
21
22
  };
@@ -56,16 +56,19 @@ const useToaster = () => {
56
56
  });
57
57
  },
58
58
  toastDeleted() {
59
- this.toastSuccess("Deleted");
59
+ this.toastSuccess("Gel\xF6scht");
60
60
  },
61
61
  toastCreated() {
62
- this.toastSuccess("Saved");
62
+ this.toastSuccess("Gespeichert");
63
63
  },
64
64
  toastUpdated() {
65
- this.toastSuccess("Saved");
65
+ this.toastSuccess("Gespeichert");
66
66
  },
67
67
  toastDuplicated() {
68
- this.toastSuccess("Duplicated");
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("Deleted");
59
+ this.toastSuccess("Gel\xF6scht");
60
60
  },
61
61
  toastCreated() {
62
- this.toastSuccess("Saved");
62
+ this.toastSuccess("Gespeichert");
63
63
  },
64
64
  toastUpdated() {
65
- this.toastSuccess("Saved");
65
+ this.toastSuccess("Gespeichert");
66
66
  },
67
67
  toastDuplicated() {
68
- this.toastSuccess("Duplicated");
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antify/ui",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {