@cloud-ru/ds-drawer 1.1.1 → 1.1.2-preview-fb7fca7a.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 +2 -0
- package/dist/cjs/components/Drawer/types.d.ts +2 -2
- package/dist/cjs/helperComponents/DesktopDrawer/DesktopDrawer.d.ts +1 -1
- package/dist/cjs/helperComponents/DesktopDrawer/DesktopDrawer.js +2 -2
- package/dist/esm/components/Drawer/types.d.ts +2 -2
- package/dist/esm/helperComponents/DesktopDrawer/DesktopDrawer.d.ts +1 -1
- package/dist/esm/helperComponents/DesktopDrawer/DesktopDrawer.js +2 -2
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/components/Drawer/types.ts +2 -2
- package/src/helperComponents/DesktopDrawer/DesktopDrawer.tsx +2 -0
package/README.md
CHANGED
|
@@ -272,6 +272,7 @@ export function NestedDrawer() {
|
|
|
272
272
|
| `subtitle` | `ReactNode` | — | Текстовая строка-подзаголовок под title. |
|
|
273
273
|
| `swipeEnabled` | `boolean` | `true` | Включает swipe-down для закрытия / swipe-up для раскрытия на следующий snap-point. <br/> При `swipeEnabled=false` snap-point по-прежнему можно переключить через controlled `snapIndex` prop'ом. |
|
|
274
274
|
| `title` | `ReactNode` | — | Заголовок. Типографика зависит от поверхности: `title-l` на sheet, `headline-s` на window (modal/drawer). |
|
|
275
|
+
| `truncate` | `{ title?: number; subtitle?: number; } \| undefined` | — | Усечение строковых `title`/`subtitle` через `TruncateString` (число строк). Применяется только <br/> когда задано — по умолчанию текст не усекается. Актуально для window-поверхности (modal/drawer), <br/> где длинный заголовок иначе переносится на несколько строк. |
|
|
275
276
|
| `width` | `Width` | `'s'` | Ширина (только при position: "left" \| "right") |
|
|
276
277
|
| `withDividers` | `boolean` | `false` | Только mobile: разделители между шапкой/контентом/футером sheet'а. |
|
|
277
278
|
|
|
@@ -313,6 +314,7 @@ export function NestedDrawer() {
|
|
|
313
314
|
| `subtitle` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | Текстовая строка-подзаголовок под title. |
|
|
314
315
|
| `swipeEnabled` | `boolean \| undefined` | — | Включает swipe-down для закрытия / swipe-up для раскрытия на следующий snap-point. <br/> При `swipeEnabled=false` snap-point по-прежнему можно переключить через controlled `snapIndex` prop'ом. |
|
|
315
316
|
| `title` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | Заголовок. Типографика зависит от поверхности: `title-l` на sheet, `headline-s` на window (modal/drawer). |
|
|
317
|
+
| `truncate` | `{ title?: number; subtitle?: number; } \| undefined` | — | Усечение строковых `title`/`subtitle` через `TruncateString` (число строк). Применяется только <br/> когда задано — по умолчанию текст не усекается. Актуально для window-поверхности (modal/drawer), <br/> где длинный заголовок иначе переносится на несколько строк. |
|
|
316
318
|
| `width` | `Width` | — | Ширина (только при position: "left" \| "right") |
|
|
317
319
|
| `withDividers` | `boolean \| undefined` | — | Только mobile: разделители между шапкой/контентом/футером sheet'а. |
|
|
318
320
|
|
|
@@ -6,11 +6,11 @@ import { DrawerCustomProps } from '../DrawerCustom';
|
|
|
6
6
|
/**
|
|
7
7
|
* Адаптивный Drawer: desktop — боковая/верхняя/нижняя панель, `mobile` — `BottomSheet`.
|
|
8
8
|
*
|
|
9
|
-
* Только desktop: `position`, `width`, `heightAuto`, `nestedDrawer` (на mobile игнорируются).
|
|
9
|
+
* Только desktop: `position`, `width`, `heightAuto`, `nestedDrawer`, `truncate` (на mobile игнорируются).
|
|
10
10
|
* Только mobile: `swipeEnabled`, `snapPoints`, `snapIndex`, `onSnapIndexChange`, `safeArea`, `withDividers`
|
|
11
11
|
* (на desktop-панели игнорируются — это анатомия `BottomSheet`).
|
|
12
12
|
*/
|
|
13
|
-
export type DrawerProps = WithSupportProps<Omit<DrawerCustomProps, 'nestedDrawer' | 'push' | 'resizable'> & Pick<BottomSheetProps, 'swipeEnabled' | 'snapPoints' | 'snapIndex' | 'onSnapIndexChange' | 'safeArea'> & Pick<DialogHeaderProps, 'title' | 'slotAfterTitle' | 'slotSecondTitle' | 'onBackButtonClick'> & Pick<DialogBodyProps, 'content'> & {
|
|
13
|
+
export type DrawerProps = WithSupportProps<Omit<DrawerCustomProps, 'nestedDrawer' | 'push' | 'resizable'> & Pick<BottomSheetProps, 'swipeEnabled' | 'snapPoints' | 'snapIndex' | 'onSnapIndexChange' | 'safeArea'> & Pick<DialogHeaderProps, 'title' | 'slotAfterTitle' | 'slotSecondTitle' | 'onBackButtonClick' | 'truncate'> & Pick<DialogBodyProps, 'content'> & {
|
|
14
14
|
/** Ссылка на скроллируемый контейнер контента (например, для дозагрузки по скроллу). */
|
|
15
15
|
contentRef?: Ref<HTMLElement>;
|
|
16
16
|
/** Только mobile: разделители между шапкой/контентом/футером sheet'а. @default false */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DrawerProps } from '../../components/Drawer/types';
|
|
2
2
|
/** Desktop-поверхность Drawer'а: панель (`DrawerCustom`) с пресетной разметкой. Internal. */
|
|
3
|
-
export declare function DesktopDrawer({ content, media, title, slotAfterTitle, slotSecondTitle, subtitle, onBackButtonClick, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, nestedDrawer, contentRef, className, ...rest }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function DesktopDrawer({ content, media, title, truncate, slotAfterTitle, slotSecondTitle, subtitle, onBackButtonClick, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, nestedDrawer, contentRef, className, ...rest }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,13 +11,13 @@ const styles_module_scss_1 = __importDefault(require('../../components/Drawer/st
|
|
|
11
11
|
const DrawerCustom_1 = require("../../components/DrawerCustom");
|
|
12
12
|
const constants_2 = require("../../constants");
|
|
13
13
|
/** Desktop-поверхность Drawer'а: панель (`DrawerCustom`) с пресетной разметкой. Internal. */
|
|
14
|
-
function DesktopDrawer({ content, media, title, slotAfterTitle, slotSecondTitle, subtitle, onBackButtonClick, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, nestedDrawer, contentRef,
|
|
14
|
+
function DesktopDrawer({ content, media, title, truncate, slotAfterTitle, slotSecondTitle, subtitle, onBackButtonClick, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, nestedDrawer, contentRef,
|
|
15
15
|
// `withDividers` — mobile-only (мастер bottomSheet): молча уходит в `rest` и отбрасывается фреймом.
|
|
16
16
|
className, ...rest }) {
|
|
17
17
|
const showHeader = Boolean(title || subtitle || slotAfterTitle || slotSecondTitle);
|
|
18
18
|
// Произвольный `footer` приоритетнее кнопок-слотов; раскладку слотов делает сам `DrawerCustom.Footer`.
|
|
19
19
|
const hasFooter = Boolean(footer || approveButton || cancelButton || additionalButton);
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)(DrawerCustom_1.DrawerCustom, { ...rest, resizable: undefined, className: (0, classnames_1.default)(styles_module_scss_1.default.drawer, className), push: Boolean(nestedDrawer) && { distance: constants_1.NESTED_DRAWER_PUSH_DISTANCE }, children: [media, showHeader && ((0, jsx_runtime_1.jsx)(DrawerCustom_1.DrawerCustom.Header, { title: title, slotAfterTitle: slotAfterTitle, slotSecondTitle: slotSecondTitle, subtitle: subtitle, onBackButtonClick: onBackButtonClick,
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(DrawerCustom_1.DrawerCustom, { ...rest, resizable: undefined, className: (0, classnames_1.default)(styles_module_scss_1.default.drawer, className), push: Boolean(nestedDrawer) && { distance: constants_1.NESTED_DRAWER_PUSH_DISTANCE }, children: [media, showHeader && ((0, jsx_runtime_1.jsx)(DrawerCustom_1.DrawerCustom.Header, { title: title, truncate: truncate, slotAfterTitle: slotAfterTitle, slotSecondTitle: slotSecondTitle, subtitle: subtitle, onBackButtonClick: onBackButtonClick,
|
|
21
21
|
// Сохраняем публичный контракт test-id'ов drawer'а поверх общего `PopupHeader`.
|
|
22
22
|
// slotAfterTitle НЕ переопределяем: id тултипа ставит сам потребитель на своём span.
|
|
23
23
|
testIds: {
|
|
@@ -6,11 +6,11 @@ import { DrawerCustomProps } from '../DrawerCustom/index.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Адаптивный Drawer: desktop — боковая/верхняя/нижняя панель, `mobile` — `BottomSheet`.
|
|
8
8
|
*
|
|
9
|
-
* Только desktop: `position`, `width`, `heightAuto`, `nestedDrawer` (на mobile игнорируются).
|
|
9
|
+
* Только desktop: `position`, `width`, `heightAuto`, `nestedDrawer`, `truncate` (на mobile игнорируются).
|
|
10
10
|
* Только mobile: `swipeEnabled`, `snapPoints`, `snapIndex`, `onSnapIndexChange`, `safeArea`, `withDividers`
|
|
11
11
|
* (на desktop-панели игнорируются — это анатомия `BottomSheet`).
|
|
12
12
|
*/
|
|
13
|
-
export type DrawerProps = WithSupportProps<Omit<DrawerCustomProps, 'nestedDrawer' | 'push' | 'resizable'> & Pick<BottomSheetProps, 'swipeEnabled' | 'snapPoints' | 'snapIndex' | 'onSnapIndexChange' | 'safeArea'> & Pick<DialogHeaderProps, 'title' | 'slotAfterTitle' | 'slotSecondTitle' | 'onBackButtonClick'> & Pick<DialogBodyProps, 'content'> & {
|
|
13
|
+
export type DrawerProps = WithSupportProps<Omit<DrawerCustomProps, 'nestedDrawer' | 'push' | 'resizable'> & Pick<BottomSheetProps, 'swipeEnabled' | 'snapPoints' | 'snapIndex' | 'onSnapIndexChange' | 'safeArea'> & Pick<DialogHeaderProps, 'title' | 'slotAfterTitle' | 'slotSecondTitle' | 'onBackButtonClick' | 'truncate'> & Pick<DialogBodyProps, 'content'> & {
|
|
14
14
|
/** Ссылка на скроллируемый контейнер контента (например, для дозагрузки по скроллу). */
|
|
15
15
|
contentRef?: Ref<HTMLElement>;
|
|
16
16
|
/** Только mobile: разделители между шапкой/контентом/футером sheet'а. @default false */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DrawerProps } from '../../components/Drawer/types.js';
|
|
2
2
|
/** Desktop-поверхность Drawer'а: панель (`DrawerCustom`) с пресетной разметкой. Internal. */
|
|
3
|
-
export declare function DesktopDrawer({ content, media, title, slotAfterTitle, slotSecondTitle, subtitle, onBackButtonClick, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, nestedDrawer, contentRef, className, ...rest }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function DesktopDrawer({ content, media, title, truncate, slotAfterTitle, slotSecondTitle, subtitle, onBackButtonClick, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, nestedDrawer, contentRef, className, ...rest }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,13 +5,13 @@ import styles from '../../components/Drawer/styles.module.css';
|
|
|
5
5
|
import { DrawerCustom } from '../../components/DrawerCustom/index.js';
|
|
6
6
|
import { TEST_IDS } from '../../constants.js';
|
|
7
7
|
/** Desktop-поверхность Drawer'а: панель (`DrawerCustom`) с пресетной разметкой. Internal. */
|
|
8
|
-
export function DesktopDrawer({ content, media, title, slotAfterTitle, slotSecondTitle, subtitle, onBackButtonClick, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, nestedDrawer, contentRef,
|
|
8
|
+
export function DesktopDrawer({ content, media, title, truncate, slotAfterTitle, slotSecondTitle, subtitle, onBackButtonClick, approveButton, cancelButton, additionalButton, footerActionsOrientation, footer, nestedDrawer, contentRef,
|
|
9
9
|
// `withDividers` — mobile-only (мастер bottomSheet): молча уходит в `rest` и отбрасывается фреймом.
|
|
10
10
|
className, ...rest }) {
|
|
11
11
|
const showHeader = Boolean(title || subtitle || slotAfterTitle || slotSecondTitle);
|
|
12
12
|
// Произвольный `footer` приоритетнее кнопок-слотов; раскладку слотов делает сам `DrawerCustom.Footer`.
|
|
13
13
|
const hasFooter = Boolean(footer || approveButton || cancelButton || additionalButton);
|
|
14
|
-
return (_jsxs(DrawerCustom, { ...rest, resizable: undefined, className: cn(styles.drawer, className), push: Boolean(nestedDrawer) && { distance: NESTED_DRAWER_PUSH_DISTANCE }, children: [media, showHeader && (_jsx(DrawerCustom.Header, { title: title, slotAfterTitle: slotAfterTitle, slotSecondTitle: slotSecondTitle, subtitle: subtitle, onBackButtonClick: onBackButtonClick,
|
|
14
|
+
return (_jsxs(DrawerCustom, { ...rest, resizable: undefined, className: cn(styles.drawer, className), push: Boolean(nestedDrawer) && { distance: NESTED_DRAWER_PUSH_DISTANCE }, children: [media, showHeader && (_jsx(DrawerCustom.Header, { title: title, truncate: truncate, slotAfterTitle: slotAfterTitle, slotSecondTitle: slotSecondTitle, subtitle: subtitle, onBackButtonClick: onBackButtonClick,
|
|
15
15
|
// Сохраняем публичный контракт test-id'ов drawer'а поверх общего `PopupHeader`.
|
|
16
16
|
// slotAfterTitle НЕ переопределяем: id тултипа ставит сам потребитель на своём span.
|
|
17
17
|
testIds: {
|