@atlaskit/editor-plugin-find-replace 1.0.0 → 1.0.2

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,17 @@
1
1
  # @atlaskit/editor-plugin-find-replace
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#72125](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72125) [`9b19a14df053`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9b19a14df053) - Migrated buttons in find and replace popup to new atlaskit buttons with a feature flag `platform.design-system-team.editor-new-button_jjjdo`.
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#72710](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72710) [`3a884530c4d2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3a884530c4d2) - Move translation strings for find-replace to ICU format.
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  ### Major Changes
@@ -237,6 +237,9 @@ var Find = /*#__PURE__*/function (_React$Component) {
237
237
  title: this.matchCase,
238
238
  appearance: "default",
239
239
  icon: this.matchCaseIcon,
240
+ newIcon: _keyboard.default,
241
+ iconLabel: this.matchCase,
242
+ iconSize: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? 'small' : undefined,
240
243
  onClick: this.handleMatchCaseClick,
241
244
  isPressed: shouldMatchCase
242
245
  })));
@@ -286,23 +289,32 @@ var Find = /*#__PURE__*/function (_React$Component) {
286
289
  }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
287
290
  title: this.matchCase,
288
291
  icon: this.matchCaseIcon,
292
+ newIcon: _keyboard.default,
293
+ iconLabel: this.matchCase,
294
+ iconSize: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? 'small' : undefined,
289
295
  onClick: this.handleMatchCaseClick,
290
296
  isPressed: shouldMatchCase
291
297
  }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
292
298
  title: this.findNext,
293
299
  icon: this.findNextIcon,
300
+ newIcon: _chevronDown.default,
301
+ iconLabel: this.findNext,
294
302
  keymapDescription: 'Enter',
295
303
  onClick: this.handleFindNextClick,
296
304
  disabled: count.total <= 1
297
305
  }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
298
306
  title: this.findPrevious,
299
307
  icon: this.findPrevIcon,
308
+ newIcon: _chevronUp.default,
309
+ iconLabel: this.findPrevious,
300
310
  keymapDescription: 'Shift Enter',
301
311
  onClick: this.handleFindPrevClick,
302
312
  disabled: count.total <= 1
303
313
  }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
304
314
  title: this.closeFindReplaceDialog,
305
315
  icon: this.closeIcon,
316
+ newIcon: _close.default,
317
+ iconLabel: this.closeFindReplaceDialog,
306
318
  keymapDescription: 'Escape',
307
319
  onClick: this.clearSearch
308
320
  }));
@@ -14,8 +14,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
14
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
16
  var _react = _interopRequireDefault(require("react"));
17
+ var _new = require("@atlaskit/button/new");
17
18
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
18
19
  var _keymaps = require("@atlaskit/editor-common/keymaps");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
21
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
20
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; }
21
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; }
@@ -44,6 +46,8 @@ var FindReplaceTooltipButton = exports.FindReplaceTooltipButton = /*#__PURE__*/f
44
46
  var _this$props = this.props,
45
47
  title = _this$props.title,
46
48
  icon = _this$props.icon,
49
+ newIcon = _this$props.newIcon,
50
+ iconSize = _this$props.iconSize,
47
51
  keymapDescription = _this$props.keymapDescription,
48
52
  disabled = _this$props.disabled,
49
53
  isPressed = _this$props.isPressed,
@@ -58,7 +62,18 @@ var FindReplaceTooltipButton = exports.FindReplaceTooltipButton = /*#__PURE__*/f
58
62
  }),
59
63
  hideTooltipOnClick: true,
60
64
  position: 'top'
61
- }, /*#__PURE__*/_react.default.createElement(_standardButton.default, (0, _extends2.default)({
65
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.editor-new-button_jjjdo') ? /*#__PURE__*/_react.default.createElement(_new.IconButton, (0, _extends2.default)({
66
+ id: "afterInputSection",
67
+ label: title,
68
+ appearance: appearance,
69
+ testId: title,
70
+ ref: this.buttonRef,
71
+ icon: newIcon,
72
+ UNSAFE_size: iconSize,
73
+ isDisabled: disabled,
74
+ onClick: this.handleClick,
75
+ isSelected: isPressed
76
+ }, pressedProps)) : /*#__PURE__*/_react.default.createElement(_standardButton.default, (0, _extends2.default)({
62
77
  id: "afterInputSection",
63
78
  label: title,
64
79
  appearance: appearance,
@@ -16,6 +16,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
16
16
  var _react = _interopRequireWildcard(require("react"));
17
17
  var _react2 = require("@emotion/react");
18
18
  var _reactIntlNext = require("react-intl-next");
19
+ var _new = _interopRequireDefault(require("@atlaskit/button/new"));
19
20
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
20
21
  var _analytics = require("@atlaskit/editor-common/analytics");
21
22
  var _messages = require("@atlaskit/editor-common/messages");
@@ -23,6 +24,7 @@ var _form = require("@atlaskit/form");
23
24
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-down"));
24
25
  var _chevronUp = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-up"));
25
26
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
+ var _primitives = require("@atlaskit/primitives");
26
28
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
27
29
  var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
28
30
  var _styles = require("./styles");
@@ -218,8 +220,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
218
220
  count = _this$props.count,
219
221
  formatMessage = _this$props.intl.formatMessage;
220
222
  var resultsReplace = formatMessage(_messages.findReplaceMessages.replaceSuccess, {
221
- numberOfMatches: replaceCount,
222
- matchPluralSingularNoun: replaceCount > 1 ? formatMessage(_messages.findReplaceMessages.matchPluralNoun) : formatMessage(_messages.findReplaceMessages.matchSingularNoun)
223
+ numberOfMatches: replaceCount
223
224
  });
224
225
  return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("div", {
225
226
  css: [_styles.sectionWrapperStyles, _styles.sectionWrapperStylesAlternate]
@@ -256,6 +257,8 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
256
257
  }, (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
257
258
  title: this.findNext,
258
259
  icon: this.findNextIcon,
260
+ newIcon: _chevronDown.default,
261
+ iconLabel: this.findNext,
259
262
  keymapDescription: 'Enter',
260
263
  onClick: this.handleFindNextClick,
261
264
  disabled: count.total <= 1
@@ -264,10 +267,29 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
264
267
  }, (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
265
268
  title: this.findPrevious,
266
269
  icon: this.findPrevIcon,
270
+ newIcon: _chevronUp.default,
271
+ iconLabel: this.findPrevious,
267
272
  keymapDescription: 'Shift Enter',
268
273
  onClick: this.handleFindPrevClick,
269
274
  disabled: count.total <= 1
270
- })), (0, _react2.jsx)(_standardButton.default, {
275
+ })), (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.editor-new-button_jjjdo') ? (0, _react2.jsx)(_primitives.Inline, {
276
+ space: "space.075",
277
+ xcss: (0, _primitives.xcss)({
278
+ paddingInlineStart: 'space.050',
279
+ paddingInlineEnd: 'space.025'
280
+ })
281
+ }, (0, _react2.jsx)(_new.default, {
282
+ testId: this.replace,
283
+ id: "replace-button",
284
+ onClick: this.handleReplaceClick,
285
+ isDisabled: !canReplace
286
+ }, this.replace), (0, _react2.jsx)(_new.default, {
287
+ appearance: "primary",
288
+ testId: this.replaceAll,
289
+ id: "replaceAll-button",
290
+ onClick: this.handleReplaceAllClick,
291
+ isDisabled: !canReplace
292
+ }, this.replaceAll)) : (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_standardButton.default, {
271
293
  css: _styles.replaceSectionButtonStyles,
272
294
  testId: this.replace,
273
295
  id: "replace-button",
@@ -280,9 +302,13 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
280
302
  id: "replaceAll-button",
281
303
  onClick: this.handleReplaceAllClick,
282
304
  isDisabled: !canReplace
283
- }, this.replaceAll)), (0, _react2.jsx)("div", {
305
+ }, this.replaceAll))), (0, _react2.jsx)("div", {
284
306
  css: _styles.orderZeroStyles
285
- }, (0, _react2.jsx)(_standardButton.default, {
307
+ }, (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.editor-new-button_jjjdo') ? (0, _react2.jsx)(_new.default, {
308
+ appearance: "subtle",
309
+ testId: this.closeFindReplaceDialog,
310
+ onClick: this.clearSearch
311
+ }, this.closeFindReplaceDialog) : (0, _react2.jsx)(_standardButton.default, {
286
312
  css: _styles.replaceSectionButtonStyles,
287
313
  appearance: "subtle",
288
314
  testId: this.closeFindReplaceDialog,
@@ -300,7 +326,17 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
300
326
  onKeyDown: this.handleReplaceKeyDown,
301
327
  onCompositionStart: this.handleCompositionStart,
302
328
  onCompositionEnd: this.handleCompositionEnd
303
- }), (0, _react2.jsx)(_standardButton.default, {
329
+ }), (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.editor-new-button_jjjdo') ? (0, _react2.jsx)(_primitives.Inline, {
330
+ space: "space.050"
331
+ }, (0, _react2.jsx)(_new.default, {
332
+ testId: this.replace,
333
+ onClick: this.handleReplaceClick,
334
+ isDisabled: !canReplace
335
+ }, this.replace), (0, _react2.jsx)(_new.default, {
336
+ testId: this.replaceAll,
337
+ onClick: this.handleReplaceAllClick,
338
+ isDisabled: !canReplace
339
+ }, this.replaceAll)) : (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_standardButton.default, {
304
340
  css: _styles.replaceSectionButtonStyles,
305
341
  testId: this.replace,
306
342
  onClick: this.handleReplaceClick,
@@ -310,7 +346,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
310
346
  testId: this.replaceAll,
311
347
  onClick: this.handleReplaceAllClick,
312
348
  isDisabled: !canReplace
313
- }, this.replaceAll));
349
+ }, this.replaceAll)));
314
350
  }
315
351
  }]);
316
352
  return Replace;
@@ -65,7 +65,8 @@ var countWrapperStyles = exports.countWrapperStyles = (0, _react.css)({
65
65
  alignItems: 'center'
66
66
  });
67
67
  var orderZeroStyles = exports.orderZeroStyles = (0, _react.css)({
68
- order: '0'
68
+ order: '0',
69
+ marginInline: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.editor-new-button_jjjdo') ? "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-025, 2px)") : 0
69
70
  });
70
71
  var orderOneStyles = exports.orderOneStyles = (0, _react.css)({
71
72
  order: '1'
@@ -216,6 +216,9 @@ class Find extends React.Component {
216
216
  title: this.matchCase,
217
217
  appearance: "default",
218
218
  icon: this.matchCaseIcon,
219
+ newIcon: MatchCaseIcon,
220
+ iconLabel: this.matchCase,
221
+ iconSize: getBooleanFF('platform.editor.a11y-find-replace') ? 'small' : undefined,
219
222
  onClick: this.handleMatchCaseClick,
220
223
  isPressed: shouldMatchCase
221
224
  })));
@@ -265,23 +268,32 @@ class Find extends React.Component {
265
268
  }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && jsx(FindReplaceTooltipButton, {
266
269
  title: this.matchCase,
267
270
  icon: this.matchCaseIcon,
271
+ newIcon: MatchCaseIcon,
272
+ iconLabel: this.matchCase,
273
+ iconSize: getBooleanFF('platform.editor.a11y-find-replace') ? 'small' : undefined,
268
274
  onClick: this.handleMatchCaseClick,
269
275
  isPressed: shouldMatchCase
270
276
  }), jsx(FindReplaceTooltipButton, {
271
277
  title: this.findNext,
272
278
  icon: this.findNextIcon,
279
+ newIcon: ChevronDownIcon,
280
+ iconLabel: this.findNext,
273
281
  keymapDescription: 'Enter',
274
282
  onClick: this.handleFindNextClick,
275
283
  disabled: count.total <= 1
276
284
  }), jsx(FindReplaceTooltipButton, {
277
285
  title: this.findPrevious,
278
286
  icon: this.findPrevIcon,
287
+ newIcon: ChevronUpIcon,
288
+ iconLabel: this.findPrevious,
279
289
  keymapDescription: 'Shift Enter',
280
290
  onClick: this.handleFindPrevClick,
281
291
  disabled: count.total <= 1
282
292
  }), jsx(FindReplaceTooltipButton, {
283
293
  title: this.closeFindReplaceDialog,
284
294
  icon: this.closeIcon,
295
+ newIcon: EditorCloseIcon,
296
+ iconLabel: this.closeFindReplaceDialog,
285
297
  keymapDescription: 'Escape',
286
298
  onClick: this.clearSearch
287
299
  }));
@@ -1,8 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React from 'react';
4
- import Button from '@atlaskit/button/standard-button';
4
+ import { IconButton } from '@atlaskit/button/new';
5
+ import LegacyButton from '@atlaskit/button/standard-button';
5
6
  import { findKeymapByDescription, ToolTipContent } from '@atlaskit/editor-common/keymaps';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
8
  import Tooltip from '@atlaskit/tooltip';
7
9
  // eslint-disable-next-line @repo/internal/react/no-class-components
8
10
  export class FindReplaceTooltipButton extends React.PureComponent {
@@ -17,6 +19,8 @@ export class FindReplaceTooltipButton extends React.PureComponent {
17
19
  const {
18
20
  title,
19
21
  icon,
22
+ newIcon,
23
+ iconSize,
20
24
  keymapDescription,
21
25
  disabled,
22
26
  isPressed,
@@ -34,7 +38,18 @@ export class FindReplaceTooltipButton extends React.PureComponent {
34
38
  }),
35
39
  hideTooltipOnClick: true,
36
40
  position: 'top'
37
- }, /*#__PURE__*/React.createElement(Button, _extends({
41
+ }, getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? /*#__PURE__*/React.createElement(IconButton, _extends({
42
+ id: "afterInputSection",
43
+ label: title,
44
+ appearance: appearance,
45
+ testId: title,
46
+ ref: this.buttonRef,
47
+ icon: newIcon,
48
+ UNSAFE_size: iconSize,
49
+ isDisabled: disabled,
50
+ onClick: this.handleClick,
51
+ isSelected: isPressed
52
+ }, pressedProps)) : /*#__PURE__*/React.createElement(LegacyButton, _extends({
38
53
  id: "afterInputSection",
39
54
  label: title,
40
55
  appearance: appearance,
@@ -4,13 +4,15 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import React, { Fragment } from 'react';
5
5
  import { jsx } from '@emotion/react';
6
6
  import { injectIntl } from 'react-intl-next';
7
- import Button from '@atlaskit/button/standard-button';
7
+ import Button from '@atlaskit/button/new';
8
+ import LegacyButton from '@atlaskit/button/standard-button';
8
9
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
9
10
  import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
10
11
  import { Label, ValidMessage } from '@atlaskit/form';
11
12
  import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
12
13
  import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
13
14
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
+ import { Inline, xcss } from '@atlaskit/primitives';
14
16
  import Textfield from '@atlaskit/textfield';
15
17
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
16
18
  import { NextPreviousItem, orderOneStyles, orderZeroStyles, replaceSectionButtonStyles, sectionWrapperJustified, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
@@ -194,8 +196,7 @@ class Replace extends React.PureComponent {
194
196
  }
195
197
  } = this.props;
196
198
  const resultsReplace = formatMessage(messages.replaceSuccess, {
197
- numberOfMatches: replaceCount,
198
- matchPluralSingularNoun: replaceCount > 1 ? formatMessage(messages.matchPluralNoun) : formatMessage(messages.matchSingularNoun)
199
+ numberOfMatches: replaceCount
199
200
  });
200
201
  return getBooleanFF('platform.editor.a11y-find-replace') ? jsx(Fragment, null, jsx("div", {
201
202
  css: [sectionWrapperStyles, sectionWrapperStylesAlternate]
@@ -232,6 +233,8 @@ class Replace extends React.PureComponent {
232
233
  }, jsx(FindReplaceTooltipButton, {
233
234
  title: this.findNext,
234
235
  icon: this.findNextIcon,
236
+ newIcon: ChevronDownIcon,
237
+ iconLabel: this.findNext,
235
238
  keymapDescription: 'Enter',
236
239
  onClick: this.handleFindNextClick,
237
240
  disabled: count.total <= 1
@@ -240,25 +243,48 @@ class Replace extends React.PureComponent {
240
243
  }, jsx(FindReplaceTooltipButton, {
241
244
  title: this.findPrevious,
242
245
  icon: this.findPrevIcon,
246
+ newIcon: ChevronUpIcon,
247
+ iconLabel: this.findPrevious,
243
248
  keymapDescription: 'Shift Enter',
244
249
  onClick: this.handleFindPrevClick,
245
250
  disabled: count.total <= 1
246
- })), jsx(Button, {
247
- css: replaceSectionButtonStyles,
251
+ })), getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? jsx(Inline, {
252
+ space: "space.075",
253
+ xcss: xcss({
254
+ paddingInlineStart: 'space.050',
255
+ paddingInlineEnd: 'space.025'
256
+ })
257
+ }, jsx(Button, {
248
258
  testId: this.replace,
249
259
  id: "replace-button",
250
260
  onClick: this.handleReplaceClick,
251
261
  isDisabled: !canReplace
252
262
  }, this.replace), jsx(Button, {
263
+ appearance: "primary",
264
+ testId: this.replaceAll,
265
+ id: "replaceAll-button",
266
+ onClick: this.handleReplaceAllClick,
267
+ isDisabled: !canReplace
268
+ }, this.replaceAll)) : jsx(Fragment, null, jsx(LegacyButton, {
269
+ css: replaceSectionButtonStyles,
270
+ testId: this.replace,
271
+ id: "replace-button",
272
+ onClick: this.handleReplaceClick,
273
+ isDisabled: !canReplace
274
+ }, this.replace), jsx(LegacyButton, {
253
275
  css: replaceSectionButtonStyles,
254
276
  appearance: "primary",
255
277
  testId: this.replaceAll,
256
278
  id: "replaceAll-button",
257
279
  onClick: this.handleReplaceAllClick,
258
280
  isDisabled: !canReplace
259
- }, this.replaceAll)), jsx("div", {
281
+ }, this.replaceAll))), jsx("div", {
260
282
  css: orderZeroStyles
261
- }, jsx(Button, {
283
+ }, getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? jsx(Button, {
284
+ appearance: "subtle",
285
+ testId: this.closeFindReplaceDialog,
286
+ onClick: this.clearSearch
287
+ }, this.closeFindReplaceDialog) : jsx(LegacyButton, {
262
288
  css: replaceSectionButtonStyles,
263
289
  appearance: "subtle",
264
290
  testId: this.closeFindReplaceDialog,
@@ -276,17 +302,27 @@ class Replace extends React.PureComponent {
276
302
  onKeyDown: this.handleReplaceKeyDown,
277
303
  onCompositionStart: this.handleCompositionStart,
278
304
  onCompositionEnd: this.handleCompositionEnd
279
- }), jsx(Button, {
280
- css: replaceSectionButtonStyles,
305
+ }), getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? jsx(Inline, {
306
+ space: "space.050"
307
+ }, jsx(Button, {
281
308
  testId: this.replace,
282
309
  onClick: this.handleReplaceClick,
283
310
  isDisabled: !canReplace
284
311
  }, this.replace), jsx(Button, {
312
+ testId: this.replaceAll,
313
+ onClick: this.handleReplaceAllClick,
314
+ isDisabled: !canReplace
315
+ }, this.replaceAll)) : jsx(Fragment, null, jsx(LegacyButton, {
316
+ css: replaceSectionButtonStyles,
317
+ testId: this.replace,
318
+ onClick: this.handleReplaceClick,
319
+ isDisabled: !canReplace
320
+ }, this.replace), jsx(LegacyButton, {
285
321
  css: replaceSectionButtonStyles,
286
322
  testId: this.replaceAll,
287
323
  onClick: this.handleReplaceAllClick,
288
324
  isDisabled: !canReplace
289
- }, this.replaceAll));
325
+ }, this.replaceAll)));
290
326
  }
291
327
  }
292
328
  export default injectIntl(Replace);
@@ -107,7 +107,8 @@ export const countWrapperStyles = css({
107
107
  alignItems: 'center'
108
108
  });
109
109
  export const orderZeroStyles = css({
110
- order: '0'
110
+ order: '0',
111
+ marginInline: getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-025, 2px)"}` : 0
111
112
  });
112
113
  export const orderOneStyles = css({
113
114
  order: '1'
@@ -232,6 +232,9 @@ var Find = /*#__PURE__*/function (_React$Component) {
232
232
  title: this.matchCase,
233
233
  appearance: "default",
234
234
  icon: this.matchCaseIcon,
235
+ newIcon: MatchCaseIcon,
236
+ iconLabel: this.matchCase,
237
+ iconSize: getBooleanFF('platform.editor.a11y-find-replace') ? 'small' : undefined,
235
238
  onClick: this.handleMatchCaseClick,
236
239
  isPressed: shouldMatchCase
237
240
  })));
@@ -281,23 +284,32 @@ var Find = /*#__PURE__*/function (_React$Component) {
281
284
  }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && jsx(FindReplaceTooltipButton, {
282
285
  title: this.matchCase,
283
286
  icon: this.matchCaseIcon,
287
+ newIcon: MatchCaseIcon,
288
+ iconLabel: this.matchCase,
289
+ iconSize: getBooleanFF('platform.editor.a11y-find-replace') ? 'small' : undefined,
284
290
  onClick: this.handleMatchCaseClick,
285
291
  isPressed: shouldMatchCase
286
292
  }), jsx(FindReplaceTooltipButton, {
287
293
  title: this.findNext,
288
294
  icon: this.findNextIcon,
295
+ newIcon: ChevronDownIcon,
296
+ iconLabel: this.findNext,
289
297
  keymapDescription: 'Enter',
290
298
  onClick: this.handleFindNextClick,
291
299
  disabled: count.total <= 1
292
300
  }), jsx(FindReplaceTooltipButton, {
293
301
  title: this.findPrevious,
294
302
  icon: this.findPrevIcon,
303
+ newIcon: ChevronUpIcon,
304
+ iconLabel: this.findPrevious,
295
305
  keymapDescription: 'Shift Enter',
296
306
  onClick: this.handleFindPrevClick,
297
307
  disabled: count.total <= 1
298
308
  }), jsx(FindReplaceTooltipButton, {
299
309
  title: this.closeFindReplaceDialog,
300
310
  icon: this.closeIcon,
311
+ newIcon: EditorCloseIcon,
312
+ iconLabel: this.closeFindReplaceDialog,
301
313
  keymapDescription: 'Escape',
302
314
  onClick: this.clearSearch
303
315
  }));
@@ -11,8 +11,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
11
11
  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); }; }
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
  import React from 'react';
14
- import Button from '@atlaskit/button/standard-button';
14
+ import { IconButton } from '@atlaskit/button/new';
15
+ import LegacyButton from '@atlaskit/button/standard-button';
15
16
  import { findKeymapByDescription, ToolTipContent } from '@atlaskit/editor-common/keymaps';
17
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
16
18
  import Tooltip from '@atlaskit/tooltip';
17
19
  // eslint-disable-next-line @repo/internal/react/no-class-components
18
20
  export var FindReplaceTooltipButton = /*#__PURE__*/function (_React$PureComponent) {
@@ -37,6 +39,8 @@ export var FindReplaceTooltipButton = /*#__PURE__*/function (_React$PureComponen
37
39
  var _this$props = this.props,
38
40
  title = _this$props.title,
39
41
  icon = _this$props.icon,
42
+ newIcon = _this$props.newIcon,
43
+ iconSize = _this$props.iconSize,
40
44
  keymapDescription = _this$props.keymapDescription,
41
45
  disabled = _this$props.disabled,
42
46
  isPressed = _this$props.isPressed,
@@ -51,7 +55,18 @@ export var FindReplaceTooltipButton = /*#__PURE__*/function (_React$PureComponen
51
55
  }),
52
56
  hideTooltipOnClick: true,
53
57
  position: 'top'
54
- }, /*#__PURE__*/React.createElement(Button, _extends({
58
+ }, getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? /*#__PURE__*/React.createElement(IconButton, _extends({
59
+ id: "afterInputSection",
60
+ label: title,
61
+ appearance: appearance,
62
+ testId: title,
63
+ ref: this.buttonRef,
64
+ icon: newIcon,
65
+ UNSAFE_size: iconSize,
66
+ isDisabled: disabled,
67
+ onClick: this.handleClick,
68
+ isSelected: isPressed
69
+ }, pressedProps)) : /*#__PURE__*/React.createElement(LegacyButton, _extends({
55
70
  id: "afterInputSection",
56
71
  label: title,
57
72
  appearance: appearance,
@@ -12,13 +12,15 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
  import React, { Fragment } from 'react';
13
13
  import { jsx } from '@emotion/react';
14
14
  import { injectIntl } from 'react-intl-next';
15
- import Button from '@atlaskit/button/standard-button';
15
+ import Button from '@atlaskit/button/new';
16
+ import LegacyButton from '@atlaskit/button/standard-button';
16
17
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
17
18
  import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
18
19
  import { Label, ValidMessage } from '@atlaskit/form';
19
20
  import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
20
21
  import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
21
22
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
23
+ import { Inline, xcss } from '@atlaskit/primitives';
22
24
  import Textfield from '@atlaskit/textfield';
23
25
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
24
26
  import { NextPreviousItem, orderOneStyles, orderZeroStyles, replaceSectionButtonStyles, sectionWrapperJustified, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
@@ -210,8 +212,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
210
212
  count = _this$props.count,
211
213
  formatMessage = _this$props.intl.formatMessage;
212
214
  var resultsReplace = formatMessage(messages.replaceSuccess, {
213
- numberOfMatches: replaceCount,
214
- matchPluralSingularNoun: replaceCount > 1 ? formatMessage(messages.matchPluralNoun) : formatMessage(messages.matchSingularNoun)
215
+ numberOfMatches: replaceCount
215
216
  });
216
217
  return getBooleanFF('platform.editor.a11y-find-replace') ? jsx(Fragment, null, jsx("div", {
217
218
  css: [sectionWrapperStyles, sectionWrapperStylesAlternate]
@@ -248,6 +249,8 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
248
249
  }, jsx(FindReplaceTooltipButton, {
249
250
  title: this.findNext,
250
251
  icon: this.findNextIcon,
252
+ newIcon: ChevronDownIcon,
253
+ iconLabel: this.findNext,
251
254
  keymapDescription: 'Enter',
252
255
  onClick: this.handleFindNextClick,
253
256
  disabled: count.total <= 1
@@ -256,25 +259,48 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
256
259
  }, jsx(FindReplaceTooltipButton, {
257
260
  title: this.findPrevious,
258
261
  icon: this.findPrevIcon,
262
+ newIcon: ChevronUpIcon,
263
+ iconLabel: this.findPrevious,
259
264
  keymapDescription: 'Shift Enter',
260
265
  onClick: this.handleFindPrevClick,
261
266
  disabled: count.total <= 1
262
- })), jsx(Button, {
263
- css: replaceSectionButtonStyles,
267
+ })), getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? jsx(Inline, {
268
+ space: "space.075",
269
+ xcss: xcss({
270
+ paddingInlineStart: 'space.050',
271
+ paddingInlineEnd: 'space.025'
272
+ })
273
+ }, jsx(Button, {
264
274
  testId: this.replace,
265
275
  id: "replace-button",
266
276
  onClick: this.handleReplaceClick,
267
277
  isDisabled: !canReplace
268
278
  }, this.replace), jsx(Button, {
279
+ appearance: "primary",
280
+ testId: this.replaceAll,
281
+ id: "replaceAll-button",
282
+ onClick: this.handleReplaceAllClick,
283
+ isDisabled: !canReplace
284
+ }, this.replaceAll)) : jsx(Fragment, null, jsx(LegacyButton, {
285
+ css: replaceSectionButtonStyles,
286
+ testId: this.replace,
287
+ id: "replace-button",
288
+ onClick: this.handleReplaceClick,
289
+ isDisabled: !canReplace
290
+ }, this.replace), jsx(LegacyButton, {
269
291
  css: replaceSectionButtonStyles,
270
292
  appearance: "primary",
271
293
  testId: this.replaceAll,
272
294
  id: "replaceAll-button",
273
295
  onClick: this.handleReplaceAllClick,
274
296
  isDisabled: !canReplace
275
- }, this.replaceAll)), jsx("div", {
297
+ }, this.replaceAll))), jsx("div", {
276
298
  css: orderZeroStyles
277
- }, jsx(Button, {
299
+ }, getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? jsx(Button, {
300
+ appearance: "subtle",
301
+ testId: this.closeFindReplaceDialog,
302
+ onClick: this.clearSearch
303
+ }, this.closeFindReplaceDialog) : jsx(LegacyButton, {
278
304
  css: replaceSectionButtonStyles,
279
305
  appearance: "subtle",
280
306
  testId: this.closeFindReplaceDialog,
@@ -292,17 +318,27 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
292
318
  onKeyDown: this.handleReplaceKeyDown,
293
319
  onCompositionStart: this.handleCompositionStart,
294
320
  onCompositionEnd: this.handleCompositionEnd
295
- }), jsx(Button, {
296
- css: replaceSectionButtonStyles,
321
+ }), getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? jsx(Inline, {
322
+ space: "space.050"
323
+ }, jsx(Button, {
297
324
  testId: this.replace,
298
325
  onClick: this.handleReplaceClick,
299
326
  isDisabled: !canReplace
300
327
  }, this.replace), jsx(Button, {
328
+ testId: this.replaceAll,
329
+ onClick: this.handleReplaceAllClick,
330
+ isDisabled: !canReplace
331
+ }, this.replaceAll)) : jsx(Fragment, null, jsx(LegacyButton, {
332
+ css: replaceSectionButtonStyles,
333
+ testId: this.replace,
334
+ onClick: this.handleReplaceClick,
335
+ isDisabled: !canReplace
336
+ }, this.replace), jsx(LegacyButton, {
301
337
  css: replaceSectionButtonStyles,
302
338
  testId: this.replaceAll,
303
339
  onClick: this.handleReplaceAllClick,
304
340
  isDisabled: !canReplace
305
- }, this.replaceAll));
341
+ }, this.replaceAll)));
306
342
  }
307
343
  }]);
308
344
  return Replace;
@@ -60,7 +60,8 @@ export var countWrapperStyles = css({
60
60
  alignItems: 'center'
61
61
  });
62
62
  export var orderZeroStyles = css({
63
- order: '0'
63
+ order: '0',
64
+ marginInline: getBooleanFF('platform.design-system-team.editor-new-button_jjjdo') ? "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-025, 2px)") : 0
64
65
  });
65
66
  export var orderOneStyles = css({
66
67
  order: '1'
@@ -1,12 +1,16 @@
1
1
  import React from 'react';
2
+ import type { IconProps } from '@atlaskit/icon/types';
2
3
  interface Props {
3
4
  title: string;
4
5
  icon: JSX.Element;
6
+ newIcon: React.ComponentType<IconProps>;
7
+ iconLabel: string;
8
+ iconSize?: 'small' | undefined;
5
9
  keymapDescription: string;
6
10
  onClick: (ref: React.RefObject<HTMLButtonElement>) => void;
7
11
  disabled?: boolean;
8
12
  isPressed?: boolean;
9
- appearance?: 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
13
+ appearance?: 'default' | 'primary' | 'subtle';
10
14
  }
11
15
  export declare class FindReplaceTooltipButton extends React.PureComponent<Props> {
12
16
  private buttonRef;
@@ -1,12 +1,16 @@
1
1
  import React from 'react';
2
+ import type { IconProps } from '@atlaskit/icon/types';
2
3
  interface Props {
3
4
  title: string;
4
5
  icon: JSX.Element;
6
+ newIcon: React.ComponentType<IconProps>;
7
+ iconLabel: string;
8
+ iconSize?: 'small' | undefined;
5
9
  keymapDescription: string;
6
10
  onClick: (ref: React.RefObject<HTMLButtonElement>) => void;
7
11
  disabled?: boolean;
8
12
  isPressed?: boolean;
9
- appearance?: 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
13
+ appearance?: 'default' | 'primary' | 'subtle';
10
14
  }
11
15
  export declare class FindReplaceTooltipButton extends React.PureComponent<Props> {
12
16
  private buttonRef;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,9 +43,10 @@
43
43
  "@atlaskit/form": "^9.0.5",
44
44
  "@atlaskit/icon": "^22.0.0",
45
45
  "@atlaskit/platform-feature-flags": "^0.2.0",
46
+ "@atlaskit/primitives": "^2.0.0",
46
47
  "@atlaskit/textfield": "^6.0.0",
47
48
  "@atlaskit/theme": "^12.6.0",
48
- "@atlaskit/tokens": "^1.36.0",
49
+ "@atlaskit/tokens": "^1.37.0",
49
50
  "@atlaskit/tooltip": "^18.1.0",
50
51
  "@babel/runtime": "^7.0.0",
51
52
  "@emotion/react": "^11.7.1",
@@ -56,7 +57,6 @@
56
57
  "@af/visual-regression": "*",
57
58
  "@atlaskit/editor-plugin-block-type": "^3.0.0",
58
59
  "@atlaskit/editor-plugin-text-formatting": "^1.0.0",
59
- "@atlaskit/primitives": "^2.0.0",
60
60
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
61
61
  "@atlassian/feature-flags-test-utils": "^0.2.0",
62
62
  "@testing-library/react": "^12.1.5",
@@ -108,6 +108,9 @@
108
108
  "platform-feature-flags": {
109
109
  "platform.editor.a11y-find-replace": {
110
110
  "type": "boolean"
111
+ },
112
+ "platform.design-system-team.editor-new-button_jjjdo": {
113
+ "type": "boolean"
111
114
  }
112
115
  },
113
116
  "stricter": {