@szhsin/react-autocomplete
Advanced tools
Comparing version 0.9.5 to 0.9.6-alpha.0
@@ -168,2 +168,5 @@ 'use strict'; | ||
const $onClick = 'onClick'; | ||
const $onMouseDown = 'onMouseDown'; | ||
const scrollIntoView = element => element == null ? void 0 : element.scrollIntoView({ | ||
@@ -251,4 +254,4 @@ block: 'nearest' | ||
...ButtonProps, | ||
onMouseDown: startCapture, | ||
onClick: () => { | ||
[$onMouseDown]: startCapture, | ||
[$onClick]: () => { | ||
stopCapture(); | ||
@@ -265,4 +268,4 @@ setOpen(true); | ||
role: 'listbox', | ||
onMouseDown: startCapture, | ||
onClick: stopCapture | ||
[$onMouseDown]: startCapture, | ||
[$onClick]: stopCapture | ||
}), | ||
@@ -277,3 +280,3 @@ getItemProps: ({ | ||
ref: isEqual(item, focusItem) ? scrollIntoView : null, | ||
onClick: () => { | ||
[$onClick]: () => { | ||
if (!(isItemDisabled != null && isItemDisabled(item))) { | ||
@@ -342,4 +345,4 @@ resetState(selectItemOrAction(item)); | ||
}, | ||
onMouseDown: e => e.stopPropagation(), | ||
onClick: () => setOpen(true) | ||
[$onMouseDown]: e => e.stopPropagation(), | ||
[$onClick]: () => setOpen(true) | ||
}) | ||
@@ -412,7 +415,7 @@ }; | ||
'aria-controls': getId(id, 'l'), | ||
onMouseDown: () => { | ||
[$onMouseDown]: () => { | ||
startToggle(); | ||
startCapture(); | ||
}, | ||
onClick: () => { | ||
[$onClick]: () => { | ||
stopToggle(); | ||
@@ -477,4 +480,4 @@ stopCapture(); | ||
ref: toggleRef, | ||
onMouseDown: startToggle, | ||
onClick: stopToggle, | ||
[$onMouseDown]: startToggle, | ||
[$onClick]: stopToggle, | ||
onKeyDown: e => { | ||
@@ -528,4 +531,4 @@ const { | ||
getInputWrapperProps: () => ({ | ||
onMouseDown: startCapture, | ||
onClick: stopCapture | ||
[$onMouseDown]: startCapture, | ||
[$onClick]: stopCapture | ||
}), | ||
@@ -532,0 +535,0 @@ getInputProps: () => ({ |
import { ButtonProps, getId } from '../../common.js'; | ||
import { useFocusCapture } from '../../hooks/useFocusCapture.js'; | ||
import { $onMouseDown, $onClick } from '../../objKeys.js'; | ||
@@ -86,4 +87,4 @@ const scrollIntoView = element => element == null ? void 0 : element.scrollIntoView({ | ||
...ButtonProps, | ||
onMouseDown: startCapture, | ||
onClick: () => { | ||
[$onMouseDown]: startCapture, | ||
[$onClick]: () => { | ||
stopCapture(); | ||
@@ -100,4 +101,4 @@ setOpen(true); | ||
role: 'listbox', | ||
onMouseDown: startCapture, | ||
onClick: stopCapture | ||
[$onMouseDown]: startCapture, | ||
[$onClick]: stopCapture | ||
}), | ||
@@ -112,3 +113,3 @@ getItemProps: ({ | ||
ref: isEqual(item, focusItem) ? scrollIntoView : null, | ||
onClick: () => { | ||
[$onClick]: () => { | ||
if (!(isItemDisabled != null && isItemDisabled(item))) { | ||
@@ -177,4 +178,4 @@ resetState(selectItemOrAction(item)); | ||
}, | ||
onMouseDown: e => e.stopPropagation(), | ||
onClick: () => setOpen(true) | ||
[$onMouseDown]: e => e.stopPropagation(), | ||
[$onClick]: () => setOpen(true) | ||
}) | ||
@@ -181,0 +182,0 @@ }; |
import { useRef, useEffect } from 'react'; | ||
import { useToggle } from '../../hooks/useToggle.js'; | ||
import { $onMouseDown, $onClick } from '../../objKeys.js'; | ||
@@ -32,4 +33,4 @@ const dropdownToggle = ({ | ||
ref: toggleRef, | ||
onMouseDown: startToggle, | ||
onClick: stopToggle, | ||
[$onMouseDown]: startToggle, | ||
[$onClick]: stopToggle, | ||
onKeyDown: e => { | ||
@@ -36,0 +37,0 @@ const { |
import { ButtonProps, getId } from '../../common.js'; | ||
import { useToggle } from '../../hooks/useToggle.js'; | ||
import { useFocusCapture } from '../../hooks/useFocusCapture.js'; | ||
import { $onMouseDown, $onClick } from '../../objKeys.js'; | ||
@@ -18,7 +19,7 @@ const inputToggle = () => ({ | ||
'aria-controls': getId(id, 'l'), | ||
onMouseDown: () => { | ||
[$onMouseDown]: () => { | ||
startToggle(); | ||
startCapture(); | ||
}, | ||
onClick: () => { | ||
[$onClick]: () => { | ||
stopToggle(); | ||
@@ -25,0 +26,0 @@ stopCapture(); |
import { useFocusCapture } from '../../hooks/useFocusCapture.js'; | ||
import { $onMouseDown, $onClick } from '../../objKeys.js'; | ||
@@ -10,4 +11,4 @@ const multiInput = () => ({ | ||
getInputWrapperProps: () => ({ | ||
onMouseDown: startCapture, | ||
onClick: stopCapture | ||
[$onMouseDown]: startCapture, | ||
[$onClick]: stopCapture | ||
}), | ||
@@ -14,0 +15,0 @@ getInputProps: () => ({ |
{ | ||
"name": "@szhsin/react-autocomplete", | ||
"version": "0.9.5", | ||
"version": "0.9.6-alpha.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Zheng Song", |
@@ -37,3 +37,3 @@ import type { HTMLAttributes, InputHTMLAttributes, ButtonHTMLAttributes, LabelHTMLAttributes } from 'react'; | ||
onAction?: (item: T) => void; | ||
value?: string | undefined; | ||
value: string | undefined; | ||
onChange: (value?: string | undefined) => void; | ||
@@ -40,0 +40,0 @@ items: T[]; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52083
60
1467