@atlaskit/datetime-picker 12.3.10 → 12.3.12
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 +14 -0
- package/dist/cjs/components/date-picker.js +16 -8
- package/dist/cjs/components/date-time-picker.js +12 -8
- package/dist/cjs/components/time-picker.js +21 -3
- package/dist/cjs/internal/fixed-layer.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/date-picker.js +15 -8
- package/dist/es2019/components/date-time-picker.js +11 -7
- package/dist/es2019/components/time-picker.js +20 -4
- package/dist/es2019/internal/fixed-layer.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/date-picker.js +15 -7
- package/dist/esm/components/date-time-picker.js +11 -7
- package/dist/esm/components/time-picker.js +19 -3
- package/dist/esm/internal/fixed-layer.js +1 -0
- package/dist/esm/version.json +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 12.3.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
8
|
+
- [`e754545d460`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e754545d460) - [ux] Ensure no duplicate ID's when using `selectProps` on any of the DateTime Picker components.
|
|
9
|
+
|
|
10
|
+
## 12.3.11
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`b50c6475079`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b50c6475079) - Make clear button in datetime picker a button element that is out of the tab order. This mimics the native input element's clear behavior in Safari/Edge.
|
|
15
|
+
- [`c0fb88b3af6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c0fb88b3af6) - [ux] style(calendar): update icon color token from text.subtlest to color.icon
|
|
16
|
+
|
|
3
17
|
## 12.3.10
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -34,9 +34,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
34
|
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; }
|
|
35
35
|
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; }
|
|
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
|
-
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; } }
|
|
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.3.
|
|
39
|
+
var packageVersion = "12.3.12";
|
|
40
40
|
|
|
41
41
|
/* eslint-disable react/no-unused-prop-types */
|
|
42
42
|
|
|
@@ -218,11 +218,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
218
218
|
// today's date
|
|
219
219
|
var yearIsOverLimit = calendarValue.match(/^\d{5,}/);
|
|
220
220
|
if (yearIsOverLimit) {
|
|
221
|
-
|
|
222
|
-
var year = today.getFullYear();
|
|
223
|
-
var month = (today.getMonth() + 1).toString().padStart(2, '0');
|
|
224
|
-
var day = today.getDate().toString().padStart(2, '0');
|
|
225
|
-
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
221
|
+
return getShortISOString(new Date());
|
|
226
222
|
}
|
|
227
223
|
return calendarValue;
|
|
228
224
|
});
|
|
@@ -392,6 +388,19 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
392
388
|
|
|
393
389
|
// All state needs to be accessed via this function so that the state is mapped from props
|
|
394
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
|
+
*/
|
|
395
404
|
}, {
|
|
396
405
|
key: "render",
|
|
397
406
|
value: function render() {
|
|
@@ -461,7 +470,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
461
470
|
ref: this.getContainerRef,
|
|
462
471
|
"data-testid": testId && "".concat(testId, "--container")
|
|
463
472
|
}), (0, _react2.jsx)("input", {
|
|
464
|
-
id: selectProps.inputId,
|
|
465
473
|
name: name,
|
|
466
474
|
type: "hidden",
|
|
467
475
|
value: value,
|
|
@@ -29,9 +29,9 @@ var _utils = require("./utils");
|
|
|
29
29
|
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); }; }
|
|
30
30
|
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; } }
|
|
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
|
-
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; }
|
|
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.3.
|
|
34
|
+
var packageVersion = "12.3.12";
|
|
35
35
|
|
|
36
36
|
/* eslint-disable react/no-unused-prop-types */
|
|
37
37
|
|
|
@@ -108,6 +108,8 @@ var iconContainerStyles = (0, _react2.css)({
|
|
|
108
108
|
paddingLeft: "".concat(ICON_PADDING * 2, "px"),
|
|
109
109
|
alignItems: 'center',
|
|
110
110
|
flexBasis: 'inherit',
|
|
111
|
+
backgroundColor: 'inherit',
|
|
112
|
+
border: 'none',
|
|
111
113
|
color: "var(--ds-text-subtlest, ".concat(_colors.N70, ")"),
|
|
112
114
|
transition: "color 150ms",
|
|
113
115
|
'&:hover': {
|
|
@@ -204,7 +206,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
204
206
|
}));
|
|
205
207
|
});
|
|
206
208
|
return _this;
|
|
207
|
-
}
|
|
209
|
+
} // All state needs to be accessed via this function so that the state is mapped from props
|
|
210
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
208
211
|
(0, _createClass2.default)(DateTimePicker, [{
|
|
209
212
|
key: "parseValue",
|
|
210
213
|
value: function parseValue(value, dateValue, timeValue, zoneValue) {
|
|
@@ -297,16 +300,15 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
297
300
|
// Don't use Date or TimePicker's because they can't be customised
|
|
298
301
|
var isClearable = Boolean(dateValue || timeValue);
|
|
299
302
|
var notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
300
|
-
var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
301
303
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
302
304
|
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]
|
|
303
305
|
}, innerProps, {
|
|
304
306
|
"data-testid": testId
|
|
305
307
|
}), (0, _react2.jsx)("input", {
|
|
306
|
-
id: labelId,
|
|
307
308
|
name: name,
|
|
308
309
|
type: "hidden",
|
|
309
|
-
value: value
|
|
310
|
+
value: value,
|
|
311
|
+
"data-testid": testId && "".concat(testId, "--input")
|
|
310
312
|
}), (0, _react2.jsx)("div", {
|
|
311
313
|
css: datePickerContainerStyles
|
|
312
314
|
}, (0, _react2.jsx)(_datePicker.default, (0, _extends2.default)({}, bothProps, {
|
|
@@ -333,10 +335,12 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
333
335
|
testId: testId && "".concat(testId, "--timepicker")
|
|
334
336
|
}, timePickerProps))), isClearable && !isDisabled ?
|
|
335
337
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
336
|
-
(0, _react2.jsx)("
|
|
338
|
+
(0, _react2.jsx)("button", {
|
|
337
339
|
css: iconContainerStyles,
|
|
338
340
|
onClick: this.onClear,
|
|
339
|
-
"data-testid": testId && "".concat(testId, "--icon--container")
|
|
341
|
+
"data-testid": testId && "".concat(testId, "--icon--container"),
|
|
342
|
+
tabIndex: -1,
|
|
343
|
+
type: "button"
|
|
340
344
|
}, (0, _react2.jsx)(_selectClear.default, {
|
|
341
345
|
size: "small",
|
|
342
346
|
primaryColor: "inherit",
|
|
@@ -28,6 +28,9 @@ var _parseTime = _interopRequireDefault(require("../internal/parse-time"));
|
|
|
28
28
|
var _utils = require("./utils");
|
|
29
29
|
var _excluded = ["selectProps"],
|
|
30
30
|
_excluded2 = ["styles"];
|
|
31
|
+
/* eslint-disable @repo/internal/react/use-noop */
|
|
32
|
+
// eslint-disable-next-line no-restricted-imports
|
|
33
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
31
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
32
35
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
36
|
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; }
|
|
@@ -35,7 +38,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
35
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); }; }
|
|
36
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; } }
|
|
37
40
|
var packageName = "@atlaskit/datetime-picker";
|
|
38
|
-
var packageVersion = "12.3.
|
|
41
|
+
var packageVersion = "12.3.12";
|
|
42
|
+
|
|
43
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
44
|
+
|
|
39
45
|
var menuStyles = {
|
|
40
46
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
41
47
|
position: 'static',
|
|
@@ -247,6 +253,18 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
247
253
|
};
|
|
248
254
|
});
|
|
249
255
|
}
|
|
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
|
+
*/
|
|
250
268
|
}, {
|
|
251
269
|
key: "render",
|
|
252
270
|
value: function render() {
|
|
@@ -309,10 +327,10 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
309
327
|
"data-testid": testId && "".concat(testId, "--container"),
|
|
310
328
|
onKeyDown: this.onSelectKeyDown
|
|
311
329
|
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
312
|
-
id: selectProps.inputId,
|
|
313
330
|
name: name,
|
|
314
331
|
type: "hidden",
|
|
315
|
-
value: value
|
|
332
|
+
value: value,
|
|
333
|
+
"data-testid": testId && "".concat(testId, "--input")
|
|
316
334
|
}), /*#__PURE__*/_react.default.createElement(SelectComponent, (0, _extends2.default)({
|
|
317
335
|
appearance: this.props.appearance,
|
|
318
336
|
autoFocus: autoFocus,
|
|
@@ -21,7 +21,7 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
21
21
|
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; }
|
|
22
22
|
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; }
|
|
23
23
|
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); }; }
|
|
24
|
-
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; } }
|
|
24
|
+
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-next-line @atlaskit/design-system/no-deprecated-imports
|
|
25
25
|
/**
|
|
26
26
|
* This component renders layered content with fixed positioning.
|
|
27
27
|
* Scroll is locked outside the layer to prevent the layered content from detaching from the
|
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.3.
|
|
21
|
+
const packageVersion = "12.3.12";
|
|
22
22
|
|
|
23
23
|
/* eslint-disable react/no-unused-prop-types */
|
|
24
24
|
|
|
@@ -197,11 +197,7 @@ class DatePicker extends Component {
|
|
|
197
197
|
// today's date
|
|
198
198
|
const yearIsOverLimit = calendarValue.match(/^\d{5,}/);
|
|
199
199
|
if (yearIsOverLimit) {
|
|
200
|
-
|
|
201
|
-
const year = today.getFullYear();
|
|
202
|
-
const month = (today.getMonth() + 1).toString().padStart(2, '0');
|
|
203
|
-
const day = today.getDate().toString().padStart(2, '0');
|
|
204
|
-
return `${year}-${month}-${day}`;
|
|
200
|
+
return getShortISOString(new Date());
|
|
205
201
|
}
|
|
206
202
|
return calendarValue;
|
|
207
203
|
});
|
|
@@ -380,7 +376,19 @@ class DatePicker extends Component {
|
|
|
380
376
|
|
|
381
377
|
// All state needs to be accessed via this function so that the state is mapped from props
|
|
382
378
|
// correctly to allow controlled/uncontrolled usage.
|
|
383
|
-
|
|
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
|
+
*/
|
|
384
392
|
render() {
|
|
385
393
|
const {
|
|
386
394
|
appearance,
|
|
@@ -452,7 +460,6 @@ class DatePicker extends Component {
|
|
|
452
460
|
ref: this.getContainerRef,
|
|
453
461
|
"data-testid": testId && `${testId}--container`
|
|
454
462
|
}), jsx("input", {
|
|
455
|
-
id: selectProps.inputId,
|
|
456
463
|
name: name,
|
|
457
464
|
type: "hidden",
|
|
458
465
|
value: value,
|
|
@@ -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.3.
|
|
20
|
+
const packageVersion = "12.3.12";
|
|
21
21
|
|
|
22
22
|
/* eslint-disable react/no-unused-prop-types */
|
|
23
23
|
|
|
@@ -94,6 +94,8 @@ const iconContainerStyles = css({
|
|
|
94
94
|
paddingLeft: `${ICON_PADDING * 2}px`,
|
|
95
95
|
alignItems: 'center',
|
|
96
96
|
flexBasis: 'inherit',
|
|
97
|
+
backgroundColor: 'inherit',
|
|
98
|
+
border: 'none',
|
|
97
99
|
color: `var(--ds-text-subtlest, ${N70})`,
|
|
98
100
|
transition: `color 150ms`,
|
|
99
101
|
'&:hover': {
|
|
@@ -191,7 +193,8 @@ class DateTimePicker extends React.Component {
|
|
|
191
193
|
dateValue: ''
|
|
192
194
|
});
|
|
193
195
|
});
|
|
194
|
-
}
|
|
196
|
+
} // All state needs to be accessed via this function so that the state is mapped from props
|
|
197
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
195
198
|
parseValue(value, dateValue, timeValue, zoneValue) {
|
|
196
199
|
if (this.props.parseValue) {
|
|
197
200
|
return this.props.parseValue(value, dateValue, timeValue, zoneValue);
|
|
@@ -286,16 +289,15 @@ class DateTimePicker extends React.Component {
|
|
|
286
289
|
// Don't use Date or TimePicker's because they can't be customised
|
|
287
290
|
const isClearable = Boolean(dateValue || timeValue);
|
|
288
291
|
const notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
289
|
-
const labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
290
292
|
return jsx("div", _extends({
|
|
291
293
|
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]
|
|
292
294
|
}, innerProps, {
|
|
293
295
|
"data-testid": testId
|
|
294
296
|
}), jsx("input", {
|
|
295
|
-
id: labelId,
|
|
296
297
|
name: name,
|
|
297
298
|
type: "hidden",
|
|
298
|
-
value: value
|
|
299
|
+
value: value,
|
|
300
|
+
"data-testid": testId && `${testId}--input`
|
|
299
301
|
}), jsx("div", {
|
|
300
302
|
css: datePickerContainerStyles
|
|
301
303
|
}, jsx(DatePicker, _extends({}, bothProps, {
|
|
@@ -322,10 +324,12 @@ class DateTimePicker extends React.Component {
|
|
|
322
324
|
testId: testId && `${testId}--timepicker`
|
|
323
325
|
}, timePickerProps))), isClearable && !isDisabled ?
|
|
324
326
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
325
|
-
jsx("
|
|
327
|
+
jsx("button", {
|
|
326
328
|
css: iconContainerStyles,
|
|
327
329
|
onClick: this.onClear,
|
|
328
|
-
"data-testid": testId && `${testId}--icon--container
|
|
330
|
+
"data-testid": testId && `${testId}--icon--container`,
|
|
331
|
+
tabIndex: -1,
|
|
332
|
+
type: "button"
|
|
329
333
|
}, jsx(SelectClearIcon, {
|
|
330
334
|
size: "small",
|
|
331
335
|
primaryColor: "inherit",
|
|
@@ -9,13 +9,17 @@ import pick from 'lodash/pick';
|
|
|
9
9
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
11
11
|
import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
|
|
12
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
12
13
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
13
14
|
import { defaultTimeFormat, defaultTimes, EmptyComponent, placeholderDatetime } from '../internal';
|
|
14
15
|
import FixedLayer from '../internal/fixed-layer';
|
|
15
16
|
import parseTime from '../internal/parse-time';
|
|
16
17
|
import { convertTokens } from './utils';
|
|
17
18
|
const packageName = "@atlaskit/datetime-picker";
|
|
18
|
-
const packageVersion = "12.3.
|
|
19
|
+
const packageVersion = "12.3.12";
|
|
20
|
+
|
|
21
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
22
|
+
|
|
19
23
|
const menuStyles = {
|
|
20
24
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
21
25
|
position: 'static',
|
|
@@ -216,7 +220,6 @@ class TimePicker extends React.Component {
|
|
|
216
220
|
|
|
217
221
|
// All state needs to be accessed via this function so that the state is mapped from props
|
|
218
222
|
// correctly to allow controlled/uncontrolled usage.
|
|
219
|
-
|
|
220
223
|
getOptions() {
|
|
221
224
|
return this.props.times.map(time => {
|
|
222
225
|
return {
|
|
@@ -225,6 +228,19 @@ class TimePicker extends React.Component {
|
|
|
225
228
|
};
|
|
226
229
|
});
|
|
227
230
|
}
|
|
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
|
+
|
|
228
244
|
render() {
|
|
229
245
|
const {
|
|
230
246
|
autoFocus,
|
|
@@ -286,10 +302,10 @@ class TimePicker extends React.Component {
|
|
|
286
302
|
"data-testid": testId && `${testId}--container`,
|
|
287
303
|
onKeyDown: this.onSelectKeyDown
|
|
288
304
|
}), /*#__PURE__*/React.createElement("input", {
|
|
289
|
-
id: selectProps.inputId,
|
|
290
305
|
name: name,
|
|
291
306
|
type: "hidden",
|
|
292
|
-
value: value
|
|
307
|
+
value: value,
|
|
308
|
+
"data-testid": testId && `${testId}--input`
|
|
293
309
|
}), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
294
310
|
appearance: this.props.appearance,
|
|
295
311
|
autoFocus: autoFocus,
|
|
@@ -4,6 +4,7 @@ import ScrollLock from 'react-scrolllock';
|
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { sizes } from '@atlaskit/icon';
|
|
6
6
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
7
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
7
8
|
import { gridSize, layers } from '@atlaskit/theme/constants';
|
|
8
9
|
/**
|
|
9
10
|
* This component renders layered content with fixed positioning.
|
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.3.
|
|
32
|
+
var packageVersion = "12.3.12";
|
|
33
33
|
|
|
34
34
|
/* eslint-disable react/no-unused-prop-types */
|
|
35
35
|
|
|
@@ -211,11 +211,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
211
211
|
// today's date
|
|
212
212
|
var yearIsOverLimit = calendarValue.match(/^\d{5,}/);
|
|
213
213
|
if (yearIsOverLimit) {
|
|
214
|
-
|
|
215
|
-
var year = today.getFullYear();
|
|
216
|
-
var month = (today.getMonth() + 1).toString().padStart(2, '0');
|
|
217
|
-
var day = today.getDate().toString().padStart(2, '0');
|
|
218
|
-
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
214
|
+
return getShortISOString(new Date());
|
|
219
215
|
}
|
|
220
216
|
return calendarValue;
|
|
221
217
|
});
|
|
@@ -385,6 +381,19 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
385
381
|
|
|
386
382
|
// All state needs to be accessed via this function so that the state is mapped from props
|
|
387
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
|
+
*/
|
|
388
397
|
}, {
|
|
389
398
|
key: "render",
|
|
390
399
|
value: function render() {
|
|
@@ -454,7 +463,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
454
463
|
ref: this.getContainerRef,
|
|
455
464
|
"data-testid": testId && "".concat(testId, "--container")
|
|
456
465
|
}), jsx("input", {
|
|
457
|
-
id: selectProps.inputId,
|
|
458
466
|
name: name,
|
|
459
467
|
type: "hidden",
|
|
460
468
|
value: value,
|
|
@@ -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.3.
|
|
30
|
+
var packageVersion = "12.3.12";
|
|
31
31
|
|
|
32
32
|
/* eslint-disable react/no-unused-prop-types */
|
|
33
33
|
|
|
@@ -104,6 +104,8 @@ var iconContainerStyles = css({
|
|
|
104
104
|
paddingLeft: "".concat(ICON_PADDING * 2, "px"),
|
|
105
105
|
alignItems: 'center',
|
|
106
106
|
flexBasis: 'inherit',
|
|
107
|
+
backgroundColor: 'inherit',
|
|
108
|
+
border: 'none',
|
|
107
109
|
color: "var(--ds-text-subtlest, ".concat(N70, ")"),
|
|
108
110
|
transition: "color 150ms",
|
|
109
111
|
'&:hover': {
|
|
@@ -200,7 +202,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
200
202
|
}));
|
|
201
203
|
});
|
|
202
204
|
return _this;
|
|
203
|
-
}
|
|
205
|
+
} // All state needs to be accessed via this function so that the state is mapped from props
|
|
206
|
+
// correctly to allow controlled/uncontrolled usage.
|
|
204
207
|
_createClass(DateTimePicker, [{
|
|
205
208
|
key: "parseValue",
|
|
206
209
|
value: function parseValue(value, dateValue, timeValue, zoneValue) {
|
|
@@ -293,16 +296,15 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
293
296
|
// Don't use Date or TimePicker's because they can't be customised
|
|
294
297
|
var isClearable = Boolean(dateValue || timeValue);
|
|
295
298
|
var notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
296
|
-
var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
297
299
|
return jsx("div", _extends({
|
|
298
300
|
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
301
|
}, innerProps, {
|
|
300
302
|
"data-testid": testId
|
|
301
303
|
}), jsx("input", {
|
|
302
|
-
id: labelId,
|
|
303
304
|
name: name,
|
|
304
305
|
type: "hidden",
|
|
305
|
-
value: value
|
|
306
|
+
value: value,
|
|
307
|
+
"data-testid": testId && "".concat(testId, "--input")
|
|
306
308
|
}), jsx("div", {
|
|
307
309
|
css: datePickerContainerStyles
|
|
308
310
|
}, jsx(DatePicker, _extends({}, bothProps, {
|
|
@@ -329,10 +331,12 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
329
331
|
testId: testId && "".concat(testId, "--timepicker")
|
|
330
332
|
}, timePickerProps))), isClearable && !isDisabled ?
|
|
331
333
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
332
|
-
jsx("
|
|
334
|
+
jsx("button", {
|
|
333
335
|
css: iconContainerStyles,
|
|
334
336
|
onClick: this.onClear,
|
|
335
|
-
"data-testid": testId && "".concat(testId, "--icon--container")
|
|
337
|
+
"data-testid": testId && "".concat(testId, "--icon--container"),
|
|
338
|
+
tabIndex: -1,
|
|
339
|
+
type: "button"
|
|
336
340
|
}, jsx(SelectClearIcon, {
|
|
337
341
|
size: "small",
|
|
338
342
|
primaryColor: "inherit",
|
|
@@ -22,13 +22,17 @@ import pick from 'lodash/pick';
|
|
|
22
22
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
23
23
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
24
24
|
import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
|
|
25
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
25
26
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
26
27
|
import { defaultTimeFormat, defaultTimes, EmptyComponent, placeholderDatetime } from '../internal';
|
|
27
28
|
import FixedLayer from '../internal/fixed-layer';
|
|
28
29
|
import parseTime from '../internal/parse-time';
|
|
29
30
|
import { convertTokens } from './utils';
|
|
30
31
|
var packageName = "@atlaskit/datetime-picker";
|
|
31
|
-
var packageVersion = "12.3.
|
|
32
|
+
var packageVersion = "12.3.12";
|
|
33
|
+
|
|
34
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
35
|
+
|
|
32
36
|
var menuStyles = {
|
|
33
37
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
34
38
|
position: 'static',
|
|
@@ -240,6 +244,18 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
240
244
|
};
|
|
241
245
|
});
|
|
242
246
|
}
|
|
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
|
+
*/
|
|
243
259
|
}, {
|
|
244
260
|
key: "render",
|
|
245
261
|
value: function render() {
|
|
@@ -302,10 +318,10 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
302
318
|
"data-testid": testId && "".concat(testId, "--container"),
|
|
303
319
|
onKeyDown: this.onSelectKeyDown
|
|
304
320
|
}), /*#__PURE__*/React.createElement("input", {
|
|
305
|
-
id: selectProps.inputId,
|
|
306
321
|
name: name,
|
|
307
322
|
type: "hidden",
|
|
308
|
-
value: value
|
|
323
|
+
value: value,
|
|
324
|
+
"data-testid": testId && "".concat(testId, "--input")
|
|
309
325
|
}), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
310
326
|
appearance: this.props.appearance,
|
|
311
327
|
autoFocus: autoFocus,
|
|
@@ -14,6 +14,7 @@ import ScrollLock from 'react-scrolllock';
|
|
|
14
14
|
import noop from '@atlaskit/ds-lib/noop';
|
|
15
15
|
import { sizes } from '@atlaskit/icon';
|
|
16
16
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
17
18
|
import { gridSize, layers } from '@atlaskit/theme/constants';
|
|
18
19
|
/**
|
|
19
20
|
* This component renders layered content with fixed positioning.
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.12",
|
|
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/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/locale": "^2.1.0",
|
|
32
32
|
"@atlaskit/popper": "^5.4.0",
|
|
33
33
|
"@atlaskit/select": "^16.1.0",
|
|
34
|
-
"@atlaskit/theme": "^12.
|
|
34
|
+
"@atlaskit/theme": "^12.4.0",
|
|
35
35
|
"@atlaskit/tokens": "^1.2.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
37
|
"@emotion/react": "^11.7.1",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"react": "^16.8.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@atlaskit/button": "^16.
|
|
46
|
+
"@atlaskit/button": "^16.6.0",
|
|
47
47
|
"@atlaskit/docs": "*",
|
|
48
48
|
"@atlaskit/field-base": "^15.0.5",
|
|
49
|
-
"@atlaskit/form": "^8.
|
|
49
|
+
"@atlaskit/form": "^8.9.0",
|
|
50
50
|
"@atlaskit/modal-dialog": "^12.4.0",
|
|
51
51
|
"@atlaskit/popup": "^1.5.0",
|
|
52
52
|
"@atlaskit/range": "^7.0.0",
|