@jobber/components-native 0.71.2-TAYLORmax-6e14b32.19 → 0.71.2-improve-di-796b148.24

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.
@@ -46,6 +46,12 @@ interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSize" | "
46
46
  * Use italic font style
47
47
  */
48
48
  readonly italic?: boolean;
49
+ /**
50
+ * Underline style to use for the text. The non-solid style is only supported
51
+ * on iOS, as per React Native's Text component's limitations.
52
+ * https://reactnative.dev/docs/text-style-props#textdecorationstyle-ios
53
+ */
54
+ readonly underline?: "solid" | "dotted";
49
55
  /**
50
56
  * This will make the text inaccessible to the screen reader.
51
57
  * This should be avoided unless there is a good reason.
@@ -57,5 +63,5 @@ interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSize" | "
57
63
  }
58
64
  export type TextLevel = "text" | "textSupporting";
59
65
  export declare const TEXT_MAX_SCALED_FONT_SIZES: Record<TextLevel, number>;
60
- export declare function Text({ level, variation, emphasis, allowFontScaling, adjustsFontSizeToFit, maxLines, align, children, reverseTheme, strikeThrough, italic, hideFromScreenReader, maxFontScaleSize, selectable, }: TextProps): JSX.Element;
66
+ export declare function Text({ level, variation, emphasis, allowFontScaling, adjustsFontSizeToFit, maxLines, align, children, reverseTheme, strikeThrough, italic, hideFromScreenReader, maxFontScaleSize, underline, selectable, }: TextProps): JSX.Element;
61
67
  export {};
@@ -55,6 +55,12 @@ export interface TypographyProps<T extends FontFamily> extends Pick<TextProps, "
55
55
  * Font style
56
56
  */
57
57
  readonly fontStyle?: T extends "base" ? BaseStyle : DisplayStyle;
58
+ /**
59
+ * Underline style to use for the text. The non-solid style is only supported
60
+ * on iOS, as per React Native's Text component's limitations.
61
+ * https://reactnative.dev/docs/text-style-props#textdecorationstyle-ios
62
+ */
63
+ readonly underline?: "solid" | "double" | "dotted" | "dashed" | undefined;
58
64
  /**
59
65
  * Font weight
60
66
  */
@@ -81,7 +87,7 @@ export interface TypographyProps<T extends FontFamily> extends Pick<TextProps, "
81
87
  readonly strikeThrough?: boolean;
82
88
  }
83
89
  export declare const Typography: React.MemoExoticComponent<typeof InternalTypography>;
84
- declare function InternalTypography<T extends FontFamily = "base">({ fontFamily, fontStyle, fontWeight, transform, color, align, size, children, maxLines, allowFontScaling, maxFontScaleSize, adjustsFontSizeToFit, lineHeight, letterSpacing, reverseTheme, hideFromScreenReader, accessibilityRole, strikeThrough, selectable, }: TypographyProps<T>): JSX.Element;
90
+ declare function InternalTypography<T extends FontFamily = "base">({ fontFamily, fontStyle, fontWeight, transform, color, align, size, children, maxLines, allowFontScaling, maxFontScaleSize, adjustsFontSizeToFit, lineHeight, letterSpacing, reverseTheme, hideFromScreenReader, accessibilityRole, strikeThrough, underline, selectable, }: TypographyProps<T>): JSX.Element;
85
91
  export type FontFamily = "base" | "display";
86
92
  export type FontStyle = "regular" | "italic";
87
93
  export type FontWeight = "regular" | "medium" | "bold" | "semiBold" | "extraBold" | "black";
@@ -89,8 +95,8 @@ export type BaseWeight = Extract<FontWeight, "regular" | "medium" | "semiBold" |
89
95
  export type DisplayWeight = Extract<FontWeight, "semiBold" | "bold" | "extraBold" | "black">;
90
96
  export type BaseStyle = FontStyle;
91
97
  export type DisplayStyle = Extract<FontStyle, "regular">;
92
- 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";
93
- 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";
94
100
  export type TextTransform = "uppercase" | "lowercase" | "capitalize" | "none";
95
101
  export type TextSize = "smallest" | "smaller" | "small" | "default" | "large" | "larger" | "largest" | "jumbo" | "extravagant";
96
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.71.2-TAYLORmax-6e14b32.19+6e14b32d",
3
+ "version": "0.71.2-improve-di-796b148.24+796b148d",
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": "6e14b32d5a326475566187872f9e4e695ec3c0f8"
85
+ "gitHead": "796b148d464e0e5d1fa64edd033e0e12c2a2ded3"
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 (
@@ -142,3 +142,9 @@ it("renders text that is inaccessible", () => {
142
142
  }),
143
143
  );
144
144
  });
145
+
146
+ it("renders text with underline styling", () => {
147
+ const text = render(<Text underline="dashed">Test Text</Text>);
148
+
149
+ expect(text.toJSON()).toMatchSnapshot();
150
+ });
package/src/Text/Text.tsx CHANGED
@@ -70,6 +70,13 @@ interface TextProps
70
70
  */
71
71
  readonly italic?: boolean;
72
72
 
73
+ /**
74
+ * Underline style to use for the text. The non-solid style is only supported
75
+ * on iOS, as per React Native's Text component's limitations.
76
+ * https://reactnative.dev/docs/text-style-props#textdecorationstyle-ios
77
+ */
78
+ readonly underline?: "solid" | "dotted";
79
+
73
80
  /**
74
81
  * This will make the text inaccessible to the screen reader.
75
82
  * This should be avoided unless there is a good reason.
@@ -118,6 +125,7 @@ export function Text({
118
125
  italic = false,
119
126
  hideFromScreenReader = false,
120
127
  maxFontScaleSize,
128
+ underline,
121
129
  selectable,
122
130
  }: TextProps): JSX.Element {
123
131
  const accessibilityRole: TextAccessibilityRole = "text";
@@ -130,6 +138,7 @@ export function Text({
130
138
  fontWeight={getFontWeight({ level, emphasis })}
131
139
  maxFontScaleSize={maxFontScaleSize || TEXT_MAX_SCALED_FONT_SIZES[level]}
132
140
  selectable={selectable}
141
+ underline={underline}
133
142
  {...{
134
143
  ...levelStyles[level],
135
144
  allowFontScaling,
@@ -546,6 +546,47 @@ exports[`renders text with success variation reverseTheme true 1`] = `
546
546
  </Text>
547
547
  `;
548
548
 
549
+ exports[`renders text with underline styling 1`] = `
550
+ <Text
551
+ accessibilityRole="text"
552
+ adjustsFontSizeToFit={false}
553
+ allowFontScaling={true}
554
+ collapsable={false}
555
+ maxFontSizeMultiplier={3.125}
556
+ selectable={true}
557
+ selectionColor="hsl(86, 100%, 46%)"
558
+ style={
559
+ [
560
+ {
561
+ "fontFamily": "inter-regular",
562
+ },
563
+ {
564
+ "color": "hsl(198, 35%, 21%)",
565
+ },
566
+ {
567
+ "textAlign": "left",
568
+ },
569
+ {
570
+ "fontSize": 16,
571
+ "lineHeight": 20,
572
+ },
573
+ {
574
+ "letterSpacing": 0,
575
+ },
576
+ {
577
+ "textDecorationStyle": "dashed",
578
+ },
579
+ {
580
+ "textDecorationColor": "hsl(197, 15%, 45%)",
581
+ "textDecorationLine": "underline",
582
+ },
583
+ ]
584
+ }
585
+ >
586
+ Test Text
587
+ </Text>
588
+ `;
589
+
549
590
  exports[`renders text with warn variation 1`] = `
550
591
  <Text
551
592
  accessibilityRole="text"
@@ -88,6 +88,15 @@ export const typographyTokens: { [index: string]: TextStyle } = {
88
88
  fontStyle: "italic",
89
89
  },
90
90
 
91
+ underline: {
92
+ textDecorationColor: tokens["color-text--secondary"],
93
+ textDecorationLine: "underline",
94
+ },
95
+
96
+ /**
97
+ * Alignments
98
+ */
99
+
91
100
  startAlign: {
92
101
  textAlign: "left",
93
102
  },
@@ -104,9 +113,11 @@ export const typographyTokens: { [index: string]: TextStyle } = {
104
113
  textAlign: "justify",
105
114
  },
106
115
 
107
- blue: {
108
- color: tokens["color-heading"],
109
- },
116
+ /**
117
+ * Colors
118
+ */
119
+
120
+ // Base colors for backwards compatibility
110
121
 
111
122
  blueDark: {
112
123
  color: tokens["color-blue--dark"],
@@ -200,14 +211,11 @@ export const typographyTokens: { [index: string]: TextStyle } = {
200
211
  color: tokens["color-navy"],
201
212
  },
202
213
 
214
+ // Typography
203
215
  heading: {
204
216
  color: tokens["color-heading"],
205
217
  },
206
218
 
207
- headingReverse: {
208
- color: tokens["color-text--reverse"],
209
- },
210
-
211
219
  text: {
212
220
  color: tokens["color-text"],
213
221
  },
@@ -224,52 +232,267 @@ export const typographyTokens: { [index: string]: TextStyle } = {
224
232
  color: tokens["color-text--reverse--secondary"],
225
233
  },
226
234
 
227
- success: {
228
- color: tokens["color-success--onSurface"],
235
+ // Statuses
236
+
237
+ inactive: {
238
+ color: tokens["color-inactive"],
229
239
  },
230
240
 
231
- error: {
241
+ inactiveSurface: {
242
+ color: tokens["color-inactive--surface"],
243
+ },
244
+
245
+ inactiveOnSurface: {
246
+ color: tokens["color-inactive--onSurface"],
247
+ },
248
+
249
+ critical: {
232
250
  color: tokens["color-critical"],
233
251
  },
234
252
 
235
- base: {
236
- color: tokens["color-text"],
253
+ criticalSurface: {
254
+ color: tokens["color-critical--surface"],
237
255
  },
238
256
 
239
- subdued: {
240
- color: tokens["color-text--secondary"],
257
+ criticalOnSurface: {
258
+ color: tokens["color-critical--onSurface"],
241
259
  },
242
260
 
243
- warn: {
261
+ warning: {
262
+ color: tokens["color-warning"],
263
+ },
264
+
265
+ warningSurface: {
266
+ color: tokens["color-warning--surface"],
267
+ },
268
+
269
+ warningOnSurface: {
244
270
  color: tokens["color-warning--onSurface"],
245
271
  },
246
272
 
247
- info: {
273
+ informative: {
274
+ color: tokens["color-informative"],
275
+ },
276
+
277
+ informativeSurface: {
278
+ color: tokens["color-informative--surface"],
279
+ },
280
+
281
+ informativeOnSurface: {
248
282
  color: tokens["color-informative--onSurface"],
249
283
  },
250
284
 
251
- 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: {
252
467
  color: tokens["color-critical"],
253
468
  },
254
469
 
470
+ success: {
471
+ color: tokens["color-success--onSurface"],
472
+ },
473
+
255
474
  successReverse: {
256
475
  color: tokens["color-success"],
257
476
  },
258
477
 
259
- errorReverse: {
260
- color: tokens["color-critical"],
478
+ warn: {
479
+ color: tokens["color-warning--onSurface"],
261
480
  },
262
481
 
263
- baseReverse: {
264
- color: tokens["color-text--reverse"],
482
+ warnReverse: {
483
+ color: tokens["color-warning"],
484
+ },
485
+
486
+ subdued: {
487
+ color: tokens["color-text--secondary"],
265
488
  },
266
489
 
267
490
  subduedReverse: {
268
491
  color: tokens["color-text--reverse--secondary"],
269
492
  },
270
493
 
271
- warnReverse: {
272
- color: tokens["color-warning"],
494
+ info: {
495
+ color: tokens["color-informative--onSurface"],
273
496
  },
274
497
 
275
498
  infoReverse: {
@@ -280,14 +503,6 @@ export const typographyTokens: { [index: string]: TextStyle } = {
280
503
  color: tokens["color-critical"],
281
504
  },
282
505
 
283
- interactive: {
284
- color: tokens["color-interactive"],
285
- },
286
-
287
- destructive: {
288
- color: tokens["color-destructive"],
289
- },
290
-
291
506
  learning: {
292
507
  color: tokens["color-informative"],
293
508
  },
@@ -300,9 +515,9 @@ export const typographyTokens: { [index: string]: TextStyle } = {
300
515
  color: tokens["color-surface"],
301
516
  },
302
517
 
303
- disabled: {
304
- color: tokens["color-disabled"],
305
- },
518
+ /**
519
+ * Sizes
520
+ */
306
521
 
307
522
  smallestSize: {
308
523
  fontSize: tokens["typography--fontSize-smallest"],
@@ -349,6 +564,10 @@ export const typographyTokens: { [index: string]: TextStyle } = {
349
564
  lineHeight: extravagantLineHeight,
350
565
  },
351
566
 
567
+ /**
568
+ * Line Heights
569
+ */
570
+
352
571
  extravagantLineHeight: {
353
572
  lineHeight: extravagantLineHeight,
354
573
  },
@@ -376,6 +595,10 @@ export const typographyTokens: { [index: string]: TextStyle } = {
376
595
  lineHeight: tightLineHeight,
377
596
  },
378
597
 
598
+ /**
599
+ * Letter Spacings
600
+ */
601
+
379
602
  baseLetterSpacing: {
380
603
  letterSpacing: tokens["typography--letterSpacing-base"],
381
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();
@@ -217,3 +224,16 @@ it("renders text that is inaccessible", () => {
217
224
  }),
218
225
  );
219
226
  });
227
+
228
+ describe("underline", () => {
229
+ it.each(["solid", "double", "dotted", "dashed"] as const)(
230
+ "renders text with %s underline",
231
+ underlineStyle => {
232
+ const typography = render(
233
+ <Typography underline={underlineStyle}>Test Text</Typography>,
234
+ );
235
+
236
+ expect(typography.toJSON()).toMatchSnapshot();
237
+ },
238
+ );
239
+ });