@integry/sdk 4.5.22 → 4.5.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integry/sdk",
3
- "version": "4.5.22",
3
+ "version": "4.5.24",
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",
@@ -8,7 +8,7 @@ import { isScrolledIntoView } from '@/utils/common';
8
8
  import { searchJSON } from '@/utils/searchJson';
9
9
  import { Input } from '@/components/Input';
10
10
  import { createElement } from 'preact/compat';
11
- import { cloneElement } from 'preact/compat';
11
+ import { createRoot } from 'react-dom/client';
12
12
  import { TagOptions } from '../TagOptions';
13
13
  import { ThreeDotLoader } from '../../ThreeDotLoader';
14
14
  import styles from './styles.module.scss';
@@ -214,19 +214,28 @@ const FieldDropdown = (props: FieldMenuProps) => {
214
214
  }
215
215
 
216
216
  let tagsComponentRender: any = null;
217
- let tagsComponentRenderClone: any = null;
218
217
  if (tagsComponent) {
219
218
  tagsComponentRender = createElement(tagsComponent, {
220
219
  onSelect: () => alert('Selected!'),
221
220
  });
222
-
223
- tagsComponentRenderClone = cloneElement(tagsComponentRender);
224
- // eslint-disable-next-line no-console
225
- console.log(tagsComponentRender);
226
- // eslint-disable-next-line no-console
227
- console.log(tagsComponentRenderClone);
228
221
  }
229
222
 
223
+ const PortalWrapper = () => {
224
+ const reactRoot = useRef<HTMLDivElement>(null);
225
+
226
+ useEffect(() => {
227
+ if (reactRoot.current) {
228
+ const root = createRoot(reactRoot.current);
229
+ root.render(tagsComponentRender);
230
+ }
231
+ }, []);
232
+
233
+ return html`<div ref=${reactRoot}></div>`;
234
+ };
235
+
236
+ // eslint-disable-next-line no-console
237
+ console.log(PortalWrapper);
238
+
230
239
  return html` <div
231
240
  class=${`${styles.tagMenu} ${enableSearch ? styles.tagMenuWithSearch : ''}`}
232
241
  style=${parentContainer && tagMenyStyleRef?.current
@@ -352,7 +361,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
352
361
  </div>`
353
362
  : html` <div className="${styles.mappedFieldMenu}">
354
363
  ${tagsComponent
355
- ? html`<div>${tagsComponentRenderClone}</div>`
364
+ ? html`<${PortalWrapper} />`
356
365
  : html`${Object.keys(
357
366
  !isEditable ? searchJSON(tags, searchValue) : tags,
358
367
  ).length > 0