@hipay/hipay-material-ui 2.0.0-beta.41 → 2.0.0-beta.42

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,7 +28,15 @@ var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
28
28
  // @inheritedComponent Button
29
29
  var styles = function styles(theme) {
30
30
  return {
31
- root: {},
31
+ root: {
32
+ '&$disabled': {
33
+ color: theme.palette.neutral.contrastText,
34
+ backgroundColor: theme.palette.neutral.main
35
+ }
36
+ },
37
+ flatNeutral: {
38
+ color: theme.palette.neutral.main
39
+ },
32
40
  flatPositive: {
33
41
  color: theme.palette.positive.main,
34
42
  '&:hover': {
@@ -59,16 +67,6 @@ var styles = function styles(theme) {
59
67
  }
60
68
  }
61
69
  },
62
- flatNeutral: {
63
- color: theme.palette.neutral.main,
64
- '&:hover': {
65
- backgroundColor: (0, _colorManipulator.fade)(theme.palette.neutral.main, theme.palette.action.hoverOpacity),
66
- // Reset on touch devices, it doesn't add specificity
67
- '@media (hover: none)': {
68
- backgroundColor: 'transparent'
69
- }
70
- }
71
- },
72
70
 
73
71
  /* Styles applied to the root element if `variant="[contained | fab]"` and `color="positive"`. */
74
72
  containedPositive: {
@@ -152,7 +150,8 @@ var styles = function styles(theme) {
152
150
  '&:hover': {
153
151
  border: "1px solid ".concat(theme.palette.neutral.main)
154
152
  }
155
- }
153
+ },
154
+ disabled: {}
156
155
  };
157
156
  };
158
157
 
@@ -166,18 +165,20 @@ function HiButton(props) {
166
165
  className = props.className,
167
166
  color = props.color,
168
167
  variant = props.variant,
169
- other = (0, _objectWithoutProperties2.default)(props, ["children", "classes", "className", "color", "variant"]);
168
+ disabled = props.disabled,
169
+ other = (0, _objectWithoutProperties2.default)(props, ["children", "classes", "className", "color", "variant", "disabled"]);
170
170
  var hcolor = ['positive', 'negative', 'middle', 'neutral'].includes(color) ? 'inherit' : color;
171
171
  var fab = variant === 'fab' || variant === 'extendedFab';
172
172
  var contained = variant === 'contained' || variant === 'raised';
173
- var buttonClassNames = (0, _classnames.default)(classes.root, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.flatPositive, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'positive'), (0, _defineProperty2.default)(_classNames, classes.flatNegative, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'negative'), (0, _defineProperty2.default)(_classNames, classes.flatMiddle, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'middle'), (0, _defineProperty2.default)(_classNames, classes.flatNeutral, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'neutral'), (0, _defineProperty2.default)(_classNames, classes.containedPositive, (contained || fab) && color === 'positive'), (0, _defineProperty2.default)(_classNames, classes.containedNegative, (contained || fab) && color === 'negative'), (0, _defineProperty2.default)(_classNames, classes.containedMiddle, (contained || fab) && color === 'middle'), (0, _defineProperty2.default)(_classNames, classes.containedNeutral, (contained || fab) && color === 'neutral'), (0, _defineProperty2.default)(_classNames, classes.outlinedPositive, variant === 'outlined' && color === 'positive'), (0, _defineProperty2.default)(_classNames, classes.outlinedNegative, variant === 'outlined' && color === 'negative'), (0, _defineProperty2.default)(_classNames, classes.outlinedMiddle, variant === 'outlined' && color === 'middle'), (0, _defineProperty2.default)(_classNames, classes.outlinedNeutral, variant === 'outlined' && color === 'neutral'), _classNames));
173
+ var buttonClassNames = (0, _classnames.default)(classes.root, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.flatPositive, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'positive'), (0, _defineProperty2.default)(_classNames, classes.flatNegative, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'negative'), (0, _defineProperty2.default)(_classNames, classes.flatMiddle, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'middle'), (0, _defineProperty2.default)(_classNames, classes.flatNeutral, (variant === 'text' || variant === 'flat' || variant === 'outlined') && (color === 'default' || color === 'neutral')), (0, _defineProperty2.default)(_classNames, classes.containedPositive, (contained || fab) && color === 'positive'), (0, _defineProperty2.default)(_classNames, classes.containedNegative, (contained || fab) && color === 'negative'), (0, _defineProperty2.default)(_classNames, classes.containedMiddle, (contained || fab) && color === 'middle'), (0, _defineProperty2.default)(_classNames, classes.containedNeutral, (contained || fab) && (color === 'default' || color === 'neutral')), (0, _defineProperty2.default)(_classNames, classes.outlinedPositive, variant === 'outlined' && color === 'positive'), (0, _defineProperty2.default)(_classNames, classes.outlinedNegative, variant === 'outlined' && color === 'negative'), (0, _defineProperty2.default)(_classNames, classes.outlinedMiddle, variant === 'outlined' && color === 'middle'), (0, _defineProperty2.default)(_classNames, classes.outlinedNeutral, variant === 'outlined' && (color === 'default' || color === 'neutral')), (0, _defineProperty2.default)(_classNames, classes.disabled, disabled), _classNames));
174
174
  return _react.default.createElement(_Button.default, (0, _extends2.default)({
175
175
  className: className,
176
176
  classes: {
177
177
  root: buttonClassNames
178
178
  },
179
179
  color: hcolor,
180
- variant: variant
180
+ variant: variant,
181
+ disabled: disabled
181
182
  }, other), children);
182
183
  }
183
184
 
@@ -203,7 +204,7 @@ HiButton.propTypes = process.env.NODE_ENV !== "production" ? {
203
204
  variant: _propTypes.default.oneOf(['text', 'flat', 'outlined', 'contained', 'raised', 'fab', 'extendedFab'])
204
205
  } : {};
205
206
  HiButton.defaultProps = {
206
- color: 'default',
207
+ color: 'neutral',
207
208
  variant: 'text'
208
209
  };
209
210
 
package/HiForm/HiInput.js CHANGED
@@ -390,6 +390,15 @@ function (_React$PureComponent) {
390
390
  }
391
391
  }));
392
392
  }
393
+ }], [{
394
+ key: "getDerivedStateFromProps",
395
+ value: function getDerivedStateFromProps(nextProps, prevState) {
396
+ if (typeof nextProps.focused !== 'undefined' && nextProps.focused !== prevState.focused) {
397
+ return {
398
+ focused: nextProps.focused
399
+ };
400
+ }
401
+ }
393
402
  }]);
394
403
  return HiInput;
395
404
  }(_react.default.PureComponent);
@@ -445,6 +454,12 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
445
454
  */
446
455
  error: _propTypes.default.bool,
447
456
 
457
+ /**
458
+ * Force le focus de l'input et surcharge le comportement par défaut
459
+ * où le focus est géré dans le state.
460
+ */
461
+ focused: _propTypes.default.bool,
462
+
448
463
  /**
449
464
  * Utile pour surcharger les classes de l'input
450
465
  */
@@ -59,11 +59,11 @@ var styles = function styles(theme) {
59
59
  backgroundColor: theme.palette.background2,
60
60
  maxWidth: 500,
61
61
  width: '100%',
62
- position: 'relative'
62
+ position: 'relative',
63
+ zIndex: 1
63
64
  },
64
65
  popper: {
65
- width: '100%',
66
- zIndex: 1200
66
+ width: '100%'
67
67
  },
68
68
  paper: {
69
69
  borderRadius: '0px 2px',
@@ -181,14 +181,54 @@ function (_React$PureComponent) {
181
181
  }
182
182
  };
183
183
 
184
+ _this.handleKeyDownReset = function (event) {
185
+ var key = (0, _keycode.default)(event);
186
+
187
+ if (key === 'enter' || key === 'space') {
188
+ _this.handleReset(event);
189
+
190
+ event.stopPropagation();
191
+ event.preventDefault();
192
+ }
193
+ };
194
+
184
195
  _this.handleClick = function (event) {
185
196
  if ((!_this.resetIcon || !_this.resetIcon.contains(event.target)) && _this.props.onClick) {
186
197
  _this.props.onClick(event);
187
198
  }
188
199
  };
189
200
 
201
+ _this.handleReset = function (event) {
202
+ _this.props.onReset(event);
203
+
204
+ if (_this.input) {
205
+ _this.input.focus();
206
+ }
207
+ };
208
+
209
+ _this.handleBlur = function (event) {
210
+ if ((!_this.input || !_this.input.contains(event.relatedTarget)) && _this.props.onBlur) {
211
+ _this.props.onBlur(event);
212
+ } else {
213
+ if (_this.input && (!_this.resetIcon || !_this.resetIcon.contains(event.relatedTarget))) {
214
+ _this.input.focus();
215
+ }
216
+ }
217
+ };
218
+
219
+ _this.handleRef = function (el) {
220
+ _this.input = el;
221
+
222
+ if (_this.props.refElement) {
223
+ _this.props.refElement(el);
224
+ }
225
+ };
226
+
190
227
  _this.handleKeyDown = _this.handleKeyDown.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
191
228
  _this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
229
+ _this.handleBlur = _this.handleBlur.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
230
+ _this.handleRef = _this.handleRef.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
231
+ _this.handleReset = _this.handleReset.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
192
232
  return _this;
193
233
  }
194
234
 
@@ -210,9 +250,7 @@ function (_React$PureComponent) {
210
250
  focused = _this$props.focused,
211
251
  error = _this$props.error,
212
252
  id = _this$props.id,
213
- placeholder = _this$props.placeholder,
214
- refElement = _this$props.refElement,
215
- theme = _this$props.theme; // On utilise classNames pour variabiliser les styles et merge les classes appliquées
253
+ placeholder = _this$props.placeholder; // On utilise classNames pour variabiliser les styles et merge les classes appliquées
216
254
 
217
255
  var rootClass = (0, _classnames.default)(classes.root, classes.inkbar, classes.underline, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.disabled, disabled), (0, _defineProperty2.default)(_classNames, classes.focused, focused), (0, _defineProperty2.default)(_classNames, classes.error, error && !focused), _classNames));
218
256
  var iconClass = (0, _classnames.default)(classes.icon, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, classes.iconOpen, open), (0, _defineProperty2.default)(_classNames2, classes.iconClose, !open), _classNames2));
@@ -227,9 +265,7 @@ function (_React$PureComponent) {
227
265
  onBlur: this.props.onBlur,
228
266
  role: "button",
229
267
  tabIndex: "0",
230
- ref: function ref(el) {
231
- if (refElement) refElement(el);
232
- }
268
+ ref: this.handleRef
233
269
  }, _react.default.createElement("span", {
234
270
  className: (0, _classnames.default)(classes.label, (0, _defineProperty2.default)({}, classes.placeholder, value === undefined))
235
271
  }, value || placeholder), _react.default.createElement(_ArrowDropDown.default, {
@@ -243,10 +279,8 @@ function (_React$PureComponent) {
243
279
  onMouseLeave: this.props.onMouseLeave,
244
280
  onKeyDown: this.handleKeyDown,
245
281
  onFocus: this.props.onFocus,
246
- onBlur: this.props.onBlur,
247
- buttonRef: function buttonRef(el) {
248
- if (refElement) refElement(el);
249
- }
282
+ onBlur: this.handleBlur,
283
+ buttonRef: this.handleRef
250
284
  }, _react.default.createElement("span", {
251
285
  className: (0, _classnames.default)(classes.label, (0, _defineProperty2.default)({}, classes.placeholder, value === undefined))
252
286
  }, value || placeholder), onReset && focused && _react.default.createElement("div", {
@@ -255,9 +289,11 @@ function (_React$PureComponent) {
255
289
  }
256
290
  }, _react.default.createElement(_HiIcon.default, {
257
291
  icon: "close",
258
- size: 24,
259
- color: theme.palette.neutral.main,
260
- onClick: onReset
292
+ size: 20,
293
+ color: "neutral",
294
+ onClick: this.handleReset,
295
+ onKeyDown: this.handleKeyDownReset,
296
+ tabIndex: 0
261
297
  })), _react.default.createElement(_Icon.default, {
262
298
  classes: {
263
299
  root: iconClass
@@ -370,8 +406,7 @@ HiSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
370
406
 
371
407
  var _default = (0, _withStyles.default)(styles, {
372
408
  hiComponent: true,
373
- name: 'HmuiHiSelectInput',
374
- withTheme: true
409
+ name: 'HmuiHiSelectInput'
375
410
  })(HiSelectInput);
376
411
 
377
412
  exports.default = _default;
@@ -8,7 +8,15 @@ import { withStyles } from '../styles';
8
8
  import { fade } from '../styles/colorManipulator';
9
9
  import Button from '@material-ui/core/Button';
10
10
  export const styles = theme => ({
11
- root: {},
11
+ root: {
12
+ '&$disabled': {
13
+ color: theme.palette.neutral.contrastText,
14
+ backgroundColor: theme.palette.neutral.main
15
+ }
16
+ },
17
+ flatNeutral: {
18
+ color: theme.palette.neutral.main
19
+ },
12
20
  flatPositive: {
13
21
  color: theme.palette.positive.main,
14
22
  '&:hover': {
@@ -39,16 +47,6 @@ export const styles = theme => ({
39
47
  }
40
48
  }
41
49
  },
42
- flatNeutral: {
43
- color: theme.palette.neutral.main,
44
- '&:hover': {
45
- backgroundColor: fade(theme.palette.neutral.main, theme.palette.action.hoverOpacity),
46
- // Reset on touch devices, it doesn't add specificity
47
- '@media (hover: none)': {
48
- backgroundColor: 'transparent'
49
- }
50
- }
51
- },
52
50
 
53
51
  /* Styles applied to the root element if `variant="[contained | fab]"` and `color="positive"`. */
54
52
  containedPositive: {
@@ -132,7 +130,8 @@ export const styles = theme => ({
132
130
  '&:hover': {
133
131
  border: `1px solid ${theme.palette.neutral.main}`
134
132
  }
135
- }
133
+ },
134
+ disabled: {}
136
135
  });
137
136
 
138
137
  function HiButton(props) {
@@ -141,9 +140,10 @@ function HiButton(props) {
141
140
  classes,
142
141
  className,
143
142
  color,
144
- variant
143
+ variant,
144
+ disabled
145
145
  } = props,
146
- other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "variant"]);
146
+ other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "variant", "disabled"]);
147
147
 
148
148
  const hcolor = ['positive', 'negative', 'middle', 'neutral'].includes(color) ? 'inherit' : color;
149
149
  const fab = variant === 'fab' || variant === 'extendedFab';
@@ -152,15 +152,16 @@ function HiButton(props) {
152
152
  [classes.flatPositive]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'positive',
153
153
  [classes.flatNegative]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'negative',
154
154
  [classes.flatMiddle]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'middle',
155
- [classes.flatNeutral]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'neutral',
155
+ [classes.flatNeutral]: (variant === 'text' || variant === 'flat' || variant === 'outlined') && (color === 'default' || color === 'neutral'),
156
156
  [classes.containedPositive]: (contained || fab) && color === 'positive',
157
157
  [classes.containedNegative]: (contained || fab) && color === 'negative',
158
158
  [classes.containedMiddle]: (contained || fab) && color === 'middle',
159
- [classes.containedNeutral]: (contained || fab) && color === 'neutral',
159
+ [classes.containedNeutral]: (contained || fab) && (color === 'default' || color === 'neutral'),
160
160
  [classes.outlinedPositive]: variant === 'outlined' && color === 'positive',
161
161
  [classes.outlinedNegative]: variant === 'outlined' && color === 'negative',
162
162
  [classes.outlinedMiddle]: variant === 'outlined' && color === 'middle',
163
- [classes.outlinedNeutral]: variant === 'outlined' && color === 'neutral'
163
+ [classes.outlinedNeutral]: variant === 'outlined' && (color === 'default' || color === 'neutral'),
164
+ [classes.disabled]: disabled
164
165
  });
165
166
  return React.createElement(Button, _extends({
166
167
  className: className,
@@ -168,7 +169,8 @@ function HiButton(props) {
168
169
  root: buttonClassNames
169
170
  },
170
171
  color: hcolor,
171
- variant: variant
172
+ variant: variant,
173
+ disabled: disabled
172
174
  }, other), children);
173
175
  }
174
176
 
@@ -194,7 +196,7 @@ HiButton.propTypes = process.env.NODE_ENV !== "production" ? {
194
196
  variant: PropTypes.oneOf(['text', 'flat', 'outlined', 'contained', 'raised', 'fab', 'extendedFab'])
195
197
  } : {};
196
198
  HiButton.defaultProps = {
197
- color: 'default',
199
+ color: 'neutral',
198
200
  variant: 'text'
199
201
  };
200
202
  export default withStyles(styles, {
@@ -141,6 +141,14 @@ class HiInput extends React.PureComponent {
141
141
  this.handleOverlayRef = this.handleOverlayRef.bind(this);
142
142
  }
143
143
 
144
+ static getDerivedStateFromProps(nextProps, prevState) {
145
+ if (typeof nextProps.focused !== 'undefined' && nextProps.focused !== prevState.focused) {
146
+ return {
147
+ focused: nextProps.focused
148
+ };
149
+ }
150
+ }
151
+
144
152
  getInputElement(el) {
145
153
  this.inputElement = el;
146
154
 
@@ -403,6 +411,12 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
403
411
  */
404
412
  error: PropTypes.bool,
405
413
 
414
+ /**
415
+ * Force le focus de l'input et surcharge le comportement par défaut
416
+ * où le focus est géré dans le state.
417
+ */
418
+ focused: PropTypes.bool,
419
+
406
420
  /**
407
421
  * Utile pour surcharger les classes de l'input
408
422
  */
@@ -20,11 +20,11 @@ export const styles = theme => ({
20
20
  backgroundColor: theme.palette.background2,
21
21
  maxWidth: 500,
22
22
  width: '100%',
23
- position: 'relative'
23
+ position: 'relative',
24
+ zIndex: 1
24
25
  },
25
26
  popper: {
26
- width: '100%',
27
- zIndex: 1200
27
+ width: '100%'
28
28
  },
29
29
  paper: {
30
30
  borderRadius: '0px 2px',
@@ -135,14 +135,53 @@ class HiSelectInput extends React.PureComponent {
135
135
  }
136
136
  };
137
137
 
138
+ this.handleKeyDownReset = event => {
139
+ const key = keycode(event);
140
+
141
+ if (key === 'enter' || key === 'space') {
142
+ this.handleReset(event);
143
+ event.stopPropagation();
144
+ event.preventDefault();
145
+ }
146
+ };
147
+
138
148
  this.handleClick = event => {
139
149
  if ((!this.resetIcon || !this.resetIcon.contains(event.target)) && this.props.onClick) {
140
150
  this.props.onClick(event);
141
151
  }
142
152
  };
143
153
 
154
+ this.handleReset = event => {
155
+ this.props.onReset(event);
156
+
157
+ if (this.input) {
158
+ this.input.focus();
159
+ }
160
+ };
161
+
162
+ this.handleBlur = event => {
163
+ if ((!this.input || !this.input.contains(event.relatedTarget)) && this.props.onBlur) {
164
+ this.props.onBlur(event);
165
+ } else {
166
+ if (this.input && (!this.resetIcon || !this.resetIcon.contains(event.relatedTarget))) {
167
+ this.input.focus();
168
+ }
169
+ }
170
+ };
171
+
172
+ this.handleRef = el => {
173
+ this.input = el;
174
+
175
+ if (this.props.refElement) {
176
+ this.props.refElement(el);
177
+ }
178
+ };
179
+
144
180
  this.handleKeyDown = this.handleKeyDown.bind(this);
145
181
  this.handleClick = this.handleClick.bind(this);
182
+ this.handleBlur = this.handleBlur.bind(this);
183
+ this.handleRef = this.handleRef.bind(this);
184
+ this.handleReset = this.handleReset.bind(this);
146
185
  }
147
186
 
148
187
  render() {
@@ -157,9 +196,7 @@ class HiSelectInput extends React.PureComponent {
157
196
  focused,
158
197
  error,
159
198
  id,
160
- placeholder,
161
- refElement,
162
- theme
199
+ placeholder
163
200
  } = this.props; // On utilise classNames pour variabiliser les styles et merge les classes appliquées
164
201
 
165
202
  const rootClass = classNames(classes.root, classes.inkbar, classes.underline, {
@@ -182,9 +219,7 @@ class HiSelectInput extends React.PureComponent {
182
219
  onBlur: this.props.onBlur,
183
220
  role: "button",
184
221
  tabIndex: "0",
185
- ref: el => {
186
- if (refElement) refElement(el);
187
- }
222
+ ref: this.handleRef
188
223
  }, React.createElement("span", {
189
224
  className: classNames(classes.label, {
190
225
  [classes.placeholder]: value === undefined
@@ -200,10 +235,8 @@ class HiSelectInput extends React.PureComponent {
200
235
  onMouseLeave: this.props.onMouseLeave,
201
236
  onKeyDown: this.handleKeyDown,
202
237
  onFocus: this.props.onFocus,
203
- onBlur: this.props.onBlur,
204
- buttonRef: el => {
205
- if (refElement) refElement(el);
206
- }
238
+ onBlur: this.handleBlur,
239
+ buttonRef: this.handleRef
207
240
  }, React.createElement("span", {
208
241
  className: classNames(classes.label, {
209
242
  [classes.placeholder]: value === undefined
@@ -214,9 +247,11 @@ class HiSelectInput extends React.PureComponent {
214
247
  }
215
248
  }, React.createElement(HiIcon, {
216
249
  icon: "close",
217
- size: 24,
218
- color: theme.palette.neutral.main,
219
- onClick: onReset
250
+ size: 20,
251
+ color: "neutral",
252
+ onClick: this.handleReset,
253
+ onKeyDown: this.handleKeyDownReset,
254
+ tabIndex: 0
220
255
  })), React.createElement(Icon, {
221
256
  classes: {
222
257
  root: iconClass
@@ -327,6 +362,5 @@ HiSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
327
362
  } : {};
328
363
  export default withStyles(styles, {
329
364
  hiComponent: true,
330
- name: 'HmuiHiSelectInput',
331
- withTheme: true
365
+ name: 'HmuiHiSelectInput'
332
366
  })(HiSelectInput);
package/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.0.0-beta.41
1
+ /** @license HiPay-Material-UI v2.0.0-beta.42
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.0.0-beta.41
1
+ /** @license HiPay-Material-UI v2.0.0-beta.42
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@hipay/hipay-material-ui",
3
3
  "private": false,
4
4
  "author": "HiPay PSYCHE Team",
5
- "version": "2.0.0-beta.41",
5
+ "version": "2.0.0-beta.42",
6
6
  "description": "React components that implement Google's Material Design.",
7
7
  "keywords": [
8
8
  "react",
@@ -1,4 +1,4 @@
1
- /** @license HiPay-Material-UI v2.0.0-beta.41
1
+ /** @license HiPay-Material-UI v2.0.0-beta.42
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -13289,7 +13289,15 @@
13289
13289
 
13290
13290
  var styles = function styles(theme) {
13291
13291
  return {
13292
- root: {},
13292
+ root: {
13293
+ '&$disabled': {
13294
+ color: theme.palette.neutral.contrastText,
13295
+ backgroundColor: theme.palette.neutral.main
13296
+ }
13297
+ },
13298
+ flatNeutral: {
13299
+ color: theme.palette.neutral.main
13300
+ },
13293
13301
  flatPositive: {
13294
13302
  color: theme.palette.positive.main,
13295
13303
  '&:hover': {
@@ -13320,16 +13328,6 @@
13320
13328
  }
13321
13329
  }
13322
13330
  },
13323
- flatNeutral: {
13324
- color: theme.palette.neutral.main,
13325
- '&:hover': {
13326
- backgroundColor: fade(theme.palette.neutral.main, theme.palette.action.hoverOpacity),
13327
- // Reset on touch devices, it doesn't add specificity
13328
- '@media (hover: none)': {
13329
- backgroundColor: 'transparent'
13330
- }
13331
- }
13332
- },
13333
13331
 
13334
13332
  /* Styles applied to the root element if `variant="[contained | fab]"` and `color="positive"`. */
13335
13333
  containedPositive: {
@@ -13413,7 +13411,8 @@
13413
13411
  '&:hover': {
13414
13412
  border: "1px solid ".concat(theme.palette.neutral.main)
13415
13413
  }
13416
- }
13414
+ },
13415
+ disabled: {}
13417
13416
  };
13418
13417
  };
13419
13418
 
@@ -13425,19 +13424,21 @@
13425
13424
  className = props.className,
13426
13425
  color = props.color,
13427
13426
  variant = props.variant,
13428
- other = objectWithoutProperties(props, ["children", "classes", "className", "color", "variant"]);
13427
+ disabled = props.disabled,
13428
+ other = objectWithoutProperties(props, ["children", "classes", "className", "color", "variant", "disabled"]);
13429
13429
 
13430
13430
  var hcolor = ['positive', 'negative', 'middle', 'neutral'].includes(color) ? 'inherit' : color;
13431
13431
  var fab = variant === 'fab' || variant === 'extendedFab';
13432
13432
  var contained = variant === 'contained' || variant === 'raised';
13433
- var buttonClassNames = classnames(classes.root, (_classNames = {}, defineProperty(_classNames, classes.flatPositive, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'positive'), defineProperty(_classNames, classes.flatNegative, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'negative'), defineProperty(_classNames, classes.flatMiddle, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'middle'), defineProperty(_classNames, classes.flatNeutral, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'neutral'), defineProperty(_classNames, classes.containedPositive, (contained || fab) && color === 'positive'), defineProperty(_classNames, classes.containedNegative, (contained || fab) && color === 'negative'), defineProperty(_classNames, classes.containedMiddle, (contained || fab) && color === 'middle'), defineProperty(_classNames, classes.containedNeutral, (contained || fab) && color === 'neutral'), defineProperty(_classNames, classes.outlinedPositive, variant === 'outlined' && color === 'positive'), defineProperty(_classNames, classes.outlinedNegative, variant === 'outlined' && color === 'negative'), defineProperty(_classNames, classes.outlinedMiddle, variant === 'outlined' && color === 'middle'), defineProperty(_classNames, classes.outlinedNeutral, variant === 'outlined' && color === 'neutral'), _classNames));
13433
+ var buttonClassNames = classnames(classes.root, (_classNames = {}, defineProperty(_classNames, classes.flatPositive, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'positive'), defineProperty(_classNames, classes.flatNegative, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'negative'), defineProperty(_classNames, classes.flatMiddle, (variant === 'text' || variant === 'flat' || variant === 'outlined') && color === 'middle'), defineProperty(_classNames, classes.flatNeutral, (variant === 'text' || variant === 'flat' || variant === 'outlined') && (color === 'default' || color === 'neutral')), defineProperty(_classNames, classes.containedPositive, (contained || fab) && color === 'positive'), defineProperty(_classNames, classes.containedNegative, (contained || fab) && color === 'negative'), defineProperty(_classNames, classes.containedMiddle, (contained || fab) && color === 'middle'), defineProperty(_classNames, classes.containedNeutral, (contained || fab) && (color === 'default' || color === 'neutral')), defineProperty(_classNames, classes.outlinedPositive, variant === 'outlined' && color === 'positive'), defineProperty(_classNames, classes.outlinedNegative, variant === 'outlined' && color === 'negative'), defineProperty(_classNames, classes.outlinedMiddle, variant === 'outlined' && color === 'middle'), defineProperty(_classNames, classes.outlinedNeutral, variant === 'outlined' && (color === 'default' || color === 'neutral')), defineProperty(_classNames, classes.disabled, disabled), _classNames));
13434
13434
  return React__default.createElement(Button$2, _extends_1({
13435
13435
  className: className,
13436
13436
  classes: {
13437
13437
  root: buttonClassNames
13438
13438
  },
13439
13439
  color: hcolor,
13440
- variant: variant
13440
+ variant: variant,
13441
+ disabled: disabled
13441
13442
  }, other), children);
13442
13443
  }
13443
13444
 
@@ -13463,7 +13464,7 @@
13463
13464
  variant: propTypes.oneOf(['text', 'flat', 'outlined', 'contained', 'raised', 'fab', 'extendedFab'])
13464
13465
  };
13465
13466
  HiButton.defaultProps = {
13466
- color: 'default',
13467
+ color: 'neutral',
13467
13468
  variant: 'text'
13468
13469
  };
13469
13470
  var HiButton$1 = withStyles(styles, {
@@ -68873,6 +68874,15 @@
68873
68874
  }
68874
68875
  }));
68875
68876
  }
68877
+ }], [{
68878
+ key: "getDerivedStateFromProps",
68879
+ value: function getDerivedStateFromProps(nextProps, prevState) {
68880
+ if (typeof nextProps.focused !== 'undefined' && nextProps.focused !== prevState.focused) {
68881
+ return {
68882
+ focused: nextProps.focused
68883
+ };
68884
+ }
68885
+ }
68876
68886
  }]);
68877
68887
 
68878
68888
  return HiInput;
@@ -68929,6 +68939,12 @@
68929
68939
  */
68930
68940
  error: propTypes.bool,
68931
68941
 
68942
+ /**
68943
+ * Force le focus de l'input et surcharge le comportement par défaut
68944
+ * où le focus est géré dans le state.
68945
+ */
68946
+ focused: propTypes.bool,
68947
+
68932
68948
  /**
68933
68949
  * Utile pour surcharger les classes de l'input
68934
68950
  */