@atlaskit/editor-plugin-date 12.2.5 → 12.2.7

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,20 @@
1
1
  # @atlaskit/editor-plugin-date
2
2
 
3
+ ## 12.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`832b5c12a55e7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/832b5c12a55e7) -
8
+ Improve date picker keyboard behaviour in modal-mounted editor popups behind
9
+ create_work_item_modernization_exp or platform_editor_datepicker_focus_fix.
10
+ - Updated dependencies
11
+
12
+ ## 12.2.6
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 12.2.5
4
19
 
5
20
  ### Patch Changes
@@ -19,7 +19,9 @@ var _reactIntl = require("react-intl");
19
19
  var _analytics = require("@atlaskit/editor-common/analytics");
20
20
  var _messages = require("@atlaskit/editor-common/messages");
21
21
  var _form = require("@atlaskit/form");
22
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
23
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
24
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
23
25
  var _formatParse = require("./utils/formatParse");
24
26
  var _internal = require("./utils/internal");
25
27
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
@@ -135,6 +137,11 @@ var DatePickerInput = /*#__PURE__*/function (_React$Component) {
135
137
  if (adjustment === undefined) {
136
138
  return;
137
139
  }
140
+
141
+ // focus trap for arrow keys in input field
142
+ if ((0, _platformFeatureFlags.fg)('platform_editor_datepicker_focus_fix') || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true)) {
143
+ event.stopPropagation();
144
+ }
138
145
  var dispatchAnalyticsEvent = _this.props.dispatchAnalyticsEvent;
139
146
  var cursorPos = (_this$inputRef3 = _this.inputRef) === null || _this$inputRef3 === void 0 ? void 0 : _this$inputRef3.selectionStart;
140
147
  if (cursorPos === null || cursorPos === undefined) {
@@ -215,13 +222,14 @@ var DatePickerInput = /*#__PURE__*/function (_React$Component) {
215
222
  }
216
223
  }, {
217
224
  key: "componentDidUpdate",
218
- value: function componentDidUpdate() {
225
+ value: function componentDidUpdate(prevProps) {
219
226
  var setInputSelectionPos = this.setInputSelectionPos;
220
227
  if (this.inputRef && setInputSelectionPos !== undefined) {
221
228
  this.inputRef.setSelectionRange(setInputSelectionPos, setInputSelectionPos);
222
229
  this.setInputSelectionPos = undefined;
223
230
  }
224
- if (this.inputRef && this.props.autoFocus) {
231
+ var shouldFocusInput = (0, _platformFeatureFlags.fg)('platform_editor_datepicker_focus_fix') || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true) ? !prevProps.autoFocus && this.props.autoFocus : this.props.autoFocus;
232
+ if (this.inputRef && shouldFocusInput) {
225
233
  this.focusInput();
226
234
  }
227
235
 
@@ -7,7 +7,9 @@ import { injectIntl } from 'react-intl';
7
7
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
8
  import { dateMessages as messages } from '@atlaskit/editor-common/messages';
9
9
  import { ErrorMessage } from '@atlaskit/form';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import TextField from '@atlaskit/textfield';
12
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
13
  import { formatDateType, parseDateType } from './utils/formatParse';
12
14
  import { adjustDate, findDateSegmentByPosition, isDatePossiblyValid } from './utils/internal';
13
15
 
@@ -125,6 +127,11 @@ class DatePickerInput extends React.Component {
125
127
  if (adjustment === undefined) {
126
128
  return;
127
129
  }
130
+
131
+ // focus trap for arrow keys in input field
132
+ if (fg('platform_editor_datepicker_focus_fix') || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) {
133
+ event.stopPropagation();
134
+ }
128
135
  const {
129
136
  dispatchAnalyticsEvent
130
137
  } = this.props;
@@ -208,13 +215,14 @@ class DatePickerInput extends React.Component {
208
215
  "aria-label": formatMessage(messages.onKeyUpDownText)
209
216
  }), displayError && /*#__PURE__*/React.createElement(ErrorMessage, null, formatMessage(messages.invalidDateError)));
210
217
  }
211
- componentDidUpdate() {
218
+ componentDidUpdate(prevProps) {
212
219
  const setInputSelectionPos = this.setInputSelectionPos;
213
220
  if (this.inputRef && setInputSelectionPos !== undefined) {
214
221
  this.inputRef.setSelectionRange(setInputSelectionPos, setInputSelectionPos);
215
222
  this.setInputSelectionPos = undefined;
216
223
  }
217
- if (this.inputRef && this.props.autoFocus) {
224
+ const shouldFocusInput = fg('platform_editor_datepicker_focus_fix') || expValEquals('create_work_item_modernization_exp', 'isEnabled', true) ? !prevProps.autoFocus && this.props.autoFocus : this.props.autoFocus;
225
+ if (this.inputRef && shouldFocusInput) {
218
226
  this.focusInput();
219
227
  }
220
228
 
@@ -14,7 +14,9 @@ import { injectIntl } from 'react-intl';
14
14
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
15
15
  import { dateMessages as messages } from '@atlaskit/editor-common/messages';
16
16
  import { ErrorMessage } from '@atlaskit/form';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  import TextField from '@atlaskit/textfield';
19
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
20
  import { formatDateType, parseDateType } from './utils/formatParse';
19
21
  import { adjustDate, findDateSegmentByPosition, isDatePossiblyValid } from './utils/internal';
20
22
 
@@ -129,6 +131,11 @@ var DatePickerInput = /*#__PURE__*/function (_React$Component) {
129
131
  if (adjustment === undefined) {
130
132
  return;
131
133
  }
134
+
135
+ // focus trap for arrow keys in input field
136
+ if (fg('platform_editor_datepicker_focus_fix') || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) {
137
+ event.stopPropagation();
138
+ }
132
139
  var dispatchAnalyticsEvent = _this.props.dispatchAnalyticsEvent;
133
140
  var cursorPos = (_this$inputRef3 = _this.inputRef) === null || _this$inputRef3 === void 0 ? void 0 : _this$inputRef3.selectionStart;
134
141
  if (cursorPos === null || cursorPos === undefined) {
@@ -209,13 +216,14 @@ var DatePickerInput = /*#__PURE__*/function (_React$Component) {
209
216
  }
210
217
  }, {
211
218
  key: "componentDidUpdate",
212
- value: function componentDidUpdate() {
219
+ value: function componentDidUpdate(prevProps) {
213
220
  var setInputSelectionPos = this.setInputSelectionPos;
214
221
  if (this.inputRef && setInputSelectionPos !== undefined) {
215
222
  this.inputRef.setSelectionRange(setInputSelectionPos, setInputSelectionPos);
216
223
  this.setInputSelectionPos = undefined;
217
224
  }
218
- if (this.inputRef && this.props.autoFocus) {
225
+ var shouldFocusInput = fg('platform_editor_datepicker_focus_fix') || expValEquals('create_work_item_modernization_exp', 'isEnabled', true) ? !prevProps.autoFocus && this.props.autoFocus : this.props.autoFocus;
226
+ if (this.inputRef && shouldFocusInput) {
219
227
  this.focusInput();
220
228
  }
221
229
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-date",
3
- "version": "12.2.5",
3
+ "version": "12.2.7",
4
4
  "description": "Date plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
- "@atlaskit/adf-schema": "^52.14.0",
32
+ "@atlaskit/adf-schema": "^52.15.0",
33
33
  "@atlaskit/calendar": "^17.2.0",
34
34
  "@atlaskit/css": "^0.19.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^10.1.0",
@@ -43,8 +43,8 @@
43
43
  "@atlaskit/locale": "^4.1.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/textfield": "^8.3.0",
46
- "@atlaskit/tmp-editor-statsig": "^84.0.0",
47
- "@atlaskit/tokens": "^13.0.0",
46
+ "@atlaskit/tmp-editor-statsig": "^85.0.0",
47
+ "@atlaskit/tokens": "^13.1.0",
48
48
  "@atlaskit/visually-hidden": "^3.1.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "bind-event-listener": "^3.0.0",
@@ -58,7 +58,7 @@
58
58
  "react-intl": "^6.6.2"
59
59
  },
60
60
  "peerDependencies": {
61
- "@atlaskit/editor-common": "^114.47.0",
61
+ "@atlaskit/editor-common": "^114.51.0",
62
62
  "react": "^18.2.0",
63
63
  "react-dom": "^18.2.0",
64
64
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -104,6 +104,9 @@
104
104
  },
105
105
  "platform_editor_adf_with_localid": {
106
106
  "type": "boolean"
107
+ },
108
+ "platform_editor_datepicker_focus_fix": {
109
+ "type": "boolean"
107
110
  }
108
111
  }
109
112
  }