@instructure/ui-source-code-editor 10.16.1-pr-snapshot-1744893671793 → 10.16.1-snapshot-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 +1 -1
- package/es/SourceCodeEditor/SearchPanel.js +19 -24
- package/es/SourceCodeEditor/__new-tests__/SourceCodeEditor.test.js +3 -4
- package/es/SourceCodeEditor/index.js +11 -16
- package/lib/SourceCodeEditor/SearchPanel.js +20 -24
- package/lib/SourceCodeEditor/__new-tests__/SourceCodeEditor.test.js +4 -4
- package/lib/SourceCodeEditor/index.js +10 -15
- package/package.json +18 -18
- package/src/SourceCodeEditor/SearchPanel.tsx +2 -2
- package/src/SourceCodeEditor/__new-tests__/SourceCodeEditor.test.tsx +1 -1
- package/src/SourceCodeEditor/index.tsx +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SourceCodeEditor/index.d.ts +3 -1
- package/types/SourceCodeEditor/index.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
## [10.16.1-
|
|
6
|
+
## [10.16.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-0) (2025-04-15)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-source-code-editor
|
|
9
9
|
|
|
@@ -24,13 +24,12 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import React, { useState } from 'react';
|
|
28
28
|
import { setSearchQuery, search, findNext, findPrevious, SearchQuery, closeSearchPanel } from '@codemirror/search';
|
|
29
29
|
import { TextInput } from '@instructure/ui-text-input';
|
|
30
30
|
import { IconButton } from '@instructure/ui-buttons';
|
|
31
31
|
import { IconArrowOpenDownLine, IconArrowOpenUpLine, IconSearchLine } from '@instructure/ui-icons';
|
|
32
32
|
import ReactDOM from 'react-dom';
|
|
33
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
34
33
|
function SearchPanel({
|
|
35
34
|
view,
|
|
36
35
|
searchConfig
|
|
@@ -66,7 +65,7 @@ function SearchPanel({
|
|
|
66
65
|
handleHighlightSearch(searchQueryStr);
|
|
67
66
|
findPrevious(view);
|
|
68
67
|
};
|
|
69
|
-
return
|
|
68
|
+
return /*#__PURE__*/React.createElement(TextInput, {
|
|
70
69
|
renderLabel: "",
|
|
71
70
|
inputRef: r => {
|
|
72
71
|
setTimeout(() => r === null || r === void 0 ? void 0 : r.focus(), 0);
|
|
@@ -78,26 +77,22 @@ function SearchPanel({
|
|
|
78
77
|
onChange: handleChange,
|
|
79
78
|
onKeyDown: handleKeyDown,
|
|
80
79
|
onKeyUp: handleKeyUp,
|
|
81
|
-
renderBeforeInput: _IconSearchLine || (_IconSearchLine =
|
|
80
|
+
renderBeforeInput: _IconSearchLine || (_IconSearchLine = /*#__PURE__*/React.createElement(IconSearchLine, {
|
|
82
81
|
size: "x-small"
|
|
83
82
|
})),
|
|
84
|
-
renderAfterInput:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
screenReaderLabel: searchConfig.prevResultLabel,
|
|
98
|
-
children: _IconArrowOpenUpLine || (_IconArrowOpenUpLine = _jsx(IconArrowOpenUpLine, {}))
|
|
99
|
-
})]
|
|
100
|
-
})
|
|
83
|
+
renderAfterInput: /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(IconButton, {
|
|
84
|
+
size: "small",
|
|
85
|
+
withBorder: false,
|
|
86
|
+
withBackground: false,
|
|
87
|
+
onClick: handleFindNext,
|
|
88
|
+
screenReaderLabel: searchConfig.nextResultLabel
|
|
89
|
+
}, _IconArrowOpenDownLin || (_IconArrowOpenDownLin = /*#__PURE__*/React.createElement(IconArrowOpenDownLine, null))), /*#__PURE__*/React.createElement(IconButton, {
|
|
90
|
+
size: "small",
|
|
91
|
+
withBorder: false,
|
|
92
|
+
withBackground: false,
|
|
93
|
+
onClick: handleFindPrev,
|
|
94
|
+
screenReaderLabel: searchConfig.prevResultLabel
|
|
95
|
+
}, _IconArrowOpenUpLine || (_IconArrowOpenUpLine = /*#__PURE__*/React.createElement(IconArrowOpenUpLine, null))))
|
|
101
96
|
});
|
|
102
97
|
}
|
|
103
98
|
export default function customSearch(searchConfig) {
|
|
@@ -106,20 +101,20 @@ export default function customSearch(searchConfig) {
|
|
|
106
101
|
var _SearchPanel;
|
|
107
102
|
const dom = document.createElement('div');
|
|
108
103
|
dom.style.padding = '8px';
|
|
109
|
-
const reactVersionMajor = Number(version.split('.')[0]);
|
|
104
|
+
const reactVersionMajor = Number(React.version.split('.')[0]);
|
|
110
105
|
if (reactVersionMajor >= 18) {
|
|
111
106
|
const module = 'react-dom/client';
|
|
112
107
|
// webpack tries to evaluate imports compile time which would lead to an error on older react versions
|
|
113
108
|
// Vite errors out during build in React v16/17
|
|
114
109
|
import(/* webpackIgnore: true */ /* @vite-ignore */module).then(r => {
|
|
115
110
|
const root = r.createRoot(dom);
|
|
116
|
-
root.render(_SearchPanel || (_SearchPanel =
|
|
111
|
+
root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/React.createElement(SearchPanel, {
|
|
117
112
|
view: view,
|
|
118
113
|
searchConfig: searchConfig
|
|
119
114
|
})));
|
|
120
115
|
}).catch(e => {});
|
|
121
116
|
} else {
|
|
122
|
-
ReactDOM.render(
|
|
117
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(SearchPanel, {
|
|
123
118
|
view: view,
|
|
124
119
|
searchConfig: searchConfig
|
|
125
120
|
}), dom);
|
|
@@ -22,15 +22,14 @@ var _SourceCodeEditor, _SourceCodeEditor2;
|
|
|
22
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
import React from 'react';
|
|
26
26
|
import { render } from '@testing-library/react';
|
|
27
27
|
import SourceCodeEditor from '../index';
|
|
28
28
|
import '@testing-library/jest-dom';
|
|
29
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
30
29
|
describe('<SourceCodeEditor />', () => {
|
|
31
30
|
describe('syntax highlight', () => {
|
|
32
31
|
it('should highlight jsx code', async () => {
|
|
33
|
-
const _render = render(_SourceCodeEditor || (_SourceCodeEditor =
|
|
32
|
+
const _render = render(_SourceCodeEditor || (_SourceCodeEditor = /*#__PURE__*/React.createElement(SourceCodeEditor, {
|
|
34
33
|
label: "test",
|
|
35
34
|
language: "jsx",
|
|
36
35
|
defaultValue: "const a = 2;"
|
|
@@ -50,7 +49,7 @@ describe('<SourceCodeEditor />', () => {
|
|
|
50
49
|
});
|
|
51
50
|
it('should link editor element to label using aria-labelledby attribute', async () => {
|
|
52
51
|
var _container$querySelec;
|
|
53
|
-
const _render2 = render(_SourceCodeEditor2 || (_SourceCodeEditor2 =
|
|
52
|
+
const _render2 = render(_SourceCodeEditor2 || (_SourceCodeEditor2 = /*#__PURE__*/React.createElement(SourceCodeEditor, {
|
|
54
53
|
label: "test",
|
|
55
54
|
language: "jsx",
|
|
56
55
|
defaultValue: "const a = 2;"
|
|
@@ -25,6 +25,7 @@ var _dec, _dec2, _dec3, _dec4, _class, _SourceCodeEditor;
|
|
|
25
25
|
* SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
+
/** @jsx jsx */
|
|
28
29
|
import { Component } from 'react';
|
|
29
30
|
import { deepEqual as isEqual } from '@instructure/ui-utils';
|
|
30
31
|
import { EditorState, StateEffect } from '@codemirror/state';
|
|
@@ -48,13 +49,12 @@ import { omitProps, passthroughProps, withDeterministicId } from '@instructure/u
|
|
|
48
49
|
import { requestAnimationFrame } from '@instructure/ui-dom-utils';
|
|
49
50
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
50
51
|
import { textDirectionContextConsumer } from '@instructure/ui-i18n';
|
|
51
|
-
import { withStyle } from '@instructure/emotion';
|
|
52
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
52
53
|
import customSearch from './SearchPanel';
|
|
53
54
|
import generateStyle from './styles';
|
|
54
55
|
import generateComponentTheme from './theme';
|
|
55
56
|
import { rtlHorizontalArrowKeymap } from './customKeybinding';
|
|
56
57
|
import { propTypes, allowedProps } from './props';
|
|
57
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
58
58
|
/**
|
|
59
59
|
---
|
|
60
60
|
category: components
|
|
@@ -499,21 +499,16 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
|
|
|
499
499
|
label = _this$props6.label,
|
|
500
500
|
styles = _this$props6.styles,
|
|
501
501
|
restProps = _objectWithoutProperties(_this$props6, _excluded);
|
|
502
|
-
return
|
|
502
|
+
return jsx("div", Object.assign({
|
|
503
503
|
ref: this.handleRef,
|
|
504
|
-
css: styles === null || styles === void 0 ? void 0 : styles.codeEditor
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
ref: this.handleContainerRef,
|
|
513
|
-
css: styles === null || styles === void 0 ? void 0 : styles.codeEditorContainer
|
|
514
|
-
})]
|
|
515
|
-
})
|
|
516
|
-
});
|
|
504
|
+
css: styles === null || styles === void 0 ? void 0 : styles.codeEditor
|
|
505
|
+
}, passthroughProps(omitProps(restProps, SourceCodeEditor.allowedProps))), jsx("label", {
|
|
506
|
+
css: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
507
|
+
id: this._id
|
|
508
|
+
}, jsx(ScreenReaderContent, null, label), jsx("div", {
|
|
509
|
+
ref: this.handleContainerRef,
|
|
510
|
+
css: styles === null || styles === void 0 ? void 0 : styles.codeEditorContainer
|
|
511
|
+
})));
|
|
517
512
|
}
|
|
518
513
|
}, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.propTypes = propTypes, _SourceCodeEditor.allowedProps = allowedProps, _SourceCodeEditor.defaultProps = {
|
|
519
514
|
language: 'jsx',
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard3 = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = customSearch;
|
|
8
9
|
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
9
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _react = require("react");
|
|
11
|
+
var _react = _interopRequireWildcard3(require("react"));
|
|
11
12
|
var _search = require("@codemirror/search");
|
|
12
13
|
var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
|
|
13
14
|
var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
|
|
@@ -15,7 +16,6 @@ var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/IconArrowOpenDow
|
|
|
15
16
|
var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/IconArrowOpenUpLine.js");
|
|
16
17
|
var _IconSearchLine2 = require("@instructure/ui-icons/lib/IconSearchLine.js");
|
|
17
18
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
18
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
19
|
var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
20
20
|
/*
|
|
21
21
|
* The MIT License (MIT)
|
|
@@ -75,7 +75,7 @@ function SearchPanel({
|
|
|
75
75
|
handleHighlightSearch(searchQueryStr);
|
|
76
76
|
(0, _search.findPrevious)(view);
|
|
77
77
|
};
|
|
78
|
-
return
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(_TextInput.TextInput, {
|
|
79
79
|
renderLabel: "",
|
|
80
80
|
inputRef: r => {
|
|
81
81
|
setTimeout(() => r === null || r === void 0 ? void 0 : r.focus(), 0);
|
|
@@ -87,26 +87,22 @@ function SearchPanel({
|
|
|
87
87
|
onChange: handleChange,
|
|
88
88
|
onKeyDown: handleKeyDown,
|
|
89
89
|
onKeyUp: handleKeyUp,
|
|
90
|
-
renderBeforeInput: _IconSearchLine || (_IconSearchLine =
|
|
90
|
+
renderBeforeInput: _IconSearchLine || (_IconSearchLine = /*#__PURE__*/_react.default.createElement(_IconSearchLine2.IconSearchLine, {
|
|
91
91
|
size: "x-small"
|
|
92
92
|
})),
|
|
93
|
-
renderAfterInput:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
screenReaderLabel: searchConfig.prevResultLabel,
|
|
107
|
-
children: _IconArrowOpenUpLine || (_IconArrowOpenUpLine = (0, _jsxRuntime.jsx)(_IconArrowOpenUpLine2.IconArrowOpenUpLine, {}))
|
|
108
|
-
})]
|
|
109
|
-
})
|
|
93
|
+
renderAfterInput: /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
|
|
94
|
+
size: "small",
|
|
95
|
+
withBorder: false,
|
|
96
|
+
withBackground: false,
|
|
97
|
+
onClick: handleFindNext,
|
|
98
|
+
screenReaderLabel: searchConfig.nextResultLabel
|
|
99
|
+
}, _IconArrowOpenDownLin || (_IconArrowOpenDownLin = /*#__PURE__*/_react.default.createElement(_IconArrowOpenDownLine.IconArrowOpenDownLine, null))), /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, {
|
|
100
|
+
size: "small",
|
|
101
|
+
withBorder: false,
|
|
102
|
+
withBackground: false,
|
|
103
|
+
onClick: handleFindPrev,
|
|
104
|
+
screenReaderLabel: searchConfig.prevResultLabel
|
|
105
|
+
}, _IconArrowOpenUpLine || (_IconArrowOpenUpLine = /*#__PURE__*/_react.default.createElement(_IconArrowOpenUpLine2.IconArrowOpenUpLine, null))))
|
|
110
106
|
});
|
|
111
107
|
}
|
|
112
108
|
function customSearch(searchConfig) {
|
|
@@ -115,20 +111,20 @@ function customSearch(searchConfig) {
|
|
|
115
111
|
var _SearchPanel;
|
|
116
112
|
const dom = document.createElement('div');
|
|
117
113
|
dom.style.padding = '8px';
|
|
118
|
-
const reactVersionMajor = Number(_react.version.split('.')[0]);
|
|
114
|
+
const reactVersionMajor = Number(_react.default.version.split('.')[0]);
|
|
119
115
|
if (reactVersionMajor >= 18) {
|
|
120
116
|
const module = 'react-dom/client';
|
|
121
117
|
// webpack tries to evaluate imports compile time which would lead to an error on older react versions
|
|
122
118
|
// Vite errors out during build in React v16/17
|
|
123
119
|
(specifier => new Promise(r => r(`${specifier}`)).then(s => (0, _interopRequireWildcard2.default)(require(s))))(/* webpackIgnore: true */ /* @vite-ignore */module).then(r => {
|
|
124
120
|
const root = r.createRoot(dom);
|
|
125
|
-
root.render(_SearchPanel || (_SearchPanel =
|
|
121
|
+
root.render(_SearchPanel || (_SearchPanel = /*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
126
122
|
view: view,
|
|
127
123
|
searchConfig: searchConfig
|
|
128
124
|
})));
|
|
129
125
|
}).catch(e => {});
|
|
130
126
|
} else {
|
|
131
|
-
_reactDom.default.render(
|
|
127
|
+
_reactDom.default.render(/*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
132
128
|
view: view,
|
|
133
129
|
searchConfig: searchConfig
|
|
134
130
|
}), dom);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _react = require("
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
5
6
|
var _index = _interopRequireDefault(require("../index"));
|
|
6
7
|
require("@testing-library/jest-dom");
|
|
7
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
8
8
|
var _SourceCodeEditor, _SourceCodeEditor2;
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -32,7 +32,7 @@ var _SourceCodeEditor, _SourceCodeEditor2;
|
|
|
32
32
|
describe('<SourceCodeEditor />', () => {
|
|
33
33
|
describe('syntax highlight', () => {
|
|
34
34
|
it('should highlight jsx code', async () => {
|
|
35
|
-
const _render = (0,
|
|
35
|
+
const _render = (0, _react2.render)(_SourceCodeEditor || (_SourceCodeEditor = /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
36
36
|
label: "test",
|
|
37
37
|
language: "jsx",
|
|
38
38
|
defaultValue: "const a = 2;"
|
|
@@ -52,7 +52,7 @@ describe('<SourceCodeEditor />', () => {
|
|
|
52
52
|
});
|
|
53
53
|
it('should link editor element to label using aria-labelledby attribute', async () => {
|
|
54
54
|
var _container$querySelec;
|
|
55
|
-
const _render2 = (0,
|
|
55
|
+
const _render2 = (0, _react2.render)(_SourceCodeEditor2 || (_SourceCodeEditor2 = /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
56
56
|
label: "test",
|
|
57
57
|
language: "jsx",
|
|
58
58
|
defaultValue: "const a = 2;"
|
|
@@ -35,7 +35,6 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
35
35
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
36
36
|
var _customKeybinding = require("./customKeybinding");
|
|
37
37
|
var _props = require("./props");
|
|
38
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
39
38
|
const _excluded = ["label", "styles"];
|
|
40
39
|
var _dec, _dec2, _dec3, _dec4, _class, _SourceCodeEditor;
|
|
41
40
|
/*
|
|
@@ -61,6 +60,7 @@ var _dec, _dec2, _dec3, _dec4, _class, _SourceCodeEditor;
|
|
|
61
60
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
62
61
|
* SOFTWARE.
|
|
63
62
|
*/
|
|
63
|
+
/** @jsx jsx */
|
|
64
64
|
// import { oneDarkTheme, oneDarkHighlightStyle } from '@codemirror/theme-one-dark'
|
|
65
65
|
/**
|
|
66
66
|
---
|
|
@@ -506,21 +506,16 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
|
|
|
506
506
|
label = _this$props6.label,
|
|
507
507
|
styles = _this$props6.styles,
|
|
508
508
|
restProps = (0, _objectWithoutProperties2.default)(_this$props6, _excluded);
|
|
509
|
-
return (0,
|
|
509
|
+
return (0, _emotion.jsx)("div", Object.assign({
|
|
510
510
|
ref: this.handleRef,
|
|
511
|
-
css: styles === null || styles === void 0 ? void 0 : styles.codeEditor
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
ref: this.handleContainerRef,
|
|
520
|
-
css: styles === null || styles === void 0 ? void 0 : styles.codeEditorContainer
|
|
521
|
-
})]
|
|
522
|
-
})
|
|
523
|
-
});
|
|
511
|
+
css: styles === null || styles === void 0 ? void 0 : styles.codeEditor
|
|
512
|
+
}, (0, _passthroughProps.passthroughProps)((0, _omitProps.omitProps)(restProps, SourceCodeEditor.allowedProps))), (0, _emotion.jsx)("label", {
|
|
513
|
+
css: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
514
|
+
id: this._id
|
|
515
|
+
}, (0, _emotion.jsx)(_ScreenReaderContent.ScreenReaderContent, null, label), (0, _emotion.jsx)("div", {
|
|
516
|
+
ref: this.handleContainerRef,
|
|
517
|
+
css: styles === null || styles === void 0 ? void 0 : styles.codeEditorContainer
|
|
518
|
+
})));
|
|
524
519
|
}
|
|
525
520
|
}, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.propTypes = _props.propTypes, _SourceCodeEditor.allowedProps = _props.allowedProps, _SourceCodeEditor.defaultProps = {
|
|
526
521
|
language: 'jsx',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-source-code-editor",
|
|
3
|
-
"version": "10.16.1-
|
|
3
|
+
"version": "10.16.1-snapshot-0",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "10.16.1-
|
|
27
|
-
"@instructure/ui-test-queries": "10.16.1-
|
|
28
|
-
"@instructure/ui-test-utils": "10.16.1-
|
|
26
|
+
"@instructure/ui-babel-preset": "10.16.1-snapshot-0",
|
|
27
|
+
"@instructure/ui-test-queries": "10.16.1-snapshot-0",
|
|
28
|
+
"@instructure/ui-test-utils": "10.16.1-snapshot-0",
|
|
29
29
|
"@testing-library/jest-dom": "^6.6.3",
|
|
30
30
|
"@testing-library/react": "^16.0.1",
|
|
31
31
|
"vitest": "^2.1.8"
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
"@codemirror/search": "^6.5.6",
|
|
46
46
|
"@codemirror/state": "^6.4.1",
|
|
47
47
|
"@codemirror/view": "^6.34.1",
|
|
48
|
-
"@instructure/emotion": "10.16.1-
|
|
49
|
-
"@instructure/shared-types": "10.16.1-
|
|
50
|
-
"@instructure/ui-a11y-content": "10.16.1-
|
|
51
|
-
"@instructure/ui-buttons": "10.16.1-
|
|
52
|
-
"@instructure/ui-dom-utils": "10.16.1-
|
|
53
|
-
"@instructure/ui-i18n": "10.16.1-
|
|
54
|
-
"@instructure/ui-icons": "10.16.1-
|
|
55
|
-
"@instructure/ui-prop-types": "10.16.1-
|
|
56
|
-
"@instructure/ui-react-utils": "10.16.1-
|
|
57
|
-
"@instructure/ui-test-locator": "10.16.1-
|
|
58
|
-
"@instructure/ui-testable": "10.16.1-
|
|
59
|
-
"@instructure/ui-text-input": "10.16.1-
|
|
60
|
-
"@instructure/ui-themes": "10.16.1-
|
|
61
|
-
"@instructure/ui-utils": "10.16.1-
|
|
48
|
+
"@instructure/emotion": "10.16.1-snapshot-0",
|
|
49
|
+
"@instructure/shared-types": "10.16.1-snapshot-0",
|
|
50
|
+
"@instructure/ui-a11y-content": "10.16.1-snapshot-0",
|
|
51
|
+
"@instructure/ui-buttons": "10.16.1-snapshot-0",
|
|
52
|
+
"@instructure/ui-dom-utils": "10.16.1-snapshot-0",
|
|
53
|
+
"@instructure/ui-i18n": "10.16.1-snapshot-0",
|
|
54
|
+
"@instructure/ui-icons": "10.16.1-snapshot-0",
|
|
55
|
+
"@instructure/ui-prop-types": "10.16.1-snapshot-0",
|
|
56
|
+
"@instructure/ui-react-utils": "10.16.1-snapshot-0",
|
|
57
|
+
"@instructure/ui-test-locator": "10.16.1-snapshot-0",
|
|
58
|
+
"@instructure/ui-testable": "10.16.1-snapshot-0",
|
|
59
|
+
"@instructure/ui-text-input": "10.16.1-snapshot-0",
|
|
60
|
+
"@instructure/ui-themes": "10.16.1-snapshot-0",
|
|
61
|
+
"@instructure/ui-utils": "10.16.1-snapshot-0",
|
|
62
62
|
"@lezer/highlight": "1.2.1",
|
|
63
63
|
"prop-types": "^15.8.1"
|
|
64
64
|
},
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import React, { useState } from 'react'
|
|
26
26
|
import {
|
|
27
27
|
setSearchQuery,
|
|
28
28
|
search,
|
|
@@ -142,7 +142,7 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
|
|
|
142
142
|
createPanel: (view) => {
|
|
143
143
|
const dom = document.createElement('div')
|
|
144
144
|
dom.style.padding = '8px'
|
|
145
|
-
const reactVersionMajor = Number(version.split('.')[0])
|
|
145
|
+
const reactVersionMajor = Number(React.version.split('.')[0])
|
|
146
146
|
if (reactVersionMajor >= 18) {
|
|
147
147
|
const module = 'react-dom/client'
|
|
148
148
|
// webpack tries to evaluate imports compile time which would lead to an error on older react versions
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
import React from 'react'
|
|
25
25
|
import { render } from '@testing-library/react'
|
|
26
26
|
import SourceCodeEditor from '../index'
|
|
27
27
|
import '@testing-library/jest-dom'
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
/** @jsx jsx */
|
|
25
26
|
import { Component } from 'react'
|
|
26
27
|
import { deepEqual as isEqual } from '@instructure/ui-utils'
|
|
27
28
|
|
|
@@ -88,7 +89,7 @@ import type { RequestAnimationFrameType } from '@instructure/ui-dom-utils'
|
|
|
88
89
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content'
|
|
89
90
|
import { textDirectionContextConsumer } from '@instructure/ui-i18n'
|
|
90
91
|
|
|
91
|
-
import { withStyle } from '@instructure/emotion'
|
|
92
|
+
import { withStyle, jsx } from '@instructure/emotion'
|
|
92
93
|
|
|
93
94
|
import customSearch from './SearchPanel'
|
|
94
95
|
|