From 2c26de88ed550787ca71a068590882619990f657 Mon Sep 17 00:00:00 2001 From: Robert Snow Date: Tue, 28 Oct 2025 16:22:06 +1100 Subject: [PATCH 1/2] fix S2 API sweep --- packages/@react-spectrum/s2/src/Calendar.tsx | 2 +- packages/@react-spectrum/s2/src/Menu.tsx | 7 +++- packages/@react-spectrum/s2/src/Popover.tsx | 34 +++++++++++++++++-- .../@react-spectrum/s2/src/RangeCalendar.tsx | 2 +- packages/@react-spectrum/s2/src/TableView.tsx | 7 ++-- packages/@react-spectrum/s2/src/Toast.tsx | 6 ++-- 6 files changed, 47 insertions(+), 11 deletions(-) diff --git a/packages/@react-spectrum/s2/src/Calendar.tsx b/packages/@react-spectrum/s2/src/Calendar.tsx index 3d2a3f83b92..73083337eeb 100644 --- a/packages/@react-spectrum/s2/src/Calendar.tsx +++ b/packages/@react-spectrum/s2/src/Calendar.tsx @@ -52,7 +52,7 @@ import {useSpectrumContextProps} from './useSpectrumContextProps'; export interface CalendarProps - extends Omit, 'visibleDuration' | 'style' | 'className' | 'styles' | keyof GlobalDOMAttributes>, + extends Omit, 'visibleDuration' | 'style' | 'className' | 'styles' | 'children' | keyof GlobalDOMAttributes>, StyleProps { /** * The error message to display when the calendar is invalid. diff --git a/packages/@react-spectrum/s2/src/Menu.tsx b/packages/@react-spectrum/s2/src/Menu.tsx index b6b11040164..65b4bd17091 100644 --- a/packages/@react-spectrum/s2/src/Menu.tsx +++ b/packages/@react-spectrum/s2/src/Menu.tsx @@ -409,7 +409,12 @@ export function Divider(props: SeparatorProps): ReactNode { ); } -export interface MenuSectionProps extends Omit, keyof GlobalDOMAttributes> {} +export interface MenuSectionProps extends Omit, 'className' | keyof GlobalDOMAttributes> { + /** + * The children of the menu section. + */ + children?: ReactNode +} export function MenuSection(props: MenuSectionProps): ReactNode { // remember, context doesn't work if it's around Section nor inside let {size} = useContext(InternalMenuContext); diff --git a/packages/@react-spectrum/s2/src/Popover.tsx b/packages/@react-spectrum/s2/src/Popover.tsx index b738786041d..530185d4efa 100644 --- a/packages/@react-spectrum/s2/src/Popover.tsx +++ b/packages/@react-spectrum/s2/src/Popover.tsx @@ -22,7 +22,7 @@ import { } from 'react-aria-components'; import {colorScheme, getAllowedOverrides, heightProperties, UnsafeStyles, widthProperties} from './style-utils' with {type: 'macro'}; import {ColorSchemeContext} from './Provider'; -import {createContext, ForwardedRef, forwardRef, useCallback, useContext, useMemo} from 'react'; +import {createContext, ForwardedRef, forwardRef, ReactNode, useCallback, useContext, useMemo} from 'react'; import {DOMRef, DOMRefValue, GlobalDOMAttributes} from '@react-types/shared'; import {lightDark, style} from '../style' with {type: 'macro'}; import {mergeRefs} from '@react-aria/utils'; @@ -31,7 +31,20 @@ import {StyleString} from '../style/types' with {type: 'macro'}; import {useDOMRef} from '@react-spectrum/utils'; import {useSpectrumContextProps} from './useSpectrumContextProps'; -export interface PopoverProps extends UnsafeStyles, Omit { +export interface PopoverProps extends UnsafeStyles, Omit { + /** + * The styles of the popover. + */ styles?: StyleString, /** * Whether a popover's arrow should be hidden. @@ -228,7 +241,22 @@ export const PopoverBase = forwardRef(function PopoverBase(props: PopoverProps, }); type PopoverStylesProp = StyleString<((typeof widthProperties)[number] | (typeof heightProperties)[number])>; -export interface PopoverDialogProps extends Pick, Omit, UnsafeStyles { +export interface PopoverDialogProps extends Pick, Omit, UnsafeStyles { + /** + * The children of the popover. + */ + children?: ReactNode, /** * The amount of padding around the contents of the dialog. * @default 'default' diff --git a/packages/@react-spectrum/s2/src/RangeCalendar.tsx b/packages/@react-spectrum/s2/src/RangeCalendar.tsx index f5dace7c7d4..7a11511df81 100644 --- a/packages/@react-spectrum/s2/src/RangeCalendar.tsx +++ b/packages/@react-spectrum/s2/src/RangeCalendar.tsx @@ -34,7 +34,7 @@ import {useSpectrumContextProps} from './useSpectrumContextProps'; export interface RangeCalendarProps - extends Omit, 'visibleDuration' | 'style' | 'className' | 'styles' | keyof GlobalDOMAttributes>, + extends Omit, 'visibleDuration' | 'style' | 'className' | 'children' | 'styles' | keyof GlobalDOMAttributes>, StyleProps { /** * The error message to display when the calendar is invalid. diff --git a/packages/@react-spectrum/s2/src/TableView.tsx b/packages/@react-spectrum/s2/src/TableView.tsx index a12694692dd..5bbaecf343b 100644 --- a/packages/@react-spectrum/s2/src/TableView.tsx +++ b/packages/@react-spectrum/s2/src/TableView.tsx @@ -519,7 +519,7 @@ const columnStyles = style({ forcedColorAdjust: 'none' }); -export interface ColumnProps extends Omit { +export interface ColumnProps extends Omit { /** Whether the column should render a divider between it and the next column. */ showDivider?: boolean, /** Whether the column allows resizing. */ @@ -1017,7 +1017,7 @@ const cellContent = style({ } }); -export interface CellProps extends RACCellProps, Pick { +export interface CellProps extends Omit, Pick { /** @private */ isSticky?: boolean, /** The content to render as the cell children. */ @@ -1410,6 +1410,9 @@ export const Row = /*#__PURE__*/ (forwardRef as forwardRefType)(function Row {selectionMode !== 'none' && selectionBehavior === 'toggle' && ( + // Not sure what we want to do with this className, in Cell it currently overrides the className that would have been applied. + // The `spread` otherProps must be after className in Cell. + // @ts-ignore diff --git a/packages/@react-spectrum/s2/src/Toast.tsx b/packages/@react-spectrum/s2/src/Toast.tsx index 4696f22dbf4..d2c96163fce 100644 --- a/packages/@react-spectrum/s2/src/Toast.tsx +++ b/packages/@react-spectrum/s2/src/Toast.tsx @@ -34,7 +34,7 @@ import {useMediaQuery} from '@react-spectrum/utils'; import {useOverlayTriggerState} from 'react-stately'; export type ToastPlacement = 'top' | 'top end' | 'bottom' | 'bottom end'; -export interface ToastContainerProps extends Omit, 'queue' | 'children'> { +export interface ToastContainerProps extends Omit, 'queue' | 'children' | 'style' | 'className'> { /** * Placement of the toast container on the page. * @default "bottom" @@ -490,7 +490,7 @@ export function SpectrumToast(props: SpectrumToastProps): ReactNode { width: '100%', translate: `0 0 ${(-12 * index) / 16}rem`, // Only 3 toasts are visible in the stack at once, but all toasts are in the DOM. - // This allows view transitions to smoothly animate them from where they would be + // This allows view transitions to smoothly animate them from where they would be // in the collapsed stack to their final position in the expanded list. opacity: index >= 3 ? 0 : 1, zIndex: visibleToasts.length - index - 1, @@ -528,7 +528,7 @@ export function SpectrumToast(props: SpectrumToastProps): ReactNode { } {toast.content.children} - {!isExpanded && visibleToasts.length > 1 && + {!isExpanded && visibleToasts.length > 1 && Date: Wed, 29 Oct 2025 06:57:31 +1100 Subject: [PATCH 2/2] Update packages/@react-spectrum/s2/src/Menu.tsx Co-authored-by: Yihui Liao <44729383+yihuiliao@users.noreply.github.com> --- packages/@react-spectrum/s2/src/Menu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@react-spectrum/s2/src/Menu.tsx b/packages/@react-spectrum/s2/src/Menu.tsx index 65b4bd17091..4871a6050a6 100644 --- a/packages/@react-spectrum/s2/src/Menu.tsx +++ b/packages/@react-spectrum/s2/src/Menu.tsx @@ -409,7 +409,7 @@ export function Divider(props: SeparatorProps): ReactNode { ); } -export interface MenuSectionProps extends Omit, 'className' | keyof GlobalDOMAttributes> { +export interface MenuSectionProps extends Omit, 'style' | 'className' | keyof GlobalDOMAttributes> { /** * The children of the menu section. */