@oxyhq/bloom 0.14.0 → 0.16.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/lib/commonjs/alert-dialog/AlertDialog.js +35 -27
- package/lib/commonjs/alert-dialog/AlertDialog.js.map +1 -1
- package/lib/commonjs/alert-dialog/index.js +1 -1
- package/lib/commonjs/alert-dialog/index.js.map +1 -1
- package/lib/commonjs/alert-dialog/index.web.js +1 -1
- package/lib/commonjs/alert-dialog/index.web.js.map +1 -1
- package/lib/commonjs/command/Command.js +27 -16
- package/lib/commonjs/command/Command.js.map +1 -1
- package/lib/commonjs/command/index.js +1 -1
- package/lib/commonjs/command/index.js.map +1 -1
- package/lib/commonjs/command/index.web.js +1 -1
- package/lib/commonjs/command/index.web.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.js +336 -43
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +420 -66
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/index.js +2 -9
- package/lib/commonjs/dialog/index.js.map +1 -1
- package/lib/commonjs/dialog/index.web.js +2 -15
- package/lib/commonjs/dialog/index.web.js.map +1 -1
- package/lib/commonjs/dialog/placement.js +104 -0
- package/lib/commonjs/dialog/placement.js.map +1 -0
- package/lib/commonjs/index.js +7 -29
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +13 -35
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/module/alert-dialog/AlertDialog.js +35 -27
- package/lib/module/alert-dialog/AlertDialog.js.map +1 -1
- package/lib/module/alert-dialog/index.js +2 -2
- package/lib/module/alert-dialog/index.js.map +1 -1
- package/lib/module/alert-dialog/index.web.js +2 -2
- package/lib/module/alert-dialog/index.web.js.map +1 -1
- package/lib/module/command/Command.js +27 -16
- package/lib/module/command/Command.js.map +1 -1
- package/lib/module/command/index.js +2 -2
- package/lib/module/command/index.js.map +1 -1
- package/lib/module/command/index.web.js +2 -2
- package/lib/module/command/index.web.js.map +1 -1
- package/lib/module/dialog/Dialog.js +335 -46
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +418 -68
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/index.js +1 -2
- package/lib/module/dialog/index.js.map +1 -1
- package/lib/module/dialog/index.web.js +1 -2
- package/lib/module/dialog/index.web.js.map +1 -1
- package/lib/module/dialog/placement.js +100 -0
- package/lib/module/dialog/placement.js.map +1 -0
- package/lib/module/index.js +1 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -3
- package/lib/module/index.web.js.map +1 -1
- package/lib/typescript/commonjs/alert-dialog/AlertDialog.d.ts +13 -12
- package/lib/typescript/commonjs/alert-dialog/AlertDialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/alert-dialog/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/alert-dialog/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/command/Command.d.ts +8 -8
- package/lib/typescript/commonjs/command/Command.d.ts.map +1 -1
- package/lib/typescript/commonjs/command/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/command/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.d.ts +17 -15
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts +18 -5
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/index.d.ts +2 -4
- package/lib/typescript/commonjs/dialog/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/index.web.d.ts +2 -4
- package/lib/typescript/commonjs/dialog/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/placement.d.ts +71 -0
- package/lib/typescript/commonjs/dialog/placement.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/types.d.ts +66 -3
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -4
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +2 -4
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/module/alert-dialog/AlertDialog.d.ts +13 -12
- package/lib/typescript/module/alert-dialog/AlertDialog.d.ts.map +1 -1
- package/lib/typescript/module/alert-dialog/index.d.ts.map +1 -1
- package/lib/typescript/module/alert-dialog/index.web.d.ts.map +1 -1
- package/lib/typescript/module/command/Command.d.ts +8 -8
- package/lib/typescript/module/command/Command.d.ts.map +1 -1
- package/lib/typescript/module/command/index.d.ts.map +1 -1
- package/lib/typescript/module/command/index.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.d.ts +17 -15
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts +18 -5
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/index.d.ts +2 -4
- package/lib/typescript/module/dialog/index.d.ts.map +1 -1
- package/lib/typescript/module/dialog/index.web.d.ts +2 -4
- package/lib/typescript/module/dialog/index.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/placement.d.ts +71 -0
- package/lib/typescript/module/dialog/placement.d.ts.map +1 -0
- package/lib/typescript/module/dialog/types.d.ts +66 -3
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -4
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +2 -4
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/package.json +1 -18
- package/src/__tests__/AlertDialog.test.tsx +122 -0
- package/src/__tests__/Command.test.tsx +107 -0
- package/src/__tests__/DialogPlacement.test.tsx +144 -0
- package/src/alert-dialog/AlertDialog.tsx +46 -36
- package/src/alert-dialog/index.ts +2 -2
- package/src/alert-dialog/index.web.ts +2 -2
- package/src/command/Command.tsx +30 -19
- package/src/command/index.ts +2 -2
- package/src/command/index.web.ts +2 -2
- package/src/dialog/Dialog.tsx +406 -50
- package/src/dialog/Dialog.web.tsx +496 -78
- package/src/dialog/index.ts +4 -3
- package/src/dialog/index.web.ts +4 -7
- package/src/dialog/placement.ts +113 -0
- package/src/dialog/types.ts +69 -3
- package/src/index.ts +4 -11
- package/src/index.web.ts +4 -11
- package/lib/commonjs/dialog/CenteredDialog.js +0 -250
- package/lib/commonjs/dialog/CenteredDialog.js.map +0 -1
- package/lib/commonjs/dialog/CenteredDialog.web.js +0 -328
- package/lib/commonjs/dialog/CenteredDialog.web.js.map +0 -1
- package/lib/commonjs/dialog/centered-dialog-tokens.js +0 -62
- package/lib/commonjs/dialog/centered-dialog-tokens.js.map +0 -1
- package/lib/commonjs/dialog/centered-dialog-types.js +0 -6
- package/lib/commonjs/dialog/centered-dialog-types.js.map +0 -1
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.js +0 -300
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.js.map +0 -1
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.native.js +0 -226
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.native.js.map +0 -1
- package/lib/commonjs/responsive-sheet/const.js +0 -60
- package/lib/commonjs/responsive-sheet/const.js.map +0 -1
- package/lib/commonjs/responsive-sheet/index.js +0 -19
- package/lib/commonjs/responsive-sheet/index.js.map +0 -1
- package/lib/commonjs/responsive-sheet/index.web.js +0 -19
- package/lib/commonjs/responsive-sheet/index.web.js.map +0 -1
- package/lib/commonjs/responsive-sheet/types.js +0 -6
- package/lib/commonjs/responsive-sheet/types.js.map +0 -1
- package/lib/module/dialog/CenteredDialog.js +0 -244
- package/lib/module/dialog/CenteredDialog.js.map +0 -1
- package/lib/module/dialog/CenteredDialog.web.js +0 -322
- package/lib/module/dialog/CenteredDialog.web.js.map +0 -1
- package/lib/module/dialog/centered-dialog-tokens.js +0 -58
- package/lib/module/dialog/centered-dialog-tokens.js.map +0 -1
- package/lib/module/dialog/centered-dialog-types.js +0 -4
- package/lib/module/dialog/centered-dialog-types.js.map +0 -1
- package/lib/module/responsive-sheet/ResponsiveSheet.js +0 -293
- package/lib/module/responsive-sheet/ResponsiveSheet.js.map +0 -1
- package/lib/module/responsive-sheet/ResponsiveSheet.native.js +0 -219
- package/lib/module/responsive-sheet/ResponsiveSheet.native.js.map +0 -1
- package/lib/module/responsive-sheet/const.js +0 -56
- package/lib/module/responsive-sheet/const.js.map +0 -1
- package/lib/module/responsive-sheet/index.js +0 -4
- package/lib/module/responsive-sheet/index.js.map +0 -1
- package/lib/module/responsive-sheet/index.web.js +0 -14
- package/lib/module/responsive-sheet/index.web.js.map +0 -1
- package/lib/module/responsive-sheet/types.js +0 -4
- package/lib/module/responsive-sheet/types.js.map +0 -1
- package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts +0 -20
- package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts.map +0 -1
- package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts +0 -29
- package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/dialog/centered-dialog-tokens.d.ts +0 -47
- package/lib/typescript/commonjs/dialog/centered-dialog-tokens.d.ts.map +0 -1
- package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts +0 -70
- package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts.map +0 -1
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts +0 -26
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts.map +0 -1
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.native.d.ts +0 -20
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.native.d.ts.map +0 -1
- package/lib/typescript/commonjs/responsive-sheet/const.d.ts +0 -43
- package/lib/typescript/commonjs/responsive-sheet/const.d.ts.map +0 -1
- package/lib/typescript/commonjs/responsive-sheet/index.d.ts +0 -3
- package/lib/typescript/commonjs/responsive-sheet/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts +0 -3
- package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/responsive-sheet/types.d.ts +0 -55
- package/lib/typescript/commonjs/responsive-sheet/types.d.ts.map +0 -1
- package/lib/typescript/module/dialog/CenteredDialog.d.ts +0 -20
- package/lib/typescript/module/dialog/CenteredDialog.d.ts.map +0 -1
- package/lib/typescript/module/dialog/CenteredDialog.web.d.ts +0 -29
- package/lib/typescript/module/dialog/CenteredDialog.web.d.ts.map +0 -1
- package/lib/typescript/module/dialog/centered-dialog-tokens.d.ts +0 -47
- package/lib/typescript/module/dialog/centered-dialog-tokens.d.ts.map +0 -1
- package/lib/typescript/module/dialog/centered-dialog-types.d.ts +0 -70
- package/lib/typescript/module/dialog/centered-dialog-types.d.ts.map +0 -1
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts +0 -26
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts.map +0 -1
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.native.d.ts +0 -20
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.native.d.ts.map +0 -1
- package/lib/typescript/module/responsive-sheet/const.d.ts +0 -43
- package/lib/typescript/module/responsive-sheet/const.d.ts.map +0 -1
- package/lib/typescript/module/responsive-sheet/index.d.ts +0 -3
- package/lib/typescript/module/responsive-sheet/index.d.ts.map +0 -1
- package/lib/typescript/module/responsive-sheet/index.web.d.ts +0 -3
- package/lib/typescript/module/responsive-sheet/index.web.d.ts.map +0 -1
- package/lib/typescript/module/responsive-sheet/types.d.ts +0 -55
- package/lib/typescript/module/responsive-sheet/types.d.ts.map +0 -1
- package/src/__tests__/CenteredDialog.test.tsx +0 -108
- package/src/__tests__/ResponsiveSheet.test.tsx +0 -104
- package/src/dialog/CenteredDialog.stories.tsx +0 -125
- package/src/dialog/CenteredDialog.tsx +0 -303
- package/src/dialog/CenteredDialog.web.tsx +0 -372
- package/src/dialog/centered-dialog-tokens.ts +0 -68
- package/src/dialog/centered-dialog-types.ts +0 -70
- package/src/responsive-sheet/ResponsiveSheet.native.tsx +0 -257
- package/src/responsive-sheet/ResponsiveSheet.stories.tsx +0 -54
- package/src/responsive-sheet/ResponsiveSheet.tsx +0 -327
- package/src/responsive-sheet/const.ts +0 -53
- package/src/responsive-sheet/index.ts +0 -6
- package/src/responsive-sheet/index.web.ts +0 -16
- package/src/responsive-sheet/types.ts +0 -57
package/src/dialog/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { Dialog } from './Dialog';
|
|
2
|
-
export { CenteredDialog, CENTERED_DIALOG_BACKDROP_TESTID } from './CenteredDialog';
|
|
1
|
+
export { Dialog, DIALOG_SHEET_BACKDROP_TESTID } from './Dialog';
|
|
3
2
|
export { BloomDialogProvider } from './BloomDialogProvider';
|
|
4
3
|
export { alert } from './alert';
|
|
5
4
|
export { useDialogContext, useDialogControl } from './context';
|
|
@@ -12,6 +11,8 @@ export type {
|
|
|
12
11
|
DialogActionColor,
|
|
13
12
|
DialogContextProps,
|
|
14
13
|
DialogControlProps,
|
|
14
|
+
DialogInset,
|
|
15
|
+
DialogPlacement,
|
|
15
16
|
DialogProps,
|
|
17
|
+
ResponsiveDialogPlacement,
|
|
16
18
|
} from './types';
|
|
17
|
-
export type { CenteredDialogProps } from './centered-dialog-types';
|
package/src/dialog/index.web.ts
CHANGED
|
@@ -8,12 +8,7 @@
|
|
|
8
8
|
// Web bundlers select this file via the `"browser"` export condition in
|
|
9
9
|
// `package.json`'s `exports['./dialog']`; native bundlers fall through to
|
|
10
10
|
// the React Native build above.
|
|
11
|
-
export { Dialog, BLOOM_DIALOG_CSS } from './Dialog.web';
|
|
12
|
-
export {
|
|
13
|
-
CenteredDialog,
|
|
14
|
-
BLOOM_CENTERED_DIALOG_CSS,
|
|
15
|
-
CENTERED_DIALOG_BACKDROP_TESTID,
|
|
16
|
-
} from './CenteredDialog.web';
|
|
11
|
+
export { Dialog, BLOOM_DIALOG_CSS, DIALOG_SHEET_BACKDROP_TESTID } from './Dialog.web';
|
|
17
12
|
export { BloomDialogProvider } from './BloomDialogProvider.web';
|
|
18
13
|
export { alert } from './alert';
|
|
19
14
|
export { useDialogContext, useDialogControl } from './context';
|
|
@@ -26,6 +21,8 @@ export type {
|
|
|
26
21
|
DialogActionColor,
|
|
27
22
|
DialogContextProps,
|
|
28
23
|
DialogControlProps,
|
|
24
|
+
DialogInset,
|
|
25
|
+
DialogPlacement,
|
|
29
26
|
DialogProps,
|
|
27
|
+
ResponsiveDialogPlacement,
|
|
30
28
|
} from './types';
|
|
31
|
-
export type { CenteredDialogProps } from './centered-dialog-types';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useWindowDimensions } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Anchor a `<Dialog>` can render against.
|
|
6
|
+
*
|
|
7
|
+
* - `'center'` — the default centered modal card (current behavior).
|
|
8
|
+
* - `'left'` / `'right'` — an anchored side-sheet / drawer.
|
|
9
|
+
* - `'bottom'` — a bottom-sheet (drag handle, slide-up).
|
|
10
|
+
*/
|
|
11
|
+
export type DialogPlacement = 'center' | 'left' | 'right' | 'bottom';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A `<Dialog>` placement that may vary by viewport width.
|
|
15
|
+
*
|
|
16
|
+
* Either a single `DialogPlacement` (applied at every width) or a responsive
|
|
17
|
+
* map whose `base` applies below the first breakpoint and whose `sm`/`md`/`lg`/
|
|
18
|
+
* `xl` keys override it at and above the matching Tailwind breakpoint.
|
|
19
|
+
*
|
|
20
|
+
* The common store-drawer case is `{ base: 'bottom', md: 'left' }`; the common
|
|
21
|
+
* dialog-to-sheet case is `{ base: 'bottom', md: 'center' }`.
|
|
22
|
+
*/
|
|
23
|
+
export type ResponsiveDialogPlacement =
|
|
24
|
+
| DialogPlacement
|
|
25
|
+
| {
|
|
26
|
+
base: DialogPlacement;
|
|
27
|
+
sm?: DialogPlacement;
|
|
28
|
+
md?: DialogPlacement;
|
|
29
|
+
lg?: DialogPlacement;
|
|
30
|
+
xl?: DialogPlacement;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Tailwind-default breakpoints (px). A responsive `placement` map resolves to
|
|
35
|
+
* the value for the largest key whose min-width is `<=` the current viewport
|
|
36
|
+
* width, falling back to `base`.
|
|
37
|
+
*/
|
|
38
|
+
export const BREAKPOINT_SM = 640;
|
|
39
|
+
export const BREAKPOINT_MD = 768;
|
|
40
|
+
export const BREAKPOINT_LG = 1024;
|
|
41
|
+
export const BREAKPOINT_XL = 1280;
|
|
42
|
+
|
|
43
|
+
/** Ordered breakpoint table, widest first, so the first match wins. */
|
|
44
|
+
const RESPONSIVE_KEYS = [
|
|
45
|
+
['xl', BREAKPOINT_XL],
|
|
46
|
+
['lg', BREAKPOINT_LG],
|
|
47
|
+
['md', BREAKPOINT_MD],
|
|
48
|
+
['sm', BREAKPOINT_SM],
|
|
49
|
+
] as const;
|
|
50
|
+
|
|
51
|
+
/** Default side-sheet width (px) on wide screens. */
|
|
52
|
+
export const DEFAULT_SIDE_WIDTH = 460;
|
|
53
|
+
|
|
54
|
+
/** Default centered-card max width (px). Matches the legacy `maxWidth: 480`. */
|
|
55
|
+
export const DEFAULT_CENTER_MAX_WIDTH = 480;
|
|
56
|
+
|
|
57
|
+
/** Default bottom-sheet max height as a fraction of the viewport height. */
|
|
58
|
+
export const DEFAULT_MAX_HEIGHT_RATIO = 0.9;
|
|
59
|
+
|
|
60
|
+
/** Corner radius shared by the side-sheet panel and the bottom-sheet top. */
|
|
61
|
+
export const PANEL_RADIUS = 20;
|
|
62
|
+
|
|
63
|
+
/** Open/close transition duration (ms). ~280ms ease-out reads smooth. */
|
|
64
|
+
export const ANIMATION_DURATION = 280;
|
|
65
|
+
|
|
66
|
+
/** Centered-card fade-out duration (ms) — preserves the legacy timing. */
|
|
67
|
+
export const CENTER_FADE_OUT_DURATION = 150;
|
|
68
|
+
|
|
69
|
+
/** CSS approximation of reanimated's `Easing.out(Easing.cubic)`. */
|
|
70
|
+
export const EASE_OUT = 'cubic-bezier(0.33, 1, 0.68, 1)';
|
|
71
|
+
|
|
72
|
+
/** Backdrop dim opacity once fully shown (matches `bg-black/40`). */
|
|
73
|
+
export const SHEET_BACKDROP_OPACITY = 0.4;
|
|
74
|
+
|
|
75
|
+
/** Stable testID for the dimmed backdrop of a side/bottom placement dialog. */
|
|
76
|
+
export const DIALOG_SHEET_BACKDROP_TESTID = 'bloom-dialog-sheet-backdrop';
|
|
77
|
+
|
|
78
|
+
/** Drag-handle pill geometry for the bottom-sheet. */
|
|
79
|
+
export const HANDLE_WIDTH = 36;
|
|
80
|
+
export const HANDLE_HEIGHT = 5;
|
|
81
|
+
export const HANDLE_RADIUS = 3;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Minimum gutter kept between a wide side-sheet and the opposite viewport edge
|
|
85
|
+
* when capping its width, so the panel never spans the full screen.
|
|
86
|
+
*/
|
|
87
|
+
export const SIDE_SHEET_MIN_GUTTER = 24;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Resolve a (possibly responsive) `placement` to a concrete `DialogPlacement`
|
|
91
|
+
* for the current viewport width.
|
|
92
|
+
*
|
|
93
|
+
* A plain string placement resolves to itself. A responsive map picks the
|
|
94
|
+
* value for the largest breakpoint key whose min-width is `<=` the viewport
|
|
95
|
+
* width, falling back to `base` below the first breakpoint.
|
|
96
|
+
*/
|
|
97
|
+
export function useResolvedPlacement(
|
|
98
|
+
placement: ResponsiveDialogPlacement | undefined,
|
|
99
|
+
): DialogPlacement {
|
|
100
|
+
const { width } = useWindowDimensions();
|
|
101
|
+
|
|
102
|
+
return useMemo<DialogPlacement>(() => {
|
|
103
|
+
if (placement === undefined) return 'center';
|
|
104
|
+
if (typeof placement === 'string') return placement;
|
|
105
|
+
for (const [key, minWidth] of RESPONSIVE_KEYS) {
|
|
106
|
+
if (width >= minWidth) {
|
|
107
|
+
const value = placement[key];
|
|
108
|
+
if (value !== undefined) return value;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return placement.base;
|
|
112
|
+
}, [placement, width]);
|
|
113
|
+
}
|
package/src/dialog/types.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import type { GestureResponderEvent, StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
|
|
3
|
+
import type { ResponsiveDialogPlacement } from './placement';
|
|
4
|
+
|
|
5
|
+
export type { DialogPlacement, ResponsiveDialogPlacement } from './placement';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Side-sheet inset (px) from the root overlay's edges. Lets a host place a
|
|
9
|
+
* `left`/`right` placement "inside its own shell" — e.g. offset from the top
|
|
10
|
+
* by a header, or from the anchored edge by a nav rail.
|
|
11
|
+
*/
|
|
12
|
+
export type DialogInset = {
|
|
13
|
+
top?: number;
|
|
14
|
+
bottom?: number;
|
|
15
|
+
left?: number;
|
|
16
|
+
right?: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
3
19
|
/**
|
|
4
20
|
* Imperative open/close handle returned by `useDialogControl`.
|
|
5
21
|
*
|
|
@@ -51,7 +67,14 @@ export type DialogAction = {
|
|
|
51
67
|
/**
|
|
52
68
|
* Props accepted by the unified `<Dialog>` component.
|
|
53
69
|
*
|
|
54
|
-
*
|
|
70
|
+
* Open/close is driven by EITHER of two mutually-exclusive modes:
|
|
71
|
+
*
|
|
72
|
+
* - **Imperative `control`** (`useDialogControl()` + `control.open()` /
|
|
73
|
+
* `control.close()`). The legacy default; unchanged.
|
|
74
|
+
* - **Controlled `open`** (an `open` boolean + `onClose`). When `open` is
|
|
75
|
+
* provided it wins and `control` is ignored.
|
|
76
|
+
*
|
|
77
|
+
* Rendering modes (orthogonal to open/close mode) — pick whichever fits:
|
|
55
78
|
*
|
|
56
79
|
* 1. **Declarative (`title` / `description` / `actions`).** Most common
|
|
57
80
|
* confirm/cancel surface. Bloom renders the title, description and
|
|
@@ -63,10 +86,26 @@ export type DialogAction = {
|
|
|
63
86
|
*
|
|
64
87
|
* 3. **Imperative `alert()`.** Bypass the JSX layer entirely — see the
|
|
65
88
|
* module-level `alert()` helper.
|
|
89
|
+
*
|
|
90
|
+
* `placement` controls the surface anchor — centered modal (default), an
|
|
91
|
+
* anchored side-sheet (`left`/`right`), or a bottom-sheet (`bottom`) — and may
|
|
92
|
+
* be a responsive map that collapses to a bottom-sheet on narrow viewports.
|
|
66
93
|
*/
|
|
67
94
|
export type DialogProps = React.PropsWithChildren<{
|
|
68
|
-
|
|
69
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Imperative open/close handle from `useDialogControl()`. Optional — omit it
|
|
97
|
+
* when driving the dialog with the controlled `open` prop instead.
|
|
98
|
+
*/
|
|
99
|
+
control?: DialogControlProps;
|
|
100
|
+
/**
|
|
101
|
+
* Controlled open state (opt-in). When provided, the dialog is driven by
|
|
102
|
+
* this boolean and `onClose`, and `control` is ignored.
|
|
103
|
+
*/
|
|
104
|
+
open?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Fires after the dialog has finished closing. In controlled mode it is the
|
|
107
|
+
* close request the host must answer by flipping `open` to `false`.
|
|
108
|
+
*/
|
|
70
109
|
onClose?: () => void;
|
|
71
110
|
testID?: string;
|
|
72
111
|
/** Optional dialog header text. Rendered above `description` / `children`. */
|
|
@@ -78,11 +117,38 @@ export type DialogProps = React.PropsWithChildren<{
|
|
|
78
117
|
* confirm/cancel/destructive buttons for you. Order is preserved.
|
|
79
118
|
*/
|
|
80
119
|
actions?: DialogAction[];
|
|
120
|
+
/**
|
|
121
|
+
* Surface anchor. Defaults to `'center'` (the centered modal — current
|
|
122
|
+
* behavior). `'left'`/`'right'` render an anchored side-sheet, `'bottom'` a
|
|
123
|
+
* bottom-sheet. A responsive map resolves by viewport width, e.g.
|
|
124
|
+
* `{ base: 'bottom', md: 'left' }` (drawer on wide, sheet on narrow).
|
|
125
|
+
*/
|
|
126
|
+
placement?: ResponsiveDialogPlacement;
|
|
127
|
+
/** Side-sheet width (px) on wide screens. Defaults to `460`. */
|
|
128
|
+
width?: number;
|
|
129
|
+
/** Centered-card max width (px). Defaults to `480`. */
|
|
130
|
+
maxWidth?: number;
|
|
131
|
+
/** Bottom-sheet max height as a fraction of the viewport height. Defaults to `0.9`. */
|
|
132
|
+
maxHeightRatio?: number;
|
|
133
|
+
/** Side-sheet inset (px) from the root overlay's edges. */
|
|
134
|
+
inset?: DialogInset;
|
|
135
|
+
/** Whether to render the drag handle in bottom-sheet mode. Defaults to `true`. */
|
|
136
|
+
showHandle?: boolean;
|
|
137
|
+
/** Whether tapping the backdrop dismisses the dialog. Defaults to `true`. */
|
|
138
|
+
dismissOnBackdrop?: boolean;
|
|
81
139
|
/**
|
|
82
140
|
* Style overrides applied to the inner content container on native (the
|
|
83
141
|
* floating bottom-sheet card) and to the modal panel on web.
|
|
84
142
|
*/
|
|
85
143
|
style?: StyleProp<ViewStyle>;
|
|
144
|
+
/** Style overrides for the side/bottom placement panel surface. */
|
|
145
|
+
panelStyle?: StyleProp<ViewStyle>;
|
|
146
|
+
/** NativeWind classes for the side/bottom placement panel surface. */
|
|
147
|
+
panelClassName?: string;
|
|
148
|
+
/** Style for the root overlay (theme-var scope, rail offset, etc.). */
|
|
149
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
150
|
+
/** NativeWind classes for the root overlay (e.g. `"md:left-[4.75rem]"`). */
|
|
151
|
+
containerClassName?: string;
|
|
86
152
|
/** Accessibility label, applied to the dialog role on web. */
|
|
87
153
|
label?: string;
|
|
88
154
|
}>;
|
package/src/index.ts
CHANGED
|
@@ -20,8 +20,7 @@ export { type Props as IconProps, sizes as iconSizes, useCommonSVGProps } from '
|
|
|
20
20
|
export * from './portal';
|
|
21
21
|
export {
|
|
22
22
|
Dialog,
|
|
23
|
-
|
|
24
|
-
CENTERED_DIALOG_BACKDROP_TESTID,
|
|
23
|
+
DIALOG_SHEET_BACKDROP_TESTID,
|
|
25
24
|
BloomDialogProvider,
|
|
26
25
|
alert,
|
|
27
26
|
useDialogContext,
|
|
@@ -30,12 +29,14 @@ export {
|
|
|
30
29
|
export type {
|
|
31
30
|
AlertButton,
|
|
32
31
|
AlertButtonStyle,
|
|
33
|
-
CenteredDialogProps,
|
|
34
32
|
DialogAction,
|
|
35
33
|
DialogActionColor,
|
|
36
34
|
DialogContextProps,
|
|
37
35
|
DialogControlProps,
|
|
36
|
+
DialogInset,
|
|
37
|
+
DialogPlacement,
|
|
38
38
|
DialogProps,
|
|
39
|
+
ResponsiveDialogPlacement,
|
|
39
40
|
} from './dialog';
|
|
40
41
|
export * from './button';
|
|
41
42
|
export { Fab } from './fab';
|
|
@@ -88,14 +89,6 @@ export type { ComboboxProps, ComboboxOption } from './combobox';
|
|
|
88
89
|
export { BottomSheet } from './bottom-sheet';
|
|
89
90
|
export type { BottomSheetRef, BottomSheetProps } from './bottom-sheet';
|
|
90
91
|
|
|
91
|
-
// Responsive sheet — side-sheet on wide screens, bottom-sheet on narrow.
|
|
92
|
-
export { ResponsiveSheet, RESPONSIVE_SHEET_BACKDROP_TESTID } from './responsive-sheet';
|
|
93
|
-
export type {
|
|
94
|
-
ResponsiveSheetProps,
|
|
95
|
-
ResponsiveSheetSide,
|
|
96
|
-
ResponsiveSheetInset,
|
|
97
|
-
} from './responsive-sheet';
|
|
98
|
-
|
|
99
92
|
// Data display
|
|
100
93
|
export * from './card';
|
|
101
94
|
export * from './badge';
|
package/src/index.web.ts
CHANGED
|
@@ -25,8 +25,7 @@ export { type Props as IconProps, sizes as iconSizes, useCommonSVGProps } from '
|
|
|
25
25
|
export * from './portal/index.web';
|
|
26
26
|
export {
|
|
27
27
|
Dialog,
|
|
28
|
-
|
|
29
|
-
CENTERED_DIALOG_BACKDROP_TESTID,
|
|
28
|
+
DIALOG_SHEET_BACKDROP_TESTID,
|
|
30
29
|
BloomDialogProvider,
|
|
31
30
|
alert,
|
|
32
31
|
useDialogContext,
|
|
@@ -35,12 +34,14 @@ export {
|
|
|
35
34
|
export type {
|
|
36
35
|
AlertButton,
|
|
37
36
|
AlertButtonStyle,
|
|
38
|
-
CenteredDialogProps,
|
|
39
37
|
DialogAction,
|
|
40
38
|
DialogActionColor,
|
|
41
39
|
DialogContextProps,
|
|
42
40
|
DialogControlProps,
|
|
41
|
+
DialogInset,
|
|
42
|
+
DialogPlacement,
|
|
43
43
|
DialogProps,
|
|
44
|
+
ResponsiveDialogPlacement,
|
|
44
45
|
} from './dialog/index.web';
|
|
45
46
|
export * from './button/index.web';
|
|
46
47
|
export { Fab } from './fab/index.web';
|
|
@@ -93,14 +94,6 @@ export type { ComboboxProps, ComboboxOption } from './combobox/index.web';
|
|
|
93
94
|
export { BottomSheet } from './bottom-sheet';
|
|
94
95
|
export type { BottomSheetRef, BottomSheetProps } from './bottom-sheet';
|
|
95
96
|
|
|
96
|
-
// Responsive sheet — side-sheet on wide screens, bottom-sheet on narrow.
|
|
97
|
-
export { ResponsiveSheet, RESPONSIVE_SHEET_BACKDROP_TESTID } from './responsive-sheet/index.web';
|
|
98
|
-
export type {
|
|
99
|
-
ResponsiveSheetProps,
|
|
100
|
-
ResponsiveSheetSide,
|
|
101
|
-
ResponsiveSheetInset,
|
|
102
|
-
} from './responsive-sheet/index.web';
|
|
103
|
-
|
|
104
97
|
// Data display
|
|
105
98
|
export * from './card';
|
|
106
99
|
export * from './badge';
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CENTERED_DIALOG_BACKDROP_TESTID = void 0;
|
|
7
|
-
exports.CenteredDialog = CenteredDialog;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _useInteractionState = require("../hooks/useInteractionState.js");
|
|
11
|
-
var _Times = require("../icons/Times.js");
|
|
12
|
-
var _useTheme = require("../theme/use-theme.js");
|
|
13
|
-
var _index = require("../typography/index.js");
|
|
14
|
-
var _centeredDialogTokens = require("./centered-dialog-tokens.js");
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
|
-
const CLOSE_HIT_SLOP = {
|
|
18
|
-
top: 8,
|
|
19
|
-
bottom: 8,
|
|
20
|
-
left: 8,
|
|
21
|
-
right: 8
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/** Stable testID for the dimmed backdrop. Overridden when a `testID` is set. */
|
|
25
|
-
const CENTERED_DIALOG_BACKDROP_TESTID = exports.CENTERED_DIALOG_BACKDROP_TESTID = 'bloom-centered-dialog-backdrop';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Native variant of `<CenteredDialog>`.
|
|
29
|
-
*
|
|
30
|
-
* A controlled, centered modal: a transparent RN `Modal` (fade animation,
|
|
31
|
-
* own native window) hosting a dimmed full-screen backdrop and a centered,
|
|
32
|
-
* rounded card styled entirely from Bloom theme tokens.
|
|
33
|
-
*
|
|
34
|
-
* The backdrop is a sibling `Pressable` rendered BEHIND the card (absolute
|
|
35
|
-
* filled), never a parent of it — so a tap on the card never bubbles to the
|
|
36
|
-
* backdrop's close handler and the card never ends up nested inside the
|
|
37
|
-
* backdrop's pressable on web.
|
|
38
|
-
*
|
|
39
|
-
* Dismissal: backdrop tap (when `dismissible`), the header close button, and
|
|
40
|
-
* the Android hardware back button (`onRequestClose`) all call `onClose`.
|
|
41
|
-
*/
|
|
42
|
-
function CenteredDialog({
|
|
43
|
-
visible,
|
|
44
|
-
onClose,
|
|
45
|
-
title,
|
|
46
|
-
dismissible = true,
|
|
47
|
-
maxWidth = _centeredDialogTokens.DEFAULT_MAX_WIDTH,
|
|
48
|
-
compact = true,
|
|
49
|
-
showClose,
|
|
50
|
-
children,
|
|
51
|
-
footer,
|
|
52
|
-
accessibilityLabel,
|
|
53
|
-
closeAccessibilityLabel = 'Close dialog',
|
|
54
|
-
backdropAccessibilityLabel = 'Dismiss dialog',
|
|
55
|
-
cardStyle,
|
|
56
|
-
contentStyle,
|
|
57
|
-
testID
|
|
58
|
-
}) {
|
|
59
|
-
const theme = (0, _useTheme.useTheme)();
|
|
60
|
-
const backdropPress = (0, _useInteractionState.useInteractionState)();
|
|
61
|
-
const spacing = (0, _react.useMemo)(() => (0, _centeredDialogTokens.resolveSpacing)(compact), [compact]);
|
|
62
|
-
const resolvedShowClose = showClose ?? Boolean(title);
|
|
63
|
-
const hasHeader = Boolean(title) || resolvedShowClose;
|
|
64
|
-
const handleBackdropPress = dismissible ? onClose : undefined;
|
|
65
|
-
// Android's hardware back must always be answerable; when the dialog is
|
|
66
|
-
// non-dismissible we still need a handler (RN requires one for transparent
|
|
67
|
-
// modals) — make it a no-op so back does nothing rather than crash.
|
|
68
|
-
const handleRequestClose = dismissible ? onClose : noop;
|
|
69
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
|
|
70
|
-
visible: visible,
|
|
71
|
-
transparent: true,
|
|
72
|
-
animationType: "fade",
|
|
73
|
-
statusBarTranslucent: true,
|
|
74
|
-
onRequestClose: handleRequestClose,
|
|
75
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
76
|
-
style: [styles.root, {
|
|
77
|
-
padding: _centeredDialogTokens.VIEWPORT_GUTTER
|
|
78
|
-
}],
|
|
79
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
80
|
-
testID: testID ? `${testID}-backdrop` : CENTERED_DIALOG_BACKDROP_TESTID,
|
|
81
|
-
style: [styles.backdrop, {
|
|
82
|
-
backgroundColor: theme.colors.overlay
|
|
83
|
-
}, backdropPress.state && styles.backdropPressed],
|
|
84
|
-
onPress: handleBackdropPress,
|
|
85
|
-
onPressIn: backdropPress.onIn,
|
|
86
|
-
onPressOut: backdropPress.onOut,
|
|
87
|
-
disabled: !dismissible,
|
|
88
|
-
accessibilityRole: "button",
|
|
89
|
-
accessibilityLabel: backdropAccessibilityLabel
|
|
90
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
91
|
-
testID: testID,
|
|
92
|
-
accessibilityLabel: accessibilityLabel ?? title,
|
|
93
|
-
style: [styles.card, {
|
|
94
|
-
maxWidth,
|
|
95
|
-
maxHeight: `${_centeredDialogTokens.MAX_HEIGHT_FRACTION * 100}%`,
|
|
96
|
-
backgroundColor: theme.colors.card,
|
|
97
|
-
borderColor: theme.colors.border,
|
|
98
|
-
shadowColor: theme.colors.shadow
|
|
99
|
-
}, cardStyle],
|
|
100
|
-
children: [hasHeader ? /*#__PURE__*/(0, _jsxRuntime.jsx)(DialogHeader, {
|
|
101
|
-
title: title,
|
|
102
|
-
showClose: resolvedShowClose,
|
|
103
|
-
padding: spacing.pad,
|
|
104
|
-
gap: spacing.headerGap,
|
|
105
|
-
closeAccessibilityLabel: closeAccessibilityLabel,
|
|
106
|
-
onClose: onClose
|
|
107
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
108
|
-
style: styles.bodyScroll,
|
|
109
|
-
contentContainerStyle: [{
|
|
110
|
-
padding: spacing.pad,
|
|
111
|
-
paddingTop: hasHeader ? spacing.headerGap : spacing.pad,
|
|
112
|
-
gap: spacing.contentGap
|
|
113
|
-
}, contentStyle],
|
|
114
|
-
showsVerticalScrollIndicator: false,
|
|
115
|
-
keyboardShouldPersistTaps: "handled",
|
|
116
|
-
children: children
|
|
117
|
-
}), footer ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
118
|
-
style: [styles.footer, {
|
|
119
|
-
padding: spacing.pad,
|
|
120
|
-
paddingTop: spacing.footerGap,
|
|
121
|
-
borderTopColor: theme.colors.borderLight
|
|
122
|
-
}],
|
|
123
|
-
children: footer
|
|
124
|
-
}) : null]
|
|
125
|
-
})]
|
|
126
|
-
})
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function DialogHeader({
|
|
130
|
-
title,
|
|
131
|
-
showClose,
|
|
132
|
-
padding,
|
|
133
|
-
gap,
|
|
134
|
-
closeAccessibilityLabel,
|
|
135
|
-
onClose
|
|
136
|
-
}) {
|
|
137
|
-
const theme = (0, _useTheme.useTheme)();
|
|
138
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
139
|
-
style: [styles.header, {
|
|
140
|
-
paddingHorizontal: padding,
|
|
141
|
-
paddingTop: padding,
|
|
142
|
-
gap
|
|
143
|
-
}],
|
|
144
|
-
children: [title ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Text, {
|
|
145
|
-
accessibilityRole: "header",
|
|
146
|
-
numberOfLines: 2,
|
|
147
|
-
style: [styles.title, {
|
|
148
|
-
color: theme.colors.text
|
|
149
|
-
}],
|
|
150
|
-
children: title
|
|
151
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
152
|
-
style: styles.titleSpacer
|
|
153
|
-
}), showClose ? /*#__PURE__*/(0, _jsxRuntime.jsx)(CloseButton, {
|
|
154
|
-
accessibilityLabel: closeAccessibilityLabel,
|
|
155
|
-
onPress: onClose
|
|
156
|
-
}) : null]
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function CloseButton({
|
|
160
|
-
accessibilityLabel,
|
|
161
|
-
onPress
|
|
162
|
-
}) {
|
|
163
|
-
const theme = (0, _useTheme.useTheme)();
|
|
164
|
-
const press = (0, _useInteractionState.useInteractionState)();
|
|
165
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
166
|
-
onPress: onPress,
|
|
167
|
-
onPressIn: press.onIn,
|
|
168
|
-
onPressOut: press.onOut,
|
|
169
|
-
hitSlop: CLOSE_HIT_SLOP,
|
|
170
|
-
accessibilityRole: "button",
|
|
171
|
-
accessibilityLabel: accessibilityLabel,
|
|
172
|
-
style: [styles.closeButton, {
|
|
173
|
-
backgroundColor: theme.colors.contrast50
|
|
174
|
-
}, press.state && styles.closeButtonPressed],
|
|
175
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Times.TimesLarge_Stroke2_Corner0_Rounded, {
|
|
176
|
-
size: "sm",
|
|
177
|
-
fill: theme.colors.textSecondary
|
|
178
|
-
})
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
function noop() {
|
|
182
|
-
/* non-dismissible: hardware back is intentionally inert */
|
|
183
|
-
}
|
|
184
|
-
const styles = _reactNative.StyleSheet.create({
|
|
185
|
-
root: {
|
|
186
|
-
flex: 1,
|
|
187
|
-
alignItems: 'center',
|
|
188
|
-
justifyContent: 'center'
|
|
189
|
-
},
|
|
190
|
-
backdrop: {
|
|
191
|
-
// Spell out the absolute-fill rect (matches `Fill`'s canonical style)
|
|
192
|
-
// rather than spreading the deprecated `StyleSheet.absoluteFillObject`,
|
|
193
|
-
// which RN 0.83's generated types no longer surface on the `StyleSheet`
|
|
194
|
-
// namespace and which downstream type-checks reject.
|
|
195
|
-
position: 'absolute',
|
|
196
|
-
top: 0,
|
|
197
|
-
right: 0,
|
|
198
|
-
bottom: 0,
|
|
199
|
-
left: 0
|
|
200
|
-
},
|
|
201
|
-
// A subtle deepening on press confirms the tap-to-dismiss affordance.
|
|
202
|
-
backdropPressed: {
|
|
203
|
-
opacity: 0.92
|
|
204
|
-
},
|
|
205
|
-
card: {
|
|
206
|
-
width: '100%',
|
|
207
|
-
borderRadius: _centeredDialogTokens.CARD_RADIUS,
|
|
208
|
-
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
209
|
-
overflow: 'hidden',
|
|
210
|
-
shadowOpacity: 0.18,
|
|
211
|
-
shadowRadius: 24,
|
|
212
|
-
shadowOffset: {
|
|
213
|
-
width: 0,
|
|
214
|
-
height: 8
|
|
215
|
-
},
|
|
216
|
-
elevation: 12
|
|
217
|
-
},
|
|
218
|
-
header: {
|
|
219
|
-
flexDirection: 'row',
|
|
220
|
-
alignItems: 'flex-start',
|
|
221
|
-
justifyContent: 'space-between'
|
|
222
|
-
},
|
|
223
|
-
title: {
|
|
224
|
-
flex: 1,
|
|
225
|
-
fontSize: 17,
|
|
226
|
-
fontWeight: '700',
|
|
227
|
-
lineHeight: 22
|
|
228
|
-
},
|
|
229
|
-
titleSpacer: {
|
|
230
|
-
flex: 1
|
|
231
|
-
},
|
|
232
|
-
closeButton: {
|
|
233
|
-
width: 28,
|
|
234
|
-
height: 28,
|
|
235
|
-
borderRadius: 14,
|
|
236
|
-
alignItems: 'center',
|
|
237
|
-
justifyContent: 'center'
|
|
238
|
-
},
|
|
239
|
-
closeButtonPressed: {
|
|
240
|
-
opacity: 0.7
|
|
241
|
-
},
|
|
242
|
-
bodyScroll: {
|
|
243
|
-
flexGrow: 0,
|
|
244
|
-
flexShrink: 1
|
|
245
|
-
},
|
|
246
|
-
footer: {
|
|
247
|
-
borderTopWidth: _reactNative.StyleSheet.hairlineWidth
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
//# sourceMappingURL=CenteredDialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useInteractionState","_Times","_useTheme","_index","_centeredDialogTokens","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CLOSE_HIT_SLOP","top","bottom","left","right","CENTERED_DIALOG_BACKDROP_TESTID","exports","CenteredDialog","visible","onClose","title","dismissible","maxWidth","DEFAULT_MAX_WIDTH","compact","showClose","children","footer","accessibilityLabel","closeAccessibilityLabel","backdropAccessibilityLabel","cardStyle","contentStyle","testID","theme","useTheme","backdropPress","useInteractionState","spacing","useMemo","resolveSpacing","resolvedShowClose","Boolean","hasHeader","handleBackdropPress","undefined","handleRequestClose","noop","jsx","Modal","transparent","animationType","statusBarTranslucent","onRequestClose","jsxs","View","style","styles","root","padding","VIEWPORT_GUTTER","Pressable","backdrop","backgroundColor","colors","overlay","state","backdropPressed","onPress","onPressIn","onIn","onPressOut","onOut","disabled","accessibilityRole","card","maxHeight","MAX_HEIGHT_FRACTION","borderColor","border","shadowColor","shadow","DialogHeader","pad","gap","headerGap","ScrollView","bodyScroll","contentContainerStyle","paddingTop","contentGap","showsVerticalScrollIndicator","keyboardShouldPersistTaps","footerGap","borderTopColor","borderLight","header","paddingHorizontal","Text","numberOfLines","color","text","titleSpacer","CloseButton","press","hitSlop","closeButton","contrast50","closeButtonPressed","TimesLarge_Stroke2_Corner0_Rounded","size","fill","textSecondary","StyleSheet","create","flex","alignItems","justifyContent","position","opacity","width","borderRadius","CARD_RADIUS","borderWidth","hairlineWidth","overflow","shadowOpacity","shadowRadius","shadowOffset","height","elevation","flexDirection","fontSize","fontWeight","lineHeight","flexGrow","flexShrink","borderTopWidth"],"sourceRoot":"../../../src","sources":["dialog/CenteredDialog.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAA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