@ieu-ui/components 0.2.0 → 0.2.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IeuSpinner.d.ts","sourceRoot":"","sources":["../../src/IeuSpinner/IeuSpinner.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"IeuSpinner.d.ts","sourceRoot":"","sources":["../../src/IeuSpinner/IeuSpinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAQ,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAG5E,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC3D,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,WAAW,GACX,SAAS,GACT,OAAO,GACP,SAAS,GACT,MAAM,GACN,MAAM,CAAC;AAEX,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAgBD,eAAO,MAAM,UAAU,GAAI,sCAKxB,eAAe,sBA4CjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.IeuSpinner = void 0;
|
|
7
|
-
const react_1 =
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
8
38
|
const react_native_1 = require("react-native");
|
|
9
39
|
const core_1 = require("@ieu-ui/core");
|
|
10
40
|
const sizeMap = {
|
|
@@ -22,10 +52,25 @@ const speedMap = {
|
|
|
22
52
|
const IeuSpinner = ({ size = 'md', colorScheme = 'primary', speed = 'normal', style, }) => {
|
|
23
53
|
const { theme } = (0, core_1.useTheme)();
|
|
24
54
|
const { colors } = theme;
|
|
55
|
+
const spinValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
|
|
25
56
|
const spinnerSize = sizeMap[size];
|
|
26
57
|
const duration = speedMap[speed];
|
|
27
|
-
const color = colors[colorScheme][500];
|
|
28
|
-
|
|
58
|
+
const color = colors[colorScheme]?.[500] || colors.primary[500];
|
|
59
|
+
(0, react_1.useEffect)(() => {
|
|
60
|
+
const spinAnimation = react_native_1.Animated.loop(react_native_1.Animated.timing(spinValue, {
|
|
61
|
+
toValue: 1,
|
|
62
|
+
duration: duration,
|
|
63
|
+
easing: react_native_1.Easing.linear,
|
|
64
|
+
useNativeDriver: true,
|
|
65
|
+
}));
|
|
66
|
+
spinAnimation.start();
|
|
67
|
+
return () => spinAnimation.stop();
|
|
68
|
+
}, [spinValue, duration]);
|
|
69
|
+
const spin = spinValue.interpolate({
|
|
70
|
+
inputRange: [0, 1],
|
|
71
|
+
outputRange: ['0deg', '360deg'],
|
|
72
|
+
});
|
|
73
|
+
return (<react_native_1.Animated.View style={[
|
|
29
74
|
{
|
|
30
75
|
width: spinnerSize,
|
|
31
76
|
height: spinnerSize,
|
|
@@ -34,6 +79,7 @@ const IeuSpinner = ({ size = 'md', colorScheme = 'primary', speed = 'normal', st
|
|
|
34
79
|
borderColor: color,
|
|
35
80
|
borderTopColor: 'transparent',
|
|
36
81
|
borderRightColor: 'transparent',
|
|
82
|
+
transform: [{ rotate: spin }],
|
|
37
83
|
},
|
|
38
84
|
style,
|
|
39
85
|
]}/>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IeuSpinner.js","sourceRoot":"","sources":["../../src/IeuSpinner/IeuSpinner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IeuSpinner.js","sourceRoot":"","sources":["../../src/IeuSpinner/IeuSpinner.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiD;AACjD,+CAA4E;AAC5E,uCA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