1 | "use strict";
|
2 | var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
3 | if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
4 | return cooked;
|
5 | };
|
6 | var __extends = (this && this.__extends) || (function () {
|
7 | var extendStatics = function (d, b) {
|
8 | extendStatics = Object.setPrototypeOf ||
|
9 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
10 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
11 | return extendStatics(d, b);
|
12 | };
|
13 | return function (d, b) {
|
14 | extendStatics(d, b);
|
15 | function __() { this.constructor = d; }
|
16 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17 | };
|
18 | })();
|
19 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
20 | if (k2 === undefined) k2 = k;
|
21 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
22 | }) : (function(o, m, k, k2) {
|
23 | if (k2 === undefined) k2 = k;
|
24 | o[k2] = m[k];
|
25 | }));
|
26 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
27 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
28 | }) : function(o, v) {
|
29 | o["default"] = v;
|
30 | });
|
31 | var __importStar = (this && this.__importStar) || function (mod) {
|
32 | if (mod && mod.__esModule) return mod;
|
33 | var result = {};
|
34 | if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
35 | __setModuleDefault(result, mod);
|
36 | return result;
|
37 | };
|
38 | Object.defineProperty(exports, "__esModule", { value: true });
|
39 |
|
40 | var React = __importStar(require("react"));
|
41 | var react_1 = require("@emotion/react");
|
42 | var helpers_1 = require("./helpers");
|
43 | var puff = [
|
44 | react_1.keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {transform: scale(0)}\n 100% {transform: scale(1.0)}\n"], ["\n 0% {transform: scale(0)}\n 100% {transform: scale(1.0)}\n"]))),
|
45 | react_1.keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 0% {opacity: 1}\n 100% {opacity: 0}\n"], ["\n 0% {opacity: 1}\n 100% {opacity: 0}\n"])))
|
46 | ];
|
47 | var Loader = (function (_super) {
|
48 | __extends(Loader, _super);
|
49 | function Loader() {
|
50 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
51 | _this.getSize = function () {
|
52 | return _this.props.size;
|
53 | };
|
54 | _this.style = function (i) {
|
55 | var _a = _this.props, color = _a.color, speedMultiplier = _a.speedMultiplier;
|
56 | return react_1.css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n height: ", ";\n width: ", ";\n border: thick solid ", ";\n border-radius: 50%;\n opacity: 1;\n top: 0;\n left: 0;\n animation-fill-mode: both;\n animation: ", ", ", ";\n animation-duration: ", "s;\n animation-iteration-count: infinite;\n animation-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1), cubic-bezier(0.3, 0.61, 0.355, 1);\n animation-delay: ", ";\n "], ["\n position: absolute;\n height: ", ";\n width: ", ";\n border: thick solid ", ";\n border-radius: 50%;\n opacity: 1;\n top: 0;\n left: 0;\n animation-fill-mode: both;\n animation: ", ", ", ";\n animation-duration: ", "s;\n animation-iteration-count: infinite;\n animation-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1), cubic-bezier(0.3, 0.61, 0.355, 1);\n animation-delay: ", ";\n "])), helpers_1.cssValue(_this.getSize()), helpers_1.cssValue(_this.getSize()), color, puff[0], puff[1], 2 / speedMultiplier, i === 1 ? "-1s" : "0s");
|
57 | };
|
58 | _this.wrapper = function () {
|
59 | return react_1.css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n width: ", ";\n height: ", ";\n "], ["\n position: relative;\n width: ", ";\n height: ", ";\n "])), helpers_1.cssValue(_this.getSize()), helpers_1.cssValue(_this.getSize()));
|
60 | };
|
61 | return _this;
|
62 | }
|
63 | Loader.prototype.render = function () {
|
64 | var _a = this.props, loading = _a.loading, css = _a.css;
|
65 | return loading ? (react_1.jsx("span", { css: [this.wrapper(), css] },
|
66 | react_1.jsx("span", { css: this.style(1) }),
|
67 | react_1.jsx("span", { css: this.style(2) }))) : null;
|
68 | };
|
69 | Loader.defaultProps = helpers_1.sizeDefaults(60);
|
70 | return Loader;
|
71 | }(React.PureComponent));
|
72 | exports.default = Loader;
|
73 | var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|