@spark-ui/progress 0.2.2 → 0.2.4

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 CHANGED
@@ -3,6 +3,16 @@
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.2.4](https://github.com/adevinta/spark/compare/@spark-ui/progress@0.2.3...@spark-ui/progress@0.2.4) (2023-08-31)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **progress:** add missing border radius to progress component ([0f2ec85](https://github.com/adevinta/spark/commit/0f2ec85382a694cf24eb9aab0bbc0f202b6945dd))
11
+
12
+ ## [0.2.3](https://github.com/adevinta/spark/compare/@spark-ui/progress@0.2.2...@spark-ui/progress@0.2.3) (2023-08-31)
13
+
14
+ **Note:** Version bump only for package @spark-ui/progress
15
+
6
16
  ## [0.2.2](https://github.com/adevinta/spark/compare/@spark-ui/progress@0.2.1...@spark-ui/progress@0.2.2) (2023-08-29)
7
17
 
8
18
  **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 l, { createContext as P, useContext as y, forwardRef as c, useState as I, useMemo as h, useCallback as E } from "react";
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: [] } } }), d = c(({ className: e, style: a, ...r }, s) => {
12
- const { value: t, max: n, isIndeterminate: o } = b(), m = (n - t) / n * 100;
13
- return l.createElement(w, { className: M({ isIndeterminate: o, className: e }), style: { ...a, ...!o && { transform: `translateX(-${m}%)` } }, ref: s, ...r });
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
- d.displayName = "Progress.Indicator";
16
- const u = c(({ className: e, children: a = l.createElement(d, null), ...r }, s) => l.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));
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 = c(({ className: e, value: a, max: r = 100, isIndeterminate: s = !1, children: t = l.createElement(u, null), ...n }, o) => {
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 l.createElement(p.Provider, { "data-spark-component": "progress", value: x }, l.createElement(L, { ref: o, className: g("flex flex-col gap-sm", e), value: a, "aria-labelledby": m, max: r, ...n }, t));
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 = c(({ id: e, children: a, ...r }, s) => {
24
- const t = k(e), { onLabelId: n } = b(), o = E((i) => {
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, o);
27
- return l.createElement("span", { id: t, className: "text-body-2 text-on-surface", ref: m, ...r }, a);
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: d });
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.2.2",
3
+ "version": "0.2.4",
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"
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@radix-ui/react-id": "1.0.1",
27
27
  "@radix-ui/react-progress": "1.0.3",
28
- "@spark-ui/use-merge-refs": "^0.3.6",
28
+ "@spark-ui/use-merge-refs": "^0.3.7",
29
29
  "class-variance-authority": "0.7.0"
30
30
  },
31
31
  "peerDependencies": {
@@ -44,5 +44,5 @@
44
44
  },
45
45
  "homepage": "https://sparkui.vercel.app",
46
46
  "license": "MIT",
47
- "gitHead": "0c0a05d34d4ade1b5e3ba458cc9865dedad5a1e3"
47
+ "gitHead": "7bfbb5b5635d3d0354d9190c8ebc9d3e7817fba7"
48
48
  }