@@ -5,10 +5,10 @@ import * as React from 'react';
55import type { Placement , RenderDOMFunc } from './BaseSelect' ;
66
77const getBuiltInPlacements = (
8- dropdownMatchSelectWidth : number | boolean ,
8+ popupMatchSelectWidth : number | boolean ,
99) : Record < string , AlignType > => {
1010 // Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
11- const adjustX = dropdownMatchSelectWidth === true ? 0 : 1 ;
11+ const adjustX = popupMatchSelectWidth === true ? 0 : 1 ;
1212 return {
1313 bottomLeft : {
1414 points : [ 'tl' , 'bl' ] ,
@@ -64,13 +64,13 @@ export interface SelectTriggerProps {
6464 transitionName ?: string ;
6565 placement ?: Placement ;
6666 builtinPlacements ?: BuildInPlacements ;
67- dropdownStyle : React . CSSProperties ;
68- dropdownClassName : string ;
67+ popupStyle : React . CSSProperties ;
68+ popupClassName : string ;
6969 direction : string ;
70- dropdownMatchSelectWidth ?: boolean | number ;
71- dropdownRender ?: ( menu : React . ReactElement ) => React . ReactElement ;
70+ popupMatchSelectWidth ?: boolean | number ;
71+ popupRender ?: ( menu : React . ReactElement ) => React . ReactElement ;
7272 getPopupContainer ?: RenderDOMFunc ;
73- dropdownAlign : AlignType ;
73+ popupAlign : AlignType ;
7474 empty : boolean ;
7575
7676 getTriggerDOMNode : ( node : HTMLElement ) => HTMLElement ;
@@ -91,14 +91,14 @@ const SelectTrigger: React.ForwardRefRenderFunction<RefTriggerProps, SelectTrigg
9191 popupElement,
9292 animation,
9393 transitionName,
94- dropdownStyle ,
95- dropdownClassName ,
94+ popupStyle ,
95+ popupClassName ,
9696 direction = 'ltr' ,
9797 placement,
9898 builtinPlacements,
99- dropdownMatchSelectWidth ,
100- dropdownRender ,
101- dropdownAlign ,
99+ popupMatchSelectWidth ,
100+ popupRender ,
101+ popupAlign ,
102102 getPopupContainer,
103103 empty,
104104 getTriggerDOMNode,
@@ -107,38 +107,44 @@ const SelectTrigger: React.ForwardRefRenderFunction<RefTriggerProps, SelectTrigg
107107 ...restProps
108108 } = props ;
109109
110- const dropdownPrefixCls = `${ prefixCls } -dropdown` ;
110+ // We still use `dropdown` className to keep compatibility
111+ // This is used for:
112+ // 1. Styles
113+ // 2. Animation
114+ // 3. Theme customization
115+ // Please do not modify this since it's a breaking change
116+ const popupPrefixCls = `${ prefixCls } -dropdown` ;
111117
112118 let popupNode = popupElement ;
113- if ( dropdownRender ) {
114- popupNode = dropdownRender ( popupElement ) ;
119+ if ( popupRender ) {
120+ popupNode = popupRender ( popupElement ) ;
115121 }
116122
117123 const mergedBuiltinPlacements = React . useMemo (
118- ( ) => builtinPlacements || getBuiltInPlacements ( dropdownMatchSelectWidth ) ,
119- [ builtinPlacements , dropdownMatchSelectWidth ] ,
124+ ( ) => builtinPlacements || getBuiltInPlacements ( popupMatchSelectWidth ) ,
125+ [ builtinPlacements , popupMatchSelectWidth ] ,
120126 ) ;
121127
122128 // ===================== Motion ======================
123- const mergedTransitionName = animation ? `${ dropdownPrefixCls } -${ animation } ` : transitionName ;
129+ const mergedTransitionName = animation ? `${ popupPrefixCls } -${ animation } ` : transitionName ;
124130
125131 // =================== Popup Width ===================
126- const isNumberPopupWidth = typeof dropdownMatchSelectWidth === 'number' ;
132+ const isNumberPopupWidth = typeof popupMatchSelectWidth === 'number' ;
127133
128134 const stretch = React . useMemo ( ( ) => {
129135 if ( isNumberPopupWidth ) {
130136 return null ;
131137 }
132138
133- return dropdownMatchSelectWidth === false ? 'minWidth' : 'width' ;
134- } , [ dropdownMatchSelectWidth , isNumberPopupWidth ] ) ;
139+ return popupMatchSelectWidth === false ? 'minWidth' : 'width' ;
140+ } , [ popupMatchSelectWidth , isNumberPopupWidth ] ) ;
135141
136- let popupStyle = dropdownStyle ;
142+ let mergedPopupStyle = popupStyle ;
137143
138144 if ( isNumberPopupWidth ) {
139- popupStyle = {
145+ mergedPopupStyle = {
140146 ...popupStyle ,
141- width : dropdownMatchSelectWidth ,
147+ width : popupMatchSelectWidth ,
142148 } ;
143149 }
144150
@@ -156,18 +162,18 @@ const SelectTrigger: React.ForwardRefRenderFunction<RefTriggerProps, SelectTrigg
156162 hideAction = { onPopupVisibleChange ? [ 'click' ] : [ ] }
157163 popupPlacement = { placement || ( direction === 'rtl' ? 'bottomRight' : 'bottomLeft' ) }
158164 builtinPlacements = { mergedBuiltinPlacements }
159- prefixCls = { dropdownPrefixCls }
165+ prefixCls = { popupPrefixCls }
160166 popupTransitionName = { mergedTransitionName }
161167 popup = { < div onMouseEnter = { onPopupMouseEnter } > { popupNode } </ div > }
162168 ref = { triggerPopupRef }
163169 stretch = { stretch }
164- popupAlign = { dropdownAlign }
170+ popupAlign = { popupAlign }
165171 popupVisible = { visible }
166172 getPopupContainer = { getPopupContainer }
167- popupClassName = { classNames ( dropdownClassName , {
168- [ `${ dropdownPrefixCls } -empty` ] : empty ,
173+ popupClassName = { classNames ( popupClassName , {
174+ [ `${ popupPrefixCls } -empty` ] : empty ,
169175 } ) }
170- popupStyle = { popupStyle }
176+ popupStyle = { mergedPopupStyle }
171177 getTriggerDOMNode = { getTriggerDOMNode }
172178 onPopupVisibleChange = { onPopupVisibleChange }
173179 >
0 commit comments