@integry/sdk 4.5.24 → 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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integry/sdk",
3
- "version": "4.5.24",
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",
@@ -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';
@@ -220,22 +221,34 @@ const FieldDropdown = (props: FieldMenuProps) => {
220
221
  });
221
222
  }
222
223
 
223
- const PortalWrapper = () => {
224
- const reactRoot = useRef<HTMLDivElement>(null);
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 (reactRoot.current) {
228
- const root = createRoot(reactRoot.current);
229
- root.render(tagsComponentRender);
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();
230
241
  }
242
+
243
+ // Return a no-op cleanup to satisfy ESLint
244
+ return () => {
245
+ // No cleanup needed if reactRootRef is not set
246
+ };
231
247
  }, []);
232
248
 
233
- return html`<div ref=${reactRoot}></div>`;
249
+ return html`<div ref=${reactRootRef}></div>`;
234
250
  };
235
251
 
236
- // eslint-disable-next-line no-console
237
- console.log(PortalWrapper);
238
-
239
252
  return html` <div
240
253
  class=${`${styles.tagMenu} ${enableSearch ? styles.tagMenuWithSearch : ''}`}
241
254
  style=${parentContainer && tagMenyStyleRef?.current
@@ -361,7 +374,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
361
374
  </div>`
362
375
  : html` <div className="${styles.mappedFieldMenu}">
363
376
  ${tagsComponent
364
- ? html`<${PortalWrapper} />`
377
+ ? html`<${ReactPortal} />`
365
378
  : html`${Object.keys(
366
379
  !isEditable ? searchJSON(tags, searchValue) : tags,
367
380
  ).length > 0