react-native-terra-ui 0.13.1 → 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 +12 -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 +2 -2
- 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/components/toast/Toast.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 +11 -2
- package/src/components/toolbar/Toolbar.tsx +2 -2
- package/src/theme/tokens/primitives.ts +90 -84
- package/src/theme/types.ts +25 -6
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { RadiusKey, TerraImageProps } from "#theme/types";
|
|
2
2
|
|
|
3
|
+
/** Width-to-height ratio. A number is used as is; `"3:4"` means 3 wide by 4 tall. */
|
|
4
|
+
export type ImageAspect = number | "1:1" | "3:4" | "16:9";
|
|
5
|
+
|
|
3
6
|
export interface ImageProps extends TerraImageProps {
|
|
4
7
|
width?: number;
|
|
5
8
|
height?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Ratio that derives the missing dimension from the one given. Ignored when
|
|
11
|
+
* both `width` and `height` are set.
|
|
12
|
+
*/
|
|
13
|
+
aspect?: ImageAspect;
|
|
6
14
|
radius?: RadiusKey;
|
|
7
15
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ImageAspect } from "./types";
|
|
2
|
+
|
|
3
|
+
const PRESET_RATIOS: Record<Exclude<ImageAspect, number>, number> = {
|
|
4
|
+
"1:1": 1,
|
|
5
|
+
"3:4": 3 / 4,
|
|
6
|
+
"16:9": 16 / 9,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function toAspectRatio(aspect: ImageAspect | undefined) {
|
|
10
|
+
return typeof aspect === "string" ? PRESET_RATIOS[aspect] : aspect;
|
|
11
|
+
}
|
|
@@ -9,10 +9,10 @@ import { FONT_WEIGHT_VALUE, SYSTEM_FONT } from "#utils/typography";
|
|
|
9
9
|
import type { InputBaseProps, InputSize } from "../types";
|
|
10
10
|
|
|
11
11
|
/** Typographic role of the text, per size. */
|
|
12
|
-
const TEXT_VARIANT: Record<InputSize, "
|
|
13
|
-
sm: "
|
|
14
|
-
md: "
|
|
15
|
-
lg: "body
|
|
12
|
+
const TEXT_VARIANT: Record<InputSize, "subheadline" | "callout" | "body"> = {
|
|
13
|
+
sm: "subheadline",
|
|
14
|
+
md: "callout",
|
|
15
|
+
lg: "body",
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -64,7 +64,7 @@ const resolveElevation = (variant: SurfaceVariant, elevation?: ElevationKey): El
|
|
|
64
64
|
* @example
|
|
65
65
|
* ```tsx
|
|
66
66
|
* <Surface variant="raised" elevation="md" p="4" radius="lg">
|
|
67
|
-
* <Text variant="
|
|
67
|
+
* <Text variant="headline">Card title</Text>
|
|
68
68
|
* </Surface>
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
ColorToken,
|
|
8
8
|
FontWeightToken,
|
|
9
9
|
HeadingTextVariant,
|
|
10
|
+
LegacyTextVariant,
|
|
10
11
|
RoleTextVariant,
|
|
11
12
|
TextVariant,
|
|
12
13
|
} from "#theme/types";
|
|
@@ -17,22 +18,40 @@ import { FONT_WEIGHT_VALUE, SYSTEM_FONT } from "#utils/typography";
|
|
|
17
18
|
export type TextAlign = "left" | "center" | "right" | "justify";
|
|
18
19
|
|
|
19
20
|
const HEADING_VARIANT_ALIAS: Record<HeadingTextVariant, RoleTextVariant> = {
|
|
20
|
-
h1: "
|
|
21
|
-
h2: "
|
|
22
|
-
h3: "
|
|
23
|
-
h4: "title-
|
|
24
|
-
h5: "
|
|
25
|
-
h6: "
|
|
21
|
+
h1: "large-title",
|
|
22
|
+
h2: "title-1",
|
|
23
|
+
h3: "title-2",
|
|
24
|
+
h4: "title-3",
|
|
25
|
+
h5: "headline",
|
|
26
|
+
h6: "callout",
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
// Pre-0.14 names, mapped to the nearest role on the iOS-style scale. Only the
|
|
30
|
+
// name is aliased; a legacy variant takes the new role's weight and cap.
|
|
31
|
+
const LEGACY_VARIANT_ALIAS: Record<LegacyTextVariant, RoleTextVariant> = {
|
|
32
|
+
"display-lg": "display",
|
|
33
|
+
"display-md": "display",
|
|
34
|
+
"display-sm": "large-title",
|
|
35
|
+
"headline-lg": "title-1",
|
|
36
|
+
"headline-md": "title-2",
|
|
37
|
+
"headline-sm": "title-2",
|
|
38
|
+
"title-lg": "title-3",
|
|
39
|
+
"title-md": "headline",
|
|
40
|
+
"title-sm": "headline",
|
|
41
|
+
"body-lg": "body",
|
|
42
|
+
"body-md": "body",
|
|
43
|
+
"body-sm": "subheadline",
|
|
44
|
+
caption: "caption-1",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const VARIANT_ALIAS: Record<string, RoleTextVariant> = { ...HEADING_VARIANT_ALIAS, ...LEGACY_VARIANT_ALIAS };
|
|
48
|
+
|
|
28
49
|
function resolveTextVariant(variant: TextVariant): RoleTextVariant {
|
|
29
|
-
return variant
|
|
30
|
-
? HEADING_VARIANT_ALIAS[variant as HeadingTextVariant]
|
|
31
|
-
: (variant as RoleTextVariant);
|
|
50
|
+
return VARIANT_ALIAS[variant] ?? (variant as RoleTextVariant);
|
|
32
51
|
}
|
|
33
52
|
|
|
34
53
|
export interface TextProps extends RNTextProps {
|
|
35
|
-
/** Typographic role. Defaults to `body
|
|
54
|
+
/** Typographic role. Defaults to `body`. */
|
|
36
55
|
variant?: TextVariant;
|
|
37
56
|
/** Semantic color token (e.g. `text.secondary`, `danger.soft.fg`). */
|
|
38
57
|
color?: ColorToken;
|
|
@@ -53,7 +72,7 @@ export interface TextProps extends RNTextProps {
|
|
|
53
72
|
*/
|
|
54
73
|
export const Text = forwardRef<ComponentRef<typeof RNText>, TextProps>(function Text(
|
|
55
74
|
{
|
|
56
|
-
variant = "body
|
|
75
|
+
variant = "body",
|
|
57
76
|
color,
|
|
58
77
|
weight,
|
|
59
78
|
align,
|
|
@@ -187,7 +187,7 @@ const ToastTitle = forwardRef<ComponentRef<typeof Text>, ToastTitleProps>(functi
|
|
|
187
187
|
export interface ToastDescriptionProps extends TextProps {}
|
|
188
188
|
|
|
189
189
|
const ToastDescription = forwardRef<ComponentRef<typeof Text>, ToastDescriptionProps>(
|
|
190
|
-
function ToastDescription({ color, nativeID, variant = "
|
|
190
|
+
function ToastDescription({ color, nativeID, variant = "subheadline", ...rest }, ref) {
|
|
191
191
|
const { theme } = useUnistyles();
|
|
192
192
|
const { nativeID: rootNativeID, variant: toastVariant } = useToastContext();
|
|
193
193
|
const colors = getToastColors(toastVariant, theme);
|
|
@@ -362,7 +362,16 @@ export function DefaultToast({
|
|
|
362
362
|
|
|
363
363
|
return (
|
|
364
364
|
<ToastRoot id={id} hide={hide} variant={variant} {...rest}>
|
|
365
|
-
{
|
|
365
|
+
{/*
|
|
366
|
+
With a description the icon stays at the top, beside the title rather
|
|
367
|
+
than the middle of two lines. With a title alone it centres on it: the
|
|
368
|
+
title's line box is taller than the 20pt icon (a font's ascender and
|
|
369
|
+
descender add to the line), so pinning it to the top leaves the icon
|
|
370
|
+
visibly above the text.
|
|
371
|
+
*/}
|
|
372
|
+
{shouldRenderIcon ? (
|
|
373
|
+
<Box alignSelf={description ? "start" : "center"}>{icon ?? <ToastIcon />}</Box>
|
|
374
|
+
) : null}
|
|
366
375
|
<Box flex={1} gap="0">
|
|
367
376
|
{label ? <ToastTitle>{label}</ToastTitle> : null}
|
|
368
377
|
{description ? <ToastDescription>{description}</ToastDescription> : null}
|
|
@@ -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
|
|