sweet-alert 0.0.4

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,432 @@
1
+ // SweetAlert
2
+ // 2014 (c) - Tristan Edwards
3
+ // github.com/t4t5/sweetalert
4
+
5
+ @import url(//fonts.googleapis.com/css?family=Open+Sans:400,600,700,300); // Open Sans font
6
+
7
+ .sweet-overlay {
8
+ background-color: rgba(black, 0.4);
9
+
10
+ position: fixed;
11
+ left: 0;
12
+ right: 0;
13
+ top: 0;
14
+ bottom: 0;
15
+
16
+ display: none;
17
+ z-index: 1000;
18
+ }
19
+
20
+ .sweet-alert {
21
+ $width: 478px;
22
+ $padding: 17px;
23
+
24
+ background-color: white;
25
+ font-family: 'Open Sans', sans-serif;
26
+ width: $width;
27
+ padding: $padding;
28
+ border-radius: 5px;
29
+ text-align: center;
30
+
31
+ position: fixed;
32
+ left: 50%;
33
+ top: 50%;
34
+ margin-left: -($width/2 + $padding);
35
+ margin-top: -200px;
36
+
37
+ overflow: hidden;
38
+ display: none;
39
+ z-index: 2000;
40
+
41
+ @media all and (max-width: 540px) {
42
+ width: auto;
43
+ margin-left: 0;
44
+ margin-right: 0;
45
+
46
+ left: 15px;
47
+ right: 15px;
48
+ }
49
+
50
+ h2 {
51
+ color: #575757;
52
+ font-size: 30px;
53
+ text-align: center;
54
+ font-weight: 600;
55
+ text-transform: none;
56
+ position: relative;
57
+ }
58
+
59
+ p {
60
+ color: #797979;
61
+ font-size: 16px;
62
+ text-align: center;
63
+ font-weight: 300;
64
+ position: relative;
65
+ margin: 0;
66
+ line-height: normal;
67
+ }
68
+
69
+ button {
70
+ $btnBlue: #AEDEF4;
71
+ $btnGray: #D0D0D0;
72
+
73
+ background-color: $btnBlue;
74
+ color: white;
75
+ border: none;
76
+ box-shadow: none;
77
+ font-size: 17px;
78
+ font-weight: 500;
79
+ border-radius: 5px;
80
+ padding: 10px 32px;
81
+ margin: 26px 5px 0 5px;
82
+ cursor: pointer;
83
+ &:focus {
84
+ outline: none;
85
+ box-shadow: 0 0 2px rgba(128, 179, 235, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
86
+ }
87
+ &:hover {
88
+ background-color: darken($btnBlue, 3%);
89
+ }
90
+ &:active {
91
+ background-color: darken($btnBlue, 10%);
92
+ }
93
+ &.cancel {
94
+ background-color: $btnGray;
95
+ &:hover {
96
+ background-color: darken($btnGray, 3%);
97
+ }
98
+ &:active {
99
+ background-color: darken($btnGray, 10%);
100
+ }
101
+ // Cancel button should keep the same style
102
+ &:focus {
103
+ box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important;
104
+ }
105
+ }
106
+ // Removes selection outline in Firefox
107
+ &::-moz-focus-inner {
108
+ border: 0;
109
+ }
110
+ }
111
+
112
+ // Only show focus-style when there is multiple choice of actions
113
+ &[data-has-cancel-button=false] button {
114
+ box-shadow: none !important;
115
+ }
116
+
117
+
118
+ .icon {
119
+ $red: #F27474;
120
+ $orange: #F8BB86;
121
+ $blue: #C9DAE1;
122
+ $green: #A5DC86;
123
+
124
+ width: 80px;
125
+ height: 80px;
126
+ border: 4px solid gray;
127
+ border-radius: 50%;
128
+ margin: 20px auto;
129
+ position: relative;
130
+ box-sizing: content-box;
131
+
132
+ &.error {
133
+ border-color: $red;
134
+
135
+ .x-mark {
136
+ position: relative;
137
+ display: block;
138
+ }
139
+
140
+ .line {
141
+ position: absolute;
142
+ height: 5px;
143
+ width: 47px;
144
+ background-color: $red;
145
+ display: block;
146
+ top: 37px;
147
+ border-radius: 2px;
148
+
149
+ &.left {
150
+ -webkit-transform: rotate(45deg);
151
+ transform: rotate(45deg);
152
+ left: 17px;
153
+ }
154
+ &.right {
155
+ -webkit-transform: rotate(-45deg);
156
+ transform: rotate(-45deg);
157
+ right: 16px;
158
+ }
159
+ }
160
+ }
161
+ &.warning {
162
+ border-color: $orange;
163
+
164
+ .body { // Exclamation mark body
165
+ position: absolute;
166
+ width: 5px;
167
+ height: 47px;
168
+ left: 50%;
169
+ top: 10px;
170
+ border-radius: 2px;
171
+ margin-left: -2px;
172
+ background-color: $orange;
173
+ }
174
+ .dot { // Exclamation mark dot
175
+ position: absolute;
176
+ width: 7px;
177
+ height: 7px;
178
+ border-radius: 50%;
179
+ margin-left: -3px;
180
+ left: 50%;
181
+ bottom: 10px;
182
+ background-color: $orange;
183
+ }
184
+ }
185
+ &.info {
186
+ border-color: $blue;
187
+
188
+ &::before { // i-letter body
189
+ content: "";
190
+ position: absolute;
191
+ width: 5px;
192
+ height: 29px;
193
+ left: 50%;
194
+ bottom: 17px;
195
+ border-radius: 2px;
196
+ margin-left: -2px;
197
+ background-color: $blue;
198
+ }
199
+ &::after { // i-letter dot
200
+ content: "";
201
+ position: absolute;
202
+ width: 7px;
203
+ height: 7px;
204
+ border-radius: 50%;
205
+ margin-left: -3px;
206
+ top: 19px;
207
+ background-color: $blue;
208
+ }
209
+ }
210
+ &.success {
211
+ border-color: $green;
212
+
213
+ &::before, &::after { // Emulate moving circular line
214
+ content: '';
215
+ border-radius: 50%;
216
+ position: absolute;
217
+ width: 60px;
218
+ height: 120px;
219
+ background: white;
220
+ -webkit-transform: rotate(45deg);
221
+ transform: rotate(45deg);
222
+ }
223
+ &::before {
224
+ border-radius: 120px 0 0 120px;
225
+ top: -7px;
226
+ left: -33px;
227
+
228
+ -webkit-transform: rotate(-45deg);
229
+ transform: rotate(-45deg);
230
+ -webkit-transform-origin: 60px 60px;
231
+ transform-origin: 60px 60px;
232
+ }
233
+ &::after {
234
+ border-radius: 0 120px 120px 0;
235
+ top: -11px;
236
+ left: 30px;
237
+
238
+ -webkit-transform: rotate(-45deg);
239
+ transform: rotate(-45deg);
240
+ -webkit-transform-origin: 0px 60px;
241
+ transform-origin: 0px 60px;
242
+ }
243
+
244
+ .placeholder { // Ring
245
+ width: 80px;
246
+ height: 80px;
247
+ border: 4px solid rgba($green, 0.2);
248
+ border-radius: 50%;
249
+ box-sizing: content-box;
250
+
251
+ position: absolute;
252
+ left: -4px;
253
+ top: -4px;
254
+ z-index: 2;
255
+ }
256
+
257
+ .fix { // Hide corners left from animation
258
+ width: 5px;
259
+ height: 90px;
260
+ background-color: white;
261
+
262
+ position: absolute;
263
+ left: 28px;
264
+ top: 8px;
265
+ z-index: 1;
266
+
267
+ -webkit-transform: rotate(-45deg);
268
+ transform: rotate(-45deg);
269
+ }
270
+
271
+ .line {
272
+ height: 5px;
273
+ background-color: $green;
274
+ display: block;
275
+ border-radius: 2px;
276
+
277
+ position: absolute;
278
+ z-index: 2;
279
+
280
+ &.tip {
281
+ width: 25px;
282
+
283
+ left: 14px;
284
+ top: 46px;
285
+
286
+ -webkit-transform: rotate(45deg);
287
+ transform: rotate(45deg);
288
+ }
289
+ &.long {
290
+ width: 47px;
291
+
292
+ right: 8px;
293
+ top: 38px;
294
+
295
+ -webkit-transform: rotate(-45deg);
296
+ transform: rotate(-45deg);
297
+ }
298
+ }
299
+ }
300
+ &.custom {
301
+ background-size: contain;
302
+ border-radius: 0;
303
+ border: none;
304
+ background-position: center center;
305
+ background-repeat: no-repeat;
306
+ }
307
+ }
308
+
309
+ }
310
+
311
+ /*
312
+ * Animations
313
+ */
314
+
315
+ @mixin keyframes($animation-name) {
316
+ @-webkit-keyframes #{$animation-name} {
317
+ @content;
318
+ }
319
+ @-moz-keyframes #{$animation-name} {
320
+ @content;
321
+ }
322
+ @keyframes #{$animation-name} {
323
+ @content;
324
+ }
325
+ }
326
+ @mixin animation($str) {
327
+ -webkit-animation: #{$str};
328
+ -moz-animation: #{$str};
329
+ animation: #{$str};
330
+ }
331
+
332
+
333
+ // Modal animation
334
+
335
+ @include keyframes(showSweetAlert) {
336
+ 0% { transform: scale(0.7); -webkit-transform: scale(0.7); }
337
+ 45% { transform: scale(1.05); -webkit-transform: scale(1.05); }
338
+ 80% { transform: scale(0.95); -webkit-tranform: scale(0.95); }
339
+ 100% { transform: scale(1); -webkit-transform: scale(1); }
340
+ }
341
+ @include keyframes(hideSweetAlert) {
342
+ 0% { transform: scale(1); -webkit-transform: scale(1); }
343
+ 100% { transform: scale(0.5); -webkit-transform: scale(0.5); }
344
+ }
345
+
346
+ .showSweetAlert {
347
+ @include animation('showSweetAlert 0.3s');
348
+ }
349
+ .hideSweetAlert {
350
+ @include animation('hideSweetAlert 0.2s');
351
+ }
352
+
353
+
354
+
355
+ // Success icon animation
356
+
357
+ @include keyframes(animateSuccessTip) {
358
+ 0% { width: 0; left: 1px; top: 19px; }
359
+ 54% { width: 0; left: 1px; top: 19px; }
360
+ 70% { width: 50px; left: -8px; top: 37px; }
361
+ 84% { width: 17px; left: 21px; top: 48px; }
362
+ 100% { width: 25px; left: 14px; top: 45px; }
363
+ }
364
+ @include keyframes(animateSuccessLong) {
365
+ 0% { width: 0; right: 46px; top: 54px; }
366
+ 65% { width: 0; right: 46px; top: 54px; }
367
+ 84% { width: 55px; right: 0px; top: 35px; }
368
+ 100% { width: 47px; right: 8px; top: 38px; }
369
+ }
370
+ @include keyframes(rotatePlaceholder) {
371
+ 0% { transform: rotate(-45deg); -webkit-transform: rotate(-45deg); }
372
+ 5% { transform: rotate(-45deg); -webkit-transform: rotate(-45deg); }
373
+ 12% { transform: rotate(-405deg); -webkit-transform: rotate(-405deg); }
374
+ 100% { transform: rotate(-405deg); -webkit-transform: rotate(-405deg); }
375
+ }
376
+
377
+ .animateSuccessTip {
378
+ @include animation('animateSuccessTip 0.75s');
379
+ }
380
+ .animateSuccessLong {
381
+ @include animation('animateSuccessLong 0.75s');
382
+ }
383
+ .icon.success.animate::after {
384
+ @include animation('rotatePlaceholder 4.25s ease-in');
385
+ }
386
+
387
+
388
+ // Error icon animation
389
+
390
+ @include keyframes(animateErrorIcon) {
391
+ 0% { transform: rotateX(100deg); -webkit-transform: rotateX(100deg); opacity: 0; }
392
+ 100% { transform: rotateX(0deg); -webkit-transform: rotateX(0deg); opacity: 1; }
393
+ }
394
+ .animateErrorIcon {
395
+ @include animation('animateErrorIcon 0.5s');
396
+ }
397
+ @include keyframes(animateXMark) {
398
+ 0% { transform: scale(0.4); -webkit-transform: scale(0.4); margin-top: 26px; opacity: 0; }
399
+ 50% { transform: scale(0.4); -webkit-transform: scale(0.4); margin-top: 26px; opacity: 0; }
400
+ 80% { transform: scale(1.15); -webkit-transform: scale(1.15); margin-top: -6px; }
401
+ 100% { transform: scale(1); -webkit-transform: scale(1); margin-top: 0; opacity: 1; }
402
+ }
403
+ .animateXMark {
404
+ @include animation('animateXMark 0.5s');
405
+ }
406
+
407
+
408
+ // Warning and info animation
409
+
410
+ /*@include keyframes(simpleRotate) {
411
+ 0% { transform: rotateY(0deg); }
412
+ 100% { transform: rotateY(-360deg); }
413
+ }
414
+ .simpleRotate {
415
+ @include animation('simpleRotate 0.75s');
416
+ }*/
417
+
418
+ @include keyframes(pulseWarning) {
419
+ 0% { border-color: #F8D486; }
420
+ 100% { border-color: #F8BB86; }
421
+ }
422
+ .pulseWarning {
423
+ @include animation('pulseWarning 0.75s infinite alternate');
424
+ }
425
+
426
+ @include keyframes(pulseWarningIns) {
427
+ 0% { background-color: #F8D486; }
428
+ 100% { background-color: #F8BB86; }
429
+ }
430
+ .pulseWarningIns {
431
+ @include animation('pulseWarningIns 0.75s infinite alternate');
432
+ }
@@ -0,0 +1,3 @@
1
+ module SweetAlert
2
+ require "sweet-alert/engine"
3
+ end
@@ -0,0 +1,4 @@
1
+ module SweetAlert
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module SweetAlert
2
+ VERSION = '0.0.4'
3
+ end
@@ -0,0 +1,16 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'sweet-alert'
6
+ s.version = '0.0.4'
7
+ s.summary = "The awesome replacement for Javascript's alert"
8
+ s.authors = ["Najtmare"]
9
+ s.email = 'millan@sino.net'
10
+ s.files = `git ls-files`.split("\n")
11
+ s.homepage =
12
+ 'http://rubygems.org/gems/sweet-alert'
13
+ s.license = 'MIT'
14
+
15
+ s.require_paths = ['lib']
16
+ end