@react-types/calendar 3.0.0-alpha.1 → 3.0.0-alpha.4

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 +4 -4
  2. package/src/index.d.ts +38 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/calendar",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.4",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "types": "src/index.d.ts",
@@ -9,8 +9,8 @@
9
9
  "url": "https://github.com/adobe/react-spectrum"
10
10
  },
11
11
  "dependencies": {
12
- "@internationalized/date": "3.0.0-alpha.1",
13
- "@react-types/shared": "^3.10.0"
12
+ "@internationalized/date": "3.0.0-alpha.4",
13
+ "@react-types/shared": "^3.11.1"
14
14
  },
15
15
  "publishConfig": {
16
16
  "access": "public"
@@ -18,5 +18,5 @@
18
18
  "peerDependencies": {
19
19
  "react": "^16.8.0 || ^17.0.0-rc.1"
20
20
  },
21
- "gitHead": "16fc29ac722793ffaea083f13760d82ab341cc8d"
21
+ "gitHead": "e7708349a637642a30d33a11ca4a75ad5829eaa3"
22
22
  }
package/src/index.d.ts CHANGED
@@ -21,22 +21,57 @@ type MappedDateValue<T> =
21
21
  never;
22
22
 
23
23
  export interface CalendarPropsBase {
24
- timeZone?: string,
24
+ /** The minimum allowed date that a user may select. */
25
25
  minValue?: DateValue,
26
+ /** The maximum allowed date that a user may select. */
26
27
  maxValue?: DateValue,
28
+ /** Callback that is called for each date of the calendar. If it returns true, then the date is unavailable. */
29
+ isDateUnavailable?: (date: DateValue) => boolean,
30
+ /**
31
+ * Whether the calendar is disabled.
32
+ * @default false
33
+ */
27
34
  isDisabled?: boolean,
35
+ /**
36
+ * Whether the calendar value is immutable.
37
+ * @default false
38
+ */
28
39
  isReadOnly?: boolean,
29
- autoFocus?: boolean
40
+ /**
41
+ * Whether to automatically focus the calendar when it mounts.
42
+ * @default false
43
+ */
44
+ autoFocus?: boolean,
45
+ /** Controls the currently focused date within the calendar. */
46
+ focusedValue?: DateValue,
47
+ /** The date that is focused when the calendar first mounts (uncountrolled). */
48
+ defaultFocusedValue?: DateValue,
49
+ /** Handler that is called when the focused date changes. */
50
+ onFocusChange?: (date: CalendarDate) => void
30
51
  }
31
52
 
32
53
  export type DateRange = RangeValue<DateValue>;
33
54
  export interface CalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<T, MappedDateValue<T>> {}
34
- export interface RangeCalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<RangeValue<T>, RangeValue<MappedDateValue<T>>> {}
55
+ export interface RangeCalendarProps<T extends DateValue> extends CalendarPropsBase, ValueBase<RangeValue<T>, RangeValue<MappedDateValue<T>>> {
56
+ /**
57
+ * When combined with `isDateUnavailable`, determines whether non-contiguous ranges,
58
+ * i.e. ranges containing unavailable dates, may be selected.
59
+ */
60
+ allowsNonContiguousRanges?: boolean
61
+ }
35
62
 
36
63
  export interface SpectrumCalendarProps<T extends DateValue> extends CalendarProps<T>, DOMProps, StyleProps {
64
+ /**
65
+ * The number of months to display at once. Up to 3 months are supported.
66
+ * @default 1
67
+ */
37
68
  visibleMonths?: number
38
69
  }
39
70
 
40
71
  export interface SpectrumRangeCalendarProps<T extends DateValue> extends RangeCalendarProps<T>, DOMProps, StyleProps {
72
+ /**
73
+ * The number of months to display at once. Up to 3 months are supported.
74
+ * @default 1
75
+ */
41
76
  visibleMonths?: number
42
77
  }