react-native-terra-ui 0.13.2 → 0.13.3
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/CHANGELOG.md +6 -0
- package/lib/module/components/accordion/parts/AccordionContent.js +2 -2
- package/lib/module/components/accordion/parts/AccordionContent.js.map +1 -1
- package/lib/module/components/accordion/parts/AccordionTrigger.js +4 -4
- package/lib/module/components/accordion/parts/AccordionTrigger.js.map +1 -1
- package/lib/module/components/avatar/Avatar.js +3 -3
- package/lib/module/components/avatar/Avatar.js.map +1 -1
- package/lib/module/components/badge/Badge.js +2 -2
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/button/Button.js +3 -3
- package/lib/module/components/button/Button.js.map +1 -1
- package/lib/module/components/chip/Chip.js +2 -2
- package/lib/module/components/chip/Chip.js.map +1 -1
- package/lib/module/components/empty-state/EmptyState.js +6 -6
- package/lib/module/components/empty-state/EmptyState.js.map +1 -1
- package/lib/module/components/header/parts/HeaderBar.js +7 -13
- package/lib/module/components/header/parts/HeaderBar.js.map +1 -1
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +8 -0
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
- package/lib/module/components/header/variants/LargeTitleHeader/parts/LargeTitleContent.js +11 -20
- package/lib/module/components/header/variants/LargeTitleHeader/parts/LargeTitleContent.js.map +1 -1
- package/lib/module/components/header/variants/TitleHeader/index.js +4 -0
- package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
- package/lib/module/components/image/Image.js +11 -5
- package/lib/module/components/image/Image.js.map +1 -1
- package/lib/module/components/image/utils.js +11 -0
- package/lib/module/components/image/utils.js.map +1 -0
- package/lib/module/components/input/parts/InputField.js +3 -3
- package/lib/module/components/input/parts/InputField.js.map +1 -1
- package/lib/module/components/surface/Surface.js +1 -1
- package/lib/module/components/text/Text.js +30 -8
- package/lib/module/components/text/Text.js.map +1 -1
- package/lib/module/components/toast/Toast.js +1 -1
- package/lib/module/components/toast/Toast.js.map +1 -1
- package/lib/module/components/toolbar/Toolbar.js +2 -2
- package/lib/module/components/toolbar/Toolbar.js.map +1 -1
- package/lib/module/theme/tokens/primitives.js +90 -84
- package/lib/module/theme/tokens/primitives.js.map +1 -1
- package/lib/typescript/src/components/header/parts/HeaderBar.d.ts +4 -1
- package/lib/typescript/src/components/header/parts/HeaderBar.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +6 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/parts/LargeTitleContent.d.ts +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/parts/LargeTitleContent.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +9 -2
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/image/Image.d.ts +3 -3
- package/lib/typescript/src/components/image/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/image/index.d.ts +1 -1
- package/lib/typescript/src/components/image/index.d.ts.map +1 -1
- package/lib/typescript/src/components/image/types.d.ts +7 -0
- package/lib/typescript/src/components/image/types.d.ts.map +1 -1
- package/lib/typescript/src/components/image/utils.d.ts +3 -0
- package/lib/typescript/src/components/image/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/surface/Surface.d.ts +1 -1
- package/lib/typescript/src/components/text/Text.d.ts +1 -1
- package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
- package/lib/typescript/src/theme/tokens/primitives.d.ts +60 -65
- package/lib/typescript/src/theme/tokens/primitives.d.ts.map +1 -1
- package/lib/typescript/src/theme/types.d.ts +8 -2
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/accordion/parts/AccordionContent.tsx +2 -2
- package/src/components/accordion/parts/AccordionTrigger.tsx +2 -2
- package/src/components/avatar/Avatar.tsx +3 -3
- package/src/components/badge/Badge.tsx +2 -2
- package/src/components/button/Button.tsx +3 -3
- package/src/components/chip/Chip.tsx +2 -2
- package/src/components/empty-state/EmptyState.tsx +3 -3
- package/src/components/header/parts/HeaderBar.tsx +10 -13
- package/src/components/header/variants/LargeTitleHeader/index.tsx +13 -0
- package/src/components/header/variants/LargeTitleHeader/parts/LargeTitleContent.tsx +14 -22
- package/src/components/header/variants/TitleHeader/index.tsx +12 -1
- package/src/components/image/Image.tsx +7 -4
- package/src/components/image/index.ts +1 -1
- package/src/components/image/types.ts +8 -0
- package/src/components/image/utils.ts +11 -0
- package/src/components/input/parts/InputField.tsx +4 -4
- package/src/components/surface/Surface.tsx +1 -1
- package/src/components/text/Text.tsx +30 -11
- package/src/components/toast/Toast.tsx +1 -1
- package/src/components/toolbar/Toolbar.tsx +2 -2
- package/src/theme/tokens/primitives.ts +90 -84
- package/src/theme/types.ts +25 -6
|
@@ -207,14 +207,14 @@ function renderLabel(children: ReactNode, tint: ColorToken): ReactNode {
|
|
|
207
207
|
return Children.map(children, (child) => {
|
|
208
208
|
if (typeof child === "string") {
|
|
209
209
|
return child.trim().length > 0 ? (
|
|
210
|
-
<Text variant={LABEL_VARIANT} color={tint} weight="
|
|
210
|
+
<Text variant={LABEL_VARIANT} color={tint} weight="medium">
|
|
211
211
|
{child}
|
|
212
212
|
</Text>
|
|
213
213
|
) : null;
|
|
214
214
|
}
|
|
215
215
|
if (typeof child === "number") {
|
|
216
216
|
return (
|
|
217
|
-
<Text variant={LABEL_VARIANT} color={tint} weight="
|
|
217
|
+
<Text variant={LABEL_VARIANT} color={tint} weight="medium">
|
|
218
218
|
{child}
|
|
219
219
|
</Text>
|
|
220
220
|
);
|
|
@@ -375,102 +375,108 @@ export const primitives = {
|
|
|
375
375
|
// are not physical pixels. Pass them directly to Text without multiplying
|
|
376
376
|
// by PixelRatio or fontScale (native Text handles accessibility scaling).
|
|
377
377
|
// Each role pairs fontSize with an absolute lineHeight, not a ratio.
|
|
378
|
-
// Line heights use a 4-unit grid; font sizes need not follow that grid.
|
|
379
378
|
//
|
|
380
|
-
//
|
|
381
|
-
//
|
|
382
|
-
//
|
|
383
|
-
// title
|
|
384
|
-
//
|
|
385
|
-
//
|
|
386
|
-
//
|
|
387
|
-
//
|
|
388
|
-
//
|
|
379
|
+
// Sizes follow the iOS text styles at the Default (Large) Dynamic Type size,
|
|
380
|
+
// and the role names follow iOS too, so `headline` is the 17pt semibold a
|
|
381
|
+
// navigation bar or table cell title uses and `large-title` is the 34pt
|
|
382
|
+
// bold large title. Line heights are the iOS values rounded to an even
|
|
383
|
+
// number. Weights are what UIKit renders in practice (bold titles), not the
|
|
384
|
+
// "Regular" the HIG table lists. Tracking is left to the font: SF carries
|
|
385
|
+
// its own, and a configured custom family can set `letterSpacing` per role.
|
|
386
|
+
//
|
|
387
|
+
// Font size / line height:
|
|
388
|
+
// display: 40/48 — hero text, no iOS equivalent.
|
|
389
|
+
// large-title: 34/40 — iOS Large Title.
|
|
390
|
+
// title-1/2/3: 28/34, 22/28, 20/24 — iOS Title 1, Title 2, Title 3.
|
|
391
|
+
// headline: 17/22 semibold — iOS Headline; compact header bar title.
|
|
392
|
+
// body: 17/22 — iOS Body; Text's default.
|
|
393
|
+
// callout: 16/20 — iOS Callout.
|
|
394
|
+
// subheadline: 15/20 — iOS Subheadline.
|
|
395
|
+
// footnote: 13/18 — iOS Footnote.
|
|
396
|
+
// caption-1/2: 12/16, 11/14 — iOS Caption 1, Caption 2.
|
|
397
|
+
// label-lg/md/sm: 16/20, 15/20, 13/16 medium — control labels; no iOS role.
|
|
389
398
|
//
|
|
390
399
|
// maxFontSizeMultiplier limits accessibility enlargement when scaling is
|
|
391
|
-
// enabled.
|
|
400
|
+
// enabled. Reading roles cap at 2 so text still meets WCAG 1.4.4 at the OS's
|
|
401
|
+
// 200% setting. Titles cap at 1.5 (iOS itself scales Large Title to 1.76x at
|
|
402
|
+
// most) and labels at 1.6 because toolbars and chips have fixed heights.
|
|
392
403
|
// RN uses 0 for no cap; Terra Text also accepts a per-instance override.
|
|
393
404
|
// Validate wrapping and clipping at large OS text sizes and with custom fonts.
|
|
394
|
-
"typography.variants.display
|
|
395
|
-
"typography.variants.display
|
|
396
|
-
"typography.variants.display
|
|
397
|
-
"typography.variants.display
|
|
398
|
-
"typography.variants.display
|
|
399
|
-
"typography.variants.
|
|
400
|
-
"typography.variants.
|
|
401
|
-
"typography.variants.
|
|
402
|
-
"typography.variants.
|
|
403
|
-
"typography.variants.
|
|
404
|
-
"typography.variants.
|
|
405
|
-
"typography.variants.
|
|
406
|
-
"typography.variants.
|
|
407
|
-
"typography.variants.
|
|
408
|
-
"typography.variants.
|
|
409
|
-
"typography.variants.
|
|
410
|
-
"typography.variants.
|
|
411
|
-
"typography.variants.
|
|
412
|
-
"typography.variants.
|
|
413
|
-
"typography.variants.
|
|
414
|
-
"typography.variants.
|
|
415
|
-
"typography.variants.
|
|
416
|
-
"typography.variants.
|
|
417
|
-
"typography.variants.
|
|
418
|
-
"typography.variants.
|
|
419
|
-
"typography.variants.headline
|
|
420
|
-
"typography.variants.headline
|
|
421
|
-
"typography.variants.headline
|
|
422
|
-
"typography.variants.headline
|
|
423
|
-
"typography.variants.headline
|
|
424
|
-
"typography.variants.
|
|
425
|
-
"typography.variants.
|
|
426
|
-
"typography.variants.
|
|
427
|
-
"typography.variants.
|
|
428
|
-
"typography.variants.
|
|
429
|
-
"typography.variants.
|
|
430
|
-
"typography.variants.
|
|
431
|
-
"typography.variants.
|
|
432
|
-
"typography.variants.
|
|
433
|
-
"typography.variants.
|
|
434
|
-
"typography.variants.
|
|
435
|
-
"typography.variants.
|
|
436
|
-
"typography.variants.
|
|
437
|
-
"typography.variants.
|
|
438
|
-
"typography.variants.
|
|
439
|
-
"typography.variants.
|
|
440
|
-
"typography.variants.
|
|
441
|
-
"typography.variants.
|
|
442
|
-
"typography.variants.
|
|
443
|
-
"typography.variants.
|
|
444
|
-
"typography.variants.
|
|
445
|
-
"typography.variants.
|
|
446
|
-
"typography.variants.
|
|
447
|
-
"typography.variants.
|
|
448
|
-
"typography.variants.
|
|
449
|
-
"typography.variants.
|
|
450
|
-
"typography.variants.
|
|
451
|
-
"typography.variants.
|
|
452
|
-
"typography.variants.
|
|
453
|
-
"typography.variants.
|
|
405
|
+
"typography.variants.display.fontSize": 40,
|
|
406
|
+
"typography.variants.display.lineHeight": 48,
|
|
407
|
+
"typography.variants.display.fontWeight": "bold",
|
|
408
|
+
"typography.variants.display.letterSpacing": -0.3,
|
|
409
|
+
"typography.variants.display.maxFontSizeMultiplier": 1.3,
|
|
410
|
+
"typography.variants.large-title.fontSize": 34,
|
|
411
|
+
"typography.variants.large-title.lineHeight": 40,
|
|
412
|
+
"typography.variants.large-title.fontWeight": "bold",
|
|
413
|
+
"typography.variants.large-title.letterSpacing": -0.3,
|
|
414
|
+
"typography.variants.large-title.maxFontSizeMultiplier": 1.5,
|
|
415
|
+
"typography.variants.title-1.fontSize": 28,
|
|
416
|
+
"typography.variants.title-1.lineHeight": 34,
|
|
417
|
+
"typography.variants.title-1.fontWeight": "bold",
|
|
418
|
+
"typography.variants.title-1.letterSpacing": 0,
|
|
419
|
+
"typography.variants.title-1.maxFontSizeMultiplier": 1.5,
|
|
420
|
+
"typography.variants.title-2.fontSize": 22,
|
|
421
|
+
"typography.variants.title-2.lineHeight": 28,
|
|
422
|
+
"typography.variants.title-2.fontWeight": "bold",
|
|
423
|
+
"typography.variants.title-2.letterSpacing": 0,
|
|
424
|
+
"typography.variants.title-2.maxFontSizeMultiplier": 1.5,
|
|
425
|
+
"typography.variants.title-3.fontSize": 20,
|
|
426
|
+
"typography.variants.title-3.lineHeight": 24,
|
|
427
|
+
"typography.variants.title-3.fontWeight": "semibold",
|
|
428
|
+
"typography.variants.title-3.letterSpacing": 0,
|
|
429
|
+
"typography.variants.title-3.maxFontSizeMultiplier": 1.5,
|
|
430
|
+
"typography.variants.headline.fontSize": 17,
|
|
431
|
+
"typography.variants.headline.lineHeight": 22,
|
|
432
|
+
"typography.variants.headline.fontWeight": "semibold",
|
|
433
|
+
"typography.variants.headline.letterSpacing": 0,
|
|
434
|
+
"typography.variants.headline.maxFontSizeMultiplier": 2,
|
|
435
|
+
"typography.variants.body.fontSize": 17,
|
|
436
|
+
"typography.variants.body.lineHeight": 22,
|
|
437
|
+
"typography.variants.body.fontWeight": "regular",
|
|
438
|
+
"typography.variants.body.letterSpacing": 0,
|
|
439
|
+
"typography.variants.body.maxFontSizeMultiplier": 2,
|
|
440
|
+
"typography.variants.callout.fontSize": 16,
|
|
441
|
+
"typography.variants.callout.lineHeight": 20,
|
|
442
|
+
"typography.variants.callout.fontWeight": "regular",
|
|
443
|
+
"typography.variants.callout.letterSpacing": 0,
|
|
444
|
+
"typography.variants.callout.maxFontSizeMultiplier": 2,
|
|
445
|
+
"typography.variants.subheadline.fontSize": 15,
|
|
446
|
+
"typography.variants.subheadline.lineHeight": 20,
|
|
447
|
+
"typography.variants.subheadline.fontWeight": "regular",
|
|
448
|
+
"typography.variants.subheadline.letterSpacing": 0,
|
|
449
|
+
"typography.variants.subheadline.maxFontSizeMultiplier": 2,
|
|
450
|
+
"typography.variants.footnote.fontSize": 13,
|
|
451
|
+
"typography.variants.footnote.lineHeight": 18,
|
|
452
|
+
"typography.variants.footnote.fontWeight": "regular",
|
|
453
|
+
"typography.variants.footnote.letterSpacing": 0,
|
|
454
|
+
"typography.variants.footnote.maxFontSizeMultiplier": 2,
|
|
455
|
+
"typography.variants.caption-1.fontSize": 12,
|
|
456
|
+
"typography.variants.caption-1.lineHeight": 16,
|
|
457
|
+
"typography.variants.caption-1.fontWeight": "regular",
|
|
458
|
+
"typography.variants.caption-1.letterSpacing": 0,
|
|
459
|
+
"typography.variants.caption-1.maxFontSizeMultiplier": 2,
|
|
460
|
+
"typography.variants.caption-2.fontSize": 11,
|
|
461
|
+
"typography.variants.caption-2.lineHeight": 14,
|
|
462
|
+
"typography.variants.caption-2.fontWeight": "regular",
|
|
463
|
+
"typography.variants.caption-2.letterSpacing": 0,
|
|
464
|
+
"typography.variants.caption-2.maxFontSizeMultiplier": 2,
|
|
454
465
|
"typography.variants.label-lg.fontSize": 16,
|
|
455
466
|
"typography.variants.label-lg.lineHeight": 20,
|
|
456
467
|
"typography.variants.label-lg.fontWeight": "medium",
|
|
457
|
-
"typography.variants.label-lg.letterSpacing": 0
|
|
458
|
-
"typography.variants.label-lg.maxFontSizeMultiplier": 1.
|
|
459
|
-
"typography.variants.label-md.fontSize":
|
|
468
|
+
"typography.variants.label-lg.letterSpacing": 0,
|
|
469
|
+
"typography.variants.label-lg.maxFontSizeMultiplier": 1.6,
|
|
470
|
+
"typography.variants.label-md.fontSize": 15,
|
|
460
471
|
"typography.variants.label-md.lineHeight": 20,
|
|
461
472
|
"typography.variants.label-md.fontWeight": "medium",
|
|
462
|
-
"typography.variants.label-md.letterSpacing": 0
|
|
463
|
-
"typography.variants.label-md.maxFontSizeMultiplier": 1.
|
|
464
|
-
"typography.variants.label-sm.fontSize":
|
|
473
|
+
"typography.variants.label-md.letterSpacing": 0,
|
|
474
|
+
"typography.variants.label-md.maxFontSizeMultiplier": 1.6,
|
|
475
|
+
"typography.variants.label-sm.fontSize": 13,
|
|
465
476
|
"typography.variants.label-sm.lineHeight": 16,
|
|
466
477
|
"typography.variants.label-sm.fontWeight": "medium",
|
|
467
|
-
"typography.variants.label-sm.letterSpacing": 0
|
|
468
|
-
"typography.variants.label-sm.maxFontSizeMultiplier": 1.
|
|
469
|
-
"typography.variants.caption.fontSize": 12,
|
|
470
|
-
"typography.variants.caption.lineHeight": 16,
|
|
471
|
-
"typography.variants.caption.fontWeight": "regular",
|
|
472
|
-
"typography.variants.caption.letterSpacing": 0.2,
|
|
473
|
-
"typography.variants.caption.maxFontSizeMultiplier": 2,
|
|
478
|
+
"typography.variants.label-sm.letterSpacing": 0,
|
|
479
|
+
"typography.variants.label-sm.maxFontSizeMultiplier": 1.6,
|
|
474
480
|
|
|
475
481
|
// ── component opacity multipliers ─────────────────────────────────────────────────
|
|
476
482
|
"opacity.disabled": 0.45,
|
package/src/theme/types.ts
CHANGED
|
@@ -64,6 +64,30 @@ export type ElevationScale = Record<ElevationKey, ElevationStyle>;
|
|
|
64
64
|
// ─── Typography ──────────────────────────────────────────────────────────────
|
|
65
65
|
|
|
66
66
|
export type RoleTextVariant =
|
|
67
|
+
| "display"
|
|
68
|
+
| "large-title"
|
|
69
|
+
| "title-1"
|
|
70
|
+
| "title-2"
|
|
71
|
+
| "title-3"
|
|
72
|
+
| "headline"
|
|
73
|
+
| "body"
|
|
74
|
+
| "callout"
|
|
75
|
+
| "subheadline"
|
|
76
|
+
| "footnote"
|
|
77
|
+
| "caption-1"
|
|
78
|
+
| "caption-2"
|
|
79
|
+
| "label-lg"
|
|
80
|
+
| "label-md"
|
|
81
|
+
| "label-sm";
|
|
82
|
+
|
|
83
|
+
export type HeadingTextVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Pre-0.14 role names. Still accepted by `Text` and resolved onto the iOS-style
|
|
87
|
+
* scale; removed at 1.0. `label-*` kept its name and is not listed here.
|
|
88
|
+
* @deprecated Use the {@link RoleTextVariant} it maps to.
|
|
89
|
+
*/
|
|
90
|
+
export type LegacyTextVariant =
|
|
67
91
|
| "display-lg"
|
|
68
92
|
| "display-md"
|
|
69
93
|
| "display-sm"
|
|
@@ -76,14 +100,9 @@ export type RoleTextVariant =
|
|
|
76
100
|
| "body-lg"
|
|
77
101
|
| "body-md"
|
|
78
102
|
| "body-sm"
|
|
79
|
-
| "label-lg"
|
|
80
|
-
| "label-md"
|
|
81
|
-
| "label-sm"
|
|
82
103
|
| "caption";
|
|
83
104
|
|
|
84
|
-
export type
|
|
85
|
-
|
|
86
|
-
export type TextVariant = RoleTextVariant | HeadingTextVariant;
|
|
105
|
+
export type TextVariant = RoleTextVariant | HeadingTextVariant | LegacyTextVariant;
|
|
87
106
|
|
|
88
107
|
export type FontWeightToken = "regular" | "medium" | "semibold" | "bold";
|
|
89
108
|
|