@vuu-ui/vuu-context-menu 4.0.0-alpha.11 → 4.0.0-alpha.12

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.0-alpha.11",
2
+ "version": "4.0.0-alpha.12",
3
3
  "author": "heswell",
4
4
  "main": "./src/index.js",
5
5
  "type": "module",
@@ -10,12 +10,12 @@
10
10
  "type-defs": "node ../../scripts/build-type-defs.mjs"
11
11
  },
12
12
  "devDependencies": {
13
- "@vuu-ui/vuu-data-types": "4.0.0-alpha.11",
14
- "@vuu-ui/vuu-protocol-types": "4.0.0-alpha.11",
15
- "@vuu-ui/vuu-table-types": "4.0.0-alpha.11"
13
+ "@vuu-ui/vuu-data-types": "4.0.0-alpha.12",
14
+ "@vuu-ui/vuu-protocol-types": "4.0.0-alpha.12",
15
+ "@vuu-ui/vuu-table-types": "4.0.0-alpha.12"
16
16
  },
17
17
  "dependencies": {
18
- "@vuu-ui/vuu-utils": "4.0.0-alpha.11",
18
+ "@vuu-ui/vuu-utils": "4.0.0-alpha.12",
19
19
  "@salt-ds/core": "1.67.0",
20
20
  "@salt-ds/styles": "0.2.1",
21
21
  "@salt-ds/window": "0.1.1"
@@ -25,6 +25,10 @@ const css = `
25
25
  }
26
26
  }
27
27
 
28
+ .vuuContextMenuDivider {
29
+ margin: var(--salt-spacing-50) 0;
30
+ }
31
+
28
32
 
29
33
  `;
30
34
  export default css;
package/src/menu-utils.js CHANGED
@@ -1,10 +1,20 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Menu, MenuItem, MenuPanel, MenuTrigger } from "@salt-ds/core";
2
+ import { Divider, Menu, MenuItem, MenuPanel, MenuTrigger } from "@salt-ds/core";
3
+ import { Fragment } from "react";
3
4
  const isGroupMenuItemDescriptor = (menuItem)=>void 0 !== menuItem && "children" in menuItem;
4
5
  const isOpenBulkEditResponse = (rpcResponse)=>"beginEditSession" === rpcResponse.rpcName;
5
6
  const hasShowNotificationAction = (res)=>res.action?.type === "SHOW_NOTIFICATION_ACTION";
6
7
  const menuItemsFromMenuDescriptors = (menuDescriptors, menuActionHandler)=>{
7
- const fromDescriptor = (menuItem, index)=>isGroupMenuItemDescriptor(menuItem) ? /*#__PURE__*/ jsxs(Menu, {
8
+ const fromDescriptor = (menuItem, index)=>menuItem.dividerBefore ? /*#__PURE__*/ jsxs(Fragment, {
9
+ children: [
10
+ /*#__PURE__*/ jsx(Divider, {
11
+ "aria-hidden": true,
12
+ className: "vuuContextMenuDivider"
13
+ }),
14
+ itemFromDescriptor(menuItem, index)
15
+ ]
16
+ }, index) : itemFromDescriptor(menuItem, index);
17
+ const itemFromDescriptor = (menuItem, index)=>isGroupMenuItemDescriptor(menuItem) ? /*#__PURE__*/ jsxs(Menu, {
8
18
  children: [
9
19
  /*#__PURE__*/ jsx(MenuTrigger, {
10
20
  children: /*#__PURE__*/ jsx(MenuItem, {
@@ -3,6 +3,8 @@ import type { ShowNotificationAction, VuuRpcResponse } from "@vuu-ui/vuu-protoco
3
3
  import { MenuActionHandler } from "./ContextMenuProvider";
4
4
  export interface ContextMenuItemBase {
5
5
  className?: string;
6
+ /** Renders a divider above the item, to separate groups of items. */
7
+ dividerBefore?: boolean;
6
8
  icon?: string;
7
9
  label: string;
8
10
  location?: string;