@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.js CHANGED
@@ -4260,14 +4260,29 @@ var InputDynamic = ({
4260
4260
  const shouldFocusRef = React.useRef(false);
4261
4261
  const isBackspaceNavigationRef = React.useRef(false);
4262
4262
  const rawEmailOrPhoneInputRef = React.useRef("");
4263
+ const wrapperRef = React.useRef(null);
4263
4264
  const [selectPortalTarget, setSelectPortalTarget] = React.useState(null);
4265
+ const [isMobile, setIsMobile] = React.useState(false);
4266
+ const [isInsideDialog, setIsInsideDialog] = React.useState(false);
4264
4267
  React.useEffect(() => {
4265
- if (typeof document !== "undefined") {
4266
- const provider = document.querySelector(
4267
- ".fui-FluentProvider"
4268
+ if (typeof document === "undefined" || typeof window === "undefined") return;
4269
+ const provider = document.querySelector(
4270
+ ".fui-FluentProvider"
4271
+ );
4272
+ setSelectPortalTarget(provider ?? document.body);
4273
+ const MOBILE_BREAKPOINT = 768;
4274
+ const checkMobile = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
4275
+ checkMobile();
4276
+ window.addEventListener("resize", checkMobile);
4277
+ if (wrapperRef.current) {
4278
+ const dialog = wrapperRef.current.closest(
4279
+ ".fui-DialogBody, [role='dialog']"
4268
4280
  );
4269
- setSelectPortalTarget(provider ?? document.body);
4281
+ setIsInsideDialog(!!dialog);
4270
4282
  }
4283
+ return () => {
4284
+ window.removeEventListener("resize", checkMobile);
4285
+ };
4271
4286
  }, []);
4272
4287
  const getPhoneInputValue = (val) => {
4273
4288
  let cleaned = val.startsWith("+") ? stripNonDigits(val.substring(1)) : stripNonDigits(val);
@@ -4371,7 +4386,9 @@ var InputDynamic = ({
4371
4386
  menuList: (provided) => ({
4372
4387
  ...provided,
4373
4388
  padding: 0,
4374
- maxHeight: "300px",
4389
+ // On mobile inside a Dialog: limit height to 200px to prevent viewport overflow.
4390
+ // Otherwise keep 300px. Breakpoint: designTokens.breakpoints.md = 768px.
4391
+ maxHeight: isMobile && isInsideDialog ? "180px" : "300px",
4375
4392
  /* Targetkan Webkit Scrollbar di menuList */
4376
4393
  "&::-webkit-scrollbar": {
4377
4394
  width: "8px",
@@ -5391,7 +5408,7 @@ var InputDynamic = ({
5391
5408
  }
5392
5409
  return rules;
5393
5410
  };
5394
- return /* @__PURE__ */ jsxRuntime.jsx(
5411
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: { display: "contents" }, children: /* @__PURE__ */ jsxRuntime.jsx(
5395
5412
  reactHookForm.Controller,
5396
5413
  {
5397
5414
  name,
@@ -5451,7 +5468,7 @@ var InputDynamic = ({
5451
5468
  }
5452
5469
  )
5453
5470
  }
5454
- );
5471
+ ) });
5455
5472
  };
5456
5473
  var InputDynamic_default = InputDynamic;
5457
5474