@sberbusiness/triplex-next-mcp-server 0.24.0-beta1 → 0.24.0-beta2
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/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/Button.md +280 -0
- package/bundle/components/ButtonDropdown.md +300 -0
- package/bundle/components/ButtonIcon.md +69 -0
- package/bundle/components/Calendar.md +58 -0
- package/bundle/components/Checkbox.md +112 -0
- package/bundle/components/CheckboxTree.md +61 -0
- package/bundle/components/CheckboxTreeExtended.md +114 -0
- package/bundle/components/CheckboxXGroup.md +41 -0
- package/bundle/components/CheckboxYGroup.md +45 -0
- package/bundle/components/EmptyView.md +119 -0
- package/bundle/components/HelpBox.md +198 -0
- package/bundle/components/SliderExtended.md +285 -0
- package/bundle/manifest.json +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -319,3 +319,117 @@ margin). Кандидат на токенизацию.
|
|
|
319
319
|
| Дата | Изменение |
|
|
320
320
|
|---|---|
|
|
321
321
|
| 2026-04-18 | Создан документ |
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Примеры использования
|
|
326
|
+
|
|
327
|
+
### Default
|
|
328
|
+
|
|
329
|
+
`stories/CheckboxTreeExtended/examples/DefaultExample.tsx`
|
|
330
|
+
|
|
331
|
+
```tsx
|
|
332
|
+
import React from "react";
|
|
333
|
+
import { CheckboxTreeExtended, EComponentSize } from "@sberbusiness/triplex-next";
|
|
334
|
+
|
|
335
|
+
type CheckboxNode = { id: string; label: string; checked: boolean; bulk?: boolean; children?: CheckboxNode[] };
|
|
336
|
+
|
|
337
|
+
const INITIAL: CheckboxNode[] = [
|
|
338
|
+
{ id: "1", label: "Группа 1", checked: false, children: [{ id: "1-1", label: "Значение 1-1", checked: false }] },
|
|
339
|
+
{ id: "2", label: "Группа 2", checked: false },
|
|
340
|
+
];
|
|
341
|
+
|
|
342
|
+
export const DefaultExample = ({ size = EComponentSize.MD }: { size?: EComponentSize }) => {
|
|
343
|
+
const [checkboxes, setCheckboxes] = React.useState<CheckboxNode[]>(INITIAL);
|
|
344
|
+
|
|
345
|
+
const onChange = (target: CheckboxNode) => (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
346
|
+
target.checked = event.target.checked;
|
|
347
|
+
setCheckboxes([...checkboxes]);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const renderNode = (node: CheckboxNode) => (
|
|
351
|
+
<CheckboxTreeExtended.Node
|
|
352
|
+
id={node.id}
|
|
353
|
+
key={node.id}
|
|
354
|
+
checkbox={(props) => (
|
|
355
|
+
<CheckboxTreeExtended.Checkbox
|
|
356
|
+
{...props}
|
|
357
|
+
onChange={onChange(node)}
|
|
358
|
+
bulk={node.bulk}
|
|
359
|
+
checked={node.checked}
|
|
360
|
+
>
|
|
361
|
+
{node.label}
|
|
362
|
+
</CheckboxTreeExtended.Checkbox>
|
|
363
|
+
)}
|
|
364
|
+
>
|
|
365
|
+
{node.children?.map((child) => renderNode(child))}
|
|
366
|
+
</CheckboxTreeExtended.Node>
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
return <CheckboxTreeExtended size={size}>{checkboxes.map((node) => renderNode(node))}</CheckboxTreeExtended>;
|
|
370
|
+
};
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Sizes
|
|
374
|
+
|
|
375
|
+
`stories/CheckboxTreeExtended/examples/SizesExample.tsx`
|
|
376
|
+
|
|
377
|
+
```tsx
|
|
378
|
+
import React from "react";
|
|
379
|
+
import { CheckboxTreeExtended, Col, EComponentSize, Row } from "@sberbusiness/triplex-next";
|
|
380
|
+
|
|
381
|
+
type CheckboxNode = { id: string; label: string; checked: boolean; bulk?: boolean; children?: CheckboxNode[] };
|
|
382
|
+
|
|
383
|
+
const INITIAL: CheckboxNode[] = [
|
|
384
|
+
{ id: "1", label: "Группа 1", checked: false, children: [{ id: "1-1", label: "Значение 1-1", checked: false }] },
|
|
385
|
+
{ id: "2", label: "Группа 2", checked: false },
|
|
386
|
+
];
|
|
387
|
+
|
|
388
|
+
const TreeBySize = ({ size = EComponentSize.MD }: { size?: EComponentSize }) => {
|
|
389
|
+
const [checkboxes, setCheckboxes] = React.useState<CheckboxNode[]>(INITIAL);
|
|
390
|
+
|
|
391
|
+
const onChange = (target: CheckboxNode) => (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
392
|
+
target.checked = event.target.checked;
|
|
393
|
+
setCheckboxes([...checkboxes]);
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const renderNode = (node: CheckboxNode) => (
|
|
397
|
+
<CheckboxTreeExtended.Node
|
|
398
|
+
id={node.id}
|
|
399
|
+
key={node.id}
|
|
400
|
+
checkbox={(props) => (
|
|
401
|
+
<CheckboxTreeExtended.Checkbox
|
|
402
|
+
{...props}
|
|
403
|
+
onChange={onChange(node)}
|
|
404
|
+
bulk={node.bulk}
|
|
405
|
+
checked={node.checked}
|
|
406
|
+
>
|
|
407
|
+
{node.label}
|
|
408
|
+
</CheckboxTreeExtended.Checkbox>
|
|
409
|
+
)}
|
|
410
|
+
>
|
|
411
|
+
{node.children?.map((child) => renderNode(child))}
|
|
412
|
+
</CheckboxTreeExtended.Node>
|
|
413
|
+
);
|
|
414
|
+
|
|
415
|
+
return <CheckboxTreeExtended size={size}>{checkboxes.map((node) => renderNode(node))}</CheckboxTreeExtended>;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
export const SizesExample = () => (
|
|
419
|
+
<Row>
|
|
420
|
+
<Col size={4}>
|
|
421
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>SM</div>
|
|
422
|
+
<TreeBySize size={EComponentSize.SM} />
|
|
423
|
+
</Col>
|
|
424
|
+
<Col size={4}>
|
|
425
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>MD</div>
|
|
426
|
+
<TreeBySize size={EComponentSize.MD} />
|
|
427
|
+
</Col>
|
|
428
|
+
<Col size={4}>
|
|
429
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>LG</div>
|
|
430
|
+
<TreeBySize size={EComponentSize.LG} />
|
|
431
|
+
</Col>
|
|
432
|
+
</Row>
|
|
433
|
+
);
|
|
434
|
+
```
|
|
435
|
+
|
|
@@ -66,3 +66,44 @@ version: "1.0"
|
|
|
66
66
|
|---|---|
|
|
67
67
|
| 2026-04-16 | Приведение `CheckboxXGroup` к AI-ready: добавлен `forwardRef`, типизирован `children`, созданы AI-документ и инварианты. |
|
|
68
68
|
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Примеры использования
|
|
72
|
+
|
|
73
|
+
### XGroup
|
|
74
|
+
|
|
75
|
+
`stories/Checkbox/examples/XGroupExample.tsx`
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import React from "react";
|
|
79
|
+
import { Checkbox, CheckboxXGroup, EComponentSize, Gap } from "@sberbusiness/triplex-next";
|
|
80
|
+
|
|
81
|
+
export const XGroupExample = () => (
|
|
82
|
+
<>
|
|
83
|
+
<CheckboxXGroup indent={16}>
|
|
84
|
+
{[1, 2, 3].map((value) => (
|
|
85
|
+
<Checkbox key={value} name="checkbox-x-group" value={value} size={EComponentSize.SM}>
|
|
86
|
+
Checkbox text
|
|
87
|
+
</Checkbox>
|
|
88
|
+
))}
|
|
89
|
+
</CheckboxXGroup>
|
|
90
|
+
<Gap size={16} />
|
|
91
|
+
<CheckboxXGroup indent={16}>
|
|
92
|
+
{[1, 2, 3].map((value) => (
|
|
93
|
+
<Checkbox key={value} name="checkbox-x-group" value={value}>
|
|
94
|
+
Checkbox text
|
|
95
|
+
</Checkbox>
|
|
96
|
+
))}
|
|
97
|
+
</CheckboxXGroup>
|
|
98
|
+
<Gap size={16} />
|
|
99
|
+
<CheckboxXGroup indent={20}>
|
|
100
|
+
{[1, 2, 3].map((value) => (
|
|
101
|
+
<Checkbox key={value} name="checkbox-x-group" value={value} size={EComponentSize.LG}>
|
|
102
|
+
Checkbox text
|
|
103
|
+
</Checkbox>
|
|
104
|
+
))}
|
|
105
|
+
</CheckboxXGroup>
|
|
106
|
+
</>
|
|
107
|
+
);
|
|
108
|
+
```
|
|
109
|
+
|
|
@@ -65,3 +65,48 @@ version: "1.0"
|
|
|
65
65
|
|---|---|
|
|
66
66
|
| 2026-04-16 | Приведение `CheckboxYGroup` к AI-ready: добавлен `forwardRef`, типизирован `children`, созданы AI-документ и инварианты. |
|
|
67
67
|
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Примеры использования
|
|
71
|
+
|
|
72
|
+
### YGroup
|
|
73
|
+
|
|
74
|
+
`stories/Checkbox/examples/YGroupExample.tsx`
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import React from "react";
|
|
78
|
+
import { Checkbox, CheckboxYGroup, Col, EComponentSize, Row } from "@sberbusiness/triplex-next";
|
|
79
|
+
|
|
80
|
+
export const YGroupExample = () => (
|
|
81
|
+
<Row>
|
|
82
|
+
<Col size={3}>
|
|
83
|
+
<CheckboxYGroup aria-labelledby="checkbox-y-group-label">
|
|
84
|
+
{[1, 2, 3, 4].map((value) => (
|
|
85
|
+
<Checkbox key={value} name="checkbox-y-group" value={value} size={EComponentSize.SM}>
|
|
86
|
+
Checkbox text
|
|
87
|
+
</Checkbox>
|
|
88
|
+
))}
|
|
89
|
+
</CheckboxYGroup>
|
|
90
|
+
</Col>
|
|
91
|
+
<Col size={3}>
|
|
92
|
+
<CheckboxYGroup aria-labelledby="checkbox-y-group-label">
|
|
93
|
+
{[1, 2, 3, 4].map((value) => (
|
|
94
|
+
<Checkbox key={value} name="checkbox-y-group" value={value}>
|
|
95
|
+
Checkbox text
|
|
96
|
+
</Checkbox>
|
|
97
|
+
))}
|
|
98
|
+
</CheckboxYGroup>
|
|
99
|
+
</Col>
|
|
100
|
+
<Col size={3}>
|
|
101
|
+
<CheckboxYGroup aria-labelledby="checkbox-y-group-label">
|
|
102
|
+
{[1, 2, 3, 4].map((value) => (
|
|
103
|
+
<Checkbox key={value} name="checkbox-y-group" value={value} size={EComponentSize.LG}>
|
|
104
|
+
Checkbox text
|
|
105
|
+
</Checkbox>
|
|
106
|
+
))}
|
|
107
|
+
</CheckboxYGroup>
|
|
108
|
+
</Col>
|
|
109
|
+
</Row>
|
|
110
|
+
);
|
|
111
|
+
```
|
|
112
|
+
|
|
@@ -97,3 +97,122 @@ version: "1.0"
|
|
|
97
97
|
| Дата | Изменение |
|
|
98
98
|
|---|---|
|
|
99
99
|
| 2026-04-09 | Создан компонент и документ |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Примеры использования
|
|
104
|
+
|
|
105
|
+
### Default
|
|
106
|
+
|
|
107
|
+
`stories/EmptyView/examples/DefaultExample.tsx`
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import React from "react";
|
|
111
|
+
import { EmptyView, EEmptyViewSize } from "@sberbusiness/triplex-next";
|
|
112
|
+
import ServicesetupSysIcon96 from "@sberbusiness/icons-next/WaitgradientStsIcon96";
|
|
113
|
+
|
|
114
|
+
export const DefaultExample = () => (
|
|
115
|
+
<div style={{ maxWidth: "380px" }}>
|
|
116
|
+
<EmptyView
|
|
117
|
+
size={EEmptyViewSize.SM}
|
|
118
|
+
icon={<ServicesetupSysIcon96 />}
|
|
119
|
+
title="Title text"
|
|
120
|
+
description="This message provides additional context or highlights important information to note."
|
|
121
|
+
caption="Caption"
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Sizes
|
|
128
|
+
|
|
129
|
+
`stories/EmptyView/examples/SizesExample.tsx`
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import React from "react";
|
|
133
|
+
import { EmptyView, EEmptyViewSize } from "@sberbusiness/triplex-next";
|
|
134
|
+
import { ServicesetupSysIcon96, ServicesetupSysIcon128 } from "@sberbusiness/icons-next";
|
|
135
|
+
|
|
136
|
+
export const SizesExample = () => (
|
|
137
|
+
<div style={{ display: "flex", gap: "48px", flexWrap: "wrap" }}>
|
|
138
|
+
<div>
|
|
139
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>SM</div>
|
|
140
|
+
<div style={{ maxWidth: "380px" }}>
|
|
141
|
+
<EmptyView
|
|
142
|
+
size={EEmptyViewSize.SM}
|
|
143
|
+
icon={<ServicesetupSysIcon96 />}
|
|
144
|
+
title="Title text"
|
|
145
|
+
description="This message provides additional context or highlights important information to note."
|
|
146
|
+
caption="Caption"
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
<div>
|
|
151
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>MD</div>
|
|
152
|
+
<div style={{ maxWidth: "380px" }}>
|
|
153
|
+
<EmptyView
|
|
154
|
+
size={EEmptyViewSize.MD}
|
|
155
|
+
icon={<ServicesetupSysIcon128 />}
|
|
156
|
+
title="Title text"
|
|
157
|
+
description="This message provides additional context or highlights important information to note."
|
|
158
|
+
caption="Caption"
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### WithoutTitle
|
|
167
|
+
|
|
168
|
+
`stories/EmptyView/examples/WithoutTitleExample.tsx`
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
import React from "react";
|
|
172
|
+
import { EmptyView, EEmptyViewSize } from "@sberbusiness/triplex-next";
|
|
173
|
+
import { ServicesetupSysIcon96 } from "@sberbusiness/icons-next";
|
|
174
|
+
|
|
175
|
+
export const WithoutTitleExample = () => (
|
|
176
|
+
<div style={{ maxWidth: "380px" }}>
|
|
177
|
+
<EmptyView
|
|
178
|
+
size={EEmptyViewSize.SM}
|
|
179
|
+
icon={<ServicesetupSysIcon96 />}
|
|
180
|
+
description="This message provides additional context or highlights important information to note."
|
|
181
|
+
caption="Caption"
|
|
182
|
+
/>
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### WithButtons
|
|
188
|
+
|
|
189
|
+
`stories/EmptyView/examples/WithButtonsExample.tsx`
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
import React from "react";
|
|
193
|
+
import { EmptyView, EEmptyViewSize, Button, EButtonTheme, EComponentSize } from "@sberbusiness/triplex-next";
|
|
194
|
+
import { ServicesetupSysIcon96 } from "@sberbusiness/icons-next";
|
|
195
|
+
|
|
196
|
+
export const WithButtonsExample = () => (
|
|
197
|
+
<div style={{ maxWidth: "380px" }}>
|
|
198
|
+
<EmptyView
|
|
199
|
+
size={EEmptyViewSize.SM}
|
|
200
|
+
icon={<ServicesetupSysIcon96 />}
|
|
201
|
+
title="Title text"
|
|
202
|
+
description="This message provides additional context or highlights important information to note."
|
|
203
|
+
caption="Caption"
|
|
204
|
+
buttons={
|
|
205
|
+
<>
|
|
206
|
+
<Button theme={EButtonTheme.SECONDARY} size={EComponentSize.SM}>
|
|
207
|
+
Button text
|
|
208
|
+
</Button>
|
|
209
|
+
<Button theme={EButtonTheme.GENERAL} size={EComponentSize.SM}>
|
|
210
|
+
Button text
|
|
211
|
+
</Button>
|
|
212
|
+
</>
|
|
213
|
+
}
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
```
|
|
218
|
+
|
|
@@ -152,3 +152,201 @@ HelpBox — обёртка над несколькими внутренними
|
|
|
152
152
|
| Дата | Изменение |
|
|
153
153
|
|---|---|
|
|
154
154
|
| 2026-04-08 | Создан документ. Добавлен `forwardRef`. |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Примеры использования
|
|
159
|
+
|
|
160
|
+
### Default
|
|
161
|
+
|
|
162
|
+
`stories/HelpBox/examples/DefaultExample.tsx`
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import React from "react";
|
|
166
|
+
import { HelpBox, ETooltipSize } from "@sberbusiness/triplex-next";
|
|
167
|
+
|
|
168
|
+
export const DefaultExample = () => (
|
|
169
|
+
<div style={{ padding: 50 }}>
|
|
170
|
+
<HelpBox tooltipSize={ETooltipSize.SM} aria-label="Подсказка" tooltipXButtonProps={{ "aria-label": "Закрыть" }}>
|
|
171
|
+
Подсказка по элементу интерфейса
|
|
172
|
+
</HelpBox>
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Sizes
|
|
178
|
+
|
|
179
|
+
`stories/HelpBox/examples/SizesExample.tsx`
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
import React from "react";
|
|
183
|
+
import { HelpBox, ETooltipSize, ETooltipPreferPlace } from "@sberbusiness/triplex-next";
|
|
184
|
+
|
|
185
|
+
export const SizesExample = () => (
|
|
186
|
+
<div style={{ padding: 50, display: "flex", gap: 100 }}>
|
|
187
|
+
<div>
|
|
188
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>SM</div>
|
|
189
|
+
<HelpBox
|
|
190
|
+
tooltipSize={ETooltipSize.SM}
|
|
191
|
+
preferPlace={ETooltipPreferPlace.ABOVE}
|
|
192
|
+
aria-label="Подсказка"
|
|
193
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
194
|
+
>
|
|
195
|
+
SM
|
|
196
|
+
</HelpBox>
|
|
197
|
+
</div>
|
|
198
|
+
<div>
|
|
199
|
+
<div style={{ marginBottom: "8px", fontSize: "16px", fontWeight: "700" }}>LG</div>
|
|
200
|
+
<HelpBox
|
|
201
|
+
tooltipSize={ETooltipSize.LG}
|
|
202
|
+
preferPlace={ETooltipPreferPlace.BELOW}
|
|
203
|
+
aria-label="Подсказка"
|
|
204
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
205
|
+
>
|
|
206
|
+
LG
|
|
207
|
+
</HelpBox>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Placement
|
|
214
|
+
|
|
215
|
+
`stories/HelpBox/examples/PlacementExample.tsx`
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
import React from "react";
|
|
219
|
+
import { HelpBox, ETooltipSize, ETooltipPreferPlace } from "@sberbusiness/triplex-next";
|
|
220
|
+
|
|
221
|
+
export const PlacementExample = () => (
|
|
222
|
+
<div style={{ padding: 50, display: "grid", gridTemplateColumns: "repeat(2, minmax(120px, 1fr))", gap: 32 }}>
|
|
223
|
+
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
|
|
224
|
+
<span style={{ width: 150 }}>above</span>
|
|
225
|
+
<HelpBox
|
|
226
|
+
tooltipSize={ETooltipSize.SM}
|
|
227
|
+
preferPlace={ETooltipPreferPlace.ABOVE}
|
|
228
|
+
aria-label="Подсказка"
|
|
229
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
230
|
+
>
|
|
231
|
+
Подсказка сверху
|
|
232
|
+
</HelpBox>
|
|
233
|
+
</div>
|
|
234
|
+
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
|
|
235
|
+
<span style={{ width: 150 }}>below</span>
|
|
236
|
+
<HelpBox
|
|
237
|
+
tooltipSize={ETooltipSize.SM}
|
|
238
|
+
preferPlace={ETooltipPreferPlace.BELOW}
|
|
239
|
+
aria-label="Подсказка"
|
|
240
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
241
|
+
>
|
|
242
|
+
Подсказка снизу
|
|
243
|
+
</HelpBox>
|
|
244
|
+
</div>
|
|
245
|
+
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
|
|
246
|
+
<span style={{ width: 150 }}>left</span>
|
|
247
|
+
<HelpBox
|
|
248
|
+
tooltipSize={ETooltipSize.SM}
|
|
249
|
+
preferPlace={ETooltipPreferPlace.LEFT}
|
|
250
|
+
aria-label="Подсказка"
|
|
251
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
252
|
+
>
|
|
253
|
+
Подсказка слева
|
|
254
|
+
</HelpBox>
|
|
255
|
+
</div>
|
|
256
|
+
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
|
|
257
|
+
<span style={{ width: 150 }}>right</span>
|
|
258
|
+
<HelpBox
|
|
259
|
+
tooltipSize={ETooltipSize.SM}
|
|
260
|
+
preferPlace={ETooltipPreferPlace.RIGHT}
|
|
261
|
+
aria-label="Подсказка"
|
|
262
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
263
|
+
>
|
|
264
|
+
Подсказка справа
|
|
265
|
+
</HelpBox>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### WithMobileHeader
|
|
272
|
+
|
|
273
|
+
`stories/HelpBox/examples/WithMobileHeaderExample.tsx`
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
import React from "react";
|
|
277
|
+
import { HelpBox, ETooltipSize } from "@sberbusiness/triplex-next";
|
|
278
|
+
|
|
279
|
+
export const WithMobileHeaderExample = () => (
|
|
280
|
+
<div style={{ padding: 50 }}>
|
|
281
|
+
<HelpBox
|
|
282
|
+
tooltipSize={ETooltipSize.SM}
|
|
283
|
+
mobileHeaderContent="Заголовок"
|
|
284
|
+
aria-label="Подсказка"
|
|
285
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
286
|
+
>
|
|
287
|
+
Текст подсказки
|
|
288
|
+
</HelpBox>
|
|
289
|
+
</div>
|
|
290
|
+
);
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Controlled
|
|
294
|
+
|
|
295
|
+
`stories/HelpBox/examples/ControlledExample.tsx`
|
|
296
|
+
|
|
297
|
+
```tsx
|
|
298
|
+
import React, { useState } from "react";
|
|
299
|
+
import { HelpBox, ETooltipSize, ETooltipPreferPlace } from "@sberbusiness/triplex-next";
|
|
300
|
+
|
|
301
|
+
export const ControlledExample = () => {
|
|
302
|
+
const [open, setOpen] = useState(false);
|
|
303
|
+
|
|
304
|
+
const handleToggle = (nextOpen: boolean) => setOpen(nextOpen);
|
|
305
|
+
const handleManualOpen = () => setOpen(true);
|
|
306
|
+
const handleManualClose = () => setOpen(false);
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<div style={{ padding: 40, display: "flex", alignItems: "center", gap: 16 }}>
|
|
310
|
+
<button type="button" onClick={handleManualOpen}>
|
|
311
|
+
Открыть
|
|
312
|
+
</button>
|
|
313
|
+
<button type="button" onClick={handleManualClose}>
|
|
314
|
+
Закрыть
|
|
315
|
+
</button>
|
|
316
|
+
<HelpBox
|
|
317
|
+
tooltipSize={ETooltipSize.SM}
|
|
318
|
+
preferPlace={ETooltipPreferPlace.RIGHT}
|
|
319
|
+
isOpen={open}
|
|
320
|
+
toggle={handleToggle}
|
|
321
|
+
aria-label="Подсказка"
|
|
322
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
323
|
+
>
|
|
324
|
+
Управляемое состояние тултипа
|
|
325
|
+
</HelpBox>
|
|
326
|
+
</div>
|
|
327
|
+
);
|
|
328
|
+
};
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### ChangeIconProps
|
|
332
|
+
|
|
333
|
+
`stories/HelpBox/examples/ChangeIconPropsExample.tsx`
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
import React from "react";
|
|
337
|
+
import { HelpBox, ETooltipSize } from "@sberbusiness/triplex-next";
|
|
338
|
+
|
|
339
|
+
export const ChangeIconPropsExample = () => (
|
|
340
|
+
<div style={{ padding: 50 }}>
|
|
341
|
+
<HelpBox
|
|
342
|
+
tooltipSize={ETooltipSize.SM}
|
|
343
|
+
iconProps={{ paletteIndex: 0 }}
|
|
344
|
+
aria-label="Подсказка"
|
|
345
|
+
tooltipXButtonProps={{ "aria-label": "Закрыть" }}
|
|
346
|
+
>
|
|
347
|
+
Подсказка по элементу интерфейса
|
|
348
|
+
</HelpBox>
|
|
349
|
+
</div>
|
|
350
|
+
);
|
|
351
|
+
```
|
|
352
|
+
|