@atlaskit/datetime-picker 12.3.0 → 12.3.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 +12 -0
- package/dist/cjs/components/date-picker.js +3 -2
- package/dist/cjs/components/date-time-picker.js +1 -1
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/date-picker.js +3 -2
- package/dist/es2019/components/date-time-picker.js +1 -1
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/date-picker.js +3 -2
- package/dist/esm/components/date-time-picker.js +1 -1
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/date-time-picker.d.ts +2 -2
- package/dist/types/components/time-picker.d.ts +2 -2
- package/package.json +13 -18
- package/report.api.md +66 -193
- package/dist/types-ts4.0/components/date-picker.d.ts +0 -288
- package/dist/types-ts4.0/components/date-time-picker.d.ts +0 -218
- package/dist/types-ts4.0/components/time-picker.d.ts +0 -228
- package/dist/types-ts4.0/components/utils.d.ts +0 -1
- package/dist/types-ts4.0/index.d.ts +0 -7
- package/dist/types-ts4.0/internal/fixed-layer.d.ts +0 -33
- package/dist/types-ts4.0/internal/index.d.ts +0 -10
- package/dist/types-ts4.0/internal/parse-time.d.ts +0 -14
- package/dist/types-ts4.0/types.d.ts +0 -3
package/report.api.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
4
|
|
|
5
|
+
<!--
|
|
6
|
+
Generated API Report version: 2.0
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
10
|
+
|
|
5
11
|
```ts
|
|
6
12
|
import { ComponentType } from 'react';
|
|
7
13
|
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
@@ -15,9 +21,11 @@ import { SelectProps as SelectProps_2 } from '@atlaskit/select';
|
|
|
15
21
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
16
22
|
import { WithContextProps } from '@atlaskit/analytics-next';
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
// @public (undocumented)
|
|
25
|
+
export type Appearance = 'default' | 'subtle' | 'none';
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
// @public (undocumented)
|
|
28
|
+
export const DatePicker: ForwardRefExoticComponent<
|
|
21
29
|
Pick<
|
|
22
30
|
Pick<
|
|
23
31
|
Omit<DatePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
@@ -123,7 +131,8 @@ export declare const DatePicker: ForwardRefExoticComponent<
|
|
|
123
131
|
RefAttributes<any>
|
|
124
132
|
>;
|
|
125
133
|
|
|
126
|
-
|
|
134
|
+
// @public (undocumented)
|
|
135
|
+
const datePickerDefaultProps: {
|
|
127
136
|
appearance: Appearance;
|
|
128
137
|
autoFocus: boolean;
|
|
129
138
|
defaultIsOpen: boolean;
|
|
@@ -145,116 +154,50 @@ declare const datePickerDefaultProps: {
|
|
|
145
154
|
locale: string;
|
|
146
155
|
};
|
|
147
156
|
|
|
148
|
-
|
|
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
|
-
*/
|
|
157
|
+
// @public (undocumented)
|
|
158
|
+
export interface DatePickerProps extends WithAnalyticsEventsProps {
|
|
156
159
|
appearance?: Appearance;
|
|
157
|
-
/** Set the picker to autofocus on mount. */
|
|
158
160
|
autoFocus?: boolean;
|
|
159
|
-
|
|
161
|
+
dateFormat?: string;
|
|
160
162
|
defaultIsOpen?: boolean;
|
|
161
|
-
/** The default for `value`. */
|
|
162
163
|
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
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
165
|
disabledDateFilter?: (date: string) => boolean;
|
|
171
|
-
|
|
172
|
-
|
|
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. */
|
|
166
|
+
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
167
|
+
hideIcon?: boolean;
|
|
176
168
|
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
169
|
id?: string;
|
|
183
|
-
/** Props to apply to the container. **/
|
|
184
170
|
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
185
|
-
/** Set if the picker is disabled. */
|
|
186
171
|
isDisabled?: boolean;
|
|
187
|
-
|
|
172
|
+
isInvalid?: boolean;
|
|
188
173
|
isOpen?: boolean;
|
|
189
|
-
|
|
174
|
+
locale?: string;
|
|
175
|
+
maxDate?: string;
|
|
176
|
+
minDate?: string;
|
|
190
177
|
name?: string;
|
|
191
|
-
/** The aria-label attribute associated with the next-month arrow. */
|
|
192
178
|
nextMonthLabel?: string;
|
|
193
|
-
/** Called when the field is blurred. */
|
|
194
179
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
195
|
-
/** Called when the value changes. The only argument is an ISO time or empty string. */
|
|
196
180
|
onChange?: (value: string) => void;
|
|
197
|
-
/** Called when the field is focused. */
|
|
198
181
|
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
182
|
parseInputValue?: (date: string, dateFormat: string) => Date;
|
|
201
|
-
|
|
202
|
-
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
203
|
-
/** The aria-label attribute associated with the previous-month arrow. */
|
|
183
|
+
placeholder?: string;
|
|
204
184
|
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
185
|
selectProps?: SelectProps;
|
|
208
|
-
/**
|
|
209
|
-
The spacing for the select control.
|
|
210
|
-
|
|
211
|
-
Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
212
|
-
*/
|
|
213
186
|
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
187
|
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
|
-
*/
|
|
188
|
+
value?: string;
|
|
242
189
|
weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
243
190
|
}
|
|
244
191
|
|
|
245
|
-
|
|
246
|
-
|
|
192
|
+
// @public (undocumented)
|
|
193
|
+
type DatePickerProps_2 = typeof datePickerDefaultProps & DatePickerProps;
|
|
247
194
|
|
|
248
|
-
|
|
195
|
+
// @public (undocumented)
|
|
196
|
+
export const DateTimePicker: React_2.ForwardRefExoticComponent<
|
|
249
197
|
Pick<
|
|
250
198
|
Pick<
|
|
251
199
|
Omit<DateTimePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
252
|
-
| '
|
|
253
|
-
| 'hideIcon'
|
|
254
|
-
| 'value'
|
|
255
|
-
| 'dateFormat'
|
|
256
|
-
| 'timeFormat'
|
|
257
|
-
| 'parseValue'
|
|
200
|
+
'testId' | 'value' | 'dateFormat' | 'timeFormat' | 'parseValue'
|
|
258
201
|
> &
|
|
259
202
|
Partial<
|
|
260
203
|
Pick<
|
|
@@ -313,7 +256,6 @@ export declare const DateTimePicker: React_2.ForwardRefExoticComponent<
|
|
|
313
256
|
| 'innerProps'
|
|
314
257
|
| 'autoFocus'
|
|
315
258
|
| 'defaultValue'
|
|
316
|
-
| 'hideIcon'
|
|
317
259
|
| 'id'
|
|
318
260
|
| 'isDisabled'
|
|
319
261
|
| 'isInvalid'
|
|
@@ -339,7 +281,8 @@ export declare const DateTimePicker: React_2.ForwardRefExoticComponent<
|
|
|
339
281
|
React_2.RefAttributes<any>
|
|
340
282
|
>;
|
|
341
283
|
|
|
342
|
-
|
|
284
|
+
// @public (undocumented)
|
|
285
|
+
const dateTimePickerDefaultProps: {
|
|
343
286
|
appearance: string;
|
|
344
287
|
autoFocus: boolean;
|
|
345
288
|
isDisabled: boolean;
|
|
@@ -361,49 +304,23 @@ declare const dateTimePickerDefaultProps: {
|
|
|
361
304
|
locale: string;
|
|
362
305
|
};
|
|
363
306
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
* Set the appearance of the picker.
|
|
367
|
-
*
|
|
368
|
-
* `subtle` will remove the borders and background.
|
|
369
|
-
*/
|
|
307
|
+
// @public (undocumented)
|
|
308
|
+
export interface DateTimePickerProps extends WithAnalyticsEventsProps {
|
|
370
309
|
appearance?: Appearance;
|
|
371
|
-
/** Set the picker to autofocus on mount. */
|
|
372
310
|
autoFocus?: boolean;
|
|
373
|
-
|
|
311
|
+
dateFormat?: string;
|
|
312
|
+
datePickerProps?: DatePickerProps;
|
|
313
|
+
datePickerSelectProps?: SelectProps_2<any>;
|
|
374
314
|
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
315
|
id?: string;
|
|
380
|
-
/** Props to apply to the container. **/
|
|
381
316
|
innerProps?: React_2.AllHTMLAttributes<HTMLElement>;
|
|
382
|
-
/** Set if the field is disabled. */
|
|
383
317
|
isDisabled?: boolean;
|
|
384
|
-
|
|
318
|
+
isInvalid?: boolean;
|
|
319
|
+
locale?: string;
|
|
385
320
|
name?: string;
|
|
386
|
-
/** Called when the field is blurred. */
|
|
387
321
|
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
322
|
onChange?: (value: string) => void;
|
|
390
|
-
/** Called when the field is focused. */
|
|
391
323
|
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
324
|
parseValue?: (
|
|
408
325
|
dateTimeValue: string,
|
|
409
326
|
date: string,
|
|
@@ -414,38 +331,28 @@ export declare interface DateTimePickerProps extends WithAnalyticsEventsProps {
|
|
|
414
331
|
timeValue: string;
|
|
415
332
|
zoneValue: string;
|
|
416
333
|
};
|
|
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
334
|
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
335
|
testId?: string;
|
|
336
|
+
timeFormat?: string;
|
|
337
|
+
timeIsEditable?: boolean;
|
|
338
|
+
timePickerProps?: TimePickerProps;
|
|
339
|
+
timePickerSelectProps?: SelectProps_2<any>;
|
|
340
|
+
times?: Array<string>;
|
|
341
|
+
value?: string;
|
|
439
342
|
}
|
|
440
343
|
|
|
441
|
-
|
|
344
|
+
// @public (undocumented)
|
|
345
|
+
type DateTimePickerProps_2 = typeof dateTimePickerDefaultProps &
|
|
442
346
|
DateTimePickerProps;
|
|
443
347
|
|
|
444
|
-
|
|
348
|
+
// @public (undocumented)
|
|
349
|
+
type SelectProps = any;
|
|
445
350
|
|
|
446
|
-
|
|
351
|
+
// @public (undocumented)
|
|
352
|
+
export type Spacing = 'compact' | 'default';
|
|
447
353
|
|
|
448
|
-
|
|
354
|
+
// @public (undocumented)
|
|
355
|
+
export const TimePicker: React_2.ForwardRefExoticComponent<
|
|
449
356
|
Pick<
|
|
450
357
|
Pick<
|
|
451
358
|
Omit<TimePickerProps_2, keyof WithAnalyticsEventsProps>,
|
|
@@ -542,7 +449,8 @@ export declare const TimePicker: React_2.ForwardRefExoticComponent<
|
|
|
542
449
|
React_2.RefAttributes<any>
|
|
543
450
|
>;
|
|
544
451
|
|
|
545
|
-
|
|
452
|
+
// @public (undocumented)
|
|
453
|
+
const timePickerDefaultProps: {
|
|
546
454
|
appearance: Appearance;
|
|
547
455
|
autoFocus: boolean;
|
|
548
456
|
defaultIsOpen: boolean;
|
|
@@ -564,73 +472,38 @@ declare const timePickerDefaultProps: {
|
|
|
564
472
|
locale: string;
|
|
565
473
|
};
|
|
566
474
|
|
|
567
|
-
|
|
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
|
-
*/
|
|
475
|
+
// @public (undocumented)
|
|
476
|
+
export interface TimePickerProps extends WithAnalyticsEventsProps {
|
|
575
477
|
appearance?: Appearance;
|
|
576
|
-
/** Set the picker to autofocus on mount. */
|
|
577
478
|
autoFocus?: boolean;
|
|
578
|
-
/** The default for `isOpen`. */
|
|
579
479
|
defaultIsOpen?: boolean;
|
|
580
|
-
/** The default for `value`. */
|
|
581
480
|
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
481
|
formatDisplayLabel?: (time: string, timeFormat: string) => string;
|
|
584
|
-
|
|
482
|
+
hideIcon?: boolean;
|
|
585
483
|
id?: string;
|
|
586
|
-
/** Props to apply to the container. **/
|
|
587
484
|
innerProps?: React_2.AllHTMLAttributes<HTMLElement>;
|
|
588
|
-
/** Set if the field is disabled. */
|
|
589
485
|
isDisabled?: boolean;
|
|
590
|
-
|
|
486
|
+
isInvalid?: boolean;
|
|
591
487
|
isOpen?: boolean;
|
|
592
|
-
|
|
488
|
+
locale?: string;
|
|
593
489
|
name?: string;
|
|
594
|
-
/** Called when the field is blurred. */
|
|
595
490
|
onBlur?: React_2.FocusEventHandler<HTMLElement>;
|
|
596
|
-
/** Called when the value changes. The only argument is an ISO time or empty string. */
|
|
597
491
|
onChange?: (value: string) => void;
|
|
598
|
-
/** Called when the field is focused. */
|
|
599
492
|
onFocus?: React_2.FocusEventHandler<HTMLElement>;
|
|
493
|
+
// (undocumented)
|
|
600
494
|
parseInputValue?: (time: string, timeFormat: string) => string | Date;
|
|
601
|
-
|
|
495
|
+
placeholder?: string;
|
|
602
496
|
selectProps?: SelectProps_2<any>;
|
|
603
|
-
/**
|
|
604
|
-
The spacing for the select control.
|
|
605
|
-
|
|
606
|
-
Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
607
|
-
*/
|
|
608
497
|
spacing?: Spacing;
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
/** Set if users can edit the input, allowing them to add custom times. */
|
|
498
|
+
testId?: string;
|
|
499
|
+
timeFormat?: string;
|
|
612
500
|
timeIsEditable?: boolean;
|
|
613
|
-
|
|
501
|
+
times?: string[];
|
|
614
502
|
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
503
|
}
|
|
631
504
|
|
|
632
|
-
|
|
633
|
-
|
|
505
|
+
// @public (undocumented)
|
|
506
|
+
type TimePickerProps_2 = typeof timePickerDefaultProps & TimePickerProps;
|
|
634
507
|
|
|
635
|
-
|
|
508
|
+
// (No @packageDocumentation comment for this package)
|
|
636
509
|
```
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { Component } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
4
|
-
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
5
|
-
import { CalendarRef } from '@atlaskit/calendar';
|
|
6
|
-
import { LocalizationProvider } from '@atlaskit/locale';
|
|
7
|
-
import { ActionMeta, IndicatorComponentType, IndicatorProps, OptionType, ValueType } from '@atlaskit/select';
|
|
8
|
-
import { Appearance, SelectProps, Spacing } from '../types';
|
|
9
|
-
export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
10
|
-
/**
|
|
11
|
-
* Set the appearance of the picker.
|
|
12
|
-
*
|
|
13
|
-
* `subtle` will remove the borders, background, and icon.
|
|
14
|
-
*
|
|
15
|
-
*NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
16
|
-
*/
|
|
17
|
-
appearance?: Appearance;
|
|
18
|
-
/**
|
|
19
|
-
* Set the picker to autofocus on mount.
|
|
20
|
-
*/
|
|
21
|
-
autoFocus?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* The default for `isOpen`. Will be `false` if not provided.
|
|
24
|
-
*/
|
|
25
|
-
defaultIsOpen?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* The default for `value`.
|
|
28
|
-
*/
|
|
29
|
-
defaultValue?: string;
|
|
30
|
-
/**
|
|
31
|
-
* An array of ISO dates that should be disabled on the calendar. This does not affect what users can type into the picker.
|
|
32
|
-
*/
|
|
33
|
-
disabled?: string[];
|
|
34
|
-
/**
|
|
35
|
-
* A filter function for disabling dates on the calendar. This does not affect what users can type into the picker.
|
|
36
|
-
*
|
|
37
|
-
* The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
|
|
38
|
-
*/
|
|
39
|
-
disabledDateFilter?: (date: string) => boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
42
|
-
*/
|
|
43
|
-
maxDate?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The earliest enabled date. Dates before this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
46
|
-
*/
|
|
47
|
-
minDate?: string;
|
|
48
|
-
/**
|
|
49
|
-
* The icon shown in the picker.
|
|
50
|
-
*/
|
|
51
|
-
icon?: IndicatorComponentType<OptionType>;
|
|
52
|
-
/**
|
|
53
|
-
* 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`.
|
|
54
|
-
*
|
|
55
|
-
* Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
56
|
-
*/
|
|
57
|
-
id?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Props to apply to the container.
|
|
60
|
-
*/
|
|
61
|
-
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
62
|
-
/**
|
|
63
|
-
* Set if the picker is disabled.
|
|
64
|
-
*/
|
|
65
|
-
isDisabled?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Set if the picker is open.
|
|
68
|
-
*/
|
|
69
|
-
isOpen?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* The name of the field.
|
|
72
|
-
*/
|
|
73
|
-
name?: string;
|
|
74
|
-
/**
|
|
75
|
-
* The aria-label attribute associated with the next-month arrow.
|
|
76
|
-
*/
|
|
77
|
-
nextMonthLabel?: string;
|
|
78
|
-
/**
|
|
79
|
-
* Called when the field is blurred.
|
|
80
|
-
*/
|
|
81
|
-
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
82
|
-
/**
|
|
83
|
-
* Called when the value changes. The only argument is an ISO time or empty string.
|
|
84
|
-
*/
|
|
85
|
-
onChange?: (value: string) => void;
|
|
86
|
-
/**
|
|
87
|
-
* Called when the field is focused.
|
|
88
|
-
*/
|
|
89
|
-
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
90
|
-
/**
|
|
91
|
-
* A function for parsing input characters and transforming them into a Date object. By default parses the date string based off the locale.
|
|
92
|
-
*/
|
|
93
|
-
parseInputValue?: (date: string, dateFormat: string) => Date;
|
|
94
|
-
/**
|
|
95
|
-
* 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.
|
|
96
|
-
*/
|
|
97
|
-
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
98
|
-
/**
|
|
99
|
-
* The aria-label attribute associated with the previous-month arrow.
|
|
100
|
-
*/
|
|
101
|
-
previousMonthLabel?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Props to apply to the select. This can be used to set options such as placeholder text.
|
|
104
|
-
* See [the `Select` documentation for further information](/components/select).
|
|
105
|
-
*/
|
|
106
|
-
selectProps?: SelectProps;
|
|
107
|
-
/**
|
|
108
|
-
* The spacing for the select control.
|
|
109
|
-
*
|
|
110
|
-
* Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
111
|
-
*/
|
|
112
|
-
spacing?: Spacing;
|
|
113
|
-
/**
|
|
114
|
-
* The ISO time used as the input value.
|
|
115
|
-
*/
|
|
116
|
-
value?: string;
|
|
117
|
-
/**
|
|
118
|
-
* Set if the picker has an invalid value.
|
|
119
|
-
*/
|
|
120
|
-
isInvalid?: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Hides icon for dropdown indicator.
|
|
123
|
-
*/
|
|
124
|
-
hideIcon?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Format the date with a string that is accepted by [date-fn's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
127
|
-
*/
|
|
128
|
-
dateFormat?: string;
|
|
129
|
-
/**
|
|
130
|
-
* Placeholder text displayed in input
|
|
131
|
-
*/
|
|
132
|
-
placeholder?: string;
|
|
133
|
-
/**
|
|
134
|
-
* Locale used to format the date and calendar. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
135
|
-
*/
|
|
136
|
-
locale?: string;
|
|
137
|
-
/**
|
|
138
|
-
* 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
|
|
139
|
-
* - `{testId}--container` wrapping element of date-picker
|
|
140
|
-
* - `{testId}--calendar--container` nested calendar component
|
|
141
|
-
*/
|
|
142
|
-
testId?: string;
|
|
143
|
-
/**
|
|
144
|
-
* Start day of the week for the calendar.
|
|
145
|
-
* - `0` sunday (default value)
|
|
146
|
-
* - `1` monday
|
|
147
|
-
* - `2` tuesday
|
|
148
|
-
* - `3` wednesday
|
|
149
|
-
* - `4` thursday
|
|
150
|
-
* - `5` friday
|
|
151
|
-
* - `6` saturday
|
|
152
|
-
*/
|
|
153
|
-
weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
154
|
-
}
|
|
155
|
-
declare type DatePickerProps = typeof datePickerDefaultProps & DatePickerBaseProps;
|
|
156
|
-
interface State {
|
|
157
|
-
isOpen: boolean;
|
|
158
|
-
/**
|
|
159
|
-
* When being cleared from the icon the DatePicker is blurred.
|
|
160
|
-
* This variable defines whether the default onSelectBlur or onSelectFocus
|
|
161
|
-
* events should behave as normal
|
|
162
|
-
*/
|
|
163
|
-
isFocused: boolean;
|
|
164
|
-
clearingFromIcon: boolean;
|
|
165
|
-
value: string;
|
|
166
|
-
/**
|
|
167
|
-
* Value to be shown in the calendar as selected.
|
|
168
|
-
*/
|
|
169
|
-
selectedValue: string;
|
|
170
|
-
view: string;
|
|
171
|
-
inputValue: string;
|
|
172
|
-
l10n: LocalizationProvider;
|
|
173
|
-
}
|
|
174
|
-
declare const datePickerDefaultProps: {
|
|
175
|
-
appearance: Appearance;
|
|
176
|
-
autoFocus: boolean;
|
|
177
|
-
defaultIsOpen: boolean;
|
|
178
|
-
defaultValue: string;
|
|
179
|
-
disabled: string[];
|
|
180
|
-
disabledDateFilter: (_: string) => boolean;
|
|
181
|
-
hideIcon: boolean;
|
|
182
|
-
icon: import("react").ComponentType<IndicatorProps<OptionType, false>>;
|
|
183
|
-
id: string;
|
|
184
|
-
innerProps: {};
|
|
185
|
-
isDisabled: boolean;
|
|
186
|
-
isInvalid: boolean;
|
|
187
|
-
name: string;
|
|
188
|
-
onBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
189
|
-
onChange: (value: string) => void;
|
|
190
|
-
onFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
191
|
-
selectProps: {};
|
|
192
|
-
spacing: Spacing;
|
|
193
|
-
locale: string;
|
|
194
|
-
};
|
|
195
|
-
declare class DatePicker extends Component<DatePickerProps, State> {
|
|
196
|
-
static defaultProps: {
|
|
197
|
-
appearance: Appearance;
|
|
198
|
-
autoFocus: boolean;
|
|
199
|
-
defaultIsOpen: boolean;
|
|
200
|
-
defaultValue: string;
|
|
201
|
-
disabled: string[];
|
|
202
|
-
disabledDateFilter: (_: string) => boolean;
|
|
203
|
-
hideIcon: boolean;
|
|
204
|
-
icon: import("react").ComponentType<IndicatorProps<OptionType, false>>;
|
|
205
|
-
id: string;
|
|
206
|
-
innerProps: {};
|
|
207
|
-
isDisabled: boolean;
|
|
208
|
-
isInvalid: boolean;
|
|
209
|
-
name: string;
|
|
210
|
-
onBlur: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
211
|
-
onChange: (value: string) => void;
|
|
212
|
-
onFocus: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
213
|
-
selectProps: {};
|
|
214
|
-
spacing: Spacing;
|
|
215
|
-
locale: string;
|
|
216
|
-
};
|
|
217
|
-
calendarRef: CalendarRef | null;
|
|
218
|
-
containerRef: HTMLElement | null;
|
|
219
|
-
constructor(props: any);
|
|
220
|
-
UNSAFE_componentWillReceiveProps(nextProps: Readonly<DatePickerProps>): void;
|
|
221
|
-
getSafeState: () => {
|
|
222
|
-
inputValue: any;
|
|
223
|
-
isOpen: boolean;
|
|
224
|
-
value: string;
|
|
225
|
-
isFocused: boolean;
|
|
226
|
-
clearingFromIcon: boolean;
|
|
227
|
-
selectedValue: string;
|
|
228
|
-
view: string;
|
|
229
|
-
l10n: LocalizationProvider;
|
|
230
|
-
};
|
|
231
|
-
isDateDisabled: (date: string) => boolean;
|
|
232
|
-
onCalendarChange: ({ iso }: {
|
|
233
|
-
iso: string;
|
|
234
|
-
}) => void;
|
|
235
|
-
onCalendarSelect: ({ iso }: {
|
|
236
|
-
iso: string;
|
|
237
|
-
}) => void;
|
|
238
|
-
onInputClick: () => void;
|
|
239
|
-
onSelectBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
240
|
-
onSelectFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
241
|
-
onSelectInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
242
|
-
onSelectKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
243
|
-
onClear: () => void;
|
|
244
|
-
onSelectChange: (value: ValueType<OptionType>, action: ActionMeta) => void;
|
|
245
|
-
refCalendar: (ref: CalendarRef | null) => void;
|
|
246
|
-
handleInputChange: (inputValue: string, actionMeta: {}) => void;
|
|
247
|
-
getContainerRef: (ref: HTMLElement | null) => void;
|
|
248
|
-
/**
|
|
249
|
-
* There are two props that can change how the date is parsed.
|
|
250
|
-
* The priority of props used is:
|
|
251
|
-
* 1. parseInputValue
|
|
252
|
-
* 2. locale
|
|
253
|
-
*/
|
|
254
|
-
parseDate: (date: string) => Date;
|
|
255
|
-
/**
|
|
256
|
-
* There are multiple props that can change how the date is formatted.
|
|
257
|
-
* The priority of props used is:
|
|
258
|
-
* 1. formatDisplayLabel
|
|
259
|
-
* 2. dateFormat
|
|
260
|
-
* 3. locale
|
|
261
|
-
*/
|
|
262
|
-
formatDate: (value: string) => string;
|
|
263
|
-
getPlaceholder: () => string;
|
|
264
|
-
render(): jsx.JSX.Element;
|
|
265
|
-
}
|
|
266
|
-
export { DatePicker as DatePickerWithoutAnalytics };
|
|
267
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "value" | "dateFormat" | "placeholder" | "weekStartDay"> & Partial<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "icon" | "disabled" | "appearance" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "disabledDateFilter" | "id" | "innerProps" | "isDisabled" | "name" | "onBlur" | "onChange" | "onFocus" | "selectProps" | "spacing" | "isInvalid" | "hideIcon" | "locale">> & Partial<Pick<{
|
|
268
|
-
appearance: Appearance;
|
|
269
|
-
autoFocus: boolean;
|
|
270
|
-
defaultIsOpen: boolean;
|
|
271
|
-
defaultValue: string;
|
|
272
|
-
disabled: string[];
|
|
273
|
-
disabledDateFilter: (_: string) => boolean;
|
|
274
|
-
hideIcon: boolean;
|
|
275
|
-
icon: import("react").ComponentType<IndicatorProps<OptionType, false>>;
|
|
276
|
-
id: string;
|
|
277
|
-
innerProps: {};
|
|
278
|
-
isDisabled: boolean;
|
|
279
|
-
isInvalid: boolean;
|
|
280
|
-
name: string;
|
|
281
|
-
onBlur: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
282
|
-
onChange: (value: string) => void;
|
|
283
|
-
onFocus: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
284
|
-
selectProps: {};
|
|
285
|
-
spacing: Spacing;
|
|
286
|
-
locale: string;
|
|
287
|
-
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "icon" | "disabled" | "appearance" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "disabledDateFilter" | "maxDate" | "minDate" | "id" | "innerProps" | "isDisabled" | "isOpen" | "name" | "nextMonthLabel" | "onBlur" | "onChange" | "onFocus" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "selectProps" | "spacing" | "value" | "isInvalid" | "hideIcon" | "dateFormat" | "placeholder" | "locale" | "weekStartDay" | "key" | "analyticsContext"> & import("react").RefAttributes<any>>;
|
|
288
|
-
export default _default;
|