@jobber/components-native 0.84.4-JOB-138679-b1552ab.68 → 0.84.4-match-mobi-accfa8a.9

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 (83) hide show
  1. package/dist/package.json +5 -3
  2. package/dist/src/BottomSheet/BottomSheet.js +58 -32
  3. package/dist/src/BottomSheet/BottomSheet.style.js +8 -9
  4. package/dist/src/BottomSheet/hooks/useBottomSheetBackHandler.js +26 -0
  5. package/dist/src/Chip/Chip.js +12 -1
  6. package/dist/src/Chip/Chip.style.js +1 -1
  7. package/dist/src/Content/ContentHorizontal.style.js +15 -0
  8. package/dist/src/Content/ContentSpaceAround.style.js +15 -0
  9. package/dist/src/Content/ContentVertical.style.js +15 -0
  10. package/dist/src/InputText/InputText.js +2 -2
  11. package/dist/src/ProgressBar/ProgressBar.js +10 -6
  12. package/dist/src/ProgressBar/ProgressBarInner.js +3 -12
  13. package/dist/src/ProgressBar/ProgressBarStepped.js +7 -2
  14. package/dist/src/StatusIndicator/StatusIndicator.js +11 -0
  15. package/dist/src/StatusIndicator/StatusIndicator.style.js +12 -0
  16. package/dist/src/StatusIndicator/StatusIndicator.type.js +1 -0
  17. package/dist/src/StatusIndicator/index.js +1 -0
  18. package/dist/src/StatusLabel/StatusLabel.js +6 -12
  19. package/dist/src/StatusLabel/StatusLabel.style.js +10 -13
  20. package/dist/src/hooks/useFormController.js +1 -1
  21. package/dist/src/index.js +1 -0
  22. package/dist/src/utils/meta/meta.json +1 -0
  23. package/dist/tsconfig.build.tsbuildinfo +1 -1
  24. package/dist/types/src/BottomSheet/BottomSheet.d.ts +7 -3
  25. package/dist/types/src/BottomSheet/BottomSheet.style.d.ts +7 -14
  26. package/dist/types/src/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +8 -0
  27. package/dist/types/src/Content/Content.d.ts +1 -1
  28. package/dist/types/src/Content/ContentHorizontal.style.d.ts +15 -0
  29. package/dist/types/src/Content/ContentSpaceAround.style.d.ts +15 -0
  30. package/dist/types/src/Content/ContentVertical.style.d.ts +15 -0
  31. package/dist/types/src/Form/context/types.d.ts +2 -2
  32. package/dist/types/src/Form/hooks/useInternalForm.d.ts +2 -2
  33. package/dist/types/src/InputText/InputText.d.ts +1 -1
  34. package/dist/types/src/Menu/types.d.ts +1 -1
  35. package/dist/types/src/ProgressBar/ProgressBar.d.ts +1 -1
  36. package/dist/types/src/ProgressBar/ProgressBarInner.d.ts +4 -1
  37. package/dist/types/src/ProgressBar/ProgressBarStepped.d.ts +3 -1
  38. package/dist/types/src/ProgressBar/types.d.ts +20 -0
  39. package/dist/types/src/StatusIndicator/StatusIndicator.d.ts +6 -0
  40. package/dist/types/src/StatusIndicator/StatusIndicator.style.d.ts +8 -0
  41. package/dist/types/src/StatusIndicator/StatusIndicator.type.d.ts +1 -0
  42. package/dist/types/src/StatusIndicator/index.d.ts +2 -0
  43. package/dist/types/src/StatusLabel/StatusLabel.d.ts +3 -3
  44. package/dist/types/src/StatusLabel/StatusLabel.style.d.ts +10 -10
  45. package/dist/types/src/index.d.ts +1 -0
  46. package/package.json +5 -3
  47. package/src/BottomSheet/BottomSheet.stories.tsx +128 -0
  48. package/src/BottomSheet/BottomSheet.style.ts +7 -14
  49. package/src/BottomSheet/BottomSheet.test.tsx +19 -24
  50. package/src/BottomSheet/BottomSheet.tsx +112 -93
  51. package/src/BottomSheet/hooks/useBottomSheetBackHandler.test.ts +90 -0
  52. package/src/BottomSheet/hooks/useBottomSheetBackHandler.ts +41 -0
  53. package/src/Checkbox/Checkbox.test.tsx +118 -1
  54. package/src/Chip/Chip.style.ts +1 -1
  55. package/src/Chip/Chip.tsx +19 -1
  56. package/src/Content/Content.tsx +6 -1
  57. package/src/Content/ContentHorizontal.style.ts +20 -0
  58. package/src/Content/ContentSpaceAround.style.ts +20 -0
  59. package/src/Content/ContentVertical.style.ts +20 -0
  60. package/src/Form/context/types.ts +2 -2
  61. package/src/Form/hooks/useInternalForm.ts +2 -2
  62. package/src/InputText/InputText.test.tsx +115 -1
  63. package/src/InputText/InputText.tsx +3 -3
  64. package/src/Menu/types.ts +1 -1
  65. package/src/ProgressBar/ProgressBar.test.tsx +109 -0
  66. package/src/ProgressBar/ProgressBar.tsx +17 -1
  67. package/src/ProgressBar/ProgressBarInner.tsx +7 -10
  68. package/src/ProgressBar/ProgressBarStepped.tsx +12 -1
  69. package/src/ProgressBar/__snapshots__/ProgressBar.test.tsx.snap +14 -0
  70. package/src/ProgressBar/types.ts +22 -0
  71. package/src/StatusIndicator/StatusIndicator.style.ts +14 -0
  72. package/src/StatusIndicator/StatusIndicator.test.tsx +42 -0
  73. package/src/StatusIndicator/StatusIndicator.tsx +23 -0
  74. package/src/StatusIndicator/StatusIndicator.type.ts +6 -0
  75. package/src/StatusIndicator/__snapshots__/StatusIndicator.test.tsx.snap +96 -0
  76. package/src/StatusIndicator/index.ts +2 -0
  77. package/src/StatusLabel/StatusLabel.style.ts +10 -16
  78. package/src/StatusLabel/StatusLabel.tsx +15 -28
  79. package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +133 -105
  80. package/src/ThumbnailList/__snapshots__/ThumbnailList.test.tsx.snap +199 -1
  81. package/src/hooks/useFormController.ts +1 -1
  82. package/src/index.ts +1 -0
  83. package/src/utils/meta/meta.json +1 -0
@@ -1,6 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
2
  import React from "react";
3
- import type { Modalize } from "react-native-modalize";
4
3
  export interface BottomSheetProps {
5
4
  readonly children: ReactNode;
6
5
  /**
@@ -24,5 +23,10 @@ export interface BottomSheetProps {
24
23
  */
25
24
  readonly onClose?: () => void;
26
25
  }
27
- export declare const BottomSheet: React.ForwardRefExoticComponent<BottomSheetProps & React.RefAttributes<import("react-native-modalize/lib/options").IHandles | undefined>>;
28
- export type BottomSheetRef = Modalize | undefined;
26
+ export interface BottomSheetRef {
27
+ open: () => void;
28
+ close: () => void;
29
+ }
30
+ export declare function BottomSheet({ children, showCancel, loading, heading, onOpen, onClose, ref, }: BottomSheetProps & {
31
+ readonly ref?: React.Ref<BottomSheetRef>;
32
+ }): React.JSX.Element;
@@ -1,23 +1,13 @@
1
1
  export declare const useStyles: () => {
2
- overlayModalize: {
2
+ backdrop: {
3
3
  backgroundColor: string;
4
4
  };
5
- overlay: {
6
- backgroundColor: string;
7
- height: number;
8
- position: "absolute";
9
- left: 0;
10
- right: 0;
11
- top: 0;
12
- bottom: 0;
13
- };
14
- modal: {
5
+ background: {
15
6
  borderTopLeftRadius: number;
16
7
  borderTopRightRadius: number;
17
- paddingTop: number;
18
8
  };
19
- children: {
20
- paddingBottom: number;
9
+ footerContainer: {
10
+ backgroundColor: string;
21
11
  };
22
12
  header: {
23
13
  paddingHorizontal: number;
@@ -29,4 +19,7 @@ export declare const useStyles: () => {
29
19
  marginTop: number;
30
20
  marginBottom: number;
31
21
  };
22
+ handle: {
23
+ display: "none";
24
+ };
32
25
  };
@@ -0,0 +1,8 @@
1
+ import type BottomSheet from "@gorhom/bottom-sheet";
2
+ /**
3
+ * Hook that closes the bottom sheet on the hardware back button press if it is visible
4
+ * @param bottomSheetRef ref to the bottom sheet component
5
+ */
6
+ export declare function useBottomSheetBackHandler(bottomSheetRef: React.RefObject<BottomSheet | null>): {
7
+ handleSheetPositionChange: (index: number) => void;
8
+ };
@@ -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
  };
@@ -1,4 +1,4 @@
1
- import type { MutableRefObject } from "react";
1
+ import type { RefObject } from "react";
2
2
  import type { DeepPartial, FieldValues, UseFormReturn } from "react-hook-form";
3
3
  export interface UseConfirmBeforeBackProps {
4
4
  alwaysPreventBack: boolean;
@@ -16,7 +16,7 @@ interface LocalCacheOptions {
16
16
  readonly id?: string | string[];
17
17
  }
18
18
  export interface AtlantisFormContextProps {
19
- useConfirmBeforeBack: (props: UseConfirmBeforeBackProps) => MutableRefObject<() => void>;
19
+ useConfirmBeforeBack: (props: UseConfirmBeforeBackProps) => RefObject<() => void>;
20
20
  useInternalFormLocalCache: <TData extends FieldValues>(formMethods: UseFormReturn<TData>, cacheKey?: string, options?: LocalCacheOptions) => {
21
21
  setLocalCache: (data: DeepPartial<TData>) => void;
22
22
  removeLocalCache: () => void;
@@ -1,5 +1,5 @@
1
1
  import type { DeepPartial, FieldValues, UseFormHandleSubmit, UseFormReturn } from "react-hook-form";
2
- import type { MutableRefObject, RefObject } from "react";
2
+ import type { RefObject } from "react";
3
3
  import type { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
4
4
  import type { InternalFormProps } from "../types";
5
5
  type UseInternalFormProps<T extends FieldValues, SubmitResponseType> = Pick<InternalFormProps<T, SubmitResponseType>, "mode" | "reValidateMode" | "initialValues" | "formRef" | "localCacheKey" | "localCacheExclude" | "localCacheId" | "UNSAFE_allowDiscardLocalCacheWhenOffline"> & {
@@ -12,7 +12,7 @@ interface UseInternalForm<T extends FieldValues> {
12
12
  readonly handleSubmit: UseFormHandleSubmit<T>;
13
13
  readonly isSubmitting: boolean;
14
14
  readonly isDirty: boolean;
15
- readonly removeListenerRef: MutableRefObject<() => void>;
15
+ readonly removeListenerRef: RefObject<() => void>;
16
16
  readonly setLocalCache: (data: DeepPartial<T>) => void;
17
17
  }
18
18
  export declare function useInternalForm<T extends FieldValues, SubmitResponseType>({ mode, reValidateMode, initialValues, formRef, localCacheKey, localCacheId, scrollViewRef, saveButtonHeight, messageBannerHeight, UNSAFE_allowDiscardLocalCacheWhenOffline, }: UseInternalFormProps<T, SubmitResponseType>): UseInternalForm<T>;
@@ -77,7 +77,7 @@ export interface InputTextProps extends Pick<InputFieldWrapperProps, "toolbar" |
77
77
  /**
78
78
  * Callback that is called when the text input is blurred
79
79
  */
80
- readonly onBlur?: () => void;
80
+ readonly onBlur?: (event?: FocusEvent) => void;
81
81
  /**
82
82
  * VoiceOver will read this string when a user selects the associated element
83
83
  */
@@ -1,5 +1,5 @@
1
- import type { IconColorNames, IconNames } from "@jobber/design";
2
1
  import type { ReactElement } from "react";
2
+ import type { IconColorNames, IconNames } from "@jobber/design";
3
3
  import type { TextAlign } from "../Typography";
4
4
  export interface MenuOptionProps {
5
5
  readonly label: string;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import type { ProgressBarProps } from "./types";
3
- export declare function ProgressBar({ loading, total, current, inProgress, reverseTheme, header, variation, size, }: ProgressBarProps): React.JSX.Element;
3
+ export declare function ProgressBar({ loading, total, current, inProgress, reverseTheme, header, variation, size, UNSAFE_style, }: ProgressBarProps): React.JSX.Element;
@@ -1,9 +1,12 @@
1
1
  import React from "react";
2
+ import type { StyleProp, ViewStyle } from "react-native";
2
3
  interface ProgressBarInnerProps {
3
4
  readonly width: number;
4
5
  readonly animationDuration?: number;
5
6
  readonly color?: string;
7
+ readonly style?: StyleProp<ViewStyle>;
8
+ readonly testID?: string;
6
9
  }
7
- export declare function ProgressBarInner({ width, color, }: ProgressBarInnerProps): React.JSX.Element;
10
+ export declare function ProgressBarInner({ width, color, style, testID, }: ProgressBarInnerProps): React.JSX.Element;
8
11
  export declare function calculateWidth(total: number, current: number): number;
9
12
  export {};
@@ -1,10 +1,12 @@
1
1
  import React from "react";
2
+ import type { ProgressBarUnsafeStyle } from "./types";
2
3
  interface ProgressBarSteppedProps {
3
4
  readonly total: number;
4
5
  readonly current: number;
5
6
  readonly color?: string;
6
7
  readonly loading?: boolean;
7
8
  readonly inProgress?: number;
9
+ readonly UNSAFE_style?: ProgressBarUnsafeStyle;
8
10
  }
9
- export declare function ProgressBarStepped({ total, current, color, loading, inProgress, }: ProgressBarSteppedProps): React.JSX.Element;
11
+ export declare function ProgressBarStepped({ total, current, color, loading, inProgress, UNSAFE_style, }: ProgressBarSteppedProps): React.JSX.Element;
10
12
  export {};
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import type { StyleProp, ViewStyle } from "react-native";
2
3
  export interface ProgressBarProps {
3
4
  /**
4
5
  * The total number of items to be completed
@@ -36,4 +37,23 @@ export interface ProgressBarProps {
36
37
  * @default base
37
38
  */
38
39
  readonly size?: "smaller" | "small" | "base";
40
+ /** **Use at your own risk:** Custom style for specific elements. This should only be used as a
41
+ * **last resort**. Using this may result in unexpected side effects.
42
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
43
+ */
44
+ readonly UNSAFE_style?: ProgressBarUnsafeStyle;
45
+ }
46
+ export interface ProgressBarUnsafeStyle {
47
+ /** Styles applied to the outer accessible wrapper (role="progressbar"). */
48
+ container?: StyleProp<ViewStyle>;
49
+ /** Styles applied to the inner bar container (track container) – controls bar height/rounding. */
50
+ progressBarContainer?: StyleProp<ViewStyle>;
51
+ /** Styles applied to each step block in the stepped variation. */
52
+ step?: StyleProp<ViewStyle>;
53
+ /** Track/background bar in 'progress' variation (full-width inner) */
54
+ track?: StyleProp<ViewStyle>;
55
+ /** Filled/completed portion in 'progress' variation */
56
+ fill?: StyleProp<ViewStyle>;
57
+ /** In-progress overlay portion in 'progress' variation */
58
+ inProgressFill?: StyleProp<ViewStyle>;
39
59
  }
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import type { StatusIndicatorType } from "./StatusIndicator.type";
3
+ export interface StatusIndicatorProps {
4
+ readonly status: StatusIndicatorType;
5
+ }
6
+ export declare function StatusIndicator({ status }: StatusIndicatorProps): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ export declare const useStyles: () => {
2
+ statusIndicator: {
3
+ borderRadius: number;
4
+ backgroundColor: string;
5
+ width: number;
6
+ height: number;
7
+ };
8
+ };
@@ -0,0 +1 @@
1
+ export type StatusIndicatorType = "success" | "warning" | "critical" | "inactive" | "informative";
@@ -0,0 +1,2 @@
1
+ export { StatusIndicator } from "./StatusIndicator";
2
+ export type { StatusIndicatorProps } from "./StatusIndicator";
@@ -6,15 +6,15 @@ export interface StatusLabelType {
6
6
  }
7
7
  interface StatusLabelProps {
8
8
  /**
9
- * Text to display.
9
+ * Text to display
10
10
  */
11
11
  readonly text: string;
12
12
  /**
13
- * Alignment of text
13
+ * Alignment of text and StatusIndicator
14
14
  */
15
15
  readonly alignment?: "start" | "end";
16
16
  /**
17
- * Status color of the square beside text
17
+ * Status color of label container, label, and StatusIndicator
18
18
  */
19
19
  readonly status?: StatusType;
20
20
  }
@@ -2,22 +2,22 @@ export declare const useStyles: () => {
2
2
  statusLabelRow: {
3
3
  flexDirection: "row";
4
4
  justifyContent: "flex-end";
5
+ alignItems: "center";
6
+ alignSelf: "flex-start";
5
7
  flexWrap: "nowrap";
8
+ flexGrow: number;
9
+ flexShrink: number;
10
+ gap: number;
11
+ backgroundColor: string;
12
+ borderRadius: number;
13
+ paddingVertical: number;
14
+ paddingHorizontal: number;
6
15
  };
7
16
  statusLabelText: {
8
17
  flexShrink: number;
9
- };
10
- statusLabelIcon: {
11
- borderRadius: number;
12
- backgroundColor: string;
13
- width: number;
14
- height: number;
15
- marginTop: number;
18
+ marginBottom: number;
16
19
  };
17
20
  labelTextStartAligned: {
18
21
  flexDirection: "row-reverse";
19
22
  };
20
- innerPad: {
21
- width: number;
22
- };
23
23
  };
@@ -39,6 +39,7 @@ export * from "./Menu";
39
39
  export * from "./ProgressBar";
40
40
  export * from "./Select";
41
41
  export * from "./StatusLabel";
42
+ export * from "./StatusIndicator";
42
43
  export * from "./Switch";
43
44
  export * from "./Text";
44
45
  export * from "./TextList";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.84.4-JOB-138679-b1552ab.68+b1552ab31",
3
+ "version": "0.84.4-match-mobi-accfa8a.9+accfa8aef",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -53,8 +53,9 @@
53
53
  "ts-xor": "^1.1.0"
54
54
  },
55
55
  "devDependencies": {
56
+ "@gorhom/bottom-sheet": "^5.2.8",
56
57
  "@react-native-community/datetimepicker": "^8.4.5",
57
- "@react-native/babel-preset": "^0.81.1",
58
+ "@react-native/babel-preset": "^0.82.1",
58
59
  "@storybook/addon-a11y": "^9.1.2",
59
60
  "@storybook/react": "^9.1.2",
60
61
  "@storybook/react-native-web-vite": "^9.1.2",
@@ -78,6 +79,7 @@
78
79
  },
79
80
  "peerDependencies": {
80
81
  "@babel/core": "^7.4.5",
82
+ "@gorhom/bottom-sheet": "^5.2.8",
81
83
  "@jobber/design": "*",
82
84
  "@react-native-community/datetimepicker": ">=6.7.0",
83
85
  "date-fns": "^2.30.0",
@@ -94,5 +96,5 @@
94
96
  "react-native-safe-area-context": "^5.4.0",
95
97
  "react-native-svg": ">=12.0.0"
96
98
  },
97
- "gitHead": "b1552ab319204ce883046ea2c22d875952746675"
99
+ "gitHead": "accfa8aefd00ea92526e90f81830b9a8691bdac7"
98
100
  }
@@ -0,0 +1,128 @@
1
+ import React, { useRef } from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
3
+ import { View } from "react-native";
4
+ import { SafeAreaProvider } from "react-native-safe-area-context";
5
+ import { Button, Heading, Text } from "@jobber/components-native";
6
+ import { BottomSheet } from "./BottomSheet";
7
+ import type { BottomSheetRef } from "./BottomSheet";
8
+ import { BottomSheetOption } from "./components/BottomSheetOption";
9
+
10
+ const meta = {
11
+ title: "Components/Selections/BottomSheet",
12
+ component: BottomSheet,
13
+ } satisfies Meta<typeof BottomSheet>;
14
+
15
+ export default meta;
16
+ type Story = StoryObj<typeof meta>;
17
+
18
+ const BasicTemplate = () => {
19
+ const bottomSheetRef = useRef<BottomSheetRef>(null);
20
+
21
+ const openBottomSheet = () => {
22
+ bottomSheetRef.current?.open();
23
+ };
24
+
25
+ const closeBottomSheet = () => {
26
+ bottomSheetRef.current?.close();
27
+ };
28
+
29
+ return (
30
+ <SafeAreaProvider>
31
+ <View style={{ display: "flex", flexDirection: "column", gap: 16 }}>
32
+ <Heading>Basic BottomSheet</Heading>
33
+ <Text>
34
+ Note that due to the differences between React Native Web and React
35
+ Native, this does not render 100% properly
36
+ </Text>
37
+ <Button label="Open Bottom Sheet" onPress={openBottomSheet} />
38
+ <Button label="Close Bottom Sheet" onPress={closeBottomSheet} />
39
+ </View>
40
+ <BottomSheet
41
+ ref={bottomSheetRef}
42
+ onClose={() => console.log("closed bottom sheet")}
43
+ onOpen={() => console.log("opened bottom sheet")}
44
+ >
45
+ <BottomSheetOption
46
+ icon="sendMessage"
47
+ iconColor="greyBlue"
48
+ text="Send message"
49
+ onPress={() => alert("send message")}
50
+ />
51
+ <BottomSheetOption
52
+ icon="phone"
53
+ iconColor="greyBlue"
54
+ text="Call a friend"
55
+ onPress={() => alert("Calling a friend")}
56
+ />
57
+ <BottomSheetOption
58
+ destructive={true}
59
+ icon="trash"
60
+ text="Remove"
61
+ onPress={() => alert("Removed")}
62
+ />
63
+ </BottomSheet>
64
+ </SafeAreaProvider>
65
+ );
66
+ };
67
+
68
+ const HeaderFooterInputTextTemplate = () => {
69
+ const bottomSheetRef = useRef<BottomSheetRef>(null);
70
+
71
+ const openBottomSheet = () => {
72
+ bottomSheetRef.current?.open();
73
+ };
74
+
75
+ const closeBottomSheet = () => {
76
+ bottomSheetRef.current?.close();
77
+ };
78
+
79
+ return (
80
+ <SafeAreaProvider>
81
+ <View style={{ display: "flex", flexDirection: "column", gap: 16 }}>
82
+ <Heading>Basic BottomSheet</Heading>
83
+ <Text>
84
+ Note that due to the differences between React Native Web and React
85
+ Native, this does not render 100% properly
86
+ </Text>
87
+ <Button label="Open Bottom Sheet" onPress={openBottomSheet} />
88
+ <Button label="Close Bottom Sheet" onPress={closeBottomSheet} />
89
+ </View>
90
+ <BottomSheet
91
+ ref={bottomSheetRef}
92
+ showCancel={true}
93
+ heading="BottomSheet Header"
94
+ onClose={() => console.log("closed bottom sheet")}
95
+ onOpen={() => console.log("opened bottom sheet")}
96
+ >
97
+ <BottomSheetOption
98
+ icon="sendMessage"
99
+ iconColor="greyBlue"
100
+ text="Send message"
101
+ onPress={() => alert("send message")}
102
+ />
103
+ <BottomSheetOption
104
+ icon="phone"
105
+ iconColor="greyBlue"
106
+ text="Call a friend"
107
+ onPress={() => alert("Calling a friend")}
108
+ />
109
+ <BottomSheetOption
110
+ destructive={true}
111
+ icon="trash"
112
+ text="Remove"
113
+ onPress={() => alert("Removed")}
114
+ />
115
+ </BottomSheet>
116
+ </SafeAreaProvider>
117
+ );
118
+ };
119
+
120
+ export const Basic: Story = {
121
+ render: BasicTemplate,
122
+ args: {} as Story["args"],
123
+ };
124
+
125
+ export const HeaderFooterInputText: Story = {
126
+ render: HeaderFooterInputTextTemplate,
127
+ args: {} as Story["args"],
128
+ };
@@ -1,28 +1,18 @@
1
- import { Dimensions, StyleSheet } from "react-native";
2
1
  import { buildThemedStyles } from "../AtlantisThemeContext";
3
2
 
4
- const { height } = Dimensions.get("window");
5
-
6
3
  export const useStyles = buildThemedStyles(tokens => {
7
4
  const modalBorderRadius = tokens["radius-larger"];
8
5
 
9
6
  return {
10
- overlayModalize: {
11
- backgroundColor: "transparent",
12
- },
13
-
14
- overlay: {
15
- ...StyleSheet.absoluteFillObject,
7
+ backdrop: {
16
8
  backgroundColor: tokens["color-overlay"],
17
- height,
18
9
  },
19
- modal: {
10
+ background: {
20
11
  borderTopLeftRadius: modalBorderRadius,
21
12
  borderTopRightRadius: modalBorderRadius,
22
- paddingTop: tokens["space-small"],
23
13
  },
24
- children: {
25
- paddingBottom: tokens["space-small"],
14
+ footerContainer: {
15
+ backgroundColor: tokens["color-surface"],
26
16
  },
27
17
  header: {
28
18
  paddingHorizontal: tokens["space-base"],
@@ -34,5 +24,8 @@ export const useStyles = buildThemedStyles(tokens => {
34
24
  marginTop: tokens["space-small"],
35
25
  marginBottom: tokens["space-smaller"],
36
26
  },
27
+ handle: {
28
+ display: "none",
29
+ },
37
30
  };
38
31
  });
@@ -1,7 +1,6 @@
1
1
  import React, { createRef } from "react";
2
- import { act, fireEvent, render, waitFor } from "@testing-library/react-native";
2
+ import { act, render, userEvent, waitFor } from "@testing-library/react-native";
3
3
  import { AccessibilityInfo, View } from "react-native";
4
- import { Host, Portal } from "react-native-portalize";
5
4
  import { BottomSheet } from ".";
6
5
  import type { BottomSheetRef } from "./BottomSheet";
7
6
  import { waitForUntestableRender } from "../utils/test/wait";
@@ -23,22 +22,18 @@ function setup({
23
22
  loading?: boolean;
24
23
  }) {
25
24
  return render(
26
- <Host>
27
- <Portal>
28
- <BottomSheet
29
- ref={ref}
30
- heading={heading}
31
- showCancel={showCancel}
32
- loading={loading}
33
- onClose={mockOnClose}
34
- onOpen={mockOnOpen}
35
- >
36
- <View>
37
- <Text>BottomSheet</Text>
38
- </View>
39
- </BottomSheet>
40
- </Portal>
41
- </Host>,
25
+ <BottomSheet
26
+ ref={ref}
27
+ heading={heading}
28
+ showCancel={showCancel}
29
+ loading={loading}
30
+ onClose={mockOnClose}
31
+ onOpen={mockOnOpen}
32
+ >
33
+ <View>
34
+ <Text>BottomSheet</Text>
35
+ </View>
36
+ </BottomSheet>,
42
37
  );
43
38
  }
44
39
 
@@ -78,7 +73,8 @@ it("BottomSheet can be closed with the cancel action", async () => {
78
73
  ref.current?.open();
79
74
  });
80
75
 
81
- fireEvent.press(await findByLabelText("Cancel"));
76
+ const cancelButton = await findByLabelText("Cancel");
77
+ await userEvent.press(cancelButton);
82
78
 
83
79
  await waitFor(() => {
84
80
  expect(queryByText("BottomSheet")).toBeNull();
@@ -134,15 +130,14 @@ describe("when there is a screen reader enabled", () => {
134
130
 
135
131
  const { findByLabelText, queryByText } = setup({});
136
132
 
137
- await waitForUntestableRender(
138
- "Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
139
- );
140
-
141
133
  await act(async () => {
142
134
  ref.current?.open();
143
135
  });
144
136
 
145
- fireEvent.press(await findByLabelText("Cancel"));
137
+ const cancelButton = await findByLabelText("Cancel");
138
+ expect(cancelButton).toBeDefined();
139
+
140
+ await userEvent.press(cancelButton);
146
141
 
147
142
  await waitFor(() => {
148
143
  expect(queryByText("BottomSheet")).toBeNull();