draft-components 1.0.0-beta.6 → 1.0.0-beta.7
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.
- package/cjs/components/menu/menu-item.cjs +11 -4
- package/cjs/components/menu/menu.cjs +3 -4
- package/css/draft-components.css +12 -3
- package/esm/components/menu/menu-item.js +11 -4
- package/esm/components/menu/menu.js +3 -4
- package/package.json +1 -1
- package/types/components/menu/menu-item.d.ts +6 -3
- package/types/components/menu/menu.d.ts +4 -3
|
@@ -4,11 +4,18 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
const react = require('react');
|
|
5
5
|
const reactHelpers = require('../../lib/react-helpers.cjs');
|
|
6
6
|
|
|
7
|
-
const MenuItem = react.forwardRef(function MenuItem({
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const MenuItem = react.forwardRef(function MenuItem({ role = 'menuitem', appearance = 'default', iconLeft = null, iconRight = null, className, children, ...props }, ref) {
|
|
8
|
+
let label = children;
|
|
9
|
+
if (iconLeft || iconRight) {
|
|
10
|
+
const className = reactHelpers.classNames('dc-menu-btn__label', {
|
|
11
|
+
'dc-menu-btn__label_gap_left': iconLeft,
|
|
12
|
+
'dc-menu-btn__label_gap_right': iconRight,
|
|
13
|
+
});
|
|
14
|
+
label = jsxRuntime.jsx("span", { className: className, children: label });
|
|
15
|
+
}
|
|
16
|
+
return (jsxRuntime.jsx("li", { role: "presentation", children: jsxRuntime.jsxs("button", { ...props, ref: ref, className: reactHelpers.classNames(className, 'dc-menu-btn', {
|
|
10
17
|
[`dc-menu-btn_${appearance}`]: appearance,
|
|
11
|
-
}), type: "button", role:
|
|
18
|
+
}), type: "button", role: role, tabIndex: -1, children: [iconLeft, label, iconRight] }) }));
|
|
12
19
|
});
|
|
13
20
|
|
|
14
21
|
exports.MenuItem = MenuItem;
|
|
@@ -10,7 +10,7 @@ require('../button/icon-button.cjs');
|
|
|
10
10
|
const popover = require('../popover/popover.cjs');
|
|
11
11
|
const menuItem = require('./menu-item.cjs');
|
|
12
12
|
|
|
13
|
-
function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start', buttonAppearance = 'default', buttonVariant = 'filled', button: button$1, className, children, onOpen, onClose, onKeyDown, ...props }) {
|
|
13
|
+
function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start', buttonClassName = '', buttonAppearance = 'default', buttonVariant = 'filled', button: button$1, className, children, onOpen, onClose, onKeyDown, ...props }) {
|
|
14
14
|
const id = react.useId();
|
|
15
15
|
const menuId = props.id || id;
|
|
16
16
|
const buttonId = `menu-button-${menuId}`;
|
|
@@ -83,12 +83,11 @@ function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start'
|
|
|
83
83
|
const handleButtonClick = (event) => {
|
|
84
84
|
if (isOpen) {
|
|
85
85
|
closeMenu();
|
|
86
|
-
focusMenuButton();
|
|
87
86
|
}
|
|
88
87
|
else {
|
|
89
88
|
openMenu();
|
|
90
|
-
window.setTimeout(focusFirstMenuItem);
|
|
91
89
|
}
|
|
90
|
+
focusMenuButton();
|
|
92
91
|
event.preventDefault();
|
|
93
92
|
event.stopPropagation();
|
|
94
93
|
};
|
|
@@ -159,7 +158,7 @@ function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start'
|
|
|
159
158
|
closeMenu,
|
|
160
159
|
});
|
|
161
160
|
}
|
|
162
|
-
return (jsxRuntime.jsx(button.Button, { ref: ref, id: buttonId, "aria-haspopup": true, "aria-expanded": isOpen, "aria-controls": menuId, onClick: handleButtonClick, onKeyDown: handleButtonKeyDown, appearance: buttonAppearance, variant: buttonVariant, children: button$1 }));
|
|
161
|
+
return (jsxRuntime.jsx(button.Button, { "data-testid": "menu-button", ref: ref, id: buttonId, "aria-haspopup": true, "aria-expanded": isOpen, "aria-controls": menuId, onClick: handleButtonClick, onKeyDown: handleButtonKeyDown, className: buttonClassName, appearance: buttonAppearance, variant: buttonVariant, children: button$1 }));
|
|
163
162
|
};
|
|
164
163
|
return (jsxRuntime.jsx(popover.Popover, { className: "dc-menu__container", placement: placement, alignment: alignment, anchor: renderAnchor, isOpen: isOpen, onClose: closeMenu, children: jsxRuntime.jsx("ul", { ...props, className: reactHelpers.classNames('dc-menu', className), role: "menu", id: menuId, "aria-labelledby": buttonId, onKeyDown: handleMenuKeyDown, children: react.Children.map(children, (child) => {
|
|
165
164
|
if (isMenuItem(child)) {
|
package/css/draft-components.css
CHANGED
|
@@ -3232,6 +3232,7 @@
|
|
|
3232
3232
|
}
|
|
3233
3233
|
|
|
3234
3234
|
.dc-menu {
|
|
3235
|
+
--dc-menu-item-icon-gap: 8px;
|
|
3235
3236
|
--dc-menu-item-color: var(--dc-button-default-plain-text-color);
|
|
3236
3237
|
--dc-menu-item-bg: var(--dc-button-default-bg-hover);
|
|
3237
3238
|
--dc-menu-item-color-destructive: var(--dc-button-danger-plain-text-color);
|
|
@@ -3272,6 +3273,7 @@
|
|
|
3272
3273
|
width: 100%;
|
|
3273
3274
|
height: 32px;
|
|
3274
3275
|
padding: 0 12px;
|
|
3276
|
+
text-align: left;
|
|
3275
3277
|
white-space: nowrap;
|
|
3276
3278
|
border: none;
|
|
3277
3279
|
border-radius: 6px;
|
|
@@ -3287,9 +3289,16 @@
|
|
|
3287
3289
|
background: var(--dc-menu-item-bg);
|
|
3288
3290
|
}
|
|
3289
3291
|
|
|
3290
|
-
.dc-menu-
|
|
3291
|
-
|
|
3292
|
-
|
|
3292
|
+
.dc-menu-btn__label {
|
|
3293
|
+
flex-grow: 1;
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
.dc-menu-btn__label_gap_left {
|
|
3297
|
+
padding-left: var(--dc-menu-item-icon-gap);
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
.dc-menu-btn__label_gap_right {
|
|
3301
|
+
padding-right: var(--dc-menu-item-icon-gap);
|
|
3293
3302
|
}
|
|
3294
3303
|
|
|
3295
3304
|
.dc-menu-btn_destructive {
|
|
@@ -2,11 +2,18 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { classNames } from '../../lib/react-helpers.js';
|
|
4
4
|
|
|
5
|
-
const MenuItem = forwardRef(function MenuItem({
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const MenuItem = forwardRef(function MenuItem({ role = 'menuitem', appearance = 'default', iconLeft = null, iconRight = null, className, children, ...props }, ref) {
|
|
6
|
+
let label = children;
|
|
7
|
+
if (iconLeft || iconRight) {
|
|
8
|
+
const className = classNames('dc-menu-btn__label', {
|
|
9
|
+
'dc-menu-btn__label_gap_left': iconLeft,
|
|
10
|
+
'dc-menu-btn__label_gap_right': iconRight,
|
|
11
|
+
});
|
|
12
|
+
label = jsx("span", { className: className, children: label });
|
|
13
|
+
}
|
|
14
|
+
return (jsx("li", { role: "presentation", children: jsxs("button", { ...props, ref: ref, className: classNames(className, 'dc-menu-btn', {
|
|
8
15
|
[`dc-menu-btn_${appearance}`]: appearance,
|
|
9
|
-
}), type: "button", role:
|
|
16
|
+
}), type: "button", role: role, tabIndex: -1, children: [iconLeft, label, iconRight] }) }));
|
|
10
17
|
});
|
|
11
18
|
|
|
12
19
|
export { MenuItem };
|
|
@@ -8,7 +8,7 @@ import '../button/icon-button.js';
|
|
|
8
8
|
import { Popover } from '../popover/popover.js';
|
|
9
9
|
import { MenuItem } from './menu-item.js';
|
|
10
10
|
|
|
11
|
-
function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start', buttonAppearance = 'default', buttonVariant = 'filled', button, className, children, onOpen, onClose, onKeyDown, ...props }) {
|
|
11
|
+
function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start', buttonClassName = '', buttonAppearance = 'default', buttonVariant = 'filled', button, className, children, onOpen, onClose, onKeyDown, ...props }) {
|
|
12
12
|
const id = useId();
|
|
13
13
|
const menuId = props.id || id;
|
|
14
14
|
const buttonId = `menu-button-${menuId}`;
|
|
@@ -81,12 +81,11 @@ function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start'
|
|
|
81
81
|
const handleButtonClick = (event) => {
|
|
82
82
|
if (isOpen) {
|
|
83
83
|
closeMenu();
|
|
84
|
-
focusMenuButton();
|
|
85
84
|
}
|
|
86
85
|
else {
|
|
87
86
|
openMenu();
|
|
88
|
-
window.setTimeout(focusFirstMenuItem);
|
|
89
87
|
}
|
|
88
|
+
focusMenuButton();
|
|
90
89
|
event.preventDefault();
|
|
91
90
|
event.stopPropagation();
|
|
92
91
|
};
|
|
@@ -157,7 +156,7 @@ function Menu({ defaultIsOpen = false, placement = 'bottom', alignment = 'start'
|
|
|
157
156
|
closeMenu,
|
|
158
157
|
});
|
|
159
158
|
}
|
|
160
|
-
return (jsx(Button, { ref: ref, id: buttonId, "aria-haspopup": true, "aria-expanded": isOpen, "aria-controls": menuId, onClick: handleButtonClick, onKeyDown: handleButtonKeyDown, appearance: buttonAppearance, variant: buttonVariant, children: button }));
|
|
159
|
+
return (jsx(Button, { "data-testid": "menu-button", ref: ref, id: buttonId, "aria-haspopup": true, "aria-expanded": isOpen, "aria-controls": menuId, onClick: handleButtonClick, onKeyDown: handleButtonKeyDown, className: buttonClassName, appearance: buttonAppearance, variant: buttonVariant, children: button }));
|
|
161
160
|
};
|
|
162
161
|
return (jsx(Popover, { className: "dc-menu__container", placement: placement, alignment: alignment, anchor: renderAnchor, isOpen: isOpen, onClose: closeMenu, children: jsx("ul", { ...props, className: classNames('dc-menu', className), role: "menu", id: menuId, "aria-labelledby": buttonId, onKeyDown: handleMenuKeyDown, children: Children.map(children, (child) => {
|
|
163
162
|
if (isMenuItem(child)) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef, type ReactNode } from 'react';
|
|
2
2
|
type MenuItemHTMLProps = ComponentPropsWithRef<'button'>;
|
|
3
|
-
type MenuItemBaseProps = Omit<MenuItemHTMLProps, 'children'>;
|
|
3
|
+
type MenuItemBaseProps = Omit<MenuItemHTMLProps, 'children' | 'role'>;
|
|
4
4
|
export type MenuItemAppearance = 'default' | 'destructive';
|
|
5
|
+
export type MenuItemRole = 'menuitem' | 'menuitemradio';
|
|
5
6
|
export type MenuItemProps = {
|
|
7
|
+
role?: MenuItemRole;
|
|
6
8
|
appearance?: MenuItemAppearance;
|
|
7
|
-
|
|
9
|
+
iconLeft?: ReactNode;
|
|
10
|
+
iconRight?: ReactNode;
|
|
8
11
|
children: ReactNode;
|
|
9
12
|
} & MenuItemBaseProps;
|
|
10
|
-
export declare const MenuItem: import("react").ForwardRefExoticComponent<Pick<MenuItemProps, "hidden" | "form" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "
|
|
13
|
+
export declare const MenuItem: import("react").ForwardRefExoticComponent<Pick<MenuItemProps, "hidden" | "form" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "appearance" | "value" | "type" | "name" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "iconLeft" | "iconRight"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
11
14
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentPropsWithoutRef, type KeyboardEventHandler, type MouseEventHandler, type ReactNode, type RefCallback } from 'react';
|
|
2
2
|
import { type ButtonAppearance, type ButtonVariant } from '../button';
|
|
3
3
|
import { type PopoverAlignment, type PopoverPlacement } from '../popover';
|
|
4
|
-
export type
|
|
4
|
+
export type MenuButtonRenderFn = (props: {
|
|
5
5
|
ref: RefCallback<HTMLElement>;
|
|
6
6
|
id: string;
|
|
7
7
|
'aria-haspopup': true;
|
|
@@ -23,9 +23,10 @@ export type MenuProps = {
|
|
|
23
23
|
alignment?: MenuAlignment;
|
|
24
24
|
onOpen?: () => void;
|
|
25
25
|
onClose?: () => void;
|
|
26
|
-
button: ReactNode |
|
|
26
|
+
button: ReactNode | MenuButtonRenderFn;
|
|
27
|
+
buttonClassName?: string;
|
|
27
28
|
buttonAppearance?: ButtonAppearance;
|
|
28
29
|
buttonVariant?: ButtonVariant;
|
|
29
30
|
} & MenuHTMLProps;
|
|
30
|
-
export declare function Menu({ defaultIsOpen, placement, alignment, buttonAppearance, buttonVariant, button, className, children, onOpen, onClose, onKeyDown, ...props }: MenuProps): JSX.Element;
|
|
31
|
+
export declare function Menu({ defaultIsOpen, placement, alignment, buttonClassName, buttonAppearance, buttonVariant, button, className, children, onOpen, onClose, onKeyDown, ...props }: MenuProps): JSX.Element;
|
|
31
32
|
export {};
|