How to use the @reach/utils.wrapEvent function in @reach/utils

To help you get started, we’ve selected a few @reach/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 reach / reach-ui / packages / combobox / src / index.js View on Github external
}
  };

  const inputValue =
    autocomplete && (state === NAVIGATING || state === INTERACTING)
      ? // When idle, we don't have a navigationValue on ArrowUp/Down
        navigationValue || controlledValue || value
      : controlledValue || value;

  return (
    
  );
});
github reach / reach-ui / packages / combobox / src / index.js View on Github external
const inputValue =
    autocomplete && (state === NAVIGATING || state === INTERACTING)
      ? // When idle, we don't have a navigationValue on ArrowUp/Down
        navigationValue || controlledValue || value
      : controlledValue || value;

  return (
    
  );
});
github reach / reach-ui / packages / combobox / src / index.js View on Github external
const Container = portal ? Popover : "div";

  const popupProps = portal
    ? {
        targetRef: inputRef,
        position: positionMatchWidth
      }
    : null;

  return (
    
  );
});
github reach / reach-ui / packages / listbox / src / index.js View on Github external
optionsRef.current.push({ value, valueText });
  });

  return (
    
      <span data-reach-listbox-option-text="">
        {typeof children === "function"
          ? children({ value, valueText })
          : children || valueText}
      </span>
    
  );
});
github reach / reach-ui / packages / slider / src / index.js View on Github external
disabled
  });

  return (
    <div aria-labelledby="{ariaLabelledBy}" aria-valuemax="{sliderMax}" aria-valuenow="{value}" aria-orientation="{orientation}" aria-valuetext="{valueText}" aria-valuemin="{sliderMin}" aria-disabled="{disabled}" tabindex="{disabled" role="slider"> {
        setHasFocus(false);
      })}
      onFocus={wrapEvent(onFocus, () =&gt; {
        setHasFocus(true);
      })}
      onKeyDown={wrapEvent(onKeyDown, onHandleKeyDown)}
      style={{
        position: "absolute",
        ...(isVertical ? { bottom: handlePosition } : { left: handlePosition }),
        ...style
      }}
      {...dataAttributes}
      {...props}
    /&gt;
  );
});</div>
github reach / reach-ui / packages / tooltip / src / index.js View on Github external
};

  const handleKeyDown = event => {
    if (event.key === "Enter" || event.key === " ") {
      transition("selectWithKeyboard");
    }
  };

  const trigger = {
    "aria-describedby": isVisible ? makeId("tooltip", id) : undefined,
    "data-reach-tooltip-trigger": "",
    ref,
    onMouseEnter: wrapEvent(onMouseEnter, handleMouseEnter),
    onMouseMove: wrapEvent(onMouseMove, handleMouseMove),
    onFocus: wrapEvent(onFocus, handleFocus),
    onBlur: wrapEvent(onBlur, handleBlur),
    onMouseLeave: wrapEvent(onMouseLeave, handleMouseLeave),
    onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
    onMouseDown: wrapEvent(onMouseDown, handleMouseDown)
  };

  const tooltip = {
    id,
    triggerRect,
    isVisible
  };

  return [trigger, tooltip, isVisible];
}
github reach / reach-ui / packages / slider / src / index.js View on Github external
return (
    <div aria-labelledby="{ariaLabelledBy}" aria-valuemax="{sliderMax}" aria-valuenow="{value}" aria-orientation="{orientation}" aria-valuetext="{valueText}" aria-valuemin="{sliderMin}" aria-disabled="{disabled}" tabindex="{disabled" role="slider"> {
        setHasFocus(false);
      })}
      onFocus={wrapEvent(onFocus, () =&gt; {
        setHasFocus(true);
      })}
      onKeyDown={wrapEvent(onKeyDown, onHandleKeyDown)}
      style={{
        position: "absolute",
        ...(isVertical ? { bottom: handlePosition } : { left: handlePosition }),
        ...style
      }}
      {...dataAttributes}
      {...props}
    /&gt;
  );
});
</div>
github reach / reach-ui / packages / combobox / examples / token-input.js View on Github external
function ExampleTokenbox({ onSelect, ...props }) {
  const handleSelect = () =&gt; {};
  return ;
}
github reach / reach-ui / packages / listbox / src / index.js View on Github external
const popupProps = portal
    ? {
        targetRef: buttonRef,
        position: positionMatchWidth
      }
    : {};

  return (
    
  );
});

@reach/utils

Internal, shared utilities for Reach UI.

MIT
Latest version published 2 years ago

Package Health Score

82 / 100
Full package analysis

Similar packages