@pindoba/astro-progress 0.0.0-alpha-20260426220647
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 +12 -0
- package/index.ts +4 -0
- package/package.json +45 -0
- package/src/Progress.astro +40 -0
- package/src/demos/custom.astro +72 -0
- package/src/demos/feedback.astro +51 -0
- package/src/demos/index.ts +5 -0
- package/src/demos/label.astro +68 -0
- package/src/demos/size.astro +34 -0
- package/src/demos/variants.astro +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright 2025 Eduardo Lopes
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
8
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
9
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
|
10
|
+
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
11
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
12
|
+
DEALINGS IN THE SOFTWARE.
|
package/index.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pindoba/astro-progress",
|
|
3
|
+
"version": "0.0.0-alpha-20260426220647",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.ts",
|
|
9
|
+
"./Progress": "./src/Progress.astro",
|
|
10
|
+
"./demos": "./src/demos/index.ts",
|
|
11
|
+
"./demos/variants": "./src/demos/variants.astro",
|
|
12
|
+
"./demos/feedback": "./src/demos/feedback.astro",
|
|
13
|
+
"./demos/size": "./src/demos/size.astro",
|
|
14
|
+
"./demos/label": "./src/demos/label.astro",
|
|
15
|
+
"./demos/custom": "./src/demos/custom.astro"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"src",
|
|
19
|
+
"index.ts"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"astro-component"
|
|
23
|
+
],
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@astrojs/check": "^0.9.8",
|
|
26
|
+
"astro": "^6.1.9",
|
|
27
|
+
"typescript": "^6.0.3"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"astro": "^4.0.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@pindoba/core-progress": "0.0.0-alpha-20260426220647",
|
|
34
|
+
"@pindoba/styled-system": "0.0.0-alpha-20260426220647"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"check": "astro check",
|
|
38
|
+
"dev": "astro check --watch",
|
|
39
|
+
"lint": "TIMING=1 eslint . --max-warnings 0",
|
|
40
|
+
"lint:fix": "TIMING=1 eslint . --fix --max-warnings 0",
|
|
41
|
+
"format": "prettier --check .",
|
|
42
|
+
"format:fix": "prettier --write .",
|
|
43
|
+
"clean": "rm -rf .astro && rm -rf node_modules && rm -rf .turbo"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
import {
|
|
3
|
+
connectProgress,
|
|
4
|
+
type ProgressBaseProps as ProgressCoreBaseProps,
|
|
5
|
+
} from "@pindoba/core-progress";
|
|
6
|
+
import type { HTMLAttributes } from "astro/types";
|
|
7
|
+
|
|
8
|
+
type ProgressBaseProps = ProgressCoreBaseProps<
|
|
9
|
+
HTMLAttributes<"div">,
|
|
10
|
+
HTMLAttributes<"progress"> & HTMLAttributes<"svg">,
|
|
11
|
+
HTMLAttributes<"circle">,
|
|
12
|
+
HTMLAttributes<"span">
|
|
13
|
+
>;
|
|
14
|
+
|
|
15
|
+
export type ProgressProps = HTMLAttributes<"div"> & ProgressBaseProps;
|
|
16
|
+
|
|
17
|
+
type Props = ProgressProps;
|
|
18
|
+
|
|
19
|
+
const { class: className, ...rest }: Props = Astro.props;
|
|
20
|
+
|
|
21
|
+
const api = connectProgress({ ...rest, class: className });
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<div {...api.rootProps}>
|
|
25
|
+
{
|
|
26
|
+
api.variant === "linear" ? (
|
|
27
|
+
<progress {...api.trackProps} />
|
|
28
|
+
) : (
|
|
29
|
+
<svg {...api.svgProps}>
|
|
30
|
+
<circle {...api.trackProps} />
|
|
31
|
+
<circle {...api.indicatorProps} />
|
|
32
|
+
</svg>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
{
|
|
36
|
+
api.labelText && rest.showLabel && (
|
|
37
|
+
<span {...api.labelProps}>{api.labelText}</span>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Progress from "../Progress.astro";
|
|
3
|
+
import { stack } from "@pindoba/styled-system/patterns";
|
|
4
|
+
import { css } from "@pindoba/styled-system/css";
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<div
|
|
8
|
+
class={stack({
|
|
9
|
+
gap: "xl",
|
|
10
|
+
direction: "column",
|
|
11
|
+
})}
|
|
12
|
+
>
|
|
13
|
+
<!-- Custom max + label formatter -->
|
|
14
|
+
<div>
|
|
15
|
+
<h3>Custom Max and Label</h3>
|
|
16
|
+
<Progress
|
|
17
|
+
value={3}
|
|
18
|
+
max={10}
|
|
19
|
+
showLabel={true}
|
|
20
|
+
formatValue={(v, m) => `${v} of ${m} steps`}
|
|
21
|
+
label="Step progress"
|
|
22
|
+
feedback="primary"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<!-- Custom track style via passThrough -->
|
|
27
|
+
<div>
|
|
28
|
+
<h3>Custom Track Styling</h3>
|
|
29
|
+
<Progress
|
|
30
|
+
value={70}
|
|
31
|
+
feedback="success"
|
|
32
|
+
passThrough={{
|
|
33
|
+
root: {
|
|
34
|
+
style: css.raw({
|
|
35
|
+
maxWidth: "400px",
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
track: {
|
|
39
|
+
style: css.raw({
|
|
40
|
+
borderRadius: "none",
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
}}
|
|
44
|
+
label="Custom radius progress"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<!-- Accessible label via passThrough -->
|
|
49
|
+
<div>
|
|
50
|
+
<h3>Accessible Label via Props</h3>
|
|
51
|
+
<Progress
|
|
52
|
+
variant="circular"
|
|
53
|
+
value={42}
|
|
54
|
+
feedback="warning"
|
|
55
|
+
passThrough={{
|
|
56
|
+
root: {
|
|
57
|
+
props: {
|
|
58
|
+
"aria-describedby": "upload-status",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}}
|
|
62
|
+
label="File upload"
|
|
63
|
+
/>
|
|
64
|
+
<p
|
|
65
|
+
id="upload-status"
|
|
66
|
+
class={css({ fontSize: "sm", color: "fg.subtle", mt: "xs" })}
|
|
67
|
+
>
|
|
68
|
+
Use <code>passThrough.root.props</code> to attach ARIA attributes, event handlers,
|
|
69
|
+
or data attributes to the outer wrapper element.
|
|
70
|
+
</p>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Progress from "../Progress.astro";
|
|
3
|
+
import { stack } from "@pindoba/styled-system/patterns";
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class={stack({
|
|
8
|
+
gap: "xl",
|
|
9
|
+
direction: "column",
|
|
10
|
+
})}
|
|
11
|
+
>
|
|
12
|
+
<div>
|
|
13
|
+
<h3>Neutral</h3>
|
|
14
|
+
<div class={stack({ gap: "sm", direction: "column" })}>
|
|
15
|
+
<Progress value={60} feedback="neutral" label="Neutral progress" />
|
|
16
|
+
<Progress variant="circular" value={60} feedback="neutral" label="60%" />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div>
|
|
21
|
+
<h3>Primary</h3>
|
|
22
|
+
<div class={stack({ gap: "sm", direction: "column" })}>
|
|
23
|
+
<Progress value={60} feedback="primary" label="Primary progress" />
|
|
24
|
+
<Progress variant="circular" value={60} feedback="primary" label="60%" />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div>
|
|
29
|
+
<h3>Success</h3>
|
|
30
|
+
<div class={stack({ gap: "sm", direction: "column" })}>
|
|
31
|
+
<Progress value={60} feedback="success" label="Success progress" />
|
|
32
|
+
<Progress variant="circular" value={60} feedback="success" label="60%" />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div>
|
|
37
|
+
<h3>Warning</h3>
|
|
38
|
+
<div class={stack({ gap: "sm", direction: "column" })}>
|
|
39
|
+
<Progress value={60} feedback="warning" label="Warning progress" />
|
|
40
|
+
<Progress variant="circular" value={60} feedback="warning" label="60%" />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div>
|
|
45
|
+
<h3>Danger</h3>
|
|
46
|
+
<div class={stack({ gap: "sm", direction: "column" })}>
|
|
47
|
+
<Progress value={60} feedback="danger" label="Danger progress" />
|
|
48
|
+
<Progress variant="circular" value={60} feedback="danger" label="60%" />
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Progress from "../Progress.astro";
|
|
3
|
+
import { stack } from "@pindoba/styled-system/patterns";
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class={stack({
|
|
8
|
+
gap: "xl",
|
|
9
|
+
direction: "column",
|
|
10
|
+
})}
|
|
11
|
+
>
|
|
12
|
+
<div>
|
|
13
|
+
<h3>Default percentage</h3>
|
|
14
|
+
<div class={stack({ gap: "sm", direction: "column" })}>
|
|
15
|
+
<Progress value={65} showLabel label="Upload progress" />
|
|
16
|
+
<Progress
|
|
17
|
+
variant="circular"
|
|
18
|
+
value={65}
|
|
19
|
+
showLabel
|
|
20
|
+
label="Upload progress"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div>
|
|
26
|
+
<h3>Step count</h3>
|
|
27
|
+
<div class={stack({ gap: "sm", direction: "column" })}>
|
|
28
|
+
<Progress
|
|
29
|
+
value={3}
|
|
30
|
+
max={5}
|
|
31
|
+
showLabel
|
|
32
|
+
formatValue={(v, m) => `Step ${v} of ${m}`}
|
|
33
|
+
label="Onboarding progress"
|
|
34
|
+
/>
|
|
35
|
+
<Progress
|
|
36
|
+
variant="circular"
|
|
37
|
+
value={3}
|
|
38
|
+
max={5}
|
|
39
|
+
showLabel
|
|
40
|
+
formatValue={(v, m) => `${v}/${m}`}
|
|
41
|
+
label="Onboarding progress"
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div>
|
|
47
|
+
<h3>File size</h3>
|
|
48
|
+
<div class={stack({ gap: "sm", direction: "column" })}>
|
|
49
|
+
<Progress
|
|
50
|
+
value={42}
|
|
51
|
+
max={100}
|
|
52
|
+
showLabel
|
|
53
|
+
formatValue={(v, m) => `${v} MB of ${m} MB`}
|
|
54
|
+
feedback="primary"
|
|
55
|
+
label="Download progress"
|
|
56
|
+
/>
|
|
57
|
+
<Progress
|
|
58
|
+
variant="circular"
|
|
59
|
+
value={42}
|
|
60
|
+
max={100}
|
|
61
|
+
showLabel
|
|
62
|
+
formatValue={(v, _m) => `${v} MB`}
|
|
63
|
+
feedback="primary"
|
|
64
|
+
label="Download progress"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Progress from "../Progress.astro";
|
|
3
|
+
import { stack } from "@pindoba/styled-system/patterns";
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class={stack({
|
|
8
|
+
gap: "xl",
|
|
9
|
+
direction: "column",
|
|
10
|
+
})}
|
|
11
|
+
>
|
|
12
|
+
<div>
|
|
13
|
+
<h3>Linear Sizes</h3>
|
|
14
|
+
<div class={stack({ gap: "md", direction: "column" })}>
|
|
15
|
+
<Progress size="sm" value={50} label="Small" />
|
|
16
|
+
<Progress size="md" value={50} label="Medium (default)" />
|
|
17
|
+
<Progress size="lg" value={50} label="Large" />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div>
|
|
22
|
+
<h3>Circular Sizes</h3>
|
|
23
|
+
<div class={stack({ gap: "md", direction: "row", align: "center" })}>
|
|
24
|
+
<Progress variant="circular" size="sm" value={50} label="Small" />
|
|
25
|
+
<Progress
|
|
26
|
+
variant="circular"
|
|
27
|
+
size="md"
|
|
28
|
+
value={50}
|
|
29
|
+
label="Medium (default)"
|
|
30
|
+
/>
|
|
31
|
+
<Progress variant="circular" size="lg" value={50} label="Large" />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Progress from "../Progress.astro";
|
|
3
|
+
import { stack } from "@pindoba/styled-system/patterns";
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class={stack({
|
|
8
|
+
gap: "xl",
|
|
9
|
+
direction: "column",
|
|
10
|
+
})}
|
|
11
|
+
>
|
|
12
|
+
<!-- Linear determinate -->
|
|
13
|
+
<div>
|
|
14
|
+
<h3>Linear</h3>
|
|
15
|
+
<div class={stack({ gap: "md", direction: "column" })}>
|
|
16
|
+
<Progress value={30} label="Task progress" />
|
|
17
|
+
<Progress value={65} label="Upload progress" />
|
|
18
|
+
<Progress value={100} label="Complete" />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<!-- Linear indeterminate -->
|
|
23
|
+
<div>
|
|
24
|
+
<h3>Linear Indeterminate</h3>
|
|
25
|
+
<Progress indeterminate={true} label="Loading…" />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- Circular determinate -->
|
|
29
|
+
<div>
|
|
30
|
+
<h3>Circular</h3>
|
|
31
|
+
<div class={stack({ gap: "md", direction: "row", align: "center" })}>
|
|
32
|
+
<Progress variant="circular" value={30} label="30%" />
|
|
33
|
+
<Progress variant="circular" value={65} label="65%" />
|
|
34
|
+
<Progress variant="circular" value={100} label="Complete" />
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- Circular indeterminate -->
|
|
39
|
+
<div>
|
|
40
|
+
<h3>Circular Indeterminate</h3>
|
|
41
|
+
<Progress variant="circular" indeterminate={true} label="Loading…" />
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|