@oxyhq/bloom 0.16.0 → 0.16.2
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/dialog/Dialog.js +45 -157
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +64 -198
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +216 -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/placement.js +12 -1
- package/lib/commonjs/dialog/placement.js.map +1 -1
- package/lib/module/dialog/Dialog.js +48 -160
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +66 -200
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +211 -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/placement.js +11 -0
- package/lib/module/dialog/placement.js.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.d.ts +1 -1
- 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/placement.d.ts +10 -0
- package/lib/typescript/commonjs/dialog/placement.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +12 -0
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.d.ts +1 -1
- 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/placement.d.ts +10 -0
- package/lib/typescript/module/dialog/placement.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +12 -0
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/BottomSheetGesture.test.tsx +135 -0
- package/src/__tests__/DialogBottomSheet.test.tsx +259 -0
- package/src/dialog/Dialog.tsx +41 -171
- package/src/dialog/Dialog.web.tsx +56 -211
- package/src/dialog/DialogBottomSheet.tsx +250 -0
- package/src/dialog/DialogContent.tsx +157 -0
- package/src/dialog/placement.ts +11 -0
- package/src/dialog/types.ts +12 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useEffect, useId, useImperativeHandle, useMemo, useRef } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { BottomSheet } from "../bottom-sheet/index.js";
|
|
6
|
+
import { useTheme } from "../theme/use-theme.js";
|
|
7
|
+
import { Context } from "./context.js";
|
|
8
|
+
import { DialogBody } from "./DialogContent.js";
|
|
9
|
+
import { DEFAULT_DIALOG_CONTENT_PADDING, DEFAULT_MAX_HEIGHT_RATIO, PANEL_RADIUS, SHEET_BACKDROP_OPACITY } from "./placement.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
/**
|
|
12
|
+
* Shared `BottomSheet`-backed surface for the `bottom` placement, used by BOTH
|
|
13
|
+
* `Dialog.tsx` (native) and `Dialog.web.tsx` (web). `BottomSheet` is itself a
|
|
14
|
+
* single cross-platform implementation (react-native-gesture-handler +
|
|
15
|
+
* reanimated, drag-to-dismiss on web and native alike), so routing the bottom
|
|
16
|
+
* placement through here gives ONE code path with drag working everywhere — no
|
|
17
|
+
* duplicated CSS slide-up sheet.
|
|
18
|
+
*
|
|
19
|
+
* This component owns the entire open↔present/dismiss bridge and the Dialog →
|
|
20
|
+
* BottomSheet prop mapping in one place:
|
|
21
|
+
*
|
|
22
|
+
* - `open` (controlled) / `control` (imperative) → `present()` / `dismiss()`
|
|
23
|
+
* - `onClose` → fired once the sheet settles
|
|
24
|
+
* - `maxHeightRatio` → sheet `maxHeight`
|
|
25
|
+
* - `showHandle` / `dismissOnBackdrop` / `label` → forwarded to the surface
|
|
26
|
+
* - `panelStyle` → paints the sheet surface
|
|
27
|
+
* - `containerStyle` → wraps the content subtree
|
|
28
|
+
* so a host's CSS-var theme scope (`vars()`) still applies to descendants
|
|
29
|
+
* - `title` / `description` / `actions` / `children` → declarative body
|
|
30
|
+
*/
|
|
31
|
+
export function DialogBottomSheet({
|
|
32
|
+
control,
|
|
33
|
+
open: controlledOpen,
|
|
34
|
+
onClose,
|
|
35
|
+
testID,
|
|
36
|
+
title,
|
|
37
|
+
description,
|
|
38
|
+
actions,
|
|
39
|
+
maxHeightRatio = DEFAULT_MAX_HEIGHT_RATIO,
|
|
40
|
+
showHandle = true,
|
|
41
|
+
dismissOnBackdrop = true,
|
|
42
|
+
contentPadding = DEFAULT_DIALOG_CONTENT_PADDING,
|
|
43
|
+
style,
|
|
44
|
+
panelStyle,
|
|
45
|
+
panelClassName,
|
|
46
|
+
containerStyle,
|
|
47
|
+
containerClassName,
|
|
48
|
+
label,
|
|
49
|
+
children
|
|
50
|
+
}) {
|
|
51
|
+
const isControlled = controlledOpen !== undefined;
|
|
52
|
+
const theme = useTheme();
|
|
53
|
+
const ref = useRef(null);
|
|
54
|
+
const closeCallbacks = useRef([]);
|
|
55
|
+
const titleId = useId();
|
|
56
|
+
const descriptionId = useId();
|
|
57
|
+
|
|
58
|
+
// Read the latest controlled flag / `onClose` inside stable callbacks without
|
|
59
|
+
// re-binding them (the context + imperative handle depend on `close` staying
|
|
60
|
+
// referentially stable).
|
|
61
|
+
const isControlledRef = useRef(isControlled);
|
|
62
|
+
isControlledRef.current = isControlled;
|
|
63
|
+
const onCloseRef = useRef(onClose);
|
|
64
|
+
onCloseRef.current = onClose;
|
|
65
|
+
|
|
66
|
+
// Drain queued close callbacks atomically — capturing the list and resetting
|
|
67
|
+
// it before invocation ensures a callback that synchronously re-opens the
|
|
68
|
+
// dialog (and queues fresh callbacks) does not see the old ones replayed
|
|
69
|
+
// against the new session.
|
|
70
|
+
const callQueuedCallbacks = useCallback(() => {
|
|
71
|
+
const queued = closeCallbacks.current;
|
|
72
|
+
closeCallbacks.current = [];
|
|
73
|
+
for (const cb of queued) {
|
|
74
|
+
try {
|
|
75
|
+
cb();
|
|
76
|
+
} catch (e) {
|
|
77
|
+
if (typeof console !== 'undefined' && console.error) {
|
|
78
|
+
console.error('Dialog close callback error:', e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
83
|
+
const open = useCallback(() => {
|
|
84
|
+
ref.current?.present();
|
|
85
|
+
}, []);
|
|
86
|
+
|
|
87
|
+
// A dismissal request (backdrop, pan-to-close, action button). In controlled
|
|
88
|
+
// mode it asks the host to close via `onClose` (the host flips `open`); in
|
|
89
|
+
// imperative mode it dismisses the surface directly. The optional callback
|
|
90
|
+
// runs once the dialog has finished closing.
|
|
91
|
+
const close = useCallback(cb => {
|
|
92
|
+
if (typeof cb === 'function') {
|
|
93
|
+
closeCallbacks.current.push(cb);
|
|
94
|
+
}
|
|
95
|
+
if (isControlledRef.current) {
|
|
96
|
+
onCloseRef.current?.();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
ref.current?.dismiss();
|
|
100
|
+
}, []);
|
|
101
|
+
|
|
102
|
+
// Fired when the sheet has finished closing. Drains queued callbacks, then
|
|
103
|
+
// fires `onClose` ONLY in imperative mode — controlled mode already requested
|
|
104
|
+
// the close through `onClose` (the host then flipped `open`), so firing it
|
|
105
|
+
// again here would double-call it.
|
|
106
|
+
const handleDismiss = useCallback(() => {
|
|
107
|
+
callQueuedCallbacks();
|
|
108
|
+
if (!isControlledRef.current) onCloseRef.current?.();
|
|
109
|
+
}, [callQueuedCallbacks]);
|
|
110
|
+
|
|
111
|
+
// In controlled mode, mirror the `open` prop onto the underlying sheet so both
|
|
112
|
+
// modes share one lifecycle.
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!isControlled) return;
|
|
115
|
+
if (controlledOpen) {
|
|
116
|
+
ref.current?.present();
|
|
117
|
+
} else {
|
|
118
|
+
ref.current?.dismiss();
|
|
119
|
+
}
|
|
120
|
+
}, [isControlled, controlledOpen]);
|
|
121
|
+
useImperativeHandle(control?.ref, () => ({
|
|
122
|
+
open,
|
|
123
|
+
close
|
|
124
|
+
}), [open, close]);
|
|
125
|
+
const context = useMemo(() => ({
|
|
126
|
+
close,
|
|
127
|
+
isWithinDialog: true
|
|
128
|
+
}), [close]);
|
|
129
|
+
|
|
130
|
+
// Backdrop press → dismiss, unless the host disabled it. Returning `false`
|
|
131
|
+
// from `onDismissAttempt` blocks the BottomSheet's own backdrop/pan dismissal,
|
|
132
|
+
// which is how `dismissOnBackdrop: false` maps onto the single sheet API.
|
|
133
|
+
const onDismissAttempt = useCallback(() => dismissOnBackdrop, [dismissOnBackdrop]);
|
|
134
|
+
|
|
135
|
+
// `panelStyle` paints the sheet surface (e.g. a brand background). It composes
|
|
136
|
+
// AFTER the BottomSheet's internal background so a host palette wins; the
|
|
137
|
+
// shape (radius, max height) is supplied here and remains overridable.
|
|
138
|
+
const sheetStyle = useMemo(() => {
|
|
139
|
+
const maxHeightPercent = `${Math.round(maxHeightRatio * 100)}%`;
|
|
140
|
+
return [{
|
|
141
|
+
backgroundColor: theme.colors.background,
|
|
142
|
+
borderTopLeftRadius: PANEL_RADIUS + 4,
|
|
143
|
+
borderTopRightRadius: PANEL_RADIUS + 4,
|
|
144
|
+
maxHeight: maxHeightPercent
|
|
145
|
+
}, panelStyle];
|
|
146
|
+
}, [theme.colors.background, maxHeightRatio, panelStyle]);
|
|
147
|
+
|
|
148
|
+
// Does this dialog render bloom's declarative chrome (title / description /
|
|
149
|
+
// actions), or is it pure custom `children`? Pure custom children own their
|
|
150
|
+
// own layout and scrolling, so we render them through a NON-scrollable
|
|
151
|
+
// BottomSheet body — otherwise the sheet's internal ScrollView would wrap a
|
|
152
|
+
// child that already contains its own scroller, producing a scroll-in-scroll
|
|
153
|
+
// (double scroll container). Declarative dialogs are short and keep the
|
|
154
|
+
// sheet's default scrollable body so they degrade gracefully on small
|
|
155
|
+
// viewports. This only changes what `DialogBottomSheet` passes to
|
|
156
|
+
// `BottomSheet`; the standalone `BottomSheet` API and its `scrollable` default
|
|
157
|
+
// are unchanged for direct consumers.
|
|
158
|
+
const hasDeclarativeChrome = title !== undefined || description !== undefined || actions !== undefined && actions.length > 0;
|
|
159
|
+
return /*#__PURE__*/_jsx(BottomSheet, {
|
|
160
|
+
ref: ref,
|
|
161
|
+
onDismiss: handleDismiss,
|
|
162
|
+
onDismissAttempt: onDismissAttempt,
|
|
163
|
+
enablePanDownToClose: true,
|
|
164
|
+
showHandle: showHandle
|
|
165
|
+
// Pure custom children own scrolling → opt OUT of BottomSheet's internal
|
|
166
|
+
// ScrollView so there is exactly ONE scroll container (no scroll-in-scroll).
|
|
167
|
+
,
|
|
168
|
+
scrollable: hasDeclarativeChrome
|
|
169
|
+
// Stronger dim than a lone sheet so an underlying sheet's handle/content
|
|
170
|
+
// doesn't bleed through when a Dialog is stacked over one.
|
|
171
|
+
,
|
|
172
|
+
backdropOpacity: SHEET_BACKDROP_OPACITY + 0.3,
|
|
173
|
+
style: sheetStyle,
|
|
174
|
+
children: /*#__PURE__*/_jsx(Context.Provider, {
|
|
175
|
+
value: context,
|
|
176
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
177
|
+
testID: testID,
|
|
178
|
+
accessibilityLabel: label,
|
|
179
|
+
"aria-labelledby": title ? titleId : undefined,
|
|
180
|
+
"aria-describedby": description ? descriptionId : undefined,
|
|
181
|
+
...(containerClassName ? {
|
|
182
|
+
className: containerClassName
|
|
183
|
+
} : {}),
|
|
184
|
+
...(panelClassName ? {
|
|
185
|
+
className: panelClassName
|
|
186
|
+
} : {}),
|
|
187
|
+
style: [{
|
|
188
|
+
padding: contentPadding
|
|
189
|
+
},
|
|
190
|
+
// `containerStyle` carries the host's CSS-var theme scope; it wraps
|
|
191
|
+
// the content subtree so descendants read the scoped palette.
|
|
192
|
+
containerStyle, style, panelStyle],
|
|
193
|
+
children: /*#__PURE__*/_jsx(DialogBody, {
|
|
194
|
+
titleId: titleId,
|
|
195
|
+
descriptionId: descriptionId,
|
|
196
|
+
title: title,
|
|
197
|
+
description: description,
|
|
198
|
+
actions: actions,
|
|
199
|
+
children: children
|
|
200
|
+
})
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Props the shared bottom-sheet surface consumes — the `bottom`-relevant subset
|
|
208
|
+
* of `DialogProps`. `width`, `maxWidth`, and `inset` are placement-specific to
|
|
209
|
+
* the side/centered surfaces and intentionally excluded.
|
|
210
|
+
*/
|
|
211
|
+
//# sourceMappingURL=DialogBottomSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useId","useImperativeHandle","useMemo","useRef","View","BottomSheet","useTheme","Context","DialogBody","DEFAULT_DIALOG_CONTENT_PADDING","DEFAULT_MAX_HEIGHT_RATIO","PANEL_RADIUS","SHEET_BACKDROP_OPACITY","jsx","_jsx","DialogBottomSheet","control","open","controlledOpen","onClose","testID","title","description","actions","maxHeightRatio","showHandle","dismissOnBackdrop","contentPadding","style","panelStyle","panelClassName","containerStyle","containerClassName","label","children","isControlled","undefined","theme","ref","closeCallbacks","titleId","descriptionId","isControlledRef","current","onCloseRef","callQueuedCallbacks","queued","cb","e","console","error","present","close","push","dismiss","handleDismiss","context","isWithinDialog","onDismissAttempt","sheetStyle","maxHeightPercent","Math","round","backgroundColor","colors","background","borderTopLeftRadius","borderTopRightRadius","maxHeight","hasDeclarativeChrome","length","onDismiss","enablePanDownToClose","scrollable","backdropOpacity","Provider","value","accessibilityLabel","className","padding"],"sourceRoot":"../../../src","sources":["dialog/DialogBottomSheet.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,KAAK,EACLC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,SAASC,IAAI,QAAwC,cAAc;AAEnE,SAASC,WAAW,QAA6B,0BAAiB;AAClE,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,SAASC,OAAO,QAAQ,cAAW;AACnC,SAASC,UAAU,QAAQ,oBAAiB;AAC5C,SACEC,8BAA8B,EAC9BC,wBAAwB,EACxBC,YAAY,EACZC,sBAAsB,QACjB,gBAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAC;EAChCC,OAAO;EACPC,IAAI,EAAEC,cAAc;EACpBC,OAAO;EACPC,MAAM;EACNC,KAAK;EACLC,WAAW;EACXC,OAAO;EACPC,cAAc,GAAGd,wBAAwB;EACzCe,UAAU,GAAG,IAAI;EACjBC,iBAAiB,GAAG,IAAI;EACxBC,cAAc,GAAGlB,8BAA8B;EAC/CmB,KAAK;EACLC,UAAU;EACVC,cAAc;EACdC,cAAc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Ae,CAAC,GAA8B,CAAC,CAAC;QACpFF,KAAK,EAAE,CACL;UAAEmD,OAAO,EAAEpD;QAAe,CAAC;QAC3B;QACA;QACAI,cAAc,EACdH,KAAK,EACLC,UAAU,CACV;QAAAK,QAAA,eAEFpB,IAAA,CAACN,UAAU;UACTgC,OAAO,EAAEA,OAAQ;UACjBC,aAAa,EAAEA,aAAc;UAC7BpB,KAAK,EAAEA,KAAM;UACbC,WAAW,EAAEA,WAAY;UACzBC,OAAO,EAAEA,OAAQ;UAAAW,QAAA,EAEhBA;QAAQ,CACC;MAAC,CACT;IAAC,CACS;EAAC,CACR,CAAC;AAElB;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
import { Text, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import { useTheme } from "../theme/use-theme.js";
|
|
6
|
+
import { useDialogContext } from "./context.js";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* Shared dialog content primitives used by every `<Dialog>` placement on both
|
|
10
|
+
* platforms — the centered panel, the side-sheets, and the `BottomSheet`-backed
|
|
11
|
+
* bottom placement. Keeping them here is the single source of truth for the
|
|
12
|
+
* declarative `title` / `description` / `actions` chrome, so the surfaces never
|
|
13
|
+
* drift in spacing, typography, or action-button behaviour.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Renders the dialog's body: optional declarative title + description, any
|
|
18
|
+
* `children`, then the action row. The `titleId`/`descriptionId` are wired by
|
|
19
|
+
* the caller onto the dialog role element for `aria-labelledby` /
|
|
20
|
+
* `aria-describedby`.
|
|
21
|
+
*/
|
|
22
|
+
export function DialogBody({
|
|
23
|
+
titleId,
|
|
24
|
+
descriptionId,
|
|
25
|
+
title,
|
|
26
|
+
description,
|
|
27
|
+
actions,
|
|
28
|
+
children
|
|
29
|
+
}) {
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
32
|
+
children: [title ? /*#__PURE__*/_jsx(Text, {
|
|
33
|
+
nativeID: titleId,
|
|
34
|
+
style: {
|
|
35
|
+
fontSize: 22,
|
|
36
|
+
fontWeight: '600',
|
|
37
|
+
color: theme.colors.text,
|
|
38
|
+
paddingBottom: description ? 4 : 16,
|
|
39
|
+
lineHeight: 30
|
|
40
|
+
},
|
|
41
|
+
children: title
|
|
42
|
+
}) : null, description ? /*#__PURE__*/_jsx(Text, {
|
|
43
|
+
nativeID: descriptionId,
|
|
44
|
+
style: {
|
|
45
|
+
fontSize: 16,
|
|
46
|
+
color: theme.colors.textSecondary,
|
|
47
|
+
paddingBottom: 16,
|
|
48
|
+
lineHeight: 22
|
|
49
|
+
},
|
|
50
|
+
children: description
|
|
51
|
+
}) : null, children, actions && actions.length > 0 ? /*#__PURE__*/_jsx(ActionRow, {
|
|
52
|
+
actions: actions
|
|
53
|
+
}) : null]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export function ActionRow({
|
|
57
|
+
actions
|
|
58
|
+
}) {
|
|
59
|
+
return /*#__PURE__*/_jsx(View, {
|
|
60
|
+
style: {
|
|
61
|
+
width: '100%',
|
|
62
|
+
gap: 8,
|
|
63
|
+
justifyContent: 'flex-end'
|
|
64
|
+
},
|
|
65
|
+
children: actions.map((action, idx) => /*#__PURE__*/_jsx(ActionButton, {
|
|
66
|
+
action: action
|
|
67
|
+
}, `${action.label}-${idx}`))
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function ActionButton({
|
|
71
|
+
action
|
|
72
|
+
}) {
|
|
73
|
+
const {
|
|
74
|
+
close
|
|
75
|
+
} = useDialogContext();
|
|
76
|
+
const theme = useTheme();
|
|
77
|
+
const color = action.color ?? 'default';
|
|
78
|
+
const shouldCloseOnPress = action.shouldCloseOnPress ?? true;
|
|
79
|
+
const {
|
|
80
|
+
background,
|
|
81
|
+
foreground
|
|
82
|
+
} = getActionPalette(color, theme.colors);
|
|
83
|
+
const handlePress = useCallback(e => {
|
|
84
|
+
const onPress = action.onPress;
|
|
85
|
+
if (color === 'cancel') {
|
|
86
|
+
// Cancel always dismisses; consumer's onPress (rare) runs after.
|
|
87
|
+
close(onPress ? () => onPress(e) : undefined);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (shouldCloseOnPress) {
|
|
91
|
+
close(onPress ? () => onPress(e) : undefined);
|
|
92
|
+
} else {
|
|
93
|
+
onPress?.(e);
|
|
94
|
+
}
|
|
95
|
+
}, [action.onPress, close, color, shouldCloseOnPress]);
|
|
96
|
+
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
97
|
+
style: {
|
|
98
|
+
borderRadius: 9999,
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
backgroundColor: background,
|
|
102
|
+
opacity: action.disabled ? 0.5 : 1,
|
|
103
|
+
paddingVertical: 12,
|
|
104
|
+
paddingHorizontal: 24
|
|
105
|
+
},
|
|
106
|
+
onPress: handlePress,
|
|
107
|
+
disabled: action.disabled,
|
|
108
|
+
activeOpacity: 0.7,
|
|
109
|
+
testID: action.testID,
|
|
110
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
111
|
+
style: {
|
|
112
|
+
fontSize: 16,
|
|
113
|
+
fontWeight: '500',
|
|
114
|
+
color: foreground
|
|
115
|
+
},
|
|
116
|
+
children: action.label
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export function getActionPalette(color, colors) {
|
|
121
|
+
switch (color) {
|
|
122
|
+
case 'destructive':
|
|
123
|
+
return {
|
|
124
|
+
background: colors.negative,
|
|
125
|
+
foreground: colors.negativeForeground
|
|
126
|
+
};
|
|
127
|
+
case 'cancel':
|
|
128
|
+
return {
|
|
129
|
+
background: colors.contrast50,
|
|
130
|
+
foreground: colors.text
|
|
131
|
+
};
|
|
132
|
+
case 'default':
|
|
133
|
+
return {
|
|
134
|
+
background: colors.primary,
|
|
135
|
+
foreground: colors.primaryForeground
|
|
136
|
+
};
|
|
137
|
+
/* c8 ignore next 3 -- TS exhaustiveness check guards this branch */
|
|
138
|
+
default:
|
|
139
|
+
{
|
|
140
|
+
const _exhaustive = color;
|
|
141
|
+
return {
|
|
142
|
+
background: colors.primary,
|
|
143
|
+
foreground: colors.primaryForeground
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=DialogContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","Text","TouchableOpacity","View","useTheme","useDialogContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DialogBody","titleId","descriptionId","title","description","actions","children","theme","nativeID","style","fontSize","fontWeight","color","colors","text","paddingBottom","lineHeight","textSecondary","length","ActionRow","width","gap","justifyContent","map","action","idx","ActionButton","label","close","shouldCloseOnPress","background","foreground","getActionPalette","handlePress","e","onPress","undefined","borderRadius","alignItems","backgroundColor","opacity","disabled","paddingVertical","paddingHorizontal","activeOpacity","testID","negative","negativeForeground","contrast50","primary","primaryForeground","_exhaustive"],"sourceRoot":"../../../src","sources":["dialog/DialogContent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SACEC,IAAI,EACJC,gBAAgB,EAChBC,IAAI,QAEC,cAAc;AAGrB,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,SAASC,gBAAgB,QAAQ,cAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAG7C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAC;EACzBC,OAA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AiB,EAAE;IACrB,CAAE;IACFR,OAAO,EAAEF,WAAY;IACrBQ,QAAQ,EAAEjB,MAAM,CAACiB,QAAS;IAC1BG,aAAa,EAAE,GAAI;IACnBC,MAAM,EAAErB,MAAM,CAACqB,MAAO;IAAAvC,QAAA,eAEtBX,IAAA,CAACN,IAAI;MAACoB,KAAK,EAAE;QAAEC,QAAQ,EAAE,EAAE;QAAEC,UAAU,EAAE,KAAK;QAAEC,KAAK,EAAEmB;MAAW,CAAE;MAAAzB,QAAA,EACjEkB,MAAM,CAACG;IAAK,CACT;EAAC,CACS,CAAC;AAEvB;AAEA,OAAO,SAASK,gBAAgBA,CAC9BpB,KAAwB,EACxBC,MAAmB,EACyB;EAC5C,QAAQD,KAAK;IACX,KAAK,aAAa;MAChB,OAAO;QACLkB,UAAU,EAAEjB,MAAM,CAACiC,QAAQ;QAC3Bf,UAAU,EAAElB,MAAM,CAACkC;MACrB,CAAC;IACH,KAAK,QAAQ;MACX,OAAO;QAAEjB,UAAU,EAAEjB,MAAM,CAACmC,UAAU;QAAEjB,UAAU,EAAElB,MAAM,CAACC;MAAK,CAAC;IACnE,KAAK,SAAS;MACZ,OAAO;QAAEgB,UAAU,EAAEjB,MAAM,CAACoC,OAAO;QAAElB,UAAU,EAAElB,MAAM,CAACqC;MAAkB,CAAC;IAC7E;IACA;MAAS;QACP,MAAMC,WAAkB,GAAGvC,KAAK;QAChC,OAAO;UAAEkB,UAAU,EAAEjB,MAAM,CAACoC,OAAO;UAAElB,UAAU,EAAElB,MAAM,CAACqC;QAAkB,CAAC;MAC7E;EACF;AACF","ignoreList":[]}
|
|
@@ -47,6 +47,17 @@ export const DEFAULT_MAX_HEIGHT_RATIO = 0.9;
|
|
|
47
47
|
/** Corner radius shared by the side-sheet panel and the bottom-sheet top. */
|
|
48
48
|
export const PANEL_RADIUS = 20;
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Default inner padding (px) of the dialog content container, applied uniformly
|
|
52
|
+
* across every placement (centered panel, side-sheet body, bottom-sheet body)
|
|
53
|
+
* so the chrome reads identically regardless of which surface resolves. This is
|
|
54
|
+
* the legacy value — omitting the `contentPadding` prop keeps 20px everywhere,
|
|
55
|
+
* byte-for-byte unchanged. A host that owns its own insets (e.g. custom
|
|
56
|
+
* `children` that already manage padding) can override it via
|
|
57
|
+
* `Dialog`'s `contentPadding` prop (e.g. `contentPadding={0}`).
|
|
58
|
+
*/
|
|
59
|
+
export const DEFAULT_DIALOG_CONTENT_PADDING = 20;
|
|
60
|
+
|
|
50
61
|
/** Open/close transition duration (ms). ~280ms ease-out reads smooth. */
|
|
51
62
|
export const ANIMATION_DURATION = 280;
|
|
52
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","useWindowDimensions","BREAKPOINT_SM","BREAKPOINT_MD","BREAKPOINT_LG","BREAKPOINT_XL","RESPONSIVE_KEYS","DEFAULT_SIDE_WIDTH","DEFAULT_CENTER_MAX_WIDTH","DEFAULT_MAX_HEIGHT_RATIO","PANEL_RADIUS","ANIMATION_DURATION","CENTER_FADE_OUT_DURATION","EASE_OUT","SHEET_BACKDROP_OPACITY","DIALOG_SHEET_BACKDROP_TESTID","HANDLE_WIDTH","HANDLE_HEIGHT","HANDLE_RADIUS","SIDE_SHEET_MIN_GUTTER","useResolvedPlacement","placement","width","undefined","key","minWidth","value","base"],"sourceRoot":"../../../src","sources":["dialog/placement.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAG,GAAG;AAChC,OAAO,MAAMC,aAAa,GAAG,GAAG;AAChC,OAAO,MAAMC,aAAa,GAAG,IAAI;AACjC,OAAO,MAAMC,aAAa,GAAG,IAAI;;AAEjC;AACA,MAAMC,eAAe,GAAG,CACtB,CAAC,IAAI,EAAED,aAAa,CAAC,EACrB,CAAC,IAAI,EAAED,aAAa,CAAC,EACrB,CAAC,IAAI,EAAED,aAAa,CAAC,EACrB,CAAC,IAAI,EAAED,aAAa,CAAC,CACb;;AAEV;AACA,OAAO,MAAMK,kBAAkB,GAAG,GAAG;;AAErC;AACA,OAAO,MAAMC,wBAAwB,GAAG,GAAG;;AAE3C;AACA,OAAO,MAAMC,wBAAwB,GAAG,GAAG;;AAE3C;AACA,OAAO,MAAMC,YAAY,GAAG,EAAE;;AAE9B;AACA,OAAO,MAAMC,kBAAkB,GAAG,GAAG;;AAErC;AACA,OAAO,MAAMC,wBAAwB,GAAG,GAAG;;AAE3C;AACA,OAAO,MAAMC,QAAQ,GAAG,gCAAgC;;AAExD;AACA,OAAO,MAAMC,sBAAsB,GAAG,GAAG;;AAEzC;AACA,OAAO,MAAMC,4BAA4B,GAAG,6BAA6B;;AAEzE;AACA,OAAO,MAAMC,YAAY,GAAG,EAAE;AAC9B,OAAO,MAAMC,aAAa,GAAG,CAAC;AAC9B,OAAO,MAAMC,aAAa,GAAG,CAAC;;AAE9B;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAG,EAAE;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,SAAgD,EAC/B;EACjB,MAAM;IAAEC;EAAM,CAAC,
|
|
1
|
+
{"version":3,"names":["useMemo","useWindowDimensions","BREAKPOINT_SM","BREAKPOINT_MD","BREAKPOINT_LG","BREAKPOINT_XL","RESPONSIVE_KEYS","DEFAULT_SIDE_WIDTH","DEFAULT_CENTER_MAX_WIDTH","DEFAULT_MAX_HEIGHT_RATIO","PANEL_RADIUS","DEFAULT_DIALOG_CONTENT_PADDING","ANIMATION_DURATION","CENTER_FADE_OUT_DURATION","EASE_OUT","SHEET_BACKDROP_OPACITY","DIALOG_SHEET_BACKDROP_TESTID","HANDLE_WIDTH","HANDLE_HEIGHT","HANDLE_RADIUS","SIDE_SHEET_MIN_GUTTER","useResolvedPlacement","placement","width","undefined","key","minWidth","value","base"],"sourceRoot":"../../../src","sources":["dialog/placement.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAG,GAAG;AAChC,OAAO,MAAMC,aAAa,GAAG,GAAG;AAChC,OAAO,MAAMC,aAAa,GAAG,IAAI;AACjC,OAAO,MAAMC,aAAa,GAAG,IAAI;;AAEjC;AACA,MAAMC,eAAe,GAAG,CACtB,CAAC,IAAI,EAAED,aAAa,CAAC,EACrB,CAAC,IAAI,EAAED,aAAa,CAAC,EACrB,CAAC,IAAI,EAAED,aAAa,CAAC,EACrB,CAAC,IAAI,EAAED,aAAa,CAAC,CACb;;AAEV;AACA,OAAO,MAAMK,kBAAkB,GAAG,GAAG;;AAErC;AACA,OAAO,MAAMC,wBAAwB,GAAG,GAAG;;AAE3C;AACA,OAAO,MAAMC,wBAAwB,GAAG,GAAG;;AAE3C;AACA,OAAO,MAAMC,YAAY,GAAG,EAAE;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,8BAA8B,GAAG,EAAE;;AAEhD;AACA,OAAO,MAAMC,kBAAkB,GAAG,GAAG;;AAErC;AACA,OAAO,MAAMC,wBAAwB,GAAG,GAAG;;AAE3C;AACA,OAAO,MAAMC,QAAQ,GAAG,gCAAgC;;AAExD;AACA,OAAO,MAAMC,sBAAsB,GAAG,GAAG;;AAEzC;AACA,OAAO,MAAMC,4BAA4B,GAAG,6BAA6B;;AAEzE;AACA,OAAO,MAAMC,YAAY,GAAG,EAAE;AAC9B,OAAO,MAAMC,aAAa,GAAG,CAAC;AAC9B,OAAO,MAAMC,aAAa,GAAG,CAAC;;AAE9B;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAG,EAAE;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,SAAgD,EAC/B;EACjB,MAAM;IAAEC;EAAM,CAAC,GAAGtB,mBAAmB,CAAC,CAAC;EAEvC,OAAOD,OAAO,CAAkB,MAAM;IACpC,IAAIsB,SAAS,KAAKE,SAAS,EAAE,OAAO,QAAQ;IAC5C,IAAI,OAAOF,SAAS,KAAK,QAAQ,EAAE,OAAOA,SAAS;IACnD,KAAK,MAAM,CAACG,GAAG,EAAEC,QAAQ,CAAC,IAAIpB,eAAe,EAAE;MAC7C,IAAIiB,KAAK,IAAIG,QAAQ,EAAE;QACrB,MAAMC,KAAK,GAAGL,SAAS,CAACG,GAAG,CAAC;QAC5B,IAAIE,KAAK,KAAKH,SAAS,EAAE,OAAOG,KAAK;MACvC;IACF;IACA,OAAOL,SAAS,CAACM,IAAI;EACvB,CAAC,EAAE,CAACN,SAAS,EAAEC,KAAK,CAAC,CAAC;AACxB","ignoreList":[]}
|
|
@@ -22,7 +22,7 @@ export { DIALOG_SHEET_BACKDROP_TESTID };
|
|
|
22
22
|
* 2. Custom children — caller passes JSX, bloom renders the chrome.
|
|
23
23
|
* 3. Pure children — no `title`/`description`/`actions`.
|
|
24
24
|
*/
|
|
25
|
-
export declare function Dialog({
|
|
25
|
+
export declare function Dialog({ placement, ...rest }: DialogProps): import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
/**
|
|
27
27
|
* Helper used by the imperative `alert()` API. Mounts a `<Dialog>` against
|
|
28
28
|
* a fresh control and presents it immediately. `onResolve` is invoked
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAIL,4BAA4B,EAK7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,YAAY,EAGZ,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,WAAW,2CAab;AAqZD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,2CAoBA"}
|
|
@@ -4,9 +4,10 @@ import type { DialogAction, DialogProps } from './types';
|
|
|
4
4
|
* Web variant of `<Dialog>`.
|
|
5
5
|
*
|
|
6
6
|
* A centered modal card (default) rendered into the bloom Portal at the end of
|
|
7
|
-
* `document.body`,
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `document.body`, an anchored side-sheet for `left`/`right`, or — for
|
|
8
|
+
* `bottom` — bloom's cross-platform `BottomSheet` (the SAME component native
|
|
9
|
+
* uses), so the bottom placement drags-to-dismiss on web too. Same prop API as
|
|
10
|
+
* native, so call sites are platform agnostic.
|
|
10
11
|
*
|
|
11
12
|
* Open/close is driven by EITHER the imperative `control` (legacy) OR the
|
|
12
13
|
* controlled `open` prop. When `open` is provided it wins.
|
|
@@ -18,10 +19,11 @@ import type { DialogAction, DialogProps } from './types';
|
|
|
18
19
|
*
|
|
19
20
|
* Web motion never uses reanimated `exiting` (which throws `removeChild` on
|
|
20
21
|
* concurrent React unmounts): the centered card uses CSS keyframes and the
|
|
21
|
-
* side
|
|
22
|
-
*
|
|
22
|
+
* side modes use self-contained CSS transitions on a mounted-through-exit
|
|
23
|
+
* node. The bottom placement animates via `BottomSheet`'s shared-value/gesture
|
|
24
|
+
* animation (no `exiting` layout animation).
|
|
23
25
|
*/
|
|
24
|
-
export declare function Dialog({
|
|
26
|
+
export declare function Dialog({ placement, ...rest }: DialogProps): import("react/jsx-runtime").JSX.Element;
|
|
25
27
|
export { DIALOG_SHEET_BACKDROP_TESTID };
|
|
26
28
|
/**
|
|
27
29
|
* Inline imperative dialog used by `alert()`. Mounts and immediately
|
|
@@ -45,8 +47,9 @@ export declare function AutoMountedDialog({ title, description, actions, onResol
|
|
|
45
47
|
* @keyframes bloomDialogZoomFadeOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95); } }
|
|
46
48
|
* ```
|
|
47
49
|
*
|
|
48
|
-
* The `left`/`right
|
|
49
|
-
*
|
|
50
|
+
* The `left`/`right` placements do NOT depend on this — they animate via
|
|
51
|
+
* self-contained inline CSS transitions and need no keyframe injection. The
|
|
52
|
+
* `bottom` placement uses bloom's `BottomSheet` (reanimated) and needs none.
|
|
50
53
|
*/
|
|
51
54
|
export declare const BLOOM_DIALOG_CSS = "\n@keyframes bloomDialogFadeIn { from { opacity: 0; } to { opacity: 1; } }\n@keyframes bloomDialogFadeOut { from { opacity: 1; } to { opacity: 0; } }\n@keyframes bloomDialogZoomFadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }\n@keyframes bloomDialogZoomFadeOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95); } }\n";
|
|
52
55
|
//# sourceMappingURL=Dialog.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.web.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.web.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.web.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAML,4BAA4B,EAM7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,YAAY,EAGZ,WAAW,EACZ,MAAM,SAAS,CAAC;AASjB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,2CAazD;AAoSD,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAqNxC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,2CAgBA;AA6BD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,mZAK5B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DialogProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Shared `BottomSheet`-backed surface for the `bottom` placement, used by BOTH
|
|
4
|
+
* `Dialog.tsx` (native) and `Dialog.web.tsx` (web). `BottomSheet` is itself a
|
|
5
|
+
* single cross-platform implementation (react-native-gesture-handler +
|
|
6
|
+
* reanimated, drag-to-dismiss on web and native alike), so routing the bottom
|
|
7
|
+
* placement through here gives ONE code path with drag working everywhere — no
|
|
8
|
+
* duplicated CSS slide-up sheet.
|
|
9
|
+
*
|
|
10
|
+
* This component owns the entire open↔present/dismiss bridge and the Dialog →
|
|
11
|
+
* BottomSheet prop mapping in one place:
|
|
12
|
+
*
|
|
13
|
+
* - `open` (controlled) / `control` (imperative) → `present()` / `dismiss()`
|
|
14
|
+
* - `onClose` → fired once the sheet settles
|
|
15
|
+
* - `maxHeightRatio` → sheet `maxHeight`
|
|
16
|
+
* - `showHandle` / `dismissOnBackdrop` / `label` → forwarded to the surface
|
|
17
|
+
* - `panelStyle` → paints the sheet surface
|
|
18
|
+
* - `containerStyle` → wraps the content subtree
|
|
19
|
+
* so a host's CSS-var theme scope (`vars()`) still applies to descendants
|
|
20
|
+
* - `title` / `description` / `actions` / `children` → declarative body
|
|
21
|
+
*/
|
|
22
|
+
export declare function DialogBottomSheet({ control, open: controlledOpen, onClose, testID, title, description, actions, maxHeightRatio, showHandle, dismissOnBackdrop, contentPadding, style, panelStyle, panelClassName, containerStyle, containerClassName, label, children, }: DialogBottomSheetProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Props the shared bottom-sheet surface consumes — the `bottom`-relevant subset
|
|
25
|
+
* of `DialogProps`. `width`, `maxWidth`, and `inset` are placement-specific to
|
|
26
|
+
* the side/centered surfaces and intentionally excluded.
|
|
27
|
+
*/
|
|
28
|
+
export type DialogBottomSheetProps = Pick<DialogProps, 'control' | 'open' | 'onClose' | 'testID' | 'title' | 'description' | 'actions' | 'maxHeightRatio' | 'showHandle' | 'dismissOnBackdrop' | 'contentPadding' | 'style' | 'panelStyle' | 'panelClassName' | 'containerStyle' | 'containerClassName' | 'label' | 'children'>;
|
|
29
|
+
//# sourceMappingURL=DialogBottomSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogBottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/dialog/DialogBottomSheet.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAsB,WAAW,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,IAAI,EAAE,cAAc,EACpB,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,OAAO,EACP,cAAyC,EACzC,UAAiB,EACjB,iBAAwB,EACxB,cAA+C,EAC/C,KAAK,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,QAAQ,GACT,EAAE,sBAAsB,2CAiKxB;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,WAAW,EACT,SAAS,GACT,MAAM,GACN,SAAS,GACT,QAAQ,GACR,OAAO,GACP,aAAa,GACb,SAAS,GACT,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,gBAAgB,GAChB,OAAO,GACP,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,oBAAoB,GACpB,OAAO,GACP,UAAU,CACb,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ThemeColors } from '../theme/types';
|
|
3
|
+
import type { DialogAction, DialogActionColor } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Shared dialog content primitives used by every `<Dialog>` placement on both
|
|
6
|
+
* platforms — the centered panel, the side-sheets, and the `BottomSheet`-backed
|
|
7
|
+
* bottom placement. Keeping them here is the single source of truth for the
|
|
8
|
+
* declarative `title` / `description` / `actions` chrome, so the surfaces never
|
|
9
|
+
* drift in spacing, typography, or action-button behaviour.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Renders the dialog's body: optional declarative title + description, any
|
|
13
|
+
* `children`, then the action row. The `titleId`/`descriptionId` are wired by
|
|
14
|
+
* the caller onto the dialog role element for `aria-labelledby` /
|
|
15
|
+
* `aria-describedby`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function DialogBody({ titleId, descriptionId, title, description, actions, children, }: {
|
|
18
|
+
titleId: string;
|
|
19
|
+
descriptionId: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
actions?: DialogAction[];
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function ActionRow({ actions }: {
|
|
26
|
+
actions: DialogAction[];
|
|
27
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function getActionPalette(color: DialogActionColor, colors: ThemeColors): {
|
|
29
|
+
background: string;
|
|
30
|
+
foreground: string;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=DialogContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogContent.d.ts","sourceRoot":"","sources":["../../../../src/dialog/DialogContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAQ3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;GAMG;AAEH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,aAAa,EACb,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,2CAmCA;AAED,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,YAAY,EAAE,CAAA;CAAE,2CAQjE;AAkDD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,WAAW,GAClB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAiB5C"}
|
|
@@ -40,6 +40,16 @@ export declare const DEFAULT_CENTER_MAX_WIDTH = 480;
|
|
|
40
40
|
export declare const DEFAULT_MAX_HEIGHT_RATIO = 0.9;
|
|
41
41
|
/** Corner radius shared by the side-sheet panel and the bottom-sheet top. */
|
|
42
42
|
export declare const PANEL_RADIUS = 20;
|
|
43
|
+
/**
|
|
44
|
+
* Default inner padding (px) of the dialog content container, applied uniformly
|
|
45
|
+
* across every placement (centered panel, side-sheet body, bottom-sheet body)
|
|
46
|
+
* so the chrome reads identically regardless of which surface resolves. This is
|
|
47
|
+
* the legacy value — omitting the `contentPadding` prop keeps 20px everywhere,
|
|
48
|
+
* byte-for-byte unchanged. A host that owns its own insets (e.g. custom
|
|
49
|
+
* `children` that already manage padding) can override it via
|
|
50
|
+
* `Dialog`'s `contentPadding` prop (e.g. `contentPadding={0}`).
|
|
51
|
+
*/
|
|
52
|
+
export declare const DEFAULT_DIALOG_CONTENT_PADDING = 20;
|
|
43
53
|
/** Open/close transition duration (ms). ~280ms ease-out reads smooth. */
|
|
44
54
|
export declare const ANIMATION_DURATION = 280;
|
|
45
55
|
/** Centered-card fade-out duration (ms) — preserves the legacy timing. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement.d.ts","sourceRoot":"","sources":["../../../../src/dialog/placement.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErE;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GACjC,eAAe,GACf;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,EAAE,CAAC,EAAE,eAAe,CAAC;CACtB,CAAC;AAEN;;;;GAIG;AACH,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,OAAO,CAAC;AAUlC,qDAAqD;AACrD,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,gF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eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,OAAO,CAAC;AAUlC,qDAAqD;AACrD,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,gFAAgF;AAChF,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,6EAA6E;AAC7E,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD,yEAAyE;AACzE,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,oEAAoE;AACpE,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AAEzD,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B,gCAAgC,CAAC;AAE1E,sDAAsD;AACtD,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,yBAAyB,GAAG,SAAS,GAC/C,eAAe,CAcjB"}
|
|
@@ -125,6 +125,18 @@ export type DialogProps = React.PropsWithChildren<{
|
|
|
125
125
|
inset?: DialogInset;
|
|
126
126
|
/** Whether to render the drag handle in bottom-sheet mode. Defaults to `true`. */
|
|
127
127
|
showHandle?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Inner padding (px) of the dialog content container, applied uniformly across
|
|
130
|
+
* every placement (centered panel, side-sheet body, bottom-sheet body).
|
|
131
|
+
* Defaults to `20`.
|
|
132
|
+
*
|
|
133
|
+
* The default chrome padding is correct for the declarative
|
|
134
|
+
* `title`/`description`/`actions` layout, but a host passing pure custom
|
|
135
|
+
* `children` that already own their insets can set `contentPadding={0}` to
|
|
136
|
+
* render flush content and manage padding itself. Omitting the prop keeps the
|
|
137
|
+
* 20px default on every surface.
|
|
138
|
+
*/
|
|
139
|
+
contentPadding?: number;
|
|
128
140
|
/** Whether tapping the backdrop dismisses the dialog. Defaults to `true`. */
|
|
129
141
|
dismissOnBackdrop?: boolean;
|
|
130
142
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/dialog/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D,YAAY,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,GAAG;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,cAAc,EAAE,OA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M,CAAC;IACxB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,kFAAkF;IAClF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,mEAAmE;IACnE,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,4EAA4E;IAC5E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC"}
|
|
@@ -22,7 +22,7 @@ export { DIALOG_SHEET_BACKDROP_TESTID };
|
|
|
22
22
|
* 2. Custom children — caller passes JSX, bloom renders the chrome.
|
|
23
23
|
* 3. Pure children — no `title`/`description`/`actions`.
|
|
24
24
|
*/
|
|
25
|
-
export declare function Dialog({
|
|
25
|
+
export declare function Dialog({ placement, ...rest }: DialogProps): import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
/**
|
|
27
27
|
* Helper used by the imperative `alert()` API. Mounts a `<Dialog>` against
|
|
28
28
|
* a fresh control and presents it immediately. `onResolve` is invoked
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAIL,4BAA4B,EAK7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,YAAY,EAGZ,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,GAAG,IAAI,EACR,EAAE,WAAW,2CAab;AAqZD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,2CAoBA"}
|