@semcore/progress-bar 2.1.0 → 2.2.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.
- package/CHANGELOG.md +22 -0
- package/lib/cjs/ProgressBar.js +61 -94
- package/lib/cjs/ProgressBar.js.map +1 -1
- package/lib/cjs/index.js +6 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/progress-bar.shadow.css +25 -6
- package/lib/es6/ProgressBar.js +54 -90
- package/lib/es6/ProgressBar.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/progress-bar.shadow.css +25 -6
- package/lib/types/index.d.ts +44 -2
- package/package.json +10 -4
- package/src/ProgressBar.js +98 -0
- package/src/index.d.ts +44 -0
- package/src/{index.tsx → index.js} +0 -0
- package/src/style/progress-bar.shadow.css +25 -6
- package/lib/types/ProgressBar.d.ts +0 -40
- package/src/ProgressBar.tsx +0 -151
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [2.2.2] - 2022-02-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added repository field to package.json file.
|
|
10
|
+
|
|
11
|
+
## [2.2.1] - 2021-8-26
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Add 'sideEffect=false' for more optimal build via webpack
|
|
16
|
+
|
|
17
|
+
## [2.2.0] - 2021-07-05
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Version of dependence `@semcore/core` has been changed to `1.11`.
|
|
22
|
+
- Improved performance. Removed one component wrapper.
|
|
23
|
+
- The style processing system has been changed.
|
|
24
|
+
- Removed the ability to apply media styles via a plugin `babel-plugin-react-semcore`.
|
|
25
|
+
- [TS] rewrite code from TS to JS
|
|
26
|
+
|
|
5
27
|
## [2.1.0] - 2020-12-17
|
|
6
28
|
|
|
7
29
|
### Added
|
package/lib/cjs/ProgressBar.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports
|
|
10
|
+
exports["default"] = exports.Progress = exports.Bar = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
13
|
|
|
12
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
15
|
|
|
@@ -23,76 +25,60 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
23
25
|
|
|
24
26
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
27
|
|
|
26
|
-
var
|
|
28
|
+
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
27
29
|
|
|
28
30
|
var _react = _interopRequireDefault(require("react"));
|
|
29
31
|
|
|
30
|
-
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
31
|
-
|
|
32
32
|
var _flexBox = require("@semcore/flex-box");
|
|
33
33
|
|
|
34
34
|
var _color = _interopRequireDefault(require("@semcore/utils/lib/color"));
|
|
35
35
|
|
|
36
36
|
var _logger = _interopRequireDefault(require("@semcore/utils/lib/logger"));
|
|
37
37
|
|
|
38
|
+
var _excluded = ["Children", "styles", "duration", "size", "theme", "value", "animation"];
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
47
|
+
|
|
38
48
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
39
49
|
|
|
40
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
50
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
51
|
|
|
42
52
|
/*__reshadow-styles__:"./style/progress-bar.shadow.css"*/
|
|
43
|
-
var
|
|
53
|
+
var style = (
|
|
44
54
|
/*__reshadow_css_start__*/
|
|
45
|
-
|
|
55
|
+
_core.sstyled.insert(
|
|
46
56
|
/*__inner_css_start__*/
|
|
47
|
-
".
|
|
57
|
+
".___SProgressBar_k9rlr_gg_{position:relative;width:100%;overflow:hidden}.___SValue_k9rlr_gg_{position:absolute;top:0;left:0;background-image:linear-gradient(-45deg,#479d2e 25%,#4fae33 0,#4fae33 50%,#479d2e 0,#479d2e 76%,#4fae33 0);overflow:hidden;-webkit-animation-name:loading_1wbyfk1;animation-name:loading_1wbyfk1;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;transition-property:width;transition-timing-function:linear;transition-duration:1s}.___SProgressBar_k9rlr_gg_._size_s_k9rlr_gg_,.___SValue_k9rlr_gg_._size_s_k9rlr_gg_{height:4px;border-radius:2px;background-size:8px 8px}.___SProgressBar_k9rlr_gg_._size_m_k9rlr_gg_,.___SValue_k9rlr_gg_._size_m_k9rlr_gg_{height:8px;border-radius:4px;background-size:12px 12px}.___SProgressBar_k9rlr_gg_._size_l_k9rlr_gg_,.___SValue_k9rlr_gg_._size_l_k9rlr_gg_{height:12px;border-radius:6px;background-size:16px 16px}.___SProgressBar_k9rlr_gg_._theme_dark_k9rlr_gg_{background-color:hsla(0,0%,100%,.2)}.___SProgressBar_k9rlr_gg_._theme_invert_k9rlr_gg_{background-color:#dee3e5}@-webkit-keyframes loading_1wbyfk1{0%{background-position:0 0}to{background-position:60px 0}}@keyframes loading_1wbyfk1{0%{background-position:0 0}to{background-position:60px 0}}.___SProgressBar_k9rlr_gg_.__animation_k9rlr_gg_{background-image:linear-gradient(-45deg,#c8ccce 25%,#dee3e5 0,#dee3e5 50%,#c8ccce 0,#c8ccce 76%,#dee3e5 0);-webkit-animation-name:loading_1wbyfk1;animation-name:loading_1wbyfk1;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.___SProgressBar_k9rlr_gg_._theme_custom_k9rlr_gg_{background-color:var(--backgroundColor_1wbyfk1)}.___SProgressBar_k9rlr_gg_._theme_custom_k9rlr_gg_{background-image:var(--backgroundColor_1wbyfk1)}.___SProgressBar_k9rlr_gg_.__animation_k9rlr_gg_{-webkit-animation-duration:var(--duration_1wbyfk1);animation-duration:var(--duration_1wbyfk1)}.___SValue_k9rlr_gg_{width:var(--width_1wbyfk1);-webkit-animation-duration:var(--duration_1wbyfk1);animation-duration:var(--duration_1wbyfk1)}.___SValue_k9rlr_gg_.__theme_k9rlr_gg_{background-color:var(--backgroundColor_1wbyfk1);background-image:var(--backgroundColor_1wbyfk1)}"
|
|
48
58
|
/*__inner_css_end__*/
|
|
49
|
-
, "
|
|
59
|
+
, "1wbyfk1_gg_")
|
|
50
60
|
/*__reshadow_css_end__*/
|
|
51
61
|
, {
|
|
52
|
-
"__SProgressBar": "
|
|
53
|
-
"__SValue": "
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/*__reshadow_css_start__*/
|
|
68
|
-
(0, _core.__css__)(
|
|
69
|
-
/*__inner_css_start__*/
|
|
70
|
-
"@media (max-width: 768px) {\n\n.___SProgressBar_w4qdd_gg_.__size_w4qdd_gg_.__size_s_w4qdd_gg_,.___SValue_w4qdd_gg_.__size_w4qdd_gg_.__size_s_w4qdd_gg_ {\n height: 5.2px;\n background-size: 10.4px 10.4px;\n}\n\n.___SProgressBar_w4qdd_gg_.__size_w4qdd_gg_.__size_m_w4qdd_gg_,.___SValue_w4qdd_gg_.__size_w4qdd_gg_.__size_m_w4qdd_gg_ {\n height: 10.4px;\n background-size: 15.6px 15.6px;\n}\n\n.___SProgressBar_w4qdd_gg_.__size_w4qdd_gg_.__size_l_w4qdd_gg_,.___SValue_w4qdd_gg_.__size_w4qdd_gg_.__size_l_w4qdd_gg_ {\n height: 15.6px;\n background-size: 20.8px 20.8px;\n}}"
|
|
71
|
-
/*__inner_css_end__*/
|
|
72
|
-
, "3a459m_gg_")
|
|
73
|
-
/*__reshadow_css_end__*/
|
|
74
|
-
;
|
|
75
|
-
}
|
|
62
|
+
"__SProgressBar": "___SProgressBar_k9rlr_gg_",
|
|
63
|
+
"__SValue": "___SValue_k9rlr_gg_",
|
|
64
|
+
"_size_s": "_size_s_k9rlr_gg_",
|
|
65
|
+
"_size_m": "_size_m_k9rlr_gg_",
|
|
66
|
+
"_size_l": "_size_l_k9rlr_gg_",
|
|
67
|
+
"_theme_dark": "_theme_dark_k9rlr_gg_",
|
|
68
|
+
"_theme_invert": "_theme_invert_k9rlr_gg_",
|
|
69
|
+
"@loading": "loading_1wbyfk1",
|
|
70
|
+
"_animation": "__animation_k9rlr_gg_",
|
|
71
|
+
"_theme_custom": "_theme_custom_k9rlr_gg_",
|
|
72
|
+
"--backgroundColor": "--backgroundColor_1wbyfk1",
|
|
73
|
+
"--duration": "--duration_1wbyfk1",
|
|
74
|
+
"--width": "--width_1wbyfk1",
|
|
75
|
+
"_theme": "__theme_k9rlr_gg_"
|
|
76
|
+
});
|
|
76
77
|
|
|
77
78
|
function isCustomTheme(theme) {
|
|
78
79
|
return !['dark', 'invert'].includes(theme);
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
var styled_c8 = (0, _core.create)([(
|
|
82
|
-
/*__reshadow_css_start__*/
|
|
83
|
-
(0, _core.__css__)(
|
|
84
|
-
/*__inner_css_start__*/
|
|
85
|
-
".___SProgressBar_1yrpf_gg_.__theme_1yrpf_gg_.__theme_custom_1yrpf_gg_{background-color:var(--1romxg5_0);background-image:var(--1romxg5_0)}.___SProgressBar_1yrpf_gg_.__animation_1yrpf_gg_{-webkit-animation-duration:var(--1romxg5_2);animation-duration:var(--1romxg5_2)}"
|
|
86
|
-
/*__inner_css_end__*/
|
|
87
|
-
, "15rpvmm_gg_")
|
|
88
|
-
/*__reshadow_css_end__*/
|
|
89
|
-
, {
|
|
90
|
-
"__SProgressBar": "___SProgressBar_1yrpf_gg_",
|
|
91
|
-
"_theme": "__theme_1yrpf_gg_",
|
|
92
|
-
"_theme_custom": "__theme_custom_1yrpf_gg_",
|
|
93
|
-
"_animation": "__animation_1yrpf_gg_"
|
|
94
|
-
})]);
|
|
95
|
-
|
|
96
82
|
var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
97
83
|
(0, _inherits2["default"])(ProgressBarRoot, _Component);
|
|
98
84
|
|
|
@@ -119,7 +105,10 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
119
105
|
}, {
|
|
120
106
|
key: "render",
|
|
121
107
|
value: function render() {
|
|
122
|
-
var
|
|
108
|
+
var _ref = this ? this.asProps : arguments[0],
|
|
109
|
+
_ref3;
|
|
110
|
+
|
|
111
|
+
var SProgressBar = _flexBox.Box;
|
|
123
112
|
var _this$asProps2 = this.asProps,
|
|
124
113
|
Children = _this$asProps2.Children,
|
|
125
114
|
styles = _this$asProps2.styles,
|
|
@@ -128,25 +117,18 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
128
117
|
theme = _this$asProps2.theme,
|
|
129
118
|
value = _this$asProps2.value,
|
|
130
119
|
animation = _this$asProps2.animation,
|
|
131
|
-
other = (0, _objectWithoutProperties2["default"])(_this$asProps2,
|
|
132
|
-
var speedValue = "".concat(duration, "ms");
|
|
120
|
+
other = (0, _objectWithoutProperties2["default"])(_this$asProps2, _excluded);
|
|
133
121
|
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
134
122
|
var color = (0, _color["default"])(theme);
|
|
135
123
|
|
|
136
|
-
_logger["default"].warn(animation !== undefined, "
|
|
137
|
-
|
|
138
|
-
return (0, _core.
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
animation: animation === undefined ? !value : animation,
|
|
145
|
-
size: size,
|
|
146
|
-
$$style: _core.styled.$$style
|
|
147
|
-
}), /*#__PURE__*/_react["default"].createElement(Children, {
|
|
148
|
-
className: _core.styled.styles["__Children"]
|
|
149
|
-
}))));
|
|
124
|
+
_logger["default"].warn(animation !== undefined, "The 'animation' property is deprecated, use 'value'", other['data-ui-name'] || ProgressBarRoot.displayName);
|
|
125
|
+
|
|
126
|
+
return _ref3 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SProgressBar, _ref3.cn("SProgressBar", _objectSpread({}, (0, _core.assignProps)({
|
|
127
|
+
"use:theme": useTheme,
|
|
128
|
+
"use:animation": animation === undefined ? !value : animation,
|
|
129
|
+
"use:duration": "".concat(duration, "ms"),
|
|
130
|
+
"backgroundColor": color
|
|
131
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {})));
|
|
150
132
|
}
|
|
151
133
|
}]);
|
|
152
134
|
return ProgressBarRoot;
|
|
@@ -162,39 +144,24 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
162
144
|
children: /*#__PURE__*/_react["default"].createElement(ProgressBar.Value, null)
|
|
163
145
|
};
|
|
164
146
|
});
|
|
165
|
-
var styled_12c = (0, _core.create)([(
|
|
166
|
-
/*__reshadow_css_start__*/
|
|
167
|
-
(0, _core.__css__)(
|
|
168
|
-
/*__inner_css_start__*/
|
|
169
|
-
".___SValue_ongkf_gg_{width:var(--1romxg5_0);-webkit-animation-duration:var(--1romxg5_1);animation-duration:var(--1romxg5_1)}.___SValue_ongkf_gg_.__theme_ongkf_gg_{background-color:var(--1romxg5_2);background-image:var(--1romxg5_2)}"
|
|
170
|
-
/*__inner_css_end__*/
|
|
171
|
-
, "qg3glx_gg_")
|
|
172
|
-
/*__reshadow_css_end__*/
|
|
173
|
-
, {
|
|
174
|
-
"__SValue": "___SValue_ongkf_gg_",
|
|
175
|
-
"_theme": "__theme_ongkf_gg_"
|
|
176
|
-
})]);
|
|
177
147
|
|
|
178
148
|
function Value(props) {
|
|
179
|
-
var
|
|
180
|
-
|
|
149
|
+
var _ref2 = this ? this.asProps : arguments[0],
|
|
150
|
+
_ref4;
|
|
151
|
+
|
|
152
|
+
var SValue = _flexBox.Box;
|
|
153
|
+
var styles = props.styles,
|
|
181
154
|
value = props.value,
|
|
182
155
|
size = props.size,
|
|
183
156
|
theme = props.theme,
|
|
184
157
|
duration = props.duration;
|
|
185
158
|
var width = "".concat(value, "%");
|
|
186
|
-
var durationBackground = "".concat(duration, "ms");
|
|
187
159
|
var color = (0, _color["default"])(theme);
|
|
188
|
-
return (0, _core.
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
}
|
|
193
|
-
render: _flexBox.Box,
|
|
194
|
-
theme: theme,
|
|
195
|
-
size: size,
|
|
196
|
-
$$style: _core.styled.$$style
|
|
197
|
-
}))));
|
|
160
|
+
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SValue, _ref4.cn("SValue", _objectSpread({}, (0, _core.assignProps)({
|
|
161
|
+
"use:width": width,
|
|
162
|
+
"use:duration": "".concat(duration, "ms"),
|
|
163
|
+
"backgroundColor": color
|
|
164
|
+
}, _ref2))));
|
|
198
165
|
}
|
|
199
166
|
|
|
200
167
|
var ProgressBar = (0, _core["default"])(ProgressBarRoot, {
|
|
@@ -204,7 +171,7 @@ var _default = ProgressBar;
|
|
|
204
171
|
exports["default"] = _default;
|
|
205
172
|
|
|
206
173
|
var Progress = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
207
|
-
_logger["default"].warn(true, "
|
|
174
|
+
_logger["default"].warn(true, "Component '<Progress/>' is deprecated, use '<ProgressBar.Value/>'", props['data-ui-name'] || ProgressBar.displayName);
|
|
208
175
|
|
|
209
176
|
return /*#__PURE__*/_react["default"].createElement(ProgressBar.Value, (0, _extends2["default"])({
|
|
210
177
|
ref: ref
|
|
@@ -214,7 +181,7 @@ var Progress = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
214
181
|
exports.Progress = Progress;
|
|
215
182
|
|
|
216
183
|
var Bar = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
217
|
-
_logger["default"].warn(true, "
|
|
184
|
+
_logger["default"].warn(true, "Component '<Bar/>' is deprecated, please use '<ProgressBar/>'", props['data-ui-name'] || ProgressBar.displayName);
|
|
218
185
|
|
|
219
186
|
return /*#__PURE__*/_react["default"].createElement(ProgressBar, (0, _extends2["default"])({
|
|
220
187
|
ref: ref
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ProgressBar.
|
|
1
|
+
{"version":3,"sources":["../../src/ProgressBar.js"],"names":["isCustomTheme","theme","includes","ProgressBarRoot","asProps","value","duration","size","SProgressBar","Box","Children","styles","animation","other","useTheme","color","logger","warn","undefined","displayName","Component","style","children","Value","props","SValue","width","ProgressBar","Progress","React","forwardRef","ref","Bar"],"mappings":"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","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport resolveColor from '@semcore/utils/lib/color';\nimport logger from '@semcore/utils/lib/logger';\n\nimport style from './style/progress-bar.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['dark', 'invert'].includes(theme);\n}\n\nclass ProgressBarRoot extends Component {\n static displayName = 'ProgressBar';\n static style = style;\n static defaultProps = () => ({\n duration: 1000,\n size: 'm',\n theme: 'invert',\n children: <ProgressBar.Value />,\n });\n\n getValueProps() {\n const { value, duration, size } = this.asProps;\n return {\n value,\n duration,\n size,\n };\n }\n\n render() {\n const SProgressBar = Root;\n const { Children, styles, duration, size, theme, value, animation, ...other } = this.asProps;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n\n logger.warn(\n animation !== undefined,\n \"The 'animation' property is deprecated, use 'value'\",\n other['data-ui-name'] || ProgressBarRoot.displayName,\n );\n\n return sstyled(styles)(\n <SProgressBar\n render={Box}\n use:theme={useTheme}\n use:animation={animation === undefined ? !value : animation}\n use:duration={`${duration}ms`}\n backgroundColor={color}\n >\n <Children />\n </SProgressBar>,\n );\n }\n}\n\nfunction Value(props) {\n const SValue = Root;\n const { styles, value, size, theme, duration } = props;\n const width = `${value}%`;\n const color = resolveColor(theme);\n\n return sstyled(styles)(\n <SValue\n render={Box}\n use:width={width}\n use:duration={`${duration}ms`}\n backgroundColor={color}\n />,\n );\n}\n\nconst ProgressBar = createComponent(ProgressBarRoot, {\n Value,\n});\n\nexport default ProgressBar;\n\nconst Progress = React.forwardRef(function (props, ref) {\n logger.warn(\n true,\n \"Component '<Progress/>' is deprecated, use '<ProgressBar.Value/>'\",\n props['data-ui-name'] || ProgressBar.displayName,\n );\n return <ProgressBar.Value ref={ref} {...props} />;\n});\n\nconst Bar = React.forwardRef(function (props, ref) {\n logger.warn(\n true,\n \"Component '<Bar/>' is deprecated, please use '<ProgressBar/>'\",\n props['data-ui-name'] || ProgressBar.displayName,\n );\n return <ProgressBar ref={ref} {...props} />;\n});\n\nexport { Bar, Progress };\n"],"file":"ProgressBar.js"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -18,6 +18,7 @@ var _ProgressBar = _interopRequireWildcard(require("./ProgressBar"));
|
|
|
18
18
|
Object.keys(_ProgressBar).forEach(function (key) {
|
|
19
19
|
if (key === "default" || key === "__esModule") return;
|
|
20
20
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
21
|
+
if (key in exports && exports[key] === _ProgressBar[key]) return;
|
|
21
22
|
Object.defineProperty(exports, key, {
|
|
22
23
|
enumerable: true,
|
|
23
24
|
get: function get() {
|
|
@@ -25,4 +26,8 @@ Object.keys(_ProgressBar).forEach(function (key) {
|
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
28
|
});
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28
33
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { default } from './ProgressBar';\nexport * from './ProgressBar';\n"],"file":"index.js"}
|
|
@@ -31,23 +31,23 @@ SValue {
|
|
|
31
31
|
|
|
32
32
|
SProgressBar[size='s'],
|
|
33
33
|
SValue[size='s'] {
|
|
34
|
-
height:
|
|
34
|
+
height: 4px;
|
|
35
35
|
border-radius: 2px;
|
|
36
|
-
background-size:
|
|
36
|
+
background-size: 8px 8px;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
SProgressBar[size='m'],
|
|
40
40
|
SValue[size='m'] {
|
|
41
|
-
height:
|
|
41
|
+
height: 8px;
|
|
42
42
|
border-radius: 4px;
|
|
43
|
-
background-size:
|
|
43
|
+
background-size: 12px 12px;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
SProgressBar[size='l'],
|
|
47
47
|
SValue[size='l'] {
|
|
48
|
-
height:
|
|
48
|
+
height: 12px;
|
|
49
49
|
border-radius: 6px;
|
|
50
|
-
background-size:
|
|
50
|
+
background-size: 16px 16px;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
SProgressBar[theme='dark'] {
|
|
@@ -81,3 +81,22 @@ SProgressBar[animation] {
|
|
|
81
81
|
animation-timing-function: linear;
|
|
82
82
|
animation-iteration-count: infinite;
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
SProgressBar[theme='custom'] {
|
|
86
|
+
background-color: var(--backgroundColor);
|
|
87
|
+
}
|
|
88
|
+
SProgressBar[theme='custom'] {
|
|
89
|
+
background-image: var(--backgroundColor);
|
|
90
|
+
}
|
|
91
|
+
SProgressBar[animation] {
|
|
92
|
+
animation-duration: var(--duration);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
SValue {
|
|
96
|
+
width: var(--width);
|
|
97
|
+
animation-duration: var(--duration);
|
|
98
|
+
}
|
|
99
|
+
SValue[theme] {
|
|
100
|
+
background-color: var(--backgroundColor);
|
|
101
|
+
background-image: var(--backgroundColor);
|
|
102
|
+
}
|
package/lib/es6/ProgressBar.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -5,72 +6,55 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import
|
|
9
|
+
import { sstyled as _sstyled } from "@semcore/core";
|
|
10
|
+
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
11
|
+
import { assignProps as _assignProps } from "@semcore/core";
|
|
12
|
+
var _excluded = ["Children", "styles", "duration", "size", "theme", "value", "animation"];
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
9
17
|
|
|
10
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
19
|
|
|
12
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
21
|
|
|
14
22
|
import React from 'react';
|
|
15
|
-
import createComponent, { Component,
|
|
23
|
+
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
16
24
|
import { Box } from '@semcore/flex-box';
|
|
17
25
|
import resolveColor from '@semcore/utils/lib/color';
|
|
18
26
|
import logger from '@semcore/utils/lib/logger';
|
|
19
27
|
|
|
20
28
|
/*__reshadow-styles__:"./style/progress-bar.shadow.css"*/
|
|
21
|
-
var
|
|
29
|
+
var style = (
|
|
22
30
|
/*__reshadow_css_start__*/
|
|
23
|
-
|
|
31
|
+
_sstyled.insert(
|
|
24
32
|
/*__inner_css_start__*/
|
|
25
|
-
".
|
|
33
|
+
".___SProgressBar_k9rlr_gg_{position:relative;width:100%;overflow:hidden}.___SValue_k9rlr_gg_{position:absolute;top:0;left:0;background-image:linear-gradient(-45deg,#479d2e 25%,#4fae33 0,#4fae33 50%,#479d2e 0,#479d2e 76%,#4fae33 0);overflow:hidden;-webkit-animation-name:loading_1wbyfk1;animation-name:loading_1wbyfk1;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;transition-property:width;transition-timing-function:linear;transition-duration:1s}.___SProgressBar_k9rlr_gg_._size_s_k9rlr_gg_,.___SValue_k9rlr_gg_._size_s_k9rlr_gg_{height:4px;border-radius:2px;background-size:8px 8px}.___SProgressBar_k9rlr_gg_._size_m_k9rlr_gg_,.___SValue_k9rlr_gg_._size_m_k9rlr_gg_{height:8px;border-radius:4px;background-size:12px 12px}.___SProgressBar_k9rlr_gg_._size_l_k9rlr_gg_,.___SValue_k9rlr_gg_._size_l_k9rlr_gg_{height:12px;border-radius:6px;background-size:16px 16px}.___SProgressBar_k9rlr_gg_._theme_dark_k9rlr_gg_{background-color:hsla(0,0%,100%,.2)}.___SProgressBar_k9rlr_gg_._theme_invert_k9rlr_gg_{background-color:#dee3e5}@-webkit-keyframes loading_1wbyfk1{0%{background-position:0 0}to{background-position:60px 0}}@keyframes loading_1wbyfk1{0%{background-position:0 0}to{background-position:60px 0}}.___SProgressBar_k9rlr_gg_.__animation_k9rlr_gg_{background-image:linear-gradient(-45deg,#c8ccce 25%,#dee3e5 0,#dee3e5 50%,#c8ccce 0,#c8ccce 76%,#dee3e5 0);-webkit-animation-name:loading_1wbyfk1;animation-name:loading_1wbyfk1;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.___SProgressBar_k9rlr_gg_._theme_custom_k9rlr_gg_{background-color:var(--backgroundColor_1wbyfk1)}.___SProgressBar_k9rlr_gg_._theme_custom_k9rlr_gg_{background-image:var(--backgroundColor_1wbyfk1)}.___SProgressBar_k9rlr_gg_.__animation_k9rlr_gg_{-webkit-animation-duration:var(--duration_1wbyfk1);animation-duration:var(--duration_1wbyfk1)}.___SValue_k9rlr_gg_{width:var(--width_1wbyfk1);-webkit-animation-duration:var(--duration_1wbyfk1);animation-duration:var(--duration_1wbyfk1)}.___SValue_k9rlr_gg_.__theme_k9rlr_gg_{background-color:var(--backgroundColor_1wbyfk1);background-image:var(--backgroundColor_1wbyfk1)}"
|
|
26
34
|
/*__inner_css_end__*/
|
|
27
|
-
, "
|
|
35
|
+
, "1wbyfk1_gg_")
|
|
28
36
|
/*__reshadow_css_end__*/
|
|
29
37
|
, {
|
|
30
|
-
"__SProgressBar": "
|
|
31
|
-
"__SValue": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/*__reshadow_css_start__*/
|
|
46
|
-
__css__(
|
|
47
|
-
/*__inner_css_start__*/
|
|
48
|
-
"@media (max-width: 768px) {\n\n.___SProgressBar_w4qdd_gg_.__size_w4qdd_gg_.__size_s_w4qdd_gg_,.___SValue_w4qdd_gg_.__size_w4qdd_gg_.__size_s_w4qdd_gg_ {\n height: 5.2px;\n background-size: 10.4px 10.4px;\n}\n\n.___SProgressBar_w4qdd_gg_.__size_w4qdd_gg_.__size_m_w4qdd_gg_,.___SValue_w4qdd_gg_.__size_w4qdd_gg_.__size_m_w4qdd_gg_ {\n height: 10.4px;\n background-size: 15.6px 15.6px;\n}\n\n.___SProgressBar_w4qdd_gg_.__size_w4qdd_gg_.__size_l_w4qdd_gg_,.___SValue_w4qdd_gg_.__size_w4qdd_gg_.__size_l_w4qdd_gg_ {\n height: 15.6px;\n background-size: 20.8px 20.8px;\n}}"
|
|
49
|
-
/*__inner_css_end__*/
|
|
50
|
-
, "3a459m_gg_")
|
|
51
|
-
/*__reshadow_css_end__*/
|
|
52
|
-
;
|
|
53
|
-
}
|
|
38
|
+
"__SProgressBar": "___SProgressBar_k9rlr_gg_",
|
|
39
|
+
"__SValue": "___SValue_k9rlr_gg_",
|
|
40
|
+
"_size_s": "_size_s_k9rlr_gg_",
|
|
41
|
+
"_size_m": "_size_m_k9rlr_gg_",
|
|
42
|
+
"_size_l": "_size_l_k9rlr_gg_",
|
|
43
|
+
"_theme_dark": "_theme_dark_k9rlr_gg_",
|
|
44
|
+
"_theme_invert": "_theme_invert_k9rlr_gg_",
|
|
45
|
+
"@loading": "loading_1wbyfk1",
|
|
46
|
+
"_animation": "__animation_k9rlr_gg_",
|
|
47
|
+
"_theme_custom": "_theme_custom_k9rlr_gg_",
|
|
48
|
+
"--backgroundColor": "--backgroundColor_1wbyfk1",
|
|
49
|
+
"--duration": "--duration_1wbyfk1",
|
|
50
|
+
"--width": "--width_1wbyfk1",
|
|
51
|
+
"_theme": "__theme_k9rlr_gg_"
|
|
52
|
+
});
|
|
54
53
|
|
|
55
54
|
function isCustomTheme(theme) {
|
|
56
55
|
return !['dark', 'invert'].includes(theme);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
var styled_c8 = create([(
|
|
60
|
-
/*__reshadow_css_start__*/
|
|
61
|
-
__css__(
|
|
62
|
-
/*__inner_css_start__*/
|
|
63
|
-
".___SProgressBar_1yrpf_gg_.__theme_1yrpf_gg_.__theme_custom_1yrpf_gg_{background-color:var(--1romxg5_0);background-image:var(--1romxg5_0)}.___SProgressBar_1yrpf_gg_.__animation_1yrpf_gg_{-webkit-animation-duration:var(--1romxg5_2);animation-duration:var(--1romxg5_2)}"
|
|
64
|
-
/*__inner_css_end__*/
|
|
65
|
-
, "15rpvmm_gg_")
|
|
66
|
-
/*__reshadow_css_end__*/
|
|
67
|
-
, {
|
|
68
|
-
"__SProgressBar": "___SProgressBar_1yrpf_gg_",
|
|
69
|
-
"_theme": "__theme_1yrpf_gg_",
|
|
70
|
-
"_theme_custom": "__theme_custom_1yrpf_gg_",
|
|
71
|
-
"_animation": "__animation_1yrpf_gg_"
|
|
72
|
-
})]);
|
|
73
|
-
|
|
74
58
|
var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
75
59
|
_inherits(ProgressBarRoot, _Component);
|
|
76
60
|
|
|
@@ -98,7 +82,10 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
98
82
|
}, {
|
|
99
83
|
key: "render",
|
|
100
84
|
value: function render() {
|
|
101
|
-
var
|
|
85
|
+
var _ref = this ? this.asProps : arguments[0],
|
|
86
|
+
_ref3;
|
|
87
|
+
|
|
88
|
+
var SProgressBar = Box;
|
|
102
89
|
|
|
103
90
|
var _this$asProps2 = this.asProps,
|
|
104
91
|
Children = _this$asProps2.Children,
|
|
@@ -108,24 +95,17 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
108
95
|
theme = _this$asProps2.theme,
|
|
109
96
|
value = _this$asProps2.value,
|
|
110
97
|
animation = _this$asProps2.animation,
|
|
111
|
-
other = _objectWithoutProperties(_this$asProps2,
|
|
98
|
+
other = _objectWithoutProperties(_this$asProps2, _excluded);
|
|
112
99
|
|
|
113
|
-
var speedValue = "".concat(duration, "ms");
|
|
114
100
|
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
115
101
|
var color = resolveColor(theme);
|
|
116
|
-
logger.warn(animation !== undefined, "
|
|
117
|
-
return
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
animation: animation === undefined ? !value : animation,
|
|
124
|
-
size: size,
|
|
125
|
-
$$style: styled.$$style
|
|
126
|
-
}), /*#__PURE__*/React.createElement(Children, {
|
|
127
|
-
className: styled.styles["__Children"]
|
|
128
|
-
}))));
|
|
102
|
+
logger.warn(animation !== undefined, "The 'animation' property is deprecated, use 'value'", other['data-ui-name'] || ProgressBarRoot.displayName);
|
|
103
|
+
return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SProgressBar, _ref3.cn("SProgressBar", _objectSpread({}, _assignProps({
|
|
104
|
+
"use:theme": useTheme,
|
|
105
|
+
"use:animation": animation === undefined ? !value : animation,
|
|
106
|
+
"use:duration": "".concat(duration, "ms"),
|
|
107
|
+
"backgroundColor": color
|
|
108
|
+
}, _ref))), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})));
|
|
129
109
|
}
|
|
130
110
|
}]);
|
|
131
111
|
|
|
@@ -145,39 +125,23 @@ _defineProperty(ProgressBarRoot, "defaultProps", function () {
|
|
|
145
125
|
};
|
|
146
126
|
});
|
|
147
127
|
|
|
148
|
-
var styled_12c = create([(
|
|
149
|
-
/*__reshadow_css_start__*/
|
|
150
|
-
__css__(
|
|
151
|
-
/*__inner_css_start__*/
|
|
152
|
-
".___SValue_ongkf_gg_{width:var(--1romxg5_0);-webkit-animation-duration:var(--1romxg5_1);animation-duration:var(--1romxg5_1)}.___SValue_ongkf_gg_.__theme_ongkf_gg_{background-color:var(--1romxg5_2);background-image:var(--1romxg5_2)}"
|
|
153
|
-
/*__inner_css_end__*/
|
|
154
|
-
, "qg3glx_gg_")
|
|
155
|
-
/*__reshadow_css_end__*/
|
|
156
|
-
, {
|
|
157
|
-
"__SValue": "___SValue_ongkf_gg_",
|
|
158
|
-
"_theme": "__theme_ongkf_gg_"
|
|
159
|
-
})]);
|
|
160
|
-
|
|
161
128
|
function Value(props) {
|
|
162
|
-
var
|
|
163
|
-
|
|
129
|
+
var _ref2 = this ? this.asProps : arguments[0],
|
|
130
|
+
_ref4;
|
|
131
|
+
|
|
132
|
+
var SValue = Box;
|
|
133
|
+
var styles = props.styles,
|
|
164
134
|
value = props.value,
|
|
165
135
|
size = props.size,
|
|
166
136
|
theme = props.theme,
|
|
167
137
|
duration = props.duration;
|
|
168
138
|
var width = "".concat(value, "%");
|
|
169
|
-
var durationBackground = "".concat(duration, "ms");
|
|
170
139
|
var color = resolveColor(theme);
|
|
171
|
-
return
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
}
|
|
176
|
-
render: Box,
|
|
177
|
-
theme: theme,
|
|
178
|
-
size: size,
|
|
179
|
-
$$style: styled.$$style
|
|
180
|
-
}))));
|
|
140
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SValue, _ref4.cn("SValue", _objectSpread({}, _assignProps2({
|
|
141
|
+
"use:width": width,
|
|
142
|
+
"use:duration": "".concat(duration, "ms"),
|
|
143
|
+
"backgroundColor": color
|
|
144
|
+
}, _ref2))));
|
|
181
145
|
}
|
|
182
146
|
|
|
183
147
|
var ProgressBar = createComponent(ProgressBarRoot, {
|
|
@@ -185,13 +149,13 @@ var ProgressBar = createComponent(ProgressBarRoot, {
|
|
|
185
149
|
});
|
|
186
150
|
export default ProgressBar;
|
|
187
151
|
var Progress = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
188
|
-
logger.warn(true, "
|
|
152
|
+
logger.warn(true, "Component '<Progress/>' is deprecated, use '<ProgressBar.Value/>'", props['data-ui-name'] || ProgressBar.displayName);
|
|
189
153
|
return /*#__PURE__*/React.createElement(ProgressBar.Value, _extends({
|
|
190
154
|
ref: ref
|
|
191
155
|
}, props));
|
|
192
156
|
});
|
|
193
157
|
var Bar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
194
|
-
logger.warn(true, "
|
|
158
|
+
logger.warn(true, "Component '<Bar/>' is deprecated, please use '<ProgressBar/>'", props['data-ui-name'] || ProgressBar.displayName);
|
|
195
159
|
return /*#__PURE__*/React.createElement(ProgressBar, _extends({
|
|
196
160
|
ref: ref
|
|
197
161
|
}, props));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ProgressBar.
|
|
1
|
+
{"version":3,"sources":["../../src/ProgressBar.js"],"names":["React","createComponent","Component","sstyled","Root","Box","resolveColor","logger","isCustomTheme","theme","includes","ProgressBarRoot","asProps","value","duration","size","SProgressBar","Children","styles","animation","other","useTheme","color","warn","undefined","displayName","style","children","Value","props","SValue","width","ProgressBar","Progress","forwardRef","ref","Bar"],"mappings":"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","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport resolveColor from '@semcore/utils/lib/color';\nimport logger from '@semcore/utils/lib/logger';\n\nimport style from './style/progress-bar.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['dark', 'invert'].includes(theme);\n}\n\nclass ProgressBarRoot extends Component {\n static displayName = 'ProgressBar';\n static style = style;\n static defaultProps = () => ({\n duration: 1000,\n size: 'm',\n theme: 'invert',\n children: <ProgressBar.Value />,\n });\n\n getValueProps() {\n const { value, duration, size } = this.asProps;\n return {\n value,\n duration,\n size,\n };\n }\n\n render() {\n const SProgressBar = Root;\n const { Children, styles, duration, size, theme, value, animation, ...other } = this.asProps;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n\n logger.warn(\n animation !== undefined,\n \"The 'animation' property is deprecated, use 'value'\",\n other['data-ui-name'] || ProgressBarRoot.displayName,\n );\n\n return sstyled(styles)(\n <SProgressBar\n render={Box}\n use:theme={useTheme}\n use:animation={animation === undefined ? !value : animation}\n use:duration={`${duration}ms`}\n backgroundColor={color}\n >\n <Children />\n </SProgressBar>,\n );\n }\n}\n\nfunction Value(props) {\n const SValue = Root;\n const { styles, value, size, theme, duration } = props;\n const width = `${value}%`;\n const color = resolveColor(theme);\n\n return sstyled(styles)(\n <SValue\n render={Box}\n use:width={width}\n use:duration={`${duration}ms`}\n backgroundColor={color}\n />,\n );\n}\n\nconst ProgressBar = createComponent(ProgressBarRoot, {\n Value,\n});\n\nexport default ProgressBar;\n\nconst Progress = React.forwardRef(function (props, ref) {\n logger.warn(\n true,\n \"Component '<Progress/>' is deprecated, use '<ProgressBar.Value/>'\",\n props['data-ui-name'] || ProgressBar.displayName,\n );\n return <ProgressBar.Value ref={ref} {...props} />;\n});\n\nconst Bar = React.forwardRef(function (props, ref) {\n logger.warn(\n true,\n \"Component '<Bar/>' is deprecated, please use '<ProgressBar/>'\",\n props['data-ui-name'] || ProgressBar.displayName,\n );\n return <ProgressBar ref={ref} {...props} />;\n});\n\nexport { Bar, Progress };\n"],"file":"ProgressBar.js"}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,eAAxB;AACA,cAAc,eAAd","sourcesContent":["export { default } from './ProgressBar';\nexport * from './ProgressBar';\n"],"file":"index.js"}
|
|
@@ -31,23 +31,23 @@ SValue {
|
|
|
31
31
|
|
|
32
32
|
SProgressBar[size='s'],
|
|
33
33
|
SValue[size='s'] {
|
|
34
|
-
height:
|
|
34
|
+
height: 4px;
|
|
35
35
|
border-radius: 2px;
|
|
36
|
-
background-size:
|
|
36
|
+
background-size: 8px 8px;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
SProgressBar[size='m'],
|
|
40
40
|
SValue[size='m'] {
|
|
41
|
-
height:
|
|
41
|
+
height: 8px;
|
|
42
42
|
border-radius: 4px;
|
|
43
|
-
background-size:
|
|
43
|
+
background-size: 12px 12px;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
SProgressBar[size='l'],
|
|
47
47
|
SValue[size='l'] {
|
|
48
|
-
height:
|
|
48
|
+
height: 12px;
|
|
49
49
|
border-radius: 6px;
|
|
50
|
-
background-size:
|
|
50
|
+
background-size: 16px 16px;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
SProgressBar[theme='dark'] {
|
|
@@ -81,3 +81,22 @@ SProgressBar[animation] {
|
|
|
81
81
|
animation-timing-function: linear;
|
|
82
82
|
animation-iteration-count: infinite;
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
SProgressBar[theme='custom'] {
|
|
86
|
+
background-color: var(--backgroundColor);
|
|
87
|
+
}
|
|
88
|
+
SProgressBar[theme='custom'] {
|
|
89
|
+
background-image: var(--backgroundColor);
|
|
90
|
+
}
|
|
91
|
+
SProgressBar[animation] {
|
|
92
|
+
animation-duration: var(--duration);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
SValue {
|
|
96
|
+
width: var(--width);
|
|
97
|
+
animation-duration: var(--duration);
|
|
98
|
+
}
|
|
99
|
+
SValue[theme] {
|
|
100
|
+
background-color: var(--backgroundColor);
|
|
101
|
+
background-image: var(--backgroundColor);
|
|
102
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,2 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ReturnEl, CProps, PropGetterFn } from '@semcore/core';
|
|
2
|
+
import { IBoxProps } from '@semcore/flex-box';
|
|
3
|
+
|
|
4
|
+
export interface IProgressBarProps extends IBoxProps {
|
|
5
|
+
/**
|
|
6
|
+
* Progress bar theme
|
|
7
|
+
* @default invert
|
|
8
|
+
*/
|
|
9
|
+
theme?: 'dark' | 'invert' | string;
|
|
10
|
+
/**
|
|
11
|
+
* Progress bar size
|
|
12
|
+
* @default m
|
|
13
|
+
*/
|
|
14
|
+
size?: 's' | 'm' | 'l';
|
|
15
|
+
/** Value as a percentage */
|
|
16
|
+
value?: number;
|
|
17
|
+
/** Duration of animation, ms
|
|
18
|
+
* @default 1000
|
|
19
|
+
*/
|
|
20
|
+
duration?: number;
|
|
21
|
+
/** Sets an animated background
|
|
22
|
+
* @deprecated v2.0.0 {@link IProgressBarProps.value}
|
|
23
|
+
* */
|
|
24
|
+
animation?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IValueProps extends IBoxProps {
|
|
28
|
+
size?: 's' | 'm' | 'l';
|
|
29
|
+
value?: number;
|
|
30
|
+
duration?: number;
|
|
31
|
+
theme?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IProgressBarCxt {
|
|
35
|
+
getValueProps: PropGetterFn;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const ProgressBar: (<T>(
|
|
39
|
+
props: CProps<IProgressBarProps & T, IProgressBarCxt>,
|
|
40
|
+
) => ReturnEl) & {
|
|
41
|
+
Value: <T>(props: IValueProps & T) => ReturnEl;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default ProgressBar;
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/progress-bar",
|
|
3
3
|
"description": "SEMRush ProgressBar Component",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.2",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
8
9
|
"author": "Roman Lysov <r.lysov@semrush.com>",
|
|
9
10
|
"license": "MIT",
|
|
10
11
|
"scripts": {
|
|
11
|
-
"build": "build",
|
|
12
|
+
"build": "build --source=js",
|
|
12
13
|
"test": "jest"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
@@ -16,10 +17,15 @@
|
|
|
16
17
|
"@semcore/flex-box": "^4"
|
|
17
18
|
},
|
|
18
19
|
"peerDependencies": {
|
|
19
|
-
"@semcore/core": "^1",
|
|
20
|
+
"@semcore/core": "^1.11",
|
|
20
21
|
"react": "16.8 - 17"
|
|
21
22
|
},
|
|
22
23
|
"jest": {
|
|
23
|
-
"preset": "jest-preset-ui"
|
|
24
|
+
"preset": "@semcore/jest-preset-ui"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/semrush/intergalactic.git",
|
|
29
|
+
"directory": "semcore/progress-bar"
|
|
24
30
|
}
|
|
25
31
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
3
|
+
import { Box } from '@semcore/flex-box';
|
|
4
|
+
import resolveColor from '@semcore/utils/lib/color';
|
|
5
|
+
import logger from '@semcore/utils/lib/logger';
|
|
6
|
+
|
|
7
|
+
import style from './style/progress-bar.shadow.css';
|
|
8
|
+
|
|
9
|
+
function isCustomTheme(theme) {
|
|
10
|
+
return !['dark', 'invert'].includes(theme);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class ProgressBarRoot extends Component {
|
|
14
|
+
static displayName = 'ProgressBar';
|
|
15
|
+
static style = style;
|
|
16
|
+
static defaultProps = () => ({
|
|
17
|
+
duration: 1000,
|
|
18
|
+
size: 'm',
|
|
19
|
+
theme: 'invert',
|
|
20
|
+
children: <ProgressBar.Value />,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
getValueProps() {
|
|
24
|
+
const { value, duration, size } = this.asProps;
|
|
25
|
+
return {
|
|
26
|
+
value,
|
|
27
|
+
duration,
|
|
28
|
+
size,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
const SProgressBar = Root;
|
|
34
|
+
const { Children, styles, duration, size, theme, value, animation, ...other } = this.asProps;
|
|
35
|
+
const useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
36
|
+
const color = resolveColor(theme);
|
|
37
|
+
|
|
38
|
+
logger.warn(
|
|
39
|
+
animation !== undefined,
|
|
40
|
+
"The 'animation' property is deprecated, use 'value'",
|
|
41
|
+
other['data-ui-name'] || ProgressBarRoot.displayName,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return sstyled(styles)(
|
|
45
|
+
<SProgressBar
|
|
46
|
+
render={Box}
|
|
47
|
+
use:theme={useTheme}
|
|
48
|
+
use:animation={animation === undefined ? !value : animation}
|
|
49
|
+
use:duration={`${duration}ms`}
|
|
50
|
+
backgroundColor={color}
|
|
51
|
+
>
|
|
52
|
+
<Children />
|
|
53
|
+
</SProgressBar>,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function Value(props) {
|
|
59
|
+
const SValue = Root;
|
|
60
|
+
const { styles, value, size, theme, duration } = props;
|
|
61
|
+
const width = `${value}%`;
|
|
62
|
+
const color = resolveColor(theme);
|
|
63
|
+
|
|
64
|
+
return sstyled(styles)(
|
|
65
|
+
<SValue
|
|
66
|
+
render={Box}
|
|
67
|
+
use:width={width}
|
|
68
|
+
use:duration={`${duration}ms`}
|
|
69
|
+
backgroundColor={color}
|
|
70
|
+
/>,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const ProgressBar = createComponent(ProgressBarRoot, {
|
|
75
|
+
Value,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export default ProgressBar;
|
|
79
|
+
|
|
80
|
+
const Progress = React.forwardRef(function (props, ref) {
|
|
81
|
+
logger.warn(
|
|
82
|
+
true,
|
|
83
|
+
"Component '<Progress/>' is deprecated, use '<ProgressBar.Value/>'",
|
|
84
|
+
props['data-ui-name'] || ProgressBar.displayName,
|
|
85
|
+
);
|
|
86
|
+
return <ProgressBar.Value ref={ref} {...props} />;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const Bar = React.forwardRef(function (props, ref) {
|
|
90
|
+
logger.warn(
|
|
91
|
+
true,
|
|
92
|
+
"Component '<Bar/>' is deprecated, please use '<ProgressBar/>'",
|
|
93
|
+
props['data-ui-name'] || ProgressBar.displayName,
|
|
94
|
+
);
|
|
95
|
+
return <ProgressBar ref={ref} {...props} />;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export { Bar, Progress };
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReturnEl, CProps, PropGetterFn } from '@semcore/core';
|
|
2
|
+
import { IBoxProps } from '@semcore/flex-box';
|
|
3
|
+
|
|
4
|
+
export interface IProgressBarProps extends IBoxProps {
|
|
5
|
+
/**
|
|
6
|
+
* Progress bar theme
|
|
7
|
+
* @default invert
|
|
8
|
+
*/
|
|
9
|
+
theme?: 'dark' | 'invert' | string;
|
|
10
|
+
/**
|
|
11
|
+
* Progress bar size
|
|
12
|
+
* @default m
|
|
13
|
+
*/
|
|
14
|
+
size?: 's' | 'm' | 'l';
|
|
15
|
+
/** Value as a percentage */
|
|
16
|
+
value?: number;
|
|
17
|
+
/** Duration of animation, ms
|
|
18
|
+
* @default 1000
|
|
19
|
+
*/
|
|
20
|
+
duration?: number;
|
|
21
|
+
/** Sets an animated background
|
|
22
|
+
* @deprecated v2.0.0 {@link IProgressBarProps.value}
|
|
23
|
+
* */
|
|
24
|
+
animation?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IValueProps extends IBoxProps {
|
|
28
|
+
size?: 's' | 'm' | 'l';
|
|
29
|
+
value?: number;
|
|
30
|
+
duration?: number;
|
|
31
|
+
theme?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IProgressBarCxt {
|
|
35
|
+
getValueProps: PropGetterFn;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const ProgressBar: (<T>(
|
|
39
|
+
props: CProps<IProgressBarProps & T, IProgressBarCxt>,
|
|
40
|
+
) => ReturnEl) & {
|
|
41
|
+
Value: <T>(props: IValueProps & T) => ReturnEl;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default ProgressBar;
|
|
File without changes
|
|
@@ -31,23 +31,23 @@ SValue {
|
|
|
31
31
|
|
|
32
32
|
SProgressBar[size='s'],
|
|
33
33
|
SValue[size='s'] {
|
|
34
|
-
height:
|
|
34
|
+
height: 4px;
|
|
35
35
|
border-radius: 2px;
|
|
36
|
-
background-size:
|
|
36
|
+
background-size: 8px 8px;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
SProgressBar[size='m'],
|
|
40
40
|
SValue[size='m'] {
|
|
41
|
-
height:
|
|
41
|
+
height: 8px;
|
|
42
42
|
border-radius: 4px;
|
|
43
|
-
background-size:
|
|
43
|
+
background-size: 12px 12px;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
SProgressBar[size='l'],
|
|
47
47
|
SValue[size='l'] {
|
|
48
|
-
height:
|
|
48
|
+
height: 12px;
|
|
49
49
|
border-radius: 6px;
|
|
50
|
-
background-size:
|
|
50
|
+
background-size: 16px 16px;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
SProgressBar[theme='dark'] {
|
|
@@ -81,3 +81,22 @@ SProgressBar[animation] {
|
|
|
81
81
|
animation-timing-function: linear;
|
|
82
82
|
animation-iteration-count: infinite;
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
SProgressBar[theme='custom'] {
|
|
86
|
+
background-color: var(--backgroundColor);
|
|
87
|
+
}
|
|
88
|
+
SProgressBar[theme='custom'] {
|
|
89
|
+
background-image: var(--backgroundColor);
|
|
90
|
+
}
|
|
91
|
+
SProgressBar[animation] {
|
|
92
|
+
animation-duration: var(--duration);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
SValue {
|
|
96
|
+
width: var(--width);
|
|
97
|
+
animation-duration: var(--duration);
|
|
98
|
+
}
|
|
99
|
+
SValue[theme] {
|
|
100
|
+
background-color: var(--backgroundColor);
|
|
101
|
+
background-image: var(--backgroundColor);
|
|
102
|
+
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Merge } from '@semcore/core';
|
|
3
|
-
import { IBoxProps } from '@semcore/flex-box';
|
|
4
|
-
export interface IProgressBarProps extends IBoxProps {
|
|
5
|
-
/**
|
|
6
|
-
* Progress bar theme
|
|
7
|
-
* @default invert
|
|
8
|
-
*/
|
|
9
|
-
theme?: 'dark' | 'invert' | string;
|
|
10
|
-
/**
|
|
11
|
-
* Progress bar size
|
|
12
|
-
* @default m
|
|
13
|
-
*/
|
|
14
|
-
size?: 's' | 'm' | 'l';
|
|
15
|
-
/** Value as a percentage */
|
|
16
|
-
value?: number;
|
|
17
|
-
/** ДDuration of animation, ms
|
|
18
|
-
* @default 1000
|
|
19
|
-
*/
|
|
20
|
-
duration?: number;
|
|
21
|
-
/** Sets an animated background
|
|
22
|
-
* @deprecated v2.0.0 {@link IProgressBarProps.value}
|
|
23
|
-
* */
|
|
24
|
-
animation?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface IValueProps extends IBoxProps {
|
|
27
|
-
size?: 's' | 'm' | 'l';
|
|
28
|
-
value?: number;
|
|
29
|
-
duration?: number;
|
|
30
|
-
theme?: string;
|
|
31
|
-
}
|
|
32
|
-
declare const ProgressBar: import("@semcore/core").ComponentType<Merge<IProgressBarProps, React.HTMLAttributes<HTMLDivElement>>, {
|
|
33
|
-
Value: Merge<IValueProps, React.HTMLAttributes<HTMLDivElement>>;
|
|
34
|
-
}, {}, {
|
|
35
|
-
[key: string]: (arg: unknown) => void;
|
|
36
|
-
}, null>;
|
|
37
|
-
export default ProgressBar;
|
|
38
|
-
declare const Progress: React.ForwardRefExoticComponent<Pick<Merge<IValueProps, React.HTMLAttributes<HTMLDivElement>>, import("csstype").FlexProperty<string>> & React.RefAttributes<unknown>>;
|
|
39
|
-
declare const Bar: React.ForwardRefExoticComponent<Pick<Merge<IProgressBarProps, React.HTMLAttributes<HTMLDivElement>>, import("csstype").FlexProperty<string>> & React.RefAttributes<unknown>>;
|
|
40
|
-
export { Bar, Progress };
|
package/src/ProgressBar.tsx
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import createComponent, { Component, IFunctionProps, Merge, styled } from '@semcore/core';
|
|
3
|
-
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
4
|
-
import resolveColor from '@semcore/utils/lib/color';
|
|
5
|
-
import logger from '@semcore/utils/lib/logger';
|
|
6
|
-
|
|
7
|
-
import style from './style/progress-bar.shadow.css';
|
|
8
|
-
|
|
9
|
-
export interface IProgressBarProps extends IBoxProps {
|
|
10
|
-
/**
|
|
11
|
-
* Progress bar theme
|
|
12
|
-
* @default invert
|
|
13
|
-
*/
|
|
14
|
-
theme?: 'dark' | 'invert' | string;
|
|
15
|
-
/**
|
|
16
|
-
* Progress bar size
|
|
17
|
-
* @default m
|
|
18
|
-
*/
|
|
19
|
-
size?: 's' | 'm' | 'l';
|
|
20
|
-
/** Value as a percentage */
|
|
21
|
-
value?: number;
|
|
22
|
-
/** ДDuration of animation, ms
|
|
23
|
-
* @default 1000
|
|
24
|
-
*/
|
|
25
|
-
duration?: number;
|
|
26
|
-
/** Sets an animated background
|
|
27
|
-
* @deprecated v2.0.0 {@link IProgressBarProps.value}
|
|
28
|
-
* */
|
|
29
|
-
animation?: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface IValueProps extends IBoxProps {
|
|
33
|
-
size?: 's' | 'm' | 'l';
|
|
34
|
-
value?: number;
|
|
35
|
-
duration?: number;
|
|
36
|
-
theme?: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function isCustomTheme(theme) {
|
|
40
|
-
return !['dark', 'invert'].includes(theme);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
class ProgressBarRoot extends Component<IProgressBarProps> {
|
|
44
|
-
static displayName = 'ProgressBar';
|
|
45
|
-
static style = style;
|
|
46
|
-
static defaultProps = () => ({
|
|
47
|
-
duration: 1000,
|
|
48
|
-
size: 'm',
|
|
49
|
-
theme: 'invert',
|
|
50
|
-
children: <ProgressBar.Value />,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
getValueProps() {
|
|
54
|
-
const { value, duration, size } = this.asProps;
|
|
55
|
-
return {
|
|
56
|
-
value,
|
|
57
|
-
duration,
|
|
58
|
-
size,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
render() {
|
|
63
|
-
const { Root: SProgressBar } = this;
|
|
64
|
-
const { Children, styles, duration, size, theme, value, animation, ...other } = this.asProps;
|
|
65
|
-
const speedValue = `${duration}ms`;
|
|
66
|
-
const useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
67
|
-
const color = resolveColor(theme);
|
|
68
|
-
|
|
69
|
-
logger.warn(
|
|
70
|
-
animation !== undefined,
|
|
71
|
-
"Свойство 'animation' является устаревшим, используйте 'value'",
|
|
72
|
-
other['data-ui-name'] || ProgressBarRoot.displayName,
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return styled(styles)`
|
|
76
|
-
SProgressBar[theme='custom'] {
|
|
77
|
-
background-color: ${color};
|
|
78
|
-
}
|
|
79
|
-
SProgressBar[theme='custom'] {
|
|
80
|
-
background-image: ${color};
|
|
81
|
-
}
|
|
82
|
-
SProgressBar[animation] {
|
|
83
|
-
animation-duration: ${speedValue};
|
|
84
|
-
}
|
|
85
|
-
`(
|
|
86
|
-
<SProgressBar
|
|
87
|
-
render={Box}
|
|
88
|
-
theme={useTheme}
|
|
89
|
-
animation={animation === undefined ? !value : animation}
|
|
90
|
-
size={size}
|
|
91
|
-
>
|
|
92
|
-
<Children />
|
|
93
|
-
</SProgressBar>,
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function Value(props: IFunctionProps<IValueProps>) {
|
|
99
|
-
const { Root: SValue, styles, value, size, theme, duration } = props;
|
|
100
|
-
const width = `${value}%`;
|
|
101
|
-
const durationBackground = `${duration}ms`;
|
|
102
|
-
const color = resolveColor(theme);
|
|
103
|
-
|
|
104
|
-
return styled(styles)`
|
|
105
|
-
SValue {
|
|
106
|
-
width: ${width};
|
|
107
|
-
animation-duration: ${durationBackground};
|
|
108
|
-
}
|
|
109
|
-
SValue[theme] {
|
|
110
|
-
background-color: ${color};
|
|
111
|
-
background-image: ${color};
|
|
112
|
-
}
|
|
113
|
-
`(<SValue render={Box} theme={theme} size={size} />);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const ProgressBar = createComponent<
|
|
117
|
-
Merge<IProgressBarProps, React.HTMLAttributes<HTMLDivElement>>,
|
|
118
|
-
{
|
|
119
|
-
Value: Merge<IValueProps, React.HTMLAttributes<HTMLDivElement>>;
|
|
120
|
-
}
|
|
121
|
-
>(ProgressBarRoot, {
|
|
122
|
-
Value,
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
export default ProgressBar;
|
|
126
|
-
|
|
127
|
-
const Progress = React.forwardRef<
|
|
128
|
-
unknown,
|
|
129
|
-
Merge<IValueProps, React.HTMLAttributes<HTMLDivElement>>
|
|
130
|
-
>(function (props, ref) {
|
|
131
|
-
logger.warn(
|
|
132
|
-
true,
|
|
133
|
-
"Компонент '<Progress/>' является устаревшим, используйте '<ProgressBar.Value/>'",
|
|
134
|
-
props['data-ui-name'] || ProgressBar.displayName,
|
|
135
|
-
);
|
|
136
|
-
return <ProgressBar.Value ref={ref} {...props} />;
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
const Bar = React.forwardRef<
|
|
140
|
-
unknown,
|
|
141
|
-
Merge<IProgressBarProps, React.HTMLAttributes<HTMLDivElement>>
|
|
142
|
-
>(function (props, ref) {
|
|
143
|
-
logger.warn(
|
|
144
|
-
true,
|
|
145
|
-
"Компонент '<Bar/>' является устаревшим, используйте '<ProgressBar/>'",
|
|
146
|
-
props['data-ui-name'] || ProgressBar.displayName,
|
|
147
|
-
);
|
|
148
|
-
return <ProgressBar ref={ref} {...props} />;
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export { Bar, Progress };
|