-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from JorgeRojo/develop
v1.1.86
- Loading branch information
Showing
5 changed files
with
893 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/components/Form/Select/__stories__/FocusFromButton.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { useRef } from 'react'; | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { Button } from '../../..'; | ||
import Select from '../Select'; | ||
|
||
const SelectFocusFromButton = (): JSX.Element => { | ||
const ref = useRef<HTMLInputElement>(null); | ||
|
||
const options = Array.from(Array(25).keys()).map(index => ({ | ||
label: `Option ${index + 1} - label`, | ||
value: { | ||
opt: `opt-${index + 1}`, | ||
prop: `prop-${index}`, | ||
}, | ||
})); | ||
|
||
const handleClick = (): void => { | ||
ref.current?.focus(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Button onClick={handleClick} size="small" type="primary"> | ||
Focus | ||
</Button> | ||
<br /> | ||
<br /> | ||
<Select triggerElementRef={ref} options={options} searchable /> | ||
</> | ||
); | ||
}; | ||
|
||
const meta = { | ||
title: 'Example/Form/Select/Focus from button', | ||
component: SelectFocusFromButton, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof SelectFocusFromButton>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof SelectFocusFromButton>; | ||
|
||
export const Docs: Story = { | ||
args: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.