aio-popup 3.2.0 → 3.3.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.
Files changed (4) hide show
  1. package/index.css +123 -30
  2. package/index.d.ts +166 -0
  3. package/index.js +1285 -11
  4. package/package.json +3 -3
package/index.css CHANGED
@@ -1,4 +1,3 @@
1
- /*version 3.2.0*/
2
1
  .aio-popup-backdrop {
3
2
  position: fixed;
4
3
  display: flex;
@@ -125,6 +124,7 @@
125
124
  }
126
125
 
127
126
  .aio-popup-header {
127
+ display:flex;
128
128
  border-bottom: 1px solid #e7e9ec;
129
129
  background: #fff;
130
130
  color: #323130;
@@ -145,6 +145,9 @@
145
145
  width: 100%;
146
146
  overflow-y: auto;
147
147
  }
148
+ .aio-popup-body *{
149
+ box-sizing: border-box;
150
+ }
148
151
 
149
152
  .aio-popup-footer {
150
153
  background: #fff;
@@ -155,15 +158,22 @@
155
158
  border-top: 1px solid #f2f4f7;
156
159
  justify-content: flex-end;
157
160
  }
158
-
161
+ .aio-popup-header-buttons{
162
+ display:flex;
163
+ align-items: center;
164
+ justify-content: center;
165
+ gap:6px;
166
+ }
159
167
  .aio-popup-header-button {
160
168
  padding: 0 6px;
161
169
  background: none;
162
170
  border: none;
163
171
  cursor: pointer;
164
172
  }
165
-
166
173
  .aio-popup-header-close-button {
174
+ display:flex;
175
+ align-items: center;
176
+ justify-content: center;
167
177
  width: 36px;
168
178
  }
169
179
 
@@ -203,6 +213,12 @@
203
213
  align-items: center;
204
214
  justify-content: center;
205
215
  font-family: inherit;
216
+ transition:0.2s;
217
+ }
218
+
219
+ .aio-popup-alert-container.not-mounted{
220
+ background: rgba(0, 0, 0, 0);
221
+ transition:0.2;
206
222
  }
207
223
 
208
224
  .aio-popup-alert {
@@ -217,6 +233,31 @@
217
233
  overflow: hidden;
218
234
  }
219
235
 
236
+ .aio-popup-alert-container-center .aio-popup-alert{
237
+ transform:scale(1);
238
+ transition:0.2s;
239
+ }
240
+ .aio-popup-alert-container-center.not-mounted .aio-popup-alert {
241
+ transform:scale(0);
242
+ transition:0.2s;
243
+ }
244
+ .aio-popup-alert-container-top .aio-popup-alert{
245
+ transform:translateY(0vh);
246
+ transition:0.2s;
247
+ }
248
+ .aio-popup-alert-container-top.not-mounted .aio-popup-alert {
249
+ transform:translateY(-100vh);
250
+ transition:0.2s;
251
+ }
252
+ .aio-popup-alert-container-bottom .aio-popup-alert{
253
+ transform:translateY(0vh);
254
+ transition:0.2s;
255
+ }
256
+ .aio-popup-alert-container-bottom.not-mounted .aio-popup-alert {
257
+ transform:translateY(100vh);
258
+ transition:0.2s;
259
+ }
260
+
220
261
  .aio-popup-alert-error .aio-popup-alert-header svg {
221
262
  fill: red;
222
263
  }
@@ -271,9 +312,9 @@
271
312
 
272
313
  .aio-popup-time {
273
314
  position: absolute;
274
- height: 3px;
275
- width: calc(100% - 24px);
276
- left: 12px;
315
+ height: 4px;
316
+ width: 100%;
317
+ left: 0;
277
318
  bottom: 0;
278
319
  }
279
320
 
@@ -311,8 +352,8 @@
311
352
  border-radius: 3px;
312
353
  }
313
354
 
314
- .aio-popup-snakebar-item-container {
315
- font-size: 12px;
355
+ .aio-popup-snackebar-item-container {
356
+ font-size: 14px;
316
357
  height: fit-content;
317
358
  color: #fff;
318
359
  width: 100%;
@@ -326,8 +367,25 @@
326
367
  justify-content: center;
327
368
  z-index: 1000000;
328
369
  }
329
-
330
- .aio-popup-snakebar-item {
370
+ .aio-popup-snackebar-item-container.aio-popup-snackebar-item-container-horizontal-align-start {
371
+ justify-content: flex-start;
372
+ }
373
+ .aio-popup-snackebar-item-container.aio-popup-snackebar-item-container-horizontal-align-end {
374
+ justify-content: flex-end;
375
+ }
376
+ .aio-popup-snackebar-item-container.aio-popup-snackebar-item-container-horizontal-align-center {
377
+ justify-content: center;
378
+ }
379
+ .aio-popup-snackebar-item-container.rtl {
380
+ direction:rtl;
381
+ }
382
+ .aio-popup-snackebar-item-container .aio-popup-snackebar-item-uptext{
383
+ text-align:left;
384
+ }
385
+ .aio-popup-snackebar-item-container.rtl .aio-popup-snackebar-item-uptext{
386
+ text-align:right;
387
+ }
388
+ .aio-popup-snackebar-item {
331
389
  background: rgb(24 28 41 / 95%);
332
390
  padding: 12px;
333
391
  right: 100%;
@@ -339,34 +397,35 @@
339
397
  align-items: center;
340
398
  transition: 0.2s;
341
399
  overflow: hidden;
400
+ box-shadow:1px 1px 10px 0 rgba(0,0,0,0.2);
342
401
  }
343
402
 
344
- .aio-popup-snakebar-item-container.mounted .aio-popup-snakebar-item {
403
+ .aio-popup-snackebar-item-container.mounted .aio-popup-snackebar-item {
345
404
  transition: 0.5s;
346
405
  right: 0;
347
406
  }
348
407
 
349
- .aio-popup-snakebar-item-text {
408
+ .aio-popup-snackebar-item-text {
350
409
  flex: 1;
351
410
  }
352
411
 
353
- .aio-popup-snakebar-item-subtext {
412
+ .aio-popup-snackebar-item-subtext {
354
413
  font-size: 85%;
355
414
  opacity: 0.67;
356
415
  }
357
416
 
358
- .aio-popup-snakebar-item-text svg {
417
+ .aio-popup-snackebar-item-text svg {
359
418
  flex: 1;
360
419
  }
361
420
 
362
- .aio-popup-snakebar-item-remove {
421
+ .aio-popup-snackebar-item-remove {
363
422
  display: flex;
364
423
  align-items: center;
365
424
  justify-content: center;
366
425
  border-radius: 100%;
367
426
  }
368
427
 
369
- .aio-popup-snakebar-item-icon {
428
+ .aio-popup-snackebar-item-icon {
370
429
  display: flex;
371
430
  align-items: center;
372
431
  justify-content: center;
@@ -375,56 +434,90 @@
375
434
  padding: 3px;
376
435
  }
377
436
 
378
- .aio-popup-snakebar-item-success .aio-popup-snakebar-item-icon {
437
+ .aio-popup-snackebar-item-success .aio-popup-snackebar-item-icon {
379
438
  color: #5ba427;
380
439
  }
381
440
 
382
- .aio-popup-snakebar-item-error .aio-popup-snakebar-item-icon {
441
+ .aio-popup-snackebar-item-error .aio-popup-snackebar-item-icon {
383
442
  color: #e83232;
384
443
  }
385
444
 
386
- .aio-popup-snakebar-item-warning .aio-popup-snakebar-item-icon {
445
+ .aio-popup-snackebar-item-warning .aio-popup-snackebar-item-icon {
387
446
  color: #ffb300;
388
447
  }
389
448
 
390
- .aio-popup-snakebar-item-info .aio-popup-snakebar-item-icon {
449
+ .aio-popup-snackebar-item-info .aio-popup-snackebar-item-icon {
391
450
  color: #00bcff;
392
451
  }
393
452
 
394
- .aio-popup-snakebar-item-container .aio-popup-snakebar-bar {
453
+ .aio-popup-snackebar-item-container .aio-popup-snackebar-bar {
395
454
  position: absolute;
396
455
  left: 0;
397
- bottom: 2px;
456
+ bottom: 0px;
398
457
  width: 0%;
399
- height: 3px;
458
+ height: 4px;
459
+ }
460
+ .aio-popup-snackebar-item-container.rtl .aio-popup-snackebar-bar {
461
+ left: unset;
462
+ right:0;
400
463
  }
401
464
 
402
- .aio-popup-snakebar-item-container.mounted .aio-popup-snakebar-bar {
465
+ .aio-popup-snackebar-item-container.mounted .aio-popup-snackebar-bar {
403
466
  width: 100%;
404
467
  }
405
468
 
406
- /* .aio-popup-snakebar-container.mounted .aio-popup-snakebar-bar{
469
+ /* .aio-popup-snackebar-container.mounted .aio-popup-snackebar-bar{
407
470
  width:50%;
408
471
  } */
409
472
 
410
- .aio-popup-snakebar-item-success .aio-popup-snakebar-bar {
473
+ .aio-popup-snackebar-item-success .aio-popup-snackebar-bar {
411
474
  background: #5ba427;
412
475
  }
413
476
 
414
- .aio-popup-snakebar-item-error .aio-popup-snakebar-bar {
477
+ .aio-popup-snackebar-item-error .aio-popup-snackebar-bar {
415
478
  background: #e83232;
416
479
  }
417
480
 
418
- .aio-popup-snakebar-item-warning .aio-popup-snakebar-bar {
481
+ .aio-popup-snackebar-item-warning .aio-popup-snackebar-bar {
419
482
  background: #ffb300;
420
483
  }
421
484
 
422
- .aio-popup-snakebar-item-info .aio-popup-snakebar-bar {
485
+ .aio-popup-snackebar-item-info .aio-popup-snackebar-bar {
423
486
  background: #00bcff;
424
487
  }
425
488
 
426
- .aio-popup-snakebar-item-action {
489
+ .aio-popup-snackebar-item-action {
427
490
  color: dodgerblue;
428
491
  border: none;
429
492
  background: none;
493
+ }
494
+
495
+ .aio-popup-confirm .aio-popup-body{
496
+ padding:12px;
497
+ }
498
+
499
+
500
+
501
+ .aio-popup-scroll::-webkit-scrollbar {
502
+ width: 10px !important;
503
+ height: 10px !important;
504
+ }
505
+
506
+ .aio-popup-scroll::-webkit-scrollbar-track {
507
+ background-color: transparent;
508
+ }
509
+
510
+ .aio-popup-scroll::-webkit-scrollbar-thumb {
511
+ background-color: #cdd4e0;
512
+ border-radius: 20px;
513
+ border: 3px solid transparent;
514
+ background-clip: content-box;
515
+ }
516
+
517
+ .aio-popup-scroll::-webkit-scrollbar-thumb {
518
+ background-color: #b1b9ca;
519
+ }
520
+
521
+ .aio-popup-scroll::-webkit-scrollbar-thumb:hover {
522
+ background-color: #6f7888;
430
523
  }
package/index.d.ts ADDED
@@ -0,0 +1,166 @@
1
+ import React from 'react';
2
+ import './index.css';
3
+ export type AP_props = {
4
+ rtl?: boolean;
5
+ id?: string;
6
+ };
7
+ export type AP_position = 'fullscreen' | 'center' | 'popover' | 'left' | 'right' | 'top' | 'bottom';
8
+ export type AP_header = {
9
+ title?: string;
10
+ subtitle?: string;
11
+ buttons?: AP_modal_button[];
12
+ onClose?: boolean | ((p: {
13
+ state: any;
14
+ setState: (state: any) => void;
15
+ }) => void);
16
+ backButton?: () => void;
17
+ attrs?: any;
18
+ };
19
+ export type AP_backdrop = false | {
20
+ attrs?: any;
21
+ close?: boolean;
22
+ };
23
+ export type AP_body = {
24
+ render?: (p: {
25
+ close: () => void;
26
+ state?: any;
27
+ setState?: (state: any) => void;
28
+ }) => React.ReactNode;
29
+ attrs?: any;
30
+ };
31
+ export type AP_footer = React.ReactNode | {
32
+ attrs?: any;
33
+ buttons?: AP_modal_button[];
34
+ };
35
+ export type AP_modal = {
36
+ getTarget?: () => any;
37
+ pageSelector?: string;
38
+ openRelatedTo?: string;
39
+ fixStyle?: (o: any, p: {
40
+ targetLimit: any;
41
+ pageLimit: any;
42
+ }) => any;
43
+ fitTo?: string;
44
+ rtl?: boolean;
45
+ id?: string;
46
+ onClose?: boolean | (() => void);
47
+ position?: AP_position;
48
+ attrs?: any;
49
+ backdrop?: AP_backdrop;
50
+ header?: AP_header;
51
+ state?: any;
52
+ footer?: AP_footer;
53
+ body?: AP_body;
54
+ animate?: boolean;
55
+ fitHorizontal?: boolean;
56
+ };
57
+ export type AP_alert = {
58
+ icon?: false | React.ReactNode;
59
+ position?: AP_position;
60
+ type: 'success' | 'error' | 'warning' | 'info';
61
+ text?: React.ReactNode;
62
+ subtext?: string;
63
+ time?: number;
64
+ className?: string;
65
+ closeText?: string;
66
+ animate?: boolean;
67
+ };
68
+ export type AP_snackebar = {
69
+ id?: string;
70
+ text: string;
71
+ subtext?: string;
72
+ icon?: React.ReactNode;
73
+ time?: number;
74
+ action?: {
75
+ text: string;
76
+ onClick: () => void;
77
+ };
78
+ type: 'success' | 'error' | 'warning' | 'info';
79
+ verticalAlign?: 'start' | 'end';
80
+ horizontalAlign?: 'start' | 'center' | 'end';
81
+ onClose?: false;
82
+ attrs?: any;
83
+ };
84
+ export type AP_confirm = {
85
+ title?: string;
86
+ subtitle?: string;
87
+ text?: React.ReactNode;
88
+ submitText?: string;
89
+ canselText?: string;
90
+ onSubmit?: () => Promise<boolean>;
91
+ onCansel?: () => void;
92
+ attrs?: any;
93
+ };
94
+ export type AP_prompt = {
95
+ title?: string;
96
+ subtitle?: string;
97
+ text?: string;
98
+ submitText?: string;
99
+ canselText?: string;
100
+ onSubmit?: (text: string) => Promise<boolean>;
101
+ onCansel?: () => void;
102
+ attrs?: any;
103
+ };
104
+ export type AP_modal_button = [text: React.ReactNode, attrs?: any | ((p: {
105
+ state: any;
106
+ setState: (v: any) => void;
107
+ }) => any)];
108
+ export type AP_Popups = {
109
+ getActions: (p: {
110
+ removeModal: (p?: string, animate?: boolean) => void;
111
+ addModal: (p: AP_modal) => void;
112
+ getModals: () => AP_modal[];
113
+ }) => void;
114
+ rtl: boolean;
115
+ id?: string;
116
+ };
117
+ export type AP_Popup = {
118
+ modal: AP_modal;
119
+ rtl: boolean;
120
+ index: number;
121
+ isLast: boolean;
122
+ onClose: () => void;
123
+ removeModal: (p?: string, animate?: boolean) => void;
124
+ };
125
+ export type AP_ModalHeader = {
126
+ rtl: boolean;
127
+ header: AP_header;
128
+ handleClose: () => void;
129
+ state: any;
130
+ setState: (state: any) => void;
131
+ };
132
+ export type AP_ModalBody = {
133
+ body?: AP_body;
134
+ handleClose: () => void;
135
+ updatePopoverStyle: () => void;
136
+ state: any;
137
+ setState: (state: any) => void;
138
+ };
139
+ export type AP_Snackebar = {
140
+ getActions: (p: {
141
+ add: (item: AP_snackebar) => void;
142
+ }) => void;
143
+ rtl: boolean;
144
+ };
145
+ export type AP_SnackebarItem = {
146
+ item: AP_snackebar;
147
+ onRemove: (id: string) => void;
148
+ index: number;
149
+ rtl: boolean;
150
+ };
151
+ export default class AIOPopup {
152
+ rtl?: boolean;
153
+ render: () => React.ReactNode;
154
+ addModal: (p: AP_modal) => void;
155
+ addAlert: (p: AP_alert) => void;
156
+ removeModal: (arg?: string, animate?: boolean) => void;
157
+ _removeModal: (arg?: string, animate?: boolean) => void;
158
+ addSnackebar: (p: AP_snackebar) => void;
159
+ getModals: () => AP_modal[];
160
+ _getModals: () => AP_modal[];
161
+ addConfirm: (p: AP_confirm) => void;
162
+ addPrompt: (p: AP_prompt) => void;
163
+ popupId?: string;
164
+ isRenderCalled: boolean;
165
+ constructor(obj?: AP_props);
166
+ }