@jobber/components-native 0.36.0 → 0.38.0
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/src/ContentOverlay/ContentOverlay.js +144 -0
- package/dist/src/ContentOverlay/ContentOverlay.style.js +56 -0
- package/dist/src/ContentOverlay/hooks/useKeyboardVisibility.js +21 -0
- package/dist/src/ContentOverlay/hooks/useViewLayoutHeight.js +10 -0
- package/dist/src/ContentOverlay/index.js +1 -0
- package/dist/src/ContentOverlay/messages.js +8 -0
- package/dist/src/ContentOverlay/types.js +1 -0
- package/dist/src/Disclosure/Disclosure.js +50 -0
- package/dist/src/Disclosure/Disclosure.style.js +21 -0
- package/dist/src/Disclosure/constants.js +1 -0
- package/dist/src/Disclosure/index.js +1 -0
- package/dist/src/index.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +6 -0
- package/dist/types/src/ContentOverlay/ContentOverlay.style.d.ts +60 -0
- package/dist/types/src/ContentOverlay/hooks/useKeyboardVisibility.d.ts +6 -0
- package/dist/types/src/ContentOverlay/hooks/useViewLayoutHeight.d.ts +6 -0
- package/dist/types/src/ContentOverlay/index.d.ts +2 -0
- package/dist/types/src/ContentOverlay/messages.d.ts +7 -0
- package/dist/types/src/ContentOverlay/types.d.ts +87 -0
- package/dist/types/src/Disclosure/Disclosure.d.ts +35 -0
- package/dist/types/src/Disclosure/Disclosure.style.d.ts +19 -0
- package/dist/types/src/Disclosure/constants.d.ts +1 -0
- package/dist/types/src/Disclosure/index.d.ts +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/ContentOverlay/ContentOverlay.style.ts +70 -0
- package/src/ContentOverlay/ContentOverlay.test.tsx +371 -0
- package/src/ContentOverlay/ContentOverlay.tsx +295 -0
- package/src/ContentOverlay/hooks/useKeyboardVisibility.test.ts +42 -0
- package/src/ContentOverlay/hooks/useKeyboardVisibility.ts +36 -0
- package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +56 -0
- package/src/ContentOverlay/hooks/useViewLayoutHeight.ts +18 -0
- package/src/ContentOverlay/index.ts +2 -0
- package/src/ContentOverlay/messages.ts +9 -0
- package/src/ContentOverlay/types.ts +96 -0
- package/src/Disclosure/Disclosure.style.ts +22 -0
- package/src/Disclosure/Disclosure.test.tsx +71 -0
- package/src/Disclosure/Disclosure.tsx +162 -0
- package/src/Disclosure/__snapshots__/Disclosure.test.tsx.snap +488 -0
- package/src/Disclosure/constants.ts +1 -0
- package/src/Disclosure/index.ts +1 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ContentOverlayProps } from "./types";
|
|
3
|
+
export declare const ContentOverlay: React.ForwardRefExoticComponent<ContentOverlayProps & React.RefAttributes<{
|
|
4
|
+
open?: ((dest?: import("react-native-modalize/lib/options").TOpen | undefined) => void) | undefined;
|
|
5
|
+
close?: ((dest?: import("react-native-modalize/lib/options").TClose | undefined) => void) | undefined;
|
|
6
|
+
} | undefined>>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
handle: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
top: number;
|
|
7
|
+
borderRadius: number;
|
|
8
|
+
};
|
|
9
|
+
overlay: {
|
|
10
|
+
backgroundColor: string;
|
|
11
|
+
};
|
|
12
|
+
modal: {
|
|
13
|
+
borderTopLeftRadius: number;
|
|
14
|
+
borderTopRightRadius: number;
|
|
15
|
+
};
|
|
16
|
+
modalForLargeScreens: {
|
|
17
|
+
width: number;
|
|
18
|
+
alignSelf: "center";
|
|
19
|
+
};
|
|
20
|
+
header: {
|
|
21
|
+
flexDirection: "row";
|
|
22
|
+
backgroundColor: string;
|
|
23
|
+
paddingTop: number;
|
|
24
|
+
zIndex: number;
|
|
25
|
+
borderTopLeftRadius: number;
|
|
26
|
+
borderTopRightRadius: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
29
|
+
headerShadow: {
|
|
30
|
+
shadowColor: string;
|
|
31
|
+
shadowOffset: {
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
};
|
|
35
|
+
shadowOpacity: number;
|
|
36
|
+
shadowRadius: number;
|
|
37
|
+
elevation: number;
|
|
38
|
+
};
|
|
39
|
+
childrenStyle: {
|
|
40
|
+
zIndex: number;
|
|
41
|
+
};
|
|
42
|
+
dismissButton: {
|
|
43
|
+
alignItems: "center";
|
|
44
|
+
};
|
|
45
|
+
hiddenContent: {
|
|
46
|
+
opacity: number;
|
|
47
|
+
};
|
|
48
|
+
titleWithoutDimiss: {
|
|
49
|
+
flex: number;
|
|
50
|
+
flexDirection: "row";
|
|
51
|
+
justifyContent: "center";
|
|
52
|
+
paddingTop: number;
|
|
53
|
+
};
|
|
54
|
+
titleWithDismiss: {
|
|
55
|
+
flex: number;
|
|
56
|
+
justifyContent: "center";
|
|
57
|
+
paddingLeft: number;
|
|
58
|
+
paddingRight: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Modalize } from "react-native-modalize";
|
|
3
|
+
export interface ContentOverlayProps {
|
|
4
|
+
/**
|
|
5
|
+
* Content to be passed into the overlay
|
|
6
|
+
*/
|
|
7
|
+
readonly children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Title of overlay, appears in the header next to the close button.
|
|
10
|
+
*/
|
|
11
|
+
readonly title: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional accessibilityLabel describing the overlay.
|
|
14
|
+
* This will read out when the overlay is opened.
|
|
15
|
+
* @default "Close {title} modal"
|
|
16
|
+
*/
|
|
17
|
+
readonly accessibilityLabel?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Force overlay height to fill the screen.
|
|
20
|
+
* Width not impacted.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
readonly fullScreen?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Display the dismiss button in the header of the overlay.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
readonly showDismiss?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* If false, hides the handle and turns off dragging.
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
readonly isDraggable?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* If true, automatically adjusts the overlay height to the content height.
|
|
36
|
+
* This will disable the ability to drag the overlay to fullscreen when
|
|
37
|
+
* `isDraggable` is true.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
readonly adjustToContentHeight?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Allows taps to be registered behind keyboard if enabled
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
readonly keyboardShouldPersistTaps?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Enables scrolling in the content body of overlay
|
|
48
|
+
*/
|
|
49
|
+
readonly scrollEnabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Set the background color of the modal window
|
|
52
|
+
* @default "surface"
|
|
53
|
+
*/
|
|
54
|
+
readonly modalBackgroundColor?: ModalBackgroundColor;
|
|
55
|
+
/**
|
|
56
|
+
* Callback that is called when the overlay is closed.
|
|
57
|
+
*/
|
|
58
|
+
readonly onClose?: () => void;
|
|
59
|
+
/**
|
|
60
|
+
* Callback that is called when the overlay is opened.
|
|
61
|
+
*/
|
|
62
|
+
readonly onOpen?: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Callback that is called between overlay is closed and when the "x" button is pressed
|
|
65
|
+
*/
|
|
66
|
+
readonly onBeforeExit?: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Define the behavior of the keyboard when having inputs inside the modal.
|
|
69
|
+
* @default padding
|
|
70
|
+
*/
|
|
71
|
+
readonly keyboardAvoidingBehavior?: "height" | "padding" | "position";
|
|
72
|
+
/**
|
|
73
|
+
* Boolean to show a disabled state
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
readonly loading?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Define keyboard's Android behavior like iOS's one.
|
|
79
|
+
* @default Platform.select({ ios: true, android: false })
|
|
80
|
+
*/
|
|
81
|
+
readonly avoidKeyboardLikeIOS?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export type ModalBackgroundColor = "surface" | "background";
|
|
84
|
+
export type ContentOverlayRef = {
|
|
85
|
+
open?: Modalize["open"];
|
|
86
|
+
close?: Modalize["close"];
|
|
87
|
+
} | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface DisclosureProps {
|
|
3
|
+
/**
|
|
4
|
+
* Specifies the main content of the disclosure component.
|
|
5
|
+
* It can be any React Node - simple text, JSX, or a complex React component.
|
|
6
|
+
*/
|
|
7
|
+
readonly content: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Defines the header of the disclosure component.
|
|
10
|
+
* Similar to `content`, it can be any React Node.
|
|
11
|
+
*/
|
|
12
|
+
readonly header: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* A boolean that determines whether the disclosure component is in an open or closed state.
|
|
15
|
+
* If `open` is true, the disclosure is in an open state; if false, it's closed.
|
|
16
|
+
*/
|
|
17
|
+
readonly open: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* A boolean that indicates whether the disclosure component is empty or not.
|
|
20
|
+
* If `isEmpty` is `true`, there is no content in the disclosure; if false, there is some content.
|
|
21
|
+
*/
|
|
22
|
+
readonly isEmpty: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* An optional property that determines the duration of the opening and closing animation of the disclosure component.
|
|
25
|
+
* It's defined in milliseconds.
|
|
26
|
+
* @default tokens["timing-slowest"]
|
|
27
|
+
*/
|
|
28
|
+
readonly animationDuration?: number;
|
|
29
|
+
/**
|
|
30
|
+
* A function that is called whenever the disclosure component is toggled between its open and closed states.
|
|
31
|
+
*/
|
|
32
|
+
onToggle(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function Disclosure({ content, header, open, onToggle, isEmpty, animationDuration, }: DisclosureProps): JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
container: {
|
|
3
|
+
width: string;
|
|
4
|
+
};
|
|
5
|
+
headerContainer: {
|
|
6
|
+
flexDirection: "row";
|
|
7
|
+
alignItems: "flex-start";
|
|
8
|
+
justifyContent: "space-between";
|
|
9
|
+
};
|
|
10
|
+
countColumn: {
|
|
11
|
+
paddingRight: number;
|
|
12
|
+
};
|
|
13
|
+
titleContainer: {
|
|
14
|
+
flexDirection: "row";
|
|
15
|
+
};
|
|
16
|
+
contentContainer: {
|
|
17
|
+
paddingTop: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EASE_CUBIC_IN_OUT: readonly [0.645, 0.045, 0.355, 1];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Disclosure } from "./Disclosure";
|
|
@@ -10,6 +10,8 @@ export * from "./Card";
|
|
|
10
10
|
export * from "./Checkbox";
|
|
11
11
|
export * from "./Chip";
|
|
12
12
|
export * from "./Content";
|
|
13
|
+
export * from "./ContentOverlay";
|
|
14
|
+
export * from "./Disclosure";
|
|
13
15
|
export * from "./Divider";
|
|
14
16
|
export * from "./EmptyState";
|
|
15
17
|
export * from "./ErrorMessageWrapper";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"react-native": ">=0.69.2",
|
|
76
76
|
"react-native-modal-datetime-picker": " >=13.0.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "5c76dda512a1f72636c5695a9b73fc8470291066"
|
|
79
79
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { tokens } from "../utils/design";
|
|
3
|
+
|
|
4
|
+
const modalBorderRadius = tokens["radius-larger"];
|
|
5
|
+
const titleOffsetFromHandle = tokens["space-small"] + tokens["space-smallest"];
|
|
6
|
+
|
|
7
|
+
export const styles = StyleSheet.create({
|
|
8
|
+
handle: {
|
|
9
|
+
width: tokens["space-largest"],
|
|
10
|
+
height: tokens["space-smaller"] + tokens["space-smallest"],
|
|
11
|
+
backgroundColor: tokens["color-border"],
|
|
12
|
+
top: tokens["space-small"],
|
|
13
|
+
borderRadius: tokens["radius-circle"],
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
overlay: {
|
|
17
|
+
backgroundColor: tokens["color-overlay"],
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
modal: {
|
|
21
|
+
borderTopLeftRadius: modalBorderRadius,
|
|
22
|
+
borderTopRightRadius: modalBorderRadius,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
modalForLargeScreens: {
|
|
26
|
+
width: 640,
|
|
27
|
+
alignSelf: "center",
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
header: {
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
backgroundColor: tokens["color-surface"],
|
|
33
|
+
paddingTop: titleOffsetFromHandle,
|
|
34
|
+
zIndex: tokens["elevation-base"],
|
|
35
|
+
borderTopLeftRadius: modalBorderRadius,
|
|
36
|
+
borderTopRightRadius: modalBorderRadius,
|
|
37
|
+
height: tokens["space-extravagant"],
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
headerShadow: {
|
|
41
|
+
...tokens["shadow-base"],
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
childrenStyle: {
|
|
45
|
+
// We need to explicity lower the zIndex because otherwise, the modal content slides over the header shadow.
|
|
46
|
+
zIndex: -1,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
dismissButton: {
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
hiddenContent: {
|
|
54
|
+
opacity: 0,
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
titleWithoutDimiss: {
|
|
58
|
+
flex: 1,
|
|
59
|
+
flexDirection: "row",
|
|
60
|
+
justifyContent: "center",
|
|
61
|
+
paddingTop: tokens["space-base"],
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
titleWithDismiss: {
|
|
65
|
+
flex: 1,
|
|
66
|
+
justifyContent: "center",
|
|
67
|
+
paddingLeft: tokens["space-base"],
|
|
68
|
+
paddingRight: tokens["space-smaller"],
|
|
69
|
+
},
|
|
70
|
+
});
|