Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(902): select panel with min and max size #903

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/select/__tests__/select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,22 @@ export const StoryOverrides = () => {
</Select>
<AssistiveText id="id-ov-6-at">Assistive Text</AssistiveText>
</StorybookCase>

<StorybookCase title="Min and Max width overrides">
<Label htmlFor="id-ov-7">Label</Label>
<Select
id="id-ov-7"
aria-describedby="id-ov-7-at"
overrides={{button: {width: '200px'}, panel: {minWidth: '300px'}}}
>
{items.map(item => (
<SelectOption key={item} value={item}>
{item}
</SelectOption>
))}
</Select>
<AssistiveText id="id-ov-7-at">Assistive Text</AssistiveText>
</StorybookCase>
</StorybookPage>
);
};
Expand Down
4 changes: 4 additions & 0 deletions src/select/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ export const StyledSelectPanel = styled.div<{

${({$size}) =>
getResponsiveSize('maxHeight', `select.${$size}.panel`, '', 'maxHeight')};
${({$size}) =>
getResponsiveSize('minWidth', `select.${$size}.panel`, '', 'minWidth')};
${({$size}) =>
getResponsiveSize('maxWidth', `select.${$size}.panel`, '', 'maxWidth')};
`;

export const StyledModalPanel = styled.div`
Expand Down
2 changes: 2 additions & 0 deletions src/select/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export interface SelectButtonOverrides extends EnhancerOverrides {

export interface SelectPanelOverrides extends LogicalProps {
maxHeight?: MQ<string>;
minWidth?: MQ<string>;
maxWidth?: MQ<string>;
stylePreset?: MQ<string>;
/**
* @deprecated This property is deprecated and will be removed in the next major release. Use `marginBlock` instead.
Expand Down