@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.
Files changed (29) hide show
  1. package/dist/package.json +3 -3
  2. package/dist/src/StatusLabel/StatusLabel.js +12 -6
  3. package/dist/src/StatusLabel/StatusLabel.style.js +13 -9
  4. package/dist/src/index.js +0 -1
  5. package/dist/src/utils/meta/meta.json +0 -1
  6. package/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/types/src/StatusLabel/StatusLabel.d.ts +3 -3
  8. package/dist/types/src/StatusLabel/StatusLabel.style.d.ts +10 -9
  9. package/dist/types/src/index.d.ts +0 -1
  10. package/package.json +3 -3
  11. package/src/StatusLabel/StatusLabel.style.ts +16 -9
  12. package/src/StatusLabel/StatusLabel.tsx +28 -15
  13. package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +105 -126
  14. package/src/index.ts +0 -1
  15. package/src/utils/meta/meta.json +0 -1
  16. package/dist/src/StatusIndicator/StatusIndicator.js +0 -11
  17. package/dist/src/StatusIndicator/StatusIndicator.style.js +0 -12
  18. package/dist/src/StatusIndicator/StatusIndicator.type.js +0 -1
  19. package/dist/src/StatusIndicator/index.js +0 -1
  20. package/dist/types/src/StatusIndicator/StatusIndicator.d.ts +0 -6
  21. package/dist/types/src/StatusIndicator/StatusIndicator.style.d.ts +0 -8
  22. package/dist/types/src/StatusIndicator/StatusIndicator.type.d.ts +0 -1
  23. package/dist/types/src/StatusIndicator/index.d.ts +0 -2
  24. package/src/StatusIndicator/StatusIndicator.style.ts +0 -14
  25. package/src/StatusIndicator/StatusIndicator.test.tsx +0 -42
  26. package/src/StatusIndicator/StatusIndicator.tsx +0 -23
  27. package/src/StatusIndicator/StatusIndicator.type.ts +0 -6
  28. package/src/StatusIndicator/__snapshots__/StatusIndicator.test.tsx.snap +0 -96
  29. 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 and StatusIndicator
12
+ * Alignment of text
13
13
  */
14
14
  readonly alignment?: "start" | "end";
15
15
  /**
16
- * Status color of label container, label, and StatusIndicator
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
- marginBottom: number;
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
  };
@@ -39,7 +39,6 @@ export * from "./Menu";
39
39
  export * from "./ProgressBar";
40
40
  export * from "./Select";
41
41
  export * from "./StatusLabel";
42
- export * from "./StatusIndicator";
43
42
  export * from "./Switch";
44
43
  export * from "./Text";
45
44
  export * from "./TextList";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.84.4-match-mobi-55ef4ec.7+55ef4ec91",
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-storybook": "storybook build --disable-telemetry"
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": "55ef4ec916758fd15610ded5298d293958e665fa"
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
- marginBottom: -1,
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 { Typography } from "../Typography";
5
- import { StatusIndicator } from "../StatusIndicator";
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 and StatusIndicator
26
+ * Alignment of text
28
27
  */
29
28
  readonly alignment?: "start" | "end";
30
29
 
31
30
  /**
32
- * Status color of label container, label, and StatusIndicator
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
- <Typography
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
- </Typography>
53
+ </Text>
61
54
  </View>
62
- <StatusIndicator status={status} />
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
+ }