@proximus/lavender-cards-native 2.1.1-alpha.5 → 2.1.1-alpha.51
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/dist/PxCard.d.ts.map +1 -1
- package/dist/PxStatusCard.d.ts +23 -0
- package/dist/PxStatusCard.d.ts.map +1 -0
- package/dist/PxStatusCard.js +94 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +2 -1
package/dist/PxCard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PxCard.d.ts","sourceRoot":"","sources":["../src/PxCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAElB,eAAe,EACf,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAOtB,OAAO,EAEL,2CAA2C,EAC5C,MAAM,0CAA0C,CAAC;AAIlD,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,YAAY,CAAC;CAC/C;AAED,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,oBAAoB,GAAG,mBAAmB,CAAC,EAC1E,2CAA2C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"PxCard.d.ts","sourceRoot":"","sources":["../src/PxCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAElB,eAAe,EACf,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAOtB,OAAO,EAEL,2CAA2C,EAC5C,MAAM,0CAA0C,CAAC;AAIlD,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,YAAY,CAAC;CAC/C;AAED,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,oBAAoB,GAAG,mBAAmB,CAAC,EAC1E,2CAA2C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,eAAe,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IACtC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,qBA0D7D;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,qBAyD1D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { IconName } from '@proximus/lavender-icon/dist/iconNames.js';
|
|
4
|
+
export type PxStatusCardType = 'Information' | 'Success' | 'Warning' | 'Error' | 'Ongoing';
|
|
5
|
+
export interface PxStatusCardProps extends AccessibilityProps {
|
|
6
|
+
type?: PxStatusCardType;
|
|
7
|
+
title: string;
|
|
8
|
+
body?: string;
|
|
9
|
+
ctaLabel?: string;
|
|
10
|
+
ctaIcon?: IconName;
|
|
11
|
+
onPressCTA?: () => void;
|
|
12
|
+
onPressClose?: () => void;
|
|
13
|
+
ctaAccessibilityLabel?: string;
|
|
14
|
+
ctaAccessibilityHint?: string;
|
|
15
|
+
closeAccessibilityLabel?: string;
|
|
16
|
+
closeAccessibilityHint?: string;
|
|
17
|
+
statusIconAriaLabel?: string;
|
|
18
|
+
testID?: string;
|
|
19
|
+
inverted?: boolean;
|
|
20
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
21
|
+
}
|
|
22
|
+
export declare function PxStatusCard(props: PxStatusCardProps): React.JSX.Element;
|
|
23
|
+
//# sourceMappingURL=PxStatusCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PxStatusCard.d.ts","sourceRoot":"","sources":["../src/PxStatusCard.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAG1E,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,SAAS,GACT,SAAS,GACT,OAAO,GACP,SAAS,CAAC;AAEd,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACvC;AAmCD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBAiIpD"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
2
|
+
import { PxButton } from '@proximus/lavender-button-native';
|
|
3
|
+
import { PxButtonIcon } from '@proximus/lavender-buttonicon-native';
|
|
4
|
+
import { PxIcon } from '@proximus/lavender-icon-native';
|
|
5
|
+
import { useTheme } from '@proximus/lavender-styling-native';
|
|
6
|
+
import { Body, Header } from '@proximus/lavender-texts-native';
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
|
+
import { StyleSheet, View, } from 'react-native';
|
|
9
|
+
const BORDER_LEFT_WIDTH = 5;
|
|
10
|
+
const statusMap = {
|
|
11
|
+
Information: {
|
|
12
|
+
icon: 'information_fill',
|
|
13
|
+
iconColor: 'Brand',
|
|
14
|
+
borderColor: 'ColorBorderBrandDefault',
|
|
15
|
+
},
|
|
16
|
+
Success: {
|
|
17
|
+
icon: 'checkmark_fill',
|
|
18
|
+
iconColor: 'PurposeSuccess',
|
|
19
|
+
borderColor: 'ColorBorderPurposeSuccessDefault',
|
|
20
|
+
},
|
|
21
|
+
Warning: {
|
|
22
|
+
icon: 'exclamation_mark_fill',
|
|
23
|
+
iconColor: 'PurposeWarning',
|
|
24
|
+
borderColor: 'ColorBorderPurposeWarningDefault',
|
|
25
|
+
},
|
|
26
|
+
Error: {
|
|
27
|
+
icon: 'minus_fill',
|
|
28
|
+
iconColor: 'PurposeError',
|
|
29
|
+
borderColor: 'ColorBorderPurposeErrorDefault',
|
|
30
|
+
},
|
|
31
|
+
Ongoing: {
|
|
32
|
+
icon: 'clock_fill',
|
|
33
|
+
iconColor: 'PurposeWarning',
|
|
34
|
+
borderColor: 'ColorBorderPurposeWarningDefault',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export function PxStatusCard(props) {
|
|
38
|
+
const { type = 'Information', title, body, ctaLabel, ctaIcon, onPressCTA, onPressClose, ctaAccessibilityLabel, ctaAccessibilityHint, closeAccessibilityLabel, closeAccessibilityHint, statusIconAriaLabel, testID, inverted = false, containerStyle, ...accessibilityProps } = props;
|
|
39
|
+
const { theme } = useTheme();
|
|
40
|
+
const status = statusMap[type];
|
|
41
|
+
const invertedSuffix = inverted ? 'Inverted' : 'Default';
|
|
42
|
+
const iconSize = useMemo(() => theme.t('SizeIconM').number, [theme]);
|
|
43
|
+
return (React.createElement(View, { style: [
|
|
44
|
+
styles.container,
|
|
45
|
+
{
|
|
46
|
+
backgroundColor: theme.t(`ColorBackgroundContainerDefault${invertedSuffix}`),
|
|
47
|
+
borderRadius: theme.t('RadiusMain').number,
|
|
48
|
+
borderLeftWidth: BORDER_LEFT_WIDTH,
|
|
49
|
+
borderLeftColor: theme.t(status.borderColor),
|
|
50
|
+
},
|
|
51
|
+
containerStyle,
|
|
52
|
+
], ...e2eID(testID), ...a11y(accessibilityProps) },
|
|
53
|
+
React.createElement(View, { style: [
|
|
54
|
+
styles.content,
|
|
55
|
+
{
|
|
56
|
+
padding: theme.t('PaddingSMobile').number,
|
|
57
|
+
gap: theme.t('SpacingSMobile').number,
|
|
58
|
+
},
|
|
59
|
+
] },
|
|
60
|
+
React.createElement(View, { style: {
|
|
61
|
+
width: iconSize,
|
|
62
|
+
height: iconSize,
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
} },
|
|
66
|
+
React.createElement(PxIcon, { name: status.icon, size: "M", color: status.iconColor, inverted: inverted, accessibilityLabel: statusIconAriaLabel, ...(testID && e2eID(`${testID}-icon`)) })),
|
|
67
|
+
React.createElement(View, { style: [
|
|
68
|
+
styles.textContainer,
|
|
69
|
+
{ gap: theme.t('SpacingXsMobile').number, marginTop: 3 },
|
|
70
|
+
] },
|
|
71
|
+
React.createElement(Header, { style: {
|
|
72
|
+
fontSize: theme.t('TextSizeHeadingSMobile').number,
|
|
73
|
+
}, inverted: inverted, ...(testID && e2eID(`${testID}-title`)) }, title),
|
|
74
|
+
body && (React.createElement(Body, { style: {
|
|
75
|
+
fontSize: theme.t('TextSizeBodyMMobile').number,
|
|
76
|
+
}, inverted: inverted, ...(testID && e2eID(`${testID}-body`)) }, body)),
|
|
77
|
+
ctaLabel && (React.createElement(PxButton, { variant: "tertiary", title: ctaLabel, onPress: onPressCTA, inverted: inverted, suffix: React.createElement(PxIcon, { name: ctaIcon ?? 'plus' }), accessibilityLabel: ctaAccessibilityLabel || ctaLabel, accessibilityHint: ctaAccessibilityHint, wrapperStyle: {
|
|
78
|
+
marginTop: theme.t('SpacingSMobile').number,
|
|
79
|
+
alignSelf: 'flex-start',
|
|
80
|
+
}, ...(testID && e2eID(`${testID}-cta-button`)) }))),
|
|
81
|
+
onPressClose && (React.createElement(PxButtonIcon, { iconName: "cross", variant: "secondary", onPress: onPressClose, size: "small", inverted: inverted, accessibilityLabel: closeAccessibilityLabel || 'Close', accessibilityHint: closeAccessibilityHint, ...(testID && e2eID(`${testID}-close-button`)) })))));
|
|
82
|
+
}
|
|
83
|
+
const styles = StyleSheet.create({
|
|
84
|
+
container: {
|
|
85
|
+
overflow: 'hidden',
|
|
86
|
+
},
|
|
87
|
+
content: {
|
|
88
|
+
flexDirection: 'row',
|
|
89
|
+
alignItems: 'flex-start',
|
|
90
|
+
},
|
|
91
|
+
textContainer: {
|
|
92
|
+
flex: 1,
|
|
93
|
+
},
|
|
94
|
+
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-cards-native",
|
|
3
|
-
"version": "2.1.1-alpha.
|
|
3
|
+
"version": "2.1.1-alpha.51",
|
|
4
4
|
"description": "Card component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"@proximus/lavender-button-native": "*",
|
|
12
12
|
"@proximus/lavender-buttonicon-native": "*",
|
|
13
13
|
"@proximus/lavender-common-native": "*",
|
|
14
|
+
"@proximus/lavender-icon-native": "*",
|
|
14
15
|
"@proximus/lavender-styling-native": "*",
|
|
15
16
|
"@proximus/lavender-tag-native": "*",
|
|
16
17
|
"@proximus/lavender-texts-native": "*"
|