@lumx/react 4.28.1-alpha.0 → 4.29.0-next.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/index.d.ts CHANGED
@@ -3996,12 +3996,13 @@ declare const Navigation: Comp<NavigationProps, HTMLElement> & SubComponents;
3996
3996
  /**
3997
3997
  * Props of the notification action.
3998
3998
  * Without `as`: props of a `Button`, with a `label` used as its content.
3999
- * With `as`: props of that component, forwarded as they are.
3999
+ * With `as`: props of that component.
4000
+ * Both get the medium `emphasis` and the `theme` of the notification as defaults.
4000
4001
  */
4001
4002
  type NotificationActionProps<E extends ElementType$1 = typeof Button> = (Omit<ButtonProps, 'children'> & {
4002
4003
  as?: undefined;
4003
4004
  label?: string;
4004
- }) | (ComponentProps<E> & {
4005
+ }) | (HasPolymorphicAs$1<E> & {
4005
4006
  as: E;
4006
4007
  });
4007
4008
  /**
@@ -4042,13 +4043,9 @@ declare const COMPONENT_NAME$1 = "Notification";
4042
4043
  */
4043
4044
  declare const CLASSNAME$1: LumxClassName$1<typeof COMPONENT_NAME$1>;
4044
4045
  /**
4045
- * Notification component.
4046
- *
4047
- * @param props Component props.
4048
- * @param ref Component ref.
4049
- * @return React element.
4046
+ * Notification component type, generic on the `as` component of `actionProps`.
4050
4047
  */
4051
- declare const Notification: {
4048
+ type NotificationComponent = {
4052
4049
  <E extends ElementType$1 = typeof Button>(props: NotificationProps<E> & {
4053
4050
  ref?: Ref<HTMLDivElement>;
4054
4051
  }): ReactElement | null;
@@ -4057,6 +4054,14 @@ declare const Notification: {
4057
4054
  className: typeof CLASSNAME$1;
4058
4055
  defaultProps: Partial<NotificationProps>;
4059
4056
  };
4057
+ /**
4058
+ * Notification component.
4059
+ *
4060
+ * @param props Component props.
4061
+ * @param ref Component ref.
4062
+ * @return React element.
4063
+ */
4064
+ declare const Notification: NotificationComponent;
4060
4065
 
4061
4066
  /**
4062
4067
  * PopoverDialog props.
package/index.js CHANGED
@@ -17647,6 +17647,10 @@ const DEFAULT_PROPS$D = {
17647
17647
  usePortal: true
17648
17648
  };
17649
17649
 
17650
+ /**
17651
+ * Notification component type, generic on the `as` component of `actionProps`.
17652
+ */
17653
+
17650
17654
  /* eslint-disable react-hooks/rules-of-hooks, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
17651
17655
  /**
17652
17656
  * Notification component.
@@ -17682,15 +17686,18 @@ const Notification = forwardRef((props, ref) => {
17682
17686
  } = NOTIFICATION_CONFIGURATION[type] || {};
17683
17687
  const rootRef = useRef(null);
17684
17688
  const isVisible = useTransitionVisibility(rootRef, !!isOpen, NOTIFICATION_TRANSITION_DURATION);
17685
- const hasAction = Boolean(actionProps) || Boolean(onActionClick) && Boolean(actionLabel);
17686
17689
  const {
17687
17690
  as: Action,
17688
17691
  label: actionPropsLabel = actionLabel,
17689
- onClick: onActionPropsClick = onActionClick,
17692
+ onClick: onActionPropsClick,
17690
17693
  ...forwardedActionProps
17691
17694
  } = actionProps || {};
17695
+ // A `Button` without a label has no accessible name.
17696
+ const hasAction = Boolean(Action) || Boolean(actionPropsLabel) && Boolean(actionProps || onActionClick);
17692
17697
  const handleActionClick = evt => {
17693
- onActionPropsClick?.(evt);
17698
+ if (onActionPropsClick) onActionPropsClick(evt);
17699
+ // The deprecated callback is typed with no argument.
17700
+ else onActionClick?.();
17694
17701
  evt.stopPropagation();
17695
17702
  };
17696
17703
  const commonActionProps = {