@megafon/ui-core 6.4.4 → 6.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +20 -4
  2. package/dist/es/components/Banner/Banner.css +3 -0
  3. package/dist/es/components/Banner/Banner.d.ts +2 -0
  4. package/dist/es/components/Banner/Banner.js +5 -1
  5. package/dist/es/components/Calendar/Calendar.css +2 -3
  6. package/dist/es/components/Calendar/Calendar.js +2 -2
  7. package/dist/es/components/Calendar/components/Day/Day.css +10 -7
  8. package/dist/es/components/Calendar/components/Month/Month.css +5 -5
  9. package/dist/es/components/Search/Search.css +76 -4
  10. package/dist/es/components/Search/Search.d.ts +15 -2
  11. package/dist/es/components/Search/Search.js +204 -25
  12. package/dist/es/components/Search/i/textarea-resizer.svg +4 -0
  13. package/dist/es/components/Tooltip/Tooltip.css +56 -0
  14. package/dist/es/components/Tooltip/Tooltip.d.ts +8 -0
  15. package/dist/es/components/Tooltip/Tooltip.js +11 -2
  16. package/dist/lib/components/Banner/Banner.css +3 -0
  17. package/dist/lib/components/Banner/Banner.d.ts +2 -0
  18. package/dist/lib/components/Banner/Banner.js +5 -1
  19. package/dist/lib/components/Calendar/Calendar.css +2 -3
  20. package/dist/lib/components/Calendar/Calendar.js +2 -2
  21. package/dist/lib/components/Calendar/components/Day/Day.css +10 -7
  22. package/dist/lib/components/Calendar/components/Month/Month.css +5 -5
  23. package/dist/lib/components/Search/Search.css +76 -4
  24. package/dist/lib/components/Search/Search.d.ts +15 -2
  25. package/dist/lib/components/Search/Search.js +217 -26
  26. package/dist/lib/components/Search/i/textarea-resizer.svg +4 -0
  27. package/dist/lib/components/Tooltip/Tooltip.css +56 -0
  28. package/dist/lib/components/Tooltip/Tooltip.d.ts +8 -0
  29. package/dist/lib/components/Tooltip/Tooltip.js +13 -3
  30. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,21 +3,37 @@
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
- ## [6.4.4](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@6.4.3...@megafon/ui-core@6.4.4) (2024-11-01)
6
+ # [6.6.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@6.5.0...@megafon/ui-core@6.6.0) (2024-11-15)
7
7
 
8
- **Note:** Version bump only for package @megafon/ui-core
9
8
 
9
+ ### Features
10
10
 
11
+ * **search:** add textarea mode to search ([43dde16](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/43dde163db3650dc901c8a7f33d671ef5788866e))
12
+ * **search:** update textarea height ([c72dae8](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/c72dae8944ce5187327481b9878c6677711f250d))
11
13
 
12
14
 
13
15
 
14
- ## [6.4.3](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@6.4.2...@megafon/ui-core@6.4.3) (2024-10-29)
15
16
 
16
- **Note:** Version bump only for package @megafon/ui-core
17
17
 
18
+ # [6.5.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@6.4.4...@megafon/ui-core@6.5.0) (2024-11-06)
19
+
20
+ ### Bug Fixes
21
+
22
+ - **calendar:** fix width and remove left artifact from second line in date selection ([14408f9](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/14408f9ae65767cdba3235e239c30f95d66db32d))
18
23
 
24
+ ### Features
25
+
26
+ - **banner:** add optional prop hasMarginTop ([ef27905](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/ef2790599ddf81d3e125e36cdec9caca1dbc983b))
27
+ - **container:** add optional prop preventMarginTopCollapse ([2b5633b](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/2b5633bb5c63e6fbc7e828253c083d2e6474a6ac))
28
+ - **tooltip:** add new props: offset and isHiddenResize ([86214b5](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/86214b597bb22d0ebd7eb497d09de03b8ed88c36))
29
+
30
+ ## [6.4.4](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@6.4.3...@megafon/ui-core@6.4.4) (2024-11-01)
19
31
 
32
+ **Note:** Version bump only for package @megafon/ui-core
33
+
34
+ ## [6.4.3](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@6.4.2...@megafon/ui-core@6.4.3) (2024-10-29)
20
35
 
36
+ **Note:** Version bump only for package @megafon/ui-core
21
37
 
22
38
  ## [6.4.2](/compare/@megafon/ui-core@6.4.1...@megafon/ui-core@6.4.2) (2024-10-21)
23
39
 
@@ -154,6 +154,9 @@
154
154
  bottom: 72px;
155
155
  }
156
156
  }
157
+ .mfui-v6-banner_margin-top {
158
+ margin-top: 24px;
159
+ }
157
160
  .mfui-v6-banner_radius_rounded .mfui-v6-banner__swiper {
158
161
  border-radius: 24px;
159
162
  }
@@ -69,6 +69,8 @@ export interface IBannerProps {
69
69
  noIncreaseAutoplayDelay?: boolean;
70
70
  /** Показать часть следующего слайда */
71
71
  showNextSlide?: boolean;
72
+ /** Отступ сверху */
73
+ hasMarginTop?: boolean;
72
74
  /** Ref на swiper */
73
75
  getSwiper?: (instance: SwiperCore) => void;
74
76
  /** Обработчик клика по стрелке "вперед" (должен быть обернут в useCallback) */
@@ -66,6 +66,8 @@ var Banner = function Banner(_ref) {
66
66
  autoHeight = _ref$autoHeight === void 0 ? false : _ref$autoHeight,
67
67
  noIncreaseAutoplayDelay = _ref.noIncreaseAutoplayDelay,
68
68
  showNextSlide = _ref.showNextSlide,
69
+ _ref$hasMarginTop = _ref.hasMarginTop,
70
+ hasMarginTop = _ref$hasMarginTop === void 0 ? false : _ref$hasMarginTop,
69
71
  _ref$children = _ref.children,
70
72
  children = _ref$children === void 0 ? [] : _ref$children,
71
73
  getSwiper = _ref.getSwiper,
@@ -268,7 +270,8 @@ var Banner = function Banner(_ref) {
268
270
  'background-color': backgroundColor,
269
271
  'no-touch': !isTouch,
270
272
  radius: radius,
271
- 'show-next-slide': showNextSlide
273
+ 'show-next-slide': showNextSlide,
274
+ 'margin-top': hasMarginTop
272
275
  }, className),
273
276
  ref: rootRef
274
277
  }), /*#__PURE__*/React.createElement("div", {
@@ -330,6 +333,7 @@ Banner.propTypes = {
330
333
  noIncreaseAutoplayDelay: PropTypes.bool,
331
334
  showNextSlide: PropTypes.bool,
332
335
  getSwiper: PropTypes.func,
336
+ hasMarginTop: PropTypes.bool,
333
337
  onNextClick: PropTypes.func,
334
338
  onPrevClick: PropTypes.func,
335
339
  onDotClick: PropTypes.func,
@@ -5,16 +5,15 @@
5
5
  }
6
6
  .mfui-v6-calendar_modern {
7
7
  display: block;
8
- width: 364px;
8
+ width: 100%;
9
9
  height: 304px;
10
10
  overflow-x: hidden;
11
11
  overflow-y: scroll;
12
12
  }
13
13
  .mfui-v6-calendar_modern::-webkit-scrollbar {
14
- width: 16px;
14
+ width: 4px;
15
15
  }
16
16
  .mfui-v6-calendar_modern::-webkit-scrollbar-thumb {
17
- border: 6px solid transparent;
18
17
  border-radius: 16px;
19
18
  background-color: #D8D8D8;
20
19
  background-clip: padding-box;
@@ -366,14 +366,14 @@ var Calendar = function Calendar(_ref) {
366
366
  var isNextMonthDisabled = !!maxBookingDate && isSameMonth(new Date(year, month, 1), maxBookingDate);
367
367
  var isCurrentMonth = new Date().getFullYear() === year && new Date().getMonth() === month;
368
368
  return /*#__PURE__*/React.createElement("div", {
369
- ref: isCurrentMonth ? currentMonthRef : null
369
+ ref: isCurrentMonth ? currentMonthRef : null,
370
+ key: "".concat(year, "-").concat(month)
370
371
  }, /*#__PURE__*/React.createElement(Month, {
371
372
  dataAttrs: {
372
373
  root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.month,
373
374
  arrowLeft: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowLeft,
374
375
  arrowRight: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowRight
375
376
  },
376
- key: "".concat(year, "-").concat(month),
377
377
  year: year,
378
378
  weekdayLabels: weekdayLabels,
379
379
  monthLabel: monthLabel,
@@ -45,7 +45,10 @@
45
45
  width: 38px;
46
46
  height: 38px;
47
47
  }
48
- .mfui-v6-day_active-modern:hover:after {
48
+ .mfui-v6-day_active-modern:hover:after,
49
+ .mfui-v6-day_active-modern:focus:after {
50
+ width: 38px !important;
51
+ height: 38px !important;
49
52
  background-color: var(--brandGreen) !important;
50
53
  }
51
54
  .mfui-v6-day:not(:disabled):not(.mfui-v6-day_active):hover:after {
@@ -67,7 +70,7 @@
67
70
  .mfui-v6-day:not(:disabled):not(.mfui-v6-day_active):focus {
68
71
  color: var(--stcWhite);
69
72
  }
70
- .mfui-v6-day_active + .mfui-v6-day_active:before,
73
+ .mfui-v6-day_active + .mfui-v6-day:not(.mfui-v6-day_monday).mfui-v6-day_active:before,
71
74
  .mfui-v6-day_between:hover + .mfui-v6-day:not(.mfui-v6-day_monday).mfui-v6-day_active:before {
72
75
  content: '';
73
76
  position: absolute;
@@ -137,7 +140,7 @@
137
140
  z-index: 99;
138
141
  }
139
142
  .mfui-v6-day_modern {
140
- width: 38.29px;
143
+ width: 100%;
141
144
  height: 38px;
142
145
  }
143
146
  .mfui-v6-day_modern:not(:disabled):not(.mfui-v6-day_modern_active-modern):hover:after,
@@ -166,7 +169,7 @@
166
169
  .mfui-v6-day:not(:disabled):focus {
167
170
  color: var(--stcWhite);
168
171
  }
169
- .mfui-v6-day_active-modern + .mfui-v6-day_active-modern:before,
172
+ .mfui-v6-day_active-modern + .mfui-v6-day:not(.mfui-v6-day_monday-modern).mfui-v6-day_active-modern:before,
170
173
  .mfui-v6-day_between-modern:hover + .mfui-v6-day:not(.mfui-v6-day_monday-modern).mfui-v6-day_active-modern:before {
171
174
  content: '';
172
175
  position: absolute;
@@ -186,7 +189,7 @@
186
189
  content: '';
187
190
  position: absolute;
188
191
  top: 0;
189
- left: -28px;
192
+ left: -20px;
190
193
  z-index: -1;
191
194
  display: block;
192
195
  height: 38px;
@@ -197,7 +200,7 @@
197
200
  content: '';
198
201
  position: absolute;
199
202
  top: 0;
200
- right: -18px;
203
+ right: -12px;
201
204
  z-index: -1;
202
205
  display: block;
203
206
  width: 45px;
@@ -210,7 +213,7 @@
210
213
  }
211
214
  .mfui-v6-day_sunday-modern:before,
212
215
  .mfui-v6-day_last-modern:before {
213
- padding-left: 20px;
216
+ padding-left: 8px;
214
217
  }
215
218
  .mfui-v6-day_sunday-modern:after,
216
219
  .mfui-v6-day_last-modern:after {
@@ -80,8 +80,8 @@ svg.mfui-v6-month__arrow_disabled {
80
80
  opacity: 0.5;
81
81
  }
82
82
  .mfui-v6-month_modern {
83
- width: 344px;
84
- padding: 0 0 24px;
83
+ width: 100%;
84
+ padding: 0 16px 24px 0;
85
85
  }
86
86
  .mfui-v6-month_modern .mfui-v6-month__header {
87
87
  display: -webkit-box;
@@ -90,7 +90,7 @@ svg.mfui-v6-month__arrow_disabled {
90
90
  -webkit-box-align: center;
91
91
  -ms-flex-align: center;
92
92
  align-items: center;
93
- width: 328px;
93
+ width: 100%;
94
94
  margin-bottom: 16px;
95
95
  text-transform: capitalize;
96
96
  }
@@ -105,7 +105,7 @@ svg.mfui-v6-month__arrow_disabled {
105
105
  .mfui-v6-month_modern .mfui-v6-month__weekday-labels {
106
106
  display: grid;
107
107
  grid-template-columns: repeat(7, 1fr);
108
- width: 328px;
108
+ width: 100%;
109
109
  padding-bottom: 0;
110
110
  border-bottom: none;
111
111
  -webkit-column-gap: 8px;
@@ -126,7 +126,7 @@ svg.mfui-v6-month__arrow_disabled {
126
126
  .mfui-v6-month_modern .mfui-v6-month__days {
127
127
  display: grid;
128
128
  grid-template-columns: repeat(7, 1fr);
129
- width: 328px;
129
+ width: 100%;
130
130
  margin-top: 10px;
131
131
  -webkit-column-gap: 0;
132
132
  -moz-column-gap: 0;
@@ -130,7 +130,7 @@
130
130
  color: var(--content);
131
131
  font-size: 100%;
132
132
  font-family: inherit;
133
- line-height: 25px;
133
+ line-height: 24px;
134
134
  background-color: transparent;
135
135
  outline: none;
136
136
  -webkit-box-shadow: none;
@@ -140,6 +140,7 @@
140
140
  -webkit-appearance: none;
141
141
  -moz-appearance: none;
142
142
  appearance: none;
143
+ resize: none;
143
144
  caret-color: var(--brandGreen);
144
145
  }
145
146
  @media screen and (max-width: 767px) {
@@ -153,8 +154,10 @@
153
154
  display: block;
154
155
  overflow: auto;
155
156
  color: var(--spbSky3);
156
- -webkit-transition-duration: 0.2s, 0.01s;
157
- transition-duration: 0.2s, 0.01s;
157
+ -webkit-transition: scale 0.5s, top 0.01s, -webkit-transform 0.5s;
158
+ transition: scale 0.5s, top 0.01s, -webkit-transform 0.5s;
159
+ transition: transform 0.5s, scale 0.5s, top 0.01s;
160
+ transition: transform 0.5s, scale 0.5s, top 0.01s, -webkit-transform 0.5s;
158
161
  pointer-events: none;
159
162
  font-family: inherit;
160
163
  font-size: 15px;
@@ -338,6 +341,7 @@
338
341
  border-radius: 12px;
339
342
  background-color: var(--base);
340
343
  }
344
+ .mfui-v6-search_type_textfield .mfui-v6-search__control_focused,
341
345
  .mfui-v6-search_type_textfield .mfui-v6-search__control:hover {
342
346
  border-color: var(--content);
343
347
  }
@@ -348,15 +352,54 @@
348
352
  .mfui-v6-search_type_textfield .mfui-v6-search__field:focus + .mfui-v6-search__label {
349
353
  -webkit-transform: scale(0.8) translate(-12.5%, -75%);
350
354
  transform: scale(0.8) translate(-12.5%, -75%);
355
+ -webkit-transition: scale 0.2s, top 0.01s, -webkit-transform 0.2s;
356
+ transition: scale 0.2s, top 0.01s, -webkit-transform 0.2s;
357
+ transition: transform 0.2s, scale 0.2s, top 0.01s;
358
+ transition: transform 0.2s, scale 0.2s, top 0.01s, -webkit-transform 0.2s;
351
359
  }
352
360
  .mfui-v6-search_type_textfield .mfui-v6-search__field_labeled {
353
- padding-top: 22px;
361
+ padding-top: 25px;
362
+ padding-bottom: 9px;
354
363
  }
355
364
  .mfui-v6-search_type_textfield .mfui-v6-search__submit-icon {
356
365
  width: 32px;
357
366
  height: 32px;
358
367
  fill: var(--content);
359
368
  }
369
+ .mfui-v6-search_textarea .mfui-v6-search__control {
370
+ height: auto;
371
+ min-height: 60px;
372
+ }
373
+ .mfui-v6-search_textarea .mfui-v6-search__field {
374
+ -webkit-box-sizing: content-box;
375
+ box-sizing: content-box;
376
+ max-height: 204px;
377
+ padding-top: 17px;
378
+ padding-bottom: 9px;
379
+ scrollbar-width: thin;
380
+ scrollbar-color: var(--spbSky2) transparent;
381
+ }
382
+ .mfui-v6-search_textarea .mfui-v6-search__field_labeled {
383
+ padding-top: 25px;
384
+ padding-bottom: 9px;
385
+ }
386
+ .mfui-v6-search_textarea .mfui-v6-search__icons {
387
+ height: 58px;
388
+ margin-left: 8px;
389
+ }
390
+ .mfui-v6-search_textarea .mfui-v6-search__field_resized {
391
+ -webkit-transition: height 0.1s;
392
+ transition: height 0.1s;
393
+ will-change: height;
394
+ }
395
+ .mfui-v6-search__textarea-wrapper {
396
+ position: relative;
397
+ -webkit-box-flex: 1;
398
+ -ms-flex-positive: 1;
399
+ flex-grow: 1;
400
+ width: 100%;
401
+ overflow: hidden;
402
+ }
360
403
  .mfui-v6-search_type_textfield.mfui-v6-search_disabled .mfui-v6-search__control {
361
404
  border-color: var(--spbSky1);
362
405
  background-color: var(--spbSky1);
@@ -451,3 +494,32 @@
451
494
  .mfui-v6-search_success .mfui-v6-search__control {
452
495
  border-color: var(--brandGreen);
453
496
  }
497
+ .mfui-v6-search__resizer {
498
+ position: absolute;
499
+ right: 0;
500
+ bottom: 0;
501
+ display: -webkit-box;
502
+ display: -ms-flexbox;
503
+ display: flex;
504
+ -webkit-box-align: center;
505
+ -ms-flex-align: center;
506
+ align-items: center;
507
+ -webkit-box-pack: center;
508
+ -ms-flex-pack: center;
509
+ justify-content: center;
510
+ -webkit-box-sizing: content-box;
511
+ box-sizing: content-box;
512
+ width: 12px;
513
+ height: 12px;
514
+ padding: 4px;
515
+ cursor: ns-resize;
516
+ }
517
+ .mfui-v6-search__resizer svg {
518
+ -webkit-transition: stroke 0.3s;
519
+ transition: stroke 0.3s;
520
+ stroke: var(--spbSky2);
521
+ }
522
+ .mfui-v6-search__resizer:hover svg,
523
+ .mfui-v6-search__resizer:active svg {
524
+ stroke: var(--spbSky3);
525
+ }
@@ -1,5 +1,10 @@
1
1
  import React from 'react';
2
2
  import './Search.less';
3
+ export declare const MinTextareaHeight: {
4
+ readonly ONE_ROW: 24;
5
+ readonly THREE_ROWS: number;
6
+ };
7
+ declare type MinTextareaHeightType = typeof MinTextareaHeight[keyof typeof MinTextareaHeight];
3
8
  export declare const Verification: {
4
9
  readonly VALID: "valid";
5
10
  readonly ERROR: "error";
@@ -40,11 +45,14 @@ export interface ISearchProps {
40
45
  notice?: Record<string, string>;
41
46
  popularItem?: Record<string, string>;
42
47
  clearButton?: Record<string, string>;
48
+ resizer?: Record<string, string>;
43
49
  };
44
50
  /** Значение */
45
51
  value?: string;
46
52
  /** Вид отображения */
47
53
  type?: 'textfield' | 'compact';
54
+ /** Включить режим textarea */
55
+ textarea?: boolean;
48
56
  /** Заголовок поля */
49
57
  label?: string;
50
58
  /** HTML идентификатор поля поиска */
@@ -78,6 +86,7 @@ export interface ISearchProps {
78
86
  textNotFound?: string;
79
87
  popularTitle?: string;
80
88
  popularItem?: string;
89
+ resizer?: string;
81
90
  };
82
91
  /** Отображение загрузки */
83
92
  showLoader?: boolean;
@@ -91,14 +100,18 @@ export interface ISearchProps {
91
100
  popularTitle?: string;
92
101
  /** Ссылка на элемент списка с результатами */
93
102
  listRef?: React.Ref<HTMLDivElement>;
103
+ /** Минимальная высота textarea, px */
104
+ minTextareaHeight?: MinTextareaHeightType;
105
+ /** Показать хендлер для ресайза текстового поля */
106
+ showResizer?: boolean;
94
107
  /** Обработчик изменения поля */
95
108
  onChange?: (value: string) => void;
96
109
  /** Обработчик нажатия на enter */
97
110
  onSubmit?: (value: string) => void;
98
111
  /** Обработчик выхода из фокуса */
99
- onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
112
+ onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
100
113
  /** Обработчик входа в фокус */
101
- onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
114
+ onFocus?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
102
115
  /** Обработчик нажатия на популярный элемент */
103
116
  onPopularItemClick?: (popularItemValue?: string) => void;
104
117
  }