@jobber/components-native 0.113.8 → 0.114.1
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/docs/AtlantisThemeContext/AtlantisThemeContext.md +27 -10
- package/dist/package.json +2 -2
- package/dist/src/AtlantisThemeContext/AtlantisThemeContext.js +35 -12
- package/dist/src/AtlantisThemeContext/AtlantisThemeContext.test.js +103 -10
- package/dist/src/BottomSheet/BottomSheet.js +11 -7
- package/dist/src/BottomSheet/BottomSheet.style.js +1 -0
- package/dist/src/BottomSheet/BottomSheet.test.js +16 -0
- package/dist/src/ContentOverlay/ContentOverlay.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/AtlantisThemeContext/AtlantisThemeContext.d.ts +1 -1
- package/dist/types/src/AtlantisThemeContext/index.d.ts +1 -1
- package/dist/types/src/AtlantisThemeContext/types.d.ts +19 -4
- package/dist/types/src/BottomSheet/BottomSheet.style.d.ts +1 -0
- package/package.json +2 -2
- package/src/AtlantisThemeContext/AtlantisThemeContext.guide.md +53 -0
- package/src/AtlantisThemeContext/AtlantisThemeContext.test.tsx +169 -10
- package/src/AtlantisThemeContext/AtlantisThemeContext.tsx +52 -11
- package/src/AtlantisThemeContext/docs/AtlantisThemeContextBasicExample.tsx +8 -2
- package/src/AtlantisThemeContext/docs/AtlantisThemeContextForceThemeForProviderExample.tsx +8 -4
- package/src/AtlantisThemeContext/index.ts +1 -0
- package/src/AtlantisThemeContext/types.ts +23 -4
- package/src/BottomSheet/BottomSheet.style.ts +1 -0
- package/src/BottomSheet/BottomSheet.test.tsx +30 -0
- package/src/BottomSheet/BottomSheet.tsx +26 -12
- package/src/ContentOverlay/ContentOverlay.tsx +2 -2
|
@@ -13,6 +13,10 @@ import { tokens } from "@jobber/design";
|
|
|
13
13
|
import { useStyles } from "./BottomSheet.style";
|
|
14
14
|
import { BottomSheetOption } from "./components/BottomSheetOption";
|
|
15
15
|
import { useBottomSheetBackHandler } from "./hooks/useBottomSheetBackHandler";
|
|
16
|
+
import {
|
|
17
|
+
AtlantisThemeContextProvider,
|
|
18
|
+
useAtlantisTheme,
|
|
19
|
+
} from "../AtlantisThemeContext";
|
|
16
20
|
import { Divider } from "../Divider";
|
|
17
21
|
import { Heading } from "../Heading";
|
|
18
22
|
import { useIsScreenReaderEnabled } from "../hooks";
|
|
@@ -52,6 +56,7 @@ export interface BottomSheetRef {
|
|
|
52
56
|
close: () => void;
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
// eslint-disable-next-line max-statements
|
|
55
60
|
export function BottomSheet({
|
|
56
61
|
children,
|
|
57
62
|
showCancel,
|
|
@@ -62,6 +67,7 @@ export function BottomSheet({
|
|
|
62
67
|
ref,
|
|
63
68
|
}: BottomSheetProps & { readonly ref?: React.Ref<BottomSheetRef> }) {
|
|
64
69
|
const styles = useStyles();
|
|
70
|
+
const { effectiveTheme } = useAtlantisTheme();
|
|
65
71
|
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
66
72
|
|
|
67
73
|
const cancellable = (showCancel && !loading) || isScreenReaderEnabled;
|
|
@@ -116,18 +122,26 @@ export function BottomSheet({
|
|
|
116
122
|
keyboardBlurBehavior="restore"
|
|
117
123
|
handleStyle={styles.handle}
|
|
118
124
|
>
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
{/*
|
|
126
|
+
BottomSheetModal renders through a portal mounted outside this
|
|
127
|
+
component's subtree, so AtlantisThemeContext is lost. Re-apply the
|
|
128
|
+
active effective theme so descendants continue to resolve the correct
|
|
129
|
+
themed tokens.
|
|
130
|
+
*/}
|
|
131
|
+
<AtlantisThemeContextProvider dangerouslyOverrideTheme={effectiveTheme}>
|
|
132
|
+
<BottomSheetView
|
|
133
|
+
style={{
|
|
134
|
+
paddingBottom: insets.bottom + tokens["space-small"],
|
|
135
|
+
paddingTop: tokens["space-small"],
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
{heading && <Header heading={heading} styles={styles} />}
|
|
139
|
+
{children}
|
|
140
|
+
{cancellable && (
|
|
141
|
+
<Footer styles={styles} close={close} cancelLabel={t("cancel")} />
|
|
142
|
+
)}
|
|
143
|
+
</BottomSheetView>
|
|
144
|
+
</AtlantisThemeContextProvider>
|
|
131
145
|
</BottomSheetModal>
|
|
132
146
|
);
|
|
133
147
|
}
|
|
@@ -99,7 +99,7 @@ export function ContentOverlay({
|
|
|
99
99
|
|
|
100
100
|
const styles = useStyles();
|
|
101
101
|
const { t } = useAtlantisI18n();
|
|
102
|
-
const {
|
|
102
|
+
const { effectiveTheme, tokens } = useAtlantisTheme();
|
|
103
103
|
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
104
104
|
|
|
105
105
|
const behavior = computeContentOverlayBehavior(
|
|
@@ -327,7 +327,7 @@ export function ContentOverlay({
|
|
|
327
327
|
the active theme here so descendants (e.g. the header title) resolve the
|
|
328
328
|
correct themed tokens.
|
|
329
329
|
*/}
|
|
330
|
-
<AtlantisThemeContextProvider dangerouslyOverrideTheme={
|
|
330
|
+
<AtlantisThemeContextProvider dangerouslyOverrideTheme={effectiveTheme}>
|
|
331
331
|
<ContentOverlayKeyboardContext.Provider value={scrollEnabled}>
|
|
332
332
|
{scrollEnabled ? (
|
|
333
333
|
<BottomSheetKeyboardAwareScrollView
|