1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _react = _interopRequireDefault(require("react"));
|
9 |
|
10 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
11 |
|
12 | var _withStyles = require("../helpers/withStyles");
|
13 |
|
14 | var _reactWithStyles = require("react-with-styles");
|
15 |
|
16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17 |
|
18 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
19 |
|
20 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
21 |
|
22 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
23 |
|
24 | var propTypes = _objectSpread({}, _reactWithStyles.withStylesPropTypes, {
|
25 | height: _propTypes.default.string,
|
26 | width: _propTypes.default.string,
|
27 | block: _propTypes.default.bool
|
28 | });
|
29 |
|
30 | var Shimmer = function Shimmer(_ref) {
|
31 | var height = _ref.height,
|
32 | width = _ref.width,
|
33 | block = _ref.block,
|
34 | styles = _ref.styles;
|
35 | return _react.default.createElement("span", _extends({}, (0, _withStyles.css)(styles.shimmer, block && styles.shimmer_block), {
|
36 | "aria-busy": "true",
|
37 | style: {
|
38 | height: height,
|
39 | width: width
|
40 | }
|
41 | }));
|
42 | };
|
43 |
|
44 | Shimmer.propTypes = propTypes;
|
45 | var ShimmerWithStyles = (0, _withStyles.withStyles)(function (_ref2) {
|
46 | var color = _ref2.color,
|
47 | animation = _ref2.animation;
|
48 | return {
|
49 | shimmer: {
|
50 | backgroundColor: color.shimmer.from,
|
51 | display: 'inline-block',
|
52 | position: 'relative',
|
53 | animationDirection: 'alternate',
|
54 | animationDuration: '1s',
|
55 | animationFillMode: 'forwards',
|
56 | animationIterationCount: 'infinite',
|
57 | animationName: animation.shimmer,
|
58 | animationTimingFunction: 'ease-in-out'
|
59 | },
|
60 | shimmer_block: {
|
61 | display: 'block'
|
62 | }
|
63 | };
|
64 | })(Shimmer);
|
65 | var _default = ShimmerWithStyles;
|
66 | exports.default = _default; |
\ | No newline at end of file |