@cloud-ru/ds-bottom-sheet 2.1.2 → 2.2.1-preview-2f5fa273.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 CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 2.2.0 (2026-11-12)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **FF-8815:** synchronize modal and bottom sheet modes ([621b2d6](https://github.com/cloud-ru-tech/snack-v2/commit/621b2d6ad7999a271d52f6ef26cdb6638f4ce11f))
11
+
12
+ ### Features
13
+
14
+ - **FF-8815:** add bottom sheet interaction modes ([b4ccdf1](https://github.com/cloud-ru-tech/snack-v2/commit/b4ccdf162d0ea5e482574e4bdc9f865e672f3238))
15
+
6
16
  ## 2.1.2 (2026-11-11)
7
17
 
8
18
  **Note:** Version bump only for package @ds/bottom-sheet
package/README.md CHANGED
@@ -19,6 +19,8 @@ Drag-индикатор 32×4px сверху — визуальная подск
19
19
  ### Backdrop (default `showBackdrop=true`)
20
20
  Полупрозрачная подложка. Click по backdrop'у вызывает `onClose`. При `showBackdrop={false}` фон не затемняется и click-outside не закрывает sheet.
21
21
 
22
+ `mode` задаёт поведение sheet: `regular` (по умолчанию) сохраняет стандартное закрытие; `aggressive` размывает фон и запрещает закрытие кликом по подложке; `forced` дополнительно запрещает закрытие свайпом, Escape и переходом по истории браузера независимо от `swipeEnabled` и `closeOnPopstate`. Размытие применяется только при `showBackdrop={true}`.
23
+
22
24
  ### Non-modal (default `lockScroll=true`)
23
25
  По умолчанию sheet — модальный: фон затемнён и заблокирован для скролла. Для non-modal сценария (sheet поверх контента, с которым продолжают работать) передайте `lockScroll={false}` (страница под sheet'ом скроллится) — обычно вместе с `showBackdrop={false}`.
24
26
 
@@ -688,6 +690,7 @@ export function NonModal() {
688
690
  | `footerTestIds` | `{ approve?: string; cancel?: string; additional?: string \| undefined; } \| undefined` | — | Переопределение `data-test-id` собранных слотов футера (approve/cancel/additional). <br/> По умолчанию — собственные id `BottomSheet`. Адаптивные `Modal`/`Drawer` передают сюда свои <br/> `TEST_IDS.footer*`, чтобы футер метился одинаково на desktop-поверхности и в mobile-sheet'е. |
689
691
  | `lockScroll` | `boolean` | `true` | Блокировать ли скролл фона на время открытия (`react-remove-scroll`). При `false` страница <br/> под sheet'ом остаётся прокручиваемой — для non-modal сценариев (sheet поверх контента, с <br/> которым продолжают взаимодействовать). Обычно используется вместе с `showBackdrop={false}`. |
690
692
  | `media` | `PopupMediaProps` | — | Media-блок над шапкой: изображение / иконка либо произвольный `ReactNode`. |
693
+ | `mode` | `"aggressive"` \| `"forced"` \| `"regular"` | `'regular'` | Режим поведения: `regular` — стандартное закрытие; `aggressive` — размытие фона <br/> и запрет закрытия кликом по подложке; `forced` — дополнительно запрещает закрытие свайпом, Escape и переходом по истории браузера. <br/> Размытие применяется только при `showBackdrop=true`. |
691
694
  | `onBackButtonClick` | `(() => void)` | — | Callback клика на back-кнопку (слева в шапке). <br/> Наличие callback'а рендерит ArrowLeft-кнопку. |
692
695
  | `onClose` | `() => void` | — | Колбэк закрытия (вызывается при click outside, Esc, swipe-down, browser-back). |
693
696
  | `onSnapIndexChange` | `((snapIndex: number) => void)` | — | Callback изменения активного snap'а (пересечение swipe-границы или click по UI). <br/> Не вызывается при программной смене controlled `snapIndex`. |
@@ -701,12 +704,16 @@ export function NonModal() {
701
704
  | `snapIndex` | `number` | — | Controlled-индекс активного snap'а. Если задан, sheet всегда находится на этом snap'е; <br/> swipe-up/down вызывают `onSnapIndexChange`, но не меняют позицию сами — consumer должен <br/> передать новое значение. |
702
705
  | `snapPoints` | `SnapPoint` | — | Массив фиксированных позиций sheet'а от меньшей к большей. По дефолту `undefined` — <br/> sheet `height: auto` с одним snap'ом по высоте контента. <br/> Пример: `[0.5, 1]` — sheet открывается на половину экрана, drag вверх раскрывает <br/> до full-viewport; drag вниз ниже `0.5` ведёт к закрытию. <br/> Контракт массива (движок не сортирует и не дедуплицирует — порядок и различимость на <br/> стороне потребителя): <br/> - строго по возрастанию: индекс `0` — самая компактная позиция, последний — top / expanded; <br/> - значения должны резолвиться в различные высоты (`['50%', 0.5]` на типичном вьюпорте дадут <br/> одну высоту → дубль-индекс будет недостижим свайпом); <br/> - `'fit-content'` имеет смысл только как ЕДИНСТВЕННЫЙ snap (без `snapPoints`); внутри массива <br/> фиксированных позиций его «контентная» высота не определена. |
703
706
  | `subtitle` | `ReactNode` | — | Текстовая строка-подзаголовок под title. |
704
- | `swipeEnabled` | `boolean` | `true` | Включает swipe-down для закрытия / swipe-up для раскрытия на следующий snap-point. <br/> При `swipeEnabled=false` snap-point по-прежнему можно переключить через controlled `snapIndex` prop'ом. |
707
+ | `swipeEnabled` | `boolean` | `true` | Включает swipe-down для закрытия / swipe-up для раскрытия на следующий snap-point. <br/> В режиме `forced` свайп отключён независимо от значения свойства. <br/> При `swipeEnabled=false` snap-point по-прежнему можно переключить через controlled `snapIndex` prop'ом. |
705
708
  | `title` | `ReactNode` | — | Заголовок в шапке. |
706
709
  | `withDividers` | `boolean` | `true` | Тонкие линии между topBar↔body и body↔footer: разграничивают закреплённые шапку и подвал <br/> от прокручиваемого под ними содержимого. Передайте `false`, чтобы убрать обе линии. |
710
+ | `withFooterDivider` | `boolean` | `true` | Разделитель над футером. По умолчанию используется `withDividers`. |
711
+ | `withHeaderDivider` | `boolean` | `true` | Разделитель под шапкой. По умолчанию используется `withDividers`. |
707
712
 
708
713
  #### Related types
709
714
 
715
+ - `BottomSheetMode` = `"aggressive"` \| `"forced"` \| `"regular"`
716
+
710
717
  - `SnapPoint` = `number | "fit-content" | `${number}px` | `${number}%` | `${number}dvh` | `${number}svh` | `${number}lvh``
711
718
 
712
719
  ## Смотри также
@@ -949,6 +956,7 @@ export function CustomDisableMotions() {
949
956
  | `defaultSnapIndex` | `number` | `0` | Индекс snap'а, на котором sheet открывается по дефолту. Игнорируется при controlled `snapIndex`. |
950
957
  | `disableMotions` | `boolean` | `false` | Отключить анимации открытия / закрытия и перехода между snap-точками. |
951
958
  | `lockScroll` | `boolean` | `true` | Блокировать ли скролл фона на время открытия (`react-remove-scroll`). При `false` страница <br/> под sheet'ом остаётся прокручиваемой — для non-modal сценариев (sheet поверх контента, с <br/> которым продолжают взаимодействовать). Обычно используется вместе с `showBackdrop={false}`. |
959
+ | `mode` | `"aggressive"` \| `"forced"` \| `"regular"` | `'regular'` | Режим поведения: `regular` — стандартное закрытие; `aggressive` — размытие фона <br/> и запрет закрытия кликом по подложке; `forced` — дополнительно запрещает закрытие свайпом, Escape и переходом по истории браузера. <br/> Размытие применяется только при `showBackdrop=true`. |
952
960
  | `onClose` | `() => void` | — | Колбэк закрытия (вызывается при click outside, Esc, swipe-down, browser-back). |
953
961
  | `onSnapIndexChange` | `((snapIndex: number) => void)` | — | Callback изменения активного snap'а (пересечение swipe-границы или click по UI). <br/> Не вызывается при программной смене controlled `snapIndex`. |
954
962
  | `open` | `boolean` | — | Управление состоянием показан / не показан. |
@@ -958,10 +966,12 @@ export function CustomDisableMotions() {
958
966
  | `showBackdrop` | `boolean` | `true` | Отображение тёмной подложки за sheet'ом. При `false` фон не затемняется и click-outside <br/> не закрывает sheet (нет backdrop-узла, по которому ловится клик). |
959
967
  | `snapIndex` | `number` | — | Controlled-индекс активного snap'а. Если задан, sheet всегда находится на этом snap'е; <br/> swipe-up/down вызывают `onSnapIndexChange`, но не меняют позицию сами — consumer должен <br/> передать новое значение. |
960
968
  | `snapPoints` | `SnapPoint` | — | Массив фиксированных позиций sheet'а от меньшей к большей. По дефолту `undefined` — <br/> sheet `height: auto` с одним snap'ом по высоте контента. <br/> Пример: `[0.5, 1]` — sheet открывается на половину экрана, drag вверх раскрывает <br/> до full-viewport; drag вниз ниже `0.5` ведёт к закрытию. <br/> Контракт массива (движок не сортирует и не дедуплицирует — порядок и различимость на <br/> стороне потребителя): <br/> - строго по возрастанию: индекс `0` — самая компактная позиция, последний — top / expanded; <br/> - значения должны резолвиться в различные высоты (`['50%', 0.5]` на типичном вьюпорте дадут <br/> одну высоту → дубль-индекс будет недостижим свайпом); <br/> - `'fit-content'` имеет смысл только как ЕДИНСТВЕННЫЙ snap (без `snapPoints`); внутри массива <br/> фиксированных позиций его «контентная» высота не определена. |
961
- | `swipeEnabled` | `boolean` | `true` | Включает swipe-down для закрытия / swipe-up для раскрытия на следующий snap-point. <br/> При `swipeEnabled=false` snap-point по-прежнему можно переключить через controlled `snapIndex` prop'ом. |
969
+ | `swipeEnabled` | `boolean` | `true` | Включает swipe-down для закрытия / swipe-up для раскрытия на следующий snap-point. <br/> В режиме `forced` свайп отключён независимо от значения свойства. <br/> При `swipeEnabled=false` snap-point по-прежнему можно переключить через controlled `snapIndex` prop'ом. |
962
970
 
963
971
  ##### Related types
964
972
 
973
+ - `BottomSheetMode` = `"aggressive"` \| `"forced"` \| `"regular"`
974
+
965
975
  - `SnapPoint` = `number | "fit-content" | `${number}px` | `${number}%` | `${number}dvh` | `${number}svh` | `${number}lvh``
966
976
 
967
977
  ### Смотри также
@@ -1,3 +1,3 @@
1
1
  import { BottomSheetProps } from '../../types';
2
2
  /** Обёртка `@cloud-ru/ds-bottom-sheet` с готовой анатомией: media + header + body + footer + safe-area + dividers. */
3
- export declare function BottomSheet({ title, slotAfterTitle, subtitle, slotSecondTitle, onBackButtonClick, actionButton, media, content, bodyPadding, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, footerTestIds, withDividers, swipeEnabled, className, ...rest }: BottomSheetProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function BottomSheet({ title, slotAfterTitle, subtitle, slotSecondTitle, onBackButtonClick, actionButton, media, content, bodyPadding, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, footerTestIds, withDividers, withHeaderDivider, withFooterDivider, swipeEnabled, className, ...rest }: BottomSheetProps): import("react/jsx-runtime").JSX.Element;
@@ -14,7 +14,7 @@ function isMediaProps(value) {
14
14
  return typeof value === 'object' && value !== null && !(0, react_1.isValidElement)(value) && 'src' in value && 'alt' in value;
15
15
  }
16
16
  /** Обёртка `@cloud-ru/ds-bottom-sheet` с готовой анатомией: media + header + body + footer + safe-area + dividers. */
17
- function BottomSheet({ title, slotAfterTitle, subtitle, slotSecondTitle, onBackButtonClick, actionButton, media, content, bodyPadding = true, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, footerTestIds, withDividers = true, swipeEnabled = true,
17
+ function BottomSheet({ title, slotAfterTitle, subtitle, slotSecondTitle, onBackButtonClick, actionButton, media, content, bodyPadding = true, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, footerTestIds, withDividers = true, withHeaderDivider = withDividers, withFooterDivider = withDividers, swipeEnabled = true,
18
18
  // safeAreaTop/safeAreaBottom уходят в `...rest` → BottomSheetCustom (env-паддинг на `.content`).
19
19
  className, ...rest }) {
20
20
  const hasHeader = Boolean(title || onBackButtonClick || actionButton || slotAfterTitle || subtitle || slotSecondTitle);
@@ -33,5 +33,5 @@ className, ...rest }) {
33
33
  return ((0, jsx_runtime_1.jsx)(BottomSheetCustom_1.BottomSheetCustom, { ...rest, swipeEnabled: swipeEnabled, ...(title ? { 'aria-labelledby': titleId } : {}), className: className, disableMotions: false, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.root, children: [hasMedia &&
34
34
  (isMediaProps(media) ? ((0, jsx_runtime_1.jsx)(popup_private_1.PopupMedia, { ...media })) : (
35
35
  // ReactNode-media: тот же data-media-kind-контракт со значением 'custom'.
36
- (0, jsx_runtime_1.jsx)("div", { "data-test-id": constants_1.TEST_IDS.media, "data-media-kind": 'custom', children: media }))), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.contentBlock, children: [hasHeader && ((0, jsx_runtime_1.jsx)(BottomSheetCustom_1.BottomSheetCustom.Header, { title: title, titleId: titleId, slotAfterTitle: slotAfterTitle, subtitle: subtitle, slotSecondTitle: slotSecondTitle, onBackButtonClick: onBackButtonClick, actionButton: actionButton })), withDividers && hasHeader && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.divider, "data-test-id": constants_1.TEST_IDS.dividerTop, "aria-hidden": true })), (0, jsx_runtime_1.jsx)(BottomSheetCustom_1.BottomSheetCustom.Body, { bodyPadding: bodyPadding, children: content }), withDividers && hasFooter && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.divider, "data-test-id": constants_1.TEST_IDS.dividerBottom, "aria-hidden": true })), hasFooter && (0, jsx_runtime_1.jsx)(BottomSheetCustom_1.BottomSheetCustom.Footer, { children: footerContent })] })] }) }));
36
+ (0, jsx_runtime_1.jsx)("div", { "data-test-id": constants_1.TEST_IDS.media, "data-media-kind": 'custom', children: media }))), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.contentBlock, children: [hasHeader && ((0, jsx_runtime_1.jsx)(BottomSheetCustom_1.BottomSheetCustom.Header, { title: title, titleId: titleId, slotAfterTitle: slotAfterTitle, subtitle: subtitle, slotSecondTitle: slotSecondTitle, onBackButtonClick: onBackButtonClick, actionButton: actionButton })), withHeaderDivider && hasHeader && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.divider, "data-test-id": constants_1.TEST_IDS.dividerTop, "aria-hidden": true })), (0, jsx_runtime_1.jsx)(BottomSheetCustom_1.BottomSheetCustom.Body, { bodyPadding: bodyPadding, children: content }), withFooterDivider && hasFooter && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.divider, "data-test-id": constants_1.TEST_IDS.dividerBottom, "aria-hidden": true })), hasFooter && (0, jsx_runtime_1.jsx)(BottomSheetCustom_1.BottomSheetCustom.Footer, { children: footerContent })] })] }) }));
37
37
  }
@@ -34,11 +34,16 @@ function resolveContainer(container, portalContextNode) {
34
34
  * Pointer-Events swipe / snap-engine. Готовая анатомия — `BottomSheet`.
35
35
  */
36
36
  function BottomSheetCustom(props) {
37
- const { open, onClose, showBackdrop = true, lockScroll = true, swipeEnabled = true, safeAreaTop = true, safeAreaBottom = true, snapPoints, defaultSnapIndex, snapIndex, onSnapIndexChange, closeOnPopstate = true, disableMotions = false, container, className, rootClassName, children, ...rest } = props;
37
+ const { open, onClose, showBackdrop = true, mode = constants_1.MODE.Regular, lockScroll = true, swipeEnabled = true, safeAreaTop = true, safeAreaBottom = true, snapPoints, defaultSnapIndex, snapIndex, onSnapIndexChange, closeOnPopstate = true, disableMotions = false, container, className, rootClassName, children, ...rest } = props;
38
38
  // Sheet модальный, если затемняет фон или лочит скролл. Non-modal не прячет фон от AT,
39
39
  // не ловит фокус и закрывается по Esc при фокусе снаружи.
40
40
  const isModal = showBackdrop || lockScroll;
41
- (0, utils_1.useModalOpenState)(open, onClose, { closeOnPopstate });
41
+ const backdropBlur = mode !== constants_1.MODE.Regular;
42
+ const isSwipeEnabled = swipeEnabled && mode !== constants_1.MODE.Forced;
43
+ (0, utils_1.useModalOpenState)(open, () => {
44
+ if (mode !== constants_1.MODE.Forced)
45
+ onClose();
46
+ }, { closeOnPopstate });
42
47
  // Возврат фокуса на триггер: запоминаем активный элемент при open=true, возвращаем при open=false.
43
48
  const restoreFocusRef = (0, react_1.useRef)(null);
44
49
  const wasOpenRef = (0, react_1.useRef)(false);
@@ -68,7 +73,7 @@ function BottomSheetCustom(props) {
68
73
  // Nested-safe для модального sheet'а: закрываем только если фокус внутри этой панели; для
69
74
  // non-modal фокус снаружи — закрываем безусловно.
70
75
  (0, react_1.useEffect)(() => {
71
- if (!isActive || !(0, utils_1.isBrowser)() || 'CloseWatcher' in window)
76
+ if (!isActive || mode === constants_1.MODE.Forced || !(0, utils_1.isBrowser)() || 'CloseWatcher' in window)
72
77
  return;
73
78
  const handleKeyDown = (event) => {
74
79
  if (event.key !== 'Escape')
@@ -81,14 +86,14 @@ function BottomSheetCustom(props) {
81
86
  };
82
87
  document.addEventListener('keydown', handleKeyDown, true);
83
88
  return () => document.removeEventListener('keydown', handleKeyDown, true);
84
- }, [isActive, isModal, onClose, focusTrapRef]);
89
+ }, [isActive, isModal, mode, onClose, focusTrapRef]);
85
90
  const { setContentNode, dragHandlers, snapIndex: activeSnapIndex, isDragging, } = (0, hooks_1.useDragEngine)({
86
91
  snapPoints,
87
92
  defaultSnapIndex,
88
93
  snapIndex,
89
94
  onSnapIndexChange,
90
95
  onClose,
91
- swipeEnabled,
96
+ swipeEnabled: isSwipeEnabled,
92
97
  isActive,
93
98
  });
94
99
  // Верхний safe-area отступ нужен только на full-height (верх под notch); флаг — в `data-full-height`.
@@ -99,9 +104,9 @@ function BottomSheetCustom(props) {
99
104
  setContentNode(node);
100
105
  }, [focusTrapRef, setContentNode]);
101
106
  const handleBackdropClick = (0, react_1.useCallback)(() => {
102
- if (showBackdrop)
107
+ if (showBackdrop && mode === constants_1.MODE.Regular)
103
108
  onClose();
104
- }, [showBackdrop, onClose]);
109
+ }, [showBackdrop, mode, onClose]);
105
110
  // Мобильная поверхность фиксирует только платформу webMobile, плотность наследуется от приложения.
106
111
  const themeClassName = (0, theme_1.useThemeClassnames)({ platform: theme_1.PLATFORM.WebMobile });
107
112
  if (!isMounted)
@@ -113,7 +118,7 @@ function BottomSheetCustom(props) {
113
118
  return (0, react_dom_1.createPortal)(
114
119
  // RemoveScroll лочит фон-скролл (refcount для вложенных sheet'ов); `enabled={lockScroll}` —
115
120
  // для non-modal фон остаётся прокручиваемым.
116
- (0, jsx_runtime_1.jsx)(react_remove_scroll_1.RemoveScroll, { enabled: lockScroll, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, rootClassName), "data-active": isActive || undefined, "data-disable-motions": disableMotions || undefined, children: [showBackdrop && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.backdrop, "data-test-id": constants_1.TEST_IDS.backdrop, onClick: handleBackdropClick, "aria-hidden": true })), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.contentWrapper, "data-active": isActive || undefined, "data-full-height": isFullHeight || undefined, children: (0, jsx_runtime_1.jsxs)("div", { ref: mergeRefCb, className: (0, classnames_1.default)(styles_module_scss_1.default.content, themeClassName, className), role: 'dialog', "aria-modal": isModal ? 'true' : undefined, "data-test-id": constants_1.TEST_IDS.root, "data-safe-area-top": (safeAreaTop && isFullHeight) || undefined, "data-safe-area-bottom": safeAreaBottom || undefined, "data-snap-index": activeSnapIndex, "data-snap-points": snapPoints && snapPoints.length > 0 ? snapPoints.length : undefined, "data-swipe-enabled": swipeEnabled || undefined, "data-dragging": isDragging || undefined, "data-full-height": isFullHeight || undefined, ...supportProps, ...(swipeEnabled ? dragHandlers : {}), children: [swipeEnabled && (0, jsx_runtime_1.jsx)(helperComponents_1.Handle, {}), (0, jsx_runtime_1.jsx)(popup_private_1.OverlaySurfaceProvider, { surface: popup_private_1.OVERLAY_SURFACE.Sheet, children: children })] }) })] }) }), targetNode);
121
+ (0, jsx_runtime_1.jsx)(react_remove_scroll_1.RemoveScroll, { enabled: lockScroll, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.root, rootClassName), "data-active": isActive || undefined, "data-disable-motions": disableMotions || undefined, children: [showBackdrop && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.backdrop, "data-backdrop-blur": backdropBlur || undefined, "data-test-id": constants_1.TEST_IDS.backdrop, onClick: handleBackdropClick, "aria-hidden": true })), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.contentWrapper, "data-active": isActive || undefined, "data-full-height": isFullHeight || undefined, children: (0, jsx_runtime_1.jsxs)("div", { ref: mergeRefCb, className: (0, classnames_1.default)(styles_module_scss_1.default.content, themeClassName, className), role: 'dialog', "aria-modal": isModal ? 'true' : undefined, "data-test-id": constants_1.TEST_IDS.root, "data-safe-area-top": (safeAreaTop && isFullHeight) || undefined, "data-safe-area-bottom": safeAreaBottom || undefined, "data-snap-index": activeSnapIndex, "data-snap-points": snapPoints && snapPoints.length > 0 ? snapPoints.length : undefined, "data-swipe-enabled": isSwipeEnabled || undefined, "data-dragging": isDragging || undefined, "data-full-height": isFullHeight || undefined, ...supportProps, ...(isSwipeEnabled ? dragHandlers : {}), children: [isSwipeEnabled && (0, jsx_runtime_1.jsx)(helperComponents_1.Handle, {}), (0, jsx_runtime_1.jsx)(popup_private_1.OverlaySurfaceProvider, { surface: popup_private_1.OVERLAY_SURFACE.Sheet, children: children })] }) })] }) }), targetNode);
117
122
  }
118
123
  BottomSheetCustom.Header = popup_private_1.PopupHeader;
119
124
  BottomSheetCustom.Body = popup_private_1.PopupBody;
@@ -14,6 +14,9 @@
14
14
  background-color:var(--sn-theme-color-blackout, var(--sn-brand-color-overlay-forLightMode-blackout, rgba(0, 0, 0, 0.3215686275)));
15
15
  transition:opacity 0.2s;
16
16
  }
17
+ .backdrop[data-backdrop-blur]{
18
+ backdrop-filter:blur(var(--sn-theme-effect-backgroundBlur, var(--sn-brand-effect-blur-overlay-backgroundBlur, 10px)));
19
+ }
17
20
  .root[data-active] .backdrop{
18
21
  opacity:1;
19
22
  }
@@ -20,3 +20,8 @@ export declare const SNAP_POINTS_PRESET: {
20
20
  /** Открывается на половину вьюпорта, drag вверх раскрывает на всю высоту. */
21
21
  halfFull: number[];
22
22
  };
23
+ export declare const MODE: {
24
+ readonly Regular: "regular";
25
+ readonly Aggressive: "aggressive";
26
+ readonly Forced: "forced";
27
+ };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Общий overlay-chrome (media / footer-ориентация / слот-`data-test-id`) вынесен в `@cloud-ru/ds-popup-private`.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SNAP_POINTS_PRESET = exports.NO_DRAG_ATTRIBUTE = exports.TEST_IDS = exports.MEDIA_KIND = exports.FOOTER_ACTIONS_ORIENTATION = void 0;
4
+ exports.MODE = exports.SNAP_POINTS_PRESET = exports.NO_DRAG_ATTRIBUTE = exports.TEST_IDS = exports.MEDIA_KIND = exports.FOOTER_ACTIONS_ORIENTATION = void 0;
5
5
  // Реэкспортируем под теми же именами — внешний контракт `@cloud-ru/ds-bottom-sheet` не меняется.
6
6
  var popup_private_1 = require("@cloud-ru/ds-popup-private");
7
7
  Object.defineProperty(exports, "FOOTER_ACTIONS_ORIENTATION", { enumerable: true, get: function () { return popup_private_1.FOOTER_ACTIONS_ORIENTATION; } });
@@ -28,3 +28,8 @@ exports.SNAP_POINTS_PRESET = {
28
28
  /** Открывается на половину вьюпорта, drag вверх раскрывает на всю высоту. */
29
29
  halfFull: [0.5, 1],
30
30
  };
31
+ exports.MODE = {
32
+ Regular: 'regular',
33
+ Aggressive: 'aggressive',
34
+ Forced: 'forced',
35
+ };
@@ -36,6 +36,9 @@
36
36
  background-color:var(--sn-theme-color-blackout, var(--sn-brand-color-overlay-forLightMode-blackout, rgba(0, 0, 0, 0.3215686275)));
37
37
  transition:opacity 0.2s;
38
38
  }
39
+ .backdrop[data-backdrop-blur]{
40
+ backdrop-filter:blur(var(--sn-theme-effect-backgroundBlur, var(--sn-brand-effect-blur-overlay-backgroundBlur, 10px)));
41
+ }
39
42
  .root[data-active] .backdrop{
40
43
  opacity:1;
41
44
  }
@@ -1,6 +1,8 @@
1
1
  import { BottomSheetActionButton, FooterActionsOrientation, PopupMediaProps } from '@cloud-ru/ds-popup-private';
2
- import { WithSupportProps } from '@cloud-ru/ds-utils';
2
+ import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
3
3
  import { PropsWithChildren, ReactNode } from 'react';
4
+ import { MODE } from './constants';
5
+ export type BottomSheetMode = ValueOf<typeof MODE>;
4
6
  export type { BottomSheetActionButton, FooterActionsOrientation, MediaKind, PopupBodyProps as BottomSheetBodyProps, PopupFooterProps as BottomSheetFooterProps, PopupHeaderProps as BottomSheetHeaderProps, PopupMediaProps as BottomSheetMediaProps, } from '@cloud-ru/ds-popup-private';
5
7
  /**
6
8
  * Фиксированная позиция bottom-sheet'а по высоте.
@@ -23,6 +25,13 @@ export type BottomSheetCustomProps = WithSupportProps<PropsWithChildren<{
23
25
  * @default true
24
26
  */
25
27
  showBackdrop?: boolean;
28
+ /**
29
+ * Режим поведения: `regular` — стандартное закрытие; `aggressive` — размытие фона
30
+ * и запрет закрытия кликом по подложке; `forced` — дополнительно запрещает закрытие свайпом, Escape и переходом по истории браузера.
31
+ * Размытие применяется только при `showBackdrop=true`.
32
+ * @default 'regular'
33
+ */
34
+ mode?: BottomSheetMode;
26
35
  /**
27
36
  * Блокировать ли скролл фона на время открытия (`react-remove-scroll`). При `false` страница
28
37
  * под sheet'ом остаётся прокручиваемой — для non-modal сценариев (sheet поверх контента, с
@@ -32,6 +41,7 @@ export type BottomSheetCustomProps = WithSupportProps<PropsWithChildren<{
32
41
  lockScroll?: boolean;
33
42
  /**
34
43
  * Включает swipe-down для закрытия / swipe-up для раскрытия на следующий snap-point.
44
+ * В режиме `forced` свайп отключён независимо от значения свойства.
35
45
  * При `swipeEnabled=false` snap-point по-прежнему можно переключить через controlled `snapIndex` prop'ом.
36
46
  * @default true
37
47
  */
@@ -130,6 +140,10 @@ export type BottomSheetProps = Omit<BottomSheetCustomProps, 'children' | 'disabl
130
140
  * @default true
131
141
  */
132
142
  withDividers?: boolean;
143
+ /** Разделитель под шапкой. По умолчанию используется `withDividers`. */
144
+ withHeaderDivider?: boolean;
145
+ /** Разделитель над футером. По умолчанию используется `withDividers`. */
146
+ withFooterDivider?: boolean;
133
147
  /**
134
148
  * Основная кнопка действия — объект пропсов `Button` (по умолчанию `view='filled'`,
135
149
  * `appearance='primary'`). Ширина зависит от `footerActionsOrientation` и числа кнопок.
@@ -1,3 +1,3 @@
1
1
  import { BottomSheetProps } from '../../types.js';
2
2
  /** Обёртка `@cloud-ru/ds-bottom-sheet` с готовой анатомией: media + header + body + footer + safe-area + dividers. */
3
- export declare function BottomSheet({ title, slotAfterTitle, subtitle, slotSecondTitle, onBackButtonClick, actionButton, media, content, bodyPadding, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, footerTestIds, withDividers, swipeEnabled, className, ...rest }: BottomSheetProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function BottomSheet({ title, slotAfterTitle, subtitle, slotSecondTitle, onBackButtonClick, actionButton, media, content, bodyPadding, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, footerTestIds, withDividers, withHeaderDivider, withFooterDivider, swipeEnabled, className, ...rest }: BottomSheetProps): import("react/jsx-runtime").JSX.Element;
@@ -8,7 +8,7 @@ function isMediaProps(value) {
8
8
  return typeof value === 'object' && value !== null && !isValidElement(value) && 'src' in value && 'alt' in value;
9
9
  }
10
10
  /** Обёртка `@cloud-ru/ds-bottom-sheet` с готовой анатомией: media + header + body + footer + safe-area + dividers. */
11
- export function BottomSheet({ title, slotAfterTitle, subtitle, slotSecondTitle, onBackButtonClick, actionButton, media, content, bodyPadding = true, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, footerTestIds, withDividers = true, swipeEnabled = true,
11
+ export function BottomSheet({ title, slotAfterTitle, subtitle, slotSecondTitle, onBackButtonClick, actionButton, media, content, bodyPadding = true, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, footerTestIds, withDividers = true, withHeaderDivider = withDividers, withFooterDivider = withDividers, swipeEnabled = true,
12
12
  // safeAreaTop/safeAreaBottom уходят в `...rest` → BottomSheetCustom (env-паддинг на `.content`).
13
13
  className, ...rest }) {
14
14
  const hasHeader = Boolean(title || onBackButtonClick || actionButton || slotAfterTitle || subtitle || slotSecondTitle);
@@ -27,5 +27,5 @@ className, ...rest }) {
27
27
  return (_jsx(BottomSheetCustom, { ...rest, swipeEnabled: swipeEnabled, ...(title ? { 'aria-labelledby': titleId } : {}), className: className, disableMotions: false, children: _jsxs("div", { className: styles.root, children: [hasMedia &&
28
28
  (isMediaProps(media) ? (_jsx(PopupMedia, { ...media })) : (
29
29
  // ReactNode-media: тот же data-media-kind-контракт со значением 'custom'.
30
- _jsx("div", { "data-test-id": TEST_IDS.media, "data-media-kind": 'custom', children: media }))), _jsxs("div", { className: styles.contentBlock, children: [hasHeader && (_jsx(BottomSheetCustom.Header, { title: title, titleId: titleId, slotAfterTitle: slotAfterTitle, subtitle: subtitle, slotSecondTitle: slotSecondTitle, onBackButtonClick: onBackButtonClick, actionButton: actionButton })), withDividers && hasHeader && (_jsx("div", { className: styles.divider, "data-test-id": TEST_IDS.dividerTop, "aria-hidden": true })), _jsx(BottomSheetCustom.Body, { bodyPadding: bodyPadding, children: content }), withDividers && hasFooter && (_jsx("div", { className: styles.divider, "data-test-id": TEST_IDS.dividerBottom, "aria-hidden": true })), hasFooter && _jsx(BottomSheetCustom.Footer, { children: footerContent })] })] }) }));
30
+ _jsx("div", { "data-test-id": TEST_IDS.media, "data-media-kind": 'custom', children: media }))), _jsxs("div", { className: styles.contentBlock, children: [hasHeader && (_jsx(BottomSheetCustom.Header, { title: title, titleId: titleId, slotAfterTitle: slotAfterTitle, subtitle: subtitle, slotSecondTitle: slotSecondTitle, onBackButtonClick: onBackButtonClick, actionButton: actionButton })), withHeaderDivider && hasHeader && (_jsx("div", { className: styles.divider, "data-test-id": TEST_IDS.dividerTop, "aria-hidden": true })), _jsx(BottomSheetCustom.Body, { bodyPadding: bodyPadding, children: content }), withFooterDivider && hasFooter && (_jsx("div", { className: styles.divider, "data-test-id": TEST_IDS.dividerBottom, "aria-hidden": true })), hasFooter && _jsx(BottomSheetCustom.Footer, { children: footerContent })] })] }) }));
31
31
  }
@@ -7,7 +7,7 @@ import cn from 'classnames';
7
7
  import { useCallback, useEffect, useRef } from 'react';
8
8
  import { createPortal } from 'react-dom';
9
9
  import { RemoveScroll } from 'react-remove-scroll';
10
- import { TEST_IDS } from '../../constants.js';
10
+ import { MODE, TEST_IDS } from '../../constants.js';
11
11
  import { Handle } from '../../helperComponents/index.js';
12
12
  import { CLOSING_TIMEOUT } from './constants.js';
13
13
  import { useDragEngine, useFocusTrap, useTransitionPhase } from './hooks/index.js';
@@ -28,11 +28,16 @@ function resolveContainer(container, portalContextNode) {
28
28
  * Pointer-Events swipe / snap-engine. Готовая анатомия — `BottomSheet`.
29
29
  */
30
30
  export function BottomSheetCustom(props) {
31
- const { open, onClose, showBackdrop = true, lockScroll = true, swipeEnabled = true, safeAreaTop = true, safeAreaBottom = true, snapPoints, defaultSnapIndex, snapIndex, onSnapIndexChange, closeOnPopstate = true, disableMotions = false, container, className, rootClassName, children, ...rest } = props;
31
+ const { open, onClose, showBackdrop = true, mode = MODE.Regular, lockScroll = true, swipeEnabled = true, safeAreaTop = true, safeAreaBottom = true, snapPoints, defaultSnapIndex, snapIndex, onSnapIndexChange, closeOnPopstate = true, disableMotions = false, container, className, rootClassName, children, ...rest } = props;
32
32
  // Sheet модальный, если затемняет фон или лочит скролл. Non-modal не прячет фон от AT,
33
33
  // не ловит фокус и закрывается по Esc при фокусе снаружи.
34
34
  const isModal = showBackdrop || lockScroll;
35
- useModalOpenState(open, onClose, { closeOnPopstate });
35
+ const backdropBlur = mode !== MODE.Regular;
36
+ const isSwipeEnabled = swipeEnabled && mode !== MODE.Forced;
37
+ useModalOpenState(open, () => {
38
+ if (mode !== MODE.Forced)
39
+ onClose();
40
+ }, { closeOnPopstate });
36
41
  // Возврат фокуса на триггер: запоминаем активный элемент при open=true, возвращаем при open=false.
37
42
  const restoreFocusRef = useRef(null);
38
43
  const wasOpenRef = useRef(false);
@@ -62,7 +67,7 @@ export function BottomSheetCustom(props) {
62
67
  // Nested-safe для модального sheet'а: закрываем только если фокус внутри этой панели; для
63
68
  // non-modal фокус снаружи — закрываем безусловно.
64
69
  useEffect(() => {
65
- if (!isActive || !isBrowser() || 'CloseWatcher' in window)
70
+ if (!isActive || mode === MODE.Forced || !isBrowser() || 'CloseWatcher' in window)
66
71
  return;
67
72
  const handleKeyDown = (event) => {
68
73
  if (event.key !== 'Escape')
@@ -75,14 +80,14 @@ export function BottomSheetCustom(props) {
75
80
  };
76
81
  document.addEventListener('keydown', handleKeyDown, true);
77
82
  return () => document.removeEventListener('keydown', handleKeyDown, true);
78
- }, [isActive, isModal, onClose, focusTrapRef]);
83
+ }, [isActive, isModal, mode, onClose, focusTrapRef]);
79
84
  const { setContentNode, dragHandlers, snapIndex: activeSnapIndex, isDragging, } = useDragEngine({
80
85
  snapPoints,
81
86
  defaultSnapIndex,
82
87
  snapIndex,
83
88
  onSnapIndexChange,
84
89
  onClose,
85
- swipeEnabled,
90
+ swipeEnabled: isSwipeEnabled,
86
91
  isActive,
87
92
  });
88
93
  // Верхний safe-area отступ нужен только на full-height (верх под notch); флаг — в `data-full-height`.
@@ -93,9 +98,9 @@ export function BottomSheetCustom(props) {
93
98
  setContentNode(node);
94
99
  }, [focusTrapRef, setContentNode]);
95
100
  const handleBackdropClick = useCallback(() => {
96
- if (showBackdrop)
101
+ if (showBackdrop && mode === MODE.Regular)
97
102
  onClose();
98
- }, [showBackdrop, onClose]);
103
+ }, [showBackdrop, mode, onClose]);
99
104
  // Мобильная поверхность фиксирует только платформу webMobile, плотность наследуется от приложения.
100
105
  const themeClassName = useThemeClassnames({ platform: PLATFORM.WebMobile });
101
106
  if (!isMounted)
@@ -107,7 +112,7 @@ export function BottomSheetCustom(props) {
107
112
  return createPortal(
108
113
  // RemoveScroll лочит фон-скролл (refcount для вложенных sheet'ов); `enabled={lockScroll}` —
109
114
  // для non-modal фон остаётся прокручиваемым.
110
- _jsx(RemoveScroll, { enabled: lockScroll, children: _jsxs("div", { className: cn(styles.root, rootClassName), "data-active": isActive || undefined, "data-disable-motions": disableMotions || undefined, children: [showBackdrop && (_jsx("div", { className: styles.backdrop, "data-test-id": TEST_IDS.backdrop, onClick: handleBackdropClick, "aria-hidden": true })), _jsx("div", { className: styles.contentWrapper, "data-active": isActive || undefined, "data-full-height": isFullHeight || undefined, children: _jsxs("div", { ref: mergeRefCb, className: cn(styles.content, themeClassName, className), role: 'dialog', "aria-modal": isModal ? 'true' : undefined, "data-test-id": TEST_IDS.root, "data-safe-area-top": (safeAreaTop && isFullHeight) || undefined, "data-safe-area-bottom": safeAreaBottom || undefined, "data-snap-index": activeSnapIndex, "data-snap-points": snapPoints && snapPoints.length > 0 ? snapPoints.length : undefined, "data-swipe-enabled": swipeEnabled || undefined, "data-dragging": isDragging || undefined, "data-full-height": isFullHeight || undefined, ...supportProps, ...(swipeEnabled ? dragHandlers : {}), children: [swipeEnabled && _jsx(Handle, {}), _jsx(OverlaySurfaceProvider, { surface: OVERLAY_SURFACE.Sheet, children: children })] }) })] }) }), targetNode);
115
+ _jsx(RemoveScroll, { enabled: lockScroll, children: _jsxs("div", { className: cn(styles.root, rootClassName), "data-active": isActive || undefined, "data-disable-motions": disableMotions || undefined, children: [showBackdrop && (_jsx("div", { className: styles.backdrop, "data-backdrop-blur": backdropBlur || undefined, "data-test-id": TEST_IDS.backdrop, onClick: handleBackdropClick, "aria-hidden": true })), _jsx("div", { className: styles.contentWrapper, "data-active": isActive || undefined, "data-full-height": isFullHeight || undefined, children: _jsxs("div", { ref: mergeRefCb, className: cn(styles.content, themeClassName, className), role: 'dialog', "aria-modal": isModal ? 'true' : undefined, "data-test-id": TEST_IDS.root, "data-safe-area-top": (safeAreaTop && isFullHeight) || undefined, "data-safe-area-bottom": safeAreaBottom || undefined, "data-snap-index": activeSnapIndex, "data-snap-points": snapPoints && snapPoints.length > 0 ? snapPoints.length : undefined, "data-swipe-enabled": isSwipeEnabled || undefined, "data-dragging": isDragging || undefined, "data-full-height": isFullHeight || undefined, ...supportProps, ...(isSwipeEnabled ? dragHandlers : {}), children: [isSwipeEnabled && _jsx(Handle, {}), _jsx(OverlaySurfaceProvider, { surface: OVERLAY_SURFACE.Sheet, children: children })] }) })] }) }), targetNode);
111
116
  }
112
117
  BottomSheetCustom.Header = PopupHeader;
113
118
  BottomSheetCustom.Body = PopupBody;
@@ -14,6 +14,9 @@
14
14
  background-color:var(--sn-theme-color-blackout, var(--sn-brand-color-overlay-forLightMode-blackout, rgba(0, 0, 0, 0.3215686275)));
15
15
  transition:opacity 0.2s;
16
16
  }
17
+ .backdrop[data-backdrop-blur]{
18
+ backdrop-filter:blur(var(--sn-theme-effect-backgroundBlur, var(--sn-brand-effect-blur-overlay-backgroundBlur, 10px)));
19
+ }
17
20
  .root[data-active] .backdrop{
18
21
  opacity:1;
19
22
  }
@@ -20,3 +20,8 @@ export declare const SNAP_POINTS_PRESET: {
20
20
  /** Открывается на половину вьюпорта, drag вверх раскрывает на всю высоту. */
21
21
  halfFull: number[];
22
22
  };
23
+ export declare const MODE: {
24
+ readonly Regular: "regular";
25
+ readonly Aggressive: "aggressive";
26
+ readonly Forced: "forced";
27
+ };
@@ -22,3 +22,8 @@ export const SNAP_POINTS_PRESET = {
22
22
  /** Открывается на половину вьюпорта, drag вверх раскрывает на всю высоту. */
23
23
  halfFull: [0.5, 1],
24
24
  };
25
+ export const MODE = {
26
+ Regular: 'regular',
27
+ Aggressive: 'aggressive',
28
+ Forced: 'forced',
29
+ };
@@ -36,6 +36,9 @@
36
36
  background-color:var(--sn-theme-color-blackout, var(--sn-brand-color-overlay-forLightMode-blackout, rgba(0, 0, 0, 0.3215686275)));
37
37
  transition:opacity 0.2s;
38
38
  }
39
+ .backdrop[data-backdrop-blur]{
40
+ backdrop-filter:blur(var(--sn-theme-effect-backgroundBlur, var(--sn-brand-effect-blur-overlay-backgroundBlur, 10px)));
41
+ }
39
42
  .root[data-active] .backdrop{
40
43
  opacity:1;
41
44
  }
@@ -1,6 +1,8 @@
1
1
  import { BottomSheetActionButton, FooterActionsOrientation, PopupMediaProps } from '@cloud-ru/ds-popup-private';
2
- import { WithSupportProps } from '@cloud-ru/ds-utils';
2
+ import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
3
3
  import { PropsWithChildren, ReactNode } from 'react';
4
+ import { MODE } from './constants.js';
5
+ export type BottomSheetMode = ValueOf<typeof MODE>;
4
6
  export type { BottomSheetActionButton, FooterActionsOrientation, MediaKind, PopupBodyProps as BottomSheetBodyProps, PopupFooterProps as BottomSheetFooterProps, PopupHeaderProps as BottomSheetHeaderProps, PopupMediaProps as BottomSheetMediaProps, } from '@cloud-ru/ds-popup-private';
5
7
  /**
6
8
  * Фиксированная позиция bottom-sheet'а по высоте.
@@ -23,6 +25,13 @@ export type BottomSheetCustomProps = WithSupportProps<PropsWithChildren<{
23
25
  * @default true
24
26
  */
25
27
  showBackdrop?: boolean;
28
+ /**
29
+ * Режим поведения: `regular` — стандартное закрытие; `aggressive` — размытие фона
30
+ * и запрет закрытия кликом по подложке; `forced` — дополнительно запрещает закрытие свайпом, Escape и переходом по истории браузера.
31
+ * Размытие применяется только при `showBackdrop=true`.
32
+ * @default 'regular'
33
+ */
34
+ mode?: BottomSheetMode;
26
35
  /**
27
36
  * Блокировать ли скролл фона на время открытия (`react-remove-scroll`). При `false` страница
28
37
  * под sheet'ом остаётся прокручиваемой — для non-modal сценариев (sheet поверх контента, с
@@ -32,6 +41,7 @@ export type BottomSheetCustomProps = WithSupportProps<PropsWithChildren<{
32
41
  lockScroll?: boolean;
33
42
  /**
34
43
  * Включает swipe-down для закрытия / swipe-up для раскрытия на следующий snap-point.
44
+ * В режиме `forced` свайп отключён независимо от значения свойства.
35
45
  * При `swipeEnabled=false` snap-point по-прежнему можно переключить через controlled `snapIndex` prop'ом.
36
46
  * @default true
37
47
  */
@@ -130,6 +140,10 @@ export type BottomSheetProps = Omit<BottomSheetCustomProps, 'children' | 'disabl
130
140
  * @default true
131
141
  */
132
142
  withDividers?: boolean;
143
+ /** Разделитель под шапкой. По умолчанию используется `withDividers`. */
144
+ withHeaderDivider?: boolean;
145
+ /** Разделитель над футером. По умолчанию используется `withDividers`. */
146
+ withFooterDivider?: boolean;
133
147
  /**
134
148
  * Основная кнопка действия — объект пропсов `Button` (по умолчанию `view='filled'`,
135
149
  * `appearance='primary'`). Ширина зависит от `footerActionsOrientation` и числа кнопок.