sweetalert.scss 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. // SweetAlert
  2. // 2014-2015 (c) - Tristan Edwards
  3. // github.com/t4t5/sweetalert
  4. body.stop-scrolling {
  5. height: 100%;
  6. overflow: hidden;
  7. }
  8. .sweet-overlay {
  9. background-color: rgb(0, 0, 0); /* IE8 */
  10. -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)"; /* IE8 */
  11. background-color: rgba(black, 0.4);
  12. position: fixed;
  13. left: 0;
  14. right: 0;
  15. top: 0;
  16. bottom: 0;
  17. display: none;
  18. z-index: 10000;
  19. }
  20. .sweet-alert {
  21. $width: 478px;
  22. $padding: 17px;
  23. background-color: white;
  24. font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  25. width: $width;
  26. padding: $padding;
  27. border-radius: 5px;
  28. text-align: center;
  29. position: fixed;
  30. left: 50%;
  31. top: 50%;
  32. margin-left: -($width/2 + $padding);
  33. margin-top: -200px;
  34. overflow: hidden;
  35. display: none;
  36. z-index: 99999;
  37. @media all and (max-width: 540px) {
  38. width: auto;
  39. margin-left: 0;
  40. margin-right: 0;
  41. left: 15px;
  42. right: 15px;
  43. }
  44. h2 {
  45. color: #575757;
  46. font-size: 30px;
  47. text-align: center;
  48. font-weight: 600;
  49. text-transform: none;
  50. position: relative;
  51. margin: 25px 0;
  52. padding: 0;
  53. line-height: 40px;
  54. display: block;
  55. }
  56. p {
  57. color: #797979;
  58. font-size: 16px;
  59. text-align: center;
  60. font-weight: 300;
  61. position: relative;
  62. text-align: inherit;
  63. float: none;
  64. margin: 0;
  65. padding: 0;
  66. line-height: normal;
  67. }
  68. fieldset {
  69. border: none;
  70. position: relative;
  71. }
  72. .sa-error-container {
  73. background-color: #f1f1f1;
  74. margin-left: -17px;
  75. margin-right: -17px;
  76. overflow: hidden;
  77. padding: 0 10px;
  78. max-height: 0;
  79. webkit-transition: padding 0.15s, max-height 0.15s;
  80. transition: padding 0.15s, max-height 0.15s;
  81. &.show {
  82. padding: 10px 0;
  83. max-height: 100px;
  84. webkit-transition: padding 0.2s, max-height 0.2s;
  85. transition: padding 0.25s, max-height 0.25s;
  86. }
  87. .icon {
  88. display: inline-block;
  89. width: 24px;
  90. height: 24px;
  91. border-radius: 50%;
  92. background-color: rgb(234, 125, 125);
  93. color: white;
  94. line-height: 24px;
  95. text-align: center;
  96. margin-right: 3px;
  97. }
  98. p {
  99. display: inline-block;
  100. }
  101. }
  102. .sa-input-error {
  103. position: absolute;
  104. top: 29px;
  105. right: 26px;
  106. width: 20px;
  107. height: 20px;
  108. opacity: 0;
  109. -webkit-transform: scale(0.5);
  110. transform: scale(0.5);
  111. -webkit-transform-origin: 50% 50%;
  112. transform-origin: 50% 50%;
  113. -webkit-transition: all 0.1s;
  114. transition: all 0.1s;
  115. &::before, &::after {
  116. content: "";
  117. width: 20px;
  118. height: 6px;
  119. background-color: #f06e57;
  120. border-radius: 3px;
  121. position: absolute;
  122. top: 50%;
  123. margin-top: -4px;
  124. left: 50%;
  125. margin-left: -9px;
  126. }
  127. &::before {
  128. -webkit-transform: rotate(-45deg);
  129. transform: rotate(-45deg);
  130. }
  131. &::after {
  132. -webkit-transform: rotate(45deg);
  133. transform: rotate(45deg);
  134. }
  135. &.show {
  136. opacity: 1;
  137. -webkit-transform: scale(1);
  138. transform: scale(1);
  139. }
  140. }
  141. input {
  142. width: 100%;
  143. box-sizing: border-box;
  144. border-radius: 3px;
  145. border: 1px solid rgb(215, 215, 215);
  146. height: 43px;
  147. margin-top: 10px;
  148. margin-bottom: 17px;
  149. font-size: 18px;
  150. box-shadow: inset 0px 1px 1px rgba(black, 0.06);
  151. padding: 0 12px;
  152. display: none;
  153. -webkit-transition: all 0.3s;
  154. transition: all 0.3s;
  155. &:focus {
  156. outline: none;
  157. box-shadow: 0px 0px 3px rgb(196, 230, 245);
  158. border: 1px solid rgb(180, 219, 237);
  159. &::-moz-placeholder {
  160. transition: opacity 0.3s 0.03s ease;
  161. opacity: 0.5;
  162. }
  163. &:-ms-input-placeholder {
  164. transition: opacity 0.3s 0.03s ease;
  165. opacity: 0.5;
  166. }
  167. &::-webkit-input-placeholder {
  168. transition: opacity 0.3s 0.03s ease;
  169. opacity: 0.5;
  170. }
  171. }
  172. &::-moz-placeholder {
  173. color: lighten(#575757, 40);
  174. }
  175. &:-ms-input-placeholder {
  176. color: lighten(#575757, 40);
  177. }
  178. &::-webkit-input-placeholder {
  179. color: lighten(#575757, 40);
  180. }
  181. }
  182. &.show-input input {
  183. display: block;
  184. }
  185. .sa-confirm-button-container {
  186. display: inline-block;
  187. position: relative;
  188. }
  189. .la-ball-fall {
  190. position: absolute;
  191. left: 50%;
  192. top: 50%;
  193. margin-left: -27px;
  194. margin-top: 4px;
  195. opacity: 0;
  196. visibility: hidden;
  197. }
  198. button {
  199. $btnBlue: #8CD4F5;
  200. $btnGray: #C1C1C1;
  201. background-color: $btnBlue;
  202. color: white;
  203. border: none;
  204. box-shadow: none;
  205. font-size: 17px;
  206. font-weight: 500;
  207. -webkit-border-radius: 4px;
  208. border-radius: 5px;
  209. padding: 10px 32px;
  210. margin: 26px 5px 0 5px;
  211. cursor: pointer;
  212. &:focus {
  213. outline: none;
  214. box-shadow: 0 0 2px rgba(128, 179, 235, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  215. }
  216. &:hover {
  217. background-color: darken($btnBlue, 3%);
  218. }
  219. &:active {
  220. background-color: darken($btnBlue, 10%);
  221. }
  222. &.cancel {
  223. background-color: $btnGray;
  224. &:hover {
  225. background-color: darken($btnGray, 3%);
  226. }
  227. &:active {
  228. background-color: darken($btnGray, 10%);
  229. }
  230. // Cancel button should keep the same style
  231. &:focus {
  232. box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important;
  233. }
  234. }
  235. &[disabled] {
  236. opacity: .6;
  237. cursor: default;
  238. }
  239. &.confirm[disabled] {
  240. color: transparent;
  241. ~ .la-ball-fall {
  242. opacity: 1;
  243. visibility: visible;
  244. transition-delay: 0s;
  245. }
  246. }
  247. // Removes selection outline in Firefox
  248. &::-moz-focus-inner {
  249. border: 0;
  250. }
  251. }
  252. // Only show focus-style when there is multiple choice of actions
  253. &[data-has-cancel-button=false] button {
  254. box-shadow: none !important;
  255. }
  256. &[data-has-confirm-button=false][data-has-cancel-button=false] {
  257. padding-bottom: 40px;
  258. }
  259. .sa-icon {
  260. $red: #F27474;
  261. $orange: #F8BB86;
  262. $blue: #C9DAE1;
  263. $green: #A5DC86;
  264. width: 80px;
  265. height: 80px;
  266. border: 4px solid gray;
  267. -webkit-border-radius: 40px;
  268. border-radius: 40px;
  269. border-radius: 50%;
  270. margin: 20px auto;
  271. padding: 0;
  272. position: relative;
  273. box-sizing: content-box;
  274. &.sa-error {
  275. border-color: $red;
  276. .sa-x-mark {
  277. position: relative;
  278. display: block;
  279. }
  280. .sa-line {
  281. position: absolute;
  282. height: 5px;
  283. width: 47px;
  284. background-color: $red;
  285. display: block;
  286. top: 37px;
  287. border-radius: 2px;
  288. &.sa-left {
  289. -webkit-transform: rotate(45deg);
  290. transform: rotate(45deg);
  291. left: 17px;
  292. }
  293. &.sa-right {
  294. -webkit-transform: rotate(-45deg);
  295. transform: rotate(-45deg);
  296. right: 16px;
  297. }
  298. }
  299. }
  300. &.sa-warning {
  301. border-color: $orange;
  302. .sa-body { // Exclamation mark body
  303. position: absolute;
  304. width: 5px;
  305. height: 47px;
  306. left: 50%;
  307. top: 10px;
  308. -webkit-border-radius: 2px;
  309. border-radius: 2px;
  310. margin-left: -2px;
  311. background-color: $orange;
  312. }
  313. .sa-dot { // Exclamation mark dot
  314. position: absolute;
  315. width: 7px;
  316. height: 7px;
  317. -webkit-border-radius: 50%;
  318. border-radius: 50%;
  319. margin-left: -3px;
  320. left: 50%;
  321. bottom: 10px;
  322. background-color: $orange;
  323. }
  324. }
  325. &.sa-info {
  326. border-color: $blue;
  327. &::before { // i-letter body
  328. content: "";
  329. position: absolute;
  330. width: 5px;
  331. height: 29px;
  332. left: 50%;
  333. bottom: 17px;
  334. border-radius: 2px;
  335. margin-left: -2px;
  336. background-color: $blue;
  337. }
  338. &::after { // i-letter dot
  339. content: "";
  340. position: absolute;
  341. width: 7px;
  342. height: 7px;
  343. border-radius: 50%;
  344. margin-left: -3px;
  345. top: 19px;
  346. background-color: $blue;
  347. }
  348. }
  349. &.sa-success {
  350. border-color: $green;
  351. &::before, &::after { // Emulate moving circular line
  352. content: '';
  353. -webkit-border-radius: 40px;
  354. border-radius: 40px;
  355. border-radius: 50%;
  356. position: absolute;
  357. width: 60px;
  358. height: 120px;
  359. background: white;
  360. -webkit-transform: rotate(45deg);
  361. transform: rotate(45deg);
  362. }
  363. &::before {
  364. -webkit-border-radius: 120px 0 0 120px;
  365. border-radius: 120px 0 0 120px;
  366. top: -7px;
  367. left: -33px;
  368. -webkit-transform: rotate(-45deg);
  369. transform: rotate(-45deg);
  370. -webkit-transform-origin: 60px 60px;
  371. transform-origin: 60px 60px;
  372. }
  373. &::after {
  374. -webkit-border-radius: 0 120px 120px 0;
  375. border-radius: 0 120px 120px 0;
  376. top: -11px;
  377. left: 30px;
  378. -webkit-transform: rotate(-45deg);
  379. transform: rotate(-45deg);
  380. -webkit-transform-origin: 0px 60px;
  381. transform-origin: 0px 60px;
  382. }
  383. .sa-placeholder { // Ring
  384. width: 80px;
  385. height: 80px;
  386. border: 4px solid rgba($green, 0.2);
  387. -webkit-border-radius: 40px;
  388. border-radius: 40px;
  389. border-radius: 50%;
  390. box-sizing: content-box;
  391. position: absolute;
  392. left: -4px;
  393. top: -4px;
  394. z-index: 2;
  395. }
  396. .sa-fix { // Hide corners left from animation
  397. width: 5px;
  398. height: 90px;
  399. background-color: white;
  400. position: absolute;
  401. left: 28px;
  402. top: 8px;
  403. z-index: 1;
  404. -webkit-transform: rotate(-45deg);
  405. transform: rotate(-45deg);
  406. }
  407. .sa-line {
  408. height: 5px;
  409. background-color: $green;
  410. display: block;
  411. border-radius: 2px;
  412. position: absolute;
  413. z-index: 2;
  414. &.sa-tip {
  415. width: 25px;
  416. left: 14px;
  417. top: 46px;
  418. -webkit-transform: rotate(45deg);
  419. transform: rotate(45deg);
  420. }
  421. &.sa-long {
  422. width: 47px;
  423. right: 8px;
  424. top: 38px;
  425. -webkit-transform: rotate(-45deg);
  426. transform: rotate(-45deg);
  427. }
  428. }
  429. }
  430. &.sa-custom {
  431. background-size: contain;
  432. border-radius: 0;
  433. border: none;
  434. background-position: center center;
  435. background-repeat: no-repeat;
  436. }
  437. }
  438. }
  439. /*
  440. * Animations
  441. */
  442. @mixin keyframes($animation-name) {
  443. @-webkit-keyframes #{$animation-name} {
  444. @content;
  445. }
  446. @keyframes #{$animation-name} {
  447. @content;
  448. }
  449. }
  450. @mixin animation($str) {
  451. -webkit-animation: #{$str};
  452. animation: #{$str};
  453. }
  454. // Modal animation
  455. @include keyframes(showSweetAlert) {
  456. 0% { transform: scale(0.7); -webkit-transform: scale(0.7); }
  457. 45% { transform: scale(1.05); -webkit-transform: scale(1.05); }
  458. 80% { transform: scale(0.95); -webkit-transform: scale(0.95); }
  459. 100% { transform: scale(1); -webkit-transform: scale(1); }
  460. }
  461. @include keyframes(hideSweetAlert) {
  462. 0% { transform: scale(1); -webkit-transform: scale(1); }
  463. 100% { transform: scale(0.5); -webkit-transform: scale(0.5); }
  464. }
  465. @include keyframes(slideFromTop) {
  466. 0% { top: 0%; }
  467. 100% { top: 50%; }
  468. }
  469. @include keyframes(slideToTop) {
  470. 0% { top: 50%; }
  471. 100% { top: 0%; }
  472. }
  473. @include keyframes(slideFromBottom) {
  474. 0% { top: 70%; }
  475. 100% { top: 50%; }
  476. }
  477. @include keyframes(slideToBottom) {
  478. 0% { top: 50%; }
  479. 100% { top: 70%; }
  480. }
  481. .showSweetAlert {
  482. &[data-animation=pop] {
  483. @include animation('showSweetAlert 0.3s');
  484. }
  485. &[data-animation=none] {
  486. @include animation('none');
  487. }
  488. &[data-animation=slide-from-top] {
  489. @include animation('slideFromTop 0.3s');
  490. }
  491. &[data-animation=slide-from-bottom] {
  492. @include animation('slideFromBottom 0.3s');
  493. }
  494. }
  495. .hideSweetAlert {
  496. &[data-animation=pop] {
  497. @include animation('hideSweetAlert 0.2s');
  498. }
  499. &[data-animation=none] {
  500. @include animation('none');
  501. }
  502. &[data-animation=slide-from-top] {
  503. @include animation('slideToTop 0.4s');
  504. }
  505. &[data-animation=slide-from-bottom] {
  506. @include animation('slideToBottom 0.3s');
  507. }
  508. }
  509. // Success icon animation
  510. @include keyframes(animateSuccessTip) {
  511. 0% { width: 0; left: 1px; top: 19px; }
  512. 54% { width: 0; left: 1px; top: 19px; }
  513. 70% { width: 50px; left: -8px; top: 37px; }
  514. 84% { width: 17px; left: 21px; top: 48px; }
  515. 100% { width: 25px; left: 14px; top: 45px; }
  516. }
  517. @include keyframes(animateSuccessLong) {
  518. 0% { width: 0; right: 46px; top: 54px; }
  519. 65% { width: 0; right: 46px; top: 54px; }
  520. 84% { width: 55px; right: 0px; top: 35px; }
  521. 100% { width: 47px; right: 8px; top: 38px; }
  522. }
  523. @include keyframes(rotatePlaceholder) {
  524. 0% { transform: rotate(-45deg); -webkit-transform: rotate(-45deg); }
  525. 5% { transform: rotate(-45deg); -webkit-transform: rotate(-45deg); }
  526. 12% { transform: rotate(-405deg); -webkit-transform: rotate(-405deg); }
  527. 100% { transform: rotate(-405deg); -webkit-transform: rotate(-405deg); }
  528. }
  529. .animateSuccessTip {
  530. @include animation('animateSuccessTip 0.75s');
  531. }
  532. .animateSuccessLong {
  533. @include animation('animateSuccessLong 0.75s');
  534. }
  535. .sa-icon.sa-success.animate::after {
  536. @include animation('rotatePlaceholder 4.25s ease-in');
  537. }
  538. // Error icon animation
  539. @include keyframes(animateErrorIcon) {
  540. 0% { transform: rotateX(100deg); -webkit-transform: rotateX(100deg); opacity: 0; }
  541. 100% { transform: rotateX(0deg); -webkit-transform: rotateX(0deg); opacity: 1; }
  542. }
  543. .animateErrorIcon {
  544. @include animation('animateErrorIcon 0.5s');
  545. }
  546. @include keyframes(animateXMark) {
  547. 0% { transform: scale(0.4); -webkit-transform: scale(0.4); margin-top: 26px; opacity: 0; }
  548. 50% { transform: scale(0.4); -webkit-transform: scale(0.4); margin-top: 26px; opacity: 0; }
  549. 80% { transform: scale(1.15); -webkit-transform: scale(1.15); margin-top: -6px; }
  550. 100% { transform: scale(1); -webkit-transform: scale(1); margin-top: 0; opacity: 1; }
  551. }
  552. .animateXMark {
  553. @include animation('animateXMark 0.5s');
  554. }
  555. @include keyframes(pulseWarning) {
  556. 0% { border-color: #F8D486; }
  557. 100% { border-color: #F8BB86; }
  558. }
  559. .pulseWarning {
  560. @include animation('pulseWarning 0.75s infinite alternate');
  561. }
  562. @include keyframes(pulseWarningIns) {
  563. 0% { background-color: #F8D486; }
  564. 100% { background-color: #F8BB86; }
  565. }
  566. .pulseWarningIns {
  567. @include animation('pulseWarningIns 0.75s infinite alternate');
  568. }
  569. @include keyframes(rotate-loading) {
  570. 0% {
  571. transform: rotate(0deg);
  572. }
  573. 100% {
  574. transform: rotate(360deg);
  575. }
  576. }