@jobber/components-native 0.89.5-JOB-140604-8777ec5.52 → 0.89.5-JOB-140604-4487daa.55

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,11 +1,6 @@
1
1
  export declare const useStyles: () => {
2
2
  backdrop: {
3
3
  backgroundColor: string;
4
- position: "absolute";
5
- left: 0;
6
- right: 0;
7
- top: 0;
8
- bottom: 0;
9
4
  };
10
5
  background: {
11
6
  borderTopLeftRadius: number;
@@ -13,9 +8,7 @@ export declare const useStyles: () => {
13
8
  };
14
9
  content: {
15
10
  paddingVertical: number;
16
- };
17
- footer: {
18
- paddingBottom: number;
11
+ flex: number;
19
12
  };
20
13
  footerContainer: {
21
14
  backgroundColor: string;
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import React from "react";
3
3
  import type { StyleProp, ViewStyle } from "react-native";
4
- export type Spacing = "none" | "base" | "small" | "smaller" | "smallest" | "large";
4
+ export type Spacing = "none" | "base" | "slim" | "small" | "smaller" | "smallest" | "minuscule" | "large" | "larger" | "largest" | "extravagant";
5
5
  export interface ContentUnsafeStyle {
6
6
  container?: StyleProp<ViewStyle>;
7
7
  childWrapper?: StyleProp<ViewStyle>;
@@ -10,6 +10,9 @@ export declare const useHorizontalStyles: () => {
10
10
  noneChildSpace: {
11
11
  padding: number;
12
12
  };
13
+ minusculeChildSpace: {
14
+ paddingLeft: number;
15
+ };
13
16
  smallestChildSpace: {
14
17
  paddingLeft: number;
15
18
  };
@@ -19,10 +22,22 @@ export declare const useHorizontalStyles: () => {
19
22
  smallChildSpace: {
20
23
  paddingLeft: number;
21
24
  };
25
+ slimChildSpace: {
26
+ paddingLeft: number;
27
+ };
22
28
  baseChildSpace: {
23
29
  paddingLeft: number;
24
30
  };
25
31
  largeChildSpace: {
26
32
  paddingLeft: number;
27
33
  };
34
+ largerChildSpace: {
35
+ paddingLeft: number;
36
+ };
37
+ largestChildSpace: {
38
+ paddingLeft: number;
39
+ };
40
+ extravagantChildSpace: {
41
+ paddingLeft: number;
42
+ };
28
43
  };
@@ -2,6 +2,9 @@ export declare const useSpaceAroundStyles: () => {
2
2
  noneSpace: {
3
3
  padding: number;
4
4
  };
5
+ minusculeSpace: {
6
+ padding: number;
7
+ };
5
8
  smallestSpace: {
6
9
  padding: number;
7
10
  };
@@ -11,10 +14,22 @@ export declare const useSpaceAroundStyles: () => {
11
14
  smallSpace: {
12
15
  padding: number;
13
16
  };
17
+ slimSpace: {
18
+ padding: number;
19
+ };
14
20
  baseSpace: {
15
21
  padding: number;
16
22
  };
17
23
  largeSpace: {
18
24
  padding: number;
19
25
  };
26
+ largerSpace: {
27
+ padding: number;
28
+ };
29
+ largestSpace: {
30
+ padding: number;
31
+ };
32
+ extravagantSpace: {
33
+ padding: number;
34
+ };
20
35
  };
@@ -4,6 +4,9 @@ export declare const useVerticalStyles: () => {
4
4
  noneChildSpace: {
5
5
  padding: number;
6
6
  };
7
+ minusculeChildSpace: {
8
+ paddingTop: number;
9
+ };
7
10
  smallestChildSpace: {
8
11
  paddingTop: number;
9
12
  };
@@ -13,10 +16,22 @@ export declare const useVerticalStyles: () => {
13
16
  smallChildSpace: {
14
17
  paddingTop: number;
15
18
  };
19
+ slimChildSpace: {
20
+ paddingTop: number;
21
+ };
16
22
  baseChildSpace: {
17
23
  paddingTop: number;
18
24
  };
19
25
  largeChildSpace: {
20
26
  paddingTop: number;
21
27
  };
28
+ largerChildSpace: {
29
+ paddingTop: number;
30
+ };
31
+ largestChildSpace: {
32
+ paddingTop: number;
33
+ };
34
+ extravagantChildSpace: {
35
+ paddingTop: number;
36
+ };
22
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.89.5-JOB-140604-8777ec5.52+8777ec587",
3
+ "version": "0.89.5-JOB-140604-4487daa.55+4487daa56",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -96,5 +96,5 @@
96
96
  "react-native-safe-area-context": "^5.4.0",
97
97
  "react-native-svg": ">=12.0.0"
98
98
  },
99
- "gitHead": "8777ec5874ee31d4d513ca4ddc477228a383efb6"
99
+ "gitHead": "4487daa56640c85a2198bde0b6296c4a290f623a"
100
100
  }
@@ -1,4 +1,3 @@
1
- import { StyleSheet } from "react-native";
2
1
  import { buildThemedStyles } from "../AtlantisThemeContext";
3
2
 
4
3
  export const useStyles = buildThemedStyles(tokens => {
@@ -6,7 +5,6 @@ export const useStyles = buildThemedStyles(tokens => {
6
5
 
7
6
  return {
8
7
  backdrop: {
9
- ...StyleSheet.absoluteFillObject,
10
8
  backgroundColor: tokens["color-overlay"],
11
9
  },
12
10
  background: {
@@ -15,9 +13,7 @@ export const useStyles = buildThemedStyles(tokens => {
15
13
  },
16
14
  content: {
17
15
  paddingVertical: tokens["space-small"],
18
- },
19
- footer: {
20
- paddingBottom: tokens["space-small"],
16
+ flex: 1,
21
17
  },
22
18
  footerContainer: {
23
19
  backgroundColor: tokens["color-surface"],
@@ -4,13 +4,10 @@ import { Keyboard, View } from "react-native";
4
4
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
5
  import RNBottomSheet, {
6
6
  BottomSheetBackdrop,
7
- BottomSheetFooter,
8
7
  BottomSheetView,
9
8
  } from "@gorhom/bottom-sheet";
10
- import type {
11
- BottomSheetBackdropProps,
12
- BottomSheetFooterProps,
13
- } from "@gorhom/bottom-sheet";
9
+ import type { BottomSheetBackdropProps } from "@gorhom/bottom-sheet";
10
+ import { tokens } from "@jobber/design";
14
11
  import { useStyles } from "./BottomSheet.style";
15
12
  import { BottomSheetOption } from "./components/BottomSheetOption";
16
13
  import { useBottomSheetBackHandler } from "./hooks/useBottomSheetBackHandler";
@@ -79,10 +76,14 @@ export function BottomSheet({
79
76
  bottomSheetRef.current?.expand();
80
77
  },
81
78
  close: () => {
82
- bottomSheetRef.current?.close();
79
+ close();
83
80
  },
84
81
  }));
85
82
 
83
+ const close = useCallback(() => {
84
+ bottomSheetRef.current?.close();
85
+ }, []);
86
+
86
87
  const handleChange = (index: number) => {
87
88
  // Handle Android back button
88
89
  handleSheetPositionChange(index);
@@ -102,52 +103,28 @@ export function BottomSheet({
102
103
  previousIndexRef.current = index;
103
104
  };
104
105
 
105
- const renderFooter = useCallback(
106
- (bottomSheetFooterProps: BottomSheetFooterProps) => {
107
- return (
108
- <BottomSheetFooter {...bottomSheetFooterProps}>
109
- <View
110
- style={[styles.footerContainer, { paddingBottom: insets.bottom }]}
111
- >
112
- {cancellable && (
113
- <View style={styles.footer}>
114
- <View style={styles.footerDivider}>
115
- <Divider />
116
- </View>
117
- <BottomSheetOption
118
- text={t("cancel")}
119
- icon={"remove"}
120
- onPress={() => {
121
- bottomSheetRef.current?.close();
122
- }}
123
- />
124
- </View>
125
- )}
126
- </View>
127
- </BottomSheetFooter>
128
- );
129
- },
130
- [cancellable],
131
- );
132
-
133
106
  return (
134
107
  <RNBottomSheet
135
108
  ref={bottomSheetRef}
136
109
  index={-1}
137
110
  backdropComponent={Backdrop}
138
111
  backgroundStyle={styles.background}
139
- footerComponent={renderFooter}
140
112
  enablePanDownToClose={true}
141
113
  onChange={handleChange}
142
114
  keyboardBlurBehavior="restore"
143
115
  handleStyle={styles.handle}
144
116
  >
145
117
  <BottomSheetView
146
- style={styles.content}
147
- enableFooterMarginAdjustment={true}
118
+ style={[
119
+ styles.content,
120
+ { paddingBottom: insets.bottom + tokens["space-small"] },
121
+ ]}
148
122
  >
149
123
  {heading && <Header heading={heading} styles={styles} />}
150
124
  {children}
125
+ {cancellable && (
126
+ <Footer styles={styles} close={close} cancelLabel={t("cancel")} />
127
+ )}
151
128
  </BottomSheetView>
152
129
  </RNBottomSheet>
153
130
  );
@@ -167,6 +144,26 @@ function Header({
167
144
  );
168
145
  }
169
146
 
147
+ function Footer({
148
+ styles,
149
+ close,
150
+ cancelLabel,
151
+ }: {
152
+ readonly styles: ReturnType<typeof useStyles>;
153
+ readonly close: () => void;
154
+ readonly cancelLabel: string;
155
+ }) {
156
+ return (
157
+ <View>
158
+ <View style={styles.footerDivider}>
159
+ <Divider />
160
+ </View>
161
+
162
+ <BottomSheetOption text={cancelLabel} icon="remove" onPress={close} />
163
+ </View>
164
+ );
165
+ }
166
+
170
167
  function dismissKeyboard() {
171
168
  //Dismisses the keyboard before opening the bottom sheet.
172
169
  //In the case where an input text field is focused we don't want to show the bottom sheet behind or above keyboard
@@ -9,10 +9,15 @@ import { useSpaceAroundStyles } from "./ContentSpaceAround.style";
9
9
  export type Spacing =
10
10
  | "none"
11
11
  | "base"
12
+ | "slim"
12
13
  | "small"
13
14
  | "smaller"
14
15
  | "smallest"
15
- | "large";
16
+ | "minuscule"
17
+ | "large"
18
+ | "larger"
19
+ | "largest"
20
+ | "extravagant";
16
21
 
17
22
  export interface ContentUnsafeStyle {
18
23
  container?: StyleProp<ViewStyle>;
@@ -16,6 +16,10 @@ export const useHorizontalStyles = buildThemedStyles(tokens => {
16
16
  padding: 0,
17
17
  },
18
18
 
19
+ minusculeChildSpace: {
20
+ paddingLeft: tokens["space-minuscule"],
21
+ },
22
+
19
23
  smallestChildSpace: {
20
24
  paddingLeft: tokens["space-smallest"],
21
25
  },
@@ -28,6 +32,10 @@ export const useHorizontalStyles = buildThemedStyles(tokens => {
28
32
  paddingLeft: tokens["space-small"],
29
33
  },
30
34
 
35
+ slimChildSpace: {
36
+ paddingLeft: tokens["space-slim"],
37
+ },
38
+
31
39
  baseChildSpace: {
32
40
  paddingLeft: tokens["space-base"],
33
41
  },
@@ -35,5 +43,17 @@ export const useHorizontalStyles = buildThemedStyles(tokens => {
35
43
  largeChildSpace: {
36
44
  paddingLeft: tokens["space-large"],
37
45
  },
46
+
47
+ largerChildSpace: {
48
+ paddingLeft: tokens["space-larger"],
49
+ },
50
+
51
+ largestChildSpace: {
52
+ paddingLeft: tokens["space-largest"],
53
+ },
54
+
55
+ extravagantChildSpace: {
56
+ paddingLeft: tokens["space-extravagant"],
57
+ },
38
58
  };
39
59
  });
@@ -6,6 +6,10 @@ export const useSpaceAroundStyles = buildThemedStyles(tokens => {
6
6
  padding: 0,
7
7
  },
8
8
 
9
+ minusculeSpace: {
10
+ padding: tokens["space-minuscule"],
11
+ },
12
+
9
13
  smallestSpace: {
10
14
  padding: tokens["space-smallest"],
11
15
  },
@@ -18,6 +22,10 @@ export const useSpaceAroundStyles = buildThemedStyles(tokens => {
18
22
  padding: tokens["space-small"],
19
23
  },
20
24
 
25
+ slimSpace: {
26
+ padding: tokens["space-slim"],
27
+ },
28
+
21
29
  baseSpace: {
22
30
  padding: tokens["space-base"],
23
31
  },
@@ -25,5 +33,17 @@ export const useSpaceAroundStyles = buildThemedStyles(tokens => {
25
33
  largeSpace: {
26
34
  padding: tokens["space-large"],
27
35
  },
36
+
37
+ largerSpace: {
38
+ padding: tokens["space-larger"],
39
+ },
40
+
41
+ largestSpace: {
42
+ padding: tokens["space-largest"],
43
+ },
44
+
45
+ extravagantSpace: {
46
+ padding: tokens["space-extravagant"],
47
+ },
28
48
  };
29
49
  });
@@ -16,6 +16,10 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
16
16
  padding: 0,
17
17
  },
18
18
 
19
+ minusculeChildSpace: {
20
+ paddingTop: tokens["space-minuscule"],
21
+ },
22
+
19
23
  smallestChildSpace: {
20
24
  paddingTop: tokens["space-smallest"],
21
25
  },
@@ -28,6 +32,10 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
28
32
  paddingTop: tokens["space-small"],
29
33
  },
30
34
 
35
+ slimChildSpace: {
36
+ paddingTop: tokens["space-slim"],
37
+ },
38
+
31
39
  baseChildSpace: {
32
40
  paddingTop: tokens["space-base"],
33
41
  },
@@ -35,5 +43,17 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
35
43
  largeChildSpace: {
36
44
  paddingTop: tokens["space-large"],
37
45
  },
46
+
47
+ largerChildSpace: {
48
+ paddingTop: tokens["space-larger"],
49
+ },
50
+
51
+ largestChildSpace: {
52
+ paddingTop: tokens["space-largest"],
53
+ },
54
+
55
+ extravagantChildSpace: {
56
+ paddingTop: tokens["space-extravagant"],
57
+ },
38
58
  };
39
59
  });
@@ -174,11 +174,16 @@ exports[`renders a thumbnail component with attachments 1`] = `
174
174
  testID="bottom-sheet-mock"
175
175
  >
176
176
  <View
177
- enableFooterMarginAdjustment={true}
178
177
  style={
179
- {
180
- "paddingVertical": 8,
181
- }
178
+ [
179
+ {
180
+ "flex": 1,
181
+ "paddingVertical": 8,
182
+ },
183
+ {
184
+ "paddingBottom": 8,
185
+ },
186
+ ]
182
187
  }
183
188
  testID="bottom-sheet-view"
184
189
  >
@@ -347,22 +352,6 @@ exports[`renders a thumbnail component with attachments 1`] = `
347
352
  </View>
348
353
  </View>
349
354
  </View>
350
- <View
351
- testID="bottom-sheet-footer"
352
- >
353
- <View
354
- style={
355
- [
356
- {
357
- "backgroundColor": "rgba(255, 255, 255, 1)",
358
- },
359
- {
360
- "paddingBottom": 0,
361
- },
362
- ]
363
- }
364
- />
365
- </View>
366
355
  </View>
367
356
  </View>,
368
357
  ]