@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.js
CHANGED
|
@@ -34594,35 +34594,65 @@ var getInputPlaceholder = function (localeOption) {
|
|
|
34594
34594
|
|
|
34595
34595
|
function useDisabledDaysTooltip(disabledDaysMessage) {
|
|
34596
34596
|
var _a = e.useState(false), showDisabledTooltip = _a[0], setShowDisabledTooltip = _a[1];
|
|
34597
|
+
var _b = e.useState(''), tooltipMessage = _b[0], setTooltipMessage = _b[1];
|
|
34598
|
+
var _c = e.useState(null), tooltipPosition = _c[0], setTooltipPosition = _c[1];
|
|
34597
34599
|
var tooltipTimerRef = e.useRef(null);
|
|
34598
|
-
var
|
|
34599
|
-
|
|
34600
|
-
|
|
34601
|
-
|
|
34602
|
-
|
|
34603
|
-
|
|
34604
|
-
|
|
34600
|
+
var lastDisabledClickRef = e.useRef(null);
|
|
34601
|
+
var resolveMessage = e.useCallback(function (day) {
|
|
34602
|
+
var _a;
|
|
34603
|
+
if (!disabledDaysMessage)
|
|
34604
|
+
return '';
|
|
34605
|
+
if (typeof disabledDaysMessage === 'string')
|
|
34606
|
+
return disabledDaysMessage;
|
|
34607
|
+
if (!day)
|
|
34608
|
+
return '';
|
|
34609
|
+
var entry = disabledDaysMessage.find(function (e) { return isSameDay(e.date, day); });
|
|
34610
|
+
return (_a = entry === null || entry === void 0 ? void 0 : entry.message) !== null && _a !== void 0 ? _a : '';
|
|
34605
34611
|
}, [disabledDaysMessage]);
|
|
34606
|
-
var
|
|
34607
|
-
|
|
34608
|
-
|
|
34612
|
+
var handleCalendarClick = e.useCallback(function (event) {
|
|
34613
|
+
if (!disabledDaysMessage)
|
|
34614
|
+
return;
|
|
34615
|
+
var target = event.target;
|
|
34616
|
+
var disabledDay = target.closest('button.ods-date__disabled');
|
|
34617
|
+
if (!disabledDay)
|
|
34618
|
+
return;
|
|
34619
|
+
var message = resolveMessage(lastDisabledClickRef.current);
|
|
34620
|
+
if (!message)
|
|
34621
|
+
return;
|
|
34622
|
+
var container = event.currentTarget;
|
|
34623
|
+
var containerRect = container.getBoundingClientRect();
|
|
34624
|
+
var dayRect = disabledDay.getBoundingClientRect();
|
|
34625
|
+
var arrowLeft = dayRect.left - containerRect.left + dayRect.width / 2;
|
|
34626
|
+
var top = dayRect.top - containerRect.top - 12;
|
|
34627
|
+
if (tooltipTimerRef.current)
|
|
34628
|
+
clearTimeout(tooltipTimerRef.current);
|
|
34629
|
+
setTooltipMessage(message);
|
|
34630
|
+
setTooltipPosition({ top: top, arrowLeft: arrowLeft });
|
|
34631
|
+
setShowDisabledTooltip(true);
|
|
34632
|
+
tooltipTimerRef.current = setTimeout(function () { return setShowDisabledTooltip(false); }, 5000);
|
|
34633
|
+
}, [disabledDaysMessage, resolveMessage]);
|
|
34609
34634
|
var createDayClickHandler = e.useCallback(function (originalHandler) {
|
|
34610
34635
|
return function (day, modifiers) {
|
|
34611
34636
|
if (modifiers.disabled) {
|
|
34612
|
-
|
|
34637
|
+
lastDisabledClickRef.current = day;
|
|
34613
34638
|
return;
|
|
34614
34639
|
}
|
|
34615
|
-
|
|
34640
|
+
lastDisabledClickRef.current = null;
|
|
34641
|
+
setShowDisabledTooltip(false);
|
|
34642
|
+
setTooltipPosition(null);
|
|
34616
34643
|
originalHandler(day);
|
|
34617
34644
|
};
|
|
34618
|
-
}, [
|
|
34645
|
+
}, []);
|
|
34619
34646
|
e.useEffect(function () { return function () {
|
|
34620
34647
|
if (tooltipTimerRef.current)
|
|
34621
34648
|
clearTimeout(tooltipTimerRef.current);
|
|
34622
34649
|
}; }, []);
|
|
34623
34650
|
return {
|
|
34624
34651
|
showDisabledTooltip: showDisabledTooltip,
|
|
34652
|
+
tooltipMessage: tooltipMessage,
|
|
34653
|
+
tooltipPosition: tooltipPosition,
|
|
34625
34654
|
createDayClickHandler: createDayClickHandler,
|
|
34655
|
+
handleCalendarClick: handleCalendarClick,
|
|
34626
34656
|
};
|
|
34627
34657
|
}
|
|
34628
34658
|
|
|
@@ -34638,7 +34668,7 @@ function useDatePickerSingle(_a) {
|
|
|
34638
34668
|
var _c = e.useState(''), currentField = _c[0], setCurrentField = _c[1];
|
|
34639
34669
|
var _d = e.useState(), currentMonthToDisplay = _d[0], setCurrentMonthToDisplay = _d[1];
|
|
34640
34670
|
var _e = e.useState(''), datePickerCache = _e[0], setDatePickerCache = _e[1];
|
|
34641
|
-
var _f = useDisabledDaysTooltip(disabledDaysMessage), showDisabledTooltip = _f.showDisabledTooltip, createDayClickHandler = _f.createDayClickHandler;
|
|
34671
|
+
var _f = useDisabledDaysTooltip(disabledDaysMessage), showDisabledTooltip = _f.showDisabledTooltip, tooltipMessage = _f.tooltipMessage, tooltipPosition = _f.tooltipPosition, createDayClickHandler = _f.createDayClickHandler, handleCalendarClick = _f.handleCalendarClick;
|
|
34642
34672
|
var fromDate = parse$1(value || '', localeDateFormat, new Date());
|
|
34643
34673
|
var updateState = function (updateData, updateCache) {
|
|
34644
34674
|
onSelect(updateData);
|
|
@@ -34723,6 +34753,9 @@ function useDatePickerSingle(_a) {
|
|
|
34723
34753
|
handleCloseByOutside: handleCloseByOutside,
|
|
34724
34754
|
currentMonthToDisplay: currentMonthToDisplay,
|
|
34725
34755
|
showDisabledTooltip: showDisabledTooltip,
|
|
34756
|
+
tooltipMessage: tooltipMessage,
|
|
34757
|
+
tooltipPosition: tooltipPosition,
|
|
34758
|
+
handleCalendarClick: handleCalendarClick,
|
|
34726
34759
|
handleDayClickWithModifiers: handleDayClickWithModifiers,
|
|
34727
34760
|
};
|
|
34728
34761
|
}
|
|
@@ -34758,10 +34791,12 @@ var DatePickerHeader = function (_a) {
|
|
|
34758
34791
|
};
|
|
34759
34792
|
|
|
34760
34793
|
var DisabledDaysTooltip = function (_a) {
|
|
34761
|
-
var message = _a.message, show = _a.show, _b = _a.testId, testId = _b === void 0 ? 'datepicker-disabled-tooltip' : _b;
|
|
34762
|
-
if (!show)
|
|
34794
|
+
var message = _a.message, show = _a.show, position = _a.position, _b = _a.testId, testId = _b === void 0 ? 'datepicker-disabled-tooltip' : _b;
|
|
34795
|
+
if (!show || !position)
|
|
34763
34796
|
return null;
|
|
34764
|
-
return (e.createElement("div", { className: "ods-date__disabled-tooltip", role: "tooltip", "data-testid": testId
|
|
34797
|
+
return (e.createElement("div", { className: "ods-date__disabled-tooltip", role: "tooltip", "data-testid": testId, style: { top: "".concat(position.top, "px") } },
|
|
34798
|
+
message,
|
|
34799
|
+
e.createElement("div", { className: "ods-date__disabled-tooltip__arrow", style: { left: "".concat(position.arrowLeft, "px") } })));
|
|
34765
34800
|
};
|
|
34766
34801
|
|
|
34767
34802
|
var DatePickerSingle = e.forwardRef(function (_a, ref) {
|
|
@@ -34772,13 +34807,11 @@ var DatePickerSingle = e.forwardRef(function (_a, ref) {
|
|
|
34772
34807
|
startsToday: startsToday,
|
|
34773
34808
|
locale: locale,
|
|
34774
34809
|
disabledDaysMessage: disabledDaysMessage,
|
|
34775
|
-
}), 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;
|
|
34810
|
+
}), 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;
|
|
34776
34811
|
var calendarOpen = inline || showDayPicker;
|
|
34777
34812
|
var CaptionWithTooltip = function (_a) {
|
|
34778
34813
|
var displayMonth = _a.displayMonth;
|
|
34779
|
-
return (e.createElement(e.Fragment, null,
|
|
34780
|
-
DatePickerHeader({ displayMonth: displayMonth, locale: localeOption, mode: 'single' }),
|
|
34781
|
-
disabledDaysMessage && (e.createElement(DisabledDaysTooltip, { message: disabledDaysMessage, show: showDisabledTooltip }))));
|
|
34814
|
+
return (e.createElement(e.Fragment, null, DatePickerHeader({ displayMonth: displayMonth, locale: localeOption, mode: 'single' })));
|
|
34782
34815
|
};
|
|
34783
34816
|
return (e.createElement("div", null,
|
|
34784
34817
|
calendarOpen && !inline && (e.createElement("div", { className: "ods-date-background", "data-testid": "date-picker-outside", onClick: handleCloseByOutside })),
|
|
@@ -34790,10 +34823,11 @@ var DatePickerSingle = e.forwardRef(function (_a, ref) {
|
|
|
34790
34823
|
'date-field-focussed': currentField === 'start-date',
|
|
34791
34824
|
}), 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 }))),
|
|
34792
34825
|
inline && label && (e.createElement("div", { className: "ods-date__inline-label" }, label)),
|
|
34793
|
-
!disabled && calendarOpen && (e.createElement("div", { "data-testid": "datepicker-calendar" },
|
|
34826
|
+
!disabled && calendarOpen && (e.createElement("div", { "data-testid": "datepicker-calendar", className: "ods-date__calendar-container", role: "presentation", onClick: handleCalendarClick },
|
|
34794
34827
|
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: {
|
|
34795
34828
|
Caption: CaptionWithTooltip,
|
|
34796
|
-
} })
|
|
34829
|
+
} }),
|
|
34830
|
+
disabledDaysMessage && (e.createElement(DisabledDaysTooltip, { message: tooltipMessage, show: showDisabledTooltip, position: tooltipPosition }))))))));
|
|
34797
34831
|
});
|
|
34798
34832
|
DatePickerSingle.displayName = 'DatePickerSingle';
|
|
34799
34833
|
|
|
@@ -34810,7 +34844,7 @@ function useDatePicker(_a) {
|
|
|
34810
34844
|
var _d = e.useState(), currentMonthToDisplay = _d[0], setCurrentMonthToDisplay = _d[1];
|
|
34811
34845
|
var _e = e.useState({ from: '', to: '' }), datePickerCache = _e[0], setDatePickerCache = _e[1];
|
|
34812
34846
|
var _f = e.useState(false), firstInputClicked = _f[0], setFirstInputClicked = _f[1];
|
|
34813
|
-
var _g = useDisabledDaysTooltip(disabledDaysMessage), showDisabledTooltip = _g.showDisabledTooltip, createDayClickHandler = _g.createDayClickHandler;
|
|
34847
|
+
var _g = useDisabledDaysTooltip(disabledDaysMessage), showDisabledTooltip = _g.showDisabledTooltip, tooltipMessage = _g.tooltipMessage, tooltipPosition = _g.tooltipPosition, createDayClickHandler = _g.createDayClickHandler, handleCalendarClick = _g.handleCalendarClick;
|
|
34814
34848
|
var fromDate = parse$1(values.from, localeDateFormat, new Date());
|
|
34815
34849
|
var toDate = parse$1(values.to, localeDateFormat, new Date());
|
|
34816
34850
|
var updateState = function (updateData, updateCache) {
|
|
@@ -34963,6 +34997,9 @@ function useDatePicker(_a) {
|
|
|
34963
34997
|
handleDayClick: handleDayClick,
|
|
34964
34998
|
handleDayClickWithModifiers: handleDayClickWithModifiers,
|
|
34965
34999
|
showDisabledTooltip: showDisabledTooltip,
|
|
35000
|
+
tooltipMessage: tooltipMessage,
|
|
35001
|
+
tooltipPosition: tooltipPosition,
|
|
35002
|
+
handleCalendarClick: handleCalendarClick,
|
|
34966
35003
|
inputChange: inputChange,
|
|
34967
35004
|
createHandleToggleClick: createHandleToggleClick,
|
|
34968
35005
|
formatDay: formatDay,
|
|
@@ -34980,7 +35017,7 @@ var DatePickerRange = e.forwardRef(function (_a, ref) {
|
|
|
34980
35017
|
startsToday: startsToday,
|
|
34981
35018
|
locale: locale,
|
|
34982
35019
|
disabledDaysMessage: disabledDaysMessage,
|
|
34983
|
-
}), 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;
|
|
35020
|
+
}), 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;
|
|
34984
35021
|
return (e.createElement("div", null,
|
|
34985
35022
|
showDayPicker && (e.createElement("div", { className: "ods-date-background", "data-testid": "date-picker-outside", onClick: handleCloseByOutside })),
|
|
34986
35023
|
e.createElement("div", __assign$1({ className: classNames('ods-date', className), ref: ref }, rest),
|
|
@@ -34995,15 +35032,14 @@ var DatePickerRange = e.forwardRef(function (_a, ref) {
|
|
|
34995
35032
|
e.createElement(Input, { ref: input2Ref, "data-testid": "datepicker-input-2", id: "end-date", type: "text", className: classNames({
|
|
34996
35033
|
'date-field-focussed': currentField === 'end-date',
|
|
34997
35034
|
}), 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 })),
|
|
34998
|
-
!disabled && showDayPicker && (e.createElement("div", { "data-testid": "datepicker-calendar" },
|
|
35035
|
+
!disabled && showDayPicker && (e.createElement("div", { "data-testid": "datepicker-calendar", className: "ods-date__calendar-container", role: "presentation", onClick: handleCalendarClick },
|
|
34999
35036
|
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: {
|
|
35000
35037
|
Caption: function (_a) {
|
|
35001
35038
|
var displayMonth = _a.displayMonth;
|
|
35002
|
-
return (e.createElement(
|
|
35003
|
-
e.createElement(DatePickerHeader, { locale: localeOption, displayMonth: handleDisplayMonth(displayMonth) }),
|
|
35004
|
-
disabledDaysMessage && (e.createElement(DisabledDaysTooltip, { message: disabledDaysMessage, show: showDisabledTooltip }))));
|
|
35039
|
+
return (e.createElement(DatePickerHeader, { locale: localeOption, displayMonth: handleDisplayMonth(displayMonth) }));
|
|
35005
35040
|
},
|
|
35006
|
-
} })
|
|
35041
|
+
} }),
|
|
35042
|
+
disabledDaysMessage && (e.createElement(DisabledDaysTooltip, { message: tooltipMessage, show: showDisabledTooltip, position: tooltipPosition }))))))));
|
|
35007
35043
|
});
|
|
35008
35044
|
DatePickerRange.displayName = 'DatePickerRange';
|
|
35009
35045
|
|
|
@@ -47751,9 +47787,26 @@ var InternalListActions = e.forwardRef(function (_a, forwardedRef) {
|
|
|
47751
47787
|
});
|
|
47752
47788
|
InternalListActions.displayName = 'InternalListActions';
|
|
47753
47789
|
|
|
47790
|
+
var AmountDetails = function (_a) {
|
|
47791
|
+
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;
|
|
47792
|
+
var isNegative = type === 'negative';
|
|
47793
|
+
var isPositive = type === 'positive';
|
|
47794
|
+
return (e.createElement("div", { className: "ods-amount-details" },
|
|
47795
|
+
e.createElement("div", { className: "ods-amount-details__main" },
|
|
47796
|
+
isNegative ? (e.createElement("div", { className: "ods-amount-details__amount-row" },
|
|
47797
|
+
e.createElement("span", { className: "ods-amount-details__amount-sign" }, "- "),
|
|
47798
|
+
e.createElement("p", { className: "ods-amount-details__amount" }, amount))) : (e.createElement("p", { className: classNames('ods-amount-details__amount', {
|
|
47799
|
+
'ods-amount-details__amount--positive': isPositive,
|
|
47800
|
+
}) }, amount)),
|
|
47801
|
+
showIndicator && indicator && (e.createElement("div", { className: classNames('ods-amount-details__indicator', {
|
|
47802
|
+
'ods-amount-details__indicator--medium': indicatorSize === 'medium',
|
|
47803
|
+
}) }, indicator))),
|
|
47804
|
+
showAdditionalData && additionalData && (e.createElement(Typography, { variant: "captionbold", className: "ods-amount-details__caption" }, additionalData))));
|
|
47805
|
+
};
|
|
47806
|
+
|
|
47754
47807
|
var ListAction = e.forwardRef(function (_a, ref) {
|
|
47755
47808
|
var _b;
|
|
47756
|
-
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"]);
|
|
47809
|
+
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"]);
|
|
47757
47810
|
var _l = e.useState(false), isSwipeOpen = _l[0], setIsSwipeOpen = _l[1];
|
|
47758
47811
|
var _m = e.useState(0), menuWidth = _m[0], setMenuWidth = _m[1];
|
|
47759
47812
|
var handleSwipeOpenChange = function (isOpen, width) {
|
|
@@ -47764,7 +47817,7 @@ var ListAction = e.forwardRef(function (_a, ref) {
|
|
|
47764
47817
|
};
|
|
47765
47818
|
var renderActionIcon = function () {
|
|
47766
47819
|
if (actionType === 'chevron') {
|
|
47767
|
-
return (e.createElement("div", { className:
|
|
47820
|
+
return (e.createElement("div", { className: "ods-list-action__action" },
|
|
47768
47821
|
e.createElement(re, { size: 20 })));
|
|
47769
47822
|
}
|
|
47770
47823
|
if (actionType === 'menu' || actionType === 'swipe') {
|
|
@@ -47772,19 +47825,32 @@ var ListAction = e.forwardRef(function (_a, ref) {
|
|
|
47772
47825
|
}
|
|
47773
47826
|
return null;
|
|
47774
47827
|
};
|
|
47775
|
-
var renderLoadingContent = function () { return (e.createElement("div", { className:
|
|
47776
|
-
e.createElement(SkeletonBar, { width:
|
|
47777
|
-
e.createElement(SkeletonBar, { width:
|
|
47828
|
+
var renderLoadingContent = function () { return (e.createElement("div", { className: "ods-list-action__skeleton" },
|
|
47829
|
+
e.createElement(SkeletonBar, { width: "40%", height: "16px" }),
|
|
47830
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" }))); };
|
|
47778
47831
|
var contentStyle = isSwipeOpen && menuWidth > 0
|
|
47779
47832
|
? { transform: "translateX(-".concat(menuWidth, "px)") }
|
|
47780
47833
|
: {};
|
|
47834
|
+
var showLeading = position && icon;
|
|
47835
|
+
var showLineAbove = position === 'middle' || position === 'last';
|
|
47836
|
+
var showLineBelow = position === 'first' || position === 'middle';
|
|
47781
47837
|
var renderContent = function () { return (e.createElement(e.Fragment, null,
|
|
47782
|
-
e.createElement("div", { className:
|
|
47783
|
-
|
|
47838
|
+
e.createElement("div", { className: "ods-list-action__content", style: contentStyle },
|
|
47839
|
+
showLeading ? (e.createElement("div", { className: "ods-list-action__position" },
|
|
47840
|
+
e.createElement("div", { className: classNames('ods-list-action__position-line', {
|
|
47841
|
+
'ods-list-action__position-line--visible': showLineAbove,
|
|
47842
|
+
}) }),
|
|
47843
|
+
e.createElement("div", { className: classNames('ods-list-action__icon', {
|
|
47844
|
+
'ods-list-action__icon--inactive': status === 'inactive',
|
|
47845
|
+
}) }, icon),
|
|
47846
|
+
e.createElement("div", { className: classNames('ods-list-action__position-line', {
|
|
47847
|
+
'ods-list-action__position-line--visible': showLineBelow,
|
|
47848
|
+
}) }))) : (icon && (e.createElement("div", { className: classNames('ods-list-action__icon', {
|
|
47784
47849
|
'ods-list-action__icon--inactive': status === 'inactive',
|
|
47785
|
-
}) }, icon)),
|
|
47850
|
+
}) }, icon))),
|
|
47786
47851
|
e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: status }),
|
|
47787
|
-
|
|
47852
|
+
amountDetails && e.createElement(AmountDetails, __assign$1({ type: status }, amountDetails)),
|
|
47853
|
+
indicator && (e.createElement("div", { className: "ods-list-action__indicator" }, indicator))),
|
|
47788
47854
|
renderActionIcon())); };
|
|
47789
47855
|
var buttonClassName = classNames('ods-list-action', className, (_b = {
|
|
47790
47856
|
'ods-list-action--loading': loading,
|
|
@@ -47794,9 +47860,9 @@ var ListAction = e.forwardRef(function (_a, ref) {
|
|
|
47794
47860
|
},
|
|
47795
47861
|
_b["ods-list-action--".concat(type)] = type,
|
|
47796
47862
|
_b));
|
|
47797
|
-
return (e.createElement("div", { className:
|
|
47798
|
-
e.createElement("button", __assign$1({ ref: ref, type:
|
|
47799
|
-
showDivider && type === 'text' && (e.createElement("div", { className:
|
|
47863
|
+
return (e.createElement("div", { className: "ods-list-action__container" },
|
|
47864
|
+
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()),
|
|
47865
|
+
showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-action__divider" }))));
|
|
47800
47866
|
});
|
|
47801
47867
|
ListAction.displayName = 'ListAction';
|
|
47802
47868
|
|
|
@@ -47863,6 +47929,48 @@ var ListExpandable = e.forwardRef(function (_a, ref) {
|
|
|
47863
47929
|
});
|
|
47864
47930
|
ListExpandable.displayName = 'ListExpandable';
|
|
47865
47931
|
|
|
47932
|
+
var TransactionListExpandable = e.forwardRef(function (_a, ref) {
|
|
47933
|
+
var _b;
|
|
47934
|
+
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"]);
|
|
47935
|
+
var handleToggle = function () {
|
|
47936
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(!expanded);
|
|
47937
|
+
};
|
|
47938
|
+
var renderLoadingContent = function () { return (e.createElement(e.Fragment, null,
|
|
47939
|
+
e.createElement("div", { className: "ods-list-expandable__icon", "aria-hidden": true },
|
|
47940
|
+
e.createElement(SkeletonBar, { width: "24px", height: "24px" })),
|
|
47941
|
+
e.createElement("div", { className: "ods-list-expandable__skeleton ods-list-expandable__transaction-content" },
|
|
47942
|
+
e.createElement("div", { className: "ods-list-expandable__skeleton-list" },
|
|
47943
|
+
e.createElement(SkeletonBar, { width: "33%", height: "16px" }),
|
|
47944
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" })),
|
|
47945
|
+
e.createElement("div", { className: "ods-list-expandable__skeleton-amount" },
|
|
47946
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" }),
|
|
47947
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" }))))); };
|
|
47948
|
+
var renderContent = function () { return (e.createElement(e.Fragment, null,
|
|
47949
|
+
icon && (e.createElement("div", { className: classNames('ods-list-expandable__icon', {
|
|
47950
|
+
'ods-list-expandable__icon--inactive': status === 'inactive',
|
|
47951
|
+
}) }, icon)),
|
|
47952
|
+
e.createElement("div", { className: "ods-list-expandable__transaction-content" },
|
|
47953
|
+
e.createElement(ContentList, { title: title, description: description, caption: caption, inverted: inverted, type: status }),
|
|
47954
|
+
e.createElement(AmountDetails, { amount: amount, type: amountType, indicator: amountIndicator, indicatorSize: "medium", showIndicator: showAmountIndicator, additionalData: additionalData, showAdditionalData: Boolean(additionalData) })),
|
|
47955
|
+
e.createElement("div", { className: "ods-list-expandable__trailing" },
|
|
47956
|
+
e.createElement("div", { className: "ods-list-expandable__action" }, expanded ? e.createElement(ae, { size: 20 }) : e.createElement(ee, { size: 20 }))))); };
|
|
47957
|
+
var containerClassName = classNames('ods-list-expandable', 'ods-list-expandable--transaction', className, (_b = {
|
|
47958
|
+
'ods-list-expandable--expanded': expanded,
|
|
47959
|
+
'ods-list-expandable--disabled': disabled,
|
|
47960
|
+
'ods-list-expandable--loading': loading
|
|
47961
|
+
},
|
|
47962
|
+
_b["ods-list-expandable--".concat(type)] = type,
|
|
47963
|
+
_b));
|
|
47964
|
+
return (e.createElement("div", __assign$1({ ref: ref, "data-testid": "transaction-list-expandable", className: containerClassName }, rest),
|
|
47965
|
+
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()),
|
|
47966
|
+
showDivider && !expanded && (e.createElement("div", { className: "ods-list-expandable__divider", "data-testid": "transaction-list-expandable-divider" })),
|
|
47967
|
+
expanded && !loading && (children || supportingText) && (e.createElement(e.Fragment, null,
|
|
47968
|
+
children && (e.createElement("div", { className: "ods-list-expandable__content ods-list-expandable__content--transaction" }, children)),
|
|
47969
|
+
supportingText && (e.createElement("div", { className: "ods-list-expandable__footer", "data-testid": "transaction-list-expandable-supporting-text" }, supportingText)),
|
|
47970
|
+
showDivider && (e.createElement("div", { className: "ods-list-expandable__divider", "data-testid": "transaction-list-expandable-divider" }))))));
|
|
47971
|
+
});
|
|
47972
|
+
TransactionListExpandable.displayName = 'TransactionListExpandable';
|
|
47973
|
+
|
|
47866
47974
|
var isListItemString = function (item) {
|
|
47867
47975
|
return typeof item === 'object' && item !== null && 'description' in item;
|
|
47868
47976
|
};
|
|
@@ -47990,6 +48098,7 @@ exports.TextArea = TextArea;
|
|
|
47990
48098
|
exports.TextListItem = TextListItem;
|
|
47991
48099
|
exports.TokenInput = TokenInput;
|
|
47992
48100
|
exports.TopBar = TopBar;
|
|
48101
|
+
exports.TransactionListExpandable = TransactionListExpandable;
|
|
47993
48102
|
exports.TransactionListItem = TransactionListItem;
|
|
47994
48103
|
exports.Typography = Typography;
|
|
47995
48104
|
exports.UnorderedListItem = UnorderedListItem;
|