@hipay/hipay-material-ui 1.0.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (675) hide show
  1. package/AppBar/AppBar.js +144 -0
  2. package/AppBar/index.js +16 -0
  3. package/Avatar/Avatar.js +165 -0
  4. package/Avatar/index.js +16 -0
  5. package/Badge/Badge.js +142 -0
  6. package/Badge/index.js +16 -0
  7. package/BottomNavigation/BottomNavigation.js +113 -0
  8. package/BottomNavigation/BottomNavigationAction.js +219 -0
  9. package/BottomNavigation/index.js +25 -0
  10. package/Button/Button.js +298 -0
  11. package/Button/index.js +16 -0
  12. package/ButtonBase/ButtonBase.js +446 -0
  13. package/ButtonBase/Ripple.js +162 -0
  14. package/ButtonBase/TouchRipple.js +359 -0
  15. package/ButtonBase/createRippleHandler.js +28 -0
  16. package/ButtonBase/index.js +16 -0
  17. package/CHANGELOG.md +5481 -0
  18. package/Card/Card.js +48 -0
  19. package/Card/CardActions.js +94 -0
  20. package/Card/CardContent.js +76 -0
  21. package/Card/CardHeader.js +150 -0
  22. package/Card/CardMedia.js +113 -0
  23. package/Card/index.js +52 -0
  24. package/Checkbox/Checkbox.js +160 -0
  25. package/Checkbox/index.js +16 -0
  26. package/Chip/Chip.js +322 -0
  27. package/Chip/index.js +16 -0
  28. package/Dialog/Dialog.js +271 -0
  29. package/Dialog/DialogActions.js +94 -0
  30. package/Dialog/DialogContent.js +77 -0
  31. package/Dialog/DialogContentText.js +72 -0
  32. package/Dialog/DialogTitle.js +91 -0
  33. package/Dialog/index.js +61 -0
  34. package/Dialog/withMobileDialog.js +49 -0
  35. package/Divider/Divider.js +113 -0
  36. package/Divider/index.js +16 -0
  37. package/Drawer/Drawer.js +325 -0
  38. package/Drawer/index.js +16 -0
  39. package/ExpansionPanel/ExpansionPanel.js +257 -0
  40. package/ExpansionPanel/ExpansionPanelActions.js +79 -0
  41. package/ExpansionPanel/ExpansionPanelDetails.js +73 -0
  42. package/ExpansionPanel/ExpansionPanelSummary.js +250 -0
  43. package/ExpansionPanel/index.js +43 -0
  44. package/Form/FormControl.js +291 -0
  45. package/Form/FormControlLabel.js +168 -0
  46. package/Form/FormGroup.js +94 -0
  47. package/Form/FormHelperText.js +139 -0
  48. package/Form/FormLabel.js +158 -0
  49. package/Form/index.js +52 -0
  50. package/Grid/Grid.js +372 -0
  51. package/Grid/index.js +16 -0
  52. package/GridList/GridList.js +122 -0
  53. package/GridList/GridListTile.js +239 -0
  54. package/GridList/GridListTileBar.js +176 -0
  55. package/GridList/index.js +34 -0
  56. package/HiBadge/HiBadge.js +107 -0
  57. package/HiBadge/index.js +16 -0
  58. package/HiButton/HiButton.js +159 -0
  59. package/HiButton/index.js +16 -0
  60. package/HiCheckbox/HiCheckbox.js +171 -0
  61. package/HiCheckbox/index.js +16 -0
  62. package/HiChip/HiChip.js +185 -0
  63. package/HiChip/HiChipSwitch.js +306 -0
  64. package/HiChip/index.js +25 -0
  65. package/HiColoredLabel/HiColoredLabel.js +116 -0
  66. package/HiColoredLabel/index.js +16 -0
  67. package/HiDatePicker/Caption.js +93 -0
  68. package/HiDatePicker/HiDatePicker.js +411 -0
  69. package/HiDatePicker/HiDateRangePicker.js +713 -0
  70. package/HiDatePicker/HiDateRangeSelector.js +414 -0
  71. package/HiDatePicker/HiWeekPicker.js +389 -0
  72. package/HiDatePicker/ListPicker.js +154 -0
  73. package/HiDatePicker/Navbar.js +169 -0
  74. package/HiDatePicker/Overlays/CustomOverlayLayout.js +142 -0
  75. package/HiDatePicker/Overlays/MonthPickerOverlay.js +137 -0
  76. package/HiDatePicker/Overlays/Overlay.js +105 -0
  77. package/HiDatePicker/Overlays/TimePickerOverlay.js +291 -0
  78. package/HiDatePicker/Overlays/YearPickerOverlay.js +173 -0
  79. package/HiDatePicker/Overlays/index.js +52 -0
  80. package/HiDatePicker/Weekday.js +52 -0
  81. package/HiDatePicker/index.js +33 -0
  82. package/HiDatePicker/stylesheet.js +188 -0
  83. package/HiForm/HiEmailField.js +126 -0
  84. package/HiForm/HiFormControl.js +377 -0
  85. package/HiForm/HiFormLabel.js +180 -0
  86. package/HiForm/HiInput.js +546 -0
  87. package/HiForm/HiPasswordField.js +134 -0
  88. package/HiForm/HiSearchField.js +192 -0
  89. package/HiForm/HiTextField.js +293 -0
  90. package/HiForm/index.js +70 -0
  91. package/HiLoader/HiLoader.js +55 -0
  92. package/HiLoader/index.js +16 -0
  93. package/HiPins/HiPins.js +99 -0
  94. package/HiPins/index.js +16 -0
  95. package/HiRadio/HiRadio.js +99 -0
  96. package/HiRadio/index.js +16 -0
  97. package/HiSelect/HiSelect.js +830 -0
  98. package/HiSelect/HiSelectField.js +160 -0
  99. package/HiSelect/HiSuggestSelect.js +306 -0
  100. package/HiSelect/HiSuggestSelectField.js +143 -0
  101. package/HiSelect/SelectInput.js +329 -0
  102. package/HiSelect/index.js +41 -0
  103. package/HiSelectableList/HiSelectableList.js +258 -0
  104. package/HiSelectableList/HiSelectableListItem.js +520 -0
  105. package/HiSelectableList/index.js +25 -0
  106. package/HiSwitch/HiSwitch.js +208 -0
  107. package/HiSwitch/HiSwitchState.js +229 -0
  108. package/HiSwitch/index.js +25 -0
  109. package/HiTable/BodyCellBuilder.js +398 -0
  110. package/HiTable/BodyCells/CellAccount.js +100 -0
  111. package/HiTable/BodyCells/CellAccountNumber.js +220 -0
  112. package/HiTable/BodyCells/CellAddress.js +199 -0
  113. package/HiTable/BodyCells/CellCountry.js +172 -0
  114. package/HiTable/BodyCells/CellDate.js +177 -0
  115. package/HiTable/BodyCells/CellIcon.js +148 -0
  116. package/HiTable/BodyCells/CellImage.js +177 -0
  117. package/HiTable/BodyCells/CellLayout.js +281 -0
  118. package/HiTable/BodyCells/CellNumeric.js +135 -0
  119. package/HiTable/BodyCells/CellRate.js +197 -0
  120. package/HiTable/BodyCells/CellSentinel.js +213 -0
  121. package/HiTable/BodyCells/CellStatus.js +136 -0
  122. package/HiTable/BodyCells/CellText.js +267 -0
  123. package/HiTable/BodyCells/CellThirdPartySecurity.js +144 -0
  124. package/HiTable/BodyCells/index.js +133 -0
  125. package/HiTable/BodyRow.js +388 -0
  126. package/HiTable/ChildRow.js +432 -0
  127. package/HiTable/ColumnFilter.js +490 -0
  128. package/HiTable/HeaderCell.js +463 -0
  129. package/HiTable/HiStickyRow.js +300 -0
  130. package/HiTable/HiTable.js +1012 -0
  131. package/HiTable/HiTableBody.js +547 -0
  132. package/HiTable/HiTableContextMenu.js +214 -0
  133. package/HiTable/HiTableFooterScroll.js +202 -0
  134. package/HiTable/HiTableHead.js +489 -0
  135. package/HiTable/OrderColumns.js +557 -0
  136. package/HiTable/constants.js +105 -0
  137. package/HiTable/index.js +25 -0
  138. package/HiTopBar/HiTopBar.js +635 -0
  139. package/HiTopBar/index.js +16 -0
  140. package/Hidden/Hidden.js +130 -0
  141. package/Hidden/HiddenCss.js +175 -0
  142. package/Hidden/HiddenJs.js +149 -0
  143. package/Hidden/index.js +16 -0
  144. package/Icon/Icon.js +109 -0
  145. package/Icon/index.js +16 -0
  146. package/IconButton/IconButton.js +146 -0
  147. package/IconButton/index.js +16 -0
  148. package/Input/Input.js +682 -0
  149. package/Input/InputAdornment.js +116 -0
  150. package/Input/InputLabel.js +163 -0
  151. package/Input/Textarea.js +301 -0
  152. package/Input/index.js +34 -0
  153. package/LICENSE +21 -0
  154. package/List/List.js +167 -0
  155. package/List/ListItem.js +279 -0
  156. package/List/ListItemAvatar.js +100 -0
  157. package/List/ListItemIcon.js +77 -0
  158. package/List/ListItemSecondaryAction.js +76 -0
  159. package/List/ListItemText.js +145 -0
  160. package/List/ListSubheader.js +127 -0
  161. package/List/index.js +70 -0
  162. package/Menu/Menu.js +274 -0
  163. package/Menu/MenuItem.js +113 -0
  164. package/Menu/MenuList.js +253 -0
  165. package/Menu/index.js +34 -0
  166. package/MobileStepper/MobileStepper.js +173 -0
  167. package/MobileStepper/index.js +16 -0
  168. package/Modal/Backdrop.js +102 -0
  169. package/Modal/Modal.js +502 -0
  170. package/Modal/ModalManager.js +210 -0
  171. package/Modal/index.js +34 -0
  172. package/Modal/isOverflowing.js +43 -0
  173. package/Modal/manageAriaHidden.js +45 -0
  174. package/Paper/Paper.js +111 -0
  175. package/Paper/index.js +16 -0
  176. package/Popover/Popover.js +564 -0
  177. package/Popover/index.js +16 -0
  178. package/Portal/LegacyPortal.js +158 -0
  179. package/Portal/Portal.js +144 -0
  180. package/Portal/index.js +21 -0
  181. package/Progress/CircularProgress.js +228 -0
  182. package/Progress/LinearProgress.js +258 -0
  183. package/Progress/index.js +25 -0
  184. package/README.md +237 -0
  185. package/Radio/Radio.js +155 -0
  186. package/Radio/RadioGroup.js +168 -0
  187. package/Radio/index.js +25 -0
  188. package/Reboot/Reboot.js +106 -0
  189. package/Reboot/index.js +16 -0
  190. package/Select/Select.js +229 -0
  191. package/Select/SelectInput.js +502 -0
  192. package/Select/index.js +16 -0
  193. package/Snackbar/Snackbar.js +451 -0
  194. package/Snackbar/SnackbarContent.js +135 -0
  195. package/Snackbar/index.js +25 -0
  196. package/Stepper/Step.js +151 -0
  197. package/Stepper/StepButton.js +143 -0
  198. package/Stepper/StepConnector.js +118 -0
  199. package/Stepper/StepContent.js +153 -0
  200. package/Stepper/StepIcon.js +86 -0
  201. package/Stepper/StepLabel.js +200 -0
  202. package/Stepper/StepPositionIcon.js +95 -0
  203. package/Stepper/Stepper.js +161 -0
  204. package/Stepper/index.js +61 -0
  205. package/SvgIcon/SvgIcon.js +147 -0
  206. package/SvgIcon/index.js +16 -0
  207. package/Switch/Switch.js +215 -0
  208. package/Switch/index.js +16 -0
  209. package/Table/Table.js +127 -0
  210. package/Table/TableBody.js +121 -0
  211. package/Table/TableCell.js +181 -0
  212. package/Table/TableFooter.js +93 -0
  213. package/Table/TableHead.js +121 -0
  214. package/Table/TablePagination.js +310 -0
  215. package/Table/TablePaginationActions.js +183 -0
  216. package/Table/TableRow.js +127 -0
  217. package/Table/TableSortLabel.js +145 -0
  218. package/Table/index.js +79 -0
  219. package/Tabs/Tab.js +340 -0
  220. package/Tabs/TabIndicator.js +95 -0
  221. package/Tabs/TabScrollButton.js +112 -0
  222. package/Tabs/Tabs.js +530 -0
  223. package/Tabs/index.js +25 -0
  224. package/TextField/TextField.js +290 -0
  225. package/TextField/index.js +16 -0
  226. package/Toolbar/Toolbar.js +89 -0
  227. package/Toolbar/index.js +16 -0
  228. package/Tooltip/Tooltip.js +514 -0
  229. package/Tooltip/index.js +16 -0
  230. package/Typography/Typography.js +192 -0
  231. package/Typography/index.js +16 -0
  232. package/colors/amber.js +23 -0
  233. package/colors/blue.js +23 -0
  234. package/colors/blueGrey.js +23 -0
  235. package/colors/brown.js +23 -0
  236. package/colors/common.js +11 -0
  237. package/colors/cyan.js +23 -0
  238. package/colors/deepOrange.js +23 -0
  239. package/colors/deepPurple.js +23 -0
  240. package/colors/green.js +23 -0
  241. package/colors/grey.js +23 -0
  242. package/colors/index.js +187 -0
  243. package/colors/indigo.js +23 -0
  244. package/colors/lightBlue.js +23 -0
  245. package/colors/lightGreen.js +23 -0
  246. package/colors/lime.js +23 -0
  247. package/colors/orange.js +23 -0
  248. package/colors/pink.js +23 -0
  249. package/colors/purple.js +23 -0
  250. package/colors/red.js +23 -0
  251. package/colors/teal.js +23 -0
  252. package/colors/yellow.js +23 -0
  253. package/es/AppBar/AppBar.js +106 -0
  254. package/es/AppBar/index.js +1 -0
  255. package/es/Avatar/Avatar.js +136 -0
  256. package/es/Avatar/index.js +1 -0
  257. package/es/Badge/Badge.js +112 -0
  258. package/es/Badge/index.js +1 -0
  259. package/es/BottomNavigation/BottomNavigation.js +86 -0
  260. package/es/BottomNavigation/BottomNavigationAction.js +153 -0
  261. package/es/BottomNavigation/index.js +2 -0
  262. package/es/Button/Button.js +274 -0
  263. package/es/Button/index.js +1 -0
  264. package/es/ButtonBase/ButtonBase.js +358 -0
  265. package/es/ButtonBase/Ripple.js +102 -0
  266. package/es/ButtonBase/TouchRipple.js +268 -0
  267. package/es/ButtonBase/createRippleHandler.js +23 -0
  268. package/es/ButtonBase/index.js +1 -0
  269. package/es/Card/Card.js +27 -0
  270. package/es/Card/CardActions.js +58 -0
  271. package/es/Card/CardContent.js +45 -0
  272. package/es/Card/CardHeader.js +120 -0
  273. package/es/Card/CardMedia.js +76 -0
  274. package/es/Card/index.js +5 -0
  275. package/es/Checkbox/Checkbox.js +117 -0
  276. package/es/Checkbox/index.js +1 -0
  277. package/es/Chip/Chip.js +241 -0
  278. package/es/Chip/index.js +1 -0
  279. package/es/Dialog/Dialog.js +231 -0
  280. package/es/Dialog/DialogActions.js +58 -0
  281. package/es/Dialog/DialogContent.js +48 -0
  282. package/es/Dialog/DialogContentText.js +41 -0
  283. package/es/Dialog/DialogTitle.js +57 -0
  284. package/es/Dialog/index.js +6 -0
  285. package/es/Dialog/withMobileDialog.js +25 -0
  286. package/es/Divider/Divider.js +83 -0
  287. package/es/Divider/index.js +1 -0
  288. package/es/Drawer/Drawer.js +252 -0
  289. package/es/Drawer/index.js +1 -0
  290. package/es/ExpansionPanel/ExpansionPanel.js +194 -0
  291. package/es/ExpansionPanel/ExpansionPanelActions.js +47 -0
  292. package/es/ExpansionPanel/ExpansionPanelDetails.js +42 -0
  293. package/es/ExpansionPanel/ExpansionPanelSummary.js +182 -0
  294. package/es/ExpansionPanel/index.js +4 -0
  295. package/es/Form/FormControl.js +214 -0
  296. package/es/Form/FormControlLabel.js +137 -0
  297. package/es/Form/FormGroup.js +62 -0
  298. package/es/Form/FormHelperText.js +110 -0
  299. package/es/Form/FormLabel.js +132 -0
  300. package/es/Form/index.js +5 -0
  301. package/es/Grid/Grid.js +353 -0
  302. package/es/Grid/index.js +1 -0
  303. package/es/GridList/GridList.js +97 -0
  304. package/es/GridList/GridListTile.js +153 -0
  305. package/es/GridList/GridListTileBar.js +152 -0
  306. package/es/GridList/index.js +3 -0
  307. package/es/HiBadge/HiBadge.js +76 -0
  308. package/es/HiBadge/index.js +1 -0
  309. package/es/HiButton/HiButton.js +130 -0
  310. package/es/HiButton/index.js +1 -0
  311. package/es/HiCheckbox/HiCheckbox.js +101 -0
  312. package/es/HiCheckbox/index.js +1 -0
  313. package/es/HiChip/HiChip.js +148 -0
  314. package/es/HiChip/HiChipSwitch.js +244 -0
  315. package/es/HiChip/index.js +2 -0
  316. package/es/HiColoredLabel/HiColoredLabel.js +84 -0
  317. package/es/HiColoredLabel/index.js +1 -0
  318. package/es/HiDatePicker/Caption.js +67 -0
  319. package/es/HiDatePicker/HiDatePicker.js +314 -0
  320. package/es/HiDatePicker/HiDateRangePicker.js +565 -0
  321. package/es/HiDatePicker/HiDateRangeSelector.js +337 -0
  322. package/es/HiDatePicker/HiWeekPicker.js +296 -0
  323. package/es/HiDatePicker/ListPicker.js +93 -0
  324. package/es/HiDatePicker/Navbar.js +130 -0
  325. package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +114 -0
  326. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +80 -0
  327. package/es/HiDatePicker/Overlays/Overlay.js +76 -0
  328. package/es/HiDatePicker/Overlays/TimePickerOverlay.js +218 -0
  329. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +109 -0
  330. package/es/HiDatePicker/Overlays/index.js +5 -0
  331. package/es/HiDatePicker/Weekday.js +34 -0
  332. package/es/HiDatePicker/index.js +7 -0
  333. package/es/HiDatePicker/stylesheet.js +175 -0
  334. package/es/HiForm/HiEmailField.js +71 -0
  335. package/es/HiForm/HiFormControl.js +298 -0
  336. package/es/HiForm/HiFormLabel.js +122 -0
  337. package/es/HiForm/HiInput.js +485 -0
  338. package/es/HiForm/HiPasswordField.js +70 -0
  339. package/es/HiForm/HiSearchField.js +135 -0
  340. package/es/HiForm/HiTextField.js +239 -0
  341. package/es/HiForm/index.js +7 -0
  342. package/es/HiLoader/HiLoader.js +33 -0
  343. package/es/HiLoader/index.js +1 -0
  344. package/es/HiPins/HiPins.js +66 -0
  345. package/es/HiPins/index.js +1 -0
  346. package/es/HiRadio/HiRadio.js +41 -0
  347. package/es/HiRadio/index.js +1 -0
  348. package/es/HiSelect/HiSelect.js +713 -0
  349. package/es/HiSelect/HiSelectField.js +106 -0
  350. package/es/HiSelect/HiSuggestSelect.js +223 -0
  351. package/es/HiSelect/HiSuggestSelectField.js +89 -0
  352. package/es/HiSelect/SelectInput.js +262 -0
  353. package/es/HiSelect/index.js +11 -0
  354. package/es/HiSelectableList/HiSelectableList.js +195 -0
  355. package/es/HiSelectableList/HiSelectableListItem.js +441 -0
  356. package/es/HiSelectableList/index.js +2 -0
  357. package/es/HiSwitch/HiSwitch.js +138 -0
  358. package/es/HiSwitch/HiSwitchState.js +169 -0
  359. package/es/HiSwitch/index.js +2 -0
  360. package/es/HiTable/BodyCellBuilder.js +345 -0
  361. package/es/HiTable/BodyCells/CellAccount.js +40 -0
  362. package/es/HiTable/BodyCells/CellAccountNumber.js +166 -0
  363. package/es/HiTable/BodyCells/CellAddress.js +129 -0
  364. package/es/HiTable/BodyCells/CellCountry.js +107 -0
  365. package/es/HiTable/BodyCells/CellDate.js +111 -0
  366. package/es/HiTable/BodyCells/CellIcon.js +83 -0
  367. package/es/HiTable/BodyCells/CellImage.js +115 -0
  368. package/es/HiTable/BodyCells/CellLayout.js +198 -0
  369. package/es/HiTable/BodyCells/CellNumeric.js +71 -0
  370. package/es/HiTable/BodyCells/CellRate.js +131 -0
  371. package/es/HiTable/BodyCells/CellSentinel.js +153 -0
  372. package/es/HiTable/BodyCells/CellStatus.js +73 -0
  373. package/es/HiTable/BodyCells/CellText.js +188 -0
  374. package/es/HiTable/BodyCells/CellThirdPartySecurity.js +89 -0
  375. package/es/HiTable/BodyCells/index.js +16 -0
  376. package/es/HiTable/BodyRow.js +314 -0
  377. package/es/HiTable/ChildRow.js +345 -0
  378. package/es/HiTable/ColumnFilter.js +394 -0
  379. package/es/HiTable/HeaderCell.js +376 -0
  380. package/es/HiTable/HiStickyRow.js +217 -0
  381. package/es/HiTable/HiTable.js +876 -0
  382. package/es/HiTable/HiTableBody.js +454 -0
  383. package/es/HiTable/HiTableContextMenu.js +150 -0
  384. package/es/HiTable/HiTableFooterScroll.js +144 -0
  385. package/es/HiTable/HiTableHead.js +403 -0
  386. package/es/HiTable/OrderColumns.js +437 -0
  387. package/es/HiTable/constants.js +180 -0
  388. package/es/HiTable/index.js +2 -0
  389. package/es/HiTopBar/HiTopBar.js +527 -0
  390. package/es/HiTopBar/index.js +1 -0
  391. package/es/Hidden/Hidden.js +107 -0
  392. package/es/Hidden/HiddenCss.js +151 -0
  393. package/es/Hidden/HiddenJs.js +129 -0
  394. package/es/Hidden/index.js +1 -0
  395. package/es/Icon/Icon.js +74 -0
  396. package/es/Icon/index.js +1 -0
  397. package/es/IconButton/IconButton.js +106 -0
  398. package/es/IconButton/index.js +1 -0
  399. package/es/Input/Input.js +616 -0
  400. package/es/Input/InputAdornment.js +83 -0
  401. package/es/Input/InputLabel.js +138 -0
  402. package/es/Input/Textarea.js +234 -0
  403. package/es/Input/index.js +3 -0
  404. package/es/List/List.js +106 -0
  405. package/es/List/ListItem.js +212 -0
  406. package/es/List/ListItemAvatar.js +63 -0
  407. package/es/List/ListItemIcon.js +46 -0
  408. package/es/List/ListItemSecondaryAction.js +45 -0
  409. package/es/List/ListItemText.js +114 -0
  410. package/es/List/ListSubheader.js +90 -0
  411. package/es/List/index.js +7 -0
  412. package/es/Menu/Menu.js +205 -0
  413. package/es/Menu/MenuItem.js +75 -0
  414. package/es/Menu/MenuList.js +168 -0
  415. package/es/Menu/index.js +3 -0
  416. package/es/MobileStepper/MobileStepper.js +137 -0
  417. package/es/MobileStepper/index.js +1 -0
  418. package/es/Modal/Backdrop.js +67 -0
  419. package/es/Modal/Modal.js +398 -0
  420. package/es/Modal/ModalManager.js +162 -0
  421. package/es/Modal/index.js +3 -0
  422. package/es/Modal/isOverflowing.js +25 -0
  423. package/es/Modal/manageAriaHidden.js +33 -0
  424. package/es/Paper/Paper.js +81 -0
  425. package/es/Paper/index.js +1 -0
  426. package/es/Popover/Popover.js +455 -0
  427. package/es/Popover/index.js +1 -0
  428. package/es/Portal/LegacyPortal.js +97 -0
  429. package/es/Portal/Portal.js +82 -0
  430. package/es/Portal/index.js +5 -0
  431. package/es/Progress/CircularProgress.js +201 -0
  432. package/es/Progress/LinearProgress.js +235 -0
  433. package/es/Progress/index.js +2 -0
  434. package/es/Radio/Radio.js +113 -0
  435. package/es/Radio/RadioGroup.js +101 -0
  436. package/es/Radio/index.js +2 -0
  437. package/es/Reboot/Reboot.js +55 -0
  438. package/es/Reboot/index.js +1 -0
  439. package/es/Select/Select.js +199 -0
  440. package/es/Select/SelectInput.js +414 -0
  441. package/es/Select/index.js +1 -0
  442. package/es/Snackbar/Snackbar.js +370 -0
  443. package/es/Snackbar/SnackbarContent.js +96 -0
  444. package/es/Snackbar/index.js +2 -0
  445. package/es/Stepper/Step.js +120 -0
  446. package/es/Stepper/StepButton.js +111 -0
  447. package/es/Stepper/StepConnector.js +85 -0
  448. package/es/Stepper/StepContent.js +116 -0
  449. package/es/Stepper/StepIcon.js +54 -0
  450. package/es/Stepper/StepLabel.js +170 -0
  451. package/es/Stepper/StepPositionIcon.js +64 -0
  452. package/es/Stepper/Stepper.js +126 -0
  453. package/es/Stepper/index.js +6 -0
  454. package/es/SvgIcon/SvgIcon.js +117 -0
  455. package/es/SvgIcon/index.js +1 -0
  456. package/es/Switch/Switch.js +178 -0
  457. package/es/Switch/index.js +1 -0
  458. package/es/Table/Table.js +64 -0
  459. package/es/Table/TableBody.js +61 -0
  460. package/es/Table/TableCell.js +153 -0
  461. package/es/Table/TableFooter.js +44 -0
  462. package/es/Table/TableHead.js +61 -0
  463. package/es/Table/TablePagination.js +224 -0
  464. package/es/Table/TablePaginationActions.js +116 -0
  465. package/es/Table/TableRow.js +99 -0
  466. package/es/Table/TableSortLabel.js +101 -0
  467. package/es/Table/index.js +8 -0
  468. package/es/Tabs/Tab.js +271 -0
  469. package/es/Tabs/TabIndicator.js +63 -0
  470. package/es/Tabs/TabScrollButton.js +70 -0
  471. package/es/Tabs/Tabs.js +425 -0
  472. package/es/Tabs/index.js +2 -0
  473. package/es/TextField/TextField.js +259 -0
  474. package/es/TextField/index.js +1 -0
  475. package/es/Toolbar/Toolbar.js +55 -0
  476. package/es/Toolbar/index.js +1 -0
  477. package/es/Tooltip/Tooltip.js +425 -0
  478. package/es/Tooltip/index.js +1 -0
  479. package/es/Typography/Typography.js +164 -0
  480. package/es/Typography/index.js +1 -0
  481. package/es/colors/amber.js +18 -0
  482. package/es/colors/blue.js +18 -0
  483. package/es/colors/blueGrey.js +18 -0
  484. package/es/colors/brown.js +18 -0
  485. package/es/colors/common.js +6 -0
  486. package/es/colors/cyan.js +18 -0
  487. package/es/colors/deepOrange.js +18 -0
  488. package/es/colors/deepPurple.js +18 -0
  489. package/es/colors/green.js +18 -0
  490. package/es/colors/grey.js +18 -0
  491. package/es/colors/index.js +20 -0
  492. package/es/colors/indigo.js +18 -0
  493. package/es/colors/lightBlue.js +18 -0
  494. package/es/colors/lightGreen.js +18 -0
  495. package/es/colors/lime.js +18 -0
  496. package/es/colors/orange.js +18 -0
  497. package/es/colors/pink.js +18 -0
  498. package/es/colors/purple.js +18 -0
  499. package/es/colors/red.js +18 -0
  500. package/es/colors/teal.js +18 -0
  501. package/es/colors/yellow.js +18 -0
  502. package/es/index.js +64 -0
  503. package/es/internal/RefHolder.js +20 -0
  504. package/es/internal/SwitchBase.js +219 -0
  505. package/es/internal/svg-icons/ArrowDownward.js +20 -0
  506. package/es/internal/svg-icons/ArrowDropDown.js +20 -0
  507. package/es/internal/svg-icons/Cancel.js +19 -0
  508. package/es/internal/svg-icons/CheckBox.js +19 -0
  509. package/es/internal/svg-icons/CheckBoxOutlineBlank.js +19 -0
  510. package/es/internal/svg-icons/CheckCircle.js +19 -0
  511. package/es/internal/svg-icons/IndeterminateCheckBox.js +19 -0
  512. package/es/internal/svg-icons/KeyboardArrowLeft.js +19 -0
  513. package/es/internal/svg-icons/KeyboardArrowRight.js +19 -0
  514. package/es/internal/svg-icons/RadioButtonChecked.js +19 -0
  515. package/es/internal/svg-icons/RadioButtonUnchecked.js +19 -0
  516. package/es/styles/MuiThemeProvider.js +125 -0
  517. package/es/styles/colorManipulator.js +221 -0
  518. package/es/styles/createBreakpoints.js +69 -0
  519. package/es/styles/createGenerateClassName.js +72 -0
  520. package/es/styles/createHiMuiTheme.js +296 -0
  521. package/es/styles/createMixins.js +25 -0
  522. package/es/styles/createMuiTheme.js +45 -0
  523. package/es/styles/createPalette.js +164 -0
  524. package/es/styles/createTypography.js +116 -0
  525. package/es/styles/getStylesCreator.js +34 -0
  526. package/es/styles/index.js +7 -0
  527. package/es/styles/jssPreset.js +16 -0
  528. package/es/styles/shadows.js +11 -0
  529. package/es/styles/spacing.js +5 -0
  530. package/es/styles/themeListener.js +31 -0
  531. package/es/styles/transitions.js +80 -0
  532. package/es/styles/withStyles.js +300 -0
  533. package/es/styles/withTheme.js +65 -0
  534. package/es/styles/zIndex.js +12 -0
  535. package/es/svg-icons/ArrowDownward.js +20 -0
  536. package/es/svg-icons/ArrowDropDown.js +20 -0
  537. package/es/svg-icons/Cancel.js +19 -0
  538. package/es/svg-icons/CheckBox.js +19 -0
  539. package/es/svg-icons/CheckBoxOutlineBlank.js +19 -0
  540. package/es/svg-icons/CheckCircle.js +19 -0
  541. package/es/svg-icons/HiAccount.js +33 -0
  542. package/es/svg-icons/HiAll.js +43 -0
  543. package/es/svg-icons/HiBilling.js +33 -0
  544. package/es/svg-icons/HiCatalog.js +33 -0
  545. package/es/svg-icons/HiCustomer.js +39 -0
  546. package/es/svg-icons/HiFinance.js +33 -0
  547. package/es/svg-icons/HiRoute.js +33 -0
  548. package/es/svg-icons/HiSettlement.js +36 -0
  549. package/es/svg-icons/HiSizeLarge.js +19 -0
  550. package/es/svg-icons/HiSizeMedium.js +19 -0
  551. package/es/svg-icons/HiSizeSmall.js +19 -0
  552. package/es/svg-icons/HiTransaction.js +33 -0
  553. package/es/svg-icons/HiUser.js +39 -0
  554. package/es/svg-icons/HiWidget.js +43 -0
  555. package/es/svg-icons/IndeterminateCheckBox.js +19 -0
  556. package/es/svg-icons/KeyboardArrowLeft.js +19 -0
  557. package/es/svg-icons/KeyboardArrowRight.js +19 -0
  558. package/es/svg-icons/RadioButtonChecked.js +19 -0
  559. package/es/svg-icons/RadioButtonUnchecked.js +19 -0
  560. package/es/svg-icons/index.js +11 -0
  561. package/es/test-utils/createMount.js +32 -0
  562. package/es/test-utils/createRender.js +16 -0
  563. package/es/test-utils/createShallow.js +33 -0
  564. package/es/test-utils/getClasses.js +21 -0
  565. package/es/test-utils/index.js +5 -0
  566. package/es/test-utils/until.js +32 -0
  567. package/es/test-utils/unwrap.js +5 -0
  568. package/es/transitions/Collapse.js +245 -0
  569. package/es/transitions/Fade.js +132 -0
  570. package/es/transitions/Grow.js +173 -0
  571. package/es/transitions/Slide.js +291 -0
  572. package/es/transitions/Zoom.js +129 -0
  573. package/es/transitions/index.js +5 -0
  574. package/es/transitions/utils.js +10 -0
  575. package/es/utils/ClickAwayListener.js +65 -0
  576. package/es/utils/HiIconBuilder.js +99 -0
  577. package/es/utils/addEventListener.js +11 -0
  578. package/es/utils/exactProp.js +21 -0
  579. package/es/utils/helpers.js +65 -0
  580. package/es/utils/hiGetMdiIcon.js +12 -0
  581. package/es/utils/hiHelpers.js +173 -0
  582. package/es/utils/keyboardFocus.js +51 -0
  583. package/es/utils/manageAriaHidden.js +33 -0
  584. package/es/utils/reactHelpers.js +21 -0
  585. package/es/utils/requirePropFactory.js +16 -0
  586. package/es/utils/withWidth.js +141 -0
  587. package/index.es.js +69 -0
  588. package/index.js +853 -0
  589. package/internal/RefHolder.js +64 -0
  590. package/internal/SwitchBase.js +287 -0
  591. package/internal/svg-icons/ArrowDownward.js +37 -0
  592. package/internal/svg-icons/ArrowDropDown.js +37 -0
  593. package/internal/svg-icons/Cancel.js +36 -0
  594. package/internal/svg-icons/CheckBox.js +36 -0
  595. package/internal/svg-icons/CheckBoxOutlineBlank.js +36 -0
  596. package/internal/svg-icons/CheckCircle.js +36 -0
  597. package/internal/svg-icons/IndeterminateCheckBox.js +36 -0
  598. package/internal/svg-icons/KeyboardArrowLeft.js +36 -0
  599. package/internal/svg-icons/KeyboardArrowRight.js +36 -0
  600. package/internal/svg-icons/RadioButtonChecked.js +36 -0
  601. package/internal/svg-icons/RadioButtonUnchecked.js +36 -0
  602. package/package.json +77 -0
  603. package/styles/MuiThemeProvider.js +197 -0
  604. package/styles/colorManipulator.js +255 -0
  605. package/styles/createBreakpoints.js +86 -0
  606. package/styles/createGenerateClassName.js +88 -0
  607. package/styles/createHiMuiTheme.js +328 -0
  608. package/styles/createMixins.js +42 -0
  609. package/styles/createMuiTheme.js +91 -0
  610. package/styles/createPalette.js +208 -0
  611. package/styles/createTypography.js +138 -0
  612. package/styles/getStylesCreator.js +55 -0
  613. package/styles/index.js +70 -0
  614. package/styles/jssPreset.js +41 -0
  615. package/styles/shadows.js +16 -0
  616. package/styles/spacing.js +10 -0
  617. package/styles/themeListener.js +44 -0
  618. package/styles/transitions.js +112 -0
  619. package/styles/withStyles.js +416 -0
  620. package/styles/withTheme.js +127 -0
  621. package/styles/zIndex.js +17 -0
  622. package/svg-icons/ArrowDownward.js +37 -0
  623. package/svg-icons/ArrowDropDown.js +37 -0
  624. package/svg-icons/Cancel.js +36 -0
  625. package/svg-icons/CheckBox.js +36 -0
  626. package/svg-icons/CheckBoxOutlineBlank.js +36 -0
  627. package/svg-icons/CheckCircle.js +36 -0
  628. package/svg-icons/HiAccount.js +52 -0
  629. package/svg-icons/HiAll.js +62 -0
  630. package/svg-icons/HiBilling.js +52 -0
  631. package/svg-icons/HiCatalog.js +52 -0
  632. package/svg-icons/HiCustomer.js +58 -0
  633. package/svg-icons/HiFinance.js +52 -0
  634. package/svg-icons/HiRoute.js +52 -0
  635. package/svg-icons/HiSettlement.js +52 -0
  636. package/svg-icons/HiSizeLarge.js +36 -0
  637. package/svg-icons/HiSizeMedium.js +36 -0
  638. package/svg-icons/HiSizeSmall.js +36 -0
  639. package/svg-icons/HiTransaction.js +52 -0
  640. package/svg-icons/HiUser.js +58 -0
  641. package/svg-icons/HiWidget.js +62 -0
  642. package/svg-icons/IndeterminateCheckBox.js +36 -0
  643. package/svg-icons/KeyboardArrowLeft.js +36 -0
  644. package/svg-icons/KeyboardArrowRight.js +36 -0
  645. package/svg-icons/RadioButtonChecked.js +36 -0
  646. package/svg-icons/RadioButtonUnchecked.js +36 -0
  647. package/svg-icons/index.js +106 -0
  648. package/test-utils/createMount.js +53 -0
  649. package/test-utils/createRender.js +36 -0
  650. package/test-utils/createShallow.js +60 -0
  651. package/test-utils/getClasses.js +47 -0
  652. package/test-utils/index.js +52 -0
  653. package/test-utils/until.js +54 -0
  654. package/test-utils/unwrap.js +11 -0
  655. package/transitions/Collapse.js +324 -0
  656. package/transitions/Fade.js +207 -0
  657. package/transitions/Grow.js +251 -0
  658. package/transitions/Slide.js +381 -0
  659. package/transitions/Zoom.js +204 -0
  660. package/transitions/index.js +52 -0
  661. package/transitions/utils.js +21 -0
  662. package/umd/hipay-material-ui.development.js +113768 -0
  663. package/umd/hipay-material-ui.production.min.js +21 -0
  664. package/utils/ClickAwayListener.js +122 -0
  665. package/utils/HiIconBuilder.js +168 -0
  666. package/utils/addEventListener.js +26 -0
  667. package/utils/exactProp.js +40 -0
  668. package/utils/helpers.js +97 -0
  669. package/utils/hiGetMdiIcon.js +20 -0
  670. package/utils/hiHelpers.js +195 -0
  671. package/utils/keyboardFocus.js +75 -0
  672. package/utils/manageAriaHidden.js +49 -0
  673. package/utils/reactHelpers.js +27 -0
  674. package/utils/requirePropFactory.js +23 -0
  675. package/utils/withWidth.js +214 -0
@@ -0,0 +1,713 @@
1
+ import _Object$keys from 'babel-runtime/core-js/object/keys';
2
+ import _extends from 'babel-runtime/helpers/extends';
3
+ // @inheritedComponent Input
4
+
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import classNames from 'classnames';
8
+ import Grow from 'material-ui/transitions/Grow';
9
+ import { findDOMNode } from 'react-dom';
10
+ import Paper from 'material-ui/Paper';
11
+ import ClickAwayListener from 'material-ui/utils/ClickAwayListener';
12
+ import Collapse from 'material-ui/transitions/Collapse';
13
+ import { Manager, Target, Popper } from 'react-popper';
14
+ import { CheckboxBlankOutline, CheckboxMarked } from 'mdi-material-ui';
15
+ import HiSelectableList from '../HiSelectableList';
16
+ import HiSelectableListItem from '../HiSelectableList/HiSelectableListItem';
17
+ import { HiSearchField } from '../HiForm';
18
+ import SelectInput from './SelectInput';
19
+ import HiChip from '../HiChip/HiChip';
20
+ import { withStyles } from '../styles';
21
+ import { arrayUnique, getNextItemSelectable } from '../utils/hiHelpers';
22
+ import HiIconBuilder from '../utils/HiIconBuilder';
23
+
24
+ export const styles = theme => ({
25
+ root: {
26
+ backgroundColor: theme.palette.background2,
27
+ maxWidth: 500,
28
+ width: '100%',
29
+ position: 'relative'
30
+ },
31
+ popper: {
32
+ width: '100%',
33
+ transform: 'none !important',
34
+ zIndex: 9
35
+ },
36
+ paper: {
37
+ borderRadius: '0px 2px',
38
+ maxHeight: 440,
39
+ transition: 'none !important'
40
+ },
41
+ labelIcon: {
42
+ marginRight: 10
43
+ },
44
+ selectIconLabel: _extends({
45
+ whiteSpace: 'nowrap',
46
+ overflow: 'hidden',
47
+ textOverflow: 'ellipsis',
48
+ paddingRight: 16
49
+ }, theme.typography.body1, {
50
+ display: 'inline-flex',
51
+ width: '100%'
52
+ })
53
+ });
54
+
55
+ /**
56
+ *
57
+ * Utilisé pour tous types de selects dans les formulaires.
58
+ * - single / multiple ( multi-select )
59
+ * - avec / sans checkboxes
60
+ * - avec / sans barre de recherche
61
+ * - avec / sans option "All"
62
+ * - prise en compte du type des éléments (text, image, icon, ...)
63
+ *
64
+ * Ce composant réuni les sous-composants
65
+ * - SelectInput : affiche l'élément dans le formulaire
66
+ * - HiSearchField : intègre une barre de recherche dans le Popper,
67
+ * il filtre la liste des suggestions
68
+ * - HiSelectableList : affiche la liste des suggestions selon le type des éléments
69
+ */
70
+ class HiSelect extends React.PureComponent {
71
+
72
+ constructor(props) {
73
+ super(props);
74
+
75
+ this.handleClick = () => {
76
+ document.body.style.overflow = 'hidden';
77
+ this.setState({ open: true });
78
+ const options = this.props.options.slice();
79
+ this.handleSuggestions(options);
80
+
81
+ if (this.props.onClick) {
82
+ this.props.onClick();
83
+ }
84
+
85
+ // Gestion du focus
86
+ if (this.searchField) {
87
+ // si searchable, focus sur le champs de recherche
88
+ const searchField = this.searchField;
89
+ setTimeout(() => {
90
+ searchField.focus();
91
+ }, 1);
92
+ } else if (this.overlay) {
93
+ // sinon focus sur le dernier élément selectionné
94
+ this.focusOnSelectedItem();
95
+ }
96
+ };
97
+
98
+ this.focusOnSelectedItem = () => {
99
+ // On récupère la div parent "overlay"
100
+ const overlay = findDOMNode(this.overlay);
101
+ const multiple = this.props.multiple;
102
+ const value = this.props.value;
103
+ const selectedIdList = Array.isArray(value) ? value : [value];
104
+ setTimeout(() => {
105
+ let focused = false;
106
+ // Si un ou plusieurs items sont selectionnés, on focus sur le dernier
107
+ if (selectedIdList.length > 0) {
108
+ const itemSelected = overlay.querySelector(`[data-id="${selectedIdList[selectedIdList.length - 1]}"]`);
109
+ if (itemSelected && itemSelected.parentElement.tagName === 'LI') {
110
+ itemSelected.parentElement.focus();
111
+ focused = true;
112
+ }
113
+ }
114
+ // Si pas d'item selectionné, ou pas visible (en cas de recherche), focus sur le premier
115
+ if (selectedIdList.length === 0 || !focused) {
116
+ // On recupère tous les items
117
+ const items = overlay.getElementsByTagName('li');
118
+ let itemToFocus = items[0];
119
+ // Si select multiple, et qu'au moins un selectionné, focus sur le 2e item
120
+ if (multiple && selectedIdList.length > 0) {
121
+ itemToFocus = items[1];
122
+ }
123
+ itemToFocus.focus();
124
+ }
125
+ }, 1);
126
+ };
127
+
128
+ this.handleKeyDown = event => {
129
+ let nextItem;
130
+ if (event.key === 'ArrowDown') {
131
+ nextItem = getNextItemSelectable(document.activeElement, 'down');
132
+ } else if (event.key === 'ArrowUp') {
133
+ nextItem = getNextItemSelectable(document.activeElement, 'up');
134
+ } else if (event.key === 'Tab') {
135
+ document.body.style.overflow = 'auto';
136
+ this.setState({ open: false });
137
+ }
138
+ if (nextItem) {
139
+ nextItem.focus();
140
+ }
141
+ };
142
+
143
+ this.handleKeyDownSearch = event => {
144
+ if (this.overlay && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
145
+ this.focusOnSelectedItem();
146
+ }
147
+ };
148
+
149
+ this.handleFocus = () => {
150
+ this.setState({ focused: true });
151
+ };
152
+
153
+ this.handleBlur = () => {
154
+ this.setState({ focused: false });
155
+ };
156
+
157
+ this.handleClose = () => {
158
+ document.body.style.overflow = 'auto';
159
+ this.setState({
160
+ open: false
161
+ });
162
+
163
+ if (this.props.onClose) {
164
+ this.props.onClose();
165
+ }
166
+ };
167
+
168
+ this.handleSelect = (event, item) => {
169
+ const { multiple, value, name, onChange, options, hierarchic } = this.props;
170
+ const { hierarchySelected, hierarchy, nbOptions } = this.state;
171
+ const hiSelected = _extends({}, hierarchySelected);
172
+
173
+ if (multiple) {
174
+ let valueList = value;
175
+ if (item.id === '_all') {
176
+ if (valueList.length === nbOptions) {
177
+ valueList = [];
178
+ if (hierarchic) {
179
+ // if hierarchic select => empty associative array of selected children
180
+ _Object$keys(hiSelected).forEach(key => {
181
+ hiSelected[key] = [];
182
+ });
183
+ }
184
+ } else {
185
+ options.forEach(option => {
186
+ if (option.hasChildren !== true && !valueList.includes(option.id) && option.id !== '_all') {
187
+ valueList.push(option.id);
188
+ } else if (option.hasChildren === true) {
189
+ // if hierarchic select => fill associative array of selected children
190
+ hiSelected[option.id] = hierarchy[option.id];
191
+ }
192
+ });
193
+ }
194
+ } else if (valueList.includes(item.id) || item.hasChildren === true && hierarchySelected[item.id].length === hierarchy[item.id].length) {
195
+ // item déjà sélectionné => on le déselectionne
196
+ if (item.hasChildren !== true) {
197
+ valueList = valueList.filter(val => {
198
+ return val !== item.id;
199
+ });
200
+ }
201
+
202
+ if (item.hasChildren === true) {
203
+ // remove all children
204
+ valueList = valueList.filter(val => {
205
+ return !this.state.hierarchy[item.id].includes(val);
206
+ });
207
+ hiSelected[item.id] = [];
208
+ } else if (item.hasOwnProperty('parentId')) {
209
+ // Si item est un enfant on l'enlève du tableau associatif des
210
+ // elmts sélectionnés
211
+ hiSelected[item.parentId].splice(hiSelected[item.parentId].indexOf(item.id), 1);
212
+ }
213
+ } else {
214
+ // item non sélectionné => on le sélectionne
215
+ if (item.hasChildren !== true) valueList.push(item.id);
216
+
217
+ if (item.hasChildren === true) {
218
+ // Si item parent => on ajoute tous les enfants
219
+ // Ou on les supprime s'ils sont déjà tous sélectionnés (dans une liste filtrée)
220
+ const idsInSuggestions = [];
221
+ this.state.suggestions.forEach(suggestion => {
222
+ if (this.state.hierarchy[item.id].includes(suggestion.id)) {
223
+ idsInSuggestions.push(suggestion.id);
224
+ }
225
+ });
226
+ // if(hierarchySelected[item.id].length > 0) {}
227
+ let allChildrenSuggestionsSelected = true;
228
+ idsInSuggestions.forEach(id => {
229
+ if (!hierarchySelected[item.id].includes(id)) {
230
+ allChildrenSuggestionsSelected = false;
231
+ }
232
+ });
233
+
234
+ if (allChildrenSuggestionsSelected === true) {
235
+ // On supprime les enfants car déjà tous sélectionnés
236
+ idsInSuggestions.forEach(id => {
237
+ valueList.splice(valueList.indexOf(id), 1);
238
+ hiSelected[item.id].splice(hiSelected[item.id].indexOf(id), 1);
239
+ });
240
+ } else {
241
+ // On ajoute tous les enfants filtrés au éléments sélectionnés
242
+ valueList = arrayUnique(valueList.concat(idsInSuggestions));
243
+ hiSelected[item.id] = arrayUnique(hiSelected[item.id].concat(idsInSuggestions));
244
+ }
245
+
246
+ this.setState({ hierarchySelected: hiSelected });
247
+ } else if (item.hasOwnProperty('parentId')) {
248
+ // Si item est un enfant on l'ajoute du tableau associatif des
249
+ // elmts sélectionnés
250
+ hiSelected[item.parentId].push(item.id);
251
+ }
252
+ }
253
+ this.setState({ hierarchySelected: hiSelected });
254
+ onChange(event, valueList);
255
+ } else {
256
+ onChange(event, item.id);
257
+ this.handleClose();
258
+ }
259
+ };
260
+
261
+ this.handleSuggestions = suggestions => {
262
+ const { options, hasAll, iconAll, translations, multiple } = this.props;
263
+
264
+ if (suggestions.length === 0) {
265
+ // Handle No Result
266
+ // FIX to remove all item
267
+ suggestions = [];
268
+ suggestions.push({
269
+ id: '_no_result',
270
+ type: 'text',
271
+ disabled: true,
272
+ centered: true,
273
+ checkbox: false,
274
+ label: translations.no_result_match
275
+ });
276
+ } else if (hasAll && suggestions.length > 0 && suggestions.length === options.length && multiple === true) {
277
+ // Handle 'All'
278
+ if (suggestions.filter(suggestion => suggestion.id === '_all').length === 0) {
279
+ const allItem = {
280
+ id: '_all',
281
+ icon: iconAll,
282
+ label: translations.all
283
+ };
284
+ if (iconAll !== false) {
285
+ allItem.type = 'icon';
286
+ }
287
+ suggestions.unshift(allItem);
288
+ }
289
+ }
290
+
291
+ this.setState({
292
+ suggestions
293
+ });
294
+ };
295
+
296
+ this.handleRequestDelete = evt => {
297
+ evt.stopPropagation();
298
+ this.props.onChange(this.props.name, []);
299
+ };
300
+
301
+ this.state = {
302
+ open: false,
303
+ focused: false,
304
+ suggestions: [],
305
+ hierarchySelected: {},
306
+ hierarchy: {},
307
+ nbOptions: 0,
308
+ dynamic: false
309
+ };
310
+
311
+ if (props.hierarchic === true && props.options.length > 1) {
312
+ // Construct two associative arrays
313
+ // hierarchy[parentId] => children
314
+ // hierarchySelected[parentId] => selected children
315
+ const hierarchy = {};
316
+ const hierarchySelected = {};
317
+ let value = props.value || [];
318
+ if (!Array.isArray(value)) value = [props.value];
319
+ props.options.forEach(option => {
320
+ if (option.hasChildren === true && !hierarchy.hasOwnProperty(option.id)) {
321
+ hierarchy[option.id] = [];
322
+ hierarchySelected[option.id] = [];
323
+ } else if (option.hasOwnProperty('parentId')) {
324
+ hierarchy[option.parentId].push(option.id);
325
+ if (value.includes(option.id)) {
326
+ hierarchySelected[option.parentId].push(option.id);
327
+ }
328
+ }
329
+ });
330
+
331
+ this.state.hierarchy = hierarchy;
332
+ this.state.hierarchySelected = hierarchySelected;
333
+ }
334
+
335
+ if (props.options.length > 0) {
336
+ // Get real options number (parent & _all are not real options)
337
+ let optionsLength = 0;
338
+ props.options.forEach(option => {
339
+ if (option.hasChildren !== true && option.id !== '_all') {
340
+ optionsLength++;
341
+ }
342
+ });
343
+ this.state.nbOptions = optionsLength;
344
+ } else {
345
+ this.state.dynamic = true;
346
+ }
347
+
348
+ this.handleSelect = this.handleSelect.bind(this);
349
+ this.handleClick = this.handleClick.bind(this);
350
+ this.handleClose = this.handleClose.bind(this);
351
+ this.handleRequestDelete = this.handleRequestDelete.bind(this);
352
+ this.handleSuggestions = this.handleSuggestions.bind(this);
353
+ this.handleFocus = this.handleFocus.bind(this);
354
+ this.handleBlur = this.handleBlur.bind(this);
355
+ }
356
+
357
+ componentWillReceiveProps(nextProps) {
358
+ if (typeof this.props.onSearch !== 'undefined' && this.props.options && this.props.options.length > 0) {
359
+ this.handleSuggestions(nextProps.options);
360
+ let optionsLength = 0;
361
+ nextProps.options.forEach(option => {
362
+ if (option.hasChildren !== true && option.id !== '_all') {
363
+ optionsLength++;
364
+ }
365
+ });
366
+ this.setState({ nbOptions: optionsLength });
367
+ }
368
+ }
369
+
370
+ // Key down on list items
371
+
372
+
373
+ // Key down on search input
374
+
375
+
376
+ /**
377
+ * Call onChange with the updated value
378
+ *
379
+ * - handle single value
380
+ * - handle multiple value
381
+ * - handle '_all' id
382
+ *
383
+ * @param event
384
+ * @param item
385
+ */
386
+
387
+
388
+ /**
389
+ * Update suggestions list
390
+ * - add '_no_result' item if suggestion list is empty
391
+ * - add '_all' item if suggestion list is complete
392
+ * @param suggestions
393
+ */
394
+
395
+
396
+ render() {
397
+ const {
398
+ classes,
399
+ disabled,
400
+ error,
401
+ multiple,
402
+ options,
403
+ checkbox,
404
+ searchable,
405
+ displayAsChip,
406
+ type,
407
+ value,
408
+ hasSelectedCount = multiple,
409
+ translations,
410
+ parentItemSelectable,
411
+ icon,
412
+ parentIcon,
413
+ hoverIcon,
414
+ checkedIcon,
415
+ hierarchic,
416
+ id
417
+ } = this.props;
418
+
419
+ const { open, suggestions, focused } = this.state;
420
+
421
+ let display = '';
422
+ const selectedIdList = Array.isArray(value) ? value : [value];
423
+
424
+ if (this.state.dynamic && selectedIdList.length === 1) {
425
+ display = translations.one_item_selected.replace('%s', selectedIdList.length);
426
+ } else if (this.state.nbOptions !== selectedIdList.length && selectedIdList.length > 1) {
427
+ display = translations.n_items_selected.replace('%s', selectedIdList.length);
428
+ } else if (this.state.nbOptions === selectedIdList.length) {
429
+ display = translations.all;
430
+ } else if (selectedIdList.length === 1) {
431
+ if (type !== 'icon') {
432
+ display = options.find(o => o.id === selectedIdList[0]).label;
433
+ } else {
434
+ const optionSelected = options.find(o => o.id === selectedIdList[0]);
435
+ display = React.createElement(
436
+ 'span',
437
+ { className: classes.selectIconLabel },
438
+ React.createElement(HiIconBuilder, { icon: optionSelected.icon, className: classes.labelIcon }),
439
+ optionSelected.label
440
+ );
441
+ }
442
+ }
443
+
444
+ if (displayAsChip) {
445
+ const chipFilter = React.createElement(HiChip, { label: display, onDelete: this.handleRequestDelete });
446
+ if (display) {
447
+ display = chipFilter;
448
+ }
449
+ }
450
+
451
+ const popperClass = classNames(classes.popper, {
452
+ [classes.popperClose]: !open
453
+ });
454
+
455
+ let allSelected = false;
456
+ if (selectedIdList.length === this.state.nbOptions) {
457
+ allSelected = true;
458
+ }
459
+
460
+ let popperStyle = {};
461
+ if (this.props.containerWidth > 0) {
462
+ popperStyle = { width: this.props.containerWidth };
463
+ }
464
+
465
+ return React.createElement(
466
+ 'div',
467
+ {
468
+ className: classes.root,
469
+ ref: el => {
470
+ this.overlay = el;
471
+ }
472
+ },
473
+ React.createElement(
474
+ Manager,
475
+ null,
476
+ React.createElement(
477
+ Target,
478
+ null,
479
+ React.createElement(SelectInput, {
480
+ id: id,
481
+ value: display,
482
+ open: open,
483
+ focused: focused,
484
+ type: type,
485
+ disabled: disabled,
486
+ noButton: displayAsChip,
487
+ error: error,
488
+ onClick: this.handleClick,
489
+ onFocus: this.handleFocus,
490
+ onBlur: this.handleBlur,
491
+ onMouseEnter: this.props.onMouseEnter,
492
+ onMouseLeave: this.props.onMouseLeave
493
+ })
494
+ ),
495
+ open && React.createElement(
496
+ Popper,
497
+ {
498
+ placement: 'bottom-start',
499
+ eventsEnabled: open,
500
+ className: popperClass,
501
+ style: popperStyle
502
+ },
503
+ React.createElement(
504
+ ClickAwayListener,
505
+ { onClickAway: this.handleClose },
506
+ React.createElement(
507
+ Grow,
508
+ { 'in': open, id: 'menu-list', style: { transformOrigin: '0 0 0' } },
509
+ React.createElement(
510
+ Paper,
511
+ { className: classes.paper },
512
+ !!searchable && React.createElement(HiSearchField, {
513
+ itemList: options,
514
+ callbackFilteredList: this.handleSuggestions,
515
+ filterPropertyList: ['label'],
516
+ placeholder: translations.search,
517
+ autoFocus: true,
518
+ onSearch: this.props.onSearch,
519
+ inputRef: el => {
520
+ this.searchField = el;
521
+ },
522
+ onKeyDown: this.handleKeyDownSearch
523
+ }),
524
+ !!hasSelectedCount && React.createElement(
525
+ Collapse,
526
+ {
527
+ 'in': selectedIdList.length > 0,
528
+ timeout: 'auto',
529
+ unmountOnExit: true
530
+ },
531
+ React.createElement(HiSelectableListItem, {
532
+ key: '_selected_count',
533
+ item: {
534
+ id: '_selected_count',
535
+ type: 'text',
536
+ disabled: true,
537
+ checkbox: false,
538
+ label: selectedIdList.length < 2 ? translations.one_item_selected.replace('%s', selectedIdList.length) : translations.n_items_selected.replace('%s', selectedIdList.length),
539
+ centered: true
540
+ }
541
+ })
542
+ ),
543
+ React.createElement(HiSelectableList, {
544
+ type: type,
545
+ parentItemSelectable: parentItemSelectable,
546
+ itemList: suggestions,
547
+ onSelect: this.handleSelect,
548
+ selectedIdList: selectedIdList,
549
+ checkbox: checkbox,
550
+ hierarchy: this.state.hierarchy,
551
+ hierarchic: hierarchic,
552
+ hierarchySelected: this.state.hierarchySelected,
553
+ translations: translations,
554
+ icon: icon,
555
+ parentIcon: parentIcon,
556
+ hoverIcon: hoverIcon,
557
+ checkedIcon: checkedIcon,
558
+ allSelected: allSelected,
559
+ value: value,
560
+ onKeyDown: this.handleKeyDown
561
+ })
562
+ )
563
+ )
564
+ )
565
+ )
566
+ )
567
+ );
568
+ }
569
+ }
570
+
571
+ HiSelect.defaultProps = {
572
+ disabled: false,
573
+ error: false,
574
+ multiple: false,
575
+ type: 'text',
576
+ checkbox: false,
577
+ searchable: false,
578
+ hasAll: false,
579
+ iconAll: false,
580
+ hierarchic: false,
581
+ parentItemSelectable: false,
582
+ displayAsChip: false,
583
+ icon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
584
+ parentIcon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
585
+ hoverIcon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
586
+ checkedIcon: React.createElement(CheckboxMarked, { style: { width: 20, height: 20 } }),
587
+ translations: {
588
+ all: 'All',
589
+ no_result_match: 'No result match',
590
+ search: 'Search',
591
+ n_items_selected: '%s items selected',
592
+ one_item_selected: '%s item selected',
593
+ n_children: '%s items',
594
+ one_child: '%s item'
595
+ }
596
+ };
597
+ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
598
+ /**
599
+ * Affiche une checkbox pour chaque éléments, par défaut si options est nested
600
+ */
601
+ checkbox: PropTypes.bool,
602
+ /**
603
+ * Icon affiché lorsque l'item est sélectionné
604
+ */
605
+ checkedIcon: PropTypes.node,
606
+ /**
607
+ * Useful to extend the style applied to components.
608
+ */
609
+ classes: PropTypes.object,
610
+ /**
611
+ * Inactif
612
+ */
613
+ disabled: PropTypes.bool,
614
+ /**
615
+ * Option permettant d'afficher les sélection sous forme de Chip.
616
+ */
617
+ displayAsChip: PropTypes.bool,
618
+ /**
619
+ * Applique le style error
620
+ */
621
+ error: PropTypes.bool,
622
+ /**
623
+ * Affiche l'élément 'All'
624
+ */
625
+ hasAll: PropTypes.bool,
626
+ /**
627
+ * Affiche le compte d'éléments sélectionnés en haut de la liste
628
+ */
629
+ hasSelectedCount: PropTypes.bool,
630
+ /**
631
+ * Les items sont hiérarchisés
632
+ */
633
+ hierarchic: PropTypes.bool,
634
+ /**
635
+ * Icon affiché lorsque l'item n'est pas sélectionné et qu'on le survole
636
+ */
637
+ hoverIcon: PropTypes.node,
638
+ /**
639
+ * Icon affiché lorsque l'item n'est pas sélectionné
640
+ */
641
+ icon: PropTypes.node,
642
+ /**
643
+ * Nom de l'icône
644
+ */
645
+ iconAll: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
646
+ /**
647
+ * id du select
648
+ */
649
+ id: PropTypes.string,
650
+ /**
651
+ * Autorise la sélection de plusieurs valeurs
652
+ */
653
+ multiple: PropTypes.bool,
654
+ /**
655
+ * Nom du champ de formulaire
656
+ */
657
+ name: PropTypes.string.isRequired,
658
+ /**
659
+ * Fonction de callback qui renvoit la/les valeurs sélectionnées
660
+ *
661
+ * @param {object} event
662
+ * @param {string || array} value
663
+ */
664
+ onChange: PropTypes.func.isRequired,
665
+ /**
666
+ * Fonction de callback appelée lorsqu'on ferme le select
667
+ */
668
+ onClose: PropTypes.func,
669
+ /**
670
+ * Fonction de callback appelée lorsqu'on survole le champs
671
+ */
672
+ onMouseEnter: PropTypes.func,
673
+ /**
674
+ * Fonction de callback appelée lorsque le curseur quitte le champs
675
+ */
676
+ onMouseLeave: PropTypes.func,
677
+ /**
678
+ * Fonction de callback appelée lorsqu'on écrit dans la barre de recherche
679
+ * A utiliser pour les selects avec des données dynamiques
680
+ *
681
+ * @param {string} value
682
+ */
683
+ onSearch: PropTypes.func,
684
+ /**
685
+ * Listes des options du select
686
+ */
687
+ options: PropTypes.array.isRequired,
688
+ /**
689
+ * Icon affiché lorsqu'un item parent n'est pas sélectionné
690
+ */
691
+ parentIcon: PropTypes.node,
692
+ /**
693
+ * Les items parents sont sélectionnables
694
+ */
695
+ parentItemSelectable: PropTypes.bool,
696
+ /**
697
+ * Affiche un input de recherche permettant de filtrer les options
698
+ */
699
+ searchable: PropTypes.bool,
700
+ /**
701
+ * Traductions (par défaut en anglais)
702
+ */
703
+ translations: PropTypes.object,
704
+ /**
705
+ * Type des éléments du select, définit le rendu d'un élément
706
+ */
707
+ type: PropTypes.oneOf(['icon', 'text', 'image', 'primary-highlight']),
708
+ /**
709
+ * Value(s) du select
710
+ */
711
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.array])
712
+ } : {};
713
+ export default withStyles(styles, { name: 'HmuiHiSelect' })(HiSelect);