@asdp/ferryui 0.1.22-dev.9719 → 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,6 +4251,30 @@ var InputDynamic = ({
4251
4251
  const shouldFocusRef = useRef(false);
4252
4252
  const isBackspaceNavigationRef = useRef(false);
4253
4253
  const rawEmailOrPhoneInputRef = useRef("");
4254
+ const wrapperRef = useRef(null);
4255
+ const [selectPortalTarget, setSelectPortalTarget] = useState(null);
4256
+ const [isMobile, setIsMobile] = useState(false);
4257
+ const [isInsideDialog, setIsInsideDialog] = useState(false);
4258
+ useEffect(() => {
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']"
4271
+ );
4272
+ setIsInsideDialog(!!dialog);
4273
+ }
4274
+ return () => {
4275
+ window.removeEventListener("resize", checkMobile);
4276
+ };
4277
+ }, []);
4254
4278
  const getPhoneInputValue = (val) => {
4255
4279
  let cleaned = val.startsWith("+") ? stripNonDigits(val.substring(1)) : stripNonDigits(val);
4256
4280
  if (onlyCountries && onlyCountries.length > 0 && cleaned) {
@@ -4336,7 +4360,12 @@ var InputDynamic = ({
4336
4360
  menuPortal: (base) => ({
4337
4361
  ...base,
4338
4362
  zIndex: 9999999,
4339
- borderRadius: tokens.borderRadiusMedium
4363
+ borderRadius: tokens.borderRadiusMedium,
4364
+ // Explicitly set typography so portal children inherit correct values
4365
+ // regardless of where in the DOM tree the portal is mounted
4366
+ fontSize: tokens.fontSizeBase400,
4367
+ fontFamily: tokens.fontFamilyBase,
4368
+ lineHeight: tokens.lineHeightBase400
4340
4369
  }),
4341
4370
  control: getControlStyles,
4342
4371
  menu: (provided) => ({
@@ -4348,7 +4377,9 @@ var InputDynamic = ({
4348
4377
  menuList: (provided) => ({
4349
4378
  ...provided,
4350
4379
  padding: 0,
4351
- 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",
4352
4383
  /* Targetkan Webkit Scrollbar di menuList */
4353
4384
  "&::-webkit-scrollbar": {
4354
4385
  width: "8px",
@@ -4839,7 +4870,10 @@ var InputDynamic = ({
4839
4870
  getOptionLabel: (option) => option.label,
4840
4871
  getOptionValue: (option) => option.value,
4841
4872
  isOptionDisabled: (option) => option.disabled || false,
4842
- menuPlacement
4873
+ menuPlacement: menuPlacement || "auto",
4874
+ menuShouldScrollIntoView: false,
4875
+ menuPortalTarget: selectPortalTarget,
4876
+ menuPosition: "fixed"
4843
4877
  }
4844
4878
  );
4845
4879
  case "country":
@@ -4899,7 +4933,10 @@ var InputDynamic = ({
4899
4933
  ]
4900
4934
  }
4901
4935
  ),
4902
- menuPlacement
4936
+ menuPlacement: menuPlacement || "auto",
4937
+ menuShouldScrollIntoView: false,
4938
+ menuPortalTarget: selectPortalTarget,
4939
+ menuPosition: "fixed"
4903
4940
  }
4904
4941
  );
4905
4942
  case "phone": {
@@ -5362,7 +5399,7 @@ var InputDynamic = ({
5362
5399
  }
5363
5400
  return rules;
5364
5401
  };
5365
- return /* @__PURE__ */ jsx(
5402
+ return /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: { display: "contents" }, children: /* @__PURE__ */ jsx(
5366
5403
  Controller,
5367
5404
  {
5368
5405
  name,
@@ -5422,7 +5459,7 @@ var InputDynamic = ({
5422
5459
  }
5423
5460
  )
5424
5461
  }
5425
- );
5462
+ ) });
5426
5463
  };
5427
5464
  var InputDynamic_default = InputDynamic;
5428
5465