@spark-ui/progress 1.1.0 → 1.1.1
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 +6 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +20 -20
- package/dist/public/docgen.json +3 -99
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
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
|
+
## [1.1.1](https://github.com/adevinta/spark/compare/@spark-ui/progress@1.1.0...@spark-ui/progress@1.1.1) (2023-09-11)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- **progress:** harmonize progress displayNames ([02f8f08](https://github.com/adevinta/spark/commit/02f8f083b7c43827345a7b28b44d05f9aaf12b2b))
|
11
|
+
|
6
12
|
# [1.1.0](https://github.com/adevinta/spark/compare/@spark-ui/progress@1.0.0...@spark-ui/progress@1.1.0) (2023-09-04)
|
7
13
|
|
8
14
|
### Features
|
package/dist/index.d.ts
CHANGED
@@ -3,11 +3,11 @@ import { ProgressProps } from './Progress';
|
|
3
3
|
import { ProgressBar } from './ProgressBar';
|
4
4
|
import { ProgressIndicator } from './ProgressIndicator';
|
5
5
|
import { ProgressLabel } from './ProgressLabel';
|
6
|
-
export { type ProgressBarProps } from './ProgressBar';
|
7
|
-
export { type ProgressLabelProps } from './ProgressLabel';
|
8
|
-
export { type ProgressIndicatorProps } from './ProgressIndicator';
|
9
6
|
export declare const Progress: FC<ProgressProps> & {
|
10
7
|
Label: typeof ProgressLabel;
|
11
8
|
Bar: typeof ProgressBar;
|
12
9
|
Indicator: typeof ProgressIndicator;
|
13
10
|
};
|
11
|
+
export { type ProgressBarProps } from './ProgressBar';
|
12
|
+
export { type ProgressLabelProps } from './ProgressLabel';
|
13
|
+
export { type ProgressIndicatorProps } from './ProgressIndicator';
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),b=require("@radix-ui/react-progress"),u=require("class-variance-authority"),y=require("@radix-ui/react-id"),x=require("@spark-ui/use-merge-refs"),p=e.createContext(null),N=()=>{const r=e.useContext(p);if(!r)throw new Error("useProgress must be used within a Progress provider");return r},I=u.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:[]}}}),m=e.forwardRef(({className:r,style:a,...s},t)=>{const{value:n,max:l,isIndeterminate:o}=N(),i=(l-n)/l*100;return e.createElement(b.ProgressIndicator,{className:I({isIndeterminate:o,className:r}),style:{...a,...!o&&{transform:`translateX(-${i}%)`}},ref:t,...s})});m.displayName="Progress.Indicator";const c=e.forwardRef(({className:r,children:a=e.createElement(m,null),...s},t)=>e.createElement("div",{className:u.cx("relative h-sz-4 w-full transform-gpu overflow-hidden rounded-sm bg-on-background/dim-4",r),ref:t,...s},a));c.displayName="Progress.Bar";const P=e.forwardRef(({className:r,value:a,max:s=100,isIndeterminate:t=!1,children:n=e.createElement(c,null),...l},o)=>{const[i,d]=e.useState(),v=e.useMemo(()=>({value:a??0,max:s,isIndeterminate:t,onLabelId:d}),[s,a,t,d]);return e.createElement(p.Provider,{"data-spark-component":"progress",value:v},e.createElement(b.Progress,{ref:o,className:u.cx("flex flex-col gap-sm",r),value:a,"aria-labelledby":i,max:s,...l},n))});P.displayName="Progress";const f=e.forwardRef(({id:r,children:a,...s},t)=>{const n=y.useId(r),{onLabelId:l}=N(),o=e.useCallback(d=>{l(d?n:void 0)},[n,l]),i=x.useMergeRefs(t,o);return e.createElement("span",{id:n,className:"text-body-2 text-on-surface",ref:i,...s},a)});f.displayName="Progress.Label";const g=Object.assign(P,{Label:f,Bar:c,Indicator:m});g.displayName="Progress",c.displayName="Progress.Bar",m.displayName="Progress.Indicator",f.displayName="Progress.Label",exports.Progress=g;
|
package/dist/index.mjs
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
import o, { createContext as
|
2
|
-
import { ProgressIndicator as
|
3
|
-
import { cva as
|
1
|
+
import o, { createContext as v, useContext as x, forwardRef as d, useState as y, useMemo as I, useCallback as h } from "react";
|
2
|
+
import { ProgressIndicator as E, Progress as w } from "@radix-ui/react-progress";
|
3
|
+
import { cva as L, cx as g } from "class-variance-authority";
|
4
4
|
import { useId as k } from "@radix-ui/react-id";
|
5
|
-
import { useMergeRefs as
|
6
|
-
const p =
|
7
|
-
const e =
|
5
|
+
import { useMergeRefs as B } from "@spark-ui/use-merge-refs";
|
6
|
+
const p = v(null), b = () => {
|
7
|
+
const e = x(p);
|
8
8
|
if (!e)
|
9
9
|
throw new Error("useProgress must be used within a Progress provider");
|
10
10
|
return e;
|
11
|
-
},
|
11
|
+
}, C = L(["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, ...s }, r) => {
|
12
12
|
const { value: t, max: n, isIndeterminate: l } = b(), m = (n - t) / n * 100;
|
13
|
-
return o.createElement(
|
13
|
+
return o.createElement(E, { className: C({ isIndeterminate: l, className: e }), style: { ...a, ...!l && { transform: `translateX(-${m}%)` } }, ref: r, ...s });
|
14
14
|
});
|
15
15
|
c.displayName = "Progress.Indicator";
|
16
|
-
const u = d(({ className: e, children: a = o.createElement(c, null), ...
|
16
|
+
const u = d(({ className: e, children: a = o.createElement(c, null), ...s }, r) => o.createElement("div", { className: g("relative h-sz-4 w-full transform-gpu overflow-hidden rounded-sm bg-on-background/dim-4", e), ref: r, ...s }, a));
|
17
17
|
u.displayName = "Progress.Bar";
|
18
|
-
const N = d(({ className: e, value: a, max:
|
19
|
-
const [m, i] =
|
20
|
-
return o.createElement(p.Provider, { "data-spark-component": "progress", value:
|
18
|
+
const N = d(({ className: e, value: a, max: s = 100, isIndeterminate: r = !1, children: t = o.createElement(u, null), ...n }, l) => {
|
19
|
+
const [m, i] = y(), P = I(() => ({ value: a ?? 0, max: s, isIndeterminate: r, onLabelId: i }), [s, a, r, i]);
|
20
|
+
return o.createElement(p.Provider, { "data-spark-component": "progress", value: P }, o.createElement(w, { ref: l, className: g("flex flex-col gap-sm", e), value: a, "aria-labelledby": m, max: s, ...n }, t));
|
21
21
|
});
|
22
22
|
N.displayName = "Progress";
|
23
|
-
const
|
24
|
-
const t = k(e), { onLabelId: n } = b(), l =
|
23
|
+
const f = d(({ id: e, children: a, ...s }, r) => {
|
24
|
+
const t = k(e), { onLabelId: n } = b(), l = h((i) => {
|
25
25
|
n(i ? t : void 0);
|
26
|
-
}, [t, n]), m =
|
27
|
-
return o.createElement("span", { id: t, className: "text-body-2 text-on-surface", ref: m, ...
|
26
|
+
}, [t, n]), m = B(r, l);
|
27
|
+
return o.createElement("span", { id: t, className: "text-body-2 text-on-surface", ref: m, ...s }, a);
|
28
28
|
});
|
29
|
-
|
30
|
-
const
|
31
|
-
|
29
|
+
f.displayName = "Progress.Label";
|
30
|
+
const M = Object.assign(N, { Label: f, Bar: u, Indicator: c });
|
31
|
+
M.displayName = "Progress", u.displayName = "Progress.Bar", c.displayName = "Progress.Indicator", f.displayName = "Progress.Label";
|
32
32
|
export {
|
33
|
-
|
33
|
+
M as Progress
|
34
34
|
};
|
package/dist/public/docgen.json
CHANGED
@@ -6,9 +6,7 @@
|
|
6
6
|
"methods": [],
|
7
7
|
"props": {
|
8
8
|
"isIndeterminate": {
|
9
|
-
"defaultValue":
|
10
|
-
"value": "false"
|
11
|
-
},
|
9
|
+
"defaultValue": null,
|
12
10
|
"description": "",
|
13
11
|
"name": "isIndeterminate",
|
14
12
|
"parent": {
|
@@ -46,9 +44,7 @@
|
|
46
44
|
}
|
47
45
|
},
|
48
46
|
"max": {
|
49
|
-
"defaultValue":
|
50
|
-
"value": "100"
|
51
|
-
},
|
47
|
+
"defaultValue": null,
|
52
48
|
"description": "",
|
53
49
|
"name": "max",
|
54
50
|
"parent": {
|
@@ -121,98 +117,6 @@
|
|
121
117
|
"description": "",
|
122
118
|
"displayName": "Progress.Label",
|
123
119
|
"methods": [],
|
124
|
-
"props": {
|
125
|
-
"isIndeterminate": {
|
126
|
-
"defaultValue": null,
|
127
|
-
"description": "",
|
128
|
-
"name": "isIndeterminate",
|
129
|
-
"parent": {
|
130
|
-
"fileName": "progress/src/Progress.tsx",
|
131
|
-
"name": "ProgressProps"
|
132
|
-
},
|
133
|
-
"declarations": [
|
134
|
-
{
|
135
|
-
"fileName": "progress/src/Progress.tsx",
|
136
|
-
"name": "ProgressProps"
|
137
|
-
}
|
138
|
-
],
|
139
|
-
"required": false,
|
140
|
-
"type": {
|
141
|
-
"name": "boolean"
|
142
|
-
}
|
143
|
-
},
|
144
|
-
"value": {
|
145
|
-
"defaultValue": null,
|
146
|
-
"description": "",
|
147
|
-
"name": "value",
|
148
|
-
"parent": {
|
149
|
-
"fileName": "spark/node_modules/@radix-ui/react-progress/dist/index.d.ts",
|
150
|
-
"name": "ProgressProps"
|
151
|
-
},
|
152
|
-
"declarations": [
|
153
|
-
{
|
154
|
-
"fileName": "spark/node_modules/@radix-ui/react-progress/dist/index.d.ts",
|
155
|
-
"name": "ProgressProps"
|
156
|
-
}
|
157
|
-
],
|
158
|
-
"required": false,
|
159
|
-
"type": {
|
160
|
-
"name": "number"
|
161
|
-
}
|
162
|
-
},
|
163
|
-
"max": {
|
164
|
-
"defaultValue": null,
|
165
|
-
"description": "",
|
166
|
-
"name": "max",
|
167
|
-
"parent": {
|
168
|
-
"fileName": "spark/node_modules/@radix-ui/react-progress/dist/index.d.ts",
|
169
|
-
"name": "ProgressProps"
|
170
|
-
},
|
171
|
-
"declarations": [
|
172
|
-
{
|
173
|
-
"fileName": "spark/node_modules/@radix-ui/react-progress/dist/index.d.ts",
|
174
|
-
"name": "ProgressProps"
|
175
|
-
}
|
176
|
-
],
|
177
|
-
"required": false,
|
178
|
-
"type": {
|
179
|
-
"name": "number"
|
180
|
-
}
|
181
|
-
},
|
182
|
-
"getValueLabel": {
|
183
|
-
"defaultValue": null,
|
184
|
-
"description": "",
|
185
|
-
"name": "getValueLabel",
|
186
|
-
"parent": {
|
187
|
-
"fileName": "spark/node_modules/@radix-ui/react-progress/dist/index.d.ts",
|
188
|
-
"name": "ProgressProps"
|
189
|
-
},
|
190
|
-
"declarations": [
|
191
|
-
{
|
192
|
-
"fileName": "spark/node_modules/@radix-ui/react-progress/dist/index.d.ts",
|
193
|
-
"name": "ProgressProps"
|
194
|
-
}
|
195
|
-
],
|
196
|
-
"required": false,
|
197
|
-
"type": {
|
198
|
-
"name": "(value: number, max: number) => string"
|
199
|
-
}
|
200
|
-
},
|
201
|
-
"asChild": {
|
202
|
-
"defaultValue": null,
|
203
|
-
"description": "",
|
204
|
-
"name": "asChild",
|
205
|
-
"declarations": [
|
206
|
-
{
|
207
|
-
"fileName": "spark/node_modules/@radix-ui/react-primitive/dist/index.d.ts",
|
208
|
-
"name": "TypeLiteral"
|
209
|
-
}
|
210
|
-
],
|
211
|
-
"required": false,
|
212
|
-
"type": {
|
213
|
-
"name": "boolean"
|
214
|
-
}
|
215
|
-
}
|
216
|
-
}
|
120
|
+
"props": {}
|
217
121
|
}
|
218
122
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@spark-ui/progress",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.1",
|
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"
|
@@ -44,5 +44,5 @@
|
|
44
44
|
},
|
45
45
|
"homepage": "https://sparkui.vercel.app",
|
46
46
|
"license": "MIT",
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "71af7216f90b81c71aac495c702ddb3826c46dcc"
|
48
48
|
}
|