@alfalab/core-components-input-autocomplete 9.1.4 → 9.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/Component-7ca84eff.d.ts +3 -2
- package/Component.d.ts +4 -4
- package/Component.js +4 -10
- package/Component.mobile.d.ts +2 -2
- package/Component.mobile.js +18 -20
- package/autocomplete-field/Component.js +5 -13
- package/autocomplete-field/index.css +2 -2
- package/autocomplete-field/index.js +2 -4
- package/autocomplete-mobile-field/Component.js +9 -16
- package/autocomplete-mobile-field/index.css +8 -8
- package/autocomplete-mobile-field/index.js +2 -4
- package/cssm/Component-7ca84eff.d.ts +3 -2
- package/cssm/Component.js +4 -10
- package/cssm/Component.mobile.d.ts +2 -2
- package/cssm/Component.mobile.js +18 -21
- package/cssm/autocomplete-field/Component.js +5 -14
- package/cssm/autocomplete-field/index.js +2 -4
- package/cssm/autocomplete-mobile-field/Component.js +10 -18
- package/cssm/autocomplete-mobile-field/index.js +2 -4
- package/cssm/getDataTestId-3fe0d3e6.d.ts +1 -1
- package/cssm/index-bdb4c6b9.d.ts +3 -2
- package/cssm/index.js +4 -6
- package/cssm/mobile.d.ts +1 -0
- package/cssm/mobile.js +3 -5
- package/cssm/{tslib.es6-9682e485.d.ts → tslib.es6-bbd6cd2a.d.ts} +0 -0
- package/cssm/{tslib.es6-9682e485.js → tslib.es6-bbd6cd2a.js} +0 -0
- package/esm/Component-7ca84eff.d.ts +3 -2
- package/esm/Component.js +3 -3
- package/esm/Component.mobile.d.ts +2 -2
- package/esm/Component.mobile.js +14 -7
- package/esm/autocomplete-field/Component.js +2 -2
- package/esm/autocomplete-field/index.css +2 -2
- package/esm/autocomplete-field/index.js +2 -2
- package/esm/autocomplete-mobile-field/Component.js +4 -4
- package/esm/autocomplete-mobile-field/index.css +8 -8
- package/esm/autocomplete-mobile-field/index.js +2 -2
- package/esm/getDataTestId-3fe0d3e6.d.ts +1 -1
- package/esm/index-bdb4c6b9.d.ts +3 -2
- package/esm/index.js +4 -4
- package/esm/mobile.css +4 -4
- package/esm/mobile.d.ts +1 -0
- package/esm/mobile.js +3 -3
- package/esm/{tslib.es6-2208c38d.d.ts → tslib.es6-18b090e0.d.ts} +0 -0
- package/esm/{tslib.es6-2208c38d.js → tslib.es6-18b090e0.js} +0 -0
- package/getDataTestId-3fe0d3e6.d.ts +1 -1
- package/index-bdb4c6b9.d.ts +3 -2
- package/index.js +4 -6
- package/mobile.css +4 -4
- package/mobile.d.ts +1 -0
- package/mobile.js +3 -5
- package/modern/Component-7ca84eff.d.ts +3 -2
- package/modern/Component.js +2 -2
- package/modern/Component.mobile.d.ts +2 -2
- package/modern/Component.mobile.js +13 -6
- package/modern/autocomplete-field/Component.js +1 -1
- package/modern/autocomplete-field/index.css +2 -2
- package/modern/autocomplete-field/index.js +1 -1
- package/modern/autocomplete-mobile-field/Component.js +2 -2
- package/modern/autocomplete-mobile-field/index.css +8 -8
- package/modern/autocomplete-mobile-field/index.js +1 -1
- package/modern/getDataTestId-3fe0d3e6.d.ts +1 -1
- package/modern/index-bdb4c6b9.d.ts +3 -2
- package/modern/index.js +3 -3
- package/modern/mobile.css +4 -4
- package/modern/mobile.d.ts +1 -0
- package/modern/mobile.js +2 -2
- package/package.json +2 -2
- /package/{tslib.es6-8ec3b181.d.ts → tslib.es6-62ba2400.d.ts} +0 -0
- /package/{tslib.es6-8ec3b181.js → tslib.es6-62ba2400.js} +0 -0
|
@@ -5,15 +5,15 @@ import throttle from 'lodash.throttle';
|
|
|
5
5
|
import { Button } from '@alfalab/core-components-button/modern';
|
|
6
6
|
import { Input } from '@alfalab/core-components-input/modern';
|
|
7
7
|
import { SelectMobile } from '@alfalab/core-components-select/modern';
|
|
8
|
+
import { AutocompleteMobileField } from './autocomplete-mobile-field/Component.js';
|
|
8
9
|
import '@alfalab/core-components-form-control/modern';
|
|
9
10
|
import '@alfalab/hooks';
|
|
10
|
-
import { AutocompleteMobileField } from './autocomplete-mobile-field/Component.js';
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const styles = {"bottomSheetInput":"input-autocomplete__bottomSheetInput_frpur","footer":"input-autocomplete__footer_frpur"};
|
|
13
13
|
require('./mobile.css')
|
|
14
14
|
|
|
15
15
|
const SELECTED = [];
|
|
16
|
-
const InputAutocompleteMobile = React.forwardRef(({ Input: Input$1, bottomSheetProps = {}, bottomSheetHeaderAddonsProps = {}, value = '', filter = '', name, Arrow = null, label, placeholder, size = 's', open: openProp, onFilter, onChange, onOpen, onCancel, onClearFilter, continueButtonProps, cancelButtonProps, ...restProps }, ref) => {
|
|
16
|
+
const InputAutocompleteMobile = React.forwardRef(({ Input: Input$1, bottomSheetProps = {}, bottomSheetHeaderAddonsProps = {}, value = '', filter = '', name, Arrow = null, label, placeholder, size = 's', open: openProp, onFilter, onChange, onOpen, onCancel, onClearFilter, continueButtonProps, cancelButtonProps, selected, multiple, ...restProps }, ref) => {
|
|
17
17
|
const [open, setOpen] = useState(false);
|
|
18
18
|
const bottomSheetInputRef = useRef(null);
|
|
19
19
|
const targetRef = useRef(null);
|
|
@@ -34,10 +34,17 @@ const InputAutocompleteMobile = React.forwardRef(({ Input: Input$1, bottomSheetP
|
|
|
34
34
|
input.blur();
|
|
35
35
|
}
|
|
36
36
|
}, 300), []);
|
|
37
|
-
const
|
|
37
|
+
const handleApply = () => {
|
|
38
38
|
setBottomSheetVisibility(false);
|
|
39
39
|
onChange(filter);
|
|
40
40
|
};
|
|
41
|
+
const handleChange = (payload) => {
|
|
42
|
+
onChange(payload);
|
|
43
|
+
if (multiple) {
|
|
44
|
+
// После выбора опции возвращаем фокус в поле ввода.
|
|
45
|
+
requestAnimationFrame(() => bottomSheetInputRef.current?.focus());
|
|
46
|
+
}
|
|
47
|
+
};
|
|
41
48
|
const handleCancel = () => {
|
|
42
49
|
setBottomSheetVisibility(false);
|
|
43
50
|
if (onCancel) {
|
|
@@ -57,7 +64,7 @@ const InputAutocompleteMobile = React.forwardRef(({ Input: Input$1, bottomSheetP
|
|
|
57
64
|
const Component = Input$1 || Input;
|
|
58
65
|
return {
|
|
59
66
|
actionButton: (React.createElement("div", { className: styles.footer },
|
|
60
|
-
React.createElement(Button, { block: true, view: 'primary', size: 's', onClick:
|
|
67
|
+
React.createElement(Button, { block: true, view: 'primary', size: 's', onClick: handleApply, ...continueButtonProps }, "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C"),
|
|
61
68
|
React.createElement(Button, { block: true, view: 'secondary', size: 's', onClick: handleCancel, ...cancelButtonProps }, "\u041E\u0442\u043C\u0435\u043D\u0430"))),
|
|
62
69
|
title: label || placeholder,
|
|
63
70
|
bottomAddons: (React.createElement(Component, { block: true, clear: !!onClearFilter, onClear: onClearFilter, value: filter, onInput: onFilter, placeholder: placeholder, onFocus: handleInputFocus, ...bottomSheetHeaderAddonsProps, className: cn(styles.bottomSheetInput, bottomSheetHeaderAddonsProps.className), ref: mergeRefs([
|
|
@@ -72,7 +79,7 @@ const InputAutocompleteMobile = React.forwardRef(({ Input: Input$1, bottomSheetP
|
|
|
72
79
|
},
|
|
73
80
|
};
|
|
74
81
|
};
|
|
75
|
-
return (React.createElement(SelectMobile, { ref: mergeRefs([targetRef, ref]), selected: SELECTED, open: Boolean(open || openProp), onOpen: handleOpen, onChange:
|
|
82
|
+
return (React.createElement(SelectMobile, { ref: mergeRefs([targetRef, ref]), selected: selected || SELECTED, open: Boolean(open || openProp), onOpen: handleOpen, onChange: handleChange, Arrow: Arrow, Field: AutocompleteMobileField, fieldProps: { value }, placeholder: placeholder, label: label, size: size, name: name, multiple: multiple, bottomSheetProps: getBottomSheetProps(), optionsListProps: { showFooter: false }, ...restProps }));
|
|
76
83
|
});
|
|
77
84
|
|
|
78
85
|
export { InputAutocompleteMobile };
|
|
@@ -3,7 +3,7 @@ import mergeRefs from 'react-merge-refs';
|
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { Input } from '@alfalab/core-components-input/modern';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const styles = {"arrow":"input-autocomplete__arrow_db1on","error":"input-autocomplete__error_db1on"};
|
|
7
7
|
require('./index.css')
|
|
8
8
|
|
|
9
9
|
const AutocompleteField = ({ label, labelView = 'inner', placeholder, size, Arrow, Input: Input$1 = Input, value, error, success, hint, disabled, readOnly, onInput, inputProps = {}, innerProps, }) => {
|
|
@@ -3,7 +3,7 @@ import cn from 'classnames';
|
|
|
3
3
|
import { FormControl } from '@alfalab/core-components-form-control/modern';
|
|
4
4
|
import { useFocus } from '@alfalab/hooks';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const styles = {"component":"input-autocomplete__component_uqles","field":"input-autocomplete__field_uqles","disabled":"input-autocomplete__disabled_uqles","placeholder":"input-autocomplete__placeholder_uqles","contentWrapper":"input-autocomplete__contentWrapper_uqles","value":"input-autocomplete__value_uqles","focusVisible":"input-autocomplete__focusVisible_uqles"};
|
|
7
7
|
require('./index.css')
|
|
8
8
|
|
|
9
9
|
const AutocompleteMobileField = ({ size = 'm', open, error, hint, disabled, label, labelView = 'inner', placeholder, value, innerProps, dataTestId, fieldClassName, Arrow, valueRenderer, toggleMenu, setSelectedItems, selectedMultiple, ...restProps }) => {
|
|
@@ -16,7 +16,7 @@ const AutocompleteMobileField = ({ size = 'm', open, error, hint, disabled, labe
|
|
|
16
16
|
React.createElement(FormControl, { fieldClassName: cn(styles.field, fieldClassName, {
|
|
17
17
|
[styles.disabled]: disabled,
|
|
18
18
|
[styles.focusVisible]: focusVisible,
|
|
19
|
-
}), block: true, size: size, focused: focused, disabled: disabled, filled: filled, label: showLabel && label, labelView: labelView, error: error, hint: hint, "data-test-id": dataTestId, ...restProps, ...innerProps },
|
|
19
|
+
}), block: true, size: size, focused: focused, disabled: disabled, filled: filled, label: showLabel && label, labelView: labelView, error: error, hint: hint, rightAddons: Arrow, "data-test-id": dataTestId, ...restProps, ...innerProps },
|
|
20
20
|
React.createElement("div", { className: styles.contentWrapper },
|
|
21
21
|
placeholder && !filled && (React.createElement("span", { className: styles.placeholder }, placeholder)),
|
|
22
22
|
filled && React.createElement("div", { className: styles.value }, value)))));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 8rusi */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-link: #007aff;
|
|
4
4
|
--color-light-text-secondary: rgba(11, 31, 53, 0.7);
|
|
@@ -15,20 +15,20 @@
|
|
|
15
15
|
--focus-color: var(--color-light-border-link);
|
|
16
16
|
--disabled-cursor: not-allowed;
|
|
17
17
|
}
|
|
18
|
-
.input-
|
|
18
|
+
.input-autocomplete__component_uqles {
|
|
19
19
|
width: 100%;
|
|
20
20
|
outline: none;
|
|
21
21
|
}
|
|
22
|
-
.input-
|
|
22
|
+
.input-autocomplete__field_uqles:not(.input-autocomplete__disabled_uqles) {
|
|
23
23
|
cursor: pointer;
|
|
24
24
|
}
|
|
25
|
-
.input-
|
|
25
|
+
.input-autocomplete__disabled_uqles {
|
|
26
26
|
cursor: var(--disabled-cursor);
|
|
27
27
|
}
|
|
28
|
-
.input-
|
|
28
|
+
.input-autocomplete__placeholder_uqles {
|
|
29
29
|
color: var(--color-light-text-secondary);
|
|
30
30
|
}
|
|
31
|
-
.input-
|
|
31
|
+
.input-autocomplete__contentWrapper_uqles {
|
|
32
32
|
font-size: 16px;
|
|
33
33
|
line-height: 20px;
|
|
34
34
|
font-weight: 400;
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
overflow: hidden;
|
|
39
39
|
width: 100%;
|
|
40
40
|
}
|
|
41
|
-
.input-
|
|
41
|
+
.input-autocomplete__value_uqles {
|
|
42
42
|
overflow: hidden;
|
|
43
43
|
text-overflow: ellipsis;
|
|
44
44
|
text-align: left;
|
|
45
45
|
}
|
|
46
|
-
.input-
|
|
46
|
+
.input-autocomplete__focusVisible_uqles {
|
|
47
47
|
outline: 2px solid var(--focus-color);
|
|
48
48
|
outline-offset: 2px;
|
|
49
49
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getDataTestId: (dataTestId?: string
|
|
1
|
+
declare const getDataTestId: (dataTestId?: string, element?: string) => string | undefined;
|
|
2
2
|
export { getDataTestId };
|
|
@@ -151,7 +151,7 @@ declare function isScrolledToBottom(target: HTMLElement): boolean;
|
|
|
151
151
|
declare function hasScrollbar(target: HTMLElement): boolean;
|
|
152
152
|
declare const getScrollbarSize: () => number;
|
|
153
153
|
declare const restoreContainerStyles: (container: HTMLElement) => void;
|
|
154
|
-
declare const handleContainer: (container?: HTMLElement
|
|
154
|
+
declare const handleContainer: (container?: HTMLElement) => void;
|
|
155
155
|
/**
|
|
156
156
|
* Набор констант для z-index соответствующих классов компонентов.
|
|
157
157
|
* Значения выбраны по приоритету.
|
|
@@ -201,4 +201,5 @@ declare class GlobalStore {
|
|
|
201
201
|
constructor();
|
|
202
202
|
getModalStore: () => ModalStore;
|
|
203
203
|
}
|
|
204
|
-
export { BaseModalProps, BaseModalContext, BaseModal, isScrolledToTop, isScrolledToBottom, hasScrollbar, getScrollbarSize, restoreContainerStyles, handleContainer, stackingOrder, StackingContext, StackProps, Stack, PORTAL_CONTAINER_ATTRIBUTE, getDefaultPortalContainer, setRef,
|
|
204
|
+
export { BaseModalProps, BaseModalContext, BaseModal, isScrolledToTop, isScrolledToBottom, hasScrollbar, getScrollbarSize, restoreContainerStyles, handleContainer, stackingOrder, StackingContext, StackProps, Stack, PORTAL_CONTAINER_ATTRIBUTE, getDefaultPortalContainer, setRef, getModalStore, GlobalStore };
|
|
205
|
+
export type { SavedStyle };
|
package/modern/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export { InputAutocomplete } from './Component.js';
|
|
1
2
|
import 'react';
|
|
3
|
+
import '@alfalab/core-components-select/modern';
|
|
4
|
+
import './autocomplete-field/Component.js';
|
|
2
5
|
import 'react-merge-refs';
|
|
3
6
|
import 'classnames';
|
|
4
7
|
import '@alfalab/core-components-input/modern';
|
|
5
|
-
import '@alfalab/core-components-select/modern';
|
|
6
|
-
import './autocomplete-field/Component.js';
|
|
7
|
-
export { InputAutocomplete } from './Component.js';
|
package/modern/mobile.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: dy48v */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
--gap-xs: 8px;
|
|
12
12
|
--gap-m: 16px;
|
|
13
13
|
}
|
|
14
|
-
.input-
|
|
14
|
+
.input-autocomplete__bottomSheetInput_frpur {
|
|
15
15
|
padding: 0 var(--gap-xs) var(--gap-xs);
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
}
|
|
18
|
-
.input-
|
|
18
|
+
.input-autocomplete__footer_frpur {
|
|
19
19
|
display: flex
|
|
20
20
|
}
|
|
21
|
-
.input-
|
|
21
|
+
.input-autocomplete__footer_frpur > button + button {
|
|
22
22
|
margin-left: var(--gap-m);
|
|
23
23
|
}
|
package/modern/mobile.d.ts
CHANGED
package/modern/mobile.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { InputAutocompleteMobile } from './Component.mobile.js';
|
|
1
2
|
import 'react';
|
|
2
3
|
import 'react-merge-refs';
|
|
3
4
|
import 'classnames';
|
|
@@ -5,7 +6,6 @@ import 'lodash.throttle';
|
|
|
5
6
|
import '@alfalab/core-components-button/modern';
|
|
6
7
|
import '@alfalab/core-components-input/modern';
|
|
7
8
|
import '@alfalab/core-components-select/modern';
|
|
9
|
+
import './autocomplete-mobile-field/Component.js';
|
|
8
10
|
import '@alfalab/core-components-form-control/modern';
|
|
9
11
|
import '@alfalab/hooks';
|
|
10
|
-
import './autocomplete-mobile-field/Component.js';
|
|
11
|
-
export { InputAutocompleteMobile } from './Component.mobile.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-input-autocomplete",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@alfalab/core-components-button": "^7.0.1",
|
|
21
21
|
"@alfalab/core-components-form-control": "^9.0.1",
|
|
22
22
|
"@alfalab/core-components-input": "^11.1.0",
|
|
23
|
-
"@alfalab/core-components-select": "^13.2.
|
|
23
|
+
"@alfalab/core-components-select": "^13.2.2",
|
|
24
24
|
"@alfalab/hooks": "^1.4.1",
|
|
25
25
|
"classnames": "^2.3.1",
|
|
26
26
|
"lodash.throttle": "^4.1.1",
|
|
File without changes
|
|
File without changes
|