@arcblock/ux 2.4.12 → 2.4.15
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.
- package/lib/ActionButton/index.js +7 -1
- package/lib/Alert/index.js +8 -1
- package/lib/Badge/index.js +7 -2
- package/lib/ClickToCopy/index.js +14 -15
- package/lib/ContactForm/index.js +3 -0
- package/lib/Earth/index.js +9 -1
- package/lib/Footer/index.js +20 -4
- package/lib/Icon/index.js +7 -2
- package/lib/Locale/context.js +16 -1
- package/lib/PageScroller/index.js +7 -1
- package/lib/PricingTable/index.js +6 -1
- package/lib/Spinner/index.js +11 -2
- package/lib/TextCollapse/index.js +9 -1
- package/lib/Util/deprecate.js +49 -0
- package/package.json +4 -4
- package/src/ActionButton/index.js +2 -1
- package/src/Alert/index.js +2 -1
- package/src/Badge/index.js +5 -1
- package/src/ClickToCopy/index.js +13 -9
- package/src/ContactForm/index.js +2 -0
- package/src/Earth/index.js +4 -10
- package/src/Footer/index.js +9 -0
- package/src/Icon/index.js +5 -1
- package/src/Locale/context.js +13 -1
- package/src/PageScroller/index.js +2 -1
- package/src/PricingTable/index.js +2 -1
- package/src/Spinner/index.js +4 -1
- package/src/TextCollapse/index.js +4 -10
- package/src/Util/deprecate.js +25 -0
@@ -11,6 +11,8 @@ var _Button = _interopRequireDefault(require("../Button"));
|
|
11
11
|
|
12
12
|
var _Util = require("../Util");
|
13
13
|
|
14
|
+
var _deprecate = require("../Util/deprecate");
|
15
|
+
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
17
|
|
16
18
|
const _excluded = ["href", "icon", "size", "color", "theme", "variant", "gradient", "children", "text"];
|
@@ -96,5 +98,9 @@ ActionButton.defaultProps = {
|
|
96
98
|
size: 'large',
|
97
99
|
children: null
|
98
100
|
};
|
99
|
-
|
101
|
+
|
102
|
+
var _default = (0, _deprecate.withDeprecated)(ActionButton, {
|
103
|
+
name: 'ActionButton'
|
104
|
+
});
|
105
|
+
|
100
106
|
exports.default = _default;
|
package/lib/Alert/index.js
CHANGED
@@ -19,6 +19,8 @@ var _Colors = _interopRequireDefault(require("../Colors"));
|
|
19
19
|
|
20
20
|
var _Theme = require("../Theme");
|
21
21
|
|
22
|
+
var _deprecate = require("../Util/deprecate");
|
23
|
+
|
22
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
23
25
|
|
24
26
|
var _templateObject;
|
@@ -120,6 +122,11 @@ Alert.defaultProps = {
|
|
120
122
|
style: '{}',
|
121
123
|
variant: 'border'
|
122
124
|
};
|
123
|
-
|
125
|
+
|
126
|
+
var _default = (0, _deprecate.withDeprecated)(Alert, {
|
127
|
+
name: 'Alert',
|
128
|
+
alternative: '@mui/material/Alert'
|
129
|
+
});
|
130
|
+
|
124
131
|
exports.default = _default;
|
125
132
|
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n font-size: 16px;\n margin: 0;\n padding: 16px;\n margin: 16px 0;\n\n strong {\n margin: 0 5px;\n }\n\n .alert-icon {\n margin-right: 16px;\n }\n\n .alert-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n"])));
|
package/lib/Badge/index.js
CHANGED
@@ -15,6 +15,8 @@ var _Colors = _interopRequireDefault(require("../Colors"));
|
|
15
15
|
|
16
16
|
var _Util = require("../Util");
|
17
17
|
|
18
|
+
var _deprecate = require("../Util/deprecate");
|
19
|
+
|
18
20
|
var _Theme = require("../Theme");
|
19
21
|
|
20
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -98,9 +100,12 @@ Badge.defaultProps = {
|
|
98
100
|
style: '{}'
|
99
101
|
};
|
100
102
|
|
101
|
-
var _default = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Badge, _objectSpread(_objectSpread({}, props), {}, {
|
103
|
+
var _default = (0, _deprecate.withDeprecated)( /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Badge, _objectSpread(_objectSpread({}, props), {}, {
|
102
104
|
forwardedRef: ref
|
103
|
-
})))
|
105
|
+
}))), {
|
106
|
+
name: 'Badge',
|
107
|
+
alternative: '@arcblock/ux/lib/Tag'
|
108
|
+
});
|
104
109
|
|
105
110
|
exports.default = _default;
|
106
111
|
const Span = (0, _Theme.styled)(_Typography.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n && {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 10px;\n height: 24px;\n line-height: 24px;\n }\n"])));
|
package/lib/ClickToCopy/index.js
CHANGED
@@ -17,8 +17,6 @@ var _useWindowSize = _interopRequireDefault(require("react-use/lib/useWindowSize
|
|
17
17
|
|
18
18
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
19
19
|
|
20
|
-
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
21
|
-
|
22
20
|
var _hook = _interopRequireDefault(require("./hook"));
|
23
21
|
|
24
22
|
var _Toast = _interopRequireWildcard(require("../Toast"));
|
@@ -31,9 +29,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
31
29
|
|
32
30
|
var _copyButton = _interopRequireDefault(require("./copy-button"));
|
33
31
|
|
34
|
-
var _templateObject;
|
32
|
+
var _templateObject, _templateObject2;
|
35
33
|
|
36
|
-
const _excluded = ["children", "content", "tip", "copiedTip", "tipPlacement", "locale", "style"];
|
34
|
+
const _excluded = ["children", "content", "tip", "copiedTip", "tipPlacement", "locale", "style", "unstyled"];
|
37
35
|
|
38
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
39
37
|
|
@@ -63,7 +61,8 @@ function ClickToCopy(props) {
|
|
63
61
|
copiedTip,
|
64
62
|
tipPlacement,
|
65
63
|
locale,
|
66
|
-
style
|
64
|
+
style,
|
65
|
+
unstyled
|
67
66
|
} = newProps,
|
68
67
|
rest = _objectWithoutProperties(newProps, _excluded);
|
69
68
|
|
@@ -93,20 +92,16 @@ function ClickToCopy(props) {
|
|
93
92
|
}
|
94
93
|
};
|
95
94
|
|
95
|
+
const ContainerComponent = unstyled ? UnstyledContainer : Container;
|
96
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toast.ToastProvider, {
|
97
97
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, _objectSpread(_objectSpread({
|
98
98
|
title: copied ? _copiedTip : _tip
|
99
99
|
}, rest), {}, {
|
100
100
|
placement: tipPlacement,
|
101
101
|
disableFocusListener: true,
|
102
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
102
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ContainerComponent, {
|
103
103
|
ref: containerRef,
|
104
|
-
|
105
|
-
style: Object.assign({
|
106
|
-
fontSize: 'inherit',
|
107
|
-
color: 'inherit',
|
108
|
-
fontWeight: 'inherit'
|
109
|
-
}, style),
|
104
|
+
style: style,
|
110
105
|
onClick: onCopy,
|
111
106
|
children: children || content
|
112
107
|
})
|
@@ -121,7 +116,9 @@ ClickToCopy.propTypes = {
|
|
121
116
|
tipPlacement: _propTypes.default.string,
|
122
117
|
copiedTip: _propTypes.default.string,
|
123
118
|
locale: _propTypes.default.oneOf(['en', 'zh']),
|
124
|
-
style: _propTypes.default.object
|
119
|
+
style: _propTypes.default.object,
|
120
|
+
// 仅提供点击复制功能, 不提供样式
|
121
|
+
unstyled: _propTypes.default.bool
|
125
122
|
};
|
126
123
|
ClickToCopy.defaultProps = {
|
127
124
|
content: '',
|
@@ -129,6 +126,8 @@ ClickToCopy.defaultProps = {
|
|
129
126
|
copiedTip: '',
|
130
127
|
tipPlacement: 'right',
|
131
128
|
locale: 'en',
|
132
|
-
style: {}
|
129
|
+
style: {},
|
130
|
+
unstyled: false
|
133
131
|
};
|
134
|
-
const Container = (0, _Theme.styled)(
|
132
|
+
const Container = (0, _Theme.styled)('span')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline;\n white-space: pre-wrap;\n word-wrap: break-word;\n overflow-wrap: break-word;\n align-items: center;\n justify-content: start;\n border-radius: 15px;\n padding: 1px 12px;\n background-color: rgba(0, 0, 0, 0.08);\n cursor: pointer;\n"])));
|
133
|
+
const UnstyledContainer = (0, _Theme.styled)('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: pointer;\n"])));
|
package/lib/ContactForm/index.js
CHANGED
@@ -18,6 +18,8 @@ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularPr
|
|
18
18
|
|
19
19
|
var _Util = require("../Util");
|
20
20
|
|
21
|
+
var _deprecate = require("../Util/deprecate");
|
22
|
+
|
21
23
|
var _Button = _interopRequireDefault(require("../Button"));
|
22
24
|
|
23
25
|
var _Theme = require("../Theme");
|
@@ -108,6 +110,7 @@ class ContactForm extends _react.default.Component {
|
|
108
110
|
this.fields.forEach(x => {
|
109
111
|
this.state[x] = '';
|
110
112
|
});
|
113
|
+
(0, _deprecate.warn)('ContactForm');
|
111
114
|
}
|
112
115
|
|
113
116
|
deriveProps() {
|
package/lib/Earth/index.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default =
|
6
|
+
exports.default = void 0;
|
7
7
|
|
8
8
|
var _react = require("react");
|
9
9
|
|
@@ -21,6 +21,8 @@ var _countries = _interopRequireDefault(require("./countries.json"));
|
|
21
21
|
|
22
22
|
var _util = _interopRequireDefault(require("./util"));
|
23
23
|
|
24
|
+
var _deprecate = require("../Util/deprecate");
|
25
|
+
|
24
26
|
var _Theme = require("../Theme");
|
25
27
|
|
26
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -447,5 +449,11 @@ Earth.defaultProps = {
|
|
447
449
|
activeMarkerId: undefined,
|
448
450
|
colors: {}
|
449
451
|
};
|
452
|
+
|
453
|
+
var _default = (0, _deprecate.withDeprecated)(Earth, {
|
454
|
+
name: 'Earth'
|
455
|
+
});
|
456
|
+
|
457
|
+
exports.default = _default;
|
450
458
|
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n width: ", "px;\n height: ", "px;\n position: relative;\n animation-name: zoomIn;\n animation-duration: 1s;\n animation-iteration-count: 1;\n animation-timing-function: ease;\n user-select: none;\n\n .defs {\n height: 0;\n width: 0;\n }\n\n .frame {\n fill: none;\n pointer-events: all;\n }\n\n .country {\n fill: ", ";\n stroke: ", ";\n stroke-width: 0.5px;\n transition: fill 300ms ease;\n\n &:hover {\n fill: ", ";\n }\n }\n\n .country--active {\n fill: ", ";\n }\n\n .globe {\n fill: ", ";\n stroke: rgba(255, 255, 255, 0.5);\n stroke-width: 0.25px;\n }\n\n .graticule {\n fill: none;\n stroke: ", ";\n }\n\n .star {\n fill: #fff;\n stroke: rgba(255, 255, 255, 0.5);\n stroke-width: 0.25px;\n }\n\n .marker {\n .marker__outer {\n fill-opacity: 0;\n animation: scaleIn 2s infinite ease-in-out;\n }\n }\n\n @keyframes zoomIn {\n from {\n opacity: 0;\n transform: scale3d(0.1, 0.1, 0.1);\n }\n\n 50% {\n opacity: 1;\n }\n }\n\n @keyframes scaleIn {\n from {\n fill-opacity: 0.3;\n transform: scale3d(0.5, 0.5, 0.5);\n }\n to {\n fill-opacity: 0;\n transform: scale3d(1.5, 1.5, 1.5);\n }\n }\n"])), props => props.theme === 'light' ? '#f7f7f7' : '#222', props => props.width, props => props.height, props => props.colors.land, props => props.colors.border, props => props.colors.activeLand, props => props.colors.activeLand, props => props.colors.ocean, props => props.colors.graticule);
|
451
459
|
const Tooltip = (0, _Theme.styled)('div')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n width: auto;\n min-width: 90px;\n max-width: 320px;\n padding: 8px 12px;\n font-size: 14px;\n background-color: #4a4a4a;\n border-radius: 2px;\n animation-name: fadeIn;\n animation-duration: 250ms;\n animation-iteration-count: 1;\n animation-timing-function: ease;\n\n .title,\n .description {\n margin: 0;\n font-size: 16px;\n color: #fff;\n }\n\n .description {\n margin-top: ", "px;\n color: #fff;\n font-size: 12px;\n }\n\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n }\n"])), props => props.theme.spacing(1));
|
package/lib/Footer/index.js
CHANGED
@@ -11,6 +11,8 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
11
11
|
|
12
12
|
var _Container = _interopRequireDefault(require("@mui/material/Container"));
|
13
13
|
|
14
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
15
|
+
|
14
16
|
var _Util = require("../Util");
|
15
17
|
|
16
18
|
var _Logo = _interopRequireDefault(require("../Logo"));
|
@@ -26,6 +28,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
26
28
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
27
29
|
|
28
30
|
function Footer(props) {
|
31
|
+
var _window, _window$blocklet;
|
32
|
+
|
29
33
|
const newProps = (0, _Util.mergeProps)(props, Footer, ['dark', 'style']);
|
30
34
|
const {
|
31
35
|
className,
|
@@ -37,11 +41,11 @@ function Footer(props) {
|
|
37
41
|
const endYearString = "".concat(new Date().getFullYear());
|
38
42
|
const copyStartString = "".concat(copyStart);
|
39
43
|
const copyYear = endYearString === copyStartString ? endYearString : "".concat(copyStartString, "-").concat(endYearString);
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
41
45
|
className: className,
|
42
46
|
style: style,
|
43
47
|
dark: dark,
|
44
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
|
48
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.default, {
|
45
49
|
maxWidth: false,
|
46
50
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
47
51
|
component: "div",
|
@@ -70,7 +74,19 @@ function Footer(props) {
|
|
70
74
|
})]
|
71
75
|
})]
|
72
76
|
})
|
73
|
-
})
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
78
|
+
position: "absolute",
|
79
|
+
right: 0,
|
80
|
+
bottom: 0,
|
81
|
+
sx: {
|
82
|
+
color: 'transparent',
|
83
|
+
'::selection': {
|
84
|
+
background: '#000',
|
85
|
+
color: '#fff'
|
86
|
+
}
|
87
|
+
},
|
88
|
+
children: (_window = window) === null || _window === void 0 ? void 0 : (_window$blocklet = _window.blocklet) === null || _window$blocklet === void 0 ? void 0 : _window$blocklet.version
|
89
|
+
})]
|
74
90
|
});
|
75
91
|
}
|
76
92
|
|
@@ -88,7 +104,7 @@ Footer.defaultProps = {
|
|
88
104
|
className: '',
|
89
105
|
style: {}
|
90
106
|
};
|
91
|
-
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-top: 64px;\n padding: 24px 0 32px;\n border-top: 1px solid ", ";\n box-sizing: border-box;\n width: 100%;\n\n @media (max-width: 540px) {\n padding: 8px 0;\n }\n\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n .footer-item {\n color: ", ";\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n font-size: 0.9rem;\n }\n\n .footer-brand {\n margin-left: 8px;\n margin-right: 8px;\n }\n\n .logo-container {\n margin-left: 24px;\n width: 90px;\n opacity: 0.5;\n }\n\n @media (max-width: 540px) {\n .footer-item {\n font-size: 0.7rem;\n }\n\n .logo-container {\n margin: 0 0 0 16px;\n width: 70px;\n height: 40px;\n }\n }\n\n @media (max-width: 380px) {\n .footer-item {\n font-size: 0.65rem;\n }\n\n .logo-container {\n margin: 0 0 0 8px;\n height: 24px;\n }\n }\n }\n"])), props => props.dark ? props.theme.palette.grey[900] : '#dee2e7', _ref => {
|
107
|
+
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n margin-top: 64px;\n padding: 24px 0 32px;\n border-top: 1px solid ", ";\n box-sizing: border-box;\n width: 100%;\n\n @media (max-width: 540px) {\n padding: 8px 0;\n }\n\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n .footer-item {\n color: ", ";\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n font-size: 0.9rem;\n }\n\n .footer-brand {\n margin-left: 8px;\n margin-right: 8px;\n }\n\n .logo-container {\n margin-left: 24px;\n width: 90px;\n opacity: 0.5;\n }\n\n @media (max-width: 540px) {\n .footer-item {\n font-size: 0.7rem;\n }\n\n .logo-container {\n margin: 0 0 0 16px;\n width: 70px;\n height: 40px;\n }\n }\n\n @media (max-width: 380px) {\n .footer-item {\n font-size: 0.65rem;\n }\n\n .logo-container {\n margin: 0 0 0 8px;\n height: 24px;\n }\n }\n }\n"])), props => props.dark ? props.theme.palette.grey[900] : '#dee2e7', _ref => {
|
92
108
|
let {
|
93
109
|
theme,
|
94
110
|
dark
|
package/lib/Icon/index.js
CHANGED
@@ -13,6 +13,8 @@ var _Colors = _interopRequireDefault(require("../Colors"));
|
|
13
13
|
|
14
14
|
var _Theme = require("../Theme");
|
15
15
|
|
16
|
+
var _deprecate = require("../Util/deprecate");
|
17
|
+
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
17
19
|
|
18
20
|
var _templateObject;
|
@@ -94,8 +96,11 @@ Icon.defaultProps = {
|
|
94
96
|
};
|
95
97
|
const Span = (0, _Theme.styled)('span')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n height: ", "px;\n border-radius: 50%;\n border: 1px solid ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n\n .fa,\n .fas,\n .fal,\n .far {\n line-height: ", "px;\n }\n"])), props => props.size * 2, props => props.size * 2, props => props.color, props => props.size);
|
96
98
|
|
97
|
-
var _default = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, _objectSpread(_objectSpread({}, props), {}, {
|
99
|
+
var _default = (0, _deprecate.withDeprecated)( /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, _objectSpread(_objectSpread({}, props), {}, {
|
98
100
|
forwardedRef: ref
|
99
|
-
})))
|
101
|
+
}))), {
|
102
|
+
name: 'Icon',
|
103
|
+
alternative: 'SVG icons'
|
104
|
+
});
|
100
105
|
|
101
106
|
exports.default = _default;
|
package/lib/Locale/context.js
CHANGED
@@ -56,11 +56,26 @@ const getLocaleFromSearchParams = function getLocaleFromSearchParams() {
|
|
56
56
|
return null;
|
57
57
|
};
|
58
58
|
|
59
|
+
const setLocaleParam = function setLocaleParam(locale) {
|
60
|
+
let url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href;
|
61
|
+
const urlObj = new URL(url);
|
62
|
+
const hasLocaleParam = urlObj.searchParams.has('locale');
|
63
|
+
|
64
|
+
if (hasLocaleParam) {
|
65
|
+
urlObj.searchParams.set('locale', locale);
|
66
|
+
window.history.replaceState({}, '', urlObj.href);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
|
59
70
|
const getLocale = locale => locale || getLocaleFromSearchParams() || _jsCookie.default.get(cookieName) || (0, _browserLang.default)(langParams);
|
60
71
|
|
61
72
|
exports.getLocale = getLocale;
|
62
73
|
|
63
|
-
const setLocale = locale =>
|
74
|
+
const setLocale = locale => {
|
75
|
+
_jsCookie.default.set(cookieName, locale, (0, _Util.getCookieOptions)());
|
76
|
+
|
77
|
+
setLocaleParam(locale);
|
78
|
+
};
|
64
79
|
|
65
80
|
exports.setLocale = setLocale;
|
66
81
|
|
@@ -17,6 +17,8 @@ var _isNull = _interopRequireDefault(require("lodash/isNull"));
|
|
17
17
|
|
18
18
|
var _usePrevValue = _interopRequireDefault(require("./usePrevValue"));
|
19
19
|
|
20
|
+
var _deprecate = require("../Util/deprecate");
|
21
|
+
|
20
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
21
23
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -318,5 +320,9 @@ PageScroller.defaultProps = {
|
|
318
320
|
renderAllPagesOnFirstRender: false,
|
319
321
|
customPageNumber: undefined
|
320
322
|
};
|
321
|
-
|
323
|
+
|
324
|
+
var _default = (0, _deprecate.withDeprecated)(PageScroller, {
|
325
|
+
name: 'PageScroller'
|
326
|
+
});
|
327
|
+
|
322
328
|
exports.default = _default;
|
@@ -13,6 +13,8 @@ var _PricingPlan = _interopRequireDefault(require("./PricingPlan"));
|
|
13
13
|
|
14
14
|
var _Theme = require("../Theme");
|
15
15
|
|
16
|
+
var _deprecate = require("../Util/deprecate");
|
17
|
+
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
17
19
|
|
18
20
|
var _templateObject;
|
@@ -53,7 +55,10 @@ function PricingTable(_ref) {
|
|
53
55
|
return null;
|
54
56
|
}
|
55
57
|
|
56
|
-
var _default = PricingTable
|
58
|
+
var _default = (0, _deprecate.withDeprecated)(PricingTable, {
|
59
|
+
name: 'PricingTable'
|
60
|
+
});
|
61
|
+
|
57
62
|
exports.default = _default;
|
58
63
|
PricingTable.propTypes = {
|
59
64
|
plans: _propTypes.default.array.isRequired
|
package/lib/Spinner/index.js
CHANGED
@@ -3,10 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default =
|
6
|
+
exports.default = void 0;
|
7
7
|
|
8
8
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
9
9
|
|
10
|
+
var _deprecate = require("../Util/deprecate");
|
11
|
+
|
10
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
11
13
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -34,4 +36,11 @@ function Spinner(props) {
|
|
34
36
|
}
|
35
37
|
|
36
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, _objectSpread({}, _props));
|
37
|
-
}
|
39
|
+
}
|
40
|
+
|
41
|
+
var _default = (0, _deprecate.withDeprecated)(Spinner, {
|
42
|
+
name: 'Spinner',
|
43
|
+
alternative: '@mui/material/CircularProgress'
|
44
|
+
});
|
45
|
+
|
46
|
+
exports.default = _default;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default =
|
6
|
+
exports.default = void 0;
|
7
7
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
|
@@ -11,6 +11,8 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
11
11
|
|
12
12
|
var _Theme = require("../Theme");
|
13
13
|
|
14
|
+
var _deprecate = require("../Util/deprecate");
|
15
|
+
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
17
|
|
16
18
|
var _templateObject;
|
@@ -92,4 +94,10 @@ TextCollapse.defaultProps = {
|
|
92
94
|
scaleFactor: 0.45,
|
93
95
|
fontType: 'normal'
|
94
96
|
};
|
97
|
+
|
98
|
+
var _default = (0, _deprecate.withDeprecated)(TextCollapse, {
|
99
|
+
name: 'TextCollapse'
|
100
|
+
});
|
101
|
+
|
102
|
+
exports.default = _default;
|
95
103
|
const Container = (0, _Theme.styled)(_Typography.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n justify-content: start;\n cursor: pointer;\n white-space: nowrap;\n overflow: hidden;\n\n .start-part,\n .end-part {\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n }\n .start-part {\n max-width: calc(100% - ", ");\n min-width: ", ";\n text-overflow: ellipsis;\n }\n .end-part {\n max-width: calc(100% - ", ");\n direction: rtl;\n }\n"])), props => props.endwidth, props => props.startwidth, props => props.startwidth);
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.withDeprecated = exports.warn = void 0;
|
7
|
+
|
8
|
+
var _react = require("react");
|
9
|
+
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
11
|
+
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
13
|
+
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
|
+
|
16
|
+
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; }
|
17
|
+
|
18
|
+
const warn = (name, alternative) => {
|
19
|
+
var _console;
|
20
|
+
|
21
|
+
if (process.env.NODE_ENV === 'production') {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
if (typeof ((_console = console) === null || _console === void 0 ? void 0 : _console.warn) === 'function') {
|
26
|
+
if (alternative) {
|
27
|
+
console.warn("DEPRECATED: ".concat(name, " is deprecated, use ").concat(alternative, " instead."));
|
28
|
+
} else {
|
29
|
+
console.warn("DEPRECATED: ".concat(name, " is deprecated."));
|
30
|
+
}
|
31
|
+
}
|
32
|
+
};
|
33
|
+
|
34
|
+
exports.warn = warn;
|
35
|
+
|
36
|
+
const withDeprecated = (Component, _ref) => {
|
37
|
+
let {
|
38
|
+
name,
|
39
|
+
alternative
|
40
|
+
} = _ref;
|
41
|
+
return function Deprecated(props) {
|
42
|
+
(0, _react.useEffect)(() => {
|
43
|
+
warn(name, alternative);
|
44
|
+
}, []);
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, _objectSpread({}, props));
|
46
|
+
};
|
47
|
+
};
|
48
|
+
|
49
|
+
exports.withDeprecated = withDeprecated;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.15",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -47,10 +47,10 @@
|
|
47
47
|
"react": ">=18.1.0",
|
48
48
|
"react-ga": "^2.7.0"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "c07a38a4575a4f41e116743b2450e468c19d55f3",
|
51
51
|
"dependencies": {
|
52
|
-
"@arcblock/icons": "^2.4.
|
53
|
-
"@arcblock/react-hooks": "^2.4.
|
52
|
+
"@arcblock/icons": "^2.4.15",
|
53
|
+
"@arcblock/react-hooks": "^2.4.15",
|
54
54
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
55
55
|
"@emotion/react": "^11.10.0",
|
56
56
|
"@emotion/styled": "^11.10.0",
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
2
2
|
|
3
3
|
import Button from '../Button';
|
4
4
|
import { mergeProps } from '../Util';
|
5
|
+
import { withDeprecated } from '../Util/deprecate';
|
5
6
|
|
6
7
|
function ActionButton(props) {
|
7
8
|
const newProps = mergeProps(props, ActionButton);
|
@@ -61,4 +62,4 @@ ActionButton.defaultProps = {
|
|
61
62
|
children: null,
|
62
63
|
};
|
63
64
|
|
64
|
-
export default ActionButton;
|
65
|
+
export default withDeprecated(ActionButton, { name: 'ActionButton' });
|
package/src/Alert/index.js
CHANGED
@@ -6,6 +6,7 @@ import Icon from '../Icon';
|
|
6
6
|
import { mergeProps } from '../Util';
|
7
7
|
import colors from '../Colors';
|
8
8
|
import { styled } from '../Theme';
|
9
|
+
import { withDeprecated } from '../Util/deprecate';
|
9
10
|
|
10
11
|
const types = {
|
11
12
|
error: {
|
@@ -72,7 +73,7 @@ Alert.defaultProps = {
|
|
72
73
|
variant: 'border',
|
73
74
|
};
|
74
75
|
|
75
|
-
export default Alert;
|
76
|
+
export default withDeprecated(Alert, { name: 'Alert', alternative: '@mui/material/Alert' });
|
76
77
|
|
77
78
|
const Container = styled('div')`
|
78
79
|
display: flex;
|
package/src/Badge/index.js
CHANGED
@@ -4,6 +4,7 @@ import Typography from '@mui/material/Typography';
|
|
4
4
|
|
5
5
|
import colors from '../Colors';
|
6
6
|
import { mergeProps } from '../Util';
|
7
|
+
import { withDeprecated } from '../Util/deprecate';
|
7
8
|
import { styled } from '../Theme';
|
8
9
|
|
9
10
|
const types = {
|
@@ -56,7 +57,10 @@ Badge.defaultProps = {
|
|
56
57
|
style: '{}',
|
57
58
|
};
|
58
59
|
|
59
|
-
export default
|
60
|
+
export default withDeprecated(
|
61
|
+
forwardRef((props, ref) => <Badge {...props} forwardedRef={ref} />),
|
62
|
+
{ name: 'Badge', alternative: '@arcblock/ux/lib/Tag' }
|
63
|
+
);
|
60
64
|
|
61
65
|
const Span = styled(Typography)`
|
62
66
|
&& {
|
package/src/ClickToCopy/index.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import useWindowSize from 'react-use/lib/useWindowSize';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import Typography from '@mui/material/Typography';
|
5
4
|
|
6
5
|
import useCopy from './hook';
|
7
6
|
import Toast, { ToastProvider } from '../Toast';
|
@@ -12,7 +11,7 @@ export { default as CopyButton } from './copy-button';
|
|
12
11
|
|
13
12
|
export default function ClickToCopy(props) {
|
14
13
|
const newProps = mergeProps(props, ClickToCopy, ['style']);
|
15
|
-
const { children, content, tip, copiedTip, tipPlacement, locale, style, ...rest } = newProps;
|
14
|
+
const { children, content, tip, copiedTip, tipPlacement, locale, style, unstyled, ...rest } = newProps;
|
16
15
|
const { containerRef, copied, copy, texts } = useCopy({ content, locale });
|
17
16
|
const _tip = tip || texts.copy;
|
18
17
|
const _copiedTip = copiedTip || texts.copied;
|
@@ -26,16 +25,14 @@ export default function ClickToCopy(props) {
|
|
26
25
|
}
|
27
26
|
};
|
28
27
|
|
28
|
+
const ContainerComponent = unstyled ? UnstyledContainer : Container;
|
29
|
+
|
29
30
|
return (
|
30
31
|
<ToastProvider>
|
31
32
|
<Tooltip title={copied ? _copiedTip : _tip} {...rest} placement={tipPlacement} disableFocusListener>
|
32
|
-
<
|
33
|
-
ref={containerRef}
|
34
|
-
component="span"
|
35
|
-
style={Object.assign({ fontSize: 'inherit', color: 'inherit', fontWeight: 'inherit' }, style)}
|
36
|
-
onClick={onCopy}>
|
33
|
+
<ContainerComponent ref={containerRef} style={style} onClick={onCopy}>
|
37
34
|
{children || content}
|
38
|
-
</
|
35
|
+
</ContainerComponent>
|
39
36
|
</Tooltip>
|
40
37
|
</ToastProvider>
|
41
38
|
);
|
@@ -49,6 +46,8 @@ ClickToCopy.propTypes = {
|
|
49
46
|
copiedTip: PropTypes.string,
|
50
47
|
locale: PropTypes.oneOf(['en', 'zh']),
|
51
48
|
style: PropTypes.object,
|
49
|
+
// 仅提供点击复制功能, 不提供样式
|
50
|
+
unstyled: PropTypes.bool,
|
52
51
|
};
|
53
52
|
|
54
53
|
ClickToCopy.defaultProps = {
|
@@ -58,9 +57,10 @@ ClickToCopy.defaultProps = {
|
|
58
57
|
tipPlacement: 'right',
|
59
58
|
locale: 'en',
|
60
59
|
style: {},
|
60
|
+
unstyled: false,
|
61
61
|
};
|
62
62
|
|
63
|
-
const Container = styled(
|
63
|
+
const Container = styled('span')`
|
64
64
|
display: inline;
|
65
65
|
white-space: pre-wrap;
|
66
66
|
word-wrap: break-word;
|
@@ -72,3 +72,7 @@ const Container = styled(Typography)`
|
|
72
72
|
background-color: rgba(0, 0, 0, 0.08);
|
73
73
|
cursor: pointer;
|
74
74
|
`;
|
75
|
+
|
76
|
+
const UnstyledContainer = styled('span')`
|
77
|
+
cursor: pointer;
|
78
|
+
`;
|
package/src/ContactForm/index.js
CHANGED
@@ -7,6 +7,7 @@ import Typography from '@mui/material/Typography';
|
|
7
7
|
import CircularProgress from '@mui/material/CircularProgress';
|
8
8
|
|
9
9
|
import { mergeProps } from '../Util';
|
10
|
+
import { warn as deprecatedWarn } from '../Util/deprecate';
|
10
11
|
import Button from '../Button';
|
11
12
|
import { styled } from '../Theme';
|
12
13
|
|
@@ -69,6 +70,7 @@ export default class ContactForm extends React.Component {
|
|
69
70
|
this.fields.forEach((x) => {
|
70
71
|
this.state[x] = '';
|
71
72
|
});
|
73
|
+
deprecatedWarn('ContactForm');
|
72
74
|
}
|
73
75
|
|
74
76
|
deriveProps() {
|
package/src/Earth/index.js
CHANGED
@@ -8,6 +8,7 @@ import versor from 'versor';
|
|
8
8
|
|
9
9
|
import json from './countries.json';
|
10
10
|
import util from './util';
|
11
|
+
import { withDeprecated } from '../Util/deprecate';
|
11
12
|
import { styled } from '../Theme';
|
12
13
|
|
13
14
|
const geoJson = topojson.feature(json, json.objects.ne_110m_admin_0_countries);
|
@@ -51,16 +52,7 @@ function stateReducer(state, action) {
|
|
51
52
|
}
|
52
53
|
}
|
53
54
|
|
54
|
-
|
55
|
-
theme,
|
56
|
-
width,
|
57
|
-
height,
|
58
|
-
enableRotation,
|
59
|
-
rotationSpeed,
|
60
|
-
markers,
|
61
|
-
activeMarkerId,
|
62
|
-
colors,
|
63
|
-
}) {
|
55
|
+
function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, activeMarkerId, colors }) {
|
64
56
|
Object.assign(colors, themes[theme]);
|
65
57
|
const [state, dispatch] = useReducer(stateReducer, {
|
66
58
|
rotation: [0, 0, 0],
|
@@ -371,6 +363,8 @@ Earth.defaultProps = {
|
|
371
363
|
colors: {},
|
372
364
|
};
|
373
365
|
|
366
|
+
export default withDeprecated(Earth, { name: 'Earth' });
|
367
|
+
|
374
368
|
const Container = styled('div')`
|
375
369
|
background-color: ${(props) => (props.theme === 'light' ? '#f7f7f7' : '#222')};
|
376
370
|
width: ${(props) => props.width}px;
|
package/src/Footer/index.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import Typography from '@mui/material/Typography';
|
4
4
|
import MuiContainer from '@mui/material/Container';
|
5
|
+
import Box from '@mui/material/Box';
|
5
6
|
|
6
7
|
import { mergeProps } from '../Util';
|
7
8
|
import Logo from '../Logo';
|
@@ -29,6 +30,13 @@ export default function Footer(props) {
|
|
29
30
|
</Typography>
|
30
31
|
</Typography>
|
31
32
|
</MuiContainer>
|
33
|
+
<Box
|
34
|
+
position="absolute"
|
35
|
+
right={0}
|
36
|
+
bottom={0}
|
37
|
+
sx={{ color: 'transparent', '::selection': { background: '#000', color: '#fff' } }}>
|
38
|
+
{window?.blocklet?.version}
|
39
|
+
</Box>
|
32
40
|
</Container>
|
33
41
|
);
|
34
42
|
}
|
@@ -50,6 +58,7 @@ Footer.defaultProps = {
|
|
50
58
|
};
|
51
59
|
|
52
60
|
const Container = styled('div')`
|
61
|
+
position: relative;
|
53
62
|
margin-top: 64px;
|
54
63
|
padding: 24px 0 32px;
|
55
64
|
border-top: 1px solid ${(props) => (props.dark ? props.theme.palette.grey[900] : '#dee2e7')};
|
package/src/Icon/index.js
CHANGED
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
3
3
|
|
4
4
|
import colors from '../Colors';
|
5
5
|
import { styled } from '../Theme';
|
6
|
+
import { withDeprecated } from '../Util/deprecate';
|
6
7
|
|
7
8
|
const variants = {
|
8
9
|
light: 'fal',
|
@@ -67,4 +68,7 @@ const Span = styled('span')`
|
|
67
68
|
}
|
68
69
|
`;
|
69
70
|
|
70
|
-
export default
|
71
|
+
export default withDeprecated(
|
72
|
+
forwardRef((props, ref) => <Icon {...props} forwardedRef={ref} />),
|
73
|
+
{ name: 'Icon', alternative: 'SVG icons' }
|
74
|
+
);
|
package/src/Locale/context.js
CHANGED
@@ -25,9 +25,21 @@ const getLocaleFromSearchParams = (url = window.location.href) => {
|
|
25
25
|
return null;
|
26
26
|
};
|
27
27
|
|
28
|
+
const setLocaleParam = (locale, url = window.location.href) => {
|
29
|
+
const urlObj = new URL(url);
|
30
|
+
const hasLocaleParam = urlObj.searchParams.has('locale');
|
31
|
+
if (hasLocaleParam) {
|
32
|
+
urlObj.searchParams.set('locale', locale);
|
33
|
+
window.history.replaceState({}, '', urlObj.href);
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
28
37
|
const getLocale = (locale) =>
|
29
38
|
locale || getLocaleFromSearchParams() || Cookie.get(cookieName) || browserLang(langParams);
|
30
|
-
const setLocale = (locale) =>
|
39
|
+
const setLocale = (locale) => {
|
40
|
+
Cookie.set(cookieName, locale, getCookieOptions());
|
41
|
+
setLocaleParam(locale);
|
42
|
+
};
|
31
43
|
|
32
44
|
const replace = (template, data) =>
|
33
45
|
template.replace(/{(\w*)}/g, (m, key) => (data.hasOwnProperty(key) ? data[key] : ''));
|
@@ -6,6 +6,7 @@ import isNil from 'lodash/isNil';
|
|
6
6
|
import isNull from 'lodash/isNull';
|
7
7
|
|
8
8
|
import usePrevious from './usePrevValue';
|
9
|
+
import { withDeprecated } from '../Util/deprecate';
|
9
10
|
|
10
11
|
const Events = {
|
11
12
|
TOUCHMOVE: 'touchmove',
|
@@ -325,4 +326,4 @@ PageScroller.defaultProps = {
|
|
325
326
|
customPageNumber: undefined,
|
326
327
|
};
|
327
328
|
|
328
|
-
export default PageScroller;
|
329
|
+
export default withDeprecated(PageScroller, { name: 'PageScroller' });
|
@@ -3,6 +3,7 @@ import Grid from '@mui/material/Grid';
|
|
3
3
|
|
4
4
|
import PricingPlan from './PricingPlan';
|
5
5
|
import { styled } from '../Theme';
|
6
|
+
import { withDeprecated } from '../Util/deprecate';
|
6
7
|
|
7
8
|
function PricingTable({ plans }) {
|
8
9
|
if (plans && plans.length > 0) {
|
@@ -22,7 +23,7 @@ function PricingTable({ plans }) {
|
|
22
23
|
return null;
|
23
24
|
}
|
24
25
|
|
25
|
-
export default PricingTable;
|
26
|
+
export default withDeprecated(PricingTable, { name: 'PricingTable' });
|
26
27
|
|
27
28
|
PricingTable.propTypes = {
|
28
29
|
plans: PropTypes.array.isRequired,
|
package/src/Spinner/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import CircularProgress from '@mui/material/CircularProgress';
|
2
|
+
import { withDeprecated } from '../Util/deprecate';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* Spinner
|
@@ -8,7 +9,7 @@ import CircularProgress from '@mui/material/CircularProgress';
|
|
8
9
|
* - 之前 size prop 是 array 类型, 需要与 CircularProgress#size 兼容
|
9
10
|
* - color 默认使用 #4598fa, 如果调用方传入了 color prop 或 style#color, 则默认 color 被覆盖
|
10
11
|
*/
|
11
|
-
|
12
|
+
function Spinner(props) {
|
12
13
|
const _props = { ...props };
|
13
14
|
// 兼容之前的 size prop (设置外圈/内圈的尺寸)
|
14
15
|
if (_props.size && Array.isArray(_props.size)) {
|
@@ -16,3 +17,5 @@ export default function Spinner(props) {
|
|
16
17
|
}
|
17
18
|
return <CircularProgress {..._props} />;
|
18
19
|
}
|
20
|
+
|
21
|
+
export default withDeprecated(Spinner, { name: 'Spinner', alternative: '@mui/material/CircularProgress' });
|
@@ -2,17 +2,9 @@ import PropTypes from 'prop-types';
|
|
2
2
|
import Typography from '@mui/material/Typography';
|
3
3
|
|
4
4
|
import { styled } from '../Theme';
|
5
|
+
import { withDeprecated } from '../Util/deprecate';
|
5
6
|
|
6
|
-
|
7
|
-
children,
|
8
|
-
startChars,
|
9
|
-
endChars,
|
10
|
-
scaleFactor,
|
11
|
-
maxWidth,
|
12
|
-
style,
|
13
|
-
fontType,
|
14
|
-
...rest
|
15
|
-
}) {
|
7
|
+
function TextCollapse({ children, startChars, endChars, scaleFactor, maxWidth, style, fontType, ...rest }) {
|
16
8
|
if (typeof children !== 'string') {
|
17
9
|
return null;
|
18
10
|
}
|
@@ -59,6 +51,8 @@ TextCollapse.defaultProps = {
|
|
59
51
|
fontType: 'normal',
|
60
52
|
};
|
61
53
|
|
54
|
+
export default withDeprecated(TextCollapse, { name: 'TextCollapse' });
|
55
|
+
|
62
56
|
const Container = styled(Typography)`
|
63
57
|
display: inline-flex;
|
64
58
|
align-items: center;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { useEffect } from 'react';
|
2
|
+
|
3
|
+
const warn = (name, alternative) => {
|
4
|
+
if (process.env.NODE_ENV === 'production') {
|
5
|
+
return;
|
6
|
+
}
|
7
|
+
if (typeof console?.warn === 'function') {
|
8
|
+
if (alternative) {
|
9
|
+
console.warn(`DEPRECATED: ${name} is deprecated, use ${alternative} instead.`);
|
10
|
+
} else {
|
11
|
+
console.warn(`DEPRECATED: ${name} is deprecated.`);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
};
|
15
|
+
|
16
|
+
const withDeprecated = (Component, { name, alternative }) => {
|
17
|
+
return function Deprecated(props) {
|
18
|
+
useEffect(() => {
|
19
|
+
warn(name, alternative);
|
20
|
+
}, []);
|
21
|
+
return <Component {...props} />;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
|
25
|
+
export { warn, withDeprecated };
|