@hipay/hipay-material-ui 2.0.0-beta.56 → 2.0.0-beta.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/HiAlertModal/HiAlertModal.js +56 -13
  3. package/HiColoredLabel/HiColoredLabel.js +1 -1
  4. package/HiDatePicker/Caption.js +8 -1
  5. package/HiDatePicker/HiDatePicker.js +9 -3
  6. package/HiDatePicker/HiDateRangePicker.js +9 -3
  7. package/HiDatePicker/HiDateRangeSelector.js +54 -4
  8. package/HiDatePicker/NavBar.js +8 -1
  9. package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +123 -0
  10. package/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
  11. package/HiDatePicker/Overlays/YearPickerOverlay.js +2 -2
  12. package/HiDatePicker/hiLocaleUtils.js +144 -0
  13. package/HiDatePicker/stylesheet.js +31 -6
  14. package/HiForm/HiFormControl.js +4 -4
  15. package/HiForm/HiInput.js +19 -7
  16. package/HiForm/HiUploadField.js +2 -1
  17. package/HiNotice/HiKPI.js +3 -3
  18. package/HiNotice/HiKPINotice.js +12 -9
  19. package/HiPin/HiPin.js +1 -1
  20. package/HiSelect/HiSelect.js +6 -5
  21. package/HiSelect/HiSuggestSelect.js +21 -2
  22. package/HiSelect/SelectInput.js +5 -1
  23. package/HiSelectNew/HiSelect.js +163 -59
  24. package/HiSelectNew/HiSelectInput.js +8 -1
  25. package/HiSelectableList/HiSelectableList.js +4 -30
  26. package/HiSelectableList/HiSelectableListItem.js +19 -12
  27. package/README.md +9 -10
  28. package/es/HiAlertModal/HiAlertModal.js +55 -13
  29. package/es/HiColoredLabel/HiColoredLabel.js +1 -1
  30. package/es/HiDatePicker/Caption.js +7 -1
  31. package/es/HiDatePicker/HiDatePicker.js +8 -3
  32. package/es/HiDatePicker/HiDateRangePicker.js +8 -3
  33. package/es/HiDatePicker/HiDateRangeSelector.js +48 -4
  34. package/es/HiDatePicker/NavBar.js +7 -1
  35. package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +106 -0
  36. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
  37. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +2 -2
  38. package/es/HiDatePicker/hiLocaleUtils.js +131 -0
  39. package/es/HiDatePicker/stylesheet.js +30 -6
  40. package/es/HiForm/HiFormControl.js +4 -4
  41. package/es/HiForm/HiInput.js +19 -7
  42. package/es/HiForm/HiUploadField.js +2 -1
  43. package/es/HiNotice/HiKPI.js +3 -3
  44. package/es/HiNotice/HiKPINotice.js +10 -9
  45. package/es/HiPin/HiPin.js +1 -1
  46. package/es/HiSelect/HiSelect.js +6 -5
  47. package/es/HiSelect/HiSuggestSelect.js +21 -2
  48. package/es/HiSelect/SelectInput.js +5 -1
  49. package/es/HiSelectNew/HiSelect.js +166 -56
  50. package/es/HiSelectNew/HiSelectInput.js +7 -1
  51. package/es/HiSelectableList/HiSelectableList.js +5 -25
  52. package/es/HiSelectableList/HiSelectableListItem.js +23 -16
  53. package/es/index.js +2 -1
  54. package/index.es.js +2 -1
  55. package/index.js +10 -2
  56. package/package.json +1 -1
  57. package/umd/hipay-material-ui.development.js +6207 -1359
  58. package/umd/hipay-material-ui.production.min.js +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,120 @@
1
+ # [2.0.0-beta.58](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.58) (2018-12-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
7
+ * **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
8
+ * **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
9
+ * **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
10
+ * **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
11
+ * **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
12
+ * **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
13
+ * **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
14
+ * **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
15
+ * **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
16
+ * **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
17
+ * **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
18
+ * **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
19
+ * **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
20
+ * **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
21
+ * **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
22
+
23
+
24
+ ### Features
25
+
26
+ * **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
27
+ * **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
28
+ * **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
29
+ * **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
30
+ * **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
31
+ * **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
32
+ * **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
33
+ * **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
34
+ * **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
35
+ * **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
36
+ * **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
37
+ * **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
38
+ * **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
39
+ * **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
40
+ * **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
41
+ * **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
42
+
43
+
44
+ ### Performance Improvements
45
+
46
+ * **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
47
+
48
+
49
+ ### BREAKING CHANGES
50
+
51
+ * **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
52
+ * **HiUploadField:** Components names changes
53
+ * **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
54
+ CellImage & CellText)
55
+ * **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
56
+
57
+
58
+
59
+ <a name="2.0.0-beta.41"></a>
60
+ # [2.0.0-beta.41](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.41) (2018-12-07)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
66
+ * **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
67
+ * **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
68
+ * **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
69
+ * **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
70
+ * **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
71
+ * **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
72
+ * **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
73
+ * **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
74
+ * **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
75
+ * **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
76
+ * **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
77
+ * **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
78
+ * **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
79
+ * **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
80
+ * **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
81
+
82
+
83
+ ### Features
84
+
85
+ * **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
86
+ * **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
87
+ * **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
88
+ * **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
89
+ * **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
90
+ * **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
91
+ * **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
92
+ * **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
93
+ * **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
94
+ * **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
95
+ * **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
96
+ * **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
97
+ * **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
98
+ * **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
99
+ * **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
100
+ * **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
101
+
102
+
103
+ ### Performance Improvements
104
+
105
+ * **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
106
+
107
+
108
+ ### BREAKING CHANGES
109
+
110
+ * **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
111
+ * **HiUploadField:** Components names changes
112
+ * **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
113
+ CellImage & CellText)
114
+ * **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
115
+
116
+
117
+
1
118
  <a name="2.0.0-beta.41"></a>
2
119
  # [2.0.0-beta.41](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.41) (2018-11-12)
3
120
 
@@ -41,20 +41,28 @@ var _styles = require("../styles");
41
41
 
42
42
  var _HiButton = _interopRequireDefault(require("../HiButton"));
43
43
 
44
+ var _HiIcon = _interopRequireDefault(require("../HiIcon"));
45
+
44
46
  // @inheritedComponent Dialog
45
47
  var styles = function styles(theme) {
46
48
  return {
47
49
  classContent: {
48
50
  fontSize: 14,
49
- lineHeight: '24px',
50
- color: '#484848'
51
+ lineHeight: '20px',
52
+ color: '#484848',
53
+ position: 'relative'
51
54
  },
52
- classPaper: {
53
- maxWidth: 300
55
+ classDialogPaper: {
56
+ minHeight: 280,
57
+ maxWidth: 280,
58
+ borderRadius: 2
54
59
  },
55
60
  classCancelButton: {
56
61
  float: 'right'
57
62
  },
63
+ classSubmitButton: {
64
+ margin: '0'
65
+ },
58
66
  classTitle: {
59
67
  fontSize: 20,
60
68
  fontFamily: theme.typography.fontFamily,
@@ -62,10 +70,20 @@ var styles = function styles(theme) {
62
70
  lineHeight: '24px'
63
71
  },
64
72
  classAction: {
65
- display: 'inline-block'
73
+ display: 'inline-block',
74
+ margin: '0',
75
+ padding: '0px 24px 24px 24px'
66
76
  },
67
77
  classDialogRoot: {
68
78
  backgroundColor: 'rgba(0, 0, 0, 0.28)'
79
+ },
80
+ classBackgroundIcon: {
81
+ position: 'absolute',
82
+ top: 'calc(50%)',
83
+ left: '50%',
84
+ transform: 'translate(-50%, -50%)',
85
+ color: theme.palette.background2,
86
+ flex: '1'
69
87
  }
70
88
  };
71
89
  };
@@ -117,6 +135,8 @@ function (_React$PureComponent) {
117
135
  // Render
118
136
  value: function render() {
119
137
  var _this$props = this.props,
138
+ backgroundIcon = _this$props.backgroundIcon,
139
+ iconSize = _this$props.iconSize,
120
140
  classes = _this$props.classes,
121
141
  content = _this$props.content,
122
142
  labelCancelButton = _this$props.labelCancelButton,
@@ -124,17 +144,23 @@ function (_React$PureComponent) {
124
144
  onCancelClick = _this$props.onCancelClick,
125
145
  onSubmitClick = _this$props.onSubmitClick,
126
146
  open = _this$props.open,
147
+ cancelColor = _this$props.cancelColor,
127
148
  submitColor = _this$props.submitColor,
128
149
  title = _this$props.title,
129
- props = (0, _objectWithoutProperties2.default)(_this$props, ["classes", "content", "labelCancelButton", "labelSubmitButton", "onCancelClick", "onSubmitClick", "open", "submitColor", "title"]);
150
+ props = (0, _objectWithoutProperties2.default)(_this$props, ["backgroundIcon", "iconSize", "classes", "content", "labelCancelButton", "labelSubmitButton", "onCancelClick", "onSubmitClick", "open", "cancelColor", "submitColor", "title"]);
130
151
  return _react.default.createElement(_Dialog.default, (0, _extends2.default)({
131
152
  open: open,
132
153
  onClose: this.handleOnClose,
133
154
  classes: {
134
- paper: classes.classPaper,
135
- root: classes.classDialogRoot
155
+ root: classes.classDialogRoot,
156
+ paper: classes.classDialogPaper
136
157
  }
137
- }, props), _react.default.createElement(_DialogTitle.default, {
158
+ }, props), backgroundIcon && _react.default.createElement("div", {
159
+ className: classes.classBackgroundIcon
160
+ }, _react.default.createElement(_HiIcon.default, {
161
+ icon: backgroundIcon,
162
+ size: iconSize
163
+ })), _react.default.createElement(_DialogTitle.default, {
138
164
  disableTypography: true,
139
165
  classes: {
140
166
  root: classes.classTitle
@@ -147,22 +173,39 @@ function (_React$PureComponent) {
147
173
  classes: {
148
174
  root: classes.classAction
149
175
  }
150
- }, _react.default.createElement(_HiButton.default, {
176
+ }, labelSubmitButton && _react.default.createElement(_HiButton.default, {
177
+ classes: {
178
+ root: classes.classSubmitButton
179
+ },
151
180
  onClick: this.handleClickSubmit,
152
181
  color: submitColor
153
- }, labelSubmitButton), _react.default.createElement(_HiButton.default, {
182
+ }, labelSubmitButton), labelCancelButton && _react.default.createElement(_HiButton.default, {
154
183
  classes: {
155
184
  root: classes.classCancelButton
156
185
  },
157
186
  onClick: this.handleClickCancel,
158
- color: "neutral"
187
+ color: cancelColor
159
188
  }, labelCancelButton)));
160
189
  }
161
190
  }]);
162
191
  return HiAlertModal;
163
192
  }(_react.default.PureComponent);
164
193
 
194
+ HiAlertModal.defaultProps = {
195
+ cancelColor: 'neutral',
196
+ submitColor: 'primary'
197
+ };
165
198
  HiAlertModal.propTypes = process.env.NODE_ENV !== "production" ? {
199
+ /**
200
+ * Icon à mettre en fond
201
+ */
202
+ backgroundIcon: _propTypes.default.string,
203
+
204
+ /**
205
+ * The color of the cancel button. It supports those theme colors that make sense for this component.
206
+ */
207
+ cancelColor: _propTypes.default.oneOf(['default', 'inherit', 'primary', 'secondary', 'positive', 'negative', 'middle', 'neutral']),
208
+
166
209
  /**
167
210
  * Surcharge les classes du composant
168
211
  */
@@ -171,7 +214,7 @@ HiAlertModal.propTypes = process.env.NODE_ENV !== "production" ? {
171
214
  /**
172
215
  * Texte contenu dans la modal
173
216
  */
174
- content: _propTypes.default.string,
217
+ content: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object, _propTypes.default.node]),
175
218
 
176
219
  /**
177
220
  * Texte sur le bouton d'annulation
@@ -27,7 +27,7 @@ var _colorManipulator = require("../styles/colorManipulator");
27
27
 
28
28
  var styles = function styles(theme) {
29
29
  return {
30
- root: (0, _extends2.default)({}, theme.typography.b1, {
30
+ root: (0, _extends2.default)({}, theme.typography.b3, {
31
31
  display: 'inline-block',
32
32
  alignItems: 'baseline',
33
33
  maxWidth: '100%',
@@ -35,10 +35,12 @@ exports.styles = styles;
35
35
  var Caption = function Caption(_ref) {
36
36
  var classes = _ref.classes,
37
37
  date = _ref.date,
38
+ _ref$locale = _ref.locale,
39
+ locale = _ref$locale === void 0 ? 'en_US' : _ref$locale,
38
40
  localeUtils = _ref.localeUtils,
39
41
  onMonthClick = _ref.onMonthClick,
40
42
  onYearClick = _ref.onYearClick;
41
- var months = localeUtils.getMonths();
43
+ var months = localeUtils.getMonths(locale);
42
44
  return _react.default.createElement("div", {
43
45
  className: classes.caption
44
46
  }, _react.default.createElement(_HiButton.default, {
@@ -61,6 +63,11 @@ Caption.propTypes = process.env.NODE_ENV !== "production" ? {
61
63
  */
62
64
  date: _propTypes.default.object.isRequired,
63
65
 
66
+ /**
67
+ * ReactDayPicker prop
68
+ */
69
+ locale: _propTypes.default.string,
70
+
64
71
  /**
65
72
  * ReactDayPicker prop
66
73
  */
@@ -31,6 +31,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
31
31
 
32
32
  var _moment = _interopRequireDefault(require("react-day-picker/moment"));
33
33
 
34
+ var _hiLocaleUtils = _interopRequireDefault(require("./hiLocaleUtils"));
35
+
34
36
  var _DayPickerInput = _interopRequireDefault(require("react-day-picker/DayPickerInput"));
35
37
 
36
38
  var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
@@ -274,13 +276,14 @@ function (_React$Component) {
274
276
  return _react.default.createElement(_NavBar.default, (0, _extends2.default)({
275
277
  showClockButton: enableTime,
276
278
  onClockClick: _this2.handleClockClick
277
- }, props2));
279
+ }, props2, {
280
+ localeUtils: _hiLocaleUtils.default
281
+ }));
278
282
  },
279
283
  captionElement: this.renderCaption,
280
284
  classNames: classes,
281
285
  disabledDays: effectiveDisabledDays,
282
286
  selectedDays: (0, _typeof2.default)(value) === 'object' ? value : undefined,
283
- locale: locale,
284
287
  firstDayOfWeek: 1,
285
288
  fromMonth: minimumDate,
286
289
  modifiers: {
@@ -289,7 +292,10 @@ function (_React$Component) {
289
292
  },
290
293
  modifiersStyles: modifiersStyles,
291
294
  month: currentMonth
292
- }, props);
295
+ }, props, {
296
+ locale: locale,
297
+ localeUtils: _hiLocaleUtils.default
298
+ });
293
299
  var inputProps = (0, _extends2.default)({}, onReset && {
294
300
  onReset: this.handleReset
295
301
  }, props, {
@@ -29,6 +29,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
29
29
 
30
30
  var _moment = _interopRequireDefault(require("react-day-picker/moment"));
31
31
 
32
+ var _hiLocaleUtils = _interopRequireDefault(require("./hiLocaleUtils"));
33
+
32
34
  var _DayPickerInput = _interopRequireDefault(require("react-day-picker/DayPickerInput"));
33
35
 
34
36
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -105,7 +107,7 @@ function (_React$Component) {
105
107
  _this.onDayToClick = function (day) {
106
108
  var change = (0, _moment2.default)(day) >= (0, _moment2.default)(_this.props.from);
107
109
 
108
- if (change && _this.props.disableFutureDays && (0, _moment2.default)(day) > (0, _moment2.default)()) {
110
+ if (change && _this.props.disableFutureDays && (0, _moment2.default)(day).utc() > (0, _moment2.default)().utc().endOf('day')) {
109
111
  change = false;
110
112
  }
111
113
 
@@ -161,9 +163,9 @@ function (_React$Component) {
161
163
 
162
164
  if (name === 'to' && comparativeDate > (0, _moment2.default)(date) || name === 'from' && comparativeDate < (0, _moment2.default)(date)) {
163
165
  error = translations.to_superior_from;
164
- } else if (date < minimumDate) {
166
+ } else if ((0, _moment2.default)(date).utc() < (0, _moment2.default)(minimumDate).utc().startOf('day')) {
165
167
  error = translations.date_inferior_min_date.replace('%s', (0, _moment2.default)(minimumDate).format(format));
166
- } else if (disableFutureDays && date > now) {
168
+ } else if (disableFutureDays && (0, _moment2.default)(date).utc() > (0, _moment2.default)(now).utc().endOf('day')) {
167
169
  error = translations.date_superior_max_date.replace('%s', (0, _moment2.default)().format(format));
168
170
  }
169
171
 
@@ -416,6 +418,8 @@ function (_React$Component) {
416
418
  }, to && {
417
419
  after: to
418
420
  }),
421
+ locale: locale,
422
+ localeUtils: _hiLocaleUtils.default,
419
423
  month: this.state.currentMonth,
420
424
  modifiers: (0, _extends2.default)({}, modifiers)
421
425
  });
@@ -431,6 +435,8 @@ function (_React$Component) {
431
435
  }, from && {
432
436
  before: from
433
437
  }),
438
+ locale: locale,
439
+ localeUtils: _hiLocaleUtils.default,
434
440
  month: this.state.currentMonth,
435
441
  modifiers: (0, _extends2.default)({}, modifiers)
436
442
  }); // From & To InputProps
@@ -5,6 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.findSeparator = findSeparator;
9
+ exports.yearAndMonth = yearAndMonth;
10
+ exports.yearAndQuarter = yearAndQuarter;
8
11
  exports.buildDateRangeOptionByKey = buildDateRangeOptionByKey;
9
12
  exports.default = exports.styles = void 0;
10
13
 
@@ -44,6 +47,52 @@ var _HiDateRangePicker = _interopRequireDefault(require("./HiDateRangePicker"));
44
47
 
45
48
  var _HiFormControl = _interopRequireDefault(require("../HiForm/HiFormControl"));
46
49
 
50
+ function findSeparator(format) {
51
+ var str = '';
52
+
53
+ if (format.search('[/]') >= 0) {
54
+ str = '/';
55
+ } else if (format.search('[-]') >= 0) {
56
+ str = '-';
57
+ } else if (format.search('[.]') >= 0) {
58
+ str = '.';
59
+ }
60
+
61
+ return str;
62
+ }
63
+
64
+ function yearAndMonth(format, date) {
65
+ var findY = function findY(el) {
66
+ return el.toUpperCase().search('Y') >= 0;
67
+ };
68
+
69
+ var findM = function findM(el) {
70
+ return el.toUpperCase().search('M') >= 0;
71
+ };
72
+
73
+ var s = findSeparator(format);
74
+ var split = format.split(s);
75
+ var indexY = split.findIndex(findY);
76
+ var indexM = split.findIndex(findM);
77
+ return indexY < indexM ? date.format(split[indexY] + s + split[indexM]) : date.format(split[indexM] + s + split[indexY]);
78
+ }
79
+
80
+ function yearAndQuarter(format, date, t) {
81
+ var findY = function findY(el) {
82
+ return el.toUpperCase().search('Y') >= 0;
83
+ };
84
+
85
+ var findM = function findM(el) {
86
+ return el.toUpperCase().search('M') >= 0;
87
+ };
88
+
89
+ var s = findSeparator(format);
90
+ var split = format.split(s);
91
+ var indexY = split.findIndex(findY);
92
+ var indexM = split.findIndex(findM);
93
+ return indexY < indexM ? date.format("".concat(split[indexY]).concat(s, "[").concat(t.short_quarter, "]Q")) : date.format("[".concat(t.short_quarter, "]Q").concat(s).concat(split[indexY]));
94
+ }
95
+
47
96
  function buildDateRangeOptionByKey(key, t, format) {
48
97
  var from;
49
98
  var label;
@@ -104,21 +153,21 @@ function buildDateRangeOptionByKey(key, t, format) {
104
153
  label = t.previous_month;
105
154
  from = (0, _moment.default)().subtract(1, 'month').startOf('month');
106
155
  to = (0, _moment.default)().subtract(1, 'month').endOf('month');
107
- info = "".concat(from.format(t.yearAndMonth), ", ").concat(from.daysInMonth(), " ").concat(t.days);
156
+ info = "".concat(yearAndMonth(format, from), ", ").concat(from.daysInMonth(), " ").concat(t.days);
108
157
  break;
109
158
 
110
159
  case 'cq':
111
160
  label = t.current_quarter;
112
161
  from = (0, _moment.default)().startOf('quarter');
113
162
  to = (0, _moment.default)();
114
- info = "".concat(from.format(t.yearAndQuarter), ", ").concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
163
+ info = "".concat(yearAndQuarter(format, from, t), ", ").concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
115
164
  break;
116
165
 
117
166
  case 'pq':
118
167
  label = t.previous_quarter;
119
168
  from = (0, _moment.default)().subtract(1, 'quarter').startOf('quarter');
120
169
  to = (0, _moment.default)().subtract(1, 'quarter').endOf('quarter');
121
- info = "".concat(from.format(t.yearAndQuarter), ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
170
+ info = "".concat(yearAndQuarter(format, from, t), ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
122
171
  break;
123
172
 
124
173
  case 'cy':
@@ -155,7 +204,7 @@ var styles = function styles() {
155
204
  },
156
205
  dateRangePicker: {
157
206
  width: 'calc(100% + 8px)',
158
- marginTop: 1
207
+ marginTop: 0
159
208
  },
160
209
  smSelect: {},
161
210
  smRangePicker: {}
@@ -370,6 +419,7 @@ HiDateRangeSelector.defaultProps = {
370
419
  quarter: 'Quarter',
371
420
  week: 'Week',
372
421
  short_week: 'W',
422
+ short_quarter: 'Q',
373
423
  yearAndMonth: 'YYYY[-]MM',
374
424
  yearAndQuarter: 'YYYY[-Q]Q',
375
425
  year: 'Year',
@@ -62,6 +62,8 @@ var _ref4 = _react.default.createElement(_AccessTime.default, null);
62
62
 
63
63
  var NavBar = function NavBar(_ref) {
64
64
  var classes = _ref.classes,
65
+ _ref$locale = _ref.locale,
66
+ locale = _ref$locale === void 0 ? 'en_US' : _ref$locale,
65
67
  localeUtils = _ref.localeUtils,
66
68
  nextMonth = _ref.nextMonth,
67
69
  onClockClick = _ref.onClockClick,
@@ -69,7 +71,7 @@ var NavBar = function NavBar(_ref) {
69
71
  onNextClick = _ref.onNextClick,
70
72
  previousMonth = _ref.previousMonth,
71
73
  showClockButton = _ref.showClockButton;
72
- var months = localeUtils.getMonths();
74
+ var months = localeUtils.getMonths(locale);
73
75
  var prev = "".concat(months[previousMonth.getMonth()], " ").concat(previousMonth.getFullYear());
74
76
  var next = "".concat(months[nextMonth.getMonth()], " ").concat(nextMonth.getFullYear());
75
77
  return _react.default.createElement("div", {
@@ -100,6 +102,11 @@ NavBar.propTypes = process.env.NODE_ENV !== "production" ? {
100
102
  */
101
103
  classes: _propTypes.default.object,
102
104
 
105
+ /**
106
+ * ReactDayPicker prop
107
+ */
108
+ locale: _propTypes.default.string,
109
+
103
110
  /**
104
111
  * ReactDayPicker prop
105
112
  */
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.styles = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
+
14
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
+
16
+ var _react = _interopRequireDefault(require("react"));
17
+
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+
20
+ var _classnames = _interopRequireDefault(require("classnames"));
21
+
22
+ var _Paper = _interopRequireDefault(require("@material-ui/core/Paper"));
23
+
24
+ var _withStyles = _interopRequireDefault(require("../../styles/withStyles"));
25
+
26
+ var styles = function styles(theme) {
27
+ return {
28
+ paper: {
29
+ width: '100%',
30
+ zIndex: 10
31
+ },
32
+ absolute: {
33
+ position: 'absolute'
34
+ },
35
+ relative: {
36
+ position: 'relative'
37
+ },
38
+ left: {
39
+ width: '200%',
40
+ left: 0
41
+ },
42
+ right: {
43
+ width: '200%',
44
+ left: '-100%'
45
+ },
46
+ overlay: (0, _extends2.default)({
47
+ padding: 0,
48
+ height: 325,
49
+ textAlign: 'center'
50
+ }, theme.typography.body2, {
51
+ fontWeight: theme.typography.fontWeightRegular
52
+ }),
53
+ header: (0, _extends2.default)({
54
+ display: 'block',
55
+ height: 40,
56
+ textAlign: 'center',
57
+ padding: '10px 0'
58
+ }, theme.typography.body1, {
59
+ color: theme.palette.neutral.main,
60
+ borderBottom: '1px solid',
61
+ borderBottomColor: theme.palette.divider
62
+ }),
63
+ body: {
64
+ height: 285,
65
+ width: 224,
66
+ margin: 'auto'
67
+ }
68
+ };
69
+ };
70
+
71
+ exports.styles = styles;
72
+
73
+ var CustomOverlayLayoutWithoutFooter = function CustomOverlayLayoutWithoutFooter(_ref) {
74
+ var _classNames;
75
+
76
+ var classes = _ref.classes,
77
+ children = _ref.children,
78
+ headerElement = _ref.headerElement,
79
+ footerElement = _ref.footerElement,
80
+ absoluteElement = _ref.absoluteElement,
81
+ side = _ref.side,
82
+ staticPosition = _ref.staticPosition,
83
+ props = (0, _objectWithoutProperties2.default)(_ref, ["classes", "children", "headerElement", "footerElement", "absoluteElement", "side", "staticPosition"]);
84
+ var paperClass = (0, _classnames.default)(classes.paper, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.left, side === 'from'), (0, _defineProperty2.default)(_classNames, classes.right, side === 'to'), (0, _defineProperty2.default)(_classNames, classes.absolute, staticPosition !== true), (0, _defineProperty2.default)(_classNames, classes.relative, staticPosition === true), _classNames));
85
+ var paperProps = (0, _extends2.default)({}, props);
86
+ return (// eslint-disable-next-line react/jsx-handler-names
87
+ _react.default.createElement(_Paper.default, {
88
+ className: paperClass,
89
+ onBlur: paperProps.onBlur,
90
+ onFocus: paperProps.onFocus
91
+ }, _react.default.createElement("div", {
92
+ className: classes.overlay
93
+ }, _react.default.createElement("div", {
94
+ className: classes.header
95
+ }, headerElement), _react.default.createElement("div", {
96
+ className: classes.body
97
+ }, children), absoluteElement))
98
+ );
99
+ };
100
+
101
+ CustomOverlayLayoutWithoutFooter.propTypes = process.env.NODE_ENV !== "production" ? {
102
+ absoluteElement: _propTypes.default.any,
103
+ children: _propTypes.default.any,
104
+
105
+ /**
106
+ * Useful to extend the style applied to components.
107
+ */
108
+ classes: _propTypes.default.object,
109
+ footerElement: _propTypes.default.any,
110
+ headerElement: _propTypes.default.any,
111
+
112
+ /**
113
+ * Définit comment construire le Paper dans le cas d'un double input
114
+ */
115
+ side: _propTypes.default.string,
116
+ staticPosition: _propTypes.default.bool
117
+ } : {};
118
+
119
+ var _default = (0, _withStyles.default)(styles, {
120
+ name: 'HmuiCustomOverlayLayoutWithoutFooter'
121
+ })(CustomOverlayLayoutWithoutFooter);
122
+
123
+ exports.default = _default;