@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.
Files changed (130) hide show
  1. package/cjs/components/Notification/NotificationsPortal.js +11 -1
  2. package/cjs/components/Notification/NotificationsPortal.js.map +1 -1
  3. package/cjs/components/Notification/NotificationsPortal_6417q6.css +1 -0
  4. package/cjs/components/Notification/NotificationsProvider.css +2 -0
  5. package/cjs/components/Tabs/tokens.js +2 -5
  6. package/cjs/components/Tabs/tokens.js.map +1 -1
  7. package/cjs/components/Tabs/ui/TabItem/TabItem.css +1 -1
  8. package/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -8
  9. package/cjs/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  10. package/cjs/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
  11. package/cjs/components/Tabs/ui/TabItem/variations/_view/base.js.map +1 -1
  12. package/cjs/components/Tabs/ui/TabItem/variations/_view/base_q8xs21.css +1 -0
  13. package/cjs/components/Tabs/ui/Tabs/Tabs.css +6 -6
  14. package/cjs/components/Tabs/ui/Tabs/Tabs.js +8 -51
  15. package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  16. package/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +7 -7
  17. package/cjs/components/Tabs/ui/Tabs/Tabs.styles.js.map +1 -1
  18. package/{es/components/Tabs/ui/Tabs/Tabs.styles_z4dnzh.css → cjs/components/Tabs/ui/Tabs/Tabs.styles_1b8qt33.css} +2 -2
  19. package/cjs/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
  20. package/cjs/components/Tabs/ui/Tabs/variations/_stretch/base.js.map +1 -1
  21. package/{es/components/Tabs/ui/Tabs/variations/_stretch/base_1c7lnrm.css → cjs/components/Tabs/ui/Tabs/variations/_stretch/base_176tz0n.css} +1 -1
  22. package/cjs/components/Tabs/ui/Tabs/variations/_view/base.js +1 -1
  23. package/{es/components/Tabs/ui/Tabs/variations/_view/base_aij3sf.css → cjs/components/Tabs/ui/Tabs/variations/_view/base_4xkt26.css} +1 -1
  24. package/cjs/index.css +9 -7
  25. package/emotion/cjs/components/Notification/NotificationsPortal.js +8 -1
  26. package/emotion/cjs/components/Tabs/tokens.js +2 -5
  27. package/emotion/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -8
  28. package/emotion/cjs/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
  29. package/emotion/cjs/components/Tabs/ui/Tabs/Tabs.js +8 -51
  30. package/emotion/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +16 -8
  31. package/emotion/cjs/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
  32. package/emotion/cjs/components/Tabs/ui/Tabs/variations/_view/tokens.json +1 -1
  33. package/emotion/cjs/examples/plasma_b2c/components/Tabs/TabItem.config.js +15 -15
  34. package/emotion/cjs/examples/plasma_b2c/components/Tabs/Tabs.config.js +17 -16
  35. package/emotion/cjs/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +196 -287
  36. package/emotion/cjs/examples/plasma_web/components/Tabs/TabItem.config.js +15 -15
  37. package/emotion/cjs/examples/plasma_web/components/Tabs/Tabs.config.js +17 -16
  38. package/emotion/cjs/examples/plasma_web/components/Tabs/Tabs.stories.tsx +196 -287
  39. package/emotion/es/components/Notification/NotificationsPortal.js +7 -1
  40. package/emotion/es/components/Tabs/tokens.js +2 -5
  41. package/emotion/es/components/Tabs/ui/TabItem/TabItem.js +2 -8
  42. package/emotion/es/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
  43. package/emotion/es/components/Tabs/ui/Tabs/Tabs.js +9 -52
  44. package/emotion/es/components/Tabs/ui/Tabs/Tabs.styles.js +17 -9
  45. package/emotion/es/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
  46. package/emotion/es/components/Tabs/ui/Tabs/variations/_view/tokens.json +1 -1
  47. package/emotion/es/examples/plasma_b2c/components/Tabs/TabItem.config.js +15 -15
  48. package/emotion/es/examples/plasma_b2c/components/Tabs/Tabs.config.js +17 -16
  49. package/emotion/es/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +196 -287
  50. package/emotion/es/examples/plasma_web/components/Tabs/TabItem.config.js +15 -15
  51. package/emotion/es/examples/plasma_web/components/Tabs/Tabs.config.js +17 -16
  52. package/emotion/es/examples/plasma_web/components/Tabs/Tabs.stories.tsx +196 -287
  53. package/es/components/Notification/NotificationsPortal.js +11 -1
  54. package/es/components/Notification/NotificationsPortal.js.map +1 -1
  55. package/es/components/Notification/NotificationsPortal_6417q6.css +1 -0
  56. package/es/components/Notification/NotificationsProvider.css +2 -0
  57. package/es/components/Tabs/tokens.js +2 -5
  58. package/es/components/Tabs/tokens.js.map +1 -1
  59. package/es/components/Tabs/ui/TabItem/TabItem.css +1 -1
  60. package/es/components/Tabs/ui/TabItem/TabItem.js +2 -8
  61. package/es/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  62. package/es/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
  63. package/es/components/Tabs/ui/TabItem/variations/_view/base.js.map +1 -1
  64. package/es/components/Tabs/ui/TabItem/variations/_view/base_q8xs21.css +1 -0
  65. package/es/components/Tabs/ui/Tabs/Tabs.css +6 -6
  66. package/es/components/Tabs/ui/Tabs/Tabs.js +9 -52
  67. package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  68. package/es/components/Tabs/ui/Tabs/Tabs.styles.js +7 -7
  69. package/es/components/Tabs/ui/Tabs/Tabs.styles.js.map +1 -1
  70. package/{cjs/components/Tabs/ui/Tabs/Tabs.styles_z4dnzh.css → es/components/Tabs/ui/Tabs/Tabs.styles_1b8qt33.css} +2 -2
  71. package/es/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
  72. package/es/components/Tabs/ui/Tabs/variations/_stretch/base.js.map +1 -1
  73. package/{cjs/components/Tabs/ui/Tabs/variations/_stretch/base_1c7lnrm.css → es/components/Tabs/ui/Tabs/variations/_stretch/base_176tz0n.css} +1 -1
  74. package/es/components/Tabs/ui/Tabs/variations/_view/base.js +1 -1
  75. package/{cjs/components/Tabs/ui/Tabs/variations/_view/base_aij3sf.css → es/components/Tabs/ui/Tabs/variations/_view/base_4xkt26.css} +1 -1
  76. package/es/index.css +9 -7
  77. package/package.json +2 -2
  78. package/styled-components/cjs/components/Notification/NotificationsPortal.js +7 -1
  79. package/styled-components/cjs/components/Tabs/tokens.js +2 -5
  80. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -8
  81. package/styled-components/cjs/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
  82. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +8 -51
  83. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +2 -2
  84. package/styled-components/cjs/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
  85. package/styled-components/cjs/components/Tabs/ui/Tabs/variations/_view/tokens.json +1 -1
  86. package/styled-components/cjs/examples/plasma_b2c/components/Tabs/TabItem.config.js +8 -8
  87. package/styled-components/cjs/examples/plasma_b2c/components/Tabs/Tabs.config.js +5 -4
  88. package/styled-components/cjs/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +196 -287
  89. package/styled-components/cjs/examples/plasma_web/components/Tabs/TabItem.config.js +8 -8
  90. package/styled-components/cjs/examples/plasma_web/components/Tabs/Tabs.config.js +5 -4
  91. package/styled-components/cjs/examples/plasma_web/components/Tabs/Tabs.stories.tsx +196 -287
  92. package/styled-components/es/components/Notification/NotificationsPortal.js +6 -1
  93. package/styled-components/es/components/Tabs/tokens.js +2 -5
  94. package/styled-components/es/components/Tabs/ui/TabItem/TabItem.js +2 -8
  95. package/styled-components/es/components/Tabs/ui/TabItem/variations/_view/base.js +1 -1
  96. package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +9 -52
  97. package/styled-components/es/components/Tabs/ui/Tabs/Tabs.styles.js +3 -3
  98. package/styled-components/es/components/Tabs/ui/Tabs/variations/_stretch/base.js +1 -1
  99. package/styled-components/es/components/Tabs/ui/Tabs/variations/_view/tokens.json +1 -1
  100. package/styled-components/es/examples/plasma_b2c/components/Tabs/TabItem.config.js +8 -8
  101. package/styled-components/es/examples/plasma_b2c/components/Tabs/Tabs.config.js +5 -4
  102. package/styled-components/es/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +196 -287
  103. package/styled-components/es/examples/plasma_web/components/Tabs/TabItem.config.js +8 -8
  104. package/styled-components/es/examples/plasma_web/components/Tabs/Tabs.config.js +5 -4
  105. package/styled-components/es/examples/plasma_web/components/Tabs/Tabs.stories.tsx +196 -287
  106. package/types/components/Notification/NotificationsPortal.d.ts.map +1 -1
  107. package/types/components/Tabs/tokens.d.ts +0 -3
  108. package/types/components/Tabs/tokens.d.ts.map +1 -1
  109. package/types/components/Tabs/ui/TabItem/TabItem.d.ts.map +1 -1
  110. package/types/components/Tabs/ui/TabItem/variations/_view/base.d.ts.map +1 -1
  111. package/types/components/Tabs/ui/Tabs/Tabs.d.ts +2 -4
  112. package/types/components/Tabs/ui/Tabs/Tabs.d.ts.map +1 -1
  113. package/types/components/Tabs/ui/Tabs/Tabs.styles.d.ts.map +1 -1
  114. package/types/components/Tabs/ui/Tabs/Tabs.types.d.ts +5 -12
  115. package/types/components/Tabs/ui/Tabs/Tabs.types.d.ts.map +1 -1
  116. package/types/components/Tabs/ui/Tabs/variations/_stretch/base.d.ts.map +1 -1
  117. package/types/examples/plasma_b2c/components/Tabs/TabItem.config.d.ts.map +1 -1
  118. package/types/examples/plasma_b2c/components/Tabs/Tabs.config.d.ts +1 -0
  119. package/types/examples/plasma_b2c/components/Tabs/Tabs.config.d.ts.map +1 -1
  120. package/types/examples/plasma_b2c/components/Tabs/Tabs.d.ts +1 -2
  121. package/types/examples/plasma_b2c/components/Tabs/Tabs.d.ts.map +1 -1
  122. package/types/examples/plasma_web/components/Tabs/TabItem.config.d.ts.map +1 -1
  123. package/types/examples/plasma_web/components/Tabs/Tabs.config.d.ts +1 -0
  124. package/types/examples/plasma_web/components/Tabs/Tabs.config.d.ts.map +1 -1
  125. package/types/examples/plasma_web/components/Tabs/Tabs.d.ts +1 -2
  126. package/types/examples/plasma_web/components/Tabs/Tabs.d.ts.map +1 -1
  127. package/types/examples/sds_engineer/components/Tabs/Tabs.d.ts +1 -2
  128. package/types/examples/sds_engineer/components/Tabs/Tabs.d.ts.map +1 -1
  129. package/cjs/components/Tabs/ui/TabItem/variations/_view/base_7pcxtm.css +0 -1
  130. 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 { disableProps } from '@salutejs/plasma-sb-utils';
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 clips = ['none', 'scroll', 'showAll'];
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
- hasDivider: boolean;
25
- itemQuantity: number;
26
- contentLeft: string;
27
- contentRight: string;
28
- stretch?: boolean;
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
- contentLeft: {
64
- options: contentLeftOptions,
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
- itemQuantity,
85
- size,
86
- contentLeft: contentLeftOption,
87
- contentRight: contentRightOption,
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
- contentLeft: contentLeftOption,
121
- contentRight: contentRightOption,
122
- hasDivider,
56
+ showLeftContent,
57
+ showRightContent,
123
58
  } = props;
124
- const items = Array(itemQuantity).fill(0);
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
- <Tabs
129
- clip={clip}
130
- view={hasDivider ? 'divider' : 'clear'}
131
- disabled={disabled}
132
- size={size}
133
- style={{ width: '15rem' }}
134
- >
135
- {items.map((_, i) => (
136
- <TabItem
137
- key={`item:${i}`}
138
- view="divider"
139
- selected={i === index}
140
- onClick={() => !disabled && setIndex(i)}
141
- tabIndex={!disabled ? 0 : -1}
142
- disabled={disabled}
143
- contentLeft={getContentLeft(contentLeftOption, size as Size)}
144
- contentRight={getContentRight(contentRightOption, size as Size)}
145
- size={size}
146
- >
147
- {`Label${i + 1}`}
148
- </TabItem>
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
- return {
175
- label: `Label${itemIndex + 1}`,
176
- value: itemIndex,
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
- return (
181
- <Tabs clip={clip} view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size}>
182
- {visibleItems.map((_, i) => (
183
- <TabItem
184
- key={`item:${i}`}
185
- view="divider"
186
- selected={i === index}
187
- onClick={() => !disabled && setIndex(i)}
188
- tabIndex={!disabled ? 0 : -1}
189
- disabled={disabled}
190
- contentLeft={getContentLeft(contentLeftOption, size as Size)}
191
- contentRight={getContentRight(contentRightOption, size as Size)}
192
- size={size}
193
- >
194
- {`Label${i + 1}`}
195
- </TabItem>
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
- <TabItem
205
- key="item:ShowAll"
206
- view="divider"
207
- tabIndex={!disabled ? 0 : -1}
208
- disabled={disabled}
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
- hasDivider: true,
225
- itemQuantity: 8,
226
- },
227
- argTypes: {
228
- clip: {
229
- options: clips,
230
- control: {
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 StoryStretch = (props: StoryTabsProps) => {
254
- const {
255
- disabled,
256
- size,
257
- contentLeft: contentLeftOption,
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
- export const Stretch: StoryObj<StoryTabsProps> = {
288
- args: {
289
- size: 'xs',
290
- stretch: true,
291
- disabled: false,
292
- hasDivider: true,
293
- },
294
- argTypes: {
295
- size: {
296
- options: sizes,
297
- control: {
298
- type: 'select',
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 StoryHeaderTabs = (props: StoryTabsProps) => {
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
- <Tabs view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size}>
319
- {items.map((_, i) => (
320
- <TabItem
321
- key={`item:${i}`}
322
- view="divider"
323
- selected={i === index}
324
- onClick={() => !disabled && setIndex(i)}
325
- tabIndex={!disabled ? 0 : -1}
326
- disabled={disabled}
327
- contentLeft={getContentLeft(contentLeftOption, size as Size)}
328
- contentRight={getContentRight(contentRightOption, size as Size)}
329
- size={size}
330
- >
331
- {`Label${i + 1}`}
332
- </TabItem>
333
- ))}
334
- </Tabs>
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 HeaderTabs: StoryObj<StoryTabsProps> = {
247
+ export const Multiple: StoryObj<StoryTabsProps> = {
339
248
  args: {
340
- size: 'h5',
249
+ size: 'xs',
250
+ itemsNumber: 6,
251
+ tabItemView: 'divider',
341
252
  disabled: false,
342
- hasDivider: true,
343
- },
344
- argTypes: {
345
- size: {
346
- options: headerSizes,
347
- control: {
348
- type: 'select',
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) => <StoryHeaderTabs {...args} />,
261
+ render: (args) => <StoryMultiple {...args} />,
353
262
  };
@@ -1,9 +1,11 @@
1
+ import _styled from "@emotion/styled/base";
1
2
  var _excluded = ["id", "isHidden"];
2
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
4
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
6
  import React, { useMemo } from 'react';
6
7
  import { useStoreon } from 'storeon/react';
8
+ import { popupBaseRootClass } from '@salutejs/plasma-core';
7
9
  import { PopupProvider, popupConfig } from '../Popup';
8
10
  import { component } from '../../engines';
9
11
  import { cx } from '../../utils';
@@ -13,6 +15,10 @@ import { classes } from './Notification.tokens';
13
15
 
14
16
  // issue #823
15
17
  var Popup = /*#__PURE__*/component(popupConfig);
18
+ var StyledPopup = /*#__PURE__*/_styled(Popup, {
19
+ target: "eefkyeq0",
20
+ label: "plasma-new-hope__StyledPopup"
21
+ })("&>.", popupBaseRootClass, "{overflow:hidden;}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvTm90aWZpY2F0aW9uL05vdGlmaWNhdGlvbnNQb3J0YWwudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWlCaUMiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjLWVtb3Rpb24vY29tcG9uZW50cy9Ob3RpZmljYXRpb24vTm90aWZpY2F0aW9uc1BvcnRhbC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QsIHsgRkMsIEZvcndhcmRSZWZFeG90aWNDb21wb25lbnQsIFJlZkF0dHJpYnV0ZXMsIHVzZU1lbW8gfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyB1c2VTdG9yZW9uIH0gZnJvbSAnc3RvcmVvbi9yZWFjdCc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pbXBvcnQgeyBwb3B1cEJhc2VSb290Q2xhc3MgfSBmcm9tICdAc2FsdXRlanMvcGxhc21hLWNvcmUnO1xuXG5pbXBvcnQgeyBQb3B1cFByb3ZpZGVyLCBwb3B1cENvbmZpZyB9IGZyb20gJy4uL1BvcHVwJztcbmltcG9ydCB7IGNvbXBvbmVudCB9IGZyb20gJy4uLy4uL2VuZ2luZXMnO1xuaW1wb3J0IHsgY3ggfSBmcm9tICcuLi8uLi91dGlscyc7XG5cbmltcG9ydCB7IE5vdGlmaWNhdGlvbnNTdGF0ZSwgTm90aWZpY2F0aW9uc0V2ZW50cywgY2xvc2VOb3RpZmljYXRpb24gfSBmcm9tICcuL05vdGlmaWNhdGlvbnNTdG9yZSc7XG5pbXBvcnQgeyBOb3RpZmljYXRpb25Qb3J0YWxQcm9wcywgTm90aWZpY2F0aW9uUHJvcHMgfSBmcm9tICcuL05vdGlmaWNhdGlvbi50eXBlcyc7XG5pbXBvcnQgeyBTdHlsZWRJdGVtV3JhcHBlciwgU3R5bGVkUm9vdCB9IGZyb20gJy4vTm90aWZpY2F0aW9uLnN0eWxlcyc7XG5pbXBvcnQgeyBjbGFzc2VzIH0gZnJvbSAnLi9Ob3RpZmljYXRpb24udG9rZW5zJztcblxuLy8gaXNzdWUgIzgyM1xuY29uc3QgUG9wdXAgPSBjb21wb25lbnQocG9wdXBDb25maWcpO1xuXG5jb25zdCBTdHlsZWRQb3B1cCA9IHN0eWxlZChQb3B1cClgXG4gICAgJiA+IC4ke3BvcHVwQmFzZVJvb3RDbGFzc30ge1xuICAgICAgICBvdmVyZmxvdzogaGlkZGVuO1xuICAgIH1cbmA7XG5cbi8qKlxuICog0J7QsdC10YDRgtC60LAg0LTQu9GPINCy0LjQt9GD0LDQu9GM0L3QvtCz0L4g0L/RgNC10LTRgdGC0LDQstC70LXQvdC40Y8g0YPQstC10LTQvtC80LvQtdC90LjQuS5cbiAqL1xuZXhwb3J0IGNvbnN0IE5vdGlmaWNhdGlvbnNQb3J0YWw6IEZDPE5vdGlmaWNhdGlvblBvcnRhbFByb3BzPiA9ICh7IGNvbmZpZywgZnJhbWUgfSkgPT4ge1xuICAgIGNvbnN0IHsgbm90aWZpY2F0aW9ucyB9ID0gdXNlU3RvcmVvbjxOb3RpZmljYXRpb25zU3RhdGUsIE5vdGlmaWNhdGlvbnNFdmVudHM+KCdub3RpZmljYXRpb25zJyk7XG5cbiAgICBjb25zdCBOb3RpZmljYXRpb24gPSB1c2VNZW1vKFxuICAgICAgICAoKSA9PiBjb21wb25lbnQoY29uZmlnKSBhcyBGb3J3YXJkUmVmRXhvdGljQ29tcG9uZW50PE5vdGlmaWNhdGlvblByb3BzICYgUmVmQXR0cmlidXRlczxIVE1MRGl2RWxlbWVudD4+LFxuICAgICAgICBbXSxcbiAgICApO1xuXG4gICAgcmV0dXJuIChcbiAgICAgICAgPFBvcHVwUHJvdmlkZXI+XG4gICAgICAgICAgICB7bm90aWZpY2F0aW9ucy5sZW5ndGggPiAwICYmIChcbiAgICAgICAgICAgICAgICA8U3R5bGVkUG9wdXAgaXNPcGVuIGZyYW1lPXtmcmFtZX0gcGxhY2VtZW50PVwiYm90dG9tLXJpZ2h0XCIgekluZGV4PVwiOTEwMFwiPlxuICAgICAgICAgICAgICAgICAgICA8U3R5bGVkUm9vdD5cbiAgICAgICAgICAgICAgICAgICAgICAgIHtub3RpZmljYXRpb25zLm1hcCgoeyBpZCwgaXNIaWRkZW4sIC4uLnJlc3QgfSkgPT4gKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxTdHlsZWRJdGVtV3JhcHBlclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk9e2lkfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU9e2N4KFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNIaWRkZW4gPyBjbGFzc2VzLm5vdGlmaWNhdGlvbkl0ZW1IaWRkZW4gOiBjbGFzc2VzLm5vdGlmaWNhdGlvbkl0ZW1PcGVuZWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICl9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzSGlkZGVuPXtpc0hpZGRlbiB8fCBmYWxzZX1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxOb3RpZmljYXRpb25cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleT17aWR9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZD17aWR9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsb3NlQnV0dG9uQ2xpY2s9eygpID0+IGNsb3NlTm90aWZpY2F0aW9uKGlkKX1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsuLi5yZXN0fVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvU3R5bGVkSXRlbVdyYXBwZXI+XG4gICAgICAgICAgICAgICAgICAgICAgICApKX1cbiAgICAgICAgICAgICAgICAgICAgPC9TdHlsZWRSb290PlxuICAgICAgICAgICAgICAgIDwvU3R5bGVkUG9wdXA+XG4gICAgICAgICAgICApfVxuICAgICAgICA8L1BvcHVwUHJvdmlkZXI+XG4gICAgKTtcbn07XG4iXX0= */"));
16
22
 
17
23
  /**
18
24
  * Обертка для визуального представления уведомлений.
@@ -25,7 +31,7 @@ export var NotificationsPortal = function NotificationsPortal(_ref) {
25
31
  var Notification = useMemo(function () {
26
32
  return component(config);
27
33
  }, []);
28
- return /*#__PURE__*/React.createElement(PopupProvider, null, notifications.length > 0 && /*#__PURE__*/React.createElement(Popup, {
34
+ return /*#__PURE__*/React.createElement(PopupProvider, null, notifications.length > 0 && /*#__PURE__*/React.createElement(StyledPopup, {
29
35
  isOpen: true,
30
36
  frame: frame,
31
37
  placement: "bottom-right",
@@ -9,9 +9,7 @@ export 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
  export var tokens = {
17
15
  disabledOpacity: '--plasma-tabs-disabled-opacity',
@@ -28,7 +26,7 @@ export 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-background-color',
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 @@ export 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',
@@ -1,4 +1,4 @@
1
- var _excluded = ["size", "view", "isActive", "selected", "disabled", "pilled", "children", "contentLeft", "contentRight", "animated", "onIndexChange", "itemIndex", "tabIndex", "className", "onClick"];
1
+ var _excluded = ["size", "view", "isActive", "selected", "disabled", "pilled", "children", "contentLeft", "contentRight", "animated", "onIndexChange", "itemIndex", "tabIndex", "className"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -31,7 +31,6 @@ export var tabItemRoot = function tabItemRoot(Root) {
31
31
  itemIndex = props.itemIndex,
32
32
  tabIndex = props.tabIndex,
33
33
  className = props.className,
34
- onClick = props.onClick,
35
34
  rest = _objectWithoutProperties(props, _excluded);
36
35
  var innerRef = useRef(null);
37
36
  var ref = useForkRef(outerRef, innerRef);
@@ -73,10 +72,6 @@ export var tabItemRoot = function tabItemRoot(Root) {
73
72
  onIndexChange === null || onIndexChange === void 0 || onIndexChange(focusIndex);
74
73
  refs.setCurrent(focusIndex);
75
74
  }, [refs, innerRef, onIndexChange, disabled]);
76
- var handleClick = useCallback(function (event) {
77
- event.currentTarget.scrollIntoView();
78
- onClick && onClick(event);
79
- }, [onClick]);
80
75
  return /*#__PURE__*/React.createElement(Root, _extends({
81
76
  ref: ref,
82
77
  disabled: disabled,
@@ -86,8 +81,7 @@ export var tabItemRoot = function tabItemRoot(Root) {
86
81
  size: size,
87
82
  onFocus: onItemFocus,
88
83
  tabIndex: hasKeyNavigation ? navigationTabIndex : tabIndex,
89
- className: cx(pilledClass, selectedClass, animatedClass, className),
90
- onClick: handleClick
84
+ className: cx(pilledClass, selectedClass, animatedClass, className)
91
85
  }, rest), /*#__PURE__*/React.createElement(React.Fragment, null, contentLeft && /*#__PURE__*/React.createElement(LeftContent, {
92
86
  className: classes.tabLeftContent
93
87
  }, contentLeft), /*#__PURE__*/React.createElement(StyledContent, {