Skip to content

Commit 3f3e83f

Browse files
authored
Code changes from docs-ts branch (#4090)
1 parent 510a7dd commit 3f3e83f

File tree

14 files changed

+41
-25
lines changed

14 files changed

+41
-25
lines changed

packages/@adobe/react-spectrum/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
"@react-spectrum/view": "^3.4.1",
7373
"@react-spectrum/well": "^3.3.4",
7474
"@react-stately/collections": "^3.5.1",
75-
"@react-stately/data": "^3.8.1"
75+
"@react-stately/data": "^3.8.1",
76+
"@react-types/shared": "^3.15.0"
7677
},
7778
"publishConfig": {
7879
"access": "public"

packages/@adobe/react-spectrum/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,4 @@ export type {VisuallyHiddenAria, VisuallyHiddenProps} from '@react-aria/visually
103103
export type {DateFormatter, DateFormatterOptions, Filter, FormatMessage, Locale, LocalizedStrings} from '@react-aria/i18n';
104104
export type {SSRProviderProps} from '@react-aria/ssr';
105105
export type {DirectoryDropItem, DragAndDropHooks, DragAndDropOptions, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem} from '@react-spectrum/dnd';
106+
export type {Selection} from '@react-types/shared';

packages/@internationalized/date/src/CalendarDate.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class CalendarDate {
4242
// This prevents TypeScript from allowing other types with the same fields to match.
4343
// i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.
4444
// If that behavior is desired, use the AnyCalendarDate interface instead.
45+
// @ts-ignore
4546
#type;
4647
/** The calendar system associated with this date, e.g. Gregorian. */
4748
public readonly calendar: Calendar;
@@ -124,6 +125,7 @@ export class CalendarDate {
124125
/** A Time represents a clock time without any date components. */
125126
export class Time {
126127
// This prevents TypeScript from allowing other types with the same fields to match.
128+
// @ts-ignore
127129
#type;
128130
/** The hour, numbered from 0 to 23. */
129131
public readonly hour: number;
@@ -189,6 +191,7 @@ export class Time {
189191
/** A CalendarDateTime represents a date and time without a time zone, in a specific calendar system. */
190192
export class CalendarDateTime {
191193
// This prevents TypeScript from allowing other types with the same fields to match.
194+
// @ts-ignore
192195
#type;
193196
/** The calendar system associated with this date, e.g. Gregorian. */
194197
public readonly calendar: Calendar;
@@ -296,6 +299,7 @@ export class CalendarDateTime {
296299
/** A ZonedDateTime represents a date and time in a specific time zone and calendar system. */
297300
export class ZonedDateTime {
298301
// This prevents TypeScript from allowing other types with the same fields to match.
302+
// @ts-ignore
299303
#type;
300304
/** The calendar system associated with this date, e.g. Gregorian. */
301305
public readonly calendar: Calendar;

packages/@react-aria/button/src/useToggleButton.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ import {DOMAttributes} from '@react-types/shared';
2525
import {mergeProps} from '@react-aria/utils';
2626
import {ToggleState} from '@react-stately/toggle';
2727

28-
export function useToggleButton(props: AriaToggleButtonProps<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
28+
// Order with overrides is important: 'button' should be default
2929
export function useToggleButton(props: AriaToggleButtonProps<'button'>, state: ToggleState, ref: RefObject<HTMLButtonElement>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;
30+
export function useToggleButton(props: AriaToggleButtonProps<'a'>, state: ToggleState, ref: RefObject<HTMLAnchorElement>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;
3031
export function useToggleButton(props: AriaToggleButtonProps<'div'>, state: ToggleState, ref: RefObject<HTMLDivElement>): ButtonAria<HTMLAttributes<HTMLDivElement>>;
3132
export function useToggleButton(props: AriaToggleButtonProps<'input'>, state: ToggleState, ref: RefObject<HTMLInputElement>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;
3233
export function useToggleButton(props: AriaToggleButtonProps<'span'>, state: ToggleState, ref: RefObject<HTMLSpanElement>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;

packages/@react-aria/listbox/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License. You may obtain a copy
55
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6-
*
6+
*
77
* Unless required by applicable law or agreed to in writing, software distributed under
88
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
99
* OF ANY KIND, either express or implied. See the License for the specific language
@@ -15,6 +15,7 @@ export {useOption} from './useOption';
1515
export {useListBoxSection} from './useListBoxSection';
1616
export {listData, getItemId} from './utils';
1717

18+
export type {AriaListBoxProps} from '@react-types/listbox';
1819
export type {AriaListBoxOptions, ListBoxAria} from './useListBox';
1920
export type {AriaOptionProps, OptionAria} from './useOption';
2021
export type {AriaListBoxSectionProps, ListBoxSectionAria} from './useListBoxSection';

packages/@react-aria/listbox/src/useListBox.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
import {AriaListBoxProps} from '@react-types/listbox';
1414
import {DOMAttributes, KeyboardDelegate} from '@react-types/shared';
1515
import {filterDOMProps, mergeProps} from '@react-aria/utils';
16-
import {Key, ReactNode, RefObject} from 'react';
1716
import {listData} from './utils';
1817
import {ListState} from '@react-stately/list';
18+
import {RefObject} from 'react';
1919
import {useFocusWithin} from '@react-aria/interactions';
2020
import {useId} from '@react-aria/utils';
2121
import {useLabel} from '@react-aria/label';
@@ -47,17 +47,7 @@ export interface AriaListBoxOptions<T> extends Omit<AriaListBoxProps<T>, 'childr
4747
shouldSelectOnPressUp?: boolean,
4848

4949
/** Whether options should be focused when the user hovers over them. */
50-
shouldFocusOnHover?: boolean,
51-
52-
/**
53-
* An optional visual label for the listbox.
54-
*/
55-
label?: ReactNode,
56-
/**
57-
* Handler that is called when a user performs an action on an item. The exact user event depends on
58-
* the collection's `selectionBehavior` prop and the interaction modality.
59-
*/
60-
onAction?: (key: Key) => void
50+
shouldFocusOnHover?: boolean
6151
}
6252

6353
/**

packages/@react-aria/menu/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export {useMenu} from './useMenu';
1515
export {useMenuItem} from './useMenuItem';
1616
export {useMenuSection} from './useMenuSection';
1717

18+
export type {AriaMenuProps} from '@react-types/menu';
1819
export type {AriaMenuTriggerProps, MenuTriggerAria} from './useMenuTrigger';
1920
export type {AriaMenuOptions, MenuAria} from './useMenu';
2021
export type {AriaMenuItemProps, MenuItemAria} from './useMenuItem';

packages/@react-aria/overlays/src/useOverlayTrigger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface OverlayTriggerAria {
3434
* Handles the behavior and accessibility for an overlay trigger, e.g. a button
3535
* that opens a popover, menu, or other overlay that is positioned relative to the trigger.
3636
*/
37-
export function useOverlayTrigger(props: OverlayTriggerProps, state: OverlayTriggerState, ref: RefObject<Element>): OverlayTriggerAria {
37+
export function useOverlayTrigger(props: OverlayTriggerProps, state: OverlayTriggerState, ref?: RefObject<Element>): OverlayTriggerAria {
3838
let {type} = props;
3939
let {isOpen} = state;
4040

packages/@react-spectrum/autocomplete/src/SearchAutocomplete.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,5 +340,5 @@ let SearchAutocompleteInput = React.forwardRef(_SearchAutocompleteInput) as <T>(
340340
/**
341341
* A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.
342342
*/
343-
let _SearchAutocomplete = forwardRef(SearchAutocomplete);
343+
let _SearchAutocomplete = forwardRef(SearchAutocomplete) as <T>(props: SpectrumSearchAutocompleteProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;
344344
export {_SearchAutocomplete as SearchAutocomplete};

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
DOMProps,
1818
FocusableDOMProps,
1919
FocusableProps,
20+
HelpTextProps,
2021
InputBase,
2122
LabelableProps,
2223
SpectrumLabelableProps,
@@ -94,7 +95,7 @@ export interface Color {
9495
getColorChannels(): [ColorChannel, ColorChannel, ColorChannel]
9596
}
9697

97-
export interface ColorFieldProps extends Omit<ValueBase<string | Color | null>, 'onChange'>, InputBase, Validation, FocusableProps, TextInputBase, LabelableProps {
98+
export interface ColorFieldProps extends Omit<ValueBase<string | Color | null>, 'onChange'>, InputBase, Validation, FocusableProps, TextInputBase, LabelableProps, HelpTextProps {
9899
/** Handler that is called when the value changes. */
99100
onChange?: (color: Color | null) => void
100101
}

0 commit comments

Comments
 (0)