draft-components 2.5.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, JSX, KeyboardEventHandler, MouseEventHandler, ReactNode, RefCallback } from 'react';
|
|
2
2
|
import { ButtonSize, ButtonStyle, ButtonTint } from '../button/index.js';
|
|
3
3
|
import { PopoverAlignment, PopoverPlacement } from '../popover/index.js';
|
|
4
|
+
import { MenuItemProps } from './menu-item.js';
|
|
5
|
+
import { MenuSeparator } from './menu-separator.js';
|
|
4
6
|
export type MenuButtonRenderFn = (props: {
|
|
5
7
|
ref: RefCallback<HTMLElement>;
|
|
6
8
|
id: string;
|
|
@@ -30,4 +32,8 @@ export type MenuProps = {
|
|
|
30
32
|
buttonTint?: ButtonTint;
|
|
31
33
|
} & MenuHTMLProps;
|
|
32
34
|
export declare function Menu({ defaultIsOpen, placement, alignment, buttonClassName, buttonStyle, buttonSize, buttonTint, button, className, children, onOpen, onClose, onKeyDown, ...props }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare namespace Menu {
|
|
36
|
+
var Item: import("react").ForwardRefExoticComponent<Omit<MenuItemProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
37
|
+
var Separator: typeof MenuSeparator;
|
|
38
|
+
}
|
|
33
39
|
export {};
|
|
@@ -6,6 +6,7 @@ import { assertIfNullable } from '../../lib/helpers.js';
|
|
|
6
6
|
import { Button } from '../button/index.js';
|
|
7
7
|
import { Popover } from '../popover/index.js';
|
|
8
8
|
import { MenuItem } from './menu-item.js';
|
|
9
|
+
import { MenuSeparator } from './menu-separator.js';
|
|
9
10
|
export function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start', buttonClassName = '', buttonStyle = 'filled', buttonSize = 'sm', buttonTint = 'gray', button, className, children, onOpen, onClose, onKeyDown, ...props }) {
|
|
10
11
|
const id = useId();
|
|
11
12
|
const menuId = props.id || id;
|
|
@@ -172,6 +173,8 @@ export function Menu({ defaultIsOpen = false, placement = 'bottom', alignment =
|
|
|
172
173
|
return child;
|
|
173
174
|
}) }) }));
|
|
174
175
|
}
|
|
176
|
+
Menu.Item = MenuItem;
|
|
177
|
+
Menu.Separator = MenuSeparator;
|
|
175
178
|
function isMenuItem(el) {
|
|
176
179
|
return isValidElement(el) && el.type === MenuItem;
|
|
177
180
|
}
|