@ankhorage/surface 3.4.6 → 4.1.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/CHANGELOG.md +13 -0
- package/README.md +1 -6
- package/dist/examples/DocsExamples.d.ts.map +1 -1
- package/dist/examples/DocsExamples.js +0 -6
- package/dist/examples/DocsExamples.js.map +1 -1
- package/dist/features/bottom-sheet/BottomSheetContext.d.ts +4 -0
- package/dist/features/bottom-sheet/BottomSheetContext.d.ts.map +1 -0
- package/dist/features/bottom-sheet/BottomSheetContext.js +3 -0
- package/dist/features/bottom-sheet/BottomSheetContext.js.map +1 -0
- package/dist/features/bottom-sheet/BottomSheetProvider.d.ts +6 -0
- package/dist/features/bottom-sheet/BottomSheetProvider.d.ts.map +1 -0
- package/dist/features/bottom-sheet/BottomSheetProvider.js +61 -0
- package/dist/features/bottom-sheet/BottomSheetProvider.js.map +1 -0
- package/dist/features/bottom-sheet/public.d.ts +4 -0
- package/dist/features/bottom-sheet/public.d.ts.map +1 -0
- package/dist/features/bottom-sheet/public.js +3 -0
- package/dist/features/bottom-sheet/public.js.map +1 -0
- package/dist/features/bottom-sheet/useBottomSheet.d.ts +4 -0
- package/dist/features/bottom-sheet/useBottomSheet.d.ts.map +1 -0
- package/dist/features/bottom-sheet/useBottomSheet.js +11 -0
- package/dist/features/bottom-sheet/useBottomSheet.js.map +1 -0
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/types/bottomSheet.d.ts +18 -0
- package/dist/types/bottomSheet.d.ts.map +1 -0
- package/dist/types/bottomSheet.js +2 -0
- package/dist/types/bottomSheet.js.map +1 -0
- package/package.json +17 -3
- package/src/examples/DocsExamples.tsx +0 -6
- package/src/features/bottom-sheet/BottomSheetContext.ts +5 -0
- package/src/features/bottom-sheet/BottomSheetProvider.tsx +129 -0
- package/src/features/bottom-sheet/public.ts +3 -0
- package/src/features/bottom-sheet/useBottomSheet.test.tsx +18 -0
- package/src/features/bottom-sheet/useBottomSheet.ts +15 -0
- package/src/index.test.ts +40 -12
- package/src/index.ts +0 -22
- package/src/types/bottomSheet.ts +19 -0
- package/dist/components/action-sheet/ActionSheet.d.ts +0 -4
- package/dist/components/action-sheet/ActionSheet.d.ts.map +0 -1
- package/dist/components/action-sheet/ActionSheet.js +0 -77
- package/dist/components/action-sheet/ActionSheet.js.map +0 -1
- package/dist/components/action-sheet/ActionSheetItem.d.ts +0 -4
- package/dist/components/action-sheet/ActionSheetItem.d.ts.map +0 -1
- package/dist/components/action-sheet/ActionSheetItem.js +0 -27
- package/dist/components/action-sheet/ActionSheetItem.js.map +0 -1
- package/dist/components/action-sheet/index.d.ts +0 -4
- package/dist/components/action-sheet/index.d.ts.map +0 -1
- package/dist/components/action-sheet/index.js +0 -3
- package/dist/components/action-sheet/index.js.map +0 -1
- package/dist/components/action-sheet/types.d.ts +0 -27
- package/dist/components/action-sheet/types.d.ts.map +0 -1
- package/dist/components/action-sheet/types.js +0 -2
- package/dist/components/action-sheet/types.js.map +0 -1
- package/dist/components/drawer/Drawer.d.ts +0 -4
- package/dist/components/drawer/Drawer.d.ts.map +0 -1
- package/dist/components/drawer/Drawer.js +0 -62
- package/dist/components/drawer/Drawer.js.map +0 -1
- package/dist/components/drawer/index.d.ts +0 -3
- package/dist/components/drawer/index.d.ts.map +0 -1
- package/dist/components/drawer/index.js +0 -2
- package/dist/components/drawer/index.js.map +0 -1
- package/dist/components/drawer/types.d.ts +0 -12
- package/dist/components/drawer/types.d.ts.map +0 -1
- package/dist/components/drawer/types.js +0 -2
- package/dist/components/drawer/types.js.map +0 -1
- package/dist/components/navigation/DrawerNavigation.d.ts +0 -4
- package/dist/components/navigation/DrawerNavigation.d.ts.map +0 -1
- package/dist/components/navigation/DrawerNavigation.js +0 -13
- package/dist/components/navigation/DrawerNavigation.js.map +0 -1
- package/dist/components/navigation/DrawerNavigationItem.d.ts +0 -4
- package/dist/components/navigation/DrawerNavigationItem.d.ts.map +0 -1
- package/dist/components/navigation/DrawerNavigationItem.js +0 -9
- package/dist/components/navigation/DrawerNavigationItem.js.map +0 -1
- package/dist/components/navigation/NavigationItem.d.ts +0 -4
- package/dist/components/navigation/NavigationItem.d.ts.map +0 -1
- package/dist/components/navigation/NavigationItem.js +0 -41
- package/dist/components/navigation/NavigationItem.js.map +0 -1
- package/dist/components/navigation/NavigationList.d.ts +0 -4
- package/dist/components/navigation/NavigationList.d.ts.map +0 -1
- package/dist/components/navigation/NavigationList.js +0 -9
- package/dist/components/navigation/NavigationList.js.map +0 -1
- package/dist/components/navigation/TabBar.d.ts +0 -4
- package/dist/components/navigation/TabBar.d.ts.map +0 -1
- package/dist/components/navigation/TabBar.js +0 -15
- package/dist/components/navigation/TabBar.js.map +0 -1
- package/dist/components/navigation/TabBarItem.d.ts +0 -4
- package/dist/components/navigation/TabBarItem.d.ts.map +0 -1
- package/dist/components/navigation/TabBarItem.js +0 -44
- package/dist/components/navigation/TabBarItem.js.map +0 -1
- package/dist/components/navigation/helpers.d.ts +0 -15
- package/dist/components/navigation/helpers.d.ts.map +0 -1
- package/dist/components/navigation/helpers.js +0 -48
- package/dist/components/navigation/helpers.js.map +0 -1
- package/dist/components/navigation/index.d.ts +0 -8
- package/dist/components/navigation/index.d.ts.map +0 -1
- package/dist/components/navigation/index.js +0 -7
- package/dist/components/navigation/index.js.map +0 -1
- package/dist/components/navigation/types.d.ts +0 -58
- package/dist/components/navigation/types.d.ts.map +0 -1
- package/dist/components/navigation/types.js +0 -2
- package/dist/components/navigation/types.js.map +0 -1
- package/src/components/action-sheet/ActionSheet.tsx +0 -130
- package/src/components/action-sheet/ActionSheetItem.tsx +0 -59
- package/src/components/action-sheet/index.ts +0 -3
- package/src/components/action-sheet/types.ts +0 -29
- package/src/components/drawer/Drawer.tsx +0 -100
- package/src/components/drawer/index.ts +0 -2
- package/src/components/drawer/types.ts +0 -13
- package/src/components/navigation/DrawerNavigation.tsx +0 -32
- package/src/components/navigation/DrawerNavigationItem.tsx +0 -23
- package/src/components/navigation/NavigationItem.tsx +0 -79
- package/src/components/navigation/NavigationList.tsx +0 -31
- package/src/components/navigation/TabBar.tsx +0 -31
- package/src/components/navigation/TabBarItem.tsx +0 -79
- package/src/components/navigation/helpers.test.ts +0 -74
- package/src/components/navigation/helpers.ts +0 -81
- package/src/components/navigation/index.ts +0 -16
- package/src/components/navigation/policy.test.ts +0 -140
- package/src/components/navigation/types.ts +0 -66
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BottomSheetBackdrop,
|
|
3
|
+
type BottomSheetBackdropProps,
|
|
4
|
+
BottomSheetModal,
|
|
5
|
+
BottomSheetModalProvider,
|
|
6
|
+
BottomSheetView,
|
|
7
|
+
} from '@gorhom/bottom-sheet';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import type { BottomSheetController, BottomSheetPresentOptions } from '../../types/bottomSheet';
|
|
11
|
+
import { BottomSheetContext } from './BottomSheetContext';
|
|
12
|
+
|
|
13
|
+
/*** Installs the shared bottom-sheet modal host and controller for descendant consumers. */
|
|
14
|
+
export function BottomSheetProvider({ children }: { children: React.ReactNode }) {
|
|
15
|
+
const modalRef = React.useRef<BottomSheetModal>(null);
|
|
16
|
+
const activeRequestRef = React.useRef<BottomSheetPresentOptions | null>(null);
|
|
17
|
+
const presentedRef = React.useRef(false);
|
|
18
|
+
const [activeRequest, setActiveRequest] = React.useState<BottomSheetPresentOptions | null>(null);
|
|
19
|
+
|
|
20
|
+
const present = React.useCallback((options: BottomSheetPresentOptions) => {
|
|
21
|
+
activeRequestRef.current = options;
|
|
22
|
+
setActiveRequest(options);
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
const dismiss = React.useCallback(() => {
|
|
26
|
+
if (presentedRef.current) {
|
|
27
|
+
modalRef.current?.dismiss();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const request = activeRequestRef.current;
|
|
32
|
+
activeRequestRef.current = null;
|
|
33
|
+
setActiveRequest(null);
|
|
34
|
+
request?.onDismiss?.();
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
const handleDismiss = React.useCallback(() => {
|
|
38
|
+
const request = activeRequestRef.current;
|
|
39
|
+
presentedRef.current = false;
|
|
40
|
+
activeRequestRef.current = null;
|
|
41
|
+
setActiveRequest(null);
|
|
42
|
+
request?.onDismiss?.();
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
const controller = React.useMemo<BottomSheetController>(
|
|
46
|
+
() => ({ dismiss, present }),
|
|
47
|
+
[dismiss, present],
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<BottomSheetContext.Provider value={controller}>
|
|
52
|
+
<BottomSheetModalProvider>
|
|
53
|
+
{children}
|
|
54
|
+
<BottomSheetHost
|
|
55
|
+
activeRequest={activeRequest}
|
|
56
|
+
handleDismiss={handleDismiss}
|
|
57
|
+
modalRef={modalRef}
|
|
58
|
+
presentedRef={presentedRef}
|
|
59
|
+
/>
|
|
60
|
+
</BottomSheetModalProvider>
|
|
61
|
+
</BottomSheetContext.Provider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface BottomSheetHostProps {
|
|
66
|
+
readonly activeRequest: BottomSheetPresentOptions | null;
|
|
67
|
+
readonly handleDismiss: () => void;
|
|
68
|
+
readonly modalRef: React.RefObject<BottomSheetModal | null>;
|
|
69
|
+
readonly presentedRef: React.RefObject<boolean>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/*** Renders and presents the single Gorhom modal owned by the provider. */
|
|
73
|
+
function BottomSheetHost({
|
|
74
|
+
activeRequest,
|
|
75
|
+
handleDismiss,
|
|
76
|
+
modalRef,
|
|
77
|
+
presentedRef,
|
|
78
|
+
}: BottomSheetHostProps) {
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
if (!activeRequest || presentedRef.current) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
presentedRef.current = true;
|
|
85
|
+
modalRef.current?.present();
|
|
86
|
+
}, [activeRequest, modalRef, presentedRef]);
|
|
87
|
+
|
|
88
|
+
const renderBackdrop = useBottomSheetBackdrop(activeRequest?.dismissOnBackdropPress);
|
|
89
|
+
const snapPoints = React.useMemo(
|
|
90
|
+
() => (activeRequest?.snapPoints ? [...activeRequest.snapPoints] : undefined),
|
|
91
|
+
[activeRequest?.snapPoints],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
if (!activeRequest) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<BottomSheetModal
|
|
100
|
+
ref={modalRef}
|
|
101
|
+
backdropComponent={renderBackdrop}
|
|
102
|
+
enableDynamicSizing={activeRequest.enableDynamicSizing ?? true}
|
|
103
|
+
enablePanDownToClose={activeRequest.enablePanDownToClose ?? true}
|
|
104
|
+
index={activeRequest.initialIndex ?? 0}
|
|
105
|
+
keyboardBehavior={activeRequest.keyboardBehavior ?? 'interactive'}
|
|
106
|
+
keyboardBlurBehavior={activeRequest.keyboardBlurBehavior ?? 'restore'}
|
|
107
|
+
onChange={activeRequest.onIndexChange}
|
|
108
|
+
onDismiss={handleDismiss}
|
|
109
|
+
snapPoints={snapPoints}
|
|
110
|
+
>
|
|
111
|
+
<BottomSheetView>{activeRequest.content}</BottomSheetView>
|
|
112
|
+
</BottomSheetModal>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/*** Creates the backdrop renderer for the active bottom-sheet request. */
|
|
117
|
+
function useBottomSheetBackdrop(dismissOnBackdropPress: boolean | undefined) {
|
|
118
|
+
return React.useCallback(
|
|
119
|
+
(props: BottomSheetBackdropProps) => (
|
|
120
|
+
<BottomSheetBackdrop
|
|
121
|
+
{...props}
|
|
122
|
+
appearsOnIndex={0}
|
|
123
|
+
disappearsOnIndex={-1}
|
|
124
|
+
pressBehavior={dismissOnBackdropPress === false ? 'none' : 'close'}
|
|
125
|
+
/>
|
|
126
|
+
),
|
|
127
|
+
[dismissOnBackdropPress],
|
|
128
|
+
);
|
|
129
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
4
|
+
|
|
5
|
+
import { useBottomSheet } from './useBottomSheet';
|
|
6
|
+
|
|
7
|
+
describe('useBottomSheet', () => {
|
|
8
|
+
it('requires BottomSheetProvider', () => {
|
|
9
|
+
function Consumer() {
|
|
10
|
+
useBottomSheet();
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
expect(() => renderToStaticMarkup(<Consumer />)).toThrow(
|
|
15
|
+
'useBottomSheet must be used within BottomSheetProvider.',
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { BottomSheetController } from '../../types/bottomSheet';
|
|
4
|
+
import { BottomSheetContext } from './BottomSheetContext';
|
|
5
|
+
|
|
6
|
+
/*** Returns the shared bottom-sheet controller installed by BottomSheetProvider. */
|
|
7
|
+
export function useBottomSheet(): BottomSheetController {
|
|
8
|
+
const controller = React.useContext(BottomSheetContext);
|
|
9
|
+
|
|
10
|
+
if (!controller) {
|
|
11
|
+
throw new Error('useBottomSheet must be used within BottomSheetProvider.');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return controller;
|
|
15
|
+
}
|
package/src/index.test.ts
CHANGED
|
@@ -9,6 +9,7 @@ const indexSource = readFileSync(new URL('./index.ts', import.meta.url), 'utf8')
|
|
|
9
9
|
const packageJson = JSON.parse(
|
|
10
10
|
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
|
|
11
11
|
) as {
|
|
12
|
+
dependencies: Record<string, string>;
|
|
12
13
|
devDependencies: Record<string, string>;
|
|
13
14
|
exports: Record<string, unknown>;
|
|
14
15
|
files: string[];
|
|
@@ -20,7 +21,6 @@ const expectedRootExports = [
|
|
|
20
21
|
"export { Button } from './components/button';",
|
|
21
22
|
"export { Card } from './components/card';",
|
|
22
23
|
"export { Checkbox } from './components/checkbox';",
|
|
23
|
-
"export { Drawer } from './components/drawer';",
|
|
24
24
|
"export { Field } from './components/field';",
|
|
25
25
|
"export { HelperText } from './components/helper-text';",
|
|
26
26
|
"export { IconButton } from './components/icon-button';",
|
|
@@ -28,7 +28,6 @@ const expectedRootExports = [
|
|
|
28
28
|
"export type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';",
|
|
29
29
|
"export { Label } from './components/label';",
|
|
30
30
|
"export { ListItem } from './components/list-item';",
|
|
31
|
-
"export {\n DrawerNavigation,\n DrawerNavigationItem,\n NavigationItem,\n NavigationList,\n TabBar,\n TabBarItem,\n} from './components/navigation';",
|
|
32
31
|
"export { Menu } from './components/menu';",
|
|
33
32
|
"export { Modal } from './components/modal';",
|
|
34
33
|
"export { Radio } from './components/radio';",
|
|
@@ -45,13 +44,24 @@ const expectedRootExports = [
|
|
|
45
44
|
"export * from './theme';",
|
|
46
45
|
] as const;
|
|
47
46
|
|
|
48
|
-
describe('public
|
|
49
|
-
it('keeps the intended package surface
|
|
47
|
+
describe('public root barrel contract', () => {
|
|
48
|
+
it('keeps the intended package surface', () => {
|
|
50
49
|
expectedRootExports.forEach((line) => {
|
|
51
50
|
expect(indexSource).toContain(line);
|
|
52
51
|
});
|
|
53
52
|
});
|
|
54
53
|
|
|
54
|
+
it('does not retain obsolete action-sheet, drawer, or navigation chrome', () => {
|
|
55
|
+
expect(indexSource).not.toContain('ActionSheet');
|
|
56
|
+
expect(indexSource).not.toContain("'./components/action-sheet'");
|
|
57
|
+
expect(indexSource).not.toContain("'./components/drawer'");
|
|
58
|
+
expect(indexSource).not.toContain("'./components/navigation'");
|
|
59
|
+
expect(indexSource).not.toContain('DrawerNavigation');
|
|
60
|
+
expect(indexSource).not.toContain('NavigationItem');
|
|
61
|
+
expect(indexSource).not.toContain('NavigationList');
|
|
62
|
+
expect(indexSource).not.toContain('TabBar');
|
|
63
|
+
});
|
|
64
|
+
|
|
55
65
|
it('keeps internal infrastructure off the public barrel', () => {
|
|
56
66
|
expect(indexSource).not.toContain("'./internal/");
|
|
57
67
|
expect(indexSource).not.toContain('resolveSelectionControlNextChecked');
|
|
@@ -60,7 +70,18 @@ describe('public package contract', () => {
|
|
|
60
70
|
expect(indexSource).not.toContain('useFocusManager');
|
|
61
71
|
});
|
|
62
72
|
|
|
63
|
-
it('
|
|
73
|
+
it('exports the resolved semantic and diagnostic contracts', () => {
|
|
74
|
+
const theme = createTheme();
|
|
75
|
+
const selection: SelectionSemantics = theme.semantics.selection;
|
|
76
|
+
const diagnostics: SurfaceColorDiagnostics = theme.colorDiagnostics;
|
|
77
|
+
|
|
78
|
+
expect(selection.background).toBeDefined();
|
|
79
|
+
expect(diagnostics.generated.swatches).toBe(theme.swatches);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('public package metadata contract', () => {
|
|
84
|
+
it('keeps package metadata aligned with deliberate public entrypoints', () => {
|
|
64
85
|
expect(packageJson.files).toEqual(['dist', 'src', 'README.md', 'CHANGELOG.md', 'LICENSE']);
|
|
65
86
|
expect(packageJson.exports).toEqual({
|
|
66
87
|
'.': {
|
|
@@ -70,6 +91,13 @@ describe('public package contract', () => {
|
|
|
70
91
|
import: './dist/index.js',
|
|
71
92
|
types: './dist/index.d.ts',
|
|
72
93
|
},
|
|
94
|
+
'./bottom-sheet': {
|
|
95
|
+
'react-native': './src/features/bottom-sheet/public.ts',
|
|
96
|
+
browser: './src/features/bottom-sheet/public.ts',
|
|
97
|
+
default: './dist/features/bottom-sheet/public.js',
|
|
98
|
+
import: './dist/features/bottom-sheet/public.js',
|
|
99
|
+
types: './dist/features/bottom-sheet/public.d.ts',
|
|
100
|
+
},
|
|
73
101
|
'./theme': {
|
|
74
102
|
bun: './src/theme/public.ts',
|
|
75
103
|
'react-native': './src/theme/public.ts',
|
|
@@ -88,13 +116,13 @@ describe('public package contract', () => {
|
|
|
88
116
|
expect(packageJson.peerDependencies['react-native-svg']).toBe('15.15.4');
|
|
89
117
|
expect(packageJson.devDependencies['react-native-svg']).toBe('15.15.4');
|
|
90
118
|
});
|
|
119
|
+
});
|
|
91
120
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
expect(
|
|
98
|
-
expect(diagnostics.generated.swatches).toBe(theme.swatches);
|
|
121
|
+
describe('bottom-sheet package contract', () => {
|
|
122
|
+
it('keeps the implementation and Expo 57 runtime boundary explicit', () => {
|
|
123
|
+
expect(packageJson.dependencies['@gorhom/bottom-sheet']).toMatch(/^\^5\./);
|
|
124
|
+
expect(packageJson.peerDependencies['react-native-gesture-handler']).toMatch(/^~2\.32\./);
|
|
125
|
+
expect(packageJson.peerDependencies['react-native-reanimated']).toBe('4.5.1');
|
|
126
|
+
expect(packageJson.peerDependencies['react-native-worklets']).toBe('0.10.1');
|
|
99
127
|
});
|
|
100
128
|
});
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';
|
|
2
|
-
export { ActionSheet, ActionSheetItem } from './components/action-sheet';
|
|
3
1
|
export type { BadgeProps } from './components/badge';
|
|
4
2
|
export { Badge } from './components/badge';
|
|
5
3
|
export type { ButtonIconSpec, ButtonProps } from './components/button';
|
|
@@ -8,8 +6,6 @@ export type { CardProps } from './components/card';
|
|
|
8
6
|
export { Card } from './components/card';
|
|
9
7
|
export type { CheckboxProps } from './components/checkbox';
|
|
10
8
|
export { Checkbox } from './components/checkbox';
|
|
11
|
-
export type { DrawerProps } from './components/drawer';
|
|
12
|
-
export { Drawer } from './components/drawer';
|
|
13
9
|
export type { FieldProps } from './components/field';
|
|
14
10
|
export { Field } from './components/field';
|
|
15
11
|
export type { HelperTextProps } from './components/helper-text';
|
|
@@ -24,24 +20,6 @@ export type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './compon
|
|
|
24
20
|
export { Menu } from './components/menu';
|
|
25
21
|
export type { ModalProps } from './components/modal';
|
|
26
22
|
export { Modal } from './components/modal';
|
|
27
|
-
export type {
|
|
28
|
-
DrawerNavigationItemProps,
|
|
29
|
-
DrawerNavigationProps,
|
|
30
|
-
NavigationItemIcon,
|
|
31
|
-
NavigationItemProps,
|
|
32
|
-
NavigationItemSpec,
|
|
33
|
-
NavigationListProps,
|
|
34
|
-
TabBarItemProps,
|
|
35
|
-
TabBarProps,
|
|
36
|
-
} from './components/navigation';
|
|
37
|
-
export {
|
|
38
|
-
DrawerNavigation,
|
|
39
|
-
DrawerNavigationItem,
|
|
40
|
-
NavigationItem,
|
|
41
|
-
NavigationList,
|
|
42
|
-
TabBar,
|
|
43
|
-
TabBarItem,
|
|
44
|
-
} from './components/navigation';
|
|
45
23
|
export type { RadioProps } from './components/radio';
|
|
46
24
|
export { Radio } from './components/radio';
|
|
47
25
|
export type { SwitchProps } from './components/switch';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface BottomSheetPresentOptions {
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
snapPoints?: readonly (number | string)[];
|
|
6
|
+
initialIndex?: number;
|
|
7
|
+
enableDynamicSizing?: boolean;
|
|
8
|
+
enablePanDownToClose?: boolean;
|
|
9
|
+
dismissOnBackdropPress?: boolean;
|
|
10
|
+
keyboardBehavior?: 'extend' | 'fillParent' | 'interactive';
|
|
11
|
+
keyboardBlurBehavior?: 'none' | 'restore';
|
|
12
|
+
onIndexChange?: (index: number) => void;
|
|
13
|
+
onDismiss?: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface BottomSheetController {
|
|
17
|
+
present: (options: BottomSheetPresentOptions) => void;
|
|
18
|
+
dismiss: () => void;
|
|
19
|
+
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ActionSheetProps } from './types';
|
|
3
|
-
export declare function ActionSheet({ visible, onDismiss, title, description, children, cancelLabel, closeOnBackdrop, interactionPolicy, testID, }: ActionSheetProps): React.JSX.Element | null;
|
|
4
|
-
//# sourceMappingURL=ActionSheet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionSheet.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIhD,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,WAAsB,EACtB,eAAsB,EACtB,iBAA6B,EAC7B,MAAM,GACP,EAAE,gBAAgB,4BAwGlB"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
3
|
-
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
4
|
-
import { Portal } from '../../internal/overlay/Portal';
|
|
5
|
-
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
6
|
-
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
7
|
-
import { Box, Stack, Surface } from '../../layout';
|
|
8
|
-
import { Text } from '../../primitives/text';
|
|
9
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
10
|
-
import { ActionSheetItem } from './ActionSheetItem';
|
|
11
|
-
const boxNonePointerEvents = resolvePointerEvents('box-none');
|
|
12
|
-
export function ActionSheet({ visible, onDismiss, title, description, children, cancelLabel = 'Cancel', closeOnBackdrop = true, interactionPolicy = 'enabled', testID, }) {
|
|
13
|
-
const { theme } = useTheme();
|
|
14
|
-
const animation = resolveOverlayAnimation('modal');
|
|
15
|
-
const passive = interactionPolicy === 'passive';
|
|
16
|
-
if (!visible) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return (<Portal layer="modal" visible={visible}>
|
|
20
|
-
<View {...boxNonePointerEvents.props} style={[
|
|
21
|
-
boxNonePointerEvents.style,
|
|
22
|
-
{
|
|
23
|
-
bottom: 0,
|
|
24
|
-
left: 0,
|
|
25
|
-
position: 'absolute',
|
|
26
|
-
right: 0,
|
|
27
|
-
top: 0,
|
|
28
|
-
},
|
|
29
|
-
]}>
|
|
30
|
-
<Pressable onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined} style={{
|
|
31
|
-
backgroundColor: theme.semantics.neutral.text,
|
|
32
|
-
bottom: 0,
|
|
33
|
-
left: 0,
|
|
34
|
-
opacity: animation.backdropOpacity,
|
|
35
|
-
position: 'absolute',
|
|
36
|
-
right: 0,
|
|
37
|
-
top: 0,
|
|
38
|
-
}} testID={testID ? `${testID}-backdrop` : undefined}/>
|
|
39
|
-
<FocusScope active={visible} onEscape={passive ? undefined : onDismiss} testID={testID ? `${testID}-focus` : undefined}>
|
|
40
|
-
<Box pointerEvents="box-none" style={{
|
|
41
|
-
flex: 1,
|
|
42
|
-
justifyContent: 'flex-end',
|
|
43
|
-
}}>
|
|
44
|
-
<View accessible accessibilityViewIsModal style={{
|
|
45
|
-
alignSelf: 'center',
|
|
46
|
-
maxWidth: 560,
|
|
47
|
-
padding: 16,
|
|
48
|
-
width: '100%',
|
|
49
|
-
}}>
|
|
50
|
-
<Surface p="m" style={{
|
|
51
|
-
borderRadius: 24,
|
|
52
|
-
shadowOpacity: 0.16,
|
|
53
|
-
shadowRadius: 18,
|
|
54
|
-
shadowOffset: { width: 0, height: -8 },
|
|
55
|
-
}} testID={testID} variant="raised">
|
|
56
|
-
<Stack gap="s">
|
|
57
|
-
{title || description ? (<Box px="m" py="s">
|
|
58
|
-
<Stack gap="xxs">
|
|
59
|
-
{title ? (<Text align="center" variant="label" weight="semiBold">
|
|
60
|
-
{title}
|
|
61
|
-
</Text>) : null}
|
|
62
|
-
{description ? (<Text align="center" emphasis="muted" variant="bodySmall">
|
|
63
|
-
{description}
|
|
64
|
-
</Text>) : null}
|
|
65
|
-
</Stack>
|
|
66
|
-
</Box>) : null}
|
|
67
|
-
<Stack gap="xxs">{children}</Stack>
|
|
68
|
-
{onDismiss ? (<ActionSheetItem label={cancelLabel} interactionPolicy={interactionPolicy} onPress={onDismiss} testID={testID ? `${testID}-cancel` : undefined}/>) : null}
|
|
69
|
-
</Stack>
|
|
70
|
-
</Surface>
|
|
71
|
-
</View>
|
|
72
|
-
</Box>
|
|
73
|
-
</FocusScope>
|
|
74
|
-
</View>
|
|
75
|
-
</Portal>);
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=ActionSheet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionSheet.js","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,MAAM,oBAAoB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AC,OAAO,CAAC,MAAM,CAAC,UAAU,CACpD;4BAAA,CAAC,KAAK,CACR;0BAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACR;wBAAA,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CACvD;4BAAA,CAAC,WAAW,CACd;0BAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;sBAAA,EAAE,KAAK,CACT;oBAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CACR;kBAAA,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,CAClC;kBAAA,CAAC,SAAS,CAAC,CAAC,CAAC,CACX,CAAC,eAAe,CACd,KAAK,CAAC,CAAC,WAAW,CAAC,CACnB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,EAChD,CACH,CAAC,CAAC,CAAC,IAAI,CACV;gBAAA,EAAE,KAAK,CACT;cAAA,EAAE,OAAO,CACX;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,GAAG,CACP;QAAA,EAAE,UAAU,CACd;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, View } from 'react-native';\n\nimport { FocusScope } from '../../internal/focus/FocusScope';\nimport { Portal } from '../../internal/overlay/Portal';\nimport { resolvePointerEvents } from '../../internal/resolvePointerEvents';\nimport { resolveOverlayAnimation } from '../../internal/resolvers';\nimport { Box, Stack, Surface } from '../../layout';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { ActionSheetItem } from './ActionSheetItem';\nimport type { ActionSheetProps } from './types';\n\nconst boxNonePointerEvents = resolvePointerEvents('box-none');\n\nexport function ActionSheet({\n visible,\n onDismiss,\n title,\n description,\n children,\n cancelLabel = 'Cancel',\n closeOnBackdrop = true,\n interactionPolicy = 'enabled',\n testID,\n}: ActionSheetProps) {\n const { theme } = useTheme();\n const animation = resolveOverlayAnimation('modal');\n const passive = interactionPolicy === 'passive';\n\n if (!visible) {\n return null;\n }\n\n return (\n <Portal layer=\"modal\" visible={visible}>\n <View\n {...boxNonePointerEvents.props}\n style={[\n boxNonePointerEvents.style,\n {\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n ]}\n >\n <Pressable\n onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined}\n style={{\n backgroundColor: theme.semantics.neutral.text,\n bottom: 0,\n left: 0,\n opacity: animation.backdropOpacity,\n position: 'absolute',\n right: 0,\n top: 0,\n }}\n testID={testID ? `${testID}-backdrop` : undefined}\n />\n <FocusScope\n active={visible}\n onEscape={passive ? undefined : onDismiss}\n testID={testID ? `${testID}-focus` : undefined}\n >\n <Box\n pointerEvents=\"box-none\"\n style={{\n flex: 1,\n justifyContent: 'flex-end',\n }}\n >\n <View\n accessible\n accessibilityViewIsModal\n style={{\n alignSelf: 'center',\n maxWidth: 560,\n padding: 16,\n width: '100%',\n }}\n >\n <Surface\n p=\"m\"\n style={{\n borderRadius: 24,\n shadowOpacity: 0.16,\n shadowRadius: 18,\n shadowOffset: { width: 0, height: -8 },\n }}\n testID={testID}\n variant=\"raised\"\n >\n <Stack gap=\"s\">\n {title || description ? (\n <Box px=\"m\" py=\"s\">\n <Stack gap=\"xxs\">\n {title ? (\n <Text align=\"center\" variant=\"label\" weight=\"semiBold\">\n {title}\n </Text>\n ) : null}\n {description ? (\n <Text align=\"center\" emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n ) : null}\n <Stack gap=\"xxs\">{children}</Stack>\n {onDismiss ? (\n <ActionSheetItem\n label={cancelLabel}\n interactionPolicy={interactionPolicy}\n onPress={onDismiss}\n testID={testID ? `${testID}-cancel` : undefined}\n />\n ) : null}\n </Stack>\n </Surface>\n </View>\n </Box>\n </FocusScope>\n </View>\n </Portal>\n );\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ActionSheetItemProps } from './types';
|
|
3
|
-
export declare function ActionSheetItem({ label, description, leading, trailing, color, disabled, selected, interactionPolicy, onPress, testID, }: ActionSheetItemProps): React.JSX.Element;
|
|
4
|
-
//# sourceMappingURL=ActionSheetItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionSheetItem.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheetItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,EACR,KAAK,EACL,QAAgB,EAChB,QAAgB,EAChB,iBAA6B,EAC7B,OAAO,EACP,MAAM,GACP,EAAE,oBAAoB,qBAwCtB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Inline, Stack } from '../../layout';
|
|
3
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
4
|
-
import { Text } from '../../primitives/text';
|
|
5
|
-
export function ActionSheetItem({ label, description, leading, trailing, color, disabled = false, selected = false, interactionPolicy = 'enabled', onPress, testID, }) {
|
|
6
|
-
return (<ButtonBase accessibilityRole="button" accessibilityState={{ disabled, selected }} disabled={disabled} interactionPolicy={interactionPolicy} onPress={onPress} radius="m" testID={testID}>
|
|
7
|
-
{(state) => (<Box px="m" py="m" radius="m" style={{
|
|
8
|
-
opacity: state.disabled ? 0.56 : 1,
|
|
9
|
-
}}>
|
|
10
|
-
<Inline align="center" gap="m" justify="space-between" wrap="nowrap">
|
|
11
|
-
{leading ? <Box>{leading}</Box> : null}
|
|
12
|
-
<Box flex={1}>
|
|
13
|
-
<Stack gap="xxs">
|
|
14
|
-
<Text color={color} variant="body" weight={selected ? 'semiBold' : 'medium'}>
|
|
15
|
-
{label}
|
|
16
|
-
</Text>
|
|
17
|
-
{description ? (<Text emphasis="muted" variant="bodySmall">
|
|
18
|
-
{description}
|
|
19
|
-
</Text>) : null}
|
|
20
|
-
</Stack>
|
|
21
|
-
</Box>
|
|
22
|
-
{trailing ? <Box>{trailing}</Box> : null}
|
|
23
|
-
</Inline>
|
|
24
|
-
</Box>)}
|
|
25
|
-
</ButtonBase>);
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=ActionSheetItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionSheetItem.js","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheetItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAG7C,MAAM,UAAU,eAAe,CAAC,EAC9B,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,EACR,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,iBAAiB,GAAG,SAAS,EAC7B,OAAO,EACP,MAAM,GACe;IACrB,OAAO,CACL,CAAC,UAAU,CACT,iBAAiB,CAAC,QAAQ,CAC1B,kBAAkB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,C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GAAG,CACL;YAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC1C;UAAA,EAAE,MAAM,CACV;QAAA,EAAE,GAAG,CAAC,CACP,CACH;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { Box, Inline, Stack } from '../../layout';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { Text } from '../../primitives/text';\nimport type { ActionSheetItemProps } from './types';\n\nexport function ActionSheetItem({\n label,\n description,\n leading,\n trailing,\n color,\n disabled = false,\n selected = false,\n interactionPolicy = 'enabled',\n onPress,\n testID,\n}: ActionSheetItemProps) {\n return (\n <ButtonBase\n accessibilityRole=\"button\"\n accessibilityState={{ disabled, selected }}\n disabled={disabled}\n interactionPolicy={interactionPolicy}\n onPress={onPress}\n radius=\"m\"\n testID={testID}\n >\n {(state) => (\n <Box\n px=\"m\"\n py=\"m\"\n radius=\"m\"\n style={{\n opacity: state.disabled ? 0.56 : 1,\n }}\n >\n <Inline align=\"center\" gap=\"m\" justify=\"space-between\" wrap=\"nowrap\">\n {leading ? <Box>{leading}</Box> : null}\n <Box flex={1}>\n <Stack gap=\"xxs\">\n <Text color={color} variant=\"body\" weight={selected ? 'semiBold' : 'medium'}>\n {label}\n </Text>\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n {trailing ? <Box>{trailing}</Box> : null}\n </Inline>\n </Box>\n )}\n </ButtonBase>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/action-sheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { ActionSheet } from './ActionSheet';\nexport { ActionSheetItem } from './ActionSheetItem';\nexport type { ActionSheetItemProps, ActionSheetProps } from './types';\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { InteractionPolicy } from '../../interactionPolicy';
|
|
3
|
-
import type { SurfaceColor } from '../../surfaceColor';
|
|
4
|
-
export interface ActionSheetProps {
|
|
5
|
-
visible: boolean;
|
|
6
|
-
onDismiss?: (() => void) | undefined;
|
|
7
|
-
title?: React.ReactNode;
|
|
8
|
-
description?: React.ReactNode;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
cancelLabel?: React.ReactNode;
|
|
11
|
-
closeOnBackdrop?: boolean;
|
|
12
|
-
interactionPolicy?: InteractionPolicy;
|
|
13
|
-
testID?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface ActionSheetItemProps {
|
|
16
|
-
label: React.ReactNode;
|
|
17
|
-
description?: React.ReactNode;
|
|
18
|
-
leading?: React.ReactNode;
|
|
19
|
-
trailing?: React.ReactNode;
|
|
20
|
-
color?: SurfaceColor;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
selected?: boolean;
|
|
23
|
-
interactionPolicy?: InteractionPolicy;
|
|
24
|
-
onPress?: (() => void) | undefined;
|
|
25
|
-
testID?: string;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACrC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/action-sheet/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { InteractionPolicy } from '../../interactionPolicy';\nimport type { SurfaceColor } from '../../surfaceColor';\n\nexport interface ActionSheetProps {\n visible: boolean;\n onDismiss?: (() => void) | undefined;\n title?: React.ReactNode;\n description?: React.ReactNode;\n children?: React.ReactNode;\n cancelLabel?: React.ReactNode;\n closeOnBackdrop?: boolean;\n interactionPolicy?: InteractionPolicy;\n testID?: string;\n}\n\nexport interface ActionSheetItemProps {\n label: React.ReactNode;\n description?: React.ReactNode;\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n color?: SurfaceColor;\n disabled?: boolean;\n selected?: boolean;\n interactionPolicy?: InteractionPolicy;\n onPress?: (() => void) | undefined;\n testID?: string;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,SAAS,EACT,QAAkB,EAClB,QAAQ,EACR,eAAsB,EACtB,iBAA6B,EAC7B,MAAM,GACP,EAAE,WAAW,4BA8Eb"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
3
|
-
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
4
|
-
import { Portal } from '../../internal/overlay/Portal';
|
|
5
|
-
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
6
|
-
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
7
|
-
import { Box, Surface } from '../../layout';
|
|
8
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
9
|
-
const boxNonePointerEvents = resolvePointerEvents('box-none');
|
|
10
|
-
export function Drawer({ visible, onDismiss, position = 'right', children, closeOnBackdrop = true, interactionPolicy = 'enabled', testID, }) {
|
|
11
|
-
const { theme } = useTheme();
|
|
12
|
-
const animation = resolveOverlayAnimation('drawer');
|
|
13
|
-
const passive = interactionPolicy === 'passive';
|
|
14
|
-
if (!visible) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return (<Portal layer="drawer" visible={visible}>
|
|
18
|
-
<View {...boxNonePointerEvents.props} style={[
|
|
19
|
-
boxNonePointerEvents.style,
|
|
20
|
-
{
|
|
21
|
-
bottom: 0,
|
|
22
|
-
left: 0,
|
|
23
|
-
position: 'absolute',
|
|
24
|
-
right: 0,
|
|
25
|
-
top: 0,
|
|
26
|
-
},
|
|
27
|
-
]}>
|
|
28
|
-
<Pressable onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined} style={{
|
|
29
|
-
backgroundColor: theme.semantics.neutral.text,
|
|
30
|
-
bottom: 0,
|
|
31
|
-
left: 0,
|
|
32
|
-
opacity: animation.backdropOpacity,
|
|
33
|
-
position: 'absolute',
|
|
34
|
-
right: 0,
|
|
35
|
-
top: 0,
|
|
36
|
-
}} testID={testID ? `${testID}-backdrop` : undefined}/>
|
|
37
|
-
<FocusScope active={visible} onEscape={passive ? undefined : onDismiss} testID={testID ? `${testID}-focus` : undefined}>
|
|
38
|
-
<Box pointerEvents="box-none" style={{
|
|
39
|
-
flex: 1,
|
|
40
|
-
justifyContent: 'flex-start',
|
|
41
|
-
}}>
|
|
42
|
-
<View accessible accessibilityViewIsModal style={{
|
|
43
|
-
alignSelf: position === 'left' ? 'flex-start' : 'flex-end',
|
|
44
|
-
height: '100%',
|
|
45
|
-
maxWidth: 420,
|
|
46
|
-
width: '88%',
|
|
47
|
-
}}>
|
|
48
|
-
<Surface p="l" style={{
|
|
49
|
-
height: '100%',
|
|
50
|
-
shadowOpacity: 0.14,
|
|
51
|
-
shadowRadius: 14,
|
|
52
|
-
shadowOffset: { width: position === 'left' ? 4 : -4, height: 0 },
|
|
53
|
-
}} testID={testID} variant="raised">
|
|
54
|
-
{children}
|
|
55
|
-
</Surface>
|
|
56
|
-
</View>
|
|
57
|
-
</Box>
|
|
58
|
-
</FocusScope>
|
|
59
|
-
</View>
|
|
60
|
-
</Portal>);
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAE9D,MAAM,UAAU,MAAM,CAAC,EACrB,OAAO,EACP,SAAS,EACT,QAAQ,GAAG,OAAO,EAClB,QAAQ,EACR,eAAe,GAAG,IAAI,EACtB,iBAAiB,GAAG,SAAS,EAC7B,MAAM,GACM;IACZ,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,iBAAiB,KAAK,SAAS,CAAC;IAEhD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,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,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU;YAC1D,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,KAAK;SACb,CAAC,CAEF;cAAA,CAAC,OAAO,CACN,CAAC,CAAC,GAAG,CACL,KAAK,CAAC,CAAC;YACL,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,EAAE;YAChB,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;SACjE,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,OAAO,CAAC,QAAQ,CAEhB;gBAAA,CAAC,QAAQ,CACX;cAAA,EAAE,OAAO,CACX;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,GAAG,CACP;QAAA,EAAE,UAAU,CACd;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, View } from 'react-native';\n\nimport { FocusScope } from '../../internal/focus/FocusScope';\nimport { Portal } from '../../internal/overlay/Portal';\nimport { resolvePointerEvents } from '../../internal/resolvePointerEvents';\nimport { resolveOverlayAnimation } from '../../internal/resolvers';\nimport { Box, Surface } from '../../layout';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { DrawerProps } from './types';\n\nconst boxNonePointerEvents = resolvePointerEvents('box-none');\n\nexport function Drawer({\n visible,\n onDismiss,\n position = 'right',\n children,\n closeOnBackdrop = true,\n interactionPolicy = 'enabled',\n testID,\n}: DrawerProps) {\n const { theme } = useTheme();\n const animation = resolveOverlayAnimation('drawer');\n const passive = interactionPolicy === 'passive';\n\n if (!visible) {\n return null;\n }\n\n return (\n <Portal layer=\"drawer\" visible={visible}>\n <View\n {...boxNonePointerEvents.props}\n style={[\n boxNonePointerEvents.style,\n {\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n ]}\n >\n <Pressable\n onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined}\n style={{\n backgroundColor: theme.semantics.neutral.text,\n bottom: 0,\n left: 0,\n opacity: animation.backdropOpacity,\n position: 'absolute',\n right: 0,\n top: 0,\n }}\n testID={testID ? `${testID}-backdrop` : undefined}\n />\n <FocusScope\n active={visible}\n onEscape={passive ? undefined : onDismiss}\n testID={testID ? `${testID}-focus` : undefined}\n >\n <Box\n pointerEvents=\"box-none\"\n style={{\n flex: 1,\n justifyContent: 'flex-start',\n }}\n >\n <View\n accessible\n accessibilityViewIsModal\n style={{\n alignSelf: position === 'left' ? 'flex-start' : 'flex-end',\n height: '100%',\n maxWidth: 420,\n width: '88%',\n }}\n >\n <Surface\n p=\"l\"\n style={{\n height: '100%',\n shadowOpacity: 0.14,\n shadowRadius: 14,\n shadowOffset: { width: position === 'left' ? 4 : -4, height: 0 },\n }}\n testID={testID}\n variant=\"raised\"\n >\n {children}\n </Surface>\n </View>\n </Box>\n </FocusScope>\n </View>\n </Portal>\n );\n}\n"]}
|