@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,72 +0,0 @@
1
- import max from 'lodash/max';
2
- import min from 'lodash/min';
3
- import React from 'react';
4
- import PropTypes from 'prop-types';
5
- import classNames from 'classnames';
6
- import TableControls from './TableControls';
7
-
8
- const TableFooter = ({
9
- rowSize,
10
- pageSize,
11
- totalDataRowCount,
12
- currentPage,
13
- totalPages,
14
- currentPageLength,
15
- showMessage,
16
- message,
17
- onPageChange,
18
- onPreviousPage,
19
- onNextPage,
20
- }) => {
21
- const classes = classNames('TableFooter', {
22
- 'TableFooter-large': rowSize === 'large',
23
- });
24
- const totalCount = max([currentPageLength, totalDataRowCount]);
25
- const displayMessage = message
26
- ? message
27
- : totalPages > 1
28
- ? `Showing ${(currentPage - 1) * pageSize + 1}-${min([
29
- currentPage * pageSize,
30
- totalCount,
31
- ])} of ${totalCount}`
32
- : `Showing ${currentPageLength} of ${totalCount}`;
33
-
34
- if (!currentPageLength) {
35
- return null;
36
- }
37
-
38
- return (
39
- <div className="TableFooter-container">
40
- <div className={classes}>
41
- {showMessage && (
42
- <div className="TableFooter-info">{displayMessage}</div>
43
- )}
44
- {totalPages > 1 && (
45
- <TableControls
46
- currentPage={currentPage}
47
- totalPages={totalPages}
48
- onPageChange={onPageChange}
49
- onPreviousPage={onPreviousPage}
50
- onNextPage={onNextPage}
51
- />
52
- )}
53
- </div>
54
- </div>
55
- );
56
- };
57
-
58
- TableFooter.propTypes = {
59
- rowSize: PropTypes.string.isRequired,
60
- pageSize: PropTypes.number.isRequired,
61
- totalDataRowCount: PropTypes.number.isRequired,
62
- currentPage: PropTypes.number.isRequired,
63
- totalPages: PropTypes.number.isRequired,
64
- currentPageLength: PropTypes.number.isRequired,
65
- showMessage: PropTypes.bool.isRequired,
66
- message: PropTypes.node,
67
- onPageChange: PropTypes.func.isRequired,
68
- onPreviousPage: PropTypes.func.isRequired,
69
- onNextPage: PropTypes.func.isRequired,
70
- };
71
-
72
- export default React.memo(TableFooter);
@@ -1,58 +0,0 @@
1
- import React, {Component} from 'react';
2
- import classNames from 'classnames';
3
- import IconTriangleDown from '@spothero/icons/triangle-down';
4
- import IconTriangleUp from '@spothero/icons/triangle-up';
5
- import TableHeadingPropTypes from './TableHeadingPropTypes';
6
- import TableSortType from './TableSortType';
7
-
8
- const {ASC, DESC} = TableSortType;
9
-
10
- export default class TableHeading extends Component {
11
- static propTypes = TableHeadingPropTypes;
12
-
13
- _onSortToggleClick = () => {
14
- const {dataKey, sortOrder, onSortClick} = this.props;
15
-
16
- onSortClick({
17
- dataKey,
18
- sortOrder: !sortOrder ? ASC : sortOrder === ASC ? DESC : ASC,
19
- });
20
- };
21
-
22
- render() {
23
- const {className, label, dataKey, sortOrder, isSortable} = this.props;
24
- const hasActiveSort = isSortable && sortOrder;
25
- const sortOrderClass = hasActiveSort
26
- ? `TableHeading-sort-${sortOrder.toLowerCase()}`
27
- : '';
28
- const classes = classNames(
29
- 'TableHeading',
30
- {'TableHeading-sortable': isSortable},
31
- {'TableHeading-sort-active': hasActiveSort},
32
- sortOrderClass,
33
- className,
34
- dataKey
35
- );
36
- const headingProps = {
37
- className: classes,
38
- };
39
- const Icon = sortOrder === ASC ? IconTriangleUp : IconTriangleDown;
40
-
41
- if (isSortable) {
42
- headingProps.onClick = this._onSortToggleClick;
43
- }
44
-
45
- return (
46
- <th {...headingProps}>
47
- <div className="TableHeading-content">
48
- <div className="TableHeading-label">{label}</div>
49
- {isSortable && sortOrder && (
50
- <div className="TableHeading-sort">
51
- <Icon className="TableHeading-sort-icon" />
52
- </div>
53
- )}
54
- </div>
55
- </th>
56
- );
57
- }
58
- }
@@ -1,20 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import TableSortType from './TableSortType';
3
-
4
- export default {
5
- /** Additional class(es) to add to the component. */
6
- className: PropTypes.string,
7
- /** The header label. */
8
- label: PropTypes.string.isRequired,
9
- /** Determines whether or not table can sort by header cell dataKey. */
10
- isSortable: PropTypes.bool,
11
- /** Determines whether or not this heading should render with sorting order arrow. */
12
- sortOrder: PropTypes.oneOf([TableSortType.ASC, TableSortType.DESC]),
13
- /**
14
- * A function to call when a sortable header is clicked.
15
- *
16
- * @param {String} dataKey - The header's dataKey.
17
- * @param {String} sortOrder - The sort order to use (ASC or DESC).
18
- */
19
- onSortClick: PropTypes.func,
20
- };
@@ -1,63 +0,0 @@
1
- import forEach from 'lodash/forEach';
2
- import React, {Component} from 'react';
3
- import PropTypes from 'prop-types';
4
- import Select from '../../../Select/Select';
5
- import TableSortType from './TableSortType';
6
-
7
- const {ASC, DESC} = TableSortType;
8
-
9
- export default class TableSortSelector extends Component {
10
- static propTypes = {
11
- headers: PropTypes.array.isRequired,
12
- sortOrder: PropTypes.oneOf([ASC, DESC]),
13
- sortDataKey: PropTypes.string,
14
- onSortChange: PropTypes.func.isRequired,
15
- };
16
-
17
- constructor(props) {
18
- super(props);
19
-
20
- this._HEADERS = props.headers;
21
- this._sortItems = [];
22
-
23
- forEach(this._HEADERS, ({isSortable, label, dataKey}) => {
24
- if (isSortable) {
25
- this._sortItems.push({
26
- label: `${label} - ${ASC}`,
27
- value: `${dataKey}-${ASC}`,
28
- });
29
- this._sortItems.push({
30
- label: `${label} - ${DESC}`,
31
- value: `${dataKey}-${DESC}`,
32
- });
33
- }
34
- });
35
- }
36
-
37
- _onSortChange = ({value}) => {
38
- const [dataKey, sortOrder] = value.split('-');
39
-
40
- this.props.onSortChange({
41
- dataKey,
42
- sortOrder,
43
- });
44
- };
45
-
46
- render() {
47
- const {sortOrder, sortDataKey} = this.props;
48
- const defaultSortValue =
49
- sortDataKey && sortOrder ? `${sortDataKey}-${sortOrder}` : null;
50
-
51
- return (
52
- <div className="TableSortSelector">
53
- <Select
54
- key={defaultSortValue}
55
- className="TableSortSelector-Select"
56
- defaultValue={defaultSortValue}
57
- items={this._sortItems}
58
- onChange={this._onSortChange}
59
- />
60
- </div>
61
- );
62
- }
63
- }
@@ -1,4 +0,0 @@
1
- export default {
2
- ASC: 'Ascending',
3
- DESC: 'Descending',
4
- };
@@ -1,263 +0,0 @@
1
- .Table {
2
- border-collapse: collapse;
3
- margin: 0;
4
- padding: 0;
5
- width: 100%;
6
- table-layout: fixed;
7
- color: $color-fuel;
8
- }
9
-
10
- .TableHead {
11
- position: absolute;
12
- clip: rect(0 0 0 0);
13
- width: 1px;
14
- height: 1px;
15
- margin: -1px;
16
- padding: 0;
17
- overflow: hidden;
18
- text-transform: uppercase;
19
-
20
- @include breakpoint($breakpoint-lg) {
21
- position: static;
22
- clip: none;
23
- width: auto;
24
- height: auto;
25
- margin: auto;
26
- padding: auto;
27
- overflow: auto;
28
-
29
- > tr {
30
- color: $color-cement;
31
- font-weight: $font-weight-semi-bold;
32
- border-bottom: 1px solid $color-dashboard;
33
-
34
- > th {
35
- padding: 15px 0 15px 20px;
36
- text-align: left;
37
- background-color: $color-white;
38
-
39
- &:first-child {
40
- border-top-left-radius: 4px;
41
- }
42
-
43
- &:last-child {
44
- border-top-right-radius: 4px;
45
- }
46
- }
47
- }
48
- }
49
- }
50
-
51
- .TableHeading-sortable {
52
- cursor: pointer;
53
- }
54
-
55
- .TableHeading-content {
56
- display: flex;
57
- width: 100%;
58
- align-items: center;
59
- }
60
-
61
- .TableHeading-sort {
62
- margin-left: 6px;
63
- }
64
-
65
- .TableHeading-sort-icon {
66
- width: 10px;
67
- height: 10px;
68
- margin-top: -2px;
69
- }
70
-
71
- .TableBody {
72
- > tr {
73
- display: block;
74
- margin: 0 0 20px;
75
- padding: 20px;
76
- background-color: $color-white;
77
- border-radius: 4px;
78
- vertical-align: top;
79
-
80
- &:last-child {
81
- margin-bottom: 0;
82
- }
83
-
84
- > td {
85
- display: block;
86
- margin-bottom: 12px;
87
-
88
- &::before {
89
- display: block;
90
- margin-bottom: 5px;
91
- content: attr(data-label);
92
- color: $color-cement;
93
- font-weight: $font-weight-semi-bold;
94
- text-transform: uppercase;
95
- }
96
-
97
- &:last-child {
98
- margin-bottom: 0;
99
- }
100
-
101
- &.Table-no-data {
102
- text-align: center;
103
- }
104
- }
105
-
106
- @include breakpoint($breakpoint-lg) {
107
- border-bottom: 1px solid $color-dashboard;
108
- border-radius: 0;
109
-
110
- &:last-child {
111
- border-bottom: none;
112
- }
113
- }
114
- }
115
-
116
- &.Table-no-data {
117
- > tr {
118
- width: 100%;
119
-
120
- > td {
121
- text-align: center;
122
- }
123
- }
124
- }
125
-
126
- @include breakpoint($breakpoint-md) {
127
- > tr {
128
- display: inline-block;
129
- width: calc(50% - 10px);
130
-
131
- &:nth-child(even) {
132
- margin-left: 20px;
133
- }
134
- }
135
- }
136
-
137
- @include breakpoint($breakpoint-lg) {
138
- > tr {
139
- > td {
140
- background-color: $color-white;
141
-
142
- > div {
143
- padding: 15px 0 15px 20px;
144
- }
145
- }
146
- }
147
- }
148
- }
149
-
150
- .TableHead,
151
- .TableBody {
152
- @include breakpoint($breakpoint-lg) {
153
- > tr {
154
- display: table-row;
155
- width: auto;
156
- text-align: left;
157
- background-color: transparent;
158
-
159
- &:nth-child(even) {
160
- margin-left: 0;
161
- }
162
-
163
- > td {
164
- display: table-cell;
165
- vertical-align: top;
166
-
167
- &::before {
168
- display: none;
169
- }
170
- }
171
- }
172
- }
173
- }
174
-
175
- .Table-large {
176
- @include breakpoint($breakpoint-lg) {
177
- .TableBody {
178
- > tr {
179
- > td {
180
- > div {
181
- padding-top: 27px;
182
- padding-bottom: 27px;
183
- }
184
- }
185
- }
186
- }
187
- }
188
- }
189
-
190
- .TableFooter-container {
191
- @extend %clearfix;
192
- }
193
-
194
- .TableFooter {
195
- float: right;
196
- margin-top: 20px;
197
- background-color: $color-white;
198
- border-radius: 4px;
199
-
200
- @include breakpoint($breakpoint-lg) {
201
- display: flex;
202
- justify-content: space-between;
203
- align-items: center;
204
- float: none;
205
- margin-top: 0;
206
- border-top: 1px solid $color-dashboard;
207
- border-top-left-radius: 0;
208
- border-top-right-radius: 0;
209
- }
210
- }
211
-
212
- .TableFooter-info {
213
- display: none;
214
-
215
- @include breakpoint($breakpoint-lg) {
216
- display: flex;
217
- justify-content: center;
218
- align-items: center;
219
- color: $color-cement;
220
- padding: 15px 20px;
221
- text-align: left;
222
- }
223
- }
224
-
225
- .TableControls {
226
- display: flex;
227
- justify-content: center;
228
- align-items: center;
229
- padding: 4px 20px;
230
- }
231
-
232
- .TableControls-pagination {
233
- .Select {
234
- display: inline-block;
235
- margin: 0 8px;
236
- vertical-align: top;
237
- }
238
-
239
- .Button {
240
- padding-left: 8px;
241
- padding-right: 8px;
242
- background-color: transparent;
243
- border: none;
244
- }
245
- }
246
-
247
- .TableSortSelector {
248
- display: flex;
249
- flex-direction: row-reverse;
250
- margin-bottom: 20px;
251
-
252
- @include breakpoint($breakpoint-lg) {
253
- display: none;
254
- }
255
- }
256
-
257
- .TableSortSelector-Select {
258
- width: 100%;
259
-
260
- @include breakpoint($breakpoint-md) {
261
- width: calc(50% - 10px);
262
- }
263
- }
@@ -1,5 +0,0 @@
1
- export {default as Table} from './Table';
2
- export {default as TableControls} from './TableControls';
3
- export {default as TableSortType} from './TableSortType';
4
- export {default as TableCellPropTypes} from './TableCellPropTypes';
5
- export {default as TableHeadingPropTypes} from './TableHeadingPropTypes';
@@ -1,194 +0,0 @@
1
- import React from 'react';
2
- import Table from '../Table';
3
- import data from './helpers/table-data';
4
- import headers from './helpers/table-headers';
5
- import TableCustomRow from './helpers/TableCustomRow';
6
- import TableCellEmail from './helpers/TableCellEmail';
7
- import TableHeadingEmail from './helpers/TableHeadingEmail';
8
-
9
- import TableCell from '../TableCell';
10
- import TableFooter from '../TableFooter';
11
- import TableHeading from '../TableHeading';
12
- import TableControls from '../TableControls';
13
- import TableSortSelector from '../TableSortSelector';
14
-
15
- export default {
16
- component: Table,
17
- title: 'v1/Table/Display',
18
- subcomponents: {
19
- TableCell,
20
- TableFooter,
21
- TableHeading,
22
- TableControls,
23
- TableSortSelector,
24
- },
25
- };
26
-
27
- export const Default = () => {
28
- return (
29
- <Table data={data} headers={headers} totalDataRowCount={data.length} />
30
- );
31
- };
32
-
33
- export const NoData = () => {
34
- return <Table headers={headers} data={[]} />;
35
- };
36
-
37
- export const NoDataCustomMessage = () => {
38
- return (
39
- <Table
40
- data={[]}
41
- headers={headers}
42
- noDataAvailableMessage="The Avengers are no more!"
43
- />
44
- );
45
- };
46
-
47
- export const WithClassNames = () => {
48
- const TableData = data.map(({firstName, lastName, email, age}) => ({
49
- firstName: {
50
- value: firstName,
51
- className: 'AvengersTableCell-first-name',
52
- },
53
- lastName: {
54
- value: lastName,
55
- className: 'AvengersTableCell-last-name',
56
- },
57
- email: {
58
- value: email,
59
- className: 'AvengersTableCell-email',
60
- },
61
- age: {
62
- value: age,
63
- className: 'AvengersTableCell-age',
64
- },
65
- }));
66
-
67
- return (
68
- <Table
69
- data={TableData}
70
- headers={headers}
71
- className="AvengersTable"
72
- totalDataRowCount={TableData.length}
73
- containerClassName="AvengersTable-container"
74
- />
75
- );
76
- };
77
-
78
- export const WithRowClassNames = () => {
79
- const TableData = data.map(row => ({
80
- ...row,
81
- className: 'TableRow',
82
- }));
83
-
84
- return (
85
- <Table
86
- data={TableData}
87
- headers={headers}
88
- className="AvengersTable"
89
- totalDataRowCount={TableData.length}
90
- containerClassName="AvengersTable-container"
91
- />
92
- );
93
- };
94
-
95
- export const WithCustomFooterMessage = () => {
96
- return (
97
- <Table
98
- data={data}
99
- headers={headers}
100
- totalDataRowCount={data.length}
101
- footerMessage={`${data.length} Rows`}
102
- />
103
- );
104
- };
105
-
106
- export const WithCustomRenders = () => {
107
- const renderEmailCell = cellProps => <TableCellEmail {...cellProps} />;
108
- const renderEmailHeading = headingProps => (
109
- <TableHeadingEmail {...headingProps} />
110
- );
111
- const customHeaders = headers.map(heading => {
112
- return {
113
- ...heading,
114
- render: /email/i.test(heading.label) ? renderEmailHeading : null,
115
- };
116
- });
117
- const customData = data.map(({age, email, lastName, firstName}) => ({
118
- age,
119
- lastName,
120
- firstName,
121
- email: {
122
- value: email,
123
- render: renderEmailCell,
124
- },
125
- }));
126
-
127
- return (
128
- <Table
129
- data={customData}
130
- headers={customHeaders}
131
- className="AvengersTable"
132
- totalDataRowCount={customData.length}
133
- />
134
- );
135
- };
136
-
137
- export const WithCustomRowRender = () => {
138
- // eslint-disable-next-line react/prop-types
139
- const renderCustomRow = ({key, row}) => {
140
- return <TableCustomRow key={key} {...row} />;
141
- };
142
- const customData = data.map(hero => {
143
- return {
144
- ...hero,
145
- customRowRender: renderCustomRow,
146
- };
147
- });
148
-
149
- return (
150
- <Table
151
- className="AvengersTable"
152
- headers={headers}
153
- data={customData}
154
- totalDataRowCount={customData.length}
155
- />
156
- );
157
- };
158
-
159
- export const WithLargeRows = () => {
160
- return (
161
- <Table
162
- data={data}
163
- rowSize="large"
164
- headers={headers}
165
- totalDataRowCount={data.length}
166
- />
167
- );
168
- };
169
-
170
- export const WithNoFooterMessage = () => {
171
- return (
172
- <Table
173
- data={data}
174
- headers={headers}
175
- showFooterMessage={false}
176
- totalDataRowCount={data.length}
177
- />
178
- );
179
- };
180
-
181
- export const WithNoTableDataRowCount = () => {
182
- return <Table headers={headers} data={data} />;
183
- };
184
-
185
- export const WithSortingArray = () => {
186
- return (
187
- <Table
188
- data={data}
189
- headers={headers}
190
- sorting={['firstName']}
191
- totalDataRowCount={data.length}
192
- />
193
- );
194
- };