@alfalab/core-components-input-autocomplete 12.7.2 → 12.8.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.d.ts +1 -1
- package/autocomplete-mobile-field/Component.js +12 -6
- package/autocomplete-mobile-field/index.css +41 -9
- package/cssm/autocomplete-mobile-field/Component.d.ts +1 -1
- package/cssm/autocomplete-mobile-field/Component.js +11 -5
- package/cssm/autocomplete-mobile-field/index.module.css +34 -2
- package/cssm/mobile/Component.mobile.js +2 -2
- package/cssm/mobile/mobile.module.css +3 -0
- package/cssm/utils.d.ts +4 -0
- package/cssm/utils.js +4 -0
- package/cssm/vars.css +5 -0
- package/esm/autocomplete-field/Component.js +1 -1
- package/esm/autocomplete-field/index.css +2 -2
- package/esm/autocomplete-mobile-field/Component.d.ts +1 -1
- package/esm/autocomplete-mobile-field/Component.js +12 -6
- package/esm/autocomplete-mobile-field/index.css +41 -9
- package/esm/mobile/Component.mobile.js +3 -3
- package/esm/mobile/mobile.css +5 -2
- package/esm/utils.d.ts +4 -0
- package/esm/utils.js +4 -0
- package/mobile/Component.mobile.js +3 -3
- package/mobile/mobile.css +5 -2
- package/modern/autocomplete-field/Component.js +1 -1
- package/modern/autocomplete-field/index.css +2 -2
- package/modern/autocomplete-mobile-field/Component.d.ts +1 -1
- package/modern/autocomplete-mobile-field/Component.js +12 -6
- package/modern/autocomplete-mobile-field/index.css +41 -9
- package/modern/mobile/Component.mobile.js +3 -2
- package/modern/mobile/mobile.css +5 -2
- package/modern/utils.d.ts +4 -0
- package/modern/utils.js +4 -0
- package/moderncssm/autocomplete-mobile-field/Component.d.ts +1 -1
- package/moderncssm/autocomplete-mobile-field/Component.js +11 -5
- package/moderncssm/autocomplete-mobile-field/index.module.css +34 -6
- package/moderncssm/mobile/Component.mobile.js +2 -1
- package/moderncssm/utils.d.ts +4 -0
- package/moderncssm/utils.js +4 -0
- package/moderncssm/vars.css +5 -0
- package/package.json +8 -7
- package/src/autocomplete-mobile-field/Component.tsx +34 -15
- package/src/autocomplete-mobile-field/index.module.css +37 -0
- package/src/mobile/Component.mobile.tsx +2 -0
- package/src/utils.ts +4 -0
- package/src/vars.css +8 -0
- package/utils.d.ts +4 -0
- package/utils.js +4 -0
package/moderncssm/utils.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ declare function getInputAutocompleteDesktopTestIds(dataTestId: string): {
|
|
|
9
9
|
fieldLeftAddons: string;
|
|
10
10
|
fieldRightAddons: string;
|
|
11
11
|
fieldError: string;
|
|
12
|
+
fieldErrorIcon: string;
|
|
13
|
+
fieldSuccessIcon: string;
|
|
12
14
|
fieldHint: string;
|
|
13
15
|
};
|
|
14
16
|
declare function getInputAutocompleteMobileTestIds(dataTestId: string): {
|
|
@@ -28,6 +30,8 @@ declare function getInputAutocompleteMobileTestIds(dataTestId: string): {
|
|
|
28
30
|
fieldLeftAddons: string;
|
|
29
31
|
fieldRightAddons: string;
|
|
30
32
|
fieldError: string;
|
|
33
|
+
fieldErrorIcon: string;
|
|
34
|
+
fieldSuccessIcon: string;
|
|
31
35
|
fieldHint: string;
|
|
32
36
|
searchInput: string;
|
|
33
37
|
searchFormControl: string;
|
package/moderncssm/utils.js
CHANGED
|
@@ -14,6 +14,8 @@ function getInputAutocompleteDesktopTestIds(dataTestId) {
|
|
|
14
14
|
fieldLeftAddons: getDataTestId(dataTestId, 'field-form-control-left-addons'),
|
|
15
15
|
fieldRightAddons: getDataTestId(dataTestId, 'field-form-control-right-addons'),
|
|
16
16
|
fieldError: getDataTestId(dataTestId, 'field-form-control-error-message'),
|
|
17
|
+
fieldErrorIcon: getDataTestId(dataTestId, 'field-form-control-error-icon'),
|
|
18
|
+
fieldSuccessIcon: getDataTestId(dataTestId, 'field-form-control-success-icon'),
|
|
17
19
|
fieldHint: getDataTestId(dataTestId, 'field-form-control-hint'),
|
|
18
20
|
};
|
|
19
21
|
}
|
|
@@ -35,6 +37,8 @@ function getInputAutocompleteMobileTestIds(dataTestId) {
|
|
|
35
37
|
fieldLeftAddons: getDataTestId(dataTestId, 'field-form-control-left-addons'),
|
|
36
38
|
fieldRightAddons: getDataTestId(dataTestId, 'field-form-control-right-addons'),
|
|
37
39
|
fieldError: getDataTestId(dataTestId, 'field-form-control-error-message'),
|
|
40
|
+
fieldErrorIcon: getDataTestId(dataTestId, 'field-error-icon'),
|
|
41
|
+
fieldSuccessIcon: getDataTestId(dataTestId, 'field-success-icon'),
|
|
38
42
|
fieldHint: getDataTestId(dataTestId, 'field-form-control-hint'),
|
|
39
43
|
searchInput: getDataTestId(dataTestId, 'search'),
|
|
40
44
|
searchFormControl: getDataTestId(dataTestId, 'search-form-control'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-input-autocomplete",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
"react": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alfalab/core-components-form-control": "^12.8.
|
|
19
|
-
"@alfalab/core-components-input": "^15.5.
|
|
20
|
-
"@alfalab/core-components-popover": "^6.3.
|
|
21
|
-
"@alfalab/core-components-select": "^17.20.
|
|
22
|
-
"@alfalab/core-components-
|
|
18
|
+
"@alfalab/core-components-form-control": "^12.8.1",
|
|
19
|
+
"@alfalab/core-components-input": "^15.5.1",
|
|
20
|
+
"@alfalab/core-components-popover": "^6.3.7",
|
|
21
|
+
"@alfalab/core-components-select": "^17.20.3",
|
|
22
|
+
"@alfalab/core-components-status-badge": "^1.2.3",
|
|
23
|
+
"@alfalab/core-components-shared": "^0.15.0",
|
|
23
24
|
"@alfalab/core-components-mq": "^4.4.1",
|
|
24
25
|
"@alfalab/hooks": "^1.13.1",
|
|
25
26
|
"classnames": "^2.5.1",
|
|
@@ -31,5 +32,5 @@
|
|
|
31
32
|
"@types/lodash": "^4.17.13"
|
|
32
33
|
},
|
|
33
34
|
"themesVersion": "13.7.0",
|
|
34
|
-
"varsVersion": "9.
|
|
35
|
+
"varsVersion": "9.18.0"
|
|
35
36
|
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { ClearButton } from '@alfalab/core-components-input/shared';
|
|
9
9
|
import type { FieldProps as BaseFieldProps } from '@alfalab/core-components-select/shared';
|
|
10
10
|
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
11
|
+
import { StatusBadge } from '@alfalab/core-components-status-badge';
|
|
11
12
|
import { useFocus } from '@alfalab/hooks';
|
|
12
13
|
|
|
13
14
|
import styles from './index.module.css';
|
|
@@ -47,6 +48,7 @@ export const AutocompleteMobileField = ({
|
|
|
47
48
|
error,
|
|
48
49
|
readOnly,
|
|
49
50
|
clear,
|
|
51
|
+
success,
|
|
50
52
|
onClear,
|
|
51
53
|
onInput,
|
|
52
54
|
colors = 'default',
|
|
@@ -64,6 +66,37 @@ export const AutocompleteMobileField = ({
|
|
|
64
66
|
|
|
65
67
|
const { tabIndex, ...restInnerProps } = innerProps;
|
|
66
68
|
|
|
69
|
+
const formRightAddons = (Arrow || rightAddons || clearButtonVisible || error || success) && (
|
|
70
|
+
<React.Fragment>
|
|
71
|
+
{clearButtonVisible && (
|
|
72
|
+
<ClearButton onClick={onClear} disabled={disabled} colors={colors} />
|
|
73
|
+
)}
|
|
74
|
+
{rightAddons}
|
|
75
|
+
{Arrow}
|
|
76
|
+
{error && (
|
|
77
|
+
<div
|
|
78
|
+
className={cn(styles.errorIcon, styles[`size-${size}`])}
|
|
79
|
+
data-addon='error-icon'
|
|
80
|
+
>
|
|
81
|
+
<StatusBadge
|
|
82
|
+
view='negative-alert'
|
|
83
|
+
size={size === 40 ? 16 : 20}
|
|
84
|
+
dataTestId={getDataTestId(dataTestId, 'error-icon')}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
{success && !error && (
|
|
89
|
+
<div className={cn(styles.successIcon, styles[`size-${size}`])}>
|
|
90
|
+
<StatusBadge
|
|
91
|
+
view='positive-checkmark'
|
|
92
|
+
size={size === 40 ? 16 : 20}
|
|
93
|
+
dataTestId={getDataTestId(dataTestId, 'success-icon')}
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
</React.Fragment>
|
|
98
|
+
);
|
|
99
|
+
|
|
67
100
|
return (
|
|
68
101
|
<div
|
|
69
102
|
className={styles.component}
|
|
@@ -90,21 +123,7 @@ export const AutocompleteMobileField = ({
|
|
|
90
123
|
readOnly={readOnly}
|
|
91
124
|
colors={colors}
|
|
92
125
|
error={error}
|
|
93
|
-
rightAddons={
|
|
94
|
-
(Arrow || rightAddons || clearButtonVisible) && (
|
|
95
|
-
<React.Fragment>
|
|
96
|
-
{clearButtonVisible && (
|
|
97
|
-
<ClearButton
|
|
98
|
-
onClick={onClear}
|
|
99
|
-
disabled={disabled}
|
|
100
|
-
colors={colors}
|
|
101
|
-
/>
|
|
102
|
-
)}
|
|
103
|
-
{rightAddons}
|
|
104
|
-
{Arrow}
|
|
105
|
-
</React.Fragment>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
126
|
+
rightAddons={formRightAddons}
|
|
108
127
|
>
|
|
109
128
|
<div className={styles.contentWrapper}>
|
|
110
129
|
{showPlaceholder && <span className={styles.placeholder}>{placeholder}</span>}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
|
+
@import '../vars.css';
|
|
2
3
|
|
|
3
4
|
.component {
|
|
4
5
|
width: 100%;
|
|
@@ -9,6 +10,42 @@
|
|
|
9
10
|
cursor: pointer;
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
.errorIcon {
|
|
14
|
+
display: var(--input-error-icon-display);
|
|
15
|
+
|
|
16
|
+
&:not(:only-child) {
|
|
17
|
+
margin-left: var(--gap-4);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.size-40:not(:only-child) {
|
|
21
|
+
margin-left: 6px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
* + .errorIcon {
|
|
26
|
+
display: var(--input-error-icon-not-alone-display);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
button[class*='eye'] + .errorIcon {
|
|
30
|
+
margin-right: var(--gap-12);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.successIcon {
|
|
34
|
+
display: var(--input-success-icon-display);
|
|
35
|
+
|
|
36
|
+
&:not(:only-child) {
|
|
37
|
+
margin-left: var(--gap-4);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.size-40:not(:only-child) {
|
|
41
|
+
margin-left: 6px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
button[class*='eye'] + .successIcon {
|
|
46
|
+
margin-right: var(--gap-12);
|
|
47
|
+
}
|
|
48
|
+
|
|
12
49
|
.disabled {
|
|
13
50
|
cursor: var(--disabled-cursor);
|
|
14
51
|
}
|
|
@@ -43,6 +43,7 @@ export const InputAutocompleteMobile = React.forwardRef(
|
|
|
43
43
|
onCancel,
|
|
44
44
|
onApply,
|
|
45
45
|
title,
|
|
46
|
+
success,
|
|
46
47
|
...restProps
|
|
47
48
|
}: InputAutocompleteMobileProps,
|
|
48
49
|
ref,
|
|
@@ -171,6 +172,7 @@ export const InputAutocompleteMobile = React.forwardRef(
|
|
|
171
172
|
value: isOpen ? frozenValue.current : value,
|
|
172
173
|
clear,
|
|
173
174
|
onClear: clear ? inputProps?.onClear : undefined,
|
|
175
|
+
success,
|
|
174
176
|
...(restProps.fieldProps as AnyObject),
|
|
175
177
|
}}
|
|
176
178
|
/>
|
package/src/utils.ts
CHANGED
|
@@ -15,6 +15,8 @@ export function getInputAutocompleteDesktopTestIds(dataTestId: string) {
|
|
|
15
15
|
fieldLeftAddons: getDataTestId(dataTestId, 'field-form-control-left-addons'),
|
|
16
16
|
fieldRightAddons: getDataTestId(dataTestId, 'field-form-control-right-addons'),
|
|
17
17
|
fieldError: getDataTestId(dataTestId, 'field-form-control-error-message'),
|
|
18
|
+
fieldErrorIcon: getDataTestId(dataTestId, 'field-form-control-error-icon'),
|
|
19
|
+
fieldSuccessIcon: getDataTestId(dataTestId, 'field-form-control-success-icon'),
|
|
18
20
|
fieldHint: getDataTestId(dataTestId, 'field-form-control-hint'),
|
|
19
21
|
};
|
|
20
22
|
}
|
|
@@ -37,6 +39,8 @@ export function getInputAutocompleteMobileTestIds(dataTestId: string) {
|
|
|
37
39
|
fieldLeftAddons: getDataTestId(dataTestId, 'field-form-control-left-addons'),
|
|
38
40
|
fieldRightAddons: getDataTestId(dataTestId, 'field-form-control-right-addons'),
|
|
39
41
|
fieldError: getDataTestId(dataTestId, 'field-form-control-error-message'),
|
|
42
|
+
fieldErrorIcon: getDataTestId(dataTestId, 'field-error-icon'),
|
|
43
|
+
fieldSuccessIcon: getDataTestId(dataTestId, 'field-success-icon'),
|
|
40
44
|
fieldHint: getDataTestId(dataTestId, 'field-form-control-hint'),
|
|
41
45
|
searchInput: getDataTestId(dataTestId, 'search'),
|
|
42
46
|
searchFormControl: getDataTestId(dataTestId, 'search-form-control'),
|
package/src/vars.css
ADDED
package/utils.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ declare function getInputAutocompleteDesktopTestIds(dataTestId: string): {
|
|
|
9
9
|
fieldLeftAddons: string;
|
|
10
10
|
fieldRightAddons: string;
|
|
11
11
|
fieldError: string;
|
|
12
|
+
fieldErrorIcon: string;
|
|
13
|
+
fieldSuccessIcon: string;
|
|
12
14
|
fieldHint: string;
|
|
13
15
|
};
|
|
14
16
|
declare function getInputAutocompleteMobileTestIds(dataTestId: string): {
|
|
@@ -28,6 +30,8 @@ declare function getInputAutocompleteMobileTestIds(dataTestId: string): {
|
|
|
28
30
|
fieldLeftAddons: string;
|
|
29
31
|
fieldRightAddons: string;
|
|
30
32
|
fieldError: string;
|
|
33
|
+
fieldErrorIcon: string;
|
|
34
|
+
fieldSuccessIcon: string;
|
|
31
35
|
fieldHint: string;
|
|
32
36
|
searchInput: string;
|
|
33
37
|
searchFormControl: string;
|
package/utils.js
CHANGED
|
@@ -18,6 +18,8 @@ function getInputAutocompleteDesktopTestIds(dataTestId) {
|
|
|
18
18
|
fieldLeftAddons: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-left-addons'),
|
|
19
19
|
fieldRightAddons: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-right-addons'),
|
|
20
20
|
fieldError: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-error-message'),
|
|
21
|
+
fieldErrorIcon: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-error-icon'),
|
|
22
|
+
fieldSuccessIcon: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-success-icon'),
|
|
21
23
|
fieldHint: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-hint'),
|
|
22
24
|
};
|
|
23
25
|
}
|
|
@@ -39,6 +41,8 @@ function getInputAutocompleteMobileTestIds(dataTestId) {
|
|
|
39
41
|
fieldLeftAddons: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-left-addons'),
|
|
40
42
|
fieldRightAddons: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-right-addons'),
|
|
41
43
|
fieldError: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-error-message'),
|
|
44
|
+
fieldErrorIcon: coreComponentsShared.getDataTestId(dataTestId, 'field-error-icon'),
|
|
45
|
+
fieldSuccessIcon: coreComponentsShared.getDataTestId(dataTestId, 'field-success-icon'),
|
|
42
46
|
fieldHint: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-hint'),
|
|
43
47
|
searchInput: coreComponentsShared.getDataTestId(dataTestId, 'search'),
|
|
44
48
|
searchFormControl: coreComponentsShared.getDataTestId(dataTestId, 'search-form-control'),
|