@true-engineering/true-react-common-ui-kit 3.13.0 → 3.14.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 +13 -0
- package/dist/components/NewMoreMenu/NewMoreMenu.d.ts +1 -1
- package/dist/components/WithPopup/WithPopup.d.ts +2 -0
- package/dist/true-react-common-ui-kit.js +17 -10
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +16 -9
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/IconButton/IconButton.styles.ts +0 -4
- package/src/components/NewMoreMenu/NewMoreMenu.stories.tsx +1 -0
- package/src/components/NewMoreMenu/NewMoreMenu.tsx +6 -1
- package/src/components/WithPopup/WithPopup.stories.tsx +1 -0
- package/src/components/WithPopup/WithPopup.tsx +13 -4
package/README.md
CHANGED
|
@@ -10,6 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
# Release Notes
|
|
12
12
|
|
|
13
|
+
## v3.14.0
|
|
14
|
+
|
|
15
|
+
### Changes
|
|
16
|
+
|
|
17
|
+
- **WithPopup**: добавлена пропса `canBeFlipped` для автоматического позиционирования
|
|
18
|
+
- **NewMoreMenu**: добавлена пропса `canBeFlipped`
|
|
19
|
+
|
|
20
|
+
## v3.13.1
|
|
21
|
+
|
|
22
|
+
### Changes
|
|
23
|
+
|
|
24
|
+
- Багфикс warning в стилях **IconButton**
|
|
25
|
+
|
|
13
26
|
## v3.13.0
|
|
14
27
|
|
|
15
28
|
### Changes
|
|
@@ -3,7 +3,7 @@ import { ICommonProps } from '../../types';
|
|
|
3
3
|
import { IListItem } from '../List';
|
|
4
4
|
import { IWithPopupProps } from '../WithPopup';
|
|
5
5
|
import { INewMoreMenuStyles } from './NewMoreMenu.styles';
|
|
6
|
-
export interface INewMoreMenuProps extends Pick<IWithPopupProps, 'middlewares' | 'shouldHideOnScroll' | 'shouldRenderInBody'>, ICommonProps<INewMoreMenuStyles> {
|
|
6
|
+
export interface INewMoreMenuProps extends Pick<IWithPopupProps, 'middlewares' | 'shouldHideOnScroll' | 'shouldRenderInBody' | 'canBeFlipped'>, ICommonProps<INewMoreMenuStyles> {
|
|
7
7
|
items: IListItem[];
|
|
8
8
|
/** @default false */
|
|
9
9
|
isDisabled?: boolean;
|
|
@@ -24,6 +24,8 @@ export interface IWithPopupProps extends ICommonProps<IWithPopupStyles> {
|
|
|
24
24
|
/** @default 6 */
|
|
25
25
|
popupOffset?: number;
|
|
26
26
|
/** @default false */
|
|
27
|
+
canBeFlipped?: boolean;
|
|
28
|
+
/** @default false */
|
|
27
29
|
isDisabled?: boolean;
|
|
28
30
|
onToggle?: (isActive: boolean) => void;
|
|
29
31
|
}
|
|
@@ -12,7 +12,7 @@ import scrollIntoViewIfNeeded from "scroll-into-view-if-needed";
|
|
|
12
12
|
import ReactDatePicker from "react-datepicker";
|
|
13
13
|
import { hasFlag } from "country-flag-icons";
|
|
14
14
|
import { RemoveScroll } from "react-remove-scroll";
|
|
15
|
-
import {
|
|
15
|
+
import { offset as offset$2, flip as flip$2, useFloating, autoUpdate, useHover, useClick, useDismiss, useInteractions, FloatingPortal } from "@floating-ui/react";
|
|
16
16
|
var jsxRuntime = { exports: {} };
|
|
17
17
|
var reactJsxRuntime_production_min = {};
|
|
18
18
|
/**
|
|
@@ -25295,9 +25295,6 @@ var useStyles$k = createThemedStyles("IconButton", {
|
|
|
25295
25295
|
pointerEvents: "none"
|
|
25296
25296
|
},
|
|
25297
25297
|
loading: {
|
|
25298
|
-
"& $content": {
|
|
25299
|
-
visibility: "hidden"
|
|
25300
|
-
},
|
|
25301
25298
|
"& $loader": {
|
|
25302
25299
|
display: "block"
|
|
25303
25300
|
}
|
|
@@ -30235,13 +30232,24 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
30235
30232
|
return _array_like_to_array(o, minLen);
|
|
30236
30233
|
}
|
|
30237
30234
|
var WithPopup = function(param) {
|
|
30238
|
-
var trigger = param.trigger, children = param.children,
|
|
30235
|
+
var trigger = param.trigger, children = param.children, initialMiddlewares = 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_shouldHideOnScroll = param.shouldHideOnScroll, shouldHideOnScroll = _param_shouldHideOnScroll === void 0 ? false : _param_shouldHideOnScroll, _param_shouldRenderInBody = param.shouldRenderInBody, shouldRenderInBody = _param_shouldRenderInBody === void 0 ? false : _param_shouldRenderInBody, _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, _param_canBeFlipped = param.canBeFlipped, canBeFlipped = _param_canBeFlipped === void 0 ? false : _param_canBeFlipped, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, tweakStyles = param.tweakStyles, data = param.data, testId = param.testId, onToggle = param.onToggle;
|
|
30239
30236
|
var classes = useStyles$1({
|
|
30240
30237
|
theme: tweakStyles
|
|
30241
30238
|
});
|
|
30242
30239
|
var _useState = _sliced_to_array(useState(false), 2), isOpen = _useState[0], setIsOpen = _useState[1];
|
|
30243
30240
|
var Trigger = trigger;
|
|
30244
30241
|
var Popup = children;
|
|
30242
|
+
var middleware = useMemo(function() {
|
|
30243
|
+
return [
|
|
30244
|
+
offset$2(popupOffset)
|
|
30245
|
+
].concat(_to_consumable_array(canBeFlipped ? [
|
|
30246
|
+
flip$2()
|
|
30247
|
+
] : []), _to_consumable_array(initialMiddlewares !== null && initialMiddlewares !== void 0 ? initialMiddlewares : []));
|
|
30248
|
+
}, [
|
|
30249
|
+
popupOffset,
|
|
30250
|
+
canBeFlipped,
|
|
30251
|
+
initialMiddlewares
|
|
30252
|
+
]);
|
|
30245
30253
|
var handleToggle = function(isActive, event) {
|
|
30246
30254
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
30247
30255
|
if (!isDisabled) {
|
|
@@ -30254,9 +30262,7 @@ var WithPopup = function(param) {
|
|
|
30254
30262
|
};
|
|
30255
30263
|
var _useFloating = useFloating({
|
|
30256
30264
|
open: isOpen,
|
|
30257
|
-
middleware
|
|
30258
|
-
offset$2(popupOffset)
|
|
30259
|
-
].concat(_to_consumable_array(middlewares !== null && middlewares !== void 0 ? middlewares : [])),
|
|
30265
|
+
middleware,
|
|
30260
30266
|
whileElementsMounted: autoUpdate,
|
|
30261
30267
|
placement,
|
|
30262
30268
|
onOpenChange: handleToggle
|
|
@@ -30282,7 +30288,7 @@ var WithPopup = function(param) {
|
|
|
30282
30288
|
]), getReferenceProps = _useInteractions.getReferenceProps, getFloatingProps = _useInteractions.getFloatingProps;
|
|
30283
30289
|
return /* @__PURE__ */ jsxs("div", _object_spread_props$1(_object_spread$1(_object_spread_props$1(_object_spread$1({
|
|
30284
30290
|
ref: refs.setReference
|
|
30285
|
-
}, getReferenceProps), {
|
|
30291
|
+
}, getReferenceProps()), {
|
|
30286
30292
|
className: clsx(classes.root, _define_property$1({}, classes.disabled, isDisabled))
|
|
30287
30293
|
}), addDataTestId(testId), addDataAttributes(data)), {
|
|
30288
30294
|
children: [
|
|
@@ -30390,7 +30396,7 @@ function _object_spread_props(target, source) {
|
|
|
30390
30396
|
return target;
|
|
30391
30397
|
}
|
|
30392
30398
|
var NewMoreMenu = function(param) {
|
|
30393
|
-
var items = param.items, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, _param_hasDefaultStateBackground = param.hasDefaultStateBackground, hasDefaultStateBackground = _param_hasDefaultStateBackground === void 0 ? true : _param_hasDefaultStateBackground, data = param.data, testId = param.testId, placement = param.placement, middlewares = param.middlewares, shouldHideOnScroll = param.shouldHideOnScroll, shouldRenderInBody = param.shouldRenderInBody, tweakStyles = param.tweakStyles;
|
|
30399
|
+
var items = param.items, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, _param_hasDefaultStateBackground = param.hasDefaultStateBackground, hasDefaultStateBackground = _param_hasDefaultStateBackground === void 0 ? true : _param_hasDefaultStateBackground, data = param.data, testId = param.testId, placement = param.placement, middlewares = param.middlewares, shouldHideOnScroll = param.shouldHideOnScroll, shouldRenderInBody = param.shouldRenderInBody, canBeFlipped = param.canBeFlipped, tweakStyles = param.tweakStyles;
|
|
30394
30400
|
var classes = useStyles({
|
|
30395
30401
|
theme: tweakStyles
|
|
30396
30402
|
});
|
|
@@ -30410,6 +30416,7 @@ var NewMoreMenu = function(param) {
|
|
|
30410
30416
|
middlewares,
|
|
30411
30417
|
shouldHideOnScroll,
|
|
30412
30418
|
shouldRenderInBody,
|
|
30419
|
+
canBeFlipped,
|
|
30413
30420
|
isDisabled: isButtonDisabled,
|
|
30414
30421
|
tweakStyles: tweakWithPopupStyles,
|
|
30415
30422
|
trigger: function(param2) {
|