@salutejs/plasma-new-hope 0.322.0-canary.1924.14511649579.0 → 0.322.0-canary.1929.14661722839.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/emotion/cjs/components/Accordion/Accordion.template-doc.mdx +99 -71
- package/emotion/cjs/components/Autocomplete/Autocomplete.template-doc.mdx +523 -454
- package/emotion/cjs/components/Checkbox/Checkbox.template-doc.mdx +3 -3
- package/emotion/cjs/components/Combobox/Combobox.template-doc.mdx +58 -27
- package/emotion/cjs/components/DatePicker/DatePicker.template-doc.mdx +5 -0
- package/emotion/cjs/components/Dropdown/Dropdown.template-doc.mdx +10 -10
- package/emotion/cjs/components/Flow/Flow.template-doc.mdx +2 -2
- package/emotion/cjs/components/Notification/Notification.template-doc.mdx +10 -1
- package/emotion/cjs/components/NumberFormat/NumberFormat.template-doc.mdx +4 -4
- package/emotion/cjs/components/Radiobox/Radiobox.template-doc.mdx +10 -11
- package/emotion/cjs/components/Range/Range.template-doc.mdx +5 -1
- package/emotion/cjs/components/Segment/Segment.template-doc.mdx +3 -3
- package/emotion/cjs/components/Select/Select.template-doc.mdx +27 -27
- package/emotion/cjs/components/Slider/Slider.template-doc.mdx +2 -2
- package/emotion/cjs/components/Switch/Switch.template-doc.mdx +3 -3
- package/emotion/cjs/components/Table/Table.template-doc.mdx +2 -2
- package/emotion/cjs/components/Tabs/Tabs.template-doc.mdx +11 -7
- package/emotion/cjs/components/TextArea/TextArea.template-doc.mdx +9 -2
- package/emotion/cjs/components/TextField/TextField.template-doc.mdx +117 -32
- package/emotion/cjs/components/Toast/Toast.template-doc.mdx +48 -2
- package/emotion/cjs/components/Tooltip/Tooltip.template-doc.mdx +19 -4
- package/emotion/cjs/components/Tree/Tree.template-doc.mdx +0 -1
- package/emotion/es/components/Accordion/Accordion.template-doc.mdx +99 -71
- package/emotion/es/components/Autocomplete/Autocomplete.template-doc.mdx +523 -454
- package/emotion/es/components/Checkbox/Checkbox.template-doc.mdx +3 -3
- package/emotion/es/components/Combobox/Combobox.template-doc.mdx +58 -27
- package/emotion/es/components/DatePicker/DatePicker.template-doc.mdx +5 -0
- package/emotion/es/components/Dropdown/Dropdown.template-doc.mdx +10 -10
- package/emotion/es/components/Flow/Flow.template-doc.mdx +2 -2
- package/emotion/es/components/Notification/Notification.template-doc.mdx +10 -1
- package/emotion/es/components/NumberFormat/NumberFormat.template-doc.mdx +4 -4
- package/emotion/es/components/Radiobox/Radiobox.template-doc.mdx +10 -11
- package/emotion/es/components/Range/Range.template-doc.mdx +5 -1
- package/emotion/es/components/Segment/Segment.template-doc.mdx +3 -3
- package/emotion/es/components/Select/Select.template-doc.mdx +27 -27
- package/emotion/es/components/Slider/Slider.template-doc.mdx +2 -2
- package/emotion/es/components/Switch/Switch.template-doc.mdx +3 -3
- package/emotion/es/components/Table/Table.template-doc.mdx +2 -2
- package/emotion/es/components/Tabs/Tabs.template-doc.mdx +11 -7
- package/emotion/es/components/TextArea/TextArea.template-doc.mdx +9 -2
- package/emotion/es/components/TextField/TextField.template-doc.mdx +117 -32
- package/emotion/es/components/Toast/Toast.template-doc.mdx +48 -2
- package/emotion/es/components/Tooltip/Tooltip.template-doc.mdx +19 -4
- package/emotion/es/components/Tree/Tree.template-doc.mdx +0 -1
- package/package.json +5 -5
- package/styled-components/cjs/components/Accordion/Accordion.template-doc.mdx +99 -71
- package/styled-components/cjs/components/Autocomplete/Autocomplete.template-doc.mdx +523 -454
- package/styled-components/cjs/components/Checkbox/Checkbox.template-doc.mdx +3 -3
- package/styled-components/cjs/components/Combobox/Combobox.template-doc.mdx +58 -27
- package/styled-components/cjs/components/DatePicker/DatePicker.template-doc.mdx +5 -0
- package/styled-components/cjs/components/Dropdown/Dropdown.template-doc.mdx +10 -10
- package/styled-components/cjs/components/Flow/Flow.template-doc.mdx +2 -2
- package/styled-components/cjs/components/Notification/Notification.template-doc.mdx +10 -1
- package/styled-components/cjs/components/NumberFormat/NumberFormat.template-doc.mdx +4 -4
- package/styled-components/cjs/components/Radiobox/Radiobox.template-doc.mdx +10 -11
- package/styled-components/cjs/components/Range/Range.template-doc.mdx +5 -1
- package/styled-components/cjs/components/Segment/Segment.template-doc.mdx +3 -3
- package/styled-components/cjs/components/Select/Select.template-doc.mdx +27 -27
- package/styled-components/cjs/components/Slider/Slider.template-doc.mdx +2 -2
- package/styled-components/cjs/components/Switch/Switch.template-doc.mdx +3 -3
- package/styled-components/cjs/components/Table/Table.template-doc.mdx +2 -2
- package/styled-components/cjs/components/Tabs/Tabs.template-doc.mdx +11 -7
- package/styled-components/cjs/components/TextArea/TextArea.template-doc.mdx +9 -2
- package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +117 -32
- package/styled-components/cjs/components/Toast/Toast.template-doc.mdx +48 -2
- package/styled-components/cjs/components/Tooltip/Tooltip.template-doc.mdx +19 -4
- package/styled-components/cjs/components/Tree/Tree.template-doc.mdx +0 -1
- package/styled-components/es/components/Accordion/Accordion.template-doc.mdx +99 -71
- package/styled-components/es/components/Autocomplete/Autocomplete.template-doc.mdx +523 -454
- package/styled-components/es/components/Checkbox/Checkbox.template-doc.mdx +3 -3
- package/styled-components/es/components/Combobox/Combobox.template-doc.mdx +58 -27
- package/styled-components/es/components/DatePicker/DatePicker.template-doc.mdx +5 -0
- package/styled-components/es/components/Dropdown/Dropdown.template-doc.mdx +10 -10
- package/styled-components/es/components/Flow/Flow.template-doc.mdx +2 -2
- package/styled-components/es/components/Notification/Notification.template-doc.mdx +10 -1
- package/styled-components/es/components/NumberFormat/NumberFormat.template-doc.mdx +4 -4
- package/styled-components/es/components/Radiobox/Radiobox.template-doc.mdx +10 -11
- package/styled-components/es/components/Range/Range.template-doc.mdx +5 -1
- package/styled-components/es/components/Segment/Segment.template-doc.mdx +3 -3
- package/styled-components/es/components/Select/Select.template-doc.mdx +27 -27
- package/styled-components/es/components/Slider/Slider.template-doc.mdx +2 -2
- package/styled-components/es/components/Switch/Switch.template-doc.mdx +3 -3
- package/styled-components/es/components/Table/Table.template-doc.mdx +2 -2
- package/styled-components/es/components/Tabs/Tabs.template-doc.mdx +11 -7
- package/styled-components/es/components/TextArea/TextArea.template-doc.mdx +9 -2
- package/styled-components/es/components/TextField/TextField.template-doc.mdx +117 -32
- package/styled-components/es/components/Toast/Toast.template-doc.mdx +48 -2
- package/styled-components/es/components/Tooltip/Tooltip.template-doc.mdx +19 -4
- package/styled-components/es/components/Tree/Tree.template-doc.mdx +0 -1
- /package/emotion/cjs/components/Combobox/ComboboxOld/{Combobox.template-doc.mdx → Combobox.doc.mdx} +0 -0
- /package/emotion/es/components/Combobox/ComboboxOld/{Combobox.template-doc.mdx → Combobox.doc.mdx} +0 -0
- /package/styled-components/cjs/components/Combobox/ComboboxOld/{Combobox.template-doc.mdx → Combobox.doc.mdx} +0 -0
- /package/styled-components/es/components/Combobox/ComboboxOld/{Combobox.template-doc.mdx → Combobox.doc.mdx} +0 -0
@@ -7,12 +7,12 @@ import { PropsTable, Description } from '@site/src/components';
|
|
7
7
|
|
8
8
|
# Checkbox
|
9
9
|
<Description name="Checkbox" />
|
10
|
-
<PropsTable name="Checkbox" exclude={['css', 'focused']} />
|
10
|
+
<PropsTable name="Checkbox" exclude={['css', 'focused']} include={['defaultChecked']} />
|
11
11
|
|
12
12
|
:::caution Устаревшие значения для свойства view
|
13
|
-
Актуальным значением для свойства `view` - является `accent`.
|
13
|
+
Актуальным значением для свойства `view` - является `accent`.
|
14
14
|
|
15
|
-
Все остальные значения `deprecated` и будут удалены в ближайшее время!
|
15
|
+
Все остальные значения `deprecated` и будут удалены в ближайшее время!
|
16
16
|
:::
|
17
17
|
|
18
18
|
## Использование
|
@@ -26,7 +26,7 @@ type Items = Array<{
|
|
26
26
|
*/
|
27
27
|
label: string;
|
28
28
|
/**
|
29
|
-
* Сторона открытия вложенного
|
29
|
+
* Сторона открытия вложенного dropdown относительно текущего элемента
|
30
30
|
* @default right
|
31
31
|
*/
|
32
32
|
placement?: Placement;
|
@@ -49,7 +49,7 @@ type Items = Array<{
|
|
49
49
|
}>;
|
50
50
|
```
|
51
51
|
|
52
|
-
Тип выбора
|
52
|
+
Тип выбора Combobox - одиночный или множественный зависит от типа `value` и `onChange`. В одиночном value - `string`, в множественном - `Array<string>`.\
|
53
53
|
|
54
54
|
|
55
55
|
## Примеры
|
@@ -85,8 +85,8 @@ type Items = Array<{
|
|
85
85
|
];
|
86
86
|
|
87
87
|
return (
|
88
|
-
<div style
|
89
|
-
<div style
|
88
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
89
|
+
<div style=\{{ width: "300px" }}>
|
90
90
|
<Combobox
|
91
91
|
items={items}
|
92
92
|
value={value}
|
@@ -131,8 +131,8 @@ type Items = Array<{
|
|
131
131
|
];
|
132
132
|
|
133
133
|
return (
|
134
|
-
<div style
|
135
|
-
<div style
|
134
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
135
|
+
<div style=\{{ width: "300px" }}>
|
136
136
|
<Combobox
|
137
137
|
multiple
|
138
138
|
items={items}
|
@@ -180,8 +180,8 @@ type Items = Array<{
|
|
180
180
|
];
|
181
181
|
|
182
182
|
return (
|
183
|
-
<div style
|
184
|
-
<div style
|
183
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
184
|
+
<div style=\{{ width: "300px" }}>
|
185
185
|
<Combobox
|
186
186
|
multiple
|
187
187
|
items={items}
|
@@ -200,9 +200,9 @@ type Items = Array<{
|
|
200
200
|
```
|
201
201
|
</TabItem>
|
202
202
|
<TabItem value="portal" label="Portal">
|
203
|
-
Иногда возникает необходимость вынесения выпадающего списка на уровни выше в DOM. К примеру, когда у родительского блока имеется
|
203
|
+
Иногда возникает необходимость вынесения выпадающего списка на уровни выше в DOM. К примеру, когда у родительского блока имеется scroll, и список будет обрезаться, чего хотелось бы избежать.\
|
204
204
|
Для такой реализации имеется пропс `portal`, который принимает либо `ref` либо `id` html-тега.\
|
205
|
-
Также нужно прокинуть
|
205
|
+
Также нужно прокинуть свойство `listWidth`, чтобы явно задать ширину списку. Если этого не сделать, то будет взята ширина 100% от блока, на который ведет ссылка портала.
|
206
206
|
|
207
207
|
```tsx live
|
208
208
|
import React, { useRef } from 'react';
|
@@ -232,11 +232,11 @@ type Items = Array<{
|
|
232
232
|
},
|
233
233
|
];
|
234
234
|
|
235
|
-
const ref = useRef(null)
|
235
|
+
const ref = useRef(null);
|
236
236
|
|
237
237
|
return (
|
238
|
-
<div style
|
239
|
-
<div style
|
238
|
+
<div style=\{{ height: "300px" }} ref={ref}>
|
239
|
+
<div style=\{{ width: "300px" }}>
|
240
240
|
<Combobox
|
241
241
|
items={items}
|
242
242
|
value={value}
|
@@ -283,8 +283,8 @@ type Items = Array<{
|
|
283
283
|
];
|
284
284
|
|
285
285
|
return (
|
286
|
-
<div style
|
287
|
-
<div style
|
286
|
+
<div style=\{{ height: "300px" }}>
|
287
|
+
<div style=\{{ width: "300px" }}>
|
288
288
|
<Combobox
|
289
289
|
items={items}
|
290
290
|
placeholder="Placeholder"
|
@@ -329,9 +329,9 @@ type Items = Array<{
|
|
329
329
|
];
|
330
330
|
|
331
331
|
return (
|
332
|
-
<div style
|
333
|
-
<div style
|
334
|
-
<Button text={ alwaysOpened ? 'По умолчанию' : 'Всегда открыт' } onClick={() => setAlwaysOpened(!alwaysOpened)} style
|
332
|
+
<div style=\{{ height: "300px" }}>
|
333
|
+
<div style=\{{width: "300px" }}>
|
334
|
+
<Button text={ alwaysOpened ? 'По умолчанию' : 'Всегда открыт' } onClick={() => setAlwaysOpened(!alwaysOpened)} style=\{{ marginBottom: '1rem' }} />
|
335
335
|
<Combobox
|
336
336
|
items={items}
|
337
337
|
placeholder="Placeholder"
|
@@ -345,6 +345,37 @@ type Items = Array<{
|
|
345
345
|
}
|
346
346
|
```
|
347
347
|
</TabItem>
|
348
|
+
<TabItem value="virtual" label="Virtual">
|
349
|
+
:::caution
|
350
|
+
Работает только в одно-уровневых списках.
|
351
|
+
:::
|
352
|
+
|
353
|
+
Свойство `virtual` позволяет виртуализировать выпадающий список. Для настройки высоты списка можно использовать свойство `listMaxHeight`.
|
354
|
+
|
355
|
+
```tsx live
|
356
|
+
import React from 'react';
|
357
|
+
import { Combobox } from '@salutejs/{{ package }}';
|
358
|
+
|
359
|
+
export function App() {
|
360
|
+
const items = Array(5000).fill(1).map((_, i) => ({ value: i.toString(), label: i.toString() }));
|
361
|
+
|
362
|
+
return (
|
363
|
+
<div style=\{{ height: "300px" }}>
|
364
|
+
<div style=\{{width: "300px" }}>
|
365
|
+
<Combobox
|
366
|
+
items={items}
|
367
|
+
virtual
|
368
|
+
listMaxHeight="200px"
|
369
|
+
placeholder="Placeholder"
|
370
|
+
label="Label"
|
371
|
+
helperText="Helper text"
|
372
|
+
/>
|
373
|
+
</div>
|
374
|
+
</div>
|
375
|
+
);
|
376
|
+
}
|
377
|
+
```
|
378
|
+
</TabItem>
|
348
379
|
<TabItem value="infinite" label="Infinite Loading">
|
349
380
|
Пример с бесконечной загрузкой элементов в списке.
|
350
381
|
|
@@ -388,8 +419,8 @@ type Items = Array<{
|
|
388
419
|
};
|
389
420
|
|
390
421
|
return (
|
391
|
-
<div style
|
392
|
-
<div style
|
422
|
+
<div style=\{{ height: "300px" }}>
|
423
|
+
<div style=\{{ width: "300px" }}>
|
393
424
|
<Combobox
|
394
425
|
items={items}
|
395
426
|
listMaxHeight="200px"
|
@@ -411,7 +442,7 @@ type Items = Array<{
|
|
411
442
|
## Использование с React Hook Form и нативной формой
|
412
443
|
|
413
444
|
:::caution Использование атрибута `name`
|
414
|
-
Используйте
|
445
|
+
Используйте свойство `name` только когда это необходимо. Оно влияет на выходной тип в `onChange`.
|
415
446
|
:::
|
416
447
|
|
417
448
|
<Tabs>
|
@@ -462,8 +493,8 @@ type Items = Array<{
|
|
462
493
|
];
|
463
494
|
|
464
495
|
return (
|
465
|
-
<div style
|
466
|
-
<form onSubmit={handleSubmit(onSubmit)} style
|
496
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
497
|
+
<form onSubmit={handleSubmit(onSubmit)} style=\{{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
467
498
|
<Combobox
|
468
499
|
items={items}
|
469
500
|
{...register('combobox')}
|
@@ -525,8 +556,8 @@ type Items = Array<{
|
|
525
556
|
];
|
526
557
|
|
527
558
|
return (
|
528
|
-
<div style
|
529
|
-
<form onSubmit={handleSubmit(onSubmit)} style
|
559
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
560
|
+
<form onSubmit={handleSubmit(onSubmit)} style=\{{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
530
561
|
<Controller
|
531
562
|
control={control}
|
532
563
|
name="combobox"
|
@@ -598,8 +629,8 @@ type Items = Array<{
|
|
598
629
|
];
|
599
630
|
|
600
631
|
return (
|
601
|
-
<div style
|
602
|
-
<form onSubmit={onSubmit} style
|
632
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
633
|
+
<form onSubmit={onSubmit} style=\{{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
603
634
|
<Combobox label="Combobox" name="combobox" defaultValue={"brazil"} items={items} />
|
604
635
|
<Combobox label="Combobox" name="comboboxMulti" defaultValue={["brazil"]} items={items} multiple />
|
605
636
|
<Button type="submit">Отправить</Button>
|
@@ -194,6 +194,11 @@ export function App() {
|
|
194
194
|
```
|
195
195
|
|
196
196
|
### Обязательность поля
|
197
|
+
|
198
|
+
:::tip
|
199
|
+
Наличие индикатора регулируется свойством `hasRequiredIndicator`.
|
200
|
+
:::
|
201
|
+
|
197
202
|
Обязательность поля задаётся с помощью свойства `required`.
|
198
203
|
Если поле является обязательным, то у компонента появляется специальный индикатор.
|
199
204
|
Изменить расположение индикатора можно с помощью свойства `requiredPlacement`, которое принимает значения `left` и `right`.
|
@@ -30,7 +30,7 @@ type Items = Array<{
|
|
30
30
|
*/
|
31
31
|
label: string;
|
32
32
|
/**
|
33
|
-
* Сторона открытия вложенного
|
33
|
+
* Сторона открытия вложенного Dropdown относительно текущего элемента;
|
34
34
|
*/
|
35
35
|
placement?: DropdownPlacement;
|
36
36
|
/**
|
@@ -117,7 +117,7 @@ type Items = Array<{
|
|
117
117
|
|
118
118
|
|
119
119
|
return (
|
120
|
-
<div style
|
120
|
+
<div style=\{{ height:"300px" }}>
|
121
121
|
<Dropdown
|
122
122
|
items={items}
|
123
123
|
>
|
@@ -170,7 +170,7 @@ type Items = Array<{
|
|
170
170
|
];
|
171
171
|
|
172
172
|
return (
|
173
|
-
<div style
|
173
|
+
<div style=\{{ height: "300px", display: "flex", gap: "50px" }}>
|
174
174
|
<Dropdown
|
175
175
|
items={items}
|
176
176
|
size="l"
|
@@ -245,7 +245,7 @@ type Items = Array<{
|
|
245
245
|
];
|
246
246
|
|
247
247
|
return (
|
248
|
-
<div style
|
248
|
+
<div style=\{{ height: "300px", display: "flex", gap: "50px" }}>
|
249
249
|
<Dropdown
|
250
250
|
items={items}
|
251
251
|
>
|
@@ -327,7 +327,7 @@ type Items = Array<{
|
|
327
327
|
];
|
328
328
|
|
329
329
|
return (
|
330
|
-
<div style
|
330
|
+
<div style=\{{ height:"300px" }}>
|
331
331
|
<Dropdown
|
332
332
|
items={items}
|
333
333
|
trigger="hover"
|
@@ -380,10 +380,10 @@ type Items = Array<{
|
|
380
380
|
},
|
381
381
|
];
|
382
382
|
|
383
|
-
const ref = useRef(null)
|
383
|
+
const ref = useRef(null);
|
384
384
|
|
385
385
|
return (
|
386
|
-
<div style
|
386
|
+
<div style=\{{ position: "relative", height: "300px" }} ref={ref}>
|
387
387
|
<Dropdown items={items} portal={ref}>
|
388
388
|
<Button text="Список стран" />
|
389
389
|
</Dropdown>
|
@@ -399,13 +399,13 @@ type Items = Array<{
|
|
399
399
|
Данный компонент соответствует требования W3C: [Combobox](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) и частично [TreeView](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/).
|
400
400
|
|
401
401
|
- `Tab` - закрывает Dropdown. Перемещает фокус на следующий элемент на странице;
|
402
|
-
- `Enter` - открывает/закрывает Dropdown. Если на элементе
|
403
|
-
- `Space` - открывает/закрывает Dropdown. Если на элементе
|
402
|
+
- `Enter` - открывает/закрывает Dropdown. Если на элементе — выбирает его;
|
403
|
+
- `Space` - открывает/закрывает Dropdown. Если на элементе — выбирает его;
|
404
404
|
- `Home` - открывает Dropdown и перемещает фокус на первый элемент;
|
405
405
|
- `End` - открывает Dropdown и перемещает фокус на последний элемент;
|
406
406
|
- `PageUp` - перемещает фокус на 10 элементов выше либо в начало списка;
|
407
407
|
- `PageDown` - перемещает фокус на 10 элементов ниже либо в конце списка;
|
408
408
|
- `ArrowUp` - открывает Dropdown и перемещает фокус на первый элемент. Перемещает фокус на один элемент выше;
|
409
409
|
- `ArrowDown` - открывает Dropdown и перемещает фокус на первый элемент. Перемещает фокус на один элемент ниже;
|
410
|
-
- `ArrowRight` - если фокус на элементе вложенного списка
|
410
|
+
- `ArrowRight` - если фокус на элементе вложенного списка — открывает его и перемещает фокус на первый элемент;
|
411
411
|
- `ArrowLeft` - закрывает текущий список и перемещает фокус на предыдущий;
|
@@ -41,7 +41,7 @@ export function App() {
|
|
41
41
|
|
42
42
|
return (
|
43
43
|
<div>
|
44
|
-
<Flow mainAxisGap="0.5ch" crossAxisGap="1ch" style
|
44
|
+
<Flow mainAxisGap="0.5ch" crossAxisGap="1ch" style=\{{ width: '15ch' }} >
|
45
45
|
{Array(6)
|
46
46
|
.fill(0)
|
47
47
|
.map((_, i) => (<div key={i} style={style(i)}>{numbers[i]}</div>))}
|
@@ -77,7 +77,7 @@ export function App() {
|
|
77
77
|
orientation="vertical"
|
78
78
|
mainAxisGap="0.5ch"
|
79
79
|
crossAxisGap="1ch"
|
80
|
-
style
|
80
|
+
style=\{{ height: '90px' }}
|
81
81
|
>
|
82
82
|
{Array(6)
|
83
83
|
.fill(0)
|
@@ -20,7 +20,7 @@ import { PropsTable, Description } from '@site/src/components';
|
|
20
20
|
<PropsTable name="NotificationsProvider" />
|
21
21
|
|
22
22
|
Поместите `NotificationsProvider` в [корень приложения](../../#корень-приложения) или там, где будете применять модальные окна.
|
23
|
-
В качестве свойств можно указать контейнер для оповещений через `frame
|
23
|
+
В качестве свойств можно указать контейнер для оповещений через `frame`.
|
24
24
|
|
25
25
|
```tsx title="index.ts"
|
26
26
|
import ReactDOM from 'react-dom';
|
@@ -36,6 +36,15 @@ ReactDOM.render(
|
|
36
36
|
);
|
37
37
|
```
|
38
38
|
|
39
|
+
### Позиционирование
|
40
|
+
|
41
|
+
Позиционирование компонента регулируется с помощью свойства `placement`.
|
42
|
+
|
43
|
+
```ts
|
44
|
+
type NotificationPlacement = 'center' | 'top' | 'bottom' | 'right' | 'left';
|
45
|
+
````
|
46
|
+
И производные комбинации, например `bottom-left` или `top-right`.
|
47
|
+
|
39
48
|
### Вызов уведомления
|
40
49
|
После подключения `NotificationsProvider` станет возможен вызов функции `addNotification`, который приведет к отображению оповещения.
|
41
50
|
Функция принимает значения свойств компонента `Notification`, включая необязательное поле `id`. И возвращает сгенерированный или переданный `id`, по которому можно закрыть оповещение через вызов `closeNotification`.
|
@@ -10,8 +10,8 @@ import { PropsTable, Description } from '@site/src/components';
|
|
10
10
|
<PropsTable name="NumberFormat" exclude={['css']} />
|
11
11
|
|
12
12
|
## Использование
|
13
|
-
Компонент `NumberFormat` представляет собой поле ввода
|
14
|
-
Он реализован на компоненте [TextField](https://plasma.sberdevices.ru/
|
13
|
+
Компонент `NumberFormat` представляет собой поле ввода числовых значений.
|
14
|
+
Он реализован на компоненте [TextField](https://plasma.sberdevices.ru/{{ name }}/components/textfield/)
|
15
15
|
и наследует практически все его свойства (`size`, `view`, `disabled`, `label` и тд.)
|
16
16
|
|
17
17
|
### Разделитель тысяч и десятичных знаков
|
@@ -146,7 +146,7 @@ export function App() {
|
|
146
146
|
```
|
147
147
|
|
148
148
|
### Ведущие нули
|
149
|
-
Чтобы разрешить в числе ведущие нули,
|
149
|
+
Чтобы разрешить в числе ведущие нули, нужно указать свойство `allowLeadingZeros`:
|
150
150
|
|
151
151
|
```tsx live
|
152
152
|
import React from 'react';
|
@@ -165,4 +165,4 @@ export function App() {
|
|
165
165
|
</div>
|
166
166
|
);
|
167
167
|
}
|
168
|
-
```
|
168
|
+
```
|
@@ -7,18 +7,18 @@ import { PropsTable, Description } from '@site/src/components';
|
|
7
7
|
|
8
8
|
# Radiobox
|
9
9
|
<Description name="Radiobox" />
|
10
|
-
<PropsTable name="Radiobox" exclude={['css', 'focused']} />
|
10
|
+
<PropsTable name="Radiobox" exclude={['css', 'focused']} include={['defaultChecked']} />
|
11
11
|
|
12
12
|
:::caution Устаревшие значения для свойства view
|
13
|
-
Актуальным значением для свойства `view` - является `accent`.
|
13
|
+
Актуальным значением для свойства `view` - является `accent`.
|
14
14
|
|
15
|
-
Все остальные значения `deprecated` и будут удалены в ближайшее время!
|
15
|
+
Все остальные значения `deprecated` и будут удалены в ближайшее время!
|
16
16
|
:::
|
17
17
|
|
18
18
|
## Использование
|
19
19
|
Компонент `Radiobox` может содержать лейбл и описание.
|
20
20
|
|
21
|
-
По умолчанию, контент внутри лейбла и описания многострочный.
|
21
|
+
По умолчанию, контент внутри лейбла и описания многострочный.
|
22
22
|
|
23
23
|
Для того чтобы стал однострочным, необходимо использовать свойство `singleLine`(по умолчанию `false`).
|
24
24
|
|
@@ -34,14 +34,13 @@ export function App() {
|
|
34
34
|
```
|
35
35
|
|
36
36
|
## RadioGroup
|
37
|
+
|
37
38
|
Компоненты `Radiobox` следует объединять в `RadioGroup`
|
38
39
|
|
39
40
|
```tsx live
|
40
|
-
<
|
41
|
-
<
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
</RadioGroup>
|
46
|
-
</div>
|
41
|
+
<RadioGroup aria-labelledby="radiogroup-title-id">
|
42
|
+
<H3 id="radiogroup-title-id">Заголовок</H3>
|
43
|
+
<Radiobox name="radio-1" label="Радиокнопка 1" description="Описание 1" defaultChecked />
|
44
|
+
<Radiobox name="radio-1" label="Радиокнопка 2" description="Описание 2" />
|
45
|
+
</RadioGroup>
|
47
46
|
```
|
@@ -323,6 +323,10 @@ export function App() {
|
|
323
323
|
```
|
324
324
|
|
325
325
|
### Обязательность поля
|
326
|
+
:::tip
|
327
|
+
Наличие индикатора регулируется свойством `hasRequiredIndicator`.
|
328
|
+
:::
|
329
|
+
|
326
330
|
Обязательность поля задаётся с помощью свойства `required`.
|
327
331
|
Если поле является обязательным, то у компонента появляется специальный индикатор.
|
328
332
|
Изменить расположение индикатора можно с помощью свойства `requiredPlacement`, которое принимает значения `left` и `right`.
|
@@ -356,4 +360,4 @@ export function App() {
|
|
356
360
|
</div>
|
357
361
|
);
|
358
362
|
}
|
359
|
-
```
|
363
|
+
```
|
@@ -59,7 +59,7 @@ export function App() {
|
|
59
59
|
}
|
60
60
|
|
61
61
|
return (
|
62
|
-
<div style
|
62
|
+
<div style=\{{ display: "block" }} >
|
63
63
|
<SegmentProvider defaultSelected={['label_1']}>
|
64
64
|
<SegmentTemplate/>
|
65
65
|
</SegmentProvider>
|
@@ -103,7 +103,7 @@ export function App() {
|
|
103
103
|
}
|
104
104
|
|
105
105
|
return (
|
106
|
-
<div style
|
106
|
+
<div style=\{{ display: "block" }} >
|
107
107
|
<SegmentProvider defaultSelected={['label_1']} singleSelectedRequired>
|
108
108
|
<SegmentTemplate/>
|
109
109
|
</SegmentProvider>
|
@@ -145,7 +145,7 @@ export function App() {
|
|
145
145
|
}
|
146
146
|
|
147
147
|
return (
|
148
|
-
<div style
|
148
|
+
<div style=\{{ display: "block" }} >
|
149
149
|
<SegmentProvider defaultSelected={['label_1']}>
|
150
150
|
<SegmentTemplate/>
|
151
151
|
</SegmentProvider>
|
@@ -104,12 +104,12 @@ Select может выглядеть как Button и как Textfield. За э
|
|
104
104
|
];
|
105
105
|
|
106
106
|
return (
|
107
|
-
<div style
|
108
|
-
<div style
|
107
|
+
<div style=\{{ display: 'flex', gap: '30px', height: '300px' }}>
|
108
|
+
<div style=\{{width: '300px'}}>
|
109
109
|
<Select items={items} value={singleValue} onChange={setSingleValue} label="Label" placeholder="Placeholder" helperText="Helper text" />
|
110
110
|
</div>
|
111
111
|
|
112
|
-
<div style
|
112
|
+
<div style=\{{width: '300px'}}>
|
113
113
|
<Select multiselect items={items} value={multipleValue} onChange={setMultipleValue} label="Label" placeholder="Placeholder" helperText="Helper text" />
|
114
114
|
</div>
|
115
115
|
</div>
|
@@ -150,12 +150,12 @@ Select может выглядеть как Button и как Textfield. За э
|
|
150
150
|
];
|
151
151
|
|
152
152
|
return (
|
153
|
-
<div style
|
154
|
-
<div style
|
153
|
+
<div style=\{{display: 'flex', gap: '30px', height: '300px' }}>
|
154
|
+
<div style=\{{width: '300px'}}>
|
155
155
|
<Select items={items} label="Single" target="button-like" value={singleValue} onChange={setSingleValue} />
|
156
156
|
</div>
|
157
157
|
|
158
|
-
<div style
|
158
|
+
<div style=\{{width: '300px'}}>
|
159
159
|
<Select multiselect items={items} label="Multiple" target="button-like" value={multipleValue} onChange={setMultipleValue} />
|
160
160
|
</div>
|
161
161
|
</div>
|
@@ -195,8 +195,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
195
195
|
];
|
196
196
|
|
197
197
|
return (
|
198
|
-
<div style
|
199
|
-
<div style
|
198
|
+
<div style=\{{display: 'flex', gap: '30px', height: '300px' }}>
|
199
|
+
<div style=\{{width: '300px'}}>
|
200
200
|
<Select multiselect items={items} label="Label" placeholder="Placeholder" value={multipleValue} onChange={setMultipleValue} />
|
201
201
|
</div>
|
202
202
|
|
@@ -246,8 +246,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
246
246
|
};
|
247
247
|
|
248
248
|
return (
|
249
|
-
<div style
|
250
|
-
<div style
|
249
|
+
<div style=\{{ height: '300px' }}>
|
250
|
+
<div style=\{{ width: '300px' }}>
|
251
251
|
<Select
|
252
252
|
items={items}
|
253
253
|
label="Label"
|
@@ -290,7 +290,7 @@ Select может выглядеть как Button и как Textfield. За э
|
|
290
290
|
if (Array.isArray(itemData)) {
|
291
291
|
if (itemData.length === 0) {
|
292
292
|
return (
|
293
|
-
<div style
|
293
|
+
<div style=\{{ padding: '0.5rem 0' }}>
|
294
294
|
<Cell
|
295
295
|
view="default"
|
296
296
|
title="Выберите страну"
|
@@ -304,7 +304,7 @@ Select может выглядеть как Button и как Textfield. За э
|
|
304
304
|
const title = itemData.map((item) => item.label).join(', ');
|
305
305
|
|
306
306
|
return (
|
307
|
-
<div style
|
307
|
+
<div style=\{{ padding: '0.5rem 0.75rem' }}>
|
308
308
|
<Cell view="default" title={title} subtitle="Subtitle" label="Label" />
|
309
309
|
</div>
|
310
310
|
);
|
@@ -321,8 +321,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
321
321
|
)
|
322
322
|
|
323
323
|
return (
|
324
|
-
<div style
|
325
|
-
<div style
|
324
|
+
<div style=\{{ height: '300px' }}>
|
325
|
+
<div style=\{{ width: '400px' }}>
|
326
326
|
<Select
|
327
327
|
items={items}
|
328
328
|
value={multipleValue}
|
@@ -373,8 +373,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
373
373
|
const ref = useRef(null)
|
374
374
|
|
375
375
|
return (
|
376
|
-
<div style
|
377
|
-
<div style
|
376
|
+
<div style=\{{ position: "relative", height: "300px" }} ref={ref}>
|
377
|
+
<div style=\{{width: '300px'}}>
|
378
378
|
<Select items={items} label="Label" placeholder="Placeholder" value={value} onChange={setValue} portal={ref} listWidth="300px" />
|
379
379
|
</div>
|
380
380
|
</div>
|
@@ -412,8 +412,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
412
412
|
];
|
413
413
|
|
414
414
|
return (
|
415
|
-
<div style
|
416
|
-
<div style
|
415
|
+
<div style=\{{ height: '300px' }}>
|
416
|
+
<div style=\{{width: '300px'}}>
|
417
417
|
<Select items={items} label="Label" placeholder="Placeholder" />
|
418
418
|
</div>
|
419
419
|
</div>
|
@@ -433,7 +433,7 @@ Select может выглядеть как Button и как Textfield. За э
|
|
433
433
|
const items = Array(5000).fill(1).map((_, i) => ({ value: i.toString(), label: i.toString() }));
|
434
434
|
|
435
435
|
return (
|
436
|
-
<div style
|
436
|
+
<div style=\{{ width: "300px", height: "300px" }}>
|
437
437
|
<Select
|
438
438
|
items={items}
|
439
439
|
virtual
|
@@ -490,8 +490,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
490
490
|
};
|
491
491
|
|
492
492
|
return (
|
493
|
-
<div style
|
494
|
-
<div style
|
493
|
+
<div style=\{{ height: "300px" }}>
|
494
|
+
<div style=\{{ width: "300px" }}>
|
495
495
|
<Select
|
496
496
|
items={items}
|
497
497
|
listMaxHeight="200px"
|
@@ -565,8 +565,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
565
565
|
];
|
566
566
|
|
567
567
|
return (
|
568
|
-
<div style
|
569
|
-
<form onSubmit={handleSubmit(onSubmit)} style
|
568
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
569
|
+
<form onSubmit={handleSubmit(onSubmit)} style=\{{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
570
570
|
<Select
|
571
571
|
items={items}
|
572
572
|
{...register('Select')}
|
@@ -628,8 +628,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
628
628
|
];
|
629
629
|
|
630
630
|
return (
|
631
|
-
<div style
|
632
|
-
<form onSubmit={handleSubmit(onSubmit)} style
|
631
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
632
|
+
<form onSubmit={handleSubmit(onSubmit)} style=\{{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
633
633
|
<Controller
|
634
634
|
control={control}
|
635
635
|
name="Select"
|
@@ -701,8 +701,8 @@ Select может выглядеть как Button и как Textfield. За э
|
|
701
701
|
];
|
702
702
|
|
703
703
|
return (
|
704
|
-
<div style
|
705
|
-
<form onSubmit={onSubmit} style
|
704
|
+
<div style=\{{ display: "flex", gap: "30px", height: "300px" }}>
|
705
|
+
<form onSubmit={onSubmit} style=\{{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
706
706
|
<Select label="Select" name="Select" defaultValue={"brazil"} items={items} />
|
707
707
|
<Select label="Select" name="SelectMulti" defaultValue={["brazil"]} items={items} multiselect />
|
708
708
|
<Button type="submit">Отправить</Button>
|
@@ -77,7 +77,7 @@ export function App() {
|
|
77
77
|
}
|
78
78
|
```
|
79
79
|
|
80
|
-
|
80
|
+
## Вертикальное отображение
|
81
81
|
|
82
82
|
```tsx live
|
83
83
|
import React from 'react';
|
@@ -86,7 +86,7 @@ import { IconMic } from '@salutejs/plasma-icons';
|
|
86
86
|
|
87
87
|
export function App() {
|
88
88
|
return (
|
89
|
-
<section style
|
89
|
+
<section style=\{{ height: '300px' }}>
|
90
90
|
<Slider
|
91
91
|
onChangeCommitted={() => {}}
|
92
92
|
min={0}
|