From b363ed00c9b1764b1245ea3be0ee4175fb1c47eb Mon Sep 17 00:00:00 2001 From: bqxbqx Date: Mon, 21 Oct 2024 23:02:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=F0=9F=90=9B:=20select=20item=20trigger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui-react/lib/Select/Select.tsx | 6 ++---- packages/ui-react/lib/Select/SelectItem.tsx | 2 +- packages/ui-react/package.json | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/ui-react/lib/Select/Select.tsx b/packages/ui-react/lib/Select/Select.tsx index 4f83ca1..215b93b 100644 --- a/packages/ui-react/lib/Select/Select.tsx +++ b/packages/ui-react/lib/Select/Select.tsx @@ -90,9 +90,7 @@ export const Select = React.forwardRef( const [visible, setVisible] = useState(false); const selectClass = classNames(styles['base'], styles[size], className); const closeOptions = () => { - setTimeout(() => { - setVisible(false); - }, 100); + setVisible(false); }; return ( @@ -107,10 +105,10 @@ export const Select = React.forwardRef( disabled={disabled} placeholder={placeHolder} size={size} + onBlur={closeOptions} optionsList={optionsList} onClick={() => setVisible(true)} onKeyDown={() => setVisible(true)} - onBlur={closeOptions} closeOptions={() => setVisible(false)} onChange={onChange} selectKey={selectKey} diff --git a/packages/ui-react/lib/Select/SelectItem.tsx b/packages/ui-react/lib/Select/SelectItem.tsx index df4c1b9..ddafc6c 100644 --- a/packages/ui-react/lib/Select/SelectItem.tsx +++ b/packages/ui-react/lib/Select/SelectItem.tsx @@ -26,7 +26,7 @@ export const SelectItem = React.forwardRef(
{ + onMouseDown={() => { updateSelectItem(option); changeValue(option.label); }} diff --git a/packages/ui-react/package.json b/packages/ui-react/package.json index 546af8c..2e08f52 100644 --- a/packages/ui-react/package.json +++ b/packages/ui-react/package.json @@ -1,6 +1,6 @@ { "name": "@ui-aurora/react", - "version": "0.0.25", + "version": "0.0.26", "description": "A React UI library built for SASTOJ", "author": "sast", "license": "MIT",