-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(menu): add scrollableblock type definitions
- Loading branch information
1 parent
c5e0ada
commit 348f91e
Showing
6 changed files
with
47 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,46 @@ | ||
import * as React from "react"; | ||
import { IconTypes } from "../../../utils/helpers/options-helper/options-helper"; | ||
import * as OptionsHelper from "../../../utils/helpers/options-helper/options-helper"; | ||
import { BoxProps } from "../../box/box"; | ||
|
||
export interface MenuItemProps { | ||
children: React.ReactNode; | ||
export interface MenuItemBaseProps extends BoxProps { | ||
/** Custom className */ | ||
className?: string; | ||
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void; | ||
icon?: IconTypes; | ||
/** onClick handler */ | ||
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void; | ||
/** Defines which direction the submenu will hang eg. left/right */ | ||
submenuDirection?: string; | ||
/** Is the menu item the currently selected item. */ | ||
selected?: boolean; | ||
/** A title for the menu item that has a submenu. */ | ||
submenu?: React.ReactNode | boolean; | ||
/** The href to use for the menu item. */ | ||
href?: string; | ||
onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void; | ||
/** onKeyDown handler */ | ||
onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement>) => void; | ||
/** The target to use for the menu item. */ | ||
target?: string; | ||
/** set the colour variant for a menuType */ | ||
variant?: "default" | "alternate"; | ||
/** Flag to display the dropdown arrow when an item has a submenu */ | ||
showDropdownArrow?: boolean; | ||
/** If no text is provided an ariaLabel should be given to facilitate accessibility. */ | ||
ariaLabel?: string; | ||
} | ||
|
||
export interface MenuWithChildren extends MenuItemBaseProps { | ||
children: React.ReactNode; | ||
/** Either prop `icon` must be defined or this node must have children. */ | ||
icon?: OptionsHelper.IconTypes; | ||
} | ||
|
||
export interface MenuWithIcon extends MenuItemBaseProps { | ||
/** Either prop `icon` must be defined or this node must have children. */ | ||
icon: OptionsHelper.IconTypes; | ||
children?: React.ReactNode; | ||
} | ||
|
||
export type MenuItemProps = MenuWithChildren | MenuWithIcon; | ||
|
||
declare function MenuItem(props: MenuItemProps): JSX.Element; | ||
|
||
export default MenuItem; |
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 @@ | ||
export { default } from "./scrollable-block"; |
10 changes: 10 additions & 0 deletions
10
src/components/menu/scrollable-block/scrollable-block.d.ts
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 @@ | ||
export interface ScrollableBlockProps { | ||
/** Children elements */ | ||
children: React.ReactNode; | ||
/** set the colour variant for a menuType */ | ||
variant?: "default" | "alternate"; | ||
} | ||
|
||
declare function ScrollableBlock(props: ScrollableBlockProps): JSX.Element; | ||
|
||
export default ScrollableBlock; |
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