@react-types/datepicker 3.3.1 → 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.
Files changed (2) hide show
  1. package/package.json +6 -5
  2. package/src/index.d.ts +34 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/datepicker",
3
- "version": "3.3.1",
3
+ "version": "3.5.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,10 @@
9
9
  "url": "https://github.com/adobe/react-spectrum"
10
10
  },
11
11
  "dependencies": {
12
- "@internationalized/date": "^3.2.0",
13
- "@react-types/overlays": "^3.7.2",
14
- "@react-types/shared": "^3.18.1"
12
+ "@internationalized/date": "^3.4.0",
13
+ "@react-types/calendar": "^3.3.1",
14
+ "@react-types/overlays": "^3.8.1",
15
+ "@react-types/shared": "^3.19.0"
15
16
  },
16
17
  "publishConfig": {
17
18
  "access": "public"
@@ -19,5 +20,5 @@
19
20
  "peerDependencies": {
20
21
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
21
22
  },
22
- "gitHead": "5911ed21de4b76d66f6254c02302519e02d50e16"
23
+ "gitHead": "d4dfe4bb842a914f10045ee63fc6b92f034c5b30"
23
24
  }
package/src/index.d.ts CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  FocusableProps,
17
17
  HelpTextProps,
18
18
  InputBase,
19
+ InputDOMProps,
19
20
  LabelableProps,
20
21
  RangeValue,
21
22
  SpectrumLabelableProps,
@@ -25,6 +26,7 @@ import {
25
26
  } from '@react-types/shared';
26
27
  import {CalendarDate, CalendarDateTime, Time, ZonedDateTime} from '@internationalized/date';
27
28
  import {OverlayTriggerProps} from '@react-types/overlays';
29
+ import {PageBehavior} from '@react-types/calendar';
28
30
 
29
31
  export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
30
32
  type MappedDateValue<T> =
@@ -51,18 +53,29 @@ interface DateFieldBase<T extends DateValue> extends InputBase, Validation, Focu
51
53
  * Whether to hide the time zone abbreviation.
52
54
  * @default false
53
55
  */
54
- hideTimeZone?: boolean
56
+ hideTimeZone?: boolean,
57
+ /**
58
+ * Whether to always show leading zeros in the month, day, and hour fields.
59
+ * By default, this is determined by the user's locale.
60
+ */
61
+ shouldForceLeadingZeros?: boolean
55
62
  }
56
63
 
57
64
  interface AriaDateFieldBaseProps<T extends DateValue> extends DateFieldBase<T>, AriaLabelingProps, DOMProps {}
58
65
  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> {}
66
+ export interface AriaDateFieldProps<T extends DateValue> extends DateFieldProps<T>, AriaDateFieldBaseProps<T>, InputDOMProps {}
60
67
 
61
- interface DatePickerBase<T extends DateValue> extends DateFieldBase<T>, OverlayTriggerProps {}
68
+ interface DatePickerBase<T extends DateValue> extends DateFieldBase<T>, OverlayTriggerProps {
69
+ /**
70
+ * Controls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.
71
+ * @default visible
72
+ */
73
+ pageBehavior?: PageBehavior
74
+ }
62
75
  export interface AriaDatePickerBaseProps<T extends DateValue> extends DatePickerBase<T>, AriaLabelingProps, DOMProps {}
63
76
 
64
77
  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> {}
78
+ export interface AriaDatePickerProps<T extends DateValue> extends DatePickerProps<T>, AriaDatePickerBaseProps<T>, InputDOMProps {}
66
79
 
67
80
  export type DateRange = RangeValue<DateValue>;
68
81
  export interface DateRangePickerProps<T extends DateValue> extends DatePickerBase<T>, ValueBase<RangeValue<T> | null, RangeValue<MappedDateValue<T>>> {
@@ -73,7 +86,16 @@ export interface DateRangePickerProps<T extends DateValue> extends DatePickerBas
73
86
  allowsNonContiguousRanges?: boolean
74
87
  }
75
88
 
76
- export interface AriaDateRangePickerProps<T extends DateValue> extends AriaDatePickerBaseProps<T>, DateRangePickerProps<T> {}
89
+ export interface AriaDateRangePickerProps<T extends DateValue> extends AriaDatePickerBaseProps<T>, DateRangePickerProps<T> {
90
+ /**
91
+ * The name of the start date input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
92
+ */
93
+ startName?: string,
94
+ /**
95
+ * The name of the end date input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
96
+ */
97
+ endName?: string
98
+ }
77
99
 
78
100
  interface SpectrumDateFieldBase extends SpectrumLabelableProps, HelpTextProps, StyleProps {
79
101
  /**
@@ -122,6 +144,11 @@ export interface TimePickerProps<T extends TimeValue> extends InputBase, Validat
122
144
  granularity?: 'hour' | 'minute' | 'second',
123
145
  /** Whether to hide the time zone abbreviation. */
124
146
  hideTimeZone?: boolean,
147
+ /**
148
+ * Whether to always show leading zeros in the hour field.
149
+ * By default, this is determined by the user's locale.
150
+ */
151
+ shouldForceLeadingZeros?: boolean,
125
152
  /**
126
153
  * A placeholder time that influences the format of the placeholder shown when no value is selected.
127
154
  * Defaults to 12:00 AM or 00:00 depending on the hour cycle.
@@ -133,9 +160,9 @@ export interface TimePickerProps<T extends TimeValue> extends InputBase, Validat
133
160
  maxValue?: TimeValue
134
161
  }
135
162
 
136
- export interface AriaTimeFieldProps<T extends TimeValue> extends TimePickerProps<T>, AriaLabelingProps, DOMProps {}
163
+ export interface AriaTimeFieldProps<T extends TimeValue> extends TimePickerProps<T>, AriaLabelingProps, DOMProps, InputDOMProps {}
137
164
 
138
- export interface SpectrumTimeFieldProps<T extends TimeValue> extends AriaTimeFieldProps<T>, SpectrumLabelableProps, StyleProps {
165
+ export interface SpectrumTimeFieldProps<T extends TimeValue> extends AriaTimeFieldProps<T>, SpectrumLabelableProps, StyleProps, InputDOMProps {
139
166
  /**
140
167
  * Whether the time field should be displayed with a quiet style.
141
168
  * @default false