@atlaskit/datetime-picker 12.0.0 → 12.1.2
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/CHANGELOG.md +31 -0
- package/dist/cjs/components/{DatePicker.js → date-picker.js} +43 -27
- package/dist/cjs/components/{DateTimePicker.js → date-time-picker.js} +16 -10
- package/dist/cjs/components/{TimePicker.js → time-picker.js} +17 -9
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/internal/{FixedLayer.js → fixed-layer.js} +3 -1
- package/dist/cjs/internal/index.js +1 -0
- package/dist/cjs/internal/{parseTime.js → parse-time.js} +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/{DatePicker.js → date-picker.js} +33 -15
- package/dist/es2019/components/{DateTimePicker.js → date-time-picker.js} +16 -8
- package/dist/es2019/components/{TimePicker.js → time-picker.js} +18 -8
- package/dist/es2019/index.js +3 -3
- package/dist/es2019/internal/{FixedLayer.js → fixed-layer.js} +2 -1
- package/dist/es2019/internal/index.js +1 -0
- package/dist/es2019/internal/{parseTime.js → parse-time.js} +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/{DatePicker.js → date-picker.js} +44 -26
- package/dist/esm/components/{DateTimePicker.js → date-time-picker.js} +16 -8
- package/dist/esm/components/{TimePicker.js → time-picker.js} +17 -8
- package/dist/esm/index.js +3 -3
- package/dist/esm/internal/{FixedLayer.js → fixed-layer.js} +2 -1
- package/dist/esm/internal/index.js +1 -0
- package/dist/esm/internal/{parseTime.js → parse-time.js} +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/components/{DatePicker.d.ts → date-picker.d.ts} +99 -45
- package/dist/types/components/{DateTimePicker.d.ts → date-time-picker.d.ts} +67 -29
- package/dist/types/components/{TimePicker.d.ts → time-picker.d.ts} +76 -33
- package/dist/types/index.d.ts +6 -6
- package/dist/types/internal/{FixedLayer.d.ts → fixed-layer.d.ts} +7 -5
- package/dist/types/internal/{parseTime.d.ts → parse-time.d.ts} +0 -0
- package/extract-react-types/date-picker-props.tsx +2 -2
- package/extract-react-types/datetime-picker-props.tsx +2 -2
- package/extract-react-types/time-picker-props.tsx +2 -2
- package/package.json +7 -4
- package/report.api.md +636 -0
|
@@ -5,89 +5,139 @@ import { CalendarRef } from '@atlaskit/calendar';
|
|
|
5
5
|
import { LocalizationProvider } from '@atlaskit/locale';
|
|
6
6
|
import { ActionMeta, IndicatorComponentType, IndicatorProps, OptionType, ValueType } from '@atlaskit/select';
|
|
7
7
|
import { Appearance, SelectProps, Spacing } from '../types';
|
|
8
|
-
export interface
|
|
8
|
+
export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* Set the appearance of the picker.
|
|
11
|
+
*
|
|
12
|
+
* `subtle` will remove the borders, background, and icon.
|
|
13
|
+
*
|
|
14
|
+
*NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
15
15
|
*/
|
|
16
16
|
appearance?: Appearance;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Set the picker to autofocus on mount.
|
|
19
|
+
*/
|
|
18
20
|
autoFocus?: boolean;
|
|
19
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* The default for `isOpen`. Will be `false` if not provided.
|
|
23
|
+
*/
|
|
20
24
|
defaultIsOpen?: boolean;
|
|
21
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The default for `value`.
|
|
27
|
+
*/
|
|
22
28
|
defaultValue?: string;
|
|
23
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* An array of ISO dates that should be disabled on the calendar. This does not affect what users can type into the picker.
|
|
31
|
+
*/
|
|
24
32
|
disabled?: string[];
|
|
25
33
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
* A filter function for disabling dates on the calendar. This does not affect what users can type into the picker.
|
|
35
|
+
*
|
|
36
|
+
* The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
|
|
29
37
|
*/
|
|
30
38
|
disabledDateFilter?: (date: string) => boolean;
|
|
31
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
41
|
+
*/
|
|
32
42
|
maxDate?: string;
|
|
33
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The earliest enabled date. Dates before this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
45
|
+
*/
|
|
34
46
|
minDate?: string;
|
|
35
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* The icon shown in the picker.
|
|
49
|
+
*/
|
|
36
50
|
icon?: IndicatorComponentType<OptionType>;
|
|
37
51
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
* The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`.
|
|
53
|
+
*
|
|
54
|
+
* Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
41
55
|
*/
|
|
42
56
|
id?: string;
|
|
43
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Props to apply to the container.
|
|
59
|
+
*/
|
|
44
60
|
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
45
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Set if the picker is disabled.
|
|
63
|
+
*/
|
|
46
64
|
isDisabled?: boolean;
|
|
47
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Set if the picker is open.
|
|
67
|
+
*/
|
|
48
68
|
isOpen?: boolean;
|
|
49
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* The name of the field.
|
|
71
|
+
*/
|
|
50
72
|
name?: string;
|
|
51
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* The aria-label attribute associated with the next-month arrow.
|
|
75
|
+
*/
|
|
52
76
|
nextMonthLabel?: string;
|
|
53
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Called when the field is blurred.
|
|
79
|
+
*/
|
|
54
80
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
55
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Called when the value changes. The only argument is an ISO time or empty string.
|
|
83
|
+
*/
|
|
56
84
|
onChange?: (value: string) => void;
|
|
57
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Called when the field is focused.
|
|
87
|
+
*/
|
|
58
88
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
59
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* A function for parsing input characters and transforming them into a Date object. By default parses the date string based off the locale.
|
|
91
|
+
*/
|
|
60
92
|
parseInputValue?: (date: string, dateFormat: string) => Date;
|
|
61
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* A function for formatting the date displayed in the input. By default composes together [date-fn's parse method](https://date-fns.org/v1.29.0/docs/parse) and [date-fn's format method](https://date-fns.org/v1.29.0/docs/format) to return a correctly formatted date string.
|
|
95
|
+
*/
|
|
62
96
|
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
63
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* The aria-label attribute associated with the previous-month arrow.
|
|
99
|
+
*/
|
|
64
100
|
previousMonthLabel?: string;
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
101
|
+
/**
|
|
102
|
+
* Props to apply to the select. This can be used to set options such as placeholder text.
|
|
103
|
+
* See [the `Select` documentation for further information](/components/select).
|
|
104
|
+
*/
|
|
67
105
|
selectProps?: SelectProps;
|
|
68
106
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
107
|
+
* The spacing for the select control.
|
|
108
|
+
*
|
|
109
|
+
* Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
72
110
|
*/
|
|
73
111
|
spacing?: Spacing;
|
|
74
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* The ISO time used as the input value.
|
|
114
|
+
*/
|
|
75
115
|
value?: string;
|
|
76
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Set if the picker has an invalid value.
|
|
118
|
+
*/
|
|
77
119
|
isInvalid?: boolean;
|
|
78
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Hides icon for dropdown indicator.
|
|
122
|
+
*/
|
|
79
123
|
hideIcon?: boolean;
|
|
80
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Format the date with a string that is accepted by [date-fn's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
126
|
+
*/
|
|
81
127
|
dateFormat?: string;
|
|
82
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Placeholder text displayed in input
|
|
130
|
+
*/
|
|
83
131
|
placeholder?: string;
|
|
84
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Locale used to format the date and calendar. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
134
|
+
*/
|
|
85
135
|
locale?: string;
|
|
86
136
|
/**
|
|
87
137
|
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
88
138
|
* - `{testId}--container` wrapping element of date-picker
|
|
89
139
|
* - `{testId}--calendar--container` nested calendar component
|
|
90
|
-
|
|
140
|
+
*/
|
|
91
141
|
testId?: string;
|
|
92
142
|
/**
|
|
93
143
|
* Start day of the week for the calendar.
|
|
@@ -101,7 +151,7 @@ export interface Props extends WithAnalyticsEventsProps {
|
|
|
101
151
|
*/
|
|
102
152
|
weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
103
153
|
}
|
|
104
|
-
declare type DatePickerProps = typeof datePickerDefaultProps &
|
|
154
|
+
declare type DatePickerProps = typeof datePickerDefaultProps & DatePickerBaseProps;
|
|
105
155
|
interface State {
|
|
106
156
|
isOpen: boolean;
|
|
107
157
|
/**
|
|
@@ -109,9 +159,12 @@ interface State {
|
|
|
109
159
|
* This variable defines whether the default onSelectBlur or onSelectFocus
|
|
110
160
|
* events should behave as normal
|
|
111
161
|
*/
|
|
162
|
+
isFocused: boolean;
|
|
112
163
|
clearingFromIcon: boolean;
|
|
113
164
|
value: string;
|
|
114
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* Value to be shown in the calendar as selected.
|
|
167
|
+
*/
|
|
115
168
|
selectedValue: string;
|
|
116
169
|
view: string;
|
|
117
170
|
inputValue: string;
|
|
@@ -168,6 +221,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
168
221
|
inputValue: any;
|
|
169
222
|
isOpen: boolean;
|
|
170
223
|
value: string;
|
|
224
|
+
isFocused: boolean;
|
|
171
225
|
clearingFromIcon: boolean;
|
|
172
226
|
selectedValue: string;
|
|
173
227
|
view: string;
|
|
@@ -190,7 +244,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
190
244
|
refCalendar: (ref: CalendarRef | null) => void;
|
|
191
245
|
handleInputChange: (inputValue: string, actionMeta: {}) => void;
|
|
192
246
|
getContainerRef: (ref: HTMLElement | null) => void;
|
|
193
|
-
getSubtleControlStyles: (
|
|
247
|
+
getSubtleControlStyles: () => {
|
|
194
248
|
border: string;
|
|
195
249
|
backgroundColor: string;
|
|
196
250
|
padding: string;
|
|
@@ -3,63 +3,99 @@ import React from 'react';
|
|
|
3
3
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
4
4
|
import { SelectProps } from '@atlaskit/select';
|
|
5
5
|
import { Appearance, Spacing } from '../types';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export interface
|
|
6
|
+
import { DatePickerBaseProps as DatePickerProps } from './date-picker';
|
|
7
|
+
import { TimePickerBaseProps as TimePickerProps } from './time-picker';
|
|
8
|
+
export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
9
9
|
/**
|
|
10
10
|
* Set the appearance of the picker.
|
|
11
11
|
*
|
|
12
12
|
* `subtle` will remove the borders and background.
|
|
13
13
|
*/
|
|
14
14
|
appearance?: Appearance;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Set the picker to autofocus on mount.
|
|
17
|
+
*/
|
|
16
18
|
autoFocus?: boolean;
|
|
17
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The default for `value`.
|
|
21
|
+
*/
|
|
18
22
|
defaultValue?: string;
|
|
19
23
|
/**
|
|
20
24
|
* The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`.
|
|
21
25
|
* Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
22
26
|
*/
|
|
23
27
|
id?: string;
|
|
24
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Props to apply to the container. *
|
|
30
|
+
*/
|
|
25
31
|
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
26
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Set if the field is disabled.
|
|
34
|
+
*/
|
|
27
35
|
isDisabled?: boolean;
|
|
28
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The name of the field.
|
|
38
|
+
*/
|
|
29
39
|
name?: string;
|
|
30
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Called when the field is blurred.
|
|
42
|
+
*/
|
|
31
43
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
32
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Called when the value changes and the date / time is a complete value, or empty. The only value is an ISO string or empty string.
|
|
46
|
+
*/
|
|
33
47
|
onChange?: (value: string) => void;
|
|
34
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Called when the field is focused.
|
|
50
|
+
*/
|
|
35
51
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
36
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* The ISO time that should be used as the input value.
|
|
54
|
+
*/
|
|
37
55
|
value?: string;
|
|
38
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Set if users can edit the input, allowing them to add custom times.
|
|
58
|
+
*/
|
|
39
59
|
timeIsEditable?: boolean;
|
|
40
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Set if the picker has an invalid value.
|
|
62
|
+
*/
|
|
41
63
|
isInvalid?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Format the date with a string that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
66
|
+
*/
|
|
45
67
|
dateFormat?: string;
|
|
46
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Props applied to the `DatePicker`.
|
|
70
|
+
*/
|
|
47
71
|
datePickerProps?: DatePickerProps;
|
|
48
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Props applied to the `TimePicker`.
|
|
74
|
+
*/
|
|
49
75
|
timePickerProps?: TimePickerProps;
|
|
50
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Function used to parse datetime values into their date, time and timezone sub-values. *
|
|
78
|
+
*/
|
|
51
79
|
parseValue?: (dateTimeValue: string, date: string, time: string, timezone: string) => {
|
|
52
80
|
dateValue: string;
|
|
53
81
|
timeValue: string;
|
|
54
82
|
zoneValue: string;
|
|
55
83
|
};
|
|
56
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* [Select props](/components/select) to pass onto the `DatePicker` component's `Select`. This can be used to set options such as placeholder text.
|
|
86
|
+
*/
|
|
57
87
|
datePickerSelectProps?: SelectProps<any>;
|
|
58
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* [Select props](/components/select) to pass onto the `TimePicker` component's `Select`. This can be used to set options such as placeholder text.
|
|
90
|
+
*/
|
|
59
91
|
timePickerSelectProps?: SelectProps<any>;
|
|
60
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* The times shown by the `TimePicker`.
|
|
94
|
+
*/
|
|
61
95
|
times?: Array<string>;
|
|
62
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* The format that times are displayed in. Values should be those accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
98
|
+
*/
|
|
63
99
|
timeFormat?: string;
|
|
64
100
|
/**
|
|
65
101
|
* The spacing for the select control.
|
|
@@ -67,16 +103,18 @@ export interface Props extends WithAnalyticsEventsProps {
|
|
|
67
103
|
* Compact is `gridSize() * 4`, default is `gridSize() * 5`.
|
|
68
104
|
*/
|
|
69
105
|
spacing?: Spacing;
|
|
70
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Locale used for formatting dates and times. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
108
|
+
*/
|
|
71
109
|
locale?: string;
|
|
72
110
|
/**
|
|
73
111
|
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
74
112
|
* - `{testId}--datepicker--container` wrapping element of date-picker
|
|
75
113
|
* - `{testId}--timepicker--container` wrapping element of time-picker
|
|
76
|
-
|
|
114
|
+
*/
|
|
77
115
|
testId?: string;
|
|
78
116
|
}
|
|
79
|
-
declare type DateTimePickerProps = typeof dateTimePickerDefaultProps &
|
|
117
|
+
declare type DateTimePickerProps = typeof dateTimePickerDefaultProps & DateTimePickerBaseProps;
|
|
80
118
|
interface State {
|
|
81
119
|
active: 0 | 1 | 2;
|
|
82
120
|
dateValue: string;
|
|
@@ -155,7 +193,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
|
|
|
155
193
|
render(): JSX.Element;
|
|
156
194
|
}
|
|
157
195
|
export { DateTimePicker as DateTimePickerWithoutAnalytics };
|
|
158
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "
|
|
196
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "times" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
|
|
159
197
|
appearance: string;
|
|
160
198
|
autoFocus: boolean;
|
|
161
199
|
isDisabled: boolean;
|
|
@@ -175,5 +213,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimeP
|
|
|
175
213
|
times: string[];
|
|
176
214
|
spacing: string;
|
|
177
215
|
locale: string;
|
|
178
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "
|
|
216
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "value" | "dateFormat" | "key" | "analyticsContext" | "times" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps" | "parseValue"> & React.RefAttributes<any>>;
|
|
179
217
|
export default _default;
|
|
@@ -7,71 +7,112 @@ interface Option {
|
|
|
7
7
|
label: string;
|
|
8
8
|
value: string;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface TimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
**NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
12
|
+
* Set the appearance of the picker.
|
|
13
|
+
* `subtle` will remove the borders, background, and icon.
|
|
14
|
+
*
|
|
15
|
+
* __NOTE:__ Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
17
16
|
*/
|
|
18
17
|
appearance?: Appearance;
|
|
19
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Set the picker to autofocus on mount.
|
|
20
|
+
*/
|
|
20
21
|
autoFocus?: boolean;
|
|
21
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The default for `isOpen`.
|
|
24
|
+
*/
|
|
22
25
|
defaultIsOpen?: boolean;
|
|
23
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The default for `value`.
|
|
28
|
+
*/
|
|
24
29
|
defaultValue?: string;
|
|
25
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* A function for formatting the displayed time value in the input. By default parses with an internal time parser, and formats using the [date-fns format function]((https://date-fns.org/v1.29.0/docs/format))
|
|
32
|
+
*/
|
|
26
33
|
formatDisplayLabel?: (time: string, timeFormat: string) => string;
|
|
27
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`. Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
36
|
+
*/
|
|
28
37
|
id?: string;
|
|
29
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Props to apply to the container. *
|
|
40
|
+
*/
|
|
30
41
|
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
31
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Set if the field is disabled.
|
|
44
|
+
*/
|
|
32
45
|
isDisabled?: boolean;
|
|
33
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Set if the dropdown is open. Will be `false` if not provided.
|
|
48
|
+
*/
|
|
34
49
|
isOpen?: boolean;
|
|
35
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The name of the field.
|
|
52
|
+
*/
|
|
36
53
|
name?: string;
|
|
37
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Called when the field is blurred.
|
|
56
|
+
*/
|
|
38
57
|
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
39
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Called when the value changes. The only argument is an ISO time or empty string.
|
|
60
|
+
*/
|
|
40
61
|
onChange?: (value: string) => void;
|
|
41
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Called when the field is focused.
|
|
64
|
+
*/
|
|
42
65
|
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
43
66
|
parseInputValue?: (time: string, timeFormat: string) => string | Date;
|
|
44
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Props to apply to the select.
|
|
69
|
+
*/
|
|
45
70
|
selectProps?: SelectProps<any>;
|
|
46
71
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
72
|
+
* The spacing for the select control.
|
|
73
|
+
*
|
|
74
|
+
* Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
50
75
|
*/
|
|
51
76
|
spacing?: Spacing;
|
|
52
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The times shown in the dropdown.
|
|
79
|
+
*/
|
|
53
80
|
times?: string[];
|
|
54
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Set if users can edit the input, allowing them to add custom times.
|
|
83
|
+
*/
|
|
55
84
|
timeIsEditable?: boolean;
|
|
56
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* The ISO time that should be used as the input value.
|
|
87
|
+
*/
|
|
57
88
|
value?: string;
|
|
58
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Set if the picker has an invalid value.
|
|
91
|
+
*/
|
|
59
92
|
isInvalid?: boolean;
|
|
60
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Hides icon for dropdown indicator.
|
|
95
|
+
*/
|
|
61
96
|
hideIcon?: boolean;
|
|
62
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Time format that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
99
|
+
*/
|
|
63
100
|
timeFormat?: string;
|
|
64
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Placeholder text displayed in input.
|
|
103
|
+
*/
|
|
65
104
|
placeholder?: string;
|
|
66
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Locale used to format the time. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
107
|
+
*/
|
|
67
108
|
locale?: string;
|
|
68
109
|
/**
|
|
69
110
|
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests:
|
|
70
111
|
* - `{testId}--container` wrapping element of time-picker
|
|
71
|
-
|
|
112
|
+
*/
|
|
72
113
|
testId?: string;
|
|
73
114
|
}
|
|
74
|
-
declare type TimePickerProps = typeof timePickerDefaultProps &
|
|
115
|
+
declare type TimePickerProps = typeof timePickerDefaultProps & TimePickerBaseProps;
|
|
75
116
|
interface State {
|
|
76
117
|
isOpen: boolean;
|
|
77
118
|
/**
|
|
@@ -141,7 +182,9 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
|
|
|
141
182
|
onChange: (v: {
|
|
142
183
|
value: string;
|
|
143
184
|
} | null, action?: ActionMeta<OptionType> | undefined) => void;
|
|
144
|
-
/**
|
|
185
|
+
/**
|
|
186
|
+
* Only allow custom times if timeIsEditable prop is true
|
|
187
|
+
*/
|
|
145
188
|
onCreateOption: (inputValue: any) => void;
|
|
146
189
|
onMenuOpen: () => void;
|
|
147
190
|
onMenuClose: () => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { default as DatePicker } from './components/
|
|
2
|
-
export type {
|
|
3
|
-
export { default as TimePicker } from './components/
|
|
4
|
-
export type {
|
|
5
|
-
export { default as DateTimePicker } from './components/
|
|
6
|
-
export type {
|
|
1
|
+
export { default as DatePicker } from './components/date-picker';
|
|
2
|
+
export type { DatePickerBaseProps as DatePickerProps } from './components/date-picker';
|
|
3
|
+
export { default as TimePicker } from './components/time-picker';
|
|
4
|
+
export type { TimePickerBaseProps as TimePickerProps } from './components/time-picker';
|
|
5
|
+
export { default as DateTimePicker } from './components/date-time-picker';
|
|
6
|
+
export type { DateTimePickerBaseProps as DateTimePickerProps } from './components/date-time-picker';
|
|
7
7
|
export type { Appearance, Spacing } from './types';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface
|
|
3
|
-
/**
|
|
2
|
+
interface FixedLayerProps {
|
|
3
|
+
/**
|
|
4
|
+
* A ref to the container that the content should be layered around for height calculation
|
|
4
5
|
* purposes. This must be an ancestor element as component does not attach the layered content around
|
|
5
|
-
* the ref itself.
|
|
6
|
+
* the ref itself.
|
|
7
|
+
*/
|
|
6
8
|
containerRef: HTMLElement | null;
|
|
7
9
|
/**
|
|
8
10
|
* The content to render in the layer.
|
|
@@ -15,7 +17,7 @@ interface Props {
|
|
|
15
17
|
/**
|
|
16
18
|
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
17
19
|
* - `{testId}--popper-container` wrapping element of time-picker
|
|
18
|
-
|
|
20
|
+
*/
|
|
19
21
|
testId?: string;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
@@ -23,7 +25,7 @@ interface Props {
|
|
|
23
25
|
* Scroll is locked outside the layer to prevent the layered content from detaching from the
|
|
24
26
|
* container ref.
|
|
25
27
|
*/
|
|
26
|
-
export default class FixedLayer extends React.Component<
|
|
28
|
+
export default class FixedLayer extends React.Component<FixedLayerProps> {
|
|
27
29
|
update: () => void;
|
|
28
30
|
componentDidUpdate(prevProps: any): void;
|
|
29
31
|
render(): JSX.Element;
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DatePickerBaseProps } from '../src/components/date-picker';
|
|
2
2
|
|
|
3
|
-
export default function DatePickerProps(props:
|
|
3
|
+
export default function DatePickerProps(props: DatePickerBaseProps) {
|
|
4
4
|
return null;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DateTimePickerBaseProps } from '../src/components/date-time-picker';
|
|
2
2
|
|
|
3
|
-
export default function DateTimePickerProps(props:
|
|
3
|
+
export default function DateTimePickerProps(props: DateTimePickerBaseProps) {
|
|
4
4
|
return null;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TimePickerBaseProps } from '../src/components/time-picker';
|
|
2
2
|
|
|
3
|
-
export default function TimePickerProps(props:
|
|
3
|
+
export default function TimePickerProps(props: TimePickerBaseProps) {
|
|
4
4
|
return null;
|
|
5
5
|
}
|