@cloud-ru/ds-drawer 1.1.2-preview-86f06def.0 → 1.2.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +6 -5
  3. package/dist/cjs/components/Drawer/types.d.ts +5 -7
  4. package/dist/cjs/components/DrawerCustom/DrawerCustom.d.ts +2 -3
  5. package/dist/cjs/components/DrawerCustom/DrawerCustom.js +3 -4
  6. package/dist/cjs/constants.d.ts +0 -6
  7. package/dist/cjs/constants.js +1 -6
  8. package/dist/cjs/helperComponents/DesktopDrawer/DesktopDrawer.d.ts +1 -1
  9. package/dist/cjs/helperComponents/DesktopDrawer/DesktopDrawer.js +2 -2
  10. package/dist/cjs/helperComponents/DialogSlots.d.ts +1 -1
  11. package/dist/cjs/helperComponents/MobileDrawer/MobileDrawer.js +6 -2
  12. package/dist/esm/components/Drawer/types.d.ts +5 -7
  13. package/dist/esm/components/DrawerCustom/DrawerCustom.d.ts +2 -3
  14. package/dist/esm/components/DrawerCustom/DrawerCustom.js +4 -5
  15. package/dist/esm/constants.d.ts +0 -6
  16. package/dist/esm/constants.js +0 -5
  17. package/dist/esm/helperComponents/DesktopDrawer/DesktopDrawer.d.ts +1 -1
  18. package/dist/esm/helperComponents/DesktopDrawer/DesktopDrawer.js +2 -2
  19. package/dist/esm/helperComponents/DialogSlots.d.ts +1 -1
  20. package/dist/esm/helperComponents/MobileDrawer/MobileDrawer.js +7 -3
  21. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  22. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  23. package/package.json +9 -9
  24. package/src/components/Drawer/types.ts +5 -7
  25. package/src/components/DrawerCustom/DrawerCustom.tsx +4 -5
  26. package/src/components/DrawerCustom/types.ts +1 -2
  27. package/src/constants.ts +0 -8
  28. package/src/helperComponents/DesktopDrawer/DesktopDrawer.tsx +2 -0
  29. package/src/helperComponents/DialogSlots.tsx +1 -1
  30. package/src/helperComponents/MobileDrawer/MobileDrawer.tsx +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-drawer",
3
- "version": "1.1.2-preview-86f06def.0",
3
+ "version": "1.2.0",
4
4
  "description": "Пакет выезжающих панелей — компоненты Drawer и DrawerCustom с едиными токенами позиции и ширины.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,13 +40,13 @@
40
40
  "classnames": "^2.5.1",
41
41
  "react-remove-scroll": "^2.7.2",
42
42
  "tabbable": "^6.5.0",
43
- "@cloud-ru/ds-adaptive": "1.0.1",
44
- "@cloud-ru/ds-popup-private": "1.1.2-preview-86f06def.0",
45
- "@cloud-ru/ds-scroll": "1.0.2",
46
- "@cloud-ru/ds-bottom-sheet": "1.1.2-preview-86f06def.0",
47
- "@cloud-ru/ds-portal-context": "1.0.1",
48
- "@cloud-ru/ds-tooltip": "1.0.4",
49
- "@cloud-ru/ds-utils": "1.1.0",
50
- "@cloud-ru/ds-materials": "1.0.1"
43
+ "@cloud-ru/ds-adaptive": "^1.0.1",
44
+ "@cloud-ru/ds-bottom-sheet": "^1.1.1",
45
+ "@cloud-ru/ds-materials": "^1.0.1",
46
+ "@cloud-ru/ds-popup-private": "^1.1.1",
47
+ "@cloud-ru/ds-portal-context": "^1.0.1",
48
+ "@cloud-ru/ds-tooltip": "^1.0.4",
49
+ "@cloud-ru/ds-utils": "^1.1.0",
50
+ "@cloud-ru/ds-scroll": "^1.0.2"
51
51
  }
52
52
  }
@@ -8,19 +8,18 @@ import { DrawerCustomProps } from '../DrawerCustom';
8
8
  /**
9
9
  * Адаптивный Drawer: desktop — боковая/верхняя/нижняя панель, `mobile` — `BottomSheet`.
10
10
  *
11
- * Только desktop: `position`, `width`, `heightAuto`, `nestedDrawer` (на mobile игнорируются).
11
+ * Только desktop: `position`, `width`, `heightAuto`, `nestedDrawer`, `truncate` (на mobile игнорируются).
12
12
  * Только mobile: `swipeEnabled`, `snapPoints`, `snapIndex`, `onSnapIndexChange`, `safeArea`, `withDividers`
13
- * (на desktop-панели игнорируются — это анатомия `BottomSheet`). `snapPoints` по умолчанию —
14
- * `MOBILE_SNAP_POINTS_DEFAULT` (`[1]`): sheet открывается на весь вьюпорт.
13
+ * (на desktop-панели игнорируются — это анатомия `BottomSheet`).
15
14
  */
16
15
  export type DrawerProps = WithSupportProps<
17
16
  Omit<DrawerCustomProps, 'nestedDrawer' | 'push' | 'resizable'> &
18
17
  Pick<BottomSheetProps, 'swipeEnabled' | 'snapPoints' | 'snapIndex' | 'onSnapIndexChange' | 'safeArea'> &
19
- Pick<DialogHeaderProps, 'title' | 'slotAfterTitle' | 'slotSecondTitle' | 'onBackButtonClick'> &
18
+ Pick<DialogHeaderProps, 'title' | 'slotAfterTitle' | 'slotSecondTitle' | 'onBackButtonClick' | 'truncate'> &
20
19
  Pick<DialogBodyProps, 'content'> & {
21
20
  /** Ссылка на скроллируемый контейнер контента (например, для дозагрузки по скроллу). */
22
21
  contentRef?: Ref<HTMLElement>;
23
- /** Только mobile: разделители между шапкой/контентом/футером sheet'а. @default true */
22
+ /** Только mobile: разделители между шапкой/контентом/футером sheet'а. @default false */
24
23
  withDividers?: boolean;
25
24
  /** Текстовая строка-подзаголовок под title. */
26
25
  subtitle?: ReactNode;
@@ -35,8 +34,7 @@ export type DrawerProps = WithSupportProps<
35
34
  /** Дополнительная (третья) кнопка — пропсы `Button` (дефолт `view='simple'`, `appearance='neutral'`). */
36
35
  additionalButton?: BottomSheetActionButton;
37
36
  /**
38
- * Ориентация кнопок футера. Игнорируется при заданном `footer`. Без значения раскладку
39
- * выбирает поверхность: два действия — в строку, три — стопкой.
37
+ * Ориентация кнопок футера. Применяется только при двух кнопках; игнорируется при заданном `footer`.
40
38
  * @default 'horizontal'
41
39
  */
42
40
  footerActionsOrientation?: FooterActionsOrientation;
@@ -8,7 +8,7 @@ import cn from 'classnames';
8
8
  import { ComponentType, CSSProperties, useMemo } from 'react';
9
9
  import { RemoveScroll } from 'react-remove-scroll';
10
10
 
11
- import { MOBILE_SNAP_POINTS_DEFAULT, TEST_IDS, WIDTH_AS_VALUES } from '../../constants';
11
+ import { TEST_IDS, WIDTH_AS_VALUES } from '../../constants';
12
12
  import {
13
13
  DialogBody,
14
14
  DialogBodyProps,
@@ -157,9 +157,8 @@ function DrawerFrame(props: DrawerCustomProps) {
157
157
  }
158
158
 
159
159
  /**
160
- * Адаптивный low-level `DrawerCustom`: на `mobile` — `BottomSheetCustom` (по умолчанию
161
- * full-screen, см. `MOBILE_SNAP_POINTS_DEFAULT`), иначе — `DrawerFrame`. Композиция одна
162
- * (surface-aware слоты `.Header/.Body/.Footer`). Форс — `withLayoutType`.
160
+ * Адаптивный low-level `DrawerCustom`: на `mobile` — `BottomSheetCustom`, иначе `DrawerFrame`.
161
+ * Композиция одна (surface-aware слоты `.Header/.Body/.Footer`). Форс — `withLayoutType`.
163
162
  */
164
163
  export function DrawerCustom(props: DrawerCustomProps) {
165
164
  const { layoutType } = useAdaptiveLayout();
@@ -174,7 +173,7 @@ export function DrawerCustom(props: DrawerCustomProps) {
174
173
  container,
175
174
  closeOnPopstate,
176
175
  showBlackout,
177
- snapPoints = MOBILE_SNAP_POINTS_DEFAULT,
176
+ snapPoints,
178
177
  swipeEnabled,
179
178
  safeArea,
180
179
  disableMotions,
@@ -73,6 +73,5 @@ export type DrawerCustomProps = WithSupportProps<
73
73
  };
74
74
  }>
75
75
  > &
76
- // Только mobile: управляют sheet-поверхностью (на desktop игнорируются). `snapPoints` по
77
- // умолчанию — `MOBILE_SNAP_POINTS_DEFAULT` (`[1]`): sheet открывается на весь вьюпорт.
76
+ // Только mobile: управляют sheet-поверхностью (на desktop игнорируются).
78
77
  Pick<BottomSheetCustomProps, 'snapPoints' | 'swipeEnabled' | 'safeArea'>;
package/src/constants.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { SnapPoint } from '@cloud-ru/ds-bottom-sheet';
2
-
3
1
  export const TEST_IDS = {
4
2
  closeButton: 'drawer__close-button',
5
3
  header: 'drawer__header',
@@ -31,9 +29,3 @@ export const POSITION = {
31
29
  Top: 'top',
32
30
  Bottom: 'bottom',
33
31
  } as const;
34
-
35
- /**
36
- * Snap-точки мобильной поверхности дровера по умолчанию: одна позиция на весь вьюпорт.
37
- * Дровер на mobile открывается сразу full-screen; swipe-down закрывает его.
38
- */
39
- export const MOBILE_SNAP_POINTS_DEFAULT: SnapPoint[] = [1];
@@ -11,6 +11,7 @@ export function DesktopDrawer({
11
11
  content,
12
12
  media,
13
13
  title,
14
+ truncate,
14
15
  slotAfterTitle,
15
16
  slotSecondTitle,
16
17
  subtitle,
@@ -42,6 +43,7 @@ export function DesktopDrawer({
42
43
  {showHeader && (
43
44
  <DrawerCustom.Header
44
45
  title={title}
46
+ truncate={truncate}
45
47
  slotAfterTitle={slotAfterTitle}
46
48
  slotSecondTitle={slotSecondTitle}
47
49
  subtitle={subtitle}
@@ -27,7 +27,7 @@ export type DialogFooterProps = SheetFooterProps & {
27
27
  cancelButton?: BottomSheetActionButton;
28
28
  /** Дополнительная (третья) кнопка. */
29
29
  additionalButton?: BottomSheetActionButton;
30
- /** Ориентация кнопок; без значения по числу действий (два в строку, три стопкой). */
30
+ /** Ориентация кнопок при ровно двух действиях. */
31
31
  footerActionsOrientation?: FooterActionsOrientation;
32
32
  };
33
33
 
@@ -2,7 +2,7 @@ import { BottomSheet } from '@cloud-ru/ds-bottom-sheet';
2
2
  import { extractSupportProps } from '@cloud-ru/ds-utils';
3
3
 
4
4
  import { DrawerProps } from '../../components/Drawer/types';
5
- import { MOBILE_SNAP_POINTS_DEFAULT, TEST_IDS } from '../../constants';
5
+ import { TEST_IDS } from '../../constants';
6
6
 
7
7
  /**
8
8
  * Mobile-поверхность Drawer'а: контент в `BottomSheet`, слоты маппятся на API sheet'а
@@ -30,16 +30,17 @@ export function MobileDrawer({
30
30
  container,
31
31
  closeOnPopstate,
32
32
  swipeEnabled,
33
- snapPoints = MOBILE_SNAP_POINTS_DEFAULT,
33
+ snapPoints,
34
34
  snapIndex,
35
35
  onSnapIndexChange,
36
36
  safeArea,
37
- withDividers,
37
+ withDividers = false,
38
38
  ...rest
39
39
  }: DrawerProps) {
40
40
  // Футер собирает сам `BottomSheet`.
41
41
  return (
42
42
  <BottomSheet
43
+ // Дефолт `withDividers` в sheet'е — `true`; у Drawer'а вид исторически без разделителей.
43
44
  withDividers={withDividers}
44
45
  open={open}
45
46
  onClose={onClose}