How to use the @paprika/helpers/lib/dom/isElementContainsFocus function in @paprika/helpers

To help you get started, we’ve selected a few @paprika/helpers 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 acl-services / paprika / packages / DatePicker / src / DatePicker.js View on Github external
function handleResetPossibleDate() {
    setPossibleDate(null);
  }

  function handleSelect(selectedDate) {
    setHasParsingError(false);
    hideCalendar();
    handleChange(selectedDate);
  }

  const hasInputError = extendedInputProps && extendedInputProps.hasError;

  const hasErrorValue = hasError || hasParsingError || hasInputError;

  const inputText =
    (inputRef && isElementContainsFocus(inputRef.current)) || hasErrorValue
      ? inputtedString
      : formatDateProp(humanFormat);

  return (
    
      <input>}
        id={id}
        isDisabled={isDisabled}
github acl-services / paprika / packages / DatePicker / src / DatePicker.js View on Github external
function handleClosePopover() {
    if (!isElementContainsFocus(calendarRef.current) && !isElementContainsFocus(inputRef.current)) {
      if (!hasParsingError) {
        setInputtedString(formatDateProp(dataFormat));
      }
      hideCalendar();
    }
  }
github acl-services / paprika / packages / DatePicker / src / DatePicker.js View on Github external
window.requestAnimationFrame(() => {
      if (!isElementContainsFocus(calendarRef.current)) {
        handleInputConfirm();
      }
    });
  }