@hipay/hipay-material-ui 1.0.0-beta.7 → 1.0.0-beta.9
Sign up to get free protection for your applications and to get access to all the features.
- package/HiBreadcrumb/HiBreadcrumb.js +143 -0
- package/HiBreadcrumb/HiStep.js +123 -0
- package/HiBreadcrumb/HiStepConnector.js +142 -0
- package/HiBreadcrumb/HiStepIcon.js +134 -0
- package/HiBreadcrumb/HiStepLabel.js +182 -0
- package/HiBreadcrumb/HiStepper.js +125 -0
- package/HiBreadcrumb/index.js +16 -0
- package/HiDatePicker/HiDateRangeSelector.js +1 -1
- package/HiDotsStepper/HiDot.js +151 -0
- package/HiDotsStepper/HiDotsStepper.js +146 -0
- package/HiDotsStepper/index.js +16 -0
- package/HiForm/HiAddressField.js +204 -0
- package/HiForm/HiFormControl.js +19 -27
- package/HiForm/HiInput.js +1 -1
- package/HiForm/HiSearchField.js +1 -1
- package/HiForm/index.js +9 -0
- package/HiPdfReader/HiPdfReader.js +282 -0
- package/HiPdfReader/index.js +16 -0
- package/HiPins/HiPins.js +0 -1
- package/HiSelect/HiSuggestSelect.js +2 -0
- package/HiSelectableList/HiSelectableListItem.js +23 -11
- package/HiTable/BodyCellBuilder.js +7 -8
- package/HiTable/BodyCells/CellLayout.js +25 -19
- package/HiTable/BodyCells/CellSentinel.js +12 -4
- package/HiTable/BodyCells/CellStatus.js +5 -1
- package/HiTable/BodyCells/CellText.js +2 -1
- package/HiTable/BodyRow.js +7 -1
- package/HiTable/ColumnFilter.js +5 -1
- package/HiTable/HeaderCell.js +17 -14
- package/HiTable/HiTable.js +25 -9
- package/HiTable/HiTableBody.js +38 -14
- package/HiTable/HiTableHead.js +22 -5
- package/HiTable/OrderColumns.js +6 -2
- package/es/HiBreadcrumb/HiBreadcrumb.js +73 -0
- package/es/HiBreadcrumb/HiStep.js +93 -0
- package/es/HiBreadcrumb/HiStepConnector.js +83 -0
- package/es/HiBreadcrumb/HiStepIcon.js +81 -0
- package/es/HiBreadcrumb/HiStepLabel.js +154 -0
- package/es/HiBreadcrumb/HiStepper.js +62 -0
- package/es/HiBreadcrumb/index.js +1 -0
- package/es/HiDatePicker/HiDateRangeSelector.js +1 -1
- package/es/HiDotsStepper/HiDot.js +92 -0
- package/es/HiDotsStepper/HiDotsStepper.js +83 -0
- package/es/HiDotsStepper/index.js +1 -0
- package/es/HiForm/HiAddressField.js +142 -0
- package/es/HiForm/HiFormControl.js +15 -15
- package/es/HiForm/HiInput.js +1 -1
- package/es/HiForm/HiSearchField.js +1 -1
- package/es/HiForm/index.js +2 -1
- package/es/HiPdfReader/HiPdfReader.js +198 -0
- package/es/HiPdfReader/index.js +1 -0
- package/es/HiPins/HiPins.js +0 -1
- package/es/HiSelect/HiSuggestSelect.js +2 -0
- package/es/HiSelectableList/HiSelectableListItem.js +22 -11
- package/es/HiTable/BodyCellBuilder.js +8 -9
- package/es/HiTable/BodyCells/CellLayout.js +27 -21
- package/es/HiTable/BodyCells/CellSentinel.js +12 -4
- package/es/HiTable/BodyCells/CellStatus.js +5 -1
- package/es/HiTable/BodyCells/CellText.js +2 -1
- package/es/HiTable/BodyRow.js +7 -1
- package/es/HiTable/ColumnFilter.js +5 -1
- package/es/HiTable/HeaderCell.js +17 -14
- package/es/HiTable/HiTable.js +25 -9
- package/es/HiTable/HiTableBody.js +34 -11
- package/es/HiTable/HiTableHead.js +17 -5
- package/es/HiTable/OrderColumns.js +6 -2
- package/es/styles/createHiMuiTheme.js +7 -0
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -1
- package/styles/createHiMuiTheme.js +7 -0
- package/umd/hipay-material-ui.development.js +2965 -2659
- package/umd/hipay-material-ui.production.min.js +4 -4
package/HiTable/HiTableHead.js
CHANGED
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.SORTED_COLUMN_ERROR_MESSAGE = exports.styles = undefined;
|
7
7
|
|
8
|
+
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
9
|
+
|
10
|
+
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
11
|
+
|
8
12
|
var _extends2 = require('babel-runtime/helpers/extends');
|
9
13
|
|
10
14
|
var _extends3 = _interopRequireDefault(_extends2);
|
@@ -43,6 +47,10 @@ var _reactProptypeConditionalRequire = require('react-proptype-conditional-requi
|
|
43
47
|
|
44
48
|
var _reactProptypeConditionalRequire2 = _interopRequireDefault(_reactProptypeConditionalRequire);
|
45
49
|
|
50
|
+
var _classnames = require('classnames');
|
51
|
+
|
52
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
53
|
+
|
46
54
|
var _Table = require('material-ui/Table');
|
47
55
|
|
48
56
|
var _PlusCircle = require('mdi-material-ui/PlusCircle');
|
@@ -79,11 +87,13 @@ var styles = exports.styles = function styles(theme) {
|
|
79
87
|
return {
|
80
88
|
thead: {
|
81
89
|
position: 'relative',
|
82
|
-
|
83
|
-
, width: '100%',
|
90
|
+
width: '100%',
|
84
91
|
overflow: 'visible',
|
85
92
|
zIndex: 12
|
86
93
|
},
|
94
|
+
theadFixedWidth: {
|
95
|
+
display: 'block' /*seperates the header from the body allowing it to be positioned*/
|
96
|
+
},
|
87
97
|
theadRow: {
|
88
98
|
backgroundColor: theme.palette.background3,
|
89
99
|
zIndex: 12
|
@@ -226,7 +236,8 @@ var HiTableHead = function (_React$Component) {
|
|
226
236
|
sticky = _props.sticky,
|
227
237
|
translations = _props.translations,
|
228
238
|
view = _props.view,
|
229
|
-
lookupColumns = _props.lookupColumns
|
239
|
+
lookupColumns = _props.lookupColumns,
|
240
|
+
fixedColumnWidth = _props.fixedColumnWidth;
|
230
241
|
var _state = this.state,
|
231
242
|
hovered = _state.hovered,
|
232
243
|
openedOrderColumns = _state.openedOrderColumns,
|
@@ -234,7 +245,7 @@ var HiTableHead = function (_React$Component) {
|
|
234
245
|
|
235
246
|
|
236
247
|
var headerProps = (0, _extends3.default)({
|
237
|
-
className: classes.thead
|
248
|
+
className: (0, _classnames2.default)(classes.thead, (0, _defineProperty3.default)({}, classes.theadFixedWidth, fixedColumnWidth))
|
238
249
|
}, orderable && { onMouseEnter: this.handleEvent, onMouseLeave: this.handleEvent });
|
239
250
|
|
240
251
|
var unfixedColumnIsSet = false,
|
@@ -301,7 +312,8 @@ var HiTableHead = function (_React$Component) {
|
|
301
312
|
fixedWidth: fixed,
|
302
313
|
align: column['align'],
|
303
314
|
sticky: firstColumn && sticky,
|
304
|
-
lookedUp: lookupColumns.includes(column.colId)
|
315
|
+
lookedUp: lookupColumns.includes(column.colId),
|
316
|
+
fixedColumnWidth: fixedColumnWidth
|
305
317
|
});
|
306
318
|
}
|
307
319
|
}),
|
@@ -411,6 +423,11 @@ HiTableHead.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
411
423
|
* Active le filtre sur les colonnes filtrables
|
412
424
|
*/
|
413
425
|
filterable: _propTypes2.default.bool,
|
426
|
+
/**
|
427
|
+
* Fixe la taille des colonnes selon le type de vue
|
428
|
+
* Sinon les colonnes s'adaptent à l'espace disponible
|
429
|
+
*/
|
430
|
+
fixedColumnWidth: _propTypes2.default.bool,
|
414
431
|
/**
|
415
432
|
* Identifiant de la ou des colonnes sur la/lesquelles il y a une 'lookup' search
|
416
433
|
*/
|
package/HiTable/OrderColumns.js
CHANGED
@@ -141,7 +141,8 @@ var styles = exports.styles = function styles(theme) {
|
|
141
141
|
controlLabelRoot: {
|
142
142
|
marginLeft: 6,
|
143
143
|
marginBottom: 8,
|
144
|
-
fontSize: 15
|
144
|
+
fontSize: 15,
|
145
|
+
width: 160
|
145
146
|
},
|
146
147
|
switchLabelRoot: {
|
147
148
|
marginLeft: 15,
|
@@ -150,7 +151,10 @@ var styles = exports.styles = function styles(theme) {
|
|
150
151
|
columnLabel: {
|
151
152
|
position: 'relative',
|
152
153
|
top: 5,
|
153
|
-
left: 5
|
154
|
+
left: 5,
|
155
|
+
overflow: 'hidden',
|
156
|
+
textOverflow: 'ellipsis',
|
157
|
+
whiteSpace: 'nowrap'
|
154
158
|
},
|
155
159
|
label: {
|
156
160
|
fontWeight: 'inherit'
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import _extends from 'babel-runtime/helpers/extends';
|
2
|
+
import React from 'react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import { withStyles } from '../styles';
|
5
|
+
import HiStepper from './HiStepper';
|
6
|
+
import HiStepLabel from './HiStepLabel';
|
7
|
+
import HiStep from './HiStep';
|
8
|
+
|
9
|
+
export const styles = theme => ({
|
10
|
+
label: _extends({
|
11
|
+
display: 'inline-block',
|
12
|
+
marginLeft: 12,
|
13
|
+
fontWeight: theme.typography.fontWeightRegular,
|
14
|
+
color: theme.palette.neutral.normal
|
15
|
+
}, theme.typography.body3),
|
16
|
+
active: {
|
17
|
+
fontWeight: theme.typography.fontWeightMedium
|
18
|
+
}
|
19
|
+
});
|
20
|
+
|
21
|
+
class HiBreadcrumb extends React.PureComponent {
|
22
|
+
constructor(...args) {
|
23
|
+
var _temp;
|
24
|
+
|
25
|
+
return _temp = super(...args), this.handleStep = idx => () => {
|
26
|
+
this.props.handleStep(idx);
|
27
|
+
}, _temp;
|
28
|
+
}
|
29
|
+
|
30
|
+
render() {
|
31
|
+
const { activeStep, steps } = this.props;
|
32
|
+
|
33
|
+
return React.createElement(
|
34
|
+
HiStepper,
|
35
|
+
{ activeStep: activeStep },
|
36
|
+
React.createElement(
|
37
|
+
'div',
|
38
|
+
null,
|
39
|
+
steps.map((step, index) => {
|
40
|
+
const validConnector = step.status === 'validated' && index < steps.length - 1 && steps[index + 1].status === 'validated';
|
41
|
+
return React.createElement(
|
42
|
+
HiStep,
|
43
|
+
{
|
44
|
+
key: step.id,
|
45
|
+
onClick: this.handleStep(index),
|
46
|
+
isLast: index === steps.length - 1,
|
47
|
+
validConnector: validConnector
|
48
|
+
},
|
49
|
+
React.createElement(
|
50
|
+
HiStepLabel,
|
51
|
+
{
|
52
|
+
active: activeStep === index,
|
53
|
+
status: step.status,
|
54
|
+
notificationNumber: step.notificationNumber
|
55
|
+
},
|
56
|
+
step.label
|
57
|
+
)
|
58
|
+
);
|
59
|
+
})
|
60
|
+
)
|
61
|
+
);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
HiBreadcrumb.defaultProps = {
|
66
|
+
activeStep: 0
|
67
|
+
};
|
68
|
+
HiBreadcrumb.propTypes = process.env.NODE_ENV !== "production" ? {
|
69
|
+
activeStep: PropTypes.number,
|
70
|
+
steps: PropTypes.array.isRequired,
|
71
|
+
handleStep: PropTypes.func
|
72
|
+
} : {};
|
73
|
+
export default withStyles(styles, { name: 'HmuiHiBreadcrumb' })(HiBreadcrumb);
|
@@ -0,0 +1,93 @@
|
|
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 classNames from 'classnames';
|
6
|
+
import { withStyles } from '../styles';
|
7
|
+
import HiStepConnector from './HiStepConnector';
|
8
|
+
|
9
|
+
export const styles = theme => ({
|
10
|
+
root: {},
|
11
|
+
horizontal: {
|
12
|
+
paddingLeft: theme.spacing.unit,
|
13
|
+
paddingRight: theme.spacing.unit,
|
14
|
+
'&:first-child': {
|
15
|
+
paddingLeft: 0
|
16
|
+
},
|
17
|
+
'&:last-child': {
|
18
|
+
paddingRight: 0
|
19
|
+
}
|
20
|
+
},
|
21
|
+
vertical: {}
|
22
|
+
});
|
23
|
+
|
24
|
+
function HiStep(props) {
|
25
|
+
const {
|
26
|
+
active,
|
27
|
+
children,
|
28
|
+
classes,
|
29
|
+
className: classNameProp,
|
30
|
+
index,
|
31
|
+
isLast,
|
32
|
+
orientation,
|
33
|
+
validConnector
|
34
|
+
} = props,
|
35
|
+
other = _objectWithoutProperties(props, ['active', 'children', 'classes', 'className', 'index', 'isLast', 'orientation', 'validConnector']);
|
36
|
+
|
37
|
+
const className = classNames(classes.root, classes[orientation], classNameProp);
|
38
|
+
|
39
|
+
return React.createElement(
|
40
|
+
'div',
|
41
|
+
_extends({ className: className }, other),
|
42
|
+
React.Children.map(children, child => React.cloneElement(child, _extends({
|
43
|
+
active,
|
44
|
+
icon: index + 1,
|
45
|
+
orientation
|
46
|
+
}, child.props))),
|
47
|
+
!isLast && React.createElement(HiStepConnector, { orientation: 'vertical', validConnector: validConnector })
|
48
|
+
);
|
49
|
+
}
|
50
|
+
|
51
|
+
HiStep.propTypes = process.env.NODE_ENV !== "production" ? {
|
52
|
+
/**
|
53
|
+
* Sets the step as active. Is passed to child components.
|
54
|
+
*/
|
55
|
+
active: PropTypes.bool,
|
56
|
+
/**
|
57
|
+
* Should be `Step` sub-components such as `StepLabel`, `StepContent`.
|
58
|
+
*/
|
59
|
+
children: PropTypes.node,
|
60
|
+
/**
|
61
|
+
* @ignore
|
62
|
+
*/
|
63
|
+
classes: PropTypes.object.isRequired,
|
64
|
+
/**
|
65
|
+
* @ignore
|
66
|
+
*/
|
67
|
+
className: PropTypes.string,
|
68
|
+
/**
|
69
|
+
* @ignore
|
70
|
+
* Used internally for numbering.
|
71
|
+
*/
|
72
|
+
index: PropTypes.number,
|
73
|
+
/**
|
74
|
+
* @ignore
|
75
|
+
* Used to know which step is the last, to not put a HiStepConnector
|
76
|
+
*/
|
77
|
+
isLast: PropTypes.bool,
|
78
|
+
/**
|
79
|
+
* @ignore
|
80
|
+
*/
|
81
|
+
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
82
|
+
/**
|
83
|
+
* @ignore
|
84
|
+
*/
|
85
|
+
validConnector: PropTypes.bool
|
86
|
+
} : {};
|
87
|
+
|
88
|
+
HiStep.defaultProps = {
|
89
|
+
active: false,
|
90
|
+
validConnector: false
|
91
|
+
};
|
92
|
+
|
93
|
+
export default withStyles(styles, { name: 'MuiStep' })(HiStep);
|
@@ -0,0 +1,83 @@
|
|
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 classNames from 'classnames';
|
6
|
+
import { withStyles } from '../styles';
|
7
|
+
|
8
|
+
export const styles = theme => ({
|
9
|
+
root: {
|
10
|
+
flex: '1 1 auto'
|
11
|
+
},
|
12
|
+
vertical: {
|
13
|
+
marginLeft: 13, // half icon
|
14
|
+
padding: `0 0 ${theme.spacing.unit}px`
|
15
|
+
},
|
16
|
+
line: {
|
17
|
+
display: 'block',
|
18
|
+
borderColor: theme.palette.grey[600]
|
19
|
+
},
|
20
|
+
lineHorizontal: {
|
21
|
+
borderTopStyle: 'solid',
|
22
|
+
borderTopWidth: 1
|
23
|
+
},
|
24
|
+
lineVertical: {
|
25
|
+
borderLeftStyle: 'solid',
|
26
|
+
borderLeftWidth: 2,
|
27
|
+
minHeight: theme.spacing.unit * 3,
|
28
|
+
height: 37
|
29
|
+
},
|
30
|
+
lineVerticalGreen: {
|
31
|
+
borderColor: theme.palette.status[116]
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @ignore - internal component.
|
37
|
+
*/
|
38
|
+
class HiStepConnector extends React.PureComponent {
|
39
|
+
render() {
|
40
|
+
const _props = this.props,
|
41
|
+
{
|
42
|
+
className: classNameProp,
|
43
|
+
classes,
|
44
|
+
orientation,
|
45
|
+
validConnector
|
46
|
+
} = _props,
|
47
|
+
other = _objectWithoutProperties(_props, ['className', 'classes', 'orientation', 'validConnector']);
|
48
|
+
|
49
|
+
const className = classNames(classes.root, classes[orientation], classNameProp);
|
50
|
+
const lineClassName = classNames(classes.line, {
|
51
|
+
[classes.lineHorizontal]: orientation === 'horizontal',
|
52
|
+
[classes.lineVertical]: orientation === 'vertical',
|
53
|
+
[classes.lineVerticalGreen]: orientation === 'vertical' && validConnector
|
54
|
+
});
|
55
|
+
|
56
|
+
return React.createElement(
|
57
|
+
'div',
|
58
|
+
_extends({ className: className }, other),
|
59
|
+
React.createElement('span', { className: lineClassName })
|
60
|
+
);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
HiStepConnector.propTypes = process.env.NODE_ENV !== "production" ? {
|
65
|
+
/**
|
66
|
+
* Useful to extend the style applied to the component.
|
67
|
+
*/
|
68
|
+
classes: PropTypes.object.isRequired,
|
69
|
+
/**
|
70
|
+
* @ignore
|
71
|
+
*/
|
72
|
+
className: PropTypes.string,
|
73
|
+
/**
|
74
|
+
* @ignore
|
75
|
+
*/
|
76
|
+
orientation: PropTypes.oneOf(['horizontal', 'vertical'])
|
77
|
+
} : {};
|
78
|
+
|
79
|
+
HiStepConnector.defaultProps = {
|
80
|
+
orientation: 'vertical'
|
81
|
+
};
|
82
|
+
|
83
|
+
export default withStyles(styles, { name: 'MuiHiStepConnector' })(HiStepConnector);
|
@@ -0,0 +1,81 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import classNames from 'classnames';
|
4
|
+
import { withStyles } from '../styles';
|
5
|
+
|
6
|
+
export const styles = theme => ({
|
7
|
+
circle: {
|
8
|
+
borderRadius: '50%',
|
9
|
+
width: 16,
|
10
|
+
height: 16,
|
11
|
+
border: 'solid 2px ' + theme.palette.neutral.normal,
|
12
|
+
marginLeft: 6,
|
13
|
+
display: 'inline-block'
|
14
|
+
},
|
15
|
+
validated: {
|
16
|
+
border: 'solid 2px ' + theme.palette.status[116]
|
17
|
+
},
|
18
|
+
refused: {
|
19
|
+
border: 'solid 2px ' + theme.palette.negative.normal
|
20
|
+
},
|
21
|
+
warning: {
|
22
|
+
border: 'solid 2px ' + theme.palette.middle.normal
|
23
|
+
},
|
24
|
+
active: {
|
25
|
+
border: '5px solid rgba(255, 0, 0, 0)',
|
26
|
+
backgroundClip: 'padding-box',
|
27
|
+
boxShadow: '0 0 0 1px ' + theme.palette.neutral.normal,
|
28
|
+
backgroundColor: theme.palette.neutral.normal
|
29
|
+
},
|
30
|
+
activeValidated: {
|
31
|
+
boxShadow: '0 0 0 1px ' + theme.palette.status[116],
|
32
|
+
backgroundColor: theme.palette.status[116]
|
33
|
+
},
|
34
|
+
activeRefused: {
|
35
|
+
boxShadow: '0 0 0 1px ' + theme.palette.negative.normal,
|
36
|
+
backgroundColor: theme.palette.negative.normal
|
37
|
+
},
|
38
|
+
activeWarning: {
|
39
|
+
boxShadow: '0 0 0 1px ' + theme.palette.middle.normal,
|
40
|
+
backgroundColor: theme.palette.middle.normal
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
class HiStepIcon extends React.PureComponent {
|
45
|
+
render() {
|
46
|
+
const { active, classes, status } = this.props;
|
47
|
+
|
48
|
+
return React.createElement('div', {
|
49
|
+
className: classNames(classes.circle, {
|
50
|
+
[classes.activeRefused]: status === 'refused' && active,
|
51
|
+
[classes.activeValidated]: status === 'validated' && active,
|
52
|
+
[classes.activeWarning]: status === 'warning' && active,
|
53
|
+
[classes.active]: active,
|
54
|
+
[classes.refused]: status === 'refused',
|
55
|
+
[classes.validated]: status === 'validated',
|
56
|
+
[classes.warning]: status === 'warning'
|
57
|
+
})
|
58
|
+
});
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
HiStepIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
63
|
+
/**
|
64
|
+
* Whether this step is active.
|
65
|
+
*/
|
66
|
+
active: PropTypes.bool,
|
67
|
+
/**
|
68
|
+
* Useful to extend the style applied to components.
|
69
|
+
*/
|
70
|
+
classes: PropTypes.object.isRequired,
|
71
|
+
|
72
|
+
status: PropTypes.oneOf(['refused', 'validated', 'warning', 'unreviewed'])
|
73
|
+
} : {};
|
74
|
+
|
75
|
+
HiStepIcon.defaultProps = {
|
76
|
+
active: false,
|
77
|
+
status: 'unreviewed',
|
78
|
+
classes: {}
|
79
|
+
};
|
80
|
+
|
81
|
+
export default withStyles(styles, { name: 'MuiHiStepIcon' })(HiStepIcon);
|
@@ -0,0 +1,154 @@
|
|
1
|
+
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
2
|
+
import _extends from 'babel-runtime/helpers/extends';
|
3
|
+
import React from 'react';
|
4
|
+
import PropTypes from 'prop-types';
|
5
|
+
import classNames from 'classnames';
|
6
|
+
import { withStyles } from '../styles';
|
7
|
+
import HiStepIcon from './HiStepIcon';
|
8
|
+
import HiPin from '../HiPins';
|
9
|
+
|
10
|
+
export const styles = theme => ({
|
11
|
+
root: {
|
12
|
+
display: 'flex',
|
13
|
+
alignItems: 'center'
|
14
|
+
},
|
15
|
+
test: {
|
16
|
+
marginLeft: '0 '
|
17
|
+
},
|
18
|
+
vertical: {
|
19
|
+
marginTop: -10,
|
20
|
+
marginBottom: -6
|
21
|
+
},
|
22
|
+
label: _extends({
|
23
|
+
display: 'inline-block',
|
24
|
+
marginLeft: 4,
|
25
|
+
fontWeight: theme.typography.fontWeightRegular,
|
26
|
+
color: theme.palette.neutral.normal,
|
27
|
+
marginBottom: -4
|
28
|
+
}, theme.typography.body3),
|
29
|
+
labelContainer: {
|
30
|
+
marginBottom: 4,
|
31
|
+
maxWidth: 160
|
32
|
+
},
|
33
|
+
validated: {
|
34
|
+
color: theme.palette.status[116]
|
35
|
+
},
|
36
|
+
refused: {
|
37
|
+
color: theme.palette.negative.normal
|
38
|
+
},
|
39
|
+
active: {
|
40
|
+
fontWeight: theme.typography.fontWeightMedium
|
41
|
+
},
|
42
|
+
warning: {
|
43
|
+
color: theme.palette.middle.normal
|
44
|
+
},
|
45
|
+
pin: {
|
46
|
+
marginLeft: 4
|
47
|
+
},
|
48
|
+
shortEllipsis: {
|
49
|
+
display: 'inline-block',
|
50
|
+
overflow: 'hidden',
|
51
|
+
textOverflow: 'ellipsis',
|
52
|
+
whiteSpace: 'pre',
|
53
|
+
maxWidth: 51
|
54
|
+
},
|
55
|
+
longEllipsis: {
|
56
|
+
display: 'inline-block',
|
57
|
+
overflow: 'hidden',
|
58
|
+
textOverflow: 'ellipsis',
|
59
|
+
whiteSpace: 'pre',
|
60
|
+
maxWidth: 90
|
61
|
+
}
|
62
|
+
});
|
63
|
+
|
64
|
+
function HiStepLabel(props) {
|
65
|
+
const {
|
66
|
+
active,
|
67
|
+
children,
|
68
|
+
classes,
|
69
|
+
className: classNameProp,
|
70
|
+
icon,
|
71
|
+
notificationNumber,
|
72
|
+
orientation,
|
73
|
+
status
|
74
|
+
} = props,
|
75
|
+
other = _objectWithoutProperties(props, ['active', 'children', 'classes', 'className', 'icon', 'notificationNumber', 'orientation', 'status']);
|
76
|
+
|
77
|
+
return React.createElement(
|
78
|
+
'span',
|
79
|
+
_extends({
|
80
|
+
className: classNames(classes.root, {
|
81
|
+
[classes.vertical]: orientation === 'vertical'
|
82
|
+
}, classNameProp)
|
83
|
+
}, other),
|
84
|
+
icon && React.createElement(
|
85
|
+
'span',
|
86
|
+
{ className: classes.iconContainer },
|
87
|
+
React.createElement(HiStepIcon, { active: active, status: status })
|
88
|
+
),
|
89
|
+
React.createElement(
|
90
|
+
'span',
|
91
|
+
{ className: classes.labelContainer },
|
92
|
+
React.createElement(
|
93
|
+
'div',
|
94
|
+
{
|
95
|
+
className: classNames(classes.label, {
|
96
|
+
[classes.validated]: status === 'validated',
|
97
|
+
[classes.refused]: status === 'refused',
|
98
|
+
[classes.warning]: status === 'warning',
|
99
|
+
[classes.active]: active,
|
100
|
+
[classes.shortEllipsis]: notificationNumber > 0,
|
101
|
+
[classes.longEllipsis]: notificationNumber === 0
|
102
|
+
})
|
103
|
+
},
|
104
|
+
children
|
105
|
+
),
|
106
|
+
notificationNumber > 0 && React.createElement(
|
107
|
+
'span',
|
108
|
+
{ className: classes.pin },
|
109
|
+
React.createElement(
|
110
|
+
HiPin,
|
111
|
+
{
|
112
|
+
color: props.theme.palette.business.primary.normal,
|
113
|
+
className: classes.test
|
114
|
+
},
|
115
|
+
notificationNumber
|
116
|
+
)
|
117
|
+
)
|
118
|
+
)
|
119
|
+
);
|
120
|
+
}
|
121
|
+
|
122
|
+
HiStepLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
123
|
+
/**
|
124
|
+
* @ignore
|
125
|
+
* Sets the step as active. Is passed to child components.
|
126
|
+
*/
|
127
|
+
active: PropTypes.bool,
|
128
|
+
/**
|
129
|
+
* In most cases will simply be a string containing a title for the label.
|
130
|
+
*/
|
131
|
+
children: PropTypes.node,
|
132
|
+
/**
|
133
|
+
* Custom styles for component.
|
134
|
+
*/
|
135
|
+
classes: PropTypes.object.isRequired,
|
136
|
+
/**
|
137
|
+
* @ignore
|
138
|
+
*/
|
139
|
+
className: PropTypes.string,
|
140
|
+
/**
|
141
|
+
* @ignore
|
142
|
+
*/
|
143
|
+
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
144
|
+
|
145
|
+
status: PropTypes.oneOf(['unreviewed', 'refused', 'validated', 'warning'])
|
146
|
+
} : {};
|
147
|
+
|
148
|
+
HiStepLabel.defaultProps = {
|
149
|
+
active: false,
|
150
|
+
status: 'unreviewed',
|
151
|
+
orientation: 'vertical'
|
152
|
+
};
|
153
|
+
|
154
|
+
export default withStyles(styles, { name: 'MuiHiStepLabel', withTheme: true })(HiStepLabel);
|
@@ -0,0 +1,62 @@
|
|
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 classNames from 'classnames';
|
6
|
+
import { withStyles } from '../styles';
|
7
|
+
import Paper from '../Paper';
|
8
|
+
|
9
|
+
export const styles = theme => ({
|
10
|
+
root: {
|
11
|
+
display: 'flex',
|
12
|
+
padding: theme.spacing.unit * 3,
|
13
|
+
maxWidth: 160,
|
14
|
+
flexDirection: 'column'
|
15
|
+
}
|
16
|
+
});
|
17
|
+
|
18
|
+
class HiStepper extends React.PureComponent {
|
19
|
+
|
20
|
+
render() {
|
21
|
+
const _props = this.props,
|
22
|
+
{ activeStep, children, classes, className: classNameProp } = _props,
|
23
|
+
other = _objectWithoutProperties(_props, ['activeStep', 'children', 'classes', 'className']);
|
24
|
+
|
25
|
+
const className = classNames(classes.root, classNameProp);
|
26
|
+
|
27
|
+
const childrenArray = React.Children.toArray(children.props.children);
|
28
|
+
|
29
|
+
const steps = childrenArray.map((step, index) => {
|
30
|
+
return React.cloneElement(step, _extends({ index, active: activeStep === index }, step.props));
|
31
|
+
});
|
32
|
+
|
33
|
+
return React.createElement(
|
34
|
+
Paper,
|
35
|
+
_extends({ square: true, elevation: 0, className: className }, other),
|
36
|
+
steps
|
37
|
+
);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
HiStepper.defaultProps = {
|
42
|
+
activeStep: 0
|
43
|
+
};
|
44
|
+
HiStepper.propTypes = process.env.NODE_ENV !== "production" ? {
|
45
|
+
/**
|
46
|
+
* Set the active step (zero based index).
|
47
|
+
*/
|
48
|
+
activeStep: PropTypes.number,
|
49
|
+
/**
|
50
|
+
* Two or more `<Step />` components.
|
51
|
+
*/
|
52
|
+
children: PropTypes.node.isRequired,
|
53
|
+
/**
|
54
|
+
* Useful to extend the style applied to components.
|
55
|
+
*/
|
56
|
+
classes: PropTypes.object.isRequired,
|
57
|
+
/**
|
58
|
+
* @ignore
|
59
|
+
*/
|
60
|
+
className: PropTypes.string
|
61
|
+
} : {};
|
62
|
+
export default withStyles(styles, { name: 'MuiHiStepper' })(HiStepper);
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './HiBreadcrumb';
|