@quantabit/progress-sdk 1.0.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/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/index.cjs +151 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.esm.js +142 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/styles.css.map +1 -0
- package/package.json +69 -0
- package/types/index.d.ts +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 QuantaBit Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @quantabit/progress-sdk
|
|
2
|
+
|
|
3
|
+
> Linear and circular progress indicators
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
- **ProgressBar** — Linear bar with gradient, stripe, label
|
|
7
|
+
- **CircleProgress** — SVG circular progress ring
|
|
8
|
+
- **useProgress** — Hook with increment/decrement/percent
|
|
9
|
+
|
|
10
|
+
```jsx
|
|
11
|
+
import { ProgressBar, CircleProgress } from '@quantabit/progress-sdk';
|
|
12
|
+
<ProgressBar value={75} showLabel striped/>
|
|
13
|
+
<CircleProgress value={85} color="#22c55e"/>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## License
|
|
17
|
+
MIT
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🌐 Brand & Links
|
|
24
|
+
- Official Mainnet: [QuantaBit Chain](https://qbitchain.io/)
|
|
25
|
+
- Developer Platform: [Developer Platform](https://developer.quantabit.io/)
|
|
26
|
+
- Open Platform: [Open Platform](https://open.quantabit.io/)
|
|
27
|
+
- Payment Platform: [Pay Platform](https://pay.qbitwallet.io/)
|
|
28
|
+
- Feedback: [Feedback](https://xwin.live/qbit)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function ProgressBar({
|
|
6
|
+
value = 0,
|
|
7
|
+
max = 100,
|
|
8
|
+
height = 8,
|
|
9
|
+
color = '#3b82f6',
|
|
10
|
+
showLabel = false,
|
|
11
|
+
animated = true,
|
|
12
|
+
striped = false,
|
|
13
|
+
className = ''
|
|
14
|
+
}) {
|
|
15
|
+
const pct = Math.min(100, Math.max(0, value / max * 100));
|
|
16
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
className: `qp-bar ${className}`
|
|
18
|
+
}, showLabel && /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
style: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
justifyContent: 'space-between',
|
|
22
|
+
fontSize: 12,
|
|
23
|
+
color: '#71717a',
|
|
24
|
+
marginBottom: 4
|
|
25
|
+
}
|
|
26
|
+
}, /*#__PURE__*/React.createElement("span", null, Math.round(pct), "%")), /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
style: {
|
|
28
|
+
height,
|
|
29
|
+
borderRadius: height,
|
|
30
|
+
background: 'rgba(128,128,128,0.1)',
|
|
31
|
+
overflow: 'hidden'
|
|
32
|
+
}
|
|
33
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: `qp-fill ${striped ? 'qp-striped' : ''}`,
|
|
35
|
+
style: {
|
|
36
|
+
height: '100%',
|
|
37
|
+
width: pct + '%',
|
|
38
|
+
borderRadius: height,
|
|
39
|
+
background: typeof color === 'string' && color.includes(',') ? `linear-gradient(90deg,${color})` : color,
|
|
40
|
+
transition: animated ? 'width 0.6s ease' : 'none'
|
|
41
|
+
}
|
|
42
|
+
})));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function CircleProgress({
|
|
46
|
+
value = 0,
|
|
47
|
+
max = 100,
|
|
48
|
+
size = 80,
|
|
49
|
+
strokeWidth = 6,
|
|
50
|
+
color = '#3b82f6',
|
|
51
|
+
trackColor = 'rgba(128,128,128,0.1)',
|
|
52
|
+
showValue = true,
|
|
53
|
+
children,
|
|
54
|
+
className = ''
|
|
55
|
+
}) {
|
|
56
|
+
const pct = Math.min(100, Math.max(0, value / max * 100));
|
|
57
|
+
const r = (size - strokeWidth) / 2;
|
|
58
|
+
const circ = 2 * Math.PI * r;
|
|
59
|
+
const offset = circ - pct / 100 * circ;
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: `qp-circle ${className}`,
|
|
62
|
+
style: {
|
|
63
|
+
position: 'relative',
|
|
64
|
+
width: size,
|
|
65
|
+
height: size,
|
|
66
|
+
display: 'inline-flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
justifyContent: 'center'
|
|
69
|
+
}
|
|
70
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
71
|
+
width: size,
|
|
72
|
+
height: size,
|
|
73
|
+
style: {
|
|
74
|
+
transform: 'rotate(-90deg)'
|
|
75
|
+
}
|
|
76
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
77
|
+
cx: size / 2,
|
|
78
|
+
cy: size / 2,
|
|
79
|
+
r: r,
|
|
80
|
+
fill: "none",
|
|
81
|
+
stroke: trackColor,
|
|
82
|
+
strokeWidth: strokeWidth
|
|
83
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
84
|
+
cx: size / 2,
|
|
85
|
+
cy: size / 2,
|
|
86
|
+
r: r,
|
|
87
|
+
fill: "none",
|
|
88
|
+
stroke: color,
|
|
89
|
+
strokeWidth: strokeWidth,
|
|
90
|
+
strokeLinecap: "round",
|
|
91
|
+
strokeDasharray: circ,
|
|
92
|
+
strokeDashoffset: offset,
|
|
93
|
+
style: {
|
|
94
|
+
transition: 'stroke-dashoffset 0.6s ease'
|
|
95
|
+
}
|
|
96
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
style: {
|
|
98
|
+
position: 'absolute',
|
|
99
|
+
fontSize: size * 0.22,
|
|
100
|
+
fontWeight: 700,
|
|
101
|
+
color: '#18181b'
|
|
102
|
+
}
|
|
103
|
+
}, children || showValue && Math.round(pct) + '%'));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function useProgress(initial = 0, max = 100) {
|
|
107
|
+
const [value, setValue] = React.useState(initial);
|
|
108
|
+
const increment = React.useCallback(n => setValue(v => Math.min(max, v + (n || 1))), [max]);
|
|
109
|
+
const decrement = React.useCallback(n => setValue(v => Math.max(0, v - (n || 1))), []);
|
|
110
|
+
const reset = React.useCallback(() => setValue(0), []);
|
|
111
|
+
const complete = React.useCallback(() => setValue(max), [max]);
|
|
112
|
+
const setPercent = React.useCallback(pct => setValue(Math.round(pct / 100 * max)), [max]);
|
|
113
|
+
return {
|
|
114
|
+
value,
|
|
115
|
+
setValue,
|
|
116
|
+
increment,
|
|
117
|
+
decrement,
|
|
118
|
+
reset,
|
|
119
|
+
complete,
|
|
120
|
+
setPercent,
|
|
121
|
+
percent: Math.round(value / max * 100)
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];
|
|
126
|
+
const messages = {
|
|
127
|
+
en: {},
|
|
128
|
+
zh: {},
|
|
129
|
+
ja: {},
|
|
130
|
+
ko: {}
|
|
131
|
+
};
|
|
132
|
+
let currentLang = 'en';
|
|
133
|
+
function setLanguage(l) {
|
|
134
|
+
if (SUPPORTED_LANGUAGES.includes(l)) currentLang = l;
|
|
135
|
+
}
|
|
136
|
+
function getLanguage() {
|
|
137
|
+
return currentLang;
|
|
138
|
+
}
|
|
139
|
+
function t(k) {
|
|
140
|
+
return messages[currentLang]?.[k] || messages.en?.[k] || k;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
exports.CircleProgress = CircleProgress;
|
|
144
|
+
exports.ProgressBar = ProgressBar;
|
|
145
|
+
exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
|
|
146
|
+
exports.getLanguage = getLanguage;
|
|
147
|
+
exports.messages = messages;
|
|
148
|
+
exports.setLanguage = setLanguage;
|
|
149
|
+
exports.t = t;
|
|
150
|
+
exports.useProgress = useProgress;
|
|
151
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/components/ProgressBar.jsx","../src/components/CircleProgress.jsx","../src/hooks/useProgress.js","../src/i18n/index.js"],"sourcesContent":["import React from'react';\nexport function ProgressBar({value=0,max=100,height=8,color='#3b82f6',showLabel=false,animated=true,striped=false,className=''}){\n const pct=Math.min(100,Math.max(0,(value/max)*100));\n return(<div className={`qp-bar ${className}`}>\n {showLabel&&<div style={{display:'flex',justifyContent:'space-between',fontSize:12,color:'#71717a',marginBottom:4}}>\n <span>{Math.round(pct)}%</span></div>}\n <div style={{height,borderRadius:height,background:'rgba(128,128,128,0.1)',overflow:'hidden'}}>\n <div className={`qp-fill ${striped?'qp-striped':''}`} style={{height:'100%',width:pct+'%',borderRadius:height,\n background:typeof color==='string'&&color.includes(',')?`linear-gradient(90deg,${color})`:color,\n transition:animated?'width 0.6s ease':'none'}}/>\n </div>\n </div>);\n}\n","import React from'react';\nexport function CircleProgress({value=0,max=100,size=80,strokeWidth=6,color='#3b82f6',trackColor='rgba(128,128,128,0.1)',\n showValue=true,children,className=''}){\n const pct=Math.min(100,Math.max(0,(value/max)*100));\n const r=(size-strokeWidth)/2;const circ=2*Math.PI*r;const offset=circ-(pct/100)*circ;\n return(<div className={`qp-circle ${className}`} style={{position:'relative',width:size,height:size,display:'inline-flex',alignItems:'center',justifyContent:'center'}}>\n <svg width={size} height={size} style={{transform:'rotate(-90deg)'}}>\n <circle cx={size/2} cy={size/2} r={r} fill=\"none\" stroke={trackColor} strokeWidth={strokeWidth}/>\n <circle cx={size/2} cy={size/2} r={r} fill=\"none\" stroke={color} strokeWidth={strokeWidth}\n strokeLinecap=\"round\" strokeDasharray={circ} strokeDashoffset={offset}\n style={{transition:'stroke-dashoffset 0.6s ease'}}/>\n </svg>\n <div style={{position:'absolute',fontSize:size*0.22,fontWeight:700,color:'#18181b'}}>\n {children||showValue&&Math.round(pct)+'%'}\n </div>\n </div>);\n}\n","import{useState,useCallback}from'react';\nexport function useProgress(initial=0,max=100){\n const[value,setValue]=useState(initial);\n const increment=useCallback(n=>setValue(v=>Math.min(max,v+(n||1))),[max]);\n const decrement=useCallback(n=>setValue(v=>Math.max(0,v-(n||1))),[]);\n const reset=useCallback(()=>setValue(0),[]);\n const complete=useCallback(()=>setValue(max),[max]);\n const setPercent=useCallback(pct=>setValue(Math.round((pct/100)*max)),[max]);\n return{value,setValue,increment,decrement,reset,complete,setPercent,percent:Math.round((value/max)*100)};\n}\n","export const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];\nexport const messages = {\n en: {},\n zh: {},\n ja: {},\n ko: {}\n};\nlet currentLang = 'en';\nexport function setLanguage(l) { if (SUPPORTED_LANGUAGES.includes(l)) currentLang = l; }\nexport function getLanguage() { return currentLang; }\nexport function t(k) { return messages[currentLang]?.[k] || messages.en?.[k] || k; }\n"],"names":["ProgressBar","value","max","height","color","showLabel","animated","striped","className","pct","Math","min","React","createElement","style","display","justifyContent","fontSize","marginBottom","round","borderRadius","background","overflow","width","includes","transition","CircleProgress","size","strokeWidth","trackColor","showValue","children","r","circ","PI","offset","position","alignItems","transform","cx","cy","fill","stroke","strokeLinecap","strokeDasharray","strokeDashoffset","fontWeight","useProgress","initial","setValue","useState","increment","useCallback","n","v","decrement","reset","complete","setPercent","percent","SUPPORTED_LANGUAGES","messages","en","zh","ja","ko","currentLang","setLanguage","l","getLanguage","t","k"],"mappings":";;;;AACO,SAASA,WAAWA,CAAC;AAACC,EAAAA,KAAK,GAAC,CAAC;AAACC,EAAAA,GAAG,GAAC,GAAG;AAACC,EAAAA,MAAM,GAAC,CAAC;AAACC,EAAAA,KAAK,GAAC,SAAS;AAACC,EAAAA,SAAS,GAAC,KAAK;AAACC,EAAAA,QAAQ,GAAC,IAAI;AAACC,EAAAA,OAAO,GAAC,KAAK;AAACC,EAAAA,SAAS,GAAC;AAAE,CAAC,EAAC;EAC9H,MAAMC,GAAG,GAACC,IAAI,CAACC,GAAG,CAAC,GAAG,EAACD,IAAI,CAACR,GAAG,CAAC,CAAC,EAAED,KAAK,GAACC,GAAG,GAAE,GAAG,CAAC,CAAC;EACnD,oBAAOU,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;IAAKL,SAAS,EAAE,UAAUA,SAAS,CAAA;AAAG,GAAA,EAC1CH,SAAS,iBAAEO,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAK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 -0,0 +1,142 @@
|
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
function ProgressBar({
|
|
4
|
+
value = 0,
|
|
5
|
+
max = 100,
|
|
6
|
+
height = 8,
|
|
7
|
+
color = '#3b82f6',
|
|
8
|
+
showLabel = false,
|
|
9
|
+
animated = true,
|
|
10
|
+
striped = false,
|
|
11
|
+
className = ''
|
|
12
|
+
}) {
|
|
13
|
+
const pct = Math.min(100, Math.max(0, value / max * 100));
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: `qp-bar ${className}`
|
|
16
|
+
}, showLabel && /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
style: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
fontSize: 12,
|
|
21
|
+
color: '#71717a',
|
|
22
|
+
marginBottom: 4
|
|
23
|
+
}
|
|
24
|
+
}, /*#__PURE__*/React.createElement("span", null, Math.round(pct), "%")), /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
style: {
|
|
26
|
+
height,
|
|
27
|
+
borderRadius: height,
|
|
28
|
+
background: 'rgba(128,128,128,0.1)',
|
|
29
|
+
overflow: 'hidden'
|
|
30
|
+
}
|
|
31
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: `qp-fill ${striped ? 'qp-striped' : ''}`,
|
|
33
|
+
style: {
|
|
34
|
+
height: '100%',
|
|
35
|
+
width: pct + '%',
|
|
36
|
+
borderRadius: height,
|
|
37
|
+
background: typeof color === 'string' && color.includes(',') ? `linear-gradient(90deg,${color})` : color,
|
|
38
|
+
transition: animated ? 'width 0.6s ease' : 'none'
|
|
39
|
+
}
|
|
40
|
+
})));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function CircleProgress({
|
|
44
|
+
value = 0,
|
|
45
|
+
max = 100,
|
|
46
|
+
size = 80,
|
|
47
|
+
strokeWidth = 6,
|
|
48
|
+
color = '#3b82f6',
|
|
49
|
+
trackColor = 'rgba(128,128,128,0.1)',
|
|
50
|
+
showValue = true,
|
|
51
|
+
children,
|
|
52
|
+
className = ''
|
|
53
|
+
}) {
|
|
54
|
+
const pct = Math.min(100, Math.max(0, value / max * 100));
|
|
55
|
+
const r = (size - strokeWidth) / 2;
|
|
56
|
+
const circ = 2 * Math.PI * r;
|
|
57
|
+
const offset = circ - pct / 100 * circ;
|
|
58
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: `qp-circle ${className}`,
|
|
60
|
+
style: {
|
|
61
|
+
position: 'relative',
|
|
62
|
+
width: size,
|
|
63
|
+
height: size,
|
|
64
|
+
display: 'inline-flex',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
justifyContent: 'center'
|
|
67
|
+
}
|
|
68
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
69
|
+
width: size,
|
|
70
|
+
height: size,
|
|
71
|
+
style: {
|
|
72
|
+
transform: 'rotate(-90deg)'
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
75
|
+
cx: size / 2,
|
|
76
|
+
cy: size / 2,
|
|
77
|
+
r: r,
|
|
78
|
+
fill: "none",
|
|
79
|
+
stroke: trackColor,
|
|
80
|
+
strokeWidth: strokeWidth
|
|
81
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
82
|
+
cx: size / 2,
|
|
83
|
+
cy: size / 2,
|
|
84
|
+
r: r,
|
|
85
|
+
fill: "none",
|
|
86
|
+
stroke: color,
|
|
87
|
+
strokeWidth: strokeWidth,
|
|
88
|
+
strokeLinecap: "round",
|
|
89
|
+
strokeDasharray: circ,
|
|
90
|
+
strokeDashoffset: offset,
|
|
91
|
+
style: {
|
|
92
|
+
transition: 'stroke-dashoffset 0.6s ease'
|
|
93
|
+
}
|
|
94
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
style: {
|
|
96
|
+
position: 'absolute',
|
|
97
|
+
fontSize: size * 0.22,
|
|
98
|
+
fontWeight: 700,
|
|
99
|
+
color: '#18181b'
|
|
100
|
+
}
|
|
101
|
+
}, children || showValue && Math.round(pct) + '%'));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function useProgress(initial = 0, max = 100) {
|
|
105
|
+
const [value, setValue] = useState(initial);
|
|
106
|
+
const increment = useCallback(n => setValue(v => Math.min(max, v + (n || 1))), [max]);
|
|
107
|
+
const decrement = useCallback(n => setValue(v => Math.max(0, v - (n || 1))), []);
|
|
108
|
+
const reset = useCallback(() => setValue(0), []);
|
|
109
|
+
const complete = useCallback(() => setValue(max), [max]);
|
|
110
|
+
const setPercent = useCallback(pct => setValue(Math.round(pct / 100 * max)), [max]);
|
|
111
|
+
return {
|
|
112
|
+
value,
|
|
113
|
+
setValue,
|
|
114
|
+
increment,
|
|
115
|
+
decrement,
|
|
116
|
+
reset,
|
|
117
|
+
complete,
|
|
118
|
+
setPercent,
|
|
119
|
+
percent: Math.round(value / max * 100)
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];
|
|
124
|
+
const messages = {
|
|
125
|
+
en: {},
|
|
126
|
+
zh: {},
|
|
127
|
+
ja: {},
|
|
128
|
+
ko: {}
|
|
129
|
+
};
|
|
130
|
+
let currentLang = 'en';
|
|
131
|
+
function setLanguage(l) {
|
|
132
|
+
if (SUPPORTED_LANGUAGES.includes(l)) currentLang = l;
|
|
133
|
+
}
|
|
134
|
+
function getLanguage() {
|
|
135
|
+
return currentLang;
|
|
136
|
+
}
|
|
137
|
+
function t(k) {
|
|
138
|
+
return messages[currentLang]?.[k] || messages.en?.[k] || k;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { CircleProgress, ProgressBar, SUPPORTED_LANGUAGES, getLanguage, messages, setLanguage, t, useProgress };
|
|
142
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/ProgressBar.jsx","../src/components/CircleProgress.jsx","../src/hooks/useProgress.js","../src/i18n/index.js"],"sourcesContent":["import React from'react';\nexport function ProgressBar({value=0,max=100,height=8,color='#3b82f6',showLabel=false,animated=true,striped=false,className=''}){\n const pct=Math.min(100,Math.max(0,(value/max)*100));\n return(<div className={`qp-bar ${className}`}>\n {showLabel&&<div style={{display:'flex',justifyContent:'space-between',fontSize:12,color:'#71717a',marginBottom:4}}>\n <span>{Math.round(pct)}%</span></div>}\n <div style={{height,borderRadius:height,background:'rgba(128,128,128,0.1)',overflow:'hidden'}}>\n <div className={`qp-fill ${striped?'qp-striped':''}`} style={{height:'100%',width:pct+'%',borderRadius:height,\n background:typeof color==='string'&&color.includes(',')?`linear-gradient(90deg,${color})`:color,\n transition:animated?'width 0.6s ease':'none'}}/>\n </div>\n </div>);\n}\n","import React from'react';\nexport function CircleProgress({value=0,max=100,size=80,strokeWidth=6,color='#3b82f6',trackColor='rgba(128,128,128,0.1)',\n showValue=true,children,className=''}){\n const pct=Math.min(100,Math.max(0,(value/max)*100));\n const r=(size-strokeWidth)/2;const circ=2*Math.PI*r;const offset=circ-(pct/100)*circ;\n return(<div className={`qp-circle ${className}`} style={{position:'relative',width:size,height:size,display:'inline-flex',alignItems:'center',justifyContent:'center'}}>\n <svg width={size} height={size} style={{transform:'rotate(-90deg)'}}>\n <circle cx={size/2} cy={size/2} r={r} fill=\"none\" stroke={trackColor} strokeWidth={strokeWidth}/>\n <circle cx={size/2} cy={size/2} r={r} fill=\"none\" stroke={color} strokeWidth={strokeWidth}\n strokeLinecap=\"round\" strokeDasharray={circ} strokeDashoffset={offset}\n style={{transition:'stroke-dashoffset 0.6s ease'}}/>\n </svg>\n <div style={{position:'absolute',fontSize:size*0.22,fontWeight:700,color:'#18181b'}}>\n {children||showValue&&Math.round(pct)+'%'}\n </div>\n </div>);\n}\n","import{useState,useCallback}from'react';\nexport function useProgress(initial=0,max=100){\n const[value,setValue]=useState(initial);\n const increment=useCallback(n=>setValue(v=>Math.min(max,v+(n||1))),[max]);\n const decrement=useCallback(n=>setValue(v=>Math.max(0,v-(n||1))),[]);\n const reset=useCallback(()=>setValue(0),[]);\n const complete=useCallback(()=>setValue(max),[max]);\n const setPercent=useCallback(pct=>setValue(Math.round((pct/100)*max)),[max]);\n return{value,setValue,increment,decrement,reset,complete,setPercent,percent:Math.round((value/max)*100)};\n}\n","export const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];\nexport const messages = {\n en: {},\n zh: {},\n ja: {},\n ko: {}\n};\nlet currentLang = 'en';\nexport function setLanguage(l) { if (SUPPORTED_LANGUAGES.includes(l)) currentLang = l; }\nexport function getLanguage() { return currentLang; }\nexport function t(k) { return messages[currentLang]?.[k] || messages.en?.[k] || k; }\n"],"names":["ProgressBar","value","max","height","color","showLabel","animated","striped","className","pct","Math","min","React","createElement","style","display","justifyContent","fontSize","marginBottom","round","borderRadius","background","overflow","width","includes","transition","CircleProgress","size","strokeWidth","trackColor","showValue","children","r","circ","PI","offset","position","alignItems","transform","cx","cy","fill","stroke","strokeLinecap","strokeDasharray","strokeDashoffset","fontWeight","useProgress","initial","setValue","useState","increment","useCallback","n","v","decrement","reset","complete","setPercent","percent","SUPPORTED_LANGUAGES","messages","en","zh","ja","ko","currentLang","setLanguage","l","getLanguage","t","k"],"mappings":";;AACO,SAASA,WAAWA,CAAC;AAACC,EAAAA,KAAK,GAAC,CAAC;AAACC,EAAAA,GAAG,GAAC,GAAG;AAACC,EAAAA,MAAM,GAAC,CAAC;AAACC,EAAAA,KAAK,GAAC,SAAS;AAACC,EAAAA,SAAS,GAAC,KAAK;AAACC,EAAAA,QAAQ,GAAC,IAAI;AAACC,EAAAA,OAAO,GAAC,KAAK;AAACC,EAAAA,SAAS,GAAC;AAAE,CAAC,EAAC;EAC9H,MAAMC,GAAG,GAACC,IAAI,CAACC,GAAG,CAAC,GAAG,EAACD,IAAI,CAACR,GAAG,CAAC,C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EAAA,OAAOH,WAAW;AAAE;AAC7C,SAASI,CAACA,CAACC,CAAC,EAAE;AAAE,EAAA,OAAOV,QAAQ,CAACK,WAAW,CAAC,GAAGK,CAAC,CAAC,IAAIV,QAAQ,CAACC,EAAE,GAAGS,CAAC,CAAC,IAAIA,CAAC;AAAE;;;;"}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@keyframes qp-stripe{0%{background-position:0 0}to{background-position:40px 0}}.qp-striped{animation:qp-stripe 1s linear infinite;background-image:linear-gradient(45deg,hsla(0,0%,100%,.15) 25%,transparent 25%,transparent 50%,hsla(0,0%,100%,.15) 50%,hsla(0,0%,100%,.15) 75%,transparent 75%,transparent)!important;background-size:40px 40px}
|
|
2
|
+
/*# sourceMappingURL=styles.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["progress.css"],"names":[],"mappings":"AAAA,qBAAqB,GAAK,uBAAuB,CAAC,GAAG,0BAA0B,CAAC,CAChF,YAAkO,sCAAA,CAAtN,qLAA2L,CAAC,yBAAgE","file":"styles.css","sourcesContent":["@keyframes qp-stripe{from{background-position:0 0}to{background-position:40px 0}}\n.qp-striped{background-image:linear-gradient(45deg,rgba(255,255,255,0.15)25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15)50%,rgba(255,255,255,0.15)75%,transparent 75%,transparent)!important;background-size:40px 40px;animation:qp-stripe 1s linear infinite}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quantabit/progress-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Linear and circular progress indicators",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./types/index.d.ts",
|
|
12
|
+
"import": "./dist/index.esm.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"types",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "rollup -c",
|
|
24
|
+
"dev": "rollup -c -w",
|
|
25
|
+
"test": "jest --passWithNoTests",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/quantabit-chain/qbit-sdk.git",
|
|
31
|
+
"directory": "packages/progress-sdk"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"progress",
|
|
35
|
+
"progress-bar",
|
|
36
|
+
"circle",
|
|
37
|
+
"react"
|
|
38
|
+
],
|
|
39
|
+
"author": "QuantaBit Team",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=18.0.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=17.0.0",
|
|
46
|
+
"react-dom": ">=17.0.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@quantabit/sdk-config": "^1.0.6"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/quantabit-chain/qbit-sdk/tree/main/packages/progress-sdk",
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/quantabit-chain/qbit-sdk/issues"
|
|
57
|
+
},
|
|
58
|
+
"sideEffects": [
|
|
59
|
+
"*.css"
|
|
60
|
+
],
|
|
61
|
+
"qbit": {
|
|
62
|
+
"privacy": {
|
|
63
|
+
"level": "functional",
|
|
64
|
+
"dataCollection": "Feature-related data for personalization. Requires user consent.",
|
|
65
|
+
"gdprCompliant": true,
|
|
66
|
+
"ccpaCompliant": true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @quantabit/progress-sdk TypeScript Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Auto-generated type stubs. Enhance with specific types as the SDK matures.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { FC, ReactNode } from 'react';
|
|
8
|
+
|
|
9
|
+
// ============ Components ============
|
|
10
|
+
|
|
11
|
+
export interface ProgressBarProps {
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare const ProgressBar: FC<ProgressBarProps>;
|
|
18
|
+
|
|
19
|
+
export interface CircleProgressProps {
|
|
20
|
+
className?: string;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export declare const CircleProgress: FC<CircleProgressProps>;
|
|
26
|
+
|
|
27
|
+
// ============ Hooks ============
|
|
28
|
+
|
|
29
|
+
export interface UseProgressReturn {
|
|
30
|
+
data: any;
|
|
31
|
+
loading: boolean;
|
|
32
|
+
error: string | null;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export declare function useProgress(...args: any[]): UseProgressReturn;
|
|
37
|
+
|
|
38
|
+
// ============ Functions & Utilities ============
|
|
39
|
+
|
|
40
|
+
export declare const messages: Record<string, Record<string, string>>;
|
|
41
|
+
export declare const SUPPORTED_LANGUAGES: string[];
|
|
42
|
+
export declare function setLanguage(lang: string): void;
|
|
43
|
+
export declare function getLanguage(): string;
|
|
44
|
+
export declare function t(key: string, params?: Record<string, any>): string;
|
|
45
|
+
|