@instructure/ui-source-code-editor 11.7.3-snapshot-7 → 11.7.3-snapshot-26
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 +5 -2
- package/es/SourceCodeEditor/v1/SearchPanel.js +6 -11
- package/es/SourceCodeEditor/v1/index.js +104 -94
- package/es/SourceCodeEditor/v1/styles.js +8 -6
- package/es/SourceCodeEditor/v1/theme.js +17 -16
- package/es/SourceCodeEditor/v2/SearchPanel.js +6 -11
- package/es/SourceCodeEditor/v2/index.js +104 -94
- package/es/SourceCodeEditor/v2/styles.js +8 -6
- package/lib/SourceCodeEditor/v1/SearchPanel.js +9 -14
- package/lib/SourceCodeEditor/v1/index.js +104 -94
- package/lib/SourceCodeEditor/v1/styles.js +8 -6
- package/lib/SourceCodeEditor/v1/theme.js +17 -16
- package/lib/SourceCodeEditor/v2/SearchPanel.js +9 -14
- package/lib/SourceCodeEditor/v2/index.js +104 -94
- package/lib/SourceCodeEditor/v2/styles.js +8 -6
- package/package.json +14 -14
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [11.7.3-snapshot-
|
|
6
|
+
## [11.7.3-snapshot-26](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-26) (2026-05-05)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **many:** update dependencies, remove lots of Babel plugins, remove Webpack 4 support ([f916fca](https://github.com/instructure/instructure-ui/commit/f916fcafdddcb2d7de401f93e8ff92cfdfa47bba))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
3
1
|
/*
|
|
4
2
|
* The MIT License (MIT)
|
|
5
3
|
*
|
|
@@ -35,10 +33,7 @@ function SearchPanel({
|
|
|
35
33
|
view,
|
|
36
34
|
searchConfig
|
|
37
35
|
}) {
|
|
38
|
-
const
|
|
39
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
-
searchQueryStr = _useState2[0],
|
|
41
|
-
setSearchQueryStr = _useState2[1];
|
|
36
|
+
const [searchQueryStr, setSearchQueryStr] = useState('');
|
|
42
37
|
const handleChange = (_e, value) => {
|
|
43
38
|
setSearchQueryStr(value);
|
|
44
39
|
handleHighlightSearch(value);
|
|
@@ -69,7 +64,7 @@ function SearchPanel({
|
|
|
69
64
|
return _jsx(TextInput, {
|
|
70
65
|
renderLabel: "",
|
|
71
66
|
inputRef: r => {
|
|
72
|
-
setTimeout(() => r
|
|
67
|
+
setTimeout(() => r?.focus(), 0);
|
|
73
68
|
},
|
|
74
69
|
size: "small",
|
|
75
70
|
display: "inline-block",
|
|
@@ -78,9 +73,9 @@ function SearchPanel({
|
|
|
78
73
|
onChange: handleChange,
|
|
79
74
|
onKeyDown: handleKeyDown,
|
|
80
75
|
onKeyUp: handleKeyUp,
|
|
81
|
-
renderBeforeInput:
|
|
76
|
+
renderBeforeInput: _jsx(IconSearchLine, {
|
|
82
77
|
size: "x-small"
|
|
83
|
-
})
|
|
78
|
+
}),
|
|
84
79
|
renderAfterInput: _jsxs("span", {
|
|
85
80
|
children: [_jsx(IconButton, {
|
|
86
81
|
size: "small",
|
|
@@ -88,14 +83,14 @@ function SearchPanel({
|
|
|
88
83
|
withBackground: false,
|
|
89
84
|
onClick: handleFindNext,
|
|
90
85
|
screenReaderLabel: searchConfig.nextResultLabel,
|
|
91
|
-
children:
|
|
86
|
+
children: _jsx(IconArrowOpenDownLine, {})
|
|
92
87
|
}), _jsx(IconButton, {
|
|
93
88
|
size: "small",
|
|
94
89
|
withBorder: false,
|
|
95
90
|
withBackground: false,
|
|
96
91
|
onClick: handleFindPrev,
|
|
97
92
|
screenReaderLabel: searchConfig.prevResultLabel,
|
|
98
|
-
children:
|
|
93
|
+
children: _jsx(IconArrowOpenUpLine, {})
|
|
99
94
|
})]
|
|
100
95
|
})
|
|
101
96
|
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const _excluded = ["label", "styles"];
|
|
3
|
-
var _dec, _dec2, _dec3, _class, _SourceCodeEditor;
|
|
1
|
+
var _dec, _dec2, _dec3, _class;
|
|
4
2
|
/*
|
|
5
3
|
* The MIT License (MIT)
|
|
6
4
|
*
|
|
@@ -59,7 +57,51 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
59
57
|
category: components
|
|
60
58
|
---
|
|
61
59
|
**/
|
|
62
|
-
let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = textDirectionContextConsumer(), _dec(_class = _dec2(_class = _dec3(_class =
|
|
60
|
+
let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = textDirectionContextConsumer(), _dec(_class = _dec2(_class = _dec3(_class = class SourceCodeEditor extends Component {
|
|
61
|
+
static displayName = "SourceCodeEditor";
|
|
62
|
+
static componentId = 'SourceCodeEditor';
|
|
63
|
+
static allowedProps = allowedProps;
|
|
64
|
+
static defaultProps = {
|
|
65
|
+
language: 'jsx',
|
|
66
|
+
readOnly: false,
|
|
67
|
+
editable: true,
|
|
68
|
+
lineNumbers: false,
|
|
69
|
+
foldGutter: false,
|
|
70
|
+
highlightActiveLine: false,
|
|
71
|
+
highlightActiveLineGutter: false,
|
|
72
|
+
lineWrapping: false,
|
|
73
|
+
autofocus: false,
|
|
74
|
+
spellcheck: false,
|
|
75
|
+
rtlMoveVisually: true,
|
|
76
|
+
indentOnLoad: false,
|
|
77
|
+
indentWithTab: false,
|
|
78
|
+
defaultValue: '',
|
|
79
|
+
height: 'auto'
|
|
80
|
+
};
|
|
81
|
+
_id;
|
|
82
|
+
ref = null;
|
|
83
|
+
_containerRef;
|
|
84
|
+
_editorView;
|
|
85
|
+
_raf = [];
|
|
86
|
+
_newSelectionAfterValueChange;
|
|
87
|
+
handleRef = el => {
|
|
88
|
+
const {
|
|
89
|
+
elementRef
|
|
90
|
+
} = this.props;
|
|
91
|
+
this.ref = el;
|
|
92
|
+
if (typeof elementRef === 'function') {
|
|
93
|
+
elementRef(el);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
handleContainerRef = el => {
|
|
97
|
+
const {
|
|
98
|
+
containerRef
|
|
99
|
+
} = this.props;
|
|
100
|
+
this._containerRef = el || undefined;
|
|
101
|
+
if (typeof containerRef === 'function') {
|
|
102
|
+
containerRef(el);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
63
105
|
addAnimationFrame(callback) {
|
|
64
106
|
if (typeof callback === 'function') {
|
|
65
107
|
this._raf.push(requestAnimationFrame(callback));
|
|
@@ -71,21 +113,18 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
71
113
|
}
|
|
72
114
|
focus() {
|
|
73
115
|
this.addAnimationFrame(() => {
|
|
74
|
-
|
|
75
|
-
(_this$_editorView = this._editorView) === null || _this$_editorView === void 0 ? void 0 : _this$_editorView.focus();
|
|
116
|
+
this._editorView?.focus();
|
|
76
117
|
});
|
|
77
118
|
}
|
|
78
119
|
get hasFocus() {
|
|
79
|
-
|
|
80
|
-
return (_this$_editorView2 = this._editorView) === null || _this$_editorView2 === void 0 ? void 0 : _this$_editorView2.hasFocus;
|
|
120
|
+
return this._editorView?.hasFocus;
|
|
81
121
|
}
|
|
82
122
|
selectAll() {
|
|
83
123
|
if (this._editorView) {
|
|
84
124
|
this.addAnimationFrame(() => {
|
|
85
|
-
var _this$currentDocValue;
|
|
86
125
|
this.dispatchViewSelection({
|
|
87
126
|
anchor: 0,
|
|
88
|
-
head:
|
|
127
|
+
head: this.currentDocValue?.length
|
|
89
128
|
});
|
|
90
129
|
});
|
|
91
130
|
}
|
|
@@ -106,8 +145,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
106
145
|
indentSelection({
|
|
107
146
|
state: this._editorView.state,
|
|
108
147
|
dispatch: transaction => {
|
|
109
|
-
|
|
110
|
-
(_this$_editorView3 = this._editorView) === null || _this$_editorView3 === void 0 ? void 0 : _this$_editorView3.update([transaction]);
|
|
148
|
+
this._editorView?.update([transaction]);
|
|
111
149
|
}
|
|
112
150
|
});
|
|
113
151
|
}
|
|
@@ -149,10 +187,10 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
149
187
|
changes,
|
|
150
188
|
...(selection ? {
|
|
151
189
|
selection
|
|
152
|
-
} :
|
|
190
|
+
} : undefined),
|
|
153
191
|
...(userEvent ? {
|
|
154
192
|
userEvent
|
|
155
|
-
} :
|
|
193
|
+
} : undefined)
|
|
156
194
|
});
|
|
157
195
|
}
|
|
158
196
|
|
|
@@ -164,8 +202,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
164
202
|
});
|
|
165
203
|
}
|
|
166
204
|
get currentDocValue() {
|
|
167
|
-
|
|
168
|
-
return (_this$_editorView4 = this._editorView) === null || _this$_editorView4 === void 0 ? void 0 : _this$_editorView4.state.doc;
|
|
205
|
+
return this._editorView?.state.doc;
|
|
169
206
|
}
|
|
170
207
|
|
|
171
208
|
// when value is passed, the editor should be controlled
|
|
@@ -174,44 +211,16 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
174
211
|
}
|
|
175
212
|
constructor(props) {
|
|
176
213
|
super(props);
|
|
177
|
-
this._id = void 0;
|
|
178
|
-
this.ref = null;
|
|
179
|
-
this._containerRef = void 0;
|
|
180
|
-
this._editorView = void 0;
|
|
181
|
-
this._raf = [];
|
|
182
|
-
this._newSelectionAfterValueChange = void 0;
|
|
183
|
-
this.handleRef = el => {
|
|
184
|
-
const elementRef = this.props.elementRef;
|
|
185
|
-
this.ref = el;
|
|
186
|
-
if (typeof elementRef === 'function') {
|
|
187
|
-
elementRef(el);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
this.handleContainerRef = el => {
|
|
191
|
-
const containerRef = this.props.containerRef;
|
|
192
|
-
this._containerRef = el || void 0;
|
|
193
|
-
if (typeof containerRef === 'function') {
|
|
194
|
-
containerRef(el);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
this.assignAriaLabel = () => {
|
|
198
|
-
if (this._containerRef) {
|
|
199
|
-
const editorDiv = this._containerRef.querySelector('[role="textbox"]');
|
|
200
|
-
if (editorDiv) {
|
|
201
|
-
editorDiv.setAttribute('aria-labelledby', `${this._id}`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
214
|
this._id = props.deterministicId();
|
|
206
215
|
}
|
|
207
216
|
componentDidMount() {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
217
|
+
const {
|
|
218
|
+
value,
|
|
219
|
+
defaultValue,
|
|
220
|
+
autofocus,
|
|
221
|
+
indentOnLoad
|
|
222
|
+
} = this.props;
|
|
223
|
+
this.props.makeStyles?.();
|
|
215
224
|
const state = EditorState.create({
|
|
216
225
|
doc: value || defaultValue,
|
|
217
226
|
extensions: this.extensions
|
|
@@ -237,13 +246,11 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
237
246
|
this.assignAriaLabel();
|
|
238
247
|
}
|
|
239
248
|
componentWillUnmount() {
|
|
240
|
-
|
|
241
|
-
(_this$_editorView5 = this._editorView) === null || _this$_editorView5 === void 0 ? void 0 : _this$_editorView5.destroy();
|
|
249
|
+
this._editorView?.destroy();
|
|
242
250
|
this.cancelAnimationFrames();
|
|
243
251
|
}
|
|
244
252
|
componentDidUpdate(prevProps) {
|
|
245
|
-
|
|
246
|
-
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
253
|
+
this.props.makeStyles?.();
|
|
247
254
|
if (this._editorView) {
|
|
248
255
|
if (this.props.value !== prevProps.value) {
|
|
249
256
|
this.refreshEditorValue();
|
|
@@ -331,7 +338,9 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
331
338
|
return keymaps;
|
|
332
339
|
}
|
|
333
340
|
get commandKeybinding() {
|
|
334
|
-
const
|
|
341
|
+
const {
|
|
342
|
+
rtlMoveVisually
|
|
343
|
+
} = this.props;
|
|
335
344
|
if (this.direction === 'rtl' && !rtlMoveVisually) {
|
|
336
345
|
const overrideableKeys = rtlHorizontalArrowKeymap.map(binding => binding.key ? binding.key : binding.mac ? binding.mac : binding);
|
|
337
346
|
// we have to remove the binding we want to override from the original,
|
|
@@ -342,12 +351,14 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
342
351
|
return defaultKeymap;
|
|
343
352
|
}
|
|
344
353
|
get themeExtension() {
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
354
|
+
const {
|
|
355
|
+
styles
|
|
356
|
+
} = this.props;
|
|
357
|
+
if (!styles?.theme || !styles.highlightStyle) {
|
|
358
|
+
return undefined;
|
|
348
359
|
}
|
|
349
|
-
const theme = EditorView.theme(styles
|
|
350
|
-
const highlightStyle = syntaxHighlighting(HighlightStyle.define(styles
|
|
360
|
+
const theme = EditorView.theme(styles?.theme);
|
|
361
|
+
const highlightStyle = syntaxHighlighting(HighlightStyle.define(styles?.highlightStyle));
|
|
351
362
|
|
|
352
363
|
// see notes in props.ts
|
|
353
364
|
// if (darkTheme) {
|
|
@@ -358,7 +369,9 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
358
369
|
return [theme, highlightStyle];
|
|
359
370
|
}
|
|
360
371
|
get languageExtension() {
|
|
361
|
-
const
|
|
372
|
+
const {
|
|
373
|
+
language
|
|
374
|
+
} = this.props;
|
|
362
375
|
switch (language) {
|
|
363
376
|
case 'json':
|
|
364
377
|
return json();
|
|
@@ -394,9 +407,10 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
394
407
|
}
|
|
395
408
|
}
|
|
396
409
|
callOnChangeHandler(newValue) {
|
|
397
|
-
const
|
|
398
|
-
onChange
|
|
399
|
-
value
|
|
410
|
+
const {
|
|
411
|
+
onChange,
|
|
412
|
+
value
|
|
413
|
+
} = this.props;
|
|
400
414
|
this.addAnimationFrame(() => {
|
|
401
415
|
if (typeof onChange === 'function' && newValue !== value) {
|
|
402
416
|
onChange(newValue);
|
|
@@ -429,9 +443,10 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
429
443
|
});
|
|
430
444
|
}
|
|
431
445
|
get focusListenerExtension() {
|
|
432
|
-
const
|
|
433
|
-
onFocus
|
|
434
|
-
onBlur
|
|
446
|
+
const {
|
|
447
|
+
onFocus,
|
|
448
|
+
onBlur
|
|
449
|
+
} = this.props;
|
|
435
450
|
return EditorView.updateListener.of(update => {
|
|
436
451
|
if (update.focusChanged && this._editorView) {
|
|
437
452
|
if (this.hasFocus) {
|
|
@@ -465,7 +480,9 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
465
480
|
}
|
|
466
481
|
refreshEditorValue() {
|
|
467
482
|
if (!this._editorView) return;
|
|
468
|
-
const
|
|
483
|
+
const {
|
|
484
|
+
value
|
|
485
|
+
} = this.props;
|
|
469
486
|
const currentValue = this._editorView.state.doc.toString();
|
|
470
487
|
if (typeof value !== 'undefined' && currentValue !== value) {
|
|
471
488
|
let userEvent;
|
|
@@ -487,50 +504,43 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
487
504
|
selection: this._newSelectionAfterValueChange,
|
|
488
505
|
userEvent: userEvent
|
|
489
506
|
});
|
|
490
|
-
this._newSelectionAfterValueChange =
|
|
507
|
+
this._newSelectionAfterValueChange = undefined;
|
|
491
508
|
}
|
|
492
509
|
if (this.props.indentOnLoad) {
|
|
493
510
|
this.indentAll();
|
|
494
511
|
}
|
|
495
512
|
}
|
|
513
|
+
assignAriaLabel = () => {
|
|
514
|
+
if (this._containerRef) {
|
|
515
|
+
const editorDiv = this._containerRef.querySelector('[role="textbox"]');
|
|
516
|
+
if (editorDiv) {
|
|
517
|
+
editorDiv.setAttribute('aria-labelledby', `${this._id}`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
};
|
|
496
521
|
render() {
|
|
497
|
-
const
|
|
498
|
-
label
|
|
499
|
-
styles
|
|
500
|
-
restProps
|
|
522
|
+
const {
|
|
523
|
+
label,
|
|
524
|
+
styles,
|
|
525
|
+
...restProps
|
|
526
|
+
} = this.props;
|
|
501
527
|
return _jsx("div", {
|
|
502
528
|
"data-cid": "SourceCodeEditor",
|
|
503
529
|
ref: this.handleRef,
|
|
504
|
-
css: styles
|
|
530
|
+
css: styles?.codeEditor,
|
|
505
531
|
...passthroughProps(omitProps(restProps, SourceCodeEditor.allowedProps)),
|
|
506
532
|
children: _jsxs("label", {
|
|
507
|
-
css: styles
|
|
533
|
+
css: styles?.label,
|
|
508
534
|
id: this._id,
|
|
509
535
|
children: [_jsx(ScreenReaderContent, {
|
|
510
536
|
children: label
|
|
511
537
|
}), _jsx("div", {
|
|
512
538
|
ref: this.handleContainerRef,
|
|
513
|
-
css: styles
|
|
539
|
+
css: styles?.codeEditorContainer
|
|
514
540
|
})]
|
|
515
541
|
})
|
|
516
542
|
});
|
|
517
543
|
}
|
|
518
|
-
}
|
|
519
|
-
language: 'jsx',
|
|
520
|
-
readOnly: false,
|
|
521
|
-
editable: true,
|
|
522
|
-
lineNumbers: false,
|
|
523
|
-
foldGutter: false,
|
|
524
|
-
highlightActiveLine: false,
|
|
525
|
-
highlightActiveLineGutter: false,
|
|
526
|
-
lineWrapping: false,
|
|
527
|
-
autofocus: false,
|
|
528
|
-
spellcheck: false,
|
|
529
|
-
rtlMoveVisually: true,
|
|
530
|
-
indentOnLoad: false,
|
|
531
|
-
indentWithTab: false,
|
|
532
|
-
defaultValue: '',
|
|
533
|
-
height: 'auto'
|
|
534
|
-
}, _SourceCodeEditor)) || _class) || _class) || _class);
|
|
544
|
+
}) || _class) || _class) || _class);
|
|
535
545
|
export default SourceCodeEditor;
|
|
536
546
|
export { SourceCodeEditor };
|
|
@@ -33,9 +33,11 @@ import { tags } from '@lezer/highlight';
|
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const {
|
|
37
|
+
attachment,
|
|
38
|
+
height,
|
|
39
|
+
width
|
|
40
|
+
} = props;
|
|
39
41
|
const attachmentBorderRadius = {
|
|
40
42
|
top: {
|
|
41
43
|
borderBottomLeftRadius: 0,
|
|
@@ -75,9 +77,9 @@ const generateStyle = (componentTheme, props) => {
|
|
|
75
77
|
label: 'codeEditorContainer',
|
|
76
78
|
height: '100%',
|
|
77
79
|
width: '100%',
|
|
78
|
-
borderColor: componentTheme
|
|
80
|
+
borderColor: componentTheme?.borderColor,
|
|
79
81
|
borderStyle: 'solid',
|
|
80
|
-
borderWidth: componentTheme
|
|
82
|
+
borderWidth: componentTheme?.borderWidth,
|
|
81
83
|
borderRadius: componentTheme.borderRadius,
|
|
82
84
|
marginBottom: '1rem',
|
|
83
85
|
...(attachment && {
|
|
@@ -111,7 +113,7 @@ const generateStyle = (componentTheme, props) => {
|
|
|
111
113
|
// are, for some reason, drawn behind the element content, which
|
|
112
114
|
// will cause things like the active line background to cover
|
|
113
115
|
// the outline (#297).
|
|
114
|
-
outline: `${componentTheme
|
|
116
|
+
outline: `${componentTheme?.borderWidth} solid ${componentTheme?.focusBorderColor}`
|
|
115
117
|
},
|
|
116
118
|
'.cm-content': {
|
|
117
119
|
padding: `${componentTheme.verticalPadding} 0`
|
|
@@ -28,23 +28,24 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
borders
|
|
34
|
-
typography
|
|
35
|
-
spacing
|
|
31
|
+
const {
|
|
32
|
+
colors,
|
|
33
|
+
borders,
|
|
34
|
+
typography,
|
|
35
|
+
spacing
|
|
36
|
+
} = theme;
|
|
36
37
|
const componentVariables = {
|
|
37
|
-
fontFamily: typography
|
|
38
|
-
fontSize: typography
|
|
39
|
-
background: colors
|
|
40
|
-
color: colors
|
|
41
|
-
gutterBackground: colors
|
|
42
|
-
borderWidth: borders
|
|
43
|
-
borderColor: colors
|
|
44
|
-
borderRadius: borders
|
|
45
|
-
focusBorderColor: colors
|
|
46
|
-
horizontalPadding: spacing
|
|
47
|
-
verticalPadding: spacing
|
|
38
|
+
fontFamily: typography?.fontFamilyMonospace,
|
|
39
|
+
fontSize: typography?.fontSizeSmall,
|
|
40
|
+
background: colors?.contrasts?.white1010,
|
|
41
|
+
color: colors?.contrasts?.grey125125,
|
|
42
|
+
gutterBackground: colors?.contrasts?.grey1111,
|
|
43
|
+
borderWidth: borders?.widthSmall,
|
|
44
|
+
borderColor: colors?.contrasts?.grey3045,
|
|
45
|
+
borderRadius: borders?.radiusMedium,
|
|
46
|
+
focusBorderColor: colors?.contrasts?.blue4570,
|
|
47
|
+
horizontalPadding: spacing?.xSmall,
|
|
48
|
+
verticalPadding: spacing?.xxSmall
|
|
48
49
|
};
|
|
49
50
|
return {
|
|
50
51
|
...componentVariables
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
3
1
|
/*
|
|
4
2
|
* The MIT License (MIT)
|
|
5
3
|
*
|
|
@@ -35,10 +33,7 @@ function SearchPanel({
|
|
|
35
33
|
view,
|
|
36
34
|
searchConfig
|
|
37
35
|
}) {
|
|
38
|
-
const
|
|
39
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
-
searchQueryStr = _useState2[0],
|
|
41
|
-
setSearchQueryStr = _useState2[1];
|
|
36
|
+
const [searchQueryStr, setSearchQueryStr] = useState('');
|
|
42
37
|
const handleChange = (_e, value) => {
|
|
43
38
|
setSearchQueryStr(value);
|
|
44
39
|
handleHighlightSearch(value);
|
|
@@ -69,7 +64,7 @@ function SearchPanel({
|
|
|
69
64
|
return _jsx(TextInput, {
|
|
70
65
|
renderLabel: "",
|
|
71
66
|
inputRef: r => {
|
|
72
|
-
setTimeout(() => r
|
|
67
|
+
setTimeout(() => r?.focus(), 0);
|
|
73
68
|
},
|
|
74
69
|
size: "small",
|
|
75
70
|
display: "inline-block",
|
|
@@ -78,9 +73,9 @@ function SearchPanel({
|
|
|
78
73
|
onChange: handleChange,
|
|
79
74
|
onKeyDown: handleKeyDown,
|
|
80
75
|
onKeyUp: handleKeyUp,
|
|
81
|
-
renderBeforeInput:
|
|
76
|
+
renderBeforeInput: _jsx(IconSearchLine, {
|
|
82
77
|
size: "x-small"
|
|
83
|
-
})
|
|
78
|
+
}),
|
|
84
79
|
renderAfterInput: _jsxs("span", {
|
|
85
80
|
children: [_jsx(IconButton, {
|
|
86
81
|
size: "small",
|
|
@@ -88,14 +83,14 @@ function SearchPanel({
|
|
|
88
83
|
withBackground: false,
|
|
89
84
|
onClick: handleFindNext,
|
|
90
85
|
screenReaderLabel: searchConfig.nextResultLabel,
|
|
91
|
-
children:
|
|
86
|
+
children: _jsx(IconArrowOpenDownLine, {})
|
|
92
87
|
}), _jsx(IconButton, {
|
|
93
88
|
size: "small",
|
|
94
89
|
withBorder: false,
|
|
95
90
|
withBackground: false,
|
|
96
91
|
onClick: handleFindPrev,
|
|
97
92
|
screenReaderLabel: searchConfig.prevResultLabel,
|
|
98
|
-
children:
|
|
93
|
+
children: _jsx(IconArrowOpenUpLine, {})
|
|
99
94
|
})]
|
|
100
95
|
})
|
|
101
96
|
});
|