UNPKG

4.1 kBJavaScriptView Raw
1"use strict";
2var __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};
6var __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})();
19var __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}));
26var __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});
31var __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};
38Object.defineProperty(exports, "__esModule", { value: true });
39/** @jsx jsx */
40var React = __importStar(require("react"));
41var react_1 = require("@emotion/react");
42var helpers_1 = require("./helpers");
43var scale = react_1.keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {transform: scaley(1.0)}\n 50% {transform: scaley(0.4)}\n 100% {transform: scaley(1.0)}\n"], ["\n 0% {transform: scaley(1.0)}\n 50% {transform: scaley(0.4)}\n 100% {transform: scaley(1.0)}\n"])));
44var Loader = /** @class */ (function (_super) {
45 __extends(Loader, _super);
46 function Loader() {
47 var _this = _super !== null && _super.apply(this, arguments) || this;
48 _this.style = function (i) {
49 var _a = _this.props, color = _a.color, width = _a.width, height = _a.height, margin = _a.margin, radius = _a.radius, speedMultiplier = _a.speedMultiplier;
50 return react_1.css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n width: ", ";\n height: ", ";\n margin: ", ";\n border-radius: ", ";\n display: inline-block;\n animation: ", " ", "s ", "s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n animation-fill-mode: both;\n "], ["\n background-color: ", ";\n width: ", ";\n height: ", ";\n margin: ", ";\n border-radius: ", ";\n display: inline-block;\n animation: ", " ", "s ", "s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n animation-fill-mode: both;\n "])), color, helpers_1.cssValue(width), helpers_1.cssValue(height), helpers_1.cssValue(margin), helpers_1.cssValue(radius), scale, 1 / speedMultiplier, i * 0.1);
51 };
52 return _this;
53 }
54 Loader.prototype.render = function () {
55 var _a = this.props, loading = _a.loading, css = _a.css;
56 return loading ? (react_1.jsx("span", { css: [css] },
57 react_1.jsx("span", { css: this.style(1) }),
58 react_1.jsx("span", { css: this.style(2) }),
59 react_1.jsx("span", { css: this.style(3) }),
60 react_1.jsx("span", { css: this.style(4) }),
61 react_1.jsx("span", { css: this.style(5) }))) : null;
62 };
63 Loader.defaultProps = helpers_1.heightWidthRadiusDefaults(35, 4, 2);
64 return Loader;
65}(React.PureComponent));
66exports.default = Loader;
67var templateObject_1, templateObject_2;