aio-popup 3.3.0 → 4.0.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.
- package/index.css +47 -105
- package/index.d.ts +33 -64
- package/index.js +8 -1283
- package/package.json +1 -1
package/index.css
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
.aio-popup-backdrop.not-mounted {
|
|
2
|
+
background: none !important;
|
|
3
|
+
transition: 0.3s;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.aio-popup-backdrop {
|
|
2
7
|
position: fixed;
|
|
3
8
|
display: flex;
|
|
@@ -11,105 +16,8 @@
|
|
|
11
16
|
background: rgba(0, 0, 0, 0.1);
|
|
12
17
|
transition: 0.3s;
|
|
13
18
|
pointer-events: all;
|
|
19
|
+
outline:none;
|
|
14
20
|
}
|
|
15
|
-
|
|
16
|
-
.aio-popup.not-mounted {
|
|
17
|
-
transition: 0.3s;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.aio-popup-position-fullscreen>.aio-popup.not-mounted {
|
|
21
|
-
transform: scale(0);
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.aio-popup-position-popover>.aio-popup.not-mounted {
|
|
26
|
-
opacity: 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.aio-popup-position-top>.aio-popup.not-mounted {
|
|
30
|
-
top: -500px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.aio-popup-position-bottom>.aio-popup.not-mounted {
|
|
34
|
-
bottom: -500px;
|
|
35
|
-
opacity: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.aio-popup-position-right>.aio-popup.not-mounted {
|
|
39
|
-
right: -500px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.aio-popup-position-left>.aio-popup.not-mounted {
|
|
43
|
-
left: -500px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.aio-popup-position-center>.aio-popup.not-mounted {
|
|
47
|
-
transform: translateY(500px);
|
|
48
|
-
opacity: 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.aio-popup-position-fullscreen>.aio-popup {
|
|
52
|
-
width: 100%;
|
|
53
|
-
height: 100%;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.aio-popup-position-popover {
|
|
57
|
-
opacity: 1;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.aio-popup-position-top {
|
|
61
|
-
align-items: flex-start;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.aio-popup-position-top>.aio-popup {
|
|
65
|
-
width: 100%;
|
|
66
|
-
max-height: 90vh;
|
|
67
|
-
top: 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.aio-popup-position-bottom {
|
|
71
|
-
align-items: flex-end;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.aio-popup-position-bottom>.aio-popup {
|
|
75
|
-
width: 100%;
|
|
76
|
-
max-height: 90vh;
|
|
77
|
-
bottom: 0;
|
|
78
|
-
opacity: 1;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.aio-popup-backdrop.not-mounted {
|
|
82
|
-
background: none !important;
|
|
83
|
-
transition: 0.3s;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.aio-popup-position-right {
|
|
87
|
-
justify-content: right;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.aio-popup-position-right .aio-popup {
|
|
91
|
-
height: 100%;
|
|
92
|
-
max-width: 90vh;
|
|
93
|
-
right: 0;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.aio-popup-position-left {
|
|
97
|
-
justify-content: left;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.aio-popup-position-left>.aio-popup {
|
|
101
|
-
height: 100%;
|
|
102
|
-
max-width: 90vh;
|
|
103
|
-
left: 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.aio-popup-position-center>.aio-popup {
|
|
107
|
-
max-width: 100vw;
|
|
108
|
-
width: fit-content;
|
|
109
|
-
opacity: 1;
|
|
110
|
-
max-height: 100vh;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
21
|
.aio-popup {
|
|
114
22
|
border-radius: 4px;
|
|
115
23
|
font-size: 14px;
|
|
@@ -117,11 +25,39 @@
|
|
|
117
25
|
max-width: 100vw;
|
|
118
26
|
max-height: 100vh;
|
|
119
27
|
pointer-events: auto;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
28
|
+
display:flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
position: absolute;
|
|
31
|
+
outline:none;
|
|
32
|
+
}
|
|
33
|
+
.aio-popup.rtl {direction: rtl;}
|
|
34
|
+
.aio-popup.not-mounted {transition: 0.3s;}
|
|
35
|
+
/**********position (fullscreen)*******/
|
|
36
|
+
.aio-popup-position-fullscreen>.aio-popup.not-mounted {transform: scale(0);}
|
|
37
|
+
.aio-popup-position-fullscreen>.aio-popup {width: 100%;height: 100%;}
|
|
38
|
+
/**********position (top)**************/
|
|
39
|
+
.aio-popup-position-top {align-items: flex-start;}
|
|
40
|
+
.aio-popup-position-top > .aio-popup.not-mounted {top: -500px;}
|
|
41
|
+
.aio-popup-position-top > .aio-popup {width: 100%;max-height: 90vh;top: 0;}
|
|
42
|
+
/**********position (bottom)***********/
|
|
43
|
+
.aio-popup-position-bottom {align-items: flex-end;}
|
|
44
|
+
.aio-popup-position-bottom>.aio-popup.not-mounted {bottom: -500px;opacity: 0;}
|
|
45
|
+
.aio-popup-position-bottom>.aio-popup {width: 100%;max-height: 90vh;bottom: 0;opacity: 1;}
|
|
46
|
+
/**********position (left)*************/
|
|
47
|
+
.aio-popup-position-left {justify-content: left;}
|
|
48
|
+
.aio-popup-position-left > .aio-popup.not-mounted {left: -500px;}
|
|
49
|
+
.aio-popup-position-left > .aio-popup {height: 100%;max-width: 90vh;left: 0;}
|
|
50
|
+
/**********position (right)************/
|
|
51
|
+
.aio-popup-position-right {justify-content: right;}
|
|
52
|
+
.aio-popup-position-right > .aio-popup.not-mounted {right: -500px;}
|
|
53
|
+
.aio-popup-position-right > .aio-popup {height: 100%;max-width: 90vh;right: 0;}
|
|
54
|
+
/**********position (popover)************/
|
|
55
|
+
.aio-popup-position-popover {opacity: 1;}
|
|
56
|
+
.aio-popup-position-popover>.aio-popup.not-mounted {opacity: 0;}
|
|
57
|
+
/**********position (center)***********/
|
|
58
|
+
.aio-popup-position-center>.aio-popup.not-mounted {transform: translateY(500px);opacity: 0;}
|
|
59
|
+
.aio-popup-position-center>.aio-popup {max-width: 100vw;width: fit-content;opacity: 1;max-height: 100vh;}
|
|
60
|
+
/**************************************/
|
|
125
61
|
|
|
126
62
|
.aio-popup-header {
|
|
127
63
|
display:flex;
|
|
@@ -134,7 +70,7 @@
|
|
|
134
70
|
min-height: 48px;
|
|
135
71
|
}
|
|
136
72
|
|
|
137
|
-
.aio-popup-subtitle {
|
|
73
|
+
.aio-popup-header-subtitle {
|
|
138
74
|
font-size: 85%;
|
|
139
75
|
opacity: 0.5;
|
|
140
76
|
}
|
|
@@ -144,6 +80,7 @@
|
|
|
144
80
|
flex: 1;
|
|
145
81
|
width: 100%;
|
|
146
82
|
overflow-y: auto;
|
|
83
|
+
box-sizing:border-box;
|
|
147
84
|
}
|
|
148
85
|
.aio-popup-body *{
|
|
149
86
|
box-sizing: border-box;
|
|
@@ -157,6 +94,7 @@
|
|
|
157
94
|
display: flex;
|
|
158
95
|
border-top: 1px solid #f2f4f7;
|
|
159
96
|
justify-content: flex-end;
|
|
97
|
+
box-sizing: border-box;
|
|
160
98
|
}
|
|
161
99
|
.aio-popup-header-buttons{
|
|
162
100
|
display:flex;
|
|
@@ -176,7 +114,11 @@
|
|
|
176
114
|
justify-content: center;
|
|
177
115
|
width: 36px;
|
|
178
116
|
}
|
|
179
|
-
|
|
117
|
+
.aio-popup-header-after{
|
|
118
|
+
display:flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
height:100%;
|
|
121
|
+
}
|
|
180
122
|
.aio-popup-footer-button {
|
|
181
123
|
height: 30px;
|
|
182
124
|
background: dodgerblue;
|
package/index.d.ts
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
2
|
import './index.css';
|
|
3
3
|
export type AP_props = {
|
|
4
4
|
rtl?: boolean;
|
|
5
5
|
id?: string;
|
|
6
6
|
};
|
|
7
7
|
export type AP_position = 'fullscreen' | 'center' | 'popover' | 'left' | 'right' | 'top' | 'bottom';
|
|
8
|
-
export type
|
|
8
|
+
export type AP_attrsKey = 'backdrop' | 'modal' | 'header' | 'body' | 'footer';
|
|
9
|
+
export type AP_header = ((p: {
|
|
10
|
+
close: () => void;
|
|
11
|
+
state: any;
|
|
12
|
+
setState: any;
|
|
13
|
+
}) => React.ReactNode) | {
|
|
9
14
|
title?: string;
|
|
10
15
|
subtitle?: string;
|
|
11
|
-
|
|
16
|
+
before?: React.ReactNode;
|
|
17
|
+
after?: React.ReactNode;
|
|
12
18
|
onClose?: boolean | ((p: {
|
|
13
19
|
state: any;
|
|
14
20
|
setState: (state: any) => void;
|
|
15
21
|
}) => 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
22
|
attrs?: any;
|
|
33
|
-
buttons?: AP_modal_button[];
|
|
34
23
|
};
|
|
24
|
+
export type AP_body = (p: {
|
|
25
|
+
close: () => void;
|
|
26
|
+
state?: any;
|
|
27
|
+
setState?: (state: any) => void;
|
|
28
|
+
}) => React.ReactNode;
|
|
29
|
+
export type AP_footer = (p: {
|
|
30
|
+
state: any;
|
|
31
|
+
setState: (v: any) => void;
|
|
32
|
+
close: () => void;
|
|
33
|
+
}) => React.ReactNode;
|
|
34
|
+
type AP_setAttrs = (mode: AP_attrsKey) => any;
|
|
35
35
|
export type AP_modal = {
|
|
36
36
|
getTarget?: () => any;
|
|
37
37
|
pageSelector?: string;
|
|
38
|
-
|
|
38
|
+
limitTo?: string;
|
|
39
|
+
maxHeight?: number | 'string';
|
|
39
40
|
fixStyle?: (o: any, p: {
|
|
40
41
|
targetLimit: any;
|
|
41
42
|
pageLimit: any;
|
|
@@ -45,14 +46,13 @@ export type AP_modal = {
|
|
|
45
46
|
id?: string;
|
|
46
47
|
onClose?: boolean | (() => void);
|
|
47
48
|
position?: AP_position;
|
|
48
|
-
attrs?: any;
|
|
49
|
-
backdrop?: AP_backdrop;
|
|
50
49
|
header?: AP_header;
|
|
51
50
|
state?: any;
|
|
52
51
|
footer?: AP_footer;
|
|
53
52
|
body?: AP_body;
|
|
54
53
|
animate?: boolean;
|
|
55
54
|
fitHorizontal?: boolean;
|
|
55
|
+
setAttrs?: AP_setAttrs;
|
|
56
56
|
};
|
|
57
57
|
export type AP_alert = {
|
|
58
58
|
icon?: false | React.ReactNode;
|
|
@@ -89,7 +89,7 @@ export type AP_confirm = {
|
|
|
89
89
|
canselText?: string;
|
|
90
90
|
onSubmit?: () => Promise<boolean>;
|
|
91
91
|
onCansel?: () => void;
|
|
92
|
-
|
|
92
|
+
setAttrs?: AP_setAttrs;
|
|
93
93
|
};
|
|
94
94
|
export type AP_prompt = {
|
|
95
95
|
title?: string;
|
|
@@ -99,42 +99,7 @@ export type AP_prompt = {
|
|
|
99
99
|
canselText?: string;
|
|
100
100
|
onSubmit?: (text: string) => Promise<boolean>;
|
|
101
101
|
onCansel?: () => void;
|
|
102
|
-
|
|
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;
|
|
102
|
+
setAttrs?: AP_setAttrs;
|
|
138
103
|
};
|
|
139
104
|
export type AP_Snackebar = {
|
|
140
105
|
getActions: (p: {
|
|
@@ -153,14 +118,18 @@ export default class AIOPopup {
|
|
|
153
118
|
render: () => React.ReactNode;
|
|
154
119
|
addModal: (p: AP_modal) => void;
|
|
155
120
|
addAlert: (p: AP_alert) => void;
|
|
156
|
-
removeModal: (arg?: string
|
|
157
|
-
_removeModal: (arg?: string, animate?: boolean) => void;
|
|
121
|
+
removeModal: (arg?: string) => void;
|
|
158
122
|
addSnackebar: (p: AP_snackebar) => void;
|
|
159
123
|
getModals: () => AP_modal[];
|
|
160
|
-
_getModals: () => AP_modal[];
|
|
161
124
|
addConfirm: (p: AP_confirm) => void;
|
|
162
125
|
addPrompt: (p: AP_prompt) => void;
|
|
163
126
|
popupId?: string;
|
|
164
|
-
|
|
127
|
+
popupsRef: React.RefObject<typeof Popups>;
|
|
165
128
|
constructor(obj?: AP_props);
|
|
166
129
|
}
|
|
130
|
+
type AP_Popups = {
|
|
131
|
+
ref: any;
|
|
132
|
+
rtl: boolean;
|
|
133
|
+
};
|
|
134
|
+
declare const Popups: FC<AP_Popups>;
|
|
135
|
+
export {};
|