@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.
Files changed (91) hide show
  1. package/CHANGELOG.md +0 -18
  2. package/package.json +2 -3
  3. package/styles/v2/components/Modal/styles/dialogContainer.js +0 -1
  4. package/styles/v2/components/Radio/Radio.jsx +1 -1
  5. package/styles/v2/components/Radio/RadioGroup.jsx +1 -1
  6. package/v2/index.js +1 -1
  7. package/v2/index.js.map +1 -1
  8. package/styles/Alert/Alert.jsx +0 -45
  9. package/styles/Alert/Alert.spec.js +0 -85
  10. package/styles/AutoSuggestInput/AutoSuggestInput.jsx +0 -429
  11. package/styles/AutoSuggestInput/AutoSuggestInput.spec.js +0 -132
  12. package/styles/AutoSuggestInput/AutoSuggestItem.jsx +0 -61
  13. package/styles/AutoSuggestInput/AutoSuggestList.jsx +0 -85
  14. package/styles/Badge/Badge.jsx +0 -24
  15. package/styles/Badge/Badge.spec.js +0 -43
  16. package/styles/Chart/Chart.jsx +0 -185
  17. package/styles/Chart/Chart.spec.js +0 -369
  18. package/styles/Checkbox/Checkbox.jsx +0 -159
  19. package/styles/Checkbox/Checkbox.spec.js +0 -142
  20. package/styles/DateTime/DatePicker.jsx +0 -281
  21. package/styles/DateTime/DatePicker.spec.js +0 -186
  22. package/styles/DateTime/DatePickerCalendar.jsx +0 -170
  23. package/styles/DateTime/DatePickerCalendarNavigation.jsx +0 -44
  24. package/styles/DateTime/DatePickerCalendarWithRange.jsx +0 -218
  25. package/styles/DateTime/DateTimePicker.jsx +0 -266
  26. package/styles/DateTime/DateTimePicker.spec.js +0 -60
  27. package/styles/DateTime/DateTimeRangePicker.jsx +0 -629
  28. package/styles/DateTime/DateTimeRangePicker.spec.js +0 -425
  29. package/styles/DateTime/TimePicker.jsx +0 -158
  30. package/styles/DateTime/TimePicker.spec.js +0 -148
  31. package/styles/DateTime/date-time-assertions.js +0 -89
  32. package/styles/DateTime/index.js +0 -6
  33. package/styles/ErrorBoundary/ErrorBoundary.jsx +0 -76
  34. package/styles/ErrorBoundary/ErrorBoundary.spec.js +0 -72
  35. package/styles/Flyout/Flyout.jsx +0 -147
  36. package/styles/Flyout/Flyout.spec.js +0 -117
  37. package/styles/Form/Form.jsx +0 -151
  38. package/styles/Form/Form.spec.js +0 -148
  39. package/styles/Form/FormElementError.jsx +0 -18
  40. package/styles/Form/FormGroup.jsx +0 -32
  41. package/styles/Form/FormGroupError.jsx +0 -24
  42. package/styles/Form/index.js +0 -4
  43. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.jsx +0 -215
  44. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.spec.js +0 -213
  45. package/styles/GooglePlacesSearchInput/PoweredByGoogle.jsx +0 -43
  46. package/styles/GooglePlacesSearchInput/index.js +0 -2
  47. package/styles/HorizontalRule/HorizontalRule.jsx +0 -36
  48. package/styles/HorizontalRule/HorizontalRule.spec.js +0 -94
  49. package/styles/Label/Label.jsx +0 -22
  50. package/styles/Label/Label.spec.js +0 -11
  51. package/styles/Notification/Notification.jsx +0 -117
  52. package/styles/Notification/Notification.spec.js +0 -154
  53. package/styles/Notification/NotificationContainer.jsx +0 -90
  54. package/styles/Notification/NotificationPropTypes.js +0 -20
  55. package/styles/Notification/index.js +0 -2
  56. package/styles/PasswordControl/PasswordControl.jsx +0 -197
  57. package/styles/PasswordControl/PasswordControl.spec.js +0 -236
  58. package/styles/Portal/Portal.jsx +0 -65
  59. package/styles/Portal/Portal.spec.js +0 -45
  60. package/styles/PulseLoader/PulseLoader.jsx +0 -71
  61. package/styles/PulseLoader/PulseLoader.spec.js +0 -63
  62. package/styles/Radio/Radio.jsx +0 -114
  63. package/styles/Radio/Radio.spec.js +0 -128
  64. package/styles/Radio/RadioGroup.jsx +0 -105
  65. package/styles/Radio/index.js +0 -2
  66. package/styles/RenderInBody/RenderInBody.jsx +0 -56
  67. package/styles/RenderInBody/RenderInBody.spec.js +0 -24
  68. package/styles/Select/Select.jsx +0 -251
  69. package/styles/Select/Select.spec.js +0 -254
  70. package/styles/Select/SelectItemPropTypes.js +0 -19
  71. package/styles/Select/index.js +0 -2
  72. package/styles/SelectControlled/SelectControlled.jsx +0 -250
  73. package/styles/SelectControlled/SelectControlled.spec.js +0 -290
  74. package/styles/SelectControlled/index.js +0 -1
  75. package/styles/Sprite/Sprite.jsx +0 -16
  76. package/styles/Sprite/Sprite.spec.js +0 -11
  77. package/styles/Tabs/Tab.jsx +0 -38
  78. package/styles/Tabs/TabContent.jsx +0 -46
  79. package/styles/Tabs/TabNavigation.jsx +0 -64
  80. package/styles/Tabs/TabPanel.jsx +0 -30
  81. package/styles/Tabs/Tabs.jsx +0 -87
  82. package/styles/Tabs/Tabs.spec.js +0 -201
  83. package/styles/Tabs/index.js +0 -5
  84. package/styles/TextArea/TextArea.jsx +0 -137
  85. package/styles/TextArea/TextArea.spec.js +0 -111
  86. package/styles/TextInput/TextInput.jsx +0 -159
  87. package/styles/TextInput/TextInput.spec.js +0 -263
  88. package/styles/TextInput/TextInputPropTypes.js +0 -88
  89. package/styles/TextInput/index.js +0 -2
  90. package/styles/Tooltip/Tooltip.jsx +0 -230
  91. package/styles/Tooltip/Tooltip.spec.js +0 -170
@@ -1,61 +0,0 @@
1
- import React, {PureComponent} from 'react';
2
- import PropTypes from 'prop-types';
3
- import classnames from 'classnames';
4
-
5
- export default class AutoSuggestItem extends PureComponent {
6
- static propTypes = {
7
- /** Additional class(es) to add to the component. */
8
- className: PropTypes.string,
9
- /** Whether or not the suggestion item is active. */
10
- active: PropTypes.bool,
11
- /** The suggestion data object. */
12
- suggestion: PropTypes.shape({
13
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
14
- .isRequired,
15
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
16
- .isRequired,
17
- }).isRequired,
18
- /** Optional function to execute when a suggestion is selected. */
19
- onSuggestionSelect: PropTypes.func,
20
- /** Optional function to execute for suggestion list item's mousedown event. */
21
- onSuggestionMouseDown: PropTypes.func,
22
- /** Optional function to execute for suggestion list item's mouseout event. */
23
- onSuggestionMouseOut: PropTypes.func,
24
- };
25
-
26
- _onClick = evt => {
27
- evt.preventDefault();
28
-
29
- const {suggestion, onSuggestionSelect} = this.props;
30
-
31
- if (onSuggestionSelect) {
32
- onSuggestionSelect(suggestion);
33
- }
34
- };
35
-
36
- render() {
37
- const {
38
- active,
39
- className,
40
- suggestion,
41
- onSuggestionMouseDown,
42
- onSuggestionMouseOut,
43
- } = this.props;
44
- const classes = classnames(
45
- 'AutoSuggestInput-item',
46
- {'AutoSuggestInput-item-active': active},
47
- className
48
- );
49
-
50
- return (
51
- <li
52
- className={classes}
53
- onClick={this._onClick}
54
- onMouseDown={onSuggestionMouseDown}
55
- onMouseOut={onSuggestionMouseOut}
56
- >
57
- {suggestion.label}
58
- </li>
59
- );
60
- }
61
- }
@@ -1,85 +0,0 @@
1
- import React, {PureComponent} from 'react';
2
- import PropTypes from 'prop-types';
3
- import classnames from 'classnames';
4
- import AutoSuggestItem from './AutoSuggestItem';
5
-
6
- class AutoSuggestList extends PureComponent {
7
- static propTypes = {
8
- /** Whether or not the suggestion list should be hidden */
9
- hidden: PropTypes.bool,
10
- /** An array of suggestion objects. */
11
- suggestions: PropTypes.arrayOf(
12
- PropTypes.shape({
13
- label: PropTypes.oneOfType([
14
- PropTypes.string,
15
- PropTypes.element,
16
- ]).isRequired,
17
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
18
- })
19
- ),
20
- /** The suggestion object which is currently active. */
21
- activeSuggestion: PropTypes.object,
22
- /** A custom element to display at the bottom of the suggestion list */
23
- suggestionBoxFooter: PropTypes.element.isRequired,
24
- /** Function to execute when a suggestion is selected. */
25
- onSuggestionSelect: PropTypes.func.isRequired,
26
- /** Optional function to execute for suggestion list item's mousedown event. */
27
- onSuggestionMouseDown: PropTypes.func,
28
- /** Optional function to execute for suggestion list item's mouseout event. */
29
- onSuggestionMouseOut: PropTypes.func,
30
- /** Optional ref of underlying <ul> */
31
- forwardRef: PropTypes.node,
32
- };
33
- static defaultProps = {
34
- hidden: true,
35
- suggestions: [],
36
- };
37
-
38
- _onSuggestionSelect = suggestion => {
39
- this.props.onSuggestionSelect({
40
- suggestion,
41
- });
42
- };
43
-
44
- render() {
45
- const {
46
- hidden,
47
- suggestions,
48
- activeSuggestion,
49
- suggestionBoxFooter,
50
- onSuggestionMouseDown,
51
- onSuggestionMouseOut,
52
- forwardRef,
53
- } = this.props;
54
- const classes = classnames('AutoSuggestInput-suggestions', {
55
- 'AutoSuggestInput-suggestions-hidden': hidden,
56
- });
57
-
58
- return (
59
- <ul className={classes} ref={forwardRef}>
60
- {suggestions.map(suggestion => {
61
- const {id, className} = suggestion;
62
- const active =
63
- activeSuggestion && id === activeSuggestion.id;
64
-
65
- return (
66
- <AutoSuggestItem
67
- key={id}
68
- className={className}
69
- suggestion={suggestion}
70
- active={active}
71
- onSuggestionSelect={this._onSuggestionSelect}
72
- onSuggestionMouseDown={onSuggestionMouseDown}
73
- onSuggestionMouseOut={onSuggestionMouseOut}
74
- />
75
- );
76
- })}
77
- {suggestionBoxFooter}
78
- </ul>
79
- );
80
- }
81
- }
82
-
83
- export default React.forwardRef((props, ref) => (
84
- <AutoSuggestList forwardRef={ref} {...props} />
85
- ));
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
-
5
- const Badge = ({className, color, children}) => {
6
- const classes = classNames('Badge', `Badge-${color}`, className);
7
-
8
- return <span className={classes}>{children}</span>;
9
- };
10
-
11
- Badge.propTypes = {
12
- /** Additional class(es) to add to the component. */
13
- className: PropTypes.string,
14
- /** The node (typically a string) to put in the badge. */
15
- children: PropTypes.node.isRequired,
16
- /** The color of the badge. */
17
- color: PropTypes.oneOf(['default', 'danger', 'warning', 'success', 'info']),
18
- };
19
-
20
- Badge.defaultProps = {
21
- color: 'default',
22
- };
23
-
24
- export default Badge;
@@ -1,43 +0,0 @@
1
- describe('<Badge />', () => {
2
- context('Colors', () => {
3
- context('Default', () => {
4
- it('Has default styles', () => {
5
- cy.visitStory('v1/Badge/Colors', 'Default')
6
- .get('.Badge')
7
- .should('have.class', 'Badge-default');
8
- });
9
- });
10
-
11
- context('Danger', () => {
12
- it('Has danger styles', () => {
13
- cy.visitStory('v1/Badge/Colors', 'Danger')
14
- .get('.Badge')
15
- .should('have.class', 'Badge-danger');
16
- });
17
- });
18
-
19
- context('Info', () => {
20
- it('Has info styles', () => {
21
- cy.visitStory('v1/Badge/Colors', 'Info')
22
- .get('.Badge')
23
- .should('have.class', 'Badge-info');
24
- });
25
- });
26
-
27
- context('Success', () => {
28
- it('Has success styles', () => {
29
- cy.visitStory('v1/Badge/Colors', 'Success')
30
- .get('.Badge')
31
- .should('have.class', 'Badge-success');
32
- });
33
- });
34
-
35
- context('Warning', () => {
36
- it('Has warning styles', () => {
37
- cy.visitStory('v1/Badge/Colors', 'Warning')
38
- .get('.Badge')
39
- .should('have.class', 'Badge-warning');
40
- });
41
- });
42
- });
43
- });
@@ -1,185 +0,0 @@
1
- import forEach from 'lodash/forEach';
2
- import isEqual from 'lodash/isEqual';
3
- import React, {Component} from 'react';
4
- import PropTypes from 'prop-types';
5
- import classNames from 'classnames';
6
- import Chartist from 'chartist';
7
- import DOMUtils from '@spothero/utils/dom';
8
-
9
- export default class Chart extends Component {
10
- static propTypes = {
11
- /** Additional class(es) to add to the component. */
12
- className: PropTypes.string,
13
- /** The type of chart to draw. */
14
- type: PropTypes.oneOf(['Line', 'Bar', 'Pie', 'Donut']).isRequired,
15
- /**
16
- * The aspect ratio of the chart container.
17
- *
18
- * @see See the aspect ratio information <a href="https://gionkunz.github.io/chartist-js/getting-started.html#as-simple-as-it-can-get" target="_blank">here</a>. The value should not include the leading `ct-`.
19
- */
20
- aspectRatio: PropTypes.string,
21
- /**
22
- * The data to display on the chart.
23
- *
24
- * @see See the <a href="https://gionkunz.github.io/chartist-js/api-documentation.html" target="_blank">Chartist documentation</a> for details.
25
- */
26
- data: PropTypes.object.isRequired,
27
- /**
28
- * The options for the chart.
29
- *
30
- * @see See the <a href="https://gionkunz.github.io/chartist-js/api-documentation.html" target="_blank">Chartist documentation</a> for details.
31
- */
32
- options: PropTypes.object,
33
- /**
34
- * The responsive options to apply to chart.
35
- *
36
- * @see See the <a href="https://gionkunz.github.io/chartist-js/api-documentation.html" target="_blank">Chartist documentation</a> for details.
37
- */
38
- responsiveOptions: PropTypes.array,
39
- /** An array containing the events to listen for and their respective handler functions. */
40
- events: PropTypes.arrayOf(
41
- PropTypes.shape({
42
- event: PropTypes.oneOf([
43
- 'draw',
44
- 'optionsChanged',
45
- 'data',
46
- 'animationBegin',
47
- 'animationEnd',
48
- 'created',
49
- ]).isRequired,
50
- handler: PropTypes.func.isRequired,
51
- })
52
- ),
53
- /**
54
- * Setting this will show a legend. If passed as an object it will set configuration options on the legend.
55
- *
56
- * @see For possible options, see <a href="https://github.com/CodeYellowBV/chartist-plugin-legend" target="_blank">chartist-plugin-legend</a>.
57
- */
58
- legend: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
59
- /**
60
- * Setting this will show a tooltip when hovering over a point. If passed as an object it will set configuration options on the tooltip.
61
- *
62
- * @see For possible options, see <a href="https://github.com/Globegitter/chartist-plugin-tooltip" target="_blank">chartist-plugin-tooltip</a>.
63
- */
64
- tooltip: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
65
- };
66
- static defaultProps = {
67
- aspectRatio: 'double-octave',
68
- };
69
-
70
- constructor(props) {
71
- super(props);
72
-
73
- if (window) {
74
- const {type, options, legend, tooltip} = props;
75
- const plugins = [];
76
- const isDonut = type === 'Donut';
77
-
78
- this._chartType = isDonut ? 'Pie' : type;
79
- this._options = {...options};
80
-
81
- if (isDonut) {
82
- this._options.donut = true;
83
- }
84
-
85
- if (legend) {
86
- plugins.push(Chartist.plugins.legend(legend));
87
- }
88
-
89
- if (tooltip) {
90
- plugins.push(Chartist.plugins.tooltip(tooltip));
91
- }
92
-
93
- if (this._options.plugins) {
94
- this._options.plugins.concat(plugins);
95
- } else {
96
- this._options.plugins = plugins;
97
- }
98
-
99
- this._previousOptions = this._options;
100
- }
101
- }
102
-
103
- componentDidMount() {
104
- if (window) {
105
- const {data, responsiveOptions, events} = this.props;
106
-
107
- this._chartist = new Chartist[this._chartType](
108
- this._chart,
109
- data,
110
- this._options,
111
- responsiveOptions
112
- );
113
-
114
- if (events) {
115
- forEach(events, ({event, handler}) => {
116
- this._chartist.on(event, handler);
117
- });
118
- }
119
- }
120
- }
121
-
122
- componentDidUpdate(prevProps, prevState, snapshot) {
123
- const {data, options, responsiveOptions} = this.props;
124
-
125
- this._options = {
126
- ...this._options,
127
- ...options,
128
- };
129
-
130
- if (window && !isEqual(this._previousOptions, this._options)) {
131
- this._chartist.update(data, this._options, responsiveOptions);
132
-
133
- this._previousOptions = this._options;
134
- }
135
- }
136
-
137
- componentWillUnmount() {
138
- if (window) {
139
- const {tooltip, events} = this.props;
140
-
141
- if (tooltip && tooltip.appendToBody) {
142
- DOMUtils.remove('.chartist-tooltip');
143
- }
144
-
145
- forEach(events, ({event, handler}) => {
146
- this._chartist.off(event, handler);
147
- });
148
-
149
- this._chartist.detach();
150
- }
151
- }
152
-
153
- /**
154
- * Getter for the chartist event emitter.
155
- *
156
- * @public
157
- * @returns {Object} - The event emitter.
158
- */
159
- get eventEmitter() {
160
- return this._chartist.eventEmitter;
161
- }
162
-
163
- render() {
164
- if (!window) {
165
- return null;
166
- }
167
-
168
- const {className, aspectRatio} = this.props;
169
- const classes = classNames(
170
- 'Chart',
171
- 'ct-chart',
172
- `ct-${aspectRatio}`,
173
- className
174
- );
175
-
176
- return (
177
- <div
178
- ref={node => {
179
- this._chart = node;
180
- }}
181
- className={classes}
182
- />
183
- );
184
- }
185
- }