@true-engineering/true-react-common-ui-kit 3.24.0 → 3.25.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/README.md +21 -0
- package/dist/components/Select/CustomSelect.stories.d.ts +1 -1
- package/dist/components/Select/MultiSelect.stories.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +14 -9
- package/dist/components/Select/Select.styles.d.ts +5 -5
- package/dist/components/Select/components/SelectList/SelectList.d.ts +7 -6
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
- package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +4 -3
- package/dist/components/Select/helpers.d.ts +0 -3
- package/dist/true-react-common-ui-kit.js +140 -114
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +139 -113
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +2 -2
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +21 -38
- package/src/components/Select/CustomSelect.stories.tsx +52 -16
- package/src/components/Select/MultiSelect.stories.tsx +3 -3
- package/src/components/Select/Select.styles.ts +8 -7
- package/src/components/Select/Select.tsx +106 -62
- package/src/components/Select/components/SelectList/SelectList.styles.ts +6 -4
- package/src/components/Select/components/SelectList/SelectList.tsx +25 -29
- package/src/components/Select/components/SelectListItem/SelectListItem.tsx +23 -19
- package/src/components/Select/helpers.ts +0 -7
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +2 -3
package/README.md
CHANGED
|
@@ -11,6 +11,27 @@
|
|
|
11
11
|
|
|
12
12
|
# Release Notes
|
|
13
13
|
|
|
14
|
+
## 3.25.0
|
|
15
|
+
|
|
16
|
+
### Changes
|
|
17
|
+
|
|
18
|
+
- **Select**: Добавлена поддержка проп `header` и `footer`
|
|
19
|
+
- **Select**: Исправлено отображение дропдауна в случае, если у поля есть `errorMessage`
|
|
20
|
+
- **Select**: Добавлен `tabIndex` для списка, с целью корректной работы для [Keyboard-focusable scroll containers](https://chromestatus.com/feature/5231964663578624)
|
|
21
|
+
|
|
22
|
+
### Chore
|
|
23
|
+
|
|
24
|
+
- **Select**: Исправлен каст типа `Styles` на `CSSProperties`
|
|
25
|
+
- **Select**: Удалён type guard для проверки `isMultiSelect`
|
|
26
|
+
- **SelectList**: Исправлены проверки на `isMultiSelect`
|
|
27
|
+
- **TextWithTooltip**: Исправлен каст типа `Styles` на `CSSProperties`
|
|
28
|
+
|
|
29
|
+
## 3.24.1
|
|
30
|
+
|
|
31
|
+
### Changes
|
|
32
|
+
|
|
33
|
+
- Фикс бага с перерендером внутренних компонентов таблицы
|
|
34
|
+
|
|
14
35
|
## 3.24.0
|
|
15
36
|
|
|
16
37
|
### Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ISelectProps } from './Select';
|
|
2
|
-
interface ISelectWithCustomProps<
|
|
2
|
+
interface ISelectWithCustomProps<Option> extends ISelectProps<Option> {
|
|
3
3
|
shouldUsePopper?: boolean;
|
|
4
4
|
shouldRenderInBody?: boolean;
|
|
5
5
|
shouldHideOnScroll?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface ISelectWithCustomProps<T> extends
|
|
1
|
+
import { IMultipleSelectProps } from './Select';
|
|
2
|
+
interface ISelectWithCustomProps<T> extends IMultipleSelectProps<T> {
|
|
3
3
|
valuesType: 'strings' | 'objects';
|
|
4
4
|
shouldUseReactNodes?: boolean;
|
|
5
5
|
shouldUsePopper?: boolean;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { IIcon } from '../Icon';
|
|
4
|
-
import { IInputProps } from '../Input';
|
|
5
|
-
import { ISearchInputProps } from '../SearchInput';
|
|
1
|
+
import { type ChangeEvent, type FormEvent, type KeyboardEvent, type MouseEvent, type ReactNode, type SyntheticEvent } from 'react';
|
|
2
|
+
import { IDropdownWithPopperOptions, type ICommonProps } from '../../types';
|
|
3
|
+
import { type IIcon } from '../Icon';
|
|
4
|
+
import { type IInputProps } from '../Input';
|
|
5
|
+
import { type ISearchInputProps } from '../SearchInput';
|
|
6
6
|
import { IMultipleSelectValue } from './types';
|
|
7
|
-
import { ISelectStyles } from './Select.styles';
|
|
8
|
-
export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type' | 'tweakStyles'>, ICommonProps<ISelectStyles> {
|
|
7
|
+
import { type ISelectStyles } from './Select.styles';
|
|
8
|
+
export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type' | 'isActive' | 'tweakStyles'>, ICommonProps<ISelectStyles> {
|
|
9
|
+
header?: ReactNode;
|
|
10
|
+
footer?: ReactNode;
|
|
9
11
|
defaultOptionLabel?: ReactNode;
|
|
10
12
|
allOptionsLabel?: string;
|
|
11
13
|
noMatchesLabel?: string;
|
|
@@ -23,7 +25,7 @@ export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChan
|
|
|
23
25
|
value: Value | undefined;
|
|
24
26
|
/** @default true */
|
|
25
27
|
shouldScrollToList?: boolean;
|
|
26
|
-
isMultiSelect?:
|
|
28
|
+
isMultiSelect?: false;
|
|
27
29
|
searchInput?: {
|
|
28
30
|
shouldRenderInList: true;
|
|
29
31
|
} & Pick<ISearchInputProps, 'placeholder'>;
|
|
@@ -34,11 +36,14 @@ export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChan
|
|
|
34
36
|
optionsFilter?: (options: Value[], query: string) => Value[];
|
|
35
37
|
onOpen?: () => void;
|
|
36
38
|
compareValuesOnChange?: (v1?: Value, v2?: Value) => boolean;
|
|
39
|
+
/** @description Функция должна быть мемоизирована с целью избежания ререндера */
|
|
37
40
|
convertValueToString?: (value: Value) => string | undefined;
|
|
41
|
+
/** @description Функция должна быть мемоизирована с целью избежания ререндера */
|
|
38
42
|
convertValueToReactNode?: (value: Value, isDisabled: boolean) => ReactNode;
|
|
43
|
+
/** @description Функция должна быть мемоизирована с целью избежания ререндера */
|
|
39
44
|
convertValueToId?: (value: Value) => string | undefined;
|
|
40
45
|
}
|
|
41
|
-
export interface IMultipleSelectProps<Value> extends Omit<ISelectProps<Value>, 'value' | 'onChange' | 'compareValuesOnChange'> {
|
|
46
|
+
export interface IMultipleSelectProps<Value> extends Omit<ISelectProps<Value>, 'value' | 'onChange' | 'compareValuesOnChange' | 'isMultiSelect'> {
|
|
42
47
|
isMultiSelect: true;
|
|
43
48
|
value: IMultipleSelectValue<Value> | undefined;
|
|
44
49
|
onChange: (value: IMultipleSelectValue<Value> | undefined, event: MouseEvent<HTMLElement> | KeyboardEvent | ChangeEvent<HTMLElement> | FormEvent<HTMLElement>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ITweakStyles } from '../../theme';
|
|
2
|
-
import { IInputStyles } from '../Input';
|
|
3
|
-
import { ISearchInputStyles } from '../SearchInput';
|
|
4
|
-
import { ISelectListStyles } from './components';
|
|
1
|
+
import { type ITweakStyles } from '../../theme';
|
|
2
|
+
import { type IInputStyles } from '../Input';
|
|
3
|
+
import { type ISearchInputStyles } from '../SearchInput';
|
|
4
|
+
import { type ISelectListStyles } from './components';
|
|
5
5
|
export declare const useStyles: import("../../theme").IUseStyles<"root" | "icon" | "disabled" | "inputWrapper" | "arrow" | "listWrapper" | "withoutPopper" | "listWrapperInBody" | "activeArrow" | "counter", unknown>;
|
|
6
6
|
export declare const readonlyInputStyles: Partial<import("jss").Styles<"bottom" | "left" | "right" | "top" | "error" | "input" | "invalid" | "root" | "middle" | "icon" | "disabled" | "loading" | "label" | "requiredLabel" | "inputWrapper" | "info" | "autosize" | "focused" | "inputContent" | "unitsWrapper" | "fakeValue" | "units" | "withFloatingLabel" | "floatingLabelWithoutPadding" | "floating" | "activeLabel" | "required" | "floatingWithoutPadding" | "activeIcon" | "border-top" | "border-bottom" | "border-left" | "border-right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "controls" | "clearIcon" | "inputIcon" | "withIcons" | "withControls" | "invalidLabel" | "error-top" | "error-bottom" | "withUnits", unknown, undefined>> & Partial<{
|
|
7
7
|
tweakPreloader: Partial<import("jss").Styles<"root" | "default" | "currentColor" | "dots" | "logo", unknown, undefined>> & Partial<{
|
|
@@ -23,7 +23,7 @@ export declare const readonlyMultiSelectStyles: Partial<import("jss").Styles<"bo
|
|
|
23
23
|
}>;
|
|
24
24
|
export declare const getInputStyles: ({ hasReadonlyInput, isMultiSelect, }: {
|
|
25
25
|
hasReadonlyInput: boolean;
|
|
26
|
-
isMultiSelect
|
|
26
|
+
isMultiSelect?: boolean | undefined;
|
|
27
27
|
}) => IInputStyles;
|
|
28
28
|
export declare const searchInputStyles: ISearchInputStyles;
|
|
29
29
|
export type ISelectStyles = ITweakStyles<typeof useStyles, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ICommonProps } from '../../../../types';
|
|
3
|
-
import { ISelectListItemProps } from '../SelectListItem';
|
|
4
|
-
import { ISelectListStyles } from './SelectList.styles';
|
|
5
|
-
export interface ISelectListProps<Value> extends ICommonProps<ISelectListStyles>, Pick<ISelectListItemProps, 'onToggleCheckbox' | 'onOptionSelect'> {
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ICommonProps } from '../../../../types';
|
|
3
|
+
import { type ISelectListItemProps } from '../SelectListItem';
|
|
4
|
+
import { type ISelectListStyles } from './SelectList.styles';
|
|
5
|
+
export interface ISelectListProps<Value> extends ICommonProps<ISelectListStyles>, Pick<ISelectListItemProps, 'onToggleCheckbox' | 'onOptionSelect' | 'isMultiSelect'> {
|
|
6
6
|
options: Value[] | Readonly<Value[]>;
|
|
7
7
|
focusedIndex?: number;
|
|
8
8
|
activeValue?: Value | Value[];
|
|
@@ -14,9 +14,10 @@ export interface ISelectListProps<Value> extends ICommonProps<ISelectListStyles>
|
|
|
14
14
|
areAllOptionsSelected?: boolean;
|
|
15
15
|
shouldScrollToList?: boolean;
|
|
16
16
|
customListHeader?: ReactNode;
|
|
17
|
+
customListFooter?: ReactNode;
|
|
17
18
|
isOptionDisabled: (value: Value) => boolean;
|
|
18
19
|
convertValueToString: (value: Value) => string | undefined;
|
|
19
20
|
convertValueToReactNode?: (value: Value, isDisabled: boolean) => ReactNode;
|
|
20
21
|
convertValueToId: (value: Value) => string | undefined;
|
|
21
22
|
}
|
|
22
|
-
export declare function SelectList<Value>({ options, focusedIndex, activeValue, defaultOptionLabel, noMatchesLabel, isLoading, loadingLabel, tweakStyles, testId, shouldScrollToList, areAllOptionsSelected, customListHeader, isOptionDisabled, allOptionsLabel, onOptionSelect, onToggleCheckbox, convertValueToString, convertValueToReactNode, convertValueToId, }: ISelectListProps<Value>): JSX.Element;
|
|
23
|
+
export declare function SelectList<Value>({ options, focusedIndex, activeValue, defaultOptionLabel, noMatchesLabel, isLoading, loadingLabel, tweakStyles, testId, shouldScrollToList, areAllOptionsSelected, customListHeader, customListFooter, isMultiSelect, isOptionDisabled, allOptionsLabel, onOptionSelect, onToggleCheckbox, convertValueToString, convertValueToReactNode, convertValueToId, }: ISelectListProps<Value>): JSX.Element;
|
|
@@ -2,5 +2,5 @@ import { ITweakStyles } from '../../../../theme';
|
|
|
2
2
|
export declare const ROW_HEIGHT = 40;
|
|
3
3
|
export declare const CONTAINER_PADDING = 10;
|
|
4
4
|
export declare const CELL_PADDING: number[];
|
|
5
|
-
export declare const useStyles: import("../../../../theme").IUseStyles<"root" | "cell" | "active" | "disabled" | "loading" | "list" | "focused" | "withListHeader" | "listHeader" | "cellWithCheckbox" | "noMatchesLabel" | "defaultCell", unknown>;
|
|
5
|
+
export declare const useStyles: import("../../../../theme").IUseStyles<"root" | "cell" | "active" | "disabled" | "loading" | "list" | "focused" | "withListHeader" | "withListFooter" | "listHeader" | "listFooter" | "cellWithCheckbox" | "noMatchesLabel" | "defaultCell", unknown>;
|
|
6
6
|
export type ISelectListStyles = ITweakStyles<typeof useStyles>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Classes } from 'jss';
|
|
1
|
+
import { type ChangeEvent, type FC, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react';
|
|
2
|
+
import { type Classes } from 'jss';
|
|
3
3
|
export interface ISelectListItemProps {
|
|
4
4
|
index: number;
|
|
5
5
|
isSemiChecked?: boolean;
|
|
@@ -8,7 +8,8 @@ export interface ISelectListItemProps {
|
|
|
8
8
|
isFocused?: boolean;
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
classes: Classes<'cellWithCheckbox' | 'cell' | 'focused' | 'active' | 'disabled'>;
|
|
11
|
+
isMultiSelect?: boolean;
|
|
11
12
|
onOptionSelect: (index: number, event: MouseEvent<HTMLElement>) => void;
|
|
12
|
-
onToggleCheckbox
|
|
13
|
+
onToggleCheckbox: (index: number, isSelected: boolean, event: ChangeEvent<HTMLElement> | KeyboardEvent) => void;
|
|
13
14
|
}
|
|
14
15
|
export declare const SelectListItem: FC<ISelectListItemProps>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { IMultipleSelectProps, ISelectProps } from './Select';
|
|
2
|
-
import { IMultipleSelectValue } from './types';
|
|
3
1
|
export declare const defaultIsOptionDisabled: <Value>(option: Value) => boolean;
|
|
4
2
|
export declare const defaultConvertFunction: (v: unknown) => string | undefined;
|
|
5
3
|
export declare const defaultCompareFunction: <Value>(v1: Value, v2: Value) => boolean;
|
|
6
4
|
export declare const getDefaultConvertToIdFunction: <Value>(convertValueToString: (value: Value) => string | undefined) => (value: Value) => string | undefined;
|
|
7
|
-
export declare const isMultiSelectValue: <Value>(props: ISelectProps<Value> | IMultipleSelectProps<Value>, _value: Value | IMultipleSelectValue<Value> | undefined) => _value is IMultipleSelectValue<Value> | undefined;
|