@lumx/react 3.6.3-alpha.0 → 3.6.3-alpha.2

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 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 = 8;
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
- }), children)), usePortal) : null;
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", "style"];
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,9 @@ const Notification = /*#__PURE__*/forwardRef((props, ref) => {
8612
8620
  onClick,
8613
8621
  theme,
8614
8622
  type,
8615
- zIndex
8623
+ zIndex,
8624
+ usePortal,
8625
+ style
8616
8626
  } = props,
8617
8627
  forwardedProps = _objectWithoutProperties(props, _excluded$M);
8618
8628
  if (!DOCUMENT) {
@@ -8632,7 +8642,10 @@ const Notification = /*#__PURE__*/forwardRef((props, ref) => {
8632
8642
  }
8633
8643
  evt.stopPropagation();
8634
8644
  };
8635
- return type && isVisible ? /*#__PURE__*/createPortal(
8645
+ if (!type || !isVisible) {
8646
+ return null;
8647
+ }
8648
+ const notification =
8636
8649
  /*#__PURE__*/
8637
8650
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
8638
8651
  React.createElement("div", _extends({
@@ -8646,9 +8659,9 @@ const Notification = /*#__PURE__*/forwardRef((props, ref) => {
8646
8659
  prefix: CLASSNAME$I
8647
8660
  })),
8648
8661
  onClick: onClick,
8649
- style: {
8662
+ style: _objectSpread2(_objectSpread2({}, style), {}, {
8650
8663
  zIndex
8651
- }
8664
+ })
8652
8665
  }), /*#__PURE__*/React.createElement("div", {
8653
8666
  className: `${CLASSNAME$I}__icon`
8654
8667
  }, /*#__PURE__*/React.createElement(Icon, {
@@ -8662,7 +8675,8 @@ const Notification = /*#__PURE__*/forwardRef((props, ref) => {
8662
8675
  emphasis: Emphasis.medium,
8663
8676
  theme: theme,
8664
8677
  onClick: handleCallback
8665
- }, /*#__PURE__*/React.createElement("span", null, actionLabel)))), document.body) : null;
8678
+ }, /*#__PURE__*/React.createElement("span", null, actionLabel))));
8679
+ return usePortal ? /*#__PURE__*/createPortal(notification, document.body) : notification;
8666
8680
  });
8667
8681
  Notification.displayName = COMPONENT_NAME$L;
8668
8682
  Notification.className = CLASSNAME$I;