@salutejs/plasma-new-hope 0.114.1-canary.1333.10249265053.0 → 0.114.1-canary.1333.10261480440.0
Sign up to get free protection for your applications and to get access to all the features.
- package/emotion/cjs/components/Tabs/Tabs.template-doc.mdx +89 -3
- package/emotion/es/components/Tabs/Tabs.template-doc.mdx +89 -3
- package/package.json +2 -2
- package/styled-components/cjs/components/Tabs/Tabs.template-doc.mdx +89 -3
- package/styled-components/es/components/Tabs/Tabs.template-doc.mdx +89 -3
@@ -51,7 +51,7 @@ export function App() {
|
|
51
51
|
contentLeft={<IconClock size="xs" color="inherit" />}
|
52
52
|
onClick={() => setIndex(i)}
|
53
53
|
>
|
54
|
-
Label
|
54
|
+
{`Label${i + 1}`}
|
55
55
|
</TabItem>
|
56
56
|
))}
|
57
57
|
</Tabs>
|
@@ -60,6 +60,92 @@ export function App() {
|
|
60
60
|
}
|
61
61
|
```
|
62
62
|
|
63
|
+
### Пример с прокруткой
|
64
|
+
|
65
|
+
```tsx live
|
66
|
+
import React, { useState } from 'react';
|
67
|
+
import { Tabs, TabItem } from '@salutejs/{{ package }}';
|
68
|
+
import { IconClock } from '@salutejs/plasma-icons';
|
69
|
+
|
70
|
+
export function App() {
|
71
|
+
const items = Array(8).fill(0);
|
72
|
+
const [index, setIndex] = useState(0);
|
73
|
+
|
74
|
+
return (
|
75
|
+
<div>
|
76
|
+
<Tabs view="divider" size="xs" style={{ width: '15rem' }}>
|
77
|
+
{items.map((_, i) => (
|
78
|
+
<TabItem
|
79
|
+
view="divider"
|
80
|
+
key={`item:${i}`}
|
81
|
+
size="xs"
|
82
|
+
selected={i === index}
|
83
|
+
tabIndex={0}
|
84
|
+
contentLeft={<IconClock size="xs" color="inherit" />}
|
85
|
+
onClick={() => setIndex(i)}
|
86
|
+
>
|
87
|
+
{`Label${i + 1}`}
|
88
|
+
</TabItem>
|
89
|
+
))}
|
90
|
+
</Tabs>
|
91
|
+
</div>
|
92
|
+
);
|
93
|
+
}
|
94
|
+
```
|
95
|
+
|
96
|
+
### Пример с Dropdown
|
97
|
+
|
98
|
+
```tsx live
|
99
|
+
import React, { useState } from 'react';
|
100
|
+
import { Tabs, TabItem, Dropdown } from '@salutejs/{{ package }}';
|
101
|
+
|
102
|
+
export function App() {
|
103
|
+
const items = Array(8).fill(0);
|
104
|
+
const [index, setIndex] = useState(0);
|
105
|
+
|
106
|
+
const maxItemQuantity = 3;
|
107
|
+
const visibleItems = items.slice(0, maxItemQuantity);
|
108
|
+
const otherItems = items.slice(maxItemQuantity);
|
109
|
+
|
110
|
+
const dropdownItems = otherItems.map((_, i) => {
|
111
|
+
const itemIndex = maxItemQuantity + i;
|
112
|
+
|
113
|
+
return {
|
114
|
+
label: `Label${itemIndex + 1}`,
|
115
|
+
value: itemIndex,
|
116
|
+
};
|
117
|
+
});
|
118
|
+
|
119
|
+
return (
|
120
|
+
<div style={{ height: '15rem', alignItems: 'flex-start' }}>
|
121
|
+
<Tabs clip="showAll" view="divider" size="xs">
|
122
|
+
{visibleItems.map((_, i) => (
|
123
|
+
<TabItem
|
124
|
+
key={`item:${i}`}
|
125
|
+
view="divider"
|
126
|
+
selected={i === index}
|
127
|
+
onClick={() => setIndex(i)}
|
128
|
+
tabIndex={0}
|
129
|
+
size="xs"
|
130
|
+
>
|
131
|
+
{`Label${i + 1}`}
|
132
|
+
</TabItem>
|
133
|
+
))}
|
134
|
+
{dropdownItems.length > 0 && (
|
135
|
+
<div style={{ marginLeft: '1.75rem' }}>
|
136
|
+
<Dropdown size="xs" items={dropdownItems} onItemSelect={(item) => setIndex(item.value)}>
|
137
|
+
<TabItem key="item:ShowAll" view="divider" tabIndex={0} size="xs">
|
138
|
+
ShowAll
|
139
|
+
</TabItem>
|
140
|
+
</Dropdown>
|
141
|
+
</div>
|
142
|
+
)}
|
143
|
+
</Tabs>
|
144
|
+
</div>
|
145
|
+
);
|
146
|
+
}
|
147
|
+
```
|
148
|
+
|
63
149
|
### Подключение клавиатурной навигации
|
64
150
|
Для этого необходимо дополнительно прокинуть свойства `index, itemIndex, onIndexChange`.
|
65
151
|
Клавиши ArrowLeft, ArrowRight, Home, End для навигации по вкладкам.
|
@@ -88,11 +174,11 @@ export function App() {
|
|
88
174
|
contentLeft={<IconClock size="xs" color="inherit" />}
|
89
175
|
onClick={() => setIndex(i)}
|
90
176
|
>
|
91
|
-
Label
|
177
|
+
{`Label${i + 1}`}
|
92
178
|
</TabItem>
|
93
179
|
))}
|
94
180
|
</Tabs>
|
95
181
|
</div>
|
96
182
|
);
|
97
183
|
}
|
98
|
-
```
|
184
|
+
```
|
@@ -51,7 +51,7 @@ export function App() {
|
|
51
51
|
contentLeft={<IconClock size="xs" color="inherit" />}
|
52
52
|
onClick={() => setIndex(i)}
|
53
53
|
>
|
54
|
-
Label
|
54
|
+
{`Label${i + 1}`}
|
55
55
|
</TabItem>
|
56
56
|
))}
|
57
57
|
</Tabs>
|
@@ -60,6 +60,92 @@ export function App() {
|
|
60
60
|
}
|
61
61
|
```
|
62
62
|
|
63
|
+
### Пример с прокруткой
|
64
|
+
|
65
|
+
```tsx live
|
66
|
+
import React, { useState } from 'react';
|
67
|
+
import { Tabs, TabItem } from '@salutejs/{{ package }}';
|
68
|
+
import { IconClock } from '@salutejs/plasma-icons';
|
69
|
+
|
70
|
+
export function App() {
|
71
|
+
const items = Array(8).fill(0);
|
72
|
+
const [index, setIndex] = useState(0);
|
73
|
+
|
74
|
+
return (
|
75
|
+
<div>
|
76
|
+
<Tabs view="divider" size="xs" style={{ width: '15rem' }}>
|
77
|
+
{items.map((_, i) => (
|
78
|
+
<TabItem
|
79
|
+
view="divider"
|
80
|
+
key={`item:${i}`}
|
81
|
+
size="xs"
|
82
|
+
selected={i === index}
|
83
|
+
tabIndex={0}
|
84
|
+
contentLeft={<IconClock size="xs" color="inherit" />}
|
85
|
+
onClick={() => setIndex(i)}
|
86
|
+
>
|
87
|
+
{`Label${i + 1}`}
|
88
|
+
</TabItem>
|
89
|
+
))}
|
90
|
+
</Tabs>
|
91
|
+
</div>
|
92
|
+
);
|
93
|
+
}
|
94
|
+
```
|
95
|
+
|
96
|
+
### Пример с Dropdown
|
97
|
+
|
98
|
+
```tsx live
|
99
|
+
import React, { useState } from 'react';
|
100
|
+
import { Tabs, TabItem, Dropdown } from '@salutejs/{{ package }}';
|
101
|
+
|
102
|
+
export function App() {
|
103
|
+
const items = Array(8).fill(0);
|
104
|
+
const [index, setIndex] = useState(0);
|
105
|
+
|
106
|
+
const maxItemQuantity = 3;
|
107
|
+
const visibleItems = items.slice(0, maxItemQuantity);
|
108
|
+
const otherItems = items.slice(maxItemQuantity);
|
109
|
+
|
110
|
+
const dropdownItems = otherItems.map((_, i) => {
|
111
|
+
const itemIndex = maxItemQuantity + i;
|
112
|
+
|
113
|
+
return {
|
114
|
+
label: `Label${itemIndex + 1}`,
|
115
|
+
value: itemIndex,
|
116
|
+
};
|
117
|
+
});
|
118
|
+
|
119
|
+
return (
|
120
|
+
<div style={{ height: '15rem', alignItems: 'flex-start' }}>
|
121
|
+
<Tabs clip="showAll" view="divider" size="xs">
|
122
|
+
{visibleItems.map((_, i) => (
|
123
|
+
<TabItem
|
124
|
+
key={`item:${i}`}
|
125
|
+
view="divider"
|
126
|
+
selected={i === index}
|
127
|
+
onClick={() => setIndex(i)}
|
128
|
+
tabIndex={0}
|
129
|
+
size="xs"
|
130
|
+
>
|
131
|
+
{`Label${i + 1}`}
|
132
|
+
</TabItem>
|
133
|
+
))}
|
134
|
+
{dropdownItems.length > 0 && (
|
135
|
+
<div style={{ marginLeft: '1.75rem' }}>
|
136
|
+
<Dropdown size="xs" items={dropdownItems} onItemSelect={(item) => setIndex(item.value)}>
|
137
|
+
<TabItem key="item:ShowAll" view="divider" tabIndex={0} size="xs">
|
138
|
+
ShowAll
|
139
|
+
</TabItem>
|
140
|
+
</Dropdown>
|
141
|
+
</div>
|
142
|
+
)}
|
143
|
+
</Tabs>
|
144
|
+
</div>
|
145
|
+
);
|
146
|
+
}
|
147
|
+
```
|
148
|
+
|
63
149
|
### Подключение клавиатурной навигации
|
64
150
|
Для этого необходимо дополнительно прокинуть свойства `index, itemIndex, onIndexChange`.
|
65
151
|
Клавиши ArrowLeft, ArrowRight, Home, End для навигации по вкладкам.
|
@@ -88,11 +174,11 @@ export function App() {
|
|
88
174
|
contentLeft={<IconClock size="xs" color="inherit" />}
|
89
175
|
onClick={() => setIndex(i)}
|
90
176
|
>
|
91
|
-
Label
|
177
|
+
{`Label${i + 1}`}
|
92
178
|
</TabItem>
|
93
179
|
))}
|
94
180
|
</Tabs>
|
95
181
|
</div>
|
96
182
|
);
|
97
183
|
}
|
98
|
-
```
|
184
|
+
```
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.114.1-canary.1333.
|
3
|
+
"version": "0.114.1-canary.1333.10261480440.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -118,5 +118,5 @@
|
|
118
118
|
"react-popper": "2.3.0",
|
119
119
|
"storeon": "3.1.5"
|
120
120
|
},
|
121
|
-
"gitHead": "
|
121
|
+
"gitHead": "d4e62ddd5e2b54d10c747c02969d6ceb10e65634"
|
122
122
|
}
|
@@ -51,7 +51,7 @@ export function App() {
|
|
51
51
|
contentLeft={<IconClock size="xs" color="inherit" />}
|
52
52
|
onClick={() => setIndex(i)}
|
53
53
|
>
|
54
|
-
Label
|
54
|
+
{`Label${i + 1}`}
|
55
55
|
</TabItem>
|
56
56
|
))}
|
57
57
|
</Tabs>
|
@@ -60,6 +60,92 @@ export function App() {
|
|
60
60
|
}
|
61
61
|
```
|
62
62
|
|
63
|
+
### Пример с прокруткой
|
64
|
+
|
65
|
+
```tsx live
|
66
|
+
import React, { useState } from 'react';
|
67
|
+
import { Tabs, TabItem } from '@salutejs/{{ package }}';
|
68
|
+
import { IconClock } from '@salutejs/plasma-icons';
|
69
|
+
|
70
|
+
export function App() {
|
71
|
+
const items = Array(8).fill(0);
|
72
|
+
const [index, setIndex] = useState(0);
|
73
|
+
|
74
|
+
return (
|
75
|
+
<div>
|
76
|
+
<Tabs view="divider" size="xs" style={{ width: '15rem' }}>
|
77
|
+
{items.map((_, i) => (
|
78
|
+
<TabItem
|
79
|
+
view="divider"
|
80
|
+
key={`item:${i}`}
|
81
|
+
size="xs"
|
82
|
+
selected={i === index}
|
83
|
+
tabIndex={0}
|
84
|
+
contentLeft={<IconClock size="xs" color="inherit" />}
|
85
|
+
onClick={() => setIndex(i)}
|
86
|
+
>
|
87
|
+
{`Label${i + 1}`}
|
88
|
+
</TabItem>
|
89
|
+
))}
|
90
|
+
</Tabs>
|
91
|
+
</div>
|
92
|
+
);
|
93
|
+
}
|
94
|
+
```
|
95
|
+
|
96
|
+
### Пример с Dropdown
|
97
|
+
|
98
|
+
```tsx live
|
99
|
+
import React, { useState } from 'react';
|
100
|
+
import { Tabs, TabItem, Dropdown } from '@salutejs/{{ package }}';
|
101
|
+
|
102
|
+
export function App() {
|
103
|
+
const items = Array(8).fill(0);
|
104
|
+
const [index, setIndex] = useState(0);
|
105
|
+
|
106
|
+
const maxItemQuantity = 3;
|
107
|
+
const visibleItems = items.slice(0, maxItemQuantity);
|
108
|
+
const otherItems = items.slice(maxItemQuantity);
|
109
|
+
|
110
|
+
const dropdownItems = otherItems.map((_, i) => {
|
111
|
+
const itemIndex = maxItemQuantity + i;
|
112
|
+
|
113
|
+
return {
|
114
|
+
label: `Label${itemIndex + 1}`,
|
115
|
+
value: itemIndex,
|
116
|
+
};
|
117
|
+
});
|
118
|
+
|
119
|
+
return (
|
120
|
+
<div style={{ height: '15rem', alignItems: 'flex-start' }}>
|
121
|
+
<Tabs clip="showAll" view="divider" size="xs">
|
122
|
+
{visibleItems.map((_, i) => (
|
123
|
+
<TabItem
|
124
|
+
key={`item:${i}`}
|
125
|
+
view="divider"
|
126
|
+
selected={i === index}
|
127
|
+
onClick={() => setIndex(i)}
|
128
|
+
tabIndex={0}
|
129
|
+
size="xs"
|
130
|
+
>
|
131
|
+
{`Label${i + 1}`}
|
132
|
+
</TabItem>
|
133
|
+
))}
|
134
|
+
{dropdownItems.length > 0 && (
|
135
|
+
<div style={{ marginLeft: '1.75rem' }}>
|
136
|
+
<Dropdown size="xs" items={dropdownItems} onItemSelect={(item) => setIndex(item.value)}>
|
137
|
+
<TabItem key="item:ShowAll" view="divider" tabIndex={0} size="xs">
|
138
|
+
ShowAll
|
139
|
+
</TabItem>
|
140
|
+
</Dropdown>
|
141
|
+
</div>
|
142
|
+
)}
|
143
|
+
</Tabs>
|
144
|
+
</div>
|
145
|
+
);
|
146
|
+
}
|
147
|
+
```
|
148
|
+
|
63
149
|
### Подключение клавиатурной навигации
|
64
150
|
Для этого необходимо дополнительно прокинуть свойства `index, itemIndex, onIndexChange`.
|
65
151
|
Клавиши ArrowLeft, ArrowRight, Home, End для навигации по вкладкам.
|
@@ -88,11 +174,11 @@ export function App() {
|
|
88
174
|
contentLeft={<IconClock size="xs" color="inherit" />}
|
89
175
|
onClick={() => setIndex(i)}
|
90
176
|
>
|
91
|
-
Label
|
177
|
+
{`Label${i + 1}`}
|
92
178
|
</TabItem>
|
93
179
|
))}
|
94
180
|
</Tabs>
|
95
181
|
</div>
|
96
182
|
);
|
97
183
|
}
|
98
|
-
```
|
184
|
+
```
|
@@ -51,7 +51,7 @@ export function App() {
|
|
51
51
|
contentLeft={<IconClock size="xs" color="inherit" />}
|
52
52
|
onClick={() => setIndex(i)}
|
53
53
|
>
|
54
|
-
Label
|
54
|
+
{`Label${i + 1}`}
|
55
55
|
</TabItem>
|
56
56
|
))}
|
57
57
|
</Tabs>
|
@@ -60,6 +60,92 @@ export function App() {
|
|
60
60
|
}
|
61
61
|
```
|
62
62
|
|
63
|
+
### Пример с прокруткой
|
64
|
+
|
65
|
+
```tsx live
|
66
|
+
import React, { useState } from 'react';
|
67
|
+
import { Tabs, TabItem } from '@salutejs/{{ package }}';
|
68
|
+
import { IconClock } from '@salutejs/plasma-icons';
|
69
|
+
|
70
|
+
export function App() {
|
71
|
+
const items = Array(8).fill(0);
|
72
|
+
const [index, setIndex] = useState(0);
|
73
|
+
|
74
|
+
return (
|
75
|
+
<div>
|
76
|
+
<Tabs view="divider" size="xs" style={{ width: '15rem' }}>
|
77
|
+
{items.map((_, i) => (
|
78
|
+
<TabItem
|
79
|
+
view="divider"
|
80
|
+
key={`item:${i}`}
|
81
|
+
size="xs"
|
82
|
+
selected={i === index}
|
83
|
+
tabIndex={0}
|
84
|
+
contentLeft={<IconClock size="xs" color="inherit" />}
|
85
|
+
onClick={() => setIndex(i)}
|
86
|
+
>
|
87
|
+
{`Label${i + 1}`}
|
88
|
+
</TabItem>
|
89
|
+
))}
|
90
|
+
</Tabs>
|
91
|
+
</div>
|
92
|
+
);
|
93
|
+
}
|
94
|
+
```
|
95
|
+
|
96
|
+
### Пример с Dropdown
|
97
|
+
|
98
|
+
```tsx live
|
99
|
+
import React, { useState } from 'react';
|
100
|
+
import { Tabs, TabItem, Dropdown } from '@salutejs/{{ package }}';
|
101
|
+
|
102
|
+
export function App() {
|
103
|
+
const items = Array(8).fill(0);
|
104
|
+
const [index, setIndex] = useState(0);
|
105
|
+
|
106
|
+
const maxItemQuantity = 3;
|
107
|
+
const visibleItems = items.slice(0, maxItemQuantity);
|
108
|
+
const otherItems = items.slice(maxItemQuantity);
|
109
|
+
|
110
|
+
const dropdownItems = otherItems.map((_, i) => {
|
111
|
+
const itemIndex = maxItemQuantity + i;
|
112
|
+
|
113
|
+
return {
|
114
|
+
label: `Label${itemIndex + 1}`,
|
115
|
+
value: itemIndex,
|
116
|
+
};
|
117
|
+
});
|
118
|
+
|
119
|
+
return (
|
120
|
+
<div style={{ height: '15rem', alignItems: 'flex-start' }}>
|
121
|
+
<Tabs clip="showAll" view="divider" size="xs">
|
122
|
+
{visibleItems.map((_, i) => (
|
123
|
+
<TabItem
|
124
|
+
key={`item:${i}`}
|
125
|
+
view="divider"
|
126
|
+
selected={i === index}
|
127
|
+
onClick={() => setIndex(i)}
|
128
|
+
tabIndex={0}
|
129
|
+
size="xs"
|
130
|
+
>
|
131
|
+
{`Label${i + 1}`}
|
132
|
+
</TabItem>
|
133
|
+
))}
|
134
|
+
{dropdownItems.length > 0 && (
|
135
|
+
<div style={{ marginLeft: '1.75rem' }}>
|
136
|
+
<Dropdown size="xs" items={dropdownItems} onItemSelect={(item) => setIndex(item.value)}>
|
137
|
+
<TabItem key="item:ShowAll" view="divider" tabIndex={0} size="xs">
|
138
|
+
ShowAll
|
139
|
+
</TabItem>
|
140
|
+
</Dropdown>
|
141
|
+
</div>
|
142
|
+
)}
|
143
|
+
</Tabs>
|
144
|
+
</div>
|
145
|
+
);
|
146
|
+
}
|
147
|
+
```
|
148
|
+
|
63
149
|
### Подключение клавиатурной навигации
|
64
150
|
Для этого необходимо дополнительно прокинуть свойства `index, itemIndex, onIndexChange`.
|
65
151
|
Клавиши ArrowLeft, ArrowRight, Home, End для навигации по вкладкам.
|
@@ -88,11 +174,11 @@ export function App() {
|
|
88
174
|
contentLeft={<IconClock size="xs" color="inherit" />}
|
89
175
|
onClick={() => setIndex(i)}
|
90
176
|
>
|
91
|
-
Label
|
177
|
+
{`Label${i + 1}`}
|
92
178
|
</TabItem>
|
93
179
|
))}
|
94
180
|
</Tabs>
|
95
181
|
</div>
|
96
182
|
);
|
97
183
|
}
|
98
|
-
```
|
184
|
+
```
|