Skip to content

Commit 88ce7f3

Browse files
authored
Merge branch 'main' into aggregate-ts-upgrade-updates
2 parents 73e0d08 + 02f242f commit 88ce7f3

File tree

15 files changed

+110
-88
lines changed

15 files changed

+110
-88
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export function getWeeksInMonth(date: DateValue, locale: string): number {
238238
}
239239

240240
/** Returns the lesser of the two provider dates. */
241-
export function minDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B {
241+
export function minDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined {
242242
if (a && b) {
243243
return a.compare(b) <= 0 ? a : b;
244244
}
@@ -247,7 +247,7 @@ export function minDate<A extends DateValue, B extends DateValue>(a: A, b: B): A
247247
}
248248

249249
/** Returns the greater of the two provider dates. */
250-
export function maxDate<A extends DateValue, B extends DateValue>(a: A, b: B): A | B {
250+
export function maxDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined {
251251
if (a && b) {
252252
return a.compare(b) >= 0 ? a : b;
253253
}

packages/@react-aria/textfield/src/useTextField.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export interface AriaTextFieldOptions<T extends TextFieldIntrinsicElements> exte
8181
*/
8282
inputElementType?: T,
8383
/**
84-
* Controls whether inputted text is automatically capitalized and, if so, in what manner.
84+
* Controls whether inputted text is automatically capitalized and, if so, in what manner.
8585
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize).
8686
*/
8787
autoCapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters'
@@ -166,7 +166,7 @@ export function useTextField<T extends TextFieldIntrinsicElements = DefaultEleme
166166
labelProps,
167167
inputProps: mergeProps(
168168
domProps,
169-
inputElementType === 'input' && inputOnlyProps,
169+
inputElementType === 'input' ? inputOnlyProps : undefined,
170170
{
171171
disabled: isDisabled,
172172
readOnly: isReadOnly,

packages/@react-aria/toast/docs/useToast.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,13 @@ interface ToastProps<T> extends AriaToastProps<T> {
140140

141141
function Toast<T extends React.ReactNode>({state, ...props}: ToastProps<T>) {
142142
let ref = React.useRef(null);
143-
let {toastProps, titleProps, closeButtonProps} = useToast(props, state, ref);
143+
let {toastProps, contentProps, titleProps, closeButtonProps} = useToast(props, state, ref);
144144

145145
return (
146146
<div {...toastProps} ref={ref} className="toast">
147-
<div {...titleProps}>{props.toast.content}</div>
147+
<div {...contentProps}>
148+
<div {...titleProps}>{props.toast.content}</div>
149+
</div>
148150
<Button {...closeButtonProps}>x</Button>
149151
</div>
150152
);

packages/@react-aria/toast/src/useToast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function useToast<T>(props: AriaToastProps<T>, state: ToastState<T>, ref:
6363

6464
let [isEntered, setIsEntered] = React.useState(false);
6565
useEffect(() => {
66-
if (animation === 'entering') {
66+
if (animation === 'entering' || animation === 'queued') {
6767
setIsEntered(true);
6868
}
6969
}, [animation]);

packages/@react-spectrum/calendar/src/Calendar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>, ref: Foc
3434
createCalendar
3535
});
3636

37-
let domRef = useRef();
37+
let domRef = useRef(null);
3838
useImperativeHandle(ref, () => ({
3939
...createDOMRef(domRef),
4040
focus() {

packages/@react-spectrum/calendar/src/CalendarBase.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {DOMProps, StyleProps} from '@react-types/shared';
2222
import {HelpText} from '@react-spectrum/label';
2323
// @ts-ignore
2424
import intlMessages from '../intl/*.json';
25-
import React, {HTMLAttributes, RefObject} from 'react';
25+
import React, {HTMLAttributes, JSX, RefObject} from 'react';
2626
import styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';
2727
import {useDateFormatter, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
2828
import {VisuallyHidden} from '@react-aria/visually-hidden';
@@ -59,8 +59,8 @@ export function CalendarBase<T extends CalendarState | RangeCalendarState>(props
5959
timeZone: state.timeZone
6060
});
6161

62-
let titles = [];
63-
let calendars = [];
62+
let titles: JSX.Element[] = [];
63+
let calendars: JSX.Element[] = [];
6464
for (let i = 0; i < visibleMonths; i++) {
6565
let d = currentMonth.add({months: i});
6666
titles.push(

packages/@react-spectrum/calendar/src/CalendarCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface CalendarCellProps extends AriaCalendarCellProps {
2727
}
2828

2929
export function CalendarCell({state, currentMonth, ...props}: CalendarCellProps) {
30-
let ref = useRef<HTMLElement>();
30+
let ref = useRef<HTMLElement>(null);
3131
let {
3232
cellProps,
3333
buttonProps,

packages/@react-spectrum/calendar/src/RangeCalendar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function RangeCalendar<T extends DateValue>(props: SpectrumRangeCalendarProps<T>
3434
createCalendar
3535
});
3636

37-
let domRef = useRef();
37+
let domRef = useRef(null);
3838
useImperativeHandle(ref, () => ({
3939
...createDOMRef(domRef),
4040
focus() {

packages/@react-spectrum/calendar/stories/Calendar.stories.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,16 @@ function Example(props) {
202202
let [calendar, setCalendar] = React.useState<Key>(calendars[0].key);
203203
let {locale: defaultLocale} = useLocale();
204204

205-
let pref = preferences.find(p => p.locale === locale);
205+
let pref = preferences.find(p => p.locale === locale)!;
206206
let preferredCalendars = React.useMemo(() => pref ? pref.ordering.split(' ').map(p => calendars.find(c => c.key === p)).filter(Boolean) : [calendars[0]], [pref]);
207-
let otherCalendars = React.useMemo(() => calendars.filter(c => !preferredCalendars.some(p => p.key === c.key)), [preferredCalendars]);
207+
let otherCalendars = React.useMemo(() => calendars.filter(c => !preferredCalendars.some(p => p!.key === c.key)), [preferredCalendars]);
208208

209209
let updateLocale = locale => {
210210
setLocale(locale);
211211
let pref = preferences.find(p => p.locale === locale);
212-
setCalendar(pref.ordering.split(' ')[0]);
212+
if (pref) {
213+
setCalendar(pref.ordering.split(' ')[0]);
214+
}
213215
};
214216

215217
return (
@@ -220,14 +222,14 @@ function Example(props) {
220222
</Picker>
221223
<Picker label="Calendar" selectedKey={calendar} onSelectionChange={setCalendar}>
222224
<Section title="Preferred" items={preferredCalendars}>
223-
{item => <Item>{item.name}</Item>}
225+
{item => <Item>{item!.name}</Item>}
224226
</Section>
225227
<Section title="Other" items={otherCalendars}>
226228
{item => <Item>{item.name}</Item>}
227229
</Section>
228230
</Picker>
229231
</Flex>
230-
<Provider locale={(locale || defaultLocale) + (calendar && calendar !== preferredCalendars[0].key ? '-u-ca-' + calendar : '')}>
232+
<Provider locale={(locale || defaultLocale) + (calendar && calendar !== preferredCalendars![0]!.key ? '-u-ca-' + calendar : '')}>
231233
<View maxWidth="100vw" padding="size-10" overflow="auto">
232234
<Calendar {...props} />
233235
</View>

packages/@react-stately/calendar/src/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ interface CalendarStateBase {
2222
/** The date range that is currently visible in the calendar. */
2323
readonly visibleRange: RangeValue<CalendarDate>,
2424
/** The minimum allowed date that a user may select. */
25-
readonly minValue?: DateValue,
25+
readonly minValue?: DateValue | null,
2626
/** The maximum allowed date that a user may select. */
27-
readonly maxValue?: DateValue,
27+
readonly maxValue?: DateValue | null,
2828
/** The time zone of the dates currently being displayed. */
2929
readonly timeZone: string,
3030
/**
3131
* The current validation state of the selected value.
3232
* @deprecated Use `isValueInvalid` instead.
3333
*/
34-
readonly validationState: ValidationState,
34+
readonly validationState: ValidationState | null,
3535
/** Whether the calendar is invalid. */
3636
readonly isValueInvalid: boolean,
3737
/** The currently focused date. */
@@ -108,17 +108,17 @@ export interface CalendarState extends CalendarStateBase {
108108

109109
export interface RangeCalendarState extends CalendarStateBase {
110110
/** The currently selected date range. */
111-
readonly value: RangeValue<DateValue>,
111+
readonly value: RangeValue<DateValue> | null,
112112
/** Sets the currently selected date range. */
113-
setValue(value: RangeValue<DateValue>): void,
113+
setValue(value: RangeValue<DateValue> | null): void,
114114
/** Highlights the given date during selection, e.g. by hovering or dragging. */
115115
highlightDate(date: CalendarDate): void,
116116
/** The current anchor date that the user clicked on to begin range selection. */
117117
readonly anchorDate: CalendarDate | null,
118118
/** Sets the anchor date that the user clicked on to begin range selection. */
119119
setAnchorDate(date: CalendarDate | null): void,
120120
/** The currently highlighted date range. */
121-
readonly highlightedRange: RangeValue<CalendarDate>,
121+
readonly highlightedRange: RangeValue<CalendarDate> | null,
122122
/** Whether the user is currently dragging over the calendar. */
123123
readonly isDragging: boolean,
124124
/** Sets whether the user is dragging over the calendar. */

0 commit comments

Comments
 (0)