@seed-design/react-drawer 1.0.5 → 1.0.7
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.
|
@@ -1033,10 +1033,10 @@ const DrawerContent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
1033
1033
|
}
|
|
1034
1034
|
},
|
|
1035
1035
|
onFocusOutside: (e)=>{
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1036
|
+
props.onFocusOutside?.(e);
|
|
1037
|
+
// Always prevent focusOutside to avoid conflicts when focus moves between modals
|
|
1038
|
+
// (e.g., when Dialog closes and restores focus while BottomSheet is opening)
|
|
1039
|
+
e.preventDefault();
|
|
1040
1040
|
},
|
|
1041
1041
|
onPointerMove: (event)=>{
|
|
1042
1042
|
lastKnownPointerEventRef.current = event;
|
|
@@ -1073,7 +1073,8 @@ const DrawerContent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
1073
1073
|
}
|
|
1074
1074
|
},
|
|
1075
1075
|
onInteractOutside: (e)=>{
|
|
1076
|
-
if (
|
|
1076
|
+
// Only close if event is not prevented (e.g., by onFocusOutside or onPointerDownOutside)
|
|
1077
|
+
if (dismissible && closeOnInteractOutside && !e.defaultPrevented) {
|
|
1077
1078
|
closeDrawer();
|
|
1078
1079
|
}
|
|
1079
1080
|
props.onInteractOutside?.(e);
|
|
@@ -1056,10 +1056,10 @@ const DrawerContent = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
|
1056
1056
|
}
|
|
1057
1057
|
},
|
|
1058
1058
|
onFocusOutside: (e)=>{
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1059
|
+
props.onFocusOutside?.(e);
|
|
1060
|
+
// Always prevent focusOutside to avoid conflicts when focus moves between modals
|
|
1061
|
+
// (e.g., when Dialog closes and restores focus while BottomSheet is opening)
|
|
1062
|
+
e.preventDefault();
|
|
1063
1063
|
},
|
|
1064
1064
|
onPointerMove: (event)=>{
|
|
1065
1065
|
lastKnownPointerEventRef.current = event;
|
|
@@ -1096,7 +1096,8 @@ const DrawerContent = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
|
1096
1096
|
}
|
|
1097
1097
|
},
|
|
1098
1098
|
onInteractOutside: (e)=>{
|
|
1099
|
-
if (
|
|
1099
|
+
// Only close if event is not prevented (e.g., by onFocusOutside or onPointerDownOutside)
|
|
1100
|
+
if (dismissible && closeOnInteractOutside && !e.defaultPrevented) {
|
|
1100
1101
|
closeDrawer();
|
|
1101
1102
|
}
|
|
1102
1103
|
props.onInteractOutside?.(e);
|
package/lib/index.cjs
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DrawerBackdrop, a as DrawerCloseButton, b as DrawerContent, c as DrawerDescription, d as DrawerHandle, e as DrawerPositioner, f as DrawerRoot, g as DrawerTitle, h as DrawerTrigger } from './Drawer-12s-
|
|
2
|
-
export { u as useDrawer, i as useDrawerContext } from './Drawer-12s-
|
|
1
|
+
import { D as DrawerBackdrop, a as DrawerCloseButton, b as DrawerContent, c as DrawerDescription, d as DrawerHandle, e as DrawerPositioner, f as DrawerRoot, g as DrawerTitle, h as DrawerTrigger } from './Drawer-12s-1gup1cyj.js';
|
|
2
|
+
export { u as useDrawer, i as useDrawerContext } from './Drawer-12s-1gup1cyj.js';
|
|
3
3
|
|
|
4
4
|
var Drawer_namespace = {
|
|
5
5
|
__proto__: null,
|
package/package.json
CHANGED
package/src/Drawer.tsx
CHANGED
|
@@ -64,15 +64,8 @@ export interface DrawerBackdropProps
|
|
|
64
64
|
React.HTMLAttributes<HTMLDivElement> {}
|
|
65
65
|
|
|
66
66
|
export const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>((props, ref) => {
|
|
67
|
-
const {
|
|
68
|
-
|
|
69
|
-
onRelease,
|
|
70
|
-
modal,
|
|
71
|
-
snapPoints,
|
|
72
|
-
isOpen,
|
|
73
|
-
shouldFade,
|
|
74
|
-
shouldOverlayAnimate,
|
|
75
|
-
} = useDrawerContext();
|
|
67
|
+
const { overlayRef, onRelease, modal, snapPoints, isOpen, shouldFade, shouldOverlayAnimate } =
|
|
68
|
+
useDrawerContext();
|
|
76
69
|
const composedRef = useComposedRefs(ref, overlayRef);
|
|
77
70
|
const hasSnapPoints = snapPoints && snapPoints.length > 0;
|
|
78
71
|
const onMouseUp = useCallbackRef((event: React.PointerEvent<HTMLDivElement>) => onRelease(event));
|
|
@@ -216,10 +209,10 @@ export const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>((pro
|
|
|
216
209
|
}
|
|
217
210
|
}}
|
|
218
211
|
onFocusOutside={(e) => {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
212
|
+
props.onFocusOutside?.(e);
|
|
213
|
+
// Always prevent focusOutside to avoid conflicts when focus moves between modals
|
|
214
|
+
// (e.g., when Dialog closes and restores focus while BottomSheet is opening)
|
|
215
|
+
e.preventDefault();
|
|
223
216
|
}}
|
|
224
217
|
onPointerMove={(event) => {
|
|
225
218
|
lastKnownPointerEventRef.current = event;
|
|
@@ -258,7 +251,8 @@ export const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>((pro
|
|
|
258
251
|
}
|
|
259
252
|
}}
|
|
260
253
|
onInteractOutside={(e) => {
|
|
261
|
-
if (
|
|
254
|
+
// Only close if event is not prevented (e.g., by onFocusOutside or onPointerDownOutside)
|
|
255
|
+
if (dismissible && closeOnInteractOutside && !e.defaultPrevented) {
|
|
262
256
|
closeDrawer();
|
|
263
257
|
}
|
|
264
258
|
props.onInteractOutside?.(e);
|
package/src/useDrawer.ts
CHANGED
|
@@ -116,7 +116,6 @@ export interface UseDrawerProps {
|
|
|
116
116
|
* @default true
|
|
117
117
|
*/
|
|
118
118
|
closeOnEscape?: boolean;
|
|
119
|
-
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
export function useDrawer(props: UseDrawerProps) {
|
|
@@ -543,7 +542,6 @@ export function useDrawer(props: UseDrawerProps) {
|
|
|
543
542
|
};
|
|
544
543
|
}, [isOpen]);
|
|
545
544
|
|
|
546
|
-
|
|
547
545
|
useEffect(() => {
|
|
548
546
|
function onVisualViewportChange() {
|
|
549
547
|
if (!drawerRef.current || !repositionInputs) return;
|