@itera-web/react-ui-progress 1.23.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.md ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1 @@
1
+ ### [使用文档](http://iterative.keyboardecho.com/)
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ interface CheckIconProps {
3
+ /** 图标大小,默认 1em,可根据需求调整 */
4
+ size?: number;
5
+ /** 背景颜色,默认绿色 */
6
+ bgColor?: string;
7
+ /** 对号颜色,默认白色 */
8
+ color?: string;
9
+ /** 是否圆形背景,默认 true */
10
+ rounded?: boolean;
11
+ className?: string;
12
+ }
13
+ export declare const CheckIcon: React.FC<CheckIconProps>;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import * as ProgressPrimitive from '@radix-ui/react-progress';
3
+ type Status = 'normal' | 'active' | 'exception' | 'success';
4
+ interface CustomProgressProps extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {
5
+ value?: number;
6
+ status?: Status;
7
+ size?: number;
8
+ circle?: boolean;
9
+ strokeWidth?: number;
10
+ trailColor?: string;
11
+ gradient?: string[];
12
+ format?: (value: number) => React.ReactNode;
13
+ }
14
+ declare const Progress: React.ForwardRefExoticComponent<CustomProgressProps & React.RefAttributes<HTMLDivElement | SVGSVGElement>>;
15
+ export { Progress };
package/es/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { Progress } from './Progress';
package/es/index.js ADDED
@@ -0,0 +1 @@
1
+ import*as e from"react";import*as t from"@itera-web/utils-cn";import*as r from"@radix-ui/react-progress";var n={d:(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},a={};n.d(a,{E:()=>u});const o=(e=>{var t={};return n.d(t,e),t})({createElement:()=>e.createElement,forwardRef:()=>e.forwardRef,useId:()=>e.useId,useMemo:()=>e.useMemo});const c=(e=>{var t={};return n.d(t,e),t})({cn:()=>t.cn});const s=(e=>{var t={};return n.d(t,e),t})({Indicator:()=>r.Indicator,Root:()=>r.Root});var l=function(e){var t=e.size,r=void 0===t?14:t,n=e.bgColor,a=void 0===n?"#22c55e":n,c=e.color,s=void 0===c?"#fff":c,l=e.rounded,i=void 0===l||l,d=e.className;return o.createElement("span",{className:"".concat(i?"rounded-full":""," inline-flex items-center justify-center ").concat(d||""),style:{backgroundColor:a,width:r+"px",height:r+"px",lineHeight:0}},o.createElement("svg",{"aria-hidden":"true","data-icon":"check",fill:s,focusable:"false",height:r/2+"px",style:{transform:"scale(1.2)"},viewBox:"64 64 896 896",width:r/2+"px"},o.createElement("path",{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"})))},i=function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},i.apply(this,arguments)},d=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},u=o.forwardRef(function(e,t){var r=e.className,n=e.value,a=void 0===n?0:n,u=e.status,f=void 0===u?"normal":u,m=e.size,p=void 0===m?60:m,g=e.circle,h=void 0!==g&&g,v=e.strokeWidth,x=void 0===v?6:v,y=e.trailColor,b=void 0===y?"#f5f5f5":y,k=e.gradient,E=void 0===k?[]:k,w=e.format,O=d(e,["className","value","status","size","circle","strokeWidth","trailColor","gradient","format"]),M=o.useMemo(function(){return Math.max(0,Math.min(100,a))},[a]),N=o.useMemo(function(){return w?w(Math.round(M)):"".concat(Math.round(M),"%")},[w,M]),j=o.useMemo(function(){return{normal:"text-emerald-500 stroke-emerald-500 bg-emerald-500",active:"text-blue-500 stroke-blue-500 bg-blue-500 animate-pulse",exception:"text-red-500 stroke-red-500 bg-red-500",success:"text-green-500 stroke-green-500 bg-green-500"}[f]},[f]),P=o.useMemo(function(){return E&&0!==E.length?{width:"".concat(M,"%"),background:"linear-gradient(90deg, ".concat(E.map(function(e,t){return"".concat(e," ").concat(t/(E.length-1)*100,"%")}).join(", "),")")}:{width:"".concat(M,"%")}},[M,E]);if(h){var I=p/2,C=I-x/2,R=2*Math.PI*C,z=o.useMemo(function(){return R-M/100*R},[M,R]),W=o.useId(),D=E.length>1,L=o.useMemo(function(){return D&&o.createElement("defs",null,o.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:W,x1:"-100%",x2:"100%",y1:"0%",y2:"0%"},E.map(function(e,t){return o.createElement("stop",{key:t,offset:"".concat(t/(E.length-1)*100,"%"),stopColor:e})})))},[E,W,D]);return o.createElement("div",{className:(0,c.cn)("relative inline-block",r),ref:t,style:{width:p,height:p}},o.createElement("svg",{className:"block",height:p,role:"presentation",shapeRendering:"geometricPrecision",viewBox:"-".concat(I," -").concat(I," ").concat(p," ").concat(p),width:p},L,o.createElement("circle",{cx:0,cy:0,fill:"transparent",r:C,stroke:b,strokeLinecap:"round",strokeWidth:x,style:{strokeDasharray:"".concat(R,"px, ").concat(R,"px"),transform:"rotate(-90deg)",transformOrigin:"0px 0px"},vectorEffect:"non-scaling-stroke"}),o.createElement("circle",{cx:0,cy:0,fill:"transparent",r:C,stroke:D?"url(#".concat(W,")"):"currentColor",strokeLinecap:"round",strokeWidth:x,style:{strokeDasharray:"".concat(R,"px, ").concat(R,"px"),strokeDashoffset:z,transform:"rotate(-90deg)",transformOrigin:"0px 0px",transition:"stroke-dashoffset 0.3s ease, stroke 0.3s ease"},vectorEffect:"non-scaling-stroke"})),o.createElement("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center w-[88%]"},M>=100&&!w?o.createElement(l,{bgColor:"transparent",color:"#22c55e",size:p/2}):o.createElement("span",{className:"text-center text-lg font-medium text-font"},N)))}return o.createElement("div",{className:"w-full relative flex items-center gap-2"},o.createElement(s.Root,i({className:(0,c.cn)("relative h-[10px] w-full overflow-hidden rounded-full bg-section",r),ref:t},O),o.createElement(s.Indicator,{className:(0,c.cn)("h-full transition-all rounded-full",j),style:P})),N&&o.createElement("span",{className:(0,c.cn)("whitespace-nowrap text-sm text-font")},M>=100&&!w?o.createElement(l,{className:"ml-1"}):N))});u.displayName="Progress";var f=a.E;export{f as Progress};
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@itera-web/react-ui-progress",
3
+ "description": "进度条",
4
+ "version": "1.23.0",
5
+ "main": "es/index.js",
6
+ "types": "es/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "license": "MIT",
11
+ "scripts": {
12
+ "build": "itera-cli package",
13
+ "up": "npm publish"
14
+ },
15
+ "dependencies": {
16
+ "@itera-web/utils-cn": "^1.20.0",
17
+ "@radix-ui/react-progress": "^1.1.3"
18
+ },
19
+ "peerDependencies": {
20
+ "react": ">=17.0.0",
21
+ "react-dom": ">=17.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "@itera-web/cli": "^1.1.45"
25
+ },
26
+ "gitHead": "691b2592db8668e5d52c9712bb906484b92cb79b"
27
+ }