@jack-henry/jh-elements 2.0.0-beta.13 → 2.0.0-beta.15
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/NOTICE +1 -1
- package/README.md +2 -2
- package/components/badge/badge.js +4 -4
- package/components/button/button.js +106 -52
- package/components/card/card.js +4 -4
- package/components/checkbox/checkbox.js +19 -31
- package/components/checkbox-group/checkbox-group.js +12 -20
- package/components/divider/divider.js +5 -5
- package/components/element/element.js +94 -0
- package/components/icon/icon.js +14 -12
- package/components/input/input.js +72 -74
- package/components/input-email/input-email.js +1 -1
- package/components/input-password/input-password.js +10 -19
- package/components/input-search/input-search.js +2 -2
- package/components/input-telephone/input-telephone.js +1 -1
- package/components/input-textarea/input-textarea.js +4 -13
- package/components/input-url/input-url.js +1 -1
- package/components/list-group/list-group.js +6 -13
- package/components/list-item/list-item.js +131 -143
- package/components/menu/menu.js +5 -8
- package/components/notification/notification.js +19 -21
- package/components/progress/progress.js +62 -56
- package/components/radio/radio.js +8 -21
- package/components/radio-group/radio-group.js +16 -31
- package/components/select/select.js +51 -30
- package/components/switch/switch.js +9 -22
- package/components/table/table.js +21 -29
- package/components/table-data-cell/table-data-cell.js +7 -9
- package/components/table-header-cell/table-header-cell.js +15 -25
- package/components/table-row/table-row.js +5 -8
- package/components/tag/tag.js +12 -14
- package/components/tag-group/tag-group.js +5 -7
- package/components/toast/toast.js +5 -14
- package/components/tooltip/tooltip.js +8 -9
- package/custom-elements.json +350 -215
- package/jsconfig.json +1 -1
- package/package.json +11 -15
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
|
-
|
|
8
|
-
let id = 0;
|
|
7
|
+
import { JhElement } from '../element/element.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* @cssprop --jh-switch-opacity-disabled - The switch opacity when disabled. Defaults to `--jh-opacity-disabled`.
|
|
@@ -28,9 +27,7 @@ let id = 0;
|
|
|
28
27
|
*
|
|
29
28
|
* @customElement jh-switch
|
|
30
29
|
*/
|
|
31
|
-
export class JhSwitch extends
|
|
32
|
-
/** @type {?Number} */
|
|
33
|
-
#id;
|
|
30
|
+
export class JhSwitch extends JhElement {
|
|
34
31
|
|
|
35
32
|
static get styles() {
|
|
36
33
|
return css`
|
|
@@ -253,20 +250,10 @@ export class JhSwitch extends LitElement {
|
|
|
253
250
|
this.label = null;
|
|
254
251
|
}
|
|
255
252
|
|
|
256
|
-
connectedCallback() {
|
|
257
|
-
super.connectedCallback();
|
|
258
|
-
this.#id = id++;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
253
|
#handleClick() {
|
|
262
254
|
if (!this.disabled && this.accessibleDisabled !== 'true') {
|
|
263
255
|
this.checked = !this.checked;
|
|
264
|
-
|
|
265
|
-
bubbles: true,
|
|
266
|
-
composed: true,
|
|
267
|
-
cancelable: true,
|
|
268
|
-
};
|
|
269
|
-
this.dispatchEvent(new CustomEvent('jh-change', options));
|
|
256
|
+
this.dispatchCustomEvent('jh-change');
|
|
270
257
|
}
|
|
271
258
|
}
|
|
272
259
|
|
|
@@ -276,7 +263,7 @@ export class JhSwitch extends LitElement {
|
|
|
276
263
|
|
|
277
264
|
if (this.helperText) {
|
|
278
265
|
helperText = html`
|
|
279
|
-
<p class="helper-text" id="switch-helper-text-${this
|
|
266
|
+
<p class="helper-text" id="switch-helper-text-${this.uniqueId}">
|
|
280
267
|
${this.helperText}
|
|
281
268
|
</p>
|
|
282
269
|
`;
|
|
@@ -285,7 +272,7 @@ export class JhSwitch extends LitElement {
|
|
|
285
272
|
if (this.label) {
|
|
286
273
|
label = html`
|
|
287
274
|
<div class="label-container">
|
|
288
|
-
<label class="label-text" for="switch-label-${this
|
|
275
|
+
<label class="label-text" for="switch-label-${this.uniqueId}">
|
|
289
276
|
${this.label}
|
|
290
277
|
</label>
|
|
291
278
|
${helperText}
|
|
@@ -300,11 +287,11 @@ export class JhSwitch extends LitElement {
|
|
|
300
287
|
aria-label="${ifDefined(this.accessibleLabel)}"
|
|
301
288
|
aria-disabled="${ifDefined(this.accessibleDisabled)}"
|
|
302
289
|
type="button"
|
|
303
|
-
aria-describedby=${this.helperText ? `switch-helper-text-${this
|
|
290
|
+
aria-describedby=${this.helperText ? `switch-helper-text-${this.uniqueId}` : null}
|
|
304
291
|
?checked=${this.checked}
|
|
305
292
|
?disabled=${this.disabled}
|
|
306
293
|
aria-pressed="${this.checked}"
|
|
307
|
-
id="switch-label-${this
|
|
294
|
+
id="switch-label-${this.uniqueId}"
|
|
308
295
|
></button>
|
|
309
296
|
<span aria-hidden="true"></span>
|
|
310
297
|
${label}
|
|
@@ -312,4 +299,4 @@ export class JhSwitch extends LitElement {
|
|
|
312
299
|
}
|
|
313
300
|
}
|
|
314
301
|
|
|
315
|
-
|
|
302
|
+
JhSwitch.register('jh-switch', JhSwitch);
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { JhElement } from '../element/element.js';
|
|
6
7
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
8
|
import '../table-header-cell/table-header-cell.js';
|
|
8
9
|
import '../table-data-cell/table-data-cell.js';
|
|
9
10
|
import '../table-row/table-row.js';
|
|
10
11
|
|
|
11
|
-
let id = 0;
|
|
12
|
-
|
|
13
12
|
/**
|
|
14
13
|
* Table
|
|
15
14
|
* @cssprop --jh-table-color-text-striped-enabled - The striped row text color. Defaults to `--jh-color-content-primary-enabled`.
|
|
@@ -29,9 +28,7 @@ let id = 0;
|
|
|
29
28
|
* @slot jh-table-toolbar - Use to insert toolbar.
|
|
30
29
|
* @customElement jh-table
|
|
31
30
|
*/
|
|
32
|
-
export class JhTable extends
|
|
33
|
-
/** @type {?Number} */
|
|
34
|
-
#id;
|
|
31
|
+
export class JhTable extends JhElement {
|
|
35
32
|
|
|
36
33
|
static get styles() {
|
|
37
34
|
return css`
|
|
@@ -174,8 +171,8 @@ export class JhTable extends LitElement {
|
|
|
174
171
|
:host([scrollable]) .table-wrapper {
|
|
175
172
|
position: relative;
|
|
176
173
|
overflow-x: hidden;
|
|
177
|
-
flex: 1 1 auto;
|
|
178
|
-
/* display grid makes sticky work and
|
|
174
|
+
flex: 1 1 auto;
|
|
175
|
+
/* display grid makes sticky work and shows horizontal scrollbar on top. */
|
|
179
176
|
display: grid;
|
|
180
177
|
}
|
|
181
178
|
|
|
@@ -187,9 +184,10 @@ export class JhTable extends LitElement {
|
|
|
187
184
|
/* removes bouncy scroll behavior in Safari and FF */
|
|
188
185
|
/* overscroll-behavior: none; */
|
|
189
186
|
}
|
|
190
|
-
:host([scrollable]) .
|
|
187
|
+
:host([scrollable]) .table {
|
|
191
188
|
width: auto;
|
|
192
189
|
position: relative;
|
|
190
|
+
min-width: 100%;
|
|
193
191
|
}
|
|
194
192
|
.table-wrapper:has(.table-container:focus-visible) {
|
|
195
193
|
outline-color: var(
|
|
@@ -199,7 +197,7 @@ export class JhTable extends LitElement {
|
|
|
199
197
|
outline-width: var(--jh-border-focus-width);
|
|
200
198
|
outline-style: var(--jh-border-focus-style);
|
|
201
199
|
}
|
|
202
|
-
.table-wrapper:focus-visible {
|
|
200
|
+
.table-container:focus-visible, :host([scrollable]) .table-wrapper:focus-visible {
|
|
203
201
|
outline: none;
|
|
204
202
|
}
|
|
205
203
|
`;
|
|
@@ -289,34 +287,28 @@ export class JhTable extends LitElement {
|
|
|
289
287
|
this.addEventListener('jh-sort', this.#handleSort);
|
|
290
288
|
}
|
|
291
289
|
|
|
292
|
-
|
|
293
|
-
super.
|
|
294
|
-
this
|
|
290
|
+
disconnectedCallback() {
|
|
291
|
+
super.disconnectedCallback();
|
|
292
|
+
if (this.observer) {
|
|
293
|
+
this.observer.disconnect();
|
|
294
|
+
}
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
async firstUpdated() {
|
|
298
298
|
if (!this.scrollable) return;
|
|
299
299
|
|
|
300
|
-
let scrollTable = this.shadowRoot.querySelector('.table');
|
|
301
|
-
await scrollTable.updateComplete;
|
|
302
|
-
let originalTableWidth = scrollTable.getBoundingClientRect().width;
|
|
303
|
-
|
|
304
300
|
this.observer = new ResizeObserver((entries) => {
|
|
305
301
|
entries.forEach((entry) => {
|
|
306
302
|
let table = entry.target.shadowRoot.querySelector('.table');
|
|
307
303
|
let tableContainer =
|
|
308
304
|
entry.target.shadowRoot.querySelector('.table-container');
|
|
305
|
+
if (!table || !tableContainer) return;
|
|
309
306
|
if (table.scrollWidth > tableContainer.clientWidth) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
table.classList.remove('scrollable');
|
|
307
|
+
tableContainer.setAttribute('tabindex', '0');
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
314
310
|
tableContainer.removeAttribute('tabindex');
|
|
315
|
-
} else {
|
|
316
|
-
table.classList.add('scrollable');
|
|
317
|
-
tableContainer.setAttribute('tabindex', '0');
|
|
318
311
|
}
|
|
319
|
-
}
|
|
320
312
|
});
|
|
321
313
|
});
|
|
322
314
|
|
|
@@ -350,12 +342,12 @@ export class JhTable extends LitElement {
|
|
|
350
342
|
|
|
351
343
|
render() {
|
|
352
344
|
return html`
|
|
353
|
-
<slot name="jh-table-caption" id="table-caption-${this
|
|
345
|
+
<slot name="jh-table-caption" id="table-caption-${this.uniqueId}" @slotchange=${this.#handleSlot}></slot>
|
|
354
346
|
<slot name="jh-table-toolbar" @slotchange=${this.#handleSlot}></slot>
|
|
355
347
|
<div class="table-wrapper">
|
|
356
348
|
<div class="table-container" tabindex="${ifDefined(this.scrollable ? '0' : null)}">
|
|
357
|
-
<div class="table
|
|
358
|
-
aria-labelledby="table-caption-${this
|
|
349
|
+
<div class="table" role="table"
|
|
350
|
+
aria-labelledby="table-caption-${this.uniqueId}" aria-label=${ifDefined(this.accessibleLabel === '' ? null : this.accessibleLabel)}>
|
|
359
351
|
<slot name="jh-table-header" class="header" role="rowgroup"></slot>
|
|
360
352
|
<slot class="body" role="rowgroup"></slot>
|
|
361
353
|
<slot name="jh-table-footer" class="footer" role="rowgroup"></slot>
|
|
@@ -367,4 +359,4 @@ export class JhTable extends LitElement {
|
|
|
367
359
|
}
|
|
368
360
|
}
|
|
369
361
|
|
|
370
|
-
|
|
362
|
+
JhTable.register('jh-table', JhTable);
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { JhElement } from '../element/element.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Table Cell
|
|
@@ -30,10 +31,7 @@ import { LitElement, css, html } from 'lit';
|
|
|
30
31
|
*
|
|
31
32
|
* @customElement jh-table-cell
|
|
32
33
|
*/
|
|
33
|
-
export class JhTableDataCell extends
|
|
34
|
-
|
|
35
|
-
/** @type {ElementInternals} */
|
|
36
|
-
#internals;
|
|
34
|
+
export class JhTableDataCell extends JhElement {
|
|
37
35
|
|
|
38
36
|
static get styles() {
|
|
39
37
|
return css`
|
|
@@ -62,7 +60,8 @@ export class JhTableDataCell extends LitElement {
|
|
|
62
60
|
font-size: var(--footer-font-size, var(--jh-font-body-regular-1-font-size));
|
|
63
61
|
font-family: var(--footer-font-family, var(--jh-font-body-regular-1-font-family));
|
|
64
62
|
display: table-cell;
|
|
65
|
-
width:
|
|
63
|
+
width: auto;
|
|
64
|
+
box-sizing: border-box;
|
|
66
65
|
}
|
|
67
66
|
:host([horizontal-align="left"]) {
|
|
68
67
|
text-align: left;
|
|
@@ -88,8 +87,7 @@ export class JhTableDataCell extends LitElement {
|
|
|
88
87
|
|
|
89
88
|
constructor() {
|
|
90
89
|
super();
|
|
91
|
-
this
|
|
92
|
-
this.#internals.role = 'cell';
|
|
90
|
+
this.internals.role = 'cell';
|
|
93
91
|
/**
|
|
94
92
|
* Sets the horizontal alignment of the content.
|
|
95
93
|
* @attr horizontal-align
|
|
@@ -104,4 +102,4 @@ export class JhTableDataCell extends LitElement {
|
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
|
|
105
|
+
JhTableDataCell.register('jh-table-data-cell', JhTableDataCell);
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { JhElement } from '../element/element.js';
|
|
6
7
|
import '@jack-henry/jh-icons/icons-wc/icon-arrow-up-arrow-down.js';
|
|
7
8
|
import '@jack-henry/jh-icons/icons-wc/icon-arrow-up-small.js';
|
|
8
9
|
import '@jack-henry/jh-icons/icons-wc/icon-arrow-down-small.js';
|
|
9
10
|
|
|
10
|
-
let id = 0;
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* Table Header Cell
|
|
14
13
|
*
|
|
@@ -66,13 +65,10 @@ let id = 0;
|
|
|
66
65
|
* @slot jh-table-sorted-none - Use to insert a custom icon for no sort.
|
|
67
66
|
* @slot default - Use to insert table header text.
|
|
68
67
|
*
|
|
69
|
-
* @event jh-sort - Dispatched when a sortable header cell is activated. Event payload includes the column, sorted state, and id of the header cell and can be accessed via `e.detail.column`, `e.detail.sorted`, and `
|
|
68
|
+
* @event jh-sort - Dispatched when a sortable header cell is activated. Event payload includes the column, sorted state, and id of the header cell and can be accessed via `e.detail.reference.column`, `e.detail.reference.sorted`, and `e.detail.reference.id`.
|
|
70
69
|
* @customElement jh-table-header-cell
|
|
71
70
|
*/
|
|
72
|
-
export class JhTableHeaderCell extends
|
|
73
|
-
|
|
74
|
-
/** @type {ElementInternals} */
|
|
75
|
-
#internals;
|
|
71
|
+
export class JhTableHeaderCell extends JhElement {
|
|
76
72
|
|
|
77
73
|
static get styles() {
|
|
78
74
|
return css`
|
|
@@ -99,7 +95,7 @@ export class JhTableHeaderCell extends LitElement {
|
|
|
99
95
|
vertical-align: var(--vertical-align, top);
|
|
100
96
|
display: table-cell;
|
|
101
97
|
box-sizing: border-box;
|
|
102
|
-
width:
|
|
98
|
+
width: auto;
|
|
103
99
|
}
|
|
104
100
|
:host([sortable]:hover) {
|
|
105
101
|
border-bottom-color: var(--jh-table-header-cell-color-border-bottom-hover, var(--jh-border-decorative-color));
|
|
@@ -208,8 +204,7 @@ export class JhTableHeaderCell extends LitElement {
|
|
|
208
204
|
|
|
209
205
|
constructor() {
|
|
210
206
|
super();
|
|
211
|
-
this
|
|
212
|
-
this.#internals.role = 'columnheader';
|
|
207
|
+
this.internals.role = 'columnheader';
|
|
213
208
|
/**
|
|
214
209
|
* Sets the horizontal alignment of the content.
|
|
215
210
|
* @attr horizontal-align
|
|
@@ -233,7 +228,7 @@ export class JhTableHeaderCell extends LitElement {
|
|
|
233
228
|
connectedCallback() {
|
|
234
229
|
super.connectedCallback();
|
|
235
230
|
/** @ignore */
|
|
236
|
-
this.id = `table-header-${
|
|
231
|
+
this.id = `table-header-${this.uniqueId}`;
|
|
237
232
|
if (this.sortable) {
|
|
238
233
|
this.setAttribute('tabindex', '0');
|
|
239
234
|
this.setAttribute('aria-sort', this.sorted);
|
|
@@ -261,18 +256,13 @@ export class JhTableHeaderCell extends LitElement {
|
|
|
261
256
|
|
|
262
257
|
this.setAttribute('aria-sort', this.sorted);
|
|
263
258
|
|
|
264
|
-
this.
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
sorted: this.sorted,
|
|
272
|
-
id: this.id,
|
|
273
|
-
},
|
|
274
|
-
})
|
|
275
|
-
);
|
|
259
|
+
this.dispatchCustomEvent('jh-sort', {
|
|
260
|
+
reference: {
|
|
261
|
+
sorted: this.sorted,
|
|
262
|
+
column: this,
|
|
263
|
+
id: this.id,
|
|
264
|
+
},
|
|
265
|
+
});
|
|
276
266
|
}
|
|
277
267
|
|
|
278
268
|
#getSortingIcon() {
|
|
@@ -318,4 +308,4 @@ export class JhTableHeaderCell extends LitElement {
|
|
|
318
308
|
}
|
|
319
309
|
}
|
|
320
310
|
|
|
321
|
-
|
|
311
|
+
JhTableHeaderCell.register('jh-table-header-cell', JhTableHeaderCell);
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { JhElement } from '../element/element.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Table Row
|
|
@@ -17,10 +18,7 @@ import { LitElement, css, html } from 'lit';
|
|
|
17
18
|
* @slot default - Use to insert `<jh-table-data-cell>`s or `<jh-table-header-cell>`s.
|
|
18
19
|
* @customElement jh-table-row
|
|
19
20
|
*/
|
|
20
|
-
export class JhTableRow extends
|
|
21
|
-
|
|
22
|
-
/** @type {ElementInternals} */
|
|
23
|
-
#internals;
|
|
21
|
+
export class JhTableRow extends JhElement {
|
|
24
22
|
|
|
25
23
|
static get styles() {
|
|
26
24
|
return css`
|
|
@@ -40,8 +38,7 @@ export class JhTableRow extends LitElement {
|
|
|
40
38
|
|
|
41
39
|
constructor() {
|
|
42
40
|
super();
|
|
43
|
-
this
|
|
44
|
-
this.#internals.role = 'row';
|
|
41
|
+
this.internals.role = 'row';
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
render() {
|
|
@@ -49,4 +46,4 @@ export class JhTableRow extends LitElement {
|
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
JhTableRow.register('jh-table-row', JhTableRow);
|
package/components/tag/tag.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { JhElement } from '../element/element.js';
|
|
6
7
|
import '@jack-henry/jh-icons/icons-wc/icon-xmark.js';
|
|
7
8
|
import '../button/button.js';
|
|
8
9
|
import '../tooltip/tooltip.js';
|
|
@@ -42,7 +43,7 @@ import '../tooltip/tooltip.js';
|
|
|
42
43
|
* @event jh-dismiss - Dispatched when the tag is dismissed.
|
|
43
44
|
* @customElement jh-tag
|
|
44
45
|
*/
|
|
45
|
-
export class JhTag extends
|
|
46
|
+
export class JhTag extends JhElement {
|
|
46
47
|
|
|
47
48
|
static get styles() {
|
|
48
49
|
return css`
|
|
@@ -357,13 +358,7 @@ export class JhTag extends LitElement {
|
|
|
357
358
|
|
|
358
359
|
#handleDismissal(e) {
|
|
359
360
|
e.stopPropagation();
|
|
360
|
-
this.
|
|
361
|
-
new CustomEvent('jh-dismiss', {
|
|
362
|
-
bubbles: true,
|
|
363
|
-
cancelable: true,
|
|
364
|
-
composed: true,
|
|
365
|
-
})
|
|
366
|
-
);
|
|
361
|
+
this.dispatchCustomEvent('jh-dismiss');
|
|
367
362
|
|
|
368
363
|
if (this.removeOnDismiss) {
|
|
369
364
|
this.remove();
|
|
@@ -376,19 +371,22 @@ export class JhTag extends LitElement {
|
|
|
376
371
|
if (this.dismissible) {
|
|
377
372
|
dismissBtn = html`
|
|
378
373
|
<jh-button
|
|
379
|
-
size="
|
|
374
|
+
size="x-small"
|
|
380
375
|
appearance="secondary"
|
|
381
376
|
accessible-label=${this.dismissButtonAccessibleLabel}
|
|
382
377
|
@click=${this.#handleDismissal}>
|
|
383
|
-
<slot name="jh-tag-dismiss-icon" slot="jh-button-icon">
|
|
384
|
-
<jh-icon-xmark slot="jh-button-icon"></jh-icon-xmark>
|
|
378
|
+
<slot name="jh-tag-dismiss-icon" slot="jh-button-icon-left">
|
|
379
|
+
<jh-icon-xmark slot="jh-button-icon-left"></jh-icon-xmark>
|
|
385
380
|
</slot>
|
|
386
381
|
</jh-button>
|
|
387
382
|
`;
|
|
388
383
|
}
|
|
389
384
|
|
|
390
385
|
if (this.dismissible && this.tooltipLabel) {
|
|
391
|
-
dismissBtn = html`<jh-tooltip
|
|
386
|
+
dismissBtn = html`<jh-tooltip>
|
|
387
|
+
${dismissBtn}
|
|
388
|
+
<div slot="jh-tooltip-content">${this.tooltipLabel}</div>
|
|
389
|
+
</jh-tooltip>`;
|
|
392
390
|
}
|
|
393
391
|
return dismissBtn;
|
|
394
392
|
}
|
|
@@ -419,4 +417,4 @@ export class JhTag extends LitElement {
|
|
|
419
417
|
}
|
|
420
418
|
}
|
|
421
419
|
|
|
422
|
-
|
|
420
|
+
JhTag.register('jh-tag', JhTag);
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { JhElement } from '../element/element.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Tag Group
|
|
@@ -10,9 +11,7 @@ import { LitElement, css, html } from 'lit';
|
|
|
10
11
|
* @slot default - Use to insert `<jh-tag>` component(s).
|
|
11
12
|
* @customElement jh-tag-group
|
|
12
13
|
*/
|
|
13
|
-
export class JhTagGroup extends
|
|
14
|
-
/** @type {ElementInternals} */
|
|
15
|
-
#internals;
|
|
14
|
+
export class JhTagGroup extends JhElement {
|
|
16
15
|
|
|
17
16
|
static get styles() {
|
|
18
17
|
return css`
|
|
@@ -43,8 +42,7 @@ export class JhTagGroup extends LitElement {
|
|
|
43
42
|
|
|
44
43
|
constructor() {
|
|
45
44
|
super();
|
|
46
|
-
this
|
|
47
|
-
this.#internals.role = 'group';
|
|
45
|
+
this.internals.role = 'group';
|
|
48
46
|
/** @type {'start'| 'end'} */
|
|
49
47
|
this.alignment = 'start';
|
|
50
48
|
}
|
|
@@ -54,4 +52,4 @@ export class JhTagGroup extends LitElement {
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
JhTagGroup.register('jh-tag-group', JhTagGroup);
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { JhElement } from '../element/element.js';
|
|
6
7
|
import '../notification/notification.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -15,7 +16,7 @@ import '../notification/notification.js';
|
|
|
15
16
|
* @event jh-dismiss - Dispatched when the toast is dismissed.
|
|
16
17
|
* @customElement jh-toast
|
|
17
18
|
*/
|
|
18
|
-
export class JhToast extends
|
|
19
|
+
export class JhToast extends JhElement {
|
|
19
20
|
static get styles() {
|
|
20
21
|
return css`
|
|
21
22
|
@keyframes fadeInUp {
|
|
@@ -114,17 +115,7 @@ export class JhToast extends LitElement {
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
#removeToast() {
|
|
117
|
-
this
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
#dispatch(name) {
|
|
121
|
-
this.dispatchEvent(
|
|
122
|
-
new CustomEvent(name, {
|
|
123
|
-
bubbles: true,
|
|
124
|
-
cancelable: true,
|
|
125
|
-
composed: true,
|
|
126
|
-
})
|
|
127
|
-
);
|
|
118
|
+
this.dispatchCustomEvent('jh-dismiss');
|
|
128
119
|
}
|
|
129
120
|
|
|
130
121
|
#handleDismiss() {
|
|
@@ -165,4 +156,4 @@ export class JhToast extends LitElement {
|
|
|
165
156
|
}
|
|
166
157
|
}
|
|
167
158
|
|
|
168
|
-
|
|
159
|
+
JhToast.register('jh-toast', JhToast);
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
|
+
import { JhElement } from '../element/element.js';
|
|
7
8
|
|
|
8
9
|
let id = 0;
|
|
9
10
|
const openAttr = 'open';
|
|
@@ -11,15 +12,14 @@ const openAttr = 'open';
|
|
|
11
12
|
/**
|
|
12
13
|
* @cssprop --jh-tooltip-color-background - The tooltip and arrow background-color. Defaults to `--jh-color-content-primary-enabled`.
|
|
13
14
|
* @cssprop --jh-tooltip-color-text - The tooltip text color. Defaults to `--jh-color-content-on-primary-enabled`.
|
|
15
|
+
* @cssprop --jh-tooltip-size-max-width - The maximum width of the tooltip. Defaults to `160px`.
|
|
14
16
|
*
|
|
15
17
|
* @slot default - Use to insert the element that triggers the tooltip.
|
|
16
18
|
* @slot jh-tooltip-content - Use to insert the content of the tooltip.
|
|
17
19
|
*
|
|
18
20
|
* @customElement jh-tooltip
|
|
19
21
|
*/
|
|
20
|
-
export class JhTooltip extends
|
|
21
|
-
/** @type {ElementInternals} */
|
|
22
|
-
#internals;
|
|
22
|
+
export class JhTooltip extends JhElement {
|
|
23
23
|
|
|
24
24
|
static get styles() {
|
|
25
25
|
return css`
|
|
@@ -36,13 +36,13 @@ export class JhTooltip extends LitElement {
|
|
|
36
36
|
--jh-tooltip-color-text,
|
|
37
37
|
var(--jh-color-content-on-primary-enabled)
|
|
38
38
|
);
|
|
39
|
+
max-width: var(--jh-tooltip-size-max-width, 160px);
|
|
39
40
|
border-radius: var(--jh-border-radius-100);
|
|
40
41
|
padding: var(--jh-dimension-200);
|
|
41
42
|
font-family: var(--jh-font-helper-bold-font-family);
|
|
42
43
|
font-weight: var(--jh-font-helper-bold-font-weight);
|
|
43
44
|
font-size: var(--jh-font-helper-bold-font-size);
|
|
44
45
|
line-height: var(--jh-font-helper-bold-line-height);
|
|
45
|
-
max-width: 160px;
|
|
46
46
|
width: max-content;
|
|
47
47
|
position: absolute;
|
|
48
48
|
box-sizing: border-box;
|
|
@@ -224,7 +224,6 @@ export class JhTooltip extends LitElement {
|
|
|
224
224
|
|
|
225
225
|
constructor() {
|
|
226
226
|
super();
|
|
227
|
-
this.#internals = this.attachInternals();
|
|
228
227
|
/**@type {?Boolean} */
|
|
229
228
|
this.flipDisabled = false;
|
|
230
229
|
/**@type {?Boolean} */
|
|
@@ -253,14 +252,14 @@ export class JhTooltip extends LitElement {
|
|
|
253
252
|
const hasContent = slot.assignedNodes().length > 0;
|
|
254
253
|
|
|
255
254
|
if (hasContent) {
|
|
256
|
-
this
|
|
255
|
+
this.internals.role = 'tooltip';
|
|
257
256
|
this.addEventListener('focus', this.#handleOpenTooltip, true);
|
|
258
257
|
this.addEventListener('mouseenter', this.#handleOpenTooltip);
|
|
259
258
|
this.addEventListener('blur', this.#handleCloseTooltip, true);
|
|
260
259
|
this.addEventListener('mouseleave', this.#handleCloseTooltip);
|
|
261
260
|
this.addEventListener('keydown', this.#handleKeyDown);
|
|
262
261
|
} else {
|
|
263
|
-
this
|
|
262
|
+
this.internals.role = '';
|
|
264
263
|
this.#handleCloseTooltip();
|
|
265
264
|
this.removeEventListener('focus', this.#handleOpenTooltip);
|
|
266
265
|
this.removeEventListener('mouseenter', this.#handleOpenTooltip);
|
|
@@ -476,4 +475,4 @@ export class JhTooltip extends LitElement {
|
|
|
476
475
|
}
|
|
477
476
|
}
|
|
478
477
|
|
|
479
|
-
|
|
478
|
+
JhTooltip.register('jh-tooltip', JhTooltip);
|