Skip to content

Commit

Permalink
Merge branch 'dialog-fixes' of github.com:adobe/react-spectrum into d…
Browse files Browse the repository at this point in the history
…ialog-fixes
  • Loading branch information
devongovett committed Nov 19, 2024
2 parents a209c68 + b295e93 commit a94792b
Show file tree
Hide file tree
Showing 19 changed files with 107 additions and 138 deletions.
12 changes: 6 additions & 6 deletions examples/rsp-cra-18/src/sections/NavigationExamples.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Accordion, Disclosure, DisclosureHeader, DisclosurePanel, Flex, Divider, Breadcrumbs, Item, Link, Tabs, TabList, TabPanels} from '@adobe/react-spectrum';
import {Accordion, Disclosure, DisclosureTitle, DisclosurePanel, Flex, Divider, Breadcrumbs, Item, Link, Tabs, TabList, TabPanels} from '@adobe/react-spectrum';

export default function NavigationExamples() {
return (
Expand Down Expand Up @@ -35,25 +35,25 @@ export default function NavigationExamples() {
<h3>Accordion</h3>
<Accordion maxWidth="size-3600">
<Disclosure id="files">
<DisclosureHeader>
<DisclosureTitle>
Files
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
<p>Files content</p>
</DisclosurePanel>
</Disclosure>
<Disclosure id="people">
<DisclosureHeader>
<DisclosureTitle>
People
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
<p>People content</p>
</DisclosurePanel>
</Disclosure>
</Accordion>
<h3>Disclosure</h3>
<Disclosure>
<DisclosureHeader>System Requirements</DisclosureHeader>
<DisclosureTitle>System Requirements</DisclosureTitle>
<DisclosurePanel>
<p>Details about system requirements here.</p>
</DisclosurePanel>
Expand Down
12 changes: 6 additions & 6 deletions examples/rsp-next-ts-17/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import {
ColorSwatch,
Accordion,
Disclosure,
DisclosureHeader,
DisclosureTitle,
DisclosurePanel
} from "@adobe/react-spectrum";
import Edit from "@spectrum-icons/workflow/Edit";
Expand Down Expand Up @@ -316,17 +316,17 @@ export default function Home() {
<h3>Accordion</h3>
<Accordion>
<Disclosure id="files">
<DisclosureHeader>
<DisclosureTitle>
Files
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
<p>Files content</p>
</DisclosurePanel>
</Disclosure>
<Disclosure id="people">
<DisclosureHeader>
<DisclosureTitle>
People
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
<p>People content</p>
</DisclosurePanel>
Expand All @@ -335,7 +335,7 @@ export default function Home() {

<h3>Disclosure</h3>
<Disclosure>
<DisclosureHeader>System Requirements</DisclosureHeader>
<DisclosureTitle>System Requirements</DisclosureTitle>
<DisclosurePanel>
<p>Details about system requirements here.</p>
</DisclosurePanel>
Expand Down
12 changes: 6 additions & 6 deletions examples/rsp-next-ts/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import {
ColorSwatch,
Accordion,
Disclosure,
DisclosureHeader,
DisclosureTitle,
DisclosurePanel
} from "@adobe/react-spectrum";
import Edit from "@spectrum-icons/workflow/Edit";
Expand Down Expand Up @@ -324,17 +324,17 @@ export default function Home() {
<h3>Accordion</h3>
<Accordion>
<Disclosure id="files">
<DisclosureHeader>
<DisclosureTitle>
Files
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
<p>Files content</p>
</DisclosurePanel>
</Disclosure>
<Disclosure id="people">
<DisclosureHeader>
<DisclosureTitle>
People
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
<p>People content</p>
</DisclosurePanel>
Expand All @@ -343,7 +343,7 @@ export default function Home() {

<h3>Disclosure</h3>
<Disclosure>
<DisclosureHeader>System Requirements</DisclosureHeader>
<DisclosureTitle>System Requirements</DisclosureTitle>
<DisclosurePanel>
<p>Details about system requirements here.</p>
</DisclosurePanel>
Expand Down
4 changes: 2 additions & 2 deletions packages/@adobe/react-spectrum/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'client-only';
export {ActionGroup} from '@react-spectrum/actiongroup';
export {Badge} from '@react-spectrum/badge';
export {Breadcrumbs} from '@react-spectrum/breadcrumbs';
export {Accordion, Disclosure, DisclosurePanel, DisclosureHeader} from '@react-spectrum/accordion';
export {Accordion, Disclosure, DisclosurePanel, DisclosureTitle} from '@react-spectrum/accordion';
export {ActionBar, ActionBarContainer} from '@react-spectrum/actionbar';
export {ActionButton, Button, LogicButton, ToggleButton} from '@react-spectrum/button';
export {Avatar} from '@react-spectrum/avatar';
Expand Down Expand Up @@ -123,4 +123,4 @@ export type {DateFormatter, DateFormatterOptions, Filter, FormatMessage, Locale,
export type {SSRProviderProps} from '@react-aria/ssr';
export type {DirectoryDropItem, DragAndDropHooks, DragAndDropOptions, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem} from '@react-spectrum/dnd';
export type {Key, Selection, ItemProps, SectionProps, RouterConfig} from '@react-types/shared';
export type {SpectrumAccordionProps, SpectrumDisclosureProps, SpectrumDisclosurePanelProps, SpectrumDisclosureHeaderProps} from '@react-spectrum/accordion';
export type {SpectrumAccordionProps, SpectrumDisclosureProps, SpectrumDisclosurePanelProps, SpectrumDisclosureTitleProps} from '@react-spectrum/accordion';
12 changes: 4 additions & 8 deletions packages/@internationalized/date/src/DateFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@

let formatterCache = new Map<string, Intl.DateTimeFormat>();

interface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {
hourCycle?: Intl.DateTimeFormatOptions['hourCycle']
}

interface DateRangeFormatPart extends Intl.DateTimeFormatPart {
source: 'startRange' | 'endRange' | 'shared'
}
Expand Down Expand Up @@ -79,8 +75,8 @@ export class DateFormatter implements Intl.DateTimeFormat {
}

/** Returns the resolved formatting options based on the values passed to the constructor. */
resolvedOptions(): ResolvedDateTimeFormatOptions {
let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions;
resolvedOptions(): Intl.ResolvedDateTimeFormatOptions {
let resolvedOptions = this.formatter.resolvedOptions();
if (hasBuggyResolvedHourCycle()) {
if (!this.resolvedHourCycle) {
this.resolvedHourCycle = getResolvedHourCycle(resolvedOptions.locale, this.options);
Expand Down Expand Up @@ -156,10 +152,10 @@ function hasBuggyHour12Behavior() {
let _hasBuggyResolvedHourCycle: boolean | null = null;
function hasBuggyResolvedHourCycle() {
if (_hasBuggyResolvedHourCycle == null) {
_hasBuggyResolvedHourCycle = (new Intl.DateTimeFormat('fr', {
_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
hour: 'numeric',
hour12: false
}).resolvedOptions() as ResolvedDateTimeFormatOptions).hourCycle === 'h12';
}).resolvedOptions().hourCycle === 'h12';
}

return _hasBuggyResolvedHourCycle;
Expand Down
26 changes: 13 additions & 13 deletions packages/@react-spectrum/accordion/chromatic/Accordion.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* governing permissions and limitations under the License.
*/

import {Accordion, Disclosure, DisclosureHeader, DisclosurePanel} from '../';
import {Accordion, Disclosure, DisclosurePanel, DisclosureTitle} from '../';
import {Meta} from '@storybook/react';
import React from 'react';

Expand All @@ -25,25 +25,25 @@ export default meta;
export const Template = (args) => (
<Accordion {...args}>
<Disclosure id="files">
<DisclosureHeader>
<DisclosureTitle>
Your files
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
files
</DisclosurePanel>
</Disclosure>
<Disclosure id="shared">
<DisclosureHeader>
<DisclosureTitle>
Shared with you
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
shared
</DisclosurePanel>
</Disclosure>
<Disclosure id="last">
<DisclosureHeader>
<DisclosureTitle>
Last item
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
last
</DisclosurePanel>
Expand All @@ -64,25 +64,25 @@ export const WithDisabledDisclosure = {
render: (args) => (
<Accordion {...args}>
<Disclosure id="files">
<DisclosureHeader>
<DisclosureTitle>
Your files
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
files
</DisclosurePanel>
</Disclosure>
<Disclosure id="shared">
<DisclosureHeader>
<DisclosureTitle>
Shared with you
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
shared
</DisclosurePanel>
</Disclosure>
<Disclosure id="last" isDisabled>
<DisclosureHeader>
<DisclosureTitle>
Last item
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
last
</DisclosurePanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* governing permissions and limitations under the License.
*/

import {Disclosure, DisclosureHeader, DisclosurePanel} from '../';
import {Disclosure, DisclosurePanel, DisclosureTitle} from '../';
import {Meta} from '@storybook/react';
import React from 'react';

Expand All @@ -24,9 +24,9 @@ export default meta;

export const Template = (args) => (
<Disclosure {...args}>
<DisclosureHeader>
<DisclosureTitle>
Your files
</DisclosureHeader>
</DisclosureTitle>
<DisclosurePanel>
files
</DisclosurePanel>
Expand Down
28 changes: 14 additions & 14 deletions packages/@react-spectrum/accordion/docs/Accordion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ keywords: [disclosure, accordion, collapse, expand]
---

```jsx import
import {Accordion, Disclosure, DisclosureHeader, DisclosurePanel} from '@react-spectrum/accordion';
import {Accordion, Disclosure, DisclosureTitle, DisclosurePanel} from '@react-spectrum/accordion';
```

# Accordion
Expand All @@ -29,20 +29,20 @@ import {Accordion, Disclosure, DisclosureHeader, DisclosurePanel} from '@react-s

<HeaderInfo
packageData={packageData}
componentNames={['Accordion', 'Disclosure', 'DisclosureHeader', 'DisclosurePanel']} />
componentNames={['Accordion', 'Disclosure', 'DisclosureTitle', 'DisclosurePanel']} />

## Example

```tsx example
<Accordion defaultExpandedKeys={['personal']}>
<Disclosure id="personal">
<DisclosureHeader>Personal Information</DisclosureHeader>
<DisclosureTitle>Personal Information</DisclosureTitle>
<DisclosurePanel>
Personal information form here.
</DisclosurePanel>
</Disclosure>
<Disclosure id="billing">
<DisclosureHeader>Billing Address</DisclosureHeader>
<DisclosureTitle>Billing Address</DisclosureTitle>
<DisclosurePanel>
Billing address form here.
</DisclosurePanel>
Expand Down Expand Up @@ -72,13 +72,13 @@ function ControlledExpansion() {
<>
<Accordion expandedKeys={expandedKeys} onExpandedChange={setExpandedKeys}>
<Disclosure id="personal">
<DisclosureHeader>Personal Information</DisclosureHeader>
<DisclosureTitle>Personal Information</DisclosureTitle>
<DisclosurePanel>
Personal information form here.
</DisclosurePanel>
</Disclosure>
<Disclosure id="billing">
<DisclosureHeader>Billing Address</DisclosureHeader>
<DisclosureTitle>Billing Address</DisclosureTitle>
<DisclosurePanel>
Billing address form here.
</DisclosurePanel>
Expand All @@ -97,13 +97,13 @@ By default, only one disclosure will be expanded at a time. To expand multiple d
```tsx example
<Accordion allowsMultipleExpanded defaultExpandedKeys={['personal', 'billing']}>
<Disclosure id="personal">
<DisclosureHeader>Personal Information</DisclosureHeader>
<DisclosureTitle>Personal Information</DisclosureTitle>
<DisclosurePanel>
Personal information form here.
</DisclosurePanel>
</Disclosure>
<Disclosure id="billing">
<DisclosureHeader>Billing Address</DisclosureHeader>
<DisclosureTitle>Billing Address</DisclosureTitle>
<DisclosurePanel>
Billing address form here.
</DisclosurePanel>
Expand All @@ -120,9 +120,9 @@ By default, only one disclosure will be expanded at a time. To expand multiple d

<PropTable component={docs.exports.Disclosure} links={docs.links} />

### Disclosure Header
### Disclosure Title

<PropTable component={docs.exports.DisclosureHeader} links={docs.links} />
<PropTable component={docs.exports.DisclosureTitle} links={docs.links} />

### Disclosure Panel

Expand All @@ -135,13 +135,13 @@ By default, only one disclosure will be expanded at a time. To expand multiple d
```tsx example
<Accordion isDisabled>
<Disclosure id="personal">
<DisclosureHeader>Personal Information</DisclosureHeader>
<DisclosureTitle>Personal Information</DisclosureTitle>
<DisclosurePanel>
Personal information form here.
</DisclosurePanel>
</Disclosure>
<Disclosure id="billing">
<DisclosureHeader>Billing Address</DisclosureHeader>
<DisclosureTitle>Billing Address</DisclosureTitle>
<DisclosurePanel>
Billing address form here.
</DisclosurePanel>
Expand All @@ -154,13 +154,13 @@ By default, only one disclosure will be expanded at a time. To expand multiple d
```tsx example
<Accordion isQuiet>
<Disclosure id="personal">
<DisclosureHeader>Personal Information</DisclosureHeader>
<DisclosureTitle>Personal Information</DisclosureTitle>
<DisclosurePanel>
Personal information form here.
</DisclosurePanel>
</Disclosure>
<Disclosure id="billing">
<DisclosureHeader>Billing Address</DisclosureHeader>
<DisclosureTitle>Billing Address</DisclosureTitle>
<DisclosurePanel>
Billing address form here.
</DisclosurePanel>
Expand Down
Loading

0 comments on commit a94792b

Please sign in to comment.