@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.
package/dist/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,7 +1,8 @@
1
1
  import React, { useCallback, useImperativeHandle, useRef } from "react";
2
2
  import { Keyboard, View } from "react-native";
3
3
  import { useSafeAreaInsets } from "react-native-safe-area-context";
4
- import RNBottomSheet, { BottomSheetBackdrop, BottomSheetFooter, BottomSheetView, } from "@gorhom/bottom-sheet";
4
+ import RNBottomSheet, { BottomSheetBackdrop, BottomSheetView, } from "@gorhom/bottom-sheet";
5
+ import { tokens } from "@jobber/design";
5
6
  import { useStyles } from "./BottomSheet.style";
6
7
  import { BottomSheetOption } from "./components/BottomSheetOption";
7
8
  import { useBottomSheetBackHandler } from "./hooks/useBottomSheetBackHandler";
@@ -24,10 +25,13 @@ export function BottomSheet({ children, showCancel, loading = false, heading, on
24
25
  (_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.expand();
25
26
  },
26
27
  close: () => {
27
- var _a;
28
- (_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
28
+ close();
29
29
  },
30
30
  }));
31
+ const close = useCallback(() => {
32
+ var _a;
33
+ (_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
34
+ }, []);
31
35
  const handleChange = (index) => {
32
36
  // Handle Android back button
33
37
  handleSheetPositionChange(index);
@@ -44,25 +48,25 @@ export function BottomSheet({ children, showCancel, loading = false, heading, on
44
48
  }
45
49
  previousIndexRef.current = index;
46
50
  };
47
- const renderFooter = useCallback((bottomSheetFooterProps) => {
48
- return (React.createElement(BottomSheetFooter, Object.assign({}, bottomSheetFooterProps),
49
- React.createElement(View, { style: [styles.footerContainer, { paddingBottom: insets.bottom }] }, cancellable && (React.createElement(View, { style: styles.footer },
50
- React.createElement(View, { style: styles.footerDivider },
51
- React.createElement(Divider, null)),
52
- React.createElement(BottomSheetOption, { text: t("cancel"), icon: "remove", onPress: () => {
53
- var _a;
54
- (_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
55
- } }))))));
56
- }, [cancellable]);
57
- return (React.createElement(RNBottomSheet, { ref: bottomSheetRef, index: -1, backdropComponent: Backdrop, backgroundStyle: styles.background, footerComponent: renderFooter, enablePanDownToClose: true, onChange: handleChange, keyboardBlurBehavior: "restore", handleStyle: styles.handle },
58
- React.createElement(BottomSheetView, { style: styles.content, enableFooterMarginAdjustment: true },
51
+ return (React.createElement(RNBottomSheet, { ref: bottomSheetRef, index: -1, backdropComponent: Backdrop, backgroundStyle: styles.background, enablePanDownToClose: true, onChange: handleChange, keyboardBlurBehavior: "restore", handleStyle: styles.handle },
52
+ React.createElement(BottomSheetView, { style: [
53
+ styles.content,
54
+ { paddingBottom: insets.bottom + tokens["space-small"] },
55
+ ] },
59
56
  heading && React.createElement(Header, { heading: heading, styles: styles }),
60
- children)));
57
+ children,
58
+ cancellable && (React.createElement(Footer, { styles: styles, close: close, cancelLabel: t("cancel") })))));
61
59
  }
62
60
  function Header({ heading, styles, }) {
63
61
  return (React.createElement(View, { style: styles.header },
64
62
  React.createElement(Heading, { level: "subtitle" }, heading)));
65
63
  }
64
+ function Footer({ styles, close, cancelLabel, }) {
65
+ return (React.createElement(View, null,
66
+ React.createElement(View, { style: styles.footerDivider },
67
+ React.createElement(Divider, null)),
68
+ React.createElement(BottomSheetOption, { text: cancelLabel, icon: "remove", onPress: close })));
69
+ }
66
70
  function dismissKeyboard() {
67
71
  //Dismisses the keyboard before opening the bottom sheet.
68
72
  //In the case where an input text field is focused we don't want to show the bottom sheet behind or above keyboard
@@ -1,18 +1,17 @@
1
- import { StyleSheet } from "react-native";
2
1
  import { buildThemedStyles } from "../AtlantisThemeContext";
3
2
  export const useStyles = buildThemedStyles(tokens => {
4
3
  const modalBorderRadius = tokens["radius-larger"];
5
4
  return {
6
- backdrop: Object.assign(Object.assign({}, StyleSheet.absoluteFillObject), { backgroundColor: tokens["color-overlay"] }),
5
+ backdrop: {
6
+ backgroundColor: tokens["color-overlay"],
7
+ },
7
8
  background: {
8
9
  borderTopLeftRadius: modalBorderRadius,
9
10
  borderTopRightRadius: modalBorderRadius,
10
11
  },
11
12
  content: {
12
13
  paddingVertical: tokens["space-small"],
13
- },
14
- footer: {
15
- paddingBottom: tokens["space-small"],
14
+ flex: 1,
16
15
  },
17
16
  footerContainer: {
18
17
  backgroundColor: tokens["color-surface"],
@@ -12,6 +12,9 @@ export const useHorizontalStyles = buildThemedStyles(tokens => {
12
12
  noneChildSpace: {
13
13
  padding: 0,
14
14
  },
15
+ minusculeChildSpace: {
16
+ paddingLeft: tokens["space-minuscule"],
17
+ },
15
18
  smallestChildSpace: {
16
19
  paddingLeft: tokens["space-smallest"],
17
20
  },
@@ -21,11 +24,23 @@ export const useHorizontalStyles = buildThemedStyles(tokens => {
21
24
  smallChildSpace: {
22
25
  paddingLeft: tokens["space-small"],
23
26
  },
27
+ slimChildSpace: {
28
+ paddingLeft: tokens["space-slim"],
29
+ },
24
30
  baseChildSpace: {
25
31
  paddingLeft: tokens["space-base"],
26
32
  },
27
33
  largeChildSpace: {
28
34
  paddingLeft: tokens["space-large"],
29
35
  },
36
+ largerChildSpace: {
37
+ paddingLeft: tokens["space-larger"],
38
+ },
39
+ largestChildSpace: {
40
+ paddingLeft: tokens["space-largest"],
41
+ },
42
+ extravagantChildSpace: {
43
+ paddingLeft: tokens["space-extravagant"],
44
+ },
30
45
  };
31
46
  });
@@ -4,6 +4,9 @@ export const useSpaceAroundStyles = buildThemedStyles(tokens => {
4
4
  noneSpace: {
5
5
  padding: 0,
6
6
  },
7
+ minusculeSpace: {
8
+ padding: tokens["space-minuscule"],
9
+ },
7
10
  smallestSpace: {
8
11
  padding: tokens["space-smallest"],
9
12
  },
@@ -13,11 +16,23 @@ export const useSpaceAroundStyles = buildThemedStyles(tokens => {
13
16
  smallSpace: {
14
17
  padding: tokens["space-small"],
15
18
  },
19
+ slimSpace: {
20
+ padding: tokens["space-slim"],
21
+ },
16
22
  baseSpace: {
17
23
  padding: tokens["space-base"],
18
24
  },
19
25
  largeSpace: {
20
26
  padding: tokens["space-large"],
21
27
  },
28
+ largerSpace: {
29
+ padding: tokens["space-larger"],
30
+ },
31
+ largestSpace: {
32
+ padding: tokens["space-largest"],
33
+ },
34
+ extravagantSpace: {
35
+ padding: tokens["space-extravagant"],
36
+ },
22
37
  };
23
38
  });
@@ -12,6 +12,9 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
12
12
  noneChildSpace: {
13
13
  padding: 0,
14
14
  },
15
+ minusculeChildSpace: {
16
+ paddingTop: tokens["space-minuscule"],
17
+ },
15
18
  smallestChildSpace: {
16
19
  paddingTop: tokens["space-smallest"],
17
20
  },
@@ -21,11 +24,23 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
21
24
  smallChildSpace: {
22
25
  paddingTop: tokens["space-small"],
23
26
  },
27
+ slimChildSpace: {
28
+ paddingTop: tokens["space-slim"],
29
+ },
24
30
  baseChildSpace: {
25
31
  paddingTop: tokens["space-base"],
26
32
  },
27
33
  largeChildSpace: {
28
34
  paddingTop: tokens["space-large"],
29
35
  },
36
+ largerChildSpace: {
37
+ paddingTop: tokens["space-larger"],
38
+ },
39
+ largestChildSpace: {
40
+ paddingTop: tokens["space-largest"],
41
+ },
42
+ extravagantChildSpace: {
43
+ paddingTop: tokens["space-extravagant"],
44
+ },
30
45
  };
31
46
  });