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,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file SwipeDialogDemo - Demonstration of swipeable dialog functionality
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Modal } from "../../../../modules/dialog/Modal.js";
|
|
6
|
+
import { DialogContainer } from "../../../../modules/dialog/DialogContainer.js";
|
|
7
|
+
import {
|
|
8
|
+
FloatingPanelFrame,
|
|
9
|
+
FloatingPanelHeader,
|
|
10
|
+
FloatingPanelTitle,
|
|
11
|
+
FloatingPanelContent,
|
|
12
|
+
} from "../../../../components/paneling/FloatingPanelFrame.js";
|
|
13
|
+
import { DemoButton } from "../../../components/ui/DemoButton.js";
|
|
14
|
+
import styles from "./SwipeDialogDemo.module.css";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Demo component for swipeable dialogs
|
|
18
|
+
*/
|
|
19
|
+
export const SwipeDialogDemo: React.FC = () => {
|
|
20
|
+
const [bottomModal, setBottomModal] = React.useState(false);
|
|
21
|
+
const [centerModal, setCenterModal] = React.useState(false);
|
|
22
|
+
const [scrollableModal, setScrollableModal] = React.useState(false);
|
|
23
|
+
const [customSheet, setCustomSheet] = React.useState(false);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={styles.container}>
|
|
27
|
+
{/* Bottom Sheet Style */}
|
|
28
|
+
<div className={styles.section}>
|
|
29
|
+
<div className={styles.label}>Bottom Sheet (Swipe Down)</div>
|
|
30
|
+
<div className={styles.buttonGroup}>
|
|
31
|
+
<DemoButton onClick={() => setBottomModal(true)}>
|
|
32
|
+
Open Bottom Sheet
|
|
33
|
+
</DemoButton>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
{/* Center Modal with Swipe */}
|
|
38
|
+
<div className={styles.section}>
|
|
39
|
+
<div className={styles.label}>Center Modal (Swipe Down)</div>
|
|
40
|
+
<div className={styles.buttonGroup}>
|
|
41
|
+
<DemoButton variant="secondary" onClick={() => setCenterModal(true)}>
|
|
42
|
+
Open Center Modal
|
|
43
|
+
</DemoButton>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
{/* Scrollable Content */}
|
|
48
|
+
<div className={styles.section}>
|
|
49
|
+
<div className={styles.label}>With Scrollable Content</div>
|
|
50
|
+
<div className={styles.buttonGroup}>
|
|
51
|
+
<DemoButton variant="secondary" onClick={() => setScrollableModal(true)}>
|
|
52
|
+
Open Scrollable Modal
|
|
53
|
+
</DemoButton>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{/* Custom Action Sheet */}
|
|
58
|
+
<div className={styles.section}>
|
|
59
|
+
<div className={styles.label}>Custom Action Sheet</div>
|
|
60
|
+
<div className={styles.buttonGroup}>
|
|
61
|
+
<DemoButton onClick={() => setCustomSheet(true)}>
|
|
62
|
+
Open Action Sheet
|
|
63
|
+
</DemoButton>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
{/* Bottom Sheet Modal */}
|
|
68
|
+
<Modal
|
|
69
|
+
visible={bottomModal}
|
|
70
|
+
onClose={() => setBottomModal(false)}
|
|
71
|
+
transitionMode="swipe"
|
|
72
|
+
openDirection="bottom"
|
|
73
|
+
swipeDismissible={true}
|
|
74
|
+
header={{ title: "Bottom Sheet" }}
|
|
75
|
+
width={400}
|
|
76
|
+
>
|
|
77
|
+
<div className={styles.modalContent}>
|
|
78
|
+
<div className={styles.infoBox}>
|
|
79
|
+
Swipe down to close this modal. The animation has two phases: translate movement followed by a scale-down
|
|
80
|
+
effect.
|
|
81
|
+
</div>
|
|
82
|
+
<p>This modal opens from the bottom and can be dismissed by swiping down.</p>
|
|
83
|
+
<DemoButton variant="secondary" onClick={() => setBottomModal(false)}>
|
|
84
|
+
Close
|
|
85
|
+
</DemoButton>
|
|
86
|
+
</div>
|
|
87
|
+
</Modal>
|
|
88
|
+
|
|
89
|
+
{/* Center Modal */}
|
|
90
|
+
<Modal
|
|
91
|
+
visible={centerModal}
|
|
92
|
+
onClose={() => setCenterModal(false)}
|
|
93
|
+
transitionMode="swipe"
|
|
94
|
+
openDirection="center"
|
|
95
|
+
swipeDismissible={true}
|
|
96
|
+
header={{ title: "Swipeable Modal" }}
|
|
97
|
+
width={400}
|
|
98
|
+
>
|
|
99
|
+
<div className={styles.modalContent}>
|
|
100
|
+
<div className={styles.infoBox}>
|
|
101
|
+
Even centered modals can be dismissed by swiping down. The threshold is 30% of the container height or a
|
|
102
|
+
quick flick.
|
|
103
|
+
</div>
|
|
104
|
+
<p>Try swiping this modal down to dismiss it.</p>
|
|
105
|
+
<DemoButton variant="secondary" onClick={() => setCenterModal(false)}>
|
|
106
|
+
Close
|
|
107
|
+
</DemoButton>
|
|
108
|
+
</div>
|
|
109
|
+
</Modal>
|
|
110
|
+
|
|
111
|
+
{/* Scrollable Content Modal */}
|
|
112
|
+
<Modal
|
|
113
|
+
visible={scrollableModal}
|
|
114
|
+
onClose={() => setScrollableModal(false)}
|
|
115
|
+
transitionMode="swipe"
|
|
116
|
+
openDirection="bottom"
|
|
117
|
+
swipeDismissible={true}
|
|
118
|
+
header={{ title: "Scrollable Content" }}
|
|
119
|
+
width={400}
|
|
120
|
+
height={500}
|
|
121
|
+
>
|
|
122
|
+
<div className={styles.scrollableContent}>
|
|
123
|
+
<div className={styles.infoBox} style={{ marginBottom: "16px" }}>
|
|
124
|
+
Swipe gestures are detected only when NOT scrolling. Try scrolling the content below, then swipe down from
|
|
125
|
+
the header area.
|
|
126
|
+
</div>
|
|
127
|
+
{Array.from({ length: 20 }).map((_, i) => (
|
|
128
|
+
<p key={i} style={{ marginBottom: "12px" }}>
|
|
129
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et
|
|
130
|
+
dolore magna aliqua. Item {i + 1}.
|
|
131
|
+
</p>
|
|
132
|
+
))}
|
|
133
|
+
</div>
|
|
134
|
+
</Modal>
|
|
135
|
+
|
|
136
|
+
{/* Custom Action Sheet */}
|
|
137
|
+
<DialogContainer
|
|
138
|
+
visible={customSheet}
|
|
139
|
+
onClose={() => setCustomSheet(false)}
|
|
140
|
+
transitionMode="swipe"
|
|
141
|
+
openDirection="bottom"
|
|
142
|
+
swipeDismissible={true}
|
|
143
|
+
>
|
|
144
|
+
<div className={styles.actionSheet}>
|
|
145
|
+
<FloatingPanelFrame>
|
|
146
|
+
<FloatingPanelHeader>
|
|
147
|
+
<FloatingPanelTitle>Actions</FloatingPanelTitle>
|
|
148
|
+
</FloatingPanelHeader>
|
|
149
|
+
<FloatingPanelContent style={{ padding: 0 }}>
|
|
150
|
+
<ActionItem icon="📷" label="Take Photo" onClick={() => setCustomSheet(false)} />
|
|
151
|
+
<ActionItem icon="🖼️" label="Choose from Library" onClick={() => setCustomSheet(false)} />
|
|
152
|
+
<ActionItem icon="📁" label="Browse Files" onClick={() => setCustomSheet(false)} />
|
|
153
|
+
<ActionItem icon="❌" label="Cancel" onClick={() => setCustomSheet(false)} isDestructive />
|
|
154
|
+
</FloatingPanelContent>
|
|
155
|
+
</FloatingPanelFrame>
|
|
156
|
+
</div>
|
|
157
|
+
</DialogContainer>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type ActionItemProps = {
|
|
163
|
+
icon: string;
|
|
164
|
+
label: string;
|
|
165
|
+
onClick: () => void;
|
|
166
|
+
isDestructive?: boolean;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const ActionItem: React.FC<ActionItemProps> = ({ icon, label, onClick, isDestructive }) => {
|
|
170
|
+
return (
|
|
171
|
+
<button
|
|
172
|
+
type="button"
|
|
173
|
+
onClick={onClick}
|
|
174
|
+
className={styles.actionItem}
|
|
175
|
+
style={{ color: isDestructive ? "#ef4444" : undefined }}
|
|
176
|
+
>
|
|
177
|
+
<span className={styles.actionIcon}>{icon}</span>
|
|
178
|
+
<span>{label}</span>
|
|
179
|
+
</button>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Dialog - Custom Alert page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { CustomAlertDialogDemo } from "../components/CustomAlertDialogDemo";
|
|
6
|
+
import CustomAlertDialogDemoSource from "../components/CustomAlertDialogDemo.tsx?raw";
|
|
7
|
+
import { SingleSamplePage } from "../../../components/layout";
|
|
8
|
+
|
|
9
|
+
const Page: React.FC = () => {
|
|
10
|
+
return (
|
|
11
|
+
<SingleSamplePage
|
|
12
|
+
title="Dialog / Custom Alert Component"
|
|
13
|
+
code={CustomAlertDialogDemoSource}
|
|
14
|
+
codeTitle="CustomAlertDialogDemo.tsx"
|
|
15
|
+
previewHeight={520}
|
|
16
|
+
>
|
|
17
|
+
<CustomAlertDialogDemo />
|
|
18
|
+
</SingleSamplePage>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Page;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Dialog - Modal page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { ModalBasics } from "../components/ModalBasics";
|
|
6
|
+
import ModalBasicsSource from "../components/ModalBasics.tsx?raw";
|
|
7
|
+
import { SingleSamplePage } from "../../../components/layout";
|
|
8
|
+
|
|
9
|
+
const Page: React.FC = () => {
|
|
10
|
+
return (
|
|
11
|
+
<SingleSamplePage title="Dialog / Modal" code={ModalBasicsSource} codeTitle="ModalBasics.tsx" previewHeight={480}>
|
|
12
|
+
<ModalBasics />
|
|
13
|
+
</SingleSamplePage>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default Page;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Dialog - Swipe Dismiss page
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { SwipeDialogDemo } from "../components/SwipeDialogDemo.js";
|
|
6
|
+
import SwipeDialogDemoSource from "../components/SwipeDialogDemo.tsx?raw";
|
|
7
|
+
import { SingleSamplePage } from "../../../components/layout/index.js";
|
|
8
|
+
|
|
9
|
+
const Page: React.FC = () => {
|
|
10
|
+
return (
|
|
11
|
+
<SingleSamplePage
|
|
12
|
+
title="Dialog / Swipe Dismiss"
|
|
13
|
+
code={SwipeDialogDemoSource}
|
|
14
|
+
codeTitle="SwipeDialogDemo.tsx"
|
|
15
|
+
previewHeight={600}
|
|
16
|
+
>
|
|
17
|
+
<SwipeDialogDemo />
|
|
18
|
+
</SingleSamplePage>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Page;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.wrapper {
|
|
2
2
|
position: relative;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
box-shadow: var(--rpl-demo-shadow-md);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
.container {
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
.hero {
|
|
13
18
|
display: grid;
|
|
14
19
|
place-items: center;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Basic drawer layout sample (default Drawer styling)
|
|
2
|
+
* @file Basic drawer layout sample (default Drawer styling with swipe gestures)
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { GridLayout } from "../../../../components/grid/GridLayout";
|
|
@@ -31,8 +31,7 @@ export const DrawerBasics: React.FC = () => {
|
|
|
31
31
|
Open drawer
|
|
32
32
|
</DemoButton>
|
|
33
33
|
<p className={styles.lead}>
|
|
34
|
-
|
|
35
|
-
uses the built-in header/close affordance.
|
|
34
|
+
Swipe from the left edge to open the drawer, or drag the drawer left to close it.
|
|
36
35
|
</p>
|
|
37
36
|
</div>
|
|
38
37
|
</div>
|
|
@@ -63,7 +62,14 @@ export const DrawerBasics: React.FC = () => {
|
|
|
63
62
|
open,
|
|
64
63
|
onStateChange: setOpen,
|
|
65
64
|
dismissible: true,
|
|
65
|
+
inline: true,
|
|
66
66
|
header: { title: "Navigation" },
|
|
67
|
+
swipeGestures: {
|
|
68
|
+
edgeSwipeOpen: true,
|
|
69
|
+
swipeClose: true,
|
|
70
|
+
edgeWidth: 24,
|
|
71
|
+
dismissThreshold: 0.3,
|
|
72
|
+
},
|
|
67
73
|
},
|
|
68
74
|
position: { left: 0 },
|
|
69
75
|
width: 320,
|
|
@@ -72,5 +78,9 @@ export const DrawerBasics: React.FC = () => {
|
|
|
72
78
|
},
|
|
73
79
|
];
|
|
74
80
|
|
|
75
|
-
return
|
|
81
|
+
return (
|
|
82
|
+
<div className={styles.wrapper}>
|
|
83
|
+
<GridLayout config={config} layers={layers} />
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
76
86
|
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Styles for DrawerReveal demo
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
height: 100%;
|
|
9
|
+
padding: 24px;
|
|
10
|
+
background: #fff;
|
|
11
|
+
color: #0f1419;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.hero {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: 16px;
|
|
18
|
+
max-width: 480px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.lead {
|
|
22
|
+
color: #536471;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
line-height: 1.6;
|
|
25
|
+
margin: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.instructions {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
gap: 12px;
|
|
32
|
+
margin-top: 24px;
|
|
33
|
+
padding: 16px;
|
|
34
|
+
background: #f7f9f9;
|
|
35
|
+
border-radius: 16px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.instruction {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 12px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
color: #536471;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.instructionIcon {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
width: 28px;
|
|
51
|
+
height: 28px;
|
|
52
|
+
background: #1d9bf0;
|
|
53
|
+
border-radius: 50%;
|
|
54
|
+
color: #fff;
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.fullscreenLink {
|
|
60
|
+
display: inline-block;
|
|
61
|
+
margin-top: 12px;
|
|
62
|
+
padding: 10px 20px;
|
|
63
|
+
background: #1d9bf0;
|
|
64
|
+
color: #fff;
|
|
65
|
+
border-radius: 9999px;
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
transition: background 0.15s ease;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.fullscreenLink:hover {
|
|
73
|
+
background: #1a8cd8;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.drawerContent {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
height: 100%;
|
|
80
|
+
padding: 16px;
|
|
81
|
+
background: #fff;
|
|
82
|
+
border-right: 1px solid #eff3f4;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.profile {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: 12px;
|
|
89
|
+
padding: 12px 0;
|
|
90
|
+
border-bottom: 1px solid #eff3f4;
|
|
91
|
+
margin-bottom: 8px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.avatar {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
width: 40px;
|
|
99
|
+
height: 40px;
|
|
100
|
+
background: #1d9bf0;
|
|
101
|
+
border-radius: 50%;
|
|
102
|
+
color: #fff;
|
|
103
|
+
font-size: 18px;
|
|
104
|
+
font-weight: 700;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.profileInfo {
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
gap: 2px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.profileName {
|
|
114
|
+
font-size: 15px;
|
|
115
|
+
font-weight: 700;
|
|
116
|
+
color: #0f1419;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.profileHandle {
|
|
120
|
+
font-size: 13px;
|
|
121
|
+
color: #536471;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nav {
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
gap: 4px;
|
|
128
|
+
flex: 1;
|
|
129
|
+
padding: 8px 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.navItem {
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
gap: 16px;
|
|
136
|
+
padding: 12px;
|
|
137
|
+
border-radius: 9999px;
|
|
138
|
+
color: #0f1419;
|
|
139
|
+
font-size: 20px;
|
|
140
|
+
font-weight: 500;
|
|
141
|
+
text-decoration: none;
|
|
142
|
+
transition: background 0.2s ease;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.navItem:hover {
|
|
146
|
+
background: #e7e7e8;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.navIcon {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
width: 26px;
|
|
154
|
+
height: 26px;
|
|
155
|
+
font-size: 14px;
|
|
156
|
+
font-weight: 700;
|
|
157
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Reveal mode drawer demo
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates the reveal animation mode where content slides away
|
|
5
|
+
* to reveal the drawer behind it (like X/Twitter's navigation menu).
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { Link } from "react-router";
|
|
9
|
+
import { GridLayout } from "../../../../components/grid/GridLayout";
|
|
10
|
+
import type { LayerDefinition, PanelLayoutConfig } from "../../../../types";
|
|
11
|
+
import { DemoButton } from "../../../components/ui/DemoButton";
|
|
12
|
+
import styles from "./DrawerReveal.module.css";
|
|
13
|
+
|
|
14
|
+
export const DrawerReveal: React.FC = () => {
|
|
15
|
+
const [open, setOpen] = React.useState(false);
|
|
16
|
+
|
|
17
|
+
const config = React.useMemo<PanelLayoutConfig>(
|
|
18
|
+
() => ({
|
|
19
|
+
areas: [["content"]],
|
|
20
|
+
rows: [{ size: "1fr" }],
|
|
21
|
+
columns: [{ size: "1fr" }],
|
|
22
|
+
gap: "0",
|
|
23
|
+
}),
|
|
24
|
+
[],
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const layers: LayerDefinition[] = [
|
|
28
|
+
{
|
|
29
|
+
id: "content",
|
|
30
|
+
gridArea: "content",
|
|
31
|
+
component: (
|
|
32
|
+
<div className={styles.container}>
|
|
33
|
+
<div className={styles.hero}>
|
|
34
|
+
<DemoButton variant="primary" size="lg" onClick={() => setOpen(true)}>
|
|
35
|
+
Open drawer
|
|
36
|
+
</DemoButton>
|
|
37
|
+
<p className={styles.lead}>
|
|
38
|
+
This demo shows the reveal animation mode with <code>inline: true</code>. The container slides to reveal
|
|
39
|
+
the drawer behind it, similar to X/Twitter's navigation menu.
|
|
40
|
+
</p>
|
|
41
|
+
<Link to="/fullscreen/drawer-reveal" className={styles.fullscreenLink} target="_blank">
|
|
42
|
+
View Fullscreen Demo
|
|
43
|
+
</Link>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div className={styles.instructions}>
|
|
47
|
+
<div className={styles.instruction}>
|
|
48
|
+
<span className={styles.instructionIcon}>1</span>
|
|
49
|
+
<span>Swipe from the left edge to open</span>
|
|
50
|
+
</div>
|
|
51
|
+
<div className={styles.instruction}>
|
|
52
|
+
<span className={styles.instructionIcon}>2</span>
|
|
53
|
+
<span>Content slides right to reveal drawer</span>
|
|
54
|
+
</div>
|
|
55
|
+
<div className={styles.instruction}>
|
|
56
|
+
<span className={styles.instructionIcon}>3</span>
|
|
57
|
+
<span>Swipe left on content to close</span>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "drawer-reveal",
|
|
65
|
+
component: (
|
|
66
|
+
<div className={styles.drawerContent}>
|
|
67
|
+
<div className={styles.profile}>
|
|
68
|
+
<div className={styles.avatar}>U</div>
|
|
69
|
+
<div className={styles.profileInfo}>
|
|
70
|
+
<div className={styles.profileName}>User Name</div>
|
|
71
|
+
<div className={styles.profileHandle}>@username</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<nav className={styles.nav}>
|
|
76
|
+
<a href="#" className={styles.navItem}>
|
|
77
|
+
<span className={styles.navIcon}>H</span>
|
|
78
|
+
Home
|
|
79
|
+
</a>
|
|
80
|
+
<a href="#" className={styles.navItem}>
|
|
81
|
+
<span className={styles.navIcon}>S</span>
|
|
82
|
+
Search
|
|
83
|
+
</a>
|
|
84
|
+
<a href="#" className={styles.navItem}>
|
|
85
|
+
<span className={styles.navIcon}>N</span>
|
|
86
|
+
Notifications
|
|
87
|
+
</a>
|
|
88
|
+
<a href="#" className={styles.navItem}>
|
|
89
|
+
<span className={styles.navIcon}>M</span>
|
|
90
|
+
Messages
|
|
91
|
+
</a>
|
|
92
|
+
<a href="#" className={styles.navItem}>
|
|
93
|
+
<span className={styles.navIcon}>P</span>
|
|
94
|
+
Profile
|
|
95
|
+
</a>
|
|
96
|
+
<a href="#" className={styles.navItem}>
|
|
97
|
+
<span className={styles.navIcon}>C</span>
|
|
98
|
+
Settings
|
|
99
|
+
</a>
|
|
100
|
+
</nav>
|
|
101
|
+
|
|
102
|
+
<DemoButton variant="secondary" size="md" onClick={() => setOpen(false)}>
|
|
103
|
+
Close
|
|
104
|
+
</DemoButton>
|
|
105
|
+
</div>
|
|
106
|
+
),
|
|
107
|
+
drawer: {
|
|
108
|
+
open,
|
|
109
|
+
onStateChange: setOpen,
|
|
110
|
+
dismissible: true,
|
|
111
|
+
animationMode: "reveal",
|
|
112
|
+
inline: true,
|
|
113
|
+
swipeGestures: {
|
|
114
|
+
edgeSwipeOpen: true,
|
|
115
|
+
swipeClose: true,
|
|
116
|
+
edgeWidth: 24,
|
|
117
|
+
dismissThreshold: 0.3,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
position: { left: 0 },
|
|
121
|
+
width: 280,
|
|
122
|
+
height: "100%",
|
|
123
|
+
zIndex: 1200,
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
return <GridLayout config={config} layers={layers} />;
|
|
128
|
+
};
|