Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/@react-spectrum/s2/src/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {useSpectrumContextProps} from './useSpectrumContextProps';

export interface DateRangePickerProps<T extends DateValue> extends
Omit<AriaDateRangePickerProps<T>, 'children' | 'className' | 'style' | 'render' | keyof GlobalDOMAttributes>,
Pick<RangeCalendarProps<T>, 'createCalendar' | 'pageBehavior' | 'firstDayOfWeek' | 'isDateUnavailable'>,
Pick<RangeCalendarProps<T>, 'createCalendar' | 'pageBehavior' | 'firstDayOfWeek' | 'isDateUnavailable' | 'interactOutsideBehavior'>,
Pick<PopoverProps, 'shouldFlip'>,
StyleProps,
SpectrumLabelableProps,
Expand Down Expand Up @@ -84,6 +84,7 @@ export const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(func
placeholderValue,
maxVisibleMonths = 1,
createCalendar,
interactOutsideBehavior,
...dateFieldProps
} = props;
let formContext = useContext(FormContext);
Expand Down Expand Up @@ -154,6 +155,7 @@ export const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(func
<RangeCalendar
visibleMonths={maxVisibleMonths}
createCalendar={createCalendar}
interactOutsideBehavior={interactOutsideBehavior}
errorMessage={errorMessage} />
{showTimeField && (
<div className={style({display: 'flex', gap: 16, contain: 'inline-size', marginTop: 24})}>
Expand Down
4 changes: 3 additions & 1 deletion packages/dev/s2-docs/pages/react-aria/Modal.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ const CustomTrigger = React.forwardRef((props, ref) => (
showDescription
cssVariables={{
'--visual-viewport-height': 'The height of the [Visual Viewport](https://developer.mozilla.org/en-US/docs/Web/API/Visual_Viewport_API), i.e. space above the software keyboard.',
'--page-height': 'The height of the `<body>` element. Useful for sizing the modal backdrop.'
'--visual-viewport-width': 'The width of the [Visual Viewport](https://developer.mozilla.org/en-US/docs/Web/API/Visual_Viewport_API).',
'--page-height': 'The height of the `<body>` element. Useful for sizing and positioning the modal backdrop.',
'--page-width': 'The width of the `<body>` element. Useful for sizing and positioning the modal backdrop.'
}} />

### Dialog
Expand Down
21 changes: 21 additions & 0 deletions packages/dev/s2-docs/pages/react-aria/RangeCalendar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,27 @@ import {ChevronLeft, ChevronRight} from 'lucide-react';
</RangeCalendar>
```

## Interact outside behavior
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be ok just having this in the prop table, not sure what other people think.


Use the `interactOutsideBehavior` prop to control what happens when a range selection is in progress and the user interacts outside the calendar.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use the `interactOutsideBehavior` prop to control what happens when a range selection is in progress and the user interacts outside the calendar.
Use the `interactOutsideBehavior` prop to control what happens when a range selection is in progress and the user interacts outside the available dates.


```tsx render docs={docs.exports.RangeCalendar} links={docs.links} props={['interactOutsideBehavior']} initialProps={{interactOutsideBehavior: 'select'}}
"use client";
import {RangeCalendar} from 'vanilla-starter/RangeCalendar';
import {parseDate} from '@internationalized/date';

<RangeCalendar
aria-label="Trip dates"
defaultValue={{
start: parseDate('2025-02-03'),
end: parseDate('2025-02-12')
}}
///- begin highlight -///
/* PROPS */
///- end highlight -///
/>
```

## API

<Anatomy
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/s2-docs/pages/react-aria/Select.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const description = 'Displays a collapsible list of options and allows a
<PageDescription>{docs.exports.Select.description}</PageDescription>

<ExampleSwitcher>
```tsx render docs={vanillaDocs.exports.Select} links={docs.links} props={['label', 'placeholder', 'selectionMode', 'isDisabled']} initialProps={{label: 'Favorite Animal'}} type="vanilla" files={["starters/docs/src/Select.tsx", "starters/docs/src/Select.css"]}
```tsx render docs={vanillaDocs.exports.Select} links={docs.links} props={['label', 'placeholder', 'selectionMode', 'isDisabled', 'shouldCloseOnSelect']} initialProps={{label: 'Favorite Animal', shouldCloseOnSelect: true}} type="vanilla" files={["starters/docs/src/Select.tsx", "starters/docs/src/Select.css"]}
"use client";
import {Select, SelectItem} from 'vanilla-starter/Select';

Expand Down
23 changes: 22 additions & 1 deletion packages/dev/s2-docs/pages/s2/RangeCalendar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function Example() {
end: parseDate('2025-02-12')
});
let formatter = useDateFormatter({ dateStyle: 'long' });

return (
<>
<RangeCalendar
Expand Down Expand Up @@ -243,6 +243,27 @@ function Example() {
}
```

## Interact outside behavior

Use the `interactOutsideBehavior` prop to control what happens when a range selection is in progress and the user interacts outside the calendar.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


```tsx render docs={docs.exports.RangeCalendar} links={docs.links} props={['interactOutsideBehavior']} initialProps={{interactOutsideBehavior: 'select'}} type="s2"
"use client";
import {RangeCalendar} from '@react-spectrum/s2';
import {parseDate} from '@internationalized/date';

<RangeCalendar
aria-label="Trip dates"
defaultValue={{
start: parseDate('2025-02-03'),
end: parseDate('2025-02-12')
}}
///- begin highlight -///
/* PROPS */
///- end highlight -///
/>
```

## API

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