@sberbusiness/triplex-next-mcp-server 1.40.0-beta → 1.42.0-beta
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/bundle/components/AlertProcess.md +460 -0
- package/bundle/components/Amount.md +145 -169
- package/bundle/components/Badge.md +155 -219
- package/bundle/components/Body.md +108 -116
- package/bundle/components/Calendar.md +183 -368
- package/bundle/components/CarouselExtended.md +355 -194
- package/bundle/components/Chip.md +310 -314
- package/bundle/components/ComposedKeyDownListener.md +323 -0
- package/bundle/components/FooterPage.md +2 -1
- package/bundle/components/FormField.md +468 -232
- package/bundle/components/HeaderPage.md +2 -1
- package/bundle/components/IconWrapper.md +142 -89
- package/bundle/components/Island.md +303 -123
- package/bundle/components/KeyDownListener.md +152 -100
- package/bundle/components/LoaderMiddle.md +265 -0
- package/bundle/components/LoaderScreen.md +178 -81
- package/bundle/components/LoaderSmall.md +230 -0
- package/bundle/components/MaskedField.md +481 -0
- package/bundle/components/MediaWidth.md +246 -108
- package/bundle/components/MobileView.md +192 -68
- package/bundle/components/ModalWindow.md +3 -1
- package/bundle/components/Page.md +3 -1
- package/bundle/components/Pagination.md +20 -0
- package/bundle/components/SelectExtendedField.md +691 -236
- package/bundle/components/ThemeProvider.md +305 -117
- package/bundle/components/Tooltip.md +421 -181
- package/bundle/guides/commits.md +54 -9
- package/bundle/guides/context.md +26 -0
- package/bundle/guides/stories.md +2 -0
- package/bundle/guides/template.md +1 -1
- package/bundle/manifest.json +63 -18
- package/bundle/release-notes/1.41.0.mdx +76 -0
- package/bundle/release-notes/1.41.1.mdx +18 -0
- package/bundle/release-notes/1.42.0.mdx +88 -0
- package/bundle/release-notes/1.43.0.mdx +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
---
|
|
2
|
+
component: AlertProcess
|
|
3
|
+
category: Alert
|
|
4
|
+
related: [AlertContext]
|
|
5
|
+
tokens:
|
|
6
|
+
- --triplex-next-AlertProcess-Info_Background
|
|
7
|
+
- --triplex-next-AlertProcess-Warning_Background
|
|
8
|
+
- --triplex-next-AlertProcess-Error_Background
|
|
9
|
+
- --triplex-next-AlertProcess-System_Background
|
|
10
|
+
- --triplex-next-AlertProcess-Feature_Background
|
|
11
|
+
stories: stories/Alerts/AlertProcess.stories.tsx
|
|
12
|
+
version: "1.0"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# AlertProcess
|
|
16
|
+
|
|
17
|
+
## Назначение
|
|
18
|
+
|
|
19
|
+
Блочное процессное уведомление: цветной прямоугольник со скруглением, иконкой
|
|
20
|
+
по типу, произвольным контентом, опциональной кнопкой закрытия и опциональным
|
|
21
|
+
раскрывающимся блоком `AlertProcess.Spoiler`. Рендерится в `<div>`, никакой
|
|
22
|
+
ARIA-роли не выставляет.
|
|
23
|
+
|
|
24
|
+
Используй когда: нужно показать в потоке страницы заметное сообщение о
|
|
25
|
+
состоянии процесса — информация, предупреждение, ошибка, системное сообщение
|
|
26
|
+
или анонс новой фичи, — с возможностью добавить ссылку, кнопку-ссылку,
|
|
27
|
+
свернуть длинный текст в спойлер или дать пользователю закрыть сообщение.
|
|
28
|
+
|
|
29
|
+
Не используй когда: нужна короткая инлайновая подпись рядом с полем или
|
|
30
|
+
кнопкой — это `AlertContext`. Для всплывающих уведомлений поверх интерфейса —
|
|
31
|
+
`Notification`.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Варианты и props
|
|
36
|
+
|
|
37
|
+
### AlertProcess
|
|
38
|
+
|
|
39
|
+
#### Обязательные props
|
|
40
|
+
|
|
41
|
+
| Prop | Тип | Описание |
|
|
42
|
+
| ------ | ------------ | ------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| `type` | `EAlertType` | Тип предупреждения: `INFO` / `WARNING` / `ERROR` / `SYSTEM` / `FEATURE`. Определяет фон блока и иконку по умолчанию |
|
|
44
|
+
|
|
45
|
+
#### Опциональные props
|
|
46
|
+
|
|
47
|
+
| Prop | Тип | По умолчанию | Описание |
|
|
48
|
+
| ----------------------------- | --------------------------- | ------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `closable` | `boolean` | `false` | Показывает кнопку закрытия в правом верхнем углу |
|
|
50
|
+
| `onClose` | `() => void` | — | Вызывается **после** того, как компонент скрыл себя. Аргументов не принимает, отменить закрытие нельзя |
|
|
51
|
+
| `renderIcon` | `React.ReactNode` | иконка по `type` | Полностью заменяет иконку по умолчанию |
|
|
52
|
+
| `borderRadius` | `EAlertProcessBorderRadius` | `EAlertProcessBorderRadius.MD` | Скругление углов: `MD` (12px) / `LG` (24px) |
|
|
53
|
+
| `children` | `React.ReactNode` | — | Контент. Типографику задаёт потребитель компонентами `Typography` — сам `AlertProcess` размер и цвет текста не задаёт |
|
|
54
|
+
| `...HTMLDivElementAttributes` | — | — | Все стандартные атрибуты `<div>` |
|
|
55
|
+
|
|
56
|
+
### AlertProcess.Spoiler
|
|
57
|
+
|
|
58
|
+
Раскрывающийся блок внутри `AlertProcess`. **Полностью управляемый** — своего
|
|
59
|
+
состояния не хранит.
|
|
60
|
+
|
|
61
|
+
| Prop | Тип | По умолчанию | Описание |
|
|
62
|
+
| ----------------------------- | ------------------------- | ------------ | -------------------------------------------------------------------- |
|
|
63
|
+
| `open` | `boolean` | `undefined` | Раскрыт ли блок. `undefined` трактуется как «закрыт» |
|
|
64
|
+
| `onOpen` | `(open: boolean) => void` | — | Вызывается по клику на каретку со **следующим** значением (`!open`) |
|
|
65
|
+
| `children` | `React.ReactNode` | — | Раскрываемое содержимое |
|
|
66
|
+
| `...HTMLDivElementAttributes` | — | — | Уходят на элемент раскрываемого контента — корневой элемент спойлера |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Дизайн-токены
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
--triplex-next-AlertProcess-Info_Background // фон для type=INFO
|
|
74
|
+
--triplex-next-AlertProcess-Warning_Background // фон для type=WARNING
|
|
75
|
+
--triplex-next-AlertProcess-Error_Background // фон для type=ERROR
|
|
76
|
+
--triplex-next-AlertProcess-System_Background // фон для type=SYSTEM
|
|
77
|
+
--triplex-next-AlertProcess-Feature_Background // фон для type=FEATURE
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Значения — в `src/components/DesignTokens/components/AlertProcess.ts`. Компонент
|
|
81
|
+
задаёт **только фон**: цвет и размер текста — зона ответственности `Typography`
|
|
82
|
+
у потребителя, цвет иконок — `paletteIndex` соответствующей иконки. Скругления
|
|
83
|
+
(12px / 24px) и внутренние отступы (16px) заданы литералами в
|
|
84
|
+
`styles/AlertProcess.module.less` — токенов для них нет.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Инварианты
|
|
89
|
+
|
|
90
|
+
- **`forwardRef`** — обязателен и у `AlertProcess` (target — корневой
|
|
91
|
+
`HTMLDivElement`), и у `AlertProcess.Spoiler` (target — корневой элемент
|
|
92
|
+
спойлера, он же элемент раскрываемого контента, он же получатель `...rest`).
|
|
93
|
+
Не убирать.
|
|
94
|
+
- **`AlertProcess.Spoiler` — статическое свойство, назначаемое через
|
|
95
|
+
`Object.assign`.** Публичный путь доступа к спойлеру только такой:
|
|
96
|
+
`AlertProcessSpoiler` не реэкспортируется из barrel `src/components/Alert/index.ts`.
|
|
97
|
+
- **`renderIcon` переопределяет иконку через `||`, а не `??`** — falsy-значение
|
|
98
|
+
(`null`, `false`) означает «показать иконку по умолчанию». Поведение
|
|
99
|
+
зафиксировано тестом `Should fall back to the default icon when renderIcon is falsy`
|
|
100
|
+
и совпадает с `AlertContext`.
|
|
101
|
+
- **Закрытие необратимо и неуправляемо.** Внутренний `useState` `closed` не
|
|
102
|
+
сбрасывается ни одним prop'ом. Не превращай его в контролируемый prop без
|
|
103
|
+
согласования — это изменение публичного API.
|
|
104
|
+
- **Связь `AlertProcess` ↔ `AlertProcess.Spoiler` идёт через
|
|
105
|
+
`AlertProcessContext`**, а не через `React.Children`. Поэтому спойлер может
|
|
106
|
+
лежать на любой глубине внутри `AlertProcess`. Контекст не экспортируется.
|
|
107
|
+
- **CSS-классы `alertProcess`, `alertTypeInfo`, `alertTypeWarning`,
|
|
108
|
+
`alertTypeError`, `alertTypeSystem`, `alertTypeFeature`, `md`, `lg`,
|
|
109
|
+
`withSpoiler`, `expandableContent`, `expanded`** проверяются в unit-тестах —
|
|
110
|
+
не переименовывать.
|
|
111
|
+
- **`ALERT_TYPE_TO_CLASS_NAME_MAP`** (`AlertTypeUtils.tsx`) — общий с
|
|
112
|
+
`AlertContext` и экспортируется из barrel. Его форма
|
|
113
|
+
(`Record<EAlertType, (styles) => string>`) — часть публичного API.
|
|
114
|
+
- **`EAlertType.FEATURE` поддерживается только здесь.** В `AlertContext` он
|
|
115
|
+
исключён на уровне типа, но ветка `FEATURE` в общем маппинге существует
|
|
116
|
+
именно ради `AlertProcess`.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Подводные камни
|
|
121
|
+
|
|
122
|
+
- **Закрытие нельзя отменить и нельзя «переоткрыть» props'ами.** Клик по
|
|
123
|
+
крестику сначала выставляет внутренний `closed`, затем зовёт `onClose`.
|
|
124
|
+
Компонент возвращает `null` навсегда — даже если снять `closable`. Чтобы
|
|
125
|
+
показать уведомление снова, потребитель должен размонтировать компонент и
|
|
126
|
+
смонтировать заново (например, сменить `key`) либо не рендерить его вовсе,
|
|
127
|
+
управляя видимостью у себя.
|
|
128
|
+
- **`AlertProcess.Spoiler` не переключается сам.** По клику он только зовёт
|
|
129
|
+
`onOpen(!open)`. Без внешнего состояния каретка будет крутиться вхолостую —
|
|
130
|
+
см. `examples/AlertProcess/WithSpoiler.tsx`.
|
|
131
|
+
- **Несколько спойлеров в одном `AlertProcess` не поддержаны.** `hasSpoiler` —
|
|
132
|
+
булев флаг, а не счётчик: при размонтировании любого из спойлеров он
|
|
133
|
+
сбрасывается в `false`, и класс `withSpoiler` (резерв высоты 40px под кнопку)
|
|
134
|
+
пропадает, хотя второй спойлер ещё жив.
|
|
135
|
+
- **`AlertProcess.Spoiler` рендерит два соседних элемента без общей обёртки** —
|
|
136
|
+
элемент раскрываемого контента (классы `expandableContent` / `expanded`) и
|
|
137
|
+
блок кнопки раскрытия (`expandButton`). Кнопка не может лежать внутри
|
|
138
|
+
контента: в свёрнутом состоянии тот скрыт (`max-height: 0; overflow: hidden`).
|
|
139
|
+
Корневой элемент компонента — элемент контента, он и получает `className`,
|
|
140
|
+
`ref` и `...rest`. `className` с 1.42.0 **мерджится** к собственным классам
|
|
141
|
+
(раньше `{...rest}` шёл после `className` и полностью затирал их, ломая
|
|
142
|
+
анимацию раскрытия).
|
|
143
|
+
- **Кнопка раскрытия позиционируется относительно корня `AlertProcess`**
|
|
144
|
+
(`position: absolute; right: 16px; bottom: 16px` внутри
|
|
145
|
+
`.alertProcess { position: relative }`), а не относительно самого спойлера.
|
|
146
|
+
Класс `withSpoiler` даёт блоку `min-height: 40px`, чтобы кнопка не наехала на
|
|
147
|
+
контент в свёрнутом состоянии.
|
|
148
|
+
- **Анимация раскрытия — `max-height: 0 → 1000px`.** Контент выше 1000px
|
|
149
|
+
обрежется. Это осознанный CSS-компромисс ради transition; при необходимости
|
|
150
|
+
показывать очень длинный текст спойлер не подходит.
|
|
151
|
+
- **`data-tx` выставляется после `{...rest}`** — потребитель не может его
|
|
152
|
+
переопределить. Это общий паттерн семейства (так же в `AlertContext`).
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Accessibility
|
|
157
|
+
|
|
158
|
+
Компонент **не** реализует ARIA-контракт уведомления — это осознанное текущее
|
|
159
|
+
состояние, а не забытая деталь:
|
|
160
|
+
|
|
161
|
+
- Корневой элемент — обычный `<div>` без `role`. В отличие от `AlertContext`,
|
|
162
|
+
live-region здесь нет: содержимое `AlertProcess` обычно объёмное, и
|
|
163
|
+
`role="alert"` (assertive) зачитывал бы его целиком, прерывая пользователя.
|
|
164
|
+
Если сообщение появляется динамически и должно быть озвучено — оберни
|
|
165
|
+
`AlertProcess` собственным live-region'ом или продублируй суть в
|
|
166
|
+
`AlertContext`.
|
|
167
|
+
- **Кнопка закрытия и кнопка раскрытия спойлера не имеют доступного имени.**
|
|
168
|
+
Обе рендерятся через `ButtonIcon`, который требует `aria-label` от
|
|
169
|
+
потребителя, но `AlertProcess` не даёт props для его проброса, а хардкодить
|
|
170
|
+
русский текст внутри компонента запрещено (`docs/ai/codestyle.md` →
|
|
171
|
+
«Мультиязычность»). Скринридер прочитает их как «кнопка». Закрыть эту дыру
|
|
172
|
+
можно только новым публичным API (например, `closeButtonProps` /
|
|
173
|
+
`spoilerButtonProps`) — это отдельная задача, breaking-изменением не является,
|
|
174
|
+
но требует согласования.
|
|
175
|
+
- **`aria-expanded` на кнопке спойлера выставляется** (`Boolean(open)`), а
|
|
176
|
+
**`aria-controls` — нет**: он требует стабильного `id` на элементе контента,
|
|
177
|
+
а генерировать его нечем — `useId` недоступен, библиотека собирается и под
|
|
178
|
+
React 17. Пробросить свой `id` можно через `...rest` спойлера, но связать его
|
|
179
|
+
с кнопкой изнутри компонента сейчас нельзя. Скрытый контент при этом остаётся
|
|
180
|
+
в DOM и доступен скринридеру всегда, независимо от `open`.
|
|
181
|
+
- Иконка типа декоративна и текстовой альтернативы не имеет: смысл сообщения
|
|
182
|
+
должен целиком быть в `children`. Не полагайся на цвет фона и иконку как на
|
|
183
|
+
единственный носитель информации о серьёзности.
|
|
184
|
+
- Собственных обработчиков клавиатуры у компонента нет — кнопки работают
|
|
185
|
+
штатно (`Enter` / `Space`), фокус нигде не перехватывается и не возвращается.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Связанные компоненты
|
|
190
|
+
|
|
191
|
+
- `AlertContext` — инлайновый вариант того же семейства: `<span>` с
|
|
192
|
+
`role="alert"`, иконка + короткий текст, без фона и кнопок. Не поддерживает
|
|
193
|
+
`EAlertType.FEATURE`.
|
|
194
|
+
- `AlertProcessSpoiler` — субкомпонент, доступный только как
|
|
195
|
+
`AlertProcess.Spoiler`. Собственного AI.md не имеет, описан здесь.
|
|
196
|
+
- `EAlertType` — общий enum типов семейства. `AlertProcess` использует его целиком.
|
|
197
|
+
- `EAlertProcessBorderRadius` — enum скруглений, экспортируется из barrel.
|
|
198
|
+
- `ALERT_TYPE_TO_CLASS_NAME_MAP` (`AlertTypeUtils.tsx`) — общий с `AlertContext`
|
|
199
|
+
маппинг типа в CSS-класс. Собственного AI.md не имеет.
|
|
200
|
+
- `ButtonIcon` — рендерит кнопки закрытия и раскрытия. Требует `aria-label`,
|
|
201
|
+
который `AlertProcess` сейчас не пробрасывает (см. «Accessibility»).
|
|
202
|
+
- `Text`, `Link`, `Button` (тема `LINK`), `Gap` — типовое наполнение контента,
|
|
203
|
+
см. examples.
|
|
204
|
+
- `StatusTrackerAlert` (`src/components/StatusTracker/components/StatusTrackerAlert.tsx`) —
|
|
205
|
+
внутренний потребитель: оборачивает `AlertProcess`, подмешивая свой
|
|
206
|
+
`className` и типизируясь тем же `IAlertProcessProps`. Любое изменение
|
|
207
|
+
props `AlertProcess` затрагивает и его.
|
|
208
|
+
- `Notification` — всплывающее уведомление поверх интерфейса, а не блочное.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Stories
|
|
213
|
+
|
|
214
|
+
Основные истории: `stories/Alerts/AlertProcess.stories.tsx`
|
|
215
|
+
Файлы примеров: `stories/Alerts/examples/AlertProcess/`
|
|
216
|
+
|
|
217
|
+
| Story | Example file | Что демонстрирует |
|
|
218
|
+
| ---------------- | -------------------- | --------------------------------------------------------------------- |
|
|
219
|
+
| `Playground` | `Playground.tsx` | Интерактивный контроль `type`, `closable`, `children`, `borderRadius` |
|
|
220
|
+
| `Default` | `Default.tsx` | Базовое предупреждение с типом `INFO` |
|
|
221
|
+
| `Types` | `Types.tsx` | Все пять типов: `INFO` / `WARNING` / `ERROR` / `SYSTEM` / `FEATURE` |
|
|
222
|
+
| `BorderRadius` | `BorderRadius.tsx` | Скругления `MD` и `LG` |
|
|
223
|
+
| `WithCustomIcon` | `WithCustomIcon.tsx` | Замена иконки через `renderIcon` |
|
|
224
|
+
| `Closable` | `Closable.tsx` | Кнопка закрытия и обработчик `onClose` |
|
|
225
|
+
| `WithButtonLink` | `WithButtonLink.tsx` | Композиция с `Button` темы `LINK` |
|
|
226
|
+
| `WithLink` | `WithLink.tsx` | Композиция с `Link` |
|
|
227
|
+
| `WithSpoiler` | `WithSpoiler.tsx` | `AlertProcess.Spoiler` в свёрнутом состоянии с внешним состоянием |
|
|
228
|
+
| `VisualTests` | `VisualTests.tsx` | Спойлер в раскрытом состоянии (`open`) |
|
|
229
|
+
|
|
230
|
+
Скриншот-тесты: baseline лежат в `__screenshots__/` как
|
|
231
|
+
`alerts-alertprocess--{default,types,border-radius,with-custom-icon,closable,with-spoiler,visual-tests}--{xs,xl}.png`.
|
|
232
|
+
Из скриншот-тестов исключены `Playground` (всегда, по `docs/ai/stories-guide.md`)
|
|
233
|
+
и `WithButtonLink` / `WithLink` — они визуально почти дублируют `Default`,
|
|
234
|
+
отличаясь только вложенной ссылкой.
|
|
235
|
+
|
|
236
|
+
Непокрытые визуальные кейсы: hover / focus кнопок закрытия и раскрытия,
|
|
237
|
+
комбинация `closable` + спойлер, перенос текста на много строк, контент выше
|
|
238
|
+
1000px (обрезается `max-height`).
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## История изменений
|
|
243
|
+
|
|
244
|
+
| Дата | Изменение |
|
|
245
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
246
|
+
| 2026-08-10 | Создан документ. AI-рефакторинг: `AlertProcessSpoiler` переведён на `forwardRef` и перестал затирать `className` собственными классами; из него убрана ссылка на несуществующий CSS-класс `styles.spoiler`; в `AlertProcess` убрано дублирующее присваивание `AlertProcess.Spoiler`, `renderIcon` приведён к `\|\|` как в `AlertContext`, добавлены JSDoc на props с дефолтами и явный `children`; из LESS удалено мёртвое правило `.alertTypeFeature .themeIcon { padding-top: 0 }`. Unit-тесты разбиты на `AlertProcess.test.tsx`и`AlertProcessSpoiler.test.tsx`и расширены с 11 до 34 кейсов. Stories переведены на modern pattern — файлы примеров без суффикса`Example`. Публичный API не изменён. |
|
|
247
|
+
| 2026-08-11 | По ревью PR #520: из `AlertProcessSpoiler` убрана пустая обёртка-`<div>` — контент и кнопка раскрытия стали соседними элементами, корневым элементом компонента стал элемент контента (он и раньше получал `className` / `ref` / `...rest`). На кнопке раскрытия выставлен `aria-expanded`. Тесты дополнены до 37 кейсов. Публичный API не изменён. |
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Примеры использования
|
|
252
|
+
|
|
253
|
+
### Default
|
|
254
|
+
|
|
255
|
+
`stories/Alerts/examples/AlertProcess/Default.tsx`
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
import React from "react";
|
|
259
|
+
import { AlertProcess, EAlertType, EFontType, ETextSize, Text } from "@sberbusiness/triplex-next";
|
|
260
|
+
|
|
261
|
+
export const Default = () => (
|
|
262
|
+
<div style={{ maxWidth: "750px" }}>
|
|
263
|
+
<AlertProcess type={EAlertType.INFO}>
|
|
264
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
265
|
+
This message provides context or highlights important information to note.
|
|
266
|
+
</Text>
|
|
267
|
+
</AlertProcess>
|
|
268
|
+
</div>
|
|
269
|
+
);
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Types
|
|
273
|
+
|
|
274
|
+
`stories/Alerts/examples/AlertProcess/Types.tsx`
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
import React from "react";
|
|
278
|
+
import { AlertProcess, EAlertType, EFontType, ETextSize, Text } from "@sberbusiness/triplex-next";
|
|
279
|
+
|
|
280
|
+
const TYPES = Object.values(EAlertType);
|
|
281
|
+
|
|
282
|
+
export const Types = () => (
|
|
283
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "16px", maxWidth: "750px" }}>
|
|
284
|
+
{TYPES.map((type) => (
|
|
285
|
+
<div key={type}>
|
|
286
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>{type.toUpperCase()}</div>
|
|
287
|
+
<AlertProcess type={type}>
|
|
288
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
289
|
+
This message provides context or highlights important information to note.
|
|
290
|
+
</Text>
|
|
291
|
+
</AlertProcess>
|
|
292
|
+
</div>
|
|
293
|
+
))}
|
|
294
|
+
</div>
|
|
295
|
+
);
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### BorderRadius
|
|
299
|
+
|
|
300
|
+
`stories/Alerts/examples/AlertProcess/BorderRadius.tsx`
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
import React from "react";
|
|
304
|
+
import {
|
|
305
|
+
AlertProcess,
|
|
306
|
+
EAlertProcessBorderRadius,
|
|
307
|
+
EAlertType,
|
|
308
|
+
EFontType,
|
|
309
|
+
ETextSize,
|
|
310
|
+
Text,
|
|
311
|
+
} from "@sberbusiness/triplex-next";
|
|
312
|
+
|
|
313
|
+
const BORDER_RADIUSES = Object.values(EAlertProcessBorderRadius);
|
|
314
|
+
|
|
315
|
+
export const BorderRadius = () => (
|
|
316
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "16px", maxWidth: "750px" }}>
|
|
317
|
+
{BORDER_RADIUSES.map((borderRadius) => (
|
|
318
|
+
<div key={borderRadius}>
|
|
319
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>
|
|
320
|
+
{borderRadius.toUpperCase()}
|
|
321
|
+
</div>
|
|
322
|
+
<AlertProcess type={EAlertType.INFO} borderRadius={borderRadius}>
|
|
323
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
324
|
+
This message provides context or highlights important information to note.
|
|
325
|
+
</Text>
|
|
326
|
+
</AlertProcess>
|
|
327
|
+
</div>
|
|
328
|
+
))}
|
|
329
|
+
</div>
|
|
330
|
+
);
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### WithCustomIcon
|
|
334
|
+
|
|
335
|
+
`stories/Alerts/examples/AlertProcess/WithCustomIcon.tsx`
|
|
336
|
+
|
|
337
|
+
```tsx
|
|
338
|
+
import React from "react";
|
|
339
|
+
import { DefaulticonStrokePrdIcon20 } from "@sberbusiness/icons-next";
|
|
340
|
+
import { AlertProcess, EAlertType, EFontType, ETextSize, Text } from "@sberbusiness/triplex-next";
|
|
341
|
+
|
|
342
|
+
export const WithCustomIcon = () => (
|
|
343
|
+
<div style={{ maxWidth: "750px" }}>
|
|
344
|
+
<AlertProcess type={EAlertType.INFO} renderIcon={<DefaulticonStrokePrdIcon20 paletteIndex={0} />}>
|
|
345
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
346
|
+
This message provides context or highlights important information to note.
|
|
347
|
+
</Text>
|
|
348
|
+
</AlertProcess>
|
|
349
|
+
</div>
|
|
350
|
+
);
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Closable
|
|
354
|
+
|
|
355
|
+
`stories/Alerts/examples/AlertProcess/Closable.tsx`
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
import React from "react";
|
|
359
|
+
import { AlertProcess, EAlertType, EFontType, ETextSize, Text } from "@sberbusiness/triplex-next";
|
|
360
|
+
|
|
361
|
+
export const Closable = () => (
|
|
362
|
+
<div style={{ maxWidth: "750px" }}>
|
|
363
|
+
<AlertProcess type={EAlertType.INFO} closable onClose={() => {}}>
|
|
364
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
365
|
+
This message provides context or highlights important information to note.
|
|
366
|
+
</Text>
|
|
367
|
+
</AlertProcess>
|
|
368
|
+
</div>
|
|
369
|
+
);
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### WithButtonLink
|
|
373
|
+
|
|
374
|
+
`stories/Alerts/examples/AlertProcess/WithButtonLink.tsx`
|
|
375
|
+
|
|
376
|
+
```tsx
|
|
377
|
+
import React from "react";
|
|
378
|
+
import {
|
|
379
|
+
AlertProcess,
|
|
380
|
+
Button,
|
|
381
|
+
EAlertType,
|
|
382
|
+
EButtonTheme,
|
|
383
|
+
EComponentSize,
|
|
384
|
+
EFontType,
|
|
385
|
+
ETextSize,
|
|
386
|
+
Gap,
|
|
387
|
+
Text,
|
|
388
|
+
} from "@sberbusiness/triplex-next";
|
|
389
|
+
|
|
390
|
+
export const WithButtonLink = () => (
|
|
391
|
+
<div style={{ maxWidth: "750px" }}>
|
|
392
|
+
<AlertProcess type={EAlertType.INFO}>
|
|
393
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
394
|
+
This message provides context or highlights important information to note.
|
|
395
|
+
</Text>
|
|
396
|
+
<Gap size={8} />
|
|
397
|
+
<Button theme={EButtonTheme.LINK} size={EComponentSize.SM}>
|
|
398
|
+
Button link text
|
|
399
|
+
</Button>
|
|
400
|
+
</AlertProcess>
|
|
401
|
+
</div>
|
|
402
|
+
);
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### WithLink
|
|
406
|
+
|
|
407
|
+
`stories/Alerts/examples/AlertProcess/WithLink.tsx`
|
|
408
|
+
|
|
409
|
+
```tsx
|
|
410
|
+
import React from "react";
|
|
411
|
+
import { AlertProcess, EAlertType, EFontType, ETextSize, Gap, Link, Text } from "@sberbusiness/triplex-next";
|
|
412
|
+
|
|
413
|
+
export const WithLink = () => (
|
|
414
|
+
<div style={{ maxWidth: "750px" }}>
|
|
415
|
+
<AlertProcess type={EAlertType.INFO}>
|
|
416
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
417
|
+
This message provides context or highlights important information to note.
|
|
418
|
+
</Text>
|
|
419
|
+
<Gap size={8} />
|
|
420
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
421
|
+
<Link href="#" onClick={(event) => event.preventDefault()}>
|
|
422
|
+
Link text
|
|
423
|
+
</Link>
|
|
424
|
+
</Text>
|
|
425
|
+
</AlertProcess>
|
|
426
|
+
</div>
|
|
427
|
+
);
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### WithSpoiler
|
|
431
|
+
|
|
432
|
+
`stories/Alerts/examples/AlertProcess/WithSpoiler.tsx`
|
|
433
|
+
|
|
434
|
+
```tsx
|
|
435
|
+
import React, { useState } from "react";
|
|
436
|
+
import { AlertProcess, EAlertType, EFontType, ETextSize, Text } from "@sberbusiness/triplex-next";
|
|
437
|
+
|
|
438
|
+
export const WithSpoiler = () => {
|
|
439
|
+
const [expanded, setExpanded] = useState(false);
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
<div style={{ maxWidth: "750px" }}>
|
|
443
|
+
<AlertProcess type={EAlertType.INFO}>
|
|
444
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
445
|
+
По вопросам финмониторинга обращайтесь в рабочие дни с 03:00 до 21:00 МСК с мобильного телефона по
|
|
446
|
+
номеру 0321, доб. 6. Звонки по России бесплатные.
|
|
447
|
+
</Text>
|
|
448
|
+
<AlertProcess.Spoiler open={expanded} onOpen={setExpanded}>
|
|
449
|
+
<Text size={ETextSize.B3} type={EFontType.PRIMARY}>
|
|
450
|
+
У вас нет прав на подписание и отправку заявления в страховую компанию. Подписывать заявления, а
|
|
451
|
+
также заверять документы, имеет право генеральный директор на основании устава, владелец ИП на
|
|
452
|
+
основании доверенности.
|
|
453
|
+
</Text>
|
|
454
|
+
</AlertProcess.Spoiler>
|
|
455
|
+
</AlertProcess>
|
|
456
|
+
</div>
|
|
457
|
+
);
|
|
458
|
+
};
|
|
459
|
+
```
|
|
460
|
+
|