@react-types/datepicker 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.
- package/package.json +4 -4
- package/src/index.d.ts +48 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/datepicker",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
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.
|
|
13
|
-
"@react-types/shared": "^3.
|
|
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": "
|
|
21
|
+
"gitHead": "e7708349a637642a30d33a11ca4a75ad5829eaa3"
|
|
22
22
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -34,11 +34,22 @@ type MappedDateValue<T> =
|
|
|
34
34
|
|
|
35
35
|
export type Granularity = 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
36
36
|
interface DatePickerBase<T extends DateValue> extends InputBase, Validation, FocusableProps, LabelableProps, HelpTextProps {
|
|
37
|
+
/** The minimum allowed date that a user may select. */
|
|
37
38
|
minValue?: DateValue,
|
|
39
|
+
/** The maximum allowed date that a user may select. */
|
|
38
40
|
maxValue?: DateValue,
|
|
41
|
+
/** Callback that is called for each date of the calendar. If it returns true, then the date is unavailable. */
|
|
42
|
+
isDateUnavailable?: (date: DateValue) => boolean,
|
|
43
|
+
/** A placeholder date to display when no value is selected. Defaults to today's date at midnight. */
|
|
39
44
|
placeholderValue?: T,
|
|
45
|
+
/** Whether to display the time in 12 or 24 hour format. By default, this is determined by the user's locale. */
|
|
40
46
|
hourCycle?: 12 | 24,
|
|
47
|
+
/** Determines the smallest unit that is displayed in the date picker. By default, this is `"day"` for dates, and `"minute"` for times. */
|
|
41
48
|
granularity?: Granularity,
|
|
49
|
+
/**
|
|
50
|
+
* Whether to hide the time zone abbreviation.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
42
53
|
hideTimeZone?: boolean
|
|
43
54
|
}
|
|
44
55
|
|
|
@@ -48,17 +59,37 @@ export interface DatePickerProps<T extends DateValue> extends DatePickerBase<T>,
|
|
|
48
59
|
export interface AriaDatePickerProps<T extends DateValue> extends AriaDatePickerBaseProps<T>, DatePickerProps<T> {}
|
|
49
60
|
|
|
50
61
|
export type DateRange = RangeValue<DateValue>;
|
|
51
|
-
export interface DateRangePickerProps<T extends DateValue> extends DatePickerBase<T>, ValueBase<RangeValue<T>, RangeValue<MappedDateValue<T>>> {
|
|
62
|
+
export interface DateRangePickerProps<T extends DateValue> extends DatePickerBase<T>, ValueBase<RangeValue<T>, RangeValue<MappedDateValue<T>>> {
|
|
63
|
+
/**
|
|
64
|
+
* When combined with `isDateUnavailable`, determines whether non-contiguous ranges,
|
|
65
|
+
* i.e. ranges containing unavailable dates, may be selected.
|
|
66
|
+
*/
|
|
67
|
+
allowsNonContiguousRanges?: boolean
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
export interface AriaDateRangePickerProps<T extends DateValue> extends AriaDatePickerBaseProps<T>, DateRangePickerProps<T> {}
|
|
53
71
|
|
|
54
72
|
interface SpectrumDatePickerBase<T extends DateValue> extends AriaDatePickerBaseProps<T>, SpectrumLabelableProps, StyleProps {
|
|
73
|
+
/**
|
|
74
|
+
* Whether the date picker should be displayed with a quiet style.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
55
77
|
isQuiet?: boolean,
|
|
78
|
+
/**
|
|
79
|
+
* Whether to show the localized date format as help text below the field.
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
56
82
|
showFormatHelpText?: boolean,
|
|
83
|
+
/**
|
|
84
|
+
* The maximum number of months to display at once in the calendar popover, if screen space permits.
|
|
85
|
+
* @default 1
|
|
86
|
+
*/
|
|
57
87
|
maxVisibleMonths?: number
|
|
58
88
|
}
|
|
59
89
|
|
|
60
90
|
export interface SpectrumDatePickerProps<T extends DateValue> extends DatePickerProps<T>, SpectrumDatePickerBase<T> {}
|
|
61
91
|
export interface SpectrumDateRangePickerProps<T extends DateValue> extends DateRangePickerProps<T>, SpectrumDatePickerBase<T> {}
|
|
92
|
+
export interface SpectrumDateFieldProps<T extends DateValue> extends Omit<SpectrumDatePickerProps<T>, 'maxVisibleMonths'> {}
|
|
62
93
|
|
|
63
94
|
export type TimeValue = Time | CalendarDateTime | ZonedDateTime;
|
|
64
95
|
type MappedTimeValue<T> =
|
|
@@ -68,14 +99,29 @@ type MappedTimeValue<T> =
|
|
|
68
99
|
never;
|
|
69
100
|
|
|
70
101
|
export interface TimePickerProps<T extends TimeValue> extends InputBase, Validation, FocusableProps, LabelableProps, ValueBase<T, MappedTimeValue<T>> {
|
|
102
|
+
/** Whether to display the time in 12 or 24 hour format. By default, this is determined by the user's locale. */
|
|
71
103
|
hourCycle?: 12 | 24,
|
|
104
|
+
/**
|
|
105
|
+
* Determines the smallest unit that is displayed in the time picker.
|
|
106
|
+
* @default 'minute'
|
|
107
|
+
*/
|
|
72
108
|
granularity?: 'hour' | 'minute' | 'second' | 'millisecond',
|
|
109
|
+
/** Whether to hide the time zone abbreviation. */
|
|
73
110
|
hideTimeZone?: boolean,
|
|
111
|
+
/** A placeholder time to display when no value is selected. Defaults to 12:00 or 00:00 depending on the hour cycle. */
|
|
74
112
|
placeholderValue?: T,
|
|
113
|
+
/** The minimum allowed time that a user may select. */
|
|
75
114
|
minValue?: TimeValue,
|
|
115
|
+
/** The maximum allowed time that a user may select. */
|
|
76
116
|
maxValue?: TimeValue
|
|
77
117
|
}
|
|
78
118
|
|
|
79
|
-
export interface
|
|
119
|
+
export interface AriaTimeFieldProps<T extends TimeValue> extends TimePickerProps<T>, AriaLabelingProps, DOMProps {}
|
|
120
|
+
|
|
121
|
+
export interface SpectrumTimePickerProps<T extends TimeValue> extends AriaTimeFieldProps<T>, SpectrumLabelableProps, StyleProps {
|
|
122
|
+
/**
|
|
123
|
+
* Whether the time field should be displayed with a quiet style.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
80
126
|
isQuiet?: boolean
|
|
81
127
|
}
|