@alfalab/core-components-select 18.2.5 → 18.2.6
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/components/arrow/index.css +4 -4
- package/components/arrow/index.module.css.js +1 -1
- package/components/base-checkmark/index.css +5 -5
- package/components/base-checkmark/index.module.css.js +1 -1
- package/components/base-option/index.css +16 -16
- package/components/base-option/index.module.css.js +1 -1
- package/components/base-select/Component.d.ts +1 -1
- package/components/base-select/Component.js +2 -2
- package/components/base-select/Component.js.map +1 -1
- package/components/base-select/index.css +11 -11
- package/components/base-select/index.module.css.js +1 -1
- package/components/base-select/mobile.css +11 -11
- package/components/base-select/mobile.module.css.js +1 -1
- package/components/checkmark/index.css +9 -9
- package/components/checkmark/index.module.css.js +1 -1
- package/components/checkmark-mobile/index.css +5 -5
- package/components/checkmark-mobile/index.module.css.js +1 -1
- package/components/clear-button/index.css +4 -4
- package/components/clear-button/index.module.css.js +1 -1
- package/components/field/index.css +13 -13
- package/components/field/index.module.css.js +1 -1
- package/components/footer/index.css +4 -4
- package/components/footer/index.module.css.js +1 -1
- package/components/optgroup/index.css +4 -4
- package/components/optgroup/index.module.css.js +1 -1
- package/components/option/desktop/index.css +19 -19
- package/components/option/desktop/index.module.css.js +1 -1
- package/components/option/mobile/index.css +16 -16
- package/components/option/mobile/index.module.css.js +1 -1
- package/components/options-list/Component.d.ts +35 -2
- package/components/options-list/Component.js +6 -8
- package/components/options-list/Component.js.map +1 -1
- package/components/options-list/index.css +9 -9
- package/components/options-list/index.module.css.js +1 -1
- package/components/search/Component.js +15 -1
- package/components/search/Component.js.map +1 -1
- package/components/search/index.css +1 -1
- package/components/search/index.module.css.js +1 -1
- package/components/virtual-options-list/Component.d.ts +35 -2
- package/components/virtual-options-list/Component.js +6 -9
- package/components/virtual-options-list/Component.js.map +1 -1
- package/components/virtual-options-list/index.css +13 -13
- package/components/virtual-options-list/index.module.css.js +1 -1
- package/cssm/components/base-select/Component.d.ts +1 -1
- package/cssm/components/base-select/Component.js +2 -2
- package/cssm/components/base-select/Component.js.map +1 -1
- package/cssm/components/options-list/Component.d.ts +35 -2
- package/cssm/components/options-list/Component.js +8 -10
- package/cssm/components/options-list/Component.js.map +1 -1
- package/cssm/components/search/Component.js +15 -1
- package/cssm/components/search/Component.js.map +1 -1
- package/cssm/components/virtual-options-list/Component.d.ts +35 -2
- package/cssm/components/virtual-options-list/Component.js +8 -11
- package/cssm/components/virtual-options-list/Component.js.map +1 -1
- package/cssm/hooks/use-native-scrollbar.d.ts +4 -0
- package/cssm/hooks/use-native-scrollbar.js +33 -0
- package/cssm/hooks/use-native-scrollbar.js.map +1 -0
- package/cssm/presets/useSelectWithApply/hook.d.ts +137 -5
- package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +69 -3
- package/cssm/typings.d.ts +1 -1
- package/esm/components/arrow/index.css +4 -4
- package/esm/components/arrow/index.module.css.js +1 -1
- package/esm/components/base-checkmark/index.css +5 -5
- package/esm/components/base-checkmark/index.module.css.js +1 -1
- package/esm/components/base-option/index.css +16 -16
- package/esm/components/base-option/index.module.css.js +1 -1
- package/esm/components/base-select/Component.d.ts +1 -1
- package/esm/components/base-select/Component.js +2 -2
- package/esm/components/base-select/Component.js.map +1 -1
- package/esm/components/base-select/index.css +11 -11
- package/esm/components/base-select/index.module.css.js +1 -1
- package/esm/components/base-select/mobile.css +11 -11
- package/esm/components/base-select/mobile.module.css.js +1 -1
- package/esm/components/checkmark/index.css +9 -9
- package/esm/components/checkmark/index.module.css.js +1 -1
- package/esm/components/checkmark-mobile/index.css +5 -5
- package/esm/components/checkmark-mobile/index.module.css.js +1 -1
- package/esm/components/clear-button/index.css +4 -4
- package/esm/components/clear-button/index.module.css.js +1 -1
- package/esm/components/field/index.css +13 -13
- package/esm/components/field/index.module.css.js +1 -1
- package/esm/components/footer/index.css +4 -4
- package/esm/components/footer/index.module.css.js +1 -1
- package/esm/components/optgroup/index.css +4 -4
- package/esm/components/optgroup/index.module.css.js +1 -1
- package/esm/components/option/desktop/index.css +19 -19
- package/esm/components/option/desktop/index.module.css.js +1 -1
- package/esm/components/option/mobile/index.css +16 -16
- package/esm/components/option/mobile/index.module.css.js +1 -1
- package/esm/components/options-list/Component.d.ts +35 -2
- package/esm/components/options-list/Component.js +6 -8
- package/esm/components/options-list/Component.js.map +1 -1
- package/esm/components/options-list/index.css +9 -9
- package/esm/components/options-list/index.module.css.js +1 -1
- package/esm/components/search/Component.js +15 -1
- package/esm/components/search/Component.js.map +1 -1
- package/esm/components/search/index.css +1 -1
- package/esm/components/search/index.module.css.js +1 -1
- package/esm/components/virtual-options-list/Component.d.ts +35 -2
- package/esm/components/virtual-options-list/Component.js +6 -9
- package/esm/components/virtual-options-list/Component.js.map +1 -1
- package/esm/components/virtual-options-list/index.css +13 -13
- package/esm/components/virtual-options-list/index.module.css.js +1 -1
- package/esm/hooks/use-native-scrollbar.d.ts +4 -0
- package/esm/hooks/use-native-scrollbar.js +29 -0
- package/esm/hooks/use-native-scrollbar.js.map +1 -0
- package/esm/presets/useSelectWithApply/hook.d.ts +137 -5
- package/esm/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +69 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js +1 -1
- package/esm/presets/useSelectWithLoading/index.css +1 -1
- package/esm/presets/useSelectWithLoading/index.module.css.js +1 -1
- package/esm/typings.d.ts +1 -1
- package/hooks/use-native-scrollbar.d.ts +4 -0
- package/hooks/use-native-scrollbar.js +33 -0
- package/hooks/use-native-scrollbar.js.map +1 -0
- package/modern/components/arrow/index.css +4 -4
- package/modern/components/arrow/index.module.css.js +1 -1
- package/modern/components/base-checkmark/index.css +5 -5
- package/modern/components/base-checkmark/index.module.css.js +1 -1
- package/modern/components/base-option/index.css +16 -16
- package/modern/components/base-option/index.module.css.js +1 -1
- package/modern/components/base-select/Component.d.ts +1 -1
- package/modern/components/base-select/Component.js +2 -2
- package/modern/components/base-select/Component.js.map +1 -1
- package/modern/components/base-select/index.css +11 -11
- package/modern/components/base-select/index.module.css.js +1 -1
- package/modern/components/base-select/mobile.css +11 -11
- package/modern/components/base-select/mobile.module.css.js +1 -1
- package/modern/components/checkmark/index.css +9 -9
- package/modern/components/checkmark/index.module.css.js +1 -1
- package/modern/components/checkmark-mobile/index.css +5 -5
- package/modern/components/checkmark-mobile/index.module.css.js +1 -1
- package/modern/components/clear-button/index.css +4 -4
- package/modern/components/clear-button/index.module.css.js +1 -1
- package/modern/components/field/index.css +13 -13
- package/modern/components/field/index.module.css.js +1 -1
- package/modern/components/footer/index.css +4 -4
- package/modern/components/footer/index.module.css.js +1 -1
- package/modern/components/optgroup/index.css +4 -4
- package/modern/components/optgroup/index.module.css.js +1 -1
- package/modern/components/option/desktop/index.css +19 -19
- package/modern/components/option/desktop/index.module.css.js +1 -1
- package/modern/components/option/mobile/index.css +16 -16
- package/modern/components/option/mobile/index.module.css.js +1 -1
- package/modern/components/options-list/Component.d.ts +35 -2
- package/modern/components/options-list/Component.js +6 -6
- package/modern/components/options-list/Component.js.map +1 -1
- package/modern/components/options-list/index.css +9 -9
- package/modern/components/options-list/index.module.css.js +1 -1
- package/modern/components/search/Component.js +17 -1
- package/modern/components/search/Component.js.map +1 -1
- package/modern/components/search/index.css +1 -1
- package/modern/components/search/index.module.css.js +1 -1
- package/modern/components/virtual-options-list/Component.d.ts +35 -2
- package/modern/components/virtual-options-list/Component.js +6 -7
- package/modern/components/virtual-options-list/Component.js.map +1 -1
- package/modern/components/virtual-options-list/index.css +13 -13
- package/modern/components/virtual-options-list/index.module.css.js +1 -1
- package/modern/hooks/use-native-scrollbar.d.ts +4 -0
- package/modern/hooks/use-native-scrollbar.js +27 -0
- package/modern/hooks/use-native-scrollbar.js.map +1 -0
- package/modern/presets/useSelectWithApply/hook.d.ts +137 -5
- package/modern/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +69 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js +1 -1
- package/modern/presets/useSelectWithLoading/index.css +1 -1
- package/modern/presets/useSelectWithLoading/index.module.css.js +1 -1
- package/modern/typings.d.ts +1 -1
- package/moderncssm/components/base-select/Component.d.ts +1 -1
- package/moderncssm/components/base-select/Component.js +2 -2
- package/moderncssm/components/base-select/Component.js.map +1 -1
- package/moderncssm/components/options-list/Component.d.ts +35 -2
- package/moderncssm/components/options-list/Component.js +6 -6
- package/moderncssm/components/options-list/Component.js.map +1 -1
- package/moderncssm/components/search/Component.js +17 -1
- package/moderncssm/components/search/Component.js.map +1 -1
- package/moderncssm/components/virtual-options-list/Component.d.ts +35 -2
- package/moderncssm/components/virtual-options-list/Component.js +6 -7
- package/moderncssm/components/virtual-options-list/Component.js.map +1 -1
- package/moderncssm/hooks/use-native-scrollbar.d.ts +4 -0
- package/moderncssm/hooks/use-native-scrollbar.js +27 -0
- package/moderncssm/hooks/use-native-scrollbar.js.map +1 -0
- package/moderncssm/presets/useSelectWithApply/hook.d.ts +137 -5
- package/moderncssm/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +69 -3
- package/moderncssm/typings.d.ts +1 -1
- package/package.json +4 -4
- package/presets/useSelectWithApply/hook.d.ts +137 -5
- package/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +69 -3
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js +1 -1
- package/presets/useSelectWithLoading/index.css +1 -1
- package/presets/useSelectWithLoading/index.module.css.js +1 -1
- package/src/components/base-select/Component.tsx +2 -0
- package/src/components/options-list/Component.tsx +6 -8
- package/src/components/search/Component.tsx +29 -10
- package/src/components/virtual-options-list/Component.tsx +6 -9
- package/src/hooks/use-native-scrollbar.ts +36 -0
- package/src/typings.ts +1 -1
- package/typings.d.ts +1 -1
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
--color-light-neutral-translucent-500-press: rgba(4, 4, 21, 0.47);
|
|
5
5
|
} :root {
|
|
6
6
|
--input-error-icon-display: none;
|
|
7
|
-
} .
|
|
7
|
+
} .select__clearIcon_15ggj {
|
|
8
8
|
display: block;
|
|
9
9
|
color: var(--color-light-neutral-translucent-500);
|
|
10
|
-
} .
|
|
10
|
+
} .select__clearIcon_15ggj:hover {
|
|
11
11
|
color: var(--color-light-neutral-translucent-500-hover);
|
|
12
|
-
} .
|
|
12
|
+
} .select__clearIcon_15ggj:active {
|
|
13
13
|
color: var(--color-light-neutral-translucent-500-press);
|
|
14
|
-
} .
|
|
14
|
+
} .select__clearButton_15ggj + [data-addon='error-icon'] {
|
|
15
15
|
display: var(--input-error-icon-display);
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"clearIcon":"
|
|
3
|
+
const styles = {"clearIcon":"select__clearIcon_15ggj","clearButton":"select__clearButton_15ggj"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -10,22 +10,22 @@
|
|
|
10
10
|
--input-focus-placeholder-color: var(--color-light-text-tertiary);
|
|
11
11
|
} :root {
|
|
12
12
|
--select-arrow-hover-opacity: 0.7;
|
|
13
|
-
} .
|
|
13
|
+
} .select__component_bk046 {
|
|
14
14
|
width: 100%;
|
|
15
15
|
outline: none;
|
|
16
|
-
} .
|
|
16
|
+
} .select__field_bk046:not(.select__disabled_bk046) {
|
|
17
17
|
cursor: pointer;
|
|
18
|
-
} .
|
|
18
|
+
} .select__field_bk046:not(.select__disabled_bk046):hover .select__arrow_bk046 {
|
|
19
19
|
opacity: var(--select-arrow-hover-opacity);
|
|
20
|
-
} .
|
|
20
|
+
} .select__disabled_bk046 {
|
|
21
21
|
cursor: var(--disabled-cursor);
|
|
22
|
-
} .
|
|
22
|
+
} .select__placeholder_bk046 {
|
|
23
23
|
color: var(--input-placeholder-color);
|
|
24
24
|
transition: color 0.2s ease;
|
|
25
|
-
animation: select__show-
|
|
26
|
-
} .
|
|
25
|
+
animation: select__show-placeholder_bk046 0.2s ease;
|
|
26
|
+
} .select__placeholder_bk046.select__focused_bk046 {
|
|
27
27
|
color: var(--input-focus-placeholder-color);
|
|
28
|
-
} .
|
|
28
|
+
} .select__contentWrapper_bk046 {
|
|
29
29
|
font-size: 16px;
|
|
30
30
|
line-height: 20px;
|
|
31
31
|
font-weight: 400;
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
text-overflow: ellipsis;
|
|
35
35
|
overflow: hidden;
|
|
36
36
|
width: 100%;
|
|
37
|
-
} .
|
|
37
|
+
} .select__contentWrapper_bk046.select__size-40_bk046 {
|
|
38
38
|
font-size: 14px;
|
|
39
39
|
line-height: 18px;
|
|
40
40
|
font-weight: 400;
|
|
41
|
-
} .
|
|
41
|
+
} .select__value_bk046 {
|
|
42
42
|
overflow: hidden;
|
|
43
43
|
text-overflow: ellipsis;
|
|
44
44
|
text-align: left;
|
|
45
|
-
} .
|
|
45
|
+
} .select__value_bk046.select__size-40_bk046 {
|
|
46
46
|
font-size: 14px;
|
|
47
47
|
line-height: 18px;
|
|
48
48
|
font-weight: 400;
|
|
49
|
-
} .
|
|
49
|
+
} .select__focusVisible_bk046 {
|
|
50
50
|
outline: 2px solid var(--focus-color);
|
|
51
51
|
outline-offset: 2px;
|
|
52
|
-
} @keyframes select__show-
|
|
52
|
+
} @keyframes select__show-placeholder_bk046 {
|
|
53
53
|
from {
|
|
54
54
|
opacity: 0;
|
|
55
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"component":"
|
|
3
|
+
const styles = {"component":"select__component_bk046","field":"select__field_bk046","disabled":"select__disabled_bk046","arrow":"select__arrow_bk046","placeholder":"select__placeholder_bk046","show-placeholder":"select__show-placeholder_bk046","focused":"select__focused_bk046","contentWrapper":"select__contentWrapper_bk046","size-40":"select__size-40_bk046","value":"select__value_bk046","focusVisible":"select__focusVisible_bk046"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
} :root {
|
|
5
5
|
--gap-m: 16px;
|
|
6
6
|
--gap-16: var(--gap-m);
|
|
7
|
-
} .
|
|
7
|
+
} .select__footer_16eho {
|
|
8
8
|
display: flex;
|
|
9
9
|
box-sizing: border-box;
|
|
10
10
|
width: 100%;
|
|
11
11
|
padding: var(--gap-16) var(--gap-16);
|
|
12
12
|
background-color: var(--color-light-modal-bg-primary);
|
|
13
|
-
} .
|
|
13
|
+
} .select__footer_16eho .select__button_16eho:first-of-type {
|
|
14
14
|
margin-right: var(--gap-16);
|
|
15
|
-
} .
|
|
15
|
+
} .select__button_16eho {
|
|
16
16
|
width: 50%;
|
|
17
|
-
} .
|
|
17
|
+
} .select__highlighted_16eho {
|
|
18
18
|
border-top: 1px solid var(--color-light-neutral-300);
|
|
19
19
|
background-color: var(--color-light-modal-bg-primary);
|
|
20
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"footer":"
|
|
3
|
+
const styles = {"footer":"select__footer_16eho","button":"select__button_16eho","highlighted":"select__highlighted_16eho"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
--select-optgroup-right-padding: var(--gap-12);
|
|
17
17
|
--select-optgroup-l-left-padding: var(--gap-16);
|
|
18
18
|
--select-optgroup-l-right-padding: var(--gap-16);
|
|
19
|
-
} .
|
|
19
|
+
} .select__optgroup_7v3if {
|
|
20
20
|
position: relative;
|
|
21
21
|
display: flex;
|
|
22
22
|
align-items: center;
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
box-sizing: border-box;
|
|
26
26
|
background: var(--select-optgroup-background);
|
|
27
27
|
min-height: 40px;
|
|
28
|
-
} .
|
|
28
|
+
} .select__optgroup_7v3if + *[role='option']:before {
|
|
29
29
|
display: none;
|
|
30
|
-
} .
|
|
30
|
+
} .select__label_7v3if {
|
|
31
31
|
font-size: 12px;
|
|
32
32
|
line-height: 16px;
|
|
33
33
|
font-weight: 500;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
display: block;
|
|
38
38
|
color: var(--select-optgroup-color);
|
|
39
|
-
} .select__size-
|
|
39
|
+
} .select__size-72_7v3if {
|
|
40
40
|
padding-left: var(--select-optgroup-l-left-padding);
|
|
41
41
|
padding-right: var(--select-optgroup-l-right-padding);
|
|
42
42
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"optgroup":"
|
|
3
|
+
const styles = {"optgroup":"select__optgroup_7v3if","label":"select__label_7v3if","size-72":"select__size-72_7v3if"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
--select-option-hover-color: var(--color-light-text-primary);
|
|
36
36
|
--select-option-active-color: var(--color-light-text-primary);
|
|
37
37
|
--select-option-disabled-color: var(--color-light-text-secondary);
|
|
38
|
-
} .
|
|
38
|
+
} .select__option_1hxpg {
|
|
39
39
|
font-size: 16px;
|
|
40
40
|
line-height: 20px;
|
|
41
41
|
font-weight: 400;
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
box-sizing: border-box;
|
|
51
51
|
position: relative;
|
|
52
52
|
cursor: pointer;
|
|
53
|
-
} .
|
|
53
|
+
} .select__option_1hxpg:not(.select__disabled_1hxpg):active {
|
|
54
54
|
background: var(--select-option-active-background);
|
|
55
55
|
color: var(--select-option-active-color);
|
|
56
|
-
} .
|
|
56
|
+
} .select__option_1hxpg:before {
|
|
57
57
|
content: '';
|
|
58
58
|
position: absolute;
|
|
59
59
|
left: var(--select-option-left-padding);
|
|
@@ -63,46 +63,46 @@
|
|
|
63
63
|
background: var(--select-option-divider-background);
|
|
64
64
|
display: var(--select-option-divider-display);
|
|
65
65
|
transition: opacity 0.2s ease;
|
|
66
|
-
} .
|
|
66
|
+
} .select__option_1hxpg:first-child:before {
|
|
67
67
|
display: none;
|
|
68
|
-
} .select__size-
|
|
68
|
+
} .select__size-48_1hxpg {
|
|
69
69
|
min-height: var(--size-s-height);
|
|
70
|
-
} .select__size-
|
|
70
|
+
} .select__size-56_1hxpg {
|
|
71
71
|
min-height: var(--size-m-height);
|
|
72
|
-
} .select__size-
|
|
72
|
+
} .select__size-64_1hxpg {
|
|
73
73
|
min-height: var(--size-l-height);
|
|
74
|
-
} .select__size-
|
|
74
|
+
} .select__size-72_1hxpg {
|
|
75
75
|
min-height: var(--size-xl-height);
|
|
76
76
|
padding-left: var(--select-option-l-left-padding);
|
|
77
77
|
padding-right: var(--select-option-l-right-padding);
|
|
78
|
-
} .select__size-
|
|
78
|
+
} .select__size-72_1hxpg:before {
|
|
79
79
|
left: var(--select-option-l-left-padding);
|
|
80
80
|
right: var(--select-option-l-right-padding);
|
|
81
|
-
} .
|
|
81
|
+
} .select__selected_1hxpg {
|
|
82
82
|
background: var(--select-option-selected-background);
|
|
83
83
|
color: var(--select-option-selected-color);
|
|
84
84
|
cursor: default;
|
|
85
|
-
} .
|
|
85
|
+
} .select__highlighted_1hxpg {
|
|
86
86
|
background: var(--select-option-hover-background);
|
|
87
87
|
color: var(--select-option-hover-color);
|
|
88
|
-
} .
|
|
89
|
-
.
|
|
88
|
+
} .select__highlighted_1hxpg:before,
|
|
89
|
+
.select__highlighted_1hxpg + .select__option_1hxpg:before {
|
|
90
90
|
opacity: 0;
|
|
91
|
-
} .
|
|
91
|
+
} .select__disabled_1hxpg {
|
|
92
92
|
cursor: var(--disabled-cursor);
|
|
93
93
|
background: var(--select-option-disabled-background);
|
|
94
94
|
color: var(--select-option-disabled-color);
|
|
95
|
-
} .
|
|
95
|
+
} .select__content_1hxpg {
|
|
96
96
|
overflow: hidden;
|
|
97
97
|
flex: 1;
|
|
98
98
|
text-overflow: ellipsis;
|
|
99
|
-
} .
|
|
99
|
+
} .select__textContent_1hxpg {
|
|
100
100
|
padding-top: var(--gap-12);
|
|
101
101
|
padding-bottom: var(--gap-12);
|
|
102
|
-
} .
|
|
102
|
+
} .select__highlighted_1hxpg {
|
|
103
103
|
background: var(--select-option-hover-background);
|
|
104
104
|
color: var(--select-option-hover-color);
|
|
105
|
-
} .
|
|
106
|
-
.
|
|
105
|
+
} .select__highlighted_1hxpg:before,
|
|
106
|
+
.select__highlighted_1hxpg + .select__option_1hxpg:before {
|
|
107
107
|
opacity: 0;
|
|
108
108
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"option":"
|
|
3
|
+
const styles = {"option":"select__option_1hxpg","disabled":"select__disabled_1hxpg","size-48":"select__size-48_1hxpg","size-56":"select__size-56_1hxpg","size-64":"select__size-64_1hxpg","size-72":"select__size-72_1hxpg","selected":"select__selected_1hxpg","highlighted":"select__highlighted_1hxpg","content":"select__content_1hxpg","textContent":"select__textContent_1hxpg"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
--select-option-hover-color: var(--color-light-text-primary);
|
|
36
36
|
--select-option-active-color: var(--color-light-text-primary);
|
|
37
37
|
--select-option-disabled-color: var(--color-light-text-secondary);
|
|
38
|
-
} .
|
|
38
|
+
} .select__option_1ipxd {
|
|
39
39
|
font-size: 16px;
|
|
40
40
|
line-height: 20px;
|
|
41
41
|
font-weight: 400;
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
box-sizing: border-box;
|
|
51
51
|
position: relative;
|
|
52
52
|
cursor: pointer;
|
|
53
|
-
} .
|
|
53
|
+
} .select__option_1ipxd:not(.select__disabled_1ipxd):active {
|
|
54
54
|
background: var(--select-option-active-background);
|
|
55
55
|
color: var(--select-option-active-color);
|
|
56
|
-
} .
|
|
56
|
+
} .select__option_1ipxd:before {
|
|
57
57
|
content: '';
|
|
58
58
|
position: absolute;
|
|
59
59
|
left: var(--select-option-left-padding);
|
|
@@ -63,40 +63,40 @@
|
|
|
63
63
|
background: var(--select-option-divider-background);
|
|
64
64
|
display: var(--select-option-divider-display);
|
|
65
65
|
transition: opacity 0.2s ease;
|
|
66
|
-
} .
|
|
66
|
+
} .select__option_1ipxd:first-child:before {
|
|
67
67
|
display: none;
|
|
68
|
-
} .select__size-
|
|
68
|
+
} .select__size-48_1ipxd {
|
|
69
69
|
min-height: var(--size-s-height);
|
|
70
|
-
} .select__size-
|
|
70
|
+
} .select__size-56_1ipxd {
|
|
71
71
|
min-height: var(--size-m-height);
|
|
72
|
-
} .select__size-
|
|
72
|
+
} .select__size-64_1ipxd {
|
|
73
73
|
min-height: var(--size-l-height);
|
|
74
|
-
} .select__size-
|
|
74
|
+
} .select__size-72_1ipxd {
|
|
75
75
|
min-height: var(--size-xl-height);
|
|
76
76
|
padding-left: var(--select-option-l-left-padding);
|
|
77
77
|
padding-right: var(--select-option-l-right-padding);
|
|
78
|
-
} .select__size-
|
|
78
|
+
} .select__size-72_1ipxd:before {
|
|
79
79
|
left: var(--select-option-l-left-padding);
|
|
80
80
|
right: var(--select-option-l-right-padding);
|
|
81
|
-
} .
|
|
81
|
+
} .select__selected_1ipxd {
|
|
82
82
|
background: var(--select-option-selected-background);
|
|
83
83
|
color: var(--select-option-selected-color);
|
|
84
84
|
cursor: default;
|
|
85
|
-
} .
|
|
85
|
+
} .select__highlighted_1ipxd {
|
|
86
86
|
background: var(--select-option-hover-background);
|
|
87
87
|
color: var(--select-option-hover-color);
|
|
88
|
-
} .
|
|
89
|
-
.
|
|
88
|
+
} .select__highlighted_1ipxd:before,
|
|
89
|
+
.select__highlighted_1ipxd + .select__option_1ipxd:before {
|
|
90
90
|
opacity: 0;
|
|
91
|
-
} .
|
|
91
|
+
} .select__disabled_1ipxd {
|
|
92
92
|
cursor: var(--disabled-cursor);
|
|
93
93
|
background: var(--select-option-disabled-background);
|
|
94
94
|
color: var(--select-option-disabled-color);
|
|
95
|
-
} .
|
|
95
|
+
} .select__content_1ipxd {
|
|
96
96
|
overflow: hidden;
|
|
97
97
|
flex: 1;
|
|
98
98
|
text-overflow: ellipsis;
|
|
99
|
-
} .
|
|
99
|
+
} .select__textContent_1ipxd {
|
|
100
100
|
padding-top: var(--gap-12);
|
|
101
101
|
padding-bottom: var(--gap-12);
|
|
102
102
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"option":"
|
|
3
|
+
const styles = {"option":"select__option_1ipxd","disabled":"select__disabled_1ipxd","size-48":"select__size-48_1ipxd","size-56":"select__size-56_1ipxd","size-64":"select__size-64_1ipxd","size-72":"select__size-72_1ipxd","selected":"select__selected_1ipxd","highlighted":"select__highlighted_1ipxd","content":"select__content_1ipxd","textContent":"select__textContent_1ipxd"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1,3 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
export declare const OptionsList: React.ForwardRefExoticComponent<
|
|
2
|
+
import { type GroupShape, type OptionShape } from '../../typings';
|
|
3
|
+
export declare const OptionsList: React.ForwardRefExoticComponent<Pick<import("../../typings").SelectProps, "client"> & {
|
|
4
|
+
className?: string | undefined;
|
|
5
|
+
optionGroupClassName?: string | undefined;
|
|
6
|
+
scrollbarClassName?: string | undefined;
|
|
7
|
+
footerClassName?: string | undefined;
|
|
8
|
+
size?: "s" | "m" | "l" | "xl" | 40 | 48 | 56 | 64 | 72 | undefined;
|
|
9
|
+
Option: React.ComponentType<import("../../typings").OptionProps>;
|
|
10
|
+
getOptionProps: (option: OptionShape, index: number) => import("../../typings").OptionProps;
|
|
11
|
+
groupOptionProps?: import("../../typings").AnyObject | undefined;
|
|
12
|
+
selectedItems?: OptionShape[] | undefined;
|
|
13
|
+
setSelectedItems: (selected: OptionShape[]) => void;
|
|
14
|
+
toggleMenu: () => void;
|
|
15
|
+
header?: React.ReactNode;
|
|
16
|
+
footer?: React.ReactNode;
|
|
17
|
+
options?: (OptionShape | GroupShape)[] | undefined;
|
|
18
|
+
flatOptions?: OptionShape[] | undefined;
|
|
19
|
+
highlightedIndex?: number | undefined;
|
|
20
|
+
open?: boolean | undefined;
|
|
21
|
+
Optgroup?: React.ComponentType<import("../../typings").OptgroupProps> | undefined;
|
|
22
|
+
emptyPlaceholder?: React.ReactNode;
|
|
23
|
+
visibleOptions?: number | undefined;
|
|
24
|
+
onScroll?: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
25
|
+
dataTestId?: string | undefined;
|
|
26
|
+
inputProps?: import("@alfalab/core-components-input").InputProps | undefined;
|
|
27
|
+
showFooter?: boolean | undefined;
|
|
28
|
+
nativeScrollbar?: boolean | undefined;
|
|
29
|
+
optionsListWidth?: "field" | "content" | undefined;
|
|
30
|
+
onApply?: (() => void) | undefined;
|
|
31
|
+
onClear?: (() => void) | undefined;
|
|
32
|
+
setHighlightedIndex?: ((index: number) => void) | undefined;
|
|
33
|
+
search?: string | undefined;
|
|
34
|
+
multiple?: boolean | undefined;
|
|
35
|
+
limitDynamicOptionGroupSize?: boolean | undefined;
|
|
36
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React, { forwardRef, useState, useCallback, useRef } from 'react';
|
|
2
2
|
import mergeRefs from 'react-merge-refs';
|
|
3
3
|
import cn from 'classnames';
|
|
4
|
-
import { useMatchMedia } from '@alfalab/core-components-mq/modern';
|
|
5
4
|
import { Scrollbar } from '@alfalab/core-components-scrollbar/modern';
|
|
6
|
-
import { isClient } from '@alfalab/core-components-shared/modern';
|
|
7
5
|
import { SIZE_TO_CLASSNAME_MAP, DEFAULT_VISIBLE_OPTIONS } from '../../consts.js';
|
|
6
|
+
import { useNativeScrollbar } from '../../hooks/use-native-scrollbar.js';
|
|
8
7
|
import { useVisibleOptions, isGroup } from '../../utils.js';
|
|
9
8
|
import { Optgroup } from '../optgroup/Component.js';
|
|
10
9
|
import styles from './index.module.css.js';
|
|
@@ -14,12 +13,13 @@ const createCounter = () => {
|
|
|
14
13
|
// eslint-disable-next-line no-plusplus
|
|
15
14
|
return () => count++;
|
|
16
15
|
};
|
|
17
|
-
const OptionsList = forwardRef(({ size = 48, className, optionGroupClassName, footerClassName, scrollbarClassName, Option, getOptionProps, groupOptionProps = {}, options = [], Optgroup: Optgroup$1 = Optgroup, dataTestId, emptyPlaceholder, visibleOptions = DEFAULT_VISIBLE_OPTIONS, onScroll, open, header, footer, showFooter = true, optionsListWidth, nativeScrollbar: nativeScrollbarProp, flatOptions = [], setHighlightedIndex, selectedItems, search, setSelectedItems, multiple, limitDynamicOptionGroupSize = false, }, ref) => {
|
|
16
|
+
const OptionsList = forwardRef(({ size = 48, className, optionGroupClassName, footerClassName, scrollbarClassName, Option, getOptionProps, groupOptionProps = {}, options = [], Optgroup: Optgroup$1 = Optgroup, dataTestId, emptyPlaceholder, visibleOptions = DEFAULT_VISIBLE_OPTIONS, onScroll, open, header, footer, showFooter = true, optionsListWidth, nativeScrollbar: nativeScrollbarProp, flatOptions = [], setHighlightedIndex, selectedItems, search, setSelectedItems, multiple, limitDynamicOptionGroupSize = false, client, }, ref) => {
|
|
18
17
|
const [scrollTop, setScrollTop] = useState(true);
|
|
19
18
|
const [scrollBottom, setScrollBottom] = useState(false);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const nativeScrollbar = useNativeScrollbar({
|
|
20
|
+
nativeScrollbar: nativeScrollbarProp,
|
|
21
|
+
client,
|
|
22
|
+
});
|
|
23
23
|
const handleScroll = useCallback((event) => {
|
|
24
24
|
const scrolledToHeader = event.currentTarget.scrollTop <= 0;
|
|
25
25
|
const scrolledToFooter = event.currentTarget.scrollHeight - event.currentTarget.offsetHeight <=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/options-list/Component.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useRef, useState } from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { useMatchMedia } from '@alfalab/core-components-mq';\nimport { Scrollbar } from '@alfalab/core-components-scrollbar';\nimport { isClient } from '@alfalab/core-components-shared';\n\nimport { DEFAULT_VISIBLE_OPTIONS, SIZE_TO_CLASSNAME_MAP } from '../../consts';\nimport { type GroupShape, type OptionShape, type OptionsListProps } from '../../typings';\nimport { isGroup, useVisibleOptions } from '../../utils';\nimport { Optgroup as DefaultOptgroup } from '../optgroup';\n\nimport styles from './index.module.css';\n\nconst createCounter = () => {\n let count = 0;\n\n // eslint-disable-next-line no-plusplus\n return () => count++;\n};\n\nexport const OptionsList = forwardRef<HTMLDivElement, OptionsListProps>(\n (\n {\n size = 48,\n className,\n optionGroupClassName,\n footerClassName,\n scrollbarClassName,\n Option,\n getOptionProps,\n groupOptionProps = {},\n options = [],\n Optgroup = DefaultOptgroup,\n dataTestId,\n emptyPlaceholder,\n visibleOptions = DEFAULT_VISIBLE_OPTIONS,\n onScroll,\n open,\n header,\n footer,\n showFooter = true,\n optionsListWidth,\n nativeScrollbar: nativeScrollbarProp,\n flatOptions = [],\n setHighlightedIndex,\n selectedItems,\n search,\n setSelectedItems,\n multiple,\n limitDynamicOptionGroupSize = false,\n },\n ref,\n ) => {\n const [scrollTop, setScrollTop] = useState(true);\n const [scrollBottom, setScrollBottom] = useState(false);\n\n const query = '(max-width: 1023px)';\n let [nativeScrollbar] = useMatchMedia(query, () =>\n isClient() ? window.matchMedia(query).matches : true,\n );\n\n nativeScrollbar = Boolean(nativeScrollbarProp ?? nativeScrollbar);\n\n const handleScroll = useCallback(\n (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n const scrolledToHeader = event.currentTarget.scrollTop <= 0;\n const scrolledToFooter =\n event.currentTarget.scrollHeight - event.currentTarget.offsetHeight <=\n event.currentTarget.scrollTop;\n\n setScrollTop(scrolledToHeader);\n setScrollBottom(scrolledToFooter);\n\n onScroll?.(event);\n },\n [onScroll],\n );\n\n const renderOption = (option: OptionShape, index: number) => (\n <Option key={option.key} {...getOptionProps(option, index)} />\n );\n\n const listRef = useRef<HTMLDivElement>(null);\n const scrollbarRef = useRef<HTMLDivElement>(null);\n const counter = createCounter();\n const renderGroup = (group: GroupShape) => {\n const groupSelectedItems = selectedItems?.filter(({ key: selectedItemKey }) =>\n group.options.some((option) => option.key === selectedItemKey),\n );\n const handleSelectedItems = (items: OptionShape[]) => {\n setSelectedItems(\n (\n selectedItems?.filter(\n ({ key: selectedItemKey }) =>\n !group.options.some((option) => option.key === selectedItemKey),\n ) ?? []\n ).concat(items),\n );\n };\n\n return (\n <Optgroup\n className={optionGroupClassName}\n label={group.label}\n key={group.label}\n size={size}\n options={group.options}\n selectedItems={groupSelectedItems}\n setSelectedItems={handleSelectedItems}\n search={search}\n multiple={multiple}\n {...groupOptionProps}\n >\n {group.options.map((option) => renderOption(option, counter()))}\n </Optgroup>\n );\n };\n\n const actualOptionsCount = limitDynamicOptionGroupSize && options.length > 0;\n\n const [measured, height] = useVisibleOptions({\n visibleOptions,\n listRef,\n open,\n options,\n actualOptionsCount,\n size: actualOptionsCount\n ? (() => {\n switch (typeof size) {\n case 'string':\n throw new Error(\n 'OptionsList with `limitDynamicOptionGroupSize` enabled needs a `size` with number type',\n );\n default:\n return size;\n }\n })()\n : undefined,\n });\n\n if (options.length === 0 && !emptyPlaceholder && !header && !footer) {\n return null;\n }\n\n const renderListItems = () => (\n <React.Fragment>\n {options.map((option) =>\n isGroup(option) ? renderGroup(option) : renderOption(option, counter()),\n )}\n\n {emptyPlaceholder && options.length === 0 && (\n <div className={styles.emptyPlaceholder}>{emptyPlaceholder}</div>\n )}\n </React.Fragment>\n );\n\n const renderWithCustomScrollbar = () => {\n const scrollableNodeProps = {\n onScroll: handleScroll,\n 'data-test-id': dataTestId,\n ref: ref as React.RefObject<HTMLDivElement>,\n };\n\n return (\n <Scrollbar\n className={cn(styles.scrollable, scrollbarClassName)}\n ref={scrollbarRef}\n style={{ height }}\n horizontalAutoStretch={optionsListWidth === 'content'}\n scrollableNodeProps={scrollableNodeProps}\n contentNodeProps={{ ref: listRef }}\n maskProps={{\n /*\n * Для корректного подсчета высоты опций(иначе для optionsListWidth: 'field'\n * высота опции всегда будет равна высоте одной строчки)\n */\n className: cn({\n [styles.mask]: optionsListWidth === 'content' && !measured,\n }),\n }}\n >\n {renderListItems()}\n </Scrollbar>\n );\n };\n\n const renderWithNativeScrollbar = () => (\n <div\n className={cn(styles.scrollable, scrollbarClassName)}\n ref={mergeRefs([listRef, ref])}\n onScroll={handleScroll}\n style={{ height }}\n >\n {renderListItems()}\n </div>\n );\n\n const resetHighlightedIndex = () => setHighlightedIndex?.(-1);\n\n return (\n <div\n {...(nativeScrollbar && { 'data-test-id': dataTestId })}\n className={cn(styles.optionsList, styles[SIZE_TO_CLASSNAME_MAP[size]], className)}\n >\n {header && (\n <div\n className={cn(styles.optionsListHeader, {\n [styles.headerHighlighted]: !scrollTop,\n })}\n onMouseEnter={resetHighlightedIndex}\n >\n {header}\n </div>\n )}\n\n {nativeScrollbar ? renderWithNativeScrollbar() : renderWithCustomScrollbar()}\n\n {showFooter && footer && (\n <div\n onMouseEnter={resetHighlightedIndex}\n className={cn(styles.optionsListFooter, footerClassName, {\n [styles.withBorder]:\n visibleOptions &&\n flatOptions.length > visibleOptions &&\n !scrollBottom,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n );\n },\n);\n"],"names":["Optgroup","DefaultOptgroup"],"mappings":";;;;;;;;;;;AAeA,MAAM,aAAa,GAAG,MAAK;IACvB,IAAI,KAAK,GAAG,CAAC;;AAGb,IAAA,OAAO,MAAM,KAAK,EAAE;AACxB,CAAC;AAEY,MAAA,WAAW,GAAG,UAAU,CACjC,CACI,EACI,IAAI,GAAG,EAAE,EACT,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,cAAc,EACd,gBAAgB,GAAG,EAAE,EACrB,OAAO,GAAG,EAAE,YACZA,UAAQ,GAAGC,QAAe,EAC1B,UAAU,EACV,gBAAgB,EAChB,cAAc,GAAG,uBAAuB,EACxC,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,MAAM,EACN,UAAU,GAAG,IAAI,EACjB,gBAAgB,EAChB,eAAe,EAAE,mBAAmB,EACpC,WAAW,GAAG,EAAE,EAChB,mBAAmB,EACnB,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,QAAQ,EACR,2BAA2B,GAAG,KAAK,GACtC,EACD,GAAG,KACH;IACA,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;IAChD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAEvD,MAAM,KAAK,GAAG,qBAAqB;AACnC,IAAA,IAAI,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,MACzC,QAAQ,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,IAAI,CACvD;AAED,IAAA,eA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,MAAM,EAAE,EAAA,EAEhB,eAAe,EAAE,CAChB,CACT;IAED,MAAM,qBAAqB,GAAG,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE7D,IAAA,QACI,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,IACS,eAAe,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,EACvD,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,EAAA;QAEhF,MAAM,KACH,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,EAAE;AACpC,gBAAA,CAAC,MAAM,CAAC,iBAAiB,GAAG,CAAC,SAAS;AACzC,aAAA,CAAC,EACF,YAAY,EAAE,qBAAqB,EAElC,EAAA,MAAM,CACL,CACT;QAEA,eAAe,GAAG,yBAAyB,EAAE,GAAG,yBAAyB,EAAE;AAE3E,QAAA,UAAU,IAAI,MAAM,KACjB,KACI,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,YAAY,EAAE,qBAAqB,EACnC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,EAAE,eAAe,EAAE;AACrD,gBAAA,CAAC,MAAM,CAAC,UAAU,GACd,cAAc;oBACd,WAAW,CAAC,MAAM,GAAG,cAAc;AACnC,oBAAA,CAAC,YAAY;AACpB,aAAA,CAAC,IAED,MAAM,CACL,CACT,CACC;AAEd,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/components/options-list/Component.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useRef, useState } from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { Scrollbar } from '@alfalab/core-components-scrollbar';\n\nimport { DEFAULT_VISIBLE_OPTIONS, SIZE_TO_CLASSNAME_MAP } from '../../consts';\nimport { useNativeScrollbar } from '../../hooks/use-native-scrollbar';\nimport { type GroupShape, type OptionShape, type OptionsListProps } from '../../typings';\nimport { isGroup, useVisibleOptions } from '../../utils';\nimport { Optgroup as DefaultOptgroup } from '../optgroup';\n\nimport styles from './index.module.css';\n\nconst createCounter = () => {\n let count = 0;\n\n // eslint-disable-next-line no-plusplus\n return () => count++;\n};\n\nexport const OptionsList = forwardRef<HTMLDivElement, OptionsListProps>(\n (\n {\n size = 48,\n className,\n optionGroupClassName,\n footerClassName,\n scrollbarClassName,\n Option,\n getOptionProps,\n groupOptionProps = {},\n options = [],\n Optgroup = DefaultOptgroup,\n dataTestId,\n emptyPlaceholder,\n visibleOptions = DEFAULT_VISIBLE_OPTIONS,\n onScroll,\n open,\n header,\n footer,\n showFooter = true,\n optionsListWidth,\n nativeScrollbar: nativeScrollbarProp,\n flatOptions = [],\n setHighlightedIndex,\n selectedItems,\n search,\n setSelectedItems,\n multiple,\n limitDynamicOptionGroupSize = false,\n client,\n },\n ref,\n ) => {\n const [scrollTop, setScrollTop] = useState(true);\n const [scrollBottom, setScrollBottom] = useState(false);\n\n const nativeScrollbar = useNativeScrollbar({\n nativeScrollbar: nativeScrollbarProp,\n client,\n });\n\n const handleScroll = useCallback(\n (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n const scrolledToHeader = event.currentTarget.scrollTop <= 0;\n const scrolledToFooter =\n event.currentTarget.scrollHeight - event.currentTarget.offsetHeight <=\n event.currentTarget.scrollTop;\n\n setScrollTop(scrolledToHeader);\n setScrollBottom(scrolledToFooter);\n\n onScroll?.(event);\n },\n [onScroll],\n );\n\n const renderOption = (option: OptionShape, index: number) => (\n <Option key={option.key} {...getOptionProps(option, index)} />\n );\n\n const listRef = useRef<HTMLDivElement>(null);\n const scrollbarRef = useRef<HTMLDivElement>(null);\n const counter = createCounter();\n const renderGroup = (group: GroupShape) => {\n const groupSelectedItems = selectedItems?.filter(({ key: selectedItemKey }) =>\n group.options.some((option) => option.key === selectedItemKey),\n );\n const handleSelectedItems = (items: OptionShape[]) => {\n setSelectedItems(\n (\n selectedItems?.filter(\n ({ key: selectedItemKey }) =>\n !group.options.some((option) => option.key === selectedItemKey),\n ) ?? []\n ).concat(items),\n );\n };\n\n return (\n <Optgroup\n className={optionGroupClassName}\n label={group.label}\n key={group.label}\n size={size}\n options={group.options}\n selectedItems={groupSelectedItems}\n setSelectedItems={handleSelectedItems}\n search={search}\n multiple={multiple}\n {...groupOptionProps}\n >\n {group.options.map((option) => renderOption(option, counter()))}\n </Optgroup>\n );\n };\n\n const actualOptionsCount = limitDynamicOptionGroupSize && options.length > 0;\n\n const [measured, height] = useVisibleOptions({\n visibleOptions,\n listRef,\n open,\n options,\n actualOptionsCount,\n size: actualOptionsCount\n ? (() => {\n switch (typeof size) {\n case 'string':\n throw new Error(\n 'OptionsList with `limitDynamicOptionGroupSize` enabled needs a `size` with number type',\n );\n default:\n return size;\n }\n })()\n : undefined,\n });\n\n if (options.length === 0 && !emptyPlaceholder && !header && !footer) {\n return null;\n }\n\n const renderListItems = () => (\n <React.Fragment>\n {options.map((option) =>\n isGroup(option) ? renderGroup(option) : renderOption(option, counter()),\n )}\n\n {emptyPlaceholder && options.length === 0 && (\n <div className={styles.emptyPlaceholder}>{emptyPlaceholder}</div>\n )}\n </React.Fragment>\n );\n\n const renderWithCustomScrollbar = () => {\n const scrollableNodeProps = {\n onScroll: handleScroll,\n 'data-test-id': dataTestId,\n ref: ref as React.RefObject<HTMLDivElement>,\n };\n\n return (\n <Scrollbar\n className={cn(styles.scrollable, scrollbarClassName)}\n ref={scrollbarRef}\n style={{ height }}\n horizontalAutoStretch={optionsListWidth === 'content'}\n scrollableNodeProps={scrollableNodeProps}\n contentNodeProps={{ ref: listRef }}\n maskProps={{\n /*\n * Для корректного подсчета высоты опций(иначе для optionsListWidth: 'field'\n * высота опции всегда будет равна высоте одной строчки)\n */\n className: cn({\n [styles.mask]: optionsListWidth === 'content' && !measured,\n }),\n }}\n >\n {renderListItems()}\n </Scrollbar>\n );\n };\n\n const renderWithNativeScrollbar = () => (\n <div\n className={cn(styles.scrollable, scrollbarClassName)}\n ref={mergeRefs([listRef, ref])}\n onScroll={handleScroll}\n style={{ height }}\n >\n {renderListItems()}\n </div>\n );\n\n const resetHighlightedIndex = () => setHighlightedIndex?.(-1);\n\n return (\n <div\n {...(nativeScrollbar && { 'data-test-id': dataTestId })}\n className={cn(styles.optionsList, styles[SIZE_TO_CLASSNAME_MAP[size]], className)}\n >\n {header && (\n <div\n className={cn(styles.optionsListHeader, {\n [styles.headerHighlighted]: !scrollTop,\n })}\n onMouseEnter={resetHighlightedIndex}\n >\n {header}\n </div>\n )}\n\n {nativeScrollbar ? renderWithNativeScrollbar() : renderWithCustomScrollbar()}\n\n {showFooter && footer && (\n <div\n onMouseEnter={resetHighlightedIndex}\n className={cn(styles.optionsListFooter, footerClassName, {\n [styles.withBorder]:\n visibleOptions &&\n flatOptions.length > visibleOptions &&\n !scrollBottom,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n );\n },\n);\n"],"names":["Optgroup","DefaultOptgroup"],"mappings":";;;;;;;;;;AAcA,MAAM,aAAa,GAAG,MAAK;IACvB,IAAI,KAAK,GAAG,CAAC;;AAGb,IAAA,OAAO,MAAM,KAAK,EAAE;AACxB,CAAC;AAEY,MAAA,WAAW,GAAG,UAAU,CACjC,CACI,EACI,IAAI,GAAG,EAAE,EACT,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,cAAc,EACd,gBAAgB,GAAG,EAAE,EACrB,OAAO,GAAG,EAAE,YACZA,UAAQ,GAAGC,QAAe,EAC1B,UAAU,EACV,gBAAgB,EAChB,cAAc,GAAG,uBAAuB,EACxC,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,MAAM,EACN,UAAU,GAAG,IAAI,EACjB,gBAAgB,EAChB,eAAe,EAAE,mBAAmB,EACpC,WAAW,GAAG,EAAE,EAChB,mBAAmB,EACnB,aAAa,EACb,MAAM,EACN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AAEd,CAAC;;;;"}
|
|
@@ -11,33 +11,33 @@
|
|
|
11
11
|
--gap-24: var(--gap-xl);
|
|
12
12
|
} :root {
|
|
13
13
|
--select-options-list-empty-placeholder-color: var(--color-light-text-secondary);
|
|
14
|
-
} .
|
|
14
|
+
} .select__optionsList_qcd3h {
|
|
15
15
|
width: 100%;
|
|
16
16
|
outline: none;
|
|
17
17
|
box-sizing: border-box;
|
|
18
18
|
position: relative;
|
|
19
|
-
} .
|
|
19
|
+
} .select__optionsListHeader_qcd3h {
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
border-bottom: 1px solid transparent;
|
|
22
22
|
transition: border-color 0.2s ease;
|
|
23
|
-
} .
|
|
23
|
+
} .select__optionsListHeader_qcd3h.select__headerHighlighted_qcd3h {
|
|
24
24
|
border-bottom-color: var(--color-light-neutral-300);
|
|
25
|
-
} .
|
|
25
|
+
} .select__optionsListFooter_qcd3h {
|
|
26
26
|
position: sticky;
|
|
27
27
|
bottom: var(--gap-0);
|
|
28
28
|
box-sizing: border-box;
|
|
29
29
|
border-top: 1px solid transparent;
|
|
30
30
|
transition: border-color 0.2s ease;
|
|
31
|
-
} .
|
|
31
|
+
} .select__optionsListFooter_qcd3h.select__withBorder_qcd3h {
|
|
32
32
|
border-top-color: var(--color-light-neutral-300);
|
|
33
|
-
} .
|
|
33
|
+
} .select__scrollable_qcd3h {
|
|
34
34
|
overflow: auto;
|
|
35
35
|
width: 100%;
|
|
36
|
-
} .
|
|
36
|
+
} .select__mask_qcd3h {
|
|
37
37
|
min-width: 4000px;
|
|
38
|
-
} .
|
|
38
|
+
} .select__emptyPlaceholder_qcd3h {
|
|
39
39
|
padding: var(--gap-16) var(--gap-12);
|
|
40
40
|
color: var(--select-options-list-empty-placeholder-color);
|
|
41
|
-
} .select__size-
|
|
41
|
+
} .select__size-72_qcd3h .select__emptyPlaceholder_qcd3h {
|
|
42
42
|
padding: var(--gap-24) var(--gap-16);
|
|
43
43
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"optionsList":"
|
|
3
|
+
const styles = {"optionsList":"select__optionsList_qcd3h","optionsListHeader":"select__optionsListHeader_qcd3h","headerHighlighted":"select__headerHighlighted_qcd3h","optionsListFooter":"select__optionsListFooter_qcd3h","withBorder":"select__withBorder_qcd3h","scrollable":"select__scrollable_qcd3h","mask":"select__mask_qcd3h","emptyPlaceholder":"select__emptyPlaceholder_qcd3h","size-72":"select__size-72_qcd3h"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Input } from '@alfalab/core-components-input/modern';
|
|
4
|
+
import { InputDesktop } from '@alfalab/core-components-input/modern/desktop';
|
|
5
|
+
import { InputMobile } from '@alfalab/core-components-input/modern/mobile';
|
|
4
6
|
import { MagnifierMIcon } from '@alfalab/icons-glyph/MagnifierMIcon';
|
|
5
7
|
import styles from './index.module.css.js';
|
|
6
8
|
|
|
7
|
-
const
|
|
9
|
+
const getComponent = (client) => {
|
|
10
|
+
switch (client) {
|
|
11
|
+
case 'desktop':
|
|
12
|
+
return InputDesktop;
|
|
13
|
+
case 'mobile':
|
|
14
|
+
return InputMobile;
|
|
15
|
+
default:
|
|
16
|
+
return Input;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const Search = forwardRef(({ clear = true, placeholder = 'Поиск', className, leftAddons = React.createElement(MagnifierMIcon, { color: '#86868A' }), ...restProps }, ref) => {
|
|
20
|
+
const { client } = restProps;
|
|
21
|
+
const Component = getComponent(client);
|
|
22
|
+
return (React.createElement(Component, { ref: ref, className: cn(styles.component, className), placeholder: placeholder, leftAddons: leftAddons, clear: clear, ...restProps }));
|
|
23
|
+
});
|
|
8
24
|
|
|
9
25
|
export { Search };
|
|
10
26
|
//# sourceMappingURL=Component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/search/Component.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { Input } from '@alfalab/core-components-input';\nimport { MagnifierMIcon } from '@alfalab/icons-glyph/MagnifierMIcon';\n\nimport { type SearchProps } from '../../typings';\n\nimport styles from './index.module.css';\n\nexport const Search = forwardRef<HTMLInputElement, SearchProps>(\n (\n {\n clear = true,\n placeholder = 'Поиск',\n className,\n leftAddons = <MagnifierMIcon color='#86868A' />,\n ...restProps\n },\n ref,\n ) => (\n <
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/components/search/Component.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport cn from 'classnames';\n\nimport { Input } from '@alfalab/core-components-input';\nimport { InputDesktop } from '@alfalab/core-components-input/desktop';\nimport { InputMobile } from '@alfalab/core-components-input/mobile';\nimport { MagnifierMIcon } from '@alfalab/icons-glyph/MagnifierMIcon';\n\nimport { type SearchProps } from '../../typings';\n\nimport styles from './index.module.css';\n\nconst getComponent = (client: SearchProps['client']) => {\n switch (client) {\n case 'desktop':\n return InputDesktop;\n case 'mobile':\n return InputMobile;\n default:\n return Input;\n }\n};\n\nexport const Search = forwardRef<HTMLInputElement, SearchProps>(\n (\n {\n clear = true,\n placeholder = 'Поиск',\n className,\n leftAddons = <MagnifierMIcon color='#86868A' />,\n ...restProps\n },\n ref,\n ) => {\n const { client } = restProps;\n\n const Component = getComponent(client);\n\n return (\n <Component\n ref={ref}\n className={cn(styles.component, className)}\n placeholder={placeholder}\n leftAddons={leftAddons}\n clear={clear}\n {...restProps}\n />\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;;AAYA,MAAM,YAAY,GAAG,CAAC,MAA6B,KAAI;AACnD,IAAA,QAAQ,MAAM;AACV,QAAA,KAAK,SAAS;AACV,YAAA,OAAO,YAAY;AACvB,QAAA,KAAK,QAAQ;AACT,YAAA,OAAO,WAAW;AACtB,QAAA;AACI,YAAA,OAAO,KAAK;AACnB;AACL,CAAC;AAEM,MAAM,MAAM,GAAG,UAAU,CAC5B,CACI,EACI,KAAK,GAAG,IAAI,EACZ,WAAW,GAAG,OAAO,EACrB,SAAS,EACT,UAAU,GAAG,KAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EAAC,KAAK,EAAC,SAAS,EAAG,CAAA,EAC/C,GAAG,SAAS,EACf,EACD,GAAG,KACH;AACA,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS;AAE5B,IAAA,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC;AAEtC,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACN,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,EAC1C,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EAAA,GACR,SAAS,EAAA,CACf;AAEV,CAAC;;;;"}
|