react-panel-layout 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/dist/{FloatingPanelFrame-SgYLc6Ud.js → FloatingPanelFrame-3eU9AwPo.js} +2 -2
  2. package/dist/{FloatingPanelFrame-SgYLc6Ud.js.map → FloatingPanelFrame-3eU9AwPo.js.map} +1 -1
  3. package/dist/FloatingWindow-CUXnEtrb.js +827 -0
  4. package/dist/FloatingWindow-CUXnEtrb.js.map +1 -0
  5. package/dist/FloatingWindow-DMwyK0eK.cjs +2 -0
  6. package/dist/FloatingWindow-DMwyK0eK.cjs.map +1 -0
  7. package/dist/GridLayout-DKTg_N61.cjs +2 -0
  8. package/dist/{GridLayout-B4VRsC0r.cjs.map → GridLayout-DKTg_N61.cjs.map} +1 -1
  9. package/dist/{GridLayout-BltqeCPK.js → GridLayout-UWNxXw77.js} +34 -35
  10. package/dist/{GridLayout-BltqeCPK.js.map → GridLayout-UWNxXw77.js.map} +1 -1
  11. package/dist/{HorizontalDivider-WF1k_qND.js → HorizontalDivider-DdxzfV0l.js} +3 -3
  12. package/dist/{HorizontalDivider-WF1k_qND.js.map → HorizontalDivider-DdxzfV0l.js.map} +1 -1
  13. package/dist/{HorizontalDivider-B5Z-KZLk.cjs → HorizontalDivider-_pgV4Mcv.cjs} +2 -2
  14. package/dist/{HorizontalDivider-B5Z-KZLk.cjs.map → HorizontalDivider-_pgV4Mcv.cjs.map} +1 -1
  15. package/dist/{PanelSystem-Dr1TBhxM.js → PanelSystem-BqUzNtf2.js} +5 -5
  16. package/dist/{PanelSystem-Dr1TBhxM.js.map → PanelSystem-BqUzNtf2.js.map} +1 -1
  17. package/dist/{PanelSystem-Bs8bQwQF.cjs → PanelSystem-D603LKKv.cjs} +2 -2
  18. package/dist/{PanelSystem-Bs8bQwQF.cjs.map → PanelSystem-D603LKKv.cjs.map} +1 -1
  19. package/dist/ResizeHandle-CBcAS918.cjs +2 -0
  20. package/dist/{ResizeHandle-CScipO5l.cjs.map → ResizeHandle-CBcAS918.cjs.map} +1 -1
  21. package/dist/{ResizeHandle-CdA_JYfN.js → ResizeHandle-CXjc1meV.js} +28 -29
  22. package/dist/{ResizeHandle-CdA_JYfN.js.map → ResizeHandle-CXjc1meV.js.map} +1 -1
  23. package/dist/SwipePivotTabBar-DWrCuwEI.js +411 -0
  24. package/dist/SwipePivotTabBar-DWrCuwEI.js.map +1 -0
  25. package/dist/SwipePivotTabBar-fjjXkpj7.cjs +2 -0
  26. package/dist/SwipePivotTabBar-fjjXkpj7.cjs.map +1 -0
  27. package/dist/components/gesture/SwipeSafeZone.d.ts +40 -0
  28. package/dist/components/window/Drawer.d.ts +3 -1
  29. package/dist/components/window/DrawerLayers.d.ts +1 -1
  30. package/dist/components/window/drawerStyles.d.ts +69 -0
  31. package/dist/components/window/drawerSwipeConfig.d.ts +29 -0
  32. package/dist/components/window/useDrawerSwipeTransform.d.ts +23 -0
  33. package/dist/config.cjs +1 -1
  34. package/dist/config.js +3 -3
  35. package/dist/constants/styles.d.ts +17 -0
  36. package/dist/dialog/index.d.ts +69 -0
  37. package/dist/floating.js +1 -1
  38. package/dist/grid.cjs +1 -1
  39. package/dist/grid.js +2 -2
  40. package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +7 -0
  41. package/dist/hooks/gesture/types.d.ts +48 -5
  42. package/dist/hooks/gesture/utils.d.ts +19 -0
  43. package/dist/hooks/useAnimationFrame.d.ts +2 -0
  44. package/dist/hooks/useOperationContinuity.d.ts +64 -0
  45. package/dist/hooks/useResizeObserver.d.ts +33 -1
  46. package/dist/hooks/useSharedElementTransition.d.ts +112 -0
  47. package/dist/hooks/useSwipeContentTransform.d.ts +9 -2
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.js +7 -7
  50. package/dist/modules/dialog/AlertDialog.d.ts +9 -0
  51. package/dist/modules/dialog/DialogContainer.d.ts +37 -0
  52. package/dist/modules/dialog/Modal.d.ts +26 -0
  53. package/dist/modules/dialog/SwipeDialogContainer.d.ts +16 -0
  54. package/dist/modules/dialog/dialogAnimationUtils.d.ts +113 -0
  55. package/dist/modules/dialog/types.d.ts +183 -0
  56. package/dist/modules/dialog/useDialog.d.ts +39 -0
  57. package/dist/modules/dialog/useDialogContainer.d.ts +47 -0
  58. package/dist/modules/dialog/useDialogSwipeInput.d.ts +70 -0
  59. package/dist/modules/dialog/useDialogTransform.d.ts +82 -0
  60. package/dist/modules/drawer/types.d.ts +74 -0
  61. package/dist/modules/drawer/useDrawerSwipeInput.d.ts +24 -0
  62. package/dist/modules/pivot/SwipePivotTabBar.d.ts +3 -0
  63. package/dist/modules/stack/SwipeStackContent.d.ts +6 -3
  64. package/dist/modules/stack/SwipeStackOutlet.d.ts +4 -4
  65. package/dist/modules/stack/computeSwipeStackTransform.d.ts +1 -1
  66. package/dist/panels.cjs +1 -1
  67. package/dist/panels.js +1 -1
  68. package/dist/pivot.cjs +1 -1
  69. package/dist/pivot.js +1 -1
  70. package/dist/resizer.cjs +1 -1
  71. package/dist/resizer.js +2 -2
  72. package/dist/stack.cjs +1 -1
  73. package/dist/stack.cjs.map +1 -1
  74. package/dist/stack.js +503 -762
  75. package/dist/stack.js.map +1 -1
  76. package/dist/sticky-header/calculateStickyMetrics.d.ts +28 -0
  77. package/dist/sticky-header.cjs +1 -1
  78. package/dist/sticky-header.cjs.map +1 -1
  79. package/dist/sticky-header.js +59 -51
  80. package/dist/sticky-header.js.map +1 -1
  81. package/dist/{styles-DPPuJ0sf.js → styles-NkjuMOVS.js} +13 -13
  82. package/dist/{styles-DPPuJ0sf.js.map → styles-NkjuMOVS.js.map} +1 -1
  83. package/dist/styles-qf6ptVLD.cjs.map +1 -1
  84. package/dist/types.d.ts +16 -0
  85. package/dist/useDocumentPointerEvents-DXxw3qWj.js +54 -0
  86. package/dist/useDocumentPointerEvents-DXxw3qWj.js.map +1 -0
  87. package/dist/useDocumentPointerEvents-DxDSOtip.cjs +2 -0
  88. package/dist/useDocumentPointerEvents-DxDSOtip.cjs.map +1 -0
  89. package/dist/useNativeGestureGuard-C7TSqEkr.cjs +2 -0
  90. package/dist/useNativeGestureGuard-C7TSqEkr.cjs.map +1 -0
  91. package/dist/useNativeGestureGuard-CGYo6O0r.js +347 -0
  92. package/dist/useNativeGestureGuard-CGYo6O0r.js.map +1 -0
  93. package/dist/window/index.d.ts +2 -0
  94. package/dist/window.cjs +1 -1
  95. package/dist/window.cjs.map +1 -1
  96. package/dist/window.js +114 -103
  97. package/dist/window.js.map +1 -1
  98. package/package.json +6 -1
  99. package/src/components/gesture/SwipeSafeZone.tsx +69 -0
  100. package/src/components/window/Drawer.tsx +249 -162
  101. package/src/components/window/DrawerLayers.tsx +13 -3
  102. package/src/components/window/drawerStyles.spec.ts +263 -0
  103. package/src/components/window/drawerStyles.ts +228 -0
  104. package/src/components/window/drawerSwipeConfig.spec.ts +131 -0
  105. package/src/components/window/drawerSwipeConfig.ts +112 -0
  106. package/src/components/window/useDrawerSwipeTransform.spec.ts +234 -0
  107. package/src/components/window/useDrawerSwipeTransform.ts +129 -0
  108. package/src/constants/styles.ts +19 -0
  109. package/src/demo/pages/Dialog/alerts/index.tsx +22 -0
  110. package/src/demo/pages/Dialog/card/index.tsx +22 -0
  111. package/src/demo/pages/Dialog/components/AlertDialogDemo.tsx +124 -0
  112. package/src/demo/pages/Dialog/components/CardExpandDemo.module.css +243 -0
  113. package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +204 -0
  114. package/src/demo/pages/Dialog/components/CustomAlertDialogDemo.tsx +219 -0
  115. package/src/demo/pages/Dialog/components/DialogDemos.module.css +77 -0
  116. package/src/demo/pages/Dialog/components/ModalBasics.tsx +45 -0
  117. package/src/demo/pages/Dialog/components/SwipeDialogDemo.module.css +77 -0
  118. package/src/demo/pages/Dialog/components/SwipeDialogDemo.tsx +181 -0
  119. package/src/demo/pages/Dialog/custom-alert/index.tsx +22 -0
  120. package/src/demo/pages/Dialog/modal/index.tsx +17 -0
  121. package/src/demo/pages/Dialog/swipe/index.tsx +22 -0
  122. package/src/demo/pages/Drawer/components/DrawerSwipe.module.css +316 -0
  123. package/src/demo/pages/Drawer/components/DrawerSwipe.tsx +178 -0
  124. package/src/demo/pages/Drawer/swipe/index.tsx +17 -0
  125. package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +54 -23
  126. package/src/demo/pages/Pivot/swipe-debug/index.tsx +1 -1
  127. package/src/demo/pages/Stack/components/StackBasics.spec.tsx +152 -0
  128. package/src/demo/pages/Stack/components/StackBasics.tsx +179 -95
  129. package/src/demo/pages/Stack/components/StackTablet.spec.tsx +120 -0
  130. package/src/demo/pages/Stack/components/StackTablet.tsx +42 -21
  131. package/src/demo/routes.tsx +22 -1
  132. package/src/dialog/index.ts +85 -0
  133. package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +68 -64
  134. package/src/hooks/gesture/testing/createGestureSimulator.ts +112 -37
  135. package/src/hooks/gesture/types.ts +83 -6
  136. package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +22 -14
  137. package/src/hooks/gesture/useNativeGestureGuard.spec.ts +91 -31
  138. package/src/hooks/gesture/useNativeGestureGuard.ts +3 -1
  139. package/src/hooks/gesture/utils.ts +91 -0
  140. package/src/hooks/useAnimatedVisibility.spec.ts +44 -24
  141. package/src/hooks/useAnimatedVisibility.ts +28 -2
  142. package/src/hooks/useAnimationFrame.ts +8 -0
  143. package/src/hooks/useOperationContinuity.spec.ts +387 -0
  144. package/src/hooks/useOperationContinuity.ts +135 -0
  145. package/src/hooks/useResizeObserver.spec.tsx +277 -0
  146. package/src/hooks/useResizeObserver.tsx +108 -39
  147. package/src/hooks/useScrollContainer.ts +4 -10
  148. package/src/hooks/useSharedElementTransition.ts +333 -0
  149. package/src/hooks/useSwipeContentTransform.spec.ts +18 -18
  150. package/src/hooks/useSwipeContentTransform.ts +166 -28
  151. package/src/modules/dialog/AlertDialog.spec.tsx +387 -0
  152. package/src/modules/dialog/AlertDialog.tsx +221 -0
  153. package/src/modules/dialog/DialogContainer.spec.tsx +228 -0
  154. package/src/modules/dialog/DialogContainer.tsx +188 -0
  155. package/src/modules/dialog/Modal.spec.tsx +220 -0
  156. package/src/modules/dialog/Modal.tsx +182 -0
  157. package/src/modules/dialog/SwipeDialogContainer.tsx +208 -0
  158. package/src/modules/dialog/dialogAnimationUtils.spec.ts +253 -0
  159. package/src/modules/dialog/dialogAnimationUtils.ts +297 -0
  160. package/src/modules/dialog/types.ts +186 -0
  161. package/src/modules/dialog/useDialog.spec.tsx +447 -0
  162. package/src/modules/dialog/useDialog.ts +214 -0
  163. package/src/modules/dialog/useDialogContainer.spec.ts +331 -0
  164. package/src/modules/dialog/useDialogContainer.ts +150 -0
  165. package/src/modules/dialog/useDialogSwipeInput.spec.ts +157 -0
  166. package/src/modules/dialog/useDialogSwipeInput.ts +319 -0
  167. package/src/modules/dialog/useDialogTransform.spec.ts +370 -0
  168. package/src/modules/dialog/useDialogTransform.ts +407 -0
  169. package/src/modules/drawer/types.ts +102 -0
  170. package/src/modules/drawer/useDrawerSwipeInput.spec.ts +566 -0
  171. package/src/modules/drawer/useDrawerSwipeInput.ts +399 -0
  172. package/src/modules/panels/rendering/ContentRegistry.spec.tsx +21 -14
  173. package/src/modules/pivot/SwipePivotContent.position.spec.tsx +12 -8
  174. package/src/modules/pivot/SwipePivotContent.spec.tsx +55 -25
  175. package/src/modules/pivot/SwipePivotContent.tsx +2 -2
  176. package/src/modules/pivot/SwipePivotTabBar.spec.tsx +85 -68
  177. package/src/modules/pivot/SwipePivotTabBar.tsx +75 -15
  178. package/src/modules/pivot/scaleInputState.spec.ts +11 -2
  179. package/src/modules/pivot/usePivot.spec.ts +17 -3
  180. package/src/modules/pivot/usePivotSwipeInput.spec.ts +182 -123
  181. package/src/modules/stack/SwipeStackContent.spec.tsx +387 -100
  182. package/src/modules/stack/SwipeStackContent.tsx +43 -33
  183. package/src/modules/stack/SwipeStackOutlet.spec.tsx +14 -16
  184. package/src/modules/stack/SwipeStackOutlet.tsx +6 -6
  185. package/src/modules/stack/computeSwipeStackTransform.spec.ts +5 -5
  186. package/src/modules/stack/computeSwipeStackTransform.ts +3 -3
  187. package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1133 -0
  188. package/src/modules/stack/useStackAnimationState.spec.ts +3 -1
  189. package/src/modules/stack/useStackAnimationState.ts +18 -13
  190. package/src/modules/stack/useStackNavigation.spec.ts +198 -3
  191. package/src/modules/stack/useStackNavigation.tsx +113 -56
  192. package/src/modules/stack/useStackSwipeInput.spec.ts +65 -32
  193. package/src/modules/stack/useStackSwipeInput.ts +1 -1
  194. package/src/sticky-header/StickyArea.tsx +29 -57
  195. package/src/sticky-header/calculateStickyMetrics.spec.ts +105 -0
  196. package/src/sticky-header/calculateStickyMetrics.ts +50 -0
  197. package/src/types.ts +18 -0
  198. package/src/window/index.ts +2 -0
  199. package/dist/FloatingWindow-BpdOpg_L.js +0 -400
  200. package/dist/FloatingWindow-BpdOpg_L.js.map +0 -1
  201. package/dist/FloatingWindow-TCDNY5gE.cjs +0 -2
  202. package/dist/FloatingWindow-TCDNY5gE.cjs.map +0 -1
  203. package/dist/GridLayout-B4VRsC0r.cjs +0 -2
  204. package/dist/ResizeHandle-CScipO5l.cjs +0 -2
  205. package/dist/SwipePivotTabBar-BGO9X94m.js +0 -407
  206. package/dist/SwipePivotTabBar-BGO9X94m.js.map +0 -1
  207. package/dist/SwipePivotTabBar-BrQismcZ.cjs +0 -2
  208. package/dist/SwipePivotTabBar-BrQismcZ.cjs.map +0 -1
  209. package/dist/useDocumentPointerEvents-CKdhGXd0.js +0 -46
  210. package/dist/useDocumentPointerEvents-CKdhGXd0.js.map +0 -1
  211. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs +0 -2
  212. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs.map +0 -1
  213. package/dist/useEffectEvent-Dp7HLCf0.js +0 -13
  214. package/dist/useEffectEvent-Dp7HLCf0.js.map +0 -1
  215. package/dist/useEffectEvent-huSsGUnl.cjs +0 -2
  216. package/dist/useEffectEvent-huSsGUnl.cjs.map +0 -1
@@ -0,0 +1,183 @@
1
+ /**
2
+ * @file Dialog module type definitions
3
+ */
4
+ import type * as React from "react";
5
+ import type { Position } from "../../types";
6
+ /**
7
+ * Transition mode for dialog animations
8
+ * - "none": No animation
9
+ * - "css": CSS-based fade/scale animation
10
+ * - "swipe": Swipeable with multi-phase animation
11
+ */
12
+ export type DialogTransitionMode = "none" | "css" | "swipe";
13
+ /**
14
+ * Direction from which the dialog opens.
15
+ * The close animation uses the same direction (swipe down to close if opened from bottom).
16
+ */
17
+ export type DialogOpenDirection = "center" | "top" | "bottom" | "left" | "right";
18
+ /**
19
+ * Base props for DialogContainer component
20
+ */
21
+ export type DialogContainerProps = {
22
+ /** Whether the dialog is visible */
23
+ visible: boolean;
24
+ /** Callback when dialog should close */
25
+ onClose: () => void;
26
+ /** Dialog content */
27
+ children: React.ReactNode;
28
+ /** Position: 'center' for screen center, or Position for absolute coordinates */
29
+ position?: "center" | Position;
30
+ /** Whether clicking backdrop closes the dialog */
31
+ dismissible?: boolean;
32
+ /** Whether pressing Escape closes the dialog */
33
+ closeOnEscape?: boolean;
34
+ /** Whether to prevent body scroll when open */
35
+ preventBodyScroll?: boolean;
36
+ /** Whether to return focus to previous element on close */
37
+ returnFocus?: boolean;
38
+ /** Aria label for the dialog */
39
+ ariaLabel?: string;
40
+ /** ID of element that labels the dialog */
41
+ ariaLabelledBy?: string;
42
+ /** ID of element that describes the dialog */
43
+ ariaDescribedBy?: string;
44
+ /** Transition mode */
45
+ transitionMode?: DialogTransitionMode;
46
+ /** Transition duration (CSS value, e.g. '200ms') */
47
+ transitionDuration?: string;
48
+ /** Transition easing (CSS value, e.g. 'ease-out') */
49
+ transitionEasing?: string;
50
+ /** Whether the dialog can be dismissed by swiping. @default false for "css", true for "swipe" */
51
+ swipeDismissible?: boolean;
52
+ /** Direction the dialog opens from (used for swipe mode). @default "center" */
53
+ openDirection?: DialogOpenDirection;
54
+ /** Whether to use viewTransition API for close animation (when available). @default false */
55
+ useViewTransition?: boolean;
56
+ };
57
+ /**
58
+ * Header configuration for Modal
59
+ */
60
+ export type ModalHeader = {
61
+ /** Title displayed in the header */
62
+ title: string;
63
+ /** Whether to show close button (default: true) */
64
+ showCloseButton?: boolean;
65
+ };
66
+ /**
67
+ * Props for Modal component
68
+ */
69
+ export type ModalProps = Omit<DialogContainerProps, "position"> & {
70
+ /** Header configuration */
71
+ header?: ModalHeader;
72
+ /** Modal width */
73
+ width?: string | number;
74
+ /** Modal height */
75
+ height?: string | number;
76
+ /** Max width (default: 90vw) */
77
+ maxWidth?: string | number;
78
+ /** Max height (default: 85vh) */
79
+ maxHeight?: string | number;
80
+ /** Whether to use FloatingPanelFrame chrome (default: true) */
81
+ chrome?: boolean;
82
+ /** Custom content style */
83
+ contentStyle?: React.CSSProperties;
84
+ };
85
+ /**
86
+ * Options for alert dialog
87
+ */
88
+ export type AlertOptions = {
89
+ /** Optional title */
90
+ title?: string;
91
+ /** Message to display */
92
+ message: string;
93
+ /** OK button label (default: 'OK') */
94
+ okLabel?: string;
95
+ };
96
+ /**
97
+ * Options for confirm dialog
98
+ */
99
+ export type ConfirmOptions = AlertOptions & {
100
+ /** Confirm button label (default: 'OK') */
101
+ confirmLabel?: string;
102
+ /** Cancel button label (default: 'Cancel') */
103
+ cancelLabel?: string;
104
+ };
105
+ /**
106
+ * Options for prompt dialog
107
+ */
108
+ export type PromptOptions = ConfirmOptions & {
109
+ /** Default input value */
110
+ defaultValue?: string;
111
+ /** Placeholder text for input */
112
+ placeholder?: string;
113
+ /** Input type (default: 'text') */
114
+ inputType?: "text" | "password" | "email" | "number";
115
+ };
116
+ /**
117
+ * Internal state for dialog queue
118
+ */
119
+ export type DialogQueueItem = {
120
+ type: "alert";
121
+ options: AlertOptions;
122
+ resolve: (value: void) => void;
123
+ } | {
124
+ type: "confirm";
125
+ options: ConfirmOptions;
126
+ resolve: (value: boolean) => void;
127
+ } | {
128
+ type: "prompt";
129
+ options: PromptOptions;
130
+ resolve: (value: string | null) => void;
131
+ };
132
+ /**
133
+ * Return type of useDialog hook
134
+ */
135
+ export type UseDialogReturn = {
136
+ /** Show an alert dialog */
137
+ alert: (options: AlertOptions | string) => Promise<void>;
138
+ /** Show a confirm dialog */
139
+ confirm: (options: ConfirmOptions | string) => Promise<boolean>;
140
+ /** Show a prompt dialog */
141
+ prompt: (options: PromptOptions | string) => Promise<string | null>;
142
+ /** Outlet component to render dialogs */
143
+ Outlet: React.FC;
144
+ };
145
+ /**
146
+ * Props for useDialog hook
147
+ */
148
+ export type UseDialogProps = {
149
+ /**
150
+ * Custom component to render alert/confirm/prompt dialogs.
151
+ * When provided, replaces the default AlertDialog component.
152
+ */
153
+ alertDialogComponent?: React.ComponentType<AlertDialogProps>;
154
+ };
155
+ /**
156
+ * Props for AlertDialog component (internal)
157
+ */
158
+ export type AlertDialogProps = {
159
+ /** Dialog type */
160
+ type: "alert" | "confirm" | "prompt";
161
+ /** Whether the dialog is visible */
162
+ visible: boolean;
163
+ /** Title */
164
+ title?: string;
165
+ /** Message */
166
+ message: string;
167
+ /** OK/Confirm button label */
168
+ confirmLabel?: string;
169
+ /** Cancel button label */
170
+ cancelLabel?: string;
171
+ /** Placeholder for prompt input */
172
+ placeholder?: string;
173
+ /** Default value for prompt input */
174
+ defaultValue?: string;
175
+ /** Input type for prompt */
176
+ inputType?: "text" | "password" | "email" | "number";
177
+ /** Callback for confirm/OK action */
178
+ onConfirm: (value?: string) => void;
179
+ /** Callback for cancel action */
180
+ onCancel: () => void;
181
+ /** Whether the dialog can be dismissed by swiping. @default false for alert, true for confirm/prompt */
182
+ swipeDismissible?: boolean;
183
+ };
@@ -0,0 +1,39 @@
1
+ import type { UseDialogReturn, UseDialogProps } from "./types";
2
+ /**
3
+ * Hook for imperative alert/confirm/prompt dialogs.
4
+ *
5
+ * Returns functions to show dialogs and an Outlet component that must be rendered.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * function MyComponent() {
10
+ * const { alert, confirm, prompt, Outlet } = useDialog();
11
+ *
12
+ * const handleClick = async () => {
13
+ * await alert("Hello!");
14
+ *
15
+ * const confirmed = await confirm({
16
+ * message: "Are you sure?",
17
+ * confirmLabel: "Yes",
18
+ * cancelLabel: "No",
19
+ * });
20
+ *
21
+ * if (confirmed) {
22
+ * const name = await prompt({
23
+ * message: "Enter your name:",
24
+ * defaultValue: "Anonymous",
25
+ * });
26
+ * console.log("Name:", name);
27
+ * }
28
+ * };
29
+ *
30
+ * return (
31
+ * <>
32
+ * <button onClick={handleClick}>Show dialogs</button>
33
+ * <Outlet />
34
+ * </>
35
+ * );
36
+ * }
37
+ * ```
38
+ */
39
+ export declare const useDialog: (props?: UseDialogProps) => UseDialogReturn;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @file Hook for managing dialog element lifecycle
3
+ */
4
+ import * as React from "react";
5
+ export type UseDialogContainerOptions = {
6
+ /** Whether the dialog is visible */
7
+ visible: boolean;
8
+ /** Callback when dialog should close */
9
+ onClose: () => void;
10
+ /** Whether clicking backdrop closes the dialog (default: true) */
11
+ dismissible?: boolean;
12
+ /** Whether pressing Escape closes the dialog (default: true) */
13
+ closeOnEscape?: boolean;
14
+ /** Whether to return focus to previous element on close (default: true) */
15
+ returnFocus?: boolean;
16
+ /** Whether to prevent body scroll when open (default: true) */
17
+ preventBodyScroll?: boolean;
18
+ };
19
+ export type UseDialogContainerReturn = {
20
+ /** Ref to attach to the dialog element */
21
+ dialogRef: React.RefObject<HTMLDialogElement | null>;
22
+ /** Props to spread onto the dialog element */
23
+ dialogProps: {
24
+ onCancel: (event: React.SyntheticEvent) => void;
25
+ onClick: (event: React.MouseEvent<HTMLDialogElement>) => void;
26
+ };
27
+ };
28
+ /**
29
+ * Hook for managing native dialog element lifecycle
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * function MyDialog({ visible, onClose }) {
34
+ * const { dialogRef, dialogProps } = useDialogContainer({
35
+ * visible,
36
+ * onClose,
37
+ * });
38
+ *
39
+ * return (
40
+ * <dialog ref={dialogRef} {...dialogProps}>
41
+ * <div>Dialog content</div>
42
+ * </dialog>
43
+ * );
44
+ * }
45
+ * ```
46
+ */
47
+ export declare const useDialogContainer: (options: UseDialogContainerOptions) => UseDialogContainerReturn;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @file Hook for detecting swipe gestures to dismiss a dialog.
3
+ *
4
+ * This hook provides free 2D movement during swipe:
5
+ * - User can drag in any direction freely
6
+ * - Close intent is detected on release based on displacement direction
7
+ * - If movement matches close direction and exceeds threshold, dismiss
8
+ * - Otherwise, snap back to original position
9
+ */
10
+ import * as React from "react";
11
+ import { type ContinuousOperationState, type Vector2 } from "../../hooks/gesture/types.js";
12
+ import type { DialogOpenDirection } from "./dialogAnimationUtils.js";
13
+ /**
14
+ * Options for useDialogSwipeInput hook.
15
+ */
16
+ export type UseDialogSwipeInputOptions = {
17
+ /** Ref to the dialog container element */
18
+ containerRef: React.RefObject<HTMLElement | null>;
19
+ /** Direction the dialog opened from (swipe closes in same direction) */
20
+ openDirection: DialogOpenDirection;
21
+ /** Whether swipe dismiss is enabled */
22
+ enabled: boolean;
23
+ /** Callback when swipe exceeds threshold and dialog should dismiss */
24
+ onSwipeDismiss: () => void;
25
+ /** Threshold ratio (0-1) of container size to trigger dismiss. @default 0.3 */
26
+ dismissThreshold?: number;
27
+ };
28
+ /**
29
+ * Result from useDialogSwipeInput hook.
30
+ */
31
+ export type UseDialogSwipeInputResult = {
32
+ /** Current operation state (idle, operating, or ended) */
33
+ state: ContinuousOperationState;
34
+ /** Props to spread on the container element */
35
+ containerProps: React.HTMLAttributes<HTMLElement> & {
36
+ style: React.CSSProperties;
37
+ };
38
+ /** Swipe progress (0-1) towards dismiss threshold */
39
+ progress: number;
40
+ /** Whether user is currently swiping */
41
+ isOperating: boolean;
42
+ /** Current displacement in pixels (primary axis based on openDirection) */
43
+ displacement: number;
44
+ /** Full 2D displacement for free movement transform */
45
+ displacement2D: Vector2;
46
+ };
47
+ /**
48
+ * Hook for detecting swipe gestures to dismiss a dialog.
49
+ *
50
+ * Allows free 2D movement - user can drag in any direction.
51
+ * On release, detects if the movement matches the close direction:
52
+ * - "center" or "bottom": close if moved down significantly
53
+ * - "top": close if moved up significantly
54
+ * - "left": close if moved left significantly
55
+ * - "right": close if moved right significantly
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * const { state, containerProps, displacement2D } = useDialogSwipeInput({
60
+ * containerRef,
61
+ * openDirection: "bottom",
62
+ * enabled: true,
63
+ * onSwipeDismiss: () => setVisible(false),
64
+ * });
65
+ *
66
+ * // Apply 2D transform for free movement
67
+ * style={{ transform: `translate(${displacement2D.x}px, ${displacement2D.y}px)` }}
68
+ * ```
69
+ */
70
+ export declare function useDialogSwipeInput(options: UseDialogSwipeInputOptions): UseDialogSwipeInputResult;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @file Hook for managing dialog transform during swipe and animation.
3
+ *
4
+ * This hook provides:
5
+ * - Real-time transform updates during swipe gestures
6
+ * - Smooth open/close animations with multi-phase easing
7
+ * - Backdrop opacity animation
8
+ * - Support for viewTransition API (optional)
9
+ */
10
+ import * as React from "react";
11
+ import type { ContinuousOperationState } from "../../hooks/gesture/types.js";
12
+ import type { DialogOpenDirection } from "./dialogAnimationUtils.js";
13
+ /**
14
+ * Phase of dialog animation lifecycle.
15
+ */
16
+ export type DialogAnimationPhase = "idle" | "opening" | "open" | "closing" | "closed";
17
+ /**
18
+ * 2D displacement for free movement.
19
+ */
20
+ export type Displacement2D = {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ /**
25
+ * Options for useDialogTransform hook.
26
+ */
27
+ export type UseDialogTransformOptions = {
28
+ /** Ref to the dialog content element */
29
+ elementRef: React.RefObject<HTMLElement | null>;
30
+ /** Ref to the backdrop element */
31
+ backdropRef: React.RefObject<HTMLElement | null>;
32
+ /** Whether the dialog is visible */
33
+ visible: boolean;
34
+ /** Direction the dialog opens from */
35
+ openDirection: DialogOpenDirection;
36
+ /** Current swipe state */
37
+ swipeState: ContinuousOperationState;
38
+ /** Current swipe displacement in pixels (primary axis) */
39
+ displacement: number;
40
+ /** Full 2D displacement for free movement */
41
+ displacement2D: Displacement2D;
42
+ /** Animation duration in ms. @default 350 */
43
+ animationDuration?: number;
44
+ /** Whether to use viewTransition API for close animation */
45
+ useViewTransition?: boolean;
46
+ /** Callback when open animation completes */
47
+ onOpenComplete?: () => void;
48
+ /** Callback when close animation completes */
49
+ onCloseComplete?: () => void;
50
+ };
51
+ /**
52
+ * Result from useDialogTransform hook.
53
+ */
54
+ export type UseDialogTransformResult = {
55
+ /** Current animation phase */
56
+ phase: DialogAnimationPhase;
57
+ /** Whether any animation is running */
58
+ isAnimating: boolean;
59
+ /** Trigger close animation (use instead of setting visible=false directly) */
60
+ triggerClose: () => Promise<void>;
61
+ };
62
+ /**
63
+ * Hook for managing dialog transform during swipe and animation.
64
+ *
65
+ * During swipe: directly updates element transform based on displacement.
66
+ * After swipe: animates to target position (close or snap back).
67
+ * On visible change: animates open/close transition.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * const { phase, isAnimating, triggerClose } = useDialogTransform({
72
+ * elementRef,
73
+ * backdropRef,
74
+ * visible,
75
+ * openDirection: "bottom",
76
+ * swipeState: inputState,
77
+ * displacement: inputDisplacement,
78
+ * onCloseComplete: () => onClose(),
79
+ * });
80
+ * ```
81
+ */
82
+ export declare function useDialogTransform(options: UseDialogTransformOptions): UseDialogTransformResult;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @file Type definitions for Drawer swipe gesture handling.
3
+ */
4
+ import type * as React from "react";
5
+ import type { ContinuousOperationState } from "../../hooks/gesture/types.js";
6
+ /**
7
+ * Direction for drawer anchor (same as anchor edge).
8
+ */
9
+ export type DrawerSwipeDirection = "left" | "right" | "top" | "bottom";
10
+ /**
11
+ * Options for useDrawerSwipeInput hook.
12
+ */
13
+ export type UseDrawerSwipeInputOptions = {
14
+ /** Container ref for edge detection zone (e.g., GridLayout container) */
15
+ edgeContainerRef: React.RefObject<HTMLElement | null>;
16
+ /** Drawer content ref (for close gesture) */
17
+ drawerContentRef: React.RefObject<HTMLElement | null>;
18
+ /** Drawer direction (anchor edge) */
19
+ direction: DrawerSwipeDirection;
20
+ /** Whether the drawer is currently open */
21
+ isOpen: boolean;
22
+ /** Callback when swipe should open the drawer */
23
+ onSwipeOpen: () => void;
24
+ /** Callback when swipe should close the drawer */
25
+ onSwipeClose: () => void;
26
+ /** Whether edge swipe to open is enabled. @default true */
27
+ enableEdgeSwipeOpen?: boolean;
28
+ /** Whether swipe to close is enabled. @default true */
29
+ enableSwipeClose?: boolean;
30
+ /** Width of edge detection zone in pixels. @default 20 */
31
+ edgeWidth?: number;
32
+ /** Dismiss threshold ratio (0-1). @default 0.3 */
33
+ dismissThreshold?: number;
34
+ };
35
+ /**
36
+ * Result from useDrawerSwipeInput hook.
37
+ */
38
+ export type UseDrawerSwipeInputResult = {
39
+ /** Current operation state */
40
+ state: ContinuousOperationState;
41
+ /** Whether currently opening via edge swipe */
42
+ isOpening: boolean;
43
+ /** Whether currently closing via drag */
44
+ isClosing: boolean;
45
+ /** Progress (0-1) towards open/close threshold */
46
+ progress: number;
47
+ /** Displacement in pixels (primary axis) */
48
+ displacement: number;
49
+ /** Props for edge container (open gesture zone) */
50
+ edgeContainerProps: React.HTMLAttributes<HTMLElement> & {
51
+ style: React.CSSProperties;
52
+ };
53
+ /** Props for drawer content (close gesture zone) */
54
+ drawerContentProps: React.HTMLAttributes<HTMLElement> & {
55
+ style: React.CSSProperties;
56
+ };
57
+ };
58
+ /**
59
+ * Get animation axis from direction.
60
+ */
61
+ export declare function getDrawerAnimationAxis(direction: DrawerSwipeDirection): "x" | "y";
62
+ /**
63
+ * Get the sign for the close swipe direction.
64
+ * Left drawer closes by swiping left (-1).
65
+ * Right drawer closes by swiping right (+1).
66
+ * Top drawer closes by swiping up (-1).
67
+ * Bottom drawer closes by swiping down (+1).
68
+ */
69
+ export declare function getDrawerCloseSwipeSign(direction: DrawerSwipeDirection): 1 | -1;
70
+ /**
71
+ * Get the sign for the open swipe direction.
72
+ * This is the opposite of the close direction.
73
+ */
74
+ export declare function getDrawerOpenSwipeSign(direction: DrawerSwipeDirection): 1 | -1;
@@ -0,0 +1,24 @@
1
+ import type { UseDrawerSwipeInputOptions, UseDrawerSwipeInputResult } from "./types.js";
2
+ /**
3
+ * Hook for detecting swipe gestures to open/close a drawer.
4
+ *
5
+ * When drawer is closed:
6
+ * - Detects edge swipe from the anchor edge to trigger open
7
+ *
8
+ * When drawer is open:
9
+ * - Detects drag gesture within drawer to trigger close
10
+ * - Respects scrollable content boundaries
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * const { state, edgeContainerProps, drawerContentProps } = useDrawerSwipeInput({
15
+ * edgeContainerRef: gridLayoutRef,
16
+ * drawerContentRef: drawerRef,
17
+ * direction: "left",
18
+ * isOpen,
19
+ * onSwipeOpen: () => setOpen(true),
20
+ * onSwipeClose: () => setOpen(false),
21
+ * });
22
+ * ```
23
+ */
24
+ export declare function useDrawerSwipeInput(options: UseDrawerSwipeInputOptions): UseDrawerSwipeInputResult;
@@ -86,4 +86,7 @@ export type SwipePivotTabBarProps<TId extends string = string> = {
86
86
  */
87
87
  renderIndicator?: (props: IndicatorRenderProps) => React.ReactNode;
88
88
  };
89
+ /**
90
+ * Swipeable tab bar for pivot navigation.
91
+ */
89
92
  export declare function SwipePivotTabBar<TId extends string = string>({ items, activeId, activeIndex, itemCount, inputState, tabWidth, viewportWidth, navigationMode, axis, renderTab, animationDuration, fixedTabs, renderIndicator, }: SwipePivotTabBarProps<TId>): React.ReactElement;
@@ -8,10 +8,13 @@
8
8
  * Uses useSwipeContentTransform for immediate DOM updates.
9
9
  */
10
10
  import * as React from "react";
11
- import type { SwipeInputState, GestureAxis } from "../../hooks/gesture/types.js";
11
+ import type { ContinuousOperationState, GestureAxis } from "../../hooks/gesture/types.js";
12
12
  import type { StackDisplayMode } from "./types.js";
13
13
  /**
14
14
  * Props for SwipeStackContent component.
15
+ *
16
+ * This component accepts ContinuousOperationState, meaning it responds uniformly
17
+ * to any continuous operation (whether human gesture or system animation).
15
18
  */
16
19
  export type SwipeStackContentProps = {
17
20
  /** Panel ID */
@@ -22,8 +25,8 @@ export type SwipeStackContentProps = {
22
25
  navigationDepth: number;
23
26
  /** Whether this panel is currently active */
24
27
  isActive: boolean;
25
- /** Swipe input state from useStackSwipeInput */
26
- inputState: SwipeInputState;
28
+ /** Continuous operation state (from gesture input or animation system) */
29
+ operationState: ContinuousOperationState;
27
30
  /** Container size in pixels (width for horizontal, height for vertical) */
28
31
  containerSize: number;
29
32
  /** Gesture axis. @default "horizontal" */
@@ -5,7 +5,7 @@
5
5
  * providing iOS-style smooth swipe-to-go-back behavior.
6
6
  */
7
7
  import * as React from "react";
8
- import type { SwipeInputState } from "../../hooks/gesture/types.js";
8
+ import type { ContinuousOperationState } from "../../hooks/gesture/types.js";
9
9
  import type { StackPanel, StackNavigationState } from "./types.js";
10
10
  /**
11
11
  * Props for SwipeStackOutlet component.
@@ -15,8 +15,8 @@ export type SwipeStackOutletProps = {
15
15
  panels: ReadonlyArray<StackPanel>;
16
16
  /** Current navigation state */
17
17
  navigationState: StackNavigationState;
18
- /** Swipe input state from useStackSwipeInput */
19
- inputState: SwipeInputState;
18
+ /** Continuous operation state (from gesture input or animation system) */
19
+ operationState: ContinuousOperationState;
20
20
  /** Container size in pixels (width for horizontal swipe) */
21
21
  containerSize: number;
22
22
  /** Function to get cached content for a panel */
@@ -70,7 +70,7 @@ export type SwipeStackOutletProps = {
70
70
  * <SwipeStackOutlet
71
71
  * panels={navigation.panels}
72
72
  * navigationState={navigation.state}
73
- * inputState={swipeInput.inputState}
73
+ * operationState={toContinuousOperationState(swipeInput.inputState)}
74
74
  * containerSize={containerWidth}
75
75
  * />
76
76
  * </div>
@@ -48,7 +48,7 @@ export type ComputeSwipeVisibilityInput = {
48
48
  /** Whether this panel is currently active */
49
49
  isActive: boolean;
50
50
  /** Whether swipe gesture is active */
51
- isSwiping: boolean;
51
+ isOperating: boolean;
52
52
  /** Whether snap-back animation is running */
53
53
  isAnimating: boolean;
54
54
  };
package/dist/panels.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PanelSystem-Bs8bQwQF.cjs");exports.DropSuggestOverlay=e.DropSuggestOverlay;exports.PanelGroupView=e.PanelGroupView;exports.PanelSystem=e.PanelSystem;exports.PanelSystemProvider=e.PanelSystemProvider;exports.addTabToGroup=e.addTabToGroup;exports.addTabToGroupAtIndex=e.addTabToGroupAtIndex;exports.buildInitialState=e.buildInitialState;exports.closeLeaf=e.closeLeaf;exports.collectGroupsInOrder=e.collectGroupsInOrder;exports.createEmptyGroup=e.createEmptyGroup;exports.focusGroupIndex=e.focusGroupIndex;exports.isGroup=e.isGroup;exports.moveTab=e.moveTab;exports.nextGroup=e.nextGroup;exports.prevGroup=e.prevGroup;exports.refreshGroupOrder=e.refreshGroupOrder;exports.removeTabFromGroup=e.removeTabFromGroup;exports.reorderTabWithinGroup=e.reorderTabWithinGroup;exports.setActiveTab=e.setActiveTab;exports.setFocusedGroup=e.setFocusedGroup;exports.setSplitRatio=e.setSplitRatio;exports.splitGroup=e.splitGroup;exports.splitLeaf=e.splitLeaf;exports.usePanelSystem=e.usePanelSystem;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PanelSystem-D603LKKv.cjs");exports.DropSuggestOverlay=e.DropSuggestOverlay;exports.PanelGroupView=e.PanelGroupView;exports.PanelSystem=e.PanelSystem;exports.PanelSystemProvider=e.PanelSystemProvider;exports.addTabToGroup=e.addTabToGroup;exports.addTabToGroupAtIndex=e.addTabToGroupAtIndex;exports.buildInitialState=e.buildInitialState;exports.closeLeaf=e.closeLeaf;exports.collectGroupsInOrder=e.collectGroupsInOrder;exports.createEmptyGroup=e.createEmptyGroup;exports.focusGroupIndex=e.focusGroupIndex;exports.isGroup=e.isGroup;exports.moveTab=e.moveTab;exports.nextGroup=e.nextGroup;exports.prevGroup=e.prevGroup;exports.refreshGroupOrder=e.refreshGroupOrder;exports.removeTabFromGroup=e.removeTabFromGroup;exports.reorderTabWithinGroup=e.reorderTabWithinGroup;exports.setActiveTab=e.setActiveTab;exports.setFocusedGroup=e.setFocusedGroup;exports.setSplitRatio=e.setSplitRatio;exports.splitGroup=e.splitGroup;exports.splitLeaf=e.splitLeaf;exports.usePanelSystem=e.usePanelSystem;
2
2
  //# sourceMappingURL=panels.cjs.map
package/dist/panels.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as e, a as r, P as o, b as t, g as p, k as u, v as i, d as l, c as G, f as d, n, i as m, m as b, o as c, p as T, q as v, r as f, j as P, h as S, l as y, e as x, t as I, s as g, u as h } from "./PanelSystem-Dr1TBhxM.js";
1
+ import { D as e, a as r, P as o, b as t, g as p, k as u, v as i, d as l, c as G, f as d, n, i as m, m as b, o as c, p as T, q as v, r as f, j as P, h as S, l as y, e as x, t as I, s as g, u as h } from "./PanelSystem-BqUzNtf2.js";
2
2
  export {
3
3
  e as DropSuggestOverlay,
4
4
  r as PanelGroupView,
package/dist/pivot.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./SwipePivotTabBar-BrQismcZ.cjs"),s=(e,c,l)=>{if(c<=0||l<=0||e.phase==="idle")return e;const o=l/c;return{...e,displacement:{x:e.displacement.x*o,y:e.displacement.y*o},velocity:{x:e.velocity.x*o,y:e.velocity.y*o}}};exports.SwipePivotTabBar=r.SwipePivotTabBar;exports.usePivot=r.usePivot;exports.scaleInputState=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./SwipePivotTabBar-fjjXkpj7.cjs"),s=(e,c,l)=>{if(c<=0||l<=0||e.phase==="idle")return e;const o=l/c;return{...e,displacement:{x:e.displacement.x*o,y:e.displacement.y*o},velocity:{x:e.velocity.x*o,y:e.velocity.y*o}}};exports.SwipePivotTabBar=r.SwipePivotTabBar;exports.usePivot=r.usePivot;exports.scaleInputState=s;
2
2
  //# sourceMappingURL=pivot.cjs.map
package/dist/pivot.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as x, u as v } from "./SwipePivotTabBar-BGO9X94m.js";
1
+ import { S as x, u as v } from "./SwipePivotTabBar-DWrCuwEI.js";
2
2
  const o = (e, c, l) => {
3
3
  if (c <= 0 || l <= 0 || e.phase === "idle")
4
4
  return e;
package/dist/resizer.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ResizeHandle-CScipO5l.cjs"),i=require("./HorizontalDivider-B5Z-KZLk.cjs");exports.ResizeHandle=e.ResizeHandle;exports.useResizeDrag=e.useResizeDrag;exports.HorizontalDivider=i.HorizontalDivider;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ResizeHandle-CBcAS918.cjs"),i=require("./HorizontalDivider-_pgV4Mcv.cjs");exports.ResizeHandle=e.ResizeHandle;exports.useResizeDrag=e.useResizeDrag;exports.HorizontalDivider=i.HorizontalDivider;
2
2
  //# sourceMappingURL=resizer.cjs.map
package/dist/resizer.js CHANGED
@@ -1,5 +1,5 @@
1
- import { R as a, u as o } from "./ResizeHandle-CdA_JYfN.js";
2
- import { H as i } from "./HorizontalDivider-WF1k_qND.js";
1
+ import { R as a, u as o } from "./ResizeHandle-CXjc1meV.js";
2
+ import { H as i } from "./HorizontalDivider-DdxzfV0l.js";
3
3
  export {
4
4
  i as HorizontalDivider,
5
5
  a as ResizeHandle,