fui-material 2.1.3 → 2.1.4

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.
@@ -3566,7 +3566,7 @@ const styles$b = {
3566
3566
  "f-dropdown__content-link": "_f-dropdown__content-link_d5i2z_28",
3567
3567
  "f-dropdown__content--open": "_f-dropdown__content--open_d5i2z_43"
3568
3568
  };
3569
- const FDropdown = ({
3569
+ const FDropdown = forwardRef(({
3570
3570
  label,
3571
3571
  variant = "contained",
3572
3572
  color = "primary",
@@ -3575,20 +3575,23 @@ const FDropdown = ({
3575
3575
  st: st2,
3576
3576
  className,
3577
3577
  id,
3578
- children
3579
- }) => {
3578
+ children,
3579
+ ...props
3580
+ }, forwardedRef) => {
3580
3581
  const [isOpen, setIsOpen] = useState(false);
3581
- const ref = useRef(null);
3582
+ const internalRef = useRef(null);
3583
+ const ref = forwardedRef || internalRef;
3582
3584
  useEffect(() => {
3583
3585
  if (!isOpen) return;
3584
3586
  const handleClick = (e) => {
3585
- if (ref.current && !ref.current.contains(e.target)) {
3587
+ const currentRef = typeof ref === "function" ? null : ref == null ? void 0 : ref.current;
3588
+ if (currentRef && !currentRef.contains(e.target)) {
3586
3589
  setIsOpen(false);
3587
3590
  }
3588
3591
  };
3589
3592
  document.addEventListener("mousedown", handleClick);
3590
3593
  return () => document.removeEventListener("mousedown", handleClick);
3591
- }, [isOpen]);
3594
+ }, [isOpen, ref]);
3592
3595
  const handleItemClick = (child) => (e) => {
3593
3596
  if (child.props && typeof child.props.onClick === "function") {
3594
3597
  child.props.onClick(e);
@@ -3605,7 +3608,7 @@ const FDropdown = ({
3605
3608
  return child;
3606
3609
  });
3607
3610
  };
3608
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$b["f-dropdown"], ref, children: [
3611
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$b["f-dropdown"], ref, ...props, children: [
3609
3612
  /* @__PURE__ */ jsxRuntimeExports.jsx(
3610
3613
  FButton,
3611
3614
  {
@@ -3634,7 +3637,7 @@ const FDropdown = ({
3634
3637
  }
3635
3638
  )
3636
3639
  ] });
3637
- };
3640
+ });
3638
3641
  FDropdown.displayName = "FDropdown";
3639
3642
  const FDropdownItem = ({
3640
3643
  disabled: disabled2,