@useblu/ocean-react 1.131.0 → 1.133.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/CHANGELOG.md +12 -0
- package/Date/DatePicker.d.ts +1 -1
- package/Date/DatePicker.d.ts.map +1 -1
- package/Date/DateRange.d.ts +1 -1
- package/Date/DateRange.d.ts.map +1 -1
- package/Date/components/DisabledDaysTooltip.d.ts +2 -0
- package/Date/components/DisabledDaysTooltip.d.ts.map +1 -1
- package/Date/hooks/useDatePicker.d.ts.map +1 -1
- package/Date/hooks/useDateRange.d.ts.map +1 -1
- package/Date/hooks/useDisabledDaysTooltip.d.ts +14 -1
- package/Date/hooks/useDisabledDaysTooltip.d.ts.map +1 -1
- package/Date/types/DatePicker.types.d.ts +7 -3
- package/Date/types/DatePicker.types.d.ts.map +1 -1
- package/Date/types/DateRange.types.d.ts +7 -3
- package/Date/types/DateRange.types.d.ts.map +1 -1
- package/Date/utils/testHelpers.d.ts +9 -0
- package/Date/utils/testHelpers.d.ts.map +1 -1
- package/ListAction/ListAction.d.ts +5 -0
- package/ListAction/ListAction.d.ts.map +1 -1
- package/ListAction/index.d.ts +1 -0
- package/ListAction/index.d.ts.map +1 -1
- package/TransactionListExpandable/TransactionListExpandable.d.ts +47 -0
- package/TransactionListExpandable/TransactionListExpandable.d.ts.map +1 -0
- package/TransactionListExpandable/index.d.ts +3 -0
- package/TransactionListExpandable/index.d.ts.map +1 -0
- package/_shared/components/AmountDetails/AmountDetails.d.ts +15 -0
- package/_shared/components/AmountDetails/AmountDetails.d.ts.map +1 -0
- package/_shared/components/AmountDetails/index.d.ts +3 -0
- package/_shared/components/AmountDetails/index.d.ts.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.es.js +151 -43
- package/index.es.js.map +1 -1
- package/index.js +151 -42
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -34592,35 +34592,65 @@ var getInputPlaceholder = function (localeOption) {
|
|
|
34592
34592
|
|
|
34593
34593
|
function useDisabledDaysTooltip(disabledDaysMessage) {
|
|
34594
34594
|
var _a = e.useState(false), showDisabledTooltip = _a[0], setShowDisabledTooltip = _a[1];
|
|
34595
|
+
var _b = e.useState(''), tooltipMessage = _b[0], setTooltipMessage = _b[1];
|
|
34596
|
+
var _c = e.useState(null), tooltipPosition = _c[0], setTooltipPosition = _c[1];
|
|
34595
34597
|
var tooltipTimerRef = e.useRef(null);
|
|
34596
|
-
var
|
|
34597
|
-
|
|
34598
|
-
|
|
34599
|
-
|
|
34600
|
-
|
|
34601
|
-
|
|
34602
|
-
|
|
34598
|
+
var lastDisabledClickRef = e.useRef(null);
|
|
34599
|
+
var resolveMessage = e.useCallback(function (day) {
|
|
34600
|
+
var _a;
|
|
34601
|
+
if (!disabledDaysMessage)
|
|
34602
|
+
return '';
|
|
34603
|
+
if (typeof disabledDaysMessage === 'string')
|
|
34604
|
+
return disabledDaysMessage;
|
|
34605
|
+
if (!day)
|
|
34606
|
+
return '';
|
|
34607
|
+
var entry = disabledDaysMessage.find(function (e) { return isSameDay(e.date, day); });
|
|
34608
|
+
return (_a = entry === null || entry === void 0 ? void 0 : entry.message) !== null && _a !== void 0 ? _a : '';
|
|
34603
34609
|
}, [disabledDaysMessage]);
|
|
34604
|
-
var
|
|
34605
|
-
|
|
34606
|
-
|
|
34610
|
+
var handleCalendarClick = e.useCallback(function (event) {
|
|
34611
|
+
if (!disabledDaysMessage)
|
|
34612
|
+
return;
|
|
34613
|
+
var target = event.target;
|
|
34614
|
+
var disabledDay = target.closest('button.ods-date__disabled');
|
|
34615
|
+
if (!disabledDay)
|
|
34616
|
+
return;
|
|
34617
|
+
var message = resolveMessage(lastDisabledClickRef.current);
|
|
34618
|
+
if (!message)
|
|
34619
|
+
return;
|
|
34620
|
+
var container = event.currentTarget;
|
|
34621
|
+
var containerRect = container.getBoundingClientRect();
|
|
34622
|
+
var dayRect = disabledDay.getBoundingClientRect();
|
|
34623
|
+
var arrowLeft = dayRect.left - containerRect.left + dayRect.width / 2;
|
|
34624
|
+
var top = dayRect.top - containerRect.top - 12;
|
|
34625
|
+
if (tooltipTimerRef.current)
|
|
34626
|
+
clearTimeout(tooltipTimerRef.current);
|
|
34627
|
+
setTooltipMessage(message);
|
|
34628
|
+
setTooltipPosition({ top: top, arrowLeft: arrowLeft });
|
|
34629
|
+
setShowDisabledTooltip(true);
|
|
34630
|
+
tooltipTimerRef.current = setTimeout(function () { return setShowDisabledTooltip(false); }, 5000);
|
|
34631
|
+
}, [disabledDaysMessage, resolveMessage]);
|
|
34607
34632
|
var createDayClickHandler = e.useCallback(function (originalHandler) {
|
|
34608
34633
|
return function (day, modifiers) {
|
|
34609
34634
|
if (modifiers.disabled) {
|
|
34610
|
-
|
|
34635
|
+
lastDisabledClickRef.current = day;
|
|
34611
34636
|
return;
|
|
34612
34637
|
}
|
|
34613
|
-
|
|
34638
|
+
lastDisabledClickRef.current = null;
|
|
34639
|
+
setShowDisabledTooltip(false);
|
|
34640
|
+
setTooltipPosition(null);
|
|
34614
34641
|
originalHandler(day);
|
|
34615
34642
|
};
|
|
34616
|
-
}, [
|
|
34643
|
+
}, []);
|
|
34617
34644
|
e.useEffect(function () { return function () {
|
|
34618
34645
|
if (tooltipTimerRef.current)
|
|
34619
34646
|
clearTimeout(tooltipTimerRef.current);
|
|
34620
34647
|
}; }, []);
|
|
34621
34648
|
return {
|
|
34622
34649
|
showDisabledTooltip: showDisabledTooltip,
|
|
34650
|
+
tooltipMessage: tooltipMessage,
|
|
34651
|
+
tooltipPosition: tooltipPosition,
|
|
34623
34652
|
createDayClickHandler: createDayClickHandler,
|
|
34653
|
+
handleCalendarClick: handleCalendarClick,
|
|
34624
34654
|
};
|
|
34625
34655
|
}
|
|
34626
34656
|
|
|
@@ -34636,7 +34666,7 @@ function useDatePickerSingle(_a) {
|
|
|
34636
34666
|
var _c = e.useState(''), currentField = _c[0], setCurrentField = _c[1];
|
|
34637
34667
|
var _d = e.useState(), currentMonthToDisplay = _d[0], setCurrentMonthToDisplay = _d[1];
|
|
34638
34668
|
var _e = e.useState(''), datePickerCache = _e[0], setDatePickerCache = _e[1];
|
|
34639
|
-
var _f = useDisabledDaysTooltip(disabledDaysMessage), showDisabledTooltip = _f.showDisabledTooltip, createDayClickHandler = _f.createDayClickHandler;
|
|
34669
|
+
var _f = useDisabledDaysTooltip(disabledDaysMessage), showDisabledTooltip = _f.showDisabledTooltip, tooltipMessage = _f.tooltipMessage, tooltipPosition = _f.tooltipPosition, createDayClickHandler = _f.createDayClickHandler, handleCalendarClick = _f.handleCalendarClick;
|
|
34640
34670
|
var fromDate = parse$1(value || '', localeDateFormat, new Date());
|
|
34641
34671
|
var updateState = function (updateData, updateCache) {
|
|
34642
34672
|
onSelect(updateData);
|
|
@@ -34721,6 +34751,9 @@ function useDatePickerSingle(_a) {
|
|
|
34721
34751
|
handleCloseByOutside: handleCloseByOutside,
|
|
34722
34752
|
currentMonthToDisplay: currentMonthToDisplay,
|
|
34723
34753
|
showDisabledTooltip: showDisabledTooltip,
|
|
34754
|
+
tooltipMessage: tooltipMessage,
|
|
34755
|
+
tooltipPosition: tooltipPosition,
|
|
34756
|
+
handleCalendarClick: handleCalendarClick,
|
|
34724
34757
|
handleDayClickWithModifiers: handleDayClickWithModifiers,
|
|
34725
34758
|
};
|
|
34726
34759
|
}
|
|
@@ -34756,10 +34789,12 @@ var DatePickerHeader = function (_a) {
|
|
|
34756
34789
|
};
|
|
34757
34790
|
|
|
34758
34791
|
var DisabledDaysTooltip = function (_a) {
|
|
34759
|
-
var message = _a.message, show = _a.show, _b = _a.testId, testId = _b === void 0 ? 'datepicker-disabled-tooltip' : _b;
|
|
34760
|
-
if (!show)
|
|
34792
|
+
var message = _a.message, show = _a.show, position = _a.position, _b = _a.testId, testId = _b === void 0 ? 'datepicker-disabled-tooltip' : _b;
|
|
34793
|
+
if (!show || !position)
|
|
34761
34794
|
return null;
|
|
34762
|
-
return (e.createElement("div", { className: "ods-date__disabled-tooltip", role: "tooltip", "data-testid": testId
|
|
34795
|
+
return (e.createElement("div", { className: "ods-date__disabled-tooltip", role: "tooltip", "data-testid": testId, style: { top: "".concat(position.top, "px") } },
|
|
34796
|
+
message,
|
|
34797
|
+
e.createElement("div", { className: "ods-date__disabled-tooltip__arrow", style: { left: "".concat(position.arrowLeft, "px") } })));
|
|
34763
34798
|
};
|
|
34764
34799
|
|
|
34765
34800
|
var DatePickerSingle = e.forwardRef(function (_a, ref) {
|
|
@@ -34770,13 +34805,11 @@ var DatePickerSingle = e.forwardRef(function (_a, ref) {
|
|
|
34770
34805
|
startsToday: startsToday,
|
|
34771
34806
|
locale: locale,
|
|
34772
34807
|
disabledDaysMessage: disabledDaysMessage,
|
|
34773
|
-
}), input1Ref = _c.input1Ref, showDayPicker = _c.showDayPicker, selectedDay = _c.selectedDay, CustomStyles = _c.CustomStyles, localeOption = _c.localeOption, currentField = _c.currentField, inputPlaceholder = _c.inputPlaceholder, inputChange = _c.inputChange, createHandleToggleClick = _c.createHandleToggleClick, formatDay = _c.formatDay, handleCloseByOutside = _c.handleCloseByOutside, currentMonthToDisplay = _c.currentMonthToDisplay, showDisabledTooltip = _c.showDisabledTooltip, handleDayClickWithModifiers = _c.handleDayClickWithModifiers;
|
|
34808
|
+
}), input1Ref = _c.input1Ref, showDayPicker = _c.showDayPicker, selectedDay = _c.selectedDay, CustomStyles = _c.CustomStyles, localeOption = _c.localeOption, currentField = _c.currentField, inputPlaceholder = _c.inputPlaceholder, inputChange = _c.inputChange, createHandleToggleClick = _c.createHandleToggleClick, formatDay = _c.formatDay, handleCloseByOutside = _c.handleCloseByOutside, currentMonthToDisplay = _c.currentMonthToDisplay, showDisabledTooltip = _c.showDisabledTooltip, tooltipMessage = _c.tooltipMessage, tooltipPosition = _c.tooltipPosition, handleCalendarClick = _c.handleCalendarClick, handleDayClickWithModifiers = _c.handleDayClickWithModifiers;
|
|
34774
34809
|
var calendarOpen = inline || showDayPicker;
|
|
34775
34810
|
var CaptionWithTooltip = function (_a) {
|
|
34776
34811
|
var displayMonth = _a.displayMonth;
|
|
34777
|
-
return (e.createElement(e.Fragment, null,
|
|
34778
|
-
DatePickerHeader({ displayMonth: displayMonth, locale: localeOption, mode: 'single' }),
|
|
34779
|
-
disabledDaysMessage && (e.createElement(DisabledDaysTooltip, { message: disabledDaysMessage, show: showDisabledTooltip }))));
|
|
34812
|
+
return (e.createElement(e.Fragment, null, DatePickerHeader({ displayMonth: displayMonth, locale: localeOption, mode: 'single' })));
|
|
34780
34813
|
};
|
|
34781
34814
|
return (e.createElement("div", null,
|
|
34782
34815
|
calendarOpen && !inline && (e.createElement("div", { className: "ods-date-background", "data-testid": "date-picker-outside", onClick: handleCloseByOutside })),
|
|
@@ -34788,10 +34821,11 @@ var DatePickerSingle = e.forwardRef(function (_a, ref) {
|
|
|
34788
34821
|
'date-field-focussed': currentField === 'start-date',
|
|
34789
34822
|
}), name: "start-date", value: value, onChange: (editable && inputChange) || undefined, placeholder: inputPlaceholder, adornment: e.createElement(On, { size: 20, stroke: "#B6B9CC" }), autoComplete: "off", readOnly: !editable, disabled: disabled, error: !disabled && error, inputMode: "numeric", helperText: (!disabled && !showDayPicker && helperText) || undefined, maxLength: 10 }))),
|
|
34790
34823
|
inline && label && (e.createElement("div", { className: "ods-date__inline-label" }, label)),
|
|
34791
|
-
!disabled && calendarOpen && (e.createElement("div", { "data-testid": "datepicker-calendar" },
|
|
34824
|
+
!disabled && calendarOpen && (e.createElement("div", { "data-testid": "datepicker-calendar", className: "ods-date__calendar-container", role: "presentation", onClick: handleCalendarClick },
|
|
34792
34825
|
e.createElement(DayPicker, { mode: "single", locale: localeOption, weekStartsOn: 0, classNames: CustomStyles(inline), className: className, onDayClick: handleDayClickWithModifiers, formatters: { formatDay: formatDay }, selected: selectedDay, disabled: startsToday ? { before: new Date() } : disabledDays, defaultMonth: currentMonthToDisplay, components: {
|
|
34793
34826
|
Caption: CaptionWithTooltip,
|
|
34794
|
-
} })
|
|
34827
|
+
} }),
|
|
34828
|
+
disabledDaysMessage && (e.createElement(DisabledDaysTooltip, { message: tooltipMessage, show: showDisabledTooltip, position: tooltipPosition }))))))));
|
|
34795
34829
|
});
|
|
34796
34830
|
DatePickerSingle.displayName = 'DatePickerSingle';
|
|
34797
34831
|
|
|
@@ -34808,7 +34842,7 @@ function useDatePicker(_a) {
|
|
|
34808
34842
|
var _d = e.useState(), currentMonthToDisplay = _d[0], setCurrentMonthToDisplay = _d[1];
|
|
34809
34843
|
var _e = e.useState({ from: '', to: '' }), datePickerCache = _e[0], setDatePickerCache = _e[1];
|
|
34810
34844
|
var _f = e.useState(false), firstInputClicked = _f[0], setFirstInputClicked = _f[1];
|
|
34811
|
-
var _g = useDisabledDaysTooltip(disabledDaysMessage), showDisabledTooltip = _g.showDisabledTooltip, createDayClickHandler = _g.createDayClickHandler;
|
|
34845
|
+
var _g = useDisabledDaysTooltip(disabledDaysMessage), showDisabledTooltip = _g.showDisabledTooltip, tooltipMessage = _g.tooltipMessage, tooltipPosition = _g.tooltipPosition, createDayClickHandler = _g.createDayClickHandler, handleCalendarClick = _g.handleCalendarClick;
|
|
34812
34846
|
var fromDate = parse$1(values.from, localeDateFormat, new Date());
|
|
34813
34847
|
var toDate = parse$1(values.to, localeDateFormat, new Date());
|
|
34814
34848
|
var updateState = function (updateData, updateCache) {
|
|
@@ -34961,6 +34995,9 @@ function useDatePicker(_a) {
|
|
|
34961
34995
|
handleDayClick: handleDayClick,
|
|
34962
34996
|
handleDayClickWithModifiers: handleDayClickWithModifiers,
|
|
34963
34997
|
showDisabledTooltip: showDisabledTooltip,
|
|
34998
|
+
tooltipMessage: tooltipMessage,
|
|
34999
|
+
tooltipPosition: tooltipPosition,
|
|
35000
|
+
handleCalendarClick: handleCalendarClick,
|
|
34964
35001
|
inputChange: inputChange,
|
|
34965
35002
|
createHandleToggleClick: createHandleToggleClick,
|
|
34966
35003
|
formatDay: formatDay,
|
|
@@ -34978,7 +35015,7 @@ var DatePickerRange = e.forwardRef(function (_a, ref) {
|
|
|
34978
35015
|
startsToday: startsToday,
|
|
34979
35016
|
locale: locale,
|
|
34980
35017
|
disabledDaysMessage: disabledDaysMessage,
|
|
34981
|
-
}), input1Ref = _b.input1Ref, input2Ref = _b.input2Ref, showDayPicker = _b.showDayPicker, selectedDays = _b.selectedDays, CustomStyles = _b.CustomStyles, localeOption = _b.localeOption, currentField = _b.currentField, inputPlaceholder = _b.inputPlaceholder, handleDayMouseEnter = _b.handleDayMouseEnter, handleDayClickWithModifiers = _b.handleDayClickWithModifiers, showDisabledTooltip = _b.showDisabledTooltip, handleDisplayMonth = _b.handleDisplayMonth, inputChange = _b.inputChange, createHandleToggleClick = _b.createHandleToggleClick, formatDay = _b.formatDay, handleCloseByOutside = _b.handleCloseByOutside, currentMonthToDisplay = _b.currentMonthToDisplay;
|
|
35018
|
+
}), input1Ref = _b.input1Ref, input2Ref = _b.input2Ref, showDayPicker = _b.showDayPicker, selectedDays = _b.selectedDays, CustomStyles = _b.CustomStyles, localeOption = _b.localeOption, currentField = _b.currentField, inputPlaceholder = _b.inputPlaceholder, handleDayMouseEnter = _b.handleDayMouseEnter, handleDayClickWithModifiers = _b.handleDayClickWithModifiers, showDisabledTooltip = _b.showDisabledTooltip, tooltipMessage = _b.tooltipMessage, tooltipPosition = _b.tooltipPosition, handleCalendarClick = _b.handleCalendarClick, handleDisplayMonth = _b.handleDisplayMonth, inputChange = _b.inputChange, createHandleToggleClick = _b.createHandleToggleClick, formatDay = _b.formatDay, handleCloseByOutside = _b.handleCloseByOutside, currentMonthToDisplay = _b.currentMonthToDisplay;
|
|
34982
35019
|
return (e.createElement("div", null,
|
|
34983
35020
|
showDayPicker && (e.createElement("div", { className: "ods-date-background", "data-testid": "date-picker-outside", onClick: handleCloseByOutside })),
|
|
34984
35021
|
e.createElement("div", __assign$1({ className: classNames('ods-date', className), ref: ref }, rest),
|
|
@@ -34993,15 +35030,14 @@ var DatePickerRange = e.forwardRef(function (_a, ref) {
|
|
|
34993
35030
|
e.createElement(Input, { ref: input2Ref, "data-testid": "datepicker-input-2", id: "end-date", type: "text", className: classNames({
|
|
34994
35031
|
'date-field-focussed': currentField === 'end-date',
|
|
34995
35032
|
}), name: "end-date", value: values.to, onChange: (editable && inputChange) || undefined, placeholder: inputPlaceholder, adornment: e.createElement(On, { size: 20, stroke: "#B6B9CC" }), autoComplete: "off", readOnly: !editable, disabled: disabled, error: !disabled && error, inputMode: "numeric", helperText: (!disabled && !showDayPicker && helperText) || undefined, maxLength: 10 })),
|
|
34996
|
-
!disabled && showDayPicker && (e.createElement("div", { "data-testid": "datepicker-calendar" },
|
|
35033
|
+
!disabled && showDayPicker && (e.createElement("div", { "data-testid": "datepicker-calendar", className: "ods-date__calendar-container", role: "presentation", onClick: handleCalendarClick },
|
|
34997
35034
|
e.createElement(DayPicker, { mode: "range", locale: localeOption, weekStartsOn: 0, classNames: CustomStyles, className: className, onDayClick: handleDayClickWithModifiers, onDayMouseEnter: function (day) { return handleDayMouseEnter(day); }, formatters: { formatDay: formatDay }, selected: selectedDays, disabled: startsToday ? { before: new Date() } : disabledDays, defaultMonth: currentMonthToDisplay, components: {
|
|
34998
35035
|
Caption: function (_a) {
|
|
34999
35036
|
var displayMonth = _a.displayMonth;
|
|
35000
|
-
return (e.createElement(
|
|
35001
|
-
e.createElement(DatePickerHeader, { locale: localeOption, displayMonth: handleDisplayMonth(displayMonth) }),
|
|
35002
|
-
disabledDaysMessage && (e.createElement(DisabledDaysTooltip, { message: disabledDaysMessage, show: showDisabledTooltip }))));
|
|
35037
|
+
return (e.createElement(DatePickerHeader, { locale: localeOption, displayMonth: handleDisplayMonth(displayMonth) }));
|
|
35003
35038
|
},
|
|
35004
|
-
} })
|
|
35039
|
+
} }),
|
|
35040
|
+
disabledDaysMessage && (e.createElement(DisabledDaysTooltip, { message: tooltipMessage, show: showDisabledTooltip, position: tooltipPosition }))))))));
|
|
35005
35041
|
});
|
|
35006
35042
|
DatePickerRange.displayName = 'DatePickerRange';
|
|
35007
35043
|
|
|
@@ -47749,9 +47785,26 @@ var InternalListActions = forwardRef(function (_a, forwardedRef) {
|
|
|
47749
47785
|
});
|
|
47750
47786
|
InternalListActions.displayName = 'InternalListActions';
|
|
47751
47787
|
|
|
47788
|
+
var AmountDetails = function (_a) {
|
|
47789
|
+
var amount = _a.amount, _b = _a.type, type = _b === void 0 ? 'default' : _b, indicator = _a.indicator, _c = _a.indicatorSize, indicatorSize = _c === void 0 ? 'small' : _c, _d = _a.showIndicator, showIndicator = _d === void 0 ? true : _d, additionalData = _a.additionalData, _e = _a.showAdditionalData, showAdditionalData = _e === void 0 ? true : _e;
|
|
47790
|
+
var isNegative = type === 'negative';
|
|
47791
|
+
var isPositive = type === 'positive';
|
|
47792
|
+
return (e.createElement("div", { className: "ods-amount-details" },
|
|
47793
|
+
e.createElement("div", { className: "ods-amount-details__main" },
|
|
47794
|
+
isNegative ? (e.createElement("div", { className: "ods-amount-details__amount-row" },
|
|
47795
|
+
e.createElement("span", { className: "ods-amount-details__amount-sign" }, "- "),
|
|
47796
|
+
e.createElement("p", { className: "ods-amount-details__amount" }, amount))) : (e.createElement("p", { className: classNames('ods-amount-details__amount', {
|
|
47797
|
+
'ods-amount-details__amount--positive': isPositive,
|
|
47798
|
+
}) }, amount)),
|
|
47799
|
+
showIndicator && indicator && (e.createElement("div", { className: classNames('ods-amount-details__indicator', {
|
|
47800
|
+
'ods-amount-details__indicator--medium': indicatorSize === 'medium',
|
|
47801
|
+
}) }, indicator))),
|
|
47802
|
+
showAdditionalData && additionalData && (e.createElement(Typography, { variant: "captionbold", className: "ods-amount-details__caption" }, additionalData))));
|
|
47803
|
+
};
|
|
47804
|
+
|
|
47752
47805
|
var ListAction = e.forwardRef(function (_a, ref) {
|
|
47753
47806
|
var _b;
|
|
47754
|
-
var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, icon = _a.icon, indicator = _a.indicator, _h = _a.actionType, actionType = _h === void 0 ? 'chevron' : _h, menuActions = _a.menuActions, _j = _a.menuPosition, menuPosition = _j === void 0 ? 'bottom-right' : _j, onClick = _a.onClick, className = _a.className, _k = _a.showDivider, showDivider = _k === void 0 ? false : _k, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "disabled", "loading", "icon", "indicator", "actionType", "menuActions", "menuPosition", "onClick", "className", "showDivider"]);
|
|
47807
|
+
var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, icon = _a.icon, indicator = _a.indicator, _h = _a.actionType, actionType = _h === void 0 ? 'chevron' : _h, menuActions = _a.menuActions, _j = _a.menuPosition, menuPosition = _j === void 0 ? 'bottom-right' : _j, onClick = _a.onClick, className = _a.className, _k = _a.showDivider, showDivider = _k === void 0 ? false : _k, amountDetails = _a.amountDetails, position = _a.position, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "disabled", "loading", "icon", "indicator", "actionType", "menuActions", "menuPosition", "onClick", "className", "showDivider", "amountDetails", "position"]);
|
|
47755
47808
|
var _l = useState(false), isSwipeOpen = _l[0], setIsSwipeOpen = _l[1];
|
|
47756
47809
|
var _m = useState(0), menuWidth = _m[0], setMenuWidth = _m[1];
|
|
47757
47810
|
var handleSwipeOpenChange = function (isOpen, width) {
|
|
@@ -47762,7 +47815,7 @@ var ListAction = e.forwardRef(function (_a, ref) {
|
|
|
47762
47815
|
};
|
|
47763
47816
|
var renderActionIcon = function () {
|
|
47764
47817
|
if (actionType === 'chevron') {
|
|
47765
|
-
return (e.createElement("div", { className:
|
|
47818
|
+
return (e.createElement("div", { className: "ods-list-action__action" },
|
|
47766
47819
|
e.createElement(re, { size: 20 })));
|
|
47767
47820
|
}
|
|
47768
47821
|
if (actionType === 'menu' || actionType === 'swipe') {
|
|
@@ -47770,19 +47823,32 @@ var ListAction = e.forwardRef(function (_a, ref) {
|
|
|
47770
47823
|
}
|
|
47771
47824
|
return null;
|
|
47772
47825
|
};
|
|
47773
|
-
var renderLoadingContent = function () { return (e.createElement("div", { className:
|
|
47774
|
-
e.createElement(SkeletonBar, { width:
|
|
47775
|
-
e.createElement(SkeletonBar, { width:
|
|
47826
|
+
var renderLoadingContent = function () { return (e.createElement("div", { className: "ods-list-action__skeleton" },
|
|
47827
|
+
e.createElement(SkeletonBar, { width: "40%", height: "16px" }),
|
|
47828
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" }))); };
|
|
47776
47829
|
var contentStyle = isSwipeOpen && menuWidth > 0
|
|
47777
47830
|
? { transform: "translateX(-".concat(menuWidth, "px)") }
|
|
47778
47831
|
: {};
|
|
47832
|
+
var showLeading = position && icon;
|
|
47833
|
+
var showLineAbove = position === 'middle' || position === 'last';
|
|
47834
|
+
var showLineBelow = position === 'first' || position === 'middle';
|
|
47779
47835
|
var renderContent = function () { return (e.createElement(e.Fragment, null,
|
|
47780
|
-
e.createElement("div", { className:
|
|
47781
|
-
|
|
47836
|
+
e.createElement("div", { className: "ods-list-action__content", style: contentStyle },
|
|
47837
|
+
showLeading ? (e.createElement("div", { className: "ods-list-action__position" },
|
|
47838
|
+
e.createElement("div", { className: classNames('ods-list-action__position-line', {
|
|
47839
|
+
'ods-list-action__position-line--visible': showLineAbove,
|
|
47840
|
+
}) }),
|
|
47841
|
+
e.createElement("div", { className: classNames('ods-list-action__icon', {
|
|
47842
|
+
'ods-list-action__icon--inactive': status === 'inactive',
|
|
47843
|
+
}) }, icon),
|
|
47844
|
+
e.createElement("div", { className: classNames('ods-list-action__position-line', {
|
|
47845
|
+
'ods-list-action__position-line--visible': showLineBelow,
|
|
47846
|
+
}) }))) : (icon && (e.createElement("div", { className: classNames('ods-list-action__icon', {
|
|
47782
47847
|
'ods-list-action__icon--inactive': status === 'inactive',
|
|
47783
|
-
}) }, icon)),
|
|
47848
|
+
}) }, icon))),
|
|
47784
47849
|
e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: status }),
|
|
47785
|
-
|
|
47850
|
+
amountDetails && e.createElement(AmountDetails, __assign$1({ type: status }, amountDetails)),
|
|
47851
|
+
indicator && (e.createElement("div", { className: "ods-list-action__indicator" }, indicator))),
|
|
47786
47852
|
renderActionIcon())); };
|
|
47787
47853
|
var buttonClassName = classNames('ods-list-action', className, (_b = {
|
|
47788
47854
|
'ods-list-action--loading': loading,
|
|
@@ -47792,9 +47858,9 @@ var ListAction = e.forwardRef(function (_a, ref) {
|
|
|
47792
47858
|
},
|
|
47793
47859
|
_b["ods-list-action--".concat(type)] = type,
|
|
47794
47860
|
_b));
|
|
47795
|
-
return (e.createElement("div", { className:
|
|
47796
|
-
e.createElement("button", __assign$1({ ref: ref, type:
|
|
47797
|
-
showDivider && type === 'text' && (e.createElement("div", { className:
|
|
47861
|
+
return (e.createElement("div", { className: "ods-list-action__container" },
|
|
47862
|
+
e.createElement("button", __assign$1({ ref: ref, type: "button", "data-testid": "list-action", className: buttonClassName, onClick: loading ? undefined : onClick, disabled: disabled || loading }, rest), loading ? renderLoadingContent() : renderContent()),
|
|
47863
|
+
showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-action__divider" }))));
|
|
47798
47864
|
});
|
|
47799
47865
|
ListAction.displayName = 'ListAction';
|
|
47800
47866
|
|
|
@@ -47861,6 +47927,48 @@ var ListExpandable = e.forwardRef(function (_a, ref) {
|
|
|
47861
47927
|
});
|
|
47862
47928
|
ListExpandable.displayName = 'ListExpandable';
|
|
47863
47929
|
|
|
47930
|
+
var TransactionListExpandable = e.forwardRef(function (_a, ref) {
|
|
47931
|
+
var _b;
|
|
47932
|
+
var title = _a.title, description = _a.description, caption = _a.caption, amount = _a.amount, _c = _a.amountType, amountType = _c === void 0 ? 'default' : _c, amountIndicator = _a.amountIndicator, _d = _a.showAmountIndicator, showAmountIndicator = _d === void 0 ? true : _d, additionalData = _a.additionalData, _e = _a.inverted, inverted = _e === void 0 ? true : _e, _f = _a.type, type = _f === void 0 ? 'card' : _f, _g = _a.status, status = _g === void 0 ? 'default' : _g, _h = _a.loading, loading = _h === void 0 ? false : _h, icon = _a.icon, _j = _a.expanded, expanded = _j === void 0 ? false : _j, onToggle = _a.onToggle, children = _a.children, supportingText = _a.supportingText, className = _a.className, _k = _a.disabled, disabled = _k === void 0 ? false : _k, _l = _a.showDivider, showDivider = _l === void 0 ? false : _l, rest = __rest$1(_a, ["title", "description", "caption", "amount", "amountType", "amountIndicator", "showAmountIndicator", "additionalData", "inverted", "type", "status", "loading", "icon", "expanded", "onToggle", "children", "supportingText", "className", "disabled", "showDivider"]);
|
|
47933
|
+
var handleToggle = function () {
|
|
47934
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(!expanded);
|
|
47935
|
+
};
|
|
47936
|
+
var renderLoadingContent = function () { return (e.createElement(e.Fragment, null,
|
|
47937
|
+
e.createElement("div", { className: "ods-list-expandable__icon", "aria-hidden": true },
|
|
47938
|
+
e.createElement(SkeletonBar, { width: "24px", height: "24px" })),
|
|
47939
|
+
e.createElement("div", { className: "ods-list-expandable__skeleton ods-list-expandable__transaction-content" },
|
|
47940
|
+
e.createElement("div", { className: "ods-list-expandable__skeleton-list" },
|
|
47941
|
+
e.createElement(SkeletonBar, { width: "33%", height: "16px" }),
|
|
47942
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" })),
|
|
47943
|
+
e.createElement("div", { className: "ods-list-expandable__skeleton-amount" },
|
|
47944
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" }),
|
|
47945
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" }))))); };
|
|
47946
|
+
var renderContent = function () { return (e.createElement(e.Fragment, null,
|
|
47947
|
+
icon && (e.createElement("div", { className: classNames('ods-list-expandable__icon', {
|
|
47948
|
+
'ods-list-expandable__icon--inactive': status === 'inactive',
|
|
47949
|
+
}) }, icon)),
|
|
47950
|
+
e.createElement("div", { className: "ods-list-expandable__transaction-content" },
|
|
47951
|
+
e.createElement(ContentList, { title: title, description: description, caption: caption, inverted: inverted, type: status }),
|
|
47952
|
+
e.createElement(AmountDetails, { amount: amount, type: amountType, indicator: amountIndicator, indicatorSize: "medium", showIndicator: showAmountIndicator, additionalData: additionalData, showAdditionalData: Boolean(additionalData) })),
|
|
47953
|
+
e.createElement("div", { className: "ods-list-expandable__trailing" },
|
|
47954
|
+
e.createElement("div", { className: "ods-list-expandable__action" }, expanded ? e.createElement(ae, { size: 20 }) : e.createElement(ee, { size: 20 }))))); };
|
|
47955
|
+
var containerClassName = classNames('ods-list-expandable', 'ods-list-expandable--transaction', className, (_b = {
|
|
47956
|
+
'ods-list-expandable--expanded': expanded,
|
|
47957
|
+
'ods-list-expandable--disabled': disabled,
|
|
47958
|
+
'ods-list-expandable--loading': loading
|
|
47959
|
+
},
|
|
47960
|
+
_b["ods-list-expandable--".concat(type)] = type,
|
|
47961
|
+
_b));
|
|
47962
|
+
return (e.createElement("div", __assign$1({ ref: ref, "data-testid": "transaction-list-expandable", className: containerClassName }, rest),
|
|
47963
|
+
e.createElement("button", { type: "button", className: "ods-list-expandable__main", onClick: loading ? undefined : handleToggle, disabled: disabled || loading, "aria-expanded": expanded, "aria-label": "".concat(expanded ? 'Recolher' : 'Expandir', " ").concat(title), "data-testid": "transaction-list-expandable-button" }, loading ? renderLoadingContent() : renderContent()),
|
|
47964
|
+
showDivider && !expanded && (e.createElement("div", { className: "ods-list-expandable__divider", "data-testid": "transaction-list-expandable-divider" })),
|
|
47965
|
+
expanded && !loading && (children || supportingText) && (e.createElement(e.Fragment, null,
|
|
47966
|
+
children && (e.createElement("div", { className: "ods-list-expandable__content ods-list-expandable__content--transaction" }, children)),
|
|
47967
|
+
supportingText && (e.createElement("div", { className: "ods-list-expandable__footer", "data-testid": "transaction-list-expandable-supporting-text" }, supportingText)),
|
|
47968
|
+
showDivider && (e.createElement("div", { className: "ods-list-expandable__divider", "data-testid": "transaction-list-expandable-divider" }))))));
|
|
47969
|
+
});
|
|
47970
|
+
TransactionListExpandable.displayName = 'TransactionListExpandable';
|
|
47971
|
+
|
|
47864
47972
|
var isListItemString = function (item) {
|
|
47865
47973
|
return typeof item === 'object' && item !== null && 'description' in item;
|
|
47866
47974
|
};
|
|
@@ -47937,5 +48045,5 @@ var ListSettings = e.forwardRef(function (_a, ref) {
|
|
|
47937
48045
|
});
|
|
47938
48046
|
ListSettings.displayName = 'ListSettings';
|
|
47939
48047
|
|
|
47940
|
-
export { Accordion, Alert, Badge, Breadcrumb, Button$1 as Button, CardGroup, CardListItem, Carousel, DoughnutChart as Chart, Checkbox, Chips, Col, Container, ContextualMenu, ContextualMenuItem, CrossSellCard, DatePickerSingle as DatePicker, DatePickerRange as DateRange, Divider, DoughnutChart, Drawer, index$1 as Grid, IconButton, Input, InternalContextualHero, Link, List, ListAction, ListExpandable, ListReadOnly, ListSelectable, ListSettings, Modal, Progress, Radio, Row$1 as Row, Search, Select, SelectAutocomplete, SettingsListItem, Shortcut, Snackbar, Stepper, Steps, SubHeader, Switch, Tag, TextArea, TextListItem, TokenInput, TopBar, TransactionListItem, Typography, UnorderedListItem, WebNotification };
|
|
48048
|
+
export { Accordion, Alert, Badge, Breadcrumb, Button$1 as Button, CardGroup, CardListItem, Carousel, DoughnutChart as Chart, Checkbox, Chips, Col, Container, ContextualMenu, ContextualMenuItem, CrossSellCard, DatePickerSingle as DatePicker, DatePickerRange as DateRange, Divider, DoughnutChart, Drawer, index$1 as Grid, IconButton, Input, InternalContextualHero, Link, List, ListAction, ListExpandable, ListReadOnly, ListSelectable, ListSettings, Modal, Progress, Radio, Row$1 as Row, Search, Select, SelectAutocomplete, SettingsListItem, Shortcut, Snackbar, Stepper, Steps, SubHeader, Switch, Tag, TextArea, TextListItem, TokenInput, TopBar, TransactionListExpandable, TransactionListItem, Typography, UnorderedListItem, WebNotification };
|
|
47941
48049
|
//# sourceMappingURL=index.es.js.map
|