Skip to content

Commit 634fa94

Browse files
ktaborsLFDanLu
andauthored
Adding AriaLabelingProps to ComboBox, Calendar, RangeCalendar, Tabs, and StatusLight (#3378)
* adding AriaLabelingProps to SpectrumComboBoxPrsop * adding aria props to more components they were missing from * moving aria props in Tabs to AriaTabListBase * fixing an import order error * moving aria for combobox * moving aria props to aria types of autocomplete and calendar * aria added to searchautocomplete via a different PR * trying something different with SearchAutocomplete, need API review * missing comma Co-authored-by: Daniel Lu <[email protected]>
1 parent 92a2397 commit 634fa94

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13+
import {AriaSearchFieldProps} from '@react-types/searchfield';
1314
import {AsyncLoadable, CollectionBase, LoadingState, SpectrumLabelableProps, SpectrumTextInputBase, StyleProps} from '@react-types/shared';
1415
import {Key} from 'react';
1516
import {MenuTriggerAction} from '@react-types/combobox';
16-
import {SpectrumSearchFieldProps} from '@react-types/searchfield';
17-
export interface SearchAutocompleteProps<T> extends CollectionBase<T>, Omit<SpectrumSearchFieldProps, 'onSubmit'> {
17+
import {ReactElement} from 'react';
18+
19+
export interface SearchAutocompleteProps<T> extends CollectionBase<T>, Omit<AriaSearchFieldProps, 'onSubmit'> {
1820
/** The list of SearchAutocomplete items (uncontrolled). */
1921
defaultItems?: Iterable<T>,
2022
/** The list of SearchAutocomplete items (controlled). */
@@ -32,7 +34,9 @@ export interface SearchAutocompleteProps<T> extends CollectionBase<T>, Omit<Spec
3234
* @default 'input'
3335
*/
3436
menuTrigger?: MenuTriggerAction,
35-
onSubmit?: (value: string, key: Key | null) => void
37+
onSubmit?: (value: string, key: Key | null) => void,
38+
/** An icon to display at the start of the input. */
39+
icon?: ReactElement
3640
}
3741

3842
export interface SpectrumSearchAutocompleteProps<T> extends SpectrumTextInputBase, Omit<SearchAutocompleteProps<T>, 'menuTrigger'>, SpectrumLabelableProps, StyleProps, Omit<AsyncLoadable, 'isLoading'> {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13+
import {AriaLabelingProps, DOMProps, RangeValue, StyleProps, ValidationState, ValueBase} from '@react-types/shared';
1314
import {CalendarDate, CalendarDateTime, ZonedDateTime} from '@internationalized/date';
14-
import {DOMProps, RangeValue, StyleProps, ValidationState, ValueBase} from '@react-types/shared';
1515
import {ReactNode} from 'react';
1616

1717
export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
@@ -56,24 +56,24 @@ export interface CalendarPropsBase {
5656
}
5757

5858
export type DateRange = RangeValue<DateValue>;
59-
export interface CalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<T, MappedDateValue<T>> {}
60-
export interface RangeCalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<RangeValue<T>, RangeValue<MappedDateValue<T>>> {
59+
export interface CalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<T, MappedDateValue<T>>, DOMProps, AriaLabelingProps {}
60+
export interface RangeCalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<RangeValue<T>, RangeValue<MappedDateValue<T>>>, DOMProps, AriaLabelingProps {
6161
/**
6262
* When combined with `isDateUnavailable`, determines whether non-contiguous ranges,
6363
* i.e. ranges containing unavailable dates, may be selected.
6464
*/
6565
allowsNonContiguousRanges?: boolean
6666
}
6767

68-
export interface SpectrumCalendarProps<T extends DateValue> extends CalendarProps<T>, DOMProps, StyleProps {
68+
export interface SpectrumCalendarProps<T extends DateValue> extends CalendarProps<T>, StyleProps {
6969
/**
7070
* The number of months to display at once. Up to 3 months are supported.
7171
* @default 1
7272
*/
7373
visibleMonths?: number
7474
}
7575

76-
export interface SpectrumRangeCalendarProps<T extends DateValue> extends RangeCalendarProps<T>, DOMProps, StyleProps {
76+
export interface SpectrumRangeCalendarProps<T extends DateValue> extends RangeCalendarProps<T>, StyleProps {
7777
/**
7878
* The number of months to display at once. Up to 3 months are supported.
7979
* @default 1

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import {AsyncLoadable, CollectionBase, DOMProps, FocusableProps, HelpTextProps, InputBase, LabelableProps, LoadingState, SingleSelection, SpectrumLabelableProps, SpectrumTextInputBase, StyleProps, TextInputBase, Validation} from '@react-types/shared';
13+
import {AriaLabelingProps, AsyncLoadable, CollectionBase, DOMProps, FocusableProps, HelpTextProps, InputBase, LabelableProps, LoadingState, SingleSelection, SpectrumLabelableProps, SpectrumTextInputBase, StyleProps, TextInputBase, Validation} from '@react-types/shared';
1414

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

@@ -45,7 +45,7 @@ export interface ComboBoxProps<T> extends CollectionBase<T>, Omit<SingleSelectio
4545
name?: string
4646
}
4747

48-
export interface AriaComboBoxProps<T> extends ComboBoxProps<T>, DOMProps {
48+
export interface AriaComboBoxProps<T> extends ComboBoxProps<T>, DOMProps, AriaLabelingProps {
4949
/** Whether keyboard navigation is circular. */
5050
shouldFocusWrap?: boolean
5151
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import {DOMProps, StyleProps} from '@react-types/shared';
13+
import {AriaLabelingProps, DOMProps, StyleProps} from '@react-types/shared';
1414
import {ReactNode} from 'react';
1515

16-
export interface SpectrumStatusLightProps extends DOMProps, StyleProps {
16+
export interface SpectrumStatusLightProps extends DOMProps, StyleProps, AriaLabelingProps {
1717
/** The content to display as the label. */
1818
children?: ReactNode,
1919
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from '@react-types/shared';
2222
import {Key, ReactNode} from 'react';
2323

24-
export interface AriaTabProps {
24+
export interface AriaTabProps extends AriaLabelingProps {
2525
/** The key of the tab. */
2626
key: Key,
2727
/** Whether the tab should be disabled. */
@@ -36,7 +36,7 @@ export interface TabListProps<T> extends CollectionBase<T>, Omit<SingleSelection
3636
isDisabled?: boolean
3737
}
3838

39-
interface AriaTabListBase {
39+
interface AriaTabListBase extends AriaLabelingProps {
4040
/**
4141
* Whether tabs are activated automatically on focus or manually.
4242
* @default 'automatic'

0 commit comments

Comments
 (0)