@leavittsoftware/web 4.22.1 → 4.23.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": "@leavittsoftware/web",
3
- "version": "4.22.1",
3
+ "version": "4.23.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "files": [
@@ -40,5 +40,5 @@
40
40
  "url": "https://github.com/LeavittSoftware/titanium-elements/issues"
41
41
  },
42
42
  "homepage": "https://github.com/LeavittSoftware/titanium-elements/#readme",
43
- "gitHead": "c3734aa282346a10ecff8c4392693bbc3595f8a7"
43
+ "gitHead": "b68d1f97e5a2ec939f493a163ba5f8dfa8213496"
44
44
  }
@@ -12,6 +12,21 @@ export declare class TitaniumChip extends LitElement {
12
12
  * When true, the chip is selected
13
13
  */
14
14
  accessor selected: boolean;
15
+ /**
16
+ * The URL that the link button points to.
17
+ */
18
+ href: string;
19
+ /**
20
+ * The filename to use when downloading the linked resource.
21
+ * If not specified, the browser will determine a filename.
22
+ * This is only applicable when the button is used as a link (`href` is set).
23
+ */
24
+ download: string;
25
+ /**
26
+ * Where to display the linked `href` URL for a link button. Common options
27
+ * include `_blank` to open in a new tab.
28
+ */
29
+ target: '_blank' | '_parent' | '_self' | '_top' | '';
15
30
  /**
16
31
  * When true, trailing slot is replaced with a remove icon button
17
32
  */
@@ -34,5 +49,8 @@ export declare class TitaniumChip extends LitElement {
34
49
  private readonly trailingSlotElements;
35
50
  static styles: import("lit").CSSResult[];
36
51
  render(): import("lit-html").TemplateResult<1>;
52
+ private renderContent;
53
+ private renderButton;
54
+ private renderLink;
37
55
  }
38
56
  //# sourceMappingURL=chip.d.ts.map
@@ -3,10 +3,32 @@ import '@material/web/icon/icon';
3
3
  import '@material/web/iconbutton/icon-button';
4
4
  import '@material/web/ripple/ripple';
5
5
  import '@material/web/focus/md-focus-ring';
6
- import { css, html, LitElement } from 'lit';
6
+ import { css, html, LitElement, nothing } from 'lit';
7
7
  import { customElement, property, queryAssignedElements } from 'lit/decorators.js';
8
8
  import { ellipsis } from '@leavittsoftware/web/titanium/styles/ellipsis';
9
9
  let TitaniumChip = class TitaniumChip extends LitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ /**
13
+ * The URL that the link button points to.
14
+ */
15
+ this.href = '';
16
+ /**
17
+ * The filename to use when downloading the linked resource.
18
+ * If not specified, the browser will determine a filename.
19
+ * This is only applicable when the button is used as a link (`href` is set).
20
+ */
21
+ this.download = '';
22
+ /**
23
+ * Where to display the linked `href` URL for a link button. Common options
24
+ * include `_blank` to open in a new tab.
25
+ */
26
+ this.target = '';
27
+ this.#inputChipRemoveIcon_accessor_storage = 'close';
28
+ this.#disabled_accessor_storage = false;
29
+ this.#hasLeadingItems_accessor_storage = false;
30
+ this.#hasTrailingItems_accessor_storage = false;
31
+ }
10
32
  #label_accessor_storage;
11
33
  /**
12
34
  * Label / text of the chip
@@ -31,22 +53,22 @@ let TitaniumChip = class TitaniumChip extends LitElement {
31
53
  */
32
54
  get nonInteractive() { return this.#nonInteractive_accessor_storage; }
33
55
  set nonInteractive(value) { this.#nonInteractive_accessor_storage = value; }
34
- #inputChipRemoveIcon_accessor_storage = 'close';
56
+ #inputChipRemoveIcon_accessor_storage;
35
57
  /**
36
58
  * Icon name of the remove icon chip
37
59
  */
38
60
  get inputChipRemoveIcon() { return this.#inputChipRemoveIcon_accessor_storage; }
39
61
  set inputChipRemoveIcon(value) { this.#inputChipRemoveIcon_accessor_storage = value; }
40
- #disabled_accessor_storage = false;
62
+ #disabled_accessor_storage;
41
63
  /**
42
64
  * Whether or not the input should be disabled
43
65
  */
44
66
  get disabled() { return this.#disabled_accessor_storage; }
45
67
  set disabled(value) { this.#disabled_accessor_storage = value; }
46
- #hasLeadingItems_accessor_storage = false;
68
+ #hasLeadingItems_accessor_storage;
47
69
  get hasLeadingItems() { return this.#hasLeadingItems_accessor_storage; }
48
70
  set hasLeadingItems(value) { this.#hasLeadingItems_accessor_storage = value; }
49
- #hasTrailingItems_accessor_storage = false;
71
+ #hasTrailingItems_accessor_storage;
50
72
  get hasTrailingItems() { return this.#hasTrailingItems_accessor_storage; }
51
73
  set hasTrailingItems(value) { this.#hasTrailingItems_accessor_storage = value; }
52
74
  static { this.styles = [
@@ -64,6 +86,7 @@ let TitaniumChip = class TitaniumChip extends LitElement {
64
86
  text-align: left;
65
87
  }
66
88
 
89
+ a,
67
90
  button {
68
91
  display: grid;
69
92
  align-items: center;
@@ -96,26 +119,35 @@ let TitaniumChip = class TitaniumChip extends LitElement {
96
119
  font-weight: inherit;
97
120
  line-height: inherit;
98
121
  letter-spacing: inherit;
122
+ text-decoration: none;
99
123
 
100
124
  padding: 0 12px;
101
125
  }
102
126
 
103
127
  :host([selected]) button,
104
- :host([has-leading-items]) button {
128
+ :host([selected]) a,
129
+ :host([has-leading-items]) button,
130
+ :host([has-leading-items]) a {
105
131
  grid: 'icon label' / auto 1fr;
106
132
  padding-left: 8px;
107
133
  }
108
134
 
109
135
  :host([input-chip]) button,
110
- :host([has-trailing-items]) butt on {
136
+ :host([input-chip]) a,
137
+ :host([has-trailing-items]) button,
138
+ :host([has-trailing-items]) a {
111
139
  grid: 'label trailing' / 1fr auto;
112
140
  padding-right: 4px;
113
141
  }
114
142
 
115
143
  :host([selected][input-chip]) button,
144
+ :host([selected][input-chip]) a,
116
145
  :host([selected][has-leading-items]) button,
146
+ :host([selected][has-leading-items]) a,
117
147
  :host([has-leading-items][input-chip]) button,
118
- :host([has-trailing-items][has-leading-items]) button {
148
+ :host([has-leading-items][input-chip]) a,
149
+ :host([has-trailing-items][has-leading-items]) button,
150
+ :host([has-trailing-items][has-leading-items]) a {
119
151
  grid: 'icon label trailing' / auto 1fr auto;
120
152
  }
121
153
 
@@ -159,9 +191,13 @@ let TitaniumChip = class TitaniumChip extends LitElement {
159
191
  `,
160
192
  ]; }
161
193
  render() {
162
- return html `<button part="button" ?inert=${this.nonInteractive}>
163
- <md-ripple ?disabled=${this.disabled}></md-ripple>
164
- <md-focus-ring ></md-focus-ring>
194
+ return html ` ${this.href ? this.renderLink() : this.renderButton()} `;
195
+ }
196
+ renderContent() {
197
+ const buttonId = this.href ? 'link' : 'button';
198
+ return html `
199
+ <md-ripple part="focus-ring" for=${buttonId} ?disabled=${this.disabled}></md-ripple>
200
+ <md-focus-ring part="ripple" for=${buttonId}></md-focus-ring>
165
201
  ${this.selected ? html `<md-icon selected-check>check</md-icon>` : html `<slot name="icon" @slotchange=${() => (this.hasLeadingItems = this.leadingSlotElements.length > 0)}></slot>`}
166
202
 
167
203
  <main label ellipsis><slot name="label">${this.label}</slot></main>
@@ -176,7 +212,20 @@ let TitaniumChip = class TitaniumChip extends LitElement {
176
212
  >`
177
213
  : html `<slot name="trailing" @slotchange=${() => (this.hasTrailingItems = this.trailingSlotElements.length > 0)}></slot>`}
178
214
  </slot>
179
- </button>`;
215
+ `;
216
+ }
217
+ renderButton() {
218
+ return html `<button id="button" part="button" ?inert=${this.nonInteractive} ?disabled=${this.disabled}>${this.renderContent()}</button>`;
219
+ }
220
+ renderLink() {
221
+ return html `<a
222
+ id="link"
223
+ tabindex="${this.disabled ? -1 : nothing}"
224
+ href=${this.href}
225
+ download=${this.download || nothing}
226
+ target=${this.target || nothing}
227
+ >${this.renderContent()}
228
+ </a>`;
180
229
  }
181
230
  };
182
231
  __decorate([
@@ -185,6 +234,15 @@ __decorate([
185
234
  __decorate([
186
235
  property({ type: Boolean, reflect: true })
187
236
  ], TitaniumChip.prototype, "selected", null);
237
+ __decorate([
238
+ property({ type: String })
239
+ ], TitaniumChip.prototype, "href", void 0);
240
+ __decorate([
241
+ property()
242
+ ], TitaniumChip.prototype, "download", void 0);
243
+ __decorate([
244
+ property()
245
+ ], TitaniumChip.prototype, "target", void 0);
188
246
  __decorate([
189
247
  property({ type: Boolean, reflect: true, attribute: 'input-chip' })
190
248
  ], TitaniumChip.prototype, "inputChip", null);
@@ -1 +1 @@
1
- {"version":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