premium-react-loaders 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/overlay/LoaderOverlay.d.ts.map +1 -1
- package/dist/components/progress/ProgressBar.d.ts.map +1 -1
- package/dist/components/progress/ProgressCircle.d.ts.map +1 -1
- package/dist/components/progress/ProgressRing.d.ts.map +1 -1
- package/dist/components/progress/ProgressSteps.d.ts.map +1 -1
- package/dist/components/pulse/PulseBars.d.ts.map +1 -1
- package/dist/components/pulse/PulseDots.d.ts.map +1 -1
- package/dist/components/pulse/PulseWave.d.ts.map +1 -1
- package/dist/components/pulse/TypingIndicator.d.ts.map +1 -1
- package/dist/components/skeleton/Skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonAvatar.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonCard.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonForm.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonImage.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonList.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonPage.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonTable.d.ts.map +1 -1
- package/dist/components/skeleton/SkeletonText.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerBars.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerCircle.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerDots.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerGrid.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerPulse.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerRing.d.ts.map +1 -1
- package/dist/components/spinner/SpinnerWave.d.ts.map +1 -1
- package/dist/index10.cjs +14 -2
- package/dist/index10.cjs.map +1 -1
- package/dist/index10.js +14 -2
- package/dist/index10.js.map +1 -1
- package/dist/index11.cjs +16 -2
- package/dist/index11.cjs.map +1 -1
- package/dist/index11.js +16 -2
- package/dist/index11.js.map +1 -1
- package/dist/index12.cjs +16 -2
- package/dist/index12.cjs.map +1 -1
- package/dist/index12.js +16 -2
- package/dist/index12.js.map +1 -1
- package/dist/index13.cjs +12 -2
- package/dist/index13.cjs.map +1 -1
- package/dist/index13.js +12 -2
- package/dist/index13.js.map +1 -1
- package/dist/index14.cjs +15 -2
- package/dist/index14.cjs.map +1 -1
- package/dist/index14.js +16 -3
- package/dist/index14.js.map +1 -1
- package/dist/index15.cjs +15 -2
- package/dist/index15.cjs.map +1 -1
- package/dist/index15.js +16 -3
- package/dist/index15.js.map +1 -1
- package/dist/index16.cjs +15 -2
- package/dist/index16.cjs.map +1 -1
- package/dist/index16.js +16 -3
- package/dist/index16.js.map +1 -1
- package/dist/index17.cjs +13 -2
- package/dist/index17.cjs.map +1 -1
- package/dist/index17.js +14 -3
- package/dist/index17.js.map +1 -1
- package/dist/index18.cjs +17 -4
- package/dist/index18.cjs.map +1 -1
- package/dist/index18.js +18 -5
- package/dist/index18.js.map +1 -1
- package/dist/index19.cjs +15 -2
- package/dist/index19.cjs.map +1 -1
- package/dist/index19.js +16 -3
- package/dist/index19.js.map +1 -1
- package/dist/index20.cjs +15 -2
- package/dist/index20.cjs.map +1 -1
- package/dist/index20.js +16 -3
- package/dist/index20.js.map +1 -1
- package/dist/index21.cjs +14 -3
- package/dist/index21.cjs.map +1 -1
- package/dist/index21.js +15 -4
- package/dist/index21.js.map +1 -1
- package/dist/index22.cjs +13 -2
- package/dist/index22.cjs.map +1 -1
- package/dist/index22.js +14 -3
- package/dist/index22.js.map +1 -1
- package/dist/index23.cjs +14 -3
- package/dist/index23.cjs.map +1 -1
- package/dist/index23.js +15 -4
- package/dist/index23.js.map +1 -1
- package/dist/index24.cjs +16 -2
- package/dist/index24.cjs.map +1 -1
- package/dist/index24.js +16 -2
- package/dist/index24.js.map +1 -1
- package/dist/index25.cjs +13 -2
- package/dist/index25.cjs.map +1 -1
- package/dist/index25.js +14 -3
- package/dist/index25.js.map +1 -1
- package/dist/index26.cjs +15 -4
- package/dist/index26.cjs.map +1 -1
- package/dist/index26.js +16 -5
- package/dist/index26.js.map +1 -1
- package/dist/index27.cjs +15 -4
- package/dist/index27.cjs.map +1 -1
- package/dist/index27.js +16 -5
- package/dist/index27.js.map +1 -1
- package/dist/index28.cjs +13 -2
- package/dist/index28.cjs.map +1 -1
- package/dist/index28.js +14 -3
- package/dist/index28.js.map +1 -1
- package/dist/index29.cjs +14 -2
- package/dist/index29.cjs.map +1 -1
- package/dist/index29.js +14 -2
- package/dist/index29.js.map +1 -1
- package/dist/index31.cjs +84 -0
- package/dist/index31.cjs.map +1 -1
- package/dist/index31.js +85 -1
- package/dist/index31.js.map +1 -1
- package/dist/index5.cjs +14 -2
- package/dist/index5.cjs.map +1 -1
- package/dist/index5.js +14 -2
- package/dist/index5.js.map +1 -1
- package/dist/index6.cjs +14 -2
- package/dist/index6.cjs.map +1 -1
- package/dist/index6.js +14 -2
- package/dist/index6.js.map +1 -1
- package/dist/index7.cjs +16 -2
- package/dist/index7.cjs.map +1 -1
- package/dist/index7.js +16 -2
- package/dist/index7.js.map +1 -1
- package/dist/index8.cjs +14 -2
- package/dist/index8.cjs.map +1 -1
- package/dist/index8.js +14 -2
- package/dist/index8.js.map +1 -1
- package/dist/index9.cjs +16 -2
- package/dist/index9.cjs.map +1 -1
- package/dist/index9.js +16 -2
- package/dist/index9.js.map +1 -1
- package/dist/premium-react-loaders.css +136 -4
- package/dist/types/common.d.ts +6 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/utils/hooks.d.ts +9 -0
- package/dist/utils/hooks.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index21.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index21.cjs","sources":["../src/components/progress/ProgressBar.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressBarProps } from '../../types';\nimport { cn, normalizeSize, getContrastColor, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * ProgressBar - Linear progress bar\n *\n * A horizontal progress bar that can be determinate (showing specific progress) or indeterminate (loading animation).\n *\n * @example\n * ```tsx\n * <ProgressBar value={75} showValue />\n * <ProgressBar indeterminate />\n * <ProgressBar value={50} height={8} color=\"#8b5cf6\" />\n * <ProgressBar value={50} buffer={75} /> // YouTube-style buffering\n * <ProgressBar value={60} gradient /> // Gradient progress\n * ```\n */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n height = '0.5rem',\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'progress-bar',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n
|
|
1
|
+
{"version":3,"file":"index21.cjs","sources":["../src/components/progress/ProgressBar.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressBarProps } from '../../types';\nimport { cn, normalizeSize, getContrastColor, useReducedMotion, getEffectiveDuration, useLoaderVisibility } from '../../utils';\n\n/**\n * ProgressBar - Linear progress bar\n *\n * A horizontal progress bar that can be determinate (showing specific progress) or indeterminate (loading animation).\n *\n * @example\n * ```tsx\n * <ProgressBar value={75} showValue />\n * <ProgressBar indeterminate />\n * <ProgressBar value={50} height={8} color=\"#8b5cf6\" />\n * <ProgressBar value={50} buffer={75} /> // YouTube-style buffering\n * <ProgressBar value={60} gradient /> // Gradient progress\n * ```\n */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n height = '0.5rem',\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'progress-bar',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n // Generate gradient ID for SVG-based gradient (must be before early return)\n const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);\n\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const clampedValue = Math.min(100, Math.max(0, value));\n const clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('relative w-full overflow-hidden rounded-full', className)}\n style={{\n height: normalizeSize(height),\n backgroundColor: secondaryColor,\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"progressbar\"\n aria-label={progressLabel}\n aria-valuenow={indeterminate ? undefined : clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n {...rest}\n >\n {/* Gradient SVG definition */}\n {gradient && !indeterminate && (\n <svg width=\"0\" height=\"0\" style={{ position: 'absolute' }}>\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" stopColor={color} />\n <stop offset=\"100%\" stopColor={secondaryColor || '#8b5cf6'} />\n </linearGradient>\n </defs>\n </svg>\n )}\n\n {/* Buffer indicator (shows behind main progress) */}\n {clampedBuffer !== undefined && !indeterminate && (\n <div\n className=\"absolute h-full rounded-full opacity-30\"\n style={{\n width: `${clampedBuffer}%`,\n backgroundColor: color,\n }}\n />\n )}\n\n {indeterminate ? (\n <div\n className=\"absolute h-full rounded-full\"\n style={{\n backgroundColor: gradient ? `url(#${gradientId})` : color,\n animation: `progress-indeterminate ${effectiveDuration} ease-in-out infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n width: '40%',\n }}\n />\n ) : (\n <div\n className=\"h-full rounded-full transition-all duration-300 ease-in-out\"\n style={{\n width: `${clampedValue}%`,\n background: gradient ? `url(#${gradientId})` : color,\n }}\n />\n )}\n\n {showValue && !indeterminate && (\n <span\n className=\"absolute inset-0 flex items-center justify-center text-xs font-medium\"\n style={{\n color: clampedValue > 50 ? getContrastColor(color) : secondaryColor === '#e0e0e0' ? '#000000' : getContrastColor(secondaryColor)\n }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressBar.displayName = 'ProgressBar';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","useMemo","useLoaderVisibility","jsxs","cn","normalizeSize","jsx","getContrastColor"],"mappings":";;;;;;;AAkBO,MAAM,cAAcA,MAAAA;AAAAA,EACzB,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,uBAAuBC,MAAAA,iBAAA;AAC7B,UAAM,oBAAoBC,MAAAA,qBAAqB,OAAO,yBAAyB,oBAAoB;AAGnG,UAAM,aAAaC,MAAAA,QAAQ,MAAM,yBAAyB,KAAK,SAAS,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE;AAEvG,UAAM,EAAE,cAAc,SAAS,gBAAA,IAAoBC,MAAAA;AAAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAGF,QAAI,CAAC,aAAc,QAAO;AAE1B,UAAM,eAAe,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC;AACrD,UAAM,gBA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AAA,gBACpD,WAAW,0BAA0B,iBAAiB;AAAA,gBACtD,oBAAoB,UAAU,YAAY;AAAA,gBAC1C,OAAO;AAAA,cAAA;AAAA,YACT;AAAA,UAAA,IAGFA,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,OAAO,GAAG,YAAY;AAAA,gBACtB,YAAY,WAAW,QAAQ,UAAU,MAAM;AAAA,cAAA;AAAA,YACjD;AAAA,UAAA;AAAA,UAIH,aAAa,CAAC,iBACbH,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,OAAO,eAAe,KAAKI,wBAAiB,KAAK,IAAI,mBAAmB,YAAY,YAAYA,OAAAA,iBAAiB,cAAc;AAAA,cAAA;AAAA,cAGhI,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,YAAY,cAAc;;"}
|
package/dist/index21.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
3
|
import { normalizeSize, getContrastColor } from "./index4.js";
|
|
4
|
-
import { useReducedMotion, getEffectiveDuration } from "./index31.js";
|
|
4
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const ProgressBar = forwardRef(
|
|
7
7
|
({
|
|
@@ -16,6 +16,9 @@ const ProgressBar = forwardRef(
|
|
|
16
16
|
speed = "normal",
|
|
17
17
|
reverse = false,
|
|
18
18
|
respectMotionPreference = true,
|
|
19
|
+
delay = 0,
|
|
20
|
+
minDuration = 0,
|
|
21
|
+
transition,
|
|
19
22
|
className,
|
|
20
23
|
style,
|
|
21
24
|
testId = "progress-bar",
|
|
@@ -23,13 +26,19 @@ const ProgressBar = forwardRef(
|
|
|
23
26
|
ariaLabel,
|
|
24
27
|
...rest
|
|
25
28
|
}, ref) => {
|
|
26
|
-
if (!visible) return null;
|
|
27
29
|
const prefersReducedMotion = useReducedMotion();
|
|
28
30
|
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
31
|
+
const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
32
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
33
|
+
visible,
|
|
34
|
+
delay,
|
|
35
|
+
minDuration,
|
|
36
|
+
transition
|
|
37
|
+
);
|
|
38
|
+
if (!shouldRender) return null;
|
|
29
39
|
const clampedValue = Math.min(100, Math.max(0, value));
|
|
30
40
|
const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
|
|
31
41
|
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
32
|
-
const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
33
42
|
return /* @__PURE__ */ jsxs(
|
|
34
43
|
"div",
|
|
35
44
|
{
|
|
@@ -39,7 +48,9 @@ const ProgressBar = forwardRef(
|
|
|
39
48
|
style: {
|
|
40
49
|
height: normalizeSize(height),
|
|
41
50
|
backgroundColor: secondaryColor,
|
|
42
|
-
...style
|
|
51
|
+
...style,
|
|
52
|
+
opacity,
|
|
53
|
+
transition: transitionStyle
|
|
43
54
|
},
|
|
44
55
|
role: "progressbar",
|
|
45
56
|
"aria-label": progressLabel,
|
package/dist/index21.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index21.js","sources":["../src/components/progress/ProgressBar.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressBarProps } from '../../types';\nimport { cn, normalizeSize, getContrastColor, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * ProgressBar - Linear progress bar\n *\n * A horizontal progress bar that can be determinate (showing specific progress) or indeterminate (loading animation).\n *\n * @example\n * ```tsx\n * <ProgressBar value={75} showValue />\n * <ProgressBar indeterminate />\n * <ProgressBar value={50} height={8} color=\"#8b5cf6\" />\n * <ProgressBar value={50} buffer={75} /> // YouTube-style buffering\n * <ProgressBar value={60} gradient /> // Gradient progress\n * ```\n */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n height = '0.5rem',\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'progress-bar',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n
|
|
1
|
+
{"version":3,"file":"index21.js","sources":["../src/components/progress/ProgressBar.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressBarProps } from '../../types';\nimport { cn, normalizeSize, getContrastColor, useReducedMotion, getEffectiveDuration, useLoaderVisibility } from '../../utils';\n\n/**\n * ProgressBar - Linear progress bar\n *\n * A horizontal progress bar that can be determinate (showing specific progress) or indeterminate (loading animation).\n *\n * @example\n * ```tsx\n * <ProgressBar value={75} showValue />\n * <ProgressBar indeterminate />\n * <ProgressBar value={50} height={8} color=\"#8b5cf6\" />\n * <ProgressBar value={50} buffer={75} /> // YouTube-style buffering\n * <ProgressBar value={60} gradient /> // Gradient progress\n * ```\n */\nexport const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n height = '0.5rem',\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'progress-bar',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n // Generate gradient ID for SVG-based gradient (must be before early return)\n const gradientId = useMemo(() => `progress-bar-gradient-${Math.random().toString(36).substr(2, 9)}`, []);\n\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const clampedValue = Math.min(100, Math.max(0, value));\n const clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('relative w-full overflow-hidden rounded-full', className)}\n style={{\n height: normalizeSize(height),\n backgroundColor: secondaryColor,\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"progressbar\"\n aria-label={progressLabel}\n aria-valuenow={indeterminate ? undefined : clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n {...rest}\n >\n {/* Gradient SVG definition */}\n {gradient && !indeterminate && (\n <svg width=\"0\" height=\"0\" style={{ position: 'absolute' }}>\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" stopColor={color} />\n <stop offset=\"100%\" stopColor={secondaryColor || '#8b5cf6'} />\n </linearGradient>\n </defs>\n </svg>\n )}\n\n {/* Buffer indicator (shows behind main progress) */}\n {clampedBuffer !== undefined && !indeterminate && (\n <div\n className=\"absolute h-full rounded-full opacity-30\"\n style={{\n width: `${clampedBuffer}%`,\n backgroundColor: color,\n }}\n />\n )}\n\n {indeterminate ? (\n <div\n className=\"absolute h-full rounded-full\"\n style={{\n backgroundColor: gradient ? `url(#${gradientId})` : color,\n animation: `progress-indeterminate ${effectiveDuration} ease-in-out infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n width: '40%',\n }}\n />\n ) : (\n <div\n className=\"h-full rounded-full transition-all duration-300 ease-in-out\"\n style={{\n width: `${clampedValue}%`,\n background: gradient ? `url(#${gradientId})` : color,\n }}\n />\n )}\n\n {showValue && !indeterminate && (\n <span\n className=\"absolute inset-0 flex items-center justify-center text-xs font-medium\"\n style={{\n color: clampedValue > 50 ? getContrastColor(color) : secondaryColor === '#e0e0e0' ? '#000000' : getContrastColor(secondaryColor)\n }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressBar.displayName = 'ProgressBar';\n"],"names":[],"mappings":";;;;;AAkBO,MAAM,cAAc;AAAA,EACzB,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,uBAAuB,iBAAA;AAC7B,UAAM,oBAAoB,qBAAqB,OAAO,yBAAyB,oBAAoB;AAGnG,UAAM,aAAa,QAAQ,MAAM,yBAAyB,KAAK,SAAS,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE;AAEvG,UAAM,EAAE,cAAc,SAAS,gBAAA,IAAoB;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAGF,QAAI,CAAC,aAAc,QAAO;AAE1B,UAAM,eAAe,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC;AACrD,UAAM,gBAAgB,WAAW,SAAY,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,CAAC,IAAI;AAClF,UAAM,gBAAgB,aAAa,WAAW,YAAY;AAE1D,WACE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,gBACL,OAAO,GAAG,YAAY;AAAA,gBACtB,YAAY,WAAW,QAAQ,UAAU,MAAM;AAAA,cAAA;AAAA,YACjD;AAAA,UAAA;AAAA,UAIH,aAAa,CAAC,iBACb;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO;AAAA,gBACL,OAAO,eAAe,KAAK,iBAAiB,KAAK,IAAI,mBAAmB,YAAY,YAAY,iBAAiB,cAAc;AAAA,cAAA;AAAA,cAGhI,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,YAAY,cAAc;"}
|
package/dist/index22.cjs
CHANGED
|
@@ -18,6 +18,9 @@ const ProgressCircle = react.forwardRef(
|
|
|
18
18
|
speed = "normal",
|
|
19
19
|
reverse = false,
|
|
20
20
|
respectMotionPreference = true,
|
|
21
|
+
delay = 0,
|
|
22
|
+
minDuration = 0,
|
|
23
|
+
transition,
|
|
21
24
|
className,
|
|
22
25
|
style,
|
|
23
26
|
testId = "progress-circle",
|
|
@@ -25,9 +28,15 @@ const ProgressCircle = react.forwardRef(
|
|
|
25
28
|
ariaLabel,
|
|
26
29
|
...rest
|
|
27
30
|
}, ref) => {
|
|
28
|
-
if (!visible) return null;
|
|
29
31
|
const prefersReducedMotion = hooks.useReducedMotion();
|
|
30
32
|
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
33
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
34
|
+
visible,
|
|
35
|
+
delay,
|
|
36
|
+
minDuration,
|
|
37
|
+
transition
|
|
38
|
+
);
|
|
39
|
+
if (!shouldRender) return null;
|
|
31
40
|
const clampedValue = Math.min(100, Math.max(0, value));
|
|
32
41
|
const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
|
|
33
42
|
const sizeValue = colors.parseSizeToNumber(size, 56);
|
|
@@ -46,7 +55,9 @@ const ProgressCircle = react.forwardRef(
|
|
|
46
55
|
style: {
|
|
47
56
|
width: colors.normalizeSize(size),
|
|
48
57
|
height: colors.normalizeSize(size),
|
|
49
|
-
...style
|
|
58
|
+
...style,
|
|
59
|
+
opacity,
|
|
60
|
+
transition: transitionStyle
|
|
50
61
|
},
|
|
51
62
|
role: "progressbar",
|
|
52
63
|
"aria-label": progressLabel,
|
package/dist/index22.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index22.cjs","sources":["../src/components/progress/ProgressCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ProgressCircleProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * ProgressCircle - SVG-based circular progress indicator\n *\n * A circular progress indicator that shows progress as a partial circle.\n *\n * @example\n * ```tsx\n * <ProgressCircle value={75} showValue />\n * <ProgressCircle value={50} size={80} thickness={6} />\n * <ProgressCircle indeterminate speed=\"fast\" />\n * <ProgressCircle value={50} buffer={75} />\n * ```\n */\nexport const ProgressCircle = forwardRef<HTMLDivElement, ProgressCircleProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 'lg',\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'progress-circle',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n
|
|
1
|
+
{"version":3,"file":"index22.cjs","sources":["../src/components/progress/ProgressCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ProgressCircleProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration, useLoaderVisibility } from '../../utils';\n\n/**\n * ProgressCircle - SVG-based circular progress indicator\n *\n * A circular progress indicator that shows progress as a partial circle.\n *\n * @example\n * ```tsx\n * <ProgressCircle value={75} showValue />\n * <ProgressCircle value={50} size={80} thickness={6} />\n * <ProgressCircle indeterminate speed=\"fast\" />\n * <ProgressCircle value={50} buffer={75} />\n * ```\n */\nexport const ProgressCircle = forwardRef<HTMLDivElement, ProgressCircleProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 'lg',\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'progress-circle',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const clampedValue = Math.min(100, Math.max(0, value));\n const clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const sizeValue = parseSizeToNumber(size, 56);\n const thicknessValue = parseSizeToNumber(thickness, 4);\n const radius = (sizeValue - thicknessValue * 2) / 2;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (clampedValue / 100) * circumference;\n const bufferDashoffset = clampedBuffer !== undefined ? circumference - (clampedBuffer / 100) * circumference : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center relative', className)}\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"progressbar\"\n aria-label={progressLabel}\n aria-valuenow={indeterminate ? undefined : clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n {...rest}\n >\n <svg\n className={cn(indeterminate && 'animate-spinner-rotate')}\n width={sizeValue}\n height={sizeValue}\n viewBox={`0 0 ${sizeValue} ${sizeValue}`}\n style={indeterminate ? {\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n } : undefined}\n >\n {/* Background circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={secondaryColor}\n strokeWidth={thicknessValue}\n />\n {/* Buffer circle (behind progress) */}\n {bufferDashoffset !== undefined && !indeterminate && (\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={bufferDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n opacity={0.3}\n />\n )}\n {/* Progress circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={indeterminate ? circumference * 0.75 : strokeDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n style={{\n transition: indeterminate ? 'none' : 'stroke-dashoffset 0.3s ease-in-out',\n }}\n />\n </svg>\n {showValue && !indeterminate && (\n <span\n className=\"absolute text-sm font-medium\"\n style={{ color }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressCircle.displayName = 'ProgressCircle';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","useLoaderVisibility","parseSizeToNumber","jsxs","cn","normalizeSize","jsx"],"mappings":";;;;;;;AAiBO,MAAM,iBAAiBA,MAAAA;AAAAA,EAC5B,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB;AAAA,IACA,QAA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,WAAW,cAAc,YAAY,CAAC,IAAI,YAAY,CAAC;AAAA,oBACvD,OAAO;AAAA,sBACL,YAAY,gBAAgB,SAAS;AAAA,oBAAA;AAAA,kBACvC;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,UAED,aAAa,CAAC,iBACbH,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,MAAA;AAAA,cAER,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,eAAe,cAAc;;"}
|
package/dist/index22.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, getEffectiveDuration } from "./index31.js";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
|
|
4
4
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const ProgressCircle = forwardRef(
|
|
@@ -16,6 +16,9 @@ const ProgressCircle = forwardRef(
|
|
|
16
16
|
speed = "normal",
|
|
17
17
|
reverse = false,
|
|
18
18
|
respectMotionPreference = true,
|
|
19
|
+
delay = 0,
|
|
20
|
+
minDuration = 0,
|
|
21
|
+
transition,
|
|
19
22
|
className,
|
|
20
23
|
style,
|
|
21
24
|
testId = "progress-circle",
|
|
@@ -23,9 +26,15 @@ const ProgressCircle = forwardRef(
|
|
|
23
26
|
ariaLabel,
|
|
24
27
|
...rest
|
|
25
28
|
}, ref) => {
|
|
26
|
-
if (!visible) return null;
|
|
27
29
|
const prefersReducedMotion = useReducedMotion();
|
|
28
30
|
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
31
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
32
|
+
visible,
|
|
33
|
+
delay,
|
|
34
|
+
minDuration,
|
|
35
|
+
transition
|
|
36
|
+
);
|
|
37
|
+
if (!shouldRender) return null;
|
|
29
38
|
const clampedValue = Math.min(100, Math.max(0, value));
|
|
30
39
|
const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
|
|
31
40
|
const sizeValue = parseSizeToNumber(size, 56);
|
|
@@ -44,7 +53,9 @@ const ProgressCircle = forwardRef(
|
|
|
44
53
|
style: {
|
|
45
54
|
width: normalizeSize(size),
|
|
46
55
|
height: normalizeSize(size),
|
|
47
|
-
...style
|
|
56
|
+
...style,
|
|
57
|
+
opacity,
|
|
58
|
+
transition: transitionStyle
|
|
48
59
|
},
|
|
49
60
|
role: "progressbar",
|
|
50
61
|
"aria-label": progressLabel,
|
package/dist/index22.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index22.js","sources":["../src/components/progress/ProgressCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ProgressCircleProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * ProgressCircle - SVG-based circular progress indicator\n *\n * A circular progress indicator that shows progress as a partial circle.\n *\n * @example\n * ```tsx\n * <ProgressCircle value={75} showValue />\n * <ProgressCircle value={50} size={80} thickness={6} />\n * <ProgressCircle indeterminate speed=\"fast\" />\n * <ProgressCircle value={50} buffer={75} />\n * ```\n */\nexport const ProgressCircle = forwardRef<HTMLDivElement, ProgressCircleProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 'lg',\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'progress-circle',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n
|
|
1
|
+
{"version":3,"file":"index22.js","sources":["../src/components/progress/ProgressCircle.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ProgressCircleProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration, useLoaderVisibility } from '../../utils';\n\n/**\n * ProgressCircle - SVG-based circular progress indicator\n *\n * A circular progress indicator that shows progress as a partial circle.\n *\n * @example\n * ```tsx\n * <ProgressCircle value={75} showValue />\n * <ProgressCircle value={50} size={80} thickness={6} />\n * <ProgressCircle indeterminate speed=\"fast\" />\n * <ProgressCircle value={50} buffer={75} />\n * ```\n */\nexport const ProgressCircle = forwardRef<HTMLDivElement, ProgressCircleProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 'lg',\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'progress-circle',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const clampedValue = Math.min(100, Math.max(0, value));\n const clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const sizeValue = parseSizeToNumber(size, 56);\n const thicknessValue = parseSizeToNumber(thickness, 4);\n const radius = (sizeValue - thicknessValue * 2) / 2;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (clampedValue / 100) * circumference;\n const bufferDashoffset = clampedBuffer !== undefined ? circumference - (clampedBuffer / 100) * circumference : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center relative', className)}\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"progressbar\"\n aria-label={progressLabel}\n aria-valuenow={indeterminate ? undefined : clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n {...rest}\n >\n <svg\n className={cn(indeterminate && 'animate-spinner-rotate')}\n width={sizeValue}\n height={sizeValue}\n viewBox={`0 0 ${sizeValue} ${sizeValue}`}\n style={indeterminate ? {\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n } : undefined}\n >\n {/* Background circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={secondaryColor}\n strokeWidth={thicknessValue}\n />\n {/* Buffer circle (behind progress) */}\n {bufferDashoffset !== undefined && !indeterminate && (\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={bufferDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n opacity={0.3}\n />\n )}\n {/* Progress circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={indeterminate ? circumference * 0.75 : strokeDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n style={{\n transition: indeterminate ? 'none' : 'stroke-dashoffset 0.3s ease-in-out',\n }}\n />\n </svg>\n {showValue && !indeterminate && (\n <span\n className=\"absolute text-sm font-medium\"\n style={{ color }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressCircle.displayName = 'ProgressCircle';\n"],"names":[],"mappings":";;;;;AAiBO,MAAM,iBAAiB;AAAA,EAC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BAAgB,gBAAgB,OAAO;AAAA,oBACzD,WAAW,cAAc,YAAY,CAAC,IAAI,YAAY,CAAC;AAAA,oBACvD,OAAO;AAAA,sBACL,YAAY,gBAAgB,SAAS;AAAA,oBAAA;AAAA,kBACvC;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,UAED,aAAa,CAAC,iBACb;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,MAAA;AAAA,cAER,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,eAAe,cAAc;"}
|
package/dist/index23.cjs
CHANGED
|
@@ -19,6 +19,9 @@ const ProgressRing = react.forwardRef(
|
|
|
19
19
|
speed = "normal",
|
|
20
20
|
reverse = false,
|
|
21
21
|
respectMotionPreference = true,
|
|
22
|
+
delay = 0,
|
|
23
|
+
minDuration = 0,
|
|
24
|
+
transition,
|
|
22
25
|
className,
|
|
23
26
|
style,
|
|
24
27
|
testId = "progress-ring",
|
|
@@ -26,9 +29,16 @@ const ProgressRing = react.forwardRef(
|
|
|
26
29
|
ariaLabel,
|
|
27
30
|
...rest
|
|
28
31
|
}, ref) => {
|
|
29
|
-
if (!visible) return null;
|
|
30
32
|
const prefersReducedMotion = hooks.useReducedMotion();
|
|
31
33
|
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
34
|
+
const gradientId = react.useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
35
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
36
|
+
visible,
|
|
37
|
+
delay,
|
|
38
|
+
minDuration,
|
|
39
|
+
transition
|
|
40
|
+
);
|
|
41
|
+
if (!shouldRender) return null;
|
|
32
42
|
const clampedValue = Math.min(100, Math.max(0, value));
|
|
33
43
|
const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
|
|
34
44
|
const sizeValue = colors.parseSizeToNumber(size, 56);
|
|
@@ -38,7 +48,6 @@ const ProgressRing = react.forwardRef(
|
|
|
38
48
|
const strokeDashoffset = circumference - clampedValue / 100 * circumference;
|
|
39
49
|
const bufferDashoffset = clampedBuffer !== void 0 ? circumference - clampedBuffer / 100 * circumference : void 0;
|
|
40
50
|
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
41
|
-
const gradientId = react.useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
42
51
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
43
52
|
"div",
|
|
44
53
|
{
|
|
@@ -48,7 +57,9 @@ const ProgressRing = react.forwardRef(
|
|
|
48
57
|
style: {
|
|
49
58
|
width: colors.normalizeSize(size),
|
|
50
59
|
height: colors.normalizeSize(size),
|
|
51
|
-
...style
|
|
60
|
+
...style,
|
|
61
|
+
opacity,
|
|
62
|
+
transition: transitionStyle
|
|
52
63
|
},
|
|
53
64
|
role: "progressbar",
|
|
54
65
|
"aria-label": progressLabel,
|
package/dist/index23.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index23.cjs","sources":["../src/components/progress/ProgressRing.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressRingProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * ProgressRing - Ring-style progress with gradient option\n *\n * A circular progress ring with optional gradient colors.\n *\n * @example\n * ```tsx\n * <ProgressRing value={75} showValue />\n * <ProgressRing value={60} gradient secondaryColor=\"#8b5cf6\" />\n * <ProgressRing indeterminate speed=\"fast\" />\n * <ProgressRing value={50} buffer={75} />\n * ```\n */\nexport const ProgressRing = forwardRef<HTMLDivElement, ProgressRingProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 'lg',\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'progress-ring',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n
|
|
1
|
+
{"version":3,"file":"index23.cjs","sources":["../src/components/progress/ProgressRing.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressRingProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration, useLoaderVisibility } from '../../utils';\n\n/**\n * ProgressRing - Ring-style progress with gradient option\n *\n * A circular progress ring with optional gradient colors.\n *\n * @example\n * ```tsx\n * <ProgressRing value={75} showValue />\n * <ProgressRing value={60} gradient secondaryColor=\"#8b5cf6\" />\n * <ProgressRing indeterminate speed=\"fast\" />\n * <ProgressRing value={50} buffer={75} />\n * ```\n */\nexport const ProgressRing = forwardRef<HTMLDivElement, ProgressRingProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 'lg',\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'progress-ring',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n // Generate gradient ID for SVG-based gradient (must be before early return)\n const gradientId = useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);\n\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const clampedValue = Math.min(100, Math.max(0, value));\n const clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const sizeValue = parseSizeToNumber(size, 56);\n const thicknessValue = parseSizeToNumber(thickness, 4);\n const radius = (sizeValue - thicknessValue * 2) / 2;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (clampedValue / 100) * circumference;\n const bufferDashoffset = clampedBuffer !== undefined ? circumference - (clampedBuffer / 100) * circumference : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center relative', className)}\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"progressbar\"\n aria-label={progressLabel}\n aria-valuenow={indeterminate ? undefined : clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n {...rest}\n >\n <svg\n className={cn(indeterminate && 'animate-spinner-rotate')}\n width={sizeValue}\n height={sizeValue}\n viewBox={`0 0 ${sizeValue} ${sizeValue}`}\n style={indeterminate ? {\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n } : undefined}\n >\n {gradient && (\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" stopColor={color} />\n <stop offset=\"100%\" stopColor={secondaryColor === '#e0e0e0' ? '#8b5cf6' : secondaryColor} />\n </linearGradient>\n </defs>\n )}\n {/* Background circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? '#e0e0e0' : secondaryColor}\n strokeWidth={thicknessValue}\n />\n {/* Buffer circle (behind progress) */}\n {bufferDashoffset !== undefined && !indeterminate && (\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? `url(#${gradientId})` : color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={bufferDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n opacity={0.3}\n />\n )}\n {/* Progress circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? `url(#${gradientId})` : color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={indeterminate ? circumference * 0.75 : strokeDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n style={{\n transition: indeterminate ? 'none' : 'stroke-dashoffset 0.3s ease-in-out',\n }}\n />\n </svg>\n {showValue && !indeterminate && (\n <span\n className=\"absolute text-sm font-semibold\"\n style={{ color }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressRing.displayName = 'ProgressRing';\n"],"names":["forwardRef","useReducedMotion","getEffectiveDuration","useMemo","useLoaderVisibility","parseSizeToNumber","jsxs","cn","normalizeSize","jsx"],"mappings":";;;;;;;AAiBO,MAAM,eAAeA,MAAAA;AAAAA,EAC1B,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,uBAAuBC,MAAAA,iBAAA;AAC7B,UAAM,oBAAoBC,MAAAA,qBAAqB,OAAO,yBAAyB,oBAAoB;AAGnG,UAAM,aAAaC,MAAAA,QAAQ,MAAM,qBAAqB,KAAK,SAAS,SAAS,EAAE,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE;A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AAa;AAAA,oBACb,eAAc;AAAA,oBACd,iBAAiB;AAAA,oBACjB,kBAAkB,gBAAgB,gBAAgB,OAAO;AAAA,oBACzD,WAAW,cAAc,YAAY,CAAC,IAAI,YAAY,CAAC;AAAA,oBACvD,OAAO;AAAA,sBACL,YAAY,gBAAgB,SAAS;AAAA,oBAAA;AAAA,kBACvC;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,UAED,aAAa,CAAC,iBACbH,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,MAAA;AAAA,cAER,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,aAAa,cAAc;;"}
|
package/dist/index23.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
|
-
import { useReducedMotion, getEffectiveDuration } from "./index31.js";
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index31.js";
|
|
4
4
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const ProgressRing = forwardRef(
|
|
@@ -17,6 +17,9 @@ const ProgressRing = forwardRef(
|
|
|
17
17
|
speed = "normal",
|
|
18
18
|
reverse = false,
|
|
19
19
|
respectMotionPreference = true,
|
|
20
|
+
delay = 0,
|
|
21
|
+
minDuration = 0,
|
|
22
|
+
transition,
|
|
20
23
|
className,
|
|
21
24
|
style,
|
|
22
25
|
testId = "progress-ring",
|
|
@@ -24,9 +27,16 @@ const ProgressRing = forwardRef(
|
|
|
24
27
|
ariaLabel,
|
|
25
28
|
...rest
|
|
26
29
|
}, ref) => {
|
|
27
|
-
if (!visible) return null;
|
|
28
30
|
const prefersReducedMotion = useReducedMotion();
|
|
29
31
|
const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
32
|
+
const gradientId = useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
33
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
34
|
+
visible,
|
|
35
|
+
delay,
|
|
36
|
+
minDuration,
|
|
37
|
+
transition
|
|
38
|
+
);
|
|
39
|
+
if (!shouldRender) return null;
|
|
30
40
|
const clampedValue = Math.min(100, Math.max(0, value));
|
|
31
41
|
const clampedBuffer = buffer !== void 0 ? Math.min(100, Math.max(0, buffer)) : void 0;
|
|
32
42
|
const sizeValue = parseSizeToNumber(size, 56);
|
|
@@ -36,7 +46,6 @@ const ProgressRing = forwardRef(
|
|
|
36
46
|
const strokeDashoffset = circumference - clampedValue / 100 * circumference;
|
|
37
47
|
const bufferDashoffset = clampedBuffer !== void 0 ? circumference - clampedBuffer / 100 * circumference : void 0;
|
|
38
48
|
const progressLabel = ariaLabel || `Loading ${clampedValue}%`;
|
|
39
|
-
const gradientId = useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
40
49
|
return /* @__PURE__ */ jsxs(
|
|
41
50
|
"div",
|
|
42
51
|
{
|
|
@@ -46,7 +55,9 @@ const ProgressRing = forwardRef(
|
|
|
46
55
|
style: {
|
|
47
56
|
width: normalizeSize(size),
|
|
48
57
|
height: normalizeSize(size),
|
|
49
|
-
...style
|
|
58
|
+
...style,
|
|
59
|
+
opacity,
|
|
60
|
+
transition: transitionStyle
|
|
50
61
|
},
|
|
51
62
|
role: "progressbar",
|
|
52
63
|
"aria-label": progressLabel,
|
package/dist/index23.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index23.js","sources":["../src/components/progress/ProgressRing.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressRingProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration } from '../../utils';\n\n/**\n * ProgressRing - Ring-style progress with gradient option\n *\n * A circular progress ring with optional gradient colors.\n *\n * @example\n * ```tsx\n * <ProgressRing value={75} showValue />\n * <ProgressRing value={60} gradient secondaryColor=\"#8b5cf6\" />\n * <ProgressRing indeterminate speed=\"fast\" />\n * <ProgressRing value={50} buffer={75} />\n * ```\n */\nexport const ProgressRing = forwardRef<HTMLDivElement, ProgressRingProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 'lg',\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n className,\n style,\n testId = 'progress-ring',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n
|
|
1
|
+
{"version":3,"file":"index23.js","sources":["../src/components/progress/ProgressRing.tsx"],"sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport { ProgressRingProps } from '../../types';\nimport { cn, normalizeSize, parseSizeToNumber, useReducedMotion, getEffectiveDuration, useLoaderVisibility } from '../../utils';\n\n/**\n * ProgressRing - Ring-style progress with gradient option\n *\n * A circular progress ring with optional gradient colors.\n *\n * @example\n * ```tsx\n * <ProgressRing value={75} showValue />\n * <ProgressRing value={60} gradient secondaryColor=\"#8b5cf6\" />\n * <ProgressRing indeterminate speed=\"fast\" />\n * <ProgressRing value={50} buffer={75} />\n * ```\n */\nexport const ProgressRing = forwardRef<HTMLDivElement, ProgressRingProps>(\n (\n {\n value = 0,\n indeterminate = false,\n showValue = false,\n size = 'lg',\n thickness = 4,\n color = '#3b82f6',\n secondaryColor = '#e0e0e0',\n gradient = false,\n buffer,\n speed = 'normal',\n reverse = false,\n respectMotionPreference = true,\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'progress-ring',\n visible = true,\n ariaLabel,\n ...rest\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const effectiveDuration = getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);\n\n // Generate gradient ID for SVG-based gradient (must be before early return)\n const gradientId = useMemo(() => `progress-gradient-${Math.random().toString(36).substr(2, 9)}`, []);\n\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const clampedValue = Math.min(100, Math.max(0, value));\n const clampedBuffer = buffer !== undefined ? Math.min(100, Math.max(0, buffer)) : undefined;\n const sizeValue = parseSizeToNumber(size, 56);\n const thicknessValue = parseSizeToNumber(thickness, 4);\n const radius = (sizeValue - thicknessValue * 2) / 2;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (clampedValue / 100) * circumference;\n const bufferDashoffset = clampedBuffer !== undefined ? circumference - (clampedBuffer / 100) * circumference : undefined;\n const progressLabel = ariaLabel || `Loading ${clampedValue}%`;\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn('inline-flex items-center justify-center relative', className)}\n style={{\n width: normalizeSize(size),\n height: normalizeSize(size),\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"progressbar\"\n aria-label={progressLabel}\n aria-valuenow={indeterminate ? undefined : clampedValue}\n aria-valuemin={0}\n aria-valuemax={100}\n {...rest}\n >\n <svg\n className={cn(indeterminate && 'animate-spinner-rotate')}\n width={sizeValue}\n height={sizeValue}\n viewBox={`0 0 ${sizeValue} ${sizeValue}`}\n style={indeterminate ? {\n animation: `spinner-rotate ${effectiveDuration} linear infinite`,\n animationDirection: reverse ? 'reverse' : 'normal',\n } : undefined}\n >\n {gradient && (\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"100%\">\n <stop offset=\"0%\" stopColor={color} />\n <stop offset=\"100%\" stopColor={secondaryColor === '#e0e0e0' ? '#8b5cf6' : secondaryColor} />\n </linearGradient>\n </defs>\n )}\n {/* Background circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? '#e0e0e0' : secondaryColor}\n strokeWidth={thicknessValue}\n />\n {/* Buffer circle (behind progress) */}\n {bufferDashoffset !== undefined && !indeterminate && (\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? `url(#${gradientId})` : color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={bufferDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n opacity={0.3}\n />\n )}\n {/* Progress circle */}\n <circle\n cx={sizeValue / 2}\n cy={sizeValue / 2}\n r={radius}\n fill=\"none\"\n stroke={gradient ? `url(#${gradientId})` : color}\n strokeWidth={thicknessValue}\n strokeLinecap=\"round\"\n strokeDasharray={circumference}\n strokeDashoffset={indeterminate ? circumference * 0.75 : strokeDashoffset}\n transform={`rotate(-90 ${sizeValue / 2} ${sizeValue / 2})`}\n style={{\n transition: indeterminate ? 'none' : 'stroke-dashoffset 0.3s ease-in-out',\n }}\n />\n </svg>\n {showValue && !indeterminate && (\n <span\n className=\"absolute text-sm font-semibold\"\n style={{ color }}\n >\n {clampedValue}%\n </span>\n )}\n </div>\n );\n }\n);\n\nProgressRing.displayName = 'ProgressRing';\n"],"names":[],"mappings":";;;;;AAiBO,MAAM,eAAe;AAAA,EAC1B,CACE;AAAA,IACE,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV;AAAA,IACA,GAAG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;AAAA,oBACH,MAAK;AAAA,oBACL,QAAQ,WAAW,QAAQ,UAAU,MAAM;AAAA,oBAC3C,aAAa;AAAA,oBACb,eAAc;AAAA,oBACd,iBAAiB;AAAA,oBACjB,kBAAkB,gBAAgB,gBAAgB,OAAO;AAAA,oBACzD,WAAW,cAAc,YAAY,CAAC,IAAI,YAAY,CAAC;AAAA,oBACvD,OAAO;AAAA,sBACL,YAAY,gBAAgB,SAAS;AAAA,oBAAA;AAAA,kBACvC;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UAAA;AAAA,UAED,aAAa,CAAC,iBACb;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,MAAA;AAAA,cAER,UAAA;AAAA,gBAAA;AAAA,gBAAa;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,aAAa,cAAc;"}
|
package/dist/index24.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
+
const hooks = require("./index31.cjs");
|
|
5
6
|
const classNames = require("./index3.cjs");
|
|
6
7
|
const ProgressSteps = react.forwardRef(
|
|
7
8
|
({
|
|
@@ -15,6 +16,9 @@ const ProgressSteps = react.forwardRef(
|
|
|
15
16
|
completedColor,
|
|
16
17
|
activeColor,
|
|
17
18
|
inactiveColor = "#e0e0e0",
|
|
19
|
+
delay = 0,
|
|
20
|
+
minDuration = 0,
|
|
21
|
+
transition,
|
|
18
22
|
className,
|
|
19
23
|
style,
|
|
20
24
|
testId = "progress-steps",
|
|
@@ -22,7 +26,13 @@ const ProgressSteps = react.forwardRef(
|
|
|
22
26
|
ariaLabel = "Progress steps",
|
|
23
27
|
...rest
|
|
24
28
|
}, ref) => {
|
|
25
|
-
|
|
29
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
30
|
+
visible,
|
|
31
|
+
delay,
|
|
32
|
+
minDuration,
|
|
33
|
+
transition
|
|
34
|
+
);
|
|
35
|
+
if (!shouldRender) return null;
|
|
26
36
|
const completed = completedColor || color;
|
|
27
37
|
const active = activeColor || color;
|
|
28
38
|
const getStepStatus = (index) => {
|
|
@@ -49,7 +59,11 @@ const ProgressSteps = react.forwardRef(
|
|
|
49
59
|
isHorizontal ? "flex-row items-center w-full" : "flex-col items-start",
|
|
50
60
|
className
|
|
51
61
|
),
|
|
52
|
-
style
|
|
62
|
+
style: {
|
|
63
|
+
...style,
|
|
64
|
+
opacity,
|
|
65
|
+
transition: transitionStyle
|
|
66
|
+
},
|
|
53
67
|
role: "progressbar",
|
|
54
68
|
"aria-label": ariaLabel,
|
|
55
69
|
"aria-valuenow": currentStep,
|
package/dist/index24.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index24.cjs","sources":["../src/components/progress/ProgressSteps.tsx"],"sourcesContent":["import { forwardRef, Fragment } from 'react';\nimport { ProgressStepsProps } from '../../types';\nimport { cn } from '../../utils';\n\n/**\n * ProgressSteps - Multi-step progress indicator\n *\n * A step-by-step progress indicator for wizards, forms, and workflows.\n *\n * @example\n * ```tsx\n * <ProgressSteps steps={4} currentStep={1} />\n * <ProgressSteps steps={5} currentStep={2} labels={['Info', 'Review', 'Payment', 'Confirm', 'Done']} />\n * <ProgressSteps steps={3} currentStep={1} orientation=\"vertical\" />\n * <ProgressSteps steps={4} currentStep={2} connector=\"none\" />\n * ```\n */\nexport const ProgressSteps = forwardRef<HTMLDivElement, ProgressStepsProps>(\n (\n {\n steps,\n currentStep,\n labels,\n showNumbers = true,\n orientation = 'horizontal',\n connector = 'line',\n color = '#3b82f6',\n completedColor,\n activeColor,\n inactiveColor = '#e0e0e0',\n className,\n style,\n testId = 'progress-steps',\n visible = true,\n ariaLabel = 'Progress steps',\n ...rest\n },\n ref\n ) => {\n if (!
|
|
1
|
+
{"version":3,"file":"index24.cjs","sources":["../src/components/progress/ProgressSteps.tsx"],"sourcesContent":["import { forwardRef, Fragment } from 'react';\nimport { ProgressStepsProps } from '../../types';\nimport { cn, useLoaderVisibility } from '../../utils';\n\n/**\n * ProgressSteps - Multi-step progress indicator\n *\n * A step-by-step progress indicator for wizards, forms, and workflows.\n *\n * @example\n * ```tsx\n * <ProgressSteps steps={4} currentStep={1} />\n * <ProgressSteps steps={5} currentStep={2} labels={['Info', 'Review', 'Payment', 'Confirm', 'Done']} />\n * <ProgressSteps steps={3} currentStep={1} orientation=\"vertical\" />\n * <ProgressSteps steps={4} currentStep={2} connector=\"none\" />\n * ```\n */\nexport const ProgressSteps = forwardRef<HTMLDivElement, ProgressStepsProps>(\n (\n {\n steps,\n currentStep,\n labels,\n showNumbers = true,\n orientation = 'horizontal',\n connector = 'line',\n color = '#3b82f6',\n completedColor,\n activeColor,\n inactiveColor = '#e0e0e0',\n delay = 0,\n minDuration = 0,\n transition,\n className,\n style,\n testId = 'progress-steps',\n visible = true,\n ariaLabel = 'Progress steps',\n ...rest\n },\n ref\n ) => {\n const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(\n visible,\n delay,\n minDuration,\n transition\n );\n\n if (!shouldRender) return null;\n\n const completed = completedColor || color;\n const active = activeColor || color;\n\n const getStepStatus = (index: number): 'completed' | 'active' | 'inactive' => {\n if (index < currentStep) return 'completed';\n if (index === currentStep) return 'active';\n return 'inactive';\n };\n\n const getStepColor = (status: 'completed' | 'active' | 'inactive'): string => {\n if (status === 'completed') return completed;\n if (status === 'active') return active;\n return inactiveColor;\n };\n\n const getConnectorColor = (index: number): string => {\n return index < currentStep ? completed : inactiveColor;\n };\n\n const isHorizontal = orientation === 'horizontal';\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n className={cn(\n 'flex',\n isHorizontal ? 'flex-row items-center w-full' : 'flex-col items-start',\n className\n )}\n style={{\n ...style,\n opacity,\n transition: transitionStyle,\n }}\n role=\"progressbar\"\n aria-label={ariaLabel}\n aria-valuenow={currentStep}\n aria-valuemin={0}\n aria-valuemax={steps - 1}\n {...rest}\n >\n {Array.from({ length: steps }).map((_, index) => {\n const status = getStepStatus(index);\n const stepColor = getStepColor(status);\n const showConnector = index < steps - 1 && connector === 'line';\n\n return (\n <Fragment key={index}>\n {/* Step */}\n <div\n className={cn(\n 'flex items-center',\n isHorizontal ? 'flex-col' : 'flex-row gap-3'\n )}\n >\n {/* Step Circle */}\n <div\n className=\"rounded-full flex items-center justify-center font-medium text-sm transition-colors\"\n style={{\n width: '2rem',\n height: '2rem',\n backgroundColor: stepColor,\n color: '#ffffff',\n }}\n >\n {showNumbers && <span>{index + 1}</span>}\n </div>\n\n {/* Step Label */}\n {labels?.[index] && (\n <span\n className={cn(\n 'text-xs mt-1 transition-colors',\n isHorizontal ? 'text-center' : 'text-left'\n )}\n style={{\n color: status === 'inactive' ? '#9ca3af' : '#374151',\n maxWidth: isHorizontal ? '80px' : 'none',\n }}\n >\n {labels[index]}\n </span>\n )}\n </div>\n\n {/* Connector */}\n {showConnector && (\n <div\n className=\"transition-colors\"\n style={{\n backgroundColor: getConnectorColor(index),\n ...(isHorizontal\n ? {\n height: '2px',\n flex: 1,\n marginLeft: '4px',\n marginRight: '4px',\n }\n : {\n width: '2px',\n height: '32px',\n marginLeft: '15px',\n marginTop: labels?.[index] ? '4px' : '0',\n marginBottom: '4px',\n }),\n }}\n />\n )}\n </Fragment>\n );\n })}\n </div>\n );\n }\n);\n\nProgressSteps.displayName = 'ProgressSteps';\n"],"names":["forwardRef","useLoaderVisibility","jsx","cn","Fragment","jsxs"],"mappings":";;;;;;AAiBO,MAAM,gBAAgBA,MAAAA;AAAAA,EAC3B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR;AAAA,IACA;AAA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,GA3DW,KA6Df;AAAA,QAEJ,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,cAAc,cAAc;;"}
|
package/dist/index24.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, Fragment } from "react";
|
|
3
|
+
import { useLoaderVisibility } from "./index31.js";
|
|
3
4
|
import { cn } from "./index3.js";
|
|
4
5
|
const ProgressSteps = forwardRef(
|
|
5
6
|
({
|
|
@@ -13,6 +14,9 @@ const ProgressSteps = forwardRef(
|
|
|
13
14
|
completedColor,
|
|
14
15
|
activeColor,
|
|
15
16
|
inactiveColor = "#e0e0e0",
|
|
17
|
+
delay = 0,
|
|
18
|
+
minDuration = 0,
|
|
19
|
+
transition,
|
|
16
20
|
className,
|
|
17
21
|
style,
|
|
18
22
|
testId = "progress-steps",
|
|
@@ -20,7 +24,13 @@ const ProgressSteps = forwardRef(
|
|
|
20
24
|
ariaLabel = "Progress steps",
|
|
21
25
|
...rest
|
|
22
26
|
}, ref) => {
|
|
23
|
-
|
|
27
|
+
const { shouldRender, opacity, transitionStyle } = useLoaderVisibility(
|
|
28
|
+
visible,
|
|
29
|
+
delay,
|
|
30
|
+
minDuration,
|
|
31
|
+
transition
|
|
32
|
+
);
|
|
33
|
+
if (!shouldRender) return null;
|
|
24
34
|
const completed = completedColor || color;
|
|
25
35
|
const active = activeColor || color;
|
|
26
36
|
const getStepStatus = (index) => {
|
|
@@ -47,7 +57,11 @@ const ProgressSteps = forwardRef(
|
|
|
47
57
|
isHorizontal ? "flex-row items-center w-full" : "flex-col items-start",
|
|
48
58
|
className
|
|
49
59
|
),
|
|
50
|
-
style
|
|
60
|
+
style: {
|
|
61
|
+
...style,
|
|
62
|
+
opacity,
|
|
63
|
+
transition: transitionStyle
|
|
64
|
+
},
|
|
51
65
|
role: "progressbar",
|
|
52
66
|
"aria-label": ariaLabel,
|
|
53
67
|
"aria-valuenow": currentStep,
|