@neo4j-ndl/react 4.5.9 → 4.5.11
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/lib/cjs/ai/more-files/stories/more-files.story.js +1 -1
- package/lib/cjs/ai/more-files/stories/more-files.story.js.map +1 -1
- package/lib/cjs/ai/prompt/Prompt.js +1 -1
- package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
- package/lib/cjs/ai/user-bubble/stories/user-bubble-and-files.story.js +1 -1
- package/lib/cjs/ai/user-bubble/stories/user-bubble-and-files.story.js.map +1 -1
- package/lib/cjs/breadcrumbs/stories/breadcrumbs-ellipses.story.js +1 -1
- package/lib/cjs/breadcrumbs/stories/breadcrumbs-ellipses.story.js.map +1 -1
- package/lib/cjs/breadcrumbs/stories/breadcrumbs-header.story.js +1 -1
- package/lib/cjs/breadcrumbs/stories/breadcrumbs-header.story.js.map +1 -1
- package/lib/cjs/data-grid/Components.js +2 -2
- package/lib/cjs/data-grid/Components.js.map +1 -1
- package/lib/cjs/dropdown-button/stories/dropdown-button-with-menu.story.js +1 -3
- package/lib/cjs/dropdown-button/stories/dropdown-button-with-menu.story.js.map +1 -1
- package/lib/cjs/menu/Menu.js +42 -6
- package/lib/cjs/menu/Menu.js.map +1 -1
- package/lib/cjs/menu/menu-types.js.map +1 -1
- package/lib/cjs/menu/stories/index.js +9 -1
- package/lib/cjs/menu/stories/index.js.map +1 -1
- package/lib/cjs/menu/stories/menu-custom-items.story.js +2 -2
- package/lib/cjs/menu/stories/menu-custom-items.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-default.story.js +14 -14
- package/lib/cjs/menu/stories/menu-default.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-in-dialog.story.js +2 -2
- package/lib/cjs/menu/stories/menu-in-dialog.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-in-popover.story.js +2 -2
- package/lib/cjs/menu/stories/menu-in-popover.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-nested.story.js +2 -2
- package/lib/cjs/menu/stories/menu-nested.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-placements.story.js +14 -14
- package/lib/cjs/menu/stories/menu-placements.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-radio-and-normal.story.js +44 -0
- package/lib/cjs/menu/stories/menu-radio-and-normal.story.js.map +1 -0
- package/lib/cjs/menu/stories/menu-radio-items.story.js +45 -0
- package/lib/cjs/menu/stories/menu-radio-items.story.js.map +1 -0
- package/lib/cjs/menu/stories/menu-with-category.story.js +2 -2
- package/lib/cjs/menu/stories/menu-with-category.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-disabled-item.story.js +2 -2
- package/lib/cjs/menu/stories/menu-with-disabled-item.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-divider.story.js +2 -2
- package/lib/cjs/menu/stories/menu-with-divider.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-icon.story.js +2 -2
- package/lib/cjs/menu/stories/menu-with-icon.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu-with-keyboard-shortcuts.story.js +2 -2
- package/lib/cjs/menu/stories/menu-with-keyboard-shortcuts.story.js.map +1 -1
- package/lib/cjs/menu/stories/menu.stories.js +29 -1
- package/lib/cjs/menu/stories/menu.stories.js.map +1 -1
- package/lib/cjs/select-icon-button/stories/select-icon-button-with-menu.story.js +1 -3
- package/lib/cjs/select-icon-button/stories/select-icon-button-with-menu.story.js.map +1 -1
- package/lib/cjs/text-link/TextLink.js +3 -2
- package/lib/cjs/text-link/TextLink.js.map +1 -1
- package/lib/cjs/text-link/stories/index.js +5 -1
- package/lib/cjs/text-link/stories/index.js.map +1 -1
- package/lib/cjs/text-link/stories/text-link-external-underline.story.js +30 -0
- package/lib/cjs/text-link/stories/text-link-external-underline.story.js.map +1 -0
- package/lib/cjs/text-link/stories/text-link-internal-underline.story.js +1 -1
- package/lib/cjs/text-link/stories/text-link-internal-underline.story.js.map +1 -1
- package/lib/cjs/text-link/stories/text-link.stories.js +14 -1
- package/lib/cjs/text-link/stories/text-link.stories.js.map +1 -1
- package/lib/esm/ai/more-files/stories/more-files.story.js +1 -1
- package/lib/esm/ai/more-files/stories/more-files.story.js.map +1 -1
- package/lib/esm/ai/prompt/Prompt.js +2 -2
- package/lib/esm/ai/prompt/Prompt.js.map +1 -1
- package/lib/esm/ai/user-bubble/stories/user-bubble-and-files.story.js +1 -1
- package/lib/esm/ai/user-bubble/stories/user-bubble-and-files.story.js.map +1 -1
- package/lib/esm/breadcrumbs/stories/breadcrumbs-ellipses.story.js +1 -1
- package/lib/esm/breadcrumbs/stories/breadcrumbs-ellipses.story.js.map +1 -1
- package/lib/esm/breadcrumbs/stories/breadcrumbs-header.story.js +2 -2
- package/lib/esm/breadcrumbs/stories/breadcrumbs-header.story.js.map +1 -1
- package/lib/esm/data-grid/Components.js +2 -2
- package/lib/esm/data-grid/Components.js.map +1 -1
- package/lib/esm/dropdown-button/stories/dropdown-button-with-menu.story.js +1 -3
- package/lib/esm/dropdown-button/stories/dropdown-button-with-menu.story.js.map +1 -1
- package/lib/esm/menu/Menu.js +43 -7
- package/lib/esm/menu/Menu.js.map +1 -1
- package/lib/esm/menu/menu-types.js.map +1 -1
- package/lib/esm/menu/stories/index.js +6 -0
- package/lib/esm/menu/stories/index.js.map +1 -1
- package/lib/esm/menu/stories/menu-custom-items.story.js +2 -2
- package/lib/esm/menu/stories/menu-custom-items.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-default.story.js +14 -14
- package/lib/esm/menu/stories/menu-default.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-in-dialog.story.js +2 -2
- package/lib/esm/menu/stories/menu-in-dialog.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-in-popover.story.js +2 -2
- package/lib/esm/menu/stories/menu-in-popover.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-nested.story.js +2 -2
- package/lib/esm/menu/stories/menu-nested.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-placements.story.js +14 -14
- package/lib/esm/menu/stories/menu-placements.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-radio-and-normal.story.js +42 -0
- package/lib/esm/menu/stories/menu-radio-and-normal.story.js.map +1 -0
- package/lib/esm/menu/stories/menu-radio-items.story.js +43 -0
- package/lib/esm/menu/stories/menu-radio-items.story.js.map +1 -0
- package/lib/esm/menu/stories/menu-with-category.story.js +2 -2
- package/lib/esm/menu/stories/menu-with-category.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-disabled-item.story.js +2 -2
- package/lib/esm/menu/stories/menu-with-disabled-item.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-divider.story.js +2 -2
- package/lib/esm/menu/stories/menu-with-divider.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-icon.story.js +2 -2
- package/lib/esm/menu/stories/menu-with-icon.story.js.map +1 -1
- package/lib/esm/menu/stories/menu-with-keyboard-shortcuts.story.js +2 -2
- package/lib/esm/menu/stories/menu-with-keyboard-shortcuts.story.js.map +1 -1
- package/lib/esm/menu/stories/menu.stories.js +29 -1
- package/lib/esm/menu/stories/menu.stories.js.map +1 -1
- package/lib/esm/select-icon-button/stories/select-icon-button-with-menu.story.js +1 -3
- package/lib/esm/select-icon-button/stories/select-icon-button-with-menu.story.js.map +1 -1
- package/lib/esm/text-link/TextLink.js +3 -2
- package/lib/esm/text-link/TextLink.js.map +1 -1
- package/lib/esm/text-link/stories/index.js +3 -0
- package/lib/esm/text-link/stories/index.js.map +1 -1
- package/lib/esm/text-link/stories/text-link-external-underline.story.js +28 -0
- package/lib/esm/text-link/stories/text-link-external-underline.story.js.map +1 -0
- package/lib/esm/text-link/stories/text-link-internal-underline.story.js +3 -3
- package/lib/esm/text-link/stories/text-link-internal-underline.story.js.map +1 -1
- package/lib/esm/text-link/stories/text-link.stories.js +14 -1
- package/lib/esm/text-link/stories/text-link.stories.js.map +1 -1
- package/lib/types/ai/more-files/stories/more-files.story.d.ts.map +1 -1
- package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
- package/lib/types/ai/user-bubble/stories/user-bubble-and-files.story.d.ts.map +1 -1
- package/lib/types/breadcrumbs/stories/breadcrumbs-ellipses.story.d.ts.map +1 -1
- package/lib/types/breadcrumbs/stories/breadcrumbs-header.story.d.ts.map +1 -1
- package/lib/types/data-grid/Components.d.ts.map +1 -1
- package/lib/types/dropdown-button/stories/dropdown-button-with-menu.story.d.ts.map +1 -1
- package/lib/types/menu/Menu.d.ts +8 -3
- package/lib/types/menu/Menu.d.ts.map +1 -1
- package/lib/types/menu/menu-types.d.ts +9 -0
- package/lib/types/menu/menu-types.d.ts.map +1 -1
- package/lib/types/menu/stories/index.d.ts +4 -0
- package/lib/types/menu/stories/index.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-custom-items.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-default.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-in-dialog.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-in-popover.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-nested.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-placements.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-radio-and-normal.story.d.ts +24 -0
- package/lib/types/menu/stories/menu-radio-and-normal.story.d.ts.map +1 -0
- package/lib/types/menu/stories/menu-radio-items.story.d.ts +24 -0
- package/lib/types/menu/stories/menu-radio-items.story.d.ts.map +1 -0
- package/lib/types/menu/stories/menu-with-category.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-disabled-item.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-divider.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-icon.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu-with-keyboard-shortcuts.story.d.ts.map +1 -1
- package/lib/types/menu/stories/menu.stories.d.ts +2 -0
- package/lib/types/menu/stories/menu.stories.d.ts.map +1 -1
- package/lib/types/select-icon-button/stories/select-icon-button-with-menu.story.d.ts.map +1 -1
- package/lib/types/text-link/TextLink.d.ts +6 -5
- package/lib/types/text-link/TextLink.d.ts.map +1 -1
- package/lib/types/text-link/stories/index.d.ts +2 -0
- package/lib/types/text-link/stories/index.d.ts.map +1 -1
- package/lib/types/text-link/stories/text-link-external-underline.story.d.ts +24 -0
- package/lib/types/text-link/stories/text-link-external-underline.story.d.ts.map +1 -0
- package/lib/types/text-link/stories/text-link-internal-underline.story.d.ts.map +1 -1
- package/lib/types/text-link/stories/text-link.stories.d.ts +1 -0
- package/lib/types/text-link/stories/text-link.stories.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-button-with-menu.story.js","sourceRoot":"","sources":["../../../../src/dropdown-button/stories/dropdown-button-with-menu.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,SAAS,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACzD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO,CACL,0BACE,KAAC,cAAc,IACb,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAC3C,GAAG,EAAE,SAAS,gCAGC,EACjB,
|
|
1
|
+
{"version":3,"file":"dropdown-button-with-menu.story.js","sourceRoot":"","sources":["../../../../src/dropdown-button/stories/dropdown-button-with-menu.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,SAAS,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACzD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO,CACL,0BACE,KAAC,cAAc,IACb,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAC3C,GAAG,EAAE,SAAS,gCAGC,EACjB,MAAC,IAAI,IACH,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,aAEnC,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,UAAU,GAAG,EAC9B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,UAAU,GAAG,EAC9B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,UAAU,GAAG,EAC9B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,UAAU,GAAG,IACzB,IACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DropdownButton, Menu } from '@neo4j-ndl/react';\nimport { useRef, useState } from 'react';\n\nconst Component = () => {\n const anchorRef = useRef<HTMLButtonElement | null>(null);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n\n return (\n <div>\n <DropdownButton\n isOpen={isMenuOpen}\n onClick={() => setIsMenuOpen((old) => !old)}\n ref={anchorRef}\n >\n Dropdown Button\n </DropdownButton>\n <Menu\n isOpen={isMenuOpen}\n anchorRef={anchorRef}\n onClose={() => setIsMenuOpen(false)}\n >\n <Menu.Item title=\"Action 1\" />\n <Menu.Item title=\"Action 2\" />\n <Menu.Item title=\"Action 3\" />\n <Menu.Item title=\"Action 4\" />\n </Menu>\n </div>\n );\n};\n\nexport default Component;\n"]}
|
package/lib/esm/menu/Menu.js
CHANGED
|
@@ -36,7 +36,7 @@ import { createContext, useContext, useEffect, useRef, useState } from 'react';
|
|
|
36
36
|
import { ConditionalWrap } from '../conditional-wrap';
|
|
37
37
|
import { useIsInsideDialog } from '../dialog/dialog-context';
|
|
38
38
|
import { Divider } from '../divider';
|
|
39
|
-
import { ChevronRightIconOutline } from '../icons';
|
|
39
|
+
import { CheckIconOutline, ChevronRightIconOutline } from '../icons';
|
|
40
40
|
import { placementTranslation } from '../popover';
|
|
41
41
|
import { useNeedleTheme } from '../theme';
|
|
42
42
|
const MenuContext = createContext({
|
|
@@ -193,22 +193,26 @@ const MenuComponent = ({ children, isOpen: controlledOpen, onClose, isRoot, anch
|
|
|
193
193
|
setHasFocusInside,
|
|
194
194
|
}, children: _jsx(FloatingList, { elementsRef: elementsRef, labelsRef: labelsRef, children: isOpen && (_jsx(ConditionalWrap, { shouldWrap: isPortaled, wrap: (wrapChildren) => (_jsx(FloatingPortal, { root: portalTarget, children: wrapChildren })), children: _jsx(FloatingFocusManager, { context: context, modal: false, initialFocus: 0, returnFocus: !isNested, closeOnFocusOut: true, guards: true, children: _jsx(Component, Object.assign({ ref: refs.setFloating, className: menuClasses, style: Object.assign({ minWidth: minWidth !== undefined ? `${minWidth}px` : undefined }, floatingStyles) }, getFloatingProps(), { children: children })) }) })) }) })] }));
|
|
195
195
|
};
|
|
196
|
+
/**
|
|
197
|
+
* @internal This is used to build the menu item components. Do not export this component.
|
|
198
|
+
*/
|
|
196
199
|
const MenuItemComponent = (_a) => {
|
|
197
|
-
var { title, leadingContent, trailingContent, description, isDisabled, as, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["title", "leadingContent", "trailingContent", "description", "isDisabled", "as", "className", "style", "htmlAttributes", "ref"]);
|
|
200
|
+
var { title, leadingContent, trailingContent, preLeadingContent, description, isDisabled, as, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["title", "leadingContent", "trailingContent", "preLeadingContent", "description", "isDisabled", "as", "className", "style", "htmlAttributes", "ref"]);
|
|
198
201
|
const classes = classNames(`ndl-menu-item`, className, {
|
|
199
202
|
'ndl-disabled': isDisabled,
|
|
200
203
|
});
|
|
201
204
|
const Component = as !== null && as !== void 0 ? as : 'button';
|
|
202
|
-
return (_jsx(Component, Object.assign({ className: classes, ref: ref, type: "button", role: "menuitem", disabled: isDisabled, style: style }, restProps, htmlAttributes, { children: _jsxs("div", { className: "ndl-menu-item-inner", children: [Boolean(leadingContent) && (_jsx("div", { className: "ndl-menu-item-leading-content", children: leadingContent })), _jsxs("div", { className: "ndl-menu-item-title-wrapper", children: [_jsx("div", { className: "ndl-menu-item-title", children: title }), Boolean(description) && (_jsx("div", { className: "ndl-menu-item-description", children: description }))] }), Boolean(trailingContent) && (_jsx("div", { className: "ndl-menu-item-trailing-content", children: trailingContent }))] }) })));
|
|
205
|
+
return (_jsx(Component, Object.assign({ className: classes, ref: ref, type: "button", role: "menuitem", disabled: isDisabled, style: style }, restProps, htmlAttributes, { children: _jsxs("div", { className: "ndl-menu-item-inner", children: [Boolean(preLeadingContent) && (_jsx("div", { className: "ndl-menu-item-pre-leading-content", children: preLeadingContent })), Boolean(leadingContent) && (_jsx("div", { className: "ndl-menu-item-leading-content", children: leadingContent })), _jsxs("div", { className: "ndl-menu-item-title-wrapper", children: [_jsx("div", { className: "ndl-menu-item-title", children: title }), Boolean(description) && (_jsx("div", { className: "ndl-menu-item-description", children: description }))] }), Boolean(trailingContent) && (_jsx("div", { className: "ndl-menu-item-trailing-content", children: trailingContent }))] }) })));
|
|
203
206
|
};
|
|
204
|
-
const MenuItem = (
|
|
207
|
+
const MenuItem = (_a) => {
|
|
208
|
+
var { title, className, style, leadingVisual, trailingContent, description, isDisabled, as, onClick, onFocus, htmlAttributes, id, ref } = _a, restProps = __rest(_a, ["title", "className", "style", "leadingVisual", "trailingContent", "description", "isDisabled", "as", "onClick", "onFocus", "htmlAttributes", "id", "ref"]);
|
|
205
209
|
const menu = useContext(MenuContext);
|
|
206
210
|
const itemLabel = typeof title === 'string' ? title : undefined;
|
|
207
211
|
const item = useListItem({ label: isDisabled === true ? null : itemLabel });
|
|
208
212
|
const tree = useFloatingTree();
|
|
209
213
|
const isActive = item.index === menu.activeIndex;
|
|
210
214
|
const mergedRefs = useMergeRefs([item.ref, ref]);
|
|
211
|
-
return (_jsx(MenuItemComponent, { as: as !== null && as !== void 0 ? as : 'button', style: style, className: className, ref: mergedRefs, title: title, description: description, leadingContent: leadingVisual, trailingContent: trailingContent, isDisabled: isDisabled, htmlAttributes: Object.assign(Object.assign(Object.assign({}, htmlAttributes), { tabIndex: isActive ? 0 : -1 }), menu.getItemProps({
|
|
215
|
+
return (_jsx(MenuItemComponent, Object.assign({ as: as !== null && as !== void 0 ? as : 'button', style: style, className: className, ref: mergedRefs, title: title, description: description, leadingContent: leadingVisual, trailingContent: trailingContent, isDisabled: isDisabled, htmlAttributes: Object.assign(Object.assign(Object.assign({}, htmlAttributes), { tabIndex: isActive ? 0 : -1 }), menu.getItemProps({
|
|
212
216
|
id: id,
|
|
213
217
|
onClick(event) {
|
|
214
218
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
@@ -218,8 +222,7 @@ const MenuItem = ({ title, className, style, leadingVisual, trailingContent, des
|
|
|
218
222
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
219
223
|
menu.setHasFocusInside(true);
|
|
220
224
|
},
|
|
221
|
-
|
|
222
|
-
})) }));
|
|
225
|
+
})) }, restProps)));
|
|
223
226
|
};
|
|
224
227
|
const NestedMenuItem = ({ title, isDisabled, description, leadingVisual, as, onFocus, onClick, className, style, htmlAttributes, id, ref, }) => {
|
|
225
228
|
const menu = useContext(MenuContext);
|
|
@@ -246,17 +249,50 @@ const CategoryItem = (_a) => {
|
|
|
246
249
|
const Component = as !== null && as !== void 0 ? as : 'div';
|
|
247
250
|
return (_jsx(Component, Object.assign({ className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: children })));
|
|
248
251
|
};
|
|
252
|
+
const RadioItem = (_a) => {
|
|
253
|
+
var { title, leadingVisual, trailingContent, description, isDisabled, isChecked = false, onClick, onFocus, className, style, as, id, htmlAttributes, ref } = _a, restProps = __rest(_a, ["title", "leadingVisual", "trailingContent", "description", "isDisabled", "isChecked", "onClick", "onFocus", "className", "style", "as", "id", "htmlAttributes", "ref"]);
|
|
254
|
+
const menu = useContext(MenuContext);
|
|
255
|
+
const itemLabel = typeof title === 'string' ? title : undefined;
|
|
256
|
+
const item = useListItem({ label: isDisabled === true ? null : itemLabel });
|
|
257
|
+
const tree = useFloatingTree();
|
|
258
|
+
const isActive = item.index === menu.activeIndex;
|
|
259
|
+
const mergedRefs = useMergeRefs([item.ref, ref]);
|
|
260
|
+
const classes = classNames('ndl-menu-radio-item', className, {
|
|
261
|
+
'ndl-checked': isChecked,
|
|
262
|
+
});
|
|
263
|
+
return (_jsx(MenuItemComponent, Object.assign({ as: as !== null && as !== void 0 ? as : 'button', style: style, className: classes, ref: mergedRefs, title: title, description: description, preLeadingContent: isChecked ? (_jsx(CheckIconOutline, { className: "n-size-5 n-shrink-0 n-self-center" })) : null, leadingContent: leadingVisual, trailingContent: trailingContent, isDisabled: isDisabled, htmlAttributes: Object.assign(Object.assign(Object.assign({}, htmlAttributes), { 'aria-checked': isChecked, role: 'menuitemradio', tabIndex: isActive ? 0 : -1 }), menu.getItemProps({
|
|
264
|
+
id: id,
|
|
265
|
+
onClick(event) {
|
|
266
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
267
|
+
tree === null || tree === void 0 ? void 0 : tree.events.emit('click', { id });
|
|
268
|
+
},
|
|
269
|
+
onFocus(event) {
|
|
270
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
271
|
+
menu.setHasFocusInside(true);
|
|
272
|
+
},
|
|
273
|
+
})) }, restProps)));
|
|
274
|
+
};
|
|
249
275
|
const MenuItems = (_a) => {
|
|
250
276
|
var { as, children, className, htmlAttributes, style, ref } = _a, restProps = __rest(_a, ["as", "children", "className", "htmlAttributes", "style", "ref"]);
|
|
251
277
|
const classes = classNames('ndl-menu-items', className);
|
|
252
278
|
const Component = as !== null && as !== void 0 ? as : 'div';
|
|
253
279
|
return (_jsx(Component, Object.assign({ className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: children })));
|
|
254
280
|
};
|
|
281
|
+
const MenuGroup = (_a) => {
|
|
282
|
+
var { children, className, htmlAttributes, style, ref } = _a, restProps = __rest(_a, ["children", "className", "htmlAttributes", "style", "ref"]);
|
|
283
|
+
const classes = classNames('ndl-menu-group', className);
|
|
284
|
+
return (_jsx("div", Object.assign({ className: classes, style: style, ref: ref, role: "group" }, restProps, htmlAttributes, { children: children })));
|
|
285
|
+
};
|
|
255
286
|
const Menu = Object.assign(MenuWrapper, {
|
|
256
287
|
CategoryItem: CategoryItem,
|
|
257
288
|
Divider: Divider,
|
|
289
|
+
Group: MenuGroup,
|
|
258
290
|
Item: MenuItem,
|
|
291
|
+
/**
|
|
292
|
+
* @deprecated Use Menu.Group instead if you want to group items together. If not, you can just omit this component in your implementation.
|
|
293
|
+
*/
|
|
259
294
|
Items: MenuItems,
|
|
295
|
+
RadioItem: RadioItem,
|
|
260
296
|
});
|
|
261
297
|
export { Menu };
|
|
262
298
|
//# sourceMappingURL=Menu.js.map
|
package/lib/esm/menu/Menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/menu/Menu.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,MAAM,EACN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAU1C,MAAM,WAAW,GAAG,aAAa,CAQ9B;IACD,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,MAAM,EAAE,K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D,OAAO,CACL,KAAC,SAAS,kBACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAsC,EAQZ,EAAE,EAAE;QARQ,EACtD,EAAE,EACF,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,GAAG,OAEuC,EADvC,SAAS,cAP0C,iEAQvD,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IACxD,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,KAAK,CAAC;IACjD,OAAO,CACL,KAAC,SAAS,kBACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;IACtC,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,SAAS;CACjB,CAAC,CAAC;AACH,OAAO,EAAE,IAAI,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingList,\n FloatingNode,\n FloatingPortal,\n FloatingTree,\n offset,\n safePolygon,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useFloatingNodeId,\n useFloatingParentNodeId,\n useFloatingTree,\n useHover,\n useInteractions,\n useListItem,\n useListNavigation,\n useMergeRefs,\n useRole,\n useTypeahead,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext, useEffect, useRef, useState } from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { Divider } from '../divider';\nimport { ChevronRightIconOutline } from '../icons';\nimport { placementTranslation } from '../popover';\nimport { useNeedleTheme } from '../theme';\nimport type {\n CategoryItemProps,\n MenuItemComponentProps,\n MenuItemProps,\n MenuItemsProps,\n MenuProps,\n NestedMenuItemProps,\n} from './menu-types';\n\nconst MenuContext = createContext<{\n getItemProps: (\n userProps?: React.HTMLProps<HTMLElement>,\n ) => Record<string, unknown>;\n activeIndex: number | null;\n setActiveIndex: React.Dispatch<React.SetStateAction<number | null>>;\n setHasFocusInside: React.Dispatch<React.SetStateAction<boolean>>;\n isOpen: boolean;\n}>({\n activeIndex: null,\n getItemProps: () => ({}),\n isOpen: false,\n // oxlint-disable-next-line @typescript-eslint/no-empty-function\n setActiveIndex: () => {},\n // oxlint-disable-next-line @typescript-eslint/no-empty-function\n setHasFocusInside: () => {},\n});\n\nconst MenuWrapper = (props: React.ComponentProps<typeof MenuComponent>) => {\n const parentId = useFloatingParentNodeId();\n\n if (parentId === null) {\n return (\n <FloatingTree>\n <MenuComponent {...props} isRoot />\n </FloatingTree>\n );\n }\n\n return <MenuComponent {...props} />;\n};\n\nconst MenuComponent = <T extends React.ElementType = 'div'>({\n children,\n isOpen: controlledOpen,\n onClose,\n isRoot,\n anchorRef,\n as,\n className,\n placement,\n minWidth,\n title,\n isDisabled,\n description,\n icon,\n isPortaled = true,\n portalTarget,\n htmlAttributes,\n strategy,\n ref: forwardedRef,\n}: PolymorphicCommonProps<T, MenuProps>) => {\n const [isOpen, setIsOpen] = useState(false);\n const [hasFocusInside, setHasFocusInside] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n\n const elementsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const labelsRef = useRef<Array<string | null>>([]);\n const parent = useContext(MenuContext);\n\n const isInsideDialog = useIsInsideDialog();\n const tree = useFloatingTree();\n const nodeId = useFloatingNodeId();\n const parentId = useFloatingParentNodeId();\n const item = useListItem();\n const { themeClassName } = useNeedleTheme();\n useEffect(() => {\n if (controlledOpen === undefined) {\n return;\n }\n setIsOpen(controlledOpen);\n }, [controlledOpen]);\n\n useEffect(() => {\n if (isOpen) {\n setActiveIndex(0);\n }\n }, [isOpen]);\n\n const Component = as ?? 'div';\n\n const isNested = parentId !== null;\n\n const defaultPlacement = isNested ? 'right-start' : 'bottom-start';\n\n const { floatingStyles, refs, context } = useFloating<HTMLButtonElement>({\n elements: {\n reference: anchorRef?.current,\n },\n middleware: [\n offset({\n alignmentAxis: isNested ? -4 : 0,\n mainAxis: isNested ? 0 : 4,\n }),\n flip({\n fallbackPlacements: ['left-start', 'right-start'],\n }),\n shift(),\n ],\n nodeId,\n onOpenChange: (open, event) => {\n if (controlledOpen === undefined) {\n setIsOpen(open);\n }\n\n if (!open) {\n if (event instanceof PointerEvent) {\n onClose?.(event, { type: 'backdropClick' });\n } else if (event instanceof KeyboardEvent) {\n onClose?.(event, { type: 'escapeKeyDown' });\n }\n }\n },\n open: isOpen,\n placement: placement ? placementTranslation[placement] : defaultPlacement,\n strategy: strategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n\n const hover = useHover(context, {\n delay: { open: 75 },\n enabled: isNested,\n handleClose: safePolygon({ blockPointerEvents: true }),\n });\n const click = useClick(context, {\n event: 'mousedown',\n ignoreMouse: isNested,\n toggle: !isNested,\n });\n const role = useRole(context, { role: 'menu' });\n const dismiss = useDismiss(context, { bubbles: true });\n const listNavigation = useListNavigation(context, {\n activeIndex,\n listRef: elementsRef,\n nested: isNested,\n onNavigate: setActiveIndex,\n });\n const typeahead = useTypeahead(context, {\n activeIndex,\n listRef: labelsRef,\n onMatch: isOpen ? setActiveIndex : undefined,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions(\n [hover, click, role, dismiss, listNavigation, typeahead],\n );\n\n // Event emitter allows you to communicate across tree components.\n // This effect closes all menus when an item gets clicked anywhere\n // in the tree.\n useEffect(() => {\n if (!tree) {\n return;\n }\n\n function handleTreeClick(data: { id?: string }) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { id: data?.id, type: 'itemClick' });\n }\n\n function onSubMenuOpen(event: { nodeId: string; parentId: string }) {\n if (event.nodeId !== nodeId && event.parentId === parentId) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { type: 'itemClick' });\n }\n }\n\n tree.events.on('click', handleTreeClick);\n tree.events.on('menuopen', onSubMenuOpen);\n\n return () => {\n tree.events.off('click', handleTreeClick);\n tree.events.off('menuopen', onSubMenuOpen);\n };\n }, [tree, nodeId, parentId, onClose, controlledOpen]);\n\n useEffect(() => {\n if (isOpen && tree) {\n tree.events.emit('menuopen', { nodeId, parentId });\n }\n }, [tree, isOpen, nodeId, parentId]);\n\n const menuClasses = classNames('ndl-menu', themeClassName, className);\n const ref = useMergeRefs([refs.setReference, item.ref, forwardedRef]);\n\n return (\n <FloatingNode id={nodeId}>\n {isRoot !== true && (\n <NestedMenuItem\n ref={ref}\n className={isNested ? 'MenuItem' : 'RootMenu'}\n isDisabled={isDisabled}\n htmlAttributes={{\n 'data-focus-inside': hasFocusInside ? '' : undefined,\n 'data-nested': isNested ? '' : undefined,\n 'data-open': isOpen ? '' : undefined,\n role: isNested ? 'menuitem' : undefined,\n tabIndex: !isNested\n ? undefined\n : parent.activeIndex === item.index\n ? 0\n : -1,\n ...htmlAttributes,\n ...getReferenceProps(\n parent.getItemProps({\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n htmlAttributes?.onFocus?.(event);\n setHasFocusInside(false);\n parent.setHasFocusInside(true);\n },\n }),\n ),\n }}\n title={title}\n description={description}\n leadingVisual={icon}\n />\n )}\n <MenuContext.Provider\n value={{\n activeIndex,\n getItemProps,\n isOpen: isDisabled === true ? false : isOpen,\n setActiveIndex,\n setHasFocusInside,\n }}\n >\n <FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>\n {isOpen && (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal root={portalTarget}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={0}\n returnFocus={!isNested}\n closeOnFocusOut={true}\n guards={true}\n >\n <Component\n ref={refs.setFloating}\n className={menuClasses}\n style={{\n minWidth:\n minWidth !== undefined ? `${minWidth}px` : undefined,\n ...floatingStyles,\n }}\n {...getFloatingProps()}\n >\n {children}\n </Component>\n </FloatingFocusManager>\n </ConditionalWrap>\n )}\n </FloatingList>\n </MenuContext.Provider>\n </FloatingNode>\n );\n};\n\nconst MenuItemComponent = <T extends React.ElementType = 'button'>({\n title,\n leadingContent,\n trailingContent,\n description,\n isDisabled,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemComponentProps>) => {\n const classes = classNames(`ndl-menu-item`, className, {\n 'ndl-disabled': isDisabled,\n });\n\n const Component = as ?? 'button';\n\n return (\n <Component\n className={classes}\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n disabled={isDisabled}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-menu-item-inner\">\n {Boolean(leadingContent) && (\n <div className=\"ndl-menu-item-leading-content\">{leadingContent}</div>\n )}\n\n <div className=\"ndl-menu-item-title-wrapper\">\n <div className=\"ndl-menu-item-title\">{title}</div>\n {Boolean(description) && (\n <div className=\"ndl-menu-item-description\">{description}</div>\n )}\n </div>\n\n {Boolean(trailingContent) && (\n <div className=\"ndl-menu-item-trailing-content\">\n {trailingContent}\n </div>\n )}\n </div>\n </Component>\n );\n};\n\nconst MenuItem = <T extends React.ElementType = 'button'>({\n title,\n className,\n style,\n leadingVisual,\n trailingContent,\n description,\n isDisabled,\n as,\n onClick,\n onFocus,\n htmlAttributes,\n id,\n ref,\n}: PolymorphicCommonProps<T, MenuItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: isDisabled === true ? null : itemLabel });\n const tree = useFloatingTree();\n const isActive = item.index === menu.activeIndex;\n\n const mergedRefs = useMergeRefs([item.ref, ref]);\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={className}\n ref={mergedRefs}\n title={title}\n description={description}\n leadingContent={leadingVisual}\n trailingContent={trailingContent}\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n id: id,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event);\n tree?.events.emit('click', { id });\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n style: style,\n }),\n }}\n />\n );\n};\n\nconst NestedMenuItem = <T extends React.ElementType = 'button'>({\n title,\n isDisabled,\n description,\n leadingVisual,\n as,\n onFocus,\n onClick,\n className,\n style,\n htmlAttributes,\n id,\n ref,\n}: PolymorphicCommonProps<T, NestedMenuItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: isDisabled === true ? null : itemLabel });\n const isActive = item.index === menu.activeIndex;\n const mergedRefs = useMergeRefs([item.ref, ref]);\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={className}\n ref={mergedRefs}\n title={title}\n description={description}\n leadingContent={leadingVisual}\n trailingContent={\n <ChevronRightIconOutline className=\"ndl-menu-item-chevron\" />\n }\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event);\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n onTouchStart() {\n menu.setHasFocusInside(true);\n },\n }),\n id: id,\n }}\n />\n );\n};\n\nconst CategoryItem = <T extends React.ElementType = 'button'>({\n children,\n className,\n style,\n as,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, CategoryItemProps>) => {\n const classes = classNames('ndl-menu-category-item', className);\n const Component: React.ElementType = as ?? 'div';\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst MenuItems = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n htmlAttributes,\n style,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemsProps>) => {\n const classes = classNames('ndl-menu-items', className);\n const Component: React.ElementType = as ?? 'div';\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Menu = Object.assign(MenuWrapper, {\n CategoryItem: CategoryItem,\n Divider: Divider,\n Item: MenuItem,\n Items: MenuItems,\n});\nexport { Menu };\n"]}
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/menu/Menu.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EAC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U,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IACxD,OAAO,CACL,4BACE,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,OAAO,IACR,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;IACtC,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,QAAQ;IACd;;OAEG;IACH,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;AACH,OAAO,EAAE,IAAI,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingList,\n FloatingNode,\n FloatingPortal,\n FloatingTree,\n offset,\n safePolygon,\n shift,\n useClick,\n useDismiss,\n useFloating,\n useFloatingNodeId,\n useFloatingParentNodeId,\n useFloatingTree,\n useHover,\n useInteractions,\n useListItem,\n useListNavigation,\n useMergeRefs,\n useRole,\n useTypeahead,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext, useEffect, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { Divider } from '../divider';\nimport { CheckIconOutline, ChevronRightIconOutline } from '../icons';\nimport { placementTranslation } from '../popover';\nimport { useNeedleTheme } from '../theme';\nimport type {\n CategoryItemProps,\n MenuGroupProps,\n MenuItemComponentProps,\n MenuItemProps,\n MenuItemsProps,\n MenuProps,\n NestedMenuItemProps,\n RadioItemProps,\n} from './menu-types';\n\nconst MenuContext = createContext<{\n getItemProps: (\n userProps?: React.HTMLProps<HTMLElement>,\n ) => Record<string, unknown>;\n activeIndex: number | null;\n setActiveIndex: React.Dispatch<React.SetStateAction<number | null>>;\n setHasFocusInside: React.Dispatch<React.SetStateAction<boolean>>;\n isOpen: boolean;\n}>({\n activeIndex: null,\n getItemProps: () => ({}),\n isOpen: false,\n // oxlint-disable-next-line @typescript-eslint/no-empty-function\n setActiveIndex: () => {},\n // oxlint-disable-next-line @typescript-eslint/no-empty-function\n setHasFocusInside: () => {},\n});\n\nconst MenuWrapper = (props: React.ComponentProps<typeof MenuComponent>) => {\n const parentId = useFloatingParentNodeId();\n\n if (parentId === null) {\n return (\n <FloatingTree>\n <MenuComponent {...props} isRoot />\n </FloatingTree>\n );\n }\n\n return <MenuComponent {...props} />;\n};\n\nconst MenuComponent = <T extends React.ElementType = 'div'>({\n children,\n isOpen: controlledOpen,\n onClose,\n isRoot,\n anchorRef,\n as,\n className,\n placement,\n minWidth,\n title,\n isDisabled,\n description,\n icon,\n isPortaled = true,\n portalTarget,\n htmlAttributes,\n strategy,\n ref: forwardedRef,\n}: PolymorphicCommonProps<T, MenuProps>) => {\n const [isOpen, setIsOpen] = useState(false);\n const [hasFocusInside, setHasFocusInside] = useState(false);\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n\n const elementsRef = useRef<Array<HTMLButtonElement | null>>([]);\n const labelsRef = useRef<Array<string | null>>([]);\n const parent = useContext(MenuContext);\n\n const isInsideDialog = useIsInsideDialog();\n const tree = useFloatingTree();\n const nodeId = useFloatingNodeId();\n const parentId = useFloatingParentNodeId();\n const item = useListItem();\n const { themeClassName } = useNeedleTheme();\n useEffect(() => {\n if (controlledOpen === undefined) {\n return;\n }\n setIsOpen(controlledOpen);\n }, [controlledOpen]);\n\n useEffect(() => {\n if (isOpen) {\n setActiveIndex(0);\n }\n }, [isOpen]);\n\n const Component = as ?? 'div';\n\n const isNested = parentId !== null;\n\n const defaultPlacement = isNested ? 'right-start' : 'bottom-start';\n\n const { floatingStyles, refs, context } = useFloating<HTMLButtonElement>({\n elements: {\n reference: anchorRef?.current,\n },\n middleware: [\n offset({\n alignmentAxis: isNested ? -4 : 0,\n mainAxis: isNested ? 0 : 4,\n }),\n flip({\n fallbackPlacements: ['left-start', 'right-start'],\n }),\n shift(),\n ],\n nodeId,\n onOpenChange: (open, event) => {\n if (controlledOpen === undefined) {\n setIsOpen(open);\n }\n\n if (!open) {\n if (event instanceof PointerEvent) {\n onClose?.(event, { type: 'backdropClick' });\n } else if (event instanceof KeyboardEvent) {\n onClose?.(event, { type: 'escapeKeyDown' });\n }\n }\n },\n open: isOpen,\n placement: placement ? placementTranslation[placement] : defaultPlacement,\n strategy: strategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n\n const hover = useHover(context, {\n delay: { open: 75 },\n enabled: isNested,\n handleClose: safePolygon({ blockPointerEvents: true }),\n });\n const click = useClick(context, {\n event: 'mousedown',\n ignoreMouse: isNested,\n toggle: !isNested,\n });\n const role = useRole(context, { role: 'menu' });\n const dismiss = useDismiss(context, { bubbles: true });\n const listNavigation = useListNavigation(context, {\n activeIndex,\n listRef: elementsRef,\n nested: isNested,\n onNavigate: setActiveIndex,\n });\n const typeahead = useTypeahead(context, {\n activeIndex,\n listRef: labelsRef,\n onMatch: isOpen ? setActiveIndex : undefined,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions(\n [hover, click, role, dismiss, listNavigation, typeahead],\n );\n\n // Event emitter allows you to communicate across tree components.\n // This effect closes all menus when an item gets clicked anywhere\n // in the tree.\n useEffect(() => {\n if (!tree) {\n return;\n }\n\n function handleTreeClick(data: { id?: string }) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { id: data?.id, type: 'itemClick' });\n }\n\n function onSubMenuOpen(event: { nodeId: string; parentId: string }) {\n if (event.nodeId !== nodeId && event.parentId === parentId) {\n if (controlledOpen === undefined) {\n setIsOpen(false);\n }\n onClose?.(undefined, { type: 'itemClick' });\n }\n }\n\n tree.events.on('click', handleTreeClick);\n tree.events.on('menuopen', onSubMenuOpen);\n\n return () => {\n tree.events.off('click', handleTreeClick);\n tree.events.off('menuopen', onSubMenuOpen);\n };\n }, [tree, nodeId, parentId, onClose, controlledOpen]);\n\n useEffect(() => {\n if (isOpen && tree) {\n tree.events.emit('menuopen', { nodeId, parentId });\n }\n }, [tree, isOpen, nodeId, parentId]);\n\n const menuClasses = classNames('ndl-menu', themeClassName, className);\n const ref = useMergeRefs([refs.setReference, item.ref, forwardedRef]);\n\n return (\n <FloatingNode id={nodeId}>\n {isRoot !== true && (\n <NestedMenuItem\n ref={ref}\n className={isNested ? 'MenuItem' : 'RootMenu'}\n isDisabled={isDisabled}\n htmlAttributes={{\n 'data-focus-inside': hasFocusInside ? '' : undefined,\n 'data-nested': isNested ? '' : undefined,\n 'data-open': isOpen ? '' : undefined,\n role: isNested ? 'menuitem' : undefined,\n tabIndex: !isNested\n ? undefined\n : parent.activeIndex === item.index\n ? 0\n : -1,\n ...htmlAttributes,\n ...getReferenceProps(\n parent.getItemProps({\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n htmlAttributes?.onFocus?.(event);\n setHasFocusInside(false);\n parent.setHasFocusInside(true);\n },\n }),\n ),\n }}\n title={title}\n description={description}\n leadingVisual={icon}\n />\n )}\n <MenuContext.Provider\n value={{\n activeIndex,\n getItemProps,\n isOpen: isDisabled === true ? false : isOpen,\n setActiveIndex,\n setHasFocusInside,\n }}\n >\n <FloatingList elementsRef={elementsRef} labelsRef={labelsRef}>\n {isOpen && (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal root={portalTarget}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={0}\n returnFocus={!isNested}\n closeOnFocusOut={true}\n guards={true}\n >\n <Component\n ref={refs.setFloating}\n className={menuClasses}\n style={{\n minWidth:\n minWidth !== undefined ? `${minWidth}px` : undefined,\n ...floatingStyles,\n }}\n {...getFloatingProps()}\n >\n {children}\n </Component>\n </FloatingFocusManager>\n </ConditionalWrap>\n )}\n </FloatingList>\n </MenuContext.Provider>\n </FloatingNode>\n );\n};\n\n/**\n * @internal This is used to build the menu item components. Do not export this component.\n */\nconst MenuItemComponent = <T extends React.ElementType = 'button'>({\n title,\n leadingContent,\n trailingContent,\n preLeadingContent,\n description,\n isDisabled,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemComponentProps>) => {\n const classes = classNames(`ndl-menu-item`, className, {\n 'ndl-disabled': isDisabled,\n });\n\n const Component = as ?? 'button';\n\n return (\n <Component\n className={classes}\n ref={ref}\n type=\"button\"\n role=\"menuitem\"\n disabled={isDisabled}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-menu-item-inner\">\n {Boolean(preLeadingContent) && (\n <div className=\"ndl-menu-item-pre-leading-content\">\n {preLeadingContent}\n </div>\n )}\n {Boolean(leadingContent) && (\n <div className=\"ndl-menu-item-leading-content\">{leadingContent}</div>\n )}\n\n <div className=\"ndl-menu-item-title-wrapper\">\n <div className=\"ndl-menu-item-title\">{title}</div>\n {Boolean(description) && (\n <div className=\"ndl-menu-item-description\">{description}</div>\n )}\n </div>\n\n {Boolean(trailingContent) && (\n <div className=\"ndl-menu-item-trailing-content\">\n {trailingContent}\n </div>\n )}\n </div>\n </Component>\n );\n};\n\nconst MenuItem = <T extends React.ElementType = 'button'>({\n title,\n className,\n style,\n leadingVisual,\n trailingContent,\n description,\n isDisabled,\n as,\n onClick,\n onFocus,\n htmlAttributes,\n id,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: isDisabled === true ? null : itemLabel });\n const tree = useFloatingTree();\n const isActive = item.index === menu.activeIndex;\n\n const mergedRefs = useMergeRefs([item.ref, ref]);\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={className}\n ref={mergedRefs}\n title={title}\n description={description}\n leadingContent={leadingVisual}\n trailingContent={trailingContent}\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n id: id,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event);\n tree?.events.emit('click', { id });\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n }),\n }}\n {...restProps}\n />\n );\n};\n\nconst NestedMenuItem = <T extends React.ElementType = 'button'>({\n title,\n isDisabled,\n description,\n leadingVisual,\n as,\n onFocus,\n onClick,\n className,\n style,\n htmlAttributes,\n id,\n ref,\n}: PolymorphicCommonProps<T, NestedMenuItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: isDisabled === true ? null : itemLabel });\n const isActive = item.index === menu.activeIndex;\n const mergedRefs = useMergeRefs([item.ref, ref]);\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={className}\n ref={mergedRefs}\n title={title}\n description={description}\n leadingContent={leadingVisual}\n trailingContent={\n <ChevronRightIconOutline className=\"ndl-menu-item-chevron\" />\n }\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event);\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n onTouchStart() {\n menu.setHasFocusInside(true);\n },\n }),\n id: id,\n }}\n />\n );\n};\n\nconst CategoryItem = <T extends React.ElementType = 'button'>({\n children,\n className,\n style,\n as,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, CategoryItemProps>) => {\n const classes = classNames('ndl-menu-category-item', className);\n const Component: React.ElementType = as ?? 'div';\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst RadioItem = <T extends React.ElementType = 'button'>({\n title,\n leadingVisual,\n trailingContent,\n description,\n isDisabled,\n isChecked = false,\n onClick,\n onFocus,\n className,\n style,\n as,\n id,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, RadioItemProps>) => {\n const menu = useContext(MenuContext);\n const itemLabel = typeof title === 'string' ? title : undefined;\n const item = useListItem({ label: isDisabled === true ? null : itemLabel });\n const tree = useFloatingTree();\n const isActive = item.index === menu.activeIndex;\n\n const mergedRefs = useMergeRefs([item.ref, ref]);\n const classes = classNames('ndl-menu-radio-item', className, {\n 'ndl-checked': isChecked,\n });\n\n return (\n <MenuItemComponent\n as={as ?? 'button'}\n style={style}\n className={classes}\n ref={mergedRefs}\n title={title}\n description={description}\n preLeadingContent={\n isChecked ? (\n <CheckIconOutline className=\"n-size-5 n-shrink-0 n-self-center\" />\n ) : null\n }\n leadingContent={leadingVisual}\n trailingContent={trailingContent}\n isDisabled={isDisabled}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-checked': isChecked,\n role: 'menuitemradio',\n tabIndex: isActive ? 0 : -1,\n ...menu.getItemProps({\n id: id,\n onClick(event: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(event);\n tree?.events.emit('click', { id });\n },\n onFocus(event: React.FocusEvent<HTMLButtonElement>) {\n onFocus?.(event);\n menu.setHasFocusInside(true);\n },\n }),\n }}\n {...restProps}\n />\n );\n};\n\nconst MenuItems = <T extends React.ElementType = 'div'>({\n as,\n children,\n className,\n htmlAttributes,\n style,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, MenuItemsProps>) => {\n const classes = classNames('ndl-menu-items', className);\n const Component: React.ElementType = as ?? 'div';\n return (\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst MenuGroup = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', MenuGroupProps>) => {\n const classes = classNames('ndl-menu-group', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n role=\"group\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nconst Menu = Object.assign(MenuWrapper, {\n CategoryItem: CategoryItem,\n Divider: Divider,\n Group: MenuGroup,\n Item: MenuItem,\n /**\n * @deprecated Use Menu.Group instead if you want to group items together. If not, you can just omit this component in your implementation.\n */\n Items: MenuItems,\n RadioItem: RadioItem,\n});\nexport { Menu };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-types.js","sourceRoot":"","sources":["../../../src/menu/menu-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Popover } from '../popover';\n\nexport interface MenuProps {\n /** Whether the menu is open or closed (uncontrolled when omitted) */\n isOpen?: boolean;\n /** Callback function that is called when the menu closes */\n onClose?: (\n event: Event | undefined,\n closeReason: {\n type: 'backdropClick' | 'itemClick' | 'escapeKeyDown';\n id?: string;\n },\n ) => void;\n /** Anchor element ref for positioning */\n anchorRef?: React.RefObject<HTMLElement | null>;\n /** Content displayed inside the menu */\n children?: React.ReactNode;\n /** Whether the menu is a root menu instance. This is set internally by the component based on nesting */\n isRoot?: boolean;\n /** The placement of the floating element is determined by two sets of words. The first set of words specifies the point on the anchor element where the floating element will be attached. The second set of coordinates specifies the point on the floating element that will attach to the anchor element.*/\n placement?: React.ComponentProps<typeof Popover>['placement'];\n /** Minimum width in pixels for the menu component */\n minWidth?: number;\n /** Optional title for nested trigger rendering */\n title?: string;\n /** Whether the menu trigger is disabled */\n isDisabled?: boolean;\n /** Optional description for nested trigger rendering */\n description?: React.ReactNode;\n /** Optional icon for nested trigger rendering */\n icon?: React.ReactNode;\n /** Whether the menu should be wrapped in a floating portal */\n isPortaled?: boolean;\n /** Portal target element (defaults to `document.body`) */\n portalTarget?: HTMLElement | null;\n /** Positioning strategy used by Floating UI */\n strategy?: 'absolute' | 'fixed';\n}\n\nexport interface MenuItemProps {\n /** Title of the menu item component */\n title: React.ReactNode;\n /** Leading icon for the menu item component */\n leadingVisual?: React.ReactNode;\n trailingContent?: React.ReactNode;\n /** Supporting text below title */\n description?: React.ReactNode;\n /** Whether the menu item is disabled */\n isDisabled?: boolean;\n /** Callback function that is called when the menu item is clicked and it closes the menu tree */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Callback function that is called when the menu item is focused */\n onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;\n /** Unique identifier for the menu item */\n id?: string;\n /** Content displayed inside the menu item component */\n children?: React.ReactNode;\n}\n\nexport type NestedMenuItemProps = Omit<\n MenuItemProps,\n 'children' | 'trailingContent'\n>;\n\nexport interface MenuItemsProps {\n /** Content displayed inside the menu items component */\n children?: React.ReactNode;\n}\n\nexport interface CategoryItemProps {\n /** Content displayed inside the category item component */\n children?: React.ReactNode;\n}\n\nexport type MenuItemComponentProps = {\n title?: React.ReactNode;\n description?: React.ReactNode;\n className?: string;\n leadingContent?: React.ReactNode;\n trailingContent?: React.ReactNode;\n isDisabled?: boolean;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"menu-types.js","sourceRoot":"","sources":["../../../src/menu/menu-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type Popover } from '../popover';\n\nexport interface MenuProps {\n /** Whether the menu is open or closed (uncontrolled when omitted) */\n isOpen?: boolean;\n /** Callback function that is called when the menu closes */\n onClose?: (\n event: Event | undefined,\n closeReason: {\n type: 'backdropClick' | 'itemClick' | 'escapeKeyDown';\n id?: string;\n },\n ) => void;\n /** Anchor element ref for positioning */\n anchorRef?: React.RefObject<HTMLElement | null>;\n /** Content displayed inside the menu */\n children?: React.ReactNode;\n /** Whether the menu is a root menu instance. This is set internally by the component based on nesting */\n isRoot?: boolean;\n /** The placement of the floating element is determined by two sets of words. The first set of words specifies the point on the anchor element where the floating element will be attached. The second set of coordinates specifies the point on the floating element that will attach to the anchor element.*/\n placement?: React.ComponentProps<typeof Popover>['placement'];\n /** Minimum width in pixels for the menu component */\n minWidth?: number;\n /** Optional title for nested trigger rendering */\n title?: string;\n /** Whether the menu trigger is disabled */\n isDisabled?: boolean;\n /** Optional description for nested trigger rendering */\n description?: React.ReactNode;\n /** Optional icon for nested trigger rendering */\n icon?: React.ReactNode;\n /** Whether the menu should be wrapped in a floating portal */\n isPortaled?: boolean;\n /** Portal target element (defaults to `document.body`) */\n portalTarget?: HTMLElement | null;\n /** Positioning strategy used by Floating UI */\n strategy?: 'absolute' | 'fixed';\n}\n\nexport interface MenuItemProps {\n /** Title of the menu item component */\n title: React.ReactNode;\n /** Leading icon for the menu item component */\n leadingVisual?: React.ReactNode;\n trailingContent?: React.ReactNode;\n /** Supporting text below title */\n description?: React.ReactNode;\n /** Whether the menu item is disabled */\n isDisabled?: boolean;\n /** Callback function that is called when the menu item is clicked and it closes the menu tree */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Callback function that is called when the menu item is focused */\n onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;\n /** Unique identifier for the menu item */\n id?: string;\n /** Content displayed inside the menu item component */\n children?: React.ReactNode;\n}\n\nexport type NestedMenuItemProps = Omit<\n MenuItemProps,\n 'children' | 'trailingContent'\n>;\n\nexport interface MenuItemsProps {\n /** Content displayed inside the menu items component */\n children?: React.ReactNode;\n}\n\nexport interface CategoryItemProps {\n /** Content displayed inside the category item component */\n children?: React.ReactNode;\n}\n\nexport type MenuItemComponentProps = {\n title?: React.ReactNode;\n description?: React.ReactNode;\n className?: string;\n leadingContent?: React.ReactNode;\n trailingContent?: React.ReactNode;\n isDisabled?: boolean;\n preLeadingContent?: React.ReactNode;\n};\n\nexport type RadioItemProps = MenuItemProps & {\n /** Whether the radio item is checked. Marks the item as aria-checked. */\n isChecked?: boolean;\n};\n\nexport type MenuGroupProps = {\n /** Content displayed inside the group. */\n children?: React.ReactNode;\n};\n"]}
|
|
@@ -29,6 +29,8 @@ export { default as MenuDivider } from './menu-with-divider.story';
|
|
|
29
29
|
export { default as MenuWithDisabledItem } from './menu-with-disabled-item.story';
|
|
30
30
|
export { default as MenuPlacements } from './menu-placements.story';
|
|
31
31
|
export { default as MenuWithKeyboardShortcuts } from './menu-with-keyboard-shortcuts.story';
|
|
32
|
+
export { default as MenuRadioItems } from './menu-radio-items.story';
|
|
33
|
+
export { default as MenuRadioAndNormal } from './menu-radio-and-normal.story';
|
|
32
34
|
import { removeLicenseHeader } from '../../_common/export-stories-utils';
|
|
33
35
|
import MenuCustomItemsSrcRaw from './menu-custom-items.story?raw';
|
|
34
36
|
import MenuDefaultSrcRaw from './menu-default.story?raw';
|
|
@@ -36,6 +38,8 @@ import MenuInDialogSrcRaw from './menu-in-dialog.story?raw';
|
|
|
36
38
|
import MenuInPopoverSrcRaw from './menu-in-popover.story?raw';
|
|
37
39
|
import MenuNestedSrcRaw from './menu-nested.story?raw';
|
|
38
40
|
import MenuPlacementsSrcRaw from './menu-placements.story?raw';
|
|
41
|
+
import MenuRadioAndNormalSrcRaw from './menu-radio-and-normal.story?raw';
|
|
42
|
+
import MenuRadioItemsSrcRaw from './menu-radio-items.story?raw';
|
|
39
43
|
import MenuWithCategorySrcRaw from './menu-with-category.story?raw';
|
|
40
44
|
import MenuWithDisabledItemSrcRaw from './menu-with-disabled-item.story?raw';
|
|
41
45
|
import MenuDividerSrcRaw from './menu-with-divider.story?raw';
|
|
@@ -52,4 +56,6 @@ export const MenuDividerSrc = removeLicenseHeader(MenuDividerSrcRaw);
|
|
|
52
56
|
export const MenuWithDisabledItemSrc = removeLicenseHeader(MenuWithDisabledItemSrcRaw);
|
|
53
57
|
export const MenuPlacementsSrc = removeLicenseHeader(MenuPlacementsSrcRaw);
|
|
54
58
|
export const MenuWithKeyboardShortcutsSrc = removeLicenseHeader(MenuWithKeyboardShortcutsSrcRaw);
|
|
59
|
+
export const MenuRadioItemsSrc = removeLicenseHeader(MenuRadioItemsSrcRaw);
|
|
60
|
+
export const MenuRadioAndNormalSrc = removeLicenseHeader(MenuRadioAndNormalSrcRaw);
|
|
55
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/menu/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/menu/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAA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AM,0CAA0C,CAAC;AAEvF,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CACxD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAC7D,+BAA+B,CAChC,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as MenuDefault } from './menu-default.story';\nexport { default as MenuNested } from './menu-nested.story';\nexport { default as MenuWithCategory } from './menu-with-category.story';\nexport { default as MenuWithIcon } from './menu-with-icon.story';\nexport { default as MenuCustomItems } from './menu-custom-items.story';\nexport { default as MenuInPopover } from './menu-in-popover.story';\nexport { default as MenuInDialog } from './menu-in-dialog.story';\nexport { default as MenuDivider } from './menu-with-divider.story';\nexport { default as MenuWithDisabledItem } from './menu-with-disabled-item.story';\nexport { default as MenuPlacements } from './menu-placements.story';\nexport { default as MenuWithKeyboardShortcuts } from './menu-with-keyboard-shortcuts.story';\nexport { default as MenuRadioItems } from './menu-radio-items.story';\nexport { default as MenuRadioAndNormal } from './menu-radio-and-normal.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport MenuCustomItemsSrcRaw from './menu-custom-items.story?raw';\nimport MenuDefaultSrcRaw from './menu-default.story?raw';\nimport MenuInDialogSrcRaw from './menu-in-dialog.story?raw';\nimport MenuInPopoverSrcRaw from './menu-in-popover.story?raw';\nimport MenuNestedSrcRaw from './menu-nested.story?raw';\nimport MenuPlacementsSrcRaw from './menu-placements.story?raw';\nimport MenuRadioAndNormalSrcRaw from './menu-radio-and-normal.story?raw';\nimport MenuRadioItemsSrcRaw from './menu-radio-items.story?raw';\nimport MenuWithCategorySrcRaw from './menu-with-category.story?raw';\nimport MenuWithDisabledItemSrcRaw from './menu-with-disabled-item.story?raw';\nimport MenuDividerSrcRaw from './menu-with-divider.story?raw';\nimport MenuWithIconSrcRaw from './menu-with-icon.story?raw';\nimport MenuWithKeyboardShortcutsSrcRaw from './menu-with-keyboard-shortcuts.story?raw';\n\nexport const MenuDefaultSrc = removeLicenseHeader(MenuDefaultSrcRaw);\nexport const MenuNestedSrc = removeLicenseHeader(MenuNestedSrcRaw);\nexport const MenuWithCategorySrc = removeLicenseHeader(MenuWithCategorySrcRaw);\nexport const MenuWithIconSrc = removeLicenseHeader(MenuWithIconSrcRaw);\nexport const MenuCustomItemsSrc = removeLicenseHeader(MenuCustomItemsSrcRaw);\nexport const MenuInPopoverSrc = removeLicenseHeader(MenuInPopoverSrcRaw);\nexport const MenuInDialogSrc = removeLicenseHeader(MenuInDialogSrcRaw);\nexport const MenuDividerSrc = removeLicenseHeader(MenuDividerSrcRaw);\nexport const MenuWithDisabledItemSrc = removeLicenseHeader(\n MenuWithDisabledItemSrcRaw,\n);\nexport const MenuPlacementsSrc = removeLicenseHeader(MenuPlacementsSrcRaw);\nexport const MenuWithKeyboardShortcutsSrc = removeLicenseHeader(\n MenuWithKeyboardShortcutsSrcRaw,\n);\nexport const MenuRadioItemsSrc = removeLicenseHeader(MenuRadioItemsSrcRaw);\nexport const MenuRadioAndNormalSrc = removeLicenseHeader(\n MenuRadioAndNormalSrcRaw,\n);\n"]}
|
|
@@ -26,9 +26,9 @@ import { useRef, useState } from 'react';
|
|
|
26
26
|
const Component = () => {
|
|
27
27
|
const anchorEl = useRef(null);
|
|
28
28
|
const [isOpen, setIsOpen] = useState(false);
|
|
29
|
-
return (_jsxs(_Fragment, { children: [
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Menu, { isOpen: isOpen, anchorRef: anchorEl, placement: "bottom-start-top-start", onClose: (_event, _data) => {
|
|
30
30
|
setIsOpen(false);
|
|
31
|
-
}, children:
|
|
31
|
+
}, children: [_jsx(Menu.Item, { title: _jsx(Typography, { variant: "display", children: "This can be any element" }) }), _jsx(Menu.Item, { title: "Danger action 1", className: "n-text-danger-text" }), _jsx(Menu.Item, { title: "Danger action 2", className: "n-text-danger-text", leadingVisual: _jsx(Square2StackIconOutline, { className: "n-text-danger-icon" }) }), _jsxs(Menu, { title: "More actions", description: "Some additional actions", children: [_jsx(Menu.Item, { title: "Danger action 3", className: "n-text-danger-text", isDisabled: true }), _jsx(Menu.Item, { title: "Danger action 4", className: "n-text-danger-text" })] })] }), _jsx(FilledButton, { onClick: () => setIsOpen(true), ref: anchorEl, children: "Open Menu (set with custom placement)" })] }));
|
|
32
32
|
};
|
|
33
33
|
export default Component;
|
|
34
34
|
//# sourceMappingURL=menu-custom-items.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-custom-items.story.js","sourceRoot":"","sources":["../../../../src/menu/stories/menu-custom-items.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,QAAQ,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO,CACL,8BACE,
|
|
1
|
+
{"version":3,"file":"menu-custom-items.story.js","sourceRoot":"","sources":["../../../../src/menu/stories/menu-custom-items.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,QAAQ,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO,CACL,8BACE,MAAC,IAAI,IACH,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,QAAQ,EACnB,SAAS,EAAC,wBAAwB,EAClC,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;oBACzB,SAAS,CAAC,KAAK,CAAC,CAAC;gBACnB,CAAC,aAED,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EACH,KAAC,UAAU,IAAC,OAAO,EAAC,SAAS,wCAAqC,GAEpE,EACF,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,iBAAiB,EAAC,SAAS,EAAC,oBAAoB,GAAG,EACpE,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,iBAAiB,EACvB,SAAS,EAAC,oBAAoB,EAC9B,aAAa,EACX,KAAC,uBAAuB,IAAC,SAAS,EAAC,oBAAoB,GAAG,GAE5D,EACF,MAAC,IAAI,IAAC,KAAK,EAAC,cAAc,EAAC,WAAW,EAAC,yBAAyB,aAC9D,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,iBAAiB,EACvB,SAAS,EAAC,oBAAoB,EAC9B,UAAU,EAAE,IAAI,GAChB,EACF,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,iBAAiB,EAAC,SAAS,EAAC,oBAAoB,GAAG,IAC/D,IACF,EACP,KAAC,YAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,sDAE5C,IACd,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton, Menu, Typography } from '@neo4j-ndl/react';\nimport { Square2StackIconOutline } from '@neo4j-ndl/react/icons';\nimport { useRef, useState } from 'react';\n\nconst Component = () => {\n const anchorEl = useRef<HTMLButtonElement | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n\n return (\n <>\n <Menu\n isOpen={isOpen}\n anchorRef={anchorEl}\n placement=\"bottom-start-top-start\"\n onClose={(_event, _data) => {\n setIsOpen(false);\n }}\n >\n <Menu.Item\n title={\n <Typography variant=\"display\">This can be any element</Typography>\n }\n />\n <Menu.Item title=\"Danger action 1\" className=\"n-text-danger-text\" />\n <Menu.Item\n title=\"Danger action 2\"\n className=\"n-text-danger-text\"\n leadingVisual={\n <Square2StackIconOutline className=\"n-text-danger-icon\" />\n }\n />\n <Menu title=\"More actions\" description=\"Some additional actions\">\n <Menu.Item\n title=\"Danger action 3\"\n className=\"n-text-danger-text\"\n isDisabled={true}\n />\n <Menu.Item title=\"Danger action 4\" className=\"n-text-danger-text\" />\n </Menu>\n </Menu>\n <FilledButton onClick={() => setIsOpen(true)} ref={anchorEl}>\n Open Menu (set with custom placement)\n </FilledButton>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -25,21 +25,21 @@ import { useRef, useState } from 'react';
|
|
|
25
25
|
const Component = () => {
|
|
26
26
|
const anchorEl = useRef(null);
|
|
27
27
|
const [isOpen, setIsOpen] = useState(false);
|
|
28
|
-
return (_jsxs(_Fragment, { children: [
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Menu, { isOpen: isOpen, anchorRef: anchorEl, onClose: (_event, _data) => {
|
|
29
29
|
setIsOpen(false);
|
|
30
|
-
}, children:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
}, children: [_jsx(Menu.Item, { title: "Action 1", onClick: () => {
|
|
31
|
+
alert('Action1');
|
|
32
|
+
setIsOpen(false);
|
|
33
|
+
} }), _jsx(Menu.Item, { title: "Action 2", onClick: () => {
|
|
34
|
+
alert('Action2');
|
|
35
|
+
setIsOpen(false);
|
|
36
|
+
} }), _jsx(Menu.Item, { title: "Action 3", description: "Action 3 is disabled", isDisabled: true, onClick: () => {
|
|
37
|
+
alert('Action3');
|
|
38
|
+
setIsOpen(false);
|
|
39
|
+
} }), _jsx(Menu.Item, { title: "Action 4", description: "Action 4 is awesome", onClick: () => {
|
|
40
|
+
alert('Action4');
|
|
41
|
+
setIsOpen(false);
|
|
42
|
+
} })] }), _jsx(FilledButton, { onClick: () => setIsOpen(true), ref: anchorEl, children: "Open Menu" })] }));
|
|
43
43
|
};
|
|
44
44
|
export default Component;
|
|
45
45
|
//# sourceMappingURL=menu-default.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-default.story.js","sourceRoot":"","sources":["../../../../src/menu/stories/menu-default.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,QAAQ,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO,CACL,8BACE,
|
|
1
|
+
{"version":3,"file":"menu-default.story.js","sourceRoot":"","sources":["../../../../src/menu/stories/menu-default.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,QAAQ,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO,CACL,8BACE,MAAC,IAAI,IACH,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;oBACzB,SAAS,CAAC,KAAK,CAAC,CAAC;gBACnB,CAAC,aAED,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,UAAU,EAChB,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,CAAC,SAAS,CAAC,CAAC;4BACjB,SAAS,CAAC,KAAK,CAAC,CAAC;wBACnB,CAAC,GACD,EACF,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,UAAU,EAChB,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,CAAC,SAAS,CAAC,CAAC;4BACjB,SAAS,CAAC,KAAK,CAAC,CAAC;wBACnB,CAAC,GACD,EACF,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,UAAU,EAChB,WAAW,EAAC,sBAAsB,EAClC,UAAU,EAAE,IAAI,EAChB,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,CAAC,SAAS,CAAC,CAAC;4BACjB,SAAS,CAAC,KAAK,CAAC,CAAC;wBACnB,CAAC,GACD,EACF,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,UAAU,EAChB,WAAW,EAAC,qBAAqB,EACjC,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,CAAC,SAAS,CAAC,CAAC;4BACjB,SAAS,CAAC,KAAK,CAAC,CAAC;wBACnB,CAAC,GACD,IACG,EAEP,KAAC,YAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,0BAE5C,IACd,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton, Menu } from '@neo4j-ndl/react';\nimport { useRef, useState } from 'react';\n\nconst Component = () => {\n const anchorEl = useRef<HTMLButtonElement | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n\n return (\n <>\n <Menu\n isOpen={isOpen}\n anchorRef={anchorEl}\n onClose={(_event, _data) => {\n setIsOpen(false);\n }}\n >\n <Menu.Item\n title=\"Action 1\"\n onClick={() => {\n alert('Action1');\n setIsOpen(false);\n }}\n />\n <Menu.Item\n title=\"Action 2\"\n onClick={() => {\n alert('Action2');\n setIsOpen(false);\n }}\n />\n <Menu.Item\n title=\"Action 3\"\n description=\"Action 3 is disabled\"\n isDisabled={true}\n onClick={() => {\n alert('Action3');\n setIsOpen(false);\n }}\n />\n <Menu.Item\n title=\"Action 4\"\n description=\"Action 4 is awesome\"\n onClick={() => {\n alert('Action4');\n setIsOpen(false);\n }}\n />\n </Menu>\n\n <FilledButton onClick={() => setIsOpen(true)} ref={anchorEl}>\n Open Menu\n </FilledButton>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -30,11 +30,11 @@ const Component = () => {
|
|
|
30
30
|
const handleClick = () => setIsModalOpen((prev) => !prev);
|
|
31
31
|
const handleClose = () => setIsModalOpen(false);
|
|
32
32
|
const handleMenuClick = () => setIsOpen((prev) => !prev);
|
|
33
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, children: "Open Dialog" }) }), _jsxs(Dialog, { htmlAttributes: { id: 'modal-root' }, isOpen: isModalOpen, onClose: handleClose, children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleMenuClick, ref: anchorEl, children: "Open Menu" }) }),
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleClick, children: "Open Dialog" }) }), _jsxs(Dialog, { htmlAttributes: { id: 'modal-root' }, isOpen: isModalOpen, onClose: handleClose, children: [_jsx("div", { className: "n-flex n-justify-center", children: _jsx(FilledButton, { onClick: handleMenuClick, ref: anchorEl, children: "Open Menu" }) }), _jsxs(Menu, { isOpen: isOpen, anchorRef: anchorEl, onClose: (event, _data) => {
|
|
34
34
|
setIsOpen(false);
|
|
35
35
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
36
36
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
37
|
-
}, portalTarget: document.getElementById('modal-root'), children:
|
|
37
|
+
}, portalTarget: document.getElementById('modal-root'), children: [_jsx(Menu.Item, { title: "Undo", onClick: () => alert('Undo') }), _jsx(Menu.Item, { title: "Redo", isDisabled: true }), _jsx(Menu.Item, { title: "Cut", description: "Copy and remove" }), _jsxs(Menu, { title: "Copy as", description: "Copying as something", icon: _jsx(Square2StackIconOutline, {}), children: [_jsx(Menu.Item, { title: "Text" }), _jsx(Menu.Item, { title: "Video" }), _jsxs(Menu, { title: "Image", children: [_jsx(Menu.Item, { title: ".png" }), _jsx(Menu.Item, { title: ".jpg" }), _jsx(Menu.Item, { title: ".svg" }), _jsx(Menu.Item, { title: ".gif" })] }), _jsx(Menu.Item, { title: "Audio" }), _jsxs(Menu, { title: "Share", children: [_jsx(Menu.Item, { title: "Mail" }), _jsx(Menu.Item, { title: "Instagram" })] })] })] })] })] }));
|
|
38
38
|
};
|
|
39
39
|
export default Component;
|
|
40
40
|
//# sourceMappingURL=menu-in-dialog.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-in-dialog.story.js","sourceRoot":"","sources":["../../../../src/menu/stories/menu-in-dialog.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,QAAQ,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEtD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC1D,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AAC,uBAAuB,KAAG,aAEjC,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,EAC1B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,OAAO,GAAG,EAC3B,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,aACjB,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,EAC1B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,EAC1B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,EAC1B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,IACrB,EACP,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,OAAO,GAAG,EAC3B,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,aACjB,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,EAC1B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,WAAW,GAAG,IAC1B,IACF,IACF,IACA,IACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Dialog, FilledButton, Menu } from '@neo4j-ndl/react';\nimport { Square2StackIconOutline } from '@neo4j-ndl/react/icons';\nimport { useRef, useState } from 'react';\n\nconst Component = () => {\n const anchorEl = useRef<HTMLButtonElement | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleClick = () => setIsModalOpen((prev) => !prev);\n const handleClose = () => setIsModalOpen(false);\n const handleMenuClick = () => setIsOpen((prev) => !prev);\n\n return (\n <>\n <div className=\"n-flex n-justify-center\">\n <FilledButton onClick={handleClick}>Open Dialog</FilledButton>\n </div>\n <Dialog\n htmlAttributes={{ id: 'modal-root' }}\n isOpen={isModalOpen}\n onClose={handleClose}\n >\n <div className=\"n-flex n-justify-center\">\n <FilledButton onClick={handleMenuClick} ref={anchorEl}>\n Open Menu\n </FilledButton>\n </div>\n <Menu\n isOpen={isOpen}\n anchorRef={anchorEl}\n onClose={(event, _data) => {\n setIsOpen(false);\n event?.preventDefault();\n event?.stopPropagation();\n }}\n portalTarget={document.getElementById('modal-root')}\n >\n <Menu.Item title=\"Undo\" onClick={() => alert('Undo')} />\n <Menu.Item title=\"Redo\" isDisabled />\n <Menu.Item title=\"Cut\" description=\"Copy and remove\" />\n <Menu\n title=\"Copy as\"\n description=\"Copying as something\"\n icon={<Square2StackIconOutline />}\n >\n <Menu.Item title=\"Text\" />\n <Menu.Item title=\"Video\" />\n <Menu title=\"Image\">\n <Menu.Item title=\".png\" />\n <Menu.Item title=\".jpg\" />\n <Menu.Item title=\".svg\" />\n <Menu.Item title=\".gif\" />\n </Menu>\n <Menu.Item title=\"Audio\" />\n <Menu title=\"Share\">\n <Menu.Item title=\"Mail\" />\n <Menu.Item title=\"Instagram\" />\n </Menu>\n </Menu>\n </Menu>\n </Dialog>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -26,9 +26,9 @@ const Component = () => {
|
|
|
26
26
|
const anchorEl = useRef(null);
|
|
27
27
|
const [isOpen, setIsOpen] = useState(false);
|
|
28
28
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
29
|
-
return (_jsxs(_Fragment, { children: [
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Menu, { isOpen: isOpen, anchorRef: anchorEl, onClose: (_event, _data) => {
|
|
30
30
|
setIsOpen(false);
|
|
31
|
-
}, children:
|
|
31
|
+
}, children: [_jsx(Menu.Item, { title: "Action 1", onClick: () => alert('Action1') }), _jsx(Menu.Item, { title: "Action 2", onClick: () => alert('Action2') }), _jsx(Menu.Item, { title: "Action 3", description: "Action 3 is disabled", isDisabled: true, onClick: () => alert('Action3') }), _jsx(Menu.Item, { title: "Action 4", description: "Action 4 is awesome", onClick: () => alert('Action4') })] }), _jsxs(Popover, { isOpen: isPopoverOpen, children: [_jsx(Popover.Trigger, { children: _jsxs(FilledButton, { onClick: () => setIsPopoverOpen(!isPopoverOpen), children: [isPopoverOpen ? 'Close' : 'Open', " Popover"] }) }), _jsx(Popover.Content, { style: { height: 150, overflow: 'auto', width: 400 }, children: _jsxs(_Fragment, { children: [_jsx("p", { children: "Scroll me to the bottom to open menu Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." }), _jsx(FilledButton, { onClick: () => setIsOpen(true), ref: anchorEl, children: "Open Context Menu" })] }) })] })] }));
|
|
32
32
|
};
|
|
33
33
|
export default Component;
|
|
34
34
|
//# sourceMappingURL=menu-in-popover.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-in-popover.story.js","sourceRoot":"","sources":["../../../../src/menu/stories/menu-in-popover.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE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C,SAAS,CAAC,GAAI,EAC/D,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,UAAU,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,GAAI,EAC/D,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,UAAU,EAChB,WAAW,EAAC,sBAAsB,EAClC,UAAU,EAAE,IAAI,EAChB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,GAC/B,EACF,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,UAAU,EAChB,WAAW,EAAC,qBAAqB,EACjC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,GAC/B,IACG,EAEP,MAAC,OAAO,IAAC,MAAM,EAAE,aAAa,aAC5B,KAAC,OAAO,CAAC,OAAO,cACd,MAAC,YAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,aAC1D,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,gBACpB,GACC,EAClB,KAAC,OAAO,CAAC,OAAO,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,YACnE,8BACE,6fASI,EACJ,KAAC,YAAY,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,kCAE5C,IACd,GACa,IACV,IACT,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton, Menu, Popover } from '@neo4j-ndl/react';\nimport { useRef, useState } from 'react';\n\nconst Component = () => {\n const anchorEl = useRef<HTMLButtonElement | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n const [isPopoverOpen, setIsPopoverOpen] = useState(false);\n\n return (\n <>\n <Menu\n isOpen={isOpen}\n anchorRef={anchorEl}\n onClose={(_event, _data) => {\n setIsOpen(false);\n }}\n >\n <Menu.Item title=\"Action 1\" onClick={() => alert('Action1')} />\n <Menu.Item title=\"Action 2\" onClick={() => alert('Action2')} />\n <Menu.Item\n title=\"Action 3\"\n description=\"Action 3 is disabled\"\n isDisabled={true}\n onClick={() => alert('Action3')}\n />\n <Menu.Item\n title=\"Action 4\"\n description=\"Action 4 is awesome\"\n onClick={() => alert('Action4')}\n />\n </Menu>\n\n <Popover isOpen={isPopoverOpen}>\n <Popover.Trigger>\n <FilledButton onClick={() => setIsPopoverOpen(!isPopoverOpen)}>\n {isPopoverOpen ? 'Close' : 'Open'} Popover\n </FilledButton>\n </Popover.Trigger>\n <Popover.Content style={{ height: 150, overflow: 'auto', width: 400 }}>\n <>\n <p>\n Scroll me to the bottom to open menu Lorem ipsum dolor sit amet,\n consectetur adipiscing elit, sed do eiusmod tempor incididunt ut\n labore et dolore magna aliqua. Ut enim ad minim veniam, quis\n nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate\n velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint\n occaecat cupidatat non proident, sunt in culpa qui officia\n deserunt mollit anim id est laborum.\n </p>\n <FilledButton onClick={() => setIsOpen(true)} ref={anchorEl}>\n Open Context Menu\n </FilledButton>\n </>\n </Popover.Content>\n </Popover>\n </>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -26,9 +26,9 @@ import { useRef, useState } from 'react';
|
|
|
26
26
|
const Component = () => {
|
|
27
27
|
const anchorEl = useRef(null);
|
|
28
28
|
const [isOpen, setIsOpen] = useState(false);
|
|
29
|
-
return (_jsxs(_Fragment, { children: [
|
|
29
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Menu, { isOpen: isOpen, anchorRef: anchorEl, onClose: (_event, _data) => {
|
|
30
30
|
setIsOpen(false);
|
|
31
|
-
}, children:
|
|
31
|
+
}, children: [_jsx(Menu.Item, { title: "Undo", onClick: () => alert('Undo') }), _jsx(Menu.Item, { title: "Redo", isDisabled: true }), _jsx(Menu.Item, { title: "Cut", description: "Copy and remove" }), _jsxs(Menu, { title: "Copy as", description: "Copying as something", icon: _jsx(Square2StackIconOutline, {}), children: [_jsx(Menu.Item, { title: "Text" }), _jsx(Menu.Item, { title: "Video" }), _jsxs(Menu, { title: "Image", children: [_jsx(Menu.Item, { title: ".png" }), _jsx(Menu.Item, { title: ".jpg" }), _jsx(Menu.Item, { title: ".svg" }), _jsx(Menu.Item, { title: ".gif" })] }), _jsx(Menu.Item, { title: "Audio" })] }), _jsxs(Menu, { title: "Share", children: [_jsx(Menu.Item, { title: "Mail" }), _jsx(Menu.Item, { title: "Instagram" })] })] }), _jsx(FilledButton, { onClick: () => setIsOpen(true), ref: anchorEl, children: "Open Menu" })] }));
|
|
32
32
|
};
|
|
33
33
|
export default Component;
|
|
34
34
|
//# sourceMappingURL=menu-nested.story.js.map
|