@hipay/hipay-material-ui 2.3.5 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Guideline/index.js +2 -0
- package/HiChip/HiChip.js +1 -0
- package/HiDatePicker/HiDateRangeSelector.js +181 -46
- package/HiDatePicker/stylesheet.js +1 -2
- package/HiForm/HiFormControl.js +10 -9
- package/HiIcon/HiIcon.js +58 -54
- package/HiPaymentMeans/HiPaymentMeans.js +16 -4
- package/HiPin/HiPin.js +12 -20
- package/HiSelect/HiSelect.js +44 -10
- package/HiSelectableList/HiSelectableListItem.js +38 -24
- package/HiStepper/HiStep.js +194 -0
- package/HiStepper/HiStepper.js +59 -0
- package/HiStepper/index.js +23 -0
- package/HiSwitch/HiSwitch.js +4 -1
- package/es/Guideline/index.js +2 -0
- package/es/HiChip/HiChip.js +1 -0
- package/es/HiDatePicker/HiDateRangeSelector.js +181 -46
- package/es/HiDatePicker/stylesheet.js +1 -2
- package/es/HiForm/HiFormControl.js +10 -9
- package/es/HiIcon/HiIcon.js +58 -54
- package/es/HiPaymentMeans/HiPaymentMeans.js +16 -4
- package/es/HiPin/HiPin.js +12 -20
- package/es/HiSelect/HiSelect.js +44 -10
- package/es/HiSelectableList/HiSelectableListItem.js +38 -24
- package/es/HiStepper/HiStep.js +194 -0
- package/es/HiStepper/HiStepper.js +59 -0
- package/es/HiStepper/index.js +23 -0
- package/es/HiSwitch/HiSwitch.js +4 -1
- package/es/hi-svg-icons/HiAccount.js +5 -9
- package/es/hi-svg-icons/HiActivity.js +5 -9
- package/es/hi-svg-icons/HiAll.js +5 -9
- package/es/hi-svg-icons/HiBilling.js +5 -9
- package/es/hi-svg-icons/HiBriefcaseRescue.js +14 -12
- package/es/hi-svg-icons/HiCatalog.js +5 -9
- package/es/hi-svg-icons/HiCustomer.js +5 -9
- package/es/hi-svg-icons/HiDownload.js +8 -9
- package/es/hi-svg-icons/HiFinance.js +5 -9
- package/es/hi-svg-icons/HiIntelligence.js +5 -9
- package/es/hi-svg-icons/HiIntelligenceMenu.js +49 -0
- package/es/hi-svg-icons/HiLogoRounded.js +58 -0
- package/es/hi-svg-icons/HiOrder.js +5 -9
- package/es/hi-svg-icons/HiPaymentOrder.js +5 -9
- package/es/hi-svg-icons/HiPermission.js +5 -9
- package/es/hi-svg-icons/HiPriceGrid.js +5 -9
- package/es/hi-svg-icons/HiRoute.js +5 -9
- package/es/hi-svg-icons/HiSettlement.js +5 -9
- package/es/hi-svg-icons/HiSizeLarge.js +17 -8
- package/es/hi-svg-icons/HiSizeMedium.js +18 -7
- package/es/hi-svg-icons/HiSizeSmall.js +18 -7
- package/es/hi-svg-icons/HiStore.js +64 -0
- package/es/hi-svg-icons/HiStoreMenu.js +58 -0
- package/es/hi-svg-icons/HiTransaction.js +5 -9
- package/es/hi-svg-icons/HiTransactionMenu.js +46 -0
- package/es/hi-svg-icons/HiUser.js +5 -9
- package/es/hi-svg-icons/HiVendor.js +5 -9
- package/es/hi-svg-icons/HiWidget.js +5 -9
- package/es/hi-svg-icons/index.js +33 -1
- package/es/hi-svg-images/HiLogo.js +41 -0
- package/es/hi-svg-images/HiLogoWhite.js +41 -0
- package/es/hi-svg-images/index.js +23 -0
- 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/es/utils/helpers.js +10 -0
- package/hi-svg-icons/HiAccount.js +5 -9
- package/hi-svg-icons/HiActivity.js +5 -9
- package/hi-svg-icons/HiAll.js +5 -9
- package/hi-svg-icons/HiBilling.js +5 -9
- package/hi-svg-icons/HiBriefcaseRescue.js +14 -12
- package/hi-svg-icons/HiCatalog.js +5 -9
- package/hi-svg-icons/HiCustomer.js +5 -9
- package/hi-svg-icons/HiDownload.js +8 -9
- package/hi-svg-icons/HiFinance.js +5 -9
- package/hi-svg-icons/HiIntelligence.js +5 -9
- package/hi-svg-icons/HiIntelligenceMenu.js +49 -0
- package/hi-svg-icons/HiLogoRounded.js +58 -0
- package/hi-svg-icons/HiOrder.js +5 -9
- package/hi-svg-icons/HiPaymentOrder.js +5 -9
- package/hi-svg-icons/HiPermission.js +5 -9
- package/hi-svg-icons/HiPriceGrid.js +5 -9
- package/hi-svg-icons/HiRoute.js +5 -9
- package/hi-svg-icons/HiSettlement.js +5 -9
- package/hi-svg-icons/HiSizeLarge.js +17 -8
- package/hi-svg-icons/HiSizeMedium.js +18 -7
- package/hi-svg-icons/HiSizeSmall.js +18 -7
- package/hi-svg-icons/HiStore.js +64 -0
- package/hi-svg-icons/HiStoreMenu.js +58 -0
- package/hi-svg-icons/HiTransaction.js +5 -9
- package/hi-svg-icons/HiTransactionMenu.js +46 -0
- package/hi-svg-icons/HiUser.js +5 -9
- package/hi-svg-icons/HiVendor.js +5 -9
- package/hi-svg-icons/HiWidget.js +5 -9
- package/hi-svg-icons/index.js +33 -1
- package/hi-svg-images/HiLogo.js +41 -0
- package/hi-svg-images/HiLogoWhite.js +41 -0
- package/hi-svg-images/index.js +23 -0
- 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/utils/helpers.js +10 -0
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',
|
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
|
@@ -131,7 +131,7 @@ var styles = function styles(theme) {
|
|
131
131
|
},
|
132
132
|
icon: {
|
133
133
|
position: 'absolute',
|
134
|
-
fontSize:
|
134
|
+
fontSize: 20
|
135
135
|
}
|
136
136
|
};
|
137
137
|
};
|
@@ -291,6 +291,7 @@ function (_React$PureComponent) {
|
|
291
291
|
}(_react.default.PureComponent);
|
292
292
|
|
293
293
|
HiFormControl.defaultProps = {
|
294
|
+
id: (0, _helpers.uniqueId)(),
|
294
295
|
fullWidth: true,
|
295
296
|
required: true,
|
296
297
|
disabled: false,
|
package/HiIcon/HiIcon.js
CHANGED
@@ -11,9 +11,11 @@ exports.default = exports.useStyles = void 0;
|
|
11
11
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends"));
|
13
13
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
15
|
+
|
14
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
15
17
|
|
16
|
-
var _react =
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
17
19
|
|
18
20
|
var _classnames = _interopRequireDefault(require("classnames"));
|
19
21
|
|
@@ -51,66 +53,68 @@ var HiIcon = _react.default.forwardRef(function (props, ref) {
|
|
51
53
|
className = props.className,
|
52
54
|
icon = props.icon,
|
53
55
|
size = props.size,
|
54
|
-
|
56
|
+
color = props.color,
|
55
57
|
other = (0, _objectWithoutProperties2.default)(props, ["children", "className", "icon", "size", "color"]);
|
56
58
|
var classes = useStyles(props);
|
57
|
-
var iconName = icon !== null ? icon : children;
|
58
59
|
var theme = (0, _styles.useTheme)();
|
59
|
-
var
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
} // Specific HiPay icons
|
70
|
-
|
71
|
-
|
72
|
-
if (iconName && iconName.indexOf('hi_') === 0) {
|
73
|
-
var IconName = hiSvgIcons[(0, _helpers.capitalize)((0, _helpers.camelize)(iconName))];
|
74
|
-
return _react.default.createElement(IconName, (0, _extends2.default)({
|
75
|
-
ref: ref,
|
76
|
-
className: (0, _classnames.default)(classes.root, className),
|
77
|
-
color: color,
|
78
|
-
size: size
|
79
|
-
}, other));
|
80
|
-
}
|
81
|
-
|
82
|
-
color = ['primary', 'secondary', 'negative'].includes(_color) ? _color : 'inherit';
|
83
|
-
|
84
|
-
if (color === 'negative') {
|
85
|
-
color = 'error';
|
86
|
-
} // MDI - Material Design Icons - https://materialdesignicons.com
|
87
|
-
|
88
|
-
|
89
|
-
if (iconName && iconName.indexOf('mdi_') === 0) {
|
90
|
-
var _IconName = mdi[(0, _helpers.capitalize)((0, _helpers.camelize)(iconName.slice(4)))];
|
91
|
-
return _react.default.createElement(_IconName, (0, _extends2.default)({
|
92
|
-
ref: ref,
|
93
|
-
className: (0, _classnames.default)(classes.root, className),
|
94
|
-
color: color,
|
95
|
-
style: {
|
96
|
-
fontSize: size
|
97
|
-
}
|
98
|
-
}, other));
|
99
|
-
} // @material-ui/icons
|
100
|
-
|
101
|
-
|
102
|
-
return _react.default.createElement(_Icon.default, (0, _extends2.default)({
|
103
|
-
ref: ref,
|
104
|
-
className: (0, _classnames.default)(classes.root, className),
|
105
|
-
color: color,
|
106
|
-
style: {
|
107
|
-
fontSize: size
|
60
|
+
var iconName = icon !== null ? icon : children;
|
61
|
+
var iconType = (0, _react.useMemo)(function () {
|
62
|
+
if (iconName && iconName.indexOf('fa-') === 0) {
|
63
|
+
return "line_awesome";
|
64
|
+
} else if (iconName && iconName.indexOf('hi_') === 0) {
|
65
|
+
return "hipay";
|
66
|
+
} else if (iconName && iconName.indexOf('mdi_') === 0) {
|
67
|
+
return "mdi";
|
68
|
+
} else {
|
69
|
+
return "mui";
|
108
70
|
}
|
109
|
-
},
|
71
|
+
}, [iconName]);
|
72
|
+
|
73
|
+
switch (iconType) {
|
74
|
+
case "line_awesome":
|
75
|
+
return _react.default.createElement("i", (0, _extends2.default)({
|
76
|
+
ref: ref,
|
77
|
+
className: (0, _classnames.default)('fa', iconName, className, (0, _defineProperty2.default)({}, classes.root, color !== "inherit")),
|
78
|
+
style: {
|
79
|
+
fontSize: size
|
80
|
+
}
|
81
|
+
}, other));
|
82
|
+
|
83
|
+
case "hipay":
|
84
|
+
var HipayIconName = hiSvgIcons[(0, _helpers.capitalize)((0, _helpers.camelize)(iconName))];
|
85
|
+
return _react.default.createElement(HipayIconName, (0, _extends2.default)({
|
86
|
+
ref: ref,
|
87
|
+
className: (0, _classnames.default)(className, (0, _defineProperty2.default)({}, classes.root, color !== "inherit")),
|
88
|
+
color: "currentColor",
|
89
|
+
size: size
|
90
|
+
}, other));
|
91
|
+
|
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
|
+
case "mui":
|
104
|
+
default:
|
105
|
+
return _react.default.createElement(_Icon.default, (0, _extends2.default)({
|
106
|
+
ref: ref,
|
107
|
+
className: (0, _classnames.default)(className, (0, _defineProperty2.default)({}, classes.root, color !== "inherit")),
|
108
|
+
color: "inherit",
|
109
|
+
style: {
|
110
|
+
fontSize: size
|
111
|
+
}
|
112
|
+
}, other), iconName);
|
113
|
+
}
|
110
114
|
});
|
111
115
|
|
112
116
|
HiIcon.defaultProps = {
|
113
|
-
color: '
|
117
|
+
color: 'inherit',
|
114
118
|
icon: null,
|
115
119
|
size: 20
|
116
120
|
};
|
@@ -153,27 +153,39 @@ var styles = function styles(theme) {
|
|
153
153
|
fontSize: 18,
|
154
154
|
width: 235,
|
155
155
|
paddingLeft: 21,
|
156
|
-
marginTop: 16
|
156
|
+
marginTop: 16,
|
157
|
+
overflow: 'hidden',
|
158
|
+
whiteSpace: 'nowrap',
|
159
|
+
textOverflow: 'ellipsis'
|
157
160
|
},
|
158
161
|
giftCardNumber: {
|
159
162
|
fontSize: 18,
|
160
163
|
width: 235,
|
161
164
|
paddingLeft: 21,
|
162
|
-
marginBottom: 28
|
165
|
+
marginBottom: 28,
|
166
|
+
overflow: 'hidden',
|
167
|
+
whiteSpace: 'nowrap',
|
168
|
+
textOverflow: 'ellipsis'
|
163
169
|
},
|
164
170
|
corporateNumber: {
|
165
171
|
fontSize: 18,
|
166
172
|
height: 25,
|
167
173
|
width: 234,
|
168
174
|
paddingLeft: 22,
|
169
|
-
marginBottom: 4
|
175
|
+
marginBottom: 4,
|
176
|
+
overflow: 'hidden',
|
177
|
+
whiteSpace: 'nowrap',
|
178
|
+
textOverflow: 'ellipsis'
|
170
179
|
},
|
171
180
|
ibanNumber: {
|
172
181
|
fontSize: 14,
|
173
182
|
height: 16,
|
174
183
|
width: 256,
|
175
184
|
paddingLeft: 12,
|
176
|
-
marginBottom: 11
|
185
|
+
marginBottom: 11,
|
186
|
+
overflow: 'hidden',
|
187
|
+
whiteSpace: 'nowrap',
|
188
|
+
textOverflow: 'ellipsis'
|
177
189
|
},
|
178
190
|
memberSince: {
|
179
191
|
display: 'block',
|