@spark-ui/components 14.0.0 → 14.1.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.
Files changed (43) hide show
  1. package/dist/circular-meter/CircularMeter.d.ts +34 -0
  2. package/dist/circular-meter/CircularMeter.styles.d.ts +5 -0
  3. package/dist/circular-meter/CircularMeterContent.d.ts +6 -0
  4. package/dist/circular-meter/CircularMeterContext.d.ts +36 -0
  5. package/dist/circular-meter/CircularMeterLabel.d.ts +7 -0
  6. package/dist/circular-meter/CircularMeterTrack.d.ts +8 -0
  7. package/dist/circular-meter/CircularMeterValue.d.ts +7 -0
  8. package/dist/circular-meter/index.d.mts +16 -0
  9. package/dist/circular-meter/index.d.ts +16 -0
  10. package/dist/circular-meter/index.js +2 -0
  11. package/dist/circular-meter/index.js.map +1 -0
  12. package/dist/circular-meter/index.mjs +316 -0
  13. package/dist/circular-meter/index.mjs.map +1 -0
  14. package/dist/circular-meter/useIntersectionAnimation.d.ts +26 -0
  15. package/dist/meter/Meter.d.ts +18 -0
  16. package/dist/meter/MeterContext.d.ts +12 -0
  17. package/dist/meter/MeterLabel.d.ts +7 -0
  18. package/dist/meter/MeterTrack.d.ts +7 -0
  19. package/dist/meter/MeterTrack.styles.d.ts +8 -0
  20. package/dist/meter/MeterValue.d.ts +7 -0
  21. package/dist/meter/index.d.mts +13 -0
  22. package/dist/meter/index.d.ts +13 -0
  23. package/dist/meter/index.js +2 -0
  24. package/dist/meter/index.js.map +1 -0
  25. package/dist/meter/index.mjs +177 -0
  26. package/dist/meter/index.mjs.map +1 -0
  27. package/dist/meter/useIntersectionAnimation.d.ts +26 -0
  28. package/dist/progress/Progress.d.ts +14 -6
  29. package/dist/progress/ProgressContext.d.ts +3 -3
  30. package/dist/progress/ProgressIndicator.d.ts +9 -2
  31. package/dist/progress/ProgressLabel.d.ts +3 -2
  32. package/dist/progress/ProgressTrack.d.ts +7 -0
  33. package/dist/progress/ProgressValue.d.ts +7 -0
  34. package/dist/progress/index.d.mts +6 -6
  35. package/dist/progress/index.d.ts +6 -6
  36. package/dist/progress/index.js +1 -1
  37. package/dist/progress/index.js.map +1 -1
  38. package/dist/progress/index.mjs +122 -111
  39. package/dist/progress/index.mjs.map +1 -1
  40. package/package.json +4 -4
  41. package/dist/progress/ProgressBar.d.ts +0 -6
  42. package/dist/progress/ProgressBar.styles.d.ts +0 -5
  43. package/dist/progress/ProgressIndicator.styles.d.ts +0 -7
@@ -0,0 +1,18 @@
1
+ import { Meter as BaseMeter } from '@base-ui/react/meter';
2
+ import { ComponentProps, PropsWithChildren, Ref } from 'react';
3
+ import { MeterIndicatorStylesProps } from './MeterTrack.styles';
4
+ export interface MeterProps extends Omit<ComponentProps<typeof BaseMeter.Root>, 'render'>, Pick<MeterIndicatorStylesProps, 'intent'> {
5
+ /**
6
+ * Shape of the meter track and indicator.
7
+ */
8
+ shape?: 'square' | 'rounded';
9
+ /**
10
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
11
+ */
12
+ asChild?: boolean;
13
+ ref?: Ref<HTMLDivElement>;
14
+ }
15
+ export declare const Meter: {
16
+ ({ className, value, max, min, shape, intent, children, ref, ...others }: PropsWithChildren<MeterProps>): import("react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
@@ -0,0 +1,12 @@
1
+ import { MeterIndicatorStylesProps } from './MeterTrack.styles';
2
+ export interface MeterContextValue {
3
+ value: number;
4
+ max: number;
5
+ min: number;
6
+ intent: MeterIndicatorStylesProps['intent'];
7
+ shape: 'square' | 'rounded';
8
+ onLabelId: (id?: string) => void;
9
+ }
10
+ export declare const MeterContext: import('react').Context<MeterContextValue | null>;
11
+ export declare const ID_PREFIX = ":meter";
12
+ export declare const useMeter: () => MeterContextValue;
@@ -0,0 +1,7 @@
1
+ import { Meter as BaseMeter } from '@base-ui/react/meter';
2
+ import { ComponentProps } from 'react';
3
+ export type MeterLabelProps = Omit<ComponentProps<typeof BaseMeter.Label>, 'render'>;
4
+ export declare const MeterLabel: {
5
+ ({ id: idProp, children, ref: forwardedRef, ...others }: MeterLabelProps): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { Meter as BaseMeter } from '@base-ui/react/meter';
2
+ import { ComponentProps } from 'react';
3
+ export type MeterTrackProps = Omit<ComponentProps<typeof BaseMeter.Track>, 'render'>;
4
+ export declare const MeterTrack: {
5
+ ({ className, ...others }: MeterTrackProps): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
@@ -0,0 +1,8 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ export declare const meterTrackStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
3
+ export type MeterTrackStylesProps = VariantProps<typeof meterTrackStyles>;
4
+ export declare const meterIndicatorStyles: (props?: ({
5
+ intent?: "main" | "alert" | "support" | "success" | "info" | "danger" | null | undefined;
6
+ shape?: "square" | "rounded" | null | undefined;
7
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
+ export type MeterIndicatorStylesProps = VariantProps<typeof meterIndicatorStyles>;
@@ -0,0 +1,7 @@
1
+ import { Meter as BaseMeter } from '@base-ui/react/meter';
2
+ import { ComponentProps, PropsWithChildren } from 'react';
3
+ export type MeterValueProps = Omit<ComponentProps<typeof BaseMeter.Value>, 'render'>;
4
+ export declare const MeterValue: {
5
+ ({ className, children, ...others }: PropsWithChildren<MeterValueProps>): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
@@ -0,0 +1,13 @@
1
+ import { Meter as Root } from './Meter';
2
+ import { MeterLabel } from './MeterLabel';
3
+ import { MeterTrack } from './MeterTrack';
4
+ import { MeterValue } from './MeterValue';
5
+ export declare const Meter: typeof Root & {
6
+ Label: typeof MeterLabel;
7
+ Track: typeof MeterTrack;
8
+ Value: typeof MeterValue;
9
+ };
10
+ export { type MeterProps } from './Meter';
11
+ export { type MeterLabelProps } from './MeterLabel';
12
+ export { type MeterTrackProps } from './MeterTrack';
13
+ export { type MeterValueProps } from './MeterValue';
@@ -0,0 +1,13 @@
1
+ import { Meter as Root } from './Meter';
2
+ import { MeterLabel } from './MeterLabel';
3
+ import { MeterTrack } from './MeterTrack';
4
+ import { MeterValue } from './MeterValue';
5
+ export declare const Meter: typeof Root & {
6
+ Label: typeof MeterLabel;
7
+ Track: typeof MeterTrack;
8
+ Value: typeof MeterValue;
9
+ };
10
+ export { type MeterProps } from './Meter';
11
+ export { type MeterLabelProps } from './MeterLabel';
12
+ export { type MeterTrackProps } from './MeterTrack';
13
+ export { type MeterValueProps } from './MeterValue';
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),f=require("@base-ui/react/meter"),b=require("class-variance-authority"),s=require("react"),N=require("@spark-ui/hooks/use-merge-refs"),x=s.createContext(null),R=":meter",y=()=>{const t=s.useContext(x);if(!t)throw new Error("useMeter must be used within a Meter provider");return t},h=({className:t,value:r,max:a=100,min:n=0,shape:o="rounded",intent:e="support",children:c,ref:i,...u})=>{const[l,d]=s.useState(),v=s.useMemo(()=>({value:r??0,max:a,min:n,intent:e,shape:o,onLabelId:d}),[a,n,r,e,o,d]);return m.jsx(x.Provider,{value:v,children:m.jsx(f.Meter.Root,{"data-spark-component":"meter",ref:i,className:b.cx("gap-y-sm focus-visible:u-outline box-border grid grid-cols-2",t),value:r,max:a,min:n,"aria-labelledby":l,...u,children:c})})};h.displayName="Meter";const p=({id:t,children:r,ref:a,...n})=>{const o=`${R}-label-${s.useId()}`,e=t||o,{onLabelId:c}=y(),i=s.useCallback(l=>{c(l?e:void 0)},[e,c]),u=N.useMergeRefs(a,i);return m.jsx(f.Meter.Label,{"data-spark-component":"meter-label",id:e,className:"default:text-body-1 text-on-surface default:font-bold",ref:u,...n,children:r})};p.displayName="Meter.Label";const I=b.cva(["relative col-span-2","h-sz-8 w-full","transform-gpu overflow-hidden","bg-on-background/dim-4"]),j=b.cva(["size-full","ease-standard transition-[width] duration-700","motion-reduce:transition-none"],{variants:{intent:{main:["bg-main"],support:["bg-support"],success:["bg-success"],alert:["bg-alert"],danger:["bg-error"],info:["bg-info"]},shape:{square:[],rounded:["rounded-sm"]}}});function w(t,r,a={}){const{threshold:n=.1,rootMargin:o}=a,e=s.useRef(!1),c=s.useRef(r);return s.useEffect(()=>{c.current=r},[r]),s.useEffect(()=>{const i=t.current;if(!i||e.current)return;const u=new IntersectionObserver(l=>{l.forEach(d=>{d.isIntersecting&&!e.current&&requestAnimationFrame(()=>{e.current||(e.current=!0,c.current(),u.disconnect())})})},{threshold:n,rootMargin:o});return u.observe(i),()=>{u.disconnect()}},[t,n,o]),e.current}const M=({className:t,...r})=>{const{value:a,max:n,min:o,intent:e,shape:c}=y(),i=(a-o)/(n-o)*100,u=s.useRef(null),[l,d]=s.useState(!1);return w(u,()=>{d(!0)}),m.jsx(f.Meter.Track,{ref:u,"data-spark-component":"meter-track",className:b.cx(I(),{"rounded-sm":c==="rounded"},t),...r,children:m.jsx(f.Meter.Indicator,{"data-spark-component":"meter-indicator",className:j({intent:e,shape:c}),style:{width:l?`${i}%`:"0%"}})})};M.displayName="Meter.Track";const g=({className:t,children:r,...a})=>m.jsx(f.Meter.Value,{"data-spark-component":"meter-value",className:b.cx("default:text-body-1 text-on-surface","col-start-2 text-right",t),...a,children:r});g.displayName="Meter.Value";const k=Object.assign(h,{Label:p,Track:M,Value:g});k.displayName="Meter";p.displayName="Meter.Label";M.displayName="Meter.Track";g.displayName="Meter.Value";exports.Meter=k;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/meter/MeterContext.tsx","../../src/meter/Meter.tsx","../../src/meter/MeterLabel.tsx","../../src/meter/MeterTrack.styles.ts","../../src/meter/useIntersectionAnimation.ts","../../src/meter/MeterTrack.tsx","../../src/meter/MeterValue.tsx","../../src/meter/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterContextValue {\n value: number\n max: number\n min: number\n intent: MeterIndicatorStylesProps['intent']\n shape: 'square' | 'rounded'\n onLabelId: (id?: string) => void\n}\n\nexport const MeterContext = createContext<MeterContextValue | null>(null)\n\nexport const ID_PREFIX = ':meter'\n\nexport const useMeter = () => {\n const context = useContext(MeterContext)\n\n if (!context) {\n throw new Error('useMeter must be used within a Meter provider')\n }\n\n return context\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { MeterContext } from './MeterContext'\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterProps\n extends Omit<ComponentProps<typeof BaseMeter.Root>, 'render'>,\n Pick<MeterIndicatorStylesProps, 'intent'> {\n /**\n * Shape of the meter track and indicator.\n */\n shape?: 'square' | 'rounded'\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Meter = ({\n className,\n value,\n max = 100,\n min = 0,\n shape = 'rounded',\n intent = 'support',\n children,\n ref,\n ...others\n}: PropsWithChildren<MeterProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const contextValue = useMemo(() => {\n return {\n value: value ?? 0,\n max,\n min,\n intent,\n shape,\n onLabelId: setLabelId,\n }\n }, [max, min, value, intent, shape, setLabelId])\n\n return (\n <MeterContext.Provider value={contextValue}>\n <BaseMeter.Root\n data-spark-component=\"meter\"\n ref={ref}\n className={cx('gap-y-sm focus-visible:u-outline box-border grid grid-cols-2', className)}\n value={value}\n max={max}\n min={min}\n aria-labelledby={labelId}\n {...others}\n >\n {children}\n </BaseMeter.Root>\n </MeterContext.Provider>\n )\n}\n\nMeter.displayName = 'Meter'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ComponentProps, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useMeter } from './MeterContext'\n\nexport type MeterLabelProps = Omit<ComponentProps<typeof BaseMeter.Label>, 'render'>\n\nexport const MeterLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: MeterLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useMeter()\n const rootRef = useCallback(\n (el: HTMLSpanElement) => {\n onLabelId(el ? id : undefined)\n },\n [id, onLabelId]\n )\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n return (\n <BaseMeter.Label\n data-spark-component=\"meter-label\"\n id={id}\n className=\"default:text-body-1 text-on-surface default:font-bold\"\n ref={ref}\n {...others}\n >\n {children}\n </BaseMeter.Label>\n )\n}\n\nMeterLabel.displayName = 'Meter.Label'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const meterTrackStyles = cva([\n 'relative col-span-2',\n 'h-sz-8 w-full',\n 'transform-gpu overflow-hidden',\n 'bg-on-background/dim-4',\n])\n\nexport type MeterTrackStylesProps = VariantProps<typeof meterTrackStyles>\n\nexport const meterIndicatorStyles = cva(\n ['size-full', 'ease-standard transition-[width] duration-700', 'motion-reduce:transition-none'],\n {\n variants: {\n /**\n * Color scheme of the meter component.\n */\n intent: {\n main: ['bg-main'],\n support: ['bg-support'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n },\n /**\n * Shape of the meter component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n }\n)\n\nexport type MeterIndicatorStylesProps = VariantProps<typeof meterIndicatorStyles>\n","import { RefObject, useEffect, useRef } from 'react'\n\nexport interface UseIntersectionAnimationOptions {\n /**\n * The threshold at which the callback should be triggered.\n * A value of 0 means as soon as any part of the element is visible.\n * A value of 1 means the entire element must be visible.\n * @default 0.1\n */\n threshold?: number\n /**\n * The root margin for the Intersection Observer.\n * This can be used to trigger the animation before the element enters the viewport.\n * @default undefined\n */\n rootMargin?: string\n}\n\n/**\n * Hook to trigger an animation callback when an element enters the viewport.\n * The callback is only triggered once, when the element first becomes visible.\n *\n * @param elementRef - Reference to the element to observe\n * @param onIntersect - Callback to execute when the element enters the viewport\n * @param options - Configuration options for the Intersection Observer\n * @returns Whether the animation has been triggered\n */\nexport function useIntersectionAnimation(\n elementRef: RefObject<Element | null>,\n onIntersect: () => void,\n options: UseIntersectionAnimationOptions = {}\n): boolean {\n const { threshold = 0.1, rootMargin } = options\n const hasTriggeredRef = useRef(false)\n const callbackRef = useRef(onIntersect)\n\n // Keep callback ref up to date\n useEffect(() => {\n callbackRef.current = onIntersect\n }, [onIntersect])\n\n useEffect(() => {\n const element = elementRef.current\n if (!element || hasTriggeredRef.current) return\n\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting && !hasTriggeredRef.current) {\n // Use requestAnimationFrame to ensure the callback runs at the right time\n requestAnimationFrame(() => {\n if (!hasTriggeredRef.current) {\n hasTriggeredRef.current = true\n callbackRef.current()\n // Disconnect observer after callback is triggered (only trigger once)\n observer.disconnect()\n }\n })\n }\n })\n },\n {\n threshold,\n rootMargin,\n }\n )\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n }\n }, [elementRef, threshold, rootMargin])\n\n return hasTriggeredRef.current\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, useRef, useState } from 'react'\n\nimport { useMeter } from './MeterContext'\nimport { meterIndicatorStyles, meterTrackStyles } from './MeterTrack.styles'\nimport { useIntersectionAnimation } from './useIntersectionAnimation'\n\nexport type MeterTrackProps = Omit<ComponentProps<typeof BaseMeter.Track>, 'render'>\n\nexport const MeterTrack = ({ className, ...others }: MeterTrackProps) => {\n const { value, max, min, intent, shape } = useMeter()\n const percentage = ((value - min) / (max - min)) * 100\n const trackRef = useRef<HTMLDivElement>(null)\n const [hasAnimated, setHasAnimated] = useState(false)\n\n // Trigger animation when component enters viewport\n useIntersectionAnimation(trackRef, () => {\n setHasAnimated(true)\n })\n\n return (\n <BaseMeter.Track\n ref={trackRef}\n data-spark-component=\"meter-track\"\n className={cx(meterTrackStyles(), { 'rounded-sm': shape === 'rounded' }, className)}\n {...others}\n >\n <BaseMeter.Indicator\n data-spark-component=\"meter-indicator\"\n className={meterIndicatorStyles({ intent, shape })}\n style={{\n width: hasAnimated ? `${percentage}%` : '0%',\n }}\n />\n </BaseMeter.Track>\n )\n}\n\nMeterTrack.displayName = 'Meter.Track'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren } from 'react'\n\nexport type MeterValueProps = Omit<ComponentProps<typeof BaseMeter.Value>, 'render'>\n\nexport const MeterValue = ({\n className,\n children,\n ...others\n}: PropsWithChildren<MeterValueProps>) => {\n return (\n <BaseMeter.Value\n data-spark-component=\"meter-value\"\n className={cx('default:text-body-1 text-on-surface', 'col-start-2 text-right', className)}\n {...others}\n >\n {children}\n </BaseMeter.Value>\n )\n}\n\nMeterValue.displayName = 'Meter.Value'\n","import { Meter as Root } from './Meter'\nimport { MeterLabel } from './MeterLabel'\nimport { MeterTrack } from './MeterTrack'\nimport { MeterValue } from './MeterValue'\n\nexport const Meter: typeof Root & {\n Label: typeof MeterLabel\n Track: typeof MeterTrack\n Value: typeof MeterValue\n} = Object.assign(Root, {\n Label: MeterLabel,\n Track: MeterTrack,\n Value: MeterValue,\n})\n\nMeter.displayName = 'Meter'\nMeterLabel.displayName = 'Meter.Label'\nMeterTrack.displayName = 'Meter.Track'\nMeterValue.displayName = 'Meter.Value'\n\nexport { type MeterProps } from './Meter'\nexport { type MeterLabelProps } from './MeterLabel'\nexport { type MeterTrackProps } from './MeterTrack'\nexport { type MeterValueProps } from './MeterValue'\n"],"names":["MeterContext","createContext","ID_PREFIX","useMeter","context","useContext","Meter","className","value","max","min","shape","intent","children","ref","others","labelId","setLabelId","useState","contextValue","useMemo","jsx","BaseMeter","cx","MeterLabel","idProp","forwardedRef","internalID","useId","id","onLabelId","rootRef","useCallback","el","useMergeRefs","meterTrackStyles","cva","meterIndicatorStyles","useIntersectionAnimation","elementRef","onIntersect","options","threshold","rootMargin","hasTriggeredRef","useRef","callbackRef","useEffect","element","observer","entries","entry","MeterTrack","percentage","trackRef","hasAnimated","setHasAnimated","MeterValue","Root"],"mappings":"4PAaaA,EAAeC,EAAAA,cAAwC,IAAI,EAE3DC,EAAY,SAEZC,EAAW,IAAM,CAC5B,MAAMC,EAAUC,EAAAA,WAAWL,CAAY,EAEvC,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,+CAA+C,EAGjE,OAAOA,CACT,ECJaE,EAAQ,CAAC,CACpB,UAAAC,EACA,MAAAC,EACA,IAAAC,EAAM,IACN,IAAAC,EAAM,EACN,MAAAC,EAAQ,UACR,OAAAC,EAAS,UACT,SAAAC,EACA,IAAAC,EACA,GAAGC,CACL,IAAqC,CACnC,KAAM,CAACC,EAASC,CAAU,EAAIC,WAAA,EAExBC,EAAeC,EAAAA,QAAQ,KACpB,CACL,MAAOZ,GAAS,EAChB,IAAAC,EACA,IAAAC,EACA,OAAAE,EACA,MAAAD,EACA,UAAWM,CAAA,GAEZ,CAACR,EAAKC,EAAKF,EAAOI,EAAQD,EAAOM,CAAU,CAAC,EAE/C,OACEI,EAAAA,IAACrB,EAAa,SAAb,CAAsB,MAAOmB,EAC5B,SAAAE,EAAAA,IAACC,EAAAA,MAAU,KAAV,CACC,uBAAqB,QACrB,IAAAR,EACA,UAAWS,EAAAA,GAAG,+DAAgEhB,CAAS,EACvF,MAAAC,EACA,IAAAC,EACA,IAAAC,EACA,kBAAiBM,EAChB,GAAGD,EAEH,SAAAF,CAAA,CAAA,EAEL,CAEJ,EAEAP,EAAM,YAAc,QCvDb,MAAMkB,EAAa,CAAC,CACzB,GAAIC,EACJ,SAAAZ,EACA,IAAKa,EACL,GAAGX,CACL,IAAuB,CACrB,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G,sCAAuC,yBAA0BhB,CAAS,EACvF,GAAGQ,EAEH,SAAAF,CAAA,CAAA,EAKP4C,EAAW,YAAc,cCjBlB,MAAMnD,EAIT,OAAO,OAAOoD,EAAM,CACtB,MAAOlC,EACP,MAAO4B,EACP,MAAOK,CACT,CAAC,EAEDnD,EAAM,YAAc,QACpBkB,EAAW,YAAc,cACzB4B,EAAW,YAAc,cACzBK,EAAW,YAAc"}
@@ -0,0 +1,177 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { Meter as m } from "@base-ui/react/meter";
3
+ import { cx as p, cva as h } from "class-variance-authority";
4
+ import { createContext as w, useContext as L, useState as y, useMemo as R, useId as T, useCallback as V, useRef as f, useEffect as k } from "react";
5
+ import { useMergeRefs as $ } from "@spark-ui/hooks/use-merge-refs";
6
+ const v = w(null), A = ":meter", x = () => {
7
+ const t = L(v);
8
+ if (!t)
9
+ throw new Error("useMeter must be used within a Meter provider");
10
+ return t;
11
+ }, N = ({
12
+ className: t,
13
+ value: r,
14
+ max: a = 100,
15
+ min: n = 0,
16
+ shape: s = "rounded",
17
+ intent: e = "support",
18
+ children: o,
19
+ ref: l,
20
+ ...c
21
+ }) => {
22
+ const [i, u] = y(), I = R(() => ({
23
+ value: r ?? 0,
24
+ max: a,
25
+ min: n,
26
+ intent: e,
27
+ shape: s,
28
+ onLabelId: u
29
+ }), [a, n, r, e, s, u]);
30
+ return /* @__PURE__ */ d(v.Provider, { value: I, children: /* @__PURE__ */ d(
31
+ m.Root,
32
+ {
33
+ "data-spark-component": "meter",
34
+ ref: l,
35
+ className: p("gap-y-sm focus-visible:u-outline box-border grid grid-cols-2", t),
36
+ value: r,
37
+ max: a,
38
+ min: n,
39
+ "aria-labelledby": i,
40
+ ...c,
41
+ children: o
42
+ }
43
+ ) });
44
+ };
45
+ N.displayName = "Meter";
46
+ const b = ({
47
+ id: t,
48
+ children: r,
49
+ ref: a,
50
+ ...n
51
+ }) => {
52
+ const s = `${A}-label-${T()}`, e = t || s, { onLabelId: o } = x(), l = V(
53
+ (i) => {
54
+ o(i ? e : void 0);
55
+ },
56
+ [e, o]
57
+ ), c = $(a, l);
58
+ return /* @__PURE__ */ d(
59
+ m.Label,
60
+ {
61
+ "data-spark-component": "meter-label",
62
+ id: e,
63
+ className: "default:text-body-1 text-on-surface default:font-bold",
64
+ ref: c,
65
+ ...n,
66
+ children: r
67
+ }
68
+ );
69
+ };
70
+ b.displayName = "Meter.Label";
71
+ const C = h([
72
+ "relative col-span-2",
73
+ "h-sz-8 w-full",
74
+ "transform-gpu overflow-hidden",
75
+ "bg-on-background/dim-4"
76
+ ]), E = h(
77
+ ["size-full", "ease-standard transition-[width] duration-700", "motion-reduce:transition-none"],
78
+ {
79
+ variants: {
80
+ /**
81
+ * Color scheme of the meter component.
82
+ */
83
+ intent: {
84
+ main: ["bg-main"],
85
+ support: ["bg-support"],
86
+ success: ["bg-success"],
87
+ alert: ["bg-alert"],
88
+ danger: ["bg-error"],
89
+ info: ["bg-info"]
90
+ },
91
+ /**
92
+ * Shape of the meter component.
93
+ */
94
+ shape: {
95
+ square: [],
96
+ rounded: ["rounded-sm"]
97
+ }
98
+ }
99
+ }
100
+ );
101
+ function S(t, r, a = {}) {
102
+ const { threshold: n = 0.1, rootMargin: s } = a, e = f(!1), o = f(r);
103
+ return k(() => {
104
+ o.current = r;
105
+ }, [r]), k(() => {
106
+ const l = t.current;
107
+ if (!l || e.current) return;
108
+ const c = new IntersectionObserver(
109
+ (i) => {
110
+ i.forEach((u) => {
111
+ u.isIntersecting && !e.current && requestAnimationFrame(() => {
112
+ e.current || (e.current = !0, o.current(), c.disconnect());
113
+ });
114
+ });
115
+ },
116
+ {
117
+ threshold: n,
118
+ rootMargin: s
119
+ }
120
+ );
121
+ return c.observe(l), () => {
122
+ c.disconnect();
123
+ };
124
+ }, [t, n, s]), e.current;
125
+ }
126
+ const M = ({ className: t, ...r }) => {
127
+ const { value: a, max: n, min: s, intent: e, shape: o } = x(), l = (a - s) / (n - s) * 100, c = f(null), [i, u] = y(!1);
128
+ return S(c, () => {
129
+ u(!0);
130
+ }), /* @__PURE__ */ d(
131
+ m.Track,
132
+ {
133
+ ref: c,
134
+ "data-spark-component": "meter-track",
135
+ className: p(C(), { "rounded-sm": o === "rounded" }, t),
136
+ ...r,
137
+ children: /* @__PURE__ */ d(
138
+ m.Indicator,
139
+ {
140
+ "data-spark-component": "meter-indicator",
141
+ className: E({ intent: e, shape: o }),
142
+ style: {
143
+ width: i ? `${l}%` : "0%"
144
+ }
145
+ }
146
+ )
147
+ }
148
+ );
149
+ };
150
+ M.displayName = "Meter.Track";
151
+ const g = ({
152
+ className: t,
153
+ children: r,
154
+ ...a
155
+ }) => /* @__PURE__ */ d(
156
+ m.Value,
157
+ {
158
+ "data-spark-component": "meter-value",
159
+ className: p("default:text-body-1 text-on-surface", "col-start-2 text-right", t),
160
+ ...a,
161
+ children: r
162
+ }
163
+ );
164
+ g.displayName = "Meter.Value";
165
+ const j = Object.assign(N, {
166
+ Label: b,
167
+ Track: M,
168
+ Value: g
169
+ });
170
+ j.displayName = "Meter";
171
+ b.displayName = "Meter.Label";
172
+ M.displayName = "Meter.Track";
173
+ g.displayName = "Meter.Value";
174
+ export {
175
+ j as Meter
176
+ };
177
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/meter/MeterContext.tsx","../../src/meter/Meter.tsx","../../src/meter/MeterLabel.tsx","../../src/meter/MeterTrack.styles.ts","../../src/meter/useIntersectionAnimation.ts","../../src/meter/MeterTrack.tsx","../../src/meter/MeterValue.tsx","../../src/meter/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterContextValue {\n value: number\n max: number\n min: number\n intent: MeterIndicatorStylesProps['intent']\n shape: 'square' | 'rounded'\n onLabelId: (id?: string) => void\n}\n\nexport const MeterContext = createContext<MeterContextValue | null>(null)\n\nexport const ID_PREFIX = ':meter'\n\nexport const useMeter = () => {\n const context = useContext(MeterContext)\n\n if (!context) {\n throw new Error('useMeter must be used within a Meter provider')\n }\n\n return context\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { MeterContext } from './MeterContext'\nimport { MeterIndicatorStylesProps } from './MeterTrack.styles'\n\nexport interface MeterProps\n extends Omit<ComponentProps<typeof BaseMeter.Root>, 'render'>,\n Pick<MeterIndicatorStylesProps, 'intent'> {\n /**\n * Shape of the meter track and indicator.\n */\n shape?: 'square' | 'rounded'\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Meter = ({\n className,\n value,\n max = 100,\n min = 0,\n shape = 'rounded',\n intent = 'support',\n children,\n ref,\n ...others\n}: PropsWithChildren<MeterProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const contextValue = useMemo(() => {\n return {\n value: value ?? 0,\n max,\n min,\n intent,\n shape,\n onLabelId: setLabelId,\n }\n }, [max, min, value, intent, shape, setLabelId])\n\n return (\n <MeterContext.Provider value={contextValue}>\n <BaseMeter.Root\n data-spark-component=\"meter\"\n ref={ref}\n className={cx('gap-y-sm focus-visible:u-outline box-border grid grid-cols-2', className)}\n value={value}\n max={max}\n min={min}\n aria-labelledby={labelId}\n {...others}\n >\n {children}\n </BaseMeter.Root>\n </MeterContext.Provider>\n )\n}\n\nMeter.displayName = 'Meter'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ComponentProps, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useMeter } from './MeterContext'\n\nexport type MeterLabelProps = Omit<ComponentProps<typeof BaseMeter.Label>, 'render'>\n\nexport const MeterLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: MeterLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useMeter()\n const rootRef = useCallback(\n (el: HTMLSpanElement) => {\n onLabelId(el ? id : undefined)\n },\n [id, onLabelId]\n )\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n return (\n <BaseMeter.Label\n data-spark-component=\"meter-label\"\n id={id}\n className=\"default:text-body-1 text-on-surface default:font-bold\"\n ref={ref}\n {...others}\n >\n {children}\n </BaseMeter.Label>\n )\n}\n\nMeterLabel.displayName = 'Meter.Label'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const meterTrackStyles = cva([\n 'relative col-span-2',\n 'h-sz-8 w-full',\n 'transform-gpu overflow-hidden',\n 'bg-on-background/dim-4',\n])\n\nexport type MeterTrackStylesProps = VariantProps<typeof meterTrackStyles>\n\nexport const meterIndicatorStyles = cva(\n ['size-full', 'ease-standard transition-[width] duration-700', 'motion-reduce:transition-none'],\n {\n variants: {\n /**\n * Color scheme of the meter component.\n */\n intent: {\n main: ['bg-main'],\n support: ['bg-support'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n },\n /**\n * Shape of the meter component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n }\n)\n\nexport type MeterIndicatorStylesProps = VariantProps<typeof meterIndicatorStyles>\n","import { RefObject, useEffect, useRef } from 'react'\n\nexport interface UseIntersectionAnimationOptions {\n /**\n * The threshold at which the callback should be triggered.\n * A value of 0 means as soon as any part of the element is visible.\n * A value of 1 means the entire element must be visible.\n * @default 0.1\n */\n threshold?: number\n /**\n * The root margin for the Intersection Observer.\n * This can be used to trigger the animation before the element enters the viewport.\n * @default undefined\n */\n rootMargin?: string\n}\n\n/**\n * Hook to trigger an animation callback when an element enters the viewport.\n * The callback is only triggered once, when the element first becomes visible.\n *\n * @param elementRef - Reference to the element to observe\n * @param onIntersect - Callback to execute when the element enters the viewport\n * @param options - Configuration options for the Intersection Observer\n * @returns Whether the animation has been triggered\n */\nexport function useIntersectionAnimation(\n elementRef: RefObject<Element | null>,\n onIntersect: () => void,\n options: UseIntersectionAnimationOptions = {}\n): boolean {\n const { threshold = 0.1, rootMargin } = options\n const hasTriggeredRef = useRef(false)\n const callbackRef = useRef(onIntersect)\n\n // Keep callback ref up to date\n useEffect(() => {\n callbackRef.current = onIntersect\n }, [onIntersect])\n\n useEffect(() => {\n const element = elementRef.current\n if (!element || hasTriggeredRef.current) return\n\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting && !hasTriggeredRef.current) {\n // Use requestAnimationFrame to ensure the callback runs at the right time\n requestAnimationFrame(() => {\n if (!hasTriggeredRef.current) {\n hasTriggeredRef.current = true\n callbackRef.current()\n // Disconnect observer after callback is triggered (only trigger once)\n observer.disconnect()\n }\n })\n }\n })\n },\n {\n threshold,\n rootMargin,\n }\n )\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n }\n }, [elementRef, threshold, rootMargin])\n\n return hasTriggeredRef.current\n}\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, useRef, useState } from 'react'\n\nimport { useMeter } from './MeterContext'\nimport { meterIndicatorStyles, meterTrackStyles } from './MeterTrack.styles'\nimport { useIntersectionAnimation } from './useIntersectionAnimation'\n\nexport type MeterTrackProps = Omit<ComponentProps<typeof BaseMeter.Track>, 'render'>\n\nexport const MeterTrack = ({ className, ...others }: MeterTrackProps) => {\n const { value, max, min, intent, shape } = useMeter()\n const percentage = ((value - min) / (max - min)) * 100\n const trackRef = useRef<HTMLDivElement>(null)\n const [hasAnimated, setHasAnimated] = useState(false)\n\n // Trigger animation when component enters viewport\n useIntersectionAnimation(trackRef, () => {\n setHasAnimated(true)\n })\n\n return (\n <BaseMeter.Track\n ref={trackRef}\n data-spark-component=\"meter-track\"\n className={cx(meterTrackStyles(), { 'rounded-sm': shape === 'rounded' }, className)}\n {...others}\n >\n <BaseMeter.Indicator\n data-spark-component=\"meter-indicator\"\n className={meterIndicatorStyles({ intent, shape })}\n style={{\n width: hasAnimated ? `${percentage}%` : '0%',\n }}\n />\n </BaseMeter.Track>\n )\n}\n\nMeterTrack.displayName = 'Meter.Track'\n","import { Meter as BaseMeter } from '@base-ui/react/meter'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren } from 'react'\n\nexport type MeterValueProps = Omit<ComponentProps<typeof BaseMeter.Value>, 'render'>\n\nexport const MeterValue = ({\n className,\n children,\n ...others\n}: PropsWithChildren<MeterValueProps>) => {\n return (\n <BaseMeter.Value\n data-spark-component=\"meter-value\"\n className={cx('default:text-body-1 text-on-surface', 'col-start-2 text-right', className)}\n {...others}\n >\n {children}\n </BaseMeter.Value>\n )\n}\n\nMeterValue.displayName = 'Meter.Value'\n","import { Meter as Root } from './Meter'\nimport { MeterLabel } from './MeterLabel'\nimport { MeterTrack } from './MeterTrack'\nimport { MeterValue } from './MeterValue'\n\nexport const Meter: typeof Root & {\n Label: typeof MeterLabel\n Track: typeof MeterTrack\n Value: typeof MeterValue\n} = Object.assign(Root, {\n Label: MeterLabel,\n Track: MeterTrack,\n Value: MeterValue,\n})\n\nMeter.displayName = 'Meter'\nMeterLabel.displayName = 'Meter.Label'\nMeterTrack.displayName = 'Meter.Track'\nMeterValue.displayName = 'Meter.Value'\n\nexport { type MeterProps } from './Meter'\nexport { type MeterLabelProps } from './MeterLabel'\nexport { type MeterTrackProps } from './MeterTrack'\nexport { type MeterValueProps } from './MeterValue'\n"],"names":["MeterContext","createContext","ID_PREFIX","useMeter","context","useContext","Meter","className","value","max","min","shape","intent","children","ref","others","labelId","setLabelId","useState","contextValue","useMemo","jsx","BaseMeter","cx","MeterLabel","idProp","forwardedRef","internalID","useId","id","onLabelId","rootRef","useCallback","el","useMergeRefs","meterTrackStyles","cva","meterIndicatorStyles","useIntersectionAnimation","elementRef","onIntersect","options","threshold","rootMargin","hasTriggeredRef","useRef","callbackRef","useEffect","element","observer","entries","entry","MeterTrack","percentage","trackRef","hasAnimated","setHasAnimated","MeterValue","Root"],"mappings":";;;;;AAaO,MAAMA,IAAeC,EAAwC,IAAI,GAE3DC,IAAY,UAEZC,IAAW,MAAM;AAC5B,QAAMC,IAAUC,EAAWL,CAAY;AAEvC,MAAI,CAACI;AACH,UAAM,IAAI,MAAM,+CAA+C;AAGjE,SAAOA;AACT,GCJaE,IAAQ,CAAC;AAAA,EACpB,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,KAAAC,IAAM;AAAA,EACN,KAAAC,IAAM;AAAA,EACN,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,KAAAC;AAAA,EACA,GAAGC;AACL,MAAqC;AACnC,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAA,GAExBC,IAAeC,EAAQ,OACpB;AAAA,IACL,OAAOZ,KAAS;AAAA,IAChB,KAAAC;AAAA,IACA,KAAAC;AAAA,IACA,QAAAE;AAAA,IACA,OAAAD;AAAA,IACA,WAAWM;AAAA,EAAA,IAEZ,CAACR,GAAKC,GAAKF,GAAOI,GAAQD,GAAOM,CAAU,CAAC;AAE/C,SACE,gBAAAI,EAACrB,EAAa,UAAb,EAAsB,OAAOmB,GAC5B,UAAA,gBAAAE;AAAA,IAACC,EAAU;AAAA,IAAV;AAAA,MACC,wBAAqB;AAAA,MACrB,KAAAR;AAAA,MACA,WAAWS,EAAG,gEAAgEhB,CAAS;AAAA,MACvF,OAAAC;AAAA,MACA,KAAAC;AAAA,MACA,KAAAC;AAAA,MACA,mBAAiBM;AAAA,MAChB,GAAGD;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAEAP,EAAM,cAAc;ACvDb,MAAMkB,IAAa,CAAC;AAAA,EACzB,IAAIC;AAAA,EACJ,UAAAZ;AAAA,EACA,KAAKa;AAAA,EACL,GAAGX;AACL,MAAuB;AACrB,QAAMY,IAA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,wBAAqB;AAAA,UACrB,WAAWe,EAAqB,EAAE,QAAAzB,GAAQ,OAAAD,GAAO;AAAA,UACjD,OAAO;AAAA,YACL,OAAO4C,IAAc,GAAGF,CAAU,MAAM;AAAA,UAAA;AAAA,QAC1C;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;AAEAD,EAAW,cAAc;ACjClB,MAAMK,IAAa,CAAC;AAAA,EACzB,WAAAlD;AAAA,EACA,UAAAM;AAAA,EACA,GAAGE;AACL,MAEI,gBAAAM;AAAA,EAACC,EAAU;AAAA,EAAV;AAAA,IACC,wBAAqB;AAAA,IACrB,WAAWC,EAAG,uCAAuC,0BAA0BhB,CAAS;AAAA,IACvF,GAAGQ;AAAA,IAEH,UAAAF;AAAA,EAAA;AAAA;AAKP4C,EAAW,cAAc;ACjBlB,MAAMnD,IAIT,OAAO,OAAOoD,GAAM;AAAA,EACtB,OAAOlC;AAAA,EACP,OAAO4B;AAAA,EACP,OAAOK;AACT,CAAC;AAEDnD,EAAM,cAAc;AACpBkB,EAAW,cAAc;AACzB4B,EAAW,cAAc;AACzBK,EAAW,cAAc;"}
@@ -0,0 +1,26 @@
1
+ import { RefObject } from 'react';
2
+ export interface UseIntersectionAnimationOptions {
3
+ /**
4
+ * The threshold at which the callback should be triggered.
5
+ * A value of 0 means as soon as any part of the element is visible.
6
+ * A value of 1 means the entire element must be visible.
7
+ * @default 0.1
8
+ */
9
+ threshold?: number;
10
+ /**
11
+ * The root margin for the Intersection Observer.
12
+ * This can be used to trigger the animation before the element enters the viewport.
13
+ * @default undefined
14
+ */
15
+ rootMargin?: string;
16
+ }
17
+ /**
18
+ * Hook to trigger an animation callback when an element enters the viewport.
19
+ * The callback is only triggered once, when the element first becomes visible.
20
+ *
21
+ * @param elementRef - Reference to the element to observe
22
+ * @param onIntersect - Callback to execute when the element enters the viewport
23
+ * @param options - Configuration options for the Intersection Observer
24
+ * @returns Whether the animation has been triggered
25
+ */
26
+ export declare function useIntersectionAnimation(elementRef: RefObject<Element | null>, onIntersect: () => void, options?: UseIntersectionAnimationOptions): boolean;
@@ -1,16 +1,24 @@
1
- import { Progress as RadixProgress } from 'radix-ui';
2
- import { PropsWithChildren, Ref } from 'react';
3
- import { ProgressIndicatorStylesProps } from './ProgressIndicator.styles';
4
- export interface ProgressProps extends RadixProgress.ProgressProps, Pick<ProgressIndicatorStylesProps, 'intent'> {
1
+ import { Progress as BaseProgress } from '@base-ui/react/progress';
2
+ import { ComponentProps, PropsWithChildren, Ref } from 'react';
3
+ import { ProgressIndicatorStylesProps } from './ProgressIndicator';
4
+ export interface ProgressProps extends Omit<ComponentProps<typeof BaseProgress.Root>, 'render'>, Pick<ProgressIndicatorStylesProps, 'intent'> {
5
5
  shape?: 'square' | 'rounded';
6
- isIndeterminate?: boolean;
7
6
  /**
8
7
  * Callback called when the progress reaches its maximum value and the transition animation completes.
9
8
  */
10
9
  onComplete?: () => void;
10
+ /**
11
+ * Function that returns a string value that provides a human-readable text alternative for the current value of the progress bar.
12
+ * @deprecated Use `getAriaValueText` instead. This prop is kept for backward compatibility.
13
+ */
14
+ getValueLabel?: (value: number, max: number) => string;
15
+ /**
16
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
17
+ */
18
+ asChild?: boolean;
11
19
  ref?: Ref<HTMLDivElement>;
12
20
  }
13
21
  export declare const Progress: {
14
- ({ className, value: valueProp, max, shape, intent, isIndeterminate, onComplete, children, ref, ...others }: PropsWithChildren<ProgressProps>): import("react/jsx-runtime").JSX.Element;
22
+ ({ className, value: valueProp, max, min, shape, intent, onComplete, getValueLabel, getAriaValueText: getAriaValueTextProp, children, ref, ...others }: PropsWithChildren<ProgressProps>): import("react/jsx-runtime").JSX.Element;
15
23
  displayName: string;
16
24
  };
@@ -1,8 +1,8 @@
1
- import { ProgressIndicatorStylesProps } from './ProgressIndicator.styles';
1
+ import { ProgressIndicatorStylesProps } from './ProgressIndicator';
2
2
  export interface ProgressContextValue {
3
- value: number;
3
+ value: number | null;
4
4
  max: number;
5
- isIndeterminate: boolean;
5
+ min: number;
6
6
  shape: 'square' | 'rounded';
7
7
  intent: ProgressIndicatorStylesProps['intent'];
8
8
  onLabelId: (id?: string) => void;
@@ -1,5 +1,12 @@
1
- import { ComponentPropsWithRef, PropsWithChildren } from 'react';
2
- export type ProgressIndicatorProps = ComponentPropsWithRef<'div'>;
1
+ import { Progress as BaseProgress } from '@base-ui/react/progress';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import { ComponentProps, PropsWithChildren } from 'react';
4
+ export declare const progressIndicatorStyles: (props?: ({
5
+ intent?: "main" | "alert" | "support" | "accent" | "basic" | "success" | "info" | "neutral" | "danger" | null | undefined;
6
+ shape?: "square" | "rounded" | null | undefined;
7
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
+ export type ProgressIndicatorStylesProps = VariantProps<typeof progressIndicatorStyles>;
9
+ export type ProgressIndicatorProps = Omit<ComponentProps<typeof BaseProgress.Indicator>, 'render'>;
3
10
  export declare const ProgressIndicator: {
4
11
  ({ className, style, ref, onTransitionEnd, ...others }: PropsWithChildren<ProgressIndicatorProps>): import("react/jsx-runtime").JSX.Element;
5
12
  displayName: string;
@@ -1,5 +1,6 @@
1
- import { ComponentPropsWithRef } from 'react';
2
- export type ProgressLabelProps = ComponentPropsWithRef<'span'>;
1
+ import { Progress as BaseProgress } from '@base-ui/react/progress';
2
+ import { ComponentProps } from 'react';
3
+ export type ProgressLabelProps = Omit<ComponentProps<typeof BaseProgress.Label>, 'render'>;
3
4
  export declare const ProgressLabel: {
4
5
  ({ id: idProp, children, ref: forwardedRef, ...others }: ProgressLabelProps): import("react/jsx-runtime").JSX.Element;
5
6
  displayName: string;
@@ -0,0 +1,7 @@
1
+ import { Progress as BaseProgress } from '@base-ui/react/progress';
2
+ import { ComponentProps } from 'react';
3
+ export type ProgressTrackProps = Omit<ComponentProps<typeof BaseProgress.Track>, 'render'>;
4
+ export declare const ProgressTrack: {
5
+ ({ className, ...others }: ProgressTrackProps): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { Progress as BaseProgress } from '@base-ui/react/progress';
2
+ import { ComponentProps, PropsWithChildren } from 'react';
3
+ export type ProgressValueProps = Omit<ComponentProps<typeof BaseProgress.Value>, 'render'>;
4
+ export declare const ProgressValue: {
5
+ ({ className, children, ...others }: PropsWithChildren<ProgressValueProps>): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
@@ -1,13 +1,13 @@
1
1
  import { Progress as Root } from './Progress';
2
- import { ProgressBar } from './ProgressBar';
3
- import { ProgressIndicator } from './ProgressIndicator';
4
2
  import { ProgressLabel } from './ProgressLabel';
3
+ import { ProgressTrack } from './ProgressTrack';
4
+ import { ProgressValue } from './ProgressValue';
5
5
  export declare const Progress: typeof Root & {
6
6
  Label: typeof ProgressLabel;
7
- Bar: typeof ProgressBar;
8
- Indicator: typeof ProgressIndicator;
7
+ Track: typeof ProgressTrack;
8
+ Value: typeof ProgressValue;
9
9
  };
10
10
  export { type ProgressProps } from './Progress';
11
- export { type ProgressBarProps } from './ProgressBar';
12
11
  export { type ProgressLabelProps } from './ProgressLabel';
13
- export { type ProgressIndicatorProps } from './ProgressIndicator';
12
+ export { type ProgressTrackProps } from './ProgressTrack';
13
+ export { type ProgressValueProps } from './ProgressValue';
@@ -1,13 +1,13 @@
1
1
  import { Progress as Root } from './Progress';
2
- import { ProgressBar } from './ProgressBar';
3
- import { ProgressIndicator } from './ProgressIndicator';
4
2
  import { ProgressLabel } from './ProgressLabel';
3
+ import { ProgressTrack } from './ProgressTrack';
4
+ import { ProgressValue } from './ProgressValue';
5
5
  export declare const Progress: typeof Root & {
6
6
  Label: typeof ProgressLabel;
7
- Bar: typeof ProgressBar;
8
- Indicator: typeof ProgressIndicator;
7
+ Track: typeof ProgressTrack;
8
+ Value: typeof ProgressValue;
9
9
  };
10
10
  export { type ProgressProps } from './Progress';
11
- export { type ProgressBarProps } from './ProgressBar';
12
11
  export { type ProgressLabelProps } from './ProgressLabel';
13
- export { type ProgressIndicatorProps } from './ProgressIndicator';
12
+ export { type ProgressTrackProps } from './ProgressTrack';
13
+ export { type ProgressValueProps } from './ProgressValue';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),P=require("class-variance-authority"),I=require("radix-ui"),l=require("react"),q=require("@spark-ui/hooks/use-merge-refs"),k=P.cva(["relative","h-sz-4 w-full","transform-gpu overflow-hidden","bg-on-background/dim-4"],{variants:{shape:{square:[],rounded:["rounded-sm"]}}}),v=l.createContext(null),L=":progress",x=()=>{const s=l.useContext(v);if(!s)throw new Error("useProgress must be used within a Progress provider");return s},w=P.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:[]}}}),p=({className:s,style:e,ref:r,onTransitionEnd:o,...n})=>{const{value:a,max:t,intent:d,shape:u,isIndeterminate:c,onComplete:g}=x(),b=(t-a)/t*100,f=j=>{o?.(j),a>=t&&g&&!c&&g()};return i.jsx(I.Progress.ProgressIndicator,{"data-spark-component":"progress-indicator",className:w({className:s,intent:d,shape:u,isIndeterminate:c}),style:{...e,...!c&&{transform:`translateX(-${b}%)`}},ref:r,onTransitionEnd:f,...n})};p.displayName="Progress.Indicator";const m=({className:s,children:e=i.jsx(p,{}),ref:r,...o})=>{const{shape:n}=x();return i.jsx("div",{"data-spark-component":"progress-bar",className:k({className:s,shape:n}),ref:r,...o,children:e})};m.displayName="Progress.Bar";const N=({className:s,value:e,max:r=100,shape:o="square",intent:n="basic",isIndeterminate:a=!1,onComplete:t,children:d=i.jsx(m,{}),ref:u,...c})=>{const[g,b]=l.useState(),f=l.useMemo(()=>({value:e??0,max:r,intent:n,shape:o,isIndeterminate:a,onLabelId:b,onComplete:t}),[r,e,n,o,a,b,t]);return i.jsx(v.Provider,{"data-spark-component":"progress",value:f,children:i.jsx(I.Progress.Progress,{"data-spark-component":"progress",ref:u,className:P.cx("gap-sm focus-visible:u-outline flex flex-col",s),value:e,"aria-labelledby":g,max:r,tabIndex:-1,...c,children:d})})};N.displayName="Progress";const y=({id:s,children:e,ref:r,...o})=>{const n=`${L}-label-${l.useId()}`,a=s||n,{onLabelId:t}=x(),d=l.useCallback(c=>{t(c?a:void 0)},[a,t]),u=q.useMergeRefs(r,d);return i.jsx("span",{"data-spark-component":"progress-label",id:a,className:"text-body-2 text-on-surface",ref:u,...o,children:e})};y.displayName="Progress.Label";const h=Object.assign(N,{Label:y,Bar:m,Indicator:p});h.displayName="Progress";m.displayName="Progress.Bar";p.displayName="Progress.Indicator";y.displayName="Progress.Label";exports.Progress=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),g=require("@base-ui/react/progress"),b=require("class-variance-authority"),i=require("react"),L=require("@spark-ui/hooks/use-merge-refs"),I=i.createContext(null),R=":progress",h=()=>{const s=i.useContext(I);if(!s)throw new Error("useProgress must be used within a Progress provider");return s},C=b.cva(["h-full w-full","transition-width 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"]}}}),j=({className:s,style:t,ref:r,onTransitionEnd:n,...c})=>{const{value:e,max:a,min:l,intent:u,shape:d,onComplete:p}=h(),f=e!==null?(e-l)/(a-l)*100:0,m=e===null,P=y=>{n?.(y),e!==null&&e>=a&&p&&p()};return o.jsx(g.Progress.Indicator,{"data-spark-component":"progress-indicator",className:b.cx(C({className:s,intent:u,shape:d}),m&&"animate-standalone-indeterminate-bar absolute -translate-x-1/2"),style:{...t,...!m&&e!==null&&{width:`${f}%`}},ref:r,onTransitionEnd:P,...c})};j.displayName="ProgressIndicator";const x=({className:s,...t})=>{const{shape:r}=h();return o.jsx(g.Progress.Track,{"data-spark-component":"progress-track",className:b.cx("h-sz-4 relative col-span-2 w-full","transform-gpu","overflow-hidden","bg-on-background/dim-4",{"rounded-sm":r==="rounded"},s),...t,children:o.jsx(j,{})})};x.displayName="Progress.Track";const T=({className:s,value:t,max:r=100,min:n=0,shape:c="square",intent:e="basic",onComplete:a,getValueLabel:l,getAriaValueText:u,children:d=o.jsx(x,{}),ref:p,...f})=>{const[m,P]=i.useState(),y=i.useMemo(()=>({value:t??null,max:r,min:n,intent:e,shape:c,onLabelId:P,onComplete:a}),[r,n,t,e,c,P,a]),V=u||(l?(q,v)=>v===null?q??"":l(v,r):void 0);return o.jsx(I.Provider,{value:y,children:o.jsx(g.Progress.Root,{"data-spark-component":"progress",ref:p,className:b.cx("gap-sm focus-visible:u-outline grid grid-cols-2",s),value:t??null,max:r,min:n,"aria-labelledby":m,getAriaValueText:V,...f,children:d})})};T.displayName="Progress";const N=({id:s,children:t,ref:r,...n})=>{const c=`${R}-label-${i.useId()}`,e=s||c,{onLabelId:a}=h(),l=i.useCallback(d=>{a(d?e:void 0)},[e,a]),u=L.useMergeRefs(r,l);return o.jsx(g.Progress.Label,{"data-spark-component":"progress-label",id:e,className:"default:text-body-1 text-on-surface default:font-bold",ref:u,...n,children:t})};N.displayName="Progress.Label";const k=({className:s,children:t,...r})=>o.jsx(g.Progress.Value,{"data-spark-component":"progress-value",className:b.cx("default:text-body-1 text-on-surface col-start-2 text-right",s),...r,children:t});k.displayName="Progress.Value";const w=Object.assign(T,{Label:N,Track:x,Value:k});w.displayName="Progress";N.displayName="Progress.Label";x.displayName="Progress.Track";k.displayName="Progress.Value";exports.Progress=w;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/progress/ProgressBar.styles.ts","../../src/progress/ProgressContext.tsx","../../src/progress/ProgressIndicator.styles.ts","../../src/progress/ProgressIndicator.tsx","../../src/progress/ProgressBar.tsx","../../src/progress/Progress.tsx","../../src/progress/ProgressLabel.tsx","../../src/progress/index.ts"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority'\n\nexport const progressBarStyles = cva(\n ['relative', 'h-sz-4 w-full', 'transform-gpu overflow-hidden', 'bg-on-background/dim-4'],\n {\n variants: {\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n }\n)\n\nexport type ProgressBarStylesProps = VariantProps<typeof progressBarStyles>\n","import { createContext, useContext } from 'react'\n\nimport { ProgressIndicatorStylesProps } from './ProgressIndicator.styles'\n\nexport interface ProgressContextValue {\n value: number\n max: number\n isIndeterminate: boolean\n shape: 'square' | 'rounded'\n intent: ProgressIndicatorStylesProps['intent']\n onLabelId: (id?: string) => void\n onComplete?: () => void\n}\n\nexport const ProgressContext = createContext<ProgressContextValue | null>(null)\n\nexport const ID_PREFIX = ':progress'\n\nexport const useProgress = () => {\n const context = useContext(ProgressContext)\n\n if (!context) {\n throw new Error('useProgress must be used within a Progress provider')\n }\n\n return context\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const progressIndicatorStyles = cva(['h-full w-full', 'transition-transform duration-400'], {\n variants: {\n /**\n * Color scheme of the progress component.\n */\n intent: {\n basic: ['bg-basic'],\n main: ['bg-main'],\n support: ['bg-support'],\n accent: ['bg-accent'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n neutral: ['bg-neutral'],\n },\n /**\n * Shape of the progress component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n /**\n * Sets if the progress value is not determinated.\n */\n isIndeterminate: {\n true: ['absolute', '-translate-x-1/2', 'animate-standalone-indeterminate-bar'],\n false: [],\n },\n },\n})\n\nexport type ProgressIndicatorStylesProps = VariantProps<typeof progressIndicatorStyles>\n","import { Progress as RadixProgress } from 'radix-ui'\nimport { ComponentPropsWithRef, PropsWithChildren } from 'react'\n\nimport { useProgress } from './ProgressContext'\nimport { progressIndicatorStyles } from './ProgressIndicator.styles'\n\nexport type ProgressIndicatorProps = ComponentPropsWithRef<'div'>\n\nexport const ProgressIndicator = ({\n className,\n style,\n ref,\n onTransitionEnd,\n ...others\n}: PropsWithChildren<ProgressIndicatorProps>) => {\n const { value, max, intent, shape, isIndeterminate, onComplete } = useProgress()\n const x = ((max - value) / max) * 100\n\n const handleTransitionEnd = (event: React.TransitionEvent<HTMLDivElement>) => {\n // Call the original onTransitionEnd if provided\n onTransitionEnd?.(event)\n\n // If progress is complete and we have a callback, call it\n if (value >= max && onComplete && !isIndeterminate) {\n onComplete()\n }\n }\n\n return (\n <RadixProgress.ProgressIndicator\n data-spark-component=\"progress-indicator\"\n className={progressIndicatorStyles({ className, intent, shape, isIndeterminate })}\n style={{ ...style, ...(!isIndeterminate && { transform: `translateX(-${x}%)` }) }}\n ref={ref}\n onTransitionEnd={handleTransitionEnd}\n {...others}\n />\n )\n}\n\nProgressIndicator.displayName = 'Progress.Indicator'\n","import { ComponentPropsWithRef, PropsWithChildren } from 'react'\n\nimport { progressBarStyles } from './ProgressBar.styles'\nimport { useProgress } from './ProgressContext'\nimport { ProgressIndicator } from './ProgressIndicator'\n\nexport type ProgressBarProps = ComponentPropsWithRef<'div'>\n\nexport const ProgressBar = ({\n className,\n children = <ProgressIndicator />,\n ref,\n ...others\n}: PropsWithChildren<ProgressBarProps>) => {\n const { shape } = useProgress()\n\n return (\n <div\n data-spark-component=\"progress-bar\"\n className={progressBarStyles({ className, shape })}\n ref={ref}\n {...others}\n >\n {children}\n </div>\n )\n}\n\nProgressBar.displayName = 'Progress.Bar'\n","import { cx } from 'class-variance-authority'\nimport { Progress as RadixProgress } from 'radix-ui'\nimport { PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { ProgressBar } from './ProgressBar'\nimport { ProgressContext } from './ProgressContext'\nimport { ProgressIndicatorStylesProps } from './ProgressIndicator.styles'\n\nexport interface ProgressProps\n extends RadixProgress.ProgressProps,\n Pick<ProgressIndicatorStylesProps, 'intent'> {\n shape?: 'square' | 'rounded'\n isIndeterminate?: boolean\n /**\n * Callback called when the progress reaches its maximum value and the transition animation completes.\n */\n onComplete?: () => void\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Progress = ({\n className,\n value: valueProp,\n max = 100,\n shape = 'square',\n intent = 'basic',\n isIndeterminate = false,\n onComplete,\n children = <ProgressBar />,\n ref,\n ...others\n}: PropsWithChildren<ProgressProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const value = useMemo(() => {\n return {\n value: valueProp ?? 0,\n max,\n intent,\n shape,\n isIndeterminate,\n onLabelId: setLabelId,\n onComplete,\n }\n }, [max, valueProp, intent, shape, isIndeterminate, setLabelId, onComplete])\n\n return (\n <ProgressContext.Provider data-spark-component=\"progress\" value={value}>\n <RadixProgress.Progress\n data-spark-component=\"progress\"\n ref={ref}\n className={cx('gap-sm focus-visible:u-outline flex flex-col', className)}\n value={valueProp}\n aria-labelledby={labelId}\n max={max}\n tabIndex={-1}\n {...others}\n >\n {children}\n </RadixProgress.Progress>\n </ProgressContext.Provider>\n )\n}\n\nProgress.displayName = 'Progress'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ComponentPropsWithRef, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useProgress } from './ProgressContext'\n\nexport type ProgressLabelProps = ComponentPropsWithRef<'span'>\n\nexport const ProgressLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: ProgressLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useProgress()\n const rootRef = useCallback(\n (el: HTMLSpanElement) => {\n onLabelId(el ? id : undefined)\n },\n [id, onLabelId]\n )\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n return (\n <span\n data-spark-component=\"progress-label\"\n id={id}\n className=\"text-body-2 text-on-surface\"\n ref={ref}\n {...others}\n >\n {children}\n </span>\n )\n}\n\nProgressLabel.displayName = 'Progress.Label'\n","import { Progress as Root } from './Progress'\nimport { ProgressBar } from './ProgressBar'\nimport { ProgressIndicator } from './ProgressIndicator'\nimport { ProgressLabel } from './ProgressLabel'\n\nexport const Progress: typeof Root & {\n Label: typeof ProgressLabel\n Bar: typeof ProgressBar\n Indicator: typeof ProgressIndicator\n} = Object.assign(Root, {\n Label: ProgressLabel,\n Bar: ProgressBar,\n Indicator: ProgressIndicator,\n})\n\nProgress.displayName = 'Progress'\nProgressBar.displayName = 'Progress.Bar'\nProgressIndicator.displayName = 'Progress.Indicator'\nProgressLabel.displayName = 'Progress.Label'\n\nexport { type ProgressProps } from './Progress'\nexport { type ProgressBarProps } from './ProgressBar'\nexport { type ProgressLabelProps } from './ProgressLabel'\nexport { type ProgressIndicatorProps } from './ProgressIndicator'\n"],"names":["progressBarStyles","cva","ProgressContext","createContext","ID_PREFIX","useProgress","context","useContext","progressIndicatorStyles","ProgressIndicator","className","style","ref","onTransitionEnd","others","value","max","intent","shape","isIndeterminate","onComplete","x","handleTransitionEnd","event","jsx","RadixProgress","ProgressBar","children","Progress","valueProp","labelId","setLabelId","useState","useMemo","cx","ProgressLabel","idProp","forwardedRef","internalID","useId","id","onLabelId","rootRef","useCallback","el","useMergeRefs","Root"],"mappings":"gPAEaA,EAAoBC,EAAAA,IAC/B,CAAC,WAAY,gBAAiB,gCAAiC,wBAAwB,EACvF,CACE,SAAU,CACR,MAAO,CACL,OAAQ,CAAA,EACR,QAAS,CAAC,YAAY,CAAA,CACxB,CACF,CAEJ,ECEaC,EAAkBC,EAAAA,cAA2C,IAAI,EAEjEC,EAAY,YAEZC,EAAc,IAAM,CAC/B,MAAMC,EAAUC,EAAAA,WAAWL,CAAe,EAE1C,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,qDAAqD,EAGvE,OAAOA,CACT,ECxBaE,EAA0BP,EAAAA,IAAI,CAAC,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AK,MAAS,CAC/B,EACA,CAACA,EAAIC,CAAS,CAAA,EAEV7B,EAAMiC,EAAAA,aAAaR,EAAcK,CAAO,EAE9C,OACElB,EAAAA,IAAC,OAAA,CACC,uBAAqB,iBACrB,GAAAgB,EACA,UAAU,8BACV,IAAA5B,EACC,GAAGE,EAEH,SAAAa,CAAA,CAAA,CAGP,EAEAQ,EAAc,YAAc,iBCjCrB,MAAMP,EAIT,OAAO,OAAOkB,EAAM,CACtB,MAAOX,EACP,IAAKT,EACL,UAAWjB,CACb,CAAC,EAEDmB,EAAS,YAAc,WACvBF,EAAY,YAAc,eAC1BjB,EAAkB,YAAc,qBAChC0B,EAAc,YAAc"}
1
+ {"version":3,"file":"index.js","sources":["../../src/progress/ProgressContext.tsx","../../src/progress/ProgressIndicator.tsx","../../src/progress/ProgressTrack.tsx","../../src/progress/Progress.tsx","../../src/progress/ProgressLabel.tsx","../../src/progress/ProgressValue.tsx","../../src/progress/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport { ProgressIndicatorStylesProps } from './ProgressIndicator'\n\nexport interface ProgressContextValue {\n value: number | null\n max: number\n min: number\n shape: 'square' | 'rounded'\n intent: ProgressIndicatorStylesProps['intent']\n onLabelId: (id?: string) => void\n onComplete?: () => void\n}\n\nexport const ProgressContext = createContext<ProgressContextValue | null>(null)\n\nexport const ID_PREFIX = ':progress'\n\nexport const useProgress = () => {\n const context = useContext(ProgressContext)\n\n if (!context) {\n throw new Error('useProgress must be used within a Progress provider')\n }\n\n return context\n}\n","import { Progress as BaseProgress } from '@base-ui/react/progress'\nimport { cva, cx, VariantProps } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren } from 'react'\n\nimport { useProgress } from './ProgressContext'\n\nexport const progressIndicatorStyles = cva(['h-full w-full', 'transition-width duration-400'], {\n variants: {\n /**\n * Color scheme of the progress component.\n */\n intent: {\n basic: ['bg-basic'],\n main: ['bg-main'],\n support: ['bg-support'],\n accent: ['bg-accent'],\n success: ['bg-success'],\n alert: ['bg-alert'],\n danger: ['bg-error'],\n info: ['bg-info'],\n neutral: ['bg-neutral'],\n },\n /**\n * Shape of the progress component.\n */\n shape: {\n square: [],\n rounded: ['rounded-sm'],\n },\n },\n})\n\nexport type ProgressIndicatorStylesProps = VariantProps<typeof progressIndicatorStyles>\n\nexport type ProgressIndicatorProps = Omit<ComponentProps<typeof BaseProgress.Indicator>, 'render'>\n\nexport const ProgressIndicator = ({\n className,\n style,\n ref,\n onTransitionEnd,\n ...others\n}: PropsWithChildren<ProgressIndicatorProps>) => {\n const { value, max, min, intent, shape, onComplete } = useProgress()\n\n const percentage = value !== null ? ((value - min) / (max - min)) * 100 : 0\n const isIndeterminate = value === null\n\n const handleTransitionEnd = (event: Parameters<NonNullable<ProgressIndicatorProps['onTransitionEnd']>>[0]) => {\n // Call the original onTransitionEnd if provided\n onTransitionEnd?.(event)\n\n // If progress is complete and we have a callback, call it\n if (value !== null && value >= max && onComplete) {\n onComplete()\n }\n }\n\n return (\n <BaseProgress.Indicator\n data-spark-component=\"progress-indicator\"\n className={cx(\n progressIndicatorStyles({\n className,\n intent,\n shape,\n }),\n isIndeterminate && 'animate-standalone-indeterminate-bar absolute -translate-x-1/2'\n )}\n style={{\n ...style,\n ...(!isIndeterminate && value !== null && { width: `${percentage}%` }),\n }}\n ref={ref}\n onTransitionEnd={handleTransitionEnd}\n {...others}\n />\n )\n}\n\nProgressIndicator.displayName = 'ProgressIndicator'\n","import { Progress as BaseProgress } from '@base-ui/react/progress'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps } from 'react'\n\nimport { useProgress } from './ProgressContext'\nimport { ProgressIndicator } from './ProgressIndicator'\n\nexport type ProgressTrackProps = Omit<ComponentProps<typeof BaseProgress.Track>, 'render'>\n\nexport const ProgressTrack = ({ className, ...others }: ProgressTrackProps) => {\n const { shape } = useProgress()\n\n return (\n <BaseProgress.Track\n data-spark-component=\"progress-track\"\n className={cx(\n 'h-sz-4 relative col-span-2 w-full',\n 'transform-gpu',\n 'overflow-hidden',\n 'bg-on-background/dim-4',\n { 'rounded-sm': shape === 'rounded' },\n className\n )}\n {...others}\n >\n <ProgressIndicator />\n </BaseProgress.Track>\n )\n}\n\nProgressTrack.displayName = 'Progress.Track'\n","import { Progress as BaseProgress } from '@base-ui/react/progress'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren, Ref, useMemo, useState } from 'react'\n\nimport { ProgressContext } from './ProgressContext'\nimport { ProgressIndicatorStylesProps } from './ProgressIndicator'\nimport { ProgressTrack } from './ProgressTrack'\n\nexport interface ProgressProps\n extends Omit<ComponentProps<typeof BaseProgress.Root>, 'render'>,\n Pick<ProgressIndicatorStylesProps, 'intent'> {\n shape?: 'square' | 'rounded'\n /**\n * Callback called when the progress reaches its maximum value and the transition animation completes.\n */\n onComplete?: () => void\n /**\n * Function that returns a string value that provides a human-readable text alternative for the current value of the progress bar.\n * @deprecated Use `getAriaValueText` instead. This prop is kept for backward compatibility.\n */\n getValueLabel?: (value: number, max: number) => string\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Progress = ({\n className,\n value: valueProp,\n max = 100,\n min = 0,\n shape = 'square',\n intent = 'basic',\n onComplete,\n getValueLabel,\n getAriaValueText: getAriaValueTextProp,\n children = <ProgressTrack />,\n ref,\n ...others\n}: PropsWithChildren<ProgressProps>) => {\n const [labelId, setLabelId] = useState<string>()\n\n const contextValue = useMemo(() => {\n return {\n value: valueProp ?? null,\n max,\n min,\n intent,\n shape,\n onLabelId: setLabelId,\n onComplete,\n }\n }, [max, min, valueProp, intent, shape, setLabelId, onComplete])\n\n // Map getValueLabel to getAriaValueText for backward compatibility\n const getAriaValueText =\n getAriaValueTextProp ||\n (getValueLabel\n ? (formattedValue: string | null, value: number | null) => {\n if (value === null) return formattedValue ?? ''\n\n return getValueLabel(value, max)\n }\n : undefined)\n\n return (\n <ProgressContext.Provider value={contextValue}>\n <BaseProgress.Root\n data-spark-component=\"progress\"\n ref={ref}\n className={cx('gap-sm focus-visible:u-outline grid grid-cols-2', className)}\n value={valueProp ?? null}\n max={max}\n min={min}\n aria-labelledby={labelId}\n getAriaValueText={getAriaValueText}\n {...others}\n >\n {children}\n </BaseProgress.Root>\n </ProgressContext.Provider>\n )\n}\n\nProgress.displayName = 'Progress'\n","import { Progress as BaseProgress } from '@base-ui/react/progress'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { ComponentProps, useCallback, useId } from 'react'\n\nimport { ID_PREFIX, useProgress } from './ProgressContext'\n\nexport type ProgressLabelProps = Omit<ComponentProps<typeof BaseProgress.Label>, 'render'>\n\nexport const ProgressLabel = ({\n id: idProp,\n children,\n ref: forwardedRef,\n ...others\n}: ProgressLabelProps) => {\n const internalID = `${ID_PREFIX}-label-${useId()}`\n const id = idProp || internalID\n\n const { onLabelId } = useProgress()\n const rootRef = useCallback(\n (el: HTMLSpanElement) => {\n onLabelId(el ? id : undefined)\n },\n [id, onLabelId]\n )\n const ref = useMergeRefs(forwardedRef, rootRef)\n\n return (\n <BaseProgress.Label\n data-spark-component=\"progress-label\"\n id={id}\n className=\"default:text-body-1 text-on-surface default:font-bold\"\n ref={ref}\n {...others}\n >\n {children}\n </BaseProgress.Label>\n )\n}\n\nProgressLabel.displayName = 'Progress.Label'\n","import { Progress as BaseProgress } from '@base-ui/react/progress'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, PropsWithChildren } from 'react'\n\nexport type ProgressValueProps = Omit<ComponentProps<typeof BaseProgress.Value>, 'render'>\n\nexport const ProgressValue = ({\n className,\n children,\n ...others\n}: PropsWithChildren<ProgressValueProps>) => {\n return (\n <BaseProgress.Value\n data-spark-component=\"progress-value\"\n className={cx('default:text-body-1 text-on-surface col-start-2 text-right', className)}\n {...others}\n >\n {children}\n </BaseProgress.Value>\n )\n}\n\nProgressValue.displayName = 'Progress.Value'\n","import { Progress as Root } from './Progress'\nimport { ProgressLabel } from './ProgressLabel'\nimport { ProgressTrack } from './ProgressTrack'\nimport { ProgressValue } from './ProgressValue'\n\nexport const Progress: typeof Root & {\n Label: typeof ProgressLabel\n Track: typeof ProgressTrack\n Value: typeof ProgressValue\n} = Object.assign(Root, {\n Label: ProgressLabel,\n Track: ProgressTrack,\n Value: ProgressValue,\n})\n\nProgress.displayName = 'Progress'\nProgressLabel.displayName = 'Progress.Label'\nProgressTrack.displayName = 'Progress.Track'\nProgressValue.displayName = 'Progress.Value'\n\nexport { type ProgressProps } from './Progress'\nexport { type ProgressLabelProps } from './ProgressLabel'\nexport { type ProgressTrackProps } from './ProgressTrack'\nexport { type ProgressValueProps } from './ProgressValue'\n"],"names":["ProgressContext","createContext","ID_PREFIX","useProgress","context","useContext","progressIndicatorStyles","cva","ProgressIndicator","className","style","ref","onTransitionEnd","others","value","max","min","intent","shape","onComplete","percentage","isIndeterminate","handleTransitionEnd","event","jsx","BaseProgress","cx","ProgressTrack","Progress","valueProp","getValueLabel","getAriaValueTextProp","children","labelId","setLabelId","useState","contextValue","useMemo","getAriaValueText","formattedValue","ProgressLabel","idProp","forwardedRef","internalID","useId","id","onLabelId","rootRef","useCallback","el","useMergeRefs","ProgressValue","Root"],"mappings":"+PAcaA,EAAkBC,EAAAA,cAA2C,IAAI,EAEjEC,EAAY,YAEZC,EAAc,IAAM,CAC/B,MAAMC,EAAUC,EAAAA,WAAWL,CAAe,EAE1C,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,qDAAqD,EAGvE,OAAOA,CACT,ECpBaE,EAA0BC,EAAAA,IAAI,CAAC,gBAAiB,+BAA+B,EAAG,CAC7F,SAAU,CAIR,OAAQ,CACN,MAAO,CAAC,UAAU,EAClB,KAAM,CAAC,SAAS,EAChB,QAAS,CAAC,YAAY,EACtB,OAAQ,CAAC,WAAW,EACpB,QAAS,CAAC,YAAY,EACtB,MAAO,CAAC,UAAU,EAClB,OAAQ,CAAC,UAAU,EACnB,KAAM,CAAC,SAAS,EAChB,QA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