@cloud-ru/ds-bottom-sheet 2.1.0 → 2.1.2-preview-87834313.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/CHANGELOG.md +6 -0
- package/README.md +4 -0
- package/dist/cjs/components/BottomSheetCustom/BottomSheetCustom.js +2 -2
- package/dist/cjs/components/BottomSheetCustom/hooks/useDragEngine.js +4 -0
- package/dist/cjs/components/BottomSheetCustom/styles.module.css +3 -0
- package/dist/cjs/style.css +3 -0
- package/dist/cjs/types.d.ts +5 -0
- package/dist/esm/components/BottomSheetCustom/BottomSheetCustom.js +2 -2
- package/dist/esm/components/BottomSheetCustom/hooks/useDragEngine.js +4 -0
- package/dist/esm/components/BottomSheetCustom/styles.module.css +3 -0
- package/dist/esm/style.css +3 -0
- package/dist/esm/types.d.ts +5 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/components/BottomSheetCustom/BottomSheetCustom.tsx +8 -1
- package/src/components/BottomSheetCustom/hooks/useDragEngine.ts +3 -0
- package/src/components/BottomSheetCustom/styles.module.scss +4 -0
- package/src/types.ts +5 -0
|
@@ -50,6 +50,7 @@ export function BottomSheetCustom(props: BottomSheetCustomProps) {
|
|
|
50
50
|
open,
|
|
51
51
|
onClose,
|
|
52
52
|
showBackdrop = true,
|
|
53
|
+
backdropBlur = false,
|
|
53
54
|
lockScroll = true,
|
|
54
55
|
swipeEnabled = true,
|
|
55
56
|
safeAreaTop = true,
|
|
@@ -173,7 +174,13 @@ export function BottomSheetCustom(props: BottomSheetCustomProps) {
|
|
|
173
174
|
data-disable-motions={disableMotions || undefined}
|
|
174
175
|
>
|
|
175
176
|
{showBackdrop && (
|
|
176
|
-
<div
|
|
177
|
+
<div
|
|
178
|
+
className={styles.backdrop}
|
|
179
|
+
data-backdrop-blur={backdropBlur || undefined}
|
|
180
|
+
data-test-id={TEST_IDS.backdrop}
|
|
181
|
+
onClick={handleBackdropClick}
|
|
182
|
+
aria-hidden
|
|
183
|
+
/>
|
|
177
184
|
)}
|
|
178
185
|
|
|
179
186
|
<div
|
|
@@ -194,6 +194,9 @@ export function useDragEngine({
|
|
|
194
194
|
const onPointerDown = useCallback(
|
|
195
195
|
(event: ReactPointerEvent<HTMLDivElement>) => {
|
|
196
196
|
if (!swipeEnabled || !isActive) return;
|
|
197
|
+
// События вложенного React-портала всплывают в родительский sheet, хотя его DOM
|
|
198
|
+
// не содержит цель жеста. Такой жест принадлежит только вложенной панели.
|
|
199
|
+
if (!(event.target instanceof Node) || !event.currentTarget.contains(event.target)) return;
|
|
197
200
|
if (!event.isPrimary || pointerId.current !== null) return;
|
|
198
201
|
if (event.pointerType === 'mouse' && event.button !== 0) return;
|
|
199
202
|
if (event.target instanceof Element && event.target.closest(NO_DRAG_SELECTOR)) return;
|
package/src/types.ts
CHANGED
|
@@ -38,6 +38,11 @@ export type BottomSheetCustomProps = WithSupportProps<
|
|
|
38
38
|
* @default true
|
|
39
39
|
*/
|
|
40
40
|
showBackdrop?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Размытие фона под подложкой. Применяется только при `showBackdrop=true`.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
backdropBlur?: boolean;
|
|
41
46
|
/**
|
|
42
47
|
* Блокировать ли скролл фона на время открытия (`react-remove-scroll`). При `false` страница
|
|
43
48
|
* под sheet'ом остаётся прокручиваемой — для non-modal сценариев (sheet поверх контента, с
|