@proximus/lavender-skeleton-native 0.1.0-alpha.0 → 0.1.0-alpha.10

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,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ISkeletonProps } from './types';
3
- export declare function PxCardSkeleton({ inverted, containerStyle }: ISkeletonProps): React.JSX.Element;
3
+ export declare function PxCardSkeleton({ inverted, containerStyle, testID, }: ISkeletonProps): React.JSX.Element;
4
4
  //# sourceMappingURL=CardSkeleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardSkeleton.d.ts","sourceRoot":"","sources":["../src/CardSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,cAAc,qBAsB1E"}
1
+ {"version":3,"file":"CardSkeleton.d.ts","sourceRoot":"","sources":["../src/CardSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,cAAc,EACd,MAAM,GACP,EAAE,cAAc,qBAuBhB"}
@@ -0,0 +1,19 @@
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 { e2eID } from '@proximus/lavender-common-native';
6
+ export function PxCardSkeleton({ inverted, containerStyle, testID, }) {
7
+ const { theme } = useTheme();
8
+ return (React.createElement(View, { style: [containerStyle, { borderRadius: theme.t('RadiusMain').number }], ...e2eID(testID) },
9
+ React.createElement(PxSkeleton, { variant: 'assetL', inverted: inverted, expand: true }),
10
+ React.createElement(View, { style: {
11
+ gap: theme.t('SpacingSMobile').number,
12
+ borderBottomEndRadius: theme.t('RadiusMain').number,
13
+ borderBottomStartRadius: theme.t('RadiusMain').number,
14
+ padding: theme.t('PaddingSMobile').number,
15
+ backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
16
+ } },
17
+ React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted }),
18
+ React.createElement(PxSkeleton, { variant: 'body', inverted: inverted }))));
19
+ }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ISkeletonProps } from './types';
3
- export declare function PxCarouselSkeleton({ inverted, itemsVisible, containerStyle, }: {
3
+ export declare function PxCarouselSkeleton({ inverted, itemsVisible, containerStyle, testID, }: {
4
4
  itemsVisible?: number;
5
5
  } & ISkeletonProps): React.JSX.Element;
6
6
  //# sourceMappingURL=CarouselSkeleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CarouselSkeleton.d.ts","sourceRoot":"","sources":["../src/CarouselSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,YAAgB,EAChB,cAAc,GACf,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,cAAc,qBAqCjB"}
1
+ {"version":3,"file":"CarouselSkeleton.d.ts","sourceRoot":"","sources":["../src/CarouselSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,YAAgB,EAChB,cAAc,EACd,MAAM,GACP,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,cAAc,qBAsCjB"}
@@ -0,0 +1,29 @@
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 { e2eID } from '@proximus/lavender-common-native';
6
+ export function PxCarouselSkeleton({ inverted, itemsVisible = 1, containerStyle, testID, }) {
7
+ const { theme } = useTheme();
8
+ const panelVariant = itemsVisible === 1 ? 'panel' : 'panelS';
9
+ return (React.createElement(View, { style: [
10
+ containerStyle,
11
+ {
12
+ gap: theme.t('SpacingSMobile').number,
13
+ borderRadius: theme.t('RadiusMain').number,
14
+ },
15
+ ], ...e2eID(testID) },
16
+ React.createElement(View, { style: {
17
+ flexDirection: 'row',
18
+ gap: theme.t('SpacingSMobile').number,
19
+ overflow: 'hidden',
20
+ } },
21
+ React.createElement(PxSkeleton, { inverted: inverted, variant: panelVariant }),
22
+ React.createElement(PxSkeleton, { inverted: inverted, variant: panelVariant }),
23
+ React.createElement(PxSkeleton, { inverted: inverted, variant: panelVariant })),
24
+ React.createElement(View, { style: {
25
+ justifyContent: 'center',
26
+ flexDirection: 'row',
27
+ } },
28
+ React.createElement(PxSkeleton, { inverted: inverted, variant: 'body' }))));
29
+ }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ISkeletonProps } from './types';
3
- export declare function PxDataUsageSkeleton({ inverted, containerStyle, }: ISkeletonProps): React.JSX.Element;
3
+ export declare function PxDataUsageSkeleton({ inverted, containerStyle, testID, }: ISkeletonProps): React.JSX.Element;
4
4
  //# sourceMappingURL=DataUsageSkeleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataUsageSkeleton.d.ts","sourceRoot":"","sources":["../src/DataUsageSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,cAAc,GACf,EAAE,cAAc,qBAkChB"}
1
+ {"version":3,"file":"DataUsageSkeleton.d.ts","sourceRoot":"","sources":["../src/DataUsageSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,cAAc,EACd,MAAM,GACP,EAAE,cAAc,qBAmChB"}
@@ -0,0 +1,29 @@
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 { e2eID } from '@proximus/lavender-common-native';
7
+ export function PxDataUsageSkeleton({ inverted, containerStyle, testID, }) {
8
+ const { theme } = useTheme();
9
+ return (React.createElement(View, { style: [
10
+ containerStyle,
11
+ {
12
+ gap: theme.t('SpacingDefaultMobile').number,
13
+ borderRadius: theme.t('RadiusMain').number,
14
+ padding: theme.t('PaddingSMobile').number,
15
+ backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
16
+ },
17
+ ], ...e2eID(testID) },
18
+ React.createElement(View, { style: {
19
+ gap: theme.t('SpacingXsMobile').number,
20
+ } },
21
+ React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted }),
22
+ React.createElement(PxSkeleton, { variant: 'body', inverted: inverted })),
23
+ React.createElement(View, { style: {
24
+ gap: theme.t('SpacingXsMobile').number,
25
+ } },
26
+ React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted }),
27
+ React.createElement(PxSkeleton, { variant: 'body', inverted: inverted, expand: true }),
28
+ React.createElement(PxStatusSkeleton, null))));
29
+ }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ISkeletonProps } from './types';
3
- export declare function PxMessageCardSkeleton({ inverted, containerStyle, }: ISkeletonProps): React.JSX.Element;
3
+ export declare function PxMessageCardSkeleton({ inverted, containerStyle, testID, }: ISkeletonProps): React.JSX.Element;
4
4
  //# sourceMappingURL=MessageCardSkeleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageCardSkeleton.d.ts","sourceRoot":"","sources":["../src/MessageCardSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,cAAc,GACf,EAAE,cAAc,qBAiChB"}
1
+ {"version":3,"file":"MessageCardSkeleton.d.ts","sourceRoot":"","sources":["../src/MessageCardSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,cAAc,EACd,MAAM,GACP,EAAE,cAAc,qBAkChB"}
@@ -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 { e2eID } from '@proximus/lavender-common-native';
6
+ export function PxMessageCardSkeleton({ inverted, containerStyle, testID, }) {
7
+ const { theme } = useTheme();
8
+ return (React.createElement(View, { style: [
9
+ containerStyle,
10
+ {
11
+ backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
12
+ borderRadius: theme.t('RadiusMain').number,
13
+ padding: theme.t('PaddingSMobile').number,
14
+ gap: theme.t('SpacingSMobile').number,
15
+ },
16
+ ], ...e2eID(testID) },
17
+ React.createElement(View, { style: {
18
+ flexDirection: 'row',
19
+ gap: theme.t('SpacingSMobile').number,
20
+ } },
21
+ React.createElement(PxSkeleton, { variant: 'assetS', inverted: inverted }),
22
+ React.createElement(View, { style: { flex: 1, gap: theme.t('SpacingSMobile').number } },
23
+ React.createElement(PxSkeleton, { variant: 'headingS', inverted: inverted }),
24
+ React.createElement(PxSkeleton, { variant: 'body', inverted: inverted })),
25
+ React.createElement(PxSkeleton, { variant: 'actionS', inverted: inverted })),
26
+ React.createElement(View, null,
27
+ React.createElement(PxSkeleton, { variant: 'actionL', inverted: inverted }))));
28
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../src/Skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAIL,SAAS,EAGT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAOtB,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG;IAC9C,uBAAuB;IACvB,OAAO,EACH,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAeF,wBAAgB,UAAU,CAAC,KAAK,EAAE,qBAAqB,qBA+EtD"}
1
+ {"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../src/Skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAIL,SAAS,EAGT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAQtB,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG;IAC9C,uBAAuB;IACvB,OAAO,EACH,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAeF,wBAAgB,UAAU,CAAC,KAAK,EAAE,qBAAqB,qBAsFtD"}
@@ -0,0 +1,126 @@
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
+ import { e2eID } from '@proximus/lavender-common-native';
6
+ const DURATION = 1500;
7
+ const ANGLE = 18;
8
+ function useColors({ inverted }) {
9
+ const { theme } = useTheme();
10
+ const invertedSuffix = inverted ? 'Inverted' : 'Default';
11
+ const backgroundColor = theme.t(`ColorBackgroundStateDisabled${invertedSuffix}`);
12
+ const highlightColor = inverted ? 'rgba(0,0,0,1)' : 'rgba(255,255,255,1)';
13
+ const highlightColorWithOpacity = inverted
14
+ ? 'rgba(0,0,0,0.24)'
15
+ : 'rgba(255,255,250,.24)';
16
+ return { backgroundColor, highlightColor, highlightColorWithOpacity };
17
+ }
18
+ export function PxSkeleton(props) {
19
+ const { inverted = false, containerStyle, variant, expand = false, testID, } = props;
20
+ const [layout, setLayout] = useState({ width: 0, height: 0 });
21
+ const translateX = useRef(new Animated.Value(0)).current;
22
+ const { theme } = useTheme();
23
+ const { backgroundColor, highlightColor, highlightColorWithOpacity } = useColors({ inverted });
24
+ const loopRef = useRef(null);
25
+ useEffect(() => {
26
+ if (layout.width <= 0)
27
+ return;
28
+ // Stop any previous loop before starting a new one
29
+ loopRef.current?.stop();
30
+ translateX.setValue(-layout.width * 1.5);
31
+ const loop = Animated.loop(Animated.timing(translateX, {
32
+ toValue: layout.width,
33
+ easing: Easing.cubic,
34
+ duration: DURATION,
35
+ useNativeDriver: true,
36
+ }));
37
+ loopRef.current = loop;
38
+ loop.start();
39
+ return () => {
40
+ loop.stop();
41
+ loopRef.current = null;
42
+ };
43
+ }, [translateX, layout]);
44
+ return (React.createElement(View, { style: [
45
+ containerStyle,
46
+ {
47
+ backgroundColor,
48
+ borderRadius: ['actionS', 'actionL'].includes(variant)
49
+ ? theme.t('RadiusPill').number
50
+ : theme.t('RadiusMain').number,
51
+ overflow: 'hidden',
52
+ },
53
+ styles[props.variant],
54
+ { ...(expand ? { width: '100%', maxWidth: undefined } : undefined) },
55
+ ], onLayout: (e) => {
56
+ const { width, height } = e.nativeEvent.layout;
57
+ setLayout({ width, height });
58
+ }, ...e2eID(testID) },
59
+ React.createElement(Animated.View, { style: {
60
+ position: 'absolute',
61
+ top: -3 * layout.height, // ensure coverage when rotated
62
+ bottom: -3 * layout.height,
63
+ width: layout.width,
64
+ transform: [{ translateX }, { rotate: `${ANGLE}deg` }],
65
+ } }, layout.width > 0 && ( // Render gradient only when layout is measured will crash otherwise
66
+ React.createElement(LinearGradient, { style: { flex: 1 }, pointerEvents: "none", colors: [
67
+ highlightColorWithOpacity,
68
+ highlightColor,
69
+ highlightColorWithOpacity,
70
+ ], locations: [0, 0.5, 1], start: { x: 0, y: 0 }, end: { x: 1, y: 0 } })))));
71
+ }
72
+ const styles = StyleSheet.create({
73
+ headingS: {
74
+ height: 24,
75
+ minWidth: 120,
76
+ maxWidth: 240,
77
+ },
78
+ headingM: {
79
+ height: 32,
80
+ minWidth: 120,
81
+ maxWidth: 240,
82
+ },
83
+ headingL: {
84
+ height: 40,
85
+ minWidth: 120,
86
+ maxWidth: 240,
87
+ },
88
+ body: {
89
+ height: 16,
90
+ maxWidth: 300,
91
+ minWidth: 120,
92
+ },
93
+ bodyS: {
94
+ height: 16,
95
+ maxWidth: 180,
96
+ minWidth: 120,
97
+ },
98
+ actionS: {
99
+ height: 40,
100
+ width: 40,
101
+ },
102
+ actionL: {
103
+ height: 48,
104
+ width: 160,
105
+ },
106
+ assetS: {
107
+ height: 40,
108
+ width: 40,
109
+ },
110
+ assetXS: {
111
+ height: 16,
112
+ width: 16,
113
+ },
114
+ assetL: {
115
+ height: 80,
116
+ width: 80,
117
+ },
118
+ panel: {
119
+ height: 200,
120
+ width: 300,
121
+ },
122
+ panelS: {
123
+ height: 133,
124
+ width: 144,
125
+ },
126
+ });
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ISkeletonProps } from './types';
3
- export declare function PxStatusSkeleton({ inverted, containerStyle }: ISkeletonProps): React.JSX.Element;
3
+ export declare function PxStatusSkeleton({ inverted, containerStyle, testID, }: ISkeletonProps): React.JSX.Element;
4
4
  //# sourceMappingURL=StatusSkeleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatusSkeleton.d.ts","sourceRoot":"","sources":["../src/StatusSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,cAAc,qBAc5E"}
1
+ {"version":3,"file":"StatusSkeleton.d.ts","sourceRoot":"","sources":["../src/StatusSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,cAAc,EACd,MAAM,GACP,EAAE,cAAc,qBAehB"}
@@ -0,0 +1,14 @@
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 { e2eID } from '@proximus/lavender-common-native';
6
+ export function PxStatusSkeleton({ inverted, containerStyle, testID, }) {
7
+ const { theme } = useTheme();
8
+ return (React.createElement(View, { style: [
9
+ containerStyle,
10
+ { flexDirection: 'row', gap: theme.t('Spacing2xsMobile').number },
11
+ ], ...e2eID(testID) },
12
+ React.createElement(PxSkeleton, { variant: 'assetXS', inverted: inverted }),
13
+ React.createElement(PxSkeleton, { variant: 'body', inverted: inverted })));
14
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"TileSkeleton.d.ts","sourceRoot":"","sources":["../src/TileSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsBzC,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,cAAc,qBAmB3E"}
1
+ {"version":3,"file":"TileSkeleton.d.ts","sourceRoot":"","sources":["../src/TileSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAuBzC,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,cAAc,qBAmB3E"}
@@ -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
+ import { e2eID } from '@proximus/lavender-common-native';
6
+ function PxTileSkeleton({ inverted, testID }) {
7
+ const { theme } = useTheme();
8
+ return (React.createElement(View, { style: {
9
+ alignItems: 'center',
10
+ gap: theme.t('SpacingSMobile').number,
11
+ borderRadius: theme.t('RadiusMain').number,
12
+ padding: theme.t('PaddingSMobile').number,
13
+ backgroundColor: theme.t('ColorBackgroundSurfaceLight'),
14
+ }, ...e2eID(testID) },
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.d.ts CHANGED
@@ -2,5 +2,6 @@ import { StyleProp, ViewStyle } from 'react-native';
2
2
  export interface ISkeletonProps {
3
3
  inverted?: boolean;
4
4
  containerStyle?: StyleProp<ViewStyle>;
5
+ testID?: string;
5
6
  }
6
7
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACvC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
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.0",
3
+ "version": "0.1.0-alpha.10",
4
4
  "description": "Lavender skeleton component",
5
5
  "license": "MIT",
6
- "main": "src/index.ts",
7
- "type": "module",
8
- "scripts": {
9
- "clean": "rm -rf dist",
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": "workspace:*",
15
- "@proximus/lavender-styling-native": "workspace:*",
16
- "@proximus/lavender-texts-native": "workspace:*"
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))
@@ -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
- }
@@ -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
- });
@@ -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
- }
@@ -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
@@ -1,6 +0,0 @@
1
- import { StyleProp, ViewStyle } from 'react-native';
2
-
3
- export interface ISkeletonProps {
4
- inverted?: boolean;
5
- containerStyle?: StyleProp<ViewStyle>;
6
- }
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.npm.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- },
6
- "include": ["src","../../../lib.d.ts"],
7
- "exclude": ["dist", "node_modules", "src/**/*.test.ts", "src/**/*.spec.ts"]
8
- }
File without changes