@proximus/lavender-common-native 0.1.0-alpha.2 → 0.1.0-alpha.3

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 CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.1.0-alpha.3](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-common-native@0.1.0-alpha.2...@proximus/lavender-common-native@0.1.0-alpha.3) (2025-09-12)
7
+
8
+ ### Features
9
+
10
+ - **BCRI-4217211:** card component ([#20](https://github.com/Pxs-Corporate/react-native-lavender/issues/20)) ([0287bee](https://github.com/Pxs-Corporate/react-native-lavender/commit/0287bee00a5b532403026b5a2ca0e702b70c822f))
11
+
6
12
  # [0.1.0-alpha.2](https://github.com/Pxs-Corporate/react-native-lavender/compare/@proximus/lavender-common-native@0.1.0-alpha.1...@proximus/lavender-common-native@0.1.0-alpha.2) (2025-09-05)
7
13
 
8
14
  ### Features
@@ -6,5 +6,5 @@ export interface IPxCardProps extends Readonly<ViewProps> {
6
6
  testId?: string;
7
7
  wrapperA11yProps?: AccessibilityProps;
8
8
  }
9
- export declare function PxCard(props: IPxCardProps): React.JSX.Element;
10
- //# sourceMappingURL=PxCard.d.ts.map
9
+ export declare function PxContainer(props: IPxCardProps): React.JSX.Element;
10
+ //# sourceMappingURL=PxContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PxContainer.d.ts","sourceRoot":"","sources":["../src/PxContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,YAAa,SAAQ,QAAQ,CAAC,SAAS,CAAC;IACvD,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC;IAC9E,YAAY,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;CACvC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,qBAwB9C"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './utils';
2
- export * from './PxCard';
2
+ export * from './PxContainer';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC"}
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AccessibilityProps } from 'react-native';
1
+ import { AccessibilityProps, ImageSourcePropType } from 'react-native';
2
2
  export interface ITestableAndroid {
3
3
  accessible: boolean;
4
4
  accessibilityLabel: string;
@@ -11,4 +11,5 @@ export interface ITestable extends ITestableAndroid, ITestableIOS {
11
11
  }
12
12
  export declare function e2eID(id?: string): ITestableAndroid | ITestableIOS | {};
13
13
  export declare function a11y(a11yProps?: AccessibilityProps): AccessibilityProps;
14
+ export declare function useImageAspectRatio(src: ImageSourcePropType | string | undefined): number | undefined;
14
15
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAY,MAAM,cAAc,CAAC;AAI5D,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAU,SAAQ,gBAAgB,EAAE,YAAY;IAC/D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,YAAY,GAAG,EAAE,CAcvE;AAED,wBAAgB,IAAI,CAAC,SAAS,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,CAQvE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,mBAAmB,EAEpB,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAU,SAAQ,gBAAgB,EAAE,YAAY;IAC/D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,YAAY,GAAG,EAAE,CAcvE;AAED,wBAAgB,IAAI,CAAC,SAAS,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,CAQvE;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,sBAuC9C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@proximus/lavender-common-native",
4
- "version": "0.1.0-alpha.2",
4
+ "version": "0.1.0-alpha.3",
5
5
  "description": "Common components for Proximus design system",
6
6
  "main": "src/index.ts",
7
7
  "scripts": {
@@ -30,5 +30,5 @@
30
30
  }
31
31
  }
32
32
  },
33
- "gitHead": "38a67765befa2567a3f5f57976b7933cf5b85a24"
33
+ "gitHead": "6328f584529cb675f4a2ede8ad89f31e2b3c9ffb"
34
34
  }
@@ -17,7 +17,7 @@ export interface IPxCardProps extends Readonly<ViewProps> {
17
17
  wrapperA11yProps?: AccessibilityProps;
18
18
  }
19
19
 
20
- export function PxCard(props: IPxCardProps) {
20
+ export function PxContainer(props: IPxCardProps) {
21
21
  const { theme } = useTheme();
22
22
 
23
23
  const { children, wrapperStyle, testId, wrapperA11yProps, ...viewProps } =
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './utils';
2
- export * from './PxCard';
2
+ export * from './PxContainer';
package/src/utils.ts CHANGED
@@ -1,6 +1,12 @@
1
- import { AccessibilityProps, Platform } from 'react-native';
1
+ import {
2
+ AccessibilityProps,
3
+ Image,
4
+ ImageSourcePropType,
5
+ Platform,
6
+ } from 'react-native';
2
7
  import Config from 'react-native-config';
3
8
  import { LaunchArguments } from 'react-native-launch-arguments';
9
+ import { useEffect, useState } from 'react';
4
10
 
5
11
  export interface ITestableAndroid {
6
12
  accessible: boolean;
@@ -40,3 +46,45 @@ export function a11y(a11yProps?: AccessibilityProps): AccessibilityProps {
40
46
  }
41
47
  return {} as any;
42
48
  }
49
+
50
+ export function useImageAspectRatio(
51
+ src: ImageSourcePropType | string | undefined
52
+ ) {
53
+ const [aspectRatio, setAspectRatio] = useState<number | undefined>();
54
+
55
+ useEffect(() => {
56
+ if (!src) return;
57
+
58
+ // 1) Try to resolve local assets (and also normalizes URIs)
59
+ const resolved = Image.resolveAssetSource(src as any);
60
+
61
+ // If RN knows width/height already (static asset), use them
62
+ if (resolved?.width && resolved?.height) {
63
+ setAspectRatio(resolved.width / resolved.height);
64
+ return;
65
+ }
66
+
67
+ // 2) Fall back to getSize for URIs (network, file://, content://)
68
+ const uri =
69
+ typeof src === 'string'
70
+ ? src
71
+ : (resolved?.uri ??
72
+ (typeof (src as any)?.uri === 'string'
73
+ ? (src as any).uri
74
+ : undefined));
75
+
76
+ if (uri) {
77
+ Image.getSize(
78
+ uri,
79
+ (width, height) => {
80
+ setAspectRatio(width / height);
81
+ },
82
+ (err) => console.warn('getSize failed:', err)
83
+ );
84
+ } else {
85
+ console.warn('Could not resolve image source for size:', src);
86
+ }
87
+ }, [src]);
88
+
89
+ return aspectRatio;
90
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"PxCard.d.ts","sourceRoot":"","sources":["../src/PxCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,YAAa,SAAQ,QAAQ,CAAC,SAAS,CAAC;IACvD,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC;IAC9E,YAAY,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;CACvC;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,YAAY,qBAwBzC"}