@spothero/ui 15.1.0 → 15.1.2
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/CHANGELOG.md +0 -18
- package/package.json +2 -3
- package/styles/v2/components/Modal/styles/dialogContainer.js +0 -1
- package/styles/v2/components/Radio/Radio.jsx +1 -1
- package/styles/v2/components/Radio/RadioGroup.jsx +1 -1
- package/v2/index.js +1 -1
- package/v2/index.js.map +1 -1
- package/styles/Alert/Alert.jsx +0 -45
- package/styles/Alert/Alert.spec.js +0 -85
- package/styles/AutoSuggestInput/AutoSuggestInput.jsx +0 -429
- package/styles/AutoSuggestInput/AutoSuggestInput.spec.js +0 -132
- package/styles/AutoSuggestInput/AutoSuggestItem.jsx +0 -61
- package/styles/AutoSuggestInput/AutoSuggestList.jsx +0 -85
- package/styles/Badge/Badge.jsx +0 -24
- package/styles/Badge/Badge.spec.js +0 -43
- package/styles/Chart/Chart.jsx +0 -185
- package/styles/Chart/Chart.spec.js +0 -369
- package/styles/Checkbox/Checkbox.jsx +0 -159
- package/styles/Checkbox/Checkbox.spec.js +0 -142
- package/styles/DateTime/DatePicker.jsx +0 -281
- package/styles/DateTime/DatePicker.spec.js +0 -186
- package/styles/DateTime/DatePickerCalendar.jsx +0 -170
- package/styles/DateTime/DatePickerCalendarNavigation.jsx +0 -44
- package/styles/DateTime/DatePickerCalendarWithRange.jsx +0 -218
- package/styles/DateTime/DateTimePicker.jsx +0 -266
- package/styles/DateTime/DateTimePicker.spec.js +0 -60
- package/styles/DateTime/DateTimeRangePicker.jsx +0 -629
- package/styles/DateTime/DateTimeRangePicker.spec.js +0 -425
- package/styles/DateTime/TimePicker.jsx +0 -158
- package/styles/DateTime/TimePicker.spec.js +0 -148
- package/styles/DateTime/date-time-assertions.js +0 -89
- package/styles/DateTime/index.js +0 -6
- package/styles/ErrorBoundary/ErrorBoundary.jsx +0 -76
- package/styles/ErrorBoundary/ErrorBoundary.spec.js +0 -72
- package/styles/Flyout/Flyout.jsx +0 -147
- package/styles/Flyout/Flyout.spec.js +0 -117
- package/styles/Form/Form.jsx +0 -151
- package/styles/Form/Form.spec.js +0 -148
- package/styles/Form/FormElementError.jsx +0 -18
- package/styles/Form/FormGroup.jsx +0 -32
- package/styles/Form/FormGroupError.jsx +0 -24
- package/styles/Form/index.js +0 -4
- package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.jsx +0 -215
- package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.spec.js +0 -213
- package/styles/GooglePlacesSearchInput/PoweredByGoogle.jsx +0 -43
- package/styles/GooglePlacesSearchInput/index.js +0 -2
- package/styles/HorizontalRule/HorizontalRule.jsx +0 -36
- package/styles/HorizontalRule/HorizontalRule.spec.js +0 -94
- package/styles/Label/Label.jsx +0 -22
- package/styles/Label/Label.spec.js +0 -11
- package/styles/Notification/Notification.jsx +0 -117
- package/styles/Notification/Notification.spec.js +0 -154
- package/styles/Notification/NotificationContainer.jsx +0 -90
- package/styles/Notification/NotificationPropTypes.js +0 -20
- package/styles/Notification/index.js +0 -2
- package/styles/PasswordControl/PasswordControl.jsx +0 -197
- package/styles/PasswordControl/PasswordControl.spec.js +0 -236
- package/styles/Portal/Portal.jsx +0 -65
- package/styles/Portal/Portal.spec.js +0 -45
- package/styles/PulseLoader/PulseLoader.jsx +0 -71
- package/styles/PulseLoader/PulseLoader.spec.js +0 -63
- package/styles/Radio/Radio.jsx +0 -114
- package/styles/Radio/Radio.spec.js +0 -128
- package/styles/Radio/RadioGroup.jsx +0 -105
- package/styles/Radio/index.js +0 -2
- package/styles/RenderInBody/RenderInBody.jsx +0 -56
- package/styles/RenderInBody/RenderInBody.spec.js +0 -24
- package/styles/Select/Select.jsx +0 -251
- package/styles/Select/Select.spec.js +0 -254
- package/styles/Select/SelectItemPropTypes.js +0 -19
- package/styles/Select/index.js +0 -2
- package/styles/SelectControlled/SelectControlled.jsx +0 -250
- package/styles/SelectControlled/SelectControlled.spec.js +0 -290
- package/styles/SelectControlled/index.js +0 -1
- package/styles/Sprite/Sprite.jsx +0 -16
- package/styles/Sprite/Sprite.spec.js +0 -11
- package/styles/Tabs/Tab.jsx +0 -38
- package/styles/Tabs/TabContent.jsx +0 -46
- package/styles/Tabs/TabNavigation.jsx +0 -64
- package/styles/Tabs/TabPanel.jsx +0 -30
- package/styles/Tabs/Tabs.jsx +0 -87
- package/styles/Tabs/Tabs.spec.js +0 -201
- package/styles/Tabs/index.js +0 -5
- package/styles/TextArea/TextArea.jsx +0 -137
- package/styles/TextArea/TextArea.spec.js +0 -111
- package/styles/TextInput/TextInput.jsx +0 -159
- package/styles/TextInput/TextInput.spec.js +0 -263
- package/styles/TextInput/TextInputPropTypes.js +0 -88
- package/styles/TextInput/index.js +0 -2
- package/styles/Tooltip/Tooltip.jsx +0 -230
- package/styles/Tooltip/Tooltip.spec.js +0 -170
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
describe('<PasswordControl />', () => {
|
|
2
|
-
context('Display', () => {
|
|
3
|
-
context('Default', () => {
|
|
4
|
-
const confirmInputType = () => {
|
|
5
|
-
return (
|
|
6
|
-
cy
|
|
7
|
-
.get('.PasswordControl')
|
|
8
|
-
.find('.TextInput input')
|
|
9
|
-
.should('have.attr', 'type', 'password')
|
|
10
|
-
// verify that the Show Password checkbox/button works
|
|
11
|
-
.get('.PasswordControl')
|
|
12
|
-
.find('.PasswordControl-show')
|
|
13
|
-
.click()
|
|
14
|
-
.get('.PasswordControl')
|
|
15
|
-
.find('.TextInput input')
|
|
16
|
-
.should('have.attr', 'type', 'text')
|
|
17
|
-
// verify that hiding the password works
|
|
18
|
-
.get('.PasswordControl')
|
|
19
|
-
.find('.PasswordControl-show')
|
|
20
|
-
.click()
|
|
21
|
-
.get('.PasswordControl')
|
|
22
|
-
.find('.TextInput input')
|
|
23
|
-
.should('have.attr', 'type', 'password')
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
const confirmInputValue = () => {
|
|
27
|
-
return (
|
|
28
|
-
cy
|
|
29
|
-
.get('.PasswordControl')
|
|
30
|
-
.find('.TextInput input')
|
|
31
|
-
.type('hunter2', {delay: 0})
|
|
32
|
-
.should('have.value', 'hunter2')
|
|
33
|
-
// verify that the Show Password checkbox/button works
|
|
34
|
-
.get('.PasswordControl')
|
|
35
|
-
.find('.PasswordControl-show')
|
|
36
|
-
.click()
|
|
37
|
-
.get('.PasswordControl')
|
|
38
|
-
.find('.TextInput input')
|
|
39
|
-
.should('have.value', 'hunter2')
|
|
40
|
-
.clear()
|
|
41
|
-
.type('pw123456', {delay: 0})
|
|
42
|
-
.should('have.value', 'pw123456')
|
|
43
|
-
// verify that hiding the password works
|
|
44
|
-
.get('.PasswordControl')
|
|
45
|
-
.find('.PasswordControl-show')
|
|
46
|
-
.click()
|
|
47
|
-
.get('.PasswordControl')
|
|
48
|
-
.find('.TextInput input')
|
|
49
|
-
.should('have.value', 'pw123456')
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
beforeEach(() => {
|
|
54
|
-
cy.visitStory('v1/PasswordControl/Display', 'Default');
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('Should have label, help text, custom class names, and no placeholder', () => {
|
|
58
|
-
cy.get('.PasswordControl')
|
|
59
|
-
.should('exist')
|
|
60
|
-
.and('have.class', 'custom-class1')
|
|
61
|
-
.and('have.class', 'custom-class2')
|
|
62
|
-
.find('.TextInput input')
|
|
63
|
-
.should('have.attr', 'name', 'password')
|
|
64
|
-
.and('have.attr', 'placeholder', '')
|
|
65
|
-
.get('.PasswordControl')
|
|
66
|
-
.find('.Label')
|
|
67
|
-
.first()
|
|
68
|
-
.contains('Enter a new password')
|
|
69
|
-
.get('.PasswordControl')
|
|
70
|
-
.find('.FormElement-help-text')
|
|
71
|
-
.contains('Additional help node text');
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
context('Show Password (Desktop)', () => {
|
|
75
|
-
it('Should correctly toggle between password and text type when Show Password is clicked', () => {
|
|
76
|
-
confirmInputType();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('Should preserve the value entered when Show Password is clicked', () => {
|
|
80
|
-
confirmInputValue();
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
context('Show Password (Mobile)', () => {
|
|
85
|
-
it('Show Password button should toggle between Show and Hide text', () => {
|
|
86
|
-
cy.viewport(375, 667)
|
|
87
|
-
.get('.PasswordControl')
|
|
88
|
-
.find('.PasswordControl-show button')
|
|
89
|
-
.contains('Show')
|
|
90
|
-
// verify that clicking the button changes the text
|
|
91
|
-
.get('.PasswordControl')
|
|
92
|
-
.find('.PasswordControl-show button')
|
|
93
|
-
.click()
|
|
94
|
-
.contains('Hide')
|
|
95
|
-
// verify that clicking the button changes the text back
|
|
96
|
-
.get('.PasswordControl')
|
|
97
|
-
.find('.PasswordControl-show button')
|
|
98
|
-
.click()
|
|
99
|
-
.contains('Show');
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('Should correctly toggle between password and text type when Show Password is clicked', () => {
|
|
103
|
-
cy.viewport(375, 667).then(() => {
|
|
104
|
-
confirmInputType();
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('Should preserve the value entered when Show Password is clicked', () => {
|
|
109
|
-
cy.viewport(375, 667).then(() => {
|
|
110
|
-
confirmInputValue();
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
context('Placeholder', () => {
|
|
117
|
-
it('Shows a placeholder', () => {
|
|
118
|
-
cy.visitStory('v1/PasswordControl/Display', 'Placeholder')
|
|
119
|
-
.get('.PasswordControl')
|
|
120
|
-
.find('input[name=password]')
|
|
121
|
-
.should('have.attr', 'placeholder', 'New Password');
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
context('Methods', () => {
|
|
127
|
-
describe('On Focus', () => {
|
|
128
|
-
it('Executes the method when input is focused on', () => {
|
|
129
|
-
cy.visitStory('v1/PasswordControl/Methods', 'OnFocus', {
|
|
130
|
-
onBeforeLoad: contentWindow => {
|
|
131
|
-
contentWindow.onPasswordControlFocus = evt => {
|
|
132
|
-
console.log(`onPasswordControlFocus`); // eslint-disable-line no-console
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
cy.stub(contentWindow, 'onPasswordControlFocus').as(
|
|
136
|
-
'onPasswordControlFocus'
|
|
137
|
-
);
|
|
138
|
-
},
|
|
139
|
-
})
|
|
140
|
-
.get('.PasswordControl')
|
|
141
|
-
.find('input[name=password]')
|
|
142
|
-
.focus()
|
|
143
|
-
.get('@onPasswordControlFocus')
|
|
144
|
-
.should('be.called');
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
describe('On Invalid', () => {
|
|
149
|
-
it('Displays an error if the input is required', () => {
|
|
150
|
-
cy.visitStory('v1/PasswordControl/Methods', 'OnInvalidRequired')
|
|
151
|
-
.get('.PasswordControl')
|
|
152
|
-
.find('input[name=password]')
|
|
153
|
-
// Show error on empty field since this is required
|
|
154
|
-
.should('have.value', '')
|
|
155
|
-
.get('button[type=submit]')
|
|
156
|
-
.click()
|
|
157
|
-
.get('.PasswordControl')
|
|
158
|
-
.find('.FormElementError')
|
|
159
|
-
.should('exist')
|
|
160
|
-
.contains('A password is required')
|
|
161
|
-
// Don't show error on field with content
|
|
162
|
-
.get('.PasswordControl')
|
|
163
|
-
.find('input[name=password]')
|
|
164
|
-
.type('hunter2', {delay: 0})
|
|
165
|
-
.get('button[type=submit]')
|
|
166
|
-
.click()
|
|
167
|
-
.get('.PasswordControl')
|
|
168
|
-
.find('.FormElementError')
|
|
169
|
-
.should('not.exist');
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('Displays an error if the input does not satisfy minLength', () => {
|
|
173
|
-
const errorMessage = 'Please enter at least 6 characters.';
|
|
174
|
-
|
|
175
|
-
cy.visitStory(
|
|
176
|
-
'v1/PasswordControl/Methods',
|
|
177
|
-
'OnInvalidMinLength'
|
|
178
|
-
)
|
|
179
|
-
.get('.PasswordControl')
|
|
180
|
-
.find('input[name=password]')
|
|
181
|
-
// Show error on empty field since this does not meet minLength requirement
|
|
182
|
-
.get('button[type=submit]')
|
|
183
|
-
.click()
|
|
184
|
-
.get('.PasswordControl')
|
|
185
|
-
.find('.FormElementError')
|
|
186
|
-
.should('exist')
|
|
187
|
-
.contains(errorMessage)
|
|
188
|
-
// Show error on field that does not meet minLength requirement
|
|
189
|
-
.get('.PasswordControl')
|
|
190
|
-
.find('input[name=password]')
|
|
191
|
-
.type('pw123', {delay: 0})
|
|
192
|
-
.get('button[type=submit]')
|
|
193
|
-
.click()
|
|
194
|
-
.get('.PasswordControl')
|
|
195
|
-
.find('.FormElementError')
|
|
196
|
-
.should('exist')
|
|
197
|
-
.contains(errorMessage)
|
|
198
|
-
// Don't show error on field with enough characters
|
|
199
|
-
.get('.PasswordControl')
|
|
200
|
-
.find('input[name=password]')
|
|
201
|
-
.type('4', {delay: 0})
|
|
202
|
-
.get('button[type=submit]')
|
|
203
|
-
.click()
|
|
204
|
-
.get('.PasswordControl')
|
|
205
|
-
.find('.FormElementError')
|
|
206
|
-
.should('not.exist');
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
describe('On Forgot Password Click', () => {
|
|
211
|
-
it('Executes the method when the Forgot Password button is clicked', () => {
|
|
212
|
-
cy.visitStory(
|
|
213
|
-
'v1/PasswordControl/Methods',
|
|
214
|
-
'OnForgotPasswordClick',
|
|
215
|
-
{
|
|
216
|
-
onBeforeLoad: contentWindow => {
|
|
217
|
-
contentWindow.onForgotPasswordClick = evt => {
|
|
218
|
-
console.log(`onForgotPasswordClick`); // eslint-disable-line no-console
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
cy.stub(contentWindow, 'onForgotPasswordClick').as(
|
|
222
|
-
'onForgotPasswordClick'
|
|
223
|
-
);
|
|
224
|
-
},
|
|
225
|
-
}
|
|
226
|
-
)
|
|
227
|
-
.get('.PasswordControl')
|
|
228
|
-
.find('.PasswordControl-forgot')
|
|
229
|
-
.should('exist')
|
|
230
|
-
.click()
|
|
231
|
-
.get('@onForgotPasswordClick')
|
|
232
|
-
.should('be.called');
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
});
|
package/styles/Portal/Portal.jsx
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import isArrayLikeObject from 'lodash/isArrayLikeObject';
|
|
2
|
-
import isString from 'lodash/isString';
|
|
3
|
-
import React, {PureComponent} from 'react';
|
|
4
|
-
import {createPortal} from 'react-dom';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import {Provider} from 'react-redux';
|
|
7
|
-
import {document} from 'ssr-window';
|
|
8
|
-
import DOMUtils from '@spothero/utils/dom';
|
|
9
|
-
|
|
10
|
-
export default class Portal extends PureComponent {
|
|
11
|
-
static propTypes = {
|
|
12
|
-
/** Additional class(es) to add to the component. */
|
|
13
|
-
className: PropTypes.string,
|
|
14
|
-
/** The content to insert into the portal. */
|
|
15
|
-
children: PropTypes.node.isRequired,
|
|
16
|
-
/** The element or selector of the element for where the portal should be appended in the DOM tree. */
|
|
17
|
-
appendTo: PropTypes.oneOfType([
|
|
18
|
-
PropTypes.object, // Should be PropTypes.instanceOf(Element) but SSR won't support that
|
|
19
|
-
PropTypes.string,
|
|
20
|
-
]),
|
|
21
|
-
/** When using Redux, allows to pass the store down to the children so they have access to its data. */
|
|
22
|
-
store: PropTypes.object,
|
|
23
|
-
};
|
|
24
|
-
static defaultProps = {
|
|
25
|
-
appendTo: document.body,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
constructor(props) {
|
|
29
|
-
super(props);
|
|
30
|
-
|
|
31
|
-
const {className, appendTo} = props;
|
|
32
|
-
|
|
33
|
-
this._EL = document.createElement('div');
|
|
34
|
-
this._ROOT = isString(appendTo) ? DOMUtils.el(appendTo) : appendTo;
|
|
35
|
-
|
|
36
|
-
if (isArrayLikeObject(this._ROOT)) {
|
|
37
|
-
this._ROOT = this._ROOT[0];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (className) {
|
|
41
|
-
DOMUtils.addClass(this._EL, className);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
componentDidMount() {
|
|
46
|
-
this._ROOT.appendChild(this._EL);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
componentWillUnmount() {
|
|
50
|
-
this._ROOT.removeChild(this._EL);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
render() {
|
|
54
|
-
const {store, children} = this.props;
|
|
55
|
-
|
|
56
|
-
if (store) {
|
|
57
|
-
return createPortal(
|
|
58
|
-
<Provider store={store}>{children}</Provider>,
|
|
59
|
-
this._EL
|
|
60
|
-
);
|
|
61
|
-
} else {
|
|
62
|
-
return createPortal(children, this._EL);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
describe('<Portal />', () => {
|
|
2
|
-
context('Display', () => {
|
|
3
|
-
context('Default', () => {
|
|
4
|
-
it('Renders properly in the body and passes props through', () => {
|
|
5
|
-
cy.visitStory('v1/Portal/Display', 'Default')
|
|
6
|
-
.get('.Portal-div')
|
|
7
|
-
.contains(`I'm in the body!`)
|
|
8
|
-
.parent()
|
|
9
|
-
.parent()
|
|
10
|
-
.then($el => {
|
|
11
|
-
expect($el.prop('tagName').toLowerCase()).to.eq('body');
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
context('Multiple classes', () => {
|
|
17
|
-
it('Renders properly and passes classes through', () => {
|
|
18
|
-
cy.visitStory('v1/Portal/Display', 'MultipleClasses')
|
|
19
|
-
.get('.Portal-div')
|
|
20
|
-
.should('have.class', 'PortalMultipleClasses');
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
context('In Element', () => {
|
|
25
|
-
it('Renders properly in an element and passes props through', () => {
|
|
26
|
-
cy.visitStory('v1/Portal/Display', 'InElement')
|
|
27
|
-
.get('.PortalInElement-open-btn')
|
|
28
|
-
.click()
|
|
29
|
-
.get('.Portal-div')
|
|
30
|
-
.contains(`I'm in the PortalInElement-sub div!`)
|
|
31
|
-
.parent()
|
|
32
|
-
.parent()
|
|
33
|
-
.should('have.class', 'PortalInElement-sub');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
context('Redux', () => {
|
|
38
|
-
it('Passes values through from a Redux store properly', () => {
|
|
39
|
-
cy.visitStory('v1/Portal/Display', 'Redux')
|
|
40
|
-
.get('.ReduxConsumer')
|
|
41
|
-
.contains('Redux items here!');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import times from 'lodash/times';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
|
|
6
|
-
const PulseLoader = ({className, size, borderWidth, additionalMarkup}) => {
|
|
7
|
-
const classes = classNames('PulseLoader', className);
|
|
8
|
-
const borderWidthx4 = borderWidth * 4;
|
|
9
|
-
const numInnerRings = size / borderWidthx4 - 1;
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div className={classes}>
|
|
13
|
-
<div
|
|
14
|
-
className="PulseLoader-pulse"
|
|
15
|
-
style={{
|
|
16
|
-
width: size,
|
|
17
|
-
height: size,
|
|
18
|
-
}}
|
|
19
|
-
>
|
|
20
|
-
<div className="PulseLoader-pulse-outer">
|
|
21
|
-
<div
|
|
22
|
-
className="PulseLoader-pulse-ring"
|
|
23
|
-
style={{
|
|
24
|
-
borderWidth,
|
|
25
|
-
}}
|
|
26
|
-
/>
|
|
27
|
-
</div>
|
|
28
|
-
{times(numInnerRings, i => {
|
|
29
|
-
const newSize = size - borderWidthx4 * (i + 1);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div
|
|
33
|
-
key={i}
|
|
34
|
-
className="PulseLoader-pulse-inner"
|
|
35
|
-
style={{
|
|
36
|
-
width: newSize,
|
|
37
|
-
height: newSize,
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
<div
|
|
41
|
-
className="PulseLoader-pulse-ring"
|
|
42
|
-
style={{
|
|
43
|
-
borderWidth,
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
})}
|
|
49
|
-
</div>
|
|
50
|
-
{additionalMarkup}
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
PulseLoader.propTypes = {
|
|
56
|
-
/** Additional class(es) to add to the component. */
|
|
57
|
-
className: PropTypes.string,
|
|
58
|
-
/** The diameter of the circle spinner. */
|
|
59
|
-
size: PropTypes.number,
|
|
60
|
-
/** The width of the border of the circle spinner. */
|
|
61
|
-
borderWidth: PropTypes.number,
|
|
62
|
-
/** Additional markup to place below the loading spinner. */
|
|
63
|
-
additionalMarkup: PropTypes.node,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
PulseLoader.defaultProps = {
|
|
67
|
-
size: 120,
|
|
68
|
-
borderWidth: 7,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export default PulseLoader;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const confirmPulseLoaderSize = expectedSize => {
|
|
2
|
-
return cy
|
|
3
|
-
.get('.PulseLoader-pulse')
|
|
4
|
-
.should(
|
|
5
|
-
'have.attr',
|
|
6
|
-
'style',
|
|
7
|
-
`width: ${expectedSize}px; height: ${expectedSize}px;`
|
|
8
|
-
);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const confirmPulseLoaderBorderWidth = expectedWidth => {
|
|
12
|
-
return cy
|
|
13
|
-
.get('.PulseLoader-pulse-ring')
|
|
14
|
-
.eq(0)
|
|
15
|
-
.should('have.attr', 'style', `border-width: ${expectedWidth}px;`);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
describe('<PulseLoader />', () => {
|
|
19
|
-
context('Display', () => {
|
|
20
|
-
context('Default', () => {
|
|
21
|
-
it('Has default stylings (size of 120px, border width of 7px)', () => {
|
|
22
|
-
cy.visitStory('v1/PulseLoader/Display', 'Default')
|
|
23
|
-
// the size the pulse reaches
|
|
24
|
-
.then(() => {
|
|
25
|
-
confirmPulseLoaderSize(120);
|
|
26
|
-
})
|
|
27
|
-
// the size/thickness of a pulse ring (border-width)
|
|
28
|
-
.then(() => {
|
|
29
|
-
confirmPulseLoaderBorderWidth(7);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
context('Border Width', () => {
|
|
35
|
-
it('Has a border width of 3px', () => {
|
|
36
|
-
cy.visitStory('v1/PulseLoader/Display', 'BorderWidth')
|
|
37
|
-
// the size/thickness of a pulse ring (border-width)
|
|
38
|
-
.then(() => {
|
|
39
|
-
confirmPulseLoaderBorderWidth(3);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
context('Size', () => {
|
|
45
|
-
it('Has a size of 70px', () => {
|
|
46
|
-
cy.visitStory('v1/PulseLoader/Display', 'Size')
|
|
47
|
-
// the size the pulse reaches
|
|
48
|
-
.then(() => {
|
|
49
|
-
confirmPulseLoaderSize(70);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
context('Additional Markup', () => {
|
|
55
|
-
it('Has additional markup', () => {
|
|
56
|
-
cy.visitStory('v1/PulseLoader/Display', 'AdditionalMarkup')
|
|
57
|
-
// make sure it contains the markup
|
|
58
|
-
.get('.PulseLoader')
|
|
59
|
-
.should('contain.text', 'Additional Markup!');
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
package/styles/Radio/Radio.jsx
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import React, {Component, cloneElement} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
export default class Radio extends Component {
|
|
6
|
-
static propTypes = {
|
|
7
|
-
/** Additional class(es) to add to the component. */
|
|
8
|
-
className: PropTypes.string,
|
|
9
|
-
/** The name for which the chosen value will correspond. Automatically passed from RadioGroup, do not set manually.
|
|
10
|
-
*
|
|
11
|
-
* @ignore
|
|
12
|
-
*/
|
|
13
|
-
name: PropTypes.string,
|
|
14
|
-
/** A value which is used when this radio is selected. */
|
|
15
|
-
value: PropTypes.string,
|
|
16
|
-
/** A custom label (typically a Label component) to display next to the radio. */
|
|
17
|
-
label: PropTypes.element.isRequired,
|
|
18
|
-
/** Whether the radio should be checked on mount. */
|
|
19
|
-
defaultChecked: PropTypes.bool,
|
|
20
|
-
/** Whether the element is disabled. Automatically passed from RadioGroup, do not set manually.
|
|
21
|
-
*
|
|
22
|
-
* @ignore
|
|
23
|
-
*/
|
|
24
|
-
disabled: PropTypes.bool,
|
|
25
|
-
/** Whether the element is required. Automatically passed from RadioGroup, do not set manually.
|
|
26
|
-
*
|
|
27
|
-
* @ignore
|
|
28
|
-
*/
|
|
29
|
-
required: PropTypes.bool,
|
|
30
|
-
/** The unique identifier to ensure this Radio is part of the right RadioGroup. Automatically passed from RadioGroup, do not set manually.
|
|
31
|
-
*
|
|
32
|
-
* @ignore
|
|
33
|
-
*/
|
|
34
|
-
id: PropTypes.string,
|
|
35
|
-
/**
|
|
36
|
-
* Method called when an item is checked. Automatically passed from RadioGroup, do not set manually.
|
|
37
|
-
*
|
|
38
|
-
* @ignore
|
|
39
|
-
*/
|
|
40
|
-
onChange: PropTypes.func,
|
|
41
|
-
/**
|
|
42
|
-
* Method called when validation state changes. Automatically passed from RadioGroup, do not set manually.
|
|
43
|
-
*
|
|
44
|
-
* @ignore
|
|
45
|
-
*/
|
|
46
|
-
onValidationChange: PropTypes.func,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
componentDidMount() {
|
|
50
|
-
this._input.addEventListener('invalid', this._onInvalid);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
componentWillUnmount() {
|
|
54
|
-
this._input.removeEventListener('invalid', this._onInvalid);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
_onInvalid = evt => {
|
|
58
|
-
evt.preventDefault();
|
|
59
|
-
|
|
60
|
-
const {onValidationChange} = this.props;
|
|
61
|
-
|
|
62
|
-
if (onValidationChange) {
|
|
63
|
-
onValidationChange(evt.currentTarget.validity);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
_onChange = evt => {
|
|
68
|
-
const {onValidationChange, onChange} = this.props;
|
|
69
|
-
|
|
70
|
-
if (onValidationChange) {
|
|
71
|
-
onValidationChange();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (onChange) {
|
|
75
|
-
onChange(evt);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
render() {
|
|
80
|
-
const {
|
|
81
|
-
label,
|
|
82
|
-
className,
|
|
83
|
-
name,
|
|
84
|
-
value,
|
|
85
|
-
defaultChecked,
|
|
86
|
-
disabled,
|
|
87
|
-
required,
|
|
88
|
-
id,
|
|
89
|
-
} = this.props;
|
|
90
|
-
const classes = classNames('Radio', 'FormElement', className);
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<div className={classes}>
|
|
94
|
-
<input
|
|
95
|
-
ref={node => {
|
|
96
|
-
this._input = node;
|
|
97
|
-
}}
|
|
98
|
-
className="FormElement-item"
|
|
99
|
-
id={`Radio-${id}`}
|
|
100
|
-
type="radio"
|
|
101
|
-
name={name}
|
|
102
|
-
value={value}
|
|
103
|
-
defaultChecked={defaultChecked}
|
|
104
|
-
onChange={this._onChange}
|
|
105
|
-
disabled={disabled}
|
|
106
|
-
required={required}
|
|
107
|
-
/>
|
|
108
|
-
{cloneElement(label, {
|
|
109
|
-
htmlFor: `Radio-${id}`,
|
|
110
|
-
})}
|
|
111
|
-
</div>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
}
|