pure-react-ui 1.5.0 → 1.5.1
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/README.md
CHANGED
|
@@ -77,11 +77,19 @@ import { Modal } from 'pure-react-ui';
|
|
|
77
77
|
**Props:**
|
|
78
78
|
- `isOpen`: boolean (required)
|
|
79
79
|
- `onClose`: () => void (required)
|
|
80
|
-
- `title`: string (optional)
|
|
80
|
+
- `title`: string | React.ReactNode (optional) - Modal title or custom header content
|
|
81
81
|
- `size`: 'small' | 'medium' | 'large' | 'fullscreen' (default: 'medium')
|
|
82
|
+
- `position`: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' (default: 'center')
|
|
83
|
+
- `variant`: 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'gradient-primary' | 'gradient-success' | 'gradient-danger' | 'gradient-info' (default: 'default')
|
|
82
84
|
- `closeOnOverlayClick`: boolean (default: true)
|
|
83
85
|
- `closeOnEscape`: boolean (default: true)
|
|
84
86
|
- `showCloseButton`: boolean (default: true)
|
|
87
|
+
- `scrollable`: boolean (default: true) - Enable scrolling for modal body
|
|
88
|
+
- `topMargin`: number | string (optional) - Custom top margin for modal
|
|
89
|
+
- `className`: string (optional) - Additional CSS classes
|
|
90
|
+
- `overlayClassName`: string (optional) - Additional CSS classes for overlay
|
|
91
|
+
- `headerClassName`: string (optional) - Additional CSS classes for header
|
|
92
|
+
- `bodyClassName`: string (optional) - Additional CSS classes for body
|
|
85
93
|
|
|
86
94
|
### Icon
|
|
87
95
|
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/* Global Font Family - Applied to Modal */
|
|
2
|
+
.pure-modal,
|
|
3
|
+
.pure-modal * {
|
|
4
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
5
|
+
-webkit-font-smoothing: antialiased;
|
|
6
|
+
-moz-osx-font-smoothing: grayscale;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
/* Pure Modal Component Styles */
|
|
2
10
|
.pure-modal__overlay {
|
|
3
11
|
position: fixed;
|
|
@@ -35,6 +43,7 @@
|
|
|
35
43
|
animation: pure-modal-slide-in 0.3s ease-out;
|
|
36
44
|
position: relative;
|
|
37
45
|
overflow: hidden;
|
|
46
|
+
margin: 0 auto;
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
@keyframes pure-modal-slide-in {
|
|
@@ -48,6 +57,59 @@
|
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
|
|
60
|
+
/* Position Variants */
|
|
61
|
+
.pure-modal--position-center {
|
|
62
|
+
/* Default - already centered by overlay */
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.pure-modal--position-top {
|
|
66
|
+
margin-top: 2rem;
|
|
67
|
+
margin-bottom: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.pure-modal--position-bottom {
|
|
71
|
+
margin-top: auto;
|
|
72
|
+
margin-bottom: 2rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.pure-modal--position-left {
|
|
76
|
+
margin-left: 2rem;
|
|
77
|
+
margin-right: auto;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.pure-modal--position-right {
|
|
81
|
+
margin-left: auto;
|
|
82
|
+
margin-right: 2rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.pure-modal--position-top-left {
|
|
86
|
+
margin-top: 2rem;
|
|
87
|
+
margin-bottom: auto;
|
|
88
|
+
margin-left: 2rem;
|
|
89
|
+
margin-right: auto;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.pure-modal--position-top-right {
|
|
93
|
+
margin-top: 2rem;
|
|
94
|
+
margin-bottom: auto;
|
|
95
|
+
margin-left: auto;
|
|
96
|
+
margin-right: 2rem;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.pure-modal--position-bottom-left {
|
|
100
|
+
margin-top: auto;
|
|
101
|
+
margin-bottom: 2rem;
|
|
102
|
+
margin-left: 2rem;
|
|
103
|
+
margin-right: auto;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.pure-modal--position-bottom-right {
|
|
107
|
+
margin-top: auto;
|
|
108
|
+
margin-bottom: 2rem;
|
|
109
|
+
margin-left: auto;
|
|
110
|
+
margin-right: 2rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
51
113
|
/* Size Variants */
|
|
52
114
|
.pure-modal--small {
|
|
53
115
|
max-width: 400px;
|
|
@@ -69,6 +131,212 @@
|
|
|
69
131
|
margin: 0;
|
|
70
132
|
}
|
|
71
133
|
|
|
134
|
+
/* Variant Colors */
|
|
135
|
+
.pure-modal--default {
|
|
136
|
+
background-color: #ffffff;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.pure-modal--primary {
|
|
140
|
+
background: linear-gradient(to bottom, #007bff 0%, #0056b3 100%);
|
|
141
|
+
color: #ffffff;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.pure-modal--primary .pure-modal__header {
|
|
145
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.pure-modal--primary .pure-modal__title {
|
|
149
|
+
color: #ffffff;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.pure-modal--primary .pure-modal__body {
|
|
153
|
+
color: #ffffff;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.pure-modal--primary .pure-modal__close-button {
|
|
157
|
+
color: #ffffff;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.pure-modal--primary .pure-modal__close-button:hover {
|
|
161
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
162
|
+
color: #ffffff;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.pure-modal--secondary {
|
|
166
|
+
background: linear-gradient(to bottom, #6c757d 0%, #545b62 100%);
|
|
167
|
+
color: #ffffff;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.pure-modal--secondary .pure-modal__header {
|
|
171
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.pure-modal--secondary .pure-modal__title,
|
|
175
|
+
.pure-modal--secondary .pure-modal__body,
|
|
176
|
+
.pure-modal--secondary .pure-modal__close-button {
|
|
177
|
+
color: #ffffff;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.pure-modal--secondary .pure-modal__close-button:hover {
|
|
181
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.pure-modal--success {
|
|
185
|
+
background: linear-gradient(to bottom, #28a745 0%, #218838 100%);
|
|
186
|
+
color: #ffffff;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.pure-modal--success .pure-modal__header {
|
|
190
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.pure-modal--success .pure-modal__title,
|
|
194
|
+
.pure-modal--success .pure-modal__body,
|
|
195
|
+
.pure-modal--success .pure-modal__close-button {
|
|
196
|
+
color: #ffffff;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.pure-modal--success .pure-modal__close-button:hover {
|
|
200
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.pure-modal--danger {
|
|
204
|
+
background: linear-gradient(to bottom, #dc3545 0%, #c82333 100%);
|
|
205
|
+
color: #ffffff;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.pure-modal--danger .pure-modal__header {
|
|
209
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.pure-modal--danger .pure-modal__title,
|
|
213
|
+
.pure-modal--danger .pure-modal__body,
|
|
214
|
+
.pure-modal--danger .pure-modal__close-button {
|
|
215
|
+
color: #ffffff;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.pure-modal--danger .pure-modal__close-button:hover {
|
|
219
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.pure-modal--warning {
|
|
223
|
+
background: linear-gradient(to bottom, #ffc107 0%, #e0a800 100%);
|
|
224
|
+
color: #212529;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.pure-modal--warning .pure-modal__header {
|
|
228
|
+
border-bottom-color: rgba(0, 0, 0, 0.1);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.pure-modal--warning .pure-modal__title,
|
|
232
|
+
.pure-modal--warning .pure-modal__body {
|
|
233
|
+
color: #212529;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.pure-modal--warning .pure-modal__close-button {
|
|
237
|
+
color: #212529;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.pure-modal--warning .pure-modal__close-button:hover {
|
|
241
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.pure-modal--info {
|
|
245
|
+
background: linear-gradient(to bottom, #17a2b8 0%, #138496 100%);
|
|
246
|
+
color: #ffffff;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.pure-modal--info .pure-modal__header {
|
|
250
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.pure-modal--info .pure-modal__title,
|
|
254
|
+
.pure-modal--info .pure-modal__body,
|
|
255
|
+
.pure-modal--info .pure-modal__close-button {
|
|
256
|
+
color: #ffffff;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.pure-modal--info .pure-modal__close-button:hover {
|
|
260
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* Gradient Variants */
|
|
264
|
+
.pure-modal--gradient-primary {
|
|
265
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
266
|
+
color: #ffffff;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.pure-modal--gradient-primary .pure-modal__header {
|
|
270
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.pure-modal--gradient-primary .pure-modal__title,
|
|
274
|
+
.pure-modal--gradient-primary .pure-modal__body,
|
|
275
|
+
.pure-modal--gradient-primary .pure-modal__close-button {
|
|
276
|
+
color: #ffffff;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.pure-modal--gradient-primary .pure-modal__close-button:hover {
|
|
280
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.pure-modal--gradient-success {
|
|
284
|
+
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
|
|
285
|
+
color: #ffffff;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.pure-modal--gradient-success .pure-modal__header {
|
|
289
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.pure-modal--gradient-success .pure-modal__title,
|
|
293
|
+
.pure-modal--gradient-success .pure-modal__body,
|
|
294
|
+
.pure-modal--gradient-success .pure-modal__close-button {
|
|
295
|
+
color: #ffffff;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.pure-modal--gradient-success .pure-modal__close-button:hover {
|
|
299
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.pure-modal--gradient-danger {
|
|
303
|
+
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
|
304
|
+
color: #ffffff;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.pure-modal--gradient-danger .pure-modal__header {
|
|
308
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.pure-modal--gradient-danger .pure-modal__title,
|
|
312
|
+
.pure-modal--gradient-danger .pure-modal__body,
|
|
313
|
+
.pure-modal--gradient-danger .pure-modal__close-button {
|
|
314
|
+
color: #ffffff;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.pure-modal--gradient-danger .pure-modal__close-button:hover {
|
|
318
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.pure-modal--gradient-info {
|
|
322
|
+
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
|
323
|
+
color: #ffffff;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.pure-modal--gradient-info .pure-modal__header {
|
|
327
|
+
border-bottom-color: rgba(255, 255, 255, 0.2);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.pure-modal--gradient-info .pure-modal__title,
|
|
331
|
+
.pure-modal--gradient-info .pure-modal__body,
|
|
332
|
+
.pure-modal--gradient-info .pure-modal__close-button {
|
|
333
|
+
color: #ffffff;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.pure-modal--gradient-info .pure-modal__close-button:hover {
|
|
337
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
338
|
+
}
|
|
339
|
+
|
|
72
340
|
/* Header */
|
|
73
341
|
.pure-modal__header {
|
|
74
342
|
display: flex;
|
|
@@ -77,6 +345,11 @@
|
|
|
77
345
|
padding: 1.5rem;
|
|
78
346
|
border-bottom: 1px solid #e0e0e0;
|
|
79
347
|
flex-shrink: 0;
|
|
348
|
+
background: inherit;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.pure-modal__title-wrapper {
|
|
352
|
+
flex: 1;
|
|
80
353
|
}
|
|
81
354
|
|
|
82
355
|
.pure-modal__title {
|
|
@@ -85,7 +358,6 @@
|
|
|
85
358
|
font-weight: 600;
|
|
86
359
|
line-height: 1.4;
|
|
87
360
|
color: #212529;
|
|
88
|
-
flex: 1;
|
|
89
361
|
}
|
|
90
362
|
|
|
91
363
|
.pure-modal__close-button {
|
|
@@ -128,10 +400,58 @@
|
|
|
128
400
|
/* Body */
|
|
129
401
|
.pure-modal__body {
|
|
130
402
|
padding: 1.5rem;
|
|
131
|
-
overflow-y: auto;
|
|
132
403
|
flex: 1;
|
|
133
404
|
color: #495057;
|
|
134
405
|
line-height: 1.6;
|
|
406
|
+
background: inherit;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.pure-modal--scrollable .pure-modal__body {
|
|
410
|
+
overflow-y: auto;
|
|
411
|
+
max-height: calc(90vh - 100px);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar {
|
|
415
|
+
width: 8px;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-track {
|
|
419
|
+
background: rgba(0, 0, 0, 0.05);
|
|
420
|
+
border-radius: 4px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb {
|
|
424
|
+
background: rgba(0, 0, 0, 0.2);
|
|
425
|
+
border-radius: 4px;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover {
|
|
429
|
+
background: rgba(0, 0, 0, 0.3);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/* Scrollable variants with custom scrollbar colors */
|
|
433
|
+
.pure-modal--primary.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb,
|
|
434
|
+
.pure-modal--secondary.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb,
|
|
435
|
+
.pure-modal--success.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb,
|
|
436
|
+
.pure-modal--danger.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb,
|
|
437
|
+
.pure-modal--info.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb,
|
|
438
|
+
.pure-modal--gradient-primary.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb,
|
|
439
|
+
.pure-modal--gradient-success.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb,
|
|
440
|
+
.pure-modal--gradient-danger.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb,
|
|
441
|
+
.pure-modal--gradient-info.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb {
|
|
442
|
+
background: rgba(255, 255, 255, 0.3);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.pure-modal--primary.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover,
|
|
446
|
+
.pure-modal--secondary.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover,
|
|
447
|
+
.pure-modal--success.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover,
|
|
448
|
+
.pure-modal--danger.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover,
|
|
449
|
+
.pure-modal--info.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover,
|
|
450
|
+
.pure-modal--gradient-primary.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover,
|
|
451
|
+
.pure-modal--gradient-success.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover,
|
|
452
|
+
.pure-modal--gradient-danger.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover,
|
|
453
|
+
.pure-modal--gradient-info.pure-modal--scrollable .pure-modal__body::-webkit-scrollbar-thumb:hover {
|
|
454
|
+
background: rgba(255, 255, 255, 0.5);
|
|
135
455
|
}
|
|
136
456
|
|
|
137
457
|
/* Responsive */
|
|
@@ -164,6 +484,17 @@
|
|
|
164
484
|
max-width: 100%;
|
|
165
485
|
}
|
|
166
486
|
|
|
487
|
+
.pure-modal--position-top,
|
|
488
|
+
.pure-modal--position-bottom,
|
|
489
|
+
.pure-modal--position-left,
|
|
490
|
+
.pure-modal--position-right,
|
|
491
|
+
.pure-modal--position-top-left,
|
|
492
|
+
.pure-modal--position-top-right,
|
|
493
|
+
.pure-modal--position-bottom-left,
|
|
494
|
+
.pure-modal--position-bottom-right {
|
|
495
|
+
margin: 0;
|
|
496
|
+
}
|
|
497
|
+
|
|
167
498
|
.pure-modal__header {
|
|
168
499
|
padding: 1rem 1.25rem;
|
|
169
500
|
}
|
|
@@ -176,22 +507,3 @@
|
|
|
176
507
|
padding: 1.25rem;
|
|
177
508
|
}
|
|
178
509
|
}
|
|
179
|
-
|
|
180
|
-
/* Scrollbar Styling */
|
|
181
|
-
.pure-modal__body::-webkit-scrollbar {
|
|
182
|
-
width: 8px;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.pure-modal__body::-webkit-scrollbar-track {
|
|
186
|
-
background: #f1f1f1;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.pure-modal__body::-webkit-scrollbar-thumb {
|
|
190
|
-
background: #c1c1c1;
|
|
191
|
-
border-radius: 4px;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.pure-modal__body::-webkit-scrollbar-thumb:hover {
|
|
195
|
-
background: #a8a8a8;
|
|
196
|
-
}
|
|
197
|
-
|
|
@@ -3,13 +3,19 @@ import './Modal.css';
|
|
|
3
3
|
export interface ModalProps {
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
|
-
title?: string;
|
|
6
|
+
title?: string | React.ReactNode;
|
|
7
7
|
size?: 'small' | 'medium' | 'large' | 'fullscreen';
|
|
8
|
+
position?: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
9
|
+
variant?: 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'gradient-primary' | 'gradient-success' | 'gradient-danger' | 'gradient-info';
|
|
8
10
|
closeOnOverlayClick?: boolean;
|
|
9
11
|
closeOnEscape?: boolean;
|
|
10
12
|
showCloseButton?: boolean;
|
|
13
|
+
scrollable?: boolean;
|
|
14
|
+
topMargin?: number | string;
|
|
11
15
|
className?: string;
|
|
12
16
|
overlayClassName?: string;
|
|
17
|
+
headerClassName?: string;
|
|
18
|
+
bodyClassName?: string;
|
|
13
19
|
children: React.ReactNode;
|
|
14
20
|
}
|
|
15
21
|
export declare const Modal: React.FC<ModalProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;IACnD,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACtH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,eAAe,CAAC;IAC1K,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA6GtC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import './Modal.css';
|
|
3
|
-
export const Modal = ({ isOpen, onClose, title, size = 'medium', closeOnOverlayClick = true, closeOnEscape = true, showCloseButton = true, className = '', overlayClassName = '', children }) => {
|
|
3
|
+
export const Modal = ({ isOpen, onClose, title, size = 'medium', position = 'center', variant = 'default', closeOnOverlayClick = true, closeOnEscape = true, showCloseButton = true, scrollable = true, topMargin, className = '', overlayClassName = '', headerClassName = '', bodyClassName = '', children }) => {
|
|
4
4
|
const modalRef = useRef(null);
|
|
5
5
|
const overlayRef = useRef(null);
|
|
6
6
|
useEffect(() => {
|
|
@@ -32,14 +32,30 @@ export const Modal = ({ isOpen, onClose, title, size = 'medium', closeOnOverlayC
|
|
|
32
32
|
return null;
|
|
33
33
|
const baseClass = 'pure-modal';
|
|
34
34
|
const sizeClass = `pure-modal--${size}`;
|
|
35
|
-
const
|
|
35
|
+
const positionClass = `pure-modal--position-${position}`;
|
|
36
|
+
const variantClass = `pure-modal--${variant}`;
|
|
37
|
+
const scrollableClass = scrollable ? 'pure-modal--scrollable' : '';
|
|
38
|
+
const combinedClassName = [
|
|
39
|
+
baseClass,
|
|
40
|
+
sizeClass,
|
|
41
|
+
positionClass,
|
|
42
|
+
variantClass,
|
|
43
|
+
scrollableClass,
|
|
44
|
+
className
|
|
45
|
+
].filter(Boolean).join(' ');
|
|
36
46
|
const combinedOverlayClassName = ['pure-modal__overlay', overlayClassName].filter(Boolean).join(' ');
|
|
47
|
+
const combinedHeaderClassName = ['pure-modal__header', headerClassName].filter(Boolean).join(' ');
|
|
48
|
+
const combinedBodyClassName = ['pure-modal__body', bodyClassName].filter(Boolean).join(' ');
|
|
49
|
+
const modalStyle = {};
|
|
50
|
+
if (topMargin !== undefined) {
|
|
51
|
+
modalStyle.marginTop = typeof topMargin === 'number' ? `${topMargin}px` : topMargin;
|
|
52
|
+
}
|
|
37
53
|
return (React.createElement("div", { className: combinedOverlayClassName, ref: overlayRef },
|
|
38
|
-
React.createElement("div", { className: combinedClassName, ref: modalRef },
|
|
39
|
-
(title || showCloseButton) && (React.createElement("div", { className:
|
|
40
|
-
title && React.createElement("h2", { className: "pure-modal__title" }, title),
|
|
54
|
+
React.createElement("div", { className: combinedClassName, ref: modalRef, style: modalStyle },
|
|
55
|
+
(title || showCloseButton) && (React.createElement("div", { className: combinedHeaderClassName },
|
|
56
|
+
title && (React.createElement("div", { className: "pure-modal__title-wrapper" }, typeof title === 'string' ? (React.createElement("h2", { className: "pure-modal__title" }, title)) : (title))),
|
|
41
57
|
showCloseButton && (React.createElement("button", { className: "pure-modal__close-button", onClick: onClose, "aria-label": "Close modal" },
|
|
42
58
|
React.createElement("span", { className: "pure-modal__close-icon" }, "\u00D7"))))),
|
|
43
|
-
React.createElement("div", { className:
|
|
59
|
+
React.createElement("div", { className: combinedBodyClassName }, children))));
|
|
44
60
|
};
|
|
45
61
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,aAAa,CAAC;AAqBrB,MAAM,CAAC,MAAM,KAAK,GAAyB,CAAC,EAC1C,MAAM,EACN,OAAO,EACP,KAAK,EACL,IAAI,GAAG,QAAQ,EACf,QAAQ,GAAG,QAAQ,EACnB,OAAO,GAAG,SAAS,EACnB,mBAAmB,GAAG,IAAI,EAC1B,aAAa,GAAG,IAAI,EACpB,eAAe,GAAG,IAAI,EACtB,UAAU,GAAG,IAAI,EACjB,SAAS,EACT,SAAS,GAAG,EAAE,EACd,gBAAgB,GAAG,EAAE,EACrB,eAAe,GAAG,EAAE,EACpB,aAAa,GAAG,EAAE,EAClB,QAAQ,EACT,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,MAAM,YAAY,GAAG,CAAC,CAAgB,EAAE,EAAE;YACxC,IAAI,aAAa,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;gBACxC,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,kBAAkB,GAAG,CAAC,CAAa,EAAE,EAAE;YAC3C,IACE,mBAAmB;gBACnB,UAAU,CAAC,OAAO;gBAClB,QAAQ,CAAC,OAAO;gBAChB,CAAC,CAAC,MA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