@react-stately/datepicker 3.0.0-nightly.3168 → 3.0.0-nightly.3180

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/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CalendarDate, Calendar, CalendarDateTime, DateFormatter } from "@internationalized/date";
1
+ import { CalendarDate, Calendar, DateFormatter } from "@internationalized/date";
2
2
  import { DatePickerProps, DateValue, Granularity, TimeValue, DateRange, DateRangePickerProps, TimePickerProps } from "@react-types/datepicker";
3
3
  import { ValidationState, RangeValue } from "@react-types/shared";
4
4
  type FieldOptions = Pick<Intl.DateTimeFormatOptions, 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second'>;
@@ -10,55 +10,130 @@ export interface DatePickerOptions extends DatePickerProps<DateValue> {
10
10
  shouldCloseOnSelect?: boolean | (() => boolean);
11
11
  }
12
12
  export interface DatePickerState {
13
+ /** The currently selected date. */
13
14
  value: DateValue;
14
- setValue: (value: DateValue) => void;
15
+ /** Sets the selected date. */
16
+ setValue(value: DateValue): void;
17
+ /**
18
+ * The date portion of the value. This may be set prior to `value` if the user has
19
+ * selected a date but has not yet selected a time.
20
+ */
15
21
  dateValue: DateValue;
16
- setDateValue: (value: CalendarDate) => void;
22
+ /** Sets the date portion of the value. */
23
+ setDateValue(value: CalendarDate): void;
24
+ /**
25
+ * The time portion of the value. This may be set prior to `value` if the user has
26
+ * selected a time but has not yet selected a date.
27
+ */
17
28
  timeValue: TimeValue;
18
- setTimeValue: (value: TimeValue) => void;
29
+ /** Sets the time portion of the value. */
30
+ setTimeValue(value: TimeValue): void;
31
+ /** The granularity for the field, based on the `granularity` prop and current value. */
32
+ granularity: Granularity;
33
+ /** Whether the date picker supports selecting a time, according to the `granularity` prop and current value. */
19
34
  hasTime: boolean;
35
+ /** Whether the calendar popover is currently open. */
20
36
  isOpen: boolean;
21
- setOpen: (isOpen: boolean) => void;
37
+ /** Sets whether the calendar popover is open. */
38
+ setOpen(isOpen: boolean): void;
39
+ /** The current validation state of the date picker, based on the `validationState`, `minValue`, and `maxValue` props. */
22
40
  validationState: ValidationState;
41
+ /** Formats the selected value using the given options. */
23
42
  formatValue(locale: string, fieldOptions: FieldOptions): string;
24
- granularity: Granularity;
25
43
  }
44
+ /**
45
+ * Provides state management for a date picker component.
46
+ * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.
47
+ */
26
48
  export function useDatePickerState(props: DatePickerOptions): DatePickerState;
49
+ export type SegmentType = 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'dayPeriod' | 'literal' | 'timeZoneName';
27
50
  export interface DateSegment {
28
- type: Intl.DateTimeFormatPartTypes;
51
+ /** The type of segment. */
52
+ type: SegmentType;
53
+ /** The formatted text for the segment. */
29
54
  text: string;
55
+ /** The numeric value for the segment, if applicable. */
30
56
  value?: number;
57
+ /** The minimum numeric value for the segment, if applicable. */
31
58
  minValue?: number;
59
+ /** The maximum numeric value for the segment, if applicable. */
32
60
  maxValue?: number;
61
+ /** Whether the value is a placeholder. */
33
62
  isPlaceholder: boolean;
63
+ /** Whether the segment is editable. */
34
64
  isEditable: boolean;
35
65
  }
36
- export interface DatePickerFieldState {
66
+ export interface DateFieldState {
67
+ /** The current field value. */
37
68
  value: DateValue;
69
+ /** The current value, converted to a native JavaScript `Date` object. */
38
70
  dateValue: Date;
39
- setValue: (value: CalendarDateTime) => void;
71
+ /** Sets the field's value. */
72
+ setValue(value: DateValue): void;
73
+ /** A list of segments for the current value. */
40
74
  segments: DateSegment[];
75
+ /** A date formatter configured for the current locale and format. */
41
76
  dateFormatter: DateFormatter;
77
+ /** The current validation state of the date field, based on the `validationState`, `minValue`, and `maxValue` props. */
42
78
  validationState: ValidationState;
79
+ /** The granularity for the field, based on the `granularity` prop and current value. */
43
80
  granularity: Granularity;
81
+ /** Whether the field is disabled. */
44
82
  isDisabled: boolean;
83
+ /** Whether the field is read only. */
45
84
  isReadOnly: boolean;
85
+ /** Whether the field is required. */
46
86
  isRequired: boolean;
47
- increment: (type: Intl.DateTimeFormatPartTypes) => void;
48
- decrement: (type: Intl.DateTimeFormatPartTypes) => void;
49
- incrementPage: (type: Intl.DateTimeFormatPartTypes) => void;
50
- decrementPage: (type: Intl.DateTimeFormatPartTypes) => void;
51
- setSegment: (type: Intl.DateTimeFormatPartTypes, value: number) => void;
52
- confirmPlaceholder: (type?: Intl.DateTimeFormatPartTypes) => void;
53
- clearSegment: (type?: Intl.DateTimeFormatPartTypes) => void;
54
- getFormatOptions(fieldOptions: FieldOptions): Intl.DateTimeFormatOptions;
87
+ /** Increments the given segment. Upon reaching the minimum or maximum value, the value wraps around to the opposite limit. */
88
+ increment(type: SegmentType): void;
89
+ /** Decrements the given segment. Upon reaching the minimum or maximum value, the value wraps around to the opposite limit. */
90
+ decrement(type: SegmentType): void;
91
+ /**
92
+ * Increments the given segment by a larger amount, rounding it to the nearest increment.
93
+ * The amount to increment by depends on the field, for example 15 minutes, 7 days, and 5 years.
94
+ * Upon reaching the minimum or maximum value, the value wraps around to the opposite limit.
95
+ */
96
+ incrementPage(type: SegmentType): void;
97
+ /**
98
+ * Decrements the given segment by a larger amount, rounding it to the nearest increment.
99
+ * The amount to decrement by depends on the field, for example 15 minutes, 7 days, and 5 years.
100
+ * Upon reaching the minimum or maximum value, the value wraps around to the opposite limit.
101
+ */
102
+ decrementPage(type: SegmentType): void;
103
+ /** Sets the value of the given segment. */
104
+ setSegment(type: SegmentType, value: number): void;
105
+ /**
106
+ * Replaces the value of the date field with the placeholder value.
107
+ * If a segment type is provided, only that segment is confirmed. Otherwise, all segments that have not been entered yet are confirmed.
108
+ */
109
+ confirmPlaceholder(type?: SegmentType): void;
110
+ /** Clears the value of the given segment, reverting it to the placeholder. */
111
+ clearSegment(type: SegmentType): void;
112
+ /** Formats the current date value using the given options. */
113
+ formatValue(fieldOptions: FieldOptions): string;
55
114
  }
56
- interface DatePickerFieldProps<T extends DateValue> extends DatePickerProps<T> {
57
- maxGranularity?: 'year' | 'month' | DatePickerProps<T>['granularity'];
115
+ interface DatePickerFieldProps extends DatePickerProps<DateValue> {
116
+ /**
117
+ * The maximum unit to display in the date field.
118
+ * @default 'year'
119
+ */
120
+ maxGranularity?: 'year' | 'month' | Granularity;
121
+ /** The locale to display and edit the value according to. */
58
122
  locale: string;
123
+ /**
124
+ * A function that creates a [Calendar](../internationalized/date/Calendar.html)
125
+ * object for a given calendar identifier. Such a function may be imported from the
126
+ * `@internationalized/date` package, or manually implemented to include support for
127
+ * only certain calendars.
128
+ */
59
129
  createCalendar: (name: string) => Calendar;
60
130
  }
61
- export function useDatePickerFieldState<T extends DateValue>(props: DatePickerFieldProps<T>): DatePickerFieldState;
131
+ /**
132
+ * Provides state management for a date field component.
133
+ * A date field allows users to enter and edit date and time values using a keyboard.
134
+ * Each part of a date value is displayed in an individually editable segment.
135
+ */
136
+ export function useDateFieldState(props: DatePickerFieldProps): DateFieldState;
62
137
  export interface DateRangePickerOptions extends DateRangePickerProps<DateValue> {
63
138
  /**
64
139
  * Determines whether the date picker popover should close automatically when a date is selected.
@@ -68,27 +143,60 @@ export interface DateRangePickerOptions extends DateRangePickerProps<DateValue>
68
143
  }
69
144
  type TimeRange = RangeValue<TimeValue>;
70
145
  export interface DateRangePickerState {
146
+ /** The currently selected date range. */
71
147
  value: DateRange;
72
- setValue: (value: DateRange) => void;
73
- setDate: (part: keyof DateRange, value: DateValue) => void;
74
- setTime: (part: keyof TimeRange, value: TimeValue) => void;
75
- setDateTime: (part: keyof DateRange, value: DateValue) => void;
148
+ /** Sets the selected date range. */
149
+ setValue(value: DateRange): void;
150
+ /**
151
+ * The date portion of the selected range. This may be set prior to `value` if the user has
152
+ * selected a date range but has not yet selected a time range.
153
+ */
76
154
  dateRange: DateRange;
77
- setDateRange: (value: DateRange) => void;
155
+ /** Sets the date portion of the selected range. */
156
+ setDateRange(value: DateRange): void;
157
+ /**
158
+ * The time portion of the selected range. This may be set prior to `value` if the user has
159
+ * selected a time range but has not yet selected a date range.
160
+ */
78
161
  timeRange: TimeRange;
79
- setTimeRange: (value: TimeRange) => void;
162
+ /** Sets the time portion of the selected range. */
163
+ setTimeRange(value: TimeRange): void;
164
+ /** Sets the date portion of either the start or end of the selected range. */
165
+ setDate(part: 'start' | 'end', value: DateValue): void;
166
+ /** Sets the time portion of either the start or end of the selected range. */
167
+ setTime(part: 'start' | 'end', value: TimeValue): void;
168
+ /** Sets the date and time of either the start or end of the selected range. */
169
+ setDateTime(part: 'start' | 'end', value: DateValue): void;
170
+ /** The granularity for the field, based on the `granularity` prop and current value. */
171
+ granularity: Granularity;
172
+ /** Whether the date range picker supports selecting times, according to the `granularity` prop and current value. */
80
173
  hasTime: boolean;
174
+ /** Whether the calendar popover is currently open. */
81
175
  isOpen: boolean;
82
- setOpen: (isOpen: boolean) => void;
176
+ /** Sets whether the calendar popover is open. */
177
+ setOpen(isOpen: boolean): void;
178
+ /** The current validation state of the date picker, based on the `validationState`, `minValue`, and `maxValue` props. */
83
179
  validationState: ValidationState;
180
+ /** Formats the selected range using the given options. */
84
181
  formatValue(locale: string, fieldOptions: FieldOptions): string;
182
+ /** Replaces the start and/or end value of the selected range with the placeholder value if unentered. */
85
183
  confirmPlaceholder(): void;
86
- granularity: Granularity;
87
184
  }
185
+ /**
186
+ * Provides state management for a date range picker component.
187
+ * A date range picker combines two DateFields and a RangeCalendar popover to allow
188
+ * users to enter or select a date and time range.
189
+ */
88
190
  export function useDateRangePickerState(props: DateRangePickerOptions): DateRangePickerState;
89
- interface TimeFieldProps<T extends TimeValue> extends TimePickerProps<T> {
191
+ interface TimeFieldProps extends TimePickerProps<TimeValue> {
192
+ /** The locale to display and edit the value according to. */
90
193
  locale: string;
91
194
  }
92
- export function useTimeFieldState<T extends TimeValue>(props: TimeFieldProps<T>): import("useDatePickerFieldState").DatePickerFieldState;
195
+ /**
196
+ * Provides state management for a time field component.
197
+ * A time field allows users to enter and edit time values using a keyboard.
198
+ * Each part of a time value is displayed in an individually editable segment.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AAkC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,0DAsC9E","sources":["packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/utils.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/useDatePickerState.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/useDatePickerFieldState.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/useDateRangePickerState.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/useTimeFieldState.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/index.ts","packages/@react-stately/datepicker/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useDatePickerState';\nexport * from './useDatePickerFieldState';\nexport * from './useDateRangePickerState';\nexport * from './useTimeFieldState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;AAuBA,oBAA2B,IAAI,CAAC,KAAK,qBAAqB,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC;ACHrH,kCAAmC,SAAQ,gBAAgB,SAAS,CAAC;IACnE;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAA;CAChD;AAED;IACE,mCAAmC;IACnC,KAAK,EAAE,SAAS,CAAC;IACjB,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC;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yG;IACzG,kBAAkB,IAAI,IAAI,CAAA;CAC3B;AAED;;;;GAIG;AACH,wCAAwC,KAAK,EAAE,sBAAsB,GAAG,oBAAoB,CAiL3F;ACzOD,wBAAyB,SAAQ,gBAAgB,SAAS,CAAC;IACzD,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,kCAAkC,KAAK,EAAE,cAAc,GAAG,cAAc,CAsCvE","sources":["packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/utils.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/useDatePickerState.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/useDateFieldState.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/useDateRangePickerState.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/useTimeFieldState.ts","packages/@react-stately/datepicker/src/packages/@react-stately/datepicker/src/index.ts","packages/@react-stately/datepicker/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useDatePickerState';\nexport * from './useDateFieldState';\nexport * from './useDateRangePickerState';\nexport * from './useTimeFieldState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/datepicker",
3
- "version": "3.0.0-nightly.3168+2fabc1ac0",
3
+ "version": "3.0.0-nightly.3180+0bba35ae3",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,10 +18,10 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@internationalized/date": "3.0.0-nightly.3168+2fabc1ac0",
22
- "@react-stately/utils": "3.0.0-nightly.1469+2fabc1ac0",
23
- "@react-types/datepicker": "3.0.0-nightly.3168+2fabc1ac0",
24
- "@react-types/shared": "3.0.0-nightly.1469+2fabc1ac0",
21
+ "@internationalized/date": "3.0.0-nightly.3180+0bba35ae3",
22
+ "@react-stately/utils": "3.0.0-nightly.1481+0bba35ae3",
23
+ "@react-types/datepicker": "3.0.0-nightly.3180+0bba35ae3",
24
+ "@react-types/shared": "3.0.0-nightly.1481+0bba35ae3",
25
25
  "date-fns": "^1.30.1"
26
26
  },
27
27
  "peerDependencies": {
@@ -30,5 +30,5 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "2fabc1ac07aa6fd75e7111e571e27787d8a44314"
33
+ "gitHead": "0bba35ae36b5d220570385215860d3ca3b549656"
34
34
  }
package/src/index.ts CHANGED
@@ -11,6 +11,6 @@
11
11
  */
12
12
 
13
13
  export * from './useDatePickerState';
14
- export * from './useDatePickerFieldState';
14
+ export * from './useDateFieldState';
15
15
  export * from './useDateRangePickerState';
16
16
  export * from './useTimeFieldState';
@@ -10,42 +10,79 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {Calendar, CalendarDateTime, DateFormatter, getMinimumDayInMonth, getMinimumMonthInYear, GregorianCalendar, toCalendar} from '@internationalized/date';
13
+ import {Calendar, DateFormatter, getMinimumDayInMonth, getMinimumMonthInYear, GregorianCalendar, toCalendar} from '@internationalized/date';
14
14
  import {convertValue, createPlaceholderDate, FieldOptions, getFormatOptions, isInvalid, useDefaultProps} from './utils';
15
15
  import {DatePickerProps, DateValue, Granularity} from '@react-types/datepicker';
16
16
  import {useControlledState} from '@react-stately/utils';
17
17
  import {useEffect, useMemo, useRef, useState} from 'react';
18
18
  import {ValidationState} from '@react-types/shared';
19
19
 
20
+ export type SegmentType = 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'dayPeriod' | 'literal' | 'timeZoneName';
20
21
  export interface DateSegment {
21
- type: Intl.DateTimeFormatPartTypes,
22
+ /** The type of segment. */
23
+ type: SegmentType,
24
+ /** The formatted text for the segment. */
22
25
  text: string,
26
+ /** The numeric value for the segment, if applicable. */
23
27
  value?: number,
28
+ /** The minimum numeric value for the segment, if applicable. */
24
29
  minValue?: number,
30
+ /** The maximum numeric value for the segment, if applicable. */
25
31
  maxValue?: number,
32
+ /** Whether the value is a placeholder. */
26
33
  isPlaceholder: boolean,
34
+ /** Whether the segment is editable. */
27
35
  isEditable: boolean
28
36
  }
29
37
 
30
- export interface DatePickerFieldState {
38
+ export interface DateFieldState {
39
+ /** The current field value. */
31
40
  value: DateValue,
41
+ /** The current value, converted to a native JavaScript `Date` object. */
32
42
  dateValue: Date,
33
- setValue: (value: CalendarDateTime) => void,
43
+ /** Sets the field's value. */
44
+ setValue(value: DateValue): void,
45
+ /** A list of segments for the current value. */
34
46
  segments: DateSegment[],
47
+ /** A date formatter configured for the current locale and format. */
35
48
  dateFormatter: DateFormatter,
49
+ /** The current validation state of the date field, based on the `validationState`, `minValue`, and `maxValue` props. */
36
50
  validationState: ValidationState,
51
+ /** The granularity for the field, based on the `granularity` prop and current value. */
37
52
  granularity: Granularity,
53
+ /** Whether the field is disabled. */
38
54
  isDisabled: boolean,
55
+ /** Whether the field is read only. */
39
56
  isReadOnly: boolean,
57
+ /** Whether the field is required. */
40
58
  isRequired: boolean,
41
- increment: (type: Intl.DateTimeFormatPartTypes) => void,
42
- decrement: (type: Intl.DateTimeFormatPartTypes) => void,
43
- incrementPage: (type: Intl.DateTimeFormatPartTypes) => void,
44
- decrementPage: (type: Intl.DateTimeFormatPartTypes) => void,
45
- setSegment: (type: Intl.DateTimeFormatPartTypes, value: number) => void,
46
- confirmPlaceholder: (type?: Intl.DateTimeFormatPartTypes) => void,
47
- clearSegment: (type?: Intl.DateTimeFormatPartTypes) => void,
48
- getFormatOptions(fieldOptions: FieldOptions): Intl.DateTimeFormatOptions
59
+ /** Increments the given segment. Upon reaching the minimum or maximum value, the value wraps around to the opposite limit. */
60
+ increment(type: SegmentType): void,
61
+ /** Decrements the given segment. Upon reaching the minimum or maximum value, the value wraps around to the opposite limit. */
62
+ decrement(type: SegmentType): void,
63
+ /**
64
+ * Increments the given segment by a larger amount, rounding it to the nearest increment.
65
+ * The amount to increment by depends on the field, for example 15 minutes, 7 days, and 5 years.
66
+ * Upon reaching the minimum or maximum value, the value wraps around to the opposite limit.
67
+ */
68
+ incrementPage(type: SegmentType): void,
69
+ /**
70
+ * Decrements the given segment by a larger amount, rounding it to the nearest increment.
71
+ * The amount to decrement by depends on the field, for example 15 minutes, 7 days, and 5 years.
72
+ * Upon reaching the minimum or maximum value, the value wraps around to the opposite limit.
73
+ */
74
+ decrementPage(type: SegmentType): void,
75
+ /** Sets the value of the given segment. */
76
+ setSegment(type: SegmentType, value: number): void,
77
+ /**
78
+ * Replaces the value of the date field with the placeholder value.
79
+ * If a segment type is provided, only that segment is confirmed. Otherwise, all segments that have not been entered yet are confirmed.
80
+ */
81
+ confirmPlaceholder(type?: SegmentType): void,
82
+ /** Clears the value of the given segment, reverting it to the placeholder. */
83
+ clearSegment(type: SegmentType): void,
84
+ /** Formats the current date value using the given options. */
85
+ formatValue(fieldOptions: FieldOptions): string
49
86
  }
50
87
 
51
88
  const EDITABLE_SEGMENTS = {
@@ -73,13 +110,29 @@ const TYPE_MAPPING = {
73
110
  dayperiod: 'dayPeriod'
74
111
  };
75
112
 
76
- interface DatePickerFieldProps<T extends DateValue> extends DatePickerProps<T> {
77
- maxGranularity?: 'year' | 'month' | DatePickerProps<T>['granularity'],
113
+ interface DatePickerFieldProps extends DatePickerProps<DateValue> {
114
+ /**
115
+ * The maximum unit to display in the date field.
116
+ * @default 'year'
117
+ */
118
+ maxGranularity?: 'year' | 'month' | Granularity,
119
+ /** The locale to display and edit the value according to. */
78
120
  locale: string,
121
+ /**
122
+ * A function that creates a [Calendar](../internationalized/date/Calendar.html)
123
+ * object for a given calendar identifier. Such a function may be imported from the
124
+ * `@internationalized/date` package, or manually implemented to include support for
125
+ * only certain calendars.
126
+ */
79
127
  createCalendar: (name: string) => Calendar
80
128
  }
81
129
 
82
- export function useDatePickerFieldState<T extends DateValue>(props: DatePickerFieldProps<T>): DatePickerFieldState {
130
+ /**
131
+ * Provides state management for a date field component.
132
+ * A date field allows users to enter and edit date and time values using a keyboard.
133
+ * Each part of a date value is displayed in an individually editable segment.
134
+ */
135
+ export function useDateFieldState(props: DatePickerFieldProps): DateFieldState {
83
136
  let {
84
137
  locale,
85
138
  createCalendar,
@@ -287,8 +340,14 @@ export function useDatePickerFieldState<T extends DateValue>(props: DatePickerFi
287
340
  setDate(null);
288
341
  setValue(value);
289
342
  },
290
- getFormatOptions(fieldOptions: FieldOptions) {
291
- return getFormatOptions(fieldOptions, formatOpts);
343
+ formatValue(fieldOptions: FieldOptions) {
344
+ if (!calendarValue) {
345
+ return '';
346
+ }
347
+
348
+ let formatOptions = getFormatOptions(fieldOptions, formatOpts);
349
+ let formatter = new DateFormatter(locale, formatOptions);
350
+ return formatter.format(dateValue);
292
351
  }
293
352
  };
294
353
  }
@@ -27,20 +27,42 @@ export interface DatePickerOptions extends DatePickerProps<DateValue> {
27
27
  }
28
28
 
29
29
  export interface DatePickerState {
30
+ /** The currently selected date. */
30
31
  value: DateValue,
31
- setValue: (value: DateValue) => void,
32
+ /** Sets the selected date. */
33
+ setValue(value: DateValue): void,
34
+ /**
35
+ * The date portion of the value. This may be set prior to `value` if the user has
36
+ * selected a date but has not yet selected a time.
37
+ */
32
38
  dateValue: DateValue,
33
- setDateValue: (value: CalendarDate) => void,
39
+ /** Sets the date portion of the value. */
40
+ setDateValue(value: CalendarDate): void,
41
+ /**
42
+ * The time portion of the value. This may be set prior to `value` if the user has
43
+ * selected a time but has not yet selected a date.
44
+ */
34
45
  timeValue: TimeValue,
35
- setTimeValue: (value: TimeValue) => void,
46
+ /** Sets the time portion of the value. */
47
+ setTimeValue(value: TimeValue): void,
48
+ /** The granularity for the field, based on the `granularity` prop and current value. */
49
+ granularity: Granularity,
50
+ /** Whether the date picker supports selecting a time, according to the `granularity` prop and current value. */
36
51
  hasTime: boolean,
52
+ /** Whether the calendar popover is currently open. */
37
53
  isOpen: boolean,
38
- setOpen: (isOpen: boolean) => void,
54
+ /** Sets whether the calendar popover is open. */
55
+ setOpen(isOpen: boolean): void,
56
+ /** The current validation state of the date picker, based on the `validationState`, `minValue`, and `maxValue` props. */
39
57
  validationState: ValidationState,
40
- formatValue(locale: string, fieldOptions: FieldOptions): string,
41
- granularity: Granularity
58
+ /** Formats the selected value using the given options. */
59
+ formatValue(locale: string, fieldOptions: FieldOptions): string
42
60
  }
43
61
 
62
+ /**
63
+ * Provides state management for a date picker component.
64
+ * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.
65
+ */
44
66
  export function useDatePickerState(props: DatePickerOptions): DatePickerState {
45
67
  let [isOpen, setOpen] = useState(false);
46
68
  let [value, setValue] = useControlledState<DateValue>(props.value, props.defaultValue || null, props.onChange);
@@ -97,7 +119,8 @@ export function useDatePickerState(props: DatePickerOptions): DatePickerState {
97
119
  };
98
120
 
99
121
  let validationState: ValidationState = props.validationState ||
100
- (isInvalid(value, props.minValue, props.maxValue) ? 'invalid' : null);
122
+ (isInvalid(value, props.minValue, props.maxValue) ? 'invalid' : null) ||
123
+ (value && props.isDateUnavailable?.(value) ? 'invalid' : null);
101
124
 
102
125
  return {
103
126
  value,
@@ -27,24 +27,51 @@ export interface DateRangePickerOptions extends DateRangePickerProps<DateValue>
27
27
 
28
28
  type TimeRange = RangeValue<TimeValue>;
29
29
  export interface DateRangePickerState {
30
+ /** The currently selected date range. */
30
31
  value: DateRange,
31
- setValue: (value: DateRange) => void,
32
- setDate: (part: keyof DateRange, value: DateValue) => void,
33
- setTime: (part: keyof TimeRange, value: TimeValue) => void,
34
- setDateTime: (part: keyof DateRange, value: DateValue) => void,
32
+ /** Sets the selected date range. */
33
+ setValue(value: DateRange): void,
34
+ /**
35
+ * The date portion of the selected range. This may be set prior to `value` if the user has
36
+ * selected a date range but has not yet selected a time range.
37
+ */
35
38
  dateRange: DateRange,
36
- setDateRange: (value: DateRange) => void,
39
+ /** Sets the date portion of the selected range. */
40
+ setDateRange(value: DateRange): void,
41
+ /**
42
+ * The time portion of the selected range. This may be set prior to `value` if the user has
43
+ * selected a time range but has not yet selected a date range.
44
+ */
37
45
  timeRange: TimeRange,
38
- setTimeRange: (value: TimeRange) => void,
46
+ /** Sets the time portion of the selected range. */
47
+ setTimeRange(value: TimeRange): void,
48
+ /** Sets the date portion of either the start or end of the selected range. */
49
+ setDate(part: 'start' | 'end', value: DateValue): void,
50
+ /** Sets the time portion of either the start or end of the selected range. */
51
+ setTime(part: 'start' | 'end', value: TimeValue): void,
52
+ /** Sets the date and time of either the start or end of the selected range. */
53
+ setDateTime(part: 'start' | 'end', value: DateValue): void,
54
+ /** The granularity for the field, based on the `granularity` prop and current value. */
55
+ granularity: Granularity,
56
+ /** Whether the date range picker supports selecting times, according to the `granularity` prop and current value. */
39
57
  hasTime: boolean,
58
+ /** Whether the calendar popover is currently open. */
40
59
  isOpen: boolean,
41
- setOpen: (isOpen: boolean) => void,
60
+ /** Sets whether the calendar popover is open. */
61
+ setOpen(isOpen: boolean): void,
62
+ /** The current validation state of the date picker, based on the `validationState`, `minValue`, and `maxValue` props. */
42
63
  validationState: ValidationState,
64
+ /** Formats the selected range using the given options. */
43
65
  formatValue(locale: string, fieldOptions: FieldOptions): string,
44
- confirmPlaceholder(): void,
45
- granularity: Granularity
66
+ /** Replaces the start and/or end value of the selected range with the placeholder value if unentered. */
67
+ confirmPlaceholder(): void
46
68
  }
47
69
 
70
+ /**
71
+ * Provides state management for a date range picker component.
72
+ * A date range picker combines two DateFields and a RangeCalendar popover to allow
73
+ * users to enter or select a date and time range.
74
+ */
48
75
  export function useDateRangePickerState(props: DateRangePickerOptions): DateRangePickerState {
49
76
  let [isOpen, setOpen] = useState(false);
50
77
  let [controlledValue, setControlledValue] = useControlledState<DateRange>(props.value, props.defaultValue || null, props.onChange);
@@ -127,7 +154,9 @@ export function useDateRangePickerState(props: DateRangePickerOptions): DateRang
127
154
  || (value != null && (
128
155
  isInvalid(value.start, props.minValue, props.maxValue) ||
129
156
  isInvalid(value.end, props.minValue, props.maxValue) ||
130
- (value.end != null && value.start != null && value.end.compare(value.start) < 0)
157
+ (value.end != null && value.start != null && value.end.compare(value.start) < 0) ||
158
+ (value?.start && props.isDateUnavailable?.(value.start)) ||
159
+ (value?.end && props.isDateUnavailable?.(value.end))
131
160
  ) ? 'invalid' : null);
132
161
 
133
162
  return {
@@ -10,17 +10,23 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
+ import {DateFieldState, useDateFieldState} from '.';
13
14
  import {DateValue, TimePickerProps, TimeValue} from '@react-types/datepicker';
14
15
  import {getLocalTimeZone, GregorianCalendar, Time, toCalendarDateTime, today, toTime} from '@internationalized/date';
15
16
  import {useControlledState} from '@react-stately/utils';
16
- import {useDatePickerFieldState} from '.';
17
17
  import {useMemo} from 'react';
18
18
 
19
- interface TimeFieldProps<T extends TimeValue> extends TimePickerProps<T> {
19
+ interface TimeFieldProps extends TimePickerProps<TimeValue> {
20
+ /** The locale to display and edit the value according to. */
20
21
  locale: string
21
22
  }
22
23
 
23
- export function useTimeFieldState<T extends TimeValue>(props: TimeFieldProps<T>) {
24
+ /**
25
+ * Provides state management for a time field component.
26
+ * A time field allows users to enter and edit time values using a keyboard.
27
+ * Each part of a time value is displayed in an individually editable segment.
28
+ */
29
+ export function useTimeFieldState(props: TimeFieldProps): DateFieldState {
24
30
  let {
25
31
  placeholderValue = new Time(),
26
32
  minValue,
@@ -45,7 +51,7 @@ export function useTimeFieldState<T extends TimeValue>(props: TimeFieldProps<T>)
45
51
  setValue(v && 'day' in v ? newValue : newValue && toTime(newValue));
46
52
  };
47
53
 
48
- return useDatePickerFieldState({
54
+ return useDateFieldState({
49
55
  ...props,
50
56
  value: dateTime,
51
57
  defaultValue: undefined,