tg-core-components 5.5.1-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/List/ListItem.js +1 -7
- 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/CashierAccordion/Deposit/BonusCodeInput/index.js +9 -6
- package/es/widgets/CashierAccordion/Deposit/DepositWidget/index.js +47 -85
- 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/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/List/ListItem.js +1 -10
- 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/CashierAccordion/Deposit/BonusCodeInput/index.js +13 -7
- package/lib/widgets/CashierAccordion/Deposit/DepositWidget/index.js +50 -88
- 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/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,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;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _react = require('react');
|
|
4
|
+
|
|
5
|
+
var _react2 = _interopRequireDefault(_react);
|
|
6
|
+
|
|
7
|
+
var _reactDom = require('react-dom');
|
|
8
|
+
|
|
9
|
+
var _testUtils = require('react-dom/test-utils');
|
|
10
|
+
|
|
11
|
+
var _index = require('./index');
|
|
12
|
+
|
|
13
|
+
var _index2 = _interopRequireDefault(_index);
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
18
|
+
|
|
19
|
+
var container = null;
|
|
20
|
+
beforeEach(function () {
|
|
21
|
+
// setup a DOM element as a render target
|
|
22
|
+
container = document.createElement('div');
|
|
23
|
+
document.body.appendChild(container);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(function () {
|
|
27
|
+
// cleanup on exiting
|
|
28
|
+
(0, _reactDom.unmountComponentAtNode)(container);
|
|
29
|
+
container.remove();
|
|
30
|
+
container = null;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('renders with correct options', function () {
|
|
34
|
+
it('with only options', function () {
|
|
35
|
+
(0, _testUtils.act)(function () {
|
|
36
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, { options: ['Male', 'Female'] }), container);
|
|
37
|
+
});
|
|
38
|
+
expect([].concat(_toConsumableArray(container.querySelectorAll('option'))).map(function (o) {
|
|
39
|
+
return o.textContent;
|
|
40
|
+
}).join(',')).toBe('Male,Female');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('with preset value and placeholder', function () {
|
|
44
|
+
(0, _testUtils.act)(function () {
|
|
45
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, {
|
|
46
|
+
options: ['Male', 'Female'],
|
|
47
|
+
value: 'Female',
|
|
48
|
+
placeholder: 'Gender'
|
|
49
|
+
}), container);
|
|
50
|
+
});
|
|
51
|
+
expect([].concat(_toConsumableArray(container.querySelectorAll('option'))).map(function (o) {
|
|
52
|
+
return o.textContent;
|
|
53
|
+
}).join(',')).toBe('Gender,Male,Female');
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('renders with correct initial value', function () {
|
|
58
|
+
it('with only options', function () {
|
|
59
|
+
(0, _testUtils.act)(function () {
|
|
60
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, { options: ['Male', 'Female'] }), container);
|
|
61
|
+
});
|
|
62
|
+
expect(container.querySelector('select').value).toBe('Male');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('with preset value', function () {
|
|
66
|
+
(0, _testUtils.act)(function () {
|
|
67
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, { options: ['Male', 'Female'], value: 'Female' }), container);
|
|
68
|
+
});
|
|
69
|
+
expect(container.querySelector('select').value).toBe('Female');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('renders with correct placeholder value', function () {
|
|
74
|
+
it('with placeholder', function () {
|
|
75
|
+
(0, _testUtils.act)(function () {
|
|
76
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, { options: ['Male', 'Female'], placeholder: 'Gender' }), container);
|
|
77
|
+
});
|
|
78
|
+
expect(container.querySelector('select').value).toBe('Gender');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('with preset value title and placeholder', function () {
|
|
82
|
+
(0, _testUtils.act)(function () {
|
|
83
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, {
|
|
84
|
+
options: ['Male', 'Female'],
|
|
85
|
+
value: 'Female',
|
|
86
|
+
title: 'What is your gender',
|
|
87
|
+
placeholder: 'gender'
|
|
88
|
+
}), container);
|
|
89
|
+
});
|
|
90
|
+
expect(container.querySelector('select').value).toBe('Female');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('renders with correct placeholder value', function () {
|
|
95
|
+
it('with placeholder and require', function () {
|
|
96
|
+
(0, _testUtils.act)(function () {
|
|
97
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, { options: ['Male', 'Female'], placeholder: 'Gender', require: true }), container);
|
|
98
|
+
});
|
|
99
|
+
expect(container.querySelector('select').value).toBe('Gender');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('with preset value, title, placeholder and require', function () {
|
|
103
|
+
(0, _testUtils.act)(function () {
|
|
104
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, {
|
|
105
|
+
options: ['Male', 'Female'],
|
|
106
|
+
value: 'Male',
|
|
107
|
+
title: 'What is your gender',
|
|
108
|
+
placeholder: 'gender',
|
|
109
|
+
require: true
|
|
110
|
+
}), container);
|
|
111
|
+
});
|
|
112
|
+
expect(container.querySelector('select').value).toBe('Male');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('with placeholder and require', function () {
|
|
116
|
+
(0, _testUtils.act)(function () {
|
|
117
|
+
(0, _reactDom.render)(_react2.default.createElement(_index2.default, { options: ['Male', 'Female'], placeholder: 'Gender', require: true }), container);
|
|
118
|
+
});
|
|
119
|
+
expect(container.querySelector('select').value).toBe('Gender');
|
|
120
|
+
});
|
|
121
|
+
});
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.countryEmojiFlags = exports.Skeleton = exports.Picture = exports.Translate = exports.VerifyAccordionWidget = exports.List = exports.ResponsibleGamingWidget = exports.ResponsibleGamingSingleSignUp = exports.ResponsibleGamingAccordionSignUp = exports.ResponsibleGamingAccordion = exports.WithdrawWidgetAccordion = exports.DepositWidgetAccordion = exports.SportsbookHistoryTable = exports.PaymentHistoryTable = exports.CasinoHistoryTable = exports.Subscriptions = exports.Verify = exports.TableWidget = exports.Settings = exports.Pagination = exports.SignIn = exports.RequestResetPassword = exports.ResetPassword = exports.ChangePassword = exports.ChangeUsername = exports.SignUp = exports.Withdraw = exports.Deposit = exports.Bonus = exports.Balance = exports.ActivateWidget = exports.AccountDetail = exports.AccordionWidget = exports.Uploader = exports.Textarea = exports.Single = exports.Select = exports.Radio = exports.Notification = exports.Money = exports.Loader = exports.InternalMessagesInbox = exports.Input = exports.Image = exports.Icon = exports.Checklist = exports.Checkbox = exports.ButtonLoader = exports.Button = exports.Alert = exports.AcceptUpdatedTaC = undefined;
|
|
7
7
|
|
|
8
8
|
var _AcceptUpdatedTaC = require('./components/AcceptUpdatedTaC');
|
|
9
9
|
|
|
@@ -21,6 +21,10 @@ var _ButtonLoader = require('./components/ButtonLoader');
|
|
|
21
21
|
|
|
22
22
|
var _ButtonLoader2 = _interopRequireDefault(_ButtonLoader);
|
|
23
23
|
|
|
24
|
+
var _Checkbox = require('./components/Checkbox');
|
|
25
|
+
|
|
26
|
+
var _Checkbox2 = _interopRequireDefault(_Checkbox);
|
|
27
|
+
|
|
24
28
|
var _Checklist = require('./components/Checklist');
|
|
25
29
|
|
|
26
30
|
var _Checklist2 = _interopRequireDefault(_Checklist);
|
|
@@ -89,10 +93,6 @@ var _Skeleton = require('./components/Skeleton');
|
|
|
89
93
|
|
|
90
94
|
var _Skeleton2 = _interopRequireDefault(_Skeleton);
|
|
91
95
|
|
|
92
|
-
var _AutocompleteInput = require('./components/AutocompleteInput');
|
|
93
|
-
|
|
94
|
-
var _AutocompleteInput2 = _interopRequireDefault(_AutocompleteInput);
|
|
95
|
-
|
|
96
96
|
var _AccordionWidget = require('./widgets/AccordionWidget');
|
|
97
97
|
|
|
98
98
|
var _AccordionWidget2 = _interopRequireDefault(_AccordionWidget);
|
|
@@ -215,6 +215,7 @@ exports.AcceptUpdatedTaC = _AcceptUpdatedTaC2.default;
|
|
|
215
215
|
exports.Alert = _Alert2.default;
|
|
216
216
|
exports.Button = _Button2.default;
|
|
217
217
|
exports.ButtonLoader = _ButtonLoader2.default;
|
|
218
|
+
exports.Checkbox = _Checkbox2.default;
|
|
218
219
|
exports.Checklist = _Checklist2.default;
|
|
219
220
|
exports.Icon = _Icon2.default;
|
|
220
221
|
exports.Image = _Image2.default;
|
|
@@ -259,9 +260,8 @@ exports.List = _List2.default;
|
|
|
259
260
|
exports.VerifyAccordionWidget = _VerifyAccordionWidget2.default;
|
|
260
261
|
exports.Translate = _Translate2.default;
|
|
261
262
|
exports.Picture = _Picture2.default;
|
|
262
|
-
exports.countryEmojiFlags = _countryEmojiFlags2.default;
|
|
263
263
|
exports.Skeleton = _Skeleton2.default;
|
|
264
|
-
exports.
|
|
264
|
+
exports.countryEmojiFlags = _countryEmojiFlags2.default;
|
|
265
265
|
|
|
266
266
|
// misc
|
|
267
267
|
|
|
@@ -8,25 +8,18 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
|
|
8
8
|
|
|
9
9
|
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; }
|
|
10
10
|
|
|
11
|
-
var cache = {};
|
|
12
|
-
|
|
13
11
|
var translate = function translate(_ref, intl) {
|
|
14
12
|
var id = _ref.id,
|
|
15
13
|
values = _ref.values,
|
|
16
14
|
rest = _objectWithoutProperties(_ref, ['id', 'values']);
|
|
17
15
|
|
|
18
|
-
var cacheId = id + (JSON.stringify(values) || '');
|
|
19
|
-
if (cache[cacheId]) return cache[cacheId];
|
|
20
|
-
|
|
21
16
|
var g = typeof window !== 'undefined' && window || typeof global !== 'undefined' && global || {};
|
|
22
17
|
|
|
23
18
|
if (!intl) console.error('Missing intl object for "' + id + '"');
|
|
24
19
|
|
|
25
20
|
if (g.showTranslations || !intl || !intl.formatMessage) return id;
|
|
26
21
|
|
|
27
|
-
|
|
28
|
-
cache[cacheId] = message;
|
|
29
|
-
return message;
|
|
22
|
+
return intl.formatMessage(_extends({ id: id }, rest), values);
|
|
30
23
|
};
|
|
31
24
|
|
|
32
25
|
exports.default = translate;
|