@atlaskit/editor-plugin-find-replace 0.2.0 → 0.3.1

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.
@@ -9,31 +9,19 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
9
9
  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; } }
10
10
  /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
11
11
  /** @jsx jsx */
12
- import React from 'react';
12
+ import React, { Fragment } from 'react';
13
13
  import { jsx } from '@emotion/react';
14
- import { defineMessages, injectIntl } from 'react-intl-next';
14
+ import { injectIntl } from 'react-intl-next';
15
15
  import Button from '@atlaskit/button/standard-button';
16
16
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
17
+ import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
18
+ import { Label, ValidMessage } from '@atlaskit/form';
19
+ import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
20
+ import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
21
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
17
22
  import Textfield from '@atlaskit/textfield';
18
- import { replaceSectionButtonStyles, sectionWrapperStyles } from './styles';
19
- var messages = defineMessages({
20
- replaceWith: {
21
- id: 'fabric.editor.replaceWith',
22
- defaultMessage: 'Replace with',
23
- description: 'The value that will replace the word or phrase that was searched for'
24
- },
25
- replace: {
26
- id: 'fabric.editor.replace',
27
- defaultMessage: 'Replace',
28
- description: 'Replace only the currently selected instance of the word or phrase'
29
- },
30
- replaceAll: {
31
- id: 'fabric.editor.replaceAll',
32
- defaultMessage: 'Replace all',
33
- description: 'Replace all instances of the word or phrase throughout the entire document'
34
- }
35
- });
36
-
23
+ import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
24
+ import { NextPreviousItem, orderOneStyles, orderZeroStyles, replaceSectionButtonStyles, sectionWrapperJustified, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
37
25
  // eslint-disable-next-line @repo/internal/react/no-class-components
38
26
  var Replace = /*#__PURE__*/function (_React$PureComponent) {
39
27
  _inherits(Replace, _React$PureComponent);
@@ -43,6 +31,8 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
43
31
  _classCallCheck(this, Replace);
44
32
  _this = _super.call(this, props);
45
33
  _defineProperty(_assertThisInitialized(_this), "replaceTextfieldRef", /*#__PURE__*/React.createRef());
34
+ _defineProperty(_assertThisInitialized(_this), "successReplacementMessageRef", /*#__PURE__*/React.createRef());
35
+ _defineProperty(_assertThisInitialized(_this), "isComposing", false);
46
36
  _defineProperty(_assertThisInitialized(_this), "skipWhileComposing", function (fn) {
47
37
  if (_this.state.isComposing) {
48
38
  return;
@@ -55,6 +45,14 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
55
45
  triggerMethod: TRIGGER_METHOD.BUTTON,
56
46
  replaceText: _this.state.replaceText
57
47
  });
48
+ // for replace button replaceCount always 1;
49
+ var replaceCount = 1;
50
+ _this.triggerSuccessReplacementMessageUpdate(replaceCount);
51
+ _this.setState({
52
+ isHelperMessageVisible: true,
53
+ replaceCount: replaceCount
54
+ });
55
+ _this.props.setFindTyped(false);
58
56
  });
59
57
  });
60
58
  _defineProperty(_assertThisInitialized(_this), "handleReplaceChange", function (event) {
@@ -93,6 +91,14 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
93
91
  _this.props.onReplaceAll({
94
92
  replaceText: _this.state.replaceText
95
93
  });
94
+ _this.setState({
95
+ isHelperMessageVisible: true
96
+ });
97
+ _this.triggerSuccessReplacementMessageUpdate(_this.props.count.total);
98
+ _this.setState({
99
+ replaceCount: _this.props.count.total
100
+ });
101
+ _this.props.setFindTyped(false);
96
102
  });
97
103
  });
98
104
  _defineProperty(_assertThisInitialized(_this), "handleCompositionStart", function () {
@@ -107,15 +113,49 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
107
113
  // type for React.CompositionEvent doesn't set type for target correctly
108
114
  _this.updateReplaceValue(event.target.value);
109
115
  });
116
+ _defineProperty(_assertThisInitialized(_this), "clearSearch", function () {
117
+ _this.props.onCancel({
118
+ triggerMethod: TRIGGER_METHOD.BUTTON
119
+ });
120
+ _this.props.focusToolbarButton && _this.props.focusToolbarButton();
121
+ });
122
+ _defineProperty(_assertThisInitialized(_this), "handleFindNextClick", function () {
123
+ if (_this.isComposing) {
124
+ return;
125
+ }
126
+ _this.props.onFindNext({
127
+ triggerMethod: TRIGGER_METHOD.BUTTON
128
+ });
129
+ });
130
+ _defineProperty(_assertThisInitialized(_this), "handleFindPrevClick", function () {
131
+ if (_this.isComposing) {
132
+ return;
133
+ }
134
+ _this.props.onFindPrev({
135
+ triggerMethod: TRIGGER_METHOD.BUTTON
136
+ });
137
+ });
110
138
  var _replaceText = props.replaceText,
111
139
  formatMessage = props.intl.formatMessage;
112
140
  _this.state = {
113
141
  replaceText: _replaceText || '',
114
- isComposing: false
142
+ isComposing: false,
143
+ isHelperMessageVisible: false,
144
+ fakeSuccessReplacementMessageUpdate: false,
145
+ replaceCount: 0
115
146
  };
116
147
  _this.replaceWith = formatMessage(messages.replaceWith);
117
148
  _this.replace = formatMessage(messages.replace);
118
149
  _this.replaceAll = formatMessage(messages.replaceAll);
150
+ _this.findNext = formatMessage(messages.findNext);
151
+ _this.findPrevious = formatMessage(messages.findPrevious);
152
+ _this.findNextIcon = jsx(ChevronDownIcon, {
153
+ label: _this.findNext
154
+ });
155
+ _this.findPrevIcon = jsx(ChevronUpIcon, {
156
+ label: _this.findPrevious
157
+ });
158
+ _this.closeFindReplaceDialog = formatMessage(messages.closeFindReplaceDialog);
119
159
  return _this;
120
160
  }
121
161
  _createClass(Replace, [{
@@ -134,13 +174,112 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
134
174
  isComposing: false
135
175
  });
136
176
  }
177
+ if (getBooleanFF('platform.editor.a11y-find-replace')) {
178
+ var findTextField = document.getElementById('find-text-field');
179
+ var replaceButton = document.getElementById('replace-button');
180
+ var replaceAllButton = document.getElementById('replaceAll-button');
181
+ if (((replaceButton === null || replaceButton === void 0 ? void 0 : replaceButton.tabIndex) === -1 || (replaceAllButton === null || replaceAllButton === void 0 ? void 0 : replaceAllButton.tabIndex) === -1) && findTextField) {
182
+ findTextField.focus();
183
+ }
184
+ }
185
+ }
186
+ }, {
187
+ key: "triggerSuccessReplacementMessageUpdate",
188
+ value: function triggerSuccessReplacementMessageUpdate(currentReplaceCount) {
189
+ var _this$state;
190
+ if (((_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.replaceCount) === currentReplaceCount) {
191
+ this.setState({
192
+ fakeSuccessReplacementMessageUpdate: !this.state.fakeSuccessReplacementMessageUpdate
193
+ });
194
+ }
195
+ if (this.successReplacementMessageRef && this.successReplacementMessageRef.current) {
196
+ var ariaLiveRegion = this.successReplacementMessageRef.current.querySelector('[aria-live="polite"]');
197
+ ariaLiveRegion === null || ariaLiveRegion === void 0 || ariaLiveRegion.removeAttribute('aria-live');
198
+ ariaLiveRegion === null || ariaLiveRegion === void 0 || ariaLiveRegion.setAttribute('aria-live', 'polite');
199
+ }
137
200
  }
138
201
  }, {
139
202
  key: "render",
140
203
  value: function render() {
141
- var replaceText = this.state.replaceText;
142
- var canReplace = this.props.canReplace;
143
- return jsx("div", {
204
+ var _this$state2 = this.state,
205
+ replaceText = _this$state2.replaceText,
206
+ isHelperMessageVisible = _this$state2.isHelperMessageVisible,
207
+ replaceCount = _this$state2.replaceCount;
208
+ var _this$props = this.props,
209
+ canReplace = _this$props.canReplace,
210
+ count = _this$props.count,
211
+ formatMessage = _this$props.intl.formatMessage;
212
+ var resultsReplace = formatMessage(messages.replaceSuccess, {
213
+ numberOfMatches: replaceCount,
214
+ matchPluralSingularNoun: replaceCount > 1 ? formatMessage(messages.matchPluralNoun) : formatMessage(messages.matchSingularNoun)
215
+ });
216
+ return getBooleanFF('platform.editor.a11y-find-replace') ? jsx(Fragment, null, jsx("div", {
217
+ css: [sectionWrapperStyles, sectionWrapperStylesAlternate]
218
+ }, jsx("div", {
219
+ css: textFieldWrapper
220
+ }, jsx(Label, {
221
+ htmlFor: "replace-text-field"
222
+ }, "Replace with"), jsx(Textfield, {
223
+ name: "replace",
224
+ id: "replace-text-field",
225
+ appearance: "standard",
226
+ defaultValue: replaceText,
227
+ ref: this.replaceTextfieldRef,
228
+ autoComplete: "off",
229
+ onChange: this.handleReplaceChange,
230
+ onKeyDown: this.handleReplaceKeyDown,
231
+ onCompositionStart: this.handleCompositionStart,
232
+ onCompositionEnd: this.handleCompositionEnd
233
+ }), isHelperMessageVisible && this.props.findTyped === false && jsx("div", {
234
+ ref: this.successReplacementMessageRef
235
+ }, jsx(ValidMessage, {
236
+ testId: "message-success-replacement"
237
+ },
238
+ /*
239
+ Replacement needed to trigger the SR announcement if message hasn't changed. e.g Replace button clicked twice.
240
+ '\u00a0' is value for &nbsp
241
+ */
242
+ this.state.fakeSuccessReplacementMessageUpdate ? resultsReplace.replace(/ /, "\xA0") : resultsReplace)))), jsx("div", {
243
+ css: [sectionWrapperStyles, sectionWrapperStylesAlternate, sectionWrapperJustified]
244
+ }, jsx("div", {
245
+ css: orderOneStyles
246
+ }, jsx("div", {
247
+ css: NextPreviousItem
248
+ }, jsx(FindReplaceTooltipButton, {
249
+ title: this.findNext,
250
+ icon: this.findNextIcon,
251
+ keymapDescription: 'Enter',
252
+ onClick: this.handleFindNextClick,
253
+ disabled: count.total <= 1
254
+ })), jsx("div", {
255
+ css: NextPreviousItem
256
+ }, jsx(FindReplaceTooltipButton, {
257
+ title: this.findPrevious,
258
+ icon: this.findPrevIcon,
259
+ keymapDescription: 'Shift Enter',
260
+ onClick: this.handleFindPrevClick,
261
+ disabled: count.total <= 1
262
+ })), jsx(Button, {
263
+ css: replaceSectionButtonStyles,
264
+ testId: this.replace,
265
+ id: "replace-button",
266
+ onClick: this.handleReplaceClick,
267
+ isDisabled: !canReplace
268
+ }, this.replace), jsx(Button, {
269
+ css: replaceSectionButtonStyles,
270
+ appearance: "primary",
271
+ testId: this.replaceAll,
272
+ id: "replaceAll-button",
273
+ onClick: this.handleReplaceAllClick,
274
+ isDisabled: !canReplace
275
+ }, this.replaceAll)), jsx("div", {
276
+ css: orderZeroStyles
277
+ }, jsx(Button, {
278
+ css: replaceSectionButtonStyles,
279
+ appearance: "subtle",
280
+ testId: this.closeFindReplaceDialog,
281
+ onClick: this.clearSearch
282
+ }, this.closeFindReplaceDialog)))) : jsx("div", {
144
283
  css: sectionWrapperStyles
145
284
  }, jsx(Textfield, {
146
285
  name: "replace",
@@ -1,12 +1,21 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
3
  /* eslint-disable @atlaskit/design-system/no-nested-styles */
4
4
  /* eslint-disable @repo/internal/styles/no-exported-styles */
5
5
  /** @jsx jsx */
6
6
  import { css } from '@emotion/react';
7
7
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
8
- import { N30A, N60 } from '@atlaskit/theme/colors';
9
- export var replaceSectionButtonStyles = css({
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
+ import { N30A } from '@atlaskit/theme/colors';
10
+ import { fontSize as getFontSize,
11
+ // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
12
+ gridSize as getGridSize } from '@atlaskit/theme/constants';
13
+ var fontSize = getFontSize();
14
+ var gridSize = getGridSize();
15
+ export var replaceSectionButtonStyles = getBooleanFF('platform.editor.a11y-find-replace') ? css({
16
+ marginLeft: "var(--ds-space-050, 4px)",
17
+ marginRight: "var(--ds-space-050, 2px)"
18
+ }) : css({
10
19
  marginLeft: "var(--ds-space-050, 4px)"
11
20
  });
12
21
  export var ruleStyles = css({
@@ -24,9 +33,18 @@ export var wrapperStyles = css({
24
33
  margin: "0px ".concat("var(--ds-space-050, 4px)")
25
34
  }
26
35
  });
36
+ export var wrapperPaddingStyles = css({
37
+ padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-050, 4px)")
38
+ });
27
39
  export var sectionWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n\n & > * {\n display: inline-flex;\n height: 32px;\n flex: 0 0 auto;\n }\n\n & > [data-ds--text-field--container] {\n display: flex;\n flex: 1 1 auto;\n }\n"])));
40
+ export var sectionWrapperStylesAlternate = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n padding: ", ";\n\n & > * {\n height: unset;\n }\n"])), "var(--ds-space-100, 8px)");
41
+ export var sectionWrapperJustified = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n justify-content: space-between;\n font-size: ", ";\n"])), relativeFontSizeToBase16(14));
42
+ export var textFieldWrapper = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex: 1 100%;\n flex-wrap: wrap;\n\n #find-text-field,\n #replace-text-field {\n height: ", "em;\n }\n\n label {\n font-size: ", ";\n line-height: ", "px;\n }\n"])), gridSize * 4.5 / fontSize, relativeFontSizeToBase16(14), gridSize * 2);
43
+ export var afterInputSection = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n"])));
44
+ export var matchCaseSection = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding-right: ", ";\n\n button {\n width: 20px;\n height: 20px;\n }\n"])), "var(--ds-space-100, 8px)");
45
+ export var NextPreviousItem = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding: 0px 3px;\n"])));
28
46
  export var countStyles = css({
29
- color: "".concat("var(--ds-text-subtlest, ".concat(N60, ")")),
47
+ color: "var(--ds-text-subtlest, #626F86)",
30
48
  fontSize: "".concat(relativeFontSizeToBase16(12)),
31
49
  flex: '0 0 auto',
32
50
  justifyContent: 'center',
@@ -34,6 +52,16 @@ export var countStyles = css({
34
52
  marginLeft: "var(--ds-space-050, 4px)",
35
53
  marginRight: "var(--ds-space-100, 8px)"
36
54
  });
55
+ export var countStylesAlternateStyles = css({
56
+ display: 'inline-flex',
57
+ height: '32px'
58
+ });
37
59
  export var countWrapperStyles = css({
38
60
  alignItems: 'center'
61
+ });
62
+ export var orderZeroStyles = css({
63
+ order: '0'
64
+ });
65
+ export var orderOneStyles = css({
66
+ order: '1'
39
67
  });
@@ -24,6 +24,8 @@ export type FindProps = {
24
24
  triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
25
25
  }) => void;
26
26
  onArrowDown: () => void;
27
+ setFindTyped: (value: boolean) => void;
28
+ findTyped: boolean;
27
29
  } & MatchCaseProps;
28
30
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
29
31
  findText?: string | undefined;
@@ -45,6 +47,8 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
45
47
  triggerMethod: TRIGGER_METHOD.BUTTON | TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR;
46
48
  }) => void;
47
49
  onArrowDown: () => void;
50
+ setFindTyped: (value: boolean) => void;
51
+ findTyped: boolean;
48
52
  } & MatchCaseProps & WrappedComponentProps<"intl">>> & {
49
53
  WrappedComponent: React.ComponentType<{
50
54
  findText?: string | undefined;
@@ -66,6 +70,8 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
66
70
  triggerMethod: TRIGGER_METHOD.BUTTON | TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR;
67
71
  }) => void;
68
72
  onArrowDown: () => void;
73
+ setFindTyped: (value: boolean) => void;
74
+ findTyped: boolean;
69
75
  } & MatchCaseProps & WrappedComponentProps<"intl">>;
70
76
  };
71
77
  export default _default;
@@ -30,10 +30,20 @@ export type FindReplaceProps = {
30
30
  triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
31
31
  }) => void;
32
32
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
33
+ focusToolbarButton?: () => void;
33
34
  } & MatchCaseProps;
34
35
  declare class FindReplace extends React.PureComponent<FindReplaceProps> {
35
36
  private findTextfield;
36
37
  private replaceTextfield?;
38
+ private modalRef;
39
+ constructor(props: FindReplaceProps);
40
+ componentDidMount(): void;
41
+ componentWillUnmount(): void;
42
+ handleTabNavigation: (event: KeyboardEvent) => void;
43
+ state: {
44
+ findTyped: boolean;
45
+ };
46
+ setFindTyped: (value: boolean) => void;
37
47
  setFindTextfieldRef: (findTextfieldRef: React.RefObject<HTMLInputElement>) => void;
38
48
  setReplaceTextfieldRef: (replaceTextfieldRef: React.RefObject<HTMLInputElement>) => void;
39
49
  setFocusToFind: () => void;
@@ -6,11 +6,13 @@ interface Props {
6
6
  onClick: (ref: React.RefObject<HTMLButtonElement>) => void;
7
7
  disabled?: boolean;
8
8
  isPressed?: boolean;
9
+ appearance?: 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
9
10
  }
10
11
  export declare class FindReplaceTooltipButton extends React.PureComponent<Props> {
11
12
  private buttonRef;
12
13
  static defaultProps: {
13
14
  keymapDescription: string;
15
+ appearance: string;
14
16
  };
15
17
  handleClick: () => void;
16
18
  render(): JSX.Element;
@@ -15,11 +15,30 @@ export type ReplaceProps = {
15
15
  }) => void;
16
16
  onReplaceTextfieldRefSet: (ref: React.RefObject<HTMLInputElement>) => void;
17
17
  onArrowUp: () => void;
18
+ onCancel: ({ triggerMethod, }: {
19
+ triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
20
+ }) => void;
21
+ count: {
22
+ index: number;
23
+ total: number;
24
+ };
25
+ onFindNext: ({ triggerMethod, }: {
26
+ triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
27
+ }) => void;
28
+ onFindPrev: ({ triggerMethod, }: {
29
+ triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
30
+ }) => void;
18
31
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
32
+ setFindTyped: (value: boolean) => void;
33
+ findTyped: boolean;
34
+ focusToolbarButton: () => void;
19
35
  };
20
36
  export type ReplaceState = {
21
37
  replaceText: string;
38
+ fakeSuccessReplacementMessageUpdate: boolean;
22
39
  isComposing: boolean;
40
+ isHelperMessageVisible: boolean;
41
+ replaceCount: number;
23
42
  };
24
43
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<ReplaceProps & WrappedComponentProps<"intl">>> & {
25
44
  WrappedComponent: React.ComponentType<ReplaceProps & WrappedComponentProps<"intl">>;
@@ -1,6 +1,16 @@
1
1
  export declare const replaceSectionButtonStyles: import("@emotion/react").SerializedStyles;
2
2
  export declare const ruleStyles: import("@emotion/react").SerializedStyles;
3
3
  export declare const wrapperStyles: import("@emotion/react").SerializedStyles;
4
+ export declare const wrapperPaddingStyles: import("@emotion/react").SerializedStyles;
4
5
  export declare const sectionWrapperStyles: import("@emotion/react").SerializedStyles;
6
+ export declare const sectionWrapperStylesAlternate: import("@emotion/react").SerializedStyles;
7
+ export declare const sectionWrapperJustified: import("@emotion/react").SerializedStyles;
8
+ export declare const textFieldWrapper: import("@emotion/react").SerializedStyles;
9
+ export declare const afterInputSection: import("@emotion/react").SerializedStyles;
10
+ export declare const matchCaseSection: import("@emotion/react").SerializedStyles;
11
+ export declare const NextPreviousItem: import("@emotion/react").SerializedStyles;
5
12
  export declare const countStyles: import("@emotion/react").SerializedStyles;
13
+ export declare const countStylesAlternateStyles: import("@emotion/react").SerializedStyles;
6
14
  export declare const countWrapperStyles: import("@emotion/react").SerializedStyles;
15
+ export declare const orderZeroStyles: import("@emotion/react").SerializedStyles;
16
+ export declare const orderOneStyles: import("@emotion/react").SerializedStyles;
@@ -24,6 +24,8 @@ export type FindProps = {
24
24
  triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
25
25
  }) => void;
26
26
  onArrowDown: () => void;
27
+ setFindTyped: (value: boolean) => void;
28
+ findTyped: boolean;
27
29
  } & MatchCaseProps;
28
30
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
29
31
  findText?: string | undefined;
@@ -45,6 +47,8 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
45
47
  triggerMethod: TRIGGER_METHOD.BUTTON | TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR;
46
48
  }) => void;
47
49
  onArrowDown: () => void;
50
+ setFindTyped: (value: boolean) => void;
51
+ findTyped: boolean;
48
52
  } & MatchCaseProps & WrappedComponentProps<"intl">>> & {
49
53
  WrappedComponent: React.ComponentType<{
50
54
  findText?: string | undefined;
@@ -66,6 +70,8 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
66
70
  triggerMethod: TRIGGER_METHOD.BUTTON | TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR;
67
71
  }) => void;
68
72
  onArrowDown: () => void;
73
+ setFindTyped: (value: boolean) => void;
74
+ findTyped: boolean;
69
75
  } & MatchCaseProps & WrappedComponentProps<"intl">>;
70
76
  };
71
77
  export default _default;
@@ -30,10 +30,20 @@ export type FindReplaceProps = {
30
30
  triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
31
31
  }) => void;
32
32
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
33
+ focusToolbarButton?: () => void;
33
34
  } & MatchCaseProps;
34
35
  declare class FindReplace extends React.PureComponent<FindReplaceProps> {
35
36
  private findTextfield;
36
37
  private replaceTextfield?;
38
+ private modalRef;
39
+ constructor(props: FindReplaceProps);
40
+ componentDidMount(): void;
41
+ componentWillUnmount(): void;
42
+ handleTabNavigation: (event: KeyboardEvent) => void;
43
+ state: {
44
+ findTyped: boolean;
45
+ };
46
+ setFindTyped: (value: boolean) => void;
37
47
  setFindTextfieldRef: (findTextfieldRef: React.RefObject<HTMLInputElement>) => void;
38
48
  setReplaceTextfieldRef: (replaceTextfieldRef: React.RefObject<HTMLInputElement>) => void;
39
49
  setFocusToFind: () => void;
@@ -6,11 +6,13 @@ interface Props {
6
6
  onClick: (ref: React.RefObject<HTMLButtonElement>) => void;
7
7
  disabled?: boolean;
8
8
  isPressed?: boolean;
9
+ appearance?: 'default' | 'danger' | 'link' | 'primary' | 'subtle' | 'subtle-link' | 'warning';
9
10
  }
10
11
  export declare class FindReplaceTooltipButton extends React.PureComponent<Props> {
11
12
  private buttonRef;
12
13
  static defaultProps: {
13
14
  keymapDescription: string;
15
+ appearance: string;
14
16
  };
15
17
  handleClick: () => void;
16
18
  render(): JSX.Element;
@@ -15,11 +15,30 @@ export type ReplaceProps = {
15
15
  }) => void;
16
16
  onReplaceTextfieldRefSet: (ref: React.RefObject<HTMLInputElement>) => void;
17
17
  onArrowUp: () => void;
18
+ onCancel: ({ triggerMethod, }: {
19
+ triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.BUTTON;
20
+ }) => void;
21
+ count: {
22
+ index: number;
23
+ total: number;
24
+ };
25
+ onFindNext: ({ triggerMethod, }: {
26
+ triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
27
+ }) => void;
28
+ onFindPrev: ({ triggerMethod, }: {
29
+ triggerMethod: TRIGGER_METHOD.KEYBOARD | TRIGGER_METHOD.BUTTON;
30
+ }) => void;
18
31
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
32
+ setFindTyped: (value: boolean) => void;
33
+ findTyped: boolean;
34
+ focusToolbarButton: () => void;
19
35
  };
20
36
  export type ReplaceState = {
21
37
  replaceText: string;
38
+ fakeSuccessReplacementMessageUpdate: boolean;
22
39
  isComposing: boolean;
40
+ isHelperMessageVisible: boolean;
41
+ replaceCount: number;
23
42
  };
24
43
  declare const _default: React.FC<import("react-intl-next").WithIntlProps<ReplaceProps & WrappedComponentProps<"intl">>> & {
25
44
  WrappedComponent: React.ComponentType<ReplaceProps & WrappedComponentProps<"intl">>;
@@ -1,6 +1,16 @@
1
1
  export declare const replaceSectionButtonStyles: import("@emotion/react").SerializedStyles;
2
2
  export declare const ruleStyles: import("@emotion/react").SerializedStyles;
3
3
  export declare const wrapperStyles: import("@emotion/react").SerializedStyles;
4
+ export declare const wrapperPaddingStyles: import("@emotion/react").SerializedStyles;
4
5
  export declare const sectionWrapperStyles: import("@emotion/react").SerializedStyles;
6
+ export declare const sectionWrapperStylesAlternate: import("@emotion/react").SerializedStyles;
7
+ export declare const sectionWrapperJustified: import("@emotion/react").SerializedStyles;
8
+ export declare const textFieldWrapper: import("@emotion/react").SerializedStyles;
9
+ export declare const afterInputSection: import("@emotion/react").SerializedStyles;
10
+ export declare const matchCaseSection: import("@emotion/react").SerializedStyles;
11
+ export declare const NextPreviousItem: import("@emotion/react").SerializedStyles;
5
12
  export declare const countStyles: import("@emotion/react").SerializedStyles;
13
+ export declare const countStylesAlternateStyles: import("@emotion/react").SerializedStyles;
6
14
  export declare const countWrapperStyles: import("@emotion/react").SerializedStyles;
15
+ export declare const orderZeroStyles: import("@emotion/react").SerializedStyles;
16
+ export declare const orderOneStyles: import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,12 +34,13 @@
34
34
  "./styles": "./src/styles.ts"
35
35
  },
36
36
  "dependencies": {
37
- "@atlaskit/button": "^17.2.0",
38
- "@atlaskit/editor-common": "^77.1.0",
37
+ "@atlaskit/button": "^17.3.0",
38
+ "@atlaskit/editor-common": "^77.3.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
40
40
  "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
41
41
  "@atlaskit/editor-prosemirror": "1.1.0",
42
42
  "@atlaskit/editor-shared-styles": "^2.9.0",
43
+ "@atlaskit/form": "^9.0.5",
43
44
  "@atlaskit/icon": "^22.0.0",
44
45
  "@atlaskit/platform-feature-flags": "^0.2.0",
45
46
  "@atlaskit/textfield": "^6.0.0",
@@ -52,10 +53,12 @@
52
53
  "raf-schd": "^4.0.3"
53
54
  },
54
55
  "devDependencies": {
56
+ "@af/visual-regression": "*",
55
57
  "@atlaskit/editor-plugin-block-type": "^3.0.0",
56
58
  "@atlaskit/editor-plugin-text-formatting": "^0.4.0",
57
- "@atlaskit/primitives": "^1.20.0",
59
+ "@atlaskit/primitives": "^2.0.0",
58
60
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
61
+ "@atlassian/feature-flags-test-utils": "^0.2.0",
59
62
  "@testing-library/react": "^12.1.5",
60
63
  "@testing-library/user-event": "^14.4.3",
61
64
  "mockdate": "^3.0.5",