@jobber/components-native 0.7.0 → 0.8.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.
@@ -0,0 +1,554 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`StatusLabel alignment when alignment prop set to "end" should match snapshot 1`] = `
4
+ <View
5
+ style={
6
+ [
7
+ {
8
+ "flexDirection": "row",
9
+ "flexWrap": "nowrap",
10
+ "justifyContent": "flex-end",
11
+ },
12
+ false,
13
+ ]
14
+ }
15
+ >
16
+ <View
17
+ style={
18
+ {
19
+ "flexShrink": 1,
20
+ }
21
+ }
22
+ >
23
+ <Text
24
+ accessibilityRole="text"
25
+ adjustsFontSizeToFit={false}
26
+ allowFontScaling={true}
27
+ collapsable={false}
28
+ maxFontSizeMultiplier={1.1428571428571428}
29
+ selectable={true}
30
+ selectionColor="rgb(160, 215, 42)"
31
+ style={
32
+ [
33
+ {
34
+ "fontFamily": "inter-medium",
35
+ },
36
+ {
37
+ "color": "rgba(101, 120, 132, 1)",
38
+ },
39
+ {
40
+ "textAlign": "right",
41
+ },
42
+ {
43
+ "fontSize": 14,
44
+ "lineHeight": 18,
45
+ },
46
+ {
47
+ "letterSpacing": 0,
48
+ },
49
+ ]
50
+ }
51
+ >
52
+ End Aligned
53
+ </Text>
54
+ </View>
55
+ <View
56
+ style={
57
+ {
58
+ "width": 8,
59
+ }
60
+ }
61
+ />
62
+ <View
63
+ style={
64
+ [
65
+ {
66
+ "backgroundColor": "rgb(125, 176, 14)",
67
+ "borderRadius": 2,
68
+ "height": 12,
69
+ "marginTop": 3,
70
+ "width": 12,
71
+ },
72
+ {
73
+ "backgroundColor": "rgb(125, 176, 14)",
74
+ },
75
+ ]
76
+ }
77
+ testID="successLabelIcon"
78
+ />
79
+ </View>
80
+ `;
81
+
82
+ exports[`StatusLabel alignment when alignment prop set to default ("start") should match snapshot 1`] = `
83
+ <View
84
+ style={
85
+ [
86
+ {
87
+ "flexDirection": "row",
88
+ "flexWrap": "nowrap",
89
+ "justifyContent": "flex-end",
90
+ },
91
+ false,
92
+ ]
93
+ }
94
+ >
95
+ <View
96
+ style={
97
+ {
98
+ "flexShrink": 1,
99
+ }
100
+ }
101
+ >
102
+ <Text
103
+ accessibilityRole="text"
104
+ adjustsFontSizeToFit={false}
105
+ allowFontScaling={true}
106
+ collapsable={false}
107
+ maxFontSizeMultiplier={1.1428571428571428}
108
+ selectable={true}
109
+ selectionColor="rgb(160, 215, 42)"
110
+ style={
111
+ [
112
+ {
113
+ "fontFamily": "inter-medium",
114
+ },
115
+ {
116
+ "color": "rgba(101, 120, 132, 1)",
117
+ },
118
+ {
119
+ "textAlign": "right",
120
+ },
121
+ {
122
+ "fontSize": 14,
123
+ "lineHeight": 18,
124
+ },
125
+ {
126
+ "letterSpacing": 0,
127
+ },
128
+ ]
129
+ }
130
+ >
131
+ Start Aligned
132
+ </Text>
133
+ </View>
134
+ <View
135
+ style={
136
+ {
137
+ "width": 8,
138
+ }
139
+ }
140
+ />
141
+ <View
142
+ style={
143
+ [
144
+ {
145
+ "backgroundColor": "rgb(125, 176, 14)",
146
+ "borderRadius": 2,
147
+ "height": 12,
148
+ "marginTop": 3,
149
+ "width": 12,
150
+ },
151
+ {
152
+ "backgroundColor": "rgb(125, 176, 14)",
153
+ },
154
+ ]
155
+ }
156
+ testID="successLabelIcon"
157
+ />
158
+ </View>
159
+ `;
160
+
161
+ exports[`StatusLabel status when status prop set to "critical" should match snapshot 1`] = `
162
+ <View
163
+ style={
164
+ [
165
+ {
166
+ "flexDirection": "row",
167
+ "flexWrap": "nowrap",
168
+ "justifyContent": "flex-end",
169
+ },
170
+ false,
171
+ ]
172
+ }
173
+ >
174
+ <View
175
+ style={
176
+ {
177
+ "flexShrink": 1,
178
+ }
179
+ }
180
+ >
181
+ <Text
182
+ accessibilityRole="text"
183
+ adjustsFontSizeToFit={false}
184
+ allowFontScaling={true}
185
+ collapsable={false}
186
+ maxFontSizeMultiplier={1.1428571428571428}
187
+ selectable={true}
188
+ selectionColor="rgb(160, 215, 42)"
189
+ style={
190
+ [
191
+ {
192
+ "fontFamily": "inter-medium",
193
+ },
194
+ {
195
+ "color": "rgba(101, 120, 132, 1)",
196
+ },
197
+ {
198
+ "textAlign": "right",
199
+ },
200
+ {
201
+ "fontSize": 14,
202
+ "lineHeight": 18,
203
+ },
204
+ {
205
+ "letterSpacing": 0,
206
+ },
207
+ ]
208
+ }
209
+ >
210
+ Critical
211
+ </Text>
212
+ </View>
213
+ <View
214
+ style={
215
+ {
216
+ "width": 8,
217
+ }
218
+ }
219
+ />
220
+ <View
221
+ style={
222
+ [
223
+ {
224
+ "backgroundColor": "rgb(125, 176, 14)",
225
+ "borderRadius": 2,
226
+ "height": 12,
227
+ "marginTop": 3,
228
+ "width": 12,
229
+ },
230
+ {
231
+ "backgroundColor": "rgb(201, 66, 33)",
232
+ },
233
+ ]
234
+ }
235
+ testID="criticalLabelIcon"
236
+ />
237
+ </View>
238
+ `;
239
+
240
+ exports[`StatusLabel status when status prop set to "inactive" should match snapshot 1`] = `
241
+ <View
242
+ style={
243
+ [
244
+ {
245
+ "flexDirection": "row",
246
+ "flexWrap": "nowrap",
247
+ "justifyContent": "flex-end",
248
+ },
249
+ false,
250
+ ]
251
+ }
252
+ >
253
+ <View
254
+ style={
255
+ {
256
+ "flexShrink": 1,
257
+ }
258
+ }
259
+ >
260
+ <Text
261
+ accessibilityRole="text"
262
+ adjustsFontSizeToFit={false}
263
+ allowFontScaling={true}
264
+ collapsable={false}
265
+ maxFontSizeMultiplier={1.1428571428571428}
266
+ selectable={true}
267
+ selectionColor="rgb(160, 215, 42)"
268
+ style={
269
+ [
270
+ {
271
+ "fontFamily": "inter-medium",
272
+ },
273
+ {
274
+ "color": "rgba(101, 120, 132, 1)",
275
+ },
276
+ {
277
+ "textAlign": "right",
278
+ },
279
+ {
280
+ "fontSize": 14,
281
+ "lineHeight": 18,
282
+ },
283
+ {
284
+ "letterSpacing": 0,
285
+ },
286
+ ]
287
+ }
288
+ >
289
+ Inactive
290
+ </Text>
291
+ </View>
292
+ <View
293
+ style={
294
+ {
295
+ "width": 8,
296
+ }
297
+ }
298
+ />
299
+ <View
300
+ style={
301
+ [
302
+ {
303
+ "backgroundColor": "rgb(125, 176, 14)",
304
+ "borderRadius": 2,
305
+ "height": 12,
306
+ "marginTop": 3,
307
+ "width": 12,
308
+ },
309
+ {
310
+ "backgroundColor": "rgb(77, 105, 116)",
311
+ },
312
+ ]
313
+ }
314
+ testID="inactiveLabelIcon"
315
+ />
316
+ </View>
317
+ `;
318
+
319
+ exports[`StatusLabel status when status prop set to "informative" should match snapshot 1`] = `
320
+ <View
321
+ style={
322
+ [
323
+ {
324
+ "flexDirection": "row",
325
+ "flexWrap": "nowrap",
326
+ "justifyContent": "flex-end",
327
+ },
328
+ false,
329
+ ]
330
+ }
331
+ >
332
+ <View
333
+ style={
334
+ {
335
+ "flexShrink": 1,
336
+ }
337
+ }
338
+ >
339
+ <Text
340
+ accessibilityRole="text"
341
+ adjustsFontSizeToFit={false}
342
+ allowFontScaling={true}
343
+ collapsable={false}
344
+ maxFontSizeMultiplier={1.1428571428571428}
345
+ selectable={true}
346
+ selectionColor="rgb(160, 215, 42)"
347
+ style={
348
+ [
349
+ {
350
+ "fontFamily": "inter-medium",
351
+ },
352
+ {
353
+ "color": "rgba(101, 120, 132, 1)",
354
+ },
355
+ {
356
+ "textAlign": "right",
357
+ },
358
+ {
359
+ "fontSize": 14,
360
+ "lineHeight": 18,
361
+ },
362
+ {
363
+ "letterSpacing": 0,
364
+ },
365
+ ]
366
+ }
367
+ >
368
+ Informative
369
+ </Text>
370
+ </View>
371
+ <View
372
+ style={
373
+ {
374
+ "width": 8,
375
+ }
376
+ }
377
+ />
378
+ <View
379
+ style={
380
+ [
381
+ {
382
+ "backgroundColor": "rgb(125, 176, 14)",
383
+ "borderRadius": 2,
384
+ "height": 12,
385
+ "marginTop": 3,
386
+ "width": 12,
387
+ },
388
+ {
389
+ "backgroundColor": "rgb(60, 162, 224)",
390
+ },
391
+ ]
392
+ }
393
+ testID="informativeLabelIcon"
394
+ />
395
+ </View>
396
+ `;
397
+
398
+ exports[`StatusLabel status when status prop set to "warning" should match snapshot 1`] = `
399
+ <View
400
+ style={
401
+ [
402
+ {
403
+ "flexDirection": "row",
404
+ "flexWrap": "nowrap",
405
+ "justifyContent": "flex-end",
406
+ },
407
+ false,
408
+ ]
409
+ }
410
+ >
411
+ <View
412
+ style={
413
+ {
414
+ "flexShrink": 1,
415
+ }
416
+ }
417
+ >
418
+ <Text
419
+ accessibilityRole="text"
420
+ adjustsFontSizeToFit={false}
421
+ allowFontScaling={true}
422
+ collapsable={false}
423
+ maxFontSizeMultiplier={1.1428571428571428}
424
+ selectable={true}
425
+ selectionColor="rgb(160, 215, 42)"
426
+ style={
427
+ [
428
+ {
429
+ "fontFamily": "inter-medium",
430
+ },
431
+ {
432
+ "color": "rgba(101, 120, 132, 1)",
433
+ },
434
+ {
435
+ "textAlign": "right",
436
+ },
437
+ {
438
+ "fontSize": 14,
439
+ "lineHeight": 18,
440
+ },
441
+ {
442
+ "letterSpacing": 0,
443
+ },
444
+ ]
445
+ }
446
+ >
447
+ Warning
448
+ </Text>
449
+ </View>
450
+ <View
451
+ style={
452
+ {
453
+ "width": 8,
454
+ }
455
+ }
456
+ />
457
+ <View
458
+ style={
459
+ [
460
+ {
461
+ "backgroundColor": "rgb(125, 176, 14)",
462
+ "borderRadius": 2,
463
+ "height": 12,
464
+ "marginTop": 3,
465
+ "width": 12,
466
+ },
467
+ {
468
+ "backgroundColor": "rgb(221, 195, 15)",
469
+ },
470
+ ]
471
+ }
472
+ testID="warningLabelIcon"
473
+ />
474
+ </View>
475
+ `;
476
+
477
+ exports[`StatusLabel status when status prop set to default ("success") should match snapshot 1`] = `
478
+ <View
479
+ style={
480
+ [
481
+ {
482
+ "flexDirection": "row",
483
+ "flexWrap": "nowrap",
484
+ "justifyContent": "flex-end",
485
+ },
486
+ false,
487
+ ]
488
+ }
489
+ >
490
+ <View
491
+ style={
492
+ {
493
+ "flexShrink": 1,
494
+ }
495
+ }
496
+ >
497
+ <Text
498
+ accessibilityRole="text"
499
+ adjustsFontSizeToFit={false}
500
+ allowFontScaling={true}
501
+ collapsable={false}
502
+ maxFontSizeMultiplier={1.1428571428571428}
503
+ selectable={true}
504
+ selectionColor="rgb(160, 215, 42)"
505
+ style={
506
+ [
507
+ {
508
+ "fontFamily": "inter-medium",
509
+ },
510
+ {
511
+ "color": "rgba(101, 120, 132, 1)",
512
+ },
513
+ {
514
+ "textAlign": "right",
515
+ },
516
+ {
517
+ "fontSize": 14,
518
+ "lineHeight": 18,
519
+ },
520
+ {
521
+ "letterSpacing": 0,
522
+ },
523
+ ]
524
+ }
525
+ >
526
+ Success
527
+ </Text>
528
+ </View>
529
+ <View
530
+ style={
531
+ {
532
+ "width": 8,
533
+ }
534
+ }
535
+ />
536
+ <View
537
+ style={
538
+ [
539
+ {
540
+ "backgroundColor": "rgb(125, 176, 14)",
541
+ "borderRadius": 2,
542
+ "height": 12,
543
+ "marginTop": 3,
544
+ "width": 12,
545
+ },
546
+ {
547
+ "backgroundColor": "rgb(125, 176, 14)",
548
+ },
549
+ ]
550
+ }
551
+ testID="successLabelIcon"
552
+ />
553
+ </View>
554
+ `;
@@ -0,0 +1,2 @@
1
+ export { StatusLabel } from "./StatusLabel";
2
+ export type { StatusType, StatusLabelType } from "./StatusLabel";
@@ -1,4 +1,5 @@
1
- import { StyleSheet, TextStyle } from "react-native";
1
+ import { Platform, StyleSheet, TextStyle } from "react-native";
2
+ import { webFonts } from "./webFonts";
2
3
  import { tokens } from "../utils/design";
3
4
 
4
5
  const extravagantLineHeight = tokens["typography--lineHeight-extravagant"];
@@ -10,23 +11,7 @@ const baseLineHeight = tokens["typography--lineHeight-base"];
10
11
  const tightLineHeight = tokens["typography--lineHeight-tight"];
11
12
  const minisculeLineHeight = tokens["typography--lineHeight-miniscule"];
12
13
 
13
- /**
14
- * `StyleSheet` for Typography.tsx.
15
- *
16
- * If you find yourself needing to use what's inside this object on files other
17
- * than `<Typography />`, please import from `@jobber/components-native` instead.
18
- *
19
- * ```
20
- * import { typographyStyles } from "@jobber/components-native"
21
- * ```
22
- */
23
-
24
- /**
25
- * Reusable typography tokens to ensure consistency for any client facing texts.
26
- */
27
- export const typographyTokens: { [index: string]: TextStyle } = {
28
- // This follows a pattern of
29
- // { fontFamily }{ fontStyle }{ fontWeight }
14
+ const deviceFonts = {
30
15
  baseRegularRegular: {
31
16
  fontFamily: "inter-regular",
32
17
  },
@@ -58,6 +43,26 @@ export const typographyTokens: { [index: string]: TextStyle } = {
58
43
  displayRegularBlack: {
59
44
  fontFamily: "jobberpro-blk",
60
45
  },
46
+ };
47
+
48
+ /**
49
+ * We need to use web fonts for rendering Typography on Storybook
50
+ * because it uses font files (.ttf) to render them on devices.
51
+ * As we don't want to expose the font files, we are setting the fonts
52
+ * in CSS.
53
+ */
54
+ const fonts = Platform.select({
55
+ web: webFonts,
56
+ default: deviceFonts,
57
+ });
58
+
59
+ /**
60
+ * Reusable typography tokens to ensure consistency for any client facing texts.
61
+ */
62
+ export const typographyTokens: { [index: string]: TextStyle } = {
63
+ // This follows a pattern of
64
+ // { fontFamily }{ fontStyle }{ fontWeight }
65
+ ...fonts,
61
66
 
62
67
  startAlign: {
63
68
  textAlign: "left",
@@ -360,5 +365,15 @@ export const typographyTokens: { [index: string]: TextStyle } = {
360
365
  },
361
366
  };
362
367
 
368
+ /**
369
+ * `StyleSheet` for Typography.tsx.
370
+ *
371
+ * If you find yourself needing to use what's inside this object on files other
372
+ * than `<Typography />`, please import from `@jobber/components-native` instead.
373
+ *
374
+ * ```
375
+ * import { typographyStyles } from "@jobber/components-native"
376
+ * ```
377
+ */
363
378
  export const typographyStyles: { [index: string]: TextStyle } =
364
379
  StyleSheet.create(typographyTokens);
@@ -0,0 +1,43 @@
1
+ import { TextStyle } from "react-native";
2
+
3
+ export const webFonts: { [index: string]: TextStyle } = {
4
+ baseRegularRegular: {
5
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
6
+ fontWeight: "400",
7
+ },
8
+
9
+ baseRegularMedium: {
10
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
11
+ fontWeight: "500",
12
+ },
13
+
14
+ baseRegularSemiBold: {
15
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
16
+ fontWeight: "600",
17
+ },
18
+
19
+ baseRegularBold: {
20
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
21
+ fontWeight: "700",
22
+ },
23
+
24
+ baseRegularExtraBold: {
25
+ fontFamily: "'Inter', Helvetica, Arial, sans-serif",
26
+ fontWeight: "800",
27
+ },
28
+
29
+ displayRegularBold: {
30
+ fontFamily: "'Jobber Pro', 'Poppins', Helvetica, Arial, sans-serif",
31
+ fontWeight: "700",
32
+ },
33
+
34
+ displayRegularExtraBold: {
35
+ fontFamily: "'Jobber Pro', 'Poppins', Helvetica, Arial, sans-serif",
36
+ fontWeight: "800",
37
+ },
38
+
39
+ displayRegularBlack: {
40
+ fontFamily: "'Jobber Pro', 'Poppins', Helvetica, Arial, sans-serif",
41
+ fontWeight: "900",
42
+ },
43
+ };
package/src/index.ts CHANGED
@@ -6,4 +6,5 @@ export * from "./ErrorMessageWrapper";
6
6
  export * from "./ActionLabel";
7
7
  export * from "./Content";
8
8
  export * from "./ActivityIndicator";
9
+ export * from "./StatusLabel";
9
10
  export * from "./AtlantisContext";