Skip to content

Commit 1c4825a

Browse files
committed
Merge branch 'main' of github.com:adobe/react-spectrum into concepts
# Conflicts: # packages/dev/s2-docs/pages/react-aria/styling.mdx
2 parents dfb9f99 + 604ddfe commit 1c4825a

File tree

133 files changed

+9120
-675
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+9120
-675
lines changed

packages/@react-aria/i18n/src/useDefaultLocale.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ export function useDefaultLocale(): Locale {
8080
// We cannot determine the browser's language on the server, so default to
8181
// en-US. This will be updated after hydration on the client to the correct value.
8282
if (isSSR) {
83+
let locale = typeof window !== 'undefined' && window[localeSymbol];
8384
return {
84-
locale: 'en-US',
85+
locale: locale || 'en-US',
8586
direction: 'ltr'
8687
};
8788
}

packages/@react-spectrum/s2/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
},
142142
"devDependencies": {
143143
"@adobe/spectrum-tokens": "^13.15.1",
144-
"@parcel/macros": "^2.16.0",
145144
"@react-aria/test-utils": "^1.0.0-alpha.8",
146145
"@storybook/jest": "^0.2.3",
147146
"@testing-library/dom": "^10.1.0",
@@ -152,6 +151,7 @@
152151
"dependencies": {
153152
"@internationalized/date": "^3.10.0",
154153
"@internationalized/number": "^3.6.5",
154+
"@parcel/macros": "^2.16.0",
155155
"@react-aria/calendar": "^3.9.2",
156156
"@react-aria/collections": "^3.0.0",
157157
"@react-aria/focus": "^3.21.2",

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/Divider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface DividerSpectrumProps {
2929
*/
3030
size?: 'S' | 'M' | 'L',
3131
/**
32-
* How thick the Divider should be.
32+
* The orientation of the Divider.
3333
* @default 'horizontal'
3434
*/
3535
orientation?: 'horizontal' | 'vertical',

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 => {

0 commit comments

Comments
 (0)