wx-svelte-menu 2.3.0 → 2.4.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "wx-svelte-menu",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Svelte menu component for creating dropdown menus, context menus, or complex menu bars",
5
5
  "productTag": "menu",
6
6
  "productTrial": false,
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "homepage": "https://svar.dev/svelte/core/",
35
35
  "dependencies": {
36
- "@svar-ui/svelte-core": "2.3.1",
37
- "@svar-ui/lib-dom": "0.9.2"
36
+ "@svar-ui/svelte-core": "2.4.0",
37
+ "@svar-ui/lib-dom": "0.11.1"
38
38
  },
39
39
  "files": [
40
40
  "src",
package/readme.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@svar-ui/svelte-menu.svg)](https://www.npmjs.com/package/@svar-ui/svelte-menu)
6
6
  [![License](https://img.shields.io/github/license/svar-widgets/menu)](https://github.com/svar-widgets/menu/blob/main/license.txt)
7
- [![npm downloads](https://img.shields.io/npm/dm/@svar-ui/svelte-menu.svg)](https://www.npmjs.com/package/@svar-ui/svelte-menuu)
7
+ [![npm downloads](https://img.shields.io/npm/dm/@svar-ui/svelte-menu.svg)](https://www.npmjs.com/package/@svar-ui/svelte-menu)
8
8
 
9
9
  </div>
10
10
 
@@ -50,6 +50,7 @@
50
50
  {#each finalOptions as option (option.id)}
51
51
  <button
52
52
  class="wx-option {active === option.id ? 'wx-active' : ''}"
53
+ class:wx-disabled={option.disabled}
53
54
  onmouseenter={ev => onHover(ev, option)}
54
55
  onclick={ev => setMenu(ev, option, true)}>{option.text}</button
55
56
  >
@@ -92,4 +93,10 @@
92
93
  background-color: var(--wx-background-alt);
93
94
  border-radius: var(--wx-button-border-radius);
94
95
  }
96
+ .wx-disabled {
97
+ pointer-events: none;
98
+ }
99
+ .wx-disabled {
100
+ color: var(--wx-color-font-disabled);
101
+ }
95
102
  </style>
@@ -14,6 +14,7 @@
14
14
  <div
15
15
  bind:this={element}
16
16
  class="wx-option {option.css || ''}"
17
+ class:wx-disabled={option.disabled}
17
18
  data-id={option.id}
18
19
  onmouseenter={onHover}
19
20
  {onclick}
@@ -80,4 +81,13 @@
80
81
  margin-left: 20px;
81
82
  white-space: nowrap;
82
83
  }
84
+
85
+ .wx-disabled {
86
+ pointer-events: none;
87
+ }
88
+ .wx-disabled .wx-value,
89
+ .wx-disabled .wx-icon,
90
+ .wx-disabled .wx-sub-icon {
91
+ color: var(--wx-color-font-disabled);
92
+ }
83
93
  </style>
@@ -31,8 +31,9 @@ let uid = 1;
31
31
  export function prepareMenuData(data) {
32
32
  return mapData(data, a => {
33
33
  // [deprecated] option.type to be deprecated in 3.0
34
- if (a.type) a.comp = a.type;
35
- return { ...a, id: a.id || uid++ };
34
+ const opt = { ...a, id: a.id || uid++ };
35
+ if (opt.type) opt.comp = opt.type;
36
+ return opt;
36
37
  });
37
38
  }
38
39
 
package/types/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export interface IMenuOption {
8
8
  data?: IMenuOption[];
9
9
  css?: string;
10
10
  icon?: string;
11
+ disabled?: boolean;
11
12
  type?: string | Component<any>; // @deprecated use `comp` instead. Will be removed in v3.0
12
13
  comp?: string | Component<any>;
13
14
  }
package/whatsnew.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 2.4.0
2
+
3
+ ### Updates
4
+
5
+ - More options to precisely position and align ContextMenu, DropDownMenu, ActionMenu
6
+
7
+ ### Fixes
8
+
9
+ - Incorrect position of Menus in a relatively positioned continer
10
+ - Incorrect position of Menus close to the container edges
11
+
12
+ ## 2.3.1
13
+
14
+ ### Fixes
15
+
16
+ - Backward compatibility for option type
17
+
1
18
  ## 2.3.0
2
19
 
3
20
  ### New features