Skip to content

Commit 559ab55

Browse files
authored
Merge pull request #6 from ishansasika/release/v2.3.1-docs-fix-and-useloader-improvements
Release/v2.3.1 docs fix and useloader improvements
2 parents 1592d03 + 6a91d2c commit 559ab55

6 files changed

Lines changed: 48 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.3.1] - 2025-01-14
9+
10+
### Added
11+
- **useEnhancedLoader**: Added `toggleLoading()` function for toggling loading state
12+
- **useEnhancedLoader**: Added `setLoading(boolean)` function for direct state control
13+
- These additions make useEnhancedLoader API-consistent with the basic useLoader hook
14+
15+
### Fixed
16+
- **Documentation**: Updated component count from 28 to 29 across all documentation
17+
- **Documentation**: Updated category count from 7 to 8 across all documentation
18+
- **Storybook Introduction**: Added missing Transition category section
19+
820
## [2.3.0] - 2025-01-13
921

1022
### Added

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Premium React Loaders
22

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.
3+
A comprehensive collection of **29 premium, production-ready loading components** for React applications. Built with TypeScript and custom CSS for maximum flexibility and zero configuration.
44

55
[![npm version](https://img.shields.io/npm/v/premium-react-loaders.svg)](https://www.npmjs.com/package/premium-react-loaders)
66
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
@@ -11,11 +11,11 @@ A comprehensive collection of **28 premium, production-ready loading components*
1111

1212
📚 **[Storybook Documentation](https://docs.premium-react-loaders.ishansasika.dev/)** - Detailed component documentation and examples
1313

14-
See all 28 components in action with interactive examples and customization options.
14+
See all 29 components in action with interactive examples and customization options.
1515

1616
## Features
1717

18-
- **28 Premium Components** across 7 categories (Skeleton, Spinner, Progress, Pulse, Overlay, Button, Status)
18+
- **29 Premium Components** across 8 categories (Skeleton, Spinner, Progress, Pulse, Overlay, Button, Status, Transition)
1919
- **Global Theming** - ThemeProvider for app-wide customization ✨ *New in v2.1.0*
2020
- **Smart Loading UX** - useLoader hook with delay, minDuration, and autoHide ✨ *New in v2.1.0*
2121
- **Enhanced CSS Variables** - Comprehensive theming with dark mode support ✨ *New in v2.1.0*

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "premium-react-loaders",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "Premium, production-ready loading components for React with TypeScript",
55
"author": "Ishan Karunaratne",
66
"license": "MIT",

src/hooks/useEnhancedLoader.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,25 @@ export function useEnhancedLoader(options: UseLoaderOptions = {}): UseLoaderRetu
368368
setHistory([]);
369369
}, []);
370370

371+
const toggleLoading = useCallback(() => {
372+
if (loading) {
373+
stopLoading();
374+
} else {
375+
startLoading();
376+
}
377+
}, [loading, startLoading, stopLoading]);
378+
379+
const setLoading = useCallback(
380+
(value: boolean) => {
381+
if (value) {
382+
startLoading();
383+
} else {
384+
stopLoading();
385+
}
386+
},
387+
[startLoading, stopLoading]
388+
);
389+
371390
return {
372391
loading,
373392
isVisible,
@@ -377,6 +396,8 @@ export function useEnhancedLoader(options: UseLoaderOptions = {}): UseLoaderRetu
377396
history,
378397
startLoading,
379398
stopLoading,
399+
toggleLoading,
400+
setLoading,
380401
setError,
381402
retry,
382403
reset,

src/types/hooks.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ export interface UseLoaderReturn {
115115
/** Stop loading with success */
116116
stopLoading: () => void;
117117

118+
/** Toggle loading state */
119+
toggleLoading: () => void;
120+
121+
/** Set loading state directly */
122+
setLoading: (loading: boolean) => void;
123+
118124
/** Stop loading with error */
119125
setError: (error: Error) => void;
120126

stories/Introduction.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Welcome to **Premium React Loaders** - a comprehensive collection of production-
88

99
## Features
1010

11-
- **28 Premium Components** across 7 categories
11+
- **29 Premium Components** across 8 categories
1212
- **Full TypeScript Support** with exported type definitions
1313
- **Zero Configuration** - no Tailwind or build setup required
1414
- **Tree-shakeable** - only bundle what you use
@@ -67,6 +67,10 @@ Animated success and error indicators:
6767
Full-screen or container-relative loader overlays:
6868
- LoaderOverlay
6969

70+
### Transition (1 component) ✨ New in v2.3.0
71+
Smooth transitions between loading and loaded states:
72+
- LoaderTransition (with fade, slide, scale animations)
73+
7074
## Installation
7175

7276
```bash

0 commit comments

Comments
 (0)