@alfalab/core-components-bottom-sheet
Advanced tools
Comparing version 6.14.5 to 6.14.6
@@ -16,2 +16,3 @@ 'use strict'; | ||
var components_swipeableBackdrop_Component = require('./components/swipeable-backdrop/Component.js'); | ||
var consts_swipeConsts = require('./consts/swipeConsts.js'); | ||
var utils = require('./utils.js'); | ||
@@ -25,3 +26,3 @@ | ||
var styles = {"modal":"bottom-sheet__modal_1gk54","wrapper":"bottom-sheet__wrapper_1gk54","fullscreen":"bottom-sheet__fullscreen_1gk54","component":"bottom-sheet__component_1gk54","withTransition":"bottom-sheet__withTransition_1gk54","scrollableContainer":"bottom-sheet__scrollableContainer_1gk54","marker":"bottom-sheet__marker_1gk54","defaultMarker":"bottom-sheet__defaultMarker_1gk54","content":"bottom-sheet__content_1gk54","noHeader":"bottom-sheet__noHeader_1gk54","noFooter":"bottom-sheet__noFooter_1gk54","scrollLocked":"bottom-sheet__scrollLocked_1gk54","hiddenScrollbar":"bottom-sheet__hiddenScrollbar_1gk54","disabledPointerEvents":"bottom-sheet__disabledPointerEvents_1gk54","appear":"bottom-sheet__appear_1gk54","enter":"bottom-sheet__enter_1gk54","appearActive":"bottom-sheet__appearActive_1gk54","enterActive":"bottom-sheet__enterActive_1gk54","enterDone":"bottom-sheet__enterDone_1gk54","appearDone":"bottom-sheet__appearDone_1gk54","exit":"bottom-sheet__exit_1gk54","exitActive":"bottom-sheet__exitActive_1gk54","background-accent":"bottom-sheet__background-accent_1gk54","background-info":"bottom-sheet__background-info_1gk54","background-attention-muted":"bottom-sheet__background-attention-muted_1gk54","background-positive-muted":"bottom-sheet__background-positive-muted_1gk54","background-negative-muted":"bottom-sheet__background-negative-muted_1gk54","background-primary":"bottom-sheet__background-primary_1gk54","background-primary-inverted":"bottom-sheet__background-primary-inverted_1gk54","background-secondary":"bottom-sheet__background-secondary_1gk54","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_1gk54","background-tertiary":"bottom-sheet__background-tertiary_1gk54","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_1gk54","background-quaternary":"bottom-sheet__background-quaternary_1gk54","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_1gk54","background-specialbg-component":"bottom-sheet__background-specialbg-component_1gk54","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_1gk54","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_1gk54","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_1gk54","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_1gk54","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_1gk54","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_1gk54","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_1gk54","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_1gk54"}; | ||
var styles = {"modal":"bottom-sheet__modal_tmbtb","wrapper":"bottom-sheet__wrapper_tmbtb","fullscreen":"bottom-sheet__fullscreen_tmbtb","component":"bottom-sheet__component_tmbtb","withTransition":"bottom-sheet__withTransition_tmbtb","scrollableContainer":"bottom-sheet__scrollableContainer_tmbtb","marker":"bottom-sheet__marker_tmbtb","defaultMarker":"bottom-sheet__defaultMarker_tmbtb","content":"bottom-sheet__content_tmbtb","noHeader":"bottom-sheet__noHeader_tmbtb","noFooter":"bottom-sheet__noFooter_tmbtb","scrollLocked":"bottom-sheet__scrollLocked_tmbtb","hiddenScrollbar":"bottom-sheet__hiddenScrollbar_tmbtb","disabledPointerEvents":"bottom-sheet__disabledPointerEvents_tmbtb","appear":"bottom-sheet__appear_tmbtb","enter":"bottom-sheet__enter_tmbtb","appearActive":"bottom-sheet__appearActive_tmbtb","enterActive":"bottom-sheet__enterActive_tmbtb","enterDone":"bottom-sheet__enterDone_tmbtb","appearDone":"bottom-sheet__appearDone_tmbtb","exit":"bottom-sheet__exit_tmbtb","exitActive":"bottom-sheet__exitActive_tmbtb","safeAreaBottom":"bottom-sheet__safeAreaBottom_tmbtb","background-accent":"bottom-sheet__background-accent_tmbtb","background-info":"bottom-sheet__background-info_tmbtb","background-attention-muted":"bottom-sheet__background-attention-muted_tmbtb","background-positive-muted":"bottom-sheet__background-positive-muted_tmbtb","background-negative-muted":"bottom-sheet__background-negative-muted_tmbtb","background-primary":"bottom-sheet__background-primary_tmbtb","background-primary-inverted":"bottom-sheet__background-primary-inverted_tmbtb","background-secondary":"bottom-sheet__background-secondary_tmbtb","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_tmbtb","background-tertiary":"bottom-sheet__background-tertiary_tmbtb","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_tmbtb","background-quaternary":"bottom-sheet__background-quaternary_tmbtb","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_tmbtb","background-specialbg-component":"bottom-sheet__background-specialbg-component_tmbtb","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_tmbtb","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_tmbtb","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_tmbtb","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_tmbtb","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_tmbtb","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_tmbtb","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_tmbtb","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_tmbtb"}; | ||
require('./index.css') | ||
@@ -37,2 +38,3 @@ | ||
var magneticAreas = React.useMemo(function () { | ||
var _a; | ||
if (magneticAreasProp) { | ||
@@ -43,3 +45,5 @@ return magneticAreasProp.map(function (area) { | ||
} | ||
return [0, fullHeight - headerOffset]; | ||
var iOSViewHeight = ((_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.clientHeight) || window.innerHeight; | ||
var viewHeight = coreComponentsShared.os.isIOS() ? iOSViewHeight : fullHeight; | ||
return [0, viewHeight - headerOffset]; | ||
}, [fullHeight, headerOffset, magneticAreasProp]); | ||
@@ -194,4 +198,5 @@ var lastMagneticArea = magneticAreas[magneticAreas.length - 1]; | ||
*/ | ||
var shouldSkipSwiping = function (deltaY, startY, event) { | ||
var shouldSkipSwiping = function (swipeParams) { | ||
var _a; | ||
var deltaY = swipeParams.deltaY, startY = swipeParams.startY, event = swipeParams.event, dir = swipeParams.dir; | ||
if (scrollLockedProp || swipingInProgress) | ||
@@ -221,7 +226,13 @@ return false; | ||
} | ||
// Если контент внутри шторки скроллится горизонально - то шторка не должна закрываться | ||
if (consts_swipeConsts.horizontalDirections.includes(dir)) { | ||
return true; | ||
} | ||
return shouldScroll; | ||
}; | ||
var handleSheetSwipe = function (_a) { | ||
var initial = _a.initial, velocity = _a.velocity, deltaY = _a.deltaY, event = _a.event; | ||
if (scrollOccurred.current || shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeEnd = function (swipeParams) { | ||
var initial = swipeParams.initial, velocity = swipeParams.velocity, deltaY = swipeParams.deltaY, event = swipeParams.event, dir = swipeParams.dir; | ||
var shouldPreventSwipe = scrollOccurred.current || | ||
shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir }); | ||
if (shouldPreventSwipe) { | ||
return; | ||
@@ -231,5 +242,5 @@ } | ||
}; | ||
var handleSheetSwipeStart = function (_a) { | ||
var deltaY = _a.deltaY, initial = _a.initial, event = _a.event; | ||
if (shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeStart = function (swipeParams) { | ||
var deltaY = swipeParams.deltaY, initial = swipeParams.initial, event = swipeParams.event, dir = swipeParams.dir; | ||
if (shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir })) { | ||
return; | ||
@@ -243,5 +254,7 @@ } | ||
}; | ||
var handleSheetSwiping = function (_a) { | ||
var initial = _a.initial, deltaY = _a.deltaY, event = _a.event; | ||
if (scrollOccurred.current || shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeMove = function (swipeParams) { | ||
var initial = swipeParams.initial, deltaY = swipeParams.deltaY, event = swipeParams.event, dir = swipeParams.dir; | ||
var shouldPreventSwipe = scrollOccurred.current || | ||
shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir }); | ||
if (shouldPreventSwipe) { | ||
return; | ||
@@ -259,4 +272,4 @@ } | ||
onSwipeStart: handleSheetSwipeStart, | ||
onSwiping: handleSheetSwiping, | ||
onSwiped: handleSheetSwipe, | ||
onSwiping: handleSheetSwipeMove, | ||
onSwiped: handleSheetSwipeEnd, | ||
onTouchEndOrOnMouseUp: handleTouchEnd, | ||
@@ -346,3 +359,3 @@ trackMouse: swipeable, | ||
_b)), disableBlockingScroll: disableBlockingScroll, disableFocusLock: disableFocusLock, transitionProps: tslib.__assign(tslib.__assign({ appear: true, timeout: utils.TIMEOUT, classNames: styles }, transitionProps), { onExited: handleExited, onEntered: handleEntered, onEnter: handleEnter, onExit: handleExit }), disableAutoFocus: disableAutoFocus, disableEscapeKeyDown: disableEscapeKeyDown, disableRestoreFocus: disableRestoreFocus, keepMounted: keepMounted }, | ||
React__default.default.createElement("div", { style: tslib.__assign({}, getHeightStyles()), className: cn__default.default(styles.wrapper, (_c = {}, | ||
React__default.default.createElement("div", { className: cn__default.default(styles.wrapper, (_c = {}, | ||
_c[styles.fullscreen] = headerOffset === 0 && sheetOffset === 0, | ||
@@ -352,2 +365,3 @@ _c)), onTransitionEnd: setSheetHeight }, | ||
_d[styles.withTransition] = swipingInProgress === false, | ||
_d[styles.safeAreaBottom] = coreComponentsShared.os.isIOS(), | ||
_d)), style: tslib.__assign(tslib.__assign({}, getSwipeStyles()), getHeightStyles()) }, sheetSwipeableHandlers, { ref: mergeRefs__default.default([sheetRef, sheetContainerRef, sheetSwipeableHandlers.ref]), onTransitionEnd: handleTransitionEnd }), | ||
@@ -354,0 +368,0 @@ renderMarker(), |
@@ -14,3 +14,3 @@ 'use strict'; | ||
var styles = {"footer":"bottom-sheet__footer_3m2vv","sticky":"bottom-sheet__sticky_3m2vv","highlighted":"bottom-sheet__highlighted_3m2vv","background-accent":"bottom-sheet__background-accent_3m2vv","background-info":"bottom-sheet__background-info_3m2vv","background-attention-muted":"bottom-sheet__background-attention-muted_3m2vv","background-positive-muted":"bottom-sheet__background-positive-muted_3m2vv","background-negative-muted":"bottom-sheet__background-negative-muted_3m2vv","background-primary":"bottom-sheet__background-primary_3m2vv","background-primary-inverted":"bottom-sheet__background-primary-inverted_3m2vv","background-secondary":"bottom-sheet__background-secondary_3m2vv","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_3m2vv","background-tertiary":"bottom-sheet__background-tertiary_3m2vv","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_3m2vv","background-quaternary":"bottom-sheet__background-quaternary_3m2vv","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_3m2vv","background-specialbg-component":"bottom-sheet__background-specialbg-component_3m2vv","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_3m2vv","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_3m2vv","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_3m2vv","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_3m2vv","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_3m2vv","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_3m2vv","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_3m2vv","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_3m2vv"}; | ||
var styles = {"footer":"bottom-sheet__footer_c562w","sticky":"bottom-sheet__sticky_c562w","highlighted":"bottom-sheet__highlighted_c562w","background-accent":"bottom-sheet__background-accent_c562w","background-info":"bottom-sheet__background-info_c562w","background-attention-muted":"bottom-sheet__background-attention-muted_c562w","background-positive-muted":"bottom-sheet__background-positive-muted_c562w","background-negative-muted":"bottom-sheet__background-negative-muted_c562w","background-primary":"bottom-sheet__background-primary_c562w","background-primary-inverted":"bottom-sheet__background-primary-inverted_c562w","background-secondary":"bottom-sheet__background-secondary_c562w","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_c562w","background-tertiary":"bottom-sheet__background-tertiary_c562w","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_c562w","background-quaternary":"bottom-sheet__background-quaternary_c562w","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_c562w","background-specialbg-component":"bottom-sheet__background-specialbg-component_c562w","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_c562w","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_c562w","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_c562w","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_c562w","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_c562w","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_c562w","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_c562w","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_c562w"}; | ||
require('./index.css') | ||
@@ -17,0 +17,0 @@ |
@@ -16,3 +16,3 @@ 'use strict'; | ||
var styles = {"headerWrapper":"bottom-sheet__headerWrapper_wfvuy","hasContent":"bottom-sheet__hasContent_wfvuy","header":"bottom-sheet__header_wfvuy","sticky":"bottom-sheet__sticky_wfvuy","highlighted":"bottom-sheet__highlighted_wfvuy","justifyEnd":"bottom-sheet__justifyEnd_wfvuy","addon":"bottom-sheet__addon_wfvuy","addonFixed":"bottom-sheet__addonFixed_wfvuy","title":"bottom-sheet__title_wfvuy","titleCenter":"bottom-sheet__titleCenter_wfvuy","titleLeft":"bottom-sheet__titleLeft_wfvuy","trimTitle":"bottom-sheet__trimTitle_wfvuy"}; | ||
var styles = {"headerWrapper":"bottom-sheet__headerWrapper_14dgd","hasContent":"bottom-sheet__hasContent_14dgd","header":"bottom-sheet__header_14dgd","sticky":"bottom-sheet__sticky_14dgd","highlighted":"bottom-sheet__highlighted_14dgd","justifyEnd":"bottom-sheet__justifyEnd_14dgd","addon":"bottom-sheet__addon_14dgd","addonFixed":"bottom-sheet__addonFixed_14dgd","title":"bottom-sheet__title_14dgd","titleCenter":"bottom-sheet__titleCenter_14dgd","titleLeft":"bottom-sheet__titleLeft_14dgd","trimTitle":"bottom-sheet__trimTitle_14dgd"}; | ||
require('./index.css') | ||
@@ -19,0 +19,0 @@ |
@@ -16,2 +16,3 @@ 'use strict'; | ||
var components_swipeableBackdrop_Component = require('./components/swipeable-backdrop/Component.js'); | ||
var consts_swipeConsts = require('./consts/swipeConsts.js'); | ||
var utils = require('./utils.js'); | ||
@@ -35,2 +36,3 @@ var styles = require('./index.module.css'); | ||
var magneticAreas = React.useMemo(function () { | ||
var _a; | ||
if (magneticAreasProp) { | ||
@@ -41,3 +43,5 @@ return magneticAreasProp.map(function (area) { | ||
} | ||
return [0, fullHeight - headerOffset]; | ||
var iOSViewHeight = ((_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.clientHeight) || window.innerHeight; | ||
var viewHeight = coreComponentsShared.os.isIOS() ? iOSViewHeight : fullHeight; | ||
return [0, viewHeight - headerOffset]; | ||
}, [fullHeight, headerOffset, magneticAreasProp]); | ||
@@ -192,4 +196,5 @@ var lastMagneticArea = magneticAreas[magneticAreas.length - 1]; | ||
*/ | ||
var shouldSkipSwiping = function (deltaY, startY, event) { | ||
var shouldSkipSwiping = function (swipeParams) { | ||
var _a; | ||
var deltaY = swipeParams.deltaY, startY = swipeParams.startY, event = swipeParams.event, dir = swipeParams.dir; | ||
if (scrollLockedProp || swipingInProgress) | ||
@@ -219,7 +224,13 @@ return false; | ||
} | ||
// Если контент внутри шторки скроллится горизонально - то шторка не должна закрываться | ||
if (consts_swipeConsts.horizontalDirections.includes(dir)) { | ||
return true; | ||
} | ||
return shouldScroll; | ||
}; | ||
var handleSheetSwipe = function (_a) { | ||
var initial = _a.initial, velocity = _a.velocity, deltaY = _a.deltaY, event = _a.event; | ||
if (scrollOccurred.current || shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeEnd = function (swipeParams) { | ||
var initial = swipeParams.initial, velocity = swipeParams.velocity, deltaY = swipeParams.deltaY, event = swipeParams.event, dir = swipeParams.dir; | ||
var shouldPreventSwipe = scrollOccurred.current || | ||
shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir }); | ||
if (shouldPreventSwipe) { | ||
return; | ||
@@ -229,5 +240,5 @@ } | ||
}; | ||
var handleSheetSwipeStart = function (_a) { | ||
var deltaY = _a.deltaY, initial = _a.initial, event = _a.event; | ||
if (shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeStart = function (swipeParams) { | ||
var deltaY = swipeParams.deltaY, initial = swipeParams.initial, event = swipeParams.event, dir = swipeParams.dir; | ||
if (shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir })) { | ||
return; | ||
@@ -241,5 +252,7 @@ } | ||
}; | ||
var handleSheetSwiping = function (_a) { | ||
var initial = _a.initial, deltaY = _a.deltaY, event = _a.event; | ||
if (scrollOccurred.current || shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeMove = function (swipeParams) { | ||
var initial = swipeParams.initial, deltaY = swipeParams.deltaY, event = swipeParams.event, dir = swipeParams.dir; | ||
var shouldPreventSwipe = scrollOccurred.current || | ||
shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir }); | ||
if (shouldPreventSwipe) { | ||
return; | ||
@@ -257,4 +270,4 @@ } | ||
onSwipeStart: handleSheetSwipeStart, | ||
onSwiping: handleSheetSwiping, | ||
onSwiped: handleSheetSwipe, | ||
onSwiping: handleSheetSwipeMove, | ||
onSwiped: handleSheetSwipeEnd, | ||
onTouchEndOrOnMouseUp: handleTouchEnd, | ||
@@ -344,3 +357,3 @@ trackMouse: swipeable, | ||
_b)), disableBlockingScroll: disableBlockingScroll, disableFocusLock: disableFocusLock, transitionProps: tslib.__assign(tslib.__assign({ appear: true, timeout: utils.TIMEOUT, classNames: styles__default.default }, transitionProps), { onExited: handleExited, onEntered: handleEntered, onEnter: handleEnter, onExit: handleExit }), disableAutoFocus: disableAutoFocus, disableEscapeKeyDown: disableEscapeKeyDown, disableRestoreFocus: disableRestoreFocus, keepMounted: keepMounted }, | ||
React__default.default.createElement("div", { style: tslib.__assign({}, getHeightStyles()), className: cn__default.default(styles__default.default.wrapper, (_c = {}, | ||
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.wrapper, (_c = {}, | ||
_c[styles__default.default.fullscreen] = headerOffset === 0 && sheetOffset === 0, | ||
@@ -350,2 +363,3 @@ _c)), onTransitionEnd: setSheetHeight }, | ||
_d[styles__default.default.withTransition] = swipingInProgress === false, | ||
_d[styles__default.default.safeAreaBottom] = coreComponentsShared.os.isIOS(), | ||
_d)), style: tslib.__assign(tslib.__assign({}, getSwipeStyles()), getHeightStyles()) }, sheetSwipeableHandlers, { ref: mergeRefs__default.default([sheetRef, sheetContainerRef, sheetSwipeableHandlers.ref]), onTransitionEnd: handleTransitionEnd }), | ||
@@ -352,0 +366,0 @@ renderMarker(), |
@@ -8,9 +8,10 @@ import { __assign } from 'tslib'; | ||
import { BaseModal } from '@alfalab/core-components-base-modal/esm'; | ||
import { fnUtils, getDataTestId } from '@alfalab/core-components-shared/esm'; | ||
import { fnUtils, os, getDataTestId } from '@alfalab/core-components-shared/esm'; | ||
import { Footer } from './components/footer/Component.js'; | ||
import { Header } from './components/header/Component.js'; | ||
import { SwipeableBackdrop } from './components/swipeable-backdrop/Component.js'; | ||
import { horizontalDirections } from './consts/swipeConsts.js'; | ||
import { convertPercentToNumber, TIMEOUT, MARKER_HEIGHT, SCROLL_OFFSET, SWIPE_VELOCITY, CLOSE_OFFSET } from './utils.js'; | ||
var styles = {"modal":"bottom-sheet__modal_1gk54","wrapper":"bottom-sheet__wrapper_1gk54","fullscreen":"bottom-sheet__fullscreen_1gk54","component":"bottom-sheet__component_1gk54","withTransition":"bottom-sheet__withTransition_1gk54","scrollableContainer":"bottom-sheet__scrollableContainer_1gk54","marker":"bottom-sheet__marker_1gk54","defaultMarker":"bottom-sheet__defaultMarker_1gk54","content":"bottom-sheet__content_1gk54","noHeader":"bottom-sheet__noHeader_1gk54","noFooter":"bottom-sheet__noFooter_1gk54","scrollLocked":"bottom-sheet__scrollLocked_1gk54","hiddenScrollbar":"bottom-sheet__hiddenScrollbar_1gk54","disabledPointerEvents":"bottom-sheet__disabledPointerEvents_1gk54","appear":"bottom-sheet__appear_1gk54","enter":"bottom-sheet__enter_1gk54","appearActive":"bottom-sheet__appearActive_1gk54","enterActive":"bottom-sheet__enterActive_1gk54","enterDone":"bottom-sheet__enterDone_1gk54","appearDone":"bottom-sheet__appearDone_1gk54","exit":"bottom-sheet__exit_1gk54","exitActive":"bottom-sheet__exitActive_1gk54","background-accent":"bottom-sheet__background-accent_1gk54","background-info":"bottom-sheet__background-info_1gk54","background-attention-muted":"bottom-sheet__background-attention-muted_1gk54","background-positive-muted":"bottom-sheet__background-positive-muted_1gk54","background-negative-muted":"bottom-sheet__background-negative-muted_1gk54","background-primary":"bottom-sheet__background-primary_1gk54","background-primary-inverted":"bottom-sheet__background-primary-inverted_1gk54","background-secondary":"bottom-sheet__background-secondary_1gk54","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_1gk54","background-tertiary":"bottom-sheet__background-tertiary_1gk54","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_1gk54","background-quaternary":"bottom-sheet__background-quaternary_1gk54","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_1gk54","background-specialbg-component":"bottom-sheet__background-specialbg-component_1gk54","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_1gk54","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_1gk54","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_1gk54","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_1gk54","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_1gk54","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_1gk54","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_1gk54","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_1gk54"}; | ||
var styles = {"modal":"bottom-sheet__modal_tmbtb","wrapper":"bottom-sheet__wrapper_tmbtb","fullscreen":"bottom-sheet__fullscreen_tmbtb","component":"bottom-sheet__component_tmbtb","withTransition":"bottom-sheet__withTransition_tmbtb","scrollableContainer":"bottom-sheet__scrollableContainer_tmbtb","marker":"bottom-sheet__marker_tmbtb","defaultMarker":"bottom-sheet__defaultMarker_tmbtb","content":"bottom-sheet__content_tmbtb","noHeader":"bottom-sheet__noHeader_tmbtb","noFooter":"bottom-sheet__noFooter_tmbtb","scrollLocked":"bottom-sheet__scrollLocked_tmbtb","hiddenScrollbar":"bottom-sheet__hiddenScrollbar_tmbtb","disabledPointerEvents":"bottom-sheet__disabledPointerEvents_tmbtb","appear":"bottom-sheet__appear_tmbtb","enter":"bottom-sheet__enter_tmbtb","appearActive":"bottom-sheet__appearActive_tmbtb","enterActive":"bottom-sheet__enterActive_tmbtb","enterDone":"bottom-sheet__enterDone_tmbtb","appearDone":"bottom-sheet__appearDone_tmbtb","exit":"bottom-sheet__exit_tmbtb","exitActive":"bottom-sheet__exitActive_tmbtb","safeAreaBottom":"bottom-sheet__safeAreaBottom_tmbtb","background-accent":"bottom-sheet__background-accent_tmbtb","background-info":"bottom-sheet__background-info_tmbtb","background-attention-muted":"bottom-sheet__background-attention-muted_tmbtb","background-positive-muted":"bottom-sheet__background-positive-muted_tmbtb","background-negative-muted":"bottom-sheet__background-negative-muted_tmbtb","background-primary":"bottom-sheet__background-primary_tmbtb","background-primary-inverted":"bottom-sheet__background-primary-inverted_tmbtb","background-secondary":"bottom-sheet__background-secondary_tmbtb","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_tmbtb","background-tertiary":"bottom-sheet__background-tertiary_tmbtb","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_tmbtb","background-quaternary":"bottom-sheet__background-quaternary_tmbtb","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_tmbtb","background-specialbg-component":"bottom-sheet__background-specialbg-component_tmbtb","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_tmbtb","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_tmbtb","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_tmbtb","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_tmbtb","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_tmbtb","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_tmbtb","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_tmbtb","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_tmbtb"}; | ||
require('./index.css') | ||
@@ -26,2 +27,3 @@ | ||
var magneticAreas = useMemo(function () { | ||
var _a; | ||
if (magneticAreasProp) { | ||
@@ -32,3 +34,5 @@ return magneticAreasProp.map(function (area) { | ||
} | ||
return [0, fullHeight - headerOffset]; | ||
var iOSViewHeight = ((_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.clientHeight) || window.innerHeight; | ||
var viewHeight = os.isIOS() ? iOSViewHeight : fullHeight; | ||
return [0, viewHeight - headerOffset]; | ||
}, [fullHeight, headerOffset, magneticAreasProp]); | ||
@@ -183,4 +187,5 @@ var lastMagneticArea = magneticAreas[magneticAreas.length - 1]; | ||
*/ | ||
var shouldSkipSwiping = function (deltaY, startY, event) { | ||
var shouldSkipSwiping = function (swipeParams) { | ||
var _a; | ||
var deltaY = swipeParams.deltaY, startY = swipeParams.startY, event = swipeParams.event, dir = swipeParams.dir; | ||
if (scrollLockedProp || swipingInProgress) | ||
@@ -210,7 +215,13 @@ return false; | ||
} | ||
// Если контент внутри шторки скроллится горизонально - то шторка не должна закрываться | ||
if (horizontalDirections.includes(dir)) { | ||
return true; | ||
} | ||
return shouldScroll; | ||
}; | ||
var handleSheetSwipe = function (_a) { | ||
var initial = _a.initial, velocity = _a.velocity, deltaY = _a.deltaY, event = _a.event; | ||
if (scrollOccurred.current || shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeEnd = function (swipeParams) { | ||
var initial = swipeParams.initial, velocity = swipeParams.velocity, deltaY = swipeParams.deltaY, event = swipeParams.event, dir = swipeParams.dir; | ||
var shouldPreventSwipe = scrollOccurred.current || | ||
shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir }); | ||
if (shouldPreventSwipe) { | ||
return; | ||
@@ -220,5 +231,5 @@ } | ||
}; | ||
var handleSheetSwipeStart = function (_a) { | ||
var deltaY = _a.deltaY, initial = _a.initial, event = _a.event; | ||
if (shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeStart = function (swipeParams) { | ||
var deltaY = swipeParams.deltaY, initial = swipeParams.initial, event = swipeParams.event, dir = swipeParams.dir; | ||
if (shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir })) { | ||
return; | ||
@@ -232,5 +243,7 @@ } | ||
}; | ||
var handleSheetSwiping = function (_a) { | ||
var initial = _a.initial, deltaY = _a.deltaY, event = _a.event; | ||
if (scrollOccurred.current || shouldSkipSwiping(deltaY, initial[1], event)) { | ||
var handleSheetSwipeMove = function (swipeParams) { | ||
var initial = swipeParams.initial, deltaY = swipeParams.deltaY, event = swipeParams.event, dir = swipeParams.dir; | ||
var shouldPreventSwipe = scrollOccurred.current || | ||
shouldSkipSwiping({ deltaY: deltaY, startY: initial[1], event: event, dir: dir }); | ||
if (shouldPreventSwipe) { | ||
return; | ||
@@ -248,4 +261,4 @@ } | ||
onSwipeStart: handleSheetSwipeStart, | ||
onSwiping: handleSheetSwiping, | ||
onSwiped: handleSheetSwipe, | ||
onSwiping: handleSheetSwipeMove, | ||
onSwiped: handleSheetSwipeEnd, | ||
onTouchEndOrOnMouseUp: handleTouchEnd, | ||
@@ -335,3 +348,3 @@ trackMouse: swipeable, | ||
_b)), disableBlockingScroll: disableBlockingScroll, disableFocusLock: disableFocusLock, transitionProps: __assign(__assign({ appear: true, timeout: TIMEOUT, classNames: styles }, transitionProps), { onExited: handleExited, onEntered: handleEntered, onEnter: handleEnter, onExit: handleExit }), disableAutoFocus: disableAutoFocus, disableEscapeKeyDown: disableEscapeKeyDown, disableRestoreFocus: disableRestoreFocus, keepMounted: keepMounted }, | ||
React.createElement("div", { style: __assign({}, getHeightStyles()), className: cn(styles.wrapper, (_c = {}, | ||
React.createElement("div", { className: cn(styles.wrapper, (_c = {}, | ||
_c[styles.fullscreen] = headerOffset === 0 && sheetOffset === 0, | ||
@@ -341,2 +354,3 @@ _c)), onTransitionEnd: setSheetHeight }, | ||
_d[styles.withTransition] = swipingInProgress === false, | ||
_d[styles.safeAreaBottom] = os.isIOS(), | ||
_d)), style: __assign(__assign({}, getSwipeStyles()), getHeightStyles()) }, sheetSwipeableHandlers, { ref: mergeRefs([sheetRef, sheetContainerRef, sheetSwipeableHandlers.ref]), onTransitionEnd: handleTransitionEnd }), | ||
@@ -343,0 +357,0 @@ renderMarker(), |
@@ -5,3 +5,3 @@ import React, { useContext, useEffect } from 'react'; | ||
var styles = {"footer":"bottom-sheet__footer_3m2vv","sticky":"bottom-sheet__sticky_3m2vv","highlighted":"bottom-sheet__highlighted_3m2vv","background-accent":"bottom-sheet__background-accent_3m2vv","background-info":"bottom-sheet__background-info_3m2vv","background-attention-muted":"bottom-sheet__background-attention-muted_3m2vv","background-positive-muted":"bottom-sheet__background-positive-muted_3m2vv","background-negative-muted":"bottom-sheet__background-negative-muted_3m2vv","background-primary":"bottom-sheet__background-primary_3m2vv","background-primary-inverted":"bottom-sheet__background-primary-inverted_3m2vv","background-secondary":"bottom-sheet__background-secondary_3m2vv","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_3m2vv","background-tertiary":"bottom-sheet__background-tertiary_3m2vv","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_3m2vv","background-quaternary":"bottom-sheet__background-quaternary_3m2vv","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_3m2vv","background-specialbg-component":"bottom-sheet__background-specialbg-component_3m2vv","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_3m2vv","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_3m2vv","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_3m2vv","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_3m2vv","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_3m2vv","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_3m2vv","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_3m2vv","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_3m2vv"}; | ||
var styles = {"footer":"bottom-sheet__footer_c562w","sticky":"bottom-sheet__sticky_c562w","highlighted":"bottom-sheet__highlighted_c562w","background-accent":"bottom-sheet__background-accent_c562w","background-info":"bottom-sheet__background-info_c562w","background-attention-muted":"bottom-sheet__background-attention-muted_c562w","background-positive-muted":"bottom-sheet__background-positive-muted_c562w","background-negative-muted":"bottom-sheet__background-negative-muted_c562w","background-primary":"bottom-sheet__background-primary_c562w","background-primary-inverted":"bottom-sheet__background-primary-inverted_c562w","background-secondary":"bottom-sheet__background-secondary_c562w","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_c562w","background-tertiary":"bottom-sheet__background-tertiary_c562w","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_c562w","background-quaternary":"bottom-sheet__background-quaternary_c562w","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_c562w","background-specialbg-component":"bottom-sheet__background-specialbg-component_c562w","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_c562w","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_c562w","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_c562w","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_c562w","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_c562w","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_c562w","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_c562w","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_c562w"}; | ||
require('./index.css') | ||
@@ -8,0 +8,0 @@ |
@@ -7,3 +7,3 @@ import { __rest, __assign } from 'tslib'; | ||
var styles = {"headerWrapper":"bottom-sheet__headerWrapper_wfvuy","hasContent":"bottom-sheet__hasContent_wfvuy","header":"bottom-sheet__header_wfvuy","sticky":"bottom-sheet__sticky_wfvuy","highlighted":"bottom-sheet__highlighted_wfvuy","justifyEnd":"bottom-sheet__justifyEnd_wfvuy","addon":"bottom-sheet__addon_wfvuy","addonFixed":"bottom-sheet__addonFixed_wfvuy","title":"bottom-sheet__title_wfvuy","titleCenter":"bottom-sheet__titleCenter_wfvuy","titleLeft":"bottom-sheet__titleLeft_wfvuy","trimTitle":"bottom-sheet__trimTitle_wfvuy"}; | ||
var styles = {"headerWrapper":"bottom-sheet__headerWrapper_14dgd","hasContent":"bottom-sheet__hasContent_14dgd","header":"bottom-sheet__header_14dgd","sticky":"bottom-sheet__sticky_14dgd","highlighted":"bottom-sheet__highlighted_14dgd","justifyEnd":"bottom-sheet__justifyEnd_14dgd","addon":"bottom-sheet__addon_14dgd","addonFixed":"bottom-sheet__addonFixed_14dgd","title":"bottom-sheet__title_14dgd","titleCenter":"bottom-sheet__titleCenter_14dgd","titleLeft":"bottom-sheet__titleLeft_14dgd","trimTitle":"bottom-sheet__trimTitle_14dgd"}; | ||
require('./index.css') | ||
@@ -10,0 +10,0 @@ |
@@ -7,9 +7,10 @@ import React, { forwardRef, useMemo, useState, useRef, useEffect, useImperativeHandle } from 'react'; | ||
import { BaseModal } from '@alfalab/core-components-base-modal/modern'; | ||
import { getDataTestId, fnUtils } from '@alfalab/core-components-shared/modern'; | ||
import { os, getDataTestId, fnUtils } from '@alfalab/core-components-shared/modern'; | ||
import { Footer } from './components/footer/Component.js'; | ||
import { Header } from './components/header/Component.js'; | ||
import { SwipeableBackdrop } from './components/swipeable-backdrop/Component.js'; | ||
import { horizontalDirections } from './consts/swipeConsts.js'; | ||
import { convertPercentToNumber, TIMEOUT, MARKER_HEIGHT, SCROLL_OFFSET, SWIPE_VELOCITY, CLOSE_OFFSET } from './utils.js'; | ||
const styles = {"modal":"bottom-sheet__modal_1gk54","wrapper":"bottom-sheet__wrapper_1gk54","fullscreen":"bottom-sheet__fullscreen_1gk54","component":"bottom-sheet__component_1gk54","withTransition":"bottom-sheet__withTransition_1gk54","scrollableContainer":"bottom-sheet__scrollableContainer_1gk54","marker":"bottom-sheet__marker_1gk54","defaultMarker":"bottom-sheet__defaultMarker_1gk54","content":"bottom-sheet__content_1gk54","noHeader":"bottom-sheet__noHeader_1gk54","noFooter":"bottom-sheet__noFooter_1gk54","scrollLocked":"bottom-sheet__scrollLocked_1gk54","hiddenScrollbar":"bottom-sheet__hiddenScrollbar_1gk54","disabledPointerEvents":"bottom-sheet__disabledPointerEvents_1gk54","appear":"bottom-sheet__appear_1gk54","enter":"bottom-sheet__enter_1gk54","appearActive":"bottom-sheet__appearActive_1gk54","enterActive":"bottom-sheet__enterActive_1gk54","enterDone":"bottom-sheet__enterDone_1gk54","appearDone":"bottom-sheet__appearDone_1gk54","exit":"bottom-sheet__exit_1gk54","exitActive":"bottom-sheet__exitActive_1gk54","background-accent":"bottom-sheet__background-accent_1gk54","background-info":"bottom-sheet__background-info_1gk54","background-attention-muted":"bottom-sheet__background-attention-muted_1gk54","background-positive-muted":"bottom-sheet__background-positive-muted_1gk54","background-negative-muted":"bottom-sheet__background-negative-muted_1gk54","background-primary":"bottom-sheet__background-primary_1gk54","background-primary-inverted":"bottom-sheet__background-primary-inverted_1gk54","background-secondary":"bottom-sheet__background-secondary_1gk54","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_1gk54","background-tertiary":"bottom-sheet__background-tertiary_1gk54","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_1gk54","background-quaternary":"bottom-sheet__background-quaternary_1gk54","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_1gk54","background-specialbg-component":"bottom-sheet__background-specialbg-component_1gk54","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_1gk54","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_1gk54","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_1gk54","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_1gk54","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_1gk54","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_1gk54","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_1gk54","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_1gk54"}; | ||
const styles = {"modal":"bottom-sheet__modal_tmbtb","wrapper":"bottom-sheet__wrapper_tmbtb","fullscreen":"bottom-sheet__fullscreen_tmbtb","component":"bottom-sheet__component_tmbtb","withTransition":"bottom-sheet__withTransition_tmbtb","scrollableContainer":"bottom-sheet__scrollableContainer_tmbtb","marker":"bottom-sheet__marker_tmbtb","defaultMarker":"bottom-sheet__defaultMarker_tmbtb","content":"bottom-sheet__content_tmbtb","noHeader":"bottom-sheet__noHeader_tmbtb","noFooter":"bottom-sheet__noFooter_tmbtb","scrollLocked":"bottom-sheet__scrollLocked_tmbtb","hiddenScrollbar":"bottom-sheet__hiddenScrollbar_tmbtb","disabledPointerEvents":"bottom-sheet__disabledPointerEvents_tmbtb","appear":"bottom-sheet__appear_tmbtb","enter":"bottom-sheet__enter_tmbtb","appearActive":"bottom-sheet__appearActive_tmbtb","enterActive":"bottom-sheet__enterActive_tmbtb","enterDone":"bottom-sheet__enterDone_tmbtb","appearDone":"bottom-sheet__appearDone_tmbtb","exit":"bottom-sheet__exit_tmbtb","exitActive":"bottom-sheet__exitActive_tmbtb","safeAreaBottom":"bottom-sheet__safeAreaBottom_tmbtb","background-accent":"bottom-sheet__background-accent_tmbtb","background-info":"bottom-sheet__background-info_tmbtb","background-attention-muted":"bottom-sheet__background-attention-muted_tmbtb","background-positive-muted":"bottom-sheet__background-positive-muted_tmbtb","background-negative-muted":"bottom-sheet__background-negative-muted_tmbtb","background-primary":"bottom-sheet__background-primary_tmbtb","background-primary-inverted":"bottom-sheet__background-primary-inverted_tmbtb","background-secondary":"bottom-sheet__background-secondary_tmbtb","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_tmbtb","background-tertiary":"bottom-sheet__background-tertiary_tmbtb","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_tmbtb","background-quaternary":"bottom-sheet__background-quaternary_tmbtb","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_tmbtb","background-specialbg-component":"bottom-sheet__background-specialbg-component_tmbtb","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_tmbtb","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_tmbtb","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_tmbtb","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_tmbtb","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_tmbtb","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_tmbtb","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_tmbtb","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_tmbtb"}; | ||
require('./index.css') | ||
@@ -26,3 +27,5 @@ | ||
} | ||
return [0, fullHeight - headerOffset]; | ||
const iOSViewHeight = document?.documentElement?.clientHeight || window.innerHeight; | ||
const viewHeight = os.isIOS() ? iOSViewHeight : fullHeight; | ||
return [0, viewHeight - headerOffset]; | ||
}, [fullHeight, headerOffset, magneticAreasProp]); | ||
@@ -200,3 +203,4 @@ const lastMagneticArea = magneticAreas[magneticAreas.length - 1]; | ||
*/ | ||
const shouldSkipSwiping = (deltaY, startY, event) => { | ||
const shouldSkipSwiping = (swipeParams) => { | ||
const { deltaY, startY, event, dir } = swipeParams; | ||
if (scrollLockedProp || swipingInProgress) | ||
@@ -226,6 +230,13 @@ return false; | ||
} | ||
// Если контент внутри шторки скроллится горизонально - то шторка не должна закрываться | ||
if (horizontalDirections.includes(dir)) { | ||
return true; | ||
} | ||
return shouldScroll; | ||
}; | ||
const handleSheetSwipe = ({ initial, velocity, deltaY, event }) => { | ||
if (scrollOccurred.current || shouldSkipSwiping(deltaY, initial[1], event)) { | ||
const handleSheetSwipeEnd = (swipeParams) => { | ||
const { initial, velocity, deltaY, event, dir } = swipeParams; | ||
const shouldPreventSwipe = scrollOccurred.current || | ||
shouldSkipSwiping({ deltaY, startY: initial[1], event, dir }); | ||
if (shouldPreventSwipe) { | ||
return; | ||
@@ -235,4 +246,5 @@ } | ||
}; | ||
const handleSheetSwipeStart = ({ deltaY, initial, event }) => { | ||
if (shouldSkipSwiping(deltaY, initial[1], event)) { | ||
const handleSheetSwipeStart = (swipeParams) => { | ||
const { deltaY, initial, event, dir } = swipeParams; | ||
if (shouldSkipSwiping({ deltaY, startY: initial[1], event, dir })) { | ||
return; | ||
@@ -243,4 +255,7 @@ } | ||
const handleTouchEnd = ({ event }) => stopSwiping(event); | ||
const handleSheetSwiping = ({ initial, deltaY, event }) => { | ||
if (scrollOccurred.current || shouldSkipSwiping(deltaY, initial[1], event)) { | ||
const handleSheetSwipeMove = (swipeParams) => { | ||
const { initial, deltaY, event, dir } = swipeParams; | ||
const shouldPreventSwipe = scrollOccurred.current || | ||
shouldSkipSwiping({ deltaY, startY: initial[1], event, dir }); | ||
if (shouldPreventSwipe) { | ||
return; | ||
@@ -258,4 +273,4 @@ } | ||
onSwipeStart: handleSheetSwipeStart, | ||
onSwiping: handleSheetSwiping, | ||
onSwiped: handleSheetSwipe, | ||
onSwiping: handleSheetSwipeMove, | ||
onSwiped: handleSheetSwipeEnd, | ||
onTouchEndOrOnMouseUp: handleTouchEnd, | ||
@@ -358,3 +373,3 @@ trackMouse: swipeable, | ||
}, disableAutoFocus: disableAutoFocus, disableEscapeKeyDown: disableEscapeKeyDown, disableRestoreFocus: disableRestoreFocus, keepMounted: keepMounted }, | ||
React.createElement("div", { style: { ...getHeightStyles() }, className: cn(styles.wrapper, { | ||
React.createElement("div", { className: cn(styles.wrapper, { | ||
[styles.fullscreen]: headerOffset === 0 && sheetOffset === 0, | ||
@@ -364,2 +379,3 @@ }), onTransitionEnd: setSheetHeight }, | ||
[styles.withTransition]: swipingInProgress === false, | ||
[styles.safeAreaBottom]: os.isIOS(), | ||
}), style: { | ||
@@ -366,0 +382,0 @@ ...getSwipeStyles(), |
@@ -5,3 +5,3 @@ import React, { useContext, useEffect } from 'react'; | ||
const styles = {"footer":"bottom-sheet__footer_3m2vv","sticky":"bottom-sheet__sticky_3m2vv","highlighted":"bottom-sheet__highlighted_3m2vv","background-accent":"bottom-sheet__background-accent_3m2vv","background-info":"bottom-sheet__background-info_3m2vv","background-attention-muted":"bottom-sheet__background-attention-muted_3m2vv","background-positive-muted":"bottom-sheet__background-positive-muted_3m2vv","background-negative-muted":"bottom-sheet__background-negative-muted_3m2vv","background-primary":"bottom-sheet__background-primary_3m2vv","background-primary-inverted":"bottom-sheet__background-primary-inverted_3m2vv","background-secondary":"bottom-sheet__background-secondary_3m2vv","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_3m2vv","background-tertiary":"bottom-sheet__background-tertiary_3m2vv","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_3m2vv","background-quaternary":"bottom-sheet__background-quaternary_3m2vv","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_3m2vv","background-specialbg-component":"bottom-sheet__background-specialbg-component_3m2vv","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_3m2vv","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_3m2vv","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_3m2vv","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_3m2vv","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_3m2vv","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_3m2vv","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_3m2vv","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_3m2vv"}; | ||
const styles = {"footer":"bottom-sheet__footer_c562w","sticky":"bottom-sheet__sticky_c562w","highlighted":"bottom-sheet__highlighted_c562w","background-accent":"bottom-sheet__background-accent_c562w","background-info":"bottom-sheet__background-info_c562w","background-attention-muted":"bottom-sheet__background-attention-muted_c562w","background-positive-muted":"bottom-sheet__background-positive-muted_c562w","background-negative-muted":"bottom-sheet__background-negative-muted_c562w","background-primary":"bottom-sheet__background-primary_c562w","background-primary-inverted":"bottom-sheet__background-primary-inverted_c562w","background-secondary":"bottom-sheet__background-secondary_c562w","background-secondary-inverted":"bottom-sheet__background-secondary-inverted_c562w","background-tertiary":"bottom-sheet__background-tertiary_c562w","background-tertiary-inverted":"bottom-sheet__background-tertiary-inverted_c562w","background-quaternary":"bottom-sheet__background-quaternary_c562w","background-quaternary-inverted":"bottom-sheet__background-quaternary-inverted_c562w","background-specialbg-component":"bottom-sheet__background-specialbg-component_c562w","background-specialbg-component-inverted":"bottom-sheet__background-specialbg-component-inverted_c562w","background-specialbg-primary-grouped":"bottom-sheet__background-specialbg-primary-grouped_c562w","background-specialbg-secondary-grouped":"bottom-sheet__background-specialbg-secondary-grouped_c562w","background-specialbg-tertiary-grouped":"bottom-sheet__background-specialbg-tertiary-grouped_c562w","background-specialbg-secondary-transparent":"bottom-sheet__background-specialbg-secondary-transparent_c562w","background-specialbg-secondary-transparent-inverted":"bottom-sheet__background-specialbg-secondary-transparent-inverted_c562w","background-specialbg-tertiary-transparent":"bottom-sheet__background-specialbg-tertiary-transparent_c562w","background-specialbg-tertiary-transparent-inverted":"bottom-sheet__background-specialbg-tertiary-transparent-inverted_c562w"}; | ||
require('./index.css') | ||
@@ -8,0 +8,0 @@ |
@@ -6,3 +6,3 @@ import React, { useContext, useEffect } from 'react'; | ||
const styles = {"headerWrapper":"bottom-sheet__headerWrapper_wfvuy","hasContent":"bottom-sheet__hasContent_wfvuy","header":"bottom-sheet__header_wfvuy","sticky":"bottom-sheet__sticky_wfvuy","highlighted":"bottom-sheet__highlighted_wfvuy","justifyEnd":"bottom-sheet__justifyEnd_wfvuy","addon":"bottom-sheet__addon_wfvuy","addonFixed":"bottom-sheet__addonFixed_wfvuy","title":"bottom-sheet__title_wfvuy","titleCenter":"bottom-sheet__titleCenter_wfvuy","titleLeft":"bottom-sheet__titleLeft_wfvuy","trimTitle":"bottom-sheet__trimTitle_wfvuy"}; | ||
const styles = {"headerWrapper":"bottom-sheet__headerWrapper_14dgd","hasContent":"bottom-sheet__hasContent_14dgd","header":"bottom-sheet__header_14dgd","sticky":"bottom-sheet__sticky_14dgd","highlighted":"bottom-sheet__highlighted_14dgd","justifyEnd":"bottom-sheet__justifyEnd_14dgd","addon":"bottom-sheet__addon_14dgd","addonFixed":"bottom-sheet__addonFixed_14dgd","title":"bottom-sheet__title_14dgd","titleCenter":"bottom-sheet__titleCenter_14dgd","titleLeft":"bottom-sheet__titleLeft_14dgd","trimTitle":"bottom-sheet__trimTitle_14dgd"}; | ||
require('./index.css') | ||
@@ -9,0 +9,0 @@ |
{ | ||
"name": "@alfalab/core-components-bottom-sheet", | ||
"version": "6.14.5", | ||
"version": "6.14.6", | ||
"description": "Bottom sheet mobile component", | ||
@@ -19,3 +19,3 @@ "keywords": [], | ||
"@alfalab/core-components-backdrop": "^3.2.0", | ||
"@alfalab/core-components-base-modal": "^5.7.2", | ||
"@alfalab/core-components-base-modal": "^5.7.3", | ||
"@alfalab/core-components-navigation-bar": "^0.8.7", | ||
@@ -22,0 +22,0 @@ "@alfalab/core-components-shared": "^0.9.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
311697
119
6220