@spark-ui/progress 7.3.6 → 8.0.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/CHANGELOG.md +8 -0
- package/dist/Progress.d.ts +6 -3
- package/dist/ProgressBar.d.ts +6 -5
- package/dist/ProgressIndicator.d.ts +6 -5
- package/dist/ProgressLabel.d.ts +6 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +29 -29
- package/dist/public/docgen.json +19 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [8.0.0](https://github.com/adevinta/spark/compare/v7.3.7...v8.0.0) (2025-01-13)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @spark-ui/progress
|
9
|
+
|
10
|
+
## [7.3.7](https://github.com/adevinta/spark/compare/v7.3.6...v7.3.7) (2025-01-08)
|
11
|
+
|
12
|
+
**Note:** Version bump only for package @spark-ui/progress
|
13
|
+
|
6
14
|
## [7.3.6](https://github.com/adevinta/spark/compare/v7.3.5...v7.3.6) (2025-01-08)
|
7
15
|
|
8
16
|
**Note:** Version bump only for package @spark-ui/progress
|
package/dist/Progress.d.ts
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
import { ProgressProps as ProgressPrimitiveProps } from '@radix-ui/react-progress';
|
2
|
+
import { PropsWithChildren, Ref } from 'react';
|
2
3
|
import { ProgressIndicatorStylesProps } from './ProgressIndicator.styles';
|
3
4
|
export interface ProgressProps extends ProgressPrimitiveProps, Pick<ProgressIndicatorStylesProps, 'intent'> {
|
4
5
|
shape?: 'square' | 'rounded';
|
5
6
|
isIndeterminate?: boolean;
|
7
|
+
ref?: Ref<HTMLDivElement>;
|
6
8
|
}
|
7
|
-
export declare const Progress:
|
8
|
-
children
|
9
|
-
|
9
|
+
export declare const Progress: {
|
10
|
+
({ className, value: valueProp, max, shape, intent, isIndeterminate, children, ref, ...others }: PropsWithChildren<ProgressProps>): import("react").JSX.Element;
|
11
|
+
displayName: string;
|
12
|
+
};
|
package/dist/ProgressBar.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
export type ProgressBarProps =
|
3
|
-
export declare const ProgressBar:
|
4
|
-
children
|
5
|
-
|
1
|
+
import { ComponentPropsWithRef, PropsWithChildren } from 'react';
|
2
|
+
export type ProgressBarProps = ComponentPropsWithRef<'div'>;
|
3
|
+
export declare const ProgressBar: {
|
4
|
+
({ className, children, ref, ...others }: PropsWithChildren<ProgressBarProps>): import("react").JSX.Element;
|
5
|
+
displayName: string;
|
6
|
+
};
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
export type ProgressIndicatorProps =
|
3
|
-
export declare const ProgressIndicator:
|
4
|
-
|
5
|
-
|
1
|
+
import { ComponentPropsWithRef, PropsWithChildren } from 'react';
|
2
|
+
export type ProgressIndicatorProps = ComponentPropsWithRef<'div'>;
|
3
|
+
export declare const ProgressIndicator: {
|
4
|
+
({ className, style, ref, ...others }: PropsWithChildren<ProgressIndicatorProps>): import("react").JSX.Element;
|
5
|
+
displayName: string;
|
6
|
+
};
|
package/dist/ProgressLabel.d.ts
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
export type ProgressLabelProps =
|
3
|
-
export declare const ProgressLabel:
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
2
|
+
export type ProgressLabelProps = ComponentPropsWithRef<'span'>;
|
3
|
+
export declare const ProgressLabel: {
|
4
|
+
({ id: idProp, children, ref: forwardedRef, ...others }: ProgressLabelProps): import("react").JSX.Element;
|
5
|
+
displayName: string;
|
6
|
+
};
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),h=require("@radix-ui/react-progress"),g=require("class-variance-authority"),x=require("@spark-ui/use-merge-refs"),I=g.cva(["relative","h-sz-4 w-full","transform-gpu overflow-hidden","bg-on-background/dim-4"],{variants:{shape:{square:[],rounded:["rounded-sm"]}}}),v=e.createContext(null),b=()=>{const a=e.useContext(v);if(!a)throw new Error("useProgress must be used within a Progress provider");return a},
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),h=require("@radix-ui/react-progress"),g=require("class-variance-authority"),x=require("@spark-ui/use-merge-refs"),I=g.cva(["relative","h-sz-4 w-full","transform-gpu overflow-hidden","bg-on-background/dim-4"],{variants:{shape:{square:[],rounded:["rounded-sm"]}}}),v=e.createContext(null),b=()=>{const a=e.useContext(v);if(!a)throw new Error("useProgress must be used within a Progress provider");return a},E=g.cva(["h-full w-full","transition-transform duration-400"],{variants:{intent:{basic:["bg-basic"],main:["bg-main"],support:["bg-support"],accent:["bg-accent"],success:["bg-success"],alert:["bg-alert"],danger:["bg-error"],info:["bg-info"],neutral:["bg-neutral"]},shape:{square:[],rounded:["rounded-sm"]},isIndeterminate:{true:["absolute","-translate-x-1/2","animate-standalone-indeterminate-bar"],false:[]}}}),u=({className:a,style:r,ref:s,...n})=>{const{value:l,max:t,intent:o,shape:c,isIndeterminate:i}=b(),d=(t-l)/t*100;return e.createElement(h.ProgressIndicator,{className:E({className:a,intent:o,shape:c,isIndeterminate:i}),style:{...r,...!i&&{transform:`translateX(-${d}%)`}},ref:s,...n})};u.displayName="Progress.Indicator";const m=({className:a,children:r=e.createElement(u,null),ref:s,...n})=>{const{shape:l}=b();return e.createElement("div",{className:I({className:a,shape:l}),ref:s,...n},r)};m.displayName="Progress.Bar";const P=({className:a,value:r,max:s=100,shape:n="square",intent:l="basic",isIndeterminate:t=!1,children:o=e.createElement(m,null),ref:c,...i})=>{const[d,f]=e.useState(),y=e.useMemo(()=>({value:r??0,max:s,intent:l,shape:n,isIndeterminate:t,onLabelId:f}),[s,r,l,n,t,f]);return e.createElement(v.Provider,{"data-spark-component":"progress",value:y},e.createElement(h.Progress,{ref:c,className:g.cx("flex flex-col gap-sm",a),value:r,"aria-labelledby":d,max:s,...i},o))};P.displayName="Progress";const p=({id:a,children:r,ref:s,...n})=>{const l=`:progress-label-${e.useId()}`,t=a||l,{onLabelId:o}=b(),c=e.useCallback(d=>{o(d?t:void 0)},[t,o]),i=x.useMergeRefs(s,c);return e.createElement("span",{id:t,className:"text-body-2 text-on-surface",ref:i,...n},r)};p.displayName="Progress.Label";const N=Object.assign(P,{Label:p,Bar:m,Indicator:u});N.displayName="Progress",m.displayName="Progress.Bar",u.displayName="Progress.Indicator",p.displayName="Progress.Label",exports.Progress=N;
|
package/dist/index.mjs
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
import o, { createContext as
|
2
|
-
import { ProgressIndicator as
|
3
|
-
import { cva as
|
4
|
-
import { useMergeRefs as
|
5
|
-
const
|
6
|
-
const e =
|
1
|
+
import o, { createContext as P, useContext as x, useState as y, useMemo as I, useId as E, useCallback as w } from "react";
|
2
|
+
import { ProgressIndicator as L, Progress as k } from "@radix-ui/react-progress";
|
3
|
+
import { cva as f, cx as q } from "class-variance-authority";
|
4
|
+
import { useMergeRefs as B } from "@spark-ui/use-merge-refs";
|
5
|
+
const C = f(["relative", "h-sz-4 w-full", "transform-gpu overflow-hidden", "bg-on-background/dim-4"], { variants: { shape: { square: [], rounded: ["rounded-sm"] } } }), N = P(null), p = () => {
|
6
|
+
const e = x(N);
|
7
7
|
if (!e)
|
8
8
|
throw new Error("useProgress must be used within a Progress provider");
|
9
9
|
return e;
|
10
|
-
},
|
11
|
-
const { value: n, max: r, intent: l, shape: m, isIndeterminate: i } =
|
12
|
-
return o.createElement(
|
13
|
-
}
|
14
|
-
|
15
|
-
const
|
16
|
-
const { shape: n } =
|
17
|
-
return o.createElement("div", { className:
|
18
|
-
}
|
19
|
-
|
20
|
-
const
|
21
|
-
const [c,
|
22
|
-
return o.createElement(N.Provider, { "data-spark-component": "progress", value:
|
23
|
-
}
|
24
|
-
|
25
|
-
const
|
26
|
-
const n = `:progress-label-${
|
10
|
+
}, M = f(["h-full w-full", "transition-transform duration-400"], { variants: { intent: { basic: ["bg-basic"], main: ["bg-main"], support: ["bg-support"], accent: ["bg-accent"], success: ["bg-success"], alert: ["bg-alert"], danger: ["bg-error"], info: ["bg-info"], neutral: ["bg-neutral"] }, shape: { square: [], rounded: ["rounded-sm"] }, isIndeterminate: { true: ["absolute", "-translate-x-1/2", "animate-standalone-indeterminate-bar"], false: [] } } }), d = ({ className: e, style: a, ref: s, ...t }) => {
|
11
|
+
const { value: n, max: r, intent: l, shape: m, isIndeterminate: i } = p(), c = (r - n) / r * 100;
|
12
|
+
return o.createElement(L, { className: M({ className: e, intent: l, shape: m, isIndeterminate: i }), style: { ...a, ...!i && { transform: `translateX(-${c}%)` } }, ref: s, ...t });
|
13
|
+
};
|
14
|
+
d.displayName = "Progress.Indicator";
|
15
|
+
const u = ({ className: e, children: a = o.createElement(d, null), ref: s, ...t }) => {
|
16
|
+
const { shape: n } = p();
|
17
|
+
return o.createElement("div", { className: C({ className: e, shape: n }), ref: s, ...t }, a);
|
18
|
+
};
|
19
|
+
u.displayName = "Progress.Bar";
|
20
|
+
const h = ({ className: e, value: a, max: s = 100, shape: t = "square", intent: n = "basic", isIndeterminate: r = !1, children: l = o.createElement(u, null), ref: m, ...i }) => {
|
21
|
+
const [c, b] = y(), v = I(() => ({ value: a ?? 0, max: s, intent: n, shape: t, isIndeterminate: r, onLabelId: b }), [s, a, n, t, r, b]);
|
22
|
+
return o.createElement(N.Provider, { "data-spark-component": "progress", value: v }, o.createElement(k, { ref: m, className: q("flex flex-col gap-sm", e), value: a, "aria-labelledby": c, max: s, ...i }, l));
|
23
|
+
};
|
24
|
+
h.displayName = "Progress";
|
25
|
+
const g = ({ id: e, children: a, ref: s, ...t }) => {
|
26
|
+
const n = `:progress-label-${E()}`, r = e || n, { onLabelId: l } = p(), m = w((c) => {
|
27
27
|
l(c ? r : void 0);
|
28
|
-
}, [r, l]), i =
|
29
|
-
return o.createElement("span", { id: r, className: "text-body-2 text-on-surface", ref: i, ...
|
30
|
-
}
|
31
|
-
|
32
|
-
const $ = Object.assign(
|
33
|
-
$.displayName = "Progress",
|
28
|
+
}, [r, l]), i = B(s, m);
|
29
|
+
return o.createElement("span", { id: r, className: "text-body-2 text-on-surface", ref: i, ...t }, a);
|
30
|
+
};
|
31
|
+
g.displayName = "Progress.Label";
|
32
|
+
const $ = Object.assign(h, { Label: g, Bar: u, Indicator: d });
|
33
|
+
$.displayName = "Progress", u.displayName = "Progress.Bar", d.displayName = "Progress.Indicator", g.displayName = "Progress.Label";
|
34
34
|
export {
|
35
35
|
$ as Progress
|
36
36
|
};
|
package/dist/public/docgen.json
CHANGED
@@ -52,6 +52,25 @@
|
|
52
52
|
"name": "boolean"
|
53
53
|
}
|
54
54
|
},
|
55
|
+
"ref": {
|
56
|
+
"defaultValue": null,
|
57
|
+
"description": "",
|
58
|
+
"name": "ref",
|
59
|
+
"parent": {
|
60
|
+
"fileName": "progress/src/Progress.tsx",
|
61
|
+
"name": "ProgressProps"
|
62
|
+
},
|
63
|
+
"declarations": [
|
64
|
+
{
|
65
|
+
"fileName": "progress/src/Progress.tsx",
|
66
|
+
"name": "ProgressProps"
|
67
|
+
}
|
68
|
+
],
|
69
|
+
"required": false,
|
70
|
+
"type": {
|
71
|
+
"name": "Ref<HTMLDivElement>"
|
72
|
+
}
|
73
|
+
},
|
55
74
|
"value": {
|
56
75
|
"defaultValue": null,
|
57
76
|
"description": "",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@spark-ui/progress",
|
3
|
-
"version": "
|
3
|
+
"version": "8.0.0",
|
4
4
|
"description": "Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -24,7 +24,7 @@
|
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
26
|
"@radix-ui/react-progress": "1.1.0",
|
27
|
-
"@spark-ui/use-merge-refs": "^
|
27
|
+
"@spark-ui/use-merge-refs": "^8.0.0",
|
28
28
|
"class-variance-authority": "0.7.0"
|
29
29
|
},
|
30
30
|
"peerDependencies": {
|
@@ -48,5 +48,5 @@
|
|
48
48
|
},
|
49
49
|
"homepage": "https://sparkui.vercel.app",
|
50
50
|
"license": "MIT",
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "309903aa55f44ebd43d2a1fe43691f110a5036ea"
|
52
52
|
}
|