@hipay/hipay-material-ui 2.3.4 → 3.0.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/HiChip/HiChip.js +1 -0
- package/HiDatePicker/HiDateRangeSelector.js +181 -46
- package/HiDatePicker/stylesheet.js +1 -2
- package/HiExpansionPanel/HiExpansionPanel.js +63 -98
- package/HiForm/HiFormControl.js +8 -8
- package/HiIcon/HiIcon.js +58 -54
- package/HiPaymentMeans/HiPaymentMeans.js +8 -5
- package/HiPin/HiPin.js +12 -20
- package/HiSelect/HiSelect.js +44 -10
- package/HiSelectableList/HiSelectableListItem.js +38 -24
- package/HiSwitch/HiSwitch.js +4 -1
- package/es/HiChip/HiChip.js +1 -0
- package/es/HiDatePicker/HiDateRangeSelector.js +181 -46
- package/es/HiDatePicker/stylesheet.js +1 -2
- package/es/HiExpansionPanel/HiExpansionPanel.js +63 -98
- package/es/HiForm/HiFormControl.js +8 -8
- package/es/HiIcon/HiIcon.js +58 -54
- package/es/HiPaymentMeans/HiPaymentMeans.js +8 -5
- package/es/HiPin/HiPin.js +12 -20
- package/es/HiSelect/HiSelect.js +44 -10
- package/es/HiSelectableList/HiSelectableListItem.js +38 -24
- package/es/HiSwitch/HiSwitch.js +4 -1
- package/es/hi-svg-icons/HiAccount.js +8 -11
- package/es/hi-svg-icons/HiBilling.js +8 -11
- package/es/hi-svg-icons/HiCatalog.js +8 -11
- package/es/hi-svg-icons/HiCustomer.js +8 -11
- package/es/hi-svg-icons/HiFinance.js +8 -11
- package/es/hi-svg-icons/HiIntelligence.js +59 -0
- package/es/hi-svg-icons/HiOrder.js +74 -0
- package/es/hi-svg-icons/HiPaymentOrder.js +56 -0
- package/es/hi-svg-icons/HiPriceGrid.js +56 -0
- package/es/hi-svg-icons/HiRoute.js +8 -11
- package/es/hi-svg-icons/HiSettlement.js +8 -11
- package/es/hi-svg-icons/HiTransaction.js +8 -11
- package/es/hi-svg-icons/HiUser.js +8 -11
- package/es/hi-svg-icons/HiVendor.js +56 -0
- package/es/hi-svg-icons/HiWidget.js +8 -16
- package/es/hi-svg-icons/index.js +41 -1
- package/es/setupTest.js +44 -0
- package/es/styleguide/Wrapper.js +9 -37
- package/es/styles/makeStyles.js +28 -0
- package/es/styles/withStyles.js +28 -0
- package/es/theme.js +7 -9
- package/hi-svg-icons/HiAccount.js +8 -11
- package/hi-svg-icons/HiBilling.js +8 -11
- package/hi-svg-icons/HiCatalog.js +8 -11
- package/hi-svg-icons/HiCustomer.js +8 -11
- package/hi-svg-icons/HiFinance.js +8 -11
- package/hi-svg-icons/HiIntelligence.js +59 -0
- package/hi-svg-icons/HiOrder.js +74 -0
- package/hi-svg-icons/HiPaymentOrder.js +56 -0
- package/hi-svg-icons/HiPriceGrid.js +56 -0
- package/hi-svg-icons/HiRoute.js +8 -11
- package/hi-svg-icons/HiSettlement.js +8 -11
- package/hi-svg-icons/HiTransaction.js +8 -11
- package/hi-svg-icons/HiUser.js +8 -11
- package/hi-svg-icons/HiVendor.js +56 -0
- package/hi-svg-icons/HiWidget.js +8 -16
- package/hi-svg-icons/index.js +41 -1
- package/package.json +2 -2
- package/setupTest.js +44 -0
- package/styleguide/Wrapper.js +9 -37
- package/styles/makeStyles.js +28 -0
- package/styles/withStyles.js +28 -0
- package/theme.js +7 -9
package/HiChip/HiChip.js
CHANGED
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
exports.findSeparator = findSeparator;
|
9
9
|
exports.yearAndMonth = yearAndMonth;
|
10
10
|
exports.yearAndQuarter = yearAndQuarter;
|
11
|
+
exports.buildDateRangeInfo = buildDateRangeInfo;
|
11
12
|
exports.buildDateRangeOptionByKey = buildDateRangeOptionByKey;
|
12
13
|
exports.default = exports.styles = void 0;
|
13
14
|
|
@@ -89,19 +90,58 @@ function yearAndQuarter(format, date, t) {
|
|
89
90
|
return indexY < indexM ? date.format("".concat(split[indexY]).concat(s, "[").concat(t.short_quarter, "]Q")) : date.format("[".concat(t.short_quarter, "]Q").concat(s).concat(split[indexY]));
|
90
91
|
}
|
91
92
|
|
93
|
+
function buildDateRangeInfo(t, from, to, format) {
|
94
|
+
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
95
|
+
var _options$prefix = options.prefix,
|
96
|
+
prefix = _options$prefix === void 0 ? null : _options$prefix,
|
97
|
+
_options$toNow = options.toNow,
|
98
|
+
toNow = _options$toNow === void 0 ? false : _options$toNow,
|
99
|
+
_options$displayDays = options.displayDays,
|
100
|
+
displayDays = _options$displayDays === void 0 ? true : _options$displayDays; // From
|
101
|
+
|
102
|
+
var info = "".concat(t.from, " ").concat(from.format(format), " "); // To
|
103
|
+
|
104
|
+
if (toNow) {
|
105
|
+
info += "".concat(t.to_now);
|
106
|
+
} else {
|
107
|
+
info += "".concat(t.to, " ").concat(to.format(format));
|
108
|
+
} // Prefix
|
109
|
+
|
110
|
+
|
111
|
+
switch (prefix) {
|
112
|
+
case "week":
|
113
|
+
info = "".concat(t.short_week).concat(from.format('w'), ", ").concat(info);
|
114
|
+
break;
|
115
|
+
|
116
|
+
case "quarter":
|
117
|
+
info = "".concat(t.short_quarter).concat(from.format('Q'), ", ").concat(info);
|
118
|
+
break;
|
119
|
+
|
120
|
+
default:
|
121
|
+
break;
|
122
|
+
} // Display number of days
|
123
|
+
|
124
|
+
|
125
|
+
if (displayDays) {
|
126
|
+
var days = Math.ceil(to.diff(from, 'days', true));
|
127
|
+
info = "".concat(days, " ").concat(t.days, ", ").concat(info);
|
128
|
+
}
|
129
|
+
|
130
|
+
return info;
|
131
|
+
}
|
132
|
+
|
92
133
|
function buildDateRangeOptionByKey(key, t, format) {
|
93
134
|
var from;
|
94
135
|
var label;
|
95
136
|
var info;
|
96
137
|
var to;
|
97
|
-
var type;
|
98
138
|
|
99
139
|
switch (key) {
|
100
140
|
case 'custom':
|
101
141
|
label = t.custom_period;
|
102
142
|
from = (0, _momentTimezone.default)().subtract(15, 'day').startOf('day');
|
103
143
|
to = (0, _momentTimezone.default)().endOf('day');
|
104
|
-
|
144
|
+
info = t.custom_period_info;
|
105
145
|
break;
|
106
146
|
|
107
147
|
case 'cd':
|
@@ -122,49 +162,84 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
122
162
|
label = t.current_week;
|
123
163
|
from = (0, _momentTimezone.default)().startOf('week');
|
124
164
|
to = (0, _momentTimezone.default)();
|
125
|
-
info =
|
165
|
+
info = buildDateRangeInfo(t, from, to, format, {
|
166
|
+
prefix: "week",
|
167
|
+
toNow: true,
|
168
|
+
displayDays: true
|
169
|
+
});
|
126
170
|
break;
|
127
171
|
|
128
172
|
case 'pw':
|
129
173
|
label = t.previous_week;
|
130
174
|
from = (0, _momentTimezone.default)().subtract(1, 'week').startOf('week');
|
131
175
|
to = (0, _momentTimezone.default)().subtract(1, 'week').endOf('week');
|
132
|
-
info =
|
176
|
+
info = buildDateRangeInfo(t, from, to, format, {
|
177
|
+
prefix: "week",
|
178
|
+
toNow: false,
|
179
|
+
displayDays: true
|
180
|
+
});
|
133
181
|
break;
|
134
182
|
|
135
183
|
case 'cm':
|
136
184
|
label = t.current_month;
|
137
185
|
from = (0, _momentTimezone.default)().startOf('month');
|
138
186
|
to = (0, _momentTimezone.default)();
|
139
|
-
info =
|
187
|
+
info = buildDateRangeInfo(t, from, to, format, {
|
188
|
+
prefix: null,
|
189
|
+
toNow: true,
|
190
|
+
displayDays: true
|
191
|
+
});
|
140
192
|
break;
|
141
193
|
|
142
194
|
case 'pm':
|
143
195
|
label = t.previous_month;
|
144
196
|
from = (0, _momentTimezone.default)().subtract(1, 'month').startOf('month');
|
145
197
|
to = (0, _momentTimezone.default)().subtract(1, 'month').endOf('month');
|
146
|
-
info = "".concat(
|
198
|
+
info = "".concat(from.daysInMonth(), " ").concat(t.days, ", ").concat(yearAndMonth(format, from));
|
147
199
|
break;
|
148
200
|
|
149
201
|
case 'cq':
|
150
202
|
label = t.current_quarter;
|
151
203
|
from = (0, _momentTimezone.default)().startOf('quarter');
|
152
204
|
to = (0, _momentTimezone.default)();
|
153
|
-
info =
|
205
|
+
info = buildDateRangeInfo(t, from, to, format, {
|
206
|
+
prefix: "quarter",
|
207
|
+
toNow: true,
|
208
|
+
displayDays: true
|
209
|
+
});
|
154
210
|
break;
|
155
211
|
|
156
212
|
case 'pq':
|
157
213
|
label = t.previous_quarter;
|
158
214
|
from = (0, _momentTimezone.default)().subtract(1, 'quarter').startOf('quarter');
|
159
215
|
to = (0, _momentTimezone.default)().subtract(1, 'quarter').endOf('quarter');
|
160
|
-
info =
|
216
|
+
info = buildDateRangeInfo(t, from, to, format, {
|
217
|
+
prefix: "quarter",
|
218
|
+
toNow: false,
|
219
|
+
displayDays: true
|
220
|
+
});
|
161
221
|
break;
|
162
222
|
|
163
223
|
case 'cy':
|
164
224
|
label = t.current_year;
|
165
225
|
from = (0, _momentTimezone.default)().startOf('year');
|
166
226
|
to = (0, _momentTimezone.default)();
|
167
|
-
info =
|
227
|
+
info = buildDateRangeInfo(t, from, to, format, {
|
228
|
+
prefix: null,
|
229
|
+
toNow: true,
|
230
|
+
displayDays: true
|
231
|
+
});
|
232
|
+
break;
|
233
|
+
|
234
|
+
case 'yy':
|
235
|
+
label = t.year_on_year;
|
236
|
+
from = (0, _momentTimezone.default)().subtract(1, 'years');
|
237
|
+
to = (0, _momentTimezone.default)();
|
238
|
+
info = buildDateRangeInfo(t, from, to, format, {
|
239
|
+
prefix: null,
|
240
|
+
toNow: true,
|
241
|
+
displayDays: true
|
242
|
+
});
|
168
243
|
break;
|
169
244
|
|
170
245
|
default:
|
@@ -176,12 +251,11 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
176
251
|
from: from,
|
177
252
|
info: info,
|
178
253
|
label: label,
|
179
|
-
to: to
|
180
|
-
type: type
|
254
|
+
to: to
|
181
255
|
};
|
182
256
|
}
|
183
257
|
|
184
|
-
var styles = function styles() {
|
258
|
+
var styles = function styles(theme) {
|
185
259
|
return {
|
186
260
|
root: {
|
187
261
|
maxWidth: 500,
|
@@ -192,21 +266,22 @@ var styles = function styles() {
|
|
192
266
|
}
|
193
267
|
},
|
194
268
|
dateRangePicker: {
|
195
|
-
width: '
|
269
|
+
width: '100%',
|
196
270
|
marginTop: 0
|
197
271
|
},
|
198
272
|
smSelect: {
|
199
|
-
padding:
|
273
|
+
padding: theme.spacing(1)
|
200
274
|
},
|
201
275
|
smRangePicker: {},
|
202
276
|
select: {
|
203
277
|
'@media(max-width: 700px)': {
|
204
278
|
width: '100%',
|
205
|
-
paddingBottom:
|
279
|
+
paddingBottom: theme.spacing(2)
|
206
280
|
},
|
207
281
|
'@media(min-width: 700px)': {
|
208
|
-
minWidth:
|
209
|
-
|
282
|
+
minWidth: 200,
|
283
|
+
width: 'calc(100% - 244px)',
|
284
|
+
marginRight: theme.spacing(2)
|
210
285
|
}
|
211
286
|
},
|
212
287
|
input: {
|
@@ -214,16 +289,18 @@ var styles = function styles() {
|
|
214
289
|
width: '100%'
|
215
290
|
},
|
216
291
|
'@media(min-width: 700px)': {
|
217
|
-
width:
|
292
|
+
width: 236
|
218
293
|
}
|
219
294
|
},
|
220
295
|
formControlLabel: {
|
221
|
-
top:
|
296
|
+
top: theme.spacing(5)
|
222
297
|
}
|
223
298
|
};
|
224
299
|
};
|
225
300
|
|
226
301
|
exports.styles = styles;
|
302
|
+
var PRESET_PERIOD_LIST = ['cd', 'pd', 'cw', 'pw', 'cm', 'pm', 'cq', 'pq', 'cy', 'yy'];
|
303
|
+
var CUSTOM_PERIOD_LIST = ['custom'];
|
227
304
|
|
228
305
|
var HiDateRangeSelector =
|
229
306
|
/*#__PURE__*/
|
@@ -304,37 +381,90 @@ function (_React$Component) {
|
|
304
381
|
}
|
305
382
|
}
|
306
383
|
}, {
|
307
|
-
key: "
|
308
|
-
value: function
|
384
|
+
key: "buildOptions",
|
385
|
+
value: function buildOptions() {
|
309
386
|
var _this2 = this;
|
310
387
|
|
311
388
|
var _this$props = this.props,
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
389
|
+
availableOptionKeys = _this$props.availableOptionKeys,
|
390
|
+
translations = _this$props.translations;
|
391
|
+
var selectedPreset = this.state.selectedPreset;
|
392
|
+
var options = [];
|
393
|
+
var presetOptionsAvailable = availableOptionKeys.filter(function (option) {
|
394
|
+
return PRESET_PERIOD_LIST.includes(option);
|
395
|
+
});
|
396
|
+
var customOptionsAvailable = availableOptionKeys.filter(function (option) {
|
397
|
+
return CUSTOM_PERIOD_LIST.includes(option);
|
398
|
+
});
|
399
|
+
|
400
|
+
if (presetOptionsAvailable) {
|
401
|
+
options.push({
|
402
|
+
id: "preset_periods_subheader",
|
403
|
+
type: PRESET_PERIOD_LIST.includes(selectedPreset) ? "primary-highlight" : "highlight",
|
404
|
+
pinned: true,
|
405
|
+
icon: "mdi_calendar",
|
406
|
+
label: translations.preset_periods
|
407
|
+
});
|
408
|
+
presetOptionsAvailable.forEach(function (option) {
|
409
|
+
options.push(_this2.options.find(function (_option) {
|
410
|
+
return _option.id === option;
|
411
|
+
}));
|
412
|
+
});
|
413
|
+
}
|
414
|
+
|
415
|
+
if (customOptionsAvailable) {
|
416
|
+
options.push({
|
417
|
+
id: "custom_periods_subheader",
|
418
|
+
type: CUSTOM_PERIOD_LIST.includes(selectedPreset) ? "primary-highlight" : "highlight",
|
419
|
+
pinned: true,
|
420
|
+
icon: "mdi_calendar_blank",
|
421
|
+
label: translations.custom_periods
|
422
|
+
});
|
423
|
+
customOptionsAvailable.forEach(function (option) {
|
424
|
+
options.push(_this2.options.find(function (_option) {
|
425
|
+
return _option.id === option;
|
426
|
+
}));
|
427
|
+
});
|
428
|
+
}
|
429
|
+
|
430
|
+
return options;
|
431
|
+
}
|
432
|
+
}, {
|
433
|
+
key: "render",
|
434
|
+
value: function render() {
|
435
|
+
var _this3 = this;
|
436
|
+
|
437
|
+
var _this$props2 = this.props,
|
438
|
+
availableOptionKeys = _this$props2.availableOptionKeys,
|
439
|
+
disabled = _this$props2.disabled,
|
440
|
+
enableTime = _this$props2.enableTime,
|
441
|
+
errorText = _this$props2.errorText,
|
442
|
+
fromError = _this$props2.fromError,
|
443
|
+
toError = _this$props2.toError,
|
444
|
+
helperIcon = _this$props2.helperIcon,
|
445
|
+
helperText = _this$props2.helperText,
|
446
|
+
idRange = _this$props2.idRange,
|
447
|
+
idSelect = _this$props2.idSelect,
|
448
|
+
minimumDate = _this$props2.minimumDate,
|
449
|
+
label = _this$props2.label,
|
450
|
+
from = _this$props2.from,
|
451
|
+
onChange = _this$props2.onChange,
|
452
|
+
required = _this$props2.required,
|
453
|
+
to = _this$props2.to,
|
454
|
+
translations = _this$props2.translations,
|
455
|
+
classes = _this$props2.classes,
|
456
|
+
selectProps = _this$props2.selectProps,
|
457
|
+
staticPosition = _this$props2.staticPosition,
|
458
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, ["availableOptionKeys", "disabled", "enableTime", "errorText", "fromError", "toError", "helperIcon", "helperText", "idRange", "idSelect", "minimumDate", "label", "from", "onChange", "required", "to", "translations", "classes", "selectProps", "staticPosition"]);
|
332
459
|
var _this$state = this.state,
|
333
460
|
selectedPreset = _this$state.selectedPreset,
|
334
461
|
containerWidth = _this$state.containerWidth;
|
335
462
|
var hiSelectableListProps = {
|
336
|
-
|
463
|
+
secondaryInline: false,
|
464
|
+
hideCheckbox: true,
|
465
|
+
lazy: false
|
337
466
|
};
|
467
|
+
var options = this.buildOptions();
|
338
468
|
return _react.default.createElement(_HiFormControl.default, {
|
339
469
|
disabled: disabled,
|
340
470
|
helperIcon: helperIcon,
|
@@ -351,7 +481,7 @@ function (_React$Component) {
|
|
351
481
|
flexDirection: 'column'
|
352
482
|
} : {},
|
353
483
|
ref: function ref(container) {
|
354
|
-
|
484
|
+
_this3.container = container;
|
355
485
|
}
|
356
486
|
}, _react.default.createElement("div", {
|
357
487
|
className: classes.select,
|
@@ -367,7 +497,7 @@ function (_React$Component) {
|
|
367
497
|
hideCheckbox: true,
|
368
498
|
hiSelectableListProps: hiSelectableListProps,
|
369
499
|
name: 'selectedPreset',
|
370
|
-
options:
|
500
|
+
options: options,
|
371
501
|
onChange: this.handleSelectChange('selectedPreset'),
|
372
502
|
required: required,
|
373
503
|
translations: translations,
|
@@ -418,7 +548,7 @@ function (_React$Component) {
|
|
418
548
|
}(_react.default.Component);
|
419
549
|
|
420
550
|
HiDateRangeSelector.defaultProps = {
|
421
|
-
availableOptionKeys: [
|
551
|
+
availableOptionKeys: [].concat(PRESET_PERIOD_LIST, CUSTOM_PERIOD_LIST),
|
422
552
|
enableTime: false,
|
423
553
|
returnSelectValue: false,
|
424
554
|
staticPosition: false,
|
@@ -441,6 +571,7 @@ HiDateRangeSelector.defaultProps = {
|
|
441
571
|
days: 'days',
|
442
572
|
custom_period: 'Custom Period',
|
443
573
|
yesterday: 'Yesterday',
|
574
|
+
from: 'from',
|
444
575
|
to: 'to',
|
445
576
|
to_now: 'to now',
|
446
577
|
current_week: 'Current Week',
|
@@ -450,12 +581,16 @@ HiDateRangeSelector.defaultProps = {
|
|
450
581
|
current_quarter: 'Current Quarter',
|
451
582
|
previous_quarter: 'Previous Quarter',
|
452
583
|
current_year: 'Current Year',
|
584
|
+
year_on_year: "Last twelve months",
|
453
585
|
invalid_format: 'The date format is not valid',
|
454
586
|
to_superior_from: 'Date from cannot be greater than date to',
|
455
587
|
date_superior_max_date: 'Date from cannot be greater than %s',
|
456
588
|
date_inferior_min_date: 'Date from cannot be before than %s',
|
457
589
|
missing_date_from: 'Missing date from',
|
458
|
-
missing_date_to: 'Missing date to'
|
590
|
+
missing_date_to: 'Missing date to',
|
591
|
+
preset_periods: 'Preset periods',
|
592
|
+
custom_periods: 'Custom periods',
|
593
|
+
custom_period_info: "Select a custom period"
|
459
594
|
}
|
460
595
|
};
|
461
596
|
|
@@ -17,7 +17,6 @@ var _default = function _default(theme) {
|
|
17
17
|
position: 'relative',
|
18
18
|
display: 'inline-block',
|
19
19
|
width: '100%',
|
20
|
-
minWidth: 252,
|
21
20
|
maxWidth: 500
|
22
21
|
},
|
23
22
|
rootMobile: (0, _objectSpread2.default)({}, theme.typography.b1, {
|
@@ -40,7 +39,7 @@ var _default = function _default(theme) {
|
|
40
39
|
position: 'relative',
|
41
40
|
display: 'inline-block',
|
42
41
|
width: 'calc(50% - 4px)',
|
43
|
-
|
42
|
+
marginRight: theme.spacing(1)
|
44
43
|
},
|
45
44
|
toInput: {
|
46
45
|
position: 'relative',
|
@@ -1,31 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
4
|
+
|
3
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
6
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
6
8
|
value: true
|
7
9
|
});
|
8
|
-
exports.default =
|
10
|
+
exports.default = void 0;
|
9
11
|
|
10
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
11
13
|
|
12
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
13
15
|
|
14
|
-
var
|
15
|
-
|
16
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
17
|
-
|
18
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
19
17
|
|
20
|
-
var
|
21
|
-
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
23
|
-
|
24
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
25
19
|
|
26
20
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
27
21
|
|
28
|
-
var _react =
|
22
|
+
var _react = _interopRequireWildcard(require("react"));
|
29
23
|
|
30
24
|
var _ExpansionPanel = _interopRequireDefault(require("@material-ui/core/ExpansionPanel"));
|
31
25
|
|
@@ -39,7 +33,7 @@ var _styles = require("@material-ui/core/styles");
|
|
39
33
|
|
40
34
|
var _classnames = _interopRequireDefault(require("classnames"));
|
41
35
|
|
42
|
-
var
|
36
|
+
var useStyles = (0, _styles.makeStyles)(function (theme) {
|
43
37
|
return {
|
44
38
|
summaryContent: {
|
45
39
|
display: 'flex',
|
@@ -114,105 +108,76 @@ var styles = function styles(theme) {
|
|
114
108
|
right: 0
|
115
109
|
}
|
116
110
|
};
|
117
|
-
};
|
111
|
+
});
|
118
112
|
/**
|
119
113
|
* HiExpansionPanel
|
120
114
|
*/
|
121
115
|
|
122
|
-
|
123
|
-
exports.styles = styles;
|
124
|
-
|
125
116
|
var _ref = _react.default.createElement(_HiIcon.default, {
|
126
117
|
icon: "mdi_menu_up",
|
127
118
|
size: 24
|
128
119
|
});
|
129
120
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
disabled: effectiveDisabled,
|
165
|
-
classes: {
|
166
|
-
root: classes.panel,
|
167
|
-
disabled: classes.disabledPanel
|
168
|
-
},
|
169
|
-
expanded: collapseDisable || expanded
|
170
|
-
}, props, {
|
171
|
-
TransitionProps: {
|
172
|
-
onExited: function onExited() {
|
173
|
-
_this2.setState({
|
174
|
-
panelDetailsExited: true
|
175
|
-
});
|
176
|
-
},
|
177
|
-
onEnter: function onEnter() {
|
178
|
-
_this2.setState({
|
179
|
-
panelDetailsExited: false
|
180
|
-
});
|
181
|
-
}
|
182
|
-
}
|
183
|
-
}), _react.default.createElement(_ExpansionPanelSummary.default, {
|
184
|
-
classes: {
|
185
|
-
root: classes.summaryRoot,
|
186
|
-
content: classes.summaryContent,
|
187
|
-
expanded: classes.expanded,
|
188
|
-
expandIcon: classes.expandIcon
|
189
|
-
},
|
190
|
-
className: (0, _classnames.default)((0, _defineProperty2.default)({}, classes.collapseDisable, collapseDisable)),
|
191
|
-
expandIcon: !collapseDisable && _ref
|
192
|
-
}, _react.default.createElement("div", {
|
193
|
-
className: classes.heading
|
194
|
-
}, heading), _react.default.createElement("div", {
|
195
|
-
className: classes.secondaryHeading
|
196
|
-
}, _react.default.createElement("span", {
|
197
|
-
className: classes.secondaryHeadingSpan
|
198
|
-
}, !effectiveDisabled ? secondaryHeading : secondaryHeadingDisabled), secondaryHeadingIcon)), !!children && _react.default.createElement(_ExpansionPanelDetails.default, {
|
199
|
-
className: (0, _classnames.default)(classes.panelDetails, (0, _defineProperty2.default)({}, classes.panelDetailsExited, this.state.panelDetailsExited))
|
200
|
-
}, children));
|
121
|
+
function HiExpansionPanel(props) {
|
122
|
+
var disabled = props.disabled,
|
123
|
+
heading = props.heading,
|
124
|
+
secondaryHeading = props.secondaryHeading,
|
125
|
+
secondaryHeadingDisabled = props.secondaryHeadingDisabled,
|
126
|
+
secondaryHeadingIcon = props.secondaryHeadingIcon,
|
127
|
+
collapseDisable = props.collapseDisable,
|
128
|
+
children = props.children,
|
129
|
+
expanded = props.expanded,
|
130
|
+
TransitionProps = props.TransitionProps,
|
131
|
+
others = (0, _objectWithoutProperties2.default)(props, ["disabled", "heading", "secondaryHeading", "secondaryHeadingDisabled", "secondaryHeadingIcon", "collapseDisable", "children", "expanded", "TransitionProps"]);
|
132
|
+
var classes = useStyles(props);
|
133
|
+
|
134
|
+
var _useState = (0, _react.useState)(!collapseDisable && !expanded),
|
135
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
136
|
+
panelDetailsExited = _useState2[0],
|
137
|
+
setPanelDetailsExited = _useState2[1];
|
138
|
+
|
139
|
+
var effectiveDisabled = disabled || !children;
|
140
|
+
return _react.default.createElement(_ExpansionPanel.default, (0, _extends2.default)({
|
141
|
+
disabled: effectiveDisabled,
|
142
|
+
expanded: collapseDisable || expanded,
|
143
|
+
TransitionProps: (0, _objectSpread2.default)({
|
144
|
+
onExited: function onExited() {
|
145
|
+
return setPanelDetailsExited(true);
|
146
|
+
},
|
147
|
+
onEnter: function onEnter() {
|
148
|
+
return setPanelDetailsExited(false);
|
149
|
+
}
|
150
|
+
}, TransitionProps)
|
151
|
+
}, others, {
|
152
|
+
classes: {
|
153
|
+
root: classes.panel,
|
154
|
+
disabled: classes.disabledPanel
|
201
155
|
}
|
202
|
-
}
|
203
|
-
|
204
|
-
|
156
|
+
}), _react.default.createElement(_ExpansionPanelSummary.default, {
|
157
|
+
classes: {
|
158
|
+
root: classes.summaryRoot,
|
159
|
+
content: classes.summaryContent,
|
160
|
+
expanded: classes.expanded,
|
161
|
+
expandIcon: classes.expandIcon
|
162
|
+
},
|
163
|
+
className: (0, _classnames.default)((0, _defineProperty2.default)({}, classes.collapseDisable, collapseDisable)),
|
164
|
+
expandIcon: !collapseDisable && _ref
|
165
|
+
}, _react.default.createElement("div", {
|
166
|
+
className: classes.heading
|
167
|
+
}, heading), _react.default.createElement("div", {
|
168
|
+
className: classes.secondaryHeading
|
169
|
+
}, _react.default.createElement("span", {
|
170
|
+
className: classes.secondaryHeadingSpan
|
171
|
+
}, !effectiveDisabled ? secondaryHeading : secondaryHeadingDisabled), secondaryHeadingIcon)), !!children && _react.default.createElement(_ExpansionPanelDetails.default, {
|
172
|
+
className: (0, _classnames.default)(classes.panelDetails, (0, _defineProperty2.default)({}, classes.panelDetailsExited, panelDetailsExited))
|
173
|
+
}, children));
|
174
|
+
}
|
205
175
|
|
206
176
|
HiExpansionPanel.defaultProps = {
|
207
177
|
disabled: false,
|
208
178
|
secondaryHeading: '',
|
209
179
|
secondaryHeadingIcon: '',
|
210
|
-
secondaryHeadingDisabled: '
|
180
|
+
secondaryHeadingDisabled: ''
|
211
181
|
};
|
212
|
-
|
213
|
-
var _default = (0, _styles.withStyles)(styles, {
|
214
|
-
hiComponent: true,
|
215
|
-
name: 'HmuiHiExpansionPanel'
|
216
|
-
})(HiExpansionPanel);
|
217
|
-
|
182
|
+
var _default = HiExpansionPanel;
|
218
183
|
exports.default = _default;
|
package/HiForm/HiFormControl.js
CHANGED
@@ -75,7 +75,7 @@ var styles = function styles(theme) {
|
|
75
75
|
},
|
76
76
|
'&$iconFullWidth': {
|
77
77
|
position: 'absolute',
|
78
|
-
right:
|
78
|
+
right: theme.spacing(1),
|
79
79
|
marginLeft: 0,
|
80
80
|
bottom: 0
|
81
81
|
}
|
@@ -87,11 +87,11 @@ var styles = function styles(theme) {
|
|
87
87
|
errorDiv: (0, _objectSpread2.default)({}, theme.typography.b3, {
|
88
88
|
backgroundColor: theme.palette.negative.main,
|
89
89
|
color: '#FFFFFF',
|
90
|
-
padding:
|
90
|
+
padding: theme.spacing(4, 2),
|
91
91
|
verticalAlign: 'middle',
|
92
92
|
borderRadius: 2,
|
93
93
|
position: 'relative',
|
94
|
-
marginBottom:
|
94
|
+
marginBottom: theme.spacing(2),
|
95
95
|
fontWeight: theme.typography.fontWeightRegular
|
96
96
|
}),
|
97
97
|
arrowDown: {
|
@@ -101,12 +101,12 @@ var styles = function styles(theme) {
|
|
101
101
|
borderRight: '4px solid transparent',
|
102
102
|
borderTop: '4px solid #000',
|
103
103
|
position: 'absolute',
|
104
|
-
bottom: -
|
104
|
+
bottom: theme.spacing(-1),
|
105
105
|
'&$arrowNotFullWidth': {
|
106
|
-
left:
|
106
|
+
left: theme.spacing(2)
|
107
107
|
},
|
108
108
|
'&$arrowFullWidth': {
|
109
|
-
right:
|
109
|
+
right: theme.spacing(3)
|
110
110
|
}
|
111
111
|
},
|
112
112
|
arrowNotFullWidth: {},
|
@@ -118,10 +118,10 @@ var styles = function styles(theme) {
|
|
118
118
|
width: '100%',
|
119
119
|
backgroundColor: '#ffffff',
|
120
120
|
color: theme.palette.neutral.normal,
|
121
|
-
padding:
|
121
|
+
padding: theme.spacing(4, 2),
|
122
122
|
borderRadius: 2,
|
123
123
|
position: 'relative',
|
124
|
-
marginBottom:
|
124
|
+
marginBottom: theme.spacing(2),
|
125
125
|
fontWeight: theme.typography.fontWeightRegular,
|
126
126
|
boxShadow: '0px 1px 7px rgba(0, 0, 0, 0.16)',
|
127
127
|
lineHeight: 1.5
|