@true-engineering/true-react-common-ui-kit 4.0.0-alpha75 → 4.0.0-alpha76
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/dist/components/Select/Select.d.ts +7 -4
- package/dist/components/Select/Select.styles.d.ts +4 -1
- package/dist/components/Select/types.d.ts +17 -0
- package/dist/components/WithPopup/WithPopup.d.ts +4 -2
- package/dist/helpers/misc.d.ts +0 -1
- package/dist/true-react-common-ui-kit.js +200 -234
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.ts +2 -1
- package/src/components/Select/CustomSelect.stories.tsx +0 -14
- package/src/components/Select/MultiSelect.stories.tsx +5 -16
- package/src/components/Select/Select.stories.tsx +5 -16
- package/src/components/Select/Select.styles.ts +8 -19
- package/src/components/Select/Select.tsx +203 -231
- package/src/components/Select/components/SelectList/SelectList.styles.ts +1 -0
- package/src/components/Select/types.ts +18 -0
- package/src/components/WithPopup/WithPopup.tsx +18 -5
- package/src/helpers/misc.ts +0 -14
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode, Ref, SyntheticEvent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { IReplaceTweakStylesProps } from '../../types';
|
|
3
3
|
import { IIcon } from '../Icon';
|
|
4
4
|
import { IInputProps } from '../Input';
|
|
5
5
|
import { ISearchInputProps } from '../SearchInput';
|
|
6
|
-
import { IChangeSelectEvent, IMultipleSelectValue, ISelectFooter } from './types';
|
|
6
|
+
import { IChangeSelectEvent, IFloatingDropdownOptions, IMultipleSelectValue, ISelectFooter } from './types';
|
|
7
7
|
import { ISelectStyles } from './Select.styles';
|
|
8
8
|
export interface ISelectProps<Value> extends Omit<IReplaceTweakStylesProps<IInputProps, ISelectStyles>, 'value' | 'onChange' | 'onBlur' | 'type'> {
|
|
9
9
|
header?: ReactNode;
|
|
@@ -18,7 +18,7 @@ export interface ISelectProps<Value> extends Omit<IReplaceTweakStylesProps<IInpu
|
|
|
18
18
|
debounceTime?: number;
|
|
19
19
|
/** @default 0 */
|
|
20
20
|
minSymbolsCountToOpenList?: number;
|
|
21
|
-
dropdownOptions?:
|
|
21
|
+
dropdownOptions?: IFloatingDropdownOptions;
|
|
22
22
|
/** @default 'chevron-down' */
|
|
23
23
|
dropdownIcon?: IIcon | null;
|
|
24
24
|
options: Value[] | readonly Value[];
|
|
@@ -36,7 +36,10 @@ export interface ISelectProps<Value> extends Omit<IReplaceTweakStylesProps<IInpu
|
|
|
36
36
|
onBlur?: (event: Event | SyntheticEvent) => void;
|
|
37
37
|
onType?: (value: string) => Promise<void>;
|
|
38
38
|
optionsFilter?: (options: Value[], query: string) => Value[];
|
|
39
|
-
|
|
39
|
+
/** @description Функция должна быть мемоизирована */
|
|
40
|
+
onOpen?: VoidFunction;
|
|
41
|
+
/** @description Функция должна быть мемоизирована */
|
|
42
|
+
onClose?: VoidFunction;
|
|
40
43
|
compareValuesOnChange?: (v1?: Value, v2?: Value) => boolean;
|
|
41
44
|
/** @description Функция должна быть мемоизирована с целью избежания ререндера */
|
|
42
45
|
convertValueToString?: (value: Value) => string | undefined;
|
|
@@ -2,8 +2,9 @@ import { ITweakStyles } from '../../theme';
|
|
|
2
2
|
import { IInputStyles } from '../Input';
|
|
3
3
|
import { ISearchInputStyles } from '../SearchInput';
|
|
4
4
|
import { IWithMessagesStyles } from '../WithMessages';
|
|
5
|
+
import { IWithPopupStyles } from '../WithPopup';
|
|
5
6
|
import { ISelectListStyles } from './components';
|
|
6
|
-
export declare const useStyles: import('../../theme').IUseStyles<"root" | "disabled" | "arrow" | "inputWrapper" | "
|
|
7
|
+
export declare const useStyles: import('../../theme').IUseStyles<"root" | "disabled" | "arrow" | "inputWrapper" | "activeArrow" | "counter">;
|
|
7
8
|
export declare const readonlyInputStyles: Partial<import('../../theme').IStyles<"input" | "withValue" | "inputContent" | "defaultWrapper" | "autoSizeWrapper" | "autoSized" | "withUnits" | "withLabel" | "fakeValue" | "units" | "focusedInput" | "disabledInput" | "invalidInput">> & Partial<{
|
|
8
9
|
tweakControlWrapper: import('..').IControlWrapperStyles;
|
|
9
10
|
tweakWithMessages: IWithMessagesStyles;
|
|
@@ -16,9 +17,11 @@ export declare const getInputStyles: ({ hasReadonlyInput, isMultiSelect, }: {
|
|
|
16
17
|
hasReadonlyInput: boolean;
|
|
17
18
|
isMultiSelect?: boolean;
|
|
18
19
|
}) => IInputStyles;
|
|
20
|
+
export declare const withPopupStyles: IWithPopupStyles;
|
|
19
21
|
export type ISelectStyles = ITweakStyles<typeof useStyles, {
|
|
20
22
|
tweakWithMessages: IWithMessagesStyles;
|
|
21
23
|
tweakInput: IInputStyles;
|
|
22
24
|
tweakSelectList: ISelectListStyles;
|
|
23
25
|
tweakSearchInput: ISearchInputStyles;
|
|
26
|
+
tweakWithPopup?: IWithPopupStyles;
|
|
24
27
|
}>;
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import { ChangeEvent, KeyboardEvent } from 'react';
|
|
2
2
|
import { IRenderNode } from '../../types';
|
|
3
3
|
import { IChangeInputEvent } from '../Input';
|
|
4
|
+
import { IWithPopupProps } from '../WithPopup';
|
|
4
5
|
export type IMultipleSelectValue<Value> = Array<NonNullable<Value>>;
|
|
5
6
|
export type IChangeSelectEvent = IChangeInputEvent | ChangeEvent<HTMLElement> | KeyboardEvent;
|
|
6
7
|
export type ISelectFooter<T> = IRenderNode<{
|
|
7
8
|
filteredOptions: T[];
|
|
8
9
|
}>;
|
|
10
|
+
export interface IFloatingDropdownOptions {
|
|
11
|
+
/** @default 'bottom-start' */
|
|
12
|
+
placement?: IWithPopupProps['placement'];
|
|
13
|
+
/** @default 4 */
|
|
14
|
+
popupOffset?: IWithPopupProps['popupOffset'];
|
|
15
|
+
/** @default false */
|
|
16
|
+
shouldRenderInBody?: IWithPopupProps['shouldRenderInBody'];
|
|
17
|
+
/** @default false */
|
|
18
|
+
shouldHideOnScroll?: IWithPopupProps['shouldHideOnScroll'];
|
|
19
|
+
/** @default true */
|
|
20
|
+
isMinWidthSameAsTrigger?: IWithPopupProps['isMinWidthSameAsTrigger'];
|
|
21
|
+
/** @default false */
|
|
22
|
+
canBeFlipped?: IWithPopupProps['canBeFlipped'];
|
|
23
|
+
flipOptions?: IWithPopupProps['flipOptions'];
|
|
24
|
+
middlewares?: IWithPopupProps['middlewares'];
|
|
25
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { Placement, Middleware, OffsetOptions, UseHoverProps, UseClickProps, UseFocusProps, UseDismissProps, UseTransitionStatusProps } from '@floating-ui/react';
|
|
1
|
+
import { Dispatch, FC, SetStateAction } from 'react';
|
|
2
|
+
import { Placement, Middleware, OffsetOptions, UseHoverProps, UseClickProps, UseFocusProps, UseDismissProps, UseTransitionStatusProps, FlipOptions, MiddlewareState } from '@floating-ui/react';
|
|
3
3
|
import { ICommonProps, IDataAttributes, IRenderNode } from '../../types';
|
|
4
4
|
import { IPopupArrowProps, IPopupEventType, IWithPopupChildrenProps, IWithPopupToggleEvent, IWithPopupTriggerProps } from './types';
|
|
5
5
|
import { IWithPopupStyles } from './WithPopup.styles';
|
|
6
6
|
export interface IWithPopupProps extends ICommonProps<IWithPopupStyles> {
|
|
7
7
|
trigger: IRenderNode<IWithPopupTriggerProps>;
|
|
8
8
|
children: IRenderNode<IWithPopupChildrenProps>;
|
|
9
|
+
state?: [boolean, Dispatch<SetStateAction<boolean>>];
|
|
9
10
|
middlewares?: Middleware[];
|
|
10
11
|
/** @default eventType === 'click' ? 'bottom-end' : 'top' */
|
|
11
12
|
placement?: Placement;
|
|
@@ -38,6 +39,7 @@ export interface IWithPopupProps extends ICommonProps<IWithPopupStyles> {
|
|
|
38
39
|
/** Должна ли минимальная ширина попапа быть равна ширине триггера
|
|
39
40
|
* @default false */
|
|
40
41
|
isMinWidthSameAsTrigger?: boolean;
|
|
42
|
+
flipOptions?: FlipOptions | ((state: MiddlewareState) => FlipOptions);
|
|
41
43
|
hoverOptions?: UseHoverProps;
|
|
42
44
|
clickOptions?: UseClickProps;
|
|
43
45
|
focusOptions?: UseFocusProps;
|
package/dist/helpers/misc.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { default as rgba } from 'hex-to-rgba';
|
|
|
4
4
|
/** @deprecated Используйте `toKebabCase` из `true-react-platform-helpers` */
|
|
5
5
|
export declare const transformToKebab: (string: string) => string;
|
|
6
6
|
export declare const getParentNode: (element: Element | ShadowRoot | Document) => Element;
|
|
7
|
-
export declare const hasExactParent: (element: Element, parent: Element) => boolean;
|
|
8
7
|
export declare const getStyleComputedProperty: (element: Element) => Partial<CSSStyleDeclaration>;
|
|
9
8
|
export declare const getScrollParent: (element: Element | Document) => Element;
|
|
10
9
|
export declare const isElementOffScreen: (element: HTMLElement, input?: HTMLElement) => boolean;
|