@undp/carbon-library 1.0.40 → 1.0.42
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +17 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +18 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
@@ -3,7 +3,7 @@ import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message,
|
|
3
3
|
import React, { useState, useEffect, useRef } from 'react';
|
4
4
|
import { DateTime } from 'luxon';
|
5
5
|
import { Buffer } from 'buffer';
|
6
|
-
import PhoneInput, { formatPhoneNumberIntl } from 'react-phone-number-input';
|
6
|
+
import PhoneInput, { formatPhoneNumberIntl, formatPhoneNumber } from 'react-phone-number-input';
|
7
7
|
import validator from 'validator';
|
8
8
|
import { plainToClass } from 'class-transformer';
|
9
9
|
import * as Icon from 'react-bootstrap-icons';
|
@@ -1194,16 +1194,30 @@ var AddNewCompanyComponent = function (props) {
|
|
1194
1194
|
React.createElement(Form.Item, { name: "phoneNo", label: "Phone Number", initialValue: (_g = state === null || state === void 0 ? void 0 : state.record) === null || _g === void 0 ? void 0 : _g.phoneNo, rules: [
|
1195
1195
|
{
|
1196
1196
|
required: true,
|
1197
|
-
message:
|
1197
|
+
message: "",
|
1198
1198
|
},
|
1199
1199
|
{
|
1200
1200
|
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
1201
|
+
var phoneNo;
|
1201
1202
|
return __generator(this, function (_a) {
|
1202
|
-
if (String(value).trim() ===
|
1203
|
+
if (String(value).trim() === "" ||
|
1203
1204
|
String(value).trim() === undefined ||
|
1204
1205
|
value === null ||
|
1205
1206
|
value === undefined) {
|
1206
|
-
throw new Error("Phone Number ".concat(t(
|
1207
|
+
throw new Error("Phone Number ".concat(t("isRequired")));
|
1208
|
+
}
|
1209
|
+
else {
|
1210
|
+
phoneNo = formatPhoneNumber(String(value));
|
1211
|
+
if (phoneNo === null ||
|
1212
|
+
phoneNo === "" ||
|
1213
|
+
phoneNo === undefined) {
|
1214
|
+
if (String(value) !== "") {
|
1215
|
+
throw new Error("Phone Number ".concat(t("isInvalid")));
|
1216
|
+
}
|
1217
|
+
else {
|
1218
|
+
throw new Error("Phone Number ".concat(t("isRequired")));
|
1219
|
+
}
|
1220
|
+
}
|
1207
1221
|
}
|
1208
1222
|
return [2 /*return*/];
|
1209
1223
|
});
|