2024-04-08 14:04:08 +08:00
|
|
|
import { unit } from '@ant-design/cssinjs';
|
2023-11-13 09:38:05 +08:00
|
|
|
import type { CssUtil } from 'antd-style';
|
2024-04-08 14:04:08 +08:00
|
|
|
|
2022-05-23 10:58:30 +08:00
|
|
|
import type { MenuToken } from '.';
|
2022-11-23 20:22:38 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
2022-05-23 10:58:30 +08:00
|
|
|
|
2023-11-13 09:38:05 +08:00
|
|
|
const getRTLStyle: GenerateStyle<MenuToken & CssUtil> = ({
|
|
|
|
componentCls,
|
|
|
|
menuArrowOffset,
|
|
|
|
calc,
|
|
|
|
}) => ({
|
2022-05-23 10:58:30 +08:00
|
|
|
[`${componentCls}-rtl`]: {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-submenu-rtl`]: {
|
|
|
|
transformOrigin: '100% 0',
|
|
|
|
},
|
|
|
|
|
|
|
|
// Vertical Arrow
|
|
|
|
[`${componentCls}-rtl${componentCls}-vertical,
|
|
|
|
${componentCls}-submenu-rtl ${componentCls}-vertical`]: {
|
|
|
|
[`${componentCls}-submenu-arrow`]: {
|
|
|
|
'&::before': {
|
2023-11-13 09:38:05 +08:00
|
|
|
transform: `rotate(-45deg) translateY(${unit(calc(menuArrowOffset).mul(-1).equal())})`,
|
2022-05-23 10:58:30 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&::after': {
|
2023-11-13 09:38:05 +08:00
|
|
|
transform: `rotate(45deg) translateY(${unit(menuArrowOffset)})`,
|
2022-05-23 10:58:30 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export default getRTLStyle;
|