@@ -16,6 +16,9 @@ See all 25 components in action with interactive examples and customization opti
1616## Features
1717
1818- ** 25 Premium Components** across 5 categories (Skeleton, Spinner, Progress, Pulse, Overlay)
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*
1922- ** Zero Configuration** - No Tailwind or build setup required ✨ * New in v2.0.0*
2023- ** Tiny Bundle Size** - 70% smaller CSS (6.27 KB → 1.64 KB gzipped) ✨ * New in v2.0.0*
2124- ** Zero Runtime Dependencies** - No external dependencies needed ✨ * New in v2.0.0*
@@ -54,6 +57,29 @@ import 'premium-react-loaders/styles';
5457
5558That's it! No Tailwind configuration or additional setup needed.
5659
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+
5783## Quick Start
5884
5985``` tsx
@@ -311,6 +337,101 @@ import { SpinnerCircle, ProgressBar, PulseDots } from 'premium-react-loaders';
311337<PulseDots size = " md" reverse />
312338```
313339
340+ ### New in v2.1.0
341+
342+ ** Global Theming** - Customize all loaders from one place:
343+
344+ ``` tsx
345+ import { ThemeProvider } from ' premium-react-loaders' ;
346+
347+ function App() {
348+ return (
349+ <ThemeProvider
350+ theme = { {
351+ primaryColor: ' #8b5cf6' ,
352+ secondaryColor: ' #ec4899' ,
353+ skeletonBase: ' #e2e8f0' ,
354+ skeletonHighlight: ' #f1f5f9' ,
355+ defaultSize: ' lg' ,
356+ defaultSpeed: ' fast' ,
357+ defaultDelay: 200 ,
358+ defaultMinDuration: 600 ,
359+ respectMotionPreference: true ,
360+ }}
361+ >
362+ { /* All loaders inherit these settings */ }
363+ <SpinnerCircle /> { /* Uses theme colors and size */ }
364+ <Skeleton /> { /* Uses theme skeleton colors */ }
365+ </ThemeProvider >
366+ );
367+ }
368+ ```
369+
370+ ** Smart Loading State Management** - Better UX with the ` useLoader ` hook:
371+
372+ ``` tsx
373+ import { useLoader } from ' premium-react-loaders' ;
374+ import { SpinnerCircle } from ' premium-react-loaders' ;
375+
376+ function MyComponent() {
377+ const { loading, startLoading, stopLoading, isVisible } = useLoader ({
378+ delay: 200 , // Don't show loader for quick operations (<200ms)
379+ minDuration: 600 , // Show loader for at least 600ms to avoid flashing
380+ autoHide: 5000 , // Auto-hide after 5 seconds (optional)
381+ });
382+
383+ const fetchData = async () => {
384+ startLoading ();
385+ try {
386+ await api .fetchData ();
387+ } finally {
388+ stopLoading ();
389+ }
390+ };
391+
392+ return (
393+ <div >
394+ <button onClick = { fetchData } >Load Data</button >
395+ <SpinnerCircle visible = { isVisible } />
396+ </div >
397+ );
398+ }
399+ ```
400+
401+ ** Enhanced CSS Variables** - More control with comprehensive theming:
402+
403+ ``` css
404+ :root {
405+ /* Colors */
406+ --loader-primary : #3b82f6 ;
407+ --loader-secondary : #8b5cf6 ;
408+ --skeleton-base : #e5e7eb ;
409+ --skeleton-highlight : #f5f5f5 ;
410+
411+ /* Sizes */
412+ --loader-size-xs : 16px ;
413+ --loader-size-sm : 24px ;
414+ --loader-size-md : 40px ;
415+ --loader-size-lg : 56px ;
416+ --loader-size-xl : 72px ;
417+
418+ /* Animation */
419+ --loader-transition-fast : 150ms ;
420+ --loader-transition-normal : 300ms ;
421+ --loader-transition-slow : 500ms ;
422+ }
423+
424+ /* Dark mode support */
425+ @media (prefers-color-scheme: dark) {
426+ :root {
427+ --skeleton-base : #2d3748 ;
428+ --skeleton-highlight : #4a5568 ;
429+ }
430+ }
431+ ```
432+
433+ ** Improved TypingIndicator** - Smoother animations with dynamic timing that scales with speed settings.
434+
314435## Customization
315436
316437All components support multiple customization methods:
@@ -339,16 +460,77 @@ Direct color control:
339460<SpinnerCircle color = " #8b5cf6" secondaryColor = " #e0e0e0" />
340461```
341462
342- ### 4. CSS Variables
463+ ### 4. CSS Variables (Enhanced in v2.1.0)
343464
344- Override theme variables globally:
465+ Override theme variables globally for comprehensive customization :
345466
346467``` css
347468:root {
469+ /* Primary colors */
348470 --loader-primary : #3b82f6 ;
349471 --loader-secondary : #8b5cf6 ;
350- --skeleton-base : #e0e0e0 ;
472+
473+ /* Skeleton colors */
474+ --skeleton-base : #e5e7eb ;
351475 --skeleton-highlight : #f5f5f5 ;
476+
477+ /* Size presets */
478+ --loader-size-xs : 16px ;
479+ --loader-size-sm : 24px ;
480+ --loader-size-md : 40px ;
481+ --loader-size-lg : 56px ;
482+ --loader-size-xl : 72px ;
483+
484+ /* Spacing and layout */
485+ --loader-gap : 0.5rem ;
486+ --loader-radius-sm : 0.25rem ;
487+ --loader-radius-md : 0.5rem ;
488+ --loader-radius-lg : 1rem ;
489+ --loader-radius-full : 9999px ;
490+
491+ /* Animation speeds */
492+ --loader-transition-fast : 150ms ;
493+ --loader-transition-normal : 300ms ;
494+ --loader-transition-slow : 500ms ;
495+
496+ /* Overlay */
497+ --loader-overlay-backdrop : rgba (0 , 0 , 0 , 0.5 );
498+ }
499+
500+ /* Dark mode support */
501+ @media (prefers-color-scheme: dark) {
502+ :root {
503+ --skeleton-base : #2d3748 ;
504+ --skeleton-highlight : #4a5568 ;
505+ }
506+ }
507+ ```
508+
509+ ### 5. ThemeProvider (v2.1.0+)
510+
511+ Use the ` ThemeProvider ` component for runtime theming:
512+
513+ ``` tsx
514+ import { ThemeProvider , useTheme } from ' premium-react-loaders' ;
515+
516+ function App() {
517+ return (
518+ <ThemeProvider
519+ theme = { {
520+ primaryColor: ' #8b5cf6' ,
521+ secondaryColor: ' #ec4899' ,
522+ defaultSize: ' lg' ,
523+ }}
524+ >
525+ <YourComponents />
526+ </ThemeProvider >
527+ );
528+ }
529+
530+ // Access theme in child components
531+ function ChildComponent() {
532+ const { theme } = useTheme ();
533+ return <SpinnerCircle />; // Automatically uses theme settings
352534}
353535```
354536
@@ -362,6 +544,9 @@ import type {
362544 SpinnerCircleProps ,
363545 ProgressBarProps ,
364546 PulseDotsProps ,
547+ LoaderTheme ,
548+ UseLoaderOptions ,
549+ UseLoaderReturn ,
365550} from ' premium-react-loaders' ;
366551
367552const MyComponent: React .FC = () => {
@@ -373,6 +558,21 @@ const MyComponent: React.FC = () => {
373558
374559 return <Skeleton {... skeletonProps } />;
375560};
561+
562+ // Theme typing (v2.1.0+)
563+ const customTheme: LoaderTheme = {
564+ primaryColor: ' #8b5cf6' ,
565+ secondaryColor: ' #ec4899' ,
566+ defaultSize: ' lg' ,
567+ defaultSpeed: ' fast' ,
568+ };
569+
570+ // useLoader hook typing (v2.1.0+)
571+ const loaderOptions: UseLoaderOptions = {
572+ delay: 200 ,
573+ minDuration: 600 ,
574+ autoHide: 5000 ,
575+ };
376576```
377577
378578## Common Props
0 commit comments