@jobber/components-native 0.76.1-JOB-116234-d279b0f.20 → 0.76.1-JOB-116234-63c4467.27
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/dist/package.json +2 -2
- package/dist/src/AtlantisThemeContext/AtlantisThemeContext.js +10 -21
- package/dist/src/Flex/Flex.js +2 -3
- package/dist/src/Flex/Flex.styles.js +9 -0
- package/dist/src/InputFieldWrapper/CommonInputStyles.style.js +6 -2
- package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +2 -1
- package/dist/src/InputPressable/InputPressable.style.js +6 -5
- package/dist/src/InputText/InputText.style.js +6 -6
- package/dist/src/Typography/Typography.js +12 -11
- package/dist/src/Typography/Typography.style.js +1 -8
- package/dist/src/utils/design/index.js +5 -2
- package/dist/src/utils/meta/meta.json +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/AtlantisThemeContext/types.d.ts +6 -3
- package/dist/types/src/Button/Button.d.ts +1 -1
- package/dist/types/src/Flex/Flex.styles.d.ts +1 -0
- package/dist/types/src/Text/Text.d.ts +1 -1
- package/dist/types/src/Typography/Typography.style.d.ts +1 -8
- package/dist/types/src/utils/design/index.d.ts +5 -0
- package/package.json +2 -2
- package/src/AtlantisThemeContext/AtlantisThemeContext.test.tsx +106 -0
- package/src/AtlantisThemeContext/AtlantisThemeContext.tsx +12 -54
- package/src/AtlantisThemeContext/buildThemedStyles.test.tsx +83 -0
- package/src/AtlantisThemeContext/types.ts +7 -3
- package/src/Button/Button.tsx +1 -1
- package/src/Flex/Flex.styles.tsx +13 -1
- package/src/Flex/Flex.tsx +2 -3
- package/src/InputFieldWrapper/CommonInputStyles.style.ts +2 -0
- package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +1 -6
- package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +9 -2
- package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +2 -1
- package/src/InputPressable/InputPressable.style.ts +7 -5
- package/src/InputText/InputText.style.ts +7 -6
- package/src/Text/Text.tsx +1 -1
- package/src/Typography/Typography.style.ts +1 -8
- package/src/Typography/Typography.tsx +19 -8
- package/src/utils/design/index.ts +5 -2
- package/src/utils/meta/meta.json +1 -0
- package/dist/src/Flex/Flex.gap.styles.js +0 -9
- package/dist/types/src/Flex/Flex.gap.styles.d.ts +0 -2
- package/src/Flex/Flex.gap.styles.tsx +0 -14
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ViewStyle,
|
|
11
11
|
} from "react-native";
|
|
12
12
|
import { TypographyGestureDetector } from "./TypographyGestureDetector";
|
|
13
|
-
import {
|
|
13
|
+
import { useTypographyStyles } from "./Typography.style";
|
|
14
14
|
import { capitalize } from "../utils/intl";
|
|
15
15
|
import { useAtlantisTheme } from "../AtlantisThemeContext";
|
|
16
16
|
|
|
@@ -161,13 +161,14 @@ function InternalTypography<T extends FontFamily = "base">({
|
|
|
161
161
|
UNSAFE_style,
|
|
162
162
|
selectable = true,
|
|
163
163
|
}: TypographyProps<T>): JSX.Element {
|
|
164
|
-
const
|
|
164
|
+
const styles = useTypographyStyles();
|
|
165
|
+
const sizeAndHeight = getSizeAndHeightStyle(size, styles, lineHeight);
|
|
165
166
|
const style: StyleProp<ViewStyle>[] = [
|
|
166
|
-
getFontStyle(fontFamily, fontStyle, fontWeight),
|
|
167
|
-
getColorStyle(color, reverseTheme),
|
|
168
|
-
getAlignStyle(align),
|
|
167
|
+
getFontStyle(fontFamily, fontStyle, fontWeight, styles),
|
|
168
|
+
getColorStyle(styles, color, reverseTheme),
|
|
169
|
+
getAlignStyle(styles, align),
|
|
169
170
|
sizeAndHeight,
|
|
170
|
-
getLetterSpacingStyle(letterSpacing),
|
|
171
|
+
getLetterSpacingStyle(letterSpacing, styles),
|
|
171
172
|
];
|
|
172
173
|
|
|
173
174
|
if (strikeThrough) {
|
|
@@ -233,6 +234,7 @@ function getFontStyle(
|
|
|
233
234
|
fontFamily: FontFamily = "base",
|
|
234
235
|
fontStyle: FontStyle = "regular",
|
|
235
236
|
fontWeight: FontWeight = "regular",
|
|
237
|
+
styles: Record<string, TextStyle>,
|
|
236
238
|
) {
|
|
237
239
|
const defaultBaseFontStyling = styles.baseRegularRegular;
|
|
238
240
|
const defaultDisplayFontStyling = styles.displayRegularBold;
|
|
@@ -263,7 +265,11 @@ function getTransformedText(text?: string, transform?: TextTransform) {
|
|
|
263
265
|
}
|
|
264
266
|
}
|
|
265
267
|
|
|
266
|
-
function getColorStyle(
|
|
268
|
+
function getColorStyle(
|
|
269
|
+
styles: Record<string, TextStyle>,
|
|
270
|
+
color?: TextColor,
|
|
271
|
+
reverseTheme?: boolean,
|
|
272
|
+
) {
|
|
267
273
|
if (color === "default" || !color) {
|
|
268
274
|
return styles.greyBlue;
|
|
269
275
|
}
|
|
@@ -273,6 +279,7 @@ function getColorStyle(color?: TextColor, reverseTheme?: boolean) {
|
|
|
273
279
|
}
|
|
274
280
|
|
|
275
281
|
function getAlignStyle(
|
|
282
|
+
styles: Record<string, TextStyle>,
|
|
276
283
|
alignStyle: TextAlign = I18nManager.isRTL ? "end" : "start",
|
|
277
284
|
) {
|
|
278
285
|
return styles[`${alignStyle}Align`];
|
|
@@ -280,6 +287,7 @@ function getAlignStyle(
|
|
|
280
287
|
|
|
281
288
|
function getSizeAndHeightStyle(
|
|
282
289
|
textSize: TextSize,
|
|
290
|
+
styles: Record<string, TextStyle>,
|
|
283
291
|
lineHeightOverwrite?: LineHeight,
|
|
284
292
|
) {
|
|
285
293
|
const fontSize = styles[`${textSize}Size`];
|
|
@@ -293,7 +301,10 @@ function getSizeAndHeightStyle(
|
|
|
293
301
|
return fontSize;
|
|
294
302
|
}
|
|
295
303
|
|
|
296
|
-
function getLetterSpacingStyle(
|
|
304
|
+
function getLetterSpacingStyle(
|
|
305
|
+
letterSpacing: LetterSpacing = "base",
|
|
306
|
+
styles: Record<string, TextStyle>,
|
|
307
|
+
) {
|
|
297
308
|
return styles[`${letterSpacing}LetterSpacing`];
|
|
298
309
|
}
|
|
299
310
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
2
|
import { androidTokens, iosTokens } from "@jobber/design";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* These design tokens don't react to theme changes. Only use these if you need to access
|
|
6
|
+
* tokens that are not affected by the current theme, otherwise you should be using our
|
|
7
|
+
* useAtlantisTheme() hook to access the current theme's tokens.
|
|
8
|
+
*/
|
|
6
9
|
export const tokens: typeof iosTokens = Platform.select({
|
|
7
10
|
ios: () => iosTokens,
|
|
8
11
|
android: () => androidTokens,
|
package/src/utils/meta/meta.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { spacing } from "./types";
|
|
2
|
-
import { buildThemedStyles } from "../AtlantisThemeContext";
|
|
3
|
-
export const useGapStyles = buildThemedStyles(tokens => spacing.reduce((gapObj, space) => {
|
|
4
|
-
let paddingLeft = 0;
|
|
5
|
-
if (space !== "none")
|
|
6
|
-
paddingLeft = tokens[`space-${space}`];
|
|
7
|
-
gapObj[space] = { paddingLeft };
|
|
8
|
-
return gapObj;
|
|
9
|
-
}, {}));
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ViewStyle } from "react-native";
|
|
2
|
-
import { Spacing, spacing } from "./types";
|
|
3
|
-
import { buildThemedStyles } from "../AtlantisThemeContext";
|
|
4
|
-
|
|
5
|
-
export const useGapStyles = buildThemedStyles(tokens =>
|
|
6
|
-
spacing.reduce((gapObj, space) => {
|
|
7
|
-
let paddingLeft = 0;
|
|
8
|
-
if (space !== "none") paddingLeft = tokens[`space-${space}`];
|
|
9
|
-
|
|
10
|
-
gapObj[space] = { paddingLeft };
|
|
11
|
-
|
|
12
|
-
return gapObj;
|
|
13
|
-
}, {} as Record<Spacing, ViewStyle>),
|
|
14
|
-
);
|