@salutejs/plasma-new-hope 0.67.0-canary.1148.8443817650.0 → 0.67.0-canary.1148.8449317874.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Cell/Cell.js +3 -0
- package/cjs/components/Cell/Cell.js.map +1 -1
- package/cjs/components/Cell/Cell.tokens.js +2 -3
- package/cjs/components/Cell/Cell.tokens.js.map +1 -1
- package/es/components/Cell/Cell.js +3 -0
- package/es/components/Cell/Cell.js.map +1 -1
- package/es/components/Cell/Cell.tokens.js +2 -3
- package/es/components/Cell/Cell.tokens.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Avatar/Avatar.template-doc.mdx +97 -0
- package/styled-components/cjs/components/AvatarGroup/AvatarGroup.template-doc.mdx +29 -0
- package/styled-components/cjs/components/Badge/Badge.template-doc.mdx +131 -0
- package/styled-components/cjs/components/Button/Button.template-doc.mdx +162 -0
- package/styled-components/cjs/components/ButtonGroup/ButtonGroup.template-doc.mdx +123 -0
- package/styled-components/cjs/components/Calendar/Calendar.template-doc.mdx +208 -0
- package/styled-components/cjs/components/Cell/Cell.js +3 -0
- package/styled-components/cjs/components/Cell/Cell.tokens.js +2 -3
- package/styled-components/cjs/components/Checkbox/Checkbox.template-doc.mdx +44 -0
- package/styled-components/cjs/components/Chip/Chip.template-doc.mdx +90 -0
- package/styled-components/cjs/components/Combobox/Combobox.template-doc.mdx +237 -0
- package/styled-components/cjs/components/Counter/Counter.template-doc.mdx +76 -0
- package/styled-components/cjs/components/Drawer/Drawer.template-doc.mdx +170 -0
- package/styled-components/cjs/components/Dropdown/Dropdown.template-doc.mdx +80 -0
- package/styled-components/cjs/components/Grid/Grid.template-doc.mdx +142 -0
- package/styled-components/cjs/components/Image/Image.template-doc.mdx +26 -0
- package/styled-components/cjs/components/Indicator/Indicator.template-doc.mdx +76 -0
- package/styled-components/cjs/components/Link/Link.template-doc.mdx +23 -0
- package/styled-components/cjs/components/Modal/Modal.template-doc.mdx +56 -0
- package/styled-components/cjs/components/Notification/Notification.template-doc.mdx +59 -0
- package/styled-components/cjs/components/Overlay/Overlay.template-doc.mdx +10 -0
- package/styled-components/cjs/components/Popover/Popover.template-doc.mdx +72 -0
- package/styled-components/cjs/components/Popup/Popup.template-doc.mdx +209 -0
- package/styled-components/cjs/components/Radiobox/Radiobox.template-doc.mdx +38 -0
- package/styled-components/cjs/components/Segment/Segment.template-doc.mdx +61 -0
- package/styled-components/cjs/components/Select/Select.template-doc.mdx +115 -0
- package/styled-components/cjs/components/Skeleton/Skeleton.template-doc.mdx +103 -0
- package/styled-components/cjs/components/Spinner/Spinner.template-doc.mdx +21 -0
- package/styled-components/cjs/components/Switch/Switch.template-doc.mdx +24 -0
- package/styled-components/cjs/components/Tabs/Tabs.template-doc.mdx +94 -0
- package/styled-components/cjs/components/TextArea/TextArea.template-doc.mdx +88 -0
- package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +112 -0
- package/styled-components/cjs/components/Toast/Toast.template-doc.mdx +153 -0
- package/styled-components/cjs/components/Tooltip/Tooltip.template-doc.mdx +30 -0
- package/styled-components/cjs/components/Typography/Typography.template-doc.mdx +127 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Cell/Cell.config.js +5 -5
- package/styled-components/cjs/examples/plasma_b2c/components/Cell/Cell.stories.tsx +16 -19
- package/styled-components/cjs/examples/plasma_web/components/Cell/Cell.config.js +5 -5
- package/styled-components/cjs/examples/plasma_web/components/Cell/Cell.stories.tsx +16 -19
- package/styled-components/es/components/Avatar/Avatar.template-doc.mdx +97 -0
- package/styled-components/es/components/AvatarGroup/AvatarGroup.template-doc.mdx +29 -0
- package/styled-components/es/components/Badge/Badge.template-doc.mdx +131 -0
- package/styled-components/es/components/Button/Button.template-doc.mdx +162 -0
- package/styled-components/es/components/ButtonGroup/ButtonGroup.template-doc.mdx +123 -0
- package/styled-components/es/components/Calendar/Calendar.template-doc.mdx +208 -0
- package/styled-components/es/components/Cell/Cell.js +3 -0
- package/styled-components/es/components/Cell/Cell.tokens.js +2 -3
- package/styled-components/es/components/Checkbox/Checkbox.template-doc.mdx +44 -0
- package/styled-components/es/components/Chip/Chip.template-doc.mdx +90 -0
- package/styled-components/es/components/Combobox/Combobox.template-doc.mdx +237 -0
- package/styled-components/es/components/Counter/Counter.template-doc.mdx +76 -0
- package/styled-components/es/components/Drawer/Drawer.template-doc.mdx +170 -0
- package/styled-components/es/components/Dropdown/Dropdown.template-doc.mdx +80 -0
- package/styled-components/es/components/Grid/Grid.template-doc.mdx +142 -0
- package/styled-components/es/components/Image/Image.template-doc.mdx +26 -0
- package/styled-components/es/components/Indicator/Indicator.template-doc.mdx +76 -0
- package/styled-components/es/components/Link/Link.template-doc.mdx +23 -0
- package/styled-components/es/components/Modal/Modal.template-doc.mdx +56 -0
- package/styled-components/es/components/Notification/Notification.template-doc.mdx +59 -0
- package/styled-components/es/components/Overlay/Overlay.template-doc.mdx +10 -0
- package/styled-components/es/components/Popover/Popover.template-doc.mdx +72 -0
- package/styled-components/es/components/Popup/Popup.template-doc.mdx +209 -0
- package/styled-components/es/components/Radiobox/Radiobox.template-doc.mdx +38 -0
- package/styled-components/es/components/Segment/Segment.template-doc.mdx +61 -0
- package/styled-components/es/components/Select/Select.template-doc.mdx +115 -0
- package/styled-components/es/components/Skeleton/Skeleton.template-doc.mdx +103 -0
- package/styled-components/es/components/Spinner/Spinner.template-doc.mdx +21 -0
- package/styled-components/es/components/Switch/Switch.template-doc.mdx +24 -0
- package/styled-components/es/components/Tabs/Tabs.template-doc.mdx +94 -0
- package/styled-components/es/components/TextArea/TextArea.template-doc.mdx +88 -0
- package/styled-components/es/components/TextField/TextField.template-doc.mdx +112 -0
- package/styled-components/es/components/Toast/Toast.template-doc.mdx +153 -0
- package/styled-components/es/components/Tooltip/Tooltip.template-doc.mdx +30 -0
- package/styled-components/es/components/Typography/Typography.template-doc.mdx +127 -0
- package/styled-components/es/examples/plasma_b2c/components/Cell/Cell.config.js +5 -5
- package/styled-components/es/examples/plasma_b2c/components/Cell/Cell.stories.tsx +16 -19
- package/styled-components/es/examples/plasma_web/components/Cell/Cell.config.js +5 -5
- package/styled-components/es/examples/plasma_web/components/Cell/Cell.stories.tsx +16 -19
- package/types/components/Cell/Cell.d.ts +4 -2
- package/types/components/Cell/Cell.d.ts.map +1 -1
- package/types/components/Cell/Cell.tokens.d.ts +0 -1
- package/types/components/Cell/Cell.tokens.d.ts.map +1 -1
- package/types/components/Cell/Cell.types.d.ts +5 -2
- package/types/components/Cell/Cell.types.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Cell/Cell.d.ts +2 -1
- package/types/examples/plasma_b2c/components/Cell/Cell.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Cell/Cell.d.ts +2 -1
- package/types/examples/plasma_web/components/Cell/Cell.d.ts.map +1 -1
@@ -0,0 +1,170 @@
|
|
1
|
+
---
|
2
|
+
id: drawer
|
3
|
+
title: Drawer
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Drawer
|
9
|
+
<Description name="Drawer" />
|
10
|
+
<PropsTable name="Drawer" />
|
11
|
+
|
12
|
+
### Использование
|
13
|
+
|
14
|
+
Перед использованием убедитесь, что `PopupProvider` подключен.
|
15
|
+
|
16
|
+
```tsx title="index.ts"
|
17
|
+
import ReactDOM from 'react-dom';
|
18
|
+
import { PopupProvider } from '@salutejs/{{ package }}';
|
19
|
+
|
20
|
+
import { App } from './App';
|
21
|
+
|
22
|
+
ReactDOM.render(
|
23
|
+
<PopupProvider>
|
24
|
+
<App />
|
25
|
+
</PopupProvider>,
|
26
|
+
document.getElementById('root')
|
27
|
+
);
|
28
|
+
```
|
29
|
+
|
30
|
+
### Отображения Drawer
|
31
|
+
|
32
|
+
Drawer можно использовать как и на всем окне, так и в отдельном фрейме - свойство `frame`.
|
33
|
+
Также это свойство поддерживает передачу id элемента, в котором будет использоваться компонент.
|
34
|
+
Само позиционирование можно указать с помощью свойства `placement`(left - по умолчанию, right, top, bottom),
|
35
|
+
а также определить отступы от точки с помощью `offset`.
|
36
|
+
|
37
|
+
У компонента Drawer есть 2 режима отображения:
|
38
|
+
модальный - добавляет при этом подложку(`overlay`), а также блокирует скролл и фокус;
|
39
|
+
немодальный - нет подложки, скролл и фокус не заблокированы.
|
40
|
+
|
41
|
+
```tsx live
|
42
|
+
import React, { useRef } from 'react';
|
43
|
+
import { IconDone } from '@salutejs/plasma-icons';
|
44
|
+
import { surfaceSolidSecondary } from '@salutejs/{{ theme }}';
|
45
|
+
|
46
|
+
import { SSRProvider, H3, Button, Drawer, DrawerHeader, DrawerContent, DrawerFooter, PopupProvider } from '@salutejs/{{ package }}';
|
47
|
+
|
48
|
+
export function App() {
|
49
|
+
const [isOpenA, setIsOpenA] = React.useState(false);
|
50
|
+
const [isOpenB, setIsOpenB] = React.useState(false);
|
51
|
+
|
52
|
+
const ref = useRef();
|
53
|
+
|
54
|
+
return (
|
55
|
+
<SSRProvider>
|
56
|
+
<PopupProvider>
|
57
|
+
<div style=\{{height: "500px"}}>
|
58
|
+
<div style=\{{ display: "flex", flexDirection: "column" }}>
|
59
|
+
<Button
|
60
|
+
text="Открыть в document"
|
61
|
+
onClick={() => setIsOpenA(true)}
|
62
|
+
style=\{{
|
63
|
+
marginTop: "1rem",
|
64
|
+
width: "15rem"
|
65
|
+
}}
|
66
|
+
/>
|
67
|
+
<Button
|
68
|
+
text="Открыть во Frame"
|
69
|
+
onClick={() => setIsOpenB(true)}
|
70
|
+
style=\{{
|
71
|
+
marginTop: "1rem",
|
72
|
+
width: "15rem"
|
73
|
+
}}
|
74
|
+
/>
|
75
|
+
</div>
|
76
|
+
<Drawer
|
77
|
+
id="drawerA"
|
78
|
+
isOpen={isOpenA}
|
79
|
+
onClose={() => setIsOpenA(false)}
|
80
|
+
placement="right"
|
81
|
+
withBlur={false}
|
82
|
+
closeOnEsc={true}
|
83
|
+
closeOnOverlayClick={true}
|
84
|
+
asModal={true}
|
85
|
+
width="25vw"
|
86
|
+
height="100vh"
|
87
|
+
>
|
88
|
+
<DrawerHeader
|
89
|
+
hasClose={true}
|
90
|
+
closePlacement="right"
|
91
|
+
actions={(
|
92
|
+
<Button size="s" view="clear" style=\{{
|
93
|
+
position: "relative",
|
94
|
+
width: "1.5rem",
|
95
|
+
height: "1.5rem"
|
96
|
+
}}>
|
97
|
+
<IconDone size="s" />
|
98
|
+
</Button>
|
99
|
+
)}
|
100
|
+
onClose={() => setIsOpenA(false)}
|
101
|
+
>
|
102
|
+
<H3>Header</H3>
|
103
|
+
</DrawerHeader>
|
104
|
+
|
105
|
+
<DrawerContent>Content</DrawerContent>
|
106
|
+
|
107
|
+
<DrawerFooter>
|
108
|
+
<H3>Footer</H3>
|
109
|
+
</DrawerFooter>
|
110
|
+
</Drawer>
|
111
|
+
<div
|
112
|
+
ref={ref}
|
113
|
+
style=\{{
|
114
|
+
marginTop: "1rem",
|
115
|
+
width: "400px",
|
116
|
+
height: "500px",
|
117
|
+
background: surfaceSolidSecondary,
|
118
|
+
position: "absolute",
|
119
|
+
|
120
|
+
display: "flex",
|
121
|
+
alignItems: "flex-start",
|
122
|
+
justifyContent: "center",
|
123
|
+
padding: "1rem",
|
124
|
+
|
125
|
+
bottom: 0,
|
126
|
+
right: 0
|
127
|
+
}}
|
128
|
+
>
|
129
|
+
<>Frame</>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<Drawer
|
133
|
+
id="drawerB"
|
134
|
+
isOpen={isOpenB}
|
135
|
+
onClose={() => setIsOpenB(false)}
|
136
|
+
placement="right"
|
137
|
+
asModal={false}
|
138
|
+
frame={ref}
|
139
|
+
width="250px"
|
140
|
+
height="100%"
|
141
|
+
>
|
142
|
+
<DrawerHeader
|
143
|
+
hasClose={true}
|
144
|
+
closePlacement="right"
|
145
|
+
actions={(
|
146
|
+
<Button size="s" view="clear" style=\{{
|
147
|
+
position: "relative",
|
148
|
+
width: "1.5rem",
|
149
|
+
height: "1.5rem"
|
150
|
+
}}>
|
151
|
+
<IconDone size="s" />
|
152
|
+
</Button>
|
153
|
+
)}
|
154
|
+
onClose={() => setIsOpenB(false)}
|
155
|
+
>
|
156
|
+
<H3>Header</H3>
|
157
|
+
</DrawerHeader>
|
158
|
+
|
159
|
+
<DrawerContent>Content</DrawerContent>
|
160
|
+
|
161
|
+
<DrawerFooter>
|
162
|
+
<H3>Footer</H3>
|
163
|
+
</DrawerFooter>
|
164
|
+
</Drawer>
|
165
|
+
</div>
|
166
|
+
</PopupProvider>
|
167
|
+
</SSRProvider>
|
168
|
+
);
|
169
|
+
}
|
170
|
+
```
|
@@ -0,0 +1,80 @@
|
|
1
|
+
---
|
2
|
+
id: dropdown
|
3
|
+
title: Dropdown
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Dropdown
|
9
|
+
Набор компонентов для создания выпадающих списков.
|
10
|
+
|
11
|
+
<Description name="Dropdown" />
|
12
|
+
<PropsTable name="Dropdown" exclude={['css']} />
|
13
|
+
|
14
|
+
# DropdownItem
|
15
|
+
|
16
|
+
<Description name="DropdownItem" />
|
17
|
+
<PropsTable name="DropdownItem" exclude={['css']} />
|
18
|
+
|
19
|
+
## Использование
|
20
|
+
|
21
|
+
```tsx live
|
22
|
+
import React, { useState } from 'react';
|
23
|
+
import { Dropdown, DropdownItem } from '@salutejs/{{ package }}';
|
24
|
+
import { surfaceSolidSecondary } from '@salutejs/{{ theme }}';
|
25
|
+
|
26
|
+
export function App() {
|
27
|
+
const [selected, setSelected] = useState('');
|
28
|
+
const [isOpen, setIsOpen] = useState(false);
|
29
|
+
|
30
|
+
const handleSelect = (value: string, text: string) => {
|
31
|
+
setSelected(value);
|
32
|
+
setIsOpen(false);
|
33
|
+
};
|
34
|
+
|
35
|
+
const getDropdownItems = (slug: string, elemCount: number) =>
|
36
|
+
[...Array(elemCount).keys()].map((num) => ({
|
37
|
+
value: `${slug}_${num}`,
|
38
|
+
child: `${slug} ${num}`,
|
39
|
+
}));
|
40
|
+
|
41
|
+
return (
|
42
|
+
<div style=\{{height: "400px", background: surfaceSolidSecondary, padding: "1rem" }}>
|
43
|
+
<Dropdown
|
44
|
+
target={<Button>Target</Button>}
|
45
|
+
isOpen={isOpen}
|
46
|
+
onToggle={() => {
|
47
|
+
setIsOpen(!isOpen);
|
48
|
+
}}
|
49
|
+
offset={[10, 15]}
|
50
|
+
view="primary"
|
51
|
+
size="m"
|
52
|
+
placement="right"
|
53
|
+
trigger="click"
|
54
|
+
closeOnOverlayClick={false}
|
55
|
+
closeOnEsc
|
56
|
+
isFocusTrapped
|
57
|
+
>
|
58
|
+
{getDropdownItems('item', 6).map((item) => (
|
59
|
+
<DropdownItem
|
60
|
+
key={item.value}
|
61
|
+
isSelected={Boolean(item.value === selected)}
|
62
|
+
onSelect={() => handleSelect(item.value, item.child)}
|
63
|
+
value={item.value}
|
64
|
+
>
|
65
|
+
{item.child}
|
66
|
+
</DropdownItem>
|
67
|
+
))}
|
68
|
+
<DropdownItem
|
69
|
+
isSelected={selected === 'disabled'}
|
70
|
+
onSelect={() => handleSelect('disabled', 'disabled')}
|
71
|
+
value="disabled"
|
72
|
+
disabled
|
73
|
+
>
|
74
|
+
disabled
|
75
|
+
</DropdownItem>
|
76
|
+
</Dropdown>
|
77
|
+
</div>
|
78
|
+
);
|
79
|
+
}
|
80
|
+
```
|
@@ -0,0 +1,142 @@
|
|
1
|
+
---
|
2
|
+
id: grid
|
3
|
+
title: Grid
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Grid
|
9
|
+
Набор компонентов для создания сетки.
|
10
|
+
|
11
|
+
## Breakpoints
|
12
|
+
Каждый breakpoints разрешения содержит собственное максимальное количество колонок:
|
13
|
+
|
14
|
+
| Обозначение | Ширина от, px | Ширина до, px | Кол-во колонок |
|
15
|
+
|-------------|---------------|---------------|----------------|
|
16
|
+
| largeM | 1200 | - | 30 |
|
17
|
+
| largeS | 960 | 1199 | 24 |
|
18
|
+
| mediumM | 786 | 959 | 18 |
|
19
|
+
| mediumS | 560 | 785 | 12 |
|
20
|
+
| smallS | 0 | 559 | 6 |
|
21
|
+
|
22
|
+
## Grid
|
23
|
+
<Description name="Grid" />
|
24
|
+
<PropsTable name="Grid" />
|
25
|
+
|
26
|
+
## Row
|
27
|
+
Блок с отрицательными отступами для размещения колонок (`Col`) по горизонтали.
|
28
|
+
Блок нельзя вкладывать сам в себя, но можно чередовать далее по дереву с использованием `Col`.
|
29
|
+
Стилизованный компонент, обладающий всеми свойствами `div`.
|
30
|
+
|
31
|
+
## Col
|
32
|
+
<Description name="Col" />
|
33
|
+
<PropsTable name="Col" />
|
34
|
+
|
35
|
+
## Примеры
|
36
|
+
|
37
|
+
### Базовое применение
|
38
|
+
Размеры колонок указываются свойством `size`, отступ — свойством `offset`.
|
39
|
+
|
40
|
+
```tsx live
|
41
|
+
import React from 'react';
|
42
|
+
import { Grid, Row, Col } from '@salutejs/{{ package }}';
|
43
|
+
|
44
|
+
export function App() {
|
45
|
+
const Filler = ({children}) => {
|
46
|
+
return (
|
47
|
+
<div
|
48
|
+
style=\{{
|
49
|
+
display: 'flex',
|
50
|
+
alignItems: 'center',
|
51
|
+
justifyContent: 'center',
|
52
|
+
width: '100%',
|
53
|
+
padding: '0.5rem 1rem',
|
54
|
+
backgroundColor: '#f0f0f0',
|
55
|
+
}}
|
56
|
+
>
|
57
|
+
{children}
|
58
|
+
</div>
|
59
|
+
)
|
60
|
+
};
|
61
|
+
|
62
|
+
return (
|
63
|
+
<Grid>
|
64
|
+
<Row>
|
65
|
+
<Col size={3}>
|
66
|
+
<Filler>3</Filler>
|
67
|
+
</Col>
|
68
|
+
<Col size={2}>
|
69
|
+
<Filler>2</Filler>
|
70
|
+
</Col>
|
71
|
+
<Col size={3}>
|
72
|
+
<Filler>3</Filler>
|
73
|
+
</Col>
|
74
|
+
<Col size={4}>
|
75
|
+
<Filler>4</Filler>
|
76
|
+
</Col>
|
77
|
+
<Col size={6}>
|
78
|
+
<Filler>6</Filler>
|
79
|
+
</Col>
|
80
|
+
</Row>
|
81
|
+
<Row>
|
82
|
+
<Col size={4} offset={1}>
|
83
|
+
<Filler>4 offset 1</Filler>
|
84
|
+
</Col>
|
85
|
+
<Col size={6} offset={2}>
|
86
|
+
<Filler>6 offset 2</Filler>
|
87
|
+
</Col>
|
88
|
+
</Row>
|
89
|
+
</Grid>
|
90
|
+
);
|
91
|
+
}
|
92
|
+
```
|
93
|
+
|
94
|
+
### Адаптивные размеры и отступы колонок
|
95
|
+
Свойства `size` и `offset` могут быть адаптивными.
|
96
|
+
Для этого добавьте соответствующие свойства с нужными [breakpoints](#Breakpoints).
|
97
|
+
При этом, `size` и `offset` могут выступать как fallback-значения для остальных разрешений.
|
98
|
+
|
99
|
+
```tsx live
|
100
|
+
import React from 'react';
|
101
|
+
import { Grid, Row, Col } from '@salutejs/{{ package }}';
|
102
|
+
|
103
|
+
export function App() {
|
104
|
+
const Filler = ({children}) => {
|
105
|
+
return (
|
106
|
+
<div
|
107
|
+
style=\{{
|
108
|
+
display: 'flex',
|
109
|
+
alignItems: 'center',
|
110
|
+
justifyContent: 'center',
|
111
|
+
width: '100%',
|
112
|
+
padding: '0.5rem 1rem',
|
113
|
+
backgroundColor: '#f0f0f0',
|
114
|
+
}}
|
115
|
+
>
|
116
|
+
{children}
|
117
|
+
</div>
|
118
|
+
)
|
119
|
+
};
|
120
|
+
|
121
|
+
return (
|
122
|
+
<Grid>
|
123
|
+
<Row>
|
124
|
+
<Col smallM=\{{ size: 1 }} mediumS=\{{ size: 2 }} mediumM=\{{ size: 3 }} largeM=\{{ size: 4 }}>
|
125
|
+
<Filler>1</Filler>
|
126
|
+
</Col>
|
127
|
+
<Col size={2} largeM=\{{ size: 4 }}>
|
128
|
+
<Filler>2</Filler>
|
129
|
+
</Col>
|
130
|
+
</Row>
|
131
|
+
<Row>
|
132
|
+
<Col size={4} smallM=\{{ offset: 1 }} mediumS=\{{ offset: 2 }} mediumM=\{{ offset: 3 }} largeM=\{{ offset: 4 }}>
|
133
|
+
<Filler>4 offset 1</Filler>
|
134
|
+
</Col>
|
135
|
+
<Col size={6} offset={2} largeM=\{{ offset: 4 }}>
|
136
|
+
<Filler>6 offset 2</Filler>
|
137
|
+
</Col>
|
138
|
+
</Row>
|
139
|
+
</Grid>
|
140
|
+
);
|
141
|
+
}
|
142
|
+
```
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
id: image
|
3
|
+
title: Image
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Image
|
9
|
+
<Description name="Image" />
|
10
|
+
<PropsTable name="Image" />
|
11
|
+
|
12
|
+
```tsx live
|
13
|
+
import React from 'react';
|
14
|
+
import { Image } from '@salutejs/{{ package }}';
|
15
|
+
|
16
|
+
export function App() {
|
17
|
+
return (
|
18
|
+
<Image
|
19
|
+
src="/web/images/320_320_9.jpg"
|
20
|
+
width="320px"
|
21
|
+
height="320px"
|
22
|
+
alt="Картинка для примера фоном"
|
23
|
+
/>
|
24
|
+
);
|
25
|
+
}
|
26
|
+
```
|
@@ -0,0 +1,76 @@
|
|
1
|
+
---
|
2
|
+
id: indicator
|
3
|
+
title: Indicator
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Indicator
|
9
|
+
Индикаторы могут отображаться в нескольких размерах и цветах.
|
10
|
+
|
11
|
+
## Indicator
|
12
|
+
<Description name="Indicator" />
|
13
|
+
<PropsTable name="Indicator" exclude={['css']} />
|
14
|
+
|
15
|
+
## Примеры
|
16
|
+
|
17
|
+
### Базовое использование
|
18
|
+
|
19
|
+
```tsx live
|
20
|
+
import React from 'react';
|
21
|
+
import { Indicator } from '@salutejs/{{ package }}';
|
22
|
+
|
23
|
+
export function App() {
|
24
|
+
return (
|
25
|
+
<div>
|
26
|
+
<div style=\{{ display: 'flex' }}>
|
27
|
+
<Indicator size="s" view="default" />
|
28
|
+
<Indicator size="m" view="default" />
|
29
|
+
<Indicator size="l" view="default" />
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div style=\{{ display: 'flex' }}>
|
33
|
+
<Indicator size="s" view="accent" />
|
34
|
+
<Indicator size="m" view="accent" />
|
35
|
+
<Indicator size="l" view="accent" />
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div style=\{{ display: 'flex' }}>
|
39
|
+
<Indicator size="s" view="inactive" />
|
40
|
+
<Indicator size="m" view="inactive" />
|
41
|
+
<Indicator size="l" view="inactive" />
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div style=\{{ display: 'flex' }}>
|
45
|
+
<Indicator size="s" view="positive" />
|
46
|
+
<Indicator size="m" view="positive" />
|
47
|
+
<Indicator size="l" view="positive" />
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<div style=\{{ display: 'flex' }}>
|
51
|
+
<Indicator size="s" view="warning" />
|
52
|
+
<Indicator size="m" view="warning" />
|
53
|
+
<Indicator size="l" view="warning" />
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<div style=\{{ display: 'flex' }}>
|
57
|
+
<Indicator size="s" view="negative" />
|
58
|
+
<Indicator size="m" view="negative" />
|
59
|
+
<Indicator size="l" view="negative" />
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div style=\{{ display: 'flex' }}>
|
63
|
+
<Indicator size="s" view="black" />
|
64
|
+
<Indicator size="m" view="black" />
|
65
|
+
<Indicator size="l" view="black" />
|
66
|
+
</div>
|
67
|
+
|
68
|
+
<div style=\{{ display: 'flex' }}>
|
69
|
+
<Indicator size="s" view="white" />
|
70
|
+
<Indicator size="m" view="white" />
|
71
|
+
<Indicator size="l" view="white" />
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
);
|
75
|
+
}
|
76
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
id: link
|
3
|
+
title: Link
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Link
|
9
|
+
<Description name="Link" />
|
10
|
+
<PropsTable name="Link" exclude={['css', 'focused']} />
|
11
|
+
|
12
|
+
```tsx live
|
13
|
+
import React from 'react';
|
14
|
+
import { P1, Link } from '@salutejs/{{ package }}';
|
15
|
+
|
16
|
+
export function App() {
|
17
|
+
return (
|
18
|
+
<P1>
|
19
|
+
Скачайте <Link href="/" target="_blank">приложение</Link>.
|
20
|
+
</P1>
|
21
|
+
);
|
22
|
+
}
|
23
|
+
```
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
id: modal
|
3
|
+
title: Modal
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Modal
|
9
|
+
<Description name="Modal" />
|
10
|
+
<PropsTable name="Modal" />
|
11
|
+
|
12
|
+
## Использование
|
13
|
+
|
14
|
+
### Провайдер контекста
|
15
|
+
Поместите `ModalsProvider` в [корень приложения](../../#корень-приложения) или там, где будете применять модальные окна:
|
16
|
+
|
17
|
+
```tsx title="index.ts"
|
18
|
+
import ReactDOM from 'react-dom';
|
19
|
+
import { ModalsProvider } from '@salutejs/{{ package }}';
|
20
|
+
|
21
|
+
import { App } from './App';
|
22
|
+
|
23
|
+
ReactDOM.render(
|
24
|
+
<ModalsProvider>
|
25
|
+
<App />
|
26
|
+
</ModalsProvider>,
|
27
|
+
document.getElementById('root')
|
28
|
+
);
|
29
|
+
```
|
30
|
+
|
31
|
+
### Вызов модального окна
|
32
|
+
После подключения `ModalsProvider` поместите компонент `Modal` туда, где необходимо применить модальное окно:
|
33
|
+
|
34
|
+
```tsx live
|
35
|
+
import React from 'react';
|
36
|
+
import { Modal, Headline3, P1, Button } from '@salutejs/{{ package }}';
|
37
|
+
|
38
|
+
export function App() {
|
39
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
40
|
+
|
41
|
+
const close = React.useCallback(() => {
|
42
|
+
setIsOpen(false);
|
43
|
+
}, []);
|
44
|
+
|
45
|
+
return (
|
46
|
+
<div>
|
47
|
+
<Button text="Открыть модальное окно" onClick={() => setIsOpen(!isOpen)} />
|
48
|
+
<Modal isOpen={isOpen} onClose={close}>
|
49
|
+
<Headline3 mb={10}>Модальное окно</Headline3>
|
50
|
+
<P1>Содержимое модального окна.</P1>
|
51
|
+
<Button text="Закрыть" onClick={close} />
|
52
|
+
</Modal>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
```
|
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
id: notification
|
3
|
+
title: Notification
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Notification
|
9
|
+
<Description name="Notification" />
|
10
|
+
<PropsTable name="Notification" />
|
11
|
+
|
12
|
+
## Использование
|
13
|
+
Компонент `Notification` может использоваться для создания собственных систем оповещения.
|
14
|
+
Вид компонента контролируется свойствами (props).
|
15
|
+
Текстовая часть оповещения состоит из `title` и `children`.
|
16
|
+
Слева или сверху от нее, также можно пробросить иконку через свойство `icon`.
|
17
|
+
Также есть часть `actions`, в которой предполагается отображение кнопок для взаимодействия.
|
18
|
+
|
19
|
+
### Провайдер контекста
|
20
|
+
Поместите `NotificationsProvider` в [корень приложения](../../#корень-приложения) или там, где будете применять модальные окна:
|
21
|
+
|
22
|
+
```tsx title="index.ts"
|
23
|
+
import ReactDOM from 'react-dom';
|
24
|
+
import { NotificationsProvider } from '@salutejs/{{ package }}';
|
25
|
+
|
26
|
+
import { App } from './App';
|
27
|
+
|
28
|
+
ReactDOM.render(
|
29
|
+
<NotificationsProvider>
|
30
|
+
<App />
|
31
|
+
</NotificationsProvider>,
|
32
|
+
document.getElementById('root')
|
33
|
+
);
|
34
|
+
```
|
35
|
+
|
36
|
+
### Вызов уведомления
|
37
|
+
После подключения `NotificationsProvider` станет возможен вызов функции `addNotification`,
|
38
|
+
который приведет к отображению оповещения.
|
39
|
+
Функция принимает значения свойств компонента `Notification`:
|
40
|
+
|
41
|
+
```tsx live
|
42
|
+
import React from 'react';
|
43
|
+
import { Button, addNotification, NotificationsProvider } from '@salutejs/{{ package }}';
|
44
|
+
|
45
|
+
export function App() {
|
46
|
+
const handleClick = React.useCallback(() => {
|
47
|
+
addNotification({
|
48
|
+
title: 'Входящий вызов',
|
49
|
+
children: 'Принять?',
|
50
|
+
}, 1000);
|
51
|
+
}, []);
|
52
|
+
|
53
|
+
return (
|
54
|
+
<NotificationsProvider>
|
55
|
+
<Button text="Показать оповещение" onClick={handleClick} />
|
56
|
+
</NotificationsProvider>
|
57
|
+
);
|
58
|
+
}
|
59
|
+
```
|