Skip to content

Commit

Permalink
fix: allow custom min width for select components (#952)
Browse files Browse the repository at this point in the history
* fix minWidth

---------

Co-authored-by: Maxime BAUCHET <[email protected]>
Co-authored-by: severinlandolt <[email protected]>
  • Loading branch information
3 people authored May 19, 2024
1 parent e3d1907 commit ded171b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
6 changes: 1 addition & 5 deletions src/components/input-elements/MultiSelect/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const MultiSelect = React.forwardRef<HTMLInputElement, MultiSelectProps>((props,
className={tremorTwMerge(
// common
"w-full min-w-[10rem] relative text-tremor-default",
className,
)}
>
<select
Expand Down Expand Up @@ -125,11 +126,6 @@ const MultiSelect = React.forwardRef<HTMLInputElement, MultiSelectProps>((props,
}) as any
}
disabled={disabled}
className={tremorTwMerge(
// common
"w-full min-w-[10rem] relative text-tremor-default",
className,
)}
id={id}
multiple
{...other}
Expand Down
6 changes: 1 addition & 5 deletions src/components/input-elements/SearchSelect/SearchSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const SearchSelect = React.forwardRef<HTMLInputElement, SearchSelectProps>((prop
className={tremorTwMerge(
// common
"w-full min-w-[10rem] relative text-tremor-default",
className,
)}
>
<select
Expand Down Expand Up @@ -125,11 +126,6 @@ const SearchSelect = React.forwardRef<HTMLInputElement, SearchSelectProps>((prop
}) as any
}
disabled={disabled}
className={tremorTwMerge(
// common
"w-full min-w-[10rem] relative text-tremor-default",
className,
)}
id={id}
{...other}
>
Expand Down
6 changes: 1 addition & 5 deletions src/components/input-elements/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Select = React.forwardRef<HTMLInputElement, SelectProps>((props, ref) => {
className={tremorTwMerge(
// common
"w-full min-w-[10rem] relative text-tremor-default",
className,
)}
>
<select
Expand Down Expand Up @@ -107,11 +108,6 @@ const Select = React.forwardRef<HTMLInputElement, SelectProps>((props, ref) => {
}) as any
}
disabled={disabled}
className={tremorTwMerge(
// common
"w-full min-w-[10rem] relative text-tremor-default",
className,
)}
id={id}
{...other}
>
Expand Down
7 changes: 7 additions & 0 deletions src/stories/input-elements/MultiSelect.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@ export const Form: Story = {
required: true,
},
};

export const WithCustomMinWidth: Story = {
render: SimpleMultiSelect,
args: {
className: "min-w-min w-[95px]",
},
};
7 changes: 7 additions & 0 deletions src/stories/input-elements/SearchSelect.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,10 @@ export const ServerSideRendering: Story = {
required: true,
},
};

export const WithCustomMinWidth: Story = {
render: SimpleSearchSelect,
args: {
className: "min-w-min w-[95px]",
},
};
7 changes: 7 additions & 0 deletions src/stories/input-elements/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,10 @@ export const Form: Story = {
required: true,
},
};

export const WithCustomMinWidth: Story = {
render: SimpleSelect,
args: {
className: "min-w-min w-[95px]",
},
};

0 comments on commit ded171b

Please sign in to comment.