@salutejs/plasma-new-hope 0.114.1-canary.1333.10211221618.0 → 0.114.1-canary.1333.10245863111.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Tabs/ui/Tabs/Tabs.css +4 -4
- package/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -1
- package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
- package/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
- package/cjs/components/Tabs/ui/Tabs/Tabs.styles.js.map +1 -1
- package/cjs/components/Tabs/ui/Tabs/{Tabs.styles_106qhdc.css → Tabs.styles_z4dnzh.css} +1 -1
- package/cjs/index.css +4 -4
- package/emotion/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -1
- package/emotion/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +8 -8
- package/emotion/cjs/examples/plasma_b2c/components/Tabs/TabItem.config.js +15 -15
- package/emotion/cjs/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +49 -71
- package/emotion/cjs/examples/plasma_web/components/Tabs/TabItem.config.js +15 -15
- package/emotion/cjs/examples/plasma_web/components/Tabs/Tabs.stories.tsx +49 -71
- package/emotion/es/components/Tabs/ui/Tabs/Tabs.js +2 -1
- package/emotion/es/components/Tabs/ui/Tabs/Tabs.styles.js +8 -8
- package/emotion/es/examples/plasma_b2c/components/Tabs/TabItem.config.js +15 -15
- package/emotion/es/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +49 -71
- package/emotion/es/examples/plasma_web/components/Tabs/TabItem.config.js +15 -15
- package/emotion/es/examples/plasma_web/components/Tabs/Tabs.stories.tsx +49 -71
- package/es/components/Tabs/ui/Tabs/Tabs.css +4 -4
- package/es/components/Tabs/ui/Tabs/Tabs.js +2 -1
- package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
- package/es/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
- package/es/components/Tabs/ui/Tabs/Tabs.styles.js.map +1 -1
- package/es/components/Tabs/ui/Tabs/{Tabs.styles_106qhdc.css → Tabs.styles_z4dnzh.css} +1 -1
- package/es/index.css +4 -4
- package/package.json +2 -2
- package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -1
- package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Tabs/TabItem.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +49 -71
- package/styled-components/cjs/examples/plasma_web/components/Tabs/TabItem.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Tabs/Tabs.stories.tsx +49 -71
- package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +2 -1
- package/styled-components/es/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Tabs/TabItem.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +49 -71
- package/styled-components/es/examples/plasma_web/components/Tabs/TabItem.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Tabs/Tabs.stories.tsx +49 -71
- package/types/components/Tabs/ui/Tabs/Tabs.styles.d.ts.map +1 -1
@@ -18,8 +18,11 @@ const clips = ['none', 'scroll', 'showAll'];
|
|
18
18
|
const sizes = ['xs', 's', 'm', 'l'] as const;
|
19
19
|
const headerSizes = ['h5', 'h4', 'h3', 'h2', 'h1'] as const;
|
20
20
|
|
21
|
+
type Size = typeof sizes[number];
|
22
|
+
|
21
23
|
type CustomStoryTabsProps = {
|
22
24
|
hasDivider: boolean;
|
25
|
+
itemQuantity: number;
|
23
26
|
contentLeft: string;
|
24
27
|
contentRight: string;
|
25
28
|
stretch?: boolean;
|
@@ -28,15 +31,20 @@ type CustomStoryTabsProps = {
|
|
28
31
|
const contentLeftOptions = ['none', 'icon'];
|
29
32
|
const contentRightOptions = ['none', 'text', 'counter', 'icon'];
|
30
33
|
|
31
|
-
const getContentLeft = (contentLeftOption: string) =>
|
32
|
-
|
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';
|
33
42
|
|
34
|
-
const getContentRight = (contentRightOption: string) => {
|
35
43
|
switch (contentRightOption) {
|
36
44
|
case 'icon':
|
37
|
-
return <IconMic size=
|
45
|
+
return <IconMic size={iconSize} color="inherit" />;
|
38
46
|
case 'counter':
|
39
|
-
return <Counter count={1} view="positive" />;
|
47
|
+
return <Counter size={counterSize} count={1} view="positive" />;
|
40
48
|
case 'text':
|
41
49
|
return <div>Text</div>;
|
42
50
|
default:
|
@@ -64,19 +72,27 @@ const meta: Meta<StoryTabsProps> = {
|
|
64
72
|
type: 'select',
|
65
73
|
},
|
66
74
|
},
|
67
|
-
...disableProps(['itemsNumber', 'pilled', 'animated', '
|
75
|
+
...disableProps(['itemsNumber', 'pilled', 'animated', 'view']),
|
68
76
|
},
|
69
77
|
};
|
70
78
|
|
71
79
|
export default meta;
|
72
80
|
|
73
81
|
const StoryDefault = (props: StoryTabsProps) => {
|
74
|
-
const {
|
75
|
-
|
82
|
+
const {
|
83
|
+
disabled,
|
84
|
+
itemQuantity,
|
85
|
+
size,
|
86
|
+
contentLeft: contentLeftOption,
|
87
|
+
contentRight: contentRightOption,
|
88
|
+
hasDivider,
|
89
|
+
stretch,
|
90
|
+
} = props;
|
91
|
+
const items = Array(itemQuantity).fill(0);
|
76
92
|
const [index, setIndex] = useState(0);
|
77
93
|
|
78
94
|
return (
|
79
|
-
<Tabs view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size}>
|
95
|
+
<Tabs view={hasDivider ? 'divider' : 'clear'} stretch={stretch} disabled={disabled} size={size}>
|
80
96
|
{items.map((_, i) => (
|
81
97
|
<TabItem
|
82
98
|
key={`item:${i}`}
|
@@ -85,8 +101,8 @@ const StoryDefault = (props: StoryTabsProps) => {
|
|
85
101
|
onClick={() => !disabled && setIndex(i)}
|
86
102
|
tabIndex={!disabled ? 0 : -1}
|
87
103
|
disabled={disabled}
|
88
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
89
|
-
contentRight={getContentRight(contentRightOption)}
|
104
|
+
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
105
|
+
contentRight={getContentRight(contentRightOption, size as Size)}
|
90
106
|
size={size}
|
91
107
|
>
|
92
108
|
{`Label${i + 1}`}
|
@@ -99,13 +115,14 @@ const StoryDefault = (props: StoryTabsProps) => {
|
|
99
115
|
const StoryScroll = (props: StoryTabsProps) => {
|
100
116
|
const {
|
101
117
|
disabled,
|
118
|
+
itemQuantity,
|
102
119
|
clip,
|
103
120
|
size,
|
104
121
|
contentLeft: contentLeftOption,
|
105
122
|
contentRight: contentRightOption,
|
106
123
|
hasDivider,
|
107
124
|
} = props;
|
108
|
-
const items = Array(
|
125
|
+
const items = Array(itemQuantity).fill(0);
|
109
126
|
const [index, setIndex] = useState(0);
|
110
127
|
|
111
128
|
return (
|
@@ -124,8 +141,8 @@ const StoryScroll = (props: StoryTabsProps) => {
|
|
124
141
|
onClick={() => !disabled && setIndex(i)}
|
125
142
|
tabIndex={!disabled ? 0 : -1}
|
126
143
|
disabled={disabled}
|
127
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
128
|
-
contentRight={getContentRight(contentRightOption)}
|
144
|
+
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
145
|
+
contentRight={getContentRight(contentRightOption, size as Size)}
|
129
146
|
size={size}
|
130
147
|
>
|
131
148
|
{`Label${i + 1}`}
|
@@ -138,21 +155,22 @@ const StoryScroll = (props: StoryTabsProps) => {
|
|
138
155
|
const StoryShowAll = (props: StoryTabsProps) => {
|
139
156
|
const {
|
140
157
|
disabled,
|
158
|
+
itemQuantity,
|
141
159
|
clip,
|
142
160
|
size,
|
143
161
|
contentLeft: contentLeftOption,
|
144
162
|
contentRight: contentRightOption,
|
145
163
|
hasDivider,
|
146
164
|
} = props;
|
147
|
-
const
|
148
|
-
const items = Array(
|
165
|
+
const maxItemQuantity = 3;
|
166
|
+
const items = Array(itemQuantity).fill(0);
|
149
167
|
const [index, setIndex] = useState(0);
|
150
168
|
|
151
|
-
const visibleItems = items.slice(0,
|
152
|
-
const otherItems = items.slice(
|
169
|
+
const visibleItems = items.slice(0, maxItemQuantity);
|
170
|
+
const otherItems = items.slice(maxItemQuantity);
|
153
171
|
|
154
172
|
const dropdownItems = otherItems.map((_, i) => {
|
155
|
-
const itemIndex =
|
173
|
+
const itemIndex = maxItemQuantity + i;
|
156
174
|
|
157
175
|
return {
|
158
176
|
label: `Label${itemIndex + 1}`,
|
@@ -170,8 +188,8 @@ const StoryShowAll = (props: StoryTabsProps) => {
|
|
170
188
|
onClick={() => !disabled && setIndex(i)}
|
171
189
|
tabIndex={!disabled ? 0 : -1}
|
172
190
|
disabled={disabled}
|
173
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
174
|
-
contentRight={getContentRight(contentRightOption)}
|
191
|
+
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
192
|
+
contentRight={getContentRight(contentRightOption, size as Size)}
|
175
193
|
size={size}
|
176
194
|
>
|
177
195
|
{`Label${i + 1}`}
|
@@ -180,7 +198,7 @@ const StoryShowAll = (props: StoryTabsProps) => {
|
|
180
198
|
{dropdownItems.length > 0 && (
|
181
199
|
<div style={{ marginLeft: '1.75rem' }}>
|
182
200
|
<Dropdown
|
183
|
-
size={size as
|
201
|
+
size={size as Size}
|
184
202
|
items={dropdownItems}
|
185
203
|
onItemSelect={(item) => setIndex(item.value as number)}
|
186
204
|
>
|
@@ -205,6 +223,8 @@ export const Default: StoryObj<StoryTabsProps> = {
|
|
205
223
|
size: 'xs',
|
206
224
|
disabled: false,
|
207
225
|
hasDivider: true,
|
226
|
+
itemQuantity: 8,
|
227
|
+
clip: 'scroll',
|
208
228
|
},
|
209
229
|
argTypes: {
|
210
230
|
clip: {
|
@@ -219,6 +239,7 @@ export const Default: StoryObj<StoryTabsProps> = {
|
|
219
239
|
type: 'select',
|
220
240
|
},
|
221
241
|
},
|
242
|
+
stretch: { control: 'boolean', if: { arg: 'clip', eq: 'none' } },
|
222
243
|
},
|
223
244
|
render: (args) => {
|
224
245
|
switch (args.clip) {
|
@@ -232,60 +253,16 @@ export const Default: StoryObj<StoryTabsProps> = {
|
|
232
253
|
},
|
233
254
|
};
|
234
255
|
|
235
|
-
const
|
256
|
+
const StoryHeaderTabs = (props: StoryTabsProps) => {
|
236
257
|
const {
|
237
258
|
disabled,
|
259
|
+
itemQuantity,
|
238
260
|
size,
|
239
261
|
contentLeft: contentLeftOption,
|
240
262
|
contentRight: contentRightOption,
|
241
263
|
hasDivider,
|
242
|
-
stretch,
|
243
264
|
} = props;
|
244
|
-
const items = Array(
|
245
|
-
const [index, setIndex] = useState(0);
|
246
|
-
|
247
|
-
return (
|
248
|
-
<Tabs view={hasDivider ? 'divider' : 'clear'} stretch={stretch} disabled={disabled} size={size}>
|
249
|
-
{items.map((_, i) => (
|
250
|
-
<TabItem
|
251
|
-
key={`item:${i}`}
|
252
|
-
view="divider"
|
253
|
-
selected={i === index}
|
254
|
-
onClick={() => !disabled && setIndex(i)}
|
255
|
-
tabIndex={!disabled ? 0 : -1}
|
256
|
-
disabled={disabled}
|
257
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
258
|
-
contentRight={getContentRight(contentRightOption)}
|
259
|
-
size={size}
|
260
|
-
>
|
261
|
-
{`Label${i + 1}`}
|
262
|
-
</TabItem>
|
263
|
-
))}
|
264
|
-
</Tabs>
|
265
|
-
);
|
266
|
-
};
|
267
|
-
|
268
|
-
export const Stretch: StoryObj<StoryTabsProps> = {
|
269
|
-
args: {
|
270
|
-
size: 'xs',
|
271
|
-
stretch: true,
|
272
|
-
disabled: false,
|
273
|
-
hasDivider: true,
|
274
|
-
},
|
275
|
-
argTypes: {
|
276
|
-
size: {
|
277
|
-
options: sizes,
|
278
|
-
control: {
|
279
|
-
type: 'select',
|
280
|
-
},
|
281
|
-
},
|
282
|
-
},
|
283
|
-
render: (args) => <StoryStretch {...args} />,
|
284
|
-
};
|
285
|
-
|
286
|
-
const StoryHeaderTabs = (props: StoryTabsProps) => {
|
287
|
-
const { disabled, size, contentLeft: contentLeftOption, contentRight: contentRightOption, hasDivider } = props;
|
288
|
-
const items = Array(4).fill(0);
|
265
|
+
const items = Array(itemQuantity).fill(0);
|
289
266
|
const [index, setIndex] = useState(0);
|
290
267
|
|
291
268
|
return (
|
@@ -298,8 +275,8 @@ const StoryHeaderTabs = (props: StoryTabsProps) => {
|
|
298
275
|
onClick={() => !disabled && setIndex(i)}
|
299
276
|
tabIndex={!disabled ? 0 : -1}
|
300
277
|
disabled={disabled}
|
301
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
302
|
-
contentRight={getContentRight(contentRightOption)}
|
278
|
+
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
279
|
+
contentRight={getContentRight(contentRightOption, size as Size)}
|
303
280
|
size={size}
|
304
281
|
>
|
305
282
|
{`Label${i + 1}`}
|
@@ -314,6 +291,7 @@ export const HeaderTabs: StoryObj<StoryTabsProps> = {
|
|
314
291
|
size: 'h5',
|
315
292
|
disabled: false,
|
316
293
|
hasDivider: true,
|
294
|
+
itemQuantity: 4,
|
317
295
|
},
|
318
296
|
argTypes: {
|
319
297
|
size: {
|
@@ -15,7 +15,7 @@ export var config = {
|
|
15
15
|
size: {
|
16
16
|
xs: /*#__PURE__*/css(["", ":0.375rem;", ":auto;", ":2rem;", ":0 0.5rem;", ":0 0.375rem;", ":1.75rem;", ":0.25rem;", ":0.125rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);"], tabsTokens.itemBorderRadius, tabsTokens.itemWidth, tabsTokens.itemHeight, tabsTokens.itemPadding, tabsTokens.itemPaddingPilled, tabsTokens.itemMarginLeft, tabsTokens.itemContentGap, tabsTokens.itemContentPadding, tabsTokens.fontFamily, tabsTokens.fontSize, tabsTokens.fontStyle, tabsTokens.fontWeight, tabsTokens.letterSpacing, tabsTokens.lineHeight),
|
17
17
|
s: /*#__PURE__*/css(["", ":0.5rem;", ":auto;", ":2.5rem;", ":0 0.625rem;", ":0 0.5rem;", ":1.75rem;", ":0.25rem;", ":0.125rem;", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);"], tabsTokens.itemBorderRadius, tabsTokens.itemWidth, tabsTokens.itemHeight, tabsTokens.itemPadding, tabsTokens.itemPaddingPilled, tabsTokens.itemMarginLeft, tabsTokens.itemContentGap, tabsTokens.itemContentPadding, tabsTokens.fontFamily, tabsTokens.fontSize, tabsTokens.fontStyle, tabsTokens.fontWeight, tabsTokens.letterSpacing, tabsTokens.lineHeight),
|
18
|
-
m: /*#__PURE__*/css(["", ":0.625rem;", ":auto;", ":3rem;", ":0 0.625rem;", ":0 0.5rem;", ":1.75rem;", ":0.
|
18
|
+
m: /*#__PURE__*/css(["", ":0.625rem;", ":auto;", ":3rem;", ":0 0.625rem;", ":0 0.5rem;", ":1.75rem;", ":0.375rem;", ":0.125rem;", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);"], tabsTokens.itemBorderRadius, tabsTokens.itemWidth, tabsTokens.itemHeight, tabsTokens.itemPadding, tabsTokens.itemPaddingPilled, tabsTokens.itemMarginLeft, tabsTokens.itemContentGap, tabsTokens.itemContentPadding, tabsTokens.fontFamily, tabsTokens.fontSize, tabsTokens.fontStyle, tabsTokens.fontWeight, tabsTokens.letterSpacing, tabsTokens.lineHeight),
|
19
19
|
l: /*#__PURE__*/css(["", ":0.75rem;", ":auto;", ":3.5rem;", ":0 0.875rem;", ":0 0.75rem;", ":1.75rem;", ":0.5rem;", ":0.125rem;", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);"], tabsTokens.itemBorderRadius, tabsTokens.itemWidth, tabsTokens.itemHeight, tabsTokens.itemPadding, tabsTokens.itemPaddingPilled, tabsTokens.itemMarginLeft, tabsTokens.itemContentGap, tabsTokens.itemContentPadding, tabsTokens.fontFamily, tabsTokens.fontSize, tabsTokens.fontStyle, tabsTokens.fontWeight, tabsTokens.letterSpacing, tabsTokens.lineHeight),
|
20
20
|
h5: /*#__PURE__*/css(["", ":0.375rem;", ":auto;", ":3rem;", ":0rem;", ":1.75rem;", ":0.625rem;", ":var(--plasma-typo-h5-font-family);", ":var(--plasma-typo-h5-font-size);", ":var(--plasma-typo-h5-font-style);", ":var(--plasma-typo-h5-font-weight);", ":var(--plasma-typo-h5-letter-spacing);", ":var(--plasma-typo-h5-line-height);"], tabsTokens.itemBorderRadius, tabsTokens.itemWidth, tabsTokens.itemHeight, tabsTokens.itemPadding, tabsTokens.itemMarginLeft, tabsTokens.itemContentGap, tabsTokens.fontFamily, tabsTokens.fontSize, tabsTokens.fontStyle, tabsTokens.fontWeight, tabsTokens.letterSpacing, tabsTokens.lineHeight),
|
21
21
|
h4: /*#__PURE__*/css(["", ":0.375rem;", ":auto;", ":3.25rem;", ":0rem;", ":2rem;", ":0.625rem;", ":var(--plasma-typo-h4-font-family);", ":var(--plasma-typo-h4-font-size);", ":var(--plasma-typo-h4-font-style);", ":var(--plasma-typo-h4-font-weight);", ":var(--plasma-typo-h4-letter-spacing);", ":var(--plasma-typo-h4-line-height);"], tabsTokens.itemBorderRadius, tabsTokens.itemWidth, tabsTokens.itemHeight, tabsTokens.itemPadding, tabsTokens.itemMarginLeft, tabsTokens.itemContentGap, tabsTokens.fontFamily, tabsTokens.fontSize, tabsTokens.fontStyle, tabsTokens.fontWeight, tabsTokens.letterSpacing, tabsTokens.lineHeight),
|
@@ -18,8 +18,11 @@ const clips = ['none', 'scroll', 'showAll'];
|
|
18
18
|
const sizes = ['xs', 's', 'm', 'l'] as const;
|
19
19
|
const headerSizes = ['h5', 'h4', 'h3', 'h2', 'h1'] as const;
|
20
20
|
|
21
|
+
type Size = typeof sizes[number];
|
22
|
+
|
21
23
|
type CustomStoryTabsProps = {
|
22
24
|
hasDivider: boolean;
|
25
|
+
itemQuantity: number;
|
23
26
|
contentLeft: string;
|
24
27
|
contentRight: string;
|
25
28
|
stretch?: boolean;
|
@@ -28,15 +31,20 @@ type CustomStoryTabsProps = {
|
|
28
31
|
const contentLeftOptions = ['none', 'icon'];
|
29
32
|
const contentRightOptions = ['none', 'text', 'counter', 'icon'];
|
30
33
|
|
31
|
-
const getContentLeft = (contentLeftOption: string) =>
|
32
|
-
|
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';
|
33
42
|
|
34
|
-
const getContentRight = (contentRightOption: string) => {
|
35
43
|
switch (contentRightOption) {
|
36
44
|
case 'icon':
|
37
|
-
return <IconMic size=
|
45
|
+
return <IconMic size={iconSize} color="inherit" />;
|
38
46
|
case 'counter':
|
39
|
-
return <Counter count={1} view="positive" />;
|
47
|
+
return <Counter size={counterSize} count={1} view="positive" />;
|
40
48
|
case 'text':
|
41
49
|
return <div>Text</div>;
|
42
50
|
default:
|
@@ -64,19 +72,27 @@ const meta: Meta<StoryTabsProps> = {
|
|
64
72
|
type: 'select',
|
65
73
|
},
|
66
74
|
},
|
67
|
-
...disableProps(['itemsNumber', 'pilled', 'animated', '
|
75
|
+
...disableProps(['itemsNumber', 'pilled', 'animated', 'view']),
|
68
76
|
},
|
69
77
|
};
|
70
78
|
|
71
79
|
export default meta;
|
72
80
|
|
73
81
|
const StoryDefault = (props: StoryTabsProps) => {
|
74
|
-
const {
|
75
|
-
|
82
|
+
const {
|
83
|
+
disabled,
|
84
|
+
itemQuantity,
|
85
|
+
size,
|
86
|
+
contentLeft: contentLeftOption,
|
87
|
+
contentRight: contentRightOption,
|
88
|
+
hasDivider,
|
89
|
+
stretch,
|
90
|
+
} = props;
|
91
|
+
const items = Array(itemQuantity).fill(0);
|
76
92
|
const [index, setIndex] = useState(0);
|
77
93
|
|
78
94
|
return (
|
79
|
-
<Tabs view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size}>
|
95
|
+
<Tabs view={hasDivider ? 'divider' : 'clear'} stretch={stretch} disabled={disabled} size={size}>
|
80
96
|
{items.map((_, i) => (
|
81
97
|
<TabItem
|
82
98
|
key={`item:${i}`}
|
@@ -85,8 +101,8 @@ const StoryDefault = (props: StoryTabsProps) => {
|
|
85
101
|
onClick={() => !disabled && setIndex(i)}
|
86
102
|
tabIndex={!disabled ? 0 : -1}
|
87
103
|
disabled={disabled}
|
88
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
89
|
-
contentRight={getContentRight(contentRightOption)}
|
104
|
+
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
105
|
+
contentRight={getContentRight(contentRightOption, size as Size)}
|
90
106
|
size={size}
|
91
107
|
>
|
92
108
|
{`Label${i + 1}`}
|
@@ -99,13 +115,14 @@ const StoryDefault = (props: StoryTabsProps) => {
|
|
99
115
|
const StoryScroll = (props: StoryTabsProps) => {
|
100
116
|
const {
|
101
117
|
disabled,
|
118
|
+
itemQuantity,
|
102
119
|
clip,
|
103
120
|
size,
|
104
121
|
contentLeft: contentLeftOption,
|
105
122
|
contentRight: contentRightOption,
|
106
123
|
hasDivider,
|
107
124
|
} = props;
|
108
|
-
const items = Array(
|
125
|
+
const items = Array(itemQuantity).fill(0);
|
109
126
|
const [index, setIndex] = useState(0);
|
110
127
|
|
111
128
|
return (
|
@@ -124,8 +141,8 @@ const StoryScroll = (props: StoryTabsProps) => {
|
|
124
141
|
onClick={() => !disabled && setIndex(i)}
|
125
142
|
tabIndex={!disabled ? 0 : -1}
|
126
143
|
disabled={disabled}
|
127
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
128
|
-
contentRight={getContentRight(contentRightOption)}
|
144
|
+
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
145
|
+
contentRight={getContentRight(contentRightOption, size as Size)}
|
129
146
|
size={size}
|
130
147
|
>
|
131
148
|
{`Label${i + 1}`}
|
@@ -138,21 +155,22 @@ const StoryScroll = (props: StoryTabsProps) => {
|
|
138
155
|
const StoryShowAll = (props: StoryTabsProps) => {
|
139
156
|
const {
|
140
157
|
disabled,
|
158
|
+
itemQuantity,
|
141
159
|
clip,
|
142
160
|
size,
|
143
161
|
contentLeft: contentLeftOption,
|
144
162
|
contentRight: contentRightOption,
|
145
163
|
hasDivider,
|
146
164
|
} = props;
|
147
|
-
const
|
148
|
-
const items = Array(
|
165
|
+
const maxItemQuantity = 3;
|
166
|
+
const items = Array(itemQuantity).fill(0);
|
149
167
|
const [index, setIndex] = useState(0);
|
150
168
|
|
151
|
-
const visibleItems = items.slice(0,
|
152
|
-
const otherItems = items.slice(
|
169
|
+
const visibleItems = items.slice(0, maxItemQuantity);
|
170
|
+
const otherItems = items.slice(maxItemQuantity);
|
153
171
|
|
154
172
|
const dropdownItems = otherItems.map((_, i) => {
|
155
|
-
const itemIndex =
|
173
|
+
const itemIndex = maxItemQuantity + i;
|
156
174
|
|
157
175
|
return {
|
158
176
|
label: `Label${itemIndex + 1}`,
|
@@ -170,8 +188,8 @@ const StoryShowAll = (props: StoryTabsProps) => {
|
|
170
188
|
onClick={() => !disabled && setIndex(i)}
|
171
189
|
tabIndex={!disabled ? 0 : -1}
|
172
190
|
disabled={disabled}
|
173
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
174
|
-
contentRight={getContentRight(contentRightOption)}
|
191
|
+
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
192
|
+
contentRight={getContentRight(contentRightOption, size as Size)}
|
175
193
|
size={size}
|
176
194
|
>
|
177
195
|
{`Label${i + 1}`}
|
@@ -180,7 +198,7 @@ const StoryShowAll = (props: StoryTabsProps) => {
|
|
180
198
|
{dropdownItems.length > 0 && (
|
181
199
|
<div style={{ marginLeft: '1.75rem' }}>
|
182
200
|
<Dropdown
|
183
|
-
size={size as
|
201
|
+
size={size as Size}
|
184
202
|
items={dropdownItems}
|
185
203
|
onItemSelect={(item) => setIndex(item.value as number)}
|
186
204
|
>
|
@@ -205,6 +223,8 @@ export const Default: StoryObj<StoryTabsProps> = {
|
|
205
223
|
size: 'xs',
|
206
224
|
disabled: false,
|
207
225
|
hasDivider: true,
|
226
|
+
itemQuantity: 8,
|
227
|
+
clip: 'scroll',
|
208
228
|
},
|
209
229
|
argTypes: {
|
210
230
|
clip: {
|
@@ -219,6 +239,7 @@ export const Default: StoryObj<StoryTabsProps> = {
|
|
219
239
|
type: 'select',
|
220
240
|
},
|
221
241
|
},
|
242
|
+
stretch: { control: 'boolean', if: { arg: 'clip', eq: 'none' } },
|
222
243
|
},
|
223
244
|
render: (args) => {
|
224
245
|
switch (args.clip) {
|
@@ -232,60 +253,16 @@ export const Default: StoryObj<StoryTabsProps> = {
|
|
232
253
|
},
|
233
254
|
};
|
234
255
|
|
235
|
-
const
|
256
|
+
const StoryHeaderTabs = (props: StoryTabsProps) => {
|
236
257
|
const {
|
237
258
|
disabled,
|
259
|
+
itemQuantity,
|
238
260
|
size,
|
239
261
|
contentLeft: contentLeftOption,
|
240
262
|
contentRight: contentRightOption,
|
241
263
|
hasDivider,
|
242
|
-
stretch,
|
243
264
|
} = props;
|
244
|
-
const items = Array(
|
245
|
-
const [index, setIndex] = useState(0);
|
246
|
-
|
247
|
-
return (
|
248
|
-
<Tabs view={hasDivider ? 'divider' : 'clear'} stretch={stretch} disabled={disabled} size={size}>
|
249
|
-
{items.map((_, i) => (
|
250
|
-
<TabItem
|
251
|
-
key={`item:${i}`}
|
252
|
-
view="divider"
|
253
|
-
selected={i === index}
|
254
|
-
onClick={() => !disabled && setIndex(i)}
|
255
|
-
tabIndex={!disabled ? 0 : -1}
|
256
|
-
disabled={disabled}
|
257
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
258
|
-
contentRight={getContentRight(contentRightOption)}
|
259
|
-
size={size}
|
260
|
-
>
|
261
|
-
{`Label${i + 1}`}
|
262
|
-
</TabItem>
|
263
|
-
))}
|
264
|
-
</Tabs>
|
265
|
-
);
|
266
|
-
};
|
267
|
-
|
268
|
-
export const Stretch: StoryObj<StoryTabsProps> = {
|
269
|
-
args: {
|
270
|
-
size: 'xs',
|
271
|
-
stretch: true,
|
272
|
-
disabled: false,
|
273
|
-
hasDivider: true,
|
274
|
-
},
|
275
|
-
argTypes: {
|
276
|
-
size: {
|
277
|
-
options: sizes,
|
278
|
-
control: {
|
279
|
-
type: 'select',
|
280
|
-
},
|
281
|
-
},
|
282
|
-
},
|
283
|
-
render: (args) => <StoryStretch {...args} />,
|
284
|
-
};
|
285
|
-
|
286
|
-
const StoryHeaderTabs = (props: StoryTabsProps) => {
|
287
|
-
const { disabled, size, contentLeft: contentLeftOption, contentRight: contentRightOption, hasDivider } = props;
|
288
|
-
const items = Array(4).fill(0);
|
265
|
+
const items = Array(itemQuantity).fill(0);
|
289
266
|
const [index, setIndex] = useState(0);
|
290
267
|
|
291
268
|
return (
|
@@ -298,8 +275,8 @@ const StoryHeaderTabs = (props: StoryTabsProps) => {
|
|
298
275
|
onClick={() => !disabled && setIndex(i)}
|
299
276
|
tabIndex={!disabled ? 0 : -1}
|
300
277
|
disabled={disabled}
|
301
|
-
contentLeft={getContentLeft(contentLeftOption)}
|
302
|
-
contentRight={getContentRight(contentRightOption)}
|
278
|
+
contentLeft={getContentLeft(contentLeftOption, size as Size)}
|
279
|
+
contentRight={getContentRight(contentRightOption, size as Size)}
|
303
280
|
size={size}
|
304
281
|
>
|
305
282
|
{`Label${i + 1}`}
|
@@ -314,6 +291,7 @@ export const HeaderTabs: StoryObj<StoryTabsProps> = {
|
|
314
291
|
size: 'h5',
|
315
292
|
disabled: false,
|
316
293
|
hasDivider: true,
|
294
|
+
itemQuantity: 4,
|
317
295
|
},
|
318
296
|
argTypes: {
|
319
297
|
size: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tabs.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tabs/ui/Tabs/Tabs.styles.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,IAAI,
|
1
|
+
{"version":3,"file":"Tabs.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tabs/ui/Tabs/Tabs.styles.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,IAAI,0CAKhB,CAAC;AAEF,eAAO,MAAM,aAAa,qKAIzB,CAAC;AAEF,eAAO,MAAM,oBAAoB,qKA0BhC,CAAC;AAEF,eAAO,MAAM,WAAW;;;EAyBvB,CAAC"}
|