@jobber/components-native 0.69.2 → 0.69.3-SCOTTTHd.45
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 +4 -6
- package/dist/src/Checkbox/Checkbox.js +1 -1
- package/dist/src/Form/components/FormActionBar/FormActionBar.js +1 -3
- package/dist/src/Icon/Icon.js +6 -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 +4 -6
- package/src/Checkbox/Checkbox.tsx +1 -1
- package/src/Form/components/FormActionBar/FormActionBar.tsx +2 -2
- package/src/Icon/Icon.tsx +11 -68
- package/src/Icon/__snapshots__/Icon.test.tsx.snap +5 -5
- package/src/InputPressable/InputPressable.style.ts +1 -1
- 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
package/dist/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.45+8d76eff1",
|
|
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.2",
|
|
40
|
-
"@jobber/hooks": "^2.10.2",
|
|
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,8 +68,8 @@
|
|
|
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": "
|
|
71
|
+
"date-fns": "^2.30.0",
|
|
72
|
+
"date-fns-tz": "^2.0.0",
|
|
75
73
|
"react": "^18.2.0",
|
|
76
74
|
"react-intl": "^6.4.2",
|
|
77
75
|
"react-native": ">=0.69.2",
|
|
@@ -84,5 +82,5 @@
|
|
|
84
82
|
"react-native-safe-area-context": "^4.5.2",
|
|
85
83
|
"react-native-svg": ">=12.0.0"
|
|
86
84
|
},
|
|
87
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "8d76eff16e7f4fad97727aff66cfb2435b30480a"
|
|
88
86
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Pressable, View } from "react-native";
|
|
3
|
-
import { tokens } from "@jobber/design
|
|
3
|
+
import { tokens } from "@jobber/design";
|
|
4
4
|
import { styles } from "./Checkbox.style";
|
|
5
5
|
import { Text } from "../Text";
|
|
6
6
|
import { Icon } from "../Icon";
|
|
@@ -15,7 +15,5 @@ export function FormActionBar({ keyboardHeight, submit, isFormSubmitting, saveBu
|
|
|
15
15
|
const onLayout = (event) => {
|
|
16
16
|
setSaveButtonHeight && setSaveButtonHeight(event.nativeEvent.layout.height);
|
|
17
17
|
};
|
|
18
|
-
return (
|
|
19
|
-
//@ts-expect-error tsc-ci
|
|
20
|
-
React.createElement(ReanimatedView, { style: buttonStyle, onLayout: onLayout }, renderStickySection ? (renderStickySection(submit, saveButtonLabel, isFormSubmitting)) : (React.createElement(FormSaveButton, { setSecondaryActionLoading: setSecondaryActionLoading, primaryAction: submit, loading: isFormSubmitting, label: saveButtonLabel, secondaryActions: secondaryActions }))));
|
|
18
|
+
return (React.createElement(ReanimatedView, { style: buttonStyle, onLayout: onLayout }, renderStickySection ? (renderStickySection(submit, saveButtonLabel, isFormSubmitting)) : (React.createElement(FormSaveButton, { setSecondaryActionLoading: setSecondaryActionLoading, primaryAction: submit, loading: isFormSubmitting, label: saveButtonLabel, secondaryActions: secondaryActions }))));
|
|
21
19
|
}
|
package/dist/src/Icon/Icon.js
CHANGED
|
@@ -1,49 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Svg, { Path } from "react-native-svg";
|
|
3
|
-
import {
|
|
3
|
+
import { getIcon } from "@jobber/design";
|
|
4
4
|
export function Icon({ name, color, size = "base", customColor, testID, }) {
|
|
5
|
-
const {
|
|
5
|
+
const { svgStyle, pathStyle, paths, viewBox } = getIcon({
|
|
6
6
|
name,
|
|
7
7
|
color,
|
|
8
8
|
size,
|
|
9
|
+
platform: "mobile",
|
|
10
|
+
format: "js",
|
|
9
11
|
});
|
|
10
|
-
/*
|
|
11
|
-
* This is to fix a bug where icons with built-in colours do not respect
|
|
12
|
-
* their color property. At time of writing, if you pass a color to getIcon,
|
|
13
|
-
* pathClassNames will return the color class first in pathClassNames.
|
|
14
|
-
* getSvgStyle applies styles in order, so the styles in the last class
|
|
15
|
-
* processed take precedence.
|
|
16
|
-
*
|
|
17
|
-
* This fix reverses the order of pathClassNames, so any color-specific
|
|
18
|
-
* CSS classes are processed last. The order of classes in pathClassNames
|
|
19
|
-
* is not contractual, so this is potentially fragile if there are updates
|
|
20
|
-
* to the @jobber/design package it comes from.
|
|
21
|
-
*/
|
|
22
|
-
const reversedPathClassNames = pathClassNames.split(" ").reverse().join(" ");
|
|
23
|
-
const svgStyle = getSvgStyle(svgClassNames + " " + reversedPathClassNames);
|
|
24
12
|
const icon = paths.map((path) => {
|
|
25
|
-
return React.createElement(Path, { key: path, d: path, fill: customColor ||
|
|
13
|
+
return React.createElement(Path, { key: path, d: path, fill: customColor || pathStyle.fill });
|
|
26
14
|
});
|
|
27
|
-
return (React.createElement(Svg, { style: svgStyle, testID: testID || name, viewBox: viewBox }, icon));
|
|
28
|
-
}
|
|
29
|
-
/*
|
|
30
|
-
* get svg styles based on the class names
|
|
31
|
-
* @param className - list of hashed names separated by space - "_2GsLyQLHv8yNULHeXGdver _1ANbiqwd8qgeLaumvLs27n"
|
|
32
|
-
* @default ""
|
|
33
|
-
* @return - style object for the icon - {"display": "flex" "height": 24, "width": 24, "verticalAlign": "middle" }
|
|
34
|
-
*
|
|
35
|
-
* Since the class names are hashed, we use the [name]ClassMap to find the actual class name. For example if we get
|
|
36
|
-
* "_2GsLyQLHv8yNULHeXGdver _1ANbiqwd8qgeLaumvLs27n", it might map to ".icon .base". Then using the mapped class names,
|
|
37
|
-
* we get the style from the css files which will be something like {"display": "flex" "height": 24, "width": 24, "verticalAlign": "middle" }
|
|
38
|
-
*
|
|
39
|
-
* Atlantis returns "display: inline-block" for icons, but since React Native doesn't support that, we override it with
|
|
40
|
-
* the default "display" value for React Native which is "flex"
|
|
41
|
-
*/
|
|
42
|
-
function getSvgStyle(classNames = "") {
|
|
43
|
-
const classMap = Object.assign(Object.assign(Object.assign({}, iconClassMap), sizesClassMap), colorsClassMap);
|
|
44
|
-
const svgStyle = getStylesForClassNames(classNames.split(" "), classMap);
|
|
45
|
-
return Object.assign(Object.assign({}, svgStyle), { display: "flex" });
|
|
46
|
-
}
|
|
47
|
-
function getStylesForClassNames(classNames, classMap) {
|
|
48
|
-
return classNames.reduce((acc, className) => (Object.assign(Object.assign({}, acc), iconStyles[classMap[className]])), {});
|
|
15
|
+
return (React.createElement(Svg, { style: Object.assign(Object.assign({}, svgStyle), { display: "flex" }), testID: testID || name, viewBox: viewBox }, icon));
|
|
49
16
|
}
|
package/dist/src/Text/Text.js
CHANGED
|
@@ -16,15 +16,16 @@ export const TEXT_MAX_SCALED_FONT_SIZES = {
|
|
|
16
16
|
text: MAX_TEXT_FONT_SIZE_SCALE,
|
|
17
17
|
textSupporting: tokens["typography--fontSize-base"],
|
|
18
18
|
};
|
|
19
|
-
export function Text({ level = "text", variation = "base", emphasis, allowFontScaling = true, adjustsFontSizeToFit = false, maxLines = "unlimited", align, children, reverseTheme = false, strikeThrough = false, hideFromScreenReader = false, maxFontScaleSize, selectable, }) {
|
|
19
|
+
export function Text({ level = "text", variation = "base", emphasis, allowFontScaling = true, adjustsFontSizeToFit = false, maxLines = "unlimited", align, children, reverseTheme = false, strikeThrough = false, italic = false, hideFromScreenReader = false, maxFontScaleSize, selectable, }) {
|
|
20
20
|
const accessibilityRole = "text";
|
|
21
|
-
return (React.createElement(Typography, Object.assign({ color: variation, fontFamily: "base", fontStyle: "regular", fontWeight: getFontWeight({ level, emphasis }), maxFontScaleSize: maxFontScaleSize || TEXT_MAX_SCALED_FONT_SIZES[level], selectable: selectable }, Object.assign(Object.assign({}, levelStyles[level]), { allowFontScaling,
|
|
21
|
+
return (React.createElement(Typography, Object.assign({ color: variation, fontFamily: "base", fontStyle: italic ? "italic" : "regular", fontWeight: getFontWeight({ level, emphasis }), maxFontScaleSize: maxFontScaleSize || TEXT_MAX_SCALED_FONT_SIZES[level], selectable: selectable }, Object.assign(Object.assign({}, levelStyles[level]), { allowFontScaling,
|
|
22
22
|
align,
|
|
23
23
|
adjustsFontSizeToFit,
|
|
24
24
|
accessibilityRole,
|
|
25
25
|
reverseTheme,
|
|
26
26
|
maxLines,
|
|
27
27
|
strikeThrough,
|
|
28
|
+
italic,
|
|
28
29
|
hideFromScreenReader })), children));
|
|
29
30
|
}
|
|
30
31
|
function getFontWeight({ level, emphasis, }) {
|
|
@@ -27,6 +27,9 @@ function InternalTypography({ fontFamily, fontStyle, fontWeight, transform, colo
|
|
|
27
27
|
if (strikeThrough) {
|
|
28
28
|
style.push(styles.strikeThrough);
|
|
29
29
|
}
|
|
30
|
+
if (fontStyle === "italic") {
|
|
31
|
+
style.push(styles.italic);
|
|
32
|
+
}
|
|
30
33
|
const numberOfLinesForNativeText = maxNumberOfLines[maxLines];
|
|
31
34
|
const text = getTransformedText(children, transform);
|
|
32
35
|
const accessibilityProps = hideFromScreenReader
|
|
@@ -8,7 +8,7 @@ const largerLineHeight = tokens["typography--lineHeight-larger"];
|
|
|
8
8
|
const largeLineHeight = tokens["typography--lineHeight-large"];
|
|
9
9
|
const baseLineHeight = tokens["typography--lineHeight-base"];
|
|
10
10
|
const tightLineHeight = tokens["typography--lineHeight-tight"];
|
|
11
|
-
const
|
|
11
|
+
const minusculeLineHeight = tokens["typography--lineHeight-minuscule"];
|
|
12
12
|
const deviceFonts = {
|
|
13
13
|
baseRegularRegular: {
|
|
14
14
|
fontFamily: "inter-regular",
|
|
@@ -25,6 +25,21 @@ const deviceFonts = {
|
|
|
25
25
|
baseRegularExtraBold: {
|
|
26
26
|
fontFamily: "inter-extrabold",
|
|
27
27
|
},
|
|
28
|
+
baseItalicRegular: {
|
|
29
|
+
fontFamily: "inter-italic",
|
|
30
|
+
},
|
|
31
|
+
baseItalicMedium: {
|
|
32
|
+
fontFamily: "inter-italic-medium",
|
|
33
|
+
},
|
|
34
|
+
baseItalicBold: {
|
|
35
|
+
fontFamily: "inter-italic-bold",
|
|
36
|
+
},
|
|
37
|
+
baseItalicSemiBold: {
|
|
38
|
+
fontFamily: "inter-italic-semibold",
|
|
39
|
+
},
|
|
40
|
+
baseItalicExtraBold: {
|
|
41
|
+
fontFamily: "inter-italic-extrabold",
|
|
42
|
+
},
|
|
28
43
|
displayRegularBold: {
|
|
29
44
|
fontFamily: "jobberpro-bd",
|
|
30
45
|
},
|
|
@@ -48,7 +63,9 @@ const fonts = Platform.select({
|
|
|
48
63
|
/**
|
|
49
64
|
* Reusable typography tokens to ensure consistency for any client facing texts.
|
|
50
65
|
*/
|
|
51
|
-
export const typographyTokens = Object.assign(Object.assign({}, fonts), {
|
|
66
|
+
export const typographyTokens = Object.assign(Object.assign({}, fonts), { italic: {
|
|
67
|
+
fontStyle: "italic",
|
|
68
|
+
}, startAlign: {
|
|
52
69
|
textAlign: "left",
|
|
53
70
|
}, endAlign: {
|
|
54
71
|
textAlign: "right",
|
|
@@ -158,7 +175,7 @@ export const typographyTokens = Object.assign(Object.assign({}, fonts), { startA
|
|
|
158
175
|
color: tokens["color-disabled"],
|
|
159
176
|
}, smallestSize: {
|
|
160
177
|
fontSize: tokens["typography--fontSize-smallest"],
|
|
161
|
-
lineHeight:
|
|
178
|
+
lineHeight: minusculeLineHeight,
|
|
162
179
|
}, smallerSize: {
|
|
163
180
|
fontSize: tokens["typography--fontSize-smaller"],
|
|
164
181
|
lineHeight: tightLineHeight,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
+
import { androidTokens, iosTokens } from "@jobber/design";
|
|
2
3
|
export const tokens = Platform.select({
|
|
3
|
-
ios: () =>
|
|
4
|
-
android: () =>
|
|
5
|
-
default: () =>
|
|
4
|
+
ios: () => iosTokens,
|
|
5
|
+
android: () => androidTokens,
|
|
6
|
+
default: () => androidTokens,
|
|
6
7
|
})();
|