premium-react-loaders 2.1.0 → 2.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/README.md +142 -3
- package/dist/components/button/ButtonSpinner.d.ts +25 -0
- package/dist/components/button/ButtonSpinner.d.ts.map +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/status/ErrorIndicator.d.ts +32 -0
- package/dist/components/status/ErrorIndicator.d.ts.map +1 -0
- package/dist/components/status/SuccessCheckmark.d.ts +31 -0
- package/dist/components/status/SuccessCheckmark.d.ts.map +1 -0
- package/dist/components/status/index.d.ts +3 -0
- package/dist/components/status/index.d.ts.map +1 -0
- package/dist/components/transition/LoaderTransition.d.ts +32 -0
- package/dist/components/transition/LoaderTransition.d.ts.map +1 -0
- package/dist/components/transition/index.d.ts +2 -0
- package/dist/components/transition/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useEnhancedLoader.d.ts +62 -0
- package/dist/hooks/useEnhancedLoader.d.ts.map +1 -0
- package/dist/index.cjs +8 -0
- package/dist/index.js +8 -0
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +1 -1
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +1 -1
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +1 -1
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +1 -1
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +1 -1
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +1 -1
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +1 -1
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +1 -1
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +1 -1
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +1 -1
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +1 -1
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +1 -1
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +1 -1
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +1 -1
- package/dist/index32.cjs +143 -119
- package/dist/index32.js +144 -120
- package/dist/index33.cjs +100 -0
- package/dist/index33.js +100 -0
- package/dist/index34.cjs +117 -0
- package/dist/index34.js +117 -0
- package/dist/index35.cjs +167 -0
- package/dist/index35.js +167 -0
- package/dist/index36.cjs +125 -0
- package/dist/index36.js +125 -0
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +1 -1
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +1 -1
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +1 -1
- package/dist/premium-react-loaders.css +215 -0
- package/dist/types/button.d.ts +31 -0
- package/dist/types/button.d.ts.map +1 -0
- package/dist/types/hooks.d.ts +95 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/status.d.ts +34 -0
- package/dist/types/status.d.ts.map +1 -0
- package/dist/types/transition.d.ts +34 -0
- package/dist/types/transition.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index18.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
4
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
4
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const SpinnerDots = forwardRef(
|
|
7
7
|
({
|
package/dist/index19.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const SpinnerBars = react.forwardRef(
|
package/dist/index19.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const SpinnerBars = forwardRef(
|
package/dist/index20.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
8
|
const SpinnerGrid = react.forwardRef(
|
package/dist/index20.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
6
6
|
const SpinnerGrid = forwardRef(
|
package/dist/index21.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
8
|
const SpinnerWave = react.forwardRef(
|
package/dist/index21.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize } from "./index4.js";
|
|
6
6
|
const SpinnerWave = forwardRef(
|
package/dist/index22.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const colors = require("./index4.cjs");
|
|
8
8
|
const SpinnerPulse = react.forwardRef(
|
package/dist/index22.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
import { normalizeSize } from "./index4.js";
|
|
6
6
|
const SpinnerPulse = forwardRef(
|
package/dist/index23.cjs
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
5
|
const colors = require("./index4.cjs");
|
|
6
|
-
const hooks = require("./
|
|
6
|
+
const hooks = require("./index36.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const ProgressBar = react.forwardRef(
|
|
9
9
|
({
|
package/dist/index23.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, useLoaderVisibility, getEffectiveDuration } from "./
|
|
4
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const ProgressBar = forwardRef(
|
|
7
7
|
({
|
package/dist/index24.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const ProgressCircle = react.forwardRef(
|
package/dist/index24.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const ProgressCircle = forwardRef(
|
package/dist/index25.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const ProgressRing = react.forwardRef(
|
package/dist/index25.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, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const ProgressRing = forwardRef(
|
package/dist/index26.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const ProgressSteps = react.forwardRef(
|
|
8
8
|
({
|
package/dist/index26.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, Fragment } from "react";
|
|
3
|
-
import { useLoaderVisibility } from "./
|
|
3
|
+
import { useLoaderVisibility } from "./index36.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
const ProgressSteps = forwardRef(
|
|
6
6
|
({
|
package/dist/index27.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const PulseDots = react.forwardRef(
|
package/dist/index27.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { normalizeSize } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const PulseDots = forwardRef(
|
package/dist/index28.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const PulseWave = react.forwardRef(
|
package/dist/index28.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const PulseWave = forwardRef(
|
package/dist/index29.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const PulseBars = react.forwardRef(
|
package/dist/index29.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { normalizeSize, parseSizeToNumber } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const PulseBars = forwardRef(
|
package/dist/index30.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const colors = require("./index4.cjs");
|
|
7
7
|
const classNames = require("./index3.cjs");
|
|
8
8
|
const TypingIndicator = react.forwardRef(
|
package/dist/index30.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./
|
|
3
|
+
import { useReducedMotion, useLoaderVisibility, getEffectiveDuration } from "./index36.js";
|
|
4
4
|
import { normalizeSize } from "./index4.js";
|
|
5
5
|
import { cn } from "./index3.js";
|
|
6
6
|
const TypingIndicator = forwardRef(
|
package/dist/index31.cjs
CHANGED
|
@@ -2,7 +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("./
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
6
|
const classNames = require("./index3.cjs");
|
|
7
7
|
const LoaderOverlay = react.forwardRef(
|
|
8
8
|
({
|
package/dist/index31.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useLoaderVisibility } from "./
|
|
3
|
+
import { useLoaderVisibility } from "./index36.js";
|
|
4
4
|
import { cn } from "./index3.js";
|
|
5
5
|
const LoaderOverlay = forwardRef(
|
|
6
6
|
({
|
package/dist/index32.cjs
CHANGED
|
@@ -1,125 +1,149 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
4
|
const react = require("react");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const hooks = require("./index36.cjs");
|
|
6
|
+
const classNames = require("./index3.cjs");
|
|
7
|
+
const colors = require("./index4.cjs");
|
|
8
|
+
const ButtonSpinner = react.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
size = 16,
|
|
11
|
+
color = "currentColor",
|
|
12
|
+
variant = "circle",
|
|
13
|
+
position = "left",
|
|
14
|
+
thickness = 2,
|
|
15
|
+
dotCount = 3,
|
|
16
|
+
barCount = 3,
|
|
17
|
+
speed = "normal",
|
|
18
|
+
gap = 8,
|
|
19
|
+
showContent = true,
|
|
20
|
+
children,
|
|
21
|
+
delay = 0,
|
|
22
|
+
minDuration = 0,
|
|
23
|
+
transition,
|
|
24
|
+
respectMotionPreference = true,
|
|
25
|
+
className,
|
|
26
|
+
style,
|
|
27
|
+
testId = "button-spinner",
|
|
28
|
+
visible = true,
|
|
29
|
+
ariaLabel = "Loading...",
|
|
30
|
+
...rest
|
|
31
|
+
}, ref) => {
|
|
32
|
+
const prefersReducedMotion = hooks.useReducedMotion();
|
|
33
|
+
const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
|
|
34
|
+
const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
|
|
35
|
+
visible,
|
|
36
|
+
delay,
|
|
37
|
+
minDuration,
|
|
38
|
+
transition
|
|
39
|
+
);
|
|
40
|
+
if (!shouldRender) {
|
|
41
|
+
return children ? /* @__PURE__ */ jsxRuntime.jsx("div", { className, style, children }) : null;
|
|
9
42
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
setShouldRender(false);
|
|
88
|
-
showTimeRef.current = null;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
if (showTimeRef.current !== null && minDuration > 0) {
|
|
92
|
-
const elapsedTime = Date.now() - showTimeRef.current;
|
|
93
|
-
const remainingTime = minDuration - elapsedTime;
|
|
94
|
-
if (remainingTime > 0) {
|
|
95
|
-
minDurationTimerRef.current = setTimeout(hideLoader, remainingTime);
|
|
96
|
-
} else {
|
|
97
|
-
hideLoader();
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
hideLoader();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return () => {
|
|
104
|
-
if (delayTimerRef.current) {
|
|
105
|
-
clearTimeout(delayTimerRef.current);
|
|
106
|
-
}
|
|
107
|
-
if (minDurationTimerRef.current) {
|
|
108
|
-
clearTimeout(minDurationTimerRef.current);
|
|
109
|
-
}
|
|
110
|
-
if (transitionTimerRef.current) {
|
|
111
|
-
clearTimeout(transitionTimerRef.current);
|
|
43
|
+
const spinnerSize = colors.normalizeSize(size);
|
|
44
|
+
const gapSize = typeof gap === "number" ? `${gap}px` : gap;
|
|
45
|
+
const renderSpinner = () => {
|
|
46
|
+
switch (variant) {
|
|
47
|
+
case "dots":
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: "inline-flex items-center justify-center",
|
|
52
|
+
style: { gap: `${parseInt(spinnerSize) / 8}px` },
|
|
53
|
+
children: Array.from({ length: dotCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: "animate-button-dot-pulse",
|
|
57
|
+
style: {
|
|
58
|
+
width: `${parseInt(spinnerSize) / 3}px`,
|
|
59
|
+
height: `${parseInt(spinnerSize) / 3}px`,
|
|
60
|
+
backgroundColor: color,
|
|
61
|
+
borderRadius: "50%",
|
|
62
|
+
animationDuration: effectiveDuration,
|
|
63
|
+
animationDelay: `${i * parseInt(effectiveDuration) / (dotCount * 3)}ms`
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
i
|
|
67
|
+
))
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
case "bars":
|
|
71
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
className: "inline-flex items-center justify-center",
|
|
75
|
+
style: { gap: `${parseInt(spinnerSize) / 8}px`, height: spinnerSize },
|
|
76
|
+
children: Array.from({ length: barCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: "animate-button-bar-pulse",
|
|
80
|
+
style: {
|
|
81
|
+
width: `${parseInt(spinnerSize) / 6}px`,
|
|
82
|
+
height: "100%",
|
|
83
|
+
backgroundColor: color,
|
|
84
|
+
borderRadius: "2px",
|
|
85
|
+
animationDuration: effectiveDuration,
|
|
86
|
+
animationDelay: `${i * parseInt(effectiveDuration) / (barCount * 3)}ms`
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
i
|
|
90
|
+
))
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
case "circle":
|
|
94
|
+
default:
|
|
95
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
"svg",
|
|
97
|
+
{
|
|
98
|
+
className: "animate-spinner-rotate",
|
|
99
|
+
style: {
|
|
100
|
+
width: spinnerSize,
|
|
101
|
+
height: spinnerSize,
|
|
102
|
+
animationDuration: effectiveDuration
|
|
103
|
+
},
|
|
104
|
+
viewBox: "0 0 50 50",
|
|
105
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
"circle",
|
|
107
|
+
{
|
|
108
|
+
cx: "25",
|
|
109
|
+
cy: "25",
|
|
110
|
+
r: 25 - thickness * 4,
|
|
111
|
+
fill: "none",
|
|
112
|
+
stroke: color,
|
|
113
|
+
strokeWidth: thickness * 2,
|
|
114
|
+
strokeDasharray: "80, 200",
|
|
115
|
+
strokeLinecap: "round"
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
);
|
|
112
120
|
}
|
|
113
121
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
const flexDirection = position === "right" ? "row-reverse" : "row";
|
|
123
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
ref,
|
|
127
|
+
"data-testid": testId,
|
|
128
|
+
className: classNames.cn("inline-flex items-center justify-center", className),
|
|
129
|
+
style: {
|
|
130
|
+
...style,
|
|
131
|
+
flexDirection: position === "center" ? "column" : flexDirection,
|
|
132
|
+
gap: showContent && children ? gapSize : 0,
|
|
133
|
+
opacity,
|
|
134
|
+
transition: transitionStyle
|
|
135
|
+
},
|
|
136
|
+
role: "status",
|
|
137
|
+
"aria-label": ariaLabel,
|
|
138
|
+
"aria-busy": "true",
|
|
139
|
+
...rest,
|
|
140
|
+
children: [
|
|
141
|
+
renderSpinner(),
|
|
142
|
+
showContent && children && /* @__PURE__ */ jsxRuntime.jsx("span", { children })
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
ButtonSpinner.displayName = "ButtonSpinner";
|
|
149
|
+
exports.ButtonSpinner = ButtonSpinner;
|