@lumx/react 3.16.0 → 3.16.1-alpha.1
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/index.js +16 -24
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/dialog/Dialog.tsx +89 -90
- package/src/components/lightbox/Lightbox.tsx +47 -47
- package/src/components/notification/Notification.tsx +33 -32
- package/src/components/popover/Popover.tsx +33 -39
- package/src/components/tooltip/Tooltip.tsx +6 -6
- package/src/utils/PortalProvider/PortalProvider.stories.jsx +33 -0
- package/src/utils/PortalProvider/index.tsx +36 -0
- package/src/utils/index.ts +1 -0
- package/utils/index.d.ts +22 -1
- package/utils/index.js +34 -1
- package/utils/index.js.map +1 -1
package/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import isBoolean from 'lodash/isBoolean';
|
|
|
4
4
|
import isEmpty from 'lodash/isEmpty';
|
|
5
5
|
import kebabCase from 'lodash/kebabCase';
|
|
6
6
|
import noop from 'lodash/noop';
|
|
7
|
-
import ReactDOM, { createPortal } from 'react-dom';
|
|
8
7
|
import last from 'lodash/last';
|
|
9
8
|
import pull from 'lodash/pull';
|
|
10
9
|
import get from 'lodash/get';
|
|
@@ -12,7 +11,7 @@ import concat from 'lodash/concat';
|
|
|
12
11
|
import dropRight from 'lodash/dropRight';
|
|
13
12
|
import partition from 'lodash/partition';
|
|
14
13
|
import reduce from 'lodash/reduce';
|
|
15
|
-
import { ClickAwayProvider } from './utils/index.js';
|
|
14
|
+
import { Portal, ClickAwayProvider } from './utils/index.js';
|
|
16
15
|
import memoize from 'lodash/memoize';
|
|
17
16
|
import isFunction from 'lodash/isFunction';
|
|
18
17
|
import castArray from 'lodash/castArray';
|
|
@@ -21,6 +20,7 @@ import isInteger from 'lodash/isInteger';
|
|
|
21
20
|
import throttle from 'lodash/throttle';
|
|
22
21
|
import range from 'lodash/range';
|
|
23
22
|
import chunk from 'lodash/chunk';
|
|
23
|
+
import ReactDOM from 'react-dom';
|
|
24
24
|
import take from 'lodash/take';
|
|
25
25
|
import isObject from 'lodash/isObject';
|
|
26
26
|
import set from 'lodash/set';
|
|
@@ -3284,7 +3284,7 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
3284
3284
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
3285
3285
|
const isVisible = useTransitionVisibility(rootRef, Boolean(isOpen), DIALOG_TRANSITION_DURATION, onVisibilityChange);
|
|
3286
3286
|
const shouldPreventCloseOnClickAway = preventAutoClose || preventCloseOnClick;
|
|
3287
|
-
return isOpen || isVisible ? /*#__PURE__*/
|
|
3287
|
+
return isOpen || isVisible ? /*#__PURE__*/React__default.createElement(Portal, null, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
3288
3288
|
ref: mergeRefs(rootRef, ref)
|
|
3289
3289
|
}, forwardedProps, {
|
|
3290
3290
|
className: classNames(className, handleBasicClasses({
|
|
@@ -3331,7 +3331,7 @@ const Dialog = forwardRef((props, ref) => {
|
|
|
3331
3331
|
className: `${CLASSNAME$16}__progress-overlay`
|
|
3332
3332
|
}, /*#__PURE__*/React__default.createElement(Progress, {
|
|
3333
3333
|
variant: ProgressVariant.circular
|
|
3334
|
-
}))))))))
|
|
3334
|
+
}))))))))) : null;
|
|
3335
3335
|
});
|
|
3336
3336
|
Dialog.displayName = COMPONENT_NAME$16;
|
|
3337
3337
|
Dialog.className = CLASSNAME$16;
|
|
@@ -6641,11 +6641,6 @@ const DEFAULT_PROPS$P = {
|
|
|
6641
6641
|
zIndex: POPOVER_ZINDEX
|
|
6642
6642
|
};
|
|
6643
6643
|
|
|
6644
|
-
/** Method to render the popover inside a portal if usePortal is true */
|
|
6645
|
-
const renderPopover = (children, usePortal) => {
|
|
6646
|
-
return usePortal ? /*#__PURE__*/createPortal(children, document.body) : children;
|
|
6647
|
-
};
|
|
6648
|
-
|
|
6649
6644
|
// Inner component (must be wrapped before export)
|
|
6650
6645
|
const _InnerPopover = forwardRef((props, ref) => {
|
|
6651
6646
|
var _styles$popover;
|
|
@@ -6709,7 +6704,9 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
6709
6704
|
useFocusTrap(withFocusTrap && isOpen && focusZoneElement, focusElement === null || focusElement === void 0 ? void 0 : focusElement.current);
|
|
6710
6705
|
const clickAwayRefs = useRef([popoverRef, anchorRef]);
|
|
6711
6706
|
const mergedRefs = useMergeRefs(setPopperElement, ref, popoverRef);
|
|
6712
|
-
return isOpen ?
|
|
6707
|
+
return isOpen ? /*#__PURE__*/React__default.createElement(Portal, {
|
|
6708
|
+
enabled: usePortal
|
|
6709
|
+
}, /*#__PURE__*/React__default.createElement(Component, _extends({}, forwardedProps, {
|
|
6713
6710
|
ref: mergedRefs,
|
|
6714
6711
|
className: classNames(className, handleBasicClasses({
|
|
6715
6712
|
prefix: CLASSNAME$11,
|
|
@@ -6733,7 +6730,7 @@ const _InnerPopover = forwardRef((props, ref) => {
|
|
|
6733
6730
|
d: "M8 3.49C7.62 2.82 6.66 2.82 6.27 3.48L.04 14 14.04 14 8 3.49Z"
|
|
6734
6731
|
}))), /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
6735
6732
|
value: theme
|
|
6736
|
-
}, children)))
|
|
6733
|
+
}, children)))) : null;
|
|
6737
6734
|
});
|
|
6738
6735
|
_InnerPopover.displayName = COMPONENT_NAME$11;
|
|
6739
6736
|
|
|
@@ -8896,10 +8893,7 @@ const Lightbox = forwardRef((props, ref) => {
|
|
|
8896
8893
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
8897
8894
|
const clickAwayRefs = useRef([wrapperRef]);
|
|
8898
8895
|
if (!isOpen && !isVisible) return null;
|
|
8899
|
-
return /*#__PURE__*/
|
|
8900
|
-
/*#__PURE__*/
|
|
8901
|
-
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */
|
|
8902
|
-
React__default.createElement("div", _extends({
|
|
8896
|
+
return /*#__PURE__*/React__default.createElement(Portal, null, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
8903
8897
|
ref: mergeRefs(ref, wrapperRef)
|
|
8904
8898
|
}, forwardedProps, {
|
|
8905
8899
|
"aria-label": ariaLabel,
|
|
@@ -8937,7 +8931,7 @@ const Lightbox = forwardRef((props, ref) => {
|
|
|
8937
8931
|
ref: childrenRef,
|
|
8938
8932
|
className: `${CLASSNAME$M}__wrapper`,
|
|
8939
8933
|
role: "presentation"
|
|
8940
|
-
}, children)))))
|
|
8934
|
+
}, children))))));
|
|
8941
8935
|
});
|
|
8942
8936
|
Lightbox.displayName = COMPONENT_NAME$M;
|
|
8943
8937
|
Lightbox.className = CLASSNAME$M;
|
|
@@ -9657,10 +9651,9 @@ const Notification = forwardRef((props, ref) => {
|
|
|
9657
9651
|
if (!type || !isVisible) {
|
|
9658
9652
|
return null;
|
|
9659
9653
|
}
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
React__default.createElement("div", _extends({
|
|
9654
|
+
return /*#__PURE__*/React__default.createElement(Portal, {
|
|
9655
|
+
enabled: usePortal
|
|
9656
|
+
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
9664
9657
|
ref: mergeRefs(ref, rootRef),
|
|
9665
9658
|
role: "alert"
|
|
9666
9659
|
}, forwardedProps, {
|
|
@@ -9687,8 +9680,7 @@ const Notification = forwardRef((props, ref) => {
|
|
|
9687
9680
|
emphasis: Emphasis.medium,
|
|
9688
9681
|
theme: theme,
|
|
9689
9682
|
onClick: handleCallback
|
|
9690
|
-
}, /*#__PURE__*/React__default.createElement("span", null, actionLabel))));
|
|
9691
|
-
return usePortal ? /*#__PURE__*/createPortal(notification, document.body) : notification;
|
|
9683
|
+
}, /*#__PURE__*/React__default.createElement("span", null, actionLabel)))), ");");
|
|
9692
9684
|
});
|
|
9693
9685
|
Notification.displayName = COMPONENT_NAME$C;
|
|
9694
9686
|
Notification.className = CLASSNAME$C;
|
|
@@ -14159,7 +14151,7 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
14159
14151
|
}, [isOpen, update, popperElement]);
|
|
14160
14152
|
const labelLines = label ? label.split('\n') : [];
|
|
14161
14153
|
const tooltipRef = useMergeRefs(ref, setPopperElement, onPopperMount);
|
|
14162
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TooltipContextProvider, null, wrappedChildren), isMounted && /*#__PURE__*/
|
|
14154
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TooltipContextProvider, null, wrappedChildren), isMounted && /*#__PURE__*/React__default.createElement(Portal, null, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
14163
14155
|
ref: tooltipRef
|
|
14164
14156
|
}, forwardedProps, {
|
|
14165
14157
|
id: id,
|
|
@@ -14178,7 +14170,7 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
14178
14170
|
className: `${CLASSNAME$2}__inner`
|
|
14179
14171
|
}, labelLines.map(line => /*#__PURE__*/React__default.createElement("p", {
|
|
14180
14172
|
key: line
|
|
14181
|
-
}, line))))
|
|
14173
|
+
}, line))))));
|
|
14182
14174
|
});
|
|
14183
14175
|
Tooltip.displayName = COMPONENT_NAME$2;
|
|
14184
14176
|
Tooltip.className = CLASSNAME$2;
|