|
@@ -78,6 +78,11 @@ export type ControlProps<OptionType = GeneralSelectValue> = Omit<
|
|
* components/compactSelect.tsx
|
|
* components/compactSelect.tsx
|
|
*/
|
|
*/
|
|
isCompact?: boolean;
|
|
isCompact?: boolean;
|
|
|
|
+ /**
|
|
|
|
+ * Maximum width of the menu component. Menu item labels that overflow the
|
|
|
|
+ * menu's boundaries will automatically be truncated.
|
|
|
|
+ */
|
|
|
|
+ maxMenuWidth?: number | string;
|
|
/**
|
|
/**
|
|
* Used by MultiSelectControl.
|
|
* Used by MultiSelectControl.
|
|
*/
|
|
*/
|
|
@@ -126,7 +131,7 @@ function SelectControl<OptionType extends GeneralSelectValue = GeneralSelectValu
|
|
props: WrappedControlProps<OptionType>
|
|
props: WrappedControlProps<OptionType>
|
|
) {
|
|
) {
|
|
const theme = useTheme();
|
|
const theme = useTheme();
|
|
- const {isCompact, isSearchable} = props;
|
|
|
|
|
|
+ const {isCompact, isSearchable, maxMenuWidth} = props;
|
|
|
|
|
|
// TODO(epurkhiser): The loading indicator should probably also be our loading
|
|
// TODO(epurkhiser): The loading indicator should probably also be our loading
|
|
// indicator.
|
|
// indicator.
|
|
@@ -196,6 +201,7 @@ function SelectControl<OptionType extends GeneralSelectValue = GeneralSelectValu
|
|
boxShadow: theme.dropShadowHeavy,
|
|
boxShadow: theme.dropShadowHeavy,
|
|
width: 'auto',
|
|
width: 'auto',
|
|
minWidth: '100%',
|
|
minWidth: '100%',
|
|
|
|
+ maxWidth: maxMenuWidth ?? 'auto',
|
|
...(isCompact && {
|
|
...(isCompact && {
|
|
position: 'relative',
|
|
position: 'relative',
|
|
margin: 0,
|
|
margin: 0,
|
|
@@ -216,7 +222,7 @@ function SelectControl<OptionType extends GeneralSelectValue = GeneralSelectValu
|
|
}),
|
|
}),
|
|
|
|
|
|
menuPortal: () => ({
|
|
menuPortal: () => ({
|
|
- maxWidth: '24rem',
|
|
|
|
|
|
+ maxWidth: maxMenuWidth ?? '24rem',
|
|
zIndex: theme.zIndex.dropdown,
|
|
zIndex: theme.zIndex.dropdown,
|
|
width: '90%',
|
|
width: '90%',
|
|
position: 'fixed',
|
|
position: 'fixed',
|