@hipay/hipay-material-ui 2.0.0-beta.59 → 2.0.0-beta.60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/HiCell/CellNumeric.js +1 -1
  3. package/HiDatePicker/HiDatePicker.js +11 -2
  4. package/HiDatePicker/HiDateRangePicker.js +49 -8
  5. package/HiDatePicker/HiDateRangeSelector.js +39 -30
  6. package/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
  7. package/HiForm/HiFormControl.js +26 -11
  8. package/HiForm/HiFormLabel.js +3 -1
  9. package/HiForm/HiInput.js +20 -1
  10. package/HiForm/HiUpload.js +290 -45
  11. package/HiForm/HiUploadField.js +19 -51
  12. package/HiForm/HiUploadInput.js +18 -7
  13. package/HiSelectNew/HiDynamicSelect.js +3 -3
  14. package/HiSelectNew/HiNestedSelect.js +9 -9
  15. package/HiSelectNew/HiNestedSelectContent.js +9 -9
  16. package/HiSelectNew/HiSelect.js +22 -23
  17. package/HiSelectNew/HiSelectContent.js +7 -7
  18. package/HiSelectableList/HiSelectableListItem.js +3 -7
  19. package/README.md +1 -1
  20. package/es/HiCell/CellNumeric.js +1 -1
  21. package/es/HiDatePicker/HiDatePicker.js +11 -2
  22. package/es/HiDatePicker/HiDateRangePicker.js +42 -8
  23. package/es/HiDatePicker/HiDateRangeSelector.js +38 -27
  24. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
  25. package/es/HiForm/HiFormControl.js +27 -11
  26. package/es/HiForm/HiFormLabel.js +3 -1
  27. package/es/HiForm/HiInput.js +19 -1
  28. package/es/HiForm/HiUpload.js +276 -35
  29. package/es/HiForm/HiUploadField.js +19 -43
  30. package/es/HiForm/HiUploadInput.js +16 -7
  31. package/es/HiSelectNew/HiSelect.js +15 -16
  32. package/es/HiSelectableList/HiSelectableListItem.js +3 -7
  33. package/es/utils/helpers.js +6 -5
  34. package/index.es.js +1 -1
  35. package/index.js +1 -1
  36. package/package.json +3 -2
  37. package/umd/hipay-material-ui.development.js +29594 -21713
  38. package/umd/hipay-material-ui.production.min.js +2 -2
  39. package/utils/helpers.js +6 -4
@@ -16,6 +16,7 @@ export const styles = theme => ({
16
16
  height: 40,
17
17
  display: 'inline-flex',
18
18
  justifyContent: 'flex-start',
19
+ cursor: 'pointer',
19
20
  '&$focused, &$dragOver': {
20
21
  backgroundColor: theme.palette.global.background1
21
22
  },
@@ -82,7 +83,7 @@ export const styles = theme => ({
82
83
  transform: 'scaleX(1)'
83
84
  },
84
85
  '&$error': {
85
- borderBottom: `1px solid ${theme.palette.negative.normal}`
86
+ borderBottom: `1px solid ${theme.palette.negative.main}`
86
87
  }
87
88
  }
88
89
  },
@@ -90,7 +91,8 @@ export const styles = theme => ({
90
91
  color: `${theme.palette.action.disabled}`,
91
92
  '&:before': {
92
93
  display: 'none'
93
- }
94
+ },
95
+ cursor: 'default'
94
96
  },
95
97
  focused: {
96
98
  backgroundColor: theme.palette.background3
@@ -107,6 +109,7 @@ export const styles = theme => ({
107
109
  height: 39,
108
110
  display: 'inline-flex',
109
111
  width: '100%',
112
+ cursor: 'pointer',
110
113
  '&$empty': {
111
114
  opacity: 0.42
112
115
  }
@@ -130,7 +133,7 @@ export const styles = theme => ({
130
133
  }),
131
134
  '&:hover': {
132
135
  color: 'inherit',
133
- backgroundColor: theme.palette.local.background2
136
+ background: 'none'
134
137
  }
135
138
  }
136
139
  });
@@ -298,6 +301,10 @@ class HiUploadInput extends React.Component {
298
301
  [classes.dragOver]: dragOver,
299
302
  [classes.droppable]: droppable
300
303
  });
304
+ const eyeButton = React.createElement(HiIconButton, {
305
+ className: classes.icon,
306
+ onClick: this.handleSeeFile
307
+ }, _ref);
301
308
  return React.createElement("div", {
302
309
  className: rootClass
303
310
  }, React.createElement("label", {
@@ -314,10 +321,7 @@ class HiUploadInput extends React.Component {
314
321
  onChange: this.handleChange
315
322
  })), value === null || React.createElement("div", {
316
323
  className: classes.endAdornment
317
- }, React.createElement(HiIconButton, {
318
- className: classes.icon,
319
- onClick: this.handleSeeFile
320
- }, _ref), React.createElement(HiIconButton, {
324
+ }, this.props.seeFile && eyeButton, React.createElement(HiIconButton, {
321
325
  className: classes.icon,
322
326
  onClick: this.handleDeleteFile
323
327
  }, _ref2)));
@@ -395,6 +399,11 @@ HiUploadInput.propTypes = process.env.NODE_ENV !== "production" ? {
395
399
  */
396
400
  placeholder: PropTypes.string,
397
401
 
402
+ /**
403
+ * set to false to hide the eye button
404
+ */
405
+ seeFile: PropTypes.bool,
406
+
398
407
  /**
399
408
  * The translations of the error messages.
400
409
  */
@@ -209,22 +209,20 @@ class HiSelect extends React.PureComponent {
209
209
  };
210
210
 
211
211
  this.focusOnSelectedItem = selectedValue => {
212
- if (this.overlay && this.overlay.getElementsByTagName('li')[0]) {
213
- setTimeout(() => {
214
- // On initialise au premier élément pour être sûr de ne pas se retrouver avec un focus of undefined
215
- let item = this.overlay.getElementsByTagName('li')[0];
216
-
217
- if (selectedValue && typeof selectedValue === 'string') {
218
- item = this.overlay.getElementsByTagName('li')[selectedValue];
219
- } else if (selectedValue && typeof selectedValue === 'number') {
220
- item = this.overlay.getElementsByTagName('li')[selectedValue - 1];
221
- }
212
+ setTimeout(() => {
213
+ // On initialise au premier élément pour être sûr de ne pas se retrouver avec un focus of undefined
214
+ let item = this.overlay.getElementsByTagName('li')[0];
215
+
216
+ if (selectedValue && typeof selectedValue === 'string') {
217
+ item = this.overlay.getElementsByTagName('li')[selectedValue];
218
+ } else if (selectedValue && typeof selectedValue === 'number') {
219
+ item = this.overlay.getElementsByTagName('li')[selectedValue - 1];
220
+ }
222
221
 
223
- if (item) {
224
- item.focus();
225
- }
226
- }, 1);
227
- }
222
+ if (item) {
223
+ item.focus();
224
+ }
225
+ }, 1);
228
226
  };
229
227
 
230
228
  this.handleClickAway = event => {
@@ -457,11 +455,12 @@ class HiSelect extends React.PureComponent {
457
455
  suggestions: props.options,
458
456
  openDown: true
459
457
  };
458
+ this.handleBlur = this.handleBlur.bind(this);
460
459
  this.handleClick = this.handleClick.bind(this);
461
460
  this.handleClose = this.handleClose.bind(this);
462
461
  this.handleClickAway = this.handleClickAway.bind(this);
463
462
  this.handleFocus = this.handleFocus.bind(this);
464
- this.handleBlur = this.handleBlur.bind(this);
463
+ this.handleKeyDownInput = this.handleKeyDownInput.bind(this);
465
464
  this.handleSearch = this.handleSearch.bind(this);
466
465
  this.handleSearchReset = this.handleSearchReset.bind(this);
467
466
  this.handleSelect = this.handleSelect.bind(this);
@@ -34,7 +34,7 @@ export const styles = theme => ({
34
34
  display: 'block'
35
35
  },
36
36
  '&$inline': {
37
- maxHeight: 40,
37
+ minHeight: 40,
38
38
  '& $secondaryLabel': {
39
39
  display: 'inline-block'
40
40
  }
@@ -91,7 +91,7 @@ export const styles = theme => ({
91
91
  '& strong': {
92
92
  fontWeight: theme.typography.fontWeightMedium
93
93
  },
94
- display: 'inline-flex'
94
+ display: 'contents'
95
95
  }),
96
96
  listItemContentSelected: {},
97
97
  label: {
@@ -121,7 +121,6 @@ export const styles = theme => ({
121
121
  fontSize: 12,
122
122
  textOverflow: 'ellipsis',
123
123
  textAlign: 'right',
124
- padding: '4px 0px 4px 8px',
125
124
  alignSelf: 'center'
126
125
  }),
127
126
  img: {
@@ -135,7 +134,7 @@ export const styles = theme => ({
135
134
  verticalAlign: 'middle'
136
135
  },
137
136
  labelContent: {
138
- display: 'flex',
137
+ display: '-webkit-flex',
139
138
  alignItems: 'center',
140
139
  maxWidth: '85%',
141
140
  '&$labelWithoutSecondaryInline': {
@@ -153,9 +152,6 @@ export const styles = theme => ({
153
152
  },
154
153
  '&$infosWithoutSecondaryInline': {
155
154
  paddingLeft: 28
156
- },
157
- '&$infosWithSecondaryInline': {
158
- marginTop: -8
159
155
  }
160
156
  },
161
157
  infosInlineWithoutSecondary: {},
@@ -121,7 +121,7 @@ export function formatNumber(number, size = 'l', locale = 'en-EN', precision) {
121
121
  break;
122
122
  }
123
123
 
124
- const effectivePrecision = precision || (size === 'l' ? 2 : 0); // To locale
124
+ const effectivePrecision = Number.isInteger(precision) ? precision : size === 'l' ? 2 : 0; // To locale
125
125
 
126
126
  const options = {
127
127
  minimumFractionDigits: effectivePrecision,
@@ -147,7 +147,7 @@ export function formatNumber(number, size = 'l', locale = 'en-EN', precision) {
147
147
  * @param currency - ISO 4217
148
148
  */
149
149
 
150
- export function formatCurrencyAmount(amount, size = 'l', locale = 'en-EN', currency = 'EUR') {
150
+ export function formatCurrencyAmount(amount, size = 'l', locale = 'en-EN', currency = 'EUR', precision = null) {
151
151
  let value = amount;
152
152
  let unit = ''; // Round number
153
153
 
@@ -172,12 +172,13 @@ export function formatCurrencyAmount(amount, size = 'l', locale = 'en-EN', curre
172
172
  default:
173
173
  value = Math.round(amount * 100) / 100;
174
174
  break;
175
- } // To locale
175
+ }
176
176
 
177
+ const effectivePrecision = Number.isInteger(precision) ? precision : size === 'l' ? 2 : 0; // To locale
177
178
 
178
179
  const options = {
179
- minimumFractionDigits: size === 'l' ? 2 : 0,
180
- maximumFractionDigits: size === 'l' ? 2 : 0,
180
+ minimumFractionDigits: effectivePrecision,
181
+ maximumFractionDigits: effectivePrecision,
181
182
  useGrouping: true,
182
183
  style: 'currency',
183
184
  currency,
package/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.0.0-beta.59
1
+ /** @license HiPay-Material-UI v2.0.0-beta.60
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.0.0-beta.59
1
+ /** @license HiPay-Material-UI v2.0.0-beta.60
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hipay/hipay-material-ui",
3
3
  "private": false,
4
4
  "author": "HiPay PSYCHE Team",
5
- "version": "2.0.0-beta.59",
5
+ "version": "2.0.0-beta.60",
6
6
  "description": "React components that implement Google's Material Design.",
7
7
  "keywords": [
8
8
  "react",
@@ -16,7 +16,7 @@
16
16
  "type": "git",
17
17
  "url": "https://gitlab.hipay.org/backend/hipay-material-ui.git"
18
18
  },
19
- "license": "MIT",
19
+ "license": "UNLICENSED",
20
20
  "bugs": {
21
21
  "url": "https://gitlab.hipay.org/backend/hipay-material-ui/issues"
22
22
  },
@@ -50,6 +50,7 @@
50
50
  "leaflet": "^1.3.4",
51
51
  "mdi-material-ui": "^5.4.0",
52
52
  "moment": "^2.22.2",
53
+ "moment-timezone": "^0.5.23",
53
54
  "normalize-scroll-left": "^0.1.2",
54
55
  "popper.js": "^1.14.1",
55
56
  "prop-types": "^15.6.0",