-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fuselage): New paginated Selects/Options
- Loading branch information
1 parent
2d2b54d
commit a7f9c9a
Showing
50 changed files
with
5,232 additions
and
128 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
Binary file added
BIN
+5.04 KB
...uselage/.loki/reference/chrome_iphone7_Forms_Inputs_SelectPaginated_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.05 KB
...selage/.loki/reference/chrome_iphone7_Forms_Inputs_SelectPaginated_Disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.06 KB
.../fuselage/.loki/reference/chrome_iphone7_Forms_Inputs_SelectPaginated_Error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+943 Bytes
.../.loki/reference/chrome_iphone7_Forms_Inputs_SelectPaginated_No_Placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.96 KB
.../reference/chrome_iphone7_Forms_Inputs_SelectPaginated_PaginatedMultiSelect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.11 KB
...ce/chrome_iphone7_Forms_Inputs_SelectPaginated_PaginatedMultiSelectFiltered.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.27 KB
..._iphone7_Forms_Inputs_SelectPaginated_PaginatedMultiSelectFiltered_disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.13 KB
...ome_iphone7_Forms_Inputs_SelectPaginated_PaginatedMultiSelectFiltered_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.97 KB
...e/chrome_iphone7_Forms_Inputs_SelectPaginated_PaginatedMultiSelect_Disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.95 KB
...ence/chrome_iphone7_Forms_Inputs_SelectPaginated_PaginatedMultiSelect_Error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.17 KB
...ki/reference/chrome_iphone7_Forms_Inputs_SelectPaginated_Select_with_filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.32 KB
...chrome_iphone7_Forms_Inputs_SelectPaginated_Select_with_filter_and_disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.23 KB
...chrome_iphone7_Forms_Inputs_SelectPaginated_Select_with_filter_and_ellipses.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.17 KB
...ce/chrome_iphone7_Forms_Inputs_SelectPaginated_Select_with_filter_and_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.9 KB
...ge/.loki/reference/chrome_iphone7_Misc_Options_OptionsPaginated_CheckOption.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.6 KB
...selage/.loki/reference/chrome_iphone7_Misc_Options_OptionsPaginated_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.6 KB
...uselage/.loki/reference/chrome_iphone7_Misc_Options_OptionsPaginated_Option.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.05 KB
...fuselage/.loki/reference/chrome_laptop_Forms_Inputs_SelectPaginated_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.05 KB
...uselage/.loki/reference/chrome_laptop_Forms_Inputs_SelectPaginated_Disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.07 KB
...s/fuselage/.loki/reference/chrome_laptop_Forms_Inputs_SelectPaginated_Error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+491 Bytes
...e/.loki/reference/chrome_laptop_Forms_Inputs_SelectPaginated_No_Placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.03 KB
...i/reference/chrome_laptop_Forms_Inputs_SelectPaginated_PaginatedMultiSelect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.11 KB
...nce/chrome_laptop_Forms_Inputs_SelectPaginated_PaginatedMultiSelectFiltered.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.16 KB
...e_laptop_Forms_Inputs_SelectPaginated_PaginatedMultiSelectFiltered_disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.12 KB
...rome_laptop_Forms_Inputs_SelectPaginated_PaginatedMultiSelectFiltered_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.03 KB
...ce/chrome_laptop_Forms_Inputs_SelectPaginated_PaginatedMultiSelect_Disabled.png
Oops, something went wrong.
Binary file added
BIN
+2.05 KB
...rence/chrome_laptop_Forms_Inputs_SelectPaginated_PaginatedMultiSelect_Error.png
Oops, something went wrong.
Binary file added
BIN
+2.15 KB
...oki/reference/chrome_laptop_Forms_Inputs_SelectPaginated_Select_with_filter.png
Oops, something went wrong.
Binary file added
BIN
+2.18 KB
.../chrome_laptop_Forms_Inputs_SelectPaginated_Select_with_filter_and_disabled.png
Oops, something went wrong.
Binary file added
BIN
+1.4 KB
.../chrome_laptop_Forms_Inputs_SelectPaginated_Select_with_filter_and_ellipses.png
Oops, something went wrong.
Binary file added
BIN
+2.15 KB
...nce/chrome_laptop_Forms_Inputs_SelectPaginated_Select_with_filter_and_error.png
Oops, something went wrong.
Binary file added
BIN
+5.47 KB
...age/.loki/reference/chrome_laptop_Misc_Options_OptionsPaginated_CheckOption.png
Oops, something went wrong.
Binary file added
BIN
+5.86 KB
...uselage/.loki/reference/chrome_laptop_Misc_Options_OptionsPaginated_Default.png
Oops, something went wrong.
Binary file added
BIN
+5.86 KB
...fuselage/.loki/reference/chrome_laptop_Misc_Options_OptionsPaginated_Option.png
Oops, something went wrong.
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
154 changes: 154 additions & 0 deletions
154
packages/fuselage/src/components/OptionsPaginated/Option/Option.stories.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,154 @@ | ||
import { Meta, Canvas, ArgsTable, Story } from '@storybook/addon-docs/blocks'; | ||
import LinkTo from '@storybook/addon-links/react'; | ||
|
||
import { Option } from '.'; | ||
import { Box, Avatar, Menu, StatusBullet } from '../..'; | ||
import { exampleAvatar, menuOptions } from '../../../../.storybook/helpers.js'; | ||
|
||
<Meta title='Misc/Options/Option' parameters={{ jest: ['Option/spec'] }} /> | ||
|
||
# Option | ||
|
||
The generic <LinkTo kind='Misc/Options/Option' story='Default'>`Option`</LinkTo> item of options. Can be freely used or inside the <LinkTo kind='Misc/Options/Options' story='Default'>`Options`</LinkTo> as well. | ||
|
||
<Canvas> | ||
<Story name='Default'> | ||
<Box position='relative' maxWidth={250}> | ||
<Option> | ||
<Option.Content>Lorem Ipsum Lorem</Option.Content> | ||
</Option> | ||
<Option> | ||
<Option.Content>Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem</Option.Content> | ||
</Option> | ||
<Option> | ||
<Option.Content>Lorem Ipsum Lorem <Option.Description>Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem</Option.Description></Option.Content> | ||
</Option> | ||
</Box> | ||
</Story> | ||
</Canvas> | ||
|
||
|
||
## With avatar | ||
|
||
<Canvas> | ||
<Story name='withAvatar'> | ||
<Box position='relative' maxWidth={250}> | ||
<Option> | ||
<Option.Avatar> | ||
<Avatar url={exampleAvatar} size='x28' /> | ||
</Option.Avatar> | ||
<Option.Content>Lorem Ipsum Lorem</Option.Content> | ||
</Option> | ||
<Option> | ||
<Option.Avatar> | ||
<Avatar url={exampleAvatar} size='x28' /> | ||
</Option.Avatar> | ||
<Option.Content>Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem</Option.Content> | ||
</Option> | ||
<Option> | ||
<Option.Avatar> | ||
<Avatar url={exampleAvatar} size='x28' /> | ||
</Option.Avatar> | ||
<Option.Content>Lorem Ipsum Lorem <Option.Description>Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem</Option.Description></Option.Content> | ||
</Option> | ||
</Box> | ||
</Story> | ||
</Canvas> | ||
|
||
## With presence | ||
|
||
<Canvas> | ||
<Story name='withPresence'> | ||
<Box position='relative' maxWidth={250}> | ||
<Option> | ||
<Option.Column><StatusBullet /></Option.Column> | ||
<Option.Content>Lorem Ipsum Lorem</Option.Content> | ||
</Option> | ||
<Option> | ||
<Option.Avatar> | ||
<Avatar url={exampleAvatar} size='x28' /> | ||
</Option.Avatar> | ||
<Option.Column><StatusBullet /></Option.Column> | ||
<Option.Content>Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem</Option.Content> | ||
</Option> | ||
</Box> | ||
</Story> | ||
</Canvas> | ||
|
||
## With menu | ||
|
||
<Canvas> | ||
<Story name='withMenu'> | ||
<Box position='relative' maxWidth={250}> | ||
<Option> | ||
<Option.Content>Lorem Ipsum Lorem</Option.Content> | ||
<Option.Menu><Menu options={menuOptions} /></Option.Menu> | ||
</Option> | ||
<Option> | ||
<Option.Avatar> | ||
<Avatar url={exampleAvatar} size='x28' /> | ||
</Option.Avatar> | ||
<Option.Column><StatusBullet /></Option.Column> | ||
<Option.Content>Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem</Option.Content> | ||
<Option.Menu><Menu options={menuOptions} /></Option.Menu> | ||
</Option> | ||
</Box> | ||
</Story> | ||
</Canvas> | ||
|
||
## With Icon | ||
|
||
<Canvas> | ||
<Story name='withIcon'> | ||
<Box position='relative' maxWidth={250}> | ||
<Option> | ||
<Option.Icon name='bell'/> | ||
<Option.Content>Lorem Ipsum Lorem</Option.Content> | ||
<Option.Menu><Menu options={menuOptions} /></Option.Menu> | ||
</Option> | ||
<Option> | ||
<Option.Avatar> | ||
<Avatar url={exampleAvatar} size='x28' /> | ||
</Option.Avatar> | ||
<Option.Icon name='bell'/> | ||
<Option.Column><StatusBullet /></Option.Column> | ||
<Option.Content>Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem Lorem Ipsum Lorem</Option.Content> | ||
<Option.Menu><Menu options={menuOptions} /></Option.Menu> | ||
</Option> | ||
</Box> | ||
</Story> | ||
</Canvas> | ||
|
||
## As UserItem | ||
|
||
<Canvas> | ||
<Story name='asUserItem'> | ||
<Box maxWidth={330}> | ||
<Option> | ||
<Option.Avatar> | ||
<Avatar url={exampleAvatar} size='x28' /> | ||
</Option.Avatar> | ||
|
||
<Option.Column><StatusBullet status='online' /></Option.Column> | ||
<Option.Content> | ||
<Box withTruncatedText fontScale='p1'>carla.culhane <Box is='span' color='neutral-500'>(carla hune)</Box></Box> | ||
</Option.Content> | ||
<Option.Menu><Menu options={menuOptions} /></Option.Menu> | ||
</Option> | ||
</Box> | ||
</Story> | ||
</Canvas> | ||
|
||
## As Skeleton | ||
|
||
<Canvas> | ||
<Story name='Skeleton'> | ||
<Box position='relative' maxWidth={330}> | ||
<Option.Skeleton /> | ||
</Box> | ||
</Story> | ||
</Canvas> | ||
|
||
<ArgsTable of={Option} /> | ||
|
||
|
85 changes: 85 additions & 0 deletions
85
packages/fuselage/src/components/OptionsPaginated/Option/index.js
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,85 @@ | ||
import React from 'react'; | ||
|
||
import { Icon } from '../../Icon'; | ||
import { Skeleton } from '../../Skeleton'; | ||
|
||
const OptionColumn = (props) => ( | ||
<div className='rcx-option__column' {...props} /> | ||
); | ||
const OptionContent = (props) => ( | ||
<div className='rcx-option__content' {...props} /> | ||
); | ||
const OptionAvatar = (props) => ( | ||
<div className='rcx-option__avatar' {...props} /> | ||
); | ||
const OptionDescription = (props) => ( | ||
<div className='rcx-option__description' {...props} /> | ||
); | ||
const OptionIcon = ({ name }) => ( | ||
<OptionColumn> | ||
<Icon size='x20' name={name} /> | ||
</OptionColumn> | ||
); | ||
|
||
const OptionSkeleton = (props) => ( | ||
<Option {...props}> | ||
<Option.Avatar> | ||
<Skeleton variant='rect' width={28} height={28} /> | ||
</Option.Avatar> | ||
<Option.Content> | ||
<Skeleton width='100%' /> | ||
</Option.Content> | ||
</Option> | ||
); | ||
|
||
export const OptionMenu = (props) => ( | ||
<div className='rcx-box--animated rcx-option__menu-wraper' {...props} /> | ||
); | ||
|
||
export const Option = React.memo( | ||
({ | ||
is: Tag = 'li', | ||
id, | ||
presence, | ||
children, | ||
label, | ||
focus, | ||
selected, | ||
className, | ||
ref, | ||
icon, | ||
avatar, | ||
...options | ||
}) => ( | ||
<Tag | ||
key={id} | ||
id={id} | ||
ref={ref} | ||
aria-selected={selected} | ||
{...options} | ||
className={[ | ||
'rcx-option', | ||
className, | ||
focus && 'rcx-option--focus', | ||
selected && 'rcx-option--selected', | ||
] | ||
.filter(Boolean) | ||
.join(' ')} | ||
> | ||
<div className='rcx-option__wrapper'> | ||
{avatar && <Option.Avatar>{avatar}</Option.Avatar>} | ||
{icon && <Option.Icon name={icon} />} | ||
{label && <Option.Content>{label}</Option.Content>} | ||
{label !== children && children} | ||
</div> | ||
</Tag> | ||
) | ||
); | ||
|
||
Option.Description = OptionDescription; | ||
Option.Skeleton = OptionSkeleton; | ||
Option.Avatar = OptionAvatar; | ||
Option.Menu = OptionMenu; | ||
Option.Icon = OptionIcon; | ||
Option.Column = OptionColumn; | ||
Option.Content = OptionContent; |
10 changes: 10 additions & 0 deletions
10
packages/fuselage/src/components/OptionsPaginated/Option/spec.js
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,10 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
import { Option } from '.'; | ||
|
||
it('Option renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<Option />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
Oops, something went wrong.