Socket
Socket
Sign inDemoInstall

@szhsin/react-autocomplete

Package Overview
Dependencies
5
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.8.1 to 0.8.2

dist/esm/utils/mergeEvents.js

62

dist/cjs/index.js

@@ -5,2 +5,19 @@ 'use strict';

const mergeEvents = (events1, events2) => {
const result = {
...events1
};
Object.keys(events2).forEach(key => {
const e2 = events2[key];
if (e2) {
const e1 = events1[key];
result[key] = e1 ? e => {
e1(e);
e2(e);
} : e2;
}
});
return result;
};
const useAutocomplete = ({

@@ -59,22 +76,12 @@ onChange = () => {},

};
const getListProps = () => {
const {
onMouseDown,
onClick,
...rest
} = _getListProps();
return {
...rest,
onMouseDown: e => {
onMouseDown == null || onMouseDown(e);
instance.a = 1;
},
onClick: e => {
var _inputRef$current;
onClick == null || onClick(e);
(_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
instance.a = 0;
}
};
};
const getListProps = () => mergeEvents(_getListProps(), {
onMouseDown: () => {
instance.a = 1;
},
onClick: () => {
var _inputRef$current;
(_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
instance.a = 0;
}
});
return {

@@ -199,12 +206,7 @@ getInputProps,

...rest,
getInputProps: () => {
const inputProps = _getInputProps();
return {
...inputProps,
onChange: e => {
instance.c = e.nativeEvent.inputType === 'insertText';
inputProps.onChange(e);
}
};
},
getInputProps: () => mergeEvents({
onChange: e => {
instance.c = e.nativeEvent.inputType === 'insertText';
}
}, _getInputProps()),
inlineComplete: react.useCallback(({

@@ -211,0 +213,0 @@ item

import { useState, useCallback } from 'react';
import { mergeEvents } from '../utils/mergeEvents.js';
import { autocomplete } from './autocomplete.js';

@@ -23,12 +24,7 @@

...rest,
getInputProps: () => {
const inputProps = _getInputProps();
return {
...inputProps,
onChange: e => {
instance.c = e.nativeEvent.inputType === 'insertText';
inputProps.onChange(e);
}
};
},
getInputProps: () => mergeEvents({
onChange: e => {
instance.c = e.nativeEvent.inputType === 'insertText';
}
}, _getInputProps()),
inlineComplete: useCallback(({

@@ -35,0 +31,0 @@ item

import { useRef, useState, useCallback } from 'react';
import { mergeEvents } from '../utils/mergeEvents.js';

@@ -56,22 +57,12 @@ const useAutocomplete = ({

};
const getListProps = () => {
const {
onMouseDown,
onClick,
...rest
} = _getListProps();
return {
...rest,
onMouseDown: e => {
onMouseDown == null || onMouseDown(e);
instance.a = 1;
},
onClick: e => {
var _inputRef$current;
onClick == null || onClick(e);
(_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
instance.a = 0;
}
};
};
const getListProps = () => mergeEvents(_getListProps(), {
onMouseDown: () => {
instance.a = 1;
},
onClick: () => {
var _inputRef$current;
(_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
instance.a = 0;
}
});
return {

@@ -78,0 +69,0 @@ getInputProps,

{
"name": "@szhsin/react-autocomplete",
"version": "0.8.1",
"version": "0.8.2",
"description": "",

@@ -5,0 +5,0 @@ "author": "Zheng Song",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc