@hipay/hipay-material-ui 2.0.0-beta.55 → 2.0.0-beta.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/HiBreadcrumb/HiBreadcrumb.js +14 -4
  3. package/HiBreadcrumb/HiStep.js +4 -1
  4. package/HiBreadcrumb/HiStepContent.js +0 -1
  5. package/HiBreadcrumb/HiStepLabel.js +12 -4
  6. package/HiBreadcrumb/HiStepper.js +1 -1
  7. package/HiButton/HiButton.js +7 -1
  8. package/HiCell/CellIcon.js +4 -4
  9. package/HiCell/CellImage.js +13 -1
  10. package/HiCell/CellRate.js +6 -3
  11. package/HiCell/CellSentinel.js +7 -10
  12. package/HiCell/CellTextStyled.js +29 -1
  13. package/HiColoredLabel/HiColoredLabel.js +1 -1
  14. package/HiDatePicker/Caption.js +16 -10
  15. package/HiDatePicker/HiDatePicker.js +9 -3
  16. package/HiDatePicker/HiDateRangePicker.js +36 -22
  17. package/HiDatePicker/HiDateRangeSelector.js +75 -21
  18. package/HiDatePicker/NavBar.js +8 -1
  19. package/HiDatePicker/Overlays/CustomOverlayLayout.js +26 -17
  20. package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +123 -0
  21. package/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
  22. package/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
  23. package/HiDatePicker/Overlays/Overlay.js +15 -8
  24. package/HiDatePicker/Overlays/Overlay.spec.js +1 -0
  25. package/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
  26. package/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
  27. package/HiDatePicker/Overlays/YearPickerOverlay.js +4 -6
  28. package/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
  29. package/HiDatePicker/hiLocaleUtils.js +144 -0
  30. package/HiDatePicker/stylesheet.js +33 -7
  31. package/HiDotsStepper/HiDot.js +108 -0
  32. package/HiDotsStepper/HiDotsStepper.js +121 -0
  33. package/HiExpansionPanel/HiExpansionPanel.js +1 -1
  34. package/HiForm/HiAddressField.js +176 -0
  35. package/HiForm/HiFormControl.js +2 -0
  36. package/HiForm/HiInput.js +3 -3
  37. package/HiForm/HiSlider.js +352 -0
  38. package/HiForm/HiUpload.js +204 -0
  39. package/HiForm/HiUploadField.js +182 -0
  40. package/HiForm/HiUploadInput.js +459 -0
  41. package/HiForm/index.js +16 -0
  42. package/HiMap/HiMap.js +345 -0
  43. package/HiMap/HiMapExpand.js +210 -0
  44. package/HiMap/index.js +23 -0
  45. package/HiNotice/HiKPI.js +238 -0
  46. package/HiNotice/HiKPINotice.js +96 -0
  47. package/HiNotice/index.js +23 -0
  48. package/HiPdfReader/HiPdfReader.js +269 -0
  49. package/HiPdfReader/index.js +15 -0
  50. package/HiPin/HiPin.js +1 -1
  51. package/HiRadio/HiRadio.js +74 -0
  52. package/HiRadio/index.js +15 -0
  53. package/HiSelect/HiSelect.js +73 -84
  54. package/HiSelect/HiSuggestSelect.js +35 -4
  55. package/HiSelect/SelectInput.js +9 -1
  56. package/HiSelectNew/HiNestedSelectContent.js +5 -1
  57. package/HiSelectNew/HiSelect.js +260 -179
  58. package/HiSelectNew/HiSelectContent.js +0 -8
  59. package/HiSelectNew/HiSelectInput.js +8 -9
  60. package/HiSelectableList/HiSelectableList.js +39 -4
  61. package/HiSelectableList/HiSelectableListItem.js +81 -38
  62. package/HiTable/HiCellBuilder.js +25 -12
  63. package/HiTable/HiTableHeader.js +16 -17
  64. package/HiTable/constants.js +3 -1
  65. package/README.md +248 -98
  66. package/es/HiBreadcrumb/HiBreadcrumb.js +14 -4
  67. package/es/HiBreadcrumb/HiStep.js +4 -1
  68. package/es/HiBreadcrumb/HiStepContent.js +0 -1
  69. package/es/HiBreadcrumb/HiStepLabel.js +13 -4
  70. package/es/HiBreadcrumb/HiStepper.js +1 -1
  71. package/es/HiButton/HiButton.js +7 -0
  72. package/es/HiCell/CellIcon.js +5 -5
  73. package/es/HiCell/CellImage.js +13 -1
  74. package/es/HiCell/CellRate.js +6 -3
  75. package/es/HiCell/CellSentinel.js +7 -10
  76. package/es/HiCell/CellTextStyled.js +28 -1
  77. package/es/HiColoredLabel/HiColoredLabel.js +1 -1
  78. package/es/HiDatePicker/Caption.js +14 -10
  79. package/es/HiDatePicker/HiDatePicker.js +8 -3
  80. package/es/HiDatePicker/HiDateRangePicker.js +40 -28
  81. package/es/HiDatePicker/HiDateRangeSelector.js +69 -21
  82. package/es/HiDatePicker/ListPicker.js +1 -1
  83. package/es/HiDatePicker/NavBar.js +7 -1
  84. package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +30 -19
  85. package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +106 -0
  86. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +5 -5
  87. package/es/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
  88. package/es/HiDatePicker/Overlays/Overlay.js +16 -9
  89. package/es/HiDatePicker/Overlays/Overlay.spec.js +1 -0
  90. package/es/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
  91. package/es/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
  92. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +4 -6
  93. package/es/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
  94. package/es/HiDatePicker/hiLocaleUtils.js +131 -0
  95. package/es/HiDatePicker/stylesheet.js +32 -7
  96. package/es/HiDotsStepper/HiDot.js +66 -0
  97. package/es/HiDotsStepper/HiDotsStepper.js +73 -0
  98. package/es/HiExpansionPanel/HiExpansionPanel.js +1 -1
  99. package/es/HiForm/HiAddressField.js +134 -0
  100. package/es/HiForm/HiFormControl.js +2 -0
  101. package/es/HiForm/HiInput.js +3 -3
  102. package/es/HiForm/HiSlider.js +302 -0
  103. package/es/HiForm/HiUpload.js +158 -0
  104. package/es/HiForm/HiUploadField.js +140 -0
  105. package/es/HiForm/HiUploadInput.js +411 -0
  106. package/es/HiForm/index.js +2 -0
  107. package/es/HiMap/HiMap.js +290 -0
  108. package/es/HiMap/HiMapExpand.js +162 -0
  109. package/es/HiMap/index.js +2 -0
  110. package/es/HiNotice/HiKPI.js +196 -0
  111. package/es/HiNotice/HiKPINotice.js +78 -0
  112. package/es/HiNotice/index.js +2 -0
  113. package/es/HiPdfReader/HiPdfReader.js +214 -0
  114. package/es/HiPdfReader/index.js +1 -0
  115. package/es/HiPin/HiPin.js +1 -1
  116. package/es/HiRadio/HiRadio.js +55 -0
  117. package/es/HiRadio/index.js +1 -0
  118. package/es/HiSelect/HiSelect.js +68 -78
  119. package/es/HiSelect/HiSuggestSelect.js +30 -4
  120. package/es/HiSelect/SelectInput.js +9 -1
  121. package/es/HiSelectNew/HiNestedSelectContent.js +5 -1
  122. package/es/HiSelectNew/HiSelect.js +246 -162
  123. package/es/HiSelectNew/HiSelectContent.js +0 -7
  124. package/es/HiSelectNew/HiSelectInput.js +8 -9
  125. package/es/HiSelectableList/HiSelectableList.js +34 -6
  126. package/es/HiSelectableList/HiSelectableListItem.js +92 -40
  127. package/es/HiTable/HiCellBuilder.js +130 -123
  128. package/es/HiTable/HiTableHeader.js +14 -12
  129. package/es/HiTable/constants.js +1 -0
  130. package/es/index.js +9 -1
  131. package/es/utils/helpers.js +1 -1
  132. package/index.es.js +9 -1
  133. package/index.js +66 -2
  134. package/package.json +5 -2
  135. package/umd/hipay-material-ui.development.js +44450 -40930
  136. package/umd/hipay-material-ui.production.min.js +2 -2
  137. package/utils/helpers.js +1 -1
@@ -0,0 +1,290 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { withStyles } from '../styles';
4
+ import HiButton from '../HiButton';
5
+ import HiIcon from '../HiIcon';
6
+ import HiLoader from '../HiLoader';
7
+ const apiUrl = 'https://nominatim.openstreetmap.org/search?q='; // The original CSS can be found here : https://unpkg.com/leaflet@1.3.1/dist/leaflet.css
8
+
9
+ export const styles = theme => ({
10
+ map: {
11
+ height: '100%',
12
+ overflow: 'hidden',
13
+ // eslint-disable-next-line max-len
14
+ '& .leaflet-pane, & .leaflet-tile, & .leaflet-marker-icon, & .leaflet-marker-shadow, & .leaflet-tile-container, & .leaflet-pane > svg, & .leaflet-pane > canvas, & .leaflet-zoom-box, & .leaflet-image-layer, & .leaflet-layer': {
15
+ position: 'absolute',
16
+ left: 0,
17
+ top: 0
18
+ },
19
+ '& .leaflet-container': {
20
+ overflow: 'hidden',
21
+ height: '100%'
22
+ },
23
+ '& .leaflet-tile, & .leaflet-marker-icon, & .leaflet-marker-shadow': {
24
+ '-webkit-user-select': 'none',
25
+ '-moz-user-select': 'none',
26
+ userSelect: 'none',
27
+ '-webkit-user-drag': 'none'
28
+ },
29
+ '& .leaflet-control': {
30
+ display: 'none'
31
+ },
32
+ '& .map_marker': {
33
+ fill: theme.palette.primary.light
34
+ }
35
+ },
36
+ controlButtons: {
37
+ position: 'absolute',
38
+ bottom: 16,
39
+ right: 16
40
+ },
41
+ centerIcon: {
42
+ fontSize: 14
43
+ },
44
+ centerButtonContainer: {
45
+ backgroundColor: theme.palette.global.background1,
46
+ borderRadius: 3,
47
+ padding: 3,
48
+ fontFamily: theme.typography.fontFamily,
49
+ boxShadow: '1px 1px 5px rgba(0, 0, 0, .16)',
50
+ color: theme.palette.neutral.normal,
51
+ '&>button:first-child': {
52
+ borderBottom: `1px solid ${theme.palette.neutral.normal}`
53
+ }
54
+ },
55
+ centerButton: {
56
+ color: theme.palette.neutral.normal,
57
+ padding: '1px !important',
58
+ height: 26,
59
+ minHeight: 26,
60
+ width: 26,
61
+ minWidth: 26
62
+ },
63
+ zoomButtons: {
64
+ backgroundColor: theme.palette.global.background1,
65
+ borderRadius: 3,
66
+ padding: 3,
67
+ fontFamily: theme.typography.fontFamily,
68
+ boxShadow: '1px 1px 5px rgba(0, 0, 0, .16)',
69
+ color: theme.palette.neutral.normal,
70
+ '&>button:first-child': {
71
+ borderBottom: `1px solid ${theme.palette.neutral.normal}`
72
+ }
73
+ },
74
+ zoomButton: {
75
+ paddingTop: '0px !important',
76
+ paddingBottom: 0,
77
+ paddingRight: 6,
78
+ paddingLeft: 6,
79
+ minWidth: 0,
80
+ minHeight: 0,
81
+ borderRadius: 0,
82
+ display: 'block',
83
+ fontSize: 24,
84
+ fontWeight: 'bold',
85
+ lineHeight: '26px',
86
+ '&>span': {
87
+ width: 14
88
+ }
89
+ }
90
+ });
91
+ let L;
92
+ let Map;
93
+ let TileLayer;
94
+ let Marker;
95
+
96
+ var _ref = React.createElement(TileLayer, {
97
+ url: "http://{s}.tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png"
98
+ });
99
+
100
+ var _ref2 = React.createElement(HiLoader, {
101
+ loading: true
102
+ });
103
+
104
+ class HiMap extends React.PureComponent {
105
+ constructor(props) {
106
+ super(props);
107
+ this.mounted = false;
108
+ this.state = {
109
+ lat: 0,
110
+ lng: 0,
111
+ notFound: false,
112
+ loaded: false,
113
+ zoom: 16
114
+ };
115
+ this.handleClickZoomIn = this.handleClickZoomIn.bind(this);
116
+ this.handleScrollZoom = this.handleScrollZoom.bind(this);
117
+ this.handleClickZoomOut = this.handleClickZoomOut.bind(this);
118
+ this.handleCenter = this.handleCenter.bind(this);
119
+ } // Loads the libraries once the component mounted to avoid error caused by server-cli rendering.
120
+
121
+
122
+ componentDidMount() {
123
+ this.mounted = true;
124
+ this.findCoords();
125
+ /* eslint-disable */
126
+
127
+ L = require('leaflet');
128
+ Map = require('react-leaflet').Map;
129
+ Marker = require('react-leaflet').Marker;
130
+ TileLayer = require('react-leaflet').TileLayer;
131
+ /* eslint-enable */
132
+ }
133
+
134
+ componentWillUnmount() {
135
+ this.mounted = false;
136
+ }
137
+
138
+ handleScrollZoom(event) {
139
+ this.setState({
140
+ zoom: event.zoom
141
+ });
142
+ }
143
+
144
+ handleClickZoomIn() {
145
+ this.setState(prevState => {
146
+ return {
147
+ zoom: prevState.zoom + 1
148
+ };
149
+ });
150
+ }
151
+
152
+ handleClickZoomOut() {
153
+ this.setState(prevState => {
154
+ return {
155
+ zoom: prevState.zoom - 1
156
+ };
157
+ });
158
+ }
159
+
160
+ handleCenter() {
161
+ // trick to center the map.
162
+ this.setState(prevState => {
163
+ return {
164
+ lat: prevState.lat + 0.0000000001
165
+ };
166
+ });
167
+ } // Call to the geocoding API.
168
+
169
+
170
+ findCoords() {
171
+ fetch(`${apiUrl}${this.props.address}&format=jsonv2&limit=5&bounded=1&dedupe=1&namedetails=1`).then(result => result.json()).then(response => {
172
+ if (this.mounted) {
173
+ if (response.length !== 0) {
174
+ this.setState({
175
+ lat: parseFloat(response[0].lat),
176
+ lng: parseFloat(response[0].lon),
177
+ notFound: false,
178
+ loaded: true
179
+ });
180
+ } else {
181
+ this.setState({
182
+ notFound: true
183
+ });
184
+ this.props.onAddressNotFound();
185
+ }
186
+ }
187
+ });
188
+ }
189
+
190
+ render() {
191
+ const {
192
+ zoom,
193
+ lng,
194
+ lat,
195
+ notFound,
196
+ loaded
197
+ } = this.state;
198
+ const {
199
+ translations,
200
+ classes
201
+ } = this.props;
202
+ const position = [lat, lng];
203
+ let element;
204
+ let myIcon;
205
+ if (notFound) element = translations.notFound;
206
+
207
+ if (loaded) {
208
+ myIcon = L.divIcon({
209
+ html: '<svg x="0px" y="0px" viewBox="0 0 365 560" enable-background="new 0 0 365 560" xml:space="preserve">\n' + '<path class="map_marker" ' + 'd="M182.9,551.7c0,0.1,0.2,0.3,0.2,0.3S358.3,283,358.3,194.6c0-130.1-88.8-186.7-175.4-186.9 ' + 'C96.3,7.9,7.5,64.5,7.5,194.6c0,88.4,175.3,357.4,175.3,357.4S182.9,551.7,182.9,551.7z' + ' M122.2,187.2c0-33.6,27.2-60.8,60.8-60.8 ' + 'c33.6,0,60.8,27.2,60.8,60.8S216.5,248,182.9,248C149.4,248,122.2,220.8,122.2,187.2z"/>\n' + '</svg>',
210
+ iconSize: [24, 36],
211
+ iconAnchor: [11, 36]
212
+ });
213
+ element = React.createElement(Map, {
214
+ zoom: zoom,
215
+ center: position,
216
+ className: classes.map,
217
+ onViewportChange: this.handleScrollZoom
218
+ }, _ref, React.createElement(Marker, {
219
+ position: position,
220
+ icon: myIcon
221
+ }), React.createElement("div", {
222
+ className: classes.controlButtons
223
+ }, React.createElement("div", {
224
+ className: classes.centerButtonContainer
225
+ }, React.createElement(HiButton, {
226
+ className: classes.centerButton,
227
+ onClick: this.handleCenter
228
+ }, React.createElement(HiIcon, {
229
+ className: classes.centerIcon,
230
+ icon: 'my_location',
231
+ size: 24
232
+ }))), React.createElement("div", {
233
+ className: classes.zoomButtons
234
+ }, React.createElement(HiButton, {
235
+ onClick: this.handleClickZoomIn,
236
+ className: classes.zoomButton
237
+ }, "+"), React.createElement(HiButton, {
238
+ onClick: this.handleClickZoomOut,
239
+ className: classes.zoomButton
240
+ }, "-"))));
241
+ } else {
242
+ element = React.createElement("div", {
243
+ style: {
244
+ top: '50%',
245
+ left: '50%',
246
+ position: 'absolute'
247
+ }
248
+ }, _ref2);
249
+ }
250
+
251
+ return React.createElement("div", {
252
+ style: {
253
+ height: '352px',
254
+ width: '100%',
255
+ position: 'relative'
256
+ }
257
+ }, element);
258
+ }
259
+
260
+ }
261
+
262
+ HiMap.defaultProps = {
263
+ translations: {
264
+ notFound: 'Address not found'
265
+ }
266
+ };
267
+ HiMap.propTypes = process.env.NODE_ENV !== "production" ? {
268
+ /**
269
+ * The address to see in the Map component.
270
+ */
271
+ address: PropTypes.string.isRequired,
272
+
273
+ /**
274
+ * Useful to extend the style applied to components.
275
+ */
276
+ classes: PropTypes.object.isRequired,
277
+
278
+ /**
279
+ * Function to tell the parent composant that the address was not found by the API.
280
+ */
281
+ onAddressNotFound: PropTypes.func,
282
+
283
+ /**
284
+ * Traductions
285
+ */
286
+ translations: PropTypes.object
287
+ } : {};
288
+ export default withStyles(styles, {
289
+ name: 'HmuiHiMap'
290
+ })(HiMap);
@@ -0,0 +1,162 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread";
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import classNames from 'classnames';
5
+ import ExpansionPanel from '@material-ui/core/ExpansionPanel';
6
+ import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
7
+ import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
8
+ import { withStyles } from '../styles';
9
+ import HiMap from './HiMap';
10
+ import HiIcon from '../HiIcon/HiIcon';
11
+
12
+ const styles = theme => ({
13
+ column: {
14
+ flexBasis: '33.33%'
15
+ },
16
+ root: {
17
+ flexGrow: 1,
18
+ boxShadow: 'none'
19
+ },
20
+ imgListItem: {
21
+ width: 24,
22
+ height: 'auto',
23
+ marginRight: 8,
24
+ verticalAlign: 'middle'
25
+ },
26
+ expandMoreIcon: {},
27
+ disabledIcon: {
28
+ color: theme.palette.action.disabled
29
+ },
30
+ panelSummaryExpanded: {
31
+ minHeight: 0
32
+ },
33
+ panelSummary: {
34
+ '&>div:first-child': {
35
+ margin: '12px 0'
36
+ }
37
+ },
38
+ expanded: {
39
+ '& $expandMoreIcon': {
40
+ transform: 'translateY(-50%) rotate(0) !important',
41
+ color: theme.palette.primary.light
42
+ },
43
+ minHeight: '0 !important'
44
+ },
45
+ heading: _objectSpread({}, theme.typography.b1, {
46
+ margin: 0,
47
+ fontSize: 15,
48
+ lineHeight: '24px'
49
+ }),
50
+ secondaryHeading: _objectSpread({}, theme.typography.b3, {
51
+ margin: 0,
52
+ fontSize: 15,
53
+ lineHeight: '24px',
54
+ float: 'left',
55
+ '&>svg': {
56
+ fontSize: 18,
57
+ marginLeft: 3,
58
+ marginBottom: -5
59
+ }
60
+ })
61
+ });
62
+
63
+ class HiMapExpand extends React.PureComponent {
64
+ constructor(props) {
65
+ super(props);
66
+ this.state = {
67
+ addressNotFound: false,
68
+ expanded: false
69
+ };
70
+ this.handleAddressNotFound = this.handleAddressNotFound.bind(this);
71
+ this.handleExpand = this.handleExpand.bind(this);
72
+ }
73
+
74
+ handleExpand() {
75
+ this.setState(prevState => ({
76
+ expanded: !prevState.addressNotFound && !prevState.expanded
77
+ }));
78
+ }
79
+
80
+ handleAddressNotFound() {
81
+ this.setState({
82
+ addressNotFound: true
83
+ });
84
+ }
85
+
86
+ render() {
87
+ const {
88
+ classes,
89
+ address,
90
+ countryFlagPath
91
+ } = this.props;
92
+ const {
93
+ addressNotFound,
94
+ expanded
95
+ } = this.state;
96
+ const flag = countryFlagPath ? React.createElement("img", {
97
+ src: countryFlagPath,
98
+ className: classes.imgListItem,
99
+ alt: 'country flag'
100
+ }) : '';
101
+ return React.createElement(ExpansionPanel, {
102
+ className: classes.root,
103
+ defaultExpanded: false,
104
+ expanded: expanded,
105
+ onChange: this.handleExpand
106
+ }, React.createElement(ExpansionPanelSummary, {
107
+ classes: {
108
+ root: classes.panelSummary,
109
+ expanded: classes.expanded,
110
+ expandIcon: classes.expandMoreIcon
111
+ },
112
+ expandIcon: React.createElement(HiIcon, {
113
+ icon: 'place',
114
+ style: {
115
+ position: 'relative',
116
+ top: 2,
117
+ marginRight: 5
118
+ },
119
+ className: classNames({
120
+ [classes.disabledIcon]: addressNotFound
121
+ })
122
+ })
123
+ }, React.createElement("div", {
124
+ className: classes.column
125
+ }, React.createElement("p", {
126
+ className: classes.secondaryHeading
127
+ }, "Adresse")), React.createElement("div", null, React.createElement("p", {
128
+ className: classes.heading
129
+ }, flag, address))), React.createElement(ExpansionPanelDetails, {
130
+ style: {
131
+ padding: 0
132
+ }
133
+ }, React.createElement(HiMap, {
134
+ address: address,
135
+ onAddressNotFound: this.handleAddressNotFound
136
+ })));
137
+ }
138
+
139
+ }
140
+
141
+ HiMapExpand.defaultProps = {
142
+ countryFlagPath: ''
143
+ };
144
+ HiMapExpand.propTypes = process.env.NODE_ENV !== "production" ? {
145
+ /**
146
+ * The address to see in the Map component.
147
+ */
148
+ address: PropTypes.string.isRequired,
149
+
150
+ /**
151
+ * Useful to extend the style applied to components.
152
+ */
153
+ classes: PropTypes.object.isRequired,
154
+
155
+ /**
156
+ * The path to the country flag image.
157
+ */
158
+ countryFlagPath: PropTypes.string
159
+ } : {};
160
+ export default withStyles(styles, {
161
+ name: 'HmuiHiMapExpand'
162
+ })(HiMapExpand);
@@ -0,0 +1,2 @@
1
+ export { default } from './HiMap';
2
+ export { default as HiMapExpand } from './HiMapExpand';
@@ -0,0 +1,196 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import classNames from 'classnames';
4
+ import { withStyles } from '../styles';
5
+ import ButtonBase from '@material-ui/core/ButtonBase';
6
+ export const styles = theme => ({
7
+ root: {
8
+ background: theme.palette.background3,
9
+ height: 104,
10
+ width: 136,
11
+ padding: '0px 8px',
12
+ margin: 8,
13
+ display: 'flex',
14
+ textAlign: 'center',
15
+ flexDirection: 'column',
16
+ alignItems: 'center',
17
+ fontFamily: theme.typography.fontFamily
18
+ },
19
+ error: {
20
+ boxShadow: '0px 2px 4px 0px rgba(213, 0, 0, 0.24)',
21
+ '&:hover': {
22
+ boxShadow: '0px 3px 5px 0px rgba(213, 0, 0, 0.32)'
23
+ }
24
+ },
25
+ warning: {
26
+ boxShadow: '0px 2px 4px 0px rgba(249, 148, 8, 0.32)',
27
+ '&:hover': {
28
+ boxShadow: '0px 3px 5px 0px rgba(249, 148, 8, 0.40)'
29
+ }
30
+ },
31
+ inherit: {
32
+ boxShadow: '0px 1px 3px 0px rgba(0, 0, 0, 0.16)',
33
+ '&:hover': {
34
+ boxShadow: '0px 3px 5px 0px rgba(0, 0, 0, 0.24)'
35
+ }
36
+ },
37
+ positive: {
38
+ boxShadow: '0px 1px 3px 0px rgba(0, 175, 1, 0.36)',
39
+ '&:hover': {
40
+ boxShadow: '0px 3px 5px 0px rgba(0, 175, 1, 0.44)'
41
+ }
42
+ },
43
+ active: {
44
+ background: theme.palette.background2,
45
+ boxShadow: 'none'
46
+ },
47
+ body: {
48
+ height: '100%',
49
+ margin: 0,
50
+ display: 'inline-grid',
51
+ alignItems: 'center',
52
+ fontSize: 20,
53
+ fontWeight: theme.typography.fontWeightLight
54
+ },
55
+ title: {
56
+ height: '100%',
57
+ maxHeight: 16,
58
+ maxWidth: '100%',
59
+ margin: '7px 0px',
60
+ whiteSpace: 'nowrap',
61
+ overflow: 'hidden',
62
+ fontSize: 14,
63
+ fontWeight: theme.typography.fontWeightLight
64
+ },
65
+ subtitle: {
66
+ height: '100%',
67
+ maxHeight: 28,
68
+ margin: '2px 0px',
69
+ maxWidth: '100%',
70
+ color: theme.palette.neutral.main,
71
+ fontSize: 11,
72
+ lineHeight: '13px',
73
+ fontWeight: theme.typography.fontWeightMedium
74
+ },
75
+ minify: {
76
+ height: 72
77
+ }
78
+ });
79
+
80
+ class HiKPI extends React.Component {
81
+ constructor(props) {
82
+ super(props);
83
+
84
+ this.handleClick = id => () => {
85
+ this.props.onClick(id);
86
+ };
87
+
88
+ this.handleClick = this.handleClick.bind(this);
89
+ }
90
+
91
+ render() {
92
+ const {
93
+ classes,
94
+ minify,
95
+ bodyMinify,
96
+ active,
97
+ title,
98
+ body,
99
+ subtitle,
100
+ color,
101
+ id,
102
+ tooltip,
103
+ disable
104
+ } = this.props;
105
+ const rootclass = classNames(classes.root, {
106
+ [classes.inherit]: color === 'inherit' && !disable,
107
+ [classes.warning]: color === 'warning' && !disable,
108
+ [classes.error]: color === 'error' && !disable,
109
+ [classes.positive]: color === 'positive' && !disable,
110
+ [classes.active]: active,
111
+ [classes.minify]: minify
112
+ });
113
+ return React.createElement(ButtonBase, {
114
+ className: rootclass,
115
+ onClick: !disable ? this.handleClick(id) : undefined,
116
+ title: tooltip
117
+ }, title && React.createElement("h3", {
118
+ className: classes.title
119
+ }, title), React.createElement("div", {
120
+ className: classes.body
121
+ }, minify && bodyMinify ? bodyMinify : body), subtitle && minify === false && React.createElement("div", {
122
+ className: classes.subtitle
123
+ }, subtitle));
124
+ }
125
+
126
+ }
127
+
128
+ HiKPI.defaultProps = {
129
+ active: false,
130
+ minify: false
131
+ };
132
+ HiKPI.propTypes = process.env.NODE_ENV !== "production" ? {
133
+ /**
134
+ * Extension du style appliqué au composant
135
+ */
136
+ active: PropTypes.bool,
137
+
138
+ /**
139
+ * Corps du KPI
140
+ */
141
+ body: PropTypes.any.isRequired,
142
+
143
+ /**
144
+ * Version minifiée du composant
145
+ */
146
+ bodyMinify: PropTypes.any,
147
+
148
+ /**
149
+ * Fonction appelée au clic sur le KPI
150
+ */
151
+ classes: PropTypes.object,
152
+
153
+ /**
154
+ * KPI est-il actif ?
155
+ */
156
+ color: PropTypes.oneOf(['inherit', 'warning', 'error', 'positive']),
157
+
158
+ /**
159
+ * Titre du KPI
160
+ */
161
+ disable: PropTypes.bool,
162
+
163
+ /**
164
+ * KPI id
165
+ */
166
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
167
+
168
+ /**
169
+ * Corps minifié du KPI si nécessaire
170
+ */
171
+ minify: PropTypes.bool,
172
+
173
+ /**
174
+ * Sous-titre du KPI
175
+ */
176
+ onClick: PropTypes.func,
177
+
178
+ /**
179
+ * Type du KPI (ancré ou normal : ancré permet action de clic)
180
+ */
181
+ subtitle: PropTypes.any,
182
+
183
+ /**
184
+ * Couleur de l'ombre du KPI
185
+ */
186
+ title: PropTypes.string,
187
+
188
+ /**
189
+ * Contenu du tooltip (facultatif)
190
+ */
191
+ tooltip: PropTypes.any
192
+ } : {};
193
+ export default withStyles(styles, {
194
+ hiComponent: true,
195
+ name: 'HmuiHiKPI'
196
+ })(HiKPI);