@salutejs/plasma-new-hope 0.114.1-canary.1333.10216082008.0 → 0.114.1-canary.1339.10246269224.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Notification/NotificationsPortal.js +11 -1
- package/cjs/components/Notification/NotificationsPortal.js.map +1 -1
- package/cjs/components/Notification/NotificationsPortal_6417q6.css +1 -0
- package/cjs/components/Notification/NotificationsProvider.css +2 -0
- package/cjs/components/Tabs/tokens.js +2 -5
- package/cjs/components/Tabs/tokens.js.map +1 -1
- package/cjs/components/Tabs/ui/TabItem/TabItem.css +1 -1
- package/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -8
- package/cjs/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
- package/cjs/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
- package/cjs/components/Tabs/ui/TabItem/variations/_view/base.js.map +1 -1
- package/cjs/components/Tabs/ui/TabItem/variations/_view/base_q8xs21.css +1 -0
- package/cjs/components/Tabs/ui/Tabs/Tabs.css +6 -6
- package/cjs/components/Tabs/ui/Tabs/Tabs.js +8 -51
- package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
- package/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +7 -7
- package/cjs/components/Tabs/ui/Tabs/Tabs.styles.js.map +1 -1
- package/{es/components/Tabs/ui/Tabs/Tabs.styles_z4dnzh.css → cjs/components/Tabs/ui/Tabs/Tabs.styles_1b8qt33.css} +2 -2
- package/cjs/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
- package/cjs/components/Tabs/ui/Tabs/variations/_stretch/base.js.map +1 -1
- package/{es/components/Tabs/ui/Tabs/variations/_stretch/base_1c7lnrm.css → cjs/components/Tabs/ui/Tabs/variations/_stretch/base_176tz0n.css} +1 -1
- package/cjs/components/Tabs/ui/Tabs/variations/_view/base.js +1 -1
- package/{es/components/Tabs/ui/Tabs/variations/_view/base_aij3sf.css → cjs/components/Tabs/ui/Tabs/variations/_view/base_4xkt26.css} +1 -1
- package/cjs/index.css +9 -7
- package/emotion/cjs/components/Notification/NotificationsPortal.js +8 -1
- package/emotion/cjs/components/Tabs/tokens.js +2 -5
- package/emotion/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -8
- package/emotion/cjs/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
- package/emotion/cjs/components/Tabs/ui/Tabs/Tabs.js +8 -51
- package/emotion/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +16 -8
- package/emotion/cjs/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
- package/emotion/cjs/components/Tabs/ui/Tabs/variations/_view/tokens.json +1 -1
- package/emotion/cjs/examples/plasma_b2c/components/Tabs/TabItem.config.js +15 -15
- package/emotion/cjs/examples/plasma_b2c/components/Tabs/Tabs.config.js +17 -16
- package/emotion/cjs/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +196 -287
- package/emotion/cjs/examples/plasma_web/components/Tabs/TabItem.config.js +15 -15
- package/emotion/cjs/examples/plasma_web/components/Tabs/Tabs.config.js +17 -16
- package/emotion/cjs/examples/plasma_web/components/Tabs/Tabs.stories.tsx +196 -287
- package/emotion/es/components/Notification/NotificationsPortal.js +7 -1
- package/emotion/es/components/Tabs/tokens.js +2 -5
- package/emotion/es/components/Tabs/ui/TabItem/TabItem.js +2 -8
- package/emotion/es/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
- package/emotion/es/components/Tabs/ui/Tabs/Tabs.js +9 -52
- package/emotion/es/components/Tabs/ui/Tabs/Tabs.styles.js +17 -9
- package/emotion/es/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
- package/emotion/es/components/Tabs/ui/Tabs/variations/_view/tokens.json +1 -1
- package/emotion/es/examples/plasma_b2c/components/Tabs/TabItem.config.js +15 -15
- package/emotion/es/examples/plasma_b2c/components/Tabs/Tabs.config.js +17 -16
- package/emotion/es/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +196 -287
- package/emotion/es/examples/plasma_web/components/Tabs/TabItem.config.js +15 -15
- package/emotion/es/examples/plasma_web/components/Tabs/Tabs.config.js +17 -16
- package/emotion/es/examples/plasma_web/components/Tabs/Tabs.stories.tsx +196 -287
- package/es/components/Notification/NotificationsPortal.js +11 -1
- package/es/components/Notification/NotificationsPortal.js.map +1 -1
- package/es/components/Notification/NotificationsPortal_6417q6.css +1 -0
- package/es/components/Notification/NotificationsProvider.css +2 -0
- package/es/components/Tabs/tokens.js +2 -5
- package/es/components/Tabs/tokens.js.map +1 -1
- package/es/components/Tabs/ui/TabItem/TabItem.css +1 -1
- package/es/components/Tabs/ui/TabItem/TabItem.js +2 -8
- package/es/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
- package/es/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
- package/es/components/Tabs/ui/TabItem/variations/_view/base.js.map +1 -1
- package/es/components/Tabs/ui/TabItem/variations/_view/base_q8xs21.css +1 -0
- package/es/components/Tabs/ui/Tabs/Tabs.css +6 -6
- package/es/components/Tabs/ui/Tabs/Tabs.js +9 -52
- package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
- package/es/components/Tabs/ui/Tabs/Tabs.styles.js +7 -7
- package/es/components/Tabs/ui/Tabs/Tabs.styles.js.map +1 -1
- package/{cjs/components/Tabs/ui/Tabs/Tabs.styles_z4dnzh.css → es/components/Tabs/ui/Tabs/Tabs.styles_1b8qt33.css} +2 -2
- package/es/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
- package/es/components/Tabs/ui/Tabs/variations/_stretch/base.js.map +1 -1
- package/{cjs/components/Tabs/ui/Tabs/variations/_stretch/base_1c7lnrm.css → es/components/Tabs/ui/Tabs/variations/_stretch/base_176tz0n.css} +1 -1
- package/es/components/Tabs/ui/Tabs/variations/_view/base.js +1 -1
- package/{cjs/components/Tabs/ui/Tabs/variations/_view/base_aij3sf.css → es/components/Tabs/ui/Tabs/variations/_view/base_4xkt26.css} +1 -1
- package/es/index.css +9 -7
- package/package.json +2 -2
- package/styled-components/cjs/components/Notification/NotificationsPortal.js +7 -1
- package/styled-components/cjs/components/Tabs/tokens.js +2 -5
- package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -8
- package/styled-components/cjs/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
- package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +8 -51
- package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +2 -2
- package/styled-components/cjs/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
- package/styled-components/cjs/components/Tabs/ui/Tabs/variations/_view/tokens.json +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Tabs/TabItem.config.js +8 -8
- package/styled-components/cjs/examples/plasma_b2c/components/Tabs/Tabs.config.js +5 -4
- package/styled-components/cjs/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +196 -287
- package/styled-components/cjs/examples/plasma_web/components/Tabs/TabItem.config.js +8 -8
- package/styled-components/cjs/examples/plasma_web/components/Tabs/Tabs.config.js +5 -4
- package/styled-components/cjs/examples/plasma_web/components/Tabs/Tabs.stories.tsx +196 -287
- package/styled-components/es/components/Notification/NotificationsPortal.js +6 -1
- package/styled-components/es/components/Tabs/tokens.js +2 -5
- package/styled-components/es/components/Tabs/ui/TabItem/TabItem.js +2 -8
- package/styled-components/es/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
- package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +9 -52
- package/styled-components/es/components/Tabs/ui/Tabs/Tabs.styles.js +3 -3
- package/styled-components/es/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
- package/styled-components/es/components/Tabs/ui/Tabs/variations/_view/tokens.json +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Tabs/TabItem.config.js +8 -8
- package/styled-components/es/examples/plasma_b2c/components/Tabs/Tabs.config.js +5 -4
- package/styled-components/es/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +196 -287
- package/styled-components/es/examples/plasma_web/components/Tabs/TabItem.config.js +8 -8
- package/styled-components/es/examples/plasma_web/components/Tabs/Tabs.config.js +5 -4
- package/styled-components/es/examples/plasma_web/components/Tabs/Tabs.stories.tsx +196 -287
- package/types/components/Notification/NotificationsPortal.d.ts.map +1 -1
- package/types/components/Tabs/tokens.d.ts +0 -3
- package/types/components/Tabs/tokens.d.ts.map +1 -1
- package/types/components/Tabs/ui/TabItem/TabItem.d.ts.map +1 -1
- package/types/components/Tabs/ui/TabItem/variations/_view/base.d.ts.map +1 -1
- package/types/components/Tabs/ui/Tabs/Tabs.d.ts +2 -4
- package/types/components/Tabs/ui/Tabs/Tabs.d.ts.map +1 -1
- package/types/components/Tabs/ui/Tabs/Tabs.styles.d.ts.map +1 -1
- package/types/components/Tabs/ui/Tabs/Tabs.types.d.ts +5 -12
- package/types/components/Tabs/ui/Tabs/Tabs.types.d.ts.map +1 -1
- package/types/components/Tabs/ui/Tabs/variations/_stretch/base.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Tabs/TabItem.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Tabs/Tabs.config.d.ts +1 -0
- package/types/examples/plasma_b2c/components/Tabs/Tabs.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Tabs/Tabs.d.ts +1 -2
- package/types/examples/plasma_b2c/components/Tabs/Tabs.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Tabs/TabItem.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Tabs/Tabs.config.d.ts +1 -0
- package/types/examples/plasma_web/components/Tabs/Tabs.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Tabs/Tabs.d.ts +1 -2
- package/types/examples/plasma_web/components/Tabs/Tabs.d.ts.map +1 -1
- package/types/examples/sds_engineer/components/Tabs/Tabs.d.ts +1 -2
- package/types/examples/sds_engineer/components/Tabs/Tabs.d.ts.map +1 -1
- package/cjs/components/Tabs/ui/TabItem/variations/_view/base_7pcxtm.css +0 -1
- package/es/components/Tabs/ui/TabItem/variations/_view/base_7pcxtm.css +0 -1
@@ -1,55 +1,26 @@
|
|
1
1
|
import React, { useState } from 'react';
|
2
2
|
import type { ComponentProps } from 'react';
|
3
3
|
import type { StoryObj, Meta } from '@storybook/react';
|
4
|
-
import
|
4
|
+
import styled from '@emotion/styled';
|
5
5
|
|
6
6
|
import { tabsConfig } from '../../../../components/Tabs';
|
7
7
|
import { mergeConfig } from '../../../../engines';
|
8
8
|
import { argTypesFromConfig, WithTheme } from '../../../_helpers';
|
9
9
|
import { IconMic } from '../../../../components/_Icon';
|
10
|
-
import { Dropdown } from '../Dropdown/Dropdown';
|
11
|
-
import { Counter } from '../Counter/Counter';
|
12
10
|
|
13
11
|
import { config } from './Tabs.config';
|
14
12
|
import { Tabs } from './Tabs';
|
15
13
|
import { TabItem } from './TabItem';
|
16
14
|
|
17
|
-
const
|
18
|
-
const sizes = ['xs', 's', 'm', 'l'] as const;
|
19
|
-
const headerSizes = ['h5', 'h4', 'h3', 'h2', 'h1'] as const;
|
20
|
-
|
21
|
-
type Size = typeof sizes[number];
|
15
|
+
const tabItemViews = ['clear', 'default', 'divider', 'secondary'];
|
22
16
|
|
23
17
|
type CustomStoryTabsProps = {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
const contentLeftOptions = ['none', 'icon'];
|
32
|
-
const contentRightOptions = ['none', 'text', 'counter', 'icon'];
|
33
|
-
|
34
|
-
const getContentLeft = (contentLeftOption: string, size: Size) => {
|
35
|
-
const iconSize = size === 'xs' ? 'xs' : 's';
|
36
|
-
return contentLeftOption === 'icon' ? <IconMic size={iconSize} color="inherit" /> : undefined;
|
37
|
-
};
|
38
|
-
|
39
|
-
const getContentRight = (contentRightOption: string, size: Size) => {
|
40
|
-
const iconSize = size === 'xs' ? 'xs' : 's';
|
41
|
-
const counterSize = size === 'xs' ? 'xxs' : 'xs';
|
42
|
-
|
43
|
-
switch (contentRightOption) {
|
44
|
-
case 'icon':
|
45
|
-
return <IconMic size={iconSize} color="inherit" />;
|
46
|
-
case 'counter':
|
47
|
-
return <Counter size={counterSize} count={1} view="positive" />;
|
48
|
-
case 'text':
|
49
|
-
return <div>Text</div>;
|
50
|
-
default:
|
51
|
-
return undefined;
|
52
|
-
}
|
18
|
+
tabItemView: string;
|
19
|
+
itemsNumber?: number;
|
20
|
+
animated?: boolean;
|
21
|
+
label?: string;
|
22
|
+
showLeftContent: boolean;
|
23
|
+
showRightContent: boolean;
|
53
24
|
};
|
54
25
|
|
55
26
|
type StoryTabsProps = ComponentProps<typeof Tabs> & CustomStoryTabsProps;
|
@@ -60,19 +31,12 @@ const meta: Meta<StoryTabsProps> = {
|
|
60
31
|
decorators: [WithTheme],
|
61
32
|
argTypes: {
|
62
33
|
...argTypesFromConfig(mergeConfig(tabsConfig, config)),
|
63
|
-
|
64
|
-
options:
|
65
|
-
control: {
|
66
|
-
type: 'select',
|
67
|
-
},
|
68
|
-
},
|
69
|
-
contentRight: {
|
70
|
-
options: contentRightOptions,
|
34
|
+
tabItemView: {
|
35
|
+
options: tabItemViews,
|
71
36
|
control: {
|
72
37
|
type: 'select',
|
73
38
|
},
|
74
39
|
},
|
75
|
-
...disableProps(['itemsNumber', 'pilled', 'animated', 'stretch', 'view']),
|
76
40
|
},
|
77
41
|
};
|
78
42
|
|
@@ -80,274 +44,219 @@ export default meta;
|
|
80
44
|
|
81
45
|
const StoryDefault = (props: StoryTabsProps) => {
|
82
46
|
const {
|
47
|
+
itemsNumber,
|
48
|
+
label,
|
49
|
+
view,
|
83
50
|
disabled,
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
hasDivider,
|
89
|
-
} = props;
|
90
|
-
const items = Array(itemQuantity).fill(0);
|
91
|
-
const [index, setIndex] = useState(0);
|
92
|
-
|
93
|
-
return (
|
94
|
-
<Tabs view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size}>
|
95
|
-
{items.map((_, i) => (
|
96
|
-
<TabItem
|
97
|
-
key={`item:${i}`}
|
98
|
-
view="divider"
|
99
|
-
selected={i === index}
|
100
|
-
onClick={() => !disabled && setIndex(i)}
|
101
|
-
tabIndex={!disabled ? 0 : -1}
|
102
|
-
disabled={disabled}
|
103
|
-
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
104
|
-
contentRight={getContentRight(contentRightOption, size as Size)}
|
105
|
-
size={size}
|
106
|
-
>
|
107
|
-
{`Label${i + 1}`}
|
108
|
-
</TabItem>
|
109
|
-
))}
|
110
|
-
</Tabs>
|
111
|
-
);
|
112
|
-
};
|
113
|
-
|
114
|
-
const StoryScroll = (props: StoryTabsProps) => {
|
115
|
-
const {
|
116
|
-
disabled,
|
117
|
-
itemQuantity,
|
118
|
-
clip,
|
51
|
+
stretch,
|
52
|
+
pilled,
|
53
|
+
animated,
|
54
|
+
tabItemView,
|
119
55
|
size,
|
120
|
-
|
121
|
-
|
122
|
-
hasDivider,
|
56
|
+
showLeftContent,
|
57
|
+
showRightContent,
|
123
58
|
} = props;
|
124
|
-
const items = Array(
|
59
|
+
const items = Array(itemsNumber).fill(0);
|
60
|
+
const secondItems = Array(10).fill(0);
|
125
61
|
const [index, setIndex] = useState(0);
|
62
|
+
const [secondIndex, setSecondIndex] = useState(0);
|
63
|
+
const [thirdIndex, setThirdIndex] = useState(0);
|
126
64
|
|
127
65
|
return (
|
128
|
-
|
129
|
-
|
130
|
-
view={
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
))}
|
150
|
-
</Tabs>
|
151
|
-
);
|
152
|
-
};
|
153
|
-
|
154
|
-
const StoryShowAll = (props: StoryTabsProps) => {
|
155
|
-
const {
|
156
|
-
disabled,
|
157
|
-
itemQuantity,
|
158
|
-
clip,
|
159
|
-
size,
|
160
|
-
contentLeft: contentLeftOption,
|
161
|
-
contentRight: contentRightOption,
|
162
|
-
hasDivider,
|
163
|
-
} = props;
|
164
|
-
const maxItemQuantity = 3;
|
165
|
-
const items = Array(itemQuantity).fill(0);
|
166
|
-
const [index, setIndex] = useState(0);
|
167
|
-
|
168
|
-
const visibleItems = items.slice(0, maxItemQuantity);
|
169
|
-
const otherItems = items.slice(maxItemQuantity);
|
170
|
-
|
171
|
-
const dropdownItems = otherItems.map((_, i) => {
|
172
|
-
const itemIndex = maxItemQuantity + i;
|
66
|
+
<>
|
67
|
+
<h3>Tabs with auto width</h3>
|
68
|
+
<Tabs view={view} stretch={stretch} pilled={pilled} disabled={disabled} size={size}>
|
69
|
+
{items.map((_, i) => (
|
70
|
+
<TabItem
|
71
|
+
key={`item:${i}`}
|
72
|
+
view={tabItemView}
|
73
|
+
selected={i === index}
|
74
|
+
onClick={() => !disabled && setIndex(i)}
|
75
|
+
tabIndex={!disabled ? 0 : -1}
|
76
|
+
disabled={disabled}
|
77
|
+
pilled={pilled}
|
78
|
+
animated={animated}
|
79
|
+
contentLeft={showLeftContent && <IconMic size="xs" color="inherit" />}
|
80
|
+
contentRight={showRightContent && <div>Text</div>}
|
81
|
+
size={size}
|
82
|
+
>
|
83
|
+
{label}
|
84
|
+
</TabItem>
|
85
|
+
))}
|
86
|
+
</Tabs>
|
173
87
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
88
|
+
<h3>Tabs with fixed width</h3>
|
89
|
+
<Tabs
|
90
|
+
view={view}
|
91
|
+
stretch={stretch}
|
92
|
+
pilled={pilled}
|
93
|
+
disabled={disabled}
|
94
|
+
size={size}
|
95
|
+
style={{ width: '28.5rem' }}
|
96
|
+
>
|
97
|
+
{secondItems.map((_, i) => (
|
98
|
+
<TabItem
|
99
|
+
key={`item:${i}`}
|
100
|
+
view={tabItemView}
|
101
|
+
selected={i === secondIndex}
|
102
|
+
onClick={() => !disabled && setSecondIndex(i)}
|
103
|
+
tabIndex={!disabled ? 0 : -1}
|
104
|
+
disabled={disabled}
|
105
|
+
pilled={pilled}
|
106
|
+
animated={animated}
|
107
|
+
contentLeft={showLeftContent && <IconMic size="xs" color="inherit" />}
|
108
|
+
contentRight={showRightContent && <div>Text</div>}
|
109
|
+
size={size}
|
110
|
+
>
|
111
|
+
{label}
|
112
|
+
</TabItem>
|
113
|
+
))}
|
114
|
+
</Tabs>
|
179
115
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
{dropdownItems.length > 0 && (
|
198
|
-
<div style={{ marginLeft: '1.75rem' }}>
|
199
|
-
<Dropdown
|
200
|
-
size={size as Size}
|
201
|
-
items={dropdownItems}
|
202
|
-
onItemSelect={(item) => setIndex(item.value as number)}
|
116
|
+
<h3>Tabs with arrow navigation</h3>
|
117
|
+
<Tabs view={view} index={thirdIndex} stretch={stretch} pilled={pilled} disabled={disabled} size={size}>
|
118
|
+
{items.map((_, i) => (
|
119
|
+
<TabItem
|
120
|
+
key={`item:${i}`}
|
121
|
+
view={tabItemView}
|
122
|
+
selected={i === thirdIndex}
|
123
|
+
itemIndex={i}
|
124
|
+
onIndexChange={(i) => setThirdIndex(i)}
|
125
|
+
onClick={() => !disabled && setThirdIndex(i)}
|
126
|
+
tabIndex={!disabled ? 0 : -1}
|
127
|
+
disabled={disabled}
|
128
|
+
pilled={pilled}
|
129
|
+
animated={animated}
|
130
|
+
contentLeft={showLeftContent && <IconMic size="xs" color="inherit" />}
|
131
|
+
contentRight={showRightContent && <div>Text</div>}
|
132
|
+
size={size}
|
203
133
|
>
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
size={size}
|
210
|
-
>
|
211
|
-
ShowAll
|
212
|
-
</TabItem>
|
213
|
-
</Dropdown>
|
214
|
-
</div>
|
215
|
-
)}
|
216
|
-
</Tabs>
|
134
|
+
{label}
|
135
|
+
</TabItem>
|
136
|
+
))}
|
137
|
+
</Tabs>
|
138
|
+
</>
|
217
139
|
);
|
218
140
|
};
|
219
141
|
|
220
142
|
export const Default: StoryObj<StoryTabsProps> = {
|
221
143
|
args: {
|
222
144
|
size: 'xs',
|
145
|
+
itemsNumber: 4,
|
146
|
+
tabItemView: 'divider',
|
223
147
|
disabled: false,
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
type: 'select',
|
232
|
-
},
|
233
|
-
},
|
234
|
-
size: {
|
235
|
-
options: sizes,
|
236
|
-
control: {
|
237
|
-
type: 'select',
|
238
|
-
},
|
239
|
-
},
|
240
|
-
},
|
241
|
-
render: (args) => {
|
242
|
-
switch (args.clip) {
|
243
|
-
case 'scroll':
|
244
|
-
return <StoryScroll {...args} />;
|
245
|
-
case 'showAll':
|
246
|
-
return <StoryShowAll {...args} />;
|
247
|
-
default:
|
248
|
-
return <StoryDefault {...args} />;
|
249
|
-
}
|
148
|
+
stretch: false,
|
149
|
+
pilled: false,
|
150
|
+
animated: true,
|
151
|
+
view: 'divider',
|
152
|
+
label: 'Label',
|
153
|
+
showLeftContent: false,
|
154
|
+
showRightContent: false,
|
250
155
|
},
|
156
|
+
render: (args) => <StoryDefault {...args} />,
|
251
157
|
};
|
252
158
|
|
253
|
-
const
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
contentRight: contentRightOption,
|
259
|
-
hasDivider,
|
260
|
-
stretch,
|
261
|
-
itemQuantity,
|
262
|
-
} = props;
|
263
|
-
const items = Array(itemQuantity).fill(0);
|
264
|
-
const [index, setIndex] = useState(0);
|
265
|
-
|
266
|
-
return (
|
267
|
-
<Tabs view={hasDivider ? 'divider' : 'clear'} stretch={stretch} disabled={disabled} size={size}>
|
268
|
-
{items.map((_, i) => (
|
269
|
-
<TabItem
|
270
|
-
key={`item:${i}`}
|
271
|
-
view="divider"
|
272
|
-
selected={i === index}
|
273
|
-
onClick={() => !disabled && setIndex(i)}
|
274
|
-
tabIndex={!disabled ? 0 : -1}
|
275
|
-
disabled={disabled}
|
276
|
-
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
277
|
-
contentRight={getContentRight(contentRightOption, size as Size)}
|
278
|
-
size={size}
|
279
|
-
>
|
280
|
-
{`Label${i + 1}`}
|
281
|
-
</TabItem>
|
282
|
-
))}
|
283
|
-
</Tabs>
|
284
|
-
);
|
285
|
-
};
|
159
|
+
const StyledMultipleContainer = styled.div`
|
160
|
+
display: flex;
|
161
|
+
align-items: center;
|
162
|
+
column-gap: 1rem;
|
163
|
+
`;
|
286
164
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
},
|
302
|
-
render: (args) => <StoryStretch {...args} />,
|
303
|
-
};
|
165
|
+
const StoryMultiple = ({
|
166
|
+
itemsNumber,
|
167
|
+
label,
|
168
|
+
view,
|
169
|
+
disabled,
|
170
|
+
stretch,
|
171
|
+
pilled,
|
172
|
+
animated,
|
173
|
+
tabItemView,
|
174
|
+
size,
|
175
|
+
showLeftContent,
|
176
|
+
showRightContent,
|
177
|
+
}: StoryTabsProps) => {
|
178
|
+
const items = Array(itemsNumber).fill(0);
|
304
179
|
|
305
|
-
const
|
306
|
-
const
|
307
|
-
disabled,
|
308
|
-
itemQuantity,
|
309
|
-
size,
|
310
|
-
contentLeft: contentLeftOption,
|
311
|
-
contentRight: contentRightOption,
|
312
|
-
hasDivider,
|
313
|
-
} = props;
|
314
|
-
const items = Array(itemQuantity).fill(0);
|
315
|
-
const [index, setIndex] = useState(0);
|
180
|
+
const [index1, setIndex1] = useState(0);
|
181
|
+
const [index2, setIndex2] = useState(0);
|
316
182
|
|
317
183
|
return (
|
318
|
-
<
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
184
|
+
<StyledMultipleContainer>
|
185
|
+
<Tabs
|
186
|
+
view={view}
|
187
|
+
index={index1}
|
188
|
+
stretch={stretch}
|
189
|
+
pilled={pilled}
|
190
|
+
disabled={disabled}
|
191
|
+
size={size}
|
192
|
+
style={{ width: '12rem' }}
|
193
|
+
>
|
194
|
+
{items.map((_, i) => (
|
195
|
+
<TabItem
|
196
|
+
key={`item:${i}`}
|
197
|
+
view={tabItemView}
|
198
|
+
selected={i === index1}
|
199
|
+
itemIndex={i}
|
200
|
+
onIndexChange={(i) => setIndex1(i)}
|
201
|
+
onClick={() => !disabled && setIndex1(i)}
|
202
|
+
tabIndex={!disabled ? 0 : -1}
|
203
|
+
disabled={disabled}
|
204
|
+
pilled={pilled}
|
205
|
+
animated={animated}
|
206
|
+
contentLeft={showLeftContent && <IconMic size="xs" color="inherit" />}
|
207
|
+
contentRight={showRightContent && <div>Text</div>}
|
208
|
+
size={size}
|
209
|
+
>
|
210
|
+
{label}
|
211
|
+
</TabItem>
|
212
|
+
))}
|
213
|
+
</Tabs>
|
214
|
+
<Tabs
|
215
|
+
view={view}
|
216
|
+
index={index2}
|
217
|
+
stretch={stretch}
|
218
|
+
pilled={pilled}
|
219
|
+
disabled={disabled}
|
220
|
+
size={size}
|
221
|
+
style={{ width: '12rem' }}
|
222
|
+
>
|
223
|
+
{items.map((_, i) => (
|
224
|
+
<TabItem
|
225
|
+
key={`item:${i}`}
|
226
|
+
view={tabItemView}
|
227
|
+
selected={i === index2}
|
228
|
+
itemIndex={i}
|
229
|
+
onIndexChange={(i) => setIndex2(i)}
|
230
|
+
onClick={() => !disabled && setIndex2(i)}
|
231
|
+
tabIndex={!disabled ? 0 : -1}
|
232
|
+
disabled={disabled}
|
233
|
+
pilled={pilled}
|
234
|
+
animated={animated}
|
235
|
+
contentLeft={showLeftContent && <IconMic size="xs" color="inherit" />}
|
236
|
+
contentRight={showRightContent && <div>Text</div>}
|
237
|
+
size={size}
|
238
|
+
>
|
239
|
+
{label}
|
240
|
+
</TabItem>
|
241
|
+
))}
|
242
|
+
</Tabs>
|
243
|
+
</StyledMultipleContainer>
|
335
244
|
);
|
336
245
|
};
|
337
246
|
|
338
|
-
export const
|
247
|
+
export const Multiple: StoryObj<StoryTabsProps> = {
|
339
248
|
args: {
|
340
|
-
size: '
|
249
|
+
size: 'xs',
|
250
|
+
itemsNumber: 6,
|
251
|
+
tabItemView: 'divider',
|
341
252
|
disabled: false,
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
},
|
350
|
-
},
|
253
|
+
stretch: false,
|
254
|
+
pilled: false,
|
255
|
+
animated: true,
|
256
|
+
view: 'divider',
|
257
|
+
label: 'Label',
|
258
|
+
showLeftContent: false,
|
259
|
+
showRightContent: false,
|
351
260
|
},
|
352
|
-
render: (args) => <
|
261
|
+
render: (args) => <StoryMultiple {...args} />,
|
353
262
|
};
|
@@ -1,6 +1,8 @@
|
|
1
|
+
import './NotificationsPortal_6417q6.css';
|
1
2
|
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
3
|
import React, { useMemo } from 'react';
|
3
4
|
import { useStoreon } from 'storeon/react';
|
5
|
+
import { styled } from '@linaria/react';
|
4
6
|
import { PopupProvider } from '../Popup/PopupContext.js';
|
5
7
|
import { popupConfig } from '../Popup/Popup.js';
|
6
8
|
import '@linaria/core';
|
@@ -14,6 +16,14 @@ var _excluded = ["id", "isHidden"];
|
|
14
16
|
|
15
17
|
// issue #823
|
16
18
|
var Popup = /*#__PURE__*/component(popupConfig);
|
19
|
+
var _exp = function _exp() {
|
20
|
+
return Popup;
|
21
|
+
};
|
22
|
+
var StyledPopup = /*#__PURE__*/styled(_exp())({
|
23
|
+
name: "StyledPopup",
|
24
|
+
"class": "s19gbs9t",
|
25
|
+
propsAsIs: true
|
26
|
+
});
|
17
27
|
|
18
28
|
/**
|
19
29
|
* Обертка для визуального представления уведомлений.
|
@@ -26,7 +36,7 @@ var NotificationsPortal = function NotificationsPortal(_ref) {
|
|
26
36
|
var Notification = useMemo(function () {
|
27
37
|
return component(config);
|
28
38
|
}, []);
|
29
|
-
return /*#__PURE__*/React.createElement(PopupProvider, null, notifications.length > 0 && /*#__PURE__*/React.createElement(
|
39
|
+
return /*#__PURE__*/React.createElement(PopupProvider, null, notifications.length > 0 && /*#__PURE__*/React.createElement(StyledPopup, {
|
30
40
|
isOpen: true,
|
31
41
|
frame: frame,
|
32
42
|
placement: "bottom-right",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NotificationsPortal.js","sources":["../../../src/components/Notification/NotificationsPortal.tsx"],"sourcesContent":["import React, { FC, ForwardRefExoticComponent, RefAttributes, useMemo } from 'react';\nimport { useStoreon } from 'storeon/react';\n\nimport { PopupProvider, popupConfig } from '../Popup';\nimport { component } from '../../engines';\nimport { cx } from '../../utils';\n\nimport { NotificationsState, NotificationsEvents, closeNotification } from './NotificationsStore';\nimport { NotificationPortalProps, NotificationProps } from './Notification.types';\nimport { StyledItemWrapper, StyledRoot } from './Notification.styles';\nimport { classes } from './Notification.tokens';\n\n// issue #823\nconst Popup = component(popupConfig);\n\n/**\n * Обертка для визуального представления уведомлений.\n */\nexport const NotificationsPortal: FC<NotificationPortalProps> = ({ config, frame }) => {\n const { notifications } = useStoreon<NotificationsState, NotificationsEvents>('notifications');\n\n const Notification = useMemo(\n () => component(config) as ForwardRefExoticComponent<NotificationProps & RefAttributes<HTMLDivElement>>,\n [],\n );\n\n return (\n <PopupProvider>\n {notifications.length > 0 && (\n <
|
1
|
+
{"version":3,"file":"NotificationsPortal.js","sources":["../../../src/components/Notification/NotificationsPortal.tsx"],"sourcesContent":["import React, { FC, ForwardRefExoticComponent, RefAttributes, useMemo } from 'react';\nimport { useStoreon } from 'storeon/react';\nimport { styled } from '@linaria/react';\nimport { popupBaseRootClass } from '@salutejs/plasma-core';\n\nimport { PopupProvider, popupConfig } from '../Popup';\nimport { component } from '../../engines';\nimport { cx } from '../../utils';\n\nimport { NotificationsState, NotificationsEvents, closeNotification } from './NotificationsStore';\nimport { NotificationPortalProps, NotificationProps } from './Notification.types';\nimport { StyledItemWrapper, StyledRoot } from './Notification.styles';\nimport { classes } from './Notification.tokens';\n\n// issue #823\nconst Popup = component(popupConfig);\n\nconst StyledPopup = styled(Popup)`\n & > .${popupBaseRootClass} {\n overflow: hidden;\n }\n`;\n\n/**\n * Обертка для визуального представления уведомлений.\n */\nexport const NotificationsPortal: FC<NotificationPortalProps> = ({ config, frame }) => {\n const { notifications } = useStoreon<NotificationsState, NotificationsEvents>('notifications');\n\n const Notification = useMemo(\n () => component(config) as ForwardRefExoticComponent<NotificationProps & RefAttributes<HTMLDivElement>>,\n [],\n );\n\n return (\n <PopupProvider>\n {notifications.length > 0 && (\n <StyledPopup isOpen frame={frame} placement=\"bottom-right\" zIndex=\"9100\">\n <StyledRoot>\n {notifications.map(({ id, isHidden, ...rest }) => (\n <StyledItemWrapper\n key={id}\n className={cx(\n isHidden ? classes.notificationItemHidden : classes.notificationItemOpened,\n )}\n isHidden={isHidden || false}\n >\n <Notification\n key={id}\n id={id}\n onCloseButtonClick={() => closeNotification(id)}\n {...rest}\n />\n </StyledItemWrapper>\n ))}\n </StyledRoot>\n </StyledPopup>\n )}\n </PopupProvider>\n );\n};\n"],"names":["Popup","component","popupConfig","_exp","StyledPopup","styled","name","class","propsAsIs","NotificationsPortal","_ref","config","frame","_useStoreon","useStoreon","notifications","Notification","useMemo","React","createElement","PopupProvider","length","isOpen","placement","zIndex","StyledRoot","map","_ref2","id","isHidden","rest","StyledItemWrapper","key","className","cx","classes","notificationItemHidden","notificationItemOpened","_extends","onCloseButtonClick","closeNotification"],"mappings":";;;;;;;;;;;;;;;AAcA;AACA,IAAMA,KAAK,gBAAGC,SAAS,CAACC,WAAW,CAAC,CAAA;AAAC,IAAAC,IAAA,GAdnBA,SAcmBA,IAAAA,GAAA;AAAA,EAAA,OAEVH,KAAK,CAAA;AAAA,CAAA,CAAA;AAAhC,IAAMI,WAAW,gBAAGC,MAAM,CAAAF,IAAA,EAAA,CAAA,CAAA;AAAAG,EAAAA,IAAA,EAAA,aAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAIzB,CAAA,CAAA;;AAED;AACA;AACA;IACaC,mBAAgD,GAAGA,SAAnDA,mBAAgDA,CAAAC,IAAA,EAA0B;AAAA,EAAA,IAApBC,MAAM,GAAAD,IAAA,CAANC,MAAM;IAAEC,KAAAA,GAAAA,IAAAA,CAAAA,KAAAA,CAAAA;AACvE,EAAA,IAAAC,WAAA,GAA0BC,UAAU,CAA0C,eAAe,CAAC;IAAtFC,aAAAA,GAAAA,WAAAA,CAAAA,aAAAA,CAAAA;EAER,IAAMC,YAAY,GAAGC,OAAO,CACxB,YAAA;IAAA,OAAMhB,SAAS,CAACU,MAAM,CAAC,CAAA;GACvB,EAAA,EACJ,CAAC,CAAA;AAED,EAAA,oBACIO,KAAA,CAAAC,aAAA,CAACC,aAAa,QACTL,aAAa,CAACM,MAAM,GAAG,CAAC,iBACrBH,KAAA,CAAAC,aAAA,CAACf,WAAW,EAAA;IAACkB,MAAM,EAAA,IAAA;AAACV,IAAAA,KAAK,EAAEA,KAAM;AAACW,IAAAA,SAAS,EAAC,cAAc;AAACC,IAAAA,MAAM,EAAC,MAAA;GAC9DN,eAAAA,KAAA,CAAAC,aAAA,CAACM,UAAU,EACNV,IAAAA,EAAAA,aAAa,CAACW,GAAG,CAAC,UAAAC,KAAA,EAAA;AAAA,IAAA,IAAGC,EAAE,GAAAD,KAAA,CAAFC,EAAE;MAAEC,QAAQ,GAAAF,KAAA,CAARE,QAAQ;AAAKC,MAAAA,IAAAA,GAAAA,wBAAAA,CAAAA,KAAAA,EAAAA,SAAAA,CAAAA,CAAAA;AAAAA,IAAAA,oBACnCZ,KAAA,CAAAC,aAAA,CAACY,iBAAiB,EAAA;AACdC,MAAAA,GAAG,EAAEJ,EAAG;AACRK,MAAAA,SAAS,EAAEC,EAAE,CACTL,QAAQ,GAAGM,OAAO,CAACC,sBAAsB,GAAGD,OAAO,CAACE,sBACxD,CAAE;MACFR,QAAQ,EAAEA,QAAQ,IAAI,KAAA;AAAM,KAAA,eAE5BX,KAAA,CAAAC,aAAA,CAACH,YAAY,EAAAsB,QAAA,CAAA;AACTN,MAAAA,GAAG,EAAEJ,EAAG;AACRA,MAAAA,EAAE,EAAEA,EAAG;MACPW,kBAAkB,EAAE,SAAAA,kBAAA,GAAA;QAAA,OAAMC,iBAAiB,CAACZ,EAAE,CAAC,CAAA;AAAA,OAAA;KAC3CE,EAAAA,IAAI,CAAC,CAEE,CACtB,CAAA;GACO,CAAA,CACH,CAEN,CAAC,CAAA;AAExB;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
.s19gbs9t > .popup-base-root{overflow:hidden;}
|
@@ -39,3 +39,5 @@
|
|
39
39
|
.Notification_styles_7h8hp0_s92kmpm__2b784e15{font-family:var(--plasma-notification-content-font-family);font-size:var(--plasma-notification-content-font-size);font-style:var(--plasma-notification-content-font-style);font-weight:var(--plasma-notification-content-font-weight);-webkit-letter-spacing:var(--plasma-notification-content-font-letter-spacing);-moz-letter-spacing:var(--plasma-notification-content-font-letter-spacing);-ms-letter-spacing:var(--plasma-notification-content-font-letter-spacing);letter-spacing:var(--plasma-notification-content-font-letter-spacing);line-height:var(--plasma-notification-content-font-line-height);overflow-wrap:break-word;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;color:var(--plasma-notification-content-color);}
|
40
40
|
.Notification_styles_7h8hp0_s18m0x6v__2b784e15{margin-top:1rem;opacity:1;}.Notification_styles_7h8hp0_s18m0x6v__2b784e15.Notification_styles_7h8hp0_s18m0x6v__2b784e15.Notification_styles_7h8hp0_notificationItemOpened__2b784e15{-webkit-animation:0.4s Notification_styles_7h8hp0_showAnimationS18m0x6v__2b784e15 ease-out;animation:0.4s Notification_styles_7h8hp0_showAnimationS18m0x6v__2b784e15 ease-out;}.Notification_styles_7h8hp0_s18m0x6v__2b784e15.Notification_styles_7h8hp0_s18m0x6v__2b784e15.Notification_styles_7h8hp0_notificationItemHidden__2b784e15{-webkit-animation:0.4s Notification_styles_7h8hp0_hideAnimationS18m0x6v__2b784e15 ease-out;animation:0.4s Notification_styles_7h8hp0_hideAnimationS18m0x6v__2b784e15 ease-out;}@-webkit-keyframes Notification_styles_7h8hp0_showAnimationS18m0x6v__2b784e15{0%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);opacity:0;}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);opacity:1;}}@keyframes Notification_styles_7h8hp0_showAnimationS18m0x6v__2b784e15{0%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);opacity:0;}100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);opacity:1;}}@-webkit-keyframes Notification_styles_7h8hp0_hideAnimationS18m0x6v__2b784e15{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);opacity:1;}100%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);opacity:0;}}@keyframes Notification_styles_7h8hp0_hideAnimationS18m0x6v__2b784e15{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);opacity:1;}100%{-webkit-transform:translateX(100%);-ms-transform:translateX(100%);transform:translateX(100%);opacity:0;}}
|
41
41
|
.Notification_styles_7h8hp0_sfe5ql2__2b784e15{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;box-sizing:border-box;padding:0 1.5rem 1.5rem;max-height:100%;-webkit-align-items:flex-end;-webkit-box-align:flex-end;-ms-flex-align:flex-end;align-items:flex-end;}
|
42
|
+
|
43
|
+
.NotificationsPortal_6417q6_s19gbs9t__4166aeb6 > .NotificationsPortal_6417q6_popupBaseRoot__4166aeb6{overflow:hidden;}
|
@@ -9,9 +9,7 @@ var classes = {
|
|
9
9
|
tabRightContent: 'tab-item-right-content',
|
10
10
|
tabLeftContent: 'tab-item-left-content',
|
11
11
|
tabsHasLeftArrow: 'tabs-has-left-arrow',
|
12
|
-
tabsHasRightArrow: 'tabs-has-right-arrow'
|
13
|
-
tabsClipScroll: 'tabs-clip-scroll',
|
14
|
-
tabsClipShowAll: 'tabs-clip-show-all'
|
12
|
+
tabsHasRightArrow: 'tabs-has-right-arrow'
|
15
13
|
};
|
16
14
|
var tokens = {
|
17
15
|
disabledOpacity: '--plasma-tabs-disabled-opacity',
|
@@ -28,7 +26,7 @@ var tokens = {
|
|
28
26
|
outlineFocusColor: '--plasma-tabs-outline-focus-color',
|
29
27
|
arrowColor: '--plasma-tabs-arrow-color',
|
30
28
|
tabsFilledBackgroundColor: '--plasma-tabs-filled-background-color',
|
31
|
-
tabsBackgroundColor: '--plasma-tabs-
|
29
|
+
tabsBackgroundColor: '--plasma-tabs-backgorund-color',
|
32
30
|
tabsBorderRadius: '--plasma-tabs-border-radius',
|
33
31
|
tabsWidth: '--plasma-tabs-width',
|
34
32
|
tabsHeight: '--plasma-tabs-height',
|
@@ -52,7 +50,6 @@ var tokens = {
|
|
52
50
|
itemColor: '--plasma-tab-item-color',
|
53
51
|
itemBackgroundColor: '--plasma-tab-item-background-color',
|
54
52
|
itemColorHover: '--plasma-tab-item-color-hover',
|
55
|
-
itemColorActive: '--plasma-tab-item-color-active',
|
56
53
|
itemBackgroundColorHover: '--plasma-tab-item-background-color-hover',
|
57
54
|
itemSelectedColor: '--plasma-tab-item-selected-color',
|
58
55
|
itemSelectedBackgroundColor: '--plasma-tab-item-selected-background-color',
|