@megafon/ui-core 4.0.0-beta.0 → 4.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +210 -7
  2. package/dist/es/components/Accordion/Accordion.css +59 -22
  3. package/dist/es/components/Accordion/Accordion.js +12 -17
  4. package/dist/es/components/Banner/Banner.d.ts +2 -0
  5. package/dist/es/components/Banner/Banner.js +46 -20
  6. package/dist/es/components/Button/Button.css +77 -0
  7. package/dist/es/components/Button/Button.d.ts +3 -0
  8. package/dist/es/components/Button/Button.js +12 -4
  9. package/dist/es/components/Calendar/Calendar.js +18 -2
  10. package/dist/es/components/Calendar/components/Month/Month.js +4 -4
  11. package/dist/es/components/Header/Header.css +3 -0
  12. package/dist/es/components/Header/Header.d.ts +2 -0
  13. package/dist/es/components/Header/Header.js +7 -1
  14. package/dist/es/components/Logo/Logo.js +22 -6
  15. package/dist/es/components/Notification/Notification.css +137 -35
  16. package/dist/es/components/Notification/Notification.d.ts +26 -0
  17. package/dist/es/components/Notification/Notification.js +190 -19
  18. package/dist/es/components/Search/Search.css +130 -10
  19. package/dist/es/components/Search/Search.d.ts +2 -0
  20. package/dist/es/components/Search/Search.js +20 -7
  21. package/dist/es/components/Select/Select.css +175 -34
  22. package/dist/es/components/Select/Select.js +25 -18
  23. package/dist/es/components/Switcher/Switcher.css +3 -0
  24. package/dist/es/components/Switcher/Switcher.d.ts +1 -0
  25. package/dist/es/components/Switcher/Switcher.js +4 -3
  26. package/dist/es/components/Tabs/Tab.d.ts +1 -0
  27. package/dist/es/components/Tabs/Tab.js +2 -1
  28. package/dist/es/components/Tabs/Tabs.css +140 -143
  29. package/dist/es/components/Tabs/Tabs.d.ts +9 -8
  30. package/dist/es/components/Tabs/Tabs.js +18 -22
  31. package/dist/es/components/TextField/TextField.css +221 -92
  32. package/dist/es/components/TextField/TextField.js +161 -70
  33. package/dist/es/components/Tooltip/Tooltip.d.ts +4 -0
  34. package/dist/es/components/Tooltip/Tooltip.js +32 -1
  35. package/dist/es/constants/throttleTime.d.ts +1 -0
  36. package/dist/es/constants/throttleTime.js +2 -1
  37. package/dist/es/index.d.ts +0 -1
  38. package/dist/es/index.js +0 -1
  39. package/dist/lib/components/Accordion/Accordion.css +59 -22
  40. package/dist/lib/components/Accordion/Accordion.js +12 -17
  41. package/dist/lib/components/Banner/Banner.d.ts +2 -0
  42. package/dist/lib/components/Banner/Banner.js +46 -20
  43. package/dist/lib/components/Button/Button.css +77 -0
  44. package/dist/lib/components/Button/Button.d.ts +3 -0
  45. package/dist/lib/components/Button/Button.js +12 -4
  46. package/dist/lib/components/Calendar/Calendar.js +17 -1
  47. package/dist/lib/components/Calendar/components/Month/Month.js +4 -4
  48. package/dist/lib/components/Header/Header.css +3 -0
  49. package/dist/lib/components/Header/Header.d.ts +2 -0
  50. package/dist/lib/components/Header/Header.js +7 -1
  51. package/dist/lib/components/Logo/Logo.js +22 -6
  52. package/dist/lib/components/Notification/Notification.css +137 -35
  53. package/dist/lib/components/Notification/Notification.d.ts +26 -0
  54. package/dist/lib/components/Notification/Notification.js +192 -19
  55. package/dist/lib/components/Search/Search.css +130 -10
  56. package/dist/lib/components/Search/Search.d.ts +2 -0
  57. package/dist/lib/components/Search/Search.js +20 -8
  58. package/dist/lib/components/Select/Select.css +175 -34
  59. package/dist/lib/components/Select/Select.js +25 -19
  60. package/dist/lib/components/Switcher/Switcher.css +3 -0
  61. package/dist/lib/components/Switcher/Switcher.d.ts +1 -0
  62. package/dist/lib/components/Switcher/Switcher.js +4 -3
  63. package/dist/lib/components/Tabs/Tab.d.ts +1 -0
  64. package/dist/lib/components/Tabs/Tab.js +2 -1
  65. package/dist/lib/components/Tabs/Tabs.css +140 -143
  66. package/dist/lib/components/Tabs/Tabs.d.ts +9 -8
  67. package/dist/lib/components/Tabs/Tabs.js +20 -24
  68. package/dist/lib/components/TextField/TextField.css +221 -92
  69. package/dist/lib/components/TextField/TextField.js +164 -70
  70. package/dist/lib/components/Tooltip/Tooltip.d.ts +4 -0
  71. package/dist/lib/components/Tooltip/Tooltip.js +36 -1
  72. package/dist/lib/constants/throttleTime.d.ts +1 -0
  73. package/dist/lib/constants/throttleTime.js +2 -1
  74. package/dist/lib/index.d.ts +0 -1
  75. package/dist/lib/index.js +0 -8
  76. package/package.json +3 -3
  77. package/styles/base.less +3 -0
  78. package/dist/es/components/InputLabel/InputLabel.css +0 -5
  79. package/dist/es/components/InputLabel/InputLabel.d.ts +0 -10
  80. package/dist/es/components/InputLabel/InputLabel.js +0 -24
  81. package/dist/lib/components/InputLabel/InputLabel.css +0 -5
  82. package/dist/lib/components/InputLabel/InputLabel.d.ts +0 -10
  83. package/dist/lib/components/InputLabel/InputLabel.js +0 -43
package/CHANGELOG.md CHANGED
@@ -3,17 +3,115 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [4.0.0-beta.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3-beta.1...@megafon/ui-core@4.0.0-beta.0) (2022-05-24)
6
+ # [4.0.0-beta.11](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.10...@megafon/ui-core@4.0.0-beta.11) (2022-07-27)
7
7
 
8
8
 
9
9
  ### Features
10
10
 
11
- * **caption:** add new Caption component; update .smallFont() less mixin ([603bed3](https://github.com/MegafonWebLab/megafon-ui/commit/603bed3ce782676b22381e3d4df5dae141fb015c))
12
- * **paragraph:** remove prop size; add new prop; add 'pale' option to colors ([ef15841](https://github.com/MegafonWebLab/megafon-ui/commit/ef15841474473739d3ac88da7a8737e183ff288a))
11
+ * **search:** changed dropdown list item height ([25ceb63](https://github.com/MegafonWebLab/megafon-ui/commit/25ceb633cdc9922e2a93af919c742b1db82f2f57))
12
+ * **select:** fixed label position with empty string value and minor style changes ([f436d5c](https://github.com/MegafonWebLab/megafon-ui/commit/f436d5c65f0aa874d12cd8d1540698644d57a3db))
13
+
14
+
15
+
16
+
17
+
18
+ # [4.0.0-beta.10](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.9...@megafon/ui-core@4.0.0-beta.10) (2022-07-15)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **accordion:** update mobile styles ([910b1c8](https://github.com/MegafonWebLab/megafon-ui/commit/910b1c8f987f1043e362b089a3ff4cfe9638070d))
24
+
25
+
26
+
27
+
28
+
29
+ # [4.0.0-beta.9](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.8...@megafon/ui-core@4.0.0-beta.9) (2022-07-15)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * **select:** update styles ([b863c8c](https://github.com/MegafonWebLab/megafon-ui/commit/b863c8c94af251d6b3c9ee39124486d7d5db9a58))
35
+
36
+
37
+
38
+
39
+
40
+ # [4.0.0-beta.8](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.7...@megafon/ui-core@4.0.0-beta.8) (2022-07-14)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * **accordion:** change focus and dark theme styles ([d3e07ea](https://github.com/MegafonWebLab/megafon-ui/commit/d3e07ea6fee0c131e25db1bb558d8b205d201e0c))
46
+ * **notification:** change title typography ([f91a60e](https://github.com/MegafonWebLab/megafon-ui/commit/f91a60ee1562626494358ef529321f072ba70890))
47
+ * **tabs:** change dark theme and indents styles ([272dfcb](https://github.com/MegafonWebLab/megafon-ui/commit/272dfcbeef750f2f7ae097b46f7d98405cf53a88))
48
+
49
+
50
+ ### Features
51
+
52
+ * **header:** add new prop space ([e5bef7c](https://github.com/MegafonWebLab/megafon-ui/commit/e5bef7c8e13c57e477a4c25f07a4a4a6dbb8b6bd))
53
+
54
+
55
+
56
+
57
+
58
+ # [4.0.0-beta.7](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.6...@megafon/ui-core@4.0.0-beta.7) (2022-07-13)
59
+
60
+
61
+ ### Bug Fixes
62
+
63
+ * **select:** fix styles ([3e79c68](https://github.com/MegafonWebLab/megafon-ui/commit/3e79c68fecde72e515b7ef52d38d9188e51680f6))
64
+
65
+
66
+
67
+
68
+
69
+ # [4.0.0-beta.6](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.5...@megafon/ui-core@4.0.0-beta.6) (2022-07-05)
70
+
71
+
72
+ ### Features
73
+
74
+ * **inputlabel:** component removed ([1f236ac](https://github.com/MegafonWebLab/megafon-ui/commit/1f236ace90acfd7ea1917422677fa24c1c5abdf4))
75
+ * **search:** component redesign ([d6f11eb](https://github.com/MegafonWebLab/megafon-ui/commit/d6f11eb7ee810b835879c7a31e5e01c426060ea1))
76
+ * **select:** component redesign ([aeeda00](https://github.com/MegafonWebLab/megafon-ui/commit/aeeda00dfc1db70421a495a686954e19eecf815d))
77
+
78
+
79
+ ### BREAKING CHANGES
80
+
81
+ * **inputlabel:** inputLabel component removed due to non-use
82
+
83
+
84
+
85
+
86
+
87
+ # [4.0.0-beta.5](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.12.0...@megafon/ui-core@4.0.0-beta.5) (2022-06-29)
88
+
89
+
90
+ ### Bug Fixes
91
+
92
+ * **textfield:** fix textarea design bugs ([287d426](https://github.com/MegafonWebLab/megafon-ui/commit/287d42644b24ca0e1a3824d5907d8af78293d0e3))
93
+ * **textfield:** update textarea scroll and resize ([9dbce52](https://github.com/MegafonWebLab/megafon-ui/commit/9dbce52d6bc3a71076ffdf2365715204231da774))
94
+
95
+
96
+ ### Features
97
+
98
+ * **accordion:** update by new design ([92dab3a](https://github.com/MegafonWebLab/megafon-ui/commit/92dab3a367544d8507526e7a57a0a9a4015e3acf))
99
+ * **caption:** add new Caption component; update .smallFont() less mixin ([b02a3f7](https://github.com/MegafonWebLab/megafon-ui/commit/b02a3f73ed8d5390d8427ab0a6bc62210710ba40))
100
+ * **paragraph:** remove prop size; add new prop; add 'pale' option to colors ([ffb6bc7](https://github.com/MegafonWebLab/megafon-ui/commit/ffb6bc709a4ef91536e359d5f9edc5501caf0c2c))
101
+ * **tabs:** update by new design ([20ae2cc](https://github.com/MegafonWebLab/megafon-ui/commit/20ae2cc695e1245b9cd06fe37a9e4e3bb0c7eaae))
102
+ * **textfield:** update by new design ([24ec769](https://github.com/MegafonWebLab/megafon-ui/commit/24ec769aeddac9a198941727aaca02ad0fb816f1))
13
103
 
14
104
 
15
105
  ### BREAKING CHANGES
16
106
 
107
+ * **textfield:** add defaultTransitionTiming in less global variables
108
+ * **tabs:** new prop autoWidth added
109
+ size prop small vallue removed
110
+ new sizes
111
+ * **textfield:** add placeholders text by default
112
+ label element positon changed
113
+ if label prop not setted, label element has text from placeholder (default or in props)
114
+ * **accordion:** change next-sibling accordion styles
17
115
  * **caption:** .smallFont() less mixin line-height rule now set to 18px instead of 16px
18
116
  either accept new rules or manually add line-height: 16px in your components
19
117
  * **paragraph:** prop 'size' is no longer exists.
@@ -23,17 +121,122 @@ use component Caption instead of Paragraph size="small"
23
121
 
24
122
 
25
123
 
26
- ## [3.5.3-beta.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3-beta.0...@megafon/ui-core@3.5.3-beta.1) (2022-05-06)
124
+ # [3.12.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.11.0...@megafon/ui-core@3.12.0) (2022-06-28)
27
125
 
28
- **Note:** Version bump only for package @megafon/ui-core
29
126
 
127
+ ### Features
30
128
 
129
+ * **tab:** add data-attribute for inner element ([43e58e1](https://github.com/MegafonWebLab/megafon-ui/commit/43e58e12b8da661020f4b48f55245492c21ad376))
31
130
 
32
131
 
33
132
 
34
- ## [3.5.3-beta.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.2...@megafon/ui-core@3.5.3-beta.0) (2022-04-13)
35
133
 
36
- **Note:** Version bump only for package @megafon/ui-core
134
+
135
+ # [3.11.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.10.1...@megafon/ui-core@3.11.0) (2022-06-21)
136
+
137
+
138
+ ### Bug Fixes
139
+
140
+ * **button:** fix font styles for extra small size ([f475b05](https://github.com/MegafonWebLab/megafon-ui/commit/f475b05ab9d62aa56645fb90ccdef88996e72a70))
141
+
142
+
143
+ ### Features
144
+
145
+ * **button:** add prop ellipsis ([1978277](https://github.com/MegafonWebLab/megafon-ui/commit/1978277a918cb680e32259042c1a7e3c58056b1b))
146
+ * **notification:** add ability to display button and collapse ([a5fe2f0](https://github.com/MegafonWebLab/megafon-ui/commit/a5fe2f0730b71469c2fb06a148b0e4574adb2d7b))
147
+
148
+
149
+
150
+
151
+
152
+ ## [3.10.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.10.0...@megafon/ui-core@3.10.1) (2022-06-07)
153
+
154
+
155
+ ### Bug Fixes
156
+
157
+ * **banner:** fix bug with hover on autoplay ([93271d8](https://github.com/MegafonWebLab/megafon-ui/commit/93271d8c8f9dd900c031d41f89207f61c41db063))
158
+
159
+
160
+
161
+
162
+
163
+ # [3.10.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.9.0...@megafon/ui-core@3.10.0) (2022-05-30)
164
+
165
+
166
+ ### Features
167
+
168
+ * **banner:** add new prop 'pauseOnHover' ([ac654c3](https://github.com/MegafonWebLab/megafon-ui/commit/ac654c3c23821a5d29ffd5cd91ff7337b3d087c1))
169
+
170
+
171
+
172
+
173
+
174
+ # [3.9.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.8.0...@megafon/ui-core@3.9.0) (2022-05-27)
175
+
176
+
177
+ ### Bug Fixes
178
+
179
+ * **select:** fix selected item color when value is zero ([9847095](https://github.com/MegafonWebLab/megafon-ui/commit/98470955ef813504d4bfa4cd4d3aba77b5458446))
180
+
181
+
182
+ ### Features
183
+
184
+ * **switcher:** add data-attribute for inner element ([793a022](https://github.com/MegafonWebLab/megafon-ui/commit/793a0224ab957b938e67dd1b4d16c2389a9fb6f8))
185
+ * **tooltip:** add portal selector props ([6188832](https://github.com/MegafonWebLab/megafon-ui/commit/6188832e9ba212e7a8182333aba06d77c3e979d6))
186
+
187
+
188
+
189
+
190
+
191
+ # [3.8.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.7.0...@megafon/ui-core@3.8.0) (2022-05-17)
192
+
193
+
194
+ ### Features
195
+
196
+ * **notification:** add props classes to notification component ([608a424](https://github.com/MegafonWebLab/megafon-ui/commit/608a4246eb99af354fb7cf8ab98c2ed513d87b66))
197
+
198
+
199
+
200
+
201
+
202
+ # [3.7.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.6.0...@megafon/ui-core@3.7.0) (2022-05-05)
203
+
204
+
205
+ ### Bug Fixes
206
+
207
+ * **logo:** fix horizontal logo svg ([76655eb](https://github.com/MegafonWebLab/megafon-ui/commit/76655ebb82650cc2617750af0b2b2726d3ebcbf3))
208
+
209
+
210
+ ### Features
211
+
212
+ * **button:** added extra small size ([a26da46](https://github.com/MegafonWebLab/megafon-ui/commit/a26da4601de7e7c81c40eabf9a87ccdbf18cb790))
213
+
214
+
215
+
216
+
217
+
218
+ # [3.6.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3...@megafon/ui-core@3.6.0) (2022-04-25)
219
+
220
+
221
+ ### Bug Fixes
222
+
223
+ * **calendar:** fix go to start day after user choice ([8bbce10](https://github.com/MegafonWebLab/megafon-ui/commit/8bbce102d204f7ea7706158f3e6540c86ed3aada))
224
+
225
+
226
+ ### Features
227
+
228
+ * **tooltip:** added prop isPortal for tooltip ([e6f6d17](https://github.com/MegafonWebLab/megafon-ui/commit/e6f6d1749cd99f065c50bac4eb6a9b3592653f8d))
229
+
230
+
231
+
232
+
233
+
234
+ ## [3.5.3](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.2...@megafon/ui-core@3.5.3) (2022-04-18)
235
+
236
+
237
+ ### Bug Fixes
238
+
239
+ * **switcher:** fix safari bugs ([65274bc](https://github.com/MegafonWebLab/megafon-ui/commit/65274bc3c5e7385109afff94a8ff3f712c9af097))
37
240
 
38
241
 
39
242
 
@@ -1,51 +1,88 @@
1
1
  .mfui-accordion {
2
- border-top: 1px solid var(--spbSky2);
3
- border-bottom: 1px solid var(--spbSky2);
2
+ border-radius: 12px;
3
+ background: var(--spbSky0);
4
4
  }
5
5
  .mfui-accordion + .mfui-accordion {
6
- border-top: none;
7
- }
8
- .mfui-accordion:not(.mfui-accordion_open) .mfui-accordion__title-wrap:hover {
9
- background: var(--spbSky0);
6
+ margin-top: 8px;
10
7
  }
11
- .mfui-accordion.mfui-accordion_open .mfui-accordion__title-wrap {
12
- background: var(--spbSky1);
8
+ @media screen and (min-width: 768px) {
9
+ .mfui-accordion + .mfui-accordion {
10
+ margin-top: 12px;
11
+ }
13
12
  }
14
13
  .mfui-accordion__title-wrap {
15
14
  position: relative;
16
- padding: 24px 52px 24px 16px;
15
+ padding: 20px 44px 20px 16px;
16
+ border-radius: 12px;
17
17
  cursor: pointer;
18
+ -webkit-transition: background-color 0.3s;
19
+ transition: background-color 0.3s;
18
20
  }
19
21
  @media screen and (min-width: 768px) {
20
22
  .mfui-accordion__title-wrap {
21
- padding: 24px 68px 24px 24px;
23
+ padding: 20px 56px 20px 24px;
22
24
  }
23
25
  }
24
- @media screen and (min-width: 1280px) {
25
- .mfui-accordion__title-wrap {
26
- padding: 24px 72px 24px 24px;
26
+ .mfui-accordion__title-wrap:hover {
27
+ background-color: var(--spbSky1);
28
+ }
29
+ @media screen and (max-width: 1023px) {
30
+ .mfui-accordion__title-wrap:focus {
31
+ background-color: inherit;
27
32
  }
28
33
  }
29
34
  .mfui-accordion__icon-box {
30
35
  position: absolute;
31
36
  top: 50%;
32
37
  right: 20px;
33
- width: 32px;
34
- height: 32px;
35
- outline: none;
38
+ display: -webkit-box;
39
+ display: -ms-flexbox;
40
+ display: flex;
41
+ -webkit-box-align: center;
42
+ -ms-flex-align: center;
43
+ align-items: center;
44
+ -webkit-box-pack: center;
45
+ -ms-flex-pack: center;
46
+ justify-content: center;
47
+ width: 24px;
48
+ height: 24px;
49
+ border-radius: 50%;
50
+ background-color: var(--stcWhite);
51
+ -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
52
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
36
53
  -webkit-transform: translateY(-50%);
37
54
  transform: translateY(-50%);
38
- opacity: 1;
39
- fill: var(--content);
55
+ }
56
+ @media screen and (min-width: 768px) {
57
+ .mfui-accordion__icon-box {
58
+ right: 24px;
59
+ width: 32px;
60
+ height: 32px;
61
+ }
62
+ }
63
+ .mfui-accordion__icon {
64
+ width: 20px;
65
+ height: 20px;
66
+ -webkit-transition: -webkit-transform 0.6s;
67
+ transition: -webkit-transform 0.6s;
68
+ transition: transform 0.6s;
69
+ transition: transform 0.6s, -webkit-transform 0.6s;
70
+ }
71
+ @media screen and (min-width: 768px) {
72
+ .mfui-accordion__icon {
73
+ width: 32px;
74
+ height: 32px;
75
+ }
40
76
  }
41
77
  .mfui-accordion__content-inner {
42
- padding: 24px 16px;
78
+ padding: 4px 20px 20px 16px;
43
79
  }
44
80
  @media screen and (min-width: 768px) {
45
81
  .mfui-accordion__content-inner {
46
- padding: 24px;
82
+ padding: 4px 24px 20px;
47
83
  }
48
84
  }
49
- .mfui-accordion__icon {
50
- fill: var(--content);
85
+ .mfui-accordion_opened .mfui-accordion__icon {
86
+ -webkit-transform: rotate(180deg);
87
+ transform: rotate(180deg);
51
88
  }
@@ -11,15 +11,9 @@ var ArrowDown = function ArrowDown(props) {
11
11
  return /*#__PURE__*/React.createElement("svg", _extends({
12
12
  viewBox: "0 0 32 32"
13
13
  }, props), /*#__PURE__*/React.createElement("path", {
14
- d: "M11.2 12l4.8 4.8 4.8-4.8 1.7 1.6L16 20l-6.5-6.4z"
15
- }));
16
- };
17
-
18
- var ArrowUp = function ArrowUp(props) {
19
- return /*#__PURE__*/React.createElement("svg", _extends({
20
- viewBox: "0 0 32 32"
21
- }, props), /*#__PURE__*/React.createElement("path", {
22
- d: "M20.8 20L16 15.2 11.2 20l-1.7-1.6L16 12l6.5 6.4z"
14
+ d: "M11 14h10l-5 6z",
15
+ fillRule: "evenodd",
16
+ clipRule: "evenodd"
23
17
  }));
24
18
  };
25
19
 
@@ -58,24 +52,25 @@ var Accordion = function Accordion(_ref) {
58
52
  };
59
53
 
60
54
  var openedClassName = isOpenedState ? openedClass : undefined;
55
+ var arrowDataAttrs = isOpenedState ? dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowUp : dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowDown;
61
56
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
62
57
  ref: rootRef,
63
58
  className: cn({
64
- open: isOpenedState
59
+ opened: isOpenedState
65
60
  }, [className, rootPropsClasses, openedClassName])
66
61
  }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.titleWrap), {
67
62
  className: cn('title-wrap', [titleWrapPropsClasses]),
68
63
  onClick: handleClickTitle,
69
- onKeyDown: handleClickTitle
64
+ onKeyDown: handleClickTitle,
65
+ tabIndex: 0,
66
+ role: "button"
70
67
  }), /*#__PURE__*/React.createElement(Header, _extends({
71
68
  as: "h5"
72
69
  }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.header)), title), /*#__PURE__*/React.createElement("div", {
73
- tabIndex: 0,
74
- role: "button",
75
- className: cn('icon-box', {
76
- open: isOpenedState
77
- })
78
- }, isOpenedState ? /*#__PURE__*/React.createElement(ArrowUp, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowUp)) : /*#__PURE__*/React.createElement(ArrowDown, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowDown)))), /*#__PURE__*/React.createElement(Collapse, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.collapse), {
70
+ className: cn('icon-box')
71
+ }, /*#__PURE__*/React.createElement(ArrowDown, _extends({
72
+ className: cn('icon')
73
+ }, filterDataAttrs(arrowDataAttrs))))), /*#__PURE__*/React.createElement(Collapse, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.collapse), {
79
74
  className: cn('content', collapsePropsClasses),
80
75
  classNameContainer: cn('content-inner'),
81
76
  isOpened: isOpenedState
@@ -32,6 +32,8 @@ export interface IBannerProps {
32
32
  autoPlay?: boolean;
33
33
  /** Задержка автоматической прокрутки */
34
34
  autoPlayDelay?: number;
35
+ /** Пауза автоматической прокрутки при наведении курсора на компонент */
36
+ pauseOnHover?: boolean;
35
37
  /** Цветовая тема навигации */
36
38
  navTheme?: NavThemeType;
37
39
  /** Обработчик клика по стрелке "вперед" (должен быть обернут в useCallback) */
@@ -49,7 +49,9 @@ var Banner = function Banner(_ref) {
49
49
  onPrevClick = _ref.onPrevClick,
50
50
  onDotClick = _ref.onDotClick,
51
51
  onChange = _ref.onChange,
52
- dataAttrs = _ref.dataAttrs;
52
+ dataAttrs = _ref.dataAttrs,
53
+ _ref$pauseOnHover = _ref.pauseOnHover,
54
+ pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover;
53
55
 
54
56
  var _React$useState = React.useState(),
55
57
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -69,29 +71,42 @@ var Banner = function Banner(_ref) {
69
71
  var _React$useState7 = React.useState(autoPlay),
70
72
  _React$useState8 = _slicedToArray(_React$useState7, 2),
71
73
  isAutoPlaying = _React$useState8[0],
72
- setAutoPlayning = _React$useState8[1];
74
+ setAutoPlaying = _React$useState8[1];
73
75
 
74
76
  var _React$useState9 = React.useState(0),
75
77
  _React$useState10 = _slicedToArray(_React$useState9, 2),
76
78
  activeIndex = _React$useState10[0],
77
79
  setActiveIndex = _React$useState10[1];
78
80
 
81
+ var _React$useState11 = React.useState(autoPlayDelay),
82
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
83
+ delay = _React$useState12[0],
84
+ setDelay = _React$useState12[1];
85
+
86
+ var _React$useState13 = React.useState(false),
87
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
88
+ isIncreasedDelay = _React$useState14[0],
89
+ setIsIncreasedDelay = _React$useState14[1];
90
+
79
91
  var showDotTimer = loop ? isAutoPlaying : isAutoPlaying && !isEnd;
80
- var dotTimerDelay = autoPlayDelay / 1000;
92
+ var dotTimerDelay = delay / 1000;
81
93
  var navArrowTheme = navTheme === NavTheme.DARK ? ArrowTheme.DARK : ArrowTheme.PURPLE;
94
+ var rootRef = React.useRef(null);
82
95
  var increaseAutoplayDelay = React.useCallback(function (_ref2) {
83
96
  var params = _ref2.params,
84
97
  autoplay = _ref2.autoplay;
85
98
 
86
- if (_typeof(params.autoplay) !== 'object' || !autoplay.running) {
99
+ if (_typeof(params.autoplay) !== 'object' || !autoPlay) {
87
100
  return;
88
101
  }
89
102
 
90
103
  autoplay.stop(); // eslint-disable-next-line no-param-reassign
91
104
 
92
105
  params.autoplay.delay = autoPlayDelay * 3;
106
+ setDelay(autoPlayDelay * 3);
107
+ setIsIncreasedDelay(true);
93
108
  autoplay.start();
94
- }, [autoPlayDelay]);
109
+ }, [autoPlay, autoPlayDelay]);
95
110
  var handlePrevClick = React.useCallback(function () {
96
111
  if (!swiperInstance) {
97
112
  return;
@@ -99,8 +114,8 @@ var Banner = function Banner(_ref) {
99
114
 
100
115
  swiperInstance.slidePrev();
101
116
  onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
102
- increaseAutoplayDelay(swiperInstance);
103
- }, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
117
+ !isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
118
+ }, [swiperInstance, onPrevClick, isIncreasedDelay, increaseAutoplayDelay]);
104
119
  var handleNextClick = React.useCallback(function () {
105
120
  if (!swiperInstance) {
106
121
  return;
@@ -108,8 +123,8 @@ var Banner = function Banner(_ref) {
108
123
 
109
124
  swiperInstance.slideNext();
110
125
  onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
111
- increaseAutoplayDelay(swiperInstance);
112
- }, [swiperInstance, onNextClick, increaseAutoplayDelay]);
126
+ !isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
127
+ }, [swiperInstance, onNextClick, isIncreasedDelay, increaseAutoplayDelay]);
113
128
  var handleDotClick = React.useCallback(function (index) {
114
129
  if (!swiperInstance) {
115
130
  return;
@@ -122,11 +137,8 @@ var Banner = function Banner(_ref) {
122
137
  }
123
138
 
124
139
  onDotClick === null || onDotClick === void 0 ? void 0 : onDotClick(swiperInstance.realIndex);
125
- increaseAutoplayDelay(swiperInstance);
126
- }, [swiperInstance, loop, onDotClick, increaseAutoplayDelay]);
127
- var handleSwiper = React.useCallback(function (swiper) {
128
- setSwiperInstance(swiper);
129
- }, []);
140
+ !isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
141
+ }, [swiperInstance, loop, onDotClick, isIncreasedDelay, increaseAutoplayDelay]);
130
142
  var handleReachBeginning = React.useCallback(function () {
131
143
  setBeginning(true);
132
144
  }, []);
@@ -148,24 +160,37 @@ var Banner = function Banner(_ref) {
148
160
  setActiveIndex(realIndex);
149
161
  onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
150
162
  }, [onChange]);
151
- var handleAutoplayStop = React.useCallback(function () {
152
- setAutoPlayning(false);
153
- }, []);
163
+ React.useEffect(function () {
164
+ var rootElement = rootRef.current;
165
+
166
+ if (!pauseOnHover || !autoPlay) {
167
+ return;
168
+ }
169
+
170
+ rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseenter', function () {
171
+ swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.stop();
172
+ setAutoPlaying(false);
173
+ });
174
+ rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseleave', function () {
175
+ swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.start();
176
+ setAutoPlaying(true);
177
+ });
178
+ }, [autoPlay, pauseOnHover, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
154
179
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
155
180
  className: cn({
156
181
  'nav-theme': navTheme
157
- }, className)
182
+ }, className),
183
+ ref: rootRef
158
184
  }), /*#__PURE__*/React.createElement(Swiper, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
159
185
  className: cn('swiper'),
160
186
  loop: loop,
161
187
  autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
162
188
  watchSlidesVisibility: true,
163
- onSwiper: handleSwiper,
189
+ onSwiper: setSwiperInstance,
164
190
  onReachBeginning: handleReachBeginning,
165
191
  onReachEnd: handleReachEnd,
166
192
  onFromEdge: handleFromEdge,
167
193
  onSlideChange: handleSlideChange,
168
- onAutoplayStop: handleAutoplayStop,
169
194
  onTouchEnd: increaseAutoplayDelay
170
195
  }), React.Children.map(children, function (child, i) {
171
196
  return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
@@ -232,6 +257,7 @@ Banner.propTypes = {
232
257
  }),
233
258
  autoPlay: PropTypes.bool,
234
259
  autoPlayDelay: PropTypes.number,
260
+ pauseOnHover: PropTypes.bool,
235
261
  navTheme: PropTypes.oneOf(Object.values(NavTheme)),
236
262
  onNextClick: PropTypes.func,
237
263
  onPrevClick: PropTypes.func,