|
4 | 4 | @notificationMotionEase: cubic-bezier(0.22, 1, 0.36, 1); |
5 | 5 | @notificationMotionOffset: 64px; |
6 | 6 |
|
| 7 | +.generate-placement(@placement, @vertical, @horizontal, @contentMargin, @stackClip, @motionX) { |
| 8 | + &-@{placement} { |
| 9 | + @{vertical}: 0; |
| 10 | + @{horizontal}: 0; |
| 11 | + display: flex; |
| 12 | + flex-direction: column; |
| 13 | + |
| 14 | + .@{notificationPrefixCls}-list-content { |
| 15 | + @{contentMargin}: auto; |
| 16 | + } |
| 17 | + |
| 18 | + .@{notificationPrefixCls}-notice { |
| 19 | + @{vertical}: var(--notification-y, 0); |
| 20 | + @{horizontal}: var(--notification-x, 0); |
| 21 | + transform-origin: center bottom; |
| 22 | + } |
| 23 | + |
| 24 | + .notification-fade-appear-prepare, |
| 25 | + .notification-fade-enter-prepare { |
| 26 | + opacity: 0; |
| 27 | + transform: translateX(@motionX) scale(var(--notification-scale, 1)); |
| 28 | + transition: none; |
| 29 | + } |
| 30 | + |
| 31 | + .notification-fade-appear-start, |
| 32 | + .notification-fade-enter-start { |
| 33 | + opacity: 0; |
| 34 | + transform: translateX(@motionX) scale(var(--notification-scale, 1)); |
| 35 | + } |
| 36 | + |
| 37 | + .notification-fade-appear-active, |
| 38 | + .notification-fade-enter-active { |
| 39 | + opacity: 1; |
| 40 | + transform: translateX(0) scale(var(--notification-scale, 1)); |
| 41 | + } |
| 42 | + |
| 43 | + .notification-fade-leave-start { |
| 44 | + opacity: 1; |
| 45 | + transform: translateX(0) scale(var(--notification-scale, 1)); |
| 46 | + } |
| 47 | + |
| 48 | + .notification-fade-leave-active { |
| 49 | + opacity: 0; |
| 50 | + transform: translateX(@motionX) scale(var(--notification-scale, 1)); |
| 51 | + } |
| 52 | + |
| 53 | + &.@{notificationPrefixCls}-stack:not(.@{notificationPrefixCls}-stack-expanded) { |
| 54 | + .@{notificationPrefixCls}-notice { |
| 55 | + clip-path: @stackClip; |
| 56 | + } |
| 57 | + |
| 58 | + .@{notificationPrefixCls}-notice[data-notification-index='0'] { |
| 59 | + clip-path: inset(-50% -50% -50% -50%); |
| 60 | + } |
| 61 | + } |
| 62 | + } |
| 63 | +} |
| 64 | + |
7 | 65 | .@{notificationPrefixCls} { |
8 | 66 | position: fixed; |
9 | | - top: 0; |
10 | | - right: 0; |
11 | 67 | z-index: 1000; |
12 | 68 | width: 360px; |
13 | 69 | height: 100vh; |
|
17 | 73 | overflow: hidden; |
18 | 74 | overscroll-behavior: contain; |
19 | 75 |
|
| 76 | + .generate-placement( |
| 77 | + topRight, |
| 78 | + top, |
| 79 | + right, |
| 80 | + margin-bottom, |
| 81 | + inset(50% -50% -50% -50%), |
| 82 | + @notificationMotionOffset |
| 83 | + ); |
| 84 | + .generate-placement( |
| 85 | + bottomRight, |
| 86 | + bottom, |
| 87 | + right, |
| 88 | + margin-top, |
| 89 | + inset(-50% -50% 50% -50%), |
| 90 | + @notificationMotionOffset |
| 91 | + ); |
| 92 | + .generate-placement( |
| 93 | + topLeft, |
| 94 | + top, |
| 95 | + left, |
| 96 | + margin-bottom, |
| 97 | + inset(50% -50% -50% -50%), |
| 98 | + -@notificationMotionOffset |
| 99 | + ); |
| 100 | + .generate-placement( |
| 101 | + bottomLeft, |
| 102 | + bottom, |
| 103 | + left, |
| 104 | + margin-top, |
| 105 | + inset(-50% -50% 50% -50%), |
| 106 | + -@notificationMotionOffset |
| 107 | + ); |
| 108 | + |
20 | 109 | &-list { |
21 | 110 | overflow-x: hidden; |
22 | 111 | overflow-y: auto; |
|
64 | 153 | box-sizing: border-box; |
65 | 154 | width: 100%; |
66 | 155 | // transform: translate3d(var(--notification-x, 0), var(--notification-y, 0), 0); |
67 | | - right: var(--notification-x, 0); |
68 | | - top: var(--notification-y, 0); |
69 | 156 | transform: scale(var(--notification-scale, 1)); |
70 | 157 | transition: |
71 | 158 | transform @notificationMotionDuration @notificationMotionEase, |
72 | 159 | inset @notificationMotionDuration @notificationMotionEase, |
73 | 160 | clip-path @notificationMotionDuration @notificationMotionEase, |
74 | 161 | opacity @notificationMotionDuration @notificationMotionEase; |
75 | | - transform-origin: center bottom; |
76 | 162 | padding: 14px 16px; |
77 | 163 | border: 2px solid #111; |
78 | 164 | border-radius: 14px; |
|
123 | 209 | &:not(.@{notificationPrefixCls}-stack-expanded) { |
124 | 210 | .@{notificationPrefixCls}-notice { |
125 | 211 | --notification-scale: ~'calc(1 - min(var(--notification-index, 0), 2) * 0.06)'; |
126 | | - clip-path: inset(50% -50% -50% -50%); |
127 | | - } |
128 | | - |
129 | | - .@{notificationPrefixCls}-notice[data-notification-index='0'] { |
130 | | - clip-path: inset(-50% -50% -50% -50%); |
131 | 212 | } |
132 | 213 |
|
133 | 214 | .@{notificationPrefixCls}-notice:not(.@{notificationPrefixCls}-notice-stack-in-threshold) { |
|
142 | 223 | backface-visibility: hidden; |
143 | 224 | will-change: transform, opacity; |
144 | 225 | } |
145 | | - |
146 | | -.notification-fade-appear-prepare, |
147 | | -.notification-fade-enter-prepare { |
148 | | - opacity: 0; |
149 | | - transform: translateX(@notificationMotionOffset) scale(var(--notification-scale, 1)); |
150 | | - transition: none; |
151 | | -} |
152 | | - |
153 | | -.notification-fade-appear-start, |
154 | | -.notification-fade-enter-start { |
155 | | - opacity: 0; |
156 | | - transform: translateX(@notificationMotionOffset) scale(var(--notification-scale, 1)); |
157 | | -} |
158 | | - |
159 | | -.notification-fade-appear-active, |
160 | | -.notification-fade-enter-active { |
161 | | - opacity: 1; |
162 | | - transform: translateX(0) scale(var(--notification-scale, 1)); |
163 | | -} |
164 | | - |
165 | | -.notification-fade-leave-start { |
166 | | - opacity: 1; |
167 | | - transform: translateX(0) scale(var(--notification-scale, 1)); |
168 | | -} |
169 | | - |
170 | | -.notification-fade-leave-active { |
171 | | - opacity: 0; |
172 | | - transform: translateX(@notificationMotionOffset) scale(var(--notification-scale, 1)); |
173 | | -} |
|
0 commit comments