@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.2",
|
|
4
4
|
"description": "A date time picker allows the user to select an associated date and time.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"atlaskit:src": "src/index.
|
|
16
|
+
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"deprecatedAutoEntryPoints": true,
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
28
|
-
"@atlaskit/calendar": "^12.
|
|
28
|
+
"@atlaskit/calendar": "^12.3.0",
|
|
29
|
+
"@atlaskit/ds-lib": "^2.1.0",
|
|
29
30
|
"@atlaskit/icon": "^21.10.0",
|
|
30
31
|
"@atlaskit/locale": "^2.1.0",
|
|
31
32
|
"@atlaskit/popper": "^5.2.0",
|
|
32
|
-
"@atlaskit/select": "^15.
|
|
33
|
+
"@atlaskit/select": "^15.5.0",
|
|
33
34
|
"@atlaskit/theme": "^12.1.0",
|
|
34
35
|
"@atlaskit/tokens": "^0.10.0",
|
|
35
36
|
"@babel/runtime": "^7.0.0",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
"@atlaskit/field-base": "^15.0.5",
|
|
48
49
|
"@atlaskit/form": "^8.5.0",
|
|
49
50
|
"@atlaskit/modal-dialog": "^12.2.0",
|
|
51
|
+
"@atlaskit/popup": "^1.4.0",
|
|
50
52
|
"@atlaskit/range": "^6.0.0",
|
|
51
53
|
"@atlaskit/section-message": "^6.0.0",
|
|
52
54
|
"@atlaskit/ssr": "*",
|
|
@@ -71,6 +73,7 @@
|
|
|
71
73
|
},
|
|
72
74
|
"@repo/internal": {
|
|
73
75
|
"dom-events": "use-bind-event-listener",
|
|
76
|
+
"design-system": "v1",
|
|
74
77
|
"styling": [
|
|
75
78
|
"static",
|
|
76
79
|
"emotion"
|
package/report.api.md
ADDED
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/datetime-picker"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { ComponentType } from 'react';
|
|
7
|
+
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
8
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
9
|
+
import { IndicatorComponentType } from '@atlaskit/select';
|
|
10
|
+
import { IndicatorProps } from '@atlaskit/select';
|
|
11
|
+
import { OptionType } from '@atlaskit/select';
|
|
12
|
+
import { default as React_2 } from 'react';
|
|
13
|
+
import { RefAttributes } from 'react';
|
|
14
|
+
import { SelectProps as SelectProps_2 } from '@atlaskit/select';
|
|
15
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
16
|
+
import { WithContextProps } from '@atlaskit/analytics-next';
|
|
17
|
+
|
|
18
|
+
export declare type Appearance = 'default' | 'subtle';
|
|
19
|
+
|
|
20
|
+
export declare const DatePicker: ForwardRefExoticComponent<
|
|
21
|
+
Pick<
|
|
22
|
+
Pick<
|
|
23
|
+
Omit<DatePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
24
|
+
| 'testId'
|
|
25
|
+
| 'maxDate'
|
|
26
|
+
| 'minDate'
|
|
27
|
+
| 'isOpen'
|
|
28
|
+
| 'nextMonthLabel'
|
|
29
|
+
| 'parseInputValue'
|
|
30
|
+
| 'formatDisplayLabel'
|
|
31
|
+
| 'previousMonthLabel'
|
|
32
|
+
| 'value'
|
|
33
|
+
| 'dateFormat'
|
|
34
|
+
| 'placeholder'
|
|
35
|
+
| 'weekStartDay'
|
|
36
|
+
> &
|
|
37
|
+
Partial<
|
|
38
|
+
Pick<
|
|
39
|
+
Omit<DatePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
40
|
+
| 'icon'
|
|
41
|
+
| 'disabled'
|
|
42
|
+
| 'appearance'
|
|
43
|
+
| 'selectProps'
|
|
44
|
+
| 'innerProps'
|
|
45
|
+
| 'autoFocus'
|
|
46
|
+
| 'defaultIsOpen'
|
|
47
|
+
| 'defaultValue'
|
|
48
|
+
| 'disabledDateFilter'
|
|
49
|
+
| 'hideIcon'
|
|
50
|
+
| 'id'
|
|
51
|
+
| 'isDisabled'
|
|
52
|
+
| 'isInvalid'
|
|
53
|
+
| 'name'
|
|
54
|
+
| 'onBlur'
|
|
55
|
+
| 'onChange'
|
|
56
|
+
| 'onFocus'
|
|
57
|
+
| 'spacing'
|
|
58
|
+
| 'locale'
|
|
59
|
+
>
|
|
60
|
+
> &
|
|
61
|
+
Partial<
|
|
62
|
+
Pick<
|
|
63
|
+
{
|
|
64
|
+
appearance: Appearance;
|
|
65
|
+
autoFocus: boolean;
|
|
66
|
+
defaultIsOpen: boolean;
|
|
67
|
+
defaultValue: string;
|
|
68
|
+
disabled: string[];
|
|
69
|
+
disabledDateFilter: (_: string) => boolean;
|
|
70
|
+
hideIcon: boolean;
|
|
71
|
+
icon: ComponentType<IndicatorProps<OptionType, false>>;
|
|
72
|
+
id: string;
|
|
73
|
+
innerProps: {};
|
|
74
|
+
isDisabled: boolean;
|
|
75
|
+
isInvalid: boolean;
|
|
76
|
+
name: string;
|
|
77
|
+
onBlur: (event: FocusEvent_2<HTMLInputElement>) => void;
|
|
78
|
+
onChange: (value: string) => void;
|
|
79
|
+
onFocus: (event: FocusEvent_2<HTMLInputElement>) => void;
|
|
80
|
+
selectProps: {};
|
|
81
|
+
spacing: Spacing;
|
|
82
|
+
locale: string;
|
|
83
|
+
},
|
|
84
|
+
never
|
|
85
|
+
>
|
|
86
|
+
> &
|
|
87
|
+
RefAttributes<any> &
|
|
88
|
+
WithContextProps,
|
|
89
|
+
| 'testId'
|
|
90
|
+
| 'icon'
|
|
91
|
+
| 'disabled'
|
|
92
|
+
| 'appearance'
|
|
93
|
+
| 'selectProps'
|
|
94
|
+
| 'innerProps'
|
|
95
|
+
| 'autoFocus'
|
|
96
|
+
| 'defaultIsOpen'
|
|
97
|
+
| 'defaultValue'
|
|
98
|
+
| 'disabledDateFilter'
|
|
99
|
+
| 'hideIcon'
|
|
100
|
+
| 'id'
|
|
101
|
+
| 'isDisabled'
|
|
102
|
+
| 'isInvalid'
|
|
103
|
+
| 'name'
|
|
104
|
+
| 'onBlur'
|
|
105
|
+
| 'onChange'
|
|
106
|
+
| 'onFocus'
|
|
107
|
+
| 'spacing'
|
|
108
|
+
| 'locale'
|
|
109
|
+
| 'maxDate'
|
|
110
|
+
| 'minDate'
|
|
111
|
+
| 'isOpen'
|
|
112
|
+
| 'nextMonthLabel'
|
|
113
|
+
| 'parseInputValue'
|
|
114
|
+
| 'formatDisplayLabel'
|
|
115
|
+
| 'previousMonthLabel'
|
|
116
|
+
| 'value'
|
|
117
|
+
| 'dateFormat'
|
|
118
|
+
| 'placeholder'
|
|
119
|
+
| 'weekStartDay'
|
|
120
|
+
| 'key'
|
|
121
|
+
| 'analyticsContext'
|
|
122
|
+
> &
|
|
123
|
+
RefAttributes<any>
|
|
124
|
+
>;
|
|
125
|
+
|
|
126
|
+
declare const datePickerDefaultProps: {
|
|
127
|
+
appearance: Appearance;
|
|
128
|
+
autoFocus: boolean;
|
|
129
|
+
defaultIsOpen: boolean;
|
|
130
|
+
defaultValue: string;
|
|
131
|
+
disabled: string[];
|
|
132
|
+
disabledDateFilter: (_: string) => boolean;
|
|
133
|
+
hideIcon: boolean;
|
|
134
|
+
icon: ComponentType<IndicatorProps<OptionType, false>>;
|
|
135
|
+
id: string;
|
|
136
|
+
innerProps: {};
|
|
137
|
+
isDisabled: boolean;
|
|
138
|
+
isInvalid: boolean;
|
|
139
|
+
name: string;
|
|
140
|
+
onBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
141
|
+
onChange: (value: string) => void;
|
|
142
|
+
onFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
143
|
+
selectProps: {};
|
|
144
|
+
spacing: Spacing;
|
|
145
|
+
locale: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export declare interface DatePickerProps extends WithAnalyticsEventsProps {
|
|
149
|
+
/**
|
|
150
|
+
Set the appearance of the picker.
|
|
151
|
+
|
|
152
|
+
`subtle` will remove the borders, background, and icon.
|
|
153
|
+
|
|
154
|
+
**NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
155
|
+
*/
|
|
156
|
+
appearance?: Appearance;
|
|
157
|
+
/** Set the picker to autofocus on mount. */
|
|
158
|
+
autoFocus?: boolean;
|
|
159
|
+
/** The default for `isOpen`. Will be `false` if not provided. */
|
|
160
|
+
defaultIsOpen?: boolean;
|
|
161
|
+
/** The default for `value`. */
|
|
162
|
+
defaultValue?: string;
|
|
163
|
+
/** An array of ISO dates that should be disabled on the calendar. This does not affect what users can type into the picker. */
|
|
164
|
+
disabled?: string[];
|
|
165
|
+
/**
|
|
166
|
+
A filter function for disabling dates on the calendar. This does not affect what users can type into the picker.
|
|
167
|
+
|
|
168
|
+
The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
|
|
169
|
+
*/
|
|
170
|
+
disabledDateFilter?: (date: string) => boolean;
|
|
171
|
+
/** The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker. */
|
|
172
|
+
maxDate?: string;
|
|
173
|
+
/** The earliest enabled date. Dates before this are disabled on the calendar. This does not affect what users can type into the picker. */
|
|
174
|
+
minDate?: string;
|
|
175
|
+
/** The icon shown in the picker. */
|
|
176
|
+
icon?: IndicatorComponentType<OptionType>;
|
|
177
|
+
/**
|
|
178
|
+
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`.
|
|
179
|
+
|
|
180
|
+
Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
181
|
+
*/
|
|
182
|
+
id?: string;
|
|
183
|
+
/** Props to apply to the container. **/
|
|
184
|
+
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
185
|
+
/** Set if the picker is disabled. */
|
|
186
|
+
isDisabled?: boolean;
|
|
187
|
+
/** Set if the picker is open. */
|
|
188
|
+
isOpen?: boolean;
|
|
189
|
+
/** The name of the field. */
|
|
190
|
+
name?: string;
|
|
191
|
+
/** The aria-label attribute associated with the next-month arrow. */
|
|
192
|
+
nextMonthLabel?: string;
|
|
193
|
+
/** Called when the field is blurred. */
|
|
194
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
195
|
+
/** Called when the value changes. The only argument is an ISO time or empty string. */
|
|
196
|
+
onChange?: (value: string) => void;
|
|
197
|
+
/** Called when the field is focused. */
|
|
198
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
199
|
+
/** A function for parsing input characters and transforming them into a Date object. By default parses the date string based off the locale. */
|
|
200
|
+
parseInputValue?: (date: string, dateFormat: string) => Date;
|
|
201
|
+
/** 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. */
|
|
202
|
+
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
203
|
+
/** The aria-label attribute associated with the previous-month arrow. */
|
|
204
|
+
previousMonthLabel?: string;
|
|
205
|
+
/** Props to apply to the select. This can be used to set options such as placeholder text.
|
|
206
|
+
* See [the `Select` documentation for further information](/components/select). */
|
|
207
|
+
selectProps?: SelectProps;
|
|
208
|
+
/**
|
|
209
|
+
The spacing for the select control.
|
|
210
|
+
|
|
211
|
+
Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
212
|
+
*/
|
|
213
|
+
spacing?: Spacing;
|
|
214
|
+
/** The ISO time used as the input value. */
|
|
215
|
+
value?: string;
|
|
216
|
+
/** Set if the picker has an invalid value. */
|
|
217
|
+
isInvalid?: boolean;
|
|
218
|
+
/** Hides icon for dropdown indicator. */
|
|
219
|
+
hideIcon?: boolean;
|
|
220
|
+
/** Format the date with a string that is accepted by [date-fn's format function](https://date-fns.org/v1.29.0/docs/format). */
|
|
221
|
+
dateFormat?: string;
|
|
222
|
+
/** Placeholder text displayed in input */
|
|
223
|
+
placeholder?: string;
|
|
224
|
+
/** Locale used to format the date and calendar. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat). */
|
|
225
|
+
locale?: string;
|
|
226
|
+
/**
|
|
227
|
+
* 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
|
|
228
|
+
* - `{testId}--container` wrapping element of date-picker
|
|
229
|
+
* - `{testId}--calendar--container` nested calendar component
|
|
230
|
+
**/
|
|
231
|
+
testId?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Start day of the week for the calendar.
|
|
234
|
+
* - `0` sunday (default value)
|
|
235
|
+
* - `1` monday
|
|
236
|
+
* - `2` tuesday
|
|
237
|
+
* - `3` wednesday
|
|
238
|
+
* - `4` thursday
|
|
239
|
+
* - `5` friday
|
|
240
|
+
* - `6` saturday
|
|
241
|
+
*/
|
|
242
|
+
weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
declare type DatePickerProps_2 = typeof datePickerDefaultProps &
|
|
246
|
+
DatePickerProps;
|
|
247
|
+
|
|
248
|
+
export declare const DateTimePicker: React_2.ForwardRefExoticComponent<
|
|
249
|
+
Pick<
|
|
250
|
+
Pick<
|
|
251
|
+
Omit<DateTimePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
252
|
+
| 'testId'
|
|
253
|
+
| 'hideIcon'
|
|
254
|
+
| 'value'
|
|
255
|
+
| 'dateFormat'
|
|
256
|
+
| 'timeFormat'
|
|
257
|
+
| 'parseValue'
|
|
258
|
+
> &
|
|
259
|
+
Partial<
|
|
260
|
+
Pick<
|
|
261
|
+
Omit<DateTimePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
262
|
+
| 'appearance'
|
|
263
|
+
| 'innerProps'
|
|
264
|
+
| 'autoFocus'
|
|
265
|
+
| 'defaultValue'
|
|
266
|
+
| 'id'
|
|
267
|
+
| 'isDisabled'
|
|
268
|
+
| 'isInvalid'
|
|
269
|
+
| 'name'
|
|
270
|
+
| 'onBlur'
|
|
271
|
+
| 'onChange'
|
|
272
|
+
| 'onFocus'
|
|
273
|
+
| 'spacing'
|
|
274
|
+
| 'locale'
|
|
275
|
+
| 'times'
|
|
276
|
+
| 'timeIsEditable'
|
|
277
|
+
| 'datePickerProps'
|
|
278
|
+
| 'timePickerProps'
|
|
279
|
+
| 'datePickerSelectProps'
|
|
280
|
+
| 'timePickerSelectProps'
|
|
281
|
+
>
|
|
282
|
+
> &
|
|
283
|
+
Partial<
|
|
284
|
+
Pick<
|
|
285
|
+
{
|
|
286
|
+
appearance: string;
|
|
287
|
+
autoFocus: boolean;
|
|
288
|
+
isDisabled: boolean;
|
|
289
|
+
name: string;
|
|
290
|
+
onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
|
|
291
|
+
onChange: (value: string) => void;
|
|
292
|
+
onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
|
|
293
|
+
innerProps: {};
|
|
294
|
+
id: string;
|
|
295
|
+
defaultValue: string;
|
|
296
|
+
timeIsEditable: boolean;
|
|
297
|
+
isInvalid: boolean;
|
|
298
|
+
datePickerProps: {};
|
|
299
|
+
timePickerProps: {};
|
|
300
|
+
datePickerSelectProps: {};
|
|
301
|
+
timePickerSelectProps: {};
|
|
302
|
+
times: string[];
|
|
303
|
+
spacing: string;
|
|
304
|
+
locale: string;
|
|
305
|
+
},
|
|
306
|
+
never
|
|
307
|
+
>
|
|
308
|
+
> &
|
|
309
|
+
React_2.RefAttributes<any> &
|
|
310
|
+
WithContextProps,
|
|
311
|
+
| 'testId'
|
|
312
|
+
| 'appearance'
|
|
313
|
+
| 'innerProps'
|
|
314
|
+
| 'autoFocus'
|
|
315
|
+
| 'defaultValue'
|
|
316
|
+
| 'hideIcon'
|
|
317
|
+
| 'id'
|
|
318
|
+
| 'isDisabled'
|
|
319
|
+
| 'isInvalid'
|
|
320
|
+
| 'name'
|
|
321
|
+
| 'onBlur'
|
|
322
|
+
| 'onChange'
|
|
323
|
+
| 'onFocus'
|
|
324
|
+
| 'spacing'
|
|
325
|
+
| 'locale'
|
|
326
|
+
| 'value'
|
|
327
|
+
| 'dateFormat'
|
|
328
|
+
| 'key'
|
|
329
|
+
| 'analyticsContext'
|
|
330
|
+
| 'times'
|
|
331
|
+
| 'timeIsEditable'
|
|
332
|
+
| 'timeFormat'
|
|
333
|
+
| 'datePickerProps'
|
|
334
|
+
| 'timePickerProps'
|
|
335
|
+
| 'datePickerSelectProps'
|
|
336
|
+
| 'timePickerSelectProps'
|
|
337
|
+
| 'parseValue'
|
|
338
|
+
> &
|
|
339
|
+
React_2.RefAttributes<any>
|
|
340
|
+
>;
|
|
341
|
+
|
|
342
|
+
declare const dateTimePickerDefaultProps: {
|
|
343
|
+
appearance: string;
|
|
344
|
+
autoFocus: boolean;
|
|
345
|
+
isDisabled: boolean;
|
|
346
|
+
name: string;
|
|
347
|
+
onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
|
|
348
|
+
onChange: (value: string) => void;
|
|
349
|
+
onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
|
|
350
|
+
innerProps: {};
|
|
351
|
+
id: string;
|
|
352
|
+
defaultValue: string;
|
|
353
|
+
timeIsEditable: boolean;
|
|
354
|
+
isInvalid: boolean;
|
|
355
|
+
datePickerProps: {};
|
|
356
|
+
timePickerProps: {};
|
|
357
|
+
datePickerSelectProps: {};
|
|
358
|
+
timePickerSelectProps: {};
|
|
359
|
+
times: string[];
|
|
360
|
+
spacing: string;
|
|
361
|
+
locale: string;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
export declare interface DateTimePickerProps extends WithAnalyticsEventsProps {
|
|
365
|
+
/**
|
|
366
|
+
* Set the appearance of the picker.
|
|
367
|
+
*
|
|
368
|
+
* `subtle` will remove the borders and background.
|
|
369
|
+
*/
|
|
370
|
+
appearance?: Appearance;
|
|
371
|
+
/** Set the picker to autofocus on mount. */
|
|
372
|
+
autoFocus?: boolean;
|
|
373
|
+
/** The default for `value`. */
|
|
374
|
+
defaultValue?: string;
|
|
375
|
+
/**
|
|
376
|
+
* 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`.
|
|
377
|
+
* Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
378
|
+
*/
|
|
379
|
+
id?: string;
|
|
380
|
+
/** Props to apply to the container. **/
|
|
381
|
+
innerProps?: React_2.AllHTMLAttributes<HTMLElement>;
|
|
382
|
+
/** Set if the field is disabled. */
|
|
383
|
+
isDisabled?: boolean;
|
|
384
|
+
/** The name of the field. */
|
|
385
|
+
name?: string;
|
|
386
|
+
/** Called when the field is blurred. */
|
|
387
|
+
onBlur?: React_2.FocusEventHandler<HTMLInputElement>;
|
|
388
|
+
/** 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. */
|
|
389
|
+
onChange?: (value: string) => void;
|
|
390
|
+
/** Called when the field is focused. */
|
|
391
|
+
onFocus?: React_2.FocusEventHandler<HTMLInputElement>;
|
|
392
|
+
/** The ISO time that should be used as the input value. */
|
|
393
|
+
value?: string;
|
|
394
|
+
/** Set if users can edit the input, allowing them to add custom times. */
|
|
395
|
+
timeIsEditable?: boolean;
|
|
396
|
+
/** Set if the picker has an invalid value. */
|
|
397
|
+
isInvalid?: boolean;
|
|
398
|
+
/** DEPRECATED - This is here only for backwards compatibility and doesn't do anything. It will be removed in the next MAJOR. */
|
|
399
|
+
hideIcon?: boolean;
|
|
400
|
+
/** Format the date with a string that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format). */
|
|
401
|
+
dateFormat?: string;
|
|
402
|
+
/** Props applied to the `DatePicker`. */
|
|
403
|
+
datePickerProps?: DatePickerProps;
|
|
404
|
+
/** Props applied to the `TimePicker`. */
|
|
405
|
+
timePickerProps?: TimePickerProps;
|
|
406
|
+
/** Function used to parse datetime values into their date, time and timezone sub-values. **/
|
|
407
|
+
parseValue?: (
|
|
408
|
+
dateTimeValue: string,
|
|
409
|
+
date: string,
|
|
410
|
+
time: string,
|
|
411
|
+
timezone: string,
|
|
412
|
+
) => {
|
|
413
|
+
dateValue: string;
|
|
414
|
+
timeValue: string;
|
|
415
|
+
zoneValue: string;
|
|
416
|
+
};
|
|
417
|
+
/** [Select props](/components/select) to pass onto the `DatePicker` component's `Select`. This can be used to set options such as placeholder text. */
|
|
418
|
+
datePickerSelectProps?: SelectProps_2<any>;
|
|
419
|
+
/** [Select props](/components/select) to pass onto the `TimePicker` component's `Select`. This can be used to set options such as placeholder text. */
|
|
420
|
+
timePickerSelectProps?: SelectProps_2<any>;
|
|
421
|
+
/** The times shown by the `TimePicker`. */
|
|
422
|
+
times?: Array<string>;
|
|
423
|
+
/** 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). */
|
|
424
|
+
timeFormat?: string;
|
|
425
|
+
/**
|
|
426
|
+
* The spacing for the select control.
|
|
427
|
+
*
|
|
428
|
+
* Compact is `gridSize() * 4`, default is `gridSize() * 5`.
|
|
429
|
+
*/
|
|
430
|
+
spacing?: Spacing;
|
|
431
|
+
/** Locale used for formatting dates and times. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat). */
|
|
432
|
+
locale?: string;
|
|
433
|
+
/**
|
|
434
|
+
* 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
|
|
435
|
+
* - `{testId}--datepicker--container` wrapping element of date-picker
|
|
436
|
+
* - `{testId}--timepicker--container` wrapping element of time-picker
|
|
437
|
+
**/
|
|
438
|
+
testId?: string;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
declare type DateTimePickerProps_2 = typeof dateTimePickerDefaultProps &
|
|
442
|
+
DateTimePickerProps;
|
|
443
|
+
|
|
444
|
+
declare type SelectProps = any;
|
|
445
|
+
|
|
446
|
+
export declare type Spacing = 'compact' | 'default';
|
|
447
|
+
|
|
448
|
+
export declare const TimePicker: React_2.ForwardRefExoticComponent<
|
|
449
|
+
Pick<
|
|
450
|
+
Pick<
|
|
451
|
+
Omit<TimePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
452
|
+
| 'testId'
|
|
453
|
+
| 'isOpen'
|
|
454
|
+
| 'formatDisplayLabel'
|
|
455
|
+
| 'value'
|
|
456
|
+
| 'placeholder'
|
|
457
|
+
| 'timeFormat'
|
|
458
|
+
> &
|
|
459
|
+
Partial<
|
|
460
|
+
Pick<
|
|
461
|
+
Omit<TimePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
462
|
+
| 'appearance'
|
|
463
|
+
| 'selectProps'
|
|
464
|
+
| 'innerProps'
|
|
465
|
+
| 'autoFocus'
|
|
466
|
+
| 'defaultIsOpen'
|
|
467
|
+
| 'defaultValue'
|
|
468
|
+
| 'hideIcon'
|
|
469
|
+
| 'id'
|
|
470
|
+
| 'isDisabled'
|
|
471
|
+
| 'isInvalid'
|
|
472
|
+
| 'name'
|
|
473
|
+
| 'onBlur'
|
|
474
|
+
| 'onChange'
|
|
475
|
+
| 'onFocus'
|
|
476
|
+
| 'spacing'
|
|
477
|
+
| 'locale'
|
|
478
|
+
| 'parseInputValue'
|
|
479
|
+
| 'times'
|
|
480
|
+
| 'timeIsEditable'
|
|
481
|
+
>
|
|
482
|
+
> &
|
|
483
|
+
Partial<
|
|
484
|
+
Pick<
|
|
485
|
+
{
|
|
486
|
+
appearance: Appearance;
|
|
487
|
+
autoFocus: boolean;
|
|
488
|
+
defaultIsOpen: boolean;
|
|
489
|
+
defaultValue: string;
|
|
490
|
+
hideIcon: boolean;
|
|
491
|
+
id: string;
|
|
492
|
+
innerProps: {};
|
|
493
|
+
isDisabled: boolean;
|
|
494
|
+
isInvalid: boolean;
|
|
495
|
+
name: string;
|
|
496
|
+
onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
|
|
497
|
+
onChange: (value: string) => void;
|
|
498
|
+
onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
|
|
499
|
+
parseInputValue: (
|
|
500
|
+
time: string,
|
|
501
|
+
timeFormat: string,
|
|
502
|
+
) => string | Date;
|
|
503
|
+
selectProps: {};
|
|
504
|
+
spacing: Spacing;
|
|
505
|
+
times: string[];
|
|
506
|
+
timeIsEditable: boolean;
|
|
507
|
+
locale: string;
|
|
508
|
+
},
|
|
509
|
+
never
|
|
510
|
+
>
|
|
511
|
+
> &
|
|
512
|
+
React_2.RefAttributes<any> &
|
|
513
|
+
WithContextProps,
|
|
514
|
+
| 'testId'
|
|
515
|
+
| 'appearance'
|
|
516
|
+
| 'selectProps'
|
|
517
|
+
| 'innerProps'
|
|
518
|
+
| 'autoFocus'
|
|
519
|
+
| 'defaultIsOpen'
|
|
520
|
+
| 'defaultValue'
|
|
521
|
+
| 'hideIcon'
|
|
522
|
+
| 'id'
|
|
523
|
+
| 'isDisabled'
|
|
524
|
+
| 'isInvalid'
|
|
525
|
+
| 'name'
|
|
526
|
+
| 'onBlur'
|
|
527
|
+
| 'onChange'
|
|
528
|
+
| 'onFocus'
|
|
529
|
+
| 'spacing'
|
|
530
|
+
| 'locale'
|
|
531
|
+
| 'isOpen'
|
|
532
|
+
| 'parseInputValue'
|
|
533
|
+
| 'formatDisplayLabel'
|
|
534
|
+
| 'value'
|
|
535
|
+
| 'placeholder'
|
|
536
|
+
| 'key'
|
|
537
|
+
| 'analyticsContext'
|
|
538
|
+
| 'times'
|
|
539
|
+
| 'timeIsEditable'
|
|
540
|
+
| 'timeFormat'
|
|
541
|
+
> &
|
|
542
|
+
React_2.RefAttributes<any>
|
|
543
|
+
>;
|
|
544
|
+
|
|
545
|
+
declare const timePickerDefaultProps: {
|
|
546
|
+
appearance: Appearance;
|
|
547
|
+
autoFocus: boolean;
|
|
548
|
+
defaultIsOpen: boolean;
|
|
549
|
+
defaultValue: string;
|
|
550
|
+
hideIcon: boolean;
|
|
551
|
+
id: string;
|
|
552
|
+
innerProps: {};
|
|
553
|
+
isDisabled: boolean;
|
|
554
|
+
isInvalid: boolean;
|
|
555
|
+
name: string;
|
|
556
|
+
onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
|
|
557
|
+
onChange: (value: string) => void;
|
|
558
|
+
onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
|
|
559
|
+
parseInputValue: (time: string, timeFormat: string) => string | Date;
|
|
560
|
+
selectProps: {};
|
|
561
|
+
spacing: Spacing;
|
|
562
|
+
times: string[];
|
|
563
|
+
timeIsEditable: boolean;
|
|
564
|
+
locale: string;
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
export declare interface TimePickerProps extends WithAnalyticsEventsProps {
|
|
568
|
+
/**
|
|
569
|
+
Set the appearance of the picker.
|
|
570
|
+
|
|
571
|
+
`subtle` will remove the borders, background, and icon.
|
|
572
|
+
|
|
573
|
+
**NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
574
|
+
*/
|
|
575
|
+
appearance?: Appearance;
|
|
576
|
+
/** Set the picker to autofocus on mount. */
|
|
577
|
+
autoFocus?: boolean;
|
|
578
|
+
/** The default for `isOpen`. */
|
|
579
|
+
defaultIsOpen?: boolean;
|
|
580
|
+
/** The default for `value`. */
|
|
581
|
+
defaultValue?: string;
|
|
582
|
+
/** DEPRECATED - Use locale instead. 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)). */
|
|
583
|
+
formatDisplayLabel?: (time: string, timeFormat: string) => string;
|
|
584
|
+
/** 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. */
|
|
585
|
+
id?: string;
|
|
586
|
+
/** Props to apply to the container. **/
|
|
587
|
+
innerProps?: React_2.AllHTMLAttributes<HTMLElement>;
|
|
588
|
+
/** Set if the field is disabled. */
|
|
589
|
+
isDisabled?: boolean;
|
|
590
|
+
/** Set if the dropdown is open. Will be `false` if not provided. */
|
|
591
|
+
isOpen?: boolean;
|
|
592
|
+
/** The name of the field. */
|
|
593
|
+
name?: string;
|
|
594
|
+
/** Called when the field is blurred. */
|
|
595
|
+
onBlur?: React_2.FocusEventHandler<HTMLElement>;
|
|
596
|
+
/** Called when the value changes. The only argument is an ISO time or empty string. */
|
|
597
|
+
onChange?: (value: string) => void;
|
|
598
|
+
/** Called when the field is focused. */
|
|
599
|
+
onFocus?: React_2.FocusEventHandler<HTMLElement>;
|
|
600
|
+
parseInputValue?: (time: string, timeFormat: string) => string | Date;
|
|
601
|
+
/** Props to apply to the select. */
|
|
602
|
+
selectProps?: SelectProps_2<any>;
|
|
603
|
+
/**
|
|
604
|
+
The spacing for the select control.
|
|
605
|
+
|
|
606
|
+
Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
607
|
+
*/
|
|
608
|
+
spacing?: Spacing;
|
|
609
|
+
/** The times shown in the dropdown. */
|
|
610
|
+
times?: string[];
|
|
611
|
+
/** Set if users can edit the input, allowing them to add custom times. */
|
|
612
|
+
timeIsEditable?: boolean;
|
|
613
|
+
/** The ISO time that should be used as the input value. */
|
|
614
|
+
value?: string;
|
|
615
|
+
/** Set if the picker has an invalid value. */
|
|
616
|
+
isInvalid?: boolean;
|
|
617
|
+
/** Hides icon for dropdown indicator. */
|
|
618
|
+
hideIcon?: boolean;
|
|
619
|
+
/** Time format that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format). */
|
|
620
|
+
timeFormat?: string;
|
|
621
|
+
/** Placeholder text displayed in input. */
|
|
622
|
+
placeholder?: string;
|
|
623
|
+
/** Locale used to format the time. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat). */
|
|
624
|
+
locale?: string;
|
|
625
|
+
/**
|
|
626
|
+
* 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:
|
|
627
|
+
* - `{testId}--container` wrapping element of time-picker
|
|
628
|
+
**/
|
|
629
|
+
testId?: string;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
declare type TimePickerProps_2 = typeof timePickerDefaultProps &
|
|
633
|
+
TimePickerProps;
|
|
634
|
+
|
|
635
|
+
export {};
|
|
636
|
+
```
|