diff --git a/packages/@react-stately/autocomplete/src/useAutocompleteState.ts b/packages/@react-stately/autocomplete/src/useAutocompleteState.ts index e9b4ce28d53..fb67ac9deb2 100644 --- a/packages/@react-stately/autocomplete/src/useAutocompleteState.ts +++ b/packages/@react-stately/autocomplete/src/useAutocompleteState.ts @@ -17,11 +17,11 @@ export interface AutocompleteState { /** The current value of the autocomplete input. */ inputValue: string, /** Sets the value of the autocomplete input. */ - setInputValue(value: string): void, + setInputValue: (value: string) => void, /** The id of the current aria-activedescendant of the autocomplete input. */ focusedNodeId: string | null, /** Sets the id of the current aria-activedescendant of the autocomplete input. */ - setFocusedNodeId(value: string | null): void + setFocusedNodeId: (value: string | null) => void } export interface AutocompleteProps { diff --git a/packages/@react-stately/calendar/src/types.ts b/packages/@react-stately/calendar/src/types.ts index 4fbf3c3fe60..2cedf10f196 100644 --- a/packages/@react-stately/calendar/src/types.ts +++ b/packages/@react-stately/calendar/src/types.ts @@ -37,23 +37,23 @@ interface CalendarStateBase { /** The currently focused date. */ readonly focusedDate: CalendarDate, /** Sets the focused date. */ - setFocusedDate(value: CalendarDate): void, + setFocusedDate: (value: CalendarDate) => void, /** Moves focus to the next calendar date. */ - focusNextDay(): void, + focusNextDay: () => void, /** Moves focus to the previous calendar date. */ - focusPreviousDay(): void, + focusPreviousDay: () => void, /** Moves focus to the next row of dates, e.g. the next week. */ - focusNextRow(): void, + focusNextRow: () => void, /** Moves focus to the previous row of dates, e.g. the previous work. */ - focusPreviousRow(): void, + focusPreviousRow: () => void, /** Moves focus to the next page of dates, e.g. the next month if one month is visible. */ - focusNextPage(): void, + focusNextPage: () => void, /** Moves focus to the previous page of dates, e.g. the previous month if one month is visible. */ - focusPreviousPage(): void, + focusPreviousPage: () => void, /** Moves focus to the start of the current section of dates, e.g. the start of the current month. */ - focusSectionStart(): void, + focusSectionStart: () => void, /** Moves focus to the end of the current section of dates, e.g. the end of the current month month. */ - focusSectionEnd(): void, + focusSectionEnd: () => void, /** * Moves focus to the next section of dates based on what is currently displayed. * By default, focus is moved by one of the currently displayed unit. For example, if @@ -61,7 +61,7 @@ interface CalendarStateBase { * If the `larger` option is `true`, the focus is moved by the next larger unit than * the one displayed. For example, if months are displayed, then focus moves to the next year. */ - focusNextSection(larger?: boolean): void, + focusNextSection: (larger?: boolean) => void, /** * Moves focus to the previous section of dates based on what is currently displayed. * By default, focus is moved by one of the currently displayed unit. For example, if @@ -69,58 +69,58 @@ interface CalendarStateBase { * If the `larger` option is `true`, the focus is moved by the next larger unit than * the one displayed. For example, if months are displayed, then focus moves to the previous year. */ - focusPreviousSection(larger?: boolean): void, + focusPreviousSection: (larger?: boolean) => void, /** Selects the currently focused date. */ - selectFocusedDate(): void, + selectFocusedDate: () => void, /** Selects the given date. */ - selectDate(date: CalendarDate): void, + selectDate: (date: CalendarDate) => void, /** Whether focus is currently within the calendar. */ readonly isFocused: boolean, /** Sets whether focus is currently within the calendar. */ - setFocused(value: boolean): void, + setFocused: (value: boolean) => void, /** Returns whether the given date is invalid according to the `minValue` and `maxValue` props. */ - isInvalid(date: CalendarDate): boolean, + isInvalid: (date: CalendarDate) => boolean, /** Returns whether the given date is currently selected. */ - isSelected(date: CalendarDate): boolean, + isSelected: (date: CalendarDate) => boolean, /** Returns whether the given date is currently focused. */ - isCellFocused(date: CalendarDate): boolean, + isCellFocused: (date: CalendarDate) => boolean, /** Returns whether the given date is disabled according to the `minValue, `maxValue`, and `isDisabled` props. */ - isCellDisabled(date: CalendarDate): boolean, + isCellDisabled: (date: CalendarDate) => boolean, /** Returns whether the given date is unavailable according to the `isDateUnavailable` prop. */ - isCellUnavailable(date: CalendarDate): boolean, + isCellUnavailable: (date: CalendarDate) => boolean, /** Returns whether the previous visible date range is allowed to be selected according to the `minValue` prop. */ - isPreviousVisibleRangeInvalid(): boolean, + isPreviousVisibleRangeInvalid: () => boolean, /** Returns whether the next visible date range is allowed to be selected according to the `maxValue` prop. */ - isNextVisibleRangeInvalid(): boolean, + isNextVisibleRangeInvalid: () => boolean, /** * Returns an array of dates in the week index counted from the provided start date, or the first visible date if not given. * The returned array always has 7 elements, but may include null if the date does not exist according to the calendar system. */ - getDatesInWeek(weekIndex: number, startDate?: CalendarDate): Array + getDatesInWeek: (weekIndex: number, startDate?: CalendarDate) => Array } export interface CalendarState extends CalendarStateBase { /** The currently selected date. */ readonly value: CalendarDate | null, /** Sets the currently selected date. */ - setValue(value: CalendarDate | null): void + setValue: (value: CalendarDate | null) => void } export interface RangeCalendarState extends CalendarStateBase { /** The currently selected date range. */ readonly value: RangeValue | null, /** Sets the currently selected date range. */ - setValue(value: RangeValue | null): void, + setValue: (value: RangeValue | null) => void, /** Highlights the given date during selection, e.g. by hovering or dragging. */ - highlightDate(date: CalendarDate): void, + highlightDate: (date: CalendarDate) => void, /** The current anchor date that the user clicked on to begin range selection. */ readonly anchorDate: CalendarDate | null, /** Sets the anchor date that the user clicked on to begin range selection. */ - setAnchorDate(date: CalendarDate | null): void, + setAnchorDate: (date: CalendarDate | null) => void, /** The currently highlighted date range. */ readonly highlightedRange: RangeValue | null, /** Whether the user is currently dragging over the calendar. */ readonly isDragging: boolean, /** Sets whether the user is dragging over the calendar. */ - setDragging(isDragging: boolean): void + setDragging: (isDragging: boolean) => void } diff --git a/packages/@react-stately/checkbox/src/useCheckboxGroupState.ts b/packages/@react-stately/checkbox/src/useCheckboxGroupState.ts index b1f1d2db9fa..45c8b01653e 100644 --- a/packages/@react-stately/checkbox/src/useCheckboxGroupState.ts +++ b/packages/@react-stately/checkbox/src/useCheckboxGroupState.ts @@ -44,22 +44,22 @@ export interface CheckboxGroupState extends FormValidationState { readonly isRequired: boolean, /** Returns whether the given value is selected. */ - isSelected(value: string): boolean, + isSelected: (value: string) => boolean, /** Sets the selected values. */ - setValue(value: string[]): void, + setValue: (value: string[]) => void, /** Adds a value to the set of selected values. */ - addValue(value: string): void, + addValue: (value: string) => void, /** Removes a value from the set of selected values. */ - removeValue(value: string): void, + removeValue: (value: string) => void, /** Toggles a value in the set of selected values. */ - toggleValue(value: string): void, + toggleValue: (value: string) => void, /** Sets whether one of the checkboxes is invalid. */ - setInvalid(value: string, validation: ValidationResult): void + setInvalid: (value: string, validation: ValidationResult) => void } /** diff --git a/packages/@react-stately/color/src/useColorAreaState.ts b/packages/@react-stately/color/src/useColorAreaState.ts index 07884c3a379..b6745622d48 100644 --- a/packages/@react-stately/color/src/useColorAreaState.ts +++ b/packages/@react-stately/color/src/useColorAreaState.ts @@ -21,37 +21,37 @@ export interface ColorAreaState { /** The default value of the color area. */ readonly defaultValue: Color, /** Sets the current color value. If a string is passed, it will be parsed to a Color. */ - setValue(value: string | Color): void, + setValue: (value: string | Color) => void, /** The current value of the horizontal axis channel displayed by the color area. */ xValue: number, /** Sets the value for the horizontal axis channel displayed by the color area, and triggers `onChange`. */ - setXValue(value: number): void, + setXValue: (value: number) => void, /** The current value of the vertical axis channel displayed by the color area. */ yValue: number, /** Sets the value for the vertical axis channel displayed by the color area, and triggers `onChange`. */ - setYValue(value: number): void, + setYValue: (value: number) => void, /** Sets the x and y channels of the current color value based on a percentage of the width and height of the color area, and triggers `onChange`. */ - setColorFromPoint(x: number, y: number): void, + setColorFromPoint: (x: number, y: number) => void, /** Returns the coordinates of the thumb relative to the upper left corner of the color area as a percentage. */ - getThumbPosition(): {x: number, y: number}, + getThumbPosition: () => {x: number, y: number}, /** Increments the value of the horizontal axis channel by the channel step or page amount. */ - incrementX(stepSize?: number): void, + incrementX: (stepSize?: number) => void, /** Decrements the value of the horizontal axis channel by the channel step or page amount. */ - decrementX(stepSize?: number): void, + decrementX: (stepSize?: number) => void, /** Increments the value of the vertical axis channel by the channel step or page amount. */ - incrementY(stepSize?: number): void, + incrementY: (stepSize?: number) => void, /** Decrements the value of the vertical axis channel by the channel step or page amount. */ - decrementY(stepSize?: number): void, + decrementY: (stepSize?: number) => void, /** Whether the color area is currently being dragged. */ readonly isDragging: boolean, /** Sets whether the color area is being dragged. */ - setDragging(value: boolean): void, + setDragging: (value: boolean) => void, /** Returns the xChannel, yChannel and zChannel names based on the color value. */ channels: {xChannel: ColorChannel, yChannel: ColorChannel, zChannel: ColorChannel}, @@ -65,7 +65,7 @@ export interface ColorAreaState { yChannelPageStep: number, /** Returns the color that should be displayed in the color area thumb instead of `value`. */ - getDisplayColor(): Color + getDisplayColor: () => Color } const DEFAULT_COLOR = parseColor('#ffffff'); diff --git a/packages/@react-stately/color/src/useColorChannelFieldState.ts b/packages/@react-stately/color/src/useColorChannelFieldState.ts index 05d10d5dd59..c7fa5fb400e 100644 --- a/packages/@react-stately/color/src/useColorChannelFieldState.ts +++ b/packages/@react-stately/color/src/useColorChannelFieldState.ts @@ -19,7 +19,7 @@ export interface ColorChannelFieldState extends NumberFieldState { /** The default value of the field. */ defaultColorValue: Color | null, /** Sets the color value of the field. */ - setColorValue(value: Color | null): void + setColorValue: (value: Color | null) => void } /** diff --git a/packages/@react-stately/color/src/useColorFieldState.ts b/packages/@react-stately/color/src/useColorFieldState.ts index 94371a9bf1b..2a24c2a6681 100644 --- a/packages/@react-stately/color/src/useColorFieldState.ts +++ b/packages/@react-stately/color/src/useColorFieldState.ts @@ -31,28 +31,28 @@ export interface ColorFieldState extends FormValidationState { /** The default value of the color field. */ readonly defaultColorValue: Color | null, /** Sets the color value of the field. */ - setColorValue(value: Color | null): void, + setColorValue: (value: Color | null) => void, /** Sets the current text value of the input. */ - setInputValue(value: string): void, + setInputValue: (value: string) => void, /** * Updates the input value based on the currently parsed color value. * Typically this is called when the field is blurred. */ - commit(): void, + commit: () => void, /** Increments the current input value to the next step boundary, and fires `onChange`. */ - increment(): void, + increment: () => void, /** Decrements the current input value to the next step boundary, and fires `onChange`. */ - decrement(): void, + decrement: () => void, /** Sets the current value to the maximum color value, and fires `onChange`. */ - incrementToMax(): void, + incrementToMax: () => void, /** Sets the current value to the minimum color value, and fires `onChange`. */ - decrementToMin(): void, + decrementToMin: () => void, /** * Validates a user input string. * Values can be partially entered, and may be valid even if they cannot currently be parsed to a color. * Can be used to implement validation as a user types. */ - validate(value: string): boolean + validate: (value: string) => boolean } const MIN_COLOR = parseColor('#000000'); diff --git a/packages/@react-stately/color/src/useColorPickerState.ts b/packages/@react-stately/color/src/useColorPickerState.ts index 6592a513c35..7a15e8e8063 100644 --- a/packages/@react-stately/color/src/useColorPickerState.ts +++ b/packages/@react-stately/color/src/useColorPickerState.ts @@ -10,7 +10,7 @@ export interface ColorPickerState { /** The current color value of the color picker. */ color: Color, /** Sets the current color value of the color picker. */ - setColor(color: Color | null): void + setColor: (color: Color | null) => void } export function useColorPickerState(props: ColorPickerProps): ColorPickerState { diff --git a/packages/@react-stately/color/src/useColorSliderState.ts b/packages/@react-stately/color/src/useColorSliderState.ts index 5c9bbf8feb3..ef8e964e932 100644 --- a/packages/@react-stately/color/src/useColorSliderState.ts +++ b/packages/@react-stately/color/src/useColorSliderState.ts @@ -20,9 +20,9 @@ export interface ColorSliderState extends SliderState { /** The current color value represented by the color slider. */ readonly value: Color, /** Sets the current color value. If a string is passed, it will be parsed to a Color. */ - setValue(value: string | Color): void, + setValue: (value: string | Color) => void, /** Returns the color that should be displayed in the slider instead of `value` or the optional parameter. */ - getDisplayColor(): Color, + getDisplayColor: () => Color, /** Whether the color slider is currently being dragged. */ readonly isDragging: boolean } diff --git a/packages/@react-stately/color/src/useColorWheelState.ts b/packages/@react-stately/color/src/useColorWheelState.ts index 9d9f34bc69e..8aa870aac34 100644 --- a/packages/@react-stately/color/src/useColorWheelState.ts +++ b/packages/@react-stately/color/src/useColorWheelState.ts @@ -21,29 +21,29 @@ export interface ColorWheelState { /** The default color value. */ readonly defaultValue: Color, /** Sets the color value represented by the color wheel, and triggers `onChange`. */ - setValue(value: string | Color): void, + setValue: (value: string | Color) => void, /** The current value of the hue channel displayed by the color wheel. */ readonly hue: number, /** Sets the hue channel of the current color value and triggers `onChange`. */ - setHue(value: number): void, + setHue: (value: number) => void, /** Sets the hue channel of the current color value based on the given coordinates and radius of the color wheel, and triggers `onChange`. */ - setHueFromPoint(x: number, y: number, radius: number): void, + setHueFromPoint: (x: number, y: number, radius: number) => void, /** Returns the coordinates of the thumb relative to the center point of the color wheel. */ - getThumbPosition(radius: number): {x: number, y: number}, + getThumbPosition: (radius: number) => {x: number, y: number}, /** Increments the hue by the given amount (defaults to 1). */ - increment(stepSize?: number): void, + increment: (stepSize?: number) => void, /** Decrements the hue by the given amount (defaults to 1). */ - decrement(stepSize?: number): void, + decrement: (stepSize?: number) => void, /** Whether the color wheel is currently being dragged. */ readonly isDragging: boolean, /** Sets whether the color wheel is being dragged. */ - setDragging(value: boolean): void, + setDragging: (value: boolean) => void, /** Returns the color that should be displayed in the color wheel instead of `value`. */ - getDisplayColor(): Color, + getDisplayColor: () => Color, /** The step value of the hue channel, used when incrementing and decrementing. */ step: number, /** The page step value of the hue channel, used when incrementing and decrementing. */ diff --git a/packages/@react-stately/combobox/src/useComboBoxState.ts b/packages/@react-stately/combobox/src/useComboBoxState.ts index 8278ca9a05b..67ffc9bfbe2 100644 --- a/packages/@react-stately/combobox/src/useComboBoxState.ts +++ b/packages/@react-stately/combobox/src/useComboBoxState.ts @@ -26,17 +26,17 @@ export interface ComboBoxState extends SelectState, FormValidationState{ /** The default value of the combo box input. */ defaultInputValue: string, /** Sets the value of the combo box input. */ - setInputValue(value: string): void, + setInputValue: (value: string) => void, /** Selects the currently focused item and updates the input value. */ - commit(): void, + commit: () => void, /** Controls which item will be auto focused when the menu opens. */ readonly focusStrategy: FocusStrategy | null, /** Opens the menu. */ - open(focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction): void, + open: (focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction) => void, /** Toggles the menu. */ - toggle(focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction): void, + toggle: (focusStrategy?: FocusStrategy | null, trigger?: MenuTriggerAction) => void, /** Resets the input value to the previously selected item's text if any and closes the menu. */ - revert(): void + revert: () => void } type FilterFn = (textValue: string, inputValue: string) => boolean; diff --git a/packages/@react-stately/data/src/useAsyncList.ts b/packages/@react-stately/data/src/useAsyncList.ts index 5bf913cc9a6..28d9717e660 100644 --- a/packages/@react-stately/data/src/useAsyncList.ts +++ b/packages/@react-stately/data/src/useAsyncList.ts @@ -102,11 +102,11 @@ export interface AsyncListData extends ListData { sortDescriptor?: SortDescriptor, /** Reloads the data in the list. */ - reload(): void, + reload: () => void, /** Loads the next page of data in the list. */ - loadMore(): void, + loadMore: () => void, /** Triggers sorting for the list. */ - sort(descriptor: SortDescriptor): void, + sort: (descriptor: SortDescriptor) => void, /** The current loading state for the list. */ loadingState: LoadingState } diff --git a/packages/@react-stately/data/src/useListData.ts b/packages/@react-stately/data/src/useListData.ts index 1e8b6a840e5..5102306d7f5 100644 --- a/packages/@react-stately/data/src/useListData.ts +++ b/packages/@react-stately/data/src/useListData.ts @@ -34,92 +34,92 @@ export interface ListData { selectedKeys: Selection, /** Sets the selected keys. */ - setSelectedKeys(keys: Selection): void, + setSelectedKeys: (keys: Selection) => void, /** The current filter text. */ filterText: string, /** Sets the filter text. */ - setFilterText(filterText: string): void, + setFilterText: (filterText: string) => void, /** * Gets an item from the list by key. * @param key - The key of the item to retrieve. */ - getItem(key: Key): T | undefined, + getItem: (key: Key) => T | undefined, /** * Inserts items into the list at the given index. * @param index - The index to insert into. * @param values - The values to insert. */ - insert(index: number, ...values: T[]): void, + insert: (index: number, ...values: T[]) => void, /** * Inserts items into the list before the item at the given key. * @param key - The key of the item to insert before. * @param values - The values to insert. */ - insertBefore(key: Key, ...values: T[]): void, + insertBefore: (key: Key, ...values: T[]) => void, /** * Inserts items into the list after the item at the given key. * @param key - The key of the item to insert after. * @param values - The values to insert. */ - insertAfter(key: Key, ...values: T[]): void, + insertAfter: (key: Key, ...values: T[]) => void, /** * Appends items to the list. * @param values - The values to insert. */ - append(...values: T[]): void, + append: (...values: T[]) => void, /** * Prepends items to the list. * @param value - The value to insert. */ - prepend(...values: T[]): void, + prepend: (...values: T[]) => void, /** * Removes items from the list by their keys. * @param keys - The keys of the item to remove. */ - remove(...keys: Key[]): void, + remove: (...keys: Key[]) => void, /** * Removes all items from the list that are currently * in the set of selected items. */ - removeSelectedItems(): void, + removeSelectedItems: () => void, /** * Moves an item within the list. * @param key - The key of the item to move. * @param toIndex - The index to move the item to. */ - move(key: Key, toIndex: number): void, + move: (key: Key, toIndex: number) => void, /** * Moves one or more items before a given key. * @param key - The key of the item to move the items before. * @param keys - The keys of the items to move. */ - moveBefore(key: Key, keys: Iterable): void, + moveBefore: (key: Key, keys: Iterable) => void, /** * Moves one or more items after a given key. * @param key - The key of the item to move the items after. * @param keys - The keys of the items to move. */ - moveAfter(key: Key, keys: Iterable): void, + moveAfter: (key: Key, keys: Iterable) => void, /** * Updates an item in the list. * @param key - The key of the item to update. * @param newValue - The new value for the item. */ - update(key: Key, newValue: T): void + update: (key: Key, newValue: T) => void } export interface ListState { diff --git a/packages/@react-stately/data/src/useTreeData.ts b/packages/@react-stately/data/src/useTreeData.ts index 5baf6d8f3f9..960ede55bf1 100644 --- a/packages/@react-stately/data/src/useTreeData.ts +++ b/packages/@react-stately/data/src/useTreeData.ts @@ -43,13 +43,13 @@ export interface TreeData { selectedKeys: Set, /** Sets the selected keys. */ - setSelectedKeys(keys: Set): void, + setSelectedKeys: (keys: Set) => void, /** * Gets a node from the tree by key. * @param key - The key of the item to retrieve. */ - getItem(key: Key): TreeNode | undefined, + getItem: (key: Key) => TreeNode | undefined, /** * Inserts an item into a parent node as a child. @@ -57,47 +57,47 @@ export interface TreeData { * @param index - The index within the parent to insert into. * @param value - The value to insert. */ - insert(parentKey: Key | null, index: number, ...values: T[]): void, + insert: (parentKey: Key | null, index: number, ...values: T[]) => void, /** * Inserts items into the list before the item at the given key. * @param key - The key of the item to insert before. * @param values - The values to insert. */ - insertBefore(key: Key, ...values: T[]): void, + insertBefore: (key: Key, ...values: T[]) => void, /** * Inserts items into the list after the item at the given key. * @param key - The key of the item to insert after. * @param values - The values to insert. */ - insertAfter(key: Key, ...values: T[]): void, + insertAfter: (key: Key, ...values: T[]) => void, /** * Appends an item into a parent node as a child. * @param parentKey - The key of the parent item to insert into. `null` for the root. * @param value - The value to insert. */ - append(parentKey: Key | null, ...values: T[]): void, + append: (parentKey: Key | null, ...values: T[]) => void, /** * Prepends an item into a parent node as a child. * @param parentKey - The key of the parent item to insert into. `null` for the root. * @param value - The value to insert. */ - prepend(parentKey: Key | null, ...value: T[]): void, + prepend: (parentKey: Key | null, ...value: T[]) => void, /** * Removes an item from the tree by its key. * @param key - The key of the item to remove. */ - remove(...keys: Key[]): void, + remove: (...keys: Key[]) => void, /** * Removes all items from the tree that are currently * in the set of selected items. */ - removeSelectedItems(): void, + removeSelectedItems: () => void, /** * Moves an item within the tree. @@ -105,28 +105,28 @@ export interface TreeData { * @param toParentKey - The key of the new parent to insert into. `null` for the root. * @param index - The index within the new parent to insert at. */ - move(key: Key, toParentKey: Key | null, index: number): void, + move: (key: Key, toParentKey: Key | null, index: number) => void, /** * Moves one or more items before a given key. * @param key - The key of the item to move the items before. * @param keys - The keys of the items to move. */ - moveBefore(key: Key, keys: Iterable): void, + moveBefore: (key: Key, keys: Iterable) => void, /** * Moves one or more items after a given key. * @param key - The key of the item to move the items after. * @param keys - The keys of the items to move. */ - moveAfter(key: Key, keys: Iterable): void, + moveAfter: (key: Key, keys: Iterable) => void, /** * Updates an item in the tree. * @param key - The key of the item to update. * @param newValue - The new value for the item. */ - update(key: Key, newValue: T): void + update: (key: Key, newValue: T) => void } interface TreeDataState { diff --git a/packages/@react-stately/datepicker/src/useDatePickerState.ts b/packages/@react-stately/datepicker/src/useDatePickerState.ts index ad1506bebf4..0c7f32c765a 100644 --- a/packages/@react-stately/datepicker/src/useDatePickerState.ts +++ b/packages/@react-stately/datepicker/src/useDatePickerState.ts @@ -33,21 +33,21 @@ export interface DatePickerState extends OverlayTriggerState, FormValidationStat /** The default date. */ defaultValue: DateValue | null, /** Sets the selected date. */ - setValue(value: DateValue | null): void, + setValue: (value: DateValue | null) => void, /** * The date portion of the value. This may be set prior to `value` if the user has * selected a date but has not yet selected a time. */ dateValue: DateValue | null, /** Sets the date portion of the value. */ - setDateValue(value: DateValue): void, + setDateValue: (value: DateValue) => void, /** * The time portion of the value. This may be set prior to `value` if the user has * selected a time but has not yet selected a date. */ timeValue: TimeValue | null, /** Sets the time portion of the value. */ - setTimeValue(value: TimeValue): void, + setTimeValue: (value: TimeValue) => void, /** The granularity for the field, based on the `granularity` prop and current value. */ granularity: Granularity, /** Whether the date picker supports selecting a time, according to the `granularity` prop and current value. */ @@ -55,7 +55,7 @@ export interface DatePickerState extends OverlayTriggerState, FormValidationStat /** Whether the calendar popover is currently open. */ isOpen: boolean, /** Sets whether the calendar popover is open. */ - setOpen(isOpen: boolean): void, + setOpen: (isOpen: boolean) => void, /** * The current validation state of the date picker, based on the `validationState`, `minValue`, and `maxValue` props. * @deprecated Use `isInvalid` instead. @@ -64,9 +64,9 @@ export interface DatePickerState extends OverlayTriggerState, FormValidationStat /** Whether the date picker is invalid, based on the `isInvalid`, `minValue`, and `maxValue` props. */ isInvalid: boolean, /** Formats the selected value using the given options. */ - formatValue(locale: string, fieldOptions: FieldOptions): string, + formatValue: (locale: string, fieldOptions: FieldOptions) => string, /** Gets a formatter based on state's props. */ - getDateFormatter(locale: string, formatOptions: FormatterOptions): DateFormatter + getDateFormatter: (locale: string, formatOptions: FormatterOptions) => DateFormatter } /** diff --git a/packages/@react-stately/datepicker/src/useDateRangePickerState.ts b/packages/@react-stately/datepicker/src/useDateRangePickerState.ts index 18b1231491d..df2817f364b 100644 --- a/packages/@react-stately/datepicker/src/useDateRangePickerState.ts +++ b/packages/@react-stately/datepicker/src/useDateRangePickerState.ts @@ -35,27 +35,27 @@ export interface DateRangePickerState extends OverlayTriggerState, FormValidatio /** The default selected date range. */ defaultValue: DateRange | null, /** Sets the selected date range. */ - setValue(value: DateRange | null): void, + setValue: (value: DateRange | null) => void, /** * The date portion of the selected range. This may be set prior to `value` if the user has * selected a date range but has not yet selected a time range. */ dateRange: RangeValue | null, /** Sets the date portion of the selected range. */ - setDateRange(value: DateRange): void, + setDateRange: (value: DateRange) => void, /** * The time portion of the selected range. This may be set prior to `value` if the user has * selected a time range but has not yet selected a date range. */ timeRange: RangeValue | null, /** Sets the time portion of the selected range. */ - setTimeRange(value: TimeRange): void, + setTimeRange: (value: TimeRange) => void, /** Sets the date portion of either the start or end of the selected range. */ - setDate(part: 'start' | 'end', value: DateValue | null): void, + setDate: (part: 'start' | 'end', value: DateValue | null) => void, /** Sets the time portion of either the start or end of the selected range. */ - setTime(part: 'start' | 'end', value: TimeValue | null): void, + setTime: (part: 'start' | 'end', value: TimeValue | null) => void, /** Sets the date and time of either the start or end of the selected range. */ - setDateTime(part: 'start' | 'end', value: DateValue | null): void, + setDateTime: (part: 'start' | 'end', value: DateValue | null) => void, /** The granularity for the field, based on the `granularity` prop and current value. */ granularity: Granularity, /** Whether the date range picker supports selecting times, according to the `granularity` prop and current value. */ @@ -63,7 +63,7 @@ export interface DateRangePickerState extends OverlayTriggerState, FormValidatio /** Whether the calendar popover is currently open. */ isOpen: boolean, /** Sets whether the calendar popover is open. */ - setOpen(isOpen: boolean): void, + setOpen: (isOpen: boolean) => void, /** * The current validation state of the date range picker, based on the `validationState`, `minValue`, and `maxValue` props. * @deprecated Use `isInvalid` instead. @@ -72,9 +72,9 @@ export interface DateRangePickerState extends OverlayTriggerState, FormValidatio /** Whether the date range picker is invalid, based on the `isInvalid`, `minValue`, and `maxValue` props. */ isInvalid: boolean, /** Formats the selected range using the given options. */ - formatValue(locale: string, fieldOptions: FieldOptions): {start: string, end: string} | null, + formatValue: (locale: string, fieldOptions: FieldOptions) => {start: string, end: string} | null, /** Gets a formatter based on state's props. */ - getDateFormatter(locale: string, formatOptions: FormatterOptions): DateFormatter + getDateFormatter: (locale: string, formatOptions: FormatterOptions) => DateFormatter } /** diff --git a/packages/@react-stately/disclosure/src/useDisclosureGroupState.ts b/packages/@react-stately/disclosure/src/useDisclosureGroupState.ts index ef880baa6e9..d9bbe965b2e 100644 --- a/packages/@react-stately/disclosure/src/useDisclosureGroupState.ts +++ b/packages/@react-stately/disclosure/src/useDisclosureGroupState.ts @@ -38,10 +38,10 @@ export interface DisclosureGroupState { readonly expandedKeys: Set, /** Toggles the expanded state for an item by its key. */ - toggleKey(key: Key): void, + toggleKey: (key: Key) => void, /** Replaces the set of expanded keys. */ - setExpandedKeys(keys: Set): void + setExpandedKeys: (keys: Set) => void } /** diff --git a/packages/@react-stately/disclosure/src/useDisclosureState.ts b/packages/@react-stately/disclosure/src/useDisclosureState.ts index c7b0d14b94c..7274e310143 100644 --- a/packages/@react-stately/disclosure/src/useDisclosureState.ts +++ b/packages/@react-stately/disclosure/src/useDisclosureState.ts @@ -27,13 +27,13 @@ export interface DisclosureState { /** Whether the disclosure is currently expanded. */ readonly isExpanded: boolean, /** Sets whether the disclosure is expanded. */ - setExpanded(isExpanded: boolean): void, + setExpanded: (isExpanded: boolean) => void, /** Expand the disclosure. */ - expand(): void, + expand: () => void, /** Collapse the disclosure. */ - collapse(): void, + collapse: () => void, /** Toggles the disclosure's visibility. */ - toggle(): void + toggle: () => void } /** diff --git a/packages/@react-stately/dnd/src/useDraggableCollectionState.ts b/packages/@react-stately/dnd/src/useDraggableCollectionState.ts index 5114fbe22a6..b37f7576ff2 100644 --- a/packages/@react-stately/dnd/src/useDraggableCollectionState.ts +++ b/packages/@react-stately/dnd/src/useDraggableCollectionState.ts @@ -35,21 +35,21 @@ export interface DraggableCollectionState { /** Whether drag events are disabled. */ isDisabled?: boolean, /** Returns whether the given key is currently being dragged. */ - isDragging(key: Key): boolean, + isDragging: (key: Key) => boolean, /** Returns the keys of the items that will be dragged with the given key (e.g. selected items). */ - getKeysForDrag(key: Key): Set, + getKeysForDrag: (key: Key) => Set, /** Returns the items to drag for the given key. */ - getItems(key: Key): DragItem[], + getItems: (key: Key) => DragItem[], /** The ref of the element that will be rendered as the drag preview while dragging. */ preview?: RefObject, /** Function that returns the drop operations that are allowed for the dragged items. If not provided, all drop operations are allowed. */ getAllowedDropOperations?: () => DropOperation[], /** Begins a drag for the given key. This triggers the onDragStart event. */ - startDrag(key: Key, event: DragStartEvent): void, + startDrag: (key: Key, event: DragStartEvent) => void, /** Triggers an onDragMove event. */ - moveDrag(event: DragMoveEvent): void, + moveDrag: (event: DragMoveEvent) => void, /** Ends the current drag, and emits an onDragEnd event. */ - endDrag(event: DraggableCollectionEndEvent): void + endDrag: (event: DraggableCollectionEndEvent) => void } /** diff --git a/packages/@react-stately/dnd/src/useDroppableCollectionState.ts b/packages/@react-stately/dnd/src/useDroppableCollectionState.ts index 01036c91688..4cf15209fa4 100644 --- a/packages/@react-stately/dnd/src/useDroppableCollectionState.ts +++ b/packages/@react-stately/dnd/src/useDroppableCollectionState.ts @@ -41,11 +41,11 @@ export interface DroppableCollectionState { /** Whether drop events are disabled. */ isDisabled?: boolean, /** Sets the current drop target. */ - setTarget(target: DropTarget | null): void, + setTarget: (target: DropTarget | null) => void, /** Returns whether the given target is equivalent to the current drop target. */ - isDropTarget(target: DropTarget | null): boolean, + isDropTarget: (target: DropTarget | null) => boolean, /** Returns the drop operation for the given parameters. */ - getDropOperation(e: DropOperationEvent): DropOperation + getDropOperation: (e: DropOperationEvent) => DropOperation } /** diff --git a/packages/@react-stately/form/src/useFormValidationState.ts b/packages/@react-stately/form/src/useFormValidationState.ts index 83acd2f155f..493f27e65ea 100644 --- a/packages/@react-stately/form/src/useFormValidationState.ts +++ b/packages/@react-stately/form/src/useFormValidationState.ts @@ -55,11 +55,11 @@ export interface FormValidationState { /** Currently displayed validation results, updated when the user commits their changes. */ displayValidation: ValidationResult, /** Updates the current validation result. Not displayed to the user until `commitValidation` is called. */ - updateValidation(result: ValidationResult): void, + updateValidation: (result: ValidationResult) => void, /** Resets the displayed validation state to valid when the user resets the form. */ - resetValidation(): void, + resetValidation: () => void, /** Commits the realtime validation so it is displayed to the user. */ - commitValidation(): void + commitValidation: () => void } export function useFormValidationState(props: FormValidationProps): FormValidationState { diff --git a/packages/@react-stately/list/src/useSingleSelectListState.ts b/packages/@react-stately/list/src/useSingleSelectListState.ts index b99a98af8ad..2d0ecefc0ab 100644 --- a/packages/@react-stately/list/src/useSingleSelectListState.ts +++ b/packages/@react-stately/list/src/useSingleSelectListState.ts @@ -27,7 +27,7 @@ export interface SingleSelectListState extends ListState { readonly selectedKey: Key | null, /** Sets the selected key. */ - setSelectedKey(key: Key | null): void, + setSelectedKey: (key: Key | null) => void, /** The value of the currently selected item. */ readonly selectedItem: Node | null diff --git a/packages/@react-stately/menu/src/useMenuTriggerState.ts b/packages/@react-stately/menu/src/useMenuTriggerState.ts index 0901c052323..5033741dde5 100644 --- a/packages/@react-stately/menu/src/useMenuTriggerState.ts +++ b/packages/@react-stately/menu/src/useMenuTriggerState.ts @@ -20,10 +20,10 @@ export interface MenuTriggerState extends OverlayTriggerState { readonly focusStrategy: FocusStrategy | null, /** Opens the menu. */ - open(focusStrategy?: FocusStrategy | null): void, + open: (focusStrategy?: FocusStrategy | null) => void, /** Toggles the menu. */ - toggle(focusStrategy?: FocusStrategy | null): void + toggle: (focusStrategy?: FocusStrategy | null) => void } export interface RootMenuTriggerState extends MenuTriggerState { diff --git a/packages/@react-stately/numberfield/src/useNumberFieldState.ts b/packages/@react-stately/numberfield/src/useNumberFieldState.ts index 9902a739c6a..6c6b21edf5f 100644 --- a/packages/@react-stately/numberfield/src/useNumberFieldState.ts +++ b/packages/@react-stately/numberfield/src/useNumberFieldState.ts @@ -42,26 +42,26 @@ export interface NumberFieldState extends FormValidationState { * Values can be partially entered, and may be valid even if they cannot currently be parsed to a number. * Can be used to implement validation as a user types. */ - validate(value: string): boolean, + validate: (value: string) => boolean, /** Sets the current text value of the input. */ - setInputValue(val: string): void, + setInputValue: (val: string) => void, /** Sets the number value. */ - setNumberValue(val: number): void, + setNumberValue: (val: number) => void, /** * Commits the current input value. The value is parsed to a number, clamped according * to the minimum and maximum values of the field, and snapped to the nearest step value. * This will fire the `onChange` prop with the new value, and if uncontrolled, update the `numberValue`. * Typically this is called when the field is blurred. */ - commit(): void, + commit: () => void, /** Increments the current input value to the next step boundary, and fires `onChange`. */ - increment(): void, + increment: () => void, /** Decrements the current input value to the next step boundary, and fires `onChange`. */ - decrement(): void, + decrement: () => void, /** Sets the current value to the `maxValue` if any, and fires `onChange`. */ - incrementToMax(): void, + incrementToMax: () => void, /** Sets the current value to the `minValue` if any, and fires `onChange`. */ - decrementToMin(): void + decrementToMin: () => void } export interface NumberFieldStateOptions extends NumberFieldProps { diff --git a/packages/@react-stately/overlays/src/useOverlayTriggerState.ts b/packages/@react-stately/overlays/src/useOverlayTriggerState.ts index 8e698afeea2..7dfa434c2a4 100644 --- a/packages/@react-stately/overlays/src/useOverlayTriggerState.ts +++ b/packages/@react-stately/overlays/src/useOverlayTriggerState.ts @@ -18,13 +18,13 @@ export interface OverlayTriggerState { /** Whether the overlay is currently open. */ readonly isOpen: boolean, /** Sets whether the overlay is open. */ - setOpen(isOpen: boolean): void, + setOpen: (isOpen: boolean) => void, /** Opens the overlay. */ - open(): void, + open: () => void, /** Closes the overlay. */ - close(): void, + close: () => void, /** Toggles the overlay's visibility. */ - toggle(): void + toggle: () => void } /** diff --git a/packages/@react-stately/radio/src/useRadioGroupState.ts b/packages/@react-stately/radio/src/useRadioGroupState.ts index 003e9f5e5d9..a4a47683cb5 100644 --- a/packages/@react-stately/radio/src/useRadioGroupState.ts +++ b/packages/@react-stately/radio/src/useRadioGroupState.ts @@ -49,13 +49,13 @@ export interface RadioGroupState extends FormValidationState { readonly defaultSelectedValue: string | null, /** Sets the selected value. */ - setSelectedValue(value: string | null): void, + setSelectedValue: (value: string | null) => void, /** The value of the last focused radio. */ readonly lastFocusedValue: string | null, /** Sets the last focused value. */ - setLastFocusedValue(value: string | null): void + setLastFocusedValue: (value: string | null) => void } let instance = Math.round(Math.random() * 10000000000); diff --git a/packages/@react-stately/searchfield/src/useSearchFieldState.ts b/packages/@react-stately/searchfield/src/useSearchFieldState.ts index 3a338cf6ef0..8b099867a63 100644 --- a/packages/@react-stately/searchfield/src/useSearchFieldState.ts +++ b/packages/@react-stately/searchfield/src/useSearchFieldState.ts @@ -18,7 +18,7 @@ export interface SearchFieldState { readonly value: string, /** Sets the value of the search field. */ - setValue(value: string): void + setValue: (value: string) => void } /** diff --git a/packages/@react-stately/select/src/useSelectState.ts b/packages/@react-stately/select/src/useSelectState.ts index cdab4312f40..24e01e12e25 100644 --- a/packages/@react-stately/select/src/useSelectState.ts +++ b/packages/@react-stately/select/src/useSelectState.ts @@ -27,16 +27,16 @@ export interface SelectState extends SingleSelectListState, OverlayTrigger readonly isFocused: boolean, /** Sets whether the select is focused. */ - setFocused(isFocused: boolean): void, + setFocused: (isFocused: boolean) => void, /** Controls which item will be auto focused when the menu opens. */ readonly focusStrategy: FocusStrategy | null, /** Opens the menu. */ - open(focusStrategy?: FocusStrategy | null): void, + open: (focusStrategy?: FocusStrategy | null) => void, /** Toggles the menu. */ - toggle(focusStrategy?: FocusStrategy | null): void + toggle: (focusStrategy?: FocusStrategy | null) => void } /** diff --git a/packages/@react-stately/selection/src/types.ts b/packages/@react-stately/selection/src/types.ts index 8eafe03307b..35325c3dfd1 100644 --- a/packages/@react-stately/selection/src/types.ts +++ b/packages/@react-stately/selection/src/types.ts @@ -17,13 +17,13 @@ export interface FocusState { /** Whether the collection is currently focused. */ readonly isFocused: boolean, /** Sets whether the collection is focused. */ - setFocused(isFocused: boolean): void, + setFocused: (isFocused: boolean) => void, /** The current focused key in the collection. */ readonly focusedKey: Key | null, /** Whether the first or last child of the focused key should receive focus. */ readonly childFocusStrategy: FocusStrategy | null, /** Sets the focused key, and optionally, whether the first or last child of that key should receive focus. */ - setFocusedKey(key: Key | null, child?: FocusStrategy): void + setFocusedKey: (key: Key | null, child?: FocusStrategy) => void } export interface SingleSelectionState extends FocusState { @@ -32,7 +32,7 @@ export interface SingleSelectionState extends FocusState { /** The currently selected key in the collection. */ readonly selectedKey: Key, /** Sets the selected key in the collection. */ - setSelectedKey(key: Key | null): void + setSelectedKey: (key: Key | null) => void } export interface MultipleSelectionState extends FocusState { @@ -41,13 +41,13 @@ export interface MultipleSelectionState extends FocusState { /** The selection behavior for the collection. */ readonly selectionBehavior: SelectionBehavior, /** Sets the selection behavior for the collection. */ - setSelectionBehavior(selectionBehavior: SelectionBehavior): void, + setSelectionBehavior: (selectionBehavior: SelectionBehavior) => void, /** Whether the collection allows empty selection. */ readonly disallowEmptySelection: boolean, /** The currently selected keys in the collection. */ readonly selectedKeys: Selection, /** Sets the selected keys in the collection. */ - setSelectedKeys(keys: Selection): void, + setSelectedKeys: (keys: Selection) => void, /** The currently disabled keys in the collection. */ readonly disabledKeys: Set, /** Whether `disabledKeys` applies to selection, actions, or both. */ @@ -76,38 +76,38 @@ export interface MultipleSelectionManager extends FocusState { /** Whether `disabledKeys` applies to selection, actions, or both. */ readonly disabledBehavior: DisabledBehavior, /** Returns whether a key is selected. */ - isSelected(key: Key): boolean, + isSelected: (key: Key) => boolean, /** Returns whether the current selection is equal to the given selection. */ - isSelectionEqual(selection: Set): boolean, + isSelectionEqual: (selection: Set) => boolean, /** Extends the selection to the given key. */ - extendSelection(toKey: Key): void, + extendSelection: (toKey: Key) => void, /** Toggles whether the given key is selected. */ - toggleSelection(key: Key): void, + toggleSelection: (key: Key) => void, /** Replaces the selection with only the given key. */ - replaceSelection(key: Key): void, + replaceSelection: (key: Key) => void, /** Replaces the selection with the given keys. */ - setSelectedKeys(keys: Iterable): void, + setSelectedKeys: (keys: Iterable) => void, /** Selects all items in the collection. */ - selectAll(): void, + selectAll: () => void, /** Removes all keys from the selection. */ - clearSelection(): void, + clearSelection: () => void, /** Toggles between select all and an empty selection. */ - toggleSelectAll(): void, + toggleSelectAll: () => void, /** * Toggles, replaces, or extends selection to the given key depending * on the pointer event and collection's selection mode. */ - select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent): void, + select: (key: Key, e?: PressEvent | LongPressEvent | PointerEvent) => void, /** Returns whether the given key can be selected. */ - canSelectItem(key: Key): boolean, + canSelectItem: (key: Key) => boolean, /** Returns whether the given key is non-interactive, i.e. both selection and actions are disabled. */ - isDisabled(key: Key): boolean, + isDisabled: (key: Key) => boolean, /** Sets the selection behavior for the collection. */ - setSelectionBehavior(selectionBehavior: SelectionBehavior): void, + setSelectionBehavior: (selectionBehavior: SelectionBehavior) => void, /** Returns whether the given key is a hyperlink. */ - isLink(key: Key): boolean, + isLink: (key: Key) => boolean, /** Returns the props for the given item. */ - getItemProps(key: Key): any, + getItemProps: (key: Key) => any, /** The collection of nodes that the selection manager handles. */ collection: Collection> } diff --git a/packages/@react-stately/slider/src/useSliderState.ts b/packages/@react-stately/slider/src/useSliderState.ts index 0f7350fc9a5..821a7559e54 100644 --- a/packages/@react-stately/slider/src/useSliderState.ts +++ b/packages/@react-stately/slider/src/useSliderState.ts @@ -28,7 +28,7 @@ export interface SliderState { * Get the value for the specified thumb. * @param index */ - getThumbValue(index: number): number, + getThumbValue: (index: number) => number, /** * Sets the value for the specified thumb. @@ -36,26 +36,26 @@ export interface SliderState { * @param index * @param value */ - setThumbValue(index: number, value: number): void, + setThumbValue: (index: number, value: number) => void, /** * Sets value for the specified thumb by percent offset (between 0 and 1). * @param index * @param percent */ - setThumbPercent(index: number, percent: number): void, + setThumbPercent: (index: number, percent: number) => void, /** * Whether the specific thumb is being dragged. * @param index */ - isThumbDragging(index: number): boolean, + isThumbDragging: (index: number) => boolean, /** * Set is dragging on the specified thumb. * @param index * @param dragging */ - setThumbDragging(index: number, dragging: boolean): void, + setThumbDragging: (index: number, dragging: boolean) => void, /** * Currently-focused thumb index. @@ -66,71 +66,71 @@ export interface SliderState { * any thumb that had it before. * @param index */ - setFocusedThumb(index: number | undefined): void, + setFocusedThumb: (index: number | undefined) => void, /** * Returns the specified thumb's value as a percentage from 0 to 1. * @param index */ - getThumbPercent(index: number): number, + getThumbPercent: (index: number) => number, /** * Returns the value as a percent between the min and max of the slider. * @param index */ - getValuePercent(value: number): number, + getValuePercent: (value: number) => number, /** * Returns the string label for the specified thumb's value, per props.formatOptions. * @param index */ - getThumbValueLabel(index: number): string, + getThumbValueLabel: (index: number) => string, /** * Returns the string label for the value, per props.formatOptions. * @param index */ - getFormattedValue(value: number): string, + getFormattedValue: (value: number) => string, /** * Returns the min allowed value for the specified thumb. * @param index */ - getThumbMinValue(index: number): number, + getThumbMinValue: (index: number) => number, /** * Returns the max allowed value for the specified thumb. * @param index */ - getThumbMaxValue(index: number): number, + getThumbMaxValue: (index: number) => number, /** * Converts a percent along track (between 0 and 1) to the corresponding value. * @param percent */ - getPercentValue(percent: number): number, + getPercentValue: (percent: number) => number, /** * Returns if the specified thumb is editable. * @param index */ - isThumbEditable(index: number): boolean, + isThumbEditable: (index: number) => boolean, /** * Set the specified thumb's editable state. * @param index * @param editable */ - setThumbEditable(index: number, editable: boolean): void, + setThumbEditable: (index: number, editable: boolean) => void, /** * Increments the value of the thumb by the step or page amount. */ - incrementThumb(index: number, stepSize?: number): void, + incrementThumb: (index: number, stepSize?: number) => void, /** * Decrements the value of the thumb by the step or page amount. */ - decrementThumb(index: number, stepSize?: number): void, + decrementThumb: (index: number, stepSize?: number) => void, /** * The step amount for the slider. diff --git a/packages/@react-stately/steplist/src/useStepListState.ts b/packages/@react-stately/steplist/src/useStepListState.ts index f2957971b44..36e4d11fbe4 100644 --- a/packages/@react-stately/steplist/src/useStepListState.ts +++ b/packages/@react-stately/steplist/src/useStepListState.ts @@ -32,9 +32,9 @@ export interface StepListProps extends CollectionBase, Omit extends SingleSelectListState { readonly lastCompletedStep?: Key, - setLastCompletedStep(key: Key): void, - isCompleted(key: Key): boolean, - isSelectable(key: Key): boolean + setLastCompletedStep: (key: Key) => void, + isCompleted: (key: Key) => boolean, + isSelectable: (key: Key) => boolean } export function useStepListState(props: StepListProps): StepListState { diff --git a/packages/@react-stately/table/src/useTableState.ts b/packages/@react-stately/table/src/useTableState.ts index 0addeb10a35..2c53e094c99 100644 --- a/packages/@react-stately/table/src/useTableState.ts +++ b/packages/@react-stately/table/src/useTableState.ts @@ -26,7 +26,7 @@ export interface TableState extends GridState> { /** The current sorted column and direction. */ sortDescriptor: SortDescriptor | null, /** Calls the provided onSortChange handler with the provided column key and sort direction. */ - sort(columnKey: Key, direction?: 'ascending' | 'descending'): void, + sort: (columnKey: Key, direction?: 'ascending' | 'descending') => void, /** Whether keyboard navigation is disabled, such as when the arrow keys should be handled by a component within a cell. */ isKeyboardNavigationDisabled: boolean, /** Set whether keyboard navigation is disabled, such as when the arrow keys should be handled by a component within a cell. */ diff --git a/packages/@react-stately/table/src/useTreeGridState.ts b/packages/@react-stately/table/src/useTreeGridState.ts index 3e6e3247927..1462fa14a48 100644 --- a/packages/@react-stately/table/src/useTreeGridState.ts +++ b/packages/@react-stately/table/src/useTreeGridState.ts @@ -23,7 +23,7 @@ export interface TreeGridState extends TableState { /** A set of keys for items that are expanded. */ expandedKeys: 'all' | Set, /** Toggles the expanded state for a row by its key. */ - toggleKey(key: Key): void, + toggleKey: (key: Key) => void, /** The key map containing nodes representing the collection's tree grid structure. */ keyMap: Map>, /** The number of leaf columns provided by the user. */ diff --git a/packages/@react-stately/toast/src/useToastState.ts b/packages/@react-stately/toast/src/useToastState.ts index 2691f637f67..e6762e81d2a 100644 --- a/packages/@react-stately/toast/src/useToastState.ts +++ b/packages/@react-stately/toast/src/useToastState.ts @@ -40,15 +40,15 @@ export interface QueuedToast extends ToastOptions { export interface ToastState { /** Adds a new toast to the queue. */ - add(content: T, options?: ToastOptions): string, + add: (content: T, options?: ToastOptions) => string, /** * Closes a toast. */ - close(key: string): void, + close: (key: string) => void, /** Pauses the timers for all visible toasts. */ - pauseAll(): void, + pauseAll: () => void, /** Resumes the timers for all visible toasts. */ - resumeAll(): void, + resumeAll: () => void, /** The visible toasts. */ visibleToasts: QueuedToast[] } diff --git a/packages/@react-stately/toggle/src/useToggleGroupState.ts b/packages/@react-stately/toggle/src/useToggleGroupState.ts index 7e5c3b5d529..4cae555e4af 100644 --- a/packages/@react-stately/toggle/src/useToggleGroupState.ts +++ b/packages/@react-stately/toggle/src/useToggleGroupState.ts @@ -40,13 +40,13 @@ export interface ToggleGroupState { readonly selectedKeys: Set, /** Toggles the selected state for an item by its key. */ - toggleKey(key: Key): void, + toggleKey: (key: Key) => void, /** Sets whether the given key is selected. */ - setSelected(key: Key, isSelected: boolean): void, + setSelected: (key: Key, isSelected: boolean) => void, /** Replaces the set of selected keys. */ - setSelectedKeys(keys: Set): void + setSelectedKeys: (keys: Set) => void } /** diff --git a/packages/@react-stately/toggle/src/useToggleState.ts b/packages/@react-stately/toggle/src/useToggleState.ts index 3e606ec3951..247debcd9c1 100644 --- a/packages/@react-stately/toggle/src/useToggleState.ts +++ b/packages/@react-stately/toggle/src/useToggleState.ts @@ -24,10 +24,10 @@ export interface ToggleState { readonly defaultSelected: boolean, /** Updates selection state. */ - setSelected(isSelected: boolean): void, + setSelected: (isSelected: boolean) => void, /** Toggle the selection state. */ - toggle(): void + toggle: () => void } /** diff --git a/packages/@react-stately/tooltip/src/useTooltipTriggerState.ts b/packages/@react-stately/tooltip/src/useTooltipTriggerState.ts index 32227e8ba60..388264a2f6e 100644 --- a/packages/@react-stately/tooltip/src/useTooltipTriggerState.ts +++ b/packages/@react-stately/tooltip/src/useTooltipTriggerState.ts @@ -25,9 +25,9 @@ export interface TooltipTriggerState { * depending on a global warmup timer. The `immediate` option shows the * tooltip immediately instead. */ - open(immediate?: boolean): void, + open: (immediate?: boolean) => void, /** Hides the tooltip. */ - close(immediate?: boolean): void + close: (immediate?: boolean) => void } let tooltips = {}; diff --git a/packages/@react-stately/tree/src/useTreeState.ts b/packages/@react-stately/tree/src/useTreeState.ts index c454a13a9fe..a8cead6c696 100644 --- a/packages/@react-stately/tree/src/useTreeState.ts +++ b/packages/@react-stately/tree/src/useTreeState.ts @@ -32,10 +32,10 @@ export interface TreeState { readonly expandedKeys: Set, /** Toggles the expanded state for an item by its key. */ - toggleKey(key: Key): void, + toggleKey: (key: Key) => void, /** Replaces the set of expanded keys. */ - setExpandedKeys(keys: Set): void, + setExpandedKeys: (keys: Set) => void, /** A selection manager to read and update multiple selection state. */ readonly selectionManager: SelectionManager diff --git a/packages/@react-stately/virtualizer/src/useVirtualizerState.ts b/packages/@react-stately/virtualizer/src/useVirtualizerState.ts index 9844e2acdd0..3408ab28c44 100644 --- a/packages/@react-stately/virtualizer/src/useVirtualizerState.ts +++ b/packages/@react-stately/virtualizer/src/useVirtualizerState.ts @@ -21,10 +21,10 @@ import {useLayoutEffect} from '@react-aria/utils'; import {Virtualizer} from './Virtualizer'; interface VirtualizerProps { - renderView(type: string, content: T | null): V, + renderView: (type: string, content: T | null) => V, layout: Layout, collection: Collection, - onVisibleRectChange(rect: Rect): void, + onVisibleRectChange: (rect: Rect) => void, persistedKeys?: Set | null, layoutOptions?: O }