@tap-payments/os-micro-frontend-shared 0.1.63-test.3 → 0.1.64-test.1

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 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, expandableCenter, expandedZIndex, ...props }: Readonly<RightLeftExpandingCenterChipProps>): import("react/jsx-runtime").JSX.Element;
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, expandableCenter, expandedZIndex = 1000 } = _a, props = __rest(_a, ["leftIcons", "rightIcons", "centerIcon", "expandableCenter", "expandedZIndex"]);
19
- const { isHovering, handleMouseEnter, handleMouseLeave, centerWrapRef, centerContentRef, centerChipRef, anchors, leftChipRefs, rightChipRefs, leftOffsets, rightOffsets, expandableInnerRef, expandedMV, shiftX, rightShift, leftHoverWidth, rightHoverWidth, } = useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenter });
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: expandableCenter && isHovering ? '12px 0 0 12px' : '12px',
22
- borderRight: expandableCenter && isHovering ? 'none' : undefined,
23
- paddingInlineEnd: '2px',
24
- } }, { children: _jsx(CenterContent, Object.assign({ "data-testid": "CenterContent", ref: centerContentRef }, { children: centerIcon })) })), _jsx(AnimatePresence, Object.assign({ initial: false }, { children: expandableCenter && (_jsx(ExpandableContainer, Object.assign({ "data-testid": "ExpandableContainer", style: {
25
- width: expandedMV,
26
- position: 'absolute',
27
- left: 'calc(100% - 1px)',
28
- top: 0,
29
- height: '24px',
30
- zIndex: 1,
31
- opacity: isHovering ? 1 : 0,
32
- pointerEvents: isHovering ? 'auto' : 'none',
33
- }, initial: false, transition: { duration: 0.2, ease: 'easeOut' } }, { children: _jsx(ExpandableInner, Object.assign({ "data-testid": "ExpandableInner", ref: expandableInnerRef }, { children: expandableCenter })) }))) })), _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: {
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
- return (_jsx(LeftExpandIcon, Object.assign({ "data-testid": `LeftExpandIcon-${index}`, initial: { opacity: 0, x: 0 }, animate: isHovering ? { opacity: 1, x: -leftOffset } : { 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}`));
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
- expandableCenter?: React.ReactNode;
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
- expandableCenter?: ReactNode;
7
+ expandableCenterRight?: ReactNode;
8
+ expandableCenterLeft?: ReactNode;
8
9
  };
9
- export declare function useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenter }: UseRightLeftExpandingCenterChipArgs): {
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
- expandableInnerRef: import("react").MutableRefObject<HTMLSpanElement | null>;
25
- expandableWidth: number;
26
- expandedMV: import("framer-motion").MotionValue<number>;
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, expandableCenter }) {
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 [expandableWidth, setExpandableWidth] = useState(0);
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 expandableInnerRef = useRef(null);
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 expandedMV = useMotionValue(0);
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 && expandableCenter ? expandableWidth + CHIP_GAP : 0;
59
- const maxRightShift = expandableCenter ? expandableWidth + CHIP_GAP : 0;
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 nextExpandableWidth = (_c = (_b = expandableInnerRef.current) === null || _b === void 0 ? void 0 : _b.scrollWidth) !== null && _c !== void 0 ? _c : 0;
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 (expandableWidth !== nextExpandableWidth)
95
- setExpandableWidth(nextExpandableWidth);
96
- }, [anchors, leftWidths, rightWidths, expandableWidth, anchorsEqual, arraysEqual]);
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, expandableCenter, measureAll]);
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 && expandableCenter ? expandableWidth + CHIP_GAP : 0;
124
- const controls = animate(expandedMV, target, { duration: 0.2, ease: 'easeOut' });
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, expandableCenter, expandableWidth, expandedMV]);
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
- expandableInnerRef,
158
- expandableWidth,
159
- expandedMV,
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
  };
@@ -1,43 +1,26 @@
1
- import { useRef, useCallback, useEffect } from 'react';
1
+ import { useRef, useCallback } from 'react';
2
2
  export const useSynchronizedScroll = () => {
3
3
  const pinnedStartVirtualListRef = useRef(null);
4
4
  const scrollableVirtualListRef = useRef(null);
5
5
  const pinnedEndVirtualListRef = useRef(null);
6
6
  const isScrollingSyncRef = useRef(false);
7
- const lastScrollOffsetRef = useRef(0);
8
- const syncTimeoutRef = useRef(null);
9
- const clearSyncTimeout = useCallback(() => {
10
- if (syncTimeoutRef.current) {
11
- clearTimeout(syncTimeoutRef.current);
12
- syncTimeoutRef.current = null;
13
- }
14
- }, []);
15
- useEffect(() => {
16
- return () => {
17
- clearSyncTimeout();
18
- };
19
- }, [clearSyncTimeout]);
20
7
  const handleScroll = useCallback(({ scrollOffset }, source) => {
21
8
  if (isScrollingSyncRef.current)
22
9
  return;
23
- clearSyncTimeout();
24
- lastScrollOffsetRef.current = scrollOffset;
25
10
  isScrollingSyncRef.current = true;
26
- syncTimeoutRef.current = setTimeout(() => {
27
- if (source !== 'start' && pinnedStartVirtualListRef.current) {
28
- pinnedStartVirtualListRef.current.scrollTo(scrollOffset);
29
- }
30
- if (source !== 'end' && pinnedEndVirtualListRef.current) {
31
- pinnedEndVirtualListRef.current.scrollTo(scrollOffset);
32
- }
33
- if (source !== 'scrollable' && scrollableVirtualListRef.current) {
34
- scrollableVirtualListRef.current.scrollTo(scrollOffset);
35
- }
36
- requestAnimationFrame(() => {
37
- isScrollingSyncRef.current = false;
38
- });
39
- }, 0);
40
- }, [clearSyncTimeout]);
11
+ if (source !== 'start' && pinnedStartVirtualListRef.current) {
12
+ pinnedStartVirtualListRef.current.scrollTo(scrollOffset);
13
+ }
14
+ if (source !== 'end' && pinnedEndVirtualListRef.current) {
15
+ pinnedEndVirtualListRef.current.scrollTo(scrollOffset);
16
+ }
17
+ if (source !== 'scrollable' && scrollableVirtualListRef.current) {
18
+ scrollableVirtualListRef.current.scrollTo(scrollOffset);
19
+ }
20
+ requestAnimationFrame(() => {
21
+ isScrollingSyncRef.current = false;
22
+ });
23
+ }, []);
41
24
  return {
42
25
  pinnedStartVirtualListRef,
43
26
  scrollableVirtualListRef,
@@ -25,16 +25,13 @@ const VirtualScrollList = React.forwardRef((_a, ref) => {
25
25
  const renderedScrollTopRef = useRef(0);
26
26
  const scrollTopRef = useRef(undefined);
27
27
  const scrollLocked = useRef(false);
28
- const isExternalScroll = useRef(false);
29
28
  const internalListRef = useRef(null);
30
29
  const listRef = ref || externalListRef || internalListRef;
31
30
  const scrollTo = useCallback(() => {
32
31
  var _a, _b;
33
32
  clearTimer();
34
33
  if (scrollTopRef.current !== undefined && listRef.current) {
35
- if (!isExternalScroll.current) {
36
- scrollLocked.current = false;
37
- }
34
+ scrollLocked.current = false;
38
35
  renderedScrollTopRef.current = scrollTopRef.current;
39
36
  scrollTopRef.current = undefined;
40
37
  handleBackDropVisibility();
@@ -48,7 +45,6 @@ const VirtualScrollList = React.forwardRef((_a, ref) => {
48
45
  scrollTopRef.current = event.currentTarget.scrollTop;
49
46
  if (!scrollLocked.current) {
50
47
  scrollLocked.current = true;
51
- isExternalScroll.current = false;
52
48
  scrollTo();
53
49
  }
54
50
  }, [scrollTo]);
@@ -61,22 +57,7 @@ const VirtualScrollList = React.forwardRef((_a, ref) => {
61
57
  const itemDataInternal = React.useMemo(() => (Object.assign(Object.assign({}, itemData), { renderedScrollTopRef })), [itemData]);
62
58
  const handleOnScroll = React.useCallback((props) => {
63
59
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(props);
64
- const isExternal = onScroll !== undefined;
65
- if (isExternal) {
66
- isExternalScroll.current = true;
67
- }
68
- requestAnimationFrame(() => {
69
- if (!isExternalScroll.current || scrollTopRef.current !== undefined) {
70
- if (scrollTo()) {
71
- if (isExternal) {
72
- setTimeout(() => {
73
- isExternalScroll.current = false;
74
- scrollLocked.current = false;
75
- }, 16);
76
- }
77
- }
78
- }
79
- });
60
+ scrollLocked.current = scrollTo();
80
61
  }, [scrollTo, onScroll]);
81
62
  return (_jsx(VirtualScrollOuterProvider, Object.assign({ value: handleScroll }, { children: _jsx(VariableSizeList, Object.assign({ ref: listRef, "data-testid": "VirtualScrollList", itemData: itemDataInternal, outerElementType: VirtualScrollOuter, innerElementType: VirtualScrollInner }, restProps, { onScroll: handleOnScroll }, { children: children })) })));
82
63
  });
@@ -5,19 +5,19 @@ export declare const merchantsTableCellWidth: {
5
5
  readonly sheet: "225px";
6
6
  };
7
7
  readonly entity: {
8
- readonly default: "150px";
8
+ readonly default: "146px";
9
9
  readonly text: "180px";
10
10
  readonly sheet: "180px";
11
11
  };
12
12
  readonly created: {
13
- readonly default: "170px";
13
+ readonly default: "160px";
14
14
  readonly text: "170px";
15
15
  readonly sheet: "170px";
16
16
  };
17
17
  readonly brands: {
18
- readonly default: "116px";
19
- readonly text: "120px";
20
- readonly sheet: "120px";
18
+ readonly default: "140px";
19
+ readonly text: "140px";
20
+ readonly sheet: "140px";
21
21
  };
22
22
  readonly marketplace: {
23
23
  readonly default: "110px";
@@ -25,9 +25,9 @@ export declare const merchantsTableCellWidth: {
25
25
  readonly sheet: "110px";
26
26
  };
27
27
  readonly individuals: {
28
- readonly default: "116px";
29
- readonly text: "120px";
30
- readonly sheet: "120px";
28
+ readonly default: "185px";
29
+ readonly text: "185px";
30
+ readonly sheet: "185px";
31
31
  };
32
32
  readonly segments: {
33
33
  readonly default: "70px";
@@ -35,17 +35,17 @@ export declare const merchantsTableCellWidth: {
35
35
  readonly sheet: "180px";
36
36
  };
37
37
  readonly psp: {
38
- readonly default: "60px";
38
+ readonly default: "70px";
39
39
  readonly text: "180px";
40
40
  readonly sheet: "180px";
41
41
  };
42
42
  readonly status: {
43
- readonly default: "80px";
43
+ readonly default: "64px";
44
44
  readonly text: "100px";
45
45
  readonly sheet: "100px";
46
46
  };
47
47
  readonly partners: {
48
- readonly default: "75px";
48
+ readonly default: "88px";
49
49
  readonly text: "100px";
50
50
  readonly sheet: "100px";
51
51
  };
@@ -69,4 +69,9 @@ export declare const merchantsTableCellWidth: {
69
69
  readonly text: "120px";
70
70
  readonly sheet: "120px";
71
71
  };
72
+ readonly merchant: {
73
+ readonly default: "175px";
74
+ readonly text: "180px";
75
+ readonly sheet: "180px";
76
+ };
72
77
  };
@@ -5,19 +5,19 @@ export const merchantsTableCellWidth = {
5
5
  sheet: '225px',
6
6
  },
7
7
  entity: {
8
- default: '150px',
8
+ default: '146px',
9
9
  text: '180px',
10
10
  sheet: '180px',
11
11
  },
12
12
  created: {
13
- default: '170px',
13
+ default: '160px',
14
14
  text: '170px',
15
15
  sheet: '170px',
16
16
  },
17
17
  brands: {
18
- default: '116px',
19
- text: '120px',
20
- sheet: '120px',
18
+ default: '140px',
19
+ text: '140px',
20
+ sheet: '140px',
21
21
  },
22
22
  marketplace: {
23
23
  default: '110px',
@@ -25,9 +25,9 @@ export const merchantsTableCellWidth = {
25
25
  sheet: '110px',
26
26
  },
27
27
  individuals: {
28
- default: '116px',
29
- text: '120px',
30
- sheet: '120px',
28
+ default: '185px',
29
+ text: '185px',
30
+ sheet: '185px',
31
31
  },
32
32
  segments: {
33
33
  default: '70px',
@@ -35,17 +35,17 @@ export const merchantsTableCellWidth = {
35
35
  sheet: '180px',
36
36
  },
37
37
  psp: {
38
- default: '60px',
38
+ default: '70px',
39
39
  text: '180px',
40
40
  sheet: '180px',
41
41
  },
42
42
  status: {
43
- default: '80px',
43
+ default: '64px',
44
44
  text: '100px',
45
45
  sheet: '100px',
46
46
  },
47
47
  partners: {
48
- default: '75px',
48
+ default: '88px',
49
49
  text: '100px',
50
50
  sheet: '100px',
51
51
  },
@@ -69,4 +69,9 @@ export const merchantsTableCellWidth = {
69
69
  text: '120px',
70
70
  sheet: '120px',
71
71
  },
72
+ merchant: {
73
+ default: '175px',
74
+ text: '180px',
75
+ sheet: '180px',
76
+ },
72
77
  };
@@ -70,9 +70,9 @@ export declare const refundTableCellWidth: {
70
70
  readonly sheet: "100px";
71
71
  };
72
72
  readonly merchant: {
73
- readonly default: "100px";
74
- readonly text: "100px";
75
- readonly sheet: "100px";
73
+ readonly default: "110px";
74
+ readonly text: "150px";
75
+ readonly sheet: "150px";
76
76
  };
77
77
  readonly reference: {
78
78
  readonly default: "95px";
@@ -70,9 +70,9 @@ export const refundTableCellWidth = {
70
70
  sheet: '100px',
71
71
  },
72
72
  merchant: {
73
- default: '100px',
74
- text: '100px',
75
- sheet: '100px',
73
+ default: '110px',
74
+ text: '150px',
75
+ sheet: '150px',
76
76
  },
77
77
  reference: {
78
78
  default: '95px',
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.63-test.3",
5
- "testVersion": 3,
4
+ "version": "0.1.64-test.1",
5
+ "testVersion": 1,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",