@hipay/hipay-material-ui 2.1.0-RC1 → 2.2.0-RC1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +154 -0
- package/HiAlertModal/HiAlertModal.js +32 -7
- package/HiAppBar/HiAppBar.js +3 -3
- package/HiBreadcrumb/HiBreadcrumb.js +1 -1
- package/HiBreadcrumb/HiStepConnector.js +3 -3
- package/HiButton/HiButton.js +64 -25
- package/HiCell/CellText.js +3 -3
- package/HiCheckbox/HiCheckbox.js +3 -3
- package/HiChip/HiChipSwitch.js +5 -5
- package/HiColoredLabel/HiColoredLabel.js +2 -1
- package/HiDatePicker/HiDatePicker.js +1 -5
- package/HiDatePicker/Overlays/MonthPickerOverlay.js +3 -3
- package/HiDatePicker/Overlays/TimePickerOverlay.js +4 -4
- package/HiDatePicker/Overlays/YearPickerOverlay.js +3 -3
- package/HiDotsStepper/HiDotsStepper.js +4 -4
- package/HiExpansionPanel/HiExpansionPanel.js +19 -10
- package/HiForm/HiAddressField.js +7 -7
- package/HiForm/HiEmailField.js +3 -3
- package/HiForm/HiFormControl.js +6 -6
- package/HiForm/HiInput.js +11 -11
- package/HiForm/HiPasswordField.js +3 -3
- package/HiForm/HiSearchField.js +5 -5
- package/HiForm/HiTextField.js +5 -5
- package/HiForm/index.js +17 -1
- package/HiIcon/HiIcon.js +9 -1
- package/HiMap/HiMap.js +6 -6
- package/HiMap/HiMapExpand.js +4 -4
- package/HiNotice/HiKPI.js +11 -11
- package/HiNotice/HiKPINotice.js +1 -1
- package/HiSelect/HiDynamicSelect.js +7 -7
- package/HiSelect/HiNestedSelect.js +12 -12
- package/HiSelect/HiNestedSelectContent.js +9 -9
- package/HiSelect/HiSelect.js +56 -58
- package/HiSelect/HiSelectContent.js +13 -13
- package/HiSelect/HiSelectInput.js +7 -7
- package/HiSelect/HiSuggestSelect.js +62 -54
- package/HiSelectableList/HiSelectableList.js +28 -9
- package/HiSelectableList/HiSelectableListItem.js +6 -5
- package/HiTable/HiTable.js +3 -3
- package/HiTable/HiTableRow.js +3 -3
- package/es/HiAlertModal/HiAlertModal.js +26 -4
- package/es/HiBreadcrumb/HiBreadcrumb.js +1 -1
- package/es/HiButton/HiButton.js +57 -41
- package/es/HiColoredLabel/HiColoredLabel.js +2 -1
- package/es/HiDatePicker/HiDatePicker.js +1 -3
- package/es/HiExpansionPanel/HiExpansionPanel.js +19 -10
- package/es/HiForm/index.js +3 -1
- package/es/HiIcon/HiIcon.js +9 -1
- package/es/HiNotice/HiKPI.js +8 -8
- package/es/HiNotice/HiKPINotice.js +1 -1
- package/es/HiSelect/HiSelect.js +30 -27
- package/es/HiSelect/HiSuggestSelect.js +61 -52
- package/es/HiSelectableList/HiSelectableList.js +26 -8
- package/es/HiSelectableList/HiSelectableListItem.js +2 -1
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -2
- package/HiDatePicker/Caption.spec.js +0 -88
- package/HiDatePicker/ListPicker.spec.js +0 -67
- package/HiDatePicker/NavBar.spec.js +0 -55
- package/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +0 -74
- package/HiDatePicker/Overlays/Overlay.spec.js +0 -34
- package/HiDatePicker/Overlays/TimePickerOverlay.spec.js +0 -71
- package/HiDatePicker/Overlays/YearPickerOverlay.spec.js +0 -127
- package/es/HiDatePicker/Caption.spec.js +0 -68
- package/es/HiDatePicker/ListPicker.spec.js +0 -50
- package/es/HiDatePicker/NavBar.spec.js +0 -39
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +0 -53
- package/es/HiDatePicker/Overlays/Overlay.spec.js +0 -25
- package/es/HiDatePicker/Overlays/TimePickerOverlay.spec.js +0 -53
- package/es/HiDatePicker/Overlays/YearPickerOverlay.spec.js +0 -92
@@ -17,10 +17,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
17
17
|
|
18
18
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
19
19
|
|
20
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
21
|
-
|
22
20
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
23
21
|
|
22
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
23
|
+
|
24
24
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
25
25
|
|
26
26
|
var _react = _interopRequireDefault(require("react"));
|
@@ -231,6 +231,7 @@ function (_React$PureComponent) {
|
|
231
231
|
|
232
232
|
if (key === 'space' || key === 'enter') {
|
233
233
|
event.preventDefault();
|
234
|
+
event.stopPropagation();
|
234
235
|
|
235
236
|
if (item) {
|
236
237
|
_this.props.onSelect(null, item);
|
@@ -242,8 +243,8 @@ function (_React$PureComponent) {
|
|
242
243
|
_this.state = {
|
243
244
|
hover: false
|
244
245
|
};
|
245
|
-
_this.buildItemLabel = _this.buildItemLabel.bind((0, _assertThisInitialized2.default)(_this));
|
246
|
-
_this.setHover = _this.setHover.bind((0, _assertThisInitialized2.default)(_this));
|
246
|
+
_this.buildItemLabel = _this.buildItemLabel.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
247
|
+
_this.setHover = _this.setHover.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
247
248
|
return _this;
|
248
249
|
}
|
249
250
|
|
@@ -378,7 +379,7 @@ function (_React$PureComponent) {
|
|
378
379
|
indeterminateIcon: indeterminateIcon
|
379
380
|
}), type === 'image' && img && _react.default.createElement("img", {
|
380
381
|
src: img,
|
381
|
-
alt:
|
382
|
+
alt: '',
|
382
383
|
onError: function onError(e) {
|
383
384
|
if (fallbackImage) {
|
384
385
|
e.target.src = "".concat(fallbackImage);
|
package/HiTable/HiTable.js
CHANGED
@@ -15,10 +15,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
15
15
|
|
16
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
17
17
|
|
18
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
19
|
-
|
20
18
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
21
19
|
|
20
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
21
|
+
|
22
22
|
var _react = _interopRequireDefault(require("react"));
|
23
23
|
|
24
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
@@ -57,7 +57,7 @@ function (_React$PureComponent) {
|
|
57
57
|
}
|
58
58
|
};
|
59
59
|
|
60
|
-
_this.handleRequestSort = _this.handleRequestSort.bind((0, _assertThisInitialized2.default)(_this));
|
60
|
+
_this.handleRequestSort = _this.handleRequestSort.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
61
61
|
return _this;
|
62
62
|
}
|
63
63
|
|
package/HiTable/HiTableRow.js
CHANGED
@@ -19,10 +19,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
19
19
|
|
20
20
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
21
21
|
|
22
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
23
|
-
|
24
22
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
25
23
|
|
24
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
25
|
+
|
26
26
|
var _react = _interopRequireDefault(require("react"));
|
27
27
|
|
28
28
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
@@ -74,7 +74,7 @@ function (_React$PureComponent) {
|
|
74
74
|
|
75
75
|
(0, _classCallCheck2.default)(this, HiTableRow);
|
76
76
|
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HiTableRow).call(this, props));
|
77
|
-
_this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2.default)(_this));
|
77
|
+
_this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
78
78
|
return _this;
|
79
79
|
}
|
80
80
|
|
@@ -67,11 +67,24 @@ class HiAlertModal extends React.PureComponent {
|
|
67
67
|
}
|
68
68
|
};
|
69
69
|
|
70
|
+
this.submitButtonRef = React.createRef();
|
71
|
+
this.cancelButtonRef = React.createRef();
|
70
72
|
this.handleOnClose = this.handleOnClose.bind(this);
|
73
|
+
this.handleOnEntered = this.handleOnEntered.bind(this);
|
71
74
|
} // Appelé si clic en dehors de la pop up
|
72
75
|
|
73
76
|
|
74
|
-
|
77
|
+
handleOnEntered() {
|
78
|
+
if (this.props.labelSubmitButton) {
|
79
|
+
this.submitButtonRef.current.focus();
|
80
|
+
this.submitActionsRef.focusVisible();
|
81
|
+
} else if (this.props.labelCancelButton) {
|
82
|
+
this.cancelButtonRef.current.focus();
|
83
|
+
this.cancelActionsRef.focusVisible();
|
84
|
+
}
|
85
|
+
} // Render
|
86
|
+
|
87
|
+
|
75
88
|
render() {
|
76
89
|
const _this$props = this.props,
|
77
90
|
{
|
@@ -105,6 +118,7 @@ class HiAlertModal extends React.PureComponent {
|
|
105
118
|
return React.createElement(Dialog, _extends({
|
106
119
|
open: open,
|
107
120
|
onClose: this.handleOnClose,
|
121
|
+
onEntered: this.handleOnEntered,
|
108
122
|
classes: {
|
109
123
|
root: classes.classDialogRoot,
|
110
124
|
paper: classes.classDialogPaper
|
@@ -112,7 +126,7 @@ class HiAlertModal extends React.PureComponent {
|
|
112
126
|
}, props), backgroundIcon && React.createElement("div", {
|
113
127
|
className: classes.classBackgroundIcon
|
114
128
|
}, React.createElement(HiIcon, {
|
115
|
-
color:
|
129
|
+
color: "inherit",
|
116
130
|
icon: backgroundIcon,
|
117
131
|
size: iconSize
|
118
132
|
})), title && React.createElement(DialogTitle, {
|
@@ -133,13 +147,21 @@ class HiAlertModal extends React.PureComponent {
|
|
133
147
|
root: classes.classCancelButton
|
134
148
|
},
|
135
149
|
onClick: onCancelClick,
|
136
|
-
color: cancelColor
|
150
|
+
color: cancelColor,
|
151
|
+
innerRef: this.cancelButtonRef,
|
152
|
+
action: actions => {
|
153
|
+
this.cancelActionsRef = actions;
|
154
|
+
}
|
137
155
|
}, labelCancelButton), labelSubmitButton && React.createElement(HiButton, {
|
138
156
|
classes: {
|
139
157
|
root: classes.classSubmitButton
|
140
158
|
},
|
141
159
|
onClick: onSubmitClick,
|
142
|
-
color: submitColor
|
160
|
+
color: submitColor,
|
161
|
+
innerRef: this.submitButtonRef,
|
162
|
+
action: actions => {
|
163
|
+
this.submitActionsRef = actions;
|
164
|
+
}
|
143
165
|
}, labelSubmitButton)));
|
144
166
|
}
|
145
167
|
|
package/es/HiButton/HiButton.js
CHANGED
@@ -169,46 +169,52 @@ export const styles = theme => ({
|
|
169
169
|
disabled: {}
|
170
170
|
});
|
171
171
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
172
|
+
class HiButton extends React.Component {
|
173
|
+
render() {
|
174
|
+
const _this$props = this.props,
|
175
|
+
{
|
176
|
+
children,
|
177
|
+
classes,
|
178
|
+
className,
|
179
|
+
color,
|
180
|
+
variant,
|
181
|
+
disabled,
|
182
|
+
buttonRef
|
183
|
+
} = _this$props,
|
184
|
+
other = _objectWithoutProperties(_this$props, ["children", "classes", "className", "color", "variant", "disabled", "buttonRef"]);
|
185
|
+
|
186
|
+
const hcolor = ['positive', 'negative', 'middle', 'neutral'].includes(color) ? 'inherit' : color;
|
187
|
+
const fab = variant === 'fab' || variant === 'extendedFab';
|
188
|
+
const contained = variant === 'contained' || variant === 'raised';
|
189
|
+
const buttonClassNames = classNames(classes.root, {
|
190
|
+
[classes.raisedDisabled]: variant === 'raised' && disabled,
|
191
|
+
[classes.flatPositive]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'positive',
|
192
|
+
[classes.flatNegative]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'negative',
|
193
|
+
[classes.flatMiddle]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'middle',
|
194
|
+
[classes.flatNeutral]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && (color === 'default' || color === 'neutral'),
|
195
|
+
[classes.containedPrimary]: (contained || fab) && color === 'primary',
|
196
|
+
[classes.containedPositive]: (contained || fab) && color === 'positive',
|
197
|
+
[classes.containedNegative]: (contained || fab) && color === 'negative',
|
198
|
+
[classes.containedMiddle]: (contained || fab) && color === 'middle',
|
199
|
+
[classes.containedNeutral]: (contained || fab) && (color === 'default' || color === 'neutral'),
|
200
|
+
[classes.outlinedPositive]: variant === 'outlined' && color === 'positive',
|
201
|
+
[classes.outlinedNegative]: variant === 'outlined' && color === 'negative',
|
202
|
+
[classes.outlinedMiddle]: variant === 'outlined' && color === 'middle',
|
203
|
+
[classes.outlinedNeutral]: variant === 'outlined' && (color === 'default' || color === 'neutral'),
|
204
|
+
[classes.disabled]: disabled
|
205
|
+
});
|
206
|
+
return React.createElement(Button, _extends({
|
207
|
+
className: className,
|
208
|
+
classes: {
|
209
|
+
root: buttonClassNames
|
210
|
+
},
|
211
|
+
color: hcolor,
|
212
|
+
variant: variant,
|
213
|
+
disabled: disabled,
|
214
|
+
buttonRef: buttonRef
|
215
|
+
}, other), children);
|
216
|
+
}
|
217
|
+
|
212
218
|
}
|
213
219
|
|
214
220
|
HiButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
@@ -236,7 +242,17 @@ HiButton.defaultProps = {
|
|
236
242
|
color: 'neutral',
|
237
243
|
variant: 'text'
|
238
244
|
};
|
245
|
+
|
246
|
+
function forwardRef(props, ref) {
|
247
|
+
return React.createElement(HiButton, _extends({}, props, {
|
248
|
+
buttonRef: ref
|
249
|
+
}));
|
250
|
+
}
|
251
|
+
|
252
|
+
const name = HiButton.displayName || HiButton.name;
|
253
|
+
forwardRef.displayName = name;
|
254
|
+
const HiButtonForwardRef = React.forwardRef(forwardRef);
|
239
255
|
export default withStyles(styles, {
|
240
256
|
hiComponent: true,
|
241
257
|
name: 'HmuiHiButton'
|
242
|
-
})(
|
258
|
+
})(HiButtonForwardRef);
|
@@ -118,7 +118,7 @@ function HiColoredLabel(props) {
|
|
118
118
|
className,
|
119
119
|
fontSize,
|
120
120
|
label,
|
121
|
-
color,
|
121
|
+
color: propsColor,
|
122
122
|
active,
|
123
123
|
outlined,
|
124
124
|
fontWeight,
|
@@ -127,6 +127,7 @@ function HiColoredLabel(props) {
|
|
127
127
|
} = props,
|
128
128
|
other = _objectWithoutProperties(props, ["classes", "className", "fontSize", "label", "color", "active", "outlined", "fontWeight", "style", "theme"]);
|
129
129
|
|
130
|
+
const color = propsColor || 'primary';
|
130
131
|
const isHiColor = ['primary', 'secondary', 'positive', 'negative', 'middle', 'neutral'].includes(color);
|
131
132
|
const isHexColor = !isHiColor && /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
|
132
133
|
return React.createElement("div", _extends({
|
@@ -18,8 +18,6 @@ import Weekday from './Weekday';
|
|
18
18
|
import HiTextField from '../HiForm/HiTextField';
|
19
19
|
import styles from './stylesheet';
|
20
20
|
import { isMobile } from 'react-device-detect';
|
21
|
-
import classNames from 'classnames';
|
22
|
-
import HiFormControl from '../HiForm/HiFormControl';
|
23
21
|
import HiDatePickerMobile from './HiDatePickerMobile';
|
24
22
|
|
25
23
|
class HiDatePicker extends React.Component {
|
@@ -50,7 +48,7 @@ class HiDatePicker extends React.Component {
|
|
50
48
|
this.props.onChange(undefined);
|
51
49
|
} else {
|
52
50
|
// Keep Time if set
|
53
|
-
if (this.props.enableTime
|
51
|
+
if (this.props.enableTime) {
|
54
52
|
if (this.props.value) {
|
55
53
|
day.setHours(this.props.value.getHours(), this.props.value.getMinutes());
|
56
54
|
} else {
|
@@ -12,11 +12,14 @@ import withStyles from '../styles/withStyles';
|
|
12
12
|
import classNames from 'classnames';
|
13
13
|
export const styles = theme => ({
|
14
14
|
summaryContent: {
|
15
|
-
display: '
|
15
|
+
display: 'flex',
|
16
|
+
alignItems: 'baseline',
|
17
|
+
justifyContent: 'space-between',
|
16
18
|
border: 'none',
|
17
19
|
'&$expanded': {
|
18
20
|
margin: 'initial'
|
19
|
-
}
|
21
|
+
},
|
22
|
+
maxWidth: '100%'
|
20
23
|
},
|
21
24
|
summaryRoot: {
|
22
25
|
borderBottom: '1px solid #E3E6E7',
|
@@ -46,17 +49,21 @@ export const styles = theme => ({
|
|
46
49
|
display: 'flex',
|
47
50
|
alignItems: 'center',
|
48
51
|
fontSize: 11,
|
49
|
-
lineHeight: '24px',
|
50
|
-
float: 'right',
|
51
|
-
marginRight: 32,
|
52
52
|
'&>svg': {
|
53
53
|
fontSize: 18,
|
54
54
|
marginLeft: 3
|
55
55
|
},
|
56
|
-
|
56
|
+
'&>button': {
|
57
57
|
marginRight: -12
|
58
|
-
}
|
58
|
+
},
|
59
|
+
marginLeft: 24,
|
60
|
+
overflow: 'hidden'
|
59
61
|
}),
|
62
|
+
secondaryHeadingSpan: {
|
63
|
+
overflow: 'hidden',
|
64
|
+
whiteSpace: 'nowrap',
|
65
|
+
textOverflow: 'ellipsis'
|
66
|
+
},
|
60
67
|
panel: {
|
61
68
|
boxShadow: 'none',
|
62
69
|
border: 'none'
|
@@ -116,10 +123,12 @@ class HiExpansionPanel extends React.PureComponent {
|
|
116
123
|
}),
|
117
124
|
expandIcon: !collapseDisable && _ref
|
118
125
|
}, React.createElement("div", {
|
119
|
-
className: classes.secondaryHeading
|
120
|
-
}, !effectiveDisabled ? secondaryHeading : secondaryHeadingDisabled, secondaryHeadingIcon), React.createElement("div", {
|
121
126
|
className: classes.heading
|
122
|
-
}, heading)
|
127
|
+
}, heading), React.createElement("div", {
|
128
|
+
className: classes.secondaryHeading
|
129
|
+
}, React.createElement("span", {
|
130
|
+
className: classes.secondaryHeadingSpan
|
131
|
+
}, !effectiveDisabled ? secondaryHeading : secondaryHeadingDisabled), secondaryHeadingIcon)), !!children && React.createElement(ExpansionPanelDetails, {
|
123
132
|
className: classes.panelDetails
|
124
133
|
}, children));
|
125
134
|
}
|
package/es/HiForm/index.js
CHANGED
@@ -6,4 +6,6 @@ export { default as HiInput } from './HiInput';
|
|
6
6
|
export { default as HiPasswordField } from './HiPasswordField';
|
7
7
|
export { default as HiSearchField } from './HiSearchField';
|
8
8
|
export { default as HiSlider } from './HiSlider';
|
9
|
-
export { default as HiTextField } from './HiTextField';
|
9
|
+
export { default as HiTextField } from './HiTextField';
|
10
|
+
export { default as HiUpload } from './HiUpload';
|
11
|
+
export { default as HiUploadField } from './HiUploadField';
|
package/es/HiIcon/HiIcon.js
CHANGED
@@ -83,9 +83,17 @@ function HiIcon(props) {
|
|
83
83
|
|
84
84
|
if (iconName.indexOf('hi_') === 0) {
|
85
85
|
const IconName = hiSvgIcons[capitalize(camelize(iconName))];
|
86
|
+
let colorValue = color;
|
87
|
+
|
88
|
+
if (color === "inherit") {
|
89
|
+
colorValue = "currentColor";
|
90
|
+
} else if (isHiColor || color === 'primary' || color === 'secondary') {
|
91
|
+
colorValue = theme.palette[color].main;
|
92
|
+
}
|
93
|
+
|
86
94
|
return React.createElement(IconName, _extends({
|
87
95
|
className: classNames(classes.root, className),
|
88
|
-
color:
|
96
|
+
color: colorValue,
|
89
97
|
width: size,
|
90
98
|
height: size
|
91
99
|
}, other));
|
package/es/HiNotice/HiKPI.js
CHANGED
@@ -15,7 +15,8 @@ export const styles = theme => ({
|
|
15
15
|
textAlign: 'center',
|
16
16
|
flexDirection: 'column',
|
17
17
|
alignItems: 'center',
|
18
|
-
fontFamily: theme.typography.fontFamily
|
18
|
+
fontFamily: theme.typography.fontFamily,
|
19
|
+
transition: 'height .5s ease-out'
|
19
20
|
},
|
20
21
|
rootDisable: {
|
21
22
|
cursor: 'default'
|
@@ -107,7 +108,7 @@ class HiKPI extends React.Component {
|
|
107
108
|
disable
|
108
109
|
} = this.props;
|
109
110
|
const rootclass = classNames(classes.root, {
|
110
|
-
[classes.inherit]: color === 'inherit'
|
111
|
+
[classes.inherit]: color === 'inherit',
|
111
112
|
[classes.warning]: color === 'warning' && !disable,
|
112
113
|
[classes.error]: color === 'error' && !disable,
|
113
114
|
[classes.positive]: color === 'positive' && !disable,
|
@@ -115,11 +116,7 @@ class HiKPI extends React.Component {
|
|
115
116
|
[classes.minify]: minify,
|
116
117
|
[classes.rootDisable]: disable
|
117
118
|
});
|
118
|
-
return React.createElement(
|
119
|
-
in: !minify,
|
120
|
-
timeout: "auto",
|
121
|
-
collapsedHeight: "88px"
|
122
|
-
}, React.createElement(ButtonBase, {
|
119
|
+
return React.createElement(ButtonBase, {
|
123
120
|
className: rootclass,
|
124
121
|
onClick: !disable ? this.handleClick(id) : undefined,
|
125
122
|
title: tooltip,
|
@@ -128,7 +125,10 @@ class HiKPI extends React.Component {
|
|
128
125
|
className: classes.title
|
129
126
|
}, title), React.createElement("div", {
|
130
127
|
className: classes.body
|
131
|
-
}, minify && bodyMinify ? bodyMinify : body),
|
128
|
+
}, minify && bodyMinify ? bodyMinify : body), React.createElement(Collapse, {
|
129
|
+
in: !minify,
|
130
|
+
timeout: 'auto'
|
131
|
+
}, React.createElement("div", {
|
132
132
|
className: classes.subtitle
|
133
133
|
}, subtitle)));
|
134
134
|
}
|
package/es/HiSelect/HiSelect.js
CHANGED
@@ -148,6 +148,7 @@ class HiSelect extends React.PureComponent {
|
|
148
148
|
className: classes.selectIconLabel
|
149
149
|
}, React.createElement(HiIcon, {
|
150
150
|
className: classes.labelIcon,
|
151
|
+
color: item.color,
|
151
152
|
icon: item.icon
|
152
153
|
}), item.label);
|
153
154
|
} else if (type === 'image' || item.type === 'image') {
|
@@ -435,6 +436,20 @@ class HiSelect extends React.PureComponent {
|
|
435
436
|
}, '');
|
436
437
|
};
|
437
438
|
|
439
|
+
this.getLengthItemList = itemList => {
|
440
|
+
let itemListLength = 0;
|
441
|
+
itemList.forEach(parent => {
|
442
|
+
if (parent.displayed !== false) {
|
443
|
+
itemListLength += 1;
|
444
|
+
|
445
|
+
if (parent.children) {
|
446
|
+
itemListLength += this.getLengthItemList(parent.children);
|
447
|
+
}
|
448
|
+
}
|
449
|
+
});
|
450
|
+
return itemListLength;
|
451
|
+
};
|
452
|
+
|
438
453
|
this.state = {
|
439
454
|
alertOpen: false,
|
440
455
|
open: false,
|
@@ -444,16 +459,6 @@ class HiSelect extends React.PureComponent {
|
|
444
459
|
openDown: true,
|
445
460
|
overlayWidth: 0
|
446
461
|
};
|
447
|
-
this.handleBlur = this.handleBlur.bind(this);
|
448
|
-
this.handleClick = this.handleClick.bind(this);
|
449
|
-
this.handleClose = this.handleClose.bind(this);
|
450
|
-
this.handleClickAway = this.handleClickAway.bind(this);
|
451
|
-
this.handleFocus = this.handleFocus.bind(this);
|
452
|
-
this.handleSearch = this.handleSearch.bind(this);
|
453
|
-
this.handleSearchReset = this.handleSearchReset.bind(this);
|
454
|
-
this.handleSelect = this.handleSelect.bind(this);
|
455
|
-
this.handleSuggestions = this.handleSuggestions.bind(this);
|
456
|
-
this.getInputElement = this.getInputElement.bind(this);
|
457
462
|
}
|
458
463
|
|
459
464
|
componentDidMount() {
|
@@ -487,20 +492,6 @@ class HiSelect extends React.PureComponent {
|
|
487
492
|
*/
|
488
493
|
|
489
494
|
|
490
|
-
getLengthItemList(itemList) {
|
491
|
-
let itemListLength = 0;
|
492
|
-
itemList.forEach(parent => {
|
493
|
-
if (parent.displayed !== false) {
|
494
|
-
itemListLength += 1;
|
495
|
-
|
496
|
-
if (parent.children) {
|
497
|
-
itemListLength += this.getLengthItemList(parent.children);
|
498
|
-
}
|
499
|
-
}
|
500
|
-
});
|
501
|
-
return itemListLength;
|
502
|
-
}
|
503
|
-
|
504
495
|
render() {
|
505
496
|
const {
|
506
497
|
alert,
|
@@ -525,6 +516,7 @@ class HiSelect extends React.PureComponent {
|
|
525
516
|
searchValue = this.state.searchValue,
|
526
517
|
startAdornment,
|
527
518
|
staticPosition,
|
519
|
+
maxOptionsDisplayed,
|
528
520
|
buildSelectProps = this.buildSelectProps // use parent builder if defined
|
529
521
|
|
530
522
|
} = this.props;
|
@@ -593,7 +585,7 @@ class HiSelect extends React.PureComponent {
|
|
593
585
|
// In case we have a nested list
|
594
586
|
const itemListLength = this.getLengthItemList(itemList); // +1 for search input
|
595
587
|
|
596
|
-
const nbItems = itemListLength <=
|
588
|
+
const nbItems = itemListLength <= maxOptionsDisplayed - 2 ? itemListLength + 1 : maxOptionsDisplayed - 1;
|
597
589
|
popperStyle.transform = `translate3d(-1px, -${nbItems * 40 + 2}px, 0px)`;
|
598
590
|
} else if (this.placement && this.placement.indexOf('top') < 0 && !!searchable) {
|
599
591
|
popperStyle.transform = 'translate3d(-1px, 40px, 0px)';
|
@@ -606,6 +598,8 @@ class HiSelect extends React.PureComponent {
|
|
606
598
|
this.placement = placement;
|
607
599
|
}
|
608
600
|
|
601
|
+
const nbItemsDisplayed = !!searchable ? maxOptionsDisplayed - 1 : maxOptionsDisplayed;
|
602
|
+
const autoHeightMax = nbItemsDisplayed * 40 - 10;
|
609
603
|
return React.createElement(ClickAwayListener, {
|
610
604
|
onClickAway: this.handleClickAway
|
611
605
|
}, React.createElement(Grow, {
|
@@ -615,13 +609,16 @@ class HiSelect extends React.PureComponent {
|
|
615
609
|
transformOrigin: '0 0 0'
|
616
610
|
}
|
617
611
|
}, React.createElement(Paper, {
|
612
|
+
style: maxOptionsDisplayed < 12 ? {
|
613
|
+
maxHeight: 40 * maxOptionsDisplayed
|
614
|
+
} : {},
|
618
615
|
className: classes.paper
|
619
616
|
}, (this.placement && this.placement.indexOf('bottom') >= 0 || staticPosition) && searchInput('bottom'), startAdornment, React.createElement(Scrollbars, _extends({
|
620
617
|
ref: contentEl => {
|
621
618
|
this.optionsContent = contentEl;
|
622
619
|
},
|
623
620
|
autoHeight: true,
|
624
|
-
autoHeightMax:
|
621
|
+
autoHeightMax: autoHeightMax
|
625
622
|
}, onScrollReachBottom && {
|
626
623
|
onScroll: this.handleScroll
|
627
624
|
}), React.createElement(HiSelectableList, _extends({
|
@@ -742,7 +739,8 @@ HiSelect.defaultProps = {
|
|
742
739
|
one_child: '%s item'
|
743
740
|
},
|
744
741
|
type: 'text',
|
745
|
-
filterFunc: filterValue
|
742
|
+
filterFunc: filterValue,
|
743
|
+
maxOptionsDisplayed: 12
|
746
744
|
};
|
747
745
|
HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
748
746
|
/**
|
@@ -826,6 +824,11 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
826
824
|
*/
|
827
825
|
loading: PropTypes.bool,
|
828
826
|
|
827
|
+
/**
|
828
|
+
* Nombre max d'items affichés
|
829
|
+
*/
|
830
|
+
maxOptionsDisplayed: PropTypes.number,
|
831
|
+
|
829
832
|
/**
|
830
833
|
* Autorise la sélection de plusieurs valeurs
|
831
834
|
*/
|