@alfalab/core-components-select 17.2.0 → 17.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/arrow/Component.js +1 -1
- package/components/arrow/index.css +4 -4
- package/components/base-checkmark/Component.js +1 -1
- package/components/base-checkmark/index.css +5 -5
- package/components/base-option/Component.js +1 -1
- package/components/base-option/index.css +14 -14
- package/components/base-select/Component.js +44 -40
- package/components/base-select/index.css +12 -12
- package/components/base-select/mobile.css +13 -13
- package/components/checkmark/Component.js +1 -1
- package/components/checkmark/index.css +11 -11
- package/components/checkmark-mobile/Component.js +1 -1
- package/components/checkmark-mobile/index.css +7 -7
- package/components/field/Component.js +2 -2
- package/components/field/index.css +13 -13
- package/components/footer/Component.js +3 -3
- package/components/footer/index.css +6 -6
- package/components/optgroup/Component.js +4 -3
- package/components/optgroup/index.css +7 -7
- package/components/option/Component.js +4 -3
- package/components/option/index.css +20 -20
- package/components/options-list/Component.js +3 -3
- package/components/options-list/index.css +10 -10
- package/components/search/Component.js +1 -1
- package/components/search/index.css +3 -3
- package/components/virtual-options-list/Component.js +3 -3
- package/components/virtual-options-list/index.css +16 -16
- package/consts.d.ts +11 -1
- package/consts.js +11 -0
- package/cssm/components/arrow/index.module.css +1 -1
- package/cssm/components/base-checkmark/index.module.css +1 -1
- package/cssm/components/base-option/index.module.css +1 -1
- package/cssm/components/base-select/Component.js +42 -38
- package/cssm/components/base-select/index.module.css +1 -1
- package/cssm/components/base-select/mobile.module.css +1 -1
- package/cssm/components/checkmark/index.module.css +3 -3
- package/cssm/components/checkmark-mobile/index.module.css +1 -1
- package/cssm/components/field/Component.js +1 -1
- package/cssm/components/field/index.module.css +1 -1
- package/cssm/components/footer/Component.js +2 -2
- package/cssm/components/footer/index.module.css +1 -1
- package/cssm/components/optgroup/Component.js +3 -2
- package/cssm/components/optgroup/index.module.css +3 -3
- package/cssm/components/option/Component.js +3 -2
- package/cssm/components/option/index.module.css +8 -8
- package/cssm/components/options-list/Component.js +2 -2
- package/cssm/components/options-list/index.module.css +3 -3
- package/cssm/components/search/index.module.css +1 -1
- package/cssm/components/virtual-options-list/Component.js +2 -2
- package/cssm/components/virtual-options-list/index.module.css +3 -3
- package/cssm/consts.d.ts +11 -1
- package/cssm/consts.js +11 -0
- package/cssm/mobile/Component.mobile.js +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +2 -2
- package/cssm/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/header/index.module.css +1 -1
- package/cssm/typings.d.ts +10 -5
- package/esm/components/arrow/Component.js +1 -1
- package/esm/components/arrow/index.css +4 -4
- package/esm/components/base-checkmark/Component.js +1 -1
- package/esm/components/base-checkmark/index.css +5 -5
- package/esm/components/base-option/Component.js +1 -1
- package/esm/components/base-option/index.css +14 -14
- package/esm/components/base-select/Component.js +46 -42
- package/esm/components/base-select/index.css +12 -12
- package/esm/components/base-select/mobile.css +13 -13
- package/esm/components/checkmark/Component.js +1 -1
- package/esm/components/checkmark/index.css +11 -11
- package/esm/components/checkmark-mobile/Component.js +1 -1
- package/esm/components/checkmark-mobile/index.css +7 -7
- package/esm/components/field/Component.js +2 -2
- package/esm/components/field/index.css +13 -13
- package/esm/components/footer/Component.js +3 -3
- package/esm/components/footer/index.css +6 -6
- package/esm/components/optgroup/Component.js +4 -3
- package/esm/components/optgroup/index.css +7 -7
- package/esm/components/option/Component.js +4 -3
- package/esm/components/option/index.css +20 -20
- package/esm/components/options-list/Component.js +4 -4
- package/esm/components/options-list/index.css +10 -10
- package/esm/components/search/Component.js +1 -1
- package/esm/components/search/index.css +3 -3
- package/esm/components/virtual-options-list/Component.js +4 -4
- package/esm/components/virtual-options-list/index.css +16 -16
- package/esm/consts.d.ts +11 -1
- package/esm/consts.js +11 -1
- package/esm/mobile/Component.mobile.js +2 -2
- 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 +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.css +4 -4
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.css +4 -4
- 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/index.js +1 -1
- package/esm/typings.d.ts +10 -5
- package/mobile/Component.mobile.js +2 -2
- package/modern/components/arrow/Component.js +1 -1
- package/modern/components/arrow/index.css +4 -4
- package/modern/components/base-checkmark/Component.js +1 -1
- package/modern/components/base-checkmark/index.css +5 -5
- package/modern/components/base-option/Component.js +1 -1
- package/modern/components/base-option/index.css +14 -14
- package/modern/components/base-select/Component.js +44 -39
- package/modern/components/base-select/index.css +12 -12
- package/modern/components/base-select/mobile.css +13 -13
- package/modern/components/checkmark/Component.js +1 -1
- package/modern/components/checkmark/index.css +11 -11
- package/modern/components/checkmark-mobile/Component.js +1 -1
- package/modern/components/checkmark-mobile/index.css +7 -7
- package/modern/components/field/Component.js +2 -2
- package/modern/components/field/index.css +13 -13
- package/modern/components/footer/Component.js +3 -3
- package/modern/components/footer/index.css +6 -6
- package/modern/components/optgroup/Component.js +4 -3
- package/modern/components/optgroup/index.css +7 -7
- package/modern/components/option/Component.js +4 -3
- package/modern/components/option/index.css +20 -20
- package/modern/components/options-list/Component.js +4 -4
- package/modern/components/options-list/index.css +10 -10
- package/modern/components/search/Component.js +1 -1
- package/modern/components/search/index.css +3 -3
- package/modern/components/virtual-options-list/Component.js +4 -4
- package/modern/components/virtual-options-list/index.css +16 -16
- package/modern/consts.d.ts +11 -1
- package/modern/consts.js +11 -1
- package/modern/mobile/Component.mobile.js +2 -2
- 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 +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.css +4 -4
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.css +4 -4
- 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/index.js +1 -1
- package/modern/typings.d.ts +10 -5
- package/package.json +8 -8
- 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 +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.css +4 -4
- package/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/header/index.css +4 -4
- 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/index.js +1 -1
- package/src/components/base-select/Component.tsx +47 -38
- package/src/components/checkmark/index.module.css +1 -1
- package/src/components/field/Component.tsx +1 -1
- package/src/components/footer/Component.tsx +2 -2
- package/src/components/optgroup/Component.tsx +3 -2
- package/src/components/optgroup/index.module.css +2 -2
- package/src/components/option/Component.tsx +3 -2
- package/src/components/option/index.module.css +6 -6
- package/src/components/options-list/Component.tsx +3 -3
- package/src/components/options-list/index.module.css +2 -2
- package/src/components/virtual-options-list/Component.tsx +7 -3
- package/src/components/virtual-options-list/index.module.css +2 -2
- package/src/consts.ts +11 -0
- package/src/mobile/Component.mobile.tsx +2 -2
- package/src/presets/useSelectWithApply/options-list-with-apply/footer/Component.tsx +2 -2
- package/src/typings.ts +10 -5
- package/typings.d.ts +10 -5
- /package/esm/{hook-b4192713.d.ts → hook-e8eb700a.d.ts} +0 -0
- /package/esm/{hook-b4192713.js → hook-e8eb700a.js} +0 -0
- /package/{hook-5269e0eb.d.ts → hook-6aa923ff.d.ts} +0 -0
- /package/{hook-5269e0eb.js → hook-6aa923ff.js} +0 -0
- /package/modern/{hook-328d58fb.d.ts → hook-a738ac9d.d.ts} +0 -0
- /package/modern/{hook-328d58fb.js → hook-a738ac9d.js} +0 -0
package/shared/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var presets_useSelectWithLoading_hook = require('../presets/useSelectWithLoading/hook.js');
|
|
6
6
|
var presets_useLazyLoading_hook = require('../presets/useLazyLoading/hook.js');
|
|
7
|
-
var presets_useSelectWithApply_optionsListWithApply_Component = require('../hook-
|
|
7
|
+
var presets_useSelectWithApply_optionsListWithApply_Component = require('../hook-6aa923ff.js');
|
|
8
8
|
var utils = require('../utils.js');
|
|
9
9
|
var components_option_Component = require('../components/option/Component.js');
|
|
10
10
|
var components_baseOption_Component = require('../components/base-option/Component.js');
|
|
@@ -101,7 +101,7 @@ export const BaseSelect = forwardRef(
|
|
|
101
101
|
name,
|
|
102
102
|
id,
|
|
103
103
|
selected,
|
|
104
|
-
size =
|
|
104
|
+
size = 48,
|
|
105
105
|
optionsSize = size,
|
|
106
106
|
error,
|
|
107
107
|
hint,
|
|
@@ -149,7 +149,6 @@ export const BaseSelect = forwardRef(
|
|
|
149
149
|
const listRef = useRef<HTMLDivElement>(null);
|
|
150
150
|
const initiatorRef = useRef<OptionShape | null>(null);
|
|
151
151
|
const searchRef = useRef<HTMLInputElement>(null);
|
|
152
|
-
const alreadyClickedRef = useRef<boolean>(false);
|
|
153
152
|
const scrollableContainerRef = useRef<HTMLDivElement>(null);
|
|
154
153
|
const onOpenRef = useRef(onOpen);
|
|
155
154
|
|
|
@@ -249,6 +248,26 @@ export const BaseSelect = forwardRef(
|
|
|
249
248
|
isItemDisabled,
|
|
250
249
|
defaultHighlightedIndex: selectedItems.length === 0 ? -1 : undefined,
|
|
251
250
|
scrollIntoView,
|
|
251
|
+
onSelectedItemChange: (changes) => {
|
|
252
|
+
const selectedItem = changes.selectedItem || initiatorRef.current;
|
|
253
|
+
|
|
254
|
+
if (selectedItem && !selectedItem.disabled) {
|
|
255
|
+
const alreadySelected = selectedItems.includes(selectedItem);
|
|
256
|
+
const allowRemove = allowUnselect || (multiple && selectedItems.length > 1);
|
|
257
|
+
|
|
258
|
+
if (alreadySelected && allowRemove) {
|
|
259
|
+
removeSelectedItem(selectedItem);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (!alreadySelected) {
|
|
263
|
+
if (multiple) {
|
|
264
|
+
addSelectedItem(selectedItem);
|
|
265
|
+
} else {
|
|
266
|
+
setSelectedItems([selectedItem]);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
252
271
|
onIsOpenChange: (changes) => {
|
|
253
272
|
if (onOpenRef.current) {
|
|
254
273
|
/**
|
|
@@ -275,18 +294,10 @@ export const BaseSelect = forwardRef(
|
|
|
275
294
|
}
|
|
276
295
|
}
|
|
277
296
|
},
|
|
278
|
-
// eslint-disable-next-line complexity
|
|
279
297
|
stateReducer: (state, actionAndChanges) => {
|
|
280
298
|
const { type, changes } = actionAndChanges;
|
|
281
|
-
const { selectedItem } = changes;
|
|
282
299
|
|
|
283
300
|
switch (type) {
|
|
284
|
-
case useCombobox.stateChangeTypes.InputBlur:
|
|
285
|
-
if (view === 'mobile') {
|
|
286
|
-
return state;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
return changes;
|
|
290
301
|
case useCombobox.stateChangeTypes.InputKeyDownArrowDown:
|
|
291
302
|
if (!circularNavigation && state.highlightedIndex === options.length - 1) {
|
|
292
303
|
return { ...changes, highlightedIndex: state.highlightedIndex };
|
|
@@ -301,37 +312,14 @@ export const BaseSelect = forwardRef(
|
|
|
301
312
|
return changes;
|
|
302
313
|
|
|
303
314
|
case useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
304
|
-
case useCombobox.stateChangeTypes.ItemClick:
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (selectedItem && !selectedItem.disabled && !alreadyClickedRef.current) {
|
|
308
|
-
// TODO!!! Проблема downshift + React 18. ItemClick срабатывает дважды. См https://github.com/downshift-js/downshift/issues/1384
|
|
309
|
-
if (view === 'mobile' && React.version.indexOf('18') === 0) {
|
|
310
|
-
alreadyClickedRef.current = true;
|
|
311
|
-
setTimeout(() => {
|
|
312
|
-
alreadyClickedRef.current = false;
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
const alreadySelected = selectedItems.includes(selectedItem);
|
|
317
|
-
const allowRemove =
|
|
318
|
-
allowUnselect || (multiple && selectedItems.length > 1);
|
|
319
|
-
|
|
320
|
-
if (alreadySelected && allowRemove) {
|
|
321
|
-
removeSelectedItem(selectedItem);
|
|
322
|
-
}
|
|
315
|
+
case useCombobox.stateChangeTypes.ItemClick: {
|
|
316
|
+
const { selectedItem } = changes;
|
|
323
317
|
|
|
324
|
-
|
|
325
|
-
if (multiple) {
|
|
326
|
-
addSelectedItem(selectedItem);
|
|
327
|
-
} else {
|
|
328
|
-
setSelectedItems([selectedItem]);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
318
|
+
initiatorRef.current = selectedItem || null;
|
|
332
319
|
|
|
333
320
|
return {
|
|
334
321
|
...changes,
|
|
322
|
+
selectedItem: state.selectedItem === selectedItem ? null : selectedItem,
|
|
335
323
|
isOpen: !closeOnSelect || (view === 'mobile' && multiple),
|
|
336
324
|
// при closeOnSelect === false - сохраняем подсвеченный индекс
|
|
337
325
|
highlightedIndex:
|
|
@@ -339,14 +327,32 @@ export const BaseSelect = forwardRef(
|
|
|
339
327
|
? state.highlightedIndex
|
|
340
328
|
: changes.highlightedIndex,
|
|
341
329
|
};
|
|
330
|
+
}
|
|
342
331
|
default:
|
|
343
332
|
return changes;
|
|
344
333
|
}
|
|
345
334
|
},
|
|
346
335
|
});
|
|
347
336
|
|
|
348
|
-
|
|
337
|
+
useEffect(() => {
|
|
338
|
+
/*
|
|
339
|
+
* При изменении openProp, состояние внутри downshift в useEnhancedReducer не меняется, поэтому меняем его таким способом
|
|
340
|
+
* Скорее всего это исправят в будущих версиях downshift
|
|
341
|
+
*/
|
|
342
|
+
if (openProp !== undefined) {
|
|
343
|
+
if (openProp) {
|
|
344
|
+
openMenu();
|
|
345
|
+
} else {
|
|
346
|
+
closeMenu();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}, [openProp, openMenu, closeMenu]);
|
|
350
|
+
|
|
349
351
|
const inputProps = getInputProps(getDropdownProps({ ref: mergeRefs([ref, fieldRef]) }));
|
|
352
|
+
const { ref: menuRef, ...menuProps } = getMenuProps(
|
|
353
|
+
{ ref: listRef },
|
|
354
|
+
{ suppressRefError: true },
|
|
355
|
+
);
|
|
350
356
|
|
|
351
357
|
const handleEntered = (node: HTMLElement, isAppearing: boolean) => {
|
|
352
358
|
if (showSearch) searchRef.current?.focus();
|
|
@@ -593,6 +599,7 @@ export const BaseSelect = forwardRef(
|
|
|
593
599
|
return (
|
|
594
600
|
<div
|
|
595
601
|
{...menuProps}
|
|
602
|
+
ref={view === 'desktop' ? menuRef : undefined}
|
|
596
603
|
className={cn(
|
|
597
604
|
optionsListClassName,
|
|
598
605
|
view === 'mobile' && mobileStyles.optionsListWrapper,
|
|
@@ -668,6 +675,7 @@ export const BaseSelect = forwardRef(
|
|
|
668
675
|
swipeable={swipeable}
|
|
669
676
|
initialHeight={showSearch ? 'full' : 'default'}
|
|
670
677
|
{...bottomSheetProps}
|
|
678
|
+
sheetContainerRef={menuRef}
|
|
671
679
|
scrollableContainerRef={scrollableContainerRef}
|
|
672
680
|
onClose={() => {
|
|
673
681
|
closeMenu();
|
|
@@ -704,6 +712,7 @@ export const BaseSelect = forwardRef(
|
|
|
704
712
|
open={open}
|
|
705
713
|
hasCloser={true}
|
|
706
714
|
{...modalProps}
|
|
715
|
+
componentRef={menuRef}
|
|
707
716
|
onClose={(...args) => {
|
|
708
717
|
closeMenu();
|
|
709
718
|
modalProps?.onClose?.(...args);
|
|
@@ -40,7 +40,7 @@ export const Footer = ({
|
|
|
40
40
|
>
|
|
41
41
|
{showClear && (
|
|
42
42
|
<ButtonMobile
|
|
43
|
-
size=
|
|
43
|
+
size={56}
|
|
44
44
|
view='secondary'
|
|
45
45
|
className={styles.button}
|
|
46
46
|
onClick={handleClear}
|
|
@@ -51,7 +51,7 @@ export const Footer = ({
|
|
|
51
51
|
)}
|
|
52
52
|
|
|
53
53
|
<ButtonMobile
|
|
54
|
-
size=
|
|
54
|
+
size={56}
|
|
55
55
|
view='primary'
|
|
56
56
|
className={styles.button}
|
|
57
57
|
onClick={handleApply}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
+
import { SIZE_TO_CLASSNAME_MAP } from '../../consts';
|
|
4
5
|
import { OptgroupProps } from '../../typings';
|
|
5
6
|
|
|
6
7
|
import styles from './index.module.css';
|
|
7
8
|
|
|
8
|
-
export const Optgroup = ({ children, className, label, size =
|
|
9
|
+
export const Optgroup = ({ children, className, label, size = 48 }: OptgroupProps) => (
|
|
9
10
|
<React.Fragment>
|
|
10
|
-
<div className={cn(styles.optgroup, className, styles[size])}>
|
|
11
|
+
<div className={cn(styles.optgroup, className, styles[SIZE_TO_CLASSNAME_MAP[size]])}>
|
|
11
12
|
<span className={styles.label}>{label}</span>
|
|
12
13
|
</div>
|
|
13
14
|
{children}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { FC, isValidElement } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
+
import { SIZE_TO_CLASSNAME_MAP } from '../../consts';
|
|
4
5
|
import { OptionProps } from '../../typings';
|
|
5
6
|
import { Checkmark as DefaultCheckMark } from '../checkmark';
|
|
6
7
|
import { Checkmark as DefaultMobileCheckmark } from '../checkmark-mobile';
|
|
@@ -8,7 +9,7 @@ import { Checkmark as DefaultMobileCheckmark } from '../checkmark-mobile';
|
|
|
8
9
|
import styles from './index.module.css';
|
|
9
10
|
|
|
10
11
|
export const Option: FC<OptionProps> = ({
|
|
11
|
-
size =
|
|
12
|
+
size = 48,
|
|
12
13
|
className,
|
|
13
14
|
option,
|
|
14
15
|
children,
|
|
@@ -27,7 +28,7 @@ export const Option: FC<OptionProps> = ({
|
|
|
27
28
|
return (
|
|
28
29
|
<div
|
|
29
30
|
{...innerProps}
|
|
30
|
-
className={cn(styles.option, styles[size], className, {
|
|
31
|
+
className={cn(styles.option, styles[SIZE_TO_CLASSNAME_MAP[size]], className, {
|
|
31
32
|
[styles.highlighted]: !mobile && highlighted,
|
|
32
33
|
[styles.selected]: selected,
|
|
33
34
|
[styles.disabled]: disabled,
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.
|
|
40
|
+
.size-48 {
|
|
41
41
|
min-height: var(--size-s-height);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.
|
|
44
|
+
.size-56 {
|
|
45
45
|
min-height: var(--size-m-height);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.
|
|
48
|
+
.size-64 {
|
|
49
49
|
min-height: var(--size-l-height);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.
|
|
52
|
+
.size-72 {
|
|
53
53
|
min-height: var(--size-xl-height);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.
|
|
57
|
-
.
|
|
56
|
+
.size-64,
|
|
57
|
+
.size-72 {
|
|
58
58
|
padding-left: var(--select-option-l-left-padding);
|
|
59
59
|
padding-right: var(--select-option-l-right-padding);
|
|
60
60
|
|
|
@@ -6,7 +6,7 @@ import { useMatchMedia } from '@alfalab/core-components-mq';
|
|
|
6
6
|
import { Scrollbar } from '@alfalab/core-components-scrollbar';
|
|
7
7
|
import { isClient } from '@alfalab/core-components-shared';
|
|
8
8
|
|
|
9
|
-
import { DEFAULT_VISIBLE_OPTIONS } from '../../consts';
|
|
9
|
+
import { DEFAULT_VISIBLE_OPTIONS, SIZE_TO_CLASSNAME_MAP } from '../../consts';
|
|
10
10
|
import { GroupShape, OptionShape, OptionsListProps } from '../../typings';
|
|
11
11
|
import { isGroup, useVisibleOptions } from '../../utils';
|
|
12
12
|
import { Optgroup as DefaultOptgroup } from '../optgroup';
|
|
@@ -23,7 +23,7 @@ const createCounter = () => {
|
|
|
23
23
|
export const OptionsList = forwardRef<HTMLDivElement, OptionsListProps>(
|
|
24
24
|
(
|
|
25
25
|
{
|
|
26
|
-
size =
|
|
26
|
+
size = 48,
|
|
27
27
|
className,
|
|
28
28
|
optionGroupClassName,
|
|
29
29
|
scrollbarClassName,
|
|
@@ -130,7 +130,7 @@ export const OptionsList = forwardRef<HTMLDivElement, OptionsListProps>(
|
|
|
130
130
|
return (
|
|
131
131
|
<div
|
|
132
132
|
{...(nativeScrollbar && { 'data-test-id': dataTestId })}
|
|
133
|
-
className={cn(styles.optionsList, styles[size], className)}
|
|
133
|
+
className={cn(styles.optionsList, styles[SIZE_TO_CLASSNAME_MAP[size]], className)}
|
|
134
134
|
>
|
|
135
135
|
{header && (
|
|
136
136
|
<div className={styles.optionsListHeader} onMouseEnter={resetHighlightedIndex}>
|
|
@@ -7,7 +7,7 @@ import { useMatchMedia } from '@alfalab/core-components-mq';
|
|
|
7
7
|
import { Scrollbar } from '@alfalab/core-components-scrollbar';
|
|
8
8
|
import { isClient } from '@alfalab/core-components-shared';
|
|
9
9
|
|
|
10
|
-
import { DEFAULT_VISIBLE_OPTIONS } from '../../consts';
|
|
10
|
+
import { DEFAULT_VISIBLE_OPTIONS, SIZE_TO_CLASSNAME_MAP } from '../../consts';
|
|
11
11
|
import { GroupShape, OptionShape, OptionsListProps } from '../../typings';
|
|
12
12
|
import { isGroup, lastIndexOf, usePrevious, useVisibleOptions } from '../../utils';
|
|
13
13
|
import { Optgroup as DefaultOptgroup } from '../optgroup';
|
|
@@ -17,7 +17,7 @@ import styles from './index.module.css';
|
|
|
17
17
|
export const VirtualOptionsList = forwardRef<HTMLDivElement, OptionsListProps>(
|
|
18
18
|
(
|
|
19
19
|
{
|
|
20
|
-
size =
|
|
20
|
+
size = 48,
|
|
21
21
|
flatOptions = [],
|
|
22
22
|
highlightedIndex = -1,
|
|
23
23
|
className,
|
|
@@ -201,7 +201,11 @@ export const VirtualOptionsList = forwardRef<HTMLDivElement, OptionsListProps>(
|
|
|
201
201
|
|
|
202
202
|
return (
|
|
203
203
|
<div
|
|
204
|
-
className={cn(
|
|
204
|
+
className={cn(
|
|
205
|
+
styles.virtualOptionsList,
|
|
206
|
+
styles[SIZE_TO_CLASSNAME_MAP[size]],
|
|
207
|
+
className,
|
|
208
|
+
)}
|
|
205
209
|
data-test-id={dataTestId}
|
|
206
210
|
>
|
|
207
211
|
{header && (
|
package/src/consts.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const Footer = ({
|
|
|
28
28
|
className={styles.footer}
|
|
29
29
|
>
|
|
30
30
|
<ButtonDesktop
|
|
31
|
-
size=
|
|
31
|
+
size={32}
|
|
32
32
|
view='primary'
|
|
33
33
|
onClick={handleApply}
|
|
34
34
|
dataTestId={getDataTestId(dataTestId, 'apply')}
|
|
@@ -38,7 +38,7 @@ export const Footer = ({
|
|
|
38
38
|
|
|
39
39
|
{showClear && selectedDraft.length > 0 && (
|
|
40
40
|
<ButtonDesktop
|
|
41
|
-
size=
|
|
41
|
+
size={32}
|
|
42
42
|
view='secondary'
|
|
43
43
|
onClick={handleClear}
|
|
44
44
|
dataTestId={getDataTestId(dataTestId, 'clear')}
|
package/src/typings.ts
CHANGED
|
@@ -144,13 +144,15 @@ export type BaseSelectProps = {
|
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* Размер компонента
|
|
147
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
147
148
|
*/
|
|
148
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
149
|
+
size?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
149
150
|
|
|
150
151
|
/**
|
|
151
152
|
* Размер пунктов меню
|
|
153
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
152
154
|
*/
|
|
153
|
-
optionsSize?: 's' | 'm' | 'l' | 'xl';
|
|
155
|
+
optionsSize?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
154
156
|
|
|
155
157
|
/**
|
|
156
158
|
* Растягивает компонент на ширину контейнера
|
|
@@ -477,8 +479,9 @@ export type OptionsListProps = {
|
|
|
477
479
|
|
|
478
480
|
/**
|
|
479
481
|
* Размер компонента
|
|
482
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
480
483
|
*/
|
|
481
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
484
|
+
size?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
482
485
|
|
|
483
486
|
/**
|
|
484
487
|
* Компонент пункта меню
|
|
@@ -605,8 +608,9 @@ export type OptgroupProps = {
|
|
|
605
608
|
|
|
606
609
|
/**
|
|
607
610
|
* Размер компонента
|
|
611
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
608
612
|
*/
|
|
609
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
613
|
+
size?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
610
614
|
|
|
611
615
|
/**
|
|
612
616
|
* Заголовок группы
|
|
@@ -627,8 +631,9 @@ export type OptionProps = {
|
|
|
627
631
|
|
|
628
632
|
/**
|
|
629
633
|
* Размер компонента
|
|
634
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
630
635
|
*/
|
|
631
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
636
|
+
size?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
632
637
|
|
|
633
638
|
/**
|
|
634
639
|
* Контент пункта меню
|
package/typings.d.ts
CHANGED
|
@@ -107,12 +107,14 @@ type BaseSelectProps = {
|
|
|
107
107
|
multiple?: boolean;
|
|
108
108
|
/**
|
|
109
109
|
* Размер компонента
|
|
110
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
110
111
|
*/
|
|
111
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
112
|
+
size?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
112
113
|
/**
|
|
113
114
|
* Размер пунктов меню
|
|
115
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
114
116
|
*/
|
|
115
|
-
optionsSize?: 's' | 'm' | 'l' | 'xl';
|
|
117
|
+
optionsSize?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
116
118
|
/**
|
|
117
119
|
* Растягивает компонент на ширину контейнера
|
|
118
120
|
*/
|
|
@@ -377,8 +379,9 @@ type OptionsListProps = {
|
|
|
377
379
|
scrollbarClassName?: string;
|
|
378
380
|
/**
|
|
379
381
|
* Размер компонента
|
|
382
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
380
383
|
*/
|
|
381
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
384
|
+
size?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
382
385
|
/**
|
|
383
386
|
* Компонент пункта меню
|
|
384
387
|
*/
|
|
@@ -480,8 +483,9 @@ type OptgroupProps = {
|
|
|
480
483
|
className?: string;
|
|
481
484
|
/**
|
|
482
485
|
* Размер компонента
|
|
486
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
483
487
|
*/
|
|
484
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
488
|
+
size?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
485
489
|
/**
|
|
486
490
|
* Заголовок группы
|
|
487
491
|
*/
|
|
@@ -498,8 +502,9 @@ type OptionProps = {
|
|
|
498
502
|
className?: string;
|
|
499
503
|
/**
|
|
500
504
|
* Размер компонента
|
|
505
|
+
* @description s, m, l, xl deprecated, используйте вместо них 48, 56, 64, 72 соответственно
|
|
501
506
|
*/
|
|
502
|
-
size?: 's' | 'm' | 'l' | 'xl';
|
|
507
|
+
size?: 's' | 'm' | 'l' | 'xl' | 48 | 56 | 64 | 72;
|
|
503
508
|
/**
|
|
504
509
|
* Контент пункта меню
|
|
505
510
|
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|