@atlaskit/editor-plugin-find-replace 0.1.2 → 0.3.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 +18 -0
- package/dist/cjs/styles.js +16 -3
- package/dist/cjs/ui/Find.js +100 -59
- package/dist/cjs/ui/FindReplace.js +68 -9
- package/dist/cjs/ui/FindReplaceToolbarButton.js +31 -3
- package/dist/cjs/ui/FindReplaceTooltipButton.js +6 -3
- package/dist/cjs/ui/Replace.js +194 -5
- package/dist/cjs/ui/styles.js +30 -4
- package/dist/es2019/styles.js +17 -10
- package/dist/es2019/ui/Find.js +100 -59
- package/dist/es2019/ui/FindReplace.js +61 -7
- package/dist/es2019/ui/FindReplaceToolbarButton.js +31 -3
- package/dist/es2019/ui/FindReplaceTooltipButton.js +6 -3
- package/dist/es2019/ui/Replace.js +190 -6
- package/dist/es2019/ui/styles.js +67 -3
- package/dist/esm/styles.js +17 -4
- package/dist/esm/ui/Find.js +101 -60
- package/dist/esm/ui/FindReplace.js +69 -10
- package/dist/esm/ui/FindReplaceToolbarButton.js +31 -3
- package/dist/esm/ui/FindReplaceTooltipButton.js +6 -3
- package/dist/esm/ui/Replace.js +192 -6
- package/dist/esm/ui/styles.js +32 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ui/Find.d.ts +6 -0
- package/dist/types/ui/FindReplace.d.ts +10 -0
- package/dist/types/ui/FindReplaceTooltipButton.d.ts +2 -0
- package/dist/types/ui/Replace.d.ts +19 -0
- package/dist/types/ui/styles.d.ts +10 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Find.d.ts +6 -0
- package/dist/types-ts4.5/ui/FindReplace.d.ts +10 -0
- package/dist/types-ts4.5/ui/FindReplaceTooltipButton.d.ts +2 -0
- package/dist/types-ts4.5/ui/Replace.d.ts +19 -0
- package/dist/types-ts4.5/ui/styles.d.ts +10 -0
- package/package.json +8 -5
package/dist/esm/ui/Replace.js
CHANGED
|
@@ -9,13 +9,18 @@ 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
14
|
import { defineMessages, 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 { Label, ValidMessage } from '@atlaskit/form';
|
|
18
|
+
import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
|
|
19
|
+
import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
|
|
20
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
17
21
|
import Textfield from '@atlaskit/textfield';
|
|
18
|
-
import {
|
|
22
|
+
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
23
|
+
import { NextPreviousItem, orderOneStyles, orderZeroStyles, replaceSectionButtonStyles, sectionWrapperJustified, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
|
|
19
24
|
var messages = defineMessages({
|
|
20
25
|
replaceWith: {
|
|
21
26
|
id: 'fabric.editor.replaceWith',
|
|
@@ -31,6 +36,36 @@ var messages = defineMessages({
|
|
|
31
36
|
id: 'fabric.editor.replaceAll',
|
|
32
37
|
defaultMessage: 'Replace all',
|
|
33
38
|
description: 'Replace all instances of the word or phrase throughout the entire document'
|
|
39
|
+
},
|
|
40
|
+
replaceSuccess: {
|
|
41
|
+
id: 'fabric.editor.replaceSuccess',
|
|
42
|
+
defaultMessage: '{numberOfMatches} {matchPluralSingularNoun} replaced',
|
|
43
|
+
description: 'Text when replacement succesfully done'
|
|
44
|
+
},
|
|
45
|
+
matchSingularNoun: {
|
|
46
|
+
id: 'fabric.editor.match.singular',
|
|
47
|
+
defaultMessage: 'match',
|
|
48
|
+
description: 'Singular "Match" noun'
|
|
49
|
+
},
|
|
50
|
+
matchPluralNoun: {
|
|
51
|
+
id: 'fabric.editor.match.plural',
|
|
52
|
+
defaultMessage: 'matches',
|
|
53
|
+
description: 'Plural "Match" noun'
|
|
54
|
+
},
|
|
55
|
+
findNext: {
|
|
56
|
+
id: 'fabric.editor.findNext',
|
|
57
|
+
defaultMessage: 'Find next',
|
|
58
|
+
description: 'Locate the next occurrence of the word or phrase that was searched for'
|
|
59
|
+
},
|
|
60
|
+
findPrevious: {
|
|
61
|
+
id: 'fabric.editor.findPrevious',
|
|
62
|
+
defaultMessage: 'Find previous',
|
|
63
|
+
description: 'Locate the previous occurrence of the word or phrase that was searched for'
|
|
64
|
+
},
|
|
65
|
+
closeFindReplaceDialog: {
|
|
66
|
+
id: 'fabric.editor.closeFindReplaceDialog',
|
|
67
|
+
defaultMessage: 'Close',
|
|
68
|
+
description: 'Cancel search and close the "Find and Replace" dialog'
|
|
34
69
|
}
|
|
35
70
|
});
|
|
36
71
|
|
|
@@ -43,6 +78,8 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
43
78
|
_classCallCheck(this, Replace);
|
|
44
79
|
_this = _super.call(this, props);
|
|
45
80
|
_defineProperty(_assertThisInitialized(_this), "replaceTextfieldRef", /*#__PURE__*/React.createRef());
|
|
81
|
+
_defineProperty(_assertThisInitialized(_this), "successReplacementMessageRef", /*#__PURE__*/React.createRef());
|
|
82
|
+
_defineProperty(_assertThisInitialized(_this), "isComposing", false);
|
|
46
83
|
_defineProperty(_assertThisInitialized(_this), "skipWhileComposing", function (fn) {
|
|
47
84
|
if (_this.state.isComposing) {
|
|
48
85
|
return;
|
|
@@ -55,6 +92,14 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
55
92
|
triggerMethod: TRIGGER_METHOD.BUTTON,
|
|
56
93
|
replaceText: _this.state.replaceText
|
|
57
94
|
});
|
|
95
|
+
// for replace button replaceCount always 1;
|
|
96
|
+
var replaceCount = 1;
|
|
97
|
+
_this.triggerSuccessReplacementMessageUpdate(replaceCount);
|
|
98
|
+
_this.setState({
|
|
99
|
+
isHelperMessageVisible: true,
|
|
100
|
+
replaceCount: replaceCount
|
|
101
|
+
});
|
|
102
|
+
_this.props.setFindTyped(false);
|
|
58
103
|
});
|
|
59
104
|
});
|
|
60
105
|
_defineProperty(_assertThisInitialized(_this), "handleReplaceChange", function (event) {
|
|
@@ -93,6 +138,14 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
93
138
|
_this.props.onReplaceAll({
|
|
94
139
|
replaceText: _this.state.replaceText
|
|
95
140
|
});
|
|
141
|
+
_this.setState({
|
|
142
|
+
isHelperMessageVisible: true
|
|
143
|
+
});
|
|
144
|
+
_this.triggerSuccessReplacementMessageUpdate(_this.props.count.total);
|
|
145
|
+
_this.setState({
|
|
146
|
+
replaceCount: _this.props.count.total
|
|
147
|
+
});
|
|
148
|
+
_this.props.setFindTyped(false);
|
|
96
149
|
});
|
|
97
150
|
});
|
|
98
151
|
_defineProperty(_assertThisInitialized(_this), "handleCompositionStart", function () {
|
|
@@ -107,15 +160,49 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
107
160
|
// type for React.CompositionEvent doesn't set type for target correctly
|
|
108
161
|
_this.updateReplaceValue(event.target.value);
|
|
109
162
|
});
|
|
163
|
+
_defineProperty(_assertThisInitialized(_this), "clearSearch", function () {
|
|
164
|
+
_this.props.onCancel({
|
|
165
|
+
triggerMethod: TRIGGER_METHOD.BUTTON
|
|
166
|
+
});
|
|
167
|
+
_this.props.focusToolbarButton && _this.props.focusToolbarButton();
|
|
168
|
+
});
|
|
169
|
+
_defineProperty(_assertThisInitialized(_this), "handleFindNextClick", function () {
|
|
170
|
+
if (_this.isComposing) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
_this.props.onFindNext({
|
|
174
|
+
triggerMethod: TRIGGER_METHOD.BUTTON
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
_defineProperty(_assertThisInitialized(_this), "handleFindPrevClick", function () {
|
|
178
|
+
if (_this.isComposing) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
_this.props.onFindPrev({
|
|
182
|
+
triggerMethod: TRIGGER_METHOD.BUTTON
|
|
183
|
+
});
|
|
184
|
+
});
|
|
110
185
|
var _replaceText = props.replaceText,
|
|
111
186
|
formatMessage = props.intl.formatMessage;
|
|
112
187
|
_this.state = {
|
|
113
188
|
replaceText: _replaceText || '',
|
|
114
|
-
isComposing: false
|
|
189
|
+
isComposing: false,
|
|
190
|
+
isHelperMessageVisible: false,
|
|
191
|
+
fakeSuccessReplacementMessageUpdate: false,
|
|
192
|
+
replaceCount: 0
|
|
115
193
|
};
|
|
116
194
|
_this.replaceWith = formatMessage(messages.replaceWith);
|
|
117
195
|
_this.replace = formatMessage(messages.replace);
|
|
118
196
|
_this.replaceAll = formatMessage(messages.replaceAll);
|
|
197
|
+
_this.findNext = formatMessage(messages.findNext);
|
|
198
|
+
_this.findPrevious = formatMessage(messages.findPrevious);
|
|
199
|
+
_this.findNextIcon = jsx(ChevronDownIcon, {
|
|
200
|
+
label: _this.findNext
|
|
201
|
+
});
|
|
202
|
+
_this.findPrevIcon = jsx(ChevronUpIcon, {
|
|
203
|
+
label: _this.findPrevious
|
|
204
|
+
});
|
|
205
|
+
_this.closeFindReplaceDialog = formatMessage(messages.closeFindReplaceDialog);
|
|
119
206
|
return _this;
|
|
120
207
|
}
|
|
121
208
|
_createClass(Replace, [{
|
|
@@ -134,13 +221,112 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
134
221
|
isComposing: false
|
|
135
222
|
});
|
|
136
223
|
}
|
|
224
|
+
if (getBooleanFF('platform.editor.a11y-find-replace')) {
|
|
225
|
+
var findTextField = document.getElementById('find-text-field');
|
|
226
|
+
var replaceButton = document.getElementById('replace-button');
|
|
227
|
+
var replaceAllButton = document.getElementById('replaceAll-button');
|
|
228
|
+
if (((replaceButton === null || replaceButton === void 0 ? void 0 : replaceButton.tabIndex) === -1 || (replaceAllButton === null || replaceAllButton === void 0 ? void 0 : replaceAllButton.tabIndex) === -1) && findTextField) {
|
|
229
|
+
findTextField.focus();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}, {
|
|
234
|
+
key: "triggerSuccessReplacementMessageUpdate",
|
|
235
|
+
value: function triggerSuccessReplacementMessageUpdate(currentReplaceCount) {
|
|
236
|
+
var _this$state;
|
|
237
|
+
if (((_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.replaceCount) === currentReplaceCount) {
|
|
238
|
+
this.setState({
|
|
239
|
+
fakeSuccessReplacementMessageUpdate: !this.state.fakeSuccessReplacementMessageUpdate
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
if (this.successReplacementMessageRef && this.successReplacementMessageRef.current) {
|
|
243
|
+
var ariaLiveRegion = this.successReplacementMessageRef.current.querySelector('[aria-live="polite"]');
|
|
244
|
+
ariaLiveRegion === null || ariaLiveRegion === void 0 || ariaLiveRegion.removeAttribute('aria-live');
|
|
245
|
+
ariaLiveRegion === null || ariaLiveRegion === void 0 || ariaLiveRegion.setAttribute('aria-live', 'polite');
|
|
246
|
+
}
|
|
137
247
|
}
|
|
138
248
|
}, {
|
|
139
249
|
key: "render",
|
|
140
250
|
value: function render() {
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
|
|
251
|
+
var _this$state2 = this.state,
|
|
252
|
+
replaceText = _this$state2.replaceText,
|
|
253
|
+
isHelperMessageVisible = _this$state2.isHelperMessageVisible,
|
|
254
|
+
replaceCount = _this$state2.replaceCount;
|
|
255
|
+
var _this$props = this.props,
|
|
256
|
+
canReplace = _this$props.canReplace,
|
|
257
|
+
count = _this$props.count,
|
|
258
|
+
formatMessage = _this$props.intl.formatMessage;
|
|
259
|
+
var resultsReplace = formatMessage(messages.replaceSuccess, {
|
|
260
|
+
numberOfMatches: replaceCount,
|
|
261
|
+
matchPluralSingularNoun: replaceCount > 1 ? formatMessage(messages.matchPluralNoun) : formatMessage(messages.matchSingularNoun)
|
|
262
|
+
});
|
|
263
|
+
return getBooleanFF('platform.editor.a11y-find-replace') ? jsx(Fragment, null, jsx("div", {
|
|
264
|
+
css: [sectionWrapperStyles, sectionWrapperStylesAlternate]
|
|
265
|
+
}, jsx("div", {
|
|
266
|
+
css: textFieldWrapper
|
|
267
|
+
}, jsx(Label, {
|
|
268
|
+
htmlFor: "replace-text-field"
|
|
269
|
+
}, "Replace with"), jsx(Textfield, {
|
|
270
|
+
name: "replace",
|
|
271
|
+
id: "replace-text-field",
|
|
272
|
+
appearance: "standard",
|
|
273
|
+
defaultValue: replaceText,
|
|
274
|
+
ref: this.replaceTextfieldRef,
|
|
275
|
+
autoComplete: "off",
|
|
276
|
+
onChange: this.handleReplaceChange,
|
|
277
|
+
onKeyDown: this.handleReplaceKeyDown,
|
|
278
|
+
onCompositionStart: this.handleCompositionStart,
|
|
279
|
+
onCompositionEnd: this.handleCompositionEnd
|
|
280
|
+
}), isHelperMessageVisible && this.props.findTyped === false && jsx("div", {
|
|
281
|
+
ref: this.successReplacementMessageRef
|
|
282
|
+
}, jsx(ValidMessage, {
|
|
283
|
+
testId: "message-success-replacement"
|
|
284
|
+
},
|
|
285
|
+
/*
|
|
286
|
+
Replacement needed to trigger the SR announcement if message hasn't changed. e.g Replace button clicked twice.
|
|
287
|
+
'\u00a0' is value for  
|
|
288
|
+
*/
|
|
289
|
+
this.state.fakeSuccessReplacementMessageUpdate ? resultsReplace.replace(/ /, "\xA0") : resultsReplace)))), jsx("div", {
|
|
290
|
+
css: [sectionWrapperStyles, sectionWrapperStylesAlternate, sectionWrapperJustified]
|
|
291
|
+
}, jsx("div", {
|
|
292
|
+
css: orderOneStyles
|
|
293
|
+
}, jsx("div", {
|
|
294
|
+
css: NextPreviousItem
|
|
295
|
+
}, jsx(FindReplaceTooltipButton, {
|
|
296
|
+
title: this.findNext,
|
|
297
|
+
icon: this.findNextIcon,
|
|
298
|
+
keymapDescription: 'Enter',
|
|
299
|
+
onClick: this.handleFindNextClick,
|
|
300
|
+
disabled: count.total <= 1
|
|
301
|
+
})), jsx("div", {
|
|
302
|
+
css: NextPreviousItem
|
|
303
|
+
}, jsx(FindReplaceTooltipButton, {
|
|
304
|
+
title: this.findPrevious,
|
|
305
|
+
icon: this.findPrevIcon,
|
|
306
|
+
keymapDescription: 'Shift Enter',
|
|
307
|
+
onClick: this.handleFindPrevClick,
|
|
308
|
+
disabled: count.total <= 1
|
|
309
|
+
})), jsx(Button, {
|
|
310
|
+
css: replaceSectionButtonStyles,
|
|
311
|
+
testId: this.replace,
|
|
312
|
+
id: "replace-button",
|
|
313
|
+
onClick: this.handleReplaceClick,
|
|
314
|
+
isDisabled: !canReplace
|
|
315
|
+
}, this.replace), jsx(Button, {
|
|
316
|
+
css: replaceSectionButtonStyles,
|
|
317
|
+
appearance: "primary",
|
|
318
|
+
testId: this.replaceAll,
|
|
319
|
+
id: "replaceAll-button",
|
|
320
|
+
onClick: this.handleReplaceAllClick,
|
|
321
|
+
isDisabled: !canReplace
|
|
322
|
+
}, this.replaceAll)), jsx("div", {
|
|
323
|
+
css: orderZeroStyles
|
|
324
|
+
}, jsx(Button, {
|
|
325
|
+
css: replaceSectionButtonStyles,
|
|
326
|
+
appearance: "subtle",
|
|
327
|
+
testId: this.closeFindReplaceDialog,
|
|
328
|
+
onClick: this.clearSearch
|
|
329
|
+
}, this.closeFindReplaceDialog)))) : jsx("div", {
|
|
144
330
|
css: sectionWrapperStyles
|
|
145
331
|
}, jsx(Textfield, {
|
|
146
332
|
name: "replace",
|
package/dist/esm/ui/styles.js
CHANGED
|
@@ -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 {
|
|
9
|
-
|
|
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: "
|
|
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
|
});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { FindReplacePlugin, FindReplaceToolbarButtonActionProps, FindReplaceOptions, } from './types';
|
|
1
|
+
export type { FindReplacePlugin, FindReplaceToolbarButtonActionProps, FindReplaceOptions, FindReplacePluginState, } from './types';
|
|
2
2
|
export { findReplacePlugin } from './plugin';
|
package/dist/types/ui/Find.d.ts
CHANGED
|
@@ -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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { FindReplacePlugin, FindReplaceToolbarButtonActionProps, FindReplaceOptions, } from './types';
|
|
1
|
+
export type { FindReplacePlugin, FindReplaceToolbarButtonActionProps, FindReplaceOptions, FindReplacePluginState, } from './types';
|
|
2
2
|
export { findReplacePlugin } from './plugin';
|
|
@@ -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.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "find replace plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,17 +34,18 @@
|
|
|
34
34
|
"./styles": "./src/styles.ts"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@atlaskit/button": "^17.
|
|
38
|
-
"@atlaskit/editor-common": "^77.
|
|
37
|
+
"@atlaskit/button": "^17.3.0",
|
|
38
|
+
"@atlaskit/editor-common": "^77.2.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",
|
|
46
47
|
"@atlaskit/theme": "^12.6.0",
|
|
47
|
-
"@atlaskit/tokens": "^1.
|
|
48
|
+
"@atlaskit/tokens": "^1.35.0",
|
|
48
49
|
"@atlaskit/tooltip": "^18.1.0",
|
|
49
50
|
"@babel/runtime": "^7.0.0",
|
|
50
51
|
"@emotion/react": "^11.7.1",
|
|
@@ -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": "^
|
|
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",
|