From 7eca992d2629e84c4bf853c01d6a4715cdd8a13e Mon Sep 17 00:00:00 2001 From: Xiaoyan Li Date: Thu, 5 Mar 2026 17:20:11 +0800 Subject: [PATCH 1/2] feat: accept readonly array for multiple combobox value Port the readonly array changes from #9221 (Select) to ComboBox. This allows passing `readonly Key[]` as the `value` prop for multiple selection mode without TypeScript errors. Co-Authored-By: Claude Opus 4.6 --- packages/@react-stately/combobox/src/useComboBoxState.ts | 6 +++--- packages/@react-types/combobox/src/index.d.ts | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/@react-stately/combobox/src/useComboBoxState.ts b/packages/@react-stately/combobox/src/useComboBoxState.ts index 54838afb8d9..1212f05d06d 100644 --- a/packages/@react-stately/combobox/src/useComboBoxState.ts +++ b/packages/@react-stately/combobox/src/useComboBoxState.ts @@ -11,7 +11,7 @@ */ import {Collection, CollectionStateBase, FocusStrategy, Key, Node, Selection} from '@react-types/shared'; -import {ComboBoxProps, MenuTriggerAction, SelectionMode, ValueType} from '@react-types/combobox'; +import {ChangeValueType, ComboBoxProps, MenuTriggerAction, SelectionMode, ValueType} from '@react-types/combobox'; import {FormValidationState, useFormValidationState} from '@react-stately/form'; import {getChildNodes} from '@react-stately/collections'; import {ListCollection, ListState, useListState} from '@react-stately/list'; @@ -373,7 +373,7 @@ export function useComboBoxState = M extends 'single' ? Key | null : Key[]; +export type ValueType = M extends 'single' ? Key | null : readonly Key[]; +export type ChangeValueType = M extends 'single' ? Key | null : Key[]; type ValidationType = M extends 'single' ? Key : Key[]; export interface ComboBoxValidationValue { @@ -50,7 +51,7 @@ export interface ComboBoxValidationValue { inputValue: string } -export interface ComboBoxProps extends CollectionBase, InputBase, ValueBase>, TextInputBase, Validation, FocusableProps, LabelableProps, HelpTextProps { +export interface ComboBoxProps extends CollectionBase, InputBase, ValueBase, ChangeValueType>, TextInputBase, Validation, FocusableProps, LabelableProps, HelpTextProps { /** The list of ComboBox items (uncontrolled). */ defaultItems?: Iterable, /** The list of ComboBox items (controlled). */ From 07f4cb1a8bcf6563c7a16132110dc312197f826a Mon Sep 17 00:00:00 2001 From: Xiaoyan Li Date: Fri, 6 Mar 2026 13:42:45 +0800 Subject: [PATCH 2/2] fix: sort imports alphabetically to fix lint CI failure Co-Authored-By: Claude Opus 4.6 --- packages/@react-stately/combobox/src/useComboBoxState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-stately/combobox/src/useComboBoxState.ts b/packages/@react-stately/combobox/src/useComboBoxState.ts index 1212f05d06d..bb897667f9e 100644 --- a/packages/@react-stately/combobox/src/useComboBoxState.ts +++ b/packages/@react-stately/combobox/src/useComboBoxState.ts @@ -10,8 +10,8 @@ * governing permissions and limitations under the License. */ -import {Collection, CollectionStateBase, FocusStrategy, Key, Node, Selection} from '@react-types/shared'; import {ChangeValueType, ComboBoxProps, MenuTriggerAction, SelectionMode, ValueType} from '@react-types/combobox'; +import {Collection, CollectionStateBase, FocusStrategy, Key, Node, Selection} from '@react-types/shared'; import {FormValidationState, useFormValidationState} from '@react-stately/form'; import {getChildNodes} from '@react-stately/collections'; import {ListCollection, ListState, useListState} from '@react-stately/list';