@tap-payments/os-micro-frontend-shared 0.1.96-test.24 → 0.1.96-test.25
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/build/components/AmountInput/AmountInput.d.ts +14 -0
- package/build/components/AmountInput/AmountInput.js +43 -0
- package/build/components/AmountInput/index.d.ts +2 -0
- package/build/components/AmountInput/index.js +2 -0
- package/build/components/AmountInput/style.d.ts +8 -0
- package/build/components/AmountInput/style.js +30 -0
- package/build/components/AppServices/AppServices.js +2 -0
- 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/DisplayAmount/DisplayAmount.d.ts +10 -0
- package/build/components/DisplayAmount/DisplayAmount.js +22 -0
- package/build/components/DisplayAmount/index.d.ts +2 -0
- package/build/components/DisplayAmount/index.js +2 -0
- package/build/components/DisplayAmount/style.d.ts +5 -0
- package/build/components/DisplayAmount/style.js +14 -0
- package/build/components/Dropdown2/style.js +2 -0
- package/build/components/ErrorToast/ErrorToast.d.ts +3 -0
- package/build/components/ErrorToast/ErrorToast.js +7 -0
- package/build/components/ErrorToast/index.d.ts +2 -0
- package/build/components/ErrorToast/index.js +2 -0
- package/build/components/ErrorToast/style.d.ts +9 -0
- package/build/components/ErrorToast/style.js +33 -0
- package/build/components/ErrorToast/type.d.ts +10 -0
- package/build/components/ErrorToast/type.js +1 -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/CountriesList.js +1 -1
- 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/LanguageDropdown/LanguageDropdown.d.ts +6 -0
- package/build/components/LanguageDropdown/LanguageDropdown.js +24 -0
- package/build/components/LanguageDropdown/index.d.ts +2 -0
- package/build/components/LanguageDropdown/index.js +2 -0
- package/build/components/LanguageDropdown/style.d.ts +6 -0
- package/build/components/LanguageDropdown/style.js +5 -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/MFWidgetLoader/MFWidgetLoader.js +3 -3
- 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/RangeCalender/style.js +1 -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/SearchListInput/SearchListInput.d.ts +10 -0
- package/build/components/SearchListInput/SearchListInput.js +20 -0
- package/build/components/SearchListInput/index.d.ts +2 -0
- package/build/components/SearchListInput/index.js +2 -0
- package/build/components/SearchListInput/style.d.ts +7 -0
- package/build/components/SearchListInput/style.js +15 -0
- 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/BankCell/BankCell.js +2 -2
- package/build/components/TableCells/CustomCells/BrandCell/BrandCell.js +1 -0
- package/build/components/TableCells/CustomCells/DateCell/DateCell.js +2 -2
- package/build/components/TableCells/CustomCells/EntityCell/EntityCell.js +4 -3
- package/build/components/TableCells/CustomCells/EntityCell/style.d.ts +0 -3
- package/build/components/TableCells/CustomCells/EntityCell/style.js +2 -22
- 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/SalesChannelCell/SalesChannelCell.js +4 -3
- package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +2 -1
- package/build/components/TableCells/CustomCells/SalesChannelCell/style.js +5 -6
- 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/TableCells/CustomCells/WalletCell/WalletCell.js +3 -3
- 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/ToggleView/index.d.ts +1 -1
- package/build/components/ToggleView/index.js +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +11 -1
- 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/usePinnedColumns.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableData.js +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +3 -2
- 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 +5 -0
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +2 -0
- 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 +10 -6
- package/build/components/index.js +10 -6
- package/build/constants/assets.d.ts +2 -0
- package/build/constants/assets.js +6 -0
- package/build/constants/server.js +1 -0
- package/build/constants/table/cell/authorizationTableCellWidth.d.ts +6 -6
- package/build/constants/table/cell/authorizationTableCellWidth.js +6 -6
- package/build/constants/table/cell/chargeTableCellWidth.d.ts +6 -6
- package/build/constants/table/cell/chargeTableCellWidth.js +6 -6
- package/build/constants/table/cell/destinationsTableCellWidth.d.ts +5 -5
- package/build/constants/table/cell/destinationsTableCellWidth.js +5 -5
- package/build/constants/table/cell/refundTableCellWidth.d.ts +7 -7
- package/build/constants/table/cell/refundTableCellWidth.js +7 -7
- package/build/constants/table/cell/terminalsTableCellWidth.d.ts +3 -3
- package/build/constants/table/cell/terminalsTableCellWidth.js +3 -3
- package/build/hooks/useCountdown.js +4 -0
- package/build/hooks/useStickyHeaderShadow.js +6 -0
- package/build/types/entity.d.ts +5 -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.d.ts +1 -1
- package/build/utils/country.js +2 -1
- 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.d.ts +2 -0
- package/build/utils/number.js +8 -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 +11 -0
- package/build/utils/style.js +28 -0
- package/build/utils/table.js +1 -1
- package/build/utils/url.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
5
|
+
import { Menu, MenuItem } from '../index.js';
|
|
6
|
+
import { Button } from './style';
|
|
7
|
+
const languages = ['EN', 'AR'];
|
|
8
|
+
export default function LanguageDropdown({ defaultLanguage = 'EN', onChange }) {
|
|
9
|
+
const [language, setLanguage] = useState(defaultLanguage);
|
|
10
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
11
|
+
const open = Boolean(anchorEl);
|
|
12
|
+
const onOpen = (event) => {
|
|
13
|
+
setAnchorEl(event.currentTarget);
|
|
14
|
+
};
|
|
15
|
+
const onCLose = () => {
|
|
16
|
+
setAnchorEl(null);
|
|
17
|
+
};
|
|
18
|
+
const onClick = (lang) => {
|
|
19
|
+
setLanguage(lang);
|
|
20
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(lang);
|
|
21
|
+
onCLose();
|
|
22
|
+
};
|
|
23
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onCLose }, { children: _jsxs(Box, { children: [_jsx(Button, Object.assign({ onClick: onOpen, open: open }, { children: _jsx(Box, Object.assign({ component: "span" }, { children: language })) })), _jsx(Menu, Object.assign({ open: open, anchorEl: anchorEl, sx: { marginTop: '8px', marginBottom: '8px', width: 31.8 } }, { children: languages.map((lang) => lang !== language && (_jsx(MenuItem, Object.assign({ onClick: () => onClick(lang) }, { children: lang }), lang))) }))] }) })));
|
|
24
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Button: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
5
|
+
open?: boolean | undefined;
|
|
6
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
export const Button = styled(Box, { shouldForwardProp: (props) => props !== 'open' })(({ theme, open }) => (Object.assign({ backgroundColor: theme.palette.common.white, border: `1px solid ${theme.palette.divider}`, fontSize: '11px', color: theme.palette.text.primary, padding: '8px', borderRadius: '4px', display: 'flex', alignItems: 'center', height: 32, gap: '4px' }, (open && {
|
|
4
|
+
borderColor: theme.palette.info.dark,
|
|
5
|
+
}))));
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { type LeftPeekRightExpandingChipProps } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* LeftPeekRightExpandingChip
|
|
4
|
+
*
|
|
5
|
+
* Renders the last item of `icons` in a main chip and the remaining items as a vertical,
|
|
6
|
+
* left‑aligned peek stack (collapsed to 24px). Hovering the main chip reveals and expands
|
|
7
|
+
* the peek chips to the right and shifts the main chip accordingly. The top‑most peek chip
|
|
8
|
+
* stays anchored while the rest slide out to the right preserving the original order.
|
|
9
|
+
* Uses Framer Motion for smooth enter/leave and x‑translation, with z-index control via `expandedZIndex`.
|
|
10
|
+
* Peek chip content is rendered only on hover to minimize layout work.
|
|
11
|
+
*/
|
|
2
12
|
export default function LeftPeekRightExpandingChip({ icons, expandedZIndex, sx }: LeftPeekRightExpandingChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,15 +3,28 @@ import Box from '@mui/material/Box';
|
|
|
3
3
|
import { AnimatePresence } from 'framer-motion';
|
|
4
4
|
import { Root, Container, PeekStack, PeekChip, MainChip, tableCellSx } from './style';
|
|
5
5
|
import { useLeftPeekRightExpandingChip } from './useLeftPeekRightExpandingChip';
|
|
6
|
+
/**
|
|
7
|
+
* LeftPeekRightExpandingChip
|
|
8
|
+
*
|
|
9
|
+
* Renders the last item of `icons` in a main chip and the remaining items as a vertical,
|
|
10
|
+
* left‑aligned peek stack (collapsed to 24px). Hovering the main chip reveals and expands
|
|
11
|
+
* the peek chips to the right and shifts the main chip accordingly. The top‑most peek chip
|
|
12
|
+
* stays anchored while the rest slide out to the right preserving the original order.
|
|
13
|
+
* Uses Framer Motion for smooth enter/leave and x‑translation, with z-index control via `expandedZIndex`.
|
|
14
|
+
* Peek chip content is rendered only on hover to minimize layout work.
|
|
15
|
+
*/
|
|
6
16
|
export default function LeftPeekRightExpandingChip({ icons = [], expandedZIndex = 1000, sx }) {
|
|
7
17
|
const { handleMouseEnter, handleRootMouseLeave, rootRef, mainChipRef, isHovering, peekItems, mainShiftX, mainIcon } = useLeftPeekRightExpandingChip({ icons });
|
|
8
|
-
return (_jsx(Box, Object.assign({ sx: Object.assign(Object.assign({}, tableCellSx), sx), "data-testid": "LeftPeekRightExpandingChipBox" }, { children: _jsx(Root, Object.assign({ ref: rootRef, onMouseLeave: handleRootMouseLeave, onMouseEnter: handleMouseEnter }, { children: _jsxs(Container, Object.assign({ "data-testid": "Container", initial: false }, { children: [_jsx(PeekStack, Object.assign({ "data-testid": "PeekStack",
|
|
18
|
+
return (_jsx(Box, Object.assign({ sx: Object.assign(Object.assign({}, tableCellSx), sx), "data-testid": "LeftPeekRightExpandingChipBox" }, { children: _jsx(Root, Object.assign({ ref: rootRef, onMouseLeave: handleRootMouseLeave, onMouseEnter: handleMouseEnter }, { children: _jsxs(Container, Object.assign({ "data-testid": "Container", initial: false }, { children: [_jsx(PeekStack, Object.assign({ "data-testid": "PeekStack",
|
|
19
|
+
// Allow the expanded chips area to keep hover active
|
|
20
|
+
onMouseEnter: handleMouseEnter, onMouseLeave: handleRootMouseLeave, style: { pointerEvents: isHovering ? 'auto' : 'none' } }, { children: _jsx(AnimatePresence, Object.assign({ initial: false }, { children: peekItems.map(({ key, rIdx, offX, hoverX, zIndex, refCb, content }) => (_jsx(PeekChip, Object.assign({ "data-testid": `LeftPeekChip-${rIdx}`, ref: refCb, initial: { opacity: 0, scale: 0.95, x: offX, y: 0 }, animate: { opacity: 1, scale: 1, x: isHovering ? hoverX : offX, y: 0 }, exit: { opacity: 0, scale: 0.95, x: offX, y: 0 }, transition: { duration: 0.18, ease: 'easeOut' }, style: {
|
|
9
21
|
zIndex,
|
|
10
22
|
width: isHovering ? 'auto' : 24,
|
|
11
23
|
minWidth: 24,
|
|
12
24
|
padding: isHovering ? '0 6px' : 0,
|
|
13
25
|
whiteSpace: 'nowrap',
|
|
14
26
|
overflow: isHovering ? 'visible' : 'hidden',
|
|
27
|
+
// Make the expanded chip area interactive to preserve hover
|
|
15
28
|
pointerEvents: isHovering ? 'auto' : 'none',
|
|
16
29
|
} }, { children: isHovering && _jsx(_Fragment, { children: content }) }), key))) })) })), _jsx(MainChip, Object.assign({ "data-testid": "MainChip", ref: mainChipRef, style: { zIndex: expandedZIndex + 10, padding: '0 6px' }, initial: false, animate: { x: isHovering ? mainShiftX : 0 }, transition: { duration: 0.18, ease: 'easeOut' } }, { children: mainIcon }))] })) })) })));
|
|
17
30
|
}
|
|
@@ -24,6 +24,7 @@ export const PeekStack = styled('div')(() => ({
|
|
|
24
24
|
export const PeekChip = styled(motion.div)(({ theme }) => ({
|
|
25
25
|
border: `1px solid ${theme.palette.divider}`,
|
|
26
26
|
borderRadius: 12,
|
|
27
|
+
// width controlled in component to switch between 24 and auto
|
|
27
28
|
height: 24,
|
|
28
29
|
display: 'flex',
|
|
29
30
|
alignItems: 'center',
|
|
@@ -2,19 +2,30 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
2
2
|
import { CHIP_GAP, DEFAULT_CHIP_MIN_WIDTH } from './style';
|
|
3
3
|
export function useLeftPeekRightExpandingChip({ icons }) {
|
|
4
4
|
var _a;
|
|
5
|
+
// ======================
|
|
6
|
+
// State
|
|
7
|
+
// ======================
|
|
5
8
|
const [isHovering, setIsHovering] = useState(false);
|
|
6
9
|
const [rightWidths, setRightWidths] = useState([]);
|
|
10
|
+
// ======================
|
|
11
|
+
// Refs (DOM and timers)
|
|
12
|
+
// ======================
|
|
7
13
|
const rootRef = useRef(null);
|
|
8
14
|
const mainChipRef = useRef(null);
|
|
9
15
|
const rightChipRefs = useRef([]);
|
|
10
16
|
const hoverTimeoutRef = useRef(null);
|
|
17
|
+
// Prepare icons: last is MainChip, the rest are peeks
|
|
11
18
|
const safeIcons = icons !== null && icons !== void 0 ? icons : [];
|
|
12
19
|
const lastIndex = Math.max(0, ((_a = safeIcons.length) !== null && _a !== void 0 ? _a : 1) - 1);
|
|
13
20
|
const mainIcon = safeIcons[lastIndex];
|
|
14
21
|
const peekIcons = safeIcons.slice(0, lastIndex);
|
|
22
|
+
// ======================
|
|
23
|
+
// Computed values
|
|
24
|
+
// ======================
|
|
15
25
|
const { peekItems, mainShiftX, guardLeft, guardWidth } = useMemo(() => {
|
|
16
26
|
const n = peekIcons.length;
|
|
17
27
|
const measured = rightWidths.length === n && rightWidths.every((w) => w > 0);
|
|
28
|
+
// Anchor stacked offset for all peeks
|
|
18
29
|
const anchorOffXAll = -6 * n;
|
|
19
30
|
const totalPeekWidth = measured ? rightWidths.reduce((acc, w) => acc + w, 0) : n * DEFAULT_CHIP_MIN_WIDTH;
|
|
20
31
|
const gapsTotal = Math.max(0, n - 1) * CHIP_GAP;
|
|
@@ -42,10 +53,14 @@ export function useLeftPeekRightExpandingChip({ icons }) {
|
|
|
42
53
|
content: peekIcons[origIdx],
|
|
43
54
|
});
|
|
44
55
|
}
|
|
56
|
+
// Guard box covers the full horizontal span of the expanded peeks
|
|
45
57
|
const guardLeft = anchorOffXEach;
|
|
46
58
|
const guardWidth = totalPeekWidth + gapsTotal;
|
|
47
59
|
return { peekItems: items, mainShiftX: mainShift, guardLeft, guardWidth };
|
|
48
60
|
}, [peekIcons, rightWidths, isHovering]);
|
|
61
|
+
// ======================
|
|
62
|
+
// Callbacks
|
|
63
|
+
// ======================
|
|
49
64
|
const clearHoverTimeout = useCallback(() => {
|
|
50
65
|
if (hoverTimeoutRef.current) {
|
|
51
66
|
clearTimeout(hoverTimeoutRef.current);
|
|
@@ -53,8 +68,8 @@ export function useLeftPeekRightExpandingChip({ icons }) {
|
|
|
53
68
|
}
|
|
54
69
|
}, []);
|
|
55
70
|
const measureRightWidths = useCallback(() => {
|
|
56
|
-
const TARGET_PADDING_X = 12;
|
|
57
|
-
const BORDER_X = 2;
|
|
71
|
+
const TARGET_PADDING_X = 12; /* 6px each side when expanded */
|
|
72
|
+
const BORDER_X = 2; /* 1px each side */
|
|
58
73
|
const next = peekIcons.map((_, origIdx) => {
|
|
59
74
|
const el = rightChipRefs.current[origIdx];
|
|
60
75
|
if (!el)
|
|
@@ -77,12 +92,18 @@ export function useLeftPeekRightExpandingChip({ icons }) {
|
|
|
77
92
|
clearHoverTimeout();
|
|
78
93
|
hoverTimeoutRef.current = setTimeout(() => setIsHovering(false), 120);
|
|
79
94
|
}, [clearHoverTimeout]);
|
|
95
|
+
// ======================
|
|
96
|
+
// Effects
|
|
97
|
+
// ======================
|
|
80
98
|
useEffect(() => {
|
|
81
99
|
return () => clearHoverTimeout();
|
|
82
100
|
}, [clearHoverTimeout]);
|
|
101
|
+
// Measure initially and when count changes
|
|
83
102
|
useEffect(() => {
|
|
84
103
|
measureRightWidths();
|
|
104
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
105
|
}, [peekIcons.length]);
|
|
106
|
+
// Re-measure shortly after hover begins to capture dynamic size
|
|
86
107
|
useEffect(() => {
|
|
87
108
|
if (!isHovering)
|
|
88
109
|
return;
|
|
@@ -91,15 +112,22 @@ export function useLeftPeekRightExpandingChip({ icons }) {
|
|
|
91
112
|
});
|
|
92
113
|
return () => window.cancelAnimationFrame(id);
|
|
93
114
|
}, [isHovering, measureRightWidths]);
|
|
115
|
+
// ======================
|
|
116
|
+
// Public API
|
|
117
|
+
// ======================
|
|
94
118
|
return {
|
|
119
|
+
// hover state/handlers
|
|
95
120
|
isHovering,
|
|
96
121
|
handleMouseEnter,
|
|
97
122
|
handleRootMouseLeave,
|
|
123
|
+
// refs
|
|
98
124
|
rootRef,
|
|
99
125
|
mainChipRef,
|
|
126
|
+
// render data
|
|
100
127
|
peekItems,
|
|
101
128
|
mainShiftX,
|
|
102
129
|
mainIcon,
|
|
130
|
+
// guard for hover persistence over gaps
|
|
103
131
|
guardLeft,
|
|
104
132
|
guardWidth,
|
|
105
133
|
};
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Stack } from '@mui/material';
|
|
3
3
|
import Skeleton from '@mui/material/Skeleton';
|
|
4
4
|
const MFWidgetLoader = () => {
|
|
5
|
-
return (_jsxs(Stack, Object.assign({ height:
|
|
5
|
+
return (_jsxs(Stack, Object.assign({ height: "100%", borderRadius: "0 0 12px 12px", overflow: "hidden" }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, height: "4.1875rem", sx: {
|
|
6
6
|
pb: '1.2rem',
|
|
7
7
|
paddingInline: '32px',
|
|
8
8
|
pt: '4px',
|
|
9
|
-
background: (theme) => theme.palette.background.transparent[0]
|
|
10
|
-
} }, { children: [_jsx(Skeleton, { sx: { bgcolor: 'gray.300' }, variant:
|
|
9
|
+
background: (theme) => theme.palette.background.transparent[0],
|
|
10
|
+
} }, { children: [_jsx(Skeleton, { sx: { bgcolor: 'gray.300' }, variant: "rounded", width: 70, height: 33 }), _jsx(Skeleton, { sx: { bgcolor: 'gray.300' }, variant: "rounded", width: 70, height: 33 }), _jsx(Skeleton, { sx: { bgcolor: 'gray.300' }, variant: "rounded", width: 70, height: 33 })] })), _jsx(Box, { flex: 1, bgcolor: "#fff" })] })));
|
|
11
11
|
};
|
|
12
12
|
export default MFWidgetLoader;
|
|
@@ -13,6 +13,7 @@ function MultiSelectStatusButton({ options = [], selectedValues, onSelectionChan
|
|
|
13
13
|
const [dropdownWidth, setDropdownWidth] = useState(0);
|
|
14
14
|
const [isHovered, setIsHovered] = useState(false);
|
|
15
15
|
const isOpen = Boolean(anchorEl);
|
|
16
|
+
// Update internal state when props change (but only when dropdown is closed)
|
|
16
17
|
useEffect(() => {
|
|
17
18
|
if (!isOpen) {
|
|
18
19
|
setInternalSelectedValues(selectedValues);
|
|
@@ -27,10 +28,12 @@ function MultiSelectStatusButton({ options = [], selectedValues, onSelectionChan
|
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
30
|
setAnchorEl(buttonRef.current);
|
|
31
|
+
// Set initial dropdown width to prevent shrinking
|
|
30
32
|
const buttonWidth = ((_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 200;
|
|
31
33
|
setDropdownWidth(Math.max(buttonWidth, 200));
|
|
32
34
|
};
|
|
33
35
|
const handleClose = () => {
|
|
36
|
+
// To prevent unnecessary updates, we check if the selection has actually changed.
|
|
34
37
|
const hasChanged = JSON.stringify([...internalSelectedValues].sort()) !== JSON.stringify([...selectedValues].sort());
|
|
35
38
|
if (hasChanged) {
|
|
36
39
|
onSelectionChange(internalSelectedValues);
|
|
@@ -38,11 +38,14 @@ function Dropdown(_a) {
|
|
|
38
38
|
return i;
|
|
39
39
|
});
|
|
40
40
|
const newList = updateList(list);
|
|
41
|
+
// update all children
|
|
41
42
|
setList(newList);
|
|
42
43
|
if (updatedList)
|
|
43
44
|
updatedList(newList);
|
|
45
|
+
// notify parent with the new children
|
|
44
46
|
if (onChildrenChange)
|
|
45
47
|
onChildrenChange(newList);
|
|
48
|
+
// notify parent with selected / unselected children
|
|
46
49
|
if (onSelect)
|
|
47
50
|
onSelect(changedChildren);
|
|
48
51
|
}
|
|
@@ -19,6 +19,7 @@ function FormInput(_a) {
|
|
|
19
19
|
return (_jsx(Controller, { name: name, control: control, defaultValue: props.defaultValue, render: ({ field, fieldState }) => {
|
|
20
20
|
var _a;
|
|
21
21
|
return (_jsx(InputBase, Object.assign({}, props, field, { hasError: !!fieldState.error, helperText: helperText !== null && helperText !== void 0 ? helperText : (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message, hideArrows: hideArrows, onWheel: (e) => {
|
|
22
|
+
// eslint-disable-next-line
|
|
22
23
|
e.target instanceof HTMLElement && e.target.blur();
|
|
23
24
|
} })));
|
|
24
25
|
} }));
|
|
@@ -23,6 +23,7 @@ export default function MultiSelect(_a) {
|
|
|
23
23
|
field.onChange(e);
|
|
24
24
|
} }, { children: (_b = props.options) === null || _b === void 0 ? void 0 : _b.map((option) => {
|
|
25
25
|
var _a, _b, _c;
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
27
|
const isSelected = (_a = field.value) === null || _a === void 0 ? void 0 : _a.some((v) => {
|
|
27
28
|
if (isOptionEqualToValue) {
|
|
28
29
|
return isOptionEqualToValue(v, option);
|
|
@@ -22,6 +22,7 @@ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalend
|
|
|
22
22
|
const open = Boolean(anchorEl);
|
|
23
23
|
const [isError, setIsError] = useState(false);
|
|
24
24
|
const { t } = useTranslation();
|
|
25
|
+
// eslint-disable-next-line
|
|
25
26
|
const calendarRef = useRef();
|
|
26
27
|
const isHijri = mode === 'hijri';
|
|
27
28
|
const onCloseCalender = () => {
|
|
@@ -16,7 +16,9 @@ import { darkLeftArrowIcon, darkRightArrowIcon } from '../../../../constants/ind
|
|
|
16
16
|
import { ArrowButton } from './style';
|
|
17
17
|
import { getLocale, getCalender } from '../../utils';
|
|
18
18
|
const weekDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
19
|
-
function RangeDatepicker(_a,
|
|
19
|
+
function RangeDatepicker(_a,
|
|
20
|
+
// eslint-disable-next-line
|
|
21
|
+
ref) {
|
|
20
22
|
var { isAr = false, isHijri, values, onChange, numberOfMonths = 2 } = _a, props = __rest(_a, ["isAr", "isHijri", "values", "onChange", "numberOfMonths"]);
|
|
21
23
|
const getArrow = (direction) => {
|
|
22
24
|
if (direction === 'right') {
|
|
@@ -39,7 +39,7 @@ export const CalenderWrapper = styled(Box)(({ theme }) => ({
|
|
|
39
39
|
padding: 0,
|
|
40
40
|
},
|
|
41
41
|
'.rmdp-day.rmdp-today span': {
|
|
42
|
-
backgroundColor: 'transparent',
|
|
42
|
+
backgroundColor: 'transparent !important',
|
|
43
43
|
color: theme.palette.info.dark,
|
|
44
44
|
},
|
|
45
45
|
'.rmdp-day.rmdp-today.end span, .rmdp-day.rmdp-today.end span': {
|
|
@@ -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[];
|