@jobber/components-native 0.69.1 → 0.69.3-SCOTTTHd.31
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 +6 -8
- package/dist/src/Checkbox/Checkbox.js +1 -1
- package/dist/src/Form/components/FormActionBar/FormActionBar.js +1 -3
- package/dist/src/Icon/Icon.js +5 -39
- package/dist/src/InputPressable/InputPressable.style.js +1 -1
- package/dist/src/Text/Text.js +3 -2
- package/dist/src/Typography/Typography.js +3 -0
- package/dist/src/Typography/Typography.style.js +20 -3
- package/dist/src/utils/design/index.js +4 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/Text/Text.d.ts +5 -1
- package/dist/types/src/utils/design/index.d.ts +2 -2
- package/package.json +6 -8
- package/src/Button/Button.test.tsx +8 -8
- package/src/Checkbox/Checkbox.tsx +1 -1
- package/src/Form/components/FormActionBar/FormActionBar.tsx +2 -2
- package/src/Icon/Icon.tsx +10 -68
- package/src/Icon/__snapshots__/Icon.test.tsx.snap +16 -10
- package/src/InputPressable/InputPressable.style.ts +1 -1
- package/src/Menu/Menu.test.tsx +11 -8
- package/src/Text/Text.test.tsx +5 -0
- package/src/Text/Text.tsx +8 -1
- package/src/Text/__snapshots__/Text.test.tsx.snap +37 -0
- package/src/Typography/Typography.style.ts +26 -2
- package/src/Typography/Typography.tsx +6 -0
- package/src/Typography/__snapshots__/Typography.test.tsx.snap +8 -2
- package/src/utils/design/index.ts +5 -5
|
@@ -42,6 +42,10 @@ interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSize" | "
|
|
|
42
42
|
* Have text styled with strike through
|
|
43
43
|
*/
|
|
44
44
|
readonly strikeThrough?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Use italic font style
|
|
47
|
+
*/
|
|
48
|
+
readonly italic?: boolean;
|
|
45
49
|
/**
|
|
46
50
|
* This will make the text inaccessible to the screen reader.
|
|
47
51
|
* This should be avoided unless there is a good reason.
|
|
@@ -53,5 +57,5 @@ interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSize" | "
|
|
|
53
57
|
}
|
|
54
58
|
export type TextLevel = "text" | "textSupporting";
|
|
55
59
|
export declare const TEXT_MAX_SCALED_FONT_SIZES: Record<TextLevel, number>;
|
|
56
|
-
export declare function Text({ level, variation, emphasis, allowFontScaling, adjustsFontSizeToFit, maxLines, align, children, reverseTheme, strikeThrough, hideFromScreenReader, maxFontScaleSize, selectable, }: TextProps): JSX.Element;
|
|
60
|
+
export declare function Text({ level, variation, emphasis, allowFontScaling, adjustsFontSizeToFit, maxLines, align, children, reverseTheme, strikeThrough, italic, hideFromScreenReader, maxFontScaleSize, selectable, }: TextProps): JSX.Element;
|
|
57
61
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const tokens: typeof
|
|
1
|
+
import { iosTokens } from "@jobber/design";
|
|
2
|
+
export declare const tokens: typeof iosTokens;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.3-SCOTTTHd.31+15d0374e",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -36,8 +36,6 @@
|
|
|
36
36
|
"build:clean": "rm -rf ./dist"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@jobber/design": "^0.62.1",
|
|
40
|
-
"@jobber/hooks": "^2.10.1",
|
|
41
39
|
"@react-native-clipboard/clipboard": "^1.11.2",
|
|
42
40
|
"@react-native-picker/picker": "^2.4.10",
|
|
43
41
|
"autolinker": "^4.0.0",
|
|
@@ -70,9 +68,9 @@
|
|
|
70
68
|
"peerDependencies": {
|
|
71
69
|
"@babel/core": "^7.4.5",
|
|
72
70
|
"@react-native-community/datetimepicker": ">=6.7.0",
|
|
73
|
-
"date-fns": "^2.
|
|
74
|
-
"date-fns-tz": "
|
|
75
|
-
"react": "^18",
|
|
71
|
+
"date-fns": "^2.30.0",
|
|
72
|
+
"date-fns-tz": "^2.0.0",
|
|
73
|
+
"react": "^18.2.0",
|
|
76
74
|
"react-intl": "^6.4.2",
|
|
77
75
|
"react-native": ">=0.69.2",
|
|
78
76
|
"react-native-gesture-handler": ">=2.10.0",
|
|
@@ -80,9 +78,9 @@
|
|
|
80
78
|
"react-native-modal-datetime-picker": " >=13.0.0",
|
|
81
79
|
"react-native-modalize": "^2.0.13",
|
|
82
80
|
"react-native-portalize": "^1.0.7",
|
|
83
|
-
"react-native-reanimated": "^
|
|
81
|
+
"react-native-reanimated": "^3.0.0",
|
|
84
82
|
"react-native-safe-area-context": "^4.5.2",
|
|
85
83
|
"react-native-svg": ">=12.0.0"
|
|
86
84
|
},
|
|
87
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "15d0374ed8f1863dbae171f3b6fc998e0be0097c"
|
|
88
86
|
}
|
|
@@ -209,8 +209,8 @@ describe("Button", () => {
|
|
|
209
209
|
it("renders an icon Button with same color as the Button text", () => {
|
|
210
210
|
const { iconColor, textColor } = getIconAndTextColorFromRender({});
|
|
211
211
|
|
|
212
|
-
expect(iconColor).toBe(
|
|
213
|
-
expect(textColor).toBe(
|
|
212
|
+
expect(iconColor).toBe("rgba(255, 255, 255, 1)");
|
|
213
|
+
expect(textColor).toBe(tokens["color-white"]);
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
it("renders the learning variation and secondary type with icon and label with the same color", () => {
|
|
@@ -218,8 +218,8 @@ describe("Button", () => {
|
|
|
218
218
|
variation: "learning",
|
|
219
219
|
type: "secondary",
|
|
220
220
|
});
|
|
221
|
-
expect(iconColor).toBe(
|
|
222
|
-
expect(textColor).toBe(
|
|
221
|
+
expect(iconColor).toBe("hsl(198, 35%, 21%)");
|
|
222
|
+
expect(textColor).toBe(tokens["color-interactive--subtle"]);
|
|
223
223
|
});
|
|
224
224
|
|
|
225
225
|
it("renders the destructive variation and secondary type with icon and label with the same color", () => {
|
|
@@ -227,8 +227,8 @@ describe("Button", () => {
|
|
|
227
227
|
variation: "destructive",
|
|
228
228
|
type: "secondary",
|
|
229
229
|
});
|
|
230
|
-
expect(iconColor).toBe(
|
|
231
|
-
expect(textColor).toBe(
|
|
230
|
+
expect(iconColor).toBe("hsl(6, 64%, 51%)");
|
|
231
|
+
expect(textColor).toBe(tokens["color-destructive"]);
|
|
232
232
|
});
|
|
233
233
|
|
|
234
234
|
it("renders the cancel variation and tertiary type with icon and label with the same color", () => {
|
|
@@ -236,8 +236,8 @@ describe("Button", () => {
|
|
|
236
236
|
variation: "cancel",
|
|
237
237
|
type: "tertiary",
|
|
238
238
|
});
|
|
239
|
-
expect(iconColor).toBe(
|
|
240
|
-
expect(textColor).toBe(
|
|
239
|
+
expect(iconColor).toBe("hsl(198, 35%, 21%)");
|
|
240
|
+
expect(textColor).toBe("hsl(198, 35%, 21%)");
|
|
241
241
|
});
|
|
242
242
|
|
|
243
243
|
it("renders an icon Button if only an icon is passed", () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ColorValue, Pressable, View } from "react-native";
|
|
3
3
|
import { XOR } from "ts-xor";
|
|
4
|
-
import { tokens } from "@jobber/design
|
|
4
|
+
import { tokens } from "@jobber/design";
|
|
5
5
|
import { styles } from "./Checkbox.style";
|
|
6
6
|
import { Text } from "../Text";
|
|
7
7
|
import { Icon } from "../Icon";
|
|
@@ -35,7 +35,8 @@ export function FormActionBar({
|
|
|
35
35
|
const buttonStyle = StyleSheet.flatten([
|
|
36
36
|
styles.saveButton,
|
|
37
37
|
{
|
|
38
|
-
position:
|
|
38
|
+
position:
|
|
39
|
+
keyboardHeight > 0 ? ("absolute" as const) : ("relative" as const),
|
|
39
40
|
bottom: 0,
|
|
40
41
|
},
|
|
41
42
|
]);
|
|
@@ -45,7 +46,6 @@ export function FormActionBar({
|
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
return (
|
|
48
|
-
//@ts-expect-error tsc-ci
|
|
49
49
|
<ReanimatedView style={buttonStyle} onLayout={onLayout}>
|
|
50
50
|
{renderStickySection ? (
|
|
51
51
|
renderStickySection(submit, saveButtonLabel, isFormSubmitting)
|
package/src/Icon/Icon.tsx
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Svg, {
|
|
3
|
-
import {
|
|
4
|
-
IconColorNames,
|
|
5
|
-
IconNames,
|
|
6
|
-
IconSizes,
|
|
7
|
-
colorsClassMap,
|
|
8
|
-
getIcon,
|
|
9
|
-
iconClassMap,
|
|
10
|
-
iconStyles,
|
|
11
|
-
sizesClassMap,
|
|
12
|
-
} from "@jobber/design";
|
|
2
|
+
import Svg, { Path } from "react-native-svg";
|
|
3
|
+
import { IconColorNames, IconNames, IconSizes, getIcon } from "@jobber/design";
|
|
13
4
|
|
|
14
5
|
export interface IconProps {
|
|
15
6
|
/** The icon to show. */
|
|
@@ -46,72 +37,23 @@ export function Icon({
|
|
|
46
37
|
customColor,
|
|
47
38
|
testID,
|
|
48
39
|
}: IconProps): JSX.Element {
|
|
49
|
-
const {
|
|
40
|
+
const { svgStyle, pathStyle, paths, viewBox } = getIcon({
|
|
50
41
|
name,
|
|
51
42
|
color,
|
|
52
43
|
size,
|
|
44
|
+
format: "js",
|
|
53
45
|
});
|
|
54
|
-
|
|
55
|
-
/*
|
|
56
|
-
* This is to fix a bug where icons with built-in colours do not respect
|
|
57
|
-
* their color property. At time of writing, if you pass a color to getIcon,
|
|
58
|
-
* pathClassNames will return the color class first in pathClassNames.
|
|
59
|
-
* getSvgStyle applies styles in order, so the styles in the last class
|
|
60
|
-
* processed take precedence.
|
|
61
|
-
*
|
|
62
|
-
* This fix reverses the order of pathClassNames, so any color-specific
|
|
63
|
-
* CSS classes are processed last. The order of classes in pathClassNames
|
|
64
|
-
* is not contractual, so this is potentially fragile if there are updates
|
|
65
|
-
* to the @jobber/design package it comes from.
|
|
66
|
-
*/
|
|
67
|
-
const reversedPathClassNames = pathClassNames.split(" ").reverse().join(" ");
|
|
68
|
-
|
|
69
|
-
const svgStyle = getSvgStyle(svgClassNames + " " + reversedPathClassNames);
|
|
70
|
-
|
|
71
46
|
const icon = paths.map((path: string) => {
|
|
72
|
-
return <Path key={path} d={path} fill={customColor ||
|
|
47
|
+
return <Path key={path} d={path} fill={customColor || pathStyle.fill} />;
|
|
73
48
|
});
|
|
74
49
|
|
|
75
50
|
return (
|
|
76
|
-
<Svg
|
|
51
|
+
<Svg
|
|
52
|
+
style={{ ...svgStyle, display: "flex" }}
|
|
53
|
+
testID={testID || name}
|
|
54
|
+
viewBox={viewBox}
|
|
55
|
+
>
|
|
77
56
|
{icon}
|
|
78
57
|
</Svg>
|
|
79
58
|
);
|
|
80
59
|
}
|
|
81
|
-
|
|
82
|
-
/*
|
|
83
|
-
* get svg styles based on the class names
|
|
84
|
-
* @param className - list of hashed names separated by space - "_2GsLyQLHv8yNULHeXGdver _1ANbiqwd8qgeLaumvLs27n"
|
|
85
|
-
* @default ""
|
|
86
|
-
* @return - style object for the icon - {"display": "flex" "height": 24, "width": 24, "verticalAlign": "middle" }
|
|
87
|
-
*
|
|
88
|
-
* Since the class names are hashed, we use the [name]ClassMap to find the actual class name. For example if we get
|
|
89
|
-
* "_2GsLyQLHv8yNULHeXGdver _1ANbiqwd8qgeLaumvLs27n", it might map to ".icon .base". Then using the mapped class names,
|
|
90
|
-
* we get the style from the css files which will be something like {"display": "flex" "height": 24, "width": 24, "verticalAlign": "middle" }
|
|
91
|
-
*
|
|
92
|
-
* Atlantis returns "display: inline-block" for icons, but since React Native doesn't support that, we override it with
|
|
93
|
-
* the default "display" value for React Native which is "flex"
|
|
94
|
-
*/
|
|
95
|
-
function getSvgStyle(classNames = ""): SvgProps["style"] & FillProps {
|
|
96
|
-
const classMap = {
|
|
97
|
-
...iconClassMap,
|
|
98
|
-
...sizesClassMap,
|
|
99
|
-
...colorsClassMap,
|
|
100
|
-
};
|
|
101
|
-
const svgStyle = getStylesForClassNames(classNames.split(" "), classMap);
|
|
102
|
-
|
|
103
|
-
return { ...svgStyle, display: "flex" };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function getStylesForClassNames(
|
|
107
|
-
classNames: string[],
|
|
108
|
-
classMap: Record<string, string>,
|
|
109
|
-
) {
|
|
110
|
-
return classNames.reduce(
|
|
111
|
-
(acc, className) => ({
|
|
112
|
-
...acc,
|
|
113
|
-
...iconStyles[classMap[className] as keyof typeof iconStyles],
|
|
114
|
-
}),
|
|
115
|
-
{},
|
|
116
|
-
);
|
|
117
|
-
}
|
|
@@ -50,7 +50,7 @@ exports[`renders apple icon 1`] = `
|
|
|
50
50
|
d="M18.467 12.754c-.027-2.996 2.453-4.453 2.566-4.52-1.404-2.048-3.581-2.328-4.346-2.35-1.828-.193-3.601 1.094-4.533 1.094-.95 0-2.384-1.076-3.93-1.044-1.988.03-3.849 1.182-4.87 2.97C1.25 12.55 2.82 17.91 4.838 20.856c1.01 1.443 2.189 3.055 3.733 2.998 1.51-.062 2.074-.963 3.897-.963 1.806 0 2.335.963 3.91.927 1.62-.026 2.641-1.45 3.615-2.907 1.166-1.654 1.635-3.283 1.653-3.367-.038-.013-3.147-1.2-3.178-4.79Zm-2.974-8.81c.812-1.015 1.368-2.397 1.213-3.8-1.175.053-2.646.814-3.492 1.807-.75.876-1.418 2.31-1.246 3.66 1.321.099 2.677-.666 3.525-1.666Z"
|
|
51
51
|
fill={
|
|
52
52
|
{
|
|
53
|
-
"payload":
|
|
53
|
+
"payload": 4278190080,
|
|
54
54
|
"type": 0,
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -114,7 +114,7 @@ exports[`renders home icon 1`] = `
|
|
|
114
114
|
d="M13.147 3.582a2 2 0 0 0-2.294 0l-9.426 6.599a1 1 0 1 0 1.147 1.638L5 10.121V18a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-7.88l2.427 1.7a1 1 0 0 0 1.146-1.64l-9.426-6.598ZM17 8.721V18a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V8.72l5-3.5 5 3.5Z"
|
|
115
115
|
fill={
|
|
116
116
|
{
|
|
117
|
-
"payload":
|
|
117
|
+
"payload": 4278190080,
|
|
118
118
|
"type": 0,
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -178,7 +178,7 @@ exports[`renders large arrowDown icon 1`] = `
|
|
|
178
178
|
d="M7.703 8.291a.996.996 0 0 0-1.41.001.994.994 0 0 0 0 1.41l5 5.005a.998.998 0 0 0 1.415 0l5-5a.994.994 0 0 0 0-1.41.995.995 0 0 0-1.411-.001L12 12.584 7.703 8.291Z"
|
|
179
179
|
fill={
|
|
180
180
|
{
|
|
181
|
-
"payload":
|
|
181
|
+
"payload": 4278190080,
|
|
182
182
|
"type": 0,
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -320,7 +320,7 @@ exports[`renders small more icon 1`] = `
|
|
|
320
320
|
d="M4 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm6 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm8-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Z"
|
|
321
321
|
fill={
|
|
322
322
|
{
|
|
323
|
-
"payload":
|
|
323
|
+
"payload": 4278190080,
|
|
324
324
|
"type": 0,
|
|
325
325
|
}
|
|
326
326
|
}
|
|
@@ -417,11 +417,7 @@ exports[`renders thumbsDown icon 1`] = `
|
|
|
417
417
|
"display": "flex",
|
|
418
418
|
"fill": "hsl(198, 35%, 21%)",
|
|
419
419
|
"height": 24,
|
|
420
|
-
"transform":
|
|
421
|
-
{
|
|
422
|
-
"scaleY": -1,
|
|
423
|
-
},
|
|
424
|
-
],
|
|
420
|
+
"transform": "scaleY(-1)",
|
|
425
421
|
"verticalAlign": "middle",
|
|
426
422
|
"width": 24,
|
|
427
423
|
},
|
|
@@ -443,6 +439,16 @@ exports[`renders thumbsDown icon 1`] = `
|
|
|
443
439
|
"type": 0,
|
|
444
440
|
}
|
|
445
441
|
}
|
|
442
|
+
matrix={
|
|
443
|
+
[
|
|
444
|
+
1,
|
|
445
|
+
0,
|
|
446
|
+
0,
|
|
447
|
+
1,
|
|
448
|
+
0,
|
|
449
|
+
0,
|
|
450
|
+
]
|
|
451
|
+
}
|
|
446
452
|
propList={
|
|
447
453
|
[
|
|
448
454
|
"fill",
|
|
@@ -453,7 +459,7 @@ exports[`renders thumbsDown icon 1`] = `
|
|
|
453
459
|
d="M8 11.78V19h8l3-5.76v-1.29h-7.639l1.036-7.944L8 11.78ZM6.134 11l4.555-8.034c1.124-1.846 3.971-.844 3.691 1.299l-.74 5.685h6.86a.5.5 0 0 1 .5.5v3a1 1 0 0 1-.084.4l-3.276 6.648a.95.95 0 0 1-.44.453c-.132.065-.276.049-.423.049H4c-1.105 0-2-1.045-2-2.15V13a2 2 0 0 1 2-2h2.134ZM6 13H4v6h2v-6Z"
|
|
454
460
|
fill={
|
|
455
461
|
{
|
|
456
|
-
"payload":
|
|
462
|
+
"payload": 4278190080,
|
|
457
463
|
"type": 0,
|
|
458
464
|
}
|
|
459
465
|
}
|
package/src/Menu/Menu.test.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { fireEvent, render } from "@testing-library/react-native";
|
|
3
3
|
import { Host } from "react-native-portalize";
|
|
4
4
|
import { View } from "react-native";
|
|
5
|
-
import { tokens } from "@jobber/design/foundation";
|
|
6
5
|
import { Menu, MenuOptionProps, MenuProps } from ".";
|
|
7
6
|
import { Icon } from "../Icon";
|
|
8
7
|
import { Button } from "../Button";
|
|
@@ -130,13 +129,17 @@ describe("Menu", () => {
|
|
|
130
129
|
});
|
|
131
130
|
|
|
132
131
|
fireEvent.press(getByLabelText(menuLabel));
|
|
133
|
-
expect(getByTestId("add").props.style).
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
132
|
+
expect(getByTestId("add").props.style).toStrictEqual([
|
|
133
|
+
{ backgroundColor: "transparent", borderWidth: 0 },
|
|
134
|
+
{
|
|
135
|
+
display: "flex",
|
|
136
|
+
fill: "hsl(6, 64%, 51%)",
|
|
137
|
+
height: 24,
|
|
138
|
+
verticalAlign: "middle",
|
|
139
|
+
width: 24,
|
|
140
|
+
},
|
|
141
|
+
{ flex: 0, height: 24, width: 24 },
|
|
142
|
+
]);
|
|
140
143
|
});
|
|
141
144
|
|
|
142
145
|
it("closes the menu after clicking on a menu option", () => {
|
package/src/Text/Text.test.tsx
CHANGED
|
@@ -127,6 +127,11 @@ it("renders with strikethrough styling", () => {
|
|
|
127
127
|
expect(text.toJSON()).toMatchSnapshot();
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
+
it("renders with italic styling", () => {
|
|
131
|
+
const text = render(<Text italic>Test Text</Text>);
|
|
132
|
+
expect(text.toJSON()).toMatchSnapshot();
|
|
133
|
+
});
|
|
134
|
+
|
|
130
135
|
it("renders text that is inaccessible", () => {
|
|
131
136
|
const text = render(<Text hideFromScreenReader={true}>Test Text</Text>);
|
|
132
137
|
expect(text.root.props).toEqual(
|
package/src/Text/Text.tsx
CHANGED
|
@@ -65,6 +65,11 @@ interface TextProps
|
|
|
65
65
|
*/
|
|
66
66
|
readonly strikeThrough?: boolean;
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Use italic font style
|
|
70
|
+
*/
|
|
71
|
+
readonly italic?: boolean;
|
|
72
|
+
|
|
68
73
|
/**
|
|
69
74
|
* This will make the text inaccessible to the screen reader.
|
|
70
75
|
* This should be avoided unless there is a good reason.
|
|
@@ -110,6 +115,7 @@ export function Text({
|
|
|
110
115
|
children,
|
|
111
116
|
reverseTheme = false,
|
|
112
117
|
strikeThrough = false,
|
|
118
|
+
italic = false,
|
|
113
119
|
hideFromScreenReader = false,
|
|
114
120
|
maxFontScaleSize,
|
|
115
121
|
selectable,
|
|
@@ -120,7 +126,7 @@ export function Text({
|
|
|
120
126
|
<Typography
|
|
121
127
|
color={variation}
|
|
122
128
|
fontFamily="base"
|
|
123
|
-
fontStyle="regular"
|
|
129
|
+
fontStyle={italic ? "italic" : "regular"}
|
|
124
130
|
fontWeight={getFontWeight({ level, emphasis })}
|
|
125
131
|
maxFontScaleSize={maxFontScaleSize || TEXT_MAX_SCALED_FONT_SIZES[level]}
|
|
126
132
|
selectable={selectable}
|
|
@@ -133,6 +139,7 @@ export function Text({
|
|
|
133
139
|
reverseTheme,
|
|
134
140
|
maxLines,
|
|
135
141
|
strikeThrough,
|
|
142
|
+
italic,
|
|
136
143
|
hideFromScreenReader,
|
|
137
144
|
}}
|
|
138
145
|
>
|
|
@@ -580,6 +580,43 @@ exports[`renders text with warn variation 1`] = `
|
|
|
580
580
|
</Text>
|
|
581
581
|
`;
|
|
582
582
|
|
|
583
|
+
exports[`renders with italic styling 1`] = `
|
|
584
|
+
<Text
|
|
585
|
+
accessibilityRole="text"
|
|
586
|
+
adjustsFontSizeToFit={false}
|
|
587
|
+
allowFontScaling={true}
|
|
588
|
+
collapsable={false}
|
|
589
|
+
maxFontSizeMultiplier={3.125}
|
|
590
|
+
selectable={true}
|
|
591
|
+
selectionColor="hsl(86, 100%, 46%)"
|
|
592
|
+
style={
|
|
593
|
+
[
|
|
594
|
+
{
|
|
595
|
+
"fontFamily": "inter-italic",
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"color": "hsl(198, 35%, 21%)",
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
"textAlign": "left",
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"fontSize": 16,
|
|
605
|
+
"lineHeight": 20,
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"letterSpacing": 0,
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"fontStyle": "italic",
|
|
612
|
+
},
|
|
613
|
+
]
|
|
614
|
+
}
|
|
615
|
+
>
|
|
616
|
+
Test Text
|
|
617
|
+
</Text>
|
|
618
|
+
`;
|
|
619
|
+
|
|
583
620
|
exports[`renders with strikethrough styling 1`] = `
|
|
584
621
|
<Text
|
|
585
622
|
accessibilityRole="text"
|
|
@@ -9,7 +9,7 @@ const largerLineHeight = tokens["typography--lineHeight-larger"];
|
|
|
9
9
|
const largeLineHeight = tokens["typography--lineHeight-large"];
|
|
10
10
|
const baseLineHeight = tokens["typography--lineHeight-base"];
|
|
11
11
|
const tightLineHeight = tokens["typography--lineHeight-tight"];
|
|
12
|
-
const
|
|
12
|
+
const minusculeLineHeight = tokens["typography--lineHeight-minuscule"];
|
|
13
13
|
|
|
14
14
|
const deviceFonts = {
|
|
15
15
|
baseRegularRegular: {
|
|
@@ -32,6 +32,26 @@ const deviceFonts = {
|
|
|
32
32
|
fontFamily: "inter-extrabold",
|
|
33
33
|
},
|
|
34
34
|
|
|
35
|
+
baseItalicRegular: {
|
|
36
|
+
fontFamily: "inter-italic",
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
baseItalicMedium: {
|
|
40
|
+
fontFamily: "inter-italic-medium",
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
baseItalicBold: {
|
|
44
|
+
fontFamily: "inter-italic-bold",
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
baseItalicSemiBold: {
|
|
48
|
+
fontFamily: "inter-italic-semibold",
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
baseItalicExtraBold: {
|
|
52
|
+
fontFamily: "inter-italic-extrabold",
|
|
53
|
+
},
|
|
54
|
+
|
|
35
55
|
displayRegularBold: {
|
|
36
56
|
fontFamily: "jobberpro-bd",
|
|
37
57
|
},
|
|
@@ -64,6 +84,10 @@ export const typographyTokens: { [index: string]: TextStyle } = {
|
|
|
64
84
|
// { fontFamily }{ fontStyle }{ fontWeight }
|
|
65
85
|
...fonts,
|
|
66
86
|
|
|
87
|
+
italic: {
|
|
88
|
+
fontStyle: "italic",
|
|
89
|
+
},
|
|
90
|
+
|
|
67
91
|
startAlign: {
|
|
68
92
|
textAlign: "left",
|
|
69
93
|
},
|
|
@@ -282,7 +306,7 @@ export const typographyTokens: { [index: string]: TextStyle } = {
|
|
|
282
306
|
|
|
283
307
|
smallestSize: {
|
|
284
308
|
fontSize: tokens["typography--fontSize-smallest"],
|
|
285
|
-
lineHeight:
|
|
309
|
+
lineHeight: minusculeLineHeight,
|
|
286
310
|
},
|
|
287
311
|
|
|
288
312
|
smallerSize: {
|
|
@@ -106,6 +106,7 @@ export interface TypographyProps<T extends FontFamily>
|
|
|
106
106
|
* of the TextInput
|
|
107
107
|
*/
|
|
108
108
|
readonly hideFromScreenReader?: boolean;
|
|
109
|
+
|
|
109
110
|
/**
|
|
110
111
|
* Have text styled with strike through
|
|
111
112
|
*/
|
|
@@ -156,6 +157,11 @@ function InternalTypography<T extends FontFamily = "base">({
|
|
|
156
157
|
if (strikeThrough) {
|
|
157
158
|
style.push(styles.strikeThrough);
|
|
158
159
|
}
|
|
160
|
+
|
|
161
|
+
if (fontStyle === "italic") {
|
|
162
|
+
style.push(styles.italic);
|
|
163
|
+
}
|
|
164
|
+
|
|
159
165
|
const numberOfLinesForNativeText = maxNumberOfLines[maxLines];
|
|
160
166
|
|
|
161
167
|
const text = getTransformedText(children, transform);
|
|
@@ -211,7 +211,7 @@ exports[`renders text with bold weight and italic style 1`] = `
|
|
|
211
211
|
style={
|
|
212
212
|
[
|
|
213
213
|
{
|
|
214
|
-
"fontFamily": "inter-
|
|
214
|
+
"fontFamily": "inter-italic-bold",
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
"color": "hsl(197, 15%, 45%)",
|
|
@@ -226,6 +226,9 @@ exports[`renders text with bold weight and italic style 1`] = `
|
|
|
226
226
|
{
|
|
227
227
|
"letterSpacing": 0,
|
|
228
228
|
},
|
|
229
|
+
{
|
|
230
|
+
"fontStyle": "italic",
|
|
231
|
+
},
|
|
229
232
|
]
|
|
230
233
|
}
|
|
231
234
|
>
|
|
@@ -409,7 +412,7 @@ exports[`renders text with italic style 1`] = `
|
|
|
409
412
|
style={
|
|
410
413
|
[
|
|
411
414
|
{
|
|
412
|
-
"fontFamily": "inter-
|
|
415
|
+
"fontFamily": "inter-italic",
|
|
413
416
|
},
|
|
414
417
|
{
|
|
415
418
|
"color": "hsl(197, 15%, 45%)",
|
|
@@ -424,6 +427,9 @@ exports[`renders text with italic style 1`] = `
|
|
|
424
427
|
{
|
|
425
428
|
"letterSpacing": 0,
|
|
426
429
|
},
|
|
430
|
+
{
|
|
431
|
+
"fontStyle": "italic",
|
|
432
|
+
},
|
|
427
433
|
]
|
|
428
434
|
}
|
|
429
435
|
>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { tokens as mobileFoundationBase } from "@jobber/design/foundation.native";
|
|
2
1
|
import { Platform } from "react-native";
|
|
2
|
+
import { androidTokens, iosTokens } from "@jobber/design";
|
|
3
3
|
|
|
4
|
-
export const tokens: typeof
|
|
5
|
-
ios: () =>
|
|
6
|
-
android: () =>
|
|
7
|
-
default: () =>
|
|
4
|
+
export const tokens: typeof iosTokens = Platform.select({
|
|
5
|
+
ios: () => iosTokens,
|
|
6
|
+
android: () => androidTokens,
|
|
7
|
+
default: () => androidTokens,
|
|
8
8
|
})();
|