Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@szhsin/react-autocomplete

Package Overview
Dependencies
Maintainers
0
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@szhsin/react-autocomplete - npm Package Compare versions

Comparing version 0.9.10 to 0.9.11

30

dist/cjs/index.js

@@ -138,5 +138,4 @@ 'use strict';

const autocompleteLite = ({
rovingText,
select,
selectOnBlur = rovingText,
rovingText = !select,
deselectOnClear = true,

@@ -170,11 +169,13 @@ deselectOnChange = true,

const listId = getId(id, 'l');
const selectItemOrAction = (item, noAction) => {
const applyValue = newValue => {
if (!select) onChange(newValue);
const endIndex = newValue.length;
inputRef.current?.setSelectionRange(endIndex, endIndex);
};
const selectItemOrAction = item => {
if (isItemAction?.(item)) {
!noAction && onAction?.(item);
onAction?.(item);
return true;
}
const itemValue = getItemValue(item);
if (!select) onChange(itemValue);
const endIndex = itemValue.length;
inputRef.current?.setSelectionRange(endIndex, endIndex);
applyValue(getItemValue(item));
onSelectChange(item);

@@ -241,3 +242,4 @@ };

}
}
},
onPointerMove: () => setFocusIndex(index)
}),

@@ -266,5 +268,3 @@ getInputProps: () => ({

if (inCapture()) return;
if (selectOnBlur && focusItem) {
selectItemOrAction(focusItem, true);
}
applyValue(inputValue);
resetState(true);

@@ -497,4 +497,3 @@ },

...props,
select: true,
selectOnBlur: false
select: true
}), inputFocus(), multiInput());

@@ -504,4 +503,3 @@

...props,
select: true,
selectOnBlur: false
select: true
}), dropdownToggle(props), multiInput());

@@ -508,0 +506,0 @@

@@ -8,5 +8,4 @@ import { buttonProps, defaultFocusIndex, getId } from '../../common.js';

const autocompleteLite = ({
rovingText,
select,
selectOnBlur = rovingText,
rovingText = !select,
deselectOnClear = true,

@@ -40,11 +39,13 @@ deselectOnChange = true,

const listId = getId(id, 'l');
const selectItemOrAction = (item, noAction) => {
const applyValue = newValue => {
if (!select) onChange(newValue);
const endIndex = newValue.length;
inputRef.current?.setSelectionRange(endIndex, endIndex);
};
const selectItemOrAction = item => {
if (isItemAction?.(item)) {
!noAction && onAction?.(item);
onAction?.(item);
return true;
}
const itemValue = getItemValue(item);
if (!select) onChange(itemValue);
const endIndex = itemValue.length;
inputRef.current?.setSelectionRange(endIndex, endIndex);
applyValue(getItemValue(item));
onSelectChange(item);

@@ -111,3 +112,4 @@ };

}
}
},
onPointerMove: () => setFocusIndex(index)
}),

@@ -136,5 +138,3 @@ getInputProps: () => ({

if (inCapture()) return;
if (selectOnBlur && focusItem) {
selectItemOrAction(focusItem, true);
}
applyValue(inputValue);
resetState(true);

@@ -141,0 +141,0 @@ },

@@ -8,6 +8,5 @@ import { mergeModules } from '../../utils/mergeModules.js';

...props,
select: true,
selectOnBlur: false
select: true
}), inputFocus(), multiInput());
export { multiSelect };

@@ -8,6 +8,5 @@ import { mergeModules } from '../../utils/mergeModules.js';

...props,
select: true,
selectOnBlur: false
select: true
}), dropdownToggle(props), multiInput());
export { multiSelectDropdown };
{
"name": "@szhsin/react-autocomplete",
"version": "0.9.10",
"version": "0.9.11",
"description": "",

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

import type { Feature, GetProps, AutocompleteFeatureProps, FeatureState } from '../../types';
type AutocompleteLiteFeature<T> = Feature<T, Pick<GetProps<T>, 'getInputProps' | 'getListProps' | 'getItemProps' | 'getClearProps'> & FeatureState>;
declare const autocompleteLite: <T>({ rovingText, select, selectOnBlur, deselectOnClear, deselectOnChange, closeOnSelect }?: AutocompleteFeatureProps<T>) => AutocompleteLiteFeature<T>;
declare const autocompleteLite: <T>({ select, rovingText, deselectOnClear, deselectOnChange, closeOnSelect }?: AutocompleteFeatureProps<T>) => AutocompleteLiteFeature<T>;
export { type AutocompleteLiteFeature, autocompleteLite };

@@ -8,3 +8,3 @@ import type { MergedFeature, FeatureProps } from '../../types';

]>;
declare const dropdown: <T>(props?: Pick<FeatureProps<T>, "rovingText" | "selectOnBlur" | "closeOnSelect" | "toggleRef">) => DropdownFeature<T>;
declare const dropdown: <T>(props?: Pick<FeatureProps<T>, "rovingText" | "closeOnSelect" | "toggleRef">) => DropdownFeature<T>;
export { type DropdownFeature, dropdown };

@@ -8,3 +8,3 @@ import type { MergedFeature, FeatureProps } from '../../types';

]>;
declare const supercomplete: <T>(props: Pick<FeatureProps<T>, "requestItem" | "select" | "selectOnBlur" | "deselectOnClear" | "deselectOnChange" | "closeOnSelect">) => SupercompleteFeature<T>;
declare const supercomplete: <T>(props: Pick<FeatureProps<T>, "requestItem" | "select" | "deselectOnClear" | "deselectOnChange" | "closeOnSelect">) => SupercompleteFeature<T>;
export { type SupercompleteFeature, supercomplete };

@@ -56,3 +56,2 @@ import type { HTMLAttributes, InputHTMLAttributes, ButtonHTMLAttributes, LabelHTMLAttributes } from 'react';

select?: boolean;
selectOnBlur?: boolean;
deselectOnClear?: boolean;

@@ -64,3 +63,3 @@ deselectOnChange?: boolean;

}
export type AutocompleteFeatureProps<T> = Pick<FeatureProps<T>, 'rovingText' | 'select' | 'selectOnBlur' | 'deselectOnClear' | 'deselectOnChange' | 'closeOnSelect'>;
export type AutocompleteFeatureProps<T> = Pick<FeatureProps<T>, 'rovingText' | 'select' | 'deselectOnClear' | 'deselectOnChange' | 'closeOnSelect'>;
export type Feature<T, Yield extends object> = (cx: Contextual<T>) => Yield;

@@ -67,0 +66,0 @@ export type MergedFeatureYield<T, Features> = Features extends readonly [Feature<T, infer S>] ? S : Features extends readonly [Feature<T, infer F>, ...infer R] ? F & MergedFeatureYield<T, R> : never;

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc