@react-types/calendar 3.0.0-nightly.3113 → 3.0.0-nightly.3114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/index.d.ts +44 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/calendar",
3
- "version": "3.0.0-nightly.3113+404d41859",
3
+ "version": "3.0.0-nightly.3114+68403fe55",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "types": "src/index.d.ts",
@@ -9,14 +9,14 @@
9
9
  "url": "https://github.com/adobe/react-spectrum"
10
10
  },
11
11
  "dependencies": {
12
- "@internationalized/date": "3.0.0-nightly.3113+404d41859",
13
- "@react-types/shared": "3.0.0-nightly.1417+404d41859"
12
+ "@internationalized/date": "3.5.6-nightly.5042+68403fe55",
13
+ "@react-types/shared": "3.0.0-nightly.3114+68403fe55"
14
14
  },
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
18
  "peerDependencies": {
19
- "react": "^16.8.0 || ^17.0.0-rc.1"
19
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
20
20
  },
21
- "gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
21
+ "gitHead": "68403fe55489dce3de1b3094c957d598ad719861"
22
22
  }
package/src/index.d.ts CHANGED
@@ -10,8 +10,9 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
+ import {AriaLabelingProps, DOMProps, RangeValue, StyleProps, ValidationState, ValueBase} from '@react-types/shared';
13
14
  import {CalendarDate, CalendarDateTime, ZonedDateTime} from '@internationalized/date';
14
- import {DOMProps, RangeValue, StyleProps, ValueBase} from '@react-types/shared';
15
+ import {ReactNode} from 'react';
15
16
 
16
17
  export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
17
18
  type MappedDateValue<T> =
@@ -22,9 +23,11 @@ type MappedDateValue<T> =
22
23
 
23
24
  export interface CalendarPropsBase {
24
25
  /** The minimum allowed date that a user may select. */
25
- minValue?: DateValue,
26
+ minValue?: DateValue | null,
26
27
  /** The maximum allowed date that a user may select. */
27
- maxValue?: DateValue,
28
+ maxValue?: DateValue | null,
29
+ /** Callback that is called for each date of the calendar. If it returns true, then the date is unavailable. */
30
+ isDateUnavailable?: (date: DateValue) => boolean,
28
31
  /**
29
32
  * Whether the calendar is disabled.
30
33
  * @default false
@@ -39,14 +42,46 @@ export interface CalendarPropsBase {
39
42
  * Whether to automatically focus the calendar when it mounts.
40
43
  * @default false
41
44
  */
42
- autoFocus?: boolean
45
+ autoFocus?: boolean,
46
+ /** Controls the currently focused date within the calendar. */
47
+ focusedValue?: DateValue,
48
+ /** The date that is focused when the calendar first mounts (uncountrolled). */
49
+ defaultFocusedValue?: DateValue,
50
+ /** Handler that is called when the focused date changes. */
51
+ onFocusChange?: (date: CalendarDate) => void,
52
+ /**
53
+ * Whether the current selection is valid or invalid according to application logic.
54
+ * @deprecated Use `isInvalid` instead.
55
+ */
56
+ validationState?: ValidationState,
57
+ /** Whether the current selection is invalid according to application logic. */
58
+ isInvalid?: boolean,
59
+ /** An error message to display when the selected value is invalid. */
60
+ errorMessage?: ReactNode,
61
+ /**
62
+ * Controls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.
63
+ * @default visible
64
+ */
65
+ pageBehavior?: PageBehavior
66
+ }
67
+
68
+ export type DateRange = RangeValue<DateValue> | null;
69
+ export interface CalendarProps<T extends DateValue | null> extends CalendarPropsBase, ValueBase<T | null, MappedDateValue<T>> {}
70
+ export interface RangeCalendarProps<T extends DateValue | null> extends CalendarPropsBase, ValueBase<RangeValue<T> | null> {
71
+ /**
72
+ * When combined with `isDateUnavailable`, determines whether non-contiguous ranges,
73
+ * i.e. ranges containing unavailable dates, may be selected.
74
+ */
75
+ allowsNonContiguousRanges?: boolean
43
76
  }
44
77
 
45
- export type DateRange = RangeValue<DateValue>;
46
- export interface CalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<T, MappedDateValue<T>> {}
47
- export interface RangeCalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<RangeValue<T>, RangeValue<MappedDateValue<T>>> {}
78
+ export interface AriaCalendarProps<T extends DateValue> extends CalendarProps<T>, DOMProps, AriaLabelingProps {}
79
+
80
+ export interface AriaRangeCalendarProps<T extends DateValue> extends RangeCalendarProps<T>, DOMProps, AriaLabelingProps {}
81
+
82
+ export type PageBehavior = 'single' | 'visible';
48
83
 
49
- export interface SpectrumCalendarProps<T extends DateValue> extends CalendarProps<T>, DOMProps, StyleProps {
84
+ export interface SpectrumCalendarProps<T extends DateValue> extends AriaCalendarProps<T>, StyleProps {
50
85
  /**
51
86
  * The number of months to display at once. Up to 3 months are supported.
52
87
  * @default 1
@@ -54,7 +89,7 @@ export interface SpectrumCalendarProps<T extends DateValue> extends CalendarProp
54
89
  visibleMonths?: number
55
90
  }
56
91
 
57
- export interface SpectrumRangeCalendarProps<T extends DateValue> extends RangeCalendarProps<T>, DOMProps, StyleProps {
92
+ export interface SpectrumRangeCalendarProps<T extends DateValue> extends AriaRangeCalendarProps<T>, StyleProps {
58
93
  /**
59
94
  * The number of months to display at once. Up to 3 months are supported.
60
95
  * @default 1