@pagopa/io-app-design-system 4.0.1 → 4.2.0
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/lib/commonjs/components/alert/Alert.js +34 -7
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/banner/Banner.js +45 -22
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +48 -190
- package/lib/commonjs/components/featureInfo/FeatureInfo.js +27 -26
- package/lib/commonjs/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/commonjs/components/layout/index.js +0 -11
- package/lib/commonjs/components/layout/index.js.map +1 -1
- package/lib/commonjs/components/spacer/Spacer.js +1 -1
- package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
- package/lib/commonjs/components/stack/Stack.js +17 -14
- package/lib/commonjs/components/stack/Stack.js.map +1 -1
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/module/components/alert/Alert.js +36 -9
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/banner/Banner.js +50 -27
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +48 -190
- package/lib/module/components/featureInfo/FeatureInfo.js +29 -28
- package/lib/module/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/module/components/layout/index.js +0 -1
- package/lib/module/components/layout/index.js.map +1 -1
- package/lib/module/components/spacer/Spacer.js +1 -1
- package/lib/module/components/spacer/Spacer.js.map +1 -1
- package/lib/module/components/stack/Stack.js +17 -14
- package/lib/module/components/stack/Stack.js.map +1 -1
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/featureInfo/FeatureInfo.d.ts.map +1 -1
- package/lib/typescript/components/layout/index.d.ts +0 -1
- package/lib/typescript/components/layout/index.d.ts.map +1 -1
- package/lib/typescript/components/spacer/Spacer.d.ts +0 -1
- package/lib/typescript/components/spacer/Spacer.d.ts.map +1 -1
- package/lib/typescript/components/stack/Stack.d.ts +9 -6
- package/lib/typescript/components/stack/Stack.d.ts.map +1 -1
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/alert/Alert.tsx +46 -15
- package/src/components/banner/Banner.tsx +64 -29
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +48 -190
- package/src/components/featureInfo/FeatureInfo.tsx +26 -28
- package/src/components/layout/index.tsx +0 -1
- package/src/components/spacer/Spacer.tsx +2 -4
- package/src/components/stack/Stack.tsx +24 -16
- package/src/core/IOColors.ts +1 -0
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
IOPictograms,
|
|
10
10
|
Icon,
|
|
11
11
|
Pictogram,
|
|
12
|
-
|
|
12
|
+
VStack
|
|
13
13
|
} from "../../components";
|
|
14
|
-
import { IOStyles } from "../../core";
|
|
14
|
+
import { IOStyles, useIOTheme } from "../../core";
|
|
15
15
|
|
|
16
16
|
type PartialFeatureInfo = {
|
|
17
17
|
// Necessary to render main body with different formatting
|
|
@@ -42,11 +42,7 @@ const DEFAULT_PICTOGRAM_SIZE: IOPictogramSizeScale = 48;
|
|
|
42
42
|
|
|
43
43
|
const renderNode = (body: FeatureInfoProps["body"]) => {
|
|
44
44
|
if (typeof body === "string") {
|
|
45
|
-
return
|
|
46
|
-
<BodySmall color="grey-700" testID="infoScreenBody">
|
|
47
|
-
{body}
|
|
48
|
-
</BodySmall>
|
|
49
|
-
);
|
|
45
|
+
return <BodySmall testID="infoScreenBody">{body}</BodySmall>;
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
return body;
|
|
@@ -57,23 +53,25 @@ export const FeatureInfo = ({
|
|
|
57
53
|
pictogramName,
|
|
58
54
|
body,
|
|
59
55
|
action
|
|
60
|
-
}: FeatureInfoProps) =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
}: FeatureInfoProps) => {
|
|
57
|
+
const theme = useIOTheme();
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<View style={[IOStyles.flex, IOStyles.row, IOStyles.alignCenter]}>
|
|
61
|
+
{iconName && (
|
|
62
|
+
<Icon
|
|
63
|
+
name={iconName}
|
|
64
|
+
size={DEFAULT_ICON_SIZE}
|
|
65
|
+
color={theme["icon-decorative"]}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
{pictogramName && (
|
|
69
|
+
<Pictogram name={pictogramName} size={DEFAULT_PICTOGRAM_SIZE} />
|
|
70
|
+
)}
|
|
71
|
+
<HSpacer size={24} />
|
|
72
|
+
<VStack space={4} style={{ flexShrink: 1 }}>
|
|
73
|
+
{renderNode(body)}
|
|
74
|
+
{action && (
|
|
77
75
|
<BodySmall
|
|
78
76
|
weight="Semibold"
|
|
79
77
|
asLink
|
|
@@ -84,8 +82,8 @@ export const FeatureInfo = ({
|
|
|
84
82
|
>
|
|
85
83
|
{action.label}
|
|
86
84
|
</BodySmall>
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
)}
|
|
86
|
+
</VStack>
|
|
89
87
|
</View>
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
);
|
|
89
|
+
};
|
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { hexToRgba, IOColors, IOSpacer } from "../../core";
|
|
4
4
|
|
|
5
|
-
export type SpacerOrientation = "vertical" | "horizontal";
|
|
6
|
-
|
|
7
5
|
type BaseSpacerProps = {
|
|
8
|
-
orientation:
|
|
6
|
+
orientation: "vertical" | "horizontal";
|
|
9
7
|
size: IOSpacer;
|
|
10
8
|
};
|
|
11
9
|
|
|
@@ -21,7 +19,7 @@ const debugBg = hexToRgba(IOColors.red, 0.2);
|
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
21
|
Native `Spacer` component
|
|
24
|
-
@param {
|
|
22
|
+
@param {string} orientation
|
|
25
23
|
@param {IOSpacer} size
|
|
26
24
|
*/
|
|
27
25
|
const Spacer = ({ orientation, size }: BaseSpacerProps) => {
|
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
2
|
import { View, ViewStyle } from "react-native";
|
|
3
3
|
import { IOSpacer } from "../../core";
|
|
4
4
|
|
|
5
5
|
type AllowedStyleProps = Pick<
|
|
6
6
|
ViewStyle,
|
|
7
|
-
"alignItems" | "flexShrink" | "flexGrow" | "flex" | "flexWrap"
|
|
7
|
+
"alignItems" | "flexShrink" | "flexGrow" | "flex" | "flexWrap" | "width"
|
|
8
8
|
>;
|
|
9
9
|
|
|
10
|
-
type Stack = {
|
|
10
|
+
type Stack = PropsWithChildren<{
|
|
11
11
|
space?: IOSpacer;
|
|
12
|
-
children: ReactNode;
|
|
13
12
|
style?: AllowedStyleProps;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
type BaseStack = Stack & {
|
|
16
|
+
orientation: "vertical" | "horizontal";
|
|
14
17
|
};
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
Horizontal Stack component
|
|
18
21
|
@param {IOSpacer} space
|
|
19
22
|
*/
|
|
20
|
-
|
|
23
|
+
|
|
24
|
+
const Stack = ({
|
|
25
|
+
space,
|
|
26
|
+
style,
|
|
27
|
+
orientation = "vertical",
|
|
28
|
+
children
|
|
29
|
+
}: BaseStack) => (
|
|
21
30
|
<View
|
|
22
31
|
style={{
|
|
23
32
|
display: "flex",
|
|
24
|
-
flexDirection: "row",
|
|
33
|
+
flexDirection: orientation === "horizontal" ? "row" : "column",
|
|
25
34
|
gap: space,
|
|
26
35
|
...style
|
|
27
36
|
}}
|
|
@@ -30,20 +39,19 @@ export const HStack = ({ space, children, style }: Stack) => (
|
|
|
30
39
|
</View>
|
|
31
40
|
);
|
|
32
41
|
|
|
42
|
+
export const HStack = ({ children, ...props }: Stack) => (
|
|
43
|
+
<Stack orientation="horizontal" {...props}>
|
|
44
|
+
{children}
|
|
45
|
+
</Stack>
|
|
46
|
+
);
|
|
47
|
+
|
|
33
48
|
/**
|
|
34
49
|
Vertical Stack component
|
|
35
50
|
@param {IOSpacer} space
|
|
36
51
|
*/
|
|
37
52
|
|
|
38
|
-
export const VStack = ({
|
|
39
|
-
<
|
|
40
|
-
style={{
|
|
41
|
-
display: "flex",
|
|
42
|
-
flexDirection: "column",
|
|
43
|
-
gap: space,
|
|
44
|
-
...style
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
53
|
+
export const VStack = ({ children, ...props }: Stack) => (
|
|
54
|
+
<Stack orientation="vertical" {...props}>
|
|
47
55
|
{children}
|
|
48
|
-
</
|
|
56
|
+
</Stack>
|
|
49
57
|
);
|
package/src/core/IOColors.ts
CHANGED