From 3bbcef7b6397f30ce0c513fb30fdf3266de73a1b Mon Sep 17 00:00:00 2001 From: Zheng Song <41896553+szhsin@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:22:49 +1100 Subject: [PATCH] feat: export all types from package type declarations --- types/index.d.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 8e6194a2..06510762 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -19,11 +19,11 @@ export type CloseReason = 'click' | 'cancel' | 'blur' | 'scroll'; */ export type FocusPosition = 'first' | 'last' | number; -type ClassNameProp = string | ((modifiers: M) => string); +export type ClassNameProp = string | ((modifiers: M) => string); -type RenderProp = R | ((modifiers: M) => R); +export type RenderProp = R | ((modifiers: M) => R); -interface BaseProps +export interface BaseProps extends Omit, 'className' | 'children'> { ref?: React.Ref; /** @@ -32,7 +32,7 @@ interface BaseProps className?: ClassNameProp; } -interface Event { +export interface Event { /** * The `value` prop passed to the `MenuItem` being clicked. * It's useful for identifying which menu item is clicked. @@ -85,11 +85,11 @@ export interface MenuChangeEvent { open: boolean; } -interface EventHandler { +export interface EventHandler { (event: E): void; } -interface RectElement { +export interface RectElement { getBoundingClientRect(): { left: number; right: number; @@ -168,14 +168,14 @@ export interface MenuStateOptions { transitionTimeout?: number; } -interface Hoverable { +export interface Hoverable { disabled?: boolean; } /** * Common props for `Menu`, `SubMenu` and `ControlledMenu` */ -interface BaseMenuProps extends Omit { +export interface BaseMenuProps extends Omit { /** * Can be a string or a function which receives a modifier object and returns a CSS `class` string. */ @@ -252,7 +252,7 @@ interface BaseMenuProps extends Omit { /** * Common props for `Menu` and `ControlledMenu` */ -interface RootMenuProps extends BaseMenuProps, Omit { +export interface RootMenuProps extends BaseMenuProps, Omit { /** * Properties of this object are spread to the root DOM element containing the menu. */ @@ -351,7 +351,7 @@ export interface MenuInstance { /** * Common props for `Menu` and `SubMenu` */ -interface UncontrolledMenuProps { +export interface UncontrolledMenuProps { /** * Menu component ref which can be used to programmatically open or close menu. */ @@ -685,13 +685,15 @@ export function useMenuState(options?: MenuStateOptions): [ (open?: boolean) => void ]; -type ClickEventProps = Required, 'onMouseDown' | 'onClick'>>; +export type ClickEventProps = Required< + Pick, 'onMouseDown' | 'onClick'> +>; -type HoverEventProps = Required< +export type HoverEventProps = Required< Pick, 'onMouseEnter' | 'onMouseLeave'> >; -type ToggleEvent = (open: boolean, event: Parameters[0]) => void; +export type ToggleEvent = (open: boolean, event: Parameters[0]) => void; /** * A Hook which works with `ControlledMenu` to create click (toggle) menu.