@atlaskit/datetime-picker 13.0.8 → 13.0.10

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.
@@ -1,117 +1,6 @@
1
1
  import React from 'react';
2
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
- import { ActionMeta, OptionType, SelectProps, ValueType } from '@atlaskit/select';
4
- import { Appearance, Spacing } from '../types';
5
- export interface TimePickerBaseProps extends WithAnalyticsEventsProps {
6
- /**
7
- * Set the appearance of the picker.
8
- * `subtle` will remove the borders, background, and icon.
9
- *
10
- * __NOTE:__ Appearance values will be ignored if styles are parsed through `selectProps`.
11
- */
12
- appearance?: Appearance;
13
- /**
14
- * Set the picker to autofocus on mount.
15
- */
16
- autoFocus?: boolean;
17
- /**
18
- * The default for `isOpen`.
19
- */
20
- defaultIsOpen?: boolean;
21
- /**
22
- * The default for `value`.
23
- */
24
- defaultValue?: string;
25
- /**
26
- * A function for formatting the displayed time value in the input. By default parses with an internal time parser, and formats using the [date-fns format function]((https://date-fns.org/v1.29.0/docs/format))
27
- */
28
- formatDisplayLabel?: (time: string, timeFormat: string) => string;
29
- /**
30
- * Set the id of the field.
31
- * Associates a `<label></label>` with the field.
32
- */
33
- id?: string;
34
- /**
35
- * Props to apply to the container. *
36
- */
37
- innerProps?: React.AllHTMLAttributes<HTMLElement>;
38
- /**
39
- * Set if the field is disabled.
40
- */
41
- isDisabled?: boolean;
42
- /**
43
- * Set if the dropdown is open. Will be `false` if not provided.
44
- */
45
- isOpen?: boolean;
46
- /**
47
- * The name of the field.
48
- */
49
- name?: string;
50
- /**
51
- * Called when the field is blurred.
52
- */
53
- onBlur?: React.FocusEventHandler<HTMLElement>;
54
- /**
55
- * Called when the value changes. The only argument is an ISO time or empty string.
56
- */
57
- onChange?: (value: string) => void;
58
- /**
59
- * Called when the field is focused.
60
- */
61
- onFocus?: React.FocusEventHandler<HTMLElement>;
62
- /**
63
- * A function for parsing input characters and transforming them into either a string or a Date object.
64
- * By default parses the string based off the locale.
65
- */
66
- parseInputValue?: (time: string, timeFormat: string) => string | Date;
67
- /**
68
- * Props to apply to the select.
69
- */
70
- selectProps?: SelectProps<any>;
71
- /**
72
- * The spacing for the select control.
73
- *
74
- * Compact is `gridSize() * 4`, default is `gridSize * 5`.
75
- */
76
- spacing?: Spacing;
77
- /**
78
- * The times shown in the dropdown.
79
- */
80
- times?: string[];
81
- /**
82
- * Set if users can edit the input, allowing them to add custom times.
83
- */
84
- timeIsEditable?: boolean;
85
- /**
86
- * The ISO time that should be used as the input value.
87
- */
88
- value?: string;
89
- /**
90
- * Set if the picker has an invalid value.
91
- */
92
- isInvalid?: boolean;
93
- /**
94
- * Hides icon for dropdown indicator.
95
- */
96
- hideIcon?: boolean;
97
- /**
98
- * Time format that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
99
- */
100
- timeFormat?: string;
101
- /**
102
- * Placeholder text displayed in input.
103
- */
104
- placeholder?: string;
105
- /**
106
- * Locale used to format the time. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
107
- */
108
- locale?: string;
109
- /**
110
- * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests:
111
- * - `{testId}--container` wrapping element of time-picker
112
- */
113
- testId?: string;
114
- }
2
+ import { ActionMeta, OptionType, ValueType } from '@atlaskit/select';
3
+ import { Appearance, Spacing, TimePickerBaseProps } from '../types';
115
4
  type TimePickerProps = typeof timePickerDefaultProps & TimePickerBaseProps;
116
5
  interface State {
117
6
  isOpen: boolean;
@@ -189,7 +78,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
189
78
  render(): JSX.Element;
190
79
  }
191
80
  export { TimePicker as TimePickerWithoutAnalytics };
192
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable">> & Partial<Pick<{
81
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "value" | "placeholder" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "id" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable">> & Partial<Pick<{
193
82
  appearance: Appearance;
194
83
  autoFocus: boolean;
195
84
  defaultIsOpen: boolean;
@@ -209,5 +98,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePicke
209
98
  times: string[];
210
99
  timeIsEditable: boolean;
211
100
  locale: string;
212
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "value" | "id" | "key" | "defaultValue" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "analyticsContext" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
101
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "innerProps" | "isDisabled" | "selectProps" | "appearance" | "value" | "id" | "key" | "defaultValue" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "locale" | "timeIsEditable" | "timeFormat" | "analyticsContext"> & React.RefAttributes<any>>;
213
102
  export default _default;
@@ -1,7 +1,4 @@
1
1
  export { default as DatePicker } from './components/date-picker';
2
- export type { DatePickerBaseProps as DatePickerProps } from './components/date-picker';
3
2
  export { default as TimePicker } from './components/time-picker';
4
- export type { TimePickerBaseProps as TimePickerProps } from './components/time-picker';
5
3
  export { default as DateTimePicker } from './components/date-time-picker';
6
- export type { DateTimePickerBaseProps as DateTimePickerProps } from './components/date-time-picker';
7
- export type { Appearance, Spacing } from './types';
4
+ export type { Appearance, Spacing, DatePickerBaseProps as DatePickerProps, TimePickerBaseProps as TimePickerProps, DateTimePickerBaseProps as DateTimePickerProps, } from './types';
@@ -1,2 +1,369 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { DropdownIndicatorProps, OptionType, SelectProps } from '@atlaskit/select';
1
4
  export type Appearance = 'default' | 'subtle' | 'none';
2
5
  export type Spacing = 'compact' | 'default';
6
+ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
7
+ /**
8
+ * Set the appearance of the picker.
9
+ *
10
+ * `subtle` will remove the borders, background, and icon.
11
+ *
12
+ *NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
13
+ */
14
+ appearance?: Appearance;
15
+ /**
16
+ * Set the picker to autofocus on mount.
17
+ */
18
+ autoFocus?: boolean;
19
+ /**
20
+ * The default for `isOpen`. Will be `false` if not provided.
21
+ */
22
+ defaultIsOpen?: boolean;
23
+ /**
24
+ * The default for `value`.
25
+ */
26
+ defaultValue?: string;
27
+ /**
28
+ * An array of ISO dates that should be disabled on the calendar. This does not affect what users can type into the picker.
29
+ */
30
+ disabled?: string[];
31
+ /**
32
+ * A filter function for disabling dates on the calendar. This does not affect what users can type into the picker.
33
+ *
34
+ * The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
35
+ */
36
+ disabledDateFilter?: (date: string) => boolean;
37
+ /**
38
+ * The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker.
39
+ */
40
+ maxDate?: string;
41
+ /**
42
+ * The earliest enabled date. Dates before this are disabled on the calendar. This does not affect what users can type into the picker.
43
+ */
44
+ minDate?: string;
45
+ /**
46
+ * The icon shown in the picker.
47
+ */
48
+ icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
49
+ /**
50
+ * Set the id of the field.
51
+ * Associates a `<label></label>` with the field.
52
+ */
53
+ id?: string;
54
+ /**
55
+ * Props to apply to the container.
56
+ */
57
+ innerProps?: React.AllHTMLAttributes<HTMLElement>;
58
+ /**
59
+ * Set if the picker is disabled.
60
+ */
61
+ isDisabled?: boolean;
62
+ /**
63
+ * Set if the picker is open.
64
+ */
65
+ isOpen?: boolean;
66
+ /**
67
+ * The name of the field.
68
+ */
69
+ name?: string;
70
+ /**
71
+ * The aria-label attribute associated with the next-month arrow.
72
+ */
73
+ nextMonthLabel?: string;
74
+ /**
75
+ * Called when the field is blurred.
76
+ */
77
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
78
+ /**
79
+ * Called when the value changes. The only argument is an ISO time or empty string.
80
+ */
81
+ onChange?: (value: string) => void;
82
+ /**
83
+ * Called when the field is focused.
84
+ */
85
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
86
+ /**
87
+ * A function for parsing input characters and transforming them into a Date object.
88
+ * By default parses the date string based off the locale.
89
+ */
90
+ parseInputValue?: (date: string, dateFormat: string) => Date;
91
+ /**
92
+ * 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.
93
+ */
94
+ formatDisplayLabel?: (value: string, dateFormat: string) => string;
95
+ /**
96
+ * The aria-label attribute associated with the previous-month arrow.
97
+ */
98
+ previousMonthLabel?: string;
99
+ /**
100
+ * Props to apply to the select. This can be used to set options such as placeholder text.
101
+ * See [the `Select` documentation for further information](/components/select).
102
+ */
103
+ selectProps?: SelectProps<any>;
104
+ /**
105
+ * The spacing for the select control.
106
+ *
107
+ * Compact is `gridSize() * 4`, default is `gridSize * 5`.
108
+ */
109
+ spacing?: Spacing;
110
+ /**
111
+ * The ISO time used as the input value.
112
+ */
113
+ value?: string;
114
+ /**
115
+ * Set if the picker has an invalid value.
116
+ */
117
+ isInvalid?: boolean;
118
+ /**
119
+ * Hides icon for dropdown indicator.
120
+ */
121
+ hideIcon?: boolean;
122
+ /**
123
+ * Format the date with a string that is accepted by [date-fn's format function](https://date-fns.org/v1.29.0/docs/format).
124
+ */
125
+ dateFormat?: string;
126
+ /**
127
+ * Placeholder text displayed in input.
128
+ */
129
+ placeholder?: string;
130
+ /**
131
+ * Locale used to format the date and calendar. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
132
+ */
133
+ locale?: string;
134
+ /**
135
+ * 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
136
+ * - `{testId}--container` wrapping element of date-picker
137
+ * - `{testId}--calendar--container` nested calendar component
138
+ */
139
+ testId?: string;
140
+ /**
141
+ * Start day of the week for the calendar.
142
+ * - `0` sunday (default value)
143
+ * - `1` monday
144
+ * - `2` tuesday
145
+ * - `3` wednesday
146
+ * - `4` thursday
147
+ * - `5` friday
148
+ * - `6` saturday
149
+ */
150
+ weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
151
+ }
152
+ export interface TimePickerBaseProps extends WithAnalyticsEventsProps {
153
+ /**
154
+ * Set the appearance of the picker.
155
+ * `subtle` will remove the borders, background, and icon.
156
+ *
157
+ * __NOTE:__ Appearance values will be ignored if styles are parsed through `selectProps`.
158
+ */
159
+ appearance?: Appearance;
160
+ /**
161
+ * Set the picker to autofocus on mount.
162
+ */
163
+ autoFocus?: boolean;
164
+ /**
165
+ * The default for `isOpen`.
166
+ */
167
+ defaultIsOpen?: boolean;
168
+ /**
169
+ * The default for `value`.
170
+ */
171
+ defaultValue?: string;
172
+ /**
173
+ * A function for formatting the displayed time value in the input. By default parses with an internal time parser, and formats using the [date-fns format function]((https://date-fns.org/v1.29.0/docs/format))
174
+ */
175
+ formatDisplayLabel?: (time: string, timeFormat: string) => string;
176
+ /**
177
+ * Set the id of the field.
178
+ * Associates a `<label></label>` with the field.
179
+ */
180
+ id?: string;
181
+ /**
182
+ * Props to apply to the container. *
183
+ */
184
+ innerProps?: React.AllHTMLAttributes<HTMLElement>;
185
+ /**
186
+ * Set if the field is disabled.
187
+ */
188
+ isDisabled?: boolean;
189
+ /**
190
+ * Set if the dropdown is open. Will be `false` if not provided.
191
+ */
192
+ isOpen?: boolean;
193
+ /**
194
+ * The name of the field.
195
+ */
196
+ name?: string;
197
+ /**
198
+ * Called when the field is blurred.
199
+ */
200
+ onBlur?: React.FocusEventHandler<HTMLElement>;
201
+ /**
202
+ * Called when the value changes. The only argument is an ISO time or empty string.
203
+ */
204
+ onChange?: (value: string) => void;
205
+ /**
206
+ * Called when the field is focused.
207
+ */
208
+ onFocus?: React.FocusEventHandler<HTMLElement>;
209
+ /**
210
+ * A function for parsing input characters and transforming them into either a string or a Date object.
211
+ * By default parses the string based off the locale.
212
+ */
213
+ parseInputValue?: (time: string, timeFormat: string) => string | Date;
214
+ /**
215
+ * Props to apply to the select.
216
+ */
217
+ selectProps?: SelectProps<any>;
218
+ /**
219
+ * The spacing for the select control.
220
+ *
221
+ * Compact is `gridSize() * 4`, default is `gridSize * 5`.
222
+ */
223
+ spacing?: Spacing;
224
+ /**
225
+ * The times shown in the dropdown.
226
+ */
227
+ times?: string[];
228
+ /**
229
+ * Set if users can edit the input, allowing them to add custom times.
230
+ */
231
+ timeIsEditable?: boolean;
232
+ /**
233
+ * The ISO time that should be used as the input value.
234
+ */
235
+ value?: string;
236
+ /**
237
+ * Set if the picker has an invalid value.
238
+ */
239
+ isInvalid?: boolean;
240
+ /**
241
+ * Hides icon for dropdown indicator.
242
+ */
243
+ hideIcon?: boolean;
244
+ /**
245
+ * Time format that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
246
+ */
247
+ timeFormat?: string;
248
+ /**
249
+ * Placeholder text displayed in input.
250
+ */
251
+ placeholder?: string;
252
+ /**
253
+ * Locale used to format the time. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
254
+ */
255
+ locale?: string;
256
+ /**
257
+ * 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:
258
+ * - `{testId}--container` wrapping element of time-picker
259
+ */
260
+ testId?: string;
261
+ }
262
+ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
263
+ /**
264
+ * Set the appearance of the picker.
265
+ *
266
+ * `subtle` will remove the borders and background.
267
+ */
268
+ appearance?: Appearance;
269
+ /**
270
+ * Set the picker to autofocus on mount.
271
+ */
272
+ autoFocus?: boolean;
273
+ /**
274
+ * The default for `value`.
275
+ */
276
+ defaultValue?: string;
277
+ /**
278
+ * Set the id of the field.
279
+ */
280
+ id?: string;
281
+ /**
282
+ * Props to apply to the container. *
283
+ */
284
+ innerProps?: React.AllHTMLAttributes<HTMLElement>;
285
+ /**
286
+ * Set if the field is disabled.
287
+ */
288
+ isDisabled?: boolean;
289
+ /**
290
+ * The name of the field.
291
+ */
292
+ name?: string;
293
+ /**
294
+ * Called when the field is blurred.
295
+ */
296
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
297
+ /**
298
+ * 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.
299
+ */
300
+ onChange?: (value: string) => void;
301
+ /**
302
+ * Called when the field is focused.
303
+ */
304
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
305
+ /**
306
+ * The ISO time that should be used as the input value.
307
+ */
308
+ value?: string;
309
+ /**
310
+ * Set if users can edit the input, allowing them to add custom times.
311
+ */
312
+ timeIsEditable?: boolean;
313
+ /**
314
+ * Set if the picker has an invalid value.
315
+ */
316
+ isInvalid?: boolean;
317
+ /**
318
+ * Format the date with a string that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
319
+ */
320
+ dateFormat?: string;
321
+ /**
322
+ * Props applied to the `DatePicker`.
323
+ */
324
+ datePickerProps?: DatePickerBaseProps;
325
+ /**
326
+ * Props applied to the `TimePicker`.
327
+ */
328
+ timePickerProps?: TimePickerBaseProps;
329
+ /**
330
+ * Function used to parse datetime values into their date, time and timezone sub-values. *
331
+ */
332
+ parseValue?: (dateTimeValue: string, date: string, time: string, timezone: string) => {
333
+ dateValue: string;
334
+ timeValue: string;
335
+ zoneValue: string;
336
+ };
337
+ /**
338
+ * [Select props](/components/select) to pass onto the `DatePicker` component's `Select`. This can be used to set options such as placeholder text.
339
+ */
340
+ datePickerSelectProps?: SelectProps<any>;
341
+ /**
342
+ * [Select props](/components/select) to pass onto the `TimePicker` component's `Select`. This can be used to set options such as placeholder text.
343
+ */
344
+ timePickerSelectProps?: SelectProps<any>;
345
+ /**
346
+ * The times shown by the `TimePicker`.
347
+ */
348
+ times?: Array<string>;
349
+ /**
350
+ * 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).
351
+ */
352
+ timeFormat?: string;
353
+ /**
354
+ * The spacing for the select control.
355
+ *
356
+ * Compact is `gridSize() * 4`, default is `gridSize() * 5`.
357
+ */
358
+ spacing?: Spacing;
359
+ /**
360
+ * Locale used for formatting dates and times. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
361
+ */
362
+ locale?: string;
363
+ /**
364
+ * 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
365
+ * - `{testId}--datepicker--container` wrapping element of date-picker
366
+ * - `{testId}--timepicker--container` wrapping element of time-picker
367
+ */
368
+ testId?: string;
369
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "13.0.8",
3
+ "version": "13.0.10",
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/"
@@ -46,9 +46,9 @@
46
46
  "@atlaskit/locale": "^2.6.0",
47
47
  "@atlaskit/platform-feature-flags": "^0.2.0",
48
48
  "@atlaskit/popper": "^5.5.0",
49
- "@atlaskit/select": "^17.0.3",
49
+ "@atlaskit/select": "^17.1.0",
50
50
  "@atlaskit/theme": "^12.6.0",
51
- "@atlaskit/tokens": "^1.36.0",
51
+ "@atlaskit/tokens": "^1.38.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1",
54
54
  "date-fns": "^2.17.0",
@@ -61,7 +61,7 @@
61
61
  "devDependencies": {
62
62
  "@af/accessibility-testing": "*",
63
63
  "@af/integration-testing": "*",
64
- "@atlaskit/button": "^17.3.0",
64
+ "@atlaskit/button": "^17.4.0",
65
65
  "@atlaskit/docs": "*",
66
66
  "@atlaskit/form": "^9.0.3",
67
67
  "@atlaskit/modal-dialog": "^12.10.0",
@@ -109,6 +109,9 @@
109
109
  "platform.design-system-team.border-checkbox_nyoiu": {
110
110
  "type": "boolean"
111
111
  },
112
+ "platform.design-system-team.update-input-border-wdith_5abwv": {
113
+ "type": "boolean"
114
+ },
112
115
  "platform.design-system-team.date-picker-input-a11y-fix_cbbxs": {
113
116
  "type": "boolean"
114
117
  }