@spothero/ui 15.1.0 → 15.1.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.
Files changed (85) hide show
  1. package/package.json +2 -3
  2. package/styles/Alert/Alert.jsx +0 -45
  3. package/styles/Alert/Alert.spec.js +0 -85
  4. package/styles/AutoSuggestInput/AutoSuggestInput.jsx +0 -429
  5. package/styles/AutoSuggestInput/AutoSuggestInput.spec.js +0 -132
  6. package/styles/AutoSuggestInput/AutoSuggestItem.jsx +0 -61
  7. package/styles/AutoSuggestInput/AutoSuggestList.jsx +0 -85
  8. package/styles/Badge/Badge.jsx +0 -24
  9. package/styles/Badge/Badge.spec.js +0 -43
  10. package/styles/Chart/Chart.jsx +0 -185
  11. package/styles/Chart/Chart.spec.js +0 -369
  12. package/styles/Checkbox/Checkbox.jsx +0 -159
  13. package/styles/Checkbox/Checkbox.spec.js +0 -142
  14. package/styles/DateTime/DatePicker.jsx +0 -281
  15. package/styles/DateTime/DatePicker.spec.js +0 -186
  16. package/styles/DateTime/DatePickerCalendar.jsx +0 -170
  17. package/styles/DateTime/DatePickerCalendarNavigation.jsx +0 -44
  18. package/styles/DateTime/DatePickerCalendarWithRange.jsx +0 -218
  19. package/styles/DateTime/DateTimePicker.jsx +0 -266
  20. package/styles/DateTime/DateTimePicker.spec.js +0 -60
  21. package/styles/DateTime/DateTimeRangePicker.jsx +0 -629
  22. package/styles/DateTime/DateTimeRangePicker.spec.js +0 -425
  23. package/styles/DateTime/TimePicker.jsx +0 -158
  24. package/styles/DateTime/TimePicker.spec.js +0 -148
  25. package/styles/DateTime/date-time-assertions.js +0 -89
  26. package/styles/DateTime/index.js +0 -6
  27. package/styles/ErrorBoundary/ErrorBoundary.jsx +0 -76
  28. package/styles/ErrorBoundary/ErrorBoundary.spec.js +0 -72
  29. package/styles/Flyout/Flyout.jsx +0 -147
  30. package/styles/Flyout/Flyout.spec.js +0 -117
  31. package/styles/Form/Form.jsx +0 -151
  32. package/styles/Form/Form.spec.js +0 -148
  33. package/styles/Form/FormElementError.jsx +0 -18
  34. package/styles/Form/FormGroup.jsx +0 -32
  35. package/styles/Form/FormGroupError.jsx +0 -24
  36. package/styles/Form/index.js +0 -4
  37. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.jsx +0 -215
  38. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.spec.js +0 -213
  39. package/styles/GooglePlacesSearchInput/PoweredByGoogle.jsx +0 -43
  40. package/styles/GooglePlacesSearchInput/index.js +0 -2
  41. package/styles/HorizontalRule/HorizontalRule.jsx +0 -36
  42. package/styles/HorizontalRule/HorizontalRule.spec.js +0 -94
  43. package/styles/Label/Label.jsx +0 -22
  44. package/styles/Label/Label.spec.js +0 -11
  45. package/styles/Notification/Notification.jsx +0 -117
  46. package/styles/Notification/Notification.spec.js +0 -154
  47. package/styles/Notification/NotificationContainer.jsx +0 -90
  48. package/styles/Notification/NotificationPropTypes.js +0 -20
  49. package/styles/Notification/index.js +0 -2
  50. package/styles/PasswordControl/PasswordControl.jsx +0 -197
  51. package/styles/PasswordControl/PasswordControl.spec.js +0 -236
  52. package/styles/Portal/Portal.jsx +0 -65
  53. package/styles/Portal/Portal.spec.js +0 -45
  54. package/styles/PulseLoader/PulseLoader.jsx +0 -71
  55. package/styles/PulseLoader/PulseLoader.spec.js +0 -63
  56. package/styles/Radio/Radio.jsx +0 -114
  57. package/styles/Radio/Radio.spec.js +0 -128
  58. package/styles/Radio/RadioGroup.jsx +0 -105
  59. package/styles/Radio/index.js +0 -2
  60. package/styles/RenderInBody/RenderInBody.jsx +0 -56
  61. package/styles/RenderInBody/RenderInBody.spec.js +0 -24
  62. package/styles/Select/Select.jsx +0 -251
  63. package/styles/Select/Select.spec.js +0 -254
  64. package/styles/Select/SelectItemPropTypes.js +0 -19
  65. package/styles/Select/index.js +0 -2
  66. package/styles/SelectControlled/SelectControlled.jsx +0 -250
  67. package/styles/SelectControlled/SelectControlled.spec.js +0 -290
  68. package/styles/SelectControlled/index.js +0 -1
  69. package/styles/Sprite/Sprite.jsx +0 -16
  70. package/styles/Sprite/Sprite.spec.js +0 -11
  71. package/styles/Tabs/Tab.jsx +0 -38
  72. package/styles/Tabs/TabContent.jsx +0 -46
  73. package/styles/Tabs/TabNavigation.jsx +0 -64
  74. package/styles/Tabs/TabPanel.jsx +0 -30
  75. package/styles/Tabs/Tabs.jsx +0 -87
  76. package/styles/Tabs/Tabs.spec.js +0 -201
  77. package/styles/Tabs/index.js +0 -5
  78. package/styles/TextArea/TextArea.jsx +0 -137
  79. package/styles/TextArea/TextArea.spec.js +0 -111
  80. package/styles/TextInput/TextInput.jsx +0 -159
  81. package/styles/TextInput/TextInput.spec.js +0 -263
  82. package/styles/TextInput/TextInputPropTypes.js +0 -88
  83. package/styles/TextInput/index.js +0 -2
  84. package/styles/Tooltip/Tooltip.jsx +0 -230
  85. package/styles/Tooltip/Tooltip.spec.js +0 -170
@@ -1,213 +0,0 @@
1
- describe('<GooglePlacesSearchInput />', () => {
2
- const testInput = 'mil';
3
- const createAutocompleteSpy = contentWindow => {
4
- const gmaps = contentWindow.google.maps;
5
- const autocompleteService = new gmaps.places.AutocompleteService();
6
-
7
- cy.spy(
8
- Object.getPrototypeOf(autocompleteService),
9
- 'getPlacePredictions'
10
- ).as('searchRequest');
11
- };
12
-
13
- context('Display', () => {
14
- context('Default', () => {
15
- it('Calls Google AutocompleteService with default search parameters', () => {
16
- const defaultCountry = {
17
- country: 'us',
18
- };
19
-
20
- cy.visitStory('v1/GooglePlacesSearchInput/Display', 'Default', {
21
- onLoad(contentWindow) {
22
- createAutocompleteSpy(contentWindow);
23
- },
24
- })
25
- .get('.GooglePlacesSearchInput')
26
- .as('gpsiInput')
27
- .fillTextInput({alias: 'gpsiInput', text: testInput})
28
- .get('@searchRequest')
29
- .should('be.calledWithMatch', val => {
30
- return cy.expect(val.input).to.equal(testInput);
31
- })
32
- .should('be.calledWithMatch', val => {
33
- return cy
34
- .expect(val.componentRestrictions)
35
- .to.eql(defaultCountry);
36
- });
37
- });
38
- });
39
-
40
- context('Custom Footer', () => {
41
- it('Has a custom PoweredByGoogle footer', () => {
42
- cy.visitStory('v1/GooglePlacesSearchInput/Display', 'Footer')
43
- .get('.GooglePlacesSearchInput')
44
- .as('gpsiInput')
45
- .fillTextInput({alias: 'gpsiInput', text: testInput})
46
- .get(
47
- '.GooglePlacesSearchInput .AutoSuggestInput-suggestions'
48
- )
49
- .find('.GooglePowered')
50
- .should('have.class', 'custom-footer');
51
- });
52
- });
53
- });
54
-
55
- context('Search', () => {
56
- describe('Bounds', () => {
57
- it('Applies bounds to autocomplete request', () => {
58
- const testBoundsJSON = {
59
- south: 41.7090772,
60
- west: -87.7946572,
61
- north: 42.2970963,
62
- east: -87.8287819,
63
- };
64
-
65
- cy.visitStory('v1/GooglePlacesSearchInput/Search', 'Bounds', {
66
- onLoad(contentWindow) {
67
- createAutocompleteSpy(contentWindow);
68
- },
69
- })
70
- .get('.GooglePlacesSearchInput')
71
- .as('gpsiInput')
72
- .fillTextInput({alias: 'gpsiInput', text: testInput})
73
- .get('@searchRequest')
74
- .should('be.calledOnce')
75
- .should('be.calledWithMatch', val => {
76
- return cy
77
- .expect(val.bounds.toJSON())
78
- .to.eql(testBoundsJSON);
79
- });
80
- });
81
- });
82
-
83
- describe('Types', () => {
84
- it('Applies types to autocomplete request', () => {
85
- const testTypes = ['(cities)'];
86
-
87
- cy.visitStory('v1/GooglePlacesSearchInput/Search', 'Types', {
88
- onLoad(contentWindow) {
89
- createAutocompleteSpy(contentWindow);
90
- },
91
- })
92
- .get('.GooglePlacesSearchInput')
93
- .as('gpsiInput')
94
- .fillTextInput({alias: 'gpsiInput', text: testInput})
95
- .get('@searchRequest')
96
- .should('be.calledOnce')
97
- .should('be.calledWithMatch', val => {
98
- return cy.expect(val.types).to.eql(testTypes);
99
- });
100
- });
101
- });
102
-
103
- describe('Country', () => {
104
- it('Applies a country to autocomplete request', () => {
105
- const testCountry = {
106
- country: 'ca',
107
- };
108
-
109
- cy.visitStory('v1/GooglePlacesSearchInput/Search', 'Country', {
110
- onLoad(contentWindow) {
111
- createAutocompleteSpy(contentWindow);
112
- },
113
- })
114
- .get('.GooglePlacesSearchInput')
115
- .as('gpsiInput')
116
- .fillTextInput({alias: 'gpsiInput', text: testInput})
117
- .get('@searchRequest')
118
- .should('be.calledOnce')
119
- .should('be.calledWithMatch', val => {
120
- return cy
121
- .expect(val.componentRestrictions)
122
- .to.eql(testCountry);
123
- });
124
- });
125
- });
126
-
127
- describe('Multi Country', () => {
128
- it('Applies an array of countries to autocomplete request', () => {
129
- const testCountries = {
130
- country: ['ca', 'fr'],
131
- };
132
-
133
- cy.visitStory(
134
- 'v1/GooglePlacesSearchInput/Search',
135
- 'MultiCountry',
136
- {
137
- onLoad(contentWindow) {
138
- createAutocompleteSpy(contentWindow);
139
- },
140
- }
141
- )
142
- .get('.GooglePlacesSearchInput')
143
- .as('gpsiInput')
144
- .fillTextInput({alias: 'gpsiInput', text: testInput})
145
- .get('@searchRequest')
146
- .should('be.calledOnce')
147
- .should('be.calledWithMatch', val => {
148
- return cy
149
- .expect(val.componentRestrictions)
150
- .to.eql(testCountries);
151
- });
152
- });
153
- });
154
- });
155
-
156
- context('Methods', () => {
157
- describe('On Clear', () => {
158
- it('Executes the method when the input is cleared', () => {
159
- cy.visitStory('v1/GooglePlacesSearchInput/Methods', 'OnClear', {
160
- onBeforeLoad: contentWindow => {
161
- contentWindow.onGooglePlacesSearchInputClear = evt => {
162
- console.log(`onGooglePlacesSearchInputClear`); // eslint-disable-line no-console
163
- };
164
-
165
- cy.stub(
166
- contentWindow,
167
- 'onGooglePlacesSearchInputClear'
168
- ).as('onGooglePlacesSearchInputClear');
169
- },
170
- })
171
- .get('.GooglePlacesSearchInput')
172
- .as('gpsiInput')
173
- .fillTextInput({alias: 'gpsiInput', text: testInput})
174
- .get('.AutoSuggestInput-clear')
175
- .click()
176
- .get('@onGooglePlacesSearchInputClear')
177
- .should('be.called');
178
- });
179
- });
180
-
181
- describe('On Suggestion Select', () => {
182
- it('Executes the method when a suggestion is selected', () => {
183
- cy.visitStory(
184
- 'v1/GooglePlacesSearchInput/Methods',
185
- 'OnSuggestionSelect',
186
- {
187
- onBeforeLoad: contentWindow => {
188
- contentWindow.onGooglePlacesSearchInputSuggest = evt => {
189
- console.log(`onGooglePlacesSearchInputSuggest`); // eslint-disable-line no-console
190
- };
191
-
192
- cy.stub(
193
- contentWindow,
194
- 'onGooglePlacesSearchInputSuggest'
195
- ).as('onGooglePlacesSearchInputSuggest');
196
- },
197
- }
198
- )
199
- .get('.GooglePlacesSearchInput')
200
- .as('gpsiInput')
201
- .fillTextInput({alias: 'gpsiInput', text: testInput})
202
- .get(
203
- '.GooglePlacesSearchInput .AutoSuggestInput-suggestions'
204
- )
205
- .find('.AutoSuggestInput-item')
206
- .first()
207
- .click()
208
- .get('@onGooglePlacesSearchInputSuggest')
209
- .should('be.called');
210
- });
211
- });
212
- });
213
- });
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
- import Image from 'v1/components/Image/Image';
5
-
6
- const PoweredByGoogle = ({
7
- className,
8
- cloudinaryImageId,
9
- imageWidth,
10
- imageHeight,
11
- }) => {
12
- const classes = classNames('PoweredByGoogle', className);
13
-
14
- return (
15
- <div className={classes}>
16
- <Image
17
- className="PoweredByGoogleImage"
18
- cloudinaryImageId={cloudinaryImageId}
19
- width={imageWidth}
20
- height={imageHeight}
21
- />
22
- </div>
23
- );
24
- };
25
-
26
- PoweredByGoogle.propTypes = {
27
- /** Additional class(es) to add to the component. */
28
- className: PropTypes.string,
29
- /** The image ID that is stored in Cloudinary for this image. */
30
- cloudinaryImageId: PropTypes.string.isRequired,
31
- /** The width to make the image transformation (typically half of the 2x source width for crisp images). */
32
- imageWidth: PropTypes.number,
33
- /** The height to make the image transformation (typically half of the 2x source height for crisp images). */
34
- imageHeight: PropTypes.number,
35
- };
36
-
37
- PoweredByGoogle.defaultProps = {
38
- cloudinaryImageId: 'front-end/powered-by-google',
39
- imageWidth: 144,
40
- imageHeight: 18,
41
- };
42
-
43
- export default PoweredByGoogle;
@@ -1,2 +0,0 @@
1
- export {default as PoweredByGoogle} from './PoweredByGoogle';
2
- export {default as GooglePlacesSearchInput} from './GooglePlacesSearchInput';
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
-
5
- const HorizontalRule = ({className, children, lineStyle, position}) => {
6
- const classes = classNames(
7
- 'HorizontalRule',
8
- `HorizontalRule-${lineStyle}`,
9
- `HorizontalRule-${position}`,
10
- className
11
- );
12
-
13
- return (
14
- <div className={classes}>
15
- <span>{children}</span>
16
- </div>
17
- );
18
- };
19
-
20
- HorizontalRule.propTypes = {
21
- /** Additional class(es) to add to the component. */
22
- className: PropTypes.string,
23
- /** An optional node to render inside of the label. */
24
- children: PropTypes.node,
25
- /** The line style of the rule. */
26
- lineStyle: PropTypes.oneOf(['solid', 'dashed', 'dotted']),
27
- /** The position of the node within the rule. */
28
- position: PropTypes.oneOf(['center', 'left', 'right']),
29
- };
30
-
31
- HorizontalRule.defaultProps = {
32
- lineStyle: 'solid',
33
- position: 'center',
34
- };
35
-
36
- export default HorizontalRule;
@@ -1,94 +0,0 @@
1
- describe('<HorizontalRule />', () => {
2
- context('Display', () => {
3
- context('Default', () => {
4
- it('Has default styles', () => {
5
- cy.visitStory('v1/HorizontalRule/Display', 'Default')
6
- .get('.HorizontalRule')
7
- .should('have.class', 'HorizontalRule-solid')
8
- .and('have.class', 'HorizontalRule-center');
9
- });
10
- });
11
-
12
- context('WithChildren', () => {
13
- it('Contains the children that were passed in', () => {
14
- cy.visitStory('v1/HorizontalRule/Display', 'WithChildren')
15
- .get('.HorizontalRule')
16
- .contains('content and more content')
17
- .get('.HorizontalRule')
18
- .find('.styled-span');
19
- });
20
- });
21
- });
22
-
23
- context('Position', () => {
24
- context('Center', () => {
25
- it('Has center styles', () => {
26
- cy.visitStory('v1/HorizontalRule/Position', 'Center')
27
- .get('.HorizontalRule')
28
- .should(
29
- 'have.class',
30
- 'HorizontalRule-dashed',
31
- 'HorizontalRule-center'
32
- );
33
- });
34
- });
35
-
36
- context('Left', () => {
37
- it('Has left styles', () => {
38
- cy.visitStory('v1/HorizontalRule/Position', 'Left')
39
- .get('.HorizontalRule')
40
- .should(
41
- 'have.class',
42
- 'HorizontalRule-dotted',
43
- 'HorizontalRule-left'
44
- );
45
- });
46
- });
47
-
48
- context('Right', () => {
49
- it('Has right styles', () => {
50
- cy.visitStory('v1/HorizontalRule/Position', 'Right')
51
- .get('.HorizontalRule')
52
- .should(
53
- 'have.class',
54
- 'HorizontalRule-solid',
55
- 'HorizontalRule-right'
56
- );
57
- });
58
- });
59
- });
60
-
61
- context('Styles', () => {
62
- context('CustomClass', () => {
63
- it('Has custom styles', () => {
64
- cy.visitStory('v1/HorizontalRule/Styles', 'CustomClass')
65
- .get('.HorizontalRule')
66
- .should('have.class', 'custom-class1', 'custom-class2');
67
- });
68
- });
69
-
70
- context('Dashed', () => {
71
- it('Has dashed styles', () => {
72
- cy.visitStory('v1/HorizontalRule/Styles', 'Dashed')
73
- .get('.HorizontalRule')
74
- .should('have.class', 'HorizontalRule-dashed');
75
- });
76
- });
77
-
78
- context('Dotted', () => {
79
- it('Has dotted styles', () => {
80
- cy.visitStory('v1/HorizontalRule/Styles', 'Dotted')
81
- .get('.HorizontalRule')
82
- .should('have.class', 'HorizontalRule-dotted');
83
- });
84
- });
85
-
86
- context('Solid', () => {
87
- it('Has solid styles', () => {
88
- cy.visitStory('v1/HorizontalRule/Styles', 'Solid')
89
- .get('.HorizontalRule')
90
- .should('have.class', 'HorizontalRule-solid');
91
- });
92
- });
93
- });
94
- });
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
-
5
- const Label = ({className, children, ...additionalProps}) => {
6
- const classes = classNames('Label', className);
7
-
8
- return (
9
- <label className={classes} {...additionalProps}>
10
- {children}
11
- </label>
12
- );
13
- };
14
-
15
- Label.propTypes = {
16
- /** Additional class(es) to add to the component. */
17
- className: PropTypes.string,
18
- /** The node to render inside of the label. */
19
- children: PropTypes.node.isRequired,
20
- };
21
-
22
- export default Label;
@@ -1,11 +0,0 @@
1
- describe('<Label />', () => {
2
- context('Display', () => {
3
- context('Default', () => {
4
- it('Renders correctly', () => {
5
- cy.visitStory('v1/Label/Display', 'Default')
6
- .get('.Label')
7
- .contains('Label Text');
8
- });
9
- });
10
- });
11
- });
@@ -1,117 +0,0 @@
1
- import bind from 'lodash/bind';
2
- import React, {Component} from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import {window} from 'ssr-window';
6
- import IconCheckCircle from '@spothero/icons/check-circle';
7
- import IconExclamationCircle from '@spothero/icons/exclamation-circle';
8
- import IconExclamationTriangle from '@spothero/icons/exclamation-triangle';
9
- import IconHeroCar from '@spothero/icons/hero-car';
10
- import IconTimes from '@spothero/icons/times';
11
- import DOMUtils from '@spothero/utils/dom';
12
- import Button from 'v1/components/Button/Button';
13
- import NotificationPropTypes from './NotificationPropTypes';
14
-
15
- export default class Notification extends Component {
16
- static propTypes = {
17
- ...NotificationPropTypes,
18
- // onRemove is added by the NotificationContainer for internal use and should not be documented
19
- onRemove: PropTypes.func.isRequired,
20
- };
21
- static defaultProps = {
22
- type: 'info',
23
- duration: 3000,
24
- showClose: true,
25
- autoClose: true,
26
- };
27
-
28
- constructor(props) {
29
- super(props);
30
-
31
- const {duration, autoClose} = props;
32
-
33
- if (autoClose) {
34
- this._hideTimeout = window.setTimeout(
35
- bind(this._hide, this),
36
- duration
37
- );
38
- }
39
- }
40
-
41
- componentDidMount() {
42
- window.setTimeout(() => {
43
- DOMUtils.addClass(this._notification, 'Notification-showing');
44
- }, 100);
45
- }
46
-
47
- _onHideClick = evt => {
48
- this._hide();
49
- };
50
-
51
- _hide() {
52
- const {onHidden, onRemove} = this.props;
53
-
54
- if (this._hideTimeout) {
55
- window.clearTimeout(this._hideTimeout);
56
- }
57
-
58
- DOMUtils.removeClass(this._notification, 'Notification-showing');
59
-
60
- window.setTimeout(() => {
61
- DOMUtils.removeClass(this._notification, 'Notification-showing');
62
-
63
- if (onHidden) {
64
- onHidden(this.props);
65
- }
66
-
67
- onRemove();
68
- }, 500);
69
- }
70
-
71
- _renderIcon() {
72
- const {type} = this.props;
73
-
74
- switch (type) {
75
- case 'success':
76
- return <IconCheckCircle />;
77
- case 'warning':
78
- return <IconExclamationTriangle />;
79
- case 'error':
80
- return <IconExclamationCircle />;
81
- case 'info':
82
- default:
83
- return <IconHeroCar />;
84
- }
85
- }
86
-
87
- render() {
88
- const {className, type, message, showClose} = this.props;
89
- const classes = classNames(
90
- 'Notification',
91
- `Notification-${type}`,
92
- className
93
- );
94
-
95
- return (
96
- <div
97
- className={classes}
98
- ref={node => {
99
- this._notification = node;
100
- }}
101
- >
102
- <div className="Notification-content-container container">
103
- {this._renderIcon()}
104
- <div className="Notification-content">{message}</div>
105
- {showClose && (
106
- <Button
107
- className="Notification-hide"
108
- onClick={this._onHideClick}
109
- >
110
- <IconTimes className="Icon-cancel" />
111
- </Button>
112
- )}
113
- </div>
114
- </div>
115
- );
116
- }
117
- }