@undp/carbon-library 1.0.299-CARBON-234.1 → 1.0.299-CARBON-443.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import React, { createContext, useState, useEffect, useCallback, useContext, use
4
4
  import { DateTime } from 'luxon';
5
5
  import { Buffer } from 'buffer';
6
6
  import axios, { HttpStatusCode } from 'axios';
7
- import PhoneInput, { formatPhoneNumberIntl, formatPhoneNumber } from 'react-phone-number-input';
7
+ import PhoneInput, { formatPhoneNumberIntl, formatPhoneNumber, isPossiblePhoneNumber } from 'react-phone-number-input';
8
8
  import validator from 'validator';
9
9
  import { plainToClass } from 'class-transformer';
10
10
  import * as Icon from 'react-bootstrap-icons';
@@ -6529,7 +6529,7 @@ var AddNewCompanyComponent = function (props) {
6529
6529
  }); },
6530
6530
  },
6531
6531
  ] },
6532
- React.createElement(Input, { disabled: isUpdate, size: "large" })))
6532
+ React.createElement(Input, { size: "large" })))
6533
6533
  : null,
6534
6534
  companyRole !== CompanyRole.MINISTRY
6535
6535
  ? (!isUpdate ||
@@ -6871,6 +6871,27 @@ var AddNewCompanyComponent = function (props) {
6871
6871
  {
6872
6872
  required: false,
6873
6873
  },
6874
+ {
6875
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
6876
+ var phoneNo;
6877
+ return __generator(this, function (_a) {
6878
+ phoneNo = formatPhoneNumber(String(value));
6879
+ if (String(value).trim() !== "") {
6880
+ if ((String(value).trim() !== "" &&
6881
+ String(value).trim() !== undefined &&
6882
+ value !== null &&
6883
+ value !== undefined) &&
6884
+ (phoneNo !== null &&
6885
+ phoneNo !== "" &&
6886
+ phoneNo !== undefined) &&
6887
+ !isPossiblePhoneNumber(String(value))) {
6888
+ throw new Error("".concat(t("addCompany:phoneNo"), " ").concat(t("isInvalid")));
6889
+ }
6890
+ }
6891
+ return [2 /*return*/];
6892
+ });
6893
+ }); },
6894
+ },
6874
6895
  ] },
6875
6896
  React.createElement(PhoneInput, { placeholder: t("addCompany:phoneNo"), international: true, value: formatPhoneNumberIntl(contactNoInput), defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { } })))),
6876
6897
  React.createElement(Col, { xl: 12, md: 24 },
@@ -15079,6 +15100,27 @@ var AddNewUserComponent = function (props) {
15079
15100
  {
15080
15101
  required: false,
15081
15102
  },
15103
+ {
15104
+ validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
15105
+ var phoneNo;
15106
+ return __generator(this, function (_a) {
15107
+ phoneNo = formatPhoneNumber(String(value));
15108
+ if (String(value).trim() !== "") {
15109
+ if ((String(value).trim() !== "" &&
15110
+ String(value).trim() !== undefined &&
15111
+ value !== null &&
15112
+ value !== undefined) &&
15113
+ (phoneNo !== null &&
15114
+ phoneNo !== "" &&
15115
+ phoneNo !== undefined) &&
15116
+ !isPossiblePhoneNumber(String(value))) {
15117
+ throw new Error("".concat(t("addUser:phoneNo"), " ").concat(t("isInvalid")));
15118
+ }
15119
+ }
15120
+ return [2 /*return*/];
15121
+ });
15122
+ }); },
15123
+ },
15082
15124
  ] },
15083
15125
  React.createElement(PhoneInput, { placeholder: t("addUser:phoneNo"), international: true,
15084
15126
  // value={contactNoInput}