@deque/cauldron-react 7.2.0-canary.e67992f2 → 7.2.0-canary.ef3abd52
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,27 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { onActionCallbackFunction } from '../ActionList/ActionListContext';
|
|
3
|
-
import AnchoredOverlay from '../AnchoredOverlay';
|
|
4
3
|
interface ActionMenuListProps {
|
|
5
4
|
ref?: React.Ref<HTMLElement>;
|
|
6
5
|
onAction?: onActionCallbackFunction;
|
|
7
6
|
[key: string]: unknown;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* defaults to `HTMLButtonElement`; annotate it (e.g. `ActionMenuTriggerProps<HTMLLIElement>`)
|
|
12
|
-
* when the trigger is not a button — for example a `MenuItem`/`TopBarItem`
|
|
13
|
-
* (`<li>`) in the documented `TopBar`/`MenuBar` nesting — so the `ref` and
|
|
14
|
-
* spread handlers type against the actual element without casts.
|
|
15
|
-
*/
|
|
16
|
-
export type ActionMenuTriggerProps<E extends HTMLElement = HTMLButtonElement> = Pick<React.HTMLAttributes<E>, 'children' | 'id' | 'onClick' | 'onKeyDown' | 'aria-expanded' | 'aria-haspopup' | 'aria-controls'> & {
|
|
17
|
-
ref: React.RefObject<E | null>;
|
|
8
|
+
type ActionMenuTriggerProps = Pick<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'onClick' | 'onKeyDown' | 'aria-expanded' | 'aria-haspopup' | 'aria-controls'> & {
|
|
9
|
+
ref: React.RefObject<HTMLButtonElement | null>;
|
|
18
10
|
};
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
type ActionMenuTriggerFunction = (props: ActionMenuTriggerProps, open: boolean) => React.ReactElement;
|
|
12
|
+
declare const ActionMenu: React.ForwardRefExoticComponent<{
|
|
21
13
|
children: React.ReactElement<ActionMenuListProps>;
|
|
22
|
-
trigger: React.ReactElement | ActionMenuTriggerFunction
|
|
14
|
+
trigger: React.ReactElement | ActionMenuTriggerFunction;
|
|
23
15
|
/** Render the action menu in a different location in the dom. */
|
|
24
|
-
portal?: React.RefObject<HTMLElement | null> |
|
|
16
|
+
portal?: HTMLElement | React.RefObject<HTMLElement | null> | undefined;
|
|
25
17
|
/**
|
|
26
18
|
* Controls whether the menu should render as a child of the trigger, as opposed to
|
|
27
19
|
* rendering as a sibling. Intended for use with nested menu patterns, for example
|
|
@@ -29,17 +21,25 @@ type ActionMenuProps<E extends HTMLElement = HTMLButtonElement> = {
|
|
|
29
21
|
*
|
|
30
22
|
* Only supported if trigger is a function *and* portal is undefined.
|
|
31
23
|
*/
|
|
32
|
-
renderInTrigger?: boolean;
|
|
33
|
-
} & Pick<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
renderInTrigger?: boolean | undefined;
|
|
25
|
+
} & Pick<{
|
|
26
|
+
target: HTMLElement | React.RefObject<HTMLElement | null> | React.MutableRefObject<HTMLElement | null>;
|
|
27
|
+
placement?: "auto" | import("@floating-ui/dom").Placement | "auto-start" | "auto-end" | undefined;
|
|
28
|
+
open?: boolean | undefined;
|
|
29
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
30
|
+
onPlacementChange?: ((placement: import("@floating-ui/dom").Placement) => void) | undefined;
|
|
31
|
+
onShiftChange?: ((coords: import("@floating-ui/dom").Coords) => void) | undefined;
|
|
32
|
+
offset?: number | undefined;
|
|
33
|
+
focusTrap?: boolean | undefined;
|
|
34
|
+
focusTrapOptions?: {
|
|
35
|
+
disabled?: boolean | undefined;
|
|
36
|
+
initialFocusElement?: import("../../types").ElementOrRef<HTMLElement> | undefined;
|
|
37
|
+
returnFocus?: boolean | undefined;
|
|
38
|
+
returnFocusElement?: import("../../types").ElementOrRef<HTMLElement> | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
portal?: HTMLElement | React.RefObject<HTMLElement | null> | undefined;
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
} & React.HTMLAttributes<HTMLElement> & {
|
|
43
|
+
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
44
|
+
} & React.RefAttributes<HTMLElement>, "placement"> & React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
|
|
45
45
|
export default ActionMenu;
|
package/lib/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export { default as PageHeader } from './components/PageHeader';
|
|
|
68
68
|
export { default as SectionHeader } from './components/SectionHeader';
|
|
69
69
|
export { default as EmptyState } from './components/EmptyState';
|
|
70
70
|
export { ActionList, ActionListItem, ActionListGroup, ActionListSeparator, ActionListLinkItem } from './components/ActionList';
|
|
71
|
-
export { ActionMenu
|
|
71
|
+
export { ActionMenu } from './components/ActionMenu';
|
|
72
72
|
export { default as TreeView, type TreeViewNode } from './components/TreeView';
|
|
73
73
|
/**
|
|
74
74
|
* Helpers / Utils
|
package/lib/index.js
CHANGED
|
@@ -5330,7 +5330,7 @@ var ActionListLinkItem = React.forwardRef(function (_a, ref) {
|
|
|
5330
5330
|
ActionListLinkItem.displayName = 'ActionListLinkItem';
|
|
5331
5331
|
|
|
5332
5332
|
var _a = tslib.__read(['ArrowDown', 'ArrowUp'], 2), ArrowDown = _a[0], ArrowUp = _a[1];
|
|
5333
|
-
var
|
|
5333
|
+
var ActionMenu = React.forwardRef(function (_a, ref) {
|
|
5334
5334
|
var className = _a.className, style = _a.style, trigger = _a.trigger, _b = _a.placement, placement = _b === void 0 ? 'bottom-start' : _b, actionMenuList = _a.children, portal = _a.portal, _c = _a.renderInTrigger, renderInTrigger = _c === void 0 ? false : _c, props = tslib.__rest(_a, ["className", "style", "trigger", "placement", "children", "portal", "renderInTrigger"]);
|
|
5335
5335
|
var _d = tslib.__read(React.useState(false), 2), open = _d[0], setOpen = _d[1];
|
|
5336
5336
|
var _e = tslib.__read(React.useState('first'), 2), focusStrategy = _e[0], setFocusStrategy = _e[1];
|
|
@@ -5448,8 +5448,7 @@ var ActionMenuComponent = React.forwardRef(function (_a, ref) {
|
|
|
5448
5448
|
React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: handleClickOutside, mouseEvent: open ? undefined : false, touchEvent: open ? undefined : false, target: triggerProps.ref }, actionMenuTrigger),
|
|
5449
5449
|
renderInTrigger ? null : overlay));
|
|
5450
5450
|
});
|
|
5451
|
-
|
|
5452
|
-
var ActionMenu = ActionMenuComponent;
|
|
5451
|
+
ActionMenu.displayName = 'ActionMenu';
|
|
5453
5452
|
|
|
5454
5453
|
var TreeViewItem = function (_a) {
|
|
5455
5454
|
var id = _a.id, textValue = _a.textValue, children = _a.children;
|
package/package.json
CHANGED