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

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 (128) hide show
  1. package/CHANGELOG.md +57 -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 +28 -4
  10. package/HiCell/CellNumeric.js +1 -2
  11. package/HiCell/CellRate.js +6 -3
  12. package/HiCell/CellSentinel.js +7 -10
  13. package/HiCell/CellSentinelScore.js +4 -4
  14. package/HiCell/CellTextStyled.js +99 -0
  15. package/HiCell/index.js +9 -1
  16. package/HiChip/HiChip.js +1 -0
  17. package/HiDatePicker/Caption.js +8 -9
  18. package/HiDatePicker/HiDateRangePicker.js +37 -19
  19. package/HiDatePicker/HiDateRangeSelector.js +24 -22
  20. package/HiDatePicker/Overlays/CustomOverlayLayout.js +26 -17
  21. package/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
  22. package/HiDatePicker/Overlays/Overlay.js +15 -8
  23. package/HiDatePicker/Overlays/Overlay.spec.js +1 -0
  24. package/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
  25. package/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
  26. package/HiDatePicker/Overlays/YearPickerOverlay.js +2 -4
  27. package/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
  28. package/HiDatePicker/stylesheet.js +3 -2
  29. package/HiDotsStepper/HiDot.js +108 -0
  30. package/HiDotsStepper/HiDotsStepper.js +121 -0
  31. package/HiExpansionPanel/HiExpansionPanel.js +1 -1
  32. package/HiForm/HiAddressField.js +176 -0
  33. package/HiForm/HiSlider.js +352 -0
  34. package/HiForm/HiUpload.js +204 -0
  35. package/HiForm/HiUploadField.js +182 -0
  36. package/HiForm/HiUploadInput.js +459 -0
  37. package/HiForm/index.js +16 -0
  38. package/HiMap/HiMap.js +345 -0
  39. package/HiMap/HiMapExpand.js +210 -0
  40. package/HiMap/index.js +23 -0
  41. package/HiNotice/HiKPI.js +238 -0
  42. package/HiNotice/HiKPINotice.js +93 -0
  43. package/HiNotice/index.js +23 -0
  44. package/HiPdfReader/HiPdfReader.js +269 -0
  45. package/HiPdfReader/index.js +15 -0
  46. package/HiRadio/HiRadio.js +74 -0
  47. package/HiRadio/index.js +15 -0
  48. package/HiSelect/HiSelect.js +73 -84
  49. package/HiSelect/HiSuggestSelect.js +32 -5
  50. package/HiSelect/SelectInput.js +5 -0
  51. package/HiSelectNew/HiNestedSelectContent.js +5 -1
  52. package/HiSelectNew/HiSelect.js +174 -137
  53. package/HiSelectNew/HiSelectContent.js +0 -8
  54. package/HiSelectNew/HiSelectInput.js +8 -9
  55. package/HiSelectableList/HiSelectableList.js +32 -4
  56. package/HiSelectableList/HiSelectableListItem.js +62 -24
  57. package/HiTable/HiCellBuilder.js +42 -32
  58. package/HiTable/HiTableHeader.js +28 -21
  59. package/HiTable/constants.js +3 -1
  60. package/README.md +249 -98
  61. package/es/HiBreadcrumb/HiBreadcrumb.js +14 -4
  62. package/es/HiBreadcrumb/HiStep.js +4 -1
  63. package/es/HiBreadcrumb/HiStepContent.js +0 -1
  64. package/es/HiBreadcrumb/HiStepLabel.js +13 -4
  65. package/es/HiBreadcrumb/HiStepper.js +1 -1
  66. package/es/HiButton/HiButton.js +7 -0
  67. package/es/HiCell/CellIcon.js +5 -5
  68. package/es/HiCell/CellImage.js +25 -2
  69. package/es/HiCell/CellNumeric.js +1 -2
  70. package/es/HiCell/CellRate.js +6 -3
  71. package/es/HiCell/CellSentinel.js +7 -10
  72. package/es/HiCell/CellSentinelScore.js +4 -4
  73. package/es/HiCell/CellTextStyled.js +84 -0
  74. package/es/HiCell/index.js +2 -1
  75. package/es/HiChip/HiChip.js +1 -0
  76. package/es/HiDatePicker/Caption.js +7 -9
  77. package/es/HiDatePicker/HiDateRangePicker.js +41 -25
  78. package/es/HiDatePicker/HiDateRangeSelector.js +24 -22
  79. package/es/HiDatePicker/ListPicker.js +1 -1
  80. package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +30 -19
  81. package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +2 -2
  82. package/es/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
  83. package/es/HiDatePicker/Overlays/Overlay.js +16 -9
  84. package/es/HiDatePicker/Overlays/Overlay.spec.js +1 -0
  85. package/es/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
  86. package/es/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
  87. package/es/HiDatePicker/Overlays/YearPickerOverlay.js +2 -4
  88. package/es/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
  89. package/es/HiDatePicker/stylesheet.js +3 -2
  90. package/es/HiDotsStepper/HiDot.js +66 -0
  91. package/es/HiDotsStepper/HiDotsStepper.js +73 -0
  92. package/es/HiExpansionPanel/HiExpansionPanel.js +1 -1
  93. package/es/HiForm/HiAddressField.js +134 -0
  94. package/es/HiForm/HiSlider.js +302 -0
  95. package/es/HiForm/HiUpload.js +158 -0
  96. package/es/HiForm/HiUploadField.js +140 -0
  97. package/es/HiForm/HiUploadInput.js +411 -0
  98. package/es/HiForm/index.js +2 -0
  99. package/es/HiMap/HiMap.js +290 -0
  100. package/es/HiMap/HiMapExpand.js +162 -0
  101. package/es/HiMap/index.js +2 -0
  102. package/es/HiNotice/HiKPI.js +196 -0
  103. package/es/HiNotice/HiKPINotice.js +77 -0
  104. package/es/HiNotice/index.js +2 -0
  105. package/es/HiPdfReader/HiPdfReader.js +214 -0
  106. package/es/HiPdfReader/index.js +1 -0
  107. package/es/HiRadio/HiRadio.js +55 -0
  108. package/es/HiRadio/index.js +1 -0
  109. package/es/HiSelect/HiSelect.js +68 -78
  110. package/es/HiSelect/HiSuggestSelect.js +27 -6
  111. package/es/HiSelect/SelectInput.js +5 -0
  112. package/es/HiSelectNew/HiNestedSelectContent.js +5 -1
  113. package/es/HiSelectNew/HiSelect.js +156 -120
  114. package/es/HiSelectNew/HiSelectContent.js +0 -7
  115. package/es/HiSelectNew/HiSelectInput.js +8 -9
  116. package/es/HiSelectableList/HiSelectableList.js +28 -6
  117. package/es/HiSelectableList/HiSelectableListItem.js +71 -24
  118. package/es/HiTable/HiCellBuilder.js +140 -136
  119. package/es/HiTable/HiTableHeader.js +26 -18
  120. package/es/HiTable/constants.js +1 -0
  121. package/es/index.js +7 -0
  122. package/es/utils/helpers.js +1 -1
  123. package/index.es.js +8 -1
  124. package/index.js +57 -1
  125. package/package.json +6 -3
  126. package/umd/hipay-material-ui.development.js +42114 -35120
  127. package/umd/hipay-material-ui.production.min.js +2 -2
  128. package/utils/helpers.js +1 -1
@@ -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
+ * KPI id
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
+ * Corps du KPI
165
+ */
166
+ id: 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);
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { withStyles } from '@material-ui/core/styles';
4
+ import HiKPI from './HiKPI';
5
+
6
+ const styles = () => ({
7
+ container: {
8
+ minWidth: 230,
9
+ width: '100%',
10
+ display: 'flex',
11
+ flexWrap: 'wrap',
12
+ justifyContent: 'center'
13
+ }
14
+ });
15
+
16
+ const HiKPINotice = ({
17
+ classes,
18
+ kpis,
19
+ activeKpis,
20
+ minify,
21
+ onClickOnKPI
22
+ }) => {
23
+ return React.createElement("div", {
24
+ className: classes.container
25
+ }, kpis.map(kpi => {
26
+ return React.createElement(HiKPI, {
27
+ key: kpi.id,
28
+ id: kpi.id,
29
+ type: kpi.type,
30
+ color: kpi.color,
31
+ title: kpi.title,
32
+ body: kpi.body,
33
+ bodyMinify: kpi.bodyMinify,
34
+ subtitle: kpi.subtitle,
35
+ tooltip: kpi.tooltip,
36
+ onClick: onClickOnKPI,
37
+ active: !!activeKpis.includes(kpi.id),
38
+ minify: minify,
39
+ disable: kpi.disable
40
+ });
41
+ }));
42
+ };
43
+
44
+ HiKPINotice.propTypes = process.env.NODE_ENV !== "production" ? {
45
+ /**
46
+ * Extension du style appliqué au composant
47
+ */
48
+ activeKpis: PropTypes.array,
49
+
50
+ /**
51
+ * Liste des KPIs
52
+ */
53
+ classes: PropTypes.object,
54
+
55
+ /**
56
+ * Fonction appelée au clic sur un KPI
57
+ */
58
+ kpis: PropTypes.array.isRequired,
59
+
60
+ /**
61
+ * Liste des KPIS actifs
62
+ */
63
+ minify: PropTypes.bool,
64
+
65
+ /**
66
+ * Minifie les KPIs si vrai
67
+ */
68
+ onClickOnKPI: PropTypes.func
69
+ } : {};
70
+ HiKPINotice.defaultProps = {
71
+ activeKpis: [],
72
+ minify: false
73
+ };
74
+ export default withStyles(styles, {
75
+ hiComponent: true,
76
+ name: 'HmuiHiKPINotice'
77
+ })(HiKPINotice);
@@ -0,0 +1,2 @@
1
+ export { default as HiKPI } from './HiKPI';
2
+ export { default as HiKPINotice } from './HiKPINotice';
@@ -0,0 +1,214 @@
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 HiButton from '../HiButton';
6
+ import HiIcon from '../HiIcon'; // import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
7
+ // import ChevronRightIcon from '@material-ui/icons/ChevronRight/';
8
+
9
+ import CircularProgress from '@material-ui/core/CircularProgress/';
10
+ import { withStyles } from '../styles';
11
+ export const styles = theme => ({
12
+ root: {
13
+ position: 'relative'
14
+ },
15
+ pageNumber: {
16
+ position: 'absolute',
17
+ bottom: 16,
18
+ left: -24,
19
+ backgroundColor: '#FFFFFF',
20
+ borderRadius: 4,
21
+ paddingTop: 7,
22
+ paddingBottom: 7,
23
+ paddingRight: 8,
24
+ paddingLeft: 8,
25
+ fontSize: 15,
26
+ fontFamily: theme.typography.fontFamily,
27
+ boxShadow: '1px 1px 5px rgba(0, 0, 0, .16)',
28
+ color: '#737373'
29
+ },
30
+ pagesNavigation: {
31
+ position: 'absolute',
32
+ top: 16,
33
+ right: -30,
34
+ backgroundColor: '#FFFFFF',
35
+ borderRadius: 3,
36
+ paddingTop: 4,
37
+ paddingBottom: 4,
38
+ paddingRight: 3,
39
+ paddingLeft: 3,
40
+ fontFamily: theme.typography.fontFamily,
41
+ boxShadow: '1px 1px 5px rgba(0, 0, 0, .16)',
42
+ color: '#737373',
43
+ '&>button:first-child': {
44
+ marginRight: 6
45
+ }
46
+ },
47
+ navigationButton: {
48
+ padding: 0,
49
+ minWidth: 0,
50
+ minHeight: 0
51
+ }
52
+ }); // Constantes utilisées pour le redimentionnement du PDF (format mobile par exemple)
53
+
54
+ const maxWindowWidth = 900;
55
+ const maxPdfWidth = 600;
56
+ let Document;
57
+ let Page;
58
+
59
+ var _ref = React.createElement(CircularProgress, null);
60
+
61
+ var _ref2 = React.createElement(HiIcon, {
62
+ icon: "chevron_left"
63
+ });
64
+
65
+ var _ref3 = React.createElement(HiIcon, {
66
+ icon: "chevron_right"
67
+ });
68
+
69
+ class HiPdfReader extends React.PureComponent {
70
+ constructor(...args) {
71
+ super(...args);
72
+ this.state = {
73
+ numPages: null,
74
+ pageNumber: 1,
75
+ error: false,
76
+ width: 600
77
+ };
78
+
79
+ this.handleLoadSuccess = ({
80
+ numPages
81
+ }) => {
82
+ this.setState({
83
+ numPages,
84
+ error: false
85
+ });
86
+ };
87
+
88
+ this.handleLoadError = () => {
89
+ this.setState({
90
+ error: true
91
+ });
92
+ };
93
+
94
+ this.handleClickNextPage = () => {
95
+ this.setState(prevState => ({
96
+ pageNumber: prevState.pageNumber + 1
97
+ }));
98
+ };
99
+
100
+ this.handleClickPreviousPage = () => {
101
+ this.setState(prevState => ({
102
+ pageNumber: prevState.pageNumber - 1
103
+ }));
104
+ };
105
+ }
106
+
107
+ componentDidMount() {
108
+ this.updateDimensions();
109
+ window.addEventListener('resize', this.updateDimensions.bind(this));
110
+ /* eslint-disable */
111
+
112
+ Document = require('react-pdf').Document;
113
+ Page = require('react-pdf').Page;
114
+ /* eslint-enable */
115
+
116
+ this.forceUpdate();
117
+ }
118
+
119
+ componentWillUnmount() {
120
+ window.removeEventListener('resize', this.updateDimensions.bind(this));
121
+ } // Fonction appelée une fois le pdf correctement chargé
122
+
123
+
124
+ // Calculate & Update state of new dimensions
125
+ updateDimensions() {
126
+ if (window.innerWidth < maxWindowWidth) {
127
+ const updateWidth = Math.round(window.innerWidth * 100 / maxWindowWidth / 100 * maxPdfWidth);
128
+ this.setState({
129
+ width: updateWidth
130
+ });
131
+ } else {
132
+ this.setState({
133
+ width: maxPdfWidth
134
+ });
135
+ }
136
+ } // Render
137
+
138
+
139
+ render() {
140
+ const {
141
+ pageNumber,
142
+ numPages,
143
+ error
144
+ } = this.state;
145
+
146
+ const _this$props = this.props,
147
+ {
148
+ classes,
149
+ file,
150
+ displayPagination,
151
+ displayNavigationButtons
152
+ } = _this$props,
153
+ props = _objectWithoutProperties(_this$props, ["classes", "file", "displayPagination", "displayNavigationButtons"]);
154
+
155
+ if (!Document || !Page) return null;
156
+ return React.createElement("div", {
157
+ className: classes.root
158
+ }, React.createElement(Document, _extends({
159
+ className: classes.style,
160
+ file: file,
161
+ onLoadSuccess: this.handleLoadSuccess,
162
+ onLoadError: this.handleLoadError,
163
+ loading: _ref
164
+ }, props), React.createElement(Page, {
165
+ pageNumber: pageNumber,
166
+ renderAnnotations: false,
167
+ renderTextLayer: false,
168
+ width: this.state.width
169
+ })), !error && numPages > 1 && displayPagination && React.createElement("span", {
170
+ className: classes.pageNumber
171
+ }, "Page ", pageNumber, " sur ", numPages), !error && numPages > 1 && displayNavigationButtons && React.createElement("span", {
172
+ className: classes.pagesNavigation
173
+ }, React.createElement(HiButton, {
174
+ onClick: this.handleClickPreviousPage,
175
+ disabled: pageNumber === 1,
176
+ className: classes.navigationButton
177
+ }, _ref2), React.createElement(HiButton, {
178
+ onClick: this.handleClickNextPage,
179
+ disabled: pageNumber === numPages,
180
+ className: classes.navigationButton
181
+ }, _ref3)));
182
+ }
183
+
184
+ }
185
+
186
+ HiPdfReader.defaultProps = {
187
+ displayPagination: true,
188
+ displayNavigationButtons: true
189
+ };
190
+ HiPdfReader.propTypes = process.env.NODE_ENV !== "production" ? {
191
+ /**
192
+ * Surcharge les classes du composant
193
+ */
194
+ classes: PropTypes.object,
195
+
196
+ /**
197
+ * On affiche les boutons de navigation entre les pages si le PDF contient plusieurs pages
198
+ */
199
+ displayNavigationButtons: PropTypes.bool,
200
+
201
+ /**
202
+ * On affiche la pagination si le PDF contient plusieurs pages
203
+ */
204
+ displayPagination: PropTypes.bool,
205
+
206
+ /**
207
+ * Chemin vers le fichier PDF
208
+ */
209
+ file: PropTypes.string.isRequired
210
+ } : {};
211
+ export default withStyles(styles, {
212
+ name: 'HmuiHiPdfReader',
213
+ index: 51
214
+ })(HiPdfReader);
@@ -0,0 +1 @@
1
+ export { default } from './HiPdfReader';
@@ -0,0 +1,55 @@
1
+ // @inheritedComponent Radio
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { withStyles } from '../styles';
5
+ import Radio from '@material-ui/core/Radio';
6
+ export const styles = theme => ({
7
+ checked: {
8
+ color: theme.palette.neutral.main
9
+ },
10
+ disabled: {
11
+ color: theme.palette.action.disabled
12
+ }
13
+ });
14
+
15
+ const HiRadio = ({
16
+ checked,
17
+ classes,
18
+ className,
19
+ color,
20
+ disabled,
21
+ label,
22
+ onChange,
23
+ value
24
+ }) => {
25
+ const hcolor = ['positive', 'negative', 'middle', 'neutral', 'inherit'].includes(color) ? 'default' : color;
26
+ return React.createElement(Radio, {
27
+ className: className,
28
+ classes: {
29
+ checked: classes.checked,
30
+ disabled: classes.disabled
31
+ },
32
+ checked: checked,
33
+ color: hcolor,
34
+ label: label,
35
+ onChange: onChange,
36
+ disabled: disabled,
37
+ value: value
38
+ });
39
+ };
40
+
41
+ HiRadio.propTypes = process.env.NODE_ENV !== "production" ? {
42
+ checked: PropTypes.bool,
43
+ classes: PropTypes.object,
44
+ className: PropTypes.string,
45
+ color: PropTypes.oneOf(['inherit', 'primary', 'secondary', 'positive', 'negative', 'middle', 'neutral']),
46
+ disabled: PropTypes.bool,
47
+ label: PropTypes.string,
48
+ onChange: PropTypes.func,
49
+ value: PropTypes.string
50
+ } : {};
51
+ HiRadio.defaultProps = {};
52
+ export default withStyles(styles, {
53
+ hiComponent: true,
54
+ name: 'HmuiHiRadio'
55
+ })(HiRadio);
@@ -0,0 +1 @@
1
+ export { default } from './HiRadio';