@pittorica/progress-react 0.24.0 → 0.25.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/dist/Progress.d.ts +8 -3
- package/dist/Progress.d.ts.map +1 -1
- package/dist/index.js +80 -88
- package/package.json +6 -7
package/dist/Progress.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
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 */
|
|
@@ -9,12 +13,13 @@ export interface ProgressProps extends BoxProps {
|
|
|
9
13
|
color?: PittoricaColor;
|
|
10
14
|
/** @default 'default' */
|
|
11
15
|
variant?: 'default' | 'wave';
|
|
12
|
-
}
|
|
16
|
+
};
|
|
13
17
|
/**
|
|
14
18
|
* Funky Progress component using SVG Patterns for decorative effects.
|
|
19
|
+
* Fully polymorphic and agnostic foundation.
|
|
15
20
|
*/
|
|
16
21
|
export declare const Progress: {
|
|
17
|
-
({ value, max, color, variant, className, style, ...props }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
<E extends ElementType = "div">({ value, max, color, variant, className, style, as, ...props }: ProgressProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
18
23
|
displayName: string;
|
|
19
24
|
};
|
|
20
25
|
//# 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,EAAS,MAAM,OAAO,CAAC;AAIpE,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;IACvB,yBAAyB;IACzB,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ;KAAI,CAAC,SAAS,WAAW,0EAS3C,aAAa,CAAC,CAAC,CAAC;;CAwElB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,125 +1,117 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useId as
|
|
3
|
-
function
|
|
4
|
-
var e, i,
|
|
5
|
-
if (typeof t == "string" || typeof t == "number")
|
|
1
|
+
import { jsx as p, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { useId as M } from "react";
|
|
3
|
+
function N(t) {
|
|
4
|
+
var e, i, a = "";
|
|
5
|
+
if (typeof t == "string" || typeof t == "number") a += t;
|
|
6
6
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
7
7
|
var s = t.length;
|
|
8
|
-
for (e = 0; e < s; e++) t[e] && (i =
|
|
9
|
-
} else for (i in t) t[i] && (
|
|
10
|
-
return
|
|
8
|
+
for (e = 0; e < s; e++) t[e] && (i = N(t[e])) && (a && (a += " "), a += i);
|
|
9
|
+
} else for (i in t) t[i] && (a && (a += " "), a += i);
|
|
10
|
+
return a;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
for (var t, e, i = 0,
|
|
14
|
-
return
|
|
12
|
+
function S() {
|
|
13
|
+
for (var t, e, i = 0, a = "", s = arguments.length; i < s; i++) (t = arguments[i]) && (e = N(t)) && (a && (a += " "), a += e);
|
|
14
|
+
return a;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
var e, i,
|
|
18
|
-
if (typeof t == "string" || typeof t == "number")
|
|
16
|
+
function T(t) {
|
|
17
|
+
var e, i, a = "";
|
|
18
|
+
if (typeof t == "string" || typeof t == "number") a += t;
|
|
19
19
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
20
20
|
var s = t.length;
|
|
21
|
-
for (e = 0; e < s; e++) t[e] && (i =
|
|
22
|
-
} else for (i in t) t[i] && (
|
|
23
|
-
return
|
|
21
|
+
for (e = 0; e < s; e++) t[e] && (i = T(t[e])) && (a && (a += " "), a += i);
|
|
22
|
+
} else for (i in t) t[i] && (a && (a += " "), a += i);
|
|
23
|
+
return a;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
for (var t, e, i = 0,
|
|
27
|
-
return
|
|
25
|
+
function W() {
|
|
26
|
+
for (var t, e, i = 0, a = "", s = arguments.length; i < s; i++) (t = arguments[i]) && (e = T(t)) && (a && (a += " "), a += e);
|
|
27
|
+
return a;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
mt: c,
|
|
29
|
+
const A = ({
|
|
30
|
+
as: t,
|
|
31
|
+
children: e,
|
|
32
|
+
display: i,
|
|
33
|
+
m: a,
|
|
34
|
+
mt: s,
|
|
36
35
|
mr: d,
|
|
37
|
-
mb:
|
|
38
|
-
ml:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
mb: g,
|
|
37
|
+
ml: m,
|
|
38
|
+
mx: o,
|
|
39
|
+
my: n,
|
|
40
|
+
p: f,
|
|
41
|
+
pt: h,
|
|
42
|
+
pr: c,
|
|
42
43
|
pb: l,
|
|
43
|
-
pl:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
pl: y,
|
|
45
|
+
px: v,
|
|
46
|
+
py: u,
|
|
47
|
+
width: $,
|
|
48
|
+
height: b,
|
|
49
|
+
position: w,
|
|
50
|
+
style: L,
|
|
48
51
|
className: j,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
rel: k,
|
|
52
|
-
htmlFor: B,
|
|
53
|
-
type: I,
|
|
54
|
-
name: L,
|
|
55
|
-
disabled: M,
|
|
56
|
-
...S
|
|
52
|
+
disabled: k,
|
|
53
|
+
...B
|
|
57
54
|
}) => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
...
|
|
62
|
-
...
|
|
55
|
+
const R = t || "div", r = {};
|
|
56
|
+
i && (r.display = i), $ && (r.width = $), b && (r.height = b), w && (r.position = w), a && (r.margin = `var(--pittorica-space-${a})`), s && (r.marginTop = `var(--pittorica-space-${s})`), d && (r.marginRight = `var(--pittorica-space-${d})`), g && (r.marginBottom = `var(--pittorica-space-${g})`), m && (r.marginLeft = `var(--pittorica-space-${m})`), o && (r.marginLeft = `var(--pittorica-space-${o})`, r.marginRight = `var(--pittorica-space-${o})`), n && (r.marginTop = `var(--pittorica-space-${n})`, r.marginBottom = `var(--pittorica-space-${n})`), f && (r.padding = `var(--pittorica-space-${f})`), h && (r.paddingTop = `var(--pittorica-space-${h})`), c && (r.paddingRight = `var(--pittorica-space-${c})`), l && (r.paddingBottom = `var(--pittorica-space-${l})`), y && (r.paddingLeft = `var(--pittorica-space-${y})`), v && (r.paddingLeft = `var(--pittorica-space-${v})`, r.paddingRight = `var(--pittorica-space-${v})`), u && (r.paddingTop = `var(--pittorica-space-${u})`, r.paddingBottom = `var(--pittorica-space-${u})`);
|
|
57
|
+
const I = {
|
|
58
|
+
...L,
|
|
59
|
+
...r
|
|
63
60
|
};
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
61
|
+
return /* @__PURE__ */ p(
|
|
62
|
+
R,
|
|
66
63
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
rel: k,
|
|
73
|
-
htmlFor: B,
|
|
74
|
-
type: I,
|
|
75
|
-
name: L,
|
|
76
|
-
disabled: M,
|
|
77
|
-
...S,
|
|
78
|
-
children: i
|
|
64
|
+
className: W("pittorica-box", j),
|
|
65
|
+
style: I,
|
|
66
|
+
disabled: k,
|
|
67
|
+
...B,
|
|
68
|
+
children: e
|
|
79
69
|
}
|
|
80
70
|
);
|
|
81
71
|
};
|
|
82
|
-
|
|
83
|
-
const
|
|
72
|
+
A.displayName = "Box";
|
|
73
|
+
const C = ({
|
|
84
74
|
value: t = 0,
|
|
85
75
|
max: e = 100,
|
|
86
76
|
color: i = "indigo",
|
|
87
|
-
variant:
|
|
77
|
+
variant: a = "default",
|
|
88
78
|
className: s,
|
|
89
|
-
style:
|
|
90
|
-
|
|
79
|
+
style: d,
|
|
80
|
+
as: g,
|
|
81
|
+
...m
|
|
91
82
|
}) => {
|
|
92
|
-
const
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
|
|
83
|
+
const o = M(), n = Math.min(Math.max(0, t / e * 100), 100), h = i !== "inherit" && !(i != null && i.startsWith("#")) && !(i != null && i.startsWith("rgb")) ? `var(--pittorica-${i}-9)` : i, c = `pittorica-progress-pattern-${o}`;
|
|
84
|
+
return /* @__PURE__ */ x(
|
|
85
|
+
A,
|
|
95
86
|
{
|
|
96
|
-
|
|
87
|
+
as: g || "div",
|
|
97
88
|
role: "progressbar",
|
|
98
89
|
"aria-valuenow": t,
|
|
99
90
|
"aria-valuemin": 0,
|
|
100
91
|
"aria-valuemax": e,
|
|
101
|
-
className:
|
|
92
|
+
className: S("pittorica-progress-root", s),
|
|
102
93
|
style: {
|
|
103
|
-
"--pittorica-source-color":
|
|
104
|
-
...
|
|
94
|
+
"--pittorica-source-color": h,
|
|
95
|
+
...d
|
|
105
96
|
},
|
|
97
|
+
...m,
|
|
106
98
|
children: [
|
|
107
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ p(
|
|
108
100
|
"div",
|
|
109
101
|
{
|
|
110
102
|
className: "pittorica-progress-indicator",
|
|
111
|
-
style: { width: `${
|
|
103
|
+
style: { width: `${n}%` }
|
|
112
104
|
}
|
|
113
105
|
),
|
|
114
|
-
|
|
115
|
-
/* @__PURE__ */
|
|
106
|
+
a === "wave" && /* @__PURE__ */ x("svg", { className: "pittorica-progress-svg", children: [
|
|
107
|
+
/* @__PURE__ */ p("defs", { children: /* @__PURE__ */ p(
|
|
116
108
|
"pattern",
|
|
117
109
|
{
|
|
118
|
-
id:
|
|
110
|
+
id: c,
|
|
119
111
|
width: "24",
|
|
120
112
|
height: "16",
|
|
121
113
|
patternUnits: "userSpaceOnUse",
|
|
122
|
-
children: /* @__PURE__ */
|
|
114
|
+
children: /* @__PURE__ */ p(
|
|
123
115
|
"path",
|
|
124
116
|
{
|
|
125
117
|
d: "M0 8 Q6 0 12 8 T24 8",
|
|
@@ -128,7 +120,7 @@ const P = ({
|
|
|
128
120
|
strokeLinecap: "round",
|
|
129
121
|
fill: "none",
|
|
130
122
|
opacity: "0.5",
|
|
131
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ p(
|
|
132
124
|
"animateTransform",
|
|
133
125
|
{
|
|
134
126
|
attributeName: "transform",
|
|
@@ -143,12 +135,12 @@ const P = ({
|
|
|
143
135
|
)
|
|
144
136
|
}
|
|
145
137
|
) }),
|
|
146
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ p(
|
|
147
139
|
"rect",
|
|
148
140
|
{
|
|
149
|
-
width: `${
|
|
141
|
+
width: `${n}%`,
|
|
150
142
|
height: "100%",
|
|
151
|
-
fill: `url(#${
|
|
143
|
+
fill: `url(#${c})`,
|
|
152
144
|
style: { transition: "width 660ms cubic-bezier(0.65, 0, 0.35, 1)" }
|
|
153
145
|
}
|
|
154
146
|
)
|
|
@@ -157,7 +149,7 @@ const P = ({
|
|
|
157
149
|
}
|
|
158
150
|
);
|
|
159
151
|
};
|
|
160
|
-
|
|
152
|
+
C.displayName = "Progress";
|
|
161
153
|
export {
|
|
162
|
-
|
|
154
|
+
C as Progress
|
|
163
155
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pittorica/progress-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"clsx": "^2.1.1",
|
|
13
|
-
"@pittorica/box-react": "0.
|
|
14
|
-
"@pittorica/text-react": "0.
|
|
13
|
+
"@pittorica/box-react": "0.25.0",
|
|
14
|
+
"@pittorica/text-react": "0.25.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"typescript": "^5.0.0",
|
|
24
24
|
"vite": "^5.0.0",
|
|
25
25
|
"vitest": "^2.1.9",
|
|
26
|
-
"@pittorica/flex-react": "0.
|
|
27
|
-
"@pittorica/theme-react": "0.
|
|
28
|
-
"pittorica": "0.
|
|
26
|
+
"@pittorica/flex-react": "0.25.0",
|
|
27
|
+
"@pittorica/theme-react": "0.25.0",
|
|
28
|
+
"pittorica": "0.25.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": ">=19",
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"build:js": "vite build",
|
|
37
37
|
"build:types": "tsc -p tsconfig.json",
|
|
38
38
|
"clean": "rm -rf dist",
|
|
39
|
-
"dev": "vite",
|
|
40
39
|
"test": "vitest run",
|
|
41
40
|
"test:watch": "vitest"
|
|
42
41
|
}
|