sweetalert2-rails 0.1.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.
@@ -0,0 +1,807 @@
1
+ // SweetAlert2
2
+ // github.com/limonte/sweetalert2
3
+ $swal2-white: #fff !default;
4
+ $swal2-black: #000 !default;
5
+ $swal2-transparent: rgba($swal2-black, 0) !default;
6
+
7
+ $swal2-success: #a5dc86 !default;
8
+ $swal2-success-border: rgba($swal2-success, .2) !default;
9
+ $swal2-error: #f27474 !default;
10
+ $swal2-warning: #f8bb86 !default;
11
+ $swal2-info: #3fc3ee !default;
12
+ $swal2-question: #87adbd !default;
13
+
14
+ $swal2-overlay: rgba($swal2-black, .4) !default;
15
+
16
+ $swal2-close-button: lighten($swal2-black, 80) !default;
17
+ $swal2-close-button-hover: #d55 !default;
18
+
19
+ $swal2-input-border: lighten($swal2-black, 85) !default;
20
+ $swal2-input-border-focus: #b4dbed !default;
21
+ $swal2-input-box-shadow: rgba($swal2-black, .06) !default;
22
+ $swal2-input-box-shadow-focus: #c4e6f5 !default;
23
+
24
+ $swal2-validationerror-background: #ea7d7d !default;
25
+ $swal2-validationerror-color: $swal2-white !default;
26
+
27
+ body {
28
+ &.swal2-shown {
29
+ overflow-y: hidden;
30
+ }
31
+
32
+ &.swal2-iosfix {
33
+ position: fixed;
34
+ left: 0;
35
+ right: 0;
36
+ }
37
+ }
38
+
39
+ .swal2-container {
40
+ // centering
41
+ display: flex;
42
+ align-items: center;
43
+ position: fixed;
44
+ top: 0;
45
+ left: 0;
46
+ bottom: 0;
47
+ right: 0;
48
+ padding: 10px;
49
+
50
+ // backdrop
51
+ background-color: transparent;
52
+
53
+ z-index: 1060;
54
+
55
+ &.swal2-fade {
56
+ transition: background-color .1s;
57
+ }
58
+
59
+ &.swal2-shown {
60
+ background-color: $swal2-overlay;
61
+ }
62
+ }
63
+
64
+ .swal2-modal {
65
+ background-color: $swal2-white;
66
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
67
+ border-radius: 5px;
68
+ box-sizing: border-box;
69
+ text-align: center;
70
+ margin: auto;
71
+ overflow-x: hidden;
72
+ overflow-y: auto;
73
+ display: none;
74
+ position: relative;
75
+ max-width: 100%;
76
+
77
+ &:focus {
78
+ outline: none;
79
+ }
80
+
81
+ &.swal2-loading {
82
+ overflow-y: hidden;
83
+ }
84
+
85
+ .swal2-title {
86
+ color: lighten($swal2-black, 35);
87
+ font-size: 30px;
88
+ text-align: center;
89
+ font-weight: 600;
90
+ text-transform: none;
91
+ position: relative;
92
+ margin: 0 0 .4em;
93
+ padding: 0;
94
+ display: block;
95
+ word-wrap: break-word;
96
+ }
97
+
98
+ .swal2-buttonswrapper {
99
+ margin-top: 15px;
100
+
101
+ &:not(.swal2-loading) {
102
+ .swal2-styled {
103
+ &[disabled] {
104
+ opacity: .4;
105
+ cursor: no-drop;
106
+ }
107
+ }
108
+ }
109
+
110
+ &.swal2-loading {
111
+ .swal2-styled {
112
+ &.swal2-confirm {
113
+ box-sizing: border-box;
114
+ border: 4px solid transparent;
115
+ border-color: transparent;
116
+ width: 40px;
117
+ height: 40px;
118
+ padding: 0;
119
+ margin: 7.5px;
120
+ vertical-align: top;
121
+ background-color: transparent !important;
122
+ color: transparent;
123
+ cursor: default;
124
+ border-radius: 100%;
125
+ animation: rotate-loading 1.5s linear 0s infinite normal;
126
+ user-select: none;
127
+ }
128
+
129
+ &.swal2-cancel {
130
+ margin-left: 30px;
131
+ margin-right: 30px;
132
+ }
133
+ }
134
+
135
+ :not(.swal2-styled) {
136
+ &.swal2-confirm {
137
+ &::after {
138
+ display: inline-block;
139
+ content: '';
140
+ margin-left: 5px 0 15px;
141
+ vertical-align: -1px;
142
+ height: 15px;
143
+ width: 15px;
144
+ border: 3px solid lighten($swal2-black, 60);
145
+ box-shadow: 1px 1px 1px $swal2-white;
146
+ border-right-color: transparent;
147
+ border-radius: 50%;
148
+ animation: rotate-loading 1.5s linear 0s infinite normal;
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ .swal2-styled {
156
+ border: 0;
157
+ border-radius: 3px;
158
+ box-shadow: none;
159
+ color: $swal2-white;
160
+ cursor: pointer;
161
+ font-size: 17px;
162
+ font-weight: 500;
163
+ margin: 15px 5px 0;
164
+ padding: 10px 32px;
165
+ }
166
+
167
+ .swal2-image {
168
+ margin: 20px auto;
169
+ max-width: 100%;
170
+ }
171
+
172
+ .swal2-close {
173
+ background: $swal2-transparent;
174
+ border: 0;
175
+ margin: 0;
176
+ padding: 0;
177
+ width: 38px;
178
+ height: 40px;
179
+ font-size: 36px;
180
+ line-height: 40px;
181
+ font-family: serif;
182
+ position: absolute;
183
+ top: 5px;
184
+ right: 8px;
185
+ cursor: pointer;
186
+ color: $swal2-close-button;
187
+ transition: color .1s ease;
188
+
189
+ &:hover {
190
+ color: $swal2-close-button-hover;
191
+ }
192
+ }
193
+
194
+ > .swal2-input,
195
+ > .swal2-file,
196
+ > .swal2-textarea,
197
+ > .swal2-select,
198
+ > .swal2-radio,
199
+ > .swal2-checkbox {
200
+ display: none;
201
+ }
202
+
203
+ .swal2-content {
204
+ font-size: 18px;
205
+ text-align: center;
206
+ font-weight: 300;
207
+ position: relative;
208
+ float: none;
209
+ margin: 0;
210
+ padding: 0;
211
+ line-height: normal;
212
+ color: lighten($swal2-black, 33);
213
+ word-wrap: break-word;
214
+ }
215
+
216
+ .swal2-input,
217
+ .swal2-file,
218
+ .swal2-textarea,
219
+ .swal2-select,
220
+ .swal2-radio,
221
+ .swal2-checkbox {
222
+ margin: 20px auto;
223
+ }
224
+
225
+ .swal2-input,
226
+ .swal2-file,
227
+ .swal2-textarea {
228
+ width: 100%;
229
+ box-sizing: border-box;
230
+ font-size: 18px;
231
+ border-radius: 3px;
232
+ border: 1px solid $swal2-input-border;
233
+ box-shadow: inset 0 1px 1px $swal2-input-box-shadow;
234
+ transition: border-color box-shadow .3s;
235
+
236
+ &.swal2-inputerror {
237
+ border-color: $swal2-error !important;
238
+ box-shadow: 0 0 2px $swal2-error !important;
239
+ }
240
+
241
+ &:focus {
242
+ outline: none;
243
+ border: 1px solid $swal2-input-border-focus;
244
+ box-shadow: 0 0 3px $swal2-input-box-shadow-focus;
245
+
246
+ &::placeholder {
247
+ transition: opacity .3s .03s ease;
248
+ opacity: .8;
249
+ }
250
+ }
251
+
252
+ &::placeholder {
253
+ color: lighten($swal2-black, 90);
254
+ }
255
+ }
256
+
257
+ .swal2-range {
258
+ input {
259
+ float: left;
260
+ width: 80%;
261
+ }
262
+
263
+ output {
264
+ float: right;
265
+ width: 20%;
266
+ font-size: 20px;
267
+ font-weight: 600;
268
+ text-align: center;
269
+ }
270
+
271
+ input,
272
+ output {
273
+ height: 43px;
274
+ line-height: 43px;
275
+ vertical-align: middle;
276
+ margin: 20px auto;
277
+ padding: 0;
278
+ }
279
+ }
280
+
281
+ .swal2-input {
282
+ height: 43px;
283
+ padding: 0 12px;
284
+
285
+ &[type='number'] {
286
+ max-width: 150px;
287
+ }
288
+ }
289
+
290
+ .swal2-file {
291
+ font-size: 20px;
292
+ }
293
+
294
+ .swal2-textarea {
295
+ height: 108px;
296
+ padding: 12px;
297
+ }
298
+
299
+ .swal2-select {
300
+ color: lighten($swal2-black, 33);
301
+ font-size: inherit;
302
+ padding: 5px 10px;
303
+ min-width: 40%;
304
+ max-width: 100%;
305
+ }
306
+
307
+ .swal2-radio {
308
+ border: 0;
309
+
310
+ label {
311
+ &:not(:first-child) {
312
+ margin-left: 20px;
313
+ }
314
+ }
315
+
316
+ input,
317
+ span {
318
+ vertical-align: middle;
319
+ }
320
+
321
+ input {
322
+ margin: 0 3px 0 0;
323
+ }
324
+ }
325
+
326
+ .swal2-checkbox {
327
+ color: lighten($swal2-black, 33);
328
+
329
+ input,
330
+ span {
331
+ vertical-align: middle;
332
+ }
333
+ }
334
+
335
+ .swal2-validationerror {
336
+ background-color: lighten($swal2-black, 94);
337
+ margin: 0 -20px;
338
+ overflow: hidden;
339
+ padding: 10px;
340
+ color: lighten($swal2-black, 50);
341
+ font-size: 16px;
342
+ font-weight: 300;
343
+ display: none;
344
+
345
+ &::before {
346
+ content: '!';
347
+ display: inline-block;
348
+ width: 24px;
349
+ height: 24px;
350
+ border-radius: 50%;
351
+ background-color: $swal2-validationerror-background;
352
+ color: $swal2-validationerror-color;
353
+ line-height: 24px;
354
+ text-align: center;
355
+ margin-right: 10px;
356
+ }
357
+ }
358
+ }
359
+
360
+ @supports (-ms-accelerator: true) {
361
+ .swal2-range {
362
+ input {
363
+ width: 100% !important;
364
+ }
365
+
366
+ output {
367
+ display: none;
368
+ }
369
+ }
370
+ }
371
+
372
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
373
+ .swal2-range {
374
+ input {
375
+ width: 100% !important;
376
+ }
377
+
378
+ output {
379
+ display: none;
380
+ }
381
+ }
382
+ }
383
+
384
+ .swal2-icon {
385
+ width: 80px;
386
+ height: 80px;
387
+ border: 4px solid transparent;
388
+ border-radius: 50%;
389
+ margin: 20px auto 30px;
390
+ padding: 0;
391
+ position: relative;
392
+ box-sizing: content-box;
393
+ cursor: default;
394
+ user-select: none;
395
+
396
+ &.swal2-error {
397
+ border-color: $swal2-error;
398
+
399
+ .swal2-x-mark {
400
+ position: relative;
401
+ display: block;
402
+ }
403
+
404
+ [class^='swal2-x-mark-line'] {
405
+ position: absolute;
406
+ height: 5px;
407
+ width: 47px;
408
+ background-color: $swal2-error;
409
+ display: block;
410
+ top: 37px;
411
+ border-radius: 2px;
412
+
413
+ &[class$='left'] {
414
+ transform: rotate(45deg);
415
+ left: 17px;
416
+ }
417
+
418
+ &[class$='right'] {
419
+ transform: rotate(-45deg);
420
+ right: 16px;
421
+ }
422
+ }
423
+ }
424
+
425
+ &.swal2-warning {
426
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
427
+ color: $swal2-warning;
428
+ border-color: lighten($swal2-warning, 7);
429
+ font-size: 60px;
430
+ line-height: 80px;
431
+ text-align: center;
432
+ }
433
+
434
+ &.swal2-info {
435
+ font-family: 'Open Sans', sans-serif;
436
+ color: $swal2-info;
437
+ border-color: lighten($swal2-info, 20);
438
+ font-size: 60px;
439
+ line-height: 80px;
440
+ text-align: center;
441
+ }
442
+
443
+ &.swal2-question {
444
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
445
+ color: $swal2-question;
446
+ border-color: lighten($swal2-question, 20);
447
+ font-size: 60px;
448
+ line-height: 80px;
449
+ text-align: center;
450
+ }
451
+
452
+ &.swal2-success {
453
+ border-color: $swal2-success;
454
+
455
+ [class^='swal2-success-circular-line'] { // Emulate moving circular line
456
+ border-radius: 50%;
457
+ position: absolute;
458
+ width: 60px;
459
+ height: 120px;
460
+ transform: rotate(45deg);
461
+
462
+ &[class$='left'] {
463
+ border-radius: 120px 0 0 120px;
464
+ top: -7px;
465
+ left: -33px;
466
+
467
+ transform: rotate(-45deg);
468
+ transform-origin: 60px 60px;
469
+ }
470
+
471
+ &[class$='right'] {
472
+ border-radius: 0 120px 120px 0;
473
+ top: -11px;
474
+ left: 30px;
475
+
476
+ transform: rotate(-45deg);
477
+ transform-origin: 0 60px;
478
+ }
479
+ }
480
+
481
+ .swal2-success-ring { // Ring
482
+ width: 80px;
483
+ height: 80px;
484
+ border: 4px solid $swal2-success-border;
485
+ border-radius: 50%;
486
+ box-sizing: content-box;
487
+
488
+ position: absolute;
489
+ left: -4px;
490
+ top: -4px;
491
+ z-index: 2;
492
+ }
493
+
494
+ .swal2-success-fix { // Hide corners left from animation
495
+ width: 7px;
496
+ height: 90px;
497
+
498
+ position: absolute;
499
+ left: 28px;
500
+ top: 8px;
501
+ z-index: 1;
502
+
503
+ transform: rotate(-45deg);
504
+ }
505
+
506
+ [class^='swal2-success-line'] {
507
+ height: 5px;
508
+ background-color: $swal2-success;
509
+ display: block;
510
+ border-radius: 2px;
511
+
512
+ position: absolute;
513
+ z-index: 2;
514
+
515
+ &[class$='tip'] {
516
+ width: 25px;
517
+
518
+ left: 14px;
519
+ top: 46px;
520
+
521
+ transform: rotate(45deg);
522
+ }
523
+
524
+ &[class$='long'] {
525
+ width: 47px;
526
+
527
+ right: 8px;
528
+ top: 38px;
529
+
530
+ transform: rotate(-45deg);
531
+ }
532
+ }
533
+ }
534
+ }
535
+
536
+ .swal2-progresssteps {
537
+ $lightblue: #add8e6;
538
+ $blue: #3085d6;
539
+
540
+ font-weight: 600;
541
+ margin: 0 0 20px;
542
+ padding: 0;
543
+
544
+ li {
545
+ display: inline-block;
546
+ position: relative;
547
+ }
548
+
549
+ .swal2-progresscircle {
550
+ background: $blue;
551
+ border-radius: 2em;
552
+ color: $swal2-white;
553
+ height: 2em;
554
+ line-height: 2em;
555
+ text-align: center;
556
+ width: 2em;
557
+ z-index: 20;
558
+
559
+ &:first-child {
560
+ margin-left: 0;
561
+ }
562
+
563
+ &:last-child {
564
+ margin-right: 0;
565
+ }
566
+
567
+ &.swal2-activeprogressstep {
568
+ background: $blue;
569
+
570
+ ~ .swal2-progresscircle {
571
+ background: $lightblue;
572
+ }
573
+
574
+ ~ .swal2-progressline {
575
+ background: $lightblue;
576
+ }
577
+ }
578
+ }
579
+
580
+ .swal2-progressline {
581
+ background: $blue;
582
+ height: .4em;
583
+ margin: 0 -1px;
584
+ z-index: 10;
585
+ }
586
+ }
587
+
588
+
589
+ // github.com/limonte/sweetalert2/issues/268
590
+ [class^='swal2'] {
591
+ -webkit-tap-highlight-color: $swal2-transparent;
592
+ }
593
+
594
+ // Animations
595
+
596
+ @mixin keyframes($animation-name) {
597
+ @keyframes #{$animation-name} {
598
+ @content;
599
+ }
600
+ }
601
+
602
+ @mixin animation($str) {
603
+ animation: #{$str};
604
+ }
605
+
606
+
607
+ // Modal animation
608
+
609
+ @include keyframes(showSweetAlert) {
610
+ 0% {
611
+ transform: scale(.7);
612
+ }
613
+
614
+ 45% {
615
+ transform: scale(1.05);
616
+ }
617
+
618
+ 80% {
619
+ transform: scale(.95);
620
+ }
621
+
622
+ 100% {
623
+ transform: scale(1);
624
+ }
625
+ }
626
+
627
+ @include keyframes(hideSweetAlert) {
628
+ 0% {
629
+ transform: scale(1);
630
+ opacity: 1;
631
+ }
632
+
633
+ 100% {
634
+ transform: scale(.5);
635
+ opacity: 0;
636
+ }
637
+ }
638
+
639
+ .swal2-show {
640
+ @include animation('showSweetAlert 0.3s');
641
+
642
+ &.swal2-noanimation {
643
+ @include animation('none');
644
+ }
645
+ }
646
+
647
+ .swal2-hide {
648
+ @include animation('hideSweetAlert 0.15s forwards');
649
+
650
+ &.swal2-noanimation {
651
+ @include animation('none');
652
+ }
653
+ }
654
+
655
+
656
+
657
+ // Success icon animation
658
+
659
+ @include keyframes(animate-success-tip) {
660
+ 0% {
661
+ width: 0;
662
+ left: 1px;
663
+ top: 19px;
664
+ }
665
+
666
+ 54% {
667
+ width: 0;
668
+ left: 1px;
669
+ top: 19px;
670
+ }
671
+
672
+ 70% {
673
+ width: 50px;
674
+ left: -8px;
675
+ top: 37px;
676
+ }
677
+
678
+ 84% {
679
+ width: 17px;
680
+ left: 21px;
681
+ top: 48px;
682
+ }
683
+
684
+ 100% {
685
+ width: 25px;
686
+ left: 14px;
687
+ top: 45px;
688
+ }
689
+ }
690
+
691
+ @include keyframes(animate-success-long) {
692
+ 0% {
693
+ width: 0;
694
+ right: 46px;
695
+ top: 54px;
696
+ }
697
+
698
+ 65% {
699
+ width: 0;
700
+ right: 46px;
701
+ top: 54px;
702
+ }
703
+
704
+ 84% {
705
+ width: 55px;
706
+ right: 0;
707
+ top: 35px;
708
+ }
709
+
710
+ 100% {
711
+ width: 47px;
712
+ right: 8px;
713
+ top: 38px;
714
+ }
715
+ }
716
+
717
+ @include keyframes(rotatePlaceholder) {
718
+ 0% {
719
+ transform: rotate(-45deg);
720
+ }
721
+
722
+ 5% {
723
+ transform: rotate(-45deg);
724
+ }
725
+
726
+ 12% {
727
+ transform: rotate(-405deg);
728
+ }
729
+
730
+ 100% {
731
+ transform: rotate(-405deg);
732
+ }
733
+ }
734
+
735
+ .swal2-animate-success-line-tip {
736
+ @include animation('animate-success-tip 0.75s');
737
+ }
738
+
739
+ .swal2-animate-success-line-long {
740
+ @include animation('animate-success-long 0.75s');
741
+ }
742
+
743
+ .swal2-success {
744
+ &.swal2-animate-success-icon {
745
+ .swal2-success-circular-line-right {
746
+ @include animation('rotatePlaceholder 4.25s ease-in');
747
+ }
748
+ }
749
+ }
750
+
751
+
752
+ // Error icon animation
753
+
754
+ @include keyframes(animate-error-icon) {
755
+ 0% {
756
+ transform: rotateX(100deg);
757
+ opacity: 0;
758
+ }
759
+
760
+ 100% {
761
+ transform: rotateX(0deg);
762
+ opacity: 1;
763
+ }
764
+ }
765
+
766
+ .swal2-animate-error-icon {
767
+ @include animation('animate-error-icon 0.5s');
768
+ }
769
+
770
+ @include keyframes(animate-x-mark) {
771
+ 0% {
772
+ transform: scale(.4);
773
+ margin-top: 26px;
774
+ opacity: 0;
775
+ }
776
+
777
+ 50% {
778
+ transform: scale(.4);
779
+ margin-top: 26px;
780
+ opacity: 0;
781
+ }
782
+
783
+ 80% {
784
+ transform: scale(1.15);
785
+ margin-top: -6px;
786
+ }
787
+
788
+ 100% {
789
+ transform: scale(1);
790
+ margin-top: 0;
791
+ opacity: 1;
792
+ }
793
+ }
794
+
795
+ .swal2-animate-x-mark {
796
+ @include animation('animate-x-mark 0.5s');
797
+ }
798
+
799
+ @include keyframes(rotate-loading) {
800
+ 0% {
801
+ transform: rotate(0deg);
802
+ }
803
+
804
+ 100% {
805
+ transform: rotate(360deg);
806
+ }
807
+ }