@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.
- package/README.md +12 -7
- package/dist/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/cjs/components/BottomSheet/BottomSheet.js +2 -2
- package/dist/cjs/components/BottomSheetCustom/BottomSheetCustom.js +2 -2
- package/dist/cjs/components/BottomSheetCustom/styles.module.css +4 -4
- package/dist/cjs/style.css +4 -4
- package/dist/cjs/types.d.ts +10 -5
- package/dist/esm/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/esm/components/BottomSheet/BottomSheet.js +2 -2
- package/dist/esm/components/BottomSheetCustom/BottomSheetCustom.js +2 -2
- package/dist/esm/components/BottomSheetCustom/styles.module.css +4 -4
- package/dist/esm/style.css +4 -4
- package/dist/esm/types.d.ts +10 -5
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/components/BottomSheet/BottomSheet.tsx +2 -2
- package/src/components/BottomSheetCustom/BottomSheetCustom.tsx +4 -2
- package/src/components/BottomSheetCustom/styles.module.scss +12 -6
- package/src/types.ts +10 -5
|
@@ -52,7 +52,8 @@ export function BottomSheetCustom(props: BottomSheetCustomProps) {
|
|
|
52
52
|
showBackdrop = true,
|
|
53
53
|
lockScroll = true,
|
|
54
54
|
swipeEnabled = true,
|
|
55
|
-
|
|
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={
|
|
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:
|
|
120
|
-
// только при full-height (верх уходит под notch)
|
|
121
|
-
&[data-safe-area] {
|
|
122
|
-
padding-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
|
|
126
|
-
padding-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
|
-
*
|
|
93
|
-
* на
|
|
94
|
-
*
|
|
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
|
-
|
|
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
|