tg-core-components 5.2.1-history-time-label.0 → 5.3.0-master.1
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/es/components/AcceptUpdatedTaC/index.js +8 -3
- package/es/components/Checkbox/index.js +93 -0
- package/es/components/Deposit/CardInput/index.js +1 -3
- package/es/components/Input/index.js +222 -22
- package/es/components/InputWrapper/index.js +69 -0
- package/es/components/Notification.js +4 -4
- package/es/components/Select/index.js +202 -64
- package/es/components/Select/test.js +111 -0
- package/es/index.js +2 -1
- package/es/lib/utils/translate.js +1 -8
- package/es/widgets/AccountDetail/index.js +53 -77
- package/es/widgets/ActivateWidget/index.js +59 -293
- package/es/widgets/BonusWidget/BonusCode.js +24 -17
- package/es/widgets/BonusWidget/index.js +83 -45
- package/es/widgets/Cashier/Deposit/PaymentForm/NewTab.js +28 -0
- package/es/widgets/Cashier/Deposit/PaymentForm/index.js +6 -2
- package/es/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +9 -6
- package/es/widgets/CashierAccordion/Deposit/DepositWidget/index.js +19 -29
- package/es/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +163 -347
- package/es/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -6
- package/es/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +8 -22
- package/es/widgets/ChangePassword/index.js +53 -40
- package/es/widgets/HistoryWidget/index.js +69 -51
- package/es/widgets/HistoryWidget/message.js +17 -20
- package/es/widgets/RequestResetPassword/index.js +15 -14
- package/es/widgets/ResetPassword/index.js +22 -18
- package/es/widgets/ResponsibleGamingAccordion/LimitStatus/index.js +5 -2
- package/es/widgets/ResponsibleGamingAccordion/PeriodItemContent/index.js +1 -2
- package/es/widgets/ResponsibleGamingSingleSignUp/AmountItem/index.js +1 -2
- package/es/widgets/ResponsibleGamingWidget/Timespan.js +14 -24
- package/es/widgets/ResponsibleGamingWidget/helpers.js +2 -2
- package/es/widgets/ResponsibleGamingWidget/validate.js +1 -1
- package/es/widgets/Settings/index.js +2 -2
- package/es/widgets/SignIn/SignInForm.js +4 -6
- package/es/widgets/SignIn/index.js +21 -21
- package/es/widgets/SignUp/ContactInfoStep.js +5 -6
- package/es/widgets/SportsbookSettings/index.js +10 -24
- package/es/widgets/Subscriptions/index.js +3 -5
- package/lib/components/AcceptUpdatedTaC/index.js +11 -3
- package/lib/components/Checkbox/index.js +106 -0
- package/lib/components/Deposit/CardInput/index.js +1 -3
- package/lib/components/Input/index.js +223 -26
- package/lib/components/InputWrapper/index.js +85 -0
- package/lib/components/Notification.js +3 -3
- package/lib/components/Select/index.js +209 -63
- package/lib/components/Select/test.js +121 -0
- package/lib/index.js +9 -4
- package/lib/lib/utils/translate.js +1 -8
- package/lib/widgets/AccountDetail/index.js +53 -86
- package/lib/widgets/ActivateWidget/index.js +58 -305
- package/lib/widgets/BonusWidget/BonusCode.js +24 -20
- package/lib/widgets/BonusWidget/index.js +85 -44
- package/lib/widgets/Cashier/Deposit/PaymentForm/NewTab.js +44 -0
- package/lib/widgets/Cashier/Deposit/PaymentForm/index.js +9 -2
- package/lib/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +13 -7
- package/lib/widgets/CashierAccordion/Deposit/DepositWidget/index.js +22 -32
- package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +195 -378
- package/lib/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -6
- package/lib/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +10 -24
- package/lib/widgets/ChangePassword/index.js +53 -43
- package/lib/widgets/HistoryWidget/index.js +69 -51
- package/lib/widgets/HistoryWidget/message.js +17 -20
- package/lib/widgets/RequestResetPassword/index.js +15 -17
- package/lib/widgets/ResetPassword/index.js +25 -21
- package/lib/widgets/ResponsibleGamingAccordion/LimitStatus/index.js +5 -2
- package/lib/widgets/ResponsibleGamingAccordion/PeriodItemContent/index.js +1 -2
- package/lib/widgets/ResponsibleGamingSingleSignUp/AmountItem/index.js +1 -2
- package/lib/widgets/ResponsibleGamingWidget/Timespan.js +14 -24
- package/lib/widgets/ResponsibleGamingWidget/helpers.js +2 -2
- package/lib/widgets/ResponsibleGamingWidget/validate.js +1 -1
- package/lib/widgets/Settings/index.js +6 -6
- package/lib/widgets/SignIn/SignInForm.js +7 -6
- package/lib/widgets/SignIn/index.js +25 -25
- package/lib/widgets/SignUp/ContactInfoStep.js +8 -6
- package/lib/widgets/SportsbookSettings/index.js +10 -24
- package/lib/widgets/Subscriptions/index.js +3 -11
- package/package.json +8 -3
- package/es/components/Input/BirthdateInput.js +0 -171
- package/es/components/Input/Checkbox.js +0 -51
- package/es/components/Input/Input.js +0 -73
- package/es/components/Input/PasswordInput.js +0 -84
- package/es/components/Input/PhoneNumberInput.js +0 -110
- package/es/components/Input/input.test.js +0 -80
- package/es/components/Input/old-input.test.js +0 -100
- package/es/components/common.js +0 -339
- package/lib/components/Input/BirthdateInput.js +0 -192
- package/lib/components/Input/Checkbox.js +0 -65
- package/lib/components/Input/Input.js +0 -87
- package/lib/components/Input/PasswordInput.js +0 -101
- package/lib/components/Input/PhoneNumberInput.js +0 -127
- package/lib/components/Input/input.test.js +0 -89
- package/lib/components/Input/old-input.test.js +0 -107
- package/lib/components/common.js +0 -359
|
@@ -12,8 +12,6 @@ import React from 'react';
|
|
|
12
12
|
import { injectIntl } from 'react-intl';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import translate from '../../lib/utils/translate';
|
|
15
|
-
import Button from '../../components/Button';
|
|
16
|
-
import Input from '../../components/Input';
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* @component Subscriptions
|
|
@@ -145,10 +143,10 @@ var Subscriptions = function (_React$Component) {
|
|
|
145
143
|
return React.createElement(
|
|
146
144
|
'div',
|
|
147
145
|
{ key: index, className: 'subscribe-item' },
|
|
148
|
-
React.createElement(
|
|
146
|
+
React.createElement('input', {
|
|
149
147
|
id: 'newsletter-checkbox-' + index,
|
|
150
148
|
type: 'checkbox',
|
|
151
|
-
|
|
149
|
+
checked: option.OptIn,
|
|
152
150
|
onChange: function onChange(e) {
|
|
153
151
|
return _this3.onClickCheckbox({ e: e, option: option });
|
|
154
152
|
}
|
|
@@ -163,7 +161,7 @@ var Subscriptions = function (_React$Component) {
|
|
|
163
161
|
);
|
|
164
162
|
}),
|
|
165
163
|
React.createElement(
|
|
166
|
-
|
|
164
|
+
'button',
|
|
167
165
|
{
|
|
168
166
|
className: 'button primary',
|
|
169
167
|
disabled: isLoading,
|
|
@@ -18,6 +18,10 @@ var _marked = require('marked');
|
|
|
18
18
|
|
|
19
19
|
var _marked2 = _interopRequireDefault(_marked);
|
|
20
20
|
|
|
21
|
+
var _Button = require('../../components/Button');
|
|
22
|
+
|
|
23
|
+
var _Button2 = _interopRequireDefault(_Button);
|
|
24
|
+
|
|
21
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
26
|
|
|
23
27
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -41,7 +45,8 @@ var AcceptUpdatedTaC = function (_Component) {
|
|
|
41
45
|
var _props = this.props,
|
|
42
46
|
onAccept = _props.onAccept,
|
|
43
47
|
termsContent = _props.termsContent,
|
|
44
|
-
current = _props.current
|
|
48
|
+
current = _props.current,
|
|
49
|
+
isLoading = _props.isLoading;
|
|
45
50
|
|
|
46
51
|
|
|
47
52
|
return _react2.default.createElement(
|
|
@@ -67,8 +72,11 @@ var AcceptUpdatedTaC = function (_Component) {
|
|
|
67
72
|
dangerouslySetInnerHTML: { __html: (0, _marked2.default)(termsContent || '') }
|
|
68
73
|
}),
|
|
69
74
|
_react2.default.createElement(
|
|
70
|
-
|
|
71
|
-
{
|
|
75
|
+
_Button2.default,
|
|
76
|
+
{
|
|
77
|
+
className: 'button primary',
|
|
78
|
+
onClick: onAccept,
|
|
79
|
+
isLoading: isLoading },
|
|
72
80
|
_react2.default.createElement(_Translate2.default, { id: 'action.accept' })
|
|
73
81
|
)
|
|
74
82
|
);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
+
|
|
9
|
+
var _react = require('react');
|
|
10
|
+
|
|
11
|
+
var _react2 = _interopRequireDefault(_react);
|
|
12
|
+
|
|
13
|
+
var _propTypes = require('prop-types');
|
|
14
|
+
|
|
15
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
16
|
+
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
|
|
19
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
|
+
|
|
21
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
22
|
+
|
|
23
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
24
|
+
|
|
25
|
+
var Checkbox = function (_React$Component) {
|
|
26
|
+
_inherits(Checkbox, _React$Component);
|
|
27
|
+
|
|
28
|
+
function Checkbox() {
|
|
29
|
+
_classCallCheck(this, Checkbox);
|
|
30
|
+
|
|
31
|
+
return _possibleConstructorReturn(this, (Checkbox.__proto__ || Object.getPrototypeOf(Checkbox)).apply(this, arguments));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_createClass(Checkbox, [{
|
|
35
|
+
key: 'render',
|
|
36
|
+
value: function render() {
|
|
37
|
+
var _props = this.props,
|
|
38
|
+
className = _props.className,
|
|
39
|
+
_onChange = _props.onChange,
|
|
40
|
+
title = _props.title,
|
|
41
|
+
name = _props.name,
|
|
42
|
+
error = _props.error,
|
|
43
|
+
checked = _props.checked;
|
|
44
|
+
|
|
45
|
+
if (!_onChange) {
|
|
46
|
+
throw new Error('You need to provide onChange function');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var randomId = Math.floor(Math.random() * 100000);
|
|
50
|
+
var wrapperClassName = 'Checkbox';
|
|
51
|
+
|
|
52
|
+
if (className) {
|
|
53
|
+
wrapperClassName += ' ' + className;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return _react2.default.createElement(
|
|
57
|
+
'div',
|
|
58
|
+
{ className: wrapperClassName },
|
|
59
|
+
_react2.default.createElement(
|
|
60
|
+
'div',
|
|
61
|
+
{ className: 'flex' },
|
|
62
|
+
_react2.default.createElement('input', {
|
|
63
|
+
id: 'checkbox-' + randomId,
|
|
64
|
+
type: 'checkbox',
|
|
65
|
+
defaultValue: null,
|
|
66
|
+
defaultChecked: this.props.value === 'true' ? true : false,
|
|
67
|
+
onChange: function onChange(e) {
|
|
68
|
+
_onChange(e, name, e.target.checked ? true : '');
|
|
69
|
+
},
|
|
70
|
+
name: name ? name : '',
|
|
71
|
+
checked: checked
|
|
72
|
+
}),
|
|
73
|
+
!_react2.default.isValidElement(title) ? _react2.default.createElement('label', {
|
|
74
|
+
htmlFor: 'checkbox-' + randomId,
|
|
75
|
+
dangerouslySetInnerHTML: { __html: title }
|
|
76
|
+
}) : _react2.default.createElement(
|
|
77
|
+
'label',
|
|
78
|
+
{ htmlFor: 'checkbox-' + randomId },
|
|
79
|
+
title
|
|
80
|
+
)
|
|
81
|
+
),
|
|
82
|
+
error && _react2.default.createElement(
|
|
83
|
+
'p',
|
|
84
|
+
{ className: 'error-text' },
|
|
85
|
+
error
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}]);
|
|
90
|
+
|
|
91
|
+
return Checkbox;
|
|
92
|
+
}(_react2.default.Component);
|
|
93
|
+
|
|
94
|
+
Checkbox.propTypes = {
|
|
95
|
+
/** Listens for value changes */
|
|
96
|
+
onChange: _propTypes2.default.func.isRequired,
|
|
97
|
+
/** Title for the checkboxes */
|
|
98
|
+
title: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
|
|
99
|
+
/** Css class name */
|
|
100
|
+
className: _propTypes2.default.string,
|
|
101
|
+
/** Name of the input element */
|
|
102
|
+
name: _propTypes2.default.string,
|
|
103
|
+
/** Errors output */
|
|
104
|
+
error: _propTypes2.default.array
|
|
105
|
+
};
|
|
106
|
+
exports.default = Checkbox;
|
|
@@ -54,9 +54,7 @@ var Input = exports.Input = function (_Component) {
|
|
|
54
54
|
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Input.__proto__ || Object.getPrototypeOf(Input)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
|
55
55
|
isFocusing: false
|
|
56
56
|
}, _this.formatInput = function (value) {
|
|
57
|
-
var
|
|
58
|
-
type = _this$props.type,
|
|
59
|
-
provider = _this$props.provider;
|
|
57
|
+
var type = _this.props.type;
|
|
60
58
|
|
|
61
59
|
|
|
62
60
|
if (!value) {
|
|
@@ -4,47 +4,244 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
|
+
|
|
9
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
+
|
|
7
11
|
var _react = require('react');
|
|
8
12
|
|
|
9
13
|
var _react2 = _interopRequireDefault(_react);
|
|
10
14
|
|
|
11
|
-
var
|
|
15
|
+
var _propTypes = require('prop-types');
|
|
12
16
|
|
|
13
|
-
var
|
|
17
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
14
18
|
|
|
15
|
-
var
|
|
19
|
+
var _ButtonLoader = require('../ButtonLoader');
|
|
16
20
|
|
|
17
|
-
var
|
|
21
|
+
var _ButtonLoader2 = _interopRequireDefault(_ButtonLoader);
|
|
18
22
|
|
|
19
|
-
var
|
|
23
|
+
var _classnames = require('classnames');
|
|
20
24
|
|
|
21
|
-
var
|
|
25
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
|
22
26
|
|
|
23
|
-
var
|
|
27
|
+
var _Icon = require('../Icon');
|
|
24
28
|
|
|
25
|
-
var
|
|
29
|
+
var _Icon2 = _interopRequireDefault(_Icon);
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
32
|
|
|
29
|
-
var
|
|
33
|
+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
30
34
|
|
|
31
|
-
function
|
|
35
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
36
|
+
|
|
37
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
38
|
+
|
|
39
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
40
|
+
|
|
41
|
+
var Input = function (_PureComponent) {
|
|
42
|
+
_inherits(Input, _PureComponent);
|
|
43
|
+
|
|
44
|
+
function Input(props) {
|
|
45
|
+
_classCallCheck(this, Input);
|
|
46
|
+
|
|
47
|
+
var _this = _possibleConstructorReturn(this, (Input.__proto__ || Object.getPrototypeOf(Input)).call(this, props));
|
|
48
|
+
|
|
49
|
+
_this._onTogglePassword = function () {
|
|
50
|
+
_this.setState({ showPassword: !_this.state.showPassword });
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
_this.getInputRef = function () {
|
|
54
|
+
return _this.input;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
_this._handleChange = function (e) {
|
|
58
|
+
var _this$props = _this.props,
|
|
59
|
+
onChange = _this$props.onChange,
|
|
60
|
+
name = _this$props.name;
|
|
61
|
+
|
|
62
|
+
var value = e.currentTarget.value;
|
|
32
63
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
_this.setState({
|
|
65
|
+
value: value
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
onChange && onChange(e, name, value);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
_this._handleFocus = function (e) {
|
|
72
|
+
var _this$props2 = _this.props,
|
|
73
|
+
onFocus = _this$props2.onFocus,
|
|
74
|
+
name = _this$props2.name;
|
|
75
|
+
var value = _this.state.value;
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
_this.setState({
|
|
79
|
+
isFocusing: true
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
onFocus && onFocus(e, name, value);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
_this._handleBlur = function () {
|
|
86
|
+
var onBlur = _this.props.onBlur;
|
|
87
|
+
var value = _this.state.value;
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
_this.setState({
|
|
91
|
+
isFocusing: false
|
|
92
|
+
});
|
|
93
|
+
onBlur && onBlur(value);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
_this._handleAutoFill = function (e) {
|
|
97
|
+
if (e.animationName === 'onAutoFill') {
|
|
98
|
+
_this.setState({
|
|
99
|
+
isAutoFill: true
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
_this.state = {
|
|
105
|
+
isFocusing: false,
|
|
106
|
+
showPassword: false,
|
|
107
|
+
value: props.value || '',
|
|
108
|
+
isAutoFill: false
|
|
109
|
+
};
|
|
110
|
+
return _this;
|
|
47
111
|
}
|
|
112
|
+
|
|
113
|
+
_createClass(Input, [{
|
|
114
|
+
key: 'componentWillReceiveProps',
|
|
115
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
116
|
+
if (!this.props.isControlled && typeof nextProps.value === 'undefined') {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (this.state.value !== nextProps.value) {
|
|
121
|
+
this.setState({ value: nextProps.value });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: 'render',
|
|
126
|
+
value: function render() {
|
|
127
|
+
var _props = this.props,
|
|
128
|
+
title = _props.title,
|
|
129
|
+
error = _props.error,
|
|
130
|
+
require = _props.require,
|
|
131
|
+
innerRef = _props.innerRef,
|
|
132
|
+
autoFocus = _props.autoFocus,
|
|
133
|
+
isLoading = _props.isLoading,
|
|
134
|
+
description = _props.description,
|
|
135
|
+
_props$type = _props.type,
|
|
136
|
+
type = _props$type === undefined ? 'text' : _props$type,
|
|
137
|
+
_props$className = _props.className,
|
|
138
|
+
className = _props$className === undefined ? '' : _props$className,
|
|
139
|
+
_props$showToggleIcon = _props.showToggleIcon,
|
|
140
|
+
showToggleIcon = _props$showToggleIcon === undefined ? false : _props$showToggleIcon,
|
|
141
|
+
rest = _objectWithoutProperties(_props, ['title', 'error', 'require', 'innerRef', 'autoFocus', 'isLoading', 'description', 'type', 'className', 'showToggleIcon']);
|
|
142
|
+
|
|
143
|
+
var _state = this.state,
|
|
144
|
+
value = _state.value,
|
|
145
|
+
isFocusing = _state.isFocusing,
|
|
146
|
+
showPassword = _state.showPassword,
|
|
147
|
+
isAutoFill = _state.isAutoFill;
|
|
148
|
+
|
|
149
|
+
var hasValue = !!value;
|
|
150
|
+
|
|
151
|
+
if (type === 'hidden') return _react2.default.createElement('input', _extends({}, rest, { type: type, value: value || '' }));
|
|
152
|
+
|
|
153
|
+
return _react2.default.createElement(
|
|
154
|
+
'div',
|
|
155
|
+
{
|
|
156
|
+
className: (0, _classnames2.default)('tg_input', className, {
|
|
157
|
+
input_focus: isFocusing,
|
|
158
|
+
tg_input_value: hasValue,
|
|
159
|
+
error: error,
|
|
160
|
+
has_title: title,
|
|
161
|
+
input_autofill: isAutoFill
|
|
162
|
+
}) },
|
|
163
|
+
_react2.default.createElement(
|
|
164
|
+
'div',
|
|
165
|
+
{ className: 'input-wrapper' },
|
|
166
|
+
title && _react2.default.createElement(
|
|
167
|
+
'div',
|
|
168
|
+
{ className: 'input_title' },
|
|
169
|
+
title + ' ' + (require ? '*' : '')
|
|
170
|
+
),
|
|
171
|
+
_react2.default.createElement('input', _extends({}, rest, {
|
|
172
|
+
ref: innerRef,
|
|
173
|
+
type: showToggleIcon && showPassword ? 'text' : type,
|
|
174
|
+
value: value || '',
|
|
175
|
+
autoFocus: autoFocus,
|
|
176
|
+
onChange: this._handleChange,
|
|
177
|
+
onFocus: this._handleFocus,
|
|
178
|
+
onBlur: this._handleBlur,
|
|
179
|
+
onAnimationStart: this._handleAutoFill
|
|
180
|
+
})),
|
|
181
|
+
isLoading && _react2.default.createElement(_ButtonLoader2.default, null),
|
|
182
|
+
showToggleIcon && _react2.default.createElement(_Icon2.default, {
|
|
183
|
+
icon: this.state.showPassword ? 'eye-slash' : 'eye',
|
|
184
|
+
className: 'toggle-password',
|
|
185
|
+
onClick: this._onTogglePassword
|
|
186
|
+
})
|
|
187
|
+
),
|
|
188
|
+
_react2.default.createElement('div', { className: 'bottom-line' }),
|
|
189
|
+
error && _react2.default.createElement(
|
|
190
|
+
'div',
|
|
191
|
+
{ className: 'error-message' },
|
|
192
|
+
error
|
|
193
|
+
),
|
|
194
|
+
!error && description && _react2.default.createElement(
|
|
195
|
+
'div',
|
|
196
|
+
{ className: 'input_description' },
|
|
197
|
+
description
|
|
198
|
+
)
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}]);
|
|
202
|
+
|
|
203
|
+
return Input;
|
|
204
|
+
}(_react.PureComponent);
|
|
205
|
+
|
|
206
|
+
Input.propTypes = {
|
|
207
|
+
/** Type of value */
|
|
208
|
+
type: _propTypes2.default.string,
|
|
209
|
+
/** Represents the label for each input field */
|
|
210
|
+
title: _propTypes2.default.string,
|
|
211
|
+
/** The validation error message */
|
|
212
|
+
error: _propTypes2.default.string,
|
|
213
|
+
/** Name associated with each input field */
|
|
214
|
+
name: _propTypes2.default.string,
|
|
215
|
+
/** Minimal amount of characters required */
|
|
216
|
+
min: _propTypes2.default.string,
|
|
217
|
+
/** Boolean props deciding whether to disable or enable input field */
|
|
218
|
+
disabled: _propTypes2.default.bool,
|
|
219
|
+
/** Boolean props deciding whether a field is required to have a value or not */
|
|
220
|
+
require: _propTypes2.default.bool,
|
|
221
|
+
/** Optional description text */
|
|
222
|
+
description: _propTypes2.default.string,
|
|
223
|
+
/** Placeholder text used on the input */
|
|
224
|
+
placeholder: _propTypes2.default.string,
|
|
225
|
+
/** Classnames that should be used on the input */
|
|
226
|
+
className: _propTypes2.default.string,
|
|
227
|
+
/** Boolean to show toggle password icon or not */
|
|
228
|
+
showToggleIcon: _propTypes2.default.bool
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
Input.defaultProps = {
|
|
232
|
+
type: 'text',
|
|
233
|
+
title: '',
|
|
234
|
+
error: '',
|
|
235
|
+
name: '',
|
|
236
|
+
min: '',
|
|
237
|
+
disabled: false,
|
|
238
|
+
require: false,
|
|
239
|
+
description: '',
|
|
240
|
+
placeholder: '',
|
|
241
|
+
className: '',
|
|
242
|
+
showToggleIcon: false
|
|
48
243
|
};
|
|
49
244
|
|
|
50
|
-
exports.default =
|
|
245
|
+
exports.default = _react2.default.forwardRef(function (props, ref) {
|
|
246
|
+
return _react2.default.createElement(Input, _extends({}, props, { innerRef: ref }));
|
|
247
|
+
});
|