@atlaskit/datetime-picker 13.11.3 → 14.0.1
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 +19 -0
- package/codemods/14.0.0-remove-duplicate-and-unused-props.tsx +432 -0
- package/codemods/__tests__/next-remove-duplicate-and-unused-props.tsx +1225 -0
- package/codemods/utils/helpers.tsx +306 -0
- package/dist/cjs/components/date-picker.js +1 -1
- package/dist/cjs/components/date-time-picker.js +24 -25
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/es2019/components/date-picker.js +1 -1
- package/dist/es2019/components/date-time-picker.js +24 -26
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/esm/components/date-picker.js +1 -1
- package/dist/esm/components/date-time-picker.js +24 -25
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/types/components/date-time-picker.d.ts +1 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +47 -31
- package/dist/types-ts4.5/components/date-time-picker.d.ts +1 -3
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +47 -31
- package/package.json +4 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -5,6 +6,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
var _excluded = ["selectProps"],
|
|
10
|
+
_excluded2 = ["selectProps"];
|
|
8
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
12
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -28,7 +31,7 @@ import { convertTokens } from '../internal/parse-tokens';
|
|
|
28
31
|
import DatePicker from './date-picker';
|
|
29
32
|
import TimePicker from './time-picker';
|
|
30
33
|
var packageName = "@atlaskit/datetime-picker";
|
|
31
|
-
var packageVersion = "
|
|
34
|
+
var packageVersion = "14.0.1";
|
|
32
35
|
// Make DatePicker 50% the width of DateTimePicker
|
|
33
36
|
// If rendering an icon container, shrink the TimePicker
|
|
34
37
|
var datePickerContainerStyles = css({
|
|
@@ -92,8 +95,6 @@ var dateTimePickerDefaultProps = {
|
|
|
92
95
|
isInvalid: false,
|
|
93
96
|
datePickerProps: {},
|
|
94
97
|
timePickerProps: {},
|
|
95
|
-
datePickerSelectProps: {},
|
|
96
|
-
timePickerSelectProps: {},
|
|
97
98
|
times: defaultTimes,
|
|
98
99
|
spacing: 'default',
|
|
99
100
|
locale: 'en-US'
|
|
@@ -229,9 +230,7 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
229
230
|
ariaDescribedBy = _this$props['aria-describedby'],
|
|
230
231
|
appearance = _this$props.appearance,
|
|
231
232
|
autoFocus = _this$props.autoFocus,
|
|
232
|
-
|
|
233
|
-
datePickerProps = _this$props.datePickerProps,
|
|
234
|
-
datePickerSelectProps = _this$props.datePickerSelectProps,
|
|
233
|
+
datePickerPropsWithSelectProps = _this$props.datePickerProps,
|
|
235
234
|
id = _this$props.id,
|
|
236
235
|
innerProps = _this$props.innerProps,
|
|
237
236
|
isDisabled = _this$props.isDisabled,
|
|
@@ -240,29 +239,25 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
240
239
|
name = _this$props.name,
|
|
241
240
|
spacing = _this$props.spacing,
|
|
242
241
|
testId = _this$props.testId,
|
|
243
|
-
|
|
244
|
-
timeIsEditable = _this$props.timeIsEditable,
|
|
245
|
-
timePickerProps = _this$props.timePickerProps,
|
|
246
|
-
timePickerSelectProps = _this$props.timePickerSelectProps,
|
|
247
|
-
times = _this$props.times;
|
|
242
|
+
timePickerPropsWithSelectProps = _this$props.timePickerProps;
|
|
248
243
|
var value = this.getValue();
|
|
249
244
|
var isFocused = this.state.isFocused;
|
|
250
245
|
var parsedValues = this.getParsedValues();
|
|
251
246
|
var dateValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.dateValue;
|
|
252
247
|
var timeValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.timeValue;
|
|
253
|
-
var
|
|
254
|
-
|
|
255
|
-
var
|
|
256
|
-
|
|
248
|
+
var datePickerSelectProps = datePickerPropsWithSelectProps.selectProps,
|
|
249
|
+
datePickerProps = _objectWithoutProperties(datePickerPropsWithSelectProps, _excluded);
|
|
250
|
+
var datePickerAriaDescribedBy = datePickerProps['aria-describedby'] || ariaDescribedBy;
|
|
251
|
+
var datePickerLabel = datePickerProps.label || datePickerDefaultAriaLabel;
|
|
257
252
|
var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
|
|
258
|
-
|
|
259
|
-
'aria-label': datePickerProps['label'] || datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
260
|
-
styles: mergeStyles(styles, datePickerStyles)
|
|
253
|
+
styles: mergeStyles(styles, datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.styles)
|
|
261
254
|
});
|
|
255
|
+
var timePickerSelectProps = timePickerPropsWithSelectProps.selectProps,
|
|
256
|
+
timePickerProps = _objectWithoutProperties(timePickerPropsWithSelectProps, _excluded2);
|
|
257
|
+
var timePickerAriaDescribedBy = timePickerProps['aria-describedby'] || ariaDescribedBy;
|
|
258
|
+
var timePickerLabel = timePickerProps.label || timePickerDefaultAriaLabel;
|
|
262
259
|
var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
|
|
263
|
-
|
|
264
|
-
'aria-label': timePickerProps['label'] || timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
265
|
-
styles: mergeStyles(styles, timePickerStyles)
|
|
260
|
+
styles: mergeStyles(styles, timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.styles)
|
|
266
261
|
});
|
|
267
262
|
|
|
268
263
|
// Render DateTimePicker's IconContainer when a value has been filled
|
|
@@ -284,8 +279,9 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
284
279
|
css: datePickerContainerStyles
|
|
285
280
|
}, jsx(DatePicker, {
|
|
286
281
|
appearance: appearance,
|
|
282
|
+
"aria-describedby": datePickerAriaDescribedBy,
|
|
287
283
|
autoFocus: datePickerProps.autoFocus || autoFocus,
|
|
288
|
-
dateFormat: datePickerProps.dateFormat
|
|
284
|
+
dateFormat: datePickerProps.dateFormat,
|
|
289
285
|
defaultIsOpen: datePickerProps.defaultIsOpen,
|
|
290
286
|
defaultValue: datePickerProps.defaultValue,
|
|
291
287
|
disabled: datePickerProps.disabled,
|
|
@@ -298,6 +294,7 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
298
294
|
isDisabled: datePickerProps.isDisabled || isDisabled,
|
|
299
295
|
isInvalid: datePickerProps.isInvalid || isInvalid,
|
|
300
296
|
isOpen: datePickerProps.isOpen,
|
|
297
|
+
label: datePickerLabel,
|
|
301
298
|
locale: datePickerProps.locale || locale,
|
|
302
299
|
maxDate: datePickerProps.maxDate,
|
|
303
300
|
minDate: datePickerProps.minDate,
|
|
@@ -318,6 +315,7 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
318
315
|
css: timePickerContainerStyles
|
|
319
316
|
}, jsx(TimePicker, {
|
|
320
317
|
appearance: timePickerProps.appearance || appearance,
|
|
318
|
+
"aria-describedby": timePickerAriaDescribedBy,
|
|
321
319
|
autoFocus: timePickerProps.autoFocus,
|
|
322
320
|
defaultIsOpen: timePickerProps.defaultIsOpen,
|
|
323
321
|
defaultValue: timePickerProps.defaultValue,
|
|
@@ -328,6 +326,7 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
328
326
|
isDisabled: timePickerProps.isDisabled || isDisabled,
|
|
329
327
|
isInvalid: timePickerProps.isInvalid || isInvalid,
|
|
330
328
|
isOpen: timePickerProps.isOpen,
|
|
329
|
+
label: timePickerLabel,
|
|
331
330
|
locale: timePickerProps.locale || locale,
|
|
332
331
|
name: timePickerProps.name,
|
|
333
332
|
onBlur: timePickerProps.onBlur || this.onBlur,
|
|
@@ -338,9 +337,9 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
338
337
|
selectProps: mergedTimePickerSelectProps,
|
|
339
338
|
spacing: timePickerProps.spacing || spacing,
|
|
340
339
|
testId: timePickerProps.testId || testId && "".concat(testId, "--timepicker"),
|
|
341
|
-
timeFormat: timePickerProps.timeFormat
|
|
342
|
-
timeIsEditable: timePickerProps.timeIsEditable
|
|
343
|
-
times: timePickerProps.times
|
|
340
|
+
timeFormat: timePickerProps.timeFormat,
|
|
341
|
+
timeIsEditable: timePickerProps.timeIsEditable,
|
|
342
|
+
times: timePickerProps.times,
|
|
344
343
|
value: timeValue
|
|
345
344
|
})), isClearable && !isDisabled ? jsx("button", {
|
|
346
345
|
css: iconContainerStyles,
|
|
@@ -27,7 +27,7 @@ import parseTime from '../internal/parse-time';
|
|
|
27
27
|
import { convertTokens } from '../internal/parse-tokens';
|
|
28
28
|
import { makeSingleValue } from '../internal/single-value';
|
|
29
29
|
var packageName = "@atlaskit/datetime-picker";
|
|
30
|
-
var packageVersion = "
|
|
30
|
+
var packageVersion = "14.0.1";
|
|
31
31
|
var menuStyles = {
|
|
32
32
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
33
33
|
position: 'static',
|
|
@@ -28,8 +28,6 @@ declare const dateTimePickerDefaultProps: {
|
|
|
28
28
|
isInvalid: boolean;
|
|
29
29
|
datePickerProps: {};
|
|
30
30
|
timePickerProps: {};
|
|
31
|
-
datePickerSelectProps: {};
|
|
32
|
-
timePickerSelectProps: {};
|
|
33
31
|
times: string[];
|
|
34
32
|
spacing: NonNullable<import("../types").Spacing | undefined>;
|
|
35
33
|
locale: string;
|
|
@@ -72,5 +70,5 @@ export { DateTimePickerComponent as DateTimePickerWithoutAnalytics };
|
|
|
72
70
|
* - [Code](https://atlassian.design/components/datetime-picker/code)
|
|
73
71
|
* - [Usage](https://atlassian.design/components/datetime-picker/usage)
|
|
74
72
|
*/
|
|
75
|
-
declare const DateTimePicker: React.ForwardRefExoticComponent<Pick<Pick<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "
|
|
73
|
+
declare const DateTimePicker: React.ForwardRefExoticComponent<Pick<Pick<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "parseValue">> & Partial<Pick<DateTimePickerProps, "ref" | "createAnalyticsEvent">>, "times" | "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "appearance" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "analyticsContext" | "createAnalyticsEvent" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any>>;
|
|
76
74
|
export default DateTimePicker;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as DatePicker } from './components/date-picker';
|
|
2
2
|
export { default as TimePicker } from './components/time-picker';
|
|
3
3
|
export { default as DateTimePicker } from './components/date-time-picker';
|
|
4
|
-
export type { Appearance, Spacing, DatePickerBaseProps as DatePickerProps, TimePickerBaseProps as TimePickerProps, DateTimePickerBaseProps as DateTimePickerProps, } from './types';
|
|
4
|
+
export type { Appearance, Spacing, DatePickerBaseProps as DatePickerProps, TimePickerBaseProps as TimePickerProps, DateTimePickerBaseProps as DateTimePickerProps, DateTimePickerSelectProps, } from './types';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -4,12 +4,48 @@ import { type DropdownIndicatorProps, type OptionType, type SelectProps } from '
|
|
|
4
4
|
export type Appearance = 'default' | 'subtle' | 'none';
|
|
5
5
|
export type Spacing = 'compact' | 'default';
|
|
6
6
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
7
|
+
/**
|
|
8
|
+
* Props to apply to the select. These include all of [the props from our
|
|
9
|
+
* `Select` component](/components/select). For the following properties, use
|
|
10
|
+
* the top-level prop alternatives:
|
|
11
|
+
*
|
|
12
|
+
* - `aria-describedby`, use `aria-describedby` prop
|
|
13
|
+
* - `aria-label`, use `label` prop
|
|
14
|
+
* - `inputId`, use `id` prop
|
|
15
|
+
* - `placeholder`, use `placeholder` prop
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Don't do this
|
|
21
|
+
* <DatePicker selectProps={{
|
|
22
|
+
* 'aria-describedby': 'helper-id'
|
|
23
|
+
* }} />
|
|
24
|
+
*
|
|
25
|
+
* // Do this
|
|
26
|
+
* <DatePicker aria-describedby="helper-id" />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type DateTimePickerSelectProps = Combine<SelectProps<OptionType>, {
|
|
30
|
+
/**
|
|
31
|
+
* Use the `aria-describedby` prop on the picker..
|
|
32
|
+
*/
|
|
33
|
+
'aria-describedby'?: never;
|
|
34
|
+
/**
|
|
35
|
+
* Use the `label` prop on the picker..
|
|
36
|
+
*/
|
|
37
|
+
'aria-label'?: never;
|
|
38
|
+
/**
|
|
39
|
+
* Use the `id` prop on the picker.`.
|
|
40
|
+
*/
|
|
41
|
+
inputId?: never;
|
|
42
|
+
/**
|
|
43
|
+
* Use the `placeholder` prop on the picker.
|
|
44
|
+
*/
|
|
45
|
+
placeholder?: never;
|
|
46
|
+
}>;
|
|
7
47
|
interface PickerSelectProps {
|
|
8
|
-
|
|
9
|
-
* Props to apply to the select. These include all of [the props from our
|
|
10
|
-
* `Select` component](/components/select).
|
|
11
|
-
*/
|
|
12
|
-
selectProps?: Combine<SelectProps<OptionType>, {}>;
|
|
48
|
+
selectProps?: DateTimePickerSelectProps;
|
|
13
49
|
}
|
|
14
50
|
export interface DatePickerBaseProps extends WithAnalyticsEventsProps, PickerSelectProps {
|
|
15
51
|
/**
|
|
@@ -175,6 +211,8 @@ export interface TimePickerBaseProps extends WithAnalyticsEventsProps, PickerSel
|
|
|
175
211
|
* `subtle` will remove the borders, background, and icon.
|
|
176
212
|
*
|
|
177
213
|
* __NOTE:__ Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
214
|
+
*
|
|
215
|
+
* @deprecated
|
|
178
216
|
*/
|
|
179
217
|
appearance?: Appearance;
|
|
180
218
|
/**
|
|
@@ -293,13 +331,15 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
293
331
|
* Set the appearance of the picker.
|
|
294
332
|
*
|
|
295
333
|
* `subtle` will remove the borders and background.
|
|
334
|
+
*
|
|
335
|
+
* @deprecated
|
|
296
336
|
*/
|
|
297
337
|
appearance?: Appearance;
|
|
298
338
|
/**
|
|
299
339
|
* Used to associate accessible descriptions to both the date and time
|
|
300
340
|
* picker. If you want to associate individual accessible descriptions, this
|
|
301
|
-
* should be done through the `
|
|
302
|
-
* `
|
|
341
|
+
* should be done through the `aria-describedby` props on the
|
|
342
|
+
* `datePickerProps` and `timePickerProps`.
|
|
303
343
|
*/
|
|
304
344
|
'aria-describedby'?: string;
|
|
305
345
|
/**
|
|
@@ -345,18 +385,10 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
345
385
|
* The ISO time that should be used as the input value.
|
|
346
386
|
*/
|
|
347
387
|
value?: string;
|
|
348
|
-
/**
|
|
349
|
-
* Set if users can edit the input, allowing them to add custom times.
|
|
350
|
-
*/
|
|
351
|
-
timeIsEditable?: boolean;
|
|
352
388
|
/**
|
|
353
389
|
* Set if the picker has an invalid value.
|
|
354
390
|
*/
|
|
355
391
|
isInvalid?: boolean;
|
|
356
|
-
/**
|
|
357
|
-
* Format the date with a string that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
358
|
-
*/
|
|
359
|
-
dateFormat?: string;
|
|
360
392
|
/**
|
|
361
393
|
* Props applied to the `DatePicker`.
|
|
362
394
|
*/
|
|
@@ -373,22 +405,6 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
373
405
|
timeValue: string;
|
|
374
406
|
zoneValue: string;
|
|
375
407
|
};
|
|
376
|
-
/**
|
|
377
|
-
* [Select props](/components/select) to pass onto the `DatePicker` component's `Select`. This can be used to set options such as placeholder text.
|
|
378
|
-
*/
|
|
379
|
-
datePickerSelectProps?: SelectProps<any>;
|
|
380
|
-
/**
|
|
381
|
-
* [Select props](/components/select) to pass onto the `TimePicker` component's `Select`. This can be used to set options such as placeholder text.
|
|
382
|
-
*/
|
|
383
|
-
timePickerSelectProps?: SelectProps<any>;
|
|
384
|
-
/**
|
|
385
|
-
* The times shown by the `TimePicker`.
|
|
386
|
-
*/
|
|
387
|
-
times?: Array<string>;
|
|
388
|
-
/**
|
|
389
|
-
* 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).
|
|
390
|
-
*/
|
|
391
|
-
timeFormat?: string;
|
|
392
408
|
/**
|
|
393
409
|
* The spacing for the select control.
|
|
394
410
|
*
|
|
@@ -28,8 +28,6 @@ declare const dateTimePickerDefaultProps: {
|
|
|
28
28
|
isInvalid: boolean;
|
|
29
29
|
datePickerProps: {};
|
|
30
30
|
timePickerProps: {};
|
|
31
|
-
datePickerSelectProps: {};
|
|
32
|
-
timePickerSelectProps: {};
|
|
33
31
|
times: string[];
|
|
34
32
|
spacing: NonNullable<import("../types").Spacing | undefined>;
|
|
35
33
|
locale: string;
|
|
@@ -72,5 +70,5 @@ export { DateTimePickerComponent as DateTimePickerWithoutAnalytics };
|
|
|
72
70
|
* - [Code](https://atlassian.design/components/datetime-picker/code)
|
|
73
71
|
* - [Usage](https://atlassian.design/components/datetime-picker/usage)
|
|
74
72
|
*/
|
|
75
|
-
declare const DateTimePicker: React.ForwardRefExoticComponent<Pick<Pick<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "
|
|
73
|
+
declare const DateTimePicker: React.ForwardRefExoticComponent<Pick<Pick<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<DateTimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "parseValue">> & Partial<Pick<DateTimePickerProps, "ref" | "createAnalyticsEvent">>, "times" | "testId" | "appearance" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "appearance" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "analyticsContext" | "createAnalyticsEvent" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "parseValue"> & React.RefAttributes<any>>;
|
|
76
74
|
export default DateTimePicker;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as DatePicker } from './components/date-picker';
|
|
2
2
|
export { default as TimePicker } from './components/time-picker';
|
|
3
3
|
export { default as DateTimePicker } from './components/date-time-picker';
|
|
4
|
-
export type { Appearance, Spacing, DatePickerBaseProps as DatePickerProps, TimePickerBaseProps as TimePickerProps, DateTimePickerBaseProps as DateTimePickerProps, } from './types';
|
|
4
|
+
export type { Appearance, Spacing, DatePickerBaseProps as DatePickerProps, TimePickerBaseProps as TimePickerProps, DateTimePickerBaseProps as DateTimePickerProps, DateTimePickerSelectProps, } from './types';
|
|
@@ -4,12 +4,48 @@ import { type DropdownIndicatorProps, type OptionType, type SelectProps } from '
|
|
|
4
4
|
export type Appearance = 'default' | 'subtle' | 'none';
|
|
5
5
|
export type Spacing = 'compact' | 'default';
|
|
6
6
|
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
7
|
+
/**
|
|
8
|
+
* Props to apply to the select. These include all of [the props from our
|
|
9
|
+
* `Select` component](/components/select). For the following properties, use
|
|
10
|
+
* the top-level prop alternatives:
|
|
11
|
+
*
|
|
12
|
+
* - `aria-describedby`, use `aria-describedby` prop
|
|
13
|
+
* - `aria-label`, use `label` prop
|
|
14
|
+
* - `inputId`, use `id` prop
|
|
15
|
+
* - `placeholder`, use `placeholder` prop
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // Don't do this
|
|
21
|
+
* <DatePicker selectProps={{
|
|
22
|
+
* 'aria-describedby': 'helper-id'
|
|
23
|
+
* }} />
|
|
24
|
+
*
|
|
25
|
+
* // Do this
|
|
26
|
+
* <DatePicker aria-describedby="helper-id" />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type DateTimePickerSelectProps = Combine<SelectProps<OptionType>, {
|
|
30
|
+
/**
|
|
31
|
+
* Use the `aria-describedby` prop on the picker..
|
|
32
|
+
*/
|
|
33
|
+
'aria-describedby'?: never;
|
|
34
|
+
/**
|
|
35
|
+
* Use the `label` prop on the picker..
|
|
36
|
+
*/
|
|
37
|
+
'aria-label'?: never;
|
|
38
|
+
/**
|
|
39
|
+
* Use the `id` prop on the picker.`.
|
|
40
|
+
*/
|
|
41
|
+
inputId?: never;
|
|
42
|
+
/**
|
|
43
|
+
* Use the `placeholder` prop on the picker.
|
|
44
|
+
*/
|
|
45
|
+
placeholder?: never;
|
|
46
|
+
}>;
|
|
7
47
|
interface PickerSelectProps {
|
|
8
|
-
|
|
9
|
-
* Props to apply to the select. These include all of [the props from our
|
|
10
|
-
* `Select` component](/components/select).
|
|
11
|
-
*/
|
|
12
|
-
selectProps?: Combine<SelectProps<OptionType>, {}>;
|
|
48
|
+
selectProps?: DateTimePickerSelectProps;
|
|
13
49
|
}
|
|
14
50
|
export interface DatePickerBaseProps extends WithAnalyticsEventsProps, PickerSelectProps {
|
|
15
51
|
/**
|
|
@@ -175,6 +211,8 @@ export interface TimePickerBaseProps extends WithAnalyticsEventsProps, PickerSel
|
|
|
175
211
|
* `subtle` will remove the borders, background, and icon.
|
|
176
212
|
*
|
|
177
213
|
* __NOTE:__ Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
214
|
+
*
|
|
215
|
+
* @deprecated
|
|
178
216
|
*/
|
|
179
217
|
appearance?: Appearance;
|
|
180
218
|
/**
|
|
@@ -293,13 +331,15 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
293
331
|
* Set the appearance of the picker.
|
|
294
332
|
*
|
|
295
333
|
* `subtle` will remove the borders and background.
|
|
334
|
+
*
|
|
335
|
+
* @deprecated
|
|
296
336
|
*/
|
|
297
337
|
appearance?: Appearance;
|
|
298
338
|
/**
|
|
299
339
|
* Used to associate accessible descriptions to both the date and time
|
|
300
340
|
* picker. If you want to associate individual accessible descriptions, this
|
|
301
|
-
* should be done through the `
|
|
302
|
-
* `
|
|
341
|
+
* should be done through the `aria-describedby` props on the
|
|
342
|
+
* `datePickerProps` and `timePickerProps`.
|
|
303
343
|
*/
|
|
304
344
|
'aria-describedby'?: string;
|
|
305
345
|
/**
|
|
@@ -345,18 +385,10 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
345
385
|
* The ISO time that should be used as the input value.
|
|
346
386
|
*/
|
|
347
387
|
value?: string;
|
|
348
|
-
/**
|
|
349
|
-
* Set if users can edit the input, allowing them to add custom times.
|
|
350
|
-
*/
|
|
351
|
-
timeIsEditable?: boolean;
|
|
352
388
|
/**
|
|
353
389
|
* Set if the picker has an invalid value.
|
|
354
390
|
*/
|
|
355
391
|
isInvalid?: boolean;
|
|
356
|
-
/**
|
|
357
|
-
* Format the date with a string that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format).
|
|
358
|
-
*/
|
|
359
|
-
dateFormat?: string;
|
|
360
392
|
/**
|
|
361
393
|
* Props applied to the `DatePicker`.
|
|
362
394
|
*/
|
|
@@ -373,22 +405,6 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
373
405
|
timeValue: string;
|
|
374
406
|
zoneValue: string;
|
|
375
407
|
};
|
|
376
|
-
/**
|
|
377
|
-
* [Select props](/components/select) to pass onto the `DatePicker` component's `Select`. This can be used to set options such as placeholder text.
|
|
378
|
-
*/
|
|
379
|
-
datePickerSelectProps?: SelectProps<any>;
|
|
380
|
-
/**
|
|
381
|
-
* [Select props](/components/select) to pass onto the `TimePicker` component's `Select`. This can be used to set options such as placeholder text.
|
|
382
|
-
*/
|
|
383
|
-
timePickerSelectProps?: SelectProps<any>;
|
|
384
|
-
/**
|
|
385
|
-
* The times shown by the `TimePicker`.
|
|
386
|
-
*/
|
|
387
|
-
times?: Array<string>;
|
|
388
|
-
/**
|
|
389
|
-
* 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).
|
|
390
|
-
*/
|
|
391
|
-
timeFormat?: string;
|
|
392
408
|
/**
|
|
393
409
|
* The spacing for the select control.
|
|
394
410
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
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/"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
43
43
|
"@atlaskit/calendar": "^14.5.0",
|
|
44
44
|
"@atlaskit/ds-lib": "^2.5.0",
|
|
45
|
-
"@atlaskit/icon": "^22.
|
|
45
|
+
"@atlaskit/icon": "^22.15.0",
|
|
46
46
|
"@atlaskit/layering": "^0.4.0",
|
|
47
47
|
"@atlaskit/locale": "^2.8.0",
|
|
48
48
|
"@atlaskit/popper": "^6.2.0",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"@af/integration-testing": "*",
|
|
62
62
|
"@af/visual-regression": "*",
|
|
63
63
|
"@atlaskit/button": "^20.1.0",
|
|
64
|
+
"@atlaskit/codemod-utils": "4.2.4",
|
|
64
65
|
"@atlaskit/docs": "*",
|
|
65
66
|
"@atlaskit/form": "^10.5.0",
|
|
66
67
|
"@atlaskit/modal-dialog": "^12.15.0",
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
"@testing-library/user-event": "^14.4.3",
|
|
77
78
|
"@types/testing-library__jest-dom": "^5.14.5",
|
|
78
79
|
"jest-in-case": "^1.0.2",
|
|
80
|
+
"jscodeshift": "^0.13.0",
|
|
79
81
|
"moment": "^2.29.2",
|
|
80
82
|
"react-dom": "^16.8.0",
|
|
81
83
|
"react-lorem-component": "^0.13.0",
|