@hipay/hipay-material-ui 3.2.3 → 3.4.0
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/HiAlertModal/HiAlertModal.js +122 -138
- package/HiCell/CellNumeric.js +21 -2
- package/HiCell/CellRate.js +8 -4
- package/HiCell/CellText.js +10 -5
- package/HiCell/CellTextStyled.js +19 -2
- package/HiCheckbox/HiCheckbox.js +25 -10
- package/HiChip/HiChip.js +66 -37
- package/HiDatePicker/HiDateRangeSelector.js +10 -2
- package/HiExpansionPanel/HiExpansionPanel.js +4 -7
- package/HiForm/HiInput.js +21 -5
- package/HiIcon/HiIcon.js +1 -16
- package/HiIconButton/HiIconButton.js +31 -56
- package/HiListItemLink/HiListItemLink.js +106 -0
- package/HiListItemLink/index.js +15 -0
- package/HiSelectableList/HiSelectableListItem.js +33 -11
- package/HiStepper/DefaultIndicator.js +44 -0
- package/HiStepper/HiStep.js +13 -7
- package/HiStepper/HiStepper.js +1 -1
- package/HiTable/HiCellBuilder.js +136 -130
- package/HiTable/HiTableBody.js +2 -2
- package/HiTable/HiTableHeader.js +7 -3
- package/HiTable/HiTableRow.js +4 -2
- package/es/HiAlertModal/HiAlertModal.js +122 -138
- package/es/HiCell/CellNumeric.js +21 -2
- package/es/HiCell/CellRate.js +8 -4
- package/es/HiCell/CellText.js +10 -5
- package/es/HiCell/CellTextStyled.js +19 -2
- package/es/HiCheckbox/HiCheckbox.js +25 -10
- package/es/HiChip/HiChip.js +66 -37
- package/es/HiDatePicker/HiDateRangeSelector.js +10 -2
- package/es/HiExpansionPanel/HiExpansionPanel.js +4 -7
- package/es/HiForm/HiInput.js +21 -5
- package/es/HiIcon/HiIcon.js +1 -16
- package/es/HiIconButton/HiIconButton.js +31 -56
- package/es/HiListItemLink/HiListItemLink.js +106 -0
- package/es/HiListItemLink/index.js +15 -0
- package/es/HiSelectableList/HiSelectableListItem.js +33 -11
- package/es/HiStepper/DefaultIndicator.js +44 -0
- package/es/HiStepper/HiStep.js +13 -7
- package/es/HiStepper/HiStepper.js +1 -1
- package/es/HiTable/HiCellBuilder.js +136 -130
- package/es/HiTable/HiTableBody.js +2 -2
- package/es/HiTable/HiTableHeader.js +7 -3
- package/es/HiTable/HiTableRow.js +4 -2
- package/es/hi-svg-icons/HiLogoRounded.js +3 -2
- package/hi-svg-icons/HiLogoRounded.js +3 -2
- package/package.json +4 -3
package/HiChip/HiChip.js
CHANGED
|
@@ -5,7 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
|
9
13
|
|
|
10
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
11
15
|
|
|
@@ -21,7 +25,7 @@ var _HiIcon = _interopRequireDefault(require("../HiIcon"));
|
|
|
21
25
|
|
|
22
26
|
var _styles = require("@material-ui/core/styles");
|
|
23
27
|
|
|
24
|
-
var
|
|
28
|
+
var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
25
29
|
return {
|
|
26
30
|
root: (0, _objectSpread2.default)({}, theme.typography.b3, {
|
|
27
31
|
display: 'inline-flex',
|
|
@@ -53,8 +57,12 @@ var styles = function styles(theme) {
|
|
|
53
57
|
rightNavigation: {},
|
|
54
58
|
deletable: {},
|
|
55
59
|
leftIcon: {},
|
|
56
|
-
icon: {
|
|
57
|
-
|
|
60
|
+
icon: function icon(props) {
|
|
61
|
+
var fontSize = props.iconSize || 20;
|
|
62
|
+
return {
|
|
63
|
+
marginRight: 4,
|
|
64
|
+
fontSize: fontSize
|
|
65
|
+
};
|
|
58
66
|
},
|
|
59
67
|
iconClickable: {
|
|
60
68
|
cursor: 'pointer',
|
|
@@ -105,9 +113,7 @@ var styles = function styles(theme) {
|
|
|
105
113
|
paddingRight: '8px'
|
|
106
114
|
}
|
|
107
115
|
};
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
exports.styles = styles;
|
|
116
|
+
});
|
|
111
117
|
|
|
112
118
|
var handleKeyDown = function handleKeyDown(e, fn) {
|
|
113
119
|
if ((0, _keycode.default)(e) === 'space' || (0, _keycode.default)(e) === 'enter') {
|
|
@@ -116,11 +122,10 @@ var handleKeyDown = function handleKeyDown(e, fn) {
|
|
|
116
122
|
}
|
|
117
123
|
};
|
|
118
124
|
|
|
119
|
-
function HiChip(props) {
|
|
120
|
-
var
|
|
125
|
+
var HiChip = function HiChip(props) {
|
|
126
|
+
var _classNames2;
|
|
121
127
|
|
|
122
128
|
var className = props.className,
|
|
123
|
-
classes = props.classes,
|
|
124
129
|
fallbackImage = props.fallbackImage,
|
|
125
130
|
icon = props.icon,
|
|
126
131
|
_props$iconSize = props.iconSize,
|
|
@@ -143,27 +148,62 @@ function HiChip(props) {
|
|
|
143
148
|
titleNext = props.titleNext,
|
|
144
149
|
titlePrevious = props.titlePrevious,
|
|
145
150
|
style = props.style;
|
|
151
|
+
var classes = useStyles(props);
|
|
152
|
+
var chipIcon;
|
|
153
|
+
|
|
154
|
+
if (icon) {
|
|
155
|
+
var iconProps = {
|
|
156
|
+
className: (0, _classnames.default)(classes.icon, (0, _defineProperty2.default)({}, classes.iconClickable, onIconClick)),
|
|
157
|
+
id: "".concat(id, "-icon"),
|
|
158
|
+
onClick: onIconClick,
|
|
159
|
+
onKeyDown: function onKeyDown(event) {
|
|
160
|
+
return handleKeyDown(event, onIconClick);
|
|
161
|
+
},
|
|
162
|
+
title: titleIcon,
|
|
163
|
+
tabIndex: onIconClick ? 0 : -1
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
if (typeof icon === 'string') {
|
|
167
|
+
chipIcon = _react.default.createElement(_HiIcon.default, (0, _extends2.default)({
|
|
168
|
+
icon: icon
|
|
169
|
+
}, iconProps));
|
|
170
|
+
} else if ((0, _typeof2.default)(icon) === 'object') {
|
|
171
|
+
chipIcon = (0, _objectSpread2.default)({}, icon);
|
|
172
|
+
chipIcon.props = (0, _objectSpread2.default)({}, iconProps);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
var chipLabelIcon;
|
|
177
|
+
|
|
178
|
+
if (labelIcon) {
|
|
179
|
+
var _iconProps = {
|
|
180
|
+
className: classes.icon,
|
|
181
|
+
id: "".concat(id, "-labelIcon"),
|
|
182
|
+
size: iconSize,
|
|
183
|
+
title: titleIcon,
|
|
184
|
+
tabIndex: -1
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
if (typeof labelIcon === 'string') {
|
|
188
|
+
chipLabelIcon = _react.default.createElement(_HiIcon.default, (0, _extends2.default)({
|
|
189
|
+
icon: labelIcon
|
|
190
|
+
}, _iconProps));
|
|
191
|
+
} else if ((0, _typeof2.default)(labelIcon) === 'object') {
|
|
192
|
+
chipLabelIcon = (0, _objectSpread2.default)({}, labelIcon);
|
|
193
|
+
chipLabelIcon.props = (0, _objectSpread2.default)({}, _iconProps);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
146
197
|
return _react.default.createElement("div", {
|
|
147
198
|
id: id,
|
|
148
199
|
role: 'button',
|
|
149
|
-
className: (0, _classnames.default)(classes.root, className, (
|
|
200
|
+
className: (0, _classnames.default)(classes.root, className, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, classes.leftNavigation, onPrevious), (0, _defineProperty2.default)(_classNames2, classes.rightNavigation, onNext), (0, _defineProperty2.default)(_classNames2, classes.deletable, onDelete), (0, _defineProperty2.default)(_classNames2, classes.leftIcon, icon), _classNames2)),
|
|
150
201
|
title: title,
|
|
151
202
|
onClick: onClick,
|
|
152
203
|
onKeyDown: onKeyDown,
|
|
153
204
|
tabIndex: onKeyDown ? '0' : '-1',
|
|
154
205
|
style: style
|
|
155
|
-
},
|
|
156
|
-
className: (0, _classnames.default)(classes.icon, (0, _defineProperty2.default)({}, classes.iconClickable, onIconClick)),
|
|
157
|
-
id: "".concat(id, "-icon"),
|
|
158
|
-
icon: icon,
|
|
159
|
-
size: iconSize,
|
|
160
|
-
onClick: onIconClick,
|
|
161
|
-
onKeyDown: function onKeyDown(event) {
|
|
162
|
-
return handleKeyDown(event, onIconClick);
|
|
163
|
-
},
|
|
164
|
-
title: titleIcon,
|
|
165
|
-
tabIndex: onIconClick ? 0 : -1
|
|
166
|
-
}), prefix && _react.default.createElement("span", {
|
|
206
|
+
}, chipIcon, prefix && _react.default.createElement("span", {
|
|
167
207
|
id: "".concat(id, "-prefix"),
|
|
168
208
|
className: classes.prefix
|
|
169
209
|
}, prefix), img && _react.default.createElement("img", {
|
|
@@ -179,14 +219,7 @@ function HiChip(props) {
|
|
|
179
219
|
}
|
|
180
220
|
},
|
|
181
221
|
title: titleImg
|
|
182
|
-
}), labelIcon && _react.default.createElement(_HiIcon.default, {
|
|
183
|
-
className: (0, _classnames.default)(classes.icon),
|
|
184
|
-
id: "".concat(id, "-labelIcon"),
|
|
185
|
-
icon: labelIcon,
|
|
186
|
-
size: iconSize,
|
|
187
|
-
title: titleIcon,
|
|
188
|
-
tabIndex: -1
|
|
189
|
-
}), onPrevious && _react.default.createElement(_HiIcon.default, {
|
|
222
|
+
}), labelIcon && chipLabelIcon, onPrevious && _react.default.createElement(_HiIcon.default, {
|
|
190
223
|
className: (0, _classnames.default)(classes.navigate),
|
|
191
224
|
id: "".concat(id, "-previous"),
|
|
192
225
|
icon: "arrow_left",
|
|
@@ -225,11 +258,7 @@ function HiChip(props) {
|
|
|
225
258
|
title: titleDelete,
|
|
226
259
|
tabIndex: 0
|
|
227
260
|
}));
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
var _default = (0, _styles.withStyles)(styles, {
|
|
231
|
-
hiComponent: true,
|
|
232
|
-
name: 'HmuiHiChip'
|
|
233
|
-
})(HiChip);
|
|
261
|
+
};
|
|
234
262
|
|
|
263
|
+
var _default = HiChip;
|
|
235
264
|
exports.default = _default;
|
|
@@ -44,6 +44,10 @@ var _HiFormControl = _interopRequireDefault(require("../HiForm/HiFormControl"));
|
|
|
44
44
|
|
|
45
45
|
var _reactDeviceDetect = require("react-device-detect");
|
|
46
46
|
|
|
47
|
+
var _Calendar = _interopRequireDefault(require("mdi-material-ui/Calendar"));
|
|
48
|
+
|
|
49
|
+
var _CalendarBlank = _interopRequireDefault(require("mdi-material-ui/CalendarBlank"));
|
|
50
|
+
|
|
47
51
|
function findSeparator(format) {
|
|
48
52
|
var str = '';
|
|
49
53
|
|
|
@@ -302,6 +306,10 @@ exports.styles = styles;
|
|
|
302
306
|
var PRESET_PERIOD_LIST = ['cd', 'pd', 'cw', 'pw', 'cm', 'pm', 'cq', 'pq', 'cy', 'yy'];
|
|
303
307
|
var CUSTOM_PERIOD_LIST = ['custom'];
|
|
304
308
|
|
|
309
|
+
var _ref2 = _react.default.createElement(_Calendar.default, null);
|
|
310
|
+
|
|
311
|
+
var _ref3 = _react.default.createElement(_CalendarBlank.default, null);
|
|
312
|
+
|
|
305
313
|
var HiDateRangeSelector =
|
|
306
314
|
/*#__PURE__*/
|
|
307
315
|
function (_React$Component) {
|
|
@@ -402,7 +410,7 @@ function (_React$Component) {
|
|
|
402
410
|
id: "preset_periods_subheader",
|
|
403
411
|
type: PRESET_PERIOD_LIST.includes(selectedPreset) ? "primary-highlight" : "highlight",
|
|
404
412
|
pinned: true,
|
|
405
|
-
icon:
|
|
413
|
+
icon: _ref2,
|
|
406
414
|
label: translations.preset_periods
|
|
407
415
|
});
|
|
408
416
|
presetOptionsAvailable.forEach(function (option) {
|
|
@@ -417,7 +425,7 @@ function (_React$Component) {
|
|
|
417
425
|
id: "custom_periods_subheader",
|
|
418
426
|
type: CUSTOM_PERIOD_LIST.includes(selectedPreset) ? "primary-highlight" : "highlight",
|
|
419
427
|
pinned: true,
|
|
420
|
-
icon:
|
|
428
|
+
icon: _ref3,
|
|
421
429
|
label: translations.custom_periods
|
|
422
430
|
});
|
|
423
431
|
customOptionsAvailable.forEach(function (option) {
|
|
@@ -27,12 +27,12 @@ var _ExpansionPanelSummary = _interopRequireDefault(require("@material-ui/core/E
|
|
|
27
27
|
|
|
28
28
|
var _ExpansionPanelDetails = _interopRequireDefault(require("@material-ui/core/ExpansionPanelDetails"));
|
|
29
29
|
|
|
30
|
-
var _HiIcon = _interopRequireDefault(require("./../HiIcon"));
|
|
31
|
-
|
|
32
30
|
var _styles = require("@material-ui/core/styles");
|
|
33
31
|
|
|
34
32
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
35
33
|
|
|
34
|
+
var _MenuUp = _interopRequireDefault(require("mdi-material-ui/MenuUp"));
|
|
35
|
+
|
|
36
36
|
var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
37
37
|
return {
|
|
38
38
|
summaryContent: {
|
|
@@ -49,7 +49,7 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
49
49
|
borderBottom: '1px solid #E3E6E7',
|
|
50
50
|
height: 48,
|
|
51
51
|
minHeight: 48,
|
|
52
|
-
padding:
|
|
52
|
+
padding: 0,
|
|
53
53
|
'&$expanded': {
|
|
54
54
|
minHeight: 48
|
|
55
55
|
}
|
|
@@ -113,10 +113,7 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
113
113
|
* HiExpansionPanel
|
|
114
114
|
*/
|
|
115
115
|
|
|
116
|
-
var _ref = _react.default.createElement(
|
|
117
|
-
icon: "mdi_menu_up",
|
|
118
|
-
size: 24
|
|
119
|
-
});
|
|
116
|
+
var _ref = _react.default.createElement(_MenuUp.default, null);
|
|
120
117
|
|
|
121
118
|
function HiExpansionPanel(props) {
|
|
122
119
|
var disabled = props.disabled,
|
package/HiForm/HiInput.js
CHANGED
|
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.styles = void 0;
|
|
9
9
|
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
|
13
|
+
|
|
10
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
11
15
|
|
|
12
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
@@ -86,6 +90,7 @@ var styles = function styles(theme) {
|
|
|
86
90
|
borderRadius: 2
|
|
87
91
|
},
|
|
88
92
|
startAdornment: {
|
|
93
|
+
fontSize: 20,
|
|
89
94
|
zIndex: 1,
|
|
90
95
|
marginLeft: 0,
|
|
91
96
|
marginRight: 8
|
|
@@ -100,6 +105,7 @@ var styles = function styles(theme) {
|
|
|
100
105
|
color: theme.palette.neutral.light
|
|
101
106
|
},
|
|
102
107
|
rightIcon: {
|
|
108
|
+
fontSize: 20,
|
|
103
109
|
width: 39,
|
|
104
110
|
color: theme.palette.neutral.main
|
|
105
111
|
},
|
|
@@ -355,16 +361,26 @@ function (_React$PureComponent) {
|
|
|
355
361
|
});
|
|
356
362
|
var leftIcon;
|
|
357
363
|
|
|
358
|
-
if (startAdornment) {
|
|
364
|
+
if (!!startAdornment) {
|
|
359
365
|
var _classNames2;
|
|
360
366
|
|
|
361
|
-
|
|
362
|
-
icon: startAdornment,
|
|
363
|
-
size: 20,
|
|
367
|
+
var leftIconProps = {
|
|
364
368
|
color: startAdornmentColor,
|
|
365
369
|
onClick: this.props.onLeftIconClick,
|
|
366
370
|
className: (0, _classnames.default)(classes.startAdornment, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, classes.startAdornmentDefaultColor, !startAdornmentColor), (0, _defineProperty2.default)(_classNames2, classes.startAdornmentFocus, focused && !startAdornmentColor), (0, _defineProperty2.default)(_classNames2, classes.startAdornmentDisabled, disabled && !startAdornmentColor), (0, _defineProperty2.default)(_classNames2, classes.iconPointer, this.props.onLeftIconClick), _classNames2))
|
|
367
|
-
}
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
if (typeof startAdornment === 'string') {
|
|
374
|
+
leftIcon = _react.default.createElement(_HiIcon.default, (0, _extends2.default)({
|
|
375
|
+
icon: startAdornment
|
|
376
|
+
}, leftIconProps));
|
|
377
|
+
} else if ((0, _typeof2.default)(startAdornment) === 'object') {
|
|
378
|
+
// Icon component as prop
|
|
379
|
+
leftIcon = (0, _objectSpread2.default)({}, startAdornment);
|
|
380
|
+
leftIcon.props = (0, _objectSpread2.default)({}, leftIcon.props, {}, leftIconProps, {
|
|
381
|
+
className: "".concat(leftIconProps.className, " ").concat(leftIcon.props.className)
|
|
382
|
+
});
|
|
383
|
+
}
|
|
368
384
|
} // Build endAdornment with eraseIcon + endAdornmentProps
|
|
369
385
|
|
|
370
386
|
|
package/HiIcon/HiIcon.js
CHANGED
|
@@ -27,8 +27,6 @@ var _helpers = require("../utils/helpers");
|
|
|
27
27
|
|
|
28
28
|
var hiSvgIcons = _interopRequireWildcard(require("../hi-svg-icons"));
|
|
29
29
|
|
|
30
|
-
var mdi = _interopRequireWildcard(require("mdi-material-ui"));
|
|
31
|
-
|
|
32
30
|
var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
33
31
|
return {
|
|
34
32
|
/* Styles applied to the root element. */
|
|
@@ -56,15 +54,12 @@ var HiIcon = _react.default.forwardRef(function (props, ref) {
|
|
|
56
54
|
color = props.color,
|
|
57
55
|
other = (0, _objectWithoutProperties2.default)(props, ["children", "className", "icon", "size", "color"]);
|
|
58
56
|
var classes = useStyles(props);
|
|
59
|
-
var theme = (0, _styles.useTheme)();
|
|
60
57
|
var iconName = icon !== null ? icon : children;
|
|
61
58
|
var iconType = (0, _react.useMemo)(function () {
|
|
62
59
|
if (iconName && iconName.indexOf('fa-') === 0) {
|
|
63
60
|
return "line_awesome";
|
|
64
61
|
} else if (iconName && iconName.indexOf('hi_') === 0) {
|
|
65
62
|
return "hipay";
|
|
66
|
-
} else if (iconName && iconName.indexOf('mdi_') === 0) {
|
|
67
|
-
return "mdi";
|
|
68
63
|
} else {
|
|
69
64
|
return "mui";
|
|
70
65
|
}
|
|
@@ -89,19 +84,9 @@ var HiIcon = _react.default.forwardRef(function (props, ref) {
|
|
|
89
84
|
size: size
|
|
90
85
|
}, other));
|
|
91
86
|
|
|
92
|
-
case "mdi":
|
|
93
|
-
var MdiIconName = mdi[(0, _helpers.capitalize)((0, _helpers.camelize)(iconName.slice(4)))];
|
|
94
|
-
return _react.default.createElement(MdiIconName, (0, _extends2.default)({
|
|
95
|
-
ref: ref,
|
|
96
|
-
className: (0, _classnames.default)(className, (0, _defineProperty2.default)({}, classes.root, color !== "inherit")),
|
|
97
|
-
color: "inherit",
|
|
98
|
-
style: {
|
|
99
|
-
fontSize: size
|
|
100
|
-
}
|
|
101
|
-
}, other));
|
|
102
|
-
|
|
103
87
|
case "mui":
|
|
104
88
|
default:
|
|
89
|
+
// console.log({ ...props });
|
|
105
90
|
return _react.default.createElement(_Icon.default, (0, _extends2.default)({
|
|
106
91
|
ref: ref,
|
|
107
92
|
className: (0, _classnames.default)(className, (0, _defineProperty2.default)({}, classes.root, color !== "inherit")),
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.
|
|
8
|
+
exports.default = exports.useStyles = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
|
11
11
|
|
|
@@ -24,81 +24,56 @@ var _colorManipulator = require("@material-ui/core/styles/colorManipulator");
|
|
|
24
24
|
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
25
25
|
|
|
26
26
|
// @inheritedComponent IconButton
|
|
27
|
-
var
|
|
27
|
+
var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
28
28
|
return {
|
|
29
29
|
label: {},
|
|
30
|
-
|
|
31
|
-
color
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
negative: {
|
|
41
|
-
color: theme.palette.negative.main,
|
|
42
|
-
'&:hover': {
|
|
43
|
-
backgroundColor: (0, _colorManipulator.fade)(theme.palette.negative.main, theme.palette.action.hoverOpacity),
|
|
44
|
-
// Reset on touch devices, it doesn't add specificity
|
|
45
|
-
'@media (hover: none)': {
|
|
46
|
-
backgroundColor: 'transparent'
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
middle: {
|
|
51
|
-
color: theme.palette.middle.main,
|
|
52
|
-
'&:hover': {
|
|
53
|
-
backgroundColor: (0, _colorManipulator.fade)(theme.palette.middle.main, theme.palette.action.hoverOpacity),
|
|
54
|
-
// Reset on touch devices, it doesn't add specificity
|
|
55
|
-
'@media (hover: none)': {
|
|
56
|
-
backgroundColor: 'transparent'
|
|
57
|
-
}
|
|
30
|
+
rootCustomColor: function rootCustomColor(props) {
|
|
31
|
+
var color;
|
|
32
|
+
|
|
33
|
+
if (theme.palette[props.color]) {
|
|
34
|
+
color = theme.palette[props.color].main;
|
|
35
|
+
} else if (props.color.charAt(0) === "#") {
|
|
36
|
+
color = props.color;
|
|
58
37
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
38
|
+
|
|
39
|
+
if (!color) return {};
|
|
40
|
+
return {
|
|
41
|
+
color: color,
|
|
42
|
+
'&:hover': {
|
|
43
|
+
backgroundColor: (0, _colorManipulator.fade)(color, theme.palette.action.hoverOpacity),
|
|
44
|
+
// Reset on touch devices, it doesn't add specificity
|
|
45
|
+
'@media (hover: none)': {
|
|
46
|
+
backgroundColor: 'transparent'
|
|
47
|
+
}
|
|
67
48
|
}
|
|
68
|
-
}
|
|
49
|
+
};
|
|
69
50
|
}
|
|
70
51
|
};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
exports.styles = styles;
|
|
52
|
+
});
|
|
53
|
+
exports.useStyles = useStyles;
|
|
74
54
|
|
|
75
55
|
function HiIconButton(props) {
|
|
76
|
-
var _classNames;
|
|
77
|
-
|
|
78
56
|
var children = props.children,
|
|
79
|
-
classes = props.classes,
|
|
80
57
|
className = props.className,
|
|
81
58
|
color = props.color,
|
|
82
|
-
other = (0, _objectWithoutProperties2.default)(props, ["children", "
|
|
83
|
-
var
|
|
84
|
-
var
|
|
59
|
+
other = (0, _objectWithoutProperties2.default)(props, ["children", "className", "color"]);
|
|
60
|
+
var classes = useStyles(props);
|
|
61
|
+
var isHexColor = color.charAt(0) === "#";
|
|
62
|
+
var isExtendedColor = ['positive', 'negative', 'middle', 'neutral'].includes(color);
|
|
63
|
+
var isCustomColor = isHexColor || isExtendedColor;
|
|
64
|
+
var rootClassNames = (0, _classnames.default)((0, _defineProperty2.default)({}, classes.rootCustomColor, isCustomColor));
|
|
85
65
|
return _react.default.createElement(_IconButton.default, (0, _extends2.default)({
|
|
86
66
|
className: className,
|
|
87
67
|
classes: {
|
|
88
|
-
root:
|
|
68
|
+
root: rootClassNames,
|
|
89
69
|
label: classes.label
|
|
90
70
|
},
|
|
91
|
-
color:
|
|
71
|
+
color: isCustomColor ? 'inherit' : color
|
|
92
72
|
}, other), children);
|
|
93
73
|
}
|
|
94
74
|
|
|
95
75
|
HiIconButton.defaultProps = {
|
|
96
76
|
color: 'default'
|
|
97
77
|
};
|
|
98
|
-
|
|
99
|
-
var _default = (0, _styles.withStyles)(styles, {
|
|
100
|
-
hiComponent: true,
|
|
101
|
-
name: 'HmuiHiIconButton'
|
|
102
|
-
})(HiIconButton);
|
|
103
|
-
|
|
78
|
+
var _default = HiIconButton;
|
|
104
79
|
exports.default = _default;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _styles = require("@material-ui/core/styles");
|
|
17
|
+
|
|
18
|
+
var _ListItem = _interopRequireDefault(require("@material-ui/core/ListItem"));
|
|
19
|
+
|
|
20
|
+
var _ArrowRight = _interopRequireDefault(require("@material-ui/icons/ArrowRight"));
|
|
21
|
+
|
|
22
|
+
var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
23
|
+
return {
|
|
24
|
+
root: function root(props) {
|
|
25
|
+
return {
|
|
26
|
+
color: props.disabled ? theme.palette.neutral.light : "initial",
|
|
27
|
+
display: "flex",
|
|
28
|
+
height: 48,
|
|
29
|
+
padding: 12,
|
|
30
|
+
"&:hover": {
|
|
31
|
+
backgroundColor: props.disabled ? "none" : "#E6F9FD",
|
|
32
|
+
cursor: props.disabled ? "cursor" : "pointer"
|
|
33
|
+
},
|
|
34
|
+
"&:not(:last-child)": {
|
|
35
|
+
borderBottom: "1px solid #E0E0E0"
|
|
36
|
+
},
|
|
37
|
+
// margin between children (unless last span for ripple effect)
|
|
38
|
+
"& > :not(span)": {
|
|
39
|
+
marginLeft: 12
|
|
40
|
+
},
|
|
41
|
+
"& > div": {
|
|
42
|
+
display: "block",
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
textOverflow: "ellipsis",
|
|
45
|
+
whiteSpace: "nowrap",
|
|
46
|
+
alignSelf: "center",
|
|
47
|
+
minWidth: "5%"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
primary: function primary(props) {
|
|
52
|
+
return {
|
|
53
|
+
fontSize: "14px",
|
|
54
|
+
textTransform: "uppercase",
|
|
55
|
+
flex: props.secondary ? "initial" : 1 // expand primary text unless there is secondary
|
|
56
|
+
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
secondary: {
|
|
60
|
+
alignSelf: "center",
|
|
61
|
+
color: theme.palette.neutral.light,
|
|
62
|
+
fontFamily: theme.typography.fontFamily,
|
|
63
|
+
fontSize: 11,
|
|
64
|
+
flex: 1
|
|
65
|
+
},
|
|
66
|
+
info: {
|
|
67
|
+
color: theme.palette.neutral.light,
|
|
68
|
+
fontFamily: theme.typography.fontFamily
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
var _ref = _react.default.createElement(_ArrowRight.default, null);
|
|
74
|
+
|
|
75
|
+
var HiListItemLink = _react.default.forwardRef(function (props, ref) {
|
|
76
|
+
var disabled = props.disabled,
|
|
77
|
+
info = props.info,
|
|
78
|
+
primary = props.primary,
|
|
79
|
+
secondary = props.secondary,
|
|
80
|
+
icon = props.icon,
|
|
81
|
+
others = (0, _objectWithoutProperties2.default)(props, ["disabled", "info", "primary", "secondary", "icon"]);
|
|
82
|
+
var classes = useStyles(props);
|
|
83
|
+
return _react.default.createElement(_ListItem.default, (0, _extends2.default)({
|
|
84
|
+
ref: ref,
|
|
85
|
+
className: classes.root,
|
|
86
|
+
button: true,
|
|
87
|
+
disableGutters: true,
|
|
88
|
+
disabled: disabled
|
|
89
|
+
}, others), _react.default.createElement("div", {
|
|
90
|
+
className: classes.primary
|
|
91
|
+
}, primary), secondary && _react.default.createElement("div", {
|
|
92
|
+
className: classes.secondary
|
|
93
|
+
}, secondary), info && _react.default.createElement("div", {
|
|
94
|
+
className: classes.info
|
|
95
|
+
}, info), icon, _ref);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
HiListItemLink.defaultProps = {
|
|
99
|
+
disabled: false,
|
|
100
|
+
info: null,
|
|
101
|
+
onClick: null,
|
|
102
|
+
secondary: null,
|
|
103
|
+
icon: null
|
|
104
|
+
};
|
|
105
|
+
var _default = HiListItemLink;
|
|
106
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "default", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _HiListItemLink.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
var _HiListItemLink = _interopRequireDefault(require("./HiListItemLink"));
|
|
@@ -11,6 +11,10 @@ exports.default = exports.useStyles = exports.useItemLabelStyles = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
13
13
|
|
|
14
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof"));
|
|
15
|
+
|
|
16
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
|
17
|
+
|
|
14
18
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
15
19
|
|
|
16
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -206,10 +210,14 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
|
206
210
|
margin: '1px 4px 3px 4px',
|
|
207
211
|
verticalAlign: 'middle'
|
|
208
212
|
},
|
|
209
|
-
icon: {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
icon: function icon(props) {
|
|
214
|
+
return {
|
|
215
|
+
marginLeft: theme.spacing(1),
|
|
216
|
+
marginRight: theme.spacing(1),
|
|
217
|
+
verticalAlign: 'middle',
|
|
218
|
+
color: props.selected && props.color ? props.color : 'inherit',
|
|
219
|
+
fontSize: 20
|
|
220
|
+
};
|
|
213
221
|
},
|
|
214
222
|
labelContent: {
|
|
215
223
|
display: '-webkit-flex',
|
|
@@ -273,7 +281,7 @@ function HiSelectableListItem(props) {
|
|
|
273
281
|
item = props.item;
|
|
274
282
|
var classes = useStyles(props);
|
|
275
283
|
var ref = (0, _react.useRef)(null);
|
|
276
|
-
var isHovering = (0, _reactUse.useHoverDirty)(ref);
|
|
284
|
+
var isHovering = !!hoverIcon ? (0, _reactUse.useHoverDirty)(ref) : false;
|
|
277
285
|
var onKeyDown = (0, _react.useCallback)(function (_ref) {
|
|
278
286
|
var code = _ref.code;
|
|
279
287
|
|
|
@@ -302,6 +310,24 @@ function HiSelectableListItem(props) {
|
|
|
302
310
|
}
|
|
303
311
|
|
|
304
312
|
var ListItemComponentName = pinned ? _ListSubheader.default : _ListItem.default;
|
|
313
|
+
var itemIcon;
|
|
314
|
+
|
|
315
|
+
if (displayedIcon) {
|
|
316
|
+
var iconProps = {
|
|
317
|
+
className: classes.icon,
|
|
318
|
+
color: selected && color ? color : 'inherit'
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
if (typeof displayedIcon === 'string') {
|
|
322
|
+
itemIcon = _react.default.createElement(_HiIcon.default, (0, _extends2.default)({
|
|
323
|
+
icon: displayedIcon
|
|
324
|
+
}, iconProps));
|
|
325
|
+
} else if ((0, _typeof2.default)(icon) === 'object') {
|
|
326
|
+
itemIcon = (0, _objectSpread2.default)({}, displayedIcon);
|
|
327
|
+
itemIcon.props = (0, _objectSpread2.default)({}, itemIcon.props, {}, iconProps);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
305
331
|
return _react.default.createElement(ListItemComponentName, {
|
|
306
332
|
ref: ref,
|
|
307
333
|
id: id,
|
|
@@ -327,7 +353,7 @@ function HiSelectableListItem(props) {
|
|
|
327
353
|
checkedIcon: checkedIcon // color={disabled ? 'inherit' : 'primary'}
|
|
328
354
|
,
|
|
329
355
|
disabled: disabled,
|
|
330
|
-
icon:
|
|
356
|
+
icon: itemIcon,
|
|
331
357
|
indeterminate: indeterminate,
|
|
332
358
|
indeterminateIcon: indeterminateIcon
|
|
333
359
|
}), type === 'image' && img && _react.default.createElement("img", {
|
|
@@ -344,11 +370,7 @@ function HiSelectableListItem(props) {
|
|
|
344
370
|
}), _react.default.createElement("div", {
|
|
345
371
|
className: (0, _classnames.default)(classes.listItemContent, (_classNames3 = {}, (0, _defineProperty2.default)(_classNames3, classes.centered, centered), (0, _defineProperty2.default)(_classNames3, classes.highlight, type === 'highlight'), (0, _defineProperty2.default)(_classNames3, classes.primaryHighlight, type === 'primary-highlight'), (0, _defineProperty2.default)(_classNames3, classes.listItemContentSelected, selected && color), _classNames3)),
|
|
346
372
|
"data-id": id
|
|
347
|
-
},
|
|
348
|
-
icon: icon,
|
|
349
|
-
className: classes.icon,
|
|
350
|
-
color: selected && color ? color : 'inherit'
|
|
351
|
-
}), _react.default.createElement(ItemLabel, {
|
|
373
|
+
}, itemIcon && hideCheckbox && itemIcon, _react.default.createElement(ItemLabel, {
|
|
352
374
|
color: color,
|
|
353
375
|
label: label,
|
|
354
376
|
labelHighlight: labelHighlight,
|