@hipay/hipay-material-ui 2.0.0-beta.56 → 2.0.0-beta.58
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.
- package/CHANGELOG.md +117 -0
- package/HiAlertModal/HiAlertModal.js +56 -13
- package/HiColoredLabel/HiColoredLabel.js +1 -1
- package/HiDatePicker/Caption.js +8 -1
- package/HiDatePicker/HiDatePicker.js +9 -3
- package/HiDatePicker/HiDateRangePicker.js +9 -3
- package/HiDatePicker/HiDateRangeSelector.js +54 -4
- package/HiDatePicker/NavBar.js +8 -1
- package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +123 -0
- package/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
- package/HiDatePicker/Overlays/YearPickerOverlay.js +2 -2
- package/HiDatePicker/hiLocaleUtils.js +144 -0
- package/HiDatePicker/stylesheet.js +31 -6
- package/HiForm/HiFormControl.js +4 -4
- package/HiForm/HiInput.js +19 -7
- package/HiForm/HiUploadField.js +2 -1
- package/HiNotice/HiKPI.js +3 -3
- package/HiNotice/HiKPINotice.js +12 -9
- package/HiPin/HiPin.js +1 -1
- package/HiSelect/HiSelect.js +6 -5
- package/HiSelect/HiSuggestSelect.js +21 -2
- package/HiSelect/SelectInput.js +5 -1
- package/HiSelectNew/HiSelect.js +163 -59
- package/HiSelectNew/HiSelectInput.js +8 -1
- package/HiSelectableList/HiSelectableList.js +4 -30
- package/HiSelectableList/HiSelectableListItem.js +19 -12
- package/README.md +9 -10
- package/es/HiAlertModal/HiAlertModal.js +55 -13
- package/es/HiColoredLabel/HiColoredLabel.js +1 -1
- package/es/HiDatePicker/Caption.js +7 -1
- package/es/HiDatePicker/HiDatePicker.js +8 -3
- package/es/HiDatePicker/HiDateRangePicker.js +8 -3
- package/es/HiDatePicker/HiDateRangeSelector.js +48 -4
- package/es/HiDatePicker/NavBar.js +7 -1
- package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +106 -0
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +2 -2
- package/es/HiDatePicker/hiLocaleUtils.js +131 -0
- package/es/HiDatePicker/stylesheet.js +30 -6
- package/es/HiForm/HiFormControl.js +4 -4
- package/es/HiForm/HiInput.js +19 -7
- package/es/HiForm/HiUploadField.js +2 -1
- package/es/HiNotice/HiKPI.js +3 -3
- package/es/HiNotice/HiKPINotice.js +10 -9
- package/es/HiPin/HiPin.js +1 -1
- package/es/HiSelect/HiSelect.js +6 -5
- package/es/HiSelect/HiSuggestSelect.js +21 -2
- package/es/HiSelect/SelectInput.js +5 -1
- package/es/HiSelectNew/HiSelect.js +166 -56
- package/es/HiSelectNew/HiSelectInput.js +7 -1
- package/es/HiSelectableList/HiSelectableList.js +5 -25
- package/es/HiSelectableList/HiSelectableListItem.js +23 -16
- package/es/index.js +2 -1
- package/index.es.js +2 -1
- package/index.js +10 -2
- package/package.json +1 -1
- package/umd/hipay-material-ui.development.js +6207 -1359
- package/umd/hipay-material-ui.production.min.js +2 -2
package/HiSelectNew/HiSelect.js
CHANGED
@@ -37,8 +37,6 @@ var _Paper = _interopRequireDefault(require("@material-ui/core/Paper"));
|
|
37
37
|
|
38
38
|
var _Popper = _interopRequireDefault(require("@material-ui/core/Popper"));
|
39
39
|
|
40
|
-
var _reactDom = require("react-dom");
|
41
|
-
|
42
40
|
var _ClickAwayListener = _interopRequireDefault(require("@material-ui/core/ClickAwayListener"));
|
43
41
|
|
44
42
|
var _HiSelectableList = _interopRequireDefault(require("../HiSelectableList"));
|
@@ -106,7 +104,10 @@ var styles = function styles(theme) {
|
|
106
104
|
}, theme.typography.b1, {
|
107
105
|
display: 'inline-flex',
|
108
106
|
width: '100%'
|
109
|
-
})
|
107
|
+
}),
|
108
|
+
separator: {
|
109
|
+
borderTop: "1px solid ".concat(theme.palette.input.bottomLine)
|
110
|
+
}
|
110
111
|
};
|
111
112
|
};
|
112
113
|
/**
|
@@ -203,7 +204,14 @@ function (_React$PureComponent) {
|
|
203
204
|
}, _react.default.createElement("img", {
|
204
205
|
className: classes.labelImg,
|
205
206
|
src: item.img,
|
206
|
-
alt: item.label
|
207
|
+
alt: item.label,
|
208
|
+
onError: function onError(e) {
|
209
|
+
if (item.fallbackImage) {
|
210
|
+
e.target.src = "".concat(item.fallbackImage);
|
211
|
+
} else {
|
212
|
+
e.target.style.display = 'none';
|
213
|
+
}
|
214
|
+
}
|
207
215
|
}), item.label);
|
208
216
|
} else {
|
209
217
|
inputValue = item.label;
|
@@ -214,11 +222,13 @@ function (_React$PureComponent) {
|
|
214
222
|
};
|
215
223
|
|
216
224
|
_this.focusOnFirstItem = function () {
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
225
|
+
if (_this.overlay && _this.overlay.getElementsByTagName('li')[0]) {
|
226
|
+
setTimeout(function () {
|
227
|
+
var item = _this.overlay.getElementsByTagName('li')[0];
|
228
|
+
|
229
|
+
item.focus();
|
230
|
+
}, 1);
|
231
|
+
}
|
222
232
|
};
|
223
233
|
|
224
234
|
_this.getInputElement = function (el) {
|
@@ -257,15 +267,14 @@ function (_React$PureComponent) {
|
|
257
267
|
};
|
258
268
|
|
259
269
|
_this.focusOnSelectedItem = function (selectedValue) {
|
260
|
-
var overlay = (0, _reactDom.findDOMNode)(_this.overlay);
|
261
270
|
setTimeout(function () {
|
262
271
|
// On initialise au premier élément pour être sûr de ne pas se retrouver avec un focus of undefined
|
263
|
-
var item = overlay.getElementsByTagName('li')[0];
|
272
|
+
var item = _this.overlay.getElementsByTagName('li')[0];
|
264
273
|
|
265
274
|
if (selectedValue && typeof selectedValue === 'string') {
|
266
|
-
item = overlay.getElementsByTagName('li')[selectedValue];
|
275
|
+
item = _this.overlay.getElementsByTagName('li')[selectedValue];
|
267
276
|
} else if (selectedValue && typeof selectedValue === 'number') {
|
268
|
-
item = overlay.getElementsByTagName('li')[selectedValue - 1];
|
277
|
+
item = _this.overlay.getElementsByTagName('li')[selectedValue - 1];
|
269
278
|
}
|
270
279
|
|
271
280
|
if (item) {
|
@@ -303,6 +312,18 @@ function (_React$PureComponent) {
|
|
303
312
|
});
|
304
313
|
};
|
305
314
|
|
315
|
+
_this.handleKeyDownInput = function (event) {
|
316
|
+
var key = (0, _keycode.default)(event);
|
317
|
+
|
318
|
+
if (key === 'down' || key === 'up') {
|
319
|
+
_this.handleClick();
|
320
|
+
} else if (key === 'enter' && _this.props.onSubmit) {
|
321
|
+
event.preventDefault();
|
322
|
+
|
323
|
+
_this.props.onSubmit(event);
|
324
|
+
}
|
325
|
+
};
|
326
|
+
|
306
327
|
_this.handleKeyDown = function (event) {
|
307
328
|
var nextItem;
|
308
329
|
var key = (0, _keycode.default)(event);
|
@@ -317,23 +338,73 @@ function (_React$PureComponent) {
|
|
317
338
|
_this.setState({
|
318
339
|
open: false
|
319
340
|
});
|
320
|
-
} else if (key === 'space'
|
341
|
+
} else if (key === 'space') {
|
342
|
+
// Cancel scroll
|
321
343
|
event.preventDefault();
|
344
|
+
}
|
345
|
+
|
346
|
+
if (nextItem) {
|
347
|
+
nextItem.focus();
|
348
|
+
}
|
349
|
+
};
|
350
|
+
|
351
|
+
_this.getItemById = function (id) {
|
352
|
+
var item;
|
353
|
+
|
354
|
+
if (_this.props.hasAll && String(id) === '_all') {
|
355
|
+
return {
|
356
|
+
id: '_all'
|
357
|
+
};
|
358
|
+
}
|
359
|
+
|
360
|
+
for (var i = 0; i < _this.props.options.length; i += 1) {
|
361
|
+
var elem = _this.props.options[i];
|
362
|
+
|
363
|
+
if (String(elem.id) === String(id)) {
|
364
|
+
item = elem;
|
365
|
+
break;
|
366
|
+
}
|
367
|
+
|
368
|
+
if (elem.children) {
|
369
|
+
for (var j = 0; j < elem.children.length; j += 1) {
|
370
|
+
if (String(elem.children[j].id) === String(id)) {
|
371
|
+
item = elem.children[j];
|
372
|
+
break;
|
373
|
+
}
|
374
|
+
}
|
375
|
+
}
|
376
|
+
}
|
377
|
+
|
378
|
+
return item;
|
379
|
+
};
|
380
|
+
|
381
|
+
_this.handleKeyUp = function (event) {
|
382
|
+
var key = (0, _keycode.default)(event);
|
322
383
|
|
323
|
-
|
324
|
-
|
384
|
+
if (key === 'esc') {
|
385
|
+
_this.setState({
|
386
|
+
open: false
|
325
387
|
});
|
388
|
+
} else if (key === 'space' || key === 'enter' && !_this.props.multiple) {
|
389
|
+
event.preventDefault();
|
390
|
+
|
391
|
+
var item = _this.getItemById(event.target.id);
|
326
392
|
|
327
|
-
|
393
|
+
if (item) {
|
394
|
+
// Select for nested select
|
395
|
+
if (_this.props.hiSelectableListProps && _this.props.hiSelectableListProps.onSelect) {
|
396
|
+
_this.props.hiSelectableListProps.onSelect(null, item);
|
397
|
+
} else {
|
398
|
+
_this.handleSelect(null, item);
|
399
|
+
}
|
400
|
+
} else {
|
401
|
+
console.warn("Can not find item #".concat(event.target.id));
|
402
|
+
}
|
328
403
|
} else if (key === 'enter' && _this.props.multiple) {
|
329
404
|
event.preventDefault();
|
330
405
|
|
331
406
|
_this.handleClose();
|
332
407
|
}
|
333
|
-
|
334
|
-
if (nextItem) {
|
335
|
-
nextItem.focus();
|
336
|
-
}
|
337
408
|
};
|
338
409
|
|
339
410
|
_this.handleKeyDownSearch = function (event) {
|
@@ -345,6 +416,10 @@ function (_React$PureComponent) {
|
|
345
416
|
event.preventDefault();
|
346
417
|
|
347
418
|
_this.handleClose();
|
419
|
+
} else if (key === 'tab') {
|
420
|
+
_this.setState({
|
421
|
+
open: false
|
422
|
+
});
|
348
423
|
}
|
349
424
|
};
|
350
425
|
|
@@ -444,7 +519,8 @@ function (_React$PureComponent) {
|
|
444
519
|
open: false,
|
445
520
|
focused: false,
|
446
521
|
searchValue: props.searchValue ? undefined : '',
|
447
|
-
suggestions: props.options
|
522
|
+
suggestions: props.options,
|
523
|
+
openDown: true
|
448
524
|
};
|
449
525
|
_this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
450
526
|
_this.handleClose = _this.handleClose.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
@@ -525,43 +601,70 @@ function (_React$PureComponent) {
|
|
525
601
|
|
526
602
|
var popperClass = (0, _classnames.default)(classes.popper, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.popperWidth, !this.props.containerWidth), (0, _defineProperty2.default)(_classNames, classes.popperRightAlign, this.props.containerWidth && this.props.align === 'right'), _classNames));
|
527
603
|
|
528
|
-
var
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
604
|
+
var searchInput = function searchInput(position) {
|
605
|
+
if (searchable) {
|
606
|
+
return _react.default.createElement(_HiInput.default, (0, _extends2.default)({
|
607
|
+
value: searchValue,
|
608
|
+
autoFocus: true,
|
609
|
+
inputRef: _this2.getInputElement,
|
610
|
+
onKeyDown: _this2.handleKeyDownSearch,
|
611
|
+
onChange: _this2.handleSearch,
|
612
|
+
onReset: _this2.handleSearchReset,
|
613
|
+
placeholder: translations.search,
|
614
|
+
startAdornment: 'search',
|
615
|
+
tabIndex: 0,
|
616
|
+
className: (0, _classnames.default)((0, _defineProperty2.default)({}, classes.separator, position === 'top'))
|
617
|
+
}, hiSearchInputProps));
|
535
618
|
}
|
536
|
-
|
537
|
-
|
538
|
-
}
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
619
|
+
|
620
|
+
return null;
|
621
|
+
}; // Replace popper onSearch when popper displayed on top of selectButton
|
622
|
+
|
623
|
+
|
624
|
+
if (this.placement && this.placement.indexOf('top') >= 0 && !!searchable) {
|
625
|
+
// +1 for search input
|
626
|
+
var nbItems = itemList.length <= 10 ? itemList.length + 1 : 11;
|
627
|
+
popperStyle.transform = "translate3d(-1px, -".concat(nbItems * 40 + 2, "px, 0px)");
|
628
|
+
} else if (this.placement && this.placement.indexOf('top') < 0 && !!searchable) {
|
629
|
+
popperStyle.transform = 'translate3d(-1px, 40px, 0px)';
|
630
|
+
}
|
631
|
+
|
632
|
+
var content = function content(_ref) {
|
633
|
+
var placement = _ref.placement;
|
634
|
+
|
635
|
+
if (placement !== _this2.placement) {
|
636
|
+
_this2.placement = placement;
|
637
|
+
}
|
638
|
+
|
639
|
+
return _react.default.createElement(_ClickAwayListener.default, {
|
640
|
+
onClickAway: _this2.handleClickAway
|
641
|
+
}, _react.default.createElement(_Grow.default, {
|
642
|
+
in: open,
|
643
|
+
id: "menu-list",
|
644
|
+
style: {
|
645
|
+
transformOrigin: '0 0 0'
|
646
|
+
}
|
647
|
+
}, _react.default.createElement(_Paper.default, {
|
648
|
+
className: classes.paper
|
649
|
+
}, (_this2.placement && _this2.placement.indexOf('bottom') >= 0 || staticPosition) && searchInput('bottom'), startAdornment, _react.default.createElement(_reactCustomScrollbars.default, (0, _extends2.default)({
|
650
|
+
ref: function ref(contentEl) {
|
651
|
+
_this2.optionsContent = contentEl;
|
652
|
+
},
|
653
|
+
autoHeight: true,
|
654
|
+
autoHeightMax: 400 // TODO ?
|
655
|
+
|
656
|
+
}, onScrollReachBottom && {
|
657
|
+
onScroll: _this2.handleScroll
|
658
|
+
}), _react.default.createElement(_HiSelectableList.default, (0, _extends2.default)({
|
659
|
+
type: type,
|
660
|
+
itemList: itemList,
|
661
|
+
onKeyDown: _this2.handleKeyDown,
|
662
|
+
onKeyUp: _this2.handleKeyUp,
|
663
|
+
onSelect: _this2.handleSelect,
|
664
|
+
selectedItemIdList: selectedItemIdList,
|
665
|
+
fallbackImage: _this2.props.fallbackImage
|
666
|
+
}, hiSelectableListProps))), _this2.placement && _this2.placement.indexOf('top') >= 0 && !staticPosition && searchInput('top'))));
|
667
|
+
};
|
565
668
|
|
566
669
|
return _react.default.createElement("div", {
|
567
670
|
className: classes.root,
|
@@ -580,6 +683,7 @@ function (_React$PureComponent) {
|
|
580
683
|
onClick: this.handleClick,
|
581
684
|
onFocus: this.handleFocus,
|
582
685
|
onBlur: this.handleBlur,
|
686
|
+
onKeyDown: this.handleKeyDownInput,
|
583
687
|
onSubmit: onSubmit,
|
584
688
|
onMouseEnter: this.props.onMouseEnter,
|
585
689
|
onMouseLeave: this.props.onMouseLeave,
|
@@ -592,7 +696,7 @@ function (_React$PureComponent) {
|
|
592
696
|
})), open && staticPosition ? _react.default.createElement("div", {
|
593
697
|
style: popperStyle,
|
594
698
|
className: popperClass
|
595
|
-
}, content) : _react.default.createElement(_Popper.default, {
|
699
|
+
}, content({})) : _react.default.createElement(_Popper.default, {
|
596
700
|
anchorEl: this.inputEl,
|
597
701
|
placement: "bottom-start",
|
598
702
|
open: open,
|
@@ -172,6 +172,8 @@ function (_React$PureComponent) {
|
|
172
172
|
|
173
173
|
if (_this.props.onKeyDown) {
|
174
174
|
_this.props.onKeyDown(event);
|
175
|
+
|
176
|
+
event.preventDefault();
|
175
177
|
} else if (key === 'down' || key === 'up') {
|
176
178
|
_this.props.onClick();
|
177
179
|
} else if (key === 'enter' && _this.props.onSubmit) {
|
@@ -193,8 +195,12 @@ function (_React$PureComponent) {
|
|
193
195
|
};
|
194
196
|
|
195
197
|
_this.handleClick = function (event) {
|
198
|
+
// Do not open select if press on resetIcon
|
196
199
|
if ((!_this.resetIcon || !_this.resetIcon.contains(event.target)) && _this.props.onClick) {
|
197
|
-
|
200
|
+
// Do not open select if press enter on button => submit form
|
201
|
+
if (event.type !== 'keydown' || (0, _keycode.default)(event) !== 'enter') {
|
202
|
+
_this.props.onClick(event);
|
203
|
+
}
|
198
204
|
}
|
199
205
|
};
|
200
206
|
|
@@ -269,6 +275,7 @@ function (_React$PureComponent) {
|
|
269
275
|
}, value || placeholder), _react.default.createElement(_ArrowDropDown.default, {
|
270
276
|
className: iconClass
|
271
277
|
})) : _react.default.createElement(_ButtonBase.default, {
|
278
|
+
component: "div",
|
272
279
|
id: id,
|
273
280
|
className: rootClass,
|
274
281
|
onClick: this.handleClick,
|
@@ -33,8 +33,6 @@ var _HiSelectableListItem = _interopRequireDefault(require("./HiSelectableListIt
|
|
33
33
|
|
34
34
|
var _helpers = require("../utils/helpers");
|
35
35
|
|
36
|
-
var _keycode = _interopRequireDefault(require("keycode"));
|
37
|
-
|
38
36
|
var styles = function styles() {
|
39
37
|
return {
|
40
38
|
root: {
|
@@ -73,31 +71,6 @@ function (_React$PureComponent) {
|
|
73
71
|
};
|
74
72
|
};
|
75
73
|
|
76
|
-
_this.handleKeyDown = function (event) {
|
77
|
-
var nextItem;
|
78
|
-
var key = (0, _keycode.default)(event);
|
79
|
-
|
80
|
-
if (key === 'down') {
|
81
|
-
event.preventDefault();
|
82
|
-
nextItem = (0, _helpers.getNextItemSelectable)(document.activeElement, 'down');
|
83
|
-
} else if (key === 'up') {
|
84
|
-
event.preventDefault();
|
85
|
-
nextItem = (0, _helpers.getNextItemSelectable)(document.activeElement, 'up');
|
86
|
-
} else if (key === 'space' || key === 'enter' && !_this.props.multiple) {
|
87
|
-
event.preventDefault();
|
88
|
-
|
89
|
-
var item = _this.props.options.find(function (elem) {
|
90
|
-
return String(elem.id) === event.target.id;
|
91
|
-
});
|
92
|
-
|
93
|
-
_this.handleSelect(null, item);
|
94
|
-
}
|
95
|
-
|
96
|
-
if (nextItem) {
|
97
|
-
nextItem.focus();
|
98
|
-
}
|
99
|
-
};
|
100
|
-
|
101
74
|
_this.buildRecursiveListItem = function (item) {
|
102
75
|
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
103
76
|
var _this$props = _this.props,
|
@@ -109,9 +82,9 @@ function (_React$PureComponent) {
|
|
109
82
|
icon = _this$props.icon,
|
110
83
|
selectedItemIdList = _this$props.selectedItemIdList,
|
111
84
|
sort = _this$props.sort,
|
112
|
-
|
113
|
-
|
114
|
-
others = (0, _objectWithoutProperties2.default)(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "selectedItemIdList", "sort", "onKeyDown"]);
|
85
|
+
onKeyDown = _this$props.onKeyDown,
|
86
|
+
onKeyUp = _this$props.onKeyUp,
|
87
|
+
others = (0, _objectWithoutProperties2.default)(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp"]);
|
115
88
|
|
116
89
|
if (sort && item.children) {
|
117
90
|
item.children.sort(_this.compareItem);
|
@@ -128,6 +101,7 @@ function (_React$PureComponent) {
|
|
128
101
|
level: level,
|
129
102
|
onSelect: _this.handleSelect(item),
|
130
103
|
onKeyDown: onKeyDown,
|
104
|
+
onKeyUp: onKeyUp,
|
131
105
|
selected: selectedItemIdList.includes(item.id) // item props override upper props (disabled, hideCheckbox, icon, level...)
|
132
106
|
|
133
107
|
}, item)), item.children && item.children.length > 0 && item.children.filter(function (subItem) {
|
@@ -116,11 +116,7 @@ var styles = function styles(theme) {
|
|
116
116
|
padding: '8px 0',
|
117
117
|
margin: 'auto'
|
118
118
|
},
|
119
|
-
listItemContent: (0, _extends2.default)({
|
120
|
-
whiteSpace: 'nowrap',
|
121
|
-
overflow: 'hidden',
|
122
|
-
textOverflow: 'ellipsis'
|
123
|
-
}, theme.typography.b1, {
|
119
|
+
listItemContent: (0, _extends2.default)({}, theme.typography.b1, {
|
124
120
|
fontWeight: 'inherit',
|
125
121
|
width: '100%',
|
126
122
|
minWidth: '50%',
|
@@ -135,6 +131,10 @@ var styles = function styles(theme) {
|
|
135
131
|
}),
|
136
132
|
listItemContentSelected: {},
|
137
133
|
label: {
|
134
|
+
maxWidth: '100%',
|
135
|
+
whiteSpace: 'nowrap',
|
136
|
+
overflow: 'hidden',
|
137
|
+
textOverflow: 'ellipsis',
|
138
138
|
display: 'inline-block',
|
139
139
|
margin: '1px 0',
|
140
140
|
paddingLeft: 4
|
@@ -295,6 +295,7 @@ function (_React$PureComponent) {
|
|
295
295
|
hideCheckbox = _this$props2.hideCheckbox,
|
296
296
|
onSelect = _this$props2.onSelect,
|
297
297
|
onKeyDown = _this$props2.onKeyDown,
|
298
|
+
onKeyUp = _this$props2.onKeyUp,
|
298
299
|
indeterminate = _this$props2.indeterminate,
|
299
300
|
indeterminateIcon = _this$props2.indeterminateIcon,
|
300
301
|
icon = _this$props2.icon,
|
@@ -342,7 +343,8 @@ function (_React$PureComponent) {
|
|
342
343
|
onClick: onSelect,
|
343
344
|
onMouseEnter: this.setHover(true),
|
344
345
|
onMouseLeave: this.setHover(false),
|
345
|
-
onKeyDown: onKeyDown
|
346
|
+
onKeyDown: onKeyDown,
|
347
|
+
onKeyUp: onKeyUp
|
346
348
|
}, {
|
347
349
|
style: {
|
348
350
|
paddingLeft: "".concat(paddingLeft + level * 32, "px")
|
@@ -361,12 +363,6 @@ function (_React$PureComponent) {
|
|
361
363
|
icon: displayedIcon,
|
362
364
|
indeterminate: indeterminate,
|
363
365
|
indeterminateIcon: indeterminateIcon
|
364
|
-
}), _react.default.createElement("div", {
|
365
|
-
className: (0, _classnames.default)(classes.listItemContent, (_classNames3 = {}, (0, _defineProperty2.default)(_classNames3, classes.centered, centered), (0, _defineProperty2.default)(_classNames3, classes.primaryHighlight, type === 'primary-highlight'), (0, _defineProperty2.default)(_classNames3, classes.listItemContentSelected, selected && color), _classNames3)),
|
366
|
-
"data-id": id
|
367
|
-
}, type === 'icon' && icon && hideCheckbox && _react.default.createElement(_HiIcon.default, {
|
368
|
-
icon: icon,
|
369
|
-
className: classes.icon
|
370
366
|
}), type === 'image' && img && _react.default.createElement("img", {
|
371
367
|
src: img,
|
372
368
|
alt: img,
|
@@ -378,6 +374,12 @@ function (_React$PureComponent) {
|
|
378
374
|
}
|
379
375
|
},
|
380
376
|
className: classes.img
|
377
|
+
}), _react.default.createElement("div", {
|
378
|
+
className: (0, _classnames.default)(classes.listItemContent, (_classNames3 = {}, (0, _defineProperty2.default)(_classNames3, classes.centered, centered), (0, _defineProperty2.default)(_classNames3, classes.primaryHighlight, type === 'primary-highlight'), (0, _defineProperty2.default)(_classNames3, classes.listItemContentSelected, selected && color), _classNames3)),
|
379
|
+
"data-id": id
|
380
|
+
}, type === 'icon' && icon && hideCheckbox && _react.default.createElement(_HiIcon.default, {
|
381
|
+
icon: icon,
|
382
|
+
className: classes.icon
|
381
383
|
}), this.buildItemLabel())), _react.default.createElement("div", {
|
382
384
|
className: (0, _classnames.default)(classes.infosContent, (_classNames4 = {}, (0, _defineProperty2.default)(_classNames4, classes.infosWithoutSecondaryInline, !secondaryInline), (0, _defineProperty2.default)(_classNames4, classes.infosWithSecondaryInline, !secondaryInline), (0, _defineProperty2.default)(_classNames4, classes.infosInlineWithoutSecondary, secondaryInline && !secondaryLabel), _classNames4))
|
383
385
|
}, !!secondaryLabel && _react.default.createElement("div", {
|
@@ -496,6 +498,11 @@ HiSelectableListItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
496
498
|
*/
|
497
499
|
onKeyDown: _propTypes.default.func,
|
498
500
|
|
501
|
+
/**
|
502
|
+
* Fonction de callback à la sélection de l'élément
|
503
|
+
*/
|
504
|
+
onKeyUp: _propTypes.default.func,
|
505
|
+
|
499
506
|
/**
|
500
507
|
* Fonction de callback à la sélection de l'élément
|
501
508
|
*/
|
package/README.md
CHANGED
@@ -13,20 +13,19 @@ Et connaîtres les [best practices](#best-practices)
|
|
13
13
|
|
14
14
|
#### Via docker
|
15
15
|
|
16
|
-
Il faut que sur votre poste soit
|
17
|
-
- [Docker](https://
|
18
|
-
- [Docker Compose](#https://docs.docker.com/compose/install/) (minimum version 1.13.0)
|
16
|
+
Il faut que sur votre poste soit installé
|
17
|
+
- [Docker](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
|
19
18
|
|
20
19
|
Puis lancez les commandes
|
21
20
|
```sh
|
22
|
-
|
23
|
-
docker-compose
|
21
|
+
# En mode dev :
|
22
|
+
docker-compose -f docker-compose.dev.yml build
|
23
|
+
docker-compose -f docker-compose.dev.yml up # -d pour détacher du shell courant
|
24
24
|
|
25
|
-
# En
|
26
|
-
docker-compose
|
25
|
+
# En mode prod :
|
26
|
+
docker-compose -f docker-compose.prod.yml build
|
27
|
+
docker-compose -f docker-compose.prod.yml up # -d pour détacher du shell courant
|
27
28
|
```
|
28
|
-
Le site est dispo à cette URL:
|
29
|
-
[http://localhost:3222](http://localhost:3222)
|
30
29
|
|
31
30
|
#### En local
|
32
31
|
|
@@ -227,7 +226,7 @@ npm install -g conventional-changelog-cli
|
|
227
226
|
npm install -g cz-conventional-changelog
|
228
227
|
```
|
229
228
|
|
230
|
-
1. Changer la version dans package.json
|
229
|
+
1. Changer la version dans packages/hipay-material-ui/package.json
|
231
230
|
2. Générer le fichier HI-CHANGELOG.md : ```npm run changelog```
|
232
231
|
3. Commiter la release : ```git ci -am "chore(release): VERSION DATE```
|
233
232
|
4. Build : ```npm run build```
|
@@ -10,18 +10,25 @@ import DialogContentText from '@material-ui/core/DialogContentText';
|
|
10
10
|
import DialogTitle from '@material-ui/core/DialogTitle';
|
11
11
|
import { withStyles } from '../styles';
|
12
12
|
import HiButton from '../HiButton';
|
13
|
+
import HiIcon from '../HiIcon';
|
13
14
|
export const styles = theme => ({
|
14
15
|
classContent: {
|
15
16
|
fontSize: 14,
|
16
|
-
lineHeight: '
|
17
|
-
color: '#484848'
|
17
|
+
lineHeight: '20px',
|
18
|
+
color: '#484848',
|
19
|
+
position: 'relative'
|
18
20
|
},
|
19
|
-
|
20
|
-
|
21
|
+
classDialogPaper: {
|
22
|
+
minHeight: 280,
|
23
|
+
maxWidth: 280,
|
24
|
+
borderRadius: 2
|
21
25
|
},
|
22
26
|
classCancelButton: {
|
23
27
|
float: 'right'
|
24
28
|
},
|
29
|
+
classSubmitButton: {
|
30
|
+
margin: '0'
|
31
|
+
},
|
25
32
|
classTitle: {
|
26
33
|
fontSize: 20,
|
27
34
|
fontFamily: theme.typography.fontFamily,
|
@@ -29,10 +36,20 @@ export const styles = theme => ({
|
|
29
36
|
lineHeight: '24px'
|
30
37
|
},
|
31
38
|
classAction: {
|
32
|
-
display: 'inline-block'
|
39
|
+
display: 'inline-block',
|
40
|
+
margin: '0',
|
41
|
+
padding: '0px 24px 24px 24px'
|
33
42
|
},
|
34
43
|
classDialogRoot: {
|
35
44
|
backgroundColor: 'rgba(0, 0, 0, 0.28)'
|
45
|
+
},
|
46
|
+
classBackgroundIcon: {
|
47
|
+
position: 'absolute',
|
48
|
+
top: 'calc(50%)',
|
49
|
+
left: '50%',
|
50
|
+
transform: 'translate(-50%, -50%)',
|
51
|
+
color: theme.palette.background2,
|
52
|
+
flex: '1'
|
36
53
|
}
|
37
54
|
});
|
38
55
|
/**
|
@@ -71,6 +88,8 @@ class HiAlertModal extends React.PureComponent {
|
|
71
88
|
render() {
|
72
89
|
const _this$props = this.props,
|
73
90
|
{
|
91
|
+
backgroundIcon,
|
92
|
+
iconSize,
|
74
93
|
classes,
|
75
94
|
content,
|
76
95
|
labelCancelButton,
|
@@ -78,19 +97,25 @@ class HiAlertModal extends React.PureComponent {
|
|
78
97
|
onCancelClick,
|
79
98
|
onSubmitClick,
|
80
99
|
open,
|
100
|
+
cancelColor,
|
81
101
|
submitColor,
|
82
102
|
title
|
83
103
|
} = _this$props,
|
84
|
-
props = _objectWithoutProperties(_this$props, ["classes", "content", "labelCancelButton", "labelSubmitButton", "onCancelClick", "onSubmitClick", "open", "submitColor", "title"]);
|
104
|
+
props = _objectWithoutProperties(_this$props, ["backgroundIcon", "iconSize", "classes", "content", "labelCancelButton", "labelSubmitButton", "onCancelClick", "onSubmitClick", "open", "cancelColor", "submitColor", "title"]);
|
85
105
|
|
86
106
|
return React.createElement(Dialog, _extends({
|
87
107
|
open: open,
|
88
108
|
onClose: this.handleOnClose,
|
89
109
|
classes: {
|
90
|
-
|
91
|
-
|
110
|
+
root: classes.classDialogRoot,
|
111
|
+
paper: classes.classDialogPaper
|
92
112
|
}
|
93
|
-
}, props), React.createElement(
|
113
|
+
}, props), backgroundIcon && React.createElement("div", {
|
114
|
+
className: classes.classBackgroundIcon
|
115
|
+
}, React.createElement(HiIcon, {
|
116
|
+
icon: backgroundIcon,
|
117
|
+
size: iconSize
|
118
|
+
})), React.createElement(DialogTitle, {
|
94
119
|
disableTypography: true,
|
95
120
|
classes: {
|
96
121
|
root: classes.classTitle
|
@@ -103,21 +128,38 @@ class HiAlertModal extends React.PureComponent {
|
|
103
128
|
classes: {
|
104
129
|
root: classes.classAction
|
105
130
|
}
|
106
|
-
}, React.createElement(HiButton, {
|
131
|
+
}, labelSubmitButton && React.createElement(HiButton, {
|
132
|
+
classes: {
|
133
|
+
root: classes.classSubmitButton
|
134
|
+
},
|
107
135
|
onClick: this.handleClickSubmit,
|
108
136
|
color: submitColor
|
109
|
-
}, labelSubmitButton), React.createElement(HiButton, {
|
137
|
+
}, labelSubmitButton), labelCancelButton && React.createElement(HiButton, {
|
110
138
|
classes: {
|
111
139
|
root: classes.classCancelButton
|
112
140
|
},
|
113
141
|
onClick: this.handleClickCancel,
|
114
|
-
color:
|
142
|
+
color: cancelColor
|
115
143
|
}, labelCancelButton)));
|
116
144
|
}
|
117
145
|
|
118
146
|
}
|
119
147
|
|
148
|
+
HiAlertModal.defaultProps = {
|
149
|
+
cancelColor: 'neutral',
|
150
|
+
submitColor: 'primary'
|
151
|
+
};
|
120
152
|
HiAlertModal.propTypes = process.env.NODE_ENV !== "production" ? {
|
153
|
+
/**
|
154
|
+
* Icon à mettre en fond
|
155
|
+
*/
|
156
|
+
backgroundIcon: PropTypes.string,
|
157
|
+
|
158
|
+
/**
|
159
|
+
* The color of the cancel button. It supports those theme colors that make sense for this component.
|
160
|
+
*/
|
161
|
+
cancelColor: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'positive', 'negative', 'middle', 'neutral']),
|
162
|
+
|
121
163
|
/**
|
122
164
|
* Surcharge les classes du composant
|
123
165
|
*/
|
@@ -126,7 +168,7 @@ HiAlertModal.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
126
168
|
/**
|
127
169
|
* Texte contenu dans la modal
|
128
170
|
*/
|
129
|
-
content: PropTypes.string,
|
171
|
+
content: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.node]),
|
130
172
|
|
131
173
|
/**
|
132
174
|
* Texte sur le bouton d'annulation
|
@@ -8,7 +8,7 @@ import withStyles from '../styles/withStyles';
|
|
8
8
|
import { capitalize } from '../utils/helpers';
|
9
9
|
import { fade } from '../styles/colorManipulator';
|
10
10
|
export const styles = theme => ({
|
11
|
-
root: _objectSpread({}, theme.typography.
|
11
|
+
root: _objectSpread({}, theme.typography.b3, {
|
12
12
|
display: 'inline-block',
|
13
13
|
alignItems: 'baseline',
|
14
14
|
maxWidth: '100%',
|