Skip to content

Commit

Permalink
feat(select-field): add isCondensed layout for SelectField component
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah4VT committed Apr 17, 2024
1 parent a270209 commit 522e0ba
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-guests-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-uikit/select-field': minor
---

Add support for isCondensed layout for SelectField
1 change: 1 addition & 0 deletions packages/components/fields/select-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default Example;
| `isClearable` | `boolean` | | | Is the select value clearable |
| `isDisabled` | `boolean` | | | Is the select disabled |
| `isReadOnly` | `boolean` | | | Is the select read-only |
| `isCondensed` | `boolean` | | | Is the component is displayed in a condensed layout |
| `isOptionDisabled` | `ReactSelectProps['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` | `boolean` | | | Support multiple selected options |
| `isSearchable` | `boolean` | | | Whether to enable search functionality |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ storiesOf('Components|Fields/SelectFields', module)
isAutofocussed={boolean('isAutofocussed', false)}
isDisabled={boolean('isDisabled', false)}
isReadOnly={boolean('isReadOnly', false)}
isCondensed={boolean('isCondensed', false)}
isMulti={isMulti}
placeholder={text('placeholder', 'Select...')}
title={text('title', 'Favourite animal')}
Expand Down
9 changes: 7 additions & 2 deletions packages/components/fields/select-field/src/select-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,13 @@ export type TSelectFieldProps = {
*/
isDisabled?: boolean;
/**
* Is the select read-only
*/
Is the select read-only
*/
isReadOnly?: boolean;
/**
* Is the select displayed in a condensed layout
*/
isCondensed?: boolean;
/**
* Override the built-in logic to detect whether an option is disabled
* <br/>
Expand Down Expand Up @@ -405,6 +409,7 @@ export default class SelectField extends Component<TSelectFieldProps> {
isClearable={this.props.isClearable}
isDisabled={this.props.isDisabled}
isReadOnly={this.props.isReadOnly}
isCondensed={this.props.isCondensed}
isOptionDisabled={this.props.isOptionDisabled}
isMulti={this.props.isMulti}
isSearchable={this.props.isSearchable}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ export const component = () => (
isReadOnly={true}
/>
</Spec>
<Spec label="when is condensed">
<SelectField
title="State"
name="form-field-name"
value={value}
onChange={() => {}}
options={options}
horizontalConstraint={7}
isCondensed={true}
/>
</Spec>
<Spec label="when has warning">
<SelectField
title="State"
Expand Down

0 comments on commit 522e0ba

Please sign in to comment.