@asdp/ferryui 0.1.22-dev.9767 → 0.1.22-dev.9771

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.mjs CHANGED
@@ -4251,14 +4251,29 @@ var InputDynamic = ({
4251
4251
  const shouldFocusRef = useRef(false);
4252
4252
  const isBackspaceNavigationRef = useRef(false);
4253
4253
  const rawEmailOrPhoneInputRef = useRef("");
4254
+ const wrapperRef = useRef(null);
4254
4255
  const [selectPortalTarget, setSelectPortalTarget] = useState(null);
4256
+ const [isMobile, setIsMobile] = useState(false);
4257
+ const [isInsideDialog, setIsInsideDialog] = useState(false);
4255
4258
  useEffect(() => {
4256
- if (typeof document !== "undefined") {
4257
- const provider = document.querySelector(
4258
- ".fui-FluentProvider"
4259
+ if (typeof document === "undefined" || typeof window === "undefined") return;
4260
+ const provider = document.querySelector(
4261
+ ".fui-FluentProvider"
4262
+ );
4263
+ setSelectPortalTarget(provider ?? document.body);
4264
+ const MOBILE_BREAKPOINT = 768;
4265
+ const checkMobile = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
4266
+ checkMobile();
4267
+ window.addEventListener("resize", checkMobile);
4268
+ if (wrapperRef.current) {
4269
+ const dialog = wrapperRef.current.closest(
4270
+ ".fui-DialogBody, [role='dialog']"
4259
4271
  );
4260
- setSelectPortalTarget(provider ?? document.body);
4272
+ setIsInsideDialog(!!dialog);
4261
4273
  }
4274
+ return () => {
4275
+ window.removeEventListener("resize", checkMobile);
4276
+ };
4262
4277
  }, []);
4263
4278
  const getPhoneInputValue = (val) => {
4264
4279
  let cleaned = val.startsWith("+") ? stripNonDigits(val.substring(1)) : stripNonDigits(val);
@@ -4362,7 +4377,9 @@ var InputDynamic = ({
4362
4377
  menuList: (provided) => ({
4363
4378
  ...provided,
4364
4379
  padding: 0,
4365
- maxHeight: "300px",
4380
+ // On mobile inside a Dialog: limit height to 200px to prevent viewport overflow.
4381
+ // Otherwise keep 300px. Breakpoint: designTokens.breakpoints.md = 768px.
4382
+ maxHeight: isMobile && isInsideDialog ? "180px" : "300px",
4366
4383
  /* Targetkan Webkit Scrollbar di menuList */
4367
4384
  "&::-webkit-scrollbar": {
4368
4385
  width: "8px",
@@ -5382,7 +5399,7 @@ var InputDynamic = ({
5382
5399
  }
5383
5400
  return rules;
5384
5401
  };
5385
- return /* @__PURE__ */ jsx(
5402
+ return /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: { display: "contents" }, children: /* @__PURE__ */ jsx(
5386
5403
  Controller,
5387
5404
  {
5388
5405
  name,
@@ -5442,7 +5459,7 @@ var InputDynamic = ({
5442
5459
  }
5443
5460
  )
5444
5461
  }
5445
- );
5462
+ ) });
5446
5463
  };
5447
5464
  var InputDynamic_default = InputDynamic;
5448
5465