@instructure/ui-source-code-editor 10.26.1 → 11.0.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 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.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
6
+ ## [11.0.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v11.0.0...v11.0.1-snapshot-0) (2025-10-07)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-source-code-editor
9
9
 
@@ -11,6 +11,35 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
+ # [11.0.0](https://github.com/instructure/instructure-ui/compare/v10.26.0...v11.0.0) (2025-10-06)
15
+
16
+
17
+ ### Features
18
+
19
+ * **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
20
+
21
+
22
+ ### BREAKING CHANGES
23
+
24
+ * **many:** InstUI v11 contains the following breaking changes:
25
+ - React 16 and 17 are no longer supported
26
+ - remove `PropTypes` from all packages
27
+ - remove `CodeEditor` component
28
+ - remove `@instui/theme-registry` package
29
+ - remove `@testable`, `@experimental`, `@hack` decorators
30
+ - InstUISettingsProvider's `as` prop is removed
31
+ - `canvas.use()`, `canvasHighContrast.use()` functions are removed
32
+ - `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
33
+ - `variables` field on theme objects are removed
34
+ - remove deprecated props from Table: Row's `isStacked`, Body's
35
+ `isStacked`, `hover`, and `headers`
36
+ - `Table`'s `caption` prop is now required
37
+ - `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
38
+
39
+
40
+
41
+
42
+
14
43
  # [10.26.0](https://github.com/instructure/instructure-ui/compare/v10.25.0...v10.26.0) (2025-10-01)
15
44
 
16
45
  **Note:** Version bump only for package @instructure/ui-source-code-editor
@@ -24,12 +24,12 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
24
24
  * SOFTWARE.
25
25
  */
26
26
 
27
- import { version, useState } from 'react';
27
+ import { 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
- import ReactDOM from 'react-dom';
32
+ import { createRoot } from 'react-dom/client';
33
33
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
34
34
  function SearchPanel({
35
35
  view,
@@ -103,27 +103,13 @@ function SearchPanel({
103
103
  export default function customSearch(searchConfig) {
104
104
  return searchConfig ? search({
105
105
  createPanel: view => {
106
- var _SearchPanel;
107
106
  const dom = document.createElement('div');
108
107
  dom.style.padding = '8px';
109
- const reactVersionMajor = Number(version.split('.')[0]);
110
- if (reactVersionMajor >= 18) {
111
- const module = 'react-dom/client';
112
- // webpack tries to evaluate imports compile time which would lead to an error on older react versions
113
- // Vite errors out during build in React v16/17
114
- import(/* webpackIgnore: true */ /* @vite-ignore */module).then(r => {
115
- const root = r.createRoot(dom);
116
- root.render(_SearchPanel || (_SearchPanel = _jsx(SearchPanel, {
117
- view: view,
118
- searchConfig: searchConfig
119
- })));
120
- }).catch(e => {});
121
- } else {
122
- ReactDOM.render(_jsx(SearchPanel, {
123
- view: view,
124
- searchConfig: searchConfig
125
- }), dom);
126
- }
108
+ const root = createRoot(dom);
109
+ root.render(_jsx(SearchPanel, {
110
+ view: view,
111
+ searchConfig: searchConfig
112
+ }));
127
113
  return {
128
114
  dom
129
115
  };
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  const _excluded = ["label", "styles"];
3
- var _dec, _dec2, _dec3, _dec4, _class, _SourceCodeEditor;
3
+ var _dec, _dec2, _dec3, _class, _SourceCodeEditor;
4
4
  /*
5
5
  * The MIT License (MIT)
6
6
  *
@@ -43,7 +43,6 @@ import { shell } from '@codemirror/legacy-modes/mode/shell';
43
43
  import { yaml } from '@codemirror/legacy-modes/mode/yaml';
44
44
  // import { oneDarkTheme, oneDarkHighlightStyle } from '@codemirror/theme-one-dark'
45
45
 
46
- import { testable } from '@instructure/ui-testable';
47
46
  import { omitProps, passthroughProps, withDeterministicId } from '@instructure/ui-react-utils';
48
47
  import { requestAnimationFrame } from '@instructure/ui-dom-utils';
49
48
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
@@ -53,14 +52,14 @@ import customSearch from './SearchPanel';
53
52
  import generateStyle from './styles';
54
53
  import generateComponentTheme from './theme';
55
54
  import { rtlHorizontalArrowKeymap } from './customKeybinding';
56
- import { propTypes, allowedProps } from './props';
55
+ import { allowedProps } from './props';
57
56
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
58
57
  /**
59
58
  ---
60
59
  category: components
61
60
  ---
62
61
  **/
63
- let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = textDirectionContextConsumer(), _dec4 = testable(), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = (_SourceCodeEditor = class SourceCodeEditor extends Component {
62
+ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = textDirectionContextConsumer(), _dec(_class = _dec2(_class = _dec3(_class = (_SourceCodeEditor = class SourceCodeEditor extends Component {
64
63
  addAnimationFrame(callback) {
65
64
  if (typeof callback === 'function') {
66
65
  this._raf.push(requestAnimationFrame(callback));
@@ -500,6 +499,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
500
499
  styles = _this$props6.styles,
501
500
  restProps = _objectWithoutProperties(_this$props6, _excluded);
502
501
  return _jsx("div", {
502
+ "data-cid": "SourceCodeEditor",
503
503
  ref: this.handleRef,
504
504
  css: styles === null || styles === void 0 ? void 0 : styles.codeEditor,
505
505
  ...passthroughProps(omitProps(restProps, SourceCodeEditor.allowedProps)),
@@ -515,7 +515,7 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
515
515
  })
516
516
  });
517
517
  }
518
- }, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.propTypes = propTypes, _SourceCodeEditor.allowedProps = allowedProps, _SourceCodeEditor.defaultProps = {
518
+ }, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.allowedProps = allowedProps, _SourceCodeEditor.defaultProps = {
519
519
  language: 'jsx',
520
520
  readOnly: false,
521
521
  editable: true,
@@ -531,6 +531,6 @@ let SourceCodeEditor = (_dec = withDeterministicId(), _dec2 = withStyle(generate
531
531
  indentWithTab: false,
532
532
  defaultValue: '',
533
533
  height: 'auto'
534
- }, _SourceCodeEditor)) || _class) || _class) || _class) || _class);
534
+ }, _SourceCodeEditor)) || _class) || _class) || _class);
535
535
  export default SourceCodeEditor;
536
536
  export { SourceCodeEditor };
@@ -22,39 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import PropTypes from 'prop-types';
26
- import { controllable } from '@instructure/ui-prop-types';
27
- const propTypes = {
28
- label: PropTypes.string.isRequired,
29
- language: PropTypes.oneOf(['sh', 'js', 'json', 'javascript', 'jsx', 'shell', 'css', 'html', 'markdown', 'yaml', 'yml', 'bash']),
30
- readOnly: PropTypes.bool,
31
- editable: PropTypes.bool,
32
- lineNumbers: PropTypes.bool,
33
- foldGutter: PropTypes.bool,
34
- highlightActiveLineGutter: PropTypes.bool,
35
- highlightActiveLine: PropTypes.bool,
36
- lineWrapping: PropTypes.bool,
37
- autofocus: PropTypes.bool,
38
- spellcheck: PropTypes.bool,
39
- direction: PropTypes.oneOf(['ltr', 'rtl']),
40
- rtlMoveVisually: PropTypes.bool,
41
- indentOnLoad: PropTypes.bool,
42
- indentWithTab: PropTypes.bool,
43
- indentUnit: PropTypes.string,
44
- defaultValue: PropTypes.string,
45
- value: controllable(PropTypes.string, 'onChange', 'defaultValue'),
46
- onChange: PropTypes.func,
47
- onFocus: PropTypes.func,
48
- onBlur: PropTypes.func,
49
- attachment: PropTypes.oneOf(['bottom', 'top']),
50
- height: PropTypes.string,
51
- width: PropTypes.string,
52
- // darkTheme: PropTypes.bool,
53
- elementRef: PropTypes.func,
54
- containerRef: PropTypes.func,
55
- searchConfig: PropTypes.object
56
- };
57
25
  const allowedProps = ['label', 'language', 'readOnly', 'editable', 'lineNumbers', 'foldGutter', 'highlightActiveLineGutter', 'highlightActiveLine', 'lineWrapping', 'autofocus', 'spellcheck', 'direction', 'rtlMoveVisually', 'indentOnLoad', 'indentWithTab', 'indentUnit', 'defaultValue', 'value', 'onChange', 'onFocus', 'onBlur', 'attachment', 'height', 'width',
58
26
  // 'darkTheme',
59
27
  'elementRef', 'containerRef', 'searchConfig'];
60
- export { propTypes, allowedProps };
28
+ export { allowedProps };
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = customSearch;
8
- var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
9
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
9
  var _react = require("react");
11
10
  var _search = require("@codemirror/search");
@@ -14,7 +13,7 @@ var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
14
13
  var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/IconArrowOpenDownLine.js");
15
14
  var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/IconArrowOpenUpLine.js");
16
15
  var _IconSearchLine2 = require("@instructure/ui-icons/lib/IconSearchLine.js");
17
- var _reactDom = _interopRequireDefault(require("react-dom"));
16
+ var _client = require("react-dom/client");
18
17
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
19
18
  var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
20
19
  /*
@@ -112,27 +111,13 @@ function SearchPanel({
112
111
  function customSearch(searchConfig) {
113
112
  return searchConfig ? (0, _search.search)({
114
113
  createPanel: view => {
115
- var _SearchPanel;
116
114
  const dom = document.createElement('div');
117
115
  dom.style.padding = '8px';
118
- const reactVersionMajor = Number(_react.version.split('.')[0]);
119
- if (reactVersionMajor >= 18) {
120
- const module = 'react-dom/client';
121
- // webpack tries to evaluate imports compile time which would lead to an error on older react versions
122
- // Vite errors out during build in React v16/17
123
- (specifier => new Promise(r => r(`${specifier}`)).then(s => (0, _interopRequireWildcard2.default)(require(s))))(/* webpackIgnore: true */ /* @vite-ignore */module).then(r => {
124
- const root = r.createRoot(dom);
125
- root.render(_SearchPanel || (_SearchPanel = (0, _jsxRuntime.jsx)(SearchPanel, {
126
- view: view,
127
- searchConfig: searchConfig
128
- })));
129
- }).catch(e => {});
130
- } else {
131
- _reactDom.default.render((0, _jsxRuntime.jsx)(SearchPanel, {
132
- view: view,
133
- searchConfig: searchConfig
134
- }), dom);
135
- }
116
+ const root = (0, _client.createRoot)(dom);
117
+ root.render((0, _jsxRuntime.jsx)(SearchPanel, {
118
+ view: view,
119
+ searchConfig: searchConfig
120
+ }));
136
121
  return {
137
122
  dom
138
123
  };
@@ -22,7 +22,6 @@ var _langMarkdown = require("@codemirror/lang-markdown");
22
22
  var _langJson = require("@codemirror/lang-json");
23
23
  var _shell = require("@codemirror/legacy-modes/mode/shell");
24
24
  var _yaml = require("@codemirror/legacy-modes/mode/yaml");
25
- var _testable = require("@instructure/ui-testable/lib/testable.js");
26
25
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
27
26
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
28
27
  var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
@@ -37,7 +36,7 @@ var _customKeybinding = require("./customKeybinding");
37
36
  var _props = require("./props");
38
37
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
39
38
  const _excluded = ["label", "styles"];
40
- var _dec, _dec2, _dec3, _dec4, _class, _SourceCodeEditor;
39
+ var _dec, _dec2, _dec3, _class, _SourceCodeEditor;
41
40
  /*
42
41
  * The MIT License (MIT)
43
42
  *
@@ -67,7 +66,7 @@ var _dec, _dec2, _dec3, _dec4, _class, _SourceCodeEditor;
67
66
  category: components
68
67
  ---
69
68
  **/
70
- let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(), _dec4 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = (_SourceCodeEditor = class SourceCodeEditor extends _react.Component {
69
+ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = _dec3(_class = (_SourceCodeEditor = class SourceCodeEditor extends _react.Component {
71
70
  addAnimationFrame(callback) {
72
71
  if (typeof callback === 'function') {
73
72
  this._raf.push((0, _requestAnimationFrame.requestAnimationFrame)(callback));
@@ -507,6 +506,7 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
507
506
  styles = _this$props6.styles,
508
507
  restProps = (0, _objectWithoutProperties2.default)(_this$props6, _excluded);
509
508
  return (0, _jsxRuntime.jsx)("div", {
509
+ "data-cid": "SourceCodeEditor",
510
510
  ref: this.handleRef,
511
511
  css: styles === null || styles === void 0 ? void 0 : styles.codeEditor,
512
512
  ...(0, _passthroughProps.passthroughProps)((0, _omitProps.omitProps)(restProps, SourceCodeEditor.allowedProps)),
@@ -522,7 +522,7 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
522
522
  })
523
523
  });
524
524
  }
525
- }, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.propTypes = _props.propTypes, _SourceCodeEditor.allowedProps = _props.allowedProps, _SourceCodeEditor.defaultProps = {
525
+ }, _SourceCodeEditor.displayName = "SourceCodeEditor", _SourceCodeEditor.componentId = 'SourceCodeEditor', _SourceCodeEditor.allowedProps = _props.allowedProps, _SourceCodeEditor.defaultProps = {
526
526
  language: 'jsx',
527
527
  readOnly: false,
528
528
  editable: true,
@@ -538,5 +538,5 @@ let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _withDeterministic
538
538
  indentWithTab: false,
539
539
  defaultValue: '',
540
540
  height: 'auto'
541
- }, _SourceCodeEditor)) || _class) || _class) || _class) || _class);
541
+ }, _SourceCodeEditor)) || _class) || _class) || _class);
542
542
  var _default = exports.default = SourceCodeEditor;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.propTypes = exports.allowedProps = void 0;
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
6
+ exports.allowedProps = void 0;
10
7
  /*
11
8
  * The MIT License (MIT)
12
9
  *
@@ -31,36 +28,6 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
31
28
  * SOFTWARE.
32
29
  */
33
30
 
34
- const propTypes = exports.propTypes = {
35
- label: _propTypes.default.string.isRequired,
36
- language: _propTypes.default.oneOf(['sh', 'js', 'json', 'javascript', 'jsx', 'shell', 'css', 'html', 'markdown', 'yaml', 'yml', 'bash']),
37
- readOnly: _propTypes.default.bool,
38
- editable: _propTypes.default.bool,
39
- lineNumbers: _propTypes.default.bool,
40
- foldGutter: _propTypes.default.bool,
41
- highlightActiveLineGutter: _propTypes.default.bool,
42
- highlightActiveLine: _propTypes.default.bool,
43
- lineWrapping: _propTypes.default.bool,
44
- autofocus: _propTypes.default.bool,
45
- spellcheck: _propTypes.default.bool,
46
- direction: _propTypes.default.oneOf(['ltr', 'rtl']),
47
- rtlMoveVisually: _propTypes.default.bool,
48
- indentOnLoad: _propTypes.default.bool,
49
- indentWithTab: _propTypes.default.bool,
50
- indentUnit: _propTypes.default.string,
51
- defaultValue: _propTypes.default.string,
52
- value: (0, _controllable.controllable)(_propTypes.default.string, 'onChange', 'defaultValue'),
53
- onChange: _propTypes.default.func,
54
- onFocus: _propTypes.default.func,
55
- onBlur: _propTypes.default.func,
56
- attachment: _propTypes.default.oneOf(['bottom', 'top']),
57
- height: _propTypes.default.string,
58
- width: _propTypes.default.string,
59
- // darkTheme: PropTypes.bool,
60
- elementRef: _propTypes.default.func,
61
- containerRef: _propTypes.default.func,
62
- searchConfig: _propTypes.default.object
63
- };
64
31
  const allowedProps = exports.allowedProps = ['label', 'language', 'readOnly', 'editable', 'lineNumbers', 'foldGutter', 'highlightActiveLineGutter', 'highlightActiveLine', 'lineWrapping', 'autofocus', 'spellcheck', 'direction', 'rtlMoveVisually', 'indentOnLoad', 'indentWithTab', 'indentUnit', 'defaultValue', 'value', 'onChange', 'onFocus', 'onBlur', 'attachment', 'height', 'width',
65
32
  // 'darkTheme',
66
33
  'elementRef', 'containerRef', 'searchConfig'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-source-code-editor",
3
- "version": "10.26.1",
3
+ "version": "11.0.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.26.1",
26
+ "@instructure/ui-babel-preset": "11.0.1-snapshot-0",
27
27
  "@testing-library/jest-dom": "^6.6.3",
28
- "@testing-library/react": "^16.0.1",
28
+ "@testing-library/react": "15.0.7",
29
29
  "@testing-library/user-event": "^14.6.1",
30
30
  "vitest": "^3.2.2"
31
31
  },
@@ -44,25 +44,22 @@
44
44
  "@codemirror/search": "^6.5.6",
45
45
  "@codemirror/state": "^6.4.1",
46
46
  "@codemirror/view": "^6.34.1",
47
- "@instructure/emotion": "10.26.1",
48
- "@instructure/shared-types": "10.26.1",
49
- "@instructure/ui-a11y-content": "10.26.1",
50
- "@instructure/ui-buttons": "10.26.1",
51
- "@instructure/ui-dom-utils": "10.26.1",
52
- "@instructure/ui-i18n": "10.26.1",
53
- "@instructure/ui-icons": "10.26.1",
54
- "@instructure/ui-prop-types": "10.26.1",
55
- "@instructure/ui-react-utils": "10.26.1",
56
- "@instructure/ui-testable": "10.26.1",
57
- "@instructure/ui-text-input": "10.26.1",
58
- "@instructure/ui-themes": "10.26.1",
59
- "@instructure/ui-utils": "10.26.1",
60
- "@lezer/highlight": "1.2.1",
61
- "prop-types": "^15.8.1"
47
+ "@instructure/emotion": "11.0.1-snapshot-0",
48
+ "@instructure/shared-types": "11.0.1-snapshot-0",
49
+ "@instructure/ui-a11y-content": "11.0.1-snapshot-0",
50
+ "@instructure/ui-buttons": "11.0.1-snapshot-0",
51
+ "@instructure/ui-dom-utils": "11.0.1-snapshot-0",
52
+ "@instructure/ui-i18n": "11.0.1-snapshot-0",
53
+ "@instructure/ui-icons": "11.0.1-snapshot-0",
54
+ "@instructure/ui-react-utils": "11.0.1-snapshot-0",
55
+ "@instructure/ui-text-input": "11.0.1-snapshot-0",
56
+ "@instructure/ui-themes": "11.0.1-snapshot-0",
57
+ "@instructure/ui-utils": "11.0.1-snapshot-0",
58
+ "@lezer/highlight": "1.2.1"
62
59
  },
63
60
  "peerDependencies": {
64
- "react": ">=16.14 <=18",
65
- "react-dom": ">=16.14 <=18"
61
+ "react": ">=18 <=19",
62
+ "react-dom": ">=18 <=19"
66
63
  },
67
64
  "publishConfig": {
68
65
  "access": "public"
@@ -4,22 +4,6 @@ describes: CodeEditor
4
4
 
5
5
  A wrapper around the popular [CodeMirror](https://codemirror.net/) code editor component. CodeMirror provides a text input field with features like line gutters, syntax highlighting, and autocompletion.
6
6
 
7
- ```javascript
8
- ---
9
- type: embed
10
- ---
11
- <ToggleBlockquote
12
- summary="Upgrade from CodeEditor!"
13
- >
14
- <ToggleBlockquote.Paragraph>
15
- If you are currently using our <Link href="/#CodeEditor">CodeEditor</Link> component, we suggest upgrading to SourceCodeEditor, because it has many more features and is way more accessible.
16
- </ToggleBlockquote.Paragraph>
17
- <ToggleBlockquote.Paragraph>
18
- See the <Link href="/#CodeEditor/#migration-guide">migration guide</Link> at the bottom of the CodeEditor docs page for more info.
19
- </ToggleBlockquote.Paragraph>
20
- </ToggleBlockquote>
21
- ```
22
-
23
7
  ### Built-in features
24
8
 
25
9
  SourceCodeEditor has a lot of built-in features that makes editing code easier.
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { version, useState } from 'react'
25
+ import { useState } from 'react'
26
26
  import {
27
27
  setSearchQuery,
28
28
  search,
@@ -39,8 +39,7 @@ import {
39
39
  IconArrowOpenUpLine,
40
40
  IconSearchLine
41
41
  } from '@instructure/ui-icons'
42
-
43
- import ReactDOM from 'react-dom'
42
+ import { createRoot } from 'react-dom/client'
44
43
 
45
44
  export type SearchConfig = {
46
45
  placeholder: string
@@ -99,7 +98,7 @@ function SearchPanel({
99
98
  return (
100
99
  <TextInput
101
100
  renderLabel=""
102
- inputRef={(r) => {
101
+ inputRef={(r: HTMLInputElement | null) => {
103
102
  setTimeout(() => r?.focus(), 0)
104
103
  }}
105
104
  size="small"
@@ -142,27 +141,8 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
142
141
  createPanel: (view) => {
143
142
  const dom = document.createElement('div')
144
143
  dom.style.padding = '8px'
145
- const reactVersionMajor = Number(version.split('.')[0])
146
- if (reactVersionMajor >= 18) {
147
- const module = 'react-dom/client'
148
- // webpack tries to evaluate imports compile time which would lead to an error on older react versions
149
- // Vite errors out during build in React v16/17
150
- import(/* webpackIgnore: true */ /* @vite-ignore */ module)
151
- .then((r) => {
152
- const root = r.createRoot(dom)
153
- root.render(
154
- <SearchPanel view={view} searchConfig={searchConfig} />
155
- )
156
- })
157
- .catch((e) => {
158
- console.error(e)
159
- })
160
- } else {
161
- ReactDOM.render(
162
- <SearchPanel view={view} searchConfig={searchConfig} />,
163
- dom
164
- )
165
- }
144
+ const root = createRoot(dom)
145
+ root.render(<SearchPanel view={view} searchConfig={searchConfig} />)
166
146
  return { dom }
167
147
  }
168
148
  })
@@ -76,7 +76,6 @@ import { shell } from '@codemirror/legacy-modes/mode/shell'
76
76
  import { yaml } from '@codemirror/legacy-modes/mode/yaml'
77
77
  // import { oneDarkTheme, oneDarkHighlightStyle } from '@codemirror/theme-one-dark'
78
78
 
79
- import { testable } from '@instructure/ui-testable'
80
79
  import {
81
80
  omitProps,
82
81
  passthroughProps,
@@ -97,7 +96,7 @@ import generateComponentTheme from './theme'
97
96
 
98
97
  import { rtlHorizontalArrowKeymap } from './customKeybinding'
99
98
 
100
- import { propTypes, allowedProps } from './props'
99
+ import { allowedProps } from './props'
101
100
  import type { SourceCodeEditorProps } from './props'
102
101
 
103
102
  /**
@@ -108,11 +107,9 @@ category: components
108
107
  @withDeterministicId()
109
108
  @withStyle(generateStyle, generateComponentTheme)
110
109
  @textDirectionContextConsumer()
111
- @testable()
112
110
  class SourceCodeEditor extends Component<SourceCodeEditorProps> {
113
111
  static readonly componentId = 'SourceCodeEditor'
114
112
 
115
- static propTypes = propTypes
116
113
  static allowedProps = allowedProps
117
114
  static defaultProps = {
118
115
  language: 'jsx',
@@ -666,6 +663,7 @@ class SourceCodeEditor extends Component<SourceCodeEditorProps> {
666
663
 
667
664
  return (
668
665
  <div
666
+ data-cid="SourceCodeEditor"
669
667
  ref={this.handleRef}
670
668
  css={styles?.codeEditor}
671
669
  {...passthroughProps(
@@ -22,14 +22,9 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import PropTypes from 'prop-types'
26
-
27
25
  import type { TagStyle } from '@codemirror/language'
28
26
 
29
- import { controllable } from '@instructure/ui-prop-types'
30
-
31
27
  import type {
32
- PropValidators,
33
28
  CodeEditorTheme,
34
29
  OtherHTMLAttributes
35
30
  } from '@instructure/shared-types'
@@ -233,51 +228,6 @@ type SourceCodeEditorStyle = ComponentStyle<
233
228
  theme: StyleObject
234
229
  highlightStyle: TagStyle[]
235
230
  }
236
-
237
- const propTypes: PropValidators<PropKeys> = {
238
- label: PropTypes.string.isRequired,
239
- language: PropTypes.oneOf([
240
- 'sh',
241
- 'js',
242
- 'json',
243
- 'javascript',
244
- 'jsx',
245
- 'shell',
246
- 'css',
247
- 'html',
248
- 'markdown',
249
- 'yaml',
250
- 'yml',
251
- 'bash'
252
- ]),
253
- readOnly: PropTypes.bool,
254
- editable: PropTypes.bool,
255
- lineNumbers: PropTypes.bool,
256
- foldGutter: PropTypes.bool,
257
- highlightActiveLineGutter: PropTypes.bool,
258
- highlightActiveLine: PropTypes.bool,
259
- lineWrapping: PropTypes.bool,
260
- autofocus: PropTypes.bool,
261
- spellcheck: PropTypes.bool,
262
- direction: PropTypes.oneOf(['ltr', 'rtl']),
263
- rtlMoveVisually: PropTypes.bool,
264
- indentOnLoad: PropTypes.bool,
265
- indentWithTab: PropTypes.bool,
266
- indentUnit: PropTypes.string,
267
- defaultValue: PropTypes.string,
268
- value: controllable(PropTypes.string, 'onChange', 'defaultValue'),
269
- onChange: PropTypes.func,
270
- onFocus: PropTypes.func,
271
- onBlur: PropTypes.func,
272
- attachment: PropTypes.oneOf(['bottom', 'top']),
273
- height: PropTypes.string,
274
- width: PropTypes.string,
275
- // darkTheme: PropTypes.bool,
276
- elementRef: PropTypes.func,
277
- containerRef: PropTypes.func,
278
- searchConfig: PropTypes.object
279
- }
280
-
281
231
  const allowedProps: AllowedPropKeys = [
282
232
  'label',
283
233
  'language',
@@ -310,4 +260,4 @@ const allowedProps: AllowedPropKeys = [
310
260
  ]
311
261
 
312
262
  export type { SourceCodeEditorProps, SourceCodeEditorStyle }
313
- export { propTypes, allowedProps }
263
+ export { allowedProps }
@@ -17,9 +17,7 @@
17
17
  { "path": "../ui-a11y-content/tsconfig.build.json" },
18
18
  { "path": "../ui-dom-utils/tsconfig.build.json" },
19
19
  { "path": "../ui-i18n/tsconfig.build.json" },
20
- { "path": "../ui-prop-types/tsconfig.build.json" },
21
20
  { "path": "../ui-react-utils/tsconfig.build.json" },
22
- { "path": "../ui-testable/tsconfig.build.json" },
23
21
  { "path": "../ui-utils/tsconfig.build.json" }
24
22
  ]
25
23
  }