@alfalab/core-components-select 15.0.4 → 15.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Component.desktop.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 +51 -11
- 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 +51 -10
- 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 +52 -12
- 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/esm/{hook-276cd428.js → hook-758ebd33.js} +21 -7
- package/{hook-9ea9e32c.d.ts → esm/hook-8abfea97.d.ts} +20 -5
- 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-ac9069cc.js → hook-9b793700.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 +42 -9
- 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-f0d60b8e.js → hook-707bbdbf.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 +78 -8
- 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-276cd428.d.ts → hook-758ebd33.d.ts} +0 -0
- /package/{hook-ac9069cc.d.ts → hook-9b793700.d.ts} +0 -0
- /package/modern/{hook-f0d60b8e.d.ts → hook-707bbdbf.d.ts} +0 -0
|
@@ -6,20 +6,29 @@ import { useMultipleSelection, useCombobox } from 'downshift';
|
|
|
6
6
|
import { Popover } from '@alfalab/core-components-popover/modern';
|
|
7
7
|
import { getDataTestId } from '@alfalab/core-components-shared/modern';
|
|
8
8
|
import { useLayoutEffect_SAFE_FOR_SSR } from '@alfalab/hooks';
|
|
9
|
-
import { processOptions } from '../../utils.js';
|
|
9
|
+
import { defaultAccessor, processOptions, defaultFilterFn } from '../../utils.js';
|
|
10
10
|
import { NativeSelect } from '../native-select/Component.js';
|
|
11
11
|
|
|
12
|
-
const styles = {"component":"
|
|
12
|
+
const styles = {"component":"select__component_1wsby","popoverInner":"select__popoverInner_1wsby","optionsList":"select__optionsList_1wsby","optionsListBorder":"select__optionsListBorder_1wsby","nativeSelect":"select__nativeSelect_1wsby","block":"select__block_1wsby","emptySearchPlaceholder":"select__emptySearchPlaceholder_1wsby","search":"select__search_1wsby"};
|
|
13
13
|
require('./index.css')
|
|
14
14
|
|
|
15
15
|
/* eslint-disable no-nested-ternary */
|
|
16
|
-
const BaseSelect = forwardRef(
|
|
16
|
+
const BaseSelect = forwardRef(
|
|
17
|
+
// TODO: 😭
|
|
18
|
+
// eslint-disable-next-line complexity
|
|
19
|
+
({ dataTestId, className, fieldClassName, optionsListClassName, optionClassName, popperClassName, options, autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, nativeSelect = false, defaultOpen = false, open: openProp, popoverPosition = 'bottom-start', preventFlip = true, optionsListWidth = 'content', name, id, selected, size = 's', optionsSize = size, error, hint, block, label, labelView, placeholder, fieldProps = {}, optionsListProps = {}, optionProps = {}, searchProps = {}, showSearch = false, valueRenderer, onChange, onOpen, onFocus, onBlur, onScroll, Arrow, Field = () => null, OptionsList = () => null, Optgroup = () => null, Option = () => null, Search = () => null, updatePopover, zIndexPopover, showEmptyOptionsList = false, visibleOptions, }, ref) => {
|
|
17
20
|
const rootRef = useRef(null);
|
|
18
21
|
const fieldRef = useRef(null);
|
|
19
22
|
const listRef = useRef(null);
|
|
20
23
|
const initiatorRef = useRef(null);
|
|
24
|
+
const searchRef = useRef(null);
|
|
25
|
+
const [searchState, setSearchState] = React.useState('');
|
|
26
|
+
const [search, setSearch] = typeof searchProps?.value === 'string'
|
|
27
|
+
? [searchProps.value, searchProps.onChange]
|
|
28
|
+
: [searchState, setSearchState];
|
|
21
29
|
const itemToString = (option) => (option ? option.key : '');
|
|
22
|
-
const
|
|
30
|
+
const accessor = searchProps.accessor || defaultAccessor;
|
|
31
|
+
const { filteredOptions, flatOptions, selectedOptions } = useMemo(() => processOptions(options, selected, (option) => defaultFilterFn(accessor(option), search)), [accessor, options, search, selected]);
|
|
23
32
|
const useMultipleSelectionProps = {
|
|
24
33
|
itemToString,
|
|
25
34
|
onSelectedItemsChange: (changes) => {
|
|
@@ -69,6 +78,16 @@ const BaseSelect = forwardRef(({ dataTestId, className, fieldClassName, optionsL
|
|
|
69
78
|
});
|
|
70
79
|
}, 0);
|
|
71
80
|
}
|
|
81
|
+
if (showSearch) {
|
|
82
|
+
if (changes.isOpen) {
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
searchRef.current?.focus();
|
|
85
|
+
}, 0);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
setSearch?.('');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
72
91
|
},
|
|
73
92
|
stateReducer: (state, actionAndChanges) => {
|
|
74
93
|
const { type, changes } = actionAndChanges;
|
|
@@ -212,7 +231,7 @@ const BaseSelect = forwardRef(({ dataTestId, className, fieldClassName, optionsL
|
|
|
212
231
|
useLayoutEffect_SAFE_FOR_SSR(calcOptionsListWidth, [
|
|
213
232
|
open,
|
|
214
233
|
optionsListWidth,
|
|
215
|
-
|
|
234
|
+
filteredOptions,
|
|
216
235
|
selectedItems,
|
|
217
236
|
]);
|
|
218
237
|
const renderValue = useCallback(() => selectedItems.map((option) => (React.createElement("input", { type: 'hidden', name: name, value: option.key, key: option.key }))), [selectedItems, name]);
|
|
@@ -220,9 +239,43 @@ const BaseSelect = forwardRef(({ dataTestId, className, fieldClassName, optionsL
|
|
|
220
239
|
const value = multiple
|
|
221
240
|
? selectedItems.map((option) => option.key)
|
|
222
241
|
: (selectedItems[0] || {}).key;
|
|
223
|
-
return (React.createElement(NativeSelect, { ...menuProps, className: styles.nativeSelect, disabled: disabled, multiple: multiple, name: name, value: value, onChange: handleNativeSelectChange, options:
|
|
224
|
-
}, [
|
|
225
|
-
|
|
242
|
+
return (React.createElement(NativeSelect, { ...menuProps, className: styles.nativeSelect, disabled: disabled, multiple: multiple, name: name, value: value, onChange: handleNativeSelectChange, options: filteredOptions }));
|
|
243
|
+
}, [
|
|
244
|
+
multiple,
|
|
245
|
+
selectedItems,
|
|
246
|
+
disabled,
|
|
247
|
+
name,
|
|
248
|
+
handleNativeSelectChange,
|
|
249
|
+
filteredOptions,
|
|
250
|
+
menuProps,
|
|
251
|
+
]);
|
|
252
|
+
const { header, emptyPlaceholder } = optionsListProps;
|
|
253
|
+
const renderOptionsListHeader = () => {
|
|
254
|
+
if (!showSearch && !header) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
const handleClear = (event) => {
|
|
258
|
+
setSearch?.('');
|
|
259
|
+
searchProps?.componentProps?.onClear?.(event);
|
|
260
|
+
};
|
|
261
|
+
const handleChange = (event, payload) => {
|
|
262
|
+
setSearch?.(payload.value);
|
|
263
|
+
searchProps?.componentProps?.onChange?.(event, payload);
|
|
264
|
+
};
|
|
265
|
+
return (React.createElement(React.Fragment, null,
|
|
266
|
+
header,
|
|
267
|
+
showSearch && (React.createElement(Search, { ...searchProps?.componentProps, value: search, onChange: handleChange, dataTestId: getDataTestId(dataTestId, 'search'), onClear: handleClear, className: cn(styles.search, searchProps?.componentProps?.className), ref: searchRef }))));
|
|
268
|
+
};
|
|
269
|
+
const needRenderOptionsList = flatOptions.length > 0 || showEmptyOptionsList || showSearch;
|
|
270
|
+
const renderEmptyPlaceholder = useCallback(() => {
|
|
271
|
+
if (emptyPlaceholder) {
|
|
272
|
+
return emptyPlaceholder;
|
|
273
|
+
}
|
|
274
|
+
if (showSearch) {
|
|
275
|
+
return React.createElement("div", { className: styles.emptySearchPlaceholder }, "\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0448\u043B\u043E\u0441\u044C");
|
|
276
|
+
}
|
|
277
|
+
return undefined;
|
|
278
|
+
}, [emptyPlaceholder, showSearch]);
|
|
226
279
|
return (React.createElement("div", { ...getComboboxProps({
|
|
227
280
|
ref: rootRef,
|
|
228
281
|
...(disabled && { 'aria-disabled': true }),
|
|
@@ -244,7 +297,7 @@ const BaseSelect = forwardRef(({ dataTestId, className, fieldClassName, optionsL
|
|
|
244
297
|
}, dataTestId: getDataTestId(dataTestId, 'field'), ...fieldProps }),
|
|
245
298
|
name && !nativeSelect && renderValue(),
|
|
246
299
|
!nativeSelect && (React.createElement(Popover, { open: open, withTransition: false, anchorElement: fieldRef.current, position: popoverPosition, preventFlip: preventFlip, popperClassName: cn(styles.popoverInner, popperClassName), update: updatePopover, zIndex: zIndexPopover }, needRenderOptionsList && (React.createElement("div", { ...menuProps, className: cn(optionsListClassName, styles.optionsList) },
|
|
247
|
-
React.createElement(OptionsList, { ...optionsListProps, optionsListWidth: optionsListWidth, flatOptions: flatOptions, highlightedIndex: highlightedIndex, open: open, size: size, options:
|
|
300
|
+
React.createElement(OptionsList, { ...optionsListProps, optionsListWidth: optionsListWidth, flatOptions: flatOptions, highlightedIndex: highlightedIndex, open: open, size: size, options: filteredOptions, Optgroup: Optgroup, Option: Option, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, visibleOptions: visibleOptions, onScroll: onScroll, dataTestId: getDataTestId(dataTestId, 'options-list'), header: renderOptionsListHeader(), emptyPlaceholder: renderEmptyPlaceholder() }),
|
|
248
301
|
React.createElement("div", { className: styles.optionsListBorder })))))));
|
|
249
302
|
});
|
|
250
303
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1mplk */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-bg-primary: #fff;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
--border-radius-m: 8px;
|
|
19
19
|
} :root {
|
|
20
20
|
--gap-2xs: 4px;
|
|
21
|
+
--gap-s: 12px;
|
|
21
22
|
} :root {
|
|
22
23
|
} :root {
|
|
23
24
|
} :root {
|
|
@@ -36,11 +37,11 @@
|
|
|
36
37
|
/* checkmark */
|
|
37
38
|
|
|
38
39
|
/* optgroup */
|
|
39
|
-
} .
|
|
40
|
+
} .select__component_1wsby {
|
|
40
41
|
width: max-content;
|
|
41
42
|
position: relative;
|
|
42
43
|
outline: 0;
|
|
43
|
-
} .
|
|
44
|
+
} .select__popoverInner_1wsby {
|
|
44
45
|
padding-top: var(--select-options-list-offset);
|
|
45
46
|
padding-bottom: var(--select-options-list-offset);
|
|
46
47
|
box-shadow: none;
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
background: transparent;
|
|
49
50
|
border-radius: 0;
|
|
50
51
|
position: relative;
|
|
51
|
-
} .
|
|
52
|
+
} .select__optionsList_1wsby {
|
|
52
53
|
position: relative;
|
|
53
54
|
padding-top: var(--select-options-list-top-padding);
|
|
54
55
|
padding-bottom: var(--select-options-list-bottom-padding);
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
background: var(--select-option-background);
|
|
58
59
|
overflow: hidden;
|
|
59
60
|
will-change: transform;
|
|
60
|
-
} .
|
|
61
|
+
} .select__optionsListBorder_1wsby {
|
|
61
62
|
position: absolute;
|
|
62
63
|
top: 0;
|
|
63
64
|
right: 0;
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
box-shadow: inset 0 0 0 1px var(--color-light-border-secondary);
|
|
67
68
|
border-radius: inherit;
|
|
68
69
|
pointer-events: none;
|
|
69
|
-
} .
|
|
70
|
+
} .select__nativeSelect_1wsby {
|
|
70
71
|
opacity: 0;
|
|
71
72
|
overflow: hidden;
|
|
72
73
|
position: absolute;
|
|
@@ -79,10 +80,16 @@
|
|
|
79
80
|
height: 100%;
|
|
80
81
|
cursor: pointer;
|
|
81
82
|
z-index: 1;
|
|
82
|
-
} .
|
|
83
|
+
} .select__block_1wsby {
|
|
83
84
|
width: 100%;
|
|
84
|
-
}
|
|
85
|
-
|
|
85
|
+
} .select__emptySearchPlaceholder_1wsby {
|
|
86
|
+
text-align: center;
|
|
87
|
+
} .select__search_1wsby {
|
|
88
|
+
margin: var(--gap-s) var(--gap-s) 0
|
|
89
|
+
} .select__search_1wsby:last-child {
|
|
90
|
+
margin-bottom: var(--gap-s);
|
|
91
|
+
} /* width: max-content; fix for IE */ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
92
|
+
.select__component_1wsby {
|
|
86
93
|
float: left;
|
|
87
94
|
clear: left;
|
|
88
95
|
}
|
|
@@ -5,12 +5,13 @@ import { useMultipleSelection, useCombobox } from 'downshift';
|
|
|
5
5
|
import { BottomSheet } from '@alfalab/core-components-bottom-sheet/modern';
|
|
6
6
|
import { ModalMobile } from '@alfalab/core-components-modal/modern/mobile';
|
|
7
7
|
import { getDataTestId } from '@alfalab/core-components-shared/modern';
|
|
8
|
-
import { processOptions } from '../../utils.js';
|
|
8
|
+
import { defaultAccessor, processOptions, defaultFilterFn } from '../../utils.js';
|
|
9
9
|
import { Arrow } from '../arrow/Component.js';
|
|
10
10
|
import { Field } from '../field/Component.js';
|
|
11
11
|
import { Optgroup } from '../optgroup/Component.js';
|
|
12
12
|
import { Option } from '../option/Component.js';
|
|
13
13
|
import { OptionsList } from '../options-list/Component.js';
|
|
14
|
+
import { Search } from '../search/Component.js';
|
|
14
15
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
15
16
|
import '@alfalab/hooks';
|
|
16
17
|
import '../checkmark/Component.js';
|
|
@@ -21,18 +22,26 @@ import '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
|
21
22
|
import '../checkmark-mobile/Component.js';
|
|
22
23
|
import '@alfalab/core-components-scrollbar/modern';
|
|
23
24
|
import '../../consts.js';
|
|
25
|
+
import '@alfalab/core-components-input/modern';
|
|
26
|
+
import '@alfalab/icons-glyph/MagnifierMIcon';
|
|
24
27
|
|
|
25
|
-
const styles = {"component":"
|
|
28
|
+
const styles = {"component":"select__component_pw1dp","sheet":"select__sheet_pw1dp","sheetContent":"select__sheetContent_pw1dp","modalContent":"select__modalContent_pw1dp","sheetContainer":"select__sheetContainer_pw1dp","block":"select__block_pw1dp","optionsListWrapper":"select__optionsListWrapper_pw1dp","optionsList":"select__optionsList_pw1dp","scrollbar":"select__scrollbar_pw1dp","emptySearchPlaceholder":"select__emptySearchPlaceholder_pw1dp","search":"select__search_pw1dp","option":"select__option_pw1dp","optionGroup":"select__optionGroup_pw1dp"};
|
|
26
29
|
require('./index.css')
|
|
27
30
|
|
|
28
|
-
const BaseSelectMobile = forwardRef(({ dataTestId, className, fieldClassName, optionsListClassName, optionClassName, optionGroupClassName, optionsListProps, options = [], autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, defaultOpen = false, open: openProp, optionsListWidth = 'content', name, id, selected = [], size = 'm', optionsSize = 'm', error, hint, block, label, labelView, placeholder, fieldProps = {}, optionProps = {}, valueRenderer, onChange, onOpen, onFocus, onBlur, Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, OptionsList: OptionsList$1 = OptionsList, swipeable, footer, isBottomSheet, bottomSheetProps, modalProps, modalHeaderProps, modalFooterProps, showEmptyOptionsList = false, }, ref) => {
|
|
31
|
+
const BaseSelectMobile = forwardRef(({ dataTestId, className, fieldClassName, optionsListClassName, optionClassName, optionGroupClassName, optionsListProps, options = [], autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, defaultOpen = false, open: openProp, optionsListWidth = 'content', name, id, selected = [], size = 'm', optionsSize = 'm', error, hint, block, label, labelView, placeholder, fieldProps = {}, optionProps = {}, searchProps = {}, showSearch = false, valueRenderer, onChange, onOpen, onFocus, onBlur, Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, OptionsList: OptionsList$1 = OptionsList, Search: Search$1 = Search, swipeable, footer, isBottomSheet, bottomSheetProps, modalProps, modalHeaderProps, modalFooterProps, showEmptyOptionsList = false, }, ref) => {
|
|
29
32
|
const rootRef = useRef(null);
|
|
30
33
|
const fieldRef = useRef(null);
|
|
31
34
|
const listRef = useRef(null);
|
|
32
35
|
const initiatorRef = useRef(null);
|
|
33
36
|
const alreadyClickedRef = useRef(false);
|
|
37
|
+
const searchRef = useRef(null);
|
|
38
|
+
const [searchState, setSearchState] = React.useState('');
|
|
39
|
+
const [search, setSearch] = typeof searchProps?.value === 'string'
|
|
40
|
+
? [searchProps.value, searchProps.onChange]
|
|
41
|
+
: [searchState, setSearchState];
|
|
34
42
|
const itemToString = (option) => (option ? option.key : '');
|
|
35
|
-
const
|
|
43
|
+
const accessor = searchProps.accessor || defaultAccessor;
|
|
44
|
+
const { filteredOptions, flatOptions, selectedOptions } = useMemo(() => processOptions(options, selected, (option) => defaultFilterFn(accessor(option), search)), [accessor, options, search, selected]);
|
|
36
45
|
const scrollableContainerRef = useRef(null);
|
|
37
46
|
const useMultipleSelectionProps = {
|
|
38
47
|
itemToString,
|
|
@@ -83,6 +92,17 @@ const BaseSelectMobile = forwardRef(({ dataTestId, className, fieldClassName, op
|
|
|
83
92
|
});
|
|
84
93
|
}, 0);
|
|
85
94
|
}
|
|
95
|
+
if (showSearch) {
|
|
96
|
+
if (isOpen) {
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
searchRef.current?.focus();
|
|
99
|
+
// BottomSheet transition duration
|
|
100
|
+
}, 500);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
setSearch?.('');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
86
106
|
},
|
|
87
107
|
stateReducer: (state, actionAndChanges) => {
|
|
88
108
|
const { type, changes } = actionAndChanges;
|
|
@@ -206,11 +226,22 @@ const BaseSelectMobile = forwardRef(({ dataTestId, className, fieldClassName, op
|
|
|
206
226
|
toggleMenu();
|
|
207
227
|
};
|
|
208
228
|
const renderValue = () => selectedItems.map((option) => (React.createElement("input", { type: 'hidden', name: name, value: option.key, key: option.key })));
|
|
229
|
+
const renderSearch = () => showSearch && (React.createElement(Search$1, { ...searchProps?.componentProps, value: search, onChange: (_, payload) => setSearch?.(payload.value), dataTestId: getDataTestId(dataTestId, 'search'), onClear: () => setSearch?.(''), className: styles.search, ref: searchRef }));
|
|
230
|
+
const { emptyPlaceholder } = optionsListProps;
|
|
231
|
+
const renderEmptyPlaceholder = () => {
|
|
232
|
+
if (emptyPlaceholder) {
|
|
233
|
+
return emptyPlaceholder;
|
|
234
|
+
}
|
|
235
|
+
if (showSearch) {
|
|
236
|
+
return React.createElement("div", { className: styles.emptySearchPlaceholder }, "\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0448\u043B\u043E\u0441\u044C");
|
|
237
|
+
}
|
|
238
|
+
return undefined;
|
|
239
|
+
};
|
|
209
240
|
const renderOptionsList = () => {
|
|
210
|
-
if (flatOptions.length === 0 && !showEmptyOptionsList)
|
|
241
|
+
if (flatOptions.length === 0 && !showEmptyOptionsList && !showSearch)
|
|
211
242
|
return null;
|
|
212
|
-
return (React.createElement("div", { ...menuProps, className: optionsListClassName },
|
|
213
|
-
React.createElement(OptionsList$1, { ...optionsListProps, ref: scrollableContainerRef, optionsListWidth: optionsListWidth, flatOptions: flatOptions, highlightedIndex: highlightedIndex, open: open, size: size, options:
|
|
243
|
+
return (React.createElement("div", { ...menuProps, className: cn(styles.optionsListWrapper, optionsListClassName) },
|
|
244
|
+
React.createElement(OptionsList$1, { ...optionsListProps, ref: scrollableContainerRef, className: styles.optionsList, scrollbarClassName: styles.scrollbar, optionsListWidth: optionsListWidth, flatOptions: flatOptions, highlightedIndex: highlightedIndex, open: open, size: size, options: filteredOptions, Optgroup: Optgroup$1, Option: Option$1, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, visibleOptions: 0, dataTestId: getDataTestId(dataTestId, 'options-list'), optionGroupClassName: cn(styles.optionGroup, optionGroupClassName), emptyPlaceholder: renderEmptyPlaceholder() })));
|
|
214
245
|
};
|
|
215
246
|
return (React.createElement("div", { ...getComboboxProps({
|
|
216
247
|
ref: rootRef,
|
|
@@ -231,14 +262,16 @@ const BaseSelectMobile = forwardRef(({ dataTestId, className, fieldClassName, op
|
|
|
231
262
|
: undefined,
|
|
232
263
|
}, dataTestId: getDataTestId(dataTestId, 'field'), ...fieldProps }),
|
|
233
264
|
name && renderValue(),
|
|
234
|
-
isBottomSheet ? (React.createElement(BottomSheet, { open: open, onClose: handleClose, className: styles.sheet, contentClassName: styles.sheetContent, containerClassName: styles.sheetContainer, title: label || placeholder, actionButton: footer, stickyHeader: true, hasCloser: true, swipeable: swipeable, scrollableContainerRef: scrollableContainerRef,
|
|
265
|
+
isBottomSheet ? (React.createElement(BottomSheet, { open: open, onClose: handleClose, className: styles.sheet, contentClassName: styles.sheetContent, containerClassName: styles.sheetContainer, title: label || placeholder, actionButton: footer, stickyHeader: true, hasCloser: true, swipeable: swipeable, scrollableContainerRef: scrollableContainerRef, initialHeight: showSearch ? 'full' : 'default', ...bottomSheetProps, bottomAddons: React.createElement(React.Fragment, null,
|
|
266
|
+
renderSearch(),
|
|
267
|
+
bottomSheetProps?.bottomAddons) }, renderOptionsList())) : (React.createElement(ModalMobile, { open: open, hasCloser: true, ...modalProps, onClose: (...args) => {
|
|
235
268
|
handleClose();
|
|
236
269
|
modalProps?.onClose?.(...args);
|
|
237
270
|
}, contentClassName: cn(styles.sheetContent, modalProps?.contentClassName), ref: mergeRefs([
|
|
238
271
|
scrollableContainerRef,
|
|
239
272
|
modalProps?.ref,
|
|
240
273
|
]) },
|
|
241
|
-
React.createElement(ModalMobile.Header, { hasCloser: true, sticky: true, ...modalHeaderProps }, label || placeholder),
|
|
274
|
+
React.createElement(ModalMobile.Header, { hasCloser: true, sticky: true, bottomAddons: renderSearch(), ...modalHeaderProps }, label || placeholder),
|
|
242
275
|
React.createElement(ModalMobile.Content, { flex: true, className: styles.modalContent }, renderOptionsList()),
|
|
243
276
|
modalFooterProps?.children && React.createElement(ModalMobile.Footer, { ...modalFooterProps })))));
|
|
244
277
|
});
|
|
@@ -3,7 +3,7 @@ import cn from 'classnames';
|
|
|
3
3
|
import { BaseModalContext } from '@alfalab/core-components-base-modal/modern';
|
|
4
4
|
import { ButtonMobile } from '@alfalab/core-components-button/modern/mobile';
|
|
5
5
|
|
|
6
|
-
const styles = {"footer":"
|
|
6
|
+
const styles = {"footer":"select__footer_1r91a","button":"select__button_1r91a","highlighted":"select__highlighted_1r91a"};
|
|
7
7
|
require('./index.css')
|
|
8
8
|
|
|
9
9
|
const Footer = ({ handleApply, handleClear, showClear }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: be615 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-bg-primary: #fff;
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
/* checkmark */
|
|
27
27
|
|
|
28
28
|
/* optgroup */
|
|
29
|
-
} .
|
|
29
|
+
} .select__footer_1r91a {
|
|
30
30
|
display: flex;
|
|
31
31
|
box-sizing: border-box;
|
|
32
32
|
width: 100%;
|
|
33
33
|
padding: var(--gap-m) var(--gap-m);
|
|
34
34
|
background-color: var(--color-light-bg-primary)
|
|
35
|
-
} .
|
|
35
|
+
} .select__footer_1r91a .select__button_1r91a:first-of-type {
|
|
36
36
|
margin-right: var(--gap-m);
|
|
37
|
-
} .
|
|
37
|
+
} .select__button_1r91a {
|
|
38
38
|
width: 50%;
|
|
39
|
-
} .
|
|
39
|
+
} .select__highlighted_1r91a {
|
|
40
40
|
border-top: 1px solid var(--color-light-border-primary);
|
|
41
41
|
background-color: var(--color-light-bg-primary);
|
|
42
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1urbu */
|
|
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 */
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
} :root {
|
|
15
15
|
--gap-2xs: 4px;
|
|
16
16
|
--gap-xs: 8px;
|
|
17
|
+
--gap-s: 12px;
|
|
17
18
|
--gap-m: 16px;
|
|
18
19
|
--gap-l: 20px;
|
|
19
20
|
} :root {
|
|
@@ -27,29 +28,43 @@
|
|
|
27
28
|
/* checkmark */
|
|
28
29
|
|
|
29
30
|
/* optgroup */
|
|
30
|
-
} .
|
|
31
|
+
} .select__component_pw1dp {
|
|
31
32
|
width: max-content;
|
|
32
33
|
position: relative;
|
|
33
34
|
outline: 0;
|
|
34
|
-
} .
|
|
35
|
+
} .select__sheet_pw1dp {
|
|
35
36
|
overflow: hidden;
|
|
36
|
-
} .
|
|
37
|
+
} .select__sheetContent_pw1dp {
|
|
37
38
|
padding: 0
|
|
38
|
-
} .
|
|
39
|
+
} .select__sheetContent_pw1dp .select__modalContent_pw1dp {
|
|
39
40
|
padding: 0;
|
|
40
|
-
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
} .select__sheetContainer_pw1dp {
|
|
41
44
|
padding: 0;
|
|
42
|
-
} .
|
|
45
|
+
} .select__block_pw1dp {
|
|
43
46
|
width: 100%;
|
|
47
|
+
} .select__optionsListWrapper_pw1dp {
|
|
48
|
+
flex: 1;
|
|
49
|
+
} .select__optionsList_pw1dp {
|
|
50
|
+
height: 100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
} .select__scrollbar_pw1dp {
|
|
54
|
+
flex: 1;
|
|
55
|
+
} .select__emptySearchPlaceholder_pw1dp {
|
|
56
|
+
text-align: center;
|
|
57
|
+
} .select__search_pw1dp {
|
|
58
|
+
padding: var(--gap-m) var(--gap-xs) var(--gap-s);
|
|
44
59
|
} /* width: max-content; fix for IE */ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
45
|
-
.
|
|
60
|
+
.select__component_pw1dp {
|
|
46
61
|
float: left;
|
|
47
62
|
clear: left;
|
|
48
63
|
}
|
|
49
|
-
} .
|
|
64
|
+
} .select__option_pw1dp {
|
|
50
65
|
padding: var(--gap-2xs) var(--gap-l) var(--gap-2xs) var(--gap-m)
|
|
51
|
-
} .
|
|
66
|
+
} .select__option_pw1dp:before {
|
|
52
67
|
display: none;
|
|
53
|
-
} .
|
|
68
|
+
} .select__optionGroup_pw1dp {
|
|
54
69
|
padding: var(--gap-m) var(--gap-m) var(--gap-xs);
|
|
55
70
|
}
|
|
@@ -22,3 +22,6 @@ import '../checkmark-mobile/Component.js';
|
|
|
22
22
|
import '../options-list/Component.js';
|
|
23
23
|
import '@alfalab/core-components-scrollbar/modern';
|
|
24
24
|
import '../../consts.js';
|
|
25
|
+
import '../search/Component.js';
|
|
26
|
+
import '@alfalab/core-components-input/modern';
|
|
27
|
+
import '@alfalab/icons-glyph/MagnifierMIcon';
|
|
@@ -5,7 +5,7 @@ import { Checkbox } from '@alfalab/core-components-checkbox/modern';
|
|
|
5
5
|
import { CheckmarkCircleMIcon } from '@alfalab/icons-glyph/CheckmarkCircleMIcon';
|
|
6
6
|
import CheckmarkMIcon from '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
7
7
|
|
|
8
|
-
const styles = {"checkmark":"
|
|
8
|
+
const styles = {"checkmark":"select__checkmark_hfmqa","after":"select__after_hfmqa","single":"select__single_hfmqa","selected":"select__selected_hfmqa","before":"select__before_hfmqa","multiple":"select__multiple_hfmqa","colorIcon":"select__colorIcon_hfmqa"};
|
|
9
9
|
require('./index.css')
|
|
10
10
|
|
|
11
11
|
const Checkmark = ({ selected, disabled = false, className, multiple, position = 'before', }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 14xu0 */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-positive: #2fc26e;
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
--select-checkmark-border-radius: var(--border-radius-circle);
|
|
40
40
|
|
|
41
41
|
/* optgroup */
|
|
42
|
-
} .
|
|
42
|
+
} .select__checkmark_hfmqa {
|
|
43
43
|
flex-shrink: 0;
|
|
44
44
|
margin: var(--select-checkmark-margin)
|
|
45
|
-
} .
|
|
45
|
+
} .select__checkmark_hfmqa.select__after_hfmqa {
|
|
46
46
|
margin: var(--select-checkmark-margin-after);
|
|
47
|
-
} .
|
|
47
|
+
} .select__single_hfmqa {
|
|
48
48
|
display: flex;
|
|
49
49
|
align-items: center;
|
|
50
50
|
justify-content: center;
|
|
@@ -54,17 +54,17 @@
|
|
|
54
54
|
border-radius: var(--select-checkmark-border-radius);
|
|
55
55
|
width: var(--select-checkmark-size);
|
|
56
56
|
height: var(--select-checkmark-size)
|
|
57
|
-
} .
|
|
57
|
+
} .select__single_hfmqa.select__selected_hfmqa {
|
|
58
58
|
opacity: 1;
|
|
59
|
-
} .
|
|
59
|
+
} .select__before_hfmqa {
|
|
60
60
|
display: var(--select-checkmark-before-display)
|
|
61
|
-
} .
|
|
61
|
+
} .select__before_hfmqa.select__multiple_hfmqa {
|
|
62
62
|
margin-right: var(--gap-s);
|
|
63
63
|
display: var(--select-checkmark-before-display-multiple);
|
|
64
|
-
} .
|
|
64
|
+
} .select__after_hfmqa {
|
|
65
65
|
display: var(--select-checkmark-after-display)
|
|
66
|
-
} .
|
|
66
|
+
} .select__after_hfmqa.select__single_hfmqa {
|
|
67
67
|
display: var(--select-checkmark-after-display-single);
|
|
68
|
-
} .
|
|
68
|
+
} .select__colorIcon_hfmqa {
|
|
69
69
|
color: var(--color-light-graphic-positive);
|
|
70
70
|
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { CheckmarkMIcon } from '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
4
4
|
|
|
5
|
-
const styles = {"checkmark":"
|
|
5
|
+
const styles = {"checkmark":"select__checkmark_1fenf","selected":"select__selected_1fenf","displayIcon":"select__displayIcon_1fenf","displayBadge":"select__displayBadge_1fenf"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
const Checkmark = ({ selected, className }) => (React.createElement("div", { className: cn(styles.checkmark, className, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: fcfnk */
|
|
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 */
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
--select-mobile-checkmark-display-badge: none;
|
|
26
26
|
|
|
27
27
|
/* optgroup */
|
|
28
|
-
} .
|
|
28
|
+
} .select__checkmark_1fenf {
|
|
29
29
|
flex-shrink: 0;
|
|
30
30
|
display: flex;
|
|
31
31
|
align-items: center;
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
width: 24px;
|
|
34
34
|
height: 24px;
|
|
35
35
|
opacity: 0
|
|
36
|
-
} .
|
|
36
|
+
} .select__checkmark_1fenf:first-child {
|
|
37
37
|
display: none;
|
|
38
|
-
} .
|
|
38
|
+
} .select__checkmark_1fenf.select__selected_1fenf {
|
|
39
39
|
opacity: 1;
|
|
40
|
-
} .
|
|
40
|
+
} .select__displayIcon_1fenf {
|
|
41
41
|
display: var(--select-mobile-checkmark-display-icon);
|
|
42
|
-
} .
|
|
42
|
+
} .select__displayBadge_1fenf {
|
|
43
43
|
display: var(--select-mobile-checkmark-display-badge);
|
|
44
44
|
}
|
|
@@ -3,7 +3,7 @@ import cn from 'classnames';
|
|
|
3
3
|
import { useFocus } from '@alfalab/hooks';
|
|
4
4
|
import { joinOptions } from '../../utils.js';
|
|
5
5
|
|
|
6
|
-
const styles = {"component":"
|
|
6
|
+
const styles = {"component":"select__component_1ypxh","field":"select__field_1ypxh","disabled":"select__disabled_1ypxh","arrow":"select__arrow_1ypxh","placeholder":"select__placeholder_1ypxh","show-placeholder":"select__show-placeholder_1ypxh","focused":"select__focused_1ypxh","contentWrapper":"select__contentWrapper_1ypxh","value":"select__value_1ypxh","focusVisible":"select__focusVisible_1ypxh"};
|
|
7
7
|
require('./index.css')
|
|
8
8
|
|
|
9
9
|
const Field = ({ size = 'm', open, multiple, error, hint, disabled, label, labelView = 'inner', placeholder, selectedMultiple = [], selected, rightAddons, valueRenderer = joinOptions, setSelectedItems, toggleMenu, Arrow, innerProps, dataTestId, fieldClassName, FormControlComponent, ...restProps }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: wi7in */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #0072ef;
|
|
@@ -44,22 +44,22 @@
|
|
|
44
44
|
/* checkmark */
|
|
45
45
|
|
|
46
46
|
/* optgroup */
|
|
47
|
-
} .
|
|
47
|
+
} .select__component_1ypxh {
|
|
48
48
|
width: 100%;
|
|
49
49
|
outline: none;
|
|
50
|
-
} .
|
|
50
|
+
} .select__field_1ypxh:not(.select__disabled_1ypxh) {
|
|
51
51
|
cursor: pointer
|
|
52
|
-
} .
|
|
52
|
+
} .select__field_1ypxh:not(.select__disabled_1ypxh):hover .select__arrow_1ypxh {
|
|
53
53
|
opacity: var(--select-arrow-hover-opacity);
|
|
54
|
-
} .
|
|
54
|
+
} .select__disabled_1ypxh {
|
|
55
55
|
cursor: var(--disabled-cursor);
|
|
56
|
-
} .
|
|
56
|
+
} .select__placeholder_1ypxh {
|
|
57
57
|
color: var(--input-placeholder-color);
|
|
58
58
|
transition: color 0.2s ease;
|
|
59
|
-
animation: select__show-
|
|
60
|
-
} .
|
|
59
|
+
animation: select__show-placeholder_1ypxh 0.2s ease
|
|
60
|
+
} .select__placeholder_1ypxh.select__focused_1ypxh {
|
|
61
61
|
color: var(--input-focus-placeholder-color);
|
|
62
|
-
} .
|
|
62
|
+
} .select__contentWrapper_1ypxh {
|
|
63
63
|
font-size: 16px;
|
|
64
64
|
line-height: 20px;
|
|
65
65
|
font-weight: 400;
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
text-overflow: ellipsis;
|
|
69
69
|
overflow: hidden;
|
|
70
70
|
width: 100%;
|
|
71
|
-
} .
|
|
71
|
+
} .select__value_1ypxh {
|
|
72
72
|
overflow: hidden;
|
|
73
73
|
text-overflow: ellipsis;
|
|
74
74
|
text-align: left;
|
|
75
|
-
} .
|
|
75
|
+
} .select__focusVisible_1ypxh {
|
|
76
76
|
outline: 2px solid var(--focus-color);
|
|
77
77
|
outline-offset: 2px;
|
|
78
|
-
} @keyframes select__show-
|
|
78
|
+
} @keyframes select__show-placeholder_1ypxh {
|
|
79
79
|
from {
|
|
80
80
|
opacity: 0;
|
|
81
81
|
}
|
|
@@ -6,6 +6,7 @@ export { Option } from './option/Component.js';
|
|
|
6
6
|
export { OptionsList } from './options-list/Component.js';
|
|
7
7
|
export { VirtualOptionsList } from './virtual-options-list/Component.js';
|
|
8
8
|
export { BaseOption } from './base-option/Component.js';
|
|
9
|
+
export { Search } from './search/Component.js';
|
|
9
10
|
import 'react';
|
|
10
11
|
import 'classnames';
|
|
11
12
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
@@ -27,3 +28,5 @@ import '@alfalab/core-components-scrollbar/modern';
|
|
|
27
28
|
import '../consts.js';
|
|
28
29
|
import 'react-virtual';
|
|
29
30
|
import './base-checkmark/Component.js';
|
|
31
|
+
import '@alfalab/core-components-input/modern';
|
|
32
|
+
import '@alfalab/icons-glyph/MagnifierMIcon';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
const styles = {"optgroup":"
|
|
4
|
+
const styles = {"optgroup":"select__optgroup_12mvz","label":"select__label_12mvz","l":"select__l_12mvz","xl":"select__xl_12mvz"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
7
|
const Optgroup = ({ children, className, label, size = 's' }) => (React.createElement(React.Fragment, null,
|