@atlaskit/datetime-picker 14.1.1 → 15.0.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 +15 -0
- package/dist/cjs/components/date-picker.js +1 -1
- package/dist/cjs/components/date-time-picker.js +1 -1
- package/dist/cjs/components/time-picker.js +23 -12
- package/dist/es2019/components/date-picker.js +1 -1
- package/dist/es2019/components/date-time-picker.js +1 -1
- package/dist/es2019/components/time-picker.js +22 -13
- package/dist/esm/components/date-picker.js +1 -1
- package/dist/esm/components/date-time-picker.js +1 -1
- package/dist/esm/components/time-picker.js +23 -14
- package/dist/types/components/time-picker.d.ts +1 -1
- package/dist/types/types.d.ts +0 -4
- package/dist/types-ts4.5/components/time-picker.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +0 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 15.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#145306](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/145306)
|
|
8
|
+
[`3b17d85b64fcd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3b17d85b64fcd) -
|
|
9
|
+
Remove unused analyticsContext prop and add unit tests for analytics.
|
|
10
|
+
|
|
11
|
+
## 14.1.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`728a2eb75d298`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/728a2eb75d298) -
|
|
16
|
+
Fix bug in handling controlled values.
|
|
17
|
+
|
|
3
18
|
## 14.1.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -36,7 +36,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
36
36
|
* @jsx jsx
|
|
37
37
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
38
38
|
var packageName = "@atlaskit/datetime-picker";
|
|
39
|
-
var packageVersion = "
|
|
39
|
+
var packageVersion = "15.0.0";
|
|
40
40
|
var datePickerDefaultProps = {
|
|
41
41
|
appearance: 'default',
|
|
42
42
|
autoFocus: false,
|
|
@@ -32,7 +32,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
32
32
|
* @jsx jsx
|
|
33
33
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
34
34
|
var packageName = "@atlaskit/datetime-picker";
|
|
35
|
-
var packageVersion = "
|
|
35
|
+
var packageVersion = "15.0.0";
|
|
36
36
|
// Make DatePicker 50% the width of DateTimePicker
|
|
37
37
|
// If rendering an icon container, shrink the TimePicker
|
|
38
38
|
var datePickerContainerStyles = (0, _react2.css)({
|
|
@@ -25,9 +25,9 @@ var _excluded = ["styles"];
|
|
|
25
25
|
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); }
|
|
26
26
|
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 && {}.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; }
|
|
27
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
-
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; }
|
|
28
|
+
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; }
|
|
29
29
|
var packageName = "@atlaskit/datetime-picker";
|
|
30
|
-
var packageVersion = "
|
|
30
|
+
var packageVersion = "15.0.0";
|
|
31
31
|
var menuStyles = {
|
|
32
32
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
33
33
|
position: 'static',
|
|
@@ -53,7 +53,6 @@ var analyticsAttributes = {
|
|
|
53
53
|
*/
|
|
54
54
|
var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
55
55
|
var ariaDescribedBy = _ref['aria-describedby'],
|
|
56
|
-
analyticsContext = _ref.analyticsContext,
|
|
57
56
|
_ref$appearance = _ref.appearance,
|
|
58
57
|
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
59
58
|
_ref$autoFocus = _ref.autoFocus,
|
|
@@ -120,11 +119,11 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
120
119
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
121
120
|
_ = _useState6[0],
|
|
122
121
|
setIsFocused = _useState6[1];
|
|
123
|
-
var _useState7 = (0, _react.useState)(
|
|
122
|
+
var _useState7 = (0, _react.useState)(defaultIsOpen),
|
|
124
123
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
125
124
|
isOpen = _useState8[0],
|
|
126
125
|
setIsOpen = _useState8[1];
|
|
127
|
-
var _useState9 = (0, _react.useState)(
|
|
126
|
+
var _useState9 = (0, _react.useState)(defaultValue),
|
|
128
127
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
129
128
|
value = _useState10[0],
|
|
130
129
|
setValue = _useState10[1];
|
|
@@ -137,10 +136,19 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
137
136
|
forceUpdate = _useReducer2[1];
|
|
138
137
|
var providedOnChangeWithAnalytics = (0, _analyticsNext.usePlatformLeafEventHandler)(_objectSpread({
|
|
139
138
|
fn: providedOnChange,
|
|
140
|
-
action: 'selectedTime'
|
|
141
|
-
analyticsData: analyticsContext
|
|
139
|
+
action: 'selectedTime'
|
|
142
140
|
}, analyticsAttributes));
|
|
143
|
-
|
|
141
|
+
(0, _react.useEffect)(function () {
|
|
142
|
+
if (providedValue) {
|
|
143
|
+
setValue(providedValue);
|
|
144
|
+
}
|
|
145
|
+
}, [providedValue]);
|
|
146
|
+
(0, _react.useEffect)(function () {
|
|
147
|
+
if (providedIsOpen) {
|
|
148
|
+
setIsOpen(providedIsOpen);
|
|
149
|
+
}
|
|
150
|
+
}, [providedIsOpen]);
|
|
151
|
+
var onChange = (0, _react.useCallback)(function (newValue, action) {
|
|
144
152
|
var rawValue = newValue ? newValue.value || newValue : '';
|
|
145
153
|
var finalValue = rawValue.toString();
|
|
146
154
|
setValue(finalValue);
|
|
@@ -148,7 +156,7 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
148
156
|
setClearingFromIcon(true);
|
|
149
157
|
}
|
|
150
158
|
providedOnChangeWithAnalytics(finalValue);
|
|
151
|
-
};
|
|
159
|
+
}, [providedOnChangeWithAnalytics]);
|
|
152
160
|
|
|
153
161
|
/**
|
|
154
162
|
* Only allow custom times if timeIsEditable prop is true
|
|
@@ -165,9 +173,9 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
165
173
|
var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
166
174
|
var formattedValue = (0, _dateFns.format)(sanitizedInput, formatFormat) || '';
|
|
167
175
|
setValue(formattedValue);
|
|
168
|
-
|
|
176
|
+
providedOnChangeWithAnalytics(formattedValue);
|
|
169
177
|
} else {
|
|
170
|
-
|
|
178
|
+
providedOnChangeWithAnalytics(inputValue);
|
|
171
179
|
}
|
|
172
180
|
};
|
|
173
181
|
var onMenuOpen = function onMenuOpen() {
|
|
@@ -322,7 +330,10 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
322
330
|
placeholder: placeholder || l10n.formatTime(_internal.placeholderDatetime),
|
|
323
331
|
styles: mergedStyles,
|
|
324
332
|
value: initialValue,
|
|
325
|
-
spacing: spacing
|
|
333
|
+
spacing: spacing
|
|
334
|
+
// We need this to get things to work, even though it's not supported.
|
|
335
|
+
// @ts-ignore
|
|
336
|
+
,
|
|
326
337
|
fixedLayerRef: containerRef,
|
|
327
338
|
isInvalid: isInvalid,
|
|
328
339
|
testId: testId
|
|
@@ -19,7 +19,7 @@ import { Menu } from '../internal/menu';
|
|
|
19
19
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
20
20
|
import { makeSingleValue } from '../internal/single-value';
|
|
21
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
22
|
-
const packageVersion = "
|
|
22
|
+
const packageVersion = "15.0.0";
|
|
23
23
|
const datePickerDefaultProps = {
|
|
24
24
|
appearance: 'default',
|
|
25
25
|
autoFocus: false,
|
|
@@ -18,7 +18,7 @@ import { convertTokens } from '../internal/parse-tokens';
|
|
|
18
18
|
import DatePicker from './date-picker';
|
|
19
19
|
import TimePicker from './time-picker';
|
|
20
20
|
const packageName = "@atlaskit/datetime-picker";
|
|
21
|
-
const packageVersion = "
|
|
21
|
+
const packageVersion = "15.0.0";
|
|
22
22
|
// Make DatePicker 50% the width of DateTimePicker
|
|
23
23
|
// If rendering an icon container, shrink the TimePicker
|
|
24
24
|
const datePickerContainerStyles = css({
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { forwardRef, useReducer, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line no-restricted-imports
|
|
2
|
+
import React, { forwardRef, useCallback, useEffect, useReducer, useState } from 'react';
|
|
5
3
|
import { format, isValid } from 'date-fns';
|
|
6
4
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
7
5
|
import __noop from '@atlaskit/ds-lib/noop';
|
|
@@ -13,7 +11,7 @@ import parseTime from '../internal/parse-time';
|
|
|
13
11
|
import { convertTokens } from '../internal/parse-tokens';
|
|
14
12
|
import { makeSingleValue } from '../internal/single-value';
|
|
15
13
|
const packageName = "@atlaskit/datetime-picker";
|
|
16
|
-
const packageVersion = "
|
|
14
|
+
const packageVersion = "15.0.0";
|
|
17
15
|
const menuStyles = {
|
|
18
16
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
19
17
|
position: 'static',
|
|
@@ -39,7 +37,6 @@ const analyticsAttributes = {
|
|
|
39
37
|
*/
|
|
40
38
|
const TimePicker = /*#__PURE__*/forwardRef(({
|
|
41
39
|
'aria-describedby': ariaDescribedBy,
|
|
42
|
-
analyticsContext,
|
|
43
40
|
appearance = 'default',
|
|
44
41
|
autoFocus = false,
|
|
45
42
|
defaultIsOpen = false,
|
|
@@ -76,18 +73,27 @@ const TimePicker = /*#__PURE__*/forwardRef(({
|
|
|
76
73
|
const [clearingFromIcon, setClearingFromIcon] = useState(false);
|
|
77
74
|
// TODO: Remove isFocused? Does it do anything?
|
|
78
75
|
const [_, setIsFocused] = useState(false);
|
|
79
|
-
const [isOpen, setIsOpen] = useState(
|
|
80
|
-
const [value, setValue] = useState(
|
|
76
|
+
const [isOpen, setIsOpen] = useState(defaultIsOpen);
|
|
77
|
+
const [value, setValue] = useState(defaultValue);
|
|
81
78
|
|
|
82
79
|
// Hack to force update: https://legacy.reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
|
|
83
80
|
const [, forceUpdate] = useReducer(x => x + 1, 0);
|
|
84
81
|
const providedOnChangeWithAnalytics = usePlatformLeafEventHandler({
|
|
85
82
|
fn: providedOnChange,
|
|
86
83
|
action: 'selectedTime',
|
|
87
|
-
analyticsData: analyticsContext,
|
|
88
84
|
...analyticsAttributes
|
|
89
85
|
});
|
|
90
|
-
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (providedValue) {
|
|
88
|
+
setValue(providedValue);
|
|
89
|
+
}
|
|
90
|
+
}, [providedValue]);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (providedIsOpen) {
|
|
93
|
+
setIsOpen(providedIsOpen);
|
|
94
|
+
}
|
|
95
|
+
}, [providedIsOpen]);
|
|
96
|
+
const onChange = useCallback((newValue, action) => {
|
|
91
97
|
const rawValue = newValue ? newValue.value || newValue : '';
|
|
92
98
|
const finalValue = rawValue.toString();
|
|
93
99
|
setValue(finalValue);
|
|
@@ -95,7 +101,7 @@ const TimePicker = /*#__PURE__*/forwardRef(({
|
|
|
95
101
|
setClearingFromIcon(true);
|
|
96
102
|
}
|
|
97
103
|
providedOnChangeWithAnalytics(finalValue);
|
|
98
|
-
};
|
|
104
|
+
}, [providedOnChangeWithAnalytics]);
|
|
99
105
|
|
|
100
106
|
/**
|
|
101
107
|
* Only allow custom times if timeIsEditable prop is true
|
|
@@ -112,9 +118,9 @@ const TimePicker = /*#__PURE__*/forwardRef(({
|
|
|
112
118
|
const formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
113
119
|
const formattedValue = format(sanitizedInput, formatFormat) || '';
|
|
114
120
|
setValue(formattedValue);
|
|
115
|
-
|
|
121
|
+
providedOnChangeWithAnalytics(formattedValue);
|
|
116
122
|
} else {
|
|
117
|
-
|
|
123
|
+
providedOnChangeWithAnalytics(inputValue);
|
|
118
124
|
}
|
|
119
125
|
};
|
|
120
126
|
const onMenuOpen = () => {
|
|
@@ -272,7 +278,10 @@ const TimePicker = /*#__PURE__*/forwardRef(({
|
|
|
272
278
|
placeholder: placeholder || l10n.formatTime(placeholderDatetime),
|
|
273
279
|
styles: mergedStyles,
|
|
274
280
|
value: initialValue,
|
|
275
|
-
spacing: spacing
|
|
281
|
+
spacing: spacing
|
|
282
|
+
// We need this to get things to work, even though it's not supported.
|
|
283
|
+
// @ts-ignore
|
|
284
|
+
,
|
|
276
285
|
fixedLayerRef: containerRef,
|
|
277
286
|
isInvalid: isInvalid,
|
|
278
287
|
testId: testId
|
|
@@ -29,7 +29,7 @@ import { Menu } from '../internal/menu';
|
|
|
29
29
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
30
30
|
import { makeSingleValue } from '../internal/single-value';
|
|
31
31
|
var packageName = "@atlaskit/datetime-picker";
|
|
32
|
-
var packageVersion = "
|
|
32
|
+
var packageVersion = "15.0.0";
|
|
33
33
|
var datePickerDefaultProps = {
|
|
34
34
|
appearance: 'default',
|
|
35
35
|
autoFocus: false,
|
|
@@ -28,7 +28,7 @@ import { convertTokens } from '../internal/parse-tokens';
|
|
|
28
28
|
import DatePicker from './date-picker';
|
|
29
29
|
import TimePicker from './time-picker';
|
|
30
30
|
var packageName = "@atlaskit/datetime-picker";
|
|
31
|
-
var packageVersion = "
|
|
31
|
+
var packageVersion = "15.0.0";
|
|
32
32
|
// Make DatePicker 50% the width of DateTimePicker
|
|
33
33
|
// If rendering an icon container, shrink the TimePicker
|
|
34
34
|
var datePickerContainerStyles = css({
|
|
@@ -5,9 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
5
5
|
var _excluded = ["styles"];
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
|
-
import React, { forwardRef, useReducer, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line no-restricted-imports
|
|
8
|
+
import React, { forwardRef, useCallback, useEffect, useReducer, useState } from 'react';
|
|
11
9
|
import { format, isValid } from 'date-fns';
|
|
12
10
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
13
11
|
import __noop from '@atlaskit/ds-lib/noop';
|
|
@@ -19,7 +17,7 @@ import parseTime from '../internal/parse-time';
|
|
|
19
17
|
import { convertTokens } from '../internal/parse-tokens';
|
|
20
18
|
import { makeSingleValue } from '../internal/single-value';
|
|
21
19
|
var packageName = "@atlaskit/datetime-picker";
|
|
22
|
-
var packageVersion = "
|
|
20
|
+
var packageVersion = "15.0.0";
|
|
23
21
|
var menuStyles = {
|
|
24
22
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
25
23
|
position: 'static',
|
|
@@ -45,7 +43,6 @@ var analyticsAttributes = {
|
|
|
45
43
|
*/
|
|
46
44
|
var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
47
45
|
var ariaDescribedBy = _ref['aria-describedby'],
|
|
48
|
-
analyticsContext = _ref.analyticsContext,
|
|
49
46
|
_ref$appearance = _ref.appearance,
|
|
50
47
|
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
51
48
|
_ref$autoFocus = _ref.autoFocus,
|
|
@@ -112,11 +109,11 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
112
109
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
113
110
|
_ = _useState6[0],
|
|
114
111
|
setIsFocused = _useState6[1];
|
|
115
|
-
var _useState7 = useState(
|
|
112
|
+
var _useState7 = useState(defaultIsOpen),
|
|
116
113
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
117
114
|
isOpen = _useState8[0],
|
|
118
115
|
setIsOpen = _useState8[1];
|
|
119
|
-
var _useState9 = useState(
|
|
116
|
+
var _useState9 = useState(defaultValue),
|
|
120
117
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
121
118
|
value = _useState10[0],
|
|
122
119
|
setValue = _useState10[1];
|
|
@@ -129,10 +126,19 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
129
126
|
forceUpdate = _useReducer2[1];
|
|
130
127
|
var providedOnChangeWithAnalytics = usePlatformLeafEventHandler(_objectSpread({
|
|
131
128
|
fn: providedOnChange,
|
|
132
|
-
action: 'selectedTime'
|
|
133
|
-
analyticsData: analyticsContext
|
|
129
|
+
action: 'selectedTime'
|
|
134
130
|
}, analyticsAttributes));
|
|
135
|
-
|
|
131
|
+
useEffect(function () {
|
|
132
|
+
if (providedValue) {
|
|
133
|
+
setValue(providedValue);
|
|
134
|
+
}
|
|
135
|
+
}, [providedValue]);
|
|
136
|
+
useEffect(function () {
|
|
137
|
+
if (providedIsOpen) {
|
|
138
|
+
setIsOpen(providedIsOpen);
|
|
139
|
+
}
|
|
140
|
+
}, [providedIsOpen]);
|
|
141
|
+
var onChange = useCallback(function (newValue, action) {
|
|
136
142
|
var rawValue = newValue ? newValue.value || newValue : '';
|
|
137
143
|
var finalValue = rawValue.toString();
|
|
138
144
|
setValue(finalValue);
|
|
@@ -140,7 +146,7 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
140
146
|
setClearingFromIcon(true);
|
|
141
147
|
}
|
|
142
148
|
providedOnChangeWithAnalytics(finalValue);
|
|
143
|
-
};
|
|
149
|
+
}, [providedOnChangeWithAnalytics]);
|
|
144
150
|
|
|
145
151
|
/**
|
|
146
152
|
* Only allow custom times if timeIsEditable prop is true
|
|
@@ -157,9 +163,9 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
157
163
|
var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
158
164
|
var formattedValue = format(sanitizedInput, formatFormat) || '';
|
|
159
165
|
setValue(formattedValue);
|
|
160
|
-
|
|
166
|
+
providedOnChangeWithAnalytics(formattedValue);
|
|
161
167
|
} else {
|
|
162
|
-
|
|
168
|
+
providedOnChangeWithAnalytics(inputValue);
|
|
163
169
|
}
|
|
164
170
|
};
|
|
165
171
|
var onMenuOpen = function onMenuOpen() {
|
|
@@ -314,7 +320,10 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
314
320
|
placeholder: placeholder || l10n.formatTime(placeholderDatetime),
|
|
315
321
|
styles: mergedStyles,
|
|
316
322
|
value: initialValue,
|
|
317
|
-
spacing: spacing
|
|
323
|
+
spacing: spacing
|
|
324
|
+
// We need this to get things to work, even though it's not supported.
|
|
325
|
+
// @ts-ignore
|
|
326
|
+
,
|
|
318
327
|
fixedLayerRef: containerRef,
|
|
319
328
|
isInvalid: isInvalid,
|
|
320
329
|
testId: testId
|
|
@@ -9,5 +9,5 @@ import { type TimePickerBaseProps } from '../types';
|
|
|
9
9
|
* - [Code](https://atlassian.design/components/datetime-picker/time-picker/code)
|
|
10
10
|
* - [Usage](https://atlassian.design/components/datetime-picker/time-picker/usage)
|
|
11
11
|
*/
|
|
12
|
-
declare const TimePicker: React.ForwardRefExoticComponent<Pick<TimePickerBaseProps, "times" | "parseInputValue" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "
|
|
12
|
+
declare const TimePicker: React.ForwardRefExoticComponent<Pick<TimePickerBaseProps, "times" | "parseInputValue" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "defaultIsOpen" | "isOpen" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<unknown>>;
|
|
13
13
|
export default TimePicker;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -206,10 +206,6 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps, PickerSel
|
|
|
206
206
|
weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
207
207
|
}
|
|
208
208
|
export interface TimePickerBaseProps extends WithAnalyticsEventsProps, PickerSelectProps {
|
|
209
|
-
/**
|
|
210
|
-
* Additional information to be included in the `context` of analytics events
|
|
211
|
-
*/
|
|
212
|
-
analyticsContext?: Record<string, any>;
|
|
213
209
|
/**
|
|
214
210
|
* Set the appearance of the picker.
|
|
215
211
|
* `subtle` will remove the borders, background, and icon.
|
|
@@ -9,5 +9,5 @@ import { type TimePickerBaseProps } from '../types';
|
|
|
9
9
|
* - [Code](https://atlassian.design/components/datetime-picker/time-picker/code)
|
|
10
10
|
* - [Usage](https://atlassian.design/components/datetime-picker/time-picker/usage)
|
|
11
11
|
*/
|
|
12
|
-
declare const TimePicker: React.ForwardRefExoticComponent<Pick<TimePickerBaseProps, "times" | "parseInputValue" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "
|
|
12
|
+
declare const TimePicker: React.ForwardRefExoticComponent<Pick<TimePickerBaseProps, "times" | "parseInputValue" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "locale" | "createAnalyticsEvent" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "defaultIsOpen" | "isOpen" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<unknown>>;
|
|
13
13
|
export default TimePicker;
|
|
@@ -206,10 +206,6 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps, PickerSel
|
|
|
206
206
|
weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
207
207
|
}
|
|
208
208
|
export interface TimePickerBaseProps extends WithAnalyticsEventsProps, PickerSelectProps {
|
|
209
|
-
/**
|
|
210
|
-
* Additional information to be included in the `context` of analytics events
|
|
211
|
-
*/
|
|
212
|
-
analyticsContext?: Record<string, any>;
|
|
213
209
|
/**
|
|
214
210
|
* Set the appearance of the picker.
|
|
215
211
|
* `subtle` will remove the borders, background, and icon.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.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/"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/popper": "^6.3.0",
|
|
45
45
|
"@atlaskit/select": "^17.19.0",
|
|
46
46
|
"@atlaskit/theme": "^13.0.0",
|
|
47
|
-
"@atlaskit/tokens": "^1.
|
|
47
|
+
"@atlaskit/tokens": "^1.61.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"@emotion/react": "^11.7.1",
|
|
50
50
|
"date-fns": "^2.17.0"
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"@af/accessibility-testing": "*",
|
|
57
57
|
"@af/integration-testing": "*",
|
|
58
58
|
"@af/visual-regression": "*",
|
|
59
|
-
"@atlaskit/button": "^20.
|
|
59
|
+
"@atlaskit/button": "^20.2.0",
|
|
60
60
|
"@atlaskit/codemod-utils": "4.2.4",
|
|
61
61
|
"@atlaskit/docs": "*",
|
|
62
62
|
"@atlaskit/form": "^10.5.0",
|
|
63
|
-
"@atlaskit/modal-dialog": "^12.
|
|
63
|
+
"@atlaskit/modal-dialog": "^12.17.0",
|
|
64
64
|
"@atlaskit/popup": "^1.27.0",
|
|
65
65
|
"@atlaskit/range": "^7.4.0",
|
|
66
66
|
"@atlaskit/section-message": "^6.6.0",
|