@true-engineering/true-react-common-ui-kit 3.54.0 → 3.56.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 +11 -720
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/List/index.d.ts +2 -1
- package/dist/components/List/types.d.ts +4 -0
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/WithPopup/WithPopup.d.ts +11 -3
- package/dist/true-react-common-ui-kit.js +21 -15
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +21 -15
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/List/List.tsx +5 -2
- package/src/components/List/index.ts +2 -1
- package/src/components/List/types.ts +5 -0
- package/src/components/Select/components/SelectList/SelectList.tsx +1 -1
- package/src/components/Select/index.ts +1 -1
- package/src/components/WithPopup/WithPopup.tsx +29 -7
package/package.json
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
import { addDataAttributes } from '../../helpers';
|
|
9
9
|
import { ICommonProps } from '../../types';
|
|
10
10
|
import { WithPopup } from '../WithPopup';
|
|
11
|
-
import { IListItemProps,
|
|
11
|
+
import { IListItemProps, ListItem } from './components';
|
|
12
|
+
import { IListItem } from './types';
|
|
12
13
|
import { useStyles, IListStyles, withPopupStyles } from './List.styles';
|
|
13
14
|
|
|
14
15
|
export interface IListProps extends ICommonProps<IListStyles> {
|
|
@@ -29,9 +30,11 @@ export const List: FC<IListProps> = ({ items, testId, data, tweakStyles, onClick
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
const filteredItems = items.filter(({ isHidden }) => !isHidden);
|
|
34
|
+
|
|
32
35
|
return (
|
|
33
36
|
<div className={classes.root} {...addDataTestId(testId)} {...addDataAttributes(data)}>
|
|
34
|
-
{
|
|
37
|
+
{filteredItems.map((item, i) => {
|
|
35
38
|
const itemProps: IListItemProps = {
|
|
36
39
|
testId: getTestId(testId, `item-${i}`),
|
|
37
40
|
...item,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * from './List';
|
|
2
2
|
export type { IListStyles } from './List.styles';
|
|
3
|
-
export
|
|
3
|
+
export type { IListItem } from './types';
|
|
4
|
+
export { type IListItemStyles, type IListItemProps, ListItem } from './components';
|
|
@@ -84,7 +84,7 @@ export function SelectList<Value>({
|
|
|
84
84
|
})}
|
|
85
85
|
>
|
|
86
86
|
{isHeaderNotEmpty && <div className={classes.listHeader}>{customListHeader}</div>}
|
|
87
|
-
<div className={classes.list} {...addDataTestId(testId)}>
|
|
87
|
+
<div className={classes.list} {...addDataTestId(testId)} tabIndex={-1}>
|
|
88
88
|
{isLoading ? (
|
|
89
89
|
<div className={clsx(classes.cell, classes.loading)}>{loadingLabel}</div>
|
|
90
90
|
) : (
|
|
@@ -24,6 +24,10 @@ import {
|
|
|
24
24
|
useFocus,
|
|
25
25
|
FloatingArrow,
|
|
26
26
|
arrow,
|
|
27
|
+
UseClickProps,
|
|
28
|
+
UseFocusProps,
|
|
29
|
+
UseDismissProps,
|
|
30
|
+
UseTransitionStatusProps,
|
|
27
31
|
} from '@floating-ui/react';
|
|
28
32
|
import { ICommonProps, IDataAttributes, IRenderNode } from '../../types';
|
|
29
33
|
import { DEFAULT_OFFSET } from './constants';
|
|
@@ -46,8 +50,11 @@ export interface IWithPopupProps extends ICommonProps<IWithPopupStyles> {
|
|
|
46
50
|
placement?: Placement;
|
|
47
51
|
/** @default 'click' */
|
|
48
52
|
eventType?: IPopupEventType;
|
|
49
|
-
/**
|
|
50
|
-
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Используйте hoverOptions
|
|
55
|
+
* @default 0
|
|
56
|
+
*/
|
|
57
|
+
hoverDelay?: number;
|
|
51
58
|
/** @default 6 */
|
|
52
59
|
popupOffset?: OffsetOptions;
|
|
53
60
|
arrowProps?: IPopupArrowProps;
|
|
@@ -70,6 +77,11 @@ export interface IWithPopupProps extends ICommonProps<IWithPopupStyles> {
|
|
|
70
77
|
/** Должна ли минимальная ширина попапа быть равна ширине триггера
|
|
71
78
|
* @default false */
|
|
72
79
|
isMinWidthSameAsTrigger?: boolean;
|
|
80
|
+
hoverOptions?: UseHoverProps;
|
|
81
|
+
clickOptions?: UseClickProps;
|
|
82
|
+
focusOptions?: UseFocusProps;
|
|
83
|
+
dismissOptions?: UseDismissProps;
|
|
84
|
+
transitionOptions?: UseTransitionStatusProps;
|
|
73
85
|
onToggle?: (isActive: boolean, event?: IWithPopupToggleEvent) => void;
|
|
74
86
|
}
|
|
75
87
|
|
|
@@ -91,6 +103,11 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
91
103
|
isDisabled = false,
|
|
92
104
|
shouldShowArrow = false,
|
|
93
105
|
isMinWidthSameAsTrigger = false,
|
|
106
|
+
hoverOptions,
|
|
107
|
+
clickOptions,
|
|
108
|
+
focusOptions,
|
|
109
|
+
dismissOptions,
|
|
110
|
+
transitionOptions,
|
|
94
111
|
tweakStyles,
|
|
95
112
|
data,
|
|
96
113
|
testId,
|
|
@@ -130,22 +147,27 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
130
147
|
|
|
131
148
|
const hover = useHover(context, {
|
|
132
149
|
enabled: eventType === 'hover',
|
|
133
|
-
delay:
|
|
150
|
+
delay: { open: hoverDelay, close: 0 },
|
|
134
151
|
handleClose: safePolygon(),
|
|
152
|
+
...hoverOptions,
|
|
135
153
|
});
|
|
136
154
|
|
|
137
|
-
const focus = useFocus(context, { enabled: eventType === 'hover' });
|
|
155
|
+
const focus = useFocus(context, { enabled: eventType === 'hover', ...focusOptions });
|
|
138
156
|
|
|
139
|
-
const click = useClick(context, { enabled: eventType === 'click' });
|
|
157
|
+
const click = useClick(context, { enabled: eventType === 'click', ...clickOptions });
|
|
140
158
|
|
|
141
159
|
const dismiss = useDismiss(context, {
|
|
142
160
|
enabled: eventType === 'click',
|
|
143
161
|
ancestorScroll: shouldHideOnScroll,
|
|
162
|
+
...dismissOptions,
|
|
144
163
|
});
|
|
145
164
|
|
|
146
165
|
const { getFloatingProps, getReferenceProps } = useInteractions([hover, click, focus, dismiss]);
|
|
147
166
|
|
|
148
|
-
const { isMounted, status } = useTransitionStatus(context, {
|
|
167
|
+
const { isMounted, status } = useTransitionStatus(context, {
|
|
168
|
+
duration: { close: 500 },
|
|
169
|
+
...transitionOptions,
|
|
170
|
+
});
|
|
149
171
|
|
|
150
172
|
const referenceProps: IReferenceProps = getReferenceProps({
|
|
151
173
|
ref: refs.setReference,
|
|
@@ -189,7 +211,7 @@ export const WithPopup: FC<IWithPopupProps> = ({
|
|
|
189
211
|
style={floatingStyles}
|
|
190
212
|
className={classes.popup}
|
|
191
213
|
{...getFloatingProps()}
|
|
192
|
-
{...addDataAttributes(popupData)}
|
|
214
|
+
{...addDataAttributes(popupData, testId, 'popup')}
|
|
193
215
|
>
|
|
194
216
|
<div className={classes[`dropdown-${status}`]}>
|
|
195
217
|
{shouldShowArrow && (
|