@atlaskit/datetime-picker 10.4.2 → 11.1.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 +35 -0
- package/dist/cjs/components/DatePicker.js +28 -28
- package/dist/cjs/components/DateTimePicker.js +90 -113
- package/dist/cjs/components/TimePicker.js +12 -9
- package/dist/cjs/components/utils.js +96 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/DatePicker.js +30 -30
- package/dist/es2019/components/DateTimePicker.js +87 -128
- package/dist/es2019/components/TimePicker.js +12 -13
- package/dist/es2019/components/utils.js +89 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/DatePicker.js +31 -30
- package/dist/esm/components/DateTimePicker.js +91 -103
- package/dist/esm/components/TimePicker.js +10 -9
- package/dist/esm/components/utils.js +89 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/DatePicker.d.ts +17 -16
- package/dist/types/components/DateTimePicker.d.ts +11 -11
- package/dist/types/components/TimePicker.d.ts +2 -2
- package/dist/types/components/utils.d.ts +1 -0
- package/package.json +17 -9
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Component } from 'react';
|
|
2
3
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
4
|
import { CalendarRef } from '@atlaskit/calendar';
|
|
4
5
|
import { LocalizationProvider } from '@atlaskit/locale';
|
|
@@ -23,7 +24,7 @@ export interface Props extends WithAnalyticsEventsProps {
|
|
|
23
24
|
disabled?: string[];
|
|
24
25
|
/**
|
|
25
26
|
A filter function for disabling dates on the calendar. This does not affect what users can type into the picker.
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
|
|
28
29
|
*/
|
|
29
30
|
disabledDateFilter?: (date: string) => boolean;
|
|
@@ -62,7 +63,7 @@ export interface Props extends WithAnalyticsEventsProps {
|
|
|
62
63
|
selectProps?: SelectProps;
|
|
63
64
|
/**
|
|
64
65
|
The spacing for the select control.
|
|
65
|
-
|
|
66
|
+
|
|
66
67
|
Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
67
68
|
*/
|
|
68
69
|
spacing?: Spacing;
|
|
@@ -120,7 +121,7 @@ declare const datePickerDefaultProps: {
|
|
|
120
121
|
disabled: string[];
|
|
121
122
|
disabledDateFilter: (_: string) => boolean;
|
|
122
123
|
hideIcon: boolean;
|
|
123
|
-
icon:
|
|
124
|
+
icon: import("react").ComponentType<import("react-select").IndicatorProps<OptionType, false, import("@atlaskit/select").GroupType<OptionType>>>;
|
|
124
125
|
id: string;
|
|
125
126
|
innerProps: {};
|
|
126
127
|
isDisabled: boolean;
|
|
@@ -133,9 +134,7 @@ declare const datePickerDefaultProps: {
|
|
|
133
134
|
spacing: Spacing;
|
|
134
135
|
locale: string;
|
|
135
136
|
};
|
|
136
|
-
declare class DatePicker extends
|
|
137
|
-
calendarRef: CalendarRef | null;
|
|
138
|
-
containerRef: HTMLElement | null;
|
|
137
|
+
declare class DatePicker extends Component<DatePickerProps, State> {
|
|
139
138
|
static defaultProps: {
|
|
140
139
|
appearance: Appearance;
|
|
141
140
|
autoFocus: boolean;
|
|
@@ -144,19 +143,21 @@ declare class DatePicker extends React.Component<DatePickerProps, State> {
|
|
|
144
143
|
disabled: string[];
|
|
145
144
|
disabledDateFilter: (_: string) => boolean;
|
|
146
145
|
hideIcon: boolean;
|
|
147
|
-
icon:
|
|
146
|
+
icon: import("react").ComponentType<import("react-select").IndicatorProps<OptionType, false, import("@atlaskit/select").GroupType<OptionType>>>;
|
|
148
147
|
id: string;
|
|
149
148
|
innerProps: {};
|
|
150
149
|
isDisabled: boolean;
|
|
151
150
|
isInvalid: boolean;
|
|
152
151
|
name: string;
|
|
153
|
-
onBlur: (event:
|
|
152
|
+
onBlur: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
154
153
|
onChange: (value: string) => void;
|
|
155
|
-
onFocus: (event:
|
|
154
|
+
onFocus: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
156
155
|
selectProps: {};
|
|
157
156
|
spacing: Spacing;
|
|
158
157
|
locale: string;
|
|
159
158
|
};
|
|
159
|
+
calendarRef: CalendarRef | null;
|
|
160
|
+
containerRef: HTMLElement | null;
|
|
160
161
|
constructor(props: any);
|
|
161
162
|
componentWillReceiveProps(nextProps: Readonly<DatePickerProps>): void;
|
|
162
163
|
getSafeState: () => {
|
|
@@ -196,7 +197,7 @@ declare class DatePicker extends React.Component<DatePickerProps, State> {
|
|
|
196
197
|
* 1. parseInputValue
|
|
197
198
|
* 2. locale
|
|
198
199
|
*/
|
|
199
|
-
parseDate: (date: string) => Date
|
|
200
|
+
parseDate: (date: string) => Date;
|
|
200
201
|
/**
|
|
201
202
|
* There are multiple props that can change how the date is formatted.
|
|
202
203
|
* The priority of props used is:
|
|
@@ -209,7 +210,7 @@ declare class DatePicker extends React.Component<DatePickerProps, State> {
|
|
|
209
210
|
render(): JSX.Element;
|
|
210
211
|
}
|
|
211
212
|
export { DatePicker as DatePickerWithoutAnalytics };
|
|
212
|
-
declare const _default:
|
|
213
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Pick<DatePickerProps, "testId" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "disabledDateFilter" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "maxDate" | "minDate" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "value" | "dateFormat" | "placeholder" | "weekStartDay">, "testId" | "maxDate" | "minDate" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "value" | "dateFormat" | "placeholder" | "weekStartDay"> & Partial<Pick<Pick<DatePickerProps, "testId" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "disabledDateFilter" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "maxDate" | "minDate" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "value" | "dateFormat" | "placeholder" | "weekStartDay">, "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "disabledDateFilter" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale">> & Partial<Pick<{
|
|
213
214
|
appearance: Appearance;
|
|
214
215
|
autoFocus: boolean;
|
|
215
216
|
defaultIsOpen: boolean;
|
|
@@ -217,17 +218,17 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Pick<DatePicke
|
|
|
217
218
|
disabled: string[];
|
|
218
219
|
disabledDateFilter: (_: string) => boolean;
|
|
219
220
|
hideIcon: boolean;
|
|
220
|
-
icon:
|
|
221
|
+
icon: import("react").ComponentType<import("react-select").IndicatorProps<OptionType, false, import("@atlaskit/select").GroupType<OptionType>>>;
|
|
221
222
|
id: string;
|
|
222
223
|
innerProps: {};
|
|
223
224
|
isDisabled: boolean;
|
|
224
225
|
isInvalid: boolean;
|
|
225
226
|
name: string;
|
|
226
|
-
onBlur: (event:
|
|
227
|
+
onBlur: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
227
228
|
onChange: (value: string) => void;
|
|
228
|
-
onFocus: (event:
|
|
229
|
+
onFocus: (event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
229
230
|
selectProps: {};
|
|
230
231
|
spacing: Spacing;
|
|
231
232
|
locale: string;
|
|
232
|
-
}, never>> &
|
|
233
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "disabledDateFilter" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "maxDate" | "minDate" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "value" | "dateFormat" | "placeholder" | "weekStartDay" | "key" | "analyticsContext"> & import("react").RefAttributes<any>>;
|
|
233
234
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
4
|
import { SelectProps } from '@atlaskit/select';
|
|
@@ -6,9 +7,9 @@ import { Props as DatePickerProps } from './DatePicker';
|
|
|
6
7
|
import { Props as TimePickerProps } from './TimePicker';
|
|
7
8
|
export interface Props extends WithAnalyticsEventsProps {
|
|
8
9
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* Set the appearance of the picker.
|
|
11
|
+
*
|
|
12
|
+
* `subtle` will remove the borders and background.
|
|
12
13
|
*/
|
|
13
14
|
appearance?: Appearance;
|
|
14
15
|
/** Set the picker to autofocus on mount. */
|
|
@@ -16,9 +17,8 @@ export interface Props extends WithAnalyticsEventsProps {
|
|
|
16
17
|
/** The default for `value`. */
|
|
17
18
|
defaultValue?: string;
|
|
18
19
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
20
|
+
* The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`.
|
|
21
|
+
* Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
22
22
|
*/
|
|
23
23
|
id?: string;
|
|
24
24
|
/** Props to apply to the container. **/
|
|
@@ -62,9 +62,9 @@ export interface Props extends WithAnalyticsEventsProps {
|
|
|
62
62
|
/** 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). */
|
|
63
63
|
timeFormat?: string;
|
|
64
64
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
* The spacing for the select control.
|
|
66
|
+
*
|
|
67
|
+
* Compact is `gridSize() * 4`, default is `gridSize() * 5`.
|
|
68
68
|
*/
|
|
69
69
|
spacing?: Spacing;
|
|
70
70
|
/** Locale used for formatting dates and times. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat). */
|
|
@@ -155,7 +155,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
|
|
|
155
155
|
render(): JSX.Element;
|
|
156
156
|
}
|
|
157
157
|
export { DateTimePicker as DateTimePickerWithoutAnalytics };
|
|
158
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Pick<DateTimePickerProps, "testId" | "appearance" | "
|
|
158
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Pick<DateTimePickerProps, "testId" | "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "value" | "dateFormat" | "times" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps" | "parseValue">, "testId" | "hideIcon" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Pick<DateTimePickerProps, "testId" | "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "value" | "dateFormat" | "times" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps" | "parseValue">, "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "times" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
|
|
159
159
|
appearance: string;
|
|
160
160
|
autoFocus: boolean;
|
|
161
161
|
isDisabled: boolean;
|
|
@@ -175,5 +175,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Pick<DateTimeP
|
|
|
175
175
|
times: string[];
|
|
176
176
|
spacing: string;
|
|
177
177
|
locale: string;
|
|
178
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "appearance" | "
|
|
178
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "value" | "dateFormat" | "key" | "analyticsContext" | "times" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps" | "parseValue"> & React.RefAttributes<any>>;
|
|
179
179
|
export default _default;
|
|
@@ -170,7 +170,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
|
|
|
170
170
|
render(): JSX.Element;
|
|
171
171
|
}
|
|
172
172
|
export { TimePicker as TimePickerWithoutAnalytics };
|
|
173
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Pick<TimePickerProps, "testId" | "appearance" | "
|
|
173
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Pick<TimePickerProps, "testId" | "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "value" | "placeholder" | "times" | "timeIsEditable" | "timeFormat">, "testId" | "isOpen" | "formatDisplayLabel" | "value" | "placeholder" | "timeFormat"> & Partial<Pick<Pick<TimePickerProps, "testId" | "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "value" | "placeholder" | "times" | "timeIsEditable" | "timeFormat">, "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "parseInputValue" | "times" | "timeIsEditable">> & Partial<Pick<{
|
|
174
174
|
appearance: Appearance;
|
|
175
175
|
autoFocus: boolean;
|
|
176
176
|
defaultIsOpen: boolean;
|
|
@@ -190,5 +190,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Pick<TimePicke
|
|
|
190
190
|
times: string[];
|
|
191
191
|
timeIsEditable: boolean;
|
|
192
192
|
locale: string;
|
|
193
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "appearance" | "
|
|
193
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "value" | "placeholder" | "key" | "analyticsContext" | "times" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
|
|
194
194
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function convertTokens(format: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.0",
|
|
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/"
|
|
@@ -26,16 +26,15 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
28
28
|
"@atlaskit/calendar": "^12.0.0",
|
|
29
|
-
"@atlaskit/
|
|
30
|
-
"@atlaskit/icon": "^21.7.0",
|
|
29
|
+
"@atlaskit/icon": "^21.9.0",
|
|
31
30
|
"@atlaskit/locale": "^2.1.0",
|
|
32
31
|
"@atlaskit/popper": "^5.2.0",
|
|
33
|
-
"@atlaskit/select": "^15.
|
|
34
|
-
"@atlaskit/theme": "^
|
|
32
|
+
"@atlaskit/select": "^15.2.0",
|
|
33
|
+
"@atlaskit/theme": "^12.0.0",
|
|
34
|
+
"@atlaskit/tokens": "^0.3.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"@emotion/core": "^10.0.9",
|
|
37
|
-
"
|
|
38
|
-
"date-fns": "^1.30.1",
|
|
37
|
+
"date-fns": "^2.17.0",
|
|
39
38
|
"lodash": "^4.17.15",
|
|
40
39
|
"react-scrolllock": "^5.0.1"
|
|
41
40
|
},
|
|
@@ -44,15 +43,20 @@
|
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
45
|
"@atlaskit/build-utils": "*",
|
|
47
|
-
"@atlaskit/button": "^
|
|
46
|
+
"@atlaskit/button": "^16.0.0",
|
|
48
47
|
"@atlaskit/docs": "*",
|
|
48
|
+
"@atlaskit/field-base": "^15.0.5",
|
|
49
49
|
"@atlaskit/field-range": "^9.0.0",
|
|
50
|
-
"@atlaskit/
|
|
50
|
+
"@atlaskit/form": "^8.4.0",
|
|
51
|
+
"@atlaskit/modal-dialog": "^12.1.0",
|
|
52
|
+
"@atlaskit/section-message": "^6.0.0",
|
|
51
53
|
"@atlaskit/ssr": "*",
|
|
52
54
|
"@atlaskit/textfield": "^5.0.0",
|
|
55
|
+
"@atlaskit/toggle": "^12.3.0",
|
|
53
56
|
"@atlaskit/visual-regression": "*",
|
|
54
57
|
"@atlaskit/webdriver-runner": "*",
|
|
55
58
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
59
|
+
"@emotion/core": "^10.0.9",
|
|
56
60
|
"@testing-library/react": "^8.0.1",
|
|
57
61
|
"enzyme": "^3.10.0",
|
|
58
62
|
"enzyme-to-json": "^3.3.0",
|
|
@@ -65,6 +69,10 @@
|
|
|
65
69
|
"techstack": {
|
|
66
70
|
"@atlassian/frontend": {
|
|
67
71
|
"import-structure": "atlassian-conventions"
|
|
72
|
+
},
|
|
73
|
+
"@repo/internal": {
|
|
74
|
+
"styling": "emotion",
|
|
75
|
+
"theming": "tokens"
|
|
68
76
|
}
|
|
69
77
|
},
|
|
70
78
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
|