2025-05-08 10:34:25 +05:30
|
|
|
import React from 'react';
|
2025-07-11 02:39:34 +05:30
|
|
|
import styled from 'styled-components';
|
|
|
|
|
|
|
|
|
|
const StyledWrapper = styled.span`
|
|
|
|
|
width: max-content;
|
|
|
|
|
display: flex;
|
|
|
|
|
`;
|
2025-05-08 10:34:25 +05:30
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
children: React.ReactNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const StopPropagationWrapper = ({ children }: Props) => {
|
|
|
|
|
return (
|
2025-07-11 02:39:34 +05:30
|
|
|
<StyledWrapper
|
2025-05-08 10:34:25 +05:30
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
|
role="button"
|
|
|
|
|
tabIndex={0}
|
|
|
|
|
onKeyDown={(e) => {
|
|
|
|
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
2025-07-11 02:39:34 +05:30
|
|
|
</StyledWrapper>
|
2025-05-08 10:34:25 +05:30
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default StopPropagationWrapper;
|