@jobber/components-native 0.24.0 → 0.24.1-migrate-te.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.
@@ -0,0 +1,30 @@
1
+ /// <reference types="react" />
2
+ import { Spacing } from "../Content";
3
+ import { TextLevel } from "../Text";
4
+ interface TextListProps {
5
+ /**
6
+ * Text to display.
7
+ */
8
+ readonly items?: string[];
9
+ /**
10
+ * Change the appearance of the text
11
+ */
12
+ readonly emphasis?: "strong";
13
+ /**
14
+ * Visual hierarchy of the text.
15
+ * @default "text"
16
+ */
17
+ readonly level?: TextLevel;
18
+ /**
19
+ * The amount of spacing that content will give.
20
+ * @default "none"
21
+ */
22
+ readonly spacing?: Spacing;
23
+ /**
24
+ * The amount of spacing that will be applied between the list items.
25
+ * @default "none"
26
+ */
27
+ readonly childSpacing?: Spacing;
28
+ }
29
+ export declare function TextList({ items, childSpacing, emphasis, level, spacing, }: TextListProps): JSX.Element;
30
+ export {};
@@ -0,0 +1,14 @@
1
+ export declare const styles: {
2
+ details: {
3
+ flexDirection: "column";
4
+ marginTop: number;
5
+ };
6
+ detail: {
7
+ flexDirection: "row";
8
+ paddingLeft: number;
9
+ };
10
+ detailText: {
11
+ paddingLeft: number;
12
+ flex: number;
13
+ };
14
+ };
@@ -0,0 +1 @@
1
+ export { TextList } from "./TextList";
@@ -16,6 +16,7 @@ export * from "./IconButton";
16
16
  export * from "./InputFieldWrapper";
17
17
  export * from "./InputPressable";
18
18
  export * from "./InputText";
19
+ export * from "./TextList";
19
20
  export * from "./ProgressBar";
20
21
  export * from "./StatusLabel";
21
22
  export * from "./Switch";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.24.0",
3
+ "version": "0.24.1-migrate-te.4+d1f46563",
4
4
  "license": "MIT",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/src/index.js",
@@ -53,5 +53,5 @@
53
53
  "react": "^18",
54
54
  "react-native": ">=0.69.2"
55
55
  },
56
- "gitHead": "f7e84f89bafb316b80e4ba19455eb3ae4e232394"
56
+ "gitHead": "d1f46563a284bbab77190fb7405deb44d4c8a9ba"
57
57
  }
@@ -0,0 +1,17 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { tokens } from "../utils/design";
3
+
4
+ export const styles = StyleSheet.create({
5
+ details: {
6
+ flexDirection: "column",
7
+ marginTop: tokens["space-small"],
8
+ },
9
+ detail: {
10
+ flexDirection: "row",
11
+ paddingLeft: tokens["space-small"],
12
+ },
13
+ detailText: {
14
+ paddingLeft: tokens["space-small"],
15
+ flex: 1,
16
+ },
17
+ });
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { render } from "@testing-library/react-native";
3
+ import { TextList } from "./TextList";
4
+
5
+ describe("TextList", () => {
6
+ describe("when the bulletItems is provided", () => {
7
+ it("displays the text list", () => {
8
+ const items = ["this is list item uno", "this is list item dos"];
9
+ const tree = render(<TextList items={items} />);
10
+
11
+ expect(tree.toJSON()).toMatchSnapshot();
12
+ });
13
+
14
+ it("displays will not display a bulleted list", () => {
15
+ const tree = render(<TextList />);
16
+
17
+ expect(tree.toJSON()).toMatchSnapshot();
18
+ });
19
+ });
20
+ });
@@ -0,0 +1,68 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { styles } from "./TextList.style";
4
+ import { Content, Spacing } from "../Content";
5
+ import { Text, TextLevel } from "../Text";
6
+
7
+ const BULLET_SYMBOL = `\u2022`;
8
+
9
+ interface TextListProps {
10
+ /**
11
+ * Text to display.
12
+ */
13
+ readonly items?: string[];
14
+
15
+ /**
16
+ * Change the appearance of the text
17
+ */
18
+ readonly emphasis?: "strong";
19
+
20
+ /**
21
+ * Visual hierarchy of the text.
22
+ * @default "text"
23
+ */
24
+ readonly level?: TextLevel;
25
+
26
+ /**
27
+ * The amount of spacing that content will give.
28
+ * @default "none"
29
+ */
30
+ readonly spacing?: Spacing;
31
+
32
+ /**
33
+ * The amount of spacing that will be applied between the list items.
34
+ * @default "none"
35
+ */
36
+ readonly childSpacing?: Spacing;
37
+ }
38
+
39
+ export function TextList({
40
+ items,
41
+ childSpacing = "none",
42
+ emphasis,
43
+ level = "text",
44
+ spacing = "none",
45
+ }: TextListProps): JSX.Element {
46
+ return (
47
+ <>
48
+ {items && (
49
+ <View style={styles.details}>
50
+ <Content spacing={spacing} childSpacing={childSpacing}>
51
+ {items.map((item, index) => (
52
+ <View style={styles.detail} key={index}>
53
+ <Text level={level} emphasis={emphasis}>
54
+ {BULLET_SYMBOL}
55
+ </Text>
56
+ <View style={styles.detailText}>
57
+ <Text level={level} emphasis={emphasis}>
58
+ {item}
59
+ </Text>
60
+ </View>
61
+ </View>
62
+ ))}
63
+ </Content>
64
+ </View>
65
+ )}
66
+ </>
67
+ );
68
+ }
@@ -0,0 +1 @@
1
+ export { TextList } from "./TextList";
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export * from "./IconButton";
16
16
  export * from "./InputFieldWrapper";
17
17
  export * from "./InputPressable";
18
18
  export * from "./InputText";
19
+ export * from "./TextList";
19
20
  export * from "./ProgressBar";
20
21
  export * from "./StatusLabel";
21
22
  export * from "./Switch";