From 39386361191595490f3706715b4e0263f59ddbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=81=87=E8=A7=81=E5=90=8C=E5=AD=A6?= <1875694521@qq.com> Date: Mon, 20 Oct 2025 14:03:34 +0800 Subject: [PATCH 1/2] feat: add semantic for popup container --- docs/examples/basic.tsx | 11 +++++++++++ package.json | 2 +- src/PickerInput/Popup/index.tsx | 7 +++++++ src/PickerInput/RangePicker.tsx | 3 +++ src/PickerInput/SinglePicker.tsx | 3 +++ src/interface.tsx | 9 ++++++++- tests/picker.spec.tsx | 5 +++++ 7 files changed, 38 insertions(+), 2 deletions(-) diff --git a/docs/examples/basic.tsx b/docs/examples/basic.tsx index acff81877..8c6e1ed68 100644 --- a/docs/examples/basic.tsx +++ b/docs/examples/basic.tsx @@ -59,6 +59,17 @@ export default () => { className="little" classNames={{ root: 'light', + popup: { + container: 'popup-c', + }, + }} + open + styles={{ + popup: { + container: { + backgroundColor: 'red', + }, + }, }} /> {...sharedProps} locale={enUS} /> diff --git a/package.json b/package.json index 653996229..5cdb3f660 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@rc-component/resize-observer": "^1.0.0", - "@rc-component/trigger": "^3.0.0", + "@rc-component/trigger": "^3.6.15", "@rc-component/util": "^1.3.0", "clsx": "^2.1.1", "rc-overflow": "^1.3.2" diff --git a/src/PickerInput/Popup/index.tsx b/src/PickerInput/Popup/index.tsx index 190c56eb4..65fb354e7 100644 --- a/src/PickerInput/Popup/index.tsx +++ b/src/PickerInput/Popup/index.tsx @@ -45,6 +45,9 @@ export interface PopupProps; + + classNames?: SharedPickerProps['classNames']; + styles?: SharedPickerProps['styles']; } export default function Popup(props: PopupProps) { @@ -79,6 +82,8 @@ export default function Popup(props: PopupProps(props: PopupProps { diff --git a/src/PickerInput/RangePicker.tsx b/src/PickerInput/RangePicker.tsx index 7706fd618..acd5c9cf9 100644 --- a/src/PickerInput/RangePicker.tsx +++ b/src/PickerInput/RangePicker.tsx @@ -626,6 +626,9 @@ function RangePicker( onNow={onNow} // Render cellRender={onInternalCellRender} + // Styles + classNames={mergedClassNames} + styles={mergedStyles} /> ); diff --git a/src/PickerInput/SinglePicker.tsx b/src/PickerInput/SinglePicker.tsx index d48038a0a..df2a86a81 100644 --- a/src/PickerInput/SinglePicker.tsx +++ b/src/PickerInput/SinglePicker.tsx @@ -540,6 +540,9 @@ function Picker( onNow={onNow} // Render cellRender={onInternalCellRender} + // Styles + classNames={mergedClassNames} + styles={mergedStyles} /> ); diff --git a/src/interface.tsx b/src/interface.tsx index 99f9b6767..964f80c2b 100644 --- a/src/interface.tsx +++ b/src/interface.tsx @@ -315,7 +315,14 @@ export type SemanticName = 'root' | 'prefix' | 'input' | 'suffix'; export type PreviewValueType = 'hover'; -export type PanelSemanticName = 'root' | 'header' | 'body' | 'content' | 'item' | 'footer'; +export type PanelSemanticName = + | 'root' + | 'header' + | 'body' + | 'content' + | 'item' + | 'footer' + | 'container'; export interface SharedPickerProps extends SharedHTMLAttrs, diff --git a/tests/picker.spec.tsx b/tests/picker.spec.tsx index 2034bad0b..76bca254c 100644 --- a/tests/picker.spec.tsx +++ b/tests/picker.spec.tsx @@ -1358,8 +1358,10 @@ describe('Picker.Basic', () => { content: 'custom-content', item: 'custom-item', footer: 'custom-footer', + container: 'custom-container', }; const popupStyles = { + container: { backgroundColor: 'red' }, root: { color: 'red' }, header: { color: 'purple' }, body: { color: 'green' }, @@ -1387,6 +1389,7 @@ describe('Picker.Basic', () => { const content = document.querySelector('.rc-picker-content'); const item = document.querySelector('.rc-picker-cell'); const footer = document.querySelector('.rc-picker-footer'); + const container = document.querySelector('.rc-picker-panel-container'); expect(header).toHaveClass(popupClassNames.header); expect(header).toHaveStyle(popupStyles.header); @@ -1398,6 +1401,8 @@ describe('Picker.Basic', () => { expect(item).toHaveStyle(popupStyles.item); expect(footer).toHaveClass(popupClassNames.footer); expect(footer).toHaveStyle(popupStyles.footer); + expect(container).toHaveClass(popupClassNames.container); + expect(container).toHaveStyle(popupStyles.container); }); it('support classNames and styles for panel', () => { From 51937af60f86f20bc46891ee5278e915dfe3f366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=81=87=E8=A7=81=E5=90=8C=E5=AD=A6?= <1875694521@qq.com> Date: Mon, 20 Oct 2025 14:11:40 +0800 Subject: [PATCH 2/2] feat: adjust code --- src/PickerInput/Popup/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PickerInput/Popup/index.tsx b/src/PickerInput/Popup/index.tsx index 65fb354e7..f02810390 100644 --- a/src/PickerInput/Popup/index.tsx +++ b/src/PickerInput/Popup/index.tsx @@ -227,7 +227,7 @@ export default function Popup(props: PopupProps {