Skip to content

Commit

Permalink
fix: Clean up disabled options
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel.carrera committed Sep 7, 2023
1 parent 6e1cbfa commit bf220f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions modules/react/select/stories/Select.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {LabelPosition} from './examples/LabelPosition';
import {WithIcons} from './examples/WithIcons';
import {Required} from './examples/Required';
import {Scrollable} from './examples/Scrollable';
import {Dynamic} from './examples/Dynamic';
import {UseSelectModel} from './examples/UseSelectModel';
import {RefForwarding} from './examples/RefForwarding';

<Meta title="Components/Inputs/Select" component={Select} />
Expand Down Expand Up @@ -118,7 +118,7 @@ forward `ref` to its underlying `<input type="text" role="combobox">` element.

<ExampleCodeBlock code={RefForwarding} />

### Dynamic Items
### UseSelectModel

`<Select>` supports a
[dynamic API](/getting-started/for-developers/resources/collection-api/#dynamic-items) where you
Expand Down Expand Up @@ -190,7 +190,7 @@ Selected Value: {model.state.selectedIds[0]}
</>
```

<ExampleCodeBlock code={Dynamic} />
<ExampleCodeBlock code={UseSelectModel} />

### Error States

Expand Down
4 changes: 2 additions & 2 deletions modules/react/select/stories/examples/DisabledOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const DisabledOptions = () => {
return (
<Flex flexDirection="column">
<Select items={options} nonInteractiveIds={disabledItems}>
<FormField label="Contact" inputId="contact-select">
<Select.Input onChange={e => handleChange(e)} id="contact-select" />
<FormField label="Contact" inputId="disabled-options-contact-select">
<Select.Input onChange={e => handleChange(e)} id="disabled-options-contact-select" />
<Select.Popper>
<Select.Card maxHeight="200px">
<Select.List>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Flex} from '@workday/canvas-kit-react/layout';
import {useSelectModel} from '../../lib/hooks';

const options = [
{id: 'E-mail', data: {textValue: 'foo'}},
{id: 'E-mail'},
{id: 'Phone'},
{id: 'Fax (disabled)', disabled: true},
{id: 'Mail'},
Expand All @@ -18,7 +18,7 @@ const options = [

const disabledItems = options.filter(item => item.disabled === true).map(item => item.id);

export const Dynamic = () => {
export const UseSelectModel = () => {
const model = useSelectModel({
items: options,
nonInteractiveIds: disabledItems,
Expand Down

0 comments on commit bf220f6

Please sign in to comment.