@instructure/ui-source-code-editor 8.53.1 → 8.53.2-snapshot-3

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,6 +3,17 @@
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
+ ## [8.53.2-snapshot-3](https://github.com/instructure/instructure-ui/compare/v8.53.1...v8.53.2-snapshot-3) (2024-02-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-source-code-editor:** make search panel react version agnostic ([f917e20](https://github.com/instructure/instructure-ui/commit/f917e20c588d93a30e0681a5c0b1a42e262f7d3e))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [8.53.1](https://github.com/instructure/instructure-ui/compare/v8.53.0...v8.53.1) (2024-02-09)
7
18
 
8
19
 
@@ -25,11 +25,16 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
25
25
  */
26
26
 
27
27
  import React, { useState } from 'react';
28
- import { createRoot } from 'react-dom/client';
29
28
  import { setSearchQuery, search, findNext, findPrevious, SearchQuery, closeSearchPanel } from '@codemirror/search';
30
29
  import { TextInput } from '@instructure/ui-text-input';
31
30
  import { IconButton } from '@instructure/ui-buttons';
32
31
  import { IconArrowOpenDownLine, IconArrowOpenUpLine, IconSearchLine } from '@instructure/ui-icons';
32
+ let reactdom;
33
+ try {
34
+ reactdom = require('react-dom/client');
35
+ } catch {
36
+ reactdom = require('react-dom');
37
+ }
33
38
  function SearchPanel({
34
39
  view,
35
40
  searchConfig
@@ -97,11 +102,18 @@ export default function customSearch(searchConfig) {
97
102
  createPanel: view => {
98
103
  const dom = document.createElement('div');
99
104
  dom.style.padding = '8px';
100
- const root = createRoot(dom);
101
- root.render( /*#__PURE__*/React.createElement(SearchPanel, {
102
- view: view,
103
- searchConfig: searchConfig
104
- }));
105
+ if ('createRoot' in reactdom) {
106
+ const root = reactdom.createRoot(dom);
107
+ root.render( /*#__PURE__*/React.createElement(SearchPanel, {
108
+ view: view,
109
+ searchConfig: searchConfig
110
+ }));
111
+ } else {
112
+ reactdom.render( /*#__PURE__*/React.createElement(SearchPanel, {
113
+ view: view,
114
+ searchConfig: searchConfig
115
+ }), dom);
116
+ }
105
117
  return {
106
118
  dom
107
119
  };
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = customSearch;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
- var _client = require("react-dom/client");
12
11
  var _search = require("@codemirror/search");
13
12
  var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
14
13
  var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
@@ -39,6 +38,12 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
39
38
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40
39
  * SOFTWARE.
41
40
  */
41
+ let reactdom;
42
+ try {
43
+ reactdom = require('react-dom/client');
44
+ } catch {
45
+ reactdom = require('react-dom');
46
+ }
42
47
  function SearchPanel({
43
48
  view,
44
49
  searchConfig
@@ -106,11 +111,18 @@ function customSearch(searchConfig) {
106
111
  createPanel: view => {
107
112
  const dom = document.createElement('div');
108
113
  dom.style.padding = '8px';
109
- const root = (0, _client.createRoot)(dom);
110
- root.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
111
- view: view,
112
- searchConfig: searchConfig
113
- }));
114
+ if ('createRoot' in reactdom) {
115
+ const root = reactdom.createRoot(dom);
116
+ root.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
117
+ view: view,
118
+ searchConfig: searchConfig
119
+ }));
120
+ } else {
121
+ reactdom.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
122
+ view: view,
123
+ searchConfig: searchConfig
124
+ }), dom);
125
+ }
114
126
  return {
115
127
  dom
116
128
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-source-code-editor",
3
- "version": "8.53.1",
3
+ "version": "8.53.2-snapshot-3",
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": "8.53.1",
27
- "@instructure/ui-test-queries": "8.53.1",
28
- "@instructure/ui-test-utils": "8.53.1",
26
+ "@instructure/ui-babel-preset": "8.53.2-snapshot-3",
27
+ "@instructure/ui-test-queries": "8.53.2-snapshot-3",
28
+ "@instructure/ui-test-utils": "8.53.2-snapshot-3",
29
29
  "@testing-library/jest-dom": "^6.1.4",
30
30
  "@testing-library/react": "^14.0.0"
31
31
  },
@@ -44,26 +44,26 @@
44
44
  "@codemirror/search": "^6.5.4",
45
45
  "@codemirror/state": "^6.3.0",
46
46
  "@codemirror/view": "^6.21.3",
47
- "@instructure/emotion": "8.53.1",
48
- "@instructure/shared-types": "8.53.1",
49
- "@instructure/ui-a11y-content": "8.53.1",
50
- "@instructure/ui-buttons": "8.53.1",
51
- "@instructure/ui-dom-utils": "8.53.1",
52
- "@instructure/ui-i18n": "8.53.1",
53
- "@instructure/ui-icons": "8.53.1",
54
- "@instructure/ui-prop-types": "8.53.1",
55
- "@instructure/ui-react-utils": "8.53.1",
56
- "@instructure/ui-test-locator": "8.53.1",
57
- "@instructure/ui-testable": "8.53.1",
58
- "@instructure/ui-text-input": "8.53.1",
59
- "@instructure/ui-themes": "8.53.1",
60
- "@instructure/ui-utils": "8.53.1",
47
+ "@instructure/emotion": "8.53.2-snapshot-3",
48
+ "@instructure/shared-types": "8.53.2-snapshot-3",
49
+ "@instructure/ui-a11y-content": "8.53.2-snapshot-3",
50
+ "@instructure/ui-buttons": "8.53.2-snapshot-3",
51
+ "@instructure/ui-dom-utils": "8.53.2-snapshot-3",
52
+ "@instructure/ui-i18n": "8.53.2-snapshot-3",
53
+ "@instructure/ui-icons": "8.53.2-snapshot-3",
54
+ "@instructure/ui-prop-types": "8.53.2-snapshot-3",
55
+ "@instructure/ui-react-utils": "8.53.2-snapshot-3",
56
+ "@instructure/ui-test-locator": "8.53.2-snapshot-3",
57
+ "@instructure/ui-testable": "8.53.2-snapshot-3",
58
+ "@instructure/ui-text-input": "8.53.2-snapshot-3",
59
+ "@instructure/ui-themes": "8.53.2-snapshot-3",
60
+ "@instructure/ui-utils": "8.53.2-snapshot-3",
61
61
  "@lezer/highlight": "1.1.6",
62
- "prop-types": "^15.8.1",
63
- "react-dom": "^18.2.0"
62
+ "prop-types": "^15.8.1"
64
63
  },
65
64
  "peerDependencies": {
66
- "react": ">=16.8 <=18"
65
+ "react": ">=16.8 <=18",
66
+ "react-dom": ">=16.8 <=18"
67
67
  },
68
68
  "publishConfig": {
69
69
  "access": "public"
@@ -23,7 +23,6 @@
23
23
  */
24
24
 
25
25
  import React, { useState } from 'react'
26
- import { createRoot } from 'react-dom/client'
27
26
  import {
28
27
  setSearchQuery,
29
28
  search,
@@ -41,6 +40,13 @@ import {
41
40
  IconSearchLine
42
41
  } from '@instructure/ui-icons'
43
42
 
43
+ let reactdom: any
44
+ try {
45
+ reactdom = require('react-dom/client')
46
+ } catch {
47
+ reactdom = require('react-dom')
48
+ }
49
+
44
50
  export type SearchConfig = {
45
51
  placeholder: string
46
52
  nextResultLabel: string
@@ -138,8 +144,15 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
138
144
  createPanel: (view) => {
139
145
  const dom = document.createElement('div')
140
146
  dom.style.padding = '8px'
141
- const root = createRoot(dom)
142
- root.render(<SearchPanel view={view} searchConfig={searchConfig} />)
147
+ if ('createRoot' in reactdom) {
148
+ const root = reactdom.createRoot(dom)
149
+ root.render(<SearchPanel view={view} searchConfig={searchConfig} />)
150
+ } else {
151
+ reactdom.render(
152
+ <SearchPanel view={view} searchConfig={searchConfig} />,
153
+ dom
154
+ )
155
+ }
143
156
  return { dom }
144
157
  }
145
158
  })