@proximus/lavender-skeleton-native 0.1.0-alpha.0 → 0.1.0-alpha.7
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/dist/CardSkeleton.js +18 -0
- package/dist/CarouselSkeleton.js +28 -0
- package/dist/DataUsageSkeleton.js +28 -0
- package/dist/MessageCardSkeleton.js +27 -0
- package/dist/Skeleton.js +125 -0
- package/dist/StatusSkeleton.js +13 -0
- package/dist/TileSkeleton.js +31 -0
- package/dist/types.js +1 -0
- package/package.json +9 -29
- package/CHANGELOG.md +0 -10
- package/src/CardSkeleton.tsx +0 -29
- package/src/CarouselSkeleton.tsx +0 -50
- package/src/DataUsageSkeleton.tsx +0 -45
- package/src/MessageCardSkeleton.tsx +0 -43
- package/src/Skeleton.tsx +0 -187
- package/src/StatusSkeleton.tsx +0 -21
- package/src/TileSkeleton.tsx +0 -46
- package/src/types.ts +0 -6
- package/tsconfig.json +0 -8
- /package/{src/index.ts → dist/index.js} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { PxSkeleton } from './Skeleton';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
+
export function PxCardSkeleton({ inverted, containerStyle }) {
|
|
6
|
+
const { theme } = useTheme();
|
|
7
|
+
return (React.createElement(View, { style: [containerStyle, { borderRadius: theme.t('RadiusMain').number }] },
|
|
8
|
+
React.createElement(PxSkeleton, { variant: 'assetL', inverted: inverted, expand: true }),
|
|
9
|
+
React.createElement(View, { style: {
|
|
10
|
+
gap: theme.t('SpacingSMobile').number,
|
|
11
|
+
borderBottomEndRadius: theme.t('RadiusMain').number,
|
|
12
|
+
borderBottomStartRadius: theme.t('RadiusMain').number,
|
|
13
|
+
padding: theme.t('PaddingSMobile').number,
|
|
14
|
+
backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
|
|
15
|
+
} },
|
|
16
|
+
React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted }),
|
|
17
|
+
React.createElement(PxSkeleton, { variant: 'body', inverted: inverted }))));
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { PxSkeleton } from './Skeleton';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
+
export function PxCarouselSkeleton({ inverted, itemsVisible = 1, containerStyle, }) {
|
|
6
|
+
const { theme } = useTheme();
|
|
7
|
+
const panelVariant = itemsVisible === 1 ? 'panel' : 'panelS';
|
|
8
|
+
return (React.createElement(View, { style: [
|
|
9
|
+
containerStyle,
|
|
10
|
+
{
|
|
11
|
+
gap: theme.t('SpacingSMobile').number,
|
|
12
|
+
borderRadius: theme.t('RadiusMain').number,
|
|
13
|
+
},
|
|
14
|
+
] },
|
|
15
|
+
React.createElement(View, { style: {
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
gap: theme.t('SpacingSMobile').number,
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
} },
|
|
20
|
+
React.createElement(PxSkeleton, { inverted: inverted, variant: panelVariant }),
|
|
21
|
+
React.createElement(PxSkeleton, { inverted: inverted, variant: panelVariant }),
|
|
22
|
+
React.createElement(PxSkeleton, { inverted: inverted, variant: panelVariant })),
|
|
23
|
+
React.createElement(View, { style: {
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
} },
|
|
27
|
+
React.createElement(PxSkeleton, { inverted: inverted, variant: 'body' }))));
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { PxSkeleton } from './Skeleton';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
+
import { PxStatusSkeleton } from './StatusSkeleton';
|
|
6
|
+
export function PxDataUsageSkeleton({ inverted, containerStyle, }) {
|
|
7
|
+
const { theme } = useTheme();
|
|
8
|
+
return (React.createElement(View, { style: [
|
|
9
|
+
containerStyle,
|
|
10
|
+
{
|
|
11
|
+
gap: theme.t('SpacingDefaultMobile').number,
|
|
12
|
+
borderRadius: theme.t('RadiusMain').number,
|
|
13
|
+
padding: theme.t('PaddingSMobile').number,
|
|
14
|
+
backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
|
|
15
|
+
},
|
|
16
|
+
] },
|
|
17
|
+
React.createElement(View, { style: {
|
|
18
|
+
gap: theme.t('SpacingXsMobile').number,
|
|
19
|
+
} },
|
|
20
|
+
React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted }),
|
|
21
|
+
React.createElement(PxSkeleton, { variant: 'body', inverted: inverted })),
|
|
22
|
+
React.createElement(View, { style: {
|
|
23
|
+
gap: theme.t('SpacingXsMobile').number,
|
|
24
|
+
} },
|
|
25
|
+
React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted }),
|
|
26
|
+
React.createElement(PxSkeleton, { variant: 'body', inverted: inverted, expand: true }),
|
|
27
|
+
React.createElement(PxStatusSkeleton, null))));
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { PxSkeleton } from './Skeleton';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
+
export function PxMessageCardSkeleton({ inverted, containerStyle, }) {
|
|
6
|
+
const { theme } = useTheme();
|
|
7
|
+
return (React.createElement(View, { style: [
|
|
8
|
+
containerStyle,
|
|
9
|
+
{
|
|
10
|
+
backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
|
|
11
|
+
borderRadius: theme.t('RadiusMain').number,
|
|
12
|
+
padding: theme.t('PaddingSMobile').number,
|
|
13
|
+
gap: theme.t('SpacingSMobile').number,
|
|
14
|
+
},
|
|
15
|
+
] },
|
|
16
|
+
React.createElement(View, { style: {
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
gap: theme.t('SpacingSMobile').number,
|
|
19
|
+
} },
|
|
20
|
+
React.createElement(PxSkeleton, { variant: 'assetS', inverted: inverted }),
|
|
21
|
+
React.createElement(View, { style: { flex: 1, gap: theme.t('SpacingSMobile').number } },
|
|
22
|
+
React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted }),
|
|
23
|
+
React.createElement(PxSkeleton, { variant: 'body', inverted: inverted })),
|
|
24
|
+
React.createElement(PxSkeleton, { variant: 'actionS', inverted: inverted })),
|
|
25
|
+
React.createElement(View, null,
|
|
26
|
+
React.createElement(PxSkeleton, { variant: 'actionL', inverted: inverted }))));
|
|
27
|
+
}
|
package/dist/Skeleton.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, Easing, StyleSheet, View, } from 'react-native';
|
|
3
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
+
const DURATION = 1500;
|
|
6
|
+
const ANGLE = 18;
|
|
7
|
+
function useColors({ inverted }) {
|
|
8
|
+
const { theme } = useTheme();
|
|
9
|
+
const invertedSuffix = inverted ? 'Inverted' : 'Default';
|
|
10
|
+
const backgroundColor = theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`);
|
|
11
|
+
const highlightColor = inverted ? 'rgba(0,0,0,1)' : 'rgba(255,255,255,1)';
|
|
12
|
+
const highlightColorWithOpacity = inverted
|
|
13
|
+
? 'rgba(0,0,0,0.24)'
|
|
14
|
+
: 'rgba(255,255,250,.24)';
|
|
15
|
+
return { backgroundColor, highlightColor, highlightColorWithOpacity };
|
|
16
|
+
}
|
|
17
|
+
export function PxSkeleton(props) {
|
|
18
|
+
const { inverted = false, containerStyle, variant, expand = false } = props;
|
|
19
|
+
const [layout, setLayout] = useState({ width: 0, height: 0 });
|
|
20
|
+
const translateX = useRef(new Animated.Value(0)).current;
|
|
21
|
+
const { theme } = useTheme();
|
|
22
|
+
const { backgroundColor, highlightColor, highlightColorWithOpacity } = useColors({ inverted });
|
|
23
|
+
const loopRef = useRef(null);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (layout.width <= 0)
|
|
26
|
+
return;
|
|
27
|
+
// Stop any previous loop before starting a new one
|
|
28
|
+
loopRef.current?.stop();
|
|
29
|
+
translateX.setValue(-layout.width * 1.5);
|
|
30
|
+
const loop = Animated.loop(Animated.timing(translateX, {
|
|
31
|
+
toValue: layout.width,
|
|
32
|
+
easing: Easing.cubic,
|
|
33
|
+
duration: DURATION,
|
|
34
|
+
useNativeDriver: true,
|
|
35
|
+
}));
|
|
36
|
+
loopRef.current = loop;
|
|
37
|
+
loop.start();
|
|
38
|
+
return () => {
|
|
39
|
+
loop.stop();
|
|
40
|
+
loopRef.current = null;
|
|
41
|
+
};
|
|
42
|
+
}, [translateX, layout]);
|
|
43
|
+
return (React.createElement(View, { style: [
|
|
44
|
+
containerStyle,
|
|
45
|
+
{
|
|
46
|
+
backgroundColor,
|
|
47
|
+
borderRadius: ['actionS', 'actionL'].includes(variant)
|
|
48
|
+
? theme.t('RadiusPill').number
|
|
49
|
+
: theme.t('RadiusMain').number,
|
|
50
|
+
overflow: 'hidden',
|
|
51
|
+
},
|
|
52
|
+
styles[props.variant],
|
|
53
|
+
{ ...(expand ? { width: '100%', maxWidth: undefined } : undefined) },
|
|
54
|
+
], onLayout: (e) => {
|
|
55
|
+
const { width, height } = e.nativeEvent.layout;
|
|
56
|
+
setLayout({ width, height });
|
|
57
|
+
} },
|
|
58
|
+
React.createElement(Animated.View, { style: {
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
top: -3 * layout.height, // ensure coverage when rotated
|
|
61
|
+
bottom: -3 * layout.height,
|
|
62
|
+
width: layout.width,
|
|
63
|
+
transform: [{ translateX }, { rotate: `${ANGLE}deg` }],
|
|
64
|
+
} }, layout.width > 0 && ( // Render gradient only when layout is measured will crash otherwise
|
|
65
|
+
React.createElement(LinearGradient, { style: { flex: 1 }, pointerEvents: "none", colors: [
|
|
66
|
+
highlightColorWithOpacity,
|
|
67
|
+
highlightColor,
|
|
68
|
+
highlightColorWithOpacity,
|
|
69
|
+
], locations: [0, 0.5, 1], start: { x: 0, y: 0 }, end: { x: 1, y: 0 } })))));
|
|
70
|
+
}
|
|
71
|
+
const styles = StyleSheet.create({
|
|
72
|
+
headingS: {
|
|
73
|
+
height: 24,
|
|
74
|
+
minWidth: 120,
|
|
75
|
+
maxWidth: 240,
|
|
76
|
+
},
|
|
77
|
+
headingM: {
|
|
78
|
+
height: 32,
|
|
79
|
+
minWidth: 120,
|
|
80
|
+
maxWidth: 240,
|
|
81
|
+
},
|
|
82
|
+
headingL: {
|
|
83
|
+
height: 40,
|
|
84
|
+
minWidth: 120,
|
|
85
|
+
maxWidth: 240,
|
|
86
|
+
},
|
|
87
|
+
body: {
|
|
88
|
+
height: 16,
|
|
89
|
+
maxWidth: 300,
|
|
90
|
+
minWidth: 120,
|
|
91
|
+
},
|
|
92
|
+
bodyS: {
|
|
93
|
+
height: 16,
|
|
94
|
+
maxWidth: 180,
|
|
95
|
+
minWidth: 120,
|
|
96
|
+
},
|
|
97
|
+
actionS: {
|
|
98
|
+
height: 40,
|
|
99
|
+
width: 40,
|
|
100
|
+
},
|
|
101
|
+
actionL: {
|
|
102
|
+
height: 48,
|
|
103
|
+
width: 160,
|
|
104
|
+
},
|
|
105
|
+
assetS: {
|
|
106
|
+
height: 40,
|
|
107
|
+
width: 40,
|
|
108
|
+
},
|
|
109
|
+
assetXS: {
|
|
110
|
+
height: 16,
|
|
111
|
+
width: 16,
|
|
112
|
+
},
|
|
113
|
+
assetL: {
|
|
114
|
+
height: 80,
|
|
115
|
+
width: 80,
|
|
116
|
+
},
|
|
117
|
+
panel: {
|
|
118
|
+
height: 200,
|
|
119
|
+
width: 300,
|
|
120
|
+
},
|
|
121
|
+
panelS: {
|
|
122
|
+
height: 133,
|
|
123
|
+
width: 144,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { PxSkeleton } from './Skeleton';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
+
export function PxStatusSkeleton({ inverted, containerStyle }) {
|
|
6
|
+
const { theme } = useTheme();
|
|
7
|
+
return (React.createElement(View, { style: [
|
|
8
|
+
containerStyle,
|
|
9
|
+
{ flexDirection: 'row', gap: theme.t('Spacing2xsMobile').number },
|
|
10
|
+
] },
|
|
11
|
+
React.createElement(PxSkeleton, { variant: 'assetXS', inverted: inverted }),
|
|
12
|
+
React.createElement(PxSkeleton, { variant: 'body', inverted: inverted })));
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { PxSkeleton } from './Skeleton';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
+
function PxTileSkeleton({ inverted }) {
|
|
6
|
+
const { theme } = useTheme();
|
|
7
|
+
return (React.createElement(View, { style: {
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
gap: theme.t('SpacingSMobile').number,
|
|
10
|
+
borderBottomEndRadius: theme.t('RadiusMain').number,
|
|
11
|
+
borderBottomStartRadius: theme.t('RadiusMain').number,
|
|
12
|
+
padding: theme.t('PaddingSMobile').number,
|
|
13
|
+
backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
|
|
14
|
+
} },
|
|
15
|
+
React.createElement(PxSkeleton, { variant: 'assetS', inverted: inverted }),
|
|
16
|
+
React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted })));
|
|
17
|
+
}
|
|
18
|
+
export function PxTilesSkeleton({ inverted, containerStyle }) {
|
|
19
|
+
const { theme } = useTheme();
|
|
20
|
+
return (React.createElement(View, { style: [
|
|
21
|
+
containerStyle,
|
|
22
|
+
{
|
|
23
|
+
gap: theme.t('SpacingSMobile').number,
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
},
|
|
27
|
+
] },
|
|
28
|
+
React.createElement(PxTileSkeleton, { inverted: inverted }),
|
|
29
|
+
React.createElement(PxTileSkeleton, { inverted: inverted }),
|
|
30
|
+
React.createElement(PxTileSkeleton, { inverted: inverted })));
|
|
31
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,38 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-skeleton-native",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"description": "Lavender skeleton component",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"main": "
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"prepublish": "yarn clean && yarn build",
|
|
11
|
-
"build": "npx tsc -p tsconfig.json"
|
|
12
|
-
},
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
13
10
|
"peerDependencies": {
|
|
14
|
-
"@proximus/lavender-common-native": "
|
|
15
|
-
"@proximus/lavender-styling-native": "
|
|
16
|
-
"@proximus/lavender-texts-native": "
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@proximus/lavender-common-native": "0.1.0-alpha.4",
|
|
20
|
-
"@proximus/lavender-styling-native": "0.1.0-alpha.3",
|
|
21
|
-
"@proximus/lavender-texts-native": "0.1.0-alpha.4"
|
|
11
|
+
"@proximus/lavender-common-native": "*",
|
|
12
|
+
"@proximus/lavender-styling-native": "*",
|
|
13
|
+
"@proximus/lavender-texts-native": "*"
|
|
22
14
|
},
|
|
23
15
|
"publishConfig": {
|
|
24
16
|
"access": "public"
|
|
25
|
-
}
|
|
26
|
-
"lerna": {
|
|
27
|
-
"command": {
|
|
28
|
-
"publish": {
|
|
29
|
-
"assets": [
|
|
30
|
-
"dist",
|
|
31
|
-
"src",
|
|
32
|
-
"package.json"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"gitHead": "8794f25d197ead361646d6e655ce64ba1c7f60c0"
|
|
17
|
+
}
|
|
38
18
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# 0.1.0-alpha.0 (2025-09-24)
|
|
7
|
-
|
|
8
|
-
### Features
|
|
9
|
-
|
|
10
|
-
- **BCRI-4333430:** skeleton components ([#23](https://github.com/Pxs-Corporate/react-native-lavender/issues/23)) ([184f02f](https://github.com/Pxs-Corporate/react-native-lavender/commit/184f02f4f58dd825288b4db905b4bcbe74756ff8))
|
package/src/CardSkeleton.tsx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
2
|
-
import { PxSkeleton } from './Skeleton';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
-
import { ISkeletonProps } from './types';
|
|
6
|
-
|
|
7
|
-
export function PxCardSkeleton({ inverted, containerStyle }: ISkeletonProps) {
|
|
8
|
-
const { theme } = useTheme();
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<View
|
|
12
|
-
style={[containerStyle, { borderRadius: theme.t('RadiusMain').number }]}
|
|
13
|
-
>
|
|
14
|
-
<PxSkeleton variant={'assetL'} inverted={inverted} expand />
|
|
15
|
-
<View
|
|
16
|
-
style={{
|
|
17
|
-
gap: theme.t('SpacingSMobile').number,
|
|
18
|
-
borderBottomEndRadius: theme.t('RadiusMain').number,
|
|
19
|
-
borderBottomStartRadius: theme.t('RadiusMain').number,
|
|
20
|
-
padding: theme.t('PaddingSMobile').number,
|
|
21
|
-
backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
<PxSkeleton variant={'headingS'} inverted={inverted} />
|
|
25
|
-
<PxSkeleton variant={'body'} inverted={inverted} />
|
|
26
|
-
</View>
|
|
27
|
-
</View>
|
|
28
|
-
);
|
|
29
|
-
}
|
package/src/CarouselSkeleton.tsx
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
2
|
-
import { PxSkeleton } from './Skeleton';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
-
import { ISkeletonProps } from './types';
|
|
6
|
-
|
|
7
|
-
export function PxCarouselSkeleton({
|
|
8
|
-
inverted,
|
|
9
|
-
itemsVisible = 1,
|
|
10
|
-
containerStyle,
|
|
11
|
-
}: {
|
|
12
|
-
itemsVisible?: number;
|
|
13
|
-
} & ISkeletonProps) {
|
|
14
|
-
const { theme } = useTheme();
|
|
15
|
-
|
|
16
|
-
const panelVariant = itemsVisible === 1 ? 'panel' : 'panelS';
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<View
|
|
20
|
-
style={[
|
|
21
|
-
containerStyle,
|
|
22
|
-
{
|
|
23
|
-
gap: theme.t('SpacingSMobile').number,
|
|
24
|
-
borderRadius: theme.t('RadiusMain').number,
|
|
25
|
-
},
|
|
26
|
-
]}
|
|
27
|
-
>
|
|
28
|
-
<View
|
|
29
|
-
style={{
|
|
30
|
-
flexDirection: 'row',
|
|
31
|
-
gap: theme.t('SpacingSMobile').number,
|
|
32
|
-
overflow: 'hidden',
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
<PxSkeleton inverted={inverted} variant={panelVariant} />
|
|
36
|
-
<PxSkeleton inverted={inverted} variant={panelVariant} />
|
|
37
|
-
<PxSkeleton inverted={inverted} variant={panelVariant} />
|
|
38
|
-
</View>
|
|
39
|
-
|
|
40
|
-
<View
|
|
41
|
-
style={{
|
|
42
|
-
justifyContent: 'center',
|
|
43
|
-
flexDirection: 'row',
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
<PxSkeleton inverted={inverted} variant={'body'} />
|
|
47
|
-
</View>
|
|
48
|
-
</View>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
2
|
-
import { PxSkeleton } from './Skeleton';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
-
import { PxStatusSkeleton } from './StatusSkeleton';
|
|
6
|
-
import { ISkeletonProps } from './types';
|
|
7
|
-
|
|
8
|
-
export function PxDataUsageSkeleton({
|
|
9
|
-
inverted,
|
|
10
|
-
containerStyle,
|
|
11
|
-
}: ISkeletonProps) {
|
|
12
|
-
const { theme } = useTheme();
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<View
|
|
16
|
-
style={[
|
|
17
|
-
containerStyle,
|
|
18
|
-
{
|
|
19
|
-
gap: theme.t('SpacingDefaultMobile').number,
|
|
20
|
-
borderRadius: theme.t('RadiusMain').number,
|
|
21
|
-
padding: theme.t('PaddingSMobile').number,
|
|
22
|
-
backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
|
|
23
|
-
},
|
|
24
|
-
]}
|
|
25
|
-
>
|
|
26
|
-
<View
|
|
27
|
-
style={{
|
|
28
|
-
gap: theme.t('SpacingXsMobile').number,
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
<PxSkeleton variant={'headingS'} inverted={inverted} />
|
|
32
|
-
<PxSkeleton variant={'body'} inverted={inverted} />
|
|
33
|
-
</View>
|
|
34
|
-
<View
|
|
35
|
-
style={{
|
|
36
|
-
gap: theme.t('SpacingXsMobile').number,
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
<PxSkeleton variant={'headingS'} inverted={inverted} />
|
|
40
|
-
<PxSkeleton variant={'body'} inverted={inverted} expand />
|
|
41
|
-
<PxStatusSkeleton />
|
|
42
|
-
</View>
|
|
43
|
-
</View>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
2
|
-
import { PxSkeleton } from './Skeleton';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
-
import { ISkeletonProps } from './types';
|
|
6
|
-
|
|
7
|
-
export function PxMessageCardSkeleton({
|
|
8
|
-
inverted,
|
|
9
|
-
containerStyle,
|
|
10
|
-
}: ISkeletonProps) {
|
|
11
|
-
const { theme } = useTheme();
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<View
|
|
15
|
-
style={[
|
|
16
|
-
containerStyle,
|
|
17
|
-
{
|
|
18
|
-
backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
|
|
19
|
-
borderRadius: theme.t('RadiusMain').number,
|
|
20
|
-
padding: theme.t('PaddingSMobile').number,
|
|
21
|
-
gap: theme.t('SpacingSMobile').number,
|
|
22
|
-
},
|
|
23
|
-
]}
|
|
24
|
-
>
|
|
25
|
-
<View
|
|
26
|
-
style={{
|
|
27
|
-
flexDirection: 'row',
|
|
28
|
-
gap: theme.t('SpacingSMobile').number,
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
<PxSkeleton variant={'assetS'} inverted={inverted} />
|
|
32
|
-
<View style={{ flex: 1, gap: theme.t('SpacingSMobile').number }}>
|
|
33
|
-
<PxSkeleton variant={'headingS'} inverted={inverted} />
|
|
34
|
-
<PxSkeleton variant={'body'} inverted={inverted} />
|
|
35
|
-
</View>
|
|
36
|
-
<PxSkeleton variant={'actionS'} inverted={inverted} />
|
|
37
|
-
</View>
|
|
38
|
-
<View>
|
|
39
|
-
<PxSkeleton variant={'actionL'} inverted={inverted} />
|
|
40
|
-
</View>
|
|
41
|
-
</View>
|
|
42
|
-
);
|
|
43
|
-
}
|
package/src/Skeleton.tsx
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Animated,
|
|
4
|
-
Easing,
|
|
5
|
-
LayoutChangeEvent,
|
|
6
|
-
StyleProp,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
View,
|
|
9
|
-
ViewProps,
|
|
10
|
-
ViewStyle,
|
|
11
|
-
} from 'react-native';
|
|
12
|
-
import LinearGradient from 'react-native-linear-gradient';
|
|
13
|
-
import { useTheme } from '@proximus/lavender-styling-native';
|
|
14
|
-
|
|
15
|
-
const DURATION = 1500;
|
|
16
|
-
const ANGLE = 18;
|
|
17
|
-
|
|
18
|
-
export type SkeletonGradientProps = ViewProps & {
|
|
19
|
-
/** Predefined shape */
|
|
20
|
-
variant:
|
|
21
|
-
| 'headingS'
|
|
22
|
-
| 'headingM'
|
|
23
|
-
| 'headingL'
|
|
24
|
-
| 'body'
|
|
25
|
-
| 'bodyS'
|
|
26
|
-
| 'actionS'
|
|
27
|
-
| 'actionL'
|
|
28
|
-
| 'assetXS'
|
|
29
|
-
| 'assetS'
|
|
30
|
-
| 'assetL'
|
|
31
|
-
| 'panel'
|
|
32
|
-
| 'panelS';
|
|
33
|
-
width?: number | string;
|
|
34
|
-
containerStyle?: StyleProp<ViewStyle>;
|
|
35
|
-
expand?: boolean;
|
|
36
|
-
inverted?: boolean;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function useColors({ inverted }: { inverted: boolean }) {
|
|
40
|
-
const { theme } = useTheme();
|
|
41
|
-
const invertedSuffix = inverted ? 'Inverted' : 'Default';
|
|
42
|
-
const backgroundColor = theme.t(
|
|
43
|
-
`ColorBackgroundStateDisabled${invertedSuffix}`
|
|
44
|
-
);
|
|
45
|
-
const highlightColor = inverted ? 'rgba(0,0,0,1)' : 'rgba(255,255,255,1)';
|
|
46
|
-
const highlightColorWithOpacity = inverted
|
|
47
|
-
? 'rgba(0,0,0,0.24)'
|
|
48
|
-
: 'rgba(255,255,250,.24)';
|
|
49
|
-
return { backgroundColor, highlightColor, highlightColorWithOpacity };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function PxSkeleton(props: SkeletonGradientProps) {
|
|
53
|
-
const { inverted = false, containerStyle, variant, expand = false } = props;
|
|
54
|
-
const [layout, setLayout] = useState({ width: 0, height: 0 });
|
|
55
|
-
const translateX = useRef(new Animated.Value(0)).current;
|
|
56
|
-
const { theme } = useTheme();
|
|
57
|
-
const { backgroundColor, highlightColor, highlightColorWithOpacity } =
|
|
58
|
-
useColors({ inverted });
|
|
59
|
-
const loopRef = useRef<Animated.CompositeAnimation | null>(null);
|
|
60
|
-
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (layout.width <= 0) return;
|
|
63
|
-
|
|
64
|
-
// Stop any previous loop before starting a new one
|
|
65
|
-
loopRef.current?.stop();
|
|
66
|
-
|
|
67
|
-
translateX.setValue(-layout.width * 1.5);
|
|
68
|
-
|
|
69
|
-
const loop = Animated.loop(
|
|
70
|
-
Animated.timing(translateX, {
|
|
71
|
-
toValue: layout.width,
|
|
72
|
-
easing: Easing.cubic,
|
|
73
|
-
duration: DURATION,
|
|
74
|
-
useNativeDriver: true,
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
loopRef.current = loop;
|
|
78
|
-
loop.start();
|
|
79
|
-
return () => {
|
|
80
|
-
loop.stop();
|
|
81
|
-
loopRef.current = null;
|
|
82
|
-
};
|
|
83
|
-
}, [translateX, layout]);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<View
|
|
87
|
-
style={[
|
|
88
|
-
containerStyle,
|
|
89
|
-
{
|
|
90
|
-
backgroundColor,
|
|
91
|
-
borderRadius: ['actionS', 'actionL'].includes(variant)
|
|
92
|
-
? theme.t('RadiusPill').number
|
|
93
|
-
: theme.t('RadiusMain').number,
|
|
94
|
-
overflow: 'hidden',
|
|
95
|
-
},
|
|
96
|
-
styles[props.variant],
|
|
97
|
-
{ ...(expand ? { width: '100%', maxWidth: undefined } : undefined) },
|
|
98
|
-
]}
|
|
99
|
-
onLayout={(e: LayoutChangeEvent) => {
|
|
100
|
-
const { width, height } = e.nativeEvent.layout;
|
|
101
|
-
setLayout({ width, height });
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
<Animated.View
|
|
105
|
-
style={{
|
|
106
|
-
position: 'absolute',
|
|
107
|
-
|
|
108
|
-
top: -3 * layout.height, // ensure coverage when rotated
|
|
109
|
-
bottom: -3 * layout.height,
|
|
110
|
-
width: layout.width,
|
|
111
|
-
transform: [{ translateX }, { rotate: `${ANGLE}deg` }],
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
{layout.width > 0 && ( // Render gradient only when layout is measured will crash otherwise
|
|
115
|
-
<LinearGradient
|
|
116
|
-
style={{ flex: 1 }}
|
|
117
|
-
pointerEvents="none"
|
|
118
|
-
colors={[
|
|
119
|
-
highlightColorWithOpacity,
|
|
120
|
-
highlightColor,
|
|
121
|
-
highlightColorWithOpacity,
|
|
122
|
-
]}
|
|
123
|
-
locations={[0, 0.5, 1]}
|
|
124
|
-
start={{ x: 0, y: 0 }}
|
|
125
|
-
end={{ x: 1, y: 0 }}
|
|
126
|
-
/>
|
|
127
|
-
)}
|
|
128
|
-
</Animated.View>
|
|
129
|
-
</View>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const styles = StyleSheet.create({
|
|
134
|
-
headingS: {
|
|
135
|
-
height: 24,
|
|
136
|
-
minWidth: 120,
|
|
137
|
-
maxWidth: 240,
|
|
138
|
-
},
|
|
139
|
-
headingM: {
|
|
140
|
-
height: 32,
|
|
141
|
-
minWidth: 120,
|
|
142
|
-
maxWidth: 240,
|
|
143
|
-
},
|
|
144
|
-
headingL: {
|
|
145
|
-
height: 40,
|
|
146
|
-
minWidth: 120,
|
|
147
|
-
maxWidth: 240,
|
|
148
|
-
},
|
|
149
|
-
body: {
|
|
150
|
-
height: 16,
|
|
151
|
-
maxWidth: 300,
|
|
152
|
-
minWidth: 120,
|
|
153
|
-
},
|
|
154
|
-
bodyS: {
|
|
155
|
-
height: 16,
|
|
156
|
-
maxWidth: 180,
|
|
157
|
-
minWidth: 120,
|
|
158
|
-
},
|
|
159
|
-
actionS: {
|
|
160
|
-
height: 40,
|
|
161
|
-
width: 40,
|
|
162
|
-
},
|
|
163
|
-
actionL: {
|
|
164
|
-
height: 48,
|
|
165
|
-
width: 160,
|
|
166
|
-
},
|
|
167
|
-
assetS: {
|
|
168
|
-
height: 40,
|
|
169
|
-
width: 40,
|
|
170
|
-
},
|
|
171
|
-
assetXS: {
|
|
172
|
-
height: 16,
|
|
173
|
-
width: 16,
|
|
174
|
-
},
|
|
175
|
-
assetL: {
|
|
176
|
-
height: 80,
|
|
177
|
-
width: 80,
|
|
178
|
-
},
|
|
179
|
-
panel: {
|
|
180
|
-
height: 200,
|
|
181
|
-
width: 300,
|
|
182
|
-
},
|
|
183
|
-
panelS: {
|
|
184
|
-
height: 133,
|
|
185
|
-
width: 144,
|
|
186
|
-
},
|
|
187
|
-
});
|
package/src/StatusSkeleton.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
2
|
-
import { PxSkeleton } from './Skeleton';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
-
import { ISkeletonProps } from './types';
|
|
6
|
-
|
|
7
|
-
export function PxStatusSkeleton({ inverted, containerStyle }: ISkeletonProps) {
|
|
8
|
-
const { theme } = useTheme();
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<View
|
|
12
|
-
style={[
|
|
13
|
-
containerStyle,
|
|
14
|
-
{ flexDirection: 'row', gap: theme.t('Spacing2xsMobile').number },
|
|
15
|
-
]}
|
|
16
|
-
>
|
|
17
|
-
<PxSkeleton variant={'assetXS'} inverted={inverted} />
|
|
18
|
-
<PxSkeleton variant={'body'} inverted={inverted} />
|
|
19
|
-
</View>
|
|
20
|
-
);
|
|
21
|
-
}
|
package/src/TileSkeleton.tsx
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
2
|
-
import { PxSkeleton } from './Skeleton';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useTheme } from '@proximus/lavender-styling-native';
|
|
5
|
-
import { ISkeletonProps } from './types';
|
|
6
|
-
|
|
7
|
-
function PxTileSkeleton({ inverted }: ISkeletonProps) {
|
|
8
|
-
const { theme } = useTheme();
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<View
|
|
12
|
-
style={{
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
gap: theme.t('SpacingSMobile').number,
|
|
15
|
-
borderBottomEndRadius: theme.t('RadiusMain').number,
|
|
16
|
-
borderBottomStartRadius: theme.t('RadiusMain').number,
|
|
17
|
-
padding: theme.t('PaddingSMobile').number,
|
|
18
|
-
backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
|
|
19
|
-
}}
|
|
20
|
-
>
|
|
21
|
-
<PxSkeleton variant={'assetS'} inverted={inverted} />
|
|
22
|
-
<PxSkeleton variant={'headingS'} inverted={inverted} />
|
|
23
|
-
</View>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function PxTilesSkeleton({ inverted, containerStyle }: ISkeletonProps) {
|
|
28
|
-
const { theme } = useTheme();
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<View
|
|
32
|
-
style={[
|
|
33
|
-
containerStyle,
|
|
34
|
-
{
|
|
35
|
-
gap: theme.t('SpacingSMobile').number,
|
|
36
|
-
flexDirection: 'row',
|
|
37
|
-
overflow: 'hidden',
|
|
38
|
-
},
|
|
39
|
-
]}
|
|
40
|
-
>
|
|
41
|
-
<PxTileSkeleton inverted={inverted} />
|
|
42
|
-
<PxTileSkeleton inverted={inverted} />
|
|
43
|
-
<PxTileSkeleton inverted={inverted} />
|
|
44
|
-
</View>
|
|
45
|
-
);
|
|
46
|
-
}
|
package/src/types.ts
DELETED
package/tsconfig.json
DELETED
|
File without changes
|