@jobber/components-native 0.84.4-match-mobi-55ef4ec.7 → 0.84.4-revert-269-4fbaea5.19
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 +3 -3
- package/dist/src/StatusLabel/StatusLabel.js +12 -6
- package/dist/src/StatusLabel/StatusLabel.style.js +13 -9
- package/dist/src/index.js +0 -1
- package/dist/src/utils/meta/meta.json +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/StatusLabel/StatusLabel.d.ts +3 -3
- package/dist/types/src/StatusLabel/StatusLabel.style.d.ts +10 -9
- package/dist/types/src/index.d.ts +0 -1
- package/package.json +3 -3
- package/src/StatusLabel/StatusLabel.style.ts +16 -9
- package/src/StatusLabel/StatusLabel.tsx +28 -15
- package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +105 -126
- package/src/index.ts +0 -1
- package/src/utils/meta/meta.json +0 -1
- package/dist/src/StatusIndicator/StatusIndicator.js +0 -11
- package/dist/src/StatusIndicator/StatusIndicator.style.js +0 -12
- package/dist/src/StatusIndicator/StatusIndicator.type.js +0 -1
- package/dist/src/StatusIndicator/index.js +0 -1
- package/dist/types/src/StatusIndicator/StatusIndicator.d.ts +0 -6
- package/dist/types/src/StatusIndicator/StatusIndicator.style.d.ts +0 -8
- package/dist/types/src/StatusIndicator/StatusIndicator.type.d.ts +0 -1
- package/dist/types/src/StatusIndicator/index.d.ts +0 -2
- package/src/StatusIndicator/StatusIndicator.style.ts +0 -14
- package/src/StatusIndicator/StatusIndicator.test.tsx +0 -42
- package/src/StatusIndicator/StatusIndicator.tsx +0 -23
- package/src/StatusIndicator/StatusIndicator.type.ts +0 -6
- package/src/StatusIndicator/__snapshots__/StatusIndicator.test.tsx.snap +0 -96
- package/src/StatusIndicator/index.ts +0 -2
|
@@ -5,15 +5,15 @@ export interface StatusLabelType {
|
|
|
5
5
|
}
|
|
6
6
|
interface StatusLabelProps {
|
|
7
7
|
/**
|
|
8
|
-
* Text to display
|
|
8
|
+
* Text to display.
|
|
9
9
|
*/
|
|
10
10
|
readonly text: string;
|
|
11
11
|
/**
|
|
12
|
-
* Alignment of text
|
|
12
|
+
* Alignment of text
|
|
13
13
|
*/
|
|
14
14
|
readonly alignment?: "start" | "end";
|
|
15
15
|
/**
|
|
16
|
-
* Status color of
|
|
16
|
+
* Status color of the square beside text
|
|
17
17
|
*/
|
|
18
18
|
readonly status?: StatusType;
|
|
19
19
|
}
|
|
@@ -2,21 +2,22 @@ export declare const useStyles: () => {
|
|
|
2
2
|
statusLabelRow: {
|
|
3
3
|
flexDirection: "row";
|
|
4
4
|
justifyContent: "flex-end";
|
|
5
|
-
alignItems: "center";
|
|
6
5
|
flexWrap: "nowrap";
|
|
7
|
-
flexGrow: number;
|
|
8
|
-
flexShrink: number;
|
|
9
|
-
gap: number;
|
|
10
|
-
backgroundColor: string;
|
|
11
|
-
borderRadius: number;
|
|
12
|
-
paddingVertical: number;
|
|
13
|
-
paddingHorizontal: number;
|
|
14
6
|
};
|
|
15
7
|
statusLabelText: {
|
|
16
8
|
flexShrink: number;
|
|
17
|
-
|
|
9
|
+
};
|
|
10
|
+
statusLabelIcon: {
|
|
11
|
+
borderRadius: number;
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
marginTop: number;
|
|
18
16
|
};
|
|
19
17
|
labelTextStartAligned: {
|
|
20
18
|
flexDirection: "row-reverse";
|
|
21
19
|
};
|
|
20
|
+
innerPad: {
|
|
21
|
+
width: number;
|
|
22
|
+
};
|
|
22
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.84.4-
|
|
3
|
+
"version": "0.84.4-revert-269-4fbaea5.19+4fbaea559",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"compile": "tsc -b",
|
|
36
36
|
"build:clean": "rm -rf ./dist",
|
|
37
37
|
"storybook": "storybook dev -p 6008 --disable-telemetry",
|
|
38
|
-
"build
|
|
38
|
+
"storybook:build": "storybook build --disable-telemetry"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@react-native-clipboard/clipboard": "^1.11.2",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"react-native-safe-area-context": "^5.4.0",
|
|
86
86
|
"react-native-svg": ">=12.0.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "4fbaea5594688ec1dcbfc12a090d798aa9676c72"
|
|
89
89
|
}
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { buildThemedStyles } from "../AtlantisThemeContext";
|
|
2
2
|
|
|
3
|
+
const statusLabelRadius = 3; // Needs to be hardcoded to 3 as this shouldn't change with the tokens
|
|
4
|
+
|
|
3
5
|
export const useStyles = buildThemedStyles(tokens => {
|
|
6
|
+
const statusLabelIconDiameter =
|
|
7
|
+
tokens["space-base"] - tokens["space-smaller"]; //12px
|
|
8
|
+
const indicatorOffset = tokens["space-smallest"] + tokens["space-minuscule"];
|
|
9
|
+
|
|
4
10
|
return {
|
|
5
11
|
statusLabelRow: {
|
|
6
12
|
flexDirection: "row",
|
|
7
13
|
justifyContent: "flex-end",
|
|
8
|
-
alignItems: "center",
|
|
9
14
|
flexWrap: "nowrap",
|
|
10
|
-
flexGrow: 0,
|
|
11
|
-
flexShrink: 1,
|
|
12
|
-
gap: tokens["space-smaller"],
|
|
13
|
-
backgroundColor: tokens["color-success--surface"],
|
|
14
|
-
borderRadius: tokens["radius-large"],
|
|
15
|
-
paddingVertical: tokens["space-smaller"],
|
|
16
|
-
paddingHorizontal: tokens["space-small"],
|
|
17
15
|
},
|
|
18
16
|
statusLabelText: {
|
|
19
17
|
flexShrink: 1,
|
|
20
|
-
|
|
18
|
+
},
|
|
19
|
+
statusLabelIcon: {
|
|
20
|
+
borderRadius: statusLabelRadius,
|
|
21
|
+
backgroundColor: tokens["color-success"],
|
|
22
|
+
width: statusLabelIconDiameter,
|
|
23
|
+
height: statusLabelIconDiameter,
|
|
24
|
+
marginTop: indicatorOffset,
|
|
21
25
|
},
|
|
22
26
|
labelTextStartAligned: {
|
|
23
27
|
flexDirection: "row-reverse",
|
|
24
28
|
},
|
|
29
|
+
innerPad: {
|
|
30
|
+
width: tokens["space-small"],
|
|
31
|
+
},
|
|
25
32
|
};
|
|
26
33
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { useStyles } from "./StatusLabel.style";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { tokens } from "../utils/design";
|
|
4
|
+
import { Text } from "../Text";
|
|
5
|
+
import { useAtlantisTheme } from "../AtlantisThemeContext";
|
|
7
6
|
|
|
8
7
|
export type StatusType =
|
|
9
8
|
| "success"
|
|
@@ -19,17 +18,17 @@ export interface StatusLabelType {
|
|
|
19
18
|
|
|
20
19
|
interface StatusLabelProps {
|
|
21
20
|
/**
|
|
22
|
-
* Text to display
|
|
21
|
+
* Text to display.
|
|
23
22
|
*/
|
|
24
23
|
readonly text: string;
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
|
-
* Alignment of text
|
|
26
|
+
* Alignment of text
|
|
28
27
|
*/
|
|
29
28
|
readonly alignment?: "start" | "end";
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
|
-
* Status color of
|
|
31
|
+
* Status color of the square beside text
|
|
33
32
|
*/
|
|
34
33
|
readonly status?: StatusType;
|
|
35
34
|
}
|
|
@@ -45,21 +44,35 @@ export function StatusLabel({
|
|
|
45
44
|
<View
|
|
46
45
|
style={[
|
|
47
46
|
styles.statusLabelRow,
|
|
48
|
-
{ backgroundColor: tokens[`color-${status}--surface`] },
|
|
49
47
|
alignment === "start" && styles.labelTextStartAligned,
|
|
50
48
|
]}
|
|
51
49
|
>
|
|
52
50
|
<View style={styles.statusLabelText}>
|
|
53
|
-
<
|
|
54
|
-
align={alignment}
|
|
55
|
-
size="smaller"
|
|
56
|
-
fontWeight="medium"
|
|
57
|
-
color={`${status}OnSurface`}
|
|
58
|
-
>
|
|
51
|
+
<Text align={alignment} level="textSupporting" variation="subdued">
|
|
59
52
|
{text}
|
|
60
|
-
</
|
|
53
|
+
</Text>
|
|
61
54
|
</View>
|
|
62
|
-
<
|
|
55
|
+
<View style={styles.innerPad} />
|
|
56
|
+
<StatusLabelIcon status={status} styles={styles} />
|
|
63
57
|
</View>
|
|
64
58
|
);
|
|
65
59
|
}
|
|
60
|
+
|
|
61
|
+
interface StatusLabelIconProps {
|
|
62
|
+
readonly status: StatusType;
|
|
63
|
+
readonly styles: ReturnType<typeof useStyles>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function StatusLabelIcon({ status, styles }: StatusLabelIconProps) {
|
|
67
|
+
const { tokens } = useAtlantisTheme();
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<View
|
|
71
|
+
testID={`${status}LabelIcon`}
|
|
72
|
+
style={[
|
|
73
|
+
styles.statusLabelIcon,
|
|
74
|
+
{ backgroundColor: tokens[`color-${status}`] },
|
|
75
|
+
]}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|