@integry/sdk 4.5.22 → 4.5.23

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.23",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -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 { createPortal } from 'preact/compat';
12
12
  import { TagOptions } from '../TagOptions';
13
13
  import { ThreeDotLoader } from '../../ThreeDotLoader';
14
14
  import styles from './styles.module.scss';
@@ -214,19 +214,24 @@ 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 containerRef = useRef<HTMLDivElement>(null);
225
+
226
+ useEffect(() => {
227
+ if (containerRef.current) {
228
+ createPortal(tagsComponentRender, containerRef.current);
229
+ }
230
+ }, []);
231
+
232
+ return html`<div ref=${containerRef}></div>`;
233
+ };
234
+
230
235
  return html` <div
231
236
  class=${`${styles.tagMenu} ${enableSearch ? styles.tagMenuWithSearch : ''}`}
232
237
  style=${parentContainer && tagMenyStyleRef?.current
@@ -352,7 +357,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
352
357
  </div>`
353
358
  : html` <div className="${styles.mappedFieldMenu}">
354
359
  ${tagsComponent
355
- ? html`<div>${tagsComponentRenderClone}</div>`
360
+ ? html`<${PortalWrapper} />`
356
361
  : html`${Object.keys(
357
362
  !isEditable ? searchJSON(tags, searchValue) : tags,
358
363
  ).length > 0