@alfalab/core-components-select 15.2.0 → 15.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Component-89f0cb07.d.ts +38 -0
- package/Component.mobile-ebda875c.d.ts +4 -4
- package/Component.mobile-f1f15074.d.ts +1 -1
- package/Component.mobile.js +2 -2
- package/Component.modal.mobile.js +2 -2
- package/Component.responsive.js +1 -1
- package/components/arrow/Component.js +1 -1
- package/components/arrow/index.css +3 -3
- package/components/base-checkmark/Component.js +1 -1
- package/components/base-checkmark/index.css +4 -4
- package/components/base-option/Component.js +1 -1
- package/components/base-option/index.css +13 -13
- package/components/base-select/Component.js +12 -5
- package/components/base-select/index.css +11 -11
- package/components/base-select-mobile/Component.js +13 -4
- package/components/base-select-mobile/footer/Component.js +1 -1
- package/components/base-select-mobile/footer/index.css +5 -5
- package/components/base-select-mobile/index.css +17 -18
- package/components/checkmark/Component.js +1 -1
- package/components/checkmark/index.css +10 -10
- package/components/checkmark-mobile/Component.js +1 -1
- package/components/checkmark-mobile/index.css +6 -6
- package/components/field/Component.js +1 -1
- package/components/field/index.css +12 -12
- package/components/optgroup/Component.js +1 -1
- package/components/optgroup/index.css +6 -6
- package/components/option/Component.js +1 -1
- package/components/option/index.css +20 -20
- package/components/options-list/Component.js +5 -4
- package/components/options-list/index.css +9 -9
- package/components/search/Component.js +1 -1
- package/components/search/index.css +2 -2
- package/components/virtual-options-list/Component.js +5 -4
- package/components/virtual-options-list/index.css +15 -15
- package/cssm/Component-89f0cb07.d.ts +38 -0
- package/cssm/Component.mobile-ebda875c.d.ts +4 -4
- package/cssm/Component.mobile.js +2 -2
- package/cssm/Component.modal.mobile.js +2 -2
- package/cssm/Component.responsive.js +1 -1
- package/cssm/components/base-select/Component.js +11 -4
- package/cssm/components/base-select-mobile/Component.js +12 -3
- package/cssm/components/base-select-mobile/index.module.css +1 -2
- package/cssm/components/options-list/Component.js +4 -3
- package/cssm/components/virtual-options-list/Component.js +4 -3
- package/cssm/desktop-69921c40.d.ts +6 -0
- package/{hook-45ab0a9c.js → cssm/hook-244c8d6e.js} +4 -1
- package/cssm/index-ebda875c.d.ts +1 -37
- package/cssm/index.js +1 -1
- package/cssm/mobile.js +1 -1
- package/cssm/presets/index.js +1 -1
- package/cssm/presets/useSelectWithApply/hook.js +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.js +1 -1
- package/cssm/shared.js +1 -1
- package/{esm/typings-9211a437.d.ts → cssm/typings-89f0cb07.d.ts} +5 -7
- package/cssm/typings.d.ts +4 -0
- package/desktop-69921c40.d.ts +6 -0
- package/esm/Component-89f0cb07.d.ts +38 -0
- package/esm/Component.mobile-ebda875c.d.ts +4 -4
- package/esm/Component.mobile.js +2 -2
- package/esm/Component.modal.mobile.js +2 -2
- package/esm/Component.responsive.js +1 -1
- package/esm/components/arrow/Component.js +1 -1
- package/esm/components/arrow/index.css +3 -3
- package/esm/components/base-checkmark/Component.js +1 -1
- package/esm/components/base-checkmark/index.css +4 -4
- package/esm/components/base-option/Component.js +1 -1
- package/esm/components/base-option/index.css +13 -13
- package/esm/components/base-select/Component.js +12 -5
- package/esm/components/base-select/index.css +11 -11
- package/esm/components/base-select-mobile/Component.js +13 -4
- package/esm/components/base-select-mobile/footer/Component.js +1 -1
- package/esm/components/base-select-mobile/footer/index.css +5 -5
- package/esm/components/base-select-mobile/index.css +17 -18
- package/esm/components/checkmark/Component.js +1 -1
- package/esm/components/checkmark/index.css +10 -10
- package/esm/components/checkmark-mobile/Component.js +1 -1
- package/esm/components/checkmark-mobile/index.css +6 -6
- package/esm/components/field/Component.js +1 -1
- package/esm/components/field/index.css +12 -12
- package/esm/components/optgroup/Component.js +1 -1
- package/esm/components/optgroup/index.css +6 -6
- package/esm/components/option/Component.js +1 -1
- package/esm/components/option/index.css +20 -20
- package/esm/components/options-list/Component.js +5 -4
- package/esm/components/options-list/index.css +9 -9
- package/esm/components/search/Component.js +1 -1
- package/esm/components/search/index.css +2 -2
- package/esm/components/virtual-options-list/Component.js +5 -4
- package/esm/components/virtual-options-list/index.css +15 -15
- package/esm/desktop-69921c40.d.ts +6 -0
- package/esm/{hook-3fd6d6d4.js → hook-571dca86.js} +4 -1
- package/esm/index-ebda875c.d.ts +1 -37
- package/esm/index.js +1 -1
- package/esm/mobile.js +1 -1
- package/esm/presets/index.js +1 -1
- package/esm/presets/useSelectWithApply/hook.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/Component.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.js +1 -1
- package/esm/presets/useSelectWithLoading/hook.js +1 -1
- package/esm/presets/useSelectWithLoading/index.css +2 -2
- package/esm/shared.js +1 -1
- package/{modern/typings-9211a437.d.ts → esm/typings-89f0cb07.d.ts} +5 -7
- package/esm/typings.d.ts +4 -0
- package/{cssm/hook-d1f5dd40.js → hook-a6f060a1.js} +4 -1
- package/index-ebda875c.d.ts +1 -37
- package/index.js +1 -1
- package/mobile.js +1 -1
- package/modern/Component-89f0cb07.d.ts +38 -0
- package/modern/Component.mobile-ebda875c.d.ts +4 -4
- package/modern/Component.mobile.js +2 -2
- package/modern/Component.modal.mobile.js +2 -2
- package/modern/Component.responsive.js +1 -1
- package/modern/components/arrow/Component.js +1 -1
- package/modern/components/arrow/index.css +3 -3
- package/modern/components/base-checkmark/Component.js +1 -1
- package/modern/components/base-checkmark/index.css +4 -4
- package/modern/components/base-option/Component.js +1 -1
- package/modern/components/base-option/index.css +13 -13
- package/modern/components/base-select/Component.js +9 -5
- package/modern/components/base-select/index.css +11 -11
- package/modern/components/base-select-mobile/Component.js +10 -4
- package/modern/components/base-select-mobile/footer/Component.js +1 -1
- package/modern/components/base-select-mobile/footer/index.css +5 -5
- package/modern/components/base-select-mobile/index.css +17 -18
- package/modern/components/checkmark/Component.js +1 -1
- package/modern/components/checkmark/index.css +10 -10
- package/modern/components/checkmark-mobile/Component.js +1 -1
- package/modern/components/checkmark-mobile/index.css +6 -6
- package/modern/components/field/Component.js +1 -1
- package/modern/components/field/index.css +12 -12
- package/modern/components/optgroup/Component.js +1 -1
- package/modern/components/optgroup/index.css +6 -6
- package/modern/components/option/Component.js +1 -1
- package/modern/components/option/index.css +20 -20
- package/modern/components/options-list/Component.js +5 -4
- package/modern/components/options-list/index.css +9 -9
- package/modern/components/search/Component.js +1 -1
- package/modern/components/search/index.css +2 -2
- package/modern/components/virtual-options-list/Component.js +5 -4
- package/modern/components/virtual-options-list/index.css +15 -15
- package/modern/desktop-69921c40.d.ts +6 -0
- package/modern/{hook-5dd83d48.js → hook-7e628eb4.js} +1 -1
- package/modern/index-ebda875c.d.ts +1 -37
- package/modern/index.js +1 -1
- package/modern/mobile.js +1 -1
- package/modern/presets/index.js +1 -1
- package/modern/presets/useSelectWithApply/hook.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/Component.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.js +1 -1
- package/modern/presets/useSelectWithLoading/hook.js +1 -1
- package/modern/presets/useSelectWithLoading/index.css +2 -2
- package/modern/shared.js +1 -1
- package/{typings-9211a437.d.ts → modern/typings-89f0cb07.d.ts} +5 -7
- package/modern/typings.d.ts +4 -0
- package/package.json +7 -7
- package/presets/index.js +1 -1
- package/presets/useSelectWithApply/hook.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/Component.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/index.js +1 -1
- package/presets/useSelectWithLoading/hook.js +1 -1
- package/presets/useSelectWithLoading/index.css +2 -2
- package/shared.js +1 -1
- package/src/Component.mobile.tsx +2 -0
- package/src/Component.modal.mobile.tsx +2 -0
- package/src/components/base-select/Component.tsx +12 -2
- package/src/components/base-select-mobile/Component.tsx +16 -3
- package/src/components/base-select-mobile/index.module.css +1 -1
- package/src/components/options-list/Component.tsx +9 -1
- package/src/components/virtual-options-list/Component.tsx +12 -1
- package/src/presets/useSelectWithApply/options-list-with-apply/Component.tsx +1 -1
- package/src/typings.ts +5 -0
- package/{cssm/typings-9211a437.d.ts → typings-89f0cb07.d.ts} +5 -7
- package/typings.d.ts +4 -0
- package/cssm/desktop-63dec22f.d.ts +0 -6
- package/desktop-63dec22f.d.ts +0 -6
- package/esm/desktop-63dec22f.d.ts +0 -6
- package/modern/desktop-63dec22f.d.ts +0 -6
- /package/cssm/{hook-d1f5dd40.d.ts → hook-244c8d6e.d.ts} +0 -0
- /package/esm/{hook-3fd6d6d4.d.ts → hook-571dca86.d.ts} +0 -0
- /package/{hook-45ab0a9c.d.ts → hook-a6f060a1.d.ts} +0 -0
- /package/modern/{hook-5dd83d48.d.ts → hook-7e628eb4.d.ts} +0 -0
|
@@ -191,7 +191,11 @@ var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
|
191
191
|
};
|
|
192
192
|
var handleFieldKeyDown = function (event) {
|
|
193
193
|
inputProps.onKeyDown(event);
|
|
194
|
-
|
|
194
|
+
// https://caniuse.com/?search=KeyboardEvent.key
|
|
195
|
+
var isKeyUnsupported = event.key === 'Unidentified';
|
|
196
|
+
if (autocomplete &&
|
|
197
|
+
!open &&
|
|
198
|
+
(isKeyUnsupported || event.key.length === 1 || event.key === 'Backspace')) {
|
|
195
199
|
// Для автокомплита - открываем меню при начале ввода
|
|
196
200
|
openMenu();
|
|
197
201
|
}
|
|
@@ -214,7 +218,10 @@ var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
|
214
218
|
}
|
|
215
219
|
};
|
|
216
220
|
var getOptionProps = function (option, index) {
|
|
217
|
-
var selectedItem = selectedItems.
|
|
221
|
+
var selectedItem = selectedItems.some(function (_a) {
|
|
222
|
+
var key = _a.key;
|
|
223
|
+
return key === option.key;
|
|
224
|
+
});
|
|
218
225
|
return tslib.__assign(tslib.__assign({}, optionProps), { mobile: true, className: cn__default.default(styles__default.default.option, optionClassName), innerProps: getItemProps({
|
|
219
226
|
index: index,
|
|
220
227
|
item: option,
|
|
@@ -286,7 +293,9 @@ var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
|
286
293
|
scrollableContainerRef,
|
|
287
294
|
modalProps === null || modalProps === void 0 ? void 0 : modalProps.ref,
|
|
288
295
|
]) }),
|
|
289
|
-
React__default.default.createElement(mobile.ModalMobile.Header, tslib.__assign({ hasCloser: true, sticky: true
|
|
296
|
+
React__default.default.createElement(mobile.ModalMobile.Header, tslib.__assign({ hasCloser: true, sticky: true }, modalHeaderProps, { bottomAddons: React__default.default.createElement(React__default.default.Fragment, null,
|
|
297
|
+
renderSearch(), modalHeaderProps === null || modalHeaderProps === void 0 ? void 0 :
|
|
298
|
+
modalHeaderProps.bottomAddons) }), label || placeholder),
|
|
290
299
|
React__default.default.createElement(mobile.ModalMobile.Content, { flex: true, className: styles__default.default.modalContent }, renderOptionsList()),
|
|
291
300
|
(modalFooterProps === null || modalFooterProps === void 0 ? void 0 : modalFooterProps.children) && React__default.default.createElement(mobile.ModalMobile.Footer, tslib.__assign({}, modalFooterProps))))));
|
|
292
301
|
});
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
} :root {
|
|
14
14
|
--gap-2xs: 4px;
|
|
15
15
|
--gap-xs: 8px;
|
|
16
|
-
--gap-s: 12px;
|
|
17
16
|
--gap-m: 16px;
|
|
18
17
|
--gap-l: 20px;
|
|
19
18
|
} :root {
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
} .emptySearchPlaceholder {
|
|
56
55
|
text-align: center;
|
|
57
56
|
} .search {
|
|
58
|
-
padding: var(--gap-
|
|
57
|
+
padding: var(--gap-xs);
|
|
59
58
|
} /* width: max-content; fix for IE */ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
60
59
|
.component {
|
|
61
60
|
float: left;
|
|
@@ -28,7 +28,7 @@ var createCounter = function () {
|
|
|
28
28
|
};
|
|
29
29
|
var OptionsList = React.forwardRef(function (_a, ref) {
|
|
30
30
|
var _b;
|
|
31
|
-
var _c = _a.size, size = _c === void 0 ? 's' : _c, className = _a.className, optionGroupClassName = _a.optionGroupClassName, scrollbarClassName = _a.scrollbarClassName, Option = _a.Option, getOptionProps = _a.getOptionProps, _d = _a.options, options = _d === void 0 ? [] : _d, _e = _a.Optgroup, Optgroup = _e === void 0 ? components_optgroup_Component.Optgroup : _e, dataTestId = _a.dataTestId, emptyPlaceholder = _a.emptyPlaceholder, _f = _a.visibleOptions, visibleOptions = _f === void 0 ? consts.DEFAULT_VISIBLE_OPTIONS : _f, onScroll = _a.onScroll, open = _a.open, header = _a.header, footer = _a.footer, _g = _a.showFooter, showFooter = _g === void 0 ? true : _g, optionsListWidth = _a.optionsListWidth, nativeScrollbarProp = _a.nativeScrollbar, _h = _a.flatOptions, flatOptions = _h === void 0 ? [] : _h;
|
|
31
|
+
var _c = _a.size, size = _c === void 0 ? 's' : _c, className = _a.className, optionGroupClassName = _a.optionGroupClassName, scrollbarClassName = _a.scrollbarClassName, Option = _a.Option, getOptionProps = _a.getOptionProps, _d = _a.options, options = _d === void 0 ? [] : _d, _e = _a.Optgroup, Optgroup = _e === void 0 ? components_optgroup_Component.Optgroup : _e, dataTestId = _a.dataTestId, emptyPlaceholder = _a.emptyPlaceholder, _f = _a.visibleOptions, visibleOptions = _f === void 0 ? consts.DEFAULT_VISIBLE_OPTIONS : _f, onScroll = _a.onScroll, open = _a.open, header = _a.header, footer = _a.footer, _g = _a.showFooter, showFooter = _g === void 0 ? true : _g, optionsListWidth = _a.optionsListWidth, nativeScrollbarProp = _a.nativeScrollbar, _h = _a.flatOptions, flatOptions = _h === void 0 ? [] : _h, setHighlightedIndex = _a.setHighlightedIndex;
|
|
32
32
|
var nativeScrollbar = hooks.useMedia([[true, '(max-width: 1023px)']], false)[0];
|
|
33
33
|
nativeScrollbar = Boolean(nativeScrollbarProp !== null && nativeScrollbarProp !== void 0 ? nativeScrollbarProp : nativeScrollbar);
|
|
34
34
|
var renderOption = function (option, index) { return (React__default.default.createElement(Option, tslib.__assign({ key: option.key }, getOptionProps(option, index)))); };
|
|
@@ -54,10 +54,11 @@ var OptionsList = React.forwardRef(function (_a, ref) {
|
|
|
54
54
|
return (React__default.default.createElement(coreComponentsScrollbar.Scrollbar, { className: cn__default.default(styles__default.default.scrollable, scrollbarClassName), ref: scrollbarRef, horizontalAutoStretch: optionsListWidth === 'content', scrollableNodeProps: scrollableNodeProps, contentNodeProps: { ref: listRef } }, renderListItems()));
|
|
55
55
|
};
|
|
56
56
|
var renderWithNativeScrollbar = function () { return (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.scrollable, scrollbarClassName), ref: mergeRefs__default.default([listRef, ref]), onScroll: onScroll }, renderListItems())); };
|
|
57
|
+
var resetHighlightedIndex = function () { return setHighlightedIndex === null || setHighlightedIndex === void 0 ? void 0 : setHighlightedIndex(-1); };
|
|
57
58
|
return (React__default.default.createElement("div", tslib.__assign({}, (nativeScrollbar && { 'data-test-id': dataTestId }), { className: cn__default.default(styles__default.default.optionsList, styles__default.default[size], className) }),
|
|
58
|
-
header && React__default.default.createElement("div", { className: styles__default.default.optionsListHeader }, header),
|
|
59
|
+
header && (React__default.default.createElement("div", { className: styles__default.default.optionsListHeader, onMouseEnter: resetHighlightedIndex }, header)),
|
|
59
60
|
nativeScrollbar ? renderWithNativeScrollbar() : renderWithCustomScrollbar(),
|
|
60
|
-
showFooter && footer && (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.optionsListFooter, (_b = {},
|
|
61
|
+
showFooter && footer && (React__default.default.createElement("div", { onMouseEnter: resetHighlightedIndex, className: cn__default.default(styles__default.default.optionsListFooter, (_b = {},
|
|
61
62
|
_b[styles__default.default.withBorder] = visibleOptions && flatOptions.length > visibleOptions,
|
|
62
63
|
_b)) }, footer))));
|
|
63
64
|
});
|
|
@@ -24,7 +24,7 @@ var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
|
24
24
|
|
|
25
25
|
var VirtualOptionsList = React.forwardRef(function (_a, ref) {
|
|
26
26
|
var _b;
|
|
27
|
-
var _c = _a.size, size = _c === void 0 ? 's' : _c, _d = _a.flatOptions, flatOptions = _d === void 0 ? [] : _d, _e = _a.highlightedIndex, highlightedIndex = _e === void 0 ? -1 : _e, className = _a.className, getOptionProps = _a.getOptionProps, Option = _a.Option, open = _a.open, _f = _a.options, options = _f === void 0 ? [] : _f, _g = _a.Optgroup, Optgroup = _g === void 0 ? components_optgroup_Component.Optgroup : _g, dataTestId = _a.dataTestId, emptyPlaceholder = _a.emptyPlaceholder, _h = _a.visibleOptions, visibleOptions = _h === void 0 ? consts.DEFAULT_VISIBLE_OPTIONS : _h, header = _a.header, footer = _a.footer, _j = _a.showFooter, showFooter = _j === void 0 ? true : _j, optionsListWidth = _a.optionsListWidth, onScroll = _a.onScroll, nativeScrollbarProp = _a.nativeScrollbar;
|
|
27
|
+
var _c = _a.size, size = _c === void 0 ? 's' : _c, _d = _a.flatOptions, flatOptions = _d === void 0 ? [] : _d, _e = _a.highlightedIndex, highlightedIndex = _e === void 0 ? -1 : _e, className = _a.className, getOptionProps = _a.getOptionProps, Option = _a.Option, open = _a.open, _f = _a.options, options = _f === void 0 ? [] : _f, _g = _a.Optgroup, Optgroup = _g === void 0 ? components_optgroup_Component.Optgroup : _g, dataTestId = _a.dataTestId, emptyPlaceholder = _a.emptyPlaceholder, _h = _a.visibleOptions, visibleOptions = _h === void 0 ? consts.DEFAULT_VISIBLE_OPTIONS : _h, header = _a.header, footer = _a.footer, _j = _a.showFooter, showFooter = _j === void 0 ? true : _j, optionsListWidth = _a.optionsListWidth, onScroll = _a.onScroll, nativeScrollbarProp = _a.nativeScrollbar, setHighlightedIndex = _a.setHighlightedIndex;
|
|
28
28
|
var listRef = React.useRef(null);
|
|
29
29
|
var parentRef = React.useRef(null);
|
|
30
30
|
var scrollbarRef = React.useRef(null);
|
|
@@ -125,14 +125,15 @@ var VirtualOptionsList = React.forwardRef(function (_a, ref) {
|
|
|
125
125
|
}
|
|
126
126
|
return React__default.default.createElement("div", tslib.__assign({}, contentNodeProps), renderList());
|
|
127
127
|
};
|
|
128
|
+
var resetHighlightedIndex = function () { return setHighlightedIndex === null || setHighlightedIndex === void 0 ? void 0 : setHighlightedIndex(-1); };
|
|
128
129
|
if (options.length === 0 && !emptyPlaceholder) {
|
|
129
130
|
return null;
|
|
130
131
|
}
|
|
131
132
|
return (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.virtualOptionsList, styles__default.default[size], className), "data-test-id": dataTestId },
|
|
132
|
-
header && React__default.default.createElement("div", { className: styles__default.default.virtualOptionsListHeader }, header),
|
|
133
|
+
header && (React__default.default.createElement("div", { className: styles__default.default.virtualOptionsListHeader, onMouseEnter: resetHighlightedIndex }, header)),
|
|
133
134
|
nativeScrollbar ? renderWithNativeScrollbar() : renderWithCustomScrollbar(),
|
|
134
135
|
emptyPlaceholder && options.length === 0 && (React__default.default.createElement("div", { className: styles__default.default.emptyPlaceholder }, emptyPlaceholder)),
|
|
135
|
-
showFooter && footer && (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.virtualOptionsListFooter, (_b = {},
|
|
136
|
+
showFooter && footer && (React__default.default.createElement("div", { onMouseEnter: resetHighlightedIndex, className: cn__default.default(styles__default.default.virtualOptionsListFooter, (_b = {},
|
|
136
137
|
_b[styles__default.default.withBorder] = visibleOptions && flatOptions.length > visibleOptions,
|
|
137
138
|
_b)) }, footer))));
|
|
138
139
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CommonButtonProps } from "./typings-89f0cb07";
|
|
4
|
+
declare const ButtonDesktop: React.ForwardRefExoticComponent<CommonButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
5
|
+
export { ButtonDesktop };
|
|
6
|
+
export type { CommonButtonProps as ButtonDesktopProps } from "./typings-89f0cb07";
|
|
@@ -18,7 +18,10 @@ var OptionsListWithApply = React.forwardRef(function (_a, ref) {
|
|
|
18
18
|
var optionProps = defaultGetOptionProps(option, index);
|
|
19
19
|
var selected = option.key === SELECT_ALL_KEY
|
|
20
20
|
? selectedDraft.length === flatOptions.length - 1
|
|
21
|
-
: selectedDraft.
|
|
21
|
+
: selectedDraft.some(function (_a) {
|
|
22
|
+
var key = _a.key;
|
|
23
|
+
return key === option.key;
|
|
24
|
+
});
|
|
22
25
|
return tslib.__assign(tslib.__assign({}, optionProps), { selected: selected });
|
|
23
26
|
}, [defaultGetOptionProps, flatOptions.length, selectedDraft]);
|
|
24
27
|
var handleApply = React.useCallback(function () {
|
package/cssm/index-ebda875c.d.ts
CHANGED
|
@@ -1,38 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
import { FC } from "react";
|
|
4
|
-
import { BaseButtonProps } from "./typings-9211a437";
|
|
5
|
-
/**
|
|
6
|
-
* Минимальное время отображения лоадера - 500мс,
|
|
7
|
-
* чтобы при быстрых ответах от сервера кнопка не «моргала».
|
|
8
|
-
*/
|
|
9
|
-
declare const LOADER_MIN_DISPLAY_INTERVAL = 500;
|
|
10
|
-
declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
11
|
-
type SpinnerProps = {
|
|
12
|
-
/**
|
|
13
|
-
* Управление видимостью компонента
|
|
14
|
-
*/
|
|
15
|
-
visible?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Размер компонента
|
|
18
|
-
*/
|
|
19
|
-
size?: "xs" | "s" | "m";
|
|
20
|
-
/**
|
|
21
|
-
* Дополнительный класс
|
|
22
|
-
*/
|
|
23
|
-
className?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Идентификатор компонента в DOM
|
|
26
|
-
*/
|
|
27
|
-
id?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Идентификатор для систем автоматизированного тестирования
|
|
30
|
-
*/
|
|
31
|
-
dataTestId?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Палитра, в контексте которой используется спиннер
|
|
34
|
-
*/
|
|
35
|
-
colors?: "default" | "inverted";
|
|
36
|
-
};
|
|
37
|
-
declare const Spinner: FC<SpinnerProps>;
|
|
38
|
-
export { LOADER_MIN_DISPLAY_INTERVAL, BaseButton, SpinnerProps, Spinner };
|
|
2
|
+
export * from "./Component-89f0cb07";
|
package/cssm/index.js
CHANGED
|
@@ -56,7 +56,7 @@ require('./components/base-select-mobile/footer/index.module.css');
|
|
|
56
56
|
require('./components/virtual-options-list/Component.js');
|
|
57
57
|
require('react-virtual');
|
|
58
58
|
require('./components/virtual-options-list/index.module.css');
|
|
59
|
-
require('./hook-
|
|
59
|
+
require('./hook-244c8d6e.js');
|
|
60
60
|
require('./presets/useSelectWithApply/options-list-with-apply/footer/Component.js');
|
|
61
61
|
require('@alfalab/core-components-button/cssm/desktop');
|
|
62
62
|
require('./presets/useSelectWithApply/options-list-with-apply/footer/index.module.css');
|
package/cssm/mobile.js
CHANGED
|
@@ -49,7 +49,7 @@ require('./components/base-select-mobile/footer/index.module.css');
|
|
|
49
49
|
require('./components/virtual-options-list/Component.js');
|
|
50
50
|
require('react-virtual');
|
|
51
51
|
require('./components/virtual-options-list/index.module.css');
|
|
52
|
-
require('./hook-
|
|
52
|
+
require('./hook-244c8d6e.js');
|
|
53
53
|
require('./presets/useSelectWithApply/options-list-with-apply/footer/Component.js');
|
|
54
54
|
require('@alfalab/core-components-button/cssm/desktop');
|
|
55
55
|
require('./presets/useSelectWithApply/options-list-with-apply/footer/index.module.css');
|
package/cssm/presets/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var presets_useSelectWithLoading_hook = require('./useSelectWithLoading/hook.js');
|
|
6
6
|
var presets_useLazyLoading_hook = require('./useLazyLoading/hook.js');
|
|
7
|
-
var presets_useSelectWithApply_optionsListWithApply_Component = require('../hook-
|
|
7
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('../hook-244c8d6e.js');
|
|
8
8
|
require('tslib');
|
|
9
9
|
require('react');
|
|
10
10
|
require('@alfalab/core-components-skeleton/cssm');
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
require('tslib');
|
|
6
6
|
require('react');
|
|
7
7
|
require('../../utils.js');
|
|
8
|
-
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../hook-
|
|
8
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../hook-244c8d6e.js');
|
|
9
9
|
require('../../components/options-list/Component.js');
|
|
10
10
|
require('react-merge-refs');
|
|
11
11
|
require('classnames');
|
|
@@ -6,7 +6,7 @@ require('tslib');
|
|
|
6
6
|
require('react');
|
|
7
7
|
require('../../../components/options-list/Component.js');
|
|
8
8
|
require('../../../consts.js');
|
|
9
|
-
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../../hook-
|
|
9
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../../hook-244c8d6e.js');
|
|
10
10
|
require('./footer/Component.js');
|
|
11
11
|
require('./header/Component.js');
|
|
12
12
|
require('react-merge-refs');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "../../../hook-
|
|
1
|
+
export * from "../../../hook-244c8d6e";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../../hook-
|
|
5
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('../../../hook-244c8d6e.js');
|
|
6
6
|
require('tslib');
|
|
7
7
|
require('react');
|
|
8
8
|
require('../../../utils.js');
|
package/cssm/shared.js
CHANGED
|
@@ -13,7 +13,7 @@ var components_baseOption_Component = require('./components/base-option/Componen
|
|
|
13
13
|
var components_search_Component = require('./components/search/Component.js');
|
|
14
14
|
var presets_useSelectWithLoading_hook = require('./presets/useSelectWithLoading/hook.js');
|
|
15
15
|
var presets_useLazyLoading_hook = require('./presets/useLazyLoading/hook.js');
|
|
16
|
-
var presets_useSelectWithApply_optionsListWithApply_Component = require('./hook-
|
|
16
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('./hook-244c8d6e.js');
|
|
17
17
|
var utils = require('./utils.js');
|
|
18
18
|
require('react');
|
|
19
19
|
require('classnames');
|
|
@@ -69,6 +69,8 @@ type ComponentProps = {
|
|
|
69
69
|
* Дочерние элементы.
|
|
70
70
|
*/
|
|
71
71
|
children?: ReactNode;
|
|
72
|
+
};
|
|
73
|
+
type PrivateButtonProps = {
|
|
72
74
|
/**
|
|
73
75
|
* Основные стили компонента.
|
|
74
76
|
*/
|
|
@@ -80,16 +82,12 @@ type ComponentProps = {
|
|
|
80
82
|
*/
|
|
81
83
|
colorStylesMap: StyleColors;
|
|
82
84
|
};
|
|
83
|
-
type
|
|
84
|
-
type
|
|
85
|
-
type BaseButtonProps = Partial<AnchorBaseButtonProps | NativeBaseButtonProps>;
|
|
86
|
-
type AnchorButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
87
|
-
type NativeButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
88
|
-
type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps> & {
|
|
85
|
+
type CommonButtonProps = ComponentProps & Partial<AnchorHTMLAttributes<HTMLAnchorElement> | ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
86
|
+
type ButtonProps = CommonButtonProps & {
|
|
89
87
|
/**
|
|
90
88
|
* Контрольная точка, с нее начинается desktop версия
|
|
91
89
|
* @default 1024
|
|
92
90
|
*/
|
|
93
91
|
breakpoint?: number;
|
|
94
92
|
};
|
|
95
|
-
export { StyleColors, ComponentProps,
|
|
93
|
+
export { StyleColors, ComponentProps, PrivateButtonProps, CommonButtonProps, ButtonProps };
|
package/cssm/typings.d.ts
CHANGED
|
@@ -459,6 +459,10 @@ type OptionsListProps = {
|
|
|
459
459
|
* Обработчик отмены изменений
|
|
460
460
|
*/
|
|
461
461
|
onClear?: () => void;
|
|
462
|
+
/**
|
|
463
|
+
* Указать индекс пункта для hover состояния
|
|
464
|
+
*/
|
|
465
|
+
setHighlightedIndex?: (index: number) => void;
|
|
462
466
|
};
|
|
463
467
|
type OptgroupProps = {
|
|
464
468
|
/**
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CommonButtonProps } from "./typings-89f0cb07";
|
|
4
|
+
declare const ButtonDesktop: React.ForwardRefExoticComponent<CommonButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
5
|
+
export { ButtonDesktop };
|
|
6
|
+
export type { CommonButtonProps as ButtonDesktopProps } from "./typings-89f0cb07";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
import { CommonButtonProps, PrivateButtonProps } from "./typings-89f0cb07";
|
|
5
|
+
type SpinnerProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Управление видимостью компонента
|
|
8
|
+
*/
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Размер компонента
|
|
12
|
+
*/
|
|
13
|
+
size?: "xs" | "s" | "m";
|
|
14
|
+
/**
|
|
15
|
+
* Дополнительный класс
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Идентификатор компонента в DOM
|
|
20
|
+
*/
|
|
21
|
+
id?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
24
|
+
*/
|
|
25
|
+
dataTestId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Палитра, в контексте которой используется спиннер
|
|
28
|
+
*/
|
|
29
|
+
colors?: "default" | "inverted";
|
|
30
|
+
};
|
|
31
|
+
declare const Spinner: FC<SpinnerProps>;
|
|
32
|
+
/**
|
|
33
|
+
* Минимальное время отображения лоадера - 500мс,
|
|
34
|
+
* чтобы при быстрых ответах от сервера кнопка не «моргала».
|
|
35
|
+
*/
|
|
36
|
+
declare const LOADER_MIN_DISPLAY_INTERVAL = 500;
|
|
37
|
+
declare const BaseButton: React.ForwardRefExoticComponent<(CommonButtonProps & PrivateButtonProps) & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
38
|
+
export { SpinnerProps, Spinner, LOADER_MIN_DISPLAY_INTERVAL, BaseButton };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
type
|
|
5
|
-
declare const
|
|
6
|
-
export {
|
|
3
|
+
import { BaseFormControlProps } from "./index-ebda875c";
|
|
4
|
+
type FormControlMobileProps = Omit<BaseFormControlProps, 'styles' | 'colorStyles'>;
|
|
5
|
+
declare const FormControlMobile: React.ForwardRefExoticComponent<FormControlMobileProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { FormControlMobileProps, FormControlMobile };
|
package/esm/Component.mobile.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Option } from './components/option/Component.js';
|
|
|
10
10
|
import { OptionsList } from './components/options-list/Component.js';
|
|
11
11
|
import { Search } from './components/search/Component.js';
|
|
12
12
|
import { VirtualOptionsList } from './components/virtual-options-list/Component.js';
|
|
13
|
-
import { u as useSelectWithApply } from './hook-
|
|
13
|
+
import { u as useSelectWithApply } from './hook-571dca86.js';
|
|
14
14
|
import { Header } from './presets/useSelectWithApply/options-list-with-apply/header/Component.js';
|
|
15
15
|
import 'classnames';
|
|
16
16
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
@@ -53,7 +53,7 @@ var SelectMobile = forwardRef(function (_a, ref) {
|
|
|
53
53
|
showClear: showClear,
|
|
54
54
|
showSelectAll: showSelectAll,
|
|
55
55
|
});
|
|
56
|
-
return (React.createElement(BaseSelectMobile, __assign({ ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: __assign({ FormControlComponent: FormControlMobile }, fieldProps), optionProps: optionProps, Arrow: Arrow$1, Field: Field$1, Optgroup: Optgroup$1, Option: Option$1, Search: Search$1, isBottomSheet: true, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList$1, bottomSheetProps: __assign({ bottomAddons: useWithApplyHook && showHeaderWithSelectAll && (React.createElement(Header, __assign({}, applyProps.optionsListProps.headerProps, { mobile: true }))) }, bottomSheetProps), optionsListProps: optionsListProps }, restProps, (useWithApplyHook && applyProps))));
|
|
56
|
+
return (React.createElement(BaseSelectMobile, __assign({ ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: __assign({ FormControlComponent: FormControlMobile }, fieldProps), optionProps: optionProps, Arrow: Arrow$1, Field: Field$1, Optgroup: Optgroup$1, Option: Option$1, Search: Search$1, isBottomSheet: true, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList$1, showSearch: showSearch, searchProps: searchProps, bottomSheetProps: __assign({ bottomAddons: useWithApplyHook && showHeaderWithSelectAll && (React.createElement(Header, __assign({}, applyProps.optionsListProps.headerProps, { mobile: true }))) }, bottomSheetProps), optionsListProps: optionsListProps }, restProps, (useWithApplyHook && applyProps))));
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
export { SelectMobile };
|
|
@@ -9,7 +9,7 @@ import { Optgroup } from './components/optgroup/Component.js';
|
|
|
9
9
|
import { Option } from './components/option/Component.js';
|
|
10
10
|
import { OptionsList } from './components/options-list/Component.js';
|
|
11
11
|
import { VirtualOptionsList } from './components/virtual-options-list/Component.js';
|
|
12
|
-
import { u as useSelectWithApply } from './hook-
|
|
12
|
+
import { u as useSelectWithApply } from './hook-571dca86.js';
|
|
13
13
|
import { Header } from './presets/useSelectWithApply/options-list-with-apply/header/Component.js';
|
|
14
14
|
import 'classnames';
|
|
15
15
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
@@ -53,7 +53,7 @@ var SelectModalMobile = forwardRef(function (_a, ref) {
|
|
|
53
53
|
showClear: showClear,
|
|
54
54
|
showSelectAll: showSelectAll,
|
|
55
55
|
});
|
|
56
|
-
return (React.createElement(BaseSelectMobile, __assign({ ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: __assign({ FormControlComponent: FormControlMobile }, fieldProps), optionProps: optionProps, Arrow: Arrow$1, Field: Field$1, Optgroup: Optgroup$1, Option: Option$1, isBottomSheet: false, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList$1, optionsListProps: optionsListProps, modalHeaderProps: __assign({ bottomAddons: useWithApplyHook && showHeaderWithSelectAll && (React.createElement(Header, __assign({}, applyProps.optionsListProps.headerProps, { mobile: true }))) }, modalHeaderProps) }, restProps, (useWithApplyHook && applyProps))));
|
|
56
|
+
return (React.createElement(BaseSelectMobile, __assign({ ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: __assign({ FormControlComponent: FormControlMobile }, fieldProps), optionProps: optionProps, Arrow: Arrow$1, Field: Field$1, Optgroup: Optgroup$1, Option: Option$1, isBottomSheet: false, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList$1, optionsListProps: optionsListProps, showSearch: showSearch, searchProps: searchProps, modalHeaderProps: __assign({ bottomAddons: useWithApplyHook && showHeaderWithSelectAll && (React.createElement(Header, __assign({}, applyProps.optionsListProps.headerProps, { mobile: true }))) }, modalHeaderProps) }, restProps, (useWithApplyHook && applyProps))));
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
export { SelectModalMobile };
|
|
@@ -39,7 +39,7 @@ import '@alfalab/core-components-base-modal/esm';
|
|
|
39
39
|
import '@alfalab/core-components-button/esm/mobile';
|
|
40
40
|
import './components/virtual-options-list/Component.js';
|
|
41
41
|
import 'react-virtual';
|
|
42
|
-
import './hook-
|
|
42
|
+
import './hook-571dca86.js';
|
|
43
43
|
import './presets/useSelectWithApply/options-list-with-apply/footer/Component.js';
|
|
44
44
|
import '@alfalab/core-components-button/esm/desktop';
|
|
45
45
|
import './presets/useSelectWithApply/options-list-with-apply/header/Component.js';
|
|
@@ -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_yw1vz","open":"select__open_yw1vz"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
var Arrow = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 5xl7a */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-primary: #0e0e0e; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
/* checkmark */
|
|
27
27
|
|
|
28
28
|
/* optgroup */
|
|
29
|
-
} .
|
|
29
|
+
} .select__arrow_yw1vz {
|
|
30
30
|
display: block;
|
|
31
31
|
width: 24px;
|
|
32
32
|
height: 24px;
|
|
33
33
|
color: var(--select-arrow-color);
|
|
34
34
|
|
|
35
35
|
transition: transform 0.15s ease-in-out, opacity 0.2s ease;
|
|
36
|
-
} .
|
|
36
|
+
} .select__open_yw1vz {
|
|
37
37
|
transform: var(--arrow-transform);
|
|
38
38
|
}
|
|
@@ -3,7 +3,7 @@ import cn from 'classnames';
|
|
|
3
3
|
import { Checkbox } from '@alfalab/core-components-checkbox/esm';
|
|
4
4
|
import { CheckmarkMIcon } from '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
5
5
|
|
|
6
|
-
var styles = {"checkmark":"
|
|
6
|
+
var styles = {"checkmark":"select__checkmark_ld7ul","single":"select__single_ld7ul","selected":"select__selected_ld7ul"};
|
|
7
7
|
require('./index.css')
|
|
8
8
|
|
|
9
9
|
var BaseCheckmark = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 31spa */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
/* checkmark */
|
|
24
24
|
|
|
25
25
|
/* optgroup */
|
|
26
|
-
} .
|
|
26
|
+
} .select__checkmark_ld7ul {
|
|
27
27
|
flex-shrink: 0;
|
|
28
28
|
box-sizing: border-box;
|
|
29
|
-
} .
|
|
29
|
+
} .select__single_ld7ul {
|
|
30
30
|
display: flex;
|
|
31
31
|
align-items: center;
|
|
32
32
|
justify-content: center;
|
|
33
33
|
opacity: 0
|
|
34
|
-
} .
|
|
34
|
+
} .select__single_ld7ul.select__selected_ld7ul {
|
|
35
35
|
opacity: 1;
|
|
36
36
|
}
|
|
@@ -5,7 +5,7 @@ import { BaseCheckmark } from '../base-checkmark/Component.js';
|
|
|
5
5
|
import '@alfalab/core-components-checkbox/esm';
|
|
6
6
|
import '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
7
7
|
|
|
8
|
-
var styles = {"option":"
|
|
8
|
+
var styles = {"option":"select__option_1c4es","disabled":"select__disabled_1c4es","checkmarkBefore":"select__checkmarkBefore_1c4es","mobile":"select__mobile_1c4es","checkmarkAfter":"select__checkmarkAfter_1c4es","textContent":"select__textContent_1c4es","selected":"select__selected_1c4es","highlighted":"select__highlighted_1c4es","content":"select__content_1c4es"};
|
|
9
9
|
require('./index.css')
|
|
10
10
|
|
|
11
11
|
var BaseOption = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: iw1nm */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-bg-primary: #fff;
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
/* checkmark */
|
|
44
44
|
|
|
45
45
|
/* optgroup */
|
|
46
|
-
} .
|
|
46
|
+
} .select__option_1c4es {
|
|
47
47
|
font-size: 16px;
|
|
48
48
|
line-height: 20px;
|
|
49
49
|
font-weight: 400;
|
|
@@ -60,32 +60,32 @@
|
|
|
60
60
|
position: relative;
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
min-height: var(--size-s-height)
|
|
63
|
-
} .
|
|
63
|
+
} .select__option_1c4es:not(.select__disabled_1c4es):active {
|
|
64
64
|
background: var(--select-option-active-background);
|
|
65
65
|
color: var(--select-option-active-color);
|
|
66
|
-
} .
|
|
66
|
+
} .select__option_1c4es.select__checkmarkBefore_1c4es {
|
|
67
67
|
padding: 0 0 0 var(--gap-s)
|
|
68
|
-
} .
|
|
68
|
+
} .select__option_1c4es.select__checkmarkBefore_1c4es.select__mobile_1c4es {
|
|
69
69
|
padding-left: var(--gap-m);
|
|
70
|
-
} .
|
|
70
|
+
} .select__option_1c4es.select__checkmarkAfter_1c4es {
|
|
71
71
|
padding: 0 var(--gap-s) 0 0
|
|
72
|
-
} .
|
|
72
|
+
} .select__option_1c4es.select__checkmarkAfter_1c4es.select__mobile_1c4es {
|
|
73
73
|
padding-right: var(--gap-l);
|
|
74
|
-
} .
|
|
74
|
+
} .select__option_1c4es.select__textContent_1c4es {
|
|
75
75
|
padding: var(--gap-s)
|
|
76
|
-
} .
|
|
76
|
+
} .select__option_1c4es.select__textContent_1c4es.select__mobile_1c4es {
|
|
77
77
|
padding: var(--gap-m) var(--gap-l) var(--gap-m) var(--gap-m);
|
|
78
|
-
} .
|
|
78
|
+
} .select__selected_1c4es {
|
|
79
79
|
background: var(--select-option-selected-background);
|
|
80
80
|
color: var(--select-option-selected-color);
|
|
81
81
|
cursor: default;
|
|
82
|
-
} .
|
|
82
|
+
} .select__highlighted_1c4es {
|
|
83
83
|
background: var(--select-option-hover-background);
|
|
84
84
|
color: var(--select-option-hover-color);
|
|
85
|
-
} .
|
|
85
|
+
} .select__disabled_1c4es {
|
|
86
86
|
cursor: var(--disabled-cursor);
|
|
87
87
|
background: var(--select-option-disabled-background);
|
|
88
88
|
color: var(--select-option-disabled-color);
|
|
89
|
-
} .
|
|
89
|
+
} .select__content_1c4es {
|
|
90
90
|
flex: 1;
|
|
91
91
|
}
|
|
@@ -10,7 +10,7 @@ import { useLayoutEffect_SAFE_FOR_SSR } from '@alfalab/hooks';
|
|
|
10
10
|
import { defaultAccessor, processOptions, defaultFilterFn } from '../../utils.js';
|
|
11
11
|
import { NativeSelect } from '../native-select/Component.js';
|
|
12
12
|
|
|
13
|
-
var styles = {"component":"
|
|
13
|
+
var styles = {"component":"select__component_iqbbc","popoverInner":"select__popoverInner_iqbbc","optionsList":"select__optionsList_iqbbc","optionsListBorder":"select__optionsListBorder_iqbbc","nativeSelect":"select__nativeSelect_iqbbc","block":"select__block_iqbbc","emptySearchPlaceholder":"select__emptySearchPlaceholder_iqbbc","search":"select__search_iqbbc"};
|
|
14
14
|
require('./index.css')
|
|
15
15
|
|
|
16
16
|
var BaseSelect = forwardRef(
|
|
@@ -127,7 +127,7 @@ function (_a, ref) {
|
|
|
127
127
|
return changes;
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
|
-
}), open = _6.isOpen, getMenuProps = _6.getMenuProps, getInputProps = _6.getInputProps, getItemProps = _6.getItemProps, getComboboxProps = _6.getComboboxProps, getLabelProps = _6.getLabelProps, highlightedIndex = _6.highlightedIndex, toggleMenu = _6.toggleMenu, openMenu = _6.openMenu;
|
|
130
|
+
}), open = _6.isOpen, getMenuProps = _6.getMenuProps, getInputProps = _6.getInputProps, getItemProps = _6.getItemProps, getComboboxProps = _6.getComboboxProps, getLabelProps = _6.getLabelProps, highlightedIndex = _6.highlightedIndex, toggleMenu = _6.toggleMenu, openMenu = _6.openMenu, setHighlightedIndex = _6.setHighlightedIndex;
|
|
131
131
|
var menuProps = getMenuProps({ ref: listRef }, { suppressRefError: true });
|
|
132
132
|
var inputProps = getInputProps(getDropdownProps({ ref: mergeRefs([ref, fieldRef]) }));
|
|
133
133
|
var handleFieldFocus = function (event) {
|
|
@@ -148,7 +148,11 @@ function (_a, ref) {
|
|
|
148
148
|
};
|
|
149
149
|
var handleFieldKeyDown = function (event) {
|
|
150
150
|
inputProps.onKeyDown(event);
|
|
151
|
-
|
|
151
|
+
// https://caniuse.com/?search=KeyboardEvent.key
|
|
152
|
+
var isKeyUnsupported = event.key === 'Unidentified';
|
|
153
|
+
if (autocomplete &&
|
|
154
|
+
!open &&
|
|
155
|
+
(isKeyUnsupported || event.key.length === 1 || event.key === 'Backspace')) {
|
|
152
156
|
// Для автокомплита - открываем меню при начале ввода
|
|
153
157
|
openMenu();
|
|
154
158
|
}
|
|
@@ -183,7 +187,10 @@ function (_a, ref) {
|
|
|
183
187
|
item: option,
|
|
184
188
|
disabled: option.disabled,
|
|
185
189
|
onMouseDown: function (event) { return event.preventDefault(); },
|
|
186
|
-
}), multiple: multiple, index: index, option: option, size: optionsSize, disabled: option.disabled, highlighted: index === highlightedIndex, selected: selectedItems.
|
|
190
|
+
}), multiple: multiple, index: index, option: option, size: optionsSize, disabled: option.disabled, highlighted: index === highlightedIndex, selected: selectedItems.some(function (_a) {
|
|
191
|
+
var key = _a.key;
|
|
192
|
+
return key === option.key;
|
|
193
|
+
}), dataTestId: getDataTestId(dataTestId, 'option') })); }, [
|
|
187
194
|
dataTestId,
|
|
188
195
|
getItemProps,
|
|
189
196
|
highlightedIndex,
|
|
@@ -293,7 +300,7 @@ function (_a, ref) {
|
|
|
293
300
|
}, dataTestId: getDataTestId(dataTestId, 'field') }, fieldProps)),
|
|
294
301
|
name && !nativeSelect && renderValue(),
|
|
295
302
|
!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) }),
|
|
296
|
-
React.createElement(OptionsList, __assign({}, optionsListProps, { optionsListWidth: optionsListWidth, flatOptions: flatOptions, highlightedIndex: highlightedIndex, open: open, size: size, options: filteredOptions, Optgroup: Optgroup, Option: Option, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, visibleOptions: visibleOptions, onScroll: onScroll, dataTestId: getDataTestId(dataTestId, 'options-list'), header: renderOptionsListHeader(), emptyPlaceholder: renderEmptyPlaceholder() })),
|
|
303
|
+
React.createElement(OptionsList, __assign({}, optionsListProps, { setHighlightedIndex: setHighlightedIndex, optionsListWidth: optionsListWidth, flatOptions: flatOptions, highlightedIndex: highlightedIndex, open: open, size: size, options: filteredOptions, Optgroup: Optgroup, Option: Option, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, visibleOptions: visibleOptions, onScroll: onScroll, dataTestId: getDataTestId(dataTestId, 'options-list'), header: renderOptionsListHeader(), emptyPlaceholder: renderEmptyPlaceholder() })),
|
|
297
304
|
React.createElement("div", { className: styles.optionsListBorder })))))));
|
|
298
305
|
});
|
|
299
306
|
|