aio-popup 3.2.1 → 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 +119 -29
  2. package/index.d.ts +166 -0
  3. package/index.js +1285 -11
  4. package/package.json +3 -3
package/index.css CHANGED
@@ -124,6 +124,7 @@
124
124
  }
125
125
 
126
126
  .aio-popup-header {
127
+ display:flex;
127
128
  border-bottom: 1px solid #e7e9ec;
128
129
  background: #fff;
129
130
  color: #323130;
@@ -144,6 +145,9 @@
144
145
  width: 100%;
145
146
  overflow-y: auto;
146
147
  }
148
+ .aio-popup-body *{
149
+ box-sizing: border-box;
150
+ }
147
151
 
148
152
  .aio-popup-footer {
149
153
  background: #fff;
@@ -154,15 +158,22 @@
154
158
  border-top: 1px solid #f2f4f7;
155
159
  justify-content: flex-end;
156
160
  }
157
-
161
+ .aio-popup-header-buttons{
162
+ display:flex;
163
+ align-items: center;
164
+ justify-content: center;
165
+ gap:6px;
166
+ }
158
167
  .aio-popup-header-button {
159
168
  padding: 0 6px;
160
169
  background: none;
161
170
  border: none;
162
171
  cursor: pointer;
163
172
  }
164
-
165
173
  .aio-popup-header-close-button {
174
+ display:flex;
175
+ align-items: center;
176
+ justify-content: center;
166
177
  width: 36px;
167
178
  }
168
179
 
@@ -202,6 +213,12 @@
202
213
  align-items: center;
203
214
  justify-content: center;
204
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;
205
222
  }
206
223
 
207
224
  .aio-popup-alert {
@@ -216,6 +233,31 @@
216
233
  overflow: hidden;
217
234
  }
218
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
+
219
261
  .aio-popup-alert-error .aio-popup-alert-header svg {
220
262
  fill: red;
221
263
  }
@@ -270,9 +312,9 @@
270
312
 
271
313
  .aio-popup-time {
272
314
  position: absolute;
273
- height: 3px;
274
- width: calc(100% - 24px);
275
- left: 12px;
315
+ height: 4px;
316
+ width: 100%;
317
+ left: 0;
276
318
  bottom: 0;
277
319
  }
278
320
 
@@ -310,8 +352,8 @@
310
352
  border-radius: 3px;
311
353
  }
312
354
 
313
- .aio-popup-snakebar-item-container {
314
- font-size: 12px;
355
+ .aio-popup-snackebar-item-container {
356
+ font-size: 14px;
315
357
  height: fit-content;
316
358
  color: #fff;
317
359
  width: 100%;
@@ -325,8 +367,25 @@
325
367
  justify-content: center;
326
368
  z-index: 1000000;
327
369
  }
328
-
329
- .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 {
330
389
  background: rgb(24 28 41 / 95%);
331
390
  padding: 12px;
332
391
  right: 100%;
@@ -338,34 +397,35 @@
338
397
  align-items: center;
339
398
  transition: 0.2s;
340
399
  overflow: hidden;
400
+ box-shadow:1px 1px 10px 0 rgba(0,0,0,0.2);
341
401
  }
342
402
 
343
- .aio-popup-snakebar-item-container.mounted .aio-popup-snakebar-item {
403
+ .aio-popup-snackebar-item-container.mounted .aio-popup-snackebar-item {
344
404
  transition: 0.5s;
345
405
  right: 0;
346
406
  }
347
407
 
348
- .aio-popup-snakebar-item-text {
408
+ .aio-popup-snackebar-item-text {
349
409
  flex: 1;
350
410
  }
351
411
 
352
- .aio-popup-snakebar-item-subtext {
412
+ .aio-popup-snackebar-item-subtext {
353
413
  font-size: 85%;
354
414
  opacity: 0.67;
355
415
  }
356
416
 
357
- .aio-popup-snakebar-item-text svg {
417
+ .aio-popup-snackebar-item-text svg {
358
418
  flex: 1;
359
419
  }
360
420
 
361
- .aio-popup-snakebar-item-remove {
421
+ .aio-popup-snackebar-item-remove {
362
422
  display: flex;
363
423
  align-items: center;
364
424
  justify-content: center;
365
425
  border-radius: 100%;
366
426
  }
367
427
 
368
- .aio-popup-snakebar-item-icon {
428
+ .aio-popup-snackebar-item-icon {
369
429
  display: flex;
370
430
  align-items: center;
371
431
  justify-content: center;
@@ -374,55 +434,59 @@
374
434
  padding: 3px;
375
435
  }
376
436
 
377
- .aio-popup-snakebar-item-success .aio-popup-snakebar-item-icon {
437
+ .aio-popup-snackebar-item-success .aio-popup-snackebar-item-icon {
378
438
  color: #5ba427;
379
439
  }
380
440
 
381
- .aio-popup-snakebar-item-error .aio-popup-snakebar-item-icon {
441
+ .aio-popup-snackebar-item-error .aio-popup-snackebar-item-icon {
382
442
  color: #e83232;
383
443
  }
384
444
 
385
- .aio-popup-snakebar-item-warning .aio-popup-snakebar-item-icon {
445
+ .aio-popup-snackebar-item-warning .aio-popup-snackebar-item-icon {
386
446
  color: #ffb300;
387
447
  }
388
448
 
389
- .aio-popup-snakebar-item-info .aio-popup-snakebar-item-icon {
449
+ .aio-popup-snackebar-item-info .aio-popup-snackebar-item-icon {
390
450
  color: #00bcff;
391
451
  }
392
452
 
393
- .aio-popup-snakebar-item-container .aio-popup-snakebar-bar {
453
+ .aio-popup-snackebar-item-container .aio-popup-snackebar-bar {
394
454
  position: absolute;
395
455
  left: 0;
396
- bottom: 2px;
456
+ bottom: 0px;
397
457
  width: 0%;
398
- height: 3px;
458
+ height: 4px;
459
+ }
460
+ .aio-popup-snackebar-item-container.rtl .aio-popup-snackebar-bar {
461
+ left: unset;
462
+ right:0;
399
463
  }
400
464
 
401
- .aio-popup-snakebar-item-container.mounted .aio-popup-snakebar-bar {
465
+ .aio-popup-snackebar-item-container.mounted .aio-popup-snackebar-bar {
402
466
  width: 100%;
403
467
  }
404
468
 
405
- /* .aio-popup-snakebar-container.mounted .aio-popup-snakebar-bar{
469
+ /* .aio-popup-snackebar-container.mounted .aio-popup-snackebar-bar{
406
470
  width:50%;
407
471
  } */
408
472
 
409
- .aio-popup-snakebar-item-success .aio-popup-snakebar-bar {
473
+ .aio-popup-snackebar-item-success .aio-popup-snackebar-bar {
410
474
  background: #5ba427;
411
475
  }
412
476
 
413
- .aio-popup-snakebar-item-error .aio-popup-snakebar-bar {
477
+ .aio-popup-snackebar-item-error .aio-popup-snackebar-bar {
414
478
  background: #e83232;
415
479
  }
416
480
 
417
- .aio-popup-snakebar-item-warning .aio-popup-snakebar-bar {
481
+ .aio-popup-snackebar-item-warning .aio-popup-snackebar-bar {
418
482
  background: #ffb300;
419
483
  }
420
484
 
421
- .aio-popup-snakebar-item-info .aio-popup-snakebar-bar {
485
+ .aio-popup-snackebar-item-info .aio-popup-snackebar-bar {
422
486
  background: #00bcff;
423
487
  }
424
488
 
425
- .aio-popup-snakebar-item-action {
489
+ .aio-popup-snackebar-item-action {
426
490
  color: dodgerblue;
427
491
  border: none;
428
492
  background: none;
@@ -430,4 +494,30 @@
430
494
 
431
495
  .aio-popup-confirm .aio-popup-body{
432
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;
433
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
+ }