@megafon/ui-core 5.4.6 → 5.6.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 +29 -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/Search/Search.css +56 -4
- package/dist/es/components/Search/Search.d.ts +22 -0
- package/dist/es/components/Search/Search.js +170 -22
- 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/Search/Search.css +56 -4
- package/dist/lib/components/Search/Search.d.ts +22 -0
- package/dist/lib/components/Search/Search.js +179 -22
- 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 +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
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.6.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.5.0...@megafon/ui-core@5.6.0) (2024-02-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **search:** added results for not found ([1a62ab7](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/1a62ab78071e2b58235d93f403512a987a3c5ce1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **snackbar:** fix useSwipe logic ([29b1187](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/29b1187fdcb065d91123a85e4ee2fde4bd9ab077))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **button:** add icon to text for extra-small and small sizes ([170b606](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/170b60639863a4b933db5a9c1072e3d1f15f8050))
|
|
28
|
+
* **chip:** create component Chip ([268d329](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/268d329713468e78c111675f0fbe8061b6c91d4c))
|
|
29
|
+
* **tabs:** add new prop for panel class ([0a5d47e](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/0a5d47e46a618cec32f62ab94b9d0f9ee769d029))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
6
35
|
## [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)
|
|
7
36
|
|
|
8
37
|
**Note:** Version bump only for package @megafon/ui-core
|
|
@@ -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;
|
|
@@ -213,10 +213,43 @@
|
|
|
213
213
|
padding-right: 12px;
|
|
214
214
|
padding-left: 12px;
|
|
215
215
|
}
|
|
216
|
-
.mfui-
|
|
216
|
+
.mfui-search__popular-item {
|
|
217
|
+
display: -webkit-box;
|
|
218
|
+
display: -ms-flexbox;
|
|
219
|
+
display: flex;
|
|
220
|
+
-webkit-box-align: center;
|
|
221
|
+
-ms-flex-align: center;
|
|
222
|
+
align-items: center;
|
|
223
|
+
min-height: 48px;
|
|
224
|
+
padding-right: 16px;
|
|
225
|
+
padding-left: 12px;
|
|
226
|
+
border-radius: 16px;
|
|
227
|
+
text-decoration: none;
|
|
228
|
+
background-color: var(--base);
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
}
|
|
231
|
+
.mfui-search__popular-icon {
|
|
232
|
+
display: -webkit-box;
|
|
233
|
+
display: -ms-flexbox;
|
|
234
|
+
display: flex;
|
|
235
|
+
-ms-flex-negative: 0;
|
|
236
|
+
flex-shrink: 0;
|
|
237
|
+
-webkit-box-align: center;
|
|
238
|
+
-ms-flex-align: center;
|
|
239
|
+
align-items: center;
|
|
240
|
+
-webkit-box-pack: center;
|
|
241
|
+
-ms-flex-pack: center;
|
|
242
|
+
justify-content: center;
|
|
243
|
+
width: 32px;
|
|
244
|
+
height: 32px;
|
|
245
|
+
margin-right: 16px;
|
|
246
|
+
}
|
|
247
|
+
.mfui-search__list-item_active,
|
|
248
|
+
.mfui-search__popular-item_active {
|
|
217
249
|
background-color: var(--spbSky0);
|
|
218
250
|
}
|
|
219
|
-
.mfui-search__item-title
|
|
251
|
+
.mfui-search__item-title,
|
|
252
|
+
.mfui-search__popular-item-title {
|
|
220
253
|
position: relative;
|
|
221
254
|
-webkit-box-flex: 1;
|
|
222
255
|
-ms-flex-positive: 1;
|
|
@@ -224,7 +257,8 @@
|
|
|
224
257
|
overflow: hidden;
|
|
225
258
|
white-space: nowrap;
|
|
226
259
|
}
|
|
227
|
-
.mfui-search__item-title:after
|
|
260
|
+
.mfui-search__item-title:after,
|
|
261
|
+
.mfui-search__popular-item-title:after {
|
|
228
262
|
content: '';
|
|
229
263
|
position: absolute;
|
|
230
264
|
top: 0;
|
|
@@ -234,7 +268,8 @@
|
|
|
234
268
|
background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(var(--base)));
|
|
235
269
|
background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--base));
|
|
236
270
|
}
|
|
237
|
-
.mfui-search__list-item_active .mfui-search__item-title:after
|
|
271
|
+
.mfui-search__list-item_active .mfui-search__item-title:after,
|
|
272
|
+
.mfui-search__popular-item_active .mfui-search__popular-item-title:after {
|
|
238
273
|
background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(var(--spbSky0)));
|
|
239
274
|
background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--spbSky0));
|
|
240
275
|
}
|
|
@@ -261,6 +296,23 @@
|
|
|
261
296
|
align-items: center;
|
|
262
297
|
height: 100%;
|
|
263
298
|
}
|
|
299
|
+
.mfui-search__list_not-found {
|
|
300
|
+
cursor: default;
|
|
301
|
+
}
|
|
302
|
+
.mfui-search__not-found-text {
|
|
303
|
+
font-family: inherit;
|
|
304
|
+
padding: 12px 32px;
|
|
305
|
+
color: var(--spbSky3);
|
|
306
|
+
background-color: var(--base);
|
|
307
|
+
}
|
|
308
|
+
.mfui-search__not-found-text_show-popular {
|
|
309
|
+
padding: 0 0 16px 0;
|
|
310
|
+
border-bottom: 1px solid var(--spbSky2);
|
|
311
|
+
}
|
|
312
|
+
.mfui-search__popular-title {
|
|
313
|
+
padding-top: 16px;
|
|
314
|
+
padding-bottom: 8px;
|
|
315
|
+
}
|
|
264
316
|
.mfui-search_open {
|
|
265
317
|
z-index: 12;
|
|
266
318
|
}
|
|
@@ -18,6 +18,14 @@ export declare type SearchItem = {
|
|
|
18
18
|
/** Размер горизонтальных отступов элемента */
|
|
19
19
|
paddings?: typeof SearchItemsPaddings[keyof typeof SearchItemsPaddings];
|
|
20
20
|
};
|
|
21
|
+
export declare type PopularItem = {
|
|
22
|
+
/** Название элемента */
|
|
23
|
+
title: string;
|
|
24
|
+
/** Ссылка элемента */
|
|
25
|
+
href?: string;
|
|
26
|
+
/** Иконка элемента */
|
|
27
|
+
icon?: JSX.Element;
|
|
28
|
+
};
|
|
21
29
|
export interface ISearchProps {
|
|
22
30
|
/** Дополнительные data атрибуты к внутренним элементам */
|
|
23
31
|
dataAttrs?: {
|
|
@@ -28,6 +36,7 @@ export interface ISearchProps {
|
|
|
28
36
|
item?: Record<string, string>;
|
|
29
37
|
itemTitle?: Record<string, string>;
|
|
30
38
|
notice?: Record<string, string>;
|
|
39
|
+
popularItem?: Record<string, string>;
|
|
31
40
|
};
|
|
32
41
|
/** Значение */
|
|
33
42
|
value?: string;
|
|
@@ -63,9 +72,20 @@ export interface ISearchProps {
|
|
|
63
72
|
control?: string;
|
|
64
73
|
icon?: string;
|
|
65
74
|
submitButton?: string;
|
|
75
|
+
textNotFound?: string;
|
|
76
|
+
popularTitle?: string;
|
|
77
|
+
popularItem?: string;
|
|
66
78
|
};
|
|
67
79
|
/** Отображение загрузки */
|
|
68
80
|
showLoader?: boolean;
|
|
81
|
+
/** Выводить результат, когда нет результатов поиска */
|
|
82
|
+
showNotFound?: boolean;
|
|
83
|
+
/** Текст, когда нет результатов поиска */
|
|
84
|
+
textNotFound?: string;
|
|
85
|
+
/** Популярные элементы (max 5) */
|
|
86
|
+
popularItems?: PopularItem[];
|
|
87
|
+
/** Заголовок перед популярными элементами */
|
|
88
|
+
popularTitle?: string;
|
|
69
89
|
/** Обработчик изменения поля */
|
|
70
90
|
onChange?: (value: string) => void;
|
|
71
91
|
/** Обработчик нажатия на enter */
|
|
@@ -74,6 +94,8 @@ export interface ISearchProps {
|
|
|
74
94
|
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
75
95
|
/** Обработчик входа в фокус */
|
|
76
96
|
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
97
|
+
/** Обработчик нажатия на популярный элемент */
|
|
98
|
+
onPopularItemClick?: (popularItemValue?: string) => void;
|
|
77
99
|
}
|
|
78
100
|
declare const Search: React.FC<ISearchProps>;
|
|
79
101
|
export default Search;
|