-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement
ToolbarListbox
in new design
- Loading branch information
1 parent
571eec3
commit aeeb87e
Showing
17 changed files
with
138 additions
and
187 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
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 |
---|---|---|
|
@@ -118,6 +118,7 @@ languageservice | |
linenumber | ||
linenumbers | ||
linkify | ||
listbox | ||
listvalues | ||
matchingbracket | ||
modulemap | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './button'; | ||
export * from './execute'; | ||
export * from './listbox'; | ||
export * from './menu'; |
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,5 @@ | ||
.graphiql-toolbar-listbox { | ||
display: block; | ||
height: var(--toolbar-width); | ||
width: var(--toolbar-width); | ||
} |
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,28 @@ | ||
import { ComponentProps, forwardRef, ReactNode } from 'react'; | ||
import { Listbox } from '../ui'; | ||
import { createComponentGroup } from '../utility/component-group'; | ||
import { compose } from '../utility/compose'; | ||
|
||
import './listbox.css'; | ||
|
||
type ToolbarListboxProps = { | ||
button: ReactNode; | ||
}; | ||
|
||
const ToolbarListboxRoot = forwardRef< | ||
HTMLDivElement, | ||
ToolbarListboxProps & ComponentProps<typeof Listbox.Input> | ||
>(({ button, children, ...props }, ref) => ( | ||
<Listbox.Input | ||
{...props} | ||
ref={ref} | ||
className={compose('graphiql-toolbar-listbox', props.className)}> | ||
<Listbox.Button>{button}</Listbox.Button> | ||
<Listbox.Popover>{children}</Listbox.Popover> | ||
</Listbox.Input> | ||
)); | ||
ToolbarListboxRoot.displayName = 'ToolbarListbox'; | ||
|
||
export const ToolbarListbox = createComponentGroup(ToolbarListboxRoot, { | ||
Option: Listbox.Option, | ||
}); |
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
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,55 @@ | ||
import { | ||
Listbox as ListboxRoot, | ||
ListboxButton as ReachListboxButton, | ||
ListboxInput, | ||
ListboxOption, | ||
ListboxPopover, | ||
} from '@reach/listbox'; | ||
import { | ||
Menu as MenuRoot, | ||
MenuButton as ReachMenuButton, | ||
MenuItem, | ||
MenuList, | ||
} from '@reach/menu-button'; | ||
import { ComponentProps, forwardRef } from 'react'; | ||
import { createComponentGroup } from '../utility/component-group'; | ||
import { compose } from '../utility/compose'; | ||
|
||
import './dropdown.css'; | ||
|
||
const MenuButton = forwardRef< | ||
HTMLButtonElement, | ||
ComponentProps<typeof ReachMenuButton> | ||
>((props, ref) => ( | ||
<ReachMenuButton | ||
{...props} | ||
ref={ref} | ||
className={compose('graphiql-un-styled', props.className)} | ||
/> | ||
)); | ||
MenuButton.displayName = 'MenuButton'; | ||
|
||
export const Menu = createComponentGroup(MenuRoot, { | ||
Button: MenuButton, | ||
Item: MenuItem, | ||
List: MenuList, | ||
}); | ||
|
||
const ListboxButton = forwardRef< | ||
HTMLDivElement, | ||
ComponentProps<typeof ReachListboxButton> | ||
>((props, ref) => ( | ||
<ReachListboxButton | ||
{...props} | ||
ref={ref} | ||
className={compose('graphiql-un-styled', props.className)} | ||
/> | ||
)); | ||
ListboxButton.displayName = 'ListboxButton'; | ||
|
||
export const Listbox = createComponentGroup(ListboxRoot, { | ||
Button: ListboxButton, | ||
Input: ListboxInput, | ||
Option: ListboxOption, | ||
Popover: ListboxPopover, | ||
}); |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export * from './button'; | ||
export * from './button-group'; | ||
export * from './dialog'; | ||
export * from './menu'; | ||
export * from './dropdown'; | ||
export * from './markdown'; | ||
export * from './spinner'; | ||
export * from './tabs'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.