react-panel-layout 0.6.0 → 0.7.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.
- package/dist/{FloatingPanelFrame-SgYLc6Ud.js → FloatingPanelFrame-3eU9AwPo.js} +2 -2
- package/dist/{FloatingPanelFrame-SgYLc6Ud.js.map → FloatingPanelFrame-3eU9AwPo.js.map} +1 -1
- package/dist/FloatingWindow-Bw2djgpz.js +1542 -0
- package/dist/FloatingWindow-Bw2djgpz.js.map +1 -0
- package/dist/FloatingWindow-Cvyokf0m.cjs +2 -0
- package/dist/FloatingWindow-Cvyokf0m.cjs.map +1 -0
- package/dist/GridLayout-B4aCqSyd.js +947 -0
- package/dist/{GridLayout-BltqeCPK.js.map → GridLayout-B4aCqSyd.js.map} +1 -1
- package/dist/GridLayout-DNOClFzz.cjs +2 -0
- package/dist/{GridLayout-B4VRsC0r.cjs.map → GridLayout-DNOClFzz.cjs.map} +1 -1
- package/dist/{HorizontalDivider-WF1k_qND.js → HorizontalDivider-DdxzfV0l.js} +3 -3
- package/dist/{HorizontalDivider-WF1k_qND.js.map → HorizontalDivider-DdxzfV0l.js.map} +1 -1
- package/dist/{HorizontalDivider-B5Z-KZLk.cjs → HorizontalDivider-_pgV4Mcv.cjs} +2 -2
- package/dist/{HorizontalDivider-B5Z-KZLk.cjs.map → HorizontalDivider-_pgV4Mcv.cjs.map} +1 -1
- package/dist/PanelSystem-B8Igvnb2.cjs +3 -0
- package/dist/PanelSystem-B8Igvnb2.cjs.map +1 -0
- package/dist/{PanelSystem-Dr1TBhxM.js → PanelSystem-DDUSFjXD.js} +209 -248
- package/dist/PanelSystem-DDUSFjXD.js.map +1 -0
- package/dist/ResizeHandle-CBcAS918.cjs +2 -0
- package/dist/{ResizeHandle-CScipO5l.cjs.map → ResizeHandle-CBcAS918.cjs.map} +1 -1
- package/dist/{ResizeHandle-CdA_JYfN.js → ResizeHandle-CXjc1meV.js} +28 -29
- package/dist/{ResizeHandle-CdA_JYfN.js.map → ResizeHandle-CXjc1meV.js.map} +1 -1
- package/dist/SwipePivotTabBar-DWrCuwEI.js +411 -0
- package/dist/SwipePivotTabBar-DWrCuwEI.js.map +1 -0
- package/dist/SwipePivotTabBar-fjjXkpj7.cjs +2 -0
- package/dist/SwipePivotTabBar-fjjXkpj7.cjs.map +1 -0
- package/dist/components/gesture/SwipeSafeZone.d.ts +40 -0
- package/dist/components/window/Drawer.d.ts +4 -1
- package/dist/components/window/DrawerLayers.d.ts +1 -1
- package/dist/components/window/DrawerRevealContext.d.ts +61 -0
- package/dist/components/window/drawerRevealAnimationUtils.d.ts +212 -0
- package/dist/components/window/drawerStyles.d.ts +74 -0
- package/dist/components/window/drawerSwipeConfig.d.ts +29 -0
- package/dist/components/window/useDrawerSwipeTransform.d.ts +29 -0
- package/dist/components/window/useDrawerTransform.d.ts +68 -0
- package/dist/components/window/useRevealDrawerTransform.d.ts +56 -0
- package/dist/config.cjs +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.js +9 -8
- package/dist/config.js.map +1 -1
- package/dist/constants/styles.d.ts +17 -0
- package/dist/dialog/index.d.ts +69 -0
- package/dist/floating.js +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/grid.js +2 -2
- package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +7 -0
- package/dist/hooks/gesture/types.d.ts +48 -5
- package/dist/hooks/gesture/utils.d.ts +19 -0
- package/dist/hooks/useAnimationFrame.d.ts +2 -0
- package/dist/hooks/useOperationContinuity.d.ts +64 -0
- package/dist/hooks/useResizeObserver.d.ts +33 -1
- package/dist/hooks/useSharedElementTransition.d.ts +112 -0
- package/dist/hooks/useSwipeContentTransform.d.ts +9 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/modules/dialog/AlertDialog.d.ts +9 -0
- package/dist/modules/dialog/DialogContainer.d.ts +37 -0
- package/dist/modules/dialog/Modal.d.ts +26 -0
- package/dist/modules/dialog/SwipeDialogContainer.d.ts +16 -0
- package/dist/modules/dialog/dialogAnimationUtils.d.ts +113 -0
- package/dist/modules/dialog/types.d.ts +183 -0
- package/dist/modules/dialog/useDialog.d.ts +39 -0
- package/dist/modules/dialog/useDialogContainer.d.ts +47 -0
- package/dist/modules/dialog/useDialogSwipeInput.d.ts +70 -0
- package/dist/modules/dialog/useDialogTransform.d.ts +82 -0
- package/dist/modules/drawer/drawerStateMachine.d.ts +168 -0
- package/dist/modules/drawer/revealDrawerConstants.d.ts +33 -0
- package/dist/modules/drawer/revealDrawerStateMachine.d.ts +146 -0
- package/dist/modules/drawer/strategies/index.d.ts +8 -0
- package/dist/modules/drawer/strategies/overlayStrategy.d.ts +12 -0
- package/dist/modules/drawer/strategies/revealStrategy.d.ts +12 -0
- package/dist/modules/drawer/strategies/types.d.ts +116 -0
- package/dist/modules/drawer/types.d.ts +74 -0
- package/dist/modules/drawer/useDrawerSwipeInput.d.ts +24 -0
- package/dist/modules/pivot/SwipePivotTabBar.d.ts +3 -0
- package/dist/modules/stack/SwipeStackContent.d.ts +6 -3
- package/dist/modules/stack/SwipeStackOutlet.d.ts +4 -4
- package/dist/modules/stack/computeSwipeStackTransform.d.ts +1 -1
- package/dist/panels.cjs +1 -1
- package/dist/panels.js +1 -1
- package/dist/pivot.cjs +1 -1
- package/dist/pivot.js +1 -1
- package/dist/resizer.cjs +1 -1
- package/dist/resizer.js +2 -2
- package/dist/stack.cjs +1 -1
- package/dist/stack.cjs.map +1 -1
- package/dist/stack.js +480 -780
- package/dist/stack.js.map +1 -1
- package/dist/sticky-header/calculateStickyMetrics.d.ts +28 -0
- package/dist/sticky-header.cjs +1 -1
- package/dist/sticky-header.cjs.map +1 -1
- package/dist/sticky-header.js +59 -51
- package/dist/sticky-header.js.map +1 -1
- package/dist/{styles-DPPuJ0sf.js → styles-NkjuMOVS.js} +13 -13
- package/dist/{styles-DPPuJ0sf.js.map → styles-NkjuMOVS.js.map} +1 -1
- package/dist/styles-qf6ptVLD.cjs.map +1 -1
- package/dist/types.d.ts +30 -0
- package/dist/useAnimationFrame-BZ6D2lMq.cjs +2 -0
- package/dist/useAnimationFrame-BZ6D2lMq.cjs.map +1 -0
- package/dist/useAnimationFrame-Bg4e-H8O.js +394 -0
- package/dist/useAnimationFrame-Bg4e-H8O.js.map +1 -0
- package/dist/useDocumentPointerEvents-DXxw3qWj.js +54 -0
- package/dist/useDocumentPointerEvents-DXxw3qWj.js.map +1 -0
- package/dist/useDocumentPointerEvents-DxDSOtip.cjs +2 -0
- package/dist/useDocumentPointerEvents-DxDSOtip.cjs.map +1 -0
- package/dist/window/index.d.ts +2 -0
- package/dist/window.cjs +1 -1
- package/dist/window.cjs.map +1 -1
- package/dist/window.js +114 -103
- package/dist/window.js.map +1 -1
- package/package.json +6 -1
- package/src/components/gesture/SwipeSafeZone.tsx +70 -0
- package/src/components/grid/GridLayout.tsx +110 -38
- package/src/components/window/Drawer.tsx +353 -162
- package/src/components/window/DrawerLayers.tsx +54 -11
- package/src/components/window/DrawerRevealContext.spec.ts +20 -0
- package/src/components/window/DrawerRevealContext.tsx +99 -0
- package/src/components/window/drawerRevealAnimationUtils.spec.ts +375 -0
- package/src/components/window/drawerRevealAnimationUtils.ts +415 -0
- package/src/components/window/drawerStyles.spec.ts +302 -0
- package/src/components/window/drawerStyles.ts +252 -0
- package/src/components/window/drawerSwipeConfig.spec.ts +131 -0
- package/src/components/window/drawerSwipeConfig.ts +112 -0
- package/src/components/window/useDrawerSwipeTransform.ts +67 -0
- package/src/components/window/useDrawerTransform.ts +505 -0
- package/src/components/window/useRevealDrawerTransform.spec.ts +1936 -0
- package/src/components/window/useRevealDrawerTransform.ts +105 -0
- package/src/constants/styles.ts +19 -0
- package/src/demo/components/FullscreenDemoPage.tsx +47 -0
- package/src/demo/fullscreenRoutes.tsx +32 -0
- package/src/demo/index.tsx +5 -0
- package/src/demo/pages/Dialog/alerts/index.tsx +22 -0
- package/src/demo/pages/Dialog/card/index.tsx +22 -0
- package/src/demo/pages/Dialog/components/AlertDialogDemo.tsx +124 -0
- package/src/demo/pages/Dialog/components/CardExpandDemo.module.css +243 -0
- package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +219 -0
- package/src/demo/pages/Dialog/components/CustomAlertDialogDemo.tsx +219 -0
- package/src/demo/pages/Dialog/components/DialogDemos.module.css +77 -0
- package/src/demo/pages/Dialog/components/ModalBasics.tsx +45 -0
- package/src/demo/pages/Dialog/components/SwipeDialogDemo.module.css +77 -0
- package/src/demo/pages/Dialog/components/SwipeDialogDemo.tsx +181 -0
- package/src/demo/pages/Dialog/custom-alert/index.tsx +22 -0
- package/src/demo/pages/Dialog/modal/index.tsx +17 -0
- package/src/demo/pages/Dialog/swipe/index.tsx +22 -0
- package/src/demo/pages/Drawer/components/DrawerBasics.module.css +6 -1
- package/src/demo/pages/Drawer/components/DrawerBasics.tsx +14 -4
- package/src/demo/pages/Drawer/components/DrawerReveal.module.css +157 -0
- package/src/demo/pages/Drawer/components/DrawerReveal.tsx +128 -0
- package/src/demo/pages/Drawer/components/DrawerSwipe.module.css +316 -0
- package/src/demo/pages/Drawer/components/DrawerSwipe.tsx +178 -0
- package/src/demo/pages/Drawer/reveal/index.tsx +17 -0
- package/src/demo/pages/Drawer/reveal-fullscreen/index.tsx +135 -0
- package/src/demo/pages/Drawer/reveal-fullscreen/styles.module.css +233 -0
- package/src/demo/pages/Drawer/swipe/index.tsx +17 -0
- package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +54 -23
- package/src/demo/pages/Pivot/swipe-debug/index.tsx +1 -1
- package/src/demo/pages/Stack/components/StackBasics.spec.tsx +156 -0
- package/src/demo/pages/Stack/components/StackBasics.tsx +179 -95
- package/src/demo/pages/Stack/components/StackTablet.spec.tsx +110 -0
- package/src/demo/pages/Stack/components/StackTablet.tsx +42 -21
- package/src/demo/routes.tsx +24 -1
- package/src/dialog/index.ts +85 -0
- package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +68 -64
- package/src/hooks/gesture/testing/createGestureSimulator.ts +113 -37
- package/src/hooks/gesture/types.ts +83 -6
- package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +22 -14
- package/src/hooks/gesture/useNativeGestureGuard.spec.ts +99 -31
- package/src/hooks/gesture/useNativeGestureGuard.ts +3 -1
- package/src/hooks/gesture/utils.ts +102 -0
- package/src/hooks/useAnimatedVisibility.spec.ts +44 -24
- package/src/hooks/useAnimatedVisibility.ts +28 -2
- package/src/hooks/useAnimationFrame.ts +8 -0
- package/src/hooks/useOperationContinuity.spec.ts +394 -0
- package/src/hooks/useOperationContinuity.ts +135 -0
- package/src/hooks/useResizeObserver.spec.tsx +277 -0
- package/src/hooks/useResizeObserver.tsx +108 -39
- package/src/hooks/useScrollContainer.ts +4 -10
- package/src/hooks/useSharedElementTransition.ts +354 -0
- package/src/hooks/useSwipeContentTransform.spec.ts +18 -18
- package/src/hooks/useSwipeContentTransform.ts +166 -28
- package/src/modules/dialog/AlertDialog.spec.tsx +387 -0
- package/src/modules/dialog/AlertDialog.tsx +221 -0
- package/src/modules/dialog/DialogContainer.spec.tsx +228 -0
- package/src/modules/dialog/DialogContainer.tsx +188 -0
- package/src/modules/dialog/Modal.spec.tsx +220 -0
- package/src/modules/dialog/Modal.tsx +182 -0
- package/src/modules/dialog/SwipeDialogContainer.tsx +208 -0
- package/src/modules/dialog/dialogAnimationUtils.spec.ts +252 -0
- package/src/modules/dialog/dialogAnimationUtils.ts +297 -0
- package/src/modules/dialog/types.ts +186 -0
- package/src/modules/dialog/useDialog.spec.tsx +447 -0
- package/src/modules/dialog/useDialog.ts +214 -0
- package/src/modules/dialog/useDialogContainer.spec.ts +339 -0
- package/src/modules/dialog/useDialogContainer.ts +150 -0
- package/src/modules/dialog/useDialogSwipeInput.spec.ts +178 -0
- package/src/modules/dialog/useDialogSwipeInput.ts +350 -0
- package/src/modules/dialog/useDialogTransform.spec.ts +403 -0
- package/src/modules/dialog/useDialogTransform.ts +407 -0
- package/src/modules/drawer/drawerStateMachine.ts +500 -0
- package/src/modules/drawer/revealDrawerConstants.ts +38 -0
- package/src/modules/drawer/revealDrawerStateMachine.spec.ts +558 -0
- package/src/modules/drawer/revealDrawerStateMachine.ts +197 -0
- package/src/modules/drawer/strategies/index.ts +9 -0
- package/src/modules/drawer/strategies/overlayStrategy.ts +133 -0
- package/src/modules/drawer/strategies/revealStrategy.ts +111 -0
- package/src/modules/drawer/strategies/types.ts +160 -0
- package/src/modules/drawer/types.ts +102 -0
- package/src/modules/drawer/useDrawerSwipeInput.spec.ts +566 -0
- package/src/modules/drawer/useDrawerSwipeInput.ts +402 -0
- package/src/modules/panels/rendering/ContentRegistry.spec.tsx +21 -14
- package/src/modules/pivot/SwipePivotContent.position.spec.tsx +12 -8
- package/src/modules/pivot/SwipePivotContent.spec.tsx +66 -25
- package/src/modules/pivot/SwipePivotContent.tsx +2 -2
- package/src/modules/pivot/SwipePivotTabBar.spec.tsx +85 -68
- package/src/modules/pivot/SwipePivotTabBar.tsx +75 -15
- package/src/modules/pivot/scaleInputState.spec.ts +11 -2
- package/src/modules/pivot/usePivot.spec.ts +17 -3
- package/src/modules/pivot/usePivotSwipeInput.spec.ts +182 -123
- package/src/modules/stack/SwipeStackContent.spec.tsx +387 -100
- package/src/modules/stack/SwipeStackContent.tsx +43 -33
- package/src/modules/stack/SwipeStackOutlet.spec.tsx +14 -16
- package/src/modules/stack/SwipeStackOutlet.tsx +6 -6
- package/src/modules/stack/computeSwipeStackTransform.spec.ts +5 -5
- package/src/modules/stack/computeSwipeStackTransform.ts +3 -3
- package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1133 -0
- package/src/modules/stack/useStackAnimationState.spec.ts +3 -1
- package/src/modules/stack/useStackAnimationState.ts +18 -13
- package/src/modules/stack/useStackNavigation.spec.ts +198 -3
- package/src/modules/stack/useStackNavigation.tsx +113 -56
- package/src/modules/stack/useStackSwipeInput.spec.ts +65 -32
- package/src/modules/stack/useStackSwipeInput.ts +1 -1
- package/src/sticky-header/StickyArea.tsx +29 -57
- package/src/sticky-header/calculateStickyMetrics.spec.ts +105 -0
- package/src/sticky-header/calculateStickyMetrics.ts +50 -0
- package/src/types.ts +33 -0
- package/src/window/index.ts +2 -0
- package/dist/FloatingWindow-BpdOpg_L.js +0 -400
- package/dist/FloatingWindow-BpdOpg_L.js.map +0 -1
- package/dist/FloatingWindow-TCDNY5gE.cjs +0 -2
- package/dist/FloatingWindow-TCDNY5gE.cjs.map +0 -1
- package/dist/GridLayout-B4VRsC0r.cjs +0 -2
- package/dist/GridLayout-BltqeCPK.js +0 -927
- package/dist/PanelSystem-Bs8bQwQF.cjs +0 -3
- package/dist/PanelSystem-Bs8bQwQF.cjs.map +0 -1
- package/dist/PanelSystem-Dr1TBhxM.js.map +0 -1
- package/dist/ResizeHandle-CScipO5l.cjs +0 -2
- package/dist/SwipePivotTabBar-BGO9X94m.js +0 -407
- package/dist/SwipePivotTabBar-BGO9X94m.js.map +0 -1
- package/dist/SwipePivotTabBar-BrQismcZ.cjs +0 -2
- package/dist/SwipePivotTabBar-BrQismcZ.cjs.map +0 -1
- package/dist/useDocumentPointerEvents-CKdhGXd0.js +0 -46
- package/dist/useDocumentPointerEvents-CKdhGXd0.js.map +0 -1
- package/dist/useDocumentPointerEvents-ChqrKXDk.cjs +0 -2
- package/dist/useDocumentPointerEvents-ChqrKXDk.cjs.map +0 -1
- package/dist/useEffectEvent-Dp7HLCf0.js +0 -13
- package/dist/useEffectEvent-Dp7HLCf0.js.map +0 -1
- package/dist/useEffectEvent-huSsGUnl.cjs +0 -2
- package/dist/useEffectEvent-huSsGUnl.cjs.map +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Dialog entry point - Modal and alert/confirm/prompt dialogs
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*
|
|
5
|
+
* This is a subpath export entry point for `react-panel-layout/dialog`.
|
|
6
|
+
*
|
|
7
|
+
* ## Overview
|
|
8
|
+
* Dialog provides modal dialogs and imperative alert/confirm/prompt APIs
|
|
9
|
+
* using native HTML dialog element for proper accessibility and top-layer rendering.
|
|
10
|
+
*
|
|
11
|
+
* ## Installation
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Modal, useDialog, DialogContainer } from "react-panel-layout/dialog";
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## Modal Usage
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
19
|
+
*
|
|
20
|
+
* <Modal
|
|
21
|
+
* visible={isOpen}
|
|
22
|
+
* onClose={() => setIsOpen(false)}
|
|
23
|
+
* header={{ title: "Settings" }}
|
|
24
|
+
* >
|
|
25
|
+
* <form>
|
|
26
|
+
* <input type="text" placeholder="Name" />
|
|
27
|
+
* <button type="submit">Save</button>
|
|
28
|
+
* </form>
|
|
29
|
+
* </Modal>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* ## useDialog Hook Usage
|
|
33
|
+
* ```tsx
|
|
34
|
+
* function MyComponent() {
|
|
35
|
+
* const { alert, confirm, prompt, Outlet } = useDialog();
|
|
36
|
+
*
|
|
37
|
+
* const handleClick = async () => {
|
|
38
|
+
* await alert("Hello!");
|
|
39
|
+
*
|
|
40
|
+
* const confirmed = await confirm({
|
|
41
|
+
* message: "Are you sure?",
|
|
42
|
+
* confirmLabel: "Yes",
|
|
43
|
+
* cancelLabel: "No",
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* if (confirmed) {
|
|
47
|
+
* const name = await prompt({
|
|
48
|
+
* message: "Enter your name:",
|
|
49
|
+
* defaultValue: "Anonymous",
|
|
50
|
+
* });
|
|
51
|
+
* console.log("Name:", name);
|
|
52
|
+
* }
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* return (
|
|
56
|
+
* <>
|
|
57
|
+
* <button onClick={handleClick}>Show dialogs</button>
|
|
58
|
+
* <Outlet />
|
|
59
|
+
* </>
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export { Modal } from "../modules/dialog/Modal.js";
|
|
65
|
+
export { DialogContainer } from "../modules/dialog/DialogContainer.js";
|
|
66
|
+
export { AlertDialog } from "../modules/dialog/AlertDialog.js";
|
|
67
|
+
export { useDialog } from "../modules/dialog/useDialog.js";
|
|
68
|
+
export { useDialogContainer } from "../modules/dialog/useDialogContainer.js";
|
|
69
|
+
export type { ModalProps, ModalHeader, DialogContainerProps, DialogTransitionMode, AlertOptions, ConfirmOptions, PromptOptions, AlertDialogProps, UseDialogReturn, } from "../modules/dialog/types.js";
|
package/dist/floating.js
CHANGED
package/dist/grid.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GridLayout-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GridLayout-DNOClFzz.cjs"),r=require("./FloatingWindow-Cvyokf0m.cjs");exports.GridLayerList=e.GridLayerList;exports.GridLayerResizeHandles=e.GridLayerResizeHandles;exports.GridLayout=e.GridLayout;exports.GridTrackResizeHandle=e.GridTrackResizeHandle;exports.useGridPlacements=e.useGridPlacements;exports.useGridTracks=e.useGridTracks;exports.GridLayoutProvider=r.GridLayoutProvider;exports.useGridLayoutContext=r.useGridLayoutContext;
|
|
2
2
|
//# sourceMappingURL=grid.cjs.map
|
package/dist/grid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as e, b as s, G as d, c as i, u as G, d as o } from "./GridLayout-
|
|
2
|
-
import { G as u, u as L } from "./FloatingWindow-
|
|
1
|
+
import { a as e, b as s, G as d, c as i, u as G, d as o } from "./GridLayout-B4aCqSyd.js";
|
|
2
|
+
import { G as u, u as L } from "./FloatingWindow-Bw2djgpz.js";
|
|
3
3
|
export {
|
|
4
4
|
e as GridLayerList,
|
|
5
5
|
s as GridLayerResizeHandles,
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Test utility for simulating gesture events.
|
|
3
|
+
*
|
|
4
|
+
* Provides a fluent API for simulating pointer events in tests,
|
|
5
|
+
* making it easier to test swipe and drag gestures.
|
|
6
|
+
*/
|
|
7
|
+
import type * as React from "react";
|
|
1
8
|
/**
|
|
2
9
|
* 2D point for gesture coordinates.
|
|
3
10
|
*/
|
|
@@ -6,17 +6,15 @@
|
|
|
6
6
|
* - Input: how to command (swipe, click, keyboard)
|
|
7
7
|
* - Presentation: how to show (animation, transition)
|
|
8
8
|
*
|
|
9
|
-
* This file defines types for the Input layer
|
|
9
|
+
* This file defines types for the Input layer, including the abstract
|
|
10
|
+
* ContinuousOperationState that represents any continuous state transition
|
|
11
|
+
* (whether controlled by human gesture or system animation).
|
|
10
12
|
*/
|
|
11
13
|
import type * as React from "react";
|
|
12
14
|
/**
|
|
13
15
|
* Axis for gesture detection.
|
|
14
16
|
*/
|
|
15
17
|
export type GestureAxis = "horizontal" | "vertical";
|
|
16
|
-
/**
|
|
17
|
-
* Phase of swipe input lifecycle.
|
|
18
|
-
*/
|
|
19
|
-
export type SwipeInputPhase = "idle" | "tracking" | "swiping" | "ended";
|
|
20
18
|
/**
|
|
21
19
|
* 2D vector for displacement and velocity.
|
|
22
20
|
*/
|
|
@@ -24,6 +22,51 @@ export type Vector2 = {
|
|
|
24
22
|
x: number;
|
|
25
23
|
y: number;
|
|
26
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Phase of a continuous operation lifecycle.
|
|
27
|
+
* - "idle": No operation in progress
|
|
28
|
+
* - "operating": Operation is in progress (human or system controlled)
|
|
29
|
+
* - "ended": Operation has completed
|
|
30
|
+
*/
|
|
31
|
+
export type ContinuousOperationPhase = "idle" | "operating" | "ended";
|
|
32
|
+
/**
|
|
33
|
+
* State of a continuous operation.
|
|
34
|
+
*
|
|
35
|
+
* This is the abstract representation of any operation that occurs over time,
|
|
36
|
+
* whether controlled by human gesture or system animation. Components that
|
|
37
|
+
* accept this state can respond to both input types uniformly.
|
|
38
|
+
*/
|
|
39
|
+
export type ContinuousOperationState = {
|
|
40
|
+
/** Current phase of the operation */
|
|
41
|
+
phase: ContinuousOperationPhase;
|
|
42
|
+
/** Displacement from start position in pixels */
|
|
43
|
+
displacement: Vector2;
|
|
44
|
+
/** Current velocity in pixels per millisecond */
|
|
45
|
+
velocity: Vector2;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Initial idle state for ContinuousOperationState.
|
|
49
|
+
*/
|
|
50
|
+
export declare const IDLE_CONTINUOUS_OPERATION_STATE: ContinuousOperationState;
|
|
51
|
+
/**
|
|
52
|
+
* Convert SwipeInputPhase to ContinuousOperationPhase.
|
|
53
|
+
* - "idle" → "idle"
|
|
54
|
+
* - "tracking" | "swiping" → "operating"
|
|
55
|
+
* - "ended" → "ended"
|
|
56
|
+
*/
|
|
57
|
+
export declare function toContinuousPhase(phase: SwipeInputPhase): ContinuousOperationPhase;
|
|
58
|
+
/**
|
|
59
|
+
* Convert SwipeInputState to ContinuousOperationState.
|
|
60
|
+
*/
|
|
61
|
+
export declare function toContinuousOperationState(state: SwipeInputState): ContinuousOperationState;
|
|
62
|
+
/**
|
|
63
|
+
* Phase of swipe input lifecycle.
|
|
64
|
+
* - "idle": No swipe in progress
|
|
65
|
+
* - "tracking": Pointer down, tracking movement (direction not yet locked)
|
|
66
|
+
* - "swiping": Direction locked, actively swiping
|
|
67
|
+
* - "ended": Swipe gesture completed
|
|
68
|
+
*/
|
|
69
|
+
export type SwipeInputPhase = "idle" | "tracking" | "swiping" | "ended";
|
|
27
70
|
/**
|
|
28
71
|
* Point with timestamp for velocity calculation.
|
|
29
72
|
*/
|
|
@@ -38,3 +38,22 @@ export type GestureContainerProps = React.HTMLAttributes<HTMLElement> & {
|
|
|
38
38
|
* @returns Merged container props with combined styles and handlers
|
|
39
39
|
*/
|
|
40
40
|
export declare const mergeGestureContainerProps: (...propsArray: GestureContainerProps[]) => GestureContainerProps;
|
|
41
|
+
/**
|
|
42
|
+
* Check if an element is scrollable in any direction.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isScrollableElement(element: HTMLElement): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Check if we should start drag based on scroll state.
|
|
47
|
+
* Returns false if the target is inside a scrollable element.
|
|
48
|
+
*/
|
|
49
|
+
export declare function shouldStartDrag(event: React.PointerEvent, container: HTMLElement): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Check if an element or its ancestors are scrollable in the specified direction.
|
|
52
|
+
* Returns true if scrolling is possible and would block the swipe gesture.
|
|
53
|
+
*
|
|
54
|
+
* @param element - The target element to check
|
|
55
|
+
* @param container - The container boundary
|
|
56
|
+
* @param axis - The axis to check ("x" or "y")
|
|
57
|
+
* @param direction - The swipe direction (1 = right/down, -1 = left/up)
|
|
58
|
+
*/
|
|
59
|
+
export declare function isScrollableInDirection(element: HTMLElement, container: HTMLElement, axis: "x" | "y", direction: 1 | -1): boolean;
|
|
@@ -17,6 +17,8 @@ export declare const easings: {
|
|
|
17
17
|
readonly easeOutQuart: (t: number) => number;
|
|
18
18
|
/** Ease in out cubic */
|
|
19
19
|
readonly easeInOutCubic: (t: number) => number;
|
|
20
|
+
/** Ease in expo (accelerating, for "suck in" effect) */
|
|
21
|
+
readonly easeInExpo: (t: number) => number;
|
|
20
22
|
};
|
|
21
23
|
/**
|
|
22
24
|
* Animation state passed to callbacks.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result from useOperationContinuity hook.
|
|
3
|
+
*/
|
|
4
|
+
export type UseOperationContinuityResult<T> = {
|
|
5
|
+
/** The effective value (retained during operation, current after) */
|
|
6
|
+
value: T;
|
|
7
|
+
/**
|
|
8
|
+
* True if the value changed during the operation.
|
|
9
|
+
*
|
|
10
|
+
* This is useful for determining how to handle the transition when the
|
|
11
|
+
* operation ends. For example, if the role changed during a swipe,
|
|
12
|
+
* the target position change at operation end should snap rather than animate.
|
|
13
|
+
*
|
|
14
|
+
* This flag is true on the render where shouldRetainPrevious becomes false
|
|
15
|
+
* (operation end), allowing consumers to handle the transition appropriately.
|
|
16
|
+
* It resets to false on subsequent renders.
|
|
17
|
+
*/
|
|
18
|
+
changedDuringOperation: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* True on the render where the operation just ended.
|
|
21
|
+
*
|
|
22
|
+
* This is true when shouldRetainPrevious transitions from true to false,
|
|
23
|
+
* regardless of whether the value changed. Use this to detect the moment
|
|
24
|
+
* when an operation completes and delay any immediate animations.
|
|
25
|
+
*
|
|
26
|
+
* In the over-swipe case, this helps prevent unwanted snap-back animation
|
|
27
|
+
* in the intermediate render before navigation changes.
|
|
28
|
+
*/
|
|
29
|
+
operationJustEnded: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Hook for maintaining value continuity during continuous operations.
|
|
33
|
+
*
|
|
34
|
+
* When an operation is in progress, this hook retains the previous value
|
|
35
|
+
* to prevent sudden visual changes from state updates. Once the operation
|
|
36
|
+
* ends (shouldRetainPrevious becomes false), the new value is accepted.
|
|
37
|
+
*
|
|
38
|
+
* Additionally, this hook tracks whether the value changed during the operation,
|
|
39
|
+
* which is useful for determining animation behavior at operation end.
|
|
40
|
+
*
|
|
41
|
+
* IMPORTANT: This hook is designed to be idempotent during render to work
|
|
42
|
+
* correctly with React StrictMode, which calls the render function twice.
|
|
43
|
+
* All ref mutations happen in useLayoutEffect, not during render.
|
|
44
|
+
*
|
|
45
|
+
* @param value - The current value from external state
|
|
46
|
+
* @param shouldRetainPrevious - Whether to retain the previous value (true during operation)
|
|
47
|
+
* @returns Object with effective value and whether it changed during operation
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* // Maintain role continuity during swipe
|
|
52
|
+
* const { value: effectiveRole, changedDuringOperation } = useOperationContinuity(
|
|
53
|
+
* role,
|
|
54
|
+
* displacement > 0,
|
|
55
|
+
* );
|
|
56
|
+
*
|
|
57
|
+
* // Use changedDuringOperation to skip animation on operation end
|
|
58
|
+
* useSwipeContentTransform({
|
|
59
|
+
* // ...
|
|
60
|
+
* skipTargetChangeAnimation: changedDuringOperation,
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function useOperationContinuity<T>(value: T, shouldRetainPrevious: boolean): UseOperationContinuityResult<T>;
|
|
@@ -1,15 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Shared useResizeObserver hook with cached observer instances.
|
|
3
|
+
*
|
|
4
|
+
* Provides element size observation with shared observers for memory efficiency.
|
|
5
|
+
* Size becomes available after the first useLayoutEffect cycle completes.
|
|
6
|
+
*
|
|
7
|
+
* Note: Due to React's effect execution order (children before parents),
|
|
8
|
+
* child components may see containerSize=0 on their first effect run.
|
|
9
|
+
* This is a React constraint, not a bug. Consumers should check for
|
|
10
|
+
* valid size before using it for calculations like animation positions.
|
|
3
11
|
*/
|
|
4
12
|
import * as React from "react";
|
|
13
|
+
/**
|
|
14
|
+
* Clear observer cache. Exported for testing purposes.
|
|
15
|
+
*/
|
|
16
|
+
export declare function clearObserverCache(): void;
|
|
5
17
|
/**
|
|
6
18
|
* Observe size changes for a given element reference using shared resize observers.
|
|
7
19
|
*
|
|
8
20
|
* @param ref - Ref holding the element whose size to monitor.
|
|
9
21
|
* @param options - Resize observer configuration.
|
|
10
22
|
* @returns Latest resize entry and a derived DOMRect snapshot.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* The `rect` will be `null` on the first render. After the initial
|
|
26
|
+
* useLayoutEffect runs and triggers a re-render, `rect` will contain
|
|
27
|
+
* the measured size.
|
|
28
|
+
*
|
|
29
|
+
* Due to React's effect execution order, child components' effects run
|
|
30
|
+
* before parent effects. If you pass `rect.width` to a child as a prop,
|
|
31
|
+
* the child's first effect will see `0` (or whatever default you use).
|
|
32
|
+
* This is expected React behavior.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* const containerRef = useRef<HTMLDivElement>(null);
|
|
37
|
+
* const { rect } = useResizeObserver(containerRef, { box: "border-box" });
|
|
38
|
+
* const width = rect?.width ?? 0;
|
|
39
|
+
*
|
|
40
|
+
* // Check if size is ready before using for calculations
|
|
41
|
+
* const isReady = rect !== null;
|
|
42
|
+
* ```
|
|
11
43
|
*/
|
|
12
44
|
export declare function useResizeObserver<T extends HTMLElement>(ref: React.RefObject<T | null>, { box }: ResizeObserverOptions): {
|
|
13
45
|
entry: ResizeObserverEntry | null;
|
|
14
|
-
rect:
|
|
46
|
+
rect: DOMRect | null;
|
|
15
47
|
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Hook for View Transitions API shared element animations.
|
|
3
|
+
*
|
|
4
|
+
* Enables smooth morph animations between a source element (e.g., card)
|
|
5
|
+
* and a target element (e.g., expanded view) using CSS view-transition-name.
|
|
6
|
+
* Supports swipe-to-dismiss with the expanded view animating back to source.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
/**
|
|
10
|
+
* Check if View Transitions API is supported.
|
|
11
|
+
*/
|
|
12
|
+
export declare function supportsViewTransitions(): boolean;
|
|
13
|
+
type ViewTransitionHandle = {
|
|
14
|
+
finished: Promise<void>;
|
|
15
|
+
ready: Promise<void>;
|
|
16
|
+
updateCallbackDone: Promise<void>;
|
|
17
|
+
skipTransition: () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Start a view transition with the given callback.
|
|
21
|
+
*/
|
|
22
|
+
export declare function startViewTransition(callback: () => void): ViewTransitionHandle | null;
|
|
23
|
+
/**
|
|
24
|
+
* Options for useSharedElementTransition hook.
|
|
25
|
+
*/
|
|
26
|
+
export type UseSharedElementTransitionOptions<T> = {
|
|
27
|
+
/**
|
|
28
|
+
* Function to generate a unique transition name for an item.
|
|
29
|
+
* Multiple names can be returned for nested shared elements.
|
|
30
|
+
*/
|
|
31
|
+
getTransitionName: (item: T) => string | string[];
|
|
32
|
+
/**
|
|
33
|
+
* Function to get a unique key for comparison.
|
|
34
|
+
* Defaults to using getTransitionName result.
|
|
35
|
+
*/
|
|
36
|
+
getKey?: (item: T) => string;
|
|
37
|
+
/** Enable swipe to dismiss. @default true */
|
|
38
|
+
swipeDismissible?: boolean;
|
|
39
|
+
/** Threshold ratio (0-1) to trigger dismiss. @default 0.3 */
|
|
40
|
+
dismissThreshold?: number;
|
|
41
|
+
};
|
|
42
|
+
/** 2D vector */
|
|
43
|
+
type Vector2 = {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Result from useSharedElementTransition hook.
|
|
49
|
+
*/
|
|
50
|
+
export type UseSharedElementTransitionResult<T> = {
|
|
51
|
+
/** Currently expanded item, or null if none */
|
|
52
|
+
expandedItem: T | null;
|
|
53
|
+
/** Expand an item with view transition */
|
|
54
|
+
expand: (item: T) => void;
|
|
55
|
+
/** Collapse the expanded item with view transition */
|
|
56
|
+
collapse: () => void;
|
|
57
|
+
/**
|
|
58
|
+
* Get style props for a source element (e.g., card).
|
|
59
|
+
*/
|
|
60
|
+
getSourceProps: (item: T, nameIndex?: number) => {
|
|
61
|
+
style: React.CSSProperties;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Get style props for the target element (e.g., expanded view).
|
|
65
|
+
* Includes transform for swipe tracking.
|
|
66
|
+
*/
|
|
67
|
+
getTargetProps: (nameIndex?: number) => {
|
|
68
|
+
style: React.CSSProperties;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Get swipe container props (onPointerDown, style).
|
|
72
|
+
* Apply to the swipeable container element.
|
|
73
|
+
*/
|
|
74
|
+
getSwipeContainerProps: () => React.HTMLAttributes<HTMLElement> & {
|
|
75
|
+
style: React.CSSProperties;
|
|
76
|
+
};
|
|
77
|
+
/** Whether currently being swiped */
|
|
78
|
+
isSwiping: boolean;
|
|
79
|
+
/** Current displacement during swipe */
|
|
80
|
+
displacement: Vector2;
|
|
81
|
+
/** Whether View Transitions API is supported */
|
|
82
|
+
isSupported: boolean;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Hook for managing shared element transitions using View Transitions API.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* const {
|
|
90
|
+
* expandedItem, expand, collapse,
|
|
91
|
+
* getSourceProps, getTargetProps, getSwipeContainerProps
|
|
92
|
+
* } = useSharedElementTransition({
|
|
93
|
+
* getTransitionName: (album) => [`album-${album.id}`, `album-art-${album.id}`],
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* // Source (card)
|
|
97
|
+
* <div {...getSourceProps(album, 0)}>
|
|
98
|
+
* <img {...getSourceProps(album, 1)} />
|
|
99
|
+
* </div>
|
|
100
|
+
*
|
|
101
|
+
* // Target (expanded view) - apply swipe props to container
|
|
102
|
+
* {expandedItem && (
|
|
103
|
+
* <div {...getSwipeContainerProps()}>
|
|
104
|
+
* <div {...getTargetProps(0)}>
|
|
105
|
+
* <img {...getTargetProps(1)} />
|
|
106
|
+
* </div>
|
|
107
|
+
* </div>
|
|
108
|
+
* )}
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function useSharedElementTransition<T>(options: UseSharedElementTransitionOptions<T>): UseSharedElementTransitionResult<T>;
|
|
112
|
+
export {};
|
|
@@ -19,7 +19,7 @@ export type UseSwipeContentTransformOptions = {
|
|
|
19
19
|
/** Current swipe displacement in pixels */
|
|
20
20
|
displacement: number;
|
|
21
21
|
/** Whether swipe gesture is active */
|
|
22
|
-
|
|
22
|
+
isOperating: boolean;
|
|
23
23
|
/** Axis of transformation */
|
|
24
24
|
axis?: GestureAxis;
|
|
25
25
|
/** Duration of snap animation in ms */
|
|
@@ -38,6 +38,13 @@ export type UseSwipeContentTransformOptions = {
|
|
|
38
38
|
* Use this for push animations where new panel comes from off-screen.
|
|
39
39
|
*/
|
|
40
40
|
initialPx?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Skip animation when targetPx changes.
|
|
43
|
+
* Use this when the target changed during an operation (from useOperationContinuity).
|
|
44
|
+
* When true, target changes will snap instead of animate.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
skipTargetChangeAnimation?: boolean;
|
|
41
48
|
};
|
|
42
49
|
/**
|
|
43
50
|
* Animation direction information.
|
|
@@ -72,7 +79,7 @@ export type UseSwipeContentTransformResult = {
|
|
|
72
79
|
* elementRef: containerRef,
|
|
73
80
|
* targetPx: 0,
|
|
74
81
|
* displacement: inputState.displacement.x,
|
|
75
|
-
*
|
|
82
|
+
* isOperating: inputState.phase === "swiping",
|
|
76
83
|
* });
|
|
77
84
|
* ```
|
|
78
85
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./GridLayout-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./GridLayout-DNOClFzz.cjs"),t=require("./FloatingWindow-Cvyokf0m.cjs"),s=require("./HorizontalDivider-_pgV4Mcv.cjs"),u=require("./ResizeHandle-CBcAS918.cjs"),l=require("react"),c=require("./useFloatingState-C4kRaW_R.cjs"),d=require("./styles-qf6ptVLD.cjs"),i=require("./PanelSystem-B8Igvnb2.cjs");function y(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const S=y(l),g=()=>{const{layerId:e}=t.useLayerInstance(),{getLayerHandleProps:r}=t.useGridLayoutContext();return S.useMemo(()=>r(e),[r,e])};exports.GridLayout=o.GridLayout;exports.Drawer=t.Drawer;exports.DrawerLayers=t.DrawerLayers;exports.FloatingWindow=t.FloatingWindow;exports.runTransition=t.runTransition;exports.useTransitionState=t.useTransitionState;exports.HorizontalDivider=s.HorizontalDivider;exports.ResizeHandle=u.ResizeHandle;exports.useFloatingState=c.useFloatingState;exports.CSS_VAR_PREFIX=d.CSS_VAR_PREFIX;exports.PanelSystem=i.PanelSystem;exports.buildInitialState=i.buildInitialState;exports.useLayerDragHandle=g;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { G as m } from "./GridLayout-
|
|
2
|
-
import { a as e, u as t } from "./FloatingWindow-
|
|
3
|
-
import { D as l, b as d, F as f, r as x, c as y } from "./FloatingWindow-
|
|
4
|
-
import { H as L } from "./HorizontalDivider-
|
|
5
|
-
import { R as D } from "./ResizeHandle-
|
|
1
|
+
import { G as m } from "./GridLayout-B4aCqSyd.js";
|
|
2
|
+
import { a as e, u as t } from "./FloatingWindow-Bw2djgpz.js";
|
|
3
|
+
import { D as l, b as d, F as f, r as x, c as y } from "./FloatingWindow-Bw2djgpz.js";
|
|
4
|
+
import { H as L } from "./HorizontalDivider-DdxzfV0l.js";
|
|
5
|
+
import { R as D } from "./ResizeHandle-CXjc1meV.js";
|
|
6
6
|
import * as o from "react";
|
|
7
7
|
import { u as R } from "./useFloatingState-tEfA_wbc.js";
|
|
8
|
-
import { C as F } from "./styles-
|
|
9
|
-
import { P, v as w } from "./PanelSystem-
|
|
8
|
+
import { C as F } from "./styles-NkjuMOVS.js";
|
|
9
|
+
import { P, v as w } from "./PanelSystem-DDUSFjXD.js";
|
|
10
10
|
const n = () => {
|
|
11
11
|
const { layerId: r } = e(), { getLayerHandleProps: a } = t();
|
|
12
12
|
return o.useMemo(() => a(r), [a, r]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file AlertDialog component for alert, confirm, and prompt dialogs
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import type { AlertDialogProps } from "./types";
|
|
6
|
+
/**
|
|
7
|
+
* Internal component for alert, confirm, and prompt dialogs
|
|
8
|
+
*/
|
|
9
|
+
export declare const AlertDialog: React.FC<AlertDialogProps>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Base dialog container component using native <dialog> element
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import type { DialogContainerProps } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Base container for dialog-based overlays using native <dialog> element.
|
|
8
|
+
* Opens in the browser's top layer, ensuring it appears above all other content.
|
|
9
|
+
*
|
|
10
|
+
* Supports three transition modes:
|
|
11
|
+
* - "none": No animation
|
|
12
|
+
* - "css": CSS-based fade/scale animation (default)
|
|
13
|
+
* - "swipe": Swipeable with multi-phase animation
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <DialogContainer
|
|
18
|
+
* visible={isOpen}
|
|
19
|
+
* onClose={() => setIsOpen(false)}
|
|
20
|
+
* >
|
|
21
|
+
* <div>Dialog content</div>
|
|
22
|
+
* </DialogContainer>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Swipeable dialog
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <DialogContainer
|
|
28
|
+
* visible={isOpen}
|
|
29
|
+
* onClose={() => setIsOpen(false)}
|
|
30
|
+
* transitionMode="swipe"
|
|
31
|
+
* openDirection="bottom"
|
|
32
|
+
* >
|
|
33
|
+
* <div>Swipe down to close</div>
|
|
34
|
+
* </DialogContainer>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const DialogContainer: React.FC<DialogContainerProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Modal component - Centered modal dialog with optional chrome
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import type { ModalProps } from "./types";
|
|
6
|
+
/**
|
|
7
|
+
* Modal component for displaying centered dialogs.
|
|
8
|
+
* Uses native <dialog> element for proper accessibility and top-layer rendering.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
13
|
+
*
|
|
14
|
+
* <Modal
|
|
15
|
+
* visible={isOpen}
|
|
16
|
+
* onClose={() => setIsOpen(false)}
|
|
17
|
+
* header={{ title: "Settings" }}
|
|
18
|
+
* >
|
|
19
|
+
* <form>
|
|
20
|
+
* <input type="text" placeholder="Name" />
|
|
21
|
+
* <button type="submit">Save</button>
|
|
22
|
+
* </form>
|
|
23
|
+
* </Modal>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const Modal: React.FC<ModalProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Swipeable dialog container component.
|
|
3
|
+
*
|
|
4
|
+
* This component extends the base dialog functionality with swipe-to-dismiss
|
|
5
|
+
* and multi-phase animations. It uses native <dialog> element for top layer
|
|
6
|
+
* positioning and custom transform animations.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import type { DialogContainerProps } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Swipeable dialog container with multi-phase animation.
|
|
12
|
+
*
|
|
13
|
+
* Uses native <dialog> for top layer positioning and custom JS animations
|
|
14
|
+
* for swipe-to-dismiss functionality.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SwipeDialogContainer: React.FC<DialogContainerProps>;
|