@spothero/ui 15.10.9 → 16.0.0-beta.0

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 (316) hide show
  1. package/.eslintignore +2 -1
  2. package/dex.config.js +1 -1
  3. package/jest.config.json +1 -2
  4. package/package.json +8 -24
  5. package/styles/{v2/components → components}/Accordion/Accordion.stories.js +2 -2
  6. package/styles/{v2/components → components}/Accordion/styles/button.js +1 -1
  7. package/styles/{v2/components → components}/Alert/Alert.jsx +2 -2
  8. package/styles/{v2/components → components}/AutoSuggestSelect/AutoSuggestSelect.jsx +7 -0
  9. package/styles/{v2/components → components}/Button/stories/button.js +1 -1
  10. package/styles/{v2/components → components}/Button/stories/overview.js +1 -1
  11. package/styles/{v2/components → components}/FormControl/FormControl.jsx +2 -0
  12. package/styles/{v2/components → components}/Grid/Grid.stories.js +1 -1
  13. package/styles/{v2/components → components}/Heading/Heading.styles.js +1 -1
  14. package/styles/{v2/components → components}/Image/Image.jsx +23 -2
  15. package/styles/{v2/components → components}/Link/Link.stories.js +2 -2
  16. package/styles/{v2/components → components}/List/List.stories.js +2 -2
  17. package/styles/{v2/components → components}/Modal/Modal.jsx +0 -1
  18. package/styles/{v2/components → components}/Modal/Modal.stories.js +4 -4
  19. package/styles/{v2/components → components}/Popover/Popover.stories.js +1 -1
  20. package/styles/{v2/components → components}/Skeleton/index.js +1 -1
  21. package/styles/{v2/components → components}/Spinner/Spinner.stories.js +1 -1
  22. package/styles/{v2/components → components}/Table/Table.styles.js +1 -1
  23. package/styles/{v2/components → components}/Tabs/Tabs.jsx +2 -3
  24. package/styles/{v2/components → components}/Tabs/combineSizeWithVariant.js +5 -3
  25. package/styles/{v2/components → components}/Text/Text.styles.js +1 -1
  26. package/styles/{v2/components → components}/Text/combineAsWithVariant.js +1 -1
  27. package/styles/{v2/components → components}/ThemeProvider/ThemeProvider.jsx +2 -2
  28. package/styles/{v2/components → components}/ThemeProvider/ThemeProvider.stories.js +2 -2
  29. package/v2/index.js +1 -1
  30. package/v2/index.js.map +1 -1
  31. package/backlog/Alert/Alert.js +0 -37
  32. package/backlog/AutoSuggestInput/AutoSuggestInput.js +0 -474
  33. package/backlog/AutoSuggestInput/AutoSuggestItem.js +0 -99
  34. package/backlog/AutoSuggestInput/AutoSuggestList.js +0 -126
  35. package/backlog/Badge/Badge.js +0 -28
  36. package/backlog/Chart/Chart.js +0 -211
  37. package/backlog/Checkbox/Checkbox.js +0 -167
  38. package/backlog/DateTime/DatePicker.js +0 -279
  39. package/backlog/DateTime/DatePickerCalendar.js +0 -199
  40. package/backlog/DateTime/DatePickerCalendarNavigation.js +0 -102
  41. package/backlog/DateTime/DatePickerCalendarWithRange.js +0 -241
  42. package/backlog/DateTime/DateTimePicker.js +0 -216
  43. package/backlog/DateTime/DateTimeRangePicker.js +0 -530
  44. package/backlog/DateTime/TimePicker.js +0 -180
  45. package/backlog/DateTime/date-time-assertions.js +0 -66
  46. package/backlog/DateTime/index.js +0 -55
  47. package/backlog/ErrorBoundary/ErrorBoundary.js +0 -125
  48. package/backlog/Flyout/Flyout.js +0 -198
  49. package/backlog/Form/Form.js +0 -193
  50. package/backlog/Form/FormElementError.js +0 -24
  51. package/backlog/Form/FormGroup.js +0 -30
  52. package/backlog/Form/FormGroupError.js +0 -28
  53. package/backlog/Form/index.js +0 -39
  54. package/backlog/GooglePlacesSearchInput/GooglePlacesSearchInput.js +0 -253
  55. package/backlog/GooglePlacesSearchInput/PoweredByGoogle.js +0 -38
  56. package/backlog/GooglePlacesSearchInput/index.js +0 -23
  57. package/backlog/HorizontalRule/HorizontalRule.js +0 -30
  58. package/backlog/Label/Label.js +0 -31
  59. package/backlog/Notification/Notification.js +0 -178
  60. package/backlog/Notification/NotificationContainer.js +0 -131
  61. package/backlog/Notification/NotificationPropTypes.js +0 -37
  62. package/backlog/Notification/index.js +0 -23
  63. package/backlog/PasswordControl/PasswordControl.js +0 -201
  64. package/backlog/Portal/Portal.js +0 -110
  65. package/backlog/PulseLoader/PulseLoader.js +0 -62
  66. package/backlog/Radio/Radio.js +0 -135
  67. package/backlog/Radio/RadioGroup.js +0 -123
  68. package/backlog/Radio/index.js +0 -23
  69. package/backlog/RenderInBody/RenderInBody.js +0 -103
  70. package/backlog/Select/Select.js +0 -275
  71. package/backlog/Select/SelectItemPropTypes.js +0 -32
  72. package/backlog/Select/index.js +0 -23
  73. package/backlog/SelectControlled/SelectControlled.js +0 -270
  74. package/backlog/SelectControlled/index.js +0 -15
  75. package/backlog/Sprite/Sprite.js +0 -24
  76. package/backlog/Tabs/Tab.js +0 -94
  77. package/backlog/Tabs/TabContent.js +0 -56
  78. package/backlog/Tabs/TabNavigation.js +0 -108
  79. package/backlog/Tabs/TabPanel.js +0 -29
  80. package/backlog/Tabs/Tabs.js +0 -126
  81. package/backlog/Tabs/index.js +0 -47
  82. package/backlog/TextArea/TextArea.js +0 -155
  83. package/backlog/TextInput/TextInput.js +0 -230
  84. package/backlog/TextInput/TextInputPropTypes.js +0 -114
  85. package/backlog/TextInput/index.js +0 -23
  86. package/backlog/Tooltip/Tooltip.js +0 -249
  87. package/backlog/index.js +0 -393
  88. package/backlog/v1/components/Button/Button.js +0 -64
  89. package/backlog/v1/components/Button/button-props.js +0 -48
  90. package/backlog/v1/components/Image/Image.js +0 -193
  91. package/backlog/v1/components/Loader/Loader.js +0 -51
  92. package/backlog/v1/components/Modal/Modal.js +0 -325
  93. package/backlog/v1/components/Modal/ModalContent.js +0 -154
  94. package/backlog/v1/components/Modal/ModalFooter.js +0 -89
  95. package/backlog/v1/components/Modal/index.js +0 -31
  96. package/backlog/v1/components/Panel/Panel.js +0 -209
  97. package/backlog/v1/components/Table/Table.js +0 -336
  98. package/backlog/v1/components/Table/TableCell.js +0 -28
  99. package/backlog/v1/components/Table/TableCellPropTypes.js +0 -22
  100. package/backlog/v1/components/Table/TableControls.js +0 -56
  101. package/backlog/v1/components/Table/TableFooter.js +0 -63
  102. package/backlog/v1/components/Table/TableHeading.js +0 -126
  103. package/backlog/v1/components/Table/TableHeadingPropTypes.js +0 -35
  104. package/backlog/v1/components/Table/TableSortSelector.js +0 -125
  105. package/backlog/v1/components/Table/TableSortType.js +0 -11
  106. package/backlog/v1/components/Table/index.js +0 -47
  107. package/backlog/v1/components/TextButton/TextButton.js +0 -74
  108. package/backlog/v1/components/index.js +0 -75
  109. package/backlog/v1/utils/deprecate.js +0 -61
  110. package/styles/Alert/_Alert.scss +0 -51
  111. package/styles/AutoSuggestInput/_AutoSuggestInput.scss +0 -116
  112. package/styles/Badge/_Badge.scss +0 -33
  113. package/styles/Chart/_Chart.scss +0 -105
  114. package/styles/Chart/_chartist-settings.scss +0 -131
  115. package/styles/Chart/_chartist.scss +0 -295
  116. package/styles/Checkbox/_Checkbox.scss +0 -173
  117. package/styles/DateTime/_DatePicker.scss +0 -61
  118. package/styles/DateTime/_DatePickerCalendar.scss +0 -159
  119. package/styles/DateTime/_DateTime.scss +0 -4
  120. package/styles/DateTime/_DateTimePicker.scss +0 -46
  121. package/styles/DateTime/_TimePicker.scss +0 -30
  122. package/styles/ErrorBoundary/_ErrorBoundary.scss +0 -18
  123. package/styles/Flyout/_Flyout.scss +0 -73
  124. package/styles/Form/_Form.scss +0 -53
  125. package/styles/GooglePlacesSearchInput/_GooglePlacesSearchInput.scss +0 -3
  126. package/styles/GooglePlacesSearchInput/_PoweredByGoogle.scss +0 -21
  127. package/styles/HorizontalRule/_HorizontalRule.scss +0 -48
  128. package/styles/Label/_Label.scss +0 -6
  129. package/styles/Notification/_Notification.scss +0 -113
  130. package/styles/PasswordControl/_PasswordControl.scss +0 -86
  131. package/styles/PulseLoader/_PulseLoader.scss +0 -60
  132. package/styles/Radio/_Radio.scss +0 -93
  133. package/styles/Select/_Select.scss +0 -94
  134. package/styles/Tabs/_Tabs.scss +0 -57
  135. package/styles/TextArea/_TextArea.scss +0 -26
  136. package/styles/TextInput/_TextInput.scss +0 -43
  137. package/styles/Tooltip/_Tooltip.scss +0 -108
  138. package/styles/_index.scss +0 -34
  139. package/styles/common/sass/_control-sizing.scss +0 -5
  140. package/styles/common/sass/_disable-scrolling.scss +0 -7
  141. package/styles/common/sass/_forms.scss +0 -72
  142. package/styles/index.js +0 -50
  143. package/styles/v1/components/Button/Button.jsx +0 -48
  144. package/styles/v1/components/Button/Button.spec.js +0 -76
  145. package/styles/v1/components/Button/_Button.scss +0 -178
  146. package/styles/v1/components/Button/button-props.js +0 -30
  147. package/styles/v1/components/Button/stories/button.js +0 -20
  148. package/styles/v1/components/Button/stories/index.stories.js +0 -92
  149. package/styles/v1/components/Button/stories/overview.js +0 -87
  150. package/styles/v1/components/Button/stories/types.js +0 -31
  151. package/styles/v1/components/Image/Image.jsx +0 -175
  152. package/styles/v1/components/Image/Image.spec.js +0 -113
  153. package/styles/v1/components/Image/_Image.scss +0 -24
  154. package/styles/v1/components/Image/stories/Cloudinary.stories.js +0 -39
  155. package/styles/v1/components/Image/stories/Display.stories.js +0 -92
  156. package/styles/v1/components/Loader/Loader.jsx +0 -54
  157. package/styles/v1/components/Loader/Loader.spec.js +0 -67
  158. package/styles/v1/components/Loader/_Loader.scss +0 -18
  159. package/styles/v1/components/Loader/stories/Display.stories.js +0 -55
  160. package/styles/v1/components/Modal/Modal.jsx +0 -315
  161. package/styles/v1/components/Modal/Modal.spec.js +0 -293
  162. package/styles/v1/components/Modal/ModalContent.jsx +0 -126
  163. package/styles/v1/components/Modal/ModalFooter.jsx +0 -53
  164. package/styles/v1/components/Modal/_Modal.scss +0 -262
  165. package/styles/v1/components/Modal/index.js +0 -3
  166. package/styles/v1/components/Modal/stories/Content.stories.js +0 -314
  167. package/styles/v1/components/Modal/stories/Display.stories.js +0 -208
  168. package/styles/v1/components/Modal/stories/Methods.stories.js +0 -44
  169. package/styles/v1/components/Modal/stories/Width.stories.js +0 -82
  170. package/styles/v1/components/Modal/stories/helpers/ReduxConsumer.jsx +0 -21
  171. package/styles/v1/components/Panel/Panel.jsx +0 -202
  172. package/styles/v1/components/Panel/Panel.spec.js +0 -196
  173. package/styles/v1/components/Panel/_Panel.scss +0 -55
  174. package/styles/v1/components/Panel/stories/Display.stories.js +0 -82
  175. package/styles/v1/components/Panel/stories/Methods.stories.js +0 -76
  176. package/styles/v1/components/Table/Table.jsx +0 -367
  177. package/styles/v1/components/Table/Table.spec.js +0 -526
  178. package/styles/v1/components/Table/TableCell.jsx +0 -17
  179. package/styles/v1/components/Table/TableCellPropTypes.js +0 -10
  180. package/styles/v1/components/Table/TableControls.jsx +0 -61
  181. package/styles/v1/components/Table/TableFooter.jsx +0 -72
  182. package/styles/v1/components/Table/TableHeading.jsx +0 -58
  183. package/styles/v1/components/Table/TableHeadingPropTypes.js +0 -20
  184. package/styles/v1/components/Table/TableSortSelector.jsx +0 -63
  185. package/styles/v1/components/Table/TableSortType.js +0 -4
  186. package/styles/v1/components/Table/_Table.scss +0 -263
  187. package/styles/v1/components/Table/index.js +0 -5
  188. package/styles/v1/components/Table/stories/Display.stories.js +0 -194
  189. package/styles/v1/components/Table/stories/Methods.stories.js +0 -141
  190. package/styles/v1/components/Table/stories/helpers/TableCellEmail.jsx +0 -25
  191. package/styles/v1/components/Table/stories/helpers/TableCustomRow.jsx +0 -35
  192. package/styles/v1/components/Table/stories/helpers/TableHeadingEmail.jsx +0 -20
  193. package/styles/v1/components/Table/stories/helpers/table-data.js +0 -26
  194. package/styles/v1/components/Table/stories/helpers/table-headers.js +0 -14
  195. package/styles/v1/components/TextButton/TextButton.jsx +0 -78
  196. package/styles/v1/components/TextButton/TextButton.spec.js +0 -95
  197. package/styles/v1/components/TextButton/_TextButton.scss +0 -114
  198. package/styles/v1/components/TextButton/stories/Display.stories.js +0 -46
  199. package/styles/v1/components/index.js +0 -7
  200. package/styles/v1/utils/deprecate.js +0 -45
  201. package/styles/v2/components/index.js +0 -70
  202. package/styles/v2/components/styles.js +0 -21
  203. package/styles/v2/theme/global.js +0 -118
  204. package/styles/v2/theme/index.js +0 -27
  205. package/styles/v2/utils/Spaces.js +0 -16
  206. package/v1/assets-manifest.json +0 -5
  207. package/v1/index.html +0 -1
  208. package/v1/index.js +0 -3
  209. package/v1/index.js.LICENSE.txt +0 -23
  210. package/v1/index.js.map +0 -1
  211. /package/styles/{v2/components → components}/Accordion/Accordion.jsx +0 -0
  212. /package/styles/{v2/components → components}/Accordion/index.js +0 -0
  213. /package/styles/{v2/components → components}/Accordion/styles/container.js +0 -0
  214. /package/styles/{v2/components → components}/Accordion/styles/index.js +0 -0
  215. /package/styles/{v2/components → components}/Accordion/styles/panel.js +0 -0
  216. /package/styles/{v2/components → components}/Alert/Alert.stories.js +0 -0
  217. /package/styles/{v2/components → components}/Alert/index.js +0 -0
  218. /package/styles/{v2/components → components}/Alert/styles/index.js +0 -0
  219. /package/styles/{v2/components → components}/AutoSuggestSelect/index.js +0 -0
  220. /package/styles/{v2/components → components}/Badge/Badge.jsx +0 -0
  221. /package/styles/{v2/components → components}/Badge/Badge.stories.js +0 -0
  222. /package/styles/{v2/components → components}/Badge/styles/index.js +0 -0
  223. /package/styles/{v2/components → components}/Button/Button.jsx +0 -0
  224. /package/styles/{v2/components → components}/Button/Button.spec.js +0 -0
  225. /package/styles/{v2/components → components}/Button/Button.styles.js +0 -0
  226. /package/styles/{v2/components → components}/Button/button-props.js +0 -0
  227. /package/styles/{v2/components → components}/Button/index.js +0 -0
  228. /package/styles/{v2/components → components}/Button/stories/index.stories.js +0 -0
  229. /package/styles/{v2/components → components}/Card/Card.jsx +0 -0
  230. /package/styles/{v2/components → components}/Card/Card.stories.js +0 -0
  231. /package/styles/{v2/components → components}/Checkbox/Checkbox.jsx +0 -0
  232. /package/styles/{v2/components → components}/Checkbox/Checkbox.stories.js +0 -0
  233. /package/styles/{v2/components → components}/Checkbox/index.js +0 -0
  234. /package/styles/{v2/components → components}/Checkbox/styles/index.js +0 -0
  235. /package/styles/{v2/components → components}/Container/Container.jsx +0 -0
  236. /package/styles/{v2/components → components}/Container/Container.stories.js +0 -0
  237. /package/styles/{v2/components → components}/Container/Container.styles.js +0 -0
  238. /package/styles/{v2/components → components}/Divider/Divider.jsx +0 -0
  239. /package/styles/{v2/components → components}/Divider/Divider.stories.js +0 -0
  240. /package/styles/{v2/components → components}/Divider/Divider.styles.js +0 -0
  241. /package/styles/{v2/components → components}/Grid/Grid.jsx +0 -0
  242. /package/styles/{v2/components → components}/Grid/Grid.styles.js +0 -0
  243. /package/styles/{v2/components → components}/Grid/GridItem.jsx +0 -0
  244. /package/styles/{v2/components → components}/Grid/GridItem.styles.js +0 -0
  245. /package/styles/{v2/components → components}/Grid/index.js +0 -0
  246. /package/styles/{v2/components → components}/Heading/Heading.jsx +0 -0
  247. /package/styles/{v2/components → components}/Heading/Heading.stories.js +0 -0
  248. /package/styles/{v2/components → components}/Icon/Icon.jsx +0 -0
  249. /package/styles/{v2/components → components}/Icon/Icon.stories.js +0 -0
  250. /package/styles/{v2/components → components}/Image/Image.spec.js +0 -0
  251. /package/styles/{v2/components → components}/Image/Image.stories.js +0 -0
  252. /package/styles/{v2/components → components}/Input/Input.jsx +0 -0
  253. /package/styles/{v2/components → components}/Input/Input.stories.js +0 -0
  254. /package/styles/{v2/components → components}/Input/index.js +0 -0
  255. /package/styles/{v2/components → components}/Input/styles/index.js +0 -0
  256. /package/styles/{v2/components → components}/Link/Link.jsx +0 -0
  257. /package/styles/{v2/components → components}/Link/Link.styles.js +0 -0
  258. /package/styles/{v2/components → components}/List/List.jsx +0 -0
  259. /package/styles/{v2/components → components}/List/index.js +0 -0
  260. /package/styles/{v2/components → components}/List/styles/index.js +0 -0
  261. /package/styles/{v2/components → components}/List/styles/item.styles.js +0 -0
  262. /package/styles/{v2/components → components}/Loader/Loader.jsx +0 -0
  263. /package/styles/{v2/components → components}/Loader/Loader.stories.js +0 -0
  264. /package/styles/{v2/components → components}/Modal/index.js +0 -0
  265. /package/styles/{v2/components → components}/Modal/styles/body.js +0 -0
  266. /package/styles/{v2/components → components}/Modal/styles/closeButton.js +0 -0
  267. /package/styles/{v2/components → components}/Modal/styles/dialog.js +0 -0
  268. /package/styles/{v2/components → components}/Modal/styles/dialogContainer.js +0 -0
  269. /package/styles/{v2/components → components}/Modal/styles/footer.js +0 -0
  270. /package/styles/{v2/components → components}/Modal/styles/header.js +0 -0
  271. /package/styles/{v2/components → components}/Modal/styles/index.js +0 -0
  272. /package/styles/{v2/components → components}/Modal/styles/overlay.js +0 -0
  273. /package/styles/{v2/components → components}/Popover/Popover.jsx +0 -0
  274. /package/styles/{v2/components → components}/Popover/PopoverArrow.jsx +0 -0
  275. /package/styles/{v2/components → components}/Popover/PopoverCloseButton.jsx +0 -0
  276. /package/styles/{v2/components → components}/Popover/PopoverContent.jsx +0 -0
  277. /package/styles/{v2/components → components}/Popover/index.js +0 -0
  278. /package/styles/{v2/components → components}/Popover/styles/index.js +0 -0
  279. /package/styles/{v2/components → components}/Popover/styles/popover-arrow.js +0 -0
  280. /package/styles/{v2/components → components}/Popover/styles/popover-body.js +0 -0
  281. /package/styles/{v2/components → components}/Popover/styles/popover-close-button.js +0 -0
  282. /package/styles/{v2/components → components}/Popover/styles/popover-content.js +0 -0
  283. /package/styles/{v2/components → components}/Popover/styles/popover-header.js +0 -0
  284. /package/styles/{v2/components → components}/Popover/styles/popper.js +0 -0
  285. /package/styles/{v2/components → components}/Radio/Radio.jsx +0 -0
  286. /package/styles/{v2/components → components}/Radio/Radio.stories.js +0 -0
  287. /package/styles/{v2/components → components}/Radio/RadioGroup.jsx +0 -0
  288. /package/styles/{v2/components → components}/Radio/index.js +0 -0
  289. /package/styles/{v2/components → components}/Radio/styles/index.js +0 -0
  290. /package/styles/{v2/components → components}/Select/Select.jsx +0 -0
  291. /package/styles/{v2/components → components}/Select/Select.stories.js +0 -0
  292. /package/styles/{v2/components → components}/Select/index.js +0 -0
  293. /package/styles/{v2/components → components}/Select/styles/index.js +0 -0
  294. /package/styles/{v2/components → components}/Skeleton/Skeleton.stories.jsx +0 -0
  295. /package/styles/{v2/components → components}/Skeleton/Skeleton.styles.js +0 -0
  296. /package/styles/{v2/components → components}/Spinner/Spinner.jsx +0 -0
  297. /package/styles/{v2/components → components}/Spinner/Spinner.styles.js +0 -0
  298. /package/styles/{v2/components → components}/Switch/Switch.jsx +0 -0
  299. /package/styles/{v2/components → components}/Switch/Switch.stories.js +0 -0
  300. /package/styles/{v2/components → components}/Switch/index.js +0 -0
  301. /package/styles/{v2/components → components}/Switch/styles/index.js +0 -0
  302. /package/styles/{v2/components → components}/Table/Table.jsx +0 -0
  303. /package/styles/{v2/components → components}/Table/Table.stories.js +0 -0
  304. /package/styles/{v2/components → components}/Table/index.js +0 -0
  305. /package/styles/{v2/components → components}/Tabs/Tabs.stories.js +0 -0
  306. /package/styles/{v2/components → components}/Tabs/index.js +0 -0
  307. /package/styles/{v2/components → components}/Tabs/styles/index.js +0 -0
  308. /package/styles/{v2/components → components}/Text/Text.jsx +0 -0
  309. /package/styles/{v2/components → components}/Text/Text.stories.js +0 -0
  310. /package/styles/{v2/components → components}/Text/options.js +0 -0
  311. /package/styles/{v2/theme → theme}/base/breakpoints.js +0 -0
  312. /package/styles/{v2/theme → theme}/base/colors.js +0 -0
  313. /package/styles/{v2/theme → theme}/base/index.js +0 -0
  314. /package/styles/{v2/theme → theme}/base/sizes.js +0 -0
  315. /package/styles/{v2/theme → theme}/base/typography.js +0 -0
  316. /package/styles/{v2/theme → theme}/base/zindices.js +0 -0
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
11
-
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
13
-
14
- var _react = _interopRequireDefault(require("react"));
15
-
16
- var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
- var _excluded = ["className", "children"];
19
-
20
- var Label = function Label(_ref) {
21
- var className = _ref.className,
22
- children = _ref.children,
23
- additionalProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
24
- var classes = (0, _classnames.default)('Label', className);
25
- return /*#__PURE__*/_react.default.createElement("label", (0, _extends2.default)({
26
- className: classes
27
- }, additionalProps), children);
28
- };
29
-
30
- var _default = Label;
31
- exports.default = _default;
@@ -1,178 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
-
5
- var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
6
-
7
- var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
8
-
9
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
10
-
11
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
12
-
13
- Object.defineProperty(exports, "__esModule", {
14
- value: true
15
- });
16
- exports.default = void 0;
17
-
18
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
19
-
20
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
21
-
22
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
23
-
24
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
25
-
26
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
27
-
28
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
29
-
30
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
31
-
32
- var _bind = _interopRequireDefault(require("lodash/bind"));
33
-
34
- var _react = _interopRequireWildcard(require("react"));
35
-
36
- var _classnames = _interopRequireDefault(require("classnames"));
37
-
38
- var _ssrWindow = require("ssr-window");
39
-
40
- var _checkCircle = _interopRequireDefault(require("@spothero/icons/check-circle"));
41
-
42
- var _exclamationCircle = _interopRequireDefault(require("@spothero/icons/exclamation-circle"));
43
-
44
- var _exclamationTriangle = _interopRequireDefault(require("@spothero/icons/exclamation-triangle"));
45
-
46
- var _heroCar = _interopRequireDefault(require("@spothero/icons/hero-car"));
47
-
48
- var _times = _interopRequireDefault(require("@spothero/icons/times"));
49
-
50
- var _dom = _interopRequireDefault(require("@spothero/utils/dom"));
51
-
52
- var _Button = _interopRequireDefault(require("../v1/components/Button/Button"));
53
-
54
- var _NotificationPropTypes = _interopRequireDefault(require("./NotificationPropTypes"));
55
-
56
- function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
57
-
58
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
59
-
60
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
61
-
62
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
63
-
64
- var Notification = /*#__PURE__*/function (_Component) {
65
- (0, _inherits2.default)(Notification, _Component);
66
-
67
- var _super = _createSuper(Notification);
68
-
69
- function Notification(props) {
70
- var _this;
71
-
72
- (0, _classCallCheck2.default)(this, Notification);
73
- _this = _super.call(this, props);
74
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onHideClick", function (evt) {
75
- _this._hide();
76
- });
77
- var duration = props.duration,
78
- autoClose = props.autoClose;
79
-
80
- if (autoClose) {
81
- _this._hideTimeout = _ssrWindow.window.setTimeout((0, _bind.default)(_this._hide, (0, _assertThisInitialized2.default)(_this)), duration);
82
- }
83
-
84
- return _this;
85
- }
86
-
87
- (0, _createClass2.default)(Notification, [{
88
- key: "componentDidMount",
89
- value: function componentDidMount() {
90
- var _this2 = this;
91
-
92
- _ssrWindow.window.setTimeout(function () {
93
- _dom.default.addClass(_this2._notification, 'Notification-showing');
94
- }, 100);
95
- }
96
- }, {
97
- key: "_hide",
98
- value: function _hide() {
99
- var _this3 = this;
100
-
101
- var _this$props = this.props,
102
- onHidden = _this$props.onHidden,
103
- onRemove = _this$props.onRemove;
104
-
105
- if (this._hideTimeout) {
106
- _ssrWindow.window.clearTimeout(this._hideTimeout);
107
- }
108
-
109
- _dom.default.removeClass(this._notification, 'Notification-showing');
110
-
111
- _ssrWindow.window.setTimeout(function () {
112
- _dom.default.removeClass(_this3._notification, 'Notification-showing');
113
-
114
- if (onHidden) {
115
- onHidden(_this3.props);
116
- }
117
-
118
- onRemove();
119
- }, 500);
120
- }
121
- }, {
122
- key: "_renderIcon",
123
- value: function _renderIcon() {
124
- var type = this.props.type;
125
-
126
- switch (type) {
127
- case 'success':
128
- return /*#__PURE__*/_react.default.createElement(_checkCircle.default, null);
129
-
130
- case 'warning':
131
- return /*#__PURE__*/_react.default.createElement(_exclamationTriangle.default, null);
132
-
133
- case 'error':
134
- return /*#__PURE__*/_react.default.createElement(_exclamationCircle.default, null);
135
-
136
- case 'info':
137
- default:
138
- return /*#__PURE__*/_react.default.createElement(_heroCar.default, null);
139
- }
140
- }
141
- }, {
142
- key: "render",
143
- value: function render() {
144
- var _this4 = this;
145
-
146
- var _this$props2 = this.props,
147
- className = _this$props2.className,
148
- type = _this$props2.type,
149
- message = _this$props2.message,
150
- showClose = _this$props2.showClose;
151
- var classes = (0, _classnames.default)('Notification', "Notification-".concat(type), className);
152
- return /*#__PURE__*/_react.default.createElement("div", {
153
- className: classes,
154
- ref: function ref(node) {
155
- _this4._notification = node;
156
- }
157
- }, /*#__PURE__*/_react.default.createElement("div", {
158
- className: "Notification-content-container container"
159
- }, this._renderIcon(), /*#__PURE__*/_react.default.createElement("div", {
160
- className: "Notification-content"
161
- }, message), showClose && /*#__PURE__*/_react.default.createElement(_Button.default, {
162
- className: "Notification-hide",
163
- onClick: this._onHideClick
164
- }, /*#__PURE__*/_react.default.createElement(_times.default, {
165
- className: "Icon-cancel"
166
- }))));
167
- }
168
- }]);
169
- return Notification;
170
- }(_react.Component);
171
-
172
- exports.default = Notification;
173
- (0, _defineProperty2.default)(Notification, "defaultProps", {
174
- type: 'info',
175
- duration: 3000,
176
- showClose: true,
177
- autoClose: true
178
- });
@@ -1,131 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
-
5
- var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
6
-
7
- var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
8
-
9
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
10
-
11
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
12
-
13
- Object.defineProperty(exports, "__esModule", {
14
- value: true
15
- });
16
- exports.default = void 0;
17
-
18
- var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
19
-
20
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
21
-
22
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
23
-
24
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
25
-
26
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
27
-
28
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
29
-
30
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
31
-
32
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
33
-
34
- var _find = _interopRequireDefault(require("lodash/find"));
35
-
36
- var _react = _interopRequireWildcard(require("react"));
37
-
38
- var _classnames = _interopRequireDefault(require("classnames"));
39
-
40
- var _Notification = _interopRequireDefault(require("./Notification"));
41
-
42
- var _NotificationPropTypes = _interopRequireDefault(require("./NotificationPropTypes"));
43
-
44
- function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
45
-
46
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
47
-
48
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
49
-
50
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
51
-
52
- var NotificationContainer = /*#__PURE__*/function (_Component) {
53
- (0, _inherits2.default)(NotificationContainer, _Component);
54
-
55
- var _super = _createSuper(NotificationContainer);
56
-
57
- function NotificationContainer(props) {
58
- var _this;
59
-
60
- (0, _classCallCheck2.default)(this, NotificationContainer);
61
- _this = _super.call(this, props);
62
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
63
- currentNotification: _this.props.notification
64
- });
65
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onRemove", function () {
66
- _this._notificationQueue.shift(); // clear the state first so that it causes a re-render and the queue can be re-checked
67
-
68
-
69
- _this.setState({
70
- currentNotification: null
71
- });
72
- });
73
- var notification = props.notification;
74
- _this._notificationQueue = [];
75
-
76
- if (notification) {
77
- _this._notificationQueue.push(notification);
78
- }
79
-
80
- return _this;
81
- }
82
-
83
- (0, _createClass2.default)(NotificationContainer, [{
84
- key: "componentDidUpdate",
85
- value: function componentDidUpdate(prevProps, prevState) {
86
- var _this$props = this.props,
87
- notification = _this$props.notification,
88
- onQueueEmpty = _this$props.onQueueEmpty;
89
-
90
- this._checkQueue();
91
-
92
- if (prevState.currentNotification && !this.state.currentNotification && !this._notificationQueue.length && onQueueEmpty) {
93
- onQueueEmpty();
94
- } else if (notification && !(0, _find.default)(this._notificationQueue, {
95
- id: notification.id
96
- }) // eslint-disable-line react/prop-types
97
- ) {
98
- // eslint-disable-line react/prop-types
99
- this._notificationQueue.push(notification);
100
-
101
- this._checkQueue();
102
- }
103
- }
104
- }, {
105
- key: "_checkQueue",
106
- value: function _checkQueue() {
107
- if (this.state.currentNotification || !this._notificationQueue.length) {
108
- return;
109
- }
110
-
111
- this.setState({
112
- currentNotification: this._notificationQueue[0]
113
- });
114
- }
115
- }, {
116
- key: "render",
117
- value: function render() {
118
- var className = this.props.className;
119
- var currentNotification = this.state.currentNotification;
120
- var classes = (0, _classnames.default)('NotificationContainer', className);
121
- return /*#__PURE__*/_react.default.createElement("div", {
122
- className: classes
123
- }, currentNotification && /*#__PURE__*/_react.default.createElement(_Notification.default, (0, _extends2.default)({
124
- onRemove: this._onRemove
125
- }, currentNotification)));
126
- }
127
- }]);
128
- return NotificationContainer;
129
- }(_react.Component);
130
-
131
- exports.default = NotificationContainer;
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _default = {
13
- /** Additional class(es) to add to the component. */
14
- className: _propTypes.default.string,
15
-
16
- /** A unique ID to identify the notification with. The suggested way to create this is to use <a href="https://www.npmjs.com/package/uuid#quickstart---commonjs-recommended" target="_blank">uuid</a>. */
17
- id: _propTypes.default.string.isRequired,
18
-
19
- /** The message body of the notification. */
20
- message: _propTypes.default.node.isRequired,
21
-
22
- /** Determines the characteristics of the notification. */
23
- type: _propTypes.default.oneOf(['info', 'success', 'error', 'warning']),
24
-
25
- /** Whether to display the close button. */
26
- showClose: _propTypes.default.bool,
27
-
28
- /** The time (in milliseconds) that the notification stays open for. */
29
- duration: _propTypes.default.number,
30
-
31
- /** Whether the notification should close itself without having to click the close button after the specified duration. */
32
- autoClose: _propTypes.default.bool,
33
-
34
- /** A function to execute after the notification has been hidden. Will receive the notification's props. */
35
- onHidden: _propTypes.default.func
36
- };
37
- exports.default = _default;
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "NotificationContainer", {
9
- enumerable: true,
10
- get: function get() {
11
- return _NotificationContainer.default;
12
- }
13
- });
14
- Object.defineProperty(exports, "NotificationPropTypes", {
15
- enumerable: true,
16
- get: function get() {
17
- return _NotificationPropTypes.default;
18
- }
19
- });
20
-
21
- var _NotificationContainer = _interopRequireDefault(require("./NotificationContainer"));
22
-
23
- var _NotificationPropTypes = _interopRequireDefault(require("./NotificationPropTypes"));
@@ -1,201 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
-
5
- var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
6
-
7
- var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
8
-
9
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
10
-
11
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
12
-
13
- Object.defineProperty(exports, "__esModule", {
14
- value: true
15
- });
16
- exports.default = void 0;
17
-
18
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
19
-
20
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
21
-
22
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
23
-
24
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
25
-
26
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
27
-
28
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
29
-
30
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
31
-
32
- var _react = _interopRequireWildcard(require("react"));
33
-
34
- var _classnames = _interopRequireDefault(require("classnames"));
35
-
36
- var _Checkbox = _interopRequireDefault(require("../Checkbox/Checkbox"));
37
-
38
- var _FormElementError = _interopRequireDefault(require("../Form/FormElementError"));
39
-
40
- var _Label = _interopRequireDefault(require("../Label/Label"));
41
-
42
- var _TextButton = _interopRequireDefault(require("../v1/components/TextButton/TextButton"));
43
-
44
- var _TextInput = _interopRequireDefault(require("../TextInput/TextInput"));
45
-
46
- function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
-
48
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
49
-
50
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
51
-
52
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
53
-
54
- var PasswordControl = /*#__PURE__*/function (_Component) {
55
- (0, _inherits2.default)(PasswordControl, _Component);
56
-
57
- var _super = _createSuper(PasswordControl);
58
-
59
- function PasswordControl(props) {
60
- var _this;
61
-
62
- (0, _classCallCheck2.default)(this, PasswordControl);
63
- _this = _super.call(this, props);
64
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
65
- showPassword: false,
66
- isValid: true
67
- });
68
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onPasswordFocus", function () {
69
- var onFocus = _this.props.onFocus;
70
-
71
- if (onFocus) {
72
- onFocus();
73
- }
74
- });
75
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onPasswordChange", function (evt) {
76
- _this.setState({
77
- value: evt.target.value,
78
- isValid: true
79
- });
80
- });
81
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onInvalid", function (validationState) {
82
- var onInvalid = _this.props.onInvalid;
83
-
84
- _this.setState({
85
- isValid: validationState.valid
86
- });
87
-
88
- if (onInvalid) {
89
- onInvalid(validationState);
90
- }
91
- });
92
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onToggleShowPasswordChange", function () {
93
- _this._generateKey();
94
-
95
- _this.setState(function (prevState, props) {
96
- return {
97
- showPassword: !prevState.showPassword
98
- };
99
- });
100
- });
101
- var requiredError = props.requiredError,
102
- minLength = props.minLength;
103
- _this._pattern = minLength ? ".{".concat(minLength, ",}") : null;
104
-
105
- if (minLength) {
106
- _this._error = /*#__PURE__*/_react.default.createElement(_FormElementError.default, null, "Please enter at least ", minLength, " characters.");
107
- } else {
108
- _this._error = /*#__PURE__*/_react.default.createElement(_FormElementError.default, null, requiredError);
109
- }
110
-
111
- _this._generateKey();
112
-
113
- return _this;
114
- }
115
-
116
- (0, _createClass2.default)(PasswordControl, [{
117
- key: "_generateKey",
118
- value: function _generateKey() {
119
- this._key = "password-".concat(Date.now());
120
- }
121
- /**
122
- * Provides the form data as an object for submission.
123
- *
124
- * @public
125
- * @returns {Object} - The form data to submit.
126
- */
127
-
128
- }, {
129
- key: "submit",
130
- value: function submit() {
131
- var value = this._input.node.value;
132
- return value ? {
133
- password: value
134
- } : null;
135
- }
136
- }, {
137
- key: "render",
138
- value: function render() {
139
- var _this2 = this;
140
-
141
- var _this$props = this.props,
142
- className = _this$props.className,
143
- showCheckboxId = _this$props.showCheckboxId,
144
- showForgotPassword = _this$props.showForgotPassword,
145
- label = _this$props.label,
146
- placeholder = _this$props.placeholder,
147
- showPlaceholder = _this$props.showPlaceholder,
148
- helpNode = _this$props.helpNode,
149
- required = _this$props.required,
150
- onForgotPasswordClick = _this$props.onForgotPasswordClick;
151
- var _this$state = this.state,
152
- value = _this$state.value,
153
- showPassword = _this$state.showPassword,
154
- isValid = _this$state.isValid;
155
- var classes = (0, _classnames.default)('PasswordControl', 'FormElement', {
156
- 'FormElement-contains-error': !isValid
157
- }, className);
158
- return /*#__PURE__*/_react.default.createElement("div", {
159
- className: classes
160
- }, label, /*#__PURE__*/_react.default.createElement("div", {
161
- className: "PasswordControl-input"
162
- }, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
163
- key: this._key,
164
- ref: function ref(node) {
165
- _this2._input = node;
166
- },
167
- name: "password",
168
- type: showPassword ? 'text' : 'password',
169
- required: required,
170
- pattern: this._pattern,
171
- defaultValue: value,
172
- placeholder: showPlaceholder && placeholder ? placeholder : '',
173
- onChange: this._onPasswordChange,
174
- onInvalid: this._onInvalid,
175
- onFocus: this._onPasswordFocus
176
- }), /*#__PURE__*/_react.default.createElement("div", {
177
- className: "PasswordControl-show"
178
- }, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
179
- id: showCheckboxId,
180
- label: /*#__PURE__*/_react.default.createElement(_Label.default, null, "Show"),
181
- onChange: this._onToggleShowPasswordChange
182
- }), /*#__PURE__*/_react.default.createElement(_TextButton.default, {
183
- onClick: this._onToggleShowPasswordChange
184
- }, showPassword ? 'Hide' : 'Show'))), helpNode && /*#__PURE__*/_react.default.createElement("div", {
185
- className: "FormElement-help-text"
186
- }, helpNode), !isValid && this._error, showForgotPassword && /*#__PURE__*/_react.default.createElement(_TextButton.default, {
187
- className: "PasswordControl-forgot",
188
- onClick: onForgotPasswordClick
189
- }, "Forgot Password?"));
190
- }
191
- }]);
192
- return PasswordControl;
193
- }(_react.Component);
194
-
195
- exports.default = PasswordControl;
196
- (0, _defineProperty2.default)(PasswordControl, "defaultProps", {
197
- showCheckboxId: 'PasswordControl-show-password',
198
- showForgotPassword: true,
199
- required: true,
200
- requiredError: 'Please enter your password.'
201
- });