@proximus/lavender-mediacontainer-native 1.2.4-alpha.6

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.
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ export type MediaContainerAspectRatio = '1:1' | '4:3' | '3:2' | '16:9' | '3:1' | '2:3';
4
+ export interface PxMediaContainerProps {
5
+ aspectRatio?: MediaContainerAspectRatio;
6
+ inset?: boolean;
7
+ children?: React.ReactNode;
8
+ style?: StyleProp<ViewStyle>;
9
+ testID?: string;
10
+ }
11
+ export declare function PxMediaContainer({ aspectRatio, inset, children, style, testID, }: PxMediaContainerProps): React.JSX.Element;
12
+ //# sourceMappingURL=PxMediaContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PxMediaContainer.d.ts","sourceRoot":"","sources":["../src/PxMediaContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAC;AAItE,MAAM,MAAM,yBAAyB,GACjC,KAAK,GACL,KAAK,GACL,KAAK,GACL,MAAM,GACN,KAAK,GACL,KAAK,CAAC;AAEV,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAWD,wBAAgB,gBAAgB,CAAC,EAC/B,WAAmB,EACnB,KAAa,EACb,QAAQ,EACR,KAAK,EACL,MAAM,GACP,EAAE,qBAAqB,qBAqBvB"}
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { useTheme } from '@proximus/lavender-styling-native';
4
+ import { e2eID } from '@proximus/lavender-common-native';
5
+ const aspectRatioMap = {
6
+ '1:1': 1,
7
+ '4:3': 4 / 3,
8
+ '3:2': 3 / 2,
9
+ '16:9': 16 / 9,
10
+ '3:1': 3,
11
+ '2:3': 2 / 3,
12
+ };
13
+ export function PxMediaContainer({ aspectRatio = '1:1', inset = false, children, style, testID, }) {
14
+ const { theme } = useTheme();
15
+ const numericAspectRatio = aspectRatioMap[aspectRatio];
16
+ const insetPadding = inset ? theme.t('PaddingMMobile').number : 0;
17
+ return (React.createElement(View, { style: [
18
+ styles.container,
19
+ {
20
+ aspectRatio: numericAspectRatio,
21
+ padding: insetPadding,
22
+ },
23
+ style,
24
+ ], ...(testID && e2eID(testID)) },
25
+ React.createElement(View, { style: styles.media }, children)));
26
+ }
27
+ const styles = StyleSheet.create({
28
+ container: {
29
+ width: '100%',
30
+ overflow: 'hidden',
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
33
+ },
34
+ media: {
35
+ flex: 1,
36
+ width: '100%',
37
+ height: '100%',
38
+ },
39
+ });
@@ -0,0 +1,2 @@
1
+ export * from './PxMediaContainer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './PxMediaContainer';
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@proximus/lavender-mediacontainer-native",
3
+ "version": "1.2.4-alpha.6",
4
+ "description": "Media container component",
5
+ "license": "MIT",
6
+ "main": "dist/index.js",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "peerDependencies": {
12
+ "@proximus/lavender-common-native": "*",
13
+ "@proximus/lavender-styling-native": "*"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ }
18
+ }