@tap-payments/os-micro-frontend-shared 0.1.63 → 0.1.64
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/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.d.ts +1 -1
- package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.js +40 -16
- package/build/components/RightLeftExpandingCenterChip/style.js +1 -4
- package/build/components/RightLeftExpandingCenterChip/type.d.ts +2 -1
- package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.d.ts +10 -5
- package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.js +36 -20
- package/build/constants/table/cell/refundTableCellWidth.d.ts +3 -3
- package/build/constants/table/cell/refundTableCellWidth.js +3 -3
- package/package.json +135 -135
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Tap Payments
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tap Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# os-micro-frontend-shared
|
|
2
|
-
|
|
3
|
-
## Publishing Workflow
|
|
4
|
-
|
|
5
|
-
1. Update version in package.json
|
|
6
|
-
2. Commit changes
|
|
7
|
-
3. Create and push a tag:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm version patch # or minor, major
|
|
11
|
-
git push origin main --tags
|
|
12
|
-
```
|
|
1
|
+
# os-micro-frontend-shared
|
|
2
|
+
|
|
3
|
+
## Publishing Workflow
|
|
4
|
+
|
|
5
|
+
1. Update version in package.json
|
|
6
|
+
2. Commit changes
|
|
7
|
+
3. Create and push a tag:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm version patch # or minor, major
|
|
11
|
+
git push origin main --tags
|
|
12
|
+
```
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RightLeftExpandingCenterChipProps } from './type';
|
|
2
|
-
declare function RightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon,
|
|
2
|
+
declare function RightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenterRight, expandableCenterLeft, expandedZIndex, ...props }: Readonly<RightLeftExpandingCenterChipProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default RightLeftExpandingCenterChip;
|
|
@@ -15,22 +15,45 @@ 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
17
|
function RightLeftExpandingCenterChip(_a) {
|
|
18
|
-
var { leftIcons = [], rightIcons = [], centerIcon,
|
|
19
|
-
const { isHovering, handleMouseEnter, handleMouseLeave, centerWrapRef, centerContentRef, centerChipRef, anchors, leftChipRefs, rightChipRefs, leftOffsets, rightOffsets,
|
|
18
|
+
var { leftIcons = [], rightIcons = [], centerIcon, expandableCenterRight, expandableCenterLeft, expandedZIndex = 1000 } = _a, props = __rest(_a, ["leftIcons", "rightIcons", "centerIcon", "expandableCenterRight", "expandableCenterLeft", "expandedZIndex"]);
|
|
19
|
+
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 });
|
|
20
20
|
return (_jsx(Box, Object.assign({}, props, { "data-testid": "RightLeftExpandingCenterChipBox", sx: tableCellSx }, { children: _jsx(CenterShiftWrapper, Object.assign({ "data-testid": "CenterShiftWrapper", initial: false, style: { x: shiftX } }, { children: _jsxs(CenterIconWrapper, Object.assign({ "data-testid": "CenterIconWrapper", ref: centerWrapRef, onMouseLeave: handleMouseLeave }, { children: [_jsxs(PeekContainer, Object.assign({ "data-testid": "PeekContainer" }, { children: [_jsx(AnimatePresence, Object.assign({ initial: false }, { children: leftIcons.length > 0 && (_jsx(LeftPeekChip, { "data-testid": "LeftPeekChip", 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' } }, "left-peek")) })), _jsx(CenterChip, Object.assign({ "data-testid": "CenterChip", ref: centerChipRef, onMouseEnter: handleMouseEnter, style: {
|
|
21
|
-
borderRadius:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
borderRadius: (() => {
|
|
22
|
+
const hasLeftExpanded = expandableCenterLeft && isHovering;
|
|
23
|
+
const hasRightExpanded = expandableCenterRight && isHovering;
|
|
24
|
+
if (hasLeftExpanded && hasRightExpanded)
|
|
25
|
+
return '0';
|
|
26
|
+
if (hasLeftExpanded)
|
|
27
|
+
return '0 12px 12px 0';
|
|
28
|
+
if (hasRightExpanded)
|
|
29
|
+
return '12px 0 0 12px';
|
|
30
|
+
return '12px';
|
|
31
|
+
})(),
|
|
32
|
+
borderLeft: expandableCenterLeft && isHovering ? 'none' : undefined,
|
|
33
|
+
borderRight: expandableCenterRight && isHovering ? 'none' : undefined,
|
|
34
|
+
} }, { children: _jsx(CenterContent, Object.assign({ "data-testid": "CenterContent", ref: centerContentRef }, { children: centerIcon })) })), expandableCenterLeft && (_jsx(ExpandableContainer, Object.assign({ "data-testid": "ExpandableLeftContainer", style: {
|
|
35
|
+
width: expandedLeftMV,
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
right: '100%',
|
|
38
|
+
top: 0,
|
|
39
|
+
height: '24px',
|
|
40
|
+
zIndex: 1,
|
|
41
|
+
opacity: isHovering ? 1 : 0,
|
|
42
|
+
pointerEvents: isHovering ? 'auto' : 'none',
|
|
43
|
+
borderRadius: '12px 0 0 12px',
|
|
44
|
+
borderRight: 'none',
|
|
45
|
+
}, 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
|
+
width: expandedRightMV,
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
left: '100%',
|
|
49
|
+
top: 0,
|
|
50
|
+
height: '24px',
|
|
51
|
+
zIndex: 1,
|
|
52
|
+
opacity: isHovering ? 1 : 0,
|
|
53
|
+
pointerEvents: isHovering ? 'auto' : 'none',
|
|
54
|
+
borderRadius: '0 12px 12px 0',
|
|
55
|
+
borderLeft: 'none',
|
|
56
|
+
}, 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: {
|
|
34
57
|
right: `calc(100% - ${anchors.left}px)`,
|
|
35
58
|
top: '50%',
|
|
36
59
|
position: 'absolute',
|
|
@@ -39,7 +62,8 @@ function RightLeftExpandingCenterChip(_a) {
|
|
|
39
62
|
}, 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) => {
|
|
40
63
|
var _a;
|
|
41
64
|
const leftOffset = (_a = leftOffsets[index]) !== null && _a !== void 0 ? _a : (DEFAULT_CHIP_MIN_WIDTH + CHIP_GAP) * (index + 1);
|
|
42
|
-
|
|
65
|
+
const totalOffset = leftOffset + leftShift;
|
|
66
|
+
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}`));
|
|
43
67
|
}) }), "left-expanded")) })), _jsx(AnimatePresence, Object.assign({ initial: false }, { children: rightIcons.length > 0 && (_jsx(ExpandedSection, Object.assign({ "data-testid": "RightExpandedSection", side: "right", style: {
|
|
44
68
|
left: `${anchors.right}px`,
|
|
45
69
|
top: '50%',
|
|
@@ -85,17 +85,14 @@ export const ExpandableContainer = styled(motion.span)(({ theme }) => ({
|
|
|
85
85
|
boxSizing: 'border-box',
|
|
86
86
|
willChange: 'width',
|
|
87
87
|
border: `1px solid ${theme.palette.divider}`,
|
|
88
|
-
borderLeft: 'none',
|
|
89
|
-
borderRadius: '0 12px 12px 0',
|
|
90
88
|
backgroundColor: theme.palette.background.paper,
|
|
91
89
|
height: '24px',
|
|
92
90
|
alignItems: 'center',
|
|
91
|
+
paddingInline: '0px',
|
|
93
92
|
}));
|
|
94
93
|
export const ExpandableInner = styled(motion.span)(() => ({
|
|
95
94
|
display: 'inline-flex',
|
|
96
95
|
whiteSpace: 'nowrap',
|
|
97
|
-
paddingLeft: '1px',
|
|
98
|
-
paddingRight: '8px',
|
|
99
96
|
alignItems: 'center',
|
|
100
97
|
height: '100%',
|
|
101
98
|
}));
|
|
@@ -4,7 +4,8 @@ export interface RightLeftExpandingCenterChipProps {
|
|
|
4
4
|
leftIcons?: React.ReactNode[];
|
|
5
5
|
rightIcons?: React.ReactNode[];
|
|
6
6
|
centerIcon: React.ReactNode;
|
|
7
|
-
|
|
7
|
+
expandableCenterRight?: React.ReactNode;
|
|
8
|
+
expandableCenterLeft?: React.ReactNode;
|
|
8
9
|
sx?: SxProps;
|
|
9
10
|
expandedZIndex?: number;
|
|
10
11
|
}
|
|
@@ -4,9 +4,10 @@ export type UseRightLeftExpandingCenterChipArgs = {
|
|
|
4
4
|
leftIcons: ReactNode[];
|
|
5
5
|
rightIcons: ReactNode[];
|
|
6
6
|
centerIcon: ReactNode;
|
|
7
|
-
|
|
7
|
+
expandableCenterRight?: ReactNode;
|
|
8
|
+
expandableCenterLeft?: ReactNode;
|
|
8
9
|
};
|
|
9
|
-
export declare function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon,
|
|
10
|
+
export declare function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenterRight, expandableCenterLeft, }: UseRightLeftExpandingCenterChipArgs): {
|
|
10
11
|
isHovering: boolean;
|
|
11
12
|
handleMouseEnter: () => void;
|
|
12
13
|
handleMouseLeave: () => void;
|
|
@@ -21,11 +22,15 @@ export declare function useRightLeftExpandingCenterChip({ leftIcons, rightIcons,
|
|
|
21
22
|
rightChipRefs: import("react").MutableRefObject<(HTMLDivElement | null)[]>;
|
|
22
23
|
leftOffsets: number[];
|
|
23
24
|
rightOffsets: number[];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
expandableRightInnerRef: import("react").MutableRefObject<HTMLSpanElement | null>;
|
|
26
|
+
expandableLeftInnerRef: import("react").MutableRefObject<HTMLSpanElement | null>;
|
|
27
|
+
expandableRightWidth: number;
|
|
28
|
+
expandableLeftWidth: number;
|
|
29
|
+
expandedRightMV: import("framer-motion").MotionValue<number>;
|
|
30
|
+
expandedLeftMV: import("framer-motion").MotionValue<number>;
|
|
27
31
|
shiftX: import("framer-motion").MotionValue<number>;
|
|
28
32
|
rightShift: number;
|
|
33
|
+
leftShift: number;
|
|
29
34
|
leftHoverWidth: number;
|
|
30
35
|
rightHoverWidth: number;
|
|
31
36
|
};
|
|
@@ -2,19 +2,21 @@ import { useRef, useEffect, useState, useMemo, useCallback, useLayoutEffect } fr
|
|
|
2
2
|
import { animate, useMotionValue } from 'framer-motion';
|
|
3
3
|
import { CHIP_GAP } from './style';
|
|
4
4
|
export const DEFAULT_CHIP_MIN_WIDTH = 24;
|
|
5
|
-
export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon,
|
|
5
|
+
export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenterRight, expandableCenterLeft, }) {
|
|
6
6
|
const [isHovering, setIsHovering] = useState(false);
|
|
7
7
|
const [anchors, setAnchors] = useState({ left: 0, right: 0 });
|
|
8
8
|
const [leftWidths, setLeftWidths] = useState([]);
|
|
9
9
|
const [rightWidths, setRightWidths] = useState([]);
|
|
10
|
-
const [
|
|
10
|
+
const [expandableRightWidth, setExpandableRightWidth] = useState(0);
|
|
11
|
+
const [expandableLeftWidth, setExpandableLeftWidth] = useState(0);
|
|
11
12
|
const hoverTimeoutRef = useRef(null);
|
|
12
13
|
const centerWrapRef = useRef(null);
|
|
13
14
|
const centerContentRef = useRef(null);
|
|
14
15
|
const centerChipRef = useRef(null);
|
|
15
16
|
const leftChipRefs = useRef([]);
|
|
16
17
|
const rightChipRefs = useRef([]);
|
|
17
|
-
const
|
|
18
|
+
const expandableRightInnerRef = useRef(null);
|
|
19
|
+
const expandableLeftInnerRef = useRef(null);
|
|
18
20
|
const resizeRaf = useRef(null);
|
|
19
21
|
const arraysEqual = useCallback((a, b) => {
|
|
20
22
|
if (a === b)
|
|
@@ -29,7 +31,8 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
29
31
|
const anchorsEqual = useCallback((a, b) => {
|
|
30
32
|
return a.left === b.left && a.right === b.right;
|
|
31
33
|
}, []);
|
|
32
|
-
const
|
|
34
|
+
const expandedRightMV = useMotionValue(0);
|
|
35
|
+
const expandedLeftMV = useMotionValue(0);
|
|
33
36
|
const shiftX = useMotionValue(0);
|
|
34
37
|
const leftOffsets = useMemo(() => {
|
|
35
38
|
if (!leftWidths.length)
|
|
@@ -55,8 +58,9 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
55
58
|
}
|
|
56
59
|
return acc;
|
|
57
60
|
}, [rightWidths]);
|
|
58
|
-
const rightShift = isHovering &&
|
|
59
|
-
const
|
|
61
|
+
const rightShift = isHovering && expandableCenterRight ? expandableRightWidth : 0;
|
|
62
|
+
const leftShift = isHovering && expandableCenterLeft ? expandableLeftWidth : 0;
|
|
63
|
+
const maxRightShift = expandableCenterRight ? expandableRightWidth : 0;
|
|
60
64
|
const handleMouseEnter = useCallback(() => {
|
|
61
65
|
if (hoverTimeoutRef.current)
|
|
62
66
|
clearTimeout(hoverTimeoutRef.current);
|
|
@@ -68,7 +72,7 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
68
72
|
hoverTimeoutRef.current = setTimeout(() => setIsHovering(false), 120);
|
|
69
73
|
}, []);
|
|
70
74
|
const measureAll = useCallback(() => {
|
|
71
|
-
var _a, _b, _c;
|
|
75
|
+
var _a, _b, _c, _d, _e;
|
|
72
76
|
const wrap = centerWrapRef.current;
|
|
73
77
|
const chip = centerChipRef.current;
|
|
74
78
|
const content = centerContentRef.current;
|
|
@@ -84,16 +88,19 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
84
88
|
}
|
|
85
89
|
const nextLeftWidths = leftChipRefs.current.map((el) => (el ? el.offsetWidth : DEFAULT_CHIP_MIN_WIDTH));
|
|
86
90
|
const nextRightWidths = rightChipRefs.current.map((el) => (el ? el.offsetWidth : DEFAULT_CHIP_MIN_WIDTH));
|
|
87
|
-
const
|
|
91
|
+
const nextExpandableRightWidth = (_c = (_b = expandableRightInnerRef.current) === null || _b === void 0 ? void 0 : _b.scrollWidth) !== null && _c !== void 0 ? _c : 0;
|
|
92
|
+
const nextExpandableLeftWidth = (_e = (_d = expandableLeftInnerRef.current) === null || _d === void 0 ? void 0 : _d.scrollWidth) !== null && _e !== void 0 ? _e : 0;
|
|
88
93
|
if (!anchorsEqual(anchors, nextAnchors))
|
|
89
94
|
setAnchors(nextAnchors);
|
|
90
95
|
if (!arraysEqual(leftWidths, nextLeftWidths))
|
|
91
96
|
setLeftWidths(nextLeftWidths);
|
|
92
97
|
if (!arraysEqual(rightWidths, nextRightWidths))
|
|
93
98
|
setRightWidths(nextRightWidths);
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
if (expandableRightWidth !== nextExpandableRightWidth)
|
|
100
|
+
setExpandableRightWidth(nextExpandableRightWidth);
|
|
101
|
+
if (expandableLeftWidth !== nextExpandableLeftWidth)
|
|
102
|
+
setExpandableLeftWidth(nextExpandableLeftWidth);
|
|
103
|
+
}, [anchors, leftWidths, rightWidths, expandableRightWidth, expandableLeftWidth, anchorsEqual, arraysEqual]);
|
|
97
104
|
const onResize = useCallback(() => {
|
|
98
105
|
if (resizeRaf.current)
|
|
99
106
|
cancelAnimationFrame(resizeRaf.current);
|
|
@@ -109,7 +116,7 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
109
116
|
}, []);
|
|
110
117
|
useLayoutEffect(() => {
|
|
111
118
|
measureAll();
|
|
112
|
-
}, [centerIcon, leftIcons, rightIcons,
|
|
119
|
+
}, [centerIcon, leftIcons, rightIcons, expandableCenterRight, expandableCenterLeft, measureAll]);
|
|
113
120
|
useEffect(() => {
|
|
114
121
|
onResize();
|
|
115
122
|
window.addEventListener('resize', onResize);
|
|
@@ -120,19 +127,24 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
120
127
|
};
|
|
121
128
|
}, [onResize]);
|
|
122
129
|
useEffect(() => {
|
|
123
|
-
const target = isHovering &&
|
|
124
|
-
const controls = animate(
|
|
130
|
+
const target = isHovering && expandableCenterRight ? expandableRightWidth : 0;
|
|
131
|
+
const controls = animate(expandedRightMV, target, { duration: 0.2, ease: 'easeOut' });
|
|
125
132
|
return () => controls.stop();
|
|
126
|
-
}, [isHovering,
|
|
133
|
+
}, [isHovering, expandableCenterRight, expandableRightWidth, expandedRightMV]);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
const target = isHovering && expandableCenterLeft ? expandableLeftWidth : 0;
|
|
136
|
+
const controls = animate(expandedLeftMV, target, { duration: 0.2, ease: 'easeOut' });
|
|
137
|
+
return () => controls.stop();
|
|
138
|
+
}, [isHovering, expandableCenterLeft, expandableLeftWidth, expandedLeftMV]);
|
|
127
139
|
const leftHoverWidth = useMemo(() => {
|
|
128
140
|
var _a;
|
|
129
141
|
if (!leftOffsets.length)
|
|
130
142
|
return 0;
|
|
131
143
|
const last = leftOffsets.length - 1;
|
|
132
144
|
const lastWidth = (_a = leftWidths[last]) !== null && _a !== void 0 ? _a : DEFAULT_CHIP_MIN_WIDTH;
|
|
133
|
-
const farthest = leftOffsets[last] + lastWidth / 2;
|
|
145
|
+
const farthest = leftOffsets[last] + lastWidth / 2 + leftShift;
|
|
134
146
|
return farthest + CHIP_GAP;
|
|
135
|
-
}, [leftOffsets, leftWidths]);
|
|
147
|
+
}, [leftOffsets, leftWidths, leftShift]);
|
|
136
148
|
const rightHoverWidth = useMemo(() => {
|
|
137
149
|
var _a;
|
|
138
150
|
if (!rightOffsets.length)
|
|
@@ -154,11 +166,15 @@ export function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerI
|
|
|
154
166
|
rightChipRefs,
|
|
155
167
|
leftOffsets,
|
|
156
168
|
rightOffsets,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
169
|
+
expandableRightInnerRef,
|
|
170
|
+
expandableLeftInnerRef,
|
|
171
|
+
expandableRightWidth,
|
|
172
|
+
expandableLeftWidth,
|
|
173
|
+
expandedRightMV,
|
|
174
|
+
expandedLeftMV,
|
|
160
175
|
shiftX,
|
|
161
176
|
rightShift,
|
|
177
|
+
leftShift,
|
|
162
178
|
leftHoverWidth,
|
|
163
179
|
rightHoverWidth,
|
|
164
180
|
};
|
|
@@ -70,9 +70,9 @@ export declare const refundTableCellWidth: {
|
|
|
70
70
|
readonly sheet: "100px";
|
|
71
71
|
};
|
|
72
72
|
readonly merchant: {
|
|
73
|
-
readonly default: "
|
|
74
|
-
readonly text: "
|
|
75
|
-
readonly sheet: "
|
|
73
|
+
readonly default: "110px";
|
|
74
|
+
readonly text: "150px";
|
|
75
|
+
readonly sheet: "150px";
|
|
76
76
|
};
|
|
77
77
|
readonly reference: {
|
|
78
78
|
readonly default: "95px";
|
package/package.json
CHANGED
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
|
-
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"testVersion":
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "build/index.js",
|
|
8
|
-
"module": "build/index.js",
|
|
9
|
-
"types": "build/index.d.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./build/index.d.ts",
|
|
13
|
-
"import": "./build/index.js",
|
|
14
|
-
"require": "./build/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./constants": {
|
|
17
|
-
"types": "./build/constants/index.d.ts",
|
|
18
|
-
"import": "./build/constants/index.js",
|
|
19
|
-
"require": "./build/constants/index.js"
|
|
20
|
-
},
|
|
21
|
-
"./components": {
|
|
22
|
-
"types": "./build/components/index.d.ts",
|
|
23
|
-
"import": "./build/components/index.js",
|
|
24
|
-
"require": "./build/components/index.js"
|
|
25
|
-
},
|
|
26
|
-
"./components/*": {
|
|
27
|
-
"types": "./build/components/*/index.d.ts",
|
|
28
|
-
"import": "./build/components/*/index.js",
|
|
29
|
-
"require": "./build/components/*/index.js"
|
|
30
|
-
},
|
|
31
|
-
"./hooks": {
|
|
32
|
-
"types": "./build/hooks/index.d.ts",
|
|
33
|
-
"import": "./build/hooks/index.js",
|
|
34
|
-
"require": "./build/hooks/index.js"
|
|
35
|
-
},
|
|
36
|
-
"./utils": {
|
|
37
|
-
"types": "./build/utils/index.d.ts",
|
|
38
|
-
"import": "./build/utils/index.js",
|
|
39
|
-
"require": "./build/utils/index.js"
|
|
40
|
-
},
|
|
41
|
-
"./theme": {
|
|
42
|
-
"types": "./build/theme/index.d.ts",
|
|
43
|
-
"import": "./build/theme/index.js",
|
|
44
|
-
"require": "./build/theme/index.js"
|
|
45
|
-
},
|
|
46
|
-
"./types": {
|
|
47
|
-
"types": "./build/types/index.d.ts",
|
|
48
|
-
"import": "./build/types/index.js",
|
|
49
|
-
"require": "./build/types/index.js"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"license": "MIT",
|
|
53
|
-
"author": {
|
|
54
|
-
"name": "Ahmed Sharkawy",
|
|
55
|
-
"email": "a.elsharkawy@tap.company"
|
|
56
|
-
},
|
|
57
|
-
"files": [
|
|
58
|
-
"build",
|
|
59
|
-
"readme.md"
|
|
60
|
-
],
|
|
61
|
-
"scripts": {
|
|
62
|
-
"ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
|
|
63
|
-
"push:local": "yarn ts:build && yalc publish --push",
|
|
64
|
-
"push": "npm run ts:build && npm publish --access public",
|
|
65
|
-
"push:test": "node scripts/increment-test-version.cjs && npm run ts:build && npm publish --access public --tag test && node scripts/restore-version.cjs",
|
|
66
|
-
"dev": "vite",
|
|
67
|
-
"build": "tsc -b && vite build ",
|
|
68
|
-
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
|
|
69
|
-
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\"",
|
|
70
|
-
"lint": "eslint . --color",
|
|
71
|
-
"lint:fix": "eslint src --fix --color",
|
|
72
|
-
"preview": "vite preview",
|
|
73
|
-
"prepare": "husky"
|
|
74
|
-
},
|
|
75
|
-
"dependencies": {
|
|
76
|
-
"@emotion/react": "^11.11.0",
|
|
77
|
-
"@emotion/styled": "^11.11.0",
|
|
78
|
-
"@hookform/resolvers": "^3.3.1",
|
|
79
|
-
"@mui/material": "^5.12.3",
|
|
80
|
-
"@uiw/react-json-view": "^2.0.0-alpha.16",
|
|
81
|
-
"axios": "^1.4.0",
|
|
82
|
-
"dayjs": "^1.11.8",
|
|
83
|
-
"framer-motion": "10.11.0",
|
|
84
|
-
"i18next": "^22.4.15",
|
|
85
|
-
"memoize-one": "^6.0.0",
|
|
86
|
-
"re-resizable": "^6.9.9",
|
|
87
|
-
"react": "^18.2.0",
|
|
88
|
-
"react-currency-input-field": "^3.6.11",
|
|
89
|
-
"react-dom": "^18.2.0",
|
|
90
|
-
"react-draggable": "^4.4.6",
|
|
91
|
-
"react-dropzone": "^14.2.3",
|
|
92
|
-
"react-hook-form": "^7.45.4",
|
|
93
|
-
"react-hot-toast": "^2.4.1",
|
|
94
|
-
"react-i18next": "^12.2.2",
|
|
95
|
-
"react-multi-date-picker": "^4.1.2",
|
|
96
|
-
"react-router-dom": "^7.7.0",
|
|
97
|
-
"react-virtualized-auto-sizer": "^1.0.20",
|
|
98
|
-
"react-window": "^1.8.9",
|
|
99
|
-
"react-window-infinite-loader": "^1.0.9",
|
|
100
|
-
"react18-input-otp": "^1.1.4",
|
|
101
|
-
"recharts": "^2.15.1"
|
|
102
|
-
},
|
|
103
|
-
"devDependencies": {
|
|
104
|
-
"@eslint/js": "^9.17.0",
|
|
105
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
106
|
-
"@types/lodash": "^4.17.15",
|
|
107
|
-
"@types/react": "^18.2.6",
|
|
108
|
-
"@types/react-dom": "^18.3.5",
|
|
109
|
-
"@types/react-virtualized-auto-sizer": "^1.0.8",
|
|
110
|
-
"@types/react-window": "^1.8.5",
|
|
111
|
-
"@types/react-window-infinite-loader": "^1.0.6",
|
|
112
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
113
|
-
"eslint": "^9.17.0",
|
|
114
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
115
|
-
"eslint-plugin-react-refresh": "^0.4.16",
|
|
116
|
-
"globals": "^15.14.0",
|
|
117
|
-
"husky": "^8.0.3",
|
|
118
|
-
"lint-staged": "^13.2.2",
|
|
119
|
-
"prettier": "^2.8.8",
|
|
120
|
-
"tsc-alias": "^1.8.16",
|
|
121
|
-
"typescript": "5.0.2",
|
|
122
|
-
"typescript-eslint": "^8.18.2",
|
|
123
|
-
"vite": "6.0.5",
|
|
124
|
-
"vite-tsconfig-paths": "^4.2.0"
|
|
125
|
-
},
|
|
126
|
-
"lint-staged": {
|
|
127
|
-
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
128
|
-
"yarn run prettier:fix",
|
|
129
|
-
"yarn run lint"
|
|
130
|
-
]
|
|
131
|
-
},
|
|
132
|
-
"publishConfig": {
|
|
133
|
-
"registry": "https://registry.npmjs.org/"
|
|
134
|
-
}
|
|
135
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
|
+
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
+
"version": "0.1.64",
|
|
5
|
+
"testVersion": 0,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "build/index.js",
|
|
8
|
+
"module": "build/index.js",
|
|
9
|
+
"types": "build/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./build/index.d.ts",
|
|
13
|
+
"import": "./build/index.js",
|
|
14
|
+
"require": "./build/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./constants": {
|
|
17
|
+
"types": "./build/constants/index.d.ts",
|
|
18
|
+
"import": "./build/constants/index.js",
|
|
19
|
+
"require": "./build/constants/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./components": {
|
|
22
|
+
"types": "./build/components/index.d.ts",
|
|
23
|
+
"import": "./build/components/index.js",
|
|
24
|
+
"require": "./build/components/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./components/*": {
|
|
27
|
+
"types": "./build/components/*/index.d.ts",
|
|
28
|
+
"import": "./build/components/*/index.js",
|
|
29
|
+
"require": "./build/components/*/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./hooks": {
|
|
32
|
+
"types": "./build/hooks/index.d.ts",
|
|
33
|
+
"import": "./build/hooks/index.js",
|
|
34
|
+
"require": "./build/hooks/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./utils": {
|
|
37
|
+
"types": "./build/utils/index.d.ts",
|
|
38
|
+
"import": "./build/utils/index.js",
|
|
39
|
+
"require": "./build/utils/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./theme": {
|
|
42
|
+
"types": "./build/theme/index.d.ts",
|
|
43
|
+
"import": "./build/theme/index.js",
|
|
44
|
+
"require": "./build/theme/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./types": {
|
|
47
|
+
"types": "./build/types/index.d.ts",
|
|
48
|
+
"import": "./build/types/index.js",
|
|
49
|
+
"require": "./build/types/index.js"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"author": {
|
|
54
|
+
"name": "Ahmed Sharkawy",
|
|
55
|
+
"email": "a.elsharkawy@tap.company"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"build",
|
|
59
|
+
"readme.md"
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
|
|
63
|
+
"push:local": "yarn ts:build && yalc publish --push",
|
|
64
|
+
"push": "npm run ts:build && npm publish --access public",
|
|
65
|
+
"push:test": "node scripts/increment-test-version.cjs && npm run ts:build && npm publish --access public --tag test && node scripts/restore-version.cjs",
|
|
66
|
+
"dev": "vite",
|
|
67
|
+
"build": "tsc -b && vite build ",
|
|
68
|
+
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
|
|
69
|
+
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\"",
|
|
70
|
+
"lint": "eslint . --color",
|
|
71
|
+
"lint:fix": "eslint src --fix --color",
|
|
72
|
+
"preview": "vite preview",
|
|
73
|
+
"prepare": "husky"
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"@emotion/react": "^11.11.0",
|
|
77
|
+
"@emotion/styled": "^11.11.0",
|
|
78
|
+
"@hookform/resolvers": "^3.3.1",
|
|
79
|
+
"@mui/material": "^5.12.3",
|
|
80
|
+
"@uiw/react-json-view": "^2.0.0-alpha.16",
|
|
81
|
+
"axios": "^1.4.0",
|
|
82
|
+
"dayjs": "^1.11.8",
|
|
83
|
+
"framer-motion": "10.11.0",
|
|
84
|
+
"i18next": "^22.4.15",
|
|
85
|
+
"memoize-one": "^6.0.0",
|
|
86
|
+
"re-resizable": "^6.9.9",
|
|
87
|
+
"react": "^18.2.0",
|
|
88
|
+
"react-currency-input-field": "^3.6.11",
|
|
89
|
+
"react-dom": "^18.2.0",
|
|
90
|
+
"react-draggable": "^4.4.6",
|
|
91
|
+
"react-dropzone": "^14.2.3",
|
|
92
|
+
"react-hook-form": "^7.45.4",
|
|
93
|
+
"react-hot-toast": "^2.4.1",
|
|
94
|
+
"react-i18next": "^12.2.2",
|
|
95
|
+
"react-multi-date-picker": "^4.1.2",
|
|
96
|
+
"react-router-dom": "^7.7.0",
|
|
97
|
+
"react-virtualized-auto-sizer": "^1.0.20",
|
|
98
|
+
"react-window": "^1.8.9",
|
|
99
|
+
"react-window-infinite-loader": "^1.0.9",
|
|
100
|
+
"react18-input-otp": "^1.1.4",
|
|
101
|
+
"recharts": "^2.15.1"
|
|
102
|
+
},
|
|
103
|
+
"devDependencies": {
|
|
104
|
+
"@eslint/js": "^9.17.0",
|
|
105
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
106
|
+
"@types/lodash": "^4.17.15",
|
|
107
|
+
"@types/react": "^18.2.6",
|
|
108
|
+
"@types/react-dom": "^18.3.5",
|
|
109
|
+
"@types/react-virtualized-auto-sizer": "^1.0.8",
|
|
110
|
+
"@types/react-window": "^1.8.5",
|
|
111
|
+
"@types/react-window-infinite-loader": "^1.0.6",
|
|
112
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
113
|
+
"eslint": "^9.17.0",
|
|
114
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
115
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
116
|
+
"globals": "^15.14.0",
|
|
117
|
+
"husky": "^8.0.3",
|
|
118
|
+
"lint-staged": "^13.2.2",
|
|
119
|
+
"prettier": "^2.8.8",
|
|
120
|
+
"tsc-alias": "^1.8.16",
|
|
121
|
+
"typescript": "5.0.2",
|
|
122
|
+
"typescript-eslint": "^8.18.2",
|
|
123
|
+
"vite": "6.0.5",
|
|
124
|
+
"vite-tsconfig-paths": "^4.2.0"
|
|
125
|
+
},
|
|
126
|
+
"lint-staged": {
|
|
127
|
+
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
128
|
+
"yarn run prettier:fix",
|
|
129
|
+
"yarn run lint"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"publishConfig": {
|
|
133
|
+
"registry": "https://registry.npmjs.org/"
|
|
134
|
+
}
|
|
135
|
+
}
|