@proximus/lavender-common-native 0.1.0-alpha.0 → 0.1.0-alpha.11

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.
@@ -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"}
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { StyleSheet, View, } from 'react-native';
3
+ import { a11y, e2eID } from './utils';
4
+ import { useTheme } from '@proximus/lavender-styling-native';
5
+ export function PxContainer(props) {
6
+ const { theme } = useTheme();
7
+ const { children, wrapperStyle, testId, wrapperA11yProps, ...viewProps } = props;
8
+ return (React.createElement(View, { style: [
9
+ styles.container,
10
+ {
11
+ backgroundColor: theme.t('ColorBackgroundContainerLightDefault'),
12
+ },
13
+ wrapperStyle,
14
+ ], ...e2eID(testId), ...a11y({
15
+ ...wrapperA11yProps,
16
+ }), ...viewProps }, children));
17
+ }
18
+ const styles = StyleSheet.create({
19
+ container: {
20
+ borderRadius: 8,
21
+ },
22
+ });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare function PxSpacer(): React.JSX.Element;
3
+ //# sourceMappingURL=Spacer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spacer.d.ts","sourceRoot":"","sources":["../src/Spacer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,QAAQ,sBAEvB"}
package/dist/Spacer.js ADDED
@@ -0,0 +1,5 @@
1
+ import { View } from 'react-native';
2
+ import React from 'react';
3
+ export function PxSpacer() {
4
+ return React.createElement(View, { style: { flex: 1 } });
5
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './utils';
2
- export * from './PxCard';
2
+ export * from './PxContainer';
3
+ export * from './Spacer';
3
4
  //# 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;AAC9B,cAAc,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './utils';
2
+ export * from './PxContainer';
3
+ export * from './Spacer';
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/dist/utils.js ADDED
@@ -0,0 +1,58 @@
1
+ import { Image, Platform, } from 'react-native';
2
+ import Config from 'react-native-config';
3
+ import { LaunchArguments } from 'react-native-launch-arguments';
4
+ import { useEffect, useState } from 'react';
5
+ export function e2eID(id) {
6
+ const { e2e } = LaunchArguments.value();
7
+ if (('E2E' === Config.ENV || e2e) && id) {
8
+ if (Platform.OS === 'android') {
9
+ return {
10
+ accessibilityLabel: id,
11
+ accessible: true,
12
+ };
13
+ }
14
+ return {
15
+ testID: id,
16
+ };
17
+ }
18
+ return {};
19
+ }
20
+ export function a11y(a11yProps) {
21
+ const { e2e } = LaunchArguments.value();
22
+ if ('E2E' !== Config.ENV && !e2e) {
23
+ return {
24
+ ...a11yProps,
25
+ };
26
+ }
27
+ return {};
28
+ }
29
+ export function useImageAspectRatio(src) {
30
+ const [aspectRatio, setAspectRatio] = useState();
31
+ useEffect(() => {
32
+ if (!src)
33
+ return;
34
+ // 1) Try to resolve local assets (and also normalizes URIs)
35
+ const resolved = Image.resolveAssetSource(src);
36
+ // If RN knows width/height already (static asset), use them
37
+ if (resolved?.width && resolved?.height) {
38
+ setAspectRatio(resolved.width / resolved.height);
39
+ return;
40
+ }
41
+ // 2) Fall back to getSize for URIs (network, file://, content://)
42
+ const uri = typeof src === 'string'
43
+ ? src
44
+ : (resolved?.uri ??
45
+ (typeof src?.uri === 'string'
46
+ ? src.uri
47
+ : undefined));
48
+ if (uri) {
49
+ Image.getSize(uri, (width, height) => {
50
+ setAspectRatio(width / height);
51
+ }, (err) => console.warn('getSize failed:', err));
52
+ }
53
+ else {
54
+ console.warn('Could not resolve image source for size:', src);
55
+ }
56
+ }, [src]);
57
+ return aspectRatio;
58
+ }
package/package.json CHANGED
@@ -1,35 +1,17 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@proximus/lavender-common-native",
4
- "version": "0.1.0-alpha.0",
4
+ "version": "0.1.0-alpha.11",
5
5
  "description": "Common components for Proximus design system",
6
- "main": "src/index.ts",
7
- "types": "dist/index.d.ts",
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
  "license": "MIT",
14
- "devDependencies": {
15
- "@proximus/lavender-styling-native": "0.1.0-alpha.0"
16
- },
17
11
  "peerDependencies": {
18
12
  "@proximus/lavender-styling-native": "*"
19
13
  },
20
14
  "publishConfig": {
21
15
  "access": "public"
22
- },
23
- "lerna": {
24
- "command": {
25
- "publish": {
26
- "assets": [
27
- "dist",
28
- "src",
29
- "package.json"
30
- ]
31
- }
32
- }
33
- },
34
- "gitHead": "59b3436b786cc1c73b4a20a98b2a85139e75b72e"
16
+ }
35
17
  }
package/CHANGELOG.md DELETED
@@ -1,15 +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-08-13)
7
-
8
- ### Features
9
-
10
- - **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
11
- - **BCRI-3651606:** mono repo creation ([d19f852](https://github.com/Pxs-Corporate/react-native-lavender/commit/d19f852a710963ff85b1a9d31d18188217aa23ab))
12
- - **BCRI-3660857:** cell components ([af9e45c](https://github.com/Pxs-Corporate/react-native-lavender/commit/af9e45cefc20d08d2338380ff4cd8cd6851abe24))
13
- - **BCRI-3689585:** icon module ([f13230d](https://github.com/Pxs-Corporate/react-native-lavender/commit/f13230d9c7643680089a0db2c69b96cd73ff246e))
14
- - **BCRI-3810979:** tile components ([46fc5c7](https://github.com/Pxs-Corporate/react-native-lavender/commit/46fc5c7a0ddff6c2db43fba0de9929626092f265))
15
- - **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
@@ -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"}
package/src/PxCard.tsx DELETED
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
- import {
3
- AccessibilityProps,
4
- StyleProp,
5
- StyleSheet,
6
- View,
7
- ViewProps,
8
- } from 'react-native';
9
-
10
- import { a11y, e2eID } from './utils';
11
- import { useTheme } from '@proximus/lavender-styling-native';
12
-
13
- export interface IPxCardProps extends Readonly<ViewProps> {
14
- children?: Array<React.ReactElement | false | undefined> | React.ReactElement;
15
- wrapperStyle?: StyleProp<any>;
16
- testId?: string;
17
- wrapperA11yProps?: AccessibilityProps;
18
- }
19
-
20
- export function PxCard(props: IPxCardProps) {
21
- const { theme } = useTheme();
22
-
23
- const { children, wrapperStyle, testId, wrapperA11yProps, ...viewProps } =
24
- props;
25
-
26
- return (
27
- <View
28
- style={[
29
- styles.container,
30
- {
31
- backgroundColor: theme.t('BackgroundColorActionNeutralBareDefault'),
32
- },
33
- wrapperStyle,
34
- ]}
35
- {...e2eID(testId)}
36
- {...a11y({
37
- ...wrapperA11yProps,
38
- })}
39
- {...viewProps}
40
- >
41
- {children}
42
- </View>
43
- );
44
- }
45
-
46
- const styles = StyleSheet.create({
47
- container: {
48
- borderRadius: 8,
49
- },
50
- });
Binary file
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './utils';
2
- export * from './PxCard';
package/src/utils.ts DELETED
@@ -1,42 +0,0 @@
1
- import { AccessibilityProps, Platform } from 'react-native';
2
- import Config from 'react-native-config';
3
- import { LaunchArguments } from 'react-native-launch-arguments';
4
-
5
- export interface ITestableAndroid {
6
- accessible: boolean;
7
- accessibilityLabel: string;
8
- }
9
-
10
- export interface ITestableIOS {
11
- testID: string;
12
- }
13
-
14
- export interface ITestable extends ITestableAndroid, ITestableIOS {
15
- appiumID: string;
16
- }
17
-
18
- export function e2eID(id?: string): ITestableAndroid | ITestableIOS | {} {
19
- const { e2e } = LaunchArguments.value();
20
- if (('E2E' === Config.ENV || e2e) && id) {
21
- if (Platform.OS === 'android') {
22
- return {
23
- accessibilityLabel: id,
24
- accessible: true,
25
- };
26
- }
27
- return {
28
- testID: id,
29
- };
30
- }
31
- return {};
32
- }
33
-
34
- export function a11y(a11yProps?: AccessibilityProps): AccessibilityProps {
35
- const { e2e } = LaunchArguments.value();
36
- if ('E2E' !== Config.ENV && !e2e) {
37
- return {
38
- ...a11yProps,
39
- };
40
- }
41
- return {} as any;
42
- }
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.npm.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- },
6
- "include": ["src"],
7
- "exclude": ["dist", "node_modules", "src/**/*.test.ts", "src/**/*.spec.ts"]
8
- }