@proximus/lavender-cards-native 0.0.1-alpha.0 → 0.0.1-alpha.2

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 ADDED
@@ -0,0 +1,14 @@
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.0.1-alpha.2](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-cards-native@0.0.1-alpha.1...@proximus/lavender-cards-native@0.0.1-alpha.2) (2025-09-26)
7
+
8
+ **Note:** Version bump only for package @proximus/lavender-cards-native
9
+
10
+ ## 0.0.1-alpha.1 (2025-09-25)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **BCRI-000000:** no free space on gh runner during build ([#27](https://github.com/Pxs-Corporate/react-native-lavender/issues/27)) ([a7c8604](https://github.com/Pxs-Corporate/react-native-lavender/commit/a7c86043b5cefcb10fd768d449c5718fbabe87ec))
@@ -0,0 +1,43 @@
1
+ import LinearGradient from 'react-native-linear-gradient';
2
+ import { ImageBackground } from 'react-native';
3
+ import React from 'react';
4
+ import { useTheme } from '@proximus/lavender-styling-native';
5
+ function useStyles(props) {
6
+ const { theme } = useTheme();
7
+ const { inverted = false, backgroundColor = 'Default' } = props;
8
+ return {
9
+ gradientColors: inverted
10
+ ? ['#252525FF', '#252525DD', '#25252500']
11
+ : ['#FFFFFF', '#FFFFFFDD', '#FFFFFF00'],
12
+ backgroundColor: inverted
13
+ ? theme.t(`ColorBackgroundContainer${backgroundColor}Inverted`)
14
+ : theme.t(`ColorBackgroundContainer${backgroundColor}Default`),
15
+ contrastColors: inverted
16
+ ? ['rgba(0,0,0,0.6)', 'rgba(0,0,0,0.6)']
17
+ : ['rgba(255,255,255,0.7)', 'rgba(255,255,255,0.7)'],
18
+ };
19
+ }
20
+ export function BackgroundImageLinearGradientContainer(props) {
21
+ const { theme } = useTheme();
22
+ const styles = useStyles(props);
23
+ const { src, alternativeText = 'Image', contrastHelper = 'none', children, gradientDirection = 'diagonal', } = props;
24
+ return (React.createElement(ImageBackground, { alt: alternativeText, imageStyle: {
25
+ borderRadius: theme.t('RadiusMain').number,
26
+ }, style: {
27
+ flex: 1,
28
+ }, resizeMode: 'cover', source: src },
29
+ React.createElement(LinearGradient, { colors: [styles.backgroundColor, styles.backgroundColor], ...(contrastHelper === 'gradient' && {
30
+ colors: styles.gradientColors,
31
+ ...(gradientDirection === 'horizontal'
32
+ ? {
33
+ start: { x: 0, y: 1.0 },
34
+ end: { x: 1.0, y: 1.0 },
35
+ }
36
+ : {
37
+ start: { x: 0.0, y: 1.0 },
38
+ end: { x: 0.0, y: 0.0 },
39
+ }),
40
+ }), ...(contrastHelper === 'overlay' && {
41
+ colors: styles.contrastColors,
42
+ }) }, children)));
43
+ }
@@ -0,0 +1,12 @@
1
+ import { Body } from '@proximus/lavender-texts-native';
2
+ import React from 'react';
3
+ import { useTheme } from '@proximus/lavender-styling-native';
4
+ export function Content({ content, size = 'M', inverted = false, }) {
5
+ const { theme } = useTheme();
6
+ return (React.createElement(Body, { style: {
7
+ color: inverted
8
+ ? theme.t(`ColorTextDimmedInverted`)
9
+ : theme.t(`ColorTextNeutralDefault`),
10
+ fontSize: theme.t(`TextSizeBody${size}Mobile`).number,
11
+ }, ellipsizeMode: 'tail', numberOfLines: 3 }, content));
12
+ }
package/dist/PxCard.js ADDED
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { Image, TouchableOpacity, View, } from 'react-native';
3
+ import { useTheme } from '@proximus/lavender-styling-native';
4
+ import { a11y, e2eID, useImageAspectRatio, } from '@proximus/lavender-common-native';
5
+ import { BackgroundImageLinearGradientContainer, } from './BackgroundImageLinearGradientContainer';
6
+ import { Title } from './Title';
7
+ import { Content } from './Content';
8
+ export function MediaPart(props) {
9
+ const { theme } = useTheme();
10
+ const { src, backgroundSize = 'cover', mediaPosition = 'top', alternativeText, } = props;
11
+ const aspectRatio = useImageAspectRatio(src);
12
+ const [wrapperHeight, setWrapperHeight] = React.useState(undefined);
13
+ /*
14
+ If we don’t set width (or height), RN needs one concrete dimension for image. Local assets
15
+ have an intrinsic size, so they render at that size (can be wider than the parent).
16
+ Remote images often don’t have an intrinsic size at first and end up constrained by
17
+ the parent, so they look correct.
18
+
19
+ We then wrap the image in a View to be able to set the aspect ratio and
20
+ make sure Image takes the full width of the card when mediaPosition is 'top'.
21
+ */
22
+ return (React.createElement(View, { style: mediaPosition === 'top' && { width: '100%', aspectRatio }, onLayout: (event) => {
23
+ // when media position is left, we need to set the height of the image to match the height of the wrapper
24
+ // which itself have the height of the taller's neighbor element
25
+ const { height } = event.nativeEvent.layout;
26
+ setWrapperHeight(height);
27
+ } },
28
+ React.createElement(Image, { alt: alternativeText, style: {
29
+ ...(mediaPosition === 'top' && {
30
+ width: '100%',
31
+ height: '100%',
32
+ aspectRatio,
33
+ borderTopRightRadius: theme.t('RadiusMain').number,
34
+ borderTopLeftRadius: theme.t('RadiusMain').number,
35
+ }),
36
+ ...(mediaPosition === 'left' && {
37
+ width: 120,
38
+ height: wrapperHeight,
39
+ borderBottomLeftRadius: theme.t('RadiusMain').number,
40
+ borderTopLeftRadius: theme.t('RadiusMain').number,
41
+ }),
42
+ }, source: src, resizeMode: backgroundSize })));
43
+ }
44
+ export function PxCard(props) {
45
+ const { title, content, children, mediaPosition, containerStyle, accessibilityLabel, accessibilityHint, testID, onPress, src, } = props;
46
+ const flexDirection = mediaPosition === 'left' ? 'row' : 'column';
47
+ const { theme } = useTheme();
48
+ return (React.createElement(TouchableOpacity, { onPress: onPress },
49
+ React.createElement(View, { style: [
50
+ containerStyle,
51
+ {
52
+ overflow: 'hidden',
53
+ flexDirection,
54
+ borderRadius: theme.t('RadiusMain').number,
55
+ },
56
+ ], ...e2eID(testID), ...a11y({
57
+ accessibilityLabel,
58
+ accessibilityHint,
59
+ role: 'button',
60
+ }) },
61
+ mediaPosition !== 'background' && React.createElement(MediaPart, { ...props }),
62
+ React.createElement(BackgroundImageLinearGradientContainer, { ...props, src: mediaPosition !== 'background' ? undefined : src },
63
+ React.createElement(View, { style: {
64
+ padding: theme.t(`PaddingMMobile`).number,
65
+ gap: theme.t(`PaddingSMobile`).number,
66
+ } },
67
+ React.createElement(Title, { title: title }),
68
+ content && React.createElement(Content, { content: content }),
69
+ children)))));
70
+ }
@@ -0,0 +1,72 @@
1
+ import { a11y, e2eID, PxSpacer } from '@proximus/lavender-common-native';
2
+ import { Title } from './Title';
3
+ import { Content } from './Content';
4
+ import { BackgroundImageLinearGradientContainer } from './BackgroundImageLinearGradientContainer';
5
+ import React from 'react';
6
+ import { Image, View } from 'react-native';
7
+ import { useTheme } from '@proximus/lavender-styling-native';
8
+ import { PxButton } from '@proximus/lavender-button-native';
9
+ import { PxButtonIcon } from '@proximus/lavender-buttonicon-native';
10
+ import { PxTag } from '@proximus/lavender-tag-native';
11
+ export function PxMessageCard(props) {
12
+ const { children, containerStyle, accessibilityLabel, accessibilityHint, testID, ctaLabel, ctaAccessibilityLabel, ctaAccessibilityHint, onPress, imageLayout = 'leading', src, onClose, closeButtonSize = 'small', closeButtonAccessibilityHint, closeButtonAccessibilityLabel, inverted, tag, backgroundColor = 'Light', gradientDirection = 'vertical', height, } = props;
13
+ const { theme } = useTheme();
14
+ return (React.createElement(View, { style: [
15
+ containerStyle,
16
+ {
17
+ overflow: 'hidden',
18
+ borderRadius: theme.t('RadiusMain').number,
19
+ height,
20
+ },
21
+ ], ...e2eID(testID), ...a11y({
22
+ accessibilityLabel,
23
+ accessibilityHint,
24
+ role: 'button',
25
+ }) },
26
+ React.createElement(BackgroundImageLinearGradientContainer, { ...props, backgroundColor: backgroundColor, src: imageLayout === 'background' ? src : undefined, gradientDirection: gradientDirection },
27
+ React.createElement(View, { style: {
28
+ gap: theme.t('SpacingDefaultMobile').number,
29
+ padding: theme.t('PaddingSMobile').number,
30
+ height: '100%',
31
+ } },
32
+ tag && React.createElement(TagSection, { ...props }),
33
+ height && React.createElement(PxSpacer, null),
34
+ React.createElement(TitleSection, { ...props }),
35
+ children,
36
+ React.createElement(PxButton, { title: ctaLabel, onPress: onPress, type: "secondary", accessibilityLabel: ctaAccessibilityLabel || ctaLabel, accessibilityHint: ctaAccessibilityHint, testID: `${testID ? testID : 'message-card'}-cta-button`, inverted: inverted }),
37
+ React.createElement(PxButtonIcon, { size: closeButtonSize, iconName: 'cross', variant: 'secondary', onPress: onClose, wrapperStyle: {
38
+ position: 'absolute',
39
+ top: theme.t('SpacingSMobile').number,
40
+ right: theme.t('SpacingSMobile').number,
41
+ }, inverted: inverted, ...e2eID(testID ? `${testID}-close-button` : 'message-card-close-button'), ...a11y({
42
+ accessibilityLabel: `${closeButtonAccessibilityLabel || 'Close'}`,
43
+ accessibilityHint: closeButtonAccessibilityHint,
44
+ }) })))));
45
+ }
46
+ function TitleSection(props) {
47
+ const { theme } = useTheme();
48
+ const { imageLayout, src, inverted, content, title } = props;
49
+ return (React.createElement(View, { style: {
50
+ gap: theme.t('SpacingDefaultMobile').number,
51
+ flexDirection: 'row',
52
+ } },
53
+ imageLayout === 'leading' && (React.createElement(Image, { source: src, style: {
54
+ width: theme.t('SizeAssetsM').number,
55
+ aspectRatio: 1,
56
+ } })),
57
+ React.createElement(View, { style: {
58
+ gap: theme.t('SpacingXsMobile').number,
59
+ flexDirection: 'column',
60
+ } },
61
+ React.createElement(Title, { inverted: inverted, title: title, color: 'Neutral', size: 'L' }),
62
+ content && (React.createElement(Content, { inverted: inverted, content: content, size: 'M' })))));
63
+ }
64
+ function TagSection(props) {
65
+ const { theme } = useTheme();
66
+ const { tag, inverted } = props;
67
+ return (React.createElement(View, { style: {
68
+ gap: theme.t('PaddingMMobile').number,
69
+ alignItems: 'flex-start',
70
+ } },
71
+ React.createElement(PxTag, { label: tag, inverted: inverted })));
72
+ }
package/dist/Title.js ADDED
@@ -0,0 +1,11 @@
1
+ import { Header } from '@proximus/lavender-texts-native';
2
+ import React from 'react';
3
+ import { useTheme } from '@proximus/lavender-styling-native';
4
+ export function Title({ title, size = '2xl', color = 'Brand', inverted = false, }) {
5
+ const { theme } = useTheme();
6
+ const invertedSuffix = inverted ? 'Inverted' : 'Default';
7
+ return (React.createElement(Header, { ellipsizeMode: 'tail', numberOfLines: 1, style: {
8
+ fontSize: theme.t(`TextSizeHeading${size}Mobile`).number,
9
+ color: theme.t(`ColorText${color}${invertedSuffix}`),
10
+ } }, title));
11
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@proximus/lavender-cards-native",
3
+ "version": "0.0.1-alpha.2",
4
+ "description": "Card component",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "peerDependencies": {
8
+ "@proximus/lavender-button-native": "*",
9
+ "@proximus/lavender-buttonicon-native": "*",
10
+ "@proximus/lavender-common-native": "*",
11
+ "@proximus/lavender-styling-native": "*",
12
+ "@proximus/lavender-tag-native": "*",
13
+ "@proximus/lavender-texts-native": "*"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "lerna": {
19
+ "command": {
20
+ "publish": {
21
+ "assets": [
22
+ {
23
+ "from": "dist/far/away/package.json",
24
+ "to": "."
25
+ },
26
+ "dist/*.js",
27
+ "dist/*.d.ts",
28
+ "dist/*.d.ts.map",
29
+ "src",
30
+ "package.json"
31
+ ]
32
+ }
33
+ }
34
+ },
35
+ "gitHead": "e50a17526561b3eafb159e36c737173956093e0d"
36
+ }
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './PxCard';
2
+ export * from './PxMessageCard';
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@proximus/lavender-cards-native",
3
- "version": "0.0.1-alpha.0",
3
+ "version": "0.0.1-alpha.2",
4
4
  "description": "Card component",
5
5
  "license": "MIT",
6
6
  "main": "src/index.ts",
7
7
  "scripts": {
8
8
  "clean": "rm -rf dist",
9
- "prepublish": "yarn clean && yarn build",
9
+ "transform-package-json": "node ../../../scripts/tranformPackageJson.js package.json dist/far/away",
10
+ "prepublish": "yarn clean && yarn transform-package-json && yarn build",
10
11
  "build": "npx tsc -p tsconfig.json"
11
12
  },
12
13
  "peerDependencies": {
@@ -18,12 +19,12 @@
18
19
  "@proximus/lavender-texts-native": "workspace:*"
19
20
  },
20
21
  "devDependencies": {
21
- "@proximus/lavender-button-native": "0.1.0-alpha.5",
22
- "@proximus/lavender-buttonicon-native": "0.1.0-alpha.4",
23
- "@proximus/lavender-common-native": "0.1.0-alpha.4",
24
- "@proximus/lavender-styling-native": "0.1.0-alpha.3",
25
- "@proximus/lavender-tag-native": "0.1.0-alpha.1",
26
- "@proximus/lavender-texts-native": "0.1.0-alpha.4"
22
+ "@proximus/lavender-button-native": "0.1.0-alpha.7",
23
+ "@proximus/lavender-buttonicon-native": "0.1.0-alpha.6",
24
+ "@proximus/lavender-common-native": "0.1.0-alpha.6",
25
+ "@proximus/lavender-styling-native": "0.1.0-alpha.5",
26
+ "@proximus/lavender-tag-native": "0.1.0-alpha.3",
27
+ "@proximus/lavender-texts-native": "0.1.0-alpha.6"
27
28
  },
28
29
  "publishConfig": {
29
30
  "access": "public"
@@ -32,12 +33,18 @@
32
33
  "command": {
33
34
  "publish": {
34
35
  "assets": [
35
- "dist",
36
+ {
37
+ "from": "dist/far/away/package.json",
38
+ "to": "."
39
+ },
40
+ "dist/*.js",
41
+ "dist/*.d.ts",
42
+ "dist/*.d.ts.map",
36
43
  "src",
37
44
  "package.json"
38
45
  ]
39
46
  }
40
47
  }
41
48
  },
42
- "gitHead": "8794f25d197ead361646d6e655ce64ba1c7f60c0"
49
+ "gitHead": "e50a17526561b3eafb159e36c737173956093e0d"
43
50
  }
package/tsconfig.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "outDir": "dist",
5
5
  },
6
6
  "include": ["src","../../../lib.d.ts"],
7
- "exclude": ["dist", "node_modules", "src/**/*.test.ts", "src/**/*.spec.ts"]
7
+ "exclude": ["dist", "node_modules", "src/**/*.spec.tsx", "src/**/*.spec.ts"]
8
8
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=PxCard.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PxCard.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/PxCard.spec.tsx"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=PxMessageCard.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PxMessageCard.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/PxMessageCard.spec.tsx"],"names":[],"mappings":""}