@atlaskit/datetime-picker 15.3.0 → 15.4.0
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 +13 -0
- package/dist/cjs/components/date-picker-class.js +668 -0
- package/dist/cjs/components/date-picker-fc.js +614 -0
- package/dist/cjs/components/date-picker.js +6 -661
- package/dist/cjs/components/date-time-picker.js +6 -3
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/es2019/components/date-picker-class.js +631 -0
- package/dist/es2019/components/date-picker-fc.js +543 -0
- package/dist/es2019/components/date-picker.js +5 -630
- package/dist/es2019/components/date-time-picker.js +5 -2
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/esm/components/date-picker-class.js +663 -0
- package/dist/esm/components/date-picker-fc.js +605 -0
- package/dist/esm/components/date-picker.js +5 -662
- package/dist/esm/components/date-time-picker.js +5 -2
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/types/components/date-picker-class.d.ts +119 -0
- package/dist/types/components/date-picker-fc.d.ts +30 -0
- package/dist/types/components/date-picker.d.ts +20 -99
- package/dist/types/types.d.ts +3 -3
- package/dist/types-ts4.5/components/date-picker-class.d.ts +119 -0
- package/dist/types-ts4.5/components/date-picker-fc.d.ts +30 -0
- package/dist/types-ts4.5/components/date-picker.d.ts +20 -99
- package/dist/types-ts4.5/types.d.ts +3 -3
- package/package.json +10 -4
|
@@ -20,15 +20,18 @@ import { css, jsx } from '@emotion/react';
|
|
|
20
20
|
import { format, isValid, parseISO } from 'date-fns';
|
|
21
21
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
22
22
|
import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
|
|
23
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
23
24
|
import { mergeStyles } from '@atlaskit/select';
|
|
24
25
|
import { N500, N70 } from '@atlaskit/theme/colors';
|
|
25
26
|
import { formatDateTimeZoneIntoIso } from '../internal';
|
|
26
27
|
import { DateTimePickerContainer } from '../internal/date-time-picker-container';
|
|
27
28
|
import { convertTokens } from '../internal/parse-tokens';
|
|
28
|
-
import
|
|
29
|
+
import DatePickerOld from './date-picker-class';
|
|
30
|
+
import DatePickerNew from './date-picker-fc';
|
|
29
31
|
import TimePicker from './time-picker';
|
|
32
|
+
var DatePicker = fg('dst-date-picker-use-functional-component') ? DatePickerNew : DatePickerOld;
|
|
30
33
|
var packageName = "@atlaskit/datetime-picker";
|
|
31
|
-
var packageVersion = "15.
|
|
34
|
+
var packageVersion = "15.4.0";
|
|
32
35
|
// Make DatePicker 50% the width of DateTimePicker
|
|
33
36
|
// If rendering an icon container, shrink the TimePicker
|
|
34
37
|
var datePickerContainerStyles = css({
|
|
@@ -17,7 +17,7 @@ import parseTime from '../internal/parse-time';
|
|
|
17
17
|
import { convertTokens } from '../internal/parse-tokens';
|
|
18
18
|
import { makeSingleValue } from '../internal/single-value';
|
|
19
19
|
var packageName = "@atlaskit/datetime-picker";
|
|
20
|
-
var packageVersion = "15.
|
|
20
|
+
var packageVersion = "15.4.0";
|
|
21
21
|
var menuStyles = {
|
|
22
22
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
23
23
|
position: 'static',
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { Component } from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
8
|
+
import { type ActionMeta, type InputActionMeta } from '@atlaskit/select';
|
|
9
|
+
import { type DatePickerBaseProps } from '../types';
|
|
10
|
+
type DatePickerProps = typeof datePickerDefaultProps & DatePickerBaseProps;
|
|
11
|
+
interface State {
|
|
12
|
+
isKeyDown: boolean;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When being cleared from the icon the DatePicker is blurred.
|
|
16
|
+
* This variable defines whether the default onSelectBlur or onSelectFocus
|
|
17
|
+
* events should behave as normal.
|
|
18
|
+
*/
|
|
19
|
+
isFocused: boolean;
|
|
20
|
+
clearingFromIcon: boolean;
|
|
21
|
+
value: string;
|
|
22
|
+
calendarValue: string;
|
|
23
|
+
selectInputValue: string;
|
|
24
|
+
l10n: LocalizationProvider;
|
|
25
|
+
locale: string;
|
|
26
|
+
shouldSetFocusOnCurrentDay: boolean;
|
|
27
|
+
wasOpenedFromCalendarButton: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const datePickerDefaultProps: {
|
|
30
|
+
defaultIsOpen: boolean;
|
|
31
|
+
defaultValue: string;
|
|
32
|
+
disabled: string[];
|
|
33
|
+
disabledDateFilter: (_: string) => boolean;
|
|
34
|
+
locale: string;
|
|
35
|
+
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
36
|
+
onChange: (_value: string) => void;
|
|
37
|
+
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
38
|
+
};
|
|
39
|
+
declare class DatePickerComponent extends Component<DatePickerProps, State> {
|
|
40
|
+
static defaultProps: {
|
|
41
|
+
defaultIsOpen: boolean;
|
|
42
|
+
defaultValue: string;
|
|
43
|
+
disabled: string[];
|
|
44
|
+
disabledDateFilter: (_: string) => boolean;
|
|
45
|
+
locale: string;
|
|
46
|
+
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
47
|
+
onChange: (_value: string) => void;
|
|
48
|
+
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
49
|
+
};
|
|
50
|
+
containerRef: HTMLElement | null;
|
|
51
|
+
calendarRef: React.RefObject<HTMLDivElement | null>;
|
|
52
|
+
calendarButtonRef: React.RefObject<HTMLButtonElement>;
|
|
53
|
+
constructor(props: any);
|
|
54
|
+
static getDerivedStateFromProps(nextProps: Readonly<DatePickerProps>, prevState: State): {
|
|
55
|
+
l10n: LocalizationProvider;
|
|
56
|
+
locale: string;
|
|
57
|
+
} | null;
|
|
58
|
+
getValue: () => string;
|
|
59
|
+
getIsOpen: () => boolean;
|
|
60
|
+
onCalendarChange: ({ iso }: {
|
|
61
|
+
iso: string;
|
|
62
|
+
}) => void;
|
|
63
|
+
onCalendarSelect: ({ iso }: {
|
|
64
|
+
iso: string;
|
|
65
|
+
}) => void;
|
|
66
|
+
onInputClick: () => void;
|
|
67
|
+
onContainerBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
68
|
+
onContainerFocus: () => void;
|
|
69
|
+
onSelectBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
70
|
+
onSelectFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
71
|
+
onTextInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
72
|
+
onInputKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
73
|
+
onCalendarButtonKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
74
|
+
onCalendarButtonClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
75
|
+
onClear: () => void;
|
|
76
|
+
onSelectChange: (_value: unknown, action: ActionMeta) => void;
|
|
77
|
+
handleSelectInputChange: (selectInputValue: string, actionMeta: InputActionMeta) => void;
|
|
78
|
+
getContainerRef: (ref: HTMLElement | null) => void;
|
|
79
|
+
render(): jsx.JSX.Element;
|
|
80
|
+
}
|
|
81
|
+
export { DatePickerComponent as DatePickerWithoutAnalytics };
|
|
82
|
+
/**
|
|
83
|
+
* __Date picker__
|
|
84
|
+
*
|
|
85
|
+
* A date picker allows the user to select a particular date.
|
|
86
|
+
*
|
|
87
|
+
* - [Examples](https://atlassian.design/components/datetime-picker/date-picker/examples)
|
|
88
|
+
* - [Code](https://atlassian.design/components/datetime-picker/date-picker/code)
|
|
89
|
+
* - [Usage](https://atlassian.design/components/datetime-picker/date-picker/usage)
|
|
90
|
+
*/
|
|
91
|
+
declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<{
|
|
92
|
+
defaultIsOpen: boolean;
|
|
93
|
+
defaultValue: string;
|
|
94
|
+
disabled: string[];
|
|
95
|
+
disabledDateFilter: (_: string) => boolean;
|
|
96
|
+
locale: string;
|
|
97
|
+
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
98
|
+
onChange: (_value: string) => void;
|
|
99
|
+
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
100
|
+
} & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
|
|
101
|
+
defaultIsOpen: boolean;
|
|
102
|
+
defaultValue: string;
|
|
103
|
+
disabled: string[];
|
|
104
|
+
disabledDateFilter: (_: string) => boolean;
|
|
105
|
+
locale: string;
|
|
106
|
+
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
107
|
+
onChange: (_value: string) => void;
|
|
108
|
+
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
109
|
+
} & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "disabled" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "defaultIsOpen">> & Partial<Pick<{
|
|
110
|
+
defaultIsOpen: boolean;
|
|
111
|
+
defaultValue: string;
|
|
112
|
+
disabled: string[];
|
|
113
|
+
disabledDateFilter: (_: string) => boolean;
|
|
114
|
+
locale: string;
|
|
115
|
+
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
116
|
+
onChange: (_value: string) => void;
|
|
117
|
+
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
118
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
|
|
119
|
+
export default DatePicker;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type DropdownIndicatorProps, type GroupType, type OptionType } from '@atlaskit/select';
|
|
3
|
+
import { type DatePickerBaseProps, type DateTimePickerSelectProps } from '../types';
|
|
4
|
+
export type DatePickerProps = DatePickerBaseProps & {
|
|
5
|
+
icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
|
|
6
|
+
selectProps?: DateTimePickerSelectProps & {
|
|
7
|
+
inputValue?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* __Date picker__
|
|
12
|
+
*
|
|
13
|
+
* A date picker allows the user to select a particular date.
|
|
14
|
+
*
|
|
15
|
+
* - [Examples](https://atlassian.design/components/datetime-picker/date-picker/examples)
|
|
16
|
+
* - [Code](https://atlassian.design/components/datetime-picker/date-picker/code)
|
|
17
|
+
* - [Usage](https://atlassian.design/components/datetime-picker/date-picker/usage)
|
|
18
|
+
*/
|
|
19
|
+
declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<DatePickerBaseProps & {
|
|
20
|
+
icon?: import("react").ComponentType<DropdownIndicatorProps<OptionType, boolean, GroupType<OptionType>>> | undefined;
|
|
21
|
+
selectProps?: (Omit<import("@atlaskit/select").SelectProps<OptionType, false>, "placeholder" | "aria-describedby" | "aria-label" | "inputId"> & {
|
|
22
|
+
'aria-describedby'?: undefined;
|
|
23
|
+
'aria-label'?: undefined;
|
|
24
|
+
inputId?: undefined;
|
|
25
|
+
placeholder?: undefined;
|
|
26
|
+
} & {
|
|
27
|
+
inputValue?: string | undefined;
|
|
28
|
+
}) | undefined;
|
|
29
|
+
}, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
|
|
30
|
+
export default DatePicker;
|
|
@@ -1,119 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { Component } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
8
|
-
import { type ActionMeta, type InputActionMeta } from '@atlaskit/select';
|
|
9
|
-
import { type DatePickerBaseProps } from '../types';
|
|
10
|
-
type DatePickerProps = typeof datePickerDefaultProps & DatePickerBaseProps;
|
|
11
|
-
interface State {
|
|
12
|
-
isKeyDown: boolean;
|
|
13
|
-
isOpen: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* When being cleared from the icon the DatePicker is blurred.
|
|
16
|
-
* This variable defines whether the default onSelectBlur or onSelectFocus
|
|
17
|
-
* events should behave as normal.
|
|
18
|
-
*/
|
|
19
|
-
isFocused: boolean;
|
|
20
|
-
clearingFromIcon: boolean;
|
|
21
|
-
value: string;
|
|
22
|
-
calendarValue: string;
|
|
23
|
-
selectInputValue: string;
|
|
24
|
-
l10n: LocalizationProvider;
|
|
25
|
-
locale: string;
|
|
26
|
-
shouldSetFocusOnCurrentDay: boolean;
|
|
27
|
-
wasOpenedFromCalendarButton: boolean;
|
|
28
|
-
}
|
|
29
|
-
declare const datePickerDefaultProps: {
|
|
30
|
-
defaultIsOpen: boolean;
|
|
31
|
-
defaultValue: string;
|
|
32
|
-
disabled: string[];
|
|
33
|
-
disabledDateFilter: (_: string) => boolean;
|
|
34
|
-
locale: string;
|
|
35
|
-
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
36
|
-
onChange: (_value: string) => void;
|
|
37
|
-
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
38
|
-
};
|
|
39
|
-
declare class DatePickerComponent extends Component<DatePickerProps, State> {
|
|
40
|
-
static defaultProps: {
|
|
41
|
-
defaultIsOpen: boolean;
|
|
42
|
-
defaultValue: string;
|
|
43
|
-
disabled: string[];
|
|
44
|
-
disabledDateFilter: (_: string) => boolean;
|
|
45
|
-
locale: string;
|
|
46
|
-
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
47
|
-
onChange: (_value: string) => void;
|
|
48
|
-
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
49
|
-
};
|
|
50
|
-
containerRef: HTMLElement | null;
|
|
51
|
-
calendarRef: React.RefObject<HTMLDivElement | null>;
|
|
52
|
-
calendarButtonRef: React.RefObject<HTMLButtonElement>;
|
|
53
|
-
constructor(props: any);
|
|
54
|
-
static getDerivedStateFromProps(nextProps: Readonly<DatePickerProps>, prevState: State): {
|
|
55
|
-
l10n: LocalizationProvider;
|
|
56
|
-
locale: string;
|
|
57
|
-
} | null;
|
|
58
|
-
getValue: () => string;
|
|
59
|
-
getIsOpen: () => boolean;
|
|
60
|
-
onCalendarChange: ({ iso }: {
|
|
61
|
-
iso: string;
|
|
62
|
-
}) => void;
|
|
63
|
-
onCalendarSelect: ({ iso }: {
|
|
64
|
-
iso: string;
|
|
65
|
-
}) => void;
|
|
66
|
-
onInputClick: () => void;
|
|
67
|
-
onContainerBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
68
|
-
onContainerFocus: () => void;
|
|
69
|
-
onSelectBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
70
|
-
onSelectFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
71
|
-
onTextInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
72
|
-
onInputKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
73
|
-
onCalendarButtonKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
74
|
-
onCalendarButtonClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
75
|
-
onClear: () => void;
|
|
76
|
-
onSelectChange: (_value: unknown, action: ActionMeta) => void;
|
|
77
|
-
handleSelectInputChange: (selectInputValue: string, actionMeta: InputActionMeta) => void;
|
|
78
|
-
getContainerRef: (ref: HTMLElement | null) => void;
|
|
79
|
-
render(): jsx.JSX.Element;
|
|
80
|
-
}
|
|
81
|
-
export { DatePickerComponent as DatePickerWithoutAnalytics };
|
|
82
|
-
/**
|
|
83
|
-
* __Date picker__
|
|
84
|
-
*
|
|
85
|
-
* A date picker allows the user to select a particular date.
|
|
86
|
-
*
|
|
87
|
-
* - [Examples](https://atlassian.design/components/datetime-picker/date-picker/examples)
|
|
88
|
-
* - [Code](https://atlassian.design/components/datetime-picker/date-picker/code)
|
|
89
|
-
* - [Usage](https://atlassian.design/components/datetime-picker/date-picker/usage)
|
|
90
|
-
*/
|
|
1
|
+
/// <reference types="react" />
|
|
91
2
|
declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<{
|
|
92
3
|
defaultIsOpen: boolean;
|
|
93
4
|
defaultValue: string;
|
|
94
5
|
disabled: string[];
|
|
95
6
|
disabledDateFilter: (_: string) => boolean;
|
|
96
7
|
locale: string;
|
|
97
|
-
onBlur: (_event:
|
|
8
|
+
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
98
9
|
onChange: (_value: string) => void;
|
|
99
|
-
onFocus: (_event:
|
|
100
|
-
} &
|
|
10
|
+
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
11
|
+
} & import("..").DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
|
|
101
12
|
defaultIsOpen: boolean;
|
|
102
13
|
defaultValue: string;
|
|
103
14
|
disabled: string[];
|
|
104
15
|
disabledDateFilter: (_: string) => boolean;
|
|
105
16
|
locale: string;
|
|
106
|
-
onBlur: (_event:
|
|
17
|
+
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
107
18
|
onChange: (_value: string) => void;
|
|
108
|
-
onFocus: (_event:
|
|
109
|
-
} &
|
|
19
|
+
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
20
|
+
} & import("..").DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "disabled" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "defaultIsOpen">> & Partial<Pick<{
|
|
110
21
|
defaultIsOpen: boolean;
|
|
111
22
|
defaultValue: string;
|
|
112
23
|
disabled: string[];
|
|
113
24
|
disabledDateFilter: (_: string) => boolean;
|
|
114
25
|
locale: string;
|
|
115
|
-
onBlur: (_event:
|
|
26
|
+
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
116
27
|
onChange: (_value: string) => void;
|
|
117
|
-
onFocus: (_event:
|
|
118
|
-
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any
|
|
28
|
+
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
29
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>> | import("react").ForwardRefExoticComponent<Pick<import("..").DatePickerProps & {
|
|
30
|
+
icon?: import("react").ComponentType<import("@atlaskit/react-select").DropdownIndicatorProps<import("@atlaskit/select").OptionType, boolean, import("@atlaskit/react-select").GroupBase<import("@atlaskit/select").OptionType>>> | undefined;
|
|
31
|
+
selectProps?: (Omit<import("@atlaskit/select").SelectProps<import("@atlaskit/select").OptionType, false>, "placeholder" | "aria-describedby" | "aria-label" | "inputId"> & {
|
|
32
|
+
'aria-describedby'?: undefined;
|
|
33
|
+
'aria-label'?: undefined;
|
|
34
|
+
inputId?: undefined;
|
|
35
|
+
placeholder?: undefined;
|
|
36
|
+
} & {
|
|
37
|
+
inputValue?: string | undefined;
|
|
38
|
+
}) | undefined;
|
|
39
|
+
}, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
|
|
119
40
|
export default DatePicker;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -123,7 +123,7 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps, PickerSel
|
|
|
123
123
|
*/
|
|
124
124
|
isOpen?: boolean;
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* Set the field as required.
|
|
127
127
|
*/
|
|
128
128
|
isRequired?: boolean;
|
|
129
129
|
/**
|
|
@@ -304,7 +304,7 @@ export interface TimePickerBaseProps extends WithAnalyticsEventsProps, PickerSel
|
|
|
304
304
|
*/
|
|
305
305
|
isOpen?: boolean;
|
|
306
306
|
/**
|
|
307
|
-
*
|
|
307
|
+
* Set the field as required.
|
|
308
308
|
*/
|
|
309
309
|
isRequired?: boolean;
|
|
310
310
|
/**
|
|
@@ -420,7 +420,7 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
420
420
|
*/
|
|
421
421
|
isDisabled?: boolean;
|
|
422
422
|
/**
|
|
423
|
-
*
|
|
423
|
+
* Set the field as required.
|
|
424
424
|
*/
|
|
425
425
|
isRequired?: boolean;
|
|
426
426
|
/**
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { Component } from 'react';
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
7
|
+
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
8
|
+
import { type ActionMeta, type InputActionMeta } from '@atlaskit/select';
|
|
9
|
+
import { type DatePickerBaseProps } from '../types';
|
|
10
|
+
type DatePickerProps = typeof datePickerDefaultProps & DatePickerBaseProps;
|
|
11
|
+
interface State {
|
|
12
|
+
isKeyDown: boolean;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When being cleared from the icon the DatePicker is blurred.
|
|
16
|
+
* This variable defines whether the default onSelectBlur or onSelectFocus
|
|
17
|
+
* events should behave as normal.
|
|
18
|
+
*/
|
|
19
|
+
isFocused: boolean;
|
|
20
|
+
clearingFromIcon: boolean;
|
|
21
|
+
value: string;
|
|
22
|
+
calendarValue: string;
|
|
23
|
+
selectInputValue: string;
|
|
24
|
+
l10n: LocalizationProvider;
|
|
25
|
+
locale: string;
|
|
26
|
+
shouldSetFocusOnCurrentDay: boolean;
|
|
27
|
+
wasOpenedFromCalendarButton: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const datePickerDefaultProps: {
|
|
30
|
+
defaultIsOpen: boolean;
|
|
31
|
+
defaultValue: string;
|
|
32
|
+
disabled: string[];
|
|
33
|
+
disabledDateFilter: (_: string) => boolean;
|
|
34
|
+
locale: string;
|
|
35
|
+
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
36
|
+
onChange: (_value: string) => void;
|
|
37
|
+
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
38
|
+
};
|
|
39
|
+
declare class DatePickerComponent extends Component<DatePickerProps, State> {
|
|
40
|
+
static defaultProps: {
|
|
41
|
+
defaultIsOpen: boolean;
|
|
42
|
+
defaultValue: string;
|
|
43
|
+
disabled: string[];
|
|
44
|
+
disabledDateFilter: (_: string) => boolean;
|
|
45
|
+
locale: string;
|
|
46
|
+
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
47
|
+
onChange: (_value: string) => void;
|
|
48
|
+
onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
49
|
+
};
|
|
50
|
+
containerRef: HTMLElement | null;
|
|
51
|
+
calendarRef: React.RefObject<HTMLDivElement | null>;
|
|
52
|
+
calendarButtonRef: React.RefObject<HTMLButtonElement>;
|
|
53
|
+
constructor(props: any);
|
|
54
|
+
static getDerivedStateFromProps(nextProps: Readonly<DatePickerProps>, prevState: State): {
|
|
55
|
+
l10n: LocalizationProvider;
|
|
56
|
+
locale: string;
|
|
57
|
+
} | null;
|
|
58
|
+
getValue: () => string;
|
|
59
|
+
getIsOpen: () => boolean;
|
|
60
|
+
onCalendarChange: ({ iso }: {
|
|
61
|
+
iso: string;
|
|
62
|
+
}) => void;
|
|
63
|
+
onCalendarSelect: ({ iso }: {
|
|
64
|
+
iso: string;
|
|
65
|
+
}) => void;
|
|
66
|
+
onInputClick: () => void;
|
|
67
|
+
onContainerBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
68
|
+
onContainerFocus: () => void;
|
|
69
|
+
onSelectBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
70
|
+
onSelectFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
71
|
+
onTextInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
72
|
+
onInputKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
73
|
+
onCalendarButtonKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
74
|
+
onCalendarButtonClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
75
|
+
onClear: () => void;
|
|
76
|
+
onSelectChange: (_value: unknown, action: ActionMeta) => void;
|
|
77
|
+
handleSelectInputChange: (selectInputValue: string, actionMeta: InputActionMeta) => void;
|
|
78
|
+
getContainerRef: (ref: HTMLElement | null) => void;
|
|
79
|
+
render(): jsx.JSX.Element;
|
|
80
|
+
}
|
|
81
|
+
export { DatePickerComponent as DatePickerWithoutAnalytics };
|
|
82
|
+
/**
|
|
83
|
+
* __Date picker__
|
|
84
|
+
*
|
|
85
|
+
* A date picker allows the user to select a particular date.
|
|
86
|
+
*
|
|
87
|
+
* - [Examples](https://atlassian.design/components/datetime-picker/date-picker/examples)
|
|
88
|
+
* - [Code](https://atlassian.design/components/datetime-picker/date-picker/code)
|
|
89
|
+
* - [Usage](https://atlassian.design/components/datetime-picker/date-picker/usage)
|
|
90
|
+
*/
|
|
91
|
+
declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<{
|
|
92
|
+
defaultIsOpen: boolean;
|
|
93
|
+
defaultValue: string;
|
|
94
|
+
disabled: string[];
|
|
95
|
+
disabledDateFilter: (_: string) => boolean;
|
|
96
|
+
locale: string;
|
|
97
|
+
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
98
|
+
onChange: (_value: string) => void;
|
|
99
|
+
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
100
|
+
} & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
|
|
101
|
+
defaultIsOpen: boolean;
|
|
102
|
+
defaultValue: string;
|
|
103
|
+
disabled: string[];
|
|
104
|
+
disabledDateFilter: (_: string) => boolean;
|
|
105
|
+
locale: string;
|
|
106
|
+
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
107
|
+
onChange: (_value: string) => void;
|
|
108
|
+
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
109
|
+
} & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "disabled" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "defaultIsOpen">> & Partial<Pick<{
|
|
110
|
+
defaultIsOpen: boolean;
|
|
111
|
+
defaultValue: string;
|
|
112
|
+
disabled: string[];
|
|
113
|
+
disabledDateFilter: (_: string) => boolean;
|
|
114
|
+
locale: string;
|
|
115
|
+
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
116
|
+
onChange: (_value: string) => void;
|
|
117
|
+
onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
118
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
|
|
119
|
+
export default DatePicker;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type DropdownIndicatorProps, type GroupType, type OptionType } from '@atlaskit/select';
|
|
3
|
+
import { type DatePickerBaseProps, type DateTimePickerSelectProps } from '../types';
|
|
4
|
+
export type DatePickerProps = DatePickerBaseProps & {
|
|
5
|
+
icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
|
|
6
|
+
selectProps?: DateTimePickerSelectProps & {
|
|
7
|
+
inputValue?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* __Date picker__
|
|
12
|
+
*
|
|
13
|
+
* A date picker allows the user to select a particular date.
|
|
14
|
+
*
|
|
15
|
+
* - [Examples](https://atlassian.design/components/datetime-picker/date-picker/examples)
|
|
16
|
+
* - [Code](https://atlassian.design/components/datetime-picker/date-picker/code)
|
|
17
|
+
* - [Usage](https://atlassian.design/components/datetime-picker/date-picker/usage)
|
|
18
|
+
*/
|
|
19
|
+
declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<DatePickerBaseProps & {
|
|
20
|
+
icon?: import("react").ComponentType<DropdownIndicatorProps<OptionType, boolean, GroupType<OptionType>>> | undefined;
|
|
21
|
+
selectProps?: (Omit<import("@atlaskit/select").SelectProps<OptionType, false>, "placeholder" | "aria-describedby" | "aria-label" | "inputId"> & {
|
|
22
|
+
'aria-describedby'?: undefined;
|
|
23
|
+
'aria-label'?: undefined;
|
|
24
|
+
inputId?: undefined;
|
|
25
|
+
placeholder?: undefined;
|
|
26
|
+
} & {
|
|
27
|
+
inputValue?: string | undefined;
|
|
28
|
+
}) | undefined;
|
|
29
|
+
}, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "value" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
|
|
30
|
+
export default DatePicker;
|