Skip to content

Commit

Permalink
feat(search-select-field): add support for isCondensed prop to Search…
Browse files Browse the repository at this point in the history
…SelectField (#2808)
  • Loading branch information
Sarah4VT committed May 3, 2024
1 parent 91a86d8 commit 3c06060
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-emus-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-uikit/search-select-field': minor
---

Add support for isCondensed layout for SearchSelectField
1 change: 1 addition & 0 deletions packages/components/fields/search-select-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default Example;
| `isReadOnly` | `boolean` | | | Is the select read-only |
| `isDisabled` | `boolean` | | | Is the select disabled |
| `isClearable` | `boolean` | | | Is the select value clearable |
| `isCondensed` | `boolean` | | | Whether the input and its options are rendered with condensed paddings |
| `isOptionDisabled` | `AsyncProps['isOptionDisabled']` | | | Override the built-in logic to detect whether an option is disabled&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
| `isMulti` | `AsyncProps['isMulti']` | | | Support multiple selected options&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
| `isAutofocussed` | `boolean` | | | Focus the control when it is mounted. Renamed autoFocus of react-select |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ storiesOf('Components|Fields/SelectFields', module)
maxMenuHeight={number('maxMenuHeight', 220)}
isSearchable={boolean('isSearchable', true)}
isClearable={boolean('isClearable', false)}
isCondensed={boolean('isCondensed', false)}
tabIndex={text('tabIndex', '0')}
tabSelectsValue={boolean('tabSelectsValue', true)}
// Async props
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ export type TSearchSelectFieldProps = {
* Is the select value clearable
*/
isClearable?: boolean;
/**
* Whether the input and its options are rendered with condensed paddings
*/
isCondensed?: boolean;
/**
* Override the built-in logic to detect whether an option is disabled
* <br>
Expand Down Expand Up @@ -393,6 +397,7 @@ const SearchSelectField = (props: TSearchSelectFieldProps) => {
id={id}
containerId={props.containerId}
isClearable={props.isClearable}
isCondensed={props.isCondensed}
isDisabled={props.isDisabled}
isReadOnly={props.isReadOnly}
isOptionDisabled={props.isOptionDisabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ export const component = () => (
isDisabled={true}
/>
</Spec>
<Spec label="when condensed">
<SearchSelectField
title="State"
name="form-field-name"
value={value}
onChange={() => {}}
loadOptions={loadOptions}
horizontalConstraint={7}
isCondensed={true}
/>
</Spec>
<Spec label='with "missing" error when not touched'>
<SearchSelectField
title="State"
Expand Down

0 comments on commit 3c06060

Please sign in to comment.