@alfalab/core-components-input-autocomplete 11.1.0 → 11.2.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/autocomplete-field/Component.js +1 -1
- package/autocomplete-field/index.css +2 -2
- package/autocomplete-mobile-field/Component.js +1 -1
- package/autocomplete-mobile-field/index.css +8 -8
- package/cssm/mobile/Component.mobile.d.ts +2 -0
- package/cssm/mobile/Component.mobile.js +7 -4
- package/cssm/mobile/Component.modal.mobile.d.ts +2 -0
- package/cssm/types.d.ts +8 -0
- package/esm/autocomplete-field/Component.js +1 -1
- package/esm/autocomplete-field/index.css +2 -2
- package/esm/autocomplete-mobile-field/Component.js +1 -1
- package/esm/autocomplete-mobile-field/index.css +8 -8
- package/esm/mobile/Component.mobile.d.ts +2 -0
- package/esm/mobile/Component.mobile.js +8 -5
- package/esm/mobile/Component.modal.mobile.d.ts +2 -0
- package/esm/mobile/mobile.css +2 -2
- package/esm/types.d.ts +8 -0
- package/mobile/Component.mobile.d.ts +2 -0
- package/mobile/Component.mobile.js +8 -5
- package/mobile/Component.modal.mobile.d.ts +2 -0
- package/mobile/mobile.css +2 -2
- package/modern/autocomplete-field/Component.js +1 -1
- package/modern/autocomplete-field/index.css +2 -2
- package/modern/autocomplete-mobile-field/Component.js +1 -1
- package/modern/autocomplete-mobile-field/index.css +8 -8
- package/modern/mobile/Component.mobile.d.ts +2 -0
- package/modern/mobile/Component.mobile.js +8 -5
- package/modern/mobile/Component.modal.mobile.d.ts +2 -0
- package/modern/mobile/mobile.css +2 -2
- package/modern/types.d.ts +8 -0
- package/package.json +1 -1
- package/src/mobile/Component.mobile.tsx +8 -4
- package/src/types.ts +10 -0
- package/types.d.ts +8 -0
|
@@ -14,7 +14,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
14
14
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
15
15
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
16
16
|
|
|
17
|
-
var styles = {"arrow":"input-
|
|
17
|
+
var styles = {"arrow":"input-autocomplete__arrow_1ohhy","error":"input-autocomplete__error_1ohhy"};
|
|
18
18
|
require('./index.css')
|
|
19
19
|
|
|
20
20
|
var AutocompleteField = function (_a) {
|
|
@@ -15,7 +15,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
16
16
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
17
17
|
|
|
18
|
-
var styles = {"component":"input-
|
|
18
|
+
var styles = {"component":"input-autocomplete__component_zrg4l","field":"input-autocomplete__field_zrg4l","disabled":"input-autocomplete__disabled_zrg4l","placeholder":"input-autocomplete__placeholder_zrg4l","contentWrapper":"input-autocomplete__contentWrapper_zrg4l","value":"input-autocomplete__value_zrg4l","focusVisible":"input-autocomplete__focusVisible_zrg4l"};
|
|
19
19
|
require('./index.css')
|
|
20
20
|
|
|
21
21
|
var AutocompleteMobileField = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1vqlc */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #2288fa;
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
} :root {
|
|
19
19
|
--focus-color: var(--color-light-border-link);
|
|
20
20
|
--disabled-cursor: not-allowed;
|
|
21
|
-
} .input-
|
|
21
|
+
} .input-autocomplete__component_zrg4l {
|
|
22
22
|
width: 100%;
|
|
23
23
|
outline: none;
|
|
24
|
-
} .input-
|
|
24
|
+
} .input-autocomplete__field_zrg4l:not(.input-autocomplete__disabled_zrg4l) {
|
|
25
25
|
cursor: pointer;
|
|
26
|
-
} .input-
|
|
26
|
+
} .input-autocomplete__disabled_zrg4l {
|
|
27
27
|
cursor: var(--disabled-cursor);
|
|
28
|
-
} .input-
|
|
28
|
+
} .input-autocomplete__placeholder_zrg4l {
|
|
29
29
|
color: var(--color-light-text-secondary);
|
|
30
|
-
} .input-
|
|
30
|
+
} .input-autocomplete__contentWrapper_zrg4l {
|
|
31
31
|
font-size: 16px;
|
|
32
32
|
line-height: 20px;
|
|
33
33
|
font-weight: 400;
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
text-overflow: ellipsis;
|
|
37
37
|
overflow: hidden;
|
|
38
38
|
width: 100%;
|
|
39
|
-
} .input-
|
|
39
|
+
} .input-autocomplete__value_zrg4l {
|
|
40
40
|
overflow: hidden;
|
|
41
41
|
text-overflow: ellipsis;
|
|
42
42
|
text-align: left;
|
|
43
|
-
} .input-
|
|
43
|
+
} .input-autocomplete__focusVisible_zrg4l {
|
|
44
44
|
outline: 2px solid var(--focus-color);
|
|
45
45
|
outline-offset: 2px;
|
|
46
46
|
}
|
|
@@ -4,5 +4,7 @@ import React from 'react';
|
|
|
4
4
|
declare const InputAutocompleteMobile: React.ForwardRefExoticComponent<import("../types").InputAutocompleteCommonProps & {
|
|
5
5
|
isBottomSheet?: boolean | undefined;
|
|
6
6
|
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
7
|
+
onApply?: (() => void) | undefined;
|
|
8
|
+
onCancel?: (() => void) | undefined;
|
|
7
9
|
} & React.RefAttributes<unknown>>;
|
|
8
10
|
export { InputAutocompleteMobile };
|
|
@@ -29,7 +29,7 @@ var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
|
29
29
|
var InputAutocompleteMobile = React__default.default.forwardRef(function (_a, ref) {
|
|
30
30
|
var _b;
|
|
31
31
|
var _c;
|
|
32
|
-
var Input = _a.Input, value = _a.value, name = _a.name, _d = _a.Arrow, Arrow = _d === void 0 ? null : _d, label = _a.label, _e = _a.placeholder, placeholder = _e === void 0 ? '' : _e, _f = _a.size, size = _f === void 0 ? 's' : _f, openProp = _a.open, onInput = _a.onInput, onOpen = _a.onOpen, multiple = _a.multiple, inputProps = _a.inputProps, _g = _a.isBottomSheet, isBottomSheet = _g === void 0 ? true : _g, dataTestId = _a.dataTestId, transitionProps = _a.transitionProps, restProps = tslib.__rest(_a, ["Input", "value", "name", "Arrow", "label", "placeholder", "size", "open", "onInput", "onOpen", "multiple", "inputProps", "isBottomSheet", "dataTestId", "transitionProps"]);
|
|
32
|
+
var Input = _a.Input, value = _a.value, name = _a.name, _d = _a.Arrow, Arrow = _d === void 0 ? null : _d, label = _a.label, _e = _a.placeholder, placeholder = _e === void 0 ? '' : _e, _f = _a.size, size = _f === void 0 ? 's' : _f, openProp = _a.open, onInput = _a.onInput, onOpen = _a.onOpen, multiple = _a.multiple, inputProps = _a.inputProps, _g = _a.isBottomSheet, isBottomSheet = _g === void 0 ? true : _g, dataTestId = _a.dataTestId, transitionProps = _a.transitionProps, onCancel = _a.onCancel, onApply = _a.onApply, restProps = tslib.__rest(_a, ["Input", "value", "name", "Arrow", "label", "placeholder", "size", "open", "onInput", "onOpen", "multiple", "inputProps", "isBottomSheet", "dataTestId", "transitionProps", "onCancel", "onApply"]);
|
|
33
33
|
var _h = React.useState(false), open = _h[0], setOpen = _h[1];
|
|
34
34
|
var frozenValue = React.useRef('');
|
|
35
35
|
var searchInputRef = React.useRef(null);
|
|
@@ -55,12 +55,15 @@ var InputAutocompleteMobile = React__default.default.forwardRef(function (_a, re
|
|
|
55
55
|
}
|
|
56
56
|
}, 300);
|
|
57
57
|
}, []);
|
|
58
|
-
var handleApply = function () {
|
|
58
|
+
var handleApply = function () {
|
|
59
|
+
setModalVisibility(false);
|
|
60
|
+
onApply === null || onApply === void 0 ? void 0 : onApply();
|
|
61
|
+
};
|
|
59
62
|
var handleCancel = function () {
|
|
60
63
|
setModalVisibility(false);
|
|
61
64
|
restorePrevValue();
|
|
65
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
62
66
|
};
|
|
63
|
-
var handleClear = function () { return onInput === null || onInput === void 0 ? void 0 : onInput(null, { value: '' }); };
|
|
64
67
|
var handleExiting = function (node) {
|
|
65
68
|
var _a, _b;
|
|
66
69
|
(_a = targetRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -84,7 +87,7 @@ var InputAutocompleteMobile = React__default.default.forwardRef(function (_a, re
|
|
|
84
87
|
value: value,
|
|
85
88
|
filterFn: utils.searchFilterStub,
|
|
86
89
|
componentProps: tslib.__assign(tslib.__assign({ leftAddons: null, placeholder: placeholder }, inputProps), { className: cn__default.default(styles__default.default.input, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className), clear: clear, ref: mergeRefs__default.default([searchInputRef, inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref]), onChange: onInput }),
|
|
87
|
-
}, Search: Input, ref: mergeRefs__default.default([targetRef, ref]), open: isOpen, onOpen: handleOpen, Arrow: Arrow, placeholder: placeholder, label: label, size: size, name: name, multiple: multiple, optionsListProps: tslib.__assign({ footer: (React__default.default.createElement(shared.Footer, { showClear: true, handleClear: handleCancel, handleApply: handleApply, clearText: '\u041E\u0442\u043C\u0435\u043D\u0430', applyText: '\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C', dataTestId: dataTestId })) }, restProps.optionsListProps), fieldProps: tslib.__assign({ value: isOpen ? frozenValue.current : value, clear: clear, onClear: clear ?
|
|
90
|
+
}, Search: Input, ref: mergeRefs__default.default([targetRef, ref]), open: isOpen, onOpen: handleOpen, Arrow: Arrow, placeholder: placeholder, label: label, size: size, name: name, multiple: multiple, optionsListProps: tslib.__assign({ footer: (React__default.default.createElement(shared.Footer, { showClear: true, handleClear: handleCancel, handleApply: handleApply, clearText: '\u041E\u0442\u043C\u0435\u043D\u0430', applyText: '\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C', dataTestId: dataTestId })) }, restProps.optionsListProps), fieldProps: tslib.__assign({ value: isOpen ? frozenValue.current : value, clear: clear, onClear: clear ? inputProps === null || inputProps === void 0 ? void 0 : inputProps.onClear : undefined }, restProps.fieldProps) })));
|
|
88
91
|
});
|
|
89
92
|
|
|
90
93
|
exports.InputAutocompleteMobile = InputAutocompleteMobile;
|
|
@@ -4,5 +4,7 @@ import React from 'react';
|
|
|
4
4
|
declare const InputAutocompleteModalMobile: React.ForwardRefExoticComponent<import("../types").InputAutocompleteCommonProps & {
|
|
5
5
|
isBottomSheet?: boolean | undefined;
|
|
6
6
|
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
7
|
+
onApply?: (() => void) | undefined;
|
|
8
|
+
onCancel?: (() => void) | undefined;
|
|
7
9
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
10
|
export { InputAutocompleteModalMobile };
|
package/cssm/types.d.ts
CHANGED
|
@@ -38,6 +38,14 @@ type MobileProps = {
|
|
|
38
38
|
* Пропсы анимации контента (CSSTransition)
|
|
39
39
|
*/
|
|
40
40
|
transitionProps?: NonNullable<BottomSheetSelectMobileProps['bottomSheetProps']>['transitionProps'];
|
|
41
|
+
/**
|
|
42
|
+
* Клик на кнопку "Применить"
|
|
43
|
+
*/
|
|
44
|
+
onApply?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Клик на кнопку "Отмена"
|
|
47
|
+
*/
|
|
48
|
+
onCancel?: () => void;
|
|
41
49
|
};
|
|
42
50
|
type InputAutocompleteMobileProps = InputAutocompleteCommonProps & MobileProps;
|
|
43
51
|
interface InputAutocompleteProps extends InputAutocompleteCommonProps {
|
|
@@ -4,7 +4,7 @@ import mergeRefs from 'react-merge-refs';
|
|
|
4
4
|
import cn from 'classnames';
|
|
5
5
|
import { InputDesktop } from '@alfalab/core-components-input/esm/desktop';
|
|
6
6
|
|
|
7
|
-
var styles = {"arrow":"input-
|
|
7
|
+
var styles = {"arrow":"input-autocomplete__arrow_1ohhy","error":"input-autocomplete__error_1ohhy"};
|
|
8
8
|
require('./index.css')
|
|
9
9
|
|
|
10
10
|
var AutocompleteField = function (_a) {
|
|
@@ -6,7 +6,7 @@ import { ClearButton } from '@alfalab/core-components-input/esm/shared';
|
|
|
6
6
|
import { getDataTestId } from '@alfalab/core-components-shared/esm';
|
|
7
7
|
import { useFocus } from '@alfalab/hooks';
|
|
8
8
|
|
|
9
|
-
var styles = {"component":"input-
|
|
9
|
+
var styles = {"component":"input-autocomplete__component_zrg4l","field":"input-autocomplete__field_zrg4l","disabled":"input-autocomplete__disabled_zrg4l","placeholder":"input-autocomplete__placeholder_zrg4l","contentWrapper":"input-autocomplete__contentWrapper_zrg4l","value":"input-autocomplete__value_zrg4l","focusVisible":"input-autocomplete__focusVisible_zrg4l"};
|
|
10
10
|
require('./index.css')
|
|
11
11
|
|
|
12
12
|
var AutocompleteMobileField = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1vqlc */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #2288fa;
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
} :root {
|
|
19
19
|
--focus-color: var(--color-light-border-link);
|
|
20
20
|
--disabled-cursor: not-allowed;
|
|
21
|
-
} .input-
|
|
21
|
+
} .input-autocomplete__component_zrg4l {
|
|
22
22
|
width: 100%;
|
|
23
23
|
outline: none;
|
|
24
|
-
} .input-
|
|
24
|
+
} .input-autocomplete__field_zrg4l:not(.input-autocomplete__disabled_zrg4l) {
|
|
25
25
|
cursor: pointer;
|
|
26
|
-
} .input-
|
|
26
|
+
} .input-autocomplete__disabled_zrg4l {
|
|
27
27
|
cursor: var(--disabled-cursor);
|
|
28
|
-
} .input-
|
|
28
|
+
} .input-autocomplete__placeholder_zrg4l {
|
|
29
29
|
color: var(--color-light-text-secondary);
|
|
30
|
-
} .input-
|
|
30
|
+
} .input-autocomplete__contentWrapper_zrg4l {
|
|
31
31
|
font-size: 16px;
|
|
32
32
|
line-height: 20px;
|
|
33
33
|
font-weight: 400;
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
text-overflow: ellipsis;
|
|
37
37
|
overflow: hidden;
|
|
38
38
|
width: 100%;
|
|
39
|
-
} .input-
|
|
39
|
+
} .input-autocomplete__value_zrg4l {
|
|
40
40
|
overflow: hidden;
|
|
41
41
|
text-overflow: ellipsis;
|
|
42
42
|
text-align: left;
|
|
43
|
-
} .input-
|
|
43
|
+
} .input-autocomplete__focusVisible_zrg4l {
|
|
44
44
|
outline: 2px solid var(--focus-color);
|
|
45
45
|
outline-offset: 2px;
|
|
46
46
|
}
|
|
@@ -4,5 +4,7 @@ import React from 'react';
|
|
|
4
4
|
declare const InputAutocompleteMobile: React.ForwardRefExoticComponent<import("../types").InputAutocompleteCommonProps & {
|
|
5
5
|
isBottomSheet?: boolean | undefined;
|
|
6
6
|
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
7
|
+
onApply?: (() => void) | undefined;
|
|
8
|
+
onCancel?: (() => void) | undefined;
|
|
7
9
|
} & React.RefAttributes<unknown>>;
|
|
8
10
|
export { InputAutocompleteMobile };
|
|
@@ -12,13 +12,13 @@ import '@alfalab/core-components-input/esm/shared';
|
|
|
12
12
|
import '@alfalab/core-components-shared/esm';
|
|
13
13
|
import '@alfalab/hooks';
|
|
14
14
|
|
|
15
|
-
var styles = {"input":"input-
|
|
15
|
+
var styles = {"input":"input-autocomplete__input_obkwb"};
|
|
16
16
|
require('./mobile.css')
|
|
17
17
|
|
|
18
18
|
var InputAutocompleteMobile = React.forwardRef(function (_a, ref) {
|
|
19
19
|
var _b;
|
|
20
20
|
var _c;
|
|
21
|
-
var Input = _a.Input, value = _a.value, name = _a.name, _d = _a.Arrow, Arrow = _d === void 0 ? null : _d, label = _a.label, _e = _a.placeholder, placeholder = _e === void 0 ? '' : _e, _f = _a.size, size = _f === void 0 ? 's' : _f, openProp = _a.open, onInput = _a.onInput, onOpen = _a.onOpen, multiple = _a.multiple, inputProps = _a.inputProps, _g = _a.isBottomSheet, isBottomSheet = _g === void 0 ? true : _g, dataTestId = _a.dataTestId, transitionProps = _a.transitionProps, restProps = __rest(_a, ["Input", "value", "name", "Arrow", "label", "placeholder", "size", "open", "onInput", "onOpen", "multiple", "inputProps", "isBottomSheet", "dataTestId", "transitionProps"]);
|
|
21
|
+
var Input = _a.Input, value = _a.value, name = _a.name, _d = _a.Arrow, Arrow = _d === void 0 ? null : _d, label = _a.label, _e = _a.placeholder, placeholder = _e === void 0 ? '' : _e, _f = _a.size, size = _f === void 0 ? 's' : _f, openProp = _a.open, onInput = _a.onInput, onOpen = _a.onOpen, multiple = _a.multiple, inputProps = _a.inputProps, _g = _a.isBottomSheet, isBottomSheet = _g === void 0 ? true : _g, dataTestId = _a.dataTestId, transitionProps = _a.transitionProps, onCancel = _a.onCancel, onApply = _a.onApply, restProps = __rest(_a, ["Input", "value", "name", "Arrow", "label", "placeholder", "size", "open", "onInput", "onOpen", "multiple", "inputProps", "isBottomSheet", "dataTestId", "transitionProps", "onCancel", "onApply"]);
|
|
22
22
|
var _h = useState(false), open = _h[0], setOpen = _h[1];
|
|
23
23
|
var frozenValue = useRef('');
|
|
24
24
|
var searchInputRef = useRef(null);
|
|
@@ -44,12 +44,15 @@ var InputAutocompleteMobile = React.forwardRef(function (_a, ref) {
|
|
|
44
44
|
}
|
|
45
45
|
}, 300);
|
|
46
46
|
}, []);
|
|
47
|
-
var handleApply = function () {
|
|
47
|
+
var handleApply = function () {
|
|
48
|
+
setModalVisibility(false);
|
|
49
|
+
onApply === null || onApply === void 0 ? void 0 : onApply();
|
|
50
|
+
};
|
|
48
51
|
var handleCancel = function () {
|
|
49
52
|
setModalVisibility(false);
|
|
50
53
|
restorePrevValue();
|
|
54
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
51
55
|
};
|
|
52
|
-
var handleClear = function () { return onInput === null || onInput === void 0 ? void 0 : onInput(null, { value: '' }); };
|
|
53
56
|
var handleExiting = function (node) {
|
|
54
57
|
var _a, _b;
|
|
55
58
|
(_a = targetRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -73,7 +76,7 @@ var InputAutocompleteMobile = React.forwardRef(function (_a, ref) {
|
|
|
73
76
|
value: value,
|
|
74
77
|
filterFn: searchFilterStub,
|
|
75
78
|
componentProps: __assign(__assign({ leftAddons: null, placeholder: placeholder }, inputProps), { className: cn(styles.input, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className), clear: clear, ref: mergeRefs([searchInputRef, inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref]), onChange: onInput }),
|
|
76
|
-
}, Search: Input, ref: mergeRefs([targetRef, ref]), open: isOpen, onOpen: handleOpen, Arrow: Arrow, placeholder: placeholder, label: label, size: size, name: name, multiple: multiple, optionsListProps: __assign({ footer: (React.createElement(Footer, { showClear: true, handleClear: handleCancel, handleApply: handleApply, clearText: '\u041E\u0442\u043C\u0435\u043D\u0430', applyText: '\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C', dataTestId: dataTestId })) }, restProps.optionsListProps), fieldProps: __assign({ value: isOpen ? frozenValue.current : value, clear: clear, onClear: clear ?
|
|
79
|
+
}, Search: Input, ref: mergeRefs([targetRef, ref]), open: isOpen, onOpen: handleOpen, Arrow: Arrow, placeholder: placeholder, label: label, size: size, name: name, multiple: multiple, optionsListProps: __assign({ footer: (React.createElement(Footer, { showClear: true, handleClear: handleCancel, handleApply: handleApply, clearText: '\u041E\u0442\u043C\u0435\u043D\u0430', applyText: '\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C', dataTestId: dataTestId })) }, restProps.optionsListProps), fieldProps: __assign({ value: isOpen ? frozenValue.current : value, clear: clear, onClear: clear ? inputProps === null || inputProps === void 0 ? void 0 : inputProps.onClear : undefined }, restProps.fieldProps) })));
|
|
77
80
|
});
|
|
78
81
|
|
|
79
82
|
export { InputAutocompleteMobile };
|
|
@@ -4,5 +4,7 @@ import React from 'react';
|
|
|
4
4
|
declare const InputAutocompleteModalMobile: React.ForwardRefExoticComponent<import("../types").InputAutocompleteCommonProps & {
|
|
5
5
|
isBottomSheet?: boolean | undefined;
|
|
6
6
|
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
7
|
+
onApply?: (() => void) | undefined;
|
|
8
|
+
onCancel?: (() => void) | undefined;
|
|
7
9
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
10
|
export { InputAutocompleteModalMobile };
|
package/esm/mobile/mobile.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1kaq4 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
} :root {
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
17
|
-
} .input-
|
|
17
|
+
} .input-autocomplete__input_obkwb {
|
|
18
18
|
width: auto;
|
|
19
19
|
}
|
package/esm/types.d.ts
CHANGED
|
@@ -38,6 +38,14 @@ type MobileProps = {
|
|
|
38
38
|
* Пропсы анимации контента (CSSTransition)
|
|
39
39
|
*/
|
|
40
40
|
transitionProps?: NonNullable<BottomSheetSelectMobileProps['bottomSheetProps']>['transitionProps'];
|
|
41
|
+
/**
|
|
42
|
+
* Клик на кнопку "Применить"
|
|
43
|
+
*/
|
|
44
|
+
onApply?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Клик на кнопку "Отмена"
|
|
47
|
+
*/
|
|
48
|
+
onCancel?: () => void;
|
|
41
49
|
};
|
|
42
50
|
type InputAutocompleteMobileProps = InputAutocompleteCommonProps & MobileProps;
|
|
43
51
|
interface InputAutocompleteProps extends InputAutocompleteCommonProps {
|
|
@@ -4,5 +4,7 @@ import React from 'react';
|
|
|
4
4
|
declare const InputAutocompleteMobile: React.ForwardRefExoticComponent<import("../types").InputAutocompleteCommonProps & {
|
|
5
5
|
isBottomSheet?: boolean | undefined;
|
|
6
6
|
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
7
|
+
onApply?: (() => void) | undefined;
|
|
8
|
+
onCancel?: (() => void) | undefined;
|
|
7
9
|
} & React.RefAttributes<unknown>>;
|
|
8
10
|
export { InputAutocompleteMobile };
|
|
@@ -23,13 +23,13 @@ var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
|
23
23
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
24
24
|
var throttle__default = /*#__PURE__*/_interopDefaultCompat(throttle);
|
|
25
25
|
|
|
26
|
-
var styles = {"input":"input-
|
|
26
|
+
var styles = {"input":"input-autocomplete__input_obkwb"};
|
|
27
27
|
require('./mobile.css')
|
|
28
28
|
|
|
29
29
|
var InputAutocompleteMobile = React__default.default.forwardRef(function (_a, ref) {
|
|
30
30
|
var _b;
|
|
31
31
|
var _c;
|
|
32
|
-
var Input = _a.Input, value = _a.value, name = _a.name, _d = _a.Arrow, Arrow = _d === void 0 ? null : _d, label = _a.label, _e = _a.placeholder, placeholder = _e === void 0 ? '' : _e, _f = _a.size, size = _f === void 0 ? 's' : _f, openProp = _a.open, onInput = _a.onInput, onOpen = _a.onOpen, multiple = _a.multiple, inputProps = _a.inputProps, _g = _a.isBottomSheet, isBottomSheet = _g === void 0 ? true : _g, dataTestId = _a.dataTestId, transitionProps = _a.transitionProps, restProps = tslib.__rest(_a, ["Input", "value", "name", "Arrow", "label", "placeholder", "size", "open", "onInput", "onOpen", "multiple", "inputProps", "isBottomSheet", "dataTestId", "transitionProps"]);
|
|
32
|
+
var Input = _a.Input, value = _a.value, name = _a.name, _d = _a.Arrow, Arrow = _d === void 0 ? null : _d, label = _a.label, _e = _a.placeholder, placeholder = _e === void 0 ? '' : _e, _f = _a.size, size = _f === void 0 ? 's' : _f, openProp = _a.open, onInput = _a.onInput, onOpen = _a.onOpen, multiple = _a.multiple, inputProps = _a.inputProps, _g = _a.isBottomSheet, isBottomSheet = _g === void 0 ? true : _g, dataTestId = _a.dataTestId, transitionProps = _a.transitionProps, onCancel = _a.onCancel, onApply = _a.onApply, restProps = tslib.__rest(_a, ["Input", "value", "name", "Arrow", "label", "placeholder", "size", "open", "onInput", "onOpen", "multiple", "inputProps", "isBottomSheet", "dataTestId", "transitionProps", "onCancel", "onApply"]);
|
|
33
33
|
var _h = React.useState(false), open = _h[0], setOpen = _h[1];
|
|
34
34
|
var frozenValue = React.useRef('');
|
|
35
35
|
var searchInputRef = React.useRef(null);
|
|
@@ -55,12 +55,15 @@ var InputAutocompleteMobile = React__default.default.forwardRef(function (_a, re
|
|
|
55
55
|
}
|
|
56
56
|
}, 300);
|
|
57
57
|
}, []);
|
|
58
|
-
var handleApply = function () {
|
|
58
|
+
var handleApply = function () {
|
|
59
|
+
setModalVisibility(false);
|
|
60
|
+
onApply === null || onApply === void 0 ? void 0 : onApply();
|
|
61
|
+
};
|
|
59
62
|
var handleCancel = function () {
|
|
60
63
|
setModalVisibility(false);
|
|
61
64
|
restorePrevValue();
|
|
65
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
62
66
|
};
|
|
63
|
-
var handleClear = function () { return onInput === null || onInput === void 0 ? void 0 : onInput(null, { value: '' }); };
|
|
64
67
|
var handleExiting = function (node) {
|
|
65
68
|
var _a, _b;
|
|
66
69
|
(_a = targetRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -84,7 +87,7 @@ var InputAutocompleteMobile = React__default.default.forwardRef(function (_a, re
|
|
|
84
87
|
value: value,
|
|
85
88
|
filterFn: utils.searchFilterStub,
|
|
86
89
|
componentProps: tslib.__assign(tslib.__assign({ leftAddons: null, placeholder: placeholder }, inputProps), { className: cn__default.default(styles.input, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className), clear: clear, ref: mergeRefs__default.default([searchInputRef, inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref]), onChange: onInput }),
|
|
87
|
-
}, Search: Input, ref: mergeRefs__default.default([targetRef, ref]), open: isOpen, onOpen: handleOpen, Arrow: Arrow, placeholder: placeholder, label: label, size: size, name: name, multiple: multiple, optionsListProps: tslib.__assign({ footer: (React__default.default.createElement(shared.Footer, { showClear: true, handleClear: handleCancel, handleApply: handleApply, clearText: '\u041E\u0442\u043C\u0435\u043D\u0430', applyText: '\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C', dataTestId: dataTestId })) }, restProps.optionsListProps), fieldProps: tslib.__assign({ value: isOpen ? frozenValue.current : value, clear: clear, onClear: clear ?
|
|
90
|
+
}, Search: Input, ref: mergeRefs__default.default([targetRef, ref]), open: isOpen, onOpen: handleOpen, Arrow: Arrow, placeholder: placeholder, label: label, size: size, name: name, multiple: multiple, optionsListProps: tslib.__assign({ footer: (React__default.default.createElement(shared.Footer, { showClear: true, handleClear: handleCancel, handleApply: handleApply, clearText: '\u041E\u0442\u043C\u0435\u043D\u0430', applyText: '\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C', dataTestId: dataTestId })) }, restProps.optionsListProps), fieldProps: tslib.__assign({ value: isOpen ? frozenValue.current : value, clear: clear, onClear: clear ? inputProps === null || inputProps === void 0 ? void 0 : inputProps.onClear : undefined }, restProps.fieldProps) })));
|
|
88
91
|
});
|
|
89
92
|
|
|
90
93
|
exports.InputAutocompleteMobile = InputAutocompleteMobile;
|
|
@@ -4,5 +4,7 @@ import React from 'react';
|
|
|
4
4
|
declare const InputAutocompleteModalMobile: React.ForwardRefExoticComponent<import("../types").InputAutocompleteCommonProps & {
|
|
5
5
|
isBottomSheet?: boolean | undefined;
|
|
6
6
|
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
7
|
+
onApply?: (() => void) | undefined;
|
|
8
|
+
onCancel?: (() => void) | undefined;
|
|
7
9
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
10
|
export { InputAutocompleteModalMobile };
|
package/mobile/mobile.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1kaq4 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
} :root {
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
17
|
-
} .input-
|
|
17
|
+
} .input-autocomplete__input_obkwb {
|
|
18
18
|
width: auto;
|
|
19
19
|
}
|
|
@@ -3,7 +3,7 @@ import mergeRefs from 'react-merge-refs';
|
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { InputDesktop } from '@alfalab/core-components-input/modern/desktop';
|
|
5
5
|
|
|
6
|
-
const styles = {"arrow":"input-
|
|
6
|
+
const styles = {"arrow":"input-autocomplete__arrow_1ohhy","error":"input-autocomplete__error_1ohhy"};
|
|
7
7
|
require('./index.css')
|
|
8
8
|
|
|
9
9
|
const AutocompleteField = ({ label, labelView = 'inner', placeholder, size, Arrow, Input = InputDesktop, value, error, success, hint, disabled, readOnly, onInput, inputProps = {}, innerProps, }) => {
|
|
@@ -5,7 +5,7 @@ import { ClearButton } from '@alfalab/core-components-input/modern/shared';
|
|
|
5
5
|
import { getDataTestId } from '@alfalab/core-components-shared/modern';
|
|
6
6
|
import { useFocus } from '@alfalab/hooks';
|
|
7
7
|
|
|
8
|
-
const styles = {"component":"input-
|
|
8
|
+
const styles = {"component":"input-autocomplete__component_zrg4l","field":"input-autocomplete__field_zrg4l","disabled":"input-autocomplete__disabled_zrg4l","placeholder":"input-autocomplete__placeholder_zrg4l","contentWrapper":"input-autocomplete__contentWrapper_zrg4l","value":"input-autocomplete__value_zrg4l","focusVisible":"input-autocomplete__focusVisible_zrg4l"};
|
|
9
9
|
require('./index.css')
|
|
10
10
|
|
|
11
11
|
const AutocompleteMobileField = ({ size = 'm', open, disabled, value, innerProps, dataTestId, fieldClassName, labelView = 'inner', placeholder, Arrow, valueRenderer, toggleMenu, setSelectedItems, selectedMultiple, FormControlComponent, rightAddons, error, readOnly, clear, onClear, onInput, colors = 'default', ...restProps }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1vqlc */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #2288fa;
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
} :root {
|
|
19
19
|
--focus-color: var(--color-light-border-link);
|
|
20
20
|
--disabled-cursor: not-allowed;
|
|
21
|
-
} .input-
|
|
21
|
+
} .input-autocomplete__component_zrg4l {
|
|
22
22
|
width: 100%;
|
|
23
23
|
outline: none;
|
|
24
|
-
} .input-
|
|
24
|
+
} .input-autocomplete__field_zrg4l:not(.input-autocomplete__disabled_zrg4l) {
|
|
25
25
|
cursor: pointer;
|
|
26
|
-
} .input-
|
|
26
|
+
} .input-autocomplete__disabled_zrg4l {
|
|
27
27
|
cursor: var(--disabled-cursor);
|
|
28
|
-
} .input-
|
|
28
|
+
} .input-autocomplete__placeholder_zrg4l {
|
|
29
29
|
color: var(--color-light-text-secondary);
|
|
30
|
-
} .input-
|
|
30
|
+
} .input-autocomplete__contentWrapper_zrg4l {
|
|
31
31
|
font-size: 16px;
|
|
32
32
|
line-height: 20px;
|
|
33
33
|
font-weight: 400;
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
text-overflow: ellipsis;
|
|
37
37
|
overflow: hidden;
|
|
38
38
|
width: 100%;
|
|
39
|
-
} .input-
|
|
39
|
+
} .input-autocomplete__value_zrg4l {
|
|
40
40
|
overflow: hidden;
|
|
41
41
|
text-overflow: ellipsis;
|
|
42
42
|
text-align: left;
|
|
43
|
-
} .input-
|
|
43
|
+
} .input-autocomplete__focusVisible_zrg4l {
|
|
44
44
|
outline: 2px solid var(--focus-color);
|
|
45
45
|
outline-offset: 2px;
|
|
46
46
|
}
|
|
@@ -4,5 +4,7 @@ import React from 'react';
|
|
|
4
4
|
declare const InputAutocompleteMobile: React.ForwardRefExoticComponent<import("../types").InputAutocompleteCommonProps & {
|
|
5
5
|
isBottomSheet?: boolean | undefined;
|
|
6
6
|
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
7
|
+
onApply?: (() => void) | undefined;
|
|
8
|
+
onCancel?: (() => void) | undefined;
|
|
7
9
|
} & React.RefAttributes<unknown>>;
|
|
8
10
|
export { InputAutocompleteMobile };
|
|
@@ -11,10 +11,10 @@ import '@alfalab/core-components-input/modern/shared';
|
|
|
11
11
|
import '@alfalab/core-components-shared/modern';
|
|
12
12
|
import '@alfalab/hooks';
|
|
13
13
|
|
|
14
|
-
const styles = {"input":"input-
|
|
14
|
+
const styles = {"input":"input-autocomplete__input_obkwb"};
|
|
15
15
|
require('./mobile.css')
|
|
16
16
|
|
|
17
|
-
const InputAutocompleteMobile = React.forwardRef(({ Input, value, name, Arrow = null, label, placeholder = '', size = 's', open: openProp, onInput, onOpen, multiple, inputProps, isBottomSheet = true, dataTestId, transitionProps, ...restProps }, ref) => {
|
|
17
|
+
const InputAutocompleteMobile = React.forwardRef(({ Input, value, name, Arrow = null, label, placeholder = '', size = 's', open: openProp, onInput, onOpen, multiple, inputProps, isBottomSheet = true, dataTestId, transitionProps, onCancel, onApply, ...restProps }, ref) => {
|
|
18
18
|
const [open, setOpen] = useState(false);
|
|
19
19
|
const frozenValue = useRef('');
|
|
20
20
|
const searchInputRef = useRef(null);
|
|
@@ -38,12 +38,15 @@ const InputAutocompleteMobile = React.forwardRef(({ Input, value, name, Arrow =
|
|
|
38
38
|
input.blur();
|
|
39
39
|
}
|
|
40
40
|
}, 300), []);
|
|
41
|
-
const handleApply = () =>
|
|
41
|
+
const handleApply = () => {
|
|
42
|
+
setModalVisibility(false);
|
|
43
|
+
onApply?.();
|
|
44
|
+
};
|
|
42
45
|
const handleCancel = () => {
|
|
43
46
|
setModalVisibility(false);
|
|
44
47
|
restorePrevValue();
|
|
48
|
+
onCancel?.();
|
|
45
49
|
};
|
|
46
|
-
const handleClear = () => onInput?.(null, { value: '' });
|
|
47
50
|
const handleExiting = (node) => {
|
|
48
51
|
targetRef.current?.focus();
|
|
49
52
|
transitionProps?.onExiting?.(node);
|
|
@@ -82,7 +85,7 @@ const InputAutocompleteMobile = React.forwardRef(({ Input, value, name, Arrow =
|
|
|
82
85
|
}, fieldProps: {
|
|
83
86
|
value: isOpen ? frozenValue.current : value,
|
|
84
87
|
clear,
|
|
85
|
-
onClear: clear ?
|
|
88
|
+
onClear: clear ? inputProps?.onClear : undefined,
|
|
86
89
|
...restProps.fieldProps,
|
|
87
90
|
} }));
|
|
88
91
|
});
|
|
@@ -4,5 +4,7 @@ import React from 'react';
|
|
|
4
4
|
declare const InputAutocompleteModalMobile: React.ForwardRefExoticComponent<import("../types").InputAutocompleteCommonProps & {
|
|
5
5
|
isBottomSheet?: boolean | undefined;
|
|
6
6
|
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
7
|
+
onApply?: (() => void) | undefined;
|
|
8
|
+
onCancel?: (() => void) | undefined;
|
|
7
9
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
10
|
export { InputAutocompleteModalMobile };
|
package/modern/mobile/mobile.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1kaq4 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
} :root {
|
|
15
15
|
} :root {
|
|
16
16
|
} :root {
|
|
17
|
-
} .input-
|
|
17
|
+
} .input-autocomplete__input_obkwb {
|
|
18
18
|
width: auto;
|
|
19
19
|
}
|
package/modern/types.d.ts
CHANGED
|
@@ -38,6 +38,14 @@ type MobileProps = {
|
|
|
38
38
|
* Пропсы анимации контента (CSSTransition)
|
|
39
39
|
*/
|
|
40
40
|
transitionProps?: NonNullable<BottomSheetSelectMobileProps['bottomSheetProps']>['transitionProps'];
|
|
41
|
+
/**
|
|
42
|
+
* Клик на кнопку "Применить"
|
|
43
|
+
*/
|
|
44
|
+
onApply?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Клик на кнопку "Отмена"
|
|
47
|
+
*/
|
|
48
|
+
onCancel?: () => void;
|
|
41
49
|
};
|
|
42
50
|
type InputAutocompleteMobileProps = InputAutocompleteCommonProps & MobileProps;
|
|
43
51
|
interface InputAutocompleteProps extends InputAutocompleteCommonProps {
|
package/package.json
CHANGED
|
@@ -39,6 +39,8 @@ export const InputAutocompleteMobile = React.forwardRef(
|
|
|
39
39
|
isBottomSheet = true,
|
|
40
40
|
dataTestId,
|
|
41
41
|
transitionProps,
|
|
42
|
+
onCancel,
|
|
43
|
+
onApply,
|
|
42
44
|
...restProps
|
|
43
45
|
}: InputAutocompleteMobileProps,
|
|
44
46
|
ref,
|
|
@@ -78,15 +80,17 @@ export const InputAutocompleteMobile = React.forwardRef(
|
|
|
78
80
|
[],
|
|
79
81
|
);
|
|
80
82
|
|
|
81
|
-
const handleApply = () =>
|
|
83
|
+
const handleApply = () => {
|
|
84
|
+
setModalVisibility(false);
|
|
85
|
+
onApply?.();
|
|
86
|
+
};
|
|
82
87
|
|
|
83
88
|
const handleCancel = () => {
|
|
84
89
|
setModalVisibility(false);
|
|
85
90
|
restorePrevValue();
|
|
91
|
+
onCancel?.();
|
|
86
92
|
};
|
|
87
93
|
|
|
88
|
-
const handleClear = () => onInput?.(null, { value: '' });
|
|
89
|
-
|
|
90
94
|
const handleExiting = (node: HTMLElement) => {
|
|
91
95
|
targetRef.current?.focus();
|
|
92
96
|
transitionProps?.onExiting?.(node);
|
|
@@ -161,7 +165,7 @@ export const InputAutocompleteMobile = React.forwardRef(
|
|
|
161
165
|
fieldProps={{
|
|
162
166
|
value: isOpen ? frozenValue.current : value,
|
|
163
167
|
clear,
|
|
164
|
-
onClear: clear ?
|
|
168
|
+
onClear: clear ? inputProps?.onClear : undefined,
|
|
165
169
|
...(restProps.fieldProps as AnyObject),
|
|
166
170
|
}}
|
|
167
171
|
/>
|
package/src/types.ts
CHANGED
|
@@ -54,6 +54,16 @@ type MobileProps = {
|
|
|
54
54
|
transitionProps?: NonNullable<
|
|
55
55
|
BottomSheetSelectMobileProps['bottomSheetProps']
|
|
56
56
|
>['transitionProps'];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Клик на кнопку "Применить"
|
|
60
|
+
*/
|
|
61
|
+
onApply?: () => void;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Клик на кнопку "Отмена"
|
|
65
|
+
*/
|
|
66
|
+
onCancel?: () => void;
|
|
57
67
|
};
|
|
58
68
|
|
|
59
69
|
export type InputAutocompleteMobileProps = InputAutocompleteCommonProps & MobileProps;
|
package/types.d.ts
CHANGED
|
@@ -38,6 +38,14 @@ type MobileProps = {
|
|
|
38
38
|
* Пропсы анимации контента (CSSTransition)
|
|
39
39
|
*/
|
|
40
40
|
transitionProps?: NonNullable<BottomSheetSelectMobileProps['bottomSheetProps']>['transitionProps'];
|
|
41
|
+
/**
|
|
42
|
+
* Клик на кнопку "Применить"
|
|
43
|
+
*/
|
|
44
|
+
onApply?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Клик на кнопку "Отмена"
|
|
47
|
+
*/
|
|
48
|
+
onCancel?: () => void;
|
|
41
49
|
};
|
|
42
50
|
type InputAutocompleteMobileProps = InputAutocompleteCommonProps & MobileProps;
|
|
43
51
|
interface InputAutocompleteProps extends InputAutocompleteCommonProps {
|