@hipay/hipay-material-ui 2.0.0-beta.55 → 2.0.0-beta.57
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.
- package/CHANGELOG.md +116 -0
- package/HiBreadcrumb/HiBreadcrumb.js +14 -4
- package/HiBreadcrumb/HiStep.js +4 -1
- package/HiBreadcrumb/HiStepContent.js +0 -1
- package/HiBreadcrumb/HiStepLabel.js +12 -4
- package/HiBreadcrumb/HiStepper.js +1 -1
- package/HiButton/HiButton.js +7 -1
- package/HiCell/CellIcon.js +4 -4
- package/HiCell/CellImage.js +13 -1
- package/HiCell/CellRate.js +6 -3
- package/HiCell/CellSentinel.js +7 -10
- package/HiCell/CellTextStyled.js +29 -1
- package/HiColoredLabel/HiColoredLabel.js +1 -1
- package/HiDatePicker/Caption.js +16 -10
- package/HiDatePicker/HiDatePicker.js +9 -3
- package/HiDatePicker/HiDateRangePicker.js +36 -22
- package/HiDatePicker/HiDateRangeSelector.js +75 -21
- package/HiDatePicker/NavBar.js +8 -1
- package/HiDatePicker/Overlays/CustomOverlayLayout.js +26 -17
- package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +123 -0
- package/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
- package/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
- package/HiDatePicker/Overlays/Overlay.js +15 -8
- package/HiDatePicker/Overlays/Overlay.spec.js +1 -0
- package/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
- package/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
- package/HiDatePicker/Overlays/YearPickerOverlay.js +4 -6
- package/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
- package/HiDatePicker/hiLocaleUtils.js +144 -0
- package/HiDatePicker/stylesheet.js +33 -7
- package/HiDotsStepper/HiDot.js +108 -0
- package/HiDotsStepper/HiDotsStepper.js +121 -0
- package/HiExpansionPanel/HiExpansionPanel.js +1 -1
- package/HiForm/HiAddressField.js +176 -0
- package/HiForm/HiFormControl.js +2 -0
- package/HiForm/HiInput.js +3 -3
- package/HiForm/HiSlider.js +352 -0
- package/HiForm/HiUpload.js +204 -0
- package/HiForm/HiUploadField.js +182 -0
- package/HiForm/HiUploadInput.js +459 -0
- package/HiForm/index.js +16 -0
- package/HiMap/HiMap.js +345 -0
- package/HiMap/HiMapExpand.js +210 -0
- package/HiMap/index.js +23 -0
- package/HiNotice/HiKPI.js +238 -0
- package/HiNotice/HiKPINotice.js +96 -0
- package/HiNotice/index.js +23 -0
- package/HiPdfReader/HiPdfReader.js +269 -0
- package/HiPdfReader/index.js +15 -0
- package/HiPin/HiPin.js +1 -1
- package/HiRadio/HiRadio.js +74 -0
- package/HiRadio/index.js +15 -0
- package/HiSelect/HiSelect.js +73 -84
- package/HiSelect/HiSuggestSelect.js +35 -4
- package/HiSelect/SelectInput.js +9 -1
- package/HiSelectNew/HiNestedSelectContent.js +5 -1
- package/HiSelectNew/HiSelect.js +260 -179
- package/HiSelectNew/HiSelectContent.js +0 -8
- package/HiSelectNew/HiSelectInput.js +8 -9
- package/HiSelectableList/HiSelectableList.js +39 -4
- package/HiSelectableList/HiSelectableListItem.js +81 -38
- package/HiTable/HiCellBuilder.js +25 -12
- package/HiTable/HiTableHeader.js +16 -17
- package/HiTable/constants.js +3 -1
- package/README.md +248 -98
- package/es/HiBreadcrumb/HiBreadcrumb.js +14 -4
- package/es/HiBreadcrumb/HiStep.js +4 -1
- package/es/HiBreadcrumb/HiStepContent.js +0 -1
- package/es/HiBreadcrumb/HiStepLabel.js +13 -4
- package/es/HiBreadcrumb/HiStepper.js +1 -1
- package/es/HiButton/HiButton.js +7 -0
- package/es/HiCell/CellIcon.js +5 -5
- package/es/HiCell/CellImage.js +13 -1
- package/es/HiCell/CellRate.js +6 -3
- package/es/HiCell/CellSentinel.js +7 -10
- package/es/HiCell/CellTextStyled.js +28 -1
- package/es/HiColoredLabel/HiColoredLabel.js +1 -1
- package/es/HiDatePicker/Caption.js +14 -10
- package/es/HiDatePicker/HiDatePicker.js +8 -3
- package/es/HiDatePicker/HiDateRangePicker.js +40 -28
- package/es/HiDatePicker/HiDateRangeSelector.js +69 -21
- package/es/HiDatePicker/ListPicker.js +1 -1
- package/es/HiDatePicker/NavBar.js +7 -1
- package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +30 -19
- package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +106 -0
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +5 -5
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
- package/es/HiDatePicker/Overlays/Overlay.js +16 -9
- package/es/HiDatePicker/Overlays/Overlay.spec.js +1 -0
- package/es/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
- package/es/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +4 -6
- package/es/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
- package/es/HiDatePicker/hiLocaleUtils.js +131 -0
- package/es/HiDatePicker/stylesheet.js +32 -7
- package/es/HiDotsStepper/HiDot.js +66 -0
- package/es/HiDotsStepper/HiDotsStepper.js +73 -0
- package/es/HiExpansionPanel/HiExpansionPanel.js +1 -1
- package/es/HiForm/HiAddressField.js +134 -0
- package/es/HiForm/HiFormControl.js +2 -0
- package/es/HiForm/HiInput.js +3 -3
- package/es/HiForm/HiSlider.js +302 -0
- package/es/HiForm/HiUpload.js +158 -0
- package/es/HiForm/HiUploadField.js +140 -0
- package/es/HiForm/HiUploadInput.js +411 -0
- package/es/HiForm/index.js +2 -0
- package/es/HiMap/HiMap.js +290 -0
- package/es/HiMap/HiMapExpand.js +162 -0
- package/es/HiMap/index.js +2 -0
- package/es/HiNotice/HiKPI.js +196 -0
- package/es/HiNotice/HiKPINotice.js +78 -0
- package/es/HiNotice/index.js +2 -0
- package/es/HiPdfReader/HiPdfReader.js +214 -0
- package/es/HiPdfReader/index.js +1 -0
- package/es/HiPin/HiPin.js +1 -1
- package/es/HiRadio/HiRadio.js +55 -0
- package/es/HiRadio/index.js +1 -0
- package/es/HiSelect/HiSelect.js +68 -78
- package/es/HiSelect/HiSuggestSelect.js +30 -4
- package/es/HiSelect/SelectInput.js +9 -1
- package/es/HiSelectNew/HiNestedSelectContent.js +5 -1
- package/es/HiSelectNew/HiSelect.js +246 -162
- package/es/HiSelectNew/HiSelectContent.js +0 -7
- package/es/HiSelectNew/HiSelectInput.js +8 -9
- package/es/HiSelectableList/HiSelectableList.js +34 -6
- package/es/HiSelectableList/HiSelectableListItem.js +92 -40
- package/es/HiTable/HiCellBuilder.js +130 -123
- package/es/HiTable/HiTableHeader.js +14 -12
- package/es/HiTable/constants.js +1 -0
- package/es/index.js +9 -1
- package/es/utils/helpers.js +1 -1
- package/index.es.js +9 -1
- package/index.js +66 -2
- package/package.json +5 -2
- package/umd/hipay-material-ui.development.js +44450 -40930
- package/umd/hipay-material-ui.production.min.js +2 -2
- package/utils/helpers.js +1 -1
|
@@ -41,6 +41,7 @@ var _ref3 = React.createElement(AccessTime, null);
|
|
|
41
41
|
|
|
42
42
|
const NavBar = ({
|
|
43
43
|
classes,
|
|
44
|
+
locale = 'en_US',
|
|
44
45
|
localeUtils,
|
|
45
46
|
nextMonth,
|
|
46
47
|
onClockClick,
|
|
@@ -49,7 +50,7 @@ const NavBar = ({
|
|
|
49
50
|
previousMonth,
|
|
50
51
|
showClockButton
|
|
51
52
|
}) => {
|
|
52
|
-
const months = localeUtils.getMonths();
|
|
53
|
+
const months = localeUtils.getMonths(locale);
|
|
53
54
|
const prev = `${months[previousMonth.getMonth()]} ${previousMonth.getFullYear()}`;
|
|
54
55
|
const next = `${months[nextMonth.getMonth()]} ${nextMonth.getFullYear()}`;
|
|
55
56
|
return React.createElement("div", {
|
|
@@ -74,6 +75,11 @@ NavBar.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
74
75
|
*/
|
|
75
76
|
classes: PropTypes.object,
|
|
76
77
|
|
|
78
|
+
/**
|
|
79
|
+
* ReactDayPicker prop
|
|
80
|
+
*/
|
|
81
|
+
locale: PropTypes.string,
|
|
82
|
+
|
|
77
83
|
/**
|
|
78
84
|
* ReactDayPicker prop
|
|
79
85
|
*/
|
|
@@ -7,10 +7,15 @@ import Paper from '@material-ui/core/Paper';
|
|
|
7
7
|
import withStyles from '../../styles/withStyles';
|
|
8
8
|
export const styles = theme => ({
|
|
9
9
|
paper: {
|
|
10
|
-
position: 'absolute',
|
|
11
10
|
width: '100%',
|
|
12
11
|
zIndex: 10
|
|
13
12
|
},
|
|
13
|
+
absolute: {
|
|
14
|
+
position: 'absolute'
|
|
15
|
+
},
|
|
16
|
+
relative: {
|
|
17
|
+
position: 'relative'
|
|
18
|
+
},
|
|
14
19
|
left: {
|
|
15
20
|
width: '200%',
|
|
16
21
|
left: 0
|
|
@@ -56,30 +61,35 @@ const CustomOverlayLayout = (_ref) => {
|
|
|
56
61
|
headerElement,
|
|
57
62
|
footerElement,
|
|
58
63
|
absoluteElement,
|
|
59
|
-
side
|
|
64
|
+
side,
|
|
65
|
+
staticPosition
|
|
60
66
|
} = _ref,
|
|
61
|
-
props = _objectWithoutProperties(_ref, ["classes", "children", "headerElement", "footerElement", "absoluteElement", "side"]);
|
|
67
|
+
props = _objectWithoutProperties(_ref, ["classes", "children", "headerElement", "footerElement", "absoluteElement", "side", "staticPosition"]);
|
|
62
68
|
|
|
63
69
|
const paperClass = classNames(classes.paper, {
|
|
64
70
|
[classes.left]: side === 'from',
|
|
65
|
-
[classes.right]: side === 'to'
|
|
71
|
+
[classes.right]: side === 'to',
|
|
72
|
+
[classes.absolute]: staticPosition !== true,
|
|
73
|
+
[classes.relative]: staticPosition === true
|
|
66
74
|
});
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
const paperProps = _objectSpread({}, props);
|
|
69
77
|
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
return (// eslint-disable-next-line react/jsx-handler-names
|
|
79
|
+
React.createElement(Paper, {
|
|
80
|
+
className: paperClass,
|
|
81
|
+
onBlur: paperProps.onBlur,
|
|
82
|
+
onFocus: paperProps.onFocus
|
|
83
|
+
}, React.createElement("div", {
|
|
84
|
+
className: classes.overlay
|
|
85
|
+
}, React.createElement("div", {
|
|
86
|
+
className: classes.header
|
|
87
|
+
}, headerElement), React.createElement("div", {
|
|
88
|
+
className: classes.body
|
|
89
|
+
}, children), React.createElement("div", {
|
|
90
|
+
className: classes.footer
|
|
91
|
+
}, footerElement), absoluteElement))
|
|
92
|
+
);
|
|
83
93
|
};
|
|
84
94
|
|
|
85
95
|
CustomOverlayLayout.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -96,7 +106,8 @@ CustomOverlayLayout.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
96
106
|
/**
|
|
97
107
|
* Définit comment construire le Paper dans le cas d'un double input
|
|
98
108
|
*/
|
|
99
|
-
side: PropTypes.string
|
|
109
|
+
side: PropTypes.string,
|
|
110
|
+
staticPosition: PropTypes.bool
|
|
100
111
|
} : {};
|
|
101
112
|
export default withStyles(styles, {
|
|
102
113
|
name: 'HmuiCustomOverlayLayout'
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import Paper from '@material-ui/core/Paper';
|
|
7
|
+
import withStyles from '../../styles/withStyles';
|
|
8
|
+
export const styles = theme => ({
|
|
9
|
+
paper: {
|
|
10
|
+
width: '100%',
|
|
11
|
+
zIndex: 10
|
|
12
|
+
},
|
|
13
|
+
absolute: {
|
|
14
|
+
position: 'absolute'
|
|
15
|
+
},
|
|
16
|
+
relative: {
|
|
17
|
+
position: 'relative'
|
|
18
|
+
},
|
|
19
|
+
left: {
|
|
20
|
+
width: '200%',
|
|
21
|
+
left: 0
|
|
22
|
+
},
|
|
23
|
+
right: {
|
|
24
|
+
width: '200%',
|
|
25
|
+
left: '-100%'
|
|
26
|
+
},
|
|
27
|
+
overlay: _objectSpread({
|
|
28
|
+
padding: 0,
|
|
29
|
+
height: 325,
|
|
30
|
+
textAlign: 'center'
|
|
31
|
+
}, theme.typography.body2, {
|
|
32
|
+
fontWeight: theme.typography.fontWeightRegular
|
|
33
|
+
}),
|
|
34
|
+
header: _objectSpread({
|
|
35
|
+
display: 'block',
|
|
36
|
+
height: 40,
|
|
37
|
+
textAlign: 'center',
|
|
38
|
+
padding: '10px 0'
|
|
39
|
+
}, theme.typography.body1, {
|
|
40
|
+
color: theme.palette.neutral.main,
|
|
41
|
+
borderBottom: '1px solid',
|
|
42
|
+
borderBottomColor: theme.palette.divider
|
|
43
|
+
}),
|
|
44
|
+
body: {
|
|
45
|
+
height: 285,
|
|
46
|
+
width: 224,
|
|
47
|
+
margin: 'auto'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const CustomOverlayLayoutWithoutFooter = (_ref) => {
|
|
52
|
+
let {
|
|
53
|
+
classes,
|
|
54
|
+
children,
|
|
55
|
+
headerElement,
|
|
56
|
+
footerElement,
|
|
57
|
+
absoluteElement,
|
|
58
|
+
side,
|
|
59
|
+
staticPosition
|
|
60
|
+
} = _ref,
|
|
61
|
+
props = _objectWithoutProperties(_ref, ["classes", "children", "headerElement", "footerElement", "absoluteElement", "side", "staticPosition"]);
|
|
62
|
+
|
|
63
|
+
const paperClass = classNames(classes.paper, {
|
|
64
|
+
[classes.left]: side === 'from',
|
|
65
|
+
[classes.right]: side === 'to',
|
|
66
|
+
[classes.absolute]: staticPosition !== true,
|
|
67
|
+
[classes.relative]: staticPosition === true
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const paperProps = _objectSpread({}, props);
|
|
71
|
+
|
|
72
|
+
return (// eslint-disable-next-line react/jsx-handler-names
|
|
73
|
+
React.createElement(Paper, {
|
|
74
|
+
className: paperClass,
|
|
75
|
+
onBlur: paperProps.onBlur,
|
|
76
|
+
onFocus: paperProps.onFocus
|
|
77
|
+
}, React.createElement("div", {
|
|
78
|
+
className: classes.overlay
|
|
79
|
+
}, React.createElement("div", {
|
|
80
|
+
className: classes.header
|
|
81
|
+
}, headerElement), React.createElement("div", {
|
|
82
|
+
className: classes.body
|
|
83
|
+
}, children), absoluteElement))
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
CustomOverlayLayoutWithoutFooter.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
88
|
+
absoluteElement: PropTypes.any,
|
|
89
|
+
children: PropTypes.any,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Useful to extend the style applied to components.
|
|
93
|
+
*/
|
|
94
|
+
classes: PropTypes.object,
|
|
95
|
+
footerElement: PropTypes.any,
|
|
96
|
+
headerElement: PropTypes.any,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Définit comment construire le Paper dans le cas d'un double input
|
|
100
|
+
*/
|
|
101
|
+
side: PropTypes.string,
|
|
102
|
+
staticPosition: PropTypes.bool
|
|
103
|
+
} : {};
|
|
104
|
+
export default withStyles(styles, {
|
|
105
|
+
name: 'HmuiCustomOverlayLayoutWithoutFooter'
|
|
106
|
+
})(CustomOverlayLayoutWithoutFooter);
|
|
@@ -2,7 +2,7 @@ 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
|
|
5
|
+
import CustomOverlayLayoutWithoutFooter from './CustomOverlayLayoutWithoutFooter';
|
|
6
6
|
import ListPicker from '../ListPicker';
|
|
7
7
|
|
|
8
8
|
class MonthPickerOverlay extends React.Component {
|
|
@@ -10,7 +10,7 @@ class MonthPickerOverlay extends React.Component {
|
|
|
10
10
|
super();
|
|
11
11
|
this.months = [];
|
|
12
12
|
this.handleMonthClick = this.handleMonthClick.bind(this);
|
|
13
|
-
this.months = props.localeUtils ? props.localeUtils.getMonths() : props.children.props.localeUtils.getMonths();
|
|
13
|
+
this.months = props.localeUtils ? props.localeUtils.getMonths(props.children.props.locale) : props.children.props.localeUtils.getMonths(props.children.props.locale);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
handleMonthClick(month) {
|
|
@@ -31,9 +31,9 @@ class MonthPickerOverlay extends React.Component {
|
|
|
31
31
|
} = _this$props,
|
|
32
32
|
props = _objectWithoutProperties(_this$props, ["value", "translations"]);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return React.createElement(
|
|
34
|
+
const now = new Date();
|
|
35
|
+
const currentMonth = props.localeUtils ? props.localeUtils.getMonths(props.children.props.locale)[now.getMonth()] : props.children.props.localeUtils.getMonths(props.children.props.locale)[now.getMonth()];
|
|
36
|
+
return React.createElement(CustomOverlayLayoutWithoutFooter, _extends({
|
|
37
37
|
headerElement: translations.month
|
|
38
38
|
}, props), React.createElement(ListPicker, {
|
|
39
39
|
itemList: this.months,
|
|
@@ -45,15 +45,17 @@ const Overlay = (_ref) => {
|
|
|
45
45
|
[classes.relative]: staticPosition === true
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
const paperProps = _objectSpread({}, props);
|
|
49
49
|
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
return (// eslint-disable-next-line react/jsx-handler-names
|
|
51
|
+
React.createElement(Paper, {
|
|
52
|
+
onBlur: paperProps.onBlur,
|
|
53
|
+
onFocus: paperProps.onFocus,
|
|
54
|
+
className: paperClass
|
|
55
|
+
}, React.createElement("div", {
|
|
56
|
+
className: classes.overlay
|
|
57
|
+
}, children))
|
|
58
|
+
);
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
Overlay.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -88,7 +90,12 @@ Overlay.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
88
90
|
/**
|
|
89
91
|
* Définit comment construire le Paper dans le cas d'un double input
|
|
90
92
|
*/
|
|
91
|
-
side: PropTypes.string
|
|
93
|
+
side: PropTypes.string,
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Display overlay with position static
|
|
97
|
+
*/
|
|
98
|
+
staticPosition: PropTypes.bool
|
|
92
99
|
} : {};
|
|
93
100
|
export default withStyles(styles, {
|
|
94
101
|
name: 'HmuiOverlay'
|
|
@@ -81,7 +81,7 @@ export const styles = theme => ({
|
|
|
81
81
|
bottom: 0,
|
|
82
82
|
height: 32,
|
|
83
83
|
width: 32,
|
|
84
|
-
margin: '
|
|
84
|
+
margin: '4px 24px'
|
|
85
85
|
},
|
|
86
86
|
calendarButton: {
|
|
87
87
|
fontWeight: theme.typography.fontWeightMedium
|
|
@@ -92,7 +92,7 @@ var _ref = React.createElement(CalendarIcon, null);
|
|
|
92
92
|
|
|
93
93
|
class TimePickerOverlay extends React.Component {
|
|
94
94
|
constructor(props) {
|
|
95
|
-
super();
|
|
95
|
+
super(props);
|
|
96
96
|
this.hours = Array.from(Array(24).keys());
|
|
97
97
|
this.minutes = Array.from(Array(60).keys());
|
|
98
98
|
this.handleHourClick = this.handleHourClick.bind(this);
|
|
@@ -2,12 +2,12 @@ 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
|
|
5
|
+
import CustomOverlayLayoutWithoutFooter from './CustomOverlayLayoutWithoutFooter';
|
|
6
6
|
import ListPicker from '../ListPicker';
|
|
7
7
|
|
|
8
8
|
class YearPickerOverlay extends React.Component {
|
|
9
9
|
constructor(props) {
|
|
10
|
-
super();
|
|
10
|
+
super(props);
|
|
11
11
|
this.years = [];
|
|
12
12
|
this.handleYearClick = this.handleYearClick.bind(this);
|
|
13
13
|
const currentYear = new Date().getFullYear();
|
|
@@ -42,7 +42,7 @@ class YearPickerOverlay extends React.Component {
|
|
|
42
42
|
} = _this$props,
|
|
43
43
|
props = _objectWithoutProperties(_this$props, ["value", "translations"]);
|
|
44
44
|
|
|
45
|
-
return React.createElement(
|
|
45
|
+
return React.createElement(CustomOverlayLayoutWithoutFooter, _extends({
|
|
46
46
|
headerElement: translations.year
|
|
47
47
|
}, props), React.createElement(ListPicker, {
|
|
48
48
|
itemList: this.years,
|
|
@@ -55,8 +55,6 @@ class YearPickerOverlay extends React.Component {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
YearPickerOverlay.defaultProps = {
|
|
58
|
-
// disableFutureDays: true,
|
|
59
|
-
// disablePastDays: false,
|
|
60
58
|
minimumDate: new Date(2013, 4, 1),
|
|
61
59
|
// by default 1 May 2013
|
|
62
60
|
translations: {
|
|
@@ -92,7 +90,7 @@ YearPickerOverlay.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
92
90
|
/**
|
|
93
91
|
* Date minimale sélectionnable
|
|
94
92
|
*/
|
|
95
|
-
minimumDate: PropTypes.instanceOf(Date)
|
|
93
|
+
minimumDate: PropTypes.instanceOf(Date),
|
|
96
94
|
|
|
97
95
|
/**
|
|
98
96
|
* Fonction de callback
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const WEEKDAYS_LONG = {
|
|
2
|
+
en_US: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
3
|
+
fr_FR: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi']
|
|
4
|
+
};
|
|
5
|
+
const WEEKDAYS_SHORT = {
|
|
6
|
+
en_US: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
7
|
+
fr_FR: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa']
|
|
8
|
+
};
|
|
9
|
+
const MONTHS = {
|
|
10
|
+
en_US: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
11
|
+
fr_FR: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre']
|
|
12
|
+
};
|
|
13
|
+
const FIRST_DAY = {
|
|
14
|
+
en_US: 0,
|
|
15
|
+
fr_FR: 1 // Use Monday as first day of the week
|
|
16
|
+
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Format Date as day
|
|
20
|
+
*
|
|
21
|
+
* @param Date d
|
|
22
|
+
* @param string locale
|
|
23
|
+
*
|
|
24
|
+
* @returns string
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
function formatDay(d, locale = 'en_US') {
|
|
28
|
+
const loc = this.formatLocale(locale);
|
|
29
|
+
return `${WEEKDAYS_LONG[loc][d.getDay()]}, ${d.getDate()} ${MONTHS[loc][d.getMonth()]} ${d.getFullYear()}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Format Date as month title
|
|
33
|
+
*
|
|
34
|
+
* @param Date d
|
|
35
|
+
* @param string locale
|
|
36
|
+
*
|
|
37
|
+
* @returns string
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
function formatMonthTitle(d, locale = 'en_US') {
|
|
42
|
+
const loc = this.formatLocale(locale);
|
|
43
|
+
return `${MONTHS[loc][d.getMonth()]} ${d.getFullYear()}`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the short version of a week day
|
|
47
|
+
*
|
|
48
|
+
* @param int i
|
|
49
|
+
* @param string locale
|
|
50
|
+
*
|
|
51
|
+
* @returns string
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
function formatWeekdayShort(i, locale = 'en_US') {
|
|
56
|
+
const loc = this.formatLocale(locale);
|
|
57
|
+
return WEEKDAYS_SHORT[loc][i];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the long version of a week day
|
|
61
|
+
*
|
|
62
|
+
* @param int i
|
|
63
|
+
* @param string locale
|
|
64
|
+
*
|
|
65
|
+
* @returns string
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
function formatWeekdayLong(i, locale = 'en_US') {
|
|
70
|
+
const loc = this.formatLocale(locale);
|
|
71
|
+
return WEEKDAYS_LONG[loc][i];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get first day of the week
|
|
75
|
+
* @param string locale
|
|
76
|
+
*
|
|
77
|
+
* @returns integer
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
function getFirstDayOfWeek(locale = 'en_US') {
|
|
82
|
+
const loc = this.formatLocale(locale);
|
|
83
|
+
return FIRST_DAY[loc];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get List of Months
|
|
87
|
+
*
|
|
88
|
+
* @param string locale
|
|
89
|
+
*
|
|
90
|
+
* @returns array
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
function getMonths(locale = 'en_US') {
|
|
95
|
+
const loc = this.formatLocale(locale);
|
|
96
|
+
return MONTHS[loc];
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Format locale
|
|
100
|
+
*
|
|
101
|
+
* @param string locale
|
|
102
|
+
*
|
|
103
|
+
* @return string
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
function formatLocale(locale) {
|
|
108
|
+
let loc = locale.split('-');
|
|
109
|
+
|
|
110
|
+
if (loc.length !== 2) {
|
|
111
|
+
loc = locale.split('_');
|
|
112
|
+
|
|
113
|
+
if (loc.length !== 2) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
loc[1] = loc[1].toUpperCase();
|
|
119
|
+
return loc.join('_');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const HiLocaleUtils = {
|
|
123
|
+
formatDay,
|
|
124
|
+
formatMonthTitle,
|
|
125
|
+
formatWeekdayShort,
|
|
126
|
+
formatWeekdayLong,
|
|
127
|
+
getFirstDayOfWeek,
|
|
128
|
+
getMonths,
|
|
129
|
+
formatLocale
|
|
130
|
+
};
|
|
131
|
+
export default HiLocaleUtils;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread";
|
|
2
|
+
import { fade } from '../styles/colorManipulator';
|
|
2
3
|
export default (theme => ({
|
|
3
4
|
root: {
|
|
4
5
|
position: 'relative',
|
|
@@ -140,36 +141,60 @@ export default (theme => ({
|
|
|
140
141
|
footer: {
|
|
141
142
|
marginTop: 12,
|
|
142
143
|
borderTop: '1px solid',
|
|
143
|
-
borderTopColor: theme.palette.divider
|
|
144
|
+
borderTopColor: theme.palette.divider,
|
|
145
|
+
padding: '5px',
|
|
146
|
+
width: '100%'
|
|
144
147
|
},
|
|
145
148
|
// The today button (only with todayButton prop)
|
|
146
149
|
todayButton: _objectSpread({
|
|
147
|
-
|
|
150
|
+
display: 'table',
|
|
151
|
+
minWidth: 230,
|
|
152
|
+
margin: '0 auto',
|
|
148
153
|
border: 'none',
|
|
149
154
|
backgroundImage: 'none',
|
|
150
155
|
backgroundColor: 'transparent',
|
|
151
156
|
boxShadow: 'none',
|
|
152
157
|
cursor: 'pointer',
|
|
153
|
-
height:
|
|
158
|
+
height: 30
|
|
154
159
|
}, theme.typography.body2, {
|
|
155
160
|
color: theme.palette.neutral.main,
|
|
156
161
|
fontWeight: theme.typography.fontWeightMedium,
|
|
157
|
-
textTransform: 'uppercase'
|
|
162
|
+
textTransform: 'uppercase',
|
|
163
|
+
'&:hover': {
|
|
164
|
+
backgroundColor: fade(theme.palette.neutral.dark, theme.palette.action.hoverOpacity),
|
|
165
|
+
// Reset on touch devices, it doesn't add specificity
|
|
166
|
+
'@media (hover: none)': {
|
|
167
|
+
backgroundColor: 'transparent'
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
borderRadius: 4
|
|
158
171
|
}),
|
|
159
172
|
|
|
160
173
|
/* default modifiers */
|
|
161
174
|
// Added to the day's cell for the current day
|
|
162
175
|
today: {
|
|
163
176
|
// color: theme.palette.primary.light,
|
|
164
|
-
|
|
177
|
+
position: 'relative',
|
|
165
178
|
borderRadius: '50%',
|
|
166
179
|
color: `${theme.palette.neutral.dark} !important`,
|
|
167
|
-
fontWeight: theme.typography.fontWeightMedium
|
|
180
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
181
|
+
'&:before': {
|
|
182
|
+
content: '""',
|
|
183
|
+
position: 'absolute',
|
|
184
|
+
top: 0,
|
|
185
|
+
left: 0,
|
|
186
|
+
display: 'inline-block',
|
|
187
|
+
width: '100%',
|
|
188
|
+
height: '100%',
|
|
189
|
+
borderRadius: '50%',
|
|
190
|
+
boxShadow: `inset 0 0 0 2px ${theme.palette.neutral.main}`
|
|
191
|
+
}
|
|
168
192
|
},
|
|
169
193
|
// Added to the day's cell outside the current month
|
|
170
194
|
outside: {
|
|
171
195
|
backgroundColor: '#F8F9FB',
|
|
172
|
-
color: theme.palette.neutral.main
|
|
196
|
+
color: theme.palette.neutral.main,
|
|
197
|
+
cursor: 'default'
|
|
173
198
|
},
|
|
174
199
|
// Added to the day's cell specified in the "disabledDays" prop
|
|
175
200
|
disabled: {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import withStyles from '../styles/withStyles';
|
|
6
|
+
import HiIcon from '../HiIcon';
|
|
7
|
+
import HiIconButton from '../HiIconButton';
|
|
8
|
+
export const styles = () => ({
|
|
9
|
+
dot: {
|
|
10
|
+
padding: 4,
|
|
11
|
+
'&:hover': {
|
|
12
|
+
backgroundColor: 'transparent !important'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var _ref = React.createElement(HiIcon, {
|
|
18
|
+
size: 24
|
|
19
|
+
}, "radio_button_checked");
|
|
20
|
+
|
|
21
|
+
var _ref2 = React.createElement(HiIcon, {
|
|
22
|
+
size: 12
|
|
23
|
+
}, "lens");
|
|
24
|
+
|
|
25
|
+
class HiDot extends React.PureComponent {
|
|
26
|
+
render() {
|
|
27
|
+
const _this$props = this.props,
|
|
28
|
+
{
|
|
29
|
+
active,
|
|
30
|
+
status,
|
|
31
|
+
classes,
|
|
32
|
+
onClick
|
|
33
|
+
} = _this$props,
|
|
34
|
+
props = _objectWithoutProperties(_this$props, ["active", "status", "classes", "onClick"]);
|
|
35
|
+
|
|
36
|
+
let dotColor;
|
|
37
|
+
|
|
38
|
+
if (!status || status === 'unreviewed') {
|
|
39
|
+
dotColor = 'default';
|
|
40
|
+
} else {
|
|
41
|
+
dotColor = status === 'refused' ? 'negative' : 'positive';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return React.createElement(HiIconButton, _extends({
|
|
45
|
+
className: classes.dot,
|
|
46
|
+
color: dotColor,
|
|
47
|
+
onClick: onClick
|
|
48
|
+
}, props), active ? _ref : _ref2);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
HiDot.defaultProps = {
|
|
54
|
+
active: false,
|
|
55
|
+
status: 'unreviewed'
|
|
56
|
+
};
|
|
57
|
+
HiDot.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
58
|
+
active: PropTypes.bool,
|
|
59
|
+
classes: PropTypes.object,
|
|
60
|
+
onClick: PropTypes.func,
|
|
61
|
+
status: PropTypes.oneOf(['refused', 'validated', 'unreviewed'])
|
|
62
|
+
} : {};
|
|
63
|
+
export default withStyles(styles, {
|
|
64
|
+
hiComponent: true,
|
|
65
|
+
name: 'HmuiHiDot'
|
|
66
|
+
})(HiDot);
|