@true-engineering/true-react-common-ui-kit 4.0.0-alpha31 → 4.0.0-alpha32

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "4.0.0-alpha31",
3
+ "version": "4.0.0-alpha32",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -17,6 +17,7 @@ import { Portal } from 'react-overlays';
17
17
  import clsx from 'clsx';
18
18
  import { debounce } from 'ts-debounce';
19
19
  import {
20
+ applyAction,
20
21
  createFilter,
21
22
  getArray,
22
23
  getTestId,
@@ -39,14 +40,14 @@ import {
39
40
  defaultIsOptionDisabled,
40
41
  getDefaultConvertToIdFunction,
41
42
  } from './helpers';
42
- import { IChangeSelectEvent, IMultipleSelectValue } from './types';
43
+ import { IChangeSelectEvent, IMultipleSelectValue, ISelectFooter } from './types';
43
44
  import { getInputStyles, ISelectStyles, useStyles } from './Select.styles';
44
45
 
45
46
  export interface ISelectProps<Value>
46
47
  extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type' | 'tweakStyles'>,
47
48
  ICommonProps<ISelectStyles> {
48
49
  header?: ReactNode;
49
- footer?: ReactNode;
50
+ footer?: ISelectFooter<Value>;
50
51
  defaultOptionLabel?: ReactNode;
51
52
  allOptionsLabel?: string;
52
53
  noMatchesLabel?: string;
@@ -194,7 +195,7 @@ export function Select<Value>(
194
195
 
195
196
  const filteredOptions = useMemo(() => {
196
197
  if (optionsMode !== 'search') {
197
- return options;
198
+ return options as Value[];
198
199
  }
199
200
 
200
201
  const filter =
@@ -554,7 +555,7 @@ export function Select<Value>(
554
555
  allOptionsLabel={shouldShowAllOption && allOptionsLabel}
555
556
  areAllOptionsSelected={areAllOptionsSelected}
556
557
  customListHeader={customHeader}
557
- customListFooter={footer}
558
+ customListFooter={applyAction(footer, { filteredOptions })}
558
559
  noMatchesLabel={noMatchesLabel}
559
560
  focusedIndex={focusedListCellIndex}
560
561
  activeValue={value}
@@ -1,6 +1,9 @@
1
1
  import { ChangeEvent, KeyboardEvent } from 'react';
2
+ import { IRenderNode } from '../../types';
2
3
  import { IChangeInputEvent } from '../Input';
3
4
 
4
5
  export type IMultipleSelectValue<Value> = Array<NonNullable<Value>>;
5
6
 
6
7
  export type IChangeSelectEvent = IChangeInputEvent | ChangeEvent<HTMLElement> | KeyboardEvent;
8
+
9
+ export type ISelectFooter<T> = IRenderNode<{ filteredOptions: T[] }>;