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 _withStyles = require("../helpers/withStyles");
|
11 |
|
12 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
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 | huge: _propTypes.default.bool,
|
26 | inverse: _propTypes.default.bool,
|
27 | large: _propTypes.default.bool,
|
28 | micro: _propTypes.default.bool,
|
29 | mono: _propTypes.default.bool,
|
30 | muted: _propTypes.default.bool,
|
31 | name: _propTypes.default.oneOf(['auto-location', 'check', 'delete', 'error', 'filter', 'import-location', 'location', 'more', 'search', 'settings', 'vector']),
|
32 | noPadding: _propTypes.default.bool,
|
33 | primary: _propTypes.default.bool,
|
34 | secondary: _propTypes.default.bool,
|
35 | small: _propTypes.default.bool,
|
36 | smaller: _propTypes.default.bool,
|
37 | text: _propTypes.default.bool
|
38 | });
|
39 |
|
40 | var Icon = function Icon(_ref) {
|
41 | var css = _ref.css,
|
42 | huge = _ref.huge,
|
43 | inverse = _ref.inverse,
|
44 | large = _ref.large,
|
45 | micro = _ref.micro,
|
46 | mono = _ref.mono,
|
47 | muted = _ref.muted,
|
48 | name = _ref.name,
|
49 | noPadding = _ref.noPadding,
|
50 | primary = _ref.primary,
|
51 | secondary = _ref.secondary,
|
52 | small = _ref.small,
|
53 | smaller = _ref.smaller,
|
54 | styles = _ref.styles,
|
55 | text = _ref.text;
|
56 | return _react.default.createElement("div", css(styles.icon, noPadding && styles.icon_noPadding), _react.default.createElement("svg", _extends({}, css(styles.icon__svg, huge && styles.icon__svg_huge, inverse && styles.icon__svg_inverse, large && styles.icon__svg_large, micro && styles.icon__svg_micro, mono && styles.icon__svg_mono, muted && styles.icon__svg_muted, primary && styles.icon__svg_primary, secondary && styles.icon__svg_secondary, small && styles.icon__svg_small, smaller && styles.icon__svg_smaller, text && styles.icon__svg_text), {
|
57 | viewBox: "0 0 16 16"
|
58 | })));
|
59 | };
|
60 |
|
61 | Icon.propTypes = propTypes;
|
62 | var IconWithStyles = (0, _withStyles.withStyles)(function (_ref2) {
|
63 | var color = _ref2.color,
|
64 | icon = _ref2.icon;
|
65 | return {
|
66 | icon: {
|
67 | padding: 2,
|
68 | height: '100%',
|
69 | display: 'flex',
|
70 | alignItems: 'center',
|
71 | justifyContent: 'center'
|
72 | },
|
73 | icon_noPadding: {
|
74 | padding: 0
|
75 | },
|
76 | icon__svg: {
|
77 | fill: icon.defaultColor,
|
78 | width: icon.size.default
|
79 | },
|
80 | icon__svg_muted: {
|
81 | fill: color.blueGrayDark
|
82 | },
|
83 | icon__svg_primary: {
|
84 | fill: color.primary
|
85 | },
|
86 | icon__svg_secondary: {
|
87 | fill: color.secondary
|
88 | },
|
89 | icon__svg_inverse: {
|
90 | fill: color.white
|
91 | },
|
92 | icon__svg_mono: {
|
93 | fill: color.black
|
94 | },
|
95 | icon__svg_text: {
|
96 | fill: color.grayDarker
|
97 | },
|
98 | icon__svg_micro: {
|
99 | width: icon.size.micro
|
100 | },
|
101 | icon__svg_small: {
|
102 | width: icon.size.small
|
103 | },
|
104 | icon__svg_smaller: {
|
105 | width: icon.size.smaller
|
106 | },
|
107 | icon__svg_large: {
|
108 | width: icon.size.large
|
109 | },
|
110 | icon__svg_huge: {
|
111 | width: icon.size.huge
|
112 | }
|
113 | };
|
114 | })(Icon);
|
115 | var _default = IconWithStyles;
|
116 | exports.default = _default; |
\ | No newline at end of file |