@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.mjs
CHANGED
|
@@ -4255,7 +4255,8 @@ var InputDynamic = ({
|
|
|
4255
4255
|
const [isMobile, setIsMobile] = useState(false);
|
|
4256
4256
|
const [isInsideDialog, setIsInsideDialog] = useState(false);
|
|
4257
4257
|
useEffect(() => {
|
|
4258
|
-
if (typeof document === "undefined" || typeof window === "undefined")
|
|
4258
|
+
if (typeof document === "undefined" || typeof window === "undefined")
|
|
4259
|
+
return;
|
|
4259
4260
|
const provider = document.querySelector(
|
|
4260
4261
|
".fui-FluentProvider"
|
|
4261
4262
|
);
|
|
@@ -4577,7 +4578,9 @@ var InputDynamic = ({
|
|
|
4577
4578
|
if (!DIGITS_ONLY_REGEX.test(e.key)) {
|
|
4578
4579
|
e.preventDefault();
|
|
4579
4580
|
const fieldStr = typeof field.value === "string" ? field.value : "";
|
|
4580
|
-
const fieldDigits = stripNonDigits(
|
|
4581
|
+
const fieldDigits = stripNonDigits(
|
|
4582
|
+
fieldStr.replace(/^\+/, "")
|
|
4583
|
+
);
|
|
4581
4584
|
const activeDialCode = getDialCode(onlyCountries?.[0] || defaultCountry) || "";
|
|
4582
4585
|
const userDigitsFromField = activeDialCode && fieldDigits.startsWith(activeDialCode) ? fieldDigits.slice(activeDialCode.length) : fieldDigits;
|
|
4583
4586
|
const hadTrunkPrefix = rawEmailOrPhoneInputRef.current.startsWith("08");
|
|
@@ -4608,7 +4611,10 @@ var InputDynamic = ({
|
|
|
4608
4611
|
return;
|
|
4609
4612
|
}
|
|
4610
4613
|
const countryDialCode = data?.dialCode || "";
|
|
4611
|
-
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4614
|
+
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4615
|
+
value,
|
|
4616
|
+
countryDialCode
|
|
4617
|
+
);
|
|
4612
4618
|
if (cleanedValue === countryDialCode) {
|
|
4613
4619
|
const dialCodeChanged = lastEmailOrPhoneValue && lastEmailOrPhoneValue !== countryDialCode && !lastEmailOrPhoneValue.startsWith(countryDialCode);
|
|
4614
4620
|
const isInitial = !lastEmailOrPhoneValue;
|
|
@@ -4647,7 +4653,9 @@ var InputDynamic = ({
|
|
|
4647
4653
|
const inputEl = e.currentTarget;
|
|
4648
4654
|
if (nativeInputValueSetter) {
|
|
4649
4655
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4650
|
-
inputEl.dispatchEvent(
|
|
4656
|
+
inputEl.dispatchEvent(
|
|
4657
|
+
new Event("input", { bubbles: true })
|
|
4658
|
+
);
|
|
4651
4659
|
}
|
|
4652
4660
|
}
|
|
4653
4661
|
}
|
|
@@ -4673,7 +4681,10 @@ var InputDynamic = ({
|
|
|
4673
4681
|
rawEmailOrPhoneInputRef.current = newValue;
|
|
4674
4682
|
let normalizedValue = newValue;
|
|
4675
4683
|
if (detectedType === "phone") {
|
|
4676
|
-
normalizedValue = localToInternational(
|
|
4684
|
+
normalizedValue = localToInternational(
|
|
4685
|
+
newValue,
|
|
4686
|
+
defaultCountry
|
|
4687
|
+
);
|
|
4677
4688
|
}
|
|
4678
4689
|
field.onChange(normalizedValue);
|
|
4679
4690
|
updateEmailOrPhoneType(normalizedValue);
|
|
@@ -4739,7 +4750,10 @@ var InputDynamic = ({
|
|
|
4739
4750
|
return;
|
|
4740
4751
|
}
|
|
4741
4752
|
const countryDialCode = data?.dialCode || "";
|
|
4742
|
-
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4753
|
+
const cleanedValue = removeLeadingZeroAfterDialCode(
|
|
4754
|
+
value,
|
|
4755
|
+
countryDialCode
|
|
4756
|
+
);
|
|
4743
4757
|
if (cleanedValue === countryDialCode) {
|
|
4744
4758
|
const dialCodeChanged = lastPhoneValue && lastPhoneValue !== countryDialCode && !lastPhoneValue.startsWith(countryDialCode);
|
|
4745
4759
|
const isInitial = !lastPhoneValue;
|
|
@@ -4777,7 +4791,9 @@ var InputDynamic = ({
|
|
|
4777
4791
|
const inputEl = e.currentTarget;
|
|
4778
4792
|
if (nativeInputValueSetter) {
|
|
4779
4793
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4780
|
-
inputEl.dispatchEvent(
|
|
4794
|
+
inputEl.dispatchEvent(
|
|
4795
|
+
new Event("input", { bubbles: true })
|
|
4796
|
+
);
|
|
4781
4797
|
}
|
|
4782
4798
|
}
|
|
4783
4799
|
}
|
|
@@ -4804,7 +4820,10 @@ var InputDynamic = ({
|
|
|
4804
4820
|
if (willSwitchType) shouldFocusRef.current = true;
|
|
4805
4821
|
let normalizedValue = newValue;
|
|
4806
4822
|
if (detectedType === "phone") {
|
|
4807
|
-
normalizedValue = localToInternational(
|
|
4823
|
+
normalizedValue = localToInternational(
|
|
4824
|
+
newValue,
|
|
4825
|
+
defaultCountry
|
|
4826
|
+
);
|
|
4808
4827
|
}
|
|
4809
4828
|
field.onChange(normalizedValue);
|
|
4810
4829
|
updateIdentityType(normalizedValue);
|
|
@@ -4868,6 +4887,21 @@ var InputDynamic = ({
|
|
|
4868
4887
|
},
|
|
4869
4888
|
getOptionLabel: (option) => option.label,
|
|
4870
4889
|
getOptionValue: (option) => option.value,
|
|
4890
|
+
formatOptionLabel: (option) => /* @__PURE__ */ jsxs("div", { children: [
|
|
4891
|
+
/* @__PURE__ */ jsx("div", { children: option.label }),
|
|
4892
|
+
option.description && /* @__PURE__ */ jsx(
|
|
4893
|
+
"div",
|
|
4894
|
+
{
|
|
4895
|
+
style: {
|
|
4896
|
+
fontSize: "12px",
|
|
4897
|
+
color: "#6b7280",
|
|
4898
|
+
marginTop: "2px",
|
|
4899
|
+
lineHeight: "1.4"
|
|
4900
|
+
},
|
|
4901
|
+
children: option.description
|
|
4902
|
+
}
|
|
4903
|
+
)
|
|
4904
|
+
] }),
|
|
4871
4905
|
isOptionDisabled: (option) => option.disabled || false,
|
|
4872
4906
|
menuPlacement: menuPlacement || "auto",
|
|
4873
4907
|
menuShouldScrollIntoView: false,
|
|
@@ -4965,7 +4999,10 @@ var InputDynamic = ({
|
|
|
4965
4999
|
return;
|
|
4966
5000
|
}
|
|
4967
5001
|
const dialCode = data?.dialCode || "";
|
|
4968
|
-
let cleanedValue = removeLeadingZeroAfterDialCode(
|
|
5002
|
+
let cleanedValue = removeLeadingZeroAfterDialCode(
|
|
5003
|
+
value,
|
|
5004
|
+
dialCode
|
|
5005
|
+
);
|
|
4969
5006
|
if (cleanedValue.length > PHONE_MAX_DIGITS) {
|
|
4970
5007
|
cleanedValue = cleanedValue.substring(0, PHONE_MAX_DIGITS);
|
|
4971
5008
|
}
|
|
@@ -4985,7 +5022,9 @@ var InputDynamic = ({
|
|
|
4985
5022
|
const inputEl = e.currentTarget;
|
|
4986
5023
|
if (nativeInputValueSetter) {
|
|
4987
5024
|
nativeInputValueSetter.call(inputEl, digitsOnly);
|
|
4988
|
-
inputEl.dispatchEvent(
|
|
5025
|
+
inputEl.dispatchEvent(
|
|
5026
|
+
new Event("input", { bubbles: true })
|
|
5027
|
+
);
|
|
4989
5028
|
}
|
|
4990
5029
|
}
|
|
4991
5030
|
}
|