@sberbusiness/triplex-next-mcp-server 0.24.0-beta1 → 0.36.0-beta0
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 +10 -0
- package/bundle/components/Alert.md +272 -0
- package/bundle/components/Amount.md +138 -0
- package/bundle/components/AmountField.md +174 -0
- package/bundle/components/Avatar.md +72 -0
- package/bundle/components/Badge.md +203 -0
- package/bundle/components/BodyPage.md +186 -0
- package/bundle/components/Button.md +370 -85
- package/bundle/components/ButtonDropdown.md +328 -70
- package/bundle/components/ButtonIcon.md +98 -42
- package/bundle/components/Calendar.md +58 -0
- package/bundle/components/Checkbox.md +77 -44
- package/bundle/components/CheckboxTree.md +61 -0
- package/bundle/components/CheckboxTreeExtended.md +114 -0
- package/bundle/components/CheckboxXGroup.md +120 -16
- package/bundle/components/CheckboxYGroup.md +88 -15
- package/bundle/components/CollapsibleTree.md +581 -0
- package/bundle/components/CollapsibleTreeExtended.md +418 -0
- package/bundle/components/EmptyView.md +133 -15
- package/bundle/components/FooterPage.md +203 -0
- package/bundle/components/Gap.md +115 -57
- package/bundle/components/HeaderPage.md +226 -0
- package/bundle/components/HelpBox.md +231 -72
- package/bundle/components/ImageGallery.md +423 -0
- package/bundle/components/ImageGalleryExtended.md +606 -0
- package/bundle/components/List.md +194 -186
- package/bundle/components/ListItem.md +251 -0
- package/bundle/components/ListItemControlsButton.md +103 -0
- package/bundle/components/ListItemControlsButtonDropdown.md +107 -0
- package/bundle/components/ListItemSelectable.md +99 -0
- package/bundle/components/ListItemTable.md +390 -0
- package/bundle/components/ListMaster.md +877 -156
- package/bundle/components/ListMasterFooter.md +80 -0
- package/bundle/components/ListMasterHeader.md +86 -0
- package/bundle/components/ListSortable.md +153 -0
- package/bundle/components/ListSortableItem.md +175 -0
- package/bundle/components/ModalWindow.md +427 -237
- package/bundle/components/MonthYearField.md +145 -109
- package/bundle/components/Notification.md +625 -155
- package/bundle/components/Overlay.md +271 -170
- package/bundle/components/Page.md +283 -186
- package/bundle/components/Pagination.md +206 -229
- package/bundle/components/SliderExtended.md +285 -0
- package/bundle/guides/codestyle.md +38 -11
- package/bundle/guides/commits.md +1 -2
- package/bundle/guides/context.md +34 -30
- package/bundle/guides/stories.md +110 -40
- package/bundle/guides/template.md +3 -7
- package/bundle/guides/tests.md +6 -2
- package/bundle/manifest.json +194 -24
- package/bundle/release-notes/1.26.0.mdx +33 -2
- package/bundle/release-notes/1.27.0.mdx +43 -0
- package/bundle/release-notes/1.28.0.mdx +25 -0
- package/bundle/release-notes/1.29.0.mdx +47 -0
- package/bundle/release-notes/1.30.0.mdx +56 -0
- package/bundle/release-notes/1.31.0.mdx +52 -0
- package/bundle/release-notes/1.32.0.mdx +35 -0
- package/bundle/release-notes/1.33.0.mdx +61 -0
- package/bundle/release-notes/1.34.0.mdx +35 -0
- package/bundle/release-notes/1.35.0.mdx +21 -0
- package/bundle/release-notes/1.35.1.mdx +11 -0
- package/bundle/release-notes/1.36.0.mdx +21 -0
- package/bundle/release-notes/1.37.0.mdx +30 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
component: Button
|
|
3
3
|
category: Buttons
|
|
4
|
-
figma-node: "1-328"
|
|
5
|
-
figma-file: "https://www.figma.com/design/MeAqaaLV9acAgoBOkZC9C2/-W--LIB-DSN-01-Components-DCB-Next-v.1.3.0"
|
|
6
4
|
related: [ButtonIcon, ButtonDropdown, ButtonDropdownExtended]
|
|
7
5
|
tokens:
|
|
8
6
|
- --triplex-next-Button-General_Background_Default
|
|
@@ -64,42 +62,17 @@ version: "1.0"
|
|
|
64
62
|
|
|
65
63
|
---
|
|
66
64
|
|
|
67
|
-
## Файловая структура
|
|
68
|
-
|
|
69
|
-
```text
|
|
70
|
-
src/components/Button/
|
|
71
|
-
├── Button.tsx # Основной компонент, union type TButtonProps
|
|
72
|
-
├── ButtonBase.tsx # Базовый <button>, extends HTML attrs
|
|
73
|
-
├── ButtonIcon.tsx # Иконочная кнопка (squircle / circle)
|
|
74
|
-
├── ButtonDropdown.tsx # Кнопка с выпадающим меню
|
|
75
|
-
├── ButtonDropdownExtended.tsx # Контейнер с кастомным dropdown
|
|
76
|
-
├── enums.ts # EButtonTheme, EButtonDotsTheme, EButtonIconShape
|
|
77
|
-
├── index.ts # Barrel exports
|
|
78
|
-
└── styles/
|
|
79
|
-
├── Button.module.less # Размеры, block, loading, base layout
|
|
80
|
-
├── ButtonGeneral.module.less # Тема GENERAL
|
|
81
|
-
├── ButtonSecondary.module.less
|
|
82
|
-
├── ButtonSecondaryLight.module.less
|
|
83
|
-
├── ButtonDanger.module.less
|
|
84
|
-
├── ButtonLink.module.less # Тема LINK — нет min-width, нет bg
|
|
85
|
-
├── ButtonIcon.module.less # Стили ButtonIcon
|
|
86
|
-
├── ButtonDropdown.module.less
|
|
87
|
-
└── ButtonDropdownExtended.module.less
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
65
|
## Варианты и props
|
|
93
66
|
|
|
94
67
|
### Темы (`EButtonTheme`)
|
|
95
68
|
|
|
96
|
-
| Значение | Описание |
|
|
97
|
-
|
|
98
|
-
| `GENERAL` | Основной стиль (primary) |
|
|
99
|
-
| `SECONDARY` | Вторичный |
|
|
100
|
-
| `SECONDARY_LIGHT` | Вторичный светлый (для тёмных фонов) |
|
|
101
|
-
| `DANGER` | Деструктивное действие |
|
|
102
|
-
| `LINK` | Текстовая ссылка |
|
|
69
|
+
| Значение | Описание |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `GENERAL` | Основной стиль (primary) |
|
|
72
|
+
| `SECONDARY` | Вторичный |
|
|
73
|
+
| `SECONDARY_LIGHT` | Вторичный светлый (для тёмных фонов) |
|
|
74
|
+
| `DANGER` | Деструктивное действие |
|
|
75
|
+
| `LINK` | Текстовая ссылка |
|
|
103
76
|
|
|
104
77
|
### Размеры (`EComponentSize`)
|
|
105
78
|
|
|
@@ -109,17 +82,22 @@ src/components/Button/
|
|
|
109
82
|
| `MD` | 40px | 0 20px | 8px | 14px |
|
|
110
83
|
| `LG` | 56px | 0 24px | 10px | 16px |
|
|
111
84
|
|
|
112
|
-
###
|
|
85
|
+
### Обязательные props (`Button`)
|
|
113
86
|
|
|
114
|
-
| Prop | Тип |
|
|
87
|
+
| Prop | Тип | Описание |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `theme` | `EButtonTheme` | Визуальный стиль |
|
|
90
|
+
| `size` | `EComponentSize` | Размер |
|
|
91
|
+
|
|
92
|
+
### Опциональные props (`Button`)
|
|
93
|
+
|
|
94
|
+
| Prop | Тип | По умолчанию | Описание |
|
|
115
95
|
|---|---|---|---|
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `children` | `React.ReactNode` | Нет | Текст кнопки |
|
|
122
|
-
| `...HTMLButtonAttributes` | — | — | Все стандартные атрибуты `<button>` |
|
|
96
|
+
| `block` | `boolean` | `false` | Полноширинный режим |
|
|
97
|
+
| `loading` | `boolean` | `false` | Состояние загрузки: скрывает контент через `visibility: hidden`, показывает спиннер, ставит `tabIndex={-1}` |
|
|
98
|
+
| `icon` | `React.ReactElement` | — | Иконка слева от текста; если без `children` — кнопка становится квадратной (icon-only) |
|
|
99
|
+
| `children` | `React.ReactNode` | — | Текст кнопки |
|
|
100
|
+
| `...HTMLButtonAttributes` | — | — | Все стандартные атрибуты `<button>`, включая `aria-expanded` (см. Accessibility) |
|
|
123
101
|
|
|
124
102
|
### Props компонента `ButtonIcon`
|
|
125
103
|
|
|
@@ -129,45 +107,11 @@ src/components/Button/
|
|
|
129
107
|
| `active` | `boolean` | `false` | Визуальное активное состояние |
|
|
130
108
|
| `...HTMLButtonAttributes` | — | — | Включая `disabled` |
|
|
131
109
|
|
|
132
|
-
|
|
110
|
+
### Ограничения по темам
|
|
133
111
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
Если передан `icon` без `children` — добавляется класс `.icon`, который делает кнопку квадратной:
|
|
138
|
-
```tsx
|
|
139
|
-
// Button.tsx — логика определения icon-only режима
|
|
140
|
-
const iconOnly = Boolean(icon) && !children;
|
|
141
|
-
<button className={clsx(styles.button, { [styles.icon]: iconOnly })}>
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Состояние загрузки
|
|
145
|
-
- `loading` скрывает контент через `visibility: hidden` (не `display: none`) — сохраняет размеры,
|
|
146
|
-
- устанавливает `tabIndex={-1}` — кнопка недоступна с клавиатуры
|
|
147
|
-
- Тема лоадера: `SECONDARY` и `SECONDARY_LIGHT` → `ELoaderSmallTheme.BRAND`, остальные → `ELoaderSmallTheme.NEUTRAL`
|
|
148
|
-
|
|
149
|
-
### `aria-expanded` управляет визуалом
|
|
150
|
-
Состояние "раскрыто" (например, когда кнопка открывает dropdown) управляется через `aria-expanded`:
|
|
151
|
-
```tsx
|
|
152
|
-
<Button aria-expanded={true} ...> → добавляет CSS-классы .expanded и .active
|
|
153
|
-
```
|
|
154
|
-
Отдельного prop `expanded` нет — используй стандартный HTML-атрибут.
|
|
155
|
-
|
|
156
|
-
### Тема LINK
|
|
157
|
-
- Нет `min-width`
|
|
158
|
-
- `background: transparent`
|
|
159
|
-
- `padding` по вертикали отличается от других тем (меньше)
|
|
160
|
-
- `block`, `loading`, `icon` — тип `never` в интерфейсе, TypeScript запрещает передачу
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## Accessibility
|
|
165
|
-
|
|
166
|
-
- Нативный `<button>` — полная поддержка клавиатуры (Tab, Enter, Space) без дополнительных атрибутов.
|
|
167
|
-
- **`ButtonIcon`**: иконочная кнопка без видимого текста — потребитель **обязан** передать `aria-label` через `...rest`. Библиотека мультиязычная, текст не хардкодится.
|
|
168
|
-
- **`loading`**: устанавливает `tabIndex={-1}` — кнопка исключается из tab-порядка. Если нужна доступность состояния загрузки для скринридеров, потребитель добавляет `aria-busy="true"` через props.
|
|
169
|
-
- **`aria-expanded`**: управляет визуальным состоянием "раскрыто" (добавляет CSS-классы `.expanded`, `.active`). Передаётся потребителем при использовании кнопки как триггера dropdown.
|
|
170
|
-
- Фокус-стиль через `:focus-visible` — виден только при клавиатурной навигации.
|
|
112
|
+
- `block`, `loading`, `icon` недоступны для темы `LINK` — тип `never` в интерфейсе, TypeScript запрещает передачу.
|
|
113
|
+
- Тема `LINK` не имеет `min-width`, фона (`background: transparent`) и использует уменьшенный вертикальный `padding`.
|
|
114
|
+
- Тема лоадера (`loading`) для `SECONDARY` и `SECONDARY_LIGHT` — `ELoaderSmallTheme.BRAND`, для остальных — `ELoaderSmallTheme.NEUTRAL`.
|
|
171
115
|
|
|
172
116
|
---
|
|
173
117
|
|
|
@@ -175,12 +119,12 @@ const iconOnly = Boolean(icon) && !children;
|
|
|
175
119
|
|
|
176
120
|
Паттерн: `--triplex-next-Button-{Theme}_{Property}_{State}`
|
|
177
121
|
|
|
178
|
-
Каждая тема (кроме LINK) имеет полный набор:
|
|
122
|
+
Каждая тема (кроме `LINK`) имеет полный набор:
|
|
179
123
|
- `_Background_Default/Hover/Active/Disabled`
|
|
180
124
|
- `_Color_Default/Hover/Active/Disabled`
|
|
181
125
|
- `_Shadow_Focus`
|
|
182
126
|
|
|
183
|
-
Тема LINK — только `_Color_*` и `_Shadow_Focus` (нет фона).
|
|
127
|
+
Тема `LINK` — только `_Color_*` и `_Shadow_Focus` (нет фона).
|
|
184
128
|
|
|
185
129
|
При добавлении нового визуального состояния нужен новый токен в `src/generated/themesCssVariables.css`.
|
|
186
130
|
|
|
@@ -192,7 +136,17 @@ const iconOnly = Boolean(icon) && !children;
|
|
|
192
136
|
- **`TButtonProps` union type** — должен включать все тематические интерфейсы. При добавлении новой темы — добавь интерфейс в union.
|
|
193
137
|
- **`EButtonTheme` значения** — не переименовывать. Это публичное API.
|
|
194
138
|
- **`EComponentSize`** — общий enum из `src/enums/EComponentSize`, не делай локальный аналог.
|
|
195
|
-
- **Размеры (28px/40px/56px)** — не менять без согласования с дизайнером, другие компоненты ориентируются на эти размеры.
|
|
139
|
+
- **Размеры (28px / 40px / 56px)** — не менять без согласования с дизайнером, другие компоненты ориентируются на эти размеры.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Accessibility
|
|
144
|
+
|
|
145
|
+
- Нативный `<button>` — полная поддержка клавиатуры (Tab, Enter, Space) без дополнительных атрибутов.
|
|
146
|
+
- **`ButtonIcon`**: иконочная кнопка без видимого текста — потребитель **обязан** передать `aria-label` через `...rest`. Библиотека мультиязычная, текст не хардкодится.
|
|
147
|
+
- **`loading`**: устанавливает `tabIndex={-1}` — кнопка исключается из tab-порядка. Если нужна доступность состояния загрузки для скринридеров, потребитель добавляет `aria-busy="true"` через props.
|
|
148
|
+
- **`aria-expanded`**: управляет визуальным состоянием «раскрыто» (добавляет CSS-классы `.expanded`, `.active`). Передаётся потребителем при использовании кнопки как триггера dropdown. Отдельного prop `expanded` нет — используй стандартный HTML-атрибут.
|
|
149
|
+
- Фокус-стиль через `:focus-visible` — виден только при клавиатурной навигации.
|
|
196
150
|
|
|
197
151
|
---
|
|
198
152
|
|
|
@@ -208,7 +162,7 @@ const iconOnly = Boolean(icon) && !children;
|
|
|
208
162
|
|
|
209
163
|
## Stories
|
|
210
164
|
|
|
211
|
-
`stories/Buttons/Button.stories.tsx`
|
|
165
|
+
Основные истории: `stories/Buttons/Button.stories.tsx`
|
|
212
166
|
Файлы примеров: `stories/Buttons/examples/Button/`
|
|
213
167
|
|
|
214
168
|
| Story | Example file | Что демонстрирует |
|
|
@@ -219,7 +173,9 @@ const iconOnly = Boolean(icon) && !children;
|
|
|
219
173
|
| `Sizes` | `SizesExample.tsx` | SM / MD / LG для всех тем |
|
|
220
174
|
| `Themes` | `ThemesExample.tsx` | Все пять тем |
|
|
221
175
|
| `WithIcon` | `WithIconExample.tsx` | Icon-only и text+icon |
|
|
176
|
+
| `WithNotificationIcon` | `WithNotificationIconExample.tsx` | Иконка с индикатором уведомления |
|
|
222
177
|
| `BlockMode` | `BlockModeExample.tsx` | Полноширинный режим |
|
|
178
|
+
| `TextWithIcon` | `TextWithIconExample.tsx` | Текст вместе с иконкой |
|
|
223
179
|
|
|
224
180
|
---
|
|
225
181
|
|
|
@@ -228,3 +184,332 @@ const iconOnly = Boolean(icon) && !children;
|
|
|
228
184
|
| Дата | Изменение |
|
|
229
185
|
|---|---|
|
|
230
186
|
| 2026-03-31 | Создан документ (пилот AI-Ready) |
|
|
187
|
+
| 2026-04-27 | Приведён в соответствие с `docs/ai/template-ai.md`: убраны секции «Файловая структура» и «Ключевые особенности реализации», переструктурированы props, добавлена колонка `Example file` в таблице Stories |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Примеры использования
|
|
192
|
+
|
|
193
|
+
### Default
|
|
194
|
+
|
|
195
|
+
`stories/Buttons/examples/Button/DefaultExample.tsx`
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import React from "react";
|
|
199
|
+
import { Button, EButtonTheme, EComponentSize } from "@sberbusiness/triplex-next";
|
|
200
|
+
|
|
201
|
+
export const DefaultExample = () => (
|
|
202
|
+
<div style={{ maxWidth: "250px" }}>
|
|
203
|
+
<Button theme={EButtonTheme.GENERAL} size={EComponentSize.MD}>
|
|
204
|
+
Button text
|
|
205
|
+
</Button>
|
|
206
|
+
</div>
|
|
207
|
+
);
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### States
|
|
211
|
+
|
|
212
|
+
`stories/Buttons/examples/Button/StatesExample.tsx`
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
import React from "react";
|
|
216
|
+
import { DefaulticonStrokePrdIcon20 } from "@sberbusiness/icons-next";
|
|
217
|
+
import { Button, EButtonTheme, EComponentSize } from "@sberbusiness/triplex-next";
|
|
218
|
+
|
|
219
|
+
export const StatesExample = () => (
|
|
220
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
221
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
|
|
222
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>Expanded</div>
|
|
223
|
+
<div style={{ display: "flex", flexWrap: "wrap", alignItems: "center", gap: 16 }}>
|
|
224
|
+
<Button theme={EButtonTheme.GENERAL} size={EComponentSize.MD} aria-expanded>
|
|
225
|
+
General
|
|
226
|
+
</Button>
|
|
227
|
+
<Button theme={EButtonTheme.SECONDARY} size={EComponentSize.MD} aria-expanded>
|
|
228
|
+
Secondary
|
|
229
|
+
</Button>
|
|
230
|
+
<Button theme={EButtonTheme.SECONDARY_LIGHT} size={EComponentSize.MD} aria-expanded>
|
|
231
|
+
Secondary Light
|
|
232
|
+
</Button>
|
|
233
|
+
<Button theme={EButtonTheme.DANGER} size={EComponentSize.MD} aria-expanded>
|
|
234
|
+
Danger
|
|
235
|
+
</Button>
|
|
236
|
+
<Button
|
|
237
|
+
theme={EButtonTheme.GENERAL}
|
|
238
|
+
size={EComponentSize.MD}
|
|
239
|
+
icon={<DefaulticonStrokePrdIcon20 paletteIndex={7} />}
|
|
240
|
+
aria-expanded
|
|
241
|
+
/>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
|
|
245
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>Loading</div>
|
|
246
|
+
<div style={{ display: "flex", flexWrap: "wrap", alignItems: "center", gap: 16 }}>
|
|
247
|
+
<Button loading theme={EButtonTheme.GENERAL} size={EComponentSize.MD}>
|
|
248
|
+
Button text
|
|
249
|
+
</Button>
|
|
250
|
+
<Button loading theme={EButtonTheme.SECONDARY} size={EComponentSize.MD}>
|
|
251
|
+
Button text
|
|
252
|
+
</Button>
|
|
253
|
+
<Button loading theme={EButtonTheme.SECONDARY_LIGHT} size={EComponentSize.MD}>
|
|
254
|
+
Button text
|
|
255
|
+
</Button>
|
|
256
|
+
<Button loading theme={EButtonTheme.DANGER} size={EComponentSize.MD}>
|
|
257
|
+
Button text
|
|
258
|
+
</Button>
|
|
259
|
+
<Button
|
|
260
|
+
loading
|
|
261
|
+
icon={<DefaulticonStrokePrdIcon20 paletteIndex={0} />}
|
|
262
|
+
size={EComponentSize.MD}
|
|
263
|
+
theme={EButtonTheme.GENERAL}
|
|
264
|
+
/>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
|
|
268
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>Disabled</div>
|
|
269
|
+
<div style={{ display: "flex", flexWrap: "wrap", alignItems: "center", gap: 16 }}>
|
|
270
|
+
<Button disabled theme={EButtonTheme.GENERAL} size={EComponentSize.MD}>
|
|
271
|
+
General
|
|
272
|
+
</Button>
|
|
273
|
+
<Button disabled theme={EButtonTheme.SECONDARY} size={EComponentSize.MD}>
|
|
274
|
+
Secondary
|
|
275
|
+
</Button>
|
|
276
|
+
<Button disabled theme={EButtonTheme.SECONDARY_LIGHT} size={EComponentSize.MD}>
|
|
277
|
+
Secondary Light
|
|
278
|
+
</Button>
|
|
279
|
+
<Button disabled theme={EButtonTheme.DANGER} size={EComponentSize.MD}>
|
|
280
|
+
Danger
|
|
281
|
+
</Button>
|
|
282
|
+
<Button disabled theme={EButtonTheme.LINK} size={EComponentSize.MD}>
|
|
283
|
+
Link
|
|
284
|
+
</Button>
|
|
285
|
+
<Button
|
|
286
|
+
icon={<DefaulticonStrokePrdIcon20 paletteIndex={7} />}
|
|
287
|
+
size={EComponentSize.MD}
|
|
288
|
+
theme={EButtonTheme.GENERAL}
|
|
289
|
+
disabled
|
|
290
|
+
/>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
);
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Sizes
|
|
298
|
+
|
|
299
|
+
`stories/Buttons/examples/Button/SizesExample.tsx`
|
|
300
|
+
|
|
301
|
+
```tsx
|
|
302
|
+
import React from "react";
|
|
303
|
+
import { Button, EButtonTheme, EComponentSize } from "@sberbusiness/triplex-next";
|
|
304
|
+
|
|
305
|
+
export const SizesExample = () => (
|
|
306
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
307
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
|
|
308
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>SM</div>
|
|
309
|
+
<div style={{ display: "flex", flexWrap: "wrap", alignItems: "center", gap: 16 }}>
|
|
310
|
+
<Button size={EComponentSize.SM} theme={EButtonTheme.GENERAL}>
|
|
311
|
+
Button text
|
|
312
|
+
</Button>
|
|
313
|
+
<Button size={EComponentSize.SM} theme={EButtonTheme.SECONDARY}>
|
|
314
|
+
Button text
|
|
315
|
+
</Button>
|
|
316
|
+
<Button size={EComponentSize.SM} theme={EButtonTheme.SECONDARY_LIGHT}>
|
|
317
|
+
Button text
|
|
318
|
+
</Button>
|
|
319
|
+
<Button size={EComponentSize.SM} theme={EButtonTheme.DANGER}>
|
|
320
|
+
Button text
|
|
321
|
+
</Button>
|
|
322
|
+
<Button size={EComponentSize.SM} theme={EButtonTheme.LINK}>
|
|
323
|
+
Button text
|
|
324
|
+
</Button>
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
|
|
328
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>MD</div>
|
|
329
|
+
<div style={{ display: "flex", flexWrap: "wrap", alignItems: "center", gap: 16 }}>
|
|
330
|
+
<Button size={EComponentSize.MD} theme={EButtonTheme.GENERAL}>
|
|
331
|
+
Button text
|
|
332
|
+
</Button>
|
|
333
|
+
<Button size={EComponentSize.MD} theme={EButtonTheme.SECONDARY}>
|
|
334
|
+
Button text
|
|
335
|
+
</Button>
|
|
336
|
+
<Button size={EComponentSize.MD} theme={EButtonTheme.SECONDARY_LIGHT}>
|
|
337
|
+
Button text
|
|
338
|
+
</Button>
|
|
339
|
+
<Button size={EComponentSize.MD} theme={EButtonTheme.DANGER}>
|
|
340
|
+
Button text
|
|
341
|
+
</Button>
|
|
342
|
+
<Button size={EComponentSize.MD} theme={EButtonTheme.LINK}>
|
|
343
|
+
Button text
|
|
344
|
+
</Button>
|
|
345
|
+
</div>
|
|
346
|
+
</div>
|
|
347
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}>
|
|
348
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>LG</div>
|
|
349
|
+
<div style={{ display: "flex", flexWrap: "wrap", alignItems: "center", gap: 16 }}>
|
|
350
|
+
<Button size={EComponentSize.LG} theme={EButtonTheme.GENERAL}>
|
|
351
|
+
Button text
|
|
352
|
+
</Button>
|
|
353
|
+
<Button size={EComponentSize.LG} theme={EButtonTheme.SECONDARY}>
|
|
354
|
+
Button text
|
|
355
|
+
</Button>
|
|
356
|
+
<Button size={EComponentSize.LG} theme={EButtonTheme.SECONDARY_LIGHT}>
|
|
357
|
+
Button text
|
|
358
|
+
</Button>
|
|
359
|
+
<Button size={EComponentSize.LG} theme={EButtonTheme.DANGER}>
|
|
360
|
+
Button text
|
|
361
|
+
</Button>
|
|
362
|
+
<Button size={EComponentSize.LG} theme={EButtonTheme.LINK}>
|
|
363
|
+
Button text
|
|
364
|
+
</Button>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
);
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### Themes
|
|
372
|
+
|
|
373
|
+
`stories/Buttons/examples/Button/ThemesExample.tsx`
|
|
374
|
+
|
|
375
|
+
```tsx
|
|
376
|
+
import React from "react";
|
|
377
|
+
import { Button, EButtonTheme, EComponentSize } from "@sberbusiness/triplex-next";
|
|
378
|
+
|
|
379
|
+
export const ThemesExample = () => (
|
|
380
|
+
<div style={{ display: "flex", flexWrap: "wrap", alignItems: "center", gap: 16 }}>
|
|
381
|
+
<Button theme={EButtonTheme.GENERAL} size={EComponentSize.MD}>
|
|
382
|
+
General
|
|
383
|
+
</Button>
|
|
384
|
+
<Button theme={EButtonTheme.SECONDARY} size={EComponentSize.MD}>
|
|
385
|
+
Secondary
|
|
386
|
+
</Button>
|
|
387
|
+
<Button theme={EButtonTheme.SECONDARY_LIGHT} size={EComponentSize.MD}>
|
|
388
|
+
Secondary Light
|
|
389
|
+
</Button>
|
|
390
|
+
<Button theme={EButtonTheme.DANGER} size={EComponentSize.MD}>
|
|
391
|
+
Danger
|
|
392
|
+
</Button>
|
|
393
|
+
<Button theme={EButtonTheme.LINK} size={EComponentSize.MD}>
|
|
394
|
+
Link
|
|
395
|
+
</Button>
|
|
396
|
+
</div>
|
|
397
|
+
);
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### WithIcon
|
|
401
|
+
|
|
402
|
+
`stories/Buttons/examples/Button/WithIconExample.tsx`
|
|
403
|
+
|
|
404
|
+
```tsx
|
|
405
|
+
import React from "react";
|
|
406
|
+
import { DefaulticonStrokePrdIcon20, DefaulticonStrokePrdIcon32 } from "@sberbusiness/icons-next";
|
|
407
|
+
import { Button, EButtonTheme, EComponentSize } from "@sberbusiness/triplex-next";
|
|
408
|
+
|
|
409
|
+
export const WithIconExample = () => (
|
|
410
|
+
<div style={{ display: "flex", alignItems: "center", gap: 16 }}>
|
|
411
|
+
<Button
|
|
412
|
+
icon={<DefaulticonStrokePrdIcon20 paletteIndex={7} />}
|
|
413
|
+
size={EComponentSize.SM}
|
|
414
|
+
theme={EButtonTheme.GENERAL}
|
|
415
|
+
/>
|
|
416
|
+
<Button
|
|
417
|
+
icon={<DefaulticonStrokePrdIcon20 paletteIndex={0} />}
|
|
418
|
+
size={EComponentSize.MD}
|
|
419
|
+
theme={EButtonTheme.SECONDARY}
|
|
420
|
+
/>
|
|
421
|
+
<Button
|
|
422
|
+
icon={<DefaulticonStrokePrdIcon20 paletteIndex={0} />}
|
|
423
|
+
size={EComponentSize.MD}
|
|
424
|
+
theme={EButtonTheme.SECONDARY_LIGHT}
|
|
425
|
+
/>
|
|
426
|
+
<Button
|
|
427
|
+
icon={<DefaulticonStrokePrdIcon32 paletteIndex={7} />}
|
|
428
|
+
size={EComponentSize.LG}
|
|
429
|
+
theme={EButtonTheme.DANGER}
|
|
430
|
+
/>
|
|
431
|
+
</div>
|
|
432
|
+
);
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### WithNotificationIcon
|
|
436
|
+
|
|
437
|
+
`stories/Buttons/examples/Button/WithNotificationIconExample.tsx`
|
|
438
|
+
|
|
439
|
+
```tsx
|
|
440
|
+
import React from "react";
|
|
441
|
+
import { Badge, Button, EButtonTheme, EComponentSize } from "@sberbusiness/triplex-next";
|
|
442
|
+
import { BellStrokeNavIcon20 } from "@sberbusiness/icons-next";
|
|
443
|
+
|
|
444
|
+
export const WithNotificationIconExample = () => (
|
|
445
|
+
<div style={{ position: "relative", display: "inline-flex" }}>
|
|
446
|
+
<Button
|
|
447
|
+
icon={<BellStrokeNavIcon20 paletteIndex={0} />}
|
|
448
|
+
size={EComponentSize.MD}
|
|
449
|
+
theme={EButtonTheme.SECONDARY}
|
|
450
|
+
/>
|
|
451
|
+
<Badge.Dot size={EComponentSize.MD} style={{ position: "absolute", top: 4, right: 4 }} />
|
|
452
|
+
</div>
|
|
453
|
+
);
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### BlockMode
|
|
457
|
+
|
|
458
|
+
`stories/Buttons/examples/Button/BlockModeExample.tsx`
|
|
459
|
+
|
|
460
|
+
```tsx
|
|
461
|
+
import React from "react";
|
|
462
|
+
import { DefaulticonStrokePrdIcon20 } from "@sberbusiness/icons-next";
|
|
463
|
+
import { Button, EButtonTheme, EComponentSize, Gap } from "@sberbusiness/triplex-next";
|
|
464
|
+
|
|
465
|
+
export const BlockModeExample = () => (
|
|
466
|
+
<div style={{ maxWidth: 280 }}>
|
|
467
|
+
<Button block theme={EButtonTheme.GENERAL} size={EComponentSize.MD}>
|
|
468
|
+
General
|
|
469
|
+
</Button>
|
|
470
|
+
<Gap size={16} />
|
|
471
|
+
<Button block theme={EButtonTheme.SECONDARY} size={EComponentSize.MD}>
|
|
472
|
+
Secondary
|
|
473
|
+
</Button>
|
|
474
|
+
<Gap size={16} />
|
|
475
|
+
<Button block theme={EButtonTheme.SECONDARY_LIGHT} size={EComponentSize.MD}>
|
|
476
|
+
Secondary Light
|
|
477
|
+
</Button>
|
|
478
|
+
<Gap size={16} />
|
|
479
|
+
<Button
|
|
480
|
+
block
|
|
481
|
+
size={EComponentSize.MD}
|
|
482
|
+
theme={EButtonTheme.DANGER}
|
|
483
|
+
icon={<DefaulticonStrokePrdIcon20 paletteIndex={7} />}
|
|
484
|
+
/>
|
|
485
|
+
</div>
|
|
486
|
+
);
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### TextWithIcon
|
|
490
|
+
|
|
491
|
+
`stories/Buttons/examples/Button/TextWithIconExample.tsx`
|
|
492
|
+
|
|
493
|
+
```tsx
|
|
494
|
+
import React from "react";
|
|
495
|
+
import { DefaulticonStrokePrdIcon16, DefaulticonStrokePrdIcon20 } from "@sberbusiness/icons-next";
|
|
496
|
+
import { Button, EButtonTheme, EComponentSize } from "@sberbusiness/triplex-next";
|
|
497
|
+
|
|
498
|
+
export const TextWithIconExample = () => (
|
|
499
|
+
<div style={{ display: "flex", alignItems: "flex-start", gap: 16 }}>
|
|
500
|
+
<Button theme={EButtonTheme.LINK} size={EComponentSize.SM}>
|
|
501
|
+
<DefaulticonStrokePrdIcon16 paletteIndex={5} />
|
|
502
|
+
<span style={{ marginLeft: 8 }}>Button text</span>
|
|
503
|
+
</Button>
|
|
504
|
+
<Button theme={EButtonTheme.LINK} size={EComponentSize.MD}>
|
|
505
|
+
<DefaulticonStrokePrdIcon20 paletteIndex={5} />
|
|
506
|
+
<span style={{ marginLeft: 8 }}>Button text</span>
|
|
507
|
+
</Button>
|
|
508
|
+
<Button theme={EButtonTheme.LINK} size={EComponentSize.LG}>
|
|
509
|
+
<DefaulticonStrokePrdIcon20 paletteIndex={5} />
|
|
510
|
+
<span style={{ marginLeft: 8 }}>Button text</span>
|
|
511
|
+
</Button>
|
|
512
|
+
</div>
|
|
513
|
+
);
|
|
514
|
+
```
|
|
515
|
+
|