fluentui-extended 2026.2.17 → 2026.6.12

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/README.md CHANGED
@@ -167,6 +167,7 @@ import { AddRegular, PersonSearchRegular } from '@fluentui/react-icons';
167
167
 
168
168
  | Prop | Type | Default | Description |
169
169
  |------|------|---------|-------------|
170
+ | `id` | `string` | auto-generated | Unique identifier for the lookup |
170
171
  | `options` | `LookupOption[]` | `[]` | Options to display in the dropdown |
171
172
  | `selectedKey` | `string \| null` | - | Selected option key (controlled) |
172
173
  | `selectedOption` | `LookupOption \| null` | - | Selected option object (recommended for async) |
@@ -178,9 +179,20 @@ import { AddRegular, PersonSearchRegular } from '@fluentui/react-icons';
178
179
  | `clearable` | `boolean` | `true` | Show clear button |
179
180
  | `minSearchLength` | `number` | `0` | Min chars before search fires |
180
181
  | `searchDebounceMs` | `number` | `300` | Search debounce delay (ms) |
182
+ | `matchInputWidth` | `boolean` | `true` | Match dropdown width to input width |
181
183
  | `header` | `ReactNode` | - | Header content |
182
184
  | `footer` | `ReactNode` | - | Footer content |
183
185
  | `disabled` | `boolean` | `false` | Disable the lookup |
186
+ | `open` | `boolean` | - | Controlled open state for the dropdown |
187
+ | `onOpenChange` | `(open: boolean) => void` | - | Callback when dropdown open state changes |
188
+
189
+ ### Cross-Document Support (Dynamics 365 Iframes)
190
+
191
+ The Lookup component automatically detects when it's rendered inside a cross-document context (e.g., a React tree mounted into a parent window's document from an iframe). It uses `ownerDocument` and `ownerDocument.defaultView` instead of the global `document` and `window` to ensure:
192
+
193
+ - **Dismiss on click outside** works correctly (mousedown listener on the correct document)
194
+ - **Scroll/resize tracking** responds to the correct window's events
195
+ - **Dropdown positioning** uses the correct scroll offsets
184
196
 
185
197
  ### Inherited Input Props
186
198
 
package/dist/index.js CHANGED
@@ -458,9 +458,10 @@ var Lookup = ({
458
458
  const updatePosition = () => {
459
459
  const rect = inputWrapperRef.current?.getBoundingClientRect();
460
460
  if (rect) {
461
+ const ownerWin2 = inputWrapperRef.current?.ownerDocument?.defaultView ?? window;
461
462
  setDropdownPosition({
462
- top: rect.bottom + 4 + window.scrollY,
463
- left: rect.left + window.scrollX,
463
+ top: rect.bottom + 4 + ownerWin2.scrollY,
464
+ left: rect.left + ownerWin2.scrollX,
464
465
  width: matchInputWidth ? rect.width : 0
465
466
  });
466
467
  }
@@ -471,12 +472,13 @@ var Lookup = ({
471
472
  resizeObserver = new ResizeObserver(() => updatePosition());
472
473
  resizeObserver.observe(inputWrapperRef.current);
473
474
  }
474
- window.addEventListener("resize", updatePosition);
475
- window.addEventListener("scroll", updatePosition, true);
475
+ const ownerWin = inputWrapperRef.current?.ownerDocument?.defaultView ?? window;
476
+ ownerWin.addEventListener("resize", updatePosition);
477
+ ownerWin.addEventListener("scroll", updatePosition, true);
476
478
  return () => {
477
479
  resizeObserver?.disconnect();
478
- window.removeEventListener("resize", updatePosition);
479
- window.removeEventListener("scroll", updatePosition, true);
480
+ ownerWin.removeEventListener("resize", updatePosition);
481
+ ownerWin.removeEventListener("scroll", updatePosition, true);
480
482
  };
481
483
  }, [isOpen, matchInputWidth]);
482
484
  React3__namespace.useEffect(() => {
@@ -490,9 +492,10 @@ var Lookup = ({
490
492
  closeDropdown();
491
493
  }
492
494
  };
493
- document.addEventListener("mousedown", handlePointerDownOutside, true);
495
+ const ownerDoc = inputWrapperRef.current?.ownerDocument ?? document;
496
+ ownerDoc.addEventListener("mousedown", handlePointerDownOutside, true);
494
497
  return () => {
495
- document.removeEventListener("mousedown", handlePointerDownOutside, true);
498
+ ownerDoc.removeEventListener("mousedown", handlePointerDownOutside, true);
496
499
  };
497
500
  }, [isOpen, closeDropdown]);
498
501
  const showDropdown = isOpen && !disabled;