@lumx/react 3.6.2 → 3.6.3-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.d.ts +3 -1
- package/index.js +22 -9
- package/index.js.map +1 -1
- package/package.json +4 -5
- package/src/components/notification/Notification.test.tsx +13 -1
- package/src/components/notification/Notification.tsx +41 -34
- package/src/components/notification/Notifications.stories.tsx +10 -0
- package/src/components/popover/Popover.stories.tsx +22 -0
- package/src/components/popover/Popover.tsx +16 -4
- package/src/components/popover/constants.ts +1 -1
- package/src/components/popover/usePopoverStyle.tsx +7 -1
- package/src/stories/controls/selectArgType.ts +4 -1
package/index.d.ts
CHANGED
|
@@ -748,7 +748,7 @@ declare type FitAnchorWidth = ValueOf<typeof FitAnchorWidth>;
|
|
|
748
748
|
/**
|
|
749
749
|
* Defines the props of the component.
|
|
750
750
|
*/
|
|
751
|
-
interface PopoverProps extends GenericProps {
|
|
751
|
+
interface PopoverProps extends GenericProps, HasTheme {
|
|
752
752
|
/** Reference to the DOM element used to set the position of the popover. */
|
|
753
753
|
anchorRef: React.RefObject<HTMLElement>;
|
|
754
754
|
/** Customize the root element. (Must accept ref forwarding and props forwarding!). */
|
|
@@ -1743,6 +1743,8 @@ interface NotificationProps extends GenericProps, HasTheme {
|
|
|
1743
1743
|
onActionClick?(): void;
|
|
1744
1744
|
/** On click callback. */
|
|
1745
1745
|
onClick?(): void;
|
|
1746
|
+
/** Whether the notification should be rendered into a DOM node that exists outside the DOM hierarchy of the parent component. */
|
|
1747
|
+
usePortal?: boolean;
|
|
1746
1748
|
}
|
|
1747
1749
|
/**
|
|
1748
1750
|
* Notification component.
|
package/index.js
CHANGED
|
@@ -6199,7 +6199,7 @@ const FitAnchorWidth = {
|
|
|
6199
6199
|
/**
|
|
6200
6200
|
* Arrow size (in pixel).
|
|
6201
6201
|
*/
|
|
6202
|
-
const ARROW_SIZE =
|
|
6202
|
+
const ARROW_SIZE = 14;
|
|
6203
6203
|
|
|
6204
6204
|
/**
|
|
6205
6205
|
* Popper js modifier to fit popover min width to the anchor width.
|
|
@@ -6318,7 +6318,7 @@ function usePopoverStyle(_ref5) {
|
|
|
6318
6318
|
name: 'arrow',
|
|
6319
6319
|
options: {
|
|
6320
6320
|
element: arrowElement,
|
|
6321
|
-
padding: ARROW_SIZE
|
|
6321
|
+
padding: ARROW_SIZE / 2
|
|
6322
6322
|
}
|
|
6323
6323
|
});
|
|
6324
6324
|
}
|
|
@@ -6387,7 +6387,7 @@ function usePopoverStyle(_ref5) {
|
|
|
6387
6387
|
};
|
|
6388
6388
|
}
|
|
6389
6389
|
|
|
6390
|
-
const _excluded$m = ["anchorRef", "as", "children", "className", "closeOnClickAway", "closeOnEscape", "elevation", "focusElement", "hasArrow", "isOpen", "onClose", "parentElement", "usePortal", "focusAnchorOnClose", "withFocusTrap", "boundaryRef", "fitToAnchorWidth", "fitWithinViewportHeight", "offset", "placement", "style", "zIndex"];
|
|
6390
|
+
const _excluded$m = ["anchorRef", "as", "children", "className", "closeOnClickAway", "closeOnEscape", "elevation", "focusElement", "hasArrow", "isOpen", "onClose", "parentElement", "usePortal", "focusAnchorOnClose", "withFocusTrap", "boundaryRef", "fitToAnchorWidth", "fitWithinViewportHeight", "offset", "placement", "style", "theme", "zIndex"];
|
|
6391
6391
|
|
|
6392
6392
|
/**
|
|
6393
6393
|
* Defines the props of the component.
|
|
@@ -6442,6 +6442,7 @@ const _InnerPopover = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
6442
6442
|
offset,
|
|
6443
6443
|
placement,
|
|
6444
6444
|
style,
|
|
6445
|
+
theme,
|
|
6445
6446
|
zIndex
|
|
6446
6447
|
} = props,
|
|
6447
6448
|
forwardedProps = _objectWithoutProperties(props, _excluded$m);
|
|
@@ -6521,6 +6522,7 @@ const _InnerPopover = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
6521
6522
|
ref: mergeRefs(setPopperElement, ref, clickAwayRef, contentRef),
|
|
6522
6523
|
className: classnames(className, handleBasicClasses({
|
|
6523
6524
|
prefix: CLASSNAME$i,
|
|
6525
|
+
theme,
|
|
6524
6526
|
elevation: Math.min(elevation || 0, 5),
|
|
6525
6527
|
position
|
|
6526
6528
|
})),
|
|
@@ -6532,7 +6534,12 @@ const _InnerPopover = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
6532
6534
|
ref: setArrowElement,
|
|
6533
6535
|
className: `${CLASSNAME$i}__arrow`,
|
|
6534
6536
|
style: styles.arrow
|
|
6535
|
-
}
|
|
6537
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
6538
|
+
viewBox: "0 0 14 14",
|
|
6539
|
+
"aria-hidden": true
|
|
6540
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
6541
|
+
d: "M8 3.49C7.62 2.82 6.66 2.82 6.27 3.48L.04 14 14.04 14 8 3.49Z"
|
|
6542
|
+
}))), children)), usePortal) : null;
|
|
6536
6543
|
});
|
|
6537
6544
|
_InnerPopover.displayName = COMPONENT_NAME$l;
|
|
6538
6545
|
|
|
@@ -8570,7 +8577,7 @@ const NOTIFICATION_CONFIGURATION = {
|
|
|
8570
8577
|
}
|
|
8571
8578
|
};
|
|
8572
8579
|
|
|
8573
|
-
const _excluded$M = ["actionLabel", "className", "content", "isOpen", "onActionClick", "onClick", "theme", "type", "zIndex"];
|
|
8580
|
+
const _excluded$M = ["actionLabel", "className", "content", "isOpen", "onActionClick", "onClick", "theme", "type", "zIndex", "usePortal"];
|
|
8574
8581
|
|
|
8575
8582
|
/**
|
|
8576
8583
|
* Defines the props of the component.
|
|
@@ -8591,7 +8598,8 @@ const CLASSNAME$I = getRootClassName(COMPONENT_NAME$L);
|
|
|
8591
8598
|
*/
|
|
8592
8599
|
const DEFAULT_PROPS$w = {
|
|
8593
8600
|
theme: Theme.light,
|
|
8594
|
-
zIndex: 9999
|
|
8601
|
+
zIndex: 9999,
|
|
8602
|
+
usePortal: true
|
|
8595
8603
|
};
|
|
8596
8604
|
|
|
8597
8605
|
/* eslint-disable react-hooks/rules-of-hooks, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
|
|
@@ -8612,7 +8620,8 @@ const Notification = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
8612
8620
|
onClick,
|
|
8613
8621
|
theme,
|
|
8614
8622
|
type,
|
|
8615
|
-
zIndex
|
|
8623
|
+
zIndex,
|
|
8624
|
+
usePortal
|
|
8616
8625
|
} = props,
|
|
8617
8626
|
forwardedProps = _objectWithoutProperties(props, _excluded$M);
|
|
8618
8627
|
if (!DOCUMENT) {
|
|
@@ -8632,7 +8641,10 @@ const Notification = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
8632
8641
|
}
|
|
8633
8642
|
evt.stopPropagation();
|
|
8634
8643
|
};
|
|
8635
|
-
|
|
8644
|
+
if (!type || !isVisible) {
|
|
8645
|
+
return null;
|
|
8646
|
+
}
|
|
8647
|
+
const notification =
|
|
8636
8648
|
/*#__PURE__*/
|
|
8637
8649
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
8638
8650
|
React.createElement("div", _extends({
|
|
@@ -8662,7 +8674,8 @@ const Notification = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
8662
8674
|
emphasis: Emphasis.medium,
|
|
8663
8675
|
theme: theme,
|
|
8664
8676
|
onClick: handleCallback
|
|
8665
|
-
}, /*#__PURE__*/React.createElement("span", null, actionLabel))))
|
|
8677
|
+
}, /*#__PURE__*/React.createElement("span", null, actionLabel))));
|
|
8678
|
+
return usePortal ? /*#__PURE__*/createPortal(notification, document.body) : notification;
|
|
8666
8679
|
});
|
|
8667
8680
|
Notification.displayName = COMPONENT_NAME$L;
|
|
8668
8681
|
Notification.className = CLASSNAME$I;
|