@alfalab/core-components-select 15.0.3 → 15.1.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.js +5 -2
- package/Component.mobile.d.ts +1 -1
- package/Component.mobile.js +9 -4
- package/Component.modal.mobile.d.ts +1 -1
- package/Component.modal.mobile.js +7 -2
- package/Component.responsive.js +4 -1
- 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 +4 -4
- package/components/base-option/Component.js +1 -1
- package/components/base-option/index.css +13 -13
- package/components/base-select/Component.js +73 -12
- package/components/base-select/index.css +16 -9
- package/components/base-select-mobile/Component.js +57 -15
- package/components/base-select-mobile/footer/Component.js +1 -1
- package/components/base-select-mobile/footer/index.css +5 -5
- package/components/base-select-mobile/index.css +26 -11
- package/components/base-select-mobile/index.js +3 -0
- 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/field/Component.js +1 -1
- package/components/field/index.css +12 -12
- package/components/index.d.ts +1 -0
- package/components/index.js +4 -0
- 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 +20 -20
- package/components/options-list/Component.js +5 -5
- package/components/options-list/index.css +9 -9
- package/components/search/Component.d.ts +7 -0
- package/components/search/Component.js +24 -0
- package/components/search/index.css +28 -0
- package/components/search/index.d.ts +1 -0
- package/components/search/index.js +14 -0
- package/components/virtual-options-list/Component.js +1 -1
- package/components/virtual-options-list/index.css +15 -15
- package/cssm/Component.desktop.js +6 -2
- package/cssm/Component.mobile.d.ts +1 -1
- package/cssm/Component.mobile.js +10 -4
- package/cssm/Component.modal.mobile.d.ts +1 -1
- package/cssm/Component.modal.mobile.js +8 -2
- package/cssm/Component.responsive.js +5 -1
- package/cssm/components/base-select/Component.js +72 -11
- package/cssm/components/base-select/index.module.css +8 -1
- package/cssm/components/base-select-mobile/Component.js +57 -14
- package/cssm/components/base-select-mobile/index.js +4 -0
- package/cssm/components/base-select-mobile/index.module.css +15 -0
- package/cssm/components/index.d.ts +1 -0
- package/cssm/components/index.js +5 -0
- package/cssm/components/options-list/Component.js +4 -4
- package/cssm/components/search/Component.d.ts +7 -0
- package/cssm/components/search/Component.js +23 -0
- package/cssm/components/search/index.d.ts +1 -0
- package/cssm/components/search/index.js +15 -0
- package/cssm/components/search/index.module.css +27 -0
- package/cssm/desktop.js +4 -0
- package/{modern/hook-9ea9e32c.d.ts → cssm/hook-8abfea97.d.ts} +20 -5
- package/cssm/{hook-97e6e688.js → hook-d1f5dd40.js} +19 -5
- package/cssm/index.js +5 -1
- package/cssm/mobile.js +5 -1
- package/cssm/presets/index.d.ts +1 -1
- package/cssm/presets/index.js +1 -1
- package/cssm/presets/useSelectWithApply/hook.js +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.js +1 -1
- package/cssm/shared.js +8 -1
- package/cssm/typings.d.ts +23 -1
- package/cssm/utils.d.ts +5 -2
- package/cssm/utils.js +34 -5
- package/desktop.js +3 -0
- package/esm/Component.desktop.js +5 -2
- package/esm/Component.mobile.d.ts +1 -1
- package/esm/Component.mobile.js +9 -4
- package/esm/Component.modal.mobile.d.ts +1 -1
- package/esm/Component.modal.mobile.js +7 -2
- package/esm/Component.responsive.js +4 -1
- 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 +4 -4
- package/esm/components/base-option/Component.js +1 -1
- package/esm/components/base-option/index.css +13 -13
- package/esm/components/base-select/Component.js +74 -13
- package/esm/components/base-select/index.css +16 -9
- package/esm/components/base-select-mobile/Component.js +58 -16
- package/esm/components/base-select-mobile/footer/Component.js +1 -1
- package/esm/components/base-select-mobile/footer/index.css +5 -5
- package/esm/components/base-select-mobile/index.css +26 -11
- package/esm/components/base-select-mobile/index.js +3 -0
- 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/field/Component.js +1 -1
- package/esm/components/field/index.css +12 -12
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.js +3 -0
- 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 +20 -20
- package/esm/components/options-list/Component.js +5 -5
- package/esm/components/options-list/index.css +9 -9
- package/esm/components/search/Component.d.ts +7 -0
- package/esm/components/search/Component.js +15 -0
- package/esm/components/search/index.css +28 -0
- package/esm/components/search/index.d.ts +1 -0
- package/esm/components/search/index.js +6 -0
- package/esm/components/virtual-options-list/Component.js +1 -1
- package/esm/components/virtual-options-list/index.css +15 -15
- package/esm/desktop.js +3 -0
- package/{hook-9ea9e32c.d.ts → esm/hook-8abfea97.d.ts} +20 -5
- package/esm/{hook-d40b4e10.js → hook-990a584e.js} +21 -7
- package/esm/index.js +4 -1
- package/esm/mobile.js +4 -1
- package/esm/presets/index.d.ts +1 -1
- 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.js +5 -2
- package/esm/typings.d.ts +23 -1
- package/esm/utils.d.ts +5 -2
- package/esm/utils.js +33 -6
- package/{cssm/hook-9ea9e32c.d.ts → hook-8abfea97.d.ts} +20 -5
- package/{hook-43a35a80.js → hook-c0d8bff3.js} +19 -5
- package/index.js +4 -1
- package/mobile.js +4 -1
- package/modern/Component.desktop.js +5 -2
- package/modern/Component.mobile.d.ts +1 -1
- package/modern/Component.mobile.js +9 -4
- package/modern/Component.modal.mobile.d.ts +1 -1
- package/modern/Component.modal.mobile.js +7 -2
- package/modern/Component.responsive.js +4 -1
- 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 +4 -4
- package/modern/components/base-option/Component.js +1 -1
- package/modern/components/base-option/index.css +13 -13
- package/modern/components/base-select/Component.js +62 -9
- package/modern/components/base-select/index.css +16 -9
- package/modern/components/base-select-mobile/Component.js +48 -13
- package/modern/components/base-select-mobile/footer/Component.js +1 -1
- package/modern/components/base-select-mobile/footer/index.css +5 -5
- package/modern/components/base-select-mobile/index.css +26 -11
- package/modern/components/base-select-mobile/index.js +3 -0
- 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/field/Component.js +1 -1
- package/modern/components/field/index.css +12 -12
- package/modern/components/index.d.ts +1 -0
- package/modern/components/index.js +3 -0
- 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 +20 -20
- package/modern/components/options-list/Component.js +5 -5
- package/modern/components/options-list/index.css +9 -9
- package/modern/components/search/Component.d.ts +7 -0
- package/modern/components/search/Component.js +11 -0
- package/modern/components/search/index.css +28 -0
- package/modern/components/search/index.d.ts +1 -0
- package/modern/components/search/index.js +5 -0
- package/modern/components/virtual-options-list/Component.js +1 -1
- package/modern/components/virtual-options-list/index.css +15 -15
- package/modern/desktop.js +3 -0
- package/modern/{hook-d771f2ed.js → hook-101e5d49.js} +23 -6
- package/{esm/hook-9ea9e32c.d.ts → modern/hook-8abfea97.d.ts} +20 -5
- package/modern/index.js +4 -1
- package/modern/mobile.js +4 -1
- package/modern/presets/index.d.ts +1 -1
- 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.js +5 -2
- package/modern/typings.d.ts +23 -1
- package/modern/utils.d.ts +5 -2
- package/modern/utils.js +34 -6
- package/package.json +6 -6
- package/presets/index.d.ts +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.js +7 -1
- package/src/Component.desktop.tsx +4 -1
- package/src/Component.mobile.tsx +7 -0
- package/src/Component.modal.mobile.tsx +4 -0
- package/src/components/base-select/Component.tsx +101 -10
- package/src/components/base-select/index.module.css +12 -0
- package/src/components/base-select-mobile/Component.tsx +84 -12
- package/src/components/base-select-mobile/index.module.css +24 -0
- package/src/components/index.ts +1 -0
- package/src/components/options-list/Component.tsx +8 -3
- package/src/components/search/Component.tsx +31 -0
- package/src/components/search/index.module.css +6 -0
- package/src/components/search/index.ts +1 -0
- package/src/presets/useSelectWithApply/hook.tsx +32 -3
- package/src/presets/useSelectWithApply/options-list-with-apply/Component.tsx +13 -1
- package/src/typings.ts +27 -0
- package/src/utils.ts +37 -5
- package/typings.d.ts +23 -1
- package/utils.d.ts +5 -2
- package/utils.js +34 -5
- /package/cssm/{hook-97e6e688.d.ts → hook-d1f5dd40.d.ts} +0 -0
- /package/esm/{hook-d40b4e10.d.ts → hook-990a584e.d.ts} +0 -0
- /package/{hook-43a35a80.d.ts → hook-c0d8bff3.d.ts} +0 -0
- /package/modern/{hook-d771f2ed.d.ts → hook-101e5d49.d.ts} +0 -0
package/esm/shared.js
CHANGED
|
@@ -6,10 +6,11 @@ export { Option } from './components/option/Component.js';
|
|
|
6
6
|
export { OptionsList } from './components/options-list/Component.js';
|
|
7
7
|
export { VirtualOptionsList } from './components/virtual-options-list/Component.js';
|
|
8
8
|
export { BaseOption } from './components/base-option/Component.js';
|
|
9
|
+
export { Search } from './components/search/Component.js';
|
|
9
10
|
export { useSelectWithLoading } from './presets/useSelectWithLoading/hook.js';
|
|
10
11
|
export { useLazyLoading } from './presets/useLazyLoading/hook.js';
|
|
11
|
-
export { S as SELECT_ALL_KEY, u as useSelectWithApply } from './hook-
|
|
12
|
-
export { isGroup, isOptionShape, joinOptions, lastIndexOf, processOptions, usePrevious, useVisibleOptions } from './utils.js';
|
|
12
|
+
export { S as SELECT_ALL_KEY, u as useSelectWithApply } from './hook-990a584e.js';
|
|
13
|
+
export { defaultAccessor, defaultFilterFn, isGroup, isOptionShape, joinOptions, lastIndexOf, processOptions, usePrevious, useVisibleOptions } from './utils.js';
|
|
13
14
|
import 'react';
|
|
14
15
|
import 'classnames';
|
|
15
16
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
@@ -31,6 +32,8 @@ import '@alfalab/core-components-scrollbar/esm';
|
|
|
31
32
|
import './consts.js';
|
|
32
33
|
import 'react-virtual';
|
|
33
34
|
import './components/base-checkmark/Component.js';
|
|
35
|
+
import '@alfalab/core-components-input/esm';
|
|
36
|
+
import '@alfalab/icons-glyph/MagnifierMIcon';
|
|
34
37
|
import '@alfalab/core-components-skeleton/esm';
|
|
35
38
|
import 'intersection-observer';
|
|
36
39
|
import './presets/useSelectWithApply/options-list-with-apply/footer/Component.js';
|
package/esm/typings.d.ts
CHANGED
|
@@ -210,6 +210,23 @@ type BaseSelectProps = {
|
|
|
210
210
|
* Компонент пункта меню
|
|
211
211
|
*/
|
|
212
212
|
Option?: FC<OptionProps>;
|
|
213
|
+
/**
|
|
214
|
+
* Включает отображение поиска
|
|
215
|
+
*/
|
|
216
|
+
showSearch?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Компонент поиска
|
|
219
|
+
*/
|
|
220
|
+
Search?: FC<SearchProps & RefAttributes<HTMLInputElement>>;
|
|
221
|
+
/**
|
|
222
|
+
* Настройки поиска
|
|
223
|
+
*/
|
|
224
|
+
searchProps?: {
|
|
225
|
+
componentProps?: SearchProps;
|
|
226
|
+
accessor?: (option: OptionShape) => string;
|
|
227
|
+
value?: string;
|
|
228
|
+
onChange?: (value: string) => void;
|
|
229
|
+
};
|
|
213
230
|
/**
|
|
214
231
|
* Обработчик выбора
|
|
215
232
|
*/
|
|
@@ -345,6 +362,10 @@ type OptionsListProps = {
|
|
|
345
362
|
* Дополнительный класс для компонента группы пунктов
|
|
346
363
|
*/
|
|
347
364
|
optionGroupClassName?: string;
|
|
365
|
+
/**
|
|
366
|
+
* Дополнительный класс для скроллбара
|
|
367
|
+
*/
|
|
368
|
+
scrollbarClassName?: string;
|
|
348
369
|
/**
|
|
349
370
|
* Размер компонента
|
|
350
371
|
*/
|
|
@@ -547,4 +568,5 @@ type CheckmarkProps = {
|
|
|
547
568
|
*/
|
|
548
569
|
icon?: FC<SVGProps<SVGSVGElement>>;
|
|
549
570
|
};
|
|
550
|
-
|
|
571
|
+
type SearchProps = InputProps;
|
|
572
|
+
export { AnyObject, OptionShape, GroupShape, BaseSelectChangePayload, BaseSelectProps, FieldProps, ArrowProps, OptionsListProps, OptgroupProps, OptionProps, CheckmarkProps, SearchProps };
|
package/esm/utils.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ declare const joinOptions: ({ selected, selectedMultiple, }: {
|
|
|
6
6
|
selected?: OptionShape | undefined;
|
|
7
7
|
selectedMultiple?: OptionShape[] | undefined;
|
|
8
8
|
}) => ReactNode[] | null;
|
|
9
|
-
declare function processOptions(options: BaseSelectProps['options'], selected?: BaseSelectProps['selected']): {
|
|
9
|
+
declare function processOptions(options: BaseSelectProps['options'], selected?: BaseSelectProps['selected'], filterFn?: (option: OptionShape) => boolean): {
|
|
10
|
+
filteredOptions: (OptionShape | GroupShape)[];
|
|
10
11
|
flatOptions: OptionShape[];
|
|
11
12
|
selectedOptions: OptionShape[];
|
|
12
13
|
};
|
|
@@ -33,6 +34,8 @@ type useVisibleOptionsArgs = {
|
|
|
33
34
|
invalidate?: unknown;
|
|
34
35
|
};
|
|
35
36
|
declare function useVisibleOptions({ visibleOptions, listRef, styleTargetRef, open, invalidate, }: useVisibleOptionsArgs): void;
|
|
37
|
+
declare function defaultFilterFn(optionText: string, search: string): boolean;
|
|
38
|
+
declare function defaultAccessor(option: OptionShape): string;
|
|
36
39
|
declare function usePrevious<T>(value: T): T | undefined;
|
|
37
40
|
declare const lastIndexOf: <T>(array: T[], predicate: (item: T) => boolean) => number;
|
|
38
|
-
export { isGroup, isOptionShape, joinOptions, processOptions, useVisibleOptions, usePrevious, lastIndexOf };
|
|
41
|
+
export { isGroup, isOptionShape, joinOptions, processOptions, useVisibleOptions, defaultFilterFn, defaultAccessor, usePrevious, lastIndexOf };
|
package/esm/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __assign } from 'tslib';
|
|
1
2
|
import { isValidElement, cloneElement, useEffect, useRef } from 'react';
|
|
2
3
|
|
|
3
4
|
var isGroup = function (item) {
|
|
@@ -24,28 +25,42 @@ var joinOptions = function (_a) {
|
|
|
24
25
|
}, []);
|
|
25
26
|
};
|
|
26
27
|
// За один проход делает список пунктов меню плоским и находит выбранные пункты по ключу
|
|
27
|
-
function processOptions(options, selected) {
|
|
28
|
+
function processOptions(options, selected, filterFn) {
|
|
28
29
|
if (selected === void 0) { selected = []; }
|
|
30
|
+
if (filterFn === void 0) { filterFn = function () { return true; }; }
|
|
29
31
|
var flatOptions = [];
|
|
32
|
+
var filteredOptions = [];
|
|
30
33
|
var selectedArray = Array.isArray(selected) ? selected : [selected];
|
|
31
34
|
var selectedOptions = selectedArray.filter(isOptionShape);
|
|
32
35
|
var selectedKeys = selectedArray.filter(function (option) { return typeof option === 'string'; });
|
|
33
36
|
var isSelected = function (option) { return selectedKeys.includes(option.key); };
|
|
34
37
|
var process = function (option) {
|
|
35
|
-
flatOptions.push(option);
|
|
36
38
|
if (isSelected(option)) {
|
|
37
39
|
selectedOptions.push(option);
|
|
38
40
|
}
|
|
41
|
+
if (!filterFn(option))
|
|
42
|
+
return false;
|
|
43
|
+
flatOptions.push(option);
|
|
44
|
+
return true;
|
|
39
45
|
};
|
|
40
46
|
options.forEach(function (option) {
|
|
41
47
|
if (isGroup(option)) {
|
|
42
|
-
option
|
|
48
|
+
var group_1 = __assign(__assign({}, option), { options: [] });
|
|
49
|
+
option.options.forEach(function (groupOption) {
|
|
50
|
+
var matched = process(groupOption);
|
|
51
|
+
if (matched)
|
|
52
|
+
group_1.options.push(groupOption);
|
|
53
|
+
});
|
|
54
|
+
if (group_1.options.length)
|
|
55
|
+
filteredOptions.push(group_1);
|
|
43
56
|
}
|
|
44
57
|
else {
|
|
45
|
-
process(option);
|
|
58
|
+
var matched = process(option);
|
|
59
|
+
if (matched)
|
|
60
|
+
filteredOptions.push(option);
|
|
46
61
|
}
|
|
47
62
|
});
|
|
48
|
-
return { flatOptions: flatOptions, selectedOptions: selectedOptions };
|
|
63
|
+
return { filteredOptions: filteredOptions, flatOptions: flatOptions, selectedOptions: selectedOptions };
|
|
49
64
|
}
|
|
50
65
|
function useVisibleOptions(_a) {
|
|
51
66
|
var visibleOptions = _a.visibleOptions, listRef = _a.listRef, _b = _a.styleTargetRef, styleTargetRef = _b === void 0 ? listRef : _b, open = _a.open, invalidate = _a.invalidate;
|
|
@@ -69,6 +84,18 @@ function useVisibleOptions(_a) {
|
|
|
69
84
|
}
|
|
70
85
|
}, [listRef, open, styleTargetRef, visibleOptions, invalidate]);
|
|
71
86
|
}
|
|
87
|
+
function defaultFilterFn(optionText, search) {
|
|
88
|
+
if (!search)
|
|
89
|
+
return true;
|
|
90
|
+
return optionText.toLowerCase().includes(search.toLowerCase());
|
|
91
|
+
}
|
|
92
|
+
function defaultAccessor(option) {
|
|
93
|
+
if (typeof option.content === 'string')
|
|
94
|
+
return option.content;
|
|
95
|
+
if (typeof option.value === 'string')
|
|
96
|
+
return option.value;
|
|
97
|
+
return option.key;
|
|
98
|
+
}
|
|
72
99
|
// TODO: перенести
|
|
73
100
|
function usePrevious(value) {
|
|
74
101
|
var ref = useRef();
|
|
@@ -86,4 +113,4 @@ var lastIndexOf = function (array, predicate) {
|
|
|
86
113
|
return -1;
|
|
87
114
|
};
|
|
88
115
|
|
|
89
|
-
export { isGroup, isOptionShape, joinOptions, lastIndexOf, processOptions, usePrevious, useVisibleOptions };
|
|
116
|
+
export { defaultAccessor, defaultFilterFn, isGroup, isOptionShape, joinOptions, lastIndexOf, processOptions, usePrevious, useVisibleOptions };
|
|
@@ -21,6 +21,14 @@ type UseSelectWithApplyProps = {
|
|
|
21
21
|
* Пропсы, которые будут прокинуты в компонент списка
|
|
22
22
|
*/
|
|
23
23
|
optionsListProps?: BaseSelectProps['optionsListProps'];
|
|
24
|
+
/**
|
|
25
|
+
* Включает отображение поиска
|
|
26
|
+
*/
|
|
27
|
+
showSearch?: BaseSelectProps['showSearch'];
|
|
28
|
+
/**
|
|
29
|
+
* Настройки поиска
|
|
30
|
+
*/
|
|
31
|
+
searchProps?: BaseSelectProps['searchProps'];
|
|
24
32
|
/**
|
|
25
33
|
* Показывать кнопку очистки
|
|
26
34
|
*/
|
|
@@ -35,17 +43,17 @@ type UseSelectWithApplyProps = {
|
|
|
35
43
|
showHeaderWithSelectAll?: boolean;
|
|
36
44
|
};
|
|
37
45
|
declare const SELECT_ALL_KEY = "select_all";
|
|
38
|
-
declare function useSelectWithApply({ options, selected, onChange, OptionsList, optionsListProps, showClear, showSelectAll, showHeaderWithSelectAll, }: UseSelectWithApplyProps): {
|
|
46
|
+
declare function useSelectWithApply({ options, selected, onChange, OptionsList, optionsListProps, showClear, showSelectAll, showHeaderWithSelectAll, showSearch, searchProps, }: UseSelectWithApplyProps): {
|
|
39
47
|
OptionsList: import("react").ForwardRefExoticComponent<import("./typings").OptionsListProps & {
|
|
40
48
|
showClear?: boolean | undefined;
|
|
41
|
-
onClose?: (() => void) | undefined;
|
|
49
|
+
onClose?: (() => void) | undefined; /**
|
|
50
|
+
* Компонент выпадающего меню
|
|
51
|
+
*/
|
|
42
52
|
selectedDraft?: OptionShape[] | undefined;
|
|
43
53
|
OptionsList?: import("react").FC<import("./typings").OptionsListProps & import("react").RefAttributes<HTMLDivElement>> | undefined;
|
|
44
54
|
Footer?: import("react").FC<import("./presets/useSelectWithApply/options-list-with-apply/footer/Component").FooterProps> | undefined;
|
|
45
55
|
Header?: import("react").FC<import("./presets/useSelectWithApply/options-list-with-apply/header/Component").HeaderProps> | undefined;
|
|
46
|
-
headerProps?: import("./presets/useSelectWithApply/options-list-with-apply/header/Component").HeaderProps | undefined;
|
|
47
|
-
* Показывать кнопку очистки
|
|
48
|
-
*/
|
|
56
|
+
headerProps?: import("./presets/useSelectWithApply/options-list-with-apply/header/Component").HeaderProps | undefined;
|
|
49
57
|
showHeaderWithSelectAll?: boolean | undefined;
|
|
50
58
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
51
59
|
optionsListProps: {
|
|
@@ -70,5 +78,12 @@ declare function useSelectWithApply({ options, selected, onChange, OptionsList,
|
|
|
70
78
|
})[];
|
|
71
79
|
onChange: (payload: import("./typings").BaseSelectChangePayload) => void;
|
|
72
80
|
selected: string | OptionShape | (string | OptionShape)[] | null | undefined;
|
|
81
|
+
showSearch: boolean | undefined;
|
|
82
|
+
searchProps: {
|
|
83
|
+
value: string;
|
|
84
|
+
onChange: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
85
|
+
componentProps?: import("packages/input/src").InputProps | undefined;
|
|
86
|
+
accessor?: ((option: OptionShape) => string) | undefined;
|
|
87
|
+
} | undefined;
|
|
73
88
|
};
|
|
74
89
|
export { UseSelectWithApplyProps, SELECT_ALL_KEY, useSelectWithApply };
|
|
@@ -13,7 +13,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
14
14
|
|
|
15
15
|
var OptionsListWithApply = React.forwardRef(function (_a, ref) {
|
|
16
|
-
var toggleMenu = _a.toggleMenu, defaultGetOptionProps = _a.getOptionProps, _b = _a.showClear, showClear = _b === void 0 ? true : _b, showHeaderWithSelectAll = _a.showHeaderWithSelectAll, _c = _a.selectedDraft, selectedDraft = _c === void 0 ? [] : _c, _d = _a.flatOptions, flatOptions = _d === void 0 ? [] : _d, _e = _a.OptionsList, OptionsList = _e === void 0 ? components_optionsList_Component.OptionsList : _e, _f = _a.onApply, onApply = _f === void 0 ? function () { return null; } : _f, _g = _a.onClear, onClear = _g === void 0 ? function () { return null; } : _g, _h = _a.onClose, onClose = _h === void 0 ? function () { return null; } : _h, _j = _a.visibleOptions, visibleOptions = _j === void 0 ? consts.DEFAULT_VISIBLE_OPTIONS : _j, _k = _a.Footer, Footer = _k === void 0 ? presets_useSelectWithApply_optionsListWithApply_footer_Component.Footer : _k, _l = _a.Header, Header = _l === void 0 ? presets_useSelectWithApply_optionsListWithApply_header_Component.Header : _l, headerProps = _a.headerProps, restProps = tslib.__rest(_a, ["toggleMenu", "getOptionProps", "showClear", "showHeaderWithSelectAll", "selectedDraft", "flatOptions", "OptionsList", "onApply", "onClear", "onClose", "visibleOptions", "Footer", "Header", "headerProps"]);
|
|
16
|
+
var toggleMenu = _a.toggleMenu, defaultGetOptionProps = _a.getOptionProps, _b = _a.showClear, showClear = _b === void 0 ? true : _b, showHeaderWithSelectAll = _a.showHeaderWithSelectAll, _c = _a.selectedDraft, selectedDraft = _c === void 0 ? [] : _c, _d = _a.flatOptions, flatOptions = _d === void 0 ? [] : _d, _e = _a.OptionsList, OptionsList = _e === void 0 ? components_optionsList_Component.OptionsList : _e, _f = _a.onApply, onApply = _f === void 0 ? function () { return null; } : _f, _g = _a.onClear, onClear = _g === void 0 ? function () { return null; } : _g, _h = _a.onClose, onClose = _h === void 0 ? function () { return null; } : _h, _j = _a.visibleOptions, visibleOptions = _j === void 0 ? consts.DEFAULT_VISIBLE_OPTIONS : _j, _k = _a.Footer, Footer = _k === void 0 ? presets_useSelectWithApply_optionsListWithApply_footer_Component.Footer : _k, _l = _a.Header, Header = _l === void 0 ? presets_useSelectWithApply_optionsListWithApply_header_Component.Header : _l, header = _a.header, headerProps = _a.headerProps, restProps = tslib.__rest(_a, ["toggleMenu", "getOptionProps", "showClear", "showHeaderWithSelectAll", "selectedDraft", "flatOptions", "OptionsList", "onApply", "onClear", "onClose", "visibleOptions", "Footer", "Header", "header", "headerProps"]);
|
|
17
17
|
var getOptionProps = React.useCallback(function (option, index) {
|
|
18
18
|
var optionProps = defaultGetOptionProps(option, index);
|
|
19
19
|
var selected = option.key === SELECT_ALL_KEY
|
|
@@ -39,15 +39,26 @@ var OptionsListWithApply = React.forwardRef(function (_a, ref) {
|
|
|
39
39
|
};
|
|
40
40
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
41
|
}, []);
|
|
42
|
-
|
|
42
|
+
var renderHeader = function () {
|
|
43
|
+
if (!showHeaderWithSelectAll && !header)
|
|
44
|
+
return undefined;
|
|
45
|
+
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
46
|
+
header,
|
|
47
|
+
showHeaderWithSelectAll && React__default.default.createElement(Header, tslib.__assign({}, headerProps))));
|
|
48
|
+
};
|
|
49
|
+
return (React__default.default.createElement(OptionsList, tslib.__assign({}, restProps, { ref: ref, visibleOptions: visibleOptions, toggleMenu: toggleMenu, flatOptions: flatOptions, getOptionProps: getOptionProps, onApply: handleApply, onClear: handleClear, header: renderHeader(), footer: React__default.default.createElement(Footer, { handleApply: handleApply, handleClear: handleClear, showClear: showClear, selectedDraft: selectedDraft }) })));
|
|
43
50
|
});
|
|
44
51
|
|
|
45
52
|
var SELECT_ALL_KEY = 'select_all';
|
|
46
53
|
var selectAllOption = { key: SELECT_ALL_KEY, content: 'Выбрать все' };
|
|
47
54
|
function useSelectWithApply(_a) {
|
|
48
|
-
var options = _a.options, selected = _a.selected, _b = _a.onChange, onChange = _b === void 0 ? function () { return null; } : _b, OptionsList = _a.OptionsList, _c = _a.optionsListProps, optionsListProps = _c === void 0 ? {} : _c, _d = _a.showClear, showClear = _d === void 0 ? true : _d, _e = _a.showSelectAll, showSelectAll = _e === void 0 ? false : _e, _f = _a.showHeaderWithSelectAll, showHeaderWithSelectAll = _f === void 0 ? false : _f;
|
|
49
|
-
var
|
|
50
|
-
var
|
|
55
|
+
var options = _a.options, selected = _a.selected, _b = _a.onChange, onChange = _b === void 0 ? function () { return null; } : _b, OptionsList = _a.OptionsList, _c = _a.optionsListProps, optionsListProps = _c === void 0 ? {} : _c, _d = _a.showClear, showClear = _d === void 0 ? true : _d, _e = _a.showSelectAll, showSelectAll = _e === void 0 ? false : _e, _f = _a.showHeaderWithSelectAll, showHeaderWithSelectAll = _f === void 0 ? false : _f, showSearch = _a.showSearch, _g = _a.searchProps, searchProps = _g === void 0 ? {} : _g;
|
|
56
|
+
var _h = React.useState(''), search = _h[0], setSearch = _h[1];
|
|
57
|
+
var accessor = searchProps.accessor || utils.defaultAccessor;
|
|
58
|
+
var _j = React.useMemo(function () {
|
|
59
|
+
return utils.processOptions(options, selected, showSearch ? function (option) { return utils.defaultFilterFn(accessor(option), search); } : undefined);
|
|
60
|
+
}, [accessor, options, search, selected, showSearch]), flatOptions = _j.flatOptions, selectedOptions = _j.selectedOptions;
|
|
61
|
+
var _k = React.useState(selectedOptions), selectedDraft = _k[0], setSelectedDraft = _k[1];
|
|
51
62
|
var selectedOptionsRef = React.useRef(selectedOptions);
|
|
52
63
|
var handleApply = function () {
|
|
53
64
|
onChange({
|
|
@@ -102,6 +113,9 @@ function useSelectWithApply(_a) {
|
|
|
102
113
|
options: memoizedOptions,
|
|
103
114
|
onChange: handleChange,
|
|
104
115
|
selected: selected,
|
|
116
|
+
showSearch: showSearch,
|
|
117
|
+
searchProps: showSearch
|
|
118
|
+
? tslib.__assign(tslib.__assign({}, searchProps), { value: search, onChange: setSearch }) : undefined,
|
|
105
119
|
};
|
|
106
120
|
}
|
|
107
121
|
|
package/index.js
CHANGED
|
@@ -31,6 +31,9 @@ require('./components/checkmark-mobile/Component.js');
|
|
|
31
31
|
require('./components/options-list/Component.js');
|
|
32
32
|
require('@alfalab/core-components-scrollbar');
|
|
33
33
|
require('./consts.js');
|
|
34
|
+
require('./components/search/Component.js');
|
|
35
|
+
require('@alfalab/core-components-input');
|
|
36
|
+
require('@alfalab/icons-glyph/MagnifierMIcon');
|
|
34
37
|
require('./Component.mobile.js');
|
|
35
38
|
require('@alfalab/core-components-form-control/mobile');
|
|
36
39
|
require('./components/base-select-mobile/Component.js');
|
|
@@ -41,7 +44,7 @@ require('@alfalab/core-components-base-modal');
|
|
|
41
44
|
require('@alfalab/core-components-button/mobile');
|
|
42
45
|
require('./components/virtual-options-list/Component.js');
|
|
43
46
|
require('react-virtual');
|
|
44
|
-
require('./hook-
|
|
47
|
+
require('./hook-c0d8bff3.js');
|
|
45
48
|
require('./presets/useSelectWithApply/options-list-with-apply/footer/Component.js');
|
|
46
49
|
require('@alfalab/core-components-button/desktop');
|
|
47
50
|
require('./presets/useSelectWithApply/options-list-with-apply/header/Component.js');
|
package/mobile.js
CHANGED
|
@@ -30,12 +30,15 @@ require('./components/checkmark-mobile/Component.js');
|
|
|
30
30
|
require('./components/options-list/Component.js');
|
|
31
31
|
require('@alfalab/core-components-scrollbar');
|
|
32
32
|
require('./consts.js');
|
|
33
|
+
require('./components/search/Component.js');
|
|
34
|
+
require('@alfalab/core-components-input');
|
|
35
|
+
require('@alfalab/icons-glyph/MagnifierMIcon');
|
|
33
36
|
require('./components/base-select-mobile/footer/Component.js');
|
|
34
37
|
require('@alfalab/core-components-base-modal');
|
|
35
38
|
require('@alfalab/core-components-button/mobile');
|
|
36
39
|
require('./components/virtual-options-list/Component.js');
|
|
37
40
|
require('react-virtual');
|
|
38
|
-
require('./hook-
|
|
41
|
+
require('./hook-c0d8bff3.js');
|
|
39
42
|
require('./presets/useSelectWithApply/options-list-with-apply/footer/Component.js');
|
|
40
43
|
require('@alfalab/core-components-button/desktop');
|
|
41
44
|
require('./presets/useSelectWithApply/options-list-with-apply/header/Component.js');
|
|
@@ -6,6 +6,7 @@ import { Field } from './components/field/Component.js';
|
|
|
6
6
|
import { Optgroup } from './components/optgroup/Component.js';
|
|
7
7
|
import { Option } from './components/option/Component.js';
|
|
8
8
|
import { OptionsList } from './components/options-list/Component.js';
|
|
9
|
+
import { Search } from './components/search/Component.js';
|
|
9
10
|
import 'classnames';
|
|
10
11
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
11
12
|
import 'react-merge-refs';
|
|
@@ -24,10 +25,12 @@ import '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
|
24
25
|
import './components/checkmark-mobile/Component.js';
|
|
25
26
|
import '@alfalab/core-components-scrollbar/modern';
|
|
26
27
|
import './consts.js';
|
|
28
|
+
import '@alfalab/core-components-input/modern';
|
|
29
|
+
import '@alfalab/icons-glyph/MagnifierMIcon';
|
|
27
30
|
|
|
28
|
-
const SelectDesktop = forwardRef(({ Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, OptionsList: OptionsList$1 = OptionsList, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, fieldProps = {}, ...restProps }, ref) => (React.createElement(BaseSelect, { ref: ref, Option: Option$1, Field: Field$1, fieldProps: {
|
|
31
|
+
const SelectDesktop = forwardRef(({ Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, OptionsList: OptionsList$1 = OptionsList, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, Search: Search$1 = Search, fieldProps = {}, ...restProps }, ref) => (React.createElement(BaseSelect, { ref: ref, Option: Option$1, Field: Field$1, fieldProps: {
|
|
29
32
|
FormControlComponent: FormControlDesktop,
|
|
30
33
|
...fieldProps,
|
|
31
|
-
}, Optgroup: Optgroup$1, OptionsList: OptionsList$1, Arrow: Arrow$1, ...restProps })));
|
|
34
|
+
}, Search: Search$1, Optgroup: Optgroup$1, OptionsList: OptionsList$1, Arrow: Arrow$1, ...restProps })));
|
|
32
35
|
|
|
33
36
|
export { SelectDesktop };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { BottomSheetProps } from "@alfalab/core-components-bottom-sheet";
|
|
5
|
-
import { UseSelectWithApplyProps } from "./hook-
|
|
5
|
+
import { UseSelectWithApplyProps } from "./hook-8abfea97";
|
|
6
6
|
import { BaseSelectProps } from "./typings";
|
|
7
7
|
type AdditionalMobileProps = {
|
|
8
8
|
/**
|
|
@@ -7,8 +7,9 @@ import { Field } from './components/field/Component.js';
|
|
|
7
7
|
import { Optgroup } from './components/optgroup/Component.js';
|
|
8
8
|
import { Option } from './components/option/Component.js';
|
|
9
9
|
import { OptionsList } from './components/options-list/Component.js';
|
|
10
|
+
import { Search } from './components/search/Component.js';
|
|
10
11
|
import { VirtualOptionsList } from './components/virtual-options-list/Component.js';
|
|
11
|
-
import { u as useSelectWithApply } from './hook-
|
|
12
|
+
import { u as useSelectWithApply } from './hook-101e5d49.js';
|
|
12
13
|
import { Header } from './presets/useSelectWithApply/options-list-with-apply/header/Component.js';
|
|
13
14
|
import 'classnames';
|
|
14
15
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
@@ -29,20 +30,24 @@ import '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
|
29
30
|
import './components/checkmark-mobile/Component.js';
|
|
30
31
|
import '@alfalab/core-components-scrollbar/modern';
|
|
31
32
|
import './consts.js';
|
|
33
|
+
import '@alfalab/core-components-input/modern';
|
|
34
|
+
import '@alfalab/icons-glyph/MagnifierMIcon';
|
|
32
35
|
import 'react-virtual';
|
|
33
36
|
import './presets/useSelectWithApply/options-list-with-apply/footer/Component.js';
|
|
34
37
|
import '@alfalab/core-components-button/modern/desktop';
|
|
35
38
|
|
|
36
39
|
const VIRTUAL_OPTIONS_LIST_THRESHOLD = 30;
|
|
37
|
-
const SelectMobile = forwardRef(({ autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, defaultOpen = false, open: openProp, size = 'm', optionsSize = 'm', fieldProps = {}, optionProps = {}, optionsListProps = {}, Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, selected, options, OptionsList: OptionsList$1 = options.length > VIRTUAL_OPTIONS_LIST_THRESHOLD
|
|
40
|
+
const SelectMobile = forwardRef(({ autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, defaultOpen = false, open: openProp, size = 'm', optionsSize = 'm', fieldProps = {}, optionProps = {}, optionsListProps = {}, Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, Search: Search$1 = Search, selected, options, OptionsList: OptionsList$1 = options.length > VIRTUAL_OPTIONS_LIST_THRESHOLD
|
|
38
41
|
? VirtualOptionsList
|
|
39
|
-
: OptionsList, onChange, bottomSheetProps, showClear = true, showSelectAll, showHeaderWithSelectAll, useWithApplyHook = multiple, ...restProps }, ref) => {
|
|
42
|
+
: OptionsList, onChange, bottomSheetProps, showClear = true, showSelectAll, showHeaderWithSelectAll, useWithApplyHook = multiple, showSearch, searchProps, ...restProps }, ref) => {
|
|
40
43
|
const applyProps = useSelectWithApply({
|
|
41
44
|
optionsListProps: {
|
|
42
45
|
...optionsListProps,
|
|
43
46
|
Footer,
|
|
44
47
|
},
|
|
45
48
|
OptionsList: OptionsList$1,
|
|
49
|
+
showSearch,
|
|
50
|
+
searchProps,
|
|
46
51
|
selected,
|
|
47
52
|
options,
|
|
48
53
|
onChange,
|
|
@@ -52,7 +57,7 @@ const SelectMobile = forwardRef(({ autocomplete = false, multiple = false, allow
|
|
|
52
57
|
return (React.createElement(BaseSelectMobile, { ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: {
|
|
53
58
|
FormControlComponent: FormControlMobile,
|
|
54
59
|
...fieldProps,
|
|
55
|
-
}, optionProps: optionProps, Arrow: Arrow$1, Field: Field$1, Optgroup: Optgroup$1, Option: Option$1, isBottomSheet: true, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList$1, bottomSheetProps: {
|
|
60
|
+
}, optionProps: optionProps, Arrow: Arrow$1, Field: Field$1, Optgroup: Optgroup$1, Option: Option$1, Search: Search$1, isBottomSheet: true, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList$1, bottomSheetProps: {
|
|
56
61
|
bottomAddons: useWithApplyHook && showHeaderWithSelectAll && (React.createElement(Header, { ...applyProps.optionsListProps.headerProps, mobile: true })),
|
|
57
62
|
...bottomSheetProps,
|
|
58
63
|
}, optionsListProps: optionsListProps, ...restProps, ...(useWithApplyHook && applyProps) }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ModalMobile } from "./Component.mobile-f1f15074";
|
|
4
|
-
import { UseSelectWithApplyProps } from "./hook-
|
|
4
|
+
import { UseSelectWithApplyProps } from "./hook-8abfea97";
|
|
5
5
|
import { BaseSelectProps } from "./typings";
|
|
6
6
|
type SelectModalMobileProps = Omit<BaseSelectProps, 'Checkmark' | 'onScroll'> & {
|
|
7
7
|
/**
|
|
@@ -8,7 +8,7 @@ import { Optgroup } from './components/optgroup/Component.js';
|
|
|
8
8
|
import { Option } from './components/option/Component.js';
|
|
9
9
|
import { OptionsList } from './components/options-list/Component.js';
|
|
10
10
|
import { VirtualOptionsList } from './components/virtual-options-list/Component.js';
|
|
11
|
-
import { u as useSelectWithApply } from './hook-
|
|
11
|
+
import { u as useSelectWithApply } from './hook-101e5d49.js';
|
|
12
12
|
import { Header } from './presets/useSelectWithApply/options-list-with-apply/header/Component.js';
|
|
13
13
|
import 'classnames';
|
|
14
14
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
@@ -18,6 +18,9 @@ import '@alfalab/core-components-bottom-sheet/modern';
|
|
|
18
18
|
import '@alfalab/core-components-modal/modern/mobile';
|
|
19
19
|
import '@alfalab/core-components-shared/modern';
|
|
20
20
|
import './utils.js';
|
|
21
|
+
import './components/search/Component.js';
|
|
22
|
+
import '@alfalab/core-components-input/modern';
|
|
23
|
+
import '@alfalab/icons-glyph/MagnifierMIcon';
|
|
21
24
|
import '@alfalab/core-components-base-modal/modern';
|
|
22
25
|
import '@alfalab/core-components-button/modern/mobile';
|
|
23
26
|
import '@alfalab/hooks';
|
|
@@ -36,7 +39,7 @@ import '@alfalab/core-components-button/modern/desktop';
|
|
|
36
39
|
const VIRTUAL_OPTIONS_LIST_THRESHOLD = 30;
|
|
37
40
|
const SelectModalMobile = forwardRef(({ autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, defaultOpen = false, open: openProp, size = 'm', optionsSize = 'm', fieldProps = {}, optionProps = {}, optionsListProps = {}, Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, selected, options, OptionsList: OptionsList$1 = options.length > VIRTUAL_OPTIONS_LIST_THRESHOLD
|
|
38
41
|
? VirtualOptionsList
|
|
39
|
-
: OptionsList, onChange, showClear = true, showSelectAll, useWithApplyHook = multiple, modalHeaderProps, showHeaderWithSelectAll, ...restProps }, ref) => {
|
|
42
|
+
: OptionsList, onChange, showClear = true, showSelectAll, useWithApplyHook = multiple, modalHeaderProps, showHeaderWithSelectAll, showSearch, searchProps, ...restProps }, ref) => {
|
|
40
43
|
const applyProps = useSelectWithApply({
|
|
41
44
|
optionsListProps: {
|
|
42
45
|
...optionsListProps,
|
|
@@ -46,6 +49,8 @@ const SelectModalMobile = forwardRef(({ autocomplete = false, multiple = false,
|
|
|
46
49
|
selected,
|
|
47
50
|
options,
|
|
48
51
|
onChange,
|
|
52
|
+
showSearch,
|
|
53
|
+
searchProps,
|
|
49
54
|
showClear,
|
|
50
55
|
showSelectAll,
|
|
51
56
|
});
|
|
@@ -26,6 +26,9 @@ import './components/checkmark-mobile/Component.js';
|
|
|
26
26
|
import './components/options-list/Component.js';
|
|
27
27
|
import '@alfalab/core-components-scrollbar/modern';
|
|
28
28
|
import './consts.js';
|
|
29
|
+
import './components/search/Component.js';
|
|
30
|
+
import '@alfalab/core-components-input/modern';
|
|
31
|
+
import '@alfalab/icons-glyph/MagnifierMIcon';
|
|
29
32
|
import '@alfalab/core-components-form-control/modern/mobile';
|
|
30
33
|
import './components/base-select-mobile/Component.js';
|
|
31
34
|
import '@alfalab/core-components-bottom-sheet/modern';
|
|
@@ -35,7 +38,7 @@ import '@alfalab/core-components-base-modal/modern';
|
|
|
35
38
|
import '@alfalab/core-components-button/modern/mobile';
|
|
36
39
|
import './components/virtual-options-list/Component.js';
|
|
37
40
|
import 'react-virtual';
|
|
38
|
-
import './hook-
|
|
41
|
+
import './hook-101e5d49.js';
|
|
39
42
|
import './presets/useSelectWithApply/options-list-with-apply/footer/Component.js';
|
|
40
43
|
import '@alfalab/core-components-button/modern/desktop';
|
|
41
44
|
import './presets/useSelectWithApply/options-list-with-apply/header/Component.js';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { ChevronDownMIcon } from '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
4
4
|
|
|
5
|
-
const styles = {"arrow":"
|
|
5
|
+
const styles = {"arrow":"select__arrow_7z2ye","open":"select__open_7z2ye"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
const Arrow = ({ open, className }) => (React.createElement(ChevronDownMIcon, { className: cn(styles.arrow, className, { [styles.open]: open }) }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1qeb7 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-primary: #0e0e0e; /* 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 */
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
/* checkmark */
|
|
27
27
|
|
|
28
28
|
/* optgroup */
|
|
29
|
-
} .
|
|
29
|
+
} .select__arrow_7z2ye {
|
|
30
30
|
display: block;
|
|
31
31
|
width: 24px;
|
|
32
32
|
height: 24px;
|
|
33
33
|
color: var(--select-arrow-color);
|
|
34
34
|
|
|
35
35
|
transition: transform 0.15s ease-in-out, opacity 0.2s ease;
|
|
36
|
-
} .
|
|
36
|
+
} .select__open_7z2ye {
|
|
37
37
|
transform: var(--arrow-transform);
|
|
38
38
|
}
|
|
@@ -3,7 +3,7 @@ import cn from 'classnames';
|
|
|
3
3
|
import { Checkbox } from '@alfalab/core-components-checkbox/modern';
|
|
4
4
|
import { CheckmarkMIcon } from '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
5
5
|
|
|
6
|
-
const styles = {"checkmark":"
|
|
6
|
+
const styles = {"checkmark":"select__checkmark_6928o","single":"select__single_6928o","selected":"select__selected_6928o"};
|
|
7
7
|
require('./index.css')
|
|
8
8
|
|
|
9
9
|
const BaseCheckmark = ({ selected, disabled = false, className, multiple, }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1xysu */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :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 */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :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 */
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
/* checkmark */
|
|
24
24
|
|
|
25
25
|
/* optgroup */
|
|
26
|
-
} .
|
|
26
|
+
} .select__checkmark_6928o {
|
|
27
27
|
flex-shrink: 0;
|
|
28
28
|
box-sizing: border-box;
|
|
29
|
-
} .
|
|
29
|
+
} .select__single_6928o {
|
|
30
30
|
display: flex;
|
|
31
31
|
align-items: center;
|
|
32
32
|
justify-content: center;
|
|
33
33
|
opacity: 0
|
|
34
|
-
} .
|
|
34
|
+
} .select__single_6928o.select__selected_6928o {
|
|
35
35
|
opacity: 1;
|
|
36
36
|
}
|
|
@@ -4,7 +4,7 @@ import { BaseCheckmark } from '../base-checkmark/Component.js';
|
|
|
4
4
|
import '@alfalab/core-components-checkbox/modern';
|
|
5
5
|
import '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
6
6
|
|
|
7
|
-
const styles = {"option":"
|
|
7
|
+
const styles = {"option":"select__option_18w82","disabled":"select__disabled_18w82","checkmarkBefore":"select__checkmarkBefore_18w82","mobile":"select__mobile_18w82","checkmarkAfter":"select__checkmarkAfter_18w82","textContent":"select__textContent_18w82","selected":"select__selected_18w82","highlighted":"select__highlighted_18w82","content":"select__content_18w82"};
|
|
8
8
|
require('./index.css')
|
|
9
9
|
|
|
10
10
|
const BaseOption = ({ className, option, children, selected, highlighted, disabled, multiple, Checkmark = BaseCheckmark, checkmarkPosition = multiple ? 'before' : 'after', innerProps, dataTestId, mobile = false, }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1wh3a */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-bg-primary: #fff;
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
/* checkmark */
|
|
44
44
|
|
|
45
45
|
/* optgroup */
|
|
46
|
-
} .
|
|
46
|
+
} .select__option_18w82 {
|
|
47
47
|
font-size: 16px;
|
|
48
48
|
line-height: 20px;
|
|
49
49
|
font-weight: 400;
|
|
@@ -60,32 +60,32 @@
|
|
|
60
60
|
position: relative;
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
min-height: var(--size-s-height)
|
|
63
|
-
} .
|
|
63
|
+
} .select__option_18w82:not(.select__disabled_18w82):active {
|
|
64
64
|
background: var(--select-option-active-background);
|
|
65
65
|
color: var(--select-option-active-color);
|
|
66
|
-
} .
|
|
66
|
+
} .select__option_18w82.select__checkmarkBefore_18w82 {
|
|
67
67
|
padding: 0 0 0 var(--gap-s)
|
|
68
|
-
} .
|
|
68
|
+
} .select__option_18w82.select__checkmarkBefore_18w82.select__mobile_18w82 {
|
|
69
69
|
padding-left: var(--gap-m);
|
|
70
|
-
} .
|
|
70
|
+
} .select__option_18w82.select__checkmarkAfter_18w82 {
|
|
71
71
|
padding: 0 var(--gap-s) 0 0
|
|
72
|
-
} .
|
|
72
|
+
} .select__option_18w82.select__checkmarkAfter_18w82.select__mobile_18w82 {
|
|
73
73
|
padding-right: var(--gap-l);
|
|
74
|
-
} .
|
|
74
|
+
} .select__option_18w82.select__textContent_18w82 {
|
|
75
75
|
padding: var(--gap-s)
|
|
76
|
-
} .
|
|
76
|
+
} .select__option_18w82.select__textContent_18w82.select__mobile_18w82 {
|
|
77
77
|
padding: var(--gap-m) var(--gap-l) var(--gap-m) var(--gap-m);
|
|
78
|
-
} .
|
|
78
|
+
} .select__selected_18w82 {
|
|
79
79
|
background: var(--select-option-selected-background);
|
|
80
80
|
color: var(--select-option-selected-color);
|
|
81
81
|
cursor: default;
|
|
82
|
-
} .
|
|
82
|
+
} .select__highlighted_18w82 {
|
|
83
83
|
background: var(--select-option-hover-background);
|
|
84
84
|
color: var(--select-option-hover-color);
|
|
85
|
-
} .
|
|
85
|
+
} .select__disabled_18w82 {
|
|
86
86
|
cursor: var(--disabled-cursor);
|
|
87
87
|
background: var(--select-option-disabled-background);
|
|
88
88
|
color: var(--select-option-disabled-color);
|
|
89
|
-
} .
|
|
89
|
+
} .select__content_18w82 {
|
|
90
90
|
flex: 1;
|
|
91
91
|
}
|