How to use the @hig/utils.combineEventHandlers function in @hig/utils

To help you get started, we’ve selected a few @hig/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Autodesk / hig / packages / flyout / src / Flyout.js View on Github external
renderChildren(onMouseEnter, onMouseLeave) {
    const { children } = this.props;
    const { handleChildClick } = this;

    if (typeof children === "function") {
      return children({ handleClick: handleChildClick });
    }

    if (React.Children.count(children) === 1) {
      return React.cloneElement(children, {
        onClick: combineEventHandlers(handleChildClick, children.props.onClick),
        onMouseEnter,
        onMouseLeave
      });
    }

    return children;
  }
github Autodesk / hig / packages / multi-downshift / src / MultiDownshift.js View on Github external
getRemoveButtonProps = ({ onClick, item, ...props } = {}) => {
    /**
     * @param {MouseEvent} event
     */
    const handleRemoveButtonClick = event => {
      event.stopPropagation();
      this.unselectItem(item);
    };

    const handleClick = combineEventHandlers(onClick, handleRemoveButtonClick);

    return {
      ...props,
      onClick: handleClick
    };
  };
github Autodesk / hig / packages / notifications-flyout / src / NotificationsFlyout.js View on Github external
return function renderNotification(notification) {
    const {
      content,
      featured,
      id,
      image,
      key,
      onDismiss,
      showDismissButton,
      timestamp,
      type,
      unread
    } = notification;

    const handleDismiss = combineEventHandlers(onDismiss, () =>
      dismissNotification(id)
    );

    return (
      
        {content}

@hig/utils

Non-component specific utility functions for HIG components

Apache-2.0
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Similar packages