premium-react-loaders 3.0.0 → 3.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 (153) hide show
  1. package/README.md +45 -3
  2. package/dist/components/3d/CubeSpinner.d.ts +21 -0
  3. package/dist/components/3d/CubeSpinner.d.ts.map +1 -0
  4. package/dist/components/3d/FlipCard.d.ts +21 -0
  5. package/dist/components/3d/FlipCard.d.ts.map +1 -0
  6. package/dist/components/3d/Helix.d.ts +23 -0
  7. package/dist/components/3d/Helix.d.ts.map +1 -0
  8. package/dist/components/3d/PerspectiveRing.d.ts +21 -0
  9. package/dist/components/3d/PerspectiveRing.d.ts.map +1 -0
  10. package/dist/components/3d/PlaneRotate.d.ts +21 -0
  11. package/dist/components/3d/PlaneRotate.d.ts.map +1 -0
  12. package/dist/components/3d/index.d.ts +6 -0
  13. package/dist/components/3d/index.d.ts.map +1 -0
  14. package/dist/components/accessibility/LiveRegion.d.ts +34 -0
  15. package/dist/components/accessibility/LiveRegion.d.ts.map +1 -0
  16. package/dist/components/accessibility/index.d.ts +2 -0
  17. package/dist/components/accessibility/index.d.ts.map +1 -0
  18. package/dist/components/index.d.ts +3 -0
  19. package/dist/components/index.d.ts.map +1 -1
  20. package/dist/components/skeleton/DataTableSkeleton.d.ts +25 -0
  21. package/dist/components/skeleton/DataTableSkeleton.d.ts.map +1 -0
  22. package/dist/components/skeleton/SmartSkeleton.d.ts +23 -0
  23. package/dist/components/skeleton/SmartSkeleton.d.ts.map +1 -0
  24. package/dist/components/skeleton/index.d.ts +2 -0
  25. package/dist/components/skeleton/index.d.ts.map +1 -1
  26. package/dist/components/smart/FormFieldLoader.d.ts +22 -0
  27. package/dist/components/smart/FormFieldLoader.d.ts.map +1 -0
  28. package/dist/components/smart/index.d.ts +2 -0
  29. package/dist/components/smart/index.d.ts.map +1 -0
  30. package/dist/hooks/index.d.ts +6 -0
  31. package/dist/hooks/index.d.ts.map +1 -1
  32. package/dist/hooks/useLoadingAnalytics.d.ts +101 -0
  33. package/dist/hooks/useLoadingAnalytics.d.ts.map +1 -0
  34. package/dist/hooks/useLoadingOrchestrator.d.ts +104 -0
  35. package/dist/hooks/useLoadingOrchestrator.d.ts.map +1 -0
  36. package/dist/hooks/useSmartLoader.d.ts +98 -0
  37. package/dist/hooks/useSmartLoader.d.ts.map +1 -0
  38. package/dist/index.cjs +49 -31
  39. package/dist/index.js +49 -31
  40. package/dist/index10.cjs +1 -1
  41. package/dist/index10.js +1 -1
  42. package/dist/index11.cjs +1 -1
  43. package/dist/index11.js +1 -1
  44. package/dist/index12.cjs +1 -1
  45. package/dist/index12.js +1 -1
  46. package/dist/index13.cjs +1 -1
  47. package/dist/index13.js +1 -1
  48. package/dist/index14.cjs +1 -1
  49. package/dist/index14.js +1 -1
  50. package/dist/index15.cjs +1 -1
  51. package/dist/index15.js +1 -1
  52. package/dist/index16.cjs +131 -66
  53. package/dist/index16.js +132 -67
  54. package/dist/index17.cjs +245 -30
  55. package/dist/index17.js +246 -31
  56. package/dist/index18.cjs +24 -36
  57. package/dist/index18.js +24 -36
  58. package/dist/index19.cjs +19 -21
  59. package/dist/index19.js +19 -21
  60. package/dist/index20.cjs +25 -20
  61. package/dist/index20.js +25 -20
  62. package/dist/index21.cjs +22 -32
  63. package/dist/index21.js +22 -32
  64. package/dist/index22.cjs +26 -35
  65. package/dist/index22.js +28 -37
  66. package/dist/index23.cjs +40 -76
  67. package/dist/index23.js +42 -78
  68. package/dist/index24.cjs +53 -102
  69. package/dist/index24.js +54 -103
  70. package/dist/index25.cjs +46 -80
  71. package/dist/index25.js +47 -81
  72. package/dist/index26.cjs +105 -103
  73. package/dist/index26.js +107 -105
  74. package/dist/index27.cjs +108 -27
  75. package/dist/index27.js +111 -30
  76. package/dist/index28.cjs +104 -36
  77. package/dist/index28.js +106 -38
  78. package/dist/index29.cjs +22 -30
  79. package/dist/index29.js +23 -31
  80. package/dist/index30.cjs +30 -32
  81. package/dist/index30.js +31 -33
  82. package/dist/index31.cjs +49 -52
  83. package/dist/index31.js +50 -53
  84. package/dist/index32.cjs +37 -108
  85. package/dist/index32.js +38 -109
  86. package/dist/index33.cjs +54 -72
  87. package/dist/index33.js +55 -73
  88. package/dist/index34.cjs +112 -80
  89. package/dist/index34.js +112 -80
  90. package/dist/index35.cjs +78 -145
  91. package/dist/index35.js +80 -147
  92. package/dist/index36.cjs +78 -57
  93. package/dist/index36.js +79 -58
  94. package/dist/index37.cjs +138 -84
  95. package/dist/index37.js +140 -86
  96. package/dist/index38.cjs +33 -106
  97. package/dist/index38.js +34 -107
  98. package/dist/index39.cjs +66 -50
  99. package/dist/index39.js +66 -50
  100. package/dist/index40.cjs +123 -44
  101. package/dist/index40.js +124 -45
  102. package/dist/index41.cjs +43 -85
  103. package/dist/index41.js +44 -86
  104. package/dist/index42.cjs +35 -27
  105. package/dist/index42.js +35 -27
  106. package/dist/index43.cjs +87 -58
  107. package/dist/index43.js +87 -58
  108. package/dist/index44.cjs +35 -88
  109. package/dist/index44.js +36 -89
  110. package/dist/index45.cjs +62 -58
  111. package/dist/index45.js +63 -59
  112. package/dist/index46.cjs +87 -110
  113. package/dist/index46.js +88 -111
  114. package/dist/index47.cjs +101 -120
  115. package/dist/index47.js +102 -121
  116. package/dist/index48.cjs +158 -0
  117. package/dist/index48.js +158 -0
  118. package/dist/index49.cjs +167 -0
  119. package/dist/index49.js +167 -0
  120. package/dist/index50.cjs +110 -0
  121. package/dist/index50.js +110 -0
  122. package/dist/index51.cjs +112 -0
  123. package/dist/index51.js +112 -0
  124. package/dist/index52.cjs +144 -0
  125. package/dist/index52.js +144 -0
  126. package/dist/index53.cjs +112 -0
  127. package/dist/index53.js +112 -0
  128. package/dist/index54.cjs +189 -0
  129. package/dist/index54.js +189 -0
  130. package/dist/index55.cjs +53 -0
  131. package/dist/index55.js +53 -0
  132. package/dist/index56.cjs +125 -0
  133. package/dist/index56.js +125 -0
  134. package/dist/index7.cjs +1 -1
  135. package/dist/index7.js +1 -1
  136. package/dist/index8.cjs +1 -1
  137. package/dist/index8.js +1 -1
  138. package/dist/index9.cjs +1 -1
  139. package/dist/index9.js +1 -1
  140. package/dist/premium-react-loaders.css +140 -0
  141. package/dist/types/3d.d.ts +85 -0
  142. package/dist/types/3d.d.ts.map +1 -0
  143. package/dist/types/accessibility.d.ts +35 -0
  144. package/dist/types/accessibility.d.ts.map +1 -0
  145. package/dist/types/index.d.ts +3 -0
  146. package/dist/types/index.d.ts.map +1 -1
  147. package/dist/types/smart.d.ts +63 -0
  148. package/dist/types/smart.d.ts.map +1 -0
  149. package/dist/utils/accessibility.d.ts +67 -0
  150. package/dist/utils/accessibility.d.ts.map +1 -0
  151. package/dist/utils/index.d.ts +1 -0
  152. package/dist/utils/index.d.ts.map +1 -1
  153. package/package.json +1 -1
@@ -0,0 +1,98 @@
1
+ export type ConnectionSpeed = 'slow' | 'medium' | 'fast';
2
+ export interface SmartLoaderOptions {
3
+ /** Auto-detect slow connections and adjust behavior */
4
+ adaptToConnection?: boolean;
5
+ /** Show estimated progress based on historical data */
6
+ estimateProgress?: boolean;
7
+ /** Automatically retry on failure */
8
+ autoRetry?: boolean;
9
+ /** Maximum retry attempts */
10
+ maxRetries?: number;
11
+ /** Use intelligent delay based on connection speed */
12
+ intelligentDelay?: boolean;
13
+ /** Callback when loading starts */
14
+ onLoadingStart?: () => void;
15
+ /** Callback when loading completes */
16
+ onLoadingComplete?: () => void;
17
+ /** Callback on retry */
18
+ onRetry?: (attempt: number) => void;
19
+ }
20
+ export interface UseSmartLoaderReturn {
21
+ /** Current loading state */
22
+ loading: boolean;
23
+ /** Progress percentage (0-100) */
24
+ progress: number;
25
+ /** Estimated time remaining in seconds */
26
+ estimatedTimeRemaining: number;
27
+ /** Detected connection speed */
28
+ connectionSpeed: ConnectionSpeed;
29
+ /** Whether loader should be shown (accounts for intelligent delay) */
30
+ shouldShowLoader: boolean;
31
+ /** Current retry attempt */
32
+ retryAttempt: number;
33
+ /** Start loading */
34
+ startLoading: () => void;
35
+ /** Stop loading */
36
+ stopLoading: (success?: boolean) => void;
37
+ /** Update progress manually */
38
+ updateProgress: (value: number) => void;
39
+ /** Retry the operation */
40
+ retry: () => void;
41
+ }
42
+ /**
43
+ * useSmartLoader - Intelligent loader with adaptive UX
44
+ *
45
+ * Combines multiple smart loading features: connection detection, progress estimation,
46
+ * intelligent delays, and automatic retry logic for optimal user experience.
47
+ *
48
+ * @param options - Configuration options
49
+ * @returns Smart loading state and controls
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * function SmartDataLoader() {
54
+ * const {
55
+ * loading,
56
+ * progress,
57
+ * estimatedTimeRemaining,
58
+ * connectionSpeed,
59
+ * shouldShowLoader,
60
+ * startLoading,
61
+ * stopLoading,
62
+ * updateProgress,
63
+ * } = useSmartLoader({
64
+ * adaptToConnection: true,
65
+ * estimateProgress: true,
66
+ * autoRetry: true,
67
+ * maxRetries: 3,
68
+ * intelligentDelay: true,
69
+ * });
70
+ *
71
+ * const loadData = async () => {
72
+ * startLoading();
73
+ * try {
74
+ * const data = await fetchData((progress) => {
75
+ * updateProgress(progress);
76
+ * });
77
+ * stopLoading(true);
78
+ * } catch (error) {
79
+ * stopLoading(false);
80
+ * }
81
+ * };
82
+ *
83
+ * return (
84
+ * <>
85
+ * {shouldShowLoader && (
86
+ * <div>
87
+ * <ProgressBar value={progress} />
88
+ * <p>Connection: {connectionSpeed}</p>
89
+ * <p>ETA: {estimatedTimeRemaining}s</p>
90
+ * </div>
91
+ * )}
92
+ * </>
93
+ * );
94
+ * }
95
+ * ```
96
+ */
97
+ export declare function useSmartLoader(options?: SmartLoaderOptions): UseSmartLoaderReturn;
98
+ //# sourceMappingURL=useSmartLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSmartLoader.d.ts","sourceRoot":"","sources":["../../src/hooks/useSmartLoader.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACnC,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,gCAAgC;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,sEAAsE;IACtE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,mBAAmB;IACnB,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,+BAA+B;IAC/B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,cAAc,CAC5B,OAAO,GAAE,kBAAuB,GAC/B,oBAAoB,CA6OtB"}
package/dist/index.cjs CHANGED
@@ -14,37 +14,46 @@ const SkeletonList = require("./index12.cjs");
14
14
  const SkeletonTable = require("./index13.cjs");
15
15
  const SkeletonPage = require("./index14.cjs");
16
16
  const SkeletonForm = require("./index15.cjs");
17
- const SpinnerCircle = require("./index16.cjs");
18
- const SpinnerRing = require("./index17.cjs");
19
- const SpinnerDots = require("./index18.cjs");
20
- const SpinnerBars = require("./index19.cjs");
21
- const SpinnerGrid = require("./index20.cjs");
22
- const SpinnerWave = require("./index21.cjs");
23
- const SpinnerPulse = require("./index22.cjs");
24
- const ProgressBar = require("./index23.cjs");
25
- const ProgressCircle = require("./index24.cjs");
26
- const ProgressRing = require("./index25.cjs");
27
- const ProgressSteps = require("./index26.cjs");
28
- const PulseDots = require("./index27.cjs");
29
- const PulseWave = require("./index28.cjs");
30
- const PulseBars = require("./index29.cjs");
31
- const TypingIndicator = require("./index30.cjs");
32
- const LoaderOverlay = require("./index31.cjs");
33
- const ButtonSpinner = require("./index32.cjs");
34
- const SuccessCheckmark = require("./index33.cjs");
35
- const ErrorIndicator = require("./index34.cjs");
36
- const LoaderTransition = require("./index35.cjs");
37
- const ShimmerBox = require("./index36.cjs");
38
- const ShimmerText = require("./index37.cjs");
39
- const ShimmerButton = require("./index38.cjs");
40
- const OrbitDots = require("./index39.cjs");
41
- const OrbitRings = require("./index40.cjs");
42
- const AtomLoader = require("./index41.cjs");
43
- const BouncingDots = require("./index42.cjs");
44
- const BouncingBalls = require("./index43.cjs");
45
- const InfinityLoader = require("./index44.cjs");
46
- const MobiusLoader = require("./index45.cjs");
47
- const LoadingText = require("./index46.cjs");
17
+ const SmartSkeleton = require("./index16.cjs");
18
+ const DataTableSkeleton = require("./index17.cjs");
19
+ const SpinnerCircle = require("./index18.cjs");
20
+ const SpinnerRing = require("./index19.cjs");
21
+ const SpinnerDots = require("./index20.cjs");
22
+ const SpinnerBars = require("./index21.cjs");
23
+ const SpinnerGrid = require("./index22.cjs");
24
+ const SpinnerWave = require("./index23.cjs");
25
+ const SpinnerPulse = require("./index24.cjs");
26
+ const ProgressBar = require("./index25.cjs");
27
+ const ProgressCircle = require("./index26.cjs");
28
+ const ProgressRing = require("./index27.cjs");
29
+ const ProgressSteps = require("./index28.cjs");
30
+ const PulseDots = require("./index29.cjs");
31
+ const PulseWave = require("./index30.cjs");
32
+ const PulseBars = require("./index31.cjs");
33
+ const TypingIndicator = require("./index32.cjs");
34
+ const LoaderOverlay = require("./index33.cjs");
35
+ const ButtonSpinner = require("./index34.cjs");
36
+ const SuccessCheckmark = require("./index35.cjs");
37
+ const ErrorIndicator = require("./index36.cjs");
38
+ const LoaderTransition = require("./index37.cjs");
39
+ const ShimmerBox = require("./index38.cjs");
40
+ const ShimmerText = require("./index39.cjs");
41
+ const ShimmerButton = require("./index40.cjs");
42
+ const OrbitDots = require("./index41.cjs");
43
+ const OrbitRings = require("./index42.cjs");
44
+ const AtomLoader = require("./index43.cjs");
45
+ const BouncingDots = require("./index44.cjs");
46
+ const BouncingBalls = require("./index45.cjs");
47
+ const InfinityLoader = require("./index46.cjs");
48
+ const MobiusLoader = require("./index47.cjs");
49
+ const LoadingText = require("./index48.cjs");
50
+ const CubeSpinner = require("./index49.cjs");
51
+ const FlipCard = require("./index50.cjs");
52
+ const PlaneRotate = require("./index51.cjs");
53
+ const Helix = require("./index52.cjs");
54
+ const PerspectiveRing = require("./index53.cjs");
55
+ const FormFieldLoader = require("./index54.cjs");
56
+ const LiveRegion = require("./index55.cjs");
48
57
  const version = "2.1.0";
49
58
  exports.cn = classNames.cn;
50
59
  exports.getAnimationDuration = colors.getAnimationDuration;
@@ -61,6 +70,8 @@ exports.SkeletonList = SkeletonList.SkeletonList;
61
70
  exports.SkeletonTable = SkeletonTable.SkeletonTable;
62
71
  exports.SkeletonPage = SkeletonPage.SkeletonPage;
63
72
  exports.SkeletonForm = SkeletonForm.SkeletonForm;
73
+ exports.SmartSkeleton = SmartSkeleton.SmartSkeleton;
74
+ exports.DataTableSkeleton = DataTableSkeleton.DataTableSkeleton;
64
75
  exports.SpinnerCircle = SpinnerCircle.SpinnerCircle;
65
76
  exports.SpinnerRing = SpinnerRing.SpinnerRing;
66
77
  exports.SpinnerDots = SpinnerDots.SpinnerDots;
@@ -92,4 +103,11 @@ exports.BouncingBalls = BouncingBalls.BouncingBalls;
92
103
  exports.InfinityLoader = InfinityLoader.InfinityLoader;
93
104
  exports.MobiusLoader = MobiusLoader.MobiusLoader;
94
105
  exports.LoadingText = LoadingText.LoadingText;
106
+ exports.CubeSpinner = CubeSpinner.CubeSpinner;
107
+ exports.FlipCard = FlipCard.FlipCard;
108
+ exports.PlaneRotate = PlaneRotate.PlaneRotate;
109
+ exports.Helix = Helix.Helix;
110
+ exports.PerspectiveRing = PerspectiveRing.PerspectiveRing;
111
+ exports.FormFieldLoader = FormFieldLoader.FormFieldLoader;
112
+ exports.LiveRegion = LiveRegion.LiveRegion;
95
113
  exports.version = version;
package/dist/index.js CHANGED
@@ -12,51 +12,68 @@ import { SkeletonList } from "./index12.js";
12
12
  import { SkeletonTable } from "./index13.js";
13
13
  import { SkeletonPage } from "./index14.js";
14
14
  import { SkeletonForm } from "./index15.js";
15
- import { SpinnerCircle } from "./index16.js";
16
- import { SpinnerRing } from "./index17.js";
17
- import { SpinnerDots } from "./index18.js";
18
- import { SpinnerBars } from "./index19.js";
19
- import { SpinnerGrid } from "./index20.js";
20
- import { SpinnerWave } from "./index21.js";
21
- import { SpinnerPulse } from "./index22.js";
22
- import { ProgressBar } from "./index23.js";
23
- import { ProgressCircle } from "./index24.js";
24
- import { ProgressRing } from "./index25.js";
25
- import { ProgressSteps } from "./index26.js";
26
- import { PulseDots } from "./index27.js";
27
- import { PulseWave } from "./index28.js";
28
- import { PulseBars } from "./index29.js";
29
- import { TypingIndicator } from "./index30.js";
30
- import { LoaderOverlay } from "./index31.js";
31
- import { ButtonSpinner } from "./index32.js";
32
- import { SuccessCheckmark } from "./index33.js";
33
- import { ErrorIndicator } from "./index34.js";
34
- import { LoaderTransition } from "./index35.js";
35
- import { ShimmerBox } from "./index36.js";
36
- import { ShimmerText } from "./index37.js";
37
- import { ShimmerButton } from "./index38.js";
38
- import { OrbitDots } from "./index39.js";
39
- import { OrbitRings } from "./index40.js";
40
- import { AtomLoader } from "./index41.js";
41
- import { BouncingDots } from "./index42.js";
42
- import { BouncingBalls } from "./index43.js";
43
- import { InfinityLoader } from "./index44.js";
44
- import { MobiusLoader } from "./index45.js";
45
- import { LoadingText } from "./index46.js";
15
+ import { SmartSkeleton } from "./index16.js";
16
+ import { DataTableSkeleton } from "./index17.js";
17
+ import { SpinnerCircle } from "./index18.js";
18
+ import { SpinnerRing } from "./index19.js";
19
+ import { SpinnerDots } from "./index20.js";
20
+ import { SpinnerBars } from "./index21.js";
21
+ import { SpinnerGrid } from "./index22.js";
22
+ import { SpinnerWave } from "./index23.js";
23
+ import { SpinnerPulse } from "./index24.js";
24
+ import { ProgressBar } from "./index25.js";
25
+ import { ProgressCircle } from "./index26.js";
26
+ import { ProgressRing } from "./index27.js";
27
+ import { ProgressSteps } from "./index28.js";
28
+ import { PulseDots } from "./index29.js";
29
+ import { PulseWave } from "./index30.js";
30
+ import { PulseBars } from "./index31.js";
31
+ import { TypingIndicator } from "./index32.js";
32
+ import { LoaderOverlay } from "./index33.js";
33
+ import { ButtonSpinner } from "./index34.js";
34
+ import { SuccessCheckmark } from "./index35.js";
35
+ import { ErrorIndicator } from "./index36.js";
36
+ import { LoaderTransition } from "./index37.js";
37
+ import { ShimmerBox } from "./index38.js";
38
+ import { ShimmerText } from "./index39.js";
39
+ import { ShimmerButton } from "./index40.js";
40
+ import { OrbitDots } from "./index41.js";
41
+ import { OrbitRings } from "./index42.js";
42
+ import { AtomLoader } from "./index43.js";
43
+ import { BouncingDots } from "./index44.js";
44
+ import { BouncingBalls } from "./index45.js";
45
+ import { InfinityLoader } from "./index46.js";
46
+ import { MobiusLoader } from "./index47.js";
47
+ import { LoadingText } from "./index48.js";
48
+ import { CubeSpinner } from "./index49.js";
49
+ import { FlipCard } from "./index50.js";
50
+ import { PlaneRotate } from "./index51.js";
51
+ import { Helix } from "./index52.js";
52
+ import { PerspectiveRing } from "./index53.js";
53
+ import { FormFieldLoader } from "./index54.js";
54
+ import { LiveRegion } from "./index55.js";
46
55
  const version = "2.1.0";
47
56
  export {
48
57
  AtomLoader,
49
58
  BouncingBalls,
50
59
  BouncingDots,
51
60
  ButtonSpinner,
61
+ CubeSpinner,
62
+ DataTableSkeleton,
52
63
  ErrorIndicator,
64
+ FlipCard,
65
+ FormFieldLoader,
66
+ Helix,
53
67
  InfinityLoader,
68
+ LiveRegion,
54
69
  LoaderOverlay,
55
70
  LoaderTransition,
56
71
  LoadingText,
57
72
  MobiusLoader,
58
73
  OrbitDots,
59
74
  OrbitRings,
75
+ PerspectiveRing,
76
+ PlaneRotate,
60
77
  ProgressBar,
61
78
  ProgressCircle,
62
79
  ProgressRing,
@@ -76,6 +93,7 @@ export {
76
93
  SkeletonPage,
77
94
  SkeletonTable,
78
95
  SkeletonText,
96
+ SmartSkeleton,
79
97
  SpinnerBars,
80
98
  SpinnerCircle,
81
99
  SpinnerDots,
package/dist/index10.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 Skeleton = require("./index7.cjs");
6
- const hooks = require("./index47.cjs");
6
+ const hooks = require("./index56.cjs");
7
7
  const SkeletonImage = react.forwardRef(
8
8
  ({
9
9
  width = "100%",
package/dist/index10.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index7.js";
4
- import { useLoaderVisibility } from "./index47.js";
4
+ import { useLoaderVisibility } from "./index56.js";
5
5
  const SkeletonImage = forwardRef(
6
6
  ({
7
7
  width = "100%",
package/dist/index11.cjs CHANGED
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
5
  const Skeleton = require("./index7.cjs");
6
6
  const SkeletonAvatar = require("./index9.cjs");
7
- const hooks = require("./index47.cjs");
7
+ const hooks = require("./index56.cjs");
8
8
  const classNames = require("./index3.cjs");
9
9
  const SkeletonCard = react.forwardRef(
10
10
  ({
package/dist/index11.js CHANGED
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index7.js";
4
4
  import { SkeletonAvatar } from "./index9.js";
5
- import { useLoaderVisibility } from "./index47.js";
5
+ import { useLoaderVisibility } from "./index56.js";
6
6
  import { cn } from "./index3.js";
7
7
  const SkeletonCard = forwardRef(
8
8
  ({
package/dist/index12.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 Skeleton = require("./index7.cjs");
6
- const hooks = require("./index47.cjs");
6
+ const hooks = require("./index56.cjs");
7
7
  const colors = require("./index4.cjs");
8
8
  const classNames = require("./index3.cjs");
9
9
  const SkeletonList = react.forwardRef(
package/dist/index12.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index7.js";
4
- import { useLoaderVisibility } from "./index47.js";
4
+ import { useLoaderVisibility } from "./index56.js";
5
5
  import { normalizeSize } from "./index4.js";
6
6
  import { cn } from "./index3.js";
7
7
  const SkeletonList = forwardRef(
package/dist/index13.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 Skeleton = require("./index7.cjs");
6
- const hooks = require("./index47.cjs");
6
+ const hooks = require("./index56.cjs");
7
7
  const classNames = require("./index3.cjs");
8
8
  const SkeletonTable = react.forwardRef(
9
9
  ({
package/dist/index13.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index7.js";
4
- import { useLoaderVisibility } from "./index47.js";
4
+ import { useLoaderVisibility } from "./index56.js";
5
5
  import { cn } from "./index3.js";
6
6
  const SkeletonTable = forwardRef(
7
7
  ({
package/dist/index14.cjs CHANGED
@@ -5,7 +5,7 @@ const react = require("react");
5
5
  const Skeleton = require("./index7.cjs");
6
6
  const SkeletonText = require("./index8.cjs");
7
7
  const SkeletonAvatar = require("./index9.cjs");
8
- const hooks = require("./index47.cjs");
8
+ const hooks = require("./index56.cjs");
9
9
  const classNames = require("./index3.cjs");
10
10
  const SkeletonPage = react.forwardRef(
11
11
  ({
package/dist/index14.js CHANGED
@@ -3,7 +3,7 @@ import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index7.js";
4
4
  import { SkeletonText } from "./index8.js";
5
5
  import { SkeletonAvatar } from "./index9.js";
6
- import { useLoaderVisibility } from "./index47.js";
6
+ import { useLoaderVisibility } from "./index56.js";
7
7
  import { cn } from "./index3.js";
8
8
  const SkeletonPage = forwardRef(
9
9
  ({
package/dist/index15.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 Skeleton = require("./index7.cjs");
6
- const hooks = require("./index47.cjs");
6
+ const hooks = require("./index56.cjs");
7
7
  const colors = require("./index4.cjs");
8
8
  const classNames = require("./index3.cjs");
9
9
  const SkeletonForm = react.forwardRef(
package/dist/index15.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Skeleton } from "./index7.js";
4
- import { useLoaderVisibility } from "./index47.js";
4
+ import { useLoaderVisibility } from "./index56.js";
5
5
  import { normalizeSize } from "./index4.js";
6
6
  import { cn } from "./index3.js";
7
7
  const SkeletonForm = forwardRef(
package/dist/index16.cjs CHANGED
@@ -2,80 +2,145 @@
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("./index47.cjs");
6
- const classNames = require("./index3.cjs");
7
- const colors = require("./index4.cjs");
8
- const SpinnerCircle = react.forwardRef(
5
+ const SkeletonCard = require("./index11.cjs");
6
+ const SkeletonTable = require("./index13.cjs");
7
+ const SkeletonList = require("./index12.cjs");
8
+ const SkeletonText = require("./index8.cjs");
9
+ const SkeletonImage = require("./index10.cjs");
10
+ const SkeletonForm = require("./index15.cjs");
11
+ const SmartSkeleton = react.forwardRef(
9
12
  ({
10
- size = "md",
11
- color = "#3b82f6",
12
- thickness = 4,
13
- speed = "normal",
14
- reverse = false,
15
- respectMotionPreference = true,
16
- delay = 0,
17
- minDuration = 0,
18
- transition,
13
+ contentType = "text",
14
+ referenceElement,
15
+ itemCount = 3,
16
+ detectionStrategy = "mixed",
17
+ width,
18
+ height,
19
+ animate = true,
20
+ baseColor,
21
+ highlightColor,
19
22
  className,
20
23
  style,
21
- testId = "spinner-circle",
24
+ testId = "smart-skeleton",
22
25
  visible = true,
23
- ariaLabel = "Loading...",
24
26
  ...rest
25
27
  }, ref) => {
26
- const prefersReducedMotion = hooks.useReducedMotion();
27
- const effectiveDuration = hooks.getEffectiveDuration(speed, respectMotionPreference, prefersReducedMotion);
28
- const { shouldRender, opacity, transitionStyle } = hooks.useLoaderVisibility(
28
+ const [detectedType, setDetectedType] = react.useState(contentType);
29
+ react.useEffect(() => {
30
+ if (contentType !== "auto" || !referenceElement) return;
31
+ const detectContentType = () => {
32
+ if (detectionStrategy === "dom" || detectionStrategy === "mixed") {
33
+ const tagName = referenceElement.tagName.toLowerCase();
34
+ if (tagName === "table" || referenceElement.querySelector("table")) {
35
+ return "table";
36
+ }
37
+ if (tagName === "form" || referenceElement.querySelector("form")) {
38
+ return "form";
39
+ }
40
+ if (tagName === "ul" || tagName === "ol" || referenceElement.querySelector("ul, ol")) {
41
+ return "list";
42
+ }
43
+ if (tagName === "img" || referenceElement.querySelector("img")) {
44
+ return "image";
45
+ }
46
+ const hasImage = !!referenceElement.querySelector("img");
47
+ const hasText = referenceElement.textContent && referenceElement.textContent.length > 50;
48
+ if (hasImage && hasText) {
49
+ return "card";
50
+ }
51
+ }
52
+ if (detectionStrategy === "dimensions" || detectionStrategy === "mixed") {
53
+ const { width: width2, height: height2 } = referenceElement.getBoundingClientRect();
54
+ const aspectRatio = width2 / height2;
55
+ if (aspectRatio > 2 && height2 < 100) {
56
+ return "text";
57
+ }
58
+ if (aspectRatio >= 0.7 && aspectRatio <= 1.5 && width2 > 200) {
59
+ return "card";
60
+ }
61
+ if (aspectRatio > 3) {
62
+ return "table";
63
+ }
64
+ if (aspectRatio < 0.5) {
65
+ return "list";
66
+ }
67
+ }
68
+ return "text";
69
+ };
70
+ const type = detectContentType();
71
+ setDetectedType(type);
72
+ }, [contentType, referenceElement, detectionStrategy]);
73
+ const activeType = contentType === "auto" ? detectedType : contentType;
74
+ const commonProps = {
75
+ ref,
76
+ className,
77
+ style,
78
+ testId,
29
79
  visible,
30
- delay,
31
- minDuration,
32
- transition
33
- );
34
- if (!shouldRender) return null;
35
- return /* @__PURE__ */ jsxRuntime.jsx(
36
- "div",
37
- {
38
- ref,
39
- "data-testid": testId,
40
- className: classNames.cn("inline-flex items-center justify-center", className),
41
- style: {
42
- ...style,
43
- opacity,
44
- transition: transitionStyle
45
- },
46
- role: "status",
47
- "aria-label": ariaLabel,
48
- "aria-busy": "true",
49
- ...rest,
50
- children: /* @__PURE__ */ jsxRuntime.jsx(
51
- "svg",
80
+ animate,
81
+ baseColor,
82
+ highlightColor,
83
+ ...rest
84
+ };
85
+ switch (activeType) {
86
+ case "card":
87
+ return /* @__PURE__ */ jsxRuntime.jsx(
88
+ SkeletonCard.SkeletonCard,
89
+ {
90
+ ...commonProps,
91
+ width,
92
+ hasAvatar: true,
93
+ lines: 3
94
+ }
95
+ );
96
+ case "table":
97
+ return /* @__PURE__ */ jsxRuntime.jsx(
98
+ SkeletonTable.SkeletonTable,
99
+ {
100
+ ...commonProps,
101
+ rows: itemCount,
102
+ columns: 4,
103
+ showHeader: true
104
+ }
105
+ );
106
+ case "list":
107
+ return /* @__PURE__ */ jsxRuntime.jsx(
108
+ SkeletonList.SkeletonList,
109
+ {
110
+ ...commonProps,
111
+ items: itemCount,
112
+ itemHeight: 60
113
+ }
114
+ );
115
+ case "form":
116
+ return /* @__PURE__ */ jsxRuntime.jsx(
117
+ SkeletonForm.SkeletonForm,
118
+ {
119
+ ...commonProps,
120
+ fields: itemCount || 4,
121
+ showLabels: true
122
+ }
123
+ );
124
+ case "image":
125
+ return /* @__PURE__ */ jsxRuntime.jsx(
126
+ SkeletonImage.SkeletonImage,
127
+ {
128
+ ...commonProps,
129
+ width: width || "100%",
130
+ height: height || 200
131
+ }
132
+ );
133
+ case "text":
134
+ default:
135
+ return /* @__PURE__ */ jsxRuntime.jsx(
136
+ SkeletonText.SkeletonText,
52
137
  {
53
- className: "animate-spinner-rotate",
54
- style: {
55
- width: colors.normalizeSize(size),
56
- height: colors.normalizeSize(size),
57
- animationDuration: effectiveDuration,
58
- animationDirection: reverse ? "reverse" : "normal"
59
- },
60
- viewBox: "0 0 50 50",
61
- children: /* @__PURE__ */ jsxRuntime.jsx(
62
- "circle",
63
- {
64
- cx: "25",
65
- cy: "25",
66
- r: 25 - thickness * 2,
67
- fill: "none",
68
- stroke: color,
69
- strokeWidth: thickness,
70
- strokeDasharray: "80, 200",
71
- strokeLinecap: "round"
72
- }
73
- )
138
+ ...commonProps,
139
+ lines: itemCount
74
140
  }
75
- )
76
- }
77
- );
141
+ );
142
+ }
78
143
  }
79
144
  );
80
- SpinnerCircle.displayName = "SpinnerCircle";
81
- exports.SpinnerCircle = SpinnerCircle;
145
+ SmartSkeleton.displayName = "SmartSkeleton";
146
+ exports.SmartSkeleton = SmartSkeleton;