@jobber/components-native 0.72.0 → 0.72.2

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.
@@ -95,8 +95,8 @@ export type BaseWeight = Extract<FontWeight, "regular" | "medium" | "semiBold" |
95
95
  export type DisplayWeight = Extract<FontWeight, "semiBold" | "bold" | "extraBold" | "black">;
96
96
  export type BaseStyle = FontStyle;
97
97
  export type DisplayStyle = Extract<FontStyle, "regular">;
98
- export type TextColor = TextVariation | "default" | "blue" | "blueDark" | "white" | "green" | "greenDark" | "grey" | "greyDark" | "greyBlue" | "greyBlueDark" | "lightBlue" | "lightBlueDark" | "red" | "redDark" | "yellow" | "yellowDark" | "yellowGreenDark" | "orangeDark" | "navyDark" | "limeDark" | "purpleDark" | "pinkDark" | "tealDark" | "indigoDark" | "navy" | "text" | "heading" | "textSecondary" | "textReverse" | "textReverseSecondary" | "interactive" | "destructive" | "learning" | "subtle" | "onPrimary";
99
- export type TextVariation = "success" | "interactive" | "error" | "base" | "subdued" | "warn" | "info" | "disabled" | "critical";
98
+ export type TextColor = TextVariation | "default" | "blueDark" | "white" | "green" | "greenDark" | "grey" | "greyDark" | "greyBlue" | "greyBlueDark" | "lightBlue" | "lightBlueDark" | "red" | "redDark" | "yellow" | "yellowDark" | "yellowGreenDark" | "orangeDark" | "navyDark" | "limeDark" | "purpleDark" | "pinkDark" | "tealDark" | "indigoDark" | "navy" | "heading" | "text" | "textSecondary" | "textReverse" | "textReverseSecondary" | "inactive" | "inactiveSurface" | "inactiveOnSurface" | "critical" | "criticalSurface" | "criticalOnSurface" | "warning" | "warningSurface" | "warningOnSurface" | "informative" | "informativeSurface" | "informativeOnSurface" | "success" | "successSurface" | "successOnSurface" | "interactiveHover" | "interactiveSubtleHover" | "destructiveHover" | "disabledSecondary" | "request" | "requestSurface" | "requestOnSurface" | "quote" | "quoteSurface" | "quoteOnSurface" | "job" | "jobSurface" | "jobOnSurface" | "visit" | "visitSurface" | "visitOnSurface" | "task" | "taskSurface" | "taskOnSurface" | "event" | "eventSurface" | "eventOnSurface" | "invoice" | "invoiceSurface" | "invoiceOnSurface" | "payments" | "paymentsSurface" | "paymentsOnSurface" | "client" | "blue" | "learning" | "subtle" | "onPrimary";
99
+ export type TextVariation = "text" | "textSecondary" | "interactive" | "interactiveSubtle" | "successOnSurface" | "critical" | "warning" | "informativeOnSurface" | "disabled" | "destructive" | "base" | "subdued" | "error" | "warn" | "info";
100
100
  export type TextTransform = "uppercase" | "lowercase" | "capitalize" | "none";
101
101
  export type TextSize = "smallest" | "smaller" | "small" | "default" | "large" | "larger" | "largest" | "jumbo" | "extravagant";
102
102
  export type TextAlign = "start" | "end" | "center" | "justify";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.72.0",
3
+ "version": "0.72.2",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -82,5 +82,5 @@
82
82
  "react-native-safe-area-context": "^4.5.2",
83
83
  "react-native-svg": ">=12.0.0"
84
84
  },
85
- "gitHead": "26cb076b2f8a8cbdaee1df6be72b211987a4e5eb"
85
+ "gitHead": "5bf179fd86de1628e28da194dd8cc4c2d51ed9ab"
86
86
  }
@@ -26,7 +26,7 @@ export function BottomSheetOption({
26
26
  textTransform = "capitalize",
27
27
  onPress,
28
28
  }: BottomSheetOptionProps): JSX.Element {
29
- const destructiveColor = "critical";
29
+ const destructiveColor = "destructive";
30
30
  const textVariation = destructive ? destructiveColor : "subdued";
31
31
 
32
32
  return (
@@ -18,7 +18,7 @@ export function MenuOption({
18
18
  onPress,
19
19
  setOpen,
20
20
  }: MenuOptionInternalProps): JSX.Element {
21
- const destructiveColor = "critical";
21
+ const destructiveColor = "destructive";
22
22
  const textVariation = destructive ? destructiveColor : "heading";
23
23
 
24
24
  return (
@@ -93,6 +93,10 @@ export const typographyTokens: { [index: string]: TextStyle } = {
93
93
  textDecorationLine: "underline",
94
94
  },
95
95
 
96
+ /**
97
+ * Alignments
98
+ */
99
+
96
100
  startAlign: {
97
101
  textAlign: "left",
98
102
  },
@@ -109,9 +113,11 @@ export const typographyTokens: { [index: string]: TextStyle } = {
109
113
  textAlign: "justify",
110
114
  },
111
115
 
112
- blue: {
113
- color: tokens["color-heading"],
114
- },
116
+ /**
117
+ * Colors
118
+ */
119
+
120
+ // Base colors for backwards compatibility
115
121
 
116
122
  blueDark: {
117
123
  color: tokens["color-blue--dark"],
@@ -205,14 +211,11 @@ export const typographyTokens: { [index: string]: TextStyle } = {
205
211
  color: tokens["color-navy"],
206
212
  },
207
213
 
214
+ // Typography
208
215
  heading: {
209
216
  color: tokens["color-heading"],
210
217
  },
211
218
 
212
- headingReverse: {
213
- color: tokens["color-text--reverse"],
214
- },
215
-
216
219
  text: {
217
220
  color: tokens["color-text"],
218
221
  },
@@ -229,52 +232,267 @@ export const typographyTokens: { [index: string]: TextStyle } = {
229
232
  color: tokens["color-text--reverse--secondary"],
230
233
  },
231
234
 
232
- success: {
233
- color: tokens["color-success--onSurface"],
235
+ // Statuses
236
+
237
+ inactive: {
238
+ color: tokens["color-inactive"],
234
239
  },
235
240
 
236
- error: {
241
+ inactiveSurface: {
242
+ color: tokens["color-inactive--surface"],
243
+ },
244
+
245
+ inactiveOnSurface: {
246
+ color: tokens["color-inactive--onSurface"],
247
+ },
248
+
249
+ critical: {
237
250
  color: tokens["color-critical"],
238
251
  },
239
252
 
240
- base: {
241
- color: tokens["color-text"],
253
+ criticalSurface: {
254
+ color: tokens["color-critical--surface"],
242
255
  },
243
256
 
244
- subdued: {
245
- color: tokens["color-text--secondary"],
257
+ criticalOnSurface: {
258
+ color: tokens["color-critical--onSurface"],
246
259
  },
247
260
 
248
- warn: {
261
+ warning: {
262
+ color: tokens["color-warning"],
263
+ },
264
+
265
+ warningSurface: {
266
+ color: tokens["color-warning--surface"],
267
+ },
268
+
269
+ warningOnSurface: {
249
270
  color: tokens["color-warning--onSurface"],
250
271
  },
251
272
 
252
- info: {
273
+ informative: {
274
+ color: tokens["color-informative"],
275
+ },
276
+
277
+ informativeSurface: {
278
+ color: tokens["color-informative--surface"],
279
+ },
280
+
281
+ informativeOnSurface: {
253
282
  color: tokens["color-informative--onSurface"],
254
283
  },
255
284
 
256
- critical: {
285
+ // To be uncommented once success in Deprecated is removed
286
+ // success: {
287
+ // color: tokens["color-success"],
288
+ // },
289
+
290
+ successSurface: {
291
+ color: tokens["color-success--surface"],
292
+ },
293
+
294
+ successOnSurface: {
295
+ color: tokens["color-success--onSurface"],
296
+ },
297
+
298
+ // Interactions
299
+
300
+ interactive: {
301
+ color: tokens["color-interactive"],
302
+ },
303
+
304
+ interactiveHover: {
305
+ color: tokens["color-interactive--hover"],
306
+ },
307
+
308
+ interactiveSubtle: {
309
+ color: tokens["color-interactive--subtle"],
310
+ },
311
+
312
+ interactiveSubtleHover: {
313
+ color: tokens["color-interactive--subtle--hover"],
314
+ },
315
+
316
+ destructive: {
317
+ color: tokens["color-destructive"],
318
+ },
319
+
320
+ destructiveHover: {
321
+ color: tokens["color-destructive--hover"],
322
+ },
323
+
324
+ disabled: {
325
+ color: tokens["color-disabled"],
326
+ },
327
+
328
+ disabledSecondary: {
329
+ color: tokens["color-disabled--secondary"],
330
+ },
331
+
332
+ // Workflow
333
+
334
+ request: {
335
+ color: tokens["color-request"],
336
+ },
337
+
338
+ requestSurface: {
339
+ color: tokens["color-request--surface"],
340
+ },
341
+
342
+ requestOnSurface: {
343
+ color: tokens["color-request--onSurface"],
344
+ },
345
+
346
+ quote: {
347
+ color: tokens["color-quote"],
348
+ },
349
+
350
+ quoteSurface: {
351
+ color: tokens["color-quote--surface"],
352
+ },
353
+
354
+ quoteOnSurface: {
355
+ color: tokens["color-quote--onSurface"],
356
+ },
357
+
358
+ job: {
359
+ color: tokens["color-job"],
360
+ },
361
+
362
+ jobSurface: {
363
+ color: tokens["color-job--surface"],
364
+ },
365
+
366
+ jobOnSurface: {
367
+ color: tokens["color-job--onSurface"],
368
+ },
369
+
370
+ visit: {
371
+ color: tokens["color-visit"],
372
+ },
373
+
374
+ visitSurface: {
375
+ color: tokens["color-visit--surface"],
376
+ },
377
+
378
+ visitOnSurface: {
379
+ color: tokens["color-visit--onSurface"],
380
+ },
381
+
382
+ task: {
383
+ color: tokens["color-task"],
384
+ },
385
+
386
+ taskSurface: {
387
+ color: tokens["color-task--surface"],
388
+ },
389
+
390
+ taskOnSurface: {
391
+ color: tokens["color-task--onSurface"],
392
+ },
393
+
394
+ event: {
395
+ color: tokens["color-event"],
396
+ },
397
+
398
+ eventSurface: {
399
+ color: tokens["color-event--surface"],
400
+ },
401
+
402
+ eventOnSurface: {
403
+ color: tokens["color-event--onSurface"],
404
+ },
405
+
406
+ invoice: {
407
+ color: tokens["color-invoice"],
408
+ },
409
+
410
+ invoiceSurface: {
411
+ color: tokens["color-invoice--surface"],
412
+ },
413
+
414
+ invoiceOnSurface: {
415
+ color: tokens["color-invoice--onSurface"],
416
+ },
417
+
418
+ payments: {
419
+ color: tokens["color-payments"],
420
+ },
421
+
422
+ paymentsSurface: {
423
+ color: tokens["color-payments--surface"],
424
+ },
425
+
426
+ paymentsOnSurface: {
427
+ color: tokens["color-payments--onSurface"],
428
+ },
429
+
430
+ client: {
431
+ color: tokens["color-client"],
432
+ },
433
+
434
+ // Miscellaneous
435
+
436
+ icon: {
437
+ color: tokens["color-icon"],
438
+ },
439
+
440
+ brand: {
441
+ color: tokens["color-brand"],
442
+ },
443
+
444
+ // Deprecated
445
+
446
+ blue: {
447
+ color: tokens["color-heading"],
448
+ },
449
+
450
+ base: {
451
+ color: tokens["color-text"],
452
+ },
453
+
454
+ baseReverse: {
455
+ color: tokens["color-text--reverse"],
456
+ },
457
+
458
+ headingReverse: {
459
+ color: tokens["color-text--reverse"],
460
+ },
461
+
462
+ error: {
463
+ color: tokens["color-critical"],
464
+ },
465
+
466
+ errorReverse: {
257
467
  color: tokens["color-critical"],
258
468
  },
259
469
 
470
+ success: {
471
+ color: tokens["color-success--onSurface"],
472
+ },
473
+
260
474
  successReverse: {
261
475
  color: tokens["color-success"],
262
476
  },
263
477
 
264
- errorReverse: {
265
- color: tokens["color-critical"],
478
+ warn: {
479
+ color: tokens["color-warning--onSurface"],
266
480
  },
267
481
 
268
- baseReverse: {
269
- color: tokens["color-text--reverse"],
482
+ warnReverse: {
483
+ color: tokens["color-warning"],
484
+ },
485
+
486
+ subdued: {
487
+ color: tokens["color-text--secondary"],
270
488
  },
271
489
 
272
490
  subduedReverse: {
273
491
  color: tokens["color-text--reverse--secondary"],
274
492
  },
275
493
 
276
- warnReverse: {
277
- color: tokens["color-warning"],
494
+ info: {
495
+ color: tokens["color-informative--onSurface"],
278
496
  },
279
497
 
280
498
  infoReverse: {
@@ -285,14 +503,6 @@ export const typographyTokens: { [index: string]: TextStyle } = {
285
503
  color: tokens["color-critical"],
286
504
  },
287
505
 
288
- interactive: {
289
- color: tokens["color-interactive"],
290
- },
291
-
292
- destructive: {
293
- color: tokens["color-destructive"],
294
- },
295
-
296
506
  learning: {
297
507
  color: tokens["color-informative"],
298
508
  },
@@ -305,9 +515,9 @@ export const typographyTokens: { [index: string]: TextStyle } = {
305
515
  color: tokens["color-surface"],
306
516
  },
307
517
 
308
- disabled: {
309
- color: tokens["color-disabled"],
310
- },
518
+ /**
519
+ * Sizes
520
+ */
311
521
 
312
522
  smallestSize: {
313
523
  fontSize: tokens["typography--fontSize-smallest"],
@@ -354,6 +564,10 @@ export const typographyTokens: { [index: string]: TextStyle } = {
354
564
  lineHeight: extravagantLineHeight,
355
565
  },
356
566
 
567
+ /**
568
+ * Line Heights
569
+ */
570
+
357
571
  extravagantLineHeight: {
358
572
  lineHeight: extravagantLineHeight,
359
573
  },
@@ -381,6 +595,10 @@ export const typographyTokens: { [index: string]: TextStyle } = {
381
595
  lineHeight: tightLineHeight,
382
596
  },
383
597
 
598
+ /**
599
+ * Letter Spacings
600
+ */
601
+
384
602
  baseLetterSpacing: {
385
603
  letterSpacing: tokens["typography--letterSpacing-base"],
386
604
  },
@@ -89,6 +89,13 @@ it("renders text with green color", () => {
89
89
  expect(typography.toJSON()).toMatchSnapshot();
90
90
  });
91
91
 
92
+ it("renders text with semantic color", () => {
93
+ const typography = render(
94
+ <Typography color="inactiveOnSurface">Test Text</Typography>,
95
+ );
96
+ expect(typography.toJSON()).toMatchSnapshot();
97
+ });
98
+
92
99
  it("renders text with default color", () => {
93
100
  const typography = render(<Typography color="default">Test Text</Typography>);
94
101
  expect(typography.toJSON()).toMatchSnapshot();
@@ -310,8 +310,8 @@ export type DisplayStyle = Extract<FontStyle, "regular">;
310
310
 
311
311
  export type TextColor =
312
312
  | TextVariation
313
+ // Base colors for backwards compatibility
313
314
  | "default"
314
- | "blue"
315
315
  | "blueDark"
316
316
  | "white"
317
317
  | "green"
@@ -335,27 +335,89 @@ export type TextColor =
335
335
  | "tealDark"
336
336
  | "indigoDark"
337
337
  | "navy"
338
- | "text"
338
+
339
+ // Typography
339
340
  | "heading"
341
+ | "text"
340
342
  | "textSecondary"
341
343
  | "textReverse"
342
344
  | "textReverseSecondary"
343
- | "interactive"
344
- | "destructive"
345
- | "learning"
346
- | "subtle"
347
- | "onPrimary";
348
345
 
349
- export type TextVariation =
346
+ // Statuses
347
+ | "inactive"
348
+ | "inactiveSurface"
349
+ | "inactiveOnSurface"
350
+ | "critical"
351
+ | "criticalSurface"
352
+ | "criticalOnSurface"
353
+ | "warning"
354
+ | "warningSurface"
355
+ | "warningOnSurface"
356
+ | "informative"
357
+ | "informativeSurface"
358
+ | "informativeOnSurface"
350
359
  | "success"
360
+ | "successSurface"
361
+ | "successOnSurface"
362
+
363
+ // Interactions
364
+ | "interactiveHover"
365
+ | "interactiveSubtleHover"
366
+ | "destructiveHover"
367
+ | "disabledSecondary"
368
+
369
+ // Workflow
370
+ | "request"
371
+ | "requestSurface"
372
+ | "requestOnSurface"
373
+ | "quote"
374
+ | "quoteSurface"
375
+ | "quoteOnSurface"
376
+ | "job"
377
+ | "jobSurface"
378
+ | "jobOnSurface"
379
+ | "visit"
380
+ | "visitSurface"
381
+ | "visitOnSurface"
382
+ | "task"
383
+ | "taskSurface"
384
+ | "taskOnSurface"
385
+ | "event"
386
+ | "eventSurface"
387
+ | "eventOnSurface"
388
+ | "invoice"
389
+ | "invoiceSurface"
390
+ | "invoiceOnSurface"
391
+ | "payments"
392
+ | "paymentsSurface"
393
+ | "paymentsOnSurface"
394
+ | "client"
395
+
396
+ // Deprecated
397
+ | "blue" // Use "heading" instead
398
+ | "learning" // Use "informative" instead
399
+ | "subtle" // Use "interactiveSubtle" instead
400
+ | "onPrimary"; // Use "subtle" instead
401
+
402
+ // A subset of colors that can be used with the Text component
403
+ export type TextVariation =
404
+ | "text"
405
+ | "textSecondary"
351
406
  | "interactive"
352
- | "error"
353
- | "base"
354
- | "subdued"
355
- | "warn"
356
- | "info"
407
+ | "interactiveSubtle"
408
+ | "successOnSurface"
409
+ | "critical"
410
+ | "warning"
411
+ | "informativeOnSurface"
357
412
  | "disabled"
358
- | "critical";
413
+ | "destructive"
414
+
415
+ // Deprecated
416
+ | "base" // Use "text" instead
417
+ | "subdued" // Use "textSecondary" instead
418
+ | "error" // Use "critical" instead
419
+ | "warn" // Use "warningOnSurface" instead
420
+ | "info"; // Use "informativeOnSurface" instead
359
421
 
360
422
  export type TextTransform = "uppercase" | "lowercase" | "capitalize" | "none";
361
423
 
@@ -734,6 +734,39 @@ exports[`renders text with reverseTheme true with reversible color 1`] = `
734
734
  </Text>
735
735
  `;
736
736
 
737
+ exports[`renders text with semantic color 1`] = `
738
+ <Text
739
+ accessibilityRole="text"
740
+ adjustsFontSizeToFit={false}
741
+ allowFontScaling={true}
742
+ collapsable={false}
743
+ selectable={true}
744
+ selectionColor="hsl(86, 100%, 46%)"
745
+ style={
746
+ [
747
+ {
748
+ "fontFamily": "inter-regular",
749
+ },
750
+ {
751
+ "color": "hsl(197, 90%, 12%)",
752
+ },
753
+ {
754
+ "textAlign": "left",
755
+ },
756
+ {
757
+ "fontSize": 16,
758
+ "lineHeight": 20,
759
+ },
760
+ {
761
+ "letterSpacing": 0,
762
+ },
763
+ ]
764
+ }
765
+ >
766
+ Test Text
767
+ </Text>
768
+ `;
769
+
737
770
  exports[`renders text with small size 1`] = `
738
771
  <Text
739
772
  accessibilityRole="text"