@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 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
@@ -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: import("react").ForwardRefExoticComponent<ProgressProps & {
8
- children?: import("react").ReactNode;
9
- } & import("react").RefAttributes<HTMLDivElement>>;
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
+ };
@@ -1,5 +1,6 @@
1
- import { ComponentPropsWithoutRef } from 'react';
2
- export type ProgressBarProps = ComponentPropsWithoutRef<'div'>;
3
- export declare const ProgressBar: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
4
- children?: import("react").ReactNode;
5
- } & import("react").RefAttributes<HTMLDivElement>>;
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 { ComponentPropsWithoutRef } from 'react';
2
- export type ProgressIndicatorProps = ComponentPropsWithoutRef<'div'>;
3
- export declare const ProgressIndicator: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
4
- children?: import("react").ReactNode;
5
- } & import("react").RefAttributes<HTMLDivElement>>;
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
+ };
@@ -1,3 +1,6 @@
1
- import { ComponentPropsWithoutRef } from 'react';
2
- export type ProgressLabelProps = ComponentPropsWithoutRef<'span'>;
3
- export declare const ProgressLabel: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
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},w=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=e.forwardRef(({className:a,style:r,...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:w({className:a,intent:o,shape:c,isIndeterminate:i}),style:{...r,...!i&&{transform:`translateX(-${d}%)`}},ref:n,...s})});u.displayName="Progress.Indicator";const m=e.forwardRef(({className:a,children:r=e.createElement(u,null),...s},n)=>{const{shape:l}=b();return e.createElement("div",{className:I({className:a,shape:l}),ref:n,...s},r)});m.displayName="Progress.Bar";const P=e.forwardRef(({className:a,value:r,max:s=100,shape:n="square",intent:l="basic",isIndeterminate:t=!1,children:o=e.createElement(m,null),...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:i,className:g.cx("flex flex-col gap-sm",a),value:r,"aria-labelledby":d,max:s,...c},o))});P.displayName="Progress";const p=e.forwardRef(({id:a,children:r,...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(n,c);return e.createElement("span",{id:t,className:"text-body-2 text-on-surface",ref:i,...s},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;
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 x, useContext as y, forwardRef as d, useState as I, useMemo as E, useId as w, useCallback as L } from "react";
2
- import { ProgressIndicator as k, Progress as q } from "@radix-ui/react-progress";
3
- import { cva as h, cx as B } from "class-variance-authority";
4
- import { useMergeRefs as C } from "@spark-ui/use-merge-refs";
5
- const M = h(["relative", "h-sz-4 w-full", "transform-gpu overflow-hidden", "bg-on-background/dim-4"], { variants: { shape: { square: [], rounded: ["rounded-sm"] } } }), N = x(null), g = () => {
6
- const e = y(N);
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
- }, R = h(["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 = d(({ className: e, style: a, ...s }, t) => {
11
- const { value: n, max: r, intent: l, shape: m, isIndeterminate: i } = g(), c = (r - n) / r * 100;
12
- return o.createElement(k, { className: R({ className: e, intent: l, shape: m, isIndeterminate: i }), style: { ...a, ...!i && { transform: `translateX(-${c}%)` } }, ref: t, ...s });
13
- });
14
- u.displayName = "Progress.Indicator";
15
- const p = d(({ className: e, children: a = o.createElement(u, null), ...s }, t) => {
16
- const { shape: n } = g();
17
- return o.createElement("div", { className: M({ className: e, shape: n }), ref: t, ...s }, a);
18
- });
19
- p.displayName = "Progress.Bar";
20
- const v = d(({ className: e, value: a, max: s = 100, shape: t = "square", intent: n = "basic", isIndeterminate: r = !1, children: l = o.createElement(p, null), ...m }, i) => {
21
- const [c, f] = I(), P = E(() => ({ value: a ?? 0, max: s, intent: n, shape: t, isIndeterminate: r, onLabelId: f }), [s, a, n, t, r, f]);
22
- return o.createElement(N.Provider, { "data-spark-component": "progress", value: P }, o.createElement(q, { ref: i, className: B("flex flex-col gap-sm", e), value: a, "aria-labelledby": c, max: s, ...m }, l));
23
- });
24
- v.displayName = "Progress";
25
- const b = d(({ id: e, children: a, ...s }, t) => {
26
- const n = `:progress-label-${w()}`, r = e || n, { onLabelId: l } = g(), m = L((c) => {
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 = C(t, m);
29
- return o.createElement("span", { id: r, className: "text-body-2 text-on-surface", ref: i, ...s }, a);
30
- });
31
- b.displayName = "Progress.Label";
32
- const $ = Object.assign(v, { Label: b, Bar: p, Indicator: u });
33
- $.displayName = "Progress", p.displayName = "Progress.Bar", u.displayName = "Progress.Indicator", b.displayName = "Progress.Label";
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
  };
@@ -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": "7.3.6",
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": "^7.3.6",
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": "969983868f32c57cf6d6ffc838de66b51fa4163d"
51
+ "gitHead": "309903aa55f44ebd43d2a1fe43691f110a5036ea"
52
52
  }