@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, KeyboardEvent, MouseEvent } from 'react';
|
|
2
2
|
import { ICommonProps } from '../../types';
|
|
3
|
-
import {
|
|
3
|
+
import { IListItem } from './types';
|
|
4
4
|
import { IListStyles } from './List.styles';
|
|
5
5
|
export interface IListProps extends ICommonProps<IListStyles> {
|
|
6
6
|
items: IListItem[];
|
|
@@ -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';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { Placement, Middleware, OffsetOptions, UseHoverProps } from '@floating-ui/react';
|
|
2
|
+
import { Placement, Middleware, OffsetOptions, UseHoverProps, UseClickProps, UseFocusProps, UseDismissProps, UseTransitionStatusProps } 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';
|
|
@@ -11,8 +11,11 @@ export interface IWithPopupProps extends ICommonProps<IWithPopupStyles> {
|
|
|
11
11
|
placement?: Placement;
|
|
12
12
|
/** @default 'click' */
|
|
13
13
|
eventType?: IPopupEventType;
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Используйте hoverOptions
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
hoverDelay?: number;
|
|
16
19
|
/** @default 6 */
|
|
17
20
|
popupOffset?: OffsetOptions;
|
|
18
21
|
arrowProps?: IPopupArrowProps;
|
|
@@ -35,6 +38,11 @@ export interface IWithPopupProps extends ICommonProps<IWithPopupStyles> {
|
|
|
35
38
|
/** Должна ли минимальная ширина попапа быть равна ширине триггера
|
|
36
39
|
* @default false */
|
|
37
40
|
isMinWidthSameAsTrigger?: boolean;
|
|
41
|
+
hoverOptions?: UseHoverProps;
|
|
42
|
+
clickOptions?: UseClickProps;
|
|
43
|
+
focusOptions?: UseFocusProps;
|
|
44
|
+
dismissOptions?: UseDismissProps;
|
|
45
|
+
transitionOptions?: UseTransitionStatusProps;
|
|
38
46
|
onToggle?: (isActive: boolean, event?: IWithPopupToggleEvent) => void;
|
|
39
47
|
}
|
|
40
48
|
export declare const WithPopup: FC<IWithPopupProps>;
|
|
@@ -8096,7 +8096,7 @@ function _unsupported_iterable_to_array$m(o, minLen) {
|
|
|
8096
8096
|
return _array_like_to_array$m(o, minLen);
|
|
8097
8097
|
}
|
|
8098
8098
|
var WithPopup = function(param) {
|
|
8099
|
-
var trigger = param.trigger, children = param.children, _param_middlewares = param.middlewares, middlewares = _param_middlewares === void 0 ? [] : _param_middlewares, _param_eventType = param.eventType, eventType = _param_eventType === void 0 ? "click" : _param_eventType, _param_placement = param.placement, placement = _param_placement === void 0 ? eventType === "click" ? "bottom-end" : "top" : _param_placement, _param_hoverDelay = param.hoverDelay, hoverDelay = _param_hoverDelay === void 0 ? 0 : _param_hoverDelay, _param_popupOffset = param.popupOffset, popupOffset = _param_popupOffset === void 0 ? DEFAULT_OFFSET : _param_popupOffset, arrowProps = param.arrowProps, popupData = param.popupData, _param_shouldStopPropagation = param.shouldStopPropagation, shouldStopPropagation = _param_shouldStopPropagation === void 0 ? eventType === "click" : _param_shouldStopPropagation, _param_shouldHideOnScroll = param.shouldHideOnScroll, shouldHideOnScroll = _param_shouldHideOnScroll === void 0 ? false : _param_shouldHideOnScroll, _param_shouldRenderInBody = param.shouldRenderInBody, shouldRenderInBody = _param_shouldRenderInBody === void 0 ? true : _param_shouldRenderInBody, _param_canBeFlipped = param.canBeFlipped, canBeFlipped = _param_canBeFlipped === void 0 ? true : _param_canBeFlipped, _param_isTriggerWrapped = param.isTriggerWrapped, isTriggerWrapped = _param_isTriggerWrapped === void 0 ? eventType === "hover" : _param_isTriggerWrapped, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, _param_shouldShowArrow = param.shouldShowArrow, shouldShowArrow = _param_shouldShowArrow === void 0 ? false : _param_shouldShowArrow, _param_isMinWidthSameAsTrigger = param.isMinWidthSameAsTrigger, isMinWidthSameAsTrigger = _param_isMinWidthSameAsTrigger === void 0 ? false : _param_isMinWidthSameAsTrigger, tweakStyles = param.tweakStyles, data = param.data, testId = param.testId, onToggle = param.onToggle;
|
|
8099
|
+
var trigger = param.trigger, children = param.children, _param_middlewares = param.middlewares, middlewares = _param_middlewares === void 0 ? [] : _param_middlewares, _param_eventType = param.eventType, eventType = _param_eventType === void 0 ? "click" : _param_eventType, _param_placement = param.placement, placement = _param_placement === void 0 ? eventType === "click" ? "bottom-end" : "top" : _param_placement, _param_hoverDelay = param.hoverDelay, hoverDelay = _param_hoverDelay === void 0 ? 0 : _param_hoverDelay, _param_popupOffset = param.popupOffset, popupOffset = _param_popupOffset === void 0 ? DEFAULT_OFFSET : _param_popupOffset, arrowProps = param.arrowProps, popupData = param.popupData, _param_shouldStopPropagation = param.shouldStopPropagation, shouldStopPropagation = _param_shouldStopPropagation === void 0 ? eventType === "click" : _param_shouldStopPropagation, _param_shouldHideOnScroll = param.shouldHideOnScroll, shouldHideOnScroll = _param_shouldHideOnScroll === void 0 ? false : _param_shouldHideOnScroll, _param_shouldRenderInBody = param.shouldRenderInBody, shouldRenderInBody = _param_shouldRenderInBody === void 0 ? true : _param_shouldRenderInBody, _param_canBeFlipped = param.canBeFlipped, canBeFlipped = _param_canBeFlipped === void 0 ? true : _param_canBeFlipped, _param_isTriggerWrapped = param.isTriggerWrapped, isTriggerWrapped = _param_isTriggerWrapped === void 0 ? eventType === "hover" : _param_isTriggerWrapped, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, _param_shouldShowArrow = param.shouldShowArrow, shouldShowArrow = _param_shouldShowArrow === void 0 ? false : _param_shouldShowArrow, _param_isMinWidthSameAsTrigger = param.isMinWidthSameAsTrigger, isMinWidthSameAsTrigger = _param_isMinWidthSameAsTrigger === void 0 ? false : _param_isMinWidthSameAsTrigger, hoverOptions = param.hoverOptions, clickOptions = param.clickOptions, focusOptions = param.focusOptions, dismissOptions = param.dismissOptions, transitionOptions = param.transitionOptions, tweakStyles = param.tweakStyles, data = param.data, testId = param.testId, onToggle = param.onToggle;
|
|
8100
8100
|
var classes = useStyles$U({
|
|
8101
8101
|
theme: tweakStyles
|
|
8102
8102
|
});
|
|
@@ -8129,35 +8129,35 @@ var WithPopup = function(param) {
|
|
|
8129
8129
|
placement,
|
|
8130
8130
|
onOpenChange: handleToggle
|
|
8131
8131
|
}), refs = _useFloating.refs, floatingStyles = _useFloating.floatingStyles, context = _useFloating.context;
|
|
8132
|
-
var hover = useHover(context, {
|
|
8132
|
+
var hover = useHover(context, _object_spread$_({
|
|
8133
8133
|
enabled: eventType === "hover",
|
|
8134
|
-
delay:
|
|
8134
|
+
delay: {
|
|
8135
8135
|
open: hoverDelay,
|
|
8136
8136
|
close: 0
|
|
8137
|
-
}
|
|
8137
|
+
},
|
|
8138
8138
|
handleClose: safePolygon()
|
|
8139
|
-
});
|
|
8140
|
-
var focus = useFocus(context, {
|
|
8139
|
+
}, hoverOptions));
|
|
8140
|
+
var focus = useFocus(context, _object_spread$_({
|
|
8141
8141
|
enabled: eventType === "hover"
|
|
8142
|
-
});
|
|
8143
|
-
var click = useClick(context, {
|
|
8142
|
+
}, focusOptions));
|
|
8143
|
+
var click = useClick(context, _object_spread$_({
|
|
8144
8144
|
enabled: eventType === "click"
|
|
8145
|
-
});
|
|
8146
|
-
var dismiss = useDismiss(context, {
|
|
8145
|
+
}, clickOptions));
|
|
8146
|
+
var dismiss = useDismiss(context, _object_spread$_({
|
|
8147
8147
|
enabled: eventType === "click",
|
|
8148
8148
|
ancestorScroll: shouldHideOnScroll
|
|
8149
|
-
});
|
|
8149
|
+
}, dismissOptions));
|
|
8150
8150
|
var _useInteractions = useInteractions([
|
|
8151
8151
|
hover,
|
|
8152
8152
|
click,
|
|
8153
8153
|
focus,
|
|
8154
8154
|
dismiss
|
|
8155
8155
|
]), getFloatingProps = _useInteractions.getFloatingProps, getReferenceProps = _useInteractions.getReferenceProps;
|
|
8156
|
-
var _useTransitionStatus = useTransitionStatus(context, {
|
|
8156
|
+
var _useTransitionStatus = useTransitionStatus(context, _object_spread$_({
|
|
8157
8157
|
duration: {
|
|
8158
8158
|
close: 500
|
|
8159
8159
|
}
|
|
8160
|
-
}), isMounted = _useTransitionStatus.isMounted, status = _useTransitionStatus.status;
|
|
8160
|
+
}, transitionOptions)), isMounted = _useTransitionStatus.isMounted, status = _useTransitionStatus.status;
|
|
8161
8161
|
var referenceProps = getReferenceProps(_object_spread$_({
|
|
8162
8162
|
ref: refs.setReference
|
|
8163
8163
|
}, shouldStopPropagation && {
|
|
@@ -8187,7 +8187,7 @@ var WithPopup = function(param) {
|
|
|
8187
8187
|
ref: refs.setFloating,
|
|
8188
8188
|
style: floatingStyles,
|
|
8189
8189
|
className: classes.popup
|
|
8190
|
-
}, getFloatingProps(), addDataAttributes$1(popupData)), {
|
|
8190
|
+
}, getFloatingProps(), addDataAttributes$1(popupData, testId, "popup")), {
|
|
8191
8191
|
children: /* @__PURE__ */ jsxs("div", {
|
|
8192
8192
|
className: classes["dropdown-".concat(status)],
|
|
8193
8193
|
children: [
|
|
@@ -8425,10 +8425,14 @@ var List = function(param) {
|
|
|
8425
8425
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
8426
8426
|
}
|
|
8427
8427
|
};
|
|
8428
|
+
var filteredItems = items.filter(function(param2) {
|
|
8429
|
+
var isHidden = param2.isHidden;
|
|
8430
|
+
return !isHidden;
|
|
8431
|
+
});
|
|
8428
8432
|
return /* @__PURE__ */ jsx("div", _object_spread_props$P(_object_spread$Y({
|
|
8429
8433
|
className: classes.root
|
|
8430
8434
|
}, addDataTestId(testId), addDataAttributes(data)), {
|
|
8431
|
-
children:
|
|
8435
|
+
children: filteredItems.map(function(item, i) {
|
|
8432
8436
|
var itemProps = _object_spread_props$P(_object_spread$Y({
|
|
8433
8437
|
testId: getTestId(testId, "item-".concat(i))
|
|
8434
8438
|
}, item), {
|
|
@@ -11338,6 +11342,7 @@ function SelectList(param) {
|
|
|
11338
11342
|
/* @__PURE__ */ jsx("div", _object_spread_props$E(_object_spread$J({
|
|
11339
11343
|
className: classes.list
|
|
11340
11344
|
}, addDataTestId(testId)), {
|
|
11345
|
+
tabIndex: -1,
|
|
11341
11346
|
children: isLoading ? /* @__PURE__ */ jsx("div", {
|
|
11342
11347
|
className: clsx(classes.cell, classes.loading),
|
|
11343
11348
|
children: loadingLabel
|
|
@@ -32381,6 +32386,7 @@ export {
|
|
|
32381
32386
|
ScrollIntoViewIfNeeded,
|
|
32382
32387
|
SearchInput,
|
|
32383
32388
|
Select,
|
|
32389
|
+
SelectList,
|
|
32384
32390
|
Selector,
|
|
32385
32391
|
Skeleton,
|
|
32386
32392
|
SmartInput,
|