@tecsinapse/react-native-kit 1.12.15 → 1.15.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/CHANGELOG.md +32 -0
- package/dist/components/atoms/Skeleton/Pulse.d.ts +2 -0
- package/dist/components/atoms/Skeleton/Pulse.js +44 -0
- package/dist/components/atoms/Skeleton/Pulse.js.map +1 -0
- package/dist/components/atoms/Skeleton/Skeleton.d.ts +12 -0
- package/dist/components/atoms/Skeleton/Skeleton.js +73 -0
- package/dist/components/atoms/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/atoms/Skeleton/Wave.d.ts +2 -0
- package/dist/components/atoms/Skeleton/Wave.js +65 -0
- package/dist/components/atoms/Skeleton/Wave.js.map +1 -0
- package/dist/components/atoms/Skeleton/animation.d.ts +3 -0
- package/dist/components/atoms/Skeleton/animation.js +52 -0
- package/dist/components/atoms/Skeleton/animation.js.map +1 -0
- package/dist/components/atoms/Skeleton/index.d.ts +1 -0
- package/dist/components/atoms/Skeleton/index.js +24 -0
- package/dist/components/atoms/Skeleton/index.js.map +1 -0
- package/dist/components/atoms/Skeleton/styled.d.ts +7 -0
- package/dist/components/atoms/Skeleton/styled.js +29 -0
- package/dist/components/atoms/Skeleton/styled.js.map +1 -0
- package/dist/components/atoms/Skeleton/types.d.ts +12 -0
- package/dist/components/atoms/Skeleton/types.js +6 -0
- package/dist/components/atoms/Skeleton/types.js.map +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
- package/src/components/atoms/Skeleton/Pulse.tsx +33 -0
- package/src/components/atoms/Skeleton/Skeleton.tsx +71 -0
- package/src/components/atoms/Skeleton/Wave.tsx +53 -0
- package/src/components/atoms/Skeleton/animation.ts +49 -0
- package/src/components/atoms/Skeleton/index.ts +1 -0
- package/src/components/atoms/Skeleton/styled.ts +12 -0
- package/src/components/atoms/Skeleton/types.ts +13 -0
- package/src/index.ts +24 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.15.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.14.0...@tecsinapse/react-native-kit@1.15.0) (2022-02-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @tecsinapse/react-native-kit
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.14.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.13.0...@tecsinapse/react-native-kit@1.14.0) (2022-02-09)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @tecsinapse/react-native-kit
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [1.13.0](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.12.16...@tecsinapse/react-native-kit@1.13.0) (2022-02-02)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @tecsinapse/react-native-kit
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [1.12.16](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.12.15...@tecsinapse/react-native-kit@1.12.16) (2022-01-28)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @tecsinapse/react-native-kit
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
## [1.12.15](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.12.14...@tecsinapse/react-native-kit@1.12.15) (2022-01-24)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @tecsinapse/react-native-kit
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Pulse = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _animation = require("./animation");
|
|
13
|
+
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
const Pulse = ({
|
|
19
|
+
active = true,
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
childrenLayout
|
|
23
|
+
}) => {
|
|
24
|
+
const animatedValue = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
25
|
+
(0, _react.useEffect)(() => {
|
|
26
|
+
(0, _animation.pulseAnimation)(active, animatedValue);
|
|
27
|
+
}, [active]);
|
|
28
|
+
return _react.default.createElement(_reactNative.Animated.View, {
|
|
29
|
+
style: {
|
|
30
|
+
width: width ?? childrenLayout.width,
|
|
31
|
+
height: height ?? childrenLayout.height,
|
|
32
|
+
backgroundColor: 'rgba(0,0,0,0.05)',
|
|
33
|
+
position: 'absolute',
|
|
34
|
+
top: childrenLayout.x ?? 0,
|
|
35
|
+
left: childrenLayout.y ?? 0,
|
|
36
|
+
zIndex: 2,
|
|
37
|
+
overflow: 'hidden',
|
|
38
|
+
opacity: animatedValue
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.Pulse = Pulse;
|
|
44
|
+
//# sourceMappingURL=Pulse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Skeleton/Pulse.tsx"],"names":["Pulse","active","width","height","childrenLayout","animatedValue","Animated","Value","current","backgroundColor","position","top","x","left","y","zIndex","overflow","opacity"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAGO,MAAMA,KAAK,GAAG,CAAC;AACpBC,EAAAA,MAAM,GAAG,IADW;AAEpBC,EAAAA,KAFoB;AAGpBC,EAAAA,MAHoB;AAIpBC,EAAAA;AAJoB,CAAD,KAKM;AACzB,QAAMC,aAAa,GAAG,mBAAO,IAAIC,sBAASC,KAAb,CAAmB,CAAnB,CAAP,EAA8BC,OAApD;AAEA,wBAAU,MAAM;AACd,mCAAeP,MAAf,EAAuBI,aAAvB;AACD,GAFD,EAEG,CAACJ,MAAD,CAFH;AAIA,SACE,6BAAC,qBAAD,CAAU,IAAV;AACE,IAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAEA,KAAK,IAAIE,cAAc,CAACF,KAD1B;AAELC,MAAAA,MAAM,EAAEA,MAAM,IAAIC,cAAc,CAACD,MAF5B;AAGLM,MAAAA,eAAe,EAAE,kBAHZ;AAILC,MAAAA,QAAQ,EAAE,UAJL;AAKLC,MAAAA,GAAG,EAAEP,cAAc,CAACQ,CAAf,IAAoB,CALpB;AAMLC,MAAAA,IAAI,EAAET,cAAc,CAACU,CAAf,IAAoB,CANrB;AAOLC,MAAAA,MAAM,EAAE,CAPH;AAQLC,MAAAA,QAAQ,EAAE,QARL;AASLC,MAAAA,OAAO,EAAEZ;AATJ;AADT,IADF;AAeD,CA3BM","sourcesContent":["import { Animated } from 'react-native';\nimport React, { useEffect, useRef } from 'react';\nimport { pulseAnimation } from './animation';\nimport { IAnimationComponent } from './types';\n\nexport const Pulse = ({\n active = true,\n width,\n height,\n childrenLayout,\n}: IAnimationComponent) => {\n const animatedValue = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n pulseAnimation(active, animatedValue);\n }, [active]);\n\n return (\n <Animated.View\n style={{\n width: width ?? childrenLayout.width,\n height: height ?? childrenLayout.height,\n backgroundColor: 'rgba(0,0,0,0.05)',\n position: 'absolute',\n top: childrenLayout.x ?? 0,\n left: childrenLayout.y ?? 0,\n zIndex: 2,\n overflow: 'hidden',\n opacity: animatedValue,\n }}\n />\n );\n};\n"],"file":"Pulse.js"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BorderRadiusType } from '@tecsinapse/react-core';
|
|
3
|
+
import { ViewProps } from 'react-native';
|
|
4
|
+
export interface SkeletonProps extends ViewProps {
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
radius?: BorderRadiusType;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
animation?: 'wave' | 'pulse';
|
|
10
|
+
}
|
|
11
|
+
declare const Skeleton: React.FC<SkeletonProps>;
|
|
12
|
+
export default Skeleton;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _styled = require("./styled");
|
|
13
|
+
|
|
14
|
+
var _Wave = require("./Wave");
|
|
15
|
+
|
|
16
|
+
var _Pulse = require("./Pulse");
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
+
|
|
24
|
+
const Skeleton = ({
|
|
25
|
+
children,
|
|
26
|
+
width,
|
|
27
|
+
height,
|
|
28
|
+
radius,
|
|
29
|
+
active = true,
|
|
30
|
+
animation = 'wave',
|
|
31
|
+
...rest
|
|
32
|
+
}) => {
|
|
33
|
+
const [childrenLayout, setChildrenLayout] = (0, _react.useState)({
|
|
34
|
+
width: 0,
|
|
35
|
+
height: 0,
|
|
36
|
+
y: 0,
|
|
37
|
+
x: 0
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (!width && !height && !children) {
|
|
41
|
+
throw new Error('[Skeleton] You should provide children or specify width and height');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const getChildrenLayout = event => {
|
|
45
|
+
setChildrenLayout(event.nativeEvent.layout);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return _react.default.createElement(_styled.Wrapper, _extends({
|
|
49
|
+
width: width,
|
|
50
|
+
height: height,
|
|
51
|
+
radius: radius
|
|
52
|
+
}, rest), active && animation === 'wave' ? _react.default.createElement(_Wave.Wave, {
|
|
53
|
+
active: active,
|
|
54
|
+
width: width,
|
|
55
|
+
height: height,
|
|
56
|
+
childrenLayout: childrenLayout
|
|
57
|
+
}) : _react.default.createElement(_Pulse.Pulse, {
|
|
58
|
+
active: active,
|
|
59
|
+
width: width,
|
|
60
|
+
height: height,
|
|
61
|
+
childrenLayout: childrenLayout
|
|
62
|
+
}), _react.default.createElement(_reactNative.View, {
|
|
63
|
+
onLayout: event => getChildrenLayout(event),
|
|
64
|
+
style: {
|
|
65
|
+
opacity: active ? 0 : 1
|
|
66
|
+
},
|
|
67
|
+
pointerEvents: active ? 'none' : 'auto'
|
|
68
|
+
}, children));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var _default = Skeleton;
|
|
72
|
+
exports.default = _default;
|
|
73
|
+
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Skeleton/Skeleton.tsx"],"names":["Skeleton","children","width","height","radius","active","animation","rest","childrenLayout","setChildrenLayout","y","x","Error","getChildrenLayout","event","nativeEvent","layout","opacity"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;AAWA,MAAMA,QAAiC,GAAG,CAAC;AACzCC,EAAAA,QADyC;AAEzCC,EAAAA,KAFyC;AAGzCC,EAAAA,MAHyC;AAIzCC,EAAAA,MAJyC;AAKzCC,EAAAA,MAAM,GAAG,IALgC;AAMzCC,EAAAA,SAAS,GAAG,MAN6B;AAOzC,KAAGC;AAPsC,CAAD,KAQpC;AACJ,QAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsC,qBAAyB;AACnEP,IAAAA,KAAK,EAAE,CAD4D;AAEnEC,IAAAA,MAAM,EAAE,CAF2D;AAGnEO,IAAAA,CAAC,EAAE,CAHgE;AAInEC,IAAAA,CAAC,EAAE;AAJgE,GAAzB,CAA5C;;AAOA,MAAI,CAACT,KAAD,IAAU,CAACC,MAAX,IAAqB,CAACF,QAA1B,EAAoC;AAClC,UAAM,IAAIW,KAAJ,CACJ,oEADI,CAAN;AAGD;;AAED,QAAMC,iBAAiB,GAAIC,KAAD,IAA8B;AACtDL,IAAAA,iBAAiB,CAACK,KAAK,CAACC,WAAN,CAAkBC,MAAnB,CAAjB;AACD,GAFD;;AAIA,SACE,6BAAC,eAAD;AAAS,IAAA,KAAK,EAAEd,KAAhB;AAAuB,IAAA,MAAM,EAAEC,MAA/B;AAAuC,IAAA,MAAM,EAAEC;AAA/C,KAA2DG,IAA3D,GACGF,MAAM,IAAIC,SAAS,KAAK,MAAxB,GACC,6BAAC,UAAD;AACE,IAAA,MAAM,EAAED,MADV;AAEE,IAAA,KAAK,EAAEH,KAFT;AAGE,IAAA,MAAM,EAAEC,MAHV;AAIE,IAAA,cAAc,EAAEK;AAJlB,IADD,GAQC,6BAAC,YAAD;AACE,IAAA,MAAM,EAAEH,MADV;AAEE,IAAA,KAAK,EAAEH,KAFT;AAGE,IAAA,MAAM,EAAEC,MAHV;AAIE,IAAA,cAAc,EAAEK;AAJlB,IATJ,EAgBE,6BAAC,iBAAD;AACE,IAAA,QAAQ,EAAEM,KAAK,IAAID,iBAAiB,CAACC,KAAD,CADtC;AAEE,IAAA,KAAK,EAAE;AAAEG,MAAAA,OAAO,EAAEZ,MAAM,GAAG,CAAH,GAAO;AAAxB,KAFT;AAGE,IAAA,aAAa,EAAEA,MAAM,GAAG,MAAH,GAAY;AAHnC,KAKGJ,QALH,CAhBF,CADF;AA0BD,CApDD;;eAsDeD,Q","sourcesContent":["import React, { useState } from 'react';\nimport { BorderRadiusType } from '@tecsinapse/react-core';\nimport { LayoutChangeEvent, View, ViewProps } from 'react-native';\nimport { Wrapper } from './styled';\nimport { Wave } from './Wave';\nimport { Pulse } from './Pulse';\nimport { ChildrenLayout } from './types';\n\nexport interface SkeletonProps extends ViewProps {\n width?: number;\n height?: number;\n radius?: BorderRadiusType;\n active?: boolean;\n animation?: 'wave' | 'pulse';\n}\n\nconst Skeleton: React.FC<SkeletonProps> = ({\n children,\n width,\n height,\n radius,\n active = true,\n animation = 'wave',\n ...rest\n}) => {\n const [childrenLayout, setChildrenLayout] = useState<ChildrenLayout>({\n width: 0,\n height: 0,\n y: 0,\n x: 0,\n });\n\n if (!width && !height && !children) {\n throw new Error(\n '[Skeleton] You should provide children or specify width and height'\n );\n }\n\n const getChildrenLayout = (event: LayoutChangeEvent) => {\n setChildrenLayout(event.nativeEvent.layout);\n };\n\n return (\n <Wrapper width={width} height={height} radius={radius} {...rest}>\n {active && animation === 'wave' ? (\n <Wave\n active={active}\n width={width}\n height={height}\n childrenLayout={childrenLayout}\n />\n ) : (\n <Pulse\n active={active}\n width={width}\n height={height}\n childrenLayout={childrenLayout}\n />\n )}\n <View\n onLayout={event => getChildrenLayout(event)}\n style={{ opacity: active ? 0 : 1 }}\n pointerEvents={active ? 'none' : 'auto'}\n >\n {children}\n </View>\n </Wrapper>\n );\n};\n\nexport default Skeleton;\n"],"file":"Skeleton.js"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Wave = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _reactNativeLinearGradient = _interopRequireDefault(require("react-native-linear-gradient"));
|
|
13
|
+
|
|
14
|
+
var _animation = require("./animation");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
const AnimatedLinearGradient = _reactNative.Animated.createAnimatedComponent(_reactNativeLinearGradient.default);
|
|
23
|
+
|
|
24
|
+
const Wave = ({
|
|
25
|
+
active = true,
|
|
26
|
+
width,
|
|
27
|
+
height,
|
|
28
|
+
childrenLayout
|
|
29
|
+
}) => {
|
|
30
|
+
const range = width ?? childrenLayout.width;
|
|
31
|
+
const animatedValue = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
32
|
+
const translateX = animatedValue.interpolate({
|
|
33
|
+
inputRange: [0, 1],
|
|
34
|
+
outputRange: [-range, range]
|
|
35
|
+
});
|
|
36
|
+
(0, _react.useEffect)(() => {
|
|
37
|
+
(0, _animation.waveAnimation)(active, animatedValue);
|
|
38
|
+
}, [active]);
|
|
39
|
+
return _react.default.createElement(AnimatedLinearGradient, {
|
|
40
|
+
colors: ['transparent', 'rgba(0,0,0,0.05)', 'rgba(0,0,0,0.1)', 'transparent'],
|
|
41
|
+
start: {
|
|
42
|
+
x: 0,
|
|
43
|
+
y: 0
|
|
44
|
+
},
|
|
45
|
+
end: {
|
|
46
|
+
x: 1,
|
|
47
|
+
y: 0
|
|
48
|
+
},
|
|
49
|
+
style: {
|
|
50
|
+
width: width ?? childrenLayout.width,
|
|
51
|
+
height: height ?? childrenLayout.height,
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
top: childrenLayout.y ?? 0,
|
|
54
|
+
left: childrenLayout.x ?? 0,
|
|
55
|
+
zIndex: 2,
|
|
56
|
+
overflow: 'hidden',
|
|
57
|
+
transform: [{
|
|
58
|
+
translateX: translateX
|
|
59
|
+
}]
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
exports.Wave = Wave;
|
|
65
|
+
//# sourceMappingURL=Wave.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Skeleton/Wave.tsx"],"names":["AnimatedLinearGradient","Animated","createAnimatedComponent","LinearGradient","Wave","active","width","height","childrenLayout","range","animatedValue","Value","current","translateX","interpolate","inputRange","outputRange","x","y","position","top","left","zIndex","overflow","transform"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAGA,MAAMA,sBAAsB,GAAGC,sBAASC,uBAAT,CAAiCC,kCAAjC,CAA/B;;AAEO,MAAMC,IAAI,GAAG,CAAC;AACnBC,EAAAA,MAAM,GAAG,IADU;AAEnBC,EAAAA,KAFmB;AAGnBC,EAAAA,MAHmB;AAInBC,EAAAA;AAJmB,CAAD,KAKO;AACzB,QAAMC,KAAK,GAAGH,KAAK,IAAIE,cAAc,CAACF,KAAtC;AACA,QAAMI,aAAa,GAAG,mBAAO,IAAIT,sBAASU,KAAb,CAAmB,CAAnB,CAAP,EAA8BC,OAApD;AAEA,QAAMC,UAAU,GAAGH,aAAa,CAACI,WAAd,CAA0B;AAC3CC,IAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CAD+B;AAE3CC,IAAAA,WAAW,EAAE,CAAC,CAACP,KAAF,EAASA,KAAT;AAF8B,GAA1B,CAAnB;AAKA,wBAAU,MAAM;AACd,kCAAcJ,MAAd,EAAsBK,aAAtB;AACD,GAFD,EAEG,CAACL,MAAD,CAFH;AAIA,SACE,6BAAC,sBAAD;AACE,IAAA,MAAM,EAAE,CACN,aADM,EAEN,kBAFM,EAGN,iBAHM,EAIN,aAJM,CADV;AAOE,IAAA,KAAK,EAAE;AAAEY,MAAAA,CAAC,EAAE,CAAL;AAAQC,MAAAA,CAAC,EAAE;AAAX,KAPT;AAQE,IAAA,GAAG,EAAE;AAAED,MAAAA,CAAC,EAAE,CAAL;AAAQC,MAAAA,CAAC,EAAE;AAAX,KARP;AASE,IAAA,KAAK,EAAE;AACLZ,MAAAA,KAAK,EAAEA,KAAK,IAAIE,cAAc,CAACF,KAD1B;AAELC,MAAAA,MAAM,EAAEA,MAAM,IAAIC,cAAc,CAACD,MAF5B;AAGLY,MAAAA,QAAQ,EAAE,UAHL;AAILC,MAAAA,GAAG,EAAEZ,cAAc,CAACU,CAAf,IAAoB,CAJpB;AAKLG,MAAAA,IAAI,EAAEb,cAAc,CAACS,CAAf,IAAoB,CALrB;AAMLK,MAAAA,MAAM,EAAE,CANH;AAOLC,MAAAA,QAAQ,EAAE,QAPL;AAQLC,MAAAA,SAAS,EAAE,CACT;AACEX,QAAAA,UAAU,EAAEA;AADd,OADS;AARN;AATT,IADF;AA0BD,CA5CM","sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Animated } from 'react-native';\nimport LinearGradient from 'react-native-linear-gradient';\nimport { waveAnimation } from './animation';\nimport { IAnimationComponent } from './types';\n\nconst AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient);\n\nexport const Wave = ({\n active = true,\n width,\n height,\n childrenLayout,\n}: IAnimationComponent) => {\n const range = width ?? childrenLayout.width;\n const animatedValue = useRef(new Animated.Value(0)).current;\n\n const translateX = animatedValue.interpolate({\n inputRange: [0, 1],\n outputRange: [-range, range],\n });\n\n useEffect(() => {\n waveAnimation(active, animatedValue);\n }, [active]);\n\n return (\n <AnimatedLinearGradient\n colors={[\n 'transparent',\n 'rgba(0,0,0,0.05)',\n 'rgba(0,0,0,0.1)',\n 'transparent',\n ]}\n start={{ x: 0, y: 0 }}\n end={{ x: 1, y: 0 }}\n style={{\n width: width ?? childrenLayout.width,\n height: height ?? childrenLayout.height,\n position: 'absolute',\n top: childrenLayout.y ?? 0,\n left: childrenLayout.x ?? 0,\n zIndex: 2,\n overflow: 'hidden',\n transform: [\n {\n translateX: translateX,\n },\n ],\n }}\n />\n );\n};\n"],"file":"Wave.js"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.pulseAnimation = exports.waveAnimation = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
const waveAnimation = (active, animatedValue) => {
|
|
11
|
+
if (active) {
|
|
12
|
+
_reactNative.Animated.loop(_reactNative.Animated.timing(animatedValue, {
|
|
13
|
+
toValue: 1,
|
|
14
|
+
duration: 1600,
|
|
15
|
+
easing: _reactNative.Easing.inOut(_reactNative.Easing.linear),
|
|
16
|
+
useNativeDriver: true
|
|
17
|
+
})).start();
|
|
18
|
+
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_reactNative.Animated.timing(animatedValue, {
|
|
23
|
+
toValue: 0,
|
|
24
|
+
useNativeDriver: true
|
|
25
|
+
}).start();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.waveAnimation = waveAnimation;
|
|
29
|
+
|
|
30
|
+
const pulseAnimation = (active, animatedValue) => {
|
|
31
|
+
if (active) {
|
|
32
|
+
_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(animatedValue, {
|
|
33
|
+
toValue: 1,
|
|
34
|
+
duration: 800,
|
|
35
|
+
useNativeDriver: true
|
|
36
|
+
}), _reactNative.Animated.timing(animatedValue, {
|
|
37
|
+
toValue: 0,
|
|
38
|
+
duration: 800,
|
|
39
|
+
useNativeDriver: true
|
|
40
|
+
})])).start();
|
|
41
|
+
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
_reactNative.Animated.timing(animatedValue, {
|
|
46
|
+
toValue: 0,
|
|
47
|
+
useNativeDriver: true
|
|
48
|
+
}).start();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.pulseAnimation = pulseAnimation;
|
|
52
|
+
//# sourceMappingURL=animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Skeleton/animation.ts"],"names":["waveAnimation","active","animatedValue","Animated","loop","timing","toValue","duration","easing","Easing","inOut","linear","useNativeDriver","start","pulseAnimation","sequence"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,aAAa,GAAG,CAC3BC,MAD2B,EAE3BC,aAF2B,KAGlB;AACT,MAAID,MAAJ,EAAY;AACVE,0BAASC,IAAT,CACED,sBAASE,MAAT,CAAgBH,aAAhB,EAA+B;AAC7BI,MAAAA,OAAO,EAAE,CADoB;AAE7BC,MAAAA,QAAQ,EAAE,IAFmB;AAG7BC,MAAAA,MAAM,EAAEC,oBAAOC,KAAP,CAAaD,oBAAOE,MAApB,CAHqB;AAI7BC,MAAAA,eAAe,EAAE;AAJY,KAA/B,CADF,EAOEC,KAPF;;AAQA;AACD;;AACDV,wBAASE,MAAT,CAAgBH,aAAhB,EAA+B;AAC7BI,IAAAA,OAAO,EAAE,CADoB;AAE7BM,IAAAA,eAAe,EAAE;AAFY,GAA/B,EAGGC,KAHH;AAID,CAnBM;;;;AAqBA,MAAMC,cAAc,GAAG,CAC5Bb,MAD4B,EAE5BC,aAF4B,KAGnB;AACT,MAAID,MAAJ,EAAY;AACVE,0BAASC,IAAT,CACED,sBAASY,QAAT,CAAkB,CAChBZ,sBAASE,MAAT,CAAgBH,aAAhB,EAA+B;AAC7BI,MAAAA,OAAO,EAAE,CADoB;AAE7BC,MAAAA,QAAQ,EAAE,GAFmB;AAG7BK,MAAAA,eAAe,EAAE;AAHY,KAA/B,CADgB,EAMhBT,sBAASE,MAAT,CAAgBH,aAAhB,EAA+B;AAC7BI,MAAAA,OAAO,EAAE,CADoB;AAE7BC,MAAAA,QAAQ,EAAE,GAFmB;AAG7BK,MAAAA,eAAe,EAAE;AAHY,KAA/B,CANgB,CAAlB,CADF,EAaEC,KAbF;;AAcA;AACD;;AACDV,wBAASE,MAAT,CAAgBH,aAAhB,EAA+B;AAC7BI,IAAAA,OAAO,EAAE,CADoB;AAE7BM,IAAAA,eAAe,EAAE;AAFY,GAA/B,EAGGC,KAHH;AAID,CAzBM","sourcesContent":["import { Animated, Easing } from 'react-native';\n\nexport const waveAnimation = (\n active: boolean,\n animatedValue: Animated.Value\n): void => {\n if (active) {\n Animated.loop(\n Animated.timing(animatedValue, {\n toValue: 1,\n duration: 1600,\n easing: Easing.inOut(Easing.linear),\n useNativeDriver: true,\n })\n ).start();\n return;\n }\n Animated.timing(animatedValue, {\n toValue: 0,\n useNativeDriver: true,\n }).start();\n};\n\nexport const pulseAnimation = (\n active: boolean,\n animatedValue: Animated.Value\n): void => {\n if (active) {\n Animated.loop(\n Animated.sequence([\n Animated.timing(animatedValue, {\n toValue: 1,\n duration: 800,\n useNativeDriver: true,\n }),\n Animated.timing(animatedValue, {\n toValue: 0,\n duration: 800,\n useNativeDriver: true,\n }),\n ])\n ).start();\n return;\n }\n Animated.timing(animatedValue, {\n toValue: 0,\n useNativeDriver: true,\n }).start();\n};\n"],"file":"animation.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Skeleton, SkeletonProps } from './Skeleton';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Skeleton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Skeleton.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "SkeletonProps", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _Skeleton.SkeletonProps;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _Skeleton = _interopRequireWildcard(require("./Skeleton"));
|
|
20
|
+
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
|
+
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Skeleton/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["export { default as Skeleton, SkeletonProps } from './Skeleton';\n"],"file":"index.js"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Wrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
} & Partial<any>, {}, {
|
|
6
|
+
ref?: import("react").Ref<import("react-native").View> | undefined;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Wrapper = void 0;
|
|
7
|
+
|
|
8
|
+
var _native = _interopRequireDefault(require("@emotion/native"));
|
|
9
|
+
|
|
10
|
+
var _reactCore = require("@tecsinapse/react-core");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const Wrapper = _native.default.View`
|
|
15
|
+
width: ${({
|
|
16
|
+
width
|
|
17
|
+
}) => width ? `${(0, _reactCore.RFValueStr)(`${width}px`)}` : '100%'};
|
|
18
|
+
height: ${({
|
|
19
|
+
height
|
|
20
|
+
}) => height ? `${(0, _reactCore.RFValueStr)(`${height}px`)}` : 'auto'};
|
|
21
|
+
border-radius: ${({
|
|
22
|
+
theme,
|
|
23
|
+
radius
|
|
24
|
+
}) => radius ? theme.borderRadius[radius] : 0};
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
position: relative;
|
|
27
|
+
`;
|
|
28
|
+
exports.Wrapper = Wrapper;
|
|
29
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/atoms/Skeleton/styled.ts"],"names":["Wrapper","styled","View","width","height","theme","radius","borderRadius"],"mappings":";;;;;;;AAAA;;AACA;;;;AAGO,MAAMA,OAAO,GAAGC,gBAAOC,IAA0C;AACxE,WAAW,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAgBA,KAAK,GAAI,GAAE,2BAAY,GAAEA,KAAM,IAApB,CAAyB,EAA/B,GAAmC,MAAQ;AAC3E,YAAY,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAiBA,MAAM,GAAI,GAAE,2BAAY,GAAEA,MAAO,IAArB,CAA0B,EAAhC,GAAoC,MAAQ;AAC/E,mBAAmB,CAAC;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAD,KACfA,MAAM,GAAGD,KAAK,CAACE,YAAN,CAAmBD,MAAnB,CAAH,GAAgC,CAAE;AAC5C;AACA;AACA,CAPO","sourcesContent":["import styled from '@emotion/native';\nimport { RFValueStr, StyleProps } from '@tecsinapse/react-core';\nimport { SkeletonProps } from './Skeleton';\n\nexport const Wrapper = styled.View<Partial<StyleProps & SkeletonProps>>`\n width: ${({ width }) => (width ? `${RFValueStr(`${width}px`)}` : '100%')};\n height: ${({ height }) => (height ? `${RFValueStr(`${height}px`)}` : 'auto')};\n border-radius: ${({ theme, radius }: StyleProps & Partial<SkeletonProps>) =>\n radius ? theme.borderRadius[radius] : 0};\n overflow: hidden;\n position: relative;\n`;\n"],"file":"styled.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { Select, SelectNativeProps } from './components/molecules/Select';
|
|
|
4
4
|
export { Input, InputNativeProps } from './components/atoms/Input';
|
|
5
5
|
export { TextArea, TextAreaProps } from './components/atoms/TextArea';
|
|
6
6
|
export { Text, TextNativeProps } from './components/atoms/Text';
|
|
7
|
-
export { Error, Loading, Success, Button, ButtonNativeProps } from './components/atoms/Button';
|
|
7
|
+
export { Error, Loading, Success, Button, ButtonNativeProps, } from './components/atoms/Button';
|
|
8
8
|
export { GroupButtonOption } from './components/atoms/GroupButton';
|
|
9
9
|
export { InputPassword, InputPasswordNativeProps, } from './components/molecules/InputPassword';
|
|
10
10
|
export { BottomNavigator, BottomNavigatorProps, } from './components/atoms/BottomNavigator';
|
|
@@ -12,9 +12,10 @@ export { Tag, TagProps } from './components/atoms/Tag';
|
|
|
12
12
|
export { SnappingSlider, SnappingSliderProps, } from './components/atoms/SnappingSlider';
|
|
13
13
|
export { Badge, BadgeNativeProps } from './components/atoms/Badge';
|
|
14
14
|
export { Snackbar, SnackbarNativeProps } from './components/molecules/Snackbar';
|
|
15
|
-
export { DatePicker, NativeDatePickerProps } from './components/molecules/DatePicker';
|
|
16
|
-
export { DateTimePicker, NativeDateTimePickerProps } from './components/molecules/DateTimePicker';
|
|
15
|
+
export { DatePicker, NativeDatePickerProps, } from './components/molecules/DatePicker';
|
|
16
|
+
export { DateTimePicker, NativeDateTimePickerProps, } from './components/molecules/DateTimePicker';
|
|
17
17
|
export { Avatar } from './components/atoms/Avatar';
|
|
18
18
|
export { Calendar } from './components/molecules/Calendar';
|
|
19
19
|
export { DateTimeSelector } from './components/molecules/DateTimeSelector';
|
|
20
|
-
export { ModalGroupManager, ModalView, ModalLifecycleHandler, useLazyModalManager, useModalManager, IBaseModal } from './components/atoms/Modal';
|
|
20
|
+
export { ModalGroupManager, ModalView, ModalLifecycleHandler, useLazyModalManager, useModalManager, IBaseModal, } from './components/atoms/Modal';
|
|
21
|
+
export { Skeleton, SkeletonProps } from './components/atoms/Skeleton';
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,9 @@ var _exportNames = {
|
|
|
44
44
|
ModalLifecycleHandler: true,
|
|
45
45
|
useLazyModalManager: true,
|
|
46
46
|
useModalManager: true,
|
|
47
|
-
IBaseModal: true
|
|
47
|
+
IBaseModal: true,
|
|
48
|
+
Skeleton: true,
|
|
49
|
+
SkeletonProps: true
|
|
48
50
|
};
|
|
49
51
|
Object.defineProperty(exports, "Header", {
|
|
50
52
|
enumerable: true,
|
|
@@ -292,6 +294,18 @@ Object.defineProperty(exports, "IBaseModal", {
|
|
|
292
294
|
return _Modal.IBaseModal;
|
|
293
295
|
}
|
|
294
296
|
});
|
|
297
|
+
Object.defineProperty(exports, "Skeleton", {
|
|
298
|
+
enumerable: true,
|
|
299
|
+
get: function () {
|
|
300
|
+
return _Skeleton.Skeleton;
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
Object.defineProperty(exports, "SkeletonProps", {
|
|
304
|
+
enumerable: true,
|
|
305
|
+
get: function () {
|
|
306
|
+
return _Skeleton.SkeletonProps;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
295
309
|
|
|
296
310
|
var _reactCore = require("@tecsinapse/react-core");
|
|
297
311
|
|
|
@@ -344,4 +358,6 @@ var _Calendar = require("./components/molecules/Calendar");
|
|
|
344
358
|
var _DateTimeSelector = require("./components/molecules/DateTimeSelector");
|
|
345
359
|
|
|
346
360
|
var _Modal = require("./components/atoms/Modal");
|
|
361
|
+
|
|
362
|
+
var _Skeleton = require("./components/atoms/Skeleton");
|
|
347
363
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAIA;;AAIA;;AACA;;AAIA;;AACA;;AACA;;AAIA;;AAIA;;AACA;;AACA;;AACA;;AAQA","sourcesContent":["export * from '@tecsinapse/react-core';\nexport { Header, HeaderProps } from './components/atoms/Header';\nexport { Select, SelectNativeProps } from './components/molecules/Select';\nexport { Input, InputNativeProps } from './components/atoms/Input';\nexport { TextArea, TextAreaProps } from './components/atoms/TextArea';\nexport { Text, TextNativeProps } from './components/atoms/Text';\nexport {\n Error,\n Loading,\n Success,\n Button,\n ButtonNativeProps,\n} from './components/atoms/Button';\nexport { GroupButtonOption } from './components/atoms/GroupButton';\nexport {\n InputPassword,\n InputPasswordNativeProps,\n} from './components/molecules/InputPassword';\nexport {\n BottomNavigator,\n BottomNavigatorProps,\n} from './components/atoms/BottomNavigator';\nexport { Tag, TagProps } from './components/atoms/Tag';\nexport {\n SnappingSlider,\n SnappingSliderProps,\n} from './components/atoms/SnappingSlider';\nexport { Badge, BadgeNativeProps } from './components/atoms/Badge';\nexport { Snackbar, SnackbarNativeProps } from './components/molecules/Snackbar';\nexport {\n DatePicker,\n NativeDatePickerProps,\n} from './components/molecules/DatePicker';\nexport {\n DateTimePicker,\n NativeDateTimePickerProps,\n} from './components/molecules/DateTimePicker';\nexport { Avatar } from './components/atoms/Avatar';\nexport { Calendar } from './components/molecules/Calendar';\nexport { DateTimeSelector } from './components/molecules/DateTimeSelector';\nexport {\n ModalGroupManager,\n ModalView,\n ModalLifecycleHandler,\n useLazyModalManager,\n useModalManager,\n IBaseModal,\n} from './components/atoms/Modal';\nexport { Skeleton, SkeletonProps } from './components/atoms/Skeleton';\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/react-native-kit",
|
|
3
3
|
"description": "TecSinapse React Native components",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.15.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@emotion/native": "^11.0.0",
|
|
15
15
|
"@emotion/react": "^11.4.1",
|
|
16
|
-
"@tecsinapse/react-core": "^1.
|
|
16
|
+
"@tecsinapse/react-core": "^1.14.0",
|
|
17
|
+
"react-native-linear-gradient": "^2.5.6"
|
|
17
18
|
},
|
|
18
19
|
"repository": {
|
|
19
20
|
"type": "git",
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
"peerDependencies": {
|
|
28
29
|
"react": ">=16.8.0",
|
|
29
30
|
"react-native": ">=0.64.0",
|
|
31
|
+
"react-native-linear-gradient": "^2.5.6",
|
|
30
32
|
"react-native-safe-area-context": "^3.1.9",
|
|
31
33
|
"react-native-vector-icons": ">=8.1.0",
|
|
32
34
|
"uuid": "^8.3.2"
|
|
@@ -34,5 +36,5 @@
|
|
|
34
36
|
"devDependencies": {
|
|
35
37
|
"@types/uuid": "^8.3.3"
|
|
36
38
|
},
|
|
37
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "fb1d3b3bfa028174ef30ee2c9387a04c81699c3f"
|
|
38
40
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
import { pulseAnimation } from './animation';
|
|
4
|
+
import { IAnimationComponent } from './types';
|
|
5
|
+
|
|
6
|
+
export const Pulse = ({
|
|
7
|
+
active = true,
|
|
8
|
+
width,
|
|
9
|
+
height,
|
|
10
|
+
childrenLayout,
|
|
11
|
+
}: IAnimationComponent) => {
|
|
12
|
+
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
pulseAnimation(active, animatedValue);
|
|
16
|
+
}, [active]);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Animated.View
|
|
20
|
+
style={{
|
|
21
|
+
width: width ?? childrenLayout.width,
|
|
22
|
+
height: height ?? childrenLayout.height,
|
|
23
|
+
backgroundColor: 'rgba(0,0,0,0.05)',
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
top: childrenLayout.x ?? 0,
|
|
26
|
+
left: childrenLayout.y ?? 0,
|
|
27
|
+
zIndex: 2,
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
opacity: animatedValue,
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { BorderRadiusType } from '@tecsinapse/react-core';
|
|
3
|
+
import { LayoutChangeEvent, View, ViewProps } from 'react-native';
|
|
4
|
+
import { Wrapper } from './styled';
|
|
5
|
+
import { Wave } from './Wave';
|
|
6
|
+
import { Pulse } from './Pulse';
|
|
7
|
+
import { ChildrenLayout } from './types';
|
|
8
|
+
|
|
9
|
+
export interface SkeletonProps extends ViewProps {
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
radius?: BorderRadiusType;
|
|
13
|
+
active?: boolean;
|
|
14
|
+
animation?: 'wave' | 'pulse';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Skeleton: React.FC<SkeletonProps> = ({
|
|
18
|
+
children,
|
|
19
|
+
width,
|
|
20
|
+
height,
|
|
21
|
+
radius,
|
|
22
|
+
active = true,
|
|
23
|
+
animation = 'wave',
|
|
24
|
+
...rest
|
|
25
|
+
}) => {
|
|
26
|
+
const [childrenLayout, setChildrenLayout] = useState<ChildrenLayout>({
|
|
27
|
+
width: 0,
|
|
28
|
+
height: 0,
|
|
29
|
+
y: 0,
|
|
30
|
+
x: 0,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (!width && !height && !children) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
'[Skeleton] You should provide children or specify width and height'
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const getChildrenLayout = (event: LayoutChangeEvent) => {
|
|
40
|
+
setChildrenLayout(event.nativeEvent.layout);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Wrapper width={width} height={height} radius={radius} {...rest}>
|
|
45
|
+
{active && animation === 'wave' ? (
|
|
46
|
+
<Wave
|
|
47
|
+
active={active}
|
|
48
|
+
width={width}
|
|
49
|
+
height={height}
|
|
50
|
+
childrenLayout={childrenLayout}
|
|
51
|
+
/>
|
|
52
|
+
) : (
|
|
53
|
+
<Pulse
|
|
54
|
+
active={active}
|
|
55
|
+
width={width}
|
|
56
|
+
height={height}
|
|
57
|
+
childrenLayout={childrenLayout}
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
60
|
+
<View
|
|
61
|
+
onLayout={event => getChildrenLayout(event)}
|
|
62
|
+
style={{ opacity: active ? 0 : 1 }}
|
|
63
|
+
pointerEvents={active ? 'none' : 'auto'}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</View>
|
|
67
|
+
</Wrapper>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default Skeleton;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
import { waveAnimation } from './animation';
|
|
5
|
+
import { IAnimationComponent } from './types';
|
|
6
|
+
|
|
7
|
+
const AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient);
|
|
8
|
+
|
|
9
|
+
export const Wave = ({
|
|
10
|
+
active = true,
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
childrenLayout,
|
|
14
|
+
}: IAnimationComponent) => {
|
|
15
|
+
const range = width ?? childrenLayout.width;
|
|
16
|
+
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
17
|
+
|
|
18
|
+
const translateX = animatedValue.interpolate({
|
|
19
|
+
inputRange: [0, 1],
|
|
20
|
+
outputRange: [-range, range],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
waveAnimation(active, animatedValue);
|
|
25
|
+
}, [active]);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<AnimatedLinearGradient
|
|
29
|
+
colors={[
|
|
30
|
+
'transparent',
|
|
31
|
+
'rgba(0,0,0,0.05)',
|
|
32
|
+
'rgba(0,0,0,0.1)',
|
|
33
|
+
'transparent',
|
|
34
|
+
]}
|
|
35
|
+
start={{ x: 0, y: 0 }}
|
|
36
|
+
end={{ x: 1, y: 0 }}
|
|
37
|
+
style={{
|
|
38
|
+
width: width ?? childrenLayout.width,
|
|
39
|
+
height: height ?? childrenLayout.height,
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: childrenLayout.y ?? 0,
|
|
42
|
+
left: childrenLayout.x ?? 0,
|
|
43
|
+
zIndex: 2,
|
|
44
|
+
overflow: 'hidden',
|
|
45
|
+
transform: [
|
|
46
|
+
{
|
|
47
|
+
translateX: translateX,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Animated, Easing } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const waveAnimation = (
|
|
4
|
+
active: boolean,
|
|
5
|
+
animatedValue: Animated.Value
|
|
6
|
+
): void => {
|
|
7
|
+
if (active) {
|
|
8
|
+
Animated.loop(
|
|
9
|
+
Animated.timing(animatedValue, {
|
|
10
|
+
toValue: 1,
|
|
11
|
+
duration: 1600,
|
|
12
|
+
easing: Easing.inOut(Easing.linear),
|
|
13
|
+
useNativeDriver: true,
|
|
14
|
+
})
|
|
15
|
+
).start();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
Animated.timing(animatedValue, {
|
|
19
|
+
toValue: 0,
|
|
20
|
+
useNativeDriver: true,
|
|
21
|
+
}).start();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const pulseAnimation = (
|
|
25
|
+
active: boolean,
|
|
26
|
+
animatedValue: Animated.Value
|
|
27
|
+
): void => {
|
|
28
|
+
if (active) {
|
|
29
|
+
Animated.loop(
|
|
30
|
+
Animated.sequence([
|
|
31
|
+
Animated.timing(animatedValue, {
|
|
32
|
+
toValue: 1,
|
|
33
|
+
duration: 800,
|
|
34
|
+
useNativeDriver: true,
|
|
35
|
+
}),
|
|
36
|
+
Animated.timing(animatedValue, {
|
|
37
|
+
toValue: 0,
|
|
38
|
+
duration: 800,
|
|
39
|
+
useNativeDriver: true,
|
|
40
|
+
}),
|
|
41
|
+
])
|
|
42
|
+
).start();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
Animated.timing(animatedValue, {
|
|
46
|
+
toValue: 0,
|
|
47
|
+
useNativeDriver: true,
|
|
48
|
+
}).start();
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Skeleton, SkeletonProps } from './Skeleton';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { RFValueStr, StyleProps } from '@tecsinapse/react-core';
|
|
3
|
+
import { SkeletonProps } from './Skeleton';
|
|
4
|
+
|
|
5
|
+
export const Wrapper = styled.View<Partial<StyleProps & SkeletonProps>>`
|
|
6
|
+
width: ${({ width }) => (width ? `${RFValueStr(`${width}px`)}` : '100%')};
|
|
7
|
+
height: ${({ height }) => (height ? `${RFValueStr(`${height}px`)}` : 'auto')};
|
|
8
|
+
border-radius: ${({ theme, radius }: StyleProps & Partial<SkeletonProps>) =>
|
|
9
|
+
radius ? theme.borderRadius[radius] : 0};
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
position: relative;
|
|
12
|
+
`;
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,13 @@ export { Select, SelectNativeProps } from './components/molecules/Select';
|
|
|
4
4
|
export { Input, InputNativeProps } from './components/atoms/Input';
|
|
5
5
|
export { TextArea, TextAreaProps } from './components/atoms/TextArea';
|
|
6
6
|
export { Text, TextNativeProps } from './components/atoms/Text';
|
|
7
|
-
export {
|
|
7
|
+
export {
|
|
8
|
+
Error,
|
|
9
|
+
Loading,
|
|
10
|
+
Success,
|
|
11
|
+
Button,
|
|
12
|
+
ButtonNativeProps,
|
|
13
|
+
} from './components/atoms/Button';
|
|
8
14
|
export { GroupButtonOption } from './components/atoms/GroupButton';
|
|
9
15
|
export {
|
|
10
16
|
InputPassword,
|
|
@@ -21,9 +27,23 @@ export {
|
|
|
21
27
|
} from './components/atoms/SnappingSlider';
|
|
22
28
|
export { Badge, BadgeNativeProps } from './components/atoms/Badge';
|
|
23
29
|
export { Snackbar, SnackbarNativeProps } from './components/molecules/Snackbar';
|
|
24
|
-
export {
|
|
25
|
-
|
|
30
|
+
export {
|
|
31
|
+
DatePicker,
|
|
32
|
+
NativeDatePickerProps,
|
|
33
|
+
} from './components/molecules/DatePicker';
|
|
34
|
+
export {
|
|
35
|
+
DateTimePicker,
|
|
36
|
+
NativeDateTimePickerProps,
|
|
37
|
+
} from './components/molecules/DateTimePicker';
|
|
26
38
|
export { Avatar } from './components/atoms/Avatar';
|
|
27
39
|
export { Calendar } from './components/molecules/Calendar';
|
|
28
40
|
export { DateTimeSelector } from './components/molecules/DateTimeSelector';
|
|
29
|
-
export {
|
|
41
|
+
export {
|
|
42
|
+
ModalGroupManager,
|
|
43
|
+
ModalView,
|
|
44
|
+
ModalLifecycleHandler,
|
|
45
|
+
useLazyModalManager,
|
|
46
|
+
useModalManager,
|
|
47
|
+
IBaseModal,
|
|
48
|
+
} from './components/atoms/Modal';
|
|
49
|
+
export { Skeleton, SkeletonProps } from './components/atoms/Skeleton';
|