@megafon/ui-core 5.4.5 → 5.5.0
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.
- package/CHANGELOG.md +26 -0
- package/dist/es/components/Button/Button.css +65 -21
- package/dist/es/components/Calendar/Calendar.js +3 -1
- package/dist/es/components/Calendar/components/Month/Month.js +1 -1
- package/dist/es/components/Chip/Chip.css +111 -0
- package/dist/es/components/Chip/Chip.d.ts +36 -0
- package/dist/es/components/Chip/Chip.js +61 -0
- package/dist/es/components/Tabs/Tabs.d.ts +1 -0
- package/dist/es/components/Tabs/Tabs.js +4 -3
- package/dist/es/hooks/useSwipe.js +47 -22
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/lib/components/Button/Button.css +65 -21
- package/dist/lib/components/Calendar/Calendar.js +3 -1
- package/dist/lib/components/Chip/Chip.css +111 -0
- package/dist/lib/components/Chip/Chip.d.ts +36 -0
- package/dist/lib/components/Chip/Chip.js +82 -0
- package/dist/lib/components/Tabs/Tabs.d.ts +1 -0
- package/dist/lib/components/Tabs/Tabs.js +4 -3
- package/dist/lib/hooks/useSwipe.js +47 -22
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +8 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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
|
+
# [5.5.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.4.6...@megafon/ui-core@5.5.0) (2024-02-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **snackbar:** fix useSwipe logic ([29b1187](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/29b1187fdcb065d91123a85e4ee2fde4bd9ab077))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **button:** add icon to text for extra-small and small sizes ([170b606](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/170b60639863a4b933db5a9c1072e3d1f15f8050))
|
|
17
|
+
* **chip:** create component Chip ([268d329](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/268d329713468e78c111675f0fbe8061b6c91d4c))
|
|
18
|
+
* **tabs:** add new prop for panel class ([0a5d47e](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/0a5d47e46a618cec32f62ab94b9d0f9ee769d029))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [5.4.6](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.4.5...@megafon/ui-core@5.4.6) (2024-01-30)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @megafon/ui-core
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
## [5.4.5](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.4.4...@megafon/ui-core@5.4.5) (2024-01-22)
|
|
7
33
|
|
|
8
34
|
|
|
@@ -40,10 +40,14 @@
|
|
|
40
40
|
line-height: 14px;
|
|
41
41
|
}
|
|
42
42
|
.mfui-button_size-all_extra-small .mfui-button__icon,
|
|
43
|
-
.mfui-button_size-all_extra-small .mfui-button__icon-arrow
|
|
43
|
+
.mfui-button_size-all_extra-small .mfui-button__icon-arrow,
|
|
44
|
+
.mfui-button_size-all_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
44
45
|
width: 20px;
|
|
45
46
|
height: 20px;
|
|
46
47
|
}
|
|
48
|
+
.mfui-button_size-all_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
49
|
+
margin-right: 2px;
|
|
50
|
+
}
|
|
47
51
|
.mfui-button_size-all_small {
|
|
48
52
|
min-width: 40px;
|
|
49
53
|
height: 40px;
|
|
@@ -54,12 +58,17 @@
|
|
|
54
58
|
width: 20px;
|
|
55
59
|
height: 20px;
|
|
56
60
|
}
|
|
61
|
+
.mfui-button_size-all_small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
62
|
+
width: 32px;
|
|
63
|
+
height: 32px;
|
|
64
|
+
}
|
|
57
65
|
.mfui-button_size-all_medium {
|
|
58
66
|
min-width: 52px;
|
|
59
67
|
height: 52px;
|
|
60
68
|
}
|
|
61
69
|
.mfui-button_size-all_medium .mfui-button__icon,
|
|
62
|
-
.mfui-button_size-all_medium .mfui-button__icon-arrow
|
|
70
|
+
.mfui-button_size-all_medium .mfui-button__icon-arrow,
|
|
71
|
+
.mfui-button_size-all_medium.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
63
72
|
width: 32px;
|
|
64
73
|
height: 32px;
|
|
65
74
|
}
|
|
@@ -68,7 +77,8 @@
|
|
|
68
77
|
height: 60px;
|
|
69
78
|
}
|
|
70
79
|
.mfui-button_size-all_large .mfui-button__icon,
|
|
71
|
-
.mfui-button_size-all_large .mfui-button__icon-arrow
|
|
80
|
+
.mfui-button_size-all_large .mfui-button__icon-arrow,
|
|
81
|
+
.mfui-button_size-all_large.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
72
82
|
width: 32px;
|
|
73
83
|
height: 32px;
|
|
74
84
|
}
|
|
@@ -99,10 +109,14 @@
|
|
|
99
109
|
line-height: 14px;
|
|
100
110
|
}
|
|
101
111
|
.mfui-button_size-desktop_extra-small .mfui-button__icon,
|
|
102
|
-
.mfui-button_size-desktop_extra-small .mfui-button__icon-arrow
|
|
112
|
+
.mfui-button_size-desktop_extra-small .mfui-button__icon-arrow,
|
|
113
|
+
.mfui-button_size-desktop_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
103
114
|
width: 20px;
|
|
104
115
|
height: 20px;
|
|
105
116
|
}
|
|
117
|
+
.mfui-button_size-desktop_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
118
|
+
margin-right: 2px;
|
|
119
|
+
}
|
|
106
120
|
.mfui-button_size-desktop_small {
|
|
107
121
|
min-width: 40px;
|
|
108
122
|
height: 40px;
|
|
@@ -113,12 +127,17 @@
|
|
|
113
127
|
width: 20px;
|
|
114
128
|
height: 20px;
|
|
115
129
|
}
|
|
130
|
+
.mfui-button_size-desktop_small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
131
|
+
width: 32px;
|
|
132
|
+
height: 32px;
|
|
133
|
+
}
|
|
116
134
|
.mfui-button_size-desktop_medium {
|
|
117
135
|
min-width: 52px;
|
|
118
136
|
height: 52px;
|
|
119
137
|
}
|
|
120
138
|
.mfui-button_size-desktop_medium .mfui-button__icon,
|
|
121
|
-
.mfui-button_size-desktop_medium .mfui-button__icon-arrow
|
|
139
|
+
.mfui-button_size-desktop_medium .mfui-button__icon-arrow,
|
|
140
|
+
.mfui-button_size-desktop_medium.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
122
141
|
width: 32px;
|
|
123
142
|
height: 32px;
|
|
124
143
|
}
|
|
@@ -127,7 +146,8 @@
|
|
|
127
146
|
height: 60px;
|
|
128
147
|
}
|
|
129
148
|
.mfui-button_size-desktop_large .mfui-button__icon,
|
|
130
|
-
.mfui-button_size-desktop_large .mfui-button__icon-arrow
|
|
149
|
+
.mfui-button_size-desktop_large .mfui-button__icon-arrow,
|
|
150
|
+
.mfui-button_size-desktop_large.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
131
151
|
width: 32px;
|
|
132
152
|
height: 32px;
|
|
133
153
|
}
|
|
@@ -159,10 +179,14 @@
|
|
|
159
179
|
line-height: 14px;
|
|
160
180
|
}
|
|
161
181
|
.mfui-button_size-wide_extra-small .mfui-button__icon,
|
|
162
|
-
.mfui-button_size-wide_extra-small .mfui-button__icon-arrow
|
|
182
|
+
.mfui-button_size-wide_extra-small .mfui-button__icon-arrow,
|
|
183
|
+
.mfui-button_size-wide_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
163
184
|
width: 20px;
|
|
164
185
|
height: 20px;
|
|
165
186
|
}
|
|
187
|
+
.mfui-button_size-wide_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
188
|
+
margin-right: 2px;
|
|
189
|
+
}
|
|
166
190
|
.mfui-button_size-wide_small {
|
|
167
191
|
min-width: 40px;
|
|
168
192
|
height: 40px;
|
|
@@ -173,12 +197,17 @@
|
|
|
173
197
|
width: 20px;
|
|
174
198
|
height: 20px;
|
|
175
199
|
}
|
|
200
|
+
.mfui-button_size-wide_small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
201
|
+
width: 32px;
|
|
202
|
+
height: 32px;
|
|
203
|
+
}
|
|
176
204
|
.mfui-button_size-wide_medium {
|
|
177
205
|
min-width: 52px;
|
|
178
206
|
height: 52px;
|
|
179
207
|
}
|
|
180
208
|
.mfui-button_size-wide_medium .mfui-button__icon,
|
|
181
|
-
.mfui-button_size-wide_medium .mfui-button__icon-arrow
|
|
209
|
+
.mfui-button_size-wide_medium .mfui-button__icon-arrow,
|
|
210
|
+
.mfui-button_size-wide_medium.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
182
211
|
width: 32px;
|
|
183
212
|
height: 32px;
|
|
184
213
|
}
|
|
@@ -187,7 +216,8 @@
|
|
|
187
216
|
height: 60px;
|
|
188
217
|
}
|
|
189
218
|
.mfui-button_size-wide_large .mfui-button__icon,
|
|
190
|
-
.mfui-button_size-wide_large .mfui-button__icon-arrow
|
|
219
|
+
.mfui-button_size-wide_large .mfui-button__icon-arrow,
|
|
220
|
+
.mfui-button_size-wide_large.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
191
221
|
width: 32px;
|
|
192
222
|
height: 32px;
|
|
193
223
|
}
|
|
@@ -219,10 +249,14 @@
|
|
|
219
249
|
line-height: 14px;
|
|
220
250
|
}
|
|
221
251
|
.mfui-button_size-tablet_extra-small .mfui-button__icon,
|
|
222
|
-
.mfui-button_size-tablet_extra-small .mfui-button__icon-arrow
|
|
252
|
+
.mfui-button_size-tablet_extra-small .mfui-button__icon-arrow,
|
|
253
|
+
.mfui-button_size-tablet_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
223
254
|
width: 20px;
|
|
224
255
|
height: 20px;
|
|
225
256
|
}
|
|
257
|
+
.mfui-button_size-tablet_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
258
|
+
margin-right: 2px;
|
|
259
|
+
}
|
|
226
260
|
.mfui-button_size-tablet_small {
|
|
227
261
|
min-width: 40px;
|
|
228
262
|
height: 40px;
|
|
@@ -233,12 +267,17 @@
|
|
|
233
267
|
width: 20px;
|
|
234
268
|
height: 20px;
|
|
235
269
|
}
|
|
270
|
+
.mfui-button_size-tablet_small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
271
|
+
width: 32px;
|
|
272
|
+
height: 32px;
|
|
273
|
+
}
|
|
236
274
|
.mfui-button_size-tablet_medium {
|
|
237
275
|
min-width: 52px;
|
|
238
276
|
height: 52px;
|
|
239
277
|
}
|
|
240
278
|
.mfui-button_size-tablet_medium .mfui-button__icon,
|
|
241
|
-
.mfui-button_size-tablet_medium .mfui-button__icon-arrow
|
|
279
|
+
.mfui-button_size-tablet_medium .mfui-button__icon-arrow,
|
|
280
|
+
.mfui-button_size-tablet_medium.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
242
281
|
width: 32px;
|
|
243
282
|
height: 32px;
|
|
244
283
|
}
|
|
@@ -247,7 +286,8 @@
|
|
|
247
286
|
height: 60px;
|
|
248
287
|
}
|
|
249
288
|
.mfui-button_size-tablet_large .mfui-button__icon,
|
|
250
|
-
.mfui-button_size-tablet_large .mfui-button__icon-arrow
|
|
289
|
+
.mfui-button_size-tablet_large .mfui-button__icon-arrow,
|
|
290
|
+
.mfui-button_size-tablet_large.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
251
291
|
width: 32px;
|
|
252
292
|
height: 32px;
|
|
253
293
|
}
|
|
@@ -279,10 +319,14 @@
|
|
|
279
319
|
line-height: 14px;
|
|
280
320
|
}
|
|
281
321
|
.mfui-button_size-mobile_extra-small .mfui-button__icon,
|
|
282
|
-
.mfui-button_size-mobile_extra-small .mfui-button__icon-arrow
|
|
322
|
+
.mfui-button_size-mobile_extra-small .mfui-button__icon-arrow,
|
|
323
|
+
.mfui-button_size-mobile_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
283
324
|
width: 20px;
|
|
284
325
|
height: 20px;
|
|
285
326
|
}
|
|
327
|
+
.mfui-button_size-mobile_extra-small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
328
|
+
margin-right: 2px;
|
|
329
|
+
}
|
|
286
330
|
.mfui-button_size-mobile_small {
|
|
287
331
|
min-width: 40px;
|
|
288
332
|
height: 40px;
|
|
@@ -293,12 +337,17 @@
|
|
|
293
337
|
width: 20px;
|
|
294
338
|
height: 20px;
|
|
295
339
|
}
|
|
340
|
+
.mfui-button_size-mobile_small.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
341
|
+
width: 32px;
|
|
342
|
+
height: 32px;
|
|
343
|
+
}
|
|
296
344
|
.mfui-button_size-mobile_medium {
|
|
297
345
|
min-width: 52px;
|
|
298
346
|
height: 52px;
|
|
299
347
|
}
|
|
300
348
|
.mfui-button_size-mobile_medium .mfui-button__icon,
|
|
301
|
-
.mfui-button_size-mobile_medium .mfui-button__icon-arrow
|
|
349
|
+
.mfui-button_size-mobile_medium .mfui-button__icon-arrow,
|
|
350
|
+
.mfui-button_size-mobile_medium.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
302
351
|
width: 32px;
|
|
303
352
|
height: 32px;
|
|
304
353
|
}
|
|
@@ -307,7 +356,8 @@
|
|
|
307
356
|
height: 60px;
|
|
308
357
|
}
|
|
309
358
|
.mfui-button_size-mobile_large .mfui-button__icon,
|
|
310
|
-
.mfui-button_size-mobile_large .mfui-button__icon-arrow
|
|
359
|
+
.mfui-button_size-mobile_large .mfui-button__icon-arrow,
|
|
360
|
+
.mfui-button_size-mobile_large.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
311
361
|
width: 32px;
|
|
312
362
|
height: 32px;
|
|
313
363
|
}
|
|
@@ -395,14 +445,8 @@
|
|
|
395
445
|
padding: 0;
|
|
396
446
|
}
|
|
397
447
|
.mfui-button_content-type_icon-text .mfui-button__icon {
|
|
398
|
-
width: 32px;
|
|
399
|
-
height: 32px;
|
|
400
448
|
margin-right: 4px;
|
|
401
449
|
}
|
|
402
|
-
.mfui-button_content-type_icon-text.mfui-button_size-all_small .mfui-button__icon,
|
|
403
|
-
.mfui-button_content-type_icon-text.mfui-button_size-all_extra-small .mfui-button__icon {
|
|
404
|
-
display: none;
|
|
405
|
-
}
|
|
406
450
|
.mfui-button_type_text.mfui-button_theme_green {
|
|
407
451
|
width: -webkit-fit-content;
|
|
408
452
|
width: -moz-fit-content;
|
|
@@ -207,6 +207,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
var renderDays = function renderDays(days) {
|
|
210
|
+
var correctionIndex = 0;
|
|
210
211
|
return days.map(function (day, index) {
|
|
211
212
|
if (_typeof(day) === 'object') {
|
|
212
213
|
var date = day.date,
|
|
@@ -220,7 +221,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
220
221
|
|
|
221
222
|
return /*#__PURE__*/React.createElement(Day, _extends({
|
|
222
223
|
dataAttrs: {
|
|
223
|
-
root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.day, index + 1))
|
|
224
|
+
root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.day, index + 1 - correctionIndex))
|
|
224
225
|
},
|
|
225
226
|
date: date,
|
|
226
227
|
key: formatDate(date, 'dd-MM-yyyy'),
|
|
@@ -233,6 +234,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
233
234
|
}));
|
|
234
235
|
}
|
|
235
236
|
|
|
237
|
+
correctionIndex += 1;
|
|
236
238
|
return /*#__PURE__*/React.createElement("div", {
|
|
237
239
|
key: index + day
|
|
238
240
|
});
|
|
@@ -3,8 +3,8 @@ import "core-js/modules/es.array.concat.js";
|
|
|
3
3
|
import "core-js/modules/es.array.map.js";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { checkEventIsClickOrEnterPress, cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
6
|
-
import "./Month.css";
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
7
|
+
import "./Month.css";
|
|
8
8
|
|
|
9
9
|
var ArrowLeft = function ArrowLeft(props) {
|
|
10
10
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
.mfui-chip {
|
|
2
|
+
font-family: inherit;
|
|
3
|
+
font-size: 15px;
|
|
4
|
+
line-height: 24px;
|
|
5
|
+
font-weight: 500;
|
|
6
|
+
display: -webkit-inline-box;
|
|
7
|
+
display: -ms-inline-flexbox;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
-webkit-box-align: center;
|
|
10
|
+
-ms-flex-align: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
-webkit-box-sizing: border-box;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
min-width: -webkit-fit-content;
|
|
15
|
+
min-width: -moz-fit-content;
|
|
16
|
+
min-width: fit-content;
|
|
17
|
+
padding: 8px 20px;
|
|
18
|
+
border: none;
|
|
19
|
+
border-radius: 20px;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
color: var(--content);
|
|
22
|
+
text-align: center;
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
background-color: var(--spbSky0);
|
|
25
|
+
outline: none;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
-webkit-transition: background-color 0.3s, color 0.3s;
|
|
28
|
+
transition: background-color 0.3s, color 0.3s;
|
|
29
|
+
-webkit-appearance: none;
|
|
30
|
+
-moz-appearance: none;
|
|
31
|
+
appearance: none;
|
|
32
|
+
}
|
|
33
|
+
.mfui-chip svg {
|
|
34
|
+
-webkit-transition: fill 0.3s;
|
|
35
|
+
transition: fill 0.3s;
|
|
36
|
+
fill: var(--content);
|
|
37
|
+
}
|
|
38
|
+
@media screen and (max-width: 767px) {
|
|
39
|
+
.mfui-chip {
|
|
40
|
+
padding: 4px 12px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
.mfui-chip:hover {
|
|
44
|
+
background-color: var(--spbSky1);
|
|
45
|
+
}
|
|
46
|
+
.mfui-chip_disabled,
|
|
47
|
+
.mfui-chip_disabled:hover {
|
|
48
|
+
color: var(--spbSky3);
|
|
49
|
+
background-color: var(--spbSky0);
|
|
50
|
+
cursor: default;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
}
|
|
53
|
+
.mfui-chip_disabled svg,
|
|
54
|
+
.mfui-chip_disabled:hover svg {
|
|
55
|
+
fill: var(--spbSky3);
|
|
56
|
+
}
|
|
57
|
+
.mfui-chip_checked,
|
|
58
|
+
.mfui-chip_checked:hover {
|
|
59
|
+
color: var(--stcWhite);
|
|
60
|
+
background-color: var(--reflexBlue);
|
|
61
|
+
}
|
|
62
|
+
.mfui-chip_checked svg,
|
|
63
|
+
.mfui-chip_checked:hover svg {
|
|
64
|
+
fill: var(--stcWhite);
|
|
65
|
+
}
|
|
66
|
+
.mfui-chip_checked.mfui-chip_color_black,
|
|
67
|
+
.mfui-chip_checked.mfui-chip_color_black:hover {
|
|
68
|
+
color: var(--base);
|
|
69
|
+
background-color: var(--content);
|
|
70
|
+
}
|
|
71
|
+
.mfui-chip_checked.mfui-chip_color_black svg,
|
|
72
|
+
.mfui-chip_checked.mfui-chip_color_black:hover svg {
|
|
73
|
+
fill: var(--base);
|
|
74
|
+
}
|
|
75
|
+
.mfui-chip_with-icon {
|
|
76
|
+
padding-left: 16px;
|
|
77
|
+
}
|
|
78
|
+
@media screen and (max-width: 767px) {
|
|
79
|
+
.mfui-chip_with-icon {
|
|
80
|
+
padding-left: 8px;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
.mfui-chip__inner {
|
|
84
|
+
display: -webkit-inline-box;
|
|
85
|
+
display: -ms-inline-flexbox;
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
-webkit-box-align: center;
|
|
88
|
+
-ms-flex-align: center;
|
|
89
|
+
align-items: center;
|
|
90
|
+
-webkit-box-pack: center;
|
|
91
|
+
-ms-flex-pack: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
}
|
|
95
|
+
.mfui-chip__icon {
|
|
96
|
+
display: block;
|
|
97
|
+
width: 20px;
|
|
98
|
+
min-width: 20px;
|
|
99
|
+
max-height: 20px;
|
|
100
|
+
margin-right: 6px;
|
|
101
|
+
}
|
|
102
|
+
@media screen and (max-width: 767px) {
|
|
103
|
+
.mfui-chip__icon {
|
|
104
|
+
margin-right: 4px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.mfui-chip__icon svg {
|
|
108
|
+
display: block;
|
|
109
|
+
width: 100%;
|
|
110
|
+
height: 100%;
|
|
111
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { Ref } from 'react';
|
|
2
|
+
import './Chip.less';
|
|
3
|
+
export interface IChipProps {
|
|
4
|
+
/** Идентификатор */
|
|
5
|
+
id: number | string;
|
|
6
|
+
/** Набор цветов для компонента */
|
|
7
|
+
color?: 'default' | 'black';
|
|
8
|
+
/** Отображение в отмеченном (зажатом) состоянии */
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
/** Отключенное состояние */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Иконка */
|
|
13
|
+
icon?: JSX.Element;
|
|
14
|
+
/** Обработчик нажатия */
|
|
15
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>, id: number | string) => void;
|
|
16
|
+
/** Дочерние элементы */
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/** Дополнительный класс корневого элемента */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Дополнительные классы для внутренних элементов */
|
|
21
|
+
classes?: {
|
|
22
|
+
root?: string;
|
|
23
|
+
inner?: string;
|
|
24
|
+
icon?: string;
|
|
25
|
+
};
|
|
26
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
27
|
+
dataAttrs?: {
|
|
28
|
+
root?: Record<string, string>;
|
|
29
|
+
inner?: Record<string, string>;
|
|
30
|
+
icon?: Record<string, string>;
|
|
31
|
+
};
|
|
32
|
+
/** Ссылка на элемент */
|
|
33
|
+
rootRef?: Ref<HTMLButtonElement>;
|
|
34
|
+
}
|
|
35
|
+
declare const Chip: React.FC<IChipProps>;
|
|
36
|
+
export default Chip;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
|
+
import * as PropTypes from 'prop-types';
|
|
5
|
+
import "./Chip.css";
|
|
6
|
+
var cn = cnCreate('mfui-chip');
|
|
7
|
+
|
|
8
|
+
var Chip = function Chip(_ref) {
|
|
9
|
+
var id = _ref.id,
|
|
10
|
+
_ref$color = _ref.color,
|
|
11
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
12
|
+
_ref$checked = _ref.checked,
|
|
13
|
+
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
14
|
+
_ref$disabled = _ref.disabled,
|
|
15
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
16
|
+
icon = _ref.icon,
|
|
17
|
+
onClick = _ref.onClick,
|
|
18
|
+
children = _ref.children,
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
_ref$classes = _ref.classes,
|
|
21
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
22
|
+
dataAttrs = _ref.dataAttrs,
|
|
23
|
+
rootRef = _ref.rootRef;
|
|
24
|
+
var handleClick = React.useCallback(function (e) {
|
|
25
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e, id);
|
|
26
|
+
}, [onClick, id]);
|
|
27
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
28
|
+
type: "button",
|
|
29
|
+
className: cn({
|
|
30
|
+
color: color,
|
|
31
|
+
checked: checked,
|
|
32
|
+
disabled: disabled,
|
|
33
|
+
'with-icon': !!icon
|
|
34
|
+
}, [className, classes.root])
|
|
35
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
onClick: handleClick,
|
|
38
|
+
ref: rootRef
|
|
39
|
+
}), !!icon && /*#__PURE__*/React.createElement("span", _extends({
|
|
40
|
+
className: cn('icon', [classes.icon])
|
|
41
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.icon)), icon), /*#__PURE__*/React.createElement("span", _extends({
|
|
42
|
+
className: cn('inner', [classes.inner])
|
|
43
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner)), children));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
Chip.propTypes = {
|
|
47
|
+
id: PropTypes.string.isRequired,
|
|
48
|
+
color: PropTypes.oneOf(['default', 'black']),
|
|
49
|
+
checked: PropTypes.bool,
|
|
50
|
+
disabled: PropTypes.bool,
|
|
51
|
+
icon: PropTypes.element,
|
|
52
|
+
className: PropTypes.string,
|
|
53
|
+
classes: PropTypes.objectOf(PropTypes.string),
|
|
54
|
+
dataAttrs: PropTypes.objectOf(PropTypes.object),
|
|
55
|
+
onClick: PropTypes.func,
|
|
56
|
+
children: PropTypes.node,
|
|
57
|
+
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
|
58
|
+
current: PropTypes.elementType
|
|
59
|
+
}), PropTypes.any])])
|
|
60
|
+
};
|
|
61
|
+
export default Chip;
|
|
@@ -329,10 +329,10 @@ var Tabs = function Tabs(_ref) {
|
|
|
329
329
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.panel, i + 1), {
|
|
330
330
|
className: cn('panel', {
|
|
331
331
|
current: isCurrentPanel
|
|
332
|
-
})
|
|
332
|
+
}, [classes === null || classes === void 0 ? void 0 : classes.panel])
|
|
333
333
|
}), panel);
|
|
334
334
|
});
|
|
335
|
-
}, [children, currentIndex, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.panel, renderOnlyCurrentPanel]);
|
|
335
|
+
}, [children, currentIndex, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.panel, renderOnlyCurrentPanel, classes === null || classes === void 0 ? void 0 : classes.panel]);
|
|
336
336
|
React.useEffect(function () {
|
|
337
337
|
if (!sticky) {
|
|
338
338
|
return undefined;
|
|
@@ -459,7 +459,8 @@ Tabs.propTypes = {
|
|
|
459
459
|
swiperWrapper: PropTypes.string,
|
|
460
460
|
innerIndents: PropTypes.string,
|
|
461
461
|
tab: PropTypes.string,
|
|
462
|
-
activeTab: PropTypes.string
|
|
462
|
+
activeTab: PropTypes.string,
|
|
463
|
+
panel: PropTypes.string
|
|
463
464
|
}),
|
|
464
465
|
dataAttrs: PropTypes.shape({
|
|
465
466
|
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
@@ -22,18 +22,23 @@ function useSwipe(element) {
|
|
|
22
22
|
|
|
23
23
|
var _React$useState = React.useState(null),
|
|
24
24
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
initialTouchPositionX = _React$useState2[0],
|
|
26
|
+
setInitialTouchPositionX = _React$useState2[1];
|
|
27
27
|
|
|
28
|
-
var _React$useState3 = React.useState(
|
|
28
|
+
var _React$useState3 = React.useState(null),
|
|
29
29
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
initialTouchPositionY = _React$useState4[0],
|
|
31
|
+
setInitialTouchPositionY = _React$useState4[1];
|
|
32
32
|
|
|
33
|
-
var _React$useState5 = React.useState(
|
|
33
|
+
var _React$useState5 = React.useState(TransitionSteps.INITIAL_STEP),
|
|
34
34
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
transitionStep = _React$useState6[0],
|
|
36
|
+
setTransitionStep = _React$useState6[1];
|
|
37
|
+
|
|
38
|
+
var _React$useState7 = React.useState(''),
|
|
39
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
40
|
+
transform = _React$useState8[0],
|
|
41
|
+
setTransform = _React$useState8[1];
|
|
37
42
|
|
|
38
43
|
var animationFrameId = React.useRef(0);
|
|
39
44
|
var currentElement = element;
|
|
@@ -47,38 +52,58 @@ function useSwipe(element) {
|
|
|
47
52
|
animationFrameId.current = window.requestAnimationFrame(function () {
|
|
48
53
|
var _a;
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
if (!initialTouchPositionY) {
|
|
56
|
+
setInitialTouchPositionY(e.touches[0].clientY);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
51
59
|
|
|
52
|
-
if (!
|
|
60
|
+
if (!initialTouchPositionX) {
|
|
61
|
+
setInitialTouchPositionX(e.touches[0].clientX);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var positionsDiffX = initialTouchPositionX - e.touches[0].clientX;
|
|
66
|
+
var positionsDiffY = initialTouchPositionY - e.touches[0].clientY;
|
|
67
|
+
|
|
68
|
+
if (Math.abs(positionsDiffY) > Math.abs(positionsDiffX)) {
|
|
53
69
|
return;
|
|
54
70
|
}
|
|
55
71
|
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
setTransitionStep(TransitionSteps.MOVE_STEP);
|
|
73
|
+
|
|
74
|
+
if (!currentElement) {
|
|
58
75
|
return;
|
|
59
76
|
}
|
|
60
77
|
|
|
61
|
-
var positionsDiff =
|
|
78
|
+
var positionsDiff = initialTouchPositionX - e.touches[0].clientX;
|
|
62
79
|
var values = !!currentTransform && currentTransform !== 'none' ? (_a = currentTransform.match(/\(((?:[0-9][,\s]*)+)\)/)) === null || _a === void 0 ? void 0 : _a[0].split(', ') : undefined;
|
|
63
80
|
var currentTranslateX = !values || Number.isNaN(Number(values === null || values === void 0 ? void 0 : values[4])) ? 0 : Number(values === null || values === void 0 ? void 0 : values[4]);
|
|
64
81
|
positionsDiff !== 0 && setTransform("translateX(".concat(currentTranslateX - positionsDiff, "px)"));
|
|
65
82
|
animationFrameId.current = 0;
|
|
66
83
|
});
|
|
67
|
-
}, [
|
|
84
|
+
}, [initialTouchPositionX, initialTouchPositionY, currentElement, currentTransform]);
|
|
68
85
|
var handleWindowTouchEnd = React.useCallback(function (e) {
|
|
69
|
-
var _a;
|
|
86
|
+
var _a, _b;
|
|
70
87
|
|
|
71
|
-
if (!currentElement || !isTransitionMoveStep || !
|
|
88
|
+
if (!currentElement || !isTransitionMoveStep || !initialTouchPositionX || !initialTouchPositionY) {
|
|
72
89
|
return;
|
|
73
90
|
}
|
|
74
91
|
|
|
75
92
|
window.cancelAnimationFrame(animationFrameId.current);
|
|
93
|
+
var touchPositionY = (_a = e.changedTouches[0]) === null || _a === void 0 ? void 0 : _a.clientY;
|
|
94
|
+
var touchPositionX = (_b = e.changedTouches[0]) === null || _b === void 0 ? void 0 : _b.clientX;
|
|
95
|
+
|
|
96
|
+
if (Math.abs(touchPositionY - initialTouchPositionY) > Math.abs(touchPositionX - initialTouchPositionX)) {
|
|
97
|
+
setInitialTouchPositionX(null);
|
|
98
|
+
setInitialTouchPositionY(null);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
76
102
|
var windowCenterPosition = window.innerWidth / 2;
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
setInitialTouchPosition(null);
|
|
103
|
+
var isRightSwipe = touchPositionX > initialTouchPositionX;
|
|
104
|
+
var isLeftSwipe = touchPositionX < initialTouchPositionX;
|
|
105
|
+
var isMoreHalfSwiped = Math.abs(initialTouchPositionX - touchPositionX) > windowCenterPosition;
|
|
106
|
+
setInitialTouchPositionX(null);
|
|
82
107
|
|
|
83
108
|
switch (true) {
|
|
84
109
|
case isMoreHalfSwiped && isRightSwipe:
|
|
@@ -101,7 +126,7 @@ function useSwipe(element) {
|
|
|
101
126
|
setTransitionStep(TransitionSteps.INITIAL_STEP);
|
|
102
127
|
}
|
|
103
128
|
}
|
|
104
|
-
}, [currentElement, isTransitionMoveStep,
|
|
129
|
+
}, [currentElement, isTransitionMoveStep, initialTouchPositionX, initialTouchPositionY]);
|
|
105
130
|
React.useEffect(function () {
|
|
106
131
|
if (!isMobile || !currentElement) {
|
|
107
132
|
return;
|
package/dist/es/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { default as Caption } from './components/Caption/Caption';
|
|
|
7
7
|
export { default as Carousel } from './components/Carousel/Carousel';
|
|
8
8
|
export { default as Checkbox } from './components/Checkbox/Checkbox';
|
|
9
9
|
export { default as checkBreakpointsPropTypes } from './components/Carousel/checkBreakpointsPropTypes';
|
|
10
|
+
export { default as Chip } from './components/Chip/Chip';
|
|
10
11
|
export { default as Collapse } from './components/Collapse/Collapse';
|
|
11
12
|
export { default as ContentArea } from './components/ContentArea/ContentArea';
|
|
12
13
|
export { default as Counter } from './components/Counter/Counter';
|
package/dist/es/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { default as Caption } from "./components/Caption/Caption";
|
|
|
7
7
|
export { default as Carousel } from "./components/Carousel/Carousel";
|
|
8
8
|
export { default as Checkbox } from "./components/Checkbox/Checkbox";
|
|
9
9
|
export { default as checkBreakpointsPropTypes } from "./components/Carousel/checkBreakpointsPropTypes";
|
|
10
|
+
export { default as Chip } from "./components/Chip/Chip";
|
|
10
11
|
export { default as Collapse } from "./components/Collapse/Collapse";
|
|
11
12
|
export { default as ContentArea } from "./components/ContentArea/ContentArea";
|
|
12
13
|
export { default as Counter } from "./components/Counter/Counter";
|