@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.js +43 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4260,6 +4260,30 @@ 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);
|
|
4264
|
+
const [selectPortalTarget, setSelectPortalTarget] = React.useState(null);
|
|
4265
|
+
const [isMobile, setIsMobile] = React.useState(false);
|
|
4266
|
+
const [isInsideDialog, setIsInsideDialog] = React.useState(false);
|
|
4267
|
+
React.useEffect(() => {
|
|
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']"
|
|
4280
|
+
);
|
|
4281
|
+
setIsInsideDialog(!!dialog);
|
|
4282
|
+
}
|
|
4283
|
+
return () => {
|
|
4284
|
+
window.removeEventListener("resize", checkMobile);
|
|
4285
|
+
};
|
|
4286
|
+
}, []);
|
|
4263
4287
|
const getPhoneInputValue = (val) => {
|
|
4264
4288
|
let cleaned = val.startsWith("+") ? stripNonDigits(val.substring(1)) : stripNonDigits(val);
|
|
4265
4289
|
if (onlyCountries && onlyCountries.length > 0 && cleaned) {
|
|
@@ -4345,7 +4369,12 @@ var InputDynamic = ({
|
|
|
4345
4369
|
menuPortal: (base) => ({
|
|
4346
4370
|
...base,
|
|
4347
4371
|
zIndex: 9999999,
|
|
4348
|
-
borderRadius: reactComponents.tokens.borderRadiusMedium
|
|
4372
|
+
borderRadius: reactComponents.tokens.borderRadiusMedium,
|
|
4373
|
+
// Explicitly set typography so portal children inherit correct values
|
|
4374
|
+
// regardless of where in the DOM tree the portal is mounted
|
|
4375
|
+
fontSize: reactComponents.tokens.fontSizeBase400,
|
|
4376
|
+
fontFamily: reactComponents.tokens.fontFamilyBase,
|
|
4377
|
+
lineHeight: reactComponents.tokens.lineHeightBase400
|
|
4349
4378
|
}),
|
|
4350
4379
|
control: getControlStyles,
|
|
4351
4380
|
menu: (provided) => ({
|
|
@@ -4357,7 +4386,9 @@ var InputDynamic = ({
|
|
|
4357
4386
|
menuList: (provided) => ({
|
|
4358
4387
|
...provided,
|
|
4359
4388
|
padding: 0,
|
|
4360
|
-
|
|
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",
|
|
4361
4392
|
/* Targetkan Webkit Scrollbar di menuList */
|
|
4362
4393
|
"&::-webkit-scrollbar": {
|
|
4363
4394
|
width: "8px",
|
|
@@ -4848,7 +4879,10 @@ var InputDynamic = ({
|
|
|
4848
4879
|
getOptionLabel: (option) => option.label,
|
|
4849
4880
|
getOptionValue: (option) => option.value,
|
|
4850
4881
|
isOptionDisabled: (option) => option.disabled || false,
|
|
4851
|
-
menuPlacement
|
|
4882
|
+
menuPlacement: menuPlacement || "auto",
|
|
4883
|
+
menuShouldScrollIntoView: false,
|
|
4884
|
+
menuPortalTarget: selectPortalTarget,
|
|
4885
|
+
menuPosition: "fixed"
|
|
4852
4886
|
}
|
|
4853
4887
|
);
|
|
4854
4888
|
case "country":
|
|
@@ -4908,7 +4942,10 @@ var InputDynamic = ({
|
|
|
4908
4942
|
]
|
|
4909
4943
|
}
|
|
4910
4944
|
),
|
|
4911
|
-
menuPlacement
|
|
4945
|
+
menuPlacement: menuPlacement || "auto",
|
|
4946
|
+
menuShouldScrollIntoView: false,
|
|
4947
|
+
menuPortalTarget: selectPortalTarget,
|
|
4948
|
+
menuPosition: "fixed"
|
|
4912
4949
|
}
|
|
4913
4950
|
);
|
|
4914
4951
|
case "phone": {
|
|
@@ -5371,7 +5408,7 @@ var InputDynamic = ({
|
|
|
5371
5408
|
}
|
|
5372
5409
|
return rules;
|
|
5373
5410
|
};
|
|
5374
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5411
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: wrapperRef, style: { display: "contents" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5375
5412
|
reactHookForm.Controller,
|
|
5376
5413
|
{
|
|
5377
5414
|
name,
|
|
@@ -5431,7 +5468,7 @@ var InputDynamic = ({
|
|
|
5431
5468
|
}
|
|
5432
5469
|
)
|
|
5433
5470
|
}
|
|
5434
|
-
);
|
|
5471
|
+
) });
|
|
5435
5472
|
};
|
|
5436
5473
|
var InputDynamic_default = InputDynamic;
|
|
5437
5474
|
|