@pagopa/io-app-design-system 7.0.2 → 7.1.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.
- package/lib/commonjs/components/alert/Alert.js +6 -5
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/banner/Banner.js +7 -6
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/buttons/IOButton/IOButton.js +10 -8
- package/lib/commonjs/components/buttons/IOButton/IOButton.js.map +1 -1
- package/lib/commonjs/components/layout/ContentWrapper.js +5 -4
- package/lib/commonjs/components/layout/ContentWrapper.js.map +1 -1
- package/lib/commonjs/components/otpInput/OTPInput.js +6 -4
- package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
- package/lib/commonjs/components/searchInput/SearchInput.js +8 -6
- package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
- package/lib/commonjs/components/tabs/TabItem.js +6 -4
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputValidation.js +5 -3
- package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/commonjs/components/typography/Body.js +8 -5
- package/lib/commonjs/components/typography/Body.js.map +1 -1
- package/lib/commonjs/components/typography/BodyMonospace.js +4 -5
- package/lib/commonjs/components/typography/BodyMonospace.js.map +1 -1
- package/lib/commonjs/components/typography/BodySmall.js +8 -5
- package/lib/commonjs/components/typography/BodySmall.js.map +1 -1
- package/lib/commonjs/components/typography/ButtonText.js +4 -5
- package/lib/commonjs/components/typography/ButtonText.js.map +1 -1
- package/lib/commonjs/components/typography/Caption.js +4 -5
- package/lib/commonjs/components/typography/Caption.js.map +1 -1
- package/lib/commonjs/components/typography/H1.js +4 -5
- package/lib/commonjs/components/typography/H1.js.map +1 -1
- package/lib/commonjs/components/typography/H2.js +4 -5
- package/lib/commonjs/components/typography/H2.js.map +1 -1
- package/lib/commonjs/components/typography/H3.js +4 -5
- package/lib/commonjs/components/typography/H3.js.map +1 -1
- package/lib/commonjs/components/typography/H4.js +4 -5
- package/lib/commonjs/components/typography/H4.js.map +1 -1
- package/lib/commonjs/components/typography/H5.js +4 -5
- package/lib/commonjs/components/typography/H5.js.map +1 -1
- package/lib/commonjs/components/typography/H6.js +4 -5
- package/lib/commonjs/components/typography/H6.js.map +1 -1
- package/lib/commonjs/components/typography/Hero.js +4 -5
- package/lib/commonjs/components/typography/Hero.js.map +1 -1
- package/lib/commonjs/components/typography/IOText.js +16 -14
- package/lib/commonjs/components/typography/IOText.js.map +1 -1
- package/lib/commonjs/components/typography/LabelMini.js +8 -5
- package/lib/commonjs/components/typography/LabelMini.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH1.js +4 -5
- package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH2.js +4 -5
- package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH3.js +4 -5
- package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
- package/lib/commonjs/context/IOThemeContextProvider.js +3 -4
- package/lib/commonjs/context/IOThemeContextProvider.js.map +1 -1
- package/lib/module/components/alert/Alert.js +5 -5
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/banner/Banner.js +6 -6
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/buttons/IOButton/IOButton.js +10 -9
- package/lib/module/components/buttons/IOButton/IOButton.js.map +1 -1
- package/lib/module/components/layout/ContentWrapper.js +4 -4
- package/lib/module/components/layout/ContentWrapper.js.map +1 -1
- package/lib/module/components/otpInput/OTPInput.js +6 -5
- package/lib/module/components/otpInput/OTPInput.js.map +1 -1
- package/lib/module/components/searchInput/SearchInput.js +8 -7
- package/lib/module/components/searchInput/SearchInput.js.map +1 -1
- package/lib/module/components/tabs/TabItem.js +6 -5
- package/lib/module/components/tabs/TabItem.js.map +1 -1
- package/lib/module/components/textInput/TextInputValidation.js +5 -4
- package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/module/components/typography/Body.js +7 -5
- package/lib/module/components/typography/Body.js.map +1 -1
- package/lib/module/components/typography/BodyMonospace.js +3 -5
- package/lib/module/components/typography/BodyMonospace.js.map +1 -1
- package/lib/module/components/typography/BodySmall.js +7 -5
- package/lib/module/components/typography/BodySmall.js.map +1 -1
- package/lib/module/components/typography/ButtonText.js +3 -5
- package/lib/module/components/typography/ButtonText.js.map +1 -1
- package/lib/module/components/typography/Caption.js +3 -5
- package/lib/module/components/typography/Caption.js.map +1 -1
- package/lib/module/components/typography/H1.js +3 -5
- package/lib/module/components/typography/H1.js.map +1 -1
- package/lib/module/components/typography/H2.js +3 -5
- package/lib/module/components/typography/H2.js.map +1 -1
- package/lib/module/components/typography/H3.js +3 -5
- package/lib/module/components/typography/H3.js.map +1 -1
- package/lib/module/components/typography/H4.js +3 -5
- package/lib/module/components/typography/H4.js.map +1 -1
- package/lib/module/components/typography/H5.js +3 -5
- package/lib/module/components/typography/H5.js.map +1 -1
- package/lib/module/components/typography/H6.js +3 -5
- package/lib/module/components/typography/H6.js.map +1 -1
- package/lib/module/components/typography/Hero.js +3 -5
- package/lib/module/components/typography/Hero.js.map +1 -1
- package/lib/module/components/typography/IOText.js +16 -15
- package/lib/module/components/typography/IOText.js.map +1 -1
- package/lib/module/components/typography/LabelMini.js +7 -5
- package/lib/module/components/typography/LabelMini.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH1.js +3 -5
- package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH2.js +3 -5
- package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH3.js +3 -5
- package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
- package/lib/module/context/IOThemeContextProvider.js +3 -4
- package/lib/module/context/IOThemeContextProvider.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts +3 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts +3 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IOButton/IOButton.d.ts +3 -2
- package/lib/typescript/components/buttons/IOButton/IOButton.d.ts.map +1 -1
- package/lib/typescript/components/layout/ContentWrapper.d.ts +10 -6
- package/lib/typescript/components/layout/ContentWrapper.d.ts.map +1 -1
- package/lib/typescript/components/otpInput/OTPInput.d.ts +3 -1
- package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
- package/lib/typescript/components/searchInput/SearchInput.d.ts +3 -1
- package/lib/typescript/components/searchInput/SearchInput.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabItem.d.ts +3 -11
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputValidation.d.ts +7 -24
- package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
- package/lib/typescript/components/typography/Body.d.ts +4 -2
- package/lib/typescript/components/typography/Body.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodyMonospace.d.ts +2 -8
- package/lib/typescript/components/typography/BodyMonospace.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodySmall.d.ts +4 -2
- package/lib/typescript/components/typography/BodySmall.d.ts.map +1 -1
- package/lib/typescript/components/typography/ButtonText.d.ts +2 -8
- package/lib/typescript/components/typography/ButtonText.d.ts.map +1 -1
- package/lib/typescript/components/typography/Caption.d.ts +2 -8
- package/lib/typescript/components/typography/Caption.d.ts.map +1 -1
- package/lib/typescript/components/typography/H1.d.ts +2 -8
- package/lib/typescript/components/typography/H1.d.ts.map +1 -1
- package/lib/typescript/components/typography/H2.d.ts +6 -10
- package/lib/typescript/components/typography/H2.d.ts.map +1 -1
- package/lib/typescript/components/typography/H3.d.ts +2 -8
- package/lib/typescript/components/typography/H3.d.ts.map +1 -1
- package/lib/typescript/components/typography/H4.d.ts +2 -8
- package/lib/typescript/components/typography/H4.d.ts.map +1 -1
- package/lib/typescript/components/typography/H5.d.ts +2 -8
- package/lib/typescript/components/typography/H5.d.ts.map +1 -1
- package/lib/typescript/components/typography/H6.d.ts +2 -8
- package/lib/typescript/components/typography/H6.d.ts.map +1 -1
- package/lib/typescript/components/typography/Hero.d.ts +2 -8
- package/lib/typescript/components/typography/Hero.d.ts.map +1 -1
- package/lib/typescript/components/typography/IOText.d.ts +5 -5
- package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
- package/lib/typescript/components/typography/LabelMini.d.ts +4 -2
- package/lib/typescript/components/typography/LabelMini.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH1.d.ts +2 -8
- package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH2.d.ts +2 -8
- package/lib/typescript/components/typography/markdown/MdH2.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH3.d.ts +2 -8
- package/lib/typescript/components/typography/markdown/MdH3.d.ts.map +1 -1
- package/lib/typescript/context/IOThemeContextProvider.d.ts.map +1 -1
- package/package.json +6 -7
- package/src/components/alert/Alert.tsx +108 -112
- package/src/components/banner/Banner.tsx +121 -125
- package/src/components/buttons/IOButton/IOButton.tsx +204 -216
- package/src/components/layout/ContentWrapper.tsx +21 -24
- package/src/components/otpInput/OTPInput.tsx +156 -167
- package/src/components/searchInput/SearchInput.tsx +208 -217
- package/src/components/tabs/TabItem.tsx +143 -146
- package/src/components/textInput/TextInputValidation.tsx +116 -122
- package/src/components/typography/Body.tsx +51 -52
- package/src/components/typography/BodyMonospace.tsx +19 -24
- package/src/components/typography/BodySmall.tsx +51 -52
- package/src/components/typography/ButtonText.tsx +14 -20
- package/src/components/typography/Caption.tsx +18 -23
- package/src/components/typography/H1.tsx +12 -20
- package/src/components/typography/H2.tsx +16 -23
- package/src/components/typography/H3.tsx +12 -20
- package/src/components/typography/H4.tsx +12 -20
- package/src/components/typography/H5.tsx +16 -24
- package/src/components/typography/H6.tsx +13 -21
- package/src/components/typography/Hero.tsx +14 -19
- package/src/components/typography/IOText.tsx +54 -59
- package/src/components/typography/LabelMini.tsx +45 -49
- package/src/components/typography/markdown/MdH1.tsx +14 -19
- package/src/components/typography/markdown/MdH2.tsx +14 -19
- package/src/components/typography/markdown/MdH3.tsx +14 -19
- package/src/context/IOThemeContextProvider.tsx +4 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from "react";
|
|
2
2
|
import { Pressable, View } from "react-native";
|
|
3
3
|
import { useIOTheme } from "../../context";
|
|
4
4
|
import { IOFontWeight } from "../../utils/fonts";
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
TypographicStyleProps
|
|
10
10
|
} from "./IOText";
|
|
11
11
|
|
|
12
|
-
type BodyStyleProps = TypographicStyleProps & {
|
|
12
|
+
type BodyStyleProps = Omit<TypographicStyleProps, "ref"> & {
|
|
13
|
+
ref?: Ref<View>;
|
|
13
14
|
weight?: Extract<IOFontWeight, "Regular" | "Semibold">;
|
|
14
15
|
} & TypographicStyleAsLinkProps;
|
|
15
16
|
|
|
@@ -19,61 +20,59 @@ export const bodyLineHeight = 24;
|
|
|
19
20
|
/**
|
|
20
21
|
* `Body` typographic style
|
|
21
22
|
*/
|
|
22
|
-
export const Body =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ref?: ForwardedRef<View>
|
|
35
|
-
) => {
|
|
36
|
-
const theme = useIOTheme();
|
|
23
|
+
export const Body = ({
|
|
24
|
+
ref,
|
|
25
|
+
weight: customWeight,
|
|
26
|
+
color: customColor,
|
|
27
|
+
asLink,
|
|
28
|
+
avoidPressable,
|
|
29
|
+
accessibilityRole = "link",
|
|
30
|
+
textStyle: customTextStyle,
|
|
31
|
+
onPress,
|
|
32
|
+
...props
|
|
33
|
+
}: BodyStyleProps) => {
|
|
34
|
+
const theme = useIOTheme();
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const defaultColor = asLink
|
|
37
|
+
? theme["interactiveElem-default"]
|
|
38
|
+
: theme["textBody-tertiary"];
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (asLink && !avoidPressable) {
|
|
58
|
-
return (
|
|
59
|
-
<Pressable
|
|
60
|
-
onPress={onPress}
|
|
61
|
-
ref={ref}
|
|
62
|
-
accessibilityRole={accessibilityRole}
|
|
63
|
-
>
|
|
64
|
-
<IOText {...BodyProps}>{props.children}</IOText>
|
|
65
|
-
</Pressable>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
40
|
+
const BodyProps: IOTextProps = {
|
|
41
|
+
...props,
|
|
42
|
+
dynamicTypeRamp: "body", // iOS only
|
|
43
|
+
weight: customWeight || "Regular",
|
|
44
|
+
size: bodyFontSize,
|
|
45
|
+
lineHeight: bodyLineHeight,
|
|
46
|
+
color: customColor ?? defaultColor,
|
|
47
|
+
...(asLink
|
|
48
|
+
? {
|
|
49
|
+
accessibilityRole,
|
|
50
|
+
textStyle: customTextStyle ?? { textDecorationLine: "underline" }
|
|
51
|
+
}
|
|
52
|
+
: {})
|
|
53
|
+
};
|
|
68
54
|
|
|
55
|
+
if (asLink && !avoidPressable) {
|
|
56
|
+
// TODO: If Pressable is replaced with `onPress` on IOText, ref would
|
|
57
|
+
// always point to a Text node and the Ref<View> override in the prop
|
|
58
|
+
// type can be removed entirely.
|
|
69
59
|
return (
|
|
70
|
-
<
|
|
60
|
+
<Pressable
|
|
61
|
+
onPress={onPress}
|
|
71
62
|
ref={ref}
|
|
72
|
-
{
|
|
73
|
-
onPress={asLink && avoidPressable ? onPress : undefined}
|
|
63
|
+
accessibilityRole={accessibilityRole}
|
|
74
64
|
>
|
|
75
|
-
{props.children}
|
|
76
|
-
</
|
|
65
|
+
<IOText {...BodyProps}>{props.children}</IOText>
|
|
66
|
+
</Pressable>
|
|
77
67
|
);
|
|
78
68
|
}
|
|
79
|
-
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<IOText
|
|
72
|
+
{...BodyProps}
|
|
73
|
+
onPress={asLink && avoidPressable ? onPress : undefined}
|
|
74
|
+
>
|
|
75
|
+
{props.children}
|
|
76
|
+
</IOText>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../context";
|
|
4
2
|
import { bodyFontSize, bodyLineHeight } from "./Body";
|
|
5
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -7,27 +5,24 @@ import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
|
7
5
|
/**
|
|
8
6
|
* `BodyMonospace` typographic style
|
|
9
7
|
*/
|
|
10
|
-
export const BodyMonospace =
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export const BodyMonospace = ({
|
|
9
|
+
color: customColor,
|
|
10
|
+
...props
|
|
11
|
+
}: TypographicStyleProps) => {
|
|
12
|
+
const theme = useIOTheme();
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
const BodyProps: IOTextProps = {
|
|
15
|
+
...props,
|
|
16
|
+
dynamicTypeRamp: "body", // iOS only
|
|
17
|
+
font: "FiraCode",
|
|
18
|
+
weight: "Medium",
|
|
19
|
+
size: bodyFontSize,
|
|
20
|
+
lineHeight: bodyLineHeight,
|
|
21
|
+
color: customColor ?? theme["textBody-tertiary"],
|
|
22
|
+
textStyle: {
|
|
23
|
+
letterSpacing: 0.5
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{props.children}
|
|
30
|
-
</IOText>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
);
|
|
27
|
+
return <IOText {...BodyProps}>{props.children}</IOText>;
|
|
28
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from "react";
|
|
2
2
|
import { Pressable, View } from "react-native";
|
|
3
3
|
import { useIOTheme } from "../../context";
|
|
4
4
|
import { IOFontWeight } from "../../utils/fonts";
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
TypographicStyleProps
|
|
10
10
|
} from "./IOText";
|
|
11
11
|
|
|
12
|
-
type BodySmallProps = TypographicStyleProps & {
|
|
12
|
+
type BodySmallProps = Omit<TypographicStyleProps, "ref"> & {
|
|
13
|
+
ref?: Ref<View>;
|
|
13
14
|
weight?: Extract<IOFontWeight, "Regular" | "Semibold">;
|
|
14
15
|
} & TypographicStyleAsLinkProps;
|
|
15
16
|
|
|
@@ -19,61 +20,59 @@ export const bodySmallLineHeight = 21;
|
|
|
19
20
|
/**
|
|
20
21
|
* `BodySmall` typographic style
|
|
21
22
|
*/
|
|
22
|
-
export const BodySmall =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ref?: ForwardedRef<View>
|
|
35
|
-
) => {
|
|
36
|
-
const theme = useIOTheme();
|
|
23
|
+
export const BodySmall = ({
|
|
24
|
+
ref,
|
|
25
|
+
weight: customWeight,
|
|
26
|
+
color: customColor,
|
|
27
|
+
asLink,
|
|
28
|
+
avoidPressable,
|
|
29
|
+
accessibilityRole = "link",
|
|
30
|
+
textStyle: customTextStyle,
|
|
31
|
+
onPress,
|
|
32
|
+
...props
|
|
33
|
+
}: BodySmallProps) => {
|
|
34
|
+
const theme = useIOTheme();
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const defaultColor = asLink
|
|
37
|
+
? theme["interactiveElem-default"]
|
|
38
|
+
: theme["textBody-tertiary"];
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (asLink && !avoidPressable) {
|
|
58
|
-
return (
|
|
59
|
-
<Pressable
|
|
60
|
-
onPress={onPress}
|
|
61
|
-
ref={ref}
|
|
62
|
-
accessibilityRole={accessibilityRole}
|
|
63
|
-
>
|
|
64
|
-
<IOText {...BodySmallProps}>{props.children}</IOText>
|
|
65
|
-
</Pressable>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
40
|
+
const BodySmallProps: IOTextProps = {
|
|
41
|
+
...props,
|
|
42
|
+
dynamicTypeRamp: "footnote" /* iOS only */,
|
|
43
|
+
weight: customWeight ?? "Regular",
|
|
44
|
+
size: bodySmallFontSize,
|
|
45
|
+
lineHeight: bodySmallLineHeight,
|
|
46
|
+
color: customColor ?? defaultColor,
|
|
47
|
+
...(asLink
|
|
48
|
+
? {
|
|
49
|
+
accessibilityRole,
|
|
50
|
+
textStyle: customTextStyle ?? { textDecorationLine: "underline" }
|
|
51
|
+
}
|
|
52
|
+
: {})
|
|
53
|
+
};
|
|
68
54
|
|
|
55
|
+
if (asLink && !avoidPressable) {
|
|
56
|
+
// TODO: If Pressable is replaced with `onPress` on IOText, ref would
|
|
57
|
+
// always point to a Text node and the Ref<View> override in the prop
|
|
58
|
+
// type can be removed entirely.
|
|
69
59
|
return (
|
|
70
|
-
<
|
|
60
|
+
<Pressable
|
|
61
|
+
onPress={onPress}
|
|
71
62
|
ref={ref}
|
|
72
|
-
{
|
|
73
|
-
onPress={asLink && avoidPressable ? onPress : undefined}
|
|
63
|
+
accessibilityRole={accessibilityRole}
|
|
74
64
|
>
|
|
75
|
-
{props.children}
|
|
76
|
-
</
|
|
65
|
+
<IOText {...BodySmallProps}>{props.children}</IOText>
|
|
66
|
+
</Pressable>
|
|
77
67
|
);
|
|
78
68
|
}
|
|
79
|
-
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<IOText
|
|
72
|
+
{...BodySmallProps}
|
|
73
|
+
onPress={asLink && avoidPressable ? onPress : undefined}
|
|
74
|
+
>
|
|
75
|
+
{props.children}
|
|
76
|
+
</IOText>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
|
|
4
1
|
import { IOColors } from "../../core";
|
|
5
2
|
import { IOFontSize } from "../../utils/fonts";
|
|
6
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -15,22 +12,19 @@ const defaultColor: IOColors = "white";
|
|
|
15
12
|
/**
|
|
16
13
|
* `ButtonText` typographic style
|
|
17
14
|
*/
|
|
18
|
-
export const ButtonText =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
export const ButtonText = ({
|
|
16
|
+
color: customColor,
|
|
17
|
+
...props
|
|
18
|
+
}: TypographicStyleProps) => {
|
|
19
|
+
const ButtonTextProps: IOTextProps = {
|
|
20
|
+
...props,
|
|
21
|
+
weight: "Semibold",
|
|
22
|
+
size: buttonTextFontSize,
|
|
23
|
+
lineHeight: buttonTextLineHeight,
|
|
24
|
+
/* Needed to render `ButtonOutline` and`ButtonLink` because they use
|
|
26
25
|
`AnimatedText` for color transition through Reanimated */
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
color: customColor ?? defaultColor
|
|
27
|
+
};
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{props.children}
|
|
33
|
-
</IOText>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
);
|
|
29
|
+
return <IOText {...ButtonTextProps}>{props.children}</IOText>;
|
|
30
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../context";
|
|
4
2
|
import { IOFontSize } from "../../utils/fonts";
|
|
5
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -9,26 +7,23 @@ export const captionFontSize: IOFontSize = 12;
|
|
|
9
7
|
/**
|
|
10
8
|
* `Caption` typographic style
|
|
11
9
|
*/
|
|
12
|
-
export const Caption =
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export const Caption = ({
|
|
11
|
+
color: customColor,
|
|
12
|
+
...props
|
|
13
|
+
}: TypographicStyleProps) => {
|
|
14
|
+
const theme = useIOTheme();
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
const CaptionProps: IOTextProps = {
|
|
17
|
+
...props,
|
|
18
|
+
dynamicTypeRamp: "caption1", // iOS only
|
|
19
|
+
weight: "Regular",
|
|
20
|
+
size: captionFontSize,
|
|
21
|
+
color: customColor ?? theme["textBody-default"],
|
|
22
|
+
textStyle: {
|
|
23
|
+
textTransform: "uppercase",
|
|
24
|
+
letterSpacing: 0.5
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{props.children}
|
|
31
|
-
</IOText>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
);
|
|
28
|
+
return <IOText {...CaptionProps}>{props.children}</IOText>;
|
|
29
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../context";
|
|
4
2
|
import { IOFontSize } from "../../utils/fonts";
|
|
5
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -10,23 +8,17 @@ export const h1LineHeight = 42;
|
|
|
10
8
|
/**
|
|
11
9
|
* `H1` typographic style
|
|
12
10
|
*/
|
|
13
|
-
export const H1 =
|
|
14
|
-
|
|
15
|
-
const theme = useIOTheme();
|
|
11
|
+
export const H1 = ({ color: customColor, ...props }: TypographicStyleProps) => {
|
|
12
|
+
const theme = useIOTheme();
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
const H1Props: IOTextProps = {
|
|
15
|
+
...props,
|
|
16
|
+
dynamicTypeRamp: "largeTitle", // iOS only
|
|
17
|
+
weight: "Semibold",
|
|
18
|
+
size: h1FontSize,
|
|
19
|
+
lineHeight: h1LineHeight,
|
|
20
|
+
color: customColor ?? theme["textHeading-default"]
|
|
21
|
+
};
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{props.children}
|
|
29
|
-
</IOText>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
);
|
|
23
|
+
return <IOText {...H1Props}>{props.children}</IOText>;
|
|
24
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../context";
|
|
4
2
|
import { IOFontSize, IOFontWeight } from "../../utils/fonts";
|
|
5
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -14,26 +12,21 @@ export const h2LineHeight = 34;
|
|
|
14
12
|
/**
|
|
15
13
|
* `H2` typographic style
|
|
16
14
|
*/
|
|
17
|
-
export const H2 =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
export const H2 = ({
|
|
16
|
+
weight: customWeight,
|
|
17
|
+
color: customColor,
|
|
18
|
+
...props
|
|
19
|
+
}: H2StyleProps) => {
|
|
20
|
+
const theme = useIOTheme();
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
const H2Props: IOTextProps = {
|
|
23
|
+
...props,
|
|
24
|
+
dynamicTypeRamp: "title1", // iOS only
|
|
25
|
+
weight: customWeight ?? "Semibold",
|
|
26
|
+
size: h2FontSize,
|
|
27
|
+
lineHeight: h2LineHeight,
|
|
28
|
+
color: customColor ?? theme["textHeading-default"]
|
|
29
|
+
};
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{props.children}
|
|
36
|
-
</IOText>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
);
|
|
31
|
+
return <IOText {...H2Props}>{props.children}</IOText>;
|
|
32
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../context";
|
|
4
2
|
import { IOFontSize } from "../../utils/fonts";
|
|
5
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -11,23 +9,17 @@ export const h3LineHeight = 33;
|
|
|
11
9
|
/**
|
|
12
10
|
* `H3` typographic style
|
|
13
11
|
*/
|
|
14
|
-
export const H3 =
|
|
15
|
-
|
|
16
|
-
const theme = useIOTheme();
|
|
12
|
+
export const H3 = ({ color: customColor, ...props }: TypographicStyleProps) => {
|
|
13
|
+
const theme = useIOTheme();
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
const H3Props: IOTextProps = {
|
|
16
|
+
...props,
|
|
17
|
+
dynamicTypeRamp: "title2", // iOS only
|
|
18
|
+
weight: "Semibold",
|
|
19
|
+
size: h3FontSize,
|
|
20
|
+
lineHeight: h3LineHeight,
|
|
21
|
+
color: customColor ?? theme["textHeading-default"]
|
|
22
|
+
};
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{props.children}
|
|
30
|
-
</IOText>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
);
|
|
24
|
+
return <IOText {...H3Props}>{props.children}</IOText>;
|
|
25
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../context";
|
|
4
2
|
import { IOFontSize } from "../../utils/fonts";
|
|
5
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -10,23 +8,17 @@ export const h4LineHeight = 24;
|
|
|
10
8
|
/**
|
|
11
9
|
* `H4` typographic style
|
|
12
10
|
*/
|
|
13
|
-
export const H4 =
|
|
14
|
-
|
|
15
|
-
const theme = useIOTheme();
|
|
11
|
+
export const H4 = ({ color: customColor, ...props }: TypographicStyleProps) => {
|
|
12
|
+
const theme = useIOTheme();
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
const H4Props: IOTextProps = {
|
|
15
|
+
...props,
|
|
16
|
+
dynamicTypeRamp: "title3", // iOS only
|
|
17
|
+
weight: "Semibold",
|
|
18
|
+
size: h4FontSize,
|
|
19
|
+
lineHeight: h4LineHeight,
|
|
20
|
+
color: customColor ?? theme["textHeading-default"]
|
|
21
|
+
};
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{props.children}
|
|
29
|
-
</IOText>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
);
|
|
23
|
+
return <IOText {...H4Props}>{props.children}</IOText>;
|
|
24
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../context";
|
|
4
2
|
import { IOFontSize } from "../../utils/fonts";
|
|
5
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -10,27 +8,21 @@ export const h5LineHeight = 16;
|
|
|
10
8
|
/**
|
|
11
9
|
* `H5` typographic style
|
|
12
10
|
*/
|
|
13
|
-
export const H5 =
|
|
14
|
-
|
|
15
|
-
const theme = useIOTheme();
|
|
11
|
+
export const H5 = ({ color: customColor, ...props }: TypographicStyleProps) => {
|
|
12
|
+
const theme = useIOTheme();
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
const H5Props: IOTextProps = {
|
|
15
|
+
...props,
|
|
16
|
+
dynamicTypeRamp: "subheadline", // iOS only
|
|
17
|
+
weight: "Semibold",
|
|
18
|
+
size: h5FontSize,
|
|
19
|
+
lineHeight: h5LineHeight,
|
|
20
|
+
color: customColor ?? theme["textHeading-default"],
|
|
21
|
+
textStyle: {
|
|
22
|
+
textTransform: "uppercase",
|
|
23
|
+
letterSpacing: 0.5
|
|
24
|
+
}
|
|
25
|
+
};
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{props.children}
|
|
33
|
-
</IOText>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
);
|
|
27
|
+
return <IOText {...H5Props}>{props.children}</IOText>;
|
|
28
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIONewTypeface, useIOTheme } from "../../context";
|
|
4
2
|
import { IOFontSize } from "../../utils/fonts";
|
|
5
3
|
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
@@ -13,24 +11,18 @@ const legacyFontSize: IOFontSize = 17;
|
|
|
13
11
|
/**
|
|
14
12
|
* `H6` typographic style
|
|
15
13
|
*/
|
|
16
|
-
export const H6 =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const { newTypefaceEnabled } = useIONewTypeface();
|
|
14
|
+
export const H6 = ({ color: customColor, ...props }: TypographicStyleProps) => {
|
|
15
|
+
const theme = useIOTheme();
|
|
16
|
+
const { newTypefaceEnabled } = useIONewTypeface();
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
const H6Props: IOTextProps = {
|
|
19
|
+
...props,
|
|
20
|
+
dynamicTypeRamp: "headline", // iOS only
|
|
21
|
+
weight: "Semibold",
|
|
22
|
+
size: newTypefaceEnabled ? h6FontSize : legacyFontSize,
|
|
23
|
+
lineHeight: h6LineHeight,
|
|
24
|
+
color: customColor ?? theme["textHeading-default"]
|
|
25
|
+
};
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{props.children}
|
|
33
|
-
</IOText>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
);
|
|
27
|
+
return <IOText {...H6Props}>{props.children}</IOText>;
|
|
28
|
+
};
|