@cloud-ru/ds-popup-private 1.0.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 +8 -0
- package/LICENSE +201 -0
- package/README.md +163 -0
- package/dist/cjs/components/FooterActions/FooterActions.d.ts +44 -0
- package/dist/cjs/components/FooterActions/FooterActions.js +44 -0
- package/dist/cjs/components/FooterActions/index.d.ts +1 -0
- package/dist/cjs/components/FooterActions/index.js +17 -0
- package/dist/cjs/components/FooterActions/styles.module.css +20 -0
- package/dist/cjs/components/PopupBody/PopupBody.d.ts +3 -0
- package/dist/cjs/components/PopupBody/PopupBody.js +15 -0
- package/dist/cjs/components/PopupBody/index.d.ts +1 -0
- package/dist/cjs/components/PopupBody/index.js +17 -0
- package/dist/cjs/components/PopupBody/styles.module.css +16 -0
- package/dist/cjs/components/PopupCloseButton/PopupCloseButton.d.ts +11 -0
- package/dist/cjs/components/PopupCloseButton/PopupCloseButton.js +16 -0
- package/dist/cjs/components/PopupCloseButton/index.d.ts +1 -0
- package/dist/cjs/components/PopupCloseButton/index.js +17 -0
- package/dist/cjs/components/PopupCloseButton/styles.module.css +109 -0
- package/dist/cjs/components/PopupFooter/PopupFooter.d.ts +3 -0
- package/dist/cjs/components/PopupFooter/PopupFooter.js +17 -0
- package/dist/cjs/components/PopupFooter/index.d.ts +1 -0
- package/dist/cjs/components/PopupFooter/index.js +17 -0
- package/dist/cjs/components/PopupFooter/styles.module.css +32 -0
- package/dist/cjs/components/PopupHeader/PopupHeader.d.ts +3 -0
- package/dist/cjs/components/PopupHeader/PopupHeader.js +37 -0
- package/dist/cjs/components/PopupHeader/index.d.ts +1 -0
- package/dist/cjs/components/PopupHeader/index.js +17 -0
- package/dist/cjs/components/PopupHeader/styles.module.css +128 -0
- package/dist/cjs/components/PopupMedia/PopupMedia.d.ts +7 -0
- package/dist/cjs/components/PopupMedia/PopupMedia.js +14 -0
- package/dist/cjs/components/PopupMedia/index.d.ts +1 -0
- package/dist/cjs/components/PopupMedia/index.js +17 -0
- package/dist/cjs/components/PopupMedia/styles.module.css +27 -0
- package/dist/cjs/components/index.d.ts +6 -0
- package/dist/cjs/components/index.js +22 -0
- package/dist/cjs/constants.d.ts +68 -0
- package/dist/cjs/constants.js +73 -0
- package/dist/cjs/context/overlaySurface.d.ts +35 -0
- package/dist/cjs/context/overlaySurface.js +45 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +332 -0
- package/dist/cjs/types.d.ts +95 -0
- package/dist/cjs/types.js +2 -0
- package/dist/esm/components/FooterActions/FooterActions.d.ts +44 -0
- package/dist/esm/components/FooterActions/FooterActions.js +38 -0
- package/dist/esm/components/FooterActions/index.d.ts +1 -0
- package/dist/esm/components/FooterActions/index.js +1 -0
- package/dist/esm/components/FooterActions/styles.module.css +20 -0
- package/dist/esm/components/PopupBody/PopupBody.d.ts +3 -0
- package/dist/esm/components/PopupBody/PopupBody.js +9 -0
- package/dist/esm/components/PopupBody/index.d.ts +1 -0
- package/dist/esm/components/PopupBody/index.js +1 -0
- package/dist/esm/components/PopupBody/styles.module.css +16 -0
- package/dist/esm/components/PopupCloseButton/PopupCloseButton.d.ts +11 -0
- package/dist/esm/components/PopupCloseButton/PopupCloseButton.js +10 -0
- package/dist/esm/components/PopupCloseButton/index.d.ts +1 -0
- package/dist/esm/components/PopupCloseButton/index.js +1 -0
- package/dist/esm/components/PopupCloseButton/styles.module.css +109 -0
- package/dist/esm/components/PopupFooter/PopupFooter.d.ts +3 -0
- package/dist/esm/components/PopupFooter/PopupFooter.js +11 -0
- package/dist/esm/components/PopupFooter/index.d.ts +1 -0
- package/dist/esm/components/PopupFooter/index.js +1 -0
- package/dist/esm/components/PopupFooter/styles.module.css +32 -0
- package/dist/esm/components/PopupHeader/PopupHeader.d.ts +3 -0
- package/dist/esm/components/PopupHeader/PopupHeader.js +31 -0
- package/dist/esm/components/PopupHeader/index.d.ts +1 -0
- package/dist/esm/components/PopupHeader/index.js +1 -0
- package/dist/esm/components/PopupHeader/styles.module.css +128 -0
- package/dist/esm/components/PopupMedia/PopupMedia.d.ts +7 -0
- package/dist/esm/components/PopupMedia/PopupMedia.js +8 -0
- package/dist/esm/components/PopupMedia/index.d.ts +1 -0
- package/dist/esm/components/PopupMedia/index.js +1 -0
- package/dist/esm/components/PopupMedia/styles.module.css +27 -0
- package/dist/esm/components/index.d.ts +6 -0
- package/dist/esm/components/index.js +6 -0
- package/dist/esm/constants.d.ts +68 -0
- package/dist/esm/constants.js +70 -0
- package/dist/esm/context/overlaySurface.d.ts +35 -0
- package/dist/esm/context/overlaySurface.js +38 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/style.css +332 -0
- package/dist/esm/types.d.ts +95 -0
- package/dist/esm/types.js +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +46 -0
- package/src/components/FooterActions/FooterActions.tsx +111 -0
- package/src/components/FooterActions/index.ts +1 -0
- package/src/components/FooterActions/styles.module.scss +32 -0
- package/src/components/PopupBody/PopupBody.tsx +20 -0
- package/src/components/PopupBody/index.ts +1 -0
- package/src/components/PopupBody/styles.module.scss +24 -0
- package/src/components/PopupCloseButton/PopupCloseButton.tsx +37 -0
- package/src/components/PopupCloseButton/index.ts +1 -0
- package/src/components/PopupCloseButton/styles.module.scss +39 -0
- package/src/components/PopupFooter/PopupFooter.tsx +24 -0
- package/src/components/PopupFooter/index.ts +1 -0
- package/src/components/PopupFooter/styles.module.scss +49 -0
- package/src/components/PopupHeader/PopupHeader.tsx +125 -0
- package/src/components/PopupHeader/index.ts +1 -0
- package/src/components/PopupHeader/styles.module.scss +158 -0
- package/src/components/PopupMedia/PopupMedia.tsx +18 -0
- package/src/components/PopupMedia/index.ts +1 -0
- package/src/components/PopupMedia/styles.module.scss +33 -0
- package/src/components/index.ts +6 -0
- package/src/constants.ts +72 -0
- package/src/context/overlaySurface.tsx +65 -0
- package/src/index.ts +4 -0
- package/src/types.ts +110 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ButtonProps } from '@cloud-ru/ds-button';
|
|
2
|
+
import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { FOOTER_ACTIONS_ORIENTATION, MEDIA_KIND } from './constants';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Пропсы action-кнопки футера — объект пропсов `Button` из `@cloud-ru/ds-button`. `view` / `appearance` имеют
|
|
9
|
+
* дефолты по слоту (переопределяемы); `size` (m) и full-width задаёт `ButtonGroup`, поэтому исключены.
|
|
10
|
+
* `data-test-id` слота фиксирует `TEST_IDS` (через `WithSupportProps` у `ButtonGroup`).
|
|
11
|
+
*
|
|
12
|
+
* По умолчанию рендерится как `<button>`. Для CTA-ссылки передайте `as='a'` + `href` (`Button`
|
|
13
|
+
* полиморфен и отрендерит `<a>` — доступен middle-click / контекстное меню). Union `button | anchor`
|
|
14
|
+
* ниже раскрывает анкорные атрибуты. Для нестандартного футера остаётся `footer: ReactNode`.
|
|
15
|
+
*/
|
|
16
|
+
export type BottomSheetActionButton =
|
|
17
|
+
| Omit<ButtonProps<'button'>, 'fullWidth' | 'size'>
|
|
18
|
+
| Omit<ButtonProps<'a'>, 'fullWidth' | 'size'>;
|
|
19
|
+
|
|
20
|
+
export type MediaKind = ValueOf<typeof MEDIA_KIND>;
|
|
21
|
+
|
|
22
|
+
export type FooterActionsOrientation = ValueOf<typeof FOOTER_ACTIONS_ORIENTATION>;
|
|
23
|
+
|
|
24
|
+
export type PopupMediaProps = {
|
|
25
|
+
/** URL изображения / иконки. */
|
|
26
|
+
src: string;
|
|
27
|
+
/** Альтернативный текст (a11y). */
|
|
28
|
+
alt: string;
|
|
29
|
+
/**
|
|
30
|
+
* Режим:
|
|
31
|
+
* - `'image'` — изображение во всю ширину (высота `184px`), прижато к шапке (убирается
|
|
32
|
+
* верхний отступ контент-блока). Горизонтальные паддинги body не затрагивает — для edge-to-edge body
|
|
33
|
+
* используйте `bodyPadding={false}` отдельно.
|
|
34
|
+
* - `'icon'` — иконка с `padding-top: 24px`.
|
|
35
|
+
* @default 'image'
|
|
36
|
+
*/
|
|
37
|
+
kind?: MediaKind;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type PopupHeaderProps = WithSupportProps<{
|
|
41
|
+
/** Заголовок. Типографика зависит от поверхности: `title-l` на sheet, `headline-s` на window (modal/drawer). */
|
|
42
|
+
title?: ReactNode;
|
|
43
|
+
/** `id` заголовка — для связи с `aria-labelledby` dialog'а (accessible name). */
|
|
44
|
+
titleId?: string;
|
|
45
|
+
/** Slot справа от title (например, `QuestionTooltip` из `@cloud-ru/ds-tooltip`). */
|
|
46
|
+
slotAfterTitle?: ReactNode;
|
|
47
|
+
/** Текстовая строка-подзаголовок под title (Figma `subtitleWrapper`). Рендерится на всех поверхностях. */
|
|
48
|
+
subtitle?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Slot под подзаголовком (Figma `secondWrapper`) — типично `SearchBar`, `SegmentControl` или `Filter`.
|
|
51
|
+
* Есть только в мастере `bottomSheet`, поэтому рендерится **только** на sheet-поверхности.
|
|
52
|
+
*/
|
|
53
|
+
slotSecondTitle?: ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* Callback клика на back-кнопку (слева в шапке).
|
|
56
|
+
* Наличие callback'а авто-рендерит `Button view='function' icon={<ArrowLeftSVG />}`.
|
|
57
|
+
*/
|
|
58
|
+
onBackButtonClick?(): void;
|
|
59
|
+
/** Slot справа от headline-строки (любой `ReactNode`, обычно `Button` с иконкой). */
|
|
60
|
+
actionButton?: ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Усечение строковых `title`/`subtitle` через `TruncateString` (число строк). Применяется только
|
|
63
|
+
* когда задано — по умолчанию текст не усекается. Актуально для window-поверхности (modal/drawer),
|
|
64
|
+
* где длинный заголовок иначе переносится на несколько строк.
|
|
65
|
+
*/
|
|
66
|
+
truncate?: {
|
|
67
|
+
title?: number;
|
|
68
|
+
subtitle?: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Переопределение `data-test-id` слотов шапки. Каждый пропущенный ключ берётся из `TEST_IDS`.
|
|
72
|
+
* Потребитель-обёртка (drawer/modal) прокидывает сюда свои id, чтобы сохранить публичный контракт.
|
|
73
|
+
*/
|
|
74
|
+
testIds?: PopupHeaderTestIds;
|
|
75
|
+
/** CSS-класс контейнера header'а. */
|
|
76
|
+
className?: string;
|
|
77
|
+
}>;
|
|
78
|
+
|
|
79
|
+
/** `data-test-id` слотов `PopupHeader` — для переопределения потребителем. */
|
|
80
|
+
export type PopupHeaderTestIds = {
|
|
81
|
+
header?: string;
|
|
82
|
+
title?: string;
|
|
83
|
+
slotAfterTitle?: string;
|
|
84
|
+
subtitle?: string;
|
|
85
|
+
slotSecondTitle?: string;
|
|
86
|
+
backButton?: string;
|
|
87
|
+
actionButton?: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type PopupBodyProps = WithSupportProps<
|
|
91
|
+
PropsWithChildren<{
|
|
92
|
+
/** Содержимое body (альтернатива `children`). */
|
|
93
|
+
content?: ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Горизонтальные паддинги body. При `false` контент идёт во всю ширину sheet'а (edge-to-edge) —
|
|
96
|
+
* для карт, изображений, списков без отступов. Соответствует Figma-оси `padding=false`.
|
|
97
|
+
* @default true
|
|
98
|
+
*/
|
|
99
|
+
bodyPadding?: boolean;
|
|
100
|
+
/** CSS-класс контейнера body. */
|
|
101
|
+
className?: string;
|
|
102
|
+
}>
|
|
103
|
+
>;
|
|
104
|
+
|
|
105
|
+
export type PopupFooterProps = WithSupportProps<
|
|
106
|
+
PropsWithChildren<{
|
|
107
|
+
/** CSS-класс контейнера footer'а. */
|
|
108
|
+
className?: string;
|
|
109
|
+
}>
|
|
110
|
+
>;
|