@api-client/ui 0.5.45 → 0.5.46

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": "@api-client/ui",
3
- "version": "0.5.45",
3
+ "version": "0.5.46",
4
4
  "description": "Internal UI component library for the API Client ecosystem.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "build/src/index.js",
@@ -30,6 +30,17 @@ export default class Menu extends UiList {
30
30
  */
31
31
  @property({ type: Boolean, reflect: true }) accessor disabled = false
32
32
 
33
+ /**
34
+ * Whether to select menu items when they are activated.
35
+ * When true, clicking or pressing Enter/Space on a menu item will mark it as selected.
36
+ * When false (default), menu items will not be marked as selected when activated.
37
+ *
38
+ * Note, this is different than `selectActive` as this property controls the class names
39
+ * set on the menu item.
40
+ * @attribute
41
+ */
42
+ @property({ type: Boolean }) accessor selectOnActivate = false
43
+
33
44
  /**
34
45
  * Currently active sub-menu
35
46
  */
@@ -241,9 +252,11 @@ export default class Menu extends UiList {
241
252
  }
242
253
 
243
254
  override notifySelect(item: UiListItem & { selected?: boolean }, index?: number): boolean {
244
- // Handle single selection
245
- this.clearSelection()
246
- item.selected = true
255
+ // Only handle selection if selectOnActivate is enabled
256
+ if (this.selectOnActivate) {
257
+ this.clearSelection()
258
+ item.selected = true
259
+ }
247
260
  this.hide()
248
261
  return super.notifySelect(item, index)
249
262
  }
@@ -82,6 +82,5 @@ export default css`
82
82
  fill: var(--md-sys-color-on-surface-variant);
83
83
  width: 24px;
84
84
  height: 24px;
85
- margin-right: 8px;
86
85
  }
87
86
  `
@@ -5,14 +5,6 @@ import styles from './internal/Menu.styles.js'
5
5
 
6
6
  /**
7
7
  * Material Design 3 Menu component with sub-menu support.
8
- *
9
- * @element ui-menu
10
- * @attribute {boolean} open - Whether the menu is currently open
11
- * @attribute {boolean} anchored - Whether the menu should be positioned relative to an anchor element
12
- * @attribute {boolean} disabled - Whether the menu is disabled
13
- * @fires select - Dispatched when a menu item is selected
14
- * @fires close - Dispatched when the menu is closed
15
- * @fires open - Dispatched when the menu is opened
16
8
  */
17
9
  @customElement('ui-menu')
18
10
  export class UiMenuElement extends Element {