@atlaskit/datetime-picker 13.0.12 → 13.2.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 +16 -0
- package/dist/cjs/components/date-picker.js +10 -8
- package/dist/cjs/components/date-time-picker.js +4 -5
- package/dist/cjs/components/time-picker.js +7 -5
- package/dist/cjs/internal/date-time-picker-container.js +1 -1
- package/dist/cjs/internal/fixed-layer.js +1 -1
- package/dist/cjs/internal/menu.js +10 -2
- package/dist/cjs/internal/parse-date.js +6 -9
- package/dist/es2019/components/date-picker.js +7 -6
- package/dist/es2019/components/date-time-picker.js +3 -4
- package/dist/es2019/components/time-picker.js +4 -3
- package/dist/es2019/internal/date-time-picker-container.js +1 -1
- package/dist/es2019/internal/menu.js +9 -1
- package/dist/es2019/internal/parse-date.js +8 -9
- package/dist/esm/components/date-picker.js +8 -6
- package/dist/esm/components/date-time-picker.js +4 -5
- package/dist/esm/components/time-picker.js +5 -3
- package/dist/esm/internal/date-time-picker-container.js +1 -1
- package/dist/esm/internal/fixed-layer.js +1 -1
- package/dist/esm/internal/menu.js +9 -1
- package/dist/esm/internal/parse-date.js +8 -9
- package/dist/types/components/date-picker.d.ts +5 -2
- package/dist/types/components/time-picker.d.ts +5 -2
- package/dist/types/internal/parse-date.d.ts +6 -9
- package/dist/types/types.d.ts +10 -2
- package/dist/types-ts4.5/components/date-picker.d.ts +5 -2
- package/dist/types-ts4.5/components/time-picker.d.ts +5 -2
- package/dist/types-ts4.5/internal/parse-date.d.ts +6 -9
- package/dist/types-ts4.5/types.d.ts +10 -2
- package/extract-react-types/date-picker-props.tsx +1 -1
- package/extract-react-types/time-picker-props.tsx +1 -1
- package/package.json +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 13.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#80805](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80805) [`427c2dd9e0d6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/427c2dd9e0d6) - [ux] Update input border width from 2px to 1px with darker color to meet 3:1 color contrast
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 13.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#79261](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/79261) [`d679c084e0a9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d679c084e0a9) - Add optional `label` prop to DatePicker and TimePicker to supply an accessible name via `aria-label`
|
|
18
|
+
|
|
3
19
|
## 13.0.12
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -29,14 +29,14 @@ var _menu = require("../internal/menu");
|
|
|
29
29
|
var _parseDate = require("../internal/parse-date");
|
|
30
30
|
var _parseTokens = require("../internal/parse-tokens");
|
|
31
31
|
var _singleValue = require("../internal/single-value");
|
|
32
|
-
function _getRequireWildcardCache(
|
|
33
|
-
function _interopRequireWildcard(
|
|
32
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
33
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
34
34
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
35
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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() {
|
|
37
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
|
|
38
38
|
var packageName = "@atlaskit/datetime-picker";
|
|
39
|
-
var packageVersion = "13.0
|
|
39
|
+
var packageVersion = "13.2.0";
|
|
40
40
|
var datePickerDefaultProps = {
|
|
41
41
|
appearance: 'default',
|
|
42
42
|
autoFocus: false,
|
|
@@ -52,6 +52,7 @@ var datePickerDefaultProps = {
|
|
|
52
52
|
innerProps: {},
|
|
53
53
|
isDisabled: false,
|
|
54
54
|
isInvalid: false,
|
|
55
|
+
label: '',
|
|
55
56
|
name: '',
|
|
56
57
|
// These disables are here for proper typing when used as defaults. They
|
|
57
58
|
// should *not* use the `noop` function.
|
|
@@ -168,9 +169,9 @@ var DatePicker = exports.DatePickerWithoutAnalytics = /*#__PURE__*/function (_Co
|
|
|
168
169
|
_this.props.onFocus(event);
|
|
169
170
|
});
|
|
170
171
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onTextInput", function (event) {
|
|
171
|
-
var
|
|
172
|
-
if (
|
|
173
|
-
var parsed = _this.parseDate(
|
|
172
|
+
var inputValue = event.target.value;
|
|
173
|
+
if (inputValue) {
|
|
174
|
+
var parsed = _this.parseDate(inputValue);
|
|
174
175
|
// Only try to set the date if we have month & day
|
|
175
176
|
if (parsed && (0, _dateFns.isValid)(parsed)) {
|
|
176
177
|
// We format the parsed date to YYYY-MM-DD here because
|
|
@@ -359,6 +360,7 @@ var DatePicker = exports.DatePickerWithoutAnalytics = /*#__PURE__*/function (_Co
|
|
|
359
360
|
maxDate = _this$props3.maxDate,
|
|
360
361
|
minDate = _this$props3.minDate,
|
|
361
362
|
isInvalid = _this$props3.isInvalid,
|
|
363
|
+
label = _this$props3.label,
|
|
362
364
|
name = _this$props3.name,
|
|
363
365
|
nextMonthLabel = _this$props3.nextMonthLabel,
|
|
364
366
|
previousMonthLabel = _this$props3.previousMonthLabel,
|
|
@@ -430,6 +432,7 @@ var DatePicker = exports.DatePickerWithoutAnalytics = /*#__PURE__*/function (_Co
|
|
|
430
432
|
value: value,
|
|
431
433
|
"data-testid": testId && "".concat(testId, "--input")
|
|
432
434
|
}), (0, _react2.jsx)(_select.default, (0, _extends2.default)({
|
|
435
|
+
"aria-label": label || undefined,
|
|
433
436
|
appearance: this.props.appearance,
|
|
434
437
|
enableAnimation: false,
|
|
435
438
|
menuIsOpen: menuIsOpen,
|
|
@@ -455,7 +458,6 @@ var DatePicker = exports.DatePickerWithoutAnalytics = /*#__PURE__*/function (_Co
|
|
|
455
458
|
});
|
|
456
459
|
}
|
|
457
460
|
}),
|
|
458
|
-
|
|
459
461
|
placeholder: this.getPlaceholder(),
|
|
460
462
|
value: value && {
|
|
461
463
|
label: this.formatDate(value),
|
|
@@ -27,11 +27,11 @@ var _parseTokens = require("../internal/parse-tokens");
|
|
|
27
27
|
var _datePicker = _interopRequireDefault(require("./date-picker"));
|
|
28
28
|
var _timePicker = _interopRequireDefault(require("./time-picker"));
|
|
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
|
-
function _isNativeReflectConstruct() {
|
|
30
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
31
31
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
32
32
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */
|
|
33
33
|
var packageName = "@atlaskit/datetime-picker";
|
|
34
|
-
var packageVersion = "13.0
|
|
34
|
+
var packageVersion = "13.2.0";
|
|
35
35
|
// Make DatePicker 50% the width of DateTimePicker
|
|
36
36
|
// If rendering an icon container, shrink the TimePicker
|
|
37
37
|
var datePickerContainerStyles = (0, _react2.css)({
|
|
@@ -102,7 +102,6 @@ var dateTimePickerDefaultProps = {
|
|
|
102
102
|
// Not including a default prop for value as it will
|
|
103
103
|
// Make the component a controlled component
|
|
104
104
|
};
|
|
105
|
-
|
|
106
105
|
var datePickerDefaultAriaLabel = exports.datePickerDefaultAriaLabel = 'Date';
|
|
107
106
|
var timePickerDefaultAriaLabel = exports.timePickerDefaultAriaLabel = 'Time';
|
|
108
107
|
var DateTimePicker = exports.DateTimePickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
@@ -240,11 +239,11 @@ var DateTimePicker = exports.DateTimePickerWithoutAnalytics = /*#__PURE__*/funct
|
|
|
240
239
|
var _timePickerSelectProp = timePickerSelectProps.styles,
|
|
241
240
|
timePickerStyles = _timePickerSelectProp === void 0 ? {} : _timePickerSelectProp;
|
|
242
241
|
var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
|
|
243
|
-
'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
242
|
+
'aria-label': datePickerProps['label'] || datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
244
243
|
styles: (0, _select.mergeStyles)(styles, datePickerStyles)
|
|
245
244
|
});
|
|
246
245
|
var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
|
|
247
|
-
'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
246
|
+
'aria-label': timePickerProps['label'] || timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
248
247
|
styles: (0, _select.mergeStyles)(styles, timePickerStyles)
|
|
249
248
|
});
|
|
250
249
|
|
|
@@ -28,15 +28,15 @@ var _parseTime = _interopRequireDefault(require("../internal/parse-time"));
|
|
|
28
28
|
var _parseTokens = require("../internal/parse-tokens");
|
|
29
29
|
var _singleValue = require("../internal/single-value");
|
|
30
30
|
var _excluded = ["styles"];
|
|
31
|
-
function _getRequireWildcardCache(
|
|
32
|
-
function _interopRequireWildcard(
|
|
31
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
32
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
33
33
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
34
34
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
35
|
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
|
-
function _isNativeReflectConstruct() {
|
|
36
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // eslint-disable-next-line no-restricted-imports
|
|
37
37
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
38
38
|
var packageName = "@atlaskit/datetime-picker";
|
|
39
|
-
var packageVersion = "13.0
|
|
39
|
+
var packageVersion = "13.2.0";
|
|
40
40
|
var menuStyles = {
|
|
41
41
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
42
42
|
position: 'static',
|
|
@@ -55,6 +55,7 @@ var timePickerDefaultProps = {
|
|
|
55
55
|
innerProps: {},
|
|
56
56
|
isDisabled: false,
|
|
57
57
|
isInvalid: false,
|
|
58
|
+
label: '',
|
|
58
59
|
name: '',
|
|
59
60
|
// These disables are here for proper typing when used as defaults. They
|
|
60
61
|
// should *not* use the `noop` function.
|
|
@@ -124,7 +125,6 @@ var TimePicker = exports.TimePickerWithoutAnalytics = /*#__PURE__*/function (_Re
|
|
|
124
125
|
} catch (e) {
|
|
125
126
|
return; // do nothing, the main validation should happen in the form
|
|
126
127
|
}
|
|
127
|
-
|
|
128
128
|
var includesSeconds = !!(timeFormat && /[:.]?(s|ss)/.test(timeFormat));
|
|
129
129
|
var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
130
130
|
var formattedValue = (0, _dateFns.format)(sanitizedInput, formatFormat) || '';
|
|
@@ -205,6 +205,7 @@ var TimePicker = exports.TimePickerWithoutAnalytics = /*#__PURE__*/function (_Re
|
|
|
205
205
|
id = _this$props2.id,
|
|
206
206
|
innerProps = _this$props2.innerProps,
|
|
207
207
|
isDisabled = _this$props2.isDisabled,
|
|
208
|
+
label = _this$props2.label,
|
|
208
209
|
locale = _this$props2.locale,
|
|
209
210
|
name = _this$props2.name,
|
|
210
211
|
placeholder = _this$props2.placeholder,
|
|
@@ -298,6 +299,7 @@ var TimePicker = exports.TimePickerWithoutAnalytics = /*#__PURE__*/function (_Re
|
|
|
298
299
|
"data-testid": testId && "".concat(testId, "--input"),
|
|
299
300
|
onKeyDown: this.onSelectKeyDown
|
|
300
301
|
}), /*#__PURE__*/_react.default.createElement(SelectComponent, (0, _extends2.default)({
|
|
302
|
+
"aria-label": label || undefined,
|
|
301
303
|
appearance: appearance,
|
|
302
304
|
autoFocus: autoFocus,
|
|
303
305
|
components: selectComponents,
|
|
@@ -56,7 +56,7 @@ var isDisabledStyles = (0, _react.css)({
|
|
|
56
56
|
var baseContainerStyles = (0, _react.css)({
|
|
57
57
|
display: 'flex',
|
|
58
58
|
backgroundColor: "var(--ds-background-input, ".concat(_colors.N20, ")"),
|
|
59
|
-
border:
|
|
59
|
+
border: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border-input, ".concat(_colors.N100, ")")),
|
|
60
60
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
61
61
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
62
62
|
'&:hover': {
|
|
@@ -22,7 +22,7 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
22
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
24
|
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); }; }
|
|
25
|
-
function _isNativeReflectConstruct() {
|
|
25
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
26
26
|
/**
|
|
27
27
|
* This component renders layered content with fixed positioning.
|
|
28
28
|
* Scroll is locked outside the layer to prevent the layered content from detaching from the
|
|
@@ -7,15 +7,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.Menu = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
+
var _dateFns = require("date-fns");
|
|
10
11
|
var _calendar = _interopRequireDefault(require("@atlaskit/calendar"));
|
|
11
12
|
var _layering = require("@atlaskit/layering");
|
|
12
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
15
|
var _constants = require("@atlaskit/theme/constants");
|
|
15
16
|
var _fixedLayer = _interopRequireDefault(require("../internal/fixed-layer"));
|
|
16
|
-
var _parseDate = require("./parse-date");
|
|
17
17
|
/** @jsx jsx */
|
|
18
18
|
|
|
19
|
+
function getValidDate(iso) {
|
|
20
|
+
var date = (0, _dateFns.parseISO)(iso);
|
|
21
|
+
return (0, _dateFns.isValid)(date) ? {
|
|
22
|
+
day: date.getDate(),
|
|
23
|
+
month: date.getMonth() + 1,
|
|
24
|
+
year: date.getFullYear()
|
|
25
|
+
} : {};
|
|
26
|
+
}
|
|
19
27
|
var menuStyles = (0, _react.css)({
|
|
20
28
|
zIndex: _constants.layers.dialog(),
|
|
21
29
|
backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
@@ -37,7 +45,7 @@ var Menu = exports.Menu = function Menu(_ref) {
|
|
|
37
45
|
containerRef: selectProps.calendarContainerRef,
|
|
38
46
|
content: (0, _react.jsx)("div", (0, _extends2.default)({
|
|
39
47
|
css: menuStyles
|
|
40
|
-
}, innerProps), (0, _react.jsx)(_calendar.default, (0, _extends2.default)({},
|
|
48
|
+
}, innerProps), (0, _react.jsx)(_calendar.default, (0, _extends2.default)({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
|
|
41
49
|
disabled: selectProps.calendarDisabled,
|
|
42
50
|
disabledDateFilter: selectProps.calendarDisabledDateFilter,
|
|
43
51
|
minDate: selectProps.calendarMinDate,
|
|
@@ -5,17 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getSafeCalendarValue = getSafeCalendarValue;
|
|
7
7
|
exports.getShortISOString = getShortISOString;
|
|
8
|
-
exports.getValidDate = getValidDate;
|
|
9
8
|
var _dateFns = require("date-fns");
|
|
10
9
|
var _parseTokens = require("./parse-tokens");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} : {};
|
|
18
|
-
}
|
|
10
|
+
/**
|
|
11
|
+
* Converts a Date object into an ISO date, formatted `YYYY-MM-DD`.
|
|
12
|
+
*
|
|
13
|
+
* @param date The date to convert.
|
|
14
|
+
* @returns An ISO date (`YYYY-MM-DD`).
|
|
15
|
+
*/
|
|
19
16
|
function getShortISOString(date) {
|
|
20
17
|
return (0, _dateFns.format)(date, (0, _parseTokens.convertTokens)('YYYY-MM-DD'));
|
|
21
18
|
}
|
|
@@ -16,7 +16,7 @@ import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date'
|
|
|
16
16
|
import { convertTokens } from '../internal/parse-tokens';
|
|
17
17
|
import { makeSingleValue } from '../internal/single-value';
|
|
18
18
|
const packageName = "@atlaskit/datetime-picker";
|
|
19
|
-
const packageVersion = "13.0
|
|
19
|
+
const packageVersion = "13.2.0";
|
|
20
20
|
const datePickerDefaultProps = {
|
|
21
21
|
appearance: 'default',
|
|
22
22
|
autoFocus: false,
|
|
@@ -30,6 +30,7 @@ const datePickerDefaultProps = {
|
|
|
30
30
|
innerProps: {},
|
|
31
31
|
isDisabled: false,
|
|
32
32
|
isInvalid: false,
|
|
33
|
+
label: '',
|
|
33
34
|
name: '',
|
|
34
35
|
// These disables are here for proper typing when used as defaults. They
|
|
35
36
|
// should *not* use the `noop` function.
|
|
@@ -44,7 +45,6 @@ const datePickerDefaultProps = {
|
|
|
44
45
|
// Not including a default prop for value as it will
|
|
45
46
|
// Make the component a controlled component
|
|
46
47
|
};
|
|
47
|
-
|
|
48
48
|
class DatePicker extends Component {
|
|
49
49
|
constructor(props) {
|
|
50
50
|
super(props);
|
|
@@ -146,9 +146,9 @@ class DatePicker extends Component {
|
|
|
146
146
|
this.props.onFocus(event);
|
|
147
147
|
});
|
|
148
148
|
_defineProperty(this, "onTextInput", event => {
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
const parsed = this.parseDate(
|
|
149
|
+
const inputValue = event.target.value;
|
|
150
|
+
if (inputValue) {
|
|
151
|
+
const parsed = this.parseDate(inputValue);
|
|
152
152
|
// Only try to set the date if we have month & day
|
|
153
153
|
if (parsed && isValid(parsed)) {
|
|
154
154
|
// We format the parsed date to YYYY-MM-DD here because
|
|
@@ -355,6 +355,7 @@ class DatePicker extends Component {
|
|
|
355
355
|
maxDate,
|
|
356
356
|
minDate,
|
|
357
357
|
isInvalid,
|
|
358
|
+
label,
|
|
358
359
|
name,
|
|
359
360
|
nextMonthLabel,
|
|
360
361
|
previousMonthLabel,
|
|
@@ -430,6 +431,7 @@ class DatePicker extends Component {
|
|
|
430
431
|
value: value,
|
|
431
432
|
"data-testid": testId && `${testId}--input`
|
|
432
433
|
}), jsx(Select, _extends({
|
|
434
|
+
"aria-label": label || undefined,
|
|
433
435
|
appearance: this.props.appearance,
|
|
434
436
|
enableAnimation: false,
|
|
435
437
|
menuIsOpen: menuIsOpen,
|
|
@@ -455,7 +457,6 @@ class DatePicker extends Component {
|
|
|
455
457
|
paddingRight: "var(--ds-space-075, 6px)" // 8 - ICON_PADDING = 6
|
|
456
458
|
})
|
|
457
459
|
}),
|
|
458
|
-
|
|
459
460
|
placeholder: this.getPlaceholder(),
|
|
460
461
|
value: value && {
|
|
461
462
|
label: this.formatDate(value),
|
|
@@ -15,7 +15,7 @@ import { convertTokens } from '../internal/parse-tokens';
|
|
|
15
15
|
import DatePicker from './date-picker';
|
|
16
16
|
import TimePicker from './time-picker';
|
|
17
17
|
const packageName = "@atlaskit/datetime-picker";
|
|
18
|
-
const packageVersion = "13.0
|
|
18
|
+
const packageVersion = "13.2.0";
|
|
19
19
|
// Make DatePicker 50% the width of DateTimePicker
|
|
20
20
|
// If rendering an icon container, shrink the TimePicker
|
|
21
21
|
const datePickerContainerStyles = css({
|
|
@@ -85,7 +85,6 @@ const dateTimePickerDefaultProps = {
|
|
|
85
85
|
// Not including a default prop for value as it will
|
|
86
86
|
// Make the component a controlled component
|
|
87
87
|
};
|
|
88
|
-
|
|
89
88
|
export const datePickerDefaultAriaLabel = 'Date';
|
|
90
89
|
export const timePickerDefaultAriaLabel = 'Time';
|
|
91
90
|
class DateTimePicker extends React.Component {
|
|
@@ -225,12 +224,12 @@ class DateTimePicker extends React.Component {
|
|
|
225
224
|
} = timePickerSelectProps;
|
|
226
225
|
const mergedDatePickerSelectProps = {
|
|
227
226
|
...datePickerSelectProps,
|
|
228
|
-
'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
227
|
+
'aria-label': datePickerProps['label'] || datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
229
228
|
styles: mergeStyles(styles, datePickerStyles)
|
|
230
229
|
};
|
|
231
230
|
const mergedTimePickerSelectProps = {
|
|
232
231
|
...timePickerSelectProps,
|
|
233
|
-
'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
232
|
+
'aria-label': timePickerProps['label'] || timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
234
233
|
styles: mergeStyles(styles, timePickerStyles)
|
|
235
234
|
};
|
|
236
235
|
|
|
@@ -16,7 +16,7 @@ import parseTime from '../internal/parse-time';
|
|
|
16
16
|
import { convertTokens } from '../internal/parse-tokens';
|
|
17
17
|
import { makeSingleValue } from '../internal/single-value';
|
|
18
18
|
const packageName = "@atlaskit/datetime-picker";
|
|
19
|
-
const packageVersion = "13.0
|
|
19
|
+
const packageVersion = "13.2.0";
|
|
20
20
|
const menuStyles = {
|
|
21
21
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
22
22
|
position: 'static',
|
|
@@ -35,6 +35,7 @@ const timePickerDefaultProps = {
|
|
|
35
35
|
innerProps: {},
|
|
36
36
|
isDisabled: false,
|
|
37
37
|
isInvalid: false,
|
|
38
|
+
label: '',
|
|
38
39
|
name: '',
|
|
39
40
|
// These disables are here for proper typing when used as defaults. They
|
|
40
41
|
// should *not* use the `noop` function.
|
|
@@ -52,7 +53,6 @@ const timePickerDefaultProps = {
|
|
|
52
53
|
// Not including a default prop for value as it will
|
|
53
54
|
// Make the component a controlled component
|
|
54
55
|
};
|
|
55
|
-
|
|
56
56
|
class TimePicker extends React.Component {
|
|
57
57
|
constructor(...args) {
|
|
58
58
|
super(...args);
|
|
@@ -101,7 +101,6 @@ class TimePicker extends React.Component {
|
|
|
101
101
|
} catch (e) {
|
|
102
102
|
return; // do nothing, the main validation should happen in the form
|
|
103
103
|
}
|
|
104
|
-
|
|
105
104
|
const includesSeconds = !!(timeFormat && /[:.]?(s|ss)/.test(timeFormat));
|
|
106
105
|
const formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
107
106
|
const formattedValue = format(sanitizedInput, formatFormat) || '';
|
|
@@ -180,6 +179,7 @@ class TimePicker extends React.Component {
|
|
|
180
179
|
id,
|
|
181
180
|
innerProps,
|
|
182
181
|
isDisabled,
|
|
182
|
+
label,
|
|
183
183
|
locale,
|
|
184
184
|
name,
|
|
185
185
|
placeholder,
|
|
@@ -275,6 +275,7 @@ class TimePicker extends React.Component {
|
|
|
275
275
|
"data-testid": testId && `${testId}--input`,
|
|
276
276
|
onKeyDown: this.onSelectKeyDown
|
|
277
277
|
}), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
278
|
+
"aria-label": label || undefined,
|
|
278
279
|
appearance: appearance,
|
|
279
280
|
autoFocus: autoFocus,
|
|
280
281
|
components: selectComponents,
|
|
@@ -48,7 +48,7 @@ const isDisabledStyles = css({
|
|
|
48
48
|
const baseContainerStyles = css({
|
|
49
49
|
display: 'flex',
|
|
50
50
|
backgroundColor: `var(--ds-background-input, ${N20})`,
|
|
51
|
-
border:
|
|
51
|
+
border: `${"var(--ds-border-width, 1px)"} solid ${`var(--ds-border-input, ${N100})`}`,
|
|
52
52
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
53
53
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
54
54
|
'&:hover': {
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { isValid, parseISO } from 'date-fns';
|
|
4
5
|
import Calendar from '@atlaskit/calendar';
|
|
5
6
|
import { UNSAFE_LAYERING } from '@atlaskit/layering';
|
|
6
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
8
9
|
import { layers } from '@atlaskit/theme/constants';
|
|
9
10
|
import FixedLayer from '../internal/fixed-layer';
|
|
10
|
-
|
|
11
|
+
function getValidDate(iso) {
|
|
12
|
+
const date = parseISO(iso);
|
|
13
|
+
return isValid(date) ? {
|
|
14
|
+
day: date.getDate(),
|
|
15
|
+
month: date.getMonth() + 1,
|
|
16
|
+
year: date.getFullYear()
|
|
17
|
+
} : {};
|
|
18
|
+
}
|
|
11
19
|
const menuStyles = css({
|
|
12
20
|
zIndex: layers.dialog(),
|
|
13
21
|
backgroundColor: `var(--ds-surface-overlay, ${N0})`,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { format
|
|
1
|
+
import { format } from 'date-fns';
|
|
2
2
|
import { convertTokens } from './parse-tokens';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Converts a Date object into an ISO date, formatted `YYYY-MM-DD`.
|
|
6
|
+
*
|
|
7
|
+
* @param date The date to convert.
|
|
8
|
+
* @returns An ISO date (`YYYY-MM-DD`).
|
|
9
|
+
*/
|
|
11
10
|
export function getShortISOString(date) {
|
|
12
11
|
return format(date, convertTokens('YYYY-MM-DD'));
|
|
13
12
|
}
|
|
@@ -10,7 +10,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
-
function _isNativeReflectConstruct() {
|
|
13
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
import { Component } from 'react';
|
|
16
16
|
import { jsx } from '@emotion/react';
|
|
@@ -27,7 +27,7 @@ import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date'
|
|
|
27
27
|
import { convertTokens } from '../internal/parse-tokens';
|
|
28
28
|
import { makeSingleValue } from '../internal/single-value';
|
|
29
29
|
var packageName = "@atlaskit/datetime-picker";
|
|
30
|
-
var packageVersion = "13.0
|
|
30
|
+
var packageVersion = "13.2.0";
|
|
31
31
|
var datePickerDefaultProps = {
|
|
32
32
|
appearance: 'default',
|
|
33
33
|
autoFocus: false,
|
|
@@ -43,6 +43,7 @@ var datePickerDefaultProps = {
|
|
|
43
43
|
innerProps: {},
|
|
44
44
|
isDisabled: false,
|
|
45
45
|
isInvalid: false,
|
|
46
|
+
label: '',
|
|
46
47
|
name: '',
|
|
47
48
|
// These disables are here for proper typing when used as defaults. They
|
|
48
49
|
// should *not* use the `noop` function.
|
|
@@ -159,9 +160,9 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
159
160
|
_this.props.onFocus(event);
|
|
160
161
|
});
|
|
161
162
|
_defineProperty(_assertThisInitialized(_this), "onTextInput", function (event) {
|
|
162
|
-
var
|
|
163
|
-
if (
|
|
164
|
-
var parsed = _this.parseDate(
|
|
163
|
+
var inputValue = event.target.value;
|
|
164
|
+
if (inputValue) {
|
|
165
|
+
var parsed = _this.parseDate(inputValue);
|
|
165
166
|
// Only try to set the date if we have month & day
|
|
166
167
|
if (parsed && isValid(parsed)) {
|
|
167
168
|
// We format the parsed date to YYYY-MM-DD here because
|
|
@@ -350,6 +351,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
350
351
|
maxDate = _this$props3.maxDate,
|
|
351
352
|
minDate = _this$props3.minDate,
|
|
352
353
|
isInvalid = _this$props3.isInvalid,
|
|
354
|
+
label = _this$props3.label,
|
|
353
355
|
name = _this$props3.name,
|
|
354
356
|
nextMonthLabel = _this$props3.nextMonthLabel,
|
|
355
357
|
previousMonthLabel = _this$props3.previousMonthLabel,
|
|
@@ -421,6 +423,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
421
423
|
value: value,
|
|
422
424
|
"data-testid": testId && "".concat(testId, "--input")
|
|
423
425
|
}), jsx(Select, _extends({
|
|
426
|
+
"aria-label": label || undefined,
|
|
424
427
|
appearance: this.props.appearance,
|
|
425
428
|
enableAnimation: false,
|
|
426
429
|
menuIsOpen: menuIsOpen,
|
|
@@ -446,7 +449,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
446
449
|
});
|
|
447
450
|
}
|
|
448
451
|
}),
|
|
449
|
-
|
|
450
452
|
placeholder: this.getPlaceholder(),
|
|
451
453
|
value: value && {
|
|
452
454
|
label: this.formatDate(value),
|
|
@@ -7,7 +7,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
function _isNativeReflectConstruct() {
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
/** @jsx jsx */
|
|
@@ -25,7 +25,7 @@ import { convertTokens } from '../internal/parse-tokens';
|
|
|
25
25
|
import DatePicker from './date-picker';
|
|
26
26
|
import TimePicker from './time-picker';
|
|
27
27
|
var packageName = "@atlaskit/datetime-picker";
|
|
28
|
-
var packageVersion = "13.0
|
|
28
|
+
var packageVersion = "13.2.0";
|
|
29
29
|
// Make DatePicker 50% the width of DateTimePicker
|
|
30
30
|
// If rendering an icon container, shrink the TimePicker
|
|
31
31
|
var datePickerContainerStyles = css({
|
|
@@ -96,7 +96,6 @@ var dateTimePickerDefaultProps = {
|
|
|
96
96
|
// Not including a default prop for value as it will
|
|
97
97
|
// Make the component a controlled component
|
|
98
98
|
};
|
|
99
|
-
|
|
100
99
|
export var datePickerDefaultAriaLabel = 'Date';
|
|
101
100
|
export var timePickerDefaultAriaLabel = 'Time';
|
|
102
101
|
var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
@@ -234,11 +233,11 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
234
233
|
var _timePickerSelectProp = timePickerSelectProps.styles,
|
|
235
234
|
timePickerStyles = _timePickerSelectProp === void 0 ? {} : _timePickerSelectProp;
|
|
236
235
|
var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
|
|
237
|
-
'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
236
|
+
'aria-label': datePickerProps['label'] || datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
|
|
238
237
|
styles: mergeStyles(styles, datePickerStyles)
|
|
239
238
|
});
|
|
240
239
|
var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
|
|
241
|
-
'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
240
|
+
'aria-label': timePickerProps['label'] || timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
|
|
242
241
|
styles: mergeStyles(styles, timePickerStyles)
|
|
243
242
|
});
|
|
244
243
|
|
|
@@ -11,7 +11,7 @@ var _excluded = ["styles"];
|
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
function _isNativeReflectConstruct() {
|
|
14
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
15
|
import React from 'react';
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line no-restricted-imports
|
|
@@ -28,7 +28,7 @@ import parseTime from '../internal/parse-time';
|
|
|
28
28
|
import { convertTokens } from '../internal/parse-tokens';
|
|
29
29
|
import { makeSingleValue } from '../internal/single-value';
|
|
30
30
|
var packageName = "@atlaskit/datetime-picker";
|
|
31
|
-
var packageVersion = "13.0
|
|
31
|
+
var packageVersion = "13.2.0";
|
|
32
32
|
var menuStyles = {
|
|
33
33
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
34
34
|
position: 'static',
|
|
@@ -47,6 +47,7 @@ var timePickerDefaultProps = {
|
|
|
47
47
|
innerProps: {},
|
|
48
48
|
isDisabled: false,
|
|
49
49
|
isInvalid: false,
|
|
50
|
+
label: '',
|
|
50
51
|
name: '',
|
|
51
52
|
// These disables are here for proper typing when used as defaults. They
|
|
52
53
|
// should *not* use the `noop` function.
|
|
@@ -116,7 +117,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
116
117
|
} catch (e) {
|
|
117
118
|
return; // do nothing, the main validation should happen in the form
|
|
118
119
|
}
|
|
119
|
-
|
|
120
120
|
var includesSeconds = !!(timeFormat && /[:.]?(s|ss)/.test(timeFormat));
|
|
121
121
|
var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
122
122
|
var formattedValue = format(sanitizedInput, formatFormat) || '';
|
|
@@ -197,6 +197,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
197
197
|
id = _this$props2.id,
|
|
198
198
|
innerProps = _this$props2.innerProps,
|
|
199
199
|
isDisabled = _this$props2.isDisabled,
|
|
200
|
+
label = _this$props2.label,
|
|
200
201
|
locale = _this$props2.locale,
|
|
201
202
|
name = _this$props2.name,
|
|
202
203
|
placeholder = _this$props2.placeholder,
|
|
@@ -290,6 +291,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
290
291
|
"data-testid": testId && "".concat(testId, "--input"),
|
|
291
292
|
onKeyDown: this.onSelectKeyDown
|
|
292
293
|
}), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
294
|
+
"aria-label": label || undefined,
|
|
293
295
|
appearance: appearance,
|
|
294
296
|
autoFocus: autoFocus,
|
|
295
297
|
components: selectComponents,
|
|
@@ -48,7 +48,7 @@ var isDisabledStyles = css({
|
|
|
48
48
|
var baseContainerStyles = css({
|
|
49
49
|
display: 'flex',
|
|
50
50
|
backgroundColor: "var(--ds-background-input, ".concat(N20, ")"),
|
|
51
|
-
border:
|
|
51
|
+
border: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border-input, ".concat(N100, ")")),
|
|
52
52
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
53
53
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
54
54
|
'&:hover': {
|
|
@@ -8,7 +8,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
function _isNativeReflectConstruct() {
|
|
11
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import ScrollLock from 'react-scrolllock';
|
|
14
14
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
+
import { isValid, parseISO } from 'date-fns';
|
|
4
5
|
import Calendar from '@atlaskit/calendar';
|
|
5
6
|
import { UNSAFE_LAYERING } from '@atlaskit/layering';
|
|
6
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
8
9
|
import { layers } from '@atlaskit/theme/constants';
|
|
9
10
|
import FixedLayer from '../internal/fixed-layer';
|
|
10
|
-
|
|
11
|
+
function getValidDate(iso) {
|
|
12
|
+
var date = parseISO(iso);
|
|
13
|
+
return isValid(date) ? {
|
|
14
|
+
day: date.getDate(),
|
|
15
|
+
month: date.getMonth() + 1,
|
|
16
|
+
year: date.getFullYear()
|
|
17
|
+
} : {};
|
|
18
|
+
}
|
|
11
19
|
var menuStyles = css({
|
|
12
20
|
zIndex: layers.dialog(),
|
|
13
21
|
backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { format
|
|
1
|
+
import { format } from 'date-fns';
|
|
2
2
|
import { convertTokens } from './parse-tokens';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Converts a Date object into an ISO date, formatted `YYYY-MM-DD`.
|
|
6
|
+
*
|
|
7
|
+
* @param date The date to convert.
|
|
8
|
+
* @returns An ISO date (`YYYY-MM-DD`).
|
|
9
|
+
*/
|
|
11
10
|
export function getShortISOString(date) {
|
|
12
11
|
return format(date, convertTokens('YYYY-MM-DD'));
|
|
13
12
|
}
|
|
@@ -34,6 +34,7 @@ declare const datePickerDefaultProps: {
|
|
|
34
34
|
innerProps: {};
|
|
35
35
|
isDisabled: boolean;
|
|
36
36
|
isInvalid: boolean;
|
|
37
|
+
label: string;
|
|
37
38
|
name: string;
|
|
38
39
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
39
40
|
onChange: (_value: string) => void;
|
|
@@ -56,6 +57,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
56
57
|
innerProps: {};
|
|
57
58
|
isDisabled: boolean;
|
|
58
59
|
isInvalid: boolean;
|
|
60
|
+
label: string;
|
|
59
61
|
name: string;
|
|
60
62
|
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
61
63
|
onChange: (_value: string) => void;
|
|
@@ -119,7 +121,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
119
121
|
render(): jsx.JSX.Element;
|
|
120
122
|
}
|
|
121
123
|
export { DatePicker as DatePickerWithoutAnalytics };
|
|
122
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "placeholder" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "dateFormat"> & Partial<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "autoFocus" | "defaultIsOpen" | "name" | "spacing" | "isInvalid" | "hideIcon">> & Partial<Pick<{
|
|
124
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "placeholder" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "dateFormat"> & Partial<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "label" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "autoFocus" | "defaultIsOpen" | "name" | "spacing" | "isInvalid" | "hideIcon">> & Partial<Pick<{
|
|
123
125
|
appearance: Appearance;
|
|
124
126
|
autoFocus: boolean;
|
|
125
127
|
defaultIsOpen: boolean;
|
|
@@ -132,6 +134,7 @@ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit
|
|
|
132
134
|
innerProps: {};
|
|
133
135
|
isDisabled: boolean;
|
|
134
136
|
isInvalid: boolean;
|
|
137
|
+
label: string;
|
|
135
138
|
name: string;
|
|
136
139
|
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
137
140
|
onChange: (_value: string) => void;
|
|
@@ -139,5 +142,5 @@ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit
|
|
|
139
142
|
selectProps: {};
|
|
140
143
|
spacing: Spacing;
|
|
141
144
|
locale: string;
|
|
142
|
-
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "dateFormat"> & import("react").RefAttributes<any>>;
|
|
145
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "label" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "dateFormat"> & import("react").RefAttributes<any>>;
|
|
143
146
|
export default _default;
|
|
@@ -23,6 +23,7 @@ declare const timePickerDefaultProps: {
|
|
|
23
23
|
innerProps: {};
|
|
24
24
|
isDisabled: boolean;
|
|
25
25
|
isInvalid: boolean;
|
|
26
|
+
label: string;
|
|
26
27
|
name: string;
|
|
27
28
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
28
29
|
onChange: (_value: string) => void;
|
|
@@ -46,6 +47,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
|
|
|
46
47
|
innerProps: {};
|
|
47
48
|
isDisabled: boolean;
|
|
48
49
|
isInvalid: boolean;
|
|
50
|
+
label: string;
|
|
49
51
|
name: string;
|
|
50
52
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
51
53
|
onChange: (_value: string) => void;
|
|
@@ -78,7 +80,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
|
|
|
78
80
|
render(): JSX.Element;
|
|
79
81
|
}
|
|
80
82
|
export { TimePicker as TimePickerWithoutAnalytics };
|
|
81
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "placeholder" | "value" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "locale" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "timeIsEditable">> & Partial<Pick<{
|
|
83
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "placeholder" | "value" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "label" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "locale" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "timeIsEditable">> & Partial<Pick<{
|
|
82
84
|
appearance: Appearance;
|
|
83
85
|
autoFocus: boolean;
|
|
84
86
|
defaultIsOpen: boolean;
|
|
@@ -88,6 +90,7 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePicke
|
|
|
88
90
|
innerProps: {};
|
|
89
91
|
isDisabled: boolean;
|
|
90
92
|
isInvalid: boolean;
|
|
93
|
+
label: string;
|
|
91
94
|
name: string;
|
|
92
95
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
93
96
|
onChange: (_value: string) => void;
|
|
@@ -98,5 +101,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePicke
|
|
|
98
101
|
times: string[];
|
|
99
102
|
timeIsEditable: boolean;
|
|
100
103
|
locale: string;
|
|
101
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "locale" | "analyticsContext" | "value" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
|
|
104
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "label" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "locale" | "analyticsContext" | "value" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
|
|
102
105
|
export default _default;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
month?: undefined;
|
|
8
|
-
year?: undefined;
|
|
9
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Converts a Date object into an ISO date, formatted `YYYY-MM-DD`.
|
|
3
|
+
*
|
|
4
|
+
* @param date The date to convert.
|
|
5
|
+
* @returns An ISO date (`YYYY-MM-DD`).
|
|
6
|
+
*/
|
|
10
7
|
export declare function getShortISOString(date: Date): string;
|
|
11
8
|
export declare function getSafeCalendarValue(calendarValue: string): string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
9
9
|
*
|
|
10
10
|
* `subtle` will remove the borders, background, and icon.
|
|
11
11
|
*
|
|
12
|
-
*NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
12
|
+
* **NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
13
13
|
*/
|
|
14
14
|
appearance?: Appearance;
|
|
15
15
|
/**
|
|
@@ -34,6 +34,10 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
34
34
|
* The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
|
|
35
35
|
*/
|
|
36
36
|
disabledDateFilter?: (date: string) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Accessible name for the Date Picker Select, rendered as `aria-label`. This will override any other method of providing a label.
|
|
39
|
+
*/
|
|
40
|
+
label?: string;
|
|
37
41
|
/**
|
|
38
42
|
* The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
39
43
|
*/
|
|
@@ -89,7 +93,7 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
89
93
|
*/
|
|
90
94
|
parseInputValue?: (date: string, dateFormat: string) => Date;
|
|
91
95
|
/**
|
|
92
|
-
* A function for formatting the date displayed in the input. By default composes together [date-
|
|
96
|
+
* A function for formatting the date displayed in the input. By default composes together [`date-fns`'s parse method](https://date-fns.org/v1.29.0/docs/parse) and [`date-fns`'s format method](https://date-fns.org/v1.29.0/docs/format) to return a correctly formatted date string.
|
|
93
97
|
*/
|
|
94
98
|
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
95
99
|
/**
|
|
@@ -190,6 +194,10 @@ export interface TimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
190
194
|
* Set if the dropdown is open. Will be `false` if not provided.
|
|
191
195
|
*/
|
|
192
196
|
isOpen?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Accessible name for the Time Picker Select, rendered as `aria-label`. This will override any other method of providing a label.
|
|
199
|
+
*/
|
|
200
|
+
label?: string;
|
|
193
201
|
/**
|
|
194
202
|
* The name of the field.
|
|
195
203
|
*/
|
|
@@ -34,6 +34,7 @@ declare const datePickerDefaultProps: {
|
|
|
34
34
|
innerProps: {};
|
|
35
35
|
isDisabled: boolean;
|
|
36
36
|
isInvalid: boolean;
|
|
37
|
+
label: string;
|
|
37
38
|
name: string;
|
|
38
39
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
39
40
|
onChange: (_value: string) => void;
|
|
@@ -56,6 +57,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
56
57
|
innerProps: {};
|
|
57
58
|
isDisabled: boolean;
|
|
58
59
|
isInvalid: boolean;
|
|
60
|
+
label: string;
|
|
59
61
|
name: string;
|
|
60
62
|
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
61
63
|
onChange: (_value: string) => void;
|
|
@@ -119,7 +121,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
119
121
|
render(): jsx.JSX.Element;
|
|
120
122
|
}
|
|
121
123
|
export { DatePicker as DatePickerWithoutAnalytics };
|
|
122
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "placeholder" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "dateFormat"> & Partial<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "autoFocus" | "defaultIsOpen" | "name" | "spacing" | "isInvalid" | "hideIcon">> & Partial<Pick<{
|
|
124
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "placeholder" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "isOpen" | "parseInputValue" | "formatDisplayLabel" | "dateFormat"> & Partial<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "label" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "autoFocus" | "defaultIsOpen" | "name" | "spacing" | "isInvalid" | "hideIcon">> & Partial<Pick<{
|
|
123
125
|
appearance: Appearance;
|
|
124
126
|
autoFocus: boolean;
|
|
125
127
|
defaultIsOpen: boolean;
|
|
@@ -132,6 +134,7 @@ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit
|
|
|
132
134
|
innerProps: {};
|
|
133
135
|
isDisabled: boolean;
|
|
134
136
|
isInvalid: boolean;
|
|
137
|
+
label: string;
|
|
135
138
|
name: string;
|
|
136
139
|
onBlur: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
137
140
|
onChange: (_value: string) => void;
|
|
@@ -139,5 +142,5 @@ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit
|
|
|
139
142
|
selectProps: {};
|
|
140
143
|
spacing: Spacing;
|
|
141
144
|
locale: string;
|
|
142
|
-
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "dateFormat"> & import("react").RefAttributes<any>>;
|
|
145
|
+
}, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "label" | "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "dateFormat"> & import("react").RefAttributes<any>>;
|
|
143
146
|
export default _default;
|
|
@@ -23,6 +23,7 @@ declare const timePickerDefaultProps: {
|
|
|
23
23
|
innerProps: {};
|
|
24
24
|
isDisabled: boolean;
|
|
25
25
|
isInvalid: boolean;
|
|
26
|
+
label: string;
|
|
26
27
|
name: string;
|
|
27
28
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
28
29
|
onChange: (_value: string) => void;
|
|
@@ -46,6 +47,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
|
|
|
46
47
|
innerProps: {};
|
|
47
48
|
isDisabled: boolean;
|
|
48
49
|
isInvalid: boolean;
|
|
50
|
+
label: string;
|
|
49
51
|
name: string;
|
|
50
52
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
51
53
|
onChange: (_value: string) => void;
|
|
@@ -78,7 +80,7 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
|
|
|
78
80
|
render(): JSX.Element;
|
|
79
81
|
}
|
|
80
82
|
export { TimePicker as TimePickerWithoutAnalytics };
|
|
81
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "placeholder" | "value" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "locale" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "timeIsEditable">> & Partial<Pick<{
|
|
83
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "testId" | "placeholder" | "value" | "isOpen" | "formatDisplayLabel" | "timeFormat"> & Partial<Pick<Omit<TimePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "times" | "label" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "onFocus" | "onBlur" | "onChange" | "locale" | "autoFocus" | "defaultIsOpen" | "name" | "parseInputValue" | "spacing" | "isInvalid" | "hideIcon" | "timeIsEditable">> & Partial<Pick<{
|
|
82
84
|
appearance: Appearance;
|
|
83
85
|
autoFocus: boolean;
|
|
84
86
|
defaultIsOpen: boolean;
|
|
@@ -88,6 +90,7 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePicke
|
|
|
88
90
|
innerProps: {};
|
|
89
91
|
isDisabled: boolean;
|
|
90
92
|
isInvalid: boolean;
|
|
93
|
+
label: string;
|
|
91
94
|
name: string;
|
|
92
95
|
onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
|
|
93
96
|
onChange: (_value: string) => void;
|
|
@@ -98,5 +101,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<TimePicke
|
|
|
98
101
|
times: string[];
|
|
99
102
|
timeIsEditable: boolean;
|
|
100
103
|
locale: string;
|
|
101
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "locale" | "analyticsContext" | "value" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
|
|
104
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "label" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "locale" | "analyticsContext" | "value" | "autoFocus" | "defaultIsOpen" | "isOpen" | "name" | "parseInputValue" | "formatDisplayLabel" | "spacing" | "isInvalid" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<any>>;
|
|
102
105
|
export default _default;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
month?: undefined;
|
|
8
|
-
year?: undefined;
|
|
9
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Converts a Date object into an ISO date, formatted `YYYY-MM-DD`.
|
|
3
|
+
*
|
|
4
|
+
* @param date The date to convert.
|
|
5
|
+
* @returns An ISO date (`YYYY-MM-DD`).
|
|
6
|
+
*/
|
|
10
7
|
export declare function getShortISOString(date: Date): string;
|
|
11
8
|
export declare function getSafeCalendarValue(calendarValue: string): string;
|
|
@@ -9,7 +9,7 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
9
9
|
*
|
|
10
10
|
* `subtle` will remove the borders, background, and icon.
|
|
11
11
|
*
|
|
12
|
-
*NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
12
|
+
* **NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
13
13
|
*/
|
|
14
14
|
appearance?: Appearance;
|
|
15
15
|
/**
|
|
@@ -34,6 +34,10 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
34
34
|
* The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
|
|
35
35
|
*/
|
|
36
36
|
disabledDateFilter?: (date: string) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Accessible name for the Date Picker Select, rendered as `aria-label`. This will override any other method of providing a label.
|
|
39
|
+
*/
|
|
40
|
+
label?: string;
|
|
37
41
|
/**
|
|
38
42
|
* The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
39
43
|
*/
|
|
@@ -89,7 +93,7 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
89
93
|
*/
|
|
90
94
|
parseInputValue?: (date: string, dateFormat: string) => Date;
|
|
91
95
|
/**
|
|
92
|
-
* A function for formatting the date displayed in the input. By default composes together [date-
|
|
96
|
+
* A function for formatting the date displayed in the input. By default composes together [`date-fns`'s parse method](https://date-fns.org/v1.29.0/docs/parse) and [`date-fns`'s format method](https://date-fns.org/v1.29.0/docs/format) to return a correctly formatted date string.
|
|
93
97
|
*/
|
|
94
98
|
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
95
99
|
/**
|
|
@@ -190,6 +194,10 @@ export interface TimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
|
190
194
|
* Set if the dropdown is open. Will be `false` if not provided.
|
|
191
195
|
*/
|
|
192
196
|
isOpen?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Accessible name for the Time Picker Select, rendered as `aria-label`. This will override any other method of providing a label.
|
|
199
|
+
*/
|
|
200
|
+
label?: string;
|
|
193
201
|
/**
|
|
194
202
|
* The name of the field.
|
|
195
203
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "13.0
|
|
3
|
+
"version": "13.2.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/"
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@atlaskit/locale": "^2.6.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
48
48
|
"@atlaskit/popper": "^5.5.0",
|
|
49
|
-
"@atlaskit/select": "^17.
|
|
49
|
+
"@atlaskit/select": "^17.3.0",
|
|
50
50
|
"@atlaskit/theme": "^12.6.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.41.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1",
|
|
54
54
|
"date-fns": "^2.17.0",
|
|
@@ -61,15 +61,16 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@af/accessibility-testing": "*",
|
|
63
63
|
"@af/integration-testing": "*",
|
|
64
|
-
"@
|
|
64
|
+
"@af/visual-regression": "*",
|
|
65
|
+
"@atlaskit/button": "^17.7.0",
|
|
65
66
|
"@atlaskit/docs": "*",
|
|
66
67
|
"@atlaskit/form": "^9.0.3",
|
|
67
68
|
"@atlaskit/modal-dialog": "^12.10.0",
|
|
68
|
-
"@atlaskit/popup": "^1.
|
|
69
|
+
"@atlaskit/popup": "^1.13.0",
|
|
69
70
|
"@atlaskit/range": "^7.1.0",
|
|
70
71
|
"@atlaskit/section-message": "^6.4.0",
|
|
71
72
|
"@atlaskit/ssr": "*",
|
|
72
|
-
"@atlaskit/textfield": "^6.
|
|
73
|
+
"@atlaskit/textfield": "^6.1.0",
|
|
73
74
|
"@atlaskit/toggle": "^13.0.0",
|
|
74
75
|
"@atlaskit/visual-regression": "*",
|
|
75
76
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
@@ -109,9 +110,6 @@
|
|
|
109
110
|
"platform.design-system-team.border-checkbox_nyoiu": {
|
|
110
111
|
"type": "boolean"
|
|
111
112
|
},
|
|
112
|
-
"platform.design-system-team.update-input-border-wdith_5abwv": {
|
|
113
|
-
"type": "boolean"
|
|
114
|
-
},
|
|
115
113
|
"platform.design-system-team.date-picker-input-a11y-fix_cbbxs": {
|
|
116
114
|
"type": "boolean"
|
|
117
115
|
}
|