@rubenpazch/loading-spinner 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/README.md +3 -0
- package/dist/LoadingSpinner.d.ts +20 -0
- package/dist/LoadingSpinner.d.ts.map +1 -0
- package/dist/index.cjs.js +488 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +486 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface LoadingSpinnerProps {
|
|
3
|
+
message?: string;
|
|
4
|
+
size?: "sm" | "md" | "lg";
|
|
5
|
+
className?: string;
|
|
6
|
+
variant?: "spinner" | "dots" | "pulse" | "ring";
|
|
7
|
+
inline?: boolean;
|
|
8
|
+
color?: "blue" | "gray" | "white";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* LoadingSpinner component
|
|
12
|
+
* Displays a loading indicator with multiple style variants
|
|
13
|
+
*
|
|
14
|
+
* @param variant - 'spinner' (default circular spinner), 'dots' (three bouncing dots), 'pulse' (pulsing circle), 'ring' (rotating ring)
|
|
15
|
+
* @param inline - If true, removes centering and margins for inline use (e.g., in buttons or inputs)
|
|
16
|
+
* @param color - Color scheme: 'blue' (default), 'gray', 'white'
|
|
17
|
+
*/
|
|
18
|
+
declare const LoadingSpinner: React.FC<LoadingSpinnerProps>;
|
|
19
|
+
export default LoadingSpinner;
|
|
20
|
+
//# sourceMappingURL=LoadingSpinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingSpinner.d.ts","sourceRoot":"","sources":["../src/LoadingSpinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,UAAU,mBAAmB;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAChD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA2IjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var require$$0 = require('react');
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = {exports: {}};
|
|
6
|
+
|
|
7
|
+
var reactJsxRuntime_production = {};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
var hasRequiredReactJsxRuntime_production;
|
|
20
|
+
|
|
21
|
+
function requireReactJsxRuntime_production () {
|
|
22
|
+
if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
|
|
23
|
+
hasRequiredReactJsxRuntime_production = 1;
|
|
24
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
25
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
26
|
+
function jsxProd(type, config, maybeKey) {
|
|
27
|
+
var key = null;
|
|
28
|
+
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
29
|
+
void 0 !== config.key && (key = "" + config.key);
|
|
30
|
+
if ("key" in config) {
|
|
31
|
+
maybeKey = {};
|
|
32
|
+
for (var propName in config)
|
|
33
|
+
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
34
|
+
} else maybeKey = config;
|
|
35
|
+
config = maybeKey.ref;
|
|
36
|
+
return {
|
|
37
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
38
|
+
type: type,
|
|
39
|
+
key: key,
|
|
40
|
+
ref: void 0 !== config ? config : null,
|
|
41
|
+
props: maybeKey
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
45
|
+
reactJsxRuntime_production.jsx = jsxProd;
|
|
46
|
+
reactJsxRuntime_production.jsxs = jsxProd;
|
|
47
|
+
return reactJsxRuntime_production;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var reactJsxRuntime_development = {};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @license React
|
|
54
|
+
* react-jsx-runtime.development.js
|
|
55
|
+
*
|
|
56
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the MIT license found in the
|
|
59
|
+
* LICENSE file in the root directory of this source tree.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
var hasRequiredReactJsxRuntime_development;
|
|
63
|
+
|
|
64
|
+
function requireReactJsxRuntime_development () {
|
|
65
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
66
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
67
|
+
"production" !== process.env.NODE_ENV &&
|
|
68
|
+
(function () {
|
|
69
|
+
function getComponentNameFromType(type) {
|
|
70
|
+
if (null == type) return null;
|
|
71
|
+
if ("function" === typeof type)
|
|
72
|
+
return type.$$typeof === REACT_CLIENT_REFERENCE
|
|
73
|
+
? null
|
|
74
|
+
: type.displayName || type.name || null;
|
|
75
|
+
if ("string" === typeof type) return type;
|
|
76
|
+
switch (type) {
|
|
77
|
+
case REACT_FRAGMENT_TYPE:
|
|
78
|
+
return "Fragment";
|
|
79
|
+
case REACT_PROFILER_TYPE:
|
|
80
|
+
return "Profiler";
|
|
81
|
+
case REACT_STRICT_MODE_TYPE:
|
|
82
|
+
return "StrictMode";
|
|
83
|
+
case REACT_SUSPENSE_TYPE:
|
|
84
|
+
return "Suspense";
|
|
85
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
86
|
+
return "SuspenseList";
|
|
87
|
+
case REACT_ACTIVITY_TYPE:
|
|
88
|
+
return "Activity";
|
|
89
|
+
}
|
|
90
|
+
if ("object" === typeof type)
|
|
91
|
+
switch (
|
|
92
|
+
("number" === typeof type.tag &&
|
|
93
|
+
console.error(
|
|
94
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
95
|
+
),
|
|
96
|
+
type.$$typeof)
|
|
97
|
+
) {
|
|
98
|
+
case REACT_PORTAL_TYPE:
|
|
99
|
+
return "Portal";
|
|
100
|
+
case REACT_CONTEXT_TYPE:
|
|
101
|
+
return type.displayName || "Context";
|
|
102
|
+
case REACT_CONSUMER_TYPE:
|
|
103
|
+
return (type._context.displayName || "Context") + ".Consumer";
|
|
104
|
+
case REACT_FORWARD_REF_TYPE:
|
|
105
|
+
var innerType = type.render;
|
|
106
|
+
type = type.displayName;
|
|
107
|
+
type ||
|
|
108
|
+
((type = innerType.displayName || innerType.name || ""),
|
|
109
|
+
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
|
|
110
|
+
return type;
|
|
111
|
+
case REACT_MEMO_TYPE:
|
|
112
|
+
return (
|
|
113
|
+
(innerType = type.displayName || null),
|
|
114
|
+
null !== innerType
|
|
115
|
+
? innerType
|
|
116
|
+
: getComponentNameFromType(type.type) || "Memo"
|
|
117
|
+
);
|
|
118
|
+
case REACT_LAZY_TYPE:
|
|
119
|
+
innerType = type._payload;
|
|
120
|
+
type = type._init;
|
|
121
|
+
try {
|
|
122
|
+
return getComponentNameFromType(type(innerType));
|
|
123
|
+
} catch (x) {}
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
function testStringCoercion(value) {
|
|
128
|
+
return "" + value;
|
|
129
|
+
}
|
|
130
|
+
function checkKeyStringCoercion(value) {
|
|
131
|
+
try {
|
|
132
|
+
testStringCoercion(value);
|
|
133
|
+
var JSCompiler_inline_result = !1;
|
|
134
|
+
} catch (e) {
|
|
135
|
+
JSCompiler_inline_result = true;
|
|
136
|
+
}
|
|
137
|
+
if (JSCompiler_inline_result) {
|
|
138
|
+
JSCompiler_inline_result = console;
|
|
139
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
140
|
+
var JSCompiler_inline_result$jscomp$0 =
|
|
141
|
+
("function" === typeof Symbol &&
|
|
142
|
+
Symbol.toStringTag &&
|
|
143
|
+
value[Symbol.toStringTag]) ||
|
|
144
|
+
value.constructor.name ||
|
|
145
|
+
"Object";
|
|
146
|
+
JSCompiler_temp_const.call(
|
|
147
|
+
JSCompiler_inline_result,
|
|
148
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
149
|
+
JSCompiler_inline_result$jscomp$0
|
|
150
|
+
);
|
|
151
|
+
return testStringCoercion(value);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function getTaskName(type) {
|
|
155
|
+
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
156
|
+
if (
|
|
157
|
+
"object" === typeof type &&
|
|
158
|
+
null !== type &&
|
|
159
|
+
type.$$typeof === REACT_LAZY_TYPE
|
|
160
|
+
)
|
|
161
|
+
return "<...>";
|
|
162
|
+
try {
|
|
163
|
+
var name = getComponentNameFromType(type);
|
|
164
|
+
return name ? "<" + name + ">" : "<...>";
|
|
165
|
+
} catch (x) {
|
|
166
|
+
return "<...>";
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function getOwner() {
|
|
170
|
+
var dispatcher = ReactSharedInternals.A;
|
|
171
|
+
return null === dispatcher ? null : dispatcher.getOwner();
|
|
172
|
+
}
|
|
173
|
+
function UnknownOwner() {
|
|
174
|
+
return Error("react-stack-top-frame");
|
|
175
|
+
}
|
|
176
|
+
function hasValidKey(config) {
|
|
177
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
178
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
179
|
+
if (getter && getter.isReactWarning) return false;
|
|
180
|
+
}
|
|
181
|
+
return void 0 !== config.key;
|
|
182
|
+
}
|
|
183
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
184
|
+
function warnAboutAccessingKey() {
|
|
185
|
+
specialPropKeyWarningShown ||
|
|
186
|
+
((specialPropKeyWarningShown = true),
|
|
187
|
+
console.error(
|
|
188
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
189
|
+
displayName
|
|
190
|
+
));
|
|
191
|
+
}
|
|
192
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
193
|
+
Object.defineProperty(props, "key", {
|
|
194
|
+
get: warnAboutAccessingKey,
|
|
195
|
+
configurable: true
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
199
|
+
var componentName = getComponentNameFromType(this.type);
|
|
200
|
+
didWarnAboutElementRef[componentName] ||
|
|
201
|
+
((didWarnAboutElementRef[componentName] = true),
|
|
202
|
+
console.error(
|
|
203
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
204
|
+
));
|
|
205
|
+
componentName = this.props.ref;
|
|
206
|
+
return void 0 !== componentName ? componentName : null;
|
|
207
|
+
}
|
|
208
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
209
|
+
var refProp = props.ref;
|
|
210
|
+
type = {
|
|
211
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
212
|
+
type: type,
|
|
213
|
+
key: key,
|
|
214
|
+
props: props,
|
|
215
|
+
_owner: owner
|
|
216
|
+
};
|
|
217
|
+
null !== (void 0 !== refProp ? refProp : null)
|
|
218
|
+
? Object.defineProperty(type, "ref", {
|
|
219
|
+
enumerable: false,
|
|
220
|
+
get: elementRefGetterWithDeprecationWarning
|
|
221
|
+
})
|
|
222
|
+
: Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
223
|
+
type._store = {};
|
|
224
|
+
Object.defineProperty(type._store, "validated", {
|
|
225
|
+
configurable: false,
|
|
226
|
+
enumerable: false,
|
|
227
|
+
writable: true,
|
|
228
|
+
value: 0
|
|
229
|
+
});
|
|
230
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
231
|
+
configurable: false,
|
|
232
|
+
enumerable: false,
|
|
233
|
+
writable: true,
|
|
234
|
+
value: null
|
|
235
|
+
});
|
|
236
|
+
Object.defineProperty(type, "_debugStack", {
|
|
237
|
+
configurable: false,
|
|
238
|
+
enumerable: false,
|
|
239
|
+
writable: true,
|
|
240
|
+
value: debugStack
|
|
241
|
+
});
|
|
242
|
+
Object.defineProperty(type, "_debugTask", {
|
|
243
|
+
configurable: false,
|
|
244
|
+
enumerable: false,
|
|
245
|
+
writable: true,
|
|
246
|
+
value: debugTask
|
|
247
|
+
});
|
|
248
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
249
|
+
return type;
|
|
250
|
+
}
|
|
251
|
+
function jsxDEVImpl(
|
|
252
|
+
type,
|
|
253
|
+
config,
|
|
254
|
+
maybeKey,
|
|
255
|
+
isStaticChildren,
|
|
256
|
+
debugStack,
|
|
257
|
+
debugTask
|
|
258
|
+
) {
|
|
259
|
+
var children = config.children;
|
|
260
|
+
if (void 0 !== children)
|
|
261
|
+
if (isStaticChildren)
|
|
262
|
+
if (isArrayImpl(children)) {
|
|
263
|
+
for (
|
|
264
|
+
isStaticChildren = 0;
|
|
265
|
+
isStaticChildren < children.length;
|
|
266
|
+
isStaticChildren++
|
|
267
|
+
)
|
|
268
|
+
validateChildKeys(children[isStaticChildren]);
|
|
269
|
+
Object.freeze && Object.freeze(children);
|
|
270
|
+
} else
|
|
271
|
+
console.error(
|
|
272
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
273
|
+
);
|
|
274
|
+
else validateChildKeys(children);
|
|
275
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
276
|
+
children = getComponentNameFromType(type);
|
|
277
|
+
var keys = Object.keys(config).filter(function (k) {
|
|
278
|
+
return "key" !== k;
|
|
279
|
+
});
|
|
280
|
+
isStaticChildren =
|
|
281
|
+
0 < keys.length
|
|
282
|
+
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
|
|
283
|
+
: "{key: someKey}";
|
|
284
|
+
didWarnAboutKeySpread[children + isStaticChildren] ||
|
|
285
|
+
((keys =
|
|
286
|
+
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
|
|
287
|
+
console.error(
|
|
288
|
+
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
289
|
+
isStaticChildren,
|
|
290
|
+
children,
|
|
291
|
+
keys,
|
|
292
|
+
children
|
|
293
|
+
),
|
|
294
|
+
(didWarnAboutKeySpread[children + isStaticChildren] = true));
|
|
295
|
+
}
|
|
296
|
+
children = null;
|
|
297
|
+
void 0 !== maybeKey &&
|
|
298
|
+
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
|
|
299
|
+
hasValidKey(config) &&
|
|
300
|
+
(checkKeyStringCoercion(config.key), (children = "" + config.key));
|
|
301
|
+
if ("key" in config) {
|
|
302
|
+
maybeKey = {};
|
|
303
|
+
for (var propName in config)
|
|
304
|
+
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
305
|
+
} else maybeKey = config;
|
|
306
|
+
children &&
|
|
307
|
+
defineKeyPropWarningGetter(
|
|
308
|
+
maybeKey,
|
|
309
|
+
"function" === typeof type
|
|
310
|
+
? type.displayName || type.name || "Unknown"
|
|
311
|
+
: type
|
|
312
|
+
);
|
|
313
|
+
return ReactElement(
|
|
314
|
+
type,
|
|
315
|
+
children,
|
|
316
|
+
maybeKey,
|
|
317
|
+
getOwner(),
|
|
318
|
+
debugStack,
|
|
319
|
+
debugTask
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
function validateChildKeys(node) {
|
|
323
|
+
isValidElement(node)
|
|
324
|
+
? node._store && (node._store.validated = 1)
|
|
325
|
+
: "object" === typeof node &&
|
|
326
|
+
null !== node &&
|
|
327
|
+
node.$$typeof === REACT_LAZY_TYPE &&
|
|
328
|
+
("fulfilled" === node._payload.status
|
|
329
|
+
? isValidElement(node._payload.value) &&
|
|
330
|
+
node._payload.value._store &&
|
|
331
|
+
(node._payload.value._store.validated = 1)
|
|
332
|
+
: node._store && (node._store.validated = 1));
|
|
333
|
+
}
|
|
334
|
+
function isValidElement(object) {
|
|
335
|
+
return (
|
|
336
|
+
"object" === typeof object &&
|
|
337
|
+
null !== object &&
|
|
338
|
+
object.$$typeof === REACT_ELEMENT_TYPE
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
var React = require$$0,
|
|
342
|
+
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
343
|
+
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
344
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
345
|
+
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
346
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
347
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
348
|
+
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
349
|
+
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
350
|
+
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
351
|
+
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
352
|
+
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
353
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
354
|
+
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
|
|
355
|
+
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
|
|
356
|
+
ReactSharedInternals =
|
|
357
|
+
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
358
|
+
hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
359
|
+
isArrayImpl = Array.isArray,
|
|
360
|
+
createTask = console.createTask
|
|
361
|
+
? console.createTask
|
|
362
|
+
: function () {
|
|
363
|
+
return null;
|
|
364
|
+
};
|
|
365
|
+
React = {
|
|
366
|
+
react_stack_bottom_frame: function (callStackForError) {
|
|
367
|
+
return callStackForError();
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
var specialPropKeyWarningShown;
|
|
371
|
+
var didWarnAboutElementRef = {};
|
|
372
|
+
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
|
|
373
|
+
React,
|
|
374
|
+
UnknownOwner
|
|
375
|
+
)();
|
|
376
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
377
|
+
var didWarnAboutKeySpread = {};
|
|
378
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
379
|
+
reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
|
|
380
|
+
var trackActualOwner =
|
|
381
|
+
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
382
|
+
return jsxDEVImpl(
|
|
383
|
+
type,
|
|
384
|
+
config,
|
|
385
|
+
maybeKey,
|
|
386
|
+
false,
|
|
387
|
+
trackActualOwner
|
|
388
|
+
? Error("react-stack-top-frame")
|
|
389
|
+
: unknownOwnerDebugStack,
|
|
390
|
+
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
391
|
+
);
|
|
392
|
+
};
|
|
393
|
+
reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
|
|
394
|
+
var trackActualOwner =
|
|
395
|
+
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
396
|
+
return jsxDEVImpl(
|
|
397
|
+
type,
|
|
398
|
+
config,
|
|
399
|
+
maybeKey,
|
|
400
|
+
true,
|
|
401
|
+
trackActualOwner
|
|
402
|
+
? Error("react-stack-top-frame")
|
|
403
|
+
: unknownOwnerDebugStack,
|
|
404
|
+
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
405
|
+
);
|
|
406
|
+
};
|
|
407
|
+
})();
|
|
408
|
+
return reactJsxRuntime_development;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
var hasRequiredJsxRuntime;
|
|
412
|
+
|
|
413
|
+
function requireJsxRuntime () {
|
|
414
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
415
|
+
hasRequiredJsxRuntime = 1;
|
|
416
|
+
|
|
417
|
+
if (process.env.NODE_ENV === 'production') {
|
|
418
|
+
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
419
|
+
} else {
|
|
420
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
421
|
+
}
|
|
422
|
+
return jsxRuntime.exports;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* LoadingSpinner component
|
|
429
|
+
* Displays a loading indicator with multiple style variants
|
|
430
|
+
*
|
|
431
|
+
* @param variant - 'spinner' (default circular spinner), 'dots' (three bouncing dots), 'pulse' (pulsing circle), 'ring' (rotating ring)
|
|
432
|
+
* @param inline - If true, removes centering and margins for inline use (e.g., in buttons or inputs)
|
|
433
|
+
* @param color - Color scheme: 'blue' (default), 'gray', 'white'
|
|
434
|
+
*/
|
|
435
|
+
const LoadingSpinner = ({ message, size = "md", className = "", variant = "spinner", inline = false, color = "blue", }) => {
|
|
436
|
+
const sizeClasses = {
|
|
437
|
+
sm: "h-4 w-4",
|
|
438
|
+
md: "h-8 w-8",
|
|
439
|
+
lg: "h-12 w-12",
|
|
440
|
+
};
|
|
441
|
+
const colorClasses = {
|
|
442
|
+
blue: "border-blue-600",
|
|
443
|
+
gray: "border-gray-600",
|
|
444
|
+
white: "border-white",
|
|
445
|
+
};
|
|
446
|
+
const dotColorClasses = {
|
|
447
|
+
blue: "bg-blue-600",
|
|
448
|
+
gray: "bg-gray-600",
|
|
449
|
+
white: "bg-white",
|
|
450
|
+
};
|
|
451
|
+
const dotSizeClasses = {
|
|
452
|
+
sm: "h-1.5 w-1.5",
|
|
453
|
+
md: "h-2.5 w-2.5",
|
|
454
|
+
lg: "h-3.5 w-3.5",
|
|
455
|
+
};
|
|
456
|
+
// Spinner variant (circular border)
|
|
457
|
+
if (variant === "spinner") {
|
|
458
|
+
return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsx("div", { className: `animate-spin rounded-full border-2 ${colorClasses[color]} ${sizeClasses[size]} ${inline ? "" : "mx-auto mb-4"}`, style: {
|
|
459
|
+
borderTopColor: "transparent",
|
|
460
|
+
borderRightColor: "transparent",
|
|
461
|
+
} }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
|
|
462
|
+
}
|
|
463
|
+
// Dots variant (three bouncing dots)
|
|
464
|
+
if (variant === "dots") {
|
|
465
|
+
return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "flex gap-1" : "text-center", children: [jsxRuntimeExports.jsxs("div", { className: `flex gap-1 ${inline ? "" : "mx-auto mb-4"}`, children: [jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "0ms" } }), jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "150ms" } }), jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "300ms" } })] }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
|
|
466
|
+
}
|
|
467
|
+
// Pulse variant (pulsing circle)
|
|
468
|
+
if (variant === "pulse") {
|
|
469
|
+
return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsx("div", { className: `${sizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-pulse ${inline ? "" : "mx-auto mb-4"}` }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
|
|
470
|
+
}
|
|
471
|
+
// Ring variant (rotating ring with gradient)
|
|
472
|
+
if (variant === "ring") {
|
|
473
|
+
const ringColorMap = {
|
|
474
|
+
blue: "border-blue-600",
|
|
475
|
+
gray: "border-gray-600",
|
|
476
|
+
white: "border-white",
|
|
477
|
+
};
|
|
478
|
+
return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsxs("div", { className: `relative ${sizeClasses[size]} ${inline ? "" : "mx-auto mb-4"}`, children: [jsxRuntimeExports.jsx("div", { className: `absolute inset-0 rounded-full border-2 ${colorClasses[color]} opacity-25` }), jsxRuntimeExports.jsx("div", { className: `absolute inset-0 rounded-full border-2 border-transparent ${ringColorMap[color]} animate-spin`, style: {
|
|
479
|
+
borderTopColor: "currentColor",
|
|
480
|
+
borderRightColor: "transparent",
|
|
481
|
+
borderBottomColor: "transparent",
|
|
482
|
+
borderLeftColor: "transparent",
|
|
483
|
+
} })] }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
|
|
484
|
+
}
|
|
485
|
+
return null;
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
module.exports = LoadingSpinner;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface LoadingSpinnerProps {
|
|
4
|
+
message?: string;
|
|
5
|
+
size?: "sm" | "md" | "lg";
|
|
6
|
+
className?: string;
|
|
7
|
+
variant?: "spinner" | "dots" | "pulse" | "ring";
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
color?: "blue" | "gray" | "white";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* LoadingSpinner component
|
|
13
|
+
* Displays a loading indicator with multiple style variants
|
|
14
|
+
*
|
|
15
|
+
* @param variant - 'spinner' (default circular spinner), 'dots' (three bouncing dots), 'pulse' (pulsing circle), 'ring' (rotating ring)
|
|
16
|
+
* @param inline - If true, removes centering and margins for inline use (e.g., in buttons or inputs)
|
|
17
|
+
* @param color - Color scheme: 'blue' (default), 'gray', 'white'
|
|
18
|
+
*/
|
|
19
|
+
declare const LoadingSpinner: React.FC<LoadingSpinnerProps>;
|
|
20
|
+
//# sourceMappingURL=LoadingSpinner.d.ts.map
|
|
21
|
+
|
|
22
|
+
export { LoadingSpinner as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import require$$0 from 'react';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = {exports: {}};
|
|
4
|
+
|
|
5
|
+
var reactJsxRuntime_production = {};
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license React
|
|
9
|
+
* react-jsx-runtime.production.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var hasRequiredReactJsxRuntime_production;
|
|
18
|
+
|
|
19
|
+
function requireReactJsxRuntime_production () {
|
|
20
|
+
if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
|
|
21
|
+
hasRequiredReactJsxRuntime_production = 1;
|
|
22
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
23
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
24
|
+
function jsxProd(type, config, maybeKey) {
|
|
25
|
+
var key = null;
|
|
26
|
+
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
27
|
+
void 0 !== config.key && (key = "" + config.key);
|
|
28
|
+
if ("key" in config) {
|
|
29
|
+
maybeKey = {};
|
|
30
|
+
for (var propName in config)
|
|
31
|
+
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
32
|
+
} else maybeKey = config;
|
|
33
|
+
config = maybeKey.ref;
|
|
34
|
+
return {
|
|
35
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
36
|
+
type: type,
|
|
37
|
+
key: key,
|
|
38
|
+
ref: void 0 !== config ? config : null,
|
|
39
|
+
props: maybeKey
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
43
|
+
reactJsxRuntime_production.jsx = jsxProd;
|
|
44
|
+
reactJsxRuntime_production.jsxs = jsxProd;
|
|
45
|
+
return reactJsxRuntime_production;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var reactJsxRuntime_development = {};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @license React
|
|
52
|
+
* react-jsx-runtime.development.js
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the MIT license found in the
|
|
57
|
+
* LICENSE file in the root directory of this source tree.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
var hasRequiredReactJsxRuntime_development;
|
|
61
|
+
|
|
62
|
+
function requireReactJsxRuntime_development () {
|
|
63
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
64
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
65
|
+
"production" !== process.env.NODE_ENV &&
|
|
66
|
+
(function () {
|
|
67
|
+
function getComponentNameFromType(type) {
|
|
68
|
+
if (null == type) return null;
|
|
69
|
+
if ("function" === typeof type)
|
|
70
|
+
return type.$$typeof === REACT_CLIENT_REFERENCE
|
|
71
|
+
? null
|
|
72
|
+
: type.displayName || type.name || null;
|
|
73
|
+
if ("string" === typeof type) return type;
|
|
74
|
+
switch (type) {
|
|
75
|
+
case REACT_FRAGMENT_TYPE:
|
|
76
|
+
return "Fragment";
|
|
77
|
+
case REACT_PROFILER_TYPE:
|
|
78
|
+
return "Profiler";
|
|
79
|
+
case REACT_STRICT_MODE_TYPE:
|
|
80
|
+
return "StrictMode";
|
|
81
|
+
case REACT_SUSPENSE_TYPE:
|
|
82
|
+
return "Suspense";
|
|
83
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
84
|
+
return "SuspenseList";
|
|
85
|
+
case REACT_ACTIVITY_TYPE:
|
|
86
|
+
return "Activity";
|
|
87
|
+
}
|
|
88
|
+
if ("object" === typeof type)
|
|
89
|
+
switch (
|
|
90
|
+
("number" === typeof type.tag &&
|
|
91
|
+
console.error(
|
|
92
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
93
|
+
),
|
|
94
|
+
type.$$typeof)
|
|
95
|
+
) {
|
|
96
|
+
case REACT_PORTAL_TYPE:
|
|
97
|
+
return "Portal";
|
|
98
|
+
case REACT_CONTEXT_TYPE:
|
|
99
|
+
return type.displayName || "Context";
|
|
100
|
+
case REACT_CONSUMER_TYPE:
|
|
101
|
+
return (type._context.displayName || "Context") + ".Consumer";
|
|
102
|
+
case REACT_FORWARD_REF_TYPE:
|
|
103
|
+
var innerType = type.render;
|
|
104
|
+
type = type.displayName;
|
|
105
|
+
type ||
|
|
106
|
+
((type = innerType.displayName || innerType.name || ""),
|
|
107
|
+
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
|
|
108
|
+
return type;
|
|
109
|
+
case REACT_MEMO_TYPE:
|
|
110
|
+
return (
|
|
111
|
+
(innerType = type.displayName || null),
|
|
112
|
+
null !== innerType
|
|
113
|
+
? innerType
|
|
114
|
+
: getComponentNameFromType(type.type) || "Memo"
|
|
115
|
+
);
|
|
116
|
+
case REACT_LAZY_TYPE:
|
|
117
|
+
innerType = type._payload;
|
|
118
|
+
type = type._init;
|
|
119
|
+
try {
|
|
120
|
+
return getComponentNameFromType(type(innerType));
|
|
121
|
+
} catch (x) {}
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
function testStringCoercion(value) {
|
|
126
|
+
return "" + value;
|
|
127
|
+
}
|
|
128
|
+
function checkKeyStringCoercion(value) {
|
|
129
|
+
try {
|
|
130
|
+
testStringCoercion(value);
|
|
131
|
+
var JSCompiler_inline_result = !1;
|
|
132
|
+
} catch (e) {
|
|
133
|
+
JSCompiler_inline_result = true;
|
|
134
|
+
}
|
|
135
|
+
if (JSCompiler_inline_result) {
|
|
136
|
+
JSCompiler_inline_result = console;
|
|
137
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
138
|
+
var JSCompiler_inline_result$jscomp$0 =
|
|
139
|
+
("function" === typeof Symbol &&
|
|
140
|
+
Symbol.toStringTag &&
|
|
141
|
+
value[Symbol.toStringTag]) ||
|
|
142
|
+
value.constructor.name ||
|
|
143
|
+
"Object";
|
|
144
|
+
JSCompiler_temp_const.call(
|
|
145
|
+
JSCompiler_inline_result,
|
|
146
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
147
|
+
JSCompiler_inline_result$jscomp$0
|
|
148
|
+
);
|
|
149
|
+
return testStringCoercion(value);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function getTaskName(type) {
|
|
153
|
+
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
154
|
+
if (
|
|
155
|
+
"object" === typeof type &&
|
|
156
|
+
null !== type &&
|
|
157
|
+
type.$$typeof === REACT_LAZY_TYPE
|
|
158
|
+
)
|
|
159
|
+
return "<...>";
|
|
160
|
+
try {
|
|
161
|
+
var name = getComponentNameFromType(type);
|
|
162
|
+
return name ? "<" + name + ">" : "<...>";
|
|
163
|
+
} catch (x) {
|
|
164
|
+
return "<...>";
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function getOwner() {
|
|
168
|
+
var dispatcher = ReactSharedInternals.A;
|
|
169
|
+
return null === dispatcher ? null : dispatcher.getOwner();
|
|
170
|
+
}
|
|
171
|
+
function UnknownOwner() {
|
|
172
|
+
return Error("react-stack-top-frame");
|
|
173
|
+
}
|
|
174
|
+
function hasValidKey(config) {
|
|
175
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
176
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
177
|
+
if (getter && getter.isReactWarning) return false;
|
|
178
|
+
}
|
|
179
|
+
return void 0 !== config.key;
|
|
180
|
+
}
|
|
181
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
182
|
+
function warnAboutAccessingKey() {
|
|
183
|
+
specialPropKeyWarningShown ||
|
|
184
|
+
((specialPropKeyWarningShown = true),
|
|
185
|
+
console.error(
|
|
186
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
187
|
+
displayName
|
|
188
|
+
));
|
|
189
|
+
}
|
|
190
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
191
|
+
Object.defineProperty(props, "key", {
|
|
192
|
+
get: warnAboutAccessingKey,
|
|
193
|
+
configurable: true
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
197
|
+
var componentName = getComponentNameFromType(this.type);
|
|
198
|
+
didWarnAboutElementRef[componentName] ||
|
|
199
|
+
((didWarnAboutElementRef[componentName] = true),
|
|
200
|
+
console.error(
|
|
201
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
202
|
+
));
|
|
203
|
+
componentName = this.props.ref;
|
|
204
|
+
return void 0 !== componentName ? componentName : null;
|
|
205
|
+
}
|
|
206
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
207
|
+
var refProp = props.ref;
|
|
208
|
+
type = {
|
|
209
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
210
|
+
type: type,
|
|
211
|
+
key: key,
|
|
212
|
+
props: props,
|
|
213
|
+
_owner: owner
|
|
214
|
+
};
|
|
215
|
+
null !== (void 0 !== refProp ? refProp : null)
|
|
216
|
+
? Object.defineProperty(type, "ref", {
|
|
217
|
+
enumerable: false,
|
|
218
|
+
get: elementRefGetterWithDeprecationWarning
|
|
219
|
+
})
|
|
220
|
+
: Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
221
|
+
type._store = {};
|
|
222
|
+
Object.defineProperty(type._store, "validated", {
|
|
223
|
+
configurable: false,
|
|
224
|
+
enumerable: false,
|
|
225
|
+
writable: true,
|
|
226
|
+
value: 0
|
|
227
|
+
});
|
|
228
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
229
|
+
configurable: false,
|
|
230
|
+
enumerable: false,
|
|
231
|
+
writable: true,
|
|
232
|
+
value: null
|
|
233
|
+
});
|
|
234
|
+
Object.defineProperty(type, "_debugStack", {
|
|
235
|
+
configurable: false,
|
|
236
|
+
enumerable: false,
|
|
237
|
+
writable: true,
|
|
238
|
+
value: debugStack
|
|
239
|
+
});
|
|
240
|
+
Object.defineProperty(type, "_debugTask", {
|
|
241
|
+
configurable: false,
|
|
242
|
+
enumerable: false,
|
|
243
|
+
writable: true,
|
|
244
|
+
value: debugTask
|
|
245
|
+
});
|
|
246
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
247
|
+
return type;
|
|
248
|
+
}
|
|
249
|
+
function jsxDEVImpl(
|
|
250
|
+
type,
|
|
251
|
+
config,
|
|
252
|
+
maybeKey,
|
|
253
|
+
isStaticChildren,
|
|
254
|
+
debugStack,
|
|
255
|
+
debugTask
|
|
256
|
+
) {
|
|
257
|
+
var children = config.children;
|
|
258
|
+
if (void 0 !== children)
|
|
259
|
+
if (isStaticChildren)
|
|
260
|
+
if (isArrayImpl(children)) {
|
|
261
|
+
for (
|
|
262
|
+
isStaticChildren = 0;
|
|
263
|
+
isStaticChildren < children.length;
|
|
264
|
+
isStaticChildren++
|
|
265
|
+
)
|
|
266
|
+
validateChildKeys(children[isStaticChildren]);
|
|
267
|
+
Object.freeze && Object.freeze(children);
|
|
268
|
+
} else
|
|
269
|
+
console.error(
|
|
270
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
271
|
+
);
|
|
272
|
+
else validateChildKeys(children);
|
|
273
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
274
|
+
children = getComponentNameFromType(type);
|
|
275
|
+
var keys = Object.keys(config).filter(function (k) {
|
|
276
|
+
return "key" !== k;
|
|
277
|
+
});
|
|
278
|
+
isStaticChildren =
|
|
279
|
+
0 < keys.length
|
|
280
|
+
? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
|
|
281
|
+
: "{key: someKey}";
|
|
282
|
+
didWarnAboutKeySpread[children + isStaticChildren] ||
|
|
283
|
+
((keys =
|
|
284
|
+
0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
|
|
285
|
+
console.error(
|
|
286
|
+
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
287
|
+
isStaticChildren,
|
|
288
|
+
children,
|
|
289
|
+
keys,
|
|
290
|
+
children
|
|
291
|
+
),
|
|
292
|
+
(didWarnAboutKeySpread[children + isStaticChildren] = true));
|
|
293
|
+
}
|
|
294
|
+
children = null;
|
|
295
|
+
void 0 !== maybeKey &&
|
|
296
|
+
(checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
|
|
297
|
+
hasValidKey(config) &&
|
|
298
|
+
(checkKeyStringCoercion(config.key), (children = "" + config.key));
|
|
299
|
+
if ("key" in config) {
|
|
300
|
+
maybeKey = {};
|
|
301
|
+
for (var propName in config)
|
|
302
|
+
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
303
|
+
} else maybeKey = config;
|
|
304
|
+
children &&
|
|
305
|
+
defineKeyPropWarningGetter(
|
|
306
|
+
maybeKey,
|
|
307
|
+
"function" === typeof type
|
|
308
|
+
? type.displayName || type.name || "Unknown"
|
|
309
|
+
: type
|
|
310
|
+
);
|
|
311
|
+
return ReactElement(
|
|
312
|
+
type,
|
|
313
|
+
children,
|
|
314
|
+
maybeKey,
|
|
315
|
+
getOwner(),
|
|
316
|
+
debugStack,
|
|
317
|
+
debugTask
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
function validateChildKeys(node) {
|
|
321
|
+
isValidElement(node)
|
|
322
|
+
? node._store && (node._store.validated = 1)
|
|
323
|
+
: "object" === typeof node &&
|
|
324
|
+
null !== node &&
|
|
325
|
+
node.$$typeof === REACT_LAZY_TYPE &&
|
|
326
|
+
("fulfilled" === node._payload.status
|
|
327
|
+
? isValidElement(node._payload.value) &&
|
|
328
|
+
node._payload.value._store &&
|
|
329
|
+
(node._payload.value._store.validated = 1)
|
|
330
|
+
: node._store && (node._store.validated = 1));
|
|
331
|
+
}
|
|
332
|
+
function isValidElement(object) {
|
|
333
|
+
return (
|
|
334
|
+
"object" === typeof object &&
|
|
335
|
+
null !== object &&
|
|
336
|
+
object.$$typeof === REACT_ELEMENT_TYPE
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
var React = require$$0,
|
|
340
|
+
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
341
|
+
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
342
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
343
|
+
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
344
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
345
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
346
|
+
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
347
|
+
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
348
|
+
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
349
|
+
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
350
|
+
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
351
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
352
|
+
REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
|
|
353
|
+
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
|
|
354
|
+
ReactSharedInternals =
|
|
355
|
+
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
356
|
+
hasOwnProperty = Object.prototype.hasOwnProperty,
|
|
357
|
+
isArrayImpl = Array.isArray,
|
|
358
|
+
createTask = console.createTask
|
|
359
|
+
? console.createTask
|
|
360
|
+
: function () {
|
|
361
|
+
return null;
|
|
362
|
+
};
|
|
363
|
+
React = {
|
|
364
|
+
react_stack_bottom_frame: function (callStackForError) {
|
|
365
|
+
return callStackForError();
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
var specialPropKeyWarningShown;
|
|
369
|
+
var didWarnAboutElementRef = {};
|
|
370
|
+
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
|
|
371
|
+
React,
|
|
372
|
+
UnknownOwner
|
|
373
|
+
)();
|
|
374
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
375
|
+
var didWarnAboutKeySpread = {};
|
|
376
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
377
|
+
reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
|
|
378
|
+
var trackActualOwner =
|
|
379
|
+
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
380
|
+
return jsxDEVImpl(
|
|
381
|
+
type,
|
|
382
|
+
config,
|
|
383
|
+
maybeKey,
|
|
384
|
+
false,
|
|
385
|
+
trackActualOwner
|
|
386
|
+
? Error("react-stack-top-frame")
|
|
387
|
+
: unknownOwnerDebugStack,
|
|
388
|
+
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
389
|
+
);
|
|
390
|
+
};
|
|
391
|
+
reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
|
|
392
|
+
var trackActualOwner =
|
|
393
|
+
1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
394
|
+
return jsxDEVImpl(
|
|
395
|
+
type,
|
|
396
|
+
config,
|
|
397
|
+
maybeKey,
|
|
398
|
+
true,
|
|
399
|
+
trackActualOwner
|
|
400
|
+
? Error("react-stack-top-frame")
|
|
401
|
+
: unknownOwnerDebugStack,
|
|
402
|
+
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
403
|
+
);
|
|
404
|
+
};
|
|
405
|
+
})();
|
|
406
|
+
return reactJsxRuntime_development;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
var hasRequiredJsxRuntime;
|
|
410
|
+
|
|
411
|
+
function requireJsxRuntime () {
|
|
412
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
413
|
+
hasRequiredJsxRuntime = 1;
|
|
414
|
+
|
|
415
|
+
if (process.env.NODE_ENV === 'production') {
|
|
416
|
+
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
417
|
+
} else {
|
|
418
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
419
|
+
}
|
|
420
|
+
return jsxRuntime.exports;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* LoadingSpinner component
|
|
427
|
+
* Displays a loading indicator with multiple style variants
|
|
428
|
+
*
|
|
429
|
+
* @param variant - 'spinner' (default circular spinner), 'dots' (three bouncing dots), 'pulse' (pulsing circle), 'ring' (rotating ring)
|
|
430
|
+
* @param inline - If true, removes centering and margins for inline use (e.g., in buttons or inputs)
|
|
431
|
+
* @param color - Color scheme: 'blue' (default), 'gray', 'white'
|
|
432
|
+
*/
|
|
433
|
+
const LoadingSpinner = ({ message, size = "md", className = "", variant = "spinner", inline = false, color = "blue", }) => {
|
|
434
|
+
const sizeClasses = {
|
|
435
|
+
sm: "h-4 w-4",
|
|
436
|
+
md: "h-8 w-8",
|
|
437
|
+
lg: "h-12 w-12",
|
|
438
|
+
};
|
|
439
|
+
const colorClasses = {
|
|
440
|
+
blue: "border-blue-600",
|
|
441
|
+
gray: "border-gray-600",
|
|
442
|
+
white: "border-white",
|
|
443
|
+
};
|
|
444
|
+
const dotColorClasses = {
|
|
445
|
+
blue: "bg-blue-600",
|
|
446
|
+
gray: "bg-gray-600",
|
|
447
|
+
white: "bg-white",
|
|
448
|
+
};
|
|
449
|
+
const dotSizeClasses = {
|
|
450
|
+
sm: "h-1.5 w-1.5",
|
|
451
|
+
md: "h-2.5 w-2.5",
|
|
452
|
+
lg: "h-3.5 w-3.5",
|
|
453
|
+
};
|
|
454
|
+
// Spinner variant (circular border)
|
|
455
|
+
if (variant === "spinner") {
|
|
456
|
+
return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsx("div", { className: `animate-spin rounded-full border-2 ${colorClasses[color]} ${sizeClasses[size]} ${inline ? "" : "mx-auto mb-4"}`, style: {
|
|
457
|
+
borderTopColor: "transparent",
|
|
458
|
+
borderRightColor: "transparent",
|
|
459
|
+
} }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
|
|
460
|
+
}
|
|
461
|
+
// Dots variant (three bouncing dots)
|
|
462
|
+
if (variant === "dots") {
|
|
463
|
+
return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "flex gap-1" : "text-center", children: [jsxRuntimeExports.jsxs("div", { className: `flex gap-1 ${inline ? "" : "mx-auto mb-4"}`, children: [jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "0ms" } }), jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "150ms" } }), jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "300ms" } })] }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
|
|
464
|
+
}
|
|
465
|
+
// Pulse variant (pulsing circle)
|
|
466
|
+
if (variant === "pulse") {
|
|
467
|
+
return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsx("div", { className: `${sizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-pulse ${inline ? "" : "mx-auto mb-4"}` }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
|
|
468
|
+
}
|
|
469
|
+
// Ring variant (rotating ring with gradient)
|
|
470
|
+
if (variant === "ring") {
|
|
471
|
+
const ringColorMap = {
|
|
472
|
+
blue: "border-blue-600",
|
|
473
|
+
gray: "border-gray-600",
|
|
474
|
+
white: "border-white",
|
|
475
|
+
};
|
|
476
|
+
return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsxs("div", { className: `relative ${sizeClasses[size]} ${inline ? "" : "mx-auto mb-4"}`, children: [jsxRuntimeExports.jsx("div", { className: `absolute inset-0 rounded-full border-2 ${colorClasses[color]} opacity-25` }), jsxRuntimeExports.jsx("div", { className: `absolute inset-0 rounded-full border-2 border-transparent ${ringColorMap[color]} animate-spin`, style: {
|
|
477
|
+
borderTopColor: "currentColor",
|
|
478
|
+
borderRightColor: "transparent",
|
|
479
|
+
borderBottomColor: "transparent",
|
|
480
|
+
borderLeftColor: "transparent",
|
|
481
|
+
} })] }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
|
|
482
|
+
}
|
|
483
|
+
return null;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
export { LoadingSpinner as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rubenpazch/loading-spinner",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "LoadingSpinner component",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "dist/index.cjs.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/rubenpazch/lbyte-ui-library.git",
|
|
12
|
+
"directory": "packages/loading-spinner"
|
|
13
|
+
},
|
|
14
|
+
"author": "Ruben Paz Chuspe <rubenpazchuspe@outlook.com>",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": "./dist/index.esm.js",
|
|
23
|
+
"require": "./dist/index.cjs.js",
|
|
24
|
+
"types": "./dist/index.d.ts"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": "^19.0.0",
|
|
29
|
+
"react-dom": "^19.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@rubenpazch/typescript-config": "2.0.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rollup -c",
|
|
39
|
+
"test": "jest --passWithNoTests"
|
|
40
|
+
}
|
|
41
|
+
}
|