@hipay/hipay-material-ui 2.0.0-beta.59 → 2.0.0-beta.61
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +118 -0
- package/HiCell/CellNumeric.js +1 -1
- package/HiDatePicker/HiDatePicker.js +48 -14
- package/HiDatePicker/HiDateRangePicker.js +119 -64
- package/HiDatePicker/HiDateRangeSelector.js +70 -47
- package/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
- package/HiDatePicker/stylesheet.js +32 -17
- package/HiForm/HiFormControl.js +26 -11
- package/HiForm/HiFormLabel.js +3 -1
- package/HiForm/HiInput.js +20 -1
- package/HiForm/HiUpload.js +290 -45
- package/HiForm/HiUploadField.js +19 -51
- package/HiForm/HiUploadInput.js +18 -7
- package/HiSelectNew/HiSelect.js +15 -16
- package/HiSelectableList/HiSelectableList.js +9 -0
- package/HiSelectableList/HiSelectableListItem.js +3 -7
- package/README.md +1 -1
- package/es/HiCell/CellNumeric.js +1 -1
- package/es/HiDatePicker/HiDatePicker.js +41 -12
- package/es/HiDatePicker/HiDateRangePicker.js +79 -28
- package/es/HiDatePicker/HiDateRangeSelector.js +59 -37
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
- package/es/HiDatePicker/stylesheet.js +32 -17
- package/es/HiForm/HiFormControl.js +27 -11
- package/es/HiForm/HiFormLabel.js +3 -1
- package/es/HiForm/HiInput.js +19 -1
- package/es/HiForm/HiUpload.js +276 -35
- package/es/HiForm/HiUploadField.js +19 -43
- package/es/HiForm/HiUploadInput.js +16 -7
- package/es/HiSelectNew/HiSelect.js +15 -16
- package/es/HiSelectableList/HiSelectableList.js +9 -0
- package/es/HiSelectableList/HiSelectableListItem.js +3 -7
- package/es/styles/createPalette.js +1 -1
- package/es/utils/helpers.js +15 -6
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +4 -4
- package/styles/createPalette.js +1 -1
- package/umd/hipay-material-ui.development.js +6301 -383
- package/umd/hipay-material-ui.production.min.js +2 -2
- package/utils/helpers.js +15 -5
@@ -2,43 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
3
|
import React from 'react';
|
4
4
|
import PropTypes from 'prop-types';
|
5
|
-
import withStyles from '../styles/withStyles';
|
6
5
|
import HiFormControl from './HiFormControl';
|
7
6
|
import HiUpload from './HiUpload';
|
8
|
-
export const styles = theme => ({
|
9
|
-
flexContainer: {
|
10
|
-
display: ' flex',
|
11
|
-
alignItems: 'center'
|
12
|
-
},
|
13
|
-
statusIcon: {
|
14
|
-
height: '80px',
|
15
|
-
width: '80px',
|
16
|
-
marginRight: '8px',
|
17
|
-
padding: '24px',
|
18
|
-
borderRadius: '2px',
|
19
|
-
backgroundColor: theme.palette.local.background2,
|
20
|
-
border: `1px solid ${theme.palette.middle.main}`,
|
21
|
-
color: `${theme.palette.middle.main} !important`,
|
22
|
-
fontSize: '80px'
|
23
|
-
},
|
24
|
-
inputContainer: {
|
25
|
-
flex: '1',
|
26
|
-
width: 'calc(100% - 88px)'
|
27
|
-
},
|
28
|
-
empty: {
|
29
|
-
border: `1px solid ${theme.palette.input.bottomLine}`,
|
30
|
-
color: `${theme.palette.neutral.main} !important`
|
31
|
-
},
|
32
|
-
complete: {
|
33
|
-
border: `1px solid ${theme.palette.positive.main}`,
|
34
|
-
color: `${theme.palette.positive.main} !important`,
|
35
|
-
fontSize: '32px'
|
36
|
-
},
|
37
|
-
error: {
|
38
|
-
border: `1px solid ${theme.palette.negative.main}`,
|
39
|
-
color: `${theme.palette.negative.main} !important`
|
40
|
-
}
|
41
|
-
});
|
42
7
|
|
43
8
|
class HiUploadField extends React.PureComponent {
|
44
9
|
render() {
|
@@ -48,9 +13,10 @@ class HiUploadField extends React.PureComponent {
|
|
48
13
|
label,
|
49
14
|
helperIcon,
|
50
15
|
helperText,
|
51
|
-
values
|
16
|
+
values,
|
17
|
+
fullWidth
|
52
18
|
} = _this$props,
|
53
|
-
others = _objectWithoutProperties(_this$props, ["className", "label", "helperIcon", "helperText", "values"]);
|
19
|
+
others = _objectWithoutProperties(_this$props, ["className", "label", "helperIcon", "helperText", "values", "fullWidth"]);
|
54
20
|
|
55
21
|
let empty = true;
|
56
22
|
let error = false;
|
@@ -72,7 +38,8 @@ class HiUploadField extends React.PureComponent {
|
|
72
38
|
errorText: errorText,
|
73
39
|
error: error,
|
74
40
|
helperIcon: helperIcon,
|
75
|
-
helperText: helperText
|
41
|
+
helperText: helperText,
|
42
|
+
fullWidth: fullWidth
|
76
43
|
}, React.createElement(HiUpload, _extends({
|
77
44
|
values: values
|
78
45
|
}, others)));
|
@@ -82,7 +49,9 @@ class HiUploadField extends React.PureComponent {
|
|
82
49
|
|
83
50
|
HiUploadField.defaultProps = {
|
84
51
|
helperText: '',
|
85
|
-
helperIcon: false
|
52
|
+
helperIcon: false,
|
53
|
+
seeFile: true,
|
54
|
+
fullWidth: false
|
86
55
|
};
|
87
56
|
HiUploadField.propTypes = process.env.NODE_ENV !== "production" ? {
|
88
57
|
/**
|
@@ -95,6 +64,11 @@ HiUploadField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
95
64
|
*/
|
96
65
|
className: PropTypes.string,
|
97
66
|
|
67
|
+
/**
|
68
|
+
* Si "true", applique l'attribut css correspondant
|
69
|
+
*/
|
70
|
+
fullWidth: PropTypes.bool,
|
71
|
+
|
98
72
|
/**
|
99
73
|
* Si "true", le texte d'aide s'affichera seulement au clic sur l'icône "Information"
|
100
74
|
*/
|
@@ -130,12 +104,14 @@ HiUploadField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
130
104
|
*/
|
131
105
|
onSeeFile: PropTypes.func,
|
132
106
|
|
107
|
+
/**
|
108
|
+
* set to false to hide the eye button
|
109
|
+
*/
|
110
|
+
seeFile: PropTypes.bool,
|
111
|
+
|
133
112
|
/**
|
134
113
|
* Valeurs des inputs
|
135
114
|
*/
|
136
115
|
values: PropTypes.array
|
137
116
|
} : {};
|
138
|
-
export default
|
139
|
-
hiComponent: true,
|
140
|
-
name: 'HmuiHiUploadField'
|
141
|
-
})(HiUploadField);
|
117
|
+
export default HiUploadField;
|
@@ -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.
|
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
|
-
|
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
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
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
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
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.
|
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);
|
@@ -61,6 +61,10 @@ class HiSelectableList extends React.PureComponent {
|
|
61
61
|
};
|
62
62
|
|
63
63
|
this.compareItem = (a, b) => {
|
64
|
+
if (this.props.comparItemFunc) {
|
65
|
+
return this.props.comparItemFunc(a, b);
|
66
|
+
}
|
67
|
+
|
64
68
|
if (a.label === undefined || b.label === undefined) {
|
65
69
|
return 0;
|
66
70
|
}
|
@@ -123,6 +127,11 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
123
127
|
*/
|
124
128
|
classes: PropTypes.object,
|
125
129
|
|
130
|
+
/**
|
131
|
+
* Fonction de comparaison utilisée pour les tris
|
132
|
+
*/
|
133
|
+
comparItemFunc: PropTypes.func,
|
134
|
+
|
126
135
|
/**
|
127
136
|
* Désactive la listes
|
128
137
|
*/
|
@@ -34,7 +34,7 @@ export const styles = theme => ({
|
|
34
34
|
display: 'block'
|
35
35
|
},
|
36
36
|
'&$inline': {
|
37
|
-
|
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: '
|
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: {},
|
@@ -30,7 +30,7 @@ export const light = {
|
|
30
30
|
hint: 'rgba(0, 0, 0, 0.38)'
|
31
31
|
},
|
32
32
|
// The color used to divide different elements.
|
33
|
-
divider: '
|
33
|
+
divider: '#D9D9DB',
|
34
34
|
// The background colors used to style the surfaces.
|
35
35
|
// Consistency between these values is important.
|
36
36
|
background: {
|
package/es/utils/helpers.js
CHANGED
@@ -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
|
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
|
-
}
|
175
|
+
}
|
176
176
|
|
177
|
+
const effectivePrecision = Number.isInteger(precision) ? precision : size === 'l' ? 2 : 0; // To locale
|
177
178
|
|
178
179
|
const options = {
|
179
|
-
minimumFractionDigits:
|
180
|
-
maximumFractionDigits:
|
180
|
+
minimumFractionDigits: effectivePrecision,
|
181
|
+
maximumFractionDigits: effectivePrecision,
|
181
182
|
useGrouping: true,
|
182
183
|
style: 'currency',
|
183
184
|
currency,
|
@@ -249,7 +250,7 @@ export function getNextItemSelectable(node, direction) {
|
|
249
250
|
*/
|
250
251
|
|
251
252
|
export function foldAccents(toFold) {
|
252
|
-
return toFold.replace(/([àáâãäå])|([ç])|([èéêë])|([ìíîï])|([ñ])|([òóôõöø])|([ß])|([ùúûü])|([ÿ])|([æ])|([œ])/g, (str, a, c, e, i, n, o, s, u, y, ae, oe) => {
|
253
|
+
return toFold.replace(/([àáâãäå])|([ç])|([èéêë])|([ìíîï])|([ñ])|([òóôõöø])|([ß])|([ùúûü])|([ÿ])|([æ])|([œ])|([+])|([\\])|([\[])|([\]])|([\(])|([\)])|([?])|([*])/g, (str, a, c, e, i, n, o, s, u, y, ae, oe, plus, backSlash, lc, rc, lp, rp, interogation, star) => {
|
253
254
|
if (a) return 'a';
|
254
255
|
if (c) return 'c';
|
255
256
|
if (e) return 'e';
|
@@ -261,6 +262,14 @@ export function foldAccents(toFold) {
|
|
261
262
|
if (y) return 'y';
|
262
263
|
if (ae) return 'ae';
|
263
264
|
if (oe) return 'oe';
|
265
|
+
if (plus) return '\\+';
|
266
|
+
if (backSlash) return '\\\\';
|
267
|
+
if (lc) return '\\[';
|
268
|
+
if (rc) return '\\]';
|
269
|
+
if (lp) return '\\(';
|
270
|
+
if (rp) return '\\)';
|
271
|
+
if (interogation) return '\\?';
|
272
|
+
if (star) return '\\*';
|
264
273
|
return str;
|
265
274
|
});
|
266
275
|
}
|
package/index.es.js
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hipay/hipay-material-ui",
|
3
|
-
"private": false,
|
4
3
|
"author": "HiPay PSYCHE Team",
|
5
|
-
"version": "2.0.0-beta.
|
4
|
+
"version": "2.0.0-beta.61",
|
6
5
|
"description": "React components that implement Google's Material Design.",
|
7
6
|
"keywords": [
|
8
7
|
"react",
|
@@ -16,7 +15,7 @@
|
|
16
15
|
"type": "git",
|
17
16
|
"url": "https://gitlab.hipay.org/backend/hipay-material-ui.git"
|
18
17
|
},
|
19
|
-
"license": "
|
18
|
+
"license": "UNLICENSED",
|
20
19
|
"bugs": {
|
21
20
|
"url": "https://gitlab.hipay.org/backend/hipay-material-ui/issues"
|
22
21
|
},
|
@@ -50,6 +49,7 @@
|
|
50
49
|
"leaflet": "^1.3.4",
|
51
50
|
"mdi-material-ui": "^5.4.0",
|
52
51
|
"moment": "^2.22.2",
|
52
|
+
"moment-timezone": "^0.5.23",
|
53
53
|
"normalize-scroll-left": "^0.1.2",
|
54
54
|
"popper.js": "^1.14.1",
|
55
55
|
"prop-types": "^15.6.0",
|
@@ -75,4 +75,4 @@
|
|
75
75
|
},
|
76
76
|
"main": "./index.js",
|
77
77
|
"module": "./index.es.js"
|
78
|
-
}
|
78
|
+
}
|
package/styles/createPalette.js
CHANGED
@@ -48,7 +48,7 @@ var light = {
|
|
48
48
|
hint: 'rgba(0, 0, 0, 0.38)'
|
49
49
|
},
|
50
50
|
// The color used to divide different elements.
|
51
|
-
divider: '
|
51
|
+
divider: '#D9D9DB',
|
52
52
|
// The background colors used to style the surfaces.
|
53
53
|
// Consistency between these values is important.
|
54
54
|
background: {
|