fluentui-extended 2026.2.13 → 2026.2.17

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/index.d.mts CHANGED
@@ -54,6 +54,16 @@ interface LookupProps extends Omit<InputProps, 'onChange' | 'value'> {
54
54
  header?: React.ReactNode;
55
55
  /** Footer content rendered at the bottom of the dropdown */
56
56
  footer?: React.ReactNode;
57
+ /**
58
+ * Controlled open state. When provided, the component will use this value
59
+ * instead of its internal state. Use together with `onOpenChange`.
60
+ */
61
+ open?: boolean;
62
+ /**
63
+ * Callback fired when the dropdown open state changes.
64
+ * Use together with `open` for controlled mode, or standalone to observe changes.
65
+ */
66
+ onOpenChange?: (open: boolean) => void;
57
67
  }
58
68
 
59
69
  declare const Lookup: React.FC<LookupProps>;
package/dist/index.d.ts CHANGED
@@ -54,6 +54,16 @@ interface LookupProps extends Omit<InputProps, 'onChange' | 'value'> {
54
54
  header?: React.ReactNode;
55
55
  /** Footer content rendered at the bottom of the dropdown */
56
56
  footer?: React.ReactNode;
57
+ /**
58
+ * Controlled open state. When provided, the component will use this value
59
+ * instead of its internal state. Use together with `onOpenChange`.
60
+ */
61
+ open?: boolean;
62
+ /**
63
+ * Callback fired when the dropdown open state changes.
64
+ * Use together with `open` for controlled mode, or standalone to observe changes.
65
+ */
66
+ onOpenChange?: (open: boolean) => void;
57
67
  }
58
68
 
59
69
  declare const Lookup: React.FC<LookupProps>;
package/dist/index.js CHANGED
@@ -265,6 +265,8 @@ var Lookup = ({
265
265
  disabled,
266
266
  header,
267
267
  footer,
268
+ open: controlledOpen,
269
+ onOpenChange,
268
270
  ...inputProps
269
271
  }) => {
270
272
  const styles = useLookupStyles();
@@ -272,7 +274,19 @@ var Lookup = ({
272
274
  const ariaLabelledBy = inputProps["aria-labelledby"];
273
275
  const autoId = reactComponents.useId("lookup-");
274
276
  const lookupId = id ?? autoId;
275
- const [isOpen, setIsOpen] = React3__namespace.useState(false);
277
+ const [internalOpen, setInternalOpen] = React3__namespace.useState(false);
278
+ const isControlled = controlledOpen !== void 0;
279
+ const isOpen = isControlled ? controlledOpen : internalOpen;
280
+ const setIsOpen = React3__namespace.useCallback(
281
+ (value) => {
282
+ const nextValue = typeof value === "function" ? value(isOpen) : value;
283
+ if (!isControlled) {
284
+ setInternalOpen(nextValue);
285
+ }
286
+ onOpenChange?.(nextValue);
287
+ },
288
+ [isControlled, isOpen, onOpenChange]
289
+ );
276
290
  const [searchText, setSearchText] = React3__namespace.useState("");
277
291
  const [highlightedIndex, setHighlightedIndex] = React3__namespace.useState(-1);
278
292
  const [expandedKeys, setExpandedKeys] = React3__namespace.useState(/* @__PURE__ */ new Set());
@@ -476,12 +490,9 @@ var Lookup = ({
476
490
  closeDropdown();
477
491
  }
478
492
  };
479
- const rafId = requestAnimationFrame(() => {
480
- document.addEventListener("mousedown", handlePointerDownOutside);
481
- });
493
+ document.addEventListener("mousedown", handlePointerDownOutside, true);
482
494
  return () => {
483
- cancelAnimationFrame(rafId);
484
- document.removeEventListener("mousedown", handlePointerDownOutside);
495
+ document.removeEventListener("mousedown", handlePointerDownOutside, true);
485
496
  };
486
497
  }, [isOpen, closeDropdown]);
487
498
  const showDropdown = isOpen && !disabled;