@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.
Files changed (182) hide show
  1. package/lib/commonjs/components/alert/Alert.js +6 -5
  2. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  3. package/lib/commonjs/components/banner/Banner.js +7 -6
  4. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  5. package/lib/commonjs/components/buttons/IOButton/IOButton.js +10 -8
  6. package/lib/commonjs/components/buttons/IOButton/IOButton.js.map +1 -1
  7. package/lib/commonjs/components/layout/ContentWrapper.js +5 -4
  8. package/lib/commonjs/components/layout/ContentWrapper.js.map +1 -1
  9. package/lib/commonjs/components/otpInput/OTPInput.js +6 -4
  10. package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
  11. package/lib/commonjs/components/searchInput/SearchInput.js +8 -6
  12. package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
  13. package/lib/commonjs/components/tabs/TabItem.js +6 -4
  14. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  15. package/lib/commonjs/components/textInput/TextInputValidation.js +5 -3
  16. package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
  17. package/lib/commonjs/components/typography/Body.js +8 -5
  18. package/lib/commonjs/components/typography/Body.js.map +1 -1
  19. package/lib/commonjs/components/typography/BodyMonospace.js +4 -5
  20. package/lib/commonjs/components/typography/BodyMonospace.js.map +1 -1
  21. package/lib/commonjs/components/typography/BodySmall.js +8 -5
  22. package/lib/commonjs/components/typography/BodySmall.js.map +1 -1
  23. package/lib/commonjs/components/typography/ButtonText.js +4 -5
  24. package/lib/commonjs/components/typography/ButtonText.js.map +1 -1
  25. package/lib/commonjs/components/typography/Caption.js +4 -5
  26. package/lib/commonjs/components/typography/Caption.js.map +1 -1
  27. package/lib/commonjs/components/typography/H1.js +4 -5
  28. package/lib/commonjs/components/typography/H1.js.map +1 -1
  29. package/lib/commonjs/components/typography/H2.js +4 -5
  30. package/lib/commonjs/components/typography/H2.js.map +1 -1
  31. package/lib/commonjs/components/typography/H3.js +4 -5
  32. package/lib/commonjs/components/typography/H3.js.map +1 -1
  33. package/lib/commonjs/components/typography/H4.js +4 -5
  34. package/lib/commonjs/components/typography/H4.js.map +1 -1
  35. package/lib/commonjs/components/typography/H5.js +4 -5
  36. package/lib/commonjs/components/typography/H5.js.map +1 -1
  37. package/lib/commonjs/components/typography/H6.js +4 -5
  38. package/lib/commonjs/components/typography/H6.js.map +1 -1
  39. package/lib/commonjs/components/typography/Hero.js +4 -5
  40. package/lib/commonjs/components/typography/Hero.js.map +1 -1
  41. package/lib/commonjs/components/typography/IOText.js +16 -14
  42. package/lib/commonjs/components/typography/IOText.js.map +1 -1
  43. package/lib/commonjs/components/typography/LabelMini.js +8 -5
  44. package/lib/commonjs/components/typography/LabelMini.js.map +1 -1
  45. package/lib/commonjs/components/typography/markdown/MdH1.js +4 -5
  46. package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
  47. package/lib/commonjs/components/typography/markdown/MdH2.js +4 -5
  48. package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
  49. package/lib/commonjs/components/typography/markdown/MdH3.js +4 -5
  50. package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
  51. package/lib/commonjs/context/IOThemeContextProvider.js +3 -4
  52. package/lib/commonjs/context/IOThemeContextProvider.js.map +1 -1
  53. package/lib/module/components/alert/Alert.js +5 -5
  54. package/lib/module/components/alert/Alert.js.map +1 -1
  55. package/lib/module/components/banner/Banner.js +6 -6
  56. package/lib/module/components/banner/Banner.js.map +1 -1
  57. package/lib/module/components/buttons/IOButton/IOButton.js +10 -9
  58. package/lib/module/components/buttons/IOButton/IOButton.js.map +1 -1
  59. package/lib/module/components/layout/ContentWrapper.js +4 -4
  60. package/lib/module/components/layout/ContentWrapper.js.map +1 -1
  61. package/lib/module/components/otpInput/OTPInput.js +6 -5
  62. package/lib/module/components/otpInput/OTPInput.js.map +1 -1
  63. package/lib/module/components/searchInput/SearchInput.js +8 -7
  64. package/lib/module/components/searchInput/SearchInput.js.map +1 -1
  65. package/lib/module/components/tabs/TabItem.js +6 -5
  66. package/lib/module/components/tabs/TabItem.js.map +1 -1
  67. package/lib/module/components/textInput/TextInputValidation.js +5 -4
  68. package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
  69. package/lib/module/components/typography/Body.js +7 -5
  70. package/lib/module/components/typography/Body.js.map +1 -1
  71. package/lib/module/components/typography/BodyMonospace.js +3 -5
  72. package/lib/module/components/typography/BodyMonospace.js.map +1 -1
  73. package/lib/module/components/typography/BodySmall.js +7 -5
  74. package/lib/module/components/typography/BodySmall.js.map +1 -1
  75. package/lib/module/components/typography/ButtonText.js +3 -5
  76. package/lib/module/components/typography/ButtonText.js.map +1 -1
  77. package/lib/module/components/typography/Caption.js +3 -5
  78. package/lib/module/components/typography/Caption.js.map +1 -1
  79. package/lib/module/components/typography/H1.js +3 -5
  80. package/lib/module/components/typography/H1.js.map +1 -1
  81. package/lib/module/components/typography/H2.js +3 -5
  82. package/lib/module/components/typography/H2.js.map +1 -1
  83. package/lib/module/components/typography/H3.js +3 -5
  84. package/lib/module/components/typography/H3.js.map +1 -1
  85. package/lib/module/components/typography/H4.js +3 -5
  86. package/lib/module/components/typography/H4.js.map +1 -1
  87. package/lib/module/components/typography/H5.js +3 -5
  88. package/lib/module/components/typography/H5.js.map +1 -1
  89. package/lib/module/components/typography/H6.js +3 -5
  90. package/lib/module/components/typography/H6.js.map +1 -1
  91. package/lib/module/components/typography/Hero.js +3 -5
  92. package/lib/module/components/typography/Hero.js.map +1 -1
  93. package/lib/module/components/typography/IOText.js +16 -15
  94. package/lib/module/components/typography/IOText.js.map +1 -1
  95. package/lib/module/components/typography/LabelMini.js +7 -5
  96. package/lib/module/components/typography/LabelMini.js.map +1 -1
  97. package/lib/module/components/typography/markdown/MdH1.js +3 -5
  98. package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
  99. package/lib/module/components/typography/markdown/MdH2.js +3 -5
  100. package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
  101. package/lib/module/components/typography/markdown/MdH3.js +3 -5
  102. package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
  103. package/lib/module/context/IOThemeContextProvider.js +3 -4
  104. package/lib/module/context/IOThemeContextProvider.js.map +1 -1
  105. package/lib/typescript/components/alert/Alert.d.ts +3 -1
  106. package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
  107. package/lib/typescript/components/banner/Banner.d.ts +3 -1
  108. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  109. package/lib/typescript/components/buttons/IOButton/IOButton.d.ts +3 -2
  110. package/lib/typescript/components/buttons/IOButton/IOButton.d.ts.map +1 -1
  111. package/lib/typescript/components/layout/ContentWrapper.d.ts +10 -6
  112. package/lib/typescript/components/layout/ContentWrapper.d.ts.map +1 -1
  113. package/lib/typescript/components/otpInput/OTPInput.d.ts +3 -1
  114. package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
  115. package/lib/typescript/components/searchInput/SearchInput.d.ts +3 -1
  116. package/lib/typescript/components/searchInput/SearchInput.d.ts.map +1 -1
  117. package/lib/typescript/components/tabs/TabItem.d.ts +3 -11
  118. package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
  119. package/lib/typescript/components/textInput/TextInputValidation.d.ts +7 -24
  120. package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
  121. package/lib/typescript/components/typography/Body.d.ts +4 -2
  122. package/lib/typescript/components/typography/Body.d.ts.map +1 -1
  123. package/lib/typescript/components/typography/BodyMonospace.d.ts +2 -8
  124. package/lib/typescript/components/typography/BodyMonospace.d.ts.map +1 -1
  125. package/lib/typescript/components/typography/BodySmall.d.ts +4 -2
  126. package/lib/typescript/components/typography/BodySmall.d.ts.map +1 -1
  127. package/lib/typescript/components/typography/ButtonText.d.ts +2 -8
  128. package/lib/typescript/components/typography/ButtonText.d.ts.map +1 -1
  129. package/lib/typescript/components/typography/Caption.d.ts +2 -8
  130. package/lib/typescript/components/typography/Caption.d.ts.map +1 -1
  131. package/lib/typescript/components/typography/H1.d.ts +2 -8
  132. package/lib/typescript/components/typography/H1.d.ts.map +1 -1
  133. package/lib/typescript/components/typography/H2.d.ts +6 -10
  134. package/lib/typescript/components/typography/H2.d.ts.map +1 -1
  135. package/lib/typescript/components/typography/H3.d.ts +2 -8
  136. package/lib/typescript/components/typography/H3.d.ts.map +1 -1
  137. package/lib/typescript/components/typography/H4.d.ts +2 -8
  138. package/lib/typescript/components/typography/H4.d.ts.map +1 -1
  139. package/lib/typescript/components/typography/H5.d.ts +2 -8
  140. package/lib/typescript/components/typography/H5.d.ts.map +1 -1
  141. package/lib/typescript/components/typography/H6.d.ts +2 -8
  142. package/lib/typescript/components/typography/H6.d.ts.map +1 -1
  143. package/lib/typescript/components/typography/Hero.d.ts +2 -8
  144. package/lib/typescript/components/typography/Hero.d.ts.map +1 -1
  145. package/lib/typescript/components/typography/IOText.d.ts +5 -5
  146. package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
  147. package/lib/typescript/components/typography/LabelMini.d.ts +4 -2
  148. package/lib/typescript/components/typography/LabelMini.d.ts.map +1 -1
  149. package/lib/typescript/components/typography/markdown/MdH1.d.ts +2 -8
  150. package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
  151. package/lib/typescript/components/typography/markdown/MdH2.d.ts +2 -8
  152. package/lib/typescript/components/typography/markdown/MdH2.d.ts.map +1 -1
  153. package/lib/typescript/components/typography/markdown/MdH3.d.ts +2 -8
  154. package/lib/typescript/components/typography/markdown/MdH3.d.ts.map +1 -1
  155. package/lib/typescript/context/IOThemeContextProvider.d.ts.map +1 -1
  156. package/package.json +6 -7
  157. package/src/components/alert/Alert.tsx +108 -112
  158. package/src/components/banner/Banner.tsx +121 -125
  159. package/src/components/buttons/IOButton/IOButton.tsx +204 -216
  160. package/src/components/layout/ContentWrapper.tsx +21 -24
  161. package/src/components/otpInput/OTPInput.tsx +156 -167
  162. package/src/components/searchInput/SearchInput.tsx +208 -217
  163. package/src/components/tabs/TabItem.tsx +143 -146
  164. package/src/components/textInput/TextInputValidation.tsx +116 -122
  165. package/src/components/typography/Body.tsx +51 -52
  166. package/src/components/typography/BodyMonospace.tsx +19 -24
  167. package/src/components/typography/BodySmall.tsx +51 -52
  168. package/src/components/typography/ButtonText.tsx +14 -20
  169. package/src/components/typography/Caption.tsx +18 -23
  170. package/src/components/typography/H1.tsx +12 -20
  171. package/src/components/typography/H2.tsx +16 -23
  172. package/src/components/typography/H3.tsx +12 -20
  173. package/src/components/typography/H4.tsx +12 -20
  174. package/src/components/typography/H5.tsx +16 -24
  175. package/src/components/typography/H6.tsx +13 -21
  176. package/src/components/typography/Hero.tsx +14 -19
  177. package/src/components/typography/IOText.tsx +54 -59
  178. package/src/components/typography/LabelMini.tsx +45 -49
  179. package/src/components/typography/markdown/MdH1.tsx +14 -19
  180. package/src/components/typography/markdown/MdH2.tsx +14 -19
  181. package/src/components/typography/markdown/MdH3.tsx +14 -19
  182. 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 = forwardRef<View, TypographicStyleProps>(
14
- ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
15
- const theme = useIOTheme();
11
+ export const Hero = ({
12
+ color: customColor,
13
+ ...props
14
+ }: TypographicStyleProps) => {
15
+ const theme = useIOTheme();
16
16
 
17
- const HeroProps: IOTextProps = {
18
- ...props,
19
- weight: "Semibold",
20
- size: 32,
21
- lineHeight: 48,
22
- color: customColor ?? theme["textHeading-default"]
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
- return (
26
- <IOText ref={ref} {...HeroProps}>
27
- {props.children}
28
- </IOText>
29
- );
30
- }
31
- );
25
+ return <IOText {...HeroProps}>{props.children}</IOText>;
26
+ };
@@ -1,11 +1,10 @@
1
- import { ComponentProps, forwardRef, useMemo } from "react";
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<ComponentProps<typeof Text>, "style">;
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 = forwardRef<View, IOTextProps>(
92
- (
93
- {
94
- color,
95
- size,
96
- font,
97
- lineHeight,
98
- weight,
99
- fontStyle,
100
- textStyle,
101
- style,
102
- children,
103
- allowFontScaling = true,
104
- maxFontSizeMultiplier,
105
- ...props
106
- },
107
- ref
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
- const computedFont =
113
- font || (newTypefaceEnabled ? "Titillio" : "TitilliumSansPro");
108
+ const computedFont =
109
+ font || (newTypefaceEnabled ? "Titillio" : "TitilliumSansPro");
114
110
 
115
- const computedStyleObj = useMemo(
116
- () =>
117
- calculateTextStyle(
118
- color,
119
- size,
120
- computedFont,
121
- lineHeight,
122
- weight,
123
- fontStyle,
124
- boldEnabled
125
- ),
126
- [color, size, computedFont, lineHeight, weight, fontStyle, boldEnabled]
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
- /* In some cases, for example when we use color transitions with
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
- const fontStyleObj = style?.color
136
- ? [{ ...computedStyleObj, color: style?.color }]
137
- : computedStyleObj;
131
+ const fontStyleObj = style?.color
132
+ ? [{ ...computedStyleObj, color: style?.color }]
133
+ : computedStyleObj;
138
134
 
139
- /* Some typographic styles like `H5` have certain `TextStyle` properties
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
- const styleObj = style
147
- ? [textStyle ?? {}, fontStyleObj ?? {}, style]
148
- : [textStyle ?? {}, fontStyleObj ?? {}];
142
+ const styleObj = style
143
+ ? [textStyle ?? {}, fontStyleObj ?? {}, style]
144
+ : [textStyle ?? {}, fontStyleObj ?? {}];
149
145
 
150
- /* Accessible typography based on the `fontScale` parameter */
151
- const accessibleFontSizeProps: ComponentProps<typeof Text> = {
152
- allowFontScaling,
153
- maxFontSizeMultiplier: maxFontSizeMultiplier ?? IOMaxFontSizeMultiplier
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
- return (
157
- <Text ref={ref} style={styleObj} {...props} {...accessibleFontSizeProps}>
158
- {children}
159
- </Text>
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 { ForwardedRef, forwardRef } from "react";
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 = forwardRef<View, LabelMiniProps>(
20
- (
21
- {
22
- weight: customWeight,
23
- color: customColor,
24
- asLink,
25
- accessibilityRole = "link",
26
- textStyle: customTextStyle,
27
- onPress,
28
- ...props
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
- const defaultColor = asLink
35
- ? theme["interactiveElem-default"]
36
- : theme["textBody-tertiary"];
32
+ const defaultColor = asLink
33
+ ? theme["interactiveElem-default"]
34
+ : theme["textBody-tertiary"];
37
35
 
38
- const LabelMiniProps: IOTextProps = {
39
- ...props,
40
- dynamicTypeRamp: "footnote" /* iOS only */,
41
- weight: customWeight || "Semibold",
42
- size: 12,
43
- lineHeight: 18,
44
- color: customColor ?? defaultColor,
45
- ...(asLink
46
- ? {
47
- accessibilityRole,
48
- textStyle: customTextStyle ?? { textDecorationLine: "underline" }
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
- <IOText ref={ref} {...LabelMiniProps}>
67
- {props.children}
68
- </IOText>
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 = forwardRef<View, TypographicStyleProps>(
10
- ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
11
- const theme = useIOTheme();
7
+ export const MdH1 = ({
8
+ color: customColor,
9
+ ...props
10
+ }: TypographicStyleProps) => {
11
+ const theme = useIOTheme();
12
12
 
13
- const MdH1Props: IOTextProps = {
14
- ...props,
15
- weight: "Semibold",
16
- size: 20,
17
- lineHeight: 24,
18
- color: customColor ?? theme["textHeading-default"]
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
- return (
22
- <IOText ref={ref} {...MdH1Props}>
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 = forwardRef<View, TypographicStyleProps>(
10
- ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
11
- const theme = useIOTheme();
7
+ export const MdH2 = ({
8
+ color: customColor,
9
+ ...props
10
+ }: TypographicStyleProps) => {
11
+ const theme = useIOTheme();
12
12
 
13
- const MdH2Props: IOTextProps = {
14
- ...props,
15
- weight: "Semibold",
16
- size: 18,
17
- lineHeight: 24,
18
- color: customColor ?? theme["textHeading-default"]
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
- return (
22
- <IOText ref={ref} {...MdH2Props}>
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 = forwardRef<View, TypographicStyleProps>(
10
- ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
11
- const theme = useIOTheme();
7
+ export const MdH3 = ({
8
+ color: customColor,
9
+ ...props
10
+ }: TypographicStyleProps) => {
11
+ const theme = useIOTheme();
12
12
 
13
- const MdH3Props: IOTextProps = {
14
- ...props,
15
- weight: "Semibold",
16
- size: 16,
17
- lineHeight: 24,
18
- color: customColor ?? theme["textHeading-default"]
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
- return (
22
- <IOText ref={ref} {...MdH3Props}>
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() ?? "unspecified",
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 ?? "unspecified"
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: resolvedTheme === "dark" ? IOThemes.dark : IOThemes.light,
52
+ theme: IOThemes[currentTheme ?? "light"],
61
53
  setTheme: handleThemeChange
62
54
  }}
63
55
  >