@jobber/components-native 0.25.1 → 0.26.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/dist/src/TextList/TextList.js +13 -0
- package/dist/src/TextList/TextList.style.js +16 -0
- package/dist/src/TextList/index.js +1 -0
- package/dist/src/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/TextList/TextList.d.ts +30 -0
- package/dist/types/src/TextList/TextList.style.d.ts +14 -0
- package/dist/types/src/TextList/index.d.ts +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/TextList/TextList.style.ts +17 -0
- package/src/TextList/TextList.test.tsx +20 -0
- package/src/TextList/TextList.tsx +68 -0
- package/src/TextList/__snapshots__/TextList.test.tsx.snap +205 -0
- package/src/TextList/index.ts +1 -0
- package/src/index.ts +1 -0
|
@@ -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 @@
|
|
|
1
|
+
export { TextList } from "./TextList";
|
|
@@ -17,6 +17,7 @@ export * from "./IconButton";
|
|
|
17
17
|
export * from "./InputFieldWrapper";
|
|
18
18
|
export * from "./InputPressable";
|
|
19
19
|
export * from "./InputText";
|
|
20
|
+
export * from "./TextList";
|
|
20
21
|
export * from "./ProgressBar";
|
|
21
22
|
export * from "./StatusLabel";
|
|
22
23
|
export * from "./Switch";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"module": "dist/src/index.js",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react": "^18",
|
|
56
56
|
"react-native": ">=0.69.2"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "8b036ebea9748a095b6a1d29ea2b45c0958a286b"
|
|
59
59
|
}
|
|
@@ -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,205 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`TextList when the bulletItems is provided displays the text list 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
{
|
|
7
|
+
"flexDirection": "column",
|
|
8
|
+
"marginTop": 8,
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
>
|
|
12
|
+
<View
|
|
13
|
+
style={
|
|
14
|
+
[
|
|
15
|
+
{},
|
|
16
|
+
{
|
|
17
|
+
"padding": 0,
|
|
18
|
+
},
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
>
|
|
22
|
+
<View
|
|
23
|
+
style={
|
|
24
|
+
[
|
|
25
|
+
{},
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
>
|
|
29
|
+
<View
|
|
30
|
+
style={
|
|
31
|
+
{
|
|
32
|
+
"flexDirection": "row",
|
|
33
|
+
"paddingLeft": 8,
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
>
|
|
37
|
+
<Text
|
|
38
|
+
accessibilityRole="text"
|
|
39
|
+
adjustsFontSizeToFit={false}
|
|
40
|
+
allowFontScaling={true}
|
|
41
|
+
collapsable={false}
|
|
42
|
+
maxFontSizeMultiplier={3.125}
|
|
43
|
+
selectable={true}
|
|
44
|
+
selectionColor="rgb(132, 234, 0)"
|
|
45
|
+
style={
|
|
46
|
+
[
|
|
47
|
+
{
|
|
48
|
+
"fontFamily": "inter-regular",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"color": "rgb(66, 78, 86)",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"textAlign": "left",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"fontSize": 16,
|
|
58
|
+
"lineHeight": 20,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"letterSpacing": 0,
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
>
|
|
66
|
+
•
|
|
67
|
+
</Text>
|
|
68
|
+
<View
|
|
69
|
+
style={
|
|
70
|
+
{
|
|
71
|
+
"flex": 1,
|
|
72
|
+
"paddingLeft": 8,
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
>
|
|
76
|
+
<Text
|
|
77
|
+
accessibilityRole="text"
|
|
78
|
+
adjustsFontSizeToFit={false}
|
|
79
|
+
allowFontScaling={true}
|
|
80
|
+
collapsable={false}
|
|
81
|
+
maxFontSizeMultiplier={3.125}
|
|
82
|
+
selectable={true}
|
|
83
|
+
selectionColor="rgb(132, 234, 0)"
|
|
84
|
+
style={
|
|
85
|
+
[
|
|
86
|
+
{
|
|
87
|
+
"fontFamily": "inter-regular",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"color": "rgb(66, 78, 86)",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"textAlign": "left",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"fontSize": 16,
|
|
97
|
+
"lineHeight": 20,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"letterSpacing": 0,
|
|
101
|
+
},
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
>
|
|
105
|
+
this is list item uno
|
|
106
|
+
</Text>
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
</View>
|
|
110
|
+
<View
|
|
111
|
+
style={
|
|
112
|
+
[
|
|
113
|
+
{},
|
|
114
|
+
{
|
|
115
|
+
"padding": 0,
|
|
116
|
+
},
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
>
|
|
120
|
+
<View
|
|
121
|
+
style={
|
|
122
|
+
{
|
|
123
|
+
"flexDirection": "row",
|
|
124
|
+
"paddingLeft": 8,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
>
|
|
128
|
+
<Text
|
|
129
|
+
accessibilityRole="text"
|
|
130
|
+
adjustsFontSizeToFit={false}
|
|
131
|
+
allowFontScaling={true}
|
|
132
|
+
collapsable={false}
|
|
133
|
+
maxFontSizeMultiplier={3.125}
|
|
134
|
+
selectable={true}
|
|
135
|
+
selectionColor="rgb(132, 234, 0)"
|
|
136
|
+
style={
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
"fontFamily": "inter-regular",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"color": "rgb(66, 78, 86)",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"textAlign": "left",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"fontSize": 16,
|
|
149
|
+
"lineHeight": 20,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"letterSpacing": 0,
|
|
153
|
+
},
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
>
|
|
157
|
+
•
|
|
158
|
+
</Text>
|
|
159
|
+
<View
|
|
160
|
+
style={
|
|
161
|
+
{
|
|
162
|
+
"flex": 1,
|
|
163
|
+
"paddingLeft": 8,
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
>
|
|
167
|
+
<Text
|
|
168
|
+
accessibilityRole="text"
|
|
169
|
+
adjustsFontSizeToFit={false}
|
|
170
|
+
allowFontScaling={true}
|
|
171
|
+
collapsable={false}
|
|
172
|
+
maxFontSizeMultiplier={3.125}
|
|
173
|
+
selectable={true}
|
|
174
|
+
selectionColor="rgb(132, 234, 0)"
|
|
175
|
+
style={
|
|
176
|
+
[
|
|
177
|
+
{
|
|
178
|
+
"fontFamily": "inter-regular",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"color": "rgb(66, 78, 86)",
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"textAlign": "left",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"fontSize": 16,
|
|
188
|
+
"lineHeight": 20,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"letterSpacing": 0,
|
|
192
|
+
},
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
>
|
|
196
|
+
this is list item dos
|
|
197
|
+
</Text>
|
|
198
|
+
</View>
|
|
199
|
+
</View>
|
|
200
|
+
</View>
|
|
201
|
+
</View>
|
|
202
|
+
</View>
|
|
203
|
+
`;
|
|
204
|
+
|
|
205
|
+
exports[`TextList when the bulletItems is provided displays will not display a bulleted list 1`] = `null`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextList } from "./TextList";
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./IconButton";
|
|
|
17
17
|
export * from "./InputFieldWrapper";
|
|
18
18
|
export * from "./InputPressable";
|
|
19
19
|
export * from "./InputText";
|
|
20
|
+
export * from "./TextList";
|
|
20
21
|
export * from "./ProgressBar";
|
|
21
22
|
export * from "./StatusLabel";
|
|
22
23
|
export * from "./Switch";
|