@momentum-design/components 0.112.4 → 0.112.6

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.
@@ -58,7 +58,7 @@ declare class ButtonLink extends ButtonLink_base {
58
58
  */
59
59
  private setSoftDisabled;
60
60
  update(changedProperties: PropertyValues): void;
61
- render(): import("lit-html").TemplateResult<1>;
61
+ protected renderAnchorContent(): import("lit-html").TemplateResult<1>;
62
62
  static styles: Array<CSSResult>;
63
63
  }
64
64
  export default ButtonLink;
@@ -9,7 +9,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  import { html } from 'lit';
11
11
  import { property } from 'lit/decorators.js';
12
- import { ifDefined } from 'lit/directives/if-defined.js';
13
12
  import Button from '../button/button.component';
14
13
  import { ButtonComponentMixin } from '../../utils/mixins/ButtonComponentMixin';
15
14
  import { DEFAULTS } from '../button/button.constants';
@@ -91,39 +90,15 @@ class ButtonLink extends ButtonComponentMixin(Linksimple) {
91
90
  this.inferButtonType();
92
91
  }
93
92
  }
94
- render() {
95
- var _a;
93
+ renderAnchorContent() {
96
94
  return html `
97
- <a
98
- class="mdc-focus-ring"
99
- part="anchor"
100
- href="${this.href}"
101
- target="${this.target}"
102
- rel="${ifDefined(this.rel)}"
103
- download="${ifDefined(this.download)}"
104
- ping="${ifDefined(this.ping)}"
105
- hreflang="${ifDefined(this.hreflang)}"
106
- type="${ifDefined(this.type)}"
107
- referrerpolicy="${ifDefined(this.referrerpolicy)}"
108
- aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
109
- tabindex="${this.disabled ? -1 : 0}"
110
- >
111
- ${this.prefixIcon
112
- ? html `<mdc-icon
113
- name="${this.prefixIcon}"
114
- part="prefix-icon"
115
- length-unit="rem"
116
- ></mdc-icon>`
95
+ ${this.prefixIcon
96
+ ? html `<mdc-icon name="${this.prefixIcon}" part="prefix-icon" length-unit="rem"></mdc-icon>`
117
97
  : ''}
118
- <slot @slotchange="${this.inferButtonType}" part="button-text"></slot>
119
- ${this.postfixIcon
120
- ? html `<mdc-icon
121
- name="${this.postfixIcon}"
122
- part="postfix-icon"
123
- length-unit="rem"
124
- ></mdc-icon>`
98
+ <slot @slotchange="${this.inferButtonType}" part="button-text"></slot>
99
+ ${this.postfixIcon
100
+ ? html `<mdc-icon name="${this.postfixIcon}" part="postfix-icon" length-unit="rem"></mdc-icon>`
125
101
  : ''}
126
- </a>
127
102
  `;
128
103
  }
129
104
  }
@@ -40,7 +40,7 @@ declare class Link extends Link_base {
40
40
  * @returns The icon size value and units.
41
41
  */
42
42
  private getIconSize;
43
- render(): import("lit-html").TemplateResult<1>;
43
+ protected renderAnchorContent(): import("lit-html").TemplateResult<1>;
44
44
  static styles: Array<CSSResult>;
45
45
  }
46
46
  export default Link;
@@ -9,7 +9,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  import { html, nothing } from 'lit';
11
11
  import { property } from 'lit/decorators.js';
12
- import { ifDefined } from 'lit/directives/if-defined.js';
13
12
  import { IconNameMixin } from '../../utils/mixins/IconNameMixin';
14
13
  import Linksimple from '../linksimple/linksimple.component';
15
14
  import { DEFAULTS, LINK_ICON_SIZES, LINK_SIZES } from './link.constants';
@@ -64,34 +63,11 @@ class Link extends IconNameMixin(Linksimple) {
64
63
  return LINK_ICON_SIZES.LARGE;
65
64
  }
66
65
  }
67
- render() {
68
- var _a;
69
- return html `
70
- <a
71
- class="mdc-focus-ring"
72
- part="anchor"
73
- href="${this.href}"
74
- target="${this.target}"
75
- rel="${ifDefined(this.rel)}"
76
- download="${ifDefined(this.download)}"
77
- ping="${ifDefined(this.ping)}"
78
- hreflang="${ifDefined(this.hreflang)}"
79
- type="${ifDefined(this.type)}"
80
- referrerpolicy="${ifDefined(this.referrerpolicy)}"
81
- aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
82
- tabindex="${this.disabled ? -1 : 0}"
83
- >
84
- <slot></slot>
85
- ${this.iconName
86
- ? html `<mdc-icon
87
- part="icon"
88
- name="${this.iconName}"
89
- size="${this.getIconSize()}"
90
- length-unit="rem"
91
- ></mdc-icon>`
92
- : nothing}
93
- </a>
94
- `;
66
+ renderAnchorContent() {
67
+ return html ` <slot></slot>
68
+ ${this.iconName
69
+ ? html `<mdc-icon part="icon" name="${this.iconName}" size="${this.getIconSize()}" length-unit="rem"></mdc-icon>`
70
+ : nothing}`;
95
71
  }
96
72
  }
97
73
  Link.styles = [...Linksimple.styles, ...styles];
@@ -41,9 +41,8 @@ declare class Linksimple extends Linksimple_base {
41
41
  inverted: boolean;
42
42
  /**
43
43
  * Href for navigation. The URL that the hyperlink points to
44
- * @default #
45
44
  */
46
- href: string;
45
+ href?: string;
47
46
  /**
48
47
  * Optional target: _blank, _self, _parent, _top and _unfencedTop
49
48
  * @default _self
@@ -85,6 +84,12 @@ declare class Linksimple extends Linksimple_base {
85
84
  */
86
85
  private setDisabled;
87
86
  update(changedProperties: PropertyValues): void;
87
+ /**
88
+ * Protected method to render the anchor content.
89
+ * Override this method to customize the content inside the anchor tag.
90
+ * @internal
91
+ */
92
+ protected renderAnchorContent(): import("lit-html").TemplateResult<1>;
88
93
  render(): import("lit-html").TemplateResult<1>;
89
94
  static styles: Array<CSSResult>;
90
95
  }
@@ -55,11 +55,6 @@ class Linksimple extends DataAriaLabelMixin(DisabledMixin(Component)) {
55
55
  * @default false
56
56
  */
57
57
  this.inverted = DEFAULTS.INVERTED;
58
- /**
59
- * Href for navigation. The URL that the hyperlink points to
60
- * @default #
61
- */
62
- this.href = '#';
63
58
  /**
64
59
  * Optional target: _blank, _self, _parent, _top and _unfencedTop
65
60
  * @default _self
@@ -103,11 +98,19 @@ class Linksimple extends DataAriaLabelMixin(DisabledMixin(Component)) {
103
98
  this.setDisabled(this.disabled);
104
99
  }
105
100
  }
101
+ /**
102
+ * Protected method to render the anchor content.
103
+ * Override this method to customize the content inside the anchor tag.
104
+ * @internal
105
+ */
106
+ renderAnchorContent() {
107
+ return html `<slot></slot>`;
108
+ }
106
109
  render() {
107
110
  var _a;
108
111
  return html `
109
112
  <a
110
- class='mdc-focus-ring'
113
+ class="mdc-focus-ring"
111
114
  part="anchor"
112
115
  href="${this.href}"
113
116
  target="${this.target}"
@@ -120,7 +123,7 @@ class Linksimple extends DataAriaLabelMixin(DisabledMixin(Component)) {
120
123
  aria-label="${(_a = this.dataAriaLabel) !== null && _a !== void 0 ? _a : ''}"
121
124
  tabindex="${this.disabled ? -1 : 0}"
122
125
  >
123
- <slot></slot>
126
+ ${this.renderAnchorContent()}
124
127
  </a>
125
128
  `;
126
129
  }
@@ -136,7 +139,7 @@ __decorate([
136
139
  ], Linksimple.prototype, "inverted", void 0);
137
140
  __decorate([
138
141
  property({ type: String, reflect: true }),
139
- __metadata("design:type", Object)
142
+ __metadata("design:type", String)
140
143
  ], Linksimple.prototype, "href", void 0);
141
144
  __decorate([
142
145
  property({ type: String, reflect: true }),
@@ -808,6 +808,8 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
808
808
  }
809
809
  isEventFromTrigger(event) {
810
810
  var _a;
811
+ if (!this.triggerID)
812
+ return false;
811
813
  if (event.composed) {
812
814
  return event.composedPath().some(el => (el === null || el === void 0 ? void 0 : el.id) === this.triggerID);
813
815
  }