@invoicebox/ui 0.1.0-alpha.72 → 0.1.0-alpha.73
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/components/form/PhoneInput/externalPhoneLogic.d.ts +9 -0
- package/dist/components/form/PhoneInput/externalPhoneLogic.js +33 -0
- package/dist/components/form/PhoneInput/phoneInputLogic.d.ts +0 -4
- package/dist/components/form/PhoneInput/phoneInputLogic.js +2 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TSupportedCountries } from './types';
|
|
2
|
+
declare class ExternalPhoneLogic {
|
|
3
|
+
getIsValidPhone(value: string, countries?: Array<{
|
|
4
|
+
label: string;
|
|
5
|
+
value: TSupportedCountries;
|
|
6
|
+
}>): boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const phoneLogic: ExternalPhoneLogic;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.phoneLogic = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
var _phoneInputLogic = require("./phoneInputLogic");
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
var ExternalPhoneLogic = /*#__PURE__*/function () {
|
|
16
|
+
function ExternalPhoneLogic() {
|
|
17
|
+
_classCallCheck(this, ExternalPhoneLogic);
|
|
18
|
+
}
|
|
19
|
+
_createClass(ExternalPhoneLogic, [{
|
|
20
|
+
key: "getIsValidPhone",
|
|
21
|
+
value: function getIsValidPhone(value, countries) {
|
|
22
|
+
var notFormattedValue = _phoneInputLogic.phoneInputLogic.getOnlyNumbersFromString(value);
|
|
23
|
+
var countrySelectOptions = _phoneInputLogic.phoneInputLogic.getCountriesSelectOptions(countries);
|
|
24
|
+
var currentCountriesPhoneRules = _phoneInputLogic.phoneInputLogic.getCountriesPhoneRules(countrySelectOptions);
|
|
25
|
+
var country = Object.entries(currentCountriesPhoneRules).find(function (item) {
|
|
26
|
+
return _phoneInputLogic.phoneInputLogic.getIsHaveStartSequenceInString(notFormattedValue, item[1].startSubsequence);
|
|
27
|
+
});
|
|
28
|
+
return _phoneInputLogic.phoneInputLogic.getIsValidPhoneInputByCountry(notFormattedValue, country ? country[1] : _constants.allCountriesPhoneRules.RUS);
|
|
29
|
+
}
|
|
30
|
+
}]);
|
|
31
|
+
return ExternalPhoneLogic;
|
|
32
|
+
}();
|
|
33
|
+
var phoneLogic = exports.phoneLogic = new ExternalPhoneLogic();
|
|
@@ -27,8 +27,4 @@ declare class PhoneInputLogic {
|
|
|
27
27
|
getIsNeedChangeCountry(inputValue: string, currentCountry: TCountryRule, newCountry?: [string, TCountryRule]): boolean | "" | undefined;
|
|
28
28
|
}
|
|
29
29
|
export declare const phoneInputLogic: PhoneInputLogic;
|
|
30
|
-
export declare const getIsValidPhone: (value: string, countries?: {
|
|
31
|
-
label: string;
|
|
32
|
-
value: TSupportedCountries;
|
|
33
|
-
}[] | undefined) => boolean;
|
|
34
30
|
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.phoneInputLogic =
|
|
6
|
+
exports.phoneInputLogic = void 0;
|
|
7
7
|
var _types = require("./types");
|
|
8
8
|
var _constants = require("./constants");
|
|
9
9
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -130,5 +130,4 @@ var PhoneInputLogic = /*#__PURE__*/function () {
|
|
|
130
130
|
}]);
|
|
131
131
|
return PhoneInputLogic;
|
|
132
132
|
}();
|
|
133
|
-
var phoneInputLogic = exports.phoneInputLogic = new PhoneInputLogic();
|
|
134
|
-
var getIsValidPhone = exports.getIsValidPhone = phoneInputLogic.getIsValidPhone;
|
|
133
|
+
var phoneInputLogic = exports.phoneInputLogic = new PhoneInputLogic();
|
package/dist/index.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ export type { TProps as TFlagProps, TFlagKey } from './components/common/Flag';
|
|
|
28
28
|
export { CountrySelect } from './components/form/CountrySelect';
|
|
29
29
|
export type { TProps as TCountrySelectProps } from './components/form/CountrySelect';
|
|
30
30
|
export { PhoneInput } from './components/form/PhoneInput';
|
|
31
|
-
export { getIsValidPhone } from './components/form/PhoneInput/phoneInputLogic';
|
|
32
31
|
export type { TProps as TPhoneInputProps } from './components/form/PhoneInput';
|
|
32
|
+
export { phoneLogic } from './components/form/PhoneInput/externalPhoneLogic';
|
|
33
33
|
export { PaletteProvider } from './palette';
|
|
34
34
|
export type { TAbstractPalette } from './palette';
|
|
35
35
|
export { useOutsideClick } from './hooks/useOutsideClick';
|
package/dist/index.js
CHANGED
|
@@ -129,10 +129,10 @@ Object.defineProperty(exports, "WarningIcon", {
|
|
|
129
129
|
return _WarningIcon.WarningIcon;
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
-
Object.defineProperty(exports, "
|
|
132
|
+
Object.defineProperty(exports, "phoneLogic", {
|
|
133
133
|
enumerable: true,
|
|
134
134
|
get: function get() {
|
|
135
|
-
return
|
|
135
|
+
return _externalPhoneLogic.phoneLogic;
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
Object.defineProperty(exports, "useInputFocus", {
|
|
@@ -167,7 +167,7 @@ var _SearchInput = require("./components/form/SearchInput");
|
|
|
167
167
|
var _Flag = require("./components/common/Flag");
|
|
168
168
|
var _CountrySelect = require("./components/form/CountrySelect");
|
|
169
169
|
var _PhoneInput = require("./components/form/PhoneInput");
|
|
170
|
-
var
|
|
170
|
+
var _externalPhoneLogic = require("./components/form/PhoneInput/externalPhoneLogic");
|
|
171
171
|
var _palette = require("./palette");
|
|
172
172
|
var _useOutsideClick = require("./hooks/useOutsideClick");
|
|
173
173
|
var _useInputFocus = require("./hooks/useInputFocus");
|