@alfalab/core-components-input-autocomplete 10.3.0 → 11.0.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.
- 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
|
@@ -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 };
|
|
@@ -4,9 +4,10 @@ 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/cssm');
|
|
8
8
|
var Component_desktop = require('./Component.desktop.js');
|
|
9
9
|
var Component_mobile = require('./Component.mobile.js');
|
|
10
|
+
require('@alfalab/core-components-popover/cssm');
|
|
10
11
|
require('@alfalab/core-components-select/cssm/shared');
|
|
11
12
|
require('./autocomplete-field/Component.js');
|
|
12
13
|
require('react-merge-refs');
|
|
@@ -14,26 +15,23 @@ require('classnames');
|
|
|
14
15
|
require('@alfalab/core-components-input/cssm/desktop');
|
|
15
16
|
require('./autocomplete-field/index.module.css');
|
|
16
17
|
require('lodash.throttle');
|
|
17
|
-
require('@alfalab/core-components-button/cssm/mobile');
|
|
18
|
-
require('@alfalab/core-components-input/cssm');
|
|
19
18
|
require('@alfalab/core-components-select/cssm/mobile');
|
|
20
19
|
require('./autocomplete-mobile-field/Component.js');
|
|
21
20
|
require('@alfalab/core-components-form-control/cssm/mobile');
|
|
22
21
|
require('@alfalab/core-components-shared/cssm');
|
|
22
|
+
require('@alfalab/hooks');
|
|
23
23
|
require('./autocomplete-mobile-field/index.module.css');
|
|
24
|
+
require('./utils.js');
|
|
24
25
|
require('./mobile.module.css');
|
|
25
26
|
|
|
26
27
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
27
28
|
|
|
28
29
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
29
30
|
|
|
30
|
-
var
|
|
31
|
-
var _b = _a.breakpoint, breakpoint = _b === void 0 ? 1024 : _b, restProps = tslib.__rest(_a, ["breakpoint"]);
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
['desktop', "(min-width: ".concat(breakpoint, "px)")],
|
|
35
|
-
], 'desktop')[0];
|
|
36
|
-
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 })));
|
|
31
|
+
var InputAutocomplete = React.forwardRef(function (_a, ref) {
|
|
32
|
+
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"]);
|
|
33
|
+
var isDesktop = coreComponentsMq.useMatchMedia("(min-width: ".concat(breakpoint, "px)"), defaultMatchMediaValue)[0];
|
|
34
|
+
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 })));
|
|
37
35
|
});
|
|
38
36
|
|
|
39
|
-
exports.
|
|
37
|
+
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 };
|
|
@@ -18,17 +18,20 @@ var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
|
18
18
|
|
|
19
19
|
var AutocompleteMobileField = function (_a) {
|
|
20
20
|
var _b;
|
|
21
|
-
var _c = _a.size, size = _c === void 0 ? 'm' : _c
|
|
21
|
+
var _c = _a.size, size = _c === void 0 ? 'm' : _c, open = _a.open, disabled = _a.disabled, value = _a.value, innerProps = _a.innerProps, dataTestId = _a.dataTestId, fieldClassName = _a.fieldClassName, _d = _a.labelView, labelView = _d === void 0 ? 'inner' : _d, placeholder = _a.placeholder, Arrow = _a.Arrow; _a.valueRenderer; _a.toggleMenu; _a.setSelectedItems; _a.selectedMultiple; _a.FormControlComponent; var restProps = tslib.__rest(_a, ["size", "open", "disabled", "value", "innerProps", "dataTestId", "fieldClassName", "labelView", "placeholder", "Arrow", "valueRenderer", "toggleMenu", "setSelectedItems", "selectedMultiple", "FormControlComponent"]);
|
|
22
22
|
var _e = React.useState(false), focused = _e[0], setFocused = _e[1];
|
|
23
23
|
var wrapperRef = React.useRef(null);
|
|
24
24
|
var focusVisible = hooks.useFocus(wrapperRef, 'keyboard')[0];
|
|
25
25
|
var filled = Boolean(value);
|
|
26
26
|
var showPlaceholder = placeholder && !filled && labelView === 'outer';
|
|
27
|
+
var tabIndex = innerProps.tabIndex, restInnerProps = tslib.__rest(innerProps, ["tabIndex"]);
|
|
27
28
|
return (React__default.default.createElement("div", { className: styles__default.default.component, ref: wrapperRef, onFocus: function () { return setFocused(true); }, onBlur: function () { return setFocused(false); } },
|
|
28
29
|
React__default.default.createElement(mobile.FormControlMobile, tslib.__assign({ fieldClassName: cn__default.default(styles__default.default.field, fieldClassName, (_b = {},
|
|
29
30
|
_b[styles__default.default.disabled] = disabled,
|
|
30
31
|
_b[styles__default.default.focusVisible] = focusVisible,
|
|
31
|
-
_b)), block: true, size: size, focused: focused, disabled: disabled, filled: filled, labelView: labelView, rightAddons: Arrow, dataTestId: coreComponentsShared.getDataTestId(dataTestId, 'form-control')
|
|
32
|
+
_b)), block: true, size: size, focused: focused, disabled: disabled, filled: filled, labelView: labelView, rightAddons: Arrow, dataTestId: coreComponentsShared.getDataTestId(dataTestId, 'form-control'),
|
|
33
|
+
// downshift устанавливает фокус на таргет поле после выбора опции, не даем ему это сделать пока открыт список, иначе поле поиска будет терять фокус
|
|
34
|
+
tabIndex: open ? undefined : tabIndex }, restProps, restInnerProps),
|
|
32
35
|
React__default.default.createElement("div", { className: styles__default.default.contentWrapper },
|
|
33
36
|
showPlaceholder && React__default.default.createElement("span", { className: styles__default.default.placeholder }, placeholder),
|
|
34
37
|
filled && React__default.default.createElement("div", { className: styles__default.default.value }, value)))));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
} /* deprecated */ :root {
|
|
3
|
-
--color-light-border-link: #
|
|
4
|
-
--color-light-text-secondary: rgba(
|
|
3
|
+
--color-light-border-link: #2288fa;
|
|
4
|
+
--color-light-text-secondary: rgba(4, 4, 19, 0.55); /* 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 */
|
|
5
5
|
} :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 */
|
|
6
6
|
} :root {
|
|
7
7
|
} :root {
|
package/cssm/desktop/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { InputAutocompleteDesktop
|
|
2
|
-
export {};
|
|
1
|
+
export { InputAutocompleteDesktop } from "../Component.desktop";
|
|
2
|
+
export type { InputAutocompleteCommonProps as InputAutocompleteDesktopProps } from "../types";
|
package/cssm/desktop/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var Component_desktop = require('../Component.desktop.js');
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('react');
|
|
8
|
+
require('@alfalab/core-components-popover/cssm');
|
|
8
9
|
require('@alfalab/core-components-select/cssm/shared');
|
|
9
10
|
require('../autocomplete-field/Component.js');
|
|
10
11
|
require('react-merge-refs');
|
package/cssm/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {};
|
|
1
|
+
export { InputAutocomplete } from "./Component.responsive";
|
|
2
|
+
export type { InputAutocompleteProps } from "./types";
|
package/cssm/index.js
CHANGED
|
@@ -5,8 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var Component_responsive = require('./Component.responsive.js');
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('react');
|
|
8
|
-
require('@alfalab/
|
|
8
|
+
require('@alfalab/core-components-mq/cssm');
|
|
9
9
|
require('./Component.desktop.js');
|
|
10
|
+
require('@alfalab/core-components-popover/cssm');
|
|
10
11
|
require('@alfalab/core-components-select/cssm/shared');
|
|
11
12
|
require('./autocomplete-field/Component.js');
|
|
12
13
|
require('react-merge-refs');
|
|
@@ -15,15 +16,15 @@ require('@alfalab/core-components-input/cssm/desktop');
|
|
|
15
16
|
require('./autocomplete-field/index.module.css');
|
|
16
17
|
require('./Component.mobile.js');
|
|
17
18
|
require('lodash.throttle');
|
|
18
|
-
require('@alfalab/core-components-button/cssm/mobile');
|
|
19
|
-
require('@alfalab/core-components-input/cssm');
|
|
20
19
|
require('@alfalab/core-components-select/cssm/mobile');
|
|
21
20
|
require('./autocomplete-mobile-field/Component.js');
|
|
22
21
|
require('@alfalab/core-components-form-control/cssm/mobile');
|
|
23
22
|
require('@alfalab/core-components-shared/cssm');
|
|
23
|
+
require('@alfalab/hooks');
|
|
24
24
|
require('./autocomplete-mobile-field/index.module.css');
|
|
25
|
+
require('./utils.js');
|
|
25
26
|
require('./mobile.module.css');
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
|
|
29
|
-
exports.InputAutocomplete = Component_responsive.
|
|
30
|
+
exports.InputAutocomplete = Component_responsive.InputAutocomplete;
|
package/cssm/mobile/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { InputAutocompleteMobile
|
|
2
|
-
export { InputAutocompleteModalMobile
|
|
3
|
-
export {};
|
|
1
|
+
export { InputAutocompleteMobile } from "../Component.mobile";
|
|
2
|
+
export { InputAutocompleteModalMobile } from "../Component.modal.mobile";
|
|
3
|
+
export { InputAutocompleteMobileProps } from "../types";
|
package/cssm/mobile/index.js
CHANGED
|
@@ -9,14 +9,14 @@ require('react');
|
|
|
9
9
|
require('react-merge-refs');
|
|
10
10
|
require('classnames');
|
|
11
11
|
require('lodash.throttle');
|
|
12
|
-
require('@alfalab/core-components-button/cssm/mobile');
|
|
13
|
-
require('@alfalab/core-components-input/cssm');
|
|
14
12
|
require('@alfalab/core-components-select/cssm/mobile');
|
|
13
|
+
require('@alfalab/core-components-select/cssm/shared');
|
|
15
14
|
require('../autocomplete-mobile-field/Component.js');
|
|
16
15
|
require('@alfalab/core-components-form-control/cssm/mobile');
|
|
17
16
|
require('@alfalab/core-components-shared/cssm');
|
|
18
17
|
require('@alfalab/hooks');
|
|
19
18
|
require('../autocomplete-mobile-field/index.module.css');
|
|
19
|
+
require('../utils.js');
|
|
20
20
|
require('../mobile.module.css');
|
|
21
21
|
|
|
22
22
|
|
package/cssm/mobile.module.css
CHANGED
|
@@ -11,15 +11,8 @@
|
|
|
11
11
|
/* Hard up */
|
|
12
12
|
} :root {
|
|
13
13
|
} :root {
|
|
14
|
-
--gap-xs: 8px;
|
|
15
|
-
--gap-m: 16px;
|
|
16
14
|
} :root {
|
|
17
15
|
} :root {
|
|
18
|
-
} .
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} .footer {
|
|
22
|
-
display: flex
|
|
23
|
-
} .footer > button + button {
|
|
24
|
-
margin-left: var(--gap-m);
|
|
25
|
-
}
|
|
16
|
+
} .input {
|
|
17
|
+
width: auto;
|
|
18
|
+
}
|
package/cssm/types.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ChangeEvent, FC, RefAttributes } from 'react';
|
|
2
|
+
import { InputProps } from "@alfalab/core-components-input";
|
|
3
|
+
import { BaseSelectProps, BottomSheetSelectMobileProps } from "@alfalab/core-components-select/shared";
|
|
4
|
+
interface InputAutocompleteCommonProps extends Omit<BaseSelectProps, 'autocomplete' | 'Field' | 'nativeSelect' | 'searchProps' | 'showSearch' | 'Search'> {
|
|
5
|
+
/**
|
|
6
|
+
* Компонент ввода значения
|
|
7
|
+
*/
|
|
8
|
+
Input?: FC<InputProps & RefAttributes<HTMLInputElement>>;
|
|
9
|
+
/**
|
|
10
|
+
* Пропсы, которые будут прокинуты в инпут
|
|
11
|
+
*/
|
|
12
|
+
inputProps?: InputProps & Record<string, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* Значение поля ввода
|
|
15
|
+
*/
|
|
16
|
+
value?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Поле доступно только для чтения
|
|
19
|
+
*/
|
|
20
|
+
readOnly?: InputProps['readOnly'];
|
|
21
|
+
/**
|
|
22
|
+
* Отображение иконки успеха
|
|
23
|
+
*/
|
|
24
|
+
success?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Обработчик ввода
|
|
27
|
+
*/
|
|
28
|
+
onInput?: (event: ChangeEvent<HTMLInputElement> | null, payload: {
|
|
29
|
+
value: string;
|
|
30
|
+
}) => void;
|
|
31
|
+
}
|
|
32
|
+
type MobileProps = {
|
|
33
|
+
/**
|
|
34
|
+
* Открывать в bottom-sheet
|
|
35
|
+
*/
|
|
36
|
+
isBottomSheet?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Пропсы анимации контента (CSSTransition)
|
|
39
|
+
*/
|
|
40
|
+
transitionProps?: NonNullable<BottomSheetSelectMobileProps['bottomSheetProps']>['transitionProps'];
|
|
41
|
+
};
|
|
42
|
+
type InputAutocompleteMobileProps = InputAutocompleteCommonProps & MobileProps;
|
|
43
|
+
interface InputAutocompleteProps extends InputAutocompleteCommonProps {
|
|
44
|
+
/**
|
|
45
|
+
* Пропсы для мобильного компонента
|
|
46
|
+
*/
|
|
47
|
+
mobileProps?: MobileProps;
|
|
48
|
+
/**
|
|
49
|
+
* Контрольная точка, с нее начинается desktop версия
|
|
50
|
+
* @default 1024
|
|
51
|
+
*/
|
|
52
|
+
breakpoint?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Значение по-умолчанию для хука useMatchMedia
|
|
55
|
+
*/
|
|
56
|
+
defaultMatchMediaValue?: boolean | (() => boolean);
|
|
57
|
+
}
|
|
58
|
+
export { InputAutocompleteCommonProps, InputAutocompleteMobileProps, InputAutocompleteProps };
|
package/cssm/types.js
ADDED
package/cssm/utils.d.ts
ADDED
package/cssm/utils.js
ADDED
package/desktop/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { InputAutocompleteDesktop
|
|
2
|
-
export {};
|
|
1
|
+
export { InputAutocompleteDesktop } from "../Component.desktop";
|
|
2
|
+
export type { InputAutocompleteCommonProps as InputAutocompleteDesktopProps } from "../types";
|
package/desktop/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var Component_desktop = require('../Component.desktop.js');
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('react');
|
|
8
|
+
require('@alfalab/core-components-popover');
|
|
8
9
|
require('@alfalab/core-components-select/shared');
|
|
9
10
|
require('../autocomplete-field/Component.js');
|
|
10
11
|
require('react-merge-refs');
|
|
@@ -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/esm/Component.desktop.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
+
import { Popover } from '@alfalab/core-components-popover/esm';
|
|
3
4
|
import { BaseSelect, OptionsList, Optgroup, Option } from '@alfalab/core-components-select/esm/shared';
|
|
4
5
|
import { AutocompleteField } from './autocomplete-field/Component.js';
|
|
5
6
|
import 'react-merge-refs';
|
|
@@ -8,7 +9,7 @@ import '@alfalab/core-components-input/esm/desktop';
|
|
|
8
9
|
|
|
9
10
|
var InputAutocompleteDesktop = forwardRef(function (_a, ref) {
|
|
10
11
|
var _b = _a.OptionsList, OptionsList$1 = _b === void 0 ? OptionsList : _b, _c = _a.Optgroup, Optgroup$1 = _c === void 0 ? Optgroup : _c, _d = _a.Option, Option$1 = _d === void 0 ? 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 = __rest(_a, ["OptionsList", "Optgroup", "Option", "Input", "inputProps", "onInput", "value", "success", "readOnly", "closeOnSelect", "options"]);
|
|
11
|
-
return (React.createElement(BaseSelect, __assign({ ref: ref, autocomplete: true, options: options, closeOnSelect: closeOnSelect, Option: Option$1, Field: AutocompleteField, Optgroup: Optgroup$1, OptionsList: OptionsList$1 }, restProps, { fieldProps: __assign(__assign({}, restProps.fieldProps), { Input: Input, onInput: onInput, value: value, inputProps: inputProps, readOnly: readOnly, success: success }) })));
|
|
12
|
+
return (React.createElement(BaseSelect, __assign({ view: 'desktop', Popover: Popover, ref: ref, autocomplete: true, options: options, closeOnSelect: closeOnSelect, Option: Option$1, Field: AutocompleteField, Optgroup: Optgroup$1, OptionsList: OptionsList$1 }, restProps, { fieldProps: __assign(__assign({}, restProps.fieldProps), { Input: Input, onInput: onInput, value: value, inputProps: inputProps, readOnly: readOnly, success: success }) })));
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
export { InputAutocompleteDesktop };
|
|
@@ -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 };
|