Skip to content

Commit 8d631f5

Browse files
authored
Move aria specific props to AriaComboBoxProps (#2651)
1 parent df5c4cb commit 8d631f5

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

packages/@react-aria/combobox/src/useComboBox.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
import {announce} from '@react-aria/live-announcer';
1414
import {AriaButtonProps} from '@react-types/button';
15+
import {AriaComboBoxProps} from '@react-types/combobox';
1516
import {ariaHideOutside} from '@react-aria/overlays';
1617
import {AriaListBoxOptions, getItemId, listData} from '@react-aria/listbox';
1718
import {chain, isAppleDevice, mergeProps, useLabels} from '@react-aria/utils';
18-
import {ComboBoxProps} from '@react-types/combobox';
1919
import {ComboBoxState} from '@react-stately/combobox';
2020
import {FocusEvent, HTMLAttributes, InputHTMLAttributes, KeyboardEvent, RefObject, TouchEvent, useEffect, useMemo, useRef} from 'react';
2121
import {getItemCount} from '@react-stately/collections';
@@ -27,7 +27,7 @@ import {useMenuTrigger} from '@react-aria/menu';
2727
import {useMessageFormatter} from '@react-aria/i18n';
2828
import {useTextField} from '@react-aria/textfield';
2929

30-
interface AriaComboBoxProps<T> extends ComboBoxProps<T> {
30+
interface AriaComboBoxOptions<T> extends AriaComboBoxProps<T> {
3131
/** The ref for the input element. */
3232
inputRef: RefObject<HTMLInputElement>,
3333
/** The ref for the list box popover. */
@@ -61,7 +61,7 @@ interface ComboBoxAria<T> {
6161
* @param props - Props for the combo box.
6262
* @param state - State for the select, as returned by `useComboBoxState`.
6363
*/
64-
export function useComboBox<T>(props: AriaComboBoxProps<T>, state: ComboBoxState<T>): ComboBoxAria<T> {
64+
export function useComboBox<T>(props: AriaComboBoxOptions<T>, state: ComboBoxState<T>): ComboBoxAria<T> {
6565
let {
6666
buttonRef,
6767
popoverRef,

packages/@react-types/combobox/src/index.d.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {AsyncLoadable, CollectionBase, DOMProps, FocusableProps, HelpTextProps,
1414

1515
export type MenuTriggerAction = 'focus' | 'input' | 'manual';
1616

17-
export interface ComboBoxProps<T> extends CollectionBase<T>, SingleSelection, InputBase, TextInputBase, DOMProps, Validation, FocusableProps, LabelableProps, HelpTextProps {
17+
export interface ComboBoxProps<T> extends CollectionBase<T>, SingleSelection, InputBase, TextInputBase, Validation, FocusableProps, LabelableProps, HelpTextProps {
1818
/** The list of ComboBox items (uncontrolled). */
1919
defaultItems?: Iterable<T>,
2020
/** The list of ComboBox items (controlled). */
@@ -34,16 +34,19 @@ export interface ComboBoxProps<T> extends CollectionBase<T>, SingleSelection, In
3434
// * @default 'suggest'
3535
// */
3636
// completionMode?: 'suggest' | 'complete',
37-
/**
38-
* The interaction required to display the ComboBox menu.
39-
* @default 'input'
40-
*/
41-
menuTrigger?: MenuTriggerAction,
37+
/**
38+
* The interaction required to display the ComboBox menu.
39+
* @default 'input'
40+
*/
41+
menuTrigger?: MenuTriggerAction
42+
}
43+
44+
export interface AriaComboBoxProps<T> extends ComboBoxProps<T>, DOMProps {
4245
/** Whether keyboard navigation is circular. */
4346
shouldFocusWrap?: boolean
4447
}
4548

46-
export interface SpectrumComboBoxProps<T> extends Omit<ComboBoxProps<T>, 'menuTrigger'>, SpectrumLabelableProps, StyleProps, Omit<AsyncLoadable, 'isLoading'> {
49+
export interface SpectrumComboBoxProps<T> extends Omit<AriaComboBoxProps<T>, 'menuTrigger'>, SpectrumLabelableProps, StyleProps, Omit<AsyncLoadable, 'isLoading'> {
4750
/**
4851
* The interaction required to display the ComboBox menu. Note that this prop has no effect on the mobile ComboBox experience.
4952
* @default 'input'

0 commit comments

Comments
 (0)