premium-react-loaders 2.0.0 → 2.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 (72) hide show
  1. package/README.md +203 -3
  2. package/dist/components/pulse/TypingIndicator.d.ts.map +1 -1
  3. package/dist/context/ThemeContext.d.ts +84 -0
  4. package/dist/context/ThemeContext.d.ts.map +1 -0
  5. package/dist/context/index.d.ts +3 -0
  6. package/dist/context/index.d.ts.map +1 -0
  7. package/dist/hooks/index.d.ts +3 -0
  8. package/dist/hooks/index.d.ts.map +1 -0
  9. package/dist/hooks/useLoader.d.ts +56 -0
  10. package/dist/hooks/useLoader.d.ts.map +1 -0
  11. package/dist/index.cjs +31 -26
  12. package/dist/index.d.ts +5 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +31 -26
  15. package/dist/index10.cjs +20 -31
  16. package/dist/index10.js +20 -31
  17. package/dist/index11.cjs +47 -25
  18. package/dist/index11.js +47 -25
  19. package/dist/index12.cjs +30 -126
  20. package/dist/index12.js +31 -127
  21. package/dist/index13.cjs +30 -53
  22. package/dist/index13.js +30 -53
  23. package/dist/index14.cjs +127 -43
  24. package/dist/index14.js +128 -44
  25. package/dist/index15.cjs +58 -37
  26. package/dist/index15.js +59 -38
  27. package/dist/index16.cjs +24 -36
  28. package/dist/index16.js +24 -36
  29. package/dist/index17.cjs +19 -21
  30. package/dist/index17.js +19 -21
  31. package/dist/index18.cjs +25 -20
  32. package/dist/index18.js +25 -20
  33. package/dist/index19.cjs +22 -32
  34. package/dist/index19.js +22 -32
  35. package/dist/index20.cjs +26 -35
  36. package/dist/index20.js +28 -37
  37. package/dist/index21.cjs +40 -76
  38. package/dist/index21.js +42 -78
  39. package/dist/index22.cjs +53 -102
  40. package/dist/index22.js +54 -103
  41. package/dist/index23.cjs +46 -80
  42. package/dist/index23.js +47 -81
  43. package/dist/index24.cjs +105 -103
  44. package/dist/index24.js +107 -105
  45. package/dist/index25.cjs +108 -27
  46. package/dist/index25.js +111 -30
  47. package/dist/index26.cjs +104 -36
  48. package/dist/index26.js +106 -38
  49. package/dist/index27.cjs +22 -30
  50. package/dist/index27.js +23 -31
  51. package/dist/index28.cjs +30 -29
  52. package/dist/index28.js +31 -30
  53. package/dist/index29.cjs +49 -52
  54. package/dist/index29.js +50 -53
  55. package/dist/index30.cjs +74 -121
  56. package/dist/index30.js +75 -122
  57. package/dist/index31.cjs +82 -0
  58. package/dist/index31.js +82 -0
  59. package/dist/index32.cjs +125 -0
  60. package/dist/index32.js +125 -0
  61. package/dist/index5.cjs +11 -72
  62. package/dist/index5.js +12 -73
  63. package/dist/index6.cjs +86 -65
  64. package/dist/index6.js +87 -66
  65. package/dist/index7.cjs +40 -20
  66. package/dist/index7.js +40 -20
  67. package/dist/index8.cjs +34 -21
  68. package/dist/index8.js +34 -21
  69. package/dist/index9.cjs +21 -55
  70. package/dist/index9.js +22 -56
  71. package/dist/premium-react-loaders.css +38 -6
  72. package/package.json +1 -1
package/README.md CHANGED
@@ -16,6 +16,9 @@ See all 25 components in action with interactive examples and customization opti
16
16
  ## Features
17
17
 
18
18
  - **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*
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
@@ -311,6 +337,101 @@ import { SpinnerCircle, ProgressBar, PulseDots } from 'premium-react-loaders';
311
337
  <PulseDots size="md" reverse />
312
338
  ```
313
339
 
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
+
314
435
  ## Customization
315
436
 
316
437
  All components support multiple customization methods:
@@ -339,16 +460,77 @@ Direct color control:
339
460
  <SpinnerCircle color="#8b5cf6" secondaryColor="#e0e0e0" />
340
461
  ```
341
462
 
342
- ### 4. CSS Variables
463
+ ### 4. CSS Variables (Enhanced in v2.1.0)
343
464
 
344
- Override theme variables globally:
465
+ Override theme variables globally for comprehensive customization:
345
466
 
346
467
  ```css
347
468
  :root {
469
+ /* Primary colors */
348
470
  --loader-primary: #3b82f6;
349
471
  --loader-secondary: #8b5cf6;
350
- --skeleton-base: #e0e0e0;
472
+
473
+ /* Skeleton colors */
474
+ --skeleton-base: #e5e7eb;
351
475
  --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
352
534
  }
353
535
  ```
354
536
 
@@ -362,6 +544,9 @@ import type {
362
544
  SpinnerCircleProps,
363
545
  ProgressBarProps,
364
546
  PulseDotsProps,
547
+ LoaderTheme,
548
+ UseLoaderOptions,
549
+ UseLoaderReturn,
365
550
  } from 'premium-react-loaders';
366
551
 
367
552
  const MyComponent: React.FC = () => {
@@ -373,6 +558,21 @@ const MyComponent: React.FC = () => {
373
558
 
374
559
  return <Skeleton {...skeletonProps} />;
375
560
  };
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
+ };
376
576
  ```
377
577
 
378
578
  ## Common Props
@@ -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,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"}
package/dist/index.cjs CHANGED
@@ -3,35 +3,40 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  ;/* empty css */
4
4
  const classNames = require("./index3.cjs");
5
5
  const colors = require("./index4.cjs");
6
- const Skeleton = require("./index5.cjs");
7
- const SkeletonText = require("./index6.cjs");
8
- const SkeletonAvatar = require("./index7.cjs");
9
- const SkeletonImage = require("./index8.cjs");
10
- const SkeletonCard = require("./index9.cjs");
11
- const SkeletonList = require("./index10.cjs");
12
- const SkeletonTable = require("./index11.cjs");
13
- const SkeletonPage = require("./index12.cjs");
14
- const SkeletonForm = require("./index13.cjs");
15
- const SpinnerCircle = require("./index14.cjs");
16
- const SpinnerRing = require("./index15.cjs");
17
- const SpinnerDots = require("./index16.cjs");
18
- const SpinnerBars = require("./index17.cjs");
19
- const SpinnerGrid = require("./index18.cjs");
20
- const SpinnerWave = require("./index19.cjs");
21
- const SpinnerPulse = require("./index20.cjs");
22
- const ProgressBar = require("./index21.cjs");
23
- const ProgressCircle = require("./index22.cjs");
24
- const ProgressRing = require("./index23.cjs");
25
- const ProgressSteps = require("./index24.cjs");
26
- const PulseDots = require("./index25.cjs");
27
- const PulseWave = require("./index26.cjs");
28
- const PulseBars = require("./index27.cjs");
29
- const TypingIndicator = require("./index28.cjs");
30
- const LoaderOverlay = require("./index29.cjs");
31
- const version = "1.1.0";
6
+ const ThemeContext = require("./index5.cjs");
7
+ const useLoader = require("./index6.cjs");
8
+ const Skeleton = require("./index7.cjs");
9
+ const SkeletonText = require("./index8.cjs");
10
+ const SkeletonAvatar = require("./index9.cjs");
11
+ const SkeletonImage = require("./index10.cjs");
12
+ const SkeletonCard = require("./index11.cjs");
13
+ const SkeletonList = require("./index12.cjs");
14
+ const SkeletonTable = require("./index13.cjs");
15
+ const SkeletonPage = require("./index14.cjs");
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 version = "2.1.0";
32
34
  exports.cn = classNames.cn;
33
35
  exports.getAnimationDuration = colors.getAnimationDuration;
34
36
  exports.normalizeSize = colors.normalizeSize;
37
+ exports.ThemeProvider = ThemeContext.ThemeProvider;
38
+ exports.useTheme = ThemeContext.useTheme;
39
+ exports.useLoader = useLoader.useLoader;
35
40
  exports.Skeleton = Skeleton.Skeleton;
36
41
  exports.SkeletonText = SkeletonText.SkeletonText;
37
42
  exports.SkeletonAvatar = SkeletonAvatar.SkeletonAvatar;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export * from './components';
2
2
  export type * from './types';
3
+ export { ThemeProvider, useTheme } from './context';
4
+ export type { LoaderTheme, ThemeProviderProps } from './context';
5
+ export { useLoader } from './hooks';
6
+ export type { UseLoaderOptions, UseLoaderReturn } from './hooks';
3
7
  export { cn } from './utils/classNames';
4
8
  export { getAnimationDuration, normalizeSize } from './utils/colors';
5
- export declare const version = "1.1.0";
9
+ export declare const version = "2.1.0";
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B,cAAc,cAAc,CAAC;AAG7B,mBAAmB,SAAS,CAAC;AAG7B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGrE,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B,cAAc,cAAc,CAAC;AAG7B,mBAAmB,SAAS,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGjE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGrE,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,32 +1,34 @@
1
1
  /* empty css */
2
2
  import { cn } from "./index3.js";
3
3
  import { getAnimationDuration, normalizeSize } from "./index4.js";
4
- import { Skeleton } from "./index5.js";
5
- import { SkeletonText } from "./index6.js";
6
- import { SkeletonAvatar } from "./index7.js";
7
- import { SkeletonImage } from "./index8.js";
8
- import { SkeletonCard } from "./index9.js";
9
- import { SkeletonList } from "./index10.js";
10
- import { SkeletonTable } from "./index11.js";
11
- import { SkeletonPage } from "./index12.js";
12
- import { SkeletonForm } from "./index13.js";
13
- import { SpinnerCircle } from "./index14.js";
14
- import { SpinnerRing } from "./index15.js";
15
- import { SpinnerDots } from "./index16.js";
16
- import { SpinnerBars } from "./index17.js";
17
- import { SpinnerGrid } from "./index18.js";
18
- import { SpinnerWave } from "./index19.js";
19
- import { SpinnerPulse } from "./index20.js";
20
- import { ProgressBar } from "./index21.js";
21
- import { ProgressCircle } from "./index22.js";
22
- import { ProgressRing } from "./index23.js";
23
- import { ProgressSteps } from "./index24.js";
24
- import { PulseDots } from "./index25.js";
25
- import { PulseWave } from "./index26.js";
26
- import { PulseBars } from "./index27.js";
27
- import { TypingIndicator } from "./index28.js";
28
- import { LoaderOverlay } from "./index29.js";
29
- const version = "1.1.0";
4
+ import { ThemeProvider, useTheme } from "./index5.js";
5
+ import { useLoader } from "./index6.js";
6
+ import { Skeleton } from "./index7.js";
7
+ import { SkeletonText } from "./index8.js";
8
+ import { SkeletonAvatar } from "./index9.js";
9
+ import { SkeletonImage } from "./index10.js";
10
+ import { SkeletonCard } from "./index11.js";
11
+ import { SkeletonList } from "./index12.js";
12
+ import { SkeletonTable } from "./index13.js";
13
+ import { SkeletonPage } from "./index14.js";
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
+ const version = "2.1.0";
30
32
  export {
31
33
  LoaderOverlay,
32
34
  ProgressBar,
@@ -52,9 +54,12 @@ export {
52
54
  SpinnerPulse,
53
55
  SpinnerRing,
54
56
  SpinnerWave,
57
+ ThemeProvider,
55
58
  TypingIndicator,
56
59
  cn,
57
60
  getAnimationDuration,
58
61
  normalizeSize,
62
+ useLoader,
63
+ useTheme,
59
64
  version
60
65
  };
package/dist/index10.cjs CHANGED
@@ -2,16 +2,13 @@
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 Skeleton = require("./index5.cjs");
6
- const hooks = require("./index30.cjs");
7
- const colors = require("./index4.cjs");
8
- const classNames = require("./index3.cjs");
9
- const SkeletonList = react.forwardRef(
5
+ const Skeleton = require("./index7.cjs");
6
+ const hooks = require("./index32.cjs");
7
+ const SkeletonImage = react.forwardRef(
10
8
  ({
11
- items = 3,
12
- itemHeight = "3rem",
13
- gap = "0.75rem",
14
9
  width = "100%",
10
+ height = "200px",
11
+ aspectRatio,
15
12
  animate = true,
16
13
  baseColor,
17
14
  highlightColor,
@@ -21,7 +18,7 @@ const SkeletonList = react.forwardRef(
21
18
  transition,
22
19
  className,
23
20
  style,
24
- testId = "skeleton-list",
21
+ testId = "skeleton-image",
25
22
  visible = true,
26
23
  ...rest
27
24
  }, ref) => {
@@ -33,37 +30,29 @@ const SkeletonList = react.forwardRef(
33
30
  );
34
31
  if (!shouldRender) return null;
35
32
  return /* @__PURE__ */ jsxRuntime.jsx(
36
- "div",
33
+ Skeleton.Skeleton,
37
34
  {
38
35
  ref,
39
36
  "data-testid": testId,
40
- className: classNames.cn("flex flex-col", className),
37
+ width,
38
+ height: aspectRatio ? "auto" : height,
39
+ variant: "rounded",
40
+ borderRadius,
41
+ animate,
42
+ baseColor,
43
+ highlightColor,
44
+ className,
41
45
  style: {
42
- gap: colors.normalizeSize(gap),
46
+ aspectRatio: aspectRatio || void 0,
43
47
  ...style,
44
48
  opacity,
45
49
  transition: transitionStyle
46
50
  },
47
- role: "status",
48
- "aria-label": "Loading list...",
49
- "aria-busy": "true",
50
- ...rest,
51
- children: Array.from({ length: items }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
52
- Skeleton.Skeleton,
53
- {
54
- width,
55
- height: itemHeight,
56
- variant: "rounded",
57
- borderRadius,
58
- animate,
59
- baseColor,
60
- highlightColor
61
- },
62
- index
63
- ))
51
+ "aria-label": "Loading image...",
52
+ ...rest
64
53
  }
65
54
  );
66
55
  }
67
56
  );
68
- SkeletonList.displayName = "SkeletonList";
69
- exports.SkeletonList = SkeletonList;
57
+ SkeletonImage.displayName = "SkeletonImage";
58
+ exports.SkeletonImage = SkeletonImage;