@true-engineering/true-react-common-ui-kit 3.55.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.55.0",
3
+ "version": "3.56.0",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -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
- /** @default 0 */
50
- hoverDelay?: UseHoverProps['delay'];
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: typeof hoverDelay === 'number' ? { open: hoverDelay, close: 0 } : hoverDelay,
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, { duration: { close: 500 } });
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 && (