@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,97 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {Image as ChakraImage, Img as ChakraImg} from '@chakra-ui/react';
4
- import EnvironmentUtils from '@spothero/utils/environment';
5
- import template from 'lodash/template';
6
-
7
- const buildCloudinarySrc = ({
8
- cloudinaryImageId,
9
- cloudinaryTemplate,
10
- cloudinaryCloudName,
11
- htmlWidth,
12
- htmlHeight,
13
- quality,
14
- }) => {
15
- const defaultTemplate = `https://res.cloudinary.com/${cloudinaryCloudName}/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,fl_progressive,dpr_${
16
- EnvironmentUtils.isHighDensityDisplay() ? 2 : 1
17
- },h_$h,q_$q,w_$w/${cloudinaryImageId}`;
18
- const tmpl = cloudinaryTemplate ? cloudinaryTemplate : defaultTemplate;
19
-
20
- return template(tmpl, {
21
- interpolate: /{{([\s\S]+?)}}/g, // matches template vars in the format '{{ var }}' or '{{var}}'
22
- })({
23
- WIDTH: htmlWidth,
24
- HEIGHT: htmlHeight,
25
- QUALITY: quality,
26
- });
27
- };
28
-
29
- const Image = ({
30
- isSSR,
31
- cloudinaryImageId,
32
- cloudinaryTemplate,
33
- cloudinaryCloudName,
34
- htmlWidth,
35
- htmlHeight,
36
- quality,
37
- lazyLoad,
38
- ...otherProps
39
- }) => {
40
- const hasValidCloudinarySrc =
41
- (cloudinaryImageId || cloudinaryTemplate) &&
42
- Boolean(htmlWidth) &&
43
- Boolean(htmlHeight);
44
- let cloudinarySrc;
45
-
46
- if (hasValidCloudinarySrc) {
47
- cloudinarySrc = buildCloudinarySrc({
48
- cloudinaryImageId,
49
- cloudinaryTemplate,
50
- cloudinaryCloudName,
51
- htmlWidth,
52
- htmlHeight,
53
- quality,
54
- });
55
- }
56
-
57
- const imageProps = {
58
- ...otherProps,
59
- src: cloudinarySrc || otherProps.src,
60
- htmlWidth,
61
- htmlHeight,
62
- ...(lazyLoad && {loading: 'lazy'}),
63
- };
64
-
65
- if (isSSR) {
66
- return <ChakraImg {...imageProps} />;
67
- } else {
68
- return <ChakraImage {...imageProps} />;
69
- }
70
- };
71
-
72
- Image.propTypes = {
73
- /** If true, use the image directly without client side checks. */
74
- isSSR: PropTypes.bool,
75
- /** The Cloudinary account that this image is stored under. */
76
- cloudinaryCloudName: PropTypes.string,
77
- /** The image ID that is stored in Cloudinary for this image. Will be used to replace the source path. */
78
- cloudinaryImageId: PropTypes.string,
79
- /** The template URL to use to create the source path from. Replaceable values are {{WIDTH}}, {{HEIGHT}}, and {{QUALITY}}. */
80
- cloudinaryTemplate: PropTypes.string,
81
- /** The width of the native HTML image, in pixels. Required if using a Cloudinary ID or Template. */
82
- htmlWidth: PropTypes.number,
83
- /** The height of the native HTML image, in pixels. Required if using a Cloudinary ID or Template. */
84
- htmlHeight: PropTypes.number,
85
- /** The quality setting if this image uses a Cloudinary ID or Template. */
86
- quality: PropTypes.number,
87
- /** Whether to use lazy loading for this image. */
88
- lazyLoad: PropTypes.bool,
89
- };
90
-
91
- Image.defaultProps = {
92
- isSSR: false,
93
- quality: 50,
94
- cloudinaryCloudName: 'spothero',
95
- };
96
-
97
- export default Image;
@@ -1,100 +0,0 @@
1
- import React from 'react';
2
- import {render as rtlRender, screen, waitFor} from '@testing-library/react';
3
- import Image from './Image';
4
-
5
- const defaultSrc = 'http://placehold.it/350x200';
6
-
7
- const render = props => {
8
- rtlRender(<Image {...props} />);
9
- };
10
-
11
- describe('Image', () => {
12
- describe('basic behavior', () => {
13
- it('displays an image', () => {
14
- render({
15
- src: defaultSrc,
16
- alt: 'An image',
17
- });
18
-
19
- waitFor(() => {
20
- expect(screen.getByRole('img')).toHaveAttribute(
21
- 'src',
22
- defaultSrc
23
- );
24
- });
25
- });
26
-
27
- it('displays an image (SSR)', () => {
28
- render({
29
- src: defaultSrc,
30
- alt: 'An image',
31
- isSSR: true,
32
- });
33
-
34
- expect(screen.getByRole('img')).toHaveAttribute('src', defaultSrc);
35
- });
36
- });
37
-
38
- describe('Cloudinary properties', () => {
39
- it('correctly sets image src when a Cloudinary image template is passed in', () => {
40
- render({
41
- cloudinaryTemplate:
42
- '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',
43
- htmlWidth: 250,
44
- htmlHeight: 500,
45
- quality: 75,
46
- alt: 'An image',
47
- });
48
- waitFor(() => {
49
- expect(screen.getByRole('img')).toHaveAttribute(
50
- 'src',
51
- 'https://res.cloudinary.com/spothero/image/upload/$w_250,$h_500,$q_75/c_fill,f_auto,h_$h,q_$q,w_$w/html-emails/google'
52
- );
53
- });
54
- });
55
-
56
- it('correctly sets image src when a Cloudinary image id is passed in', () => {
57
- render({
58
- cloudinaryImageId: 'html-emails/partner-hertz',
59
- htmlWidth: 250,
60
- htmlHeight: 500,
61
- alt: 'An image',
62
- isSSR: true,
63
- });
64
-
65
- expect(screen.getByRole('img')).toHaveAttribute(
66
- 'src',
67
- 'https://res.cloudinary.com/spothero/image/upload/$w_250,$h_500,$q_50/c_fill,f_auto,fl_progressive,dpr_1,h_$h,q_$q,w_$w/html-emails/partner-hertz'
68
- );
69
- });
70
-
71
- it('does not set in image src when invalid set of Cloudinary props is passed in', () => {
72
- render({
73
- cloudinaryImageId: 'html-emails/partner-hertz',
74
- alt: 'An image',
75
- isSSR: true,
76
- });
77
-
78
- waitFor(() => {
79
- expect(screen.getByRole('img')).not.toHaveAttribute('src');
80
- });
81
- });
82
- });
83
-
84
- describe('Lazy loading', () => {
85
- it('correctly sets image loading attribute to lazy when lazyLoad prop is true', () => {
86
- render({
87
- src: defaultSrc,
88
- alt: 'An image',
89
- lazyLoad: true,
90
- });
91
-
92
- waitFor(() => {
93
- expect(screen.getByRole('img')).toHaveAttribute(
94
- 'loading',
95
- 'lazy'
96
- );
97
- });
98
- });
99
- });
100
- });
@@ -1,142 +0,0 @@
1
- import React from 'react';
2
- import Component from './Image';
3
-
4
- export default {
5
- title: 'v2/Image',
6
- component: Component,
7
- parameters: {
8
- removeBaseHtmlClass: true,
9
- importBy: 'Image',
10
- },
11
- };
12
-
13
- const Template = props => <Component {...props} />;
14
- const LazyLoadTemplate = props => (
15
- <>
16
- <p>Scroll down to see lazy loaded image in action...</p>
17
- <br />
18
- <br />
19
- <br />
20
- <br />
21
- <br />
22
- <br />
23
- <br />
24
- <br />
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
- <Component {...props} />
78
- </>
79
- );
80
-
81
- export const DefaultImage = Template.bind({});
82
- DefaultImage.args = {
83
- src: 'http://placehold.it/350x200',
84
- width: 350,
85
- height: 200,
86
- alt: 'Placeholder image',
87
- };
88
-
89
- export const StyledImage = Template.bind({});
90
- StyledImage.args = {
91
- src: 'http://placehold.it/350x200',
92
- alt: 'Placeholder image',
93
- padding: 4,
94
- borderColor: 'green.default',
95
- borderWidth: '1px',
96
- borderStyle: 'solid',
97
- height: {
98
- base: 'auto',
99
- tablet: 52,
100
- },
101
- width: {
102
- base: 'auto',
103
- tablet: 52,
104
- },
105
- };
106
-
107
- export const SSRImg = Template.bind({});
108
- SSRImg.args = {
109
- src: 'http://placehold.it/350x200',
110
- width: 350,
111
- height: 200,
112
- alt: 'SSR image',
113
- };
114
-
115
- export const CloudinaryImageId = Template.bind({});
116
- CloudinaryImageId.args = {
117
- cloudinaryImageId: 'html-emails/partner-hertz',
118
- htmlWidth: 186,
119
- htmlHeight: 76,
120
- quality: 50,
121
- alt: 'Cloudinary image ID',
122
- };
123
-
124
- export const CloudinaryImageTemplate = Template.bind({});
125
- CloudinaryImageTemplate.args = {
126
- cloudinaryTemplate:
127
- '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',
128
- htmlWidth: 132,
129
- htmlHeight: 111,
130
- quality: 80,
131
- alt: 'Cloudinary image template',
132
- };
133
-
134
- export const LazyLoadImage = LazyLoadTemplate.bind({});
135
- LazyLoadImage.args = {
136
- src:
137
- 'https://res.cloudinary.com/spothero/image/upload/$w_1024,$h_704,$q_50/c_fill,f_auto,h_$h,q_$q,w_$w,x_375,y_250/v1577978927/rzm2xqhtgqxfv3isxmyy.jpg',
138
- width: 350,
139
- height: 200,
140
- alt: 'Placeholder image',
141
- lazyLoad: true,
142
- };
@@ -1,51 +0,0 @@
1
- import React, {forwardRef} from 'react';
2
- import cn from 'classnames';
3
- import PropTypes from 'prop-types';
4
- import {Input as ChakraInput} from '@chakra-ui/react';
5
- import FormControl from '../FormControl/FormControl';
6
-
7
- const Input = forwardRef(
8
- (
9
- {
10
- label,
11
- helperText,
12
- errorMessage,
13
- isInvalid,
14
- isDisabled,
15
- isRequired,
16
- isOptional,
17
- ...props
18
- },
19
- ref
20
- ) => {
21
- const classes = cn({'FormElement-contains-error': isInvalid});
22
-
23
- return (
24
- <FormControl
25
- isInvalid={isInvalid}
26
- isDisabled={isDisabled}
27
- isRequired={isRequired}
28
- isOptional={isOptional}
29
- errorMessage={errorMessage}
30
- helperText={helperText}
31
- label={label}
32
- inputId={props.id}
33
- >
34
- <ChakraInput ref={ref} className={classes} {...props} />
35
- </FormControl>
36
- );
37
- }
38
- );
39
-
40
- Input.propTypes = {
41
- id: PropTypes.string.isRequired,
42
- label: PropTypes.string,
43
- helperText: PropTypes.string,
44
- errorMessage: PropTypes.string,
45
- isInvalid: PropTypes.bool,
46
- isDisabled: PropTypes.bool,
47
- isRequired: PropTypes.bool,
48
- isOptional: PropTypes.bool,
49
- };
50
-
51
- export default Input;
@@ -1,60 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- import Component from './Input';
5
- import {useTheme} from '@chakra-ui/react';
6
-
7
- export default {
8
- title: 'v2/Input',
9
- component: Component,
10
- parameters: {
11
- importBy: 'Input',
12
- removeBaseHtmlClass: true,
13
- chakraLink: 'https://chakra-ui.com/docs/components/input',
14
- },
15
- };
16
-
17
- const InputTemplate = props => (
18
- <Component variant="outline" maxWidth="200px" {...props} />
19
- );
20
-
21
- InputTemplate.propTypes = {
22
- placeholder: PropTypes.string,
23
- label: PropTypes.string,
24
- helperText: PropTypes.string,
25
- errorMessage: PropTypes.string,
26
- isInvalid: PropTypes.bool,
27
- isDisabled: PropTypes.bool,
28
- isReadOnly: PropTypes.bool,
29
- isOptional: PropTypes.bool,
30
- };
31
-
32
- export const Input = InputTemplate.bind({});
33
-
34
- Input.argTypes = {
35
- placeholder: {
36
- control: {type: 'text'},
37
- },
38
- label: {
39
- control: {type: 'text'},
40
- },
41
- helperText: {
42
- control: {type: 'text'},
43
- },
44
- errorMessage: {
45
- control: {type: 'text'},
46
- },
47
- };
48
-
49
- Input.args = {
50
- id: 'input_id',
51
- placeholder: 'Placeholder text',
52
- label: 'Label',
53
- helperText: 'Helper text',
54
- errorMessage: 'Error message',
55
- isInvalid: false,
56
- isDisabled: false,
57
- isReadOnly: false,
58
- isRequired: false,
59
- isOptional: false,
60
- };
@@ -1 +0,0 @@
1
- export {default} from './Input';
@@ -1,49 +0,0 @@
1
- import merge from 'lodash/merge';
2
- import chakraDefaultTheme from '@chakra-ui/theme';
3
-
4
- const baseStyle = {
5
- field: {
6
- _placeholder: {
7
- color: 'text.secondary.light',
8
- fontWeight: 'normal',
9
- _disabled: {color: 'text.secondary.light', opacity: 1},
10
- },
11
- },
12
- };
13
-
14
- const variants = {
15
- outline: {
16
- field: {
17
- border: '1px solid',
18
- borderColor: 'gray.200',
19
- fontSize: 'base',
20
- paddingLeft: 3,
21
- paddingRight: 3,
22
- bg: 'inherit',
23
- fontWeight: 'normal',
24
- boxShadow: 'none !important',
25
- _placeholder: {color: 'text.secondary.light', fontWeight: 'normal'},
26
- _focus: {
27
- borderColor: 'brandBlue',
28
- },
29
- _hover: {borderColor: 'gray.300'},
30
- _readOnly: {boxShadow: 'none !important', userSelect: 'all'},
31
- _disabled: {
32
- backgroundColor: 'gray.50',
33
- opacity: 1,
34
- cursor: 'not-allowed',
35
- },
36
- _invalid: {
37
- borderColor: 'error',
38
- _focus: {
39
- borderColor: 'error',
40
- },
41
- },
42
- },
43
- },
44
- };
45
-
46
- export default merge(chakraDefaultTheme.components.Input, {
47
- baseStyle,
48
- variants,
49
- });
@@ -1 +0,0 @@
1
- export {Link as default} from '@chakra-ui/react';
@@ -1,82 +0,0 @@
1
- import React from 'react';
2
-
3
- import {Box} from '@chakra-ui/react';
4
- import ShareIcon from '@spothero/icons/share';
5
-
6
- import Text from 'v2/components/Text/Text';
7
- import Component from 'v2/components/Link/Link';
8
-
9
- export default {
10
- title: 'v2/Link',
11
- component: Component,
12
- parameters: {
13
- removeBaseHtmlClass: true,
14
- },
15
- };
16
-
17
- const OverviewTemplate = (props, {hasDarkBackground}) => (
18
- <Box>
19
- <Text
20
- color={
21
- hasDarkBackground ? 'text.primary.dark' : 'text.primary.light'
22
- }
23
- >
24
- A link with{' '}
25
- <Component variant={hasDarkBackground ? 'onDark' : 'standard'}>
26
- no href
27
- </Component>{' '}
28
- is only styled.
29
- </Text>
30
- <Text
31
- color={
32
- hasDarkBackground ? 'text.primary.dark' : 'text.primary.light'
33
- }
34
- >
35
- Links can be linked to{' '}
36
- <Component
37
- href="#"
38
- isExternal
39
- variant={hasDarkBackground ? 'onDark' : 'standard'}
40
- >
41
- External Pages
42
- </Component>{' '}
43
- and will have <code>target=&quot;_blank&quot;</code> and{' '}
44
- <code>rel=&quot;noopener noreferrer&quot;</code> appended to them.
45
- </Text>
46
- <Text
47
- color={
48
- hasDarkBackground ? 'text.primary.dark' : 'text.primary.light'
49
- }
50
- >
51
- Links can have{' '}
52
- <Component
53
- href="#"
54
- variant={hasDarkBackground ? 'onDark' : 'standard'}
55
- >
56
- icons inline <ShareIcon width="1rem" />
57
- </Component>
58
- </Text>
59
- <Text
60
- color={
61
- hasDarkBackground ? 'text.primary.dark' : 'text.primary.light'
62
- }
63
- >
64
- Using the <code>as</code> prop, you can utilize a routing library,
65
- like{' '}
66
- <Component
67
- href="https://chakra-ui.com/docs/navigation/link#usage-with-routing-library"
68
- isExternal
69
- variant={hasDarkBackground ? 'onDark' : 'standard'}
70
- >
71
- React Router
72
- </Component>{' '}
73
- and it will replace the <code>a</code> tag with it&apos;s{' '}
74
- <code>Link</code>.
75
- </Text>
76
- </Box>
77
- );
78
-
79
- export const Overview = OverviewTemplate.bind({});
80
- Overview.parameters = {
81
- importBy: 'Link',
82
- };
@@ -1,38 +0,0 @@
1
- const baseStyle = {
2
- transition: `all 0.15s ease-out`,
3
- color: 'text.link.light',
4
- fontWeight: 'semibold',
5
- _hover: {
6
- color: 'primary.600',
7
- },
8
- _focus: {
9
- boxShadow: 'outline',
10
- },
11
- '& svg': {
12
- d: 'inline-block',
13
- verticalAlign: 'initial',
14
- },
15
- };
16
-
17
- const linkOnDark = {
18
- color: 'text.link.dark',
19
- _hover: {
20
- color: 'text.link.dark',
21
- opacity: '.8',
22
- },
23
- };
24
-
25
- export const variants = {
26
- standard: baseStyle,
27
- onDark: linkOnDark,
28
- };
29
-
30
- const defaultProps = {
31
- variant: 'standard',
32
- };
33
-
34
- export default {
35
- baseStyle,
36
- variants,
37
- defaultProps,
38
- };
@@ -1,57 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, {forwardRef} from 'react';
3
- import {List as ChakraList} from '@chakra-ui/react';
4
-
5
- const unorderedProps = {
6
- as: 'ul',
7
- styleType: 'disc',
8
- };
9
-
10
- const orderedProps = {
11
- as: 'ol',
12
- styleType: 'decimal',
13
- };
14
-
15
- const STYLE_POSITIONS = {
16
- unset: 'unset',
17
- revert: 'revert',
18
- inside: 'inside',
19
- outside: 'outside',
20
- initial: 'initial',
21
- inherit: 'inherit',
22
- };
23
-
24
- const TYPES = {
25
- ordered: 'ordered',
26
- unstyled: 'unstyled',
27
- unordered: 'unordered',
28
- };
29
-
30
- const getListProps = type => {
31
- switch (type) {
32
- case TYPES.ordered:
33
- return orderedProps;
34
- case TYPES.unordered:
35
- return unorderedProps;
36
- default:
37
- return;
38
- }
39
- };
40
-
41
- const List = forwardRef(({type, ...props}, ref) => (
42
- <ChakraList {...getListProps(type)} {...props} ref={ref} />
43
- ));
44
-
45
- List.defaultProps = {
46
- type: TYPES.unstyled,
47
- stylePosition: STYLE_POSITIONS.inside,
48
- };
49
-
50
- List.propTypes = {
51
- /** The position of the list style */
52
- stylePosition: PropTypes.oneOf(Object.keys(STYLE_POSITIONS)),
53
- /** Changes the underlying markdown to be an ordered or unorderd list, (unstyled will render a ul by default) */
54
- type: PropTypes.oneOf(Object.keys(TYPES)),
55
- };
56
-
57
- export default List;