Skip to content

Commit fc3ea3e

Browse files
fix: S2 API sweep (#9101)
* fix S2 API sweep * Update packages/@react-spectrum/s2/src/Menu.tsx Co-authored-by: Yihui Liao <44729383+yihuiliao@users.noreply.github.com> --------- Co-authored-by: Yihui Liao <44729383+yihuiliao@users.noreply.github.com>
1 parent 8e7a57d commit fc3ea3e

File tree

6 files changed

+47
-11
lines changed

6 files changed

+47
-11
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import {useSpectrumContextProps} from './useSpectrumContextProps';
5252

5353

5454
export interface CalendarProps<T extends DateValue>
55-
extends Omit<AriaCalendarProps<T>, 'visibleDuration' | 'style' | 'className' | 'styles' | keyof GlobalDOMAttributes>,
55+
extends Omit<AriaCalendarProps<T>, 'visibleDuration' | 'style' | 'className' | 'styles' | 'children' | keyof GlobalDOMAttributes>,
5656
StyleProps {
5757
/**
5858
* The error message to display when the calendar is invalid.

packages/@react-spectrum/s2/src/Menu.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,12 @@ export function Divider(props: SeparatorProps): ReactNode {
409409
);
410410
}
411411

412-
export interface MenuSectionProps<T extends object> extends Omit<AriaMenuSectionProps<T>, keyof GlobalDOMAttributes> {}
412+
export interface MenuSectionProps<T extends object> extends Omit<AriaMenuSectionProps<T>, 'style' | 'className' | keyof GlobalDOMAttributes> {
413+
/**
414+
* The children of the menu section.
415+
*/
416+
children?: ReactNode
417+
}
413418
export function MenuSection<T extends object>(props: MenuSectionProps<T>): ReactNode {
414419
// remember, context doesn't work if it's around Section nor inside
415420
let {size} = useContext(InternalMenuContext);

packages/@react-spectrum/s2/src/Popover.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
} from 'react-aria-components';
2323
import {colorScheme, getAllowedOverrides, heightProperties, UnsafeStyles, widthProperties} from './style-utils' with {type: 'macro'};
2424
import {ColorSchemeContext} from './Provider';
25-
import {createContext, ForwardedRef, forwardRef, useCallback, useContext, useMemo} from 'react';
25+
import {createContext, ForwardedRef, forwardRef, ReactNode, useCallback, useContext, useMemo} from 'react';
2626
import {DOMRef, DOMRefValue, GlobalDOMAttributes} from '@react-types/shared';
2727
import {lightDark, style} from '../style' with {type: 'macro'};
2828
import {mergeRefs} from '@react-aria/utils';
@@ -31,7 +31,20 @@ import {StyleString} from '../style/types' with {type: 'macro'};
3131
import {useDOMRef} from '@react-spectrum/utils';
3232
import {useSpectrumContextProps} from './useSpectrumContextProps';
3333

34-
export interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps, 'arrowSize' | 'isNonModal' | 'arrowBoundaryOffset' | 'isKeyboardDismissDisabled' | 'shouldCloseOnInteractOutside' | 'shouldUpdatePosition' | keyof GlobalDOMAttributes> {
34+
export interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps,
35+
'arrowSize' |
36+
'isNonModal' |
37+
'arrowBoundaryOffset' |
38+
'isKeyboardDismissDisabled' |
39+
'shouldCloseOnInteractOutside' |
40+
'shouldUpdatePosition' |
41+
'style' |
42+
'className' |
43+
keyof GlobalDOMAttributes
44+
> {
45+
/**
46+
* The styles of the popover.
47+
*/
3548
styles?: StyleString,
3649
/**
3750
* Whether a popover's arrow should be hidden.
@@ -228,7 +241,22 @@ export const PopoverBase = forwardRef(function PopoverBase(props: PopoverProps,
228241
});
229242

230243
type PopoverStylesProp = StyleString<((typeof widthProperties)[number] | (typeof heightProperties)[number])>;
231-
export interface PopoverDialogProps extends Pick<PopoverProps, 'children' | 'size' | 'hideArrow'| 'placement' | 'shouldFlip' | 'containerPadding' | 'offset' | 'crossOffset' | 'triggerRef' | 'isOpen' | 'onOpenChange'>, Omit<DialogProps, 'children' | 'className' | 'style' | keyof GlobalDOMAttributes>, UnsafeStyles {
244+
export interface PopoverDialogProps extends Pick<PopoverProps,
245+
'size' |
246+
'hideArrow'|
247+
'placement' |
248+
'shouldFlip' |
249+
'containerPadding' |
250+
'offset' |
251+
'crossOffset' |
252+
'triggerRef' |
253+
'isOpen' |
254+
'onOpenChange'
255+
>, Omit<DialogProps, 'children' | 'className' | 'style' | keyof GlobalDOMAttributes>, UnsafeStyles {
256+
/**
257+
* The children of the popover.
258+
*/
259+
children?: ReactNode,
232260
/**
233261
* The amount of padding around the contents of the dialog.
234262
* @default 'default'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {useSpectrumContextProps} from './useSpectrumContextProps';
3434

3535

3636
export interface RangeCalendarProps<T extends DateValue>
37-
extends Omit<AriaRangeCalendarProps<T>, 'visibleDuration' | 'style' | 'className' | 'styles' | keyof GlobalDOMAttributes>,
37+
extends Omit<AriaRangeCalendarProps<T>, 'visibleDuration' | 'style' | 'className' | 'children' | 'styles' | keyof GlobalDOMAttributes>,
3838
StyleProps {
3939
/**
4040
* The error message to display when the calendar is invalid.

packages/@react-spectrum/s2/src/TableView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ const columnStyles = style({
519519
forcedColorAdjust: 'none'
520520
});
521521

522-
export interface ColumnProps extends Omit<RACColumnProps, keyof GlobalDOMAttributes> {
522+
export interface ColumnProps extends Omit<RACColumnProps, 'style' | 'className' | keyof GlobalDOMAttributes> {
523523
/** Whether the column should render a divider between it and the next column. */
524524
showDivider?: boolean,
525525
/** Whether the column allows resizing. */
@@ -1017,7 +1017,7 @@ const cellContent = style({
10171017
}
10181018
});
10191019

1020-
export interface CellProps extends RACCellProps, Pick<ColumnProps, 'align' | 'showDivider'> {
1020+
export interface CellProps extends Omit<RACCellProps, 'style' | 'className' | keyof GlobalDOMAttributes>, Pick<ColumnProps, 'align' | 'showDivider'> {
10211021
/** @private */
10221022
isSticky?: boolean,
10231023
/** The content to render as the cell children. */
@@ -1410,6 +1410,9 @@ export const Row = /*#__PURE__*/ (forwardRef as forwardRefType)(function Row<T e
14101410
}) + (renderProps.isFocusVisible && ' ' + raw('&:before { content: ""; display: inline-block; position: sticky; inset-inline-start: 0; width: 3px; height: 100%; margin-inline-end: -3px; margin-block-end: 1px; z-index: 3; background-color: var(--rowFocusIndicatorColor)'))}
14111411
{...otherProps}>
14121412
{selectionMode !== 'none' && selectionBehavior === 'toggle' && (
1413+
// Not sure what we want to do with this className, in Cell it currently overrides the className that would have been applied.
1414+
// The `spread` otherProps must be after className in Cell.
1415+
// @ts-ignore
14131416
<Cell isSticky className={checkboxCellStyle}>
14141417
<Checkbox isEmphasized slot="selection" />
14151418
</Cell>

packages/@react-spectrum/s2/src/Toast.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {useMediaQuery} from '@react-spectrum/utils';
3434
import {useOverlayTriggerState} from 'react-stately';
3535

3636
export type ToastPlacement = 'top' | 'top end' | 'bottom' | 'bottom end';
37-
export interface ToastContainerProps extends Omit<ToastRegionProps<SpectrumToastValue>, 'queue' | 'children'> {
37+
export interface ToastContainerProps extends Omit<ToastRegionProps<SpectrumToastValue>, 'queue' | 'children' | 'style' | 'className'> {
3838
/**
3939
* Placement of the toast container on the page.
4040
* @default "bottom"
@@ -490,7 +490,7 @@ export function SpectrumToast(props: SpectrumToastProps): ReactNode {
490490
width: '100%',
491491
translate: `0 0 ${(-12 * index) / 16}rem`,
492492
// Only 3 toasts are visible in the stack at once, but all toasts are in the DOM.
493-
// This allows view transitions to smoothly animate them from where they would be
493+
// This allows view transitions to smoothly animate them from where they would be
494494
// in the collapsed stack to their final position in the expanded list.
495495
opacity: index >= 3 ? 0 : 1,
496496
zIndex: visibleToasts.length - index - 1,
@@ -528,7 +528,7 @@ export function SpectrumToast(props: SpectrumToastProps): ReactNode {
528528
}
529529
<Text slot="title">{toast.content.children}</Text>
530530
</ToastContent>
531-
{!isExpanded && visibleToasts.length > 1 &&
531+
{!isExpanded && visibleToasts.length > 1 &&
532532
<ActionButton
533533
isQuiet
534534
staticColor="white"

0 commit comments

Comments
 (0)