@asdp/ferryui 0.1.22-dev.10167 → 0.1.22-dev.10171
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +49 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4264,7 +4264,8 @@ var InputDynamic = ({
|
|
|
4264
4264
|
const [isMobile, setIsMobile] = React.useState(false);
|
|
4265
4265
|
const [isInsideDialog, setIsInsideDialog] = React.useState(false);
|
|
4266
4266
|
React.useEffect(() => {
|
|
4267
|
-
if (typeof document === "undefined" || typeof window === "undefined")
|
|
4267
|
+
if (typeof document === "undefined" || typeof window === "undefined")
|
|
4268
|
+
return;
|
|
4268
4269
|
const provider = document.querySelector(
|
|
4269
4270
|
".fui-FluentProvider"
|
|
4270
4271
|
);
|
|
@@ -4586,7 +4587,9 @@ var InputDynamic = ({
|
|
|
4586
4587
|
if (!DIGITS_ONLY_REGEX.test(e.key)) {
|
|
4587
4588
|
e.preventDefault();
|
|
4588
4589
|
const fieldStr = typeof field.value === "string" ? field.value : "";
|
|
4589
|
-
const fieldDigits = stripNonDigits(
|
|
4590
|
+
const fieldDigits = stripNonDigits(
|
|
4591
|
+
fieldStr.replace(/^\+/, "")
|
|
4592
|
+
);
|
|
4590
4593
|
const activeDialCode = getDialCode(onlyCountries?.[0] || defaultCountry) || "";
|
|
4591
4594
|
const userDigitsFromField = activeDialCode && fieldDigits.startsWith(activeDialCode) ? fieldDigits.slice(activeDialCode.length) : fieldDigits;
|
|
4592
4595
|
const hadTrunkPrefix = rawEmailOrPhoneInputRef.current.startsWith("08");
|
|
@@ -4617,7 +4620,10 @@ var InputDynamic = ({
|
|
|
4617
4620
|
return;
|
|
4618
4621
|
}
|
|
4619
4622
|
const countryDialCode = data?.dialCode || "";
|
|
4620
|
-
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4623
|
+
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4624
|
+
value,
|
|
4625
|
+
countryDialCode
|
|
4626
|
+
);
|
|
4621
4627
|
if (cleanedValue === countryDialCode) {
|
|
4622
4628
|
const dialCodeChanged = lastEmailOrPhoneValue && lastEmailOrPhoneValue !== countryDialCode && !lastEmailOrPhoneValue.startsWith(countryDialCode);
|
|
4623
4629
|
const isInitial = !lastEmailOrPhoneValue;
|
|
@@ -4656,7 +4662,9 @@ var InputDynamic = ({
|
|
|
4656
4662
|
const inputEl = e.currentTarget;
|
|
4657
4663
|
if (nativeInputValueSetter) {
|
|
4658
4664
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4659
|
-
inputEl.dispatchEvent(
|
|
4665
|
+
inputEl.dispatchEvent(
|
|
4666
|
+
new Event("input", { bubbles: true })
|
|
4667
|
+
);
|
|
4660
4668
|
}
|
|
4661
4669
|
}
|
|
4662
4670
|
}
|
|
@@ -4682,7 +4690,10 @@ var InputDynamic = ({
|
|
|
4682
4690
|
rawEmailOrPhoneInputRef.current = newValue;
|
|
4683
4691
|
let normalizedValue = newValue;
|
|
4684
4692
|
if (detectedType === "phone") {
|
|
4685
|
-
normalizedValue = localToInternational(
|
|
4693
|
+
normalizedValue = localToInternational(
|
|
4694
|
+
newValue,
|
|
4695
|
+
defaultCountry
|
|
4696
|
+
);
|
|
4686
4697
|
}
|
|
4687
4698
|
field.onChange(normalizedValue);
|
|
4688
4699
|
updateEmailOrPhoneType(normalizedValue);
|
|
@@ -4748,7 +4759,10 @@ var InputDynamic = ({
|
|
|
4748
4759
|
return;
|
|
4749
4760
|
}
|
|
4750
4761
|
const countryDialCode = data?.dialCode || "";
|
|
4751
|
-
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4762
|
+
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4763
|
+
value,
|
|
4764
|
+
countryDialCode
|
|
4765
|
+
);
|
|
4752
4766
|
if (cleanedValue === countryDialCode) {
|
|
4753
4767
|
const dialCodeChanged = lastPhoneValue && lastPhoneValue !== countryDialCode && !lastPhoneValue.startsWith(countryDialCode);
|
|
4754
4768
|
const isInitial = !lastPhoneValue;
|
|
@@ -4786,7 +4800,9 @@ var InputDynamic = ({
|
|
|
4786
4800
|
const inputEl = e.currentTarget;
|
|
4787
4801
|
if (nativeInputValueSetter) {
|
|
4788
4802
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4789
|
-
inputEl.dispatchEvent(
|
|
4803
|
+
inputEl.dispatchEvent(
|
|
4804
|
+
new Event("input", { bubbles: true })
|
|
4805
|
+
);
|
|
4790
4806
|
}
|
|
4791
4807
|
}
|
|
4792
4808
|
}
|
|
@@ -4813,7 +4829,10 @@ var InputDynamic = ({
|
|
|
4813
4829
|
if (willSwitchType) shouldFocusRef.current = true;
|
|
4814
4830
|
let normalizedValue = newValue;
|
|
4815
4831
|
if (detectedType === "phone") {
|
|
4816
|
-
normalizedValue = localToInternational(
|
|
4832
|
+
normalizedValue = localToInternational(
|
|
4833
|
+
newValue,
|
|
4834
|
+
defaultCountry
|
|
4835
|
+
);
|
|
4817
4836
|
}
|
|
4818
4837
|
field.onChange(normalizedValue);
|
|
4819
4838
|
updateIdentityType(normalizedValue);
|
|
@@ -4877,6 +4896,21 @@ var InputDynamic = ({
|
|
|
4877
4896
|
},
|
|
4878
4897
|
getOptionLabel: (option) => option.label,
|
|
4879
4898
|
getOptionValue: (option) => option.value,
|
|
4899
|
+
formatOptionLabel: (option) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4900
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: option.label }),
|
|
4901
|
+
option.description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4902
|
+
"div",
|
|
4903
|
+
{
|
|
4904
|
+
style: {
|
|
4905
|
+
fontSize: "12px",
|
|
4906
|
+
color: "#6b7280",
|
|
4907
|
+
marginTop: "2px",
|
|
4908
|
+
lineHeight: "1.4"
|
|
4909
|
+
},
|
|
4910
|
+
children: option.description
|
|
4911
|
+
}
|
|
4912
|
+
)
|
|
4913
|
+
] }),
|
|
4880
4914
|
isOptionDisabled: (option) => option.disabled || false,
|
|
4881
4915
|
menuPlacement: menuPlacement || "auto",
|
|
4882
4916
|
menuShouldScrollIntoView: false,
|
|
@@ -4974,7 +5008,10 @@ var InputDynamic = ({
|
|
|
4974
5008
|
return;
|
|
4975
5009
|
}
|
|
4976
5010
|
const dialCode = data?.dialCode || "";
|
|
4977
|
-
let cleanedValue = removeLeadingZeroAfterDialCode(
|
|
5011
|
+
let cleanedValue = removeLeadingZeroAfterDialCode(
|
|
5012
|
+
value,
|
|
5013
|
+
dialCode
|
|
5014
|
+
);
|
|
4978
5015
|
if (cleanedValue.length > PHONE_MAX_DIGITS) {
|
|
4979
5016
|
cleanedValue = cleanedValue.substring(0, PHONE_MAX_DIGITS);
|
|
4980
5017
|
}
|
|
@@ -4994,7 +5031,9 @@ var InputDynamic = ({
|
|
|
4994
5031
|
const inputEl = e.currentTarget;
|
|
4995
5032
|
if (nativeInputValueSetter) {
|
|
4996
5033
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4997
|
-
inputEl.dispatchEvent(
|
|
5034
|
+
inputEl.dispatchEvent(
|
|
5035
|
+
new Event("input", { bubbles: true })
|
|
5036
|
+
);
|
|
4998
5037
|
}
|
|
4999
5038
|
}
|
|
5000
5039
|
}
|