@pagopa/io-app-design-system 6.0.5 → 6.0.7

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 (183) hide show
  1. package/lib/commonjs/components/badge/Badge.js +0 -4
  2. package/lib/commonjs/components/badge/Badge.js.map +1 -1
  3. package/lib/commonjs/components/banner/Banner.js +0 -4
  4. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  5. package/lib/commonjs/components/buttons/IOButton/IOButton.js +0 -5
  6. package/lib/commonjs/components/buttons/IOButton/IOButton.js.map +1 -1
  7. package/lib/commonjs/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +3 -3
  8. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -6
  9. package/lib/commonjs/components/headers/HeaderSecondLevel.js +0 -4
  10. package/lib/commonjs/components/headers/HeaderSecondLevel.js.map +1 -1
  11. package/lib/commonjs/components/modules/ModuleIDP.js +0 -4
  12. package/lib/commonjs/components/modules/ModuleIDP.js.map +1 -1
  13. package/lib/commonjs/components/numberpad/NumberButton.js +0 -4
  14. package/lib/commonjs/components/numberpad/NumberButton.js.map +1 -1
  15. package/lib/commonjs/components/otpInput/OTPInput.js +41 -26
  16. package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
  17. package/lib/commonjs/components/searchInput/SearchInput.js +0 -1
  18. package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
  19. package/lib/commonjs/components/tabs/TabItem.js +0 -4
  20. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  21. package/lib/commonjs/components/tag/Tag.js +0 -4
  22. package/lib/commonjs/components/tag/Tag.js.map +1 -1
  23. package/lib/commonjs/components/toast/ToastProvider.js +3 -3
  24. package/lib/commonjs/components/toast/ToastProvider.js.map +1 -1
  25. package/lib/commonjs/components/tooltip/Tooltip.js +3 -3
  26. package/lib/commonjs/components/tooltip/Tooltip.js.map +1 -1
  27. package/lib/commonjs/components/typography/Body.js +1 -7
  28. package/lib/commonjs/components/typography/Body.js.map +1 -1
  29. package/lib/commonjs/components/typography/BodySmall.js +0 -7
  30. package/lib/commonjs/components/typography/BodySmall.js.map +1 -1
  31. package/lib/commonjs/components/typography/ButtonText.js +0 -7
  32. package/lib/commonjs/components/typography/ButtonText.js.map +1 -1
  33. package/lib/commonjs/components/typography/Caption.js +0 -4
  34. package/lib/commonjs/components/typography/Caption.js.map +1 -1
  35. package/lib/commonjs/components/typography/H1.js +0 -4
  36. package/lib/commonjs/components/typography/H1.js.map +1 -1
  37. package/lib/commonjs/components/typography/H2.js +0 -4
  38. package/lib/commonjs/components/typography/H2.js.map +1 -1
  39. package/lib/commonjs/components/typography/H3.js +0 -4
  40. package/lib/commonjs/components/typography/H3.js.map +1 -1
  41. package/lib/commonjs/components/typography/H4.js +0 -4
  42. package/lib/commonjs/components/typography/H4.js.map +1 -1
  43. package/lib/commonjs/components/typography/H5.js +0 -4
  44. package/lib/commonjs/components/typography/H5.js.map +1 -1
  45. package/lib/commonjs/components/typography/H6.js +0 -1
  46. package/lib/commonjs/components/typography/H6.js.map +1 -1
  47. package/lib/commonjs/components/typography/Hero.js +0 -4
  48. package/lib/commonjs/components/typography/Hero.js.map +1 -1
  49. package/lib/commonjs/components/typography/IOText.js +6 -3
  50. package/lib/commonjs/components/typography/IOText.js.map +1 -1
  51. package/lib/commonjs/components/typography/LabelMini.js +1 -8
  52. package/lib/commonjs/components/typography/LabelMini.js.map +1 -1
  53. package/lib/commonjs/components/typography/markdown/MdH1.js +0 -4
  54. package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
  55. package/lib/commonjs/components/typography/markdown/MdH2.js +0 -4
  56. package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
  57. package/lib/commonjs/components/typography/markdown/MdH3.js +0 -4
  58. package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
  59. package/lib/commonjs/utils/throttle.js +19 -0
  60. package/lib/commonjs/utils/throttle.js.map +1 -0
  61. package/lib/module/components/badge/Badge.js +1 -5
  62. package/lib/module/components/badge/Badge.js.map +1 -1
  63. package/lib/module/components/banner/Banner.js +1 -5
  64. package/lib/module/components/banner/Banner.js.map +1 -1
  65. package/lib/module/components/buttons/IOButton/IOButton.js +0 -5
  66. package/lib/module/components/buttons/IOButton/IOButton.js.map +1 -1
  67. package/lib/module/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +3 -3
  68. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -6
  69. package/lib/module/components/headers/HeaderSecondLevel.js +1 -5
  70. package/lib/module/components/headers/HeaderSecondLevel.js.map +1 -1
  71. package/lib/module/components/modules/ModuleIDP.js +1 -5
  72. package/lib/module/components/modules/ModuleIDP.js.map +1 -1
  73. package/lib/module/components/numberpad/NumberButton.js +1 -5
  74. package/lib/module/components/numberpad/NumberButton.js.map +1 -1
  75. package/lib/module/components/otpInput/OTPInput.js +42 -27
  76. package/lib/module/components/otpInput/OTPInput.js.map +1 -1
  77. package/lib/module/components/searchInput/SearchInput.js +0 -1
  78. package/lib/module/components/searchInput/SearchInput.js.map +1 -1
  79. package/lib/module/components/tabs/TabItem.js +1 -5
  80. package/lib/module/components/tabs/TabItem.js.map +1 -1
  81. package/lib/module/components/tag/Tag.js +1 -5
  82. package/lib/module/components/tag/Tag.js.map +1 -1
  83. package/lib/module/components/toast/ToastProvider.js +1 -1
  84. package/lib/module/components/toast/ToastProvider.js.map +1 -1
  85. package/lib/module/components/tooltip/Tooltip.js +3 -3
  86. package/lib/module/components/tooltip/Tooltip.js.map +1 -1
  87. package/lib/module/components/typography/Body.js +2 -8
  88. package/lib/module/components/typography/Body.js.map +1 -1
  89. package/lib/module/components/typography/BodySmall.js +1 -8
  90. package/lib/module/components/typography/BodySmall.js.map +1 -1
  91. package/lib/module/components/typography/ButtonText.js +0 -7
  92. package/lib/module/components/typography/ButtonText.js.map +1 -1
  93. package/lib/module/components/typography/Caption.js +1 -5
  94. package/lib/module/components/typography/Caption.js.map +1 -1
  95. package/lib/module/components/typography/H1.js +1 -5
  96. package/lib/module/components/typography/H1.js.map +1 -1
  97. package/lib/module/components/typography/H2.js +1 -5
  98. package/lib/module/components/typography/H2.js.map +1 -1
  99. package/lib/module/components/typography/H3.js +1 -5
  100. package/lib/module/components/typography/H3.js.map +1 -1
  101. package/lib/module/components/typography/H4.js +1 -5
  102. package/lib/module/components/typography/H4.js.map +1 -1
  103. package/lib/module/components/typography/H5.js +1 -5
  104. package/lib/module/components/typography/H5.js.map +1 -1
  105. package/lib/module/components/typography/H6.js +0 -1
  106. package/lib/module/components/typography/H6.js.map +1 -1
  107. package/lib/module/components/typography/Hero.js +1 -5
  108. package/lib/module/components/typography/Hero.js.map +1 -1
  109. package/lib/module/components/typography/IOText.js +7 -4
  110. package/lib/module/components/typography/IOText.js.map +1 -1
  111. package/lib/module/components/typography/LabelMini.js +2 -9
  112. package/lib/module/components/typography/LabelMini.js.map +1 -1
  113. package/lib/module/components/typography/markdown/MdH1.js +1 -5
  114. package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
  115. package/lib/module/components/typography/markdown/MdH2.js +1 -5
  116. package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
  117. package/lib/module/components/typography/markdown/MdH3.js +1 -5
  118. package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
  119. package/lib/module/utils/throttle.js +14 -0
  120. package/lib/module/utils/throttle.js.map +1 -0
  121. package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
  122. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  123. package/lib/typescript/components/buttons/IOButton/IOButton.d.ts.map +1 -1
  124. package/lib/typescript/components/headers/HeaderSecondLevel.d.ts.map +1 -1
  125. package/lib/typescript/components/modules/ModuleIDP.d.ts.map +1 -1
  126. package/lib/typescript/components/numberpad/NumberButton.d.ts.map +1 -1
  127. package/lib/typescript/components/otpInput/OTPInput.d.ts +4 -0
  128. package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
  129. package/lib/typescript/components/searchInput/SearchInput.d.ts.map +1 -1
  130. package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
  131. package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
  132. package/lib/typescript/components/toast/ToastProvider.d.ts.map +1 -1
  133. package/lib/typescript/components/tooltip/Tooltip.d.ts.map +1 -1
  134. package/lib/typescript/components/typography/Body.d.ts.map +1 -1
  135. package/lib/typescript/components/typography/BodySmall.d.ts.map +1 -1
  136. package/lib/typescript/components/typography/ButtonText.d.ts.map +1 -1
  137. package/lib/typescript/components/typography/Caption.d.ts.map +1 -1
  138. package/lib/typescript/components/typography/H1.d.ts.map +1 -1
  139. package/lib/typescript/components/typography/H2.d.ts.map +1 -1
  140. package/lib/typescript/components/typography/H3.d.ts.map +1 -1
  141. package/lib/typescript/components/typography/H4.d.ts.map +1 -1
  142. package/lib/typescript/components/typography/H5.d.ts.map +1 -1
  143. package/lib/typescript/components/typography/H6.d.ts.map +1 -1
  144. package/lib/typescript/components/typography/Hero.d.ts.map +1 -1
  145. package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
  146. package/lib/typescript/components/typography/LabelMini.d.ts.map +1 -1
  147. package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
  148. package/lib/typescript/components/typography/markdown/MdH2.d.ts.map +1 -1
  149. package/lib/typescript/components/typography/markdown/MdH3.d.ts.map +1 -1
  150. package/lib/typescript/utils/throttle.d.ts +2 -0
  151. package/lib/typescript/utils/throttle.d.ts.map +1 -0
  152. package/package.json +1 -3
  153. package/src/components/badge/Badge.tsx +1 -3
  154. package/src/components/banner/Banner.tsx +1 -3
  155. package/src/components/buttons/IOButton/IOButton.tsx +0 -3
  156. package/src/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +3 -3
  157. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -6
  158. package/src/components/headers/HeaderSecondLevel.tsx +1 -4
  159. package/src/components/modules/ModuleIDP.tsx +1 -3
  160. package/src/components/numberpad/NumberButton.tsx +1 -3
  161. package/src/components/otpInput/OTPInput.tsx +57 -32
  162. package/src/components/searchInput/SearchInput.tsx +0 -1
  163. package/src/components/tabs/TabItem.tsx +2 -8
  164. package/src/components/tag/Tag.tsx +1 -3
  165. package/src/components/toast/ToastProvider.tsx +1 -1
  166. package/src/components/tooltip/Tooltip.tsx +4 -3
  167. package/src/components/typography/Body.tsx +3 -8
  168. package/src/components/typography/BodySmall.tsx +2 -7
  169. package/src/components/typography/ButtonText.tsx +2 -7
  170. package/src/components/typography/Caption.tsx +1 -3
  171. package/src/components/typography/H1.tsx +1 -3
  172. package/src/components/typography/H2.tsx +1 -3
  173. package/src/components/typography/H3.tsx +1 -3
  174. package/src/components/typography/H4.tsx +1 -3
  175. package/src/components/typography/H5.tsx +1 -3
  176. package/src/components/typography/H6.tsx +0 -1
  177. package/src/components/typography/Hero.tsx +1 -3
  178. package/src/components/typography/IOText.tsx +10 -7
  179. package/src/components/typography/LabelMini.tsx +3 -8
  180. package/src/components/typography/markdown/MdH1.tsx +1 -3
  181. package/src/components/typography/markdown/MdH2.tsx +1 -3
  182. package/src/components/typography/markdown/MdH3.tsx +1 -3
  183. package/src/utils/throttle.ts +15 -0
@@ -8,10 +8,11 @@ import {
8
8
  } from "react";
9
9
  import {
10
10
  AccessibilityInfo,
11
- NativeSyntheticEvent,
11
+ Platform,
12
12
  Pressable,
13
+ StyleSheet,
13
14
  TextInput,
14
- TextInputKeyPressEventData,
15
+ TextInputKeyPressEvent,
15
16
  View
16
17
  } from "react-native";
17
18
  import Animated from "react-native-reanimated";
@@ -35,6 +36,10 @@ type Props = {
35
36
  accessibilityLabel?: string;
36
37
  deleteButtonAccessibilityLabel?: string;
37
38
  accessibilityHint?: string;
39
+ accessibilityValueText?: (params: {
40
+ valueLength: number;
41
+ length: number;
42
+ }) => string;
38
43
  inputAccessoryViewID?: string;
39
44
  autoFocus?: boolean;
40
45
  };
@@ -60,6 +65,7 @@ export const OTPInput = forwardRef<View, Props>(
60
65
  length,
61
66
  accessibilityLabel,
62
67
  accessibilityHint,
68
+ accessibilityValueText,
63
69
  onValidate,
64
70
  errorMessage = "",
65
71
  secret = false,
@@ -120,10 +126,8 @@ export const OTPInput = forwardRef<View, Props>(
120
126
  handleValidate(value);
121
127
  };
122
128
 
123
- const handleKeyPress = ({
124
- nativeEvent
125
- }: NativeSyntheticEvent<TextInputKeyPressEventData>) => {
126
- switch (nativeEvent.key) {
129
+ const handleKeyPress = (e: TextInputKeyPressEvent) => {
130
+ switch (e.nativeEvent.key) {
127
131
  case "Backspace":
128
132
  if (deleteButtonAccessibilityLabel && value.length > 0) {
129
133
  AccessibilityInfo.announceForAccessibility(
@@ -132,7 +136,7 @@ export const OTPInput = forwardRef<View, Props>(
132
136
  }
133
137
  break;
134
138
  default:
135
- AccessibilityInfo.announceForAccessibility(nativeEvent.key);
139
+ AccessibilityInfo.announceForAccessibility(e.nativeEvent.key);
136
140
  break;
137
141
  }
138
142
  };
@@ -147,21 +151,20 @@ export const OTPInput = forwardRef<View, Props>(
147
151
  setHasFocus(true);
148
152
  }}
149
153
  ref={ref}
150
- style={{
151
- flexDirection: "row",
152
- justifyContent: "space-between",
153
- columnGap: OTP_ITEMS_GAP
154
- }}
155
- accessible={true}
156
- accessibilityLabel={accessibilityLabel}
157
- accessibilityHint={accessibilityHint}
158
- accessibilityValue={{ text: value }}
154
+ accessible={false}
159
155
  >
160
156
  <TextInput
161
157
  value={value}
162
158
  onChangeText={handleChange}
163
159
  onKeyPress={handleKeyPress}
164
- style={{ position: "absolute", opacity: 0 }}
160
+ caretHidden={Platform.OS === "ios"}
161
+ style={[
162
+ StyleSheet.absoluteFillObject,
163
+ Platform.select({
164
+ ios: { opacity: 0.01 },
165
+ android: { opacity: 0 }
166
+ })
167
+ ]}
165
168
  maxLength={length}
166
169
  ref={inputRef}
167
170
  onBlur={() => setHasFocus(false)}
@@ -172,23 +175,45 @@ export const OTPInput = forwardRef<View, Props>(
172
175
  autoComplete={autocomplete ? "sms-otp" : undefined}
173
176
  inputAccessoryViewID={inputAccessoryViewID}
174
177
  accessible={true}
178
+ accessibilityLabel={accessibilityLabel}
179
+ accessibilityHint={accessibilityHint}
180
+ // Ensure the screen reader pronounces the code digit by digit
181
+ accessibilityValue={{
182
+ text:
183
+ accessibilityValueText?.({
184
+ valueLength: value.length,
185
+ length
186
+ }) ?? value.split("").join(" ")
187
+ }}
175
188
  autoFocus={autoFocus}
176
- secureTextEntry={true}
189
+ secureTextEntry={secret}
177
190
  />
178
- {cells.map((_, i) => (
179
- <BoxedInput
180
- key={i}
181
- status={
182
- hasError
183
- ? "error"
184
- : hasFocus && value.length === i
185
- ? "focus"
186
- : "default"
187
- }
188
- secret={secret}
189
- value={value[i]}
190
- />
191
- ))}
191
+ <View
192
+ style={{
193
+ flexDirection: "row",
194
+ justifyContent: "space-between",
195
+ columnGap: OTP_ITEMS_GAP,
196
+ flexGrow: 1,
197
+ zIndex: 10
198
+ }}
199
+ accessibilityElementsHidden={true}
200
+ importantForAccessibility="no-hide-descendants"
201
+ >
202
+ {cells.map((_, i) => (
203
+ <BoxedInput
204
+ key={i}
205
+ status={
206
+ hasError
207
+ ? "error"
208
+ : hasFocus && value.length === i
209
+ ? "focus"
210
+ : "default"
211
+ }
212
+ secret={secret}
213
+ value={value[i]}
214
+ />
215
+ ))}
216
+ </View>
192
217
  </Pressable>
193
218
  <VSpacer size={4} />
194
219
  {hasError && errorMessage && (
@@ -307,7 +307,6 @@ export const SearchInput = forwardRef<SearchInputRef, SearchInputProps>(
307
307
  >
308
308
  <IOText
309
309
  color={theme["interactiveElem-default"]}
310
- font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
311
310
  weight={"Semibold"}
312
311
  size={buttonTextFontSize}
313
312
  lineHeight={buttonTextLineHeight}
@@ -13,7 +13,7 @@ import Animated, {
13
13
  useReducedMotion,
14
14
  withSpring
15
15
  } from "react-native-reanimated";
16
- import { useIONewTypeface, useIOTheme } from "../../context";
16
+ import { useIOTheme } from "../../context";
17
17
  import { IOColors, IOSpringValues, hexToRgba } from "../../core";
18
18
  import { useScaleAnimation } from "../../hooks";
19
19
  import { WithTestID } from "../../utils/types";
@@ -77,7 +77,6 @@ const TabItem = forwardRef(
77
77
  useScaleAnimation("medium");
78
78
  const theme = useIOTheme();
79
79
  const reducedMotion = useReducedMotion();
80
- const { newTypefaceEnabled } = useIONewTypeface();
81
80
 
82
81
  const mapColorStates: Record<
83
82
  NonNullable<TabItem["color"]>,
@@ -199,12 +198,7 @@ const TabItem = forwardRef(
199
198
  {activeIcon && (
200
199
  <Icon name={activeIcon} color={foregroundColor} size={16} />
201
200
  )}
202
- <IOText
203
- size={14}
204
- font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
205
- weight="Semibold"
206
- color={foregroundColor}
207
- >
201
+ <IOText size={14} weight="Semibold" color={foregroundColor}>
208
202
  {label}
209
203
  </IOText>
210
204
  </Animated.View>
@@ -1,5 +1,5 @@
1
1
  import { Platform, StyleSheet, View, ViewStyle } from "react-native";
2
- import { useIONewTypeface, useIOTheme } from "../../context";
2
+ import { useIOTheme } from "../../context";
3
3
  import {
4
4
  IOColors,
5
5
  IOSpacingScale,
@@ -155,7 +155,6 @@ export const Tag = ({
155
155
  forceLightMode = false
156
156
  }: Tag) => {
157
157
  const theme = useIOTheme();
158
- const { newTypefaceEnabled } = useIONewTypeface();
159
158
  const { dynamicFontScale, spacingScaleMultiplier } = useIOFontDynamicScale();
160
159
 
161
160
  const variantProps = getVariantProps(variant, icon);
@@ -203,7 +202,6 @@ export const Tag = ({
203
202
  {text && (
204
203
  <IOText
205
204
  allowFontScaling={allowFontScaling}
206
- font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
207
205
  weight={"Semibold"}
208
206
  size={12}
209
207
  lineHeight={16}
@@ -1,4 +1,3 @@
1
- import { throttle } from "lodash";
2
1
  import { ReactNode, useCallback, useMemo, useRef, useState } from "react";
3
2
  import { AccessibilityInfo, StyleSheet, View } from "react-native";
4
3
  import Animated, {
@@ -10,6 +9,7 @@ import Animated, {
10
9
  import { SafeAreaView } from "react-native-safe-area-context";
11
10
  import { IOVisualCostants } from "../../core";
12
11
  import { triggerHaptic } from "../../functions";
12
+ import { throttle } from "../../utils/throttle";
13
13
  import { Dismissable } from "../templates";
14
14
  import { ToastNotification } from "./ToastNotification";
15
15
  import { ToastContext } from "./context";
@@ -1,4 +1,3 @@
1
- import { every, some } from "lodash";
2
1
  import {
3
2
  JSXElementConstructor,
4
3
  PropsWithChildren,
@@ -194,8 +193,10 @@ export const Tooltip = ({
194
193
  () => ARROWS_BY_PLACEMENT[currentPlacement],
195
194
  [currentPlacement]
196
195
  );
196
+ const childrenCoordsValues = Object.values(childrenCoords);
197
197
  const isChildrenMeasurementFinished =
198
- every(childrenCoords, isDefined) && some(childrenCoords, isNotZero);
198
+ childrenCoordsValues.every(isDefined) &&
199
+ childrenCoordsValues.some(isNotZero);
199
200
  const isTooltipMeasurementCompleted = isDefined(tooltipLayout);
200
201
  const tooltipVisibility = { opacity: isTooltipMeasurementCompleted ? 1 : 0 };
201
202
 
@@ -211,7 +212,7 @@ export const Tooltip = ({
211
212
  width,
212
213
  height
213
214
  };
214
- if (every(coords, isDefined)) {
215
+ if (Object.values(coords).every(isDefined)) {
215
216
  setChildrenCoords(coords);
216
217
  }
217
218
  });
@@ -1,7 +1,7 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { Pressable, View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
4
- import { IOFontFamily, IOFontWeight } from "../../utils/fonts";
3
+ import { useIOTheme } from "../../context";
4
+ import { IOFontWeight } from "../../utils/fonts";
5
5
  import {
6
6
  IOText,
7
7
  IOTextProps,
@@ -16,9 +16,6 @@ type BodyStyleProps = TypographicStyleProps & {
16
16
  export const bodyFontSize = 16;
17
17
  export const bodyLineHeight = 24;
18
18
 
19
- const fontName: IOFontFamily = "Titillio";
20
- const legacyFontName: IOFontFamily = "TitilliumSansPro";
21
-
22
19
  /**
23
20
  * `Body` typographic style
24
21
  */
@@ -37,7 +34,6 @@ export const Body = forwardRef<View, BodyStyleProps>(
37
34
  ref?: ForwardedRef<View>
38
35
  ) => {
39
36
  const theme = useIOTheme();
40
- const { newTypefaceEnabled } = useIONewTypeface();
41
37
 
42
38
  const defaultColor = asLink
43
39
  ? theme["interactiveElem-default"]
@@ -46,8 +42,7 @@ export const Body = forwardRef<View, BodyStyleProps>(
46
42
  const BodyProps: IOTextProps = {
47
43
  ...props,
48
44
  dynamicTypeRamp: "body", // iOS only
49
- font: newTypefaceEnabled ? fontName : legacyFontName,
50
- weight: customWeight ? customWeight : "Regular",
45
+ weight: customWeight || "Regular",
51
46
  size: bodyFontSize,
52
47
  lineHeight: bodyLineHeight,
53
48
  color: customColor ?? defaultColor,
@@ -1,7 +1,7 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { Pressable, View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
4
- import { IOFontFamily, IOFontWeight } from "../../utils/fonts";
3
+ import { useIOTheme } from "../../context";
4
+ import { IOFontWeight } from "../../utils/fonts";
5
5
  import {
6
6
  IOText,
7
7
  IOTextProps,
@@ -13,9 +13,6 @@ type BodySmallProps = TypographicStyleProps & {
13
13
  weight?: Extract<IOFontWeight, "Regular" | "Semibold">;
14
14
  } & TypographicStyleAsLinkProps;
15
15
 
16
- const fontName: IOFontFamily = "Titillio";
17
- const legacyFontName: IOFontFamily = "TitilliumSansPro";
18
-
19
16
  /**
20
17
  * `BodySmall` typographic style
21
18
  */
@@ -34,7 +31,6 @@ export const BodySmall = forwardRef<View, BodySmallProps>(
34
31
  ref?: ForwardedRef<View>
35
32
  ) => {
36
33
  const theme = useIOTheme();
37
- const { newTypefaceEnabled } = useIONewTypeface();
38
34
 
39
35
  const defaultColor = asLink
40
36
  ? theme["interactiveElem-default"]
@@ -43,7 +39,6 @@ export const BodySmall = forwardRef<View, BodySmallProps>(
43
39
  const BodySmallProps: IOTextProps = {
44
40
  ...props,
45
41
  dynamicTypeRamp: "footnote" /* iOS only */,
46
- font: newTypefaceEnabled ? fontName : legacyFontName,
47
42
  weight: customWeight ?? "Regular",
48
43
  size: 14,
49
44
  lineHeight: 21,
@@ -1,8 +1,8 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface } from "../../context";
3
+
4
4
  import { IOColors } from "../../core";
5
- import { IOFontFamily, IOFontSize } from "../../utils/fonts";
5
+ import { IOFontSize } from "../../utils/fonts";
6
6
  import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
7
7
 
8
8
  export const buttonTextFontSize: IOFontSize = 16;
@@ -11,19 +11,14 @@ export const buttonTextLineHeight = 20;
11
11
  /* Needed to render `ButtonOutline` and`ButtonLink` because they use
12
12
  `AnimatedText` for color transition through Reanimated */
13
13
  const defaultColor: IOColors = "white";
14
- const fontName: IOFontFamily = "Titillio";
15
- const legacyFontName: IOFontFamily = "TitilliumSansPro";
16
14
 
17
15
  /**
18
16
  * `ButtonText` typographic style
19
17
  */
20
18
  export const ButtonText = forwardRef<View, TypographicStyleProps>(
21
19
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
22
- const { newTypefaceEnabled } = useIONewTypeface();
23
-
24
20
  const ButtonTextProps: IOTextProps = {
25
21
  ...props,
26
- font: newTypefaceEnabled ? fontName : legacyFontName,
27
22
  weight: "Semibold",
28
23
  size: buttonTextFontSize,
29
24
  lineHeight: buttonTextLineHeight,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
3
+ import { useIOTheme } from "../../context";
4
4
  import { IOFontSize } from "../../utils/fonts";
5
5
  import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
6
6
 
@@ -12,12 +12,10 @@ export const captionFontSize: IOFontSize = 12;
12
12
  export const Caption = forwardRef<View, TypographicStyleProps>(
13
13
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
14
14
  const theme = useIOTheme();
15
- const { newTypefaceEnabled } = useIONewTypeface();
16
15
 
17
16
  const CaptionProps: IOTextProps = {
18
17
  ...props,
19
18
  dynamicTypeRamp: "caption1", // iOS only
20
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
21
19
  weight: "Regular",
22
20
  size: captionFontSize,
23
21
  color: customColor ?? theme["textBody-default"],
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
3
+ import { useIOTheme } from "../../context";
4
4
  import { IOFontSize } from "../../utils/fonts";
5
5
  import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
6
6
 
@@ -13,12 +13,10 @@ export const h1LineHeight = 42;
13
13
  export const H1 = forwardRef<View, TypographicStyleProps>(
14
14
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
15
15
  const theme = useIOTheme();
16
- const { newTypefaceEnabled } = useIONewTypeface();
17
16
 
18
17
  const H1Props: IOTextProps = {
19
18
  ...props,
20
19
  dynamicTypeRamp: "largeTitle", // iOS only
21
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
22
20
  weight: "Semibold",
23
21
  size: h1FontSize,
24
22
  lineHeight: h1LineHeight,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
3
+ import { useIOTheme } from "../../context";
4
4
  import { IOFontSize, IOFontWeight } from "../../utils/fonts";
5
5
  import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
6
6
 
@@ -20,12 +20,10 @@ export const H2 = forwardRef<View, H2StyleProps>(
20
20
  ref?: ForwardedRef<View>
21
21
  ) => {
22
22
  const theme = useIOTheme();
23
- const { newTypefaceEnabled } = useIONewTypeface();
24
23
 
25
24
  const H2Props: IOTextProps = {
26
25
  ...props,
27
26
  dynamicTypeRamp: "title1", // iOS only
28
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
29
27
  weight: customWeight ?? "Semibold",
30
28
  size: h2FontSize,
31
29
  lineHeight: h2LineHeight,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
3
+ import { useIOTheme } from "../../context";
4
4
  import { IOFontSize } from "../../utils/fonts";
5
5
  import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
6
6
 
@@ -14,12 +14,10 @@ export const h3LineHeight = 33;
14
14
  export const H3 = forwardRef<View, TypographicStyleProps>(
15
15
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
16
16
  const theme = useIOTheme();
17
- const { newTypefaceEnabled } = useIONewTypeface();
18
17
 
19
18
  const H3Props: IOTextProps = {
20
19
  ...props,
21
20
  dynamicTypeRamp: "title2", // iOS only
22
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
23
21
  weight: "Semibold",
24
22
  size: h3FontSize,
25
23
  lineHeight: h3LineHeight,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
3
+ import { useIOTheme } from "../../context";
4
4
  import { IOFontSize } from "../../utils/fonts";
5
5
  import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
6
6
 
@@ -13,12 +13,10 @@ export const h4LineHeight = 24;
13
13
  export const H4 = forwardRef<View, TypographicStyleProps>(
14
14
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
15
15
  const theme = useIOTheme();
16
- const { newTypefaceEnabled } = useIONewTypeface();
17
16
 
18
17
  const H4Props: IOTextProps = {
19
18
  ...props,
20
19
  dynamicTypeRamp: "title3", // iOS only
21
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
22
20
  weight: "Semibold",
23
21
  size: h4FontSize,
24
22
  lineHeight: h4LineHeight,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
3
+ import { useIOTheme } from "../../context";
4
4
  import { IOFontSize } from "../../utils/fonts";
5
5
  import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
6
6
 
@@ -13,12 +13,10 @@ export const h5LineHeight = 16;
13
13
  export const H5 = forwardRef<View, TypographicStyleProps>(
14
14
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
15
15
  const theme = useIOTheme();
16
- const { newTypefaceEnabled } = useIONewTypeface();
17
16
 
18
17
  const H5Props: IOTextProps = {
19
18
  ...props,
20
19
  dynamicTypeRamp: "subheadline", // iOS only
21
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
22
20
  weight: "Semibold",
23
21
  size: h5FontSize,
24
22
  lineHeight: h5LineHeight,
@@ -21,7 +21,6 @@ export const H6 = forwardRef<View, TypographicStyleProps>(
21
21
  const H6Props: IOTextProps = {
22
22
  ...props,
23
23
  dynamicTypeRamp: "headline", // iOS only
24
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
25
24
  weight: "Semibold",
26
25
  size: newTypefaceEnabled ? h6FontSize : legacyFontSize,
27
26
  lineHeight: h6LineHeight,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
3
+ import { useIOTheme } from "../../context";
4
4
  import { IOFontSize } from "../../utils/fonts";
5
5
  import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
6
6
 
@@ -13,11 +13,9 @@ export const heroLineHeight = 48;
13
13
  export const Hero = forwardRef<View, TypographicStyleProps>(
14
14
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
15
15
  const theme = useIOTheme();
16
- const { newTypefaceEnabled } = useIONewTypeface();
17
16
 
18
17
  const HeroProps: IOTextProps = {
19
18
  ...props,
20
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
21
19
  weight: "Semibold",
22
20
  size: 32,
23
21
  lineHeight: 48,
@@ -8,7 +8,7 @@ import {
8
8
  View
9
9
  } from "react-native";
10
10
  import Animated from "react-native-reanimated";
11
- import { useIOTheme } from "../../context";
11
+ import { useIONewTypeface } from "../../context";
12
12
  import { IOColors } from "../../core";
13
13
  import { useBoldTextEnabled } from "../../utils/accessibility";
14
14
  import {
@@ -74,11 +74,11 @@ export type TypographicStyleAsLinkProps =
74
74
  * @param args the args of the function {@link makeFontStyleObject}
75
75
  */
76
76
  const calculateTextStyle = (
77
- color: IOColors,
77
+ color?: IOColors,
78
78
  ...args: Parameters<typeof makeFontStyleObject>
79
79
  ) => ({
80
80
  ...makeFontStyleObject(...args),
81
- color: IOColors[color]
81
+ color: color ? IOColors[color] : undefined
82
82
  });
83
83
 
84
84
  /**
@@ -106,21 +106,24 @@ export const IOText = forwardRef<View, IOTextProps>(
106
106
  },
107
107
  ref
108
108
  ) => {
109
- const theme = useIOTheme();
110
109
  const boldEnabled = useBoldTextEnabled();
110
+ const { newTypefaceEnabled } = useIONewTypeface();
111
+
112
+ const computedFont =
113
+ font || (newTypefaceEnabled ? "Titillio" : "TitilliumSansPro");
111
114
 
112
115
  const computedStyleObj = useMemo(
113
116
  () =>
114
117
  calculateTextStyle(
115
- color ?? theme["textBody-default"],
118
+ color,
116
119
  size,
117
- font,
120
+ computedFont,
118
121
  lineHeight,
119
122
  weight,
120
123
  fontStyle,
121
124
  boldEnabled
122
125
  ),
123
- [color, theme, size, font, lineHeight, weight, fontStyle, boldEnabled]
126
+ [color, size, computedFont, lineHeight, weight, fontStyle, boldEnabled]
124
127
  );
125
128
 
126
129
  /* In some cases, for example when we use color transitions with
@@ -1,7 +1,7 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { Pressable, View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../context";
4
- import { IOFontFamily, IOFontWeight } from "../../utils/fonts";
3
+ import { useIOTheme } from "../../context";
4
+ import { IOFontWeight } from "../../utils/fonts";
5
5
  import {
6
6
  IOText,
7
7
  IOTextProps,
@@ -13,9 +13,6 @@ type LabelMiniProps = TypographicStyleProps & {
13
13
  weight?: Extract<IOFontWeight, "Regular" | "Semibold">;
14
14
  } & TypographicStyleAsLinkProps;
15
15
 
16
- const fontName: IOFontFamily = "Titillio";
17
- const legacyFontName: IOFontFamily = "TitilliumSansPro";
18
-
19
16
  /**
20
17
  * `LabelMini` typographic style
21
18
  */
@@ -33,7 +30,6 @@ export const LabelMini = forwardRef<View, LabelMiniProps>(
33
30
  ref?: ForwardedRef<View>
34
31
  ) => {
35
32
  const theme = useIOTheme();
36
- const { newTypefaceEnabled } = useIONewTypeface();
37
33
 
38
34
  const defaultColor = asLink
39
35
  ? theme["interactiveElem-default"]
@@ -42,8 +38,7 @@ export const LabelMini = forwardRef<View, LabelMiniProps>(
42
38
  const LabelMiniProps: IOTextProps = {
43
39
  ...props,
44
40
  dynamicTypeRamp: "footnote" /* iOS only */,
45
- font: newTypefaceEnabled ? fontName : legacyFontName,
46
- weight: customWeight ? customWeight : "Semibold",
41
+ weight: customWeight || "Semibold",
47
42
  size: 12,
48
43
  lineHeight: 18,
49
44
  color: customColor ?? defaultColor,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../../context";
3
+ import { useIOTheme } from "../../../context";
4
4
  import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
5
5
 
6
6
  /**
@@ -9,11 +9,9 @@ import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
9
9
  export const MdH1 = forwardRef<View, TypographicStyleProps>(
10
10
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
11
11
  const theme = useIOTheme();
12
- const { newTypefaceEnabled } = useIONewTypeface();
13
12
 
14
13
  const MdH1Props: IOTextProps = {
15
14
  ...props,
16
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
17
15
  weight: "Semibold",
18
16
  size: 20,
19
17
  lineHeight: 24,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../../context";
3
+ import { useIOTheme } from "../../../context";
4
4
  import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
5
5
 
6
6
  /**
@@ -9,11 +9,9 @@ import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
9
9
  export const MdH2 = forwardRef<View, TypographicStyleProps>(
10
10
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
11
11
  const theme = useIOTheme();
12
- const { newTypefaceEnabled } = useIONewTypeface();
13
12
 
14
13
  const MdH2Props: IOTextProps = {
15
14
  ...props,
16
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
17
15
  weight: "Semibold",
18
16
  size: 18,
19
17
  lineHeight: 24,
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, forwardRef } from "react";
2
2
  import { View } from "react-native";
3
- import { useIONewTypeface, useIOTheme } from "../../../context";
3
+ import { useIOTheme } from "../../../context";
4
4
  import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
5
5
 
6
6
  /**
@@ -9,11 +9,9 @@ import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
9
9
  export const MdH3 = forwardRef<View, TypographicStyleProps>(
10
10
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
11
11
  const theme = useIOTheme();
12
- const { newTypefaceEnabled } = useIONewTypeface();
13
12
 
14
13
  const MdH3Props: IOTextProps = {
15
14
  ...props,
16
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
17
15
  weight: "Semibold",
18
16
  size: 16,
19
17
  lineHeight: 24,