@undp/carbon-library 1.0.40 → 1.0.41

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -1214,16 +1214,25 @@ var AddNewCompanyComponent = function (props) {
1214
1214
  React.createElement(antd.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: [
1215
1215
  {
1216
1216
  required: true,
1217
- message: '',
1217
+ message: "",
1218
1218
  },
1219
1219
  {
1220
1220
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
1221
+ var phoneNo;
1221
1222
  return __generator(this, function (_a) {
1222
- if (String(value).trim() === '' ||
1223
+ if (String(value).trim() === "" ||
1223
1224
  String(value).trim() === undefined ||
1224
1225
  value === null ||
1225
1226
  value === undefined) {
1226
- throw new Error("Phone Number ".concat(t('isRequired')));
1227
+ throw new Error("Phone Number ".concat(t("isRequired")));
1228
+ }
1229
+ else {
1230
+ phoneNo = PhoneInput.formatPhoneNumber(String(value));
1231
+ if (phoneNo === null ||
1232
+ phoneNo === "" ||
1233
+ phoneNo === undefined) {
1234
+ throw new Error("Phone Number ".concat(t("isRequired")));
1235
+ }
1227
1236
  }
1228
1237
  return [2 /*return*/];
1229
1238
  });