@arcblock/ux 1.15.35 → 1.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +0 -56
  3. package/lib/index.js +0 -8
  4. package/package.json +6 -10
  5. package/src/ActionButton/index.js +65 -0
  6. package/src/ActivityIndicator/index.js +186 -0
  7. package/src/Alert/index.js +104 -0
  8. package/src/Async/index.js +39 -0
  9. package/src/Badge/index.js +71 -0
  10. package/src/Blocklet/index.js +335 -0
  11. package/src/Button/index.js +4 -0
  12. package/src/Button/wrap.js +88 -0
  13. package/src/ButtonGroup/index.js +19 -0
  14. package/src/Center/index.js +17 -0
  15. package/src/ClickToCopy/index.js +90 -0
  16. package/src/CodeBlock/index.js +151 -0
  17. package/src/Colors/index.js +1 -0
  18. package/src/Colors/themes/default.js +53 -0
  19. package/src/ContactForm/index.js +240 -0
  20. package/src/CookieConsent/index.js +90 -0
  21. package/src/CountDown/index.js +151 -0
  22. package/src/Dialog/confirm.js +76 -0
  23. package/src/Dialog/dialog.js +162 -0
  24. package/src/Dialog/index.js +2 -0
  25. package/src/DriftBot/index.js +81 -0
  26. package/src/Earth/countries.json +8057 -0
  27. package/src/Earth/index.js +511 -0
  28. package/src/Earth/util.js +69 -0
  29. package/src/Empty/index.js +41 -0
  30. package/src/Footer/index.js +84 -0
  31. package/src/Icon/image.js +55 -0
  32. package/src/Icon/index.js +69 -0
  33. package/src/Img/index.js +172 -0
  34. package/src/InfoRow/index.js +83 -0
  35. package/src/Layout/dashboard/header.js +145 -0
  36. package/src/Layout/dashboard/index.js +140 -0
  37. package/src/Layout/dashboard/sidebar.js +120 -0
  38. package/src/Layout/index.js +318 -0
  39. package/src/Locale/browser-lang.js +63 -0
  40. package/src/Locale/context.js +88 -0
  41. package/src/Locale/images/globe-dark.png +0 -0
  42. package/src/Locale/images/globe-light.png +0 -0
  43. package/src/Locale/selector.js +138 -0
  44. package/src/Logo/images/logo-dark-text.svg +3 -0
  45. package/src/Logo/images/logo-dark-top.svg +6 -0
  46. package/src/Logo/images/logo-light-text.svg +3 -0
  47. package/src/Logo/images/logo-light-top.svg +6 -0
  48. package/src/Logo/index.js +47 -0
  49. package/src/Metric/index.js +115 -0
  50. package/src/NFTDisplay/README.md +59 -0
  51. package/src/NFTDisplay/aspect-ratio-container.js +34 -0
  52. package/src/NFTDisplay/broken.js +18 -0
  53. package/src/NFTDisplay/index.js +230 -0
  54. package/src/NFTDisplay/loading.js +17 -0
  55. package/src/NFTDisplay/svg-embedder/img.js +36 -0
  56. package/src/NFTDisplay/svg-embedder/inline-svg.js +37 -0
  57. package/src/PageScroller/index.js +342 -0
  58. package/src/PageScroller/usePrevValue.js +12 -0
  59. package/src/PricingTable/PricingPlan.js +112 -0
  60. package/src/PricingTable/index.js +43 -0
  61. package/src/Screenshot/devices.css +1366 -0
  62. package/src/Screenshot/index.js +181 -0
  63. package/src/Spinner/index.js +33 -0
  64. package/src/Switch/index.js +78 -0
  65. package/src/Tabs/index.js +46 -0
  66. package/src/Tag/index.js +73 -0
  67. package/src/Terminal/Player.js +364 -0
  68. package/src/Terminal/index.js +150 -0
  69. package/src/Terminal/player.css +378 -0
  70. package/src/Terminal/util.js +167 -0
  71. package/src/Terminal/xterm.css +171 -0
  72. package/src/TextCollapse/index.js +92 -0
  73. package/src/Theme/index.js +169 -0
  74. package/src/Theme/responsiveFontSizes.js +94 -0
  75. package/src/Toast/index.js +118 -0
  76. package/src/Util/index.js +264 -0
  77. package/src/Video/index.js +72 -0
  78. package/src/Wallet/Action.js +105 -0
  79. package/src/Wallet/Download.js +130 -0
  80. package/src/Wallet/Open.js +50 -0
  81. package/src/Wallet/images/abtwallet.png +0 -0
  82. package/src/Wallet/images/android_download.svg +23 -0
  83. package/src/Wallet/images/app-store.svg +20 -0
  84. package/src/Wallet/images/google-play.svg +70 -0
  85. package/src/WechatPrompt/images/android.png +0 -0
  86. package/src/WechatPrompt/images/ios.png +0 -0
  87. package/src/WechatPrompt/index.js +81 -0
  88. package/src/index.js +63 -0
  89. package/src/withTheme/index.js +72 -0
  90. package/src/withTracker/README.md +34 -0
  91. package/src/withTracker/error_boundary.js +34 -0
  92. package/src/withTracker/index.js +70 -0
  93. package/lib/GraphQLPlayground/graphiql.css +0 -1850
  94. package/lib/GraphQLPlayground/index.js +0 -301
  95. package/lib/GraphQLPlayground/util.js +0 -55
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2018-2019 ArcBlock
1
+ Copyright 2018-2022 ArcBlock
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -16,59 +16,3 @@ import ClickToCopy from '@arcblock/ux/lib/ClickToCopy';
16
16
  import Icon from '@arcblock/ux/lib/Icon';
17
17
  import ActivityIndicator from '@arcblock/ux/lib/ActivityIndicator';
18
18
  ```
19
-
20
- ## FAQ
21
-
22
- ### How to use `GraphQLPlayground` comonent in SSR env such as gatsby?
23
-
24
- Because `graphiql` and `graphiql-code-exporter` uses browser globals such as `window`, we need to mock them both during building time for gatsby.
25
-
26
- First we need to create an mock for `graphqil`, `src/mocks/graphiql`:
27
-
28
- ```javascript
29
- function graphiql() {
30
- return null;
31
- }
32
-
33
- graphiql.Logo = () => null;
34
- graphiql.Toolbar = () => null;
35
- graphiql.QueryEditor = () => null;
36
- graphiql.VariableEditor = () => null;
37
- graphiql.ResultViewer = () => null;
38
- graphiql.Button = () => null;
39
- graphiql.ToolbarButton = () => null;
40
- graphiql.Group = () => null;
41
- graphiql.Menu = () => null;
42
- graphiql.MenuItem = () => null;
43
- graphiql.Select = () => null;
44
- graphiql.SelectOption = () => null;
45
- graphiql.Footer = () => null;
46
-
47
- module.exports = graphiql;
48
- ```
49
-
50
- Then, in `gatsby-node.js`, use the mocks:
51
-
52
- ```javascript
53
- const path = require('path');
54
-
55
- exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
56
- if (stage === 'build-html') {
57
- actions.setWebpackConfig({
58
- resolve: {
59
- alias: {
60
- graphiql: path.resolve(__dirname, './src/mocks/graphiql.js'),
61
- },
62
- },
63
- module: {
64
- rules: [
65
- {
66
- test: /node_modules\/codemirror\//,
67
- use: loaders.null(),
68
- },
69
- ],
70
- },
71
- });
72
- }
73
- };
74
- ```
package/lib/index.js CHANGED
@@ -75,12 +75,6 @@ Object.defineProperty(exports, "Footer", {
75
75
  return _Footer.default;
76
76
  }
77
77
  });
78
- Object.defineProperty(exports, "GraphQLPlayground", {
79
- enumerable: true,
80
- get: function get() {
81
- return _GraphQLPlayground.default;
82
- }
83
- });
84
78
  Object.defineProperty(exports, "Icon", {
85
79
  enumerable: true,
86
80
  get: function get() {
@@ -214,8 +208,6 @@ var _Earth = _interopRequireDefault(require("./Earth"));
214
208
 
215
209
  var _Footer = _interopRequireDefault(require("./Footer"));
216
210
 
217
- var _GraphQLPlayground = _interopRequireDefault(require("./GraphQLPlayground"));
218
-
219
211
  var _Icon = _interopRequireDefault(require("./Icon"));
220
212
 
221
213
  var _selector = _interopRequireDefault(require("./Locale/selector"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "1.15.35",
3
+ "version": "1.16.2",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -12,7 +12,8 @@
12
12
  "license": "Apache-2.0",
13
13
  "main": "lib/index.js",
14
14
  "files": [
15
- "lib"
15
+ "lib",
16
+ "src"
16
17
  ],
17
18
  "repository": {
18
19
  "type": "git",
@@ -52,10 +53,10 @@
52
53
  "react": ">=16.12.0",
53
54
  "react-ga": "^2.7.0"
54
55
  },
55
- "gitHead": "e81fb3d8f4283b180866c26738e9db0ec89a06f3",
56
+ "gitHead": "b869c847f922a9e89158e7d3ba4219789e6d20d0",
56
57
  "dependencies": {
57
- "@arcblock/icons": "^1.15.35",
58
- "@arcblock/react-hooks": "^1.15.35",
58
+ "@arcblock/icons": "^1.16.2",
59
+ "@arcblock/react-hooks": "^1.16.2",
59
60
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
60
61
  "@material-ui/core": "^4.12.3",
61
62
  "@material-ui/icons": "4.11.2",
@@ -65,10 +66,6 @@
65
66
  "core-js": "^3.6.4",
66
67
  "d3-geo": "^1.11.6",
67
68
  "devices.css": "^0.1.15",
68
- "graphiql": "^0.13.2",
69
- "graphiql-code-exporter": "^2.0.5",
70
- "graphiql-explorer": "^0.4.3",
71
- "graphql": "^14.6.0",
72
69
  "highlight.js": "^9.15.8",
73
70
  "is-svg": "^4.3.1",
74
71
  "js-cookie": "^2.2.0",
@@ -77,7 +74,6 @@
77
74
  "react-cookie-consent": "^6.4.1",
78
75
  "react-helmet": "^5.2.1",
79
76
  "react-intersection-observer": "^8.31.1",
80
- "react-load-script": "^0.0.6",
81
77
  "react-player": "^1.15.2",
82
78
  "react-router-dom": "^5.1.2",
83
79
  "react-shadow": "^19.0.2",
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import Button from '../Button';
5
+ import { mergeProps } from '../Util';
6
+
7
+ const ActionButton = props => {
8
+ const newProps = mergeProps(props, ActionButton);
9
+ const { href, icon, size, color, theme, variant, gradient, children, text, ...rest } = newProps;
10
+ const styles = {};
11
+ if (gradient) {
12
+ styles.backgroundImage = gradient;
13
+ styles.borderColor = 'transparent';
14
+ }
15
+ const attrs = ['color', 'border', 'width'];
16
+ attrs.forEach(x => {
17
+ if (newProps[x]) {
18
+ styles[x] = newProps[x];
19
+ }
20
+ });
21
+
22
+ return (
23
+ <Button
24
+ color={theme}
25
+ href={href}
26
+ target="_blank"
27
+ variant={variant}
28
+ style={styles}
29
+ size={size}
30
+ className="action-button"
31
+ {...rest}>
32
+ {!!icon && <i className={icon} />}
33
+ {text || children}
34
+ </Button>
35
+ );
36
+ };
37
+
38
+ ActionButton.propTypes = {
39
+ href: PropTypes.string.isRequired,
40
+ children: PropTypes.any,
41
+ gradient: PropTypes.string,
42
+ color: PropTypes.string,
43
+ icon: PropTypes.string,
44
+ border: PropTypes.string,
45
+ text: PropTypes.string,
46
+ theme: PropTypes.string,
47
+ variant: PropTypes.string,
48
+ size: PropTypes.string,
49
+ width: PropTypes.string,
50
+ };
51
+
52
+ ActionButton.defaultProps = {
53
+ gradient: '',
54
+ icon: '',
55
+ text: '',
56
+ color: '',
57
+ border: '',
58
+ width: '',
59
+ theme: 'default',
60
+ variant: 'outlined',
61
+ size: 'large',
62
+ children: null,
63
+ };
64
+
65
+ export default ActionButton;
@@ -0,0 +1,186 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import green from '@material-ui/core/colors/green';
5
+ import blue from '@material-ui/core/colors/blue';
6
+
7
+ import Logo from '../Logo';
8
+ import colors from '../Colors';
9
+
10
+ // inspired by: https://codepen.io/wangshijun/pen/oQvwdX?editors=1100
11
+ export default function ActivityIndicator({ messages, interval, ...rest }) {
12
+ const [index, setIndex] = useState(0);
13
+
14
+ useEffect(() => {
15
+ const timer = setInterval(() => {
16
+ setIndex((index + 1) % messages.length);
17
+ }, interval);
18
+
19
+ return () => {
20
+ clearTimeout(timer);
21
+ };
22
+ });
23
+
24
+ return (
25
+ <Div {...rest}>
26
+ <div className="pm-loader-container">
27
+ <div className="pm-loader-text">
28
+ <p>{messages[index]}</p>
29
+ </div>
30
+ <div className="pm-loader-atoms">
31
+ <Logo style={{ transform: 'scale(0.6)' }} showText={false} />
32
+ <div className="pm-loader-orbit-1">
33
+ <div className="pm-loader-atom-1" />
34
+ </div>
35
+ <div className="pm-loader-orbit-2">
36
+ <div className="pm-loader-atom-2" />
37
+ </div>
38
+ <div className="pm-loader-orbit-3">
39
+ <div className="pm-loader-atom-3" />
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </Div>
44
+ );
45
+ }
46
+
47
+ ActivityIndicator.propTypes = {
48
+ interval: PropTypes.number,
49
+ messages: PropTypes.arrayOf(PropTypes.string.isRequired),
50
+ };
51
+
52
+ ActivityIndicator.defaultProps = {
53
+ interval: 3000,
54
+ messages: ['Loading data...'],
55
+ };
56
+
57
+ const Div = styled.div`
58
+ && {
59
+ padding: 20px;
60
+ width: 100%;
61
+ height: 100%;
62
+ min-height: 360px;
63
+ z-index: 100;
64
+ transition: opacity 0.5s linear;
65
+ display: flex;
66
+ align-items: center;
67
+ flex-direction: column;
68
+ justify-content: center;
69
+ }
70
+
71
+ @keyframes orbit {
72
+ 0% {
73
+ transform: rotate(0deg);
74
+ }
75
+
76
+ 100% {
77
+ transform: rotate(360deg);
78
+ }
79
+ }
80
+
81
+ .pm-loader-text {
82
+ color: ${colors.grey[900]};
83
+ font-size: 14px;
84
+ text-align: center;
85
+ position: relative;
86
+ height: 70px;
87
+ -webkit-user-select: none;
88
+ }
89
+
90
+ .pm-loader-container {
91
+ width: 100%;
92
+ height: 100%;
93
+ display: flex;
94
+ align-items: center;
95
+ flex-direction: column;
96
+ justify-content: center;
97
+ flex: 1;
98
+ }
99
+
100
+ .pm-loader-atoms {
101
+ width: 100px;
102
+ height: 100px;
103
+ display: flex;
104
+ position: relative;
105
+ align-items: center;
106
+ justify-content: center;
107
+ }
108
+
109
+ .pm-loader-center-atom {
110
+ top: 32px;
111
+ left: 32px;
112
+ width: 32px;
113
+ height: 32px;
114
+ position: absolute;
115
+ border-radius: 50%;
116
+ }
117
+
118
+ .pm-loader-orbit-1 {
119
+ top: 20px;
120
+ left: 20px;
121
+ width: 56px;
122
+ height: 56px;
123
+ position: absolute;
124
+ border-radius: 50%;
125
+ border: 1px solid ${green[500]};
126
+ }
127
+
128
+ .pm-loader-orbit-2 {
129
+ top: 8px;
130
+ left: 8px;
131
+ width: 80px;
132
+ height: 80px;
133
+ border-radius: 50%;
134
+ position: absolute;
135
+ border: 1px solid ${blue[800]};
136
+ }
137
+
138
+ .pm-loader-orbit-3 {
139
+ top: -4px;
140
+ left: -4px;
141
+ width: 104px;
142
+ height: 104px;
143
+ position: absolute;
144
+ border-radius: 50%;
145
+ border: 1px solid ${colors.grey[900]};
146
+ }
147
+
148
+ .pm-loader-atom-1 {
149
+ width: 7px;
150
+ height: 7px;
151
+ margin-top: 4px;
152
+ margin-left: 4px;
153
+ border-radius: 50%;
154
+ background-color: ${green[500]};
155
+ transform-origin: 24px 24px;
156
+ animation: orbit 1s infinite;
157
+ animation-timing-function: linear;
158
+ -webkit-transform-origin: 24px 24px;
159
+ }
160
+
161
+ .pm-loader-atom-2 {
162
+ width: 7px;
163
+ height: 7px;
164
+ margin-top: 8px;
165
+ margin-left: 8px;
166
+ border-radius: 50%;
167
+ background-color: ${blue[800]};
168
+ transform-origin: 32px 32px;
169
+ animation: orbit 2s infinite;
170
+ animation-timing-function: linear;
171
+ -webkit-transform-origin: 32px 32px;
172
+ }
173
+
174
+ .pm-loader-atom-3 {
175
+ width: 7px;
176
+ height: 7px;
177
+ margin-top: 11px;
178
+ margin-left: 11px;
179
+ border-radius: 50%;
180
+ background-color: ${colors.grey[900]};
181
+ transform-origin: 41px 41px;
182
+ animation: orbit 3s infinite;
183
+ animation-timing-function: linear;
184
+ -webkit-transform-origin: 41px 41px;
185
+ }
186
+ `;
@@ -0,0 +1,104 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import Typography from '@material-ui/core/Typography';
5
+ import blueGrey from '@material-ui/core/colors/blueGrey';
6
+
7
+ import Icon from '../Icon';
8
+ import { mergeProps } from '../Util';
9
+ import colors from '../Colors';
10
+
11
+ const types = {
12
+ error: {
13
+ icon: 'exclamation-circle',
14
+ color: colors.error.main,
15
+ borderColor: '#e35b54',
16
+ backgroundColor: 'rgba(227, 91, 84, 0.2)',
17
+ },
18
+ warning: {
19
+ icon: 'exclamation-triangle',
20
+ color: colors.warning.main,
21
+ borderColor: '#f7d040',
22
+ backgroundColor: 'rgba(247, 208, 64, 0.2)',
23
+ },
24
+ success: {
25
+ icon: 'check-circle',
26
+ color: colors.success.main,
27
+ borderColor: '#89ddd9',
28
+ backgroundColor: 'rgba(137, 221, 217, 0.2)',
29
+ },
30
+ tip: {
31
+ icon: 'info-circle',
32
+ color: colors.grey[500],
33
+ borderColor: '#222222',
34
+ backgroundColor: '#EEEEEE',
35
+ },
36
+ };
37
+
38
+ const Alert = props => {
39
+ const newProps = mergeProps(props, Alert, ['style']);
40
+ const { type, children, style, className, variant, ...rest } = newProps;
41
+ const { icon, color, backgroundColor, borderColor } = types[type] || types.success;
42
+ const styles = Object.assign(
43
+ {
44
+ color: blueGrey[500],
45
+ backgroundColor: variant === 'border' ? backgroundColor : 'transparent',
46
+ borderLeft: variant === 'border' ? `5px solid ${borderColor}` : 'none',
47
+ },
48
+ style
49
+ );
50
+
51
+ return (
52
+ <Container
53
+ {...rest}
54
+ className={`alert alert--${type} alert--${variant} ${className}`.trim()}
55
+ style={styles}>
56
+ {variant === 'icon' && (
57
+ <Icon className="alert-icon" name={icon} size={24} style={{ color }} />
58
+ )}
59
+ <Typography component="div" className="alert-content">
60
+ {children}
61
+ </Typography>
62
+ </Container>
63
+ );
64
+ };
65
+
66
+ Alert.propTypes = {
67
+ type: PropTypes.oneOf(Object.keys(types)),
68
+ children: PropTypes.any.isRequired,
69
+ className: PropTypes.string,
70
+ style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
71
+ variant: PropTypes.oneOf(['border', 'icon']),
72
+ };
73
+
74
+ Alert.defaultProps = {
75
+ type: 'tip',
76
+ className: '',
77
+ style: '{}',
78
+ variant: 'border',
79
+ };
80
+
81
+ export default Alert;
82
+
83
+ const Container = styled.div`
84
+ display: flex;
85
+ align-items: center;
86
+ font-size: 16px;
87
+ margin: 0;
88
+ padding: 16px;
89
+ margin: 16px 0;
90
+
91
+ strong {
92
+ margin: 0 5px;
93
+ }
94
+
95
+ .alert-icon {
96
+ margin-right: 16px;
97
+ }
98
+
99
+ .alert-content {
100
+ flex: 1;
101
+ display: flex;
102
+ flex-direction: column;
103
+ }
104
+ `;
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+
3
+ import CircularProgress from '@material-ui/core/CircularProgress';
4
+
5
+ export default function LoadAsyncComponent(importComponent, key = 'default', showProgress = true) {
6
+ class AsyncComponent extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+
10
+ this.state = {
11
+ Component: null,
12
+ error: null,
13
+ };
14
+ }
15
+
16
+ componentDidMount() {
17
+ importComponent()
18
+ .then(asyncModule => this.setState({ Component: asyncModule[key] }))
19
+ .catch(err => this.setState({ error: `Failed to load async component: ${err.message}` }));
20
+ }
21
+
22
+ render() {
23
+ const { Component, error } = this.state;
24
+
25
+ if (error) {
26
+ return error;
27
+ }
28
+
29
+ // eslint-disable-next-line no-nested-ternary
30
+ return Component ? (
31
+ <Component {...this.props} />
32
+ ) : showProgress ? (
33
+ <CircularProgress color="primary" />
34
+ ) : null;
35
+ }
36
+ }
37
+
38
+ return AsyncComponent;
39
+ }
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+
5
+ import Typography from '@material-ui/core/Typography';
6
+
7
+ import colors from '../Colors';
8
+ import { mergeProps } from '../Util';
9
+
10
+ const types = {
11
+ error: {
12
+ color: colors.common.white,
13
+ backgroundColor: colors.error.main,
14
+ },
15
+ warning: {
16
+ color: colors.common.white,
17
+ backgroundColor: colors.warning.main,
18
+ },
19
+ success: {
20
+ color: colors.common.white,
21
+ backgroundColor: colors.success.main,
22
+ },
23
+ primary: {
24
+ color: colors.common.white,
25
+ backgroundColor: colors.primary.main,
26
+ },
27
+ reverse: {
28
+ color: colors.common.white,
29
+ backgroundColor: colors.grey[900],
30
+ },
31
+ };
32
+
33
+ function Badge(props) {
34
+ const newProps = mergeProps(props, Badge, ['style']);
35
+ const { type, content, children, style, className, forwardedRef, ...rest } = newProps;
36
+ const styles = Object.assign(types[type] || types.primary, style);
37
+
38
+ return (
39
+ <Span ref={forwardedRef} component="span" className={className} style={styles} {...rest}>
40
+ {content || children}
41
+ </Span>
42
+ );
43
+ }
44
+
45
+ Badge.propTypes = {
46
+ children: PropTypes.any.isRequired,
47
+ content: PropTypes.string,
48
+ type: PropTypes.oneOf(Object.keys(types)),
49
+ className: PropTypes.string,
50
+ style: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
51
+ };
52
+
53
+ Badge.defaultProps = {
54
+ type: 'primary',
55
+ content: '',
56
+ className: '',
57
+ style: '{}',
58
+ };
59
+
60
+ export default React.forwardRef((props, ref) => <Badge {...props} forwardedRef={ref} />);
61
+
62
+ const Span = styled(Typography)`
63
+ && {
64
+ display: inline-flex;
65
+ justify-content: center;
66
+ align-items: center;
67
+ padding: 2px 10px;
68
+ height: 24px;
69
+ line-height: 24px;
70
+ }
71
+ `;