@salutejs/plasma-new-hope 0.322.0-canary.1933.14596920222.0 → 0.322.0-canary.1938.14660334712.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/cjs/components/Notification/Notification.types.js.map +1 -1
- package/cjs/components/Notification/NotificationsStore.js +4 -2
- package/cjs/components/Notification/NotificationsStore.js.map +1 -1
- 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 +23 -2
- package/emotion/cjs/components/Notification/NotificationsStore.js +4 -2
- 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/cjs/examples/plasma_b2c/components/Notification/Notification.stories.tsx +4 -0
- package/emotion/cjs/examples/plasma_web/components/Notification/Notification.stories.tsx +4 -0
- 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 +23 -2
- package/emotion/es/components/Notification/NotificationsStore.js +4 -2
- 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/emotion/es/examples/plasma_b2c/components/Notification/Notification.stories.tsx +4 -0
- package/emotion/es/examples/plasma_web/components/Notification/Notification.stories.tsx +4 -0
- package/es/components/Notification/Notification.types.js.map +1 -1
- package/es/components/Notification/NotificationsStore.js +4 -2
- package/es/components/Notification/NotificationsStore.js.map +1 -1
- package/package.json +4 -4
- 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 +23 -2
- package/styled-components/cjs/components/Notification/NotificationsStore.js +4 -2
- 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/cjs/examples/plasma_b2c/components/Notification/Notification.stories.tsx +4 -0
- package/styled-components/cjs/examples/plasma_web/components/Notification/Notification.stories.tsx +4 -0
- 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 +23 -2
- package/styled-components/es/components/Notification/NotificationsStore.js +4 -2
- 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/styled-components/es/examples/plasma_b2c/components/Notification/Notification.stories.tsx +4 -0
- package/styled-components/es/examples/plasma_web/components/Notification/Notification.stories.tsx +4 -0
- package/types/components/Notification/Notification.types.d.ts +14 -10
- package/types/components/Notification/Notification.types.d.ts.map +1 -1
- package/types/components/Notification/NotificationsStore.d.ts +1 -1
- package/types/components/Notification/NotificationsStore.d.ts.map +1 -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
@@ -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}
|
@@ -7,7 +7,7 @@ import { PropsTable, Description } from '@site/src/components';
|
|
7
7
|
|
8
8
|
# Switch
|
9
9
|
<Description name="Switch" />
|
10
|
-
<PropsTable name="Switch" />
|
10
|
+
<PropsTable name="Switch" include={['defaultChecked']} />
|
11
11
|
|
12
12
|
## Использование
|
13
13
|
Компонент `Switch` может содержать лейбл.
|
@@ -30,7 +30,7 @@ export function App() {
|
|
30
30
|
|
31
31
|
```tsx live
|
32
32
|
import React from 'react';
|
33
|
-
import {
|
33
|
+
import { Switch } from '@salutejs/{{ package }}';
|
34
34
|
|
35
35
|
export function App() {
|
36
36
|
return (
|
@@ -47,7 +47,7 @@ export function App() {
|
|
47
47
|
|
48
48
|
```tsx live
|
49
49
|
import React from 'react';
|
50
|
-
import {
|
50
|
+
import { Switch } from '@salutejs/{{ package }}';
|
51
51
|
|
52
52
|
export function App() {
|
53
53
|
return (
|
@@ -492,7 +492,7 @@ export type TableColumnData = {
|
|
492
492
|
];
|
493
493
|
|
494
494
|
return (
|
495
|
-
<div style
|
495
|
+
<div style=\{{ display: "block" }}>
|
496
496
|
<ButtonGroup size="xs" isCommonButtonStyles={false}>
|
497
497
|
<Button text="Очистить выбранные" view="warning" size="xs" onClick={clearSelected} />
|
498
498
|
<Button text="Убрать сортировку" view="warning" size="xs" onClick={clearSorted} />
|
@@ -504,7 +504,7 @@ export type TableColumnData = {
|
|
504
504
|
<br />
|
505
505
|
<br />
|
506
506
|
|
507
|
-
<div style
|
507
|
+
<div style=\{{ overflow: "scroll" }}>
|
508
508
|
<Table
|
509
509
|
data={data}
|
510
510
|
columns={columns}
|
@@ -5,6 +5,10 @@ title: Tabs
|
|
5
5
|
|
6
6
|
import { PropsTable, Description } from '@site/src/components';
|
7
7
|
|
8
|
+
# Tabs
|
9
|
+
Набор компонентов для создания вкладок.
|
10
|
+
Структура для вкладок похожа на структуру маркированных списков.
|
11
|
+
|
8
12
|
## Tabs
|
9
13
|
|
10
14
|
<Description name="Tabs" />
|
@@ -16,7 +20,7 @@ import { PropsTable, Description } from '@site/src/components';
|
|
16
20
|
<PropsTable name="TabItem" />
|
17
21
|
|
18
22
|
:::caution Взаимоисключающие свойства
|
19
|
-
Свойство `value` - это значение
|
23
|
+
Свойство `value` - это значение Tab. Оно отображается справа от основного текста.<br/>
|
20
24
|
`value` и `contentRight` взаимоисключающие: если передано одно, второе передать нельзя.
|
21
25
|
:::
|
22
26
|
|
@@ -61,8 +65,8 @@ export function App() {
|
|
61
65
|
}
|
62
66
|
```
|
63
67
|
|
64
|
-
### Расположение
|
65
|
-
|
68
|
+
### Расположение Tabs
|
69
|
+
Компонент может быть горизонтальными (по умолчанию) и вертикальными. За это отвечает свойство `orientation`.
|
66
70
|
|
67
71
|
```tsx live
|
68
72
|
import React, { useState } from 'react';
|
@@ -97,11 +101,11 @@ export function App() {
|
|
97
101
|
```
|
98
102
|
|
99
103
|
### Пример с прокруткой
|
100
|
-
При выборе
|
104
|
+
При выборе Tab происходит прокрутка до выбранного TabItem.
|
101
105
|
|
102
106
|
```tsx live
|
103
107
|
import React, { useState } from 'react';
|
104
|
-
import { Tabs, TabItem, Button } from '@salutejs/
|
108
|
+
import { Tabs, TabItem, Button } from '@salutejs/{{ package }}';
|
105
109
|
import { IconClock } from '@salutejs/plasma-icons';
|
106
110
|
|
107
111
|
export function App() {
|
@@ -189,8 +193,8 @@ export function App() {
|
|
189
193
|
|
190
194
|
### Подключение клавиатурной навигации
|
191
195
|
Для этого необходимо дополнительно прокинуть свойства `index, itemIndex, onIndexChange`.<br/>
|
192
|
-
Для горизонтальных
|
193
|
-
Для вертикальных
|
196
|
+
Для горизонтальных Tabs: клавиши ArrowLeft, ArrowRight, Home, End для навигации по вкладкам.<br/>
|
197
|
+
Для вертикальных Tabs: клавиши ArrowUp, ArrowDown, Home, End для навигации по вкладкам.
|
194
198
|
|
195
199
|
```tsx live
|
196
200
|
import React, { useState } from 'react';
|
@@ -161,11 +161,18 @@ export function App() {
|
|
161
161
|
|
162
162
|
|
163
163
|
### Обязательность поля
|
164
|
-
|
164
|
+
|
165
|
+
:::tip
|
166
|
+
Наличие индикатора регулируется свойством `hasRequiredIndicator`.
|
167
|
+
:::
|
168
|
+
|
169
|
+
Обязательность поля задаётся с помощью свойств `required` и `requiredPlacement`.
|
170
|
+
|
171
|
+
Где `requiredPlacement` отвечает за выравнивание и принимает значения `"left"` и `"right"`:
|
165
172
|
|
166
173
|
```tsx live
|
167
174
|
import React from 'react';
|
168
|
-
import {
|
175
|
+
import { TextArea } from '@salutejs/{{ package }}';
|
169
176
|
|
170
177
|
export function App() {
|
171
178
|
return (
|
@@ -37,7 +37,7 @@ export function App() {
|
|
37
37
|
```
|
38
38
|
|
39
39
|
### Размер поля
|
40
|
-
Размер поля задаётся с помощью свойства `size`. Свойство принимает значения `"l"
|
40
|
+
Размер поля задаётся с помощью свойства `size`. Свойство принимает значения `"l" | "m" | "s" | "xs"`:
|
41
41
|
|
42
42
|
```tsx live
|
43
43
|
import React from 'react';
|
@@ -53,8 +53,8 @@ export function App() {
|
|
53
53
|
/>
|
54
54
|
<TextField
|
55
55
|
placeholder="Размер"
|
56
|
-
size="
|
57
|
-
defaultValue="
|
56
|
+
size="s"
|
57
|
+
defaultValue="S40"
|
58
58
|
/>
|
59
59
|
</div>
|
60
60
|
);
|
@@ -62,9 +62,9 @@ export function App() {
|
|
62
62
|
```
|
63
63
|
|
64
64
|
### Статус поля
|
65
|
-
Статус поля задается с помощью свойства `
|
66
|
-
|
67
|
-
|
65
|
+
Статус поля задается с помощью свойства `view`.
|
66
|
+
|
67
|
+
Возможные значения свойства: `"positive" | "warning" | "negative"`
|
68
68
|
|
69
69
|
```tsx live
|
70
70
|
import React from 'react';
|
@@ -75,46 +75,61 @@ export function App() {
|
|
75
75
|
<div style=\{{ display: "flex", flexDirection: "column", gap: "1rem" }}>
|
76
76
|
<div style=\{{ display: "flex", gap: "0.5rem" }}>
|
77
77
|
<TextField
|
78
|
-
placeholder="Статус"
|
79
|
-
|
78
|
+
placeholder="Статус positive"
|
79
|
+
view="positive"
|
80
80
|
size="m"
|
81
|
-
defaultValue="
|
81
|
+
defaultValue="Positive"
|
82
82
|
/>
|
83
83
|
<TextField
|
84
|
-
placeholder="Статус"
|
85
|
-
|
84
|
+
placeholder="Статус warning"
|
85
|
+
view="warning"
|
86
86
|
size="m"
|
87
|
-
defaultValue="
|
87
|
+
defaultValue="Warning"
|
88
88
|
/>
|
89
89
|
<TextField
|
90
|
-
placeholder="Статус"
|
91
|
-
|
90
|
+
placeholder="Статус Ошибка"
|
91
|
+
view="negative"
|
92
92
|
size="m"
|
93
|
-
defaultValue="
|
93
|
+
defaultValue="Negative"
|
94
94
|
/>
|
95
95
|
</div>
|
96
|
+
</div>
|
97
|
+
);
|
98
|
+
}
|
99
|
+
```
|
100
|
+
|
101
|
+
### Вариация Clear
|
102
|
+
На отображение компонента так же влияют свойства `clear` и `hasDivider`:
|
103
|
+
|
104
|
+
```tsx live
|
105
|
+
import React from 'react';
|
106
|
+
import { TextField } from '@salutejs/{{ package }}';
|
107
|
+
|
108
|
+
export function App() {
|
109
|
+
return (
|
110
|
+
<div style=\{{ display: "flex", flexDirection: "column", gap: "1rem" }}>
|
96
111
|
<div style=\{{ display: "flex", gap: "0.5rem" }}>
|
97
112
|
<TextField
|
98
|
-
placeholder="Статус"
|
99
|
-
|
113
|
+
placeholder="Статус positive"
|
114
|
+
view="positive"
|
100
115
|
size="m"
|
101
|
-
defaultValue="
|
116
|
+
defaultValue="Positive"
|
102
117
|
clear
|
103
118
|
hasDivider
|
104
119
|
/>
|
105
120
|
<TextField
|
106
|
-
placeholder="Статус"
|
107
|
-
|
121
|
+
placeholder="Статус warning"
|
122
|
+
view="warning"
|
108
123
|
size="m"
|
109
|
-
defaultValue="
|
124
|
+
defaultValue="Warning"
|
110
125
|
clear
|
111
126
|
hasDivider
|
112
127
|
/>
|
113
128
|
<TextField
|
114
|
-
placeholder="Статус"
|
115
|
-
|
129
|
+
placeholder="Статус negative"
|
130
|
+
view="negative"
|
116
131
|
size="m"
|
117
|
-
defaultValue="
|
132
|
+
defaultValue="Negative"
|
118
133
|
clear
|
119
134
|
hasDivider
|
120
135
|
/>
|
@@ -125,8 +140,11 @@ export function App() {
|
|
125
140
|
```
|
126
141
|
|
127
142
|
### Подсказка
|
128
|
-
Для вывода
|
129
|
-
|
143
|
+
Для вывода подсказок:
|
144
|
+
|
145
|
+
- `leftHelper` внизу слева под компонентом
|
146
|
+
- `titleCaption` сверху справа над компонентом
|
147
|
+
- `hintText` для подсказки в виде `Tooltip`
|
130
148
|
|
131
149
|
```tsx live
|
132
150
|
import React from 'react';
|
@@ -138,7 +156,7 @@ export function App() {
|
|
138
156
|
<TextField
|
139
157
|
placeholder="Введите значение"
|
140
158
|
defaultValue="Значение"
|
141
|
-
|
159
|
+
leftHelper="Подсказка снизу"
|
142
160
|
titleCaption="Подсказка сверху"
|
143
161
|
hintText="Подсказка в виде Tooltip"
|
144
162
|
hintView="default"
|
@@ -151,7 +169,9 @@ export function App() {
|
|
151
169
|
|
152
170
|
### Режим ввода
|
153
171
|
С помощью свойства `enumerationType` можно вводить элементы как теги. Свойство `chipType` изменяет внешний вид чипа.
|
154
|
-
|
172
|
+
|
173
|
+
С помощью `chipView` можно задать общий вид `Chip`. Валидация `Chip` происходит с помощью функции `chipValidator`.
|
174
|
+
|
155
175
|
По нажатию Enter, после ввода нужного текста, он преобразуется в Chip.
|
156
176
|
|
157
177
|
```tsx live
|
@@ -168,7 +188,7 @@ export function App() {
|
|
168
188
|
defaultValue="Значение"
|
169
189
|
size="l"
|
170
190
|
enumerationType="chip"
|
171
|
-
|
191
|
+
leftHelper="Подсказка снизу"
|
172
192
|
chips={["Значение 1", "Значение 2"]}
|
173
193
|
chipView="positive"
|
174
194
|
chipValidator={validateChip}
|
@@ -179,7 +199,7 @@ export function App() {
|
|
179
199
|
defaultValue="Значение"
|
180
200
|
size="l"
|
181
201
|
enumerationType="chip"
|
182
|
-
|
202
|
+
leftHelper="Подсказка снизу"
|
183
203
|
chips={["Значение 1"]}
|
184
204
|
chipType="text"
|
185
205
|
/>
|
@@ -188,9 +208,15 @@ export function App() {
|
|
188
208
|
}
|
189
209
|
```
|
190
210
|
|
191
|
-
|
192
211
|
### Обязательность поля
|
193
|
-
|
212
|
+
|
213
|
+
:::tip
|
214
|
+
Наличие индикатора регулируется свойством `hasRequiredIndicator`.
|
215
|
+
:::
|
216
|
+
|
217
|
+
Обязательность поля задаётся с помощью свойств `required` и `requiredPlacement`.
|
218
|
+
|
219
|
+
Где `requiredPlacement` отвечает за выравнивание и принимает значения `"left"` и `"right"`:
|
194
220
|
|
195
221
|
```tsx live
|
196
222
|
import React from 'react';
|
@@ -209,7 +235,66 @@ export function App() {
|
|
209
235
|
required
|
210
236
|
requiredPlacement="right"
|
211
237
|
/>
|
238
|
+
<TextField
|
239
|
+
placeholder="Введите значение"
|
240
|
+
label="Поле обязательное, но не имеет визуального индикатора"
|
241
|
+
required
|
242
|
+
requiredPlacement="right"
|
243
|
+
hasRequiredIndicator={false}
|
244
|
+
/>
|
212
245
|
</div>
|
213
246
|
);
|
214
247
|
}
|
215
248
|
```
|
249
|
+
|
250
|
+
## Примеры
|
251
|
+
|
252
|
+
### TextField + очистка поля
|
253
|
+
|
254
|
+
```tsx live
|
255
|
+
import React, { useState } from "react";
|
256
|
+
import { TextField } from "@salutejs/{{ package }}";
|
257
|
+
import { IconClose } from "@salutejs/plasma-icons";
|
258
|
+
|
259
|
+
export function App() {
|
260
|
+
const [value, setValue] = useState("");
|
261
|
+
|
262
|
+
const ControlClear = (props: { onClick: () => void }) => {
|
263
|
+
return (
|
264
|
+
<div {...props}>
|
265
|
+
<IconClose size="xs" color="inherit" />
|
266
|
+
</div>
|
267
|
+
);
|
268
|
+
};
|
269
|
+
|
270
|
+
return (
|
271
|
+
<div>
|
272
|
+
<TextField
|
273
|
+
placeholder="Положение иконки"
|
274
|
+
value={value}
|
275
|
+
onChange={(e) => {
|
276
|
+
setValue(e.target.value);
|
277
|
+
}}
|
278
|
+
contentRight={
|
279
|
+
<ControlClear
|
280
|
+
onClick={() => {
|
281
|
+
setValue("");
|
282
|
+
}}
|
283
|
+
/>
|
284
|
+
}
|
285
|
+
/>
|
286
|
+
</div>
|
287
|
+
);
|
288
|
+
}
|
289
|
+
```
|
290
|
+
|
291
|
+
## Клавиатурная навигация
|
292
|
+
|
293
|
+
Данный компонент может полностью управляться с помощью клавиатуры, используя следующие клавиши:
|
294
|
+
- по нажатию `Tab` фокусируемся на input
|
295
|
+
- если enumeratinType=`chip` после ввода текста, по нажатию `Enter`, input очистится и появится Chip
|
296
|
+
- если введен текст в input по нажатию `ArrowLeft` или `ArrowRight` каретка передвигается по тексту
|
297
|
+
- при достижении левой границы текста или отсутствии текста в input, при нажатии `Backspace` удаляем последний Chip, если он есть
|
298
|
+
- при достижении левой границы текста или отсутствии текста в input, при нажатии `ArrowLeft` переключаемся на последний Chip, если он есть
|
299
|
+
- при фокусе на Chip работает переключение фокуса на другие Chip по нажатию `ArrowLeft`, `ArrowRight`; если же Chip крайний правый, при нажатии `ArrowRight` фокус переходит на input
|
300
|
+
|
@@ -9,6 +9,11 @@ import { PropsTable, Description } from '@site/src/components';
|
|
9
9
|
<Description name="Toast" />
|
10
10
|
<PropsTable name="Toast" />
|
11
11
|
|
12
|
+
:::caution Устаревшие значения свойства `view`
|
13
|
+
Значения `dark` и `light` являются устаревшими.<br/>
|
14
|
+
Для изменения фона `Toast` используйте компонент `ViewContainer` (см. <a href="#пример-использования">пример использования</a>)
|
15
|
+
:::
|
16
|
+
|
12
17
|
## Система подсказок
|
13
18
|
Существует готовая система текстовых подсказок, для использования которой необходимо обернуть приложение в `ToastProvider`:
|
14
19
|
|
@@ -120,7 +125,6 @@ export interface ShowToastArgs {
|
|
120
125
|
```
|
121
126
|
|
122
127
|
## Пример использования
|
123
|
-
|
124
128
|
Для изменения цветовой темы компонента `Toast` используйте свойство `view` компонента `ViewContainer`.
|
125
129
|
|
126
130
|
```jsx live
|
@@ -130,7 +134,7 @@ import { useToast, ToastProvider, Button, ViewContainer } from '@salutejs/{{ pac
|
|
130
134
|
export function App() {
|
131
135
|
|
132
136
|
const ToastExample = () => {
|
133
|
-
const { showToast
|
137
|
+
const { showToast } = useToast()
|
134
138
|
|
135
139
|
const onShow = () => {}
|
136
140
|
const onHide = () => {}
|
@@ -168,3 +172,45 @@ export function App() {
|
|
168
172
|
)
|
169
173
|
}
|
170
174
|
```
|
175
|
+
|
176
|
+
## Вид иконки
|
177
|
+
Значения `positive` и `negative` свойства `view` изменяют цвет иконки.<br/>
|
178
|
+
Чтобы цвет применился, установите в иконке свойство `color` со значением `inherit`:
|
179
|
+
|
180
|
+
```jsx live
|
181
|
+
import React from 'react'
|
182
|
+
import { IconBell } from '@salutejs/plasma-icons';
|
183
|
+
import { useToast, ToastProvider, Button } from '@salutejs/{{ package }}'
|
184
|
+
|
185
|
+
export function App() {
|
186
|
+
const Icon = () => <IconBell color="inherit" size="xs" />;
|
187
|
+
|
188
|
+
const ToastExample = () => {
|
189
|
+
const { showToast } = useToast()
|
190
|
+
|
191
|
+
const onShow = () => {}
|
192
|
+
const onHide = () => {}
|
193
|
+
const toastData = {
|
194
|
+
contentLeft: <Icon />,
|
195
|
+
text: 'Подсказка c иконкой',
|
196
|
+
position: 'bottom',
|
197
|
+
role: 'status',
|
198
|
+
hasClose: true,
|
199
|
+
fade: false,
|
200
|
+
size: 'm',
|
201
|
+
view: 'positive',
|
202
|
+
timeout: 3000,
|
203
|
+
onShow,
|
204
|
+
onHide
|
205
|
+
}
|
206
|
+
|
207
|
+
return <Button onClick={() => showToast(toastData)} text="Вызвать подсказку" />
|
208
|
+
}
|
209
|
+
|
210
|
+
return (
|
211
|
+
<ToastProvider>
|
212
|
+
<ToastExample />
|
213
|
+
</ToastProvider>
|
214
|
+
)
|
215
|
+
}
|
216
|
+
```
|
@@ -17,13 +17,28 @@ import { PropsTable, Description } from '@site/src/components';
|
|
17
17
|
|
18
18
|
```tsx live
|
19
19
|
import React from 'react';
|
20
|
-
import { Tooltip } from '@salutejs/{{ package }}';
|
21
|
-
import { IconApps } from '@salutejs/plasma-icons';
|
20
|
+
import { Tooltip, Button } from '@salutejs/{{ package }}';
|
22
21
|
|
23
22
|
export function App() {
|
24
23
|
return (
|
25
|
-
<div style=\{{
|
26
|
-
<Tooltip
|
24
|
+
<div style=\{{display: 'grid', gridTemplateColumns: 'repeat(3, max-content)', gridGap: '1rem 3.5rem', padding: '3.5rem'}}>
|
25
|
+
<Tooltip
|
26
|
+
target={<Tooltip target={<Button>Btn</Button>} placement="left" opened text="left" />}
|
27
|
+
placement="top-start"
|
28
|
+
opened
|
29
|
+
text="top-start"
|
30
|
+
view="default"
|
31
|
+
/>
|
32
|
+
<Tooltip target={<Button>Btn</Button>} placement="top" opened text="top" />
|
33
|
+
<Tooltip
|
34
|
+
target={<Tooltip target={<Button>Btn</Button>} placement="right" opened text="right" />}
|
35
|
+
placement="top-end"
|
36
|
+
opened
|
37
|
+
text="top-end"
|
38
|
+
/>
|
39
|
+
<Tooltip target={<Button>Btn</Button>} placement="bottom-start" opened text="bottom-start" />
|
40
|
+
<Tooltip target={<Button>Btn</Button>} placement="bottom" opened text="bottom" />
|
41
|
+
<Tooltip target={<Button>Btn</Button>} placement="bottom-end" opened text="bottom-end" />
|
27
42
|
</div>
|
28
43
|
);
|
29
44
|
}
|