@jobber/components-native 0.76.1-JOB-116234-314c5ff.22 → 0.76.1-JOB-116234-4bc5afd.23
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/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 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/Typography/Typography.style.d.ts +1 -1
- package/package.json +2 -2
- 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/Typography/Typography.style.ts +1 -1
- package/src/Typography/Typography.tsx +19 -8
|
@@ -8,7 +8,7 @@ export declare const createTypographyTokens: (tokens: AtlantisThemeContextValue[
|
|
|
8
8
|
[index: string]: TextStyle;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* @deprecated Use
|
|
11
|
+
* @deprecated Use useTypographyStyles instead
|
|
12
12
|
*/
|
|
13
13
|
export declare const typographyStyles: Record<string, TextStyle>;
|
|
14
14
|
export declare const useTypographyStyles: () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.76.1-JOB-116234-
|
|
3
|
+
"version": "0.76.1-JOB-116234-4bc5afd.23+4bc5afdb",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"react-native-safe-area-context": "^4.5.2",
|
|
81
81
|
"react-native-svg": ">=12.0.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "4bc5afdb99786f50a9ae8474ac282eb593dd9867"
|
|
84
84
|
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
buildThemedStyles,
|
|
5
5
|
} from "../AtlantisThemeContext";
|
|
6
6
|
import {
|
|
7
|
+
// eslint-disable-next-line import/no-deprecated
|
|
7
8
|
typographyStyles as staticTypographyStyles,
|
|
8
9
|
useTypographyStyles,
|
|
9
10
|
} from "../Typography";
|
|
@@ -52,6 +53,7 @@ export const createCommonInputTokens = (
|
|
|
52
53
|
* @deprecated Use useCommonInputStyles instead
|
|
53
54
|
*/
|
|
54
55
|
export const commonInputStyles = StyleSheet.create(
|
|
56
|
+
// eslint-disable-next-line import/no-deprecated
|
|
55
57
|
createCommonInputTokens(staticTokens, staticTypographyStyles),
|
|
56
58
|
);
|
|
57
59
|
|
|
@@ -10,10 +10,7 @@ import {
|
|
|
10
10
|
prefixIconTestId,
|
|
11
11
|
prefixLabelTestId,
|
|
12
12
|
} from "./Prefix";
|
|
13
|
-
import {
|
|
14
|
-
typographyStyles as staticStyles,
|
|
15
|
-
useTypographyStyles,
|
|
16
|
-
} from "../../../Typography";
|
|
13
|
+
import { useTypographyStyles } from "../../../Typography";
|
|
17
14
|
import { useStyles } from "../../InputFieldWrapper.style";
|
|
18
15
|
import { tokens } from "../../../utils/design";
|
|
19
16
|
import * as IconComponent from "../../../Icon/Icon";
|
|
@@ -31,8 +28,6 @@ beforeAll(() => {
|
|
|
31
28
|
|
|
32
29
|
styles = stylesHook.result.current;
|
|
33
30
|
typographyStyles = typographyStylesHook.result.current;
|
|
34
|
-
console.log(typographyStyles.defaultSize);
|
|
35
|
-
console.log(staticStyles.defaultSize);
|
|
36
31
|
});
|
|
37
32
|
|
|
38
33
|
function setupLabel({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { render } from "@testing-library/react-native";
|
|
2
|
+
import { render, renderHook } from "@testing-library/react-native";
|
|
3
3
|
import { TextStyle } from "react-native";
|
|
4
4
|
import {
|
|
5
5
|
SuffixIcon,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SuffixLabel,
|
|
8
8
|
SuffixLabelProps,
|
|
9
9
|
} from "./Suffix";
|
|
10
|
-
import {
|
|
10
|
+
import { useTypographyStyles } from "../../../Typography";
|
|
11
11
|
|
|
12
12
|
const mockLabel = "$";
|
|
13
13
|
|
|
@@ -49,6 +49,13 @@ function setupIcon({
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
let typographyStyles: ReturnType<typeof useTypographyStyles>;
|
|
53
|
+
|
|
54
|
+
beforeAll(() => {
|
|
55
|
+
const typographyStylesHook = renderHook(() => useTypographyStyles());
|
|
56
|
+
typographyStyles = typographyStylesHook.result.current;
|
|
57
|
+
});
|
|
58
|
+
|
|
52
59
|
describe("Suffix", () => {
|
|
53
60
|
it("renders a suffix label when specified", () => {
|
|
54
61
|
const { getByText } = setupLabel({});
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { IconNames } from "@jobber/design";
|
|
10
10
|
import { Icon } from "../../../Icon";
|
|
11
11
|
import { Text } from "../../../Text";
|
|
12
|
-
import {
|
|
12
|
+
import { useTypographyStyles } from "../../../Typography";
|
|
13
13
|
import { useAtlantisTheme } from "../../../AtlantisThemeContext";
|
|
14
14
|
import { useStyles } from "../../InputFieldWrapper.style";
|
|
15
15
|
|
|
@@ -36,6 +36,7 @@ export function SuffixLabel({
|
|
|
36
36
|
styleOverride,
|
|
37
37
|
}: SuffixLabelProps): JSX.Element {
|
|
38
38
|
const styles = useStyles();
|
|
39
|
+
const typographyStyles = useTypographyStyles();
|
|
39
40
|
|
|
40
41
|
return (
|
|
41
42
|
<View
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { buildThemedStyles } from "../AtlantisThemeContext";
|
|
2
|
-
import {
|
|
2
|
+
import { useTypographyStyles } from "../Typography";
|
|
3
3
|
|
|
4
|
-
export const useStyles =
|
|
5
|
-
|
|
4
|
+
export const useStyles = () => {
|
|
5
|
+
const typographyStyles = useTypographyStyles();
|
|
6
|
+
|
|
7
|
+
return buildThemedStyles(tokens => ({
|
|
6
8
|
pressable: {
|
|
7
9
|
flex: 1,
|
|
8
10
|
},
|
|
@@ -26,5 +28,5 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
26
28
|
inputInvalid: {
|
|
27
29
|
borderColor: tokens["color-critical"],
|
|
28
30
|
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
+
}))();
|
|
32
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { buildThemedStyles } from "../AtlantisThemeContext";
|
|
2
|
-
import {
|
|
2
|
+
import { useTypographyStyles } from "../Typography";
|
|
3
3
|
|
|
4
|
-
export const useStyles =
|
|
5
|
-
|
|
4
|
+
export const useStyles = () => {
|
|
5
|
+
const typographyStyles = useTypographyStyles();
|
|
6
|
+
|
|
7
|
+
return buildThemedStyles(tokens => ({
|
|
6
8
|
inputPaddingTop: {
|
|
7
9
|
paddingTop:
|
|
8
10
|
(typographyStyles.smallSize.fontSize || 0) +
|
|
@@ -22,9 +24,8 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
22
24
|
},
|
|
23
25
|
|
|
24
26
|
multilineInputiOS: {
|
|
25
|
-
// for placeholder
|
|
26
27
|
paddingTop:
|
|
27
28
|
(typographyStyles.defaultSize.fontSize || 0) + tokens["space-smallest"],
|
|
28
29
|
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
30
|
+
}))();
|
|
31
|
+
};
|
|
@@ -620,7 +620,7 @@ export const createTypographyTokens = (
|
|
|
620
620
|
});
|
|
621
621
|
|
|
622
622
|
/**
|
|
623
|
-
* @deprecated Use
|
|
623
|
+
* @deprecated Use useTypographyStyles instead
|
|
624
624
|
*/
|
|
625
625
|
export const typographyStyles: Record<string, TextStyle> = StyleSheet.create(
|
|
626
626
|
createTypographyTokens(staticTokens),
|
|
@@ -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
|
|