@spark-ui/progress 0.2.3 → 0.3.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 +16 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +13 -13
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
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
|
+
# [0.3.0](https://github.com/adevinta/spark/compare/@spark-ui/progress@0.2.4...@spark-ui/progress@0.3.0) (2023-08-31)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- **progress:** release stable version ([dfbf577](https://github.com/adevinta/spark/commit/dfbf577681e51851065b88a96f20c406bfaf6976))
|
11
|
+
|
12
|
+
### BREAKING CHANGES
|
13
|
+
|
14
|
+
- **progress:** component
|
15
|
+
|
16
|
+
## [0.2.4](https://github.com/adevinta/spark/compare/@spark-ui/progress@0.2.3...@spark-ui/progress@0.2.4) (2023-08-31)
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
- **progress:** add missing border radius to progress component ([0f2ec85](https://github.com/adevinta/spark/commit/0f2ec85382a694cf24eb9aab0bbc0f202b6945dd))
|
21
|
+
|
6
22
|
## [0.2.3](https://github.com/adevinta/spark/compare/@spark-ui/progress@0.2.2...@spark-ui/progress@0.2.3) (2023-08-31)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @spark-ui/progress
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),g=require("@radix-ui/react-progress"),m=require("class-variance-authority"),P=require("@radix-ui/react-id"),y=require("@spark-ui/use-merge-refs"),b=e.createContext(null),p=()=>{const r=e.useContext(b);if(!r)throw new Error("useProgress must be used within a Progress provider");return r},I=m.cva(["h-full w-full","bg-basic","transition-transform duration-400"],{variants:{isIndeterminate:{true:["absolute","-translate-x-1/2","animate-standalone-indeterminate-bar"],false:[]}}}),u=e.forwardRef(({className:r,style:a,...s},t)=>{const{value:n,max:l,isIndeterminate:o}=p(),i=(l-n)/l*100;return e.createElement(g.ProgressIndicator,{className:I({isIndeterminate:o,className:r}),style:{...a,...!o&&{transform:`translateX(-${i}%)`}},ref:t,...s})});u.displayName="Progress.Indicator";const f=e.forwardRef(({className:r,children:a=e.createElement(u,null),...s},t)=>e.createElement("div",{className:m.cx("relative h-sz-4 w-full transform-gpu overflow-hidden rounded-sm bg-on-background/dim-4",r),ref:t,...s},a));f.displayName="Progress.Bar";const v=e.forwardRef(({className:r,value:a,max:s=100,isIndeterminate:t=!1,children:n=e.createElement(f,null),...l},o)=>{const[i,d]=e.useState(),x=e.useMemo(()=>({value:a??0,max:s,isIndeterminate:t,onLabelId:d}),[s,a,t,d]);return e.createElement(b.Provider,{"data-spark-component":"progress",value:x},e.createElement(g.Progress,{ref:o,className:m.cx("flex flex-col gap-sm",r),value:a,"aria-labelledby":i,max:s,...l},n))});v.displayName="Progress";const N=e.forwardRef(({id:r,children:a,...s},t)=>{const n=P.useId(r),{onLabelId:l}=p(),o=e.useCallback(d=>{l(d?n:void 0)},[n,l]),i=y.useMergeRefs(t,o);return e.createElement("span",{id:n,className:"text-body-2 text-on-surface",ref:i,...s},a)});N.displayName="Progress.Label";const c=Object.assign(v,{Label:N,Bar:f,Indicator:u});c.Label.displayName="Progress.Label",c.Bar.displayName="Progress.Bar",exports.Progress=c;
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),g=require("@radix-ui/react-progress"),m=require("class-variance-authority"),P=require("@radix-ui/react-id"),y=require("@spark-ui/use-merge-refs"),b=e.createContext(null),p=()=>{const r=e.useContext(b);if(!r)throw new Error("useProgress must be used within a Progress provider");return r},I=m.cva(["h-full w-full","bg-basic","rounded-sm","transition-transform duration-400"],{variants:{isIndeterminate:{true:["absolute","-translate-x-1/2","animate-standalone-indeterminate-bar"],false:[]}}}),u=e.forwardRef(({className:r,style:a,...s},t)=>{const{value:n,max:l,isIndeterminate:o}=p(),i=(l-n)/l*100;return e.createElement(g.ProgressIndicator,{className:I({isIndeterminate:o,className:r}),style:{...a,...!o&&{transform:`translateX(-${i}%)`}},ref:t,...s})});u.displayName="Progress.Indicator";const f=e.forwardRef(({className:r,children:a=e.createElement(u,null),...s},t)=>e.createElement("div",{className:m.cx("relative h-sz-4 w-full transform-gpu overflow-hidden rounded-sm bg-on-background/dim-4",r),ref:t,...s},a));f.displayName="Progress.Bar";const v=e.forwardRef(({className:r,value:a,max:s=100,isIndeterminate:t=!1,children:n=e.createElement(f,null),...l},o)=>{const[i,d]=e.useState(),x=e.useMemo(()=>({value:a??0,max:s,isIndeterminate:t,onLabelId:d}),[s,a,t,d]);return e.createElement(b.Provider,{"data-spark-component":"progress",value:x},e.createElement(g.Progress,{ref:o,className:m.cx("flex flex-col gap-sm",r),value:a,"aria-labelledby":i,max:s,...l},n))});v.displayName="Progress";const N=e.forwardRef(({id:r,children:a,...s},t)=>{const n=P.useId(r),{onLabelId:l}=p(),o=e.useCallback(d=>{l(d?n:void 0)},[n,l]),i=y.useMergeRefs(t,o);return e.createElement("span",{id:n,className:"text-body-2 text-on-surface",ref:i,...s},a)});N.displayName="Progress.Label";const c=Object.assign(v,{Label:N,Bar:f,Indicator:u});c.Label.displayName="Progress.Label",c.Bar.displayName="Progress.Bar",exports.Progress=c;
|
package/dist/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import o, { createContext as P, useContext as y, forwardRef as d, useState as I, useMemo as h, useCallback as E } from "react";
|
2
2
|
import { ProgressIndicator as w, Progress as L } from "@radix-ui/react-progress";
|
3
3
|
import { cva as B, cx as g } from "class-variance-authority";
|
4
4
|
import { useId as k } from "@radix-ui/react-id";
|
@@ -8,26 +8,26 @@ const p = P(null), b = () => {
|
|
8
8
|
if (!e)
|
9
9
|
throw new Error("useProgress must be used within a Progress provider");
|
10
10
|
return e;
|
11
|
-
}, M = B(["h-full w-full", "bg-basic", "transition-transform duration-400"], { variants: { isIndeterminate: { true: ["absolute", "-translate-x-1/2", "animate-standalone-indeterminate-bar"], false: [] } } }),
|
12
|
-
const { value: t, max: n, isIndeterminate:
|
13
|
-
return
|
11
|
+
}, M = B(["h-full w-full", "bg-basic", "rounded-sm", "transition-transform duration-400"], { variants: { isIndeterminate: { true: ["absolute", "-translate-x-1/2", "animate-standalone-indeterminate-bar"], false: [] } } }), c = d(({ className: e, style: a, ...r }, s) => {
|
12
|
+
const { value: t, max: n, isIndeterminate: l } = b(), m = (n - t) / n * 100;
|
13
|
+
return o.createElement(w, { className: M({ isIndeterminate: l, className: e }), style: { ...a, ...!l && { transform: `translateX(-${m}%)` } }, ref: s, ...r });
|
14
14
|
});
|
15
|
-
|
16
|
-
const u =
|
15
|
+
c.displayName = "Progress.Indicator";
|
16
|
+
const u = d(({ className: e, children: a = o.createElement(c, null), ...r }, s) => o.createElement("div", { className: g("relative h-sz-4 w-full transform-gpu overflow-hidden rounded-sm bg-on-background/dim-4", e), ref: s, ...r }, a));
|
17
17
|
u.displayName = "Progress.Bar";
|
18
|
-
const N =
|
18
|
+
const N = d(({ className: e, value: a, max: r = 100, isIndeterminate: s = !1, children: t = o.createElement(u, null), ...n }, l) => {
|
19
19
|
const [m, i] = I(), x = h(() => ({ value: a ?? 0, max: r, isIndeterminate: s, onLabelId: i }), [r, a, s, i]);
|
20
|
-
return
|
20
|
+
return o.createElement(p.Provider, { "data-spark-component": "progress", value: x }, o.createElement(L, { ref: l, className: g("flex flex-col gap-sm", e), value: a, "aria-labelledby": m, max: r, ...n }, t));
|
21
21
|
});
|
22
22
|
N.displayName = "Progress";
|
23
|
-
const v =
|
24
|
-
const t = k(e), { onLabelId: n } = b(),
|
23
|
+
const v = d(({ id: e, children: a, ...r }, s) => {
|
24
|
+
const t = k(e), { onLabelId: n } = b(), l = E((i) => {
|
25
25
|
n(i ? t : void 0);
|
26
|
-
}, [t, n]), m = C(s,
|
27
|
-
return
|
26
|
+
}, [t, n]), m = C(s, l);
|
27
|
+
return o.createElement("span", { id: t, className: "text-body-2 text-on-surface", ref: m, ...r }, a);
|
28
28
|
});
|
29
29
|
v.displayName = "Progress.Label";
|
30
|
-
const f = Object.assign(N, { Label: v, Bar: u, Indicator:
|
30
|
+
const f = Object.assign(N, { Label: v, Bar: u, Indicator: c });
|
31
31
|
f.Label.displayName = "Progress.Label", f.Bar.displayName = "Progress.Bar";
|
32
32
|
export {
|
33
33
|
f as Progress
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@spark-ui/progress",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.3.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"
|
@@ -29,7 +29,7 @@
|
|
29
29
|
"class-variance-authority": "0.7.0"
|
30
30
|
},
|
31
31
|
"peerDependencies": {
|
32
|
-
"@spark-ui/theme-utils": "^
|
32
|
+
"@spark-ui/theme-utils": "^4.0.0",
|
33
33
|
"react": "^16.8 || ^17.0 || ^18.0",
|
34
34
|
"react-dom": "^16.8 || ^17.0 || ^18.0",
|
35
35
|
"tailwindcss": "^3.0.0"
|
@@ -44,5 +44,5 @@
|
|
44
44
|
},
|
45
45
|
"homepage": "https://sparkui.vercel.app",
|
46
46
|
"license": "MIT",
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "e51d180fb4ab61b4d35221a80afde31b7eb17872"
|
48
48
|
}
|