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
|
@@ -35,31 +35,17 @@ var SportsbookSettings = function SportsbookSettings(_ref) {
|
|
|
35
35
|
|
|
36
36
|
return _react2.default.createElement(
|
|
37
37
|
'form',
|
|
38
|
-
{
|
|
39
|
-
onSubmit: onSubmit,
|
|
40
|
-
className: (0, _classnames2.default)('SportsbookSettings', 'form', className) },
|
|
38
|
+
{ onSubmit: onSubmit, className: (0, _classnames2.default)('SportsbookSettings', className) },
|
|
41
39
|
Array.isArray(selects) && selects.map(function (s, i) {
|
|
42
|
-
return _react2.default.createElement(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_Select2.default.Option,
|
|
52
|
-
{ value: '', selected: true },
|
|
53
|
-
s.placeholder
|
|
54
|
-
),
|
|
55
|
-
s.options.map(function (o) {
|
|
56
|
-
return _react2.default.createElement(
|
|
57
|
-
_Select2.default.Option,
|
|
58
|
-
{ value: o.value },
|
|
59
|
-
o.label
|
|
60
|
-
);
|
|
61
|
-
})
|
|
62
|
-
);
|
|
40
|
+
return _react2.default.createElement(_Select2.default, {
|
|
41
|
+
key: i,
|
|
42
|
+
name: s.name,
|
|
43
|
+
title: s.title,
|
|
44
|
+
options: s.options,
|
|
45
|
+
value: s.value,
|
|
46
|
+
placeholder: s.placeholder,
|
|
47
|
+
onChange: s.onChange || onChange
|
|
48
|
+
});
|
|
63
49
|
}),
|
|
64
50
|
_react2.default.createElement(
|
|
65
51
|
_Button2.default,
|
|
@@ -22,14 +22,6 @@ var _translate = require('../../lib/utils/translate');
|
|
|
22
22
|
|
|
23
23
|
var _translate2 = _interopRequireDefault(_translate);
|
|
24
24
|
|
|
25
|
-
var _Button = require('../../components/Button');
|
|
26
|
-
|
|
27
|
-
var _Button2 = _interopRequireDefault(_Button);
|
|
28
|
-
|
|
29
|
-
var _Input = require('../../components/Input');
|
|
30
|
-
|
|
31
|
-
var _Input2 = _interopRequireDefault(_Input);
|
|
32
|
-
|
|
33
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
26
|
|
|
35
27
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -167,10 +159,10 @@ var Subscriptions = function (_React$Component) {
|
|
|
167
159
|
return _react2.default.createElement(
|
|
168
160
|
'div',
|
|
169
161
|
{ key: index, className: 'subscribe-item' },
|
|
170
|
-
_react2.default.createElement(
|
|
162
|
+
_react2.default.createElement('input', {
|
|
171
163
|
id: 'newsletter-checkbox-' + index,
|
|
172
164
|
type: 'checkbox',
|
|
173
|
-
|
|
165
|
+
checked: option.OptIn,
|
|
174
166
|
onChange: function onChange(e) {
|
|
175
167
|
return _this3.onClickCheckbox({ e: e, option: option });
|
|
176
168
|
}
|
|
@@ -185,7 +177,7 @@ var Subscriptions = function (_React$Component) {
|
|
|
185
177
|
);
|
|
186
178
|
}),
|
|
187
179
|
_react2.default.createElement(
|
|
188
|
-
|
|
180
|
+
'button',
|
|
189
181
|
{
|
|
190
182
|
className: 'button primary',
|
|
191
183
|
disabled: isLoading,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tg-core-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0-master.1",
|
|
4
4
|
"description": "tg-core-components",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"build:clean": "rm -rf ./es && rm -rf ./lib",
|
|
17
17
|
"prepublish": "npm run build",
|
|
18
18
|
"lint": "eslint src",
|
|
19
|
+
"storybook": "start-storybook -p 6006",
|
|
20
|
+
"build-storybook": "build-storybook",
|
|
19
21
|
"guide": "yarn styleguidist server",
|
|
20
22
|
"guide:build": "yarn styleguidist build"
|
|
21
23
|
},
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
"peerDependencies": {
|
|
39
41
|
"classnames": "^2.2.6",
|
|
40
42
|
"final-form": "^4.20.1",
|
|
41
|
-
"marked": "^
|
|
43
|
+
"marked": "^1.1.1",
|
|
42
44
|
"prop-types": "^15.7.2",
|
|
43
45
|
"react": "^16.13.1",
|
|
44
46
|
"react-dom": "^16.13.1",
|
|
@@ -48,6 +50,7 @@
|
|
|
48
50
|
"react-transition-group": "^4.4.1"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
53
|
+
"@storybook/react": "^3.2.17",
|
|
51
54
|
"babel-cli": "^6.26.0",
|
|
52
55
|
"babel-core": "^6.26.3",
|
|
53
56
|
"babel-plugin-react-intl": "^2.3.1",
|
|
@@ -67,14 +70,16 @@
|
|
|
67
70
|
"ejs": "^2.5.1",
|
|
68
71
|
"enzyme": "^3.2.0",
|
|
69
72
|
"eslint": "^4.11.0",
|
|
73
|
+
"react-addons-test-utils": "^15.6.2",
|
|
70
74
|
"react-helmet": "^5.2.0",
|
|
71
75
|
"react-prism": "^4.3.1",
|
|
72
76
|
"react-scripts": "^1.0.17",
|
|
73
77
|
"react-styleguidist": "^6.2.6",
|
|
74
78
|
"react-test-renderer": "^16.2.0",
|
|
75
79
|
"react-transition-group": "^2.2.1",
|
|
80
|
+
"storybook-addon-intl": "^2.2.0",
|
|
76
81
|
"webpack": "^3.0.0",
|
|
77
82
|
"webpack-blocks": "^1.0.0"
|
|
78
83
|
},
|
|
79
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "e51624c16e8d2d380987c4606d11b6c81e6cff4d"
|
|
80
85
|
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
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; };
|
|
2
|
-
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { Select, Input, useId, useValue, useFocus, createClassName, flatObj } from '../common';
|
|
7
|
-
import Translate from '../Translate';
|
|
8
|
-
import translate from '../../lib/utils/translate';
|
|
9
|
-
import cn from 'classnames';
|
|
10
|
-
import { useIntl } from 'react-intl';
|
|
11
|
-
|
|
12
|
-
var pad = function pad(num) {
|
|
13
|
-
return ('' + num).length === 1 ? '0' + num : num;
|
|
14
|
-
};
|
|
15
|
-
var yearRange = new Array(100).fill(null, 0, 100).map(function (y, i) {
|
|
16
|
-
return new Date().getFullYear() - 18 - i;
|
|
17
|
-
});
|
|
18
|
-
var monthRange = new Array(12).fill(null, 0, 12).map(function (m, i) {
|
|
19
|
-
return i + 1;
|
|
20
|
-
});
|
|
21
|
-
var dayRange = new Array(31).fill(null, 0, 31).map(function (d, i) {
|
|
22
|
-
return i + 1;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
var BirthdateInput = function BirthdateInput(props) {
|
|
26
|
-
var intl = useIntl();
|
|
27
|
-
|
|
28
|
-
var yearInput = {
|
|
29
|
-
id: useId(),
|
|
30
|
-
value: useValue(props.value.split('/')[0]),
|
|
31
|
-
focus: useFocus()
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
var monthInput = {
|
|
35
|
-
id: useId(),
|
|
36
|
-
value: useValue(props.value.split('/')[1]),
|
|
37
|
-
focus: useFocus()
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
var dayInput = {
|
|
41
|
-
id: useId(),
|
|
42
|
-
value: useValue(props.value.split('/')[2]),
|
|
43
|
-
focus: useFocus()
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
var createValue = function createValue() {
|
|
47
|
-
var _Object$values;
|
|
48
|
-
|
|
49
|
-
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
50
|
-
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
51
|
-
return Object.values((_Object$values = {}, _defineProperty(_Object$values, yearInput.id, yearInput.value.value), _defineProperty(_Object$values, monthInput.id, monthInput.value.value), _defineProperty(_Object$values, dayInput.id, dayInput.value.value), _defineProperty(_Object$values, id, value), _Object$values)).join('/');
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
var _onChange = function _onChange(e) {
|
|
55
|
-
return props.onChange && props.onChange(e, createValue(e.target.id, e.target.value));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var _onBlur = function _onBlur(e) {
|
|
59
|
-
return props.onBlur && props.onBlur(e, createValue(e.target.id, e.target.value));
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var inputs = [yearInput, monthInput, dayInput];
|
|
63
|
-
var className = createClassName('tg-birthdate-input', {
|
|
64
|
-
hasValue: inputs.some(function (i) {
|
|
65
|
-
return i.value.hasValue;
|
|
66
|
-
}),
|
|
67
|
-
hasFocus: inputs.some(function (i) {
|
|
68
|
-
return i.focus.hasFocus;
|
|
69
|
-
}),
|
|
70
|
-
status: props.status
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return React.createElement(
|
|
74
|
-
'div',
|
|
75
|
-
{ className: cn(props.className, className) },
|
|
76
|
-
React.createElement(
|
|
77
|
-
'label',
|
|
78
|
-
{ className: 'tg-birthdate-input__label' },
|
|
79
|
-
props.label
|
|
80
|
-
),
|
|
81
|
-
React.createElement(
|
|
82
|
-
Select,
|
|
83
|
-
_extends({}, flatObj(yearInput), {
|
|
84
|
-
name: props.name + '_year',
|
|
85
|
-
label: React.createElement(Translate, { id: 'label.year-of-birth', defaultMessage: 'Year' }),
|
|
86
|
-
status: props.status,
|
|
87
|
-
onChange: function onChange(e) {
|
|
88
|
-
yearInput.value.onChange(e.target.value);
|
|
89
|
-
_onChange(e);
|
|
90
|
-
},
|
|
91
|
-
onBlur: function onBlur(e) {
|
|
92
|
-
yearInput.focus.onBlur();
|
|
93
|
-
_onBlur(e);
|
|
94
|
-
} }),
|
|
95
|
-
!yearInput.value.hasValue && React.createElement(
|
|
96
|
-
Select.Option,
|
|
97
|
-
{ value: '', selected: true, disabled: true },
|
|
98
|
-
translate({ id: 'label.year-of-birth', defaultMessage: 'Year' }, intl)
|
|
99
|
-
),
|
|
100
|
-
yearRange.map(function (y) {
|
|
101
|
-
return React.createElement(
|
|
102
|
-
Select.Option,
|
|
103
|
-
{ key: y, value: y },
|
|
104
|
-
y
|
|
105
|
-
);
|
|
106
|
-
})
|
|
107
|
-
),
|
|
108
|
-
React.createElement(
|
|
109
|
-
Select,
|
|
110
|
-
_extends({}, flatObj(monthInput), {
|
|
111
|
-
name: props.name + '_month',
|
|
112
|
-
label: React.createElement(Translate, { id: 'label.month-of-birth', defaultMessage: 'Month' }),
|
|
113
|
-
status: props.status,
|
|
114
|
-
onChange: function onChange(e) {
|
|
115
|
-
monthInput.value.onChange(e.target.value);
|
|
116
|
-
_onChange(e);
|
|
117
|
-
},
|
|
118
|
-
onBlur: function onBlur(e) {
|
|
119
|
-
monthInput.focus.onBlur();
|
|
120
|
-
_onBlur(e);
|
|
121
|
-
} }),
|
|
122
|
-
!monthInput.value.hasValue && React.createElement(
|
|
123
|
-
Select.Option,
|
|
124
|
-
{ value: '', selected: true, disabled: true },
|
|
125
|
-
translate({ id: 'label.month-of-birth', defaultMessage: 'Month' }, intl)
|
|
126
|
-
),
|
|
127
|
-
monthRange.map(function (m) {
|
|
128
|
-
return React.createElement(
|
|
129
|
-
Select.Option,
|
|
130
|
-
{ key: m, value: pad(m) },
|
|
131
|
-
m
|
|
132
|
-
);
|
|
133
|
-
})
|
|
134
|
-
),
|
|
135
|
-
React.createElement(
|
|
136
|
-
Select,
|
|
137
|
-
_extends({}, flatObj(dayInput), {
|
|
138
|
-
name: props.name + '_day',
|
|
139
|
-
label: React.createElement(Translate, { id: 'label.day-of-birth', defaultMessage: 'Day' }),
|
|
140
|
-
status: props.status,
|
|
141
|
-
onChange: function onChange(e) {
|
|
142
|
-
dayInput.value.onChange(e.target.value);
|
|
143
|
-
_onChange(e);
|
|
144
|
-
},
|
|
145
|
-
onBlur: function onBlur(e) {
|
|
146
|
-
dayInput.focus.onBlur();
|
|
147
|
-
_onBlur(e);
|
|
148
|
-
} }),
|
|
149
|
-
!dayInput.value.hasValue && React.createElement(
|
|
150
|
-
Select.Option,
|
|
151
|
-
{ value: '', selected: true, disabled: true },
|
|
152
|
-
translate({ id: 'label.day-of-birth', defaultMessage: 'Day' }, intl)
|
|
153
|
-
),
|
|
154
|
-
dayRange.map(function (d) {
|
|
155
|
-
return React.createElement(
|
|
156
|
-
Select.Option,
|
|
157
|
-
{ key: d, value: pad(d) },
|
|
158
|
-
d
|
|
159
|
-
);
|
|
160
|
-
})
|
|
161
|
-
),
|
|
162
|
-
React.createElement(Input, { type: 'hidden', name: props.name, value: createValue() }),
|
|
163
|
-
React.createElement(
|
|
164
|
-
'div',
|
|
165
|
-
{ className: 'tg-birthdate-input__status-text' },
|
|
166
|
-
props.statusText
|
|
167
|
-
)
|
|
168
|
-
);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export default BirthdateInput;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
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; };
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Checkbox, useId, useValue, useFocus, useTouched, useAutofill, createClassName, flatObj } from '../common';
|
|
5
|
-
import cn from 'classnames';
|
|
6
|
-
|
|
7
|
-
var TGCheckbox = function TGCheckbox(props) {
|
|
8
|
-
var checkbox = {
|
|
9
|
-
id: useId(),
|
|
10
|
-
value: useValue(props.value),
|
|
11
|
-
focus: useFocus(),
|
|
12
|
-
touched: useTouched(),
|
|
13
|
-
autofill: useAutofill()
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
var _onChange = function _onChange(e) {
|
|
17
|
-
return props.onChange && props.onChange(e, e.target.checked ? 'true' : '');
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var className = createClassName('tg-checkbox', {
|
|
21
|
-
hasValue: checkbox.value.hasValue,
|
|
22
|
-
hasLabel: Boolean(props.label),
|
|
23
|
-
hasFocus: checkbox.focus.hasFocus,
|
|
24
|
-
hasTouched: checkbox.touched.hasTouched,
|
|
25
|
-
hasAutofill: checkbox.autofill.hasAutofill,
|
|
26
|
-
disabled: props.disabled,
|
|
27
|
-
status: props.status
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return React.createElement(
|
|
31
|
-
'div',
|
|
32
|
-
{ className: cn(props.className, className) },
|
|
33
|
-
React.createElement(Checkbox, _extends({}, props, flatObj(checkbox), {
|
|
34
|
-
onChange: function onChange(e) {
|
|
35
|
-
checkbox.value.onChange(e.target.checked ? 'true' : '');
|
|
36
|
-
_onChange(e);
|
|
37
|
-
},
|
|
38
|
-
onFocus: function onFocus() {
|
|
39
|
-
checkbox.focus.onFocus();
|
|
40
|
-
checkbox.touched.onFocus();
|
|
41
|
-
}
|
|
42
|
-
})),
|
|
43
|
-
React.createElement(
|
|
44
|
-
'div',
|
|
45
|
-
{ className: 'tg-checkbox__status-text' },
|
|
46
|
-
props.statusText
|
|
47
|
-
)
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default TGCheckbox;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
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; };
|
|
2
|
-
|
|
3
|
-
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; }
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { Input, useId, useValue, useFocus, useTouched, useAutofill, createClassName, statusIcons, flatObj } from '../common';
|
|
7
|
-
import cn from 'classnames';
|
|
8
|
-
|
|
9
|
-
var TGInput = function TGInput(_ref) {
|
|
10
|
-
var icon = _ref.icon,
|
|
11
|
-
props = _objectWithoutProperties(_ref, ['icon']);
|
|
12
|
-
|
|
13
|
-
var input = {
|
|
14
|
-
id: useId(),
|
|
15
|
-
value: useValue(props.value),
|
|
16
|
-
focus: useFocus(),
|
|
17
|
-
touched: useTouched(),
|
|
18
|
-
autofill: useAutofill()
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
var _onChange = function _onChange(e) {
|
|
22
|
-
return props.onChange && props.onChange(e, e.target.value);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
var _onBlur = function _onBlur(e) {
|
|
26
|
-
return props.onBlur && props.onBlur(e, e.target.value);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
var className = createClassName('tg-input', {
|
|
30
|
-
hasValue: input.value.hasValue,
|
|
31
|
-
hasLabel: Boolean(props.label),
|
|
32
|
-
hasFocus: input.focus.hasFocus,
|
|
33
|
-
hasTouched: input.touched.hasTouched,
|
|
34
|
-
hasAutofill: input.autofill.hasAutofill,
|
|
35
|
-
disabled: props.disabled,
|
|
36
|
-
status: props.status
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
return React.createElement(
|
|
40
|
-
'div',
|
|
41
|
-
{ className: cn(props.className, className) },
|
|
42
|
-
React.createElement(Input, _extends({}, props, flatObj(input), {
|
|
43
|
-
onChange: function onChange(e) {
|
|
44
|
-
if (typeof props.transform === 'function') {
|
|
45
|
-
e.target.value = props.transform(e.target.value);
|
|
46
|
-
}
|
|
47
|
-
input.value.onChange(e.target.value);
|
|
48
|
-
_onChange(e);
|
|
49
|
-
},
|
|
50
|
-
onFocus: function onFocus() {
|
|
51
|
-
input.focus.onFocus();
|
|
52
|
-
input.touched.onFocus();
|
|
53
|
-
},
|
|
54
|
-
onBlur: function onBlur(e) {
|
|
55
|
-
input.focus.onBlur();
|
|
56
|
-
_onBlur(e);
|
|
57
|
-
},
|
|
58
|
-
leadingLane: [icon].filter(function (i) {
|
|
59
|
-
return i;
|
|
60
|
-
}),
|
|
61
|
-
trailingLane: [statusIcons[props.status]].filter(function (i) {
|
|
62
|
-
return i;
|
|
63
|
-
})
|
|
64
|
-
})),
|
|
65
|
-
React.createElement(
|
|
66
|
-
'div',
|
|
67
|
-
{ className: 'tg-input__status-text' },
|
|
68
|
-
props.statusText
|
|
69
|
-
)
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default TGInput;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
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; };
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import Icon from '../Icon';
|
|
5
|
-
import { Input, useId, useValue, useFocus, useTouched, useType, createClassName, statusIcons, useAutofill, flatObj } from '../common';
|
|
6
|
-
import cn from 'classnames';
|
|
7
|
-
|
|
8
|
-
var PasswordInput = function PasswordInput(props) {
|
|
9
|
-
var input = {
|
|
10
|
-
id: useId(),
|
|
11
|
-
value: useValue(props.value),
|
|
12
|
-
focus: useFocus(),
|
|
13
|
-
touched: useTouched(),
|
|
14
|
-
type: useType(props.type),
|
|
15
|
-
autofill: useAutofill()
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
var _onChange = function _onChange(e) {
|
|
19
|
-
return props.onChange && props.onChange(e, e.target.value);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
var _onBlur = function _onBlur(e) {
|
|
23
|
-
return props.onBlur && props.onBlur(e, e.target.value);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
var togglePasswordVisibility = function togglePasswordVisibility() {
|
|
27
|
-
return input.type.setType(input.type.type === 'password' ? 'text' : 'password');
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
var icons = {
|
|
31
|
-
password: React.createElement(Icon, {
|
|
32
|
-
icon: 'eye-slash',
|
|
33
|
-
className: 'tg-password-input__toggle',
|
|
34
|
-
onClick: togglePasswordVisibility
|
|
35
|
-
}),
|
|
36
|
-
text: React.createElement(Icon, {
|
|
37
|
-
icon: 'eye',
|
|
38
|
-
className: 'tg-password-input__toggle',
|
|
39
|
-
onClick: togglePasswordVisibility
|
|
40
|
-
})
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
var className = createClassName('tg-password-input', {
|
|
44
|
-
hasValue: input.value.hasValue,
|
|
45
|
-
hasLabel: Boolean(props.label),
|
|
46
|
-
hasFocus: input.focus.hasFocus,
|
|
47
|
-
hasTouched: input.touched.hasTouched,
|
|
48
|
-
hasAutofill: input.autofill.hasAutofill,
|
|
49
|
-
disabled: props.disabled,
|
|
50
|
-
status: props.status
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return React.createElement(
|
|
54
|
-
'div',
|
|
55
|
-
{ className: cn(props.className, className) },
|
|
56
|
-
React.createElement(Input, _extends({}, props, flatObj(input), {
|
|
57
|
-
onChange: function onChange(e) {
|
|
58
|
-
input.value.onChange(e.target.value);
|
|
59
|
-
_onChange(e);
|
|
60
|
-
},
|
|
61
|
-
onFocus: function onFocus() {
|
|
62
|
-
input.focus.onFocus();
|
|
63
|
-
input.touched.onFocus();
|
|
64
|
-
},
|
|
65
|
-
onBlur: function onBlur(e) {
|
|
66
|
-
input.focus.onBlur();
|
|
67
|
-
_onBlur(e);
|
|
68
|
-
},
|
|
69
|
-
leadingLane: [props.icon].filter(function (i) {
|
|
70
|
-
return i;
|
|
71
|
-
}),
|
|
72
|
-
trailingLane: [icons[input.type.type], statusIcons[props.status]].filter(function (i) {
|
|
73
|
-
return i;
|
|
74
|
-
})
|
|
75
|
-
})),
|
|
76
|
-
React.createElement(
|
|
77
|
-
'div',
|
|
78
|
-
{ className: 'tg-password-input__status-text' },
|
|
79
|
-
props.statusText
|
|
80
|
-
)
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default PasswordInput;
|