@react-stately/calendar 3.4.4 → 3.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/calendar",
3
- "version": "3.4.4",
3
+ "version": "3.5.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,10 +22,10 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@internationalized/date": "^3.5.2",
26
- "@react-stately/utils": "^3.9.1",
27
- "@react-types/calendar": "^3.4.4",
28
- "@react-types/shared": "^3.22.1",
25
+ "@internationalized/date": "^3.5.3",
26
+ "@react-stately/utils": "^3.10.0",
27
+ "@react-types/calendar": "^3.4.5",
28
+ "@react-types/shared": "^3.23.0",
29
29
  "@swc/helpers": "^0.5.0"
30
30
  },
31
31
  "peerDependencies": {
@@ -34,5 +34,5 @@
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "de9f84a22583fc741c29b341d14cd35ef4cca161"
37
+ "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
38
38
  }
package/src/types.ts CHANGED
@@ -101,9 +101,9 @@ interface CalendarStateBase {
101
101
 
102
102
  export interface CalendarState extends CalendarStateBase {
103
103
  /** The currently selected date. */
104
- readonly value: CalendarDate,
104
+ readonly value: CalendarDate | null,
105
105
  /** Sets the currently selected date. */
106
- setValue(value: CalendarDate): void
106
+ setValue(value: CalendarDate | null): void
107
107
  }
108
108
 
109
109
  export interface RangeCalendarState extends CalendarStateBase {
@@ -136,8 +136,12 @@ export function useCalendarState<T extends DateValue = DateValue>(props: Calenda
136
136
  setFocusedDate(date);
137
137
  }
138
138
 
139
- function setValue(newValue: CalendarDate) {
139
+ function setValue(newValue: CalendarDate | null) {
140
140
  if (!props.isDisabled && !props.isReadOnly) {
141
+ if (newValue === null) {
142
+ setControlledValue(null);
143
+ return;
144
+ }
141
145
  newValue = constrainValue(newValue, minValue, maxValue);
142
146
  newValue = previousAvailableDate(newValue, startDate, isDateUnavailable);
143
147
  if (!newValue) {