@nuralyui/toast 0.0.2 → 0.0.10
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/bundle.js +1302 -0
- package/index.d.ts +7 -0
- package/index.js +7 -0
- package/index.js.map +1 -1
- package/package.json +40 -5
- package/react.d.ts +5 -3
- package/react.js +12 -5
- package/react.js.map +1 -1
- package/toast.component.d.ts +152 -7
- package/toast.component.js +350 -62
- package/toast.component.js.map +1 -1
- package/toast.style.d.ts +13 -2
- package/toast.style.js +336 -69
- package/toast.style.js.map +1 -1
- package/toast.types.d.ts +124 -0
- package/toast.types.js +9 -0
- package/toast.types.js.map +1 -0
- package/demo/toast-demo.d.ts +0 -34
- package/demo/toast-demo.d.ts.map +0 -1
- package/demo/toast-demo.js +0 -353
- package/demo/toast-demo.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/react.d.ts.map +0 -1
- package/toast.component.d.ts.map +0 -1
- package/toast.style.d.ts.map +0 -1
package/toast.style.js
CHANGED
|
@@ -1,71 +1,338 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
top: var(--
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
transform: translateX(-50%)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
/**
|
|
8
|
+
* Toast component styles for the Hybrid UI Library
|
|
9
|
+
* Using shared CSS variables from /src/shared/themes/
|
|
10
|
+
*
|
|
11
|
+
* This file contains all the styling for the nr-toast component with
|
|
12
|
+
* clean CSS variable usage without local fallbacks and proper theme switching support.
|
|
13
|
+
*/
|
|
14
|
+
export const styles = css `
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
position: fixed;
|
|
18
|
+
z-index: var(--nuraly-z-index-toast);
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
|
|
21
|
+
/* Force CSS custom property inheritance to ensure theme switching works properly */
|
|
22
|
+
color: var(--nuraly-color-text);
|
|
23
|
+
font-family: var(--nuraly-font-family);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Container positioning */
|
|
27
|
+
:host([position="top-right"]) {
|
|
28
|
+
top: var(--nuraly-spacing-4);
|
|
29
|
+
right: var(--nuraly-spacing-4);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([position="top-left"]) {
|
|
33
|
+
top: var(--nuraly-spacing-4);
|
|
34
|
+
left: var(--nuraly-spacing-4);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([position="top-center"]) {
|
|
38
|
+
top: var(--nuraly-spacing-4);
|
|
39
|
+
left: 50%;
|
|
40
|
+
transform: translateX(-50%);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([position="bottom-right"]) {
|
|
44
|
+
bottom: var(--nuraly-spacing-4);
|
|
45
|
+
right: var(--nuraly-spacing-4);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([position="bottom-left"]) {
|
|
49
|
+
bottom: var(--nuraly-spacing-4);
|
|
50
|
+
left: var(--nuraly-spacing-4);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([position="bottom-center"]) {
|
|
54
|
+
bottom: var(--nuraly-spacing-4);
|
|
55
|
+
left: 50%;
|
|
56
|
+
transform: translateX(-50%);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.toast-container {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: var(--nuraly-toast-stack-gap);
|
|
63
|
+
min-width: var(--nuraly-toast-min-width);
|
|
64
|
+
max-width: var(--nuraly-toast-max-width);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.toast {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: start;
|
|
70
|
+
gap: var(--nuraly-toast-gap);
|
|
71
|
+
padding: var(--nuraly-toast-padding-vertical) var(--nuraly-toast-padding-horizontal);
|
|
72
|
+
background-color: var(--nuraly-color-background);
|
|
73
|
+
color: var(--nuraly-color-text);
|
|
74
|
+
border: 1px solid var(--nuraly-color-border);
|
|
75
|
+
border-radius: var(--nuraly-border-radius-toast);
|
|
76
|
+
box-shadow: var(--nuraly-shadow-toast);
|
|
77
|
+
pointer-events: auto;
|
|
78
|
+
cursor: default;
|
|
79
|
+
transition: all var(--nuraly-transition-fast) ease;
|
|
80
|
+
position: relative;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.toast:hover {
|
|
85
|
+
box-shadow: var(--nuraly-shadow-toast-hover);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Toast type variants */
|
|
89
|
+
.toast--default {
|
|
90
|
+
background-color: var(--nuraly-toast-default-background);
|
|
91
|
+
border-color: var(--nuraly-toast-default-border);
|
|
92
|
+
color: var(--nuraly-toast-default-text);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.toast--success {
|
|
96
|
+
background-color: var(--nuraly-toast-success-background);
|
|
97
|
+
border-color: var(--nuraly-toast-success-border);
|
|
98
|
+
color: var(--nuraly-toast-success-text);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.toast--error {
|
|
102
|
+
background-color: var(--nuraly-toast-error-background);
|
|
103
|
+
border-color: var(--nuraly-toast-error-border);
|
|
104
|
+
color: var(--nuraly-toast-error-text);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.toast--warning {
|
|
108
|
+
background-color: var(--nuraly-toast-warning-background);
|
|
109
|
+
border-color: var(--nuraly-toast-warning-border);
|
|
110
|
+
color: var(--nuraly-toast-warning-text);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.toast--info {
|
|
114
|
+
background-color: var(--nuraly-toast-info-background);
|
|
115
|
+
border-color: var(--nuraly-toast-info-border);
|
|
116
|
+
color: var(--nuraly-toast-info-text);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Toast icon */
|
|
120
|
+
.toast__icon {
|
|
121
|
+
flex-shrink: 0;
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
margin-top: 0.125rem; /* Slight adjustment for better visual alignment */
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.toast__icon nr-icon {
|
|
129
|
+
color: inherit;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Toast content */
|
|
133
|
+
.toast__content {
|
|
134
|
+
flex: 1;
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
gap: var(--nuraly-spacing-2);
|
|
138
|
+
min-width: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.toast__text {
|
|
142
|
+
font-size: var(--nuraly-font-size-sm);
|
|
143
|
+
line-height: 1.5;
|
|
144
|
+
word-break: break-word;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Toast button */
|
|
148
|
+
.toast__button {
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
margin-top: var(--nuraly-spacing-1);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.toast__button nr-button {
|
|
155
|
+
flex-shrink: 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Close button */
|
|
159
|
+
.toast__close {
|
|
160
|
+
flex-shrink: 0;
|
|
161
|
+
min-width: var(--nuraly-toast-close-size);
|
|
162
|
+
min-height: var(--nuraly-toast-close-size);
|
|
163
|
+
padding: 0;
|
|
164
|
+
border: none;
|
|
165
|
+
background: transparent;
|
|
166
|
+
color: currentColor;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
display: flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
justify-content: center;
|
|
171
|
+
border-radius: var(--nuraly-border-radius-small);
|
|
172
|
+
transition: all var(--nuraly-transition-fast) ease;
|
|
173
|
+
opacity: var(--nuraly-toast-close-opacity);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.toast__close:hover {
|
|
177
|
+
opacity: var(--nuraly-toast-close-opacity-hover);
|
|
178
|
+
background-color: var(--nuraly-toast-close-hover-background);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.toast__close:focus {
|
|
182
|
+
outline: var(--nuraly-focus-outline);
|
|
183
|
+
outline-offset: var(--nuraly-focus-outline-offset);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.toast__close nr-icon {
|
|
187
|
+
color: inherit;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* Animations */
|
|
191
|
+
@keyframes toast-fade-in {
|
|
192
|
+
from {
|
|
193
|
+
opacity: 0;
|
|
194
|
+
transform: translateY(-1rem);
|
|
195
|
+
}
|
|
196
|
+
to {
|
|
197
|
+
opacity: 1;
|
|
198
|
+
transform: translateY(0);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@keyframes toast-fade-out {
|
|
203
|
+
from {
|
|
204
|
+
opacity: 1;
|
|
205
|
+
transform: translateY(0);
|
|
206
|
+
}
|
|
207
|
+
to {
|
|
208
|
+
opacity: 0;
|
|
209
|
+
transform: translateY(-1rem);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@keyframes toast-slide-in-right {
|
|
214
|
+
from {
|
|
215
|
+
opacity: 0;
|
|
216
|
+
transform: translateX(100%);
|
|
217
|
+
}
|
|
218
|
+
to {
|
|
219
|
+
opacity: 1;
|
|
220
|
+
transform: translateX(0);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@keyframes toast-slide-out-right {
|
|
225
|
+
from {
|
|
226
|
+
opacity: 1;
|
|
227
|
+
transform: translateX(0);
|
|
228
|
+
}
|
|
229
|
+
to {
|
|
230
|
+
opacity: 0;
|
|
231
|
+
transform: translateX(100%);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@keyframes toast-slide-in-left {
|
|
236
|
+
from {
|
|
237
|
+
opacity: 0;
|
|
238
|
+
transform: translateX(-100%);
|
|
239
|
+
}
|
|
240
|
+
to {
|
|
241
|
+
opacity: 1;
|
|
242
|
+
transform: translateX(0);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@keyframes toast-slide-out-left {
|
|
247
|
+
from {
|
|
248
|
+
opacity: 1;
|
|
249
|
+
transform: translateX(0);
|
|
250
|
+
}
|
|
251
|
+
to {
|
|
252
|
+
opacity: 0;
|
|
253
|
+
transform: translateX(-100%);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@keyframes toast-bounce-in {
|
|
258
|
+
0% {
|
|
259
|
+
opacity: 0;
|
|
260
|
+
transform: scale(0.3);
|
|
261
|
+
}
|
|
262
|
+
50% {
|
|
263
|
+
transform: scale(1.05);
|
|
264
|
+
}
|
|
265
|
+
70% {
|
|
266
|
+
transform: scale(0.9);
|
|
267
|
+
}
|
|
268
|
+
100% {
|
|
269
|
+
opacity: 1;
|
|
270
|
+
transform: scale(1);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@keyframes toast-bounce-out {
|
|
275
|
+
0% {
|
|
276
|
+
transform: scale(1);
|
|
277
|
+
}
|
|
278
|
+
25% {
|
|
279
|
+
transform: scale(0.95);
|
|
280
|
+
}
|
|
281
|
+
50% {
|
|
282
|
+
opacity: 1;
|
|
283
|
+
transform: scale(1.1);
|
|
284
|
+
}
|
|
285
|
+
100% {
|
|
286
|
+
opacity: 0;
|
|
287
|
+
transform: scale(0.3);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* Animation classes */
|
|
292
|
+
.toast--fade-in {
|
|
293
|
+
animation: toast-fade-in var(--nuraly-transition-toast) ease;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.toast--fade-out {
|
|
297
|
+
animation: toast-fade-out var(--nuraly-transition-toast) ease;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.toast--slide-in {
|
|
301
|
+
animation: toast-slide-in-right var(--nuraly-transition-toast) ease;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.toast--slide-out {
|
|
305
|
+
animation: toast-slide-out-right var(--nuraly-transition-toast) ease;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.toast--bounce-in {
|
|
309
|
+
animation: toast-bounce-in var(--nuraly-transition-toast) ease;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.toast--bounce-out {
|
|
313
|
+
animation: toast-bounce-out var(--nuraly-transition-toast) ease;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* Position-specific slide animations */
|
|
317
|
+
:host([position="top-left"]) .toast--slide-in,
|
|
318
|
+
:host([position="bottom-left"]) .toast--slide-in {
|
|
319
|
+
animation: toast-slide-in-left var(--nuraly-transition-toast) ease;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
:host([position="top-left"]) .toast--slide-out,
|
|
323
|
+
:host([position="bottom-left"]) .toast--slide-out {
|
|
324
|
+
animation: toast-slide-out-left var(--nuraly-transition-toast) ease;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/* Progress bar for duration indicator */
|
|
328
|
+
.toast__progress {
|
|
329
|
+
position: absolute;
|
|
330
|
+
bottom: 0;
|
|
331
|
+
left: 0;
|
|
332
|
+
height: var(--nuraly-toast-progress-height);
|
|
333
|
+
background-color: currentColor;
|
|
334
|
+
opacity: var(--nuraly-toast-progress-opacity);
|
|
335
|
+
transition: width linear;
|
|
336
|
+
}
|
|
70
337
|
`;
|
|
71
338
|
//# sourceMappingURL=toast.style.js.map
|
package/toast.style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.style.js","sourceRoot":"","sources":["../../../src/components/toast/toast.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,
|
|
1
|
+
{"version":3,"file":"toast.style.js","sourceRoot":"","sources":["../../../src/components/toast/toast.style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmUxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { css } from 'lit';\n\n/**\n * Toast component styles for the Hybrid UI Library\n * Using shared CSS variables from /src/shared/themes/\n * \n * This file contains all the styling for the nr-toast component with\n * clean CSS variable usage without local fallbacks and proper theme switching support.\n */\nexport const styles = css`\n :host {\n display: block;\n position: fixed;\n z-index: var(--nuraly-z-index-toast);\n pointer-events: none;\n \n /* Force CSS custom property inheritance to ensure theme switching works properly */\n color: var(--nuraly-color-text);\n font-family: var(--nuraly-font-family);\n }\n\n /* Container positioning */\n :host([position=\"top-right\"]) {\n top: var(--nuraly-spacing-4);\n right: var(--nuraly-spacing-4);\n }\n\n :host([position=\"top-left\"]) {\n top: var(--nuraly-spacing-4);\n left: var(--nuraly-spacing-4);\n }\n\n :host([position=\"top-center\"]) {\n top: var(--nuraly-spacing-4);\n left: 50%;\n transform: translateX(-50%);\n }\n\n :host([position=\"bottom-right\"]) {\n bottom: var(--nuraly-spacing-4);\n right: var(--nuraly-spacing-4);\n }\n\n :host([position=\"bottom-left\"]) {\n bottom: var(--nuraly-spacing-4);\n left: var(--nuraly-spacing-4);\n }\n\n :host([position=\"bottom-center\"]) {\n bottom: var(--nuraly-spacing-4);\n left: 50%;\n transform: translateX(-50%);\n }\n\n .toast-container {\n display: flex;\n flex-direction: column;\n gap: var(--nuraly-toast-stack-gap);\n min-width: var(--nuraly-toast-min-width);\n max-width: var(--nuraly-toast-max-width);\n }\n\n .toast {\n display: flex;\n align-items: start;\n gap: var(--nuraly-toast-gap);\n padding: var(--nuraly-toast-padding-vertical) var(--nuraly-toast-padding-horizontal);\n background-color: var(--nuraly-color-background);\n color: var(--nuraly-color-text);\n border: 1px solid var(--nuraly-color-border);\n border-radius: var(--nuraly-border-radius-toast);\n box-shadow: var(--nuraly-shadow-toast);\n pointer-events: auto;\n cursor: default;\n transition: all var(--nuraly-transition-fast) ease;\n position: relative;\n overflow: hidden;\n }\n\n .toast:hover {\n box-shadow: var(--nuraly-shadow-toast-hover);\n }\n\n /* Toast type variants */\n .toast--default {\n background-color: var(--nuraly-toast-default-background);\n border-color: var(--nuraly-toast-default-border);\n color: var(--nuraly-toast-default-text);\n }\n\n .toast--success {\n background-color: var(--nuraly-toast-success-background);\n border-color: var(--nuraly-toast-success-border);\n color: var(--nuraly-toast-success-text);\n }\n\n .toast--error {\n background-color: var(--nuraly-toast-error-background);\n border-color: var(--nuraly-toast-error-border);\n color: var(--nuraly-toast-error-text);\n }\n\n .toast--warning {\n background-color: var(--nuraly-toast-warning-background);\n border-color: var(--nuraly-toast-warning-border);\n color: var(--nuraly-toast-warning-text);\n }\n\n .toast--info {\n background-color: var(--nuraly-toast-info-background);\n border-color: var(--nuraly-toast-info-border);\n color: var(--nuraly-toast-info-text);\n }\n\n /* Toast icon */\n .toast__icon {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-top: 0.125rem; /* Slight adjustment for better visual alignment */\n }\n\n .toast__icon nr-icon {\n color: inherit;\n }\n\n /* Toast content */\n .toast__content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: var(--nuraly-spacing-2);\n min-width: 0;\n }\n\n .toast__text {\n font-size: var(--nuraly-font-size-sm);\n line-height: 1.5;\n word-break: break-word;\n }\n\n /* Toast button */\n .toast__button {\n display: flex;\n align-items: center;\n margin-top: var(--nuraly-spacing-1);\n }\n\n .toast__button nr-button {\n flex-shrink: 0;\n }\n\n /* Close button */\n .toast__close {\n flex-shrink: 0;\n min-width: var(--nuraly-toast-close-size);\n min-height: var(--nuraly-toast-close-size);\n padding: 0;\n border: none;\n background: transparent;\n color: currentColor;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--nuraly-border-radius-small);\n transition: all var(--nuraly-transition-fast) ease;\n opacity: var(--nuraly-toast-close-opacity);\n }\n\n .toast__close:hover {\n opacity: var(--nuraly-toast-close-opacity-hover);\n background-color: var(--nuraly-toast-close-hover-background);\n }\n\n .toast__close:focus {\n outline: var(--nuraly-focus-outline);\n outline-offset: var(--nuraly-focus-outline-offset);\n }\n\n .toast__close nr-icon {\n color: inherit;\n }\n\n /* Animations */\n @keyframes toast-fade-in {\n from {\n opacity: 0;\n transform: translateY(-1rem);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes toast-fade-out {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-1rem);\n }\n }\n\n @keyframes toast-slide-in-right {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n\n @keyframes toast-slide-out-right {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(100%);\n }\n }\n\n @keyframes toast-slide-in-left {\n from {\n opacity: 0;\n transform: translateX(-100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n\n @keyframes toast-slide-out-left {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-100%);\n }\n }\n\n @keyframes toast-bounce-in {\n 0% {\n opacity: 0;\n transform: scale(0.3);\n }\n 50% {\n transform: scale(1.05);\n }\n 70% {\n transform: scale(0.9);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n @keyframes toast-bounce-out {\n 0% {\n transform: scale(1);\n }\n 25% {\n transform: scale(0.95);\n }\n 50% {\n opacity: 1;\n transform: scale(1.1);\n }\n 100% {\n opacity: 0;\n transform: scale(0.3);\n }\n }\n\n /* Animation classes */\n .toast--fade-in {\n animation: toast-fade-in var(--nuraly-transition-toast) ease;\n }\n\n .toast--fade-out {\n animation: toast-fade-out var(--nuraly-transition-toast) ease;\n }\n\n .toast--slide-in {\n animation: toast-slide-in-right var(--nuraly-transition-toast) ease;\n }\n\n .toast--slide-out {\n animation: toast-slide-out-right var(--nuraly-transition-toast) ease;\n }\n\n .toast--bounce-in {\n animation: toast-bounce-in var(--nuraly-transition-toast) ease;\n }\n\n .toast--bounce-out {\n animation: toast-bounce-out var(--nuraly-transition-toast) ease;\n }\n\n /* Position-specific slide animations */\n :host([position=\"top-left\"]) .toast--slide-in,\n :host([position=\"bottom-left\"]) .toast--slide-in {\n animation: toast-slide-in-left var(--nuraly-transition-toast) ease;\n }\n\n :host([position=\"top-left\"]) .toast--slide-out,\n :host([position=\"bottom-left\"]) .toast--slide-out {\n animation: toast-slide-out-left var(--nuraly-transition-toast) ease;\n }\n\n /* Progress bar for duration indicator */\n .toast__progress {\n position: absolute;\n bottom: 0;\n left: 0;\n height: var(--nuraly-toast-progress-height);\n background-color: currentColor;\n opacity: var(--nuraly-toast-progress-opacity);\n transition: width linear;\n }\n`;\n"]}
|
package/toast.types.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { TemplateResult } from 'lit';
|
|
7
|
+
/**
|
|
8
|
+
* Toast type variants
|
|
9
|
+
*/
|
|
10
|
+
export declare const enum ToastType {
|
|
11
|
+
Default = "default",
|
|
12
|
+
Success = "success",
|
|
13
|
+
Error = "error",
|
|
14
|
+
Warning = "warning",
|
|
15
|
+
Info = "info"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Toast position on screen
|
|
19
|
+
*/
|
|
20
|
+
export declare const enum ToastPosition {
|
|
21
|
+
TopRight = "top-right",
|
|
22
|
+
TopLeft = "top-left",
|
|
23
|
+
TopCenter = "top-center",
|
|
24
|
+
BottomRight = "bottom-right",
|
|
25
|
+
BottomLeft = "bottom-left",
|
|
26
|
+
BottomCenter = "bottom-center"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Toast animation types
|
|
30
|
+
*/
|
|
31
|
+
export declare const enum ToastAnimation {
|
|
32
|
+
Fade = "fade",
|
|
33
|
+
Slide = "slide",
|
|
34
|
+
Bounce = "bounce"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Predefined duration values in milliseconds
|
|
38
|
+
*/
|
|
39
|
+
export declare const enum ToastDuration {
|
|
40
|
+
Short = 3000,
|
|
41
|
+
Medium = 5000,
|
|
42
|
+
Long = 7000
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Toast action button configuration
|
|
46
|
+
*/
|
|
47
|
+
export interface ToastButton {
|
|
48
|
+
/** Button label text */
|
|
49
|
+
label: string;
|
|
50
|
+
/** Button click handler */
|
|
51
|
+
onClick: (event: Event) => void;
|
|
52
|
+
/** Button type/variant */
|
|
53
|
+
type?: 'default' | 'primary' | 'secondary' | 'tertiary' | 'danger' | 'ghost';
|
|
54
|
+
/** Button size */
|
|
55
|
+
size?: 'small' | 'medium' | 'large';
|
|
56
|
+
/** Whether button is disabled */
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
/** Icon name for button */
|
|
59
|
+
icon?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Individual toast configuration
|
|
63
|
+
*/
|
|
64
|
+
export interface ToastConfig {
|
|
65
|
+
/** Toast message text */
|
|
66
|
+
text?: string;
|
|
67
|
+
/** Custom HTML content (overrides text) */
|
|
68
|
+
content?: TemplateResult;
|
|
69
|
+
/** Toast type/variant */
|
|
70
|
+
type?: ToastType;
|
|
71
|
+
/** Duration in milliseconds */
|
|
72
|
+
duration?: number;
|
|
73
|
+
/** Auto dismiss after duration (default: true) */
|
|
74
|
+
autoDismiss?: boolean;
|
|
75
|
+
/** Show close button */
|
|
76
|
+
closable?: boolean;
|
|
77
|
+
/** Icon name to display */
|
|
78
|
+
icon?: string;
|
|
79
|
+
/** Custom CSS class */
|
|
80
|
+
customClass?: string;
|
|
81
|
+
/** Action button configuration */
|
|
82
|
+
button?: ToastButton;
|
|
83
|
+
/** Callback when toast is closed */
|
|
84
|
+
onClose?: () => void;
|
|
85
|
+
/** Callback when toast is clicked */
|
|
86
|
+
onClick?: () => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Internal toast item with metadata
|
|
90
|
+
*/
|
|
91
|
+
export interface ToastItem extends ToastConfig {
|
|
92
|
+
/** Unique identifier */
|
|
93
|
+
id: string;
|
|
94
|
+
/** Creation timestamp */
|
|
95
|
+
timestamp: number;
|
|
96
|
+
/** Whether toast is being removed */
|
|
97
|
+
removing?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Toast container configuration
|
|
101
|
+
*/
|
|
102
|
+
export interface ToastContainerConfig {
|
|
103
|
+
/** Position on screen */
|
|
104
|
+
position?: ToastPosition;
|
|
105
|
+
/** Maximum number of toasts to show */
|
|
106
|
+
maxToasts?: number;
|
|
107
|
+
/** Default duration */
|
|
108
|
+
defaultDuration?: number;
|
|
109
|
+
/** Animation type */
|
|
110
|
+
animation?: ToastAnimation;
|
|
111
|
+
/** Stack toasts or replace */
|
|
112
|
+
stack?: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Toast event detail
|
|
116
|
+
*/
|
|
117
|
+
export interface ToastEventDetail {
|
|
118
|
+
toast: ToastItem;
|
|
119
|
+
action: 'show' | 'close' | 'click';
|
|
120
|
+
}
|
|
121
|
+
export declare const EMPTY_STRING = "";
|
|
122
|
+
export declare const DEFAULT_TOAST_DURATION = ToastDuration.Medium;
|
|
123
|
+
export declare const DEFAULT_MAX_TOASTS = 5;
|
|
124
|
+
//# sourceMappingURL=toast.types.d.ts.map
|
package/toast.types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
export const EMPTY_STRING = '';
|
|
7
|
+
export const DEFAULT_TOAST_DURATION = 5000 /* ToastDuration.Medium */;
|
|
8
|
+
export const DEFAULT_MAX_TOASTS = 5;
|
|
9
|
+
//# sourceMappingURL=toast.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.types.js","sourceRoot":"","sources":["../../../src/components/toast/toast.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoJH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,sBAAsB,kCAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { TemplateResult } from 'lit';\n\n/**\n * Toast type variants\n */\nexport const enum ToastType {\n Default = 'default',\n Success = 'success',\n Error = 'error',\n Warning = 'warning',\n Info = 'info',\n}\n\n/**\n * Toast position on screen\n */\nexport const enum ToastPosition {\n TopRight = 'top-right',\n TopLeft = 'top-left',\n TopCenter = 'top-center',\n BottomRight = 'bottom-right',\n BottomLeft = 'bottom-left',\n BottomCenter = 'bottom-center',\n}\n\n/**\n * Toast animation types\n */\nexport const enum ToastAnimation {\n Fade = 'fade',\n Slide = 'slide',\n Bounce = 'bounce',\n}\n\n/**\n * Predefined duration values in milliseconds\n */\nexport const enum ToastDuration {\n Short = 3000,\n Medium = 5000,\n Long = 7000,\n}\n\n/**\n * Toast action button configuration\n */\nexport interface ToastButton {\n /** Button label text */\n label: string;\n \n /** Button click handler */\n onClick: (event: Event) => void;\n \n /** Button type/variant */\n type?: 'default' | 'primary' | 'secondary' | 'tertiary' | 'danger' | 'ghost';\n \n /** Button size */\n size?: 'small' | 'medium' | 'large';\n \n /** Whether button is disabled */\n disabled?: boolean;\n \n /** Icon name for button */\n icon?: string;\n}\n\n/**\n * Individual toast configuration\n */\nexport interface ToastConfig {\n /** Toast message text */\n text?: string;\n \n /** Custom HTML content (overrides text) */\n content?: TemplateResult;\n \n /** Toast type/variant */\n type?: ToastType;\n \n /** Duration in milliseconds */\n duration?: number;\n \n /** Auto dismiss after duration (default: true) */\n autoDismiss?: boolean;\n \n /** Show close button */\n closable?: boolean;\n \n /** Icon name to display */\n icon?: string;\n \n /** Custom CSS class */\n customClass?: string;\n \n /** Action button configuration */\n button?: ToastButton;\n \n /** Callback when toast is closed */\n onClose?: () => void;\n \n /** Callback when toast is clicked */\n onClick?: () => void;\n}\n\n/**\n * Internal toast item with metadata\n */\nexport interface ToastItem extends ToastConfig {\n /** Unique identifier */\n id: string;\n \n /** Creation timestamp */\n timestamp: number;\n \n /** Whether toast is being removed */\n removing?: boolean;\n}\n\n/**\n * Toast container configuration\n */\nexport interface ToastContainerConfig {\n /** Position on screen */\n position?: ToastPosition;\n \n /** Maximum number of toasts to show */\n maxToasts?: number;\n \n /** Default duration */\n defaultDuration?: number;\n \n /** Animation type */\n animation?: ToastAnimation;\n \n /** Stack toasts or replace */\n stack?: boolean;\n}\n\n/**\n * Toast event detail\n */\nexport interface ToastEventDetail {\n toast: ToastItem;\n action: 'show' | 'close' | 'click';\n}\n\nexport const EMPTY_STRING = '';\nexport const DEFAULT_TOAST_DURATION = ToastDuration.Medium;\nexport const DEFAULT_MAX_TOASTS = 5;\n"]}
|
package/demo/toast-demo.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2023 Google Laabidi Aymen
|
|
4
|
-
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/
|
|
6
|
-
import { LitElement } from 'lit';
|
|
7
|
-
export declare class ElMeenuElement extends LitElement {
|
|
8
|
-
toast: any;
|
|
9
|
-
_showOptions: boolean;
|
|
10
|
-
_message: string;
|
|
11
|
-
firstUpdated(): void;
|
|
12
|
-
_callToast(): void;
|
|
13
|
-
_updateMessage(event: any): void;
|
|
14
|
-
_updatePadding(event: any): void;
|
|
15
|
-
_updateBottom(event: any): void;
|
|
16
|
-
_updateZIndex(event: any): void;
|
|
17
|
-
_updateFontSize(event: any): void;
|
|
18
|
-
_updateBorderRadius(event: any): void;
|
|
19
|
-
_updateBorder(event: any): void;
|
|
20
|
-
_color: string;
|
|
21
|
-
_backgroundColor: string;
|
|
22
|
-
_fontFamily: string;
|
|
23
|
-
_borderRadius: string;
|
|
24
|
-
_border: string;
|
|
25
|
-
_zIndex: string;
|
|
26
|
-
_fontSize: string;
|
|
27
|
-
_padding: string;
|
|
28
|
-
_bottom: string;
|
|
29
|
-
_updateColor(event: any): void;
|
|
30
|
-
_updateBackgroundColor(event: any): void;
|
|
31
|
-
_updateFontFamily(event: any): void;
|
|
32
|
-
protected render(): import("lit").TemplateResult<1>;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=toast-demo.d.ts.map
|
package/demo/toast-demo.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toast-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/toast/demo/toast-demo.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAGrC,qBACa,cAAe,SAAQ,UAAU;IAE5C,KAAK,EAAG,GAAG,CAAE;IAGb,YAAY,UAAS;IAGrB,QAAQ,SAAM;IAEL,YAAY;IAYrB,UAAU;IAGV,cAAc,CAAC,KAAK,EAAC,GAAG;IAOxB,cAAc,CAAC,KAAK,EAAC,GAAG;IAQxB,aAAa,CAAC,KAAK,EAAC,GAAG;IAQvB,aAAa,CAAC,KAAK,EAAC,GAAG;IAQvB,eAAe,CAAC,KAAK,EAAC,GAAG;IAQzB,mBAAmB,CAAC,KAAK,EAAC,GAAG;IAQ7B,aAAa,CAAC,KAAK,EAAC,GAAG;IAQvB,MAAM,SAAM;IAEZ,gBAAgB,SAAM;IAEtB,WAAW,SAAM;IAEjB,aAAa,SAAM;IAEnB,OAAO,SAAM;IAEb,OAAO,SAAM;IAEb,SAAS,SAAM;IAEf,QAAQ,SAAM;IAEd,OAAO,SAAM;IAEb,YAAY,CAAC,KAAK,EAAC,GAAG;IAQtB,sBAAsB,CAAC,KAAK,EAAC,GAAG;IAWhC,iBAAiB,CAAC,KAAK,EAAC,GAAG;cAQR,MAAM;CAuM1B"}
|