@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,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,22 +8,19 @@ export const heroLineHeight = 48;
|
|
|
10
8
|
/**
|
|
11
9
|
* `Hero` typographic style
|
|
12
10
|
*/
|
|
13
|
-
export const Hero =
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export const Hero = ({
|
|
12
|
+
color: customColor,
|
|
13
|
+
...props
|
|
14
|
+
}: TypographicStyleProps) => {
|
|
15
|
+
const theme = useIOTheme();
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const HeroProps: IOTextProps = {
|
|
18
|
+
...props,
|
|
19
|
+
weight: "Semibold",
|
|
20
|
+
size: 32,
|
|
21
|
+
lineHeight: 48,
|
|
22
|
+
color: customColor ?? theme["textHeading-default"]
|
|
23
|
+
};
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{props.children}
|
|
28
|
-
</IOText>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
);
|
|
25
|
+
return <IOText {...HeroProps}>{props.children}</IOText>;
|
|
26
|
+
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ComponentProps,
|
|
1
|
+
import { ComponentProps, ComponentPropsWithRef, useMemo } from "react";
|
|
2
2
|
import {
|
|
3
3
|
AccessibilityRole,
|
|
4
4
|
ColorValue,
|
|
5
5
|
GestureResponderEvent,
|
|
6
6
|
Text,
|
|
7
|
-
TextStyle
|
|
8
|
-
View
|
|
7
|
+
TextStyle
|
|
9
8
|
} from "react-native";
|
|
10
9
|
import Animated from "react-native-reanimated";
|
|
11
10
|
import { useIONewTypeface } from "../../context";
|
|
@@ -50,7 +49,7 @@ type IOTextBaseProps = {
|
|
|
50
49
|
style?: IOTextStyle;
|
|
51
50
|
};
|
|
52
51
|
|
|
53
|
-
type IOTextExcludedProps = Omit<
|
|
52
|
+
type IOTextExcludedProps = Omit<ComponentPropsWithRef<typeof Text>, "style">;
|
|
54
53
|
|
|
55
54
|
export type IOTextProps = IOTextBaseProps & IOTextExcludedProps;
|
|
56
55
|
|
|
@@ -88,77 +87,73 @@ const calculateTextStyle = (
|
|
|
88
87
|
* @param props
|
|
89
88
|
* @constructor
|
|
90
89
|
*/
|
|
91
|
-
export const IOText =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
) => {
|
|
109
|
-
const boldEnabled = useBoldTextEnabled();
|
|
110
|
-
const { newTypefaceEnabled } = useIONewTypeface();
|
|
90
|
+
export const IOText = ({
|
|
91
|
+
color,
|
|
92
|
+
size,
|
|
93
|
+
font,
|
|
94
|
+
lineHeight,
|
|
95
|
+
weight,
|
|
96
|
+
fontStyle,
|
|
97
|
+
textStyle,
|
|
98
|
+
style,
|
|
99
|
+
children,
|
|
100
|
+
allowFontScaling = true,
|
|
101
|
+
maxFontSizeMultiplier,
|
|
102
|
+
ref,
|
|
103
|
+
...props
|
|
104
|
+
}: IOTextProps) => {
|
|
105
|
+
const boldEnabled = useBoldTextEnabled();
|
|
106
|
+
const { newTypefaceEnabled } = useIONewTypeface();
|
|
111
107
|
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
const computedFont =
|
|
109
|
+
font || (newTypefaceEnabled ? "Titillio" : "TitilliumSansPro");
|
|
114
110
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
111
|
+
const computedStyleObj = useMemo(
|
|
112
|
+
() =>
|
|
113
|
+
calculateTextStyle(
|
|
114
|
+
color,
|
|
115
|
+
size,
|
|
116
|
+
computedFont,
|
|
117
|
+
lineHeight,
|
|
118
|
+
weight,
|
|
119
|
+
fontStyle,
|
|
120
|
+
boldEnabled
|
|
121
|
+
),
|
|
122
|
+
[color, size, computedFont, lineHeight, weight, fontStyle, boldEnabled]
|
|
123
|
+
);
|
|
128
124
|
|
|
129
|
-
|
|
125
|
+
/* In some cases, for example when we use color transitions with
|
|
130
126
|
`reanimated` we need to manage chromatic values as `ColorValue`
|
|
131
127
|
or `string` (not `IOColors`). So we keep a way to override
|
|
132
128
|
the the `color' attribute without giving the ability to
|
|
133
129
|
override all other all other typographic attributes
|
|
134
130
|
through the `style' prop. */
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
const fontStyleObj = style?.color
|
|
132
|
+
? [{ ...computedStyleObj, color: style?.color }]
|
|
133
|
+
: computedStyleObj;
|
|
138
134
|
|
|
139
|
-
|
|
135
|
+
/* Some typographic styles like `H5` have certain `TextStyle` properties
|
|
140
136
|
like `textTransform` or `letterSpacing` that we want to apply to the text.
|
|
141
137
|
We use the `textStyle` prop to pass these properties to the `IOText`
|
|
142
138
|
component and preserve the ability to define the `style` prop as well.
|
|
143
139
|
The `style` prop is the last one to be applied, so we can properly
|
|
144
140
|
override the `color` attribute.
|
|
145
141
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
const styleObj = style
|
|
143
|
+
? [textStyle ?? {}, fontStyleObj ?? {}, style]
|
|
144
|
+
: [textStyle ?? {}, fontStyleObj ?? {}];
|
|
149
145
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
/* Accessible typography based on the `fontScale` parameter */
|
|
147
|
+
const accessibleFontSizeProps: ComponentProps<typeof Text> = {
|
|
148
|
+
allowFontScaling,
|
|
149
|
+
maxFontSizeMultiplier: maxFontSizeMultiplier ?? IOMaxFontSizeMultiplier
|
|
150
|
+
};
|
|
155
151
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
);
|
|
152
|
+
return (
|
|
153
|
+
<Text ref={ref} style={styleObj} {...props} {...accessibleFontSizeProps}>
|
|
154
|
+
{children}
|
|
155
|
+
</Text>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
163
158
|
|
|
164
159
|
export const AnimatedIOText = Animated.createAnimatedComponent(IOText);
|
|
@@ -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,63 +9,59 @@ import {
|
|
|
9
9
|
TypographicStyleProps
|
|
10
10
|
} from "./IOText";
|
|
11
11
|
|
|
12
|
-
type LabelMiniProps = TypographicStyleProps & {
|
|
12
|
+
type LabelMiniProps = Omit<TypographicStyleProps, "ref"> & {
|
|
13
|
+
ref?: Ref<View>;
|
|
13
14
|
weight?: Extract<IOFontWeight, "Regular" | "Semibold">;
|
|
14
15
|
} & TypographicStyleAsLinkProps;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* `LabelMini` typographic style
|
|
18
19
|
*/
|
|
19
|
-
export const LabelMini =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ref?: ForwardedRef<View>
|
|
31
|
-
) => {
|
|
32
|
-
const theme = useIOTheme();
|
|
20
|
+
export const LabelMini = ({
|
|
21
|
+
ref,
|
|
22
|
+
weight: customWeight,
|
|
23
|
+
color: customColor,
|
|
24
|
+
asLink,
|
|
25
|
+
accessibilityRole = "link",
|
|
26
|
+
textStyle: customTextStyle,
|
|
27
|
+
onPress,
|
|
28
|
+
...props
|
|
29
|
+
}: LabelMiniProps) => {
|
|
30
|
+
const theme = useIOTheme();
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const defaultColor = asLink
|
|
33
|
+
? theme["interactiveElem-default"]
|
|
34
|
+
: theme["textBody-tertiary"];
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (asLink) {
|
|
54
|
-
return (
|
|
55
|
-
<Pressable
|
|
56
|
-
onPress={onPress}
|
|
57
|
-
ref={ref}
|
|
58
|
-
accessibilityRole={accessibilityRole}
|
|
59
|
-
>
|
|
60
|
-
<IOText {...LabelMiniProps}>{props.children}</IOText>
|
|
61
|
-
</Pressable>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
36
|
+
const LabelMiniProps: IOTextProps = {
|
|
37
|
+
...props,
|
|
38
|
+
dynamicTypeRamp: "footnote" /* iOS only */,
|
|
39
|
+
weight: customWeight || "Semibold",
|
|
40
|
+
size: 12,
|
|
41
|
+
lineHeight: 18,
|
|
42
|
+
color: customColor ?? defaultColor,
|
|
43
|
+
...(asLink
|
|
44
|
+
? {
|
|
45
|
+
accessibilityRole,
|
|
46
|
+
textStyle: customTextStyle ?? { textDecorationLine: "underline" }
|
|
47
|
+
}
|
|
48
|
+
: {})
|
|
49
|
+
};
|
|
64
50
|
|
|
51
|
+
if (asLink) {
|
|
52
|
+
// TODO: If Pressable is replaced with `onPress` on IOText, ref would
|
|
53
|
+
// always point to a Text node and the Ref<View> override in the prop
|
|
54
|
+
// type can be removed entirely.
|
|
65
55
|
return (
|
|
66
|
-
<
|
|
67
|
-
{
|
|
68
|
-
|
|
56
|
+
<Pressable
|
|
57
|
+
onPress={onPress}
|
|
58
|
+
ref={ref}
|
|
59
|
+
accessibilityRole={accessibilityRole}
|
|
60
|
+
>
|
|
61
|
+
<IOText {...LabelMiniProps}>{props.children}</IOText>
|
|
62
|
+
</Pressable>
|
|
69
63
|
);
|
|
70
64
|
}
|
|
71
|
-
|
|
65
|
+
|
|
66
|
+
return <IOText {...LabelMiniProps}>{props.children}</IOText>;
|
|
67
|
+
};
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../../context";
|
|
4
2
|
import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* `MdH1` typographic style
|
|
8
6
|
*/
|
|
9
|
-
export const MdH1 =
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export const MdH1 = ({
|
|
8
|
+
color: customColor,
|
|
9
|
+
...props
|
|
10
|
+
}: TypographicStyleProps) => {
|
|
11
|
+
const theme = useIOTheme();
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const MdH1Props: IOTextProps = {
|
|
14
|
+
...props,
|
|
15
|
+
weight: "Semibold",
|
|
16
|
+
size: 20,
|
|
17
|
+
lineHeight: 24,
|
|
18
|
+
color: customColor ?? theme["textHeading-default"]
|
|
19
|
+
};
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{props.children}
|
|
24
|
-
</IOText>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
);
|
|
21
|
+
return <IOText {...MdH1Props}>{props.children}</IOText>;
|
|
22
|
+
};
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../../context";
|
|
4
2
|
import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* `MdH2` typographic style
|
|
8
6
|
*/
|
|
9
|
-
export const MdH2 =
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export const MdH2 = ({
|
|
8
|
+
color: customColor,
|
|
9
|
+
...props
|
|
10
|
+
}: TypographicStyleProps) => {
|
|
11
|
+
const theme = useIOTheme();
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const MdH2Props: IOTextProps = {
|
|
14
|
+
...props,
|
|
15
|
+
weight: "Semibold",
|
|
16
|
+
size: 18,
|
|
17
|
+
lineHeight: 24,
|
|
18
|
+
color: customColor ?? theme["textHeading-default"]
|
|
19
|
+
};
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{props.children}
|
|
24
|
-
</IOText>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
);
|
|
21
|
+
return <IOText {...MdH2Props}>{props.children}</IOText>;
|
|
22
|
+
};
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { ForwardedRef, forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
1
|
import { useIOTheme } from "../../../context";
|
|
4
2
|
import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* `MdH3` typographic style
|
|
8
6
|
*/
|
|
9
|
-
export const MdH3 =
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export const MdH3 = ({
|
|
8
|
+
color: customColor,
|
|
9
|
+
...props
|
|
10
|
+
}: TypographicStyleProps) => {
|
|
11
|
+
const theme = useIOTheme();
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const MdH3Props: IOTextProps = {
|
|
14
|
+
...props,
|
|
15
|
+
weight: "Semibold",
|
|
16
|
+
size: 16,
|
|
17
|
+
lineHeight: 24,
|
|
18
|
+
color: customColor ?? theme["textHeading-default"]
|
|
19
|
+
};
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{props.children}
|
|
24
|
-
</IOText>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
);
|
|
21
|
+
return <IOText {...MdH3Props}>{props.children}</IOText>;
|
|
22
|
+
};
|
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
import { Appearance, ColorSchemeName } from "react-native";
|
|
10
10
|
import { IOTheme, IOThemeDark, IOThemeLight } from "../core/IOColors";
|
|
11
11
|
|
|
12
|
-
export const IOThemes = {
|
|
13
|
-
light: IOThemeLight,
|
|
14
|
-
dark: IOThemeDark
|
|
15
|
-
};
|
|
12
|
+
export const IOThemes = { light: IOThemeLight, dark: IOThemeDark };
|
|
16
13
|
|
|
17
14
|
type IOThemeContextType = {
|
|
18
15
|
themeType: ColorSchemeName;
|
|
@@ -22,7 +19,7 @@ type IOThemeContextType = {
|
|
|
22
19
|
|
|
23
20
|
export const IOThemeContext: Context<IOThemeContextType> =
|
|
24
21
|
createContext<IOThemeContextType>({
|
|
25
|
-
themeType: Appearance.getColorScheme()
|
|
22
|
+
themeType: Appearance.getColorScheme(),
|
|
26
23
|
theme:
|
|
27
24
|
Appearance.getColorScheme() === "dark" ? IOThemes.dark : IOThemes.light,
|
|
28
25
|
setTheme: () => void 0
|
|
@@ -41,14 +38,9 @@ export const IOThemeContextProvider = ({
|
|
|
41
38
|
theme
|
|
42
39
|
}: PropsWithChildren<IOThemeContextProviderProps>) => {
|
|
43
40
|
const [currentTheme, setCurrentTheme] = useState<ColorSchemeName>(
|
|
44
|
-
theme ??
|
|
41
|
+
theme ?? Appearance.getColorScheme()
|
|
45
42
|
);
|
|
46
43
|
|
|
47
|
-
const resolvedTheme =
|
|
48
|
-
currentTheme === "unspecified"
|
|
49
|
-
? Appearance.getColorScheme() ?? "light"
|
|
50
|
-
: currentTheme;
|
|
51
|
-
|
|
52
44
|
const handleThemeChange = useCallback((newTheme: ColorSchemeName) => {
|
|
53
45
|
setCurrentTheme(newTheme);
|
|
54
46
|
}, []);
|
|
@@ -57,7 +49,7 @@ export const IOThemeContextProvider = ({
|
|
|
57
49
|
<IOThemeContext.Provider
|
|
58
50
|
value={{
|
|
59
51
|
themeType: currentTheme,
|
|
60
|
-
theme:
|
|
52
|
+
theme: IOThemes[currentTheme ?? "light"],
|
|
61
53
|
setTheme: handleThemeChange
|
|
62
54
|
}}
|
|
63
55
|
>
|