@semcore/progress-bar 4.8.2-prerelease.0 → 4.9.0-prerelease.0
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 +7 -1
- package/lib/cjs/ProgressBar.js +27 -22
- package/lib/cjs/ProgressBar.js.map +1 -1
- package/lib/es6/ProgressBar.js +25 -20
- package/lib/es6/ProgressBar.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [4.
|
|
5
|
+
## [4.9.0-prerelease.0] - 2023-10-26
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Design tokens resolving for `theme` prop.
|
|
10
|
+
|
|
11
|
+
## [4.8.2] - 2023-10-24
|
|
6
12
|
|
|
7
13
|
### Changed
|
|
8
14
|
|
package/lib/cjs/ProgressBar.js
CHANGED
|
@@ -15,23 +15,23 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _flexBox = require("@semcore/flex-box");
|
|
18
|
-
var
|
|
18
|
+
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/resolveColorEnhance"));
|
|
19
19
|
/*__reshadow-styles__:"./style/progress-bar.shadow.css"*/
|
|
20
|
-
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
21
|
-
"__SProgressBar": "
|
|
22
|
-
"_theme_dark": "
|
|
23
|
-
"__SValue": "
|
|
24
|
-
"--width": "--
|
|
25
|
-
"--duration": "--
|
|
26
|
-
"_theme": "
|
|
27
|
-
"--colorBg": "--
|
|
28
|
-
"_size_s": "
|
|
29
|
-
"_size_m": "
|
|
30
|
-
"_size_l": "
|
|
31
|
-
"_theme_invert": "
|
|
32
|
-
"@loading": "
|
|
33
|
-
"_animation": "
|
|
34
|
-
"_theme_custom": "
|
|
20
|
+
var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/"@keyframes loading_h33xh{0%{background-position:0 0}to{background-position:60px 0}}.___SProgressBar_h33xh_gg_{position:relative;width:100%;overflow:hidden;background-color:var(--intergalactic-progress-bar-bg, #e0e1e9)}.___SProgressBar_h33xh_gg_._theme_dark_h33xh_gg_{background-color:var(--intergalactic-progress-bar-bg-invert, rgba(255, 255, 255, 0.2))}.___SValue_h33xh_gg_{position:absolute;top:0;left:0;background-color:var(--intergalactic-progress-bar-value-bg, #000000);background-image:var(--intergalactic-progress-bar-value-gradient,\n linear-gradient(-45deg, rgba(0, 159, 129, 0.9) 25%, rgba(0, 159, 129, 1) 0%, rgba(0, 159, 129, 1) 50%, rgba(0, 159, 129, 0.9) 0%, rgba(0, 159, 129, 0.9) 75%, rgba(0, 159, 129, 1) 0%));overflow:hidden;animation-name:loading_h33xh;animation-timing-function:linear;animation-iteration-count:infinite;transition-property:width;transition-timing-function:linear;width:var(--width_h33xh);animation-duration:var(--duration_h33xh);transition-duration:var(--duration_h33xh)}.___SValue_h33xh_gg_.__theme_h33xh_gg_{background-color:var(--colorBg_h33xh);background-image:var(--colorBg_h33xh)}.___SProgressBar_h33xh_gg_._size_s_h33xh_gg_,.___SValue_h33xh_gg_._size_s_h33xh_gg_{height:4px;border-radius:var(--intergalactic-progress-bar-rounded, 6px);background-size:8px 8px}.___SProgressBar_h33xh_gg_._size_m_h33xh_gg_,.___SValue_h33xh_gg_._size_m_h33xh_gg_{height:8px;border-radius:var(--intergalactic-progress-bar-rounded, 6px);background-size:12px 12px}.___SProgressBar_h33xh_gg_._size_l_h33xh_gg_,.___SValue_h33xh_gg_._size_l_h33xh_gg_{height:12px;border-radius:var(--intergalactic-progress-bar-rounded, 6px);background-size:16px 16px}.___SProgressBar_h33xh_gg_._theme_invert_h33xh_gg_{background-color:var(--intergalactic-progress-bar-bg, #e0e1e9)}.___SProgressBar_h33xh_gg_.__animation_h33xh_gg_{background-color:var(--intergalactic-progress-bar-value-bg, #000000);background-image:var(--intergalactic-progress-bar-pattern-gradient,\n linear-gradient(-45deg, rgba(224, 225, 233, 0.9) 25%, rgba(224, 225, 233, 1) 0%, rgba(224, 225, 233, 1) 50%, rgba(224, 225, 233, 0.9) 0%, rgba(224, 225, 233, 0.9) 75%, rgba(224, 225, 233, 1) 0%));animation-name:loading_h33xh;animation-timing-function:linear;animation-iteration-count:infinite;animation-duration:var(--duration_h33xh)}.___SProgressBar_h33xh_gg_._theme_custom_h33xh_gg_{background-color:var(--colorBg_h33xh);background-image:var(--colorBg_h33xh)}@media (prefers-reduced-motion){.___SProgressBar_h33xh_gg_.__animation_h33xh_gg_,.___SValue_h33xh_gg_{animation-name:none}}" /*__inner_css_end__*/, "h33xh_gg_") /*__reshadow_css_end__*/, {
|
|
21
|
+
"__SProgressBar": "___SProgressBar_h33xh_gg_",
|
|
22
|
+
"_theme_dark": "_theme_dark_h33xh_gg_",
|
|
23
|
+
"__SValue": "___SValue_h33xh_gg_",
|
|
24
|
+
"--width": "--width_h33xh",
|
|
25
|
+
"--duration": "--duration_h33xh",
|
|
26
|
+
"_theme": "__theme_h33xh_gg_",
|
|
27
|
+
"--colorBg": "--colorBg_h33xh",
|
|
28
|
+
"_size_s": "_size_s_h33xh_gg_",
|
|
29
|
+
"_size_m": "_size_m_h33xh_gg_",
|
|
30
|
+
"_size_l": "_size_l_h33xh_gg_",
|
|
31
|
+
"_theme_invert": "_theme_invert_h33xh_gg_",
|
|
32
|
+
"@loading": "loading_h33xh",
|
|
33
|
+
"_animation": "__animation_h33xh_gg_",
|
|
34
|
+
"_theme_custom": "_theme_custom_h33xh_gg_"
|
|
35
35
|
});
|
|
36
36
|
function isCustomTheme(theme) {
|
|
37
37
|
return !['dark', 'invert'].includes(theme);
|
|
@@ -49,11 +49,13 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
49
49
|
var _this$asProps = this.asProps,
|
|
50
50
|
value = _this$asProps.value,
|
|
51
51
|
duration = _this$asProps.duration,
|
|
52
|
-
size = _this$asProps.size
|
|
52
|
+
size = _this$asProps.size,
|
|
53
|
+
resolveColor = _this$asProps.resolveColor;
|
|
53
54
|
return {
|
|
54
55
|
value: value,
|
|
55
56
|
duration: duration,
|
|
56
|
-
size: size
|
|
57
|
+
size: size,
|
|
58
|
+
resolveColor: resolveColor
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
}, {
|
|
@@ -67,13 +69,14 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
67
69
|
styles = _this$asProps2.styles,
|
|
68
70
|
duration = _this$asProps2.duration,
|
|
69
71
|
theme = _this$asProps2.theme,
|
|
70
|
-
value = _this$asProps2.value
|
|
72
|
+
value = _this$asProps2.value,
|
|
73
|
+
resolveColor = _this$asProps2.resolveColor;
|
|
71
74
|
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
72
75
|
return _ref3 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SProgressBar, _ref3.cn("SProgressBar", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
73
76
|
"use:theme": useTheme,
|
|
74
77
|
"use:animation": !value,
|
|
75
78
|
"use:duration": "".concat(duration, "ms"),
|
|
76
|
-
"colorBg": (
|
|
79
|
+
"colorBg": resolveColor(theme),
|
|
77
80
|
"role": 'progressbar',
|
|
78
81
|
"aria-valuenow": value
|
|
79
82
|
}, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {})));
|
|
@@ -83,6 +86,7 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
83
86
|
}(_core.Component);
|
|
84
87
|
(0, _defineProperty2["default"])(ProgressBarRoot, "displayName", 'ProgressBar');
|
|
85
88
|
(0, _defineProperty2["default"])(ProgressBarRoot, "style", style);
|
|
89
|
+
(0, _defineProperty2["default"])(ProgressBarRoot, "enhance", [(0, _resolveColorEnhance["default"])()]);
|
|
86
90
|
(0, _defineProperty2["default"])(ProgressBarRoot, "defaultProps", function () {
|
|
87
91
|
return {
|
|
88
92
|
duration: 1000,
|
|
@@ -98,12 +102,13 @@ function Value(props) {
|
|
|
98
102
|
var styles = props.styles,
|
|
99
103
|
value = props.value,
|
|
100
104
|
theme = props.theme,
|
|
101
|
-
duration = props.duration
|
|
105
|
+
duration = props.duration,
|
|
106
|
+
resolveColor = props.resolveColor;
|
|
102
107
|
var width = "".concat(value, "%");
|
|
103
108
|
return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SValue, _ref4.cn("SValue", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
104
109
|
"use:width": width,
|
|
105
110
|
"use:duration": "".concat(duration, "ms"),
|
|
106
|
-
"colorBg": (
|
|
111
|
+
"colorBg": resolveColor(theme)
|
|
107
112
|
}, _ref2))));
|
|
108
113
|
}
|
|
109
114
|
var ProgressBar = (0, _core["default"])(ProgressBarRoot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_resolveColorEnhance","style","sstyled","insert","isCustomTheme","theme","includes","ProgressBarRoot","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","getValueProps","_this$asProps","asProps","duration","size","resolveColor","render","_ref","_ref3","SProgressBar","Box","_this$asProps2","Children","styles","useTheme","createElement","cn","_objectSpread2","assignProps","concat","Component","_defineProperty2","resolveColorEnhance","children","ProgressBar","Value","props","_ref2","arguments[0]","_ref4","SValue","width","createComponent","_default","exports"],"sources":["../../src/ProgressBar.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\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 enhance = [resolveColorEnhance()];\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, resolveColor } = this.asProps;\n return {\n value,\n duration,\n size,\n resolveColor,\n };\n }\n\n render() {\n const SProgressBar = Root;\n const { Children, styles, duration, theme, value, resolveColor } = this.asProps;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n return sstyled(styles)(\n <SProgressBar\n render={Box}\n use:theme={useTheme}\n use:animation={!value}\n use:duration={`${duration}ms`}\n colorBg={resolveColor(theme)}\n role='progressbar'\n aria-valuenow={value}\n >\n <Children />\n </SProgressBar>,\n );\n }\n}\n\nfunction Value(props) {\n const SValue = Root;\n const { styles, value, theme, duration, resolveColor } = props;\n const width = `${value}%`;\n\n return sstyled(styles)(\n <SValue\n render={Box}\n use:width={width}\n use:duration={`${duration}ms`}\n colorBg={resolveColor(theme)}\n />,\n );\n}\n\nconst ProgressBar = createComponent(ProgressBarRoot, {\n Value,\n});\n\nexport default ProgressBar;\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAkF;AAAA,IAAAK,KAAA,+BAAAP,KAAA,CAAAQ,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAA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,KAAK,CAAvCvC,KAAK;IAAEgB,QAAQ,GAAmBuB,KAAK,CAAhCvB,QAAQ;IAAEE,YAAY,GAAKqB,KAAK,CAAtBrB,YAAY;EACpD,IAAM0B,KAAK,MAAAZ,MAAA,CAAMpB,KAAK,MAAG;EAEzB,OAAA8B,KAAA,GAAO,IAAA7C,aAAO,EAAC6B,MAAM,CAAC,eACpBlC,MAAA,YAAAoC,aAAA,CAACe,MAAM,EAAAD,KAAA,CAAAb,EAAA,eAAAC,cAAA,qBAAAzC,KAAA,CAAA0C,WAAA;IAAA,aAEMa,KAAK;IAAA,mBAAAZ,MAAA,CACChB,QAAQ;IAAA,WAChBE,YAAY,CAAClB,KAAK;EAAC,GAAAwC,KAAA,IAC5B;AAEN;AAEA,IAAMH,WAAW,GAAG,IAAAQ,gBAAe,EAAC3C,eAAe,EAAE;EACnDoC,KAAK,EAALA;AACF,CAAC,CAAC;AAAC,IAAAQ,QAAA,GAEYT,WAAW;AAAAU,OAAA,cAAAD,QAAA"}
|
package/lib/es6/ProgressBar.js
CHANGED
|
@@ -10,23 +10,23 @@ import { assignProps as _assignProps } from "@semcore/core";
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
12
12
|
import { Box } from '@semcore/flex-box';
|
|
13
|
-
import
|
|
13
|
+
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
14
14
|
/*__reshadow-styles__:"./style/progress-bar.shadow.css"*/
|
|
15
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
16
|
-
"__SProgressBar": "
|
|
17
|
-
"_theme_dark": "
|
|
18
|
-
"__SValue": "
|
|
19
|
-
"--width": "--
|
|
20
|
-
"--duration": "--
|
|
21
|
-
"_theme": "
|
|
22
|
-
"--colorBg": "--
|
|
23
|
-
"_size_s": "
|
|
24
|
-
"_size_m": "
|
|
25
|
-
"_size_l": "
|
|
26
|
-
"_theme_invert": "
|
|
27
|
-
"@loading": "
|
|
28
|
-
"_animation": "
|
|
29
|
-
"_theme_custom": "
|
|
15
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes loading_h33xh{0%{background-position:0 0}to{background-position:60px 0}}.___SProgressBar_h33xh_gg_{position:relative;width:100%;overflow:hidden;background-color:var(--intergalactic-progress-bar-bg, #e0e1e9)}.___SProgressBar_h33xh_gg_._theme_dark_h33xh_gg_{background-color:var(--intergalactic-progress-bar-bg-invert, rgba(255, 255, 255, 0.2))}.___SValue_h33xh_gg_{position:absolute;top:0;left:0;background-color:var(--intergalactic-progress-bar-value-bg, #000000);background-image:var(--intergalactic-progress-bar-value-gradient,\n linear-gradient(-45deg, rgba(0, 159, 129, 0.9) 25%, rgba(0, 159, 129, 1) 0%, rgba(0, 159, 129, 1) 50%, rgba(0, 159, 129, 0.9) 0%, rgba(0, 159, 129, 0.9) 75%, rgba(0, 159, 129, 1) 0%));overflow:hidden;animation-name:loading_h33xh;animation-timing-function:linear;animation-iteration-count:infinite;transition-property:width;transition-timing-function:linear;width:var(--width_h33xh);animation-duration:var(--duration_h33xh);transition-duration:var(--duration_h33xh)}.___SValue_h33xh_gg_.__theme_h33xh_gg_{background-color:var(--colorBg_h33xh);background-image:var(--colorBg_h33xh)}.___SProgressBar_h33xh_gg_._size_s_h33xh_gg_,.___SValue_h33xh_gg_._size_s_h33xh_gg_{height:4px;border-radius:var(--intergalactic-progress-bar-rounded, 6px);background-size:8px 8px}.___SProgressBar_h33xh_gg_._size_m_h33xh_gg_,.___SValue_h33xh_gg_._size_m_h33xh_gg_{height:8px;border-radius:var(--intergalactic-progress-bar-rounded, 6px);background-size:12px 12px}.___SProgressBar_h33xh_gg_._size_l_h33xh_gg_,.___SValue_h33xh_gg_._size_l_h33xh_gg_{height:12px;border-radius:var(--intergalactic-progress-bar-rounded, 6px);background-size:16px 16px}.___SProgressBar_h33xh_gg_._theme_invert_h33xh_gg_{background-color:var(--intergalactic-progress-bar-bg, #e0e1e9)}.___SProgressBar_h33xh_gg_.__animation_h33xh_gg_{background-color:var(--intergalactic-progress-bar-value-bg, #000000);background-image:var(--intergalactic-progress-bar-pattern-gradient,\n linear-gradient(-45deg, rgba(224, 225, 233, 0.9) 25%, rgba(224, 225, 233, 1) 0%, rgba(224, 225, 233, 1) 50%, rgba(224, 225, 233, 0.9) 0%, rgba(224, 225, 233, 0.9) 75%, rgba(224, 225, 233, 1) 0%));animation-name:loading_h33xh;animation-timing-function:linear;animation-iteration-count:infinite;animation-duration:var(--duration_h33xh)}.___SProgressBar_h33xh_gg_._theme_custom_h33xh_gg_{background-color:var(--colorBg_h33xh);background-image:var(--colorBg_h33xh)}@media (prefers-reduced-motion){.___SProgressBar_h33xh_gg_.__animation_h33xh_gg_,.___SValue_h33xh_gg_{animation-name:none}}" /*__inner_css_end__*/, "h33xh_gg_") /*__reshadow_css_end__*/, {
|
|
16
|
+
"__SProgressBar": "___SProgressBar_h33xh_gg_",
|
|
17
|
+
"_theme_dark": "_theme_dark_h33xh_gg_",
|
|
18
|
+
"__SValue": "___SValue_h33xh_gg_",
|
|
19
|
+
"--width": "--width_h33xh",
|
|
20
|
+
"--duration": "--duration_h33xh",
|
|
21
|
+
"_theme": "__theme_h33xh_gg_",
|
|
22
|
+
"--colorBg": "--colorBg_h33xh",
|
|
23
|
+
"_size_s": "_size_s_h33xh_gg_",
|
|
24
|
+
"_size_m": "_size_m_h33xh_gg_",
|
|
25
|
+
"_size_l": "_size_l_h33xh_gg_",
|
|
26
|
+
"_theme_invert": "_theme_invert_h33xh_gg_",
|
|
27
|
+
"@loading": "loading_h33xh",
|
|
28
|
+
"_animation": "__animation_h33xh_gg_",
|
|
29
|
+
"_theme_custom": "_theme_custom_h33xh_gg_"
|
|
30
30
|
});
|
|
31
31
|
function isCustomTheme(theme) {
|
|
32
32
|
return !['dark', 'invert'].includes(theme);
|
|
@@ -44,11 +44,13 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
44
44
|
var _this$asProps = this.asProps,
|
|
45
45
|
value = _this$asProps.value,
|
|
46
46
|
duration = _this$asProps.duration,
|
|
47
|
-
size = _this$asProps.size
|
|
47
|
+
size = _this$asProps.size,
|
|
48
|
+
resolveColor = _this$asProps.resolveColor;
|
|
48
49
|
return {
|
|
49
50
|
value: value,
|
|
50
51
|
duration: duration,
|
|
51
|
-
size: size
|
|
52
|
+
size: size,
|
|
53
|
+
resolveColor: resolveColor
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
56
|
}, {
|
|
@@ -62,7 +64,8 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
62
64
|
styles = _this$asProps2.styles,
|
|
63
65
|
duration = _this$asProps2.duration,
|
|
64
66
|
theme = _this$asProps2.theme,
|
|
65
|
-
value = _this$asProps2.value
|
|
67
|
+
value = _this$asProps2.value,
|
|
68
|
+
resolveColor = _this$asProps2.resolveColor;
|
|
66
69
|
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
67
70
|
return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SProgressBar, _ref3.cn("SProgressBar", _objectSpread({}, _assignProps({
|
|
68
71
|
"use:theme": useTheme,
|
|
@@ -78,6 +81,7 @@ var ProgressBarRoot = /*#__PURE__*/function (_Component) {
|
|
|
78
81
|
}(Component);
|
|
79
82
|
_defineProperty(ProgressBarRoot, "displayName", 'ProgressBar');
|
|
80
83
|
_defineProperty(ProgressBarRoot, "style", style);
|
|
84
|
+
_defineProperty(ProgressBarRoot, "enhance", [resolveColorEnhance()]);
|
|
81
85
|
_defineProperty(ProgressBarRoot, "defaultProps", function () {
|
|
82
86
|
return {
|
|
83
87
|
duration: 1000,
|
|
@@ -93,7 +97,8 @@ function Value(props) {
|
|
|
93
97
|
var styles = props.styles,
|
|
94
98
|
value = props.value,
|
|
95
99
|
theme = props.theme,
|
|
96
|
-
duration = props.duration
|
|
100
|
+
duration = props.duration,
|
|
101
|
+
resolveColor = props.resolveColor;
|
|
97
102
|
var width = "".concat(value, "%");
|
|
98
103
|
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SValue, _ref4.cn("SValue", _objectSpread({}, _assignProps2({
|
|
99
104
|
"use:width": width,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","names":["React","createComponent","Component","sstyled","Root","Box","
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","names":["React","createComponent","Component","sstyled","Root","Box","resolveColorEnhance","style","_sstyled","insert","isCustomTheme","theme","includes","ProgressBarRoot","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","getValueProps","_this$asProps","asProps","duration","size","resolveColor","render","_ref","_ref3","SProgressBar","_this$asProps2","Children","styles","useTheme","createElement","cn","_objectSpread","_assignProps","concat","_defineProperty","children","ProgressBar","Value","props","_ref2","arguments[0]","_ref4","SValue","width","_assignProps2"],"sources":["../../src/ProgressBar.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\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 enhance = [resolveColorEnhance()];\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, resolveColor } = this.asProps;\n return {\n value,\n duration,\n size,\n resolveColor,\n };\n }\n\n render() {\n const SProgressBar = Root;\n const { Children, styles, duration, theme, value, resolveColor } = this.asProps;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n return sstyled(styles)(\n <SProgressBar\n render={Box}\n use:theme={useTheme}\n use:animation={!value}\n use:duration={`${duration}ms`}\n colorBg={resolveColor(theme)}\n role='progressbar'\n aria-valuenow={value}\n >\n <Children />\n </SProgressBar>,\n );\n }\n}\n\nfunction Value(props) {\n const SValue = Root;\n const { styles, value, theme, duration, resolveColor } = props;\n const width = `${value}%`;\n\n return sstyled(styles)(\n <SValue\n render={Box}\n use:width={width}\n use:duration={`${duration}ms`}\n colorBg={resolveColor(theme)}\n />,\n );\n}\n\nconst ProgressBar = createComponent(ProgressBarRoot, {\n Value,\n});\n\nexport default ProgressBar;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,mBAAmB,MAAM,iDAAiD;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIlF,SAASC,aAAaA,CAACC,KAAK,EAAE;EAC5B,OAAO,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAACD,KAAK,CAAC;AAC5C;AAAC,IAEKE,eAAe,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,eAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,eAAA;EAAA,SAAAA,gBAAA;IAAAK,eAAA,OAAAL,eAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,eAAA;IAAAS,GAAA;IAAAC,KAAA,EAWnB,SAAAC,cAAA,EAAgB;MACd,IAAAC,aAAA,GAAgD,IAAI,CAACC,OAAO;QAApDH,KAAK,GAAAE,aAAA,CAALF,KAAK;QAAEI,QAAQ,GAAAF,aAAA,CAARE,QAAQ;QAAEC,IAAI,GAAAH,aAAA,CAAJG,IAAI;QAAEC,YAAY,GA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AACP,mBAAmB,EAAE,CAAC;AAAAqC,eAAA,CAHpC9B,eAAe,kBAIG;EAAA,OAAO;IAC3Bc,QAAQ,EAAE,IAAI;IACdC,IAAI,EAAE,GAAG;IACTjB,KAAK,EAAE,QAAQ;IACfiC,QAAQ,eAAE5C,KAAA,CAAAsC,aAAA,CAACO,WAAW,CAACC,KAAK;EAC9B,CAAC;AAAA,CAAC;AAiCJ,SAASA,KAAKA,CAACC,KAAK,EAAE;EAAA,IAAAC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EACpB,IAAMC,MAAM,GAMA9C,GAAG;EALf,IAAQ+B,MAAM,GAA2CW,KAAK,CAAtDX,MAAM;IAAEb,KAAK,GAAoCwB,KAAK,CAA9CxB,KAAK;IAAEZ,KAAK,GAA6BoC,KAAK,CAAvCpC,KAAK;IAAEgB,QAAQ,GAAmBoB,KAAK,CAAhCpB,QAAQ;IAAEE,YAAY,GAAKkB,KAAK,CAAtBlB,YAAY;EACpD,IAAMuB,KAAK,MAAAV,MAAA,CAAMnB,KAAK,MAAG;EAEzB,OAAA2B,KAAA,GAAO/C,OAAO,CAACiC,MAAM,CAAC,eACpBpC,KAAA,CAAAsC,aAAA,CAACa,MAAM,EAAAD,KAAA,CAAAX,EAAA,WAAAC,aAAA,KAAAa,aAAA;IAAA,aAEMD,KAAK;IAAA,mBAAAV,MAAA,CACCf,QAAQ;IAAA,WAChBE,YAAY,CAAClB,KAAK;EAAC,GAAAqC,KAAA,IAC5B;AAEN;AAEA,IAAMH,WAAW,GAAG5C,eAAe,CAACY,eAAe,EAAE;EACnDiC,KAAK,EAALA;AACF,CAAC,CAAC;AAEF,eAAeD,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/progress-bar",
|
|
3
3
|
"description": "Semrush ProgressBar Component",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.9.0-prerelease.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@semcore/flex-box": "5.
|
|
13
|
-
"@semcore/utils": "4.
|
|
12
|
+
"@semcore/flex-box": "5.9.0-prerelease.0",
|
|
13
|
+
"@semcore/utils": "4.9.0-prerelease.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@semcore/core": "^2.
|
|
16
|
+
"@semcore/core": "^2.8.0-prerelease.0",
|
|
17
17
|
"react": "16.8 - 18",
|
|
18
18
|
"react-dom": "16.8 - 18"
|
|
19
19
|
},
|