@easy-editor/materials-dashboard-progress 0.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/.vite/plugins/vite-plugin-external-deps.ts +224 -0
- package/.vite/plugins/vite-plugin-material-dev.ts +218 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +9 -0
- package/dist/component.esm.js +257 -0
- package/dist/component.esm.js.map +1 -0
- package/dist/component.js +265 -0
- package/dist/component.js.map +1 -0
- package/dist/component.min.js +2 -0
- package/dist/component.min.js.map +1 -0
- package/dist/index.cjs +560 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.esm.js +557 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +564 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/dist/meta.esm.js +304 -0
- package/dist/meta.esm.js.map +1 -0
- package/dist/meta.js +315 -0
- package/dist/meta.js.map +1 -0
- package/dist/meta.min.js +2 -0
- package/dist/meta.min.js.map +1 -0
- package/dist/src/component.d.ts +36 -0
- package/dist/src/configure.d.ts +7 -0
- package/dist/src/constants.d.ts +36 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/meta.d.ts +7 -0
- package/dist/src/snippets.d.ts +7 -0
- package/package.json +66 -0
- package/rollup.config.js +212 -0
- package/src/component.module.css +89 -0
- package/src/component.tsx +262 -0
- package/src/configure.ts +265 -0
- package/src/constants.ts +43 -0
- package/src/index.tsx +7 -0
- package/src/meta.ts +28 -0
- package/src/snippets.ts +60 -0
- package/src/type.d.ts +8 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +9 -0
- package/tsconfig.test.json +7 -0
- package/vite.config.ts +54 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/* @easy-editor/materials-dashboard-progress-ring v0.0.1 (component, esm) */
|
|
2
|
+
import { useId, useRef, useState, useEffect } from 'react';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function styleInject(css, ref) {
|
|
6
|
+
if (ref === void 0) ref = {};
|
|
7
|
+
var insertAt = ref.insertAt;
|
|
8
|
+
if (typeof document === 'undefined') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
12
|
+
var style = document.createElement('style');
|
|
13
|
+
style.type = 'text/css';
|
|
14
|
+
if (insertAt === 'top') {
|
|
15
|
+
if (head.firstChild) {
|
|
16
|
+
head.insertBefore(style, head.firstChild);
|
|
17
|
+
} else {
|
|
18
|
+
head.appendChild(style);
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
head.appendChild(style);
|
|
22
|
+
}
|
|
23
|
+
if (style.styleSheet) {
|
|
24
|
+
style.styleSheet.cssText = css;
|
|
25
|
+
} else {
|
|
26
|
+
style.appendChild(document.createTextNode(css));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var css_248z = ".component-module__container___VbZSk,.component-module__wrapper___IYMoW{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.component-module__container___VbZSk{position:relative}.component-module__ring___QkEHa{transform:rotate(-90deg)}.component-module__centerContent___Ri3R3{align-items:center;display:flex;flex-direction:column;justify-content:center;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%)}.component-module__value___Fg70k{font-weight:700;line-height:1.1}.component-module__label___6IHVo{color:#fff;margin-top:4px;opacity:.7}.component-module__barContainer___AOTls{display:flex;flex-direction:column;gap:4px;height:100%;justify-content:center;width:100%}.component-module__barWrapper___cni-a{border-radius:4px;flex:1;max-height:8px;min-height:8px;overflow:hidden;width:100%}.component-module__barFill___KZkJe{border-radius:4px;height:100%;transition:width .5s ease}.component-module__barLabels___BvaEi{align-items:center;display:flex;justify-content:space-between}.component-module__barLabel___wVaWe{color:hsla(0,0%,100%,.7);font-size:12px}.component-module__barValue___H2muu{font-size:14px;font-weight:600}";
|
|
31
|
+
var styles = {"wrapper":"component-module__wrapper___IYMoW","container":"component-module__container___VbZSk","ring":"component-module__ring___QkEHa","centerContent":"component-module__centerContent___Ri3R3","value":"component-module__value___Fg70k","label":"component-module__label___6IHVo","barContainer":"component-module__barContainer___AOTls","barWrapper":"component-module__barWrapper___cni-a","barFill":"component-module__barFill___KZkJe","barLabels":"component-module__barLabels___BvaEi","barLabel":"component-module__barLabel___wVaWe","barValue":"component-module__barValue___H2muu"};
|
|
32
|
+
styleInject(css_248z);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Progress Component
|
|
36
|
+
* 进度组件 - 支持环形和线性进度条
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
// 格式化数值
|
|
40
|
+
const formatValue = (value, percentage, valueFormat) => {
|
|
41
|
+
if (valueFormat === 'percent') {
|
|
42
|
+
return `${Math.round(percentage)}%`;
|
|
43
|
+
}
|
|
44
|
+
return `${value}`;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// 环形进度条组件
|
|
48
|
+
const RingProgress = ({
|
|
49
|
+
percentage,
|
|
50
|
+
strokeWidthRatio,
|
|
51
|
+
trackColor,
|
|
52
|
+
progressColor,
|
|
53
|
+
gradientEnable,
|
|
54
|
+
gradientColors,
|
|
55
|
+
showValue,
|
|
56
|
+
showLabel,
|
|
57
|
+
label,
|
|
58
|
+
valueFormat,
|
|
59
|
+
displayColor,
|
|
60
|
+
gradientId
|
|
61
|
+
}) => {
|
|
62
|
+
const containerRef = useRef(null);
|
|
63
|
+
const [size, setSize] = useState(100);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const container = containerRef.current;
|
|
66
|
+
if (!container) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const updateSize = () => {
|
|
70
|
+
const {
|
|
71
|
+
width,
|
|
72
|
+
height
|
|
73
|
+
} = container.getBoundingClientRect();
|
|
74
|
+
const minSize = Math.min(width, height);
|
|
75
|
+
if (minSize > 0) {
|
|
76
|
+
setSize(minSize);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
updateSize();
|
|
80
|
+
const resizeObserver = new ResizeObserver(updateSize);
|
|
81
|
+
resizeObserver.observe(container);
|
|
82
|
+
return () => resizeObserver.disconnect();
|
|
83
|
+
}, []);
|
|
84
|
+
const strokeWidth = Math.max(2, size * strokeWidthRatio);
|
|
85
|
+
const radius = (size - strokeWidth) / 2;
|
|
86
|
+
const circumference = 2 * Math.PI * radius;
|
|
87
|
+
const strokeDashoffset = circumference - percentage / 100 * circumference;
|
|
88
|
+
const center = size / 2;
|
|
89
|
+
return /*#__PURE__*/jsxs("div", {
|
|
90
|
+
className: styles.container,
|
|
91
|
+
ref: containerRef,
|
|
92
|
+
children: [/*#__PURE__*/jsxs("svg", {
|
|
93
|
+
"aria-label": "Progress ring",
|
|
94
|
+
className: styles.ring,
|
|
95
|
+
height: size,
|
|
96
|
+
role: "img",
|
|
97
|
+
width: size,
|
|
98
|
+
children: [/*#__PURE__*/jsx("title", {
|
|
99
|
+
children: "Progress indicator"
|
|
100
|
+
}), gradientEnable ? /*#__PURE__*/jsx("defs", {
|
|
101
|
+
children: /*#__PURE__*/jsxs("linearGradient", {
|
|
102
|
+
id: gradientId,
|
|
103
|
+
x1: "0%",
|
|
104
|
+
x2: "100%",
|
|
105
|
+
y1: "0%",
|
|
106
|
+
y2: "0%",
|
|
107
|
+
children: [/*#__PURE__*/jsx("stop", {
|
|
108
|
+
offset: "0%",
|
|
109
|
+
stopColor: gradientColors[0]
|
|
110
|
+
}), /*#__PURE__*/jsx("stop", {
|
|
111
|
+
offset: "100%",
|
|
112
|
+
stopColor: gradientColors[1]
|
|
113
|
+
})]
|
|
114
|
+
})
|
|
115
|
+
}) : null, /*#__PURE__*/jsx("circle", {
|
|
116
|
+
cx: center,
|
|
117
|
+
cy: center,
|
|
118
|
+
fill: "none",
|
|
119
|
+
r: radius,
|
|
120
|
+
stroke: trackColor,
|
|
121
|
+
strokeWidth: strokeWidth
|
|
122
|
+
}), /*#__PURE__*/jsx("circle", {
|
|
123
|
+
cx: center,
|
|
124
|
+
cy: center,
|
|
125
|
+
fill: "none",
|
|
126
|
+
r: radius,
|
|
127
|
+
stroke: gradientEnable ? `url(#${gradientId})` : progressColor,
|
|
128
|
+
strokeDasharray: circumference,
|
|
129
|
+
strokeDashoffset: strokeDashoffset,
|
|
130
|
+
strokeLinecap: "round",
|
|
131
|
+
strokeWidth: strokeWidth,
|
|
132
|
+
style: {
|
|
133
|
+
transition: 'stroke-dashoffset 0.5s ease'
|
|
134
|
+
}
|
|
135
|
+
})]
|
|
136
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
137
|
+
className: styles.centerContent,
|
|
138
|
+
children: [showValue ? /*#__PURE__*/jsx("span", {
|
|
139
|
+
className: styles.value,
|
|
140
|
+
style: {
|
|
141
|
+
fontSize: size * 0.2,
|
|
142
|
+
color: displayColor
|
|
143
|
+
},
|
|
144
|
+
children: formatValue(Math.round(percentage), percentage, valueFormat)
|
|
145
|
+
}) : null, showLabel && label ? /*#__PURE__*/jsx("span", {
|
|
146
|
+
className: styles.label,
|
|
147
|
+
style: {
|
|
148
|
+
fontSize: size * 0.1
|
|
149
|
+
},
|
|
150
|
+
children: label
|
|
151
|
+
}) : null]
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// 线性进度条组件
|
|
157
|
+
const BarProgress = ({
|
|
158
|
+
percentage,
|
|
159
|
+
trackColor,
|
|
160
|
+
progressColor,
|
|
161
|
+
gradientEnable,
|
|
162
|
+
gradientColors,
|
|
163
|
+
showValue,
|
|
164
|
+
showLabel,
|
|
165
|
+
label,
|
|
166
|
+
valueFormat,
|
|
167
|
+
displayColor
|
|
168
|
+
}) => /*#__PURE__*/jsxs("div", {
|
|
169
|
+
className: styles.barContainer,
|
|
170
|
+
children: [showLabel || showValue ? /*#__PURE__*/jsxs("div", {
|
|
171
|
+
className: styles.barLabels,
|
|
172
|
+
children: [showLabel ? /*#__PURE__*/jsx("span", {
|
|
173
|
+
className: styles.barLabel,
|
|
174
|
+
children: label
|
|
175
|
+
}) : null, showValue ? /*#__PURE__*/jsx("span", {
|
|
176
|
+
className: styles.barValue,
|
|
177
|
+
style: {
|
|
178
|
+
color: displayColor
|
|
179
|
+
},
|
|
180
|
+
children: formatValue(Math.round(percentage), percentage, valueFormat)
|
|
181
|
+
}) : null]
|
|
182
|
+
}) : null, /*#__PURE__*/jsx("div", {
|
|
183
|
+
className: styles.barWrapper,
|
|
184
|
+
style: {
|
|
185
|
+
background: trackColor
|
|
186
|
+
},
|
|
187
|
+
children: /*#__PURE__*/jsx("div", {
|
|
188
|
+
className: styles.barFill,
|
|
189
|
+
style: {
|
|
190
|
+
width: `${percentage}%`,
|
|
191
|
+
background: gradientEnable ? `linear-gradient(90deg, ${gradientColors[0]}, ${gradientColors[1]})` : progressColor
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
const Progress = ({
|
|
197
|
+
ref,
|
|
198
|
+
value = 0,
|
|
199
|
+
maxValue = 100,
|
|
200
|
+
type = 'ring',
|
|
201
|
+
showValue = true,
|
|
202
|
+
showLabel = false,
|
|
203
|
+
label = '',
|
|
204
|
+
valueFormat = 'percent',
|
|
205
|
+
strokeWidthRatio = 0.07,
|
|
206
|
+
trackColor = 'rgba(26, 26, 62, 0.8)',
|
|
207
|
+
progressColor = '#00d4ff',
|
|
208
|
+
gradientEnable = false,
|
|
209
|
+
gradientColors = ['#00d4ff', '#9b59b6'],
|
|
210
|
+
style: externalStyle
|
|
211
|
+
}) => {
|
|
212
|
+
const gradientId = useId();
|
|
213
|
+
const normalizedValue = Math.min(Math.max(value, 0), maxValue);
|
|
214
|
+
const percentage = normalizedValue / maxValue * 100;
|
|
215
|
+
const displayColor = gradientEnable ? gradientColors[0] : progressColor;
|
|
216
|
+
if (type === 'ring') {
|
|
217
|
+
return /*#__PURE__*/jsx("div", {
|
|
218
|
+
className: styles.wrapper,
|
|
219
|
+
ref: ref,
|
|
220
|
+
style: externalStyle,
|
|
221
|
+
children: /*#__PURE__*/jsx(RingProgress, {
|
|
222
|
+
displayColor: displayColor,
|
|
223
|
+
gradientColors: gradientColors,
|
|
224
|
+
gradientEnable: gradientEnable,
|
|
225
|
+
gradientId: gradientId,
|
|
226
|
+
label: label,
|
|
227
|
+
percentage: percentage,
|
|
228
|
+
progressColor: progressColor,
|
|
229
|
+
showLabel: showLabel,
|
|
230
|
+
showValue: showValue,
|
|
231
|
+
strokeWidthRatio: strokeWidthRatio,
|
|
232
|
+
trackColor: trackColor,
|
|
233
|
+
valueFormat: valueFormat
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return /*#__PURE__*/jsx("div", {
|
|
238
|
+
className: styles.wrapper,
|
|
239
|
+
ref: ref,
|
|
240
|
+
style: externalStyle,
|
|
241
|
+
children: /*#__PURE__*/jsx(BarProgress, {
|
|
242
|
+
displayColor: displayColor,
|
|
243
|
+
gradientColors: gradientColors,
|
|
244
|
+
gradientEnable: gradientEnable,
|
|
245
|
+
label: label,
|
|
246
|
+
percentage: percentage,
|
|
247
|
+
progressColor: progressColor,
|
|
248
|
+
showLabel: showLabel,
|
|
249
|
+
showValue: showValue,
|
|
250
|
+
trackColor: trackColor,
|
|
251
|
+
valueFormat: valueFormat
|
|
252
|
+
})
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export { Progress, Progress as default };
|
|
257
|
+
//# sourceMappingURL=component.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.esm.js","sources":["../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Progress Component\n * 进度组件 - 支持环形和线性进度条\n */\n\nimport { useId, useRef, useEffect, useState, type CSSProperties, type Ref } from 'react'\nimport styles from './component.module.css'\n\nexport interface ProgressProps {\n ref?: Ref<HTMLDivElement>\n /** 当前值 */\n value?: number\n /** 最大值 */\n maxValue?: number\n /** 进度条类型 */\n type?: 'ring' | 'bar'\n /** 是否显示数值 */\n showValue?: boolean\n /** 是否显示标签 */\n showLabel?: boolean\n /** 标签文本 */\n label?: string\n /** 数值格式 */\n valueFormat?: 'percent' | 'number'\n /** 线条宽度比例(相对于尺寸的百分比) */\n strokeWidthRatio?: number\n /** 轨道颜色 */\n trackColor?: string\n /** 进度颜色 */\n progressColor?: string\n /** 是否启用渐变 */\n gradientEnable?: boolean\n /** 渐变颜色 [起始色, 结束色] */\n gradientColors?: [string, string]\n /** 外部样式 */\n style?: CSSProperties\n}\n\n// 格式化数值\nconst formatValue = (value: number, percentage: number, valueFormat: string): string => {\n if (valueFormat === 'percent') {\n return `${Math.round(percentage)}%`\n }\n return `${value}`\n}\n\n// 环形进度条组件\nconst RingProgress = ({\n percentage,\n strokeWidthRatio,\n trackColor,\n progressColor,\n gradientEnable,\n gradientColors,\n showValue,\n showLabel,\n label,\n valueFormat,\n displayColor,\n gradientId,\n}: {\n percentage: number\n strokeWidthRatio: number\n trackColor: string\n progressColor: string\n gradientEnable: boolean\n gradientColors: [string, string]\n showValue: boolean\n showLabel: boolean\n label: string\n valueFormat: string\n displayColor: string\n gradientId: string\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const [size, setSize] = useState(100)\n\n useEffect(() => {\n const container = containerRef.current\n if (!container) {\n return\n }\n\n const updateSize = () => {\n const { width, height } = container.getBoundingClientRect()\n const minSize = Math.min(width, height)\n if (minSize > 0) {\n setSize(minSize)\n }\n }\n\n updateSize()\n\n const resizeObserver = new ResizeObserver(updateSize)\n resizeObserver.observe(container)\n\n return () => resizeObserver.disconnect()\n }, [])\n\n const strokeWidth = Math.max(2, size * strokeWidthRatio)\n const radius = (size - strokeWidth) / 2\n const circumference = 2 * Math.PI * radius\n const strokeDashoffset = circumference - (percentage / 100) * circumference\n const center = size / 2\n\n return (\n <div className={styles.container} ref={containerRef}>\n <svg aria-label='Progress ring' className={styles.ring} height={size} role='img' width={size}>\n <title>Progress indicator</title>\n {gradientEnable ? (\n <defs>\n <linearGradient id={gradientId} x1='0%' x2='100%' y1='0%' y2='0%'>\n <stop offset='0%' stopColor={gradientColors[0]} />\n <stop offset='100%' stopColor={gradientColors[1]} />\n </linearGradient>\n </defs>\n ) : null}\n {/* 轨道 */}\n <circle cx={center} cy={center} fill='none' r={radius} stroke={trackColor} strokeWidth={strokeWidth} />\n {/* 进度 */}\n <circle\n cx={center}\n cy={center}\n fill='none'\n r={radius}\n stroke={gradientEnable ? `url(#${gradientId})` : progressColor}\n strokeDasharray={circumference}\n strokeDashoffset={strokeDashoffset}\n strokeLinecap='round'\n strokeWidth={strokeWidth}\n style={{\n transition: 'stroke-dashoffset 0.5s ease',\n }}\n />\n </svg>\n <div className={styles.centerContent}>\n {showValue ? (\n <span className={styles.value} style={{ fontSize: size * 0.2, color: displayColor }}>\n {formatValue(Math.round(percentage), percentage, valueFormat)}\n </span>\n ) : null}\n {showLabel && label ? (\n <span className={styles.label} style={{ fontSize: size * 0.1 }}>\n {label}\n </span>\n ) : null}\n </div>\n </div>\n )\n}\n\n// 线性进度条组件\nconst BarProgress = ({\n percentage,\n trackColor,\n progressColor,\n gradientEnable,\n gradientColors,\n showValue,\n showLabel,\n label,\n valueFormat,\n displayColor,\n}: {\n percentage: number\n trackColor: string\n progressColor: string\n gradientEnable: boolean\n gradientColors: [string, string]\n showValue: boolean\n showLabel: boolean\n label: string\n valueFormat: string\n displayColor: string\n}) => (\n <div className={styles.barContainer}>\n {showLabel || showValue ? (\n <div className={styles.barLabels}>\n {showLabel ? <span className={styles.barLabel}>{label}</span> : null}\n {showValue ? (\n <span className={styles.barValue} style={{ color: displayColor }}>\n {formatValue(Math.round(percentage), percentage, valueFormat)}\n </span>\n ) : null}\n </div>\n ) : null}\n <div className={styles.barWrapper} style={{ background: trackColor }}>\n <div\n className={styles.barFill}\n style={{\n width: `${percentage}%`,\n background: gradientEnable\n ? `linear-gradient(90deg, ${gradientColors[0]}, ${gradientColors[1]})`\n : progressColor,\n }}\n />\n </div>\n </div>\n)\n\nexport const Progress: React.FC<ProgressProps> = ({\n ref,\n value = 0,\n maxValue = 100,\n type = 'ring',\n showValue = true,\n showLabel = false,\n label = '',\n valueFormat = 'percent',\n strokeWidthRatio = 0.07,\n trackColor = 'rgba(26, 26, 62, 0.8)',\n progressColor = '#00d4ff',\n gradientEnable = false,\n gradientColors = ['#00d4ff', '#9b59b6'],\n style: externalStyle,\n}) => {\n const gradientId = useId()\n\n const normalizedValue = Math.min(Math.max(value, 0), maxValue)\n const percentage = (normalizedValue / maxValue) * 100\n const displayColor = gradientEnable ? gradientColors[0] : progressColor\n\n if (type === 'ring') {\n return (\n <div className={styles.wrapper} ref={ref} style={externalStyle}>\n <RingProgress\n displayColor={displayColor}\n gradientColors={gradientColors}\n gradientEnable={gradientEnable}\n gradientId={gradientId}\n label={label}\n percentage={percentage}\n progressColor={progressColor}\n showLabel={showLabel}\n showValue={showValue}\n strokeWidthRatio={strokeWidthRatio}\n trackColor={trackColor}\n valueFormat={valueFormat}\n />\n </div>\n )\n }\n\n return (\n <div className={styles.wrapper} ref={ref} style={externalStyle}>\n <BarProgress\n displayColor={displayColor}\n gradientColors={gradientColors}\n gradientEnable={gradientEnable}\n label={label}\n percentage={percentage}\n progressColor={progressColor}\n showLabel={showLabel}\n showValue={showValue}\n trackColor={trackColor}\n valueFormat={valueFormat}\n />\n </div>\n )\n}\n\nexport default Progress\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","formatValue","value","percentage","valueFormat","Math","round","RingProgress","strokeWidthRatio","trackColor","progressColor","gradientEnable","gradientColors","showValue","showLabel","label","displayColor","gradientId","containerRef","useRef","size","setSize","useState","useEffect","container","current","updateSize","width","height","getBoundingClientRect","minSize","min","resizeObserver","ResizeObserver","observe","disconnect","strokeWidth","max","radius","circumference","PI","strokeDashoffset","center","_jsxs","className","styles","children","ring","role","_jsx","id","x1","x2","y1","y2","offset","stopColor","cx","cy","fill","r","stroke","strokeDasharray","strokeLinecap","transition","centerContent","fontSize","color","BarProgress","barContainer","barLabels","barLabel","barValue","barWrapper","background","barFill","Progress","maxValue","externalStyle","useId","normalizedValue","wrapper"],"mappings":";;;;AAAA,SAASA,WAAWA,CAACC,GAAG,EAAEC,GAAG,EAAE;EAC7B,IAAKA,GAAG,KAAK,MAAM,EAAGA,GAAG,GAAG,EAAE;AAC9B,EAAA,IAAIC,QAAQ,GAAGD,GAAG,CAACC,QAAQ;AAE3B,EAAA,IAAY,OAAOC,QAAQ,KAAK,WAAW,EAAE;AAAE,IAAA;AAAQ,EAAA;AAEvD,EAAA,IAAIC,IAAI,GAAGD,QAAQ,CAACC,IAAI,IAAID,QAAQ,CAACE,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACpE,EAAA,IAAIC,KAAK,GAAGH,QAAQ,CAACI,aAAa,CAAC,OAAO,CAAC;EAC3CD,KAAK,CAACE,IAAI,GAAG,UAAU;EAEvB,IAAIN,QAAQ,KAAK,KAAK,EAAE;IACtB,IAAIE,IAAI,CAACK,UAAU,EAAE;MACnBL,IAAI,CAACM,YAAY,CAACJ,KAAK,EAAEF,IAAI,CAACK,UAAU,CAAC;AAC3C,IAAA,CAAC,MAAM;AACLL,MAAAA,IAAI,CAAC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,KAAK,EAAEsF,aAAc;IAAAhC,QAAA,eAC7DG,GAAA,CAACmB,WAAW,EAAA;AACVpD,MAAAA,YAAY,EAAEA,YAAa;AAC3BJ,MAAAA,cAAc,EAAEA,cAAe;AAC/BD,MAAAA,cAAc,EAAEA,cAAe;AAC/BI,MAAAA,KAAK,EAAEA,KAAM;AACbZ,MAAAA,UAAU,EAAEA,UAAW;AACvBO,MAAAA,aAAa,EAAEA,aAAc;AAC7BI,MAAAA,SAAS,EAAEA,SAAU;AACrBD,MAAAA,SAAS,EAAEA,SAAU;AACrBJ,MAAAA,UAAU,EAAEA,UAAW;AACvBL,MAAAA,WAAW,EAAEA;KACd;AAAC,GACC,CAAC;AAEV;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/* @easy-editor/materials-dashboard-progress-ring v0.0.1 (component) */
|
|
2
|
+
(function (global, factory) {
|
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react/jsx-runtime')) :
|
|
4
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react/jsx-runtime'], factory) :
|
|
5
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EasyEditorMaterialsProgressRingComponent = {}, global.React, global.jsxRuntime));
|
|
6
|
+
})(this, (function (exports, react, jsxRuntime) { 'use strict';
|
|
7
|
+
|
|
8
|
+
function styleInject(css, ref) {
|
|
9
|
+
if (ref === void 0) ref = {};
|
|
10
|
+
var insertAt = ref.insertAt;
|
|
11
|
+
if (typeof document === 'undefined') {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
15
|
+
var style = document.createElement('style');
|
|
16
|
+
style.type = 'text/css';
|
|
17
|
+
if (insertAt === 'top') {
|
|
18
|
+
if (head.firstChild) {
|
|
19
|
+
head.insertBefore(style, head.firstChild);
|
|
20
|
+
} else {
|
|
21
|
+
head.appendChild(style);
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
head.appendChild(style);
|
|
25
|
+
}
|
|
26
|
+
if (style.styleSheet) {
|
|
27
|
+
style.styleSheet.cssText = css;
|
|
28
|
+
} else {
|
|
29
|
+
style.appendChild(document.createTextNode(css));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var css_248z = ".component-module__container___VbZSk,.component-module__wrapper___IYMoW{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.component-module__container___VbZSk{position:relative}.component-module__ring___QkEHa{transform:rotate(-90deg)}.component-module__centerContent___Ri3R3{align-items:center;display:flex;flex-direction:column;justify-content:center;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%)}.component-module__value___Fg70k{font-weight:700;line-height:1.1}.component-module__label___6IHVo{color:#fff;margin-top:4px;opacity:.7}.component-module__barContainer___AOTls{display:flex;flex-direction:column;gap:4px;height:100%;justify-content:center;width:100%}.component-module__barWrapper___cni-a{border-radius:4px;flex:1;max-height:8px;min-height:8px;overflow:hidden;width:100%}.component-module__barFill___KZkJe{border-radius:4px;height:100%;transition:width .5s ease}.component-module__barLabels___BvaEi{align-items:center;display:flex;justify-content:space-between}.component-module__barLabel___wVaWe{color:hsla(0,0%,100%,.7);font-size:12px}.component-module__barValue___H2muu{font-size:14px;font-weight:600}";
|
|
34
|
+
var styles = {"wrapper":"component-module__wrapper___IYMoW","container":"component-module__container___VbZSk","ring":"component-module__ring___QkEHa","centerContent":"component-module__centerContent___Ri3R3","value":"component-module__value___Fg70k","label":"component-module__label___6IHVo","barContainer":"component-module__barContainer___AOTls","barWrapper":"component-module__barWrapper___cni-a","barFill":"component-module__barFill___KZkJe","barLabels":"component-module__barLabels___BvaEi","barLabel":"component-module__barLabel___wVaWe","barValue":"component-module__barValue___H2muu"};
|
|
35
|
+
styleInject(css_248z);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Progress Component
|
|
39
|
+
* 进度组件 - 支持环形和线性进度条
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
// 格式化数值
|
|
43
|
+
const formatValue = (value, percentage, valueFormat) => {
|
|
44
|
+
if (valueFormat === 'percent') {
|
|
45
|
+
return `${Math.round(percentage)}%`;
|
|
46
|
+
}
|
|
47
|
+
return `${value}`;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// 环形进度条组件
|
|
51
|
+
const RingProgress = ({
|
|
52
|
+
percentage,
|
|
53
|
+
strokeWidthRatio,
|
|
54
|
+
trackColor,
|
|
55
|
+
progressColor,
|
|
56
|
+
gradientEnable,
|
|
57
|
+
gradientColors,
|
|
58
|
+
showValue,
|
|
59
|
+
showLabel,
|
|
60
|
+
label,
|
|
61
|
+
valueFormat,
|
|
62
|
+
displayColor,
|
|
63
|
+
gradientId
|
|
64
|
+
}) => {
|
|
65
|
+
const containerRef = react.useRef(null);
|
|
66
|
+
const [size, setSize] = react.useState(100);
|
|
67
|
+
react.useEffect(() => {
|
|
68
|
+
const container = containerRef.current;
|
|
69
|
+
if (!container) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const updateSize = () => {
|
|
73
|
+
const {
|
|
74
|
+
width,
|
|
75
|
+
height
|
|
76
|
+
} = container.getBoundingClientRect();
|
|
77
|
+
const minSize = Math.min(width, height);
|
|
78
|
+
if (minSize > 0) {
|
|
79
|
+
setSize(minSize);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
updateSize();
|
|
83
|
+
const resizeObserver = new ResizeObserver(updateSize);
|
|
84
|
+
resizeObserver.observe(container);
|
|
85
|
+
return () => resizeObserver.disconnect();
|
|
86
|
+
}, []);
|
|
87
|
+
const strokeWidth = Math.max(2, size * strokeWidthRatio);
|
|
88
|
+
const radius = (size - strokeWidth) / 2;
|
|
89
|
+
const circumference = 2 * Math.PI * radius;
|
|
90
|
+
const strokeDashoffset = circumference - percentage / 100 * circumference;
|
|
91
|
+
const center = size / 2;
|
|
92
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
93
|
+
className: styles.container,
|
|
94
|
+
ref: containerRef,
|
|
95
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
96
|
+
"aria-label": "Progress ring",
|
|
97
|
+
className: styles.ring,
|
|
98
|
+
height: size,
|
|
99
|
+
role: "img",
|
|
100
|
+
width: size,
|
|
101
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("title", {
|
|
102
|
+
children: "Progress indicator"
|
|
103
|
+
}), gradientEnable ? /*#__PURE__*/jsxRuntime.jsx("defs", {
|
|
104
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("linearGradient", {
|
|
105
|
+
id: gradientId,
|
|
106
|
+
x1: "0%",
|
|
107
|
+
x2: "100%",
|
|
108
|
+
y1: "0%",
|
|
109
|
+
y2: "0%",
|
|
110
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("stop", {
|
|
111
|
+
offset: "0%",
|
|
112
|
+
stopColor: gradientColors[0]
|
|
113
|
+
}), /*#__PURE__*/jsxRuntime.jsx("stop", {
|
|
114
|
+
offset: "100%",
|
|
115
|
+
stopColor: gradientColors[1]
|
|
116
|
+
})]
|
|
117
|
+
})
|
|
118
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("circle", {
|
|
119
|
+
cx: center,
|
|
120
|
+
cy: center,
|
|
121
|
+
fill: "none",
|
|
122
|
+
r: radius,
|
|
123
|
+
stroke: trackColor,
|
|
124
|
+
strokeWidth: strokeWidth
|
|
125
|
+
}), /*#__PURE__*/jsxRuntime.jsx("circle", {
|
|
126
|
+
cx: center,
|
|
127
|
+
cy: center,
|
|
128
|
+
fill: "none",
|
|
129
|
+
r: radius,
|
|
130
|
+
stroke: gradientEnable ? `url(#${gradientId})` : progressColor,
|
|
131
|
+
strokeDasharray: circumference,
|
|
132
|
+
strokeDashoffset: strokeDashoffset,
|
|
133
|
+
strokeLinecap: "round",
|
|
134
|
+
strokeWidth: strokeWidth,
|
|
135
|
+
style: {
|
|
136
|
+
transition: 'stroke-dashoffset 0.5s ease'
|
|
137
|
+
}
|
|
138
|
+
})]
|
|
139
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
140
|
+
className: styles.centerContent,
|
|
141
|
+
children: [showValue ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
142
|
+
className: styles.value,
|
|
143
|
+
style: {
|
|
144
|
+
fontSize: size * 0.2,
|
|
145
|
+
color: displayColor
|
|
146
|
+
},
|
|
147
|
+
children: formatValue(Math.round(percentage), percentage, valueFormat)
|
|
148
|
+
}) : null, showLabel && label ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
149
|
+
className: styles.label,
|
|
150
|
+
style: {
|
|
151
|
+
fontSize: size * 0.1
|
|
152
|
+
},
|
|
153
|
+
children: label
|
|
154
|
+
}) : null]
|
|
155
|
+
})]
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// 线性进度条组件
|
|
160
|
+
const BarProgress = ({
|
|
161
|
+
percentage,
|
|
162
|
+
trackColor,
|
|
163
|
+
progressColor,
|
|
164
|
+
gradientEnable,
|
|
165
|
+
gradientColors,
|
|
166
|
+
showValue,
|
|
167
|
+
showLabel,
|
|
168
|
+
label,
|
|
169
|
+
valueFormat,
|
|
170
|
+
displayColor
|
|
171
|
+
}) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
172
|
+
className: styles.barContainer,
|
|
173
|
+
children: [showLabel || showValue ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
174
|
+
className: styles.barLabels,
|
|
175
|
+
children: [showLabel ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
176
|
+
className: styles.barLabel,
|
|
177
|
+
children: label
|
|
178
|
+
}) : null, showValue ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
179
|
+
className: styles.barValue,
|
|
180
|
+
style: {
|
|
181
|
+
color: displayColor
|
|
182
|
+
},
|
|
183
|
+
children: formatValue(Math.round(percentage), percentage, valueFormat)
|
|
184
|
+
}) : null]
|
|
185
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
186
|
+
className: styles.barWrapper,
|
|
187
|
+
style: {
|
|
188
|
+
background: trackColor
|
|
189
|
+
},
|
|
190
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
191
|
+
className: styles.barFill,
|
|
192
|
+
style: {
|
|
193
|
+
width: `${percentage}%`,
|
|
194
|
+
background: gradientEnable ? `linear-gradient(90deg, ${gradientColors[0]}, ${gradientColors[1]})` : progressColor
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
})]
|
|
198
|
+
});
|
|
199
|
+
const Progress = ({
|
|
200
|
+
ref,
|
|
201
|
+
value = 0,
|
|
202
|
+
maxValue = 100,
|
|
203
|
+
type = 'ring',
|
|
204
|
+
showValue = true,
|
|
205
|
+
showLabel = false,
|
|
206
|
+
label = '',
|
|
207
|
+
valueFormat = 'percent',
|
|
208
|
+
strokeWidthRatio = 0.07,
|
|
209
|
+
trackColor = 'rgba(26, 26, 62, 0.8)',
|
|
210
|
+
progressColor = '#00d4ff',
|
|
211
|
+
gradientEnable = false,
|
|
212
|
+
gradientColors = ['#00d4ff', '#9b59b6'],
|
|
213
|
+
style: externalStyle
|
|
214
|
+
}) => {
|
|
215
|
+
const gradientId = react.useId();
|
|
216
|
+
const normalizedValue = Math.min(Math.max(value, 0), maxValue);
|
|
217
|
+
const percentage = normalizedValue / maxValue * 100;
|
|
218
|
+
const displayColor = gradientEnable ? gradientColors[0] : progressColor;
|
|
219
|
+
if (type === 'ring') {
|
|
220
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
221
|
+
className: styles.wrapper,
|
|
222
|
+
ref: ref,
|
|
223
|
+
style: externalStyle,
|
|
224
|
+
children: /*#__PURE__*/jsxRuntime.jsx(RingProgress, {
|
|
225
|
+
displayColor: displayColor,
|
|
226
|
+
gradientColors: gradientColors,
|
|
227
|
+
gradientEnable: gradientEnable,
|
|
228
|
+
gradientId: gradientId,
|
|
229
|
+
label: label,
|
|
230
|
+
percentage: percentage,
|
|
231
|
+
progressColor: progressColor,
|
|
232
|
+
showLabel: showLabel,
|
|
233
|
+
showValue: showValue,
|
|
234
|
+
strokeWidthRatio: strokeWidthRatio,
|
|
235
|
+
trackColor: trackColor,
|
|
236
|
+
valueFormat: valueFormat
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
241
|
+
className: styles.wrapper,
|
|
242
|
+
ref: ref,
|
|
243
|
+
style: externalStyle,
|
|
244
|
+
children: /*#__PURE__*/jsxRuntime.jsx(BarProgress, {
|
|
245
|
+
displayColor: displayColor,
|
|
246
|
+
gradientColors: gradientColors,
|
|
247
|
+
gradientEnable: gradientEnable,
|
|
248
|
+
label: label,
|
|
249
|
+
percentage: percentage,
|
|
250
|
+
progressColor: progressColor,
|
|
251
|
+
showLabel: showLabel,
|
|
252
|
+
showValue: showValue,
|
|
253
|
+
trackColor: trackColor,
|
|
254
|
+
valueFormat: valueFormat
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
exports.Progress = Progress;
|
|
260
|
+
exports.default = Progress;
|
|
261
|
+
|
|
262
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
263
|
+
|
|
264
|
+
}));
|
|
265
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Progress Component\n * 进度组件 - 支持环形和线性进度条\n */\n\nimport { useId, useRef, useEffect, useState, type CSSProperties, type Ref } from 'react'\nimport styles from './component.module.css'\n\nexport interface ProgressProps {\n ref?: Ref<HTMLDivElement>\n /** 当前值 */\n value?: number\n /** 最大值 */\n maxValue?: number\n /** 进度条类型 */\n type?: 'ring' | 'bar'\n /** 是否显示数值 */\n showValue?: boolean\n /** 是否显示标签 */\n showLabel?: boolean\n /** 标签文本 */\n label?: string\n /** 数值格式 */\n valueFormat?: 'percent' | 'number'\n /** 线条宽度比例(相对于尺寸的百分比) */\n strokeWidthRatio?: number\n /** 轨道颜色 */\n trackColor?: string\n /** 进度颜色 */\n progressColor?: string\n /** 是否启用渐变 */\n gradientEnable?: boolean\n /** 渐变颜色 [起始色, 结束色] */\n gradientColors?: [string, string]\n /** 外部样式 */\n style?: CSSProperties\n}\n\n// 格式化数值\nconst formatValue = (value: number, percentage: number, valueFormat: string): string => {\n if (valueFormat === 'percent') {\n return `${Math.round(percentage)}%`\n }\n return `${value}`\n}\n\n// 环形进度条组件\nconst RingProgress = ({\n percentage,\n strokeWidthRatio,\n trackColor,\n progressColor,\n gradientEnable,\n gradientColors,\n showValue,\n showLabel,\n label,\n valueFormat,\n displayColor,\n gradientId,\n}: {\n percentage: number\n strokeWidthRatio: number\n trackColor: string\n progressColor: string\n gradientEnable: boolean\n gradientColors: [string, string]\n showValue: boolean\n showLabel: boolean\n label: string\n valueFormat: string\n displayColor: string\n gradientId: string\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const [size, setSize] = useState(100)\n\n useEffect(() => {\n const container = containerRef.current\n if (!container) {\n return\n }\n\n const updateSize = () => {\n const { width, height } = container.getBoundingClientRect()\n const minSize = Math.min(width, height)\n if (minSize > 0) {\n setSize(minSize)\n }\n }\n\n updateSize()\n\n const resizeObserver = new ResizeObserver(updateSize)\n resizeObserver.observe(container)\n\n return () => resizeObserver.disconnect()\n }, [])\n\n const strokeWidth = Math.max(2, size * strokeWidthRatio)\n const radius = (size - strokeWidth) / 2\n const circumference = 2 * Math.PI * radius\n const strokeDashoffset = circumference - (percentage / 100) * circumference\n const center = size / 2\n\n return (\n <div className={styles.container} ref={containerRef}>\n <svg aria-label='Progress ring' className={styles.ring} height={size} role='img' width={size}>\n <title>Progress indicator</title>\n {gradientEnable ? (\n <defs>\n <linearGradient id={gradientId} x1='0%' x2='100%' y1='0%' y2='0%'>\n <stop offset='0%' stopColor={gradientColors[0]} />\n <stop offset='100%' stopColor={gradientColors[1]} />\n </linearGradient>\n </defs>\n ) : null}\n {/* 轨道 */}\n <circle cx={center} cy={center} fill='none' r={radius} stroke={trackColor} strokeWidth={strokeWidth} />\n {/* 进度 */}\n <circle\n cx={center}\n cy={center}\n fill='none'\n r={radius}\n stroke={gradientEnable ? `url(#${gradientId})` : progressColor}\n strokeDasharray={circumference}\n strokeDashoffset={strokeDashoffset}\n strokeLinecap='round'\n strokeWidth={strokeWidth}\n style={{\n transition: 'stroke-dashoffset 0.5s ease',\n }}\n />\n </svg>\n <div className={styles.centerContent}>\n {showValue ? (\n <span className={styles.value} style={{ fontSize: size * 0.2, color: displayColor }}>\n {formatValue(Math.round(percentage), percentage, valueFormat)}\n </span>\n ) : null}\n {showLabel && label ? (\n <span className={styles.label} style={{ fontSize: size * 0.1 }}>\n {label}\n </span>\n ) : null}\n </div>\n </div>\n )\n}\n\n// 线性进度条组件\nconst BarProgress = ({\n percentage,\n trackColor,\n progressColor,\n gradientEnable,\n gradientColors,\n showValue,\n showLabel,\n label,\n valueFormat,\n displayColor,\n}: {\n percentage: number\n trackColor: string\n progressColor: string\n gradientEnable: boolean\n gradientColors: [string, string]\n showValue: boolean\n showLabel: boolean\n label: string\n valueFormat: string\n displayColor: string\n}) => (\n <div className={styles.barContainer}>\n {showLabel || showValue ? (\n <div className={styles.barLabels}>\n {showLabel ? <span className={styles.barLabel}>{label}</span> : null}\n {showValue ? (\n <span className={styles.barValue} style={{ color: displayColor }}>\n {formatValue(Math.round(percentage), percentage, valueFormat)}\n </span>\n ) : null}\n </div>\n ) : null}\n <div className={styles.barWrapper} style={{ background: trackColor }}>\n <div\n className={styles.barFill}\n style={{\n width: `${percentage}%`,\n background: gradientEnable\n ? `linear-gradient(90deg, ${gradientColors[0]}, ${gradientColors[1]})`\n : progressColor,\n }}\n />\n </div>\n </div>\n)\n\nexport const Progress: React.FC<ProgressProps> = ({\n ref,\n value = 0,\n maxValue = 100,\n type = 'ring',\n showValue = true,\n showLabel = false,\n label = '',\n valueFormat = 'percent',\n strokeWidthRatio = 0.07,\n trackColor = 'rgba(26, 26, 62, 0.8)',\n progressColor = '#00d4ff',\n gradientEnable = false,\n gradientColors = ['#00d4ff', '#9b59b6'],\n style: externalStyle,\n}) => {\n const gradientId = useId()\n\n const normalizedValue = Math.min(Math.max(value, 0), maxValue)\n const percentage = (normalizedValue / maxValue) * 100\n const displayColor = gradientEnable ? gradientColors[0] : progressColor\n\n if (type === 'ring') {\n return (\n <div className={styles.wrapper} ref={ref} style={externalStyle}>\n <RingProgress\n displayColor={displayColor}\n gradientColors={gradientColors}\n gradientEnable={gradientEnable}\n gradientId={gradientId}\n label={label}\n percentage={percentage}\n progressColor={progressColor}\n showLabel={showLabel}\n showValue={showValue}\n strokeWidthRatio={strokeWidthRatio}\n trackColor={trackColor}\n valueFormat={valueFormat}\n />\n </div>\n )\n }\n\n return (\n <div className={styles.wrapper} ref={ref} style={externalStyle}>\n <BarProgress\n displayColor={displayColor}\n gradientColors={gradientColors}\n gradientEnable={gradientEnable}\n label={label}\n percentage={percentage}\n progressColor={progressColor}\n showLabel={showLabel}\n showValue={showValue}\n trackColor={trackColor}\n valueFormat={valueFormat}\n />\n </div>\n )\n}\n\nexport default Progress\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","formatValue","value","percentage","valueFormat","Math","round","RingProgress","strokeWidthRatio","trackColor","progressColor","gradientEnable","gradientColors","showValue","showLabel","label","displayColor","gradientId","containerRef","useRef","size","setSize","useState","useEffect","container","current","updateSize","width","height","getBoundingClientRect","minSize","min","resizeObserver","ResizeObserver","observe","disconnect","strokeWidth","max","radius","circumference","PI","strokeDashoffset","center","_jsxs","className","styles","children","ring","role","_jsx","id","x1","x2","y1","y2","offset","stopColor","cx","cy","fill","r","stroke","strokeDasharray","strokeLinecap","transition","centerContent","fontSize","color","BarProgress","barContainer","barLabels","barLabel","barValue","barWrapper","background","barFill","Progress","maxValue","externalStyle","useId","normalizedValue","wrapper"],"mappings":";;;;;;;EAAA,SAASA,WAAWA,CAACC,GAAG,EAAEC,GAAG,EAAE;IAC7B,IAAKA,GAAG,KAAK,MAAM,EAAGA,GAAG,GAAG,EAAE;EAC9B,EAAA,IAAIC,QAAQ,GAAGD,GAAG,CAACC,QAAQ;EAE3B,EAAA,IAAY,OAAOC,QAAQ,KAAK,WAAW,EAAE;EAAE,IAAA;EAAQ,EAAA;EAEvD,EAAA,IAAIC,IAAI,GAAGD,QAAQ,CAACC,IAAI,IAAID,QAAQ,CAACE,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;EACpE,EAAA,IAAIC,KAAK,GAAGH,QAAQ,CAACI,aAAa,CAAC,OAAO,CAAC;IAC3CD,KAAK,CAACE,IAAI,GAAG,UAAU;IAEvB,IAAIN,QAAQ,KAAK,KAAK,EAAE;MACtB,IAAIE,IAAI,CAACK,UAAU,EAAE;QACnBL,IAAI,CAACM,YAAY,CAACJ,KAAK,EAAEF,IAAI,CAACK,UAAU,CAAC;EAC3C,IAAA,CAAC,MAAM;EACLL,MAAAA,IAAI,CAACO,WAAW,CAACL,KAAK,CAAC;EACzB,IAAA;EACF,EAAA,CAAC,MAAM;EACLF,IAAAA,IA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MAAAA,YAAY,EAAEA,YAAa;EAC3BJ,MAAAA,cAAc,EAAEA,cAAe;EAC/BD,MAAAA,cAAc,EAAEA,cAAe;EAC/BI,MAAAA,KAAK,EAAEA,KAAM;EACbZ,MAAAA,UAAU,EAAEA,UAAW;EACvBO,MAAAA,aAAa,EAAEA,aAAc;EAC7BI,MAAAA,SAAS,EAAEA,SAAU;EACrBD,MAAAA,SAAS,EAAEA,SAAU;EACrBJ,MAAAA,UAAU,EAAEA,UAAW;EACvBL,MAAAA,WAAW,EAAEA;OACd;EAAC,GACC,CAAC;EAEV;;;;;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("react"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react/jsx-runtime"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).EasyEditorMaterialsProgressRingComponent={},e.React,e.jsxRuntime)}(this,function(e,o,t){"use strict";var n="component-module__wrapper___IYMoW",r="component-module__container___VbZSk",l="component-module__ring___QkEHa",a="component-module__centerContent___Ri3R3",s="component-module__value___Fg70k",i="component-module__label___6IHVo",d="component-module__barContainer___AOTls",c="component-module__barWrapper___cni-a",_="component-module__barFill___KZkJe",m="component-module__barLabels___BvaEi",u="component-module__barLabel___wVaWe",p="component-module__barValue___H2muu";!function(e,o){void 0===o&&(o={});var t=o.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".component-module__container___VbZSk,.component-module__wrapper___IYMoW{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.component-module__container___VbZSk{position:relative}.component-module__ring___QkEHa{transform:rotate(-90deg)}.component-module__centerContent___Ri3R3{align-items:center;display:flex;flex-direction:column;justify-content:center;left:50%;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%)}.component-module__value___Fg70k{font-weight:700;line-height:1.1}.component-module__label___6IHVo{color:#fff;margin-top:4px;opacity:.7}.component-module__barContainer___AOTls{display:flex;flex-direction:column;gap:4px;height:100%;justify-content:center;width:100%}.component-module__barWrapper___cni-a{border-radius:4px;flex:1;max-height:8px;min-height:8px;overflow:hidden;width:100%}.component-module__barFill___KZkJe{border-radius:4px;height:100%;transition:width .5s ease}.component-module__barLabels___BvaEi{align-items:center;display:flex;justify-content:space-between}.component-module__barLabel___wVaWe{color:hsla(0,0%,100%,.7);font-size:12px}.component-module__barValue___H2muu{font-size:14px;font-weight:600}");const h=(e,o,t)=>"percent"===t?`${Math.round(o)}%`:`${e}`,f=({percentage:e,strokeWidthRatio:n,trackColor:d,progressColor:c,gradientEnable:_,gradientColors:m,showValue:u,showLabel:p,label:f,valueFormat:g,displayColor:x,gradientId:b})=>{const y=o.useRef(null),[j,C]=o.useState(100);o.useEffect(()=>{const e=y.current;if(!e)return;const o=()=>{const{width:o,height:t}=e.getBoundingClientRect(),n=Math.min(o,t);n>0&&C(n)};o();const t=new ResizeObserver(o);return t.observe(e),()=>t.disconnect()},[]);const v=Math.max(2,j*n),k=(j-v)/2,w=2*Math.PI*k,N=w-e/100*w,V=j/2;return t.jsxs("div",{className:r,ref:y,children:[t.jsxs("svg",{"aria-label":"Progress ring",className:l,height:j,role:"img",width:j,children:[t.jsx("title",{children:"Progress indicator"}),_?t.jsx("defs",{children:t.jsxs("linearGradient",{id:b,x1:"0%",x2:"100%",y1:"0%",y2:"0%",children:[t.jsx("stop",{offset:"0%",stopColor:m[0]}),t.jsx("stop",{offset:"100%",stopColor:m[1]})]})}):null,t.jsx("circle",{cx:V,cy:V,fill:"none",r:k,stroke:d,strokeWidth:v}),t.jsx("circle",{cx:V,cy:V,fill:"none",r:k,stroke:_?`url(#${b})`:c,strokeDasharray:w,strokeDashoffset:N,strokeLinecap:"round",strokeWidth:v,style:{transition:"stroke-dashoffset 0.5s ease"}})]}),t.jsxs("div",{className:a,children:[u?t.jsx("span",{className:s,style:{fontSize:.2*j,color:x},children:h(Math.round(e),e,g)}):null,p&&f?t.jsx("span",{className:i,style:{fontSize:.1*j},children:f}):null]})]})},g=({percentage:e,trackColor:o,progressColor:n,gradientEnable:r,gradientColors:l,showValue:a,showLabel:s,label:i,valueFormat:f,displayColor:g})=>t.jsxs("div",{className:d,children:[s||a?t.jsxs("div",{className:m,children:[s?t.jsx("span",{className:u,children:i}):null,a?t.jsx("span",{className:p,style:{color:g},children:h(Math.round(e),e,f)}):null]}):null,t.jsx("div",{className:c,style:{background:o},children:t.jsx("div",{className:_,style:{width:`${e}%`,background:r?`linear-gradient(90deg, ${l[0]}, ${l[1]})`:n}})})]}),x=({ref:e,value:r=0,maxValue:l=100,type:a="ring",showValue:s=!0,showLabel:i=!1,label:d="",valueFormat:c="percent",strokeWidthRatio:_=.07,trackColor:m="rgba(26, 26, 62, 0.8)",progressColor:u="#00d4ff",gradientEnable:p=!1,gradientColors:h=["#00d4ff","#9b59b6"],style:x})=>{const b=o.useId(),y=Math.min(Math.max(r,0),l)/l*100,j=p?h[0]:u;return"ring"===a?t.jsx("div",{className:n,ref:e,style:x,children:t.jsx(f,{displayColor:j,gradientColors:h,gradientEnable:p,gradientId:b,label:d,percentage:y,progressColor:u,showLabel:i,showValue:s,strokeWidthRatio:_,trackColor:m,valueFormat:c})}):t.jsx("div",{className:n,ref:e,style:x,children:t.jsx(g,{displayColor:j,gradientColors:h,gradientEnable:p,label:d,percentage:y,progressColor:u,showLabel:i,showValue:s,trackColor:m,valueFormat:c})})};e.Progress=x,e.default=x,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
|
+
//# sourceMappingURL=component.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.min.js","sources":["../../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/component.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * Progress Component\n * 进度组件 - 支持环形和线性进度条\n */\n\nimport { useId, useRef, useEffect, useState, type CSSProperties, type Ref } from 'react'\nimport styles from './component.module.css'\n\nexport interface ProgressProps {\n ref?: Ref<HTMLDivElement>\n /** 当前值 */\n value?: number\n /** 最大值 */\n maxValue?: number\n /** 进度条类型 */\n type?: 'ring' | 'bar'\n /** 是否显示数值 */\n showValue?: boolean\n /** 是否显示标签 */\n showLabel?: boolean\n /** 标签文本 */\n label?: string\n /** 数值格式 */\n valueFormat?: 'percent' | 'number'\n /** 线条宽度比例(相对于尺寸的百分比) */\n strokeWidthRatio?: number\n /** 轨道颜色 */\n trackColor?: string\n /** 进度颜色 */\n progressColor?: string\n /** 是否启用渐变 */\n gradientEnable?: boolean\n /** 渐变颜色 [起始色, 结束色] */\n gradientColors?: [string, string]\n /** 外部样式 */\n style?: CSSProperties\n}\n\n// 格式化数值\nconst formatValue = (value: number, percentage: number, valueFormat: string): string => {\n if (valueFormat === 'percent') {\n return `${Math.round(percentage)}%`\n }\n return `${value}`\n}\n\n// 环形进度条组件\nconst RingProgress = ({\n percentage,\n strokeWidthRatio,\n trackColor,\n progressColor,\n gradientEnable,\n gradientColors,\n showValue,\n showLabel,\n label,\n valueFormat,\n displayColor,\n gradientId,\n}: {\n percentage: number\n strokeWidthRatio: number\n trackColor: string\n progressColor: string\n gradientEnable: boolean\n gradientColors: [string, string]\n showValue: boolean\n showLabel: boolean\n label: string\n valueFormat: string\n displayColor: string\n gradientId: string\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const [size, setSize] = useState(100)\n\n useEffect(() => {\n const container = containerRef.current\n if (!container) {\n return\n }\n\n const updateSize = () => {\n const { width, height } = container.getBoundingClientRect()\n const minSize = Math.min(width, height)\n if (minSize > 0) {\n setSize(minSize)\n }\n }\n\n updateSize()\n\n const resizeObserver = new ResizeObserver(updateSize)\n resizeObserver.observe(container)\n\n return () => resizeObserver.disconnect()\n }, [])\n\n const strokeWidth = Math.max(2, size * strokeWidthRatio)\n const radius = (size - strokeWidth) / 2\n const circumference = 2 * Math.PI * radius\n const strokeDashoffset = circumference - (percentage / 100) * circumference\n const center = size / 2\n\n return (\n <div className={styles.container} ref={containerRef}>\n <svg aria-label='Progress ring' className={styles.ring} height={size} role='img' width={size}>\n <title>Progress indicator</title>\n {gradientEnable ? (\n <defs>\n <linearGradient id={gradientId} x1='0%' x2='100%' y1='0%' y2='0%'>\n <stop offset='0%' stopColor={gradientColors[0]} />\n <stop offset='100%' stopColor={gradientColors[1]} />\n </linearGradient>\n </defs>\n ) : null}\n {/* 轨道 */}\n <circle cx={center} cy={center} fill='none' r={radius} stroke={trackColor} strokeWidth={strokeWidth} />\n {/* 进度 */}\n <circle\n cx={center}\n cy={center}\n fill='none'\n r={radius}\n stroke={gradientEnable ? `url(#${gradientId})` : progressColor}\n strokeDasharray={circumference}\n strokeDashoffset={strokeDashoffset}\n strokeLinecap='round'\n strokeWidth={strokeWidth}\n style={{\n transition: 'stroke-dashoffset 0.5s ease',\n }}\n />\n </svg>\n <div className={styles.centerContent}>\n {showValue ? (\n <span className={styles.value} style={{ fontSize: size * 0.2, color: displayColor }}>\n {formatValue(Math.round(percentage), percentage, valueFormat)}\n </span>\n ) : null}\n {showLabel && label ? (\n <span className={styles.label} style={{ fontSize: size * 0.1 }}>\n {label}\n </span>\n ) : null}\n </div>\n </div>\n )\n}\n\n// 线性进度条组件\nconst BarProgress = ({\n percentage,\n trackColor,\n progressColor,\n gradientEnable,\n gradientColors,\n showValue,\n showLabel,\n label,\n valueFormat,\n displayColor,\n}: {\n percentage: number\n trackColor: string\n progressColor: string\n gradientEnable: boolean\n gradientColors: [string, string]\n showValue: boolean\n showLabel: boolean\n label: string\n valueFormat: string\n displayColor: string\n}) => (\n <div className={styles.barContainer}>\n {showLabel || showValue ? (\n <div className={styles.barLabels}>\n {showLabel ? <span className={styles.barLabel}>{label}</span> : null}\n {showValue ? (\n <span className={styles.barValue} style={{ color: displayColor }}>\n {formatValue(Math.round(percentage), percentage, valueFormat)}\n </span>\n ) : null}\n </div>\n ) : null}\n <div className={styles.barWrapper} style={{ background: trackColor }}>\n <div\n className={styles.barFill}\n style={{\n width: `${percentage}%`,\n background: gradientEnable\n ? `linear-gradient(90deg, ${gradientColors[0]}, ${gradientColors[1]})`\n : progressColor,\n }}\n />\n </div>\n </div>\n)\n\nexport const Progress: React.FC<ProgressProps> = ({\n ref,\n value = 0,\n maxValue = 100,\n type = 'ring',\n showValue = true,\n showLabel = false,\n label = '',\n valueFormat = 'percent',\n strokeWidthRatio = 0.07,\n trackColor = 'rgba(26, 26, 62, 0.8)',\n progressColor = '#00d4ff',\n gradientEnable = false,\n gradientColors = ['#00d4ff', '#9b59b6'],\n style: externalStyle,\n}) => {\n const gradientId = useId()\n\n const normalizedValue = Math.min(Math.max(value, 0), maxValue)\n const percentage = (normalizedValue / maxValue) * 100\n const displayColor = gradientEnable ? gradientColors[0] : progressColor\n\n if (type === 'ring') {\n return (\n <div className={styles.wrapper} ref={ref} style={externalStyle}>\n <RingProgress\n displayColor={displayColor}\n gradientColors={gradientColors}\n gradientEnable={gradientEnable}\n gradientId={gradientId}\n label={label}\n percentage={percentage}\n progressColor={progressColor}\n showLabel={showLabel}\n showValue={showValue}\n strokeWidthRatio={strokeWidthRatio}\n trackColor={trackColor}\n valueFormat={valueFormat}\n />\n </div>\n )\n }\n\n return (\n <div className={styles.wrapper} ref={ref} style={externalStyle}>\n <BarProgress\n displayColor={displayColor}\n gradientColors={gradientColors}\n gradientEnable={gradientEnable}\n label={label}\n percentage={percentage}\n progressColor={progressColor}\n showLabel={showLabel}\n showValue={showValue}\n trackColor={trackColor}\n valueFormat={valueFormat}\n />\n </div>\n )\n}\n\nexport default Progress\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","formatValue","value","percentage","valueFormat","Math","round","RingProgress","strokeWidthRatio","trackColor","progressColor","gradientEnable","gradientColors","showValue","showLabel","label","displayColor","gradientId","containerRef","useRef","size","setSize","useState","useEffect","container","current","updateSize","width","height","getBoundingClientRect","minSize","min","resizeObserver","ResizeObserver","observe","disconnect","strokeWidth","max","radius","circumference","PI","strokeDashoffset","center","_jsxs","className","styles","children","role","_jsx","id","x1","x2","y1","y2","offset","stopColor","cx","cy","fill","r","stroke","strokeDasharray","strokeLinecap","transition","fontSize","color","BarProgress","background","Progress","maxValue","externalStyle","useId"],"mappings":"40BAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,mqCCcA,MAAMe,EAAcA,CAACC,EAAeC,EAAoBC,IAClC,YAAhBA,EACK,GAAGC,KAAKC,MAAMH,MAEhB,GAAGD,IAINK,EAAeA,EACnBJ,aACAK,mBACAC,aACAC,gBACAC,iBACAC,iBACAC,YACAC,YACAC,QACAX,cACAY,eACAC,iBAeA,MAAMC,EAAeC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