@rc-component/progress 1.0.0 → 1.0.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/README.md +4 -4
- package/es/Circle/PtgCircle.js +2 -2
- package/es/Circle/index.js +10 -10
- package/es/Line.js +7 -7
- package/es/common.js +2 -2
- package/es/interface.d.ts +2 -2
- package/lib/Circle/PtgCircle.js +2 -3
- package/lib/Circle/index.js +10 -10
- package/lib/Line.js +7 -7
- package/lib/common.js +2 -2
- package/lib/interface.d.ts +2 -2
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -83,16 +83,16 @@ export default () => (
|
|
|
83
83
|
<td>Stroke color.</td>
|
|
84
84
|
</tr>
|
|
85
85
|
<tr>
|
|
86
|
-
<td>
|
|
86
|
+
<td>railWidth</td>
|
|
87
87
|
<td>Number</td>
|
|
88
88
|
<td>1</td>
|
|
89
|
-
<td>Width of the
|
|
89
|
+
<td>Width of the rail stroke. Unit is percentage of SVG canvas size. Rail is always centered relative to actual progress path. If railWidth is not defined, it is the same as strokeWidth.</td>
|
|
90
90
|
</tr>
|
|
91
91
|
<tr>
|
|
92
|
-
<td>
|
|
92
|
+
<td>railColor</td>
|
|
93
93
|
<td>String</td>
|
|
94
94
|
<td>#D9D9D9</td>
|
|
95
|
-
<td>Color for lighter
|
|
95
|
+
<td>Color for lighter rail stroke underneath the actual progress path.</td>
|
|
96
96
|
</tr>
|
|
97
97
|
<tr>
|
|
98
98
|
<td>strokeLinecap</td>
|
package/es/Circle/PtgCircle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
3
|
const Block = ({
|
|
4
4
|
bg,
|
|
5
5
|
children
|
|
@@ -37,7 +37,7 @@ const PtgCircle = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
37
37
|
// ========================== Circle ==========================
|
|
38
38
|
const halfSize = size / 2;
|
|
39
39
|
const circleNode = /*#__PURE__*/React.createElement("circle", {
|
|
40
|
-
className:
|
|
40
|
+
className: clsx(`${prefixCls}-circle-path`, className),
|
|
41
41
|
r: radius,
|
|
42
42
|
cx: halfSize,
|
|
43
43
|
cy: halfSize,
|
package/es/Circle/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
4
|
import { defaultProps, useTransitionDuration } from "../common";
|
|
5
5
|
import useId from "@rc-component/util/es/hooks/useId";
|
|
6
6
|
import PtgCircle from "./PtgCircle";
|
|
@@ -18,10 +18,10 @@ const Circle = props => {
|
|
|
18
18
|
styles = {},
|
|
19
19
|
steps,
|
|
20
20
|
strokeWidth,
|
|
21
|
-
|
|
21
|
+
railWidth,
|
|
22
22
|
gapDegree = 0,
|
|
23
23
|
gapPosition,
|
|
24
|
-
|
|
24
|
+
railColor,
|
|
25
25
|
strokeLinecap,
|
|
26
26
|
style,
|
|
27
27
|
className,
|
|
@@ -59,7 +59,7 @@ const Circle = props => {
|
|
|
59
59
|
id: mergedId,
|
|
60
60
|
loading
|
|
61
61
|
});
|
|
62
|
-
const circleStyle = getCircleStyle(perimeter, perimeterWithoutGap, 0, 100, rotateDeg, gapDegree, gapPosition,
|
|
62
|
+
const circleStyle = getCircleStyle(perimeter, perimeterWithoutGap, 0, 100, rotateDeg, gapDegree, gapPosition, railColor, mergedStrokeLinecap, strokeWidth);
|
|
63
63
|
const paths = useTransitionDuration();
|
|
64
64
|
const getStokeList = () => {
|
|
65
65
|
let stackPtg = 0;
|
|
@@ -101,13 +101,13 @@ const Circle = props => {
|
|
|
101
101
|
const stepPtg = 100 / stepCount;
|
|
102
102
|
let stackPtg = 0;
|
|
103
103
|
return new Array(stepCount).fill(null).map((_, index) => {
|
|
104
|
-
const color = index <= current - 1 ? strokeColorList[0] :
|
|
104
|
+
const color = index <= current - 1 ? strokeColorList[0] : railColor;
|
|
105
105
|
const stroke = color && typeof color === 'object' ? `url(#${gradientId})` : undefined;
|
|
106
106
|
const circleStyleForStack = getCircleStyle(perimeter, perimeterWithoutGap, stackPtg, stepPtg, rotateDeg, gapDegree, gapPosition, color, 'butt', strokeWidth, stepGap);
|
|
107
107
|
stackPtg += (perimeterWithoutGap - circleStyleForStack.strokeDashoffset + stepGap) * 100 / perimeterWithoutGap;
|
|
108
108
|
return /*#__PURE__*/React.createElement("circle", {
|
|
109
109
|
key: index,
|
|
110
|
-
className:
|
|
110
|
+
className: clsx(`${prefixCls}-circle-path`, classNames.track),
|
|
111
111
|
r: radius,
|
|
112
112
|
cx: halfSize,
|
|
113
113
|
cy: halfSize,
|
|
@@ -125,7 +125,7 @@ const Circle = props => {
|
|
|
125
125
|
});
|
|
126
126
|
};
|
|
127
127
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
128
|
-
className:
|
|
128
|
+
className: clsx(`${prefixCls}-circle`, classNames.root, className),
|
|
129
129
|
viewBox: `0 0 ${VIEW_BOX_SIZE} ${VIEW_BOX_SIZE}`,
|
|
130
130
|
style: {
|
|
131
131
|
...styles.root,
|
|
@@ -134,13 +134,13 @@ const Circle = props => {
|
|
|
134
134
|
id: id,
|
|
135
135
|
role: "presentation"
|
|
136
136
|
}, restProps), !stepCount && /*#__PURE__*/React.createElement("circle", {
|
|
137
|
-
className:
|
|
137
|
+
className: clsx(`${prefixCls}-circle-rail`, classNames.rail),
|
|
138
138
|
r: radius,
|
|
139
139
|
cx: halfSize,
|
|
140
140
|
cy: halfSize,
|
|
141
|
-
stroke:
|
|
141
|
+
stroke: railColor,
|
|
142
142
|
strokeLinecap: mergedStrokeLinecap,
|
|
143
|
-
strokeWidth:
|
|
143
|
+
strokeWidth: railWidth || strokeWidth,
|
|
144
144
|
style: {
|
|
145
145
|
...circleStyle,
|
|
146
146
|
...styles.rail
|
package/es/Line.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
4
|
import { useTransitionDuration, defaultProps } from "./common";
|
|
5
5
|
import getIndeterminateLine from "./utils/getIndeterminateLine";
|
|
6
6
|
import useId from "@rc-component/util/es/hooks/useId";
|
|
@@ -14,8 +14,8 @@ const Line = props => {
|
|
|
14
14
|
strokeLinecap,
|
|
15
15
|
strokeWidth,
|
|
16
16
|
style,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
railColor,
|
|
18
|
+
railWidth,
|
|
19
19
|
transition,
|
|
20
20
|
loading,
|
|
21
21
|
...restProps
|
|
@@ -47,16 +47,16 @@ const Line = props => {
|
|
|
47
47
|
strokeWidth
|
|
48
48
|
});
|
|
49
49
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
50
|
-
className:
|
|
50
|
+
className: clsx(`${prefixCls}-line`, className),
|
|
51
51
|
viewBox: viewBoxString,
|
|
52
52
|
preserveAspectRatio: "none",
|
|
53
53
|
style: style
|
|
54
54
|
}, restProps), /*#__PURE__*/React.createElement("path", {
|
|
55
|
-
className: `${prefixCls}-line-
|
|
55
|
+
className: `${prefixCls}-line-rail`,
|
|
56
56
|
d: pathString,
|
|
57
57
|
strokeLinecap: strokeLinecap,
|
|
58
|
-
stroke:
|
|
59
|
-
strokeWidth:
|
|
58
|
+
stroke: railColor,
|
|
59
|
+
strokeWidth: railWidth || strokeWidth,
|
|
60
60
|
fillOpacity: "0"
|
|
61
61
|
}), percentList.map((ptg, index) => {
|
|
62
62
|
let dashPercent = 1;
|
package/es/common.js
CHANGED
package/es/interface.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ export type SemanticName = 'root' | 'rail' | 'track';
|
|
|
3
3
|
export interface ProgressProps {
|
|
4
4
|
id?: string;
|
|
5
5
|
strokeWidth?: number;
|
|
6
|
-
|
|
6
|
+
railWidth?: number;
|
|
7
7
|
className?: string;
|
|
8
8
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
9
9
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
10
10
|
percent?: number | number[];
|
|
11
11
|
strokeColor?: StrokeColorType;
|
|
12
|
-
|
|
12
|
+
railColor?: string;
|
|
13
13
|
strokeLinecap?: StrokeLinecapType;
|
|
14
14
|
prefixCls?: string;
|
|
15
15
|
style?: React.CSSProperties;
|
package/lib/Circle/PtgCircle.js
CHANGED
|
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
+
var _clsx = require("clsx");
|
|
10
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
10
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
11
|
const Block = ({
|
|
@@ -46,7 +45,7 @@ const PtgCircle = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
46
45
|
// ========================== Circle ==========================
|
|
47
46
|
const halfSize = size / 2;
|
|
48
47
|
const circleNode = /*#__PURE__*/React.createElement("circle", {
|
|
49
|
-
className: (0,
|
|
48
|
+
className: (0, _clsx.clsx)(`${prefixCls}-circle-path`, className),
|
|
50
49
|
r: radius,
|
|
51
50
|
cx: halfSize,
|
|
52
51
|
cy: halfSize,
|
package/lib/Circle/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var
|
|
8
|
+
var _clsx = require("clsx");
|
|
9
9
|
var _common = require("../common");
|
|
10
10
|
var _useId = _interopRequireDefault(require("@rc-component/util/lib/hooks/useId"));
|
|
11
11
|
var _PtgCircle = _interopRequireDefault(require("./PtgCircle"));
|
|
@@ -27,10 +27,10 @@ const Circle = props => {
|
|
|
27
27
|
styles = {},
|
|
28
28
|
steps,
|
|
29
29
|
strokeWidth,
|
|
30
|
-
|
|
30
|
+
railWidth,
|
|
31
31
|
gapDegree = 0,
|
|
32
32
|
gapPosition,
|
|
33
|
-
|
|
33
|
+
railColor,
|
|
34
34
|
strokeLinecap,
|
|
35
35
|
style,
|
|
36
36
|
className,
|
|
@@ -68,7 +68,7 @@ const Circle = props => {
|
|
|
68
68
|
id: mergedId,
|
|
69
69
|
loading
|
|
70
70
|
});
|
|
71
|
-
const circleStyle = (0, _util.getCircleStyle)(perimeter, perimeterWithoutGap, 0, 100, rotateDeg, gapDegree, gapPosition,
|
|
71
|
+
const circleStyle = (0, _util.getCircleStyle)(perimeter, perimeterWithoutGap, 0, 100, rotateDeg, gapDegree, gapPosition, railColor, mergedStrokeLinecap, strokeWidth);
|
|
72
72
|
const paths = (0, _common.useTransitionDuration)();
|
|
73
73
|
const getStokeList = () => {
|
|
74
74
|
let stackPtg = 0;
|
|
@@ -110,13 +110,13 @@ const Circle = props => {
|
|
|
110
110
|
const stepPtg = 100 / stepCount;
|
|
111
111
|
let stackPtg = 0;
|
|
112
112
|
return new Array(stepCount).fill(null).map((_, index) => {
|
|
113
|
-
const color = index <= current - 1 ? strokeColorList[0] :
|
|
113
|
+
const color = index <= current - 1 ? strokeColorList[0] : railColor;
|
|
114
114
|
const stroke = color && typeof color === 'object' ? `url(#${gradientId})` : undefined;
|
|
115
115
|
const circleStyleForStack = (0, _util.getCircleStyle)(perimeter, perimeterWithoutGap, stackPtg, stepPtg, rotateDeg, gapDegree, gapPosition, color, 'butt', strokeWidth, stepGap);
|
|
116
116
|
stackPtg += (perimeterWithoutGap - circleStyleForStack.strokeDashoffset + stepGap) * 100 / perimeterWithoutGap;
|
|
117
117
|
return /*#__PURE__*/React.createElement("circle", {
|
|
118
118
|
key: index,
|
|
119
|
-
className: (0,
|
|
119
|
+
className: (0, _clsx.clsx)(`${prefixCls}-circle-path`, classNames.track),
|
|
120
120
|
r: radius,
|
|
121
121
|
cx: halfSize,
|
|
122
122
|
cy: halfSize,
|
|
@@ -134,7 +134,7 @@ const Circle = props => {
|
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
136
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
137
|
-
className: (0,
|
|
137
|
+
className: (0, _clsx.clsx)(`${prefixCls}-circle`, classNames.root, className),
|
|
138
138
|
viewBox: `0 0 ${_util.VIEW_BOX_SIZE} ${_util.VIEW_BOX_SIZE}`,
|
|
139
139
|
style: {
|
|
140
140
|
...styles.root,
|
|
@@ -143,13 +143,13 @@ const Circle = props => {
|
|
|
143
143
|
id: id,
|
|
144
144
|
role: "presentation"
|
|
145
145
|
}, restProps), !stepCount && /*#__PURE__*/React.createElement("circle", {
|
|
146
|
-
className: (0,
|
|
146
|
+
className: (0, _clsx.clsx)(`${prefixCls}-circle-rail`, classNames.rail),
|
|
147
147
|
r: radius,
|
|
148
148
|
cx: halfSize,
|
|
149
149
|
cy: halfSize,
|
|
150
|
-
stroke:
|
|
150
|
+
stroke: railColor,
|
|
151
151
|
strokeLinecap: mergedStrokeLinecap,
|
|
152
|
-
strokeWidth:
|
|
152
|
+
strokeWidth: railWidth || strokeWidth,
|
|
153
153
|
style: {
|
|
154
154
|
...circleStyle,
|
|
155
155
|
...styles.rail
|
package/lib/Line.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var
|
|
8
|
+
var _clsx = require("clsx");
|
|
9
9
|
var _common = require("./common");
|
|
10
10
|
var _getIndeterminateLine = _interopRequireDefault(require("./utils/getIndeterminateLine"));
|
|
11
11
|
var _useId = _interopRequireDefault(require("@rc-component/util/lib/hooks/useId"));
|
|
@@ -23,8 +23,8 @@ const Line = props => {
|
|
|
23
23
|
strokeLinecap,
|
|
24
24
|
strokeWidth,
|
|
25
25
|
style,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
railColor,
|
|
27
|
+
railWidth,
|
|
28
28
|
transition,
|
|
29
29
|
loading,
|
|
30
30
|
...restProps
|
|
@@ -56,16 +56,16 @@ const Line = props => {
|
|
|
56
56
|
strokeWidth
|
|
57
57
|
});
|
|
58
58
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
59
|
-
className: (0,
|
|
59
|
+
className: (0, _clsx.clsx)(`${prefixCls}-line`, className),
|
|
60
60
|
viewBox: viewBoxString,
|
|
61
61
|
preserveAspectRatio: "none",
|
|
62
62
|
style: style
|
|
63
63
|
}, restProps), /*#__PURE__*/React.createElement("path", {
|
|
64
|
-
className: `${prefixCls}-line-
|
|
64
|
+
className: `${prefixCls}-line-rail`,
|
|
65
65
|
d: pathString,
|
|
66
66
|
strokeLinecap: strokeLinecap,
|
|
67
|
-
stroke:
|
|
68
|
-
strokeWidth:
|
|
67
|
+
stroke: railColor,
|
|
68
|
+
strokeWidth: railWidth || strokeWidth,
|
|
69
69
|
fillOpacity: "0"
|
|
70
70
|
}), percentList.map((ptg, index) => {
|
|
71
71
|
let dashPercent = 1;
|
package/lib/common.js
CHANGED
package/lib/interface.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ export type SemanticName = 'root' | 'rail' | 'track';
|
|
|
3
3
|
export interface ProgressProps {
|
|
4
4
|
id?: string;
|
|
5
5
|
strokeWidth?: number;
|
|
6
|
-
|
|
6
|
+
railWidth?: number;
|
|
7
7
|
className?: string;
|
|
8
8
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
9
9
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
10
10
|
percent?: number | number[];
|
|
11
11
|
strokeColor?: StrokeColorType;
|
|
12
|
-
|
|
12
|
+
railColor?: string;
|
|
13
13
|
strokeLinecap?: StrokeLinecapType;
|
|
14
14
|
prefixCls?: string;
|
|
15
15
|
style?: React.CSSProperties;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc-component/progress",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "progress ui component for react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -39,25 +39,20 @@
|
|
|
39
39
|
"coverage": "father test --coverage",
|
|
40
40
|
"now-build": "npm run docs:build"
|
|
41
41
|
},
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"react": ">=16.9.0",
|
|
44
|
-
"react-dom": ">=16.9.0"
|
|
45
|
-
},
|
|
46
42
|
"dependencies": {
|
|
47
43
|
"@rc-component/util": "^1.2.1",
|
|
48
|
-
"
|
|
44
|
+
"clsx": "^2.1.1"
|
|
49
45
|
},
|
|
50
46
|
"devDependencies": {
|
|
51
47
|
"@rc-component/father-plugin": "^2.0.4",
|
|
52
48
|
"@rc-component/np": "^1.0.4",
|
|
53
49
|
"@testing-library/react": "^13.0.0",
|
|
54
|
-
"@types/classnames": "^2.2.9",
|
|
55
50
|
"@types/jest": "^29.4.0",
|
|
56
51
|
"@types/keyv": "3.1.4",
|
|
52
|
+
"@types/node": "^24.5.2",
|
|
57
53
|
"@types/react": "^18.0.9",
|
|
58
54
|
"@types/react-dom": "^18.0.3",
|
|
59
55
|
"@umijs/fabric": "^3.0.0",
|
|
60
|
-
"cross-env": "^7.0.0",
|
|
61
56
|
"dumi": "^2.0.0",
|
|
62
57
|
"eslint": "^8.57.0",
|
|
63
58
|
"eslint-plugin-jest": "^27.6.0",
|
|
@@ -69,5 +64,9 @@
|
|
|
69
64
|
"react": "^18.0.0",
|
|
70
65
|
"react-dom": "^18.0.0",
|
|
71
66
|
"typescript": "^5.0.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"react": ">=16.9.0",
|
|
70
|
+
"react-dom": ">=16.9.0"
|
|
72
71
|
}
|
|
73
72
|
}
|