ecomlab-components-next 0.1.88 → 0.1.90
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.
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
|
|
4
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports["default"] = void 0;
|
|
7
|
-
var _react = require("react");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
10
|
var _imask = _interopRequireDefault(require("imask"));
|
|
9
11
|
var _libphonenumberJs = require("libphonenumber-js");
|
|
10
12
|
require("./InputDinamycPlaceholder.scss");
|
|
11
|
-
var _excluded = ["tooltip", "tooltipStatic", "rows", "changeValue", "setChangeValue", "classname", "placeholder", "type", "onChange", "passwordTooltip", "err", "textErr", "infoHeader", "info", "autoComplete", "disabled", "showClearIndicator", "multiline", "maxLength", "autoFocus", "variant", "size", "maxlength", "required", "onBlur", "mask", "readOnly", "countrySelect"];
|
|
13
|
+
var _excluded = ["tooltip", "tooltipStatic", "rows", "changeValue", "setChangeValue", "classname", "placeholder", "type", "onChange", "passwordTooltip", "err", "textErr", "infoHeader", "info", "autoComplete", "disabled", "showClearIndicator", "multiline", "maxLength", "autoFocus", "variant", "size", "maxlength", "required", "onBlur", "mask", "readOnly", "countrySelect", "countryDefault"];
|
|
12
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
13
17
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
14
18
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
19
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -62,6 +66,8 @@ var InputDinamycPlaceholder = function InputDinamycPlaceholder(_ref) {
|
|
|
62
66
|
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
63
67
|
_ref$countrySelect = _ref.countrySelect,
|
|
64
68
|
countrySelect = _ref$countrySelect === void 0 ? false : _ref$countrySelect,
|
|
69
|
+
_ref$countryDefault = _ref.countryDefault,
|
|
70
|
+
countryDefault = _ref$countryDefault === void 0 ? 'RU' : _ref$countryDefault,
|
|
65
71
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
66
72
|
var _useState = (0, _react.useState)(false),
|
|
67
73
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -79,12 +85,13 @@ var InputDinamycPlaceholder = function InputDinamycPlaceholder(_ref) {
|
|
|
79
85
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
80
86
|
isFocus = _useState8[0],
|
|
81
87
|
setIsFocus = _useState8[1];
|
|
82
|
-
var _useState9 = (0, _react.useState)(
|
|
88
|
+
var _useState9 = (0, _react.useState)(countryDefault),
|
|
83
89
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
84
90
|
country = _useState10[0],
|
|
85
91
|
setCountry = _useState10[1]; // По умолчанию Россия
|
|
86
92
|
var inputRef = (0, _react.useRef)(null);
|
|
87
93
|
var maskRef = (0, _react.useRef)(null);
|
|
94
|
+
console.log(valueInside);
|
|
88
95
|
|
|
89
96
|
// Список всех стран
|
|
90
97
|
var countries = (0, _libphonenumberJs.getCountries)();
|
|
@@ -105,9 +112,7 @@ var InputDinamycPlaceholder = function InputDinamycPlaceholder(_ref) {
|
|
|
105
112
|
maskRef.current.destroy();
|
|
106
113
|
}
|
|
107
114
|
maskRef.current = (0, _imask["default"])(inputRef.current, newMask);
|
|
108
|
-
|
|
109
|
-
setValueInside(maskRef.current.value);
|
|
110
|
-
});
|
|
115
|
+
setValueInside('');
|
|
111
116
|
}
|
|
112
117
|
};
|
|
113
118
|
|
|
@@ -150,13 +155,13 @@ var InputDinamycPlaceholder = function InputDinamycPlaceholder(_ref) {
|
|
|
150
155
|
(0, _react.useEffect)(function () {
|
|
151
156
|
setValueInside(changeValue || '');
|
|
152
157
|
}, [changeValue]);
|
|
153
|
-
return /*#__PURE__*/
|
|
158
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
154
159
|
className: "input-dinamyc-placeholder",
|
|
155
160
|
style: {
|
|
156
161
|
width: '100%',
|
|
157
162
|
marginBottom: tooltip ? '24px' : ''
|
|
158
163
|
}
|
|
159
|
-
}, countrySelect && /*#__PURE__*/
|
|
164
|
+
}, countrySelect && /*#__PURE__*/_react["default"].createElement("select", {
|
|
160
165
|
value: country,
|
|
161
166
|
onChange: handleCountryChange,
|
|
162
167
|
style: {
|
|
@@ -167,13 +172,13 @@ var InputDinamycPlaceholder = function InputDinamycPlaceholder(_ref) {
|
|
|
167
172
|
marginBottom: '12px'
|
|
168
173
|
}
|
|
169
174
|
}, countries.map(function (countryCode) {
|
|
170
|
-
return /*#__PURE__*/
|
|
175
|
+
return /*#__PURE__*/_react["default"].createElement("option", {
|
|
171
176
|
key: countryCode,
|
|
172
177
|
value: countryCode
|
|
173
178
|
}, getCountryName(countryCode), " (+", (0, _libphonenumberJs.getCountryCallingCode)(countryCode), ")");
|
|
174
|
-
})), /*#__PURE__*/
|
|
179
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
175
180
|
className: "".concat(err ? 'input-box__err' : 'input-box', " ").concat(size === 's' ? 'size-s' : 'size-l', " ").concat(disabled ? 'input-box_disabled' : '')
|
|
176
|
-
}, /*#__PURE__*/
|
|
181
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
177
182
|
ref: inputRef,
|
|
178
183
|
className: "input-dynamic",
|
|
179
184
|
maxLength: maxlength,
|
|
@@ -201,46 +206,46 @@ var InputDinamycPlaceholder = function InputDinamycPlaceholder(_ref) {
|
|
|
201
206
|
disabled: disabled,
|
|
202
207
|
required: required,
|
|
203
208
|
size: size
|
|
204
|
-
}), placeholder && /*#__PURE__*/
|
|
209
|
+
}), placeholder && /*#__PURE__*/_react["default"].createElement("div", {
|
|
205
210
|
className: valueInside.length > 0 || isFocus ? 'placeholder-dinamyc_min-blue' : 'placeholder-dinamyc'
|
|
206
|
-
}, /*#__PURE__*/
|
|
211
|
+
}, /*#__PURE__*/_react["default"].createElement("label", null, placeholder, required && /*#__PURE__*/_react["default"].createElement("span", {
|
|
207
212
|
style: {
|
|
208
213
|
color: 'red'
|
|
209
214
|
}
|
|
210
|
-
}, " *"))), /*#__PURE__*/
|
|
215
|
+
}, " *"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
211
216
|
className: "input-box__clean-value"
|
|
212
|
-
}, showClearIndicator && (valueInside === null || valueInside === void 0 ? void 0 : valueInside.length) > 0 && /*#__PURE__*/
|
|
217
|
+
}, showClearIndicator && (valueInside === null || valueInside === void 0 ? void 0 : valueInside.length) > 0 && /*#__PURE__*/_react["default"].createElement("button", {
|
|
213
218
|
className: "btn__clean",
|
|
214
219
|
onClick: function onClick() {
|
|
215
220
|
return setValueInside('');
|
|
216
221
|
}
|
|
217
|
-
}), type === 'password' && /*#__PURE__*/
|
|
222
|
+
}), type === 'password' && /*#__PURE__*/_react["default"].createElement("button", {
|
|
218
223
|
className: "btn__".concat(hidePassword ? 'show' : 'hide'),
|
|
219
224
|
onClick: function onClick() {
|
|
220
225
|
return setHidePassword(!hidePassword);
|
|
221
226
|
}
|
|
222
|
-
}), info && !err && showInfo && /*#__PURE__*/
|
|
227
|
+
}), info && !err && showInfo && /*#__PURE__*/_react["default"].createElement("div", {
|
|
223
228
|
className: "input-box__info"
|
|
224
|
-
}, /*#__PURE__*/
|
|
229
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
225
230
|
className: "tooltip-box"
|
|
226
|
-
}, /*#__PURE__*/
|
|
231
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
227
232
|
className: "btn__info",
|
|
228
233
|
disabled: true
|
|
229
|
-
}), /*#__PURE__*/
|
|
234
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
230
235
|
className: "tooltip"
|
|
231
|
-
}, /*#__PURE__*/
|
|
236
|
+
}, /*#__PURE__*/_react["default"].createElement("h6", {
|
|
232
237
|
className: "title"
|
|
233
|
-
}, infoHeader), /*#__PURE__*/
|
|
238
|
+
}, infoHeader), /*#__PURE__*/_react["default"].createElement("p", {
|
|
234
239
|
className: "text"
|
|
235
|
-
}, info))))), err ? /*#__PURE__*/
|
|
240
|
+
}, info))))), err ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
236
241
|
className: "err"
|
|
237
|
-
}, /*#__PURE__*/
|
|
242
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
238
243
|
className: "text_red"
|
|
239
|
-
}, textErr)) : /*#__PURE__*/
|
|
244
|
+
}, textErr)) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
240
245
|
className: "err"
|
|
241
|
-
}, /*#__PURE__*/
|
|
246
|
+
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
242
247
|
className: "text_tooltip"
|
|
243
|
-
}, tooltip))), tooltipStatic && /*#__PURE__*/
|
|
248
|
+
}, tooltip))), tooltipStatic && /*#__PURE__*/_react["default"].createElement("p", {
|
|
244
249
|
className: "text_tooltip-mui"
|
|
245
250
|
}, tooltipStatic));
|
|
246
251
|
};
|