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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (391) hide show
  1. package/HI-CHANGELOG.md +58 -0
  2. package/HiAlertModal/HiAlertModal.js +247 -0
  3. package/HiAlertModal/index.js +16 -0
  4. package/HiBreadcrumb/HiBreadcrumb.js +143 -0
  5. package/HiBreadcrumb/HiStep.js +123 -0
  6. package/HiBreadcrumb/HiStepConnector.js +142 -0
  7. package/HiBreadcrumb/HiStepIcon.js +134 -0
  8. package/HiBreadcrumb/HiStepLabel.js +182 -0
  9. package/HiBreadcrumb/HiStepper.js +125 -0
  10. package/HiBreadcrumb/index.js +16 -0
  11. package/HiCheckbox/HiCheckbox.js +4 -1
  12. package/HiChip/HiChip.js +4 -4
  13. package/HiChip/HiChipSwitch.js +11 -4
  14. package/HiColoredLabel/HiColoredLabel.js +3 -2
  15. package/HiDatePicker/HiDatePicker.js +34 -30
  16. package/HiDatePicker/HiDateRangePicker.js +7 -5
  17. package/HiDatePicker/HiDateRangeSelector.js +23 -11
  18. package/HiDatePicker/ListPicker.js +32 -7
  19. package/HiDatePicker/Overlays/MonthPickerOverlay.js +5 -1
  20. package/HiDatePicker/Overlays/YearPickerOverlay.js +2 -1
  21. package/HiDotsStepper/HiDot.js +151 -0
  22. package/HiDotsStepper/HiDotsStepper.js +146 -0
  23. package/HiDotsStepper/index.js +16 -0
  24. package/HiExpansionPanel/HiExpansionPanel.js +231 -0
  25. package/HiExpansionPanel/index.js +16 -0
  26. package/HiForm/HiAddressField.js +204 -0
  27. package/HiForm/HiFormControl.js +39 -31
  28. package/HiForm/HiInput.js +70 -97
  29. package/HiForm/HiSearchField.js +2 -2
  30. package/HiForm/index.js +9 -0
  31. package/HiPdfReader/HiPdfReader.js +282 -0
  32. package/HiPdfReader/index.js +16 -0
  33. package/HiPins/HiPins.js +0 -1
  34. package/HiSelect/HiSelect.js +400 -353
  35. package/HiSelect/HiSelectField.js +8 -6
  36. package/HiSelect/HiSuggestSelect.js +27 -47
  37. package/HiSelect/HiSuggestSelectField.js +88 -80
  38. package/HiSelect/SelectInput.js +34 -23
  39. package/HiSelectableList/HiSelectableList.js +9 -3
  40. package/HiSelectableList/HiSelectableListItem.js +96 -55
  41. package/HiSwitch/HiSwitchState.js +1 -1
  42. package/HiSwitch/index.js +6 -0
  43. package/HiTable/BodyCellBuilder.js +91 -96
  44. package/HiTable/BodyCells/CellCountry.js +11 -36
  45. package/HiTable/BodyCells/CellIcon.js +4 -2
  46. package/HiTable/BodyCells/CellImage.js +23 -10
  47. package/HiTable/BodyCells/CellLayout.js +25 -19
  48. package/HiTable/BodyCells/CellSentinel.js +12 -4
  49. package/HiTable/BodyCells/CellStatus.js +6 -2
  50. package/HiTable/BodyCells/CellText.js +2 -1
  51. package/HiTable/BodyCells/CellThirdPartySecurity.js +5 -6
  52. package/HiTable/BodyRow.js +78 -57
  53. package/HiTable/ColumnFilter.js +28 -15
  54. package/HiTable/HeaderCell.js +17 -14
  55. package/HiTable/HiTable.js +26 -10
  56. package/HiTable/HiTableBody.js +38 -14
  57. package/HiTable/HiTableContextMenu.js +7 -3
  58. package/HiTable/HiTableFooterScroll.js +1 -1
  59. package/HiTable/HiTableHead.js +24 -7
  60. package/HiTable/OrderColumns.js +6 -2
  61. package/HiTopBar/HiTopBar.js +57 -139
  62. package/README.md +13 -13
  63. package/es/HiAlertModal/HiAlertModal.js +189 -0
  64. package/es/HiAlertModal/index.js +1 -0
  65. package/es/HiBreadcrumb/HiBreadcrumb.js +73 -0
  66. package/es/HiBreadcrumb/HiStep.js +93 -0
  67. package/es/HiBreadcrumb/HiStepConnector.js +83 -0
  68. package/es/HiBreadcrumb/HiStepIcon.js +81 -0
  69. package/es/HiBreadcrumb/HiStepLabel.js +154 -0
  70. package/es/HiBreadcrumb/HiStepper.js +62 -0
  71. package/es/HiBreadcrumb/index.js +1 -0
  72. package/es/HiCheckbox/HiCheckbox.js +4 -1
  73. package/es/HiChip/HiChip.js +4 -4
  74. package/es/HiChip/HiChipSwitch.js +11 -4
  75. package/es/HiColoredLabel/HiColoredLabel.js +3 -2
  76. package/es/HiDatePicker/HiDatePicker.js +30 -25
  77. package/es/HiDatePicker/HiDateRangePicker.js +7 -5
  78. package/es/HiDatePicker/HiDateRangeSelector.js +24 -12
  79. package/es/HiDatePicker/ListPicker.js +39 -20
  80. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +5 -1
  81. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +2 -1
  82. package/es/HiDotsStepper/HiDot.js +92 -0
  83. package/es/HiDotsStepper/HiDotsStepper.js +83 -0
  84. package/es/HiDotsStepper/index.js +1 -0
  85. package/es/HiExpansionPanel/HiExpansionPanel.js +170 -0
  86. package/es/HiExpansionPanel/index.js +1 -0
  87. package/es/HiForm/HiAddressField.js +142 -0
  88. package/es/HiForm/HiFormControl.js +32 -18
  89. package/es/HiForm/HiInput.js +68 -97
  90. package/es/HiForm/HiSearchField.js +2 -2
  91. package/es/HiForm/index.js +2 -1
  92. package/es/HiPdfReader/HiPdfReader.js +198 -0
  93. package/es/HiPdfReader/index.js +1 -0
  94. package/es/HiPins/HiPins.js +0 -1
  95. package/es/HiSelect/HiSelect.js +375 -324
  96. package/es/HiSelect/HiSelectField.js +9 -7
  97. package/es/HiSelect/HiSuggestSelect.js +26 -39
  98. package/es/HiSelect/HiSuggestSelectField.js +77 -69
  99. package/es/HiSelect/SelectInput.js +44 -23
  100. package/es/HiSelectableList/HiSelectableList.js +10 -4
  101. package/es/HiSelectableList/HiSelectableListItem.js +91 -55
  102. package/es/HiSwitch/HiSwitchState.js +1 -1
  103. package/es/HiSwitch/index.js +1 -0
  104. package/es/HiTable/BodyCellBuilder.js +90 -97
  105. package/es/HiTable/BodyCells/CellCountry.js +10 -35
  106. package/es/HiTable/BodyCells/CellIcon.js +4 -2
  107. package/es/HiTable/BodyCells/CellImage.js +23 -10
  108. package/es/HiTable/BodyCells/CellLayout.js +27 -21
  109. package/es/HiTable/BodyCells/CellSentinel.js +12 -4
  110. package/es/HiTable/BodyCells/CellStatus.js +6 -2
  111. package/es/HiTable/BodyCells/CellText.js +2 -1
  112. package/es/HiTable/BodyCells/CellThirdPartySecurity.js +5 -6
  113. package/es/HiTable/BodyRow.js +79 -56
  114. package/es/HiTable/ColumnFilter.js +15 -9
  115. package/es/HiTable/HeaderCell.js +17 -14
  116. package/es/HiTable/HiTable.js +26 -10
  117. package/es/HiTable/HiTableBody.js +34 -11
  118. package/es/HiTable/HiTableContextMenu.js +7 -3
  119. package/es/HiTable/HiTableFooterScroll.js +1 -1
  120. package/es/HiTable/HiTableHead.js +19 -7
  121. package/es/HiTable/OrderColumns.js +6 -2
  122. package/es/HiTopBar/HiTopBar.js +58 -127
  123. package/es/styles/createHiMuiTheme.js +11 -0
  124. package/es/utils/HiIconBuilder.js +13 -5
  125. package/es/utils/hiHelpers.js +2 -2
  126. package/hmu/images/countries/ad.svg +151 -0
  127. package/hmu/images/countries/ae.svg +6 -0
  128. package/hmu/images/countries/af.svg +83 -0
  129. package/hmu/images/countries/ag.svg +15 -0
  130. package/hmu/images/countries/ai.svg +767 -0
  131. package/hmu/images/countries/al.svg +5 -0
  132. package/hmu/images/countries/am.svg +5 -0
  133. package/hmu/images/countries/ao.svg +13 -0
  134. package/hmu/images/countries/aq.svg +6 -0
  135. package/hmu/images/countries/ar.svg +32 -0
  136. package/hmu/images/countries/as.svg +33 -0
  137. package/hmu/images/countries/at.svg +6 -0
  138. package/hmu/images/countries/au.svg +9 -0
  139. package/hmu/images/countries/aw.svg +186 -0
  140. package/hmu/images/countries/ax.svg +18 -0
  141. package/hmu/images/countries/az.svg +8 -0
  142. package/hmu/images/countries/ba.svg +12 -0
  143. package/hmu/images/countries/bb.svg +6 -0
  144. package/hmu/images/countries/bd.svg +4 -0
  145. package/hmu/images/countries/be.svg +7 -0
  146. package/hmu/images/countries/bf.svg +7 -0
  147. package/hmu/images/countries/bg.svg +7 -0
  148. package/hmu/images/countries/bh.svg +11 -0
  149. package/hmu/images/countries/bi.svg +15 -0
  150. package/hmu/images/countries/bj.svg +14 -0
  151. package/hmu/images/countries/bl.svg +7 -0
  152. package/hmu/images/countries/bm.svg +99 -0
  153. package/hmu/images/countries/bn.svg +36 -0
  154. package/hmu/images/countries/bo.svg +686 -0
  155. package/hmu/images/countries/bq.svg +5 -0
  156. package/hmu/images/countries/br.svg +45 -0
  157. package/hmu/images/countries/bs.svg +13 -0
  158. package/hmu/images/countries/bt.svg +89 -0
  159. package/hmu/images/countries/bv.svg +13 -0
  160. package/hmu/images/countries/bw.svg +7 -0
  161. package/hmu/images/countries/by.svg +61 -0
  162. package/hmu/images/countries/bz.svg +146 -0
  163. package/hmu/images/countries/ca.svg +4 -0
  164. package/hmu/images/countries/cc.svg +19 -0
  165. package/hmu/images/countries/cd.svg +5 -0
  166. package/hmu/images/countries/cf.svg +15 -0
  167. package/hmu/images/countries/cg.svg +12 -0
  168. package/hmu/images/countries/ch.svg +9 -0
  169. package/hmu/images/countries/ci.svg +7 -0
  170. package/hmu/images/countries/ck.svg +9 -0
  171. package/hmu/images/countries/cl.svg +13 -0
  172. package/hmu/images/countries/cm.svg +15 -0
  173. package/hmu/images/countries/cn.svg +11 -0
  174. package/hmu/images/countries/co.svg +7 -0
  175. package/hmu/images/countries/cr.svg +7 -0
  176. package/hmu/images/countries/cu.svg +13 -0
  177. package/hmu/images/countries/cv.svg +13 -0
  178. package/hmu/images/countries/cw.svg +14 -0
  179. package/hmu/images/countries/cx.svg +15 -0
  180. package/hmu/images/countries/cy.svg +6 -0
  181. package/hmu/images/countries/cz.svg +12 -0
  182. package/hmu/images/countries/de.svg +5 -0
  183. package/hmu/images/countries/dj.svg +13 -0
  184. package/hmu/images/countries/dk.svg +5 -0
  185. package/hmu/images/countries/dm.svg +152 -0
  186. package/hmu/images/countries/do.svg +6745 -0
  187. package/hmu/images/countries/dz.svg +5 -0
  188. package/hmu/images/countries/ec.svg +141 -0
  189. package/hmu/images/countries/ee.svg +7 -0
  190. package/hmu/images/countries/eg.svg +38 -0
  191. package/hmu/images/countries/eh.svg +15 -0
  192. package/hmu/images/countries/er.svg +8 -0
  193. package/hmu/images/countries/es-ct.svg +4 -0
  194. package/hmu/images/countries/es.svg +581 -0
  195. package/hmu/images/countries/et.svg +14 -0
  196. package/hmu/images/countries/eu.svg +28 -0
  197. package/hmu/images/countries/fi.svg +5 -0
  198. package/hmu/images/countries/fj.svg +124 -0
  199. package/hmu/images/countries/fk.svg +90 -0
  200. package/hmu/images/countries/fm.svg +11 -0
  201. package/hmu/images/countries/fo.svg +12 -0
  202. package/hmu/images/countries/fr.svg +7 -0
  203. package/hmu/images/countries/ga.svg +7 -0
  204. package/hmu/images/countries/gb-eng.svg +5 -0
  205. package/hmu/images/countries/gb-nir.svg +137 -0
  206. package/hmu/images/countries/gb-sct.svg +4 -0
  207. package/hmu/images/countries/gb-wls.svg +9 -0
  208. package/hmu/images/countries/gb.svg +15 -0
  209. package/hmu/images/countries/gd.svg +27 -0
  210. package/hmu/images/countries/ge.svg +6 -0
  211. package/hmu/images/countries/gf.svg +5 -0
  212. package/hmu/images/countries/gg.svg +9 -0
  213. package/hmu/images/countries/gh.svg +6 -0
  214. package/hmu/images/countries/gi.svg +33 -0
  215. package/hmu/images/countries/gl.svg +4 -0
  216. package/hmu/images/countries/gm.svg +14 -0
  217. package/hmu/images/countries/gn.svg +7 -0
  218. package/hmu/images/countries/gp.svg +7 -0
  219. package/hmu/images/countries/gq.svg +23 -0
  220. package/hmu/images/countries/gr.svg +22 -0
  221. package/hmu/images/countries/gs.svg +205 -0
  222. package/hmu/images/countries/gt.svg +204 -0
  223. package/hmu/images/countries/gu.svg +39 -0
  224. package/hmu/images/countries/gw.svg +13 -0
  225. package/hmu/images/countries/gy.svg +9 -0
  226. package/hmu/images/countries/hk.svg +32 -0
  227. package/hmu/images/countries/hm.svg +9 -0
  228. package/hmu/images/countries/hn.svg +18 -0
  229. package/hmu/images/countries/hr.svg +59 -0
  230. package/hmu/images/countries/ht.svg +122 -0
  231. package/hmu/images/countries/hu.svg +7 -0
  232. package/hmu/images/countries/id.svg +6 -0
  233. package/hmu/images/countries/ie.svg +7 -0
  234. package/hmu/images/countries/il.svg +14 -0
  235. package/hmu/images/countries/im.svg +36 -0
  236. package/hmu/images/countries/in.svg +25 -0
  237. package/hmu/images/countries/io.svg +148 -0
  238. package/hmu/images/countries/iq.svg +10 -0
  239. package/hmu/images/countries/ir.svg +219 -0
  240. package/hmu/images/countries/is.svg +12 -0
  241. package/hmu/images/countries/it.svg +7 -0
  242. package/hmu/images/countries/je.svg +32 -0
  243. package/hmu/images/countries/jm.svg +8 -0
  244. package/hmu/images/countries/jo.svg +16 -0
  245. package/hmu/images/countries/jp.svg +11 -0
  246. package/hmu/images/countries/ke.svg +23 -0
  247. package/hmu/images/countries/kg.svg +15 -0
  248. package/hmu/images/countries/kh.svg +69 -0
  249. package/hmu/images/countries/ki.svg +36 -0
  250. package/hmu/images/countries/km.svg +16 -0
  251. package/hmu/images/countries/kn.svg +14 -0
  252. package/hmu/images/countries/kp.svg +15 -0
  253. package/hmu/images/countries/kr.svg +24 -0
  254. package/hmu/images/countries/kw.svg +13 -0
  255. package/hmu/images/countries/ky.svg +63 -0
  256. package/hmu/images/countries/kz.svg +23 -0
  257. package/hmu/images/countries/la.svg +12 -0
  258. package/hmu/images/countries/lb.svg +15 -0
  259. package/hmu/images/countries/lc.svg +8 -0
  260. package/hmu/images/countries/li.svg +43 -0
  261. package/hmu/images/countries/lk.svg +22 -0
  262. package/hmu/images/countries/lr.svg +14 -0
  263. package/hmu/images/countries/ls.svg +8 -0
  264. package/hmu/images/countries/lt.svg +7 -0
  265. package/hmu/images/countries/lu.svg +5 -0
  266. package/hmu/images/countries/lv.svg +6 -0
  267. package/hmu/images/countries/ly.svg +13 -0
  268. package/hmu/images/countries/ma.svg +4 -0
  269. package/hmu/images/countries/mc.svg +6 -0
  270. package/hmu/images/countries/md.svg +72 -0
  271. package/hmu/images/countries/me.svg +118 -0
  272. package/hmu/images/countries/mf.svg +7 -0
  273. package/hmu/images/countries/mg.svg +7 -0
  274. package/hmu/images/countries/mh.svg +7 -0
  275. package/hmu/images/countries/mk.svg +5 -0
  276. package/hmu/images/countries/ml.svg +7 -0
  277. package/hmu/images/countries/mm.svg +16 -0
  278. package/hmu/images/countries/mn.svg +13 -0
  279. package/hmu/images/countries/mo.svg +9 -0
  280. package/hmu/images/countries/mp.svg +86 -0
  281. package/hmu/images/countries/mq.svg +7 -0
  282. package/hmu/images/countries/mr.svg +6 -0
  283. package/hmu/images/countries/ms.svg +39 -0
  284. package/hmu/images/countries/mt.svg +49 -0
  285. package/hmu/images/countries/mu.svg +8 -0
  286. package/hmu/images/countries/mv.svg +6 -0
  287. package/hmu/images/countries/mw.svg +10 -0
  288. package/hmu/images/countries/mx.svg +385 -0
  289. package/hmu/images/countries/my.svg +15 -0
  290. package/hmu/images/countries/mz.svg +21 -0
  291. package/hmu/images/countries/na.svg +16 -0
  292. package/hmu/images/countries/nc.svg +7 -0
  293. package/hmu/images/countries/ne.svg +6 -0
  294. package/hmu/images/countries/nf.svg +9 -0
  295. package/hmu/images/countries/ng.svg +6 -0
  296. package/hmu/images/countries/ni.svg +131 -0
  297. package/hmu/images/countries/nl.svg +7 -0
  298. package/hmu/images/countries/no.svg +7 -0
  299. package/hmu/images/countries/np.svg +14 -0
  300. package/hmu/images/countries/nr.svg +12 -0
  301. package/hmu/images/countries/nu.svg +26 -0
  302. package/hmu/images/countries/nz.svg +41 -0
  303. package/hmu/images/countries/om.svg +116 -0
  304. package/hmu/images/countries/pa.svg +14 -0
  305. package/hmu/images/countries/pe.svg +279 -0
  306. package/hmu/images/countries/pf.svg +19 -0
  307. package/hmu/images/countries/pg.svg +9 -0
  308. package/hmu/images/countries/ph.svg +28 -0
  309. package/hmu/images/countries/pk.svg +15 -0
  310. package/hmu/images/countries/pl.svg +6 -0
  311. package/hmu/images/countries/pm.svg +7 -0
  312. package/hmu/images/countries/pn.svg +62 -0
  313. package/hmu/images/countries/pr.svg +13 -0
  314. package/hmu/images/countries/ps.svg +15 -0
  315. package/hmu/images/countries/pt.svg +57 -0
  316. package/hmu/images/countries/pw.svg +11 -0
  317. package/hmu/images/countries/py.svg +157 -0
  318. package/hmu/images/countries/qa.svg +4 -0
  319. package/hmu/images/countries/re.svg +7 -0
  320. package/hmu/images/countries/ro.svg +7 -0
  321. package/hmu/images/countries/rs.svg +292 -0
  322. package/hmu/images/countries/ru.svg +7 -0
  323. package/hmu/images/countries/rw.svg +13 -0
  324. package/hmu/images/countries/sa.svg +26 -0
  325. package/hmu/images/countries/sb.svg +13 -0
  326. package/hmu/images/countries/sc.svg +14 -0
  327. package/hmu/images/countries/sd.svg +13 -0
  328. package/hmu/images/countries/se.svg +16 -0
  329. package/hmu/images/countries/sg.svg +13 -0
  330. package/hmu/images/countries/sh.svg +74 -0
  331. package/hmu/images/countries/si.svg +18 -0
  332. package/hmu/images/countries/sj.svg +7 -0
  333. package/hmu/images/countries/sk.svg +9 -0
  334. package/hmu/images/countries/sl.svg +7 -0
  335. package/hmu/images/countries/sm.svg +91 -0
  336. package/hmu/images/countries/sn.svg +8 -0
  337. package/hmu/images/countries/so.svg +11 -0
  338. package/hmu/images/countries/sr.svg +6 -0
  339. package/hmu/images/countries/ss.svg +8 -0
  340. package/hmu/images/countries/st.svg +16 -0
  341. package/hmu/images/countries/sv.svg +618 -0
  342. package/hmu/images/countries/sx.svg +56 -0
  343. package/hmu/images/countries/sy.svg +6 -0
  344. package/hmu/images/countries/sz.svg +45 -0
  345. package/hmu/images/countries/tc.svg +67 -0
  346. package/hmu/images/countries/td.svg +7 -0
  347. package/hmu/images/countries/tf.svg +15 -0
  348. package/hmu/images/countries/tg.svg +14 -0
  349. package/hmu/images/countries/th.svg +7 -0
  350. package/hmu/images/countries/tj.svg +22 -0
  351. package/hmu/images/countries/tk.svg +5 -0
  352. package/hmu/images/countries/tl.svg +13 -0
  353. package/hmu/images/countries/tm.svg +213 -0
  354. package/hmu/images/countries/tn.svg +13 -0
  355. package/hmu/images/countries/to.svg +10 -0
  356. package/hmu/images/countries/tr.svg +8 -0
  357. package/hmu/images/countries/tt.svg +5 -0
  358. package/hmu/images/countries/tv.svg +27 -0
  359. package/hmu/images/countries/tw.svg +14 -0
  360. package/hmu/images/countries/tz.svg +13 -0
  361. package/hmu/images/countries/ua.svg +6 -0
  362. package/hmu/images/countries/ug.svg +30 -0
  363. package/hmu/images/countries/um.svg +23 -0
  364. package/hmu/images/countries/un.svg +16 -0
  365. package/hmu/images/countries/us.svg +12 -0
  366. package/hmu/images/countries/uy.svg +28 -0
  367. package/hmu/images/countries/uz.svg +30 -0
  368. package/hmu/images/countries/va.svg +483 -0
  369. package/hmu/images/countries/vc.svg +8 -0
  370. package/hmu/images/countries/ve.svg +26 -0
  371. package/hmu/images/countries/vg.svg +133 -0
  372. package/hmu/images/countries/vi.svg +31 -0
  373. package/hmu/images/countries/vn.svg +11 -0
  374. package/hmu/images/countries/vu.svg +18 -0
  375. package/hmu/images/countries/wf.svg +7 -0
  376. package/hmu/images/countries/ws.svg +7 -0
  377. package/hmu/images/countries/ye.svg +7 -0
  378. package/hmu/images/countries/yt.svg +7 -0
  379. package/hmu/images/countries/za.svg +17 -0
  380. package/hmu/images/countries/zm.svg +27 -0
  381. package/hmu/images/countries/zw.svg +21 -0
  382. package/hmu/images/hipay-white-logo.svg +42 -0
  383. package/hmu/images/logo_visa_75wx45h.gif +0 -0
  384. package/index.es.js +1 -1
  385. package/index.js +1 -1
  386. package/package.json +4 -3
  387. package/styles/createHiMuiTheme.js +11 -0
  388. package/umd/hipay-material-ui.development.js +11339 -11003
  389. package/umd/hipay-material-ui.production.min.js +5 -5
  390. package/utils/HiIconBuilder.js +17 -7
  391. package/utils/hiHelpers.js +2 -2
@@ -0,0 +1,142 @@
1
+ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
2
+ import _extends from 'babel-runtime/helpers/extends';
3
+ // @inheritedComponent HiSuggestSelectField
4
+
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import HiSuggestSelectField from '../HiSelect/HiSuggestSelectField';
8
+
9
+ /**
10
+ * Champs input adresse pour formulaire
11
+ */
12
+ class HiAddressField extends React.Component {
13
+ constructor(props) {
14
+ super(props);
15
+ this.autocompleteService = null;
16
+
17
+ this.displaySuggestions = (predictions, status) => {
18
+ if (status !== 'OK') {
19
+ // Si l'API renvoie un statut différent de 'OK'
20
+ // (par exemple ZERO_RESULTS), pas de prédictions
21
+ } else {
22
+ // Sinon je mets à jour les options du champ avec les prédictions de GMaps
23
+ const options = [];
24
+ let isExact = false;
25
+ predictions.forEach(prediction => {
26
+ // Si le texte saisi est identique à une des propositions de GMaps,
27
+ // on estime que la valeur de l'adresse est exacte,
28
+ // même sans clic sur une proposition
29
+ isExact = prediction.description === this.value ? true : isExact;
30
+ options.push({
31
+ id: prediction.id,
32
+ label: prediction.description,
33
+ labelHighlight: prediction.description.replace(new RegExp(this.value, 'gi'), '<strong>$&</strong>'),
34
+ icon: prediction.types.indexOf('establishment') >= 0 ? 'domain' : 'map_marker',
35
+ type: 'icon'
36
+ });
37
+ }, this);
38
+ this.setState({ options, isExact });
39
+ }
40
+ };
41
+
42
+ this.state = {
43
+ options: [],
44
+ isExact: false
45
+ };
46
+
47
+ this.handleSearch = this.handleSearch.bind(this);
48
+ this.handleSelect = this.handleSelect.bind(this);
49
+ this.handleReset = this.handleReset.bind(this);
50
+ this.displaySuggestions = this.displaySuggestions.bind(this);
51
+ }
52
+
53
+ /**
54
+ * Au chargement du composant, je définis mon service autocomplete GMaps
55
+ */
56
+ componentDidMount() {
57
+ this.autocompleteService = new google.maps.places.AutocompleteService();
58
+ }
59
+
60
+ handleReset() {
61
+ this.props.onReset();
62
+ this.setState({
63
+ options: [],
64
+ isExact: false
65
+ });
66
+ }
67
+
68
+ handleSearch(event) {
69
+ // Je vérifie que le champ n'est pas vide car l'API lève une exception en cas d'input vide
70
+ if (event.target.value) {
71
+ // Liste des types à rechercher. Voir https://developers.google.com/places/web-service/autocomplete?hl=fr#place_types (ex : ['establishement', 'address']
72
+ const types = [];
73
+ // Liste des codes ISO Alpha-2 des pays où il faut rechercher (ex : ['fr', 'us'])
74
+ const countries = [];
75
+ // À chaque changement, la méthode getPlacesPredictions appelle la méthode
76
+ // displaySuggestions en lui fournissant un tableau de 5 prédictions
77
+ this.value = event.target.value;
78
+ if (this.autocompleteService) {
79
+ this.autocompleteService.getPlacePredictions({
80
+ input: event.target.value,
81
+ types,
82
+ componentRestrictions: { country: countries }
83
+ }, this.displaySuggestions);
84
+ } else {
85
+ // Dans le cas où le service ne peut pas se charger (mode test par exemple).
86
+ this.displaySuggestions([], 'EMPTY_RESULT');
87
+ }
88
+ }
89
+ this.props.onSearch(event);
90
+ // Mise à jour du texte dans l'input
91
+ this.setState(_extends({}, !event.target.value && {
92
+ options: []
93
+ }));
94
+ }
95
+
96
+ handleSelect(event, value) {
97
+ // Mise à jour de la valeur du champ + la valeur de l'adresse est exacte
98
+ this.setState({ options: [], isExact: true });
99
+ this.props.onSelect(event, value.label);
100
+ }
101
+
102
+ render() {
103
+ const _props = this.props,
104
+ { exactOnly, onSearch, onReset, onSelect } = _props,
105
+ otherProps = _objectWithoutProperties(_props, ['exactOnly', 'onSearch', 'onReset', 'onSelect']);
106
+ const { options, isExact } = this.state;
107
+
108
+ // On met le champ en erreur si une adresse exacte est éxigée
109
+ // et si l'adresse courante n'est pas complète
110
+ const showError = exactOnly && !isExact;
111
+
112
+ return React.createElement(HiSuggestSelectField, _extends({
113
+ options: options,
114
+ onSearch: this.handleSearch,
115
+ onReset: this.handleReset,
116
+ onSelect: this.handleSelect,
117
+ isExact: isExact,
118
+ error: showError
119
+ }, otherProps));
120
+ }
121
+ }
122
+
123
+ HiAddressField.propTypes = process.env.NODE_ENV !== "production" ? {
124
+ /**
125
+ * Est-ce qu'on n'accepte que les adresses trouvées par GMaps
126
+ */
127
+ exactOnly: PropTypes.bool,
128
+ /**
129
+ * Callback function called to empty the field.
130
+ */
131
+ onReset: PropTypes.func,
132
+ /**
133
+ * Callback function called when we write in the input.
134
+ */
135
+ onSearch: PropTypes.func,
136
+ /**
137
+ * Callback function called when a suggestion is selected.
138
+ */
139
+ onSelect: PropTypes.func
140
+ } : {};
141
+
142
+ export default HiAddressField;
@@ -9,6 +9,7 @@ import { Alert, Information } from 'mdi-material-ui';
9
9
  import { FormControl, FormHelperText } from 'material-ui/Form';
10
10
  import withStyles from '../styles/withStyles';
11
11
  import HiFormLabel from './HiFormLabel';
12
+ import { escapeHTML } from "../utils/hiHelpers";
12
13
 
13
14
  export const styles = theme => ({
14
15
  helperTextClassName: {
@@ -62,7 +63,7 @@ export const styles = theme => ({
62
63
  color: theme.palette.business.primary.normal
63
64
  },
64
65
  helperDiv: _extends({}, theme.typography.h5, {
65
- width: 'calc(100% - 16px)',
66
+ width: '100%',
66
67
  backgroundColor: '#ffffff',
67
68
  color: theme.palette.neutral.dark,
68
69
  padding: '16px 8px',
@@ -70,7 +71,8 @@ export const styles = theme => ({
70
71
  position: 'relative',
71
72
  marginBottom: 5,
72
73
  fontWeight: theme.typography.fontWeightRegular,
73
- boxShadow: '0px 1px 7px rgba(0, 0, 0, 0.16)'
74
+ boxShadow: '0px 1px 7px rgba(0, 0, 0, 0.16)',
75
+ lineHeight: 1.5
74
76
  }),
75
77
  helperDivArrowDown: {
76
78
  borderTopColor: '#ffffff'
@@ -85,6 +87,17 @@ class HiFormControl extends React.PureComponent {
85
87
  constructor(props) {
86
88
  super(props);
87
89
 
90
+ this.handleFocus = value => () => {
91
+ this.setState({ focused: value });
92
+ if (value === false && this.state.hovered) {
93
+ this.setState({ hovered: false });
94
+ }
95
+ };
96
+
97
+ this.handleHover = value => () => {
98
+ this.setState({ hovered: value });
99
+ };
100
+
88
101
  this.state = {
89
102
  helperOpen: false,
90
103
  focused: false,
@@ -96,16 +109,11 @@ class HiFormControl extends React.PureComponent {
96
109
  this.handleHover = this.handleHover.bind(this);
97
110
  }
98
111
 
99
- handleHelperClick() {
112
+ handleHelperClick(event) {
100
113
  this.setState(prevState => ({ helperOpen: !prevState.helperOpen }));
101
- }
102
-
103
- handleFocus(value) {
104
- this.setState({ focused: value });
105
- }
106
-
107
- handleHover(value) {
108
- this.setState({ hovered: value });
114
+ if (event) {
115
+ event.preventDefault();
116
+ }
109
117
  }
110
118
 
111
119
  render() {
@@ -152,11 +160,17 @@ class HiFormControl extends React.PureComponent {
152
160
  ),
153
161
  !disabled && helperIcon && helperText && !error && helperOpen && React.createElement(
154
162
  'div',
155
- { className: classes.helperDiv },
163
+ {
164
+ className: classes.helperDiv
165
+ },
156
166
  React.createElement('div', {
157
167
  className: classNames(classes.arrowDown, classes.helperDivArrowDown)
168
+
158
169
  }),
159
- helperText
170
+ React.createElement('span', {
171
+ dangerouslySetInnerHTML: {
172
+ __html: escapeHTML(helperText)
173
+ } })
160
174
  ),
161
175
  label && React.createElement(
162
176
  HiFormLabel,
@@ -165,7 +179,7 @@ class HiFormControl extends React.PureComponent {
165
179
  label: label,
166
180
  required: required,
167
181
  disabled: disabled,
168
- focused: focused || hovered
182
+ focused: !disabled && (focused || hovered)
169
183
  }, InputLabelProps),
170
184
  !disabled && error && React.createElement(Alert, {
171
185
  className: classes.errorIcon,
@@ -181,10 +195,10 @@ class HiFormControl extends React.PureComponent {
181
195
  React.createElement(
182
196
  'div',
183
197
  {
184
- onMouseEnter: () => this.handleHover(true),
185
- onMouseLeave: () => this.handleHover(false),
186
- onFocus: () => this.handleFocus(true),
187
- onBlur: () => this.handleFocus(false)
198
+ onMouseEnter: this.handleHover(true),
199
+ onMouseLeave: this.handleHover(false),
200
+ onFocus: this.handleFocus(true),
201
+ onBlur: this.handleFocus(false)
188
202
  },
189
203
  children
190
204
  ),
@@ -1,7 +1,6 @@
1
1
  import _extends from 'babel-runtime/helpers/extends';
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { Close } from 'mdi-material-ui';
5
4
  import Input from 'material-ui/Input';
6
5
  import IconButton from 'material-ui/IconButton';
7
6
  import classNames from 'classnames';
@@ -13,7 +12,7 @@ export const styles = theme => ({
13
12
  position: 'relative'
14
13
  }, theme.typography.body1, {
15
14
  borderBottom: `1px solid ${theme.palette.input.bottomLine}`,
16
- paddingLeft: 1,
15
+ paddingLeft: 8,
17
16
  backgroundColor: '#f5f5f5',
18
17
  '&$focused': {
19
18
  backgroundColor: '#ffffff'
@@ -48,18 +47,16 @@ export const styles = theme => ({
48
47
  transform: 'scaleX(1)'
49
48
  }
50
49
  },
50
+ focused: {},
51
51
  error: {
52
52
  border: `1px solid ${theme.palette.negative.normal}`,
53
- paddingLeft: 0,
53
+ paddingLeft: 8,
54
54
  borderRadius: 2
55
55
  },
56
56
  startAdornment: {
57
- position: 'absolute',
58
- left: 0,
59
- top: '8px',
60
- marginLeft: 8,
61
57
  color: theme.palette.neutral.normal,
62
- zIndex: 1
58
+ zIndex: 1,
59
+ marginRight: 8
63
60
  },
64
61
  startAdornmentFocus: {
65
62
  color: theme.palette.neutral.dark
@@ -68,12 +65,9 @@ export const styles = theme => ({
68
65
  color: theme.palette.neutral.light
69
66
  },
70
67
  rightIcon: {
71
- position: 'absolute',
72
- right: 0,
73
- top: '11px',
74
- marginRight: 11,
75
- width: '18px',
76
- height: '18px',
68
+ margin: '0 8px',
69
+ width: 18,
70
+ height: 39,
77
71
  color: theme.palette.neutral.normal
78
72
  },
79
73
  rightIconFocus: {
@@ -88,57 +82,36 @@ export const styles = theme => ({
88
82
  },
89
83
  input: _extends({}, theme.typography.body1, {
90
84
  fontWeight: theme.typography.fontWeightRegular,
91
- caretColor: theme.palette.business.primary.normal
85
+ caretColor: theme.palette.business.primary.normal,
86
+ display: 'flex',
87
+ alignItems: 'center'
92
88
  }),
93
89
  inputPropsClassName: _extends({}, theme.typography.body1, {
94
- padding: '0 8px',
95
- '&$inputWithStartAdornment': {
96
- paddingLeft: 40
97
- },
98
- '&$inputWithClearIcon': {
99
- paddingRight: 32
100
- },
101
- '&$inputWithRightIcon': {
102
- paddingRight: 32
103
- },
104
- '&$inputWithRightButton': {
105
- paddingRight: 140
106
- },
107
- '&$inputWithClearIcon&$inputWithRightIcon': {
108
- paddingRight: 63
109
- }
90
+ padding: 0
110
91
  }),
111
92
  inputText: {
112
- height: 40
93
+ height: 39
113
94
  },
114
95
  inputTextarea: {
115
- minHeight: 40,
96
+ minHeight: 39,
116
97
  paddingTop: 8
117
98
  },
118
- inputWithStartAdornment: {},
119
- inputWithClearIcon: {},
120
- inputWithRightIcon: {},
121
- inputWithRightButton: {},
122
99
  iconPointer: {
123
100
  zIndex: 2,
124
101
  cursor: 'pointer'
125
102
  },
126
103
  eraseButton: {
127
- height: 40,
104
+ height: 39,
128
105
  width: 40,
129
- '&$inputWithRightIcon,&$inputWithRightButton': {
130
- right: 30
131
- }
132
- },
133
- eraseIcon: {
134
- width: 18,
135
- height: 18,
136
- color: theme.palette.neutral.normal
106
+ display: 'inline-block'
137
107
  },
138
108
  disabled: {
139
109
  borderBottom: 'none'
140
110
  },
141
- focused: {}
111
+ endAdornment: {
112
+ display: 'flex',
113
+ alignItems: 'center'
114
+ }
142
115
  });
143
116
 
144
117
  class HiInput extends React.PureComponent {
@@ -169,8 +142,11 @@ class HiInput extends React.PureComponent {
169
142
  }
170
143
 
171
144
  handleChange(event) {
145
+ const authorizedChar = '1234567890TOto<>';
172
146
  if (this.props.onChange) {
173
- this.props.onChange(event);
147
+ if (authorizedChar.indexOf(event.target.value.charAt(event.target.value.length - 1)) >= 0 && this.props.onlyNumbers === true || this.props.onlyNumbers !== true) {
148
+ this.props.onChange(event);
149
+ }
174
150
  }
175
151
  }
176
152
 
@@ -234,7 +210,7 @@ class HiInput extends React.PureComponent {
234
210
  classes,
235
211
  placeholder,
236
212
  startAdornment,
237
- endAdornment,
213
+ endAdornment: endAdornmentProps,
238
214
  className,
239
215
  error,
240
216
  type,
@@ -246,7 +222,8 @@ class HiInput extends React.PureComponent {
246
222
  multiline,
247
223
  rows,
248
224
  inputClassName,
249
- onReset
225
+ onReset,
226
+ theme
250
227
  } = this.props;
251
228
 
252
229
  const { focused } = this.state;
@@ -278,11 +255,21 @@ class HiInput extends React.PureComponent {
278
255
  })
279
256
  });
280
257
  }
258
+ // Build endAdornment with eraseIcon + endAdornmentProps
259
+ const eraseIcon = !multiline && onReset && focused && !disabled && value.length > 0 && React.createElement(
260
+ IconButton,
261
+ {
262
+ className: classes.eraseButton,
263
+ onClick: this.handleReset,
264
+ onBlur: this.handleBlur
265
+ },
266
+ React.createElement(HiIconBuilder, { icon: 'close', size: 18, color: theme.palette.neutral.normal })
267
+ );
281
268
 
282
- let endElement;
283
- if (typeof endAdornment === 'string' && endAdornment !== '') {
284
- endElement = React.createElement(HiIconBuilder, {
285
- icon: endAdornment,
269
+ let endAdornment = endAdornmentProps;
270
+ if (typeof endAdornmentProps === 'string' && endAdornmentProps !== '') {
271
+ endAdornment = React.createElement(HiIconBuilder, {
272
+ icon: endAdornmentProps,
286
273
  onClick: this.props.onRightIconClick,
287
274
  className: classNames(classes.rightIcon, {
288
275
  [classes.rightIconFocus]: focused,
@@ -291,8 +278,6 @@ class HiInput extends React.PureComponent {
291
278
  [classes.iconPointer]: this.props.onRightIconClick
292
279
  })
293
280
  });
294
- } else if (typeof endAdornment === 'object') {
295
- endElement = endAdornment;
296
281
  }
297
282
 
298
283
  return React.createElement(
@@ -301,7 +286,7 @@ class HiInput extends React.PureComponent {
301
286
  React.createElement(Input, {
302
287
  id: inputId,
303
288
  type: type,
304
- className: classNames(classes.input),
289
+ className: classes.input,
305
290
  disableUnderline: true,
306
291
  onChange: this.handleChange,
307
292
  value: value,
@@ -318,34 +303,19 @@ class HiInput extends React.PureComponent {
318
303
  autoFocus: autoFocus,
319
304
  name: name,
320
305
  startAdornment: leftIcon,
306
+ endAdornment: React.createElement(
307
+ 'div',
308
+ { className: classes.endAdornment },
309
+ eraseIcon,
310
+ endAdornment
311
+ ),
321
312
  inputProps: {
322
313
  className: classNames(inputClassName, classes.inputPropsClassName, {
323
- [classes.inputWithClearIcon]: onReset,
324
- [classes.inputWithStartAdornment]: startAdornment !== '',
325
- [classes.inputWithRightIcon]: typeof endAdornment === 'string' && endAdornment !== '',
326
- [classes.inputWithRightButton]: typeof endAdornment === 'object',
327
314
  [classes.inputText]: !multiline,
328
315
  [classes.inputTextarea]: multiline
329
316
  })
330
317
  }
331
- }),
332
- !multiline && (endAdornment || onReset && !disabled) && React.createElement(
333
- 'div',
334
- { style: { position: 'absolute', top: 0, right: 0, maxHeight: 40 } },
335
- !disabled && onReset && value.length > 0 && focused && React.createElement(
336
- IconButton,
337
- {
338
- className: classNames(classes.eraseButton, {
339
- [classes.inputWithRightIcon]: typeof endAdornment === 'string' && endAdornment !== '',
340
- [classes.inputWithRightButton]: typeof endAdornment === 'object'
341
- }),
342
- onClick: this.handleReset,
343
- onBlur: this.handleBlur
344
- },
345
- React.createElement(Close, { className: classes.eraseIcon })
346
- ),
347
- endAdornment && endElement
348
- )
318
+ })
349
319
  );
350
320
  }
351
321
  }
@@ -359,7 +329,8 @@ HiInput.defaultProps = {
359
329
  endAdornment: '',
360
330
  type: 'text',
361
331
  multiline: false,
362
- error: false
332
+ error: false,
333
+ onlyNumbers: false
363
334
  };
364
335
  HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
365
336
  /**
@@ -385,6 +356,10 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
385
356
  * Rendre le champs désactivé
386
357
  */
387
358
  disabled: PropTypes.bool,
359
+ /**
360
+ * Elément à afficher à droite de l'input, peut être un string ou un node
361
+ */
362
+ endAdornment: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
388
363
  /**
389
364
  * Si `true`, le champs input sera affiché en erreur.
390
365
  */
@@ -401,18 +376,6 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
401
376
  * Passe une ref callback au composant input
402
377
  */
403
378
  inputRef: PropTypes.func,
404
- /**
405
- * Icône à afficher à gauche de l'input
406
- */
407
- startAdornment: PropTypes.string,
408
- /**
409
- * Icône à afficher à droite de l'input
410
- */
411
- endAdornment: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
412
- /**
413
- * Affiche un bouton à droite de l'input (Si true, pas de endAdornment)
414
- */
415
- endButton: PropTypes.bool,
416
379
  /**
417
380
  * Si `true`, le champs input sera un textarea
418
381
  */
@@ -441,6 +404,10 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
441
404
  * Fonction de callback appelée lorsqu'on clic sur l'icône de gauche
442
405
  */
443
406
  onLeftIconClick: PropTypes.func,
407
+ /**
408
+ * Pour les input de type number (permet de bloquer la saisie des caractères non autorisés)
409
+ */
410
+ onlyNumbers: PropTypes.bool,
444
411
  /**
445
412
  * Fonction de callback appelée lorsqu'on survole le champs
446
413
  */
@@ -465,14 +432,18 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
465
432
  * Placeholder
466
433
  */
467
434
  placeholder: PropTypes.string,
468
- /**
469
- * Icône à afficher à droite de l'input
470
- */
471
- rightIcon: PropTypes.string,
472
435
  /**
473
436
  * Nombre de lignes pour les textArea
474
437
  */
475
438
  rows: PropTypes.number,
439
+ /**
440
+ * Icône à afficher à gauche de l'input
441
+ */
442
+ startAdornment: PropTypes.string,
443
+ /**
444
+ * @ignore
445
+ */
446
+ theme: PropTypes.object,
476
447
  /**
477
448
  * Type du champs input. Doit être un type HTML5 valide.
478
449
  */
@@ -482,4 +453,4 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
482
453
  */
483
454
  value: PropTypes.string
484
455
  } : {};
485
- export default withStyles(styles, { name: 'HmuiHiInput' })(HiInput);
456
+ export default withStyles(styles, { name: 'HiMuiHiInput', withTheme: true })(HiInput);
@@ -73,7 +73,7 @@ class HiSearchField extends React.Component {
73
73
 
74
74
  this.props.callbackFilteredList(filteredList);
75
75
  } else {
76
- this.props.onSearch(searchedValue);
76
+ this.props.onSearch(event, searchedValue);
77
77
  }
78
78
  }
79
79
 
@@ -85,7 +85,7 @@ class HiSearchField extends React.Component {
85
85
  if (typeof this.props.onSearch === 'undefined') {
86
86
  this.props.callbackFilteredList(this.props.itemList);
87
87
  } else {
88
- this.props.onSearch('');
88
+ this.props.onSearch(undefined, '');
89
89
  }
90
90
  }
91
91
 
@@ -4,4 +4,5 @@ export { default as HiFormLabel } from './HiFormLabel';
4
4
  export { default as HiInput } from './HiInput';
5
5
  export { default as HiPasswordField } from './HiPasswordField';
6
6
  export { default as HiTextField } from './HiTextField';
7
- export { default as HiSearchField } from './HiSearchField';
7
+ export { default as HiSearchField } from './HiSearchField';
8
+ export { default as HiAddressField } from './HiAddressField';