From 44995223dc386babba2306757222f56c39fd289d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 19 Sep 2025 17:13:51 +0800 Subject: [PATCH 1/2] chore: add css var for calc --- src/UniqueProvider/UniqueBody.tsx | 8 ++++++-- src/UniqueProvider/index.tsx | 4 ++++ tests/unique.test.tsx | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/UniqueProvider/UniqueBody.tsx b/src/UniqueProvider/UniqueBody.tsx index 9175c771..e60e0bac 100644 --- a/src/UniqueProvider/UniqueBody.tsx +++ b/src/UniqueProvider/UniqueBody.tsx @@ -3,7 +3,7 @@ import useOffsetStyle from '../hooks/useOffsetStyle'; import classNames from 'classnames'; import CSSMotion from '@rc-component/motion'; import type { CSSMotionProps } from '@rc-component/motion'; -import type { AlignType } from '../interface'; +import type { AlignType, ArrowPos } from '../interface'; export interface UniqueBodyProps { prefixCls: string; // ${prefixCls}-unique-body @@ -15,6 +15,7 @@ export interface UniqueBodyProps { offsetB: number; offsetX: number; offsetY: number; + arrowPos?: ArrowPos; popupSize?: { width: number; height: number }; motion?: CSSMotionProps; uniqueBgClassName?: string; @@ -32,6 +33,7 @@ const UniqueBody = (props: UniqueBodyProps) => { offsetB, offsetX, offsetY, + arrowPos, popupSize, motion, uniqueBgClassName, @@ -84,11 +86,13 @@ const UniqueBody = (props: UniqueBodyProps) => {
); }} diff --git a/src/UniqueProvider/index.tsx b/src/UniqueProvider/index.tsx index 2d8aae34..78643a8f 100644 --- a/src/UniqueProvider/index.tsx +++ b/src/UniqueProvider/index.tsx @@ -214,6 +214,10 @@ const UniqueProvider = ({ children }: UniqueProviderProps) => { offsetB={offsetB} offsetX={offsetX} offsetY={offsetY} + arrowPos={{ + x: arrowX, + y: arrowY, + }} popupSize={popupSize} motion={options.popupMotion} uniqueBgClassName={classNames( diff --git a/tests/unique.test.tsx b/tests/unique.test.tsx index ec6f57d2..134f4770 100644 --- a/tests/unique.test.tsx +++ b/tests/unique.test.tsx @@ -236,6 +236,7 @@ describe('Trigger.Unique', () => { }, }, }} + arrow={{ pointAtCenter: true }} >
click me
@@ -246,5 +247,11 @@ describe('Trigger.Unique', () => { expect(document.querySelector('.rc-trigger-popup-unique-body')).toHaveClass( 'bamboo', ); + + // Check that arrow position CSS variables are set + const uniqueBody = document.querySelector('.rc-trigger-popup-unique-body'); + const computedStyle = getComputedStyle(uniqueBody); + expect(computedStyle.getPropertyValue('--arrow-x')).not.toBe(''); + expect(computedStyle.getPropertyValue('--arrow-y')).not.toBe(''); }); }); From aebf0f52932e61da371d3f306fd12f2727ebda75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Fri, 19 Sep 2025 17:15:47 +0800 Subject: [PATCH 2/2] chore: fix ts --- tests/unique.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unique.test.tsx b/tests/unique.test.tsx index 134f4770..86bd09e3 100644 --- a/tests/unique.test.tsx +++ b/tests/unique.test.tsx @@ -236,7 +236,7 @@ describe('Trigger.Unique', () => { }, }, }} - arrow={{ pointAtCenter: true }} + arrow >
click me