@atlaskit/datetime-picker 12.3.13 → 12.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/components/date-picker.js +16 -17
- package/dist/cjs/components/date-time-picker.js +5 -7
- package/dist/cjs/components/time-picker.js +13 -16
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/date-picker.js +16 -17
- package/dist/es2019/components/date-time-picker.js +5 -7
- package/dist/es2019/components/time-picker.js +13 -17
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/date-picker.js +16 -17
- package/dist/esm/components/date-time-picker.js +5 -7
- package/dist/esm/components/time-picker.js +13 -16
- package/dist/esm/version.json +1 -1
- package/dist/types/components/date-time-picker.d.ts +2 -7
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 12.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e976f3cebd0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e976f3cebd0) - Remove excessive `aria-labelledby` prop, remove incorret documentation.
|
|
8
|
+
|
|
3
9
|
## 12.3.13
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -36,7 +36,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
36
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
37
37
|
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; } } /* eslint-disable @repo/internal/react/use-noop */ /** @jsx jsx */ // eslint-disable-next-line no-restricted-imports
|
|
38
38
|
var packageName = "@atlaskit/datetime-picker";
|
|
39
|
-
var packageVersion = "12.
|
|
39
|
+
var packageVersion = "12.4.0";
|
|
40
40
|
|
|
41
41
|
/* eslint-disable react/no-unused-prop-types */
|
|
42
42
|
|
|
@@ -119,6 +119,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
119
119
|
_this = _super.call(this, props);
|
|
120
120
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calendarRef", null);
|
|
121
121
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "containerRef", null);
|
|
122
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
123
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
122
124
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSafeState", function () {
|
|
123
125
|
return _objectSpread(_objectSpread(_objectSpread({}, _this.state), (0, _pick.default)(_this.props, ['value', 'isOpen'])), (0, _pick.default)(_this.props.selectProps, ['inputValue']));
|
|
124
126
|
});
|
|
@@ -333,6 +335,12 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
333
335
|
_this.forceUpdate();
|
|
334
336
|
}
|
|
335
337
|
});
|
|
338
|
+
/**
|
|
339
|
+
* There are two props that can change how the date is parsed.
|
|
340
|
+
* The priority of props used is:
|
|
341
|
+
* 1. parseInputValue
|
|
342
|
+
* 2. locale
|
|
343
|
+
*/
|
|
336
344
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "parseDate", function (date) {
|
|
337
345
|
var _this$props = _this.props,
|
|
338
346
|
parseInputValue = _this$props.parseInputValue,
|
|
@@ -344,6 +352,13 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
344
352
|
l10n = _this$getSafeState4.l10n;
|
|
345
353
|
return l10n.parseDate(date);
|
|
346
354
|
});
|
|
355
|
+
/**
|
|
356
|
+
* There are multiple props that can change how the date is formatted.
|
|
357
|
+
* The priority of props used is:
|
|
358
|
+
* 1. formatDisplayLabel
|
|
359
|
+
* 2. dateFormat
|
|
360
|
+
* 3. locale
|
|
361
|
+
*/
|
|
347
362
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatDate", function (value) {
|
|
348
363
|
var _this$props2 = _this.props,
|
|
349
364
|
formatDisplayLabel = _this$props2.formatDisplayLabel,
|
|
@@ -385,22 +400,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
385
400
|
});
|
|
386
401
|
}
|
|
387
402
|
}
|
|
388
|
-
|
|
389
|
-
// All state needs to be accessed via this function so that the state is mapped from props
|
|
390
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
391
|
-
/**
|
|
392
|
-
* There are two props that can change how the date is parsed.
|
|
393
|
-
* The priority of props used is:
|
|
394
|
-
* 1. parseInputValue
|
|
395
|
-
* 2. locale
|
|
396
|
-
*/
|
|
397
|
-
/**
|
|
398
|
-
* There are multiple props that can change how the date is formatted.
|
|
399
|
-
* The priority of props used is:
|
|
400
|
-
* 1. formatDisplayLabel
|
|
401
|
-
* 2. dateFormat
|
|
402
|
-
* 3. locale
|
|
403
|
-
*/
|
|
404
403
|
}, {
|
|
405
404
|
key: "render",
|
|
406
405
|
value: function render() {
|
|
@@ -31,7 +31,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
31
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
32
|
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; } /* eslint-disable @repo/internal/react/use-noop */ /** @jsx jsx */ // eslint-disable-next-line no-restricted-imports
|
|
33
33
|
var packageName = "@atlaskit/datetime-picker";
|
|
34
|
-
var packageVersion = "12.
|
|
34
|
+
var packageVersion = "12.4.0";
|
|
35
35
|
|
|
36
36
|
/* eslint-disable react/no-unused-prop-types */
|
|
37
37
|
|
|
@@ -178,6 +178,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
178
178
|
value: _this.props.defaultValue,
|
|
179
179
|
zoneValue: ''
|
|
180
180
|
});
|
|
181
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
182
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
181
183
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSafeState", function () {
|
|
182
184
|
var mappedState = _objectSpread(_objectSpread({}, _this.state), (0, _pick.default)(_this.props, ['value']));
|
|
183
185
|
return _objectSpread(_objectSpread({}, mappedState), _this.parseValue(mappedState.value, mappedState.dateValue, mappedState.timeValue, mappedState.zoneValue));
|
|
@@ -211,8 +213,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
211
213
|
}));
|
|
212
214
|
});
|
|
213
215
|
return _this;
|
|
214
|
-
}
|
|
215
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
216
|
+
}
|
|
216
217
|
(0, _createClass2.default)(DateTimePicker, [{
|
|
217
218
|
key: "parseValue",
|
|
218
219
|
value: function parseValue(value, dateValue, timeValue, zoneValue) {
|
|
@@ -276,8 +277,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
276
277
|
times = _this$props.times,
|
|
277
278
|
timeFormat = _this$props.timeFormat,
|
|
278
279
|
locale = _this$props.locale,
|
|
279
|
-
testId = _this$props.testId
|
|
280
|
-
ariaLabelledBy = _this$props['aria-labelledby'];
|
|
280
|
+
testId = _this$props.testId;
|
|
281
281
|
var _this$getSafeState = this.getSafeState(),
|
|
282
282
|
isFocused = _this$getSafeState.isFocused,
|
|
283
283
|
value = _this$getSafeState.value,
|
|
@@ -311,8 +311,6 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
311
311
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
312
312
|
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles), bothProps.appearance === 'none' && noBgStyles]
|
|
313
313
|
}, innerProps, {
|
|
314
|
-
role: "group",
|
|
315
|
-
"aria-labelledby": ariaLabelledBy,
|
|
316
314
|
"data-testid": testId
|
|
317
315
|
}), (0, _react2.jsx)("input", {
|
|
318
316
|
name: name,
|
|
@@ -38,7 +38,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
38
38
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
39
39
|
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; } }
|
|
40
40
|
var packageName = "@atlaskit/datetime-picker";
|
|
41
|
-
var packageVersion = "12.
|
|
41
|
+
var packageVersion = "12.4.0";
|
|
42
42
|
|
|
43
43
|
/* eslint-disable react/no-unused-prop-types */
|
|
44
44
|
|
|
@@ -105,6 +105,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
105
105
|
isFocused: false,
|
|
106
106
|
l10n: (0, _locale.createLocalizationProvider)(_this.props.locale)
|
|
107
107
|
});
|
|
108
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
109
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
108
110
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSafeState", function () {
|
|
109
111
|
return _objectSpread(_objectSpread({}, _this.state), (0, _pick.default)(_this.props, ['value', 'isOpen']));
|
|
110
112
|
});
|
|
@@ -122,6 +124,9 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
122
124
|
_this.setState(changedState);
|
|
123
125
|
_this.props.onChange(value);
|
|
124
126
|
});
|
|
127
|
+
/**
|
|
128
|
+
* Only allow custom times if timeIsEditable prop is true
|
|
129
|
+
*/
|
|
125
130
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCreateOption", function (inputValue) {
|
|
126
131
|
if (_this.props.timeIsEditable) {
|
|
127
132
|
var _this$props = _this.props,
|
|
@@ -198,6 +203,13 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
198
203
|
});
|
|
199
204
|
}
|
|
200
205
|
});
|
|
206
|
+
/**
|
|
207
|
+
* There are multiple props that can change how the time is formatted.
|
|
208
|
+
* The priority of props used is:
|
|
209
|
+
* 1. formatDisplayLabel
|
|
210
|
+
* 2. timeFormat
|
|
211
|
+
* 3. locale
|
|
212
|
+
*/
|
|
201
213
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatTime", function (time) {
|
|
202
214
|
var _this$props2 = _this.props,
|
|
203
215
|
formatDisplayLabel = _this$props2.formatDisplayLabel,
|
|
@@ -239,9 +251,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
239
251
|
});
|
|
240
252
|
}
|
|
241
253
|
}
|
|
242
|
-
|
|
243
|
-
// All state needs to be accessed via this function so that the state is mapped from props
|
|
244
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
245
254
|
}, {
|
|
246
255
|
key: "getOptions",
|
|
247
256
|
value: function getOptions() {
|
|
@@ -253,18 +262,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
253
262
|
};
|
|
254
263
|
});
|
|
255
264
|
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Only allow custom times if timeIsEditable prop is true
|
|
259
|
-
*/
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* There are multiple props that can change how the time is formatted.
|
|
263
|
-
* The priority of props used is:
|
|
264
|
-
* 1. formatDisplayLabel
|
|
265
|
-
* 2. timeFormat
|
|
266
|
-
* 3. locale
|
|
267
|
-
*/
|
|
268
265
|
}, {
|
|
269
266
|
key: "render",
|
|
270
267
|
value: function render() {
|
package/dist/cjs/version.json
CHANGED
|
@@ -18,7 +18,7 @@ import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from
|
|
|
18
18
|
import FixedLayer from '../internal/fixed-layer';
|
|
19
19
|
import { convertTokens } from './utils';
|
|
20
20
|
const packageName = "@atlaskit/datetime-picker";
|
|
21
|
-
const packageVersion = "12.
|
|
21
|
+
const packageVersion = "12.4.0";
|
|
22
22
|
|
|
23
23
|
/* eslint-disable react/no-unused-prop-types */
|
|
24
24
|
|
|
@@ -95,6 +95,8 @@ class DatePicker extends Component {
|
|
|
95
95
|
super(props);
|
|
96
96
|
_defineProperty(this, "calendarRef", null);
|
|
97
97
|
_defineProperty(this, "containerRef", null);
|
|
98
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
99
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
98
100
|
_defineProperty(this, "getSafeState", () => {
|
|
99
101
|
return {
|
|
100
102
|
...this.state,
|
|
@@ -317,6 +319,12 @@ class DatePicker extends Component {
|
|
|
317
319
|
this.forceUpdate();
|
|
318
320
|
}
|
|
319
321
|
});
|
|
322
|
+
/**
|
|
323
|
+
* There are two props that can change how the date is parsed.
|
|
324
|
+
* The priority of props used is:
|
|
325
|
+
* 1. parseInputValue
|
|
326
|
+
* 2. locale
|
|
327
|
+
*/
|
|
320
328
|
_defineProperty(this, "parseDate", date => {
|
|
321
329
|
const {
|
|
322
330
|
parseInputValue,
|
|
@@ -330,6 +338,13 @@ class DatePicker extends Component {
|
|
|
330
338
|
} = this.getSafeState();
|
|
331
339
|
return l10n.parseDate(date);
|
|
332
340
|
});
|
|
341
|
+
/**
|
|
342
|
+
* There are multiple props that can change how the date is formatted.
|
|
343
|
+
* The priority of props used is:
|
|
344
|
+
* 1. formatDisplayLabel
|
|
345
|
+
* 2. dateFormat
|
|
346
|
+
* 3. locale
|
|
347
|
+
*/
|
|
333
348
|
_defineProperty(this, "formatDate", value => {
|
|
334
349
|
const {
|
|
335
350
|
formatDisplayLabel,
|
|
@@ -373,22 +388,6 @@ class DatePicker extends Component {
|
|
|
373
388
|
});
|
|
374
389
|
}
|
|
375
390
|
}
|
|
376
|
-
|
|
377
|
-
// All state needs to be accessed via this function so that the state is mapped from props
|
|
378
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
379
|
-
/**
|
|
380
|
-
* There are two props that can change how the date is parsed.
|
|
381
|
-
* The priority of props used is:
|
|
382
|
-
* 1. parseInputValue
|
|
383
|
-
* 2. locale
|
|
384
|
-
*/
|
|
385
|
-
/**
|
|
386
|
-
* There are multiple props that can change how the date is formatted.
|
|
387
|
-
* The priority of props used is:
|
|
388
|
-
* 1. formatDisplayLabel
|
|
389
|
-
* 2. dateFormat
|
|
390
|
-
* 3. locale
|
|
391
|
-
*/
|
|
392
391
|
render() {
|
|
393
392
|
const {
|
|
394
393
|
appearance,
|
|
@@ -17,7 +17,7 @@ import DatePicker from './date-picker';
|
|
|
17
17
|
import TimePicker from './time-picker';
|
|
18
18
|
import { convertTokens } from './utils';
|
|
19
19
|
const packageName = "@atlaskit/datetime-picker";
|
|
20
|
-
const packageVersion = "12.
|
|
20
|
+
const packageVersion = "12.4.0";
|
|
21
21
|
|
|
22
22
|
/* eslint-disable react/no-unused-prop-types */
|
|
23
23
|
|
|
@@ -154,6 +154,8 @@ class DateTimePicker extends React.Component {
|
|
|
154
154
|
value: this.props.defaultValue,
|
|
155
155
|
zoneValue: ''
|
|
156
156
|
});
|
|
157
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
158
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
157
159
|
_defineProperty(this, "getSafeState", () => {
|
|
158
160
|
const mappedState = {
|
|
159
161
|
...this.state,
|
|
@@ -195,8 +197,7 @@ class DateTimePicker extends React.Component {
|
|
|
195
197
|
dateValue: ''
|
|
196
198
|
});
|
|
197
199
|
});
|
|
198
|
-
}
|
|
199
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
200
|
+
}
|
|
200
201
|
parseValue(value, dateValue, timeValue, zoneValue) {
|
|
201
202
|
if (this.props.parseValue) {
|
|
202
203
|
return this.props.parseValue(value, dateValue, timeValue, zoneValue);
|
|
@@ -256,8 +257,7 @@ class DateTimePicker extends React.Component {
|
|
|
256
257
|
times,
|
|
257
258
|
timeFormat,
|
|
258
259
|
locale,
|
|
259
|
-
testId
|
|
260
|
-
'aria-labelledby': ariaLabelledBy
|
|
260
|
+
testId
|
|
261
261
|
} = this.props;
|
|
262
262
|
const {
|
|
263
263
|
isFocused,
|
|
@@ -297,8 +297,6 @@ class DateTimePicker extends React.Component {
|
|
|
297
297
|
return jsx("div", _extends({
|
|
298
298
|
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles), bothProps.appearance === 'none' && noBgStyles]
|
|
299
299
|
}, innerProps, {
|
|
300
|
-
role: "group",
|
|
301
|
-
"aria-labelledby": ariaLabelledBy,
|
|
302
300
|
"data-testid": testId
|
|
303
301
|
}), jsx("input", {
|
|
304
302
|
name: name,
|
|
@@ -16,7 +16,7 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
16
16
|
import parseTime from '../internal/parse-time';
|
|
17
17
|
import { convertTokens } from './utils';
|
|
18
18
|
const packageName = "@atlaskit/datetime-picker";
|
|
19
|
-
const packageVersion = "12.
|
|
19
|
+
const packageVersion = "12.4.0";
|
|
20
20
|
|
|
21
21
|
/* eslint-disable react/no-unused-prop-types */
|
|
22
22
|
|
|
@@ -74,6 +74,8 @@ class TimePicker extends React.Component {
|
|
|
74
74
|
isFocused: false,
|
|
75
75
|
l10n: createLocalizationProvider(this.props.locale)
|
|
76
76
|
});
|
|
77
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
78
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
77
79
|
_defineProperty(this, "getSafeState", () => {
|
|
78
80
|
return {
|
|
79
81
|
...this.state,
|
|
@@ -95,6 +97,9 @@ class TimePicker extends React.Component {
|
|
|
95
97
|
this.setState(changedState);
|
|
96
98
|
this.props.onChange(value);
|
|
97
99
|
});
|
|
100
|
+
/**
|
|
101
|
+
* Only allow custom times if timeIsEditable prop is true
|
|
102
|
+
*/
|
|
98
103
|
_defineProperty(this, "onCreateOption", inputValue => {
|
|
99
104
|
if (this.props.timeIsEditable) {
|
|
100
105
|
const {
|
|
@@ -174,6 +179,13 @@ class TimePicker extends React.Component {
|
|
|
174
179
|
});
|
|
175
180
|
}
|
|
176
181
|
});
|
|
182
|
+
/**
|
|
183
|
+
* There are multiple props that can change how the time is formatted.
|
|
184
|
+
* The priority of props used is:
|
|
185
|
+
* 1. formatDisplayLabel
|
|
186
|
+
* 2. timeFormat
|
|
187
|
+
* 3. locale
|
|
188
|
+
*/
|
|
177
189
|
_defineProperty(this, "formatTime", time => {
|
|
178
190
|
const {
|
|
179
191
|
formatDisplayLabel,
|
|
@@ -217,9 +229,6 @@ class TimePicker extends React.Component {
|
|
|
217
229
|
});
|
|
218
230
|
}
|
|
219
231
|
}
|
|
220
|
-
|
|
221
|
-
// All state needs to be accessed via this function so that the state is mapped from props
|
|
222
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
223
232
|
getOptions() {
|
|
224
233
|
return this.props.times.map(time => {
|
|
225
234
|
return {
|
|
@@ -228,19 +237,6 @@ class TimePicker extends React.Component {
|
|
|
228
237
|
};
|
|
229
238
|
});
|
|
230
239
|
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Only allow custom times if timeIsEditable prop is true
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* There are multiple props that can change how the time is formatted.
|
|
238
|
-
* The priority of props used is:
|
|
239
|
-
* 1. formatDisplayLabel
|
|
240
|
-
* 2. timeFormat
|
|
241
|
-
* 3. locale
|
|
242
|
-
*/
|
|
243
|
-
|
|
244
240
|
render() {
|
|
245
241
|
const {
|
|
246
242
|
autoFocus,
|
package/dist/es2019/version.json
CHANGED
|
@@ -29,7 +29,7 @@ import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from
|
|
|
29
29
|
import FixedLayer from '../internal/fixed-layer';
|
|
30
30
|
import { convertTokens } from './utils';
|
|
31
31
|
var packageName = "@atlaskit/datetime-picker";
|
|
32
|
-
var packageVersion = "12.
|
|
32
|
+
var packageVersion = "12.4.0";
|
|
33
33
|
|
|
34
34
|
/* eslint-disable react/no-unused-prop-types */
|
|
35
35
|
|
|
@@ -112,6 +112,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
112
112
|
_this = _super.call(this, props);
|
|
113
113
|
_defineProperty(_assertThisInitialized(_this), "calendarRef", null);
|
|
114
114
|
_defineProperty(_assertThisInitialized(_this), "containerRef", null);
|
|
115
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
116
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
115
117
|
_defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
|
|
116
118
|
return _objectSpread(_objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value', 'isOpen'])), pick(_this.props.selectProps, ['inputValue']));
|
|
117
119
|
});
|
|
@@ -326,6 +328,12 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
326
328
|
_this.forceUpdate();
|
|
327
329
|
}
|
|
328
330
|
});
|
|
331
|
+
/**
|
|
332
|
+
* There are two props that can change how the date is parsed.
|
|
333
|
+
* The priority of props used is:
|
|
334
|
+
* 1. parseInputValue
|
|
335
|
+
* 2. locale
|
|
336
|
+
*/
|
|
329
337
|
_defineProperty(_assertThisInitialized(_this), "parseDate", function (date) {
|
|
330
338
|
var _this$props = _this.props,
|
|
331
339
|
parseInputValue = _this$props.parseInputValue,
|
|
@@ -337,6 +345,13 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
337
345
|
l10n = _this$getSafeState4.l10n;
|
|
338
346
|
return l10n.parseDate(date);
|
|
339
347
|
});
|
|
348
|
+
/**
|
|
349
|
+
* There are multiple props that can change how the date is formatted.
|
|
350
|
+
* The priority of props used is:
|
|
351
|
+
* 1. formatDisplayLabel
|
|
352
|
+
* 2. dateFormat
|
|
353
|
+
* 3. locale
|
|
354
|
+
*/
|
|
340
355
|
_defineProperty(_assertThisInitialized(_this), "formatDate", function (value) {
|
|
341
356
|
var _this$props2 = _this.props,
|
|
342
357
|
formatDisplayLabel = _this$props2.formatDisplayLabel,
|
|
@@ -378,22 +393,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
378
393
|
});
|
|
379
394
|
}
|
|
380
395
|
}
|
|
381
|
-
|
|
382
|
-
// All state needs to be accessed via this function so that the state is mapped from props
|
|
383
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
384
|
-
/**
|
|
385
|
-
* There are two props that can change how the date is parsed.
|
|
386
|
-
* The priority of props used is:
|
|
387
|
-
* 1. parseInputValue
|
|
388
|
-
* 2. locale
|
|
389
|
-
*/
|
|
390
|
-
/**
|
|
391
|
-
* There are multiple props that can change how the date is formatted.
|
|
392
|
-
* The priority of props used is:
|
|
393
|
-
* 1. formatDisplayLabel
|
|
394
|
-
* 2. dateFormat
|
|
395
|
-
* 3. locale
|
|
396
|
-
*/
|
|
397
396
|
}, {
|
|
398
397
|
key: "render",
|
|
399
398
|
value: function render() {
|
|
@@ -27,7 +27,7 @@ import DatePicker from './date-picker';
|
|
|
27
27
|
import TimePicker from './time-picker';
|
|
28
28
|
import { convertTokens } from './utils';
|
|
29
29
|
var packageName = "@atlaskit/datetime-picker";
|
|
30
|
-
var packageVersion = "12.
|
|
30
|
+
var packageVersion = "12.4.0";
|
|
31
31
|
|
|
32
32
|
/* eslint-disable react/no-unused-prop-types */
|
|
33
33
|
|
|
@@ -172,6 +172,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
172
172
|
value: _this.props.defaultValue,
|
|
173
173
|
zoneValue: ''
|
|
174
174
|
});
|
|
175
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
176
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
175
177
|
_defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
|
|
176
178
|
var mappedState = _objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value']));
|
|
177
179
|
return _objectSpread(_objectSpread({}, mappedState), _this.parseValue(mappedState.value, mappedState.dateValue, mappedState.timeValue, mappedState.zoneValue));
|
|
@@ -205,8 +207,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
205
207
|
}));
|
|
206
208
|
});
|
|
207
209
|
return _this;
|
|
208
|
-
}
|
|
209
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
210
|
+
}
|
|
210
211
|
_createClass(DateTimePicker, [{
|
|
211
212
|
key: "parseValue",
|
|
212
213
|
value: function parseValue(value, dateValue, timeValue, zoneValue) {
|
|
@@ -270,8 +271,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
270
271
|
times = _this$props.times,
|
|
271
272
|
timeFormat = _this$props.timeFormat,
|
|
272
273
|
locale = _this$props.locale,
|
|
273
|
-
testId = _this$props.testId
|
|
274
|
-
ariaLabelledBy = _this$props['aria-labelledby'];
|
|
274
|
+
testId = _this$props.testId;
|
|
275
275
|
var _this$getSafeState = this.getSafeState(),
|
|
276
276
|
isFocused = _this$getSafeState.isFocused,
|
|
277
277
|
value = _this$getSafeState.value,
|
|
@@ -305,8 +305,6 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
305
305
|
return jsx("div", _extends({
|
|
306
306
|
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles), bothProps.appearance === 'none' && noBgStyles]
|
|
307
307
|
}, innerProps, {
|
|
308
|
-
role: "group",
|
|
309
|
-
"aria-labelledby": ariaLabelledBy,
|
|
310
308
|
"data-testid": testId
|
|
311
309
|
}), jsx("input", {
|
|
312
310
|
name: name,
|
|
@@ -29,7 +29,7 @@ import FixedLayer from '../internal/fixed-layer';
|
|
|
29
29
|
import parseTime from '../internal/parse-time';
|
|
30
30
|
import { convertTokens } from './utils';
|
|
31
31
|
var packageName = "@atlaskit/datetime-picker";
|
|
32
|
-
var packageVersion = "12.
|
|
32
|
+
var packageVersion = "12.4.0";
|
|
33
33
|
|
|
34
34
|
/* eslint-disable react/no-unused-prop-types */
|
|
35
35
|
|
|
@@ -96,6 +96,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
96
96
|
isFocused: false,
|
|
97
97
|
l10n: createLocalizationProvider(_this.props.locale)
|
|
98
98
|
});
|
|
99
|
+
// All state needs to be accessed via this function so that the state is mapped from props
|
|
100
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
99
101
|
_defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
|
|
100
102
|
return _objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value', 'isOpen']));
|
|
101
103
|
});
|
|
@@ -113,6 +115,9 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
113
115
|
_this.setState(changedState);
|
|
114
116
|
_this.props.onChange(value);
|
|
115
117
|
});
|
|
118
|
+
/**
|
|
119
|
+
* Only allow custom times if timeIsEditable prop is true
|
|
120
|
+
*/
|
|
116
121
|
_defineProperty(_assertThisInitialized(_this), "onCreateOption", function (inputValue) {
|
|
117
122
|
if (_this.props.timeIsEditable) {
|
|
118
123
|
var _this$props = _this.props,
|
|
@@ -189,6 +194,13 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
189
194
|
});
|
|
190
195
|
}
|
|
191
196
|
});
|
|
197
|
+
/**
|
|
198
|
+
* There are multiple props that can change how the time is formatted.
|
|
199
|
+
* The priority of props used is:
|
|
200
|
+
* 1. formatDisplayLabel
|
|
201
|
+
* 2. timeFormat
|
|
202
|
+
* 3. locale
|
|
203
|
+
*/
|
|
192
204
|
_defineProperty(_assertThisInitialized(_this), "formatTime", function (time) {
|
|
193
205
|
var _this$props2 = _this.props,
|
|
194
206
|
formatDisplayLabel = _this$props2.formatDisplayLabel,
|
|
@@ -230,9 +242,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
230
242
|
});
|
|
231
243
|
}
|
|
232
244
|
}
|
|
233
|
-
|
|
234
|
-
// All state needs to be accessed via this function so that the state is mapped from props
|
|
235
|
-
// correctly to allow controlled/uncontrolled usage.
|
|
236
245
|
}, {
|
|
237
246
|
key: "getOptions",
|
|
238
247
|
value: function getOptions() {
|
|
@@ -244,18 +253,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
244
253
|
};
|
|
245
254
|
});
|
|
246
255
|
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Only allow custom times if timeIsEditable prop is true
|
|
250
|
-
*/
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* There are multiple props that can change how the time is formatted.
|
|
254
|
-
* The priority of props used is:
|
|
255
|
-
* 1. formatDisplayLabel
|
|
256
|
-
* 2. timeFormat
|
|
257
|
-
* 3. locale
|
|
258
|
-
*/
|
|
259
256
|
}, {
|
|
260
257
|
key: "render",
|
|
261
258
|
value: function render() {
|
package/dist/esm/version.json
CHANGED
|
@@ -26,11 +26,6 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
26
26
|
* Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
|
|
27
27
|
*/
|
|
28
28
|
id?: string;
|
|
29
|
-
/**
|
|
30
|
-
* The ID of the element that labels the datetime picker field. This will
|
|
31
|
-
* label the element that groups both the datepicker and the timepicker.
|
|
32
|
-
*/
|
|
33
|
-
'aria-labelledby'?: string;
|
|
34
29
|
/**
|
|
35
30
|
* Props to apply to the container. *
|
|
36
31
|
*/
|
|
@@ -201,7 +196,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
|
|
|
201
196
|
render(): jsx.JSX.Element;
|
|
202
197
|
}
|
|
203
198
|
export { DateTimePicker as DateTimePickerWithoutAnalytics };
|
|
204
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "
|
|
199
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "appearance" | "autoFocus" | "defaultValue" | "id" | "innerProps" | "isDisabled" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
|
|
205
200
|
appearance: string;
|
|
206
201
|
autoFocus: boolean;
|
|
207
202
|
isDisabled: boolean;
|
|
@@ -221,5 +216,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimeP
|
|
|
221
216
|
times: string[];
|
|
222
217
|
spacing: string;
|
|
223
218
|
locale: string;
|
|
224
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "appearance" | "autoFocus" | "defaultValue" | "id" | "innerProps" | "isDisabled" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "value" | "isInvalid" | "dateFormat" | "locale" | "key" | "analyticsContext" | "
|
|
219
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "appearance" | "autoFocus" | "defaultValue" | "id" | "innerProps" | "isDisabled" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "value" | "isInvalid" | "dateFormat" | "locale" | "key" | "analyticsContext" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "parseValue" | "datePickerSelectProps" | "timePickerSelectProps"> & React.RefAttributes<any>>;
|
|
225
220
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.4.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/"
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"@types/testing-library__jest-dom": "^5.14.5",
|
|
64
64
|
"moment": "^2.29.2",
|
|
65
65
|
"react-dom": "^16.8.0",
|
|
66
|
-
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
67
66
|
"react-lorem-component": "^0.13.0",
|
|
68
67
|
"react-test-renderer": "^16.8.0",
|
|
69
68
|
"typescript": "4.5.5"
|