@alfalab/core-components-input-autocomplete 10.3.0 → 11.0.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/Component.desktop.d.ts +3 -70
- package/Component.desktop.js +2 -1
- package/Component.mobile.d.ts +5 -95
- package/Component.mobile.js +42 -45
- package/Component.modal.mobile.d.ts +5 -88
- package/Component.modal.mobile.js +9 -62
- package/Component.responsive.d.ts +3 -46
- package/Component.responsive.js +9 -12
- package/autocomplete-field/Component.d.ts +2 -2
- package/autocomplete-field/Component.js +1 -1
- package/autocomplete-field/index.css +2 -2
- package/autocomplete-mobile-field/Component.js +6 -3
- package/autocomplete-mobile-field/index.css +10 -10
- package/cssm/Component.desktop.d.ts +3 -70
- package/cssm/Component.desktop.js +2 -1
- package/cssm/Component.mobile.d.ts +5 -95
- package/cssm/Component.mobile.js +39 -44
- package/cssm/Component.modal.mobile.d.ts +5 -88
- package/cssm/Component.modal.mobile.js +10 -63
- package/cssm/Component.responsive.d.ts +3 -46
- package/cssm/Component.responsive.js +9 -11
- package/cssm/autocomplete-field/Component.d.ts +2 -2
- package/cssm/autocomplete-mobile-field/Component.js +5 -2
- package/cssm/autocomplete-mobile-field/index.module.css +2 -2
- package/cssm/desktop/index.d.ts +2 -2
- package/cssm/desktop/index.js +1 -0
- package/cssm/index.d.ts +2 -2
- package/cssm/index.js +5 -4
- package/cssm/mobile/index.d.ts +3 -3
- package/cssm/mobile/index.js +2 -2
- package/cssm/mobile.module.css +3 -10
- package/cssm/types.d.ts +58 -0
- package/cssm/types.js +2 -0
- package/cssm/utils.d.ts +2 -0
- package/cssm/utils.js +9 -0
- package/desktop/index.d.ts +2 -2
- package/desktop/index.js +1 -0
- package/esm/Component.desktop.d.ts +3 -70
- package/esm/Component.desktop.js +2 -1
- package/esm/Component.mobile.d.ts +5 -95
- package/esm/Component.mobile.js +43 -46
- package/esm/Component.modal.mobile.d.ts +5 -88
- package/esm/Component.modal.mobile.js +11 -61
- package/esm/Component.responsive.d.ts +3 -46
- package/esm/Component.responsive.js +9 -12
- package/esm/autocomplete-field/Component.d.ts +2 -2
- package/esm/autocomplete-field/Component.js +1 -1
- package/esm/autocomplete-field/index.css +2 -2
- package/esm/autocomplete-mobile-field/Component.js +6 -3
- package/esm/autocomplete-mobile-field/index.css +10 -10
- package/esm/desktop/index.d.ts +2 -2
- package/esm/desktop/index.js +1 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.js +5 -5
- package/esm/mobile/index.d.ts +3 -3
- package/esm/mobile/index.js +2 -3
- package/esm/mobile.css +4 -11
- package/esm/types.d.ts +58 -0
- package/esm/types.js +1 -0
- package/esm/utils.d.ts +2 -0
- package/esm/utils.js +5 -0
- package/index.d.ts +2 -2
- package/index.js +5 -5
- package/mobile/index.d.ts +3 -3
- package/mobile/index.js +2 -3
- package/mobile.css +4 -11
- package/modern/Component.desktop.d.ts +3 -70
- package/modern/Component.desktop.js +2 -1
- package/modern/Component.mobile.d.ts +5 -95
- package/modern/Component.mobile.js +54 -56
- package/modern/Component.modal.mobile.d.ts +5 -88
- package/modern/Component.modal.mobile.js +10 -68
- package/modern/Component.responsive.d.ts +3 -46
- package/modern/Component.responsive.js +8 -11
- package/modern/autocomplete-field/Component.d.ts +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 +5 -2
- package/modern/autocomplete-mobile-field/index.css +10 -10
- package/modern/desktop/index.d.ts +2 -2
- package/modern/desktop/index.js +1 -0
- package/modern/index.d.ts +2 -2
- package/modern/index.js +5 -5
- package/modern/mobile/index.d.ts +3 -3
- package/modern/mobile/index.js +2 -3
- package/modern/mobile.css +4 -11
- package/modern/types.d.ts +58 -0
- package/modern/types.js +1 -0
- package/modern/utils.d.ts +2 -0
- package/modern/utils.js +5 -0
- package/package.json +7 -6
- package/src/Component.desktop.tsx +6 -44
- package/src/Component.mobile.tsx +90 -188
- package/src/Component.modal.mobile.tsx +5 -223
- package/src/Component.responsive.tsx +10 -30
- package/src/autocomplete-field/Component.tsx +2 -2
- package/src/autocomplete-mobile-field/Component.tsx +5 -1
- package/src/desktop/index.ts +2 -1
- package/src/index.ts +2 -4
- package/src/mobile/index.ts +4 -5
- package/src/mobile.module.css +2 -11
- package/src/types.ts +77 -0
- package/src/utils.ts +3 -0
- package/types.d.ts +58 -0
- package/types.js +2 -0
- package/utils.d.ts +2 -0
- package/utils.js +9 -0
- package/esm/mobile.module-846d8b52.js +0 -4
- package/mobile.module-7c0f2a72.js +0 -6
- package/modern/mobile.module-7bf90bfc.js +0 -4
package/Component.desktop.d.ts
CHANGED
|
@@ -1,72 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type InputAutocompleteDesktopProps = Omit<BaseSelectProps, 'Field' | 'nativeSelect' | 'searchProps' | 'showSearch' | 'Search'> & {
|
|
7
|
-
/**
|
|
8
|
-
* Компонент ввода значения
|
|
9
|
-
*/
|
|
10
|
-
Input?: FC<InputProps & RefAttributes<HTMLInputElement>>;
|
|
11
|
-
/**
|
|
12
|
-
* Пропсы, которые будут прокинуты в инпут
|
|
13
|
-
*/
|
|
14
|
-
inputProps?: InputProps & Record<string, unknown>;
|
|
15
|
-
/**
|
|
16
|
-
* Значение поля ввода
|
|
17
|
-
*/
|
|
18
|
-
value?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Поле доступно только для чтения
|
|
21
|
-
*/
|
|
22
|
-
readOnly?: InputProps['readOnly'];
|
|
23
|
-
/**
|
|
24
|
-
* Отображение иконки успеха
|
|
25
|
-
*/
|
|
26
|
-
success?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Обработчик ввода
|
|
29
|
-
*/
|
|
30
|
-
onInput?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Хранит функцию, с помощью которой можно обновить положение поповера
|
|
33
|
-
*/
|
|
34
|
-
updatePopover?: BaseSelectProps['updatePopover'];
|
|
35
|
-
};
|
|
36
|
-
declare const InputAutocompleteDesktop: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "nativeSelect" | "searchProps" | "showSearch" | "Field" | "Search"> & {
|
|
37
|
-
/**
|
|
38
|
-
* Компонент ввода значения
|
|
39
|
-
*/
|
|
40
|
-
Input?: React.FC<Omit<import("@alfalab/core-components-input/components/base-input").BaseInputProps, "colorStyles" | "FormControlComponent"> & {
|
|
41
|
-
breakpoint?: number | undefined;
|
|
42
|
-
defaultMatchMediaValue?: boolean | (() => boolean) | undefined;
|
|
43
|
-
} & React.RefAttributes<HTMLInputElement>> | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Пропсы, которые будут прокинуты в инпут
|
|
46
|
-
*/
|
|
47
|
-
inputProps?: (Omit<import("@alfalab/core-components-input/components/base-input").BaseInputProps, "colorStyles" | "FormControlComponent"> & {
|
|
48
|
-
breakpoint?: number | undefined;
|
|
49
|
-
defaultMatchMediaValue?: boolean | (() => boolean) | undefined;
|
|
50
|
-
} & Record<string, unknown>) | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Значение поля ввода
|
|
53
|
-
*/
|
|
54
|
-
value?: string | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Поле доступно только для чтения
|
|
57
|
-
*/
|
|
58
|
-
readOnly?: InputProps['readOnly'];
|
|
59
|
-
/**
|
|
60
|
-
* Отображение иконки успеха
|
|
61
|
-
*/
|
|
62
|
-
success?: boolean | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Обработчик ввода
|
|
65
|
-
*/
|
|
66
|
-
onInput?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* Хранит функцию, с помощью которой можно обновить положение поповера
|
|
69
|
-
*/
|
|
70
|
-
updatePopover?: BaseSelectProps['updatePopover'];
|
|
71
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
|
72
|
-
export { InputAutocompleteDesktopProps, InputAutocompleteDesktop };
|
|
3
|
+
import { InputAutocompleteCommonProps } from "./types";
|
|
4
|
+
declare const InputAutocompleteDesktop: React.ForwardRefExoticComponent<InputAutocompleteCommonProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export { InputAutocompleteDesktop };
|
package/Component.desktop.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var coreComponentsPopover = require('@alfalab/core-components-popover');
|
|
7
8
|
var shared = require('@alfalab/core-components-select/shared');
|
|
8
9
|
var autocompleteField_Component = require('./autocomplete-field/Component.js');
|
|
9
10
|
require('react-merge-refs');
|
|
@@ -16,7 +17,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
16
17
|
|
|
17
18
|
var InputAutocompleteDesktop = React.forwardRef(function (_a, ref) {
|
|
18
19
|
var _b = _a.OptionsList, OptionsList = _b === void 0 ? shared.OptionsList : _b, _c = _a.Optgroup, Optgroup = _c === void 0 ? shared.Optgroup : _c, _d = _a.Option, Option = _d === void 0 ? shared.Option : _d, Input = _a.Input, _e = _a.inputProps, inputProps = _e === void 0 ? {} : _e, onInput = _a.onInput, value = _a.value, success = _a.success, readOnly = _a.readOnly, _f = _a.closeOnSelect, closeOnSelect = _f === void 0 ? false : _f, options = _a.options, restProps = tslib.__rest(_a, ["OptionsList", "Optgroup", "Option", "Input", "inputProps", "onInput", "value", "success", "readOnly", "closeOnSelect", "options"]);
|
|
19
|
-
return (React__default.default.createElement(shared.BaseSelect, tslib.__assign({ ref: ref, autocomplete: true, options: options, closeOnSelect: closeOnSelect, Option: Option, Field: autocompleteField_Component.AutocompleteField, Optgroup: Optgroup, OptionsList: OptionsList }, restProps, { fieldProps: tslib.__assign(tslib.__assign({}, restProps.fieldProps), { Input: Input, onInput: onInput, value: value, inputProps: inputProps, readOnly: readOnly, success: success }) })));
|
|
20
|
+
return (React__default.default.createElement(shared.BaseSelect, tslib.__assign({ view: 'desktop', Popover: coreComponentsPopover.Popover, ref: ref, autocomplete: true, options: options, closeOnSelect: closeOnSelect, Option: Option, Field: autocompleteField_Component.AutocompleteField, Optgroup: Optgroup, OptionsList: OptionsList }, restProps, { fieldProps: tslib.__assign(tslib.__assign({}, restProps.fieldProps), { Input: Input, onInput: onInput, value: value, inputProps: inputProps, readOnly: readOnly, success: success }) })));
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
exports.InputAutocompleteDesktop = InputAutocompleteDesktop;
|
package/Component.mobile.d.ts
CHANGED
|
@@ -1,98 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
/// <reference types="react-transition-group" />
|
|
2
3
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
type InputAutocompleteMobileProps = Omit<BaseSelectProps, 'OptionsList' | 'Checkmark' | 'onScroll' | 'nativeSelect' | 'autocomplete' | 'valueRenderer' | 'searchProps' | 'showSearch' | 'Search'> & {
|
|
7
|
-
/**
|
|
8
|
-
* Обработчик выбора
|
|
9
|
-
*/
|
|
10
|
-
onChange: (payload: string | BaseSelectChangePayload) => void;
|
|
11
|
-
/**
|
|
12
|
-
* Обработчик ввода фильтра.
|
|
13
|
-
*/
|
|
14
|
-
onFilter: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Значение поля ввода
|
|
17
|
-
*/
|
|
18
|
-
value?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Значение фильтра.
|
|
21
|
-
*/
|
|
22
|
-
filter?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Обработчик нажатия на кнопку "Отмена".
|
|
25
|
-
*/
|
|
26
|
-
onCancel?: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* Обработчик нажатия на крестик в инпуте фильтра.
|
|
29
|
-
*/
|
|
30
|
-
onClearFilter?: () => void;
|
|
31
|
-
/**
|
|
32
|
-
* Дополнительные пропсы компонента BottomSheet
|
|
33
|
-
*/
|
|
34
|
-
bottomSheetProps?: AdditionalMobileProps['bottomSheetProps'];
|
|
35
|
-
/**
|
|
36
|
-
* Дополнительные пропсы на слот под заголовком компонента BottomSheet
|
|
37
|
-
*/
|
|
38
|
-
bottomSheetHeaderAddonsProps?: Record<string, unknown>;
|
|
39
|
-
/**
|
|
40
|
-
* Дополнительные пропсы на кнопку "продолжить"
|
|
41
|
-
*/
|
|
42
|
-
continueButtonProps?: ButtonMobileProps;
|
|
43
|
-
/**
|
|
44
|
-
* Дополнительные пропсы на кнопку "отмена"
|
|
45
|
-
*/
|
|
46
|
-
cancelButtonProps?: ButtonMobileProps;
|
|
47
|
-
/**
|
|
48
|
-
* Кастомный инпут
|
|
49
|
-
*/
|
|
50
|
-
Input?: ElementType;
|
|
51
|
-
};
|
|
52
|
-
declare const InputAutocompleteMobile: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "onScroll" | "valueRenderer" | "autocomplete" | "nativeSelect" | "searchProps" | "showSearch" | "OptionsList" | "Search" | "Checkmark"> & {
|
|
53
|
-
/**
|
|
54
|
-
* Обработчик выбора
|
|
55
|
-
*/
|
|
56
|
-
onChange: (payload: string | BaseSelectChangePayload) => void;
|
|
57
|
-
/**
|
|
58
|
-
* Обработчик ввода фильтра.
|
|
59
|
-
*/
|
|
60
|
-
onFilter: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
61
|
-
/**
|
|
62
|
-
* Значение поля ввода
|
|
63
|
-
*/
|
|
64
|
-
value?: string | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* Значение фильтра.
|
|
67
|
-
*/
|
|
68
|
-
filter?: string | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* Обработчик нажатия на кнопку "Отмена".
|
|
71
|
-
*/
|
|
72
|
-
onCancel?: (() => void) | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Обработчик нажатия на крестик в инпуте фильтра.
|
|
75
|
-
*/
|
|
76
|
-
onClearFilter?: (() => void) | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Дополнительные пропсы компонента BottomSheet
|
|
79
|
-
*/
|
|
80
|
-
bottomSheetProps?: AdditionalMobileProps['bottomSheetProps'];
|
|
81
|
-
/**
|
|
82
|
-
* Дополнительные пропсы на слот под заголовком компонента BottomSheet
|
|
83
|
-
*/
|
|
84
|
-
bottomSheetHeaderAddonsProps?: Record<string, unknown> | undefined;
|
|
85
|
-
/**
|
|
86
|
-
* Дополнительные пропсы на кнопку "продолжить"
|
|
87
|
-
*/
|
|
88
|
-
continueButtonProps?: ButtonMobileProps | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* Дополнительные пропсы на кнопку "отмена"
|
|
91
|
-
*/
|
|
92
|
-
cancelButtonProps?: ButtonMobileProps | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* Кастомный инпут
|
|
95
|
-
*/
|
|
96
|
-
Input?: React.ElementType<any> | undefined;
|
|
4
|
+
declare const InputAutocompleteMobile: React.ForwardRefExoticComponent<import("./types").InputAutocompleteCommonProps & {
|
|
5
|
+
isBottomSheet?: boolean | undefined;
|
|
6
|
+
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
97
7
|
} & React.RefAttributes<unknown>>;
|
|
98
|
-
export {
|
|
8
|
+
export { InputAutocompleteMobile };
|
package/Component.mobile.js
CHANGED
|
@@ -7,11 +7,10 @@ var React = require('react');
|
|
|
7
7
|
var mergeRefs = require('react-merge-refs');
|
|
8
8
|
var cn = require('classnames');
|
|
9
9
|
var throttle = require('lodash.throttle');
|
|
10
|
-
var mobile$1 = require('@alfalab/core-components-button/mobile');
|
|
11
|
-
var coreComponentsInput = require('@alfalab/core-components-input');
|
|
12
10
|
var mobile = require('@alfalab/core-components-select/mobile');
|
|
11
|
+
var shared = require('@alfalab/core-components-select/shared');
|
|
13
12
|
var autocompleteMobileField_Component = require('./autocomplete-mobile-field/Component.js');
|
|
14
|
-
var
|
|
13
|
+
var utils = require('./utils.js');
|
|
15
14
|
require('@alfalab/core-components-form-control/mobile');
|
|
16
15
|
require('@alfalab/core-components-shared');
|
|
17
16
|
require('@alfalab/hooks');
|
|
@@ -23,68 +22,66 @@ var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
|
23
22
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
24
23
|
var throttle__default = /*#__PURE__*/_interopDefaultCompat(throttle);
|
|
25
24
|
|
|
26
|
-
var
|
|
25
|
+
var styles = {"input":"input-autocomplete__input_q39f3"};
|
|
26
|
+
require('./mobile.css')
|
|
27
|
+
|
|
27
28
|
var InputAutocompleteMobile = React__default.default.forwardRef(function (_a, ref) {
|
|
28
|
-
var
|
|
29
|
+
var _b;
|
|
30
|
+
var _c;
|
|
31
|
+
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"]);
|
|
29
32
|
var _h = React.useState(false), open = _h[0], setOpen = _h[1];
|
|
30
|
-
var
|
|
33
|
+
var frozenValue = React.useRef('');
|
|
34
|
+
var searchInputRef = React.useRef(null);
|
|
31
35
|
var targetRef = React.useRef(null);
|
|
32
|
-
var
|
|
36
|
+
var restorePrevValue = function () { return onInput === null || onInput === void 0 ? void 0 : onInput(null, { value: frozenValue.current }); };
|
|
37
|
+
var setModalVisibility = function (isOpen) {
|
|
33
38
|
if (openProp === undefined) {
|
|
34
39
|
setOpen(isOpen);
|
|
35
40
|
}
|
|
36
|
-
if (
|
|
37
|
-
|
|
41
|
+
if (isOpen) {
|
|
42
|
+
frozenValue.current = value || '';
|
|
38
43
|
}
|
|
44
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen({ open: isOpen, name: name });
|
|
39
45
|
};
|
|
40
46
|
var handleOpen = function (payload) {
|
|
41
|
-
|
|
47
|
+
setModalVisibility(Boolean(payload.open));
|
|
42
48
|
};
|
|
43
49
|
var handleOptionsListTouchMove = React.useMemo(function () {
|
|
44
50
|
return throttle__default.default(function () {
|
|
45
|
-
var input =
|
|
51
|
+
var input = searchInputRef.current;
|
|
46
52
|
if (input && document.activeElement === input) {
|
|
47
53
|
input.blur();
|
|
48
54
|
}
|
|
49
55
|
}, 300);
|
|
50
56
|
}, []);
|
|
51
|
-
var handleApply = function () {
|
|
52
|
-
setBottomSheetVisibility(false);
|
|
53
|
-
onChange(filter);
|
|
54
|
-
};
|
|
55
|
-
var handleChange = function (payload) {
|
|
56
|
-
var _a;
|
|
57
|
-
onChange(payload);
|
|
58
|
-
if (multiple) {
|
|
59
|
-
// После выбора опции возвращаем фокус в поле ввода.
|
|
60
|
-
(_a = bottomSheetInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
57
|
+
var handleApply = function () { return setModalVisibility(false); };
|
|
63
58
|
var handleCancel = function () {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
onCancel();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
var handleInputFocus = function (event) {
|
|
70
|
-
var input = bottomSheetInputRef.current;
|
|
71
|
-
// Перед закрытием шторки снимаем фокус с инпута, чтобы предотвратить скачок шторки.
|
|
72
|
-
if (event.relatedTarget === targetRef.current &&
|
|
73
|
-
input &&
|
|
74
|
-
input === document.activeElement) {
|
|
75
|
-
input.blur();
|
|
76
|
-
}
|
|
59
|
+
setModalVisibility(false);
|
|
60
|
+
restorePrevValue();
|
|
77
61
|
};
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
React__default.default.createElement(mobile$1.ButtonMobile, tslib.__assign({ block: true, view: 'primary', size: 'm', onClick: handleApply }, continueButtonProps), "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C"))), title: label || placeholder, bottomAddons: (React__default.default.createElement(Component, tslib.__assign({ block: true, clear: !!onClearFilter, onClear: onClearFilter, value: filter, onInput: onFilter, placeholder: placeholder, onFocus: handleInputFocus }, bottomSheetHeaderAddonsProps, { className: cn__default.default(mobile_module.styles.bottomAddonInput, bottomSheetHeaderAddonsProps.className), ref: mergeRefs__default.default([
|
|
83
|
-
bottomSheetInputRef,
|
|
84
|
-
bottomSheetHeaderAddonsProps.ref,
|
|
85
|
-
]) }))), initialHeight: 'full' }, bottomSheetProps), { containerProps: tslib.__assign({ onTouchMove: handleOptionsListTouchMove }, bottomSheetProps.containerProps) });
|
|
62
|
+
var handleExiting = function (node) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
(_a = targetRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
65
|
+
(_b = transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.onExiting) === null || _b === void 0 ? void 0 : _b.call(transitionProps, node);
|
|
86
66
|
};
|
|
87
|
-
|
|
67
|
+
var isOpen = Boolean(open || openProp);
|
|
68
|
+
var Component = isBottomSheet ? mobile.SelectMobile : mobile.SelectModalMobile;
|
|
69
|
+
var componentProps = (_b = {
|
|
70
|
+
title: label || placeholder,
|
|
71
|
+
onClose: restorePrevValue,
|
|
72
|
+
transitionProps: tslib.__assign(tslib.__assign({}, transitionProps), { onExiting: handleExiting })
|
|
73
|
+
},
|
|
74
|
+
_b[isBottomSheet ? 'containerProps' : 'componentDivProps'] = {
|
|
75
|
+
onTouchMove: handleOptionsListTouchMove,
|
|
76
|
+
},
|
|
77
|
+
_b);
|
|
78
|
+
return (React__default.default.createElement(Component, tslib.__assign({ Field: autocompleteMobileField_Component.AutocompleteMobileField }, restProps, (isBottomSheet
|
|
79
|
+
? { bottomSheetProps: componentProps }
|
|
80
|
+
: { modalProps: componentProps }), { dataTestId: dataTestId, useWithApplyHook: false, showSearch: true, searchProps: {
|
|
81
|
+
value: value,
|
|
82
|
+
filterFn: utils.searchFilterStub,
|
|
83
|
+
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: (_c = inputProps === null || inputProps === void 0 ? void 0 : inputProps.clear) !== null && _c !== void 0 ? _c : false, ref: mergeRefs__default.default([searchInputRef, inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref]), onChange: onInput }),
|
|
84
|
+
}, 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 }, restProps.fieldProps) })));
|
|
88
85
|
});
|
|
89
86
|
|
|
90
87
|
exports.InputAutocompleteMobile = InputAutocompleteMobile;
|
|
@@ -1,91 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
/// <reference types="react-transition-group" />
|
|
2
3
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import { BaseSelectChangePayload } from "@alfalab/core-components-select/shared";
|
|
7
|
-
type InputAutocompleteModalMobileProps = Omit<SelectModalMobileProps, 'OptionsList' | 'Checkmark' | 'onScroll' | 'nativeSelect' | 'autocomplete' | 'valueRenderer'> & {
|
|
8
|
-
/**
|
|
9
|
-
* Обработчик выбора
|
|
10
|
-
*/
|
|
11
|
-
onChange: (payload: string | BaseSelectChangePayload) => void;
|
|
12
|
-
/**
|
|
13
|
-
* Обработчик ввода фильтра.
|
|
14
|
-
*/
|
|
15
|
-
onFilter: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
-
/**
|
|
17
|
-
* Значение поля ввода
|
|
18
|
-
*/
|
|
19
|
-
value?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Значение фильтра.
|
|
22
|
-
*/
|
|
23
|
-
filter?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Обработчик нажатия на кнопку "Отмена".
|
|
26
|
-
*/
|
|
27
|
-
onCancel?: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Обработчик нажатия на крестик в инпуте фильтра.
|
|
30
|
-
*/
|
|
31
|
-
onClearFilter?: () => void;
|
|
32
|
-
/**
|
|
33
|
-
* Дополнительные пропсы на слот под заголовком
|
|
34
|
-
*/
|
|
35
|
-
bottomAddonProps?: Record<string, unknown>;
|
|
36
|
-
/**
|
|
37
|
-
* Дополнительные пропсы на кнопку "продолжить"
|
|
38
|
-
*/
|
|
39
|
-
continueButtonProps?: ButtonMobileProps;
|
|
40
|
-
/**
|
|
41
|
-
* Дополнительные пропсы на кнопку "отмена"
|
|
42
|
-
*/
|
|
43
|
-
cancelButtonProps?: ButtonMobileProps;
|
|
44
|
-
/**
|
|
45
|
-
* Кастомный инпут
|
|
46
|
-
*/
|
|
47
|
-
Input?: ElementType;
|
|
48
|
-
};
|
|
49
|
-
declare const InputAutocompleteModalMobile: React.ForwardRefExoticComponent<Omit<SelectModalMobileProps, "onScroll" | "valueRenderer" | "autocomplete" | "nativeSelect" | "OptionsList" | "Checkmark"> & {
|
|
50
|
-
/**
|
|
51
|
-
* Обработчик выбора
|
|
52
|
-
*/
|
|
53
|
-
onChange: (payload: string | BaseSelectChangePayload) => void;
|
|
54
|
-
/**
|
|
55
|
-
* Обработчик ввода фильтра.
|
|
56
|
-
*/
|
|
57
|
-
onFilter: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
58
|
-
/**
|
|
59
|
-
* Значение поля ввода
|
|
60
|
-
*/
|
|
61
|
-
value?: string | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Значение фильтра.
|
|
64
|
-
*/
|
|
65
|
-
filter?: string | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* Обработчик нажатия на кнопку "Отмена".
|
|
68
|
-
*/
|
|
69
|
-
onCancel?: (() => void) | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Обработчик нажатия на крестик в инпуте фильтра.
|
|
72
|
-
*/
|
|
73
|
-
onClearFilter?: (() => void) | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* Дополнительные пропсы на слот под заголовком
|
|
76
|
-
*/
|
|
77
|
-
bottomAddonProps?: Record<string, unknown> | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Дополнительные пропсы на кнопку "продолжить"
|
|
80
|
-
*/
|
|
81
|
-
continueButtonProps?: ButtonMobileProps | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Дополнительные пропсы на кнопку "отмена"
|
|
84
|
-
*/
|
|
85
|
-
cancelButtonProps?: ButtonMobileProps | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Кастомный инпут
|
|
88
|
-
*/
|
|
89
|
-
Input?: React.ElementType<any> | undefined;
|
|
4
|
+
declare const InputAutocompleteModalMobile: React.ForwardRefExoticComponent<import("./types").InputAutocompleteCommonProps & {
|
|
5
|
+
isBottomSheet?: boolean | undefined;
|
|
6
|
+
transitionProps?: Partial<import("react-transition-group/Transition").TransitionProps<undefined>> | undefined;
|
|
90
7
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
-
export {
|
|
8
|
+
export { InputAutocompleteModalMobile };
|
|
@@ -4,75 +4,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var mobile_module = require('./mobile.module-7c0f2a72.js');
|
|
7
|
+
var Component_mobile = require('./Component.mobile.js');
|
|
8
|
+
require('react-merge-refs');
|
|
9
|
+
require('classnames');
|
|
10
|
+
require('lodash.throttle');
|
|
11
|
+
require('@alfalab/core-components-select/mobile');
|
|
12
|
+
require('@alfalab/core-components-select/shared');
|
|
13
|
+
require('./autocomplete-mobile-field/Component.js');
|
|
15
14
|
require('@alfalab/core-components-form-control/mobile');
|
|
16
15
|
require('@alfalab/core-components-shared');
|
|
17
16
|
require('@alfalab/hooks');
|
|
17
|
+
require('./utils.js');
|
|
18
18
|
|
|
19
19
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
20
20
|
|
|
21
21
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
22
|
-
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
23
|
-
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
24
|
-
var throttle__default = /*#__PURE__*/_interopDefaultCompat(throttle);
|
|
25
22
|
|
|
26
|
-
var InputAutocompleteModalMobile = React__default.default.forwardRef(function (
|
|
27
|
-
var openProp = _a.open, onOpen = _a.onOpen, name = _a.name, _b = _a.size, size = _b === void 0 ? 's' : _b, _c = _a.Input, Input = _c === void 0 ? coreComponentsInput.Input : _c, _d = _a.Arrow, Arrow = _d === void 0 ? null : _d, onClearFilter = _a.onClearFilter, _e = _a.filter, filter = _e === void 0 ? '' : _e, onFilter = _a.onFilter, placeholder = _a.placeholder, bottomAddonProps = _a.bottomAddonProps, multiple = _a.multiple, onChange = _a.onChange, onCancel = _a.onCancel, value = _a.value, cancelButtonProps = _a.cancelButtonProps, continueButtonProps = _a.continueButtonProps, modalProps = _a.modalProps, modalHeaderProps = _a.modalHeaderProps, modalFooterProps = _a.modalFooterProps, restProps = tslib.__rest(_a, ["open", "onOpen", "name", "size", "Input", "Arrow", "onClearFilter", "filter", "onFilter", "placeholder", "bottomAddonProps", "multiple", "onChange", "onCancel", "value", "cancelButtonProps", "continueButtonProps", "modalProps", "modalHeaderProps", "modalFooterProps"]);
|
|
28
|
-
var _f = React__default.default.useState(false), open = _f[0], setOpen = _f[1];
|
|
29
|
-
var targetRef = React.useRef(null);
|
|
30
|
-
var modalScrollableRef = React.useRef(null);
|
|
31
|
-
var bottomAddonRef = React.useRef(null);
|
|
32
|
-
React.useEffect(function () {
|
|
33
|
-
var modalContentNode = modalScrollableRef.current;
|
|
34
|
-
var handleListTouchMove = throttle__default.default(function () {
|
|
35
|
-
var input = bottomAddonRef.current;
|
|
36
|
-
if (input && document.activeElement === input) {
|
|
37
|
-
input.blur();
|
|
38
|
-
}
|
|
39
|
-
}, 300);
|
|
40
|
-
modalContentNode === null || modalContentNode === void 0 ? void 0 : modalContentNode.addEventListener('touchmove', handleListTouchMove);
|
|
41
|
-
return function () { return modalContentNode === null || modalContentNode === void 0 ? void 0 : modalContentNode.removeEventListener('touchmove', handleListTouchMove); };
|
|
42
|
-
}, [open]);
|
|
43
|
-
var setOpenModalSelect = function (isOpen) {
|
|
44
|
-
if (openProp === undefined) {
|
|
45
|
-
setOpen(isOpen);
|
|
46
|
-
}
|
|
47
|
-
onOpen === null || onOpen === void 0 ? void 0 : onOpen({ open: isOpen, name: name });
|
|
48
|
-
};
|
|
49
|
-
var handleOpen = function (payload) {
|
|
50
|
-
setOpenModalSelect(Boolean(payload.open));
|
|
51
|
-
};
|
|
52
|
-
var handleApply = function () {
|
|
53
|
-
setOpenModalSelect(false);
|
|
54
|
-
onChange(filter);
|
|
55
|
-
};
|
|
56
|
-
var handleCancel = function () {
|
|
57
|
-
setOpenModalSelect(false);
|
|
58
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
59
|
-
};
|
|
60
|
-
var handleChange = function (payload) {
|
|
61
|
-
var _a;
|
|
62
|
-
onChange(payload);
|
|
63
|
-
if (multiple) {
|
|
64
|
-
// После выбора опции возвращаем фокус в поле ввода.
|
|
65
|
-
(_a = bottomAddonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var renderBottomAddon = function () { return (React__default.default.createElement(Input, tslib.__assign({ block: true, clear: !!onClearFilter, onClear: onClearFilter, value: filter, onInput: onFilter, placeholder: placeholder }, bottomAddonProps, { className: cn__default.default(mobile_module.styles.bottomAddonInput, bottomAddonProps === null || bottomAddonProps === void 0 ? void 0 : bottomAddonProps.className), ref: mergeRefs__default.default([
|
|
69
|
-
bottomAddonRef,
|
|
70
|
-
bottomAddonProps === null || bottomAddonProps === void 0 ? void 0 : bottomAddonProps.ref,
|
|
71
|
-
]) }))); };
|
|
72
|
-
var renderFooter = function () { return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
73
|
-
React__default.default.createElement(mobile$1.ButtonMobile, tslib.__assign({ block: true, view: 'secondary', size: 'm', onClick: handleCancel }, cancelButtonProps), "\u041E\u0442\u043C\u0435\u043D\u0430"),
|
|
74
|
-
React__default.default.createElement(mobile$1.ButtonMobile, tslib.__assign({ block: true, view: 'primary', size: 'm', onClick: handleApply }, continueButtonProps), "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C"))); };
|
|
75
|
-
return (React__default.default.createElement(mobile.SelectModalMobile, tslib.__assign({ Field: autocompleteMobileField_Component.AutocompleteMobileField, useWithApplyHook: false }, restProps, { ref: mergeRefs__default.default([ref, targetRef]), Arrow: Arrow, onOpen: handleOpen, onChange: handleChange, multiple: multiple, open: openProp !== null && openProp !== void 0 ? openProp : open, size: size, fieldProps: tslib.__assign({ value: value }, restProps.fieldProps), placeholder: placeholder, name: name, modalProps: tslib.__assign(tslib.__assign({}, modalProps), { componentRef: modalScrollableRef }), modalHeaderProps: tslib.__assign(tslib.__assign({}, modalHeaderProps), { bottomAddons: renderBottomAddon() }), modalFooterProps: tslib.__assign(tslib.__assign({ sticky: true }, modalFooterProps), { children: renderFooter() }) })));
|
|
76
|
-
});
|
|
23
|
+
var InputAutocompleteModalMobile = React__default.default.forwardRef(function (props, ref) { return React__default.default.createElement(Component_mobile.InputAutocompleteMobile, tslib.__assign({}, props, { ref: ref, isBottomSheet: false })); });
|
|
77
24
|
|
|
78
25
|
exports.InputAutocompleteModalMobile = InputAutocompleteModalMobile;
|
|
@@ -1,48 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { InputAutocompleteMobileProps } from "./Component.mobile";
|
|
7
|
-
type InputAutocompleteResponsiveProps = InputAutocompleteDesktopProps & InputAutocompleteMobileProps & {
|
|
8
|
-
/**
|
|
9
|
-
* Контрольная точка, с нее начинается desktop версия
|
|
10
|
-
* @default 1024
|
|
11
|
-
*/
|
|
12
|
-
breakpoint?: number;
|
|
13
|
-
};
|
|
14
|
-
type InputAutocompleteMedia = 'desktop' | 'mobile';
|
|
15
|
-
declare const InputAutocompleteResponsive: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "nativeSelect" | "searchProps" | "showSearch" | "Field" | "Search"> & {
|
|
16
|
-
Input?: React.FC<Omit<import("@alfalab/core-components-input/components/base-input").BaseInputProps, "colorStyles" | "FormControlComponent"> & {
|
|
17
|
-
breakpoint?: number | undefined;
|
|
18
|
-
defaultMatchMediaValue?: boolean | (() => boolean) | undefined;
|
|
19
|
-
} & React.RefAttributes<HTMLInputElement>> | undefined;
|
|
20
|
-
inputProps?: (Omit<import("@alfalab/core-components-input/components/base-input").BaseInputProps, "colorStyles" | "FormControlComponent"> & {
|
|
21
|
-
breakpoint?: number | undefined;
|
|
22
|
-
defaultMatchMediaValue?: boolean | (() => boolean) | undefined;
|
|
23
|
-
} & Record<string, unknown>) | undefined;
|
|
24
|
-
value?: string | undefined;
|
|
25
|
-
readOnly?: boolean | undefined;
|
|
26
|
-
success?: boolean | undefined;
|
|
27
|
-
onInput?: ((event: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
28
|
-
updatePopover?: React.MutableRefObject<() => void> | undefined;
|
|
29
|
-
} & Omit<BaseSelectProps, "onScroll" | "valueRenderer" | "autocomplete" | "nativeSelect" | "searchProps" | "showSearch" | "OptionsList" | "Search" | "Checkmark"> & {
|
|
30
|
-
onChange: (payload: string | import("@alfalab/core-components-select/shared").BaseSelectChangePayload) => void;
|
|
31
|
-
onFilter: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
-
value?: string | undefined;
|
|
33
|
-
filter?: string | undefined;
|
|
34
|
-
onCancel?: (() => void) | undefined;
|
|
35
|
-
onClearFilter?: (() => void) | undefined;
|
|
36
|
-
bottomSheetProps?: Partial<import("@alfalab/core-components-bottom-sheet").BottomSheetProps> | undefined;
|
|
37
|
-
bottomSheetHeaderAddonsProps?: Record<string, unknown> | undefined;
|
|
38
|
-
continueButtonProps?: ButtonMobileProps | undefined;
|
|
39
|
-
cancelButtonProps?: ButtonMobileProps | undefined;
|
|
40
|
-
Input?: React.ElementType<any> | undefined;
|
|
41
|
-
} & {
|
|
42
|
-
/**
|
|
43
|
-
* Контрольная точка, с нее начинается desktop версия
|
|
44
|
-
* @default 1024
|
|
45
|
-
*/
|
|
46
|
-
breakpoint?: number | undefined;
|
|
47
|
-
} & React.RefAttributes<HTMLDivElement | HTMLInputElement>>;
|
|
48
|
-
export { InputAutocompleteResponsiveProps, InputAutocompleteMedia, InputAutocompleteResponsive };
|
|
3
|
+
import { InputAutocompleteProps } from "./types";
|
|
4
|
+
declare const InputAutocomplete: React.ForwardRefExoticComponent<InputAutocompleteProps & React.RefAttributes<HTMLDivElement | HTMLInputElement>>;
|
|
5
|
+
export { InputAutocomplete };
|
package/Component.responsive.js
CHANGED
|
@@ -4,34 +4,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
7
|
+
var coreComponentsMq = require('@alfalab/core-components-mq');
|
|
8
8
|
var Component_desktop = require('./Component.desktop.js');
|
|
9
9
|
var Component_mobile = require('./Component.mobile.js');
|
|
10
|
+
require('@alfalab/core-components-popover');
|
|
10
11
|
require('@alfalab/core-components-select/shared');
|
|
11
12
|
require('./autocomplete-field/Component.js');
|
|
12
13
|
require('react-merge-refs');
|
|
13
14
|
require('classnames');
|
|
14
15
|
require('@alfalab/core-components-input/desktop');
|
|
15
16
|
require('lodash.throttle');
|
|
16
|
-
require('@alfalab/core-components-button/mobile');
|
|
17
|
-
require('@alfalab/core-components-input');
|
|
18
17
|
require('@alfalab/core-components-select/mobile');
|
|
19
18
|
require('./autocomplete-mobile-field/Component.js');
|
|
20
19
|
require('@alfalab/core-components-form-control/mobile');
|
|
21
20
|
require('@alfalab/core-components-shared');
|
|
22
|
-
require('
|
|
21
|
+
require('@alfalab/hooks');
|
|
22
|
+
require('./utils.js');
|
|
23
23
|
|
|
24
24
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
25
25
|
|
|
26
26
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
27
27
|
|
|
28
|
-
var
|
|
29
|
-
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = tslib.__rest(_a, ["breakpoint"]);
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
['desktop', "(min-width: ".concat(breakpoint, "px)")],
|
|
33
|
-
], 'desktop')[0];
|
|
34
|
-
return view === 'desktop' ? (React__default.default.createElement(Component_desktop.InputAutocompleteDesktop, tslib.__assign({}, restProps, { ref: ref }))) : (React__default.default.createElement(Component_mobile.InputAutocompleteMobile, tslib.__assign({}, restProps, { ref: ref })));
|
|
28
|
+
var InputAutocomplete = React.forwardRef(function (_a, ref) {
|
|
29
|
+
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, _c = _a.defaultMatchMediaValue, defaultMatchMediaValue = _c === void 0 ? true : _c, mobileProps = _a.mobileProps, restProps = tslib.__rest(_a, ["breakpoint", "defaultMatchMediaValue", "mobileProps"]);
|
|
30
|
+
var isDesktop = coreComponentsMq.useMatchMedia("(min-width: ".concat(breakpoint, "px)"), defaultMatchMediaValue)[0];
|
|
31
|
+
return isDesktop ? (React__default.default.createElement(Component_desktop.InputAutocompleteDesktop, tslib.__assign({}, restProps, { ref: ref }))) : (React__default.default.createElement(Component_mobile.InputAutocompleteMobile, tslib.__assign({}, restProps, mobileProps, { ref: ref })));
|
|
35
32
|
});
|
|
36
33
|
|
|
37
|
-
exports.
|
|
34
|
+
exports.InputAutocomplete = InputAutocomplete;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FieldProps } from "@alfalab/core-components-select/shared";
|
|
4
|
-
import {
|
|
5
|
-
type AutocompleteFieldProps = FieldProps & Pick<
|
|
4
|
+
import { InputAutocompleteCommonProps } from "../types";
|
|
5
|
+
type AutocompleteFieldProps = FieldProps & Pick<InputAutocompleteCommonProps, 'Input' | 'inputProps' | 'value' | 'onInput' | 'readOnly'>;
|
|
6
6
|
declare const AutocompleteField: ({ label, labelView, placeholder, size, Arrow, Input, value, error, success, hint, disabled, readOnly, onInput, inputProps, innerProps, }: AutocompleteFieldProps) => React.JSX.Element;
|
|
7
7
|
export { AutocompleteFieldProps, AutocompleteField };
|
|
@@ -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_1sl9i","error":"input-autocomplete__error_1sl9i"};
|
|
18
18
|
require('./index.css')
|
|
19
19
|
|
|
20
20
|
var AutocompleteField = function (_a) {
|