@jobber/components-native 0.69.5-dependabot.8 → 0.70.0
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 +5 -38
- package/dist/src/InputPressable/InputPressable.style.js +1 -1
- package/dist/src/Typography/Typography.style.js +2 -2
- package/dist/src/utils/design/index.js +4 -3
- package/dist/tsconfig.tsbuildinfo +1 -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 +10 -66
- package/src/InputPressable/InputPressable.style.ts +1 -1
- package/src/Typography/Typography.style.ts +2 -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.
|
|
3
|
+
"version": "0.70.0",
|
|
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.63.1-dependabot.16+d8e3efef",
|
|
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": "02f3d1f70bf477916078b9e03f786783eab62d2e"
|
|
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, 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
13
|
return React.createElement(Path, { key: path, d: path, fill: customColor || svgStyle.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
|
}
|
|
@@ -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",
|
|
@@ -175,7 +175,7 @@ export const typographyTokens = Object.assign(Object.assign({}, fonts), { italic
|
|
|
175
175
|
color: tokens["color-disabled"],
|
|
176
176
|
}, smallestSize: {
|
|
177
177
|
fontSize: tokens["typography--fontSize-smallest"],
|
|
178
|
-
lineHeight:
|
|
178
|
+
lineHeight: minusculeLineHeight,
|
|
179
179
|
}, smallerSize: {
|
|
180
180
|
fontSize: tokens["typography--fontSize-smaller"],
|
|
181
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
|
})();
|