@jobber/components-native 0.43.18 → 0.44.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.
@@ -1,15 +1,30 @@
1
1
  import React from "react";
2
- import { Pressable } from "react-native";
2
+ import { Pressable, View } from "react-native";
3
3
  import { BannerTypeStyles } from "./constants";
4
4
  import { styles } from "./Banner.style";
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
- export function Banner({ action, details, text, type, }) {
10
+ export function Banner({ action, details, text, type, children, icon, }) {
10
11
  return (React.createElement(Pressable, { style: [styles.container, BannerTypeStyles[type].styles], accessibilityRole: "alert", onPress: action === null || action === void 0 ? void 0 : action.onPress },
11
12
  React.createElement(Content, { childSpacing: "small" },
12
- React.createElement(Text, { level: "textSupporting" }, text),
13
- details && React.createElement(TextList, { items: details, level: "textSupporting" }),
13
+ React.createElement(View, { style: styles.bannerContent },
14
+ icon && React.createElement(BannerIcon, { icon: icon }),
15
+ React.createElement(View, { style: styles.contentContainer },
16
+ React.createElement(View, { style: styles.childrenContainer },
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" }))),
14
21
  action && React.createElement(ActionLabel, { align: "start" }, action.label))));
15
22
  }
23
+ function BannerChildren({ children, }) {
24
+ if (!children)
25
+ return React.createElement(React.Fragment, null);
26
+ if (children && typeof children === "string") {
27
+ return React.createElement(Text, { level: "textSupporting" }, children);
28
+ }
29
+ return React.createElement(React.Fragment, null, children);
30
+ }
@@ -13,4 +13,20 @@ export const styles = StyleSheet.create({
13
13
  notice: {
14
14
  backgroundColor: tokens["color-informative--surface"],
15
15
  },
16
+ bannerContent: {
17
+ flexDirection: "row",
18
+ alignItems: "flex-start",
19
+ },
20
+ contentContainer: {
21
+ flex: 1,
22
+ },
23
+ childrenContainer: {
24
+ marginTop: tokens["space-smallest"],
25
+ },
26
+ textContainer: {
27
+ marginTop: tokens["space-minuscule"],
28
+ },
29
+ bannerIcon: {
30
+ paddingRight: tokens["space-small"],
31
+ },
16
32
  });
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { tokens } from "@jobber/design";
3
+ import { View } from "react-native";
4
+ import { Icon } from "../../../Icon";
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"] })));
9
+ }