@chekinapp/ui 0.0.140 → 0.0.141
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.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14501,6 +14501,30 @@ var Select = React49.forwardRef(SelectInternal);
|
|
|
14501
14501
|
|
|
14502
14502
|
// src/dashboard/phone-input/utils.ts
|
|
14503
14503
|
var PREFIX_REGEX = /^\+/;
|
|
14504
|
+
function isPhoneInputValue(value) {
|
|
14505
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
14506
|
+
return false;
|
|
14507
|
+
}
|
|
14508
|
+
return Boolean(value && ("code" in value || "number" in value));
|
|
14509
|
+
}
|
|
14510
|
+
function getPhoneValuePart(value) {
|
|
14511
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
14512
|
+
return String(value);
|
|
14513
|
+
}
|
|
14514
|
+
return void 0;
|
|
14515
|
+
}
|
|
14516
|
+
function toPhoneValue(value, fallbackCode, fallbackNumber) {
|
|
14517
|
+
if (value === null || value === void 0) {
|
|
14518
|
+
return { code: fallbackCode ?? "", number: fallbackNumber ?? "" };
|
|
14519
|
+
}
|
|
14520
|
+
if (isPhoneInputValue(value)) {
|
|
14521
|
+
return {
|
|
14522
|
+
code: getPhoneValuePart(value.code) ?? fallbackCode ?? "",
|
|
14523
|
+
number: getPhoneValuePart(value.number) ?? fallbackNumber ?? ""
|
|
14524
|
+
};
|
|
14525
|
+
}
|
|
14526
|
+
return { code: fallbackCode ?? "", number: fallbackNumber ?? String(value) };
|
|
14527
|
+
}
|
|
14504
14528
|
function clearPhoneNumber(value) {
|
|
14505
14529
|
return value.replace(/[^0-9]/g, "");
|
|
14506
14530
|
}
|
|
@@ -14544,7 +14568,6 @@ function formatPhoneCodeOptionLabel(option) {
|
|
|
14544
14568
|
|
|
14545
14569
|
// src/dashboard/phone-input/PhoneInput.tsx
|
|
14546
14570
|
var import_jsx_runtime158 = require("react/jsx-runtime");
|
|
14547
|
-
var EMPTY_VALUE = { code: "", number: "" };
|
|
14548
14571
|
var PhoneInput = React50.forwardRef(
|
|
14549
14572
|
function PhoneInput2({
|
|
14550
14573
|
options,
|
|
@@ -14578,7 +14601,7 @@ var PhoneInput = React50.forwardRef(
|
|
|
14578
14601
|
const errorMsgId = React50.useId();
|
|
14579
14602
|
const numberInputRef = React50.useRef(null);
|
|
14580
14603
|
const [codeSearchValue, setCodeSearchValue] = React50.useState("");
|
|
14581
|
-
const safeValue = value
|
|
14604
|
+
const safeValue = toPhoneValue(value);
|
|
14582
14605
|
const effectiveCode = safeValue.code || defaultCode || "";
|
|
14583
14606
|
const resolvedLabel = label ?? "";
|
|
14584
14607
|
const hasExternalError = Boolean(error);
|