@oxyhq/bloom 0.6.9 → 0.6.10

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.
Files changed (75) hide show
  1. package/lib/commonjs/dialog/CenteredDialog.js +242 -0
  2. package/lib/commonjs/dialog/CenteredDialog.js.map +1 -0
  3. package/lib/commonjs/dialog/CenteredDialog.web.js +326 -0
  4. package/lib/commonjs/dialog/CenteredDialog.web.js.map +1 -0
  5. package/lib/commonjs/dialog/centered-dialog-tokens.js +62 -0
  6. package/lib/commonjs/dialog/centered-dialog-tokens.js.map +1 -0
  7. package/lib/commonjs/dialog/centered-dialog-types.js +6 -0
  8. package/lib/commonjs/dialog/centered-dialog-types.js.map +1 -0
  9. package/lib/commonjs/dialog/index.js +13 -0
  10. package/lib/commonjs/dialog/index.js.map +1 -1
  11. package/lib/commonjs/dialog/index.web.js +19 -0
  12. package/lib/commonjs/dialog/index.web.js.map +1 -1
  13. package/lib/commonjs/index.js +14 -0
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/index.web.js +14 -0
  16. package/lib/commonjs/index.web.js.map +1 -1
  17. package/lib/module/dialog/CenteredDialog.js +236 -0
  18. package/lib/module/dialog/CenteredDialog.js.map +1 -0
  19. package/lib/module/dialog/CenteredDialog.web.js +320 -0
  20. package/lib/module/dialog/CenteredDialog.web.js.map +1 -0
  21. package/lib/module/dialog/centered-dialog-tokens.js +58 -0
  22. package/lib/module/dialog/centered-dialog-tokens.js.map +1 -0
  23. package/lib/module/dialog/centered-dialog-types.js +4 -0
  24. package/lib/module/dialog/centered-dialog-types.js.map +1 -0
  25. package/lib/module/dialog/index.js +1 -0
  26. package/lib/module/dialog/index.js.map +1 -1
  27. package/lib/module/dialog/index.web.js +1 -0
  28. package/lib/module/dialog/index.web.js.map +1 -1
  29. package/lib/module/index.js +1 -1
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/index.web.js +1 -1
  32. package/lib/module/index.web.js.map +1 -1
  33. package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts +20 -0
  34. package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts +29 -0
  36. package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts.map +1 -0
  37. package/lib/typescript/commonjs/dialog/centered-dialog-tokens.d.ts +47 -0
  38. package/lib/typescript/commonjs/dialog/centered-dialog-tokens.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts +70 -0
  40. package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/dialog/index.d.ts +2 -0
  42. package/lib/typescript/commonjs/dialog/index.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/dialog/index.web.d.ts +2 -0
  44. package/lib/typescript/commonjs/dialog/index.web.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/index.d.ts +2 -2
  46. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/index.web.d.ts +2 -2
  48. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  49. package/lib/typescript/module/dialog/CenteredDialog.d.ts +20 -0
  50. package/lib/typescript/module/dialog/CenteredDialog.d.ts.map +1 -0
  51. package/lib/typescript/module/dialog/CenteredDialog.web.d.ts +29 -0
  52. package/lib/typescript/module/dialog/CenteredDialog.web.d.ts.map +1 -0
  53. package/lib/typescript/module/dialog/centered-dialog-tokens.d.ts +47 -0
  54. package/lib/typescript/module/dialog/centered-dialog-tokens.d.ts.map +1 -0
  55. package/lib/typescript/module/dialog/centered-dialog-types.d.ts +70 -0
  56. package/lib/typescript/module/dialog/centered-dialog-types.d.ts.map +1 -0
  57. package/lib/typescript/module/dialog/index.d.ts +2 -0
  58. package/lib/typescript/module/dialog/index.d.ts.map +1 -1
  59. package/lib/typescript/module/dialog/index.web.d.ts +2 -0
  60. package/lib/typescript/module/dialog/index.web.d.ts.map +1 -1
  61. package/lib/typescript/module/index.d.ts +2 -2
  62. package/lib/typescript/module/index.d.ts.map +1 -1
  63. package/lib/typescript/module/index.web.d.ts +2 -2
  64. package/lib/typescript/module/index.web.d.ts.map +1 -1
  65. package/package.json +1 -1
  66. package/src/__tests__/CenteredDialog.test.tsx +108 -0
  67. package/src/dialog/CenteredDialog.stories.tsx +125 -0
  68. package/src/dialog/CenteredDialog.tsx +295 -0
  69. package/src/dialog/CenteredDialog.web.tsx +370 -0
  70. package/src/dialog/centered-dialog-tokens.ts +68 -0
  71. package/src/dialog/centered-dialog-types.ts +70 -0
  72. package/src/dialog/index.ts +2 -0
  73. package/src/dialog/index.web.ts +6 -0
  74. package/src/index.ts +3 -0
  75. package/src/index.web.ts +3 -0
@@ -0,0 +1,370 @@
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
+ import { Pressable, ScrollView, StyleSheet, View, type ViewStyle } from 'react-native';
3
+ import { RemoveScrollBar } from 'react-remove-scroll-bar';
4
+
5
+ import { useInteractionStates } from '../hooks/useInteractionState';
6
+ import { TimesLarge_Stroke2_Corner0_Rounded as CloseIcon } from '../icons/Times';
7
+ import { Portal } from '../portal/index.web';
8
+ import { useTheme } from '../theme/use-theme';
9
+ import { Text } from '../typography';
10
+ import type { CenteredDialogProps } from './centered-dialog-types';
11
+ import {
12
+ CARD_RADIUS,
13
+ DEFAULT_MAX_WIDTH,
14
+ MAX_HEIGHT_FRACTION,
15
+ resolveSpacing,
16
+ VIEWPORT_GUTTER,
17
+ } from './centered-dialog-tokens';
18
+
19
+ const FADE_OUT_DURATION = 150;
20
+ const CLOSE_HIT_SLOP = { top: 8, bottom: 8, left: 8, right: 8 } as const;
21
+
22
+ /** Stable testID for the dimmed backdrop. Overridden when a `testID` is set. */
23
+ export const CENTERED_DIALOG_BACKDROP_TESTID = 'bloom-centered-dialog-backdrop';
24
+
25
+ const stopPropagation = (e: { stopPropagation: () => void }) => e.stopPropagation();
26
+
27
+ /**
28
+ * Web variant of `<CenteredDialog>`.
29
+ *
30
+ * A centered modal card rendered into the Bloom Portal at the end of
31
+ * `document.body`. Identical prop surface to native — `visible`, `onClose`,
32
+ * `title`, `compact`, etc. — so call sites are platform agnostic.
33
+ *
34
+ * Differences from the native fork (necessary, not behavioural):
35
+ * - Portal + `RemoveScrollBar` lock the underlying page while open.
36
+ * - `Escape` dismisses (when `dismissible`).
37
+ * - A `role="dialog"` panel with `aria-label`/`aria-modal` for a11y.
38
+ * - A CSS fade/zoom keyframe matches the native modal's `fade` animation;
39
+ * the keyframes are injected once (idempotent) into `<head>`.
40
+ *
41
+ * The backdrop is a sibling element BEHIND the card, and the card stops
42
+ * click/press propagation so a tap on the card never dismisses.
43
+ */
44
+ export function CenteredDialog({
45
+ visible,
46
+ onClose,
47
+ title,
48
+ dismissible = true,
49
+ maxWidth = DEFAULT_MAX_WIDTH,
50
+ compact = true,
51
+ showClose,
52
+ children,
53
+ footer,
54
+ accessibilityLabel,
55
+ closeAccessibilityLabel = 'Close dialog',
56
+ backdropAccessibilityLabel = 'Dismiss dialog',
57
+ cardStyle,
58
+ contentStyle,
59
+ testID,
60
+ }: CenteredDialogProps) {
61
+ const theme = useTheme();
62
+ // `rendered` keeps the dialog mounted through its fade-out so a controlled
63
+ // `visible` flip to `false` still plays an exit animation (matching the
64
+ // native `Modal animationType="fade"`, which animates both directions).
65
+ const [rendered, setRendered] = useState(visible);
66
+ const isClosing = rendered && !visible;
67
+
68
+ useKeyframes();
69
+
70
+ // Mount immediately when opened; defer unmount until the exit animation
71
+ // has played when closed.
72
+ useEffect(() => {
73
+ if (visible) {
74
+ setRendered(true);
75
+ return;
76
+ }
77
+ if (!rendered) return;
78
+ const timer = setTimeout(() => setRendered(false), FADE_OUT_DURATION);
79
+ return () => clearTimeout(timer);
80
+ }, [visible, rendered]);
81
+
82
+ // Escape-to-close while open. Scoped to the open lifetime so stacked
83
+ // dialogs don't fight for the keydown — the top-most one wins via
84
+ // document-level event order.
85
+ useEffect(() => {
86
+ if (!visible || !dismissible || typeof document === 'undefined') return;
87
+ const handler = (e: KeyboardEvent) => {
88
+ if (e.key === 'Escape') {
89
+ e.stopPropagation();
90
+ onClose();
91
+ }
92
+ };
93
+ document.addEventListener('keydown', handler);
94
+ return () => document.removeEventListener('keydown', handler);
95
+ }, [visible, dismissible, onClose]);
96
+
97
+ const spacing = useMemo(() => resolveSpacing(compact), [compact]);
98
+ const resolvedShowClose = showClose ?? Boolean(title);
99
+ const hasHeader = Boolean(title) || resolvedShowClose;
100
+
101
+ if (!rendered) return null;
102
+
103
+ // While closing, the backdrop must not re-trigger onClose (it's mid-exit).
104
+ const handleBackdropPress = dismissible && !isClosing ? onClose : undefined;
105
+
106
+ return (
107
+ <Portal>
108
+ <RemoveScrollBar />
109
+ {/* `pointerEvents: 'auto'` opts back in from the Portal root's
110
+ `pointer-events: none` (set so the idle portal doesn't intercept
111
+ clicks on the underlying app). */}
112
+ <View style={[styles.root, { padding: VIEWPORT_GUTTER }]}>
113
+ <Pressable
114
+ testID={testID ? `${testID}-backdrop` : CENTERED_DIALOG_BACKDROP_TESTID}
115
+ onPress={handleBackdropPress}
116
+ disabled={!dismissible}
117
+ accessibilityRole="button"
118
+ accessibilityLabel={backdropAccessibilityLabel}
119
+ style={[
120
+ styles.backdrop,
121
+ { backgroundColor: theme.colors.overlay },
122
+ backdropAnimation(isClosing),
123
+ ]}
124
+ />
125
+
126
+ <View
127
+ testID={testID}
128
+ role="dialog"
129
+ aria-modal
130
+ aria-label={accessibilityLabel ?? title}
131
+ onStartShouldSetResponder={returnsTrue}
132
+ onResponderRelease={stopPropagation}
133
+ {...({ onClick: stopPropagation } as Record<string, unknown>)}
134
+ style={[
135
+ styles.card,
136
+ {
137
+ maxWidth,
138
+ maxHeight: `${MAX_HEIGHT_FRACTION * 100}%`,
139
+ backgroundColor: theme.colors.card,
140
+ borderColor: theme.colors.border,
141
+ shadowColor: theme.colors.shadow,
142
+ },
143
+ cardAnimation(isClosing),
144
+ cardStyle,
145
+ ]}
146
+ >
147
+ {hasHeader ? (
148
+ <DialogHeader
149
+ title={title}
150
+ showClose={resolvedShowClose}
151
+ padding={spacing.pad}
152
+ gap={spacing.headerGap}
153
+ closeAccessibilityLabel={closeAccessibilityLabel}
154
+ onClose={onClose}
155
+ />
156
+ ) : null}
157
+
158
+ <ScrollView
159
+ style={styles.bodyScroll}
160
+ contentContainerStyle={[
161
+ {
162
+ padding: spacing.pad,
163
+ paddingTop: hasHeader ? spacing.headerGap : spacing.pad,
164
+ gap: spacing.contentGap,
165
+ },
166
+ contentStyle,
167
+ ]}
168
+ showsVerticalScrollIndicator={false}
169
+ keyboardShouldPersistTaps="handled"
170
+ >
171
+ {children}
172
+ </ScrollView>
173
+
174
+ {footer ? (
175
+ <View
176
+ style={[
177
+ styles.footer,
178
+ {
179
+ padding: spacing.pad,
180
+ paddingTop: spacing.footerGap,
181
+ borderTopColor: theme.colors.borderLight,
182
+ },
183
+ ]}
184
+ >
185
+ {footer}
186
+ </View>
187
+ ) : null}
188
+ </View>
189
+ </View>
190
+ </Portal>
191
+ );
192
+ }
193
+
194
+ function DialogHeader({
195
+ title,
196
+ showClose,
197
+ padding,
198
+ gap,
199
+ closeAccessibilityLabel,
200
+ onClose,
201
+ }: {
202
+ title?: string;
203
+ showClose: boolean;
204
+ padding: number;
205
+ gap: number;
206
+ closeAccessibilityLabel: string;
207
+ onClose: () => void;
208
+ }) {
209
+ const theme = useTheme();
210
+
211
+ return (
212
+ <View
213
+ style={[
214
+ styles.header,
215
+ { paddingHorizontal: padding, paddingTop: padding, gap },
216
+ ]}
217
+ >
218
+ {title ? (
219
+ <Text
220
+ accessibilityRole="header"
221
+ numberOfLines={2}
222
+ style={[styles.title, { color: theme.colors.text }]}
223
+ >
224
+ {title}
225
+ </Text>
226
+ ) : (
227
+ <View style={styles.titleSpacer} />
228
+ )}
229
+ {showClose ? (
230
+ <CloseButton
231
+ accessibilityLabel={closeAccessibilityLabel}
232
+ onPress={onClose}
233
+ />
234
+ ) : null}
235
+ </View>
236
+ );
237
+ }
238
+
239
+ function CloseButton({
240
+ accessibilityLabel,
241
+ onPress,
242
+ }: {
243
+ accessibilityLabel: string;
244
+ onPress: () => void;
245
+ }) {
246
+ const theme = useTheme();
247
+ const { hovered, pressed, hoverHandlers, pressHandlers } = useInteractionStates();
248
+
249
+ return (
250
+ <Pressable
251
+ onPress={onPress}
252
+ {...hoverHandlers}
253
+ {...pressHandlers}
254
+ hitSlop={CLOSE_HIT_SLOP}
255
+ accessibilityRole="button"
256
+ accessibilityLabel={accessibilityLabel}
257
+ style={[
258
+ styles.closeButton,
259
+ { backgroundColor: theme.colors.contrast50 },
260
+ (hovered || pressed) && styles.closeButtonActive,
261
+ ]}
262
+ >
263
+ <CloseIcon size="sm" fill={theme.colors.textSecondary} />
264
+ </Pressable>
265
+ );
266
+ }
267
+
268
+ const returnsTrue = () => true;
269
+
270
+ function backdropAnimation(isClosing: boolean): ViewStyle {
271
+ return isClosing
272
+ ? ({ animation: `bloomCenteredDialogFadeOut ease-in ${FADE_OUT_DURATION}ms forwards` } as ViewStyle)
273
+ : ({ animation: 'bloomCenteredDialogFadeIn ease-out 150ms' } as ViewStyle);
274
+ }
275
+
276
+ function cardAnimation(isClosing: boolean): ViewStyle {
277
+ return isClosing
278
+ ? ({ animation: `bloomCenteredDialogZoomOut ease-in ${FADE_OUT_DURATION}ms forwards` } as ViewStyle)
279
+ : ({ animation: 'bloomCenteredDialogZoomIn cubic-bezier(0.16, 1, 0.3, 1) 200ms' } as ViewStyle);
280
+ }
281
+
282
+ const KEYFRAMES_ID = 'bloom-centered-dialog-keyframes';
283
+
284
+ /**
285
+ * CSS keyframes powering the web enter/exit animation. Injected once into
286
+ * `<head>` on first mount (keyed by id so re-mounts and multiple dialogs
287
+ * don't duplicate the rule). Mirrors the native modal's `fade` feel with a
288
+ * subtle zoom on the card.
289
+ */
290
+ export const BLOOM_CENTERED_DIALOG_CSS = `
291
+ @keyframes bloomCenteredDialogFadeIn { from { opacity: 0; } to { opacity: 1; } }
292
+ @keyframes bloomCenteredDialogFadeOut { from { opacity: 1; } to { opacity: 0; } }
293
+ @keyframes bloomCenteredDialogZoomIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
294
+ @keyframes bloomCenteredDialogZoomOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.96); } }
295
+ `;
296
+
297
+ function useKeyframes(): void {
298
+ useEffect(() => {
299
+ if (typeof document === 'undefined') return;
300
+ if (document.getElementById(KEYFRAMES_ID)) return;
301
+ const style = document.createElement('style');
302
+ style.id = KEYFRAMES_ID;
303
+ style.textContent = BLOOM_CENTERED_DIALOG_CSS;
304
+ document.head.appendChild(style);
305
+ }, []);
306
+ }
307
+
308
+ const styles = StyleSheet.create({
309
+ root: {
310
+ position: 'fixed' as 'absolute',
311
+ top: 0,
312
+ left: 0,
313
+ right: 0,
314
+ bottom: 0,
315
+ zIndex: 50,
316
+ alignItems: 'center',
317
+ justifyContent: 'center',
318
+ pointerEvents: 'auto',
319
+ },
320
+ backdrop: {
321
+ position: 'fixed' as 'absolute',
322
+ top: 0,
323
+ left: 0,
324
+ right: 0,
325
+ bottom: 0,
326
+ },
327
+ card: {
328
+ position: 'relative',
329
+ width: '100%',
330
+ borderRadius: CARD_RADIUS,
331
+ borderWidth: 1,
332
+ overflow: 'hidden',
333
+ shadowOpacity: 0.18,
334
+ shadowRadius: 24,
335
+ shadowOffset: { width: 0, height: 8 },
336
+ zIndex: 60,
337
+ },
338
+ header: {
339
+ flexDirection: 'row',
340
+ alignItems: 'flex-start',
341
+ justifyContent: 'space-between',
342
+ },
343
+ title: {
344
+ flex: 1,
345
+ fontSize: 17,
346
+ fontWeight: '700',
347
+ lineHeight: 22,
348
+ },
349
+ titleSpacer: {
350
+ flex: 1,
351
+ },
352
+ closeButton: {
353
+ width: 28,
354
+ height: 28,
355
+ borderRadius: 14,
356
+ alignItems: 'center',
357
+ justifyContent: 'center',
358
+ cursor: 'pointer',
359
+ },
360
+ closeButtonActive: {
361
+ opacity: 0.7,
362
+ },
363
+ bodyScroll: {
364
+ flexGrow: 0,
365
+ flexShrink: 1,
366
+ },
367
+ footer: {
368
+ borderTopWidth: 1,
369
+ },
370
+ });
@@ -0,0 +1,68 @@
1
+ import { borderRadius, space } from '../styles/tokens';
2
+
3
+ /**
4
+ * Shared layout constants for `<CenteredDialog>`, kept in one module so the
5
+ * native and web forks render identically. All values are Bloom theme tokens
6
+ * (`styles/tokens`) — no ad-hoc magic numbers.
7
+ *
8
+ * COMPACT is the priority: the `compact` spacing set is the default and is
9
+ * deliberately tight (≈`space.md`), so the card reads snug out of the box.
10
+ * The `cozy` set is the opt-out (`compact={false}`) for roomier dialogs.
11
+ */
12
+
13
+ /** Default max card width — comfortable for a compact dialog. */
14
+ export const DEFAULT_MAX_WIDTH = 440;
15
+
16
+ /** Card height is capped at this fraction of the viewport; body scrolls. */
17
+ export const MAX_HEIGHT_FRACTION = 0.8;
18
+
19
+ /** Card corner radius (token: `borderRadius.lg` = 16). */
20
+ export const CARD_RADIUS = borderRadius.lg;
21
+
22
+ /** Outer gutter between the card edge and the viewport edge (token `space.lg`). */
23
+ export const VIEWPORT_GUTTER = space.lg;
24
+
25
+ export type DialogSpacing = {
26
+ /** Card inner padding (horizontal + vertical). */
27
+ pad: number;
28
+ /** Gap between the header title row and the body. */
29
+ headerGap: number;
30
+ /** Gap between the body and the footer. */
31
+ footerGap: number;
32
+ /** Vertical gap between stacked body items (the content container `gap`). */
33
+ contentGap: number;
34
+ };
35
+
36
+ /**
37
+ * Compact (default) — tight, snug spacing built on `space.md` (12).
38
+ *
39
+ * pad = space.md (12)
40
+ * headerGap = space.sm (8)
41
+ * footerGap = space.md (12)
42
+ * contentGap = space.sm (8)
43
+ */
44
+ export const COMPACT_SPACING: DialogSpacing = {
45
+ pad: space.md,
46
+ headerGap: space.sm,
47
+ footerGap: space.md,
48
+ contentGap: space.sm,
49
+ };
50
+
51
+ /**
52
+ * Cozy (`compact={false}`) — roomier spacing built on `space.xl` (20).
53
+ *
54
+ * pad = space.xl (20)
55
+ * headerGap = space.md (12)
56
+ * footerGap = space.lg (16)
57
+ * contentGap = space.md (12)
58
+ */
59
+ export const COZY_SPACING: DialogSpacing = {
60
+ pad: space.xl,
61
+ headerGap: space.md,
62
+ footerGap: space.lg,
63
+ contentGap: space.md,
64
+ };
65
+
66
+ export function resolveSpacing(compact: boolean): DialogSpacing {
67
+ return compact ? COMPACT_SPACING : COZY_SPACING;
68
+ }
@@ -0,0 +1,70 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+
4
+ /**
5
+ * Props for the declarative `<CenteredDialog>` primitive.
6
+ *
7
+ * This is the simple, controlled centered-modal surface — distinct from the
8
+ * imperative `useDialogControl()` + `<Dialog control={…}>` API in the same
9
+ * module. Reach for `<CenteredDialog>` when you already own the open/closed
10
+ * boolean (a `useState`, a query flag, a route param) and just want Bloom to
11
+ * render the dimmed backdrop + a snug, theme-styled centered card.
12
+ *
13
+ * All spacing/colour/radius come from Bloom theme tokens — the card reads
14
+ * compact out of the box (`compact` defaults to `true`).
15
+ */
16
+ export type CenteredDialogProps = {
17
+ /** Whether the dialog is mounted + visible. */
18
+ visible: boolean;
19
+ /**
20
+ * Close request — fired on backdrop tap (when `dismissible`), the close
21
+ * button, the hardware back button (Android), and `Escape` (web). The
22
+ * caller owns the visible state, so it must flip `visible` to `false` here.
23
+ */
24
+ onClose: () => void;
25
+ /**
26
+ * Optional header title. When set (or when `showClose` is `true`) Bloom
27
+ * renders a tight header row above the content.
28
+ */
29
+ title?: string;
30
+ /**
31
+ * Tap-outside / back-button / Escape dismisses the dialog. Defaults to
32
+ * `true`. Set `false` for blocking flows (e.g. a destructive confirm that
33
+ * must be answered via an explicit action).
34
+ */
35
+ dismissible?: boolean;
36
+ /** Max card width in px. Defaults to {@link DEFAULT_MAX_WIDTH} (440). */
37
+ maxWidth?: number;
38
+ /**
39
+ * Tight, snug spacing (the Bloom default). Set `false` for a roomier card
40
+ * with larger padding and header/footer gaps. Defaults to `true`.
41
+ */
42
+ compact?: boolean;
43
+ /**
44
+ * Render a close (✕) icon button in the header. Defaults to `true` when a
45
+ * `title` is provided, otherwise `false` (a chromeless card owns its own
46
+ * dismissal affordances).
47
+ */
48
+ showClose?: boolean;
49
+ /** Card body. Scrolls within the height cap when it overflows. */
50
+ children?: ReactNode;
51
+ /**
52
+ * Optional footer slot for actions (e.g. a Bloom `<Button>` row). Rendered
53
+ * below the scrollable body with a hairline separator.
54
+ */
55
+ footer?: ReactNode;
56
+ /**
57
+ * Accessibility label for the dialog surface. Falls back to `title` when
58
+ * omitted.
59
+ */
60
+ accessibilityLabel?: string;
61
+ /** Accessibility label for the header close (✕) button. */
62
+ closeAccessibilityLabel?: string;
63
+ /** Accessibility label for the dimmed backdrop's tap-to-dismiss affordance. */
64
+ backdropAccessibilityLabel?: string;
65
+ /** Style overrides merged onto the centered card container. */
66
+ cardStyle?: StyleProp<ViewStyle>;
67
+ /** Style overrides merged onto the scrollable content container. */
68
+ contentStyle?: StyleProp<ViewStyle>;
69
+ testID?: string;
70
+ };
@@ -1,4 +1,5 @@
1
1
  export { Dialog } from './Dialog';
2
+ export { CenteredDialog, CENTERED_DIALOG_BACKDROP_TESTID } from './CenteredDialog';
2
3
  export { BloomDialogProvider } from './BloomDialogProvider';
3
4
  export { alert } from './alert';
4
5
  export { useDialogContext, useDialogControl } from './context';
@@ -13,3 +14,4 @@ export type {
13
14
  DialogControlProps,
14
15
  DialogProps,
15
16
  } from './types';
17
+ export type { CenteredDialogProps } from './centered-dialog-types';
@@ -9,6 +9,11 @@
9
9
  // `package.json`'s `exports['./dialog']`; native bundlers fall through to
10
10
  // the React Native build above.
11
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';
12
17
  export { BloomDialogProvider } from './BloomDialogProvider.web';
13
18
  export { alert } from './alert';
14
19
  export { useDialogContext, useDialogControl } from './context';
@@ -23,3 +28,4 @@ export type {
23
28
  DialogControlProps,
24
29
  DialogProps,
25
30
  } from './types';
31
+ export type { CenteredDialogProps } from './centered-dialog-types';
package/src/index.ts CHANGED
@@ -20,6 +20,8 @@ export { type Props as IconProps, sizes as iconSizes, useCommonSVGProps } from '
20
20
  export * from './portal';
21
21
  export {
22
22
  Dialog,
23
+ CenteredDialog,
24
+ CENTERED_DIALOG_BACKDROP_TESTID,
23
25
  BloomDialogProvider,
24
26
  alert,
25
27
  useDialogContext,
@@ -28,6 +30,7 @@ export {
28
30
  export type {
29
31
  AlertButton,
30
32
  AlertButtonStyle,
33
+ CenteredDialogProps,
31
34
  DialogAction,
32
35
  DialogActionColor,
33
36
  DialogContextProps,
package/src/index.web.ts CHANGED
@@ -25,6 +25,8 @@ export { type Props as IconProps, sizes as iconSizes, useCommonSVGProps } from '
25
25
  export * from './portal/index.web';
26
26
  export {
27
27
  Dialog,
28
+ CenteredDialog,
29
+ CENTERED_DIALOG_BACKDROP_TESTID,
28
30
  BloomDialogProvider,
29
31
  alert,
30
32
  useDialogContext,
@@ -33,6 +35,7 @@ export {
33
35
  export type {
34
36
  AlertButton,
35
37
  AlertButtonStyle,
38
+ CenteredDialogProps,
36
39
  DialogAction,
37
40
  DialogActionColor,
38
41
  DialogContextProps,