MCPcopy Create free account
hub / github.com/react-component/select / SelectTrigger

Function SelectTrigger

src/SelectTrigger.tsx:82–177  ·  view source on GitHub ↗
(
  props,
  ref,
)

Source from the content-addressed store, hash-verified

80}
81
82const SelectTrigger: React.ForwardRefRenderFunction<RefTriggerProps, SelectTriggerProps> = (
83 props,
84 ref,
85) => {
86 const {
87 prefixCls,
88 disabled,
89 visible,
90 children,
91 popupElement,
92 animation,
93 transitionName,
94 dropdownStyle,
95 dropdownClassName,
96 direction = 'ltr',
97 placement,
98 builtinPlacements,
99 dropdownMatchSelectWidth,
100 dropdownRender,
101 dropdownAlign,
102 getPopupContainer,
103 empty,
104 getTriggerDOMNode,
105 onPopupVisibleChange,
106 onPopupMouseEnter,
107 ...restProps
108 } = props;
109
110 const dropdownPrefixCls = `${prefixCls}-dropdown`;
111
112 let popupNode = popupElement;
113 if (dropdownRender) {
114 popupNode = dropdownRender(popupElement);
115 }
116
117 const mergedBuiltinPlacements = React.useMemo(
118 () => builtinPlacements || getBuiltInPlacements(dropdownMatchSelectWidth),
119 [builtinPlacements, dropdownMatchSelectWidth],
120 );
121
122 // ===================== Motion ======================
123 const mergedTransitionName = animation ? `${dropdownPrefixCls}-${animation}` : transitionName;
124
125 // =================== Popup Width ===================
126 const isNumberPopupWidth = typeof dropdownMatchSelectWidth === 'number';
127
128 const stretch = React.useMemo(() => {
129 if (isNumberPopupWidth) {
130 return null;
131 }
132
133 return dropdownMatchSelectWidth === false ? 'minWidth' : 'width';
134 }, [dropdownMatchSelectWidth, isNumberPopupWidth]);
135
136 let popupStyle = dropdownStyle;
137
138 if (isNumberPopupWidth) {
139 popupStyle = {

Callers

nothing calls this directly

Calls 1

getBuiltInPlacementsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…