bright-components 10.2.7 → 10.2.9
Sign up to get free protection for your applications and to get access to all the features.
- package/circle.yml +1 -2
- package/deploy.sh +6 -0
- package/dist/components/DayPicker/NewDayPicker/index.js +0 -28
- package/dist/components/DayPicker/index.js +2 -20
- package/dist/components/DayPickerPanel/HeaderDayPickerPanel/index.js +1 -18
- package/dist/components/DayPickerPanel/HeaderMonthPanel/index.js +0 -14
- package/dist/components/DayPickerPanel/HeaderYearPanel/index.js +2 -15
- package/dist/components/DayPickerPanel/Shortcuts/index.js +2 -16
- package/dist/components/DayPickerPanel/index.js +2 -74
- package/dist/components/EmployeeCard/index.js +1 -14
- package/dist/components/EmployeePicker/FilterBar/index.js +1 -28
- package/dist/components/EmployeePicker/Group/index.js +1 -41
- package/dist/components/FilterRadioGroup/index.js +2 -14
- package/dist/components/Form/index.js +4 -47
- package/dist/components/Modal/index.js +1 -23
- package/dist/components/RadioBlock/index.js +10 -41
- package/dist/components/Snackbar/index.js +1 -17
- package/dist/components/Time/OverlayBase/index.js +2 -25
- package/dist/components/Time/TimePicker/TimeOverlay/index.js +3 -26
- package/dist/components/TimePicker/Time/TimeOverlay/index.js +1 -58
- package/dist/setupTests.js +0 -7
- package/package.json +6 -8
- package/src/components/DayPicker/NewDayPicker/index.js +0 -21
- package/src/components/DayPicker/index.js +1 -16
- package/src/components/DayPicker/test.js +0 -85
- package/src/components/DayPickerPanel/HeaderDayPickerPanel/index.js +2 -22
- package/src/components/DayPickerPanel/HeaderDayPickerPanel/test.js +0 -34
- package/src/components/DayPickerPanel/HeaderMonthPanel/index.js +0 -10
- package/src/components/DayPickerPanel/HeaderMonthPanel/test.js +0 -25
- package/src/components/DayPickerPanel/HeaderYearPanel/index.js +3 -12
- package/src/components/DayPickerPanel/HeaderYearPanel/test.js +0 -17
- package/src/components/DayPickerPanel/Shortcuts/index.js +3 -17
- package/src/components/DayPickerPanel/Shortcuts/test.js +0 -39
- package/src/components/DayPickerPanel/index.js +1 -69
- package/src/components/DayPickerPanel/test.js +0 -177
- package/src/components/EmployeeCard/index.js +1 -15
- package/src/components/EmployeeCard/test.js +0 -20
- package/src/components/EmployeePicker/FilterBar/index.js +2 -26
- package/src/components/EmployeePicker/FilterBar/test.js +0 -29
- package/src/components/EmployeePicker/Group/index.js +1 -42
- package/src/components/EmployeePicker/Group/test.js +0 -21
- package/src/components/FilterRadioGroup/index.js +2 -14
- package/src/components/FilterRadioGroup/test.js +0 -13
- package/src/components/Form/index.js +1 -49
- package/src/components/Form/test.js +0 -73
- package/src/components/Modal/index.js +1 -22
- package/src/components/Modal/test.js +9 -9
- package/src/components/RadioBlock/index.js +14 -33
- package/src/components/RadioBlock/test.js +35 -155
- package/src/components/ResponsiveTabs/test.js +49 -86
- package/src/components/Snackbar/index.js +1 -16
- package/src/components/Time/OverlayBase/index.js +3 -21
- package/src/components/Time/OverlayBase/test.js +0 -50
- package/src/components/Time/TimePicker/TimeOverlay/index.js +4 -30
- package/src/components/Time/TimePicker/TimeOverlay/test.js +0 -24
- package/src/components/TimePicker/DayPart/test.js +1 -1
- package/src/components/TimePicker/Time/TimeOverlay/index.js +2 -50
- package/src/components/TimePicker/Time/TimeOverlay/test.js +1 -220
- package/src/index.js +1 -1
- package/src/setupTests.js +0 -2
- package/dist/components/TimePicker/utils/PickerGA/index.js +0 -24
- package/dist/utils/trackForm/index.js +0 -48
- package/src/components/TimePicker/utils/PickerGA/index.js +0 -6
- package/src/components/TimePicker/utils/PickerGA/test.js +0 -29
- package/src/utils/trackForm/index.js +0 -36
- package/src/utils/trackForm/test.js +0 -110
@@ -7,8 +7,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
9
9
|
|
10
|
-
var _reactGa = require("react-ga");
|
11
|
-
|
12
10
|
var _propTypes = require("prop-types");
|
13
11
|
|
14
12
|
var _H = _interopRequireDefault(require("../../Typography/H3"));
|
@@ -95,8 +93,7 @@ class Group extends _react.default.Component {
|
|
95
93
|
users,
|
96
94
|
onClick,
|
97
95
|
hideButtons,
|
98
|
-
toggleUsers
|
99
|
-
GA
|
96
|
+
toggleUsers
|
100
97
|
} = this.props;
|
101
98
|
const {
|
102
99
|
show
|
@@ -105,32 +102,6 @@ class Group extends _react.default.Component {
|
|
105
102
|
const deselectedUsers = (0, _utils.getNotSelected)(users);
|
106
103
|
return _react.default.createElement(Wrapper, null, _react.default.createElement(Bar, null, _react.default.createElement(CH3, {
|
107
104
|
onClick: () => {
|
108
|
-
if (show) {
|
109
|
-
(0, _reactGa.event)({
|
110
|
-
action: 'Contract Selected Group',
|
111
|
-
category: GA.category
|
112
|
-
});
|
113
|
-
|
114
|
-
if (title === 'No group') {
|
115
|
-
(0, _reactGa.event)({
|
116
|
-
action: 'Contract No Group',
|
117
|
-
category: GA.category
|
118
|
-
});
|
119
|
-
}
|
120
|
-
} else {
|
121
|
-
(0, _reactGa.event)({
|
122
|
-
action: 'Expand Selected Group',
|
123
|
-
category: GA.category
|
124
|
-
});
|
125
|
-
|
126
|
-
if (title === 'No group') {
|
127
|
-
(0, _reactGa.event)({
|
128
|
-
action: 'Expand No Group',
|
129
|
-
category: GA.category
|
130
|
-
});
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
105
|
this.toggleShow();
|
135
106
|
}
|
136
107
|
}, title, " (", selectedUsers.length, ")", ' ', _react.default.createElement(MLChevron, {
|
@@ -140,19 +111,11 @@ class Group extends _react.default.Component {
|
|
140
111
|
})), !hideButtons && _react.default.createElement(LinkButtonGroup, null, _react.default.createElement(_LinkButton.default, {
|
141
112
|
disabled: selectedUsers.length === users.length,
|
142
113
|
onClick: () => {
|
143
|
-
(0, _reactGa.event)({
|
144
|
-
action: 'Select Group',
|
145
|
-
category: GA.category
|
146
|
-
});
|
147
114
|
toggleUsers(deselectedUsers.filter(_utils.filterDisabled).map(_utils.idMap));
|
148
115
|
}
|
149
116
|
}, "Select group"), _react.default.createElement(_LinkButton.default, {
|
150
117
|
disabled: selectedUsers.length === 0,
|
151
118
|
onClick: () => {
|
152
|
-
(0, _reactGa.event)({
|
153
|
-
action: 'Deselect Group',
|
154
|
-
category: GA.category
|
155
|
-
});
|
156
119
|
toggleUsers(selectedUsers.filter(_utils.filterDisabled).map(_utils.idMap));
|
157
120
|
}
|
158
121
|
}, "Deselect group"))), _react.default.createElement(ItemContainer, {
|
@@ -178,9 +141,6 @@ class Group extends _react.default.Component {
|
|
178
141
|
|
179
142
|
Group.displayName = 'Group';
|
180
143
|
Group.propTypes = {
|
181
|
-
GA: (0, _propTypes.shape)({
|
182
|
-
category: _propTypes.string
|
183
|
-
}).isRequired,
|
184
144
|
users: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
185
145
|
id: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]).isRequired,
|
186
146
|
firstName: _propTypes.string.isRequired,
|
@@ -15,8 +15,6 @@ var _spacing = _interopRequireDefault(require("../../constants/spacing"));
|
|
15
15
|
|
16
16
|
var _vars = _interopRequireDefault(require("../../constants/vars"));
|
17
17
|
|
18
|
-
var _reactGa = require("react-ga");
|
19
|
-
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
19
|
|
22
20
|
function _extends() { _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; }; return _extends.apply(this, arguments); }
|
@@ -64,10 +62,9 @@ const FilterRadioGroup = _ref => {
|
|
64
62
|
options,
|
65
63
|
handleFilter,
|
66
64
|
selectedOption,
|
67
|
-
GA,
|
68
65
|
name
|
69
66
|
} = _ref,
|
70
|
-
props = _objectWithoutProperties(_ref, ["options", "handleFilter", "selectedOption", "
|
67
|
+
props = _objectWithoutProperties(_ref, ["options", "handleFilter", "selectedOption", "name"]);
|
71
68
|
|
72
69
|
return _react.default.createElement(_react.default.Fragment, null, options.map(option => _react.default.createElement(Option, _extends({
|
73
70
|
key: option,
|
@@ -76,11 +73,6 @@ const FilterRadioGroup = _ref => {
|
|
76
73
|
"data-testid": "filter-buttons",
|
77
74
|
onChange: () => {
|
78
75
|
handleFilter(option);
|
79
|
-
(0, _reactGa.event)({
|
80
|
-
action: GA.action,
|
81
|
-
category: GA.category,
|
82
|
-
label: option
|
83
|
-
});
|
84
76
|
},
|
85
77
|
type: "radio",
|
86
78
|
name: "filters"
|
@@ -91,11 +83,7 @@ FilterRadioGroup.propTypes = {
|
|
91
83
|
options: (0, _propTypes.arrayOf)(_propTypes.string).isRequired,
|
92
84
|
handleFilter: _propTypes.func.isRequired,
|
93
85
|
name: _propTypes.string.isRequired,
|
94
|
-
selectedOption: _propTypes.string
|
95
|
-
GA: (0, _propTypes.shape)({
|
96
|
-
category: _propTypes.string,
|
97
|
-
action: _propTypes.string
|
98
|
-
}).isRequired
|
86
|
+
selectedOption: _propTypes.string
|
99
87
|
};
|
100
88
|
FilterRadioGroup.defaultProps = {
|
101
89
|
selectedOption: undefined
|
@@ -19,8 +19,6 @@ var _reactAutobind = _interopRequireDefault(require("react-autobind"));
|
|
19
19
|
|
20
20
|
var _Validation = _interopRequireDefault(require("../Validation"));
|
21
21
|
|
22
|
-
var _trackForm = _interopRequireDefault(require("../../utils/trackForm"));
|
23
|
-
|
24
22
|
var _runFormValidation = _interopRequireDefault(require("./utils/runFormValidation"));
|
25
23
|
|
26
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -61,8 +59,6 @@ class Form extends _react.Component {
|
|
61
59
|
const {
|
62
60
|
fieldValidationResult
|
63
61
|
} = (0, _runFormValidation.default)(initialData, this.props.fieldValidation);
|
64
|
-
const analyticsTracking = (0, _trackForm.default)(props.name);
|
65
|
-
let currentValue;
|
66
62
|
this.state = {
|
67
63
|
error: false,
|
68
64
|
formData: initialData,
|
@@ -70,38 +66,6 @@ class Form extends _react.Component {
|
|
70
66
|
touched: {}
|
71
67
|
};
|
72
68
|
this.initialState = (0, _lodash3.default)(this.state);
|
73
|
-
|
74
|
-
this.gaChangeField = e => {
|
75
|
-
// special case for checkboxes because hidden so no blur event
|
76
|
-
if (e.target.type === 'checkbox') {
|
77
|
-
analyticsTracking(e);
|
78
|
-
}
|
79
|
-
};
|
80
|
-
|
81
|
-
this.gaButtonClick = e => {
|
82
|
-
if (e.target.type === 'button' || e.target.type === 'submit') {
|
83
|
-
analyticsTracking(e);
|
84
|
-
}
|
85
|
-
};
|
86
|
-
|
87
|
-
this.gaHover = e => {
|
88
|
-
const trackTooltip = e.target && e.target.getAttribute('data-track-tooltip');
|
89
|
-
|
90
|
-
if (trackTooltip) {
|
91
|
-
analyticsTracking(e);
|
92
|
-
}
|
93
|
-
};
|
94
|
-
|
95
|
-
this.gaFocusField = e => {
|
96
|
-
currentValue = e.target.value;
|
97
|
-
};
|
98
|
-
|
99
|
-
this.trackEvent = e => {
|
100
|
-
if (currentValue !== e.target.value) {
|
101
|
-
analyticsTracking(e);
|
102
|
-
}
|
103
|
-
};
|
104
|
-
|
105
69
|
this.componentMounted = false;
|
106
70
|
}
|
107
71
|
|
@@ -385,17 +349,10 @@ class Form extends _react.Component {
|
|
385
349
|
visible: Boolean(error)
|
386
350
|
}, error || '')
|
387
351
|
};
|
388
|
-
return (
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
onFocus: this.gaFocusField,
|
393
|
-
onChange: this.gaChangeField,
|
394
|
-
onBlur: this.trackEvent,
|
395
|
-
onClick: this.gaButtonClick,
|
396
|
-
onMouseOver: this.gaHover
|
397
|
-
}), children(formApi))
|
398
|
-
);
|
352
|
+
return _react.default.createElement("form", _extends({}, props, {
|
353
|
+
onSubmit: this.onSubmit,
|
354
|
+
onReset: this.onReset
|
355
|
+
}), children(formApi));
|
399
356
|
}
|
400
357
|
|
401
358
|
}
|
@@ -19,8 +19,6 @@ var _vars = _interopRequireDefault(require("../../constants/vars"));
|
|
19
19
|
|
20
20
|
var _colors = _interopRequireDefault(require("../../constants/colors"));
|
21
21
|
|
22
|
-
var _reactAutobind = _interopRequireDefault(require("react-autobind"));
|
23
|
-
|
24
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
23
|
|
26
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -79,14 +77,6 @@ ModalContainer.displayName = 'ModalContainer';
|
|
79
77
|
Background.displayName = 'Background';
|
80
78
|
|
81
79
|
class Modal extends _react.default.Component {
|
82
|
-
constructor(props) {
|
83
|
-
super(props);
|
84
|
-
this.state = {
|
85
|
-
createdElement: null
|
86
|
-
};
|
87
|
-
(0, _reactAutobind.default)(this);
|
88
|
-
}
|
89
|
-
|
90
80
|
componentDidMount() {
|
91
81
|
/* istanbul ignore next */
|
92
82
|
if (this.props.version === '1') {
|
@@ -95,18 +85,10 @@ class Modal extends _react.default.Component {
|
|
95
85
|
}
|
96
86
|
|
97
87
|
document.body.style.overflow = 'hidden';
|
98
|
-
const randomId = Math.random().toString();
|
99
|
-
const wrapperElement = document.createElement('div');
|
100
|
-
wrapperElement.setAttribute('id', `modal${randomId}`);
|
101
|
-
document.body.appendChild(wrapperElement);
|
102
|
-
this.setState({
|
103
|
-
createdElement: wrapperElement
|
104
|
-
});
|
105
88
|
}
|
106
89
|
|
107
90
|
componentWillUnmount() {
|
108
91
|
document.body.style.overflow = 'auto';
|
109
|
-
this.state.createdElement.parentNode.removeChild(this.state.createdElement);
|
110
92
|
}
|
111
93
|
|
112
94
|
render() {
|
@@ -129,10 +111,6 @@ class Modal extends _react.default.Component {
|
|
129
111
|
}
|
130
112
|
};
|
131
113
|
|
132
|
-
if (!this.state.createdElement) {
|
133
|
-
return null;
|
134
|
-
}
|
135
|
-
|
136
114
|
return (0, _reactDom.createPortal)(_react.default.createElement(Background, _extends({
|
137
115
|
onClick: dismiss,
|
138
116
|
version: version
|
@@ -154,7 +132,7 @@ class Modal extends _react.default.Component {
|
|
154
132
|
return _react.default.cloneElement(child, {
|
155
133
|
close
|
156
134
|
});
|
157
|
-
}))),
|
135
|
+
}))), document.body);
|
158
136
|
}
|
159
137
|
|
160
138
|
}
|
@@ -13,8 +13,6 @@ var _colors = _interopRequireDefault(require("../../constants/colors"));
|
|
13
13
|
|
14
14
|
var _vars = _interopRequireDefault(require("../../constants/vars"));
|
15
15
|
|
16
|
-
var _reactGa = require("react-ga");
|
17
|
-
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
17
|
|
20
18
|
function _extends() { _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; }; return _extends.apply(this, arguments); }
|
@@ -28,15 +26,15 @@ const Option = _styledComponents.default.div`
|
|
28
26
|
text-align: left;
|
29
27
|
border: 1px solid
|
30
28
|
${props => props.selected ? _colors.default.primaryLight : _colors.default.borderColor};
|
31
|
-
background: ${props => props.selected ? _colors.default.primaryLighter :
|
29
|
+
background: ${props => props.selected ? _colors.default.primaryLighter : "#fff"};
|
32
30
|
${props => props.selected && `box-shadow: 1px 4px 8px -4px #888888`};
|
33
31
|
border-radius: ${_vars.default.borderRadius};
|
34
32
|
height: 100%;
|
35
|
-
opacity: ${props => props.disabled ?
|
33
|
+
opacity: ${props => props.disabled ? "0.3" : 1};
|
36
34
|
`;
|
37
|
-
Option.displayName =
|
35
|
+
Option.displayName = "Option";
|
38
36
|
const Radio = _styledComponents.default.input`
|
39
|
-
cursor: ${props => props.disabled ?
|
37
|
+
cursor: ${props => props.disabled ? "not-allowed" : "pointer"};
|
40
38
|
opacity: 0 !important;
|
41
39
|
position: absolute;
|
42
40
|
top: 0;
|
@@ -46,25 +44,13 @@ const Radio = _styledComponents.default.input`
|
|
46
44
|
width: 100%;
|
47
45
|
height: 100%;
|
48
46
|
`;
|
49
|
-
Radio.displayName =
|
47
|
+
Radio.displayName = "Radio";
|
50
48
|
|
51
49
|
class RadioBlock extends _react.default.Component {
|
52
50
|
componentDidMount() {
|
53
51
|
const {
|
54
|
-
GA: {
|
55
|
-
category,
|
56
|
-
action
|
57
|
-
},
|
58
52
|
checked
|
59
53
|
} = this.props;
|
60
|
-
|
61
|
-
if (category && action && checked) {
|
62
|
-
const defaultAction = `Defaulted to ${action}`;
|
63
|
-
(0, _reactGa.event)({
|
64
|
-
category,
|
65
|
-
action: defaultAction
|
66
|
-
});
|
67
|
-
}
|
68
54
|
}
|
69
55
|
|
70
56
|
render() {
|
@@ -76,13 +62,9 @@ class RadioBlock extends _react.default.Component {
|
|
76
62
|
name,
|
77
63
|
value,
|
78
64
|
children,
|
79
|
-
className
|
80
|
-
GA: {
|
81
|
-
category,
|
82
|
-
action
|
83
|
-
}
|
65
|
+
className
|
84
66
|
} = _this$props,
|
85
|
-
props = _objectWithoutProperties(_this$props, ["checked", "disabled", "onChange", "name", "value", "children", "className"
|
67
|
+
props = _objectWithoutProperties(_this$props, ["checked", "disabled", "onChange", "name", "value", "children", "className"]);
|
86
68
|
|
87
69
|
return _react.default.createElement(Option, {
|
88
70
|
"data-testid": "option",
|
@@ -96,14 +78,6 @@ class RadioBlock extends _react.default.Component {
|
|
96
78
|
checked: checked,
|
97
79
|
disabled: disabled,
|
98
80
|
onChange: evt => {
|
99
|
-
if (category && action && !checked) {
|
100
|
-
const defaultAction = `Switched to ${action}`;
|
101
|
-
(0, _reactGa.event)({
|
102
|
-
category,
|
103
|
-
action: defaultAction
|
104
|
-
});
|
105
|
-
}
|
106
|
-
|
107
81
|
onChange(evt);
|
108
82
|
}
|
109
83
|
}, props)));
|
@@ -118,16 +92,11 @@ RadioBlock.propTypes = {
|
|
118
92
|
name: _propTypes.string.isRequired,
|
119
93
|
value: _propTypes.string.isRequired,
|
120
94
|
children: _propTypes.node.isRequired,
|
121
|
-
className: _propTypes.string
|
122
|
-
GA: (0, _propTypes.shape)({
|
123
|
-
category: _propTypes.string,
|
124
|
-
action: _propTypes.string
|
125
|
-
})
|
95
|
+
className: _propTypes.string
|
126
96
|
};
|
127
97
|
RadioBlock.defaultProps = {
|
128
|
-
className:
|
129
|
-
disabled: false
|
130
|
-
GA: {}
|
98
|
+
className: "",
|
99
|
+
disabled: false
|
131
100
|
};
|
132
101
|
var _default = RadioBlock;
|
133
102
|
exports.default = _default;
|
@@ -124,9 +124,6 @@ const delays = {
|
|
124
124
|
class Snackbar extends _react.default.Component {
|
125
125
|
constructor(props) {
|
126
126
|
super(props);
|
127
|
-
this.state = {
|
128
|
-
createdElement: null
|
129
|
-
};
|
130
127
|
(0, _reactAutobind.default)(this);
|
131
128
|
this.timer = null;
|
132
129
|
}
|
@@ -135,14 +132,6 @@ class Snackbar extends _react.default.Component {
|
|
135
132
|
if (this.props.visible) {
|
136
133
|
this.hideAfterDelay();
|
137
134
|
}
|
138
|
-
|
139
|
-
const randomId = Math.random().toString();
|
140
|
-
const wrapperElement = document.createElement('div');
|
141
|
-
wrapperElement.setAttribute('id', `modal${randomId}`);
|
142
|
-
document.body.appendChild(wrapperElement);
|
143
|
-
this.setState({
|
144
|
-
createdElement: wrapperElement
|
145
|
-
});
|
146
135
|
}
|
147
136
|
|
148
137
|
componentDidUpdate(prevProps) {
|
@@ -152,7 +141,6 @@ class Snackbar extends _react.default.Component {
|
|
152
141
|
}
|
153
142
|
|
154
143
|
componentWillUnmount() {
|
155
|
-
this.state.createdElement.parentNode.removeChild(this.state.createdElement);
|
156
144
|
window.clearTimeout(this.timer);
|
157
145
|
}
|
158
146
|
|
@@ -184,10 +172,6 @@ class Snackbar extends _react.default.Component {
|
|
184
172
|
} = _this$props,
|
185
173
|
rest = _objectWithoutProperties(_this$props, ["visible", "children", "onClose", "hideClose", "action", "onAction", "displayTime", "type"]);
|
186
174
|
|
187
|
-
if (!this.state.createdElement) {
|
188
|
-
return null;
|
189
|
-
}
|
190
|
-
|
191
175
|
return (0, _reactDom.createPortal)(_react.default.createElement(SlideUpLeft, _extends({
|
192
176
|
visible: visible
|
193
177
|
}, rest), _react.default.createElement(SnackWrapper, {
|
@@ -204,7 +188,7 @@ class Snackbar extends _react.default.Component {
|
|
204
188
|
}, action), displayTime === 'persistent' && _react.default.createElement(ToastOutlineButton, {
|
205
189
|
type: type,
|
206
190
|
onClick: onClose
|
207
|
-
}, "Dismiss")))))),
|
191
|
+
}, "Dismiss")))))), document.body);
|
208
192
|
}
|
209
193
|
|
210
194
|
}
|
@@ -9,8 +9,6 @@ var _propTypes = require("prop-types");
|
|
9
9
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
11
11
|
|
12
|
-
var _reactGa = require("react-ga");
|
13
|
-
|
14
12
|
var _colors = _interopRequireDefault(require("../../../constants/colors"));
|
15
13
|
|
16
14
|
var _spacing = _interopRequireDefault(require("../../../constants/spacing"));
|
@@ -92,7 +90,6 @@ const OverlayBase = (0, _react.forwardRef)((_ref, ref) => {
|
|
92
90
|
onHide,
|
93
91
|
hourIncrements,
|
94
92
|
minuteIncrements,
|
95
|
-
GA,
|
96
93
|
onIncrement,
|
97
94
|
onChange,
|
98
95
|
onApply
|
@@ -135,27 +132,12 @@ const OverlayBase = (0, _react.forwardRef)((_ref, ref) => {
|
|
135
132
|
type: "button",
|
136
133
|
onClick: () => {
|
137
134
|
onHide();
|
138
|
-
|
139
|
-
if (GA) {
|
140
|
-
(0, _reactGa.event)({
|
141
|
-
category: GA.category,
|
142
|
-
action: `${GA.action} (Cancel)`
|
143
|
-
});
|
144
|
-
}
|
145
135
|
}
|
146
136
|
}, "Cancel"), _react.default.createElement(_BrandButton.default, {
|
147
137
|
type: "button",
|
148
138
|
onClick: () => {
|
149
139
|
onApply(value);
|
150
140
|
onHide();
|
151
|
-
|
152
|
-
if (GA) {
|
153
|
-
(0, _reactGa.event)({
|
154
|
-
category: GA.category,
|
155
|
-
action: `${GA.action} (Apply)`,
|
156
|
-
label: `${hours} hrs ${minutes} mins`
|
157
|
-
});
|
158
|
-
}
|
159
141
|
},
|
160
142
|
"data-e2e": "time-apply"
|
161
143
|
}, "Apply")));
|
@@ -170,16 +152,11 @@ OverlayBase.propTypes = {
|
|
170
152
|
onHide: _propTypes.func.isRequired,
|
171
153
|
onIncrement: _propTypes.func.isRequired,
|
172
154
|
minuteIncrements: (0, _propTypes.oneOfType)([(0, _propTypes.arrayOf)(_propTypes.number), _propTypes.number]),
|
173
|
-
hourIncrements: _propTypes.number
|
174
|
-
GA: (0, _propTypes.shape)({
|
175
|
-
category: _propTypes.string,
|
176
|
-
action: _propTypes.string
|
177
|
-
})
|
155
|
+
hourIncrements: _propTypes.number
|
178
156
|
};
|
179
157
|
OverlayBase.defaultProps = {
|
180
158
|
minuteIncrements: 1,
|
181
|
-
hourIncrements: 1
|
182
|
-
GA: undefined
|
159
|
+
hourIncrements: 1
|
183
160
|
};
|
184
161
|
var _default = OverlayBase;
|
185
162
|
exports.default = _default;
|
@@ -23,8 +23,6 @@ var _getBoundedValue = _interopRequireDefault(require("../../../../utils/numbers
|
|
23
23
|
|
24
24
|
var _OutlineButton = _interopRequireDefault(require("../../../Button/OutlineButton"));
|
25
25
|
|
26
|
-
var _reactGa = require("react-ga");
|
27
|
-
|
28
26
|
var _BrandButton = _interopRequireDefault(require("../../../Button/BrandButton"));
|
29
27
|
|
30
28
|
var _roundTo = _interopRequireDefault(require("../../../../utils/roundTo"));
|
@@ -112,8 +110,7 @@ const TimeOverlay = (0, _react.forwardRef)((_ref, ref) => {
|
|
112
110
|
hourIncrements,
|
113
111
|
minuteIncrements,
|
114
112
|
min,
|
115
|
-
max
|
116
|
-
GA
|
113
|
+
max
|
117
114
|
} = _ref;
|
118
115
|
|
119
116
|
const sanitizeValue = unsanitizedValue => (0, _getBoundedValue.default)(unsanitizedValue, (0, _durationToMilliseconds.default)(min), (0, _durationToMilliseconds.default)(max));
|
@@ -159,13 +156,6 @@ const TimeOverlay = (0, _react.forwardRef)((_ref, ref) => {
|
|
159
156
|
type: "button",
|
160
157
|
onClick: () => {
|
161
158
|
onHide();
|
162
|
-
|
163
|
-
if (GA) {
|
164
|
-
(0, _reactGa.event)({
|
165
|
-
category: GA.category,
|
166
|
-
action: `${GA.action} (Cancel)`
|
167
|
-
});
|
168
|
-
}
|
169
159
|
}
|
170
160
|
}, "Cancel"), _react.default.createElement(DisplayValue, null, _react.default.createElement(TwentyFourHourValue, null, formatTimePart(hours), ":", formatTimePart(minutes)), _react.default.createElement(TwelveHourValue, null, convertHours(hours), ".", formatTimePart(minutes), hours > 11 ? 'pm' : 'am', ' ')), _react.default.createElement(_BrandButton.default, {
|
171
161
|
type: "button",
|
@@ -175,14 +165,6 @@ const TimeOverlay = (0, _react.forwardRef)((_ref, ref) => {
|
|
175
165
|
minutes
|
176
166
|
});
|
177
167
|
onHide();
|
178
|
-
|
179
|
-
if (GA) {
|
180
|
-
(0, _reactGa.event)({
|
181
|
-
category: GA.category,
|
182
|
-
action: `${GA.action} (Apply)`,
|
183
|
-
label: `${hours} hrs ${minutes} mins`
|
184
|
-
});
|
185
|
-
}
|
186
168
|
},
|
187
169
|
"data-e2e": "time-apply"
|
188
170
|
}, "Apply")));
|
@@ -198,16 +180,11 @@ TimeOverlay.propTypes = {
|
|
198
180
|
onChange: _propTypes.func.isRequired,
|
199
181
|
onHide: _propTypes.func.isRequired,
|
200
182
|
minuteIncrements: (0, _propTypes.oneOfType)([(0, _propTypes.arrayOf)(_propTypes.number), _propTypes.number]),
|
201
|
-
hourIncrements: _propTypes.number
|
202
|
-
GA: (0, _propTypes.shape)({
|
203
|
-
category: _propTypes.string,
|
204
|
-
action: _propTypes.string
|
205
|
-
})
|
183
|
+
hourIncrements: _propTypes.number
|
206
184
|
};
|
207
185
|
TimeOverlay.defaultProps = {
|
208
186
|
minuteIncrements: 1,
|
209
|
-
hourIncrements: 1
|
210
|
-
GA: undefined
|
187
|
+
hourIncrements: 1
|
211
188
|
};
|
212
189
|
var _default = TimeOverlay;
|
213
190
|
exports.default = _default;
|
@@ -19,8 +19,6 @@ var _loopAround = _interopRequireDefault(require("../../utils/loopAround"));
|
|
19
19
|
|
20
20
|
var _loopAroundMinutes = _interopRequireDefault(require("../../utils/loopAroundMinutes"));
|
21
21
|
|
22
|
-
var _PickerGA = _interopRequireDefault(require("../../utils/PickerGA"));
|
23
|
-
|
24
22
|
var _loopStatus = _interopRequireDefault(require("../../utils/constants/loopStatus"));
|
25
23
|
|
26
24
|
var _TimeInput = _interopRequireDefault(require("../TimeInput"));
|
@@ -60,16 +58,6 @@ const DurationLabel = _styledComponents.default.span`
|
|
60
58
|
`;
|
61
59
|
DurationLabel.displayName = 'DurationLabel';
|
62
60
|
|
63
|
-
const pad = value => value < 10 ? `0${value}` : value;
|
64
|
-
|
65
|
-
const getGATimeString = _ref => {
|
66
|
-
let {
|
67
|
-
hour,
|
68
|
-
minute
|
69
|
-
} = _ref;
|
70
|
-
return `${pad(hour)}:${pad(minute)}`;
|
71
|
-
};
|
72
|
-
|
73
61
|
class TimePickerOverlay extends _react.default.Component {
|
74
62
|
constructor(props) {
|
75
63
|
super(props);
|
@@ -254,8 +242,7 @@ class TimePickerOverlay extends _react.default.Component {
|
|
254
242
|
onApply,
|
255
243
|
onCancel,
|
256
244
|
isDurationPicker,
|
257
|
-
isDurationMinsOnly
|
258
|
-
GA
|
245
|
+
isDurationMinsOnly
|
259
246
|
} = this.props;
|
260
247
|
const {
|
261
248
|
minute,
|
@@ -275,11 +262,6 @@ class TimePickerOverlay extends _react.default.Component {
|
|
275
262
|
hour: newTime
|
276
263
|
}, () => {
|
277
264
|
if (shouldApply) {
|
278
|
-
(0, _PickerGA.default)({
|
279
|
-
category: GA.category,
|
280
|
-
action: `Apply time (${GA.action})`,
|
281
|
-
label: getGATimeString(this.state)
|
282
|
-
});
|
283
265
|
onApply(this.state);
|
284
266
|
}
|
285
267
|
}),
|
@@ -316,11 +298,6 @@ class TimePickerOverlay extends _react.default.Component {
|
|
316
298
|
minute: newTime
|
317
299
|
}, () => {
|
318
300
|
if (shouldApply) {
|
319
|
-
(0, _PickerGA.default)({
|
320
|
-
category: GA.category,
|
321
|
-
action: `Apply time (${GA.action})`,
|
322
|
-
label: getGATimeString(this.state)
|
323
|
-
});
|
324
301
|
onApply(this.state);
|
325
302
|
}
|
326
303
|
}),
|
@@ -347,35 +324,9 @@ class TimePickerOverlay extends _react.default.Component {
|
|
347
324
|
}))), _react.default.createElement(_Actions.default, null, _react.default.createElement(_CancelLink.default, {
|
348
325
|
onClick: () => {
|
349
326
|
onCancel();
|
350
|
-
(0, _PickerGA.default)({
|
351
|
-
category: GA.category,
|
352
|
-
action: `Cancel time (${GA.action})`
|
353
|
-
});
|
354
327
|
}
|
355
328
|
}, "Cancel"), _react.default.createElement(_BrandButton.default, {
|
356
329
|
onClick: () => {
|
357
|
-
if (this.state.hasUserUsedArrowIcons && this.state.hasUserEnteredInputManually) {
|
358
|
-
(0, _PickerGA.default)({
|
359
|
-
category: GA.category,
|
360
|
-
action: 'Both Arrow and Manual input used'
|
361
|
-
});
|
362
|
-
} else if (this.state.hasUserUsedArrowIcons) {
|
363
|
-
(0, _PickerGA.default)({
|
364
|
-
category: GA.category,
|
365
|
-
action: 'Only arrows used'
|
366
|
-
});
|
367
|
-
} else if (this.state.hasUserEnteredInputManually) {
|
368
|
-
(0, _PickerGA.default)({
|
369
|
-
category: GA.category,
|
370
|
-
action: 'Only Manual input used'
|
371
|
-
});
|
372
|
-
}
|
373
|
-
|
374
|
-
(0, _PickerGA.default)({
|
375
|
-
category: GA.category,
|
376
|
-
action: `Apply time (${GA.action})`,
|
377
|
-
label: getGATimeString(this.state)
|
378
|
-
});
|
379
330
|
onApply(this.state);
|
380
331
|
},
|
381
332
|
"data-e2e": "time-apply"
|
@@ -386,10 +337,6 @@ class TimePickerOverlay extends _react.default.Component {
|
|
386
337
|
|
387
338
|
TimePickerOverlay.displayName = 'TimePickerOverlay';
|
388
339
|
TimePickerOverlay.propTypes = {
|
389
|
-
GA: (0, _propTypes.shape)({
|
390
|
-
action: _propTypes.string,
|
391
|
-
label: _propTypes.string
|
392
|
-
}),
|
393
340
|
minute: _propTypes.number.isRequired,
|
394
341
|
stepMinutes: _propTypes.number,
|
395
342
|
minMinutes: _propTypes.number,
|
@@ -413,10 +360,6 @@ TimePickerOverlay.propTypes = {
|
|
413
360
|
})
|
414
361
|
};
|
415
362
|
TimePickerOverlay.defaultProps = {
|
416
|
-
GA: {
|
417
|
-
action: '',
|
418
|
-
label: ''
|
419
|
-
},
|
420
363
|
stepMinutes: 1,
|
421
364
|
stepHours: 1,
|
422
365
|
isDurationPicker: false,
|
package/dist/setupTests.js
CHANGED
@@ -6,8 +6,6 @@ var _react = require("@testing-library/react");
|
|
6
6
|
|
7
7
|
var _enzymeAdapterReact = _interopRequireDefault(require("enzyme-adapter-react-16"));
|
8
8
|
|
9
|
-
var _reactGa = _interopRequireDefault(require("react-ga"));
|
10
|
-
|
11
9
|
require("jest-enzyme");
|
12
10
|
|
13
11
|
require("jest-styled-components");
|
@@ -41,11 +39,6 @@ beforeEach(() => {
|
|
41
39
|
}
|
42
40
|
});
|
43
41
|
Element.prototype.scrollIntoView = jest.fn();
|
44
|
-
|
45
|
-
_reactGa.default.initialize('foo', {
|
46
|
-
testMode: true
|
47
|
-
});
|
48
|
-
|
49
42
|
jest.clearAllMocks();
|
50
43
|
});
|
51
44
|
afterEach(() => {
|