@spothero/ui 15.10.9 → 16.0.0-beta.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 (317) hide show
  1. package/.eslintignore +1 -1
  2. package/babel.config.js +1 -0
  3. package/dex.config.js +1 -1
  4. package/jest.config.json +4 -2
  5. package/package.json +11 -26
  6. package/v2/index.js +1 -1
  7. package/v2/index.js.map +1 -1
  8. package/backlog/Alert/Alert.js +0 -37
  9. package/backlog/AutoSuggestInput/AutoSuggestInput.js +0 -474
  10. package/backlog/AutoSuggestInput/AutoSuggestItem.js +0 -99
  11. package/backlog/AutoSuggestInput/AutoSuggestList.js +0 -126
  12. package/backlog/Badge/Badge.js +0 -28
  13. package/backlog/Chart/Chart.js +0 -211
  14. package/backlog/Checkbox/Checkbox.js +0 -167
  15. package/backlog/DateTime/DatePicker.js +0 -279
  16. package/backlog/DateTime/DatePickerCalendar.js +0 -199
  17. package/backlog/DateTime/DatePickerCalendarNavigation.js +0 -102
  18. package/backlog/DateTime/DatePickerCalendarWithRange.js +0 -241
  19. package/backlog/DateTime/DateTimePicker.js +0 -216
  20. package/backlog/DateTime/DateTimeRangePicker.js +0 -530
  21. package/backlog/DateTime/TimePicker.js +0 -180
  22. package/backlog/DateTime/date-time-assertions.js +0 -66
  23. package/backlog/DateTime/index.js +0 -55
  24. package/backlog/ErrorBoundary/ErrorBoundary.js +0 -125
  25. package/backlog/Flyout/Flyout.js +0 -198
  26. package/backlog/Form/Form.js +0 -193
  27. package/backlog/Form/FormElementError.js +0 -24
  28. package/backlog/Form/FormGroup.js +0 -30
  29. package/backlog/Form/FormGroupError.js +0 -28
  30. package/backlog/Form/index.js +0 -39
  31. package/backlog/GooglePlacesSearchInput/GooglePlacesSearchInput.js +0 -253
  32. package/backlog/GooglePlacesSearchInput/PoweredByGoogle.js +0 -38
  33. package/backlog/GooglePlacesSearchInput/index.js +0 -23
  34. package/backlog/HorizontalRule/HorizontalRule.js +0 -30
  35. package/backlog/Label/Label.js +0 -31
  36. package/backlog/Notification/Notification.js +0 -178
  37. package/backlog/Notification/NotificationContainer.js +0 -131
  38. package/backlog/Notification/NotificationPropTypes.js +0 -37
  39. package/backlog/Notification/index.js +0 -23
  40. package/backlog/PasswordControl/PasswordControl.js +0 -201
  41. package/backlog/Portal/Portal.js +0 -110
  42. package/backlog/PulseLoader/PulseLoader.js +0 -62
  43. package/backlog/Radio/Radio.js +0 -135
  44. package/backlog/Radio/RadioGroup.js +0 -123
  45. package/backlog/Radio/index.js +0 -23
  46. package/backlog/RenderInBody/RenderInBody.js +0 -103
  47. package/backlog/Select/Select.js +0 -275
  48. package/backlog/Select/SelectItemPropTypes.js +0 -32
  49. package/backlog/Select/index.js +0 -23
  50. package/backlog/SelectControlled/SelectControlled.js +0 -270
  51. package/backlog/SelectControlled/index.js +0 -15
  52. package/backlog/Sprite/Sprite.js +0 -24
  53. package/backlog/Tabs/Tab.js +0 -94
  54. package/backlog/Tabs/TabContent.js +0 -56
  55. package/backlog/Tabs/TabNavigation.js +0 -108
  56. package/backlog/Tabs/TabPanel.js +0 -29
  57. package/backlog/Tabs/Tabs.js +0 -126
  58. package/backlog/Tabs/index.js +0 -47
  59. package/backlog/TextArea/TextArea.js +0 -155
  60. package/backlog/TextInput/TextInput.js +0 -230
  61. package/backlog/TextInput/TextInputPropTypes.js +0 -114
  62. package/backlog/TextInput/index.js +0 -23
  63. package/backlog/Tooltip/Tooltip.js +0 -249
  64. package/backlog/index.js +0 -393
  65. package/backlog/v1/components/Button/Button.js +0 -64
  66. package/backlog/v1/components/Button/button-props.js +0 -48
  67. package/backlog/v1/components/Image/Image.js +0 -193
  68. package/backlog/v1/components/Loader/Loader.js +0 -51
  69. package/backlog/v1/components/Modal/Modal.js +0 -325
  70. package/backlog/v1/components/Modal/ModalContent.js +0 -154
  71. package/backlog/v1/components/Modal/ModalFooter.js +0 -89
  72. package/backlog/v1/components/Modal/index.js +0 -31
  73. package/backlog/v1/components/Panel/Panel.js +0 -209
  74. package/backlog/v1/components/Table/Table.js +0 -336
  75. package/backlog/v1/components/Table/TableCell.js +0 -28
  76. package/backlog/v1/components/Table/TableCellPropTypes.js +0 -22
  77. package/backlog/v1/components/Table/TableControls.js +0 -56
  78. package/backlog/v1/components/Table/TableFooter.js +0 -63
  79. package/backlog/v1/components/Table/TableHeading.js +0 -126
  80. package/backlog/v1/components/Table/TableHeadingPropTypes.js +0 -35
  81. package/backlog/v1/components/Table/TableSortSelector.js +0 -125
  82. package/backlog/v1/components/Table/TableSortType.js +0 -11
  83. package/backlog/v1/components/Table/index.js +0 -47
  84. package/backlog/v1/components/TextButton/TextButton.js +0 -74
  85. package/backlog/v1/components/index.js +0 -75
  86. package/backlog/v1/utils/deprecate.js +0 -61
  87. package/styles/Alert/_Alert.scss +0 -51
  88. package/styles/AutoSuggestInput/_AutoSuggestInput.scss +0 -116
  89. package/styles/Badge/_Badge.scss +0 -33
  90. package/styles/Chart/_Chart.scss +0 -105
  91. package/styles/Chart/_chartist-settings.scss +0 -131
  92. package/styles/Chart/_chartist.scss +0 -295
  93. package/styles/Checkbox/_Checkbox.scss +0 -173
  94. package/styles/DateTime/_DatePicker.scss +0 -61
  95. package/styles/DateTime/_DatePickerCalendar.scss +0 -159
  96. package/styles/DateTime/_DateTime.scss +0 -4
  97. package/styles/DateTime/_DateTimePicker.scss +0 -46
  98. package/styles/DateTime/_TimePicker.scss +0 -30
  99. package/styles/ErrorBoundary/_ErrorBoundary.scss +0 -18
  100. package/styles/Flyout/_Flyout.scss +0 -73
  101. package/styles/Form/_Form.scss +0 -53
  102. package/styles/GooglePlacesSearchInput/_GooglePlacesSearchInput.scss +0 -3
  103. package/styles/GooglePlacesSearchInput/_PoweredByGoogle.scss +0 -21
  104. package/styles/HorizontalRule/_HorizontalRule.scss +0 -48
  105. package/styles/Label/_Label.scss +0 -6
  106. package/styles/Notification/_Notification.scss +0 -113
  107. package/styles/PasswordControl/_PasswordControl.scss +0 -86
  108. package/styles/PulseLoader/_PulseLoader.scss +0 -60
  109. package/styles/Radio/_Radio.scss +0 -93
  110. package/styles/Select/_Select.scss +0 -94
  111. package/styles/Tabs/_Tabs.scss +0 -57
  112. package/styles/TextArea/_TextArea.scss +0 -26
  113. package/styles/TextInput/_TextInput.scss +0 -43
  114. package/styles/Tooltip/_Tooltip.scss +0 -108
  115. package/styles/_index.scss +0 -34
  116. package/styles/common/sass/_control-sizing.scss +0 -5
  117. package/styles/common/sass/_disable-scrolling.scss +0 -7
  118. package/styles/common/sass/_forms.scss +0 -72
  119. package/styles/index.js +0 -50
  120. package/styles/v1/components/Button/Button.jsx +0 -48
  121. package/styles/v1/components/Button/Button.spec.js +0 -76
  122. package/styles/v1/components/Button/_Button.scss +0 -178
  123. package/styles/v1/components/Button/button-props.js +0 -30
  124. package/styles/v1/components/Button/stories/button.js +0 -20
  125. package/styles/v1/components/Button/stories/index.stories.js +0 -92
  126. package/styles/v1/components/Button/stories/overview.js +0 -87
  127. package/styles/v1/components/Button/stories/types.js +0 -31
  128. package/styles/v1/components/Image/Image.jsx +0 -175
  129. package/styles/v1/components/Image/Image.spec.js +0 -113
  130. package/styles/v1/components/Image/_Image.scss +0 -24
  131. package/styles/v1/components/Image/stories/Cloudinary.stories.js +0 -39
  132. package/styles/v1/components/Image/stories/Display.stories.js +0 -92
  133. package/styles/v1/components/Loader/Loader.jsx +0 -54
  134. package/styles/v1/components/Loader/Loader.spec.js +0 -67
  135. package/styles/v1/components/Loader/_Loader.scss +0 -18
  136. package/styles/v1/components/Loader/stories/Display.stories.js +0 -55
  137. package/styles/v1/components/Modal/Modal.jsx +0 -315
  138. package/styles/v1/components/Modal/Modal.spec.js +0 -293
  139. package/styles/v1/components/Modal/ModalContent.jsx +0 -126
  140. package/styles/v1/components/Modal/ModalFooter.jsx +0 -53
  141. package/styles/v1/components/Modal/_Modal.scss +0 -262
  142. package/styles/v1/components/Modal/index.js +0 -3
  143. package/styles/v1/components/Modal/stories/Content.stories.js +0 -314
  144. package/styles/v1/components/Modal/stories/Display.stories.js +0 -208
  145. package/styles/v1/components/Modal/stories/Methods.stories.js +0 -44
  146. package/styles/v1/components/Modal/stories/Width.stories.js +0 -82
  147. package/styles/v1/components/Modal/stories/helpers/ReduxConsumer.jsx +0 -21
  148. package/styles/v1/components/Panel/Panel.jsx +0 -202
  149. package/styles/v1/components/Panel/Panel.spec.js +0 -196
  150. package/styles/v1/components/Panel/_Panel.scss +0 -55
  151. package/styles/v1/components/Panel/stories/Display.stories.js +0 -82
  152. package/styles/v1/components/Panel/stories/Methods.stories.js +0 -76
  153. package/styles/v1/components/Table/Table.jsx +0 -367
  154. package/styles/v1/components/Table/Table.spec.js +0 -526
  155. package/styles/v1/components/Table/TableCell.jsx +0 -17
  156. package/styles/v1/components/Table/TableCellPropTypes.js +0 -10
  157. package/styles/v1/components/Table/TableControls.jsx +0 -61
  158. package/styles/v1/components/Table/TableFooter.jsx +0 -72
  159. package/styles/v1/components/Table/TableHeading.jsx +0 -58
  160. package/styles/v1/components/Table/TableHeadingPropTypes.js +0 -20
  161. package/styles/v1/components/Table/TableSortSelector.jsx +0 -63
  162. package/styles/v1/components/Table/TableSortType.js +0 -4
  163. package/styles/v1/components/Table/_Table.scss +0 -263
  164. package/styles/v1/components/Table/index.js +0 -5
  165. package/styles/v1/components/Table/stories/Display.stories.js +0 -194
  166. package/styles/v1/components/Table/stories/Methods.stories.js +0 -141
  167. package/styles/v1/components/Table/stories/helpers/TableCellEmail.jsx +0 -25
  168. package/styles/v1/components/Table/stories/helpers/TableCustomRow.jsx +0 -35
  169. package/styles/v1/components/Table/stories/helpers/TableHeadingEmail.jsx +0 -20
  170. package/styles/v1/components/Table/stories/helpers/table-data.js +0 -26
  171. package/styles/v1/components/Table/stories/helpers/table-headers.js +0 -14
  172. package/styles/v1/components/TextButton/TextButton.jsx +0 -78
  173. package/styles/v1/components/TextButton/TextButton.spec.js +0 -95
  174. package/styles/v1/components/TextButton/_TextButton.scss +0 -114
  175. package/styles/v1/components/TextButton/stories/Display.stories.js +0 -46
  176. package/styles/v1/components/index.js +0 -7
  177. package/styles/v1/utils/deprecate.js +0 -45
  178. package/styles/v2/components/Accordion/Accordion.jsx +0 -1
  179. package/styles/v2/components/Accordion/Accordion.stories.js +0 -103
  180. package/styles/v2/components/Accordion/index.js +0 -7
  181. package/styles/v2/components/Accordion/styles/button.js +0 -16
  182. package/styles/v2/components/Accordion/styles/container.js +0 -9
  183. package/styles/v2/components/Accordion/styles/index.js +0 -19
  184. package/styles/v2/components/Accordion/styles/panel.js +0 -7
  185. package/styles/v2/components/Alert/Alert.jsx +0 -121
  186. package/styles/v2/components/Alert/Alert.stories.js +0 -50
  187. package/styles/v2/components/Alert/index.js +0 -1
  188. package/styles/v2/components/Alert/styles/index.js +0 -166
  189. package/styles/v2/components/AutoSuggestSelect/AutoSuggestSelect.jsx +0 -187
  190. package/styles/v2/components/AutoSuggestSelect/index.js +0 -1
  191. package/styles/v2/components/Badge/Badge.jsx +0 -1
  192. package/styles/v2/components/Badge/Badge.stories.js +0 -32
  193. package/styles/v2/components/Badge/styles/index.js +0 -29
  194. package/styles/v2/components/Button/Button.jsx +0 -31
  195. package/styles/v2/components/Button/Button.spec.js +0 -29
  196. package/styles/v2/components/Button/Button.styles.js +0 -156
  197. package/styles/v2/components/Button/button-props.js +0 -66
  198. package/styles/v2/components/Button/index.js +0 -2
  199. package/styles/v2/components/Button/stories/button.js +0 -59
  200. package/styles/v2/components/Button/stories/index.stories.js +0 -82
  201. package/styles/v2/components/Button/stories/overview.js +0 -73
  202. package/styles/v2/components/Card/Card.jsx +0 -16
  203. package/styles/v2/components/Card/Card.stories.js +0 -33
  204. package/styles/v2/components/Checkbox/Checkbox.jsx +0 -1
  205. package/styles/v2/components/Checkbox/Checkbox.stories.js +0 -41
  206. package/styles/v2/components/Checkbox/index.js +0 -1
  207. package/styles/v2/components/Checkbox/styles/index.js +0 -31
  208. package/styles/v2/components/Container/Container.jsx +0 -10
  209. package/styles/v2/components/Container/Container.stories.js +0 -52
  210. package/styles/v2/components/Container/Container.styles.js +0 -11
  211. package/styles/v2/components/Divider/Divider.jsx +0 -31
  212. package/styles/v2/components/Divider/Divider.stories.js +0 -41
  213. package/styles/v2/components/Divider/Divider.styles.js +0 -15
  214. package/styles/v2/components/FormControl/FormControl.jsx +0 -77
  215. package/styles/v2/components/Grid/Grid.jsx +0 -25
  216. package/styles/v2/components/Grid/Grid.stories.js +0 -128
  217. package/styles/v2/components/Grid/Grid.styles.js +0 -12
  218. package/styles/v2/components/Grid/GridItem.jsx +0 -10
  219. package/styles/v2/components/Grid/GridItem.styles.js +0 -8
  220. package/styles/v2/components/Grid/index.js +0 -2
  221. package/styles/v2/components/Heading/Heading.jsx +0 -23
  222. package/styles/v2/components/Heading/Heading.stories.js +0 -40
  223. package/styles/v2/components/Heading/Heading.styles.js +0 -61
  224. package/styles/v2/components/Icon/Icon.jsx +0 -1
  225. package/styles/v2/components/Icon/Icon.stories.js +0 -38
  226. package/styles/v2/components/Image/Image.jsx +0 -97
  227. package/styles/v2/components/Image/Image.spec.js +0 -100
  228. package/styles/v2/components/Image/Image.stories.js +0 -142
  229. package/styles/v2/components/Input/Input.jsx +0 -51
  230. package/styles/v2/components/Input/Input.stories.js +0 -60
  231. package/styles/v2/components/Input/index.js +0 -1
  232. package/styles/v2/components/Input/styles/index.js +0 -49
  233. package/styles/v2/components/Link/Link.jsx +0 -1
  234. package/styles/v2/components/Link/Link.stories.js +0 -82
  235. package/styles/v2/components/Link/Link.styles.js +0 -38
  236. package/styles/v2/components/List/List.jsx +0 -57
  237. package/styles/v2/components/List/List.stories.js +0 -96
  238. package/styles/v2/components/List/index.js +0 -2
  239. package/styles/v2/components/List/styles/index.js +0 -12
  240. package/styles/v2/components/List/styles/item.styles.js +0 -5
  241. package/styles/v2/components/Loader/Loader.jsx +0 -75
  242. package/styles/v2/components/Loader/Loader.stories.js +0 -145
  243. package/styles/v2/components/Modal/Modal.jsx +0 -71
  244. package/styles/v2/components/Modal/Modal.stories.js +0 -278
  245. package/styles/v2/components/Modal/index.js +0 -1
  246. package/styles/v2/components/Modal/styles/body.js +0 -24
  247. package/styles/v2/components/Modal/styles/closeButton.js +0 -17
  248. package/styles/v2/components/Modal/styles/dialog.js +0 -10
  249. package/styles/v2/components/Modal/styles/dialogContainer.js +0 -10
  250. package/styles/v2/components/Modal/styles/footer.js +0 -5
  251. package/styles/v2/components/Modal/styles/header.js +0 -7
  252. package/styles/v2/components/Modal/styles/index.js +0 -47
  253. package/styles/v2/components/Modal/styles/overlay.js +0 -4
  254. package/styles/v2/components/Popover/Popover.jsx +0 -28
  255. package/styles/v2/components/Popover/Popover.stories.js +0 -113
  256. package/styles/v2/components/Popover/PopoverArrow.jsx +0 -10
  257. package/styles/v2/components/Popover/PopoverCloseButton.jsx +0 -10
  258. package/styles/v2/components/Popover/PopoverContent.jsx +0 -41
  259. package/styles/v2/components/Popover/index.js +0 -3
  260. package/styles/v2/components/Popover/styles/index.js +0 -21
  261. package/styles/v2/components/Popover/styles/popover-arrow.js +0 -5
  262. package/styles/v2/components/Popover/styles/popover-body.js +0 -5
  263. package/styles/v2/components/Popover/styles/popover-close-button.js +0 -17
  264. package/styles/v2/components/Popover/styles/popover-content.js +0 -16
  265. package/styles/v2/components/Popover/styles/popover-header.js +0 -6
  266. package/styles/v2/components/Popover/styles/popper.js +0 -5
  267. package/styles/v2/components/Radio/Radio.jsx +0 -50
  268. package/styles/v2/components/Radio/Radio.stories.js +0 -155
  269. package/styles/v2/components/Radio/RadioGroup.jsx +0 -69
  270. package/styles/v2/components/Radio/index.js +0 -2
  271. package/styles/v2/components/Radio/styles/index.js +0 -52
  272. package/styles/v2/components/Select/Select.jsx +0 -62
  273. package/styles/v2/components/Select/Select.stories.js +0 -60
  274. package/styles/v2/components/Select/index.js +0 -1
  275. package/styles/v2/components/Select/styles/index.js +0 -29
  276. package/styles/v2/components/Skeleton/Skeleton.stories.jsx +0 -34
  277. package/styles/v2/components/Skeleton/Skeleton.styles.js +0 -3
  278. package/styles/v2/components/Skeleton/index.js +0 -1
  279. package/styles/v2/components/Spinner/Spinner.jsx +0 -40
  280. package/styles/v2/components/Spinner/Spinner.stories.js +0 -98
  281. package/styles/v2/components/Spinner/Spinner.styles.js +0 -57
  282. package/styles/v2/components/Switch/Switch.jsx +0 -52
  283. package/styles/v2/components/Switch/Switch.stories.js +0 -88
  284. package/styles/v2/components/Switch/index.js +0 -1
  285. package/styles/v2/components/Switch/styles/index.js +0 -17
  286. package/styles/v2/components/Table/Table.jsx +0 -1
  287. package/styles/v2/components/Table/Table.stories.js +0 -90
  288. package/styles/v2/components/Table/Table.styles.js +0 -66
  289. package/styles/v2/components/Table/index.js +0 -2
  290. package/styles/v2/components/Tabs/Tabs.jsx +0 -39
  291. package/styles/v2/components/Tabs/Tabs.stories.js +0 -47
  292. package/styles/v2/components/Tabs/combineSizeWithVariant.js +0 -29
  293. package/styles/v2/components/Tabs/index.js +0 -2
  294. package/styles/v2/components/Tabs/styles/index.js +0 -40
  295. package/styles/v2/components/Text/Text.jsx +0 -35
  296. package/styles/v2/components/Text/Text.stories.js +0 -47
  297. package/styles/v2/components/Text/Text.styles.js +0 -33
  298. package/styles/v2/components/Text/combineAsWithVariant.js +0 -106
  299. package/styles/v2/components/Text/options.js +0 -92
  300. package/styles/v2/components/ThemeProvider/ThemeProvider.jsx +0 -39
  301. package/styles/v2/components/ThemeProvider/ThemeProvider.stories.js +0 -85
  302. package/styles/v2/components/index.js +0 -70
  303. package/styles/v2/components/styles.js +0 -21
  304. package/styles/v2/theme/base/breakpoints.js +0 -16
  305. package/styles/v2/theme/base/colors.js +0 -136
  306. package/styles/v2/theme/base/index.js +0 -5
  307. package/styles/v2/theme/base/sizes.js +0 -48
  308. package/styles/v2/theme/base/typography.js +0 -24
  309. package/styles/v2/theme/base/zindices.js +0 -17
  310. package/styles/v2/theme/global.js +0 -118
  311. package/styles/v2/theme/index.js +0 -27
  312. package/styles/v2/utils/Spaces.js +0 -16
  313. package/v1/assets-manifest.json +0 -5
  314. package/v1/index.html +0 -1
  315. package/v1/index.js +0 -3
  316. package/v1/index.js.LICENSE.txt +0 -23
  317. package/v1/index.js.map +0 -1
@@ -1,175 +0,0 @@
1
- import omit from 'lodash/omit';
2
- import template from 'lodash/template';
3
- import React, {Component} from 'react';
4
- import PropTypes from 'prop-types';
5
- import classNames from 'classnames';
6
- import LazyLoad from 'react-lazy-load';
7
- import EnvironmentUtils from '@spothero/utils/environment';
8
- import PulseLoader from '../../../PulseLoader/PulseLoader';
9
-
10
- export default class Image extends Component {
11
- static propTypes = {
12
- /** Additional class(es) to add to the component. */
13
- className: PropTypes.string,
14
- /** Whether to show the loader before the image is fully loaded. */
15
- showLoader: PropTypes.bool,
16
- /** Whether to use lazy loading for this image. */
17
- lazyLoad: PropTypes.bool,
18
- /** The offset from the bottom of the screen at which point the image gets lazy loaded when the page is scrolled to. */
19
- lazyLoadOffsetVertical: PropTypes.number,
20
- /** The Cloudinary account that this image is stored under. */
21
- cloudinaryCloudName: PropTypes.string,
22
- /** The image ID that is stored in Cloudinary for this image. Will be used to replace the source path. */
23
- cloudinaryImageId: PropTypes.string,
24
- /** The template URL to use to create the source path from. Replaceable values are {{WIDTH}}, {{HEIGHT}}, and {{QUALITY}}. */
25
- cloudinaryTemplate: PropTypes.string,
26
- /** The width of the image. Required if using a Cloudinary ID and highly suggested otherwise to help place the loader properly. */
27
- width: PropTypes.number,
28
- /** The height of the image. Required if using a Cloudinary ID and highly suggested otherwise to help place the loader properly. */
29
- height: PropTypes.number,
30
- /** The quality setting if this image uses a Cloudinary source ID. */
31
- quality: PropTypes.number,
32
- /** Optional function to execute when the image is loaded. */
33
- onLoad: PropTypes.func,
34
- };
35
- static defaultProps = {
36
- showLoader: true,
37
- lazyLoadOffsetVertical: 100,
38
- quality: 50,
39
- cloudinaryCloudName: 'spothero',
40
- };
41
-
42
- constructor(props) {
43
- super(props);
44
-
45
- const {cloudinaryImageId, cloudinaryTemplate} = props;
46
-
47
- this._imageProps = omit(props, [
48
- 'className',
49
- 'showLoader',
50
- 'lazyLoad',
51
- 'lazyLoadOffsetVertical',
52
- 'cloudinaryCloudName',
53
- 'cloudinaryImageId',
54
- 'cloudinaryTemplate',
55
- 'quality',
56
- 'onLoad',
57
- ]);
58
-
59
- this.state = {
60
- isLoaded: false,
61
- hasCloudinarySrc: !(cloudinaryImageId || cloudinaryTemplate),
62
- };
63
- }
64
-
65
- componentDidMount() {
66
- const {
67
- cloudinaryCloudName,
68
- cloudinaryTemplate,
69
- cloudinaryImageId,
70
- width,
71
- height,
72
- quality,
73
- } = this.props;
74
-
75
- if (cloudinaryImageId || cloudinaryTemplate) {
76
- // cloudinary image provided, create the source path
77
-
78
- if (this.isCloudinaryImageAndInvalid()) {
79
- return;
80
- }
81
-
82
- const tmpl = cloudinaryTemplate
83
- ? cloudinaryTemplate
84
- : `https://res.cloudinary.com/${cloudinaryCloudName}/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,fl_progressive,dpr_${
85
- EnvironmentUtils.isHighDensityDisplay() ? 2 : 1
86
- },h_$h,q_$q,w_$w/${cloudinaryImageId}`;
87
-
88
- this._imageProps.src = template(tmpl, {
89
- interpolate: /{{([\s\S]+?)}}/g, // matches template vars in the format '{{ var }}' or '{{var}}'
90
- })({
91
- WIDTH: width,
92
- HEIGHT: height,
93
- QUALITY: quality,
94
- });
95
-
96
- // eslint-disable-next-line react/no-did-mount-set-state
97
- this.setState({
98
- hasCloudinarySrc: true,
99
- });
100
- }
101
- }
102
-
103
- _onLoaded = evt => {
104
- const {onLoad} = this.props;
105
-
106
- this.setState({
107
- isLoaded: true,
108
- });
109
-
110
- if (onLoad) {
111
- onLoad(evt);
112
- }
113
- };
114
-
115
- isCloudinaryImageAndInvalid = () => {
116
- const {
117
- cloudinaryImageId,
118
- cloudinaryTemplate,
119
- width,
120
- height,
121
- } = this.props;
122
-
123
- return (cloudinaryImageId || cloudinaryTemplate) && (!width || !height);
124
- };
125
-
126
- _renderImage() {
127
- const {className, width, height, showLoader} = this.props;
128
- const {isLoaded} = this.state;
129
- const classes = classNames(className, 'Image-container');
130
- const imgClasses = classNames('Image', {
131
- 'Image-loaded': isLoaded,
132
- });
133
-
134
- return (
135
- <div
136
- className={classes}
137
- style={{maxWidth: width, maxHeight: height}}
138
- >
139
- {showLoader && !isLoaded && (
140
- <PulseLoader size={32} borderWidth={2} />
141
- )}
142
- <img
143
- {...this._imageProps}
144
- className={imgClasses}
145
- onLoad={this._onLoaded}
146
- />
147
- </div>
148
- );
149
- }
150
-
151
- render() {
152
- const {lazyLoad, lazyLoadOffsetVertical} = this.props;
153
- const {hasCloudinarySrc} = this.state;
154
-
155
- // the source is set after component is mounted in the case of Cloudinary images otherwise there are mis-matching
156
- // DPR attributes in the url since node will always set the DPR to 1 and high density displays will have it set to 2+.
157
- if (!hasCloudinarySrc) {
158
- return null;
159
- }
160
-
161
- if (this.isCloudinaryImageAndInvalid()) {
162
- return null;
163
- }
164
-
165
- if (lazyLoad) {
166
- return (
167
- <LazyLoad offsetVertical={lazyLoadOffsetVertical}>
168
- {this._renderImage()}
169
- </LazyLoad>
170
- );
171
- }
172
-
173
- return this._renderImage();
174
- }
175
- }
@@ -1,113 +0,0 @@
1
- describe('<Image />', () => {
2
- context('Display', () => {
3
- context('Default', () => {
4
- beforeEach(() => {
5
- cy.visitStory('v1/Image/Display', 'Default', {
6
- onBeforeLoad: contentWindow => {
7
- contentWindow.onImageLoaded = evt => {
8
- console.log('image loaded'); // eslint-disable-line no-console
9
- };
10
-
11
- cy.stub(contentWindow, 'onImageLoaded').as(
12
- 'imageLoaded'
13
- );
14
- },
15
- });
16
- });
17
-
18
- it('Renders properly and passes props through', () => {
19
- cy.get('.Image')
20
- .should('have.class', 'Image-loaded')
21
- .should('have.attr', 'alt', 'Placeholder image');
22
- });
23
-
24
- it('Calls onLoad() properly', () => {
25
- cy.get('@imageLoaded')
26
- .should('be.called')
27
- .get('.Image')
28
- .should('have.class', 'Image-loaded');
29
- });
30
- });
31
-
32
- context('Lazy Load', () => {
33
- it('Lazy loads when the image comes into view', () => {
34
- cy.visitStory('v1/Image/Display', 'LazyLoad', {
35
- onBeforeLoad: contentWindow => {
36
- contentWindow.onImageLoaded = evt => {
37
- console.log('image loaded'); // eslint-disable-line no-console
38
- };
39
-
40
- cy.stub(contentWindow, 'onImageLoaded').as(
41
- 'imageLoaded'
42
- );
43
- },
44
- })
45
- .get('@imageLoaded')
46
- .should('not.be.called')
47
- .get('.Image')
48
- .should('not.exist')
49
- .get('.LazyLoad')
50
- .should('not.have.class', 'is-visible')
51
- .get('.LazyLoad')
52
- .scrollIntoView()
53
- .should('have.class', 'is-visible')
54
- .get('.Image')
55
- .should('exist')
56
- .get('@imageLoaded')
57
- .should('be.called');
58
- });
59
- });
60
- });
61
-
62
- context('Cloudinary', () => {
63
- context('Source ID', () => {
64
- it('Renders properly using a Cloudinary image source ID', () => {
65
- cy.visitStory('v1/Image/Cloudinary', 'SourceId')
66
- .get('.Image-container')
67
- .should('have.class', 'Image-hertz')
68
- .get('.Image')
69
- .should('have.class', 'Image-loaded')
70
- .should('have.attr', 'alt', 'Cloudinary source ID')
71
- .should('have.attr', 'width', '186')
72
- .should('have.attr', 'height', '76')
73
- .should('have.attr', 'src')
74
- .then(src => {
75
- expect(src).to.contain('res.cloudinary.com/spothero/');
76
- expect(src).to.contain('c_fill');
77
- expect(src).to.contain('f_auto');
78
- expect(src).to.contain('fl_progressive');
79
- expect(src).to.contain('q_50');
80
- });
81
- });
82
- });
83
-
84
- context('Template', () => {
85
- it('Renders properly using a provided template', () => {
86
- cy.visitStory('v1/Image/Cloudinary', 'Template')
87
- .get('.Image')
88
- .should('have.class', 'Image-loaded')
89
- .should('have.attr', 'alt', 'Cloudinary template')
90
- .should('have.attr', 'width', '132')
91
- .should('have.attr', 'height', '111')
92
- .should('have.attr', 'src')
93
- .then(src => {
94
- expect(src).to.contain('res.cloudinary.com/spothero/');
95
- expect(src).to.contain('c_fill');
96
- expect(src).to.contain('f_auto');
97
- expect(src).to.contain('w_132');
98
- expect(src).to.contain('h_111');
99
- expect(src).to.contain('q_100');
100
- expect(src).to.contain('html-emails/google');
101
- });
102
- });
103
- });
104
-
105
- context('Dimensions Error', () => {
106
- it('Does not render if width or height props are not passed', () => {
107
- cy.visitStory('v1/Image/Cloudinary', 'DimensionsError')
108
- .get('.Image')
109
- .should('not.exist');
110
- });
111
- });
112
- });
113
- });
@@ -1,24 +0,0 @@
1
- .Image-container {
2
- position: relative;
3
- display: inline-block;
4
- width: 100%;
5
- height: 100%;
6
- vertical-align: middle;
7
-
8
- .PulseLoader {
9
- position: absolute;
10
- top: 0;
11
- left: 0;
12
- width: 100%;
13
- height: 100%;
14
- }
15
-
16
- .PulseLoader-pulse {
17
- @include center;
18
- }
19
- }
20
-
21
- .Image {
22
- width: 100%;
23
- height: 100%;
24
- }
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import Image from '../Image';
3
-
4
- export default {
5
- component: Image,
6
- title: 'v1/Image/Cloudinary',
7
- };
8
-
9
- export const SourceId = () => {
10
- return (
11
- <Image
12
- className="Image-hertz"
13
- cloudinaryImageId="html-emails/partner-hertz"
14
- width={186}
15
- height={76}
16
- alt="Cloudinary source ID"
17
- onLoad={window.onImageLoaded} // eslint-disable-line react/jsx-handler-names
18
- />
19
- );
20
- };
21
-
22
- export const Template = () => {
23
- return (
24
- <Image
25
- cloudinaryTemplate="https://res.cloudinary.com/spothero/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,h_$h,q_$q,w_$w/html-emails/google"
26
- width={132}
27
- height={111}
28
- quality={100}
29
- alt="Cloudinary template"
30
- onLoad={window.onImageLoaded} // eslint-disable-line react/jsx-handler-names
31
- />
32
- );
33
- };
34
-
35
- export const DimensionsError = () => {
36
- return (
37
- <Image cloudinaryTemplate="https://res.cloudinary.com/spothero/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,h_$h,q_$q,w_$w/html-emails/google" />
38
- );
39
- };
@@ -1,92 +0,0 @@
1
- import React from 'react';
2
- import Image from '../Image';
3
-
4
- export default {
5
- component: Image,
6
- title: 'v1/Image/Display',
7
- };
8
-
9
- export const Default = () => {
10
- return (
11
- <Image
12
- src="http://placehold.it/350x200"
13
- width={350}
14
- height={200}
15
- alt="Placeholder image"
16
- onLoad={window.onImageLoaded} // eslint-disable-line react/jsx-handler-names
17
- />
18
- );
19
- };
20
-
21
- export const LazyLoad = () => {
22
- return (
23
- <>
24
- <p>Scroll down to see lazy loaded image in action...</p>
25
- <br />
26
- <br />
27
- <br />
28
- <br />
29
- <br />
30
- <br />
31
- <br />
32
- <br />
33
- <br />
34
- <br />
35
- <br />
36
- <br />
37
- <br />
38
- <br />
39
- <br />
40
- <br />
41
- <br />
42
- <br />
43
- <br />
44
- <br />
45
- <br />
46
- <br />
47
- <br />
48
- <br />
49
- <br />
50
- <br />
51
- <br />
52
- <br />
53
- <br />
54
- <br />
55
- <br />
56
- <br />
57
- <br />
58
- <br />
59
- <br />
60
- <br />
61
- <br />
62
- <br />
63
- <br />
64
- <br />
65
- <br />
66
- <br />
67
- <br />
68
- <br />
69
- <br />
70
- <br />
71
- <br />
72
- <br />
73
- <br />
74
- <br />
75
- <br />
76
- <br />
77
- <br />
78
- <br />
79
- <br />
80
- <br />
81
- <br />
82
- <br />
83
- <br />
84
- <br />
85
- <Image
86
- src="http://placehold.it/350x200"
87
- lazyLoad
88
- onLoad={window.onImageLoaded} // eslint-disable-line react/jsx-handler-names
89
- />
90
- </>
91
- );
92
- };
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
-
5
- import deprecate from 'v1/utils/deprecate';
6
-
7
- deprecate({
8
- name: 'Loader',
9
- newName: 'Loader',
10
- changes: [
11
- '---- Changes in v2 component ----',
12
- '`borderWidth` is now `thickness`',
13
- '`additionalMarkup` is no longer supported within this component',
14
- '`className` is no longer explicitly supported, but a custom class could still be passed in if needed, but with the move to ChakraUI custom classes are generally not needed',
15
- '---- Additional Information ----',
16
- 'new props are documented at: https://chakra-ui.com/docs/feedback/circular-progress',
17
- ],
18
- });
19
-
20
- const Loader = ({className, size, borderWidth, additionalMarkup, ...attrs}) => {
21
- const classes = classNames('Loader', className);
22
-
23
- return (
24
- <div className={classes} {...attrs}>
25
- <div
26
- className="Loader-spinner"
27
- style={{
28
- width: size,
29
- height: size,
30
- borderWidth,
31
- }}
32
- />
33
- {additionalMarkup}
34
- </div>
35
- );
36
- };
37
-
38
- Loader.propTypes = {
39
- /** Additional class(es) to add to the component. */
40
- className: PropTypes.string,
41
- /** The diameter of the circle spinner. */
42
- size: PropTypes.number,
43
- /** The width of the border of the circle spinner. */
44
- borderWidth: PropTypes.number,
45
- /** Additional markup to place below the loading spinner. */
46
- additionalMarkup: PropTypes.node,
47
- };
48
-
49
- Loader.defaultProps = {
50
- size: 80,
51
- borderWidth: 4,
52
- };
53
-
54
- export default Loader;
@@ -1,67 +0,0 @@
1
- describe('<Loader />', () => {
2
- context('Display', () => {
3
- context('Default', () => {
4
- it('Has default size and border-width', () => {
5
- cy.visitStory('v1/Loader/Display', 'Default')
6
- .get('.Loader-spinner')
7
- .should('have.css', 'width', '80px')
8
- .and('have.css', 'height', '80px')
9
- .and('have.css', 'border-width', '4px');
10
- });
11
- });
12
-
13
- context('Size', () => {
14
- it('Has height and width determined by size prop, and default border-width', () => {
15
- cy.visitStory('v1/Loader/Display', 'Size')
16
- .get('.Loader-spinner')
17
- .should('have.css', 'width', '300px')
18
- .and('have.css', 'height', '300px')
19
- .and('have.css', 'border-width', '4px');
20
- });
21
- });
22
-
23
- context('Border Width', () => {
24
- it('Has border-width determined by border-width prop, and default height/width', () => {
25
- cy.visitStory('v1/Loader/Display', 'BorderWidth')
26
- .get('.Loader-spinner')
27
- .should('have.css', 'border-width', '25px')
28
- .and('have.css', 'width', '80px')
29
- .and('have.css', 'height', '80px');
30
- });
31
- });
32
-
33
- context('Additional Markup', () => {
34
- it('Displays additional markup (nodes) that was passed in', () => {
35
- cy.visitStory('v1/Loader/Display', 'AdditionalMarkup')
36
- .get('.Loader')
37
- .contains('Here is some additional markup')
38
- .get('.Loader')
39
- .find('h1')
40
- .find('span');
41
- });
42
-
43
- it('Displays additional markup (text) that was passed in', () => {
44
- cy.visitStory('v1/Loader/Display', 'AdditionalMarkupText')
45
- .get('.Loader')
46
- .contains('Just add text!');
47
- });
48
- });
49
-
50
- context('Custom Classes', () => {
51
- it('Applies custom classes to loader', () => {
52
- cy.visitStory('v1/Loader/Display', 'CustomClass')
53
- .get('.Loader')
54
- .should('have.class', 'custom-class1')
55
- .and('have.class', 'custom-class2');
56
- });
57
- });
58
-
59
- context('Custom Props', () => {
60
- it('Applies custom props to loader', () => {
61
- cy.visitStory('v1/Loader/Display', 'CustomProps')
62
- .get('.Loader')
63
- .should('have.attr', 'role', 'status');
64
- });
65
- });
66
- });
67
- });
@@ -1,18 +0,0 @@
1
- @keyframes load8 {
2
- 0% {
3
- transform: rotate(0deg);
4
- }
5
- 100% {
6
- transform: rotate(360deg);
7
- }
8
- }
9
-
10
- .Loader-spinner {
11
- border-top: 4px solid $color-dashboard;
12
- border-right: 4px solid $color-dashboard;
13
- border-bottom: 4px solid $color-go;
14
- border-left: 4px solid $color-go;
15
- border-radius: 50%;
16
- transform: translateZ(0);
17
- animation: load8 1.1s infinite linear;
18
- }
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- import Loader from '../Loader';
3
-
4
- export default {
5
- component: Loader,
6
- title: 'v1/Loader/Display',
7
- };
8
-
9
- export const Default = () => {
10
- return <Loader />;
11
- };
12
-
13
- export const AdditionalMarkup = () => {
14
- return (
15
- <Loader
16
- additionalMarkup={
17
- <h1>
18
- Here is some <span>additional markup</span>
19
- </h1>
20
- }
21
- />
22
- );
23
- };
24
-
25
- export const AdditionalMarkupText = () => {
26
- return <Loader additionalMarkup="Just add text!" />;
27
- };
28
-
29
- export const BorderWidth = () => {
30
- return <Loader borderWidth={25} />;
31
- };
32
-
33
- export const CustomClass = () => {
34
- return (
35
- <Loader
36
- className="custom-class1 custom-class2"
37
- size={30}
38
- borderWidth={5}
39
- additionalMarkup="I have custom classes"
40
- />
41
- );
42
- };
43
-
44
- export const Size = () => {
45
- return <Loader size={300} />;
46
- };
47
-
48
- export const CustomProps = () => {
49
- return (
50
- <Loader
51
- role="status"
52
- additionalMarkup="I support passing in custom attributes"
53
- />
54
- );
55
- };