@proximus/lavender-skeleton-native 0.1.0-alpha.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 +10 -0
- package/dist/CardSkeleton.d.ts +4 -0
- package/dist/CardSkeleton.d.ts.map +1 -0
- package/dist/CarouselSkeleton.d.ts +6 -0
- package/dist/CarouselSkeleton.d.ts.map +1 -0
- package/dist/DataUsageSkeleton.d.ts +4 -0
- package/dist/DataUsageSkeleton.d.ts.map +1 -0
- package/dist/MessageCardSkeleton.d.ts +4 -0
- package/dist/MessageCardSkeleton.d.ts.map +1 -0
- package/dist/Skeleton.d.ts +12 -0
- package/dist/Skeleton.d.ts.map +1 -0
- package/dist/StatusSkeleton.d.ts +4 -0
- package/dist/StatusSkeleton.d.ts.map +1 -0
- package/dist/TileSkeleton.d.ts +4 -0
- package/dist/TileSkeleton.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +38 -0
- package/src/CardSkeleton.tsx +29 -0
- package/src/CarouselSkeleton.tsx +50 -0
- package/src/DataUsageSkeleton.tsx +45 -0
- package/src/MessageCardSkeleton.tsx +43 -0
- package/src/Skeleton.tsx +187 -0
- package/src/StatusSkeleton.tsx +21 -0
- package/src/TileSkeleton.tsx +46 -0
- package/src/index.ts +7 -0
- package/src/types.ts +6 -0
- package/tsconfig.json +8 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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))
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ISkeletonProps } from './types';
|
|
3
|
+
export declare function PxCarouselSkeleton({ inverted, itemsVisible, containerStyle, }: {
|
|
4
|
+
itemsVisible?: number;
|
|
5
|
+
} & ISkeletonProps): React.JSX.Element;
|
|
6
|
+
//# sourceMappingURL=CarouselSkeleton.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
export type SkeletonGradientProps = ViewProps & {
|
|
4
|
+
/** Predefined shape */
|
|
5
|
+
variant: 'headingS' | 'headingM' | 'headingL' | 'body' | 'bodyS' | 'actionS' | 'actionL' | 'assetXS' | 'assetS' | 'assetL' | 'panel' | 'panelS';
|
|
6
|
+
width?: number | string;
|
|
7
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
8
|
+
expand?: boolean;
|
|
9
|
+
inverted?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function PxSkeleton(props: SkeletonGradientProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=Skeleton.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './Skeleton';
|
|
2
|
+
export * from './CardSkeleton';
|
|
3
|
+
export * from './MessageCardSkeleton';
|
|
4
|
+
export * from './CarouselSkeleton';
|
|
5
|
+
export * from './StatusSkeleton';
|
|
6
|
+
export * from './TileSkeleton';
|
|
7
|
+
export * from './DataUsageSkeleton';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-skeleton-native",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Lavender skeleton component",
|
|
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
|
+
},
|
|
13
|
+
"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"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"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"
|
|
38
|
+
}
|
|
@@ -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 { 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
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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/index.ts
ADDED
package/src/types.ts
ADDED