@react-stately/toast 3.0.0-nightly.4624 → 3.0.0-nightly.4637
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.
|
@@ -70,11 +70,11 @@ class $c995945a643dde76$export$f1f8569633bbbec4 {
|
|
|
70
70
|
else low = mid + 1;
|
|
71
71
|
}
|
|
72
72
|
this.queue.splice(low, 0, toast);
|
|
73
|
-
toast.animation = low < this.maxVisibleToasts ?
|
|
73
|
+
toast.animation = low < this.maxVisibleToasts ? 'entering' : 'queued';
|
|
74
74
|
let i = this.maxVisibleToasts;
|
|
75
|
-
while(i < this.queue.length)this.queue[i++].animation =
|
|
75
|
+
while(i < this.queue.length)this.queue[i++].animation = 'queued';
|
|
76
76
|
this.updateVisibleToasts({
|
|
77
|
-
action:
|
|
77
|
+
action: 'add'
|
|
78
78
|
});
|
|
79
79
|
return toastKey;
|
|
80
80
|
}
|
|
@@ -89,31 +89,31 @@ class $c995945a643dde76$export$f1f8569633bbbec4 {
|
|
|
89
89
|
this.queue.splice(index, 1);
|
|
90
90
|
}
|
|
91
91
|
this.updateVisibleToasts({
|
|
92
|
-
action:
|
|
92
|
+
action: 'close',
|
|
93
93
|
key: key
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
/** Removes a toast from the visible toasts after an exiting animation. */ remove(key) {
|
|
97
97
|
this.updateVisibleToasts({
|
|
98
|
-
action:
|
|
98
|
+
action: 'remove',
|
|
99
99
|
key: key
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
updateVisibleToasts(options) {
|
|
103
103
|
let { action: action, key: key } = options;
|
|
104
104
|
let toasts = this.queue.slice(0, this.maxVisibleToasts);
|
|
105
|
-
if (action ===
|
|
105
|
+
if (action === 'add' && this.hasExitAnimation) {
|
|
106
106
|
let prevToasts = this.visibleToasts.filter((t)=>!toasts.some((t2)=>t.key === t2.key)).map((t)=>({
|
|
107
107
|
...t,
|
|
108
|
-
animation:
|
|
108
|
+
animation: 'exiting'
|
|
109
109
|
}));
|
|
110
110
|
this.visibleToasts = prevToasts.concat(toasts).sort((a, b)=>b.priority - a.priority);
|
|
111
|
-
} else if (action ===
|
|
111
|
+
} else if (action === 'close' && this.hasExitAnimation) // Cause a rerender to happen for exit animation
|
|
112
112
|
this.visibleToasts = this.visibleToasts.map((t)=>{
|
|
113
113
|
if (t.key !== key) return t;
|
|
114
114
|
else return {
|
|
115
115
|
...t,
|
|
116
|
-
animation:
|
|
116
|
+
animation: 'exiting'
|
|
117
117
|
};
|
|
118
118
|
});
|
|
119
119
|
else this.visibleToasts = toasts;
|
package/dist/useToastState.mjs
CHANGED
|
@@ -62,11 +62,11 @@ class $77b352cf12efcf73$export$f1f8569633bbbec4 {
|
|
|
62
62
|
else low = mid + 1;
|
|
63
63
|
}
|
|
64
64
|
this.queue.splice(low, 0, toast);
|
|
65
|
-
toast.animation = low < this.maxVisibleToasts ?
|
|
65
|
+
toast.animation = low < this.maxVisibleToasts ? 'entering' : 'queued';
|
|
66
66
|
let i = this.maxVisibleToasts;
|
|
67
|
-
while(i < this.queue.length)this.queue[i++].animation =
|
|
67
|
+
while(i < this.queue.length)this.queue[i++].animation = 'queued';
|
|
68
68
|
this.updateVisibleToasts({
|
|
69
|
-
action:
|
|
69
|
+
action: 'add'
|
|
70
70
|
});
|
|
71
71
|
return toastKey;
|
|
72
72
|
}
|
|
@@ -81,31 +81,31 @@ class $77b352cf12efcf73$export$f1f8569633bbbec4 {
|
|
|
81
81
|
this.queue.splice(index, 1);
|
|
82
82
|
}
|
|
83
83
|
this.updateVisibleToasts({
|
|
84
|
-
action:
|
|
84
|
+
action: 'close',
|
|
85
85
|
key: key
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
/** Removes a toast from the visible toasts after an exiting animation. */ remove(key) {
|
|
89
89
|
this.updateVisibleToasts({
|
|
90
|
-
action:
|
|
90
|
+
action: 'remove',
|
|
91
91
|
key: key
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
updateVisibleToasts(options) {
|
|
95
95
|
let { action: action, key: key } = options;
|
|
96
96
|
let toasts = this.queue.slice(0, this.maxVisibleToasts);
|
|
97
|
-
if (action ===
|
|
97
|
+
if (action === 'add' && this.hasExitAnimation) {
|
|
98
98
|
let prevToasts = this.visibleToasts.filter((t)=>!toasts.some((t2)=>t.key === t2.key)).map((t)=>({
|
|
99
99
|
...t,
|
|
100
|
-
animation:
|
|
100
|
+
animation: 'exiting'
|
|
101
101
|
}));
|
|
102
102
|
this.visibleToasts = prevToasts.concat(toasts).sort((a, b)=>b.priority - a.priority);
|
|
103
|
-
} else if (action ===
|
|
103
|
+
} else if (action === 'close' && this.hasExitAnimation) // Cause a rerender to happen for exit animation
|
|
104
104
|
this.visibleToasts = this.visibleToasts.map((t)=>{
|
|
105
105
|
if (t.key !== key) return t;
|
|
106
106
|
else return {
|
|
107
107
|
...t,
|
|
108
|
-
animation:
|
|
108
|
+
animation: 'exiting'
|
|
109
109
|
};
|
|
110
110
|
});
|
|
111
111
|
else this.visibleToasts = toasts;
|
|
@@ -62,11 +62,11 @@ class $77b352cf12efcf73$export$f1f8569633bbbec4 {
|
|
|
62
62
|
else low = mid + 1;
|
|
63
63
|
}
|
|
64
64
|
this.queue.splice(low, 0, toast);
|
|
65
|
-
toast.animation = low < this.maxVisibleToasts ?
|
|
65
|
+
toast.animation = low < this.maxVisibleToasts ? 'entering' : 'queued';
|
|
66
66
|
let i = this.maxVisibleToasts;
|
|
67
|
-
while(i < this.queue.length)this.queue[i++].animation =
|
|
67
|
+
while(i < this.queue.length)this.queue[i++].animation = 'queued';
|
|
68
68
|
this.updateVisibleToasts({
|
|
69
|
-
action:
|
|
69
|
+
action: 'add'
|
|
70
70
|
});
|
|
71
71
|
return toastKey;
|
|
72
72
|
}
|
|
@@ -81,31 +81,31 @@ class $77b352cf12efcf73$export$f1f8569633bbbec4 {
|
|
|
81
81
|
this.queue.splice(index, 1);
|
|
82
82
|
}
|
|
83
83
|
this.updateVisibleToasts({
|
|
84
|
-
action:
|
|
84
|
+
action: 'close',
|
|
85
85
|
key: key
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
/** Removes a toast from the visible toasts after an exiting animation. */ remove(key) {
|
|
89
89
|
this.updateVisibleToasts({
|
|
90
|
-
action:
|
|
90
|
+
action: 'remove',
|
|
91
91
|
key: key
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
updateVisibleToasts(options) {
|
|
95
95
|
let { action: action, key: key } = options;
|
|
96
96
|
let toasts = this.queue.slice(0, this.maxVisibleToasts);
|
|
97
|
-
if (action ===
|
|
97
|
+
if (action === 'add' && this.hasExitAnimation) {
|
|
98
98
|
let prevToasts = this.visibleToasts.filter((t)=>!toasts.some((t2)=>t.key === t2.key)).map((t)=>({
|
|
99
99
|
...t,
|
|
100
|
-
animation:
|
|
100
|
+
animation: 'exiting'
|
|
101
101
|
}));
|
|
102
102
|
this.visibleToasts = prevToasts.concat(toasts).sort((a, b)=>b.priority - a.priority);
|
|
103
|
-
} else if (action ===
|
|
103
|
+
} else if (action === 'close' && this.hasExitAnimation) // Cause a rerender to happen for exit animation
|
|
104
104
|
this.visibleToasts = this.visibleToasts.map((t)=>{
|
|
105
105
|
if (t.key !== key) return t;
|
|
106
106
|
else return {
|
|
107
107
|
...t,
|
|
108
|
-
animation:
|
|
108
|
+
animation: 'exiting'
|
|
109
109
|
};
|
|
110
110
|
});
|
|
111
111
|
else this.visibleToasts = toasts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/toast",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.4637+c57671e7f",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "c57671e7f57c4ffe59640a174f084cf660968913"
|
|
38
38
|
}
|