@astryxdesign/lab 0.4.1-canary.fb0b7a9 → 0.4.2-canary.356d2f9
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/dist/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +5 -11
- package/dist/BottomSheet/BottomSheetPanel.d.ts +2 -3
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +11 -6
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts +2 -2
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +3 -3
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.d.ts.map +1 -1
- package/dist/BottomSheet/index.js +2 -1
- package/dist/BottomSheet/snapOffsets.d.ts +5 -5
- package/dist/BottomSheet/snapOffsets.d.ts.map +1 -1
- package/dist/BottomSheet/useMobileKeyboard.d.ts +8 -9
- package/dist/BottomSheet/useMobileKeyboard.d.ts.map +1 -1
- package/dist/BottomSheet/useMobileKeyboard.js +139 -130
- package/dist/BottomSheet/useSheetGestures.js +6 -6
- package/dist/ListInput/ListInput.d.ts.map +1 -1
- package/dist/ListInput/ListInput.js +76 -29
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lab.css +0 -1
- package/package.json +6 -5
- package/src/BottomSheet/BottomSheet.doc.mjs +41 -63
- package/src/BottomSheet/BottomSheet.test.tsx +510 -202
- package/src/BottomSheet/BottomSheet.tsx +2 -8
- package/src/BottomSheet/BottomSheetPanel.test.tsx +2 -2
- package/src/BottomSheet/BottomSheetPanel.tsx +14 -8
- package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +21 -54
- package/src/BottomSheet/BottomSheetSwitcher.test.tsx +11 -22
- package/src/BottomSheet/BottomSheetSwitcher.tsx +7 -11
- package/src/BottomSheet/index.ts +3 -1
- package/src/BottomSheet/snapOffsets.ts +5 -5
- package/src/BottomSheet/useMobileKeyboard.ts +201 -166
- package/src/BottomSheet/useSheetGestures.test.ts +3 -3
- package/src/BottomSheet/useSheetGestures.ts +6 -6
- package/src/ListInput/ListInput.test.tsx +48 -22
- package/src/ListInput/ListInput.tsx +76 -34
- package/src/TransferList/TransferList.doc.mjs +2 -2
- package/src/index.ts +1 -0
- package/src/BottomSheet/useSheetGestures.doc.mjs +0 -32
|
@@ -29,7 +29,7 @@ interface BottomSheetSharedProps extends BaseProps<HTMLDivElement> {
|
|
|
29
29
|
label: string;
|
|
30
30
|
/** Sheet content, rendered below the grab handle in a scrollable area. */
|
|
31
31
|
children: ReactNode;
|
|
32
|
-
/** Height budget or custom CSS length. @default 'capped' */
|
|
32
|
+
/** Height budget or custom CSS length. Only fully expanded Tall is keyboard-aware. @default 'capped' */
|
|
33
33
|
height?: BottomSheetHeight | number | string;
|
|
34
34
|
}
|
|
35
35
|
interface StandaloneBottomSheetProps extends BottomSheetSharedProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAkBlD,YAAY,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAkBlD,YAAY,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AA2D1D,UAAU,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,qDAAqD;IACrD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IAEd,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,CAAC;IAEpB,wGAAwG;IACxG,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC9C;AAED,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,UAAU,wBAAyB,SAAQ,sBAAsB;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAC1B,0BAA0B,GAAG,wBAAwB,CAAC;AAwUxD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA6BlD;yBA7Be,WAAW"}
|
|
@@ -84,7 +84,6 @@ function StandaloneBottomSheet({
|
|
|
84
84
|
...props
|
|
85
85
|
}) {
|
|
86
86
|
const dialogRef = useRef(null);
|
|
87
|
-
const positionerRef = useRef(null);
|
|
88
87
|
const panelRef = useRef(null);
|
|
89
88
|
const triggerRef = useRef(null);
|
|
90
89
|
const [isPresented, setIsPresented] = useState(isOpen);
|
|
@@ -192,9 +191,8 @@ function StandaloneBottomSheet({
|
|
|
192
191
|
onClick: handleClick,
|
|
193
192
|
onKeyDown: handleKeyDown,
|
|
194
193
|
children: /*#__PURE__*/_jsx("div", {
|
|
195
|
-
ref: positionerRef,
|
|
196
194
|
...{
|
|
197
|
-
className: "x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl
|
|
195
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl"
|
|
198
196
|
},
|
|
199
197
|
children: /*#__PURE__*/_jsx(BottomSheetPanel, {
|
|
200
198
|
...props,
|
|
@@ -204,7 +202,6 @@ function StandaloneBottomSheet({
|
|
|
204
202
|
xstyle: xstyle,
|
|
205
203
|
onDismiss: close,
|
|
206
204
|
onScrimOpacity: handleScrimOpacity,
|
|
207
|
-
positionerRef: positionerRef,
|
|
208
205
|
onElementChange: handlePanelElementChange,
|
|
209
206
|
onMotionComplete: handleMotionComplete,
|
|
210
207
|
children: children
|
|
@@ -242,7 +239,6 @@ function SwitcherBottomSheetItem({
|
|
|
242
239
|
const isInactive = phase === 'covered' || phase === 'aligning' || phase === 'fading' || phase === 'exiting';
|
|
243
240
|
const isPresented = phase !== 'hidden';
|
|
244
241
|
const isTopSheet = phase === 'active' || phase === 'entering';
|
|
245
|
-
const positionerRef = useRef(null);
|
|
246
242
|
const panelRef = useRef(null);
|
|
247
243
|
const previousPhaseRef = useRef(phase);
|
|
248
244
|
const previousPhase = previousPhaseRef.current;
|
|
@@ -299,19 +295,18 @@ function SwitcherBottomSheetItem({
|
|
|
299
295
|
}, [hasScrim, isInteractive, phase, previousPhase]);
|
|
300
296
|
useDevWarning('BottomSheet', 'requires a non-empty `label` for an accessible name; the open sheet ' + 'has no built-in heading to derive one from.', isInteractive && !label);
|
|
301
297
|
return /*#__PURE__*/_jsx("div", {
|
|
302
|
-
ref: positionerRef,
|
|
303
298
|
...{
|
|
304
299
|
0: {
|
|
305
|
-
className: "x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl
|
|
300
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl"
|
|
306
301
|
},
|
|
307
302
|
2: {
|
|
308
|
-
className: "x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl
|
|
303
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg"
|
|
309
304
|
},
|
|
310
305
|
1: {
|
|
311
|
-
className: "x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl
|
|
306
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl x1vjfegm"
|
|
312
307
|
},
|
|
313
308
|
3: {
|
|
314
|
-
className: "x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl
|
|
309
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg x1vjfegm"
|
|
315
310
|
}
|
|
316
311
|
}[!!!isPresented << 1 | !!isTopSheet << 0],
|
|
317
312
|
hidden: !isPresented,
|
|
@@ -325,7 +320,6 @@ function SwitcherBottomSheetItem({
|
|
|
325
320
|
xstyle: xstyle,
|
|
326
321
|
onDismiss: close,
|
|
327
322
|
onScrimOpacity: handleScrimOpacity,
|
|
328
|
-
positionerRef: positionerRef,
|
|
329
323
|
onElementChange: handlePanelElementChange,
|
|
330
324
|
onMotionStart: handleMotionStart,
|
|
331
325
|
onMotionComplete: handleMotionComplete,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - /packages/lab/src/BottomSheet/BottomSheetPanel.test.tsx
|
|
15
15
|
* - /packages/lab/src/BottomSheet/useSheetGestures.ts
|
|
16
16
|
*/
|
|
17
|
-
import { type
|
|
17
|
+
import { type ReactNode } from 'react';
|
|
18
18
|
import type { BaseProps } from '@astryxdesign/core';
|
|
19
19
|
declare const HEIGHT_BUDGETS: {
|
|
20
20
|
readonly hug: "92dvh";
|
|
@@ -43,13 +43,12 @@ interface BottomSheetPanelProps extends BaseProps<HTMLDivElement> {
|
|
|
43
43
|
children: ReactNode;
|
|
44
44
|
onDismiss: () => void;
|
|
45
45
|
onScrimOpacity: (opacity: number) => void;
|
|
46
|
-
positionerRef?: RefObject<HTMLDivElement | null>;
|
|
47
46
|
onElementChange?: (element: HTMLDivElement | null) => void;
|
|
48
47
|
onMotionStart?: (motion: BottomSheetPanelMotion) => void;
|
|
49
48
|
onMotionComplete?: (motion: BottomSheetPanelMotion) => void;
|
|
50
49
|
}
|
|
51
50
|
/** Internal visual and gesture surface shared by every BottomSheet host. */
|
|
52
|
-
export declare function BottomSheetPanel({ ref, state, height, children, className, style, tabIndex, xstyle, onDismiss, onScrimOpacity,
|
|
51
|
+
export declare function BottomSheetPanel({ ref, state, height, children, className, style, tabIndex, xstyle, onDismiss, onScrimOpacity, onElementChange, onMotionStart, onMotionComplete, ...props }: BottomSheetPanelProps): import("react").JSX.Element;
|
|
53
52
|
export declare namespace BottomSheetPanel {
|
|
54
53
|
var displayName: string;
|
|
55
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAML,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"BottomSheetPanel.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetPanel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAgBlD,QAAA,MAAM,cAAc;;;;CAIV,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,cAAc,CAAC;AA8F5D,MAAM,MAAM,sBAAsB,GAChC,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,qBAAqB,GAC7B;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAChB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,GACjC;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;CACzB,GACD;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC;AAEtB,UAAU,qBAAsB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC/D,+CAA+C;IAC/C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,MAAM,EAAE,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5C,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACzD,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;CAC7D;AA+GD,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,cAAc,EACd,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,qBAAqB,+BAkLvB;yBAjMe,gBAAgB"}
|
|
@@ -190,7 +190,6 @@ export function BottomSheetPanel({
|
|
|
190
190
|
xstyle,
|
|
191
191
|
onDismiss,
|
|
192
192
|
onScrimOpacity,
|
|
193
|
-
positionerRef,
|
|
194
193
|
onElementChange,
|
|
195
194
|
onMotionStart,
|
|
196
195
|
onMotionComplete,
|
|
@@ -198,7 +197,6 @@ export function BottomSheetPanel({
|
|
|
198
197
|
}) {
|
|
199
198
|
const elementRef = useRef(null);
|
|
200
199
|
const bodyElementRef = useRef(null);
|
|
201
|
-
const fallbackPositionerRef = useRef(null);
|
|
202
200
|
const previousStateRef = useRef(state);
|
|
203
201
|
const reactivatedEntranceRef = useRef(false);
|
|
204
202
|
const onMotionStartRef = useRef(onMotionStart);
|
|
@@ -219,6 +217,7 @@ export function BottomSheetPanel({
|
|
|
219
217
|
onMotionCompleteRef.current = onMotionComplete;
|
|
220
218
|
}, [onMotionComplete, onMotionStart, state]);
|
|
221
219
|
const isInteractive = state.kind === 'open';
|
|
220
|
+
const isPresented = state.kind !== 'hidden';
|
|
222
221
|
const isRetained = state.kind === 'retained';
|
|
223
222
|
const isInactive = isRetained || state.kind === 'exiting';
|
|
224
223
|
const isClosing = state.kind === 'exiting';
|
|
@@ -250,10 +249,11 @@ export function BottomSheetPanel({
|
|
|
250
249
|
useMobileKeyboard({
|
|
251
250
|
bodyRef: bodyElementRef,
|
|
252
251
|
bottomClearance: MOBILE_KEYBOARD_BOTTOM_CLEARANCE,
|
|
252
|
+
isEnabled: height === 'tall',
|
|
253
|
+
isFullyExpanded: settledOffset === 0,
|
|
253
254
|
isSheetTraveling: isDragging && dragOffset !== settledOffset,
|
|
254
255
|
isOpen: isInteractive,
|
|
255
|
-
|
|
256
|
-
preserveSheetHeight: height === 'hug',
|
|
256
|
+
isPresented,
|
|
257
257
|
sheetRef: elementRef
|
|
258
258
|
});
|
|
259
259
|
// Keep controller registration attached to one stable host ref. React
|
|
@@ -326,8 +326,13 @@ export function BottomSheetPanel({
|
|
|
326
326
|
})
|
|
327
327
|
}), /*#__PURE__*/_jsx("div", {
|
|
328
328
|
...{
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
0: {
|
|
330
|
+
className: "x1iyjqo2 x2lwn1j x1odjw0f x8du1vd xx69xxh"
|
|
331
|
+
},
|
|
332
|
+
1: {
|
|
333
|
+
className: "x1iyjqo2 x2lwn1j x1odjw0f x8du1vd xx69xxh xrw9175 x1s928wv xhkezso xu6fald x2q1x1w"
|
|
334
|
+
}
|
|
335
|
+
}[!!(height === 'tall') << 0],
|
|
331
336
|
...bodyProps,
|
|
332
337
|
ref: setBodyElement,
|
|
333
338
|
children: children
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* All child sheets render as panels inside one switcher-owned `<dialog>`. A
|
|
15
15
|
* scrim flow calls showModal() once and keeps that native top-layer dialog open
|
|
16
|
-
* across every handoff. A no-scrim flow calls show() on the same
|
|
16
|
+
* across every handoff. A no-scrim flow calls show() on the same non-modal shell.
|
|
17
17
|
* This keeps one modal boundary and one native ::backdrop without a portal.
|
|
18
18
|
*
|
|
19
19
|
* SYNC: When modified, update these files to stay in sync:
|
|
@@ -41,7 +41,7 @@ export interface BottomSheetSwitcherProps extends BaseProps<HTMLDialogElement> {
|
|
|
41
41
|
onActiveSheetChange: (sheetId: string | null) => void;
|
|
42
42
|
/**
|
|
43
43
|
* Whether to open the shared dialog modally with its native ::backdrop.
|
|
44
|
-
* Disable for
|
|
44
|
+
* Disable for a viewport-anchored, non-modal flow over an interactive page.
|
|
45
45
|
* @default true
|
|
46
46
|
*/
|
|
47
47
|
hasScrim?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetSwitcher.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetSwitcher.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheetSwitcher.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheetSwitcher.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAkIlD,MAAM,WAAW,wBAAyB,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC5E,iDAAiD;IACjD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAEnC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAE9D;;;;;OAKG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,iEAAiE;IACjE,mBAAmB,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAEtD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,0DAA0D;IAC1D,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,mBAAmB,EACnB,QAAe,EACf,QAAQ,EACR,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,+BAmX1B;yBAhYe,mBAAmB"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* All child sheets render as panels inside one switcher-owned `<dialog>`. A
|
|
19
19
|
* scrim flow calls showModal() once and keeps that native top-layer dialog open
|
|
20
|
-
* across every handoff. A no-scrim flow calls show() on the same
|
|
20
|
+
* across every handoff. A no-scrim flow calls show() on the same non-modal shell.
|
|
21
21
|
* This keeps one modal boundary and one native ::backdrop without a portal.
|
|
22
22
|
*
|
|
23
23
|
* SYNC: When modified, update these files to stay in sync:
|
|
@@ -32,7 +32,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
32
32
|
import '@astryxdesign/core/theme/tokens.stylex';
|
|
33
33
|
import { colorVars, durationVars, easeVars } from '@astryxdesign/core/theme/tokens.stylex';
|
|
34
34
|
import { hasActiveFocusTrapEscape, isImeKeyEvent, useFocusTrap, useScrollLock } from '@astryxdesign/core/hooks';
|
|
35
|
-
import { composeEventHandlers, mergeProps, mergeRefs
|
|
35
|
+
import { composeEventHandlers, mergeProps, mergeRefs } from '@astryxdesign/core/utils';
|
|
36
36
|
import { BottomSheetSwitcherContext } from "./BottomSheetSwitcherContext.js";
|
|
37
37
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
38
38
|
const styles = {
|
|
@@ -353,7 +353,7 @@ export function BottomSheetSwitcher({
|
|
|
353
353
|
}
|
|
354
354
|
}, [close, hasScrim]);
|
|
355
355
|
const dialogStyleProps = stylex.props(styles.dialog, isFlowVisible && styles.dialogOpen, hasScrim && styles.scrim, !hasScrim && styles.dialogNonModal, xstyle);
|
|
356
|
-
const dialogPresentationProps =
|
|
356
|
+
const dialogPresentationProps = mergeProps(dialogStyleProps, className, style);
|
|
357
357
|
const ariaLabel = props['aria-label'] ?? (props['aria-labelledby'] == null ? activeLabel : undefined);
|
|
358
358
|
return /*#__PURE__*/_jsx(BottomSheetSwitcherContext.Provider, {
|
|
359
359
|
value: contextValue,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @position Lab entry point for the BottomSheet directory
|
|
6
6
|
*/
|
|
7
7
|
export { BottomSheet } from './BottomSheet';
|
|
8
|
-
export type { BottomSheetProps } from './BottomSheet';
|
|
8
|
+
export type { BottomSheetHeight, BottomSheetProps } from './BottomSheet';
|
|
9
9
|
export { BottomSheetSwitcher } from './BottomSheetSwitcher';
|
|
10
10
|
export type { BottomSheetSwitcherProps } from './BottomSheetSwitcher';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/index.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAC,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAC,wBAAwB,EAAC,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* @file index.ts
|
|
5
7
|
* @input BottomSheet.tsx, BottomSheetSwitcher.tsx
|
|
6
8
|
* @output Re-exports the BottomSheet public API
|
|
7
9
|
* @position Lab entry point for the BottomSheet directory
|
|
8
10
|
*/
|
|
9
|
-
|
|
10
11
|
export { BottomSheet } from "./BottomSheet.js";
|
|
11
12
|
export { BottomSheetSwitcher } from "./BottomSheetSwitcher.js";
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
export declare const DETENT_DEDUP_PX = 48;
|
|
22
22
|
/** Resolve snap points given as viewport fractions (0, 1] to px heights. */
|
|
23
|
-
export declare function snapFractionsToHeights(fractions:
|
|
23
|
+
export declare function snapFractionsToHeights(fractions: ReadonlyArray<number>, viewportPx: number): number[];
|
|
24
24
|
/**
|
|
25
25
|
* Given the sheet's full height (px, as rendered fully open) and a set of
|
|
26
26
|
* candidate detent *visible heights* (px), return the resting translateY
|
|
@@ -32,9 +32,9 @@ export declare function snapFractionsToHeights(fractions: readonly number[], vie
|
|
|
32
32
|
* - Offsets closer than `dedupPx` collapse to the smaller (taller) offset, so
|
|
33
33
|
* near-identical detents — e.g. a hug height ≈ a snap point — become one stop.
|
|
34
34
|
*/
|
|
35
|
-
export declare function computeDetentOffsets(sheetHeight: number, detentHeights:
|
|
35
|
+
export declare function computeDetentOffsets(sheetHeight: number, detentHeights: ReadonlyArray<number>, dedupPx?: number): number[];
|
|
36
36
|
/** Nearest value in `offsets` to `value` (offsets must be non-empty). */
|
|
37
|
-
export declare function nearestOffset(value: number, offsets:
|
|
37
|
+
export declare function nearestOffset(value: number, offsets: ReadonlyArray<number>): number;
|
|
38
38
|
/**
|
|
39
39
|
* Minimum scrim opacity at the peek detent. The scrim thins to a glance state
|
|
40
40
|
* but never fully vanishes, because a modal sheet keeps the background inert —
|
|
@@ -51,12 +51,12 @@ export declare const MIN_PEEK_SCRIM_OPACITY = 0.3;
|
|
|
51
51
|
* A single-detent sheet has no peek, so it instead fades all the way to 0
|
|
52
52
|
* across the dismiss overshoot toward `dismissOffset` (the sheet is leaving).
|
|
53
53
|
*/
|
|
54
|
-
export declare function scrimOpacityForOffset(offset: number, offsets:
|
|
54
|
+
export declare function scrimOpacityForOffset(offset: number, offsets: ReadonlyArray<number>, dismissOffset: number): number;
|
|
55
55
|
/**
|
|
56
56
|
* Settle target for a released drag. Restricts candidates to the drag
|
|
57
57
|
* direction so a committed drag never snaps *back past* where it started
|
|
58
58
|
* (a down-drag settles at/below the start, an up-drag at/above), then picks
|
|
59
59
|
* the nearest remaining detent. `dir`: 1 = dragged down, -1 = up, 0 = neither.
|
|
60
60
|
*/
|
|
61
|
-
export declare function resolveSettleOffset(value: number, offsets:
|
|
61
|
+
export declare function resolveSettleOffset(value: number, offsets: ReadonlyArray<number>, dir: number, baseOffset: number): number;
|
|
62
62
|
//# sourceMappingURL=snapOffsets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapOffsets.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/snapOffsets.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,4EAA4E;AAC5E,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"snapOffsets.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/snapOffsets.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,4EAA4E;AAC5E,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,EAChC,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAEV;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,EACpC,OAAO,GAAE,MAAwB,GAChC,MAAM,EAAE,CAcV;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAC7B,MAAM,CAKR;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,aAAa,EAAE,MAAM,GACpB,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,GACjB,MAAM,CAcR"}
|
|
@@ -4,23 +4,22 @@
|
|
|
4
4
|
* @output Exports internal useMobileKeyboard hook
|
|
5
5
|
* @position Internal to BottomSheet; not exported from the lab entry point
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* retaining its measured height. Starting sheet travel or closing the sheet
|
|
12
|
-
* blurs the field and dismisses the keyboard.
|
|
7
|
+
* Gives a fully expanded, explicitly Tall sheet a keyboard-aware internal
|
|
8
|
+
* scroll range while leaving the sheet itself stationary. Shorter detents and
|
|
9
|
+
* other heights opt out entirely. Starting Tall-sheet travel or closing the
|
|
10
|
+
* sheet blurs the field and dismisses the keyboard.
|
|
13
11
|
*/
|
|
14
12
|
import { type RefObject } from 'react';
|
|
15
13
|
interface UseMobileKeyboardOptions {
|
|
16
14
|
bodyRef: RefObject<HTMLDivElement | null>;
|
|
17
15
|
bottomClearance: number;
|
|
16
|
+
isEnabled: boolean;
|
|
17
|
+
isFullyExpanded: boolean;
|
|
18
18
|
isSheetTraveling: boolean;
|
|
19
19
|
isOpen: boolean;
|
|
20
|
-
|
|
21
|
-
preserveSheetHeight: boolean;
|
|
20
|
+
isPresented: boolean;
|
|
22
21
|
sheetRef: RefObject<HTMLDivElement | null>;
|
|
23
22
|
}
|
|
24
|
-
export declare function useMobileKeyboard({ bodyRef, bottomClearance, isSheetTraveling, isOpen,
|
|
23
|
+
export declare function useMobileKeyboard({ bodyRef, bottomClearance, isEnabled, isFullyExpanded, isSheetTraveling, isOpen, isPresented, sheetRef, }: UseMobileKeyboardOptions): void;
|
|
25
24
|
export {};
|
|
26
25
|
//# sourceMappingURL=useMobileKeyboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMobileKeyboard.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/useMobileKeyboard.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"useMobileKeyboard.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/useMobileKeyboard.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAiBxD,UAAU,wBAAwB;IAChC,OAAO,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC1C,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAC5C;AAsGD,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,eAAe,EACf,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,QAAQ,GACT,EAAE,wBAAwB,GAAG,IAAI,CA4ZjC"}
|