@cloud-ru/ds-bottom-sheet 1.2.0 → 1.2.1-preview-ac2c37a8.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.
@@ -52,7 +52,8 @@ export function BottomSheetCustom(props: BottomSheetCustomProps) {
52
52
  showBackdrop = true,
53
53
  lockScroll = true,
54
54
  swipeEnabled = true,
55
- safeArea = true,
55
+ safeAreaTop = true,
56
+ safeAreaBottom = true,
56
57
  snapPoints,
57
58
  defaultSnapIndex,
58
59
  snapIndex,
@@ -188,7 +189,8 @@ export function BottomSheetCustom(props: BottomSheetCustomProps) {
188
189
  // aria-modal только для модального sheet'а: non-modal оставляет фон доступным AT.
189
190
  aria-modal={isModal ? 'true' : undefined}
190
191
  data-test-id={TEST_IDS.root}
191
- data-safe-area={safeArea || undefined}
192
+ data-safe-area-top={(safeAreaTop && isFullHeight) || undefined}
193
+ data-safe-area-bottom={safeAreaBottom || undefined}
192
194
  data-snap-index={activeSnapIndex}
193
195
  // Пустой массив ведёт себя как single fit-content — атрибут не выставляем.
194
196
  data-snap-points={snapPoints && snapPoints.length > 0 ? snapPoints.length : undefined}
@@ -116,14 +116,20 @@
116
116
  border-top-right-radius: 0;
117
117
  }
118
118
 
119
- // Safe-area: env-паддинг прямо на `.content`. Нижний — всегда (home-indicator), верхний —
120
- // только при full-height (верх уходит под notch). Без выреза `env(...)` = 0.
121
- &[data-safe-area] {
122
- padding-bottom: env(safe-area-inset-bottom);
119
+ // Safe-area: токен из макета как минимум, на устройстве с вырезом — env, если он больше.
120
+ // Верхний выставляется только при full-height (верх уходит под notch), см. `data-safe-area-top`.
121
+ &[data-safe-area-bottom] {
122
+ padding-bottom: max(
123
+ #{base.simple-var(bottomSheet.$bottomSheet, 'anatomy', 'safeArea', 'padding-bottom')},
124
+ env(safe-area-inset-bottom)
125
+ );
123
126
  }
124
127
 
125
- &[data-safe-area][data-full-height] {
126
- padding-top: env(safe-area-inset-top);
128
+ &[data-safe-area-top] {
129
+ padding-top: max(
130
+ #{base.simple-var(bottomSheet.$bottomSheet, 'anatomy', 'safeArea', 'padding-top')},
131
+ env(safe-area-inset-top)
132
+ );
127
133
  }
128
134
  }
129
135
 
package/src/types.ts CHANGED
@@ -89,13 +89,18 @@ export type BottomSheetCustomProps = WithSupportProps<
89
89
  */
90
90
  closeOnPopstate?: boolean;
91
91
  /**
92
- * Резервировать ли место под iOS notch / home-indicator и Android nav-bar. Реализовано паддингом
93
- * на `.content` через `env(safe-area-inset-*)`: на устройстве без выреза/индикатора (и на desktop)
94
- * inset = 0, поэтому никакого «лишнего» отступа не появляется; на notched-устройстве — ровно нужный.
95
- * Верхний отступ добавляется только когда sheet раскрыт на полный вьюпорт (его верх под notch).
92
+ * Верхний safe-area отступ под iOS notch / status-bar. Размер — токен `safeArea.paddingTop` (32px),
93
+ * на устройстве с большим `env(safe-area-inset-top)` — значение inset. Применяется, только когда
94
+ * sheet раскрыт на полный вьюпорт: у неполного sheet'а верх и так не заходит под notch.
96
95
  * @default true
97
96
  */
98
- safeArea?: boolean;
97
+ safeAreaTop?: boolean;
98
+ /**
99
+ * Нижний safe-area отступ под iOS home-indicator и Android nav-bar. Размер — токен
100
+ * `safeArea.paddingBottom` (32px), на устройстве с большим `env(safe-area-inset-bottom)` — значение inset.
101
+ * @default true
102
+ */
103
+ safeAreaBottom?: boolean;
99
104
  /**
100
105
  * Отключить анимации открытия / закрытия и перехода между snap-точками.
101
106
  * @default false