@integry/sdk 4.5.23 → 4.5.25
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/dist/esm/index.csm.js +1778 -1778
- package/dist/umd/index.umd.js +1778 -1778
- package/integry-sdk-4.5.24.tgz +0 -0
- package/package.json +2 -1
- package/src/components/MultipurposeField/TagMenu/index.ts +24 -7
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@integry/sdk",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.25",
|
|
4
4
|
"description": "Integry SDK",
|
|
5
5
|
"main": "dist/umd/index.umd.js",
|
|
6
6
|
"module": "dist/esm/index.csm.js",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@testing-library/preact": "^2.0.1",
|
|
55
55
|
"@testing-library/user-event": "^14.6.1",
|
|
56
56
|
"@types/jest": "^26.0.23",
|
|
57
|
+
"@types/react-dom": "^19.0.4",
|
|
57
58
|
"@types/yaireo__tagify": "^4.18.0",
|
|
58
59
|
"@typescript-eslint/eslint-plugin": "^4.20.0",
|
|
59
60
|
"@typescript-eslint/parser": "^4.20.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import { NestedObject } from '@/interfaces';
|
|
4
5
|
import { html } from 'htm/preact';
|
|
5
6
|
import { createRef } from 'preact';
|
|
@@ -8,7 +9,7 @@ import { isScrolledIntoView } from '@/utils/common';
|
|
|
8
9
|
import { searchJSON } from '@/utils/searchJson';
|
|
9
10
|
import { Input } from '@/components/Input';
|
|
10
11
|
import { createElement } from 'preact/compat';
|
|
11
|
-
import {
|
|
12
|
+
import { createRoot } from 'react-dom/client';
|
|
12
13
|
import { TagOptions } from '../TagOptions';
|
|
13
14
|
import { ThreeDotLoader } from '../../ThreeDotLoader';
|
|
14
15
|
import styles from './styles.module.scss';
|
|
@@ -220,16 +221,32 @@ const FieldDropdown = (props: FieldMenuProps) => {
|
|
|
220
221
|
});
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
|
|
224
|
-
|
|
224
|
+
// This component handles rendering React components in a Preact app
|
|
225
|
+
const ReactPortal = () => {
|
|
226
|
+
const reactRootRef = useRef<HTMLDivElement | null>(null);
|
|
225
227
|
|
|
226
228
|
useEffect(() => {
|
|
227
|
-
if (
|
|
228
|
-
|
|
229
|
+
if (reactRootRef.current) {
|
|
230
|
+
// Ensure it's a valid React element
|
|
231
|
+
const reactElement = React.createElement(tagsComponent, {
|
|
232
|
+
onSelect: () => alert('Selected from React!'),
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// Render using React's createRoot
|
|
236
|
+
const root = createRoot(reactRootRef.current);
|
|
237
|
+
root.render(reactElement);
|
|
238
|
+
|
|
239
|
+
// Cleanup on unmount
|
|
240
|
+
return () => root.unmount();
|
|
229
241
|
}
|
|
242
|
+
|
|
243
|
+
// Return a no-op cleanup to satisfy ESLint
|
|
244
|
+
return () => {
|
|
245
|
+
// No cleanup needed if reactRootRef is not set
|
|
246
|
+
};
|
|
230
247
|
}, []);
|
|
231
248
|
|
|
232
|
-
return html`<div ref=${
|
|
249
|
+
return html`<div ref=${reactRootRef}></div>`;
|
|
233
250
|
};
|
|
234
251
|
|
|
235
252
|
return html` <div
|
|
@@ -357,7 +374,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
|
|
|
357
374
|
</div>`
|
|
358
375
|
: html` <div className="${styles.mappedFieldMenu}">
|
|
359
376
|
${tagsComponent
|
|
360
|
-
? html`<${
|
|
377
|
+
? html`<${ReactPortal} />`
|
|
361
378
|
: html`${Object.keys(
|
|
362
379
|
!isEditable ? searchJSON(tags, searchValue) : tags,
|
|
363
380
|
).length > 0
|