@umituz/react-native-loading 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ümit UZ
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # @umituz/react-native-loading
2
+
3
+ Loading states and animations for React Native apps with breathing animations, skeleton loaders, and state management hooks.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @umituz/react-native-loading
9
+ ```
10
+
11
+ ## Peer Dependencies
12
+
13
+ - `react` >= 18.2.0
14
+ - `react-native` >= 0.74.0
15
+ - `@umituz/react-native-design-system` >= 1.5.0
16
+
17
+ ## Features
18
+
19
+ - ✅ Breathing animation loading state (meditation-inspired)
20
+ - ✅ Skeleton loaders with shimmer effect
21
+ - ✅ Loading state management hooks
22
+ - ✅ App-specific emoji presets
23
+ - ✅ Configurable sizes and patterns
24
+
25
+ ## Usage
26
+
27
+ ### Basic Loading State
28
+
29
+ ```typescript
30
+ import { LoadingState, useLoading } from '@umituz/react-native-loading';
31
+
32
+ const MyScreen = () => {
33
+ const { isLoading, startLoading, stopLoading } = useLoading();
34
+
35
+ return (
36
+ <View>
37
+ {isLoading ? (
38
+ <LoadingState message="Loading..." />
39
+ ) : (
40
+ <Content />
41
+ )}
42
+ </View>
43
+ );
44
+ };
45
+ ```
46
+
47
+ ### Skeleton Loader
48
+
49
+ ```typescript
50
+ import { SkeletonLoader, useLoading } from '@umituz/react-native-loading';
51
+
52
+ const ListScreen = () => {
53
+ const { isLoading } = useLoading();
54
+
55
+ return (
56
+ <View>
57
+ {isLoading ? (
58
+ <SkeletonLoader pattern="list" count={5} />
59
+ ) : (
60
+ <FlatList data={data} />
61
+ )}
62
+ </View>
63
+ );
64
+ };
65
+ ```
66
+
67
+ ### With Async Wrapper
68
+
69
+ ```typescript
70
+ import { LoadingState, useLoading } from '@umituz/react-native-loading';
71
+
72
+ const DataScreen = () => {
73
+ const { isLoading, loadingMessage, withLoading } = useLoading();
74
+
75
+ const loadData = () => withLoading(
76
+ fetchData(),
77
+ 'Loading data...'
78
+ );
79
+
80
+ return (
81
+ <View>
82
+ {isLoading && <LoadingState message={loadingMessage} />}
83
+ <Button onPress={loadData}>Load</Button>
84
+ </View>
85
+ );
86
+ };
87
+ ```
88
+
89
+ ## API
90
+
91
+ ### Components
92
+
93
+ - `LoadingState`: Main loading component with breathing animation
94
+ - `SkeletonLoader`: Skeleton loader with shimmer effect
95
+
96
+ ### Hooks
97
+
98
+ - `useLoading()`: Main loading state management hook
99
+ - `useSimpleLoading()`: Simplified loading hook
100
+
101
+ ### Utilities
102
+
103
+ - `LOADING_EMOJIS`: App-specific emoji presets
104
+ - `SIZE_CONFIGS`: Size configuration presets
105
+ - `SKELETON_PATTERNS`: Skeleton loader patterns
106
+ - `LoadingUtils`: Utility functions for loading states
107
+
108
+ ## License
109
+
110
+ MIT
111
+
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Loading Domain - Entity Definitions
3
+ *
4
+ * Core types and interfaces for loading states and animations.
5
+ * Provides consistent loading UX across all apps.
6
+ *
7
+ * @domain loading
8
+ * @layer domain/entities
9
+ */
10
+ /**
11
+ * Loading animation type
12
+ */
13
+ export type LoadingType = 'pulse' | 'spinner' | 'dots' | 'skeleton';
14
+ /**
15
+ * Loading size preset
16
+ */
17
+ export type LoadingSize = 'small' | 'medium' | 'large';
18
+ /**
19
+ * Skeleton loader pattern
20
+ */
21
+ export type SkeletonPattern = 'list' | 'card' | 'profile' | 'text' | 'custom';
22
+ /**
23
+ * Loading configuration
24
+ */
25
+ export interface LoadingConfig {
26
+ /** Animation type */
27
+ type: LoadingType;
28
+ /** Size preset */
29
+ size: LoadingSize;
30
+ /** Loading emoji (customizable per app) */
31
+ emoji?: string;
32
+ /** Loading message */
33
+ message?: string;
34
+ /** Full screen mode */
35
+ fullScreen?: boolean;
36
+ }
37
+ /**
38
+ * Size configuration for each preset
39
+ */
40
+ export interface SizeConfig {
41
+ emojiSize: number;
42
+ showMessage: boolean;
43
+ spacing: number;
44
+ }
45
+ /**
46
+ * Skeleton loader configuration
47
+ */
48
+ export interface SkeletonConfig {
49
+ width?: number | string;
50
+ height?: number;
51
+ borderRadius?: number;
52
+ marginBottom?: number;
53
+ }
54
+ /**
55
+ * Animation timing configuration
56
+ */
57
+ export interface AnimationConfig {
58
+ duration: number;
59
+ toValue: number;
60
+ easing?: 'linear' | 'ease' | 'easeIn' | 'easeOut' | 'easeInOut';
61
+ }
62
+ /**
63
+ * Size configurations for loading states
64
+ */
65
+ export declare const SIZE_CONFIGS: Record<LoadingSize, SizeConfig>;
66
+ /**
67
+ * App-specific emoji presets
68
+ * Apps can override the default emoji based on their theme
69
+ */
70
+ export declare const LOADING_EMOJIS: {
71
+ readonly meditation: "🧘";
72
+ readonly fitness: "💪";
73
+ readonly workout: "🏋️";
74
+ readonly running: "🏃";
75
+ readonly cycling: "🚴";
76
+ readonly yoga: "🧘‍♀️";
77
+ readonly health: "🏥";
78
+ readonly nutrition: "🥗";
79
+ readonly productivity: "⏳";
80
+ readonly education: "📚";
81
+ readonly reading: "📖";
82
+ readonly music: "🎵";
83
+ readonly art: "🎨";
84
+ readonly travel: "✈️";
85
+ readonly finance: "💰";
86
+ readonly shopping: "🛍️";
87
+ readonly cooking: "👨‍🍳";
88
+ readonly gaming: "🎮";
89
+ readonly default: "⌛";
90
+ };
91
+ /**
92
+ * Animation configurations
93
+ */
94
+ export declare const ANIMATION_CONFIGS: {
95
+ readonly pulse: {
96
+ readonly duration: 1000;
97
+ readonly toValue: 1.15;
98
+ readonly easing: "easeInOut";
99
+ };
100
+ readonly spinner: {
101
+ readonly duration: 1000;
102
+ readonly toValue: 360;
103
+ readonly easing: "linear";
104
+ };
105
+ readonly dots: {
106
+ readonly duration: 500;
107
+ readonly toValue: 1;
108
+ readonly easing: "easeInOut";
109
+ };
110
+ readonly skeleton: {
111
+ readonly duration: 1200;
112
+ readonly toValue: 1;
113
+ readonly easing: "linear";
114
+ };
115
+ };
116
+ /**
117
+ * Skeleton pattern configurations
118
+ */
119
+ export declare const SKELETON_PATTERNS: Record<SkeletonPattern, SkeletonConfig[]>;
120
+ /**
121
+ * Loading utility class
122
+ */
123
+ export declare class LoadingUtils {
124
+ /**
125
+ * Get emoji for app category
126
+ */
127
+ static getEmojiForCategory(category: string): string;
128
+ /**
129
+ * Get default loading config
130
+ */
131
+ static getDefaultConfig(overrides?: Partial<LoadingConfig>): LoadingConfig;
132
+ /**
133
+ * Get size config
134
+ */
135
+ static getSizeConfig(size: LoadingSize): SizeConfig;
136
+ /**
137
+ * Get animation config
138
+ */
139
+ static getAnimationConfig(type: LoadingType): AnimationConfig;
140
+ /**
141
+ * Get skeleton pattern
142
+ */
143
+ static getSkeletonPattern(pattern: SkeletonPattern): SkeletonConfig[];
144
+ /**
145
+ * Validate loading config
146
+ */
147
+ static validateConfig(config: Partial<LoadingConfig>): LoadingConfig;
148
+ }
149
+ /**
150
+ * Loading constants
151
+ */
152
+ export declare const LOADING_CONSTANTS: {
153
+ readonly DEFAULT_TYPE: LoadingType;
154
+ readonly DEFAULT_SIZE: LoadingSize;
155
+ readonly DEFAULT_EMOJI: "⌛";
156
+ readonly BREATHING_CYCLE_DURATION: 2000;
157
+ readonly SPINNER_ROTATION_DURATION: 1000;
158
+ readonly DOTS_WAVE_DURATION: 1500;
159
+ readonly SKELETON_SHIMMER_DURATION: 1200;
160
+ };
161
+ //# sourceMappingURL=Loading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/Loading.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,WAAW,CAAC;IAClB,kBAAkB;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;I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AACH,eAAO,MAAM,iBAAiB;2BACH,WAAW;2BACX,WAAW;;;;;;CAM5B,CAAC"}
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Loading Domain - Entity Definitions
3
+ *
4
+ * Core types and interfaces for loading states and animations.
5
+ * Provides consistent loading UX across all apps.
6
+ *
7
+ * @domain loading
8
+ * @layer domain/entities
9
+ */
10
+ /**
11
+ * Size configurations for loading states
12
+ */
13
+ export const SIZE_CONFIGS = {
14
+ small: {
15
+ emojiSize: 32,
16
+ showMessage: false,
17
+ spacing: 8,
18
+ },
19
+ medium: {
20
+ emojiSize: 48,
21
+ showMessage: true,
22
+ spacing: 12,
23
+ },
24
+ large: {
25
+ emojiSize: 64,
26
+ showMessage: true,
27
+ spacing: 16,
28
+ },
29
+ };
30
+ /**
31
+ * App-specific emoji presets
32
+ * Apps can override the default emoji based on their theme
33
+ */
34
+ export const LOADING_EMOJIS = {
35
+ meditation: '🧘',
36
+ fitness: '💪',
37
+ workout: '🏋️',
38
+ running: '🏃',
39
+ cycling: '🚴',
40
+ yoga: '🧘‍♀️',
41
+ health: '🏥',
42
+ nutrition: '🥗',
43
+ productivity: '⏳',
44
+ education: '📚',
45
+ reading: '📖',
46
+ music: '🎵',
47
+ art: '🎨',
48
+ travel: '✈️',
49
+ finance: '💰',
50
+ shopping: '🛍️',
51
+ cooking: '👨‍🍳',
52
+ gaming: '🎮',
53
+ default: '⌛',
54
+ };
55
+ /**
56
+ * Animation configurations
57
+ */
58
+ export const ANIMATION_CONFIGS = {
59
+ pulse: {
60
+ duration: 1000,
61
+ toValue: 1.15,
62
+ easing: 'easeInOut',
63
+ },
64
+ spinner: {
65
+ duration: 1000,
66
+ toValue: 360,
67
+ easing: 'linear',
68
+ },
69
+ dots: {
70
+ duration: 500,
71
+ toValue: 1,
72
+ easing: 'easeInOut',
73
+ },
74
+ skeleton: {
75
+ duration: 1200,
76
+ toValue: 1,
77
+ easing: 'linear',
78
+ },
79
+ };
80
+ /**
81
+ * Skeleton pattern configurations
82
+ */
83
+ export const SKELETON_PATTERNS = {
84
+ list: [
85
+ { width: '100%', height: 60, borderRadius: 8, marginBottom: 12 },
86
+ ],
87
+ card: [
88
+ { width: '100%', height: 200, borderRadius: 12, marginBottom: 16 },
89
+ { width: '80%', height: 20, borderRadius: 4, marginBottom: 8 },
90
+ { width: '60%', height: 16, borderRadius: 4, marginBottom: 0 },
91
+ ],
92
+ profile: [
93
+ { width: 80, height: 80, borderRadius: 40, marginBottom: 16 },
94
+ { width: '60%', height: 24, borderRadius: 4, marginBottom: 8 },
95
+ { width: '40%', height: 16, borderRadius: 4, marginBottom: 0 },
96
+ ],
97
+ text: [
98
+ { width: '100%', height: 16, borderRadius: 4, marginBottom: 8 },
99
+ { width: '90%', height: 16, borderRadius: 4, marginBottom: 8 },
100
+ { width: '95%', height: 16, borderRadius: 4, marginBottom: 0 },
101
+ ],
102
+ custom: [],
103
+ };
104
+ /**
105
+ * Loading utility class
106
+ */
107
+ export class LoadingUtils {
108
+ /**
109
+ * Get emoji for app category
110
+ */
111
+ static getEmojiForCategory(category) {
112
+ const normalizedCategory = category.toLowerCase();
113
+ if (normalizedCategory.includes('meditation') || normalizedCategory.includes('mindfulness')) {
114
+ return LOADING_EMOJIS.meditation;
115
+ }
116
+ if (normalizedCategory.includes('fitness') || normalizedCategory.includes('gym')) {
117
+ return LOADING_EMOJIS.fitness;
118
+ }
119
+ if (normalizedCategory.includes('workout')) {
120
+ return LOADING_EMOJIS.workout;
121
+ }
122
+ if (normalizedCategory.includes('running') || normalizedCategory.includes('run')) {
123
+ return LOADING_EMOJIS.running;
124
+ }
125
+ if (normalizedCategory.includes('cycling') || normalizedCategory.includes('bike')) {
126
+ return LOADING_EMOJIS.cycling;
127
+ }
128
+ if (normalizedCategory.includes('yoga')) {
129
+ return LOADING_EMOJIS.yoga;
130
+ }
131
+ if (normalizedCategory.includes('health') || normalizedCategory.includes('medical')) {
132
+ return LOADING_EMOJIS.health;
133
+ }
134
+ if (normalizedCategory.includes('nutrition') || normalizedCategory.includes('diet')) {
135
+ return LOADING_EMOJIS.nutrition;
136
+ }
137
+ if (normalizedCategory.includes('productivity') || normalizedCategory.includes('task')) {
138
+ return LOADING_EMOJIS.productivity;
139
+ }
140
+ if (normalizedCategory.includes('education') || normalizedCategory.includes('learn')) {
141
+ return LOADING_EMOJIS.education;
142
+ }
143
+ if (normalizedCategory.includes('reading') || normalizedCategory.includes('book')) {
144
+ return LOADING_EMOJIS.reading;
145
+ }
146
+ if (normalizedCategory.includes('music') || normalizedCategory.includes('audio')) {
147
+ return LOADING_EMOJIS.music;
148
+ }
149
+ if (normalizedCategory.includes('art') || normalizedCategory.includes('creative')) {
150
+ return LOADING_EMOJIS.art;
151
+ }
152
+ if (normalizedCategory.includes('travel') || normalizedCategory.includes('trip')) {
153
+ return LOADING_EMOJIS.travel;
154
+ }
155
+ if (normalizedCategory.includes('finance') || normalizedCategory.includes('money')) {
156
+ return LOADING_EMOJIS.finance;
157
+ }
158
+ if (normalizedCategory.includes('shopping') || normalizedCategory.includes('shop')) {
159
+ return LOADING_EMOJIS.shopping;
160
+ }
161
+ if (normalizedCategory.includes('cooking') || normalizedCategory.includes('recipe')) {
162
+ return LOADING_EMOJIS.cooking;
163
+ }
164
+ if (normalizedCategory.includes('gaming') || normalizedCategory.includes('game')) {
165
+ return LOADING_EMOJIS.gaming;
166
+ }
167
+ return LOADING_EMOJIS.default;
168
+ }
169
+ /**
170
+ * Get default loading config
171
+ */
172
+ static getDefaultConfig(overrides) {
173
+ return {
174
+ type: 'pulse',
175
+ size: 'large',
176
+ emoji: LOADING_EMOJIS.default,
177
+ fullScreen: false,
178
+ ...overrides,
179
+ };
180
+ }
181
+ /**
182
+ * Get size config
183
+ */
184
+ static getSizeConfig(size) {
185
+ return SIZE_CONFIGS[size];
186
+ }
187
+ /**
188
+ * Get animation config
189
+ */
190
+ static getAnimationConfig(type) {
191
+ return ANIMATION_CONFIGS[type];
192
+ }
193
+ /**
194
+ * Get skeleton pattern
195
+ */
196
+ static getSkeletonPattern(pattern) {
197
+ return SKELETON_PATTERNS[pattern];
198
+ }
199
+ /**
200
+ * Validate loading config
201
+ */
202
+ static validateConfig(config) {
203
+ return {
204
+ type: config.type || 'pulse',
205
+ size: config.size || 'large',
206
+ emoji: config.emoji || LOADING_EMOJIS.default,
207
+ message: config.message,
208
+ fullScreen: config.fullScreen ?? false,
209
+ };
210
+ }
211
+ }
212
+ /**
213
+ * Loading constants
214
+ */
215
+ export const LOADING_CONSTANTS = {
216
+ DEFAULT_TYPE: 'pulse',
217
+ DEFAULT_SIZE: 'large',
218
+ DEFAULT_EMOJI: LOADING_EMOJIS.default,
219
+ BREATHING_CYCLE_DURATION: 2000, // 2 seconds (inhale + exhale)
220
+ SPINNER_ROTATION_DURATION: 1000, // 1 second
221
+ DOTS_WAVE_DURATION: 1500, // 1.5 seconds
222
+ SKELETON_SHIMMER_DURATION: 1200, // 1.2 seconds
223
+ };
224
+ //# sourceMappingURL=Loading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loading.js","sourceRoot":"","sources":["../../../src/domain/entities/Loading.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6DH;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAoC;IAC3D,KAAK,EAAE;QACL,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,EAAE;QACN,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,EAAE;KACZ;IACD,KAAK,EAAE;QACL,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,EAAE;KACZ;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,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/index.d.ts ADDED
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Loading Domain - Barrel Export
3
+ *
4
+ * Public API for the loading domain.
5
+ * Provides consistent loading states and animations across all apps.
6
+ *
7
+ * Features:
8
+ * - Breathing animation loading state (meditation-inspired)
9
+ * - Skeleton loaders with shimmer effect
10
+ * - Loading state management hooks
11
+ * - App-specific emoji presets
12
+ * - Configurable sizes and patterns
13
+ *
14
+ * Usage:
15
+ * ```tsx
16
+ * import {
17
+ * LoadingState,
18
+ * SkeletonLoader,
19
+ * useLoading,
20
+ * LOADING_EMOJIS,
21
+ * } from '@umituz/react-native-loading';
22
+ *
23
+ * // Basic loading state
24
+ * const MyScreen = () => {
25
+ * const { isLoading, startLoading, stopLoading } = useLoading();
26
+ *
27
+ * return (
28
+ * <View>
29
+ * {isLoading ? (
30
+ * <LoadingState message="Loading..." />
31
+ * ) : (
32
+ * <Content />
33
+ * )}
34
+ * </View>
35
+ * );
36
+ * };
37
+ *
38
+ * // Skeleton loader for lists
39
+ * const ListScreen = () => {
40
+ * const [data, setData] = useState([]);
41
+ * const { isLoading } = useLoading();
42
+ *
43
+ * return (
44
+ * <View>
45
+ * {isLoading ? (
46
+ * <SkeletonLoader pattern="list" count={5} />
47
+ * ) : (
48
+ * <FlatList data={data} ... />
49
+ * )}
50
+ * </View>
51
+ * );
52
+ * };
53
+ *
54
+ * // With async wrapper
55
+ * const DataScreen = () => {
56
+ * const { isLoading, loadingMessage, withLoading } = useLoading();
57
+ *
58
+ * const loadData = () => withLoading(
59
+ * fetchData(),
60
+ * 'Loading data...'
61
+ * );
62
+ *
63
+ * return (
64
+ * <View>
65
+ * {isLoading && <LoadingState message={loadingMessage} />}
66
+ * <Button onPress={loadData}>Load</Button>
67
+ * </View>
68
+ * );
69
+ * };
70
+ *
71
+ * // Custom emoji per app
72
+ * const FitnessLoadingScreen = () => (
73
+ * <LoadingState
74
+ * emoji={LOADING_EMOJIS.fitness}
75
+ * message="Loading workouts..."
76
+ * />
77
+ * );
78
+ * ```
79
+ */
80
+ export type { LoadingType, LoadingSize, SkeletonPattern, LoadingConfig, SizeConfig, SkeletonConfig, AnimationConfig, } from './domain/entities/Loading';
81
+ export { SIZE_CONFIGS, LOADING_EMOJIS, ANIMATION_CONFIGS, SKELETON_PATTERNS, LoadingUtils, LOADING_CONSTANTS, } from './domain/entities/Loading';
82
+ export { LoadingState, type LoadingStateProps, } from './presentation/components/LoadingState';
83
+ export { SkeletonLoader, type SkeletonLoaderProps, } from './presentation/components/SkeletonLoader';
84
+ export { useLoading, useSimpleLoading, type UseLoadingReturn, } from './presentation/hooks/useLoading';
85
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AAGH,YAAY,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,GAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,KAAK,gBAAgB,GACtB,MAAM,iCAAiC,CAAC"}