@undp/carbon-library 1.0.40 → 1.0.41
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/cjs/index.js +12 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +13 -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,25 @@ 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
|
+
throw new Error("Phone Number ".concat(t("isRequired")));
|
1215
|
+
}
|
1207
1216
|
}
|
1208
1217
|
return [2 /*return*/];
|
1209
1218
|
});
|