@alfalab/core-components-select 10.2.3 → 10.4.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/CHANGELOG.md +45 -0
- package/dist/Component.d.ts +1 -1
- package/dist/Component.js +2 -1
- package/dist/components/arrow/Component.js +1 -1
- package/dist/components/arrow/index.css +3 -3
- package/dist/components/base-select/Component.js +26 -23
- package/dist/components/base-select/index.css +7 -7
- package/dist/components/base-select/index.js +1 -1
- package/dist/components/checkmark/Component.d.ts +1 -1
- package/dist/components/checkmark/Component.js +11 -5
- package/dist/components/checkmark/index.css +21 -9
- package/dist/components/checkmark/index.js +1 -0
- package/dist/components/field/Component.d.ts +1 -1
- package/dist/components/field/Component.js +3 -3
- package/dist/components/field/index.css +9 -9
- package/dist/components/field/index.js +1 -1
- package/dist/components/index.js +2 -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 -6
- package/dist/components/option/Component.js +7 -5
- package/dist/components/option/index.css +20 -20
- package/dist/components/option/index.js +2 -1
- package/dist/components/options-list/Component.js +13 -8
- package/dist/components/options-list/index.css +9 -5
- package/dist/components/options-list/index.js +1 -0
- package/dist/components/virtual-options-list/Component.d.ts +1 -1
- package/dist/components/virtual-options-list/Component.js +22 -18
- package/dist/components/virtual-options-list/index.css +15 -12
- package/dist/components/virtual-options-list/index.js +1 -0
- package/dist/cssm/Component.d.ts +1 -1
- package/dist/cssm/Component.js +1 -0
- package/dist/cssm/components/base-select/Component.js +24 -21
- package/dist/cssm/components/checkmark/Component.d.ts +1 -1
- package/dist/cssm/components/checkmark/Component.js +10 -4
- package/dist/cssm/components/checkmark/index.js +1 -0
- package/dist/cssm/components/checkmark/index.module.css +19 -7
- package/dist/cssm/components/field/Component.d.ts +1 -1
- package/dist/cssm/components/field/Component.js +1 -1
- package/dist/cssm/components/index.js +1 -0
- package/dist/cssm/components/option/Component.js +5 -3
- package/dist/cssm/components/option/index.js +1 -0
- package/dist/cssm/components/options-list/Component.js +12 -7
- package/dist/cssm/components/options-list/index.js +1 -0
- package/dist/cssm/components/options-list/index.module.css +4 -0
- package/dist/cssm/components/virtual-options-list/Component.d.ts +1 -1
- package/dist/cssm/components/virtual-options-list/Component.js +21 -17
- package/dist/cssm/components/virtual-options-list/index.js +1 -0
- package/dist/cssm/components/virtual-options-list/index.module.css +4 -1
- package/dist/cssm/hook-3b9bd559.d.ts +12 -0
- package/dist/cssm/hook-3b9bd559.js +147 -0
- package/dist/cssm/hook-f5b8fe4f.d.ts +61 -0
- package/dist/cssm/index.js +8 -1
- package/dist/cssm/intersection-observer-8c55e13a.d.ts +1 -0
- package/dist/cssm/intersection-observer-8c55e13a.js +893 -0
- package/dist/cssm/presets/index.d.ts +1 -0
- package/dist/cssm/presets/index.js +30 -1
- package/dist/cssm/presets/useLazyLoading/hook.js +2 -892
- package/dist/cssm/presets/useSelectWithApply/hook.d.ts +0 -0
- package/dist/cssm/presets/useSelectWithApply/hook.js +46 -0
- package/dist/cssm/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +0 -0
- package/dist/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js +45 -0
- package/dist/cssm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -0
- package/dist/cssm/presets/useSelectWithApply/options-list-with-apply/index.js +45 -0
- package/dist/cssm/presets/useSelectWithApply/options-list-with-apply/index.module.css +38 -0
- package/dist/cssm/presets/useSelectWithLoading/hook.js +1 -0
- package/dist/cssm/typings.d.ts +55 -6
- package/dist/esm/Component.d.ts +1 -1
- package/dist/esm/Component.js +2 -1
- package/dist/esm/components/arrow/Component.js +1 -1
- package/dist/esm/components/arrow/index.css +3 -3
- package/dist/esm/components/base-select/Component.js +26 -23
- package/dist/esm/components/base-select/index.css +7 -7
- package/dist/esm/components/base-select/index.js +1 -1
- package/dist/esm/components/checkmark/Component.d.ts +1 -1
- package/dist/esm/components/checkmark/Component.js +12 -6
- package/dist/esm/components/checkmark/index.css +21 -9
- package/dist/esm/components/checkmark/index.js +1 -0
- package/dist/esm/components/field/Component.d.ts +1 -1
- package/dist/esm/components/field/Component.js +3 -3
- package/dist/esm/components/field/index.css +9 -9
- package/dist/esm/components/field/index.js +1 -1
- package/dist/esm/components/index.js +2 -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 -6
- package/dist/esm/components/option/Component.js +7 -5
- package/dist/esm/components/option/index.css +20 -20
- package/dist/esm/components/option/index.js +2 -1
- package/dist/esm/components/options-list/Component.js +14 -9
- package/dist/esm/components/options-list/index.css +9 -5
- package/dist/esm/components/options-list/index.js +1 -0
- package/dist/esm/components/virtual-options-list/Component.d.ts +1 -1
- package/dist/esm/components/virtual-options-list/Component.js +22 -18
- package/dist/esm/components/virtual-options-list/index.css +15 -12
- package/dist/esm/components/virtual-options-list/index.js +1 -0
- package/dist/esm/hook-3514e1ff.d.ts +12 -0
- package/dist/esm/hook-3514e1ff.js +131 -0
- package/dist/esm/hook-f5b8fe4f.d.ts +61 -0
- package/dist/esm/index.js +5 -1
- package/dist/esm/intersection-observer-228b670b.d.ts +1 -0
- package/dist/esm/intersection-observer-228b670b.js +891 -0
- package/dist/esm/presets/index.d.ts +1 -0
- package/dist/esm/presets/index.js +21 -1
- package/dist/esm/presets/useLazyLoading/hook.js +4 -894
- package/dist/esm/presets/useLazyLoading/index.css +2 -2
- package/dist/esm/presets/useSelectWithApply/hook.d.ts +0 -0
- package/dist/esm/presets/useSelectWithApply/hook.js +26 -0
- package/dist/esm/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +0 -0
- package/dist/esm/presets/useSelectWithApply/options-list-with-apply/Component.js +26 -0
- package/dist/esm/presets/useSelectWithApply/options-list-with-apply/index.css +39 -0
- package/dist/esm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -0
- package/dist/esm/presets/useSelectWithApply/options-list-with-apply/index.js +26 -0
- package/dist/esm/presets/useSelectWithLoading/hook.js +3 -2
- package/dist/esm/presets/useSelectWithLoading/index.css +2 -2
- package/dist/esm/{tslib.es6-e401d952.d.ts → tslib.es6-f688174c.d.ts} +0 -0
- package/dist/esm/{tslib.es6-e401d952.js → tslib.es6-f688174c.js} +0 -0
- package/dist/esm/typings.d.ts +55 -6
- package/dist/hook-6f1602ae.d.ts +12 -0
- package/dist/hook-6f1602ae.js +140 -0
- package/dist/hook-f5b8fe4f.d.ts +61 -0
- package/dist/index.js +7 -1
- package/dist/intersection-observer-6dcf2d59.d.ts +1 -0
- package/dist/intersection-observer-6dcf2d59.js +893 -0
- package/dist/modern/Component.d.ts +1 -1
- package/dist/modern/Component.js +1 -0
- package/dist/modern/components/arrow/Component.js +1 -1
- package/dist/modern/components/arrow/index.css +3 -3
- package/dist/modern/components/base-select/Component.js +20 -15
- package/dist/modern/components/base-select/index.css +7 -7
- package/dist/modern/components/checkmark/Component.d.ts +1 -1
- package/dist/modern/components/checkmark/Component.js +12 -4
- package/dist/modern/components/checkmark/index.css +21 -9
- package/dist/modern/components/checkmark/index.js +1 -0
- package/dist/modern/components/field/Component.d.ts +1 -1
- package/dist/modern/components/field/Component.js +2 -2
- package/dist/modern/components/field/index.css +9 -9
- package/dist/modern/components/index.js +1 -0
- package/dist/modern/components/optgroup/Component.js +1 -1
- package/dist/modern/components/optgroup/index.css +6 -6
- package/dist/modern/components/option/Component.js +6 -4
- package/dist/modern/components/option/index.css +20 -20
- package/dist/modern/components/option/index.js +1 -0
- package/dist/modern/components/options-list/Component.js +11 -7
- package/dist/modern/components/options-list/index.css +9 -5
- package/dist/modern/components/virtual-options-list/Component.d.ts +1 -1
- package/dist/modern/components/virtual-options-list/Component.js +20 -17
- package/dist/modern/components/virtual-options-list/index.css +15 -12
- package/dist/modern/hook-d9110e41.d.ts +12 -0
- package/dist/modern/hook-d9110e41.js +132 -0
- package/dist/modern/hook-f5b8fe4f.d.ts +61 -0
- package/dist/modern/index.js +4 -0
- package/dist/modern/intersection-observer-228b670b.d.ts +1 -0
- package/dist/modern/intersection-observer-228b670b.js +891 -0
- package/dist/modern/presets/index.d.ts +1 -0
- package/dist/modern/presets/index.js +20 -0
- package/dist/modern/presets/useLazyLoading/hook.js +3 -893
- package/dist/modern/presets/useLazyLoading/index.css +2 -2
- package/dist/modern/presets/useSelectWithApply/hook.d.ts +0 -0
- package/dist/modern/presets/useSelectWithApply/hook.js +25 -0
- package/dist/modern/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +0 -0
- package/dist/modern/presets/useSelectWithApply/options-list-with-apply/Component.js +25 -0
- package/dist/modern/presets/useSelectWithApply/options-list-with-apply/index.css +39 -0
- package/dist/modern/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -0
- package/dist/modern/presets/useSelectWithApply/options-list-with-apply/index.js +25 -0
- package/dist/modern/presets/useSelectWithLoading/hook.js +2 -1
- package/dist/modern/presets/useSelectWithLoading/index.css +2 -2
- package/dist/modern/typings.d.ts +55 -6
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/index.js +23 -1
- package/dist/presets/useLazyLoading/hook.js +4 -894
- package/dist/presets/useLazyLoading/index.css +2 -2
- package/dist/presets/useSelectWithApply/hook.d.ts +0 -0
- package/dist/presets/useSelectWithApply/hook.js +35 -0
- package/dist/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +0 -0
- package/dist/presets/useSelectWithApply/options-list-with-apply/Component.js +34 -0
- package/dist/presets/useSelectWithApply/options-list-with-apply/index.css +39 -0
- package/dist/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -0
- package/dist/presets/useSelectWithApply/options-list-with-apply/index.js +34 -0
- package/dist/presets/useSelectWithLoading/hook.js +3 -2
- package/dist/presets/useSelectWithLoading/index.css +2 -2
- package/dist/{tslib.es6-ba995fc6.d.ts → tslib.es6-b1b1a51e.d.ts} +0 -0
- package/dist/{tslib.es6-ba995fc6.js → tslib.es6-b1b1a51e.js} +0 -0
- package/dist/typings.d.ts +55 -6
- package/package.json +5 -3
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('../../tslib.es6-f8106a15.js');
|
|
6
|
+
require('react');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/hooks');
|
|
9
|
+
require('@alfalab/core-components-form-control/dist/cssm');
|
|
10
|
+
require('../../utils.js');
|
|
11
|
+
require('../../components/field/index.module.css');
|
|
12
|
+
require('../../components/field/Component.js');
|
|
13
|
+
require('@alfalab/icons-glyph/ChevronDownMIcon');
|
|
14
|
+
require('../../components/arrow/index.module.css');
|
|
15
|
+
require('../../components/arrow/Component.js');
|
|
16
|
+
require('react-merge-refs');
|
|
17
|
+
require('../../components/optgroup/index.module.css');
|
|
18
|
+
require('../../components/optgroup/Component.js');
|
|
19
|
+
require('../../components/options-list/index.module.css');
|
|
20
|
+
require('../../components/options-list/Component.js');
|
|
21
|
+
require('@alfalab/core-components-checkbox/dist/cssm');
|
|
22
|
+
require('../../components/checkmark/index.module.css');
|
|
23
|
+
require('../../components/checkmark/Component.js');
|
|
24
|
+
require('../../components/option/index.module.css');
|
|
25
|
+
require('../../components/option/Component.js');
|
|
26
|
+
require('resize-observer');
|
|
27
|
+
require('@alfalab/core-components-popover/dist/cssm');
|
|
28
|
+
require('downshift');
|
|
29
|
+
require('../../components/native-select/Component.js');
|
|
30
|
+
require('../../components/base-select/Component.js');
|
|
31
|
+
require('../../components/base-select/index.module.css');
|
|
32
|
+
require('../../Component.js');
|
|
33
|
+
require('react-virtual');
|
|
34
|
+
require('../../components/virtual-options-list/index.module.css');
|
|
35
|
+
require('@alfalab/core-components-skeleton/dist/cssm');
|
|
36
|
+
require('../useSelectWithLoading/index.module.css');
|
|
37
|
+
require('../../intersection-observer-8c55e13a.js');
|
|
38
|
+
require('../useLazyLoading/index.module.css');
|
|
39
|
+
require('@alfalab/core-components-button/dist/cssm');
|
|
40
|
+
require('./options-list-with-apply/index.module.css');
|
|
41
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../hook-3b9bd559.js');
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.SELECT_ALL_KEY = presets_useSelectWithApply_optionsListWithApply_Component.SELECT_ALL_KEY;
|
|
46
|
+
exports.useSelectWithApply = presets_useSelectWithApply_optionsListWithApply_Component.useSelectWithApply;
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('../../../tslib.es6-f8106a15.js');
|
|
6
|
+
require('react');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/hooks');
|
|
9
|
+
require('@alfalab/core-components-form-control/dist/cssm');
|
|
10
|
+
require('../../../utils.js');
|
|
11
|
+
require('../../../components/field/index.module.css');
|
|
12
|
+
require('../../../components/field/Component.js');
|
|
13
|
+
require('@alfalab/icons-glyph/ChevronDownMIcon');
|
|
14
|
+
require('../../../components/arrow/index.module.css');
|
|
15
|
+
require('../../../components/arrow/Component.js');
|
|
16
|
+
require('react-merge-refs');
|
|
17
|
+
require('../../../components/optgroup/index.module.css');
|
|
18
|
+
require('../../../components/optgroup/Component.js');
|
|
19
|
+
require('../../../components/options-list/index.module.css');
|
|
20
|
+
require('../../../components/options-list/Component.js');
|
|
21
|
+
require('@alfalab/core-components-checkbox/dist/cssm');
|
|
22
|
+
require('../../../components/checkmark/index.module.css');
|
|
23
|
+
require('../../../components/checkmark/Component.js');
|
|
24
|
+
require('../../../components/option/index.module.css');
|
|
25
|
+
require('../../../components/option/Component.js');
|
|
26
|
+
require('resize-observer');
|
|
27
|
+
require('@alfalab/core-components-popover/dist/cssm');
|
|
28
|
+
require('downshift');
|
|
29
|
+
require('../../../components/native-select/Component.js');
|
|
30
|
+
require('../../../components/base-select/Component.js');
|
|
31
|
+
require('../../../components/base-select/index.module.css');
|
|
32
|
+
require('../../../Component.js');
|
|
33
|
+
require('react-virtual');
|
|
34
|
+
require('../../../components/virtual-options-list/index.module.css');
|
|
35
|
+
require('@alfalab/core-components-skeleton/dist/cssm');
|
|
36
|
+
require('../../useSelectWithLoading/index.module.css');
|
|
37
|
+
require('../../../intersection-observer-8c55e13a.js');
|
|
38
|
+
require('../../useLazyLoading/index.module.css');
|
|
39
|
+
require('@alfalab/core-components-button/dist/cssm');
|
|
40
|
+
require('./index.module.css');
|
|
41
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../../hook-3b9bd559.js');
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.OptionsListWithApply = presets_useSelectWithApply_optionsListWithApply_Component.OptionsListWithApply;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../hook-3b9bd559";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('../../../tslib.es6-f8106a15.js');
|
|
6
|
+
require('react');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('@alfalab/hooks');
|
|
9
|
+
require('@alfalab/core-components-form-control/dist/cssm');
|
|
10
|
+
require('../../../utils.js');
|
|
11
|
+
require('../../../components/field/index.module.css');
|
|
12
|
+
require('../../../components/field/Component.js');
|
|
13
|
+
require('@alfalab/icons-glyph/ChevronDownMIcon');
|
|
14
|
+
require('../../../components/arrow/index.module.css');
|
|
15
|
+
require('../../../components/arrow/Component.js');
|
|
16
|
+
require('react-merge-refs');
|
|
17
|
+
require('../../../components/optgroup/index.module.css');
|
|
18
|
+
require('../../../components/optgroup/Component.js');
|
|
19
|
+
require('../../../components/options-list/index.module.css');
|
|
20
|
+
require('../../../components/options-list/Component.js');
|
|
21
|
+
require('@alfalab/core-components-checkbox/dist/cssm');
|
|
22
|
+
require('../../../components/checkmark/index.module.css');
|
|
23
|
+
require('../../../components/checkmark/Component.js');
|
|
24
|
+
require('../../../components/option/index.module.css');
|
|
25
|
+
require('../../../components/option/Component.js');
|
|
26
|
+
require('resize-observer');
|
|
27
|
+
require('@alfalab/core-components-popover/dist/cssm');
|
|
28
|
+
require('downshift');
|
|
29
|
+
require('../../../components/native-select/Component.js');
|
|
30
|
+
require('../../../components/base-select/Component.js');
|
|
31
|
+
require('../../../components/base-select/index.module.css');
|
|
32
|
+
require('../../../Component.js');
|
|
33
|
+
require('react-virtual');
|
|
34
|
+
require('../../../components/virtual-options-list/index.module.css');
|
|
35
|
+
require('@alfalab/core-components-skeleton/dist/cssm');
|
|
36
|
+
require('../../useSelectWithLoading/index.module.css');
|
|
37
|
+
require('../../../intersection-observer-8c55e13a.js');
|
|
38
|
+
require('../../useLazyLoading/index.module.css');
|
|
39
|
+
require('@alfalab/core-components-button/dist/cssm');
|
|
40
|
+
require('./index.module.css');
|
|
41
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../../hook-3b9bd559.js');
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.OptionsListWithApply = presets_useSelectWithApply_optionsListWithApply_Component.OptionsListWithApply;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--color-light-bg-primary: #fff;
|
|
3
|
+
--color-light-border-secondary: #e7e9eb;
|
|
4
|
+
}
|
|
5
|
+
:root {
|
|
6
|
+
|
|
7
|
+
/* Hard */
|
|
8
|
+
|
|
9
|
+
/* Up */
|
|
10
|
+
|
|
11
|
+
/* Hard up */
|
|
12
|
+
}
|
|
13
|
+
:root {
|
|
14
|
+
--gap-xs: 8px;
|
|
15
|
+
--gap-s: 12px;
|
|
16
|
+
--gap-m: 16px;
|
|
17
|
+
}
|
|
18
|
+
:root {
|
|
19
|
+
|
|
20
|
+
/* options list */
|
|
21
|
+
|
|
22
|
+
/* option */
|
|
23
|
+
|
|
24
|
+
/* checkmark */
|
|
25
|
+
|
|
26
|
+
/* optgroup */
|
|
27
|
+
}
|
|
28
|
+
.footer {
|
|
29
|
+
background: var(--color-light-bg-primary);
|
|
30
|
+
padding: var(--gap-s) var(--gap-s) var(--gap-m);
|
|
31
|
+
outline: none
|
|
32
|
+
}
|
|
33
|
+
.footer > * + * {
|
|
34
|
+
margin-left: var(--gap-xs);
|
|
35
|
+
}
|
|
36
|
+
.withBorder {
|
|
37
|
+
box-shadow: inset 0 1px 0 var(--color-light-border-secondary);
|
|
38
|
+
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib_es6 = require('../../tslib.es6-f8106a15.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
require('classnames');
|
|
8
|
+
require('@alfalab/core-components-checkbox/dist/cssm');
|
|
8
9
|
require('../../components/checkmark/index.module.css');
|
|
9
10
|
require('../../components/checkmark/Component.js');
|
|
10
11
|
require('../../components/option/index.module.css');
|
package/dist/cssm/typings.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ReactNode, FC, RefAttributes, AriaAttributes, FocusEvent, MouseEvent, ReactElement } from 'react';
|
|
3
2
|
import { PopoverProps } from "@alfalab/core-components-popover";
|
|
4
3
|
import { InputProps } from "@alfalab/core-components-input";
|
|
@@ -51,6 +50,10 @@ type BaseSelectProps = {
|
|
|
51
50
|
* Дополнительный класс для пункта меню
|
|
52
51
|
*/
|
|
53
52
|
optionClassName?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Дополнительный класс для поповера
|
|
55
|
+
*/
|
|
56
|
+
popperClassName?: string;
|
|
54
57
|
/**
|
|
55
58
|
* Список вариантов выбора
|
|
56
59
|
*/
|
|
@@ -194,6 +197,7 @@ type BaseSelectProps = {
|
|
|
194
197
|
onChange?: (payload: {
|
|
195
198
|
selected: OptionShape | null;
|
|
196
199
|
selectedMultiple: OptionShape[];
|
|
200
|
+
initiator: OptionShape | null;
|
|
197
201
|
name?: string;
|
|
198
202
|
}) => void;
|
|
199
203
|
/**
|
|
@@ -245,6 +249,14 @@ type FieldProps = {
|
|
|
245
249
|
* Список выбранных пунктов
|
|
246
250
|
*/
|
|
247
251
|
selectedMultiple?: OptionShape[];
|
|
252
|
+
/**
|
|
253
|
+
* Метод для ручной установки выбранных пунктов
|
|
254
|
+
*/
|
|
255
|
+
setSelectedItems: (selected: OptionShape[]) => void;
|
|
256
|
+
/**
|
|
257
|
+
* Метод переключающий видимость выпадающего списка
|
|
258
|
+
*/
|
|
259
|
+
toggleMenu: () => void;
|
|
248
260
|
/**
|
|
249
261
|
* Флаг, можно ли выбрать несколько значений
|
|
250
262
|
*/
|
|
@@ -322,10 +334,31 @@ type OptionsListProps = {
|
|
|
322
334
|
/**
|
|
323
335
|
* Компонент пункта меню
|
|
324
336
|
*/
|
|
325
|
-
Option:
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
337
|
+
Option: FC<OptionProps>;
|
|
338
|
+
/**
|
|
339
|
+
* Функция для получения пропсов для ячейки
|
|
340
|
+
*/
|
|
341
|
+
getOptionProps: (option: OptionShape, index: number) => OptionProps;
|
|
342
|
+
/**
|
|
343
|
+
* Список выбранных пунктов
|
|
344
|
+
*/
|
|
345
|
+
selectedItems?: OptionShape[];
|
|
346
|
+
/**
|
|
347
|
+
* Метод для ручной установки выбранных пунктов
|
|
348
|
+
*/
|
|
349
|
+
setSelectedItems: (selected: OptionShape[]) => void;
|
|
350
|
+
/**
|
|
351
|
+
* Метод переключающий видимость выпадающего списка
|
|
352
|
+
*/
|
|
353
|
+
toggleMenu: () => void;
|
|
354
|
+
/**
|
|
355
|
+
* Контент шапки
|
|
356
|
+
*/
|
|
357
|
+
header?: ReactNode;
|
|
358
|
+
/**
|
|
359
|
+
* Контент футера
|
|
360
|
+
*/
|
|
361
|
+
footer?: ReactNode;
|
|
329
362
|
/**
|
|
330
363
|
* Список вариантов выбора
|
|
331
364
|
*/
|
|
@@ -399,7 +432,7 @@ type OptionProps = {
|
|
|
399
432
|
*/
|
|
400
433
|
option: OptionShape;
|
|
401
434
|
/**
|
|
402
|
-
*
|
|
435
|
+
* Индекс пункта
|
|
403
436
|
*/
|
|
404
437
|
index: number;
|
|
405
438
|
/**
|
|
@@ -414,6 +447,10 @@ type OptionProps = {
|
|
|
414
447
|
* Флаг, заблокирован ли данный пункт
|
|
415
448
|
*/
|
|
416
449
|
disabled?: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Флаг множественного выбора
|
|
452
|
+
*/
|
|
453
|
+
multiple?: boolean;
|
|
417
454
|
/**
|
|
418
455
|
* Компонент пункта меню
|
|
419
456
|
*/
|
|
@@ -438,5 +475,17 @@ type CheckmarkProps = {
|
|
|
438
475
|
* Флаг, данный пункт выбран
|
|
439
476
|
*/
|
|
440
477
|
selected?: boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Дополнительный класс
|
|
480
|
+
*/
|
|
481
|
+
className?: string;
|
|
482
|
+
/**
|
|
483
|
+
* Флаг множественного выбора
|
|
484
|
+
*/
|
|
485
|
+
multiple?: boolean;
|
|
486
|
+
/**
|
|
487
|
+
* Расположение отметки
|
|
488
|
+
*/
|
|
489
|
+
position?: 'before' | 'after';
|
|
441
490
|
};
|
|
442
491
|
export { OptionShape, GroupShape, BaseSelectProps, FieldProps, ArrowProps, OptionsListProps, OptgroupProps, OptionProps, CheckmarkProps };
|
package/dist/esm/Component.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ type SelectProps = Omit<BaseSelectProps, 'fieldProps'> & {
|
|
|
82
82
|
*/
|
|
83
83
|
fieldProps?: FormControlProps & Record<string, unknown>;
|
|
84
84
|
};
|
|
85
|
-
declare const Select: React.ForwardRefExoticComponent<Pick<BaseSelectProps, "block" | "size" | "className" | "fieldClassName" | "disabled" | "error" | "hint" | "label" | "dataTestId" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "onScroll" | "preventFlip" | "open" | "name" | "options" | "multiple" | "selected" | "valueRenderer" | "Optgroup" | "visibleOptions" | "Arrow" | "Option" | "optionsListClassName" | "optionClassName" | "autocomplete" | "allowUnselect" | "closeOnSelect" | "circularNavigation" | "nativeSelect" | "defaultOpen" | "popoverPosition" | "optionsListWidth" | "optionsSize" | "optionsListProps" | "optionProps" | "onOpen" | "Field" | "OptionsList" | "updatePopover" | "zIndexPopover" | "showEmptyOptionsList"> & {
|
|
85
|
+
declare const Select: React.ForwardRefExoticComponent<Pick<BaseSelectProps, "block" | "size" | "className" | "fieldClassName" | "disabled" | "error" | "hint" | "label" | "dataTestId" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "onScroll" | "preventFlip" | "popperClassName" | "open" | "name" | "options" | "multiple" | "selected" | "valueRenderer" | "Optgroup" | "visibleOptions" | "Arrow" | "Option" | "optionsListClassName" | "optionClassName" | "autocomplete" | "allowUnselect" | "closeOnSelect" | "circularNavigation" | "nativeSelect" | "defaultOpen" | "popoverPosition" | "optionsListWidth" | "optionsSize" | "optionsListProps" | "optionProps" | "onOpen" | "Field" | "OptionsList" | "updatePopover" | "zIndexPopover" | "showEmptyOptionsList"> & {
|
|
86
86
|
/**
|
|
87
87
|
* Пропсы, которые будут прокинуты в компонент поля
|
|
88
88
|
*/
|
package/dist/esm/Component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign } from './tslib.es6-
|
|
1
|
+
import { _ as __rest, a as __assign } from './tslib.es6-f688174c.js';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import 'classnames';
|
|
4
4
|
import '@alfalab/hooks';
|
|
@@ -10,6 +10,7 @@ import { Arrow } from './components/arrow/Component.js';
|
|
|
10
10
|
import 'react-merge-refs';
|
|
11
11
|
import { Optgroup } from './components/optgroup/Component.js';
|
|
12
12
|
import { OptionsList } from './components/options-list/Component.js';
|
|
13
|
+
import '@alfalab/core-components-checkbox/dist/esm';
|
|
13
14
|
import './components/checkmark/Component.js';
|
|
14
15
|
import { Option } from './components/option/Component.js';
|
|
15
16
|
import 'resize-observer';
|
|
@@ -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
|
-
var styles = {"arrow":"
|
|
5
|
+
var styles = {"arrow":"select__arrow_uh35h","open":"select__open_uh35h"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
var Arrow = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 19l12 */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-primary: #0b1f35;
|
|
4
4
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
/* optgroup */
|
|
26
26
|
}
|
|
27
|
-
.
|
|
27
|
+
.select__arrow_uh35h {
|
|
28
28
|
display: block;
|
|
29
29
|
width: 24px;
|
|
30
30
|
height: 24px;
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
|
|
33
33
|
transition: transform 0.15s ease-in-out, opacity 0.2s ease;
|
|
34
34
|
}
|
|
35
|
-
.
|
|
35
|
+
.select__open_uh35h {
|
|
36
36
|
transform: var(--arrow-transform);
|
|
37
37
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __assign, b as __spreadArrays
|
|
1
|
+
import { a as __assign, b as __spreadArrays } from '../../tslib.es6-f688174c.js';
|
|
2
2
|
import React, { forwardRef, useRef, useMemo, useCallback, useEffect, useLayoutEffect } from 'react';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { processOptions } from '../../utils.js';
|
|
@@ -13,15 +13,16 @@ var getDataTestId = function (dataTestId, element) {
|
|
|
13
13
|
return dataTestId ? "" + dataTestId + elementPart : undefined;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
var styles = {"component":"
|
|
16
|
+
var styles = {"component":"select__component_1osb1","popoverInner":"select__popoverInner_1osb1","optionsList":"select__optionsList_1osb1","nativeSelect":"select__nativeSelect_1osb1","block":"select__block_1osb1"};
|
|
17
17
|
require('./index.css')
|
|
18
18
|
|
|
19
19
|
var BaseSelect = forwardRef(function (_a, ref) {
|
|
20
20
|
var _b;
|
|
21
|
-
var dataTestId = _a.dataTestId, className = _a.className, fieldClassName = _a.fieldClassName, optionsListClassName = _a.optionsListClassName, optionClassName = _a.optionClassName, options = _a.options, _c = _a.autocomplete, autocomplete = _c === void 0 ? false : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.allowUnselect, allowUnselect = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.closeOnSelect, closeOnSelect = _g === void 0 ? !multiple : _g, _h = _a.circularNavigation, circularNavigation = _h === void 0 ? false : _h, _j = _a.nativeSelect, nativeSelect = _j === void 0 ? false : _j, _k = _a.defaultOpen, defaultOpen = _k === void 0 ? false : _k, openProp = _a.open, _l = _a.popoverPosition, popoverPosition = _l === void 0 ? 'bottom-start' : _l, _m = _a.preventFlip, preventFlip = _m === void 0 ? true : _m, _o = _a.optionsListWidth, optionsListWidth = _o === void 0 ? 'content' : _o, name = _a.name, id = _a.id, selected = _a.selected, _p = _a.size, size = _p === void 0 ? 's' : _p, _q = _a.optionsSize, optionsSize = _q === void 0 ? size : _q, error = _a.error, hint = _a.hint, block = _a.block, label = _a.label, placeholder = _a.placeholder, _r = _a.fieldProps, fieldProps = _r === void 0 ? {} : _r, _s = _a.optionsListProps, optionsListProps = _s === void 0 ? {} : _s, _t = _a.optionProps, optionProps = _t === void 0 ? {} : _t, valueRenderer = _a.valueRenderer, onChange = _a.onChange, onOpen = _a.onOpen, onFocus = _a.onFocus, onBlur = _a.onBlur, onScroll = _a.onScroll, Arrow = _a.Arrow, _u = _a.Field, Field = _u === void 0 ? function () { return null; } : _u, _v = _a.OptionsList, OptionsList = _v === void 0 ? function () { return null; } : _v, _w = _a.Optgroup, Optgroup = _w === void 0 ? function () { return null; } : _w, _x = _a.Option, Option = _x === void 0 ? function () { return null; } : _x, updatePopover = _a.updatePopover, zIndexPopover = _a.zIndexPopover, _y = _a.showEmptyOptionsList, showEmptyOptionsList = _y === void 0 ? false : _y, visibleOptions = _a.visibleOptions;
|
|
21
|
+
var dataTestId = _a.dataTestId, className = _a.className, fieldClassName = _a.fieldClassName, optionsListClassName = _a.optionsListClassName, optionClassName = _a.optionClassName, popperClassName = _a.popperClassName, options = _a.options, _c = _a.autocomplete, autocomplete = _c === void 0 ? false : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.allowUnselect, allowUnselect = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.closeOnSelect, closeOnSelect = _g === void 0 ? !multiple : _g, _h = _a.circularNavigation, circularNavigation = _h === void 0 ? false : _h, _j = _a.nativeSelect, nativeSelect = _j === void 0 ? false : _j, _k = _a.defaultOpen, defaultOpen = _k === void 0 ? false : _k, openProp = _a.open, _l = _a.popoverPosition, popoverPosition = _l === void 0 ? 'bottom-start' : _l, _m = _a.preventFlip, preventFlip = _m === void 0 ? true : _m, _o = _a.optionsListWidth, optionsListWidth = _o === void 0 ? 'content' : _o, name = _a.name, id = _a.id, selected = _a.selected, _p = _a.size, size = _p === void 0 ? 's' : _p, _q = _a.optionsSize, optionsSize = _q === void 0 ? size : _q, error = _a.error, hint = _a.hint, block = _a.block, label = _a.label, placeholder = _a.placeholder, _r = _a.fieldProps, fieldProps = _r === void 0 ? {} : _r, _s = _a.optionsListProps, optionsListProps = _s === void 0 ? {} : _s, _t = _a.optionProps, optionProps = _t === void 0 ? {} : _t, valueRenderer = _a.valueRenderer, onChange = _a.onChange, onOpen = _a.onOpen, onFocus = _a.onFocus, onBlur = _a.onBlur, onScroll = _a.onScroll, Arrow = _a.Arrow, _u = _a.Field, Field = _u === void 0 ? function () { return null; } : _u, _v = _a.OptionsList, OptionsList = _v === void 0 ? function () { return null; } : _v, _w = _a.Optgroup, Optgroup = _w === void 0 ? function () { return null; } : _w, _x = _a.Option, Option = _x === void 0 ? function () { return null; } : _x, updatePopover = _a.updatePopover, zIndexPopover = _a.zIndexPopover, _y = _a.showEmptyOptionsList, showEmptyOptionsList = _y === void 0 ? false : _y, visibleOptions = _a.visibleOptions;
|
|
22
22
|
var rootRef = useRef(null);
|
|
23
23
|
var fieldRef = useRef(null);
|
|
24
24
|
var listRef = useRef(null);
|
|
25
|
+
var initiatorRef = useRef(null);
|
|
25
26
|
var itemToString = function (option) { return (option ? option.key : ''); };
|
|
26
27
|
var _z = useMemo(function () { return processOptions(options, selected); }, [
|
|
27
28
|
options,
|
|
@@ -35,8 +36,10 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
35
36
|
onChange({
|
|
36
37
|
selectedMultiple: selectedItems_1,
|
|
37
38
|
selected: selectedItems_1.length ? selectedItems_1[0] : null,
|
|
39
|
+
initiator: initiatorRef.current,
|
|
38
40
|
name: name,
|
|
39
41
|
});
|
|
42
|
+
initiatorRef.current = null;
|
|
40
43
|
}
|
|
41
44
|
},
|
|
42
45
|
stateReducer: function (state, actionAndChanges) {
|
|
@@ -81,6 +84,7 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
81
84
|
switch (type) {
|
|
82
85
|
case useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
83
86
|
case useCombobox.stateChangeTypes.ItemClick:
|
|
87
|
+
initiatorRef.current = selectedItem;
|
|
84
88
|
if (selectedItem && !selectedItem.disabled) {
|
|
85
89
|
var alreadySelected = selectedItems.includes(selectedItem);
|
|
86
90
|
var allowRemove = allowUnselect || (multiple && selectedItems.length > 1);
|
|
@@ -126,14 +130,15 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
126
130
|
};
|
|
127
131
|
var handleFieldKeyDown = function (event) {
|
|
128
132
|
inputProps.onKeyDown(event);
|
|
129
|
-
if (autocomplete && !open && event.key.length === 1) {
|
|
133
|
+
if (autocomplete && !open && (event.key.length === 1 || event.key === 'Backspace')) {
|
|
130
134
|
// Для автокомплита - открываем меню при начале ввода
|
|
131
135
|
openMenu();
|
|
132
136
|
}
|
|
133
137
|
if ([' ', 'Enter'].includes(event.key) &&
|
|
134
138
|
!autocomplete &&
|
|
135
139
|
!nativeSelect &&
|
|
136
|
-
event.target.tagName !== 'INPUT'
|
|
140
|
+
event.target.tagName !== 'INPUT' &&
|
|
141
|
+
event.target.tagName !== 'BUTTON') {
|
|
137
142
|
// Открываем\закрываем меню по нажатию enter или пробела
|
|
138
143
|
event.preventDefault();
|
|
139
144
|
if (!open || highlightedIndex === -1)
|
|
@@ -153,24 +158,22 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
153
158
|
return option.selected ? acc.concat(flatOptions[index]) : acc;
|
|
154
159
|
}, []));
|
|
155
160
|
}, [flatOptions, setSelectedItems]);
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}, [
|
|
166
|
-
Option,
|
|
167
|
-
optionProps,
|
|
168
|
-
optionClassName,
|
|
161
|
+
var getOptionProps = useCallback(function (option, index) { return (__assign(__assign({}, optionProps), { className: optionClassName, innerProps: getItemProps({
|
|
162
|
+
index: index,
|
|
163
|
+
item: option,
|
|
164
|
+
disabled: option.disabled,
|
|
165
|
+
onMouseDown: function (event) { return event.preventDefault(); },
|
|
166
|
+
}), multiple: multiple,
|
|
167
|
+
index: index,
|
|
168
|
+
option: option, size: optionsSize, disabled: option.disabled, highlighted: index === highlightedIndex, selected: selectedItems.includes(option), dataTestId: getDataTestId(dataTestId, 'option') })); }, [
|
|
169
|
+
dataTestId,
|
|
169
170
|
getItemProps,
|
|
170
|
-
optionsSize,
|
|
171
171
|
highlightedIndex,
|
|
172
|
+
multiple,
|
|
173
|
+
optionClassName,
|
|
174
|
+
optionProps,
|
|
175
|
+
optionsSize,
|
|
172
176
|
selectedItems,
|
|
173
|
-
dataTestId,
|
|
174
177
|
]);
|
|
175
178
|
useEffect(function () {
|
|
176
179
|
if (defaultOpen)
|
|
@@ -214,7 +217,7 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
214
217
|
var needRenderOptionsList = flatOptions.length > 0 || showEmptyOptionsList;
|
|
215
218
|
return (React.createElement("div", __assign({}, getComboboxProps(__assign(__assign({ ref: rootRef }, (disabled && { 'aria-disabled': true })), { className: cn(styles.component, (_b = {}, _b[styles.block] = block, _b), className) })), { onKeyDown: disabled ? undefined : handleFieldKeyDown, tabIndex: -1, "data-test-id": getDataTestId(dataTestId) }),
|
|
216
219
|
nativeSelect && renderNativeSelect(),
|
|
217
|
-
React.createElement(Field, __assign({ selectedMultiple: selectedItems, selected: selectedItems[0], multiple: multiple, open: open, disabled: disabled, size: size, placeholder: placeholder, label: label && React.createElement("span", __assign({}, getLabelProps()), label), Arrow: Arrow && React.createElement(Arrow, { open: open }), error: error, hint: hint, valueRenderer: valueRenderer, className: fieldClassName, innerProps: {
|
|
220
|
+
React.createElement(Field, __assign({ selectedMultiple: selectedItems, selected: selectedItems[0], setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, multiple: multiple, open: open, disabled: disabled, size: size, placeholder: placeholder, label: label && React.createElement("span", __assign({}, getLabelProps()), label), Arrow: Arrow && React.createElement(Arrow, { open: open }), error: error, hint: hint, valueRenderer: valueRenderer, className: fieldClassName, innerProps: {
|
|
218
221
|
onBlur: handleFieldBlur,
|
|
219
222
|
onFocus: disabled ? undefined : handleFieldFocus,
|
|
220
223
|
onClick: disabled ? undefined : handleFieldClick,
|
|
@@ -228,8 +231,8 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
228
231
|
: undefined,
|
|
229
232
|
}, dataTestId: getDataTestId(dataTestId, 'field') }, fieldProps)),
|
|
230
233
|
name && !nativeSelect && renderValue(),
|
|
231
|
-
!nativeSelect && (React.createElement(Popover, { open: open, withTransition: false, anchorElement: fieldRef.current, position: popoverPosition, preventFlip: preventFlip, popperClassName: styles.popoverInner, update: updatePopover, zIndex: zIndexPopover }, needRenderOptionsList && (React.createElement("div", __assign({}, menuProps, { className: cn(optionsListClassName, styles.optionsList) }),
|
|
232
|
-
React.createElement(OptionsList, __assign({}, optionsListProps, { flatOptions: flatOptions, highlightedIndex: highlightedIndex, open: open, size: size, options: options, Optgroup: Optgroup, Option:
|
|
234
|
+
!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", __assign({}, menuProps, { className: cn(optionsListClassName, styles.optionsList) }),
|
|
235
|
+
React.createElement(OptionsList, __assign({}, optionsListProps, { flatOptions: flatOptions, highlightedIndex: highlightedIndex, open: open, size: size, options: options, Optgroup: Optgroup, Option: Option, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, visibleOptions: visibleOptions, onScroll: onScroll, dataTestId: getDataTestId(dataTestId, 'options-list') }))))))));
|
|
233
236
|
});
|
|
234
237
|
|
|
235
238
|
export { BaseSelect };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: bu6ui */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
}
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
|
|
29
29
|
/* optgroup */
|
|
30
30
|
}
|
|
31
|
-
.
|
|
31
|
+
.select__component_1osb1 {
|
|
32
32
|
width: max-content;
|
|
33
33
|
position: relative;
|
|
34
34
|
outline: 0;
|
|
35
35
|
}
|
|
36
|
-
.
|
|
36
|
+
.select__popoverInner_1osb1 {
|
|
37
37
|
padding-top: var(--select-options-list-offset);
|
|
38
38
|
padding-bottom: var(--select-options-list-offset);
|
|
39
39
|
box-shadow: none;
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
border-radius: 0;
|
|
43
43
|
position: relative;
|
|
44
44
|
}
|
|
45
|
-
.
|
|
45
|
+
.select__optionsList_1osb1 {
|
|
46
46
|
padding-top: var(--select-options-list-top-padding);
|
|
47
47
|
padding-bottom: var(--select-options-list-bottom-padding);
|
|
48
48
|
box-shadow: var(--select-options-list-box-shadow);
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
overflow: hidden;
|
|
52
52
|
will-change: transform;
|
|
53
53
|
}
|
|
54
|
-
.
|
|
54
|
+
.select__nativeSelect_1osb1 {
|
|
55
55
|
opacity: 0;
|
|
56
56
|
overflow: hidden;
|
|
57
57
|
position: absolute;
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
cursor: pointer;
|
|
66
66
|
z-index: 1;
|
|
67
67
|
}
|
|
68
|
-
.
|
|
68
|
+
.select__block_1osb1 {
|
|
69
69
|
width: 100%;
|
|
70
70
|
}
|
|
71
71
|
/* width: max-content; fix for IE */
|
|
72
72
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
73
|
-
.
|
|
73
|
+
.select__component_1osb1 {
|
|
74
74
|
float: left;
|
|
75
75
|
clear: left;
|
|
76
76
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckmarkProps } from "../../typings";
|
|
3
|
-
declare const Checkmark: ({ selected }: CheckmarkProps) => JSX.Element;
|
|
3
|
+
declare const Checkmark: ({ selected, className, multiple, position, }: CheckmarkProps) => JSX.Element;
|
|
4
4
|
export { Checkmark };
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
+
import { Checkbox } from '@alfalab/core-components-checkbox/dist/esm';
|
|
3
4
|
|
|
4
|
-
var styles = {"checkmark":"
|
|
5
|
+
var styles = {"checkmark":"select__checkmark_3l2l6","single":"select__single_3l2l6","selected":"select__selected_3l2l6","before":"select__before_3l2l6","multiple":"select__multiple_3l2l6","after":"select__after_3l2l6"};
|
|
5
6
|
require('./index.css')
|
|
6
7
|
|
|
7
8
|
var Checkmark = function (_a) {
|
|
8
9
|
var _b;
|
|
9
|
-
var selected = _a.selected;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
var selected = _a.selected, className = _a.className, multiple = _a.multiple, _c = _a.position, position = _c === void 0 ? 'before' : _c;
|
|
11
|
+
var single = !multiple || position === 'after';
|
|
12
|
+
var checkmarkClassNames = cn(styles.checkmark, className, styles[position], (_b = {},
|
|
13
|
+
_b[styles.multiple] = !single,
|
|
14
|
+
_b[styles.single] = single,
|
|
15
|
+
_b[styles.selected] = selected,
|
|
16
|
+
_b));
|
|
17
|
+
var handleCheckboxClick = useCallback(function (event) { return event.stopPropagation(); }, []);
|
|
18
|
+
return single ? (React.createElement("span", { className: checkmarkClassNames })) : (React.createElement(Checkbox, { checked: selected, className: checkmarkClassNames, size: 'm', onClick: handleCheckboxClick }));
|
|
13
19
|
};
|
|
14
20
|
|
|
15
21
|
export { Checkmark };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: manlv */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-primary: #0b1f35;
|
|
4
4
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
:root {
|
|
14
14
|
--gap-xs: 8px;
|
|
15
|
+
--gap-s: 12px;
|
|
15
16
|
}
|
|
16
17
|
:root {
|
|
17
18
|
--border-radius-circle: 50%;
|
|
@@ -26,27 +27,38 @@
|
|
|
26
27
|
|
|
27
28
|
--select-checkmark-margin: 0 var(--gap-xs) 0 0;
|
|
28
29
|
--select-checkmark-size: 4px;
|
|
29
|
-
--select-checkmark-
|
|
30
|
+
--select-checkmark-before-display: 'flex';
|
|
31
|
+
--select-checkmark-after-display: none;
|
|
30
32
|
--select-checkmark-unselected-opacity: 0;
|
|
31
33
|
--select-checkmark-background: var(--color-light-graphic-primary);
|
|
32
34
|
--select-checkmark-border-radius: var(--border-radius-circle);
|
|
33
35
|
|
|
34
36
|
/* optgroup */
|
|
35
37
|
}
|
|
36
|
-
.
|
|
38
|
+
.select__checkmark_3l2l6 {
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
margin: var(--select-checkmark-margin);
|
|
41
|
+
}
|
|
42
|
+
.select__single_3l2l6 {
|
|
37
43
|
display: flex;
|
|
38
44
|
align-items: center;
|
|
39
45
|
justify-content: center;
|
|
40
46
|
opacity: var(--select-checkmark-unselected-opacity);
|
|
41
|
-
flex-shrink: 0;
|
|
42
47
|
background: var(--select-checkmark-background);
|
|
43
48
|
background-size: cover;
|
|
44
49
|
border-radius: var(--select-checkmark-border-radius);
|
|
45
|
-
margin: var(--select-checkmark-margin);
|
|
46
|
-
order: var(--select-checkmark-order);
|
|
47
50
|
width: var(--select-checkmark-size);
|
|
48
|
-
height: var(--select-checkmark-size)
|
|
51
|
+
height: var(--select-checkmark-size)
|
|
52
|
+
}
|
|
53
|
+
.select__single_3l2l6.select__selected_3l2l6 {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
.select__before_3l2l6 {
|
|
57
|
+
display: var(--select-checkmark-before-display)
|
|
49
58
|
}
|
|
50
|
-
.
|
|
51
|
-
|
|
59
|
+
.select__before_3l2l6.select__multiple_3l2l6 {
|
|
60
|
+
margin-right: var(--gap-s);
|
|
61
|
+
}
|
|
62
|
+
.select__after_3l2l6 {
|
|
63
|
+
display: var(--select-checkmark-after-display);
|
|
52
64
|
}
|