@spothero/ui 15.10.8 → 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 (317) 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}/Popover/styles/index.js +1 -1
  21. package/styles/{v2/components/Popover/styles/popper.js → components/Popover/styles/popover-content.js} +8 -5
  22. package/styles/components/Popover/styles/popper.js +5 -0
  23. package/styles/{v2/components → components}/Skeleton/index.js +1 -1
  24. package/styles/{v2/components → components}/Spinner/Spinner.stories.js +1 -1
  25. package/styles/{v2/components → components}/Table/Table.styles.js +1 -1
  26. package/styles/{v2/components → components}/Tabs/Tabs.jsx +2 -3
  27. package/styles/{v2/components → components}/Tabs/combineSizeWithVariant.js +5 -3
  28. package/styles/{v2/components → components}/Text/Text.styles.js +1 -1
  29. package/styles/{v2/components → components}/Text/combineAsWithVariant.js +1 -1
  30. package/styles/{v2/components → components}/ThemeProvider/ThemeProvider.jsx +2 -2
  31. package/styles/{v2/components → components}/ThemeProvider/ThemeProvider.stories.js +2 -2
  32. package/v2/index.js +1 -1
  33. package/v2/index.js.map +1 -1
  34. package/backlog/Alert/Alert.js +0 -37
  35. package/backlog/AutoSuggestInput/AutoSuggestInput.js +0 -474
  36. package/backlog/AutoSuggestInput/AutoSuggestItem.js +0 -99
  37. package/backlog/AutoSuggestInput/AutoSuggestList.js +0 -126
  38. package/backlog/Badge/Badge.js +0 -28
  39. package/backlog/Chart/Chart.js +0 -211
  40. package/backlog/Checkbox/Checkbox.js +0 -167
  41. package/backlog/DateTime/DatePicker.js +0 -279
  42. package/backlog/DateTime/DatePickerCalendar.js +0 -199
  43. package/backlog/DateTime/DatePickerCalendarNavigation.js +0 -102
  44. package/backlog/DateTime/DatePickerCalendarWithRange.js +0 -241
  45. package/backlog/DateTime/DateTimePicker.js +0 -216
  46. package/backlog/DateTime/DateTimeRangePicker.js +0 -530
  47. package/backlog/DateTime/TimePicker.js +0 -180
  48. package/backlog/DateTime/date-time-assertions.js +0 -66
  49. package/backlog/DateTime/index.js +0 -55
  50. package/backlog/ErrorBoundary/ErrorBoundary.js +0 -125
  51. package/backlog/Flyout/Flyout.js +0 -198
  52. package/backlog/Form/Form.js +0 -193
  53. package/backlog/Form/FormElementError.js +0 -24
  54. package/backlog/Form/FormGroup.js +0 -30
  55. package/backlog/Form/FormGroupError.js +0 -28
  56. package/backlog/Form/index.js +0 -39
  57. package/backlog/GooglePlacesSearchInput/GooglePlacesSearchInput.js +0 -253
  58. package/backlog/GooglePlacesSearchInput/PoweredByGoogle.js +0 -38
  59. package/backlog/GooglePlacesSearchInput/index.js +0 -23
  60. package/backlog/HorizontalRule/HorizontalRule.js +0 -30
  61. package/backlog/Label/Label.js +0 -31
  62. package/backlog/Notification/Notification.js +0 -178
  63. package/backlog/Notification/NotificationContainer.js +0 -131
  64. package/backlog/Notification/NotificationPropTypes.js +0 -37
  65. package/backlog/Notification/index.js +0 -23
  66. package/backlog/PasswordControl/PasswordControl.js +0 -201
  67. package/backlog/Portal/Portal.js +0 -110
  68. package/backlog/PulseLoader/PulseLoader.js +0 -62
  69. package/backlog/Radio/Radio.js +0 -135
  70. package/backlog/Radio/RadioGroup.js +0 -123
  71. package/backlog/Radio/index.js +0 -23
  72. package/backlog/RenderInBody/RenderInBody.js +0 -103
  73. package/backlog/Select/Select.js +0 -275
  74. package/backlog/Select/SelectItemPropTypes.js +0 -32
  75. package/backlog/Select/index.js +0 -23
  76. package/backlog/SelectControlled/SelectControlled.js +0 -270
  77. package/backlog/SelectControlled/index.js +0 -15
  78. package/backlog/Sprite/Sprite.js +0 -24
  79. package/backlog/Tabs/Tab.js +0 -94
  80. package/backlog/Tabs/TabContent.js +0 -56
  81. package/backlog/Tabs/TabNavigation.js +0 -108
  82. package/backlog/Tabs/TabPanel.js +0 -29
  83. package/backlog/Tabs/Tabs.js +0 -126
  84. package/backlog/Tabs/index.js +0 -47
  85. package/backlog/TextArea/TextArea.js +0 -155
  86. package/backlog/TextInput/TextInput.js +0 -230
  87. package/backlog/TextInput/TextInputPropTypes.js +0 -114
  88. package/backlog/TextInput/index.js +0 -23
  89. package/backlog/Tooltip/Tooltip.js +0 -249
  90. package/backlog/index.js +0 -393
  91. package/backlog/v1/components/Button/Button.js +0 -64
  92. package/backlog/v1/components/Button/button-props.js +0 -48
  93. package/backlog/v1/components/Image/Image.js +0 -193
  94. package/backlog/v1/components/Loader/Loader.js +0 -51
  95. package/backlog/v1/components/Modal/Modal.js +0 -325
  96. package/backlog/v1/components/Modal/ModalContent.js +0 -154
  97. package/backlog/v1/components/Modal/ModalFooter.js +0 -89
  98. package/backlog/v1/components/Modal/index.js +0 -31
  99. package/backlog/v1/components/Panel/Panel.js +0 -209
  100. package/backlog/v1/components/Table/Table.js +0 -336
  101. package/backlog/v1/components/Table/TableCell.js +0 -28
  102. package/backlog/v1/components/Table/TableCellPropTypes.js +0 -22
  103. package/backlog/v1/components/Table/TableControls.js +0 -56
  104. package/backlog/v1/components/Table/TableFooter.js +0 -63
  105. package/backlog/v1/components/Table/TableHeading.js +0 -126
  106. package/backlog/v1/components/Table/TableHeadingPropTypes.js +0 -35
  107. package/backlog/v1/components/Table/TableSortSelector.js +0 -125
  108. package/backlog/v1/components/Table/TableSortType.js +0 -11
  109. package/backlog/v1/components/Table/index.js +0 -47
  110. package/backlog/v1/components/TextButton/TextButton.js +0 -74
  111. package/backlog/v1/components/index.js +0 -75
  112. package/backlog/v1/utils/deprecate.js +0 -61
  113. package/styles/Alert/_Alert.scss +0 -51
  114. package/styles/AutoSuggestInput/_AutoSuggestInput.scss +0 -116
  115. package/styles/Badge/_Badge.scss +0 -33
  116. package/styles/Chart/_Chart.scss +0 -105
  117. package/styles/Chart/_chartist-settings.scss +0 -131
  118. package/styles/Chart/_chartist.scss +0 -295
  119. package/styles/Checkbox/_Checkbox.scss +0 -173
  120. package/styles/DateTime/_DatePicker.scss +0 -61
  121. package/styles/DateTime/_DatePickerCalendar.scss +0 -159
  122. package/styles/DateTime/_DateTime.scss +0 -4
  123. package/styles/DateTime/_DateTimePicker.scss +0 -46
  124. package/styles/DateTime/_TimePicker.scss +0 -30
  125. package/styles/ErrorBoundary/_ErrorBoundary.scss +0 -18
  126. package/styles/Flyout/_Flyout.scss +0 -73
  127. package/styles/Form/_Form.scss +0 -53
  128. package/styles/GooglePlacesSearchInput/_GooglePlacesSearchInput.scss +0 -3
  129. package/styles/GooglePlacesSearchInput/_PoweredByGoogle.scss +0 -21
  130. package/styles/HorizontalRule/_HorizontalRule.scss +0 -48
  131. package/styles/Label/_Label.scss +0 -6
  132. package/styles/Notification/_Notification.scss +0 -113
  133. package/styles/PasswordControl/_PasswordControl.scss +0 -86
  134. package/styles/PulseLoader/_PulseLoader.scss +0 -60
  135. package/styles/Radio/_Radio.scss +0 -93
  136. package/styles/Select/_Select.scss +0 -94
  137. package/styles/Tabs/_Tabs.scss +0 -57
  138. package/styles/TextArea/_TextArea.scss +0 -26
  139. package/styles/TextInput/_TextInput.scss +0 -43
  140. package/styles/Tooltip/_Tooltip.scss +0 -108
  141. package/styles/_index.scss +0 -34
  142. package/styles/common/sass/_control-sizing.scss +0 -5
  143. package/styles/common/sass/_disable-scrolling.scss +0 -7
  144. package/styles/common/sass/_forms.scss +0 -72
  145. package/styles/index.js +0 -50
  146. package/styles/v1/components/Button/Button.jsx +0 -48
  147. package/styles/v1/components/Button/Button.spec.js +0 -76
  148. package/styles/v1/components/Button/_Button.scss +0 -178
  149. package/styles/v1/components/Button/button-props.js +0 -30
  150. package/styles/v1/components/Button/stories/button.js +0 -20
  151. package/styles/v1/components/Button/stories/index.stories.js +0 -92
  152. package/styles/v1/components/Button/stories/overview.js +0 -87
  153. package/styles/v1/components/Button/stories/types.js +0 -31
  154. package/styles/v1/components/Image/Image.jsx +0 -175
  155. package/styles/v1/components/Image/Image.spec.js +0 -113
  156. package/styles/v1/components/Image/_Image.scss +0 -24
  157. package/styles/v1/components/Image/stories/Cloudinary.stories.js +0 -39
  158. package/styles/v1/components/Image/stories/Display.stories.js +0 -92
  159. package/styles/v1/components/Loader/Loader.jsx +0 -54
  160. package/styles/v1/components/Loader/Loader.spec.js +0 -67
  161. package/styles/v1/components/Loader/_Loader.scss +0 -18
  162. package/styles/v1/components/Loader/stories/Display.stories.js +0 -55
  163. package/styles/v1/components/Modal/Modal.jsx +0 -315
  164. package/styles/v1/components/Modal/Modal.spec.js +0 -293
  165. package/styles/v1/components/Modal/ModalContent.jsx +0 -126
  166. package/styles/v1/components/Modal/ModalFooter.jsx +0 -53
  167. package/styles/v1/components/Modal/_Modal.scss +0 -262
  168. package/styles/v1/components/Modal/index.js +0 -3
  169. package/styles/v1/components/Modal/stories/Content.stories.js +0 -314
  170. package/styles/v1/components/Modal/stories/Display.stories.js +0 -208
  171. package/styles/v1/components/Modal/stories/Methods.stories.js +0 -44
  172. package/styles/v1/components/Modal/stories/Width.stories.js +0 -82
  173. package/styles/v1/components/Modal/stories/helpers/ReduxConsumer.jsx +0 -21
  174. package/styles/v1/components/Panel/Panel.jsx +0 -202
  175. package/styles/v1/components/Panel/Panel.spec.js +0 -196
  176. package/styles/v1/components/Panel/_Panel.scss +0 -55
  177. package/styles/v1/components/Panel/stories/Display.stories.js +0 -82
  178. package/styles/v1/components/Panel/stories/Methods.stories.js +0 -76
  179. package/styles/v1/components/Table/Table.jsx +0 -367
  180. package/styles/v1/components/Table/Table.spec.js +0 -526
  181. package/styles/v1/components/Table/TableCell.jsx +0 -17
  182. package/styles/v1/components/Table/TableCellPropTypes.js +0 -10
  183. package/styles/v1/components/Table/TableControls.jsx +0 -61
  184. package/styles/v1/components/Table/TableFooter.jsx +0 -72
  185. package/styles/v1/components/Table/TableHeading.jsx +0 -58
  186. package/styles/v1/components/Table/TableHeadingPropTypes.js +0 -20
  187. package/styles/v1/components/Table/TableSortSelector.jsx +0 -63
  188. package/styles/v1/components/Table/TableSortType.js +0 -4
  189. package/styles/v1/components/Table/_Table.scss +0 -263
  190. package/styles/v1/components/Table/index.js +0 -5
  191. package/styles/v1/components/Table/stories/Display.stories.js +0 -194
  192. package/styles/v1/components/Table/stories/Methods.stories.js +0 -141
  193. package/styles/v1/components/Table/stories/helpers/TableCellEmail.jsx +0 -25
  194. package/styles/v1/components/Table/stories/helpers/TableCustomRow.jsx +0 -35
  195. package/styles/v1/components/Table/stories/helpers/TableHeadingEmail.jsx +0 -20
  196. package/styles/v1/components/Table/stories/helpers/table-data.js +0 -26
  197. package/styles/v1/components/Table/stories/helpers/table-headers.js +0 -14
  198. package/styles/v1/components/TextButton/TextButton.jsx +0 -78
  199. package/styles/v1/components/TextButton/TextButton.spec.js +0 -95
  200. package/styles/v1/components/TextButton/_TextButton.scss +0 -114
  201. package/styles/v1/components/TextButton/stories/Display.stories.js +0 -46
  202. package/styles/v1/components/index.js +0 -7
  203. package/styles/v1/utils/deprecate.js +0 -45
  204. package/styles/v2/components/Popover/styles/popover-content.js +0 -8
  205. package/styles/v2/components/index.js +0 -70
  206. package/styles/v2/components/styles.js +0 -21
  207. package/styles/v2/theme/global.js +0 -118
  208. package/styles/v2/theme/index.js +0 -27
  209. package/styles/v2/utils/Spaces.js +0 -16
  210. package/v1/assets-manifest.json +0 -5
  211. package/v1/index.html +0 -1
  212. package/v1/index.js +0 -3
  213. package/v1/index.js.LICENSE.txt +0 -23
  214. package/v1/index.js.map +0 -1
  215. /package/styles/{v2/components → components}/Accordion/Accordion.jsx +0 -0
  216. /package/styles/{v2/components → components}/Accordion/index.js +0 -0
  217. /package/styles/{v2/components → components}/Accordion/styles/container.js +0 -0
  218. /package/styles/{v2/components → components}/Accordion/styles/index.js +0 -0
  219. /package/styles/{v2/components → components}/Accordion/styles/panel.js +0 -0
  220. /package/styles/{v2/components → components}/Alert/Alert.stories.js +0 -0
  221. /package/styles/{v2/components → components}/Alert/index.js +0 -0
  222. /package/styles/{v2/components → components}/Alert/styles/index.js +0 -0
  223. /package/styles/{v2/components → components}/AutoSuggestSelect/index.js +0 -0
  224. /package/styles/{v2/components → components}/Badge/Badge.jsx +0 -0
  225. /package/styles/{v2/components → components}/Badge/Badge.stories.js +0 -0
  226. /package/styles/{v2/components → components}/Badge/styles/index.js +0 -0
  227. /package/styles/{v2/components → components}/Button/Button.jsx +0 -0
  228. /package/styles/{v2/components → components}/Button/Button.spec.js +0 -0
  229. /package/styles/{v2/components → components}/Button/Button.styles.js +0 -0
  230. /package/styles/{v2/components → components}/Button/button-props.js +0 -0
  231. /package/styles/{v2/components → components}/Button/index.js +0 -0
  232. /package/styles/{v2/components → components}/Button/stories/index.stories.js +0 -0
  233. /package/styles/{v2/components → components}/Card/Card.jsx +0 -0
  234. /package/styles/{v2/components → components}/Card/Card.stories.js +0 -0
  235. /package/styles/{v2/components → components}/Checkbox/Checkbox.jsx +0 -0
  236. /package/styles/{v2/components → components}/Checkbox/Checkbox.stories.js +0 -0
  237. /package/styles/{v2/components → components}/Checkbox/index.js +0 -0
  238. /package/styles/{v2/components → components}/Checkbox/styles/index.js +0 -0
  239. /package/styles/{v2/components → components}/Container/Container.jsx +0 -0
  240. /package/styles/{v2/components → components}/Container/Container.stories.js +0 -0
  241. /package/styles/{v2/components → components}/Container/Container.styles.js +0 -0
  242. /package/styles/{v2/components → components}/Divider/Divider.jsx +0 -0
  243. /package/styles/{v2/components → components}/Divider/Divider.stories.js +0 -0
  244. /package/styles/{v2/components → components}/Divider/Divider.styles.js +0 -0
  245. /package/styles/{v2/components → components}/Grid/Grid.jsx +0 -0
  246. /package/styles/{v2/components → components}/Grid/Grid.styles.js +0 -0
  247. /package/styles/{v2/components → components}/Grid/GridItem.jsx +0 -0
  248. /package/styles/{v2/components → components}/Grid/GridItem.styles.js +0 -0
  249. /package/styles/{v2/components → components}/Grid/index.js +0 -0
  250. /package/styles/{v2/components → components}/Heading/Heading.jsx +0 -0
  251. /package/styles/{v2/components → components}/Heading/Heading.stories.js +0 -0
  252. /package/styles/{v2/components → components}/Icon/Icon.jsx +0 -0
  253. /package/styles/{v2/components → components}/Icon/Icon.stories.js +0 -0
  254. /package/styles/{v2/components → components}/Image/Image.spec.js +0 -0
  255. /package/styles/{v2/components → components}/Image/Image.stories.js +0 -0
  256. /package/styles/{v2/components → components}/Input/Input.jsx +0 -0
  257. /package/styles/{v2/components → components}/Input/Input.stories.js +0 -0
  258. /package/styles/{v2/components → components}/Input/index.js +0 -0
  259. /package/styles/{v2/components → components}/Input/styles/index.js +0 -0
  260. /package/styles/{v2/components → components}/Link/Link.jsx +0 -0
  261. /package/styles/{v2/components → components}/Link/Link.styles.js +0 -0
  262. /package/styles/{v2/components → components}/List/List.jsx +0 -0
  263. /package/styles/{v2/components → components}/List/index.js +0 -0
  264. /package/styles/{v2/components → components}/List/styles/index.js +0 -0
  265. /package/styles/{v2/components → components}/List/styles/item.styles.js +0 -0
  266. /package/styles/{v2/components → components}/Loader/Loader.jsx +0 -0
  267. /package/styles/{v2/components → components}/Loader/Loader.stories.js +0 -0
  268. /package/styles/{v2/components → components}/Modal/index.js +0 -0
  269. /package/styles/{v2/components → components}/Modal/styles/body.js +0 -0
  270. /package/styles/{v2/components → components}/Modal/styles/closeButton.js +0 -0
  271. /package/styles/{v2/components → components}/Modal/styles/dialog.js +0 -0
  272. /package/styles/{v2/components → components}/Modal/styles/dialogContainer.js +0 -0
  273. /package/styles/{v2/components → components}/Modal/styles/footer.js +0 -0
  274. /package/styles/{v2/components → components}/Modal/styles/header.js +0 -0
  275. /package/styles/{v2/components → components}/Modal/styles/index.js +0 -0
  276. /package/styles/{v2/components → components}/Modal/styles/overlay.js +0 -0
  277. /package/styles/{v2/components → components}/Popover/Popover.jsx +0 -0
  278. /package/styles/{v2/components → components}/Popover/PopoverArrow.jsx +0 -0
  279. /package/styles/{v2/components → components}/Popover/PopoverCloseButton.jsx +0 -0
  280. /package/styles/{v2/components → components}/Popover/PopoverContent.jsx +0 -0
  281. /package/styles/{v2/components → components}/Popover/index.js +0 -0
  282. /package/styles/{v2/components → components}/Popover/styles/popover-arrow.js +0 -0
  283. /package/styles/{v2/components → components}/Popover/styles/popover-body.js +0 -0
  284. /package/styles/{v2/components → components}/Popover/styles/popover-close-button.js +0 -0
  285. /package/styles/{v2/components → components}/Popover/styles/popover-header.js +0 -0
  286. /package/styles/{v2/components → components}/Radio/Radio.jsx +0 -0
  287. /package/styles/{v2/components → components}/Radio/Radio.stories.js +0 -0
  288. /package/styles/{v2/components → components}/Radio/RadioGroup.jsx +0 -0
  289. /package/styles/{v2/components → components}/Radio/index.js +0 -0
  290. /package/styles/{v2/components → components}/Radio/styles/index.js +0 -0
  291. /package/styles/{v2/components → components}/Select/Select.jsx +0 -0
  292. /package/styles/{v2/components → components}/Select/Select.stories.js +0 -0
  293. /package/styles/{v2/components → components}/Select/index.js +0 -0
  294. /package/styles/{v2/components → components}/Select/styles/index.js +0 -0
  295. /package/styles/{v2/components → components}/Skeleton/Skeleton.stories.jsx +0 -0
  296. /package/styles/{v2/components → components}/Skeleton/Skeleton.styles.js +0 -0
  297. /package/styles/{v2/components → components}/Spinner/Spinner.jsx +0 -0
  298. /package/styles/{v2/components → components}/Spinner/Spinner.styles.js +0 -0
  299. /package/styles/{v2/components → components}/Switch/Switch.jsx +0 -0
  300. /package/styles/{v2/components → components}/Switch/Switch.stories.js +0 -0
  301. /package/styles/{v2/components → components}/Switch/index.js +0 -0
  302. /package/styles/{v2/components → components}/Switch/styles/index.js +0 -0
  303. /package/styles/{v2/components → components}/Table/Table.jsx +0 -0
  304. /package/styles/{v2/components → components}/Table/Table.stories.js +0 -0
  305. /package/styles/{v2/components → components}/Table/index.js +0 -0
  306. /package/styles/{v2/components → components}/Tabs/Tabs.stories.js +0 -0
  307. /package/styles/{v2/components → components}/Tabs/index.js +0 -0
  308. /package/styles/{v2/components → components}/Tabs/styles/index.js +0 -0
  309. /package/styles/{v2/components → components}/Text/Text.jsx +0 -0
  310. /package/styles/{v2/components → components}/Text/Text.stories.js +0 -0
  311. /package/styles/{v2/components → components}/Text/options.js +0 -0
  312. /package/styles/{v2/theme → theme}/base/breakpoints.js +0 -0
  313. /package/styles/{v2/theme → theme}/base/colors.js +0 -0
  314. /package/styles/{v2/theme → theme}/base/index.js +0 -0
  315. /package/styles/{v2/theme → theme}/base/sizes.js +0 -0
  316. /package/styles/{v2/theme → theme}/base/typography.js +0 -0
  317. /package/styles/{v2/theme → theme}/base/zindices.js +0 -0
@@ -1,275 +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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
21
-
22
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
23
-
24
- var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
25
-
26
- var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
27
-
28
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
29
-
30
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
31
-
32
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
33
-
34
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
35
-
36
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
37
-
38
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
39
-
40
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
41
-
42
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
43
-
44
- var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
45
-
46
- var _react = _interopRequireWildcard(require("react"));
47
-
48
- var _classnames = _interopRequireDefault(require("classnames"));
49
-
50
- var _chevronDown = _interopRequireDefault(require("@spothero/icons/chevron-down"));
51
-
52
- var _dom = _interopRequireDefault(require("@spothero/utils/dom"));
53
-
54
- var _Loader = _interopRequireDefault(require("../v1/components/Loader/Loader"));
55
-
56
- var _omit = _interopRequireDefault(require("lodash/omit"));
57
-
58
- var _excluded = ["optgroup"],
59
- _excluded2 = ["className", "name", "items", "disabled", "loading", "error", "helpNode", "label", "dropdownIcon", "icon", "iconPosition", "required", "inline", "defaultValue", "placeholder", "onFocus"];
60
-
61
- 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); }
62
-
63
- 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; }
64
-
65
- 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); }; }
66
-
67
- 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; } }
68
-
69
- // import {
70
- // SelectItemPropTypes,
71
- // OptgroupPropTypes
72
- // } from './SelectItemPropTypes';
73
- var Select = /*#__PURE__*/function (_Component) {
74
- (0, _inherits2.default)(Select, _Component);
75
-
76
- var _super = _createSuper(Select);
77
-
78
- function Select() {
79
- var _context;
80
-
81
- var _this;
82
-
83
- (0, _classCallCheck2.default)(this, Select);
84
-
85
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
86
- args[_key] = arguments[_key];
87
- }
88
-
89
- _this = _super.call.apply(_super, (0, _concat.default)(_context = [this]).call(_context, args));
90
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
91
- validationState: null
92
- });
93
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_isFirstRender", true);
94
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onInvalid", function (evt) {
95
- evt.preventDefault();
96
- var onInvalid = _this.props.onInvalid;
97
- var validationState = evt.currentTarget.validity;
98
-
99
- _this.setState({
100
- validationState: validationState
101
- });
102
-
103
- if (onInvalid) {
104
- onInvalid(validationState);
105
- }
106
- });
107
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onChange", function (evt) {
108
- var _context2;
109
-
110
- var _this$props = _this.props,
111
- items = _this$props.items,
112
- onChange = _this$props.onChange;
113
- var selectedItem = (0, _find.default)(_context2 = items.reduce(function (options, _ref) {
114
- var _context3, _context4;
115
-
116
- var optgroup = _ref.optgroup,
117
- item = (0, _objectWithoutProperties2.default)(_ref, _excluded);
118
- return optgroup ? (0, _concat.default)(_context3 = []).call(_context3, (0, _toConsumableArray2.default)(options), (0, _toConsumableArray2.default)(optgroup)) : (0, _concat.default)(_context4 = []).call(_context4, (0, _toConsumableArray2.default)(options), [item]);
119
- }, [])).call(_context2, function (_ref2) {
120
- var value = _ref2.value;
121
- return value === evt.target.value;
122
- });
123
-
124
- _this.setState({
125
- validationState: null
126
- });
127
-
128
- if (onChange) {
129
- onChange(selectedItem);
130
- }
131
- });
132
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_renderOptgroup", function (_ref3) {
133
- var label = _ref3.label,
134
- optgroup = _ref3.optgroup;
135
- return /*#__PURE__*/_react.default.createElement("optgroup", {
136
- key: label,
137
- label: label
138
- }, (0, _map.default)(optgroup).call(optgroup, _this._renderItem));
139
- });
140
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_renderItem", function (_ref4, i) {
141
- var _ref4$disabled = _ref4.disabled,
142
- disabled = _ref4$disabled === void 0 ? false : _ref4$disabled,
143
- _ref4$label = _ref4.label,
144
- label = _ref4$label === void 0 ? '' : _ref4$label,
145
- _ref4$value = _ref4.value,
146
- value = _ref4$value === void 0 ? '' : _ref4$value;
147
- return /*#__PURE__*/_react.default.createElement("option", {
148
- key: i,
149
- value: value,
150
- disabled: disabled
151
- }, label);
152
- });
153
- return _this;
154
- }
155
-
156
- (0, _createClass2.default)(Select, [{
157
- key: "componentDidMount",
158
- value: function componentDidMount() {
159
- // if a placeholder is present on first render, we want to use this for setting the placeholder class to avoid a flash
160
- // in the coloring of the placeholder text in the field on initial load
161
- this._isFirstRender = false;
162
-
163
- this._select.addEventListener('invalid', this._onInvalid);
164
- }
165
- }, {
166
- key: "componentDidUpdate",
167
- value: function componentDidUpdate(prevProps, prevState, snapshot) {
168
- this._checkIfDisabledSelected();
169
- }
170
- }, {
171
- key: "componentWillUnmount",
172
- value: function componentWillUnmount() {
173
- this._select.removeEventListener('invalid', this._onInvalid);
174
- }
175
- }, {
176
- key: "_checkIfDisabledSelected",
177
- value: function _checkIfDisabledSelected() {
178
- // if a disabled option is selected at first, make it the same color as placeholder as thats typically why its selected
179
- if ((0, _isEmpty.default)(this._select.value)) {
180
- _dom.default.addClass(this._select, 'FormElement-item-placeholder');
181
- } else {
182
- _dom.default.removeClass(this._select, 'FormElement-item-placeholder');
183
- }
184
- }
185
- }, {
186
- key: "node",
187
- get:
188
- /**
189
- * Getter for the select DOM element.
190
- *
191
- * @public
192
- * @returns {Element} - The select element.
193
- */
194
- function get() {
195
- return this._select;
196
- }
197
- }, {
198
- key: "render",
199
- value: function render() {
200
- var _this2 = this;
201
-
202
- var _this$props2 = this.props,
203
- className = _this$props2.className,
204
- name = _this$props2.name,
205
- items = _this$props2.items,
206
- disabled = _this$props2.disabled,
207
- loading = _this$props2.loading,
208
- error = _this$props2.error,
209
- helpNode = _this$props2.helpNode,
210
- label = _this$props2.label,
211
- dropdownIcon = _this$props2.dropdownIcon,
212
- icon = _this$props2.icon,
213
- iconPosition = _this$props2.iconPosition,
214
- required = _this$props2.required,
215
- inline = _this$props2.inline,
216
- defaultValue = _this$props2.defaultValue,
217
- placeholder = _this$props2.placeholder,
218
- onFocus = _this$props2.onFocus,
219
- attrs = (0, _objectWithoutProperties2.default)(_this$props2, _excluded2);
220
- var spreadProps = (0, _omit.default)(attrs, ['onChange', 'onInvalid']);
221
- var validationState = this.state.validationState;
222
- var isValid = validationState ? validationState.valid : true;
223
- var containerClasses = (0, _classnames.default)('Select', 'FormElement', {
224
- 'FormElement-inline': inline
225
- }, {
226
- 'FormElement-with-icon': icon
227
- }, (0, _defineProperty2.default)({}, "FormElement-with-icon-".concat(iconPosition), icon), {
228
- 'FormElement-contains-error': !isValid
229
- }, className);
230
- var itemClasses = (0, _classnames.default)('FormElement-item', {
231
- 'FormElement-item-placeholder': placeholder && !defaultValue && this._isFirstRender
232
- });
233
- var customIconClasses = (0, _classnames.default)('Select-dropdown-icon', dropdownIcon ? dropdownIcon.props.className : null);
234
- var newDefaultValue = placeholder && !defaultValue ? '' : defaultValue;
235
- return /*#__PURE__*/_react.default.createElement("div", {
236
- className: containerClasses
237
- }, label, /*#__PURE__*/_react.default.createElement("div", {
238
- className: "FormElement-control"
239
- }, /*#__PURE__*/_react.default.createElement("select", (0, _extends2.default)({
240
- ref: function ref(node) {
241
- _this2._select = node;
242
- },
243
- className: itemClasses,
244
- name: name,
245
- required: required,
246
- disabled: disabled,
247
- defaultValue: newDefaultValue,
248
- onFocus: onFocus,
249
- onChange: this._onChange
250
- }, spreadProps), placeholder && /*#__PURE__*/_react.default.createElement("option", {
251
- value: "",
252
- disabled: true
253
- }, placeholder), (0, _map.default)(items).call(items, function (item, i) {
254
- return item.optgroup ? _this2._renderOptgroup(item) : _this2._renderItem(item, i);
255
- })), loading ? /*#__PURE__*/_react.default.createElement(_Loader.default, {
256
- size: 16,
257
- borderWidth: 2
258
- }) : dropdownIcon ? /*#__PURE__*/(0, _react.cloneElement)(dropdownIcon, {
259
- className: customIconClasses
260
- }) : /*#__PURE__*/_react.default.createElement(_chevronDown.default, {
261
- className: "Select-dropdown-icon"
262
- }), /*#__PURE__*/_react.default.createElement("span", {
263
- className: "Select-icon"
264
- }, icon)), helpNode && /*#__PURE__*/_react.default.createElement("div", {
265
- className: "FormElement-help-text"
266
- }, helpNode), !isValid && error);
267
- }
268
- }]);
269
- return Select;
270
- }(_react.Component);
271
-
272
- exports.default = Select;
273
- (0, _defineProperty2.default)(Select, "defaultProps", {
274
- iconPosition: 'left'
275
- });
@@ -1,32 +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 = exports.SelectItemPropTypes = exports.OptgroupPropTypes = void 0;
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var SelectItemPropTypes = {
13
- /** The label to display visually in the Select. */
14
- label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
15
-
16
- /** The value to return when a selection is made. */
17
- value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
18
-
19
- /** Whether the option is disabled. */
20
- disabled: _propTypes.default.bool
21
- };
22
- exports.SelectItemPropTypes = SelectItemPropTypes;
23
- var OptgroupPropTypes = {
24
- /** The optgroup label within the list of options */
25
- label: _propTypes.default.string,
26
-
27
- /** An array of options with label/value pairs */
28
- optgroup: _propTypes.default.arrayOf(_propTypes.default.shape(SelectItemPropTypes))
29
- };
30
- exports.OptgroupPropTypes = OptgroupPropTypes;
31
- var _default = SelectItemPropTypes;
32
- 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, "Select", {
9
- enumerable: true,
10
- get: function get() {
11
- return _Select.default;
12
- }
13
- });
14
- Object.defineProperty(exports, "SelectItemPropTypes", {
15
- enumerable: true,
16
- get: function get() {
17
- return _SelectItemPropTypes.default;
18
- }
19
- });
20
-
21
- var _Select = _interopRequireDefault(require("./Select"));
22
-
23
- var _SelectItemPropTypes = _interopRequireDefault(require("./SelectItemPropTypes"));
@@ -1,270 +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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/toConsumableArray"));
19
-
20
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
21
-
22
- var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
23
-
24
- var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
25
-
26
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
27
-
28
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
29
-
30
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
31
-
32
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
33
-
34
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
35
-
36
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
37
-
38
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
39
-
40
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
41
-
42
- var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
43
-
44
- var _react = _interopRequireWildcard(require("react"));
45
-
46
- var _classnames = _interopRequireDefault(require("classnames"));
47
-
48
- var _chevronDown = _interopRequireDefault(require("@spothero/icons/chevron-down"));
49
-
50
- var _dom = _interopRequireDefault(require("@spothero/utils/dom"));
51
-
52
- var _Loader = _interopRequireDefault(require("../v1/components/Loader/Loader"));
53
-
54
- var _excluded = ["optgroup"];
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
- // import {
65
- // SelectItemPropTypes,
66
- // OptgroupPropTypes
67
- // } from './SelectItemPropTypes';
68
- var SelectControlled = /*#__PURE__*/function (_Component) {
69
- (0, _inherits2.default)(SelectControlled, _Component);
70
-
71
- var _super = _createSuper(SelectControlled);
72
-
73
- function SelectControlled() {
74
- var _context;
75
-
76
- var _this;
77
-
78
- (0, _classCallCheck2.default)(this, SelectControlled);
79
-
80
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
81
- args[_key] = arguments[_key];
82
- }
83
-
84
- _this = _super.call.apply(_super, (0, _concat.default)(_context = [this]).call(_context, args));
85
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
86
- validationState: null
87
- });
88
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_isFirstRender", true);
89
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onInvalid", function (evt) {
90
- evt.preventDefault();
91
- var onInvalid = _this.props.onInvalid;
92
- var validationState = evt.currentTarget.validity;
93
-
94
- _this.setState({
95
- validationState: validationState
96
- });
97
-
98
- if (onInvalid) {
99
- onInvalid(validationState);
100
- }
101
- });
102
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_onChange", function (evt) {
103
- var _context2;
104
-
105
- var _this$props = _this.props,
106
- items = _this$props.items,
107
- onChange = _this$props.onChange;
108
- var selectedItem = (0, _find.default)(_context2 = items.reduce(function (options, _ref) {
109
- var _context3, _context4;
110
-
111
- var optgroup = _ref.optgroup,
112
- item = (0, _objectWithoutProperties2.default)(_ref, _excluded);
113
- return optgroup ? (0, _concat.default)(_context3 = []).call(_context3, (0, _toConsumableArray2.default)(options), (0, _toConsumableArray2.default)(optgroup)) : (0, _concat.default)(_context4 = []).call(_context4, (0, _toConsumableArray2.default)(options), [item]);
114
- }, [])).call(_context2, function (_ref2) {
115
- var value = _ref2.value;
116
- return value === evt.target.value;
117
- });
118
-
119
- _this.setState({
120
- validationState: null
121
- });
122
-
123
- if (onChange) {
124
- onChange(selectedItem);
125
- }
126
- });
127
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_renderOptgroup", function (_ref3) {
128
- var label = _ref3.label,
129
- optgroup = _ref3.optgroup;
130
- return /*#__PURE__*/_react.default.createElement("optgroup", {
131
- key: label,
132
- label: label
133
- }, (0, _map.default)(optgroup).call(optgroup, _this._renderItem));
134
- });
135
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_renderItem", function (_ref4, i) {
136
- var _ref4$disabled = _ref4.disabled,
137
- disabled = _ref4$disabled === void 0 ? false : _ref4$disabled,
138
- _ref4$label = _ref4.label,
139
- label = _ref4$label === void 0 ? '' : _ref4$label,
140
- _ref4$value = _ref4.value,
141
- value = _ref4$value === void 0 ? '' : _ref4$value;
142
- return /*#__PURE__*/_react.default.createElement("option", {
143
- key: i,
144
- value: value,
145
- disabled: disabled
146
- }, label);
147
- });
148
- return _this;
149
- }
150
-
151
- (0, _createClass2.default)(SelectControlled, [{
152
- key: "componentDidMount",
153
- value: function componentDidMount() {
154
- // if a placeholder is present on first render, we want to use this for setting the placeholder class to avoid a flash
155
- // in the coloring of the placeholder text in the field on initial load
156
- this._isFirstRender = false;
157
-
158
- this._select.addEventListener('invalid', this._onInvalid);
159
- }
160
- }, {
161
- key: "componentDidUpdate",
162
- value: function componentDidUpdate(prevProps, prevState, snapshot) {
163
- this._checkIfDisabledSelected();
164
- }
165
- }, {
166
- key: "componentWillUnmount",
167
- value: function componentWillUnmount() {
168
- this._select.removeEventListener('invalid', this._onInvalid);
169
- }
170
- }, {
171
- key: "_checkIfDisabledSelected",
172
- value: function _checkIfDisabledSelected() {
173
- // if a disabled option is selected at first, make it the same color as placeholder as thats typically why its selected
174
- if ((0, _isEmpty.default)(this._select.value)) {
175
- _dom.default.addClass(this._select, 'FormElement-item-placeholder');
176
- } else {
177
- _dom.default.removeClass(this._select, 'FormElement-item-placeholder');
178
- }
179
- }
180
- }, {
181
- key: "node",
182
- get:
183
- /**
184
- * Getter for the select DOM element.
185
- *
186
- * @public
187
- * @returns {Element} - The select element.
188
- */
189
- function get() {
190
- return this._select;
191
- }
192
- }, {
193
- key: "render",
194
- value: function render() {
195
- var _this2 = this;
196
-
197
- var _this$props2 = this.props,
198
- className = _this$props2.className,
199
- name = _this$props2.name,
200
- items = _this$props2.items,
201
- disabled = _this$props2.disabled,
202
- loading = _this$props2.loading,
203
- error = _this$props2.error,
204
- helpNode = _this$props2.helpNode,
205
- label = _this$props2.label,
206
- dropdownIcon = _this$props2.dropdownIcon,
207
- icon = _this$props2.icon,
208
- iconPosition = _this$props2.iconPosition,
209
- required = _this$props2.required,
210
- inline = _this$props2.inline,
211
- defaultValue = _this$props2.defaultValue,
212
- placeholder = _this$props2.placeholder,
213
- onFocus = _this$props2.onFocus,
214
- value = _this$props2.value;
215
- var validationState = this.state.validationState;
216
- var isValid = validationState ? validationState.valid : true;
217
- var containerClasses = (0, _classnames.default)('Select', 'FormElement', {
218
- 'FormElement-inline': inline
219
- }, {
220
- 'FormElement-with-icon': icon
221
- }, (0, _defineProperty2.default)({}, "FormElement-with-icon-".concat(iconPosition), icon), {
222
- 'FormElement-contains-error': !isValid
223
- }, className);
224
- var itemClasses = (0, _classnames.default)('FormElement-item', {
225
- 'FormElement-item-placeholder': placeholder && !defaultValue && this._isFirstRender
226
- });
227
- var customIconClasses = (0, _classnames.default)('Select-dropdown-icon', dropdownIcon ? dropdownIcon.props.className : null);
228
- var newDefaultValue = placeholder && !defaultValue ? '' : defaultValue;
229
- return /*#__PURE__*/_react.default.createElement("div", {
230
- className: containerClasses
231
- }, label, /*#__PURE__*/_react.default.createElement("div", {
232
- className: "FormElement-control"
233
- }, /*#__PURE__*/_react.default.createElement("select", {
234
- ref: function ref(node) {
235
- _this2._select = node;
236
- },
237
- className: itemClasses,
238
- name: name,
239
- required: required,
240
- disabled: disabled,
241
- defaultValue: newDefaultValue,
242
- onFocus: onFocus,
243
- onChange: this._onChange,
244
- value: value
245
- }, placeholder && /*#__PURE__*/_react.default.createElement("option", {
246
- value: "",
247
- disabled: true
248
- }, placeholder), (0, _map.default)(items).call(items, function (item, i) {
249
- return item.optgroup ? _this2._renderOptgroup(item) : _this2._renderItem(item, i);
250
- })), loading ? /*#__PURE__*/_react.default.createElement(_Loader.default, {
251
- size: 16,
252
- borderWidth: 2
253
- }) : dropdownIcon ? /*#__PURE__*/(0, _react.cloneElement)(dropdownIcon, {
254
- className: customIconClasses
255
- }) : /*#__PURE__*/_react.default.createElement(_chevronDown.default, {
256
- className: "Select-dropdown-icon"
257
- }), /*#__PURE__*/_react.default.createElement("span", {
258
- className: "Select-icon"
259
- }, icon)), helpNode && /*#__PURE__*/_react.default.createElement("div", {
260
- className: "FormElement-help-text"
261
- }, helpNode), !isValid && error);
262
- }
263
- }]);
264
- return SelectControlled;
265
- }(_react.Component);
266
-
267
- exports.default = SelectControlled;
268
- (0, _defineProperty2.default)(SelectControlled, "defaultProps", {
269
- iconPosition: 'left'
270
- });
@@ -1,15 +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, "SelectControlled", {
9
- enumerable: true,
10
- get: function get() {
11
- return _SelectControlled.default;
12
- }
13
- });
14
-
15
- var _SelectControlled = _interopRequireDefault(require("./SelectControlled"));
@@ -1,24 +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 _react = _interopRequireDefault(require("react"));
11
-
12
- var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
- var Sprite = function Sprite(_ref) {
15
- var className = _ref.className,
16
- name = _ref.name;
17
- var classes = (0, _classnames.default)('Sprite', "sprite-".concat(name), className);
18
- return /*#__PURE__*/_react.default.createElement("i", {
19
- className: classes
20
- });
21
- };
22
-
23
- var _default = Sprite;
24
- exports.default = _default;