@alfalab/core-components-select 9.4.2 → 9.6.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/CHANGELOG.md +41 -0
- package/dist/Component.d.ts +3 -3
- package/dist/Component.js +1 -1
- package/dist/components/arrow/Component.js +1 -1
- package/dist/components/arrow/index.css +3 -8
- package/dist/components/base-select/Component.js +22 -7
- package/dist/components/base-select/index.css +7 -10
- package/dist/components/base-select/index.js +1 -1
- package/dist/components/checkmark/Component.js +1 -1
- package/dist/components/checkmark/index.css +3 -6
- package/dist/components/field/Component.d.ts +1 -1
- package/dist/components/field/Component.js +2 -2
- package/dist/components/field/index.css +9 -12
- package/dist/components/field/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/native-select/Component.js +1 -1
- package/dist/components/native-select/index.js +1 -1
- package/dist/components/optgroup/Component.js +1 -1
- package/dist/components/optgroup/index.css +6 -9
- package/dist/components/option/Component.js +2 -2
- package/dist/components/option/index.css +20 -23
- package/dist/components/option/index.js +1 -1
- package/dist/components/options-list/Component.js +1 -1
- package/dist/components/options-list/index.css +5 -8
- package/dist/components/virtual-options-list/Component.js +1 -1
- package/dist/components/virtual-options-list/index.css +11 -14
- package/dist/cssm/Component.d.ts +3 -3
- package/dist/cssm/components/arrow/index.module.css +0 -5
- package/dist/cssm/components/base-select/Component.js +20 -5
- package/dist/cssm/components/base-select/index.module.css +0 -3
- package/dist/cssm/components/checkmark/index.module.css +0 -3
- package/dist/cssm/components/field/Component.d.ts +1 -1
- package/dist/cssm/components/field/index.module.css +0 -3
- package/dist/cssm/components/optgroup/index.module.css +0 -3
- package/dist/cssm/components/option/index.module.css +0 -3
- package/dist/cssm/components/options-list/index.module.css +0 -3
- package/dist/cssm/components/virtual-options-list/index.module.css +0 -3
- package/dist/cssm/presets/useLazyLoading/hook.d.ts +1 -0
- package/dist/cssm/presets/useLazyLoading/hook.js +10 -0
- package/dist/cssm/typings.d.ts +6 -2
- package/dist/esm/Component.d.ts +3 -3
- package/dist/esm/Component.js +1 -1
- package/dist/esm/components/arrow/Component.js +1 -1
- package/dist/esm/components/arrow/index.css +3 -8
- package/dist/esm/components/base-select/Component.js +22 -7
- package/dist/esm/components/base-select/index.css +7 -10
- package/dist/esm/components/base-select/index.js +1 -1
- package/dist/esm/components/checkmark/Component.js +1 -1
- package/dist/esm/components/checkmark/index.css +3 -6
- package/dist/esm/components/field/Component.d.ts +1 -1
- package/dist/esm/components/field/Component.js +2 -2
- package/dist/esm/components/field/index.css +9 -12
- package/dist/esm/components/field/index.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/native-select/Component.js +1 -1
- package/dist/esm/components/native-select/index.js +1 -1
- package/dist/esm/components/optgroup/Component.js +1 -1
- package/dist/esm/components/optgroup/index.css +6 -9
- package/dist/esm/components/option/Component.js +2 -2
- package/dist/esm/components/option/index.css +20 -23
- package/dist/esm/components/option/index.js +1 -1
- package/dist/esm/components/options-list/Component.js +1 -1
- package/dist/esm/components/options-list/index.css +5 -8
- package/dist/esm/components/virtual-options-list/Component.js +1 -1
- package/dist/esm/components/virtual-options-list/index.css +11 -14
- package/dist/esm/index.js +1 -1
- package/dist/esm/presets/index.js +1 -1
- package/dist/esm/presets/useLazyLoading/hook.d.ts +1 -0
- package/dist/esm/presets/useLazyLoading/hook.js +12 -2
- package/dist/esm/presets/useLazyLoading/index.css +2 -2
- package/dist/esm/presets/useSelectWithLoading/hook.js +2 -2
- package/dist/esm/presets/useSelectWithLoading/index.css +2 -2
- package/dist/esm/{tslib.es6-019b5eec.d.ts → tslib.es6-569ca735.d.ts} +0 -0
- package/dist/esm/{tslib.es6-019b5eec.js → tslib.es6-569ca735.js} +0 -0
- package/dist/esm/typings.d.ts +6 -2
- package/dist/index.js +1 -1
- package/dist/modern/Component.d.ts +3 -3
- package/dist/modern/components/arrow/Component.js +1 -1
- package/dist/modern/components/arrow/index.css +3 -8
- package/dist/modern/components/base-select/Component.js +21 -6
- package/dist/modern/components/base-select/index.css +7 -10
- package/dist/modern/components/checkmark/Component.js +1 -1
- package/dist/modern/components/checkmark/index.css +3 -6
- package/dist/modern/components/field/Component.d.ts +1 -1
- package/dist/modern/components/field/Component.js +1 -1
- package/dist/modern/components/field/index.css +9 -12
- package/dist/modern/components/optgroup/Component.js +1 -1
- package/dist/modern/components/optgroup/index.css +6 -9
- package/dist/modern/components/option/Component.js +1 -1
- package/dist/modern/components/option/index.css +20 -23
- package/dist/modern/components/options-list/Component.js +1 -1
- package/dist/modern/components/options-list/index.css +5 -8
- package/dist/modern/components/virtual-options-list/Component.js +1 -1
- package/dist/modern/components/virtual-options-list/index.css +11 -14
- package/dist/modern/presets/useLazyLoading/hook.d.ts +1 -0
- package/dist/modern/presets/useLazyLoading/hook.js +13 -1
- package/dist/modern/presets/useLazyLoading/index.css +2 -2
- package/dist/modern/presets/useSelectWithLoading/hook.js +1 -1
- package/dist/modern/presets/useSelectWithLoading/index.css +2 -2
- package/dist/modern/typings.d.ts +6 -2
- package/dist/presets/index.js +1 -1
- package/dist/presets/useLazyLoading/hook.d.ts +1 -0
- package/dist/presets/useLazyLoading/hook.js +12 -2
- package/dist/presets/useLazyLoading/index.css +2 -2
- package/dist/presets/useSelectWithLoading/hook.js +2 -2
- package/dist/presets/useSelectWithLoading/index.css +2 -2
- package/dist/{tslib.es6-032582d3.d.ts → tslib.es6-f19a86c5.d.ts} +0 -0
- package/dist/{tslib.es6-032582d3.js → tslib.es6-f19a86c5.js} +0 -0
- package/dist/typings.d.ts +6 -2
- package/package.json +5 -5
|
@@ -12,10 +12,10 @@ const getDataTestId = (dataTestId, element) => {
|
|
|
12
12
|
return dataTestId ? `${dataTestId}${elementPart}` : undefined;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
var styles = {"component":"
|
|
15
|
+
var styles = {"component":"select__component_1uqsl","popoverInner":"select__popoverInner_1uqsl","optionsList":"select__optionsList_1uqsl","nativeSelect":"select__nativeSelect_1uqsl","block":"select__block_1uqsl"};
|
|
16
16
|
require('./index.css')
|
|
17
17
|
|
|
18
|
-
const BaseSelect = forwardRef(({ dataTestId, className, fieldClassName, optionsListClassName, optionClassName, options, autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, nativeSelect = false, defaultOpen = false, popoverPosition = 'bottom-start', preventFlip = true, optionsListWidth = 'content', name, id, selected, size = 's', optionsSize = size, error, hint, block, label, placeholder, fieldProps = {}, optionsListProps = {}, optionProps = {}, valueRenderer, onChange, onOpen, onFocus, onBlur, onScroll, Arrow, Field = () => null, OptionsList = () => null, Optgroup = () => null, Option = () => null, updatePopover, showEmptyOptionsList = false, visibleOptions, }, ref) => {
|
|
18
|
+
const BaseSelect = forwardRef(({ dataTestId, className, fieldClassName, optionsListClassName, optionClassName, 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, placeholder, fieldProps = {}, optionsListProps = {}, optionProps = {}, valueRenderer, onChange, onOpen, onFocus, onBlur, onScroll, Arrow, Field = () => null, OptionsList = () => null, Optgroup = () => null, Option = () => null, updatePopover, showEmptyOptionsList = false, visibleOptions, }, ref) => {
|
|
19
19
|
const rootRef = useRef(null);
|
|
20
20
|
const fieldRef = useRef(null);
|
|
21
21
|
const listRef = useRef(null);
|
|
@@ -51,16 +51,25 @@ const BaseSelect = forwardRef(({ dataTestId, className, fieldClassName, optionsL
|
|
|
51
51
|
const { selectedItems, addSelectedItem, setSelectedItems, removeSelectedItem, getDropdownProps, } = useMultipleSelection(useMultipleSelectionProps);
|
|
52
52
|
const { isOpen: open, getMenuProps, getInputProps, getItemProps, getComboboxProps, getLabelProps, highlightedIndex, toggleMenu, openMenu, } = useCombobox({
|
|
53
53
|
id,
|
|
54
|
+
isOpen: openProp,
|
|
54
55
|
circularNavigation,
|
|
55
56
|
items: flatOptions,
|
|
56
57
|
itemToString,
|
|
57
58
|
defaultHighlightedIndex: selectedItems.length === 0 ? -1 : undefined,
|
|
58
59
|
onIsOpenChange: changes => {
|
|
59
60
|
if (onOpen) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Вызываем обработчик асинхронно.
|
|
63
|
+
*
|
|
64
|
+
* Иначе при клике вне открытого селекта сначала сработает onOpen, который закроет селект,
|
|
65
|
+
* А затем сработает onClick кнопки открытия\закрытия с open=false и в итоге селект откроется снова.
|
|
66
|
+
*/
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
onOpen({
|
|
69
|
+
open: changes.isOpen,
|
|
70
|
+
name,
|
|
71
|
+
});
|
|
72
|
+
}, 0);
|
|
64
73
|
}
|
|
65
74
|
},
|
|
66
75
|
stateReducer: (state, actionAndChanges) => {
|
|
@@ -172,6 +181,12 @@ const BaseSelect = forwardRef(({ dataTestId, className, fieldClassName, optionsL
|
|
|
172
181
|
if (defaultOpen)
|
|
173
182
|
openMenu();
|
|
174
183
|
}, [defaultOpen, openMenu]);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (openProp) {
|
|
186
|
+
openMenu();
|
|
187
|
+
}
|
|
188
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
189
|
+
}, []);
|
|
175
190
|
const calcOptionsListWidth = useCallback(() => {
|
|
176
191
|
if (listRef.current) {
|
|
177
192
|
const widthAttr = optionsListWidth === 'field' ? 'width' : 'minWidth';
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1uqsl */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
|
-
|
|
5
|
-
/* TODO: цвета добавлены руками. Обновить токены */
|
|
6
|
-
--color-light-text-secondary-inverted-transparent: rgba(255, 255, 255, 0.7);
|
|
7
4
|
}
|
|
8
5
|
:root {
|
|
9
6
|
--shadow-s: 0 0 8px rgba(11, 31, 53, 0.04), 0 4px 8px rgba(11, 31, 53, 0.08);
|
|
@@ -31,12 +28,12 @@
|
|
|
31
28
|
|
|
32
29
|
/* optgroup */
|
|
33
30
|
}
|
|
34
|
-
.
|
|
31
|
+
.select__component_1uqsl {
|
|
35
32
|
width: max-content;
|
|
36
33
|
position: relative;
|
|
37
34
|
outline: 0;
|
|
38
35
|
}
|
|
39
|
-
.
|
|
36
|
+
.select__popoverInner_1uqsl {
|
|
40
37
|
padding-top: var(--select-options-list-offset);
|
|
41
38
|
padding-bottom: var(--select-options-list-offset);
|
|
42
39
|
box-shadow: none;
|
|
@@ -45,7 +42,7 @@
|
|
|
45
42
|
border-radius: 0;
|
|
46
43
|
position: relative;
|
|
47
44
|
}
|
|
48
|
-
.
|
|
45
|
+
.select__optionsList_1uqsl {
|
|
49
46
|
padding-top: var(--select-options-list-top-padding);
|
|
50
47
|
padding-bottom: var(--select-options-list-bottom-padding);
|
|
51
48
|
box-shadow: var(--select-options-list-box-shadow);
|
|
@@ -54,7 +51,7 @@
|
|
|
54
51
|
overflow: hidden;
|
|
55
52
|
will-change: transform;
|
|
56
53
|
}
|
|
57
|
-
.
|
|
54
|
+
.select__nativeSelect_1uqsl {
|
|
58
55
|
opacity: 0;
|
|
59
56
|
overflow: hidden;
|
|
60
57
|
position: absolute;
|
|
@@ -68,12 +65,12 @@
|
|
|
68
65
|
cursor: pointer;
|
|
69
66
|
z-index: 1;
|
|
70
67
|
}
|
|
71
|
-
.
|
|
68
|
+
.select__block_1uqsl {
|
|
72
69
|
width: 100%;
|
|
73
70
|
}
|
|
74
71
|
/* width: max-content; fix for IE */
|
|
75
72
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
76
|
-
.
|
|
73
|
+
.select__component_1uqsl {
|
|
77
74
|
float: left;
|
|
78
75
|
clear: left;
|
|
79
76
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
var styles = {"checkmark":"
|
|
4
|
+
var styles = {"checkmark":"select__checkmark_1yq1s","selected":"select__selected_1yq1s"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
7
|
const Checkmark = ({ selected }) => (React.createElement("span", { className: cn(styles.checkmark, {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1yq1s */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-primary: #0b1f35;
|
|
4
|
-
|
|
5
|
-
/* TODO: цвета добавлены руками. Обновить токены */
|
|
6
|
-
--color-light-text-secondary-inverted-transparent: rgba(255, 255, 255, 0.7);
|
|
7
4
|
}
|
|
8
5
|
:root {
|
|
9
6
|
|
|
@@ -36,7 +33,7 @@
|
|
|
36
33
|
|
|
37
34
|
/* optgroup */
|
|
38
35
|
}
|
|
39
|
-
.
|
|
36
|
+
.select__checkmark_1yq1s {
|
|
40
37
|
display: flex;
|
|
41
38
|
align-items: center;
|
|
42
39
|
justify-content: center;
|
|
@@ -50,6 +47,6 @@
|
|
|
50
47
|
width: var(--select-checkmark-size);
|
|
51
48
|
height: var(--select-checkmark-size);
|
|
52
49
|
}
|
|
53
|
-
.
|
|
50
|
+
.select__selected_1yq1s {
|
|
54
51
|
opacity: 1;
|
|
55
52
|
}
|
|
@@ -8,7 +8,7 @@ declare const Field: ({ size, open, multiple, error, hint, disabled, label, plac
|
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
filled?: boolean | undefined;
|
|
10
10
|
focused?: boolean | undefined;
|
|
11
|
-
error?:
|
|
11
|
+
error?: React.ReactNode;
|
|
12
12
|
hint?: React.ReactNode;
|
|
13
13
|
label?: React.ReactNode;
|
|
14
14
|
leftAddons?: React.ReactNode;
|
|
@@ -4,7 +4,7 @@ import { useFocus } from '@alfalab/hooks';
|
|
|
4
4
|
import { FormControl } from '@alfalab/core-components-form-control/dist/modern';
|
|
5
5
|
import { joinOptions } from '../../utils.js';
|
|
6
6
|
|
|
7
|
-
var styles = {"component":"
|
|
7
|
+
var styles = {"component":"select__component_vno7x","field":"select__field_vno7x","disabled":"select__disabled_vno7x","arrow":"select__arrow_vno7x","placeholder":"select__placeholder_vno7x","contentWrapper":"select__contentWrapper_vno7x","value":"select__value_vno7x","focusVisible":"select__focusVisible_vno7x"};
|
|
8
8
|
require('./index.css')
|
|
9
9
|
|
|
10
10
|
const Field = ({ size = 'm', open, multiple, error, hint, disabled, label, placeholder, selectedMultiple = [], selected, rightAddons, valueRenderer = joinOptions, Arrow, innerProps, dataTestId, fieldClassName, ...restProps }) => {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: vno7x */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-link: #007aff;
|
|
4
4
|
--color-light-text-secondary: #546272;
|
|
5
|
-
|
|
6
|
-
/* TODO: цвета добавлены руками. Обновить токены */
|
|
7
|
-
--color-light-text-secondary-inverted-transparent: rgba(255, 255, 255, 0.7);
|
|
8
5
|
}
|
|
9
6
|
:root {
|
|
10
7
|
|
|
@@ -29,24 +26,24 @@
|
|
|
29
26
|
|
|
30
27
|
/* optgroup */
|
|
31
28
|
}
|
|
32
|
-
.
|
|
29
|
+
.select__component_vno7x {
|
|
33
30
|
width: 100%;
|
|
34
31
|
outline: none;
|
|
35
32
|
}
|
|
36
|
-
.
|
|
33
|
+
.select__field_vno7x:not(.select__disabled_vno7x) {
|
|
37
34
|
cursor: pointer
|
|
38
35
|
}
|
|
39
|
-
.
|
|
36
|
+
.select__field_vno7x:not(.select__disabled_vno7x):hover .select__arrow_vno7x {
|
|
40
37
|
opacity: var(--select-arrow-hover-opacity);
|
|
41
38
|
}
|
|
42
|
-
.
|
|
39
|
+
.select__disabled_vno7x {
|
|
43
40
|
cursor: var(--disabled-cursor);
|
|
44
41
|
}
|
|
45
42
|
/* TODO: Заюзать переменные из инпута */
|
|
46
|
-
.
|
|
43
|
+
.select__placeholder_vno7x {
|
|
47
44
|
color: var(--color-light-text-secondary);
|
|
48
45
|
}
|
|
49
|
-
.
|
|
46
|
+
.select__contentWrapper_vno7x {
|
|
50
47
|
font-size: 16px;
|
|
51
48
|
line-height: 20px;
|
|
52
49
|
font-weight: 400;
|
|
@@ -56,12 +53,12 @@
|
|
|
56
53
|
overflow: hidden;
|
|
57
54
|
width: 100%;
|
|
58
55
|
}
|
|
59
|
-
.
|
|
56
|
+
.select__value_vno7x {
|
|
60
57
|
overflow: hidden;
|
|
61
58
|
text-overflow: ellipsis;
|
|
62
59
|
text-align: left;
|
|
63
60
|
}
|
|
64
|
-
.
|
|
61
|
+
.select__focusVisible_vno7x {
|
|
65
62
|
outline: 2px solid var(--focus-color);
|
|
66
63
|
outline-offset: 2px;
|
|
67
64
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
var styles = {"optgroup":"
|
|
4
|
+
var styles = {"optgroup":"select__optgroup_q5inb","label":"select__label_q5inb","l":"select__l_q5inb","xl":"select__xl_q5inb"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
7
|
const Optgroup = ({ children, label, size = 's' }) => (React.createElement(React.Fragment, null,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: q5inb */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
--color-light-text-secondary: #546272;
|
|
5
|
-
|
|
6
|
-
/* TODO: цвета добавлены руками. Обновить токены */
|
|
7
|
-
--color-light-text-secondary-inverted-transparent: rgba(255, 255, 255, 0.7);
|
|
8
5
|
}
|
|
9
6
|
:root {
|
|
10
7
|
|
|
@@ -36,7 +33,7 @@
|
|
|
36
33
|
--select-optgroup-l-left-padding: var(--gap-m);
|
|
37
34
|
--select-optgroup-l-right-padding: var(--gap-m);
|
|
38
35
|
}
|
|
39
|
-
.
|
|
36
|
+
.select__optgroup_q5inb {
|
|
40
37
|
position: relative;
|
|
41
38
|
display: flex;
|
|
42
39
|
align-items: center;
|
|
@@ -46,10 +43,10 @@
|
|
|
46
43
|
background: var(--select-optgroup-background);
|
|
47
44
|
min-height: 40px
|
|
48
45
|
}
|
|
49
|
-
.
|
|
46
|
+
.select__optgroup_q5inb + *[role='option']:before {
|
|
50
47
|
display: none;
|
|
51
48
|
}
|
|
52
|
-
.
|
|
49
|
+
.select__label_q5inb {
|
|
53
50
|
font-size: 12px;
|
|
54
51
|
line-height: 16px;
|
|
55
52
|
font-weight: 500;
|
|
@@ -59,8 +56,8 @@
|
|
|
59
56
|
display: block;
|
|
60
57
|
color: var(--select-optgroup-color);
|
|
61
58
|
}
|
|
62
|
-
.
|
|
63
|
-
.
|
|
59
|
+
.select__l_q5inb,
|
|
60
|
+
.select__xl_q5inb {
|
|
64
61
|
padding-left: var(--select-optgroup-l-left-padding);
|
|
65
62
|
padding-right: var(--select-optgroup-l-right-padding);
|
|
66
63
|
}
|
|
@@ -2,7 +2,7 @@ import React, { isValidElement } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Checkmark } from '../checkmark/Component.js';
|
|
4
4
|
|
|
5
|
-
var styles = {"option":"
|
|
5
|
+
var styles = {"option":"select__option_1g0al","disabled":"select__disabled_1g0al","s":"select__s_1g0al","m":"select__m_1g0al","l":"select__l_1g0al","xl":"select__xl_1g0al","selected":"select__selected_1g0al","highlighted":"select__highlighted_1g0al","content":"select__content_1g0al","textContent":"select__textContent_1g0al"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
const Option = ({ size = 's', className, option, children, selected, highlighted, disabled, Checkmark: Checkmark$1 = Checkmark, innerProps, dataTestId, }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1g0al */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
--color-light-bg-secondary: #f3f4f5;
|
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
--color-light-border-primary: #dbdee1;
|
|
7
7
|
--color-light-text-primary: #0b1f35;
|
|
8
8
|
--color-light-text-secondary: #546272;
|
|
9
|
-
|
|
10
|
-
/* TODO: цвета добавлены руками. Обновить токены */
|
|
11
|
-
--color-light-text-secondary-inverted-transparent: rgba(255, 255, 255, 0.7);
|
|
12
9
|
}
|
|
13
10
|
:root {
|
|
14
11
|
|
|
@@ -56,7 +53,7 @@
|
|
|
56
53
|
|
|
57
54
|
/* optgroup */
|
|
58
55
|
}
|
|
59
|
-
.
|
|
56
|
+
.select__option_1g0al {
|
|
60
57
|
font-size: 16px;
|
|
61
58
|
line-height: 20px;
|
|
62
59
|
font-weight: 400;
|
|
@@ -72,11 +69,11 @@
|
|
|
72
69
|
position: relative;
|
|
73
70
|
cursor: pointer
|
|
74
71
|
}
|
|
75
|
-
.
|
|
72
|
+
.select__option_1g0al:not(.select__disabled_1g0al):active {
|
|
76
73
|
background: var(--select-option-active-background);
|
|
77
74
|
color: var(--select-option-active-color);
|
|
78
75
|
}
|
|
79
|
-
.
|
|
76
|
+
.select__option_1g0al:before {
|
|
80
77
|
content: '';
|
|
81
78
|
position: absolute;
|
|
82
79
|
left: var(--select-option-left-padding);
|
|
@@ -87,60 +84,60 @@
|
|
|
87
84
|
display: var(--select-option-divider-display);
|
|
88
85
|
transition: opacity 0.2s ease;
|
|
89
86
|
}
|
|
90
|
-
.
|
|
87
|
+
.select__option_1g0al:first-child:before {
|
|
91
88
|
display: none;
|
|
92
89
|
}
|
|
93
|
-
.
|
|
90
|
+
.select__s_1g0al {
|
|
94
91
|
min-height: var(--size-s-height);
|
|
95
92
|
}
|
|
96
|
-
.
|
|
93
|
+
.select__m_1g0al {
|
|
97
94
|
min-height: var(--size-m-height);
|
|
98
95
|
}
|
|
99
|
-
.
|
|
96
|
+
.select__l_1g0al {
|
|
100
97
|
min-height: var(--size-l-height);
|
|
101
98
|
}
|
|
102
|
-
.
|
|
99
|
+
.select__xl_1g0al {
|
|
103
100
|
min-height: var(--size-xl-height);
|
|
104
101
|
}
|
|
105
|
-
.
|
|
106
|
-
.
|
|
102
|
+
.select__l_1g0al,
|
|
103
|
+
.select__xl_1g0al {
|
|
107
104
|
padding-left: var(--select-option-l-left-padding);
|
|
108
105
|
padding-right: var(--select-option-l-right-padding)
|
|
109
106
|
}
|
|
110
|
-
.
|
|
107
|
+
.select__l_1g0al:before, .select__xl_1g0al:before {
|
|
111
108
|
left: var(--select-option-l-left-padding);
|
|
112
109
|
right: var(--select-option-l-right-padding);
|
|
113
110
|
}
|
|
114
|
-
.
|
|
111
|
+
.select__selected_1g0al {
|
|
115
112
|
background: var(--select-option-selected-background);
|
|
116
113
|
color: var(--select-option-selected-color);
|
|
117
114
|
cursor: default;
|
|
118
115
|
}
|
|
119
|
-
.
|
|
116
|
+
.select__highlighted_1g0al {
|
|
120
117
|
background: var(--select-option-hover-background);
|
|
121
118
|
color: var(--select-option-hover-color)
|
|
122
119
|
}
|
|
123
|
-
.
|
|
124
|
-
.
|
|
120
|
+
.select__highlighted_1g0al:before,
|
|
121
|
+
.select__highlighted_1g0al + .select__option_1g0al:before {
|
|
125
122
|
opacity: 0;
|
|
126
123
|
}
|
|
127
|
-
.
|
|
124
|
+
.select__disabled_1g0al {
|
|
128
125
|
cursor: var(--disabled-cursor);
|
|
129
126
|
background: var(--select-option-disabled-background);
|
|
130
127
|
color: var(--select-option-disabled-color);
|
|
131
128
|
}
|
|
132
|
-
.
|
|
129
|
+
.select__content_1g0al {
|
|
133
130
|
overflow: hidden;
|
|
134
131
|
text-overflow: ellipsis;
|
|
135
132
|
flex: 1;
|
|
136
133
|
}
|
|
137
|
-
.
|
|
134
|
+
.select__textContent_1g0al {
|
|
138
135
|
padding-top: var(--gap-s);
|
|
139
136
|
padding-bottom: var(--gap-s);
|
|
140
137
|
}
|
|
141
138
|
/* IE min-height fix */
|
|
142
139
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
143
|
-
.
|
|
140
|
+
.select__option_1g0al:after {
|
|
144
141
|
min-height: inherit;
|
|
145
142
|
font-size: 0;
|
|
146
143
|
content: '';
|
|
@@ -4,7 +4,7 @@ import { useVisibleOptions, isGroup } from '../../utils.js';
|
|
|
4
4
|
import mergeRefs from 'react-merge-refs';
|
|
5
5
|
import { Optgroup } from '../optgroup/Component.js';
|
|
6
6
|
|
|
7
|
-
var styles = {"optionsList":"
|
|
7
|
+
var styles = {"optionsList":"select__optionsList_z26dc","emptyPlaceholder":"select__emptyPlaceholder_z26dc","l":"select__l_z26dc","xl":"select__xl_z26dc"};
|
|
8
8
|
require('./index.css')
|
|
9
9
|
|
|
10
10
|
const createCounter = () => {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: z26dc */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-text-secondary: #546272;
|
|
4
|
-
|
|
5
|
-
/* TODO: цвета добавлены руками. Обновить токены */
|
|
6
|
-
--color-light-text-secondary-inverted-transparent: rgba(255, 255, 255, 0.7);
|
|
7
4
|
}
|
|
8
5
|
:root {
|
|
9
6
|
|
|
@@ -29,17 +26,17 @@
|
|
|
29
26
|
|
|
30
27
|
/* optgroup */
|
|
31
28
|
}
|
|
32
|
-
.
|
|
29
|
+
.select__optionsList_z26dc {
|
|
33
30
|
overflow: auto;
|
|
34
31
|
width: 100%;
|
|
35
32
|
outline: none;
|
|
36
33
|
box-sizing: border-box;
|
|
37
34
|
}
|
|
38
|
-
.
|
|
35
|
+
.select__emptyPlaceholder_z26dc {
|
|
39
36
|
padding: var(--gap-m) var(--gap-s);
|
|
40
37
|
color: var(--select-options-list-empty-placeholder-color);
|
|
41
38
|
}
|
|
42
|
-
.
|
|
43
|
-
.
|
|
39
|
+
.select__l_z26dc .select__emptyPlaceholder_z26dc,
|
|
40
|
+
.select__xl_z26dc .select__emptyPlaceholder_z26dc {
|
|
44
41
|
padding: var(--gap-xl) var(--gap-m);
|
|
45
42
|
}
|
|
@@ -4,7 +4,7 @@ import { usePrevious, lastIndexOf, useVisibleOptions, isGroup } from '../../util
|
|
|
4
4
|
import { Optgroup } from '../optgroup/Component.js';
|
|
5
5
|
import { useVirtual } from 'react-virtual';
|
|
6
6
|
|
|
7
|
-
var styles = {"virtualOptionsList":"
|
|
7
|
+
var styles = {"virtualOptionsList":"select__virtualOptionsList_2dlim","inner":"select__inner_2dlim","virtualRow":"select__virtualRow_2dlim","highlighted":"select__highlighted_2dlim","emptyPlaceholder":"select__emptyPlaceholder_2dlim","l":"select__l_2dlim","xl":"select__xl_2dlim"};
|
|
8
8
|
require('./index.css')
|
|
9
9
|
|
|
10
10
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 2dlim */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-text-secondary: #546272;
|
|
5
|
-
|
|
6
|
-
/* TODO: цвета добавлены руками. Обновить токены */
|
|
7
|
-
--color-light-text-secondary-inverted-transparent: rgba(255, 255, 255, 0.7);
|
|
8
5
|
}
|
|
9
6
|
:root {
|
|
10
7
|
|
|
@@ -35,24 +32,24 @@
|
|
|
35
32
|
|
|
36
33
|
/* optgroup */
|
|
37
34
|
}
|
|
38
|
-
.
|
|
35
|
+
.select__virtualOptionsList_2dlim {
|
|
39
36
|
overflow: auto;
|
|
40
37
|
width: 100%;
|
|
41
38
|
outline: none;
|
|
42
39
|
box-sizing: border-box;
|
|
43
40
|
position: relative;
|
|
44
41
|
}
|
|
45
|
-
.
|
|
42
|
+
.select__inner_2dlim {
|
|
46
43
|
position: relative;
|
|
47
44
|
width: 100%;
|
|
48
45
|
}
|
|
49
|
-
.
|
|
46
|
+
.select__virtualRow_2dlim {
|
|
50
47
|
position: absolute;
|
|
51
48
|
top: 0;
|
|
52
49
|
left: 0;
|
|
53
50
|
width: 100%
|
|
54
51
|
}
|
|
55
|
-
.
|
|
52
|
+
.select__virtualRow_2dlim:before {
|
|
56
53
|
content: '';
|
|
57
54
|
position: absolute;
|
|
58
55
|
z-index: 1;
|
|
@@ -63,18 +60,18 @@
|
|
|
63
60
|
background: var(--select-option-divider-background);
|
|
64
61
|
display: var(--select-option-divider-display);
|
|
65
62
|
}
|
|
66
|
-
.
|
|
63
|
+
.select__virtualRow_2dlim:first-child:before {
|
|
67
64
|
display: none;
|
|
68
65
|
}
|
|
69
|
-
.
|
|
70
|
-
.
|
|
66
|
+
.select__highlighted_2dlim:before,
|
|
67
|
+
.select__highlighted_2dlim + .select__virtualRow_2dlim:before {
|
|
71
68
|
display: none;
|
|
72
69
|
}
|
|
73
|
-
.
|
|
70
|
+
.select__emptyPlaceholder_2dlim {
|
|
74
71
|
padding: var(--gap-m) var(--gap-s);
|
|
75
72
|
color: var(--select-options-list-empty-placeholder-color);
|
|
76
73
|
}
|
|
77
|
-
.
|
|
78
|
-
.
|
|
74
|
+
.select__l_2dlim .select__emptyPlaceholder_2dlim,
|
|
75
|
+
.select__xl_2dlim .select__emptyPlaceholder_2dlim {
|
|
79
76
|
padding: var(--gap-xl) var(--gap-m);
|
|
80
77
|
}
|
|
@@ -896,7 +896,7 @@ import { Skeleton } from '@alfalab/core-components-skeleton/dist/modern';
|
|
|
896
896
|
window.IntersectionObserverEntry = IntersectionObserverEntry;
|
|
897
897
|
}());
|
|
898
898
|
|
|
899
|
-
var styles = {"skeleton":"
|
|
899
|
+
var styles = {"skeleton":"select__skeleton_ansiq"};
|
|
900
900
|
require('./index.css')
|
|
901
901
|
|
|
902
902
|
const DEBOUNCE_TIMEOUT = 300;
|
|
@@ -916,6 +916,9 @@ const actions = {
|
|
|
916
916
|
setQueryString(qs) {
|
|
917
917
|
return { type: 'SET_QUERY_STRING', payload: qs };
|
|
918
918
|
},
|
|
919
|
+
reset() {
|
|
920
|
+
return { type: 'RESET' };
|
|
921
|
+
},
|
|
919
922
|
};
|
|
920
923
|
function useLazyLoading({ limit = 10, initialOffset = 0, optionsFetcher, skeleton = React.createElement(Skeleton, { className: styles.skeleton, visible: true }), }) {
|
|
921
924
|
const initialOptions = [];
|
|
@@ -966,6 +969,11 @@ function useLazyLoading({ limit = 10, initialOffset = 0, optionsFetcher, skeleto
|
|
|
966
969
|
queryString: action.payload,
|
|
967
970
|
};
|
|
968
971
|
}
|
|
972
|
+
case 'RESET': {
|
|
973
|
+
return {
|
|
974
|
+
...lazyLoadingInitialState,
|
|
975
|
+
};
|
|
976
|
+
}
|
|
969
977
|
default: {
|
|
970
978
|
return state;
|
|
971
979
|
}
|
|
@@ -1075,6 +1083,9 @@ function useLazyLoading({ limit = 10, initialOffset = 0, optionsFetcher, skeleto
|
|
|
1075
1083
|
content: skeleton,
|
|
1076
1084
|
}));
|
|
1077
1085
|
}, [loading, limit, skeleton]);
|
|
1086
|
+
const reset = useCallback(() => {
|
|
1087
|
+
dispatch(actions.reset());
|
|
1088
|
+
}, []);
|
|
1078
1089
|
return {
|
|
1079
1090
|
optionsProps: {
|
|
1080
1091
|
Option: renderOption,
|
|
@@ -1088,6 +1099,7 @@ function useLazyLoading({ limit = 10, initialOffset = 0, optionsFetcher, skeleto
|
|
|
1088
1099
|
},
|
|
1089
1100
|
onOpen,
|
|
1090
1101
|
},
|
|
1102
|
+
reset,
|
|
1091
1103
|
};
|
|
1092
1104
|
}
|
|
1093
1105
|
|
|
@@ -4,7 +4,7 @@ import '../../components/checkmark/Component.js';
|
|
|
4
4
|
import { Option } from '../../components/option/Component.js';
|
|
5
5
|
import { Skeleton } from '@alfalab/core-components-skeleton/dist/modern';
|
|
6
6
|
|
|
7
|
-
var styles = {"skeleton":"
|
|
7
|
+
var styles = {"skeleton":"select__skeleton_tynxj"};
|
|
8
8
|
require('./index.css')
|
|
9
9
|
|
|
10
10
|
function useSelectWithLoading({ loading = false, visibleOptions = 6, }) {
|
package/dist/modern/typings.d.ts
CHANGED
|
@@ -71,6 +71,10 @@ type BaseSelectProps = {
|
|
|
71
71
|
* Начальное состояние селекта
|
|
72
72
|
*/
|
|
73
73
|
defaultOpen?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Управление открытием
|
|
76
|
+
*/
|
|
77
|
+
open?: boolean;
|
|
74
78
|
/**
|
|
75
79
|
* Возможность выбрать несколько значений
|
|
76
80
|
*/
|
|
@@ -103,7 +107,7 @@ type BaseSelectProps = {
|
|
|
103
107
|
/**
|
|
104
108
|
* Отображение ошибки
|
|
105
109
|
*/
|
|
106
|
-
error?:
|
|
110
|
+
error?: ReactNode | boolean;
|
|
107
111
|
/**
|
|
108
112
|
* Подсказка под полем
|
|
109
113
|
*/
|
|
@@ -260,7 +264,7 @@ type FieldProps = {
|
|
|
260
264
|
/**
|
|
261
265
|
* Отображение ошибки
|
|
262
266
|
*/
|
|
263
|
-
error?:
|
|
267
|
+
error?: ReactNode | boolean;
|
|
264
268
|
/**
|
|
265
269
|
* Отображение иконки успеха
|
|
266
270
|
*/
|
package/dist/presets/index.js
CHANGED