@react-types/datepicker 3.1.4 → 3.3.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 +5 -5
  2. package/src/index.d.ts +18 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/datepicker",
3
- "version": "3.1.4",
3
+ "version": "3.3.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "types": "src/index.d.ts",
@@ -9,9 +9,9 @@
9
9
  "url": "https://github.com/adobe/react-spectrum"
10
10
  },
11
11
  "dependencies": {
12
- "@internationalized/date": "^3.0.2",
13
- "@react-types/overlays": "^3.6.5",
14
- "@react-types/shared": "^3.16.0"
12
+ "@internationalized/date": "^3.2.0",
13
+ "@react-types/overlays": "^3.7.1",
14
+ "@react-types/shared": "^3.18.0"
15
15
  },
16
16
  "publishConfig": {
17
17
  "access": "public"
@@ -19,5 +19,5 @@
19
19
  "peerDependencies": {
20
20
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
21
21
  },
22
- "gitHead": "5480d76bd815e239366f92852c76b6831ad2a4fd"
22
+ "gitHead": "9d1ba9bd8ebcd63bf3495ade16d349bcb71795ce"
23
23
  }
package/src/index.d.ts CHANGED
@@ -34,7 +34,7 @@ type MappedDateValue<T> =
34
34
  never;
35
35
 
36
36
  export type Granularity = 'day' | 'hour' | 'minute' | 'second';
37
- interface DatePickerBase<T extends DateValue> extends InputBase, Validation, FocusableProps, LabelableProps, HelpTextProps, OverlayTriggerProps {
37
+ interface DateFieldBase<T extends DateValue> extends InputBase, Validation, FocusableProps, LabelableProps, HelpTextProps, OverlayTriggerProps {
38
38
  /** The minimum allowed date that a user may select. */
39
39
  minValue?: DateValue,
40
40
  /** The maximum allowed date that a user may select. */
@@ -54,13 +54,18 @@ interface DatePickerBase<T extends DateValue> extends InputBase, Validation, Foc
54
54
  hideTimeZone?: boolean
55
55
  }
56
56
 
57
+ interface AriaDateFieldBaseProps<T extends DateValue> extends DateFieldBase<T>, AriaLabelingProps, DOMProps {}
58
+ export interface DateFieldProps<T extends DateValue> extends DateFieldBase<T>, ValueBase<T | null, MappedDateValue<T>> {}
59
+ export interface AriaDateFieldProps<T extends DateValue> extends DateFieldProps<T>, AriaDateFieldBaseProps<T> {}
60
+
61
+ interface DatePickerBase<T extends DateValue> extends DateFieldBase<T>, OverlayTriggerProps {}
57
62
  export interface AriaDatePickerBaseProps<T extends DateValue> extends DatePickerBase<T>, AriaLabelingProps, DOMProps {}
58
63
 
59
- export interface DatePickerProps<T extends DateValue> extends DatePickerBase<T>, ValueBase<T, MappedDateValue<T>> {}
60
- export interface AriaDatePickerProps<T extends DateValue> extends AriaDatePickerBaseProps<T>, DatePickerProps<T> {}
64
+ export interface DatePickerProps<T extends DateValue> extends DatePickerBase<T>, ValueBase<T | null, MappedDateValue<T>> {}
65
+ export interface AriaDatePickerProps<T extends DateValue> extends DatePickerProps<T>, AriaDatePickerBaseProps<T> {}
61
66
 
62
67
  export type DateRange = RangeValue<DateValue>;
63
- export interface DateRangePickerProps<T extends DateValue> extends DatePickerBase<T>, ValueBase<RangeValue<T>, RangeValue<MappedDateValue<T>>> {
68
+ export interface DateRangePickerProps<T extends DateValue> extends DatePickerBase<T>, ValueBase<RangeValue<T> | null, RangeValue<MappedDateValue<T>>> {
64
69
  /**
65
70
  * When combined with `isDateUnavailable`, determines whether non-contiguous ranges,
66
71
  * i.e. ranges containing unavailable dates, may be selected.
@@ -70,7 +75,7 @@ export interface DateRangePickerProps<T extends DateValue> extends DatePickerBas
70
75
 
71
76
  export interface AriaDateRangePickerProps<T extends DateValue> extends AriaDatePickerBaseProps<T>, DateRangePickerProps<T> {}
72
77
 
73
- interface SpectrumDatePickerBase<T extends DateValue> extends AriaDatePickerBaseProps<T>, SpectrumLabelableProps, StyleProps {
78
+ interface SpectrumDateFieldBase extends SpectrumLabelableProps, HelpTextProps, StyleProps {
74
79
  /**
75
80
  * Whether the date picker should be displayed with a quiet style.
76
81
  * @default false
@@ -80,7 +85,10 @@ interface SpectrumDatePickerBase<T extends DateValue> extends AriaDatePickerBase
80
85
  * Whether to show the localized date format as help text below the field.
81
86
  * @default false
82
87
  */
83
- showFormatHelpText?: boolean,
88
+ showFormatHelpText?: boolean
89
+ }
90
+
91
+ interface SpectrumDatePickerBase extends SpectrumDateFieldBase, SpectrumLabelableProps, StyleProps {
84
92
  /**
85
93
  * The maximum number of months to display at once in the calendar popover, if screen space permits.
86
94
  * @default 1
@@ -93,9 +101,9 @@ interface SpectrumDatePickerBase<T extends DateValue> extends AriaDatePickerBase
93
101
  shouldFlip?: boolean
94
102
  }
95
103
 
96
- export interface SpectrumDatePickerProps<T extends DateValue> extends DatePickerProps<T>, SpectrumDatePickerBase<T> {}
97
- export interface SpectrumDateRangePickerProps<T extends DateValue> extends DateRangePickerProps<T>, SpectrumDatePickerBase<T> {}
98
- export interface SpectrumDateFieldProps<T extends DateValue> extends Omit<SpectrumDatePickerProps<T>, 'maxVisibleMonths'> {}
104
+ export interface SpectrumDatePickerProps<T extends DateValue> extends AriaDatePickerProps<T>, SpectrumDatePickerBase {}
105
+ export interface SpectrumDateRangePickerProps<T extends DateValue> extends AriaDateRangePickerProps<T>, SpectrumDatePickerBase {}
106
+ export interface SpectrumDateFieldProps<T extends DateValue> extends AriaDateFieldProps<T>, SpectrumDateFieldBase {}
99
107
 
100
108
  export type TimeValue = Time | CalendarDateTime | ZonedDateTime;
101
109
  type MappedTimeValue<T> =
@@ -104,7 +112,7 @@ type MappedTimeValue<T> =
104
112
  T extends Time ? Time :
105
113
  never;
106
114
 
107
- export interface TimePickerProps<T extends TimeValue> extends InputBase, Validation, FocusableProps, LabelableProps, HelpTextProps, ValueBase<T, MappedTimeValue<T>> {
115
+ export interface TimePickerProps<T extends TimeValue> extends InputBase, Validation, FocusableProps, LabelableProps, HelpTextProps, ValueBase<T | null, MappedTimeValue<T>> {
108
116
  /** Whether to display the time in 12 or 24 hour format. By default, this is determined by the user's locale. */
109
117
  hourCycle?: 12 | 24,
110
118
  /**