@oxyhq/bloom 0.15.0 → 0.16.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/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 +39 -152
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +61 -196
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +205 -0
- package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -0
- package/lib/commonjs/dialog/DialogContent.js +155 -0
- package/lib/commonjs/dialog/DialogContent.js.map +1 -0
- package/lib/commonjs/dialog/index.js +0 -13
- package/lib/commonjs/dialog/index.js.map +1 -1
- package/lib/commonjs/dialog/index.web.js +0 -19
- package/lib/commonjs/dialog/index.web.js.map +1 -1
- package/lib/commonjs/index.js +0 -29
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +6 -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 +42 -155
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +63 -198
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +200 -0
- package/lib/module/dialog/DialogBottomSheet.js.map +1 -0
- package/lib/module/dialog/DialogContent.js +148 -0
- package/lib/module/dialog/DialogContent.js.map +1 -0
- package/lib/module/dialog/index.js +0 -1
- package/lib/module/dialog/index.js.map +1 -1
- package/lib/module/dialog/index.web.js +0 -1
- package/lib/module/dialog/index.web.js.map +1 -1
- 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 +2 -3
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts +11 -8
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts +29 -0
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/DialogContent.d.ts +32 -0
- package/lib/typescript/commonjs/dialog/DialogContent.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/index.d.ts +0 -2
- package/lib/typescript/commonjs/dialog/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/index.web.d.ts +0 -2
- package/lib/typescript/commonjs/dialog/index.web.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 +2 -3
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts +11 -8
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts +29 -0
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -0
- package/lib/typescript/module/dialog/DialogContent.d.ts +32 -0
- package/lib/typescript/module/dialog/DialogContent.d.ts.map +1 -0
- package/lib/typescript/module/dialog/index.d.ts +0 -2
- package/lib/typescript/module/dialog/index.d.ts.map +1 -1
- package/lib/typescript/module/dialog/index.web.d.ts +0 -2
- package/lib/typescript/module/dialog/index.web.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__/BottomSheetGesture.test.tsx +135 -0
- package/src/__tests__/Command.test.tsx +107 -0
- package/src/__tests__/DialogBottomSheet.test.tsx +130 -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 +35 -168
- package/src/dialog/Dialog.web.tsx +52 -209
- package/src/dialog/DialogBottomSheet.tsx +235 -0
- package/src/dialog/DialogContent.tsx +157 -0
- package/src/dialog/index.ts +0 -2
- package/src/dialog/index.web.ts +0 -6
- package/src/index.ts +0 -11
- package/src/index.web.ts +0 -11
- package/lib/commonjs/dialog/CenteredDialog.js +0 -252
- package/lib/commonjs/dialog/CenteredDialog.js.map +0 -1
- package/lib/commonjs/dialog/CenteredDialog.web.js +0 -330
- 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 -97
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.js.map +0 -1
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.web.js +0 -84
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.web.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 -246
- package/lib/module/dialog/CenteredDialog.js.map +0 -1
- package/lib/module/dialog/CenteredDialog.web.js +0 -324
- 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 -90
- package/lib/module/responsive-sheet/ResponsiveSheet.js.map +0 -1
- package/lib/module/responsive-sheet/ResponsiveSheet.web.js +0 -77
- package/lib/module/responsive-sheet/ResponsiveSheet.web.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 -12
- 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 -22
- package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts.map +0 -1
- package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts +0 -31
- 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 -74
- package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts.map +0 -1
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts +0 -22
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts.map +0 -1
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.web.d.ts +0 -16
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.web.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 -58
- package/lib/typescript/commonjs/responsive-sheet/types.d.ts.map +0 -1
- package/lib/typescript/module/dialog/CenteredDialog.d.ts +0 -22
- package/lib/typescript/module/dialog/CenteredDialog.d.ts.map +0 -1
- package/lib/typescript/module/dialog/CenteredDialog.web.d.ts +0 -31
- 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 -74
- package/lib/typescript/module/dialog/centered-dialog-types.d.ts.map +0 -1
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts +0 -22
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts.map +0 -1
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.web.d.ts +0 -16
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.web.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 -58
- 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 -88
- package/src/dialog/CenteredDialog.stories.tsx +0 -125
- package/src/dialog/CenteredDialog.tsx +0 -305
- package/src/dialog/CenteredDialog.web.tsx +0 -374
- package/src/dialog/centered-dialog-tokens.ts +0 -68
- package/src/dialog/centered-dialog-types.ts +0 -74
- package/src/responsive-sheet/ResponsiveSheet.stories.tsx +0 -54
- package/src/responsive-sheet/ResponsiveSheet.tsx +0 -88
- package/src/responsive-sheet/ResponsiveSheet.web.tsx +0 -76
- package/src/responsive-sheet/index.ts +0 -6
- package/src/responsive-sheet/index.web.ts +0 -14
- package/src/responsive-sheet/types.ts +0 -60
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_ResponsiveSheetWeb","require"],"sourceRoot":"../../../src","sources":["responsive-sheet/index.web.ts"],"mappings":";;;;;;;;;;;;;;;;;AAQA,IAAAA,mBAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["responsive-sheet/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
4
|
-
import { Modal, Pressable, ScrollView, StyleSheet, View } from 'react-native';
|
|
5
|
-
import { useInteractionState } from "../hooks/useInteractionState.js";
|
|
6
|
-
import { TimesLarge_Stroke2_Corner0_Rounded as CloseIcon } from "../icons/Times.js";
|
|
7
|
-
import { useTheme } from "../theme/use-theme.js";
|
|
8
|
-
import { Text } from "../typography/index.js";
|
|
9
|
-
import { CARD_RADIUS, DEFAULT_MAX_WIDTH, MAX_HEIGHT_FRACTION, resolveSpacing, VIEWPORT_GUTTER } from "./centered-dialog-tokens.js";
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
const CLOSE_HIT_SLOP = {
|
|
12
|
-
top: 8,
|
|
13
|
-
bottom: 8,
|
|
14
|
-
left: 8,
|
|
15
|
-
right: 8
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/** Stable testID for the dimmed backdrop. Overridden when a `testID` is set. */
|
|
19
|
-
export const CENTERED_DIALOG_BACKDROP_TESTID = 'bloom-centered-dialog-backdrop';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Use `<Dialog placement="center">` instead.
|
|
23
|
-
*
|
|
24
|
-
* Native variant of `<CenteredDialog>`.
|
|
25
|
-
*
|
|
26
|
-
* A controlled, centered modal: a transparent RN `Modal` (fade animation,
|
|
27
|
-
* own native window) hosting a dimmed full-screen backdrop and a centered,
|
|
28
|
-
* rounded card styled entirely from Bloom theme tokens.
|
|
29
|
-
*
|
|
30
|
-
* The backdrop is a sibling `Pressable` rendered BEHIND the card (absolute
|
|
31
|
-
* filled), never a parent of it — so a tap on the card never bubbles to the
|
|
32
|
-
* backdrop's close handler and the card never ends up nested inside the
|
|
33
|
-
* backdrop's pressable on web.
|
|
34
|
-
*
|
|
35
|
-
* Dismissal: backdrop tap (when `dismissible`), the header close button, and
|
|
36
|
-
* the Android hardware back button (`onRequestClose`) all call `onClose`.
|
|
37
|
-
*/
|
|
38
|
-
export function CenteredDialog({
|
|
39
|
-
visible,
|
|
40
|
-
onClose,
|
|
41
|
-
title,
|
|
42
|
-
dismissible = true,
|
|
43
|
-
maxWidth = DEFAULT_MAX_WIDTH,
|
|
44
|
-
compact = true,
|
|
45
|
-
showClose,
|
|
46
|
-
children,
|
|
47
|
-
footer,
|
|
48
|
-
accessibilityLabel,
|
|
49
|
-
closeAccessibilityLabel = 'Close dialog',
|
|
50
|
-
backdropAccessibilityLabel = 'Dismiss dialog',
|
|
51
|
-
cardStyle,
|
|
52
|
-
contentStyle,
|
|
53
|
-
testID
|
|
54
|
-
}) {
|
|
55
|
-
const theme = useTheme();
|
|
56
|
-
const backdropPress = useInteractionState();
|
|
57
|
-
const spacing = useMemo(() => resolveSpacing(compact), [compact]);
|
|
58
|
-
const resolvedShowClose = showClose ?? Boolean(title);
|
|
59
|
-
const hasHeader = Boolean(title) || resolvedShowClose;
|
|
60
|
-
const handleBackdropPress = dismissible ? onClose : undefined;
|
|
61
|
-
// Android's hardware back must always be answerable; when the dialog is
|
|
62
|
-
// non-dismissible we still need a handler (RN requires one for transparent
|
|
63
|
-
// modals) — make it a no-op so back does nothing rather than crash.
|
|
64
|
-
const handleRequestClose = dismissible ? onClose : noop;
|
|
65
|
-
return /*#__PURE__*/_jsx(Modal, {
|
|
66
|
-
visible: visible,
|
|
67
|
-
transparent: true,
|
|
68
|
-
animationType: "fade",
|
|
69
|
-
statusBarTranslucent: true,
|
|
70
|
-
onRequestClose: handleRequestClose,
|
|
71
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
72
|
-
style: [styles.root, {
|
|
73
|
-
padding: VIEWPORT_GUTTER
|
|
74
|
-
}],
|
|
75
|
-
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
76
|
-
testID: testID ? `${testID}-backdrop` : CENTERED_DIALOG_BACKDROP_TESTID,
|
|
77
|
-
style: [styles.backdrop, {
|
|
78
|
-
backgroundColor: theme.colors.overlay
|
|
79
|
-
}, backdropPress.state && styles.backdropPressed],
|
|
80
|
-
onPress: handleBackdropPress,
|
|
81
|
-
onPressIn: backdropPress.onIn,
|
|
82
|
-
onPressOut: backdropPress.onOut,
|
|
83
|
-
disabled: !dismissible,
|
|
84
|
-
accessibilityRole: "button",
|
|
85
|
-
accessibilityLabel: backdropAccessibilityLabel
|
|
86
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
87
|
-
testID: testID,
|
|
88
|
-
accessibilityLabel: accessibilityLabel ?? title,
|
|
89
|
-
style: [styles.card, {
|
|
90
|
-
maxWidth,
|
|
91
|
-
maxHeight: `${MAX_HEIGHT_FRACTION * 100}%`,
|
|
92
|
-
backgroundColor: theme.colors.card,
|
|
93
|
-
borderColor: theme.colors.border,
|
|
94
|
-
shadowColor: theme.colors.shadow
|
|
95
|
-
}, cardStyle],
|
|
96
|
-
children: [hasHeader ? /*#__PURE__*/_jsx(DialogHeader, {
|
|
97
|
-
title: title,
|
|
98
|
-
showClose: resolvedShowClose,
|
|
99
|
-
padding: spacing.pad,
|
|
100
|
-
gap: spacing.headerGap,
|
|
101
|
-
closeAccessibilityLabel: closeAccessibilityLabel,
|
|
102
|
-
onClose: onClose
|
|
103
|
-
}) : null, /*#__PURE__*/_jsx(ScrollView, {
|
|
104
|
-
style: styles.bodyScroll,
|
|
105
|
-
contentContainerStyle: [{
|
|
106
|
-
padding: spacing.pad,
|
|
107
|
-
paddingTop: hasHeader ? spacing.headerGap : spacing.pad,
|
|
108
|
-
gap: spacing.contentGap
|
|
109
|
-
}, contentStyle],
|
|
110
|
-
showsVerticalScrollIndicator: false,
|
|
111
|
-
keyboardShouldPersistTaps: "handled",
|
|
112
|
-
children: children
|
|
113
|
-
}), footer ? /*#__PURE__*/_jsx(View, {
|
|
114
|
-
style: [styles.footer, {
|
|
115
|
-
padding: spacing.pad,
|
|
116
|
-
paddingTop: spacing.footerGap,
|
|
117
|
-
borderTopColor: theme.colors.borderLight
|
|
118
|
-
}],
|
|
119
|
-
children: footer
|
|
120
|
-
}) : null]
|
|
121
|
-
})]
|
|
122
|
-
})
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function DialogHeader({
|
|
126
|
-
title,
|
|
127
|
-
showClose,
|
|
128
|
-
padding,
|
|
129
|
-
gap,
|
|
130
|
-
closeAccessibilityLabel,
|
|
131
|
-
onClose
|
|
132
|
-
}) {
|
|
133
|
-
const theme = useTheme();
|
|
134
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
135
|
-
style: [styles.header, {
|
|
136
|
-
paddingHorizontal: padding,
|
|
137
|
-
paddingTop: padding,
|
|
138
|
-
gap
|
|
139
|
-
}],
|
|
140
|
-
children: [title ? /*#__PURE__*/_jsx(Text, {
|
|
141
|
-
accessibilityRole: "header",
|
|
142
|
-
numberOfLines: 2,
|
|
143
|
-
style: [styles.title, {
|
|
144
|
-
color: theme.colors.text
|
|
145
|
-
}],
|
|
146
|
-
children: title
|
|
147
|
-
}) : /*#__PURE__*/_jsx(View, {
|
|
148
|
-
style: styles.titleSpacer
|
|
149
|
-
}), showClose ? /*#__PURE__*/_jsx(CloseButton, {
|
|
150
|
-
accessibilityLabel: closeAccessibilityLabel,
|
|
151
|
-
onPress: onClose
|
|
152
|
-
}) : null]
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
function CloseButton({
|
|
156
|
-
accessibilityLabel,
|
|
157
|
-
onPress
|
|
158
|
-
}) {
|
|
159
|
-
const theme = useTheme();
|
|
160
|
-
const press = useInteractionState();
|
|
161
|
-
return /*#__PURE__*/_jsx(Pressable, {
|
|
162
|
-
onPress: onPress,
|
|
163
|
-
onPressIn: press.onIn,
|
|
164
|
-
onPressOut: press.onOut,
|
|
165
|
-
hitSlop: CLOSE_HIT_SLOP,
|
|
166
|
-
accessibilityRole: "button",
|
|
167
|
-
accessibilityLabel: accessibilityLabel,
|
|
168
|
-
style: [styles.closeButton, {
|
|
169
|
-
backgroundColor: theme.colors.contrast50
|
|
170
|
-
}, press.state && styles.closeButtonPressed],
|
|
171
|
-
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
172
|
-
size: "sm",
|
|
173
|
-
fill: theme.colors.textSecondary
|
|
174
|
-
})
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
function noop() {
|
|
178
|
-
/* non-dismissible: hardware back is intentionally inert */
|
|
179
|
-
}
|
|
180
|
-
const styles = StyleSheet.create({
|
|
181
|
-
root: {
|
|
182
|
-
flex: 1,
|
|
183
|
-
alignItems: 'center',
|
|
184
|
-
justifyContent: 'center'
|
|
185
|
-
},
|
|
186
|
-
backdrop: {
|
|
187
|
-
// Spell out the absolute-fill rect (matches `Fill`'s canonical style)
|
|
188
|
-
// rather than spreading the deprecated `StyleSheet.absoluteFillObject`,
|
|
189
|
-
// which RN 0.83's generated types no longer surface on the `StyleSheet`
|
|
190
|
-
// namespace and which downstream type-checks reject.
|
|
191
|
-
position: 'absolute',
|
|
192
|
-
top: 0,
|
|
193
|
-
right: 0,
|
|
194
|
-
bottom: 0,
|
|
195
|
-
left: 0
|
|
196
|
-
},
|
|
197
|
-
// A subtle deepening on press confirms the tap-to-dismiss affordance.
|
|
198
|
-
backdropPressed: {
|
|
199
|
-
opacity: 0.92
|
|
200
|
-
},
|
|
201
|
-
card: {
|
|
202
|
-
width: '100%',
|
|
203
|
-
borderRadius: CARD_RADIUS,
|
|
204
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
205
|
-
overflow: 'hidden',
|
|
206
|
-
shadowOpacity: 0.18,
|
|
207
|
-
shadowRadius: 24,
|
|
208
|
-
shadowOffset: {
|
|
209
|
-
width: 0,
|
|
210
|
-
height: 8
|
|
211
|
-
},
|
|
212
|
-
elevation: 12
|
|
213
|
-
},
|
|
214
|
-
header: {
|
|
215
|
-
flexDirection: 'row',
|
|
216
|
-
alignItems: 'flex-start',
|
|
217
|
-
justifyContent: 'space-between'
|
|
218
|
-
},
|
|
219
|
-
title: {
|
|
220
|
-
flex: 1,
|
|
221
|
-
fontSize: 17,
|
|
222
|
-
fontWeight: '700',
|
|
223
|
-
lineHeight: 22
|
|
224
|
-
},
|
|
225
|
-
titleSpacer: {
|
|
226
|
-
flex: 1
|
|
227
|
-
},
|
|
228
|
-
closeButton: {
|
|
229
|
-
width: 28,
|
|
230
|
-
height: 28,
|
|
231
|
-
borderRadius: 14,
|
|
232
|
-
alignItems: 'center',
|
|
233
|
-
justifyContent: 'center'
|
|
234
|
-
},
|
|
235
|
-
closeButtonPressed: {
|
|
236
|
-
opacity: 0.7
|
|
237
|
-
},
|
|
238
|
-
bodyScroll: {
|
|
239
|
-
flexGrow: 0,
|
|
240
|
-
flexShrink: 1
|
|
241
|
-
},
|
|
242
|
-
footer: {
|
|
243
|
-
borderTopWidth: StyleSheet.hairlineWidth
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
//# sourceMappingURL=CenteredDialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","Modal","Pressable","ScrollView","StyleSheet","View","useInteractionState","TimesLarge_Stroke2_Corner0_Rounded","CloseIcon","useTheme","Text","CARD_RADIUS","DEFAULT_MAX_WIDTH","MAX_HEIGHT_FRACTION","resolveSpacing","VIEWPORT_GUTTER","jsx","_jsx","jsxs","_jsxs","CLOSE_HIT_SLOP","top","bottom","left","right","CENTERED_DIALOG_BACKDROP_TESTID","CenteredDialog","visible","onClose","title","dismissible","maxWidth","compact","showClose","children","footer","accessibilityLabel","closeAccessibilityLabel","backdropAccessibilityLabel","cardStyle","contentStyle","testID","theme","backdropPress","spacing","resolvedShowClose","Boolean","hasHeader","handleBackdropPress","undefined","handleRequestClose","noop","transparent","animationType","statusBarTranslucent","onRequestClose","style","styles","root","padding","backdrop","backgroundColor","colors","overlay","state","backdropPressed","onPress","onPressIn","onIn","onPressOut","onOut","disabled","accessibilityRole","card","maxHeight","borderColor","border","shadowColor","shadow","DialogHeader","pad","gap","headerGap","bodyScroll","contentContainerStyle","paddingTop","contentGap","showsVerticalScrollIndicator","keyboardShouldPersistTaps","footerGap","borderTopColor","borderLight","header","paddingHorizontal","numberOfLines","color","text","titleSpacer","CloseButton","press","hitSlop","closeButton","contrast50","closeButtonPressed","size","fill","textSecondary","create","flex","alignItems","justifyContent","position","opacity","width","borderRadius","borderWidth","hairlineWidth","overflow","shadowOpacity","shadowRadius","shadowOffset","height","elevation","flexDirection","fontSize","fontWeight","lineHeight","flexGrow","flexShrink","borderTopWidth"],"sourceRoot":"../../../src","sources":["dialog/CenteredDialog.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SACEC,KAAK,EACLC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,IAAI,QACC,cAAc;AAErB,SAASC,mBAAmB,QAAQ,iCAA8B;AAClE,SAASC,kCAAkC,IAAIC,SAAS,QAAQ,mBAAgB;AAChF,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,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,CAAC;EACD7B,UAAU,EAAE;IACV4C,QAAQ,EAAE,CAAC;IACXC,UAAU,EAAE;EACd,CAAC;EACD7F,MAAM,EAAE;IACN8F,cAAc,EAAE7H,UAAU,CAACgH;EAC7B;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { Pressable, ScrollView, StyleSheet, View } from 'react-native';
|
|
5
|
-
import { RemoveScrollBar } from 'react-remove-scroll-bar';
|
|
6
|
-
import { useInteractionStates } from "../hooks/useInteractionState.js";
|
|
7
|
-
import { TimesLarge_Stroke2_Corner0_Rounded as CloseIcon } from "../icons/Times.js";
|
|
8
|
-
import { Portal } from "../portal/index.web.js";
|
|
9
|
-
import { createOverlayZIndex } from "../styles/z-index.js";
|
|
10
|
-
import { useTheme } from "../theme/use-theme.js";
|
|
11
|
-
import { Text } from "../typography/index.js";
|
|
12
|
-
import { CARD_RADIUS, DEFAULT_MAX_WIDTH, MAX_HEIGHT_FRACTION, resolveSpacing, VIEWPORT_GUTTER } from "./centered-dialog-tokens.js";
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const FADE_OUT_DURATION = 150;
|
|
15
|
-
const CLOSE_HIT_SLOP = {
|
|
16
|
-
top: 8,
|
|
17
|
-
bottom: 8,
|
|
18
|
-
left: 8,
|
|
19
|
-
right: 8
|
|
20
|
-
};
|
|
21
|
-
const dialogZIndex = createOverlayZIndex();
|
|
22
|
-
|
|
23
|
-
/** Stable testID for the dimmed backdrop. Overridden when a `testID` is set. */
|
|
24
|
-
export const CENTERED_DIALOG_BACKDROP_TESTID = 'bloom-centered-dialog-backdrop';
|
|
25
|
-
const stopPropagation = e => e.stopPropagation();
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Use `<Dialog placement="center">` instead.
|
|
29
|
-
*
|
|
30
|
-
* Web variant of `<CenteredDialog>`.
|
|
31
|
-
*
|
|
32
|
-
* A centered modal card rendered into the Bloom Portal at the end of
|
|
33
|
-
* `document.body`. Identical prop surface to native — `visible`, `onClose`,
|
|
34
|
-
* `title`, `compact`, etc. — so call sites are platform agnostic.
|
|
35
|
-
*
|
|
36
|
-
* Differences from the native fork (necessary, not behavioural):
|
|
37
|
-
* - Portal + `RemoveScrollBar` lock the underlying page while open.
|
|
38
|
-
* - `Escape` dismisses (when `dismissible`).
|
|
39
|
-
* - A `role="dialog"` panel with `aria-label`/`aria-modal` for a11y.
|
|
40
|
-
* - A CSS fade/zoom keyframe matches the native modal's `fade` animation;
|
|
41
|
-
* the keyframes are injected once (idempotent) into `<head>`.
|
|
42
|
-
*
|
|
43
|
-
* The backdrop is a sibling element BEHIND the card, and the card stops
|
|
44
|
-
* click/press propagation so a tap on the card never dismisses.
|
|
45
|
-
*/
|
|
46
|
-
export function CenteredDialog({
|
|
47
|
-
visible,
|
|
48
|
-
onClose,
|
|
49
|
-
title,
|
|
50
|
-
dismissible = true,
|
|
51
|
-
maxWidth = DEFAULT_MAX_WIDTH,
|
|
52
|
-
compact = true,
|
|
53
|
-
showClose,
|
|
54
|
-
children,
|
|
55
|
-
footer,
|
|
56
|
-
accessibilityLabel,
|
|
57
|
-
closeAccessibilityLabel = 'Close dialog',
|
|
58
|
-
backdropAccessibilityLabel = 'Dismiss dialog',
|
|
59
|
-
cardStyle,
|
|
60
|
-
contentStyle,
|
|
61
|
-
testID
|
|
62
|
-
}) {
|
|
63
|
-
const theme = useTheme();
|
|
64
|
-
// `rendered` keeps the dialog mounted through its fade-out so a controlled
|
|
65
|
-
// `visible` flip to `false` still plays an exit animation (matching the
|
|
66
|
-
// native `Modal animationType="fade"`, which animates both directions).
|
|
67
|
-
const [rendered, setRendered] = useState(visible);
|
|
68
|
-
const isClosing = rendered && !visible;
|
|
69
|
-
useKeyframes();
|
|
70
|
-
|
|
71
|
-
// Mount immediately when opened; defer unmount until the exit animation
|
|
72
|
-
// has played when closed.
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
if (visible) {
|
|
75
|
-
setRendered(true);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (!rendered) return;
|
|
79
|
-
const timer = setTimeout(() => setRendered(false), FADE_OUT_DURATION);
|
|
80
|
-
return () => clearTimeout(timer);
|
|
81
|
-
}, [visible, rendered]);
|
|
82
|
-
|
|
83
|
-
// Escape-to-close while open. Scoped to the open lifetime so stacked
|
|
84
|
-
// dialogs don't fight for the keydown — the top-most one wins via
|
|
85
|
-
// document-level event order.
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (!visible || !dismissible || typeof document === 'undefined') return;
|
|
88
|
-
const handler = e => {
|
|
89
|
-
if (e.key === 'Escape') {
|
|
90
|
-
e.stopPropagation();
|
|
91
|
-
onClose();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
document.addEventListener('keydown', handler);
|
|
95
|
-
return () => document.removeEventListener('keydown', handler);
|
|
96
|
-
}, [visible, dismissible, onClose]);
|
|
97
|
-
const spacing = useMemo(() => resolveSpacing(compact), [compact]);
|
|
98
|
-
const resolvedShowClose = showClose ?? Boolean(title);
|
|
99
|
-
const hasHeader = Boolean(title) || resolvedShowClose;
|
|
100
|
-
if (!rendered) return null;
|
|
101
|
-
|
|
102
|
-
// While closing, the backdrop must not re-trigger onClose (it's mid-exit).
|
|
103
|
-
const handleBackdropPress = dismissible && !isClosing ? onClose : undefined;
|
|
104
|
-
return /*#__PURE__*/_jsxs(Portal, {
|
|
105
|
-
children: [/*#__PURE__*/_jsx(RemoveScrollBar, {}), /*#__PURE__*/_jsxs(View, {
|
|
106
|
-
style: [styles.root, {
|
|
107
|
-
padding: VIEWPORT_GUTTER
|
|
108
|
-
}],
|
|
109
|
-
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
110
|
-
testID: testID ? `${testID}-backdrop` : CENTERED_DIALOG_BACKDROP_TESTID,
|
|
111
|
-
onPress: handleBackdropPress,
|
|
112
|
-
disabled: !dismissible,
|
|
113
|
-
accessibilityRole: "button",
|
|
114
|
-
accessibilityLabel: backdropAccessibilityLabel,
|
|
115
|
-
style: [styles.backdrop, {
|
|
116
|
-
backgroundColor: theme.colors.overlay
|
|
117
|
-
}, backdropAnimation(isClosing)]
|
|
118
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
119
|
-
testID: testID,
|
|
120
|
-
role: "dialog",
|
|
121
|
-
"aria-modal": true,
|
|
122
|
-
"aria-label": accessibilityLabel ?? title,
|
|
123
|
-
onStartShouldSetResponder: returnsTrue,
|
|
124
|
-
onResponderRelease: stopPropagation,
|
|
125
|
-
onClick: stopPropagation,
|
|
126
|
-
style: [styles.card, {
|
|
127
|
-
maxWidth,
|
|
128
|
-
maxHeight: `${MAX_HEIGHT_FRACTION * 100}%`,
|
|
129
|
-
backgroundColor: theme.colors.card,
|
|
130
|
-
borderColor: theme.colors.border,
|
|
131
|
-
shadowColor: theme.colors.shadow
|
|
132
|
-
}, cardAnimation(isClosing), cardStyle],
|
|
133
|
-
children: [hasHeader ? /*#__PURE__*/_jsx(DialogHeader, {
|
|
134
|
-
title: title,
|
|
135
|
-
showClose: resolvedShowClose,
|
|
136
|
-
padding: spacing.pad,
|
|
137
|
-
gap: spacing.headerGap,
|
|
138
|
-
closeAccessibilityLabel: closeAccessibilityLabel,
|
|
139
|
-
onClose: onClose
|
|
140
|
-
}) : null, /*#__PURE__*/_jsx(ScrollView, {
|
|
141
|
-
style: styles.bodyScroll,
|
|
142
|
-
contentContainerStyle: [{
|
|
143
|
-
padding: spacing.pad,
|
|
144
|
-
paddingTop: hasHeader ? spacing.headerGap : spacing.pad,
|
|
145
|
-
gap: spacing.contentGap
|
|
146
|
-
}, contentStyle],
|
|
147
|
-
showsVerticalScrollIndicator: false,
|
|
148
|
-
keyboardShouldPersistTaps: "handled",
|
|
149
|
-
children: children
|
|
150
|
-
}), footer ? /*#__PURE__*/_jsx(View, {
|
|
151
|
-
style: [styles.footer, {
|
|
152
|
-
padding: spacing.pad,
|
|
153
|
-
paddingTop: spacing.footerGap,
|
|
154
|
-
borderTopColor: theme.colors.borderLight
|
|
155
|
-
}],
|
|
156
|
-
children: footer
|
|
157
|
-
}) : null]
|
|
158
|
-
})]
|
|
159
|
-
})]
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
function DialogHeader({
|
|
163
|
-
title,
|
|
164
|
-
showClose,
|
|
165
|
-
padding,
|
|
166
|
-
gap,
|
|
167
|
-
closeAccessibilityLabel,
|
|
168
|
-
onClose
|
|
169
|
-
}) {
|
|
170
|
-
const theme = useTheme();
|
|
171
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
172
|
-
style: [styles.header, {
|
|
173
|
-
paddingHorizontal: padding,
|
|
174
|
-
paddingTop: padding,
|
|
175
|
-
gap
|
|
176
|
-
}],
|
|
177
|
-
children: [title ? /*#__PURE__*/_jsx(Text, {
|
|
178
|
-
accessibilityRole: "header",
|
|
179
|
-
numberOfLines: 2,
|
|
180
|
-
style: [styles.title, {
|
|
181
|
-
color: theme.colors.text
|
|
182
|
-
}],
|
|
183
|
-
children: title
|
|
184
|
-
}) : /*#__PURE__*/_jsx(View, {
|
|
185
|
-
style: styles.titleSpacer
|
|
186
|
-
}), showClose ? /*#__PURE__*/_jsx(CloseButton, {
|
|
187
|
-
accessibilityLabel: closeAccessibilityLabel,
|
|
188
|
-
onPress: onClose
|
|
189
|
-
}) : null]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function CloseButton({
|
|
193
|
-
accessibilityLabel,
|
|
194
|
-
onPress
|
|
195
|
-
}) {
|
|
196
|
-
const theme = useTheme();
|
|
197
|
-
const {
|
|
198
|
-
hovered,
|
|
199
|
-
pressed,
|
|
200
|
-
hoverHandlers,
|
|
201
|
-
pressHandlers
|
|
202
|
-
} = useInteractionStates();
|
|
203
|
-
return /*#__PURE__*/_jsx(Pressable, {
|
|
204
|
-
onPress: onPress,
|
|
205
|
-
...hoverHandlers,
|
|
206
|
-
...pressHandlers,
|
|
207
|
-
hitSlop: CLOSE_HIT_SLOP,
|
|
208
|
-
accessibilityRole: "button",
|
|
209
|
-
accessibilityLabel: accessibilityLabel,
|
|
210
|
-
style: [styles.closeButton, {
|
|
211
|
-
backgroundColor: theme.colors.contrast50
|
|
212
|
-
}, (hovered || pressed) && styles.closeButtonActive],
|
|
213
|
-
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
214
|
-
size: "sm",
|
|
215
|
-
fill: theme.colors.textSecondary
|
|
216
|
-
})
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
const returnsTrue = () => true;
|
|
220
|
-
function backdropAnimation(isClosing) {
|
|
221
|
-
return isClosing ? {
|
|
222
|
-
animation: `bloomCenteredDialogFadeOut ease-in ${FADE_OUT_DURATION}ms forwards`
|
|
223
|
-
} : {
|
|
224
|
-
animation: 'bloomCenteredDialogFadeIn ease-out 150ms'
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function cardAnimation(isClosing) {
|
|
228
|
-
return isClosing ? {
|
|
229
|
-
animation: `bloomCenteredDialogZoomOut ease-in ${FADE_OUT_DURATION}ms forwards`
|
|
230
|
-
} : {
|
|
231
|
-
animation: 'bloomCenteredDialogZoomIn cubic-bezier(0.16, 1, 0.3, 1) 200ms'
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
const KEYFRAMES_ID = 'bloom-centered-dialog-keyframes';
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* CSS keyframes powering the web enter/exit animation. Injected once into
|
|
238
|
-
* `<head>` on first mount (keyed by id so re-mounts and multiple dialogs
|
|
239
|
-
* don't duplicate the rule). Mirrors the native modal's `fade` feel with a
|
|
240
|
-
* subtle zoom on the card.
|
|
241
|
-
*/
|
|
242
|
-
export const BLOOM_CENTERED_DIALOG_CSS = `
|
|
243
|
-
@keyframes bloomCenteredDialogFadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
244
|
-
@keyframes bloomCenteredDialogFadeOut { from { opacity: 1; } to { opacity: 0; } }
|
|
245
|
-
@keyframes bloomCenteredDialogZoomIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
|
|
246
|
-
@keyframes bloomCenteredDialogZoomOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.96); } }
|
|
247
|
-
`;
|
|
248
|
-
function useKeyframes() {
|
|
249
|
-
useEffect(() => {
|
|
250
|
-
if (typeof document === 'undefined') return;
|
|
251
|
-
if (document.getElementById(KEYFRAMES_ID)) return;
|
|
252
|
-
const style = document.createElement('style');
|
|
253
|
-
style.id = KEYFRAMES_ID;
|
|
254
|
-
style.textContent = BLOOM_CENTERED_DIALOG_CSS;
|
|
255
|
-
document.head.appendChild(style);
|
|
256
|
-
}, []);
|
|
257
|
-
}
|
|
258
|
-
const styles = StyleSheet.create({
|
|
259
|
-
root: {
|
|
260
|
-
position: 'fixed',
|
|
261
|
-
top: 0,
|
|
262
|
-
left: 0,
|
|
263
|
-
right: 0,
|
|
264
|
-
bottom: 0,
|
|
265
|
-
zIndex: dialogZIndex.backdrop,
|
|
266
|
-
alignItems: 'center',
|
|
267
|
-
justifyContent: 'center',
|
|
268
|
-
pointerEvents: 'auto'
|
|
269
|
-
},
|
|
270
|
-
backdrop: {
|
|
271
|
-
position: 'fixed',
|
|
272
|
-
top: 0,
|
|
273
|
-
left: 0,
|
|
274
|
-
right: 0,
|
|
275
|
-
bottom: 0
|
|
276
|
-
},
|
|
277
|
-
card: {
|
|
278
|
-
position: 'relative',
|
|
279
|
-
width: '100%',
|
|
280
|
-
borderRadius: CARD_RADIUS,
|
|
281
|
-
borderWidth: 1,
|
|
282
|
-
overflow: 'hidden',
|
|
283
|
-
shadowOpacity: 0.18,
|
|
284
|
-
shadowRadius: 24,
|
|
285
|
-
shadowOffset: {
|
|
286
|
-
width: 0,
|
|
287
|
-
height: 8
|
|
288
|
-
},
|
|
289
|
-
zIndex: dialogZIndex.surface
|
|
290
|
-
},
|
|
291
|
-
header: {
|
|
292
|
-
flexDirection: 'row',
|
|
293
|
-
alignItems: 'flex-start',
|
|
294
|
-
justifyContent: 'space-between'
|
|
295
|
-
},
|
|
296
|
-
title: {
|
|
297
|
-
flex: 1,
|
|
298
|
-
fontSize: 17,
|
|
299
|
-
fontWeight: '700',
|
|
300
|
-
lineHeight: 22
|
|
301
|
-
},
|
|
302
|
-
titleSpacer: {
|
|
303
|
-
flex: 1
|
|
304
|
-
},
|
|
305
|
-
closeButton: {
|
|
306
|
-
width: 28,
|
|
307
|
-
height: 28,
|
|
308
|
-
borderRadius: 14,
|
|
309
|
-
alignItems: 'center',
|
|
310
|
-
justifyContent: 'center',
|
|
311
|
-
cursor: 'pointer'
|
|
312
|
-
},
|
|
313
|
-
closeButtonActive: {
|
|
314
|
-
opacity: 0.7
|
|
315
|
-
},
|
|
316
|
-
bodyScroll: {
|
|
317
|
-
flexGrow: 0,
|
|
318
|
-
flexShrink: 1
|
|
319
|
-
},
|
|
320
|
-
footer: {
|
|
321
|
-
borderTopWidth: 1
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
//# sourceMappingURL=CenteredDialog.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useMemo","useState","Pressable","ScrollView","StyleSheet","View","RemoveScrollBar","useInteractionStates","TimesLarge_Stroke2_Corner0_Rounded","CloseIcon","Portal","createOverlayZIndex","useTheme","Text","CARD_RADIUS","DEFAULT_MAX_WIDTH","MAX_HEIGHT_FRACTION","resolveSpacing","VIEWPORT_GUTTER","jsx","_jsx","jsxs","_jsxs","FADE_OUT_DURATION","CLOSE_HIT_SLOP","top","bottom","left","right","dialogZIndex","CENTERED_DIALOG_BACKDROP_TESTID","stopPropagation","e","CenteredDialog","visible","onClose","title","dismissible","maxWidth","compact","showClose","children","footer","accessibilityLabel","closeAccessibilityLabel","backdropAccessibilityLabel","cardStyle","contentStyle","testID","theme","rendered","setRendered","isClosing","useKeyframes","timer","setTimeout","clearTimeout","document","handler","key","addEventListener","removeEventListener","spacing","resolvedShowClose","Boolean","hasHeader","handleBackdropPress","undefined","style","styles","root","padding","onPress","disabled","accessibilityRole","backdrop","backgroundColor","colors","overlay","backdropAnimation","role","onStartShouldSetResponder","returnsTrue","onResponderRelease","onClick","card","maxHeight","borderColor","border","shadowColor","shadow","cardAnimation","DialogHeader","pad","gap","headerGap","bodyScroll","contentContainerStyle","paddingTop","contentGap","showsVerticalScrollIndicator","keyboardShouldPersistTaps","footerGap","borderTopColor","borderLight","header","paddingHorizontal","numberOfLines","color","text","titleSpacer","CloseButton","hovered","pressed","hoverHandlers","pressHandlers","hitSlop","closeButton","contrast50","closeButtonActive","size","fill","textSecondary","animation","KEYFRAMES_ID","BLOOM_CENTERED_DIALOG_CSS","getElementById","createElement","id","textContent","head","appendChild","create","position","zIndex","alignItems","justifyContent","pointerEvents","width","borderRadius","borderWidth","overflow","shadowOpacity","shadowRadius","shadowOffset","height","surface","flexDirection","flex","fontSize","fontWeight","lineHeight","cursor","opacity","flexGrow","flexShrink","borderTopWidth"],"sourceRoot":"../../../src","sources":["dialog/CenteredDialog.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,SAAS,EAAEC,UAAU,EAAEC,UAAU,EAAEC,IAAI,QAAwB,cAAc;AACtF,SAASC,eAAe,QAAQ,yBAAyB;AAEzD,SAASC,oBAAoB,QAAQ,iCAA8B;AACnE,SAASC,kCAAkC,IAAIC,SAAS,QAAQ,mBAAgB;AAChF,SAASC,MAAM,QAAQ,wBAAqB;AAC5C,SAASC,mBAAmB,QAAQ,sBAAmB;AACvD,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,SAASC,IAAI,QAAQ,wBAAe;AAEpC,SACEC,WAAW,EACXC,iBAAiB,EACjBC,mBAAmB,EACnBC,cAAc,EACdC,eAAe,Q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MAAM,EAAE;EACV,CAAC;EACD2D,IAAI,EAAE;IACJgD,QAAQ,EAAE,UAAU;IACpBK,KAAK,EAAE,MAAM;IACbC,YAAY,EAAE7H,WAAW;IACzB8H,WAAW,EAAE,CAAC;IACdC,QAAQ,EAAE,QAAQ;IAClBC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,EAAE;IAChBC,YAAY,EAAE;MAAEN,KAAK,EAAE,CAAC;MAAEO,MAAM,EAAE;IAAE,CAAC;IACrCX,MAAM,EAAEzG,YAAY,CAACqH;EACvB,CAAC;EACDzC,MAAM,EAAE;IACN0C,aAAa,EAAE,KAAK;IACpBZ,UAAU,EAAE,YAAY;IACxBC,cAAc,EAAE;EAClB,CAAC;EACDpG,KAAK,EAAE;IACLgH,IAAI,EAAE,CAAC;IACPC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,UAAU,EAAE;EACd,CAAC;EACDzC,WAAW,EAAE;IACXsC,IAAI,EAAE;EACR,CAAC;EACD/B,WAAW,EAAE;IACXqB,KAAK,EAAE,EAAE;IACTO,MAAM,EAAE,EAAE;IACVN,YAAY,EAAE,EAAE;IAChBJ,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBgB,MAAM,EAAE;EACV,CAAC;EACDjC,iBAAiB,EAAE;IACjBkC,OAAO,EAAE;EACX,CAAC;EACDzD,UAAU,EAAE;IACV0D,QAAQ,EAAE,CAAC;IACXC,UAAU,EAAE;EACd,CAAC;EACDjH,MAAM,EAAE;IACNkH,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { borderRadius, space } from "../styles/tokens.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Shared layout constants for `<CenteredDialog>`, kept in one module so the
|
|
7
|
-
* native and web forks render identically. All values are Bloom theme tokens
|
|
8
|
-
* (`styles/tokens`) — no ad-hoc magic numbers.
|
|
9
|
-
*
|
|
10
|
-
* COMPACT is the priority: the `compact` spacing set is the default and is
|
|
11
|
-
* deliberately tight (≈`space.md`), so the card reads snug out of the box.
|
|
12
|
-
* The `cozy` set is the opt-out (`compact={false}`) for roomier dialogs.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/** Default max card width — comfortable for a compact dialog. */
|
|
16
|
-
export const DEFAULT_MAX_WIDTH = 440;
|
|
17
|
-
|
|
18
|
-
/** Card height is capped at this fraction of the viewport; body scrolls. */
|
|
19
|
-
export const MAX_HEIGHT_FRACTION = 0.8;
|
|
20
|
-
|
|
21
|
-
/** Card corner radius (token: `borderRadius.lg` = 16). */
|
|
22
|
-
export const CARD_RADIUS = borderRadius.lg;
|
|
23
|
-
|
|
24
|
-
/** Outer gutter between the card edge and the viewport edge (token `space.lg`). */
|
|
25
|
-
export const VIEWPORT_GUTTER = space.lg;
|
|
26
|
-
/**
|
|
27
|
-
* Compact (default) — tight, snug spacing built on `space.md` (12).
|
|
28
|
-
*
|
|
29
|
-
* pad = space.md (12)
|
|
30
|
-
* headerGap = space.sm (8)
|
|
31
|
-
* footerGap = space.md (12)
|
|
32
|
-
* contentGap = space.sm (8)
|
|
33
|
-
*/
|
|
34
|
-
export const COMPACT_SPACING = {
|
|
35
|
-
pad: space.md,
|
|
36
|
-
headerGap: space.sm,
|
|
37
|
-
footerGap: space.md,
|
|
38
|
-
contentGap: space.sm
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Cozy (`compact={false}`) — roomier spacing built on `space.xl` (20).
|
|
43
|
-
*
|
|
44
|
-
* pad = space.xl (20)
|
|
45
|
-
* headerGap = space.md (12)
|
|
46
|
-
* footerGap = space.lg (16)
|
|
47
|
-
* contentGap = space.md (12)
|
|
48
|
-
*/
|
|
49
|
-
export const COZY_SPACING = {
|
|
50
|
-
pad: space.xl,
|
|
51
|
-
headerGap: space.md,
|
|
52
|
-
footerGap: space.lg,
|
|
53
|
-
contentGap: space.md
|
|
54
|
-
};
|
|
55
|
-
export function resolveSpacing(compact) {
|
|
56
|
-
return compact ? COMPACT_SPACING : COZY_SPACING;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=centered-dialog-tokens.js.map
|