@helpdice/ui 2.1.5 → 2.1.9
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/auto-complete/index.js +2158 -17
- package/dist/button/button.d.ts +1 -1
- package/dist/button/index.js +73 -16
- package/dist/button/styles.d.ts +1 -0
- package/dist/carousal/index.js +73 -16
- package/dist/container/box.d.ts +42 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/container/index.js +948 -0
- package/dist/copy-to-clipboard/clipboard.d.ts +14 -0
- package/dist/copy-to-clipboard/copy.d.ts +2 -0
- package/dist/copy-to-clipboard/index.d.ts +2 -0
- package/dist/copy-to-clipboard/index.js +1702 -0
- package/dist/copy-to-clipboard/toggle-selection.d.ts +1 -0
- package/dist/grid/index.d.ts +2 -3
- package/dist/grid/index.js +0 -1
- package/dist/html-renderer/index.js +35 -12
- package/dist/index.d.ts +6 -6
- package/dist/index.js +15776 -15418
- package/dist/input/index.d.ts +4 -0
- package/dist/input/index.js +2162 -18
- package/dist/input/input-props.d.ts +1 -0
- package/dist/input/phone-input/phone.d.ts +13 -0
- package/dist/modal/index.js +73 -16
- package/dist/notetip/index.js +690 -0
- package/{esm/notetip/index.d.ts → dist/notetip/note-tip.d.ts} +2 -2
- package/dist/placeholder/index.js +643 -8
- package/dist/table/index.js +4370 -2163
- package/dist/text/child.d.ts +1 -0
- package/dist/text/index.js +686 -8
- package/dist/text/text.d.ts +1 -0
- package/esm/button/button.d.ts +1 -1
- package/esm/button/button.js +51 -5
- package/esm/button/styles.d.ts +1 -0
- package/esm/button/styles.js +22 -11
- package/esm/container/box.d.ts +42 -0
- package/esm/container/box.js +39 -0
- package/esm/container/index.d.ts +2 -0
- package/esm/container/index.js +2 -0
- package/esm/copy-to-clipboard/clipboard.d.ts +14 -0
- package/esm/copy-to-clipboard/clipboard.js +91 -0
- package/esm/copy-to-clipboard/copy.d.ts +2 -0
- package/esm/copy-to-clipboard/copy.js +105 -0
- package/esm/copy-to-clipboard/index.d.ts +2 -0
- package/esm/copy-to-clipboard/index.js +2 -0
- package/esm/copy-to-clipboard/toggle-selection.d.ts +1 -0
- package/esm/copy-to-clipboard/toggle-selection.js +31 -0
- package/esm/grid/index.d.ts +2 -3
- package/esm/grid/index.js +5 -3
- package/esm/index.d.ts +6 -6
- package/esm/index.js +7 -5
- package/esm/input/index.d.ts +4 -0
- package/esm/input/index.js +4 -0
- package/esm/input/input-field.js +12 -10
- package/esm/input/input-props.d.ts +1 -0
- package/esm/input/phone-input/phone.d.ts +13 -0
- package/esm/input/phone-input/phone.js +166 -0
- package/esm/notetip/index.js +2 -97
- package/{dist/notetip/index.d.ts → esm/notetip/note-tip.d.ts} +2 -2
- package/esm/notetip/note-tip.js +97 -0
- package/esm/table/table-body.js +2 -2
- package/esm/table/table-cell.js +1 -1
- package/esm/table/table-head.js +4 -2
- package/esm/table/table.js +0 -1
- package/esm/text/child.d.ts +1 -0
- package/esm/text/text.d.ts +1 -0
- package/esm/text/text.js +25 -3
- package/package.json +19 -19
- package/dist/currency-input/index.js +0 -862
- package/dist/phone-input/index.js +0 -2033
- package/dist/phone-input/phone.d.ts +0 -11
- package/esm/phone-input/phone.d.ts +0 -11
- package/esm/phone-input/phone.js +0 -161
- /package/dist/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/index.d.ts +0 -0
- /package/dist/{phone-input → input/phone-input}/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/addSeparators.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/index.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.js +0 -0
- /package/esm/{currency-input → input/currency-input}/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/index.js +0 -0
- /package/esm/{phone-input → input/phone-input}/index.d.ts +0 -0
- /package/esm/{phone-input → input/phone-input}/index.js +0 -0
package/dist/input/index.js
CHANGED
|
@@ -13,6 +13,9 @@ function _arrayLikeToArray(r, a) {
|
|
|
13
13
|
function _arrayWithHoles(r) {
|
|
14
14
|
if (Array.isArray(r)) return r;
|
|
15
15
|
}
|
|
16
|
+
function _arrayWithoutHoles(r) {
|
|
17
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
18
|
+
}
|
|
16
19
|
function _createForOfIteratorHelper(r, e) {
|
|
17
20
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
18
21
|
if (!t) {
|
|
@@ -78,6 +81,9 @@ function _extends() {
|
|
|
78
81
|
return n;
|
|
79
82
|
}, _extends.apply(null, arguments);
|
|
80
83
|
}
|
|
84
|
+
function _iterableToArray(r) {
|
|
85
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
86
|
+
}
|
|
81
87
|
function _iterableToArrayLimit(r, l) {
|
|
82
88
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
83
89
|
if (null != t) {
|
|
@@ -89,7 +95,10 @@ function _iterableToArrayLimit(r, l) {
|
|
|
89
95
|
f = true,
|
|
90
96
|
o = false;
|
|
91
97
|
try {
|
|
92
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
98
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
99
|
+
if (Object(t) !== t) return;
|
|
100
|
+
f = !1;
|
|
101
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
93
102
|
} catch (r) {
|
|
94
103
|
o = true, n = r;
|
|
95
104
|
} finally {
|
|
@@ -105,6 +114,9 @@ function _iterableToArrayLimit(r, l) {
|
|
|
105
114
|
function _nonIterableRest() {
|
|
106
115
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
107
116
|
}
|
|
117
|
+
function _nonIterableSpread() {
|
|
118
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
119
|
+
}
|
|
108
120
|
function ownKeys(e, r) {
|
|
109
121
|
var t = Object.keys(e);
|
|
110
122
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -149,6 +161,9 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
149
161
|
function _slicedToArray(r, e) {
|
|
150
162
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
151
163
|
}
|
|
164
|
+
function _toConsumableArray(r) {
|
|
165
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
166
|
+
}
|
|
152
167
|
function _toPrimitive(t, r) {
|
|
153
168
|
if ("object" != typeof t || !t) return t;
|
|
154
169
|
var e = t[Symbol.toPrimitive];
|
|
@@ -916,7 +931,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
916
931
|
return getAllScaleProps;
|
|
917
932
|
};
|
|
918
933
|
|
|
919
|
-
var _excluded$
|
|
934
|
+
var _excluded$4 = ["children"];
|
|
920
935
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
921
936
|
if (scale === 1) return scale;
|
|
922
937
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -926,7 +941,7 @@ var withScale = function withScale(Render) {
|
|
|
926
941
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
927
942
|
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31;
|
|
928
943
|
var children = _ref.children,
|
|
929
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
944
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
930
945
|
var _useTheme = theme.useTheme(),
|
|
931
946
|
layout = _useTheme.layout;
|
|
932
947
|
var paddingLeft = props.paddingLeft,
|
|
@@ -1009,7 +1024,7 @@ var withScale = function withScale(Render) {
|
|
|
1009
1024
|
return ScaleFC;
|
|
1010
1025
|
};
|
|
1011
1026
|
|
|
1012
|
-
var _excluded$
|
|
1027
|
+
var _excluded$3 = ["label", "labelRight", "color", "error", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "autoComplete", "placeholder", "children", "disabled", "fullWidth"];
|
|
1013
1028
|
var simulateChangeEvent = function simulateChangeEvent(el, event) {
|
|
1014
1029
|
return _objectSpread2(_objectSpread2({}, event), {}, {
|
|
1015
1030
|
target: el,
|
|
@@ -1025,6 +1040,8 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1025
1040
|
_ref$type = _ref.type,
|
|
1026
1041
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1027
1042
|
icon = _ref.icon,
|
|
1043
|
+
_ref$variant = _ref.variant,
|
|
1044
|
+
variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
|
|
1028
1045
|
iconRight = _ref.iconRight,
|
|
1029
1046
|
_ref$iconClickable = _ref.iconClickable,
|
|
1030
1047
|
iconClickable = _ref$iconClickable === void 0 ? false : _ref$iconClickable,
|
|
@@ -1051,7 +1068,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1051
1068
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1052
1069
|
_ref$fullWidth = _ref.fullWidth,
|
|
1053
1070
|
fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
|
|
1054
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1071
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1055
1072
|
var theme$1 = theme.useTheme();
|
|
1056
1073
|
var _useScale = useScale(),
|
|
1057
1074
|
SCALES = _useScale.SCALES;
|
|
@@ -1129,11 +1146,11 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1129
1146
|
var inputProps = _objectSpread2(_objectSpread2({}, props), controlledValue);
|
|
1130
1147
|
var defaultWidth = fullWidth ? '100%' : 'initial';
|
|
1131
1148
|
return /*#__PURE__*/React.createElement("div", {
|
|
1132
|
-
className: _JSXStyle.dynamic([["
|
|
1149
|
+
className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + "with-label"
|
|
1133
1150
|
}, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement("div", {
|
|
1134
|
-
className: _JSXStyle.dynamic([["
|
|
1151
|
+
className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (theme.useClasses('input-container', className) || "")
|
|
1135
1152
|
}, label && /*#__PURE__*/React.createElement(MemoInputLabel, null, label), /*#__PURE__*/React.createElement("div", {
|
|
1136
|
-
className: _JSXStyle.dynamic([["
|
|
1153
|
+
className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (theme.useClasses('input-wrapper', {
|
|
1137
1154
|
hover: hover,
|
|
1138
1155
|
disabled: disabled
|
|
1139
1156
|
}, labelClasses) || "")
|
|
@@ -1150,7 +1167,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1150
1167
|
onChange: changeHandler,
|
|
1151
1168
|
autoComplete: autoComplete
|
|
1152
1169
|
}, inputProps, {
|
|
1153
|
-
className: _JSXStyle.dynamic([["
|
|
1170
|
+
className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || theme.useClasses({
|
|
1154
1171
|
disabled: disabled
|
|
1155
1172
|
}, iconClasses) || "")
|
|
1156
1173
|
})), clearable && /*#__PURE__*/React.createElement(MemoInputIconClear, {
|
|
@@ -1162,7 +1179,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1162
1179
|
}, iconProps))), labelRight && /*#__PURE__*/React.createElement(MemoInputLabel, {
|
|
1163
1180
|
isRight: true
|
|
1164
1181
|
}, labelRight), /*#__PURE__*/React.createElement("br", {
|
|
1165
|
-
className: _JSXStyle.dynamic([["
|
|
1182
|
+
className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme$1.palette.accents_3, theme$1.palette.background, color]]])
|
|
1166
1183
|
})), error && /*#__PURE__*/React.createElement("p", {
|
|
1167
1184
|
style: {
|
|
1168
1185
|
marginTop: 0.4,
|
|
@@ -1171,11 +1188,11 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1171
1188
|
marginBottom: '0.4rem',
|
|
1172
1189
|
textAlign: 'left'
|
|
1173
1190
|
},
|
|
1174
|
-
className: _JSXStyle.dynamic([["
|
|
1191
|
+
className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme$1.palette.accents_3, theme$1.palette.background, color]]]) + " " + "input-error"
|
|
1175
1192
|
}, error), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
1176
|
-
id: "
|
|
1177
|
-
dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), theme$1.layout.radius, borderColor, theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme$1.palette.accents_3, theme$1.palette.background, color]
|
|
1178
|
-
}, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, defaultWidth), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.input-error.__jsx-style-dynamic-selector{color:#aa4a44;}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, defaultWidth), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(theme$1.layout.radius, ";border:1px solid ").concat(borderColor, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme$1.palette.accents_1, ";border-color:").concat(theme$1.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(color, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme$1.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")));
|
|
1193
|
+
id: "3970712841",
|
|
1194
|
+
dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme$1.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme$1.palette.accents_1, theme$1.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme$1.palette.accents_3, theme$1.palette.background, color]
|
|
1195
|
+
}, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, defaultWidth), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.input-error.__jsx-style-dynamic-selector{color:#aa4a44;}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, defaultWidth), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(variant === 'normal' ? theme$1.layout.radius : '', ";").concat(variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme$1.palette.accents_1, ";border-color:").concat(theme$1.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(color, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme$1.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme$1.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")));
|
|
1179
1196
|
});
|
|
1180
1197
|
InputComponent.displayName = 'Input';
|
|
1181
1198
|
var Input = withScale(InputComponent);
|
|
@@ -1195,7 +1212,7 @@ tuple('hover', 'click');
|
|
|
1195
1212
|
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
1196
1213
|
tuple('start', 'center', 'end', 'left', 'right');
|
|
1197
1214
|
|
|
1198
|
-
var _excluded$
|
|
1215
|
+
var _excluded$2 = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "resize"];
|
|
1199
1216
|
tuple('none', 'both', 'horizontal', 'vertical', 'initial', 'inherit');
|
|
1200
1217
|
var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1201
1218
|
var _ref$type = _ref.type,
|
|
@@ -1215,7 +1232,7 @@ var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1215
1232
|
placeholder = _ref.placeholder,
|
|
1216
1233
|
_ref$resize = _ref.resize,
|
|
1217
1234
|
resize = _ref$resize === void 0 ? 'none' : _ref$resize,
|
|
1218
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1235
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1219
1236
|
var theme$1 = theme.useTheme();
|
|
1220
1237
|
var _useScale = useScale(),
|
|
1221
1238
|
SCALES = _useScale.SCALES;
|
|
@@ -1315,11 +1332,11 @@ var PasswordIcon = function PasswordIcon(_ref) {
|
|
|
1315
1332
|
};
|
|
1316
1333
|
var MemoPasswordIcon = /*#__PURE__*/React.memo(PasswordIcon);
|
|
1317
1334
|
|
|
1318
|
-
var _excluded = ["hideToggle", "children"];
|
|
1335
|
+
var _excluded$1 = ["hideToggle", "children"];
|
|
1319
1336
|
var InputPasswordComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1320
1337
|
var hideToggle = _ref.hideToggle,
|
|
1321
1338
|
children = _ref.children,
|
|
1322
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
1339
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
1323
1340
|
var _useScale = useScale(),
|
|
1324
1341
|
getAllScaleProps = _useScale.getAllScaleProps;
|
|
1325
1342
|
var inputRef = React.useRef(null);
|
|
@@ -1361,9 +1378,2136 @@ var InputPasswordComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
1361
1378
|
InputPasswordComponent.displayName = 'InputPassword';
|
|
1362
1379
|
var InputPassword = withScale(InputPasswordComponent);
|
|
1363
1380
|
|
|
1381
|
+
var countries = [
|
|
1382
|
+
{
|
|
1383
|
+
code: "AD",
|
|
1384
|
+
label: "Andorra",
|
|
1385
|
+
phone: "+376"
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
code: "AE",
|
|
1389
|
+
label: "United Arab Emirates",
|
|
1390
|
+
phone: "+971"
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
code: "AF",
|
|
1394
|
+
label: "Afghanistan",
|
|
1395
|
+
phone: "+93"
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
code: "AG",
|
|
1399
|
+
label: "Antigua and Barbuda",
|
|
1400
|
+
phone: "+1-268"
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
code: "AI",
|
|
1404
|
+
label: "Anguilla",
|
|
1405
|
+
phone: "+1-264"
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
code: "AL",
|
|
1409
|
+
label: "Albania",
|
|
1410
|
+
phone: "+355"
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
code: "AM",
|
|
1414
|
+
label: "Armenia",
|
|
1415
|
+
phone: "+374"
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
code: "AO",
|
|
1419
|
+
label: "Angola",
|
|
1420
|
+
phone: "+244"
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
code: "AQ",
|
|
1424
|
+
label: "Antarctica",
|
|
1425
|
+
phone: "+672"
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
code: "AR",
|
|
1429
|
+
label: "Argentina",
|
|
1430
|
+
phone: "+54"
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
code: "AS",
|
|
1434
|
+
label: "American Samoa",
|
|
1435
|
+
phone: "+1-684"
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
code: "AT",
|
|
1439
|
+
label: "Austria",
|
|
1440
|
+
phone: "+43"
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
code: "AU",
|
|
1444
|
+
label: "Australia",
|
|
1445
|
+
phone: "+61",
|
|
1446
|
+
suggested: true
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
code: "AW",
|
|
1450
|
+
label: "Aruba",
|
|
1451
|
+
phone: "+297"
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
code: "AX",
|
|
1455
|
+
label: "Alland Islands",
|
|
1456
|
+
phone: "+358"
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
code: "AZ",
|
|
1460
|
+
label: "Azerbaijan",
|
|
1461
|
+
phone: "+994"
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
code: "BA",
|
|
1465
|
+
label: "Bosnia and Herzegovina",
|
|
1466
|
+
phone: "+387"
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
code: "BB",
|
|
1470
|
+
label: "Barbados",
|
|
1471
|
+
phone: "+1-246"
|
|
1472
|
+
},
|
|
1473
|
+
{
|
|
1474
|
+
code: "BD",
|
|
1475
|
+
label: "Bangladesh",
|
|
1476
|
+
phone: "+880"
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
code: "BE",
|
|
1480
|
+
label: "Belgium",
|
|
1481
|
+
phone: "+32"
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
code: "BF",
|
|
1485
|
+
label: "Burkina Faso",
|
|
1486
|
+
phone: "+226"
|
|
1487
|
+
},
|
|
1488
|
+
{
|
|
1489
|
+
code: "BG",
|
|
1490
|
+
label: "Bulgaria",
|
|
1491
|
+
phone: "+359"
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
code: "BH",
|
|
1495
|
+
label: "Bahrain",
|
|
1496
|
+
phone: "+973"
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
code: "BI",
|
|
1500
|
+
label: "Burundi",
|
|
1501
|
+
phone: "+257"
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
code: "BJ",
|
|
1505
|
+
label: "Benin",
|
|
1506
|
+
phone: "+229"
|
|
1507
|
+
},
|
|
1508
|
+
{
|
|
1509
|
+
code: "BL",
|
|
1510
|
+
label: "Saint Barthelemy",
|
|
1511
|
+
phone: "+590"
|
|
1512
|
+
},
|
|
1513
|
+
{
|
|
1514
|
+
code: "BM",
|
|
1515
|
+
label: "Bermuda",
|
|
1516
|
+
phone: "+1-441"
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
code: "BN",
|
|
1520
|
+
label: "Brunei Darussalam",
|
|
1521
|
+
phone: "+673"
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
code: "BO",
|
|
1525
|
+
label: "Bolivia",
|
|
1526
|
+
phone: "+591"
|
|
1527
|
+
},
|
|
1528
|
+
{
|
|
1529
|
+
code: "BR",
|
|
1530
|
+
label: "Brazil",
|
|
1531
|
+
phone: "+55"
|
|
1532
|
+
},
|
|
1533
|
+
{
|
|
1534
|
+
code: "BS",
|
|
1535
|
+
label: "Bahamas",
|
|
1536
|
+
phone: "+1-242"
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
code: "BT",
|
|
1540
|
+
label: "Bhutan",
|
|
1541
|
+
phone: "+975"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
code: "BV",
|
|
1545
|
+
label: "Bouvet Island",
|
|
1546
|
+
phone: "+47"
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
code: "BW",
|
|
1550
|
+
label: "Botswana",
|
|
1551
|
+
phone: "+267"
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
code: "BY",
|
|
1555
|
+
label: "Belarus",
|
|
1556
|
+
phone: "+375"
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
code: "BZ",
|
|
1560
|
+
label: "Belize",
|
|
1561
|
+
phone: "+501"
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
code: "CA",
|
|
1565
|
+
label: "Canada",
|
|
1566
|
+
phone: "+1",
|
|
1567
|
+
suggested: true
|
|
1568
|
+
},
|
|
1569
|
+
{
|
|
1570
|
+
code: "CC",
|
|
1571
|
+
label: "Cocos (Keeling) Islands",
|
|
1572
|
+
phone: "+61"
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
code: "CD",
|
|
1576
|
+
label: "Congo, Democratic Republic of the",
|
|
1577
|
+
phone: "+243"
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
code: "CF",
|
|
1581
|
+
label: "Central African Republic",
|
|
1582
|
+
phone: "+236"
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
code: "CG",
|
|
1586
|
+
label: "Congo, Republic of the",
|
|
1587
|
+
phone: "+242"
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
code: "CH",
|
|
1591
|
+
label: "Switzerland",
|
|
1592
|
+
phone: "+41"
|
|
1593
|
+
},
|
|
1594
|
+
{
|
|
1595
|
+
code: "CI",
|
|
1596
|
+
label: "Cote d'Ivoire",
|
|
1597
|
+
phone: "+225"
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
code: "CK",
|
|
1601
|
+
label: "Cook Islands",
|
|
1602
|
+
phone: "+682"
|
|
1603
|
+
},
|
|
1604
|
+
{
|
|
1605
|
+
code: "CL",
|
|
1606
|
+
label: "Chile",
|
|
1607
|
+
phone: "+56"
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
code: "CM",
|
|
1611
|
+
label: "Cameroon",
|
|
1612
|
+
phone: "+237"
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
code: "CN",
|
|
1616
|
+
label: "China",
|
|
1617
|
+
phone: "+86"
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
code: "CO",
|
|
1621
|
+
label: "Colombia",
|
|
1622
|
+
phone: "+57"
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
code: "CR",
|
|
1626
|
+
label: "Costa Rica",
|
|
1627
|
+
phone: "+506"
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
code: "CU",
|
|
1631
|
+
label: "Cuba",
|
|
1632
|
+
phone: "+53"
|
|
1633
|
+
},
|
|
1634
|
+
{
|
|
1635
|
+
code: "CV",
|
|
1636
|
+
label: "Cape Verde",
|
|
1637
|
+
phone: "+238"
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
code: "CW",
|
|
1641
|
+
label: "Curacao",
|
|
1642
|
+
phone: "+599"
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
code: "CX",
|
|
1646
|
+
label: "Christmas Island",
|
|
1647
|
+
phone: "+61"
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
code: "CY",
|
|
1651
|
+
label: "Cyprus",
|
|
1652
|
+
phone: "+357"
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
code: "CZ",
|
|
1656
|
+
label: "Czech Republic",
|
|
1657
|
+
phone: "+420"
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
code: "DE",
|
|
1661
|
+
label: "Germany",
|
|
1662
|
+
phone: "+49",
|
|
1663
|
+
suggested: true
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
code: "DJ",
|
|
1667
|
+
label: "Djibouti",
|
|
1668
|
+
phone: "+253"
|
|
1669
|
+
},
|
|
1670
|
+
{
|
|
1671
|
+
code: "DK",
|
|
1672
|
+
label: "Denmark",
|
|
1673
|
+
phone: "+45"
|
|
1674
|
+
},
|
|
1675
|
+
{
|
|
1676
|
+
code: "DM",
|
|
1677
|
+
label: "Dominica",
|
|
1678
|
+
phone: "+1-767"
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
code: "DO",
|
|
1682
|
+
label: "Dominican Republic",
|
|
1683
|
+
phone: "+1-809"
|
|
1684
|
+
},
|
|
1685
|
+
{
|
|
1686
|
+
code: "DZ",
|
|
1687
|
+
label: "Algeria",
|
|
1688
|
+
phone: "+213"
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
code: "EC",
|
|
1692
|
+
label: "Ecuador",
|
|
1693
|
+
phone: "+593"
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
code: "EE",
|
|
1697
|
+
label: "Estonia",
|
|
1698
|
+
phone: "+372"
|
|
1699
|
+
},
|
|
1700
|
+
{
|
|
1701
|
+
code: "EG",
|
|
1702
|
+
label: "Egypt",
|
|
1703
|
+
phone: "+20"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
code: "EH",
|
|
1707
|
+
label: "Western Sahara",
|
|
1708
|
+
phone: "+212"
|
|
1709
|
+
},
|
|
1710
|
+
{
|
|
1711
|
+
code: "ER",
|
|
1712
|
+
label: "Eritrea",
|
|
1713
|
+
phone: "+291"
|
|
1714
|
+
},
|
|
1715
|
+
{
|
|
1716
|
+
code: "ES",
|
|
1717
|
+
label: "Spain",
|
|
1718
|
+
phone: "+34"
|
|
1719
|
+
},
|
|
1720
|
+
{
|
|
1721
|
+
code: "ET",
|
|
1722
|
+
label: "Ethiopia",
|
|
1723
|
+
phone: "+251"
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
code: "FI",
|
|
1727
|
+
label: "Finland",
|
|
1728
|
+
phone: "+358"
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
code: "FJ",
|
|
1732
|
+
label: "Fiji",
|
|
1733
|
+
phone: "+679"
|
|
1734
|
+
},
|
|
1735
|
+
{
|
|
1736
|
+
code: "FK",
|
|
1737
|
+
label: "Falkland Islands (Malvinas)",
|
|
1738
|
+
phone: "+500"
|
|
1739
|
+
},
|
|
1740
|
+
{
|
|
1741
|
+
code: "FM",
|
|
1742
|
+
label: "Micronesia, Federated States of",
|
|
1743
|
+
phone: "+691"
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
code: "FO",
|
|
1747
|
+
label: "Faroe Islands",
|
|
1748
|
+
phone: "+298"
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
code: "FR",
|
|
1752
|
+
label: "France",
|
|
1753
|
+
phone: "+33",
|
|
1754
|
+
suggested: true
|
|
1755
|
+
},
|
|
1756
|
+
{
|
|
1757
|
+
code: "GA",
|
|
1758
|
+
label: "Gabon",
|
|
1759
|
+
phone: "+241"
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
code: "GB",
|
|
1763
|
+
label: "United Kingdom",
|
|
1764
|
+
phone: "+44"
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
code: "GD",
|
|
1768
|
+
label: "Grenada",
|
|
1769
|
+
phone: "+1-473"
|
|
1770
|
+
},
|
|
1771
|
+
{
|
|
1772
|
+
code: "GE",
|
|
1773
|
+
label: "Georgia",
|
|
1774
|
+
phone: "+995"
|
|
1775
|
+
},
|
|
1776
|
+
{
|
|
1777
|
+
code: "GF",
|
|
1778
|
+
label: "French Guiana",
|
|
1779
|
+
phone: "+594"
|
|
1780
|
+
},
|
|
1781
|
+
{
|
|
1782
|
+
code: "GG",
|
|
1783
|
+
label: "Guernsey",
|
|
1784
|
+
phone: "+44"
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
code: "GH",
|
|
1788
|
+
label: "Ghana",
|
|
1789
|
+
phone: "+233"
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
code: "GI",
|
|
1793
|
+
label: "Gibraltar",
|
|
1794
|
+
phone: "+350"
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
code: "GL",
|
|
1798
|
+
label: "Greenland",
|
|
1799
|
+
phone: "+299"
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
code: "GM",
|
|
1803
|
+
label: "Gambia",
|
|
1804
|
+
phone: "+220"
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
code: "GN",
|
|
1808
|
+
label: "Guinea",
|
|
1809
|
+
phone: "+224"
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
code: "GP",
|
|
1813
|
+
label: "Guadeloupe",
|
|
1814
|
+
phone: "+590"
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
code: "GQ",
|
|
1818
|
+
label: "Equatorial Guinea",
|
|
1819
|
+
phone: "+240"
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
code: "GR",
|
|
1823
|
+
label: "Greece",
|
|
1824
|
+
phone: "+30"
|
|
1825
|
+
},
|
|
1826
|
+
{
|
|
1827
|
+
code: "GS",
|
|
1828
|
+
label: "South Georgia and the South Sandwich Islands",
|
|
1829
|
+
phone: "+500"
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
code: "GT",
|
|
1833
|
+
label: "Guatemala",
|
|
1834
|
+
phone: "+502"
|
|
1835
|
+
},
|
|
1836
|
+
{
|
|
1837
|
+
code: "GU",
|
|
1838
|
+
label: "Guam",
|
|
1839
|
+
phone: "+1-671"
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
code: "GW",
|
|
1843
|
+
label: "Guinea-Bissau",
|
|
1844
|
+
phone: "+245"
|
|
1845
|
+
},
|
|
1846
|
+
{
|
|
1847
|
+
code: "GY",
|
|
1848
|
+
label: "Guyana",
|
|
1849
|
+
phone: "+592"
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
code: "HK",
|
|
1853
|
+
label: "Hong Kong",
|
|
1854
|
+
phone: "+852"
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
code: "HM",
|
|
1858
|
+
label: "Heard Island and McDonald Islands",
|
|
1859
|
+
phone: "+672"
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
code: "HN",
|
|
1863
|
+
label: "Honduras",
|
|
1864
|
+
phone: "+504"
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
code: "HR",
|
|
1868
|
+
label: "Croatia",
|
|
1869
|
+
phone: "+385"
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
code: "HT",
|
|
1873
|
+
label: "Haiti",
|
|
1874
|
+
phone: "+509"
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
code: "HU",
|
|
1878
|
+
label: "Hungary",
|
|
1879
|
+
phone: "+36"
|
|
1880
|
+
},
|
|
1881
|
+
{
|
|
1882
|
+
code: "ID",
|
|
1883
|
+
label: "Indonesia",
|
|
1884
|
+
phone: "+62"
|
|
1885
|
+
},
|
|
1886
|
+
{
|
|
1887
|
+
code: "IE",
|
|
1888
|
+
label: "Ireland",
|
|
1889
|
+
phone: "+353"
|
|
1890
|
+
},
|
|
1891
|
+
{
|
|
1892
|
+
code: "IL",
|
|
1893
|
+
label: "Israel",
|
|
1894
|
+
phone: "+972"
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
code: "IM",
|
|
1898
|
+
label: "Isle of Man",
|
|
1899
|
+
phone: "+44"
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
code: "IN",
|
|
1903
|
+
label: "India",
|
|
1904
|
+
phone: "+91"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
code: "IO",
|
|
1908
|
+
label: "British Indian Ocean Territory",
|
|
1909
|
+
phone: "+246"
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
code: "IQ",
|
|
1913
|
+
label: "Iraq",
|
|
1914
|
+
phone: "+964"
|
|
1915
|
+
},
|
|
1916
|
+
{
|
|
1917
|
+
code: "IR",
|
|
1918
|
+
label: "Iran, Islamic Republic of",
|
|
1919
|
+
phone: "+98"
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
code: "IS",
|
|
1923
|
+
label: "Iceland",
|
|
1924
|
+
phone: "+354"
|
|
1925
|
+
},
|
|
1926
|
+
{
|
|
1927
|
+
code: "IT",
|
|
1928
|
+
label: "Italy",
|
|
1929
|
+
phone: "+39"
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
code: "JE",
|
|
1933
|
+
label: "Jersey",
|
|
1934
|
+
phone: "+44"
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
code: "JM",
|
|
1938
|
+
label: "Jamaica",
|
|
1939
|
+
phone: "+1-876"
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
code: "JO",
|
|
1943
|
+
label: "Jordan",
|
|
1944
|
+
phone: "+962"
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
code: "JP",
|
|
1948
|
+
label: "Japan",
|
|
1949
|
+
phone: "+81",
|
|
1950
|
+
suggested: true
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
code: "KE",
|
|
1954
|
+
label: "Kenya",
|
|
1955
|
+
phone: "+254"
|
|
1956
|
+
},
|
|
1957
|
+
{
|
|
1958
|
+
code: "KG",
|
|
1959
|
+
label: "Kyrgyzstan",
|
|
1960
|
+
phone: "+996"
|
|
1961
|
+
},
|
|
1962
|
+
{
|
|
1963
|
+
code: "KH",
|
|
1964
|
+
label: "Cambodia",
|
|
1965
|
+
phone: "+855"
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
code: "KI",
|
|
1969
|
+
label: "Kiribati",
|
|
1970
|
+
phone: "+686"
|
|
1971
|
+
},
|
|
1972
|
+
{
|
|
1973
|
+
code: "KM",
|
|
1974
|
+
label: "Comoros",
|
|
1975
|
+
phone: "+269"
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
code: "KN",
|
|
1979
|
+
label: "Saint Kitts and Nevis",
|
|
1980
|
+
phone: "+1-869"
|
|
1981
|
+
},
|
|
1982
|
+
{
|
|
1983
|
+
code: "KP",
|
|
1984
|
+
label: "Korea, Democratic People's Republic of",
|
|
1985
|
+
phone: "+850"
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
code: "KR",
|
|
1989
|
+
label: "Korea, Republic of",
|
|
1990
|
+
phone: "+82"
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
code: "KW",
|
|
1994
|
+
label: "Kuwait",
|
|
1995
|
+
phone: "+965"
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
code: "KY",
|
|
1999
|
+
label: "Cayman Islands",
|
|
2000
|
+
phone: "+1-345"
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
code: "KZ",
|
|
2004
|
+
label: "Kazakhstan",
|
|
2005
|
+
phone: "+7"
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
code: "LA",
|
|
2009
|
+
label: "Lao People's Democratic Republic",
|
|
2010
|
+
phone: "+856"
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
code: "LB",
|
|
2014
|
+
label: "Lebanon",
|
|
2015
|
+
phone: "+961"
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
code: "LC",
|
|
2019
|
+
label: "Saint Lucia",
|
|
2020
|
+
phone: "+1-758"
|
|
2021
|
+
},
|
|
2022
|
+
{
|
|
2023
|
+
code: "LI",
|
|
2024
|
+
label: "Liechtenstein",
|
|
2025
|
+
phone: "+423"
|
|
2026
|
+
},
|
|
2027
|
+
{
|
|
2028
|
+
code: "LK",
|
|
2029
|
+
label: "Sri Lanka",
|
|
2030
|
+
phone: "+94"
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
code: "LR",
|
|
2034
|
+
label: "Liberia",
|
|
2035
|
+
phone: "+231"
|
|
2036
|
+
},
|
|
2037
|
+
{
|
|
2038
|
+
code: "LS",
|
|
2039
|
+
label: "Lesotho",
|
|
2040
|
+
phone: "+266"
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
code: "LT",
|
|
2044
|
+
label: "Lithuania",
|
|
2045
|
+
phone: "+370"
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
code: "LU",
|
|
2049
|
+
label: "Luxembourg",
|
|
2050
|
+
phone: "+352"
|
|
2051
|
+
},
|
|
2052
|
+
{
|
|
2053
|
+
code: "LV",
|
|
2054
|
+
label: "Latvia",
|
|
2055
|
+
phone: "+371"
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
code: "LY",
|
|
2059
|
+
label: "Libya",
|
|
2060
|
+
phone: "+218"
|
|
2061
|
+
},
|
|
2062
|
+
{
|
|
2063
|
+
code: "MA",
|
|
2064
|
+
label: "Morocco",
|
|
2065
|
+
phone: "+212"
|
|
2066
|
+
},
|
|
2067
|
+
{
|
|
2068
|
+
code: "MC",
|
|
2069
|
+
label: "Monaco",
|
|
2070
|
+
phone: "+377"
|
|
2071
|
+
},
|
|
2072
|
+
{
|
|
2073
|
+
code: "MD",
|
|
2074
|
+
label: "Moldova, Republic of",
|
|
2075
|
+
phone: "+373"
|
|
2076
|
+
},
|
|
2077
|
+
{
|
|
2078
|
+
code: "ME",
|
|
2079
|
+
label: "Montenegro",
|
|
2080
|
+
phone: "+382"
|
|
2081
|
+
},
|
|
2082
|
+
{
|
|
2083
|
+
code: "MF",
|
|
2084
|
+
label: "Saint Martin (French part)",
|
|
2085
|
+
phone: "+590"
|
|
2086
|
+
},
|
|
2087
|
+
{
|
|
2088
|
+
code: "MG",
|
|
2089
|
+
label: "Madagascar",
|
|
2090
|
+
phone: "+261"
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
code: "MH",
|
|
2094
|
+
label: "Marshall Islands",
|
|
2095
|
+
phone: "+692"
|
|
2096
|
+
},
|
|
2097
|
+
{
|
|
2098
|
+
code: "MK",
|
|
2099
|
+
label: "Macedonia, the Former Yugoslav Republic of",
|
|
2100
|
+
phone: "+389"
|
|
2101
|
+
},
|
|
2102
|
+
{
|
|
2103
|
+
code: "ML",
|
|
2104
|
+
label: "Mali",
|
|
2105
|
+
phone: "+223"
|
|
2106
|
+
},
|
|
2107
|
+
{
|
|
2108
|
+
code: "MM",
|
|
2109
|
+
label: "Myanmar",
|
|
2110
|
+
phone: "+95"
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
code: "MN",
|
|
2114
|
+
label: "Mongolia",
|
|
2115
|
+
phone: "+976"
|
|
2116
|
+
},
|
|
2117
|
+
{
|
|
2118
|
+
code: "MO",
|
|
2119
|
+
label: "Macao",
|
|
2120
|
+
phone: "+853"
|
|
2121
|
+
},
|
|
2122
|
+
{
|
|
2123
|
+
code: "MP",
|
|
2124
|
+
label: "Northern Mariana Islands",
|
|
2125
|
+
phone: "+1-670"
|
|
2126
|
+
},
|
|
2127
|
+
{
|
|
2128
|
+
code: "MQ",
|
|
2129
|
+
label: "Martinique",
|
|
2130
|
+
phone: "+596"
|
|
2131
|
+
},
|
|
2132
|
+
{
|
|
2133
|
+
code: "MR",
|
|
2134
|
+
label: "Mauritania",
|
|
2135
|
+
phone: "+222"
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
code: "MS",
|
|
2139
|
+
label: "Montserrat",
|
|
2140
|
+
phone: "+1-664"
|
|
2141
|
+
},
|
|
2142
|
+
{
|
|
2143
|
+
code: "MT",
|
|
2144
|
+
label: "Malta",
|
|
2145
|
+
phone: "+356"
|
|
2146
|
+
},
|
|
2147
|
+
{
|
|
2148
|
+
code: "MU",
|
|
2149
|
+
label: "Mauritius",
|
|
2150
|
+
phone: "+230"
|
|
2151
|
+
},
|
|
2152
|
+
{
|
|
2153
|
+
code: "MV",
|
|
2154
|
+
label: "Maldives",
|
|
2155
|
+
phone: "+960"
|
|
2156
|
+
},
|
|
2157
|
+
{
|
|
2158
|
+
code: "MW",
|
|
2159
|
+
label: "Malawi",
|
|
2160
|
+
phone: "+265"
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
code: "MX",
|
|
2164
|
+
label: "Mexico",
|
|
2165
|
+
phone: "+52"
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
code: "MY",
|
|
2169
|
+
label: "Malaysia",
|
|
2170
|
+
phone: "+60"
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
code: "MZ",
|
|
2174
|
+
label: "Mozambique",
|
|
2175
|
+
phone: "+258"
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
code: "NA",
|
|
2179
|
+
label: "Namibia",
|
|
2180
|
+
phone: "+264"
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
code: "NC",
|
|
2184
|
+
label: "New Caledonia",
|
|
2185
|
+
phone: "+687"
|
|
2186
|
+
},
|
|
2187
|
+
{
|
|
2188
|
+
code: "NE",
|
|
2189
|
+
label: "Niger",
|
|
2190
|
+
phone: "+227"
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
code: "NF",
|
|
2194
|
+
label: "Norfolk Island",
|
|
2195
|
+
phone: "+672"
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
code: "NG",
|
|
2199
|
+
label: "Nigeria",
|
|
2200
|
+
phone: "+234"
|
|
2201
|
+
},
|
|
2202
|
+
{
|
|
2203
|
+
code: "NI",
|
|
2204
|
+
label: "Nicaragua",
|
|
2205
|
+
phone: "+505"
|
|
2206
|
+
},
|
|
2207
|
+
{
|
|
2208
|
+
code: "NL",
|
|
2209
|
+
label: "Netherlands",
|
|
2210
|
+
phone: "+31"
|
|
2211
|
+
},
|
|
2212
|
+
{
|
|
2213
|
+
code: "NO",
|
|
2214
|
+
label: "Norway",
|
|
2215
|
+
phone: "+47"
|
|
2216
|
+
},
|
|
2217
|
+
{
|
|
2218
|
+
code: "NP",
|
|
2219
|
+
label: "Nepal",
|
|
2220
|
+
phone: "+977"
|
|
2221
|
+
},
|
|
2222
|
+
{
|
|
2223
|
+
code: "NR",
|
|
2224
|
+
label: "Nauru",
|
|
2225
|
+
phone: "+674"
|
|
2226
|
+
},
|
|
2227
|
+
{
|
|
2228
|
+
code: "NU",
|
|
2229
|
+
label: "Niue",
|
|
2230
|
+
phone: "+683"
|
|
2231
|
+
},
|
|
2232
|
+
{
|
|
2233
|
+
code: "NZ",
|
|
2234
|
+
label: "New Zealand",
|
|
2235
|
+
phone: "+64"
|
|
2236
|
+
},
|
|
2237
|
+
{
|
|
2238
|
+
code: "OM",
|
|
2239
|
+
label: "Oman",
|
|
2240
|
+
phone: "+968"
|
|
2241
|
+
},
|
|
2242
|
+
{
|
|
2243
|
+
code: "PA",
|
|
2244
|
+
label: "Panama",
|
|
2245
|
+
phone: "+507"
|
|
2246
|
+
},
|
|
2247
|
+
{
|
|
2248
|
+
code: "PE",
|
|
2249
|
+
label: "Peru",
|
|
2250
|
+
phone: "+51"
|
|
2251
|
+
},
|
|
2252
|
+
{
|
|
2253
|
+
code: "PF",
|
|
2254
|
+
label: "French Polynesia",
|
|
2255
|
+
phone: "+689"
|
|
2256
|
+
},
|
|
2257
|
+
{
|
|
2258
|
+
code: "PG",
|
|
2259
|
+
label: "Papua New Guinea",
|
|
2260
|
+
phone: "+675"
|
|
2261
|
+
},
|
|
2262
|
+
{
|
|
2263
|
+
code: "PH",
|
|
2264
|
+
label: "Philippines",
|
|
2265
|
+
phone: "+63"
|
|
2266
|
+
},
|
|
2267
|
+
{
|
|
2268
|
+
code: "PK",
|
|
2269
|
+
label: "Pakistan",
|
|
2270
|
+
phone: "+92"
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
code: "PL",
|
|
2274
|
+
label: "Poland",
|
|
2275
|
+
phone: "+48"
|
|
2276
|
+
},
|
|
2277
|
+
{
|
|
2278
|
+
code: "PM",
|
|
2279
|
+
label: "Saint Pierre and Miquelon",
|
|
2280
|
+
phone: "+508"
|
|
2281
|
+
},
|
|
2282
|
+
{
|
|
2283
|
+
code: "PN",
|
|
2284
|
+
label: "Pitcairn",
|
|
2285
|
+
phone: "+870"
|
|
2286
|
+
},
|
|
2287
|
+
{
|
|
2288
|
+
code: "PR",
|
|
2289
|
+
label: "Puerto Rico",
|
|
2290
|
+
phone: "+1"
|
|
2291
|
+
},
|
|
2292
|
+
{
|
|
2293
|
+
code: "PS",
|
|
2294
|
+
label: "Palestine, State of",
|
|
2295
|
+
phone: "+970"
|
|
2296
|
+
},
|
|
2297
|
+
{
|
|
2298
|
+
code: "PT",
|
|
2299
|
+
label: "Portugal",
|
|
2300
|
+
phone: "+351"
|
|
2301
|
+
},
|
|
2302
|
+
{
|
|
2303
|
+
code: "PW",
|
|
2304
|
+
label: "Palau",
|
|
2305
|
+
phone: "+680"
|
|
2306
|
+
},
|
|
2307
|
+
{
|
|
2308
|
+
code: "PY",
|
|
2309
|
+
label: "Paraguay",
|
|
2310
|
+
phone: "+595"
|
|
2311
|
+
},
|
|
2312
|
+
{
|
|
2313
|
+
code: "QA",
|
|
2314
|
+
label: "Qatar",
|
|
2315
|
+
phone: "+974"
|
|
2316
|
+
},
|
|
2317
|
+
{
|
|
2318
|
+
code: "RE",
|
|
2319
|
+
label: "Reunion",
|
|
2320
|
+
phone: "+262"
|
|
2321
|
+
},
|
|
2322
|
+
{
|
|
2323
|
+
code: "RO",
|
|
2324
|
+
label: "Romania",
|
|
2325
|
+
phone: "+40"
|
|
2326
|
+
},
|
|
2327
|
+
{
|
|
2328
|
+
code: "RS",
|
|
2329
|
+
label: "Serbia",
|
|
2330
|
+
phone: "+381"
|
|
2331
|
+
},
|
|
2332
|
+
{
|
|
2333
|
+
code: "RU",
|
|
2334
|
+
label: "Russian Federation",
|
|
2335
|
+
phone: "+7"
|
|
2336
|
+
},
|
|
2337
|
+
{
|
|
2338
|
+
code: "RW",
|
|
2339
|
+
label: "Rwanda",
|
|
2340
|
+
phone: "+250"
|
|
2341
|
+
},
|
|
2342
|
+
{
|
|
2343
|
+
code: "SA",
|
|
2344
|
+
label: "Saudi Arabia",
|
|
2345
|
+
phone: "+966"
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
code: "SB",
|
|
2349
|
+
label: "Solomon Islands",
|
|
2350
|
+
phone: "+677"
|
|
2351
|
+
},
|
|
2352
|
+
{
|
|
2353
|
+
code: "SC",
|
|
2354
|
+
label: "Seychelles",
|
|
2355
|
+
phone: "+248"
|
|
2356
|
+
},
|
|
2357
|
+
{
|
|
2358
|
+
code: "SD",
|
|
2359
|
+
label: "Sudan",
|
|
2360
|
+
phone: "+249"
|
|
2361
|
+
},
|
|
2362
|
+
{
|
|
2363
|
+
code: "SE",
|
|
2364
|
+
label: "Sweden",
|
|
2365
|
+
phone: "+46"
|
|
2366
|
+
},
|
|
2367
|
+
{
|
|
2368
|
+
code: "SG",
|
|
2369
|
+
label: "Singapore",
|
|
2370
|
+
phone: "+65"
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
code: "SH",
|
|
2374
|
+
label: "Saint Helena",
|
|
2375
|
+
phone: "+290"
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
code: "SI",
|
|
2379
|
+
label: "Slovenia",
|
|
2380
|
+
phone: "+386"
|
|
2381
|
+
},
|
|
2382
|
+
{
|
|
2383
|
+
code: "SJ",
|
|
2384
|
+
label: "Svalbard and Jan Mayen",
|
|
2385
|
+
phone: "+47"
|
|
2386
|
+
},
|
|
2387
|
+
{
|
|
2388
|
+
code: "SK",
|
|
2389
|
+
label: "Slovakia",
|
|
2390
|
+
phone: "+421"
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
code: "SL",
|
|
2394
|
+
label: "Sierra Leone",
|
|
2395
|
+
phone: "+232"
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
code: "SM",
|
|
2399
|
+
label: "San Marino",
|
|
2400
|
+
phone: "+378"
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
code: "SN",
|
|
2404
|
+
label: "Senegal",
|
|
2405
|
+
phone: "+221"
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
code: "SO",
|
|
2409
|
+
label: "Somalia",
|
|
2410
|
+
phone: "+252"
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
code: "SR",
|
|
2414
|
+
label: "Suriname",
|
|
2415
|
+
phone: "+597"
|
|
2416
|
+
},
|
|
2417
|
+
{
|
|
2418
|
+
code: "SS",
|
|
2419
|
+
label: "South Sudan",
|
|
2420
|
+
phone: "+211"
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
code: "ST",
|
|
2424
|
+
label: "Sao Tome and Principe",
|
|
2425
|
+
phone: "+239"
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
code: "SV",
|
|
2429
|
+
label: "El Salvador",
|
|
2430
|
+
phone: "+503"
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
code: "SX",
|
|
2434
|
+
label: "Sint Maarten (Dutch part)",
|
|
2435
|
+
phone: "+1-721"
|
|
2436
|
+
},
|
|
2437
|
+
{
|
|
2438
|
+
code: "SY",
|
|
2439
|
+
label: "Syrian Arab Republic",
|
|
2440
|
+
phone: "+963"
|
|
2441
|
+
},
|
|
2442
|
+
{
|
|
2443
|
+
code: "SZ",
|
|
2444
|
+
label: "Swaziland",
|
|
2445
|
+
phone: "+268"
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
code: "TC",
|
|
2449
|
+
label: "Turks and Caicos Islands",
|
|
2450
|
+
phone: "+1-649"
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
code: "TD",
|
|
2454
|
+
label: "Chad",
|
|
2455
|
+
phone: "+235"
|
|
2456
|
+
},
|
|
2457
|
+
{
|
|
2458
|
+
code: "TF",
|
|
2459
|
+
label: "French Southern Territories",
|
|
2460
|
+
phone: "+262"
|
|
2461
|
+
},
|
|
2462
|
+
{
|
|
2463
|
+
code: "TG",
|
|
2464
|
+
label: "Togo",
|
|
2465
|
+
phone: "+228"
|
|
2466
|
+
},
|
|
2467
|
+
{
|
|
2468
|
+
code: "TH",
|
|
2469
|
+
label: "Thailand",
|
|
2470
|
+
phone: "+66"
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
code: "TJ",
|
|
2474
|
+
label: "Tajikistan",
|
|
2475
|
+
phone: "+992"
|
|
2476
|
+
},
|
|
2477
|
+
{
|
|
2478
|
+
code: "TK",
|
|
2479
|
+
label: "Tokelau",
|
|
2480
|
+
phone: "+690"
|
|
2481
|
+
},
|
|
2482
|
+
{
|
|
2483
|
+
code: "TL",
|
|
2484
|
+
label: "Timor-Leste",
|
|
2485
|
+
phone: "+670"
|
|
2486
|
+
},
|
|
2487
|
+
{
|
|
2488
|
+
code: "TM",
|
|
2489
|
+
label: "Turkmenistan",
|
|
2490
|
+
phone: "+993"
|
|
2491
|
+
},
|
|
2492
|
+
{
|
|
2493
|
+
code: "TN",
|
|
2494
|
+
label: "Tunisia",
|
|
2495
|
+
phone: "+216"
|
|
2496
|
+
},
|
|
2497
|
+
{
|
|
2498
|
+
code: "TO",
|
|
2499
|
+
label: "Tonga",
|
|
2500
|
+
phone: "+676"
|
|
2501
|
+
},
|
|
2502
|
+
{
|
|
2503
|
+
code: "TR",
|
|
2504
|
+
label: "Turkey",
|
|
2505
|
+
phone: "+90"
|
|
2506
|
+
},
|
|
2507
|
+
{
|
|
2508
|
+
code: "TT",
|
|
2509
|
+
label: "Trinidad and Tobago",
|
|
2510
|
+
phone: "+1-868"
|
|
2511
|
+
},
|
|
2512
|
+
{
|
|
2513
|
+
code: "TV",
|
|
2514
|
+
label: "Tuvalu",
|
|
2515
|
+
phone: "+688"
|
|
2516
|
+
},
|
|
2517
|
+
{
|
|
2518
|
+
code: "TW",
|
|
2519
|
+
label: "Taiwan, Province of China",
|
|
2520
|
+
phone: "+886"
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
code: "TZ",
|
|
2524
|
+
label: "United Republic of Tanzania",
|
|
2525
|
+
phone: "+255"
|
|
2526
|
+
},
|
|
2527
|
+
{
|
|
2528
|
+
code: "UA",
|
|
2529
|
+
label: "Ukraine",
|
|
2530
|
+
phone: "+380"
|
|
2531
|
+
},
|
|
2532
|
+
{
|
|
2533
|
+
code: "UG",
|
|
2534
|
+
label: "Uganda",
|
|
2535
|
+
phone: "+256"
|
|
2536
|
+
},
|
|
2537
|
+
{
|
|
2538
|
+
code: "US",
|
|
2539
|
+
label: "United States",
|
|
2540
|
+
phone: "+1",
|
|
2541
|
+
suggested: true
|
|
2542
|
+
},
|
|
2543
|
+
{
|
|
2544
|
+
code: "UY",
|
|
2545
|
+
label: "Uruguay",
|
|
2546
|
+
phone: "+598"
|
|
2547
|
+
},
|
|
2548
|
+
{
|
|
2549
|
+
code: "UZ",
|
|
2550
|
+
label: "Uzbekistan",
|
|
2551
|
+
phone: "+998"
|
|
2552
|
+
},
|
|
2553
|
+
{
|
|
2554
|
+
code: "VA",
|
|
2555
|
+
label: "Holy See (Vatican City State)",
|
|
2556
|
+
phone: "+379"
|
|
2557
|
+
},
|
|
2558
|
+
{
|
|
2559
|
+
code: "VC",
|
|
2560
|
+
label: "Saint Vincent and the Grenadines",
|
|
2561
|
+
phone: "+1-784"
|
|
2562
|
+
},
|
|
2563
|
+
{
|
|
2564
|
+
code: "VE",
|
|
2565
|
+
label: "Venezuela",
|
|
2566
|
+
phone: "+58"
|
|
2567
|
+
},
|
|
2568
|
+
{
|
|
2569
|
+
code: "VG",
|
|
2570
|
+
label: "British Virgin Islands",
|
|
2571
|
+
phone: "+1-284"
|
|
2572
|
+
},
|
|
2573
|
+
{
|
|
2574
|
+
code: "VI",
|
|
2575
|
+
label: "US Virgin Islands",
|
|
2576
|
+
phone: "+1-340"
|
|
2577
|
+
},
|
|
2578
|
+
{
|
|
2579
|
+
code: "VN",
|
|
2580
|
+
label: "Vietnam",
|
|
2581
|
+
phone: "+84"
|
|
2582
|
+
},
|
|
2583
|
+
{
|
|
2584
|
+
code: "VU",
|
|
2585
|
+
label: "Vanuatu",
|
|
2586
|
+
phone: "+678"
|
|
2587
|
+
},
|
|
2588
|
+
{
|
|
2589
|
+
code: "WF",
|
|
2590
|
+
label: "Wallis and Futuna",
|
|
2591
|
+
phone: "+681"
|
|
2592
|
+
},
|
|
2593
|
+
{
|
|
2594
|
+
code: "WS",
|
|
2595
|
+
label: "Samoa",
|
|
2596
|
+
phone: "+685"
|
|
2597
|
+
},
|
|
2598
|
+
{
|
|
2599
|
+
code: "XK",
|
|
2600
|
+
label: "Kosovo",
|
|
2601
|
+
phone: "+383"
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
code: "YE",
|
|
2605
|
+
label: "Yemen",
|
|
2606
|
+
phone: "+967"
|
|
2607
|
+
},
|
|
2608
|
+
{
|
|
2609
|
+
code: "YT",
|
|
2610
|
+
label: "Mayotte",
|
|
2611
|
+
phone: "+262"
|
|
2612
|
+
},
|
|
2613
|
+
{
|
|
2614
|
+
code: "ZA",
|
|
2615
|
+
label: "South Africa",
|
|
2616
|
+
phone: "+27"
|
|
2617
|
+
},
|
|
2618
|
+
{
|
|
2619
|
+
code: "ZM",
|
|
2620
|
+
label: "Zambia",
|
|
2621
|
+
phone: "+260"
|
|
2622
|
+
},
|
|
2623
|
+
{
|
|
2624
|
+
code: "ZW",
|
|
2625
|
+
label: "Zimbabwe",
|
|
2626
|
+
phone: "+263"
|
|
2627
|
+
}
|
|
2628
|
+
];
|
|
2629
|
+
|
|
2630
|
+
function PhoneInput(_ref) {
|
|
2631
|
+
var onChange = _ref.onChange,
|
|
2632
|
+
_ref$value = _ref.value,
|
|
2633
|
+
value = _ref$value === void 0 ? '' : _ref$value,
|
|
2634
|
+
country = _ref.country,
|
|
2635
|
+
_ref$placeholder = _ref.placeholder,
|
|
2636
|
+
placeholder = _ref$placeholder === void 0 ? 'Enter phone number' : _ref$placeholder,
|
|
2637
|
+
_ref$color = _ref.color,
|
|
2638
|
+
_color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
2639
|
+
children = _ref.children,
|
|
2640
|
+
fullWidth = _ref.fullWidth;
|
|
2641
|
+
var theme$1 = theme.useTheme();
|
|
2642
|
+
var _useScale = useScale(),
|
|
2643
|
+
SCALES = _useScale.SCALES;
|
|
2644
|
+
var defaultValue = country ? countries.findIndex(function (cn) {
|
|
2645
|
+
return cn.code == country;
|
|
2646
|
+
}) : 103;
|
|
2647
|
+
var _useState = React.useState(countries[defaultValue]),
|
|
2648
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2649
|
+
selectedCountry = _useState2[0],
|
|
2650
|
+
setSelectedCountry = _useState2[1];
|
|
2651
|
+
var _useState3 = React.useState(value),
|
|
2652
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2653
|
+
phoneNumber = _useState4[0],
|
|
2654
|
+
setPhoneNumber = _useState4[1];
|
|
2655
|
+
var _useState5 = React.useState(false),
|
|
2656
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
2657
|
+
isFocused = _useState6[0],
|
|
2658
|
+
setIsFocused = _useState6[1];
|
|
2659
|
+
var _useState7 = React.useState(false),
|
|
2660
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
2661
|
+
dropdownOpen = _useState8[0],
|
|
2662
|
+
setDropdownOpen = _useState8[1];
|
|
2663
|
+
var _useState9 = React.useState(''),
|
|
2664
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
2665
|
+
searchTerm = _useState0[0],
|
|
2666
|
+
setSearchTerm = _useState0[1];
|
|
2667
|
+
var dropdownRef = React.useRef(null);
|
|
2668
|
+
var _useMemo = React.useMemo(function () {
|
|
2669
|
+
return getColors(theme$1.palette, _color);
|
|
2670
|
+
}, [theme$1.palette]),
|
|
2671
|
+
borderColor = _useMemo.borderColor,
|
|
2672
|
+
hoverBorder = _useMemo.hoverBorder;
|
|
2673
|
+
var handleSelectCountry = function handleSelectCountry(country) {
|
|
2674
|
+
setSelectedCountry(country);
|
|
2675
|
+
setDropdownOpen(false);
|
|
2676
|
+
setSearchTerm('');
|
|
2677
|
+
if (onChange) onChange("".concat(country.code, ":").concat(phoneNumber));
|
|
2678
|
+
};
|
|
2679
|
+
var handlePhoneChange = function handlePhoneChange(e) {
|
|
2680
|
+
var value = e.target.value.replace(/[^\d]/g, '');
|
|
2681
|
+
setPhoneNumber(value);
|
|
2682
|
+
if (onChange) onChange("".concat(selectedCountry.phone, ",").concat(value));
|
|
2683
|
+
};
|
|
2684
|
+
var handleClickOutside = function handleClickOutside(e) {
|
|
2685
|
+
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2686
|
+
setDropdownOpen(false);
|
|
2687
|
+
setSearchTerm('');
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
React.useEffect(function () {
|
|
2691
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
2692
|
+
return function () {
|
|
2693
|
+
return document.removeEventListener('mousedown', handleClickOutside);
|
|
2694
|
+
};
|
|
2695
|
+
}, []);
|
|
2696
|
+
var filteredCountries = countries.filter(function (c) {
|
|
2697
|
+
return "".concat(c.label, " ").concat(c.code, " ").concat(c.phone).toLowerCase().includes(searchTerm.toLowerCase());
|
|
2698
|
+
});
|
|
2699
|
+
var defaultWidth = fullWidth ? '100%' : 'initial';
|
|
2700
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2701
|
+
ref: dropdownRef,
|
|
2702
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "phone-input-container ".concat(isFocused ? 'focused' : '')
|
|
2703
|
+
}, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement("div", {
|
|
2704
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "input-wrapper"
|
|
2705
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2706
|
+
onClick: function onClick() {
|
|
2707
|
+
return setDropdownOpen(!dropdownOpen);
|
|
2708
|
+
},
|
|
2709
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-toggle"
|
|
2710
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
2711
|
+
style: {
|
|
2712
|
+
display: 'flex',
|
|
2713
|
+
alignItems: 'center',
|
|
2714
|
+
gap: 5
|
|
2715
|
+
},
|
|
2716
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2717
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
2718
|
+
loading: "lazy",
|
|
2719
|
+
width: "20",
|
|
2720
|
+
height: "20",
|
|
2721
|
+
src: "https://flagcdn.com/w20/".concat(selectedCountry.code.toLowerCase(), ".png"),
|
|
2722
|
+
srcSet: "https://flagcdn.com/w40/".concat(selectedCountry.code.toLowerCase(), ".png 2x"),
|
|
2723
|
+
alt: "Flag of ".concat(selectedCountry.label),
|
|
2724
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2725
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
2726
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2727
|
+
}, selectedCountry.phone))), /*#__PURE__*/React.createElement("input", {
|
|
2728
|
+
type: "tel",
|
|
2729
|
+
placeholder: placeholder,
|
|
2730
|
+
value: phoneNumber,
|
|
2731
|
+
onChange: handlePhoneChange,
|
|
2732
|
+
onFocus: function onFocus() {
|
|
2733
|
+
return setIsFocused(true);
|
|
2734
|
+
},
|
|
2735
|
+
onBlur: function onBlur() {
|
|
2736
|
+
return setIsFocused(false);
|
|
2737
|
+
},
|
|
2738
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "phone-input"
|
|
2739
|
+
})), dropdownOpen && /*#__PURE__*/React.createElement("div", {
|
|
2740
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown"
|
|
2741
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
2742
|
+
type: "text",
|
|
2743
|
+
placeholder: "Search country...",
|
|
2744
|
+
value: searchTerm,
|
|
2745
|
+
onChange: function onChange(e) {
|
|
2746
|
+
return setSearchTerm(e.target.value);
|
|
2747
|
+
},
|
|
2748
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "search-input"
|
|
2749
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
2750
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "country-list"
|
|
2751
|
+
}, filteredCountries.length > 0 ? filteredCountries.map(function (c) {
|
|
2752
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2753
|
+
key: c.code,
|
|
2754
|
+
onClick: function onClick() {
|
|
2755
|
+
return handleSelectCountry(c);
|
|
2756
|
+
},
|
|
2757
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-item"
|
|
2758
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
2759
|
+
style: {
|
|
2760
|
+
display: 'flex',
|
|
2761
|
+
alignItems: 'center',
|
|
2762
|
+
gap: 5
|
|
2763
|
+
},
|
|
2764
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2765
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
2766
|
+
loading: "lazy",
|
|
2767
|
+
width: "23",
|
|
2768
|
+
height: "23",
|
|
2769
|
+
src: "https://flagcdn.com/w20/".concat(c.code.toLowerCase(), ".png"),
|
|
2770
|
+
srcSet: "https://flagcdn.com/w40/".concat(c.code.toLowerCase(), ".png 2x"),
|
|
2771
|
+
alt: "Flag of ".concat(c.label),
|
|
2772
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2773
|
+
}), c.phone, " ", /*#__PURE__*/React.createElement("span", {
|
|
2774
|
+
style: {
|
|
2775
|
+
color: 'grey'
|
|
2776
|
+
},
|
|
2777
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2778
|
+
}, c.label)));
|
|
2779
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
2780
|
+
className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-item disabled"
|
|
2781
|
+
}, "No results"))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
2782
|
+
id: "3237870810",
|
|
2783
|
+
dynamic: [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']
|
|
2784
|
+
}, ".phone-input-container.__jsx-style-dynamic-selector{position:relative;width:".concat(SCALES.width(1, defaultWidth), ";height:").concat(SCALES.height(2.25), ";}.phone-input-container.focused.__jsx-style-dynamic-selector{outline:1px solid ").concat(hoverBorder, ";border-radius:6px;}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid ").concat(borderColor, ";border-radius:6px;overflow:hidden;}.dropdown-toggle.__jsx-style-dynamic-selector{padding:7px 12px;border-radius:6px 0px 0px 6px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:14px;border-right:1px solid ").concat(borderColor, ";}.phone-input.__jsx-style-dynamic-selector{width:100%;min-width:0;padding:5px 10px;background-color:transparent;font-size:14px;border:none;}.phone-input.__jsx-style-dynamic-selector:focus{outline:none;}.dropdown.__jsx-style-dynamic-selector{position:absolute;top:100%;left:0;width:").concat(SCALES.width(1, defaultWidth), ";background:").concat(theme$1.type == 'dark' ? 'black' : 'white', ";border:1px solid ").concat(borderColor, ";border-radius:6px;margin-top:4px;z-index:999;box-shadow:0 4px 10px rgba(0,0,0,0.1);}.search-input.__jsx-style-dynamic-selector{width:100%;padding:8px 10px;border:none;background-color:transparent;border-bottom:1px solid ").concat(borderColor, ";font-size:14px;}.search-input.__jsx-style-dynamic-selector:focus{outline:none;}.country-list.__jsx-style-dynamic-selector{max-height:200px;overflow-y:auto;}.dropdown-item.__jsx-style-dynamic-selector{padding:10px;cursor:pointer;font-size:14px;}.dropdown-item.__jsx-style-dynamic-selector:hover{background:").concat(theme$1.type == 'dark' ? '#3a3d3d' : '#efefef', ";}.dropdown-item.disabled.__jsx-style-dynamic-selector{color:#888;cursor:default;}")));
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
/**
|
|
2788
|
+
* Escape regex char
|
|
2789
|
+
*
|
|
2790
|
+
* See: https://stackoverflow.com/questions/17885855/use-dynamic-variable-string-as-regex-pattern-in-javascript
|
|
2791
|
+
*/
|
|
2792
|
+
var escapeRegExp = function escapeRegExp(stringToGoIntoTheRegex) {
|
|
2793
|
+
return stringToGoIntoTheRegex.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
2794
|
+
};
|
|
2795
|
+
|
|
2796
|
+
var abbrMap = {
|
|
2797
|
+
k: 1000,
|
|
2798
|
+
m: 1000000,
|
|
2799
|
+
b: 1000000000
|
|
2800
|
+
};
|
|
2801
|
+
|
|
2802
|
+
/**
|
|
2803
|
+
* Parse a value with abbreviation e.g 1k = 1000
|
|
2804
|
+
*/
|
|
2805
|
+
var parseAbbrValue = function parseAbbrValue(value) {
|
|
2806
|
+
var decimalSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.';
|
|
2807
|
+
var reg = new RegExp("(\\d+(".concat(escapeRegExp(decimalSeparator), "\\d*)?)([kmb])$"), 'i');
|
|
2808
|
+
var match = value.match(reg);
|
|
2809
|
+
if (match) {
|
|
2810
|
+
var _match = _slicedToArray(match, 4),
|
|
2811
|
+
digits = _match[1],
|
|
2812
|
+
abbr = _match[3];
|
|
2813
|
+
var multiplier = abbrMap[abbr.toLowerCase()];
|
|
2814
|
+
return Number(digits.replace(decimalSeparator, '.')) * multiplier;
|
|
2815
|
+
}
|
|
2816
|
+
return undefined;
|
|
2817
|
+
};
|
|
2818
|
+
|
|
2819
|
+
/**
|
|
2820
|
+
* Remove group separator from value eg. 1,000 > 1000
|
|
2821
|
+
*/
|
|
2822
|
+
var removeSeparators = function removeSeparators(value) {
|
|
2823
|
+
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
|
|
2824
|
+
var reg = new RegExp(escapeRegExp(separator), 'g');
|
|
2825
|
+
return value.replace(reg, '');
|
|
2826
|
+
};
|
|
2827
|
+
|
|
2828
|
+
/**
|
|
2829
|
+
* Remove invalid characters
|
|
2830
|
+
*/
|
|
2831
|
+
var removeInvalidChars = function removeInvalidChars(value, validChars) {
|
|
2832
|
+
var chars = escapeRegExp(validChars.join(''));
|
|
2833
|
+
var reg = new RegExp("[^\\d".concat(chars, "]"), 'gi');
|
|
2834
|
+
return value.replace(reg, '');
|
|
2835
|
+
};
|
|
2836
|
+
|
|
2837
|
+
/**
|
|
2838
|
+
* Remove prefix, separators and extra decimals from value
|
|
2839
|
+
*/
|
|
2840
|
+
var cleanValue = function cleanValue(_ref) {
|
|
2841
|
+
var value = _ref.value,
|
|
2842
|
+
_ref$groupSeparator = _ref.groupSeparator,
|
|
2843
|
+
groupSeparator = _ref$groupSeparator === void 0 ? ',' : _ref$groupSeparator,
|
|
2844
|
+
_ref$decimalSeparator = _ref.decimalSeparator,
|
|
2845
|
+
decimalSeparator = _ref$decimalSeparator === void 0 ? '.' : _ref$decimalSeparator,
|
|
2846
|
+
_ref$allowDecimals = _ref.allowDecimals,
|
|
2847
|
+
allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
|
|
2848
|
+
_ref$decimalsLimit = _ref.decimalsLimit,
|
|
2849
|
+
decimalsLimit = _ref$decimalsLimit === void 0 ? 2 : _ref$decimalsLimit,
|
|
2850
|
+
_ref$allowNegativeVal = _ref.allowNegativeValue,
|
|
2851
|
+
allowNegativeValue = _ref$allowNegativeVal === void 0 ? true : _ref$allowNegativeVal,
|
|
2852
|
+
_ref$disableAbbreviat = _ref.disableAbbreviations,
|
|
2853
|
+
disableAbbreviations = _ref$disableAbbreviat === void 0 ? false : _ref$disableAbbreviat,
|
|
2854
|
+
_ref$prefix = _ref.prefix,
|
|
2855
|
+
prefix = _ref$prefix === void 0 ? '' : _ref$prefix,
|
|
2856
|
+
_ref$transformRawValu = _ref.transformRawValue,
|
|
2857
|
+
transformRawValue = _ref$transformRawValu === void 0 ? function (rawValue) {
|
|
2858
|
+
return rawValue;
|
|
2859
|
+
} : _ref$transformRawValu;
|
|
2860
|
+
var transformedValue = transformRawValue(value);
|
|
2861
|
+
if (transformedValue === '-') {
|
|
2862
|
+
return transformedValue;
|
|
2863
|
+
}
|
|
2864
|
+
var abbreviations = disableAbbreviations ? [] : ['k', 'm', 'b'];
|
|
2865
|
+
var reg = new RegExp("((^|\\D)-\\d)|(-".concat(escapeRegExp(prefix), ")"));
|
|
2866
|
+
var isNegative = reg.test(transformedValue);
|
|
2867
|
+
|
|
2868
|
+
// Is there a digit before the prefix? eg. 1$
|
|
2869
|
+
var _ref2 = RegExp("(\\d+)-?".concat(escapeRegExp(prefix))).exec(value) || [],
|
|
2870
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
2871
|
+
prefixWithValue = _ref3[0],
|
|
2872
|
+
preValue = _ref3[1];
|
|
2873
|
+
var withoutPrefix = prefix ? prefixWithValue ? transformedValue.replace(prefixWithValue, '').concat(preValue) : transformedValue.replace(prefix, '') : transformedValue;
|
|
2874
|
+
var withoutSeparators = removeSeparators(withoutPrefix, groupSeparator);
|
|
2875
|
+
var withoutInvalidChars = removeInvalidChars(withoutSeparators, [groupSeparator, decimalSeparator].concat(abbreviations));
|
|
2876
|
+
var valueOnly = withoutInvalidChars;
|
|
2877
|
+
if (!disableAbbreviations) {
|
|
2878
|
+
// disallow letter without number
|
|
2879
|
+
if (abbreviations.some(function (letter) {
|
|
2880
|
+
return letter === withoutInvalidChars.toLowerCase().replace(decimalSeparator, '');
|
|
2881
|
+
})) {
|
|
2882
|
+
return '';
|
|
2883
|
+
}
|
|
2884
|
+
var parsed = parseAbbrValue(withoutInvalidChars, decimalSeparator);
|
|
2885
|
+
if (parsed) {
|
|
2886
|
+
valueOnly = String(parsed);
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
var includeNegative = isNegative && allowNegativeValue ? '-' : '';
|
|
2890
|
+
if (decimalSeparator && valueOnly.includes(decimalSeparator)) {
|
|
2891
|
+
var _withoutInvalidChars$ = withoutInvalidChars.split(decimalSeparator),
|
|
2892
|
+
_withoutInvalidChars$2 = _slicedToArray(_withoutInvalidChars$, 2),
|
|
2893
|
+
_int = _withoutInvalidChars$2[0],
|
|
2894
|
+
decimals = _withoutInvalidChars$2[1];
|
|
2895
|
+
var trimmedDecimals = decimalsLimit && decimals ? decimals.slice(0, decimalsLimit) : decimals;
|
|
2896
|
+
var includeDecimals = allowDecimals ? "".concat(decimalSeparator).concat(trimmedDecimals) : '';
|
|
2897
|
+
return "".concat(includeNegative).concat(_int).concat(includeDecimals);
|
|
2898
|
+
}
|
|
2899
|
+
return "".concat(includeNegative).concat(valueOnly);
|
|
2900
|
+
};
|
|
2901
|
+
|
|
2902
|
+
var fixedDecimalValue = function fixedDecimalValue(value, decimalSeparator, fixedDecimalLength) {
|
|
2903
|
+
if (fixedDecimalLength !== undefined && value.length > 1) {
|
|
2904
|
+
if (fixedDecimalLength === 0) {
|
|
2905
|
+
return value.replace(decimalSeparator, '');
|
|
2906
|
+
}
|
|
2907
|
+
if (value.includes(decimalSeparator)) {
|
|
2908
|
+
var _value$split = value.split(decimalSeparator),
|
|
2909
|
+
_value$split2 = _slicedToArray(_value$split, 2),
|
|
2910
|
+
_int = _value$split2[0],
|
|
2911
|
+
decimals = _value$split2[1];
|
|
2912
|
+
if (decimals.length === fixedDecimalLength) {
|
|
2913
|
+
return value;
|
|
2914
|
+
}
|
|
2915
|
+
if (decimals.length > fixedDecimalLength) {
|
|
2916
|
+
return "".concat(_int).concat(decimalSeparator).concat(decimals.slice(0, fixedDecimalLength));
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
var reg = value.length > fixedDecimalLength ? new RegExp("(\\d+)(\\d{".concat(fixedDecimalLength, "})")) : new RegExp("(\\d)(\\d+)");
|
|
2920
|
+
var match = value.match(reg);
|
|
2921
|
+
if (match) {
|
|
2922
|
+
var _match = _slicedToArray(match, 3),
|
|
2923
|
+
_int2 = _match[1],
|
|
2924
|
+
_decimals = _match[2];
|
|
2925
|
+
return "".concat(_int2).concat(decimalSeparator).concat(_decimals);
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
return value;
|
|
2929
|
+
};
|
|
2930
|
+
|
|
2931
|
+
var getSuffix = function getSuffix(value, _ref) {
|
|
2932
|
+
var _ref$groupSeparator = _ref.groupSeparator,
|
|
2933
|
+
groupSeparator = _ref$groupSeparator === void 0 ? ',' : _ref$groupSeparator,
|
|
2934
|
+
_ref$decimalSeparator = _ref.decimalSeparator,
|
|
2935
|
+
decimalSeparator = _ref$decimalSeparator === void 0 ? '.' : _ref$decimalSeparator;
|
|
2936
|
+
var suffixReg = new RegExp("\\d([^".concat(escapeRegExp(groupSeparator)).concat(escapeRegExp(decimalSeparator), "0-9]+)"));
|
|
2937
|
+
var suffixMatch = value.match(suffixReg);
|
|
2938
|
+
return suffixMatch ? suffixMatch[1] : undefined;
|
|
2939
|
+
};
|
|
2940
|
+
|
|
2941
|
+
/**
|
|
2942
|
+
* Format value with decimal separator, group separator and prefix
|
|
2943
|
+
*/
|
|
2944
|
+
var formatValue = function formatValue(options) {
|
|
2945
|
+
var _value = options.value,
|
|
2946
|
+
decimalSeparator = options.decimalSeparator,
|
|
2947
|
+
intlConfig = options.intlConfig,
|
|
2948
|
+
decimalScale = options.decimalScale,
|
|
2949
|
+
_options$prefix = options.prefix,
|
|
2950
|
+
prefix = _options$prefix === void 0 ? '' : _options$prefix,
|
|
2951
|
+
_options$suffix = options.suffix,
|
|
2952
|
+
suffix = _options$suffix === void 0 ? '' : _options$suffix;
|
|
2953
|
+
if (_value === '' || _value === undefined) {
|
|
2954
|
+
return '';
|
|
2955
|
+
}
|
|
2956
|
+
if (_value === '-') {
|
|
2957
|
+
return '-';
|
|
2958
|
+
}
|
|
2959
|
+
var isNegative = new RegExp("^\\d?-".concat(prefix ? "".concat(escapeRegExp(prefix), "?") : '', "\\d")).test(_value);
|
|
2960
|
+
var value = decimalSeparator !== '.' ? replaceDecimalSeparator(_value, decimalSeparator, isNegative) : _value;
|
|
2961
|
+
if (decimalSeparator && decimalSeparator !== '-' && value.startsWith(decimalSeparator)) {
|
|
2962
|
+
value = '0' + value;
|
|
2963
|
+
}
|
|
2964
|
+
var defaultNumberFormatOptions = {
|
|
2965
|
+
minimumFractionDigits: decimalScale || 0,
|
|
2966
|
+
maximumFractionDigits: 20
|
|
2967
|
+
};
|
|
2968
|
+
var numberFormatter = intlConfig ? new Intl.NumberFormat(intlConfig.locale, intlConfig.currency ? _objectSpread2(_objectSpread2({}, defaultNumberFormatOptions), {}, {
|
|
2969
|
+
style: 'currency',
|
|
2970
|
+
currency: intlConfig.currency
|
|
2971
|
+
}) : defaultNumberFormatOptions) : new Intl.NumberFormat(undefined, defaultNumberFormatOptions);
|
|
2972
|
+
var parts = numberFormatter.formatToParts(Number(value));
|
|
2973
|
+
var formatted = replaceParts(parts, options);
|
|
2974
|
+
|
|
2975
|
+
// Does intl formatting add a suffix?
|
|
2976
|
+
var intlSuffix = getSuffix(formatted, _objectSpread2({}, options));
|
|
2977
|
+
|
|
2978
|
+
// Include decimal separator if user input ends with decimal separator
|
|
2979
|
+
var includeDecimalSeparator = _value.slice(-1) === decimalSeparator ? decimalSeparator : '';
|
|
2980
|
+
var _ref = value.match(RegExp('\\d+\\.(\\d+)')) || [],
|
|
2981
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
2982
|
+
decimals = _ref2[1];
|
|
2983
|
+
|
|
2984
|
+
// Keep original decimal padding if no decimalScale
|
|
2985
|
+
if (decimalScale === undefined && decimals && decimalSeparator) {
|
|
2986
|
+
if (formatted.includes(decimalSeparator)) {
|
|
2987
|
+
formatted = formatted.replace(RegExp("(\\d+)(".concat(escapeRegExp(decimalSeparator), ")(\\d+)"), 'g'), "$1$2".concat(decimals));
|
|
2988
|
+
} else {
|
|
2989
|
+
if (intlSuffix && !suffix) {
|
|
2990
|
+
formatted = formatted.replace(intlSuffix, "".concat(decimalSeparator).concat(decimals).concat(intlSuffix));
|
|
2991
|
+
} else {
|
|
2992
|
+
formatted = "".concat(formatted).concat(decimalSeparator).concat(decimals);
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
if (suffix && includeDecimalSeparator) {
|
|
2997
|
+
return "".concat(formatted).concat(includeDecimalSeparator).concat(suffix);
|
|
2998
|
+
}
|
|
2999
|
+
if (intlSuffix && includeDecimalSeparator) {
|
|
3000
|
+
return formatted.replace(intlSuffix, "".concat(includeDecimalSeparator).concat(intlSuffix));
|
|
3001
|
+
}
|
|
3002
|
+
if (intlSuffix && suffix) {
|
|
3003
|
+
return formatted.replace(intlSuffix, "".concat(includeDecimalSeparator).concat(suffix));
|
|
3004
|
+
}
|
|
3005
|
+
return [formatted, includeDecimalSeparator, suffix].join('');
|
|
3006
|
+
};
|
|
3007
|
+
|
|
3008
|
+
/**
|
|
3009
|
+
* Before converting to Number, decimal separator has to be .
|
|
3010
|
+
*/
|
|
3011
|
+
var replaceDecimalSeparator = function replaceDecimalSeparator(value, decimalSeparator, isNegative) {
|
|
3012
|
+
var newValue = value;
|
|
3013
|
+
if (decimalSeparator && decimalSeparator !== '.') {
|
|
3014
|
+
newValue = newValue.replace(RegExp(escapeRegExp(decimalSeparator), 'g'), '.');
|
|
3015
|
+
if (isNegative && decimalSeparator === '-') {
|
|
3016
|
+
newValue = "-".concat(newValue.slice(1));
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
return newValue;
|
|
3020
|
+
};
|
|
3021
|
+
var replaceParts = function replaceParts(parts, _ref3) {
|
|
3022
|
+
var prefix = _ref3.prefix,
|
|
3023
|
+
groupSeparator = _ref3.groupSeparator,
|
|
3024
|
+
decimalSeparator = _ref3.decimalSeparator,
|
|
3025
|
+
decimalScale = _ref3.decimalScale,
|
|
3026
|
+
_ref3$disableGroupSep = _ref3.disableGroupSeparators,
|
|
3027
|
+
disableGroupSeparators = _ref3$disableGroupSep === void 0 ? false : _ref3$disableGroupSep;
|
|
3028
|
+
return parts.reduce(function (prev, _ref4, i) {
|
|
3029
|
+
var type = _ref4.type,
|
|
3030
|
+
value = _ref4.value;
|
|
3031
|
+
if (i === 0 && prefix) {
|
|
3032
|
+
if (type === 'minusSign') {
|
|
3033
|
+
return [value, prefix];
|
|
3034
|
+
}
|
|
3035
|
+
if (type === 'currency') {
|
|
3036
|
+
return [].concat(_toConsumableArray(prev), [prefix]);
|
|
3037
|
+
}
|
|
3038
|
+
return [prefix, value];
|
|
3039
|
+
}
|
|
3040
|
+
if (type === 'currency') {
|
|
3041
|
+
return prefix ? prev : [].concat(_toConsumableArray(prev), [value]);
|
|
3042
|
+
}
|
|
3043
|
+
if (type === 'group') {
|
|
3044
|
+
return !disableGroupSeparators ? [].concat(_toConsumableArray(prev), [groupSeparator !== undefined ? groupSeparator : value]) : prev;
|
|
3045
|
+
}
|
|
3046
|
+
if (type === 'decimal') {
|
|
3047
|
+
if (decimalScale !== undefined && decimalScale === 0) {
|
|
3048
|
+
return prev;
|
|
3049
|
+
}
|
|
3050
|
+
return [].concat(_toConsumableArray(prev), [decimalSeparator !== undefined ? decimalSeparator : value]);
|
|
3051
|
+
}
|
|
3052
|
+
if (type === 'fraction') {
|
|
3053
|
+
return [].concat(_toConsumableArray(prev), [decimalScale !== undefined ? value.slice(0, decimalScale) : value]);
|
|
3054
|
+
}
|
|
3055
|
+
return [].concat(_toConsumableArray(prev), [value]);
|
|
3056
|
+
}, ['']).join('');
|
|
3057
|
+
};
|
|
3058
|
+
|
|
3059
|
+
var defaultConfig = {
|
|
3060
|
+
currencySymbol: '',
|
|
3061
|
+
groupSeparator: '',
|
|
3062
|
+
decimalSeparator: '',
|
|
3063
|
+
prefix: '',
|
|
3064
|
+
suffix: ''
|
|
3065
|
+
};
|
|
3066
|
+
|
|
3067
|
+
/**
|
|
3068
|
+
* Get locale config from input or default
|
|
3069
|
+
*/
|
|
3070
|
+
var getLocaleConfig = function getLocaleConfig(intlConfig) {
|
|
3071
|
+
var _ref = intlConfig || {},
|
|
3072
|
+
locale = _ref.locale,
|
|
3073
|
+
currency = _ref.currency;
|
|
3074
|
+
var numberFormatter = locale ? new Intl.NumberFormat(locale, currency ? {
|
|
3075
|
+
currency: currency,
|
|
3076
|
+
style: 'currency'
|
|
3077
|
+
} : undefined) : new Intl.NumberFormat();
|
|
3078
|
+
return numberFormatter.formatToParts(1000.1).reduce(function (prev, curr, i) {
|
|
3079
|
+
if (curr.type === 'currency') {
|
|
3080
|
+
if (i === 0) {
|
|
3081
|
+
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
3082
|
+
currencySymbol: curr.value,
|
|
3083
|
+
prefix: curr.value
|
|
3084
|
+
});
|
|
3085
|
+
} else {
|
|
3086
|
+
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
3087
|
+
currencySymbol: curr.value,
|
|
3088
|
+
suffix: curr.value
|
|
3089
|
+
});
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
if (curr.type === 'group') {
|
|
3093
|
+
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
3094
|
+
groupSeparator: curr.value
|
|
3095
|
+
});
|
|
3096
|
+
}
|
|
3097
|
+
if (curr.type === 'decimal') {
|
|
3098
|
+
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
3099
|
+
decimalSeparator: curr.value
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
return prev;
|
|
3103
|
+
}, defaultConfig);
|
|
3104
|
+
};
|
|
3105
|
+
|
|
3106
|
+
var isNumber = function isNumber(input) {
|
|
3107
|
+
return RegExp(/\d/, 'gi').test(input);
|
|
3108
|
+
};
|
|
3109
|
+
|
|
3110
|
+
var padTrimValue = function padTrimValue(value) {
|
|
3111
|
+
var decimalSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.';
|
|
3112
|
+
var decimalScale = arguments.length > 2 ? arguments[2] : undefined;
|
|
3113
|
+
if (decimalScale === undefined || value === '' || value === undefined) {
|
|
3114
|
+
return value;
|
|
3115
|
+
}
|
|
3116
|
+
if (!value.match(/\d/g)) {
|
|
3117
|
+
return '';
|
|
3118
|
+
}
|
|
3119
|
+
var _value$split = value.split(decimalSeparator),
|
|
3120
|
+
_value$split2 = _slicedToArray(_value$split, 2),
|
|
3121
|
+
_int = _value$split2[0],
|
|
3122
|
+
decimals = _value$split2[1];
|
|
3123
|
+
if (decimalScale === 0) {
|
|
3124
|
+
return _int;
|
|
3125
|
+
}
|
|
3126
|
+
var newValue = decimals || '';
|
|
3127
|
+
if (newValue.length < decimalScale) {
|
|
3128
|
+
while (newValue.length < decimalScale) {
|
|
3129
|
+
newValue += '0';
|
|
3130
|
+
}
|
|
3131
|
+
} else {
|
|
3132
|
+
newValue = newValue.slice(0, decimalScale);
|
|
3133
|
+
}
|
|
3134
|
+
return "".concat(_int).concat(decimalSeparator).concat(newValue);
|
|
3135
|
+
};
|
|
3136
|
+
|
|
3137
|
+
/**
|
|
3138
|
+
* Based on the last key stroke and the cursor position, update the value
|
|
3139
|
+
* and reposition the cursor to the right place
|
|
3140
|
+
*/
|
|
3141
|
+
var repositionCursor = function repositionCursor(_ref) {
|
|
3142
|
+
var selectionStart = _ref.selectionStart,
|
|
3143
|
+
value = _ref.value,
|
|
3144
|
+
lastKeyStroke = _ref.lastKeyStroke,
|
|
3145
|
+
stateValue = _ref.stateValue,
|
|
3146
|
+
groupSeparator = _ref.groupSeparator;
|
|
3147
|
+
var cursorPosition = selectionStart;
|
|
3148
|
+
var modifiedValue = value;
|
|
3149
|
+
if (stateValue && cursorPosition) {
|
|
3150
|
+
var splitValue = value.split('');
|
|
3151
|
+
// if cursor is to right of groupSeparator and backspace pressed, delete the character to the left of the separator and reposition the cursor
|
|
3152
|
+
if (lastKeyStroke === 'Backspace' && stateValue[cursorPosition] === groupSeparator) {
|
|
3153
|
+
splitValue.splice(cursorPosition - 1, 1);
|
|
3154
|
+
cursorPosition -= 1;
|
|
3155
|
+
}
|
|
3156
|
+
// if cursor is to left of groupSeparator and delete pressed, delete the character to the right of the separator and reposition the cursor
|
|
3157
|
+
if (lastKeyStroke === 'Delete' && stateValue[cursorPosition] === groupSeparator) {
|
|
3158
|
+
splitValue.splice(cursorPosition, 1);
|
|
3159
|
+
cursorPosition += 1;
|
|
3160
|
+
}
|
|
3161
|
+
modifiedValue = splitValue.join('');
|
|
3162
|
+
return {
|
|
3163
|
+
modifiedValue: modifiedValue,
|
|
3164
|
+
cursorPosition: cursorPosition
|
|
3165
|
+
};
|
|
3166
|
+
}
|
|
3167
|
+
return {
|
|
3168
|
+
modifiedValue: modifiedValue,
|
|
3169
|
+
cursorPosition: selectionStart
|
|
3170
|
+
};
|
|
3171
|
+
};
|
|
3172
|
+
|
|
3173
|
+
var _excluded = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "onValueChange", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
|
|
3174
|
+
var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3175
|
+
var _ref$allowDecimals = _ref.allowDecimals,
|
|
3176
|
+
allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
|
|
3177
|
+
_ref$allowNegativeVal = _ref.allowNegativeValue,
|
|
3178
|
+
allowNegativeValue = _ref$allowNegativeVal === void 0 ? true : _ref$allowNegativeVal,
|
|
3179
|
+
id = _ref.id,
|
|
3180
|
+
name = _ref.name,
|
|
3181
|
+
className = _ref.className,
|
|
3182
|
+
customInput = _ref.customInput,
|
|
3183
|
+
decimalsLimit = _ref.decimalsLimit,
|
|
3184
|
+
defaultValue = _ref.defaultValue,
|
|
3185
|
+
_ref$disabled = _ref.disabled,
|
|
3186
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
3187
|
+
userMaxLength = _ref.maxLength,
|
|
3188
|
+
userValue = _ref.value,
|
|
3189
|
+
onValueChange = _ref.onValueChange,
|
|
3190
|
+
fixedDecimalLength = _ref.fixedDecimalLength,
|
|
3191
|
+
placeholder = _ref.placeholder,
|
|
3192
|
+
decimalScale = _ref.decimalScale,
|
|
3193
|
+
prefix = _ref.prefix,
|
|
3194
|
+
suffix = _ref.suffix,
|
|
3195
|
+
intlConfig = _ref.intlConfig,
|
|
3196
|
+
step = _ref.step,
|
|
3197
|
+
min = _ref.min,
|
|
3198
|
+
max = _ref.max,
|
|
3199
|
+
_ref$disableGroupSepa = _ref.disableGroupSeparators,
|
|
3200
|
+
disableGroupSeparators = _ref$disableGroupSepa === void 0 ? false : _ref$disableGroupSepa,
|
|
3201
|
+
_ref$disableAbbreviat = _ref.disableAbbreviations,
|
|
3202
|
+
disableAbbreviations = _ref$disableAbbreviat === void 0 ? false : _ref$disableAbbreviat,
|
|
3203
|
+
_decimalSeparator = _ref.decimalSeparator,
|
|
3204
|
+
_groupSeparator = _ref.groupSeparator,
|
|
3205
|
+
onChange = _ref.onChange,
|
|
3206
|
+
onFocus = _ref.onFocus,
|
|
3207
|
+
onBlur = _ref.onBlur,
|
|
3208
|
+
onKeyDown = _ref.onKeyDown,
|
|
3209
|
+
onKeyUp = _ref.onKeyUp,
|
|
3210
|
+
transformRawValue = _ref.transformRawValue,
|
|
3211
|
+
_ref$formatValueOnBlu = _ref.formatValueOnBlur,
|
|
3212
|
+
formatValueOnBlur = _ref$formatValueOnBlu === void 0 ? true : _ref$formatValueOnBlu,
|
|
3213
|
+
children = _ref.children,
|
|
3214
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
3215
|
+
var theme$1 = theme.useTheme();
|
|
3216
|
+
if (_decimalSeparator && isNumber(_decimalSeparator)) {
|
|
3217
|
+
throw new Error('decimalSeparator cannot be a number');
|
|
3218
|
+
}
|
|
3219
|
+
if (_groupSeparator && isNumber(_groupSeparator)) {
|
|
3220
|
+
throw new Error('groupSeparator cannot be a number');
|
|
3221
|
+
}
|
|
3222
|
+
var localeConfig = React.useMemo(function () {
|
|
3223
|
+
return getLocaleConfig(intlConfig);
|
|
3224
|
+
}, [intlConfig]);
|
|
3225
|
+
var decimalSeparator = _decimalSeparator || localeConfig.decimalSeparator || '';
|
|
3226
|
+
var groupSeparator = _groupSeparator || localeConfig.groupSeparator || '';
|
|
3227
|
+
if (decimalSeparator && groupSeparator && decimalSeparator === groupSeparator && disableGroupSeparators === false) {
|
|
3228
|
+
throw new Error('decimalSeparator cannot be the same as groupSeparator');
|
|
3229
|
+
}
|
|
3230
|
+
var formatValueOptions = {
|
|
3231
|
+
decimalSeparator: decimalSeparator,
|
|
3232
|
+
groupSeparator: groupSeparator,
|
|
3233
|
+
disableGroupSeparators: disableGroupSeparators,
|
|
3234
|
+
intlConfig: intlConfig,
|
|
3235
|
+
prefix: prefix || localeConfig.prefix,
|
|
3236
|
+
suffix: suffix
|
|
3237
|
+
};
|
|
3238
|
+
var cleanValueOptions = {
|
|
3239
|
+
decimalSeparator: decimalSeparator,
|
|
3240
|
+
groupSeparator: groupSeparator,
|
|
3241
|
+
allowDecimals: allowDecimals,
|
|
3242
|
+
decimalsLimit: decimalsLimit || fixedDecimalLength || 2,
|
|
3243
|
+
allowNegativeValue: allowNegativeValue,
|
|
3244
|
+
disableAbbreviations: disableAbbreviations,
|
|
3245
|
+
prefix: prefix || localeConfig.prefix,
|
|
3246
|
+
transformRawValue: transformRawValue
|
|
3247
|
+
};
|
|
3248
|
+
var _useState = React.useState(function () {
|
|
3249
|
+
return defaultValue != null ? formatValue(_objectSpread2(_objectSpread2({}, formatValueOptions), {}, {
|
|
3250
|
+
decimalScale: decimalScale,
|
|
3251
|
+
value: String(defaultValue)
|
|
3252
|
+
})) : userValue != null ? formatValue(_objectSpread2(_objectSpread2({}, formatValueOptions), {}, {
|
|
3253
|
+
decimalScale: decimalScale,
|
|
3254
|
+
value: String(userValue)
|
|
3255
|
+
})) : '';
|
|
3256
|
+
}),
|
|
3257
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3258
|
+
stateValue = _useState2[0],
|
|
3259
|
+
setStateValue = _useState2[1];
|
|
3260
|
+
var _useState3 = React.useState(false),
|
|
3261
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
3262
|
+
dirty = _useState4[0],
|
|
3263
|
+
setDirty = _useState4[1];
|
|
3264
|
+
var _useState5 = React.useState(0),
|
|
3265
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
3266
|
+
cursor = _useState6[0],
|
|
3267
|
+
setCursor = _useState6[1];
|
|
3268
|
+
var _useState7 = React.useState(0),
|
|
3269
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
3270
|
+
changeCount = _useState8[0],
|
|
3271
|
+
setChangeCount = _useState8[1];
|
|
3272
|
+
var _useState9 = React.useState(null),
|
|
3273
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
3274
|
+
lastKeyStroke = _useState0[0],
|
|
3275
|
+
setLastKeyStroke = _useState0[1];
|
|
3276
|
+
var inputRef = React.useRef(null);
|
|
3277
|
+
React.useImperativeHandle(ref, function () {
|
|
3278
|
+
return inputRef.current;
|
|
3279
|
+
});
|
|
3280
|
+
|
|
3281
|
+
/**
|
|
3282
|
+
* Process change in value
|
|
3283
|
+
*/
|
|
3284
|
+
var processChange = function processChange(value, selectionStart) {
|
|
3285
|
+
setDirty(true);
|
|
3286
|
+
var _repositionCursor = repositionCursor({
|
|
3287
|
+
selectionStart: selectionStart,
|
|
3288
|
+
value: value,
|
|
3289
|
+
lastKeyStroke: lastKeyStroke,
|
|
3290
|
+
stateValue: stateValue,
|
|
3291
|
+
groupSeparator: groupSeparator
|
|
3292
|
+
}),
|
|
3293
|
+
modifiedValue = _repositionCursor.modifiedValue,
|
|
3294
|
+
cursorPosition = _repositionCursor.cursorPosition;
|
|
3295
|
+
var stringValue = cleanValue(_objectSpread2({
|
|
3296
|
+
value: modifiedValue
|
|
3297
|
+
}, cleanValueOptions));
|
|
3298
|
+
if (userMaxLength && stringValue.replace(/-/g, '').length > userMaxLength) {
|
|
3299
|
+
return;
|
|
3300
|
+
}
|
|
3301
|
+
if (stringValue === '' || stringValue === '-' || stringValue === decimalSeparator) {
|
|
3302
|
+
onValueChange && onValueChange(undefined, name, {
|
|
3303
|
+
"float": null,
|
|
3304
|
+
formatted: '',
|
|
3305
|
+
value: ''
|
|
3306
|
+
});
|
|
3307
|
+
setStateValue(stringValue);
|
|
3308
|
+
// Always sets cursor after '-' or decimalSeparator input
|
|
3309
|
+
setCursor(1);
|
|
3310
|
+
return;
|
|
3311
|
+
}
|
|
3312
|
+
var stringValueWithoutSeparator = decimalSeparator ? stringValue.replace(decimalSeparator, '.') : stringValue;
|
|
3313
|
+
var numberValue = parseFloat(stringValueWithoutSeparator);
|
|
3314
|
+
var formattedValue = formatValue(_objectSpread2({
|
|
3315
|
+
value: stringValue
|
|
3316
|
+
}, formatValueOptions));
|
|
3317
|
+
if (cursorPosition != null) {
|
|
3318
|
+
// Prevent cursor jumping
|
|
3319
|
+
var newCursor = cursorPosition + (formattedValue.length - value.length);
|
|
3320
|
+
newCursor = newCursor <= 0 ? prefix ? prefix.length : 0 : newCursor;
|
|
3321
|
+
setCursor(newCursor);
|
|
3322
|
+
setChangeCount(changeCount + 1);
|
|
3323
|
+
}
|
|
3324
|
+
setStateValue(formattedValue);
|
|
3325
|
+
if (onValueChange) {
|
|
3326
|
+
var values = {
|
|
3327
|
+
"float": numberValue,
|
|
3328
|
+
formatted: formattedValue,
|
|
3329
|
+
value: stringValue
|
|
3330
|
+
};
|
|
3331
|
+
onValueChange(stringValue, name, values);
|
|
3332
|
+
}
|
|
3333
|
+
};
|
|
3334
|
+
|
|
3335
|
+
/**
|
|
3336
|
+
* Handle change event
|
|
3337
|
+
*/
|
|
3338
|
+
var handleOnChange = function handleOnChange(event) {
|
|
3339
|
+
var _event$target = event.target,
|
|
3340
|
+
value = _event$target.value,
|
|
3341
|
+
selectionStart = _event$target.selectionStart;
|
|
3342
|
+
processChange(value, selectionStart);
|
|
3343
|
+
onChange && onChange(event);
|
|
3344
|
+
};
|
|
3345
|
+
|
|
3346
|
+
/**
|
|
3347
|
+
* Handle focus event
|
|
3348
|
+
*/
|
|
3349
|
+
var handleOnFocus = function handleOnFocus(event) {
|
|
3350
|
+
onFocus && onFocus(event);
|
|
3351
|
+
return stateValue ? stateValue.length : 0;
|
|
3352
|
+
};
|
|
3353
|
+
|
|
3354
|
+
/**
|
|
3355
|
+
* Handle blur event
|
|
3356
|
+
*
|
|
3357
|
+
* Format value by padding/trimming decimals if required by
|
|
3358
|
+
*/
|
|
3359
|
+
var handleOnBlur = function handleOnBlur(event) {
|
|
3360
|
+
var value = event.target.value;
|
|
3361
|
+
var valueOnly = cleanValue(_objectSpread2({
|
|
3362
|
+
value: value
|
|
3363
|
+
}, cleanValueOptions));
|
|
3364
|
+
if (valueOnly === '-' || valueOnly === decimalSeparator || !valueOnly) {
|
|
3365
|
+
setStateValue('');
|
|
3366
|
+
onBlur && onBlur(event);
|
|
3367
|
+
return;
|
|
3368
|
+
}
|
|
3369
|
+
var fixedDecimals = fixedDecimalValue(valueOnly, decimalSeparator, fixedDecimalLength);
|
|
3370
|
+
var newValue = padTrimValue(fixedDecimals, decimalSeparator, decimalScale !== undefined ? decimalScale : fixedDecimalLength);
|
|
3371
|
+
var numberValue = parseFloat(newValue.replace(decimalSeparator, '.'));
|
|
3372
|
+
var formattedValue = formatValue(_objectSpread2(_objectSpread2({}, formatValueOptions), {}, {
|
|
3373
|
+
value: newValue
|
|
3374
|
+
}));
|
|
3375
|
+
if (onValueChange && formatValueOnBlur) {
|
|
3376
|
+
onValueChange(newValue, name, {
|
|
3377
|
+
"float": numberValue,
|
|
3378
|
+
formatted: formattedValue,
|
|
3379
|
+
value: newValue
|
|
3380
|
+
});
|
|
3381
|
+
}
|
|
3382
|
+
setStateValue(formattedValue);
|
|
3383
|
+
onBlur && onBlur(event);
|
|
3384
|
+
};
|
|
3385
|
+
|
|
3386
|
+
/**
|
|
3387
|
+
* Handle key down event
|
|
3388
|
+
*
|
|
3389
|
+
* Increase or decrease value by step
|
|
3390
|
+
*/
|
|
3391
|
+
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
3392
|
+
var key = event.key;
|
|
3393
|
+
setLastKeyStroke(key);
|
|
3394
|
+
if (step && (key === 'ArrowUp' || key === 'ArrowDown')) {
|
|
3395
|
+
event.preventDefault();
|
|
3396
|
+
setCursor(stateValue.length);
|
|
3397
|
+
var currentValue = parseFloat(userValue != null ? String(userValue).replace(decimalSeparator, '.') : cleanValue(_objectSpread2({
|
|
3398
|
+
value: stateValue
|
|
3399
|
+
}, cleanValueOptions))) || 0;
|
|
3400
|
+
var newValue = key === 'ArrowUp' ? currentValue + step : currentValue - step;
|
|
3401
|
+
if (min !== undefined && newValue < Number(min)) {
|
|
3402
|
+
return;
|
|
3403
|
+
}
|
|
3404
|
+
if (max !== undefined && newValue > Number(max)) {
|
|
3405
|
+
return;
|
|
3406
|
+
}
|
|
3407
|
+
var fixedLength = String(step).includes('.') ? Number(String(step).split('.')[1].length) : undefined;
|
|
3408
|
+
processChange(String(fixedLength ? newValue.toFixed(fixedLength) : newValue).replace('.', decimalSeparator));
|
|
3409
|
+
}
|
|
3410
|
+
onKeyDown && onKeyDown(event);
|
|
3411
|
+
};
|
|
3412
|
+
|
|
3413
|
+
/**
|
|
3414
|
+
* Handle key up event
|
|
3415
|
+
*
|
|
3416
|
+
* Move cursor if there is a suffix to prevent user typing past suffix
|
|
3417
|
+
*/
|
|
3418
|
+
var handleOnKeyUp = function handleOnKeyUp(event) {
|
|
3419
|
+
var key = event.key,
|
|
3420
|
+
selectionStart = event.currentTarget.selectionStart;
|
|
3421
|
+
if (key !== 'ArrowUp' && key !== 'ArrowDown' && stateValue !== '-') {
|
|
3422
|
+
var _suffix = getSuffix(stateValue, {
|
|
3423
|
+
groupSeparator: groupSeparator,
|
|
3424
|
+
decimalSeparator: decimalSeparator
|
|
3425
|
+
});
|
|
3426
|
+
if (_suffix && selectionStart && selectionStart > stateValue.length - _suffix.length) {
|
|
3427
|
+
/* istanbul ignore else */
|
|
3428
|
+
if (inputRef.current) {
|
|
3429
|
+
var newCursor = stateValue.length - _suffix.length;
|
|
3430
|
+
inputRef.current.setSelectionRange(newCursor, newCursor);
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
onKeyUp && onKeyUp(event);
|
|
3435
|
+
};
|
|
3436
|
+
|
|
3437
|
+
// Update state if userValue changes to undefined
|
|
3438
|
+
React.useEffect(function () {
|
|
3439
|
+
if (userValue == null && defaultValue == null) {
|
|
3440
|
+
setStateValue('');
|
|
3441
|
+
}
|
|
3442
|
+
}, [defaultValue, userValue]);
|
|
3443
|
+
React.useEffect(function () {
|
|
3444
|
+
// prevent cursor jumping if editing value
|
|
3445
|
+
if (dirty && stateValue !== '-' && inputRef.current && document.activeElement === inputRef.current) {
|
|
3446
|
+
inputRef.current.setSelectionRange(cursor, cursor);
|
|
3447
|
+
}
|
|
3448
|
+
}, [stateValue, cursor, inputRef, dirty, changeCount]);
|
|
3449
|
+
|
|
3450
|
+
/**
|
|
3451
|
+
* If user has only entered "-" or decimal separator,
|
|
3452
|
+
* keep the char to allow them to enter next value
|
|
3453
|
+
*/
|
|
3454
|
+
var getRenderValue = function getRenderValue() {
|
|
3455
|
+
if (userValue != null && stateValue !== '-' && (!decimalSeparator || stateValue !== decimalSeparator)) {
|
|
3456
|
+
return formatValue(_objectSpread2(_objectSpread2({}, formatValueOptions), {}, {
|
|
3457
|
+
decimalScale: dirty ? undefined : decimalScale,
|
|
3458
|
+
value: String(userValue)
|
|
3459
|
+
}));
|
|
3460
|
+
}
|
|
3461
|
+
return stateValue;
|
|
3462
|
+
};
|
|
3463
|
+
var inputProps = _objectSpread2({
|
|
3464
|
+
type: 'text',
|
|
3465
|
+
inputMode: 'decimal',
|
|
3466
|
+
id: id,
|
|
3467
|
+
name: name,
|
|
3468
|
+
className: className,
|
|
3469
|
+
onChange: handleOnChange,
|
|
3470
|
+
onBlur: handleOnBlur,
|
|
3471
|
+
onFocus: handleOnFocus,
|
|
3472
|
+
onKeyDown: handleOnKeyDown,
|
|
3473
|
+
onKeyUp: handleOnKeyUp,
|
|
3474
|
+
placeholder: placeholder,
|
|
3475
|
+
disabled: disabled,
|
|
3476
|
+
value: getRenderValue(),
|
|
3477
|
+
ref: inputRef
|
|
3478
|
+
}, props);
|
|
3479
|
+
if (customInput) {
|
|
3480
|
+
var CustomInput = customInput;
|
|
3481
|
+
return /*#__PURE__*/React.createElement(CustomInput, inputProps);
|
|
3482
|
+
}
|
|
3483
|
+
return /*#__PURE__*/React.createElement("div", null, children && /*#__PURE__*/React.createElement("label", {
|
|
3484
|
+
style: {
|
|
3485
|
+
display: 'block',
|
|
3486
|
+
marginBottom: '0.7rem',
|
|
3487
|
+
fontSize: '14px',
|
|
3488
|
+
fontWeight: 'light'
|
|
3489
|
+
}
|
|
3490
|
+
}, children), /*#__PURE__*/React.createElement("input", _extends({}, inputProps, {
|
|
3491
|
+
style: {
|
|
3492
|
+
textAlign: 'right',
|
|
3493
|
+
border: "1px solid ".concat(theme$1.palette.border),
|
|
3494
|
+
fontSize: '14px',
|
|
3495
|
+
borderRadius: '5px',
|
|
3496
|
+
height: '35px',
|
|
3497
|
+
padding: '5px 10px',
|
|
3498
|
+
fontWeight: 'light',
|
|
3499
|
+
width: 'auto',
|
|
3500
|
+
background: 'transparent',
|
|
3501
|
+
minWidth: '200px'
|
|
3502
|
+
}
|
|
3503
|
+
})));
|
|
3504
|
+
});
|
|
3505
|
+
|
|
1364
3506
|
/* "use client" */
|
|
1365
3507
|
Input.Textarea = Textarea;
|
|
1366
3508
|
Input.Password = InputPassword;
|
|
3509
|
+
Input.Phone = PhoneInput;
|
|
3510
|
+
Input.Currency = InputCurrency;
|
|
1367
3511
|
|
|
1368
3512
|
exports.default = Input;
|
|
1369
3513
|
exports.getColors = getColors;
|