@salutejs/plasma-new-hope 0.67.0-canary.1148.8444175533.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,123 @@
|
|
1
|
+
---
|
2
|
+
id: buttonGroup
|
3
|
+
title: ButtonGroup
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# ButtonGroup
|
9
|
+
<Description name="ButtonGroup" />
|
10
|
+
<PropsTable name="ButtonGroup" exclude={['css']} />
|
11
|
+
|
12
|
+
## Использование
|
13
|
+
Компонент `ButtonGroup` - это обертка для Button. Принимает в себя группу кнопок.
|
14
|
+
|
15
|
+
```tsx live
|
16
|
+
import React from 'react';
|
17
|
+
import { ButtonGroup, Button } from '@salutejs/{{ package }}';
|
18
|
+
|
19
|
+
export function App() {
|
20
|
+
return (
|
21
|
+
<ButtonGroup>
|
22
|
+
{Array(5)
|
23
|
+
.fill(true)
|
24
|
+
.map((_, i) => (
|
25
|
+
<Button text={`Button ${i}`} />
|
26
|
+
))}
|
27
|
+
</ButtonGroup>
|
28
|
+
);
|
29
|
+
}
|
30
|
+
```
|
31
|
+
|
32
|
+
## Примеры
|
33
|
+
|
34
|
+
### Размер и вид группы кнопок
|
35
|
+
Размер и вид группы кнопок задается с помощью свойств `size` и `view` соответственно.
|
36
|
+
С помощью свойства `isCommonButtonStyles` можно отключить переопределение стилей для всех кнопок внутри группы.
|
37
|
+
Тогда каждая кнопка будет иметь настраиваемый размер и вид.
|
38
|
+
|
39
|
+
```tsx live
|
40
|
+
import React from 'react';
|
41
|
+
import { ButtonGroup, Button } from '@salutejs/{{ package }}';
|
42
|
+
|
43
|
+
export function App() {
|
44
|
+
return (
|
45
|
+
<div>
|
46
|
+
<ButtonGroup size="s" view="secondary">
|
47
|
+
{Array(5)
|
48
|
+
.fill(true)
|
49
|
+
.map((_, i) => (
|
50
|
+
<Button text={`Button ${i}`} />
|
51
|
+
))}
|
52
|
+
</ButtonGroup>
|
53
|
+
|
54
|
+
<ButtonGroup isCommonButtonStyles={false}>
|
55
|
+
<Button size="m" text="Default" />
|
56
|
+
<Button size="s" text="Primary" view="primary" />
|
57
|
+
<Button size="xs" text="Success" view="success" />
|
58
|
+
</ButtonGroup>
|
59
|
+
</div>
|
60
|
+
);
|
61
|
+
}
|
62
|
+
```
|
63
|
+
|
64
|
+
### Ориентация группы кнопок и отступы между кнопками
|
65
|
+
|
66
|
+
Группа кнопок может располагаться вертикально или горизонтально и иметь три вида отступов:
|
67
|
+
|
68
|
+
```tsx live
|
69
|
+
import React from 'react';
|
70
|
+
import { ButtonGroup, Button } from '@salutejs/{{ package }}';
|
71
|
+
|
72
|
+
export function App() {
|
73
|
+
return (
|
74
|
+
<div>
|
75
|
+
<ButtonGroup size="xs" orientation="vertical" gap="none">
|
76
|
+
{Array(5)
|
77
|
+
.fill(true)
|
78
|
+
.map((_, i) => (
|
79
|
+
<Button text={`Button ${i}`} />
|
80
|
+
))}
|
81
|
+
</ButtonGroup>
|
82
|
+
|
83
|
+
<ButtonGroup size="xs" orientation="horizontal" gap="wide">
|
84
|
+
{Array(4)
|
85
|
+
.fill(true)
|
86
|
+
.map((_, i) => (
|
87
|
+
<Button text={`Button ${i}`} />
|
88
|
+
))}
|
89
|
+
</ButtonGroup>
|
90
|
+
</div>
|
91
|
+
);
|
92
|
+
}
|
93
|
+
```
|
94
|
+
|
95
|
+
### Границы кнопки
|
96
|
+
Границы кнопки задаются с помощью свойства `shape`.
|
97
|
+
|
98
|
+
```tsx live
|
99
|
+
import React from 'react';
|
100
|
+
import { ButtonGroup, Button } from '@salutejs/{{ package }}';
|
101
|
+
|
102
|
+
export function App() {
|
103
|
+
return (
|
104
|
+
<div>
|
105
|
+
<ButtonGroup size="xs" shape="segmented">
|
106
|
+
{Array(3)
|
107
|
+
.fill(true)
|
108
|
+
.map((_, i) => (
|
109
|
+
<Button text={`Button ${i}`} />
|
110
|
+
))}
|
111
|
+
</ButtonGroup>
|
112
|
+
|
113
|
+
<ButtonGroup size="xs" shape="default">
|
114
|
+
{Array(3)
|
115
|
+
.fill(true)
|
116
|
+
.map((_, i) => (
|
117
|
+
<Button text={`Button ${i}`} />
|
118
|
+
))}
|
119
|
+
</ButtonGroup>
|
120
|
+
</div>
|
121
|
+
);
|
122
|
+
}
|
123
|
+
```
|
@@ -0,0 +1,208 @@
|
|
1
|
+
---
|
2
|
+
id: calendar
|
3
|
+
title: Calendar
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Calendar
|
9
|
+
Компоненты календарей для выбора даты или диапазона дат.
|
10
|
+
|
11
|
+
## Calendar
|
12
|
+
|
13
|
+
<Description name="Calendar" />
|
14
|
+
<PropsTable name="Calendar" />
|
15
|
+
|
16
|
+
Представляет собой универсальный компонент `Calendar`, в котором можно настроить любое доступное представление: базовый, двойной, базовый с диапазоном, двойной с диапазоном.
|
17
|
+
|
18
|
+
```tsx live
|
19
|
+
import React from 'react';
|
20
|
+
import { Calendar } from '@salutejs/{{ package }}';
|
21
|
+
|
22
|
+
export function App() {
|
23
|
+
const isRange = false;
|
24
|
+
const isDouble = false;
|
25
|
+
const min = new Date(2022, 4, 0);
|
26
|
+
const max = new Date(2022, 6, 15);
|
27
|
+
const date = {
|
28
|
+
day: 6,
|
29
|
+
monthIndex: 5,
|
30
|
+
year: 2022,
|
31
|
+
}
|
32
|
+
|
33
|
+
const [value, setValue] = React.useState(new Date(2022, 5, 6));
|
34
|
+
const [valueRange, setValueRange] = React.useState([new Date(2022, 5, 6), new Date(2022, 5, 10)]);
|
35
|
+
|
36
|
+
const handleOnChange = React.useCallback((newValue) => {
|
37
|
+
setValue(newValue);
|
38
|
+
}, []);
|
39
|
+
const handleOnRangeChange = React.useCallback((newValue) => {
|
40
|
+
setValueRange(newValue);
|
41
|
+
}, []);
|
42
|
+
|
43
|
+
const baseEvents = [
|
44
|
+
{
|
45
|
+
date: new Date(2022, 5, 6),
|
46
|
+
},
|
47
|
+
{
|
48
|
+
date: new Date(2022, 5, 10),
|
49
|
+
color: 'red',
|
50
|
+
},
|
51
|
+
{
|
52
|
+
date: new Date(2022, 5, 10),
|
53
|
+
color: 'green',
|
54
|
+
},
|
55
|
+
{
|
56
|
+
date: new Date(2022, 5, 10),
|
57
|
+
color: 'blue',
|
58
|
+
},
|
59
|
+
];
|
60
|
+
|
61
|
+
const eventsRange = Array.from(Array(10),((_, day) => ({
|
62
|
+
date: new Date(2022, 5, 15 + day),
|
63
|
+
color: 'purple',
|
64
|
+
})));
|
65
|
+
|
66
|
+
const disabledDays = Array.from(Array(5),((_, day) => ({
|
67
|
+
date: new Date(2022, 5, 11 + day),
|
68
|
+
|
69
|
+
})));
|
70
|
+
|
71
|
+
return (
|
72
|
+
<div>
|
73
|
+
<Calendar
|
74
|
+
isRange={isRange}
|
75
|
+
isDouble={isDouble}
|
76
|
+
value={(isRange ? valueRange : value)}
|
77
|
+
eventList={[...baseEvents, ...eventsRange]}
|
78
|
+
disabledList={disabledDays}
|
79
|
+
date={date}
|
80
|
+
min={min}
|
81
|
+
max={max}
|
82
|
+
onChangeValue={(isRange ? handleOnRangeChange : handleOnChange)}
|
83
|
+
/>
|
84
|
+
</div>
|
85
|
+
);
|
86
|
+
}
|
87
|
+
```
|
88
|
+
|
89
|
+
## CalendarBase
|
90
|
+
<Description name="CalendarBase" />
|
91
|
+
<PropsTable name="CalendarBase" />
|
92
|
+
|
93
|
+
```tsx live
|
94
|
+
import React from 'react';
|
95
|
+
import { CalendarBase } from '@salutejs/{{ package }}';
|
96
|
+
|
97
|
+
export function App() {
|
98
|
+
const min = new Date(2022, 4, 0);
|
99
|
+
const max = new Date(2022, 7, 15);
|
100
|
+
|
101
|
+
const [value, setValue] = React.useState(new Date(2022, 5, 6));
|
102
|
+
const handleOnChange = React.useCallback((newValue) => {
|
103
|
+
setValue(newValue);
|
104
|
+
}, []);
|
105
|
+
|
106
|
+
return (
|
107
|
+
<div>
|
108
|
+
<CalendarBase
|
109
|
+
value={value}
|
110
|
+
min={min}
|
111
|
+
max={max}
|
112
|
+
onChangeValue={handleOnChange}
|
113
|
+
/>
|
114
|
+
</div>
|
115
|
+
);
|
116
|
+
}
|
117
|
+
```
|
118
|
+
|
119
|
+
## CalendarDouble
|
120
|
+
<Description name="CalendarDouble" />
|
121
|
+
<PropsTable name="CalendarDouble" />
|
122
|
+
|
123
|
+
```tsx live
|
124
|
+
import React from 'react';
|
125
|
+
import { CalendarDouble } from '@salutejs/{{ package }}';
|
126
|
+
|
127
|
+
export function App() {
|
128
|
+
const min = new Date(2022, 4, 0);
|
129
|
+
const max = new Date(2022, 7, 15);
|
130
|
+
|
131
|
+
const [value, setValue] = React.useState(new Date(2022, 5, 6));
|
132
|
+
const handleOnChange = React.useCallback((newValue) => {
|
133
|
+
setValue(newValue);
|
134
|
+
}, []);
|
135
|
+
|
136
|
+
return (
|
137
|
+
<div>
|
138
|
+
<CalendarDouble
|
139
|
+
value={value}
|
140
|
+
min={min}
|
141
|
+
max={max}
|
142
|
+
onChangeValue={handleOnChange}
|
143
|
+
/>
|
144
|
+
</div>
|
145
|
+
);
|
146
|
+
}
|
147
|
+
```
|
148
|
+
|
149
|
+
## CalendarBaseRange
|
150
|
+
<Description name="CalendarBaseRange" />
|
151
|
+
<PropsTable name="CalendarBaseRange" />
|
152
|
+
|
153
|
+
```tsx live
|
154
|
+
import React from 'react';
|
155
|
+
import { CalendarBaseRange } from '@salutejs/{{ package }}';
|
156
|
+
|
157
|
+
export function App() {
|
158
|
+
const min = new Date(2022, 4, 0);
|
159
|
+
const max = new Date(2022, 7, 15);
|
160
|
+
|
161
|
+
const [value, setValue] = React.useState([new Date(2022, 5, 6), new Date(2022, 5, 16)]);
|
162
|
+
const handleOnChange = React.useCallback((newValue) => {
|
163
|
+
setValue(newValue);
|
164
|
+
}, []);
|
165
|
+
|
166
|
+
return (
|
167
|
+
<div>
|
168
|
+
<CalendarBaseRange
|
169
|
+
value={value}
|
170
|
+
min={min}
|
171
|
+
max={max}
|
172
|
+
onChangeValue={handleOnChange}
|
173
|
+
/>
|
174
|
+
</div>
|
175
|
+
);
|
176
|
+
}
|
177
|
+
```
|
178
|
+
|
179
|
+
## CalendarDoubleRange
|
180
|
+
<Description name="CalendarDoubleRange" />
|
181
|
+
<PropsTable name="CalendarDoubleRange" />
|
182
|
+
|
183
|
+
```tsx live
|
184
|
+
import React from 'react';
|
185
|
+
import { CalendarDoubleRange } from '@salutejs/{{ package }}';
|
186
|
+
|
187
|
+
export function App() {
|
188
|
+
const min = new Date(2022, 4, 0);
|
189
|
+
const max = new Date(2022, 7, 15);
|
190
|
+
|
191
|
+
const [value, setValue] = React.useState([new Date(2022, 5, 6), new Date(2022, 6, 16)]);
|
192
|
+
const handleOnChange = React.useCallback((newValue) => {
|
193
|
+
setValue(newValue);
|
194
|
+
}, []);
|
195
|
+
|
196
|
+
return (
|
197
|
+
<div>
|
198
|
+
<CalendarDoubleRange
|
199
|
+
value={value}
|
200
|
+
min={min}
|
201
|
+
max={max}
|
202
|
+
onChangeValue={handleOnChange}
|
203
|
+
/>
|
204
|
+
</div>
|
205
|
+
);
|
206
|
+
}
|
207
|
+
```
|
208
|
+
|
@@ -22,6 +22,8 @@ var cellRoot = exports.cellRoot = function cellRoot(Root) {
|
|
22
22
|
return /*#__PURE__*/(0, _react.forwardRef)(function (props, outerRootRef) {
|
23
23
|
var _props$size = props.size,
|
24
24
|
size = _props$size === void 0 ? 'm' : _props$size,
|
25
|
+
_props$view = props.view,
|
26
|
+
view = _props$view === void 0 ? 'default' : _props$view,
|
25
27
|
left = props.contentLeft,
|
26
28
|
right = props.contentRight,
|
27
29
|
_props$alignLeft = props.alignLeft,
|
@@ -38,6 +40,7 @@ var cellRoot = exports.cellRoot = function cellRoot(Root) {
|
|
38
40
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
39
41
|
ref: outerRootRef,
|
40
42
|
size: size,
|
43
|
+
view: view,
|
41
44
|
className: (0, _utils.cx)(stretchingClass)
|
42
45
|
}, /*#__PURE__*/_react["default"].createElement(_Cell.CellRoot, {
|
43
46
|
className: _Cell2.classes.cellRoot
|
@@ -7,9 +7,9 @@ exports.tokens = exports.classes = void 0;
|
|
7
7
|
var tokens = exports.tokens = {
|
8
8
|
cellColor: '--plasma-cell-color',
|
9
9
|
cellBackgroundColor: '--plasma-cell-background-color',
|
10
|
-
cellPadding: '--plasma-cell-padding',
|
10
|
+
cellPadding: '--plasma-cell-content-padding',
|
11
11
|
cellPaddingLeftContent: '--plasma-cell-left-padding',
|
12
|
-
cellPaddingContent: '--plasma-cell-padding',
|
12
|
+
cellPaddingContent: '--plasma-cell-content-padding',
|
13
13
|
cellPaddingRightContent: '--plasma-cell-right-padding',
|
14
14
|
cellTextboxGap: '--plasma-cell-textbox-gap',
|
15
15
|
cellGap: '--plasma-cell-gap',
|
@@ -37,7 +37,6 @@ var tokens = exports.tokens = {
|
|
37
37
|
cellSubtitleLineHeight: '--plasma-cell-subtitle-line-height'
|
38
38
|
};
|
39
39
|
var classes = exports.classes = {
|
40
|
-
cellStretch: 'cell-stretch',
|
41
40
|
autoStretching: 'cell-stretching-auto',
|
42
41
|
filledStretching: 'cell-stretching-filled',
|
43
42
|
fixedStretching: 'cell-stretching-fixed',
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
id: checkbox
|
3
|
+
title: Checkbox
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Checkbox
|
9
|
+
<Description name="Checkbox" />
|
10
|
+
<PropsTable name="Checkbox" exclude={['css', 'focused']} />
|
11
|
+
|
12
|
+
## Использование
|
13
|
+
Компонент `Checkbox` может содержать лейбл и описание.
|
14
|
+
|
15
|
+
```tsx live
|
16
|
+
import React from 'react';
|
17
|
+
import { Checkbox } from '@salutejs/s{{package}}';
|
18
|
+
|
19
|
+
export function App() {
|
20
|
+
return (
|
21
|
+
<Checkbox label="Чекбокс" description="Описание" defaultChecked />
|
22
|
+
);
|
23
|
+
}
|
24
|
+
```
|
25
|
+
|
26
|
+
Свойства `description` и `label` могут принимать JSX элементы.
|
27
|
+
|
28
|
+
По умолчанию, контент внутри лейбла и описания многострочный.
|
29
|
+
|
30
|
+
Для того чтобы стал однострочным, необходимо использовать свойство `singleLine`(по умолчанию `false`).
|
31
|
+
|
32
|
+
```tsx live
|
33
|
+
import React from 'react';
|
34
|
+
import { Checkbox } from '@salutejs/s{{package}}';
|
35
|
+
|
36
|
+
export function App() {
|
37
|
+
return (
|
38
|
+
<Checkbox
|
39
|
+
label={<div>Чекбокс со <a href="/#">ссылкой</a></div>}
|
40
|
+
description={<div>Описание чекбокса со <a href="/#">ссылкой</a></div>}
|
41
|
+
/>
|
42
|
+
);
|
43
|
+
}
|
44
|
+
```
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
id: chip
|
3
|
+
title: Chip
|
4
|
+
---
|
5
|
+
|
6
|
+
import { PropsTable, Description } from '@site/src/components';
|
7
|
+
|
8
|
+
# Chip
|
9
|
+
Chips могут отображаться в нескольких размерах и цветах, могут содержать текст и/или иконку.
|
10
|
+
|
11
|
+
## Chip
|
12
|
+
<Description name="Chip" />
|
13
|
+
<PropsTable name="Chip" exclude={['css', 'focused']} />
|
14
|
+
|
15
|
+
## Использование
|
16
|
+
Компонент `Chip` может содержать текст, который указывается в
|
17
|
+
свойстве `text`, или любой контент напрямую через `children`.
|
18
|
+
|
19
|
+
Свойство `text` можно использовать вместе со свойствами `contentLeft` и `contentRight`.
|
20
|
+
С их помощью можно размещать **иконку** слева или справа от текста.
|
21
|
+
|
22
|
+
Так же есть свойство `contentClearButton`, которое позволяет прокинуть custom **иконку**.
|
23
|
+
|
24
|
+
```tsx live
|
25
|
+
import React from 'react';
|
26
|
+
import { Chip } from '@salutejs/{{ package }}';
|
27
|
+
import { IconDownload } from '@salutejs/plasma-icons';
|
28
|
+
|
29
|
+
export function App() {
|
30
|
+
return (
|
31
|
+
<div>
|
32
|
+
<Chip text="Текст" />
|
33
|
+
|
34
|
+
<Chip text="Текст" contentLeft={<IconDownload color="inherit" />} />
|
35
|
+
|
36
|
+
<Chip contentLeft={<IconDownload color="inherit" />} />
|
37
|
+
|
38
|
+
<Chip text="Текст" />
|
39
|
+
|
40
|
+
<Chip text="Текст" contentLeft={<IconDownload color="inherit" />} />
|
41
|
+
|
42
|
+
<Chip>
|
43
|
+
Текст
|
44
|
+
</Chip>
|
45
|
+
</div>
|
46
|
+
);
|
47
|
+
}
|
48
|
+
```
|
49
|
+
|
50
|
+
## Примеры
|
51
|
+
|
52
|
+
### Размер Chip
|
53
|
+
Размер Chip задается с помощью свойства `size`. Возможные значения свойства: `"l"`, `"m"`, `"s"` или `"xs"`:
|
54
|
+
|
55
|
+
```tsx live
|
56
|
+
import React from 'react';
|
57
|
+
import { Chip } from '@salutejs/{{ package }}';
|
58
|
+
|
59
|
+
export function App() {
|
60
|
+
return (
|
61
|
+
<div>
|
62
|
+
<Chip text="Chip" size="l" />
|
63
|
+
<Chip text="Chip" size="m" />
|
64
|
+
<Chip text="Chip" size="s" />
|
65
|
+
<Chip text="Chip" size="xs" />
|
66
|
+
</div>
|
67
|
+
);
|
68
|
+
}
|
69
|
+
```
|
70
|
+
|
71
|
+
### Вид Chip
|
72
|
+
Вид Chip задается с помощью свойства `view`. Возможные значения свойства `view`:
|
73
|
+
+ `"default"` – основная;
|
74
|
+
+ `"secondary"` – вторичная;
|
75
|
+
+ `"positive"` – успешное завершение;
|
76
|
+
|
77
|
+
```tsx live
|
78
|
+
import React from 'react';
|
79
|
+
import { Chip } from '@salutejs/{{ package }}';
|
80
|
+
|
81
|
+
export function App() {
|
82
|
+
return (
|
83
|
+
<div>
|
84
|
+
<Chip text="Chip" size="m" view="default" />
|
85
|
+
<Chip text="Chip" size="m" view="secondary" />
|
86
|
+
<Chip text="Chip" size="m" view="positive" />
|
87
|
+
</div>
|
88
|
+
);
|
89
|
+
}
|
90
|
+
```
|