@oxyhq/bloom 0.15.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.
Files changed (188) hide show
  1. package/lib/commonjs/alert-dialog/AlertDialog.js +35 -27
  2. package/lib/commonjs/alert-dialog/AlertDialog.js.map +1 -1
  3. package/lib/commonjs/alert-dialog/index.js +1 -1
  4. package/lib/commonjs/alert-dialog/index.js.map +1 -1
  5. package/lib/commonjs/alert-dialog/index.web.js +1 -1
  6. package/lib/commonjs/alert-dialog/index.web.js.map +1 -1
  7. package/lib/commonjs/command/Command.js +27 -16
  8. package/lib/commonjs/command/Command.js.map +1 -1
  9. package/lib/commonjs/command/index.js +1 -1
  10. package/lib/commonjs/command/index.js.map +1 -1
  11. package/lib/commonjs/command/index.web.js +1 -1
  12. package/lib/commonjs/command/index.web.js.map +1 -1
  13. package/lib/commonjs/dialog/Dialog.js +1 -2
  14. package/lib/commonjs/dialog/Dialog.js.map +1 -1
  15. package/lib/commonjs/dialog/Dialog.web.js +9 -6
  16. package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
  17. package/lib/commonjs/dialog/index.js +0 -13
  18. package/lib/commonjs/dialog/index.js.map +1 -1
  19. package/lib/commonjs/dialog/index.web.js +0 -19
  20. package/lib/commonjs/dialog/index.web.js.map +1 -1
  21. package/lib/commonjs/index.js +0 -29
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/commonjs/index.web.js +6 -35
  24. package/lib/commonjs/index.web.js.map +1 -1
  25. package/lib/module/alert-dialog/AlertDialog.js +35 -27
  26. package/lib/module/alert-dialog/AlertDialog.js.map +1 -1
  27. package/lib/module/alert-dialog/index.js +2 -2
  28. package/lib/module/alert-dialog/index.js.map +1 -1
  29. package/lib/module/alert-dialog/index.web.js +2 -2
  30. package/lib/module/alert-dialog/index.web.js.map +1 -1
  31. package/lib/module/command/Command.js +27 -16
  32. package/lib/module/command/Command.js.map +1 -1
  33. package/lib/module/command/index.js +2 -2
  34. package/lib/module/command/index.js.map +1 -1
  35. package/lib/module/command/index.web.js +2 -2
  36. package/lib/module/command/index.web.js.map +1 -1
  37. package/lib/module/dialog/Dialog.js +1 -2
  38. package/lib/module/dialog/Dialog.js.map +1 -1
  39. package/lib/module/dialog/Dialog.web.js +9 -6
  40. package/lib/module/dialog/Dialog.web.js.map +1 -1
  41. package/lib/module/dialog/index.js +0 -1
  42. package/lib/module/dialog/index.js.map +1 -1
  43. package/lib/module/dialog/index.web.js +0 -1
  44. package/lib/module/dialog/index.web.js.map +1 -1
  45. package/lib/module/index.js +1 -3
  46. package/lib/module/index.js.map +1 -1
  47. package/lib/module/index.web.js +1 -3
  48. package/lib/module/index.web.js.map +1 -1
  49. package/lib/typescript/commonjs/alert-dialog/AlertDialog.d.ts +13 -12
  50. package/lib/typescript/commonjs/alert-dialog/AlertDialog.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/alert-dialog/index.d.ts.map +1 -1
  52. package/lib/typescript/commonjs/alert-dialog/index.web.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/command/Command.d.ts +8 -8
  54. package/lib/typescript/commonjs/command/Command.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/command/index.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/command/index.web.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/dialog/Dialog.d.ts +1 -2
  58. package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts +2 -2
  60. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/dialog/index.d.ts +0 -2
  62. package/lib/typescript/commonjs/dialog/index.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/dialog/index.web.d.ts +0 -2
  64. package/lib/typescript/commonjs/dialog/index.web.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/index.d.ts +2 -4
  66. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/index.web.d.ts +2 -4
  68. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  69. package/lib/typescript/module/alert-dialog/AlertDialog.d.ts +13 -12
  70. package/lib/typescript/module/alert-dialog/AlertDialog.d.ts.map +1 -1
  71. package/lib/typescript/module/alert-dialog/index.d.ts.map +1 -1
  72. package/lib/typescript/module/alert-dialog/index.web.d.ts.map +1 -1
  73. package/lib/typescript/module/command/Command.d.ts +8 -8
  74. package/lib/typescript/module/command/Command.d.ts.map +1 -1
  75. package/lib/typescript/module/command/index.d.ts.map +1 -1
  76. package/lib/typescript/module/command/index.web.d.ts.map +1 -1
  77. package/lib/typescript/module/dialog/Dialog.d.ts +1 -2
  78. package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
  79. package/lib/typescript/module/dialog/Dialog.web.d.ts +2 -2
  80. package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
  81. package/lib/typescript/module/dialog/index.d.ts +0 -2
  82. package/lib/typescript/module/dialog/index.d.ts.map +1 -1
  83. package/lib/typescript/module/dialog/index.web.d.ts +0 -2
  84. package/lib/typescript/module/dialog/index.web.d.ts.map +1 -1
  85. package/lib/typescript/module/index.d.ts +2 -4
  86. package/lib/typescript/module/index.d.ts.map +1 -1
  87. package/lib/typescript/module/index.web.d.ts +2 -4
  88. package/lib/typescript/module/index.web.d.ts.map +1 -1
  89. package/package.json +1 -18
  90. package/src/__tests__/AlertDialog.test.tsx +122 -0
  91. package/src/__tests__/Command.test.tsx +107 -0
  92. package/src/alert-dialog/AlertDialog.tsx +46 -36
  93. package/src/alert-dialog/index.ts +2 -2
  94. package/src/alert-dialog/index.web.ts +2 -2
  95. package/src/command/Command.tsx +30 -19
  96. package/src/command/index.ts +2 -2
  97. package/src/command/index.web.ts +2 -2
  98. package/src/dialog/Dialog.tsx +1 -2
  99. package/src/dialog/Dialog.web.tsx +9 -6
  100. package/src/dialog/index.ts +0 -2
  101. package/src/dialog/index.web.ts +0 -6
  102. package/src/index.ts +0 -11
  103. package/src/index.web.ts +0 -11
  104. package/lib/commonjs/dialog/CenteredDialog.js +0 -252
  105. package/lib/commonjs/dialog/CenteredDialog.js.map +0 -1
  106. package/lib/commonjs/dialog/CenteredDialog.web.js +0 -330
  107. package/lib/commonjs/dialog/CenteredDialog.web.js.map +0 -1
  108. package/lib/commonjs/dialog/centered-dialog-tokens.js +0 -62
  109. package/lib/commonjs/dialog/centered-dialog-tokens.js.map +0 -1
  110. package/lib/commonjs/dialog/centered-dialog-types.js +0 -6
  111. package/lib/commonjs/dialog/centered-dialog-types.js.map +0 -1
  112. package/lib/commonjs/responsive-sheet/ResponsiveSheet.js +0 -97
  113. package/lib/commonjs/responsive-sheet/ResponsiveSheet.js.map +0 -1
  114. package/lib/commonjs/responsive-sheet/ResponsiveSheet.web.js +0 -84
  115. package/lib/commonjs/responsive-sheet/ResponsiveSheet.web.js.map +0 -1
  116. package/lib/commonjs/responsive-sheet/index.js +0 -19
  117. package/lib/commonjs/responsive-sheet/index.js.map +0 -1
  118. package/lib/commonjs/responsive-sheet/index.web.js +0 -19
  119. package/lib/commonjs/responsive-sheet/index.web.js.map +0 -1
  120. package/lib/commonjs/responsive-sheet/types.js +0 -6
  121. package/lib/commonjs/responsive-sheet/types.js.map +0 -1
  122. package/lib/module/dialog/CenteredDialog.js +0 -246
  123. package/lib/module/dialog/CenteredDialog.js.map +0 -1
  124. package/lib/module/dialog/CenteredDialog.web.js +0 -324
  125. package/lib/module/dialog/CenteredDialog.web.js.map +0 -1
  126. package/lib/module/dialog/centered-dialog-tokens.js +0 -58
  127. package/lib/module/dialog/centered-dialog-tokens.js.map +0 -1
  128. package/lib/module/dialog/centered-dialog-types.js +0 -4
  129. package/lib/module/dialog/centered-dialog-types.js.map +0 -1
  130. package/lib/module/responsive-sheet/ResponsiveSheet.js +0 -90
  131. package/lib/module/responsive-sheet/ResponsiveSheet.js.map +0 -1
  132. package/lib/module/responsive-sheet/ResponsiveSheet.web.js +0 -77
  133. package/lib/module/responsive-sheet/ResponsiveSheet.web.js.map +0 -1
  134. package/lib/module/responsive-sheet/index.js +0 -4
  135. package/lib/module/responsive-sheet/index.js.map +0 -1
  136. package/lib/module/responsive-sheet/index.web.js +0 -12
  137. package/lib/module/responsive-sheet/index.web.js.map +0 -1
  138. package/lib/module/responsive-sheet/types.js +0 -4
  139. package/lib/module/responsive-sheet/types.js.map +0 -1
  140. package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts +0 -22
  141. package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts.map +0 -1
  142. package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts +0 -31
  143. package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts.map +0 -1
  144. package/lib/typescript/commonjs/dialog/centered-dialog-tokens.d.ts +0 -47
  145. package/lib/typescript/commonjs/dialog/centered-dialog-tokens.d.ts.map +0 -1
  146. package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts +0 -74
  147. package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts.map +0 -1
  148. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts +0 -22
  149. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts.map +0 -1
  150. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.web.d.ts +0 -16
  151. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.web.d.ts.map +0 -1
  152. package/lib/typescript/commonjs/responsive-sheet/index.d.ts +0 -3
  153. package/lib/typescript/commonjs/responsive-sheet/index.d.ts.map +0 -1
  154. package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts +0 -3
  155. package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts.map +0 -1
  156. package/lib/typescript/commonjs/responsive-sheet/types.d.ts +0 -58
  157. package/lib/typescript/commonjs/responsive-sheet/types.d.ts.map +0 -1
  158. package/lib/typescript/module/dialog/CenteredDialog.d.ts +0 -22
  159. package/lib/typescript/module/dialog/CenteredDialog.d.ts.map +0 -1
  160. package/lib/typescript/module/dialog/CenteredDialog.web.d.ts +0 -31
  161. package/lib/typescript/module/dialog/CenteredDialog.web.d.ts.map +0 -1
  162. package/lib/typescript/module/dialog/centered-dialog-tokens.d.ts +0 -47
  163. package/lib/typescript/module/dialog/centered-dialog-tokens.d.ts.map +0 -1
  164. package/lib/typescript/module/dialog/centered-dialog-types.d.ts +0 -74
  165. package/lib/typescript/module/dialog/centered-dialog-types.d.ts.map +0 -1
  166. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts +0 -22
  167. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts.map +0 -1
  168. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.web.d.ts +0 -16
  169. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.web.d.ts.map +0 -1
  170. package/lib/typescript/module/responsive-sheet/index.d.ts +0 -3
  171. package/lib/typescript/module/responsive-sheet/index.d.ts.map +0 -1
  172. package/lib/typescript/module/responsive-sheet/index.web.d.ts +0 -3
  173. package/lib/typescript/module/responsive-sheet/index.web.d.ts.map +0 -1
  174. package/lib/typescript/module/responsive-sheet/types.d.ts +0 -58
  175. package/lib/typescript/module/responsive-sheet/types.d.ts.map +0 -1
  176. package/src/__tests__/CenteredDialog.test.tsx +0 -108
  177. package/src/__tests__/ResponsiveSheet.test.tsx +0 -88
  178. package/src/dialog/CenteredDialog.stories.tsx +0 -125
  179. package/src/dialog/CenteredDialog.tsx +0 -305
  180. package/src/dialog/CenteredDialog.web.tsx +0 -374
  181. package/src/dialog/centered-dialog-tokens.ts +0 -68
  182. package/src/dialog/centered-dialog-types.ts +0 -74
  183. package/src/responsive-sheet/ResponsiveSheet.stories.tsx +0 -54
  184. package/src/responsive-sheet/ResponsiveSheet.tsx +0 -88
  185. package/src/responsive-sheet/ResponsiveSheet.web.tsx +0 -76
  186. package/src/responsive-sheet/index.ts +0 -6
  187. package/src/responsive-sheet/index.web.ts +0 -14
  188. package/src/responsive-sheet/types.ts +0 -60
@@ -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,QACV,6BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAElC,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,cAAc,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC,MAAM,EAAE,CAAC;EAAEC,IAAI,EAAE,CAAC;EAAEC,KAAK,EAAE;AAAE,CAAU;AACxE,MAAMC,YAAY,GAAGlB,mBAAmB,CAAC,CAAC;;AAE1C;AACA,OAAO,MAAMmB,+BAA+B,GAAG,gCAAgC;AAE/E,MAAMC,eAAe,GAAIC,CAAkC,IAAKA,CAAC,CAACD,eAAe,CAAC,CAAC;;AAEnF;AACA;AACA;AACA;AACA;AACA;AACA;A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;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
@@ -1 +0,0 @@
1
- {"version":3,"names":["borderRadius","space","DEFAULT_MAX_WIDTH","MAX_HEIGHT_FRACTION","CARD_RADIUS","lg","VIEWPORT_GUTTER","COMPACT_SPACING","pad","md","headerGap","sm","footerGap","contentGap","COZY_SPACING","xl","resolveSpacing","compact"],"sourceRoot":"../../../src","sources":["dialog/centered-dialog-tokens.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,KAAK,QAAQ,qBAAkB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,MAAMC,iBAAiB,GAAG,GAAG;;AAEpC;AACA,OAAO,MAAMC,mBAAmB,GAAG,GAAG;;AAEtC;AACA,OAAO,MAAMC,WAAW,GAAGJ,YAAY,CAACK,EAAE;;AAE1C;AACA,OAAO,MAAMC,eAAe,GAAGL,KAAK,CAACI,EAAE;AAavC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,eAA8B,GAAG;EAC5CC,GAAG,EAAEP,KAAK,CAACQ,EAAE;EACbC,SAAS,EAAET,KAAK,CAACU,EAAE;EACnBC,SAAS,EAAEX,KAAK,CAACQ,EAAE;EACnBI,UAAU,EAAEZ,KAAK,CAACU;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,YAA2B,GAAG;EACzCN,GAAG,EAAEP,KAAK,CAACc,EAAE;EACbL,SAAS,EAAET,KAAK,CAACQ,EAAE;EACnBG,SAAS,EAAEX,KAAK,CAACI,EAAE;EACnBQ,UAAU,EAAEZ,KAAK,CAACQ;AACpB,CAAC;AAED,OAAO,SAASO,cAAcA,CAACC,OAAgB,EAAiB;EAC9D,OAAOA,OAAO,GAAGV,eAAe,GAAGO,YAAY;AACjD","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export {};
4
- //# sourceMappingURL=centered-dialog-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["dialog/centered-dialog-types.ts"],"mappings":"","ignoreList":[]}
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- import React from 'react';
4
- import { Dialog } from '../dialog';
5
- import { BREAKPOINT_LG, BREAKPOINT_MD, BREAKPOINT_SM, BREAKPOINT_XL, DIALOG_SHEET_BACKDROP_TESTID } from "../dialog/placement.js";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- /**
8
- * @deprecated Use `<Dialog placement={{ base: 'bottom', md: 'left' }}>` instead.
9
- *
10
- * `ResponsiveSheet` is now a thin wrapper that configures the canonical
11
- * `<Dialog>` — an anchored side-sheet on wide screens collapsing to a
12
- * bottom-sheet below the breakpoint. It holds ZERO motion/layout logic of its
13
- * own; it maps its props onto a responsive `Dialog` `placement`. The
14
- * `@oxyhq/bloom/responsive-sheet` subpath is retained for the migration window.
15
- *
16
- * This file is BOTH the package default entry (resolved by downstream `tsc`
17
- * and non-Metro web bundlers via the `browser` condition through `index.web`)
18
- * AND a clean delegation, so it carries no platform-specific imports.
19
- */
20
- export function ResponsiveSheet({
21
- open,
22
- onClose,
23
- side = 'left',
24
- breakpoint = BREAKPOINT_MD,
25
- width,
26
- maxHeightRatio,
27
- inset,
28
- showHandle,
29
- dismissOnBackdrop,
30
- panelStyle,
31
- panelClassName,
32
- containerStyle,
33
- containerClassName,
34
- label,
35
- children
36
- }) {
37
- return /*#__PURE__*/_jsx(Dialog, {
38
- open: open,
39
- onClose: onClose,
40
- placement: placementForSide(side, breakpoint),
41
- width: width,
42
- maxHeightRatio: maxHeightRatio,
43
- inset: inset,
44
- showHandle: showHandle,
45
- dismissOnBackdrop: dismissOnBackdrop,
46
- panelStyle: panelStyle,
47
- panelClassName: panelClassName,
48
- containerStyle: containerStyle,
49
- containerClassName: containerClassName,
50
- label: label,
51
- children: children
52
- });
53
- }
54
-
55
- /**
56
- * Build the `Dialog` `placement` map for a `ResponsiveSheet`: a bottom-sheet
57
- * below `breakpoint`, the anchored `side` at and above it. The `breakpoint`
58
- * (px) is bucketed to the nearest Tailwind key so the side-sheet engages at the
59
- * matching width.
60
- */
61
- function placementForSide(side, breakpoint) {
62
- if (breakpoint <= BREAKPOINT_SM) return {
63
- base: 'bottom',
64
- sm: side
65
- };
66
- if (breakpoint <= BREAKPOINT_MD) return {
67
- base: 'bottom',
68
- md: side
69
- };
70
- if (breakpoint <= BREAKPOINT_LG) return {
71
- base: 'bottom',
72
- lg: side
73
- };
74
- if (breakpoint <= BREAKPOINT_XL) return {
75
- base: 'bottom',
76
- xl: side
77
- };
78
- return {
79
- base: 'bottom',
80
- xl: side
81
- };
82
- }
83
-
84
- /**
85
- * @deprecated Stable testID for the dimmed backdrop dismiss button — now
86
- * provided by the underlying `<Dialog>`'s side/bottom backdrop.
87
- */
88
- export const RESPONSIVE_SHEET_BACKDROP_TESTID = DIALOG_SHEET_BACKDROP_TESTID;
89
- export default ResponsiveSheet;
90
- //# sourceMappingURL=ResponsiveSheet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","Dialog","BREAKPOINT_LG","BREAKPOINT_MD","BREAKPOINT_SM","BREAKPOINT_XL","DIALOG_SHEET_BACKDROP_TESTID","jsx","_jsx","ResponsiveSheet","open","onClose","side","breakpoint","width","maxHeightRatio","inset","showHandle","dismissOnBackdrop","panelStyle","panelClassName","containerStyle","containerClassName","label","children","placement","placementForSide","base","sm","md","lg","xl","RESPONSIVE_SHEET_BACKDROP_TESTID"],"sourceRoot":"../../../src","sources":["responsive-sheet/ResponsiveSheet.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,MAAM,QAAQ,WAAW;AAClC,SACEC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,4BAA4B,QAEvB,wBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAC;EAC9BC,IAAI;EACJC,OAAO;EACPC,IAAI,GAAG,MAAM;EACbC,UAAU,GAAGV,aAAa;EAC1BW,KAAK;EACLC,cAAc;EACdC,KAAK;EACLC,UAAU;EACVC,iBAAiB;EACjBC,UAAU;EACVC,cAAc;EACdC,cAAc;EACdC,kBAAkB;EAClBC,KAAK;EACLC;AACoB,CAAC,EAAE;EACvB,oBACEhB,IAAA,CAACP,MAAM;IACLS,IAAI,EAAEA,IAAK;IACXC,OAAO,EAAEA,OAAQ;IACjBc,SAAS,EAAEC,gBAAgB,CAACd,IAAI,EAAEC,UAAU,CAAE;IAC9CC,KAAK,EAAEA,KAAM;IACbC,cAAc,EAAEA,cAAe;IAC/BC,KAAK,EAAEA,KAAM;IACbC,UAAU,EAAEA,UAAW;IACvBC,iBAAiB,EAAEA,iBAAkB;IACrCC,UAAU,EAAEA,UAAW;IACvBC,cAAc,EAAEA,cAAe;IAC/BC,cAAc,EAAEA,cAAe;IAC/BC,kBAAkB,EAAEA,kBAAmB;IACvCC,KAAK,EAAEA,KAAM;IAAAC,QAAA,EAEZA;EAAQ,CACH,CAAC;AAEb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,gBAAgBA,CACvBd,IAAsB,EACtBC,UAAkB,EACS;EAC3B,IAAIA,UAAU,IAAIT,aAAa,EAAE,OAAO;IAAEuB,IAAI,EAAE,QAAQ;IAAEC,EAAE,EAAEhB;EAAK,CAAC;EACpE,IAAIC,UAAU,IAAIV,aAAa,EAAE,OAAO;IAAEwB,IAAI,EAAE,QAAQ;IAAEE,EAAE,EAAEjB;EAAK,CAAC;EACpE,IAAIC,UAAU,IAAIX,aAAa,EAAE,OAAO;IAAEyB,IAAI,EAAE,QAAQ;IAAEG,EAAE,EAAElB;EAAK,CAAC;EACpE,IAAIC,UAAU,IAAIR,aAAa,EAAE,OAAO;IAAEsB,IAAI,EAAE,QAAQ;IAAEI,EAAE,EAAEnB;EAAK,CAAC;EACpE,OAAO;IAAEe,IAAI,EAAE,QAAQ;IAAEI,EAAE,EAAEnB;EAAK,CAAC;AACrC;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMoB,gCAAgC,GAAG1B,4BAA4B;AAE5E,eAAeG,eAAe","ignoreList":[]}
@@ -1,77 +0,0 @@
1
- "use strict";
2
-
3
- import React from 'react';
4
- import { Dialog } from "../dialog/index.web.js";
5
- import { BREAKPOINT_LG, BREAKPOINT_MD, BREAKPOINT_SM, BREAKPOINT_XL, DIALOG_SHEET_BACKDROP_TESTID } from "../dialog/placement.js";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- /**
8
- * @deprecated Use `<Dialog placement={{ base: 'bottom', md: 'left' }}>` instead.
9
- *
10
- * Web fork of the deprecated `ResponsiveSheet` wrapper. Identical delegation to
11
- * the default fork, but imports the web `Dialog` explicitly so non-Metro web
12
- * bundlers never follow the native (reanimated) `Dialog` sibling.
13
- */
14
- export function ResponsiveSheet({
15
- open,
16
- onClose,
17
- side = 'left',
18
- breakpoint = BREAKPOINT_MD,
19
- width,
20
- maxHeightRatio,
21
- inset,
22
- showHandle,
23
- dismissOnBackdrop,
24
- panelStyle,
25
- panelClassName,
26
- containerStyle,
27
- containerClassName,
28
- label,
29
- children
30
- }) {
31
- return /*#__PURE__*/_jsx(Dialog, {
32
- open: open,
33
- onClose: onClose,
34
- placement: placementForSide(side, breakpoint),
35
- width: width,
36
- maxHeightRatio: maxHeightRatio,
37
- inset: inset,
38
- showHandle: showHandle,
39
- dismissOnBackdrop: dismissOnBackdrop,
40
- panelStyle: panelStyle,
41
- panelClassName: panelClassName,
42
- containerStyle: containerStyle,
43
- containerClassName: containerClassName,
44
- label: label,
45
- children: children
46
- });
47
- }
48
- function placementForSide(side, breakpoint) {
49
- if (breakpoint <= BREAKPOINT_SM) return {
50
- base: 'bottom',
51
- sm: side
52
- };
53
- if (breakpoint <= BREAKPOINT_MD) return {
54
- base: 'bottom',
55
- md: side
56
- };
57
- if (breakpoint <= BREAKPOINT_LG) return {
58
- base: 'bottom',
59
- lg: side
60
- };
61
- if (breakpoint <= BREAKPOINT_XL) return {
62
- base: 'bottom',
63
- xl: side
64
- };
65
- return {
66
- base: 'bottom',
67
- xl: side
68
- };
69
- }
70
-
71
- /**
72
- * @deprecated Stable testID for the dimmed backdrop dismiss button — now
73
- * provided by the underlying `<Dialog>`'s side/bottom backdrop.
74
- */
75
- export const RESPONSIVE_SHEET_BACKDROP_TESTID = DIALOG_SHEET_BACKDROP_TESTID;
76
- export default ResponsiveSheet;
77
- //# sourceMappingURL=ResponsiveSheet.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","Dialog","BREAKPOINT_LG","BREAKPOINT_MD","BREAKPOINT_SM","BREAKPOINT_XL","DIALOG_SHEET_BACKDROP_TESTID","jsx","_jsx","ResponsiveSheet","open","onClose","side","breakpoint","width","maxHeightRatio","inset","showHandle","dismissOnBackdrop","panelStyle","panelClassName","containerStyle","containerClassName","label","children","placement","placementForSide","base","sm","md","lg","xl","RESPONSIVE_SHEET_BACKDROP_TESTID"],"sourceRoot":"../../../src","sources":["responsive-sheet/ResponsiveSheet.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,MAAM,QAAQ,wBA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EAAE,EAAElB;EAAK,CAAC;EACpE,IAAIC,UAAU,IAAIR,aAAa,EAAE,OAAO;IAAEsB,IAAI,EAAE,QAAQ;IAAEI,EAAE,EAAEnB;EAAK,CAAC;EACpE,OAAO;IAAEe,IAAI,EAAE,QAAQ;IAAEI,EAAE,EAAEnB;EAAK,CAAC;AACrC;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMoB,gCAAgC,GAAG1B,4BAA4B;AAE5E,eAAeG,eAAe","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export { ResponsiveSheet, RESPONSIVE_SHEET_BACKDROP_TESTID } from './ResponsiveSheet';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ResponsiveSheet","RESPONSIVE_SHEET_BACKDROP_TESTID"],"sourceRoot":"../../../src","sources":["responsive-sheet/index.ts"],"mappings":";;AAAA,SAASA,eAAe,EAAEC,gCAAgC,QAAQ,mBAAmB","ignoreList":[]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- // Web variant of the `./responsive-sheet` barrel.
4
- //
5
- // `ResponsiveSheet` is now a deprecated thin wrapper over `<Dialog>`. The
6
- // default barrel (`./index.ts`) imports the default `Dialog`; THIS web barrel
7
- // re-exports from `./ResponsiveSheet.web`, which imports the web `Dialog`
8
- // explicitly so a non-Metro bundler never follows the native (reanimated)
9
- // `Dialog` sibling. Web bundlers select this file via the `"browser"` export
10
- // condition in `package.json`'s `exports['./responsive-sheet']`.
11
- export { ResponsiveSheet, RESPONSIVE_SHEET_BACKDROP_TESTID } from "./ResponsiveSheet.web.js";
12
- //# sourceMappingURL=index.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ResponsiveSheet","RESPONSIVE_SHEET_BACKDROP_TESTID"],"sourceRoot":"../../../src","sources":["responsive-sheet/index.web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,gCAAgC,QAAQ,0BAAuB","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export {};
4
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["responsive-sheet/types.ts"],"mappings":"","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- import type { CenteredDialogProps } from './centered-dialog-types';
2
- /** Stable testID for the dimmed backdrop. Overridden when a `testID` is set. */
3
- export declare const CENTERED_DIALOG_BACKDROP_TESTID = "bloom-centered-dialog-backdrop";
4
- /**
5
- * @deprecated Use `<Dialog placement="center">` instead.
6
- *
7
- * Native variant of `<CenteredDialog>`.
8
- *
9
- * A controlled, centered modal: a transparent RN `Modal` (fade animation,
10
- * own native window) hosting a dimmed full-screen backdrop and a centered,
11
- * rounded card styled entirely from Bloom theme tokens.
12
- *
13
- * The backdrop is a sibling `Pressable` rendered BEHIND the card (absolute
14
- * filled), never a parent of it — so a tap on the card never bubbles to the
15
- * backdrop's close handler and the card never ends up nested inside the
16
- * backdrop's pressable on web.
17
- *
18
- * Dismissal: backdrop tap (when `dismissible`), the header close button, and
19
- * the Android hardware back button (`onRequestClose`) all call `onClose`.
20
- */
21
- export declare function CenteredDialog({ visible, onClose, title, dismissible, maxWidth, compact, showClose, children, footer, accessibilityLabel, closeAccessibilityLabel, backdropAccessibilityLabel, cardStyle, contentStyle, testID, }: CenteredDialogProps): import("react/jsx-runtime").JSX.Element;
22
- //# sourceMappingURL=CenteredDialog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CenteredDialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/CenteredDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAWnE,gFAAgF;AAChF,eAAO,MAAM,+BAA+B,mCAAmC,CAAC;AAEhF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,OAAO,EACP,KAAK,EACL,WAAkB,EAClB,QAA4B,EAC5B,OAAc,EACd,SAAS,EACT,QAAQ,EACR,MAAM,EACN,kBAAkB,EAClB,uBAAwC,EACxC,0BAA6C,EAC7C,SAAS,EACT,YAAY,EACZ,MAAM,GACP,EAAE,mBAAmB,2CAsGrB"}