@react-types/calendar 3.8.3 → 3.9.0

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 +8 -5
  2. package/src/index.d.ts +3 -109
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/calendar",
3
- "version": "3.8.3",
3
+ "version": "3.9.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "types": "src/index.d.ts",
@@ -9,14 +9,17 @@
9
9
  "url": "https://github.com/adobe/react-spectrum"
10
10
  },
11
11
  "dependencies": {
12
- "@internationalized/date": "^3.12.0",
13
- "@react-types/shared": "^3.33.1"
12
+ "@react-aria/calendar": "^3.10.0",
13
+ "@react-spectrum/calendar": "^3.8.0",
14
+ "@react-stately/calendar": "^3.10.0"
14
15
  },
15
16
  "publishConfig": {
16
17
  "access": "public"
17
18
  },
18
19
  "peerDependencies": {
19
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
20
+ "@react-spectrum/provider": "^3.0.0",
21
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
22
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
20
23
  },
21
- "gitHead": "8df187370053aa35f553cb388ad670f65e1ab371"
24
+ "gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
22
25
  }
package/src/index.d.ts CHANGED
@@ -10,112 +10,6 @@
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';
14
- import type {CalendarDate, CalendarDateTime, CalendarIdentifier, Calendar as ICalendar, ZonedDateTime} from '@internationalized/date';
15
- import {ReactNode} from 'react';
16
-
17
- export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
18
- type MappedDateValue<T> =
19
- T extends ZonedDateTime ? ZonedDateTime :
20
- T extends CalendarDateTime ? CalendarDateTime :
21
- T extends CalendarDate ? CalendarDate :
22
- never;
23
-
24
- export interface CalendarPropsBase {
25
- /** The minimum allowed date that a user may select. */
26
- minValue?: DateValue | null,
27
- /** The maximum allowed date that a user may select. */
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,
31
- /**
32
- * Whether the calendar is disabled.
33
- * @default false
34
- */
35
- isDisabled?: boolean,
36
- /**
37
- * Whether the calendar value is immutable.
38
- * @default false
39
- */
40
- isReadOnly?: boolean,
41
- /**
42
- * Whether to automatically focus the calendar when it mounts.
43
- * @default false
44
- */
45
- autoFocus?: boolean,
46
- /** Controls the currently focused date within the calendar. */
47
- focusedValue?: DateValue | null,
48
- /** The date that is focused when the calendar first mounts (uncontrolled). */
49
- defaultFocusedValue?: DateValue | null,
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
- * The day that starts the week.
68
- */
69
- firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat',
70
- /**
71
- * Determines the alignment of the visible months on initial render based on the current selection or current date if there is no selection.
72
- * @default 'center'
73
- */
74
- selectionAlignment?: 'start' | 'center' | 'end'
75
- }
76
-
77
- export type DateRange = RangeValue<DateValue> | null;
78
- export interface CalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<T | null, MappedDateValue<T>> {}
79
- export interface RangeCalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<RangeValue<T> | null, RangeValue<MappedDateValue<T>>> {
80
- /**
81
- * When combined with `isDateUnavailable`, determines whether non-contiguous ranges,
82
- * i.e. ranges containing unavailable dates, may be selected.
83
- */
84
- allowsNonContiguousRanges?: boolean
85
- }
86
-
87
- export interface AriaCalendarProps<T extends DateValue> extends CalendarProps<T>, DOMProps, AriaLabelingProps {}
88
-
89
- export interface AriaRangeCalendarProps<T extends DateValue> extends RangeCalendarProps<T>, DOMProps, AriaLabelingProps {}
90
-
91
- export type PageBehavior = 'single' | 'visible';
92
-
93
- export interface SpectrumCalendarProps<T extends DateValue> extends AriaCalendarProps<T>, StyleProps {
94
- /**
95
- * The number of months to display at once. Up to 3 months are supported.
96
- * @default 1
97
- */
98
- visibleMonths?: number,
99
-
100
- /**
101
- * A function to create a new [Calendar](https://react-spectrum.adobe.com/internationalized/date/Calendar.html)
102
- * object for a given calendar identifier. If not provided, the `createCalendar` function
103
- * from `@internationalized/date` will be used.
104
- */
105
- createCalendar?: (identifier: CalendarIdentifier) => ICalendar
106
- }
107
-
108
- export interface SpectrumRangeCalendarProps<T extends DateValue> extends AriaRangeCalendarProps<T>, StyleProps {
109
- /**
110
- * The number of months to display at once. Up to 3 months are supported.
111
- * @default 1
112
- */
113
- visibleMonths?: number,
114
-
115
- /**
116
- * A function to create a new [Calendar](https://react-spectrum.adobe.com/internationalized/date/Calendar.html)
117
- * object for a given calendar identifier. If not provided, the `createCalendar` function
118
- * from `@internationalized/date` will be used.
119
- */
120
- createCalendar?: (identifier: CalendarIdentifier) => ICalendar
121
- }
13
+ export {DateValue, CalendarPropsBase, CalendarProps, DateRange, PageBehavior, RangeCalendarProps} from '@react-stately/calendar';
14
+ export {AriaCalendarProps, AriaRangeCalendarProps} from '@react-aria/calendar';
15
+ export {SpectrumCalendarProps, SpectrumRangeCalendarProps} from '@react-spectrum/calendar';