premium-react-loaders 2.0.0 → 2.2.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 (96) hide show
  1. package/README.md +262 -6
  2. package/dist/components/button/ButtonSpinner.d.ts +25 -0
  3. package/dist/components/button/ButtonSpinner.d.ts.map +1 -0
  4. package/dist/components/button/index.d.ts +2 -0
  5. package/dist/components/button/index.d.ts.map +1 -0
  6. package/dist/components/index.d.ts +2 -0
  7. package/dist/components/index.d.ts.map +1 -1
  8. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -1
  9. package/dist/components/status/ErrorIndicator.d.ts +32 -0
  10. package/dist/components/status/ErrorIndicator.d.ts.map +1 -0
  11. package/dist/components/status/SuccessCheckmark.d.ts +31 -0
  12. package/dist/components/status/SuccessCheckmark.d.ts.map +1 -0
  13. package/dist/components/status/index.d.ts +3 -0
  14. package/dist/components/status/index.d.ts.map +1 -0
  15. package/dist/context/ThemeContext.d.ts +84 -0
  16. package/dist/context/ThemeContext.d.ts.map +1 -0
  17. package/dist/context/index.d.ts +3 -0
  18. package/dist/context/index.d.ts.map +1 -0
  19. package/dist/hooks/index.d.ts +3 -0
  20. package/dist/hooks/index.d.ts.map +1 -0
  21. package/dist/hooks/useLoader.d.ts +56 -0
  22. package/dist/hooks/useLoader.d.ts.map +1 -0
  23. package/dist/index.cjs +37 -26
  24. package/dist/index.d.ts +5 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +37 -26
  27. package/dist/index10.cjs +20 -31
  28. package/dist/index10.js +20 -31
  29. package/dist/index11.cjs +47 -25
  30. package/dist/index11.js +47 -25
  31. package/dist/index12.cjs +30 -126
  32. package/dist/index12.js +31 -127
  33. package/dist/index13.cjs +30 -53
  34. package/dist/index13.js +30 -53
  35. package/dist/index14.cjs +127 -43
  36. package/dist/index14.js +128 -44
  37. package/dist/index15.cjs +58 -37
  38. package/dist/index15.js +59 -38
  39. package/dist/index16.cjs +24 -36
  40. package/dist/index16.js +24 -36
  41. package/dist/index17.cjs +19 -21
  42. package/dist/index17.js +19 -21
  43. package/dist/index18.cjs +25 -20
  44. package/dist/index18.js +25 -20
  45. package/dist/index19.cjs +22 -32
  46. package/dist/index19.js +22 -32
  47. package/dist/index20.cjs +26 -35
  48. package/dist/index20.js +28 -37
  49. package/dist/index21.cjs +40 -76
  50. package/dist/index21.js +42 -78
  51. package/dist/index22.cjs +53 -102
  52. package/dist/index22.js +54 -103
  53. package/dist/index23.cjs +46 -80
  54. package/dist/index23.js +47 -81
  55. package/dist/index24.cjs +105 -103
  56. package/dist/index24.js +107 -105
  57. package/dist/index25.cjs +108 -27
  58. package/dist/index25.js +111 -30
  59. package/dist/index26.cjs +104 -36
  60. package/dist/index26.js +106 -38
  61. package/dist/index27.cjs +22 -30
  62. package/dist/index27.js +23 -31
  63. package/dist/index28.cjs +30 -29
  64. package/dist/index28.js +31 -30
  65. package/dist/index29.cjs +49 -52
  66. package/dist/index29.js +50 -53
  67. package/dist/index30.cjs +74 -121
  68. package/dist/index30.js +75 -122
  69. package/dist/index31.cjs +82 -0
  70. package/dist/index31.js +82 -0
  71. package/dist/index32.cjs +149 -0
  72. package/dist/index32.js +149 -0
  73. package/dist/index33.cjs +100 -0
  74. package/dist/index33.js +100 -0
  75. package/dist/index34.cjs +117 -0
  76. package/dist/index34.js +117 -0
  77. package/dist/index35.cjs +125 -0
  78. package/dist/index35.js +125 -0
  79. package/dist/index5.cjs +11 -72
  80. package/dist/index5.js +12 -73
  81. package/dist/index6.cjs +86 -65
  82. package/dist/index6.js +87 -66
  83. package/dist/index7.cjs +40 -20
  84. package/dist/index7.js +40 -20
  85. package/dist/index8.cjs +34 -21
  86. package/dist/index8.js +34 -21
  87. package/dist/index9.cjs +21 -55
  88. package/dist/index9.js +22 -56
  89. package/dist/premium-react-loaders.css +178 -6
  90. package/dist/types/button.d.ts +31 -0
  91. package/dist/types/button.d.ts.map +1 -0
  92. package/dist/types/index.d.ts +2 -0
  93. package/dist/types/index.d.ts.map +1 -1
  94. package/dist/types/status.d.ts +34 -0
  95. package/dist/types/status.d.ts.map +1 -0
  96. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Premium React Loaders
2
2
 
3
- A comprehensive collection of **25 premium, production-ready loading components** for React applications. Built with TypeScript and custom CSS for maximum flexibility and zero configuration.
3
+ A comprehensive collection of **28 premium, production-ready loading components** for React applications. Built with TypeScript and custom CSS for maximum flexibility and zero configuration.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/premium-react-loaders.svg)](https://www.npmjs.com/package/premium-react-loaders)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
@@ -11,11 +11,14 @@ A comprehensive collection of **25 premium, production-ready loading components*
11
11
 
12
12
  📚 **[Storybook Documentation](https://docs.premium-react-loaders.ishansasika.dev/)** - Detailed component documentation and examples
13
13
 
14
- See all 25 components in action with interactive examples and customization options.
14
+ See all 28 components in action with interactive examples and customization options.
15
15
 
16
16
  ## Features
17
17
 
18
- - **25 Premium Components** across 5 categories (Skeleton, Spinner, Progress, Pulse, Overlay)
18
+ - **28 Premium Components** across 7 categories (Skeleton, Spinner, Progress, Pulse, Overlay, Button, Status)
19
+ - **Global Theming** - ThemeProvider for app-wide customization ✨ *New in v2.1.0*
20
+ - **Smart Loading UX** - useLoader hook with delay, minDuration, and autoHide ✨ *New in v2.1.0*
21
+ - **Enhanced CSS Variables** - Comprehensive theming with dark mode support ✨ *New in v2.1.0*
19
22
  - **Zero Configuration** - No Tailwind or build setup required ✨ *New in v2.0.0*
20
23
  - **Tiny Bundle Size** - 70% smaller CSS (6.27 KB → 1.64 KB gzipped) ✨ *New in v2.0.0*
21
24
  - **Zero Runtime Dependencies** - No external dependencies needed ✨ *New in v2.0.0*
@@ -54,6 +57,29 @@ import 'premium-react-loaders/styles';
54
57
 
55
58
  That's it! No Tailwind configuration or additional setup needed.
56
59
 
60
+ ### Optional: Global Theming (v2.1.0+)
61
+
62
+ Wrap your app with `ThemeProvider` to customize all loaders globally:
63
+
64
+ ```tsx
65
+ import { ThemeProvider } from 'premium-react-loaders';
66
+
67
+ function App() {
68
+ return (
69
+ <ThemeProvider
70
+ theme={{
71
+ primaryColor: '#8b5cf6',
72
+ secondaryColor: '#ec4899',
73
+ defaultSize: 'lg',
74
+ defaultSpeed: 'fast',
75
+ }}
76
+ >
77
+ <YourApp />
78
+ </ThemeProvider>
79
+ );
80
+ }
81
+ ```
82
+
57
83
  ## Quick Start
58
84
 
59
85
  ```tsx
@@ -139,6 +165,19 @@ Wrapper component for displaying loaders over content:
139
165
 
140
166
  - **LoaderOverlay** - Displays any loader over content with backdrop (full-screen or container-relative)
141
167
 
168
+ ### Button Components (1 component) ✨ *New in v2.2.0*
169
+
170
+ Specialized loaders for button loading states:
171
+
172
+ - **ButtonSpinner** - Compact spinner optimized for buttons with multiple variants (circle, dots, bars) and positioning options
173
+
174
+ ### Status Components (2 components) ✨ *New in v2.2.0*
175
+
176
+ Animated indicators for success and error states:
177
+
178
+ - **SuccessCheckmark** - Animated checkmark with optional circle background
179
+ - **ErrorIndicator** - Animated X mark with optional shake effect and circle background
180
+
142
181
  ## Usage Examples
143
182
 
144
183
  ### Skeleton Components
@@ -311,6 +350,144 @@ import { SpinnerCircle, ProgressBar, PulseDots } from 'premium-react-loaders';
311
350
  <PulseDots size="md" reverse />
312
351
  ```
313
352
 
353
+ ### New in v2.2.0
354
+
355
+ **Button Loaders** - Specialized spinners for button states:
356
+
357
+ ```tsx
358
+ import { ButtonSpinner } from 'premium-react-loaders';
359
+
360
+ // Inside a button
361
+ <button style={{ padding: '10px 20px', backgroundColor: '#3b82f6', color: 'white' }}>
362
+ <ButtonSpinner variant="circle" size={16} color="white">
363
+ Submit Form
364
+ </ButtonSpinner>
365
+ </button>
366
+
367
+ // Different variants
368
+ <ButtonSpinner variant="dots" position="right">Next</ButtonSpinner>
369
+ <ButtonSpinner variant="bars" showContent={false}>Loading</ButtonSpinner>
370
+ ```
371
+
372
+ **Status Indicators** - Show success and error states with smooth animations:
373
+
374
+ ```tsx
375
+ import { SuccessCheckmark, ErrorIndicator } from 'premium-react-loaders';
376
+
377
+ // Success state
378
+ <SuccessCheckmark
379
+ visible={isSuccess}
380
+ showCircle
381
+ fillCircle
382
+ size={64}
383
+ color="#10b981"
384
+ />
385
+
386
+ // Error state with shake
387
+ <ErrorIndicator
388
+ visible={hasError}
389
+ showCircle
390
+ shake
391
+ size={64}
392
+ color="#ef4444"
393
+ />
394
+ ```
395
+
396
+ ### New in v2.1.0
397
+
398
+ **Global Theming** - Customize all loaders from one place:
399
+
400
+ ```tsx
401
+ import { ThemeProvider } from 'premium-react-loaders';
402
+
403
+ function App() {
404
+ return (
405
+ <ThemeProvider
406
+ theme={{
407
+ primaryColor: '#8b5cf6',
408
+ secondaryColor: '#ec4899',
409
+ skeletonBase: '#e2e8f0',
410
+ skeletonHighlight: '#f1f5f9',
411
+ defaultSize: 'lg',
412
+ defaultSpeed: 'fast',
413
+ defaultDelay: 200,
414
+ defaultMinDuration: 600,
415
+ respectMotionPreference: true,
416
+ }}
417
+ >
418
+ {/* All loaders inherit these settings */}
419
+ <SpinnerCircle /> {/* Uses theme colors and size */}
420
+ <Skeleton /> {/* Uses theme skeleton colors */}
421
+ </ThemeProvider>
422
+ );
423
+ }
424
+ ```
425
+
426
+ **Smart Loading State Management** - Better UX with the `useLoader` hook:
427
+
428
+ ```tsx
429
+ import { useLoader } from 'premium-react-loaders';
430
+ import { SpinnerCircle } from 'premium-react-loaders';
431
+
432
+ function MyComponent() {
433
+ const { loading, startLoading, stopLoading, isVisible } = useLoader({
434
+ delay: 200, // Don't show loader for quick operations (<200ms)
435
+ minDuration: 600, // Show loader for at least 600ms to avoid flashing
436
+ autoHide: 5000, // Auto-hide after 5 seconds (optional)
437
+ });
438
+
439
+ const fetchData = async () => {
440
+ startLoading();
441
+ try {
442
+ await api.fetchData();
443
+ } finally {
444
+ stopLoading();
445
+ }
446
+ };
447
+
448
+ return (
449
+ <div>
450
+ <button onClick={fetchData}>Load Data</button>
451
+ <SpinnerCircle visible={isVisible} />
452
+ </div>
453
+ );
454
+ }
455
+ ```
456
+
457
+ **Enhanced CSS Variables** - More control with comprehensive theming:
458
+
459
+ ```css
460
+ :root {
461
+ /* Colors */
462
+ --loader-primary: #3b82f6;
463
+ --loader-secondary: #8b5cf6;
464
+ --skeleton-base: #e5e7eb;
465
+ --skeleton-highlight: #f5f5f5;
466
+
467
+ /* Sizes */
468
+ --loader-size-xs: 16px;
469
+ --loader-size-sm: 24px;
470
+ --loader-size-md: 40px;
471
+ --loader-size-lg: 56px;
472
+ --loader-size-xl: 72px;
473
+
474
+ /* Animation */
475
+ --loader-transition-fast: 150ms;
476
+ --loader-transition-normal: 300ms;
477
+ --loader-transition-slow: 500ms;
478
+ }
479
+
480
+ /* Dark mode support */
481
+ @media (prefers-color-scheme: dark) {
482
+ :root {
483
+ --skeleton-base: #2d3748;
484
+ --skeleton-highlight: #4a5568;
485
+ }
486
+ }
487
+ ```
488
+
489
+ **Improved TypingIndicator** - Smoother animations with dynamic timing that scales with speed settings.
490
+
314
491
  ## Customization
315
492
 
316
493
  All components support multiple customization methods:
@@ -339,16 +516,77 @@ Direct color control:
339
516
  <SpinnerCircle color="#8b5cf6" secondaryColor="#e0e0e0" />
340
517
  ```
341
518
 
342
- ### 4. CSS Variables
519
+ ### 4. CSS Variables (Enhanced in v2.1.0)
343
520
 
344
- Override theme variables globally:
521
+ Override theme variables globally for comprehensive customization:
345
522
 
346
523
  ```css
347
524
  :root {
525
+ /* Primary colors */
348
526
  --loader-primary: #3b82f6;
349
527
  --loader-secondary: #8b5cf6;
350
- --skeleton-base: #e0e0e0;
528
+
529
+ /* Skeleton colors */
530
+ --skeleton-base: #e5e7eb;
351
531
  --skeleton-highlight: #f5f5f5;
532
+
533
+ /* Size presets */
534
+ --loader-size-xs: 16px;
535
+ --loader-size-sm: 24px;
536
+ --loader-size-md: 40px;
537
+ --loader-size-lg: 56px;
538
+ --loader-size-xl: 72px;
539
+
540
+ /* Spacing and layout */
541
+ --loader-gap: 0.5rem;
542
+ --loader-radius-sm: 0.25rem;
543
+ --loader-radius-md: 0.5rem;
544
+ --loader-radius-lg: 1rem;
545
+ --loader-radius-full: 9999px;
546
+
547
+ /* Animation speeds */
548
+ --loader-transition-fast: 150ms;
549
+ --loader-transition-normal: 300ms;
550
+ --loader-transition-slow: 500ms;
551
+
552
+ /* Overlay */
553
+ --loader-overlay-backdrop: rgba(0, 0, 0, 0.5);
554
+ }
555
+
556
+ /* Dark mode support */
557
+ @media (prefers-color-scheme: dark) {
558
+ :root {
559
+ --skeleton-base: #2d3748;
560
+ --skeleton-highlight: #4a5568;
561
+ }
562
+ }
563
+ ```
564
+
565
+ ### 5. ThemeProvider (v2.1.0+)
566
+
567
+ Use the `ThemeProvider` component for runtime theming:
568
+
569
+ ```tsx
570
+ import { ThemeProvider, useTheme } from 'premium-react-loaders';
571
+
572
+ function App() {
573
+ return (
574
+ <ThemeProvider
575
+ theme={{
576
+ primaryColor: '#8b5cf6',
577
+ secondaryColor: '#ec4899',
578
+ defaultSize: 'lg',
579
+ }}
580
+ >
581
+ <YourComponents />
582
+ </ThemeProvider>
583
+ );
584
+ }
585
+
586
+ // Access theme in child components
587
+ function ChildComponent() {
588
+ const { theme } = useTheme();
589
+ return <SpinnerCircle />; // Automatically uses theme settings
352
590
  }
353
591
  ```
354
592
 
@@ -362,6 +600,9 @@ import type {
362
600
  SpinnerCircleProps,
363
601
  ProgressBarProps,
364
602
  PulseDotsProps,
603
+ LoaderTheme,
604
+ UseLoaderOptions,
605
+ UseLoaderReturn,
365
606
  } from 'premium-react-loaders';
366
607
 
367
608
  const MyComponent: React.FC = () => {
@@ -373,6 +614,21 @@ const MyComponent: React.FC = () => {
373
614
 
374
615
  return <Skeleton {...skeletonProps} />;
375
616
  };
617
+
618
+ // Theme typing (v2.1.0+)
619
+ const customTheme: LoaderTheme = {
620
+ primaryColor: '#8b5cf6',
621
+ secondaryColor: '#ec4899',
622
+ defaultSize: 'lg',
623
+ defaultSpeed: 'fast',
624
+ };
625
+
626
+ // useLoader hook typing (v2.1.0+)
627
+ const loaderOptions: UseLoaderOptions = {
628
+ delay: 200,
629
+ minDuration: 600,
630
+ autoHide: 5000,
631
+ };
376
632
  ```
377
633
 
378
634
  ## Common Props
@@ -0,0 +1,25 @@
1
+ import { ButtonSpinnerProps } from '../../types';
2
+ /**
3
+ * ButtonSpinner - Spinner designed for button loading states
4
+ *
5
+ * A compact spinner component optimized for use inside buttons, with options for
6
+ * positioning relative to button content and different visual variants.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * // Simple button with spinner
11
+ * <ButtonSpinner visible={isLoading}>Submit</ButtonSpinner>
12
+ *
13
+ * // Spinner on the left
14
+ * <ButtonSpinner visible={isLoading} position="left" variant="dots">
15
+ * Loading...
16
+ * </ButtonSpinner>
17
+ *
18
+ * // Hide content when loading
19
+ * <ButtonSpinner visible={isLoading} showContent={false}>
20
+ * Click Me
21
+ * </ButtonSpinner>
22
+ * ```
23
+ */
24
+ export declare const ButtonSpinner: import('react').ForwardRefExoticComponent<ButtonSpinnerProps & import('react').RefAttributes<HTMLDivElement>>;
25
+ //# sourceMappingURL=ButtonSpinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonSpinner.d.ts","sourceRoot":"","sources":["../../../src/components/button/ButtonSpinner.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AASjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,aAAa,+GA8IzB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ButtonSpinner } from './ButtonSpinner';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -3,4 +3,6 @@ export * from './spinner';
3
3
  export * from './progress';
4
4
  export * from './pulse';
5
5
  export * from './overlay';
6
+ export * from './button';
7
+ export * from './status';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAG3B,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAG3B,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC;AAG1B,cAAc,UAAU,CAAC;AAGzB,cAAc,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/pulse/TypingIndicator.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,iHAqE3B,CAAC"}
1
+ {"version":3,"file":"TypingIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/pulse/TypingIndicator.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,iHA+E3B,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { ErrorIndicatorProps } from '../../types';
2
+ /**
3
+ * ErrorIndicator - Animated error indicator with X mark
4
+ *
5
+ * Displays an animated X mark that draws itself, perfect for showing
6
+ * failed operations, validation errors, or error states.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * // Simple error indicator
11
+ * <ErrorIndicator visible={hasError} />
12
+ *
13
+ * // With circle background and shake animation
14
+ * <ErrorIndicator
15
+ * visible={hasError}
16
+ * showCircle
17
+ * circleColor="#ef4444"
18
+ * fillCircle
19
+ * shake
20
+ * />
21
+ *
22
+ * // Custom size and color
23
+ * <ErrorIndicator
24
+ * visible={hasError}
25
+ * size={64}
26
+ * color="#dc2626"
27
+ * duration={600}
28
+ * />
29
+ * ```
30
+ */
31
+ export declare const ErrorIndicator: import('react').ForwardRefExoticComponent<ErrorIndicatorProps & import('react').RefAttributes<HTMLDivElement>>;
32
+ //# sourceMappingURL=ErrorIndicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/status/ErrorIndicator.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,cAAc,gHAkG1B,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { SuccessCheckmarkProps } from '../../types';
2
+ /**
3
+ * SuccessCheckmark - Animated checkmark for successful operations
4
+ *
5
+ * Displays an animated checkmark that draws itself, perfect for showing
6
+ * successful completion of actions like form submissions, file uploads, etc.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * // Simple checkmark
11
+ * <SuccessCheckmark visible={isSuccess} />
12
+ *
13
+ * // With circle background
14
+ * <SuccessCheckmark
15
+ * visible={isSuccess}
16
+ * showCircle
17
+ * circleColor="#10b981"
18
+ * fillCircle
19
+ * />
20
+ *
21
+ * // Custom size and color
22
+ * <SuccessCheckmark
23
+ * visible={isSuccess}
24
+ * size={64}
25
+ * color="#22c55e"
26
+ * duration={600}
27
+ * />
28
+ * ```
29
+ */
30
+ export declare const SuccessCheckmark: import('react').ForwardRefExoticComponent<SuccessCheckmarkProps & import('react').RefAttributes<HTMLDivElement>>;
31
+ //# sourceMappingURL=SuccessCheckmark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SuccessCheckmark.d.ts","sourceRoot":"","sources":["../../../src/components/status/SuccessCheckmark.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,gBAAgB,kHAwF5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { SuccessCheckmark } from './SuccessCheckmark';
2
+ export { ErrorIndicator } from './ErrorIndicator';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/status/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Theme configuration for loaders
4
+ */
5
+ export interface LoaderTheme {
6
+ /** Primary color for loaders */
7
+ primaryColor?: string;
8
+ /** Secondary color for loaders */
9
+ secondaryColor?: string;
10
+ /** Base color for skeletons */
11
+ skeletonBase?: string;
12
+ /** Highlight color for skeletons */
13
+ skeletonHighlight?: string;
14
+ /** Default size for loaders */
15
+ defaultSize?: number | string;
16
+ /** Default speed for animations */
17
+ defaultSpeed?: 'slow' | 'normal' | 'fast' | number;
18
+ /** Default delay before showing loaders */
19
+ defaultDelay?: number;
20
+ /** Default minimum duration for loaders */
21
+ defaultMinDuration?: number;
22
+ /** Default transition duration */
23
+ defaultTransition?: number | boolean;
24
+ /** Respect user's motion preferences by default */
25
+ respectMotionPreference?: boolean;
26
+ }
27
+ interface ThemeContextValue {
28
+ theme: LoaderTheme;
29
+ }
30
+ export interface ThemeProviderProps {
31
+ /** Theme configuration */
32
+ theme?: LoaderTheme;
33
+ /** Child components */
34
+ children: ReactNode;
35
+ }
36
+ /**
37
+ * ThemeProvider - Global theme configuration for loaders
38
+ *
39
+ * Provides theme values to all loader components in the component tree.
40
+ * Components will use theme values as defaults unless overridden by props.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * import { ThemeProvider } from 'premium-react-loaders';
45
+ *
46
+ * function App() {
47
+ * return (
48
+ * <ThemeProvider
49
+ * theme={{
50
+ * primaryColor: '#8b5cf6',
51
+ * defaultSpeed: 'fast',
52
+ * defaultDelay: 200,
53
+ * defaultMinDuration: 600,
54
+ * }}
55
+ * >
56
+ * <YourApp />
57
+ * </ThemeProvider>
58
+ * );
59
+ * }
60
+ * ```
61
+ */
62
+ export declare function ThemeProvider({ theme, children }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
63
+ /**
64
+ * useTheme - Access theme configuration
65
+ *
66
+ * Returns the current theme configuration from ThemeProvider.
67
+ * If no ThemeProvider is present, returns an empty theme object.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * function MyComponent() {
72
+ * const { theme } = useTheme();
73
+ * return <div style={{ color: theme.primaryColor }}>Hello</div>;
74
+ * }
75
+ * ```
76
+ */
77
+ export declare function useTheme(): ThemeContextValue;
78
+ /**
79
+ * Get theme value with fallback
80
+ * @internal
81
+ */
82
+ export declare function useThemeValue<K extends keyof LoaderTheme>(key: K, propValue: LoaderTheme[K] | undefined, defaultValue: LoaderTheme[K]): LoaderTheme[K];
83
+ export {};
84
+ //# sourceMappingURL=ThemeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../src/context/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACnD,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kCAAkC;IAClC,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,mDAAmD;IACnD,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,WAAW,CAAC;CACpB;AAID,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,uBAAuB;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAU,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAIzE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAG5C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,WAAW,EACvD,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,EACrC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,GAC3B,WAAW,CAAC,CAAC,CAAC,CAGhB"}
@@ -0,0 +1,3 @@
1
+ export { ThemeProvider, useTheme, useThemeValue } from './ThemeContext';
2
+ export type { LoaderTheme, ThemeProviderProps } from './ThemeContext';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { useLoader } from './useLoader';
2
+ export type { UseLoaderOptions, UseLoaderReturn } from './useLoader';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,56 @@
1
+ export interface UseLoaderOptions {
2
+ /** Initial loading state */
3
+ initialLoading?: boolean;
4
+ /** Delay before showing loader (ms) */
5
+ delay?: number;
6
+ /** Minimum duration to show loader (ms) */
7
+ minDuration?: number;
8
+ /** Auto-hide loader after duration (ms) */
9
+ autoHide?: number;
10
+ }
11
+ export interface UseLoaderReturn {
12
+ /** Current loading state */
13
+ loading: boolean;
14
+ /** Start loading */
15
+ startLoading: () => void;
16
+ /** Stop loading */
17
+ stopLoading: () => void;
18
+ /** Toggle loading state */
19
+ toggleLoading: () => void;
20
+ /** Set loading state directly */
21
+ setLoading: (loading: boolean) => void;
22
+ /** Whether loader should be visible (accounts for delay/minDuration) */
23
+ isVisible: boolean;
24
+ }
25
+ /**
26
+ * useLoader - Manage loading states with smart UX features
27
+ *
28
+ * A hook for managing loader visibility with built-in delay, minimum duration,
29
+ * and auto-hide capabilities for optimal user experience.
30
+ *
31
+ * @param options - Configuration options
32
+ * @returns Loading state and control functions
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * function MyComponent() {
37
+ * const { loading, startLoading, stopLoading, isVisible } = useLoader({
38
+ * delay: 200,
39
+ * minDuration: 600,
40
+ * });
41
+ *
42
+ * const fetchData = async () => {
43
+ * startLoading();
44
+ * try {
45
+ * await api.fetchData();
46
+ * } finally {
47
+ * stopLoading();
48
+ * }
49
+ * };
50
+ *
51
+ * return <SpinnerCircle visible={isVisible} />;
52
+ * }
53
+ * ```
54
+ */
55
+ export declare function useLoader(options?: UseLoaderOptions): UseLoaderReturn;
56
+ //# sourceMappingURL=useLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoader.d.ts","sourceRoot":"","sources":["../../src/hooks/useLoader.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,mBAAmB;IACnB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,iCAAiC;IACjC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,wEAAwE;IACxE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CAyGzE"}