@jobber/components-native 0.74.1-JOB-97734-ac441a7.1 → 0.74.1-node22-3bf0edd.11

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.
@@ -1,21 +1,12 @@
1
1
  /// <reference types="react" />
2
+ import { styles } from "./Divider.style";
2
3
  interface DividerProps {
3
4
  /**
4
5
  * The weight of the divider.
5
6
  *
6
7
  * @default "base"
7
8
  */
8
- readonly size?: "base" | "large" | "larger" | "largest";
9
- /**
10
- * The direction of the divider
11
- *
12
- * @default "horizontal"
13
- */
14
- readonly direction?: "horizontal" | "vertical";
15
- /**
16
- * Used to locate this view in end-to-end tests.
17
- */
18
- readonly testID?: string;
9
+ readonly size?: keyof typeof styles;
19
10
  }
20
- export declare function Divider({ size, direction, testID, }: DividerProps): JSX.Element;
11
+ export declare function Divider({ size }: DividerProps): JSX.Element;
21
12
  export {};
@@ -1,19 +1,14 @@
1
- export declare const horizontalStyles: {
1
+ export declare const styles: {
2
2
  base: {
3
3
  height: number;
4
4
  margin: number;
5
- width: "auto";
6
- borderBottomColor: string;
7
5
  borderBottomWidth: number;
6
+ borderBottomColor: string;
8
7
  };
9
8
  large: {
10
9
  borderBottomWidth: number;
11
10
  opacity: number;
12
11
  };
13
- larger: {
14
- borderBottomWidth: number;
15
- opacity: number;
16
- };
17
12
  largest: {
18
13
  borderBottomWidth: number;
19
14
  opacity: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.74.1-JOB-97734-ac441a7.1+ac441a7b",
3
+ "version": "0.74.1-node22-3bf0edd.11+3bf0eddd",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -79,5 +79,5 @@
79
79
  "react-native-safe-area-context": "^4.5.2",
80
80
  "react-native-svg": ">=12.0.0"
81
81
  },
82
- "gitHead": "ac441a7b169aceadaad1e902affbcd547634b9d7"
82
+ "gitHead": "3bf0eddd96dc11bb9646a691deaa3992b689e982"
83
83
  }
@@ -1,22 +1,17 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { tokens } from "../utils/design";
3
3
 
4
- export const horizontalStyles = StyleSheet.create({
4
+ export const styles = StyleSheet.create({
5
5
  base: {
6
6
  height: tokens["space-minuscule"],
7
7
  margin: 0,
8
- width: "auto",
8
+ borderBottomWidth: tokens["border-base"],
9
9
  borderBottomColor: tokens["color-border"],
10
- borderBottomWidth: tokens["space-minuscule"],
11
10
  },
12
11
  large: {
13
12
  borderBottomWidth: tokens["border-thick"],
14
13
  opacity: 0.875,
15
14
  },
16
- larger: {
17
- borderBottomWidth: tokens["border-thicker"],
18
- opacity: 0.625,
19
- },
20
15
  largest: {
21
16
  borderBottomWidth: tokens["space-small"],
22
17
  opacity: 0.375,
@@ -1,71 +1,32 @@
1
1
  import React from "react";
2
2
  import { render } from "@testing-library/react-native";
3
3
  import { Divider } from "./Divider";
4
- import { horizontalStyles } from "./DividerHorizontal.style";
5
- import { verticalStyles } from "./DividerVertical.style";
4
+ import { styles } from "./Divider.style";
6
5
 
7
6
  const dividerTestId = "Divider";
8
7
 
9
8
  describe("Divider", () => {
10
- it("uses the given testID", () => {
11
- const dividerTestID = "divider-test";
12
- const { getByTestId } = render(<Divider testID={dividerTestID} />);
13
- expect(getByTestId(dividerTestID)).toBeDefined();
9
+ it("renders a default Divider", () => {
10
+ const { getByTestId } = render(<Divider />);
11
+ const dividerStyle = getByTestId(dividerTestId).props.style;
12
+ expect(dividerStyle).toContainEqual(styles.base);
13
+ expect(dividerStyle).not.toContainEqual(styles.large);
14
+ expect(dividerStyle).not.toContainEqual(styles.largest);
14
15
  });
15
16
 
16
- describe("Horizontal", () => {
17
- it("renders a default Divider", () => {
18
- const { getByTestId } = render(<Divider />);
19
- const dividerStyle = getByTestId(dividerTestId).props.style;
20
- expect(dividerStyle).toContainEqual(horizontalStyles.base);
21
- expect(dividerStyle).not.toContainEqual(horizontalStyles.large);
22
- expect(dividerStyle).not.toContainEqual(horizontalStyles.largest);
23
- });
24
-
25
- it("renders a large Divider", () => {
26
- const { getByTestId } = render(<Divider size="large" />);
27
- const dividerStyle = getByTestId(dividerTestId).props.style;
28
- expect(dividerStyle).toContainEqual(horizontalStyles.base);
29
- expect(dividerStyle).toContainEqual(horizontalStyles.large);
30
- expect(dividerStyle).not.toContainEqual(horizontalStyles.largest);
31
- });
32
-
33
- it("renders a largest Divider", () => {
34
- const { getByTestId } = render(<Divider size="largest" />);
35
- const dividerStyle = getByTestId(dividerTestId).props.style;
36
- expect(dividerStyle).toContainEqual(horizontalStyles.base);
37
- expect(dividerStyle).not.toContainEqual(horizontalStyles.large);
38
- expect(dividerStyle).toContainEqual(horizontalStyles.largest);
39
- });
17
+ it("renders a large Divider", () => {
18
+ const { getByTestId } = render(<Divider size="large" />);
19
+ const dividerStyle = getByTestId(dividerTestId).props.style;
20
+ expect(dividerStyle).toContainEqual(styles.base);
21
+ expect(dividerStyle).toContainEqual(styles.large);
22
+ expect(dividerStyle).not.toContainEqual(styles.largest);
40
23
  });
41
24
 
42
- describe("Vertical", () => {
43
- it("renders a default Divider", () => {
44
- const { getByTestId } = render(<Divider direction="vertical" />);
45
- const dividerStyle = getByTestId(dividerTestId).props.style;
46
- expect(dividerStyle).toContainEqual(verticalStyles.base);
47
- expect(dividerStyle).not.toContainEqual(verticalStyles.large);
48
- expect(dividerStyle).not.toContainEqual(verticalStyles.largest);
49
- });
50
-
51
- it("renders a large Divider", () => {
52
- const { getByTestId } = render(
53
- <Divider direction="vertical" size="large" />,
54
- );
55
- const dividerStyle = getByTestId(dividerTestId).props.style;
56
- expect(dividerStyle).toContainEqual(verticalStyles.base);
57
- expect(dividerStyle).toContainEqual(verticalStyles.large);
58
- expect(dividerStyle).not.toContainEqual(verticalStyles.largest);
59
- });
60
-
61
- it("renders a largest Divider", () => {
62
- const { getByTestId } = render(
63
- <Divider direction="vertical" size="largest" />,
64
- );
65
- const dividerStyle = getByTestId(dividerTestId).props.style;
66
- expect(dividerStyle).toContainEqual(verticalStyles.base);
67
- expect(dividerStyle).not.toContainEqual(verticalStyles.large);
68
- expect(dividerStyle).toContainEqual(verticalStyles.largest);
69
- });
25
+ it("renders a largest Divider", () => {
26
+ const { getByTestId } = render(<Divider size="largest" />);
27
+ const dividerStyle = getByTestId(dividerTestId).props.style;
28
+ expect(dividerStyle).toContainEqual(styles.base);
29
+ expect(dividerStyle).not.toContainEqual(styles.large);
30
+ expect(dividerStyle).toContainEqual(styles.largest);
70
31
  });
71
32
  });
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
  import { View } from "react-native";
3
- import { horizontalStyles } from "./DividerHorizontal.style";
4
- import { verticalStyles } from "./DividerVertical.style";
3
+ import { styles } from "./Divider.style";
5
4
 
6
5
  interface DividerProps {
7
6
  /**
@@ -9,32 +8,15 @@ interface DividerProps {
9
8
  *
10
9
  * @default "base"
11
10
  */
12
- readonly size?: "base" | "large" | "larger" | "largest";
13
- /**
14
- * The direction of the divider
15
- *
16
- * @default "horizontal"
17
- */
18
- readonly direction?: "horizontal" | "vertical";
19
- /**
20
- * Used to locate this view in end-to-end tests.
21
- */
22
- readonly testID?: string;
11
+ readonly size?: keyof typeof styles;
23
12
  }
24
13
 
25
- export function Divider({
26
- size = "base",
27
- direction = "horizontal",
28
- testID = "Divider",
29
- }: DividerProps): JSX.Element {
30
- const directionalStyles =
31
- direction === "horizontal" ? horizontalStyles : verticalStyles;
14
+ export function Divider({ size = "base" }: DividerProps): JSX.Element {
32
15
  const style = [
33
- directionalStyles.base,
34
- size === "large" && directionalStyles.large,
35
- size === "larger" && directionalStyles.larger,
36
- size === "largest" && directionalStyles.largest,
16
+ styles.base,
17
+ size === "large" && styles.large,
18
+ size === "largest" && styles.largest,
37
19
  ];
38
20
 
39
- return <View testID={testID} style={style} />;
21
+ return <View testID="Divider" style={style} />;
40
22
  }
@@ -1,23 +0,0 @@
1
- import { StyleSheet } from "react-native";
2
- import { tokens } from "../utils/design";
3
- export const verticalStyles = StyleSheet.create({
4
- base: {
5
- margin: 0,
6
- height: "100%",
7
- width: tokens["space-minuscule"],
8
- borderRightWidth: tokens["border-base"],
9
- borderRightColor: tokens["color-border"],
10
- },
11
- large: {
12
- borderRightWidth: tokens["border-thick"],
13
- opacity: 0.875,
14
- },
15
- larger: {
16
- borderRightWidth: tokens["border-thicker"],
17
- opacity: 0.625,
18
- },
19
- largest: {
20
- borderRightWidth: tokens["space-small"],
21
- opacity: 0.375,
22
- },
23
- });
@@ -1,21 +0,0 @@
1
- export declare const verticalStyles: {
2
- base: {
3
- margin: number;
4
- height: "100%";
5
- width: number;
6
- borderRightWidth: number;
7
- borderRightColor: string;
8
- };
9
- large: {
10
- borderRightWidth: number;
11
- opacity: number;
12
- };
13
- larger: {
14
- borderRightWidth: number;
15
- opacity: number;
16
- };
17
- largest: {
18
- borderRightWidth: number;
19
- opacity: number;
20
- };
21
- };
@@ -1,24 +0,0 @@
1
- import { StyleSheet } from "react-native";
2
- import { tokens } from "../utils/design";
3
-
4
- export const verticalStyles = StyleSheet.create({
5
- base: {
6
- margin: 0,
7
- height: "100%",
8
- width: tokens["space-minuscule"],
9
- borderRightWidth: tokens["border-base"],
10
- borderRightColor: tokens["color-border"],
11
- },
12
- large: {
13
- borderRightWidth: tokens["border-thick"],
14
- opacity: 0.875,
15
- },
16
- larger: {
17
- borderRightWidth: tokens["border-thicker"],
18
- opacity: 0.625,
19
- },
20
- largest: {
21
- borderRightWidth: tokens["space-small"],
22
- opacity: 0.375,
23
- },
24
- });