@jobber/components-native 0.54.4-JOB-88641.9 → 0.54.4
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/package.json +3 -3
- package/dist/src/Banner/Banner.js +11 -32
- package/dist/src/Banner/Banner.style.js +11 -13
- package/dist/src/Banner/components/BannerIcon/BannerIcon.js +5 -4
- package/dist/src/Banner/constants.js +12 -0
- package/dist/src/TextList/TextList.style.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/Banner/Banner.style.d.ts +10 -12
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.d.ts +2 -4
- package/dist/types/src/Banner/constants.d.ts +2 -0
- package/dist/types/src/Banner/types.d.ts +2 -2
- package/dist/types/src/TextList/TextList.style.d.ts +1 -1
- package/package.json +3 -3
- package/src/Banner/Banner.style.ts +11 -13
- package/src/Banner/Banner.test.tsx +36 -144
- package/src/Banner/Banner.tsx +20 -57
- package/src/Banner/components/BannerIcon/BannerIcon.tsx +6 -8
- package/src/Banner/constants.ts +14 -0
- package/src/Banner/types.ts +2 -2
- package/src/TextList/TextList.style.ts +1 -1
- package/src/TextList/__snapshots__/TextList.test.tsx.snap +1 -1
- package/dist/src/Banner/components/BannerIcon/BannerIcon.style.js +0 -17
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.style.d.ts +0 -15
- package/src/Banner/components/BannerIcon/BannerIcon.style.ts +0 -18
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.54.4
|
|
3
|
+
"version": "0.54.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@jobber/design": "^0.54.0",
|
|
40
|
-
"@jobber/hooks": "^2.
|
|
40
|
+
"@jobber/hooks": "^2.9.0",
|
|
41
41
|
"@react-native-clipboard/clipboard": "^1.11.2",
|
|
42
42
|
"@react-native-picker/picker": "^2.4.10",
|
|
43
43
|
"autolinker": "^4.0.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"react-native-reanimated": "^2.17.0",
|
|
85
85
|
"react-native-safe-area-context": "^4.5.2"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "4780cde621bb770d24f6bd324ee868b302afc579"
|
|
88
88
|
}
|
|
@@ -1,51 +1,30 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Pressable,
|
|
2
|
+
import { Pressable, View } from "react-native";
|
|
3
|
+
import { BannerTypeStyles } from "./constants";
|
|
3
4
|
import { styles } from "./Banner.style";
|
|
4
5
|
import { BannerIcon } from "./components/BannerIcon/BannerIcon";
|
|
5
6
|
import { Content } from "../Content";
|
|
6
7
|
import { Text } from "../Text";
|
|
7
8
|
import { TextList } from "../TextList";
|
|
8
9
|
import { ActionLabel } from "../ActionLabel";
|
|
9
|
-
import { Typography } from "../Typography";
|
|
10
10
|
export function Banner({ action, details, text, type, children, icon, }) {
|
|
11
|
-
|
|
12
|
-
const shouldFlow = Boolean(React.Children.count(children) === 1 && !text && !details) ||
|
|
13
|
-
Boolean(text && !details && !children);
|
|
14
|
-
return (React.createElement(Pressable, { style: [styles.container], accessibilityRole: "alert", onPress: action === null || action === void 0 ? void 0 : action.onPress },
|
|
11
|
+
return (React.createElement(Pressable, { style: [styles.container, BannerTypeStyles[type].styles], accessibilityRole: "alert", onPress: action === null || action === void 0 ? void 0 : action.onPress },
|
|
15
12
|
React.createElement(Content, { childSpacing: "small" },
|
|
16
13
|
React.createElement(View, { style: styles.bannerContent },
|
|
17
|
-
|
|
14
|
+
icon && React.createElement(BannerIcon, { icon: icon }),
|
|
18
15
|
React.createElement(View, { style: styles.contentContainer },
|
|
19
16
|
React.createElement(View, { style: styles.childrenContainer },
|
|
20
|
-
React.createElement(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
shouldFlow && React.createElement(Typography, null, " | "),
|
|
26
|
-
React.createElement(ActionLabel, { align: "start" }, action.label))))))))));
|
|
17
|
+
React.createElement(BannerChildren, null, children)),
|
|
18
|
+
text && (React.createElement(View, { style: styles.textContainer },
|
|
19
|
+
React.createElement(Text, { level: "textSupporting" }, text))),
|
|
20
|
+
details && React.createElement(TextList, { items: details, level: "textSupporting" }))),
|
|
21
|
+
action && React.createElement(ActionLabel, { align: "start" }, action.label))));
|
|
27
22
|
}
|
|
28
|
-
function BannerChildren({ children }) {
|
|
23
|
+
function BannerChildren({ children, }) {
|
|
29
24
|
if (!children)
|
|
30
25
|
return React.createElement(React.Fragment, null);
|
|
31
26
|
if (children && typeof children === "string") {
|
|
32
|
-
return React.createElement(Text, { level: "
|
|
27
|
+
return React.createElement(Text, { level: "textSupporting" }, children);
|
|
33
28
|
}
|
|
34
29
|
return React.createElement(React.Fragment, null, children);
|
|
35
30
|
}
|
|
36
|
-
function WrappingElement({ shouldFlow, children, }) {
|
|
37
|
-
if (shouldFlow) {
|
|
38
|
-
return React.createElement(RNText, { testID: "ATL-Banner-RNText" }, children);
|
|
39
|
-
}
|
|
40
|
-
return (React.createElement(View, { testID: "ATL-Banner-View", style: styles.contentSpacing }, children));
|
|
41
|
-
}
|
|
42
|
-
function getBannerIcon(type) {
|
|
43
|
-
switch (type) {
|
|
44
|
-
case "notice":
|
|
45
|
-
return "starburst";
|
|
46
|
-
case "warning":
|
|
47
|
-
return "help";
|
|
48
|
-
case "error":
|
|
49
|
-
return "alert";
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -3,15 +3,19 @@ import { tokens } from "../utils/design";
|
|
|
3
3
|
export const styles = StyleSheet.create({
|
|
4
4
|
container: {
|
|
5
5
|
width: "100%",
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
},
|
|
7
|
+
error: {
|
|
8
|
+
backgroundColor: tokens["color-critical--surface"],
|
|
9
|
+
},
|
|
10
|
+
warning: {
|
|
11
|
+
backgroundColor: tokens["color-warning--surface"],
|
|
12
|
+
},
|
|
13
|
+
notice: {
|
|
14
|
+
backgroundColor: tokens["color-informative--surface"],
|
|
10
15
|
},
|
|
11
16
|
bannerContent: {
|
|
12
17
|
flexDirection: "row",
|
|
13
18
|
alignItems: "flex-start",
|
|
14
|
-
gap: tokens["space-small"] + tokens["space-smaller"],
|
|
15
19
|
},
|
|
16
20
|
contentContainer: {
|
|
17
21
|
flex: 1,
|
|
@@ -22,13 +26,7 @@ export const styles = StyleSheet.create({
|
|
|
22
26
|
textContainer: {
|
|
23
27
|
marginTop: tokens["space-minuscule"],
|
|
24
28
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
bannerChildrenContent: {
|
|
29
|
-
marginBottom: tokens["space-small"],
|
|
30
|
-
},
|
|
31
|
-
contentSpacing: {
|
|
32
|
-
gap: tokens["space-small"],
|
|
29
|
+
bannerIcon: {
|
|
30
|
+
paddingRight: tokens["space-small"],
|
|
33
31
|
},
|
|
34
32
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { tokens } from "@jobber/design";
|
|
2
3
|
import { View } from "react-native";
|
|
3
|
-
import { styles } from "./BannerIcon.style";
|
|
4
4
|
import { Icon } from "../../../Icon";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { styles } from "../../Banner.style";
|
|
6
|
+
export function BannerIcon({ icon }) {
|
|
7
|
+
return (React.createElement(View, { style: styles.bannerIcon },
|
|
8
|
+
React.createElement(Icon, { name: icon, customColor: tokens["color-text"] })));
|
|
8
9
|
}
|