@hipay/hipay-material-ui 4.0.0 → 4.0.1-beta5

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 (439) hide show
  1. package/HiAccordion/HiAccordion.js +26 -8
  2. package/HiAccordion/index.js +5 -1
  3. package/HiAccordionActions/HiAccordionActions.js +14 -1
  4. package/HiAccordionActions/index.js +5 -1
  5. package/HiAccordionSummary/HiAccordionSummary.js +15 -1
  6. package/HiAccordionSummary/index.js +5 -1
  7. package/HiAlertModal/HiAlertModal.js +22 -7
  8. package/HiAlertModal/index.js +5 -1
  9. package/HiAppBar/HiAppBar.js +42 -11
  10. package/HiAppBar/index.js +2 -0
  11. package/HiAvatar/HiAvatar.js +12 -3
  12. package/HiAvatar/index.js +2 -0
  13. package/HiBadge/HiBadge.js +24 -8
  14. package/HiBadge/index.js +2 -0
  15. package/HiBreadcrumb/HiBreadcrumb.js +30 -6
  16. package/HiBreadcrumb/HiStep.js +45 -13
  17. package/HiBreadcrumb/HiStepConnector.js +49 -14
  18. package/HiBreadcrumb/HiStepContent.js +30 -6
  19. package/HiBreadcrumb/HiStepIcon.js +35 -10
  20. package/HiBreadcrumb/HiStepLabel.js +44 -14
  21. package/HiBreadcrumb/HiStepper.js +30 -6
  22. package/HiBreadcrumb/index.js +2 -0
  23. package/HiButton/HiButton.js +33 -8
  24. package/HiButton/index.js +5 -1
  25. package/HiCell/CellAddress.js +33 -12
  26. package/HiCell/CellDate.js +36 -10
  27. package/HiCell/CellHiddenContent.js +30 -8
  28. package/HiCell/CellIcon.js +36 -12
  29. package/HiCell/CellImage.js +34 -12
  30. package/HiCell/CellNumeric.js +40 -13
  31. package/HiCell/CellPinToAction.js +33 -9
  32. package/HiCell/CellRate.js +47 -13
  33. package/HiCell/CellSentinel.js +33 -12
  34. package/HiCell/CellSentinelScore.js +31 -9
  35. package/HiCell/CellText.js +52 -16
  36. package/HiCell/CellTextStyled.js +24 -13
  37. package/HiCell/index.js +10 -0
  38. package/HiCheckbox/HiCheckbox.js +52 -15
  39. package/HiCheckbox/index.js +2 -0
  40. package/HiChip/HiChip.js +47 -24
  41. package/HiChip/HiChipSwitch.js +59 -16
  42. package/HiChip/index.js +3 -0
  43. package/HiColoredLabel/HiColoredLabel.js +49 -15
  44. package/HiColoredLabel/index.js +2 -0
  45. package/HiDatePicker/Caption.js +21 -9
  46. package/HiDatePicker/HiDatePicker.js +88 -16
  47. package/HiDatePicker/HiDatePickerMobile.js +43 -18
  48. package/HiDatePicker/HiDateRangePicker.js +134 -38
  49. package/HiDatePicker/HiDateRangeSelector.js +130 -49
  50. package/HiDatePicker/ListPicker.js +38 -8
  51. package/HiDatePicker/NavBar.js +31 -12
  52. package/HiDatePicker/Overlays/CustomOverlayLayout.js +28 -11
  53. package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +28 -11
  54. package/HiDatePicker/Overlays/MonthPickerOverlay.js +26 -4
  55. package/HiDatePicker/Overlays/Overlay.js +25 -8
  56. package/HiDatePicker/Overlays/TimePickerOverlay.js +39 -8
  57. package/HiDatePicker/Overlays/YearPickerOverlay.js +31 -8
  58. package/HiDatePicker/Overlays/index.js +6 -0
  59. package/HiDatePicker/Weekday.js +9 -4
  60. package/HiDatePicker/hiLocaleUtils.js +20 -8
  61. package/HiDatePicker/index.js +2 -0
  62. package/HiDatePicker/stylesheet.js +13 -7
  63. package/HiDialog/HiDialog.js +19 -7
  64. package/HiDialog/index.js +2 -0
  65. package/HiDotsStepper/HiDot.js +37 -8
  66. package/HiDotsStepper/HiDotsStepper.js +37 -10
  67. package/HiDotsStepper/index.js +3 -0
  68. package/HiExpansionPanel/HiExpansionPanel.js +38 -16
  69. package/HiExpansionPanel/index.js +5 -1
  70. package/HiForm/HiAddressField.js +36 -10
  71. package/HiForm/HiEmailField.js +29 -5
  72. package/HiForm/HiFormControl.js +74 -28
  73. package/HiForm/HiFormLabel.js +41 -15
  74. package/HiForm/HiInput.js +91 -33
  75. package/HiForm/HiPasswordField.js +46 -9
  76. package/HiForm/HiSearchField.js +34 -3
  77. package/HiForm/HiSlider.js +57 -22
  78. package/HiForm/HiTextField.js +47 -22
  79. package/HiForm/HiUpload.js +89 -29
  80. package/HiForm/HiUploadField.js +32 -10
  81. package/HiForm/HiUploadInput.js +76 -23
  82. package/HiForm/index.js +12 -0
  83. package/HiIcon/HiIcon.js +34 -9
  84. package/HiIcon/index.js +2 -0
  85. package/HiIconButton/HiIconButton.js +21 -6
  86. package/HiIconButton/index.js +2 -0
  87. package/HiListItemLink/HiListItemLink.js +19 -7
  88. package/HiListItemLink/index.js +2 -0
  89. package/HiLoader/HiLoader.js +16 -6
  90. package/HiLoader/index.js +2 -0
  91. package/HiNotice/HiKPI.js +47 -16
  92. package/HiNotice/HiKPINotice.js +16 -6
  93. package/HiNotice/index.js +3 -0
  94. package/HiPagination/HiPagination.js +11 -1
  95. package/HiPagination/index.js +2 -0
  96. package/HiPaymentMeans/HiPaymentMeans.js +72 -31
  97. package/HiPaymentMeans/index.js +2 -0
  98. package/HiPdfReader/HiPdfReader.js +57 -24
  99. package/HiPdfReader/index.js +2 -0
  100. package/HiPin/HiPin.js +19 -7
  101. package/HiPin/index.js +2 -0
  102. package/HiRadio/HiRadio.js +22 -11
  103. package/HiRadio/index.js +2 -0
  104. package/HiScrollStepper/HiScrollStepper.js +67 -29
  105. package/HiScrollStepper/index.js +2 -0
  106. package/HiSelect/HiDynamicSelect.js +42 -32
  107. package/HiSelect/HiDynamicSelectField.js +48 -24
  108. package/HiSelect/HiNestedSelect.js +111 -65
  109. package/HiSelect/HiNestedSelectContent.js +86 -60
  110. package/HiSelect/HiNestedSelectField.js +48 -24
  111. package/HiSelect/HiSelect.js +187 -89
  112. package/HiSelect/HiSelectContent.js +97 -62
  113. package/HiSelect/HiSelectField.js +49 -25
  114. package/HiSelect/HiSelectInput.js +76 -23
  115. package/HiSelect/HiSelectMobile.js +44 -7
  116. package/HiSelect/HiSuggestSelect.js +81 -25
  117. package/HiSelect/HiSuggestSelectField.js +39 -15
  118. package/HiSelect/index.js +14 -2
  119. package/HiSelectableList/HiSelectableList.js +90 -34
  120. package/HiSelectableList/HiSelectableListHierarchic.js +60 -34
  121. package/HiSelectableList/HiSelectableListItem.js +88 -45
  122. package/HiSelectableList/index.js +4 -0
  123. package/HiStepper/DefaultIndicator.js +10 -1
  124. package/HiStepper/HiStep.js +48 -18
  125. package/HiStepper/HiStepper.js +15 -2
  126. package/HiStepper/index.js +3 -0
  127. package/HiSwitch/HiSwitch.js +33 -9
  128. package/HiSwitch/HiSwitchState.js +32 -15
  129. package/HiSwitch/index.js +3 -0
  130. package/HiTable/HiCellBuilder.js +65 -10
  131. package/HiTable/HiTable.js +48 -20
  132. package/HiTable/HiTableBody.js +24 -7
  133. package/HiTable/HiTableHeader.js +51 -18
  134. package/HiTable/HiTableRow.js +46 -12
  135. package/HiTable/constants.js +98 -48
  136. package/HiTable/index.js +2 -0
  137. package/es/HiAccordion/HiAccordion.js +26 -8
  138. package/es/HiAccordion/index.js +5 -1
  139. package/es/HiAccordionActions/HiAccordionActions.js +14 -1
  140. package/es/HiAccordionActions/index.js +5 -1
  141. package/es/HiAccordionSummary/HiAccordionSummary.js +15 -1
  142. package/es/HiAccordionSummary/index.js +5 -1
  143. package/es/HiAlertModal/HiAlertModal.js +22 -7
  144. package/es/HiAlertModal/index.js +5 -1
  145. package/es/HiAppBar/HiAppBar.js +42 -11
  146. package/es/HiAppBar/index.js +2 -0
  147. package/es/HiAvatar/HiAvatar.js +12 -3
  148. package/es/HiAvatar/index.js +2 -0
  149. package/es/HiBadge/HiBadge.js +24 -8
  150. package/es/HiBadge/index.js +2 -0
  151. package/es/HiBreadcrumb/HiBreadcrumb.js +30 -6
  152. package/es/HiBreadcrumb/HiStep.js +45 -13
  153. package/es/HiBreadcrumb/HiStepConnector.js +49 -14
  154. package/es/HiBreadcrumb/HiStepContent.js +30 -6
  155. package/es/HiBreadcrumb/HiStepIcon.js +35 -10
  156. package/es/HiBreadcrumb/HiStepLabel.js +44 -14
  157. package/es/HiBreadcrumb/HiStepper.js +30 -6
  158. package/es/HiBreadcrumb/index.js +2 -0
  159. package/es/HiButton/HiButton.js +33 -8
  160. package/es/HiButton/index.js +5 -1
  161. package/es/HiCell/CellAddress.js +33 -12
  162. package/es/HiCell/CellDate.js +36 -10
  163. package/es/HiCell/CellHiddenContent.js +30 -8
  164. package/es/HiCell/CellIcon.js +36 -12
  165. package/es/HiCell/CellImage.js +34 -12
  166. package/es/HiCell/CellNumeric.js +40 -13
  167. package/es/HiCell/CellPinToAction.js +33 -9
  168. package/es/HiCell/CellRate.js +47 -13
  169. package/es/HiCell/CellSentinel.js +33 -12
  170. package/es/HiCell/CellSentinelScore.js +31 -9
  171. package/es/HiCell/CellText.js +52 -16
  172. package/es/HiCell/CellTextStyled.js +24 -13
  173. package/es/HiCell/index.js +10 -0
  174. package/es/HiCheckbox/HiCheckbox.js +52 -15
  175. package/es/HiCheckbox/index.js +2 -0
  176. package/es/HiChip/HiChip.js +47 -24
  177. package/es/HiChip/HiChipSwitch.js +59 -16
  178. package/es/HiChip/index.js +3 -0
  179. package/es/HiColoredLabel/HiColoredLabel.js +49 -15
  180. package/es/HiColoredLabel/index.js +2 -0
  181. package/es/HiDatePicker/Caption.js +21 -9
  182. package/es/HiDatePicker/HiDatePicker.js +88 -16
  183. package/es/HiDatePicker/HiDatePickerMobile.js +43 -18
  184. package/es/HiDatePicker/HiDateRangePicker.js +134 -38
  185. package/es/HiDatePicker/HiDateRangeSelector.js +130 -49
  186. package/es/HiDatePicker/ListPicker.js +38 -8
  187. package/es/HiDatePicker/NavBar.js +31 -12
  188. package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +28 -11
  189. package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +28 -11
  190. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +26 -4
  191. package/es/HiDatePicker/Overlays/Overlay.js +25 -8
  192. package/es/HiDatePicker/Overlays/TimePickerOverlay.js +39 -8
  193. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +31 -8
  194. package/es/HiDatePicker/Overlays/index.js +6 -0
  195. package/es/HiDatePicker/Weekday.js +9 -4
  196. package/es/HiDatePicker/hiLocaleUtils.js +20 -8
  197. package/es/HiDatePicker/index.js +2 -0
  198. package/es/HiDatePicker/stylesheet.js +13 -7
  199. package/es/HiDialog/HiDialog.js +19 -7
  200. package/es/HiDialog/index.js +2 -0
  201. package/es/HiDotsStepper/HiDot.js +37 -8
  202. package/es/HiDotsStepper/HiDotsStepper.js +37 -10
  203. package/es/HiDotsStepper/index.js +3 -0
  204. package/es/HiExpansionPanel/HiExpansionPanel.js +38 -16
  205. package/es/HiExpansionPanel/index.js +5 -1
  206. package/es/HiForm/HiAddressField.js +36 -10
  207. package/es/HiForm/HiEmailField.js +29 -5
  208. package/es/HiForm/HiFormControl.js +74 -28
  209. package/es/HiForm/HiFormLabel.js +41 -15
  210. package/es/HiForm/HiInput.js +91 -33
  211. package/es/HiForm/HiPasswordField.js +46 -9
  212. package/es/HiForm/HiSearchField.js +34 -3
  213. package/es/HiForm/HiSlider.js +57 -22
  214. package/es/HiForm/HiTextField.js +47 -22
  215. package/es/HiForm/HiUpload.js +89 -29
  216. package/es/HiForm/HiUploadField.js +32 -10
  217. package/es/HiForm/HiUploadInput.js +76 -23
  218. package/es/HiForm/index.js +12 -0
  219. package/es/HiIcon/HiIcon.js +34 -9
  220. package/es/HiIcon/index.js +2 -0
  221. package/es/HiIconButton/HiIconButton.js +21 -6
  222. package/es/HiIconButton/index.js +2 -0
  223. package/es/HiListItemLink/HiListItemLink.js +19 -7
  224. package/es/HiListItemLink/index.js +2 -0
  225. package/es/HiLoader/HiLoader.js +16 -6
  226. package/es/HiLoader/index.js +2 -0
  227. package/es/HiNotice/HiKPI.js +47 -16
  228. package/es/HiNotice/HiKPINotice.js +16 -6
  229. package/es/HiNotice/index.js +3 -0
  230. package/es/HiPagination/HiPagination.js +11 -1
  231. package/es/HiPagination/index.js +2 -0
  232. package/es/HiPaymentMeans/HiPaymentMeans.js +72 -31
  233. package/es/HiPaymentMeans/index.js +2 -0
  234. package/es/HiPdfReader/HiPdfReader.js +57 -24
  235. package/es/HiPdfReader/index.js +2 -0
  236. package/es/HiPin/HiPin.js +19 -7
  237. package/es/HiPin/index.js +2 -0
  238. package/es/HiRadio/HiRadio.js +22 -11
  239. package/es/HiRadio/index.js +2 -0
  240. package/es/HiScrollStepper/HiScrollStepper.js +67 -29
  241. package/es/HiScrollStepper/index.js +2 -0
  242. package/es/HiSelect/HiDynamicSelect.js +42 -32
  243. package/es/HiSelect/HiDynamicSelectField.js +48 -24
  244. package/es/HiSelect/HiNestedSelect.js +111 -65
  245. package/es/HiSelect/HiNestedSelectContent.js +86 -60
  246. package/es/HiSelect/HiNestedSelectField.js +48 -24
  247. package/es/HiSelect/HiSelect.js +187 -89
  248. package/es/HiSelect/HiSelectContent.js +97 -62
  249. package/es/HiSelect/HiSelectField.js +49 -25
  250. package/es/HiSelect/HiSelectInput.js +76 -23
  251. package/es/HiSelect/HiSelectMobile.js +44 -7
  252. package/es/HiSelect/HiSuggestSelect.js +81 -25
  253. package/es/HiSelect/HiSuggestSelectField.js +39 -15
  254. package/es/HiSelect/index.js +14 -2
  255. package/es/HiSelectableList/HiSelectableList.js +90 -34
  256. package/es/HiSelectableList/HiSelectableListHierarchic.js +60 -34
  257. package/es/HiSelectableList/HiSelectableListItem.js +88 -45
  258. package/es/HiSelectableList/index.js +4 -0
  259. package/es/HiStepper/DefaultIndicator.js +10 -1
  260. package/es/HiStepper/HiStep.js +48 -18
  261. package/es/HiStepper/HiStepper.js +15 -2
  262. package/es/HiStepper/index.js +3 -0
  263. package/es/HiSwitch/HiSwitch.js +33 -9
  264. package/es/HiSwitch/HiSwitchState.js +32 -15
  265. package/es/HiSwitch/index.js +3 -0
  266. package/es/HiTable/HiCellBuilder.js +65 -10
  267. package/es/HiTable/HiTable.js +48 -20
  268. package/es/HiTable/HiTableBody.js +24 -7
  269. package/es/HiTable/HiTableHeader.js +51 -18
  270. package/es/HiTable/HiTableRow.js +46 -12
  271. package/es/HiTable/constants.js +98 -48
  272. package/es/HiTable/index.js +2 -0
  273. package/es/hi-svg-icons/HiAccount.js +14 -4
  274. package/es/hi-svg-icons/HiActivity.js +14 -4
  275. package/es/hi-svg-icons/HiAll.js +18 -7
  276. package/es/hi-svg-icons/HiBilling.js +14 -4
  277. package/es/hi-svg-icons/HiBriefcaseRescue.js +14 -4
  278. package/es/hi-svg-icons/HiBusiness.js +14 -4
  279. package/es/hi-svg-icons/HiCatalog.js +14 -4
  280. package/es/hi-svg-icons/HiCustomer.js +14 -4
  281. package/es/hi-svg-icons/HiDownload.js +14 -4
  282. package/es/hi-svg-icons/HiFinance.js +14 -4
  283. package/es/hi-svg-icons/HiFinanceMenu.js +14 -4
  284. package/es/hi-svg-icons/HiHostedPaymentPage.js +14 -4
  285. package/es/hi-svg-icons/HiHostedPaymentPageMenu.js +14 -4
  286. package/es/hi-svg-icons/HiIntegration.js +14 -4
  287. package/es/hi-svg-icons/HiIntegrationMenu.js +14 -4
  288. package/es/hi-svg-icons/HiIntelligence.js +14 -4
  289. package/es/hi-svg-icons/HiIntelligenceMenu.js +14 -4
  290. package/es/hi-svg-icons/HiInvoice.js +14 -4
  291. package/es/hi-svg-icons/HiInvoiceMenu.js +14 -4
  292. package/es/hi-svg-icons/HiLogoRounded.js +17 -6
  293. package/es/hi-svg-icons/HiOrder.js +14 -4
  294. package/es/hi-svg-icons/HiPaymentOrder.js +14 -4
  295. package/es/hi-svg-icons/HiPermission.js +14 -4
  296. package/es/hi-svg-icons/HiPriceGrid.js +14 -4
  297. package/es/hi-svg-icons/HiPrivate.js +14 -4
  298. package/es/hi-svg-icons/HiRoute.js +14 -4
  299. package/es/hi-svg-icons/HiRouteMenu.js +14 -4
  300. package/es/hi-svg-icons/HiRouteSwitch.js +19 -7
  301. package/es/hi-svg-icons/HiRouteSwitchMenu.js +19 -7
  302. package/es/hi-svg-icons/HiSettlement.js +14 -4
  303. package/es/hi-svg-icons/HiSizeLarge.js +14 -4
  304. package/es/hi-svg-icons/HiSizeMedium.js +14 -4
  305. package/es/hi-svg-icons/HiSizeSmall.js +14 -4
  306. package/es/hi-svg-icons/HiStore.js +14 -4
  307. package/es/hi-svg-icons/HiStoreMenu.js +14 -4
  308. package/es/hi-svg-icons/HiTransaction.js +14 -4
  309. package/es/hi-svg-icons/HiTransactionMenu.js +14 -4
  310. package/es/hi-svg-icons/HiUser.js +14 -4
  311. package/es/hi-svg-icons/HiVendor.js +14 -4
  312. package/es/hi-svg-icons/HiWidget.js +14 -4
  313. package/es/hi-svg-icons/index.js +41 -0
  314. package/es/hi-svg-images/HiLogo.js +12 -4
  315. package/es/hi-svg-images/HiLogoWhite.js +12 -4
  316. package/es/hi-svg-images/index.js +3 -0
  317. package/es/setupTest.js +13 -2
  318. package/es/styleguide/Wrapper.js +6 -0
  319. package/es/styles/MuiThemeProvider.js +49 -15
  320. package/es/styles/colorManipulator.js +50 -15
  321. package/es/styles/createBreakpoints.js +29 -14
  322. package/es/styles/createGenerateClassName.js +24 -14
  323. package/es/styles/createMixins.js +10 -4
  324. package/es/styles/createMuiTheme.js +28 -11
  325. package/es/styles/createPalette.js +89 -67
  326. package/es/styles/createStyles.js +1 -0
  327. package/es/styles/createTypography.js +24 -15
  328. package/es/styles/getStylesCreator.js +14 -1
  329. package/es/styles/getThemeProps.js +7 -2
  330. package/es/styles/index.js +6 -0
  331. package/es/styles/jssPreset.js +11 -1
  332. package/es/styles/makeStyles.js +9 -2
  333. package/es/styles/mergeClasses.js +16 -5
  334. package/es/styles/shadows.js +4 -1
  335. package/es/styles/shape.js +2 -1
  336. package/es/styles/spacing.js +4 -1
  337. package/es/styles/themeListener.js +10 -2
  338. package/es/styles/transitions.js +35 -20
  339. package/es/styles/withStyles.js +9 -2
  340. package/es/styles/zIndex.js +2 -1
  341. package/es/test-utils/createMount.js +12 -2
  342. package/es/test-utils/createRender.js +9 -2
  343. package/es/test-utils/createShallow.js +17 -6
  344. package/es/test-utils/getClasses.js +4 -1
  345. package/es/test-utils/index.js +6 -0
  346. package/es/test-utils/until.js +14 -3
  347. package/es/test-utils/unwrap.js +1 -0
  348. package/es/theme/palette.js +7 -2
  349. package/es/theme/typography.js +15 -7
  350. package/es/theme.js +8 -2
  351. package/es/transitions/utils.js +7 -3
  352. package/es/utils/exactProp.js +13 -3
  353. package/es/utils/helpers.js +58 -19
  354. package/es/withMobileDialog/index.js +2 -0
  355. package/es/withMobileDialog/withMobileDialog.js +12 -3
  356. package/hi-svg-icons/HiAccount.js +14 -4
  357. package/hi-svg-icons/HiActivity.js +14 -4
  358. package/hi-svg-icons/HiAll.js +18 -7
  359. package/hi-svg-icons/HiBilling.js +14 -4
  360. package/hi-svg-icons/HiBriefcaseRescue.js +14 -4
  361. package/hi-svg-icons/HiBusiness.js +14 -4
  362. package/hi-svg-icons/HiCatalog.js +14 -4
  363. package/hi-svg-icons/HiCustomer.js +14 -4
  364. package/hi-svg-icons/HiDownload.js +14 -4
  365. package/hi-svg-icons/HiFinance.js +14 -4
  366. package/hi-svg-icons/HiFinanceMenu.js +14 -4
  367. package/hi-svg-icons/HiHostedPaymentPage.js +14 -4
  368. package/hi-svg-icons/HiHostedPaymentPageMenu.js +14 -4
  369. package/hi-svg-icons/HiIntegration.js +14 -4
  370. package/hi-svg-icons/HiIntegrationMenu.js +14 -4
  371. package/hi-svg-icons/HiIntelligence.js +14 -4
  372. package/hi-svg-icons/HiIntelligenceMenu.js +14 -4
  373. package/hi-svg-icons/HiInvoice.js +14 -4
  374. package/hi-svg-icons/HiInvoiceMenu.js +14 -4
  375. package/hi-svg-icons/HiLogoRounded.js +17 -6
  376. package/hi-svg-icons/HiOrder.js +14 -4
  377. package/hi-svg-icons/HiPaymentOrder.js +14 -4
  378. package/hi-svg-icons/HiPermission.js +14 -4
  379. package/hi-svg-icons/HiPriceGrid.js +14 -4
  380. package/hi-svg-icons/HiPrivate.js +14 -4
  381. package/hi-svg-icons/HiRoute.js +14 -4
  382. package/hi-svg-icons/HiRouteMenu.js +14 -4
  383. package/hi-svg-icons/HiRouteSwitch.js +19 -7
  384. package/hi-svg-icons/HiRouteSwitchMenu.js +19 -7
  385. package/hi-svg-icons/HiSettlement.js +14 -4
  386. package/hi-svg-icons/HiSizeLarge.js +14 -4
  387. package/hi-svg-icons/HiSizeMedium.js +14 -4
  388. package/hi-svg-icons/HiSizeSmall.js +14 -4
  389. package/hi-svg-icons/HiStore.js +14 -4
  390. package/hi-svg-icons/HiStoreMenu.js +14 -4
  391. package/hi-svg-icons/HiTransaction.js +14 -4
  392. package/hi-svg-icons/HiTransactionMenu.js +14 -4
  393. package/hi-svg-icons/HiUser.js +14 -4
  394. package/hi-svg-icons/HiVendor.js +14 -4
  395. package/hi-svg-icons/HiWidget.js +14 -4
  396. package/hi-svg-icons/index.js +41 -0
  397. package/hi-svg-images/HiLogo.js +12 -4
  398. package/hi-svg-images/HiLogoWhite.js +12 -4
  399. package/hi-svg-images/index.js +3 -0
  400. package/package.json +2 -2
  401. package/setupTest.js +13 -2
  402. package/styleguide/Wrapper.js +6 -0
  403. package/styles/MuiThemeProvider.js +49 -15
  404. package/styles/colorManipulator.js +50 -15
  405. package/styles/createBreakpoints.js +29 -14
  406. package/styles/createGenerateClassName.js +24 -14
  407. package/styles/createMixins.js +10 -4
  408. package/styles/createMuiTheme.js +28 -11
  409. package/styles/createPalette.js +89 -67
  410. package/styles/createStyles.js +1 -0
  411. package/styles/createTypography.js +24 -15
  412. package/styles/getStylesCreator.js +14 -1
  413. package/styles/getThemeProps.js +7 -2
  414. package/styles/index.js +6 -0
  415. package/styles/jssPreset.js +11 -1
  416. package/styles/makeStyles.js +9 -2
  417. package/styles/mergeClasses.js +16 -5
  418. package/styles/shadows.js +4 -1
  419. package/styles/shape.js +2 -1
  420. package/styles/spacing.js +4 -1
  421. package/styles/themeListener.js +10 -2
  422. package/styles/transitions.js +35 -20
  423. package/styles/withStyles.js +9 -2
  424. package/styles/zIndex.js +2 -1
  425. package/test-utils/createMount.js +12 -2
  426. package/test-utils/createRender.js +9 -2
  427. package/test-utils/createShallow.js +17 -6
  428. package/test-utils/getClasses.js +4 -1
  429. package/test-utils/index.js +6 -0
  430. package/test-utils/until.js +14 -3
  431. package/test-utils/unwrap.js +1 -0
  432. package/theme/palette.js +7 -2
  433. package/theme/typography.js +15 -7
  434. package/theme.js +8 -2
  435. package/transitions/utils.js +7 -3
  436. package/utils/exactProp.js +13 -3
  437. package/utils/helpers.js +58 -19
  438. package/withMobileDialog/index.js +2 -0
  439. package/withMobileDialog/withMobileDialog.js +12 -3
@@ -1,42 +1,75 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.styles = exports.default = void 0;
9
+
8
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
11
+
9
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
13
+
10
14
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));
15
+
11
16
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
17
+
12
18
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
19
+
13
20
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
21
+
14
22
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
23
+
15
24
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
25
+
16
26
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
27
+
17
28
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
29
+
18
30
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
31
+
19
32
  var _react = _interopRequireDefault(require("react"));
33
+
20
34
  var _reactCustomScrollbars = _interopRequireDefault(require("react-custom-scrollbars"));
35
+
21
36
  var _Grow = _interopRequireDefault(require("@mui/material/Grow"));
37
+
22
38
  var _Paper = _interopRequireDefault(require("@mui/material/Paper"));
39
+
23
40
  var _Popper = _interopRequireDefault(require("@mui/material/Popper"));
41
+
24
42
  var _ClickAwayListener = _interopRequireDefault(require("@mui/material/ClickAwayListener"));
43
+
25
44
  var _HiSelectableList = _interopRequireDefault(require("../HiSelectableList"));
45
+
26
46
  var _HiInput = _interopRequireDefault(require("../HiForm/HiInput"));
47
+
27
48
  var _HiSelectInput = _interopRequireDefault(require("./HiSelectInput"));
49
+
28
50
  var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
51
+
29
52
  var _helpers = require("../utils/helpers");
53
+
30
54
  var _HiIcon = _interopRequireDefault(require("../HiIcon"));
55
+
31
56
  var _keycode = _interopRequireDefault(require("keycode"));
57
+
32
58
  var _classnames = _interopRequireDefault(require("classnames"));
59
+
33
60
  var _HiAlertModal = _interopRequireDefault(require("../HiAlertModal"));
61
+
34
62
  var _reactDeviceDetect = require("react-device-detect");
63
+
35
64
  var _HiSelectMobile = _interopRequireDefault(require("./HiSelectMobile"));
65
+
36
66
  var _reactDom = require("react-dom");
67
+
37
68
  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); }; }
69
+
38
70
  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; } }
39
- var styles = exports.styles = function styles(theme) {
71
+
72
+ var styles = function styles(theme) {
40
73
  return {
41
74
  root: {
42
75
  backgroundColor: theme.palette.background2,
@@ -91,10 +124,12 @@ var styles = exports.styles = function styles(theme) {
91
124
  }
92
125
  };
93
126
  };
127
+
128
+ exports.styles = styles;
129
+
94
130
  function filterValue(item, search) {
95
131
  return search === '' || (0, _helpers.foldAccents)(item.label.toString().toLowerCase()).search((0, _helpers.foldAccents)(search.toLowerCase())) !== -1;
96
132
  }
97
-
98
133
  /**
99
134
  *
100
135
  * Utilisé pour tous types de selects dans les formulaires.
@@ -110,21 +145,19 @@ function filterValue(item, search) {
110
145
  * - HiSearchField : intègre une barre de recherche dans le Popper, il filtre la liste des suggestions
111
146
  * - HiSelectableList : affiche la liste des suggestions selon le type des éléments
112
147
  */
148
+
149
+
113
150
  var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
114
151
  (0, _inherits2.default)(HiSelect, _React$PureComponent);
152
+
115
153
  var _super = _createSuper(HiSelect);
154
+
116
155
  function HiSelect(_props) {
117
156
  var _this;
157
+
118
158
  (0, _classCallCheck2.default)(this, HiSelect);
119
159
  _this = _super.call(this, _props);
120
- /**
121
- * Build itemList & inputValue from select props
122
- * @param options
123
- * @param value
124
- * @param search
125
- * @param loading
126
- * @returns {{itemList: *[], inputValue: *}}
127
- */
160
+
128
161
  _this.buildSelectProps = function (options) {
129
162
  var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
130
163
  var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
@@ -151,25 +184,30 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
151
184
  inputValue: _this.buildInputValue(options, value, loading)
152
185
  };
153
186
  };
187
+
154
188
  _this.findRecursively = function (arr, id) {
155
189
  for (var i = 0; i < arr.length; i++) {
156
190
  if (arr[i].id === id) {
157
191
  return arr[i];
158
192
  } else if (arr[i].children && arr[i].children.length) {
159
193
  var found = _this.findRecursively(arr[i].children, id);
194
+
160
195
  if (found) return found;
161
196
  }
162
197
  }
163
198
  };
199
+
164
200
  _this.buildInputValue = function (options) {
165
201
  var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
166
202
  var loading = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
167
203
  var _this$props = _this.props,
168
- classes = _this$props.classes,
169
- hasAll = _this$props.hasAll,
170
- translations = _this$props.translations,
171
- type = _this$props.type; // build input value
204
+ classes = _this$props.classes,
205
+ hasAll = _this$props.hasAll,
206
+ translations = _this$props.translations,
207
+ type = _this$props.type; // build input value
208
+
172
209
  var inputValue;
210
+
173
211
  if (loading && value.length === 1) {
174
212
  inputValue = translations.one_item_selected;
175
213
  } else if (hasAll && options.length === value.length) {
@@ -179,6 +217,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
179
217
  inputValue = translations.n_items_selected.replace('%s', value.length);
180
218
  } else if (value.length === 1) {
181
219
  var item = _this.findRecursively(options, value[0]);
220
+
182
221
  if (item === undefined) {
183
222
  inputValue = translations.one_item_selected;
184
223
  } else if (type === 'icon' || item.type === 'icon') {
@@ -187,6 +226,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
187
226
  color: item.color
188
227
  };
189
228
  var icon;
229
+
190
230
  if (typeof item.icon === 'string') {
191
231
  icon = /*#__PURE__*/_react.default.createElement(_HiIcon.default, (0, _extends2.default)({
192
232
  icon: item.icon
@@ -195,6 +235,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
195
235
  icon = (0, _objectSpread2.default)({}, item.icon);
196
236
  icon.props = (0, _objectSpread2.default)({}, icon.props, {}, iconProps);
197
237
  }
238
+
198
239
  inputValue = /*#__PURE__*/_react.default.createElement("span", {
199
240
  className: classes.selectIconLabel
200
241
  }, icon, item.label);
@@ -217,31 +258,40 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
217
258
  inputValue = item.label;
218
259
  }
219
260
  }
261
+
220
262
  return inputValue;
221
263
  };
264
+
222
265
  _this.focusOnFirstItem = function () {
223
266
  if (_this.overlay && _this.overlay.querySelector('li:not([tabindex^="-"])')) {
224
267
  setTimeout(function () {
225
268
  var item = _this.overlay.querySelector('li:not([tabindex^="-"])');
269
+
226
270
  item.focus();
227
271
  }, 1);
228
272
  }
229
273
  };
274
+
230
275
  _this.getInputElement = function (el) {
231
276
  _this.searchField = el;
277
+
232
278
  if (_this.props.inputRef) {
233
279
  _this.props.inputRef(_this.searchField);
234
280
  }
235
281
  };
282
+
236
283
  _this.handleBlur = function (event) {
237
284
  _this.handleSearchReset();
285
+
238
286
  _this.setState({
239
287
  focused: false
240
288
  });
289
+
241
290
  if (_this.props.onBlur && !_this.inputEl.contains(event.relatedTarget) && !_this.state.open) {
242
291
  _this.props.onBlur(event);
243
292
  }
244
293
  };
294
+
245
295
  _this.handleClick = function (event) {
246
296
  if (_this.state.open) {
247
297
  _this.handleClose();
@@ -255,10 +305,11 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
255
305
  open: true,
256
306
  alertOpen: false
257
307
  });
308
+
258
309
  _this.handleSuggestions(_this.props.options);
259
- if (_this.props.onClick) _this.props.onClick();
260
310
 
261
- // Gestion du focus
311
+ if (_this.props.onClick) _this.props.onClick(); // Gestion du focus
312
+
262
313
  setTimeout(function () {
263
314
  if (!_this.props.searchable) {
264
315
  // Sinon focus sur l'élément sélectionné
@@ -267,31 +318,38 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
267
318
  }, 1);
268
319
  }
269
320
  };
321
+
270
322
  _this.handleSubmitAlert = function () {
271
323
  _this.handleClick();
272
324
  };
325
+
273
326
  _this.handleCancelAlert = function () {
274
327
  _this.handleClose();
275
328
  };
329
+
276
330
  _this.handleExitedAlert = function () {
277
331
  if (_this.searchField) {
278
332
  _this.searchField.focus();
279
333
  }
280
334
  };
335
+
281
336
  _this.handleCloseAlert = function () {
282
337
  _this.handleClose();
283
338
  };
339
+
284
340
  _this.focusOnSelectedItem = function (selectedValue) {
285
341
  if (_this.overlay && _this.overlay.querySelector('li:not([tabindex^="-"])')) {
286
342
  setTimeout(function () {
287
343
  if (_this.overlay) {
288
344
  // On initialise au premier élément pour être sûr de ne pas se retrouver avec un focus of undefined
289
345
  var item = _this.overlay.querySelector('li:not([tabindex^="-"])');
346
+
290
347
  if (selectedValue && typeof selectedValue === 'string') {
291
348
  item = _this.overlay.getElementsByTagName('li').namedItem(selectedValue);
292
349
  } else if (selectedValue && typeof selectedValue === 'number') {
293
350
  item = _this.overlay.querySelector('li:not([tabindex^="-"])')[selectedValue - 1];
294
351
  }
352
+
295
353
  if (item) {
296
354
  item.focus();
297
355
  }
@@ -299,59 +357,70 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
299
357
  }, 1);
300
358
  }
301
359
  };
360
+
302
361
  _this.handleClickAway = function (event) {
303
362
  // Au clic sur le bouton, on laisse le handleClick fermer le select
304
363
  if (!_this.inputEl.contains(event.target)) {
305
364
  _this.handleClose(event);
306
365
  }
307
366
  };
367
+
308
368
  _this.handleClose = function () {
309
369
  _this.handleSearchReset();
370
+
310
371
  _this.setState({
311
372
  open: false,
312
373
  alertOpen: false
313
374
  });
375
+
314
376
  if (_this.props.onClose) {
315
377
  _this.props.onClose();
316
378
  }
379
+
317
380
  if (_this.inputEl) {
318
381
  setTimeout(function () {
319
382
  _this.inputEl.focus();
320
383
  }, 100);
321
384
  }
322
385
  };
386
+
323
387
  _this.handleFocus = function () {
324
388
  _this.setState({
325
389
  focused: true
326
390
  });
327
391
  };
328
- // Stop the propagation of the event before it reach the childrens
392
+
329
393
  _this.handleKeyDownCapture = function (event) {
330
394
  var key = (0, _keycode.default)(event);
395
+
331
396
  if (key === 'enter') {
332
397
  if (_this.state.open) {
333
398
  if (_this.props.multiple) {
334
399
  event.stopPropagation();
400
+
335
401
  _this.handleClose();
336
402
  }
337
403
  }
338
404
  }
339
405
  };
340
- // Key down on input
406
+
341
407
  _this.handleKeyDown = function (event) {
342
408
  var key = (0, _keycode.default)(event);
409
+
343
410
  if (!_this.state.alertOpen) {
344
411
  if (event.target === _this.inputEl && _this.state.open && key === 'down') {
345
412
  // Focus on list 1st item
346
413
  event.stopPropagation();
347
414
  event.preventDefault();
348
415
  var firstLi = document.querySelector("#".concat(_this.props.id, " + div ul > li"));
416
+
349
417
  if (!!firstLi) {
350
418
  firstLi.focus();
351
419
  }
352
420
  } else if (key === 'esc' && _this.state.open) {
353
421
  event.stopPropagation();
354
422
  event.preventDefault();
423
+
355
424
  _this.handleClose();
356
425
  } else if (key === 'enter') {
357
426
  if (_this.state.open) {
@@ -363,6 +432,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
363
432
  event.preventDefault();
364
433
  } else if (key === 'tab' && (_this.state.open || _this.state.alertOpen)) {
365
434
  event.stopPropagation();
435
+
366
436
  _this.handleClose();
367
437
  } else if (key === 'down' && event.target.id.includes('_subheader')) {
368
438
  // Focus on parent, next item is child
@@ -371,6 +441,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
371
441
  }
372
442
  } else if (key === 'down' && !event.target.nextSibling) {
373
443
  var _document$getElementB, _document$getElementB2;
444
+
374
445
  // Focus on parent, next item is child
375
446
  if ((_document$getElementB = document.getElementById(event.target.dataset.group)) === null || _document$getElementB === void 0 ? void 0 : (_document$getElementB2 = _document$getElementB.nextSibling) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.nextSibling) {
376
447
  document.getElementById(event.target.dataset.group).nextSibling.nextSibling.focus();
@@ -388,13 +459,15 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
388
459
  }
389
460
  }
390
461
  };
391
- // Key down on search input
462
+
392
463
  _this.handleKeyDownSearch = function (event) {
393
464
  var key = (0, _keycode.default)(event);
465
+
394
466
  if (_this.overlay && (key === 'down' || key === 'up')) {
395
467
  _this.focusOnFirstItem();
396
468
  } else if (_this.overlay && (key === 'esc' || key === 'enter')) {
397
469
  event.preventDefault();
470
+
398
471
  _this.handleClose();
399
472
  } else if (key === 'tab') {
400
473
  _this.setState({
@@ -402,32 +475,21 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
402
475
  });
403
476
  }
404
477
  };
405
- /**
406
- * Call onScrollReachBottom
407
- * @param e
408
- */
478
+
409
479
  _this.handleScroll = function (e) {
410
480
  if (e.target.scrollHeight - e.target.clientHeight - e.target.scrollTop < 15) {
411
481
  _this.props.onScrollReachBottom();
412
482
  }
413
483
  };
414
- /**
415
- * Call onChange with the updated value
416
- *
417
- * - handle single value
418
- * - handle multiple value
419
- * - handle '_all' id
420
- *
421
- * @param event
422
- * @param item
423
- */
484
+
424
485
  _this.handleSelect = function (event, item) {
425
486
  var _this$props2 = _this.props,
426
- hasAll = _this$props2.hasAll,
427
- multiple = _this$props2.multiple,
428
- onChange = _this$props2.onChange,
429
- options = _this$props2.options,
430
- value = _this$props2.value;
487
+ hasAll = _this$props2.hasAll,
488
+ multiple = _this$props2.multiple,
489
+ onChange = _this$props2.onChange,
490
+ options = _this$props2.options,
491
+ value = _this$props2.value;
492
+
431
493
  if (!multiple) {
432
494
  // This is a fix to prevent select open after select => TODO improve ?
433
495
  setTimeout(function () {
@@ -459,17 +521,13 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
459
521
  onChange(event, [].concat((0, _toConsumableArray2.default)(value), [item.id]), item);
460
522
  }
461
523
  };
462
- /**
463
- * Update suggestions list
464
- * - add '_no_result' item if suggestion list is empty
465
- * - add '_all' item if suggestion list is complete
466
- * @param suggestions
467
- */
524
+
468
525
  _this.handleSuggestions = function (suggestions) {
469
526
  var _this$props3 = _this.props,
470
- hasAll = _this$props3.hasAll,
471
- iconAll = _this$props3.iconAll,
472
- translations = _this$props3.translations;
527
+ hasAll = _this$props3.hasAll,
528
+ iconAll = _this$props3.iconAll,
529
+ translations = _this$props3.translations;
530
+
473
531
  if (suggestions.length === 0) {
474
532
  // Add '_no_result' suggestion
475
533
  _this.setState(function (prevState) {
@@ -496,8 +554,10 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
496
554
  });
497
555
  }
498
556
  };
557
+
499
558
  _this.handleSearch = function (e, inputValue) {
500
559
  var searchValue = inputValue && e.target.value ? inputValue : e.target.value;
560
+
501
561
  if (_this.props.onSearch) {
502
562
  _this.props.onSearch(e, searchValue);
503
563
  } else {
@@ -506,6 +566,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
506
566
  });
507
567
  }
508
568
  };
569
+
509
570
  _this.handleSearchReset = function () {
510
571
  _this.handleSearch({
511
572
  target: {
@@ -513,11 +574,13 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
513
574
  }
514
575
  }, '');
515
576
  };
577
+
516
578
  _this.getLengthItemList = function (itemList) {
517
579
  var itemListLength = 0;
518
580
  itemList.forEach(function (parent) {
519
581
  if (parent.displayed !== false) {
520
582
  itemListLength += 1;
583
+
521
584
  if (parent.children) {
522
585
  itemListLength += _this.getLengthItemList(parent.children);
523
586
  }
@@ -525,9 +588,10 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
525
588
  });
526
589
  return itemListLength;
527
590
  };
591
+
528
592
  _this.renderScrollbarTrackHorizontal = function (props) {
529
593
  var style = props.style,
530
- otherProps = (0, _objectWithoutProperties2.default)(props, ["style"]);
594
+ otherProps = (0, _objectWithoutProperties2.default)(props, ["style"]);
531
595
  var inlineStyle = (0, _objectSpread2.default)({}, style, {
532
596
  zIndex: 10,
533
597
  right: 2,
@@ -539,9 +603,10 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
539
603
  style: inlineStyle
540
604
  }));
541
605
  };
606
+
542
607
  _this.renderScrollbarTrackVertical = function (props) {
543
608
  var style = props.style,
544
- otherProps = (0, _objectWithoutProperties2.default)(props, ["style"]);
609
+ otherProps = (0, _objectWithoutProperties2.default)(props, ["style"]);
545
610
  var inlineStyle = (0, _objectSpread2.default)({}, style, {
546
611
  zIndex: 10,
547
612
  right: 2,
@@ -553,6 +618,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
553
618
  style: inlineStyle
554
619
  }));
555
620
  };
621
+
556
622
  _this.state = {
557
623
  alertOpen: false,
558
624
  open: false,
@@ -564,12 +630,14 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
564
630
  };
565
631
  return _this;
566
632
  }
633
+
567
634
  (0, _createClass2.default)(HiSelect, [{
568
635
  key: "componentDidMount",
569
636
  value: function componentDidMount() {
570
637
  if (this.props.autoFocus) {
571
638
  this.inputEl.focus();
572
639
  }
640
+
573
641
  if (this.overlay) {
574
642
  this.setState({
575
643
  overlayWidth: (0, _reactDom.findDOMNode)(this.overlay).clientWidth
@@ -579,65 +647,76 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
579
647
  }, {
580
648
  key: "render",
581
649
  value: function render() {
582
- var _this2 = this;
650
+ var _classNames,
651
+ _this2 = this;
652
+
583
653
  var _this$props4 = this.props,
584
- alert = _this$props4.alert,
585
- classes = _this$props4.classes,
586
- disabled = _this$props4.disabled,
587
- error = _this$props4.error,
588
- loading = _this$props4.loading,
589
- options = _this$props4.options,
590
- searchable = _this$props4.searchable,
591
- displayAsChip = _this$props4.displayAsChip,
592
- type = _this$props4.type,
593
- value = _this$props4.value,
594
- multiple = _this$props4.multiple,
595
- translations = _this$props4.translations,
596
- hiSearchInputProps = _this$props4.hiSearchInputProps,
597
- hiSelectableListProps = _this$props4.hiSelectableListProps,
598
- hiSelectInputProps = _this$props4.hiSelectInputProps,
599
- id = _this$props4.id,
600
- onScrollReachBottom = _this$props4.onScrollReachBottom,
601
- onSubmit = _this$props4.onSubmit,
602
- placeholder = _this$props4.placeholder,
603
- _this$props4$searchVa = _this$props4.searchValue,
604
- searchValue = _this$props4$searchVa === void 0 ? this.state.searchValue : _this$props4$searchVa,
605
- startAdornment = _this$props4.startAdornment,
606
- staticPosition = _this$props4.staticPosition,
607
- maxOptionsDisplayed = _this$props4.maxOptionsDisplayed,
608
- _this$props4$buildSel = _this$props4.buildSelectProps,
609
- buildSelectProps = _this$props4$buildSel === void 0 ? this.buildSelectProps : _this$props4$buildSel;
654
+ alert = _this$props4.alert,
655
+ classes = _this$props4.classes,
656
+ disabled = _this$props4.disabled,
657
+ error = _this$props4.error,
658
+ loading = _this$props4.loading,
659
+ options = _this$props4.options,
660
+ searchable = _this$props4.searchable,
661
+ displayAsChip = _this$props4.displayAsChip,
662
+ type = _this$props4.type,
663
+ value = _this$props4.value,
664
+ multiple = _this$props4.multiple,
665
+ translations = _this$props4.translations,
666
+ hiSearchInputProps = _this$props4.hiSearchInputProps,
667
+ hiSelectableListProps = _this$props4.hiSelectableListProps,
668
+ hiSelectInputProps = _this$props4.hiSelectInputProps,
669
+ id = _this$props4.id,
670
+ onScrollReachBottom = _this$props4.onScrollReachBottom,
671
+ onSubmit = _this$props4.onSubmit,
672
+ placeholder = _this$props4.placeholder,
673
+ _this$props4$searchVa = _this$props4.searchValue,
674
+ searchValue = _this$props4$searchVa === void 0 ? this.state.searchValue : _this$props4$searchVa,
675
+ startAdornment = _this$props4.startAdornment,
676
+ staticPosition = _this$props4.staticPosition,
677
+ maxOptionsDisplayed = _this$props4.maxOptionsDisplayed,
678
+ _this$props4$buildSel = _this$props4.buildSelectProps,
679
+ buildSelectProps = _this$props4$buildSel === void 0 ? this.buildSelectProps : _this$props4$buildSel;
610
680
  var _this$state = this.state,
611
- alertOpen = _this$state.alertOpen,
612
- open = _this$state.open,
613
- focused = _this$state.focused;
681
+ alertOpen = _this$state.alertOpen,
682
+ open = _this$state.open,
683
+ focused = _this$state.focused;
684
+
614
685
  if (multiple) {
615
686
  if (!Array.isArray(value)) {
616
687
  throw new Error('HiPay Material-UI: the `value` property must be an array ' + 'when using the `HiSelect` component with `multiple`.');
617
688
  }
618
689
  }
690
+
619
691
  var selectedItemIdList = [];
692
+
620
693
  if (value) {
621
694
  selectedItemIdList = multiple ? (0, _toConsumableArray2.default)(value) : [value];
622
695
  }
696
+
623
697
  var _buildSelectProps = buildSelectProps(options, selectedItemIdList, searchValue, loading),
624
- itemList = _buildSelectProps.itemList,
625
- _buildSelectProps$inp = _buildSelectProps.inputValue,
626
- inputValue = _buildSelectProps$inp === void 0 ? this.buildInputValue(options, selectedItemIdList, loading) : _buildSelectProps$inp;
698
+ itemList = _buildSelectProps.itemList,
699
+ _buildSelectProps$inp = _buildSelectProps.inputValue,
700
+ inputValue = _buildSelectProps$inp === void 0 ? this.buildInputValue(options, selectedItemIdList, loading) : _buildSelectProps$inp;
701
+
627
702
  var popperStyle = {
628
703
  position: staticPosition ? 'relative' : 'fix',
629
704
  top: 0,
630
705
  left: 0
631
706
  };
707
+
632
708
  if (this.props.containerWidth > 0) {
633
709
  popperStyle = {
634
710
  width: this.props.containerWidth
635
711
  };
712
+
636
713
  if (!staticPosition) {
637
714
  popperStyle.position = 'absolute';
638
715
  }
639
716
  }
640
- var popperClass = (0, _classnames.default)(classes.popper, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, classes.popperWidth, !this.props.containerWidth), classes.popperRightAlign, this.props.containerWidth && this.props.align === 'right'));
717
+
718
+ var popperClass = (0, _classnames.default)(classes.popper, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.popperWidth, !this.props.containerWidth), (0, _defineProperty2.default)(_classNames, classes.popperRightAlign, this.props.containerWidth && this.props.align === 'right'), _classNames));
719
+
641
720
  var searchInput = function searchInput(position) {
642
721
  if (searchable) {
643
722
  return /*#__PURE__*/_react.default.createElement(_HiInput.default, (0, _extends2.default)({
@@ -653,24 +732,28 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
653
732
  className: (0, _classnames.default)((0, _defineProperty2.default)({}, classes.separator, position === 'top'))
654
733
  }, hiSearchInputProps));
655
734
  }
735
+
656
736
  return null;
657
- };
737
+ }; // Replace popper onSearch when popper displayed on top of selectButton
738
+
658
739
 
659
- // Replace popper onSearch when popper displayed on top of selectButton
660
740
  if (this.placement && this.placement.indexOf('top') >= 0 && !!searchable) {
661
741
  // In case we have a nested list
662
- var itemListLength = this.getLengthItemList(itemList);
663
- // +1 for search input
742
+ var itemListLength = this.getLengthItemList(itemList); // +1 for search input
743
+
664
744
  var nbItems = itemListLength <= maxOptionsDisplayed - 2 ? itemListLength + 1 : maxOptionsDisplayed - 1;
665
745
  popperStyle.transform = "translate3d(-1px, -".concat(nbItems * 40 + 2, "px, 0px)");
666
746
  } else if (this.placement && this.placement.indexOf('top') < 0 && !!searchable) {
667
747
  popperStyle.transform = 'translate3d(-1px, 40px, 0px)';
668
748
  }
749
+
669
750
  var content = function content(_ref) {
670
751
  var placement = _ref.placement;
752
+
671
753
  if (placement !== _this2.placement) {
672
754
  _this2.placement = placement;
673
755
  }
756
+
674
757
  var nbItemsDisplayed = !!searchable ? maxOptionsDisplayed - 1 : maxOptionsDisplayed;
675
758
  var autoHeightMax = nbItemsDisplayed * 40 - 10;
676
759
  return /*#__PURE__*/_react.default.createElement(_ClickAwayListener.default, {
@@ -706,6 +789,7 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
706
789
  value: value
707
790
  }, hiSelectableListProps))), _this2.placement && _this2.placement.indexOf('top') >= 0 && !staticPosition && searchInput('top'))));
708
791
  };
792
+
709
793
  return !_reactDeviceDetect.isMobile ? /*#__PURE__*/_react.default.createElement("div", {
710
794
  className: classes.root,
711
795
  ref: function ref(el) {
@@ -794,11 +878,22 @@ var HiSelect = /*#__PURE__*/function (_React$PureComponent) {
794
878
  suggestions: nextProps.options
795
879
  });
796
880
  }
881
+
797
882
  return null;
798
883
  }
884
+ /**
885
+ * Build itemList & inputValue from select props
886
+ * @param options
887
+ * @param value
888
+ * @param search
889
+ * @param loading
890
+ * @returns {{itemList: *[], inputValue: *}}
891
+ */
892
+
799
893
  }]);
800
894
  return HiSelect;
801
895
  }(_react.default.PureComponent);
896
+
802
897
  HiSelect.defaultProps = {
803
898
  align: 'left',
804
899
  autoFocus: false,
@@ -826,7 +921,10 @@ HiSelect.defaultProps = {
826
921
  filterFunc: filterValue,
827
922
  maxOptionsDisplayed: 12
828
923
  };
829
- var _default = exports.default = (0, _withStyles.default)(styles, {
924
+
925
+ var _default = (0, _withStyles.default)(styles, {
830
926
  hiComponent: true,
831
927
  name: 'HmuiHiSelect'
832
- })(HiSelect);
928
+ })(HiSelect);
929
+
930
+ exports.default = _default;