Skip to content

Commit 55b6606

Browse files
committed
Merge branch 'main' into new-docs-release-notes
# Conflicts: # packages/dev/s2-docs/src/Code.tsx # packages/dev/s2-docs/src/CodeBlock.tsx
2 parents a5eb96d + 7ff6696 commit 55b6606

File tree

29 files changed

+288
-125
lines changed

29 files changed

+288
-125
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"

packages/dev/docs/pages/react-aria/home/ExampleApp.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
import {AlertDialog} from 'tailwind-starter/AlertDialog';
1414
import {Arrow} from './components';
1515
import {Button} from 'tailwind-starter/Button';
16-
import {Cell, Column, Row, Table, TableHeader} from 'tailwind-starter/Table';
16+
import {Cell, Column, Row, Table, TableBody, TableHeader} from 'tailwind-starter/Table';
1717
import {Checkbox} from 'tailwind-starter/Checkbox';
1818
import {CloudSun, Dessert, Droplet, Droplets, FilterIcon, Mail, MoreHorizontal, PencilIcon, PlusIcon, RefreshCw, ShareIcon, SlidersIcon, StarIcon, Sun, SunDim, TrashIcon, Twitter} from 'lucide-react';
19-
import {ColumnProps, Dialog, DialogTrigger, DropZone, Form, Heading, isFileDropItem, Key, ModalOverlay, ModalOverlayProps, Modal as RACModal, Selection, SortDescriptor, TableBody, Text, ToggleButton, ToggleButtonProps, TooltipTrigger} from 'react-aria-components';
19+
import {ColumnProps, Dialog, DialogTrigger, DropZone, Form, Heading, isFileDropItem, Key, ModalOverlay, ModalOverlayProps, Modal as RACModal, Selection, SortDescriptor, Text, ToggleButton, ToggleButtonProps, TooltipTrigger} from 'react-aria-components';
2020
import {ComboBox, ComboBoxItem} from 'tailwind-starter/ComboBox';
2121
import {DatePicker} from 'tailwind-starter/DatePicker';
2222
import {focusRing} from 'tailwind-starter/utils';
@@ -177,7 +177,7 @@ export function ExampleApp(): React.ReactNode {
177177
<SearchField aria-label="Search" value={search} onChange={setSearch} className="col-span-3 sm:col-span-1" />
178178
<DialogTrigger>
179179
<TooltipTrigger>
180-
<Button aria-label="Filters" variant="secondary" className="w-9 h-9 shrink-0 p-0 relative">
180+
<Button aria-label="Filters" variant="secondary" className="w-9 h-9 shrink-0 p-0 px-2 relative">
181181
<FilterIcon aria-hidden className="block w-5 h-5" />
182182
{filters > 0 && <div className="absolute -top-2 -right-2 rounded-full h-4 aspect-square text-white text-xs bg-blue-600">{filters}</div>}
183183
</Button>
@@ -239,7 +239,7 @@ export function ExampleApp(): React.ReactNode {
239239
<span className="truncate capitalize">{item.common_name}</span>
240240
<span className="truncate text-xs text-gray-600 dark:text-zinc-400 col-start-2 row-start-2">{item.scientific_name}</span>
241241
<MenuTrigger placement="bottom end" >
242-
<Button aria-label="Actions" variant="secondary" className="row-span-2 place-self-center"><MoreHorizontal className="w-5 h-5" /></Button>
242+
<Button aria-label="Actions" variant="secondary" className="row-span-2 place-self-center bg-transparent dark:bg-transparent border-transparent dark:border-transparent !p-1"><MoreHorizontal className="w-5 h-5" /></Button>
243243
<Menu onAction={action => onAction(item, action)}>
244244
<MenuItem id="favorite"><StarIcon aria-hidden className="w-4 h-4" /> {item.isFavorite ? 'Unfavorite' : 'Favorite'}</MenuItem>
245245
<MenuItem id="edit"><PencilIcon aria-hidden className="w-4 h-4" /> Edit…</MenuItem>
@@ -266,7 +266,7 @@ export function ExampleApp(): React.ReactNode {
266266
<TableHeader columns={columns}>
267267
{column => <Column {...column} />}
268268
</TableHeader>
269-
<TableBody items={items} dependencies={[columns]}>
269+
<TableBody items={items} dependencies={[columns]} renderEmptyState={() => 'No results. Try changing the filters.'}>
270270
{item => (
271271
<Row columns={columns}>
272272
{column => {

packages/dev/s2-docs/pages/react-aria/examples/ios-list.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const description = 'A GridList with Framer Motion swipe gestures and lay
1111

1212
# iOS List View
1313

14-
<PageDescription>A re-creation of the iOS List View built with React Aria Components, [Framer Motion](https://www.framer.com/motion/), and [Tailwind CSS](https://tailwindcss.com/) with support for swipe gestures, layout animations, and multiple selection mode.</PageDescription>
14+
<PageDescription>A re-creation of the iOS List View built with React Aria Components, [Motion](https://motion.dev/), and [Tailwind CSS](https://tailwindcss.com/) with support for swipe gestures, layout animations, and multiple selection mode.</PageDescription>
1515

1616
```tsx render type="tailwind" expanded
1717
"use client";
@@ -191,7 +191,7 @@ function ListItem({ id, children, textValue, onRemove }) {
191191
<MotionItem
192192
id={id}
193193
textValue={textValue}
194-
className="outline-hidden group relative overflow-clip border-t border-0 border-solid last:border-b border-gray-200 dark:border-gray-800 pressed:bg-gray-200 dark:pressed:bg-gray-800 selected:bg-gray-200 dark:selected:bg-gray-800 focus-visible:outline focus-visible:outline-blue-600 focus-visible:-outline-offset-2"
194+
className="outline-hidden group relative overflow-clip border-t border-0 border-solid last:border-b border-gray-200 dark:border-gray-800 pressed:bg-gray-200 dark:pressed:bg-gray-800 selected:bg-gray-200 dark:selected:bg-gray-800 focus-visible:outline-solid focus-visible:outline-blue-600 focus-visible:-outline-offset-2"
195195
layout
196196
transition={{ duration: 0.25 }}
197197
exit={{ opacity: 0 }}

packages/dev/s2-docs/pages/react-aria/examples/photos/Sidebar.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
outline-offset: 2px;
7979
}
8080

81-
[slot=chevron] {
81+
.chevron {
8282
all: unset;
8383
margin-right: 4px;
8484
transition: rotate 200ms;
@@ -87,11 +87,11 @@
8787
}
8888
}
8989

90-
&[data-expanded] [slot=chevron] {
90+
&[data-expanded] .chevron {
9191
rotate: 90deg;
9292
}
9393

94-
&:not(:has([slot=chevron]))::before {
94+
&:not(:has(.chevron))::before {
9595
content: '';
9696
width: 20px;
9797
}

packages/dev/s2-docs/pages/react-aria/examples/photos/Sidebar.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ export function Sidebar({selectedAlbum, onSelectionChange, isVisible, onDrop}: S
3030
let renderAlbum = (album: Album) => (
3131
<TreeItem textValue={album.name} className="sidebar-TreeItem">
3232
<TreeItemContent>
33-
{album.children && <Button slot="chevron"><ChevronRight size={16} /></Button>}
33+
{album.children &&
34+
<Button slot="chevron" className="chevron">
35+
<ChevronRight size={16} />
36+
</Button>
37+
}
3438
<span>{album.name}</span>
3539
</TreeItemContent>
3640
{album.children && <Collection items={album.children}>{renderAlbum}</Collection>}

0 commit comments

Comments
 (0)