@pittorica/progress-react 0.24.0 → 0.26.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/README.md +10 -1
- package/dist/Progress.d.ts +9 -6
- package/dist/Progress.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +87 -139
- package/package.json +10 -10
- package/dist/Progress.stories.d.ts +0 -13
- package/dist/Progress.stories.d.ts.map +0 -1
- package/dist/Progress.test.d.ts +0 -5
- package/dist/Progress.test.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -12,7 +12,16 @@ npm install @pittorica/progress-react
|
|
|
12
12
|
|
|
13
13
|
```jsx
|
|
14
14
|
import { Progress } from '@pittorica/progress-react';
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
function MyComponent() {
|
|
17
|
+
return (
|
|
18
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
19
|
+
<Progress value={45} color="indigo" />
|
|
20
|
+
<Progress value={100} color="success" />
|
|
21
|
+
<Progress value={15} color="danger" />
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
16
25
|
```
|
|
17
26
|
|
|
18
27
|
## License
|
package/dist/Progress.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
import { type ElementType } from 'react';
|
|
1
2
|
import { type BoxProps } from '@pittorica/box-react';
|
|
2
3
|
import type { PittoricaColor } from '@pittorica/text-react';
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Fix TS2314 & TS2312: Use 'type' alias for intersection with polymorphic BoxProps<E>.
|
|
6
|
+
*/
|
|
7
|
+
export type ProgressProps<E extends ElementType = 'div'> = BoxProps<E> & {
|
|
4
8
|
/** @default 0 */
|
|
5
9
|
value?: number;
|
|
6
10
|
/** @default 100 */
|
|
7
11
|
max?: number;
|
|
8
12
|
/** @default 'indigo' */
|
|
9
13
|
color?: PittoricaColor;
|
|
10
|
-
|
|
11
|
-
variant?: 'default' | 'wave';
|
|
12
|
-
}
|
|
14
|
+
};
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Progress component displays an indicator of the status of a task or process.
|
|
17
|
+
* Fully polymorphic and agnostic foundation.
|
|
15
18
|
*/
|
|
16
19
|
export declare const Progress: {
|
|
17
|
-
({ value, max, color,
|
|
20
|
+
<E extends ElementType = "div">({ value, max, color, className, style, as, ...props }: ProgressProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
18
21
|
displayName: string;
|
|
19
22
|
};
|
|
20
23
|
//# sourceMappingURL=Progress.d.ts.map
|
package/dist/Progress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../src/Progress.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../src/Progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAI7D,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG;IACvE,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ;KAAI,CAAC,SAAS,WAAW,iEAQ3C,aAAa,CAAC,CAAC,CAAC;;CAgClB,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,163 +1,111 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (typeof
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return r;
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
function N(a) {
|
|
3
|
+
var e, i, t = "";
|
|
4
|
+
if (typeof a == "string" || typeof a == "number") t += a;
|
|
5
|
+
else if (typeof a == "object") if (Array.isArray(a)) {
|
|
6
|
+
var p = a.length;
|
|
7
|
+
for (e = 0; e < p; e++) a[e] && (i = N(a[e])) && (t && (t += " "), t += i);
|
|
8
|
+
} else for (i in a) a[i] && (t && (t += " "), t += i);
|
|
9
|
+
return t;
|
|
11
10
|
}
|
|
12
|
-
function
|
|
13
|
-
for (var
|
|
14
|
-
return
|
|
11
|
+
function M() {
|
|
12
|
+
for (var a, e, i = 0, t = "", p = arguments.length; i < p; i++) (a = arguments[i]) && (e = N(a)) && (t && (t += " "), t += e);
|
|
13
|
+
return t;
|
|
15
14
|
}
|
|
16
|
-
function
|
|
17
|
-
var e, i,
|
|
18
|
-
if (typeof
|
|
19
|
-
else if (typeof
|
|
20
|
-
var
|
|
21
|
-
for (e = 0; e <
|
|
22
|
-
} else for (i in
|
|
23
|
-
return
|
|
15
|
+
function T(a) {
|
|
16
|
+
var e, i, t = "";
|
|
17
|
+
if (typeof a == "string" || typeof a == "number") t += a;
|
|
18
|
+
else if (typeof a == "object") if (Array.isArray(a)) {
|
|
19
|
+
var p = a.length;
|
|
20
|
+
for (e = 0; e < p; e++) a[e] && (i = T(a[e])) && (t && (t += " "), t += i);
|
|
21
|
+
} else for (i in a) a[i] && (t && (t += " "), t += i);
|
|
22
|
+
return t;
|
|
24
23
|
}
|
|
25
|
-
function
|
|
26
|
-
for (var
|
|
27
|
-
return
|
|
24
|
+
function P() {
|
|
25
|
+
for (var a, e, i = 0, t = "", p = arguments.length; i < p; i++) (a = arguments[i]) && (e = T(a)) && (t && (t += " "), t += e);
|
|
26
|
+
return t;
|
|
28
27
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
disabled: M,
|
|
56
|
-
...S
|
|
28
|
+
const w = ({
|
|
29
|
+
as: a,
|
|
30
|
+
children: e,
|
|
31
|
+
display: i,
|
|
32
|
+
m: t,
|
|
33
|
+
mt: p,
|
|
34
|
+
mr: n,
|
|
35
|
+
mb: o,
|
|
36
|
+
ml: c,
|
|
37
|
+
mx: g,
|
|
38
|
+
my: s,
|
|
39
|
+
p: d,
|
|
40
|
+
pt: h,
|
|
41
|
+
pr: l,
|
|
42
|
+
pb: u,
|
|
43
|
+
pl: y,
|
|
44
|
+
px: m,
|
|
45
|
+
py: v,
|
|
46
|
+
width: $,
|
|
47
|
+
height: b,
|
|
48
|
+
position: x,
|
|
49
|
+
style: A,
|
|
50
|
+
className: B,
|
|
51
|
+
disabled: L,
|
|
52
|
+
required: R,
|
|
53
|
+
...j
|
|
57
54
|
}) => {
|
|
58
|
-
const a = {};
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
...
|
|
62
|
-
...
|
|
55
|
+
const q = a || "div", r = {};
|
|
56
|
+
i && (r.display = i), $ && (r.width = $), b && (r.height = b), x && (r.position = x), t && (r.margin = `var(--pittorica-space-${t})`), p && (r.marginTop = `var(--pittorica-space-${p})`), n && (r.marginRight = `var(--pittorica-space-${n})`), o && (r.marginBottom = `var(--pittorica-space-${o})`), c && (r.marginLeft = `var(--pittorica-space-${c})`), g && (r.marginLeft = `var(--pittorica-space-${g})`, r.marginRight = `var(--pittorica-space-${g})`), s && (r.marginTop = `var(--pittorica-space-${s})`, r.marginBottom = `var(--pittorica-space-${s})`), d && (r.padding = `var(--pittorica-space-${d})`), h && (r.paddingTop = `var(--pittorica-space-${h})`), l && (r.paddingRight = `var(--pittorica-space-${l})`), u && (r.paddingBottom = `var(--pittorica-space-${u})`), y && (r.paddingLeft = `var(--pittorica-space-${y})`), m && (r.paddingLeft = `var(--pittorica-space-${m})`, r.paddingRight = `var(--pittorica-space-${m})`), v && (r.paddingTop = `var(--pittorica-space-${v})`, r.paddingBottom = `var(--pittorica-space-${v})`);
|
|
57
|
+
const S = {
|
|
58
|
+
...A,
|
|
59
|
+
...r
|
|
63
60
|
};
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
61
|
+
return /* @__PURE__ */ f(
|
|
62
|
+
q,
|
|
66
63
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
htmlFor: B,
|
|
74
|
-
type: I,
|
|
75
|
-
name: L,
|
|
76
|
-
disabled: M,
|
|
77
|
-
...S,
|
|
78
|
-
children: i
|
|
64
|
+
className: P("pittorica-box", B),
|
|
65
|
+
style: S,
|
|
66
|
+
disabled: L,
|
|
67
|
+
required: R,
|
|
68
|
+
...j,
|
|
69
|
+
children: e
|
|
79
70
|
}
|
|
80
71
|
);
|
|
81
72
|
};
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
value:
|
|
73
|
+
w.displayName = "Box";
|
|
74
|
+
const W = ({
|
|
75
|
+
value: a = 0,
|
|
85
76
|
max: e = 100,
|
|
86
77
|
color: i = "indigo",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
...
|
|
78
|
+
className: t,
|
|
79
|
+
style: p,
|
|
80
|
+
as: n,
|
|
81
|
+
...o
|
|
91
82
|
}) => {
|
|
92
|
-
const
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
|
|
83
|
+
const c = Math.min(Math.max(0, a / e * 100), 100), s = i !== "inherit" && !(i != null && i.startsWith("#")) && !(i != null && i.startsWith("rgb")) ? `var(--pittorica-${i}-9)` : i;
|
|
84
|
+
return /* @__PURE__ */ f(
|
|
85
|
+
w,
|
|
95
86
|
{
|
|
96
|
-
|
|
87
|
+
as: n || "div",
|
|
97
88
|
role: "progressbar",
|
|
98
|
-
"aria-valuenow":
|
|
89
|
+
"aria-valuenow": a,
|
|
99
90
|
"aria-valuemin": 0,
|
|
100
91
|
"aria-valuemax": e,
|
|
101
|
-
className:
|
|
92
|
+
className: M("pittorica-progress-root", t),
|
|
102
93
|
style: {
|
|
103
|
-
"--pittorica-source-color":
|
|
104
|
-
...
|
|
94
|
+
"--pittorica-source-color": s,
|
|
95
|
+
...p
|
|
105
96
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
r === "wave" && /* @__PURE__ */ b("svg", { className: "pittorica-progress-svg", children: [
|
|
115
|
-
/* @__PURE__ */ n("defs", { children: /* @__PURE__ */ n(
|
|
116
|
-
"pattern",
|
|
117
|
-
{
|
|
118
|
-
id: o,
|
|
119
|
-
width: "24",
|
|
120
|
-
height: "16",
|
|
121
|
-
patternUnits: "userSpaceOnUse",
|
|
122
|
-
children: /* @__PURE__ */ n(
|
|
123
|
-
"path",
|
|
124
|
-
{
|
|
125
|
-
d: "M0 8 Q6 0 12 8 T24 8",
|
|
126
|
-
stroke: "white",
|
|
127
|
-
strokeWidth: "2",
|
|
128
|
-
strokeLinecap: "round",
|
|
129
|
-
fill: "none",
|
|
130
|
-
opacity: "0.5",
|
|
131
|
-
children: /* @__PURE__ */ n(
|
|
132
|
-
"animateTransform",
|
|
133
|
-
{
|
|
134
|
-
attributeName: "transform",
|
|
135
|
-
type: "translate",
|
|
136
|
-
from: "0 0",
|
|
137
|
-
to: "24 0",
|
|
138
|
-
dur: "1s",
|
|
139
|
-
repeatCount: "indefinite"
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
) }),
|
|
146
|
-
/* @__PURE__ */ n(
|
|
147
|
-
"rect",
|
|
148
|
-
{
|
|
149
|
-
width: `${p}%`,
|
|
150
|
-
height: "100%",
|
|
151
|
-
fill: `url(#${o})`,
|
|
152
|
-
style: { transition: "width 660ms cubic-bezier(0.65, 0, 0.35, 1)" }
|
|
153
|
-
}
|
|
154
|
-
)
|
|
155
|
-
] })
|
|
156
|
-
]
|
|
97
|
+
...o,
|
|
98
|
+
children: /* @__PURE__ */ f(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: "pittorica-progress-indicator",
|
|
102
|
+
style: { width: `${c}%` }
|
|
103
|
+
}
|
|
104
|
+
)
|
|
157
105
|
}
|
|
158
106
|
);
|
|
159
107
|
};
|
|
160
|
-
|
|
108
|
+
W.displayName = "Progress";
|
|
161
109
|
export {
|
|
162
|
-
|
|
110
|
+
W as Progress
|
|
163
111
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pittorica/progress-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
|
+
"homepage": "https://pittorica.dcdavidev.me",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"main": "./dist/index.js",
|
|
6
7
|
"module": "./dist/index.js",
|
|
@@ -10,8 +11,8 @@
|
|
|
10
11
|
],
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"clsx": "^2.1.1",
|
|
13
|
-
"@pittorica/
|
|
14
|
-
"@pittorica/
|
|
14
|
+
"@pittorica/text-react": "0.26.0",
|
|
15
|
+
"@pittorica/box-react": "0.26.0"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
18
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -21,11 +22,11 @@
|
|
|
21
22
|
"@vitejs/plugin-react": "^4.0.0",
|
|
22
23
|
"jsdom": "^22.0.0",
|
|
23
24
|
"typescript": "^5.0.0",
|
|
24
|
-
"vite": "^
|
|
25
|
-
"vitest": "^2.
|
|
26
|
-
"@pittorica/
|
|
27
|
-
"@pittorica/
|
|
28
|
-
"pittorica": "0.
|
|
25
|
+
"vite": "^6.4.1",
|
|
26
|
+
"vitest": "^3.2.4",
|
|
27
|
+
"@pittorica/theme-react": "0.26.0",
|
|
28
|
+
"@pittorica/flex-react": "0.26.0",
|
|
29
|
+
"pittorica": "0.26.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"react": ">=19",
|
|
@@ -35,8 +36,7 @@
|
|
|
35
36
|
"build": "npm run clean && npm run build:js && npm run build:types",
|
|
36
37
|
"build:js": "vite build",
|
|
37
38
|
"build:types": "tsc -p tsconfig.json",
|
|
38
|
-
"clean": "rm -rf dist",
|
|
39
|
-
"dev": "vite",
|
|
39
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
40
40
|
"test": "vitest run",
|
|
41
41
|
"test:watch": "vitest"
|
|
42
42
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Progress } from './Progress.js';
|
|
3
|
-
declare const meta: Meta<typeof Progress>;
|
|
4
|
-
export default meta;
|
|
5
|
-
export declare const Basic: StoryObj<typeof Progress>;
|
|
6
|
-
export declare const FunkyWave: StoryObj<typeof Progress>;
|
|
7
|
-
/**
|
|
8
|
-
* A story that demonstrates the progress bar moving dynamically.
|
|
9
|
-
*/
|
|
10
|
-
export declare const AnimatedShowcase: {
|
|
11
|
-
render: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=Progress.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.stories.d.ts","sourceRoot":"","sources":["../src/Progress.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAI/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,OAAO,QAAQ,CAK3C,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,OAAO,QAAQ,CAO/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;CAyC5B,CAAC"}
|
package/dist/Progress.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.test.d.ts","sourceRoot":"","sources":["../src/Progress.test.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,2BAA2B,CAAC"}
|