@alfalab/core-components-select 17.8.5 → 17.10.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/components/arrow/Component.js +1 -1
- package/components/arrow/index.css +3 -3
- package/components/base-checkmark/Component.js +1 -1
- package/components/base-checkmark/index.css +6 -6
- package/components/base-option/Component.js +1 -1
- package/components/base-option/index.css +15 -15
- package/components/base-select/Component.js +19 -15
- package/components/base-select/components/list-desktop/list-popover-desktop.js +1 -1
- package/components/base-select/components/list-mobile/list-bottom-sheet-mobile.js +1 -1
- package/components/base-select/components/list-mobile/list-modal-mobile.js +1 -1
- package/components/base-select/index.css +11 -11
- package/components/base-select/mobile.css +12 -12
- package/components/checkmark/Component.js +1 -1
- package/components/checkmark/index.css +10 -10
- package/components/checkmark-mobile/Component.js +1 -1
- package/components/checkmark-mobile/index.css +6 -6
- package/components/clear-button/Component.d.ts +5 -0
- package/components/clear-button/Component.js +22 -0
- package/components/clear-button/index.css +57 -0
- package/components/clear-button/index.d.ts +1 -0
- package/components/clear-button/index.js +9 -0
- package/components/field/Component.d.ts +1 -1
- package/components/field/Component.js +4 -2
- package/components/field/index.css +12 -12
- package/components/footer/Component.js +1 -1
- package/components/footer/index.css +5 -5
- package/components/optgroup/Component.js +1 -1
- package/components/optgroup/index.css +6 -6
- package/components/option/Component.js +1 -1
- package/components/option/index.css +19 -19
- package/components/options-list/Component.js +5 -5
- package/components/options-list/index.css +10 -10
- package/components/search/Component.js +1 -1
- package/components/search/index.css +2 -2
- package/components/virtual-options-list/Component.js +4 -4
- package/components/virtual-options-list/index.css +15 -15
- package/cssm/components/base-select/Component.js +17 -13
- package/cssm/components/clear-button/Component.d.ts +5 -0
- package/cssm/components/clear-button/Component.js +21 -0
- package/cssm/components/clear-button/index.d.ts +1 -0
- package/cssm/components/clear-button/index.js +9 -0
- package/cssm/components/clear-button/index.module.css +56 -0
- package/cssm/components/field/Component.d.ts +1 -1
- package/cssm/components/field/Component.js +3 -1
- package/cssm/components/options-list/Component.js +4 -4
- package/cssm/components/virtual-options-list/Component.js +3 -3
- package/cssm/typings.d.ts +32 -1
- package/cssm/utils.d.ts +1 -0
- package/cssm/utils.js +1 -0
- package/esm/components/arrow/Component.js +1 -1
- package/esm/components/arrow/index.css +3 -3
- package/esm/components/base-checkmark/Component.js +1 -1
- package/esm/components/base-checkmark/index.css +6 -6
- package/esm/components/base-option/Component.js +1 -1
- package/esm/components/base-option/index.css +15 -15
- package/esm/components/base-select/Component.js +19 -15
- package/esm/components/base-select/components/list-desktop/list-popover-desktop.js +1 -1
- package/esm/components/base-select/components/list-mobile/list-bottom-sheet-mobile.js +1 -1
- package/esm/components/base-select/components/list-mobile/list-modal-mobile.js +1 -1
- package/esm/components/base-select/index.css +11 -11
- package/esm/components/base-select/mobile.css +12 -12
- package/esm/components/checkmark/Component.js +1 -1
- package/esm/components/checkmark/index.css +10 -10
- package/esm/components/checkmark-mobile/Component.js +1 -1
- package/esm/components/checkmark-mobile/index.css +6 -6
- package/esm/components/clear-button/Component.d.ts +5 -0
- package/esm/components/clear-button/Component.js +14 -0
- package/esm/components/clear-button/index.css +57 -0
- package/esm/components/clear-button/index.d.ts +1 -0
- package/esm/components/clear-button/index.js +1 -0
- package/esm/components/field/Component.d.ts +1 -1
- package/esm/components/field/Component.js +4 -2
- package/esm/components/field/index.css +12 -12
- package/esm/components/footer/Component.js +1 -1
- package/esm/components/footer/index.css +5 -5
- package/esm/components/optgroup/Component.js +1 -1
- package/esm/components/optgroup/index.css +6 -6
- package/esm/components/option/Component.js +1 -1
- package/esm/components/option/index.css +19 -19
- package/esm/components/options-list/Component.js +5 -5
- package/esm/components/options-list/index.css +10 -10
- package/esm/components/search/Component.js +1 -1
- package/esm/components/search/index.css +2 -2
- package/esm/components/virtual-options-list/Component.js +4 -4
- package/esm/components/virtual-options-list/index.css +15 -15
- package/esm/{list-popover-desktop-ba72a202.js → list-popover-desktop-5d823442.js} +1 -1
- package/esm/mobile/Component.mobile.js +1 -1
- package/esm/mobile.module-83cac113.js +4 -0
- package/esm/presets/index.js +1 -1
- package/esm/presets/useSelectWithApply/hook.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/Component.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.js +1 -1
- package/esm/presets/useSelectWithLoading/hook.js +1 -1
- package/esm/presets/useSelectWithLoading/index.css +2 -2
- package/esm/shared/index.js +1 -1
- package/esm/typings.d.ts +32 -1
- package/esm/utils.d.ts +1 -0
- package/esm/utils.js +1 -0
- package/{list-popover-desktop-851af4b7.js → list-popover-desktop-5bfaa60b.js} +1 -1
- package/mobile/Component.mobile.js +1 -1
- package/mobile.module-81207a22.js +6 -0
- package/modern/components/arrow/Component.js +1 -1
- package/modern/components/arrow/index.css +3 -3
- package/modern/components/base-checkmark/Component.js +1 -1
- package/modern/components/base-checkmark/index.css +6 -6
- package/modern/components/base-option/Component.js +1 -1
- package/modern/components/base-option/index.css +15 -15
- package/modern/components/base-select/Component.js +9 -5
- package/modern/components/base-select/components/list-desktop/list-popover-desktop.js +1 -1
- package/modern/components/base-select/components/list-mobile/list-bottom-sheet-mobile.js +1 -1
- package/modern/components/base-select/components/list-mobile/list-modal-mobile.js +1 -1
- package/modern/components/base-select/index.css +11 -11
- package/modern/components/base-select/mobile.css +12 -12
- package/modern/components/checkmark/Component.js +1 -1
- package/modern/components/checkmark/index.css +10 -10
- package/modern/components/checkmark-mobile/Component.js +1 -1
- package/modern/components/checkmark-mobile/index.css +6 -6
- package/modern/components/clear-button/Component.d.ts +5 -0
- package/modern/components/clear-button/Component.js +11 -0
- package/modern/components/clear-button/index.css +57 -0
- package/modern/components/clear-button/index.d.ts +1 -0
- package/modern/components/clear-button/index.js +1 -0
- package/modern/components/field/Component.d.ts +1 -1
- package/modern/components/field/Component.js +4 -2
- package/modern/components/field/index.css +12 -12
- package/modern/components/footer/Component.js +1 -1
- package/modern/components/footer/index.css +5 -5
- package/modern/components/optgroup/Component.js +1 -1
- package/modern/components/optgroup/index.css +6 -6
- package/modern/components/option/Component.js +1 -1
- package/modern/components/option/index.css +19 -19
- package/modern/components/options-list/Component.js +3 -3
- package/modern/components/options-list/index.css +10 -10
- package/modern/components/search/Component.js +1 -1
- package/modern/components/search/index.css +2 -2
- package/modern/components/virtual-options-list/Component.js +3 -3
- package/modern/components/virtual-options-list/index.css +15 -15
- package/modern/{list-popover-desktop-d34e57f7.js → list-popover-desktop-e0978248.js} +1 -1
- package/modern/mobile/Component.mobile.js +1 -1
- package/modern/mobile.module-aaa81c53.js +4 -0
- package/modern/presets/index.js +1 -1
- package/modern/presets/useSelectWithApply/hook.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/Component.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.js +1 -1
- package/modern/presets/useSelectWithLoading/hook.js +1 -1
- package/modern/presets/useSelectWithLoading/index.css +2 -2
- package/modern/shared/index.js +1 -1
- package/modern/typings.d.ts +32 -1
- package/modern/utils.d.ts +1 -0
- package/modern/utils.js +1 -0
- package/package.json +1 -1
- package/presets/index.js +1 -1
- package/presets/useSelectWithApply/hook.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/Component.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/index.js +1 -1
- package/presets/useSelectWithLoading/hook.js +1 -1
- package/presets/useSelectWithLoading/index.css +2 -2
- package/shared/index.js +1 -1
- package/src/components/base-select/Component.tsx +11 -0
- package/src/components/clear-button/Component.tsx +23 -0
- package/src/components/clear-button/index.module.css +23 -0
- package/src/components/clear-button/index.ts +1 -0
- package/src/components/field/Component.tsx +10 -0
- package/src/components/options-list/Component.tsx +2 -0
- package/src/components/virtual-options-list/Component.tsx +2 -0
- package/src/typings.ts +37 -0
- package/src/utils.ts +1 -0
- package/typings.d.ts +32 -1
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
- package/esm/mobile.module-dfdae193.js +0 -4
- package/mobile.module-355cdfc8.js +0 -6
- package/modern/mobile.module-4df6ec5d.js +0 -4
- /package/esm/{hook-f7f04749.d.ts → hook-92fc6541.d.ts} +0 -0
- /package/esm/{hook-f7f04749.js → hook-92fc6541.js} +0 -0
- /package/esm/{list-popover-desktop-ba72a202.d.ts → list-popover-desktop-5d823442.d.ts} +0 -0
- /package/{hook-d446820e.d.ts → hook-46669d2d.d.ts} +0 -0
- /package/{hook-d446820e.js → hook-46669d2d.js} +0 -0
- /package/{list-popover-desktop-851af4b7.d.ts → list-popover-desktop-5bfaa60b.d.ts} +0 -0
- /package/modern/{hook-59cf6756.d.ts → hook-0ddabed4.d.ts} +0 -0
- /package/modern/{hook-59cf6756.js → hook-0ddabed4.js} +0 -0
- /package/modern/{list-popover-desktop-d34e57f7.d.ts → list-popover-desktop-e0978248.d.ts} +0 -0
|
@@ -86,6 +86,7 @@ export const BaseSelect = forwardRef<unknown, ComponentProps>(
|
|
|
86
86
|
fieldProps = {},
|
|
87
87
|
optionsListProps = {},
|
|
88
88
|
optionProps = {},
|
|
89
|
+
groupOptionProps = {},
|
|
89
90
|
searchProps = {},
|
|
90
91
|
showSearch = false,
|
|
91
92
|
valueRenderer,
|
|
@@ -94,6 +95,8 @@ export const BaseSelect = forwardRef<unknown, ComponentProps>(
|
|
|
94
95
|
onFocus,
|
|
95
96
|
onBlur,
|
|
96
97
|
onScroll,
|
|
98
|
+
onClear,
|
|
99
|
+
clear,
|
|
97
100
|
Arrow,
|
|
98
101
|
Field = () => null,
|
|
99
102
|
OptionsList = () => null,
|
|
@@ -526,6 +529,11 @@ export const BaseSelect = forwardRef<unknown, ComponentProps>(
|
|
|
526
529
|
);
|
|
527
530
|
};
|
|
528
531
|
|
|
532
|
+
const handleFieldClear = (event: MouseEvent<HTMLButtonElement>) => {
|
|
533
|
+
setSelectedItems([]);
|
|
534
|
+
onClear?.(event);
|
|
535
|
+
};
|
|
536
|
+
|
|
529
537
|
const renderSearch = () => {
|
|
530
538
|
if (!showSearch) return null;
|
|
531
539
|
|
|
@@ -621,6 +629,7 @@ export const BaseSelect = forwardRef<unknown, ComponentProps>(
|
|
|
621
629
|
selectedItems={selectedItems}
|
|
622
630
|
setSelectedItems={setSelectedItems}
|
|
623
631
|
toggleMenu={toggleMenu}
|
|
632
|
+
groupOptionProps={groupOptionProps}
|
|
624
633
|
getOptionProps={getOptionProps}
|
|
625
634
|
visibleOptions={view === 'desktop' ? visibleOptions : 0}
|
|
626
635
|
dataTestId={getDataTestId(dataTestId, 'options-list')}
|
|
@@ -670,6 +679,8 @@ export const BaseSelect = forwardRef<unknown, ComponentProps>(
|
|
|
670
679
|
hint={hint}
|
|
671
680
|
valueRenderer={valueRenderer}
|
|
672
681
|
className={fieldClassName}
|
|
682
|
+
clear={clear}
|
|
683
|
+
onClear={handleFieldClear}
|
|
673
684
|
innerProps={{
|
|
674
685
|
onBlur: handleFieldBlur,
|
|
675
686
|
onFocus: disabled ? undefined : handleFieldFocus,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Button } from '@alfalab/core-components-button';
|
|
4
|
+
import { CrossCircleMIcon } from '@alfalab/icons-glyph/CrossCircleMIcon';
|
|
5
|
+
|
|
6
|
+
import { ClearButtonProps } from '../../typings';
|
|
7
|
+
|
|
8
|
+
import styles from './index.module.css';
|
|
9
|
+
|
|
10
|
+
export const ClearButton = ({ disabled, onClick, dataTestId }: ClearButtonProps) => (
|
|
11
|
+
<Button
|
|
12
|
+
type='button'
|
|
13
|
+
view='text'
|
|
14
|
+
disabled={disabled}
|
|
15
|
+
aria-label='Очистить'
|
|
16
|
+
className={styles.clearButton}
|
|
17
|
+
onClick={onClick}
|
|
18
|
+
tabIndex={-1}
|
|
19
|
+
dataTestId={dataTestId}
|
|
20
|
+
>
|
|
21
|
+
<CrossCircleMIcon className={styles.clearIcon} />
|
|
22
|
+
</Button>
|
|
23
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import '@alfalab/core-components-input/src/vars.css';
|
|
2
|
+
@import '../../vars.css';
|
|
3
|
+
|
|
4
|
+
.clearIcon {
|
|
5
|
+
display: block;
|
|
6
|
+
color: var(--color-light-neutral-translucent-500);
|
|
7
|
+
|
|
8
|
+
&:hover {
|
|
9
|
+
color: var(--color-light-neutral-translucent-500-hover);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&:active {
|
|
13
|
+
color: var(--color-light-neutral-translucent-500-press);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.clearButton + [data-addon='error-icon'] {
|
|
18
|
+
display: var(--input-error-icon-display);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.clearButton + * {
|
|
22
|
+
margin-left: var(--gap-2xs);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Component';
|
|
@@ -7,6 +7,7 @@ import { useFocus } from '@alfalab/hooks';
|
|
|
7
7
|
|
|
8
8
|
import { FieldProps as BaseFieldProps } from '../../typings';
|
|
9
9
|
import { joinOptions } from '../../utils';
|
|
10
|
+
import { ClearButton } from '../clear-button';
|
|
10
11
|
|
|
11
12
|
import styles from './index.module.css';
|
|
12
13
|
|
|
@@ -38,6 +39,8 @@ export const Field = ({
|
|
|
38
39
|
dataTestId,
|
|
39
40
|
fieldClassName,
|
|
40
41
|
FormControlComponent,
|
|
42
|
+
clear,
|
|
43
|
+
onClear,
|
|
41
44
|
...restProps
|
|
42
45
|
}: BaseFieldProps & FormControlProps & FieldProps) => {
|
|
43
46
|
const [focused, setFocused] = useState(false);
|
|
@@ -82,6 +85,13 @@ export const Field = ({
|
|
|
82
85
|
(Arrow || rightAddons) && (
|
|
83
86
|
<React.Fragment>
|
|
84
87
|
{rightAddons}
|
|
88
|
+
{clear && filled ? (
|
|
89
|
+
<ClearButton
|
|
90
|
+
onClick={onClear}
|
|
91
|
+
disabled={disabled}
|
|
92
|
+
dataTestId={getDataTestId(dataTestId, 'clear-icon')}
|
|
93
|
+
/>
|
|
94
|
+
) : null}
|
|
85
95
|
{/* TODO: стоит переделать, но это будет мажорка */}
|
|
86
96
|
{Arrow
|
|
87
97
|
? React.cloneElement(Arrow, { className: styles.arrow })
|
|
@@ -29,6 +29,7 @@ export const OptionsList = forwardRef<HTMLDivElement, OptionsListProps>(
|
|
|
29
29
|
scrollbarClassName,
|
|
30
30
|
Option,
|
|
31
31
|
getOptionProps,
|
|
32
|
+
groupOptionProps = {},
|
|
32
33
|
options = [],
|
|
33
34
|
Optgroup = DefaultOptgroup,
|
|
34
35
|
dataTestId,
|
|
@@ -106,6 +107,7 @@ export const OptionsList = forwardRef<HTMLDivElement, OptionsListProps>(
|
|
|
106
107
|
setSelectedItems={handleSelectedItems}
|
|
107
108
|
search={search}
|
|
108
109
|
multiple={multiple}
|
|
110
|
+
{...groupOptionProps}
|
|
109
111
|
>
|
|
110
112
|
{group.options.map((option) => renderOption(option, counter()))}
|
|
111
113
|
</Optgroup>
|
|
@@ -23,6 +23,7 @@ export const VirtualOptionsList = forwardRef<HTMLDivElement, OptionsListProps>(
|
|
|
23
23
|
optionGroupClassName,
|
|
24
24
|
className,
|
|
25
25
|
getOptionProps,
|
|
26
|
+
groupOptionProps = {},
|
|
26
27
|
Option,
|
|
27
28
|
open,
|
|
28
29
|
options = [],
|
|
@@ -169,6 +170,7 @@ export const VirtualOptionsList = forwardRef<HTMLDivElement, OptionsListProps>(
|
|
|
169
170
|
setSelectedItems={handleSelectedItems}
|
|
170
171
|
search={search}
|
|
171
172
|
multiple={multiple}
|
|
173
|
+
{...groupOptionProps}
|
|
172
174
|
/>
|
|
173
175
|
);
|
|
174
176
|
};
|
package/src/typings.ts
CHANGED
|
@@ -273,6 +273,11 @@ export type BaseSelectProps = {
|
|
|
273
273
|
*/
|
|
274
274
|
optionProps?: unknown;
|
|
275
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Пропсы, которые будут прокинуты в компонент группового пункта меню
|
|
278
|
+
*/
|
|
279
|
+
groupOptionProps?: AnyObject;
|
|
280
|
+
|
|
276
281
|
/**
|
|
277
282
|
* Компонент выпадающего меню
|
|
278
283
|
*/
|
|
@@ -336,6 +341,16 @@ export type BaseSelectProps = {
|
|
|
336
341
|
*/
|
|
337
342
|
onScroll?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
338
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Обработчик нажатия на крестик для очистки поля
|
|
346
|
+
*/
|
|
347
|
+
onClear?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Флаг, показать крестик для очистки поля
|
|
351
|
+
*/
|
|
352
|
+
clear?: boolean;
|
|
353
|
+
|
|
339
354
|
/**
|
|
340
355
|
* Хранит функцию, с помощью которой можно обновить положение поповера
|
|
341
356
|
*/
|
|
@@ -516,6 +531,11 @@ export type OptionsListProps = {
|
|
|
516
531
|
*/
|
|
517
532
|
getOptionProps: (option: OptionShape, index: number) => OptionProps;
|
|
518
533
|
|
|
534
|
+
/**
|
|
535
|
+
* Пропсы, которые будут прокинуты в компонент группового пункта меню
|
|
536
|
+
*/
|
|
537
|
+
groupOptionProps?: AnyObject;
|
|
538
|
+
|
|
519
539
|
/**
|
|
520
540
|
* Список выбранных пунктов
|
|
521
541
|
*/
|
|
@@ -904,3 +924,20 @@ export type SelectProps = BaseSelectProps &
|
|
|
904
924
|
*/
|
|
905
925
|
defaultMatchMediaValue?: boolean | (() => boolean);
|
|
906
926
|
};
|
|
927
|
+
|
|
928
|
+
export type ClearButtonProps = {
|
|
929
|
+
/**
|
|
930
|
+
* Обработчик нажатия на крестик для очистки поля
|
|
931
|
+
*/
|
|
932
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Флаг, поле заблокировано
|
|
936
|
+
*/
|
|
937
|
+
disabled?: boolean;
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
941
|
+
*/
|
|
942
|
+
dataTestId?: string;
|
|
943
|
+
};
|
package/src/utils.ts
CHANGED
|
@@ -269,6 +269,7 @@ export function getSelectTestIds(dataTestId: string) {
|
|
|
269
269
|
fieldRightAddons: getDataTestId(dataTestId, 'field-form-control-right-addons'),
|
|
270
270
|
fieldError: getDataTestId(dataTestId, 'field-form-control-error-message'),
|
|
271
271
|
fieldHint: getDataTestId(dataTestId, 'field-form-control-hint'),
|
|
272
|
+
fieldClearIcon: getDataTestId(dataTestId, 'field-clear-icon'),
|
|
272
273
|
searchInput: getDataTestId(dataTestId, 'search'),
|
|
273
274
|
searchFormControl: getDataTestId(dataTestId, 'search-form-control'),
|
|
274
275
|
searchInner: getDataTestId(dataTestId, 'search-form-control-inner'),
|
package/typings.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { AriaAttributes, ComponentType, FC, FocusEvent, MouseEvent, ReactElement, ReactNode, RefAttributes, SVGProps } from 'react';
|
|
2
3
|
import { BottomSheetProps } from "@alfalab/core-components-bottom-sheet";
|
|
3
4
|
import { FormControlProps } from "@alfalab/core-components-form-control";
|
|
@@ -208,6 +209,10 @@ type BaseSelectProps = {
|
|
|
208
209
|
* Пропсы, которые будут прокинуты в компонент пункта меню
|
|
209
210
|
*/
|
|
210
211
|
optionProps?: unknown;
|
|
212
|
+
/**
|
|
213
|
+
* Пропсы, которые будут прокинуты в компонент группового пункта меню
|
|
214
|
+
*/
|
|
215
|
+
groupOptionProps?: AnyObject;
|
|
211
216
|
/**
|
|
212
217
|
* Компонент выпадающего меню
|
|
213
218
|
*/
|
|
@@ -263,6 +268,14 @@ type BaseSelectProps = {
|
|
|
263
268
|
* Обработчик скрола
|
|
264
269
|
*/
|
|
265
270
|
onScroll?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
271
|
+
/**
|
|
272
|
+
* Обработчик нажатия на крестик для очистки поля
|
|
273
|
+
*/
|
|
274
|
+
onClear?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
275
|
+
/**
|
|
276
|
+
* Флаг, показать крестик для очистки поля
|
|
277
|
+
*/
|
|
278
|
+
clear?: boolean;
|
|
266
279
|
/**
|
|
267
280
|
* Хранит функцию, с помощью которой можно обновить положение поповера
|
|
268
281
|
*/
|
|
@@ -400,6 +413,10 @@ type OptionsListProps = {
|
|
|
400
413
|
* Функция для получения пропсов для ячейки
|
|
401
414
|
*/
|
|
402
415
|
getOptionProps: (option: OptionShape, index: number) => OptionProps;
|
|
416
|
+
/**
|
|
417
|
+
* Пропсы, которые будут прокинуты в компонент группового пункта меню
|
|
418
|
+
*/
|
|
419
|
+
groupOptionProps?: AnyObject;
|
|
403
420
|
/**
|
|
404
421
|
* Список выбранных пунктов
|
|
405
422
|
*/
|
|
@@ -710,4 +727,18 @@ type SelectProps = BaseSelectProps & AdditionalMobileProps & ConditionalMobilePr
|
|
|
710
727
|
*/
|
|
711
728
|
defaultMatchMediaValue?: boolean | (() => boolean);
|
|
712
729
|
};
|
|
713
|
-
|
|
730
|
+
type ClearButtonProps = {
|
|
731
|
+
/**
|
|
732
|
+
* Обработчик нажатия на крестик для очистки поля
|
|
733
|
+
*/
|
|
734
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
735
|
+
/**
|
|
736
|
+
* Флаг, поле заблокировано
|
|
737
|
+
*/
|
|
738
|
+
disabled?: boolean;
|
|
739
|
+
/**
|
|
740
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
741
|
+
*/
|
|
742
|
+
dataTestId?: string;
|
|
743
|
+
};
|
|
744
|
+
export { AnyObject, OptionShape, GroupShape, BaseSelectChangePayload, BaseSelectProps, FieldProps, ArrowProps, OptionsListProps, OptgroupProps, OptionProps, CheckmarkProps, SearchProps, SelectFieldProps, AdditionalMobileProps, BottomSheetSelectMobileProps, ModalSelectMobileProps, SelectModalMobileProps, SelectMobileProps, SelectDesktopProps, SelectProps, ClearButtonProps };
|
package/utils.d.ts
CHANGED
package/utils.js
CHANGED
|
@@ -166,6 +166,7 @@ function getSelectTestIds(dataTestId) {
|
|
|
166
166
|
fieldRightAddons: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-right-addons'),
|
|
167
167
|
fieldError: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-error-message'),
|
|
168
168
|
fieldHint: coreComponentsShared.getDataTestId(dataTestId, 'field-form-control-hint'),
|
|
169
|
+
fieldClearIcon: coreComponentsShared.getDataTestId(dataTestId, 'field-clear-icon'),
|
|
169
170
|
searchInput: coreComponentsShared.getDataTestId(dataTestId, 'search'),
|
|
170
171
|
searchFormControl: coreComponentsShared.getDataTestId(dataTestId, 'search-form-control'),
|
|
171
172
|
searchInner: coreComponentsShared.getDataTestId(dataTestId, 'search-form-control-inner'),
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var mobileStyles = {"sheet":"select__sheet_10p5k","sheetContent":"select__sheetContent_10p5k","modalContent":"select__modalContent_10p5k","sheetContainer":"select__sheetContainer_10p5k","optionsListWrapper":"select__optionsListWrapper_10p5k","optionsList":"select__optionsList_10p5k","scrollbar":"select__scrollbar_10p5k","search":"select__search_10p5k","option":"select__option_10p5k","optionGroup":"select__optionGroup_10p5k"};
|
|
2
|
-
require('./components/base-select/mobile.css')
|
|
3
|
-
|
|
4
|
-
export { mobileStyles as m };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var mobileStyles = {"sheet":"select__sheet_10p5k","sheetContent":"select__sheetContent_10p5k","modalContent":"select__modalContent_10p5k","sheetContainer":"select__sheetContainer_10p5k","optionsListWrapper":"select__optionsListWrapper_10p5k","optionsList":"select__optionsList_10p5k","scrollbar":"select__scrollbar_10p5k","search":"select__search_10p5k","option":"select__option_10p5k","optionGroup":"select__optionGroup_10p5k"};
|
|
4
|
-
require('./components/base-select/mobile.css')
|
|
5
|
-
|
|
6
|
-
exports.mobileStyles = mobileStyles;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const mobileStyles = {"sheet":"select__sheet_10p5k","sheetContent":"select__sheetContent_10p5k","modalContent":"select__modalContent_10p5k","sheetContainer":"select__sheetContainer_10p5k","optionsListWrapper":"select__optionsListWrapper_10p5k","optionsList":"select__optionsList_10p5k","scrollbar":"select__scrollbar_10p5k","search":"select__search_10p5k","option":"select__option_10p5k","optionGroup":"select__optionGroup_10p5k"};
|
|
2
|
-
require('./components/base-select/mobile.css')
|
|
3
|
-
|
|
4
|
-
export { mobileStyles as m };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|