@megafon/ui-core 6.8.0 → 6.9.1
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.
|
@@ -69,6 +69,8 @@ export interface ISearchProps {
|
|
|
69
69
|
verification?: VerificationType;
|
|
70
70
|
/** Дополнительный текст под полем. Свойство verification влияет на цвет текста. */
|
|
71
71
|
noticeText?: string | JSX.Element;
|
|
72
|
+
/** Максимальное вводимое количество текста */
|
|
73
|
+
maxLength?: number;
|
|
72
74
|
/** Отключение поля ввода */
|
|
73
75
|
disabled?: boolean;
|
|
74
76
|
/** Делает поле обязательным */
|
|
@@ -92,6 +92,7 @@ var Search = function Search(_ref) {
|
|
|
92
92
|
disabled = _ref.disabled,
|
|
93
93
|
required = _ref.required,
|
|
94
94
|
noticeText = _ref.noticeText,
|
|
95
|
+
maxLength = _ref.maxLength,
|
|
95
96
|
className = _ref.className,
|
|
96
97
|
classes = _ref.classes,
|
|
97
98
|
_ref$type = _ref.type,
|
|
@@ -375,8 +376,15 @@ var Search = function Search(_ref) {
|
|
|
375
376
|
};
|
|
376
377
|
|
|
377
378
|
React.useEffect(function () {
|
|
379
|
+
return setSearchQuery(value);
|
|
380
|
+
}, [value]);
|
|
381
|
+
React.useEffect(function () {
|
|
382
|
+
if (value !== searchQuery) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
378
386
|
textareaResize();
|
|
379
|
-
}, [textareaResize]);
|
|
387
|
+
}, [searchQuery, value, textareaResize]);
|
|
380
388
|
React.useEffect(function () {
|
|
381
389
|
if (!resizerRef.current || !isTextarea || !showResizer) {
|
|
382
390
|
return;
|
|
@@ -418,9 +426,6 @@ var Search = function Search(_ref) {
|
|
|
418
426
|
resizerRef.current.addEventListener('mousedown', handleStartResize);
|
|
419
427
|
resizerRef.current.addEventListener('touchstart', handleStartResize);
|
|
420
428
|
}, [isTextarea, minTextareaHeight, showResizer]);
|
|
421
|
-
React.useEffect(function () {
|
|
422
|
-
return setSearchQuery(value);
|
|
423
|
-
}, [value]);
|
|
424
429
|
React.useEffect(function () {
|
|
425
430
|
debouncedOnChange.current = debounce(function (inputValue) {
|
|
426
431
|
return onChange && onChange(inputValue);
|
|
@@ -565,6 +570,7 @@ var Search = function Search(_ref) {
|
|
|
565
570
|
}, [classes === null || classes === void 0 ? void 0 : classes.input]),
|
|
566
571
|
placeholder: placeholder,
|
|
567
572
|
value: searchQuery,
|
|
573
|
+
maxLength: maxLength,
|
|
568
574
|
onChange: handleChange,
|
|
569
575
|
onFocus: handleFocus,
|
|
570
576
|
onBlur: handleBlur,
|
|
@@ -591,6 +597,7 @@ var Search = function Search(_ref) {
|
|
|
591
597
|
},
|
|
592
598
|
placeholder: placeholder,
|
|
593
599
|
value: searchQuery,
|
|
600
|
+
maxLength: maxLength,
|
|
594
601
|
onChange: handleChange,
|
|
595
602
|
onFocus: handleFocus,
|
|
596
603
|
onBlur: handleBlur,
|
|
@@ -656,6 +663,7 @@ Search.propTypes = {
|
|
|
656
663
|
changeDelay: PropTypes.number,
|
|
657
664
|
verification: PropTypes.oneOf(['valid', 'error']),
|
|
658
665
|
noticeText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
666
|
+
maxLength: PropTypes.number,
|
|
659
667
|
disabled: PropTypes.bool,
|
|
660
668
|
required: PropTypes.bool,
|
|
661
669
|
className: PropTypes.string,
|
|
@@ -69,6 +69,8 @@ export interface ISearchProps {
|
|
|
69
69
|
verification?: VerificationType;
|
|
70
70
|
/** Дополнительный текст под полем. Свойство verification влияет на цвет текста. */
|
|
71
71
|
noticeText?: string | JSX.Element;
|
|
72
|
+
/** Максимальное вводимое количество текста */
|
|
73
|
+
maxLength?: number;
|
|
72
74
|
/** Отключение поля ввода */
|
|
73
75
|
disabled?: boolean;
|
|
74
76
|
/** Делает поле обязательным */
|
|
@@ -128,6 +128,7 @@ var Search = function Search(_ref) {
|
|
|
128
128
|
disabled = _ref.disabled,
|
|
129
129
|
required = _ref.required,
|
|
130
130
|
noticeText = _ref.noticeText,
|
|
131
|
+
maxLength = _ref.maxLength,
|
|
131
132
|
className = _ref.className,
|
|
132
133
|
classes = _ref.classes,
|
|
133
134
|
_ref$type = _ref.type,
|
|
@@ -432,8 +433,16 @@ var Search = function Search(_ref) {
|
|
|
432
433
|
};
|
|
433
434
|
|
|
434
435
|
_react["default"].useEffect(function () {
|
|
436
|
+
return setSearchQuery(value);
|
|
437
|
+
}, [value]);
|
|
438
|
+
|
|
439
|
+
_react["default"].useEffect(function () {
|
|
440
|
+
if (value !== searchQuery) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
|
|
435
444
|
textareaResize();
|
|
436
|
-
}, [textareaResize]);
|
|
445
|
+
}, [searchQuery, value, textareaResize]);
|
|
437
446
|
|
|
438
447
|
_react["default"].useEffect(function () {
|
|
439
448
|
if (!resizerRef.current || !isTextarea || !showResizer) {
|
|
@@ -477,10 +486,6 @@ var Search = function Search(_ref) {
|
|
|
477
486
|
resizerRef.current.addEventListener('touchstart', handleStartResize);
|
|
478
487
|
}, [isTextarea, minTextareaHeight, showResizer]);
|
|
479
488
|
|
|
480
|
-
_react["default"].useEffect(function () {
|
|
481
|
-
return setSearchQuery(value);
|
|
482
|
-
}, [value]);
|
|
483
|
-
|
|
484
489
|
_react["default"].useEffect(function () {
|
|
485
490
|
debouncedOnChange.current = (0, _lodash["default"])(function (inputValue) {
|
|
486
491
|
return onChange && onChange(inputValue);
|
|
@@ -628,6 +633,7 @@ var Search = function Search(_ref) {
|
|
|
628
633
|
}, [classes === null || classes === void 0 ? void 0 : classes.input]),
|
|
629
634
|
placeholder: placeholder,
|
|
630
635
|
value: searchQuery,
|
|
636
|
+
maxLength: maxLength,
|
|
631
637
|
onChange: handleChange,
|
|
632
638
|
onFocus: handleFocus,
|
|
633
639
|
onBlur: handleBlur,
|
|
@@ -655,6 +661,7 @@ var Search = function Search(_ref) {
|
|
|
655
661
|
},
|
|
656
662
|
placeholder: placeholder,
|
|
657
663
|
value: searchQuery,
|
|
664
|
+
maxLength: maxLength,
|
|
658
665
|
onChange: handleChange,
|
|
659
666
|
onFocus: handleFocus,
|
|
660
667
|
onBlur: handleBlur,
|
|
@@ -721,6 +728,7 @@ Search.propTypes = {
|
|
|
721
728
|
changeDelay: PropTypes.number,
|
|
722
729
|
verification: PropTypes.oneOf(['valid', 'error']),
|
|
723
730
|
noticeText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
731
|
+
maxLength: PropTypes.number,
|
|
724
732
|
disabled: PropTypes.bool,
|
|
725
733
|
required: PropTypes.bool,
|
|
726
734
|
className: PropTypes.string,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.9.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"styles"
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"react-popper": "^2.2.3",
|
|
100
100
|
"swiper": "^6.5.6"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "7dd1739619a676bfce199986dfc728c92e5610e4"
|
|
103
103
|
}
|