@umbraco-ui/uui-menu-item 0.1.0 → 0.2.1

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/index.js CHANGED
@@ -3,6 +3,7 @@ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
3
3
  import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
4
4
  import { LitElement, html, css } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
6
+ import { ref } from 'lit/directives/ref.js';
6
7
  import { ifDefined } from 'lit/directives/if-defined.js';
7
8
  import { UUIEvent } from '@umbraco-ui/uui-base/lib/events';
8
9
 
@@ -32,6 +33,9 @@ let UUIMenuItemElement = class extends SelectOnlyMixin(SelectableMixin(ActiveMix
32
33
  this.loading = false;
33
34
  this.iconSlotHasContent = false;
34
35
  }
36
+ labelButtonChanged(label) {
37
+ this.selectableTarget = label || this;
38
+ }
35
39
  connectedCallback() {
36
40
  super.connectedCallback();
37
41
  if (!this.hasAttribute("role"))
@@ -63,12 +67,13 @@ let UUIMenuItemElement = class extends SelectOnlyMixin(SelectableMixin(ActiveMix
63
67
  }
64
68
  _renderLabelAsAnchor() {
65
69
  if (this.disabled) {
66
- return html` <span id="label-button">
70
+ return html` <span id="label-button" ${ref(this.labelButtonChanged)}>
67
71
  ${this._renderLabelInside()}
68
72
  </span>`;
69
73
  }
70
74
  return html` <a
71
75
  id="label-button"
76
+ ${ref(this.labelButtonChanged)}
72
77
  href=${ifDefined(this.href)}
73
78
  target=${ifDefined(this.target || void 0)}
74
79
  rel=${ifDefined(this.target === "_blank" ? "noopener" : void 0)}
@@ -81,6 +86,7 @@ let UUIMenuItemElement = class extends SelectOnlyMixin(SelectableMixin(ActiveMix
81
86
  _renderLabelAsButton() {
82
87
  return html` <button
83
88
  id="label-button"
89
+ ${ref(this.labelButtonChanged)}
84
90
  @click=${this.onLabelClicked}
85
91
  ?disabled=${this.disabled}
86
92
  aria-label="${this.label}">
@@ -56,6 +56,7 @@ export declare class UUIMenuItemElement extends UUIMenuItemElement_base {
56
56
  */
57
57
  target?: '_blank' | '_parent' | '_self' | '_top';
58
58
  private iconSlotHasContent;
59
+ labelButtonChanged(label?: Element | undefined): void;
59
60
  connectedCallback(): void;
60
61
  private iconSlotChanged;
61
62
  private onCaretClicked;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-menu-item",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -30,9 +30,9 @@
30
30
  "custom-elements.json"
31
31
  ],
32
32
  "dependencies": {
33
- "@umbraco-ui/uui-base": "0.1.0",
34
- "@umbraco-ui/uui-loader-bar": "0.1.0",
35
- "@umbraco-ui/uui-symbol-expand": "0.1.0"
33
+ "@umbraco-ui/uui-base": "0.2.1",
34
+ "@umbraco-ui/uui-loader-bar": "0.2.1",
35
+ "@umbraco-ui/uui-symbol-expand": "0.2.1"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
@@ -43,5 +43,5 @@
43
43
  "access": "public"
44
44
  },
45
45
  "homepage": "https://uui.umbraco.com/?path=/story/uui-menu-item",
46
- "gitHead": "9ed7860ce865d310b85bd1718f37b59db873aefd"
46
+ "gitHead": "cb61546f85d6c2f122fa8c130409507e8def4bd5"
47
47
  }