@alfalab/core-components-select 10.3.0 → 10.4.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 +12 -0
- package/dist/Component.d.ts +1 -1
- package/dist/Component.js +1 -1
- package/dist/components/arrow/Component.js +1 -1
- package/dist/components/arrow/index.css +3 -3
- package/dist/components/base-select/Component.js +23 -22
- package/dist/components/base-select/index.css +7 -7
- package/dist/components/base-select/index.js +1 -1
- package/dist/components/checkmark/Component.js +2 -2
- package/dist/components/checkmark/index.css +7 -7
- 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 +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 -6
- package/dist/components/option/Component.js +2 -2
- package/dist/components/option/index.css +20 -20
- package/dist/components/option/index.js +1 -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/components/base-select/Component.js +21 -20
- package/dist/cssm/components/checkmark/Component.js +1 -1
- package/dist/cssm/components/field/Component.d.ts +1 -1
- package/dist/cssm/components/field/Component.js +1 -1
- 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-45e5f3a8.d.ts +12 -0
- package/dist/cssm/hook-45e5f3a8.js +147 -0
- package/dist/cssm/hook-f5b8fe4f.d.ts +61 -0
- package/dist/cssm/index.js +7 -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 +29 -1
- package/dist/cssm/presets/useLazyLoading/hook.js +1 -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/typings.d.ts +39 -6
- package/dist/esm/Component.d.ts +1 -1
- package/dist/esm/Component.js +1 -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 +23 -22
- 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.js +2 -2
- package/dist/esm/components/checkmark/index.css +7 -7
- 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 +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 -6
- package/dist/esm/components/option/Component.js +2 -2
- package/dist/esm/components/option/index.css +20 -20
- package/dist/esm/components/option/index.js +1 -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-a01ac265.d.ts +12 -0
- package/dist/esm/hook-a01ac265.js +131 -0
- package/dist/esm/hook-f5b8fe4f.d.ts +61 -0
- package/dist/esm/index.js +4 -1
- package/dist/esm/intersection-observer-2080f60e.d.ts +1 -0
- package/dist/esm/intersection-observer-2080f60e.js +891 -0
- package/dist/esm/presets/index.d.ts +1 -0
- package/dist/esm/presets/index.js +20 -1
- package/dist/esm/presets/useLazyLoading/hook.js +3 -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 +2 -2
- package/dist/esm/presets/useSelectWithLoading/index.css +2 -2
- package/dist/esm/{tslib.es6-5a8a0ede.d.ts → tslib.es6-11a0bbd3.d.ts} +0 -0
- package/dist/esm/{tslib.es6-5a8a0ede.js → tslib.es6-11a0bbd3.js} +0 -0
- package/dist/esm/typings.d.ts +39 -6
- package/dist/hook-4f9a90b8.d.ts +12 -0
- package/dist/hook-4f9a90b8.js +140 -0
- package/dist/hook-f5b8fe4f.d.ts +61 -0
- package/dist/index.js +6 -1
- package/dist/intersection-observer-c983b2d1.d.ts +1 -0
- package/dist/intersection-observer-c983b2d1.js +893 -0
- package/dist/modern/Component.d.ts +1 -1
- 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 +17 -14
- package/dist/modern/components/base-select/index.css +7 -7
- package/dist/modern/components/checkmark/Component.js +2 -2
- package/dist/modern/components/checkmark/index.css +7 -7
- 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/optgroup/Component.js +1 -1
- package/dist/modern/components/optgroup/index.css +6 -6
- package/dist/modern/components/option/Component.js +1 -1
- package/dist/modern/components/option/index.css +20 -20
- 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-cdda7a62.d.ts +12 -0
- package/dist/modern/hook-cdda7a62.js +132 -0
- package/dist/modern/hook-f5b8fe4f.d.ts +61 -0
- package/dist/modern/index.js +3 -0
- package/dist/modern/intersection-observer-2080f60e.d.ts +1 -0
- package/dist/modern/intersection-observer-2080f60e.js +891 -0
- package/dist/modern/presets/index.d.ts +1 -0
- package/dist/modern/presets/index.js +19 -0
- package/dist/modern/presets/useLazyLoading/hook.js +2 -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 +1 -1
- package/dist/modern/presets/useSelectWithLoading/index.css +2 -2
- package/dist/modern/typings.d.ts +39 -6
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/index.js +22 -1
- package/dist/presets/useLazyLoading/hook.js +3 -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 +2 -2
- package/dist/presets/useSelectWithLoading/index.css +2 -2
- package/dist/{tslib.es6-f6070e97.d.ts → tslib.es6-edfcd771.d.ts} +0 -0
- package/dist/{tslib.es6-f6070e97.js → tslib.es6-edfcd771.js} +0 -0
- package/dist/typings.d.ts +39 -6
- package/package.json +3 -2
|
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-45e5f3a8.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-45e5f3a8.js');
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.OptionsListWithApply = presets_useSelectWithApply_optionsListWithApply_Component.OptionsListWithApply;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../hook-45e5f3a8";
|
|
@@ -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-45e5f3a8.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
|
+
}
|
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
|
/**
|
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
|
@@ -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_vyu08","open":"select__open_vyu08"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
var Arrow = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1ekr6 */
|
|
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_vyu08 {
|
|
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_vyu08 {
|
|
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-11a0bbd3.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_75qfr","popoverInner":"select__popoverInner_75qfr","optionsList":"select__optionsList_75qfr","nativeSelect":"select__nativeSelect_75qfr","block":"select__block_75qfr"};
|
|
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);
|
|
@@ -133,7 +137,8 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
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,26 +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
|
-
var option = _a.option, index = _a.index, rest = __rest(_a, ["option", "index"]);
|
|
158
|
-
return (React.createElement(React.Fragment, { key: option.key }, Option(__assign(__assign(__assign({}, optionProps), rest), { className: optionClassName, innerProps: getItemProps({
|
|
159
|
-
index: index,
|
|
160
|
-
item: option,
|
|
161
|
-
disabled: option.disabled,
|
|
162
|
-
onMouseDown: function (event) { return event.preventDefault(); },
|
|
163
|
-
}), multiple: multiple,
|
|
161
|
+
var getOptionProps = useCallback(function (option, index) { return (__assign(__assign({}, optionProps), { className: optionClassName, innerProps: getItemProps({
|
|
164
162
|
index: index,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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,
|
|
170
170
|
getItemProps,
|
|
171
|
+
highlightedIndex,
|
|
171
172
|
multiple,
|
|
173
|
+
optionClassName,
|
|
174
|
+
optionProps,
|
|
172
175
|
optionsSize,
|
|
173
|
-
highlightedIndex,
|
|
174
176
|
selectedItems,
|
|
175
|
-
dataTestId,
|
|
176
177
|
]);
|
|
177
178
|
useEffect(function () {
|
|
178
179
|
if (defaultOpen)
|
|
@@ -216,7 +217,7 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
216
217
|
var needRenderOptionsList = flatOptions.length > 0 || showEmptyOptionsList;
|
|
217
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) }),
|
|
218
219
|
nativeSelect && renderNativeSelect(),
|
|
219
|
-
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: {
|
|
220
221
|
onBlur: handleFieldBlur,
|
|
221
222
|
onFocus: disabled ? undefined : handleFieldFocus,
|
|
222
223
|
onClick: disabled ? undefined : handleFieldClick,
|
|
@@ -230,8 +231,8 @@ var BaseSelect = forwardRef(function (_a, ref) {
|
|
|
230
231
|
: undefined,
|
|
231
232
|
}, dataTestId: getDataTestId(dataTestId, 'field') }, fieldProps)),
|
|
232
233
|
name && !nativeSelect && renderValue(),
|
|
233
|
-
!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) }),
|
|
234
|
-
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') }))))))));
|
|
235
236
|
});
|
|
236
237
|
|
|
237
238
|
export { BaseSelect };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 16bq9 */
|
|
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_75qfr {
|
|
32
32
|
width: max-content;
|
|
33
33
|
position: relative;
|
|
34
34
|
outline: 0;
|
|
35
35
|
}
|
|
36
|
-
.
|
|
36
|
+
.select__popoverInner_75qfr {
|
|
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_75qfr {
|
|
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_75qfr {
|
|
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_75qfr {
|
|
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_75qfr {
|
|
74
74
|
float: left;
|
|
75
75
|
clear: left;
|
|
76
76
|
}
|
|
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Checkbox } from '@alfalab/core-components-checkbox/dist/esm';
|
|
4
4
|
|
|
5
|
-
var styles = {"checkmark":"
|
|
5
|
+
var styles = {"checkmark":"select__checkmark_1adtc","single":"select__single_1adtc","selected":"select__selected_1adtc","before":"select__before_1adtc","multiple":"select__multiple_1adtc","after":"select__after_1adtc"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
var Checkmark = function (_a) {
|
|
@@ -15,7 +15,7 @@ var Checkmark = function (_a) {
|
|
|
15
15
|
_b[styles.selected] = selected,
|
|
16
16
|
_b));
|
|
17
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:
|
|
18
|
+
return single ? (React.createElement("span", { className: checkmarkClassNames })) : (React.createElement(Checkbox, { checked: selected, className: checkmarkClassNames, size: 'm', onClick: handleCheckboxClick }));
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export { Checkmark };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: ut15l */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-primary: #0b1f35;
|
|
4
4
|
}
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
|
|
36
36
|
/* optgroup */
|
|
37
37
|
}
|
|
38
|
-
.
|
|
38
|
+
.select__checkmark_1adtc {
|
|
39
39
|
flex-shrink: 0;
|
|
40
40
|
margin: var(--select-checkmark-margin);
|
|
41
41
|
}
|
|
42
|
-
.
|
|
42
|
+
.select__single_1adtc {
|
|
43
43
|
display: flex;
|
|
44
44
|
align-items: center;
|
|
45
45
|
justify-content: center;
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
width: var(--select-checkmark-size);
|
|
51
51
|
height: var(--select-checkmark-size)
|
|
52
52
|
}
|
|
53
|
-
.
|
|
53
|
+
.select__single_1adtc.select__selected_1adtc {
|
|
54
54
|
opacity: 1;
|
|
55
55
|
}
|
|
56
|
-
.
|
|
56
|
+
.select__before_1adtc {
|
|
57
57
|
display: var(--select-checkmark-before-display)
|
|
58
58
|
}
|
|
59
|
-
.
|
|
59
|
+
.select__before_1adtc.select__multiple_1adtc {
|
|
60
60
|
margin-right: var(--gap-s);
|
|
61
61
|
}
|
|
62
|
-
.
|
|
62
|
+
.select__after_1adtc {
|
|
63
63
|
display: var(--select-checkmark-after-display);
|
|
64
64
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FieldProps as BaseFieldProps } from "../../typings";
|
|
4
|
-
declare const Field: ({ size, open, multiple, error, hint, disabled, label, placeholder, selectedMultiple, selected, rightAddons, valueRenderer, Arrow, innerProps, dataTestId, fieldClassName, ...restProps }: BaseFieldProps & React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
declare const Field: ({ size, open, multiple, error, hint, disabled, label, placeholder, selectedMultiple, selected, rightAddons, valueRenderer, setSelectedItems, toggleMenu, Arrow, innerProps, dataTestId, fieldClassName, ...restProps }: BaseFieldProps & React.HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
block?: boolean | undefined;
|
|
6
6
|
size?: "s" | "m" | "l" | "xl" | undefined;
|
|
7
7
|
colors?: "default" | "inverted" | undefined;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign } from '../../tslib.es6-
|
|
1
|
+
import { _ as __rest, a as __assign } from '../../tslib.es6-11a0bbd3.js';
|
|
2
2
|
import React, { useState, useRef, useCallback } from 'react';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { useFocus } from '@alfalab/hooks';
|
|
5
5
|
import { FormControl } from '@alfalab/core-components-form-control/dist/esm';
|
|
6
6
|
import { joinOptions } from '../../utils.js';
|
|
7
7
|
|
|
8
|
-
var styles = {"component":"
|
|
8
|
+
var styles = {"component":"select__component_1m09f","field":"select__field_1m09f","disabled":"select__disabled_1m09f","arrow":"select__arrow_1m09f","placeholder":"select__placeholder_1m09f","contentWrapper":"select__contentWrapper_1m09f","value":"select__value_1m09f","focusVisible":"select__focusVisible_1m09f"};
|
|
9
9
|
require('./index.css')
|
|
10
10
|
|
|
11
11
|
var Field = function (_a) {
|
|
12
12
|
var _b;
|
|
13
|
-
var _c = _a.size, size = _c === void 0 ? 'm' : _c, open = _a.open, multiple = _a.multiple, error = _a.error, hint = _a.hint, disabled = _a.disabled, label = _a.label, placeholder = _a.placeholder, _d = _a.selectedMultiple, selectedMultiple = _d === void 0 ? [] : _d, selected = _a.selected, rightAddons = _a.rightAddons, _e = _a.valueRenderer, valueRenderer = _e === void 0 ? joinOptions : _e, Arrow = _a.Arrow, innerProps = _a.innerProps, dataTestId = _a.dataTestId, fieldClassName = _a.fieldClassName, restProps = __rest(_a, ["size", "open", "multiple", "error", "hint", "disabled", "label", "placeholder", "selectedMultiple", "selected", "rightAddons", "valueRenderer", "Arrow", "innerProps", "dataTestId", "fieldClassName"]);
|
|
13
|
+
var _c = _a.size, size = _c === void 0 ? 'm' : _c, open = _a.open, multiple = _a.multiple, error = _a.error, hint = _a.hint, disabled = _a.disabled, label = _a.label, placeholder = _a.placeholder, _d = _a.selectedMultiple, selectedMultiple = _d === void 0 ? [] : _d, selected = _a.selected, rightAddons = _a.rightAddons, _e = _a.valueRenderer, valueRenderer = _e === void 0 ? joinOptions : _e, setSelectedItems = _a.setSelectedItems, toggleMenu = _a.toggleMenu, Arrow = _a.Arrow, innerProps = _a.innerProps, dataTestId = _a.dataTestId, fieldClassName = _a.fieldClassName, restProps = __rest(_a, ["size", "open", "multiple", "error", "hint", "disabled", "label", "placeholder", "selectedMultiple", "selected", "rightAddons", "valueRenderer", "setSelectedItems", "toggleMenu", "Arrow", "innerProps", "dataTestId", "fieldClassName"]);
|
|
14
14
|
var _f = useState(false), focused = _f[0], setFocused = _f[1];
|
|
15
15
|
var wrapperRef = useRef(null);
|
|
16
16
|
var focusVisible = useFocus(wrapperRef, 'keyboard')[0];
|