tg-core-components 5.4.5-bethard → 5.5.1-master
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 -2
- package/es/lib/utils/translate.js +1 -8
- package/es/misc/countryEmojiFlags.js +0 -1
- 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/Payment/index.js +2 -0
- package/es/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +9 -6
- package/es/widgets/CashierAccordion/Deposit/DepositWidget/index.js +22 -33
- package/es/widgets/CashierAccordion/Deposit/PaymentForm/index.js +2 -6
- package/es/widgets/CashierAccordion/Payment/PaymentAccountForms/astroPayBankTransaltions.js +12 -0
- package/es/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +163 -347
- package/es/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -6
- package/es/widgets/CashierAccordion/Payment/PaymentMethodSelector/index.js +2 -2
- package/es/widgets/CashierAccordion/Payment/index.js +2 -0
- package/es/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +9 -23
- 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 +2 -6
- 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 +7 -7
- package/lib/lib/utils/translate.js +1 -8
- package/lib/misc/countryEmojiFlags.js +0 -1
- 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/Payment/index.js +2 -0
- package/lib/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +13 -7
- package/lib/widgets/CashierAccordion/Deposit/DepositWidget/index.js +25 -36
- package/lib/widgets/CashierAccordion/Deposit/PaymentForm/index.js +2 -9
- package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/astroPayBankTransaltions.js +12 -0
- package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +195 -378
- package/lib/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -6
- package/lib/widgets/CashierAccordion/Payment/PaymentMethodSelector/index.js +2 -2
- package/lib/widgets/CashierAccordion/Payment/index.js +2 -0
- package/lib/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +11 -25
- 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 +2 -6
- 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/AutocompleteInput/index.js +0 -104
- package/es/components/Input/BirthdateInput.js +0 -174
- 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 -113
- 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/es/widgets/CashierAccordion/Deposit/PaymentForm/NewTab.js +0 -28
- package/lib/components/AutocompleteInput/index.js +0 -118
- package/lib/components/Input/BirthdateInput.js +0 -195
- 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 -130
- 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
- package/lib/widgets/CashierAccordion/Deposit/PaymentForm/NewTab.js +0 -44
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _react = require('react');
|
|
8
|
+
|
|
9
|
+
var _react2 = _interopRequireDefault(_react);
|
|
10
|
+
|
|
11
|
+
var _propTypes = require('prop-types');
|
|
12
|
+
|
|
13
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
14
|
+
|
|
15
|
+
var _classnames = require('classnames');
|
|
16
|
+
|
|
17
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
21
|
+
var InputWrapper = function InputWrapper(_ref) {
|
|
22
|
+
var children = _ref.children,
|
|
23
|
+
className = _ref.className,
|
|
24
|
+
disabled = _ref.disabled,
|
|
25
|
+
require = _ref.require,
|
|
26
|
+
error = _ref.error,
|
|
27
|
+
title = _ref.title,
|
|
28
|
+
hasValue = _ref.hasValue,
|
|
29
|
+
isFocusing = _ref.isFocusing;
|
|
30
|
+
return _react2.default.createElement(
|
|
31
|
+
'div',
|
|
32
|
+
{
|
|
33
|
+
className: (0, _classnames2.default)('tg_input ' + className, {
|
|
34
|
+
tg_input_value: hasValue,
|
|
35
|
+
input_focus: isFocusing,
|
|
36
|
+
error: error,
|
|
37
|
+
has_title: title
|
|
38
|
+
}) },
|
|
39
|
+
_react2.default.createElement(
|
|
40
|
+
'div',
|
|
41
|
+
{ className: 'input-wrapper' },
|
|
42
|
+
title && _react2.default.createElement(
|
|
43
|
+
'div',
|
|
44
|
+
{ className: (0, _classnames2.default)('input_title', { 'opa-d5': disabled }) },
|
|
45
|
+
title + ' ' + (require ? '*' : '')
|
|
46
|
+
),
|
|
47
|
+
children,
|
|
48
|
+
_react2.default.createElement('div', { className: 'bottom-line' }),
|
|
49
|
+
_react2.default.createElement(
|
|
50
|
+
'div',
|
|
51
|
+
{ className: 'error-message' },
|
|
52
|
+
error
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
InputWrapper.propTypes = {
|
|
59
|
+
/** Determine if select has value */
|
|
60
|
+
hasValue: _propTypes2.default.bool,
|
|
61
|
+
/** Determine if select is focuesd */
|
|
62
|
+
isFocusing: _propTypes2.default.bool,
|
|
63
|
+
/** Determine if select is disable */
|
|
64
|
+
disabled: _propTypes2.default.bool,
|
|
65
|
+
/** Title to show above the select */
|
|
66
|
+
title: _propTypes2.default.string,
|
|
67
|
+
/** Error message to display */
|
|
68
|
+
error: _propTypes2.default.string,
|
|
69
|
+
/** Determine if the select is required */
|
|
70
|
+
require: _propTypes2.default.bool,
|
|
71
|
+
/** Optional className passed in as props */
|
|
72
|
+
className: _propTypes2.default.string
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
InputWrapper.defaultProps = {
|
|
76
|
+
hasValue: false,
|
|
77
|
+
isFocusing: false,
|
|
78
|
+
disabled: false,
|
|
79
|
+
title: '',
|
|
80
|
+
error: '',
|
|
81
|
+
require: false,
|
|
82
|
+
className: ''
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.default = InputWrapper;
|
|
@@ -85,9 +85,9 @@ var Notification = function (_Component) {
|
|
|
85
85
|
timeout = _props2$timeout === undefined ? 5 : _props2$timeout,
|
|
86
86
|
action = _props2.action,
|
|
87
87
|
defaultAction = _props2.defaultAction,
|
|
88
|
-
btnText = _props2.btnText,
|
|
89
88
|
icon = _props2.icon,
|
|
90
|
-
direction = _props2.direction
|
|
89
|
+
direction = _props2.direction,
|
|
90
|
+
btnText = _props2.btnText;
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
return _react2.default.createElement(
|
|
@@ -184,6 +184,6 @@ var Notification = function (_Component) {
|
|
|
184
184
|
return Notification;
|
|
185
185
|
}(_react.Component);
|
|
186
186
|
|
|
187
|
-
var enhance = (0, _recompose.compose)(_withSwipeListeners2.default
|
|
187
|
+
var enhance = (0, _recompose.compose)(_withSwipeListeners2.default);
|
|
188
188
|
|
|
189
189
|
exports.default = enhance(Notification);
|
|
@@ -4,13 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var
|
|
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
8
|
|
|
9
9
|
var _react = require('react');
|
|
10
10
|
|
|
11
11
|
var _react2 = _interopRequireDefault(_react);
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _Icon = require('../Icon');
|
|
14
|
+
|
|
15
|
+
var _Icon2 = _interopRequireDefault(_Icon);
|
|
16
|
+
|
|
17
|
+
var _InputWrapper = require('../InputWrapper');
|
|
18
|
+
|
|
19
|
+
var _InputWrapper2 = _interopRequireDefault(_InputWrapper);
|
|
20
|
+
|
|
21
|
+
var _propTypes = require('prop-types');
|
|
22
|
+
|
|
23
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
14
24
|
|
|
15
25
|
var _classnames = require('classnames');
|
|
16
26
|
|
|
@@ -18,66 +28,202 @@ var _classnames2 = _interopRequireDefault(_classnames);
|
|
|
18
28
|
|
|
19
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
31
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
32
|
+
|
|
33
|
+
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; }
|
|
34
|
+
|
|
35
|
+
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; }
|
|
36
|
+
|
|
37
|
+
var Select = function (_PureComponent) {
|
|
38
|
+
_inherits(Select, _PureComponent);
|
|
39
|
+
|
|
40
|
+
function Select(props) {
|
|
41
|
+
_classCallCheck(this, Select);
|
|
42
|
+
|
|
43
|
+
var _this = _possibleConstructorReturn(this, (Select.__proto__ || Object.getPrototypeOf(Select)).call(this, props));
|
|
44
|
+
|
|
45
|
+
_this._generateOptions = function () {
|
|
46
|
+
var _this$props = _this.props,
|
|
47
|
+
options = _this$props.options,
|
|
48
|
+
require = _this$props.require,
|
|
49
|
+
placeholder = _this$props.placeholder;
|
|
50
|
+
var isFocusing = _this.state.isFocusing;
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if (!options) return false;
|
|
54
|
+
|
|
55
|
+
var selectOptions = options.map(function (item, index) {
|
|
56
|
+
if (Array.isArray(item.value)) {
|
|
57
|
+
return _react2.default.createElement(
|
|
58
|
+
'optgroup',
|
|
59
|
+
{ label: item.label },
|
|
60
|
+
item.value.map(function (v, i) {
|
|
61
|
+
return _react2.default.createElement(
|
|
62
|
+
'option',
|
|
63
|
+
{ key: i, value: v.value },
|
|
64
|
+
v.label || v
|
|
65
|
+
);
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return _react2.default.createElement(
|
|
71
|
+
'option',
|
|
72
|
+
{ key: index, value: item.value },
|
|
73
|
+
item.label || item
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (placeholder) selectOptions.unshift(_react2.default.createElement(
|
|
78
|
+
'option',
|
|
79
|
+
{ key: 'placeholder', disabled: isFocusing && require },
|
|
80
|
+
placeholder
|
|
81
|
+
));
|
|
82
|
+
|
|
83
|
+
return selectOptions;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
_this._handleChange = function (e) {
|
|
87
|
+
var _this$props2 = _this.props,
|
|
88
|
+
onChange = _this$props2.onChange,
|
|
89
|
+
name = _this$props2.name;
|
|
90
|
+
|
|
91
|
+
var value = e.currentTarget.value;
|
|
92
|
+
|
|
93
|
+
_this.setState({
|
|
94
|
+
value: value,
|
|
95
|
+
hasValue: !!value
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
onChange && onChange(e, name, value);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
_this._handleFocus = function () {
|
|
102
|
+
_this.setState({
|
|
103
|
+
isFocusing: true
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
_this._handleBlur = function () {
|
|
108
|
+
var onBlur = _this.props.onBlur;
|
|
109
|
+
var value = _this.state.value;
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
_this.setState({
|
|
113
|
+
isFocusing: false
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
onBlur && onBlur(value);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
_this.state = {
|
|
120
|
+
isFocusing: false,
|
|
121
|
+
value: '',
|
|
122
|
+
hasValue: false
|
|
123
|
+
};
|
|
124
|
+
return _this;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
_createClass(Select, [{
|
|
128
|
+
key: 'componentDidMount',
|
|
129
|
+
value: function componentDidMount() {
|
|
130
|
+
var _props = this.props,
|
|
131
|
+
placeholder = _props.placeholder,
|
|
132
|
+
options = _props.options;
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
var value = this.props.value;
|
|
136
|
+
|
|
137
|
+
if (!value && !placeholder && options) {
|
|
138
|
+
value = options[0].value || options[0];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this.setState({ value: value, hasValue: !!value });
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: 'componentDidUpdate',
|
|
145
|
+
value: function componentDidUpdate(prevProps) {
|
|
146
|
+
if (this.props.value !== prevProps.value) {
|
|
147
|
+
this.setState({ value: this.props.value, hasValue: !!this.props.value });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
key: 'render',
|
|
152
|
+
value: function render() {
|
|
153
|
+
var _props2 = this.props,
|
|
154
|
+
className = _props2.className,
|
|
155
|
+
title = _props2.title,
|
|
156
|
+
name = _props2.name,
|
|
157
|
+
error = _props2.error,
|
|
158
|
+
disabled = _props2.disabled,
|
|
159
|
+
require = _props2.require;
|
|
160
|
+
var _state = this.state,
|
|
161
|
+
hasValue = _state.hasValue,
|
|
162
|
+
value = _state.value,
|
|
163
|
+
isFocusing = _state.isFocusing;
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
return _react2.default.createElement(
|
|
167
|
+
_InputWrapper2.default,
|
|
168
|
+
{
|
|
169
|
+
title: title,
|
|
170
|
+
className: className,
|
|
171
|
+
hasValue: hasValue,
|
|
172
|
+
isFocusing: isFocusing,
|
|
173
|
+
error: error,
|
|
174
|
+
disabled: disabled,
|
|
175
|
+
require: require },
|
|
176
|
+
_react2.default.createElement(
|
|
177
|
+
'select',
|
|
178
|
+
{
|
|
179
|
+
disabled: disabled,
|
|
180
|
+
name: name,
|
|
181
|
+
value: value,
|
|
182
|
+
onChange: this._handleChange,
|
|
183
|
+
onFocus: this._handleFocus,
|
|
184
|
+
onBlur: this._handleBlur },
|
|
185
|
+
this._generateOptions()
|
|
186
|
+
),
|
|
187
|
+
_react2.default.createElement(
|
|
188
|
+
'div',
|
|
189
|
+
{ className: (0, _classnames2.default)('select-icon', { 'opa-d5': disabled }) },
|
|
190
|
+
_react2.default.createElement(_Icon2.default, { icon: 'angle-down' })
|
|
191
|
+
)
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}]);
|
|
195
|
+
|
|
196
|
+
return Select;
|
|
197
|
+
}(_react.PureComponent);
|
|
198
|
+
|
|
199
|
+
Select.propTypes = {
|
|
200
|
+
/** Determine if select is disable */
|
|
201
|
+
disabled: _propTypes2.default.bool,
|
|
202
|
+
/** Title to show above the select */
|
|
203
|
+
title: _propTypes2.default.string,
|
|
204
|
+
/** Error message to display */
|
|
205
|
+
error: _propTypes2.default.string,
|
|
206
|
+
/** Name of the element */
|
|
207
|
+
name: _propTypes2.default.string,
|
|
208
|
+
/** Determine if the select is required */
|
|
209
|
+
require: _propTypes2.default.bool,
|
|
210
|
+
/** Optional className passed in as props */
|
|
211
|
+
className: _propTypes2.default.string,
|
|
212
|
+
/** Placeholder */
|
|
213
|
+
placeholder: _propTypes2.default.string,
|
|
214
|
+
/** Manually pick the default selected option */
|
|
215
|
+
value: _propTypes2.default.string
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
Select.defaultProps = {
|
|
219
|
+
disabled: false,
|
|
220
|
+
title: '',
|
|
221
|
+
error: '',
|
|
222
|
+
name: '',
|
|
223
|
+
require: false,
|
|
224
|
+
className: '',
|
|
225
|
+
value: '',
|
|
226
|
+
placeholder: ''
|
|
79
227
|
};
|
|
80
|
-
TGSelect.Option = _common.Select.Option;
|
|
81
|
-
TGSelect.OptGroup = _common.Select.OptGroup;
|
|
82
228
|
|
|
83
|
-
exports.default =
|
|
229
|
+
exports.default = Select;
|