@atlaskit/datetime-picker 14.1.2 → 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 CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 14.1.2
4
12
 
5
13
  ### 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 = "14.1.2";
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 = "14.1.2";
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)({
@@ -27,7 +27,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
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
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 = "14.1.2";
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,
@@ -137,8 +136,7 @@ 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 () {
144
142
  if (providedValue) {
@@ -150,7 +148,7 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
150
148
  setIsOpen(providedIsOpen);
151
149
  }
152
150
  }, [providedIsOpen]);
153
- var onChange = function onChange(newValue, action) {
151
+ var onChange = (0, _react.useCallback)(function (newValue, action) {
154
152
  var rawValue = newValue ? newValue.value || newValue : '';
155
153
  var finalValue = rawValue.toString();
156
154
  setValue(finalValue);
@@ -158,7 +156,7 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
158
156
  setClearingFromIcon(true);
159
157
  }
160
158
  providedOnChangeWithAnalytics(finalValue);
161
- };
159
+ }, [providedOnChangeWithAnalytics]);
162
160
 
163
161
  /**
164
162
  * Only allow custom times if timeIsEditable prop is true
@@ -175,9 +173,9 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
175
173
  var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
176
174
  var formattedValue = (0, _dateFns.format)(sanitizedInput, formatFormat) || '';
177
175
  setValue(formattedValue);
178
- providedOnChange(formattedValue);
176
+ providedOnChangeWithAnalytics(formattedValue);
179
177
  } else {
180
- providedOnChange(inputValue);
178
+ providedOnChangeWithAnalytics(inputValue);
181
179
  }
182
180
  };
183
181
  var onMenuOpen = function onMenuOpen() {
@@ -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 = "14.1.2";
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 = "14.1.2";
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,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { forwardRef, useEffect, useReducer, useState } from 'react';
2
+ import React, { forwardRef, useCallback, useEffect, useReducer, useState } from 'react';
3
3
  import { format, isValid } from 'date-fns';
4
4
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
5
5
  import __noop from '@atlaskit/ds-lib/noop';
@@ -11,7 +11,7 @@ import parseTime from '../internal/parse-time';
11
11
  import { convertTokens } from '../internal/parse-tokens';
12
12
  import { makeSingleValue } from '../internal/single-value';
13
13
  const packageName = "@atlaskit/datetime-picker";
14
- const packageVersion = "14.1.2";
14
+ const packageVersion = "15.0.0";
15
15
  const menuStyles = {
16
16
  /* Need to remove default absolute positioning as that causes issues with position fixed */
17
17
  position: 'static',
@@ -37,7 +37,6 @@ const analyticsAttributes = {
37
37
  */
38
38
  const TimePicker = /*#__PURE__*/forwardRef(({
39
39
  'aria-describedby': ariaDescribedBy,
40
- analyticsContext,
41
40
  appearance = 'default',
42
41
  autoFocus = false,
43
42
  defaultIsOpen = false,
@@ -82,7 +81,6 @@ const TimePicker = /*#__PURE__*/forwardRef(({
82
81
  const providedOnChangeWithAnalytics = usePlatformLeafEventHandler({
83
82
  fn: providedOnChange,
84
83
  action: 'selectedTime',
85
- analyticsData: analyticsContext,
86
84
  ...analyticsAttributes
87
85
  });
88
86
  useEffect(() => {
@@ -95,7 +93,7 @@ const TimePicker = /*#__PURE__*/forwardRef(({
95
93
  setIsOpen(providedIsOpen);
96
94
  }
97
95
  }, [providedIsOpen]);
98
- const onChange = (newValue, action) => {
96
+ const onChange = useCallback((newValue, action) => {
99
97
  const rawValue = newValue ? newValue.value || newValue : '';
100
98
  const finalValue = rawValue.toString();
101
99
  setValue(finalValue);
@@ -103,7 +101,7 @@ const TimePicker = /*#__PURE__*/forwardRef(({
103
101
  setClearingFromIcon(true);
104
102
  }
105
103
  providedOnChangeWithAnalytics(finalValue);
106
- };
104
+ }, [providedOnChangeWithAnalytics]);
107
105
 
108
106
  /**
109
107
  * Only allow custom times if timeIsEditable prop is true
@@ -120,9 +118,9 @@ const TimePicker = /*#__PURE__*/forwardRef(({
120
118
  const formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
121
119
  const formattedValue = format(sanitizedInput, formatFormat) || '';
122
120
  setValue(formattedValue);
123
- providedOnChange(formattedValue);
121
+ providedOnChangeWithAnalytics(formattedValue);
124
122
  } else {
125
- providedOnChange(inputValue);
123
+ providedOnChangeWithAnalytics(inputValue);
126
124
  }
127
125
  };
128
126
  const onMenuOpen = () => {
@@ -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 = "14.1.2";
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 = "14.1.2";
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,7 +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, useEffect, useReducer, useState } from 'react';
8
+ import React, { forwardRef, useCallback, useEffect, useReducer, useState } from 'react';
9
9
  import { format, isValid } from 'date-fns';
10
10
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
11
11
  import __noop from '@atlaskit/ds-lib/noop';
@@ -17,7 +17,7 @@ import parseTime from '../internal/parse-time';
17
17
  import { convertTokens } from '../internal/parse-tokens';
18
18
  import { makeSingleValue } from '../internal/single-value';
19
19
  var packageName = "@atlaskit/datetime-picker";
20
- var packageVersion = "14.1.2";
20
+ var packageVersion = "15.0.0";
21
21
  var menuStyles = {
22
22
  /* Need to remove default absolute positioning as that causes issues with position fixed */
23
23
  position: 'static',
@@ -43,7 +43,6 @@ var analyticsAttributes = {
43
43
  */
44
44
  var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
45
45
  var ariaDescribedBy = _ref['aria-describedby'],
46
- analyticsContext = _ref.analyticsContext,
47
46
  _ref$appearance = _ref.appearance,
48
47
  appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
49
48
  _ref$autoFocus = _ref.autoFocus,
@@ -127,8 +126,7 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
127
126
  forceUpdate = _useReducer2[1];
128
127
  var providedOnChangeWithAnalytics = usePlatformLeafEventHandler(_objectSpread({
129
128
  fn: providedOnChange,
130
- action: 'selectedTime',
131
- analyticsData: analyticsContext
129
+ action: 'selectedTime'
132
130
  }, analyticsAttributes));
133
131
  useEffect(function () {
134
132
  if (providedValue) {
@@ -140,7 +138,7 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
140
138
  setIsOpen(providedIsOpen);
141
139
  }
142
140
  }, [providedIsOpen]);
143
- var onChange = function onChange(newValue, action) {
141
+ var onChange = useCallback(function (newValue, action) {
144
142
  var rawValue = newValue ? newValue.value || newValue : '';
145
143
  var finalValue = rawValue.toString();
146
144
  setValue(finalValue);
@@ -148,7 +146,7 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
148
146
  setClearingFromIcon(true);
149
147
  }
150
148
  providedOnChangeWithAnalytics(finalValue);
151
- };
149
+ }, [providedOnChangeWithAnalytics]);
152
150
 
153
151
  /**
154
152
  * Only allow custom times if timeIsEditable prop is true
@@ -165,9 +163,9 @@ var TimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
165
163
  var formatFormat = includesSeconds ? 'HH:mm:ss' : 'HH:mm';
166
164
  var formattedValue = format(sanitizedInput, formatFormat) || '';
167
165
  setValue(formattedValue);
168
- providedOnChange(formattedValue);
166
+ providedOnChangeWithAnalytics(formattedValue);
169
167
  } else {
170
- providedOnChange(inputValue);
168
+ providedOnChangeWithAnalytics(inputValue);
171
169
  }
172
170
  };
173
171
  var onMenuOpen = function onMenuOpen() {
@@ -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" | "analyticsContext" | "createAnalyticsEvent" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "defaultIsOpen" | "isOpen" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<unknown>>;
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.
@@ -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" | "analyticsContext" | "createAnalyticsEvent" | "value" | "autoFocus" | "name" | "spacing" | "isInvalid" | "defaultIsOpen" | "isOpen" | "hideIcon" | "timeIsEditable" | "timeFormat"> & React.RefAttributes<unknown>>;
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": "14.1.2",
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/"
@@ -56,11 +56,11 @@
56
56
  "@af/accessibility-testing": "*",
57
57
  "@af/integration-testing": "*",
58
58
  "@af/visual-regression": "*",
59
- "@atlaskit/button": "^20.1.0",
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.16.0",
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",