-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(fractal): add documentation for all sub components
- Loading branch information
1 parent
ed28ce9
commit 4109962
Showing
33 changed files
with
1,047 additions
and
320 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
34 changes: 34 additions & 0 deletions
34
packages/fractal/src/components/Autocomplete/AutocompleteEmpty.mdx
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,34 @@ | ||
import { | ||
ArgTypes, | ||
Controls, | ||
Description, | ||
Meta, | ||
Primary, | ||
Subtitle, | ||
Title, | ||
} from '@storybook/blocks' | ||
|
||
import * as AutocompleteEmptyStories from './AutocompleteEmpty.stories' | ||
|
||
<Meta of={AutocompleteEmptyStories} /> | ||
|
||
<Title /> | ||
|
||
<Subtitle /> | ||
|
||
<Description /> | ||
|
||
--- | ||
|
||
## Props | ||
|
||
On top of all the props, attributes and event handler you can set on a | ||
`<div />` element, the component accepts the following props: | ||
|
||
<ArgTypes /> | ||
|
||
## Playground | ||
|
||
<Primary /> | ||
|
||
<Controls /> |
32 changes: 32 additions & 0 deletions
32
packages/fractal/src/components/Autocomplete/AutocompleteEmpty.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,32 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
|
||
import Autocomplete from './Autocomplete' | ||
import AutocompleteEmpty from './AutocompleteEmpty' | ||
|
||
type AutocompleteEmptyProps = ComponentProps<typeof AutocompleteEmpty> | ||
|
||
const meta: Meta<AutocompleteEmptyProps> = { | ||
argTypes: { | ||
children: { | ||
control: 'text', | ||
}, | ||
}, | ||
args: { | ||
children: 'No results! Sorry about that!', | ||
}, | ||
component: AutocompleteEmpty, | ||
|
||
title: 'Molecules/Autocomplete/AutocompleteEmpty', | ||
} satisfies Meta<AutocompleteEmptyProps> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Playground: Story = { | ||
render: ({ children }) => ( | ||
<Autocomplete placeholder="Start typing to autocomplete"> | ||
<AutocompleteEmpty>{children}</AutocompleteEmpty> | ||
</Autocomplete> | ||
), | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/fractal/src/components/Autocomplete/AutocompleteItem.mdx
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,34 @@ | ||
import { | ||
ArgTypes, | ||
Controls, | ||
Description, | ||
Meta, | ||
Primary, | ||
Subtitle, | ||
Title, | ||
} from '@storybook/blocks' | ||
|
||
import * as AutocompleteItemStories from './AutocompleteItem.stories' | ||
|
||
<Meta of={AutocompleteItemStories} /> | ||
|
||
<Title /> | ||
|
||
<Subtitle /> | ||
|
||
<Description /> | ||
|
||
--- | ||
|
||
## Props | ||
|
||
On top of all the props, attributes and event handler you can set on a | ||
`<div />` element, the component accepts the following props: | ||
|
||
<ArgTypes /> | ||
|
||
## Playground | ||
|
||
<Primary /> | ||
|
||
<Controls /> |
39 changes: 39 additions & 0 deletions
39
packages/fractal/src/components/Autocomplete/AutocompleteItem.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,39 @@ | ||
import { action } from '@storybook/addon-actions' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
|
||
import Autocomplete from './Autocomplete' | ||
import AutocompleteItem from './AutocompleteItem' | ||
|
||
type AutocompleteItemProps = ComponentProps<typeof AutocompleteItem> | ||
|
||
const meta: Meta<AutocompleteItemProps> = { | ||
argTypes: { | ||
asChild: { table: { disable: true } }, | ||
children: { control: 'text' }, | ||
}, | ||
args: { | ||
children: 'Jar Jar Binks', | ||
disabled: false, | ||
value: 'jar-jar-binks', | ||
}, | ||
component: AutocompleteItem, | ||
|
||
title: 'Molecules/Autocomplete/AutocompleteItem', | ||
} satisfies Meta<AutocompleteItemProps> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Playground: Story = { | ||
render: ({ children, disabled = false, value = '' }) => ( | ||
<Autocomplete | ||
placeholder="Start typing to autocomplete" | ||
onChange={action('onChange')} | ||
> | ||
<AutocompleteItem disabled={disabled} value={value}> | ||
{children} | ||
</AutocompleteItem> | ||
</Autocomplete> | ||
), | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/fractal/src/components/Autocomplete/AutocompleteItemGroup.mdx
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,34 @@ | ||
import { | ||
ArgTypes, | ||
Controls, | ||
Description, | ||
Meta, | ||
Primary, | ||
Subtitle, | ||
Title, | ||
} from '@storybook/blocks' | ||
|
||
import * as AutocompleteItemGroupStories from './AutocompleteItemGroup.stories' | ||
|
||
<Meta of={AutocompleteItemGroupStories} /> | ||
|
||
<Title /> | ||
|
||
<Subtitle /> | ||
|
||
<Description /> | ||
|
||
--- | ||
|
||
## Props | ||
|
||
On top of all the props, attributes and event handler you can set on a | ||
`<div />` element, the component accepts the following props: | ||
|
||
<ArgTypes /> | ||
|
||
## Playground | ||
|
||
<Primary /> | ||
|
||
<Controls /> |
51 changes: 51 additions & 0 deletions
51
packages/fractal/src/components/Autocomplete/AutocompleteItemGroup.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,51 @@ | ||
import { action } from '@storybook/addon-actions' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
|
||
import Autocomplete from './Autocomplete' | ||
import AutocompleteItem from './AutocompleteItem' | ||
import AutocompleteItemGroup from './AutocompleteItemGroup' | ||
|
||
type AutocompleteItemGroupProps = ComponentProps<typeof AutocompleteItemGroup> | ||
|
||
const meta: Meta<AutocompleteItemGroupProps> = { | ||
argTypes: { | ||
children: { | ||
control: false, | ||
table: { | ||
type: { | ||
summary: | ||
'SelectItem | SelectItemSeparator | Array<SelectItem | SelectItemSeparator>', | ||
}, | ||
}, | ||
}, | ||
}, | ||
args: { | ||
label: 'Jedis', | ||
}, | ||
component: AutocompleteItemGroup, | ||
|
||
title: 'Molecules/Autocomplete/AutocompleteItemGroup', | ||
} satisfies Meta<AutocompleteItemGroupProps> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Playground: Story = { | ||
render: ({ label }) => ( | ||
<Autocomplete | ||
placeholder="Start typing to autocomplete" | ||
onChange={action('onChange')} | ||
> | ||
<AutocompleteItemGroup label={label}> | ||
<AutocompleteItem value="luke-skywalker"> | ||
Luke Skywalker | ||
</AutocompleteItem> | ||
<AutocompleteItem value="obi-wan-kenobi"> | ||
Obi-Wan Kenobi | ||
</AutocompleteItem> | ||
<AutocompleteItem value="yoda">Yoda</AutocompleteItem> | ||
</AutocompleteItemGroup> | ||
</Autocomplete> | ||
), | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/fractal/src/components/Autocomplete/AutocompleteItemSeparator.mdx
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,22 @@ | ||
import { Description, Meta, Primary, Subtitle, Title } from '@storybook/blocks' | ||
|
||
import * as AutocompleteItemSeparatortories from './AutocompleteItemSeparator.stories' | ||
|
||
<Meta of={AutocompleteItemSeparatortories} /> | ||
|
||
<Title /> | ||
|
||
<Subtitle /> | ||
|
||
<Description /> | ||
|
||
--- | ||
|
||
## Props | ||
|
||
You can pass any props, attributes and event handler you can set on a | ||
`<div />` element. | ||
|
||
## Playground | ||
|
||
<Primary /> |
33 changes: 33 additions & 0 deletions
33
packages/fractal/src/components/Autocomplete/AutocompleteItemSeparator.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,33 @@ | ||
import { action } from '@storybook/addon-actions' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
|
||
import Autocomplete from './Autocomplete' | ||
import AutocompleteItem from './AutocompleteItem' | ||
import AutocompleteItemSeparator from './AutocompleteItemSeparator' | ||
|
||
type AutocompleteItemSeparatorProps = ComponentProps< | ||
typeof AutocompleteItemSeparator | ||
> | ||
|
||
const meta: Meta<AutocompleteItemSeparatorProps> = { | ||
component: AutocompleteItemSeparator, | ||
|
||
title: 'Molecules/Autocomplete/AutocompleteItemSeparator', | ||
} satisfies Meta<AutocompleteItemSeparatorProps> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Playground: Story = { | ||
render: () => ( | ||
<Autocomplete | ||
placeholder="Start typing to autocomplete" | ||
onChange={action('onChange')} | ||
> | ||
<AutocompleteItem value="yoda">Yoda</AutocompleteItem> | ||
<AutocompleteItemSeparator /> | ||
<AutocompleteItem value="darth-sidious">Darth Sidious</AutocompleteItem> | ||
</Autocomplete> | ||
), | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/fractal/src/components/Autocomplete/AutocompleteLoading.mdx
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,34 @@ | ||
import { | ||
ArgTypes, | ||
Controls, | ||
Description, | ||
Meta, | ||
Primary, | ||
Subtitle, | ||
Title, | ||
} from '@storybook/blocks' | ||
|
||
import * as AutocompleteLoadingStories from './AutocompleteLoading.stories' | ||
|
||
<Meta of={AutocompleteLoadingStories} /> | ||
|
||
<Title /> | ||
|
||
<Subtitle /> | ||
|
||
<Description /> | ||
|
||
--- | ||
|
||
## Props | ||
|
||
On top of all the props, attributes and event handler you can set on a | ||
`<div />` element, the component accepts the following props: | ||
|
||
<ArgTypes /> | ||
|
||
## Playground | ||
|
||
<Primary /> | ||
|
||
<Controls /> |
50 changes: 50 additions & 0 deletions
50
packages/fractal/src/components/Autocomplete/AutocompleteLoading.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,50 @@ | ||
import { | ||
UilMessage as SendIcon, | ||
UilEnvelopeStar as StarIcon, | ||
} from '@iconscout/react-unicons' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import type { ComponentProps } from 'react' | ||
|
||
import Autocomplete from './Autocomplete' | ||
import AutocompleteLoading from './AutocompleteLoading' | ||
|
||
type AutocompleteLoadingProps = ComponentProps<typeof AutocompleteLoading> | ||
|
||
const meta: Meta<AutocompleteLoadingProps> = { | ||
argTypes: { | ||
children: { | ||
control: 'text', | ||
}, | ||
icon: { | ||
mapping: { | ||
Default: true, | ||
None: false, | ||
Send: <SendIcon />, | ||
Star: <StarIcon />, | ||
}, | ||
options: ['Default', 'None', 'Send', 'Star'], | ||
table: { type: { summary: 'ReactNode | boolean' } }, | ||
}, | ||
}, | ||
args: { | ||
children: 'Loading... please wait!', | ||
icon: 'Default', | ||
spin: true, | ||
}, | ||
component: AutocompleteLoading, | ||
|
||
title: 'Molecules/Autocomplete/AutocompleteLoading', | ||
} satisfies Meta<AutocompleteLoadingProps> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Playground: Story = { | ||
render: ({ children, icon, spin = false }) => ( | ||
<Autocomplete placeholder="Start typing to autocomplete"> | ||
<AutocompleteLoading icon={icon} spin={spin}> | ||
{children} | ||
</AutocompleteLoading> | ||
</Autocomplete> | ||
), | ||
} |
Oops, something went wrong.