@tap-payments/os-micro-frontend-shared 0.1.135 → 0.1.136-test.2
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/LICENSE +21 -21
- package/README.md +12 -12
- package/build/components/BackgroundAnimation/BackgroundAnimation.js +28 -0
- package/build/components/BackgroundAnimation/Blob/Blob.js +2 -0
- package/build/components/Chip/style.js +1 -0
- package/build/components/ColorPicker/HexaFields.js +4 -0
- package/build/components/ColorPicker/style.js +1 -1
- package/build/components/Dialog/style.js +1 -0
- package/build/components/Dropdown2/style.js +2 -0
- package/build/components/HeatMap/constant.js +1 -1
- package/build/components/InputBase/AmountInputBase/CurrencyList/style.js +3 -0
- package/build/components/InputBase/PhoneInputBase/CountriesList/style.js +3 -0
- package/build/components/InputBase/SelectBase/SelectBase.js +1 -0
- package/build/components/InputBase/SelectBase/SelectBaseMultiple.js +3 -0
- package/build/components/InputBase/SelectBase/style.js +3 -2
- package/build/components/InputNumber/InputNumber.js +2 -0
- package/build/components/Inputs/Input/style.js +6 -2
- package/build/components/Inputs/Select/Select.js +1 -0
- package/build/components/Inputs/Select/style.js +3 -2
- package/build/components/JSONViewer/JSONViewer.js +10 -2
- package/build/components/JSONViewer/context/Provider.js +2 -0
- package/build/components/LeftPeekRightExpandingChip/LeftPeekRightExpandingChip.d.ts +10 -0
- package/build/components/LeftPeekRightExpandingChip/LeftPeekRightExpandingChip.js +14 -1
- package/build/components/LeftPeekRightExpandingChip/style.js +1 -0
- package/build/components/LeftPeekRightExpandingChip/useLeftPeekRightExpandingChip.js +30 -2
- package/build/components/MultiSelectStatusButton/MultiSelectStatusButton.js +3 -0
- package/build/components/NestedDropdown/Dropdown.js +3 -0
- package/build/components/RFH/Inputs/FormInput/FormInput.js +1 -0
- package/build/components/RFH/Inputs/MultiSelect/MultiSelect.js +1 -0
- package/build/components/RangeCalender/RangeCalender.js +1 -0
- package/build/components/RangeCalender/components/RangeDatepicker/RangeDatepicker.js +3 -1
- package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.d.ts +32 -0
- package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.js +36 -2
- package/build/components/RightLeftExpandingCenterChip/style.js +25 -4
- package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.d.ts +5 -0
- package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.js +53 -1
- package/build/components/ScrollLoader/ScrollLoader.js +2 -1
- package/build/components/StatusButton/StatusButton.js +11 -3
- package/build/components/StatusButton/constant.js +3 -1
- package/build/components/StatusButton/style.d.ts +2 -1
- package/build/components/StatusButton/type.d.ts +13 -1
- package/build/components/StatusIcons/AuthIcons/constants.js +5 -0
- package/build/components/StatusIcons/AuthorizationAutoIcons/CaptureAutoIcon.js +11 -0
- package/build/components/StatusIcons/AuthorizationAutoIcons/VoidAutoIcon.js +11 -0
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/ApplicationStatusCell.js +3 -1
- package/build/components/TableCells/CustomCells/BrandCell/BrandCell.js +1 -0
- package/build/components/TableCells/CustomCells/ReferenceCell/ReferenceCell.js +3 -1
- package/build/components/TableCells/CustomCells/RefundStatusCell/components/RefundStateIcon.js +1 -0
- package/build/components/TableCells/CustomCells/SegmentsCell/SegmentsCell.js +3 -1
- package/build/components/TableCells/CustomCells/SourceMergedCell/SourceMergedCell.js +7 -1
- package/build/components/TableCells/CustomCells/StatusCell/StatusCell.js +1 -0
- package/build/components/TableView/CustomViews.js +2 -0
- package/build/components/TableView/TableView.js +1 -0
- package/build/components/Timepicker/Timepicker.js +1 -0
- package/build/components/Timepicker/utils.js +9 -5
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +16 -3
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableLoading.js +5 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +6 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.d.ts +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/index.js +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.d.ts +11 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.js +107 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumns.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableData.js +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +3 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts +1 -23
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +25 -21
- package/build/components/VirtualTables/SheetViewVirtualTable/style.js +1 -1
- package/build/components/VirtualTables/VirtualTable/VirtualTable.js +12 -2
- package/build/components/VirtualTables/VirtualTableWithCard/VirtualTableWithCard.js +6 -1
- package/build/components/VirtualTables/components/ColumnFilter/Inputs/Inputs.js +1 -0
- package/build/components/VirtualTables/components/TableFooter/TableFooter.js +9 -0
- package/build/components/VirtualTables/components/TableRow.js +25 -18
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +3 -1
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapperWithCard.js +2 -0
- package/build/components/VirtualTables/components/virtualScroll/VirtualScrollList.js +16 -1
- package/build/components/Widget/style.js +1 -0
- package/build/components/Window/style.js +1 -0
- package/build/components/index.d.ts +8 -2
- package/build/components/index.js +11 -2
- package/build/constants/assets.js +4 -0
- package/build/constants/server.js +1 -0
- package/build/constants/table.d.ts +1 -1
- package/build/constants/table.js +1 -1
- package/build/hooks/useCountdown.js +4 -0
- package/build/hooks/useStickyHeaderShadow.js +6 -0
- package/build/utils/api.js +3 -0
- package/build/utils/array.js +5 -1
- package/build/utils/billing.js +1 -0
- package/build/utils/country.js +1 -0
- package/build/utils/currency.js +6 -0
- package/build/utils/date.d.ts +5 -0
- package/build/utils/date.js +31 -3
- package/build/utils/encrypt.js +3 -1
- package/build/utils/error.js +2 -0
- package/build/utils/freshdesk.js +2 -0
- package/build/utils/geography.js +1 -1
- package/build/utils/localStorage.js +7 -0
- package/build/utils/merchant.js +3 -0
- package/build/utils/number.js +1 -0
- package/build/utils/segment.js +1 -0
- package/build/utils/string.d.ts +7 -0
- package/build/utils/string.js +10 -0
- package/build/utils/style.d.ts +13 -2
- package/build/utils/style.js +30 -2
- package/build/utils/table.js +1 -1
- package/build/utils/url.js +2 -0
- package/package.json +3 -3
|
@@ -1,3 +1,35 @@
|
|
|
1
1
|
import { RightLeftExpandingCenterChipProps } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* Component: RightLeftExpandingCenterChip
|
|
4
|
+
*
|
|
5
|
+
* Renders a center chip with optional inline expandable content and animated
|
|
6
|
+
* stacks of chips that expand to the left and right when hovering the center.
|
|
7
|
+
*
|
|
8
|
+
* Behavior
|
|
9
|
+
* - Hover activation: Only when the pointer enters the CenterChip. Hover persists
|
|
10
|
+
* across expanded icons and the gaps between them via transparent HoverBridge overlays.
|
|
11
|
+
* Hover ends when the pointer leaves the main wrapper (with a small debounce handled
|
|
12
|
+
* inside the useRightLeftExpandingCenterChip hook).
|
|
13
|
+
* - Anchoring: Left/Right expanded sections are anchored to the start/end of the center
|
|
14
|
+
* content using measured anchors from the hook.
|
|
15
|
+
* - Motion & layout:
|
|
16
|
+
* - ExpandableContainer width is driven by a MotionValue (expandedMV) based on measured
|
|
17
|
+
* width of the expandable content; AnimatePresence provides smooth mount/unmount.
|
|
18
|
+
* - The whole center group shifts by shiftX to visually compensate the inline expansion.
|
|
19
|
+
* - Left/Right chips slide out using computed offsets derived from measured chip widths.
|
|
20
|
+
* - Overlay order: expandedZIndex controls the base z-index for expanded sections; individual
|
|
21
|
+
* chips stack above this base so later items appear beneath earlier items.
|
|
22
|
+
*
|
|
23
|
+
* Props
|
|
24
|
+
* @param leftIcons - Icons/chips to show expanding to the left while hovering.
|
|
25
|
+
* @param rightIcons - Icons/chips to show expanding to the right while hovering.
|
|
26
|
+
* @param centerIcon - Static content inside the center chip.
|
|
27
|
+
* @param expandableCenterRight - Optional inline content that expands to the right within the center chip.
|
|
28
|
+
* @param expandableCenterLeft - Optional inline content that expands to the left within the center chip.
|
|
29
|
+
* @param expandedZIndex - Base z-index for expanded sections and icons (default 1000).
|
|
30
|
+
* @param props - Additional Box props forwarded to the root container.
|
|
31
|
+
*
|
|
32
|
+
* @returns Root Box containing the motion-driven chip UI.
|
|
33
|
+
*/
|
|
2
34
|
declare function RightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenterRight, expandableCenterLeft, expandedZIndex, ...props }: Readonly<RightLeftExpandingCenterChipProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
35
|
export default RightLeftExpandingCenterChip;
|
|
@@ -14,6 +14,38 @@ import Box from '@mui/material/Box';
|
|
|
14
14
|
import { AnimatePresence } from 'framer-motion';
|
|
15
15
|
import { CenterIconWrapper, ExpandedSection, PeekContainer, CenterChip, LeftPeekChip, RightPeekChip, LeftExpandIcon, RightExpandIcon, ExpandChip, CenterShiftWrapper, CenterContent, ExpandableContainer, ExpandableInner, tableCellSx, CHIP_GAP, HoverBridge, } from './style';
|
|
16
16
|
import { useRightLeftExpandingCenterChip, DEFAULT_CHIP_MIN_WIDTH } from './useRightLeftExpandingCenterChip';
|
|
17
|
+
/**
|
|
18
|
+
* Component: RightLeftExpandingCenterChip
|
|
19
|
+
*
|
|
20
|
+
* Renders a center chip with optional inline expandable content and animated
|
|
21
|
+
* stacks of chips that expand to the left and right when hovering the center.
|
|
22
|
+
*
|
|
23
|
+
* Behavior
|
|
24
|
+
* - Hover activation: Only when the pointer enters the CenterChip. Hover persists
|
|
25
|
+
* across expanded icons and the gaps between them via transparent HoverBridge overlays.
|
|
26
|
+
* Hover ends when the pointer leaves the main wrapper (with a small debounce handled
|
|
27
|
+
* inside the useRightLeftExpandingCenterChip hook).
|
|
28
|
+
* - Anchoring: Left/Right expanded sections are anchored to the start/end of the center
|
|
29
|
+
* content using measured anchors from the hook.
|
|
30
|
+
* - Motion & layout:
|
|
31
|
+
* - ExpandableContainer width is driven by a MotionValue (expandedMV) based on measured
|
|
32
|
+
* width of the expandable content; AnimatePresence provides smooth mount/unmount.
|
|
33
|
+
* - The whole center group shifts by shiftX to visually compensate the inline expansion.
|
|
34
|
+
* - Left/Right chips slide out using computed offsets derived from measured chip widths.
|
|
35
|
+
* - Overlay order: expandedZIndex controls the base z-index for expanded sections; individual
|
|
36
|
+
* chips stack above this base so later items appear beneath earlier items.
|
|
37
|
+
*
|
|
38
|
+
* Props
|
|
39
|
+
* @param leftIcons - Icons/chips to show expanding to the left while hovering.
|
|
40
|
+
* @param rightIcons - Icons/chips to show expanding to the right while hovering.
|
|
41
|
+
* @param centerIcon - Static content inside the center chip.
|
|
42
|
+
* @param expandableCenterRight - Optional inline content that expands to the right within the center chip.
|
|
43
|
+
* @param expandableCenterLeft - Optional inline content that expands to the left within the center chip.
|
|
44
|
+
* @param expandedZIndex - Base z-index for expanded sections and icons (default 1000).
|
|
45
|
+
* @param props - Additional Box props forwarded to the root container.
|
|
46
|
+
*
|
|
47
|
+
* @returns Root Box containing the motion-driven chip UI.
|
|
48
|
+
*/
|
|
17
49
|
function RightLeftExpandingCenterChip(_a) {
|
|
18
50
|
var { leftIcons = [], rightIcons = [], centerIcon, expandableCenterRight, expandableCenterLeft, expandedZIndex = 1000 } = _a, props = __rest(_a, ["leftIcons", "rightIcons", "centerIcon", "expandableCenterRight", "expandableCenterLeft", "expandedZIndex"]);
|
|
19
51
|
const { isHovering, handleMouseEnter, handleMouseLeave, centerWrapRef, centerContentRef, centerChipRef, anchors, leftChipRefs, rightChipRefs, leftOffsets, rightOffsets, expandableRightInnerRef, expandableLeftInnerRef, expandedRightMV, expandedLeftMV, shiftX, rightShift, leftShift, leftHoverWidth, rightHoverWidth, } = useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenterRight, expandableCenterLeft });
|
|
@@ -41,7 +73,7 @@ function RightLeftExpandingCenterChip(_a) {
|
|
|
41
73
|
opacity: isHovering ? 1 : 0,
|
|
42
74
|
pointerEvents: isHovering ? 'auto' : 'none',
|
|
43
75
|
borderRadius: '12px 0 0 12px',
|
|
44
|
-
borderRight: 'none',
|
|
76
|
+
borderRight: 'none', // Remove right border for seamless connection
|
|
45
77
|
}, initial: false, transition: { duration: 0.2, ease: 'easeOut' } }, { children: _jsx(ExpandableInner, Object.assign({ "data-testid": "ExpandableLeftInner", ref: expandableLeftInnerRef }, { children: expandableCenterLeft })) }))), expandableCenterRight && (_jsx(ExpandableContainer, Object.assign({ "data-testid": "ExpandableRightContainer", style: {
|
|
46
78
|
width: expandedRightMV,
|
|
47
79
|
position: 'absolute',
|
|
@@ -52,7 +84,7 @@ function RightLeftExpandingCenterChip(_a) {
|
|
|
52
84
|
opacity: isHovering ? 1 : 0,
|
|
53
85
|
pointerEvents: isHovering ? 'auto' : 'none',
|
|
54
86
|
borderRadius: '0 12px 12px 0',
|
|
55
|
-
borderLeft: 'none',
|
|
87
|
+
borderLeft: 'none', // Remove left border for seamless connection
|
|
56
88
|
}, initial: false, transition: { duration: 0.2, ease: 'easeOut' } }, { children: _jsx(ExpandableInner, Object.assign({ "data-testid": "ExpandableRightInner", ref: expandableRightInnerRef }, { children: expandableCenterRight })) }))), _jsx(AnimatePresence, Object.assign({ initial: false }, { children: rightIcons.length > 0 && (_jsx(RightPeekChip, { "data-testid": "RightPeekChip", initial: { opacity: 0, scale: 0.95, x: 4 }, animate: isHovering ? { opacity: 0, scale: 0.9, x: 6 } : { opacity: 1, scale: 1, x: 5 }, exit: { opacity: 0, scale: 0.95, x: 4 }, transition: { duration: 0.18, ease: 'easeOut' } }, "right-peek")) }))] })), isHovering && leftIcons.length > 0 && (_jsx(HoverBridge, { "data-testid": "LeftHoverBridge", side: "left", style: { width: leftHoverWidth, right: `calc(100% - ${anchors.left}px)`, zIndex: expandedZIndex, pointerEvents: 'auto' } })), isHovering && rightIcons.length > 0 && (_jsx(HoverBridge, { "data-testid": "RightHoverBridge", side: "right", style: { width: rightHoverWidth, left: `${anchors.right}px`, zIndex: expandedZIndex, pointerEvents: 'auto' } })), _jsx(AnimatePresence, Object.assign({ initial: false }, { children: leftIcons.length > 0 && (_jsx(ExpandedSection, Object.assign({ "data-testid": "LeftExpandedSection", side: "left", style: {
|
|
57
89
|
right: `calc(100% - ${anchors.left}px)`,
|
|
58
90
|
top: '50%',
|
|
@@ -62,6 +94,7 @@ function RightLeftExpandingCenterChip(_a) {
|
|
|
62
94
|
}, initial: { opacity: 0, x: 0, y: '-50%' }, animate: isHovering ? { opacity: 1, x: 0, y: '-50%' } : { opacity: 0, x: 0, y: '-50%' }, exit: { opacity: 0, x: 0, y: '-50%' }, transition: { duration: 0.25, ease: 'easeOut' } }, { children: leftIcons.map((icon, index) => {
|
|
63
95
|
var _a;
|
|
64
96
|
const leftOffset = (_a = leftOffsets[index]) !== null && _a !== void 0 ? _a : (DEFAULT_CHIP_MIN_WIDTH + CHIP_GAP) * (index + 1);
|
|
97
|
+
// Add shift to avoid overlap with expandable left content (no gap since it's seamless)
|
|
65
98
|
const totalOffset = leftOffset + leftShift;
|
|
66
99
|
return (_jsx(LeftExpandIcon, Object.assign({ "data-testid": `LeftExpandIcon-${index}`, initial: { opacity: 0, x: 0 }, animate: isHovering ? { opacity: 1, x: -totalOffset } : { opacity: 0, x: 0 }, exit: { opacity: 0, x: 0 }, transition: { duration: 0.25 + index * 0.04, ease: 'easeOut' }, style: { zIndex: expandedZIndex + (leftIcons.length - index) } }, { children: _jsx(ExpandChip, Object.assign({ "data-testid": `LeftExpandChip-${index}`, ref: (el) => (leftChipRefs.current[index] = el) }, { children: icon })) }), `left-${index}`));
|
|
67
100
|
}) }), "left-expanded")) })), _jsx(AnimatePresence, Object.assign({ initial: false }, { children: rightIcons.length > 0 && (_jsx(ExpandedSection, Object.assign({ "data-testid": "RightExpandedSection", side: "right", style: {
|
|
@@ -73,6 +106,7 @@ function RightLeftExpandingCenterChip(_a) {
|
|
|
73
106
|
}, initial: { opacity: 0, x: 0, y: '-50%' }, animate: isHovering ? { opacity: 1, x: 0, y: '-50%' } : { opacity: 0, x: 0, y: '-50%' }, exit: { opacity: 0, x: 0, y: '-50%' }, transition: { duration: 0.25, ease: 'easeOut' } }, { children: rightIcons.map((icon, index) => {
|
|
74
107
|
var _a;
|
|
75
108
|
const base = (_a = rightOffsets[index]) !== null && _a !== void 0 ? _a : (DEFAULT_CHIP_MIN_WIDTH + CHIP_GAP) * (index + 1);
|
|
109
|
+
// Shift accounts for seamless right expandable content
|
|
76
110
|
const shift = rightShift;
|
|
77
111
|
return (_jsx(RightExpandIcon, Object.assign({ "data-testid": `RightExpandIcon-${index}`, initial: { opacity: 0, x: 0 }, animate: isHovering ? { opacity: 1, x: shift + base } : { opacity: 0, x: 0 }, exit: { opacity: 0, x: 0 }, transition: { duration: 0.25 + index * 0.04, ease: 'easeOut' }, style: { zIndex: expandedZIndex + (rightIcons.length - index) } }, { children: _jsx(ExpandChip, Object.assign({ "data-testid": `RightExpandChip-${index}`, ref: (el) => (rightChipRefs.current[index] = el) }, { children: icon })) }), `right-${index}`));
|
|
78
112
|
}) }), "right-expanded")) }))] })) })) })));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { styled } from '@mui/material/styles';
|
|
2
2
|
import { motion } from 'framer-motion';
|
|
3
|
+
// Shared spacing between chips
|
|
3
4
|
export const CHIP_GAP = 3;
|
|
4
5
|
export const CenterIconWrapper = styled(motion.div)(({ theme }) => ({
|
|
5
6
|
display: 'flex',
|
|
@@ -14,10 +15,12 @@ export const CenterIconWrapper = styled(motion.div)(({ theme }) => ({
|
|
|
14
15
|
fontSize: '12px',
|
|
15
16
|
color: theme.palette.text.primary,
|
|
16
17
|
}));
|
|
18
|
+
// Wrapper that applies the horizontal shift driven by a motion value
|
|
17
19
|
export const CenterShiftWrapper = styled(motion.div)(() => ({
|
|
18
20
|
display: 'inline-flex',
|
|
19
21
|
}));
|
|
20
22
|
export const LeftExpandIcon = styled(motion.span)(({ theme }) => ({
|
|
23
|
+
// Make wrapper take no layout width; spacing fully controlled by transform
|
|
21
24
|
position: 'static',
|
|
22
25
|
display: 'inline-flex',
|
|
23
26
|
alignItems: 'center',
|
|
@@ -32,6 +35,7 @@ export const LeftExpandIcon = styled(motion.span)(({ theme }) => ({
|
|
|
32
35
|
userSelect: 'none',
|
|
33
36
|
}));
|
|
34
37
|
export const RightExpandIcon = styled(motion.span)(({ theme }) => ({
|
|
38
|
+
// Make wrapper take no layout width; spacing fully controlled by transform
|
|
35
39
|
position: 'static',
|
|
36
40
|
display: 'inline-flex',
|
|
37
41
|
alignItems: 'center',
|
|
@@ -46,7 +50,13 @@ export const RightExpandIcon = styled(motion.span)(({ theme }) => ({
|
|
|
46
50
|
userSelect: 'none',
|
|
47
51
|
}));
|
|
48
52
|
export const ExpandedSection = styled(motion.div)(({ side }) => (Object.assign(Object.assign(Object.assign({ position: 'absolute', display: 'flex', alignItems: 'center' }, (side === 'left' ? { right: '100%', flexDirection: 'row-reverse', transformOrigin: 'right center' } : {})), (side === 'right' ? { left: '100%', flexDirection: 'row', transformOrigin: 'left center' } : {})), { top: '50%', transform: 'translateY(-50%)', gap: 0, pointerEvents: 'auto', overflow: 'visible' })));
|
|
49
|
-
|
|
53
|
+
// Invisible hover overlays to bridge gaps between chips
|
|
54
|
+
export const HoverBridge = styled('div')(({ side }) => (Object.assign(Object.assign({ position: 'absolute', top: 0, bottom: 0 }, (side === 'left' ? { right: '100%' } : { left: '100%' })), {
|
|
55
|
+
// width will be supplied inline via style prop
|
|
56
|
+
pointerEvents: 'auto',
|
|
57
|
+
// transparent but present for hit-testing
|
|
58
|
+
background: 'transparent' })));
|
|
59
|
+
// --- Peek chips (requested style) ---
|
|
50
60
|
export const PeekContainer = styled(motion.div)(() => ({
|
|
51
61
|
position: 'relative',
|
|
52
62
|
display: 'inline-flex',
|
|
@@ -68,35 +78,46 @@ const baseChipStyles = (theme) => ({
|
|
|
68
78
|
fontSize: 12,
|
|
69
79
|
boxSizing: 'border-box',
|
|
70
80
|
whiteSpace: 'nowrap',
|
|
81
|
+
// allow chip to grow with content
|
|
71
82
|
overflow: 'visible',
|
|
72
83
|
});
|
|
73
84
|
export const CenterChip = styled(motion.div)(({ theme }) => (Object.assign(Object.assign({}, baseChipStyles(theme)), { position: 'relative', zIndex: 2, minWidth: 24, flex: '0 0 auto', display: 'inline-flex', overflow: 'hidden', willChange: 'transform' })));
|
|
85
|
+
// Static part of the center icon container
|
|
74
86
|
export const CenterContent = styled(motion.span)(() => ({
|
|
75
87
|
display: 'inline-flex',
|
|
76
88
|
alignItems: 'center',
|
|
77
89
|
transform: 'translateZ(0)',
|
|
78
90
|
}));
|
|
91
|
+
// Container that grows in width to reveal the expandable content
|
|
79
92
|
export const ExpandableContainer = styled(motion.span)(({ theme }) => ({
|
|
80
93
|
display: 'inline-flex',
|
|
81
94
|
whiteSpace: 'nowrap',
|
|
82
95
|
overflow: 'hidden',
|
|
83
96
|
boxSizing: 'border-box',
|
|
84
97
|
willChange: 'width',
|
|
98
|
+
// Style to look like a seamless continuation of the center chip
|
|
85
99
|
border: `1px solid ${theme.palette.divider}`,
|
|
86
100
|
backgroundColor: theme.palette.background.paper,
|
|
87
101
|
height: '24px',
|
|
88
102
|
alignItems: 'center',
|
|
89
|
-
paddingInline: '0px',
|
|
103
|
+
paddingInline: '0px', // Match center chip padding
|
|
90
104
|
}));
|
|
105
|
+
// Inner content of the expandable area
|
|
91
106
|
export const ExpandableInner = styled(motion.span)(() => ({
|
|
92
107
|
display: 'inline-flex',
|
|
93
108
|
whiteSpace: 'nowrap',
|
|
94
109
|
alignItems: 'center',
|
|
95
110
|
height: '100%',
|
|
96
111
|
}));
|
|
97
|
-
export const LeftPeekChip = styled(motion.div)(({ theme }) => (Object.assign(Object.assign({}, baseChipStyles(theme)), { position: 'absolute', left: 0, zIndex: 1, pointerEvents: 'none',
|
|
98
|
-
|
|
112
|
+
export const LeftPeekChip = styled(motion.div)(({ theme }) => (Object.assign(Object.assign({}, baseChipStyles(theme)), { position: 'absolute', left: 0, zIndex: 1, pointerEvents: 'none',
|
|
113
|
+
// ensure circular end even without content
|
|
114
|
+
minWidth: 24, paddingInline: 0 })));
|
|
115
|
+
export const RightPeekChip = styled(motion.div)(({ theme }) => (Object.assign(Object.assign({}, baseChipStyles(theme)), { position: 'absolute', right: 0, zIndex: 1, pointerEvents: 'none',
|
|
116
|
+
// ensure circular end even without content
|
|
117
|
+
minWidth: 24, paddingInline: 0 })));
|
|
118
|
+
// Chip for expanded icons (left/right lists)
|
|
99
119
|
export const ExpandChip = styled(motion.div)(({ theme }) => (Object.assign(Object.assign({}, baseChipStyles(theme)), { minWidth: 24, flex: '0 0 auto', display: 'inline-flex' })));
|
|
120
|
+
// Styles applied to the containing TableCell
|
|
100
121
|
export const tableCellSx = {
|
|
101
122
|
position: 'relative',
|
|
102
123
|
overflow: 'visible',
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hook: useRightLeftExpandingCenterChip
|
|
4
|
+
* Encapsulates hover logic, measurement (anchors, chip widths, expandable width),
|
|
5
|
+
* and motion values for the RightLeftExpandingCenterChip component.
|
|
6
|
+
*/
|
|
2
7
|
export declare const DEFAULT_CHIP_MIN_WIDTH = 24;
|
|
3
8
|
export type UseRightLeftExpandingCenterChipArgs = {
|
|
4
9
|
leftIcons: ReactNode[];
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { useRef, useEffect, useState, useMemo, useCallback, useLayoutEffect } from 'react';
|
|
2
2
|
import { animate, useMotionValue } from 'framer-motion';
|
|
3
3
|
import { CHIP_GAP } from './style';
|
|
4
|
+
/**
|
|
5
|
+
* Hook: useRightLeftExpandingCenterChip
|
|
6
|
+
* Encapsulates hover logic, measurement (anchors, chip widths, expandable width),
|
|
7
|
+
* and motion values for the RightLeftExpandingCenterChip component.
|
|
8
|
+
*/
|
|
4
9
|
export const DEFAULT_CHIP_MIN_WIDTH = 24;
|
|
5
10
|
export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenterRight, expandableCenterLeft, }) {
|
|
11
|
+
// =================================
|
|
12
|
+
// State (move all state to the top)
|
|
13
|
+
// =================================
|
|
6
14
|
const [isHovering, setIsHovering] = useState(false);
|
|
7
15
|
const [anchors, setAnchors] = useState({ left: 0, right: 0 });
|
|
8
16
|
const [leftWidths, setLeftWidths] = useState([]);
|
|
9
17
|
const [rightWidths, setRightWidths] = useState([]);
|
|
10
18
|
const [expandableRightWidth, setExpandableRightWidth] = useState(0);
|
|
11
19
|
const [expandableLeftWidth, setExpandableLeftWidth] = useState(0);
|
|
20
|
+
// ======================
|
|
21
|
+
// Refs (DOM and timers)
|
|
22
|
+
// ======================
|
|
12
23
|
const hoverTimeoutRef = useRef(null);
|
|
13
24
|
const centerWrapRef = useRef(null);
|
|
14
25
|
const centerContentRef = useRef(null);
|
|
@@ -17,7 +28,9 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
17
28
|
const rightChipRefs = useRef([]);
|
|
18
29
|
const expandableRightInnerRef = useRef(null);
|
|
19
30
|
const expandableLeftInnerRef = useRef(null);
|
|
31
|
+
// rAF id for resize throttling
|
|
20
32
|
const resizeRaf = useRef(null);
|
|
33
|
+
// Small helpers to avoid unnecessary state updates
|
|
21
34
|
const arraysEqual = useCallback((a, b) => {
|
|
22
35
|
if (a === b)
|
|
23
36
|
return true;
|
|
@@ -31,9 +44,16 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
31
44
|
const anchorsEqual = useCallback((a, b) => {
|
|
32
45
|
return a.left === b.left && a.right === b.right;
|
|
33
46
|
}, []);
|
|
47
|
+
// ======================
|
|
48
|
+
// Motion values
|
|
49
|
+
// ======================
|
|
34
50
|
const expandedRightMV = useMotionValue(0);
|
|
35
51
|
const expandedLeftMV = useMotionValue(0);
|
|
52
|
+
// Center icon stays fixed - no shift needed
|
|
36
53
|
const shiftX = useMotionValue(0);
|
|
54
|
+
// ======================
|
|
55
|
+
// Computed values
|
|
56
|
+
// ======================
|
|
37
57
|
const leftOffsets = useMemo(() => {
|
|
38
58
|
if (!leftWidths.length)
|
|
39
59
|
return [];
|
|
@@ -58,21 +78,31 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
58
78
|
}
|
|
59
79
|
return acc;
|
|
60
80
|
}, [rightWidths]);
|
|
81
|
+
// Right icons shift to account for expandable content without gap
|
|
61
82
|
const rightShift = isHovering && expandableCenterRight ? expandableRightWidth : 0;
|
|
83
|
+
// Left icons shift to account for expandable content without gap
|
|
62
84
|
const leftShift = isHovering && expandableCenterLeft ? expandableLeftWidth : 0;
|
|
85
|
+
// Predict max right shift even when not hovering to size hover zone generously
|
|
63
86
|
const maxRightShift = expandableCenterRight ? expandableRightWidth : 0;
|
|
87
|
+
// ======================
|
|
88
|
+
// Callbacks
|
|
89
|
+
// ======================
|
|
64
90
|
const handleMouseEnter = useCallback(() => {
|
|
65
91
|
if (hoverTimeoutRef.current)
|
|
66
92
|
clearTimeout(hoverTimeoutRef.current);
|
|
93
|
+
// Enter immediately to keep hover active while moving across expanded areas
|
|
67
94
|
setIsHovering(true);
|
|
68
95
|
}, []);
|
|
69
96
|
const handleMouseLeave = useCallback(() => {
|
|
70
97
|
if (hoverTimeoutRef.current)
|
|
71
98
|
clearTimeout(hoverTimeoutRef.current);
|
|
99
|
+
// Delay hover off to avoid flicker when moving between center and expanded icons
|
|
72
100
|
hoverTimeoutRef.current = setTimeout(() => setIsHovering(false), 120);
|
|
73
101
|
}, []);
|
|
102
|
+
// Single measurement function to batch reads and writes
|
|
74
103
|
const measureAll = useCallback(() => {
|
|
75
104
|
var _a, _b, _c, _d, _e;
|
|
105
|
+
// Read DOM
|
|
76
106
|
const wrap = centerWrapRef.current;
|
|
77
107
|
const chip = centerChipRef.current;
|
|
78
108
|
const content = centerContentRef.current;
|
|
@@ -81,6 +111,7 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
81
111
|
const wrapRect = wrap.getBoundingClientRect();
|
|
82
112
|
const targetRect = (_a = (chip !== null && chip !== void 0 ? chip : content)) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
83
113
|
if (targetRect) {
|
|
114
|
+
// Round to prevent tiny sub-pixel changes causing re-renders
|
|
84
115
|
const left = Math.round(targetRect.left - wrapRect.left);
|
|
85
116
|
const right = Math.round(targetRect.right - wrapRect.left);
|
|
86
117
|
nextAnchors = { left, right };
|
|
@@ -90,6 +121,7 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
90
121
|
const nextRightWidths = rightChipRefs.current.map((el) => (el ? el.offsetWidth : DEFAULT_CHIP_MIN_WIDTH));
|
|
91
122
|
const nextExpandableRightWidth = (_c = (_b = expandableRightInnerRef.current) === null || _b === void 0 ? void 0 : _b.scrollWidth) !== null && _c !== void 0 ? _c : 0;
|
|
92
123
|
const nextExpandableLeftWidth = (_e = (_d = expandableLeftInnerRef.current) === null || _d === void 0 ? void 0 : _d.scrollWidth) !== null && _e !== void 0 ? _e : 0;
|
|
124
|
+
// Write state only if changed
|
|
93
125
|
if (!anchorsEqual(anchors, nextAnchors))
|
|
94
126
|
setAnchors(nextAnchors);
|
|
95
127
|
if (!arraysEqual(leftWidths, nextLeftWidths))
|
|
@@ -101,6 +133,7 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
101
133
|
if (expandableLeftWidth !== nextExpandableLeftWidth)
|
|
102
134
|
setExpandableLeftWidth(nextExpandableLeftWidth);
|
|
103
135
|
}, [anchors, leftWidths, rightWidths, expandableRightWidth, expandableLeftWidth, anchorsEqual, arraysEqual]);
|
|
136
|
+
// rAF-throttled resize handler (memoized)
|
|
104
137
|
const onResize = useCallback(() => {
|
|
105
138
|
if (resizeRaf.current)
|
|
106
139
|
cancelAnimationFrame(resizeRaf.current);
|
|
@@ -108,17 +141,22 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
108
141
|
measureAll();
|
|
109
142
|
});
|
|
110
143
|
}, [measureAll]);
|
|
144
|
+
// ======================
|
|
145
|
+
// Effects
|
|
146
|
+
// ======================
|
|
111
147
|
useEffect(() => {
|
|
112
148
|
return () => {
|
|
113
149
|
if (hoverTimeoutRef.current)
|
|
114
150
|
clearTimeout(hoverTimeoutRef.current);
|
|
115
151
|
};
|
|
116
152
|
}, []);
|
|
153
|
+
// Perform initial measurements (and when inputs that affect layout change) before paint
|
|
117
154
|
useLayoutEffect(() => {
|
|
118
155
|
measureAll();
|
|
119
156
|
}, [centerIcon, leftIcons, rightIcons, expandableCenterRight, expandableCenterLeft, measureAll]);
|
|
157
|
+
// Window resize listener effect
|
|
120
158
|
useEffect(() => {
|
|
121
|
-
onResize();
|
|
159
|
+
onResize(); // initial measurement on mount
|
|
122
160
|
window.addEventListener('resize', onResize);
|
|
123
161
|
return () => {
|
|
124
162
|
window.removeEventListener('resize', onResize);
|
|
@@ -126,16 +164,21 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
126
164
|
cancelAnimationFrame(resizeRaf.current);
|
|
127
165
|
};
|
|
128
166
|
}, [onResize]);
|
|
167
|
+
// Animate right expandable content - no gap for seamless connection
|
|
129
168
|
useEffect(() => {
|
|
130
169
|
const target = isHovering && expandableCenterRight ? expandableRightWidth : 0;
|
|
131
170
|
const controls = animate(expandedRightMV, target, { duration: 0.2, ease: 'easeOut' });
|
|
132
171
|
return () => controls.stop();
|
|
133
172
|
}, [isHovering, expandableCenterRight, expandableRightWidth, expandedRightMV]);
|
|
173
|
+
// Animate left expandable content - no gap for seamless connection
|
|
134
174
|
useEffect(() => {
|
|
135
175
|
const target = isHovering && expandableCenterLeft ? expandableLeftWidth : 0;
|
|
136
176
|
const controls = animate(expandedLeftMV, target, { duration: 0.2, ease: 'easeOut' });
|
|
137
177
|
return () => controls.stop();
|
|
138
178
|
}, [isHovering, expandableCenterLeft, expandableLeftWidth, expandedLeftMV]);
|
|
179
|
+
// ======================
|
|
180
|
+
// Derived hover zone widths (adjusted for seamless positioning)
|
|
181
|
+
// ======================
|
|
139
182
|
const leftHoverWidth = useMemo(() => {
|
|
140
183
|
var _a;
|
|
141
184
|
if (!leftOffsets.length)
|
|
@@ -154,27 +197,36 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
154
197
|
const farthest = maxRightShift + rightOffsets[last] + lastWidth / 2;
|
|
155
198
|
return farthest + CHIP_GAP;
|
|
156
199
|
}, [rightOffsets, rightWidths, maxRightShift]);
|
|
200
|
+
// ======================
|
|
201
|
+
// Public API
|
|
202
|
+
// ======================
|
|
157
203
|
return {
|
|
204
|
+
// hover state/handlers
|
|
158
205
|
isHovering,
|
|
159
206
|
handleMouseEnter,
|
|
160
207
|
handleMouseLeave,
|
|
208
|
+
// anchors/refs
|
|
161
209
|
centerWrapRef,
|
|
162
210
|
centerContentRef,
|
|
163
211
|
centerChipRef,
|
|
164
212
|
anchors,
|
|
213
|
+
// chip measurement/offsets
|
|
165
214
|
leftChipRefs,
|
|
166
215
|
rightChipRefs,
|
|
167
216
|
leftOffsets,
|
|
168
217
|
rightOffsets,
|
|
218
|
+
// expandable area
|
|
169
219
|
expandableRightInnerRef,
|
|
170
220
|
expandableLeftInnerRef,
|
|
171
221
|
expandableRightWidth,
|
|
172
222
|
expandableLeftWidth,
|
|
223
|
+
// motion values
|
|
173
224
|
expandedRightMV,
|
|
174
225
|
expandedLeftMV,
|
|
175
226
|
shiftX,
|
|
176
227
|
rightShift,
|
|
177
228
|
leftShift,
|
|
229
|
+
// hover zone widths
|
|
178
230
|
leftHoverWidth,
|
|
179
231
|
rightHoverWidth,
|
|
180
232
|
};
|
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
14
14
|
import Stack from '@mui/material/Stack';
|
|
15
|
-
const OFFSET = 50;
|
|
15
|
+
const OFFSET = 50; // px to trigger loading before reaching full bottom
|
|
16
16
|
const isNearBottom = (el, offset = OFFSET) => {
|
|
17
17
|
const scrollBottom = el.scrollTop + el.clientHeight;
|
|
18
18
|
const scrollHeight = el.scrollHeight;
|
|
@@ -44,6 +44,7 @@ const ScrollLoader = (props) => {
|
|
|
44
44
|
el.addEventListener('scroll', handleScroll);
|
|
45
45
|
return () => el.removeEventListener('scroll', handleScroll);
|
|
46
46
|
}, [handleScroll]);
|
|
47
|
+
// Initially .. auto load the data if the scrollable container allows
|
|
47
48
|
useEffect(() => {
|
|
48
49
|
const el = containerRef.current;
|
|
49
50
|
if (!el || loading || initialChecked)
|
|
@@ -19,29 +19,34 @@ import { ChevronContainer, Label, LabelWrapper, StyledStatusIcon, StyledDropdown
|
|
|
19
19
|
import { statusButtonIcons } from './constant';
|
|
20
20
|
const StatusButton = memo((props) => {
|
|
21
21
|
var _a;
|
|
22
|
-
const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, onButtonBodyClick } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "onButtonBodyClick"]);
|
|
22
|
+
const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, onButtonBodyClick, iconMapper = statusButtonIcons } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "onButtonBodyClick", "iconMapper"]);
|
|
23
23
|
const [buttonClicks, setButtonClicks] = useState(0);
|
|
24
24
|
const { t } = useTranslation();
|
|
25
25
|
const buttonRef = useRef(null);
|
|
26
26
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
27
27
|
const [selectedStatus, setSelectedStatus] = useState((_a = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _a === void 0 ? void 0 : _a.status);
|
|
28
|
+
// Memoized computed values
|
|
28
29
|
const hasDropdown = useMemo(() => Boolean(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.length), [dropdownOptions]);
|
|
30
|
+
// only open if button is clicked more than once
|
|
29
31
|
const isDropdownOpen = Boolean(anchorEl) && buttonClicks > 1;
|
|
30
32
|
const isActiveVariant = variant === 'active';
|
|
31
33
|
const badgeVariant = useMemo(() => (isActiveVariant ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE), [isActiveVariant]);
|
|
32
|
-
|
|
34
|
+
// Memoized UI elements
|
|
35
|
+
const statusIcon = useMemo(() => (icon ? _jsx(StyledStatusIcon, { icon: icon, variant: variant, src: iconMapper[icon], alt: `${icon}-icon` }) : null), [icon, iconMapper, variant]);
|
|
33
36
|
const statusBadge = useMemo(() => {
|
|
34
37
|
if (!badgeCount || Number.isNaN(convertToNumber(badgeCount)))
|
|
35
38
|
return null;
|
|
36
39
|
return _jsx(StyledBadge, Object.assign({ variant: badgeVariant }, { children: formatNumber(Number(badgeCount)) }));
|
|
37
40
|
}, [badgeCount, badgeVariant]);
|
|
38
41
|
const dropdownIcon = useMemo(() => (hasDropdown ? _jsx(ChevronIcon, { isActive: isActiveVariant }) : null), [hasDropdown, isActiveVariant]);
|
|
42
|
+
// Reset button clicks and anchor element when variant changes
|
|
39
43
|
useEffect(() => {
|
|
40
44
|
if (!isActiveVariant) {
|
|
41
45
|
setButtonClicks(0);
|
|
42
46
|
setAnchorEl(null);
|
|
43
47
|
}
|
|
44
48
|
}, [isActiveVariant]);
|
|
49
|
+
// Event handlers
|
|
45
50
|
const handleDropdownClose = useCallback(() => {
|
|
46
51
|
setAnchorEl(null);
|
|
47
52
|
}, []);
|
|
@@ -58,12 +63,15 @@ const StatusButton = memo((props) => {
|
|
|
58
63
|
handleDropdownToggle();
|
|
59
64
|
setButtonClicks((prev) => prev + 1);
|
|
60
65
|
}, [props, onButtonBodyClick, selectedStatus, dropdownOptions, handleDropdownToggle]);
|
|
61
|
-
const handleMenuItemClick = useCallback(
|
|
66
|
+
const handleMenuItemClick = useCallback(
|
|
67
|
+
// eslint-disable-next-line
|
|
68
|
+
(item) => (e) => {
|
|
62
69
|
var _a;
|
|
63
70
|
(_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, e);
|
|
64
71
|
setSelectedStatus(item.status);
|
|
65
72
|
handleDropdownClose();
|
|
66
73
|
}, [handleDropdownClose]);
|
|
74
|
+
// Enhanced dropdown menu items
|
|
67
75
|
const menuItems = useMemo(() => (dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((item) => (Object.assign(Object.assign({}, item), { onClick: handleMenuItemClick(item) })))) || [], [dropdownOptions, handleMenuItemClick]);
|
|
68
76
|
const ButtonComponent = statusButtonVariants[variant];
|
|
69
77
|
const displayLabel = selectedStatus ? t(selectedStatus) : label;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { initiatedIcon, abandonedIcon, cancelledIcon, reportsIcon, searchIcon, chevronDownIcon, unAuthorizedIcon, settlementInitiatedIcon, unCapturedIcon, capturedIcon, authorizedIcon, openFlagIcon, closedFlagIcon, reverseActionIcon, authenticatedIcon, unauthenticatedIcon, paidOutFilterIcon, scheduledFilterIcon, completedBlackIcon,
|
|
1
|
+
import { initiatedIcon, abandonedIcon, cancelledIcon, reportsIcon, searchIcon, chevronDownIcon, unAuthorizedIcon, settlementInitiatedIcon, unCapturedIcon, capturedIcon, authorizedIcon, openFlagIcon, closedFlagIcon, reverseActionIcon, authenticatedIcon, unauthenticatedIcon, paidOutFilterIcon, scheduledFilterIcon, completedBlackIcon,
|
|
2
|
+
// trashBinIcon,
|
|
3
|
+
} from '../../constants/index.js';
|
|
2
4
|
export const statusButtonIcons = {
|
|
3
5
|
inProgress: initiatedIcon,
|
|
4
6
|
initiated: initiatedIcon,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type Theme } from '@mui/material';
|
|
3
|
+
import { StatusButtonProps } from './type';
|
|
3
4
|
export declare const statusButtonVariants: {
|
|
4
5
|
active: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
5
6
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
@@ -35,5 +36,5 @@ export declare const LabelWrapper: import("@emotion/styled").StyledComponent<imp
|
|
|
35
36
|
}, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
36
37
|
export declare const StyledStatusIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
37
38
|
variant: StatusButtonVariant;
|
|
38
|
-
icon?:
|
|
39
|
+
icon?: StatusButtonProps['icon'];
|
|
39
40
|
}, React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
@@ -8,11 +8,23 @@ export interface StatusButtonProps extends Omit<ButtonProps, 'variant' | 'childr
|
|
|
8
8
|
variant?: StatusButtonVariant;
|
|
9
9
|
badgeCount?: number | string;
|
|
10
10
|
hasDropdown?: boolean;
|
|
11
|
-
icon?: StatusButtonIcon;
|
|
11
|
+
icon?: StatusButtonIcon | (string & {});
|
|
12
12
|
label?: ReactNode | null;
|
|
13
13
|
showDropdownIcon?: boolean;
|
|
14
14
|
totalCount?: number;
|
|
15
15
|
onButtonBodyClick?: (status: TableHeaderStatus) => void;
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* `iconMapper` is used as an override for mapping between a given key (statusKey .. ex:`"active"`) and icon src URL
|
|
19
|
+
* @example
|
|
20
|
+
* ```js
|
|
21
|
+
* iconMapper: {
|
|
22
|
+
* active:'http://base-url/active.svg',
|
|
23
|
+
* inactive:'http://base-url/inactive.svg',
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
iconMapper?: Record<StatusButtonIcon | (string & {}), string>;
|
|
16
28
|
dropdownOptions?: Array<MenuItemI & {
|
|
17
29
|
status: TableHeaderStatus;
|
|
18
30
|
}>;
|
|
@@ -20,6 +20,17 @@ function CaptureAutoIcon({ voidPercentage, capturePercentage, captureCount, auto
|
|
|
20
20
|
const formattedAmount = formatAmount(remainingAmount || 0);
|
|
21
21
|
const generateAutoTooltip = useCallback((type) => {
|
|
22
22
|
return `Auto ${type} - ${currency} ${formattedAmount.integerAmount}.${formattedAmount.decimalAmount}`;
|
|
23
|
+
// if (!lastDate) return `Auto ${type}`
|
|
24
|
+
// const typeLabel = `Auto ${type} - Scheduled`
|
|
25
|
+
// const date = dayjs(lastDate).calendar(null, {
|
|
26
|
+
// sameDay: '[for Today at] h:mm A',
|
|
27
|
+
// nextDay: '[for Tomorrow at] h:mm A',
|
|
28
|
+
// lastDay: '[for Yesterday at] h:mm A',
|
|
29
|
+
// sameElse: '[for] MMM DD [at] h:mm A',
|
|
30
|
+
// lastWeek: '[for] MMM DD [at] h:mm A',
|
|
31
|
+
// nextWeek: '[for] MMM DD [at] h:mm A'
|
|
32
|
+
// })
|
|
33
|
+
// return `${typeLabel} ${date}`
|
|
23
34
|
}, [currency, formattedAmount.decimalAmount, formattedAmount.integerAmount]);
|
|
24
35
|
const generatePartialTooltip = useCallback((type) => {
|
|
25
36
|
const amount = type === 'Capture' ? captureAmount : voidAmount;
|
|
@@ -20,6 +20,17 @@ function VoidAutoIcon({ voidPercentage, capturePercentage, voidCount, autoType,
|
|
|
20
20
|
const formattedAmount = formatAmount(remainingAmount || 0);
|
|
21
21
|
const generateAutoTooltip = useCallback((type) => {
|
|
22
22
|
return `Auto ${type} - ${currency} ${formattedAmount.integerAmount}.${formattedAmount.decimalAmount}`;
|
|
23
|
+
// if (!lastDate) return `Auto ${type}`
|
|
24
|
+
// const typeLabel = `Auto ${type} - Scheduled`
|
|
25
|
+
// const date = dayjs(lastDate).calendar(null, {
|
|
26
|
+
// sameDay: '[for Today at] h:mm A',
|
|
27
|
+
// nextDay: '[for Tomorrow at] h:mm A',
|
|
28
|
+
// lastDay: '[for Yesterday at] h:mm A',
|
|
29
|
+
// sameElse: '[for] MMM DD [at] h:mm A',
|
|
30
|
+
// lastWeek: '[for] MMM DD [at] h:mm A',
|
|
31
|
+
// nextWeek: '[for] MMM DD [at] h:mm A'
|
|
32
|
+
// })
|
|
33
|
+
// return `${typeLabel} ${date}`
|
|
23
34
|
}, [currency, formattedAmount.decimalAmount, formattedAmount.integerAmount]);
|
|
24
35
|
const generatePartialTooltip = useCallback((type) => {
|
|
25
36
|
const amount = type === 'Capture' ? captureAmount : voidAmount;
|
package/build/components/TableCells/CustomCells/ApplicationStatusCell/ApplicationStatusCell.js
CHANGED
|
@@ -49,7 +49,9 @@ export default function ApplicationStatusCell(_a) {
|
|
|
49
49
|
}, borderColor: "transparent" }) })) }), `${app}-${index}`));
|
|
50
50
|
}), [apps, theme]);
|
|
51
51
|
const appsCount = (apps === null || apps === void 0 ? void 0 : apps.length) || 0;
|
|
52
|
-
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledAppsCell, { children: appsCount > 0 ? (_jsx(AppsStatusContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate",
|
|
52
|
+
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledAppsCell, { children: appsCount > 0 ? (_jsx(AppsStatusContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate",
|
|
53
|
+
// animate when state changes
|
|
54
|
+
animate: isTooltipOpen ? 'animate' : 'start', sourcesCount: appsCount, variants: { animate: { width: appsCount * (6 + 32) } }, style: {
|
|
53
55
|
zIndex: 29,
|
|
54
56
|
} }, { children: appsStatus }))) : null }) })));
|
|
55
57
|
}
|
|
@@ -17,6 +17,7 @@ import { BrandCellContainer, WalletIcon, WalletIconContainer } from './style';
|
|
|
17
17
|
function BrandCell(_a) {
|
|
18
18
|
var { brandName, brandIcon } = _a, props = __rest(_a, ["brandName", "brandIcon"]);
|
|
19
19
|
const icon = brandIcon ? (_jsx(Tooltip, Object.assign({ title: brandName }, { children: _jsx(WalletIcon, { src: brandIcon, alt: "brand icon", onError: (e) => {
|
|
20
|
+
// set the default icon if the image is not found
|
|
20
21
|
e.currentTarget.src = brandPlaceholderIcon;
|
|
21
22
|
} }) }))) : (_jsx(WalletIcon, { src: brandPlaceholderIcon, alt: "brand icon" }));
|
|
22
23
|
return (_jsx(TableCell, Object.assign({ style: {
|
|
@@ -34,7 +34,9 @@ function ReferenceCell(_a) {
|
|
|
34
34
|
} }, { children: isTextShown ? (_jsx(ReferenceTextWrapper, { children: _jsx(ReferenceTextLabel, { children: startCase(reference) }) })) : (_jsx(StyledSourceImage, { src: referenceIcons[reference], alt: reference, sx: Object.assign({}, (reference === 'order' && { width: '11.82px' })) })) })) }), `${reference}-${index}`));
|
|
35
35
|
}), [props, references, isTextShown, theme]);
|
|
36
36
|
const referenceSourcesCount = (ReferenceSources === null || ReferenceSources === void 0 ? void 0 : ReferenceSources.length) || 0;
|
|
37
|
-
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, { children: referenceSourcesCount > 0 ? (_jsx(ReferenceSourcesContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate",
|
|
37
|
+
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, { children: referenceSourcesCount > 0 ? (_jsx(ReferenceSourcesContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate",
|
|
38
|
+
// animate when state changes
|
|
39
|
+
animate: isTooltipOpen ? 'animate' : 'start', sourcesCount: referenceSourcesCount, variants: { animate: { width: referenceSourcesCount * (6 + 32) } }, style: {
|
|
38
40
|
zIndex: 29,
|
|
39
41
|
} }, { children: ReferenceSources }))) : null }) })));
|
|
40
42
|
}
|
package/build/components/TableCells/CustomCells/RefundStatusCell/components/RefundStateIcon.js
CHANGED
|
@@ -8,6 +8,7 @@ import { RefundStatusIcon } from './RefundStatusIcon';
|
|
|
8
8
|
export function RefundStateIcon({ status, gatewayTooltip, unCapturedTooltip, acquirerTooltip, errorCode, acquirerCode, gatewayCode, refundTooltip, }) {
|
|
9
9
|
const { t } = useTranslation();
|
|
10
10
|
if (!(unCapturedStatuses === null || unCapturedStatuses === void 0 ? void 0 : unCapturedStatuses.includes(status !== null && status !== void 0 ? status : ''))) {
|
|
11
|
+
// eslint-disable-next-line
|
|
11
12
|
return _jsx(RefundStatusIcon, { status: status, refundTooltip: refundTooltip });
|
|
12
13
|
}
|
|
13
14
|
return (_jsx(Tooltip, Object.assign({ title: t(camelCase(status)) }, { children: _jsx(ChargeStatusIcon, { chargeStatus: status, gatewayTooltip: gatewayTooltip, chargeTooltip: unCapturedTooltip, acquirerTooltip: acquirerTooltip, errorCode: errorCode, acquirerCode: acquirerCode, gatewayCode: gatewayCode, unCapturedStyles: {
|