@atlaskit/datetime-picker 11.1.10 → 12.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 +40 -0
- package/dist/cjs/components/DatePicker.js +12 -5
- package/dist/cjs/components/DateTimePicker.js +7 -5
- package/dist/cjs/components/TimePicker.js +13 -5
- package/dist/cjs/internal/parseTime.js +8 -6
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/DatePicker.js +12 -5
- package/dist/es2019/components/DateTimePicker.js +5 -3
- package/dist/es2019/components/TimePicker.js +13 -5
- package/dist/es2019/internal/parseTime.js +8 -6
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/DatePicker.js +12 -5
- package/dist/esm/components/DateTimePicker.js +7 -5
- package/dist/esm/components/TimePicker.js +13 -5
- package/dist/esm/internal/parseTime.js +8 -6
- package/dist/esm/version.json +1 -1
- package/dist/types/components/DatePicker.d.ts +6 -2
- package/dist/types/components/DateTimePicker.d.ts +2 -4
- package/dist/types/components/TimePicker.d.ts +4 -4
- package/package.json +9 -6
- package/report.api.md +636 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 12.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`58d4cd75f7a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/58d4cd75f7a) - Removed deprecated hideIcon prop from DateTimePicker because it is unused and serves no functionality.
|
|
8
|
+
Removed the deprecation notice for the formatDisplayLabel prop in TimePicker
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [`c3a1b950d49`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c3a1b950d49) - DSP-3301 specifies label to input id
|
|
13
|
+
- [`c2f866d31d1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2f866d31d1) - [ux] Fix timepicker clear icon alignment
|
|
14
|
+
- [`7566be18f20`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7566be18f20) - [ux] Time picker no longer loses focus to the document when tabbing through it in a popup.
|
|
15
|
+
- [`574b6c8ba7f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/574b6c8ba7f) - [ux] DSP-2987 Add code to catch console error
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 12.0.0
|
|
19
|
+
|
|
20
|
+
### Major Changes
|
|
21
|
+
|
|
22
|
+
- [`27d4f1e7121`](https://bitbucket.org/atlassian/atlassian-frontend/commits/27d4f1e7121) - [ux] Updating tokens
|
|
23
|
+
- [`d7542d1a7c2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7542d1a7c2) - [ux] Update Tokens in the code with those that are a better fit. New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
|
|
24
|
+
- [`c19fb116172`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c19fb116172) - [ux] Update Tokens in the code with those that are a better fit. New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- [`6f7a4353204`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6f7a4353204) - Added ability to provide custom aria-labels for next- and previous-month buttons using `nextMonthLabel` and `previousMonthLabel`
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- [`3ec9ed2c4d0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3ec9ed2c4d0) - Fixed handling of custom times that included whitespace characters
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
|
|
35
|
+
## 11.1.11
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- [`558cc136503`](https://bitbucket.org/atlassian/atlassian-frontend/commits/558cc136503) - Bump moment dependency version
|
|
40
|
+
- [`e7438659c2e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7438659c2e) - Updated dependency '@types/react-select' to fix type error
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
|
|
3
43
|
## 11.1.10
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
|
@@ -68,7 +68,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
68
68
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
69
69
|
|
|
70
70
|
var packageName = "@atlaskit/datetime-picker";
|
|
71
|
-
var packageVersion = "
|
|
71
|
+
var packageVersion = "12.1.0";
|
|
72
72
|
/* eslint-disable react/no-unused-prop-types */
|
|
73
73
|
|
|
74
74
|
function getDateObj(date) {
|
|
@@ -104,13 +104,16 @@ var Menu = function Menu(_ref) {
|
|
|
104
104
|
disabledDateFilter: selectProps.calendarDisabledDateFilter,
|
|
105
105
|
minDate: selectProps.calendarMinDate,
|
|
106
106
|
maxDate: selectProps.calendarMaxDate,
|
|
107
|
+
nextMonthLabel: selectProps.nextMonthLabel,
|
|
107
108
|
onChange: selectProps.onCalendarChange,
|
|
108
109
|
onSelect: selectProps.onCalendarSelect,
|
|
110
|
+
previousMonthLabel: selectProps.previousMonthLabel,
|
|
109
111
|
calendarRef: selectProps.calendarRef,
|
|
110
112
|
selected: [selectProps.calendarValue],
|
|
111
113
|
locale: selectProps.calendarLocale,
|
|
112
114
|
testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
|
|
113
|
-
weekStartDay: selectProps.calendarWeekStartDay
|
|
115
|
+
weekStartDay: selectProps.calendarWeekStartDay,
|
|
116
|
+
tabIndex: -1
|
|
114
117
|
}))),
|
|
115
118
|
testId: selectProps.testId
|
|
116
119
|
});
|
|
@@ -477,12 +480,13 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
477
480
|
minDate = _this$props3.minDate,
|
|
478
481
|
isInvalid = _this$props3.isInvalid,
|
|
479
482
|
name = _this$props3.name,
|
|
483
|
+
nextMonthLabel = _this$props3.nextMonthLabel,
|
|
484
|
+
previousMonthLabel = _this$props3.previousMonthLabel,
|
|
480
485
|
selectProps = _this$props3.selectProps,
|
|
481
486
|
spacing = _this$props3.spacing,
|
|
482
487
|
locale = _this$props3.locale,
|
|
483
488
|
testId = _this$props3.testId,
|
|
484
489
|
weekStartDay = _this$props3.weekStartDay;
|
|
485
|
-
var BORDER_WIDTH = 2;
|
|
486
490
|
var ICON_PADDING = 2;
|
|
487
491
|
|
|
488
492
|
var _this$getSafeState6 = this.getSafeState(),
|
|
@@ -521,7 +525,9 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
521
525
|
onCalendarChange: this.onCalendarChange,
|
|
522
526
|
onCalendarSelect: this.onCalendarSelect,
|
|
523
527
|
calendarLocale: locale,
|
|
524
|
-
calendarWeekStartDay: weekStartDay
|
|
528
|
+
calendarWeekStartDay: weekStartDay,
|
|
529
|
+
nextMonthLabel: nextMonthLabel,
|
|
530
|
+
previousMonthLabel: previousMonthLabel
|
|
525
531
|
};
|
|
526
532
|
return (0, _core.jsx)("div", (0, _extends2.default)({}, innerProps, {
|
|
527
533
|
role: "presentation",
|
|
@@ -531,6 +537,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
531
537
|
ref: this.getContainerRef,
|
|
532
538
|
"data-testid": testId && "".concat(testId, "--container")
|
|
533
539
|
}), (0, _core.jsx)("input", {
|
|
540
|
+
id: selectProps.inputId,
|
|
534
541
|
name: name,
|
|
535
542
|
type: "hidden",
|
|
536
543
|
value: value,
|
|
@@ -555,7 +562,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
555
562
|
indicatorsContainer: function indicatorsContainer(base) {
|
|
556
563
|
return _objectSpread(_objectSpread({}, base), {}, {
|
|
557
564
|
paddingLeft: ICON_PADDING,
|
|
558
|
-
paddingRight: (0, _constants.gridSize)() -
|
|
565
|
+
paddingRight: (0, _constants.gridSize)() - ICON_PADDING
|
|
559
566
|
});
|
|
560
567
|
}
|
|
561
568
|
}),
|
|
@@ -58,7 +58,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
58
58
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
59
59
|
|
|
60
60
|
var packageName = "@atlaskit/datetime-picker";
|
|
61
|
-
var packageVersion = "
|
|
61
|
+
var packageVersion = "12.1.0";
|
|
62
62
|
/* eslint-disable react/no-unused-prop-types */
|
|
63
63
|
|
|
64
64
|
var isInvalidBorderStyles = (0, _core.css)({
|
|
@@ -76,13 +76,13 @@ var subtleBgStyles = (0, _core.css)({
|
|
|
76
76
|
});
|
|
77
77
|
var hoverStyles = (0, _core.css)({
|
|
78
78
|
'&:hover': {
|
|
79
|
-
backgroundColor: "var(--ds-
|
|
79
|
+
backgroundColor: "var(--ds-background-input-hovered, ".concat(_colors.N30, ")"),
|
|
80
80
|
borderColor: "var(--ds-border, ".concat(_colors.N30, ")")
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
var isInvalidHoverStyles = (0, _core.css)({
|
|
84
84
|
'&:hover': {
|
|
85
|
-
backgroundColor: "var(--ds-
|
|
85
|
+
backgroundColor: "var(--ds-background-input-hovered, ".concat(_colors.N0, ")"),
|
|
86
86
|
borderColor: "var(--ds-border-danger, ".concat(_colors.R400, ")")
|
|
87
87
|
}
|
|
88
88
|
});
|
|
@@ -258,9 +258,9 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
258
258
|
});
|
|
259
259
|
|
|
260
260
|
if (dateValue && timeValue) {
|
|
261
|
-
var
|
|
261
|
+
var _value = (0, _internal.formatDateTimeZoneIntoIso)(dateValue, timeValue, zoneValue);
|
|
262
262
|
|
|
263
|
-
var _this$parseValue = this.parseValue(
|
|
263
|
+
var _this$parseValue = this.parseValue(_value, dateValue, timeValue, zoneValue),
|
|
264
264
|
parsedZone = _this$parseValue.zoneValue;
|
|
265
265
|
|
|
266
266
|
var valueWithValidZone = (0, _internal.formatDateTimeZoneIntoIso)(dateValue, timeValue, parsedZone);
|
|
@@ -326,11 +326,13 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
326
326
|
|
|
327
327
|
var isClearable = Boolean(dateValue || timeValue);
|
|
328
328
|
var notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
329
|
+
var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
329
330
|
return (0, _core.jsx)("div", (0, _extends2.default)({
|
|
330
331
|
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
|
|
331
332
|
}, innerProps, {
|
|
332
333
|
"data-testid": testId
|
|
333
334
|
}), (0, _core.jsx)("input", {
|
|
335
|
+
id: labelId,
|
|
334
336
|
name: name,
|
|
335
337
|
type: "hidden",
|
|
336
338
|
value: value
|
|
@@ -67,7 +67,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
67
67
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
68
68
|
|
|
69
69
|
var packageName = "@atlaskit/datetime-picker";
|
|
70
|
-
var packageVersion = "
|
|
70
|
+
var packageVersion = "12.1.0";
|
|
71
71
|
var menuStyles = {
|
|
72
72
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
73
73
|
position: 'static',
|
|
@@ -165,7 +165,15 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
165
165
|
var _this$props = _this.props,
|
|
166
166
|
parseInputValue = _this$props.parseInputValue,
|
|
167
167
|
_timeFormat = _this$props.timeFormat;
|
|
168
|
-
var
|
|
168
|
+
var sanitizedInput;
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
sanitizedInput = parseInputValue(inputValue, _timeFormat || _internal.defaultTimeFormat);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
return; // do nothing, the main validation should happen in the form
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
var formattedValue = (0, _dateFns.format)(sanitizedInput, 'HH:mm') || '';
|
|
169
177
|
|
|
170
178
|
_this.setState({
|
|
171
179
|
value: formattedValue
|
|
@@ -323,7 +331,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
323
331
|
spacing = _this$props3.spacing,
|
|
324
332
|
testId = _this$props3.testId;
|
|
325
333
|
var ICON_PADDING = 2;
|
|
326
|
-
var BORDER_WIDTH = 2;
|
|
327
334
|
|
|
328
335
|
var _this$getSafeState3 = this.getSafeState(),
|
|
329
336
|
_this$getSafeState3$v = _this$getSafeState3.value,
|
|
@@ -349,7 +356,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
349
356
|
selectComponents.ClearIndicator = _internal.EmptyClearIndicator;
|
|
350
357
|
}
|
|
351
358
|
|
|
352
|
-
var renderIconContainer = Boolean(hideIcon && value);
|
|
359
|
+
var renderIconContainer = Boolean(!hideIcon && value);
|
|
353
360
|
var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
|
|
354
361
|
control: function control(base) {
|
|
355
362
|
return _objectSpread(_objectSpread({}, base), controlStyles);
|
|
@@ -364,7 +371,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
364
371
|
indicatorsContainer: function indicatorsContainer(base) {
|
|
365
372
|
return _objectSpread(_objectSpread({}, base), {}, {
|
|
366
373
|
paddingLeft: renderIconContainer ? ICON_PADDING : 0,
|
|
367
|
-
paddingRight: renderIconContainer ? (0, _constants.gridSize)() -
|
|
374
|
+
paddingRight: renderIconContainer ? (0, _constants.gridSize)() - ICON_PADDING : 0
|
|
368
375
|
});
|
|
369
376
|
}
|
|
370
377
|
});
|
|
@@ -376,6 +383,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
376
383
|
"data-testid": testId && "".concat(testId, "--container"),
|
|
377
384
|
onKeyDown: this.onSelectKeyDown
|
|
378
385
|
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
386
|
+
id: selectProps.inputId,
|
|
379
387
|
name: name,
|
|
380
388
|
type: "hidden",
|
|
381
389
|
value: value
|
|
@@ -95,9 +95,9 @@ function checkMinute(minute) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
function convertTo24hrTime(time) {
|
|
98
|
-
var timeArray = time.split(/(p|a)/);
|
|
98
|
+
var timeArray = time.toLowerCase().split(/(p|a)/i);
|
|
99
99
|
var meridiem = timeArray[1];
|
|
100
|
-
var semi24 = formatSemi24(timeArray[0]);
|
|
100
|
+
var semi24 = formatSemi24(timeArray[0].trim());
|
|
101
101
|
var hour = checkHour(semi24.substring(0, 2), meridiem);
|
|
102
102
|
var minute = checkMinute(semi24.substring(2, 4));
|
|
103
103
|
|
|
@@ -120,15 +120,17 @@ function assignToDate(time) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
function _default(time) {
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
var trimmedTime = time.toString().trim();
|
|
124
|
+
|
|
125
|
+
if (!isValid(trimmedTime)) {
|
|
126
|
+
throw RangeError('invalid time format');
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
var time1 = removeSpacer(
|
|
129
|
+
var time1 = removeSpacer(trimmedTime);
|
|
128
130
|
var time2 = convertTo24hrTime(time1);
|
|
129
131
|
|
|
130
132
|
if (!time2) {
|
|
131
|
-
|
|
133
|
+
throw RangeError('invalid time format');
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
return assignToDate(time2);
|
package/dist/cjs/version.json
CHANGED
|
@@ -18,7 +18,7 @@ import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime }
|
|
|
18
18
|
import FixedLayer from '../internal/FixedLayer';
|
|
19
19
|
import { convertTokens } from './utils';
|
|
20
20
|
const packageName = "@atlaskit/datetime-picker";
|
|
21
|
-
const packageVersion = "
|
|
21
|
+
const packageVersion = "12.1.0";
|
|
22
22
|
/* eslint-disable react/no-unused-prop-types */
|
|
23
23
|
|
|
24
24
|
function getDateObj(date) {
|
|
@@ -54,13 +54,16 @@ const Menu = ({
|
|
|
54
54
|
disabledDateFilter: selectProps.calendarDisabledDateFilter,
|
|
55
55
|
minDate: selectProps.calendarMinDate,
|
|
56
56
|
maxDate: selectProps.calendarMaxDate,
|
|
57
|
+
nextMonthLabel: selectProps.nextMonthLabel,
|
|
57
58
|
onChange: selectProps.onCalendarChange,
|
|
58
59
|
onSelect: selectProps.onCalendarSelect,
|
|
60
|
+
previousMonthLabel: selectProps.previousMonthLabel,
|
|
59
61
|
calendarRef: selectProps.calendarRef,
|
|
60
62
|
selected: [selectProps.calendarValue],
|
|
61
63
|
locale: selectProps.calendarLocale,
|
|
62
64
|
testId: selectProps.testId && `${selectProps.testId}--calendar`,
|
|
63
|
-
weekStartDay: selectProps.calendarWeekStartDay
|
|
65
|
+
weekStartDay: selectProps.calendarWeekStartDay,
|
|
66
|
+
tabIndex: -1
|
|
64
67
|
}))),
|
|
65
68
|
testId: selectProps.testId
|
|
66
69
|
});
|
|
@@ -427,13 +430,14 @@ class DatePicker extends Component {
|
|
|
427
430
|
minDate,
|
|
428
431
|
isInvalid,
|
|
429
432
|
name,
|
|
433
|
+
nextMonthLabel,
|
|
434
|
+
previousMonthLabel,
|
|
430
435
|
selectProps,
|
|
431
436
|
spacing,
|
|
432
437
|
locale,
|
|
433
438
|
testId,
|
|
434
439
|
weekStartDay
|
|
435
440
|
} = this.props;
|
|
436
|
-
const BORDER_WIDTH = 2;
|
|
437
441
|
const ICON_PADDING = 2;
|
|
438
442
|
const {
|
|
439
443
|
value,
|
|
@@ -472,7 +476,9 @@ class DatePicker extends Component {
|
|
|
472
476
|
onCalendarChange: this.onCalendarChange,
|
|
473
477
|
onCalendarSelect: this.onCalendarSelect,
|
|
474
478
|
calendarLocale: locale,
|
|
475
|
-
calendarWeekStartDay: weekStartDay
|
|
479
|
+
calendarWeekStartDay: weekStartDay,
|
|
480
|
+
nextMonthLabel,
|
|
481
|
+
previousMonthLabel
|
|
476
482
|
};
|
|
477
483
|
return jsx("div", _extends({}, innerProps, {
|
|
478
484
|
role: "presentation",
|
|
@@ -482,6 +488,7 @@ class DatePicker extends Component {
|
|
|
482
488
|
ref: this.getContainerRef,
|
|
483
489
|
"data-testid": testId && `${testId}--container`
|
|
484
490
|
}), jsx("input", {
|
|
491
|
+
id: selectProps.inputId,
|
|
485
492
|
name: name,
|
|
486
493
|
type: "hidden",
|
|
487
494
|
value: value,
|
|
@@ -506,7 +513,7 @@ class DatePicker extends Component {
|
|
|
506
513
|
}),
|
|
507
514
|
indicatorsContainer: base => ({ ...base,
|
|
508
515
|
paddingLeft: ICON_PADDING,
|
|
509
|
-
paddingRight: gridSize() -
|
|
516
|
+
paddingRight: gridSize() - ICON_PADDING
|
|
510
517
|
})
|
|
511
518
|
}),
|
|
512
519
|
placeholder: this.getPlaceholder(),
|
|
@@ -17,7 +17,7 @@ import DatePicker from './DatePicker';
|
|
|
17
17
|
import TimePicker from './TimePicker';
|
|
18
18
|
import { convertTokens } from './utils';
|
|
19
19
|
const packageName = "@atlaskit/datetime-picker";
|
|
20
|
-
const packageVersion = "
|
|
20
|
+
const packageVersion = "12.1.0";
|
|
21
21
|
/* eslint-disable react/no-unused-prop-types */
|
|
22
22
|
|
|
23
23
|
const isInvalidBorderStyles = css({
|
|
@@ -35,13 +35,13 @@ const subtleBgStyles = css({
|
|
|
35
35
|
});
|
|
36
36
|
const hoverStyles = css({
|
|
37
37
|
'&:hover': {
|
|
38
|
-
backgroundColor: `var(--ds-
|
|
38
|
+
backgroundColor: `var(--ds-background-input-hovered, ${N30})`,
|
|
39
39
|
borderColor: `var(--ds-border, ${N30})`
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
const isInvalidHoverStyles = css({
|
|
43
43
|
'&:hover': {
|
|
44
|
-
backgroundColor: `var(--ds-
|
|
44
|
+
backgroundColor: `var(--ds-background-input-hovered, ${N0})`,
|
|
45
45
|
borderColor: `var(--ds-border-danger, ${R400})`
|
|
46
46
|
}
|
|
47
47
|
});
|
|
@@ -273,11 +273,13 @@ class DateTimePicker extends React.Component {
|
|
|
273
273
|
|
|
274
274
|
const isClearable = Boolean(dateValue || timeValue);
|
|
275
275
|
const notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
276
|
+
const labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
276
277
|
return jsx("div", _extends({
|
|
277
278
|
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
|
|
278
279
|
}, innerProps, {
|
|
279
280
|
"data-testid": testId
|
|
280
281
|
}), jsx("input", {
|
|
282
|
+
id: labelId,
|
|
281
283
|
name: name,
|
|
282
284
|
type: "hidden",
|
|
283
285
|
value: value
|
|
@@ -14,7 +14,7 @@ import FixedLayer from '../internal/FixedLayer';
|
|
|
14
14
|
import parseTime from '../internal/parseTime';
|
|
15
15
|
import { convertTokens } from './utils';
|
|
16
16
|
const packageName = "@atlaskit/datetime-picker";
|
|
17
|
-
const packageVersion = "
|
|
17
|
+
const packageVersion = "12.1.0";
|
|
18
18
|
const menuStyles = {
|
|
19
19
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
20
20
|
position: 'static',
|
|
@@ -104,7 +104,15 @@ class TimePicker extends React.Component {
|
|
|
104
104
|
parseInputValue,
|
|
105
105
|
timeFormat
|
|
106
106
|
} = this.props;
|
|
107
|
-
|
|
107
|
+
let sanitizedInput;
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
sanitizedInput = parseInputValue(inputValue, timeFormat || defaultTimeFormat);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
return; // do nothing, the main validation should happen in the form
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const formattedValue = format(sanitizedInput, 'HH:mm') || '';
|
|
108
116
|
this.setState({
|
|
109
117
|
value: formattedValue
|
|
110
118
|
});
|
|
@@ -262,7 +270,6 @@ class TimePicker extends React.Component {
|
|
|
262
270
|
testId
|
|
263
271
|
} = this.props;
|
|
264
272
|
const ICON_PADDING = 2;
|
|
265
|
-
const BORDER_WIDTH = 2;
|
|
266
273
|
const {
|
|
267
274
|
value = '',
|
|
268
275
|
isOpen
|
|
@@ -287,7 +294,7 @@ class TimePicker extends React.Component {
|
|
|
287
294
|
selectComponents.ClearIndicator = EmptyClearIndicator;
|
|
288
295
|
}
|
|
289
296
|
|
|
290
|
-
const renderIconContainer = Boolean(hideIcon && value);
|
|
297
|
+
const renderIconContainer = Boolean(!hideIcon && value);
|
|
291
298
|
const mergedStyles = mergeStyles(selectStyles, {
|
|
292
299
|
control: base => ({ ...base,
|
|
293
300
|
...controlStyles
|
|
@@ -300,7 +307,7 @@ class TimePicker extends React.Component {
|
|
|
300
307
|
}),
|
|
301
308
|
indicatorsContainer: base => ({ ...base,
|
|
302
309
|
paddingLeft: renderIconContainer ? ICON_PADDING : 0,
|
|
303
|
-
paddingRight: renderIconContainer ? gridSize() -
|
|
310
|
+
paddingRight: renderIconContainer ? gridSize() - ICON_PADDING : 0
|
|
304
311
|
})
|
|
305
312
|
});
|
|
306
313
|
return (
|
|
@@ -311,6 +318,7 @@ class TimePicker extends React.Component {
|
|
|
311
318
|
"data-testid": testId && `${testId}--container`,
|
|
312
319
|
onKeyDown: this.onSelectKeyDown
|
|
313
320
|
}), /*#__PURE__*/React.createElement("input", {
|
|
321
|
+
id: selectProps.inputId,
|
|
314
322
|
name: name,
|
|
315
323
|
type: "hidden",
|
|
316
324
|
value: value
|
|
@@ -76,9 +76,9 @@ export function checkMinute(minute) {
|
|
|
76
76
|
return minute;
|
|
77
77
|
}
|
|
78
78
|
export function convertTo24hrTime(time) {
|
|
79
|
-
const timeArray = time.split(/(p|a)/);
|
|
79
|
+
const timeArray = time.toLowerCase().split(/(p|a)/i);
|
|
80
80
|
const meridiem = timeArray[1];
|
|
81
|
-
const semi24 = formatSemi24(timeArray[0]);
|
|
81
|
+
const semi24 = formatSemi24(timeArray[0].trim());
|
|
82
82
|
const hour = checkHour(semi24.substring(0, 2), meridiem);
|
|
83
83
|
const minute = checkMinute(semi24.substring(2, 4));
|
|
84
84
|
|
|
@@ -99,15 +99,17 @@ export function assignToDate(time) {
|
|
|
99
99
|
return dateTime;
|
|
100
100
|
}
|
|
101
101
|
export default function (time) {
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
const trimmedTime = time.toString().trim();
|
|
103
|
+
|
|
104
|
+
if (!isValid(trimmedTime)) {
|
|
105
|
+
throw RangeError('invalid time format');
|
|
104
106
|
}
|
|
105
107
|
|
|
106
|
-
const time1 = removeSpacer(
|
|
108
|
+
const time1 = removeSpacer(trimmedTime);
|
|
107
109
|
const time2 = convertTo24hrTime(time1);
|
|
108
110
|
|
|
109
111
|
if (!time2) {
|
|
110
|
-
|
|
112
|
+
throw RangeError('invalid time format');
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
return assignToDate(time2);
|
package/dist/es2019/version.json
CHANGED
|
@@ -33,7 +33,7 @@ import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime }
|
|
|
33
33
|
import FixedLayer from '../internal/FixedLayer';
|
|
34
34
|
import { convertTokens } from './utils';
|
|
35
35
|
var packageName = "@atlaskit/datetime-picker";
|
|
36
|
-
var packageVersion = "
|
|
36
|
+
var packageVersion = "12.1.0";
|
|
37
37
|
/* eslint-disable react/no-unused-prop-types */
|
|
38
38
|
|
|
39
39
|
function getDateObj(date) {
|
|
@@ -69,13 +69,16 @@ var Menu = function Menu(_ref) {
|
|
|
69
69
|
disabledDateFilter: selectProps.calendarDisabledDateFilter,
|
|
70
70
|
minDate: selectProps.calendarMinDate,
|
|
71
71
|
maxDate: selectProps.calendarMaxDate,
|
|
72
|
+
nextMonthLabel: selectProps.nextMonthLabel,
|
|
72
73
|
onChange: selectProps.onCalendarChange,
|
|
73
74
|
onSelect: selectProps.onCalendarSelect,
|
|
75
|
+
previousMonthLabel: selectProps.previousMonthLabel,
|
|
74
76
|
calendarRef: selectProps.calendarRef,
|
|
75
77
|
selected: [selectProps.calendarValue],
|
|
76
78
|
locale: selectProps.calendarLocale,
|
|
77
79
|
testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
|
|
78
|
-
weekStartDay: selectProps.calendarWeekStartDay
|
|
80
|
+
weekStartDay: selectProps.calendarWeekStartDay,
|
|
81
|
+
tabIndex: -1
|
|
79
82
|
}))),
|
|
80
83
|
testId: selectProps.testId
|
|
81
84
|
});
|
|
@@ -463,12 +466,13 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
463
466
|
minDate = _this$props3.minDate,
|
|
464
467
|
isInvalid = _this$props3.isInvalid,
|
|
465
468
|
name = _this$props3.name,
|
|
469
|
+
nextMonthLabel = _this$props3.nextMonthLabel,
|
|
470
|
+
previousMonthLabel = _this$props3.previousMonthLabel,
|
|
466
471
|
selectProps = _this$props3.selectProps,
|
|
467
472
|
spacing = _this$props3.spacing,
|
|
468
473
|
locale = _this$props3.locale,
|
|
469
474
|
testId = _this$props3.testId,
|
|
470
475
|
weekStartDay = _this$props3.weekStartDay;
|
|
471
|
-
var BORDER_WIDTH = 2;
|
|
472
476
|
var ICON_PADDING = 2;
|
|
473
477
|
|
|
474
478
|
var _this$getSafeState6 = this.getSafeState(),
|
|
@@ -507,7 +511,9 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
507
511
|
onCalendarChange: this.onCalendarChange,
|
|
508
512
|
onCalendarSelect: this.onCalendarSelect,
|
|
509
513
|
calendarLocale: locale,
|
|
510
|
-
calendarWeekStartDay: weekStartDay
|
|
514
|
+
calendarWeekStartDay: weekStartDay,
|
|
515
|
+
nextMonthLabel: nextMonthLabel,
|
|
516
|
+
previousMonthLabel: previousMonthLabel
|
|
511
517
|
};
|
|
512
518
|
return jsx("div", _extends({}, innerProps, {
|
|
513
519
|
role: "presentation",
|
|
@@ -517,6 +523,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
517
523
|
ref: this.getContainerRef,
|
|
518
524
|
"data-testid": testId && "".concat(testId, "--container")
|
|
519
525
|
}), jsx("input", {
|
|
526
|
+
id: selectProps.inputId,
|
|
520
527
|
name: name,
|
|
521
528
|
type: "hidden",
|
|
522
529
|
value: value,
|
|
@@ -541,7 +548,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
541
548
|
indicatorsContainer: function indicatorsContainer(base) {
|
|
542
549
|
return _objectSpread(_objectSpread({}, base), {}, {
|
|
543
550
|
paddingLeft: ICON_PADDING,
|
|
544
|
-
paddingRight: gridSize() -
|
|
551
|
+
paddingRight: gridSize() - ICON_PADDING
|
|
545
552
|
});
|
|
546
553
|
}
|
|
547
554
|
}),
|
|
@@ -31,7 +31,7 @@ import DatePicker from './DatePicker';
|
|
|
31
31
|
import TimePicker from './TimePicker';
|
|
32
32
|
import { convertTokens } from './utils';
|
|
33
33
|
var packageName = "@atlaskit/datetime-picker";
|
|
34
|
-
var packageVersion = "
|
|
34
|
+
var packageVersion = "12.1.0";
|
|
35
35
|
/* eslint-disable react/no-unused-prop-types */
|
|
36
36
|
|
|
37
37
|
var isInvalidBorderStyles = css({
|
|
@@ -49,13 +49,13 @@ var subtleBgStyles = css({
|
|
|
49
49
|
});
|
|
50
50
|
var hoverStyles = css({
|
|
51
51
|
'&:hover': {
|
|
52
|
-
backgroundColor: "var(--ds-
|
|
52
|
+
backgroundColor: "var(--ds-background-input-hovered, ".concat(N30, ")"),
|
|
53
53
|
borderColor: "var(--ds-border, ".concat(N30, ")")
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
var isInvalidHoverStyles = css({
|
|
57
57
|
'&:hover': {
|
|
58
|
-
backgroundColor: "var(--ds-
|
|
58
|
+
backgroundColor: "var(--ds-background-input-hovered, ".concat(N0, ")"),
|
|
59
59
|
borderColor: "var(--ds-border-danger, ".concat(R400, ")")
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -239,9 +239,9 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
if (dateValue && timeValue) {
|
|
242
|
-
var
|
|
242
|
+
var _value = formatDateTimeZoneIntoIso(dateValue, timeValue, zoneValue);
|
|
243
243
|
|
|
244
|
-
var _this$parseValue = this.parseValue(
|
|
244
|
+
var _this$parseValue = this.parseValue(_value, dateValue, timeValue, zoneValue),
|
|
245
245
|
parsedZone = _this$parseValue.zoneValue;
|
|
246
246
|
|
|
247
247
|
var valueWithValidZone = formatDateTimeZoneIntoIso(dateValue, timeValue, parsedZone);
|
|
@@ -307,11 +307,13 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
307
307
|
|
|
308
308
|
var isClearable = Boolean(dateValue || timeValue);
|
|
309
309
|
var notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
310
|
+
var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
310
311
|
return jsx("div", _extends({
|
|
311
312
|
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
|
|
312
313
|
}, innerProps, {
|
|
313
314
|
"data-testid": testId
|
|
314
315
|
}), jsx("input", {
|
|
316
|
+
id: labelId,
|
|
315
317
|
name: name,
|
|
316
318
|
type: "hidden",
|
|
317
319
|
value: value
|
|
@@ -32,7 +32,7 @@ import FixedLayer from '../internal/FixedLayer';
|
|
|
32
32
|
import parseTime from '../internal/parseTime';
|
|
33
33
|
import { convertTokens } from './utils';
|
|
34
34
|
var packageName = "@atlaskit/datetime-picker";
|
|
35
|
-
var packageVersion = "
|
|
35
|
+
var packageVersion = "12.1.0";
|
|
36
36
|
var menuStyles = {
|
|
37
37
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
38
38
|
position: 'static',
|
|
@@ -136,7 +136,15 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
136
136
|
var _this$props = _this.props,
|
|
137
137
|
parseInputValue = _this$props.parseInputValue,
|
|
138
138
|
_timeFormat = _this$props.timeFormat;
|
|
139
|
-
var
|
|
139
|
+
var sanitizedInput;
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
sanitizedInput = parseInputValue(inputValue, _timeFormat || defaultTimeFormat);
|
|
143
|
+
} catch (e) {
|
|
144
|
+
return; // do nothing, the main validation should happen in the form
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var formattedValue = format(sanitizedInput, 'HH:mm') || '';
|
|
140
148
|
|
|
141
149
|
_this.setState({
|
|
142
150
|
value: formattedValue
|
|
@@ -304,7 +312,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
304
312
|
spacing = _this$props3.spacing,
|
|
305
313
|
testId = _this$props3.testId;
|
|
306
314
|
var ICON_PADDING = 2;
|
|
307
|
-
var BORDER_WIDTH = 2;
|
|
308
315
|
|
|
309
316
|
var _this$getSafeState3 = this.getSafeState(),
|
|
310
317
|
_this$getSafeState3$v = _this$getSafeState3.value,
|
|
@@ -332,7 +339,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
332
339
|
selectComponents.ClearIndicator = EmptyClearIndicator;
|
|
333
340
|
}
|
|
334
341
|
|
|
335
|
-
var renderIconContainer = Boolean(hideIcon && value);
|
|
342
|
+
var renderIconContainer = Boolean(!hideIcon && value);
|
|
336
343
|
var mergedStyles = mergeStyles(selectStyles, {
|
|
337
344
|
control: function control(base) {
|
|
338
345
|
return _objectSpread(_objectSpread({}, base), controlStyles);
|
|
@@ -347,7 +354,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
347
354
|
indicatorsContainer: function indicatorsContainer(base) {
|
|
348
355
|
return _objectSpread(_objectSpread({}, base), {}, {
|
|
349
356
|
paddingLeft: renderIconContainer ? ICON_PADDING : 0,
|
|
350
|
-
paddingRight: renderIconContainer ? gridSize() -
|
|
357
|
+
paddingRight: renderIconContainer ? gridSize() - ICON_PADDING : 0
|
|
351
358
|
});
|
|
352
359
|
}
|
|
353
360
|
});
|
|
@@ -359,6 +366,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
359
366
|
"data-testid": testId && "".concat(testId, "--container"),
|
|
360
367
|
onKeyDown: this.onSelectKeyDown
|
|
361
368
|
}), /*#__PURE__*/React.createElement("input", {
|
|
369
|
+
id: selectProps.inputId,
|
|
362
370
|
name: name,
|
|
363
371
|
type: "hidden",
|
|
364
372
|
value: value
|