@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.
Files changed (37) hide show
  1. package/NOTICE +1 -1
  2. package/README.md +2 -2
  3. package/components/badge/badge.js +4 -4
  4. package/components/button/button.js +106 -52
  5. package/components/card/card.js +4 -4
  6. package/components/checkbox/checkbox.js +19 -31
  7. package/components/checkbox-group/checkbox-group.js +12 -20
  8. package/components/divider/divider.js +5 -5
  9. package/components/element/element.js +94 -0
  10. package/components/icon/icon.js +14 -12
  11. package/components/input/input.js +72 -74
  12. package/components/input-email/input-email.js +1 -1
  13. package/components/input-password/input-password.js +10 -19
  14. package/components/input-search/input-search.js +2 -2
  15. package/components/input-telephone/input-telephone.js +1 -1
  16. package/components/input-textarea/input-textarea.js +4 -13
  17. package/components/input-url/input-url.js +1 -1
  18. package/components/list-group/list-group.js +6 -13
  19. package/components/list-item/list-item.js +131 -143
  20. package/components/menu/menu.js +5 -8
  21. package/components/notification/notification.js +19 -21
  22. package/components/progress/progress.js +62 -56
  23. package/components/radio/radio.js +8 -21
  24. package/components/radio-group/radio-group.js +16 -31
  25. package/components/select/select.js +51 -30
  26. package/components/switch/switch.js +9 -22
  27. package/components/table/table.js +21 -29
  28. package/components/table-data-cell/table-data-cell.js +7 -9
  29. package/components/table-header-cell/table-header-cell.js +15 -25
  30. package/components/table-row/table-row.js +5 -8
  31. package/components/tag/tag.js +12 -14
  32. package/components/tag-group/tag-group.js +5 -7
  33. package/components/toast/toast.js +5 -14
  34. package/components/tooltip/tooltip.js +8 -9
  35. package/custom-elements.json +350 -215
  36. package/jsconfig.json +1 -1
  37. package/package.json +11 -15
@@ -2,25 +2,43 @@
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
 
5
- import { LitElement, css, html } from 'lit';
5
+ import { css, html } from 'lit';
6
+ import { JhElement } from '../element/element.js';
6
7
  import '../divider/divider.js';
7
8
  import { ifDefined } from 'lit/directives/if-defined.js';
8
9
 
9
10
  /**
10
- * @cssprop --jh-list-item-color-background - The list-item container's background-color.
11
+ * @cssprop --jh-list-item-color-background-enabled - The list-item container's background-color.
11
12
  * Defaults to `transparent`.
12
- * @cssprop --jh-list-item-color-text - The default, left, text, metadata, right, primary, and secondary slot text color. Defaults to `--jh-color-content-primary-enabled`.
13
- * @cssprop --jh-list-item-space-padding-right - The right padding on the list-item container. Defaults to `--jh-dimension-600`.
14
- * @cssprop --jh-list-item-space-padding-left - The left padding on the list-item container. Defaults to `--jh-dimension-600`.
15
- * @cssprop --jh-list-item-size-height - The list-item's height. Defaults to `auto`.
16
- * @cssprop --jh-list-item-color-text-primary - The primary text color.
13
+ * @cssprop --jh-list-item-color-text-primary-enabled - The list-item text color for the default, left, right slots and primary text.
17
14
  * Defaults to `--jh-color-content-primary-enabled`.
18
- * @cssprop --jh-list-item-color-text-secondary - The secondary text color.
19
- * Defaults to `--jh-color-content-secondary-enabled`.
20
- * @cssprop --jh-list-item-metadata-color-text-primary - The primary metadata text color.
15
+ * @cssprop --jh-list-item-color-text-primary-focus - The list-item text color for the default, left, right slots and primary text when interactive and focused.
16
+ * Defaults to `--jh-color-content-primary-enabled`.
17
+ * @cssprop --jh-list-item-color-text-primary-hover - The list-item text color for the default, left, right slots and primary text when interactive and hovered.
18
+ * Defaults to `--jh-color-content-primary-enabled`.
19
+ * @cssprop --jh-list-item-color-text-primary-active - The list-item text color for the default, left, right slots and primary text when interactive and active.
20
+ * Defaults to `--jh-color-content-primary-enabled`.
21
+ * @cssprop --jh-list-item-color-text-primary-selected - The list-item text color for the default, left, right slots and primary text when interactive and selected.
21
22
  * Defaults to `--jh-color-content-primary-enabled`.
22
- * @cssprop --jh-list-item-metadata-color-text-secondary - The secondary metadata text color.
23
+ * @cssprop --jh-list-item-color-text-primary-disabled - The list-item text color for the default, left, right slots and primary text when interactive and disabled.
24
+ * Defaults to `--jh-color-content-primary-enabled`.
25
+ * @cssprop --jh-list-item-color-text-secondary-enabled - The secondary text color.
26
+ * Defaults to `--jh-color-content-secondary-enabled`.
27
+ * @cssprop --jh-list-item-color-text-secondary-focus - The secondary text color when interactive and focused.
28
+ * Defaults to `--jh-color-content-secondary-enabled`.
29
+ * @cssprop --jh-list-item-color-text-secondary-hover - The secondary text color when interactive and hovered.
30
+ * Defaults to `--jh-color-content-secondary-enabled`.
31
+ * @cssprop --jh-list-item-color-text-secondary-active - The secondary text color when interactive and active.
32
+ * Defaults to `--jh-color-content-secondary-enabled`.
33
+ * @cssprop --jh-list-item-color-text-secondary-selected - The secondary text color when interactive and selected.
34
+ * Defaults to `--jh-color-content-secondary-enabled`.
35
+ * @cssprop --jh-list-item-color-text-secondary-disabled - The secondary text color when interactive and disabled.
23
36
  * Defaults to `--jh-color-content-secondary-enabled`.
37
+ * @cssprop --jh-list-item-space-padding-right - The right padding on the list-item container. Defaults to `--jh-dimension-600`.
38
+ * @cssprop --jh-list-item-space-padding-left - The left padding on the list-item container. Defaults to `--jh-dimension-600`.
39
+ * @cssprop --jh-list-item-space-padding-top - The top padding on the list-item container. Defaults to `--jh-dimension-400`.
40
+ * @cssprop --jh-list-item-space-padding-bottom - The bottom padding on the list-item container. Defaults to `--jh-dimension-400`.
41
+ * @cssprop --jh-list-item-size-height - The list-item's height. Defaults to `auto`.
24
42
  * @cssprop --jh-list-item-color-background-focus - The list-item background-color when interactive and focused.
25
43
  * Defaults to `--jh-color-container-primary-hover`.
26
44
  * @cssprop --jh-list-item-color-focus - The list-item outline when it is interactive and receives keyboard focus.
@@ -29,36 +47,33 @@ import { ifDefined } from 'lit/directives/if-defined.js';
29
47
  * Defaults to `--jh-color-container-primary-hover`.
30
48
  * @cssprop --jh-list-item-color-background-active - The list-item background-color when interactive and active.
31
49
  * Defaults to `--jh-color-container-primary-active`.
50
+ * @cssprop --jh-list-item-color-background-disabled - The list-item background-color when interactive and disabled.
51
+ * Defaults to `transparent`.
52
+ * @cssprop --jh-list-item-opacity-disabled - The list-item opacity when interactive and disabled.
53
+ * Defaults to `--jh-opacity-disabled`.
32
54
  * @cssprop --jh-list-item-color-background-selected - The list-item background-color when interactive and selected. Defaults to `--jh-color-container-primary-selected`.
33
55
  * @cssprop --jh-list-item-color-border-selected - The list-item border-left-color when interactive and selected.
34
56
  * Defaults to `--jh-border-selected-color`.
35
57
  *
36
- * @slot default - Use to insert fully customized content into the list-item. Cannot be used with the other slots.
58
+ * @slot default - Use to insert custom content into the list-item.
37
59
  * @slot jh-list-item-left - Use to insert custom content on the left the list-item.
38
60
  * @slot jh-list-item-right - Use to insert custom content on the right the list-item.
39
- * @slot jh-list-item-content - Use to insert custom content into the list-item.
40
- * @slot jh-list-item-metadata - Use to insert custom metadata into the list-item.
41
61
  * @customElement jh-list-item
42
62
  */
43
- export class JhListItem extends LitElement {
44
- /** @type {ElementInternals} */
45
- #internals;
46
-
63
+ export class JhListItem extends JhElement {
47
64
  static get styles() {
48
65
  return css`
49
66
  :host {
50
- background-color: var(--jh-list-item-color-background, transparent);
51
- padding-bottom: var(--jh-dimension-400);
67
+ background-color: var(--jh-list-item-color-background-enabled, transparent);
68
+ color: var(
69
+ --jh-list-item-color-text-primary-enabled,
70
+ var(--jh-color-content-primary-enabled)
71
+ );
52
72
  font-family: var(--jh-font-body-medium-1-font-family);
53
73
  font-weight: var(--jh-font-body-medium-1-font-weight);
54
74
  font-size: var(--jh-font-body-medium-1-font-size);
55
75
  line-height: var(--jh-font-body-medium-1-line-height);
56
- color: var(
57
- --jh-list-item-color-text,
58
- var(--jh-color-content-primary-enabled)
59
- );
60
76
  display: block;
61
- box-sizing: border-box;
62
77
  }
63
78
  /* list item height is set to auto when styling hook is not set */
64
79
  .list-item {
@@ -70,18 +85,19 @@ export class JhListItem extends LitElement {
70
85
  --jh-list-item-space-padding-left,
71
86
  var(--jh-dimension-600)
72
87
  );
73
- padding-top: var(--jh-dimension-400);
88
+ height: var(--jh-list-item-size-height, auto);
89
+ padding-top: var(--jh-list-item-space-padding-top, var(--jh-dimension-400));
90
+ padding-bottom: var(--jh-list-item-space-padding-bottom, var(--jh-dimension-400));
91
+ gap: var(--jh-dimension-200);
74
92
  display: flex;
75
93
  flex-direction: row;
76
94
  align-items: center;
77
- height: calc(var(--jh-list-item-size-height, auto) - var(--jh-dimension-400));
78
95
  box-sizing: border-box;
79
96
  }
80
- :host([show-divider]) .list-item {
81
- height: calc(var(--jh-list-item-size-height, auto) - var(--jh-dimension-400) - 1px);
82
- }
83
97
  /* states for interactive list-items*/
84
98
  :host([tabindex]:focus-visible) {
99
+ --jh-list-item-color-text-primary-enabled: var(--jh-list-item-color-text-primary-focus);
100
+ --jh-list-item-color-text-secondary-enabled: var(--jh-list-item-color-text-secondary-focus);
85
101
  background-color: var(
86
102
  --jh-list-item-color-background-focus,
87
103
  var(--jh-color-container-primary-hover)
@@ -95,6 +111,8 @@ export class JhListItem extends LitElement {
95
111
  outline-offset: -2px;
96
112
  }
97
113
  :host([tabindex]:hover) {
114
+ --jh-list-item-color-text-primary-enabled: var(--jh-list-item-color-text-primary-hover);
115
+ --jh-list-item-color-text-secondary-enabled: var(--jh-list-item-color-text-secondary-hover);
98
116
  background-color: var(
99
117
  --jh-list-item-color-background-hover,
100
118
  var(--jh-color-container-primary-hover)
@@ -102,127 +120,86 @@ export class JhListItem extends LitElement {
102
120
  cursor: pointer;
103
121
  }
104
122
  :host([tabindex]:active) {
123
+ --jh-list-item-color-text-primary-enabled: var(--jh-list-item-color-text-primary-active);
124
+ --jh-list-item-color-text-secondary-enabled: var(--jh-list-item-color-text-secondary-active);
105
125
  background-color: var(
106
126
  --jh-list-item-color-background-active,
107
127
  var(--jh-color-container-primary-active)
108
128
  );
109
129
  }
130
+ :host([tabindex][disabled]) {
131
+ --jh-list-item-color-text-primary-enabled: var(--jh-list-item-color-text-primary-disabled);
132
+ --jh-list-item-color-text-secondary-enabled: var(--jh-list-item-color-text-secondary-disabled);
133
+ background-color: var(--jh-list-item-color-background-disabled, transparent);
134
+ cursor: default;
135
+ pointer-events: none;
136
+ }
137
+ :host([tabindex][disabled]) .list-item {
138
+ opacity: var(--jh-list-item-opacity-disabled, var(--jh-opacity-disabled));
139
+ }
110
140
  :host([tabindex][selected]) {
141
+ --jh-list-item-color-text-primary-enabled: var(--jh-list-item-color-text-primary-selected);
142
+ --jh-list-item-color-text-secondary-enabled: var(--jh-list-item-color-text-secondary-selected);
111
143
  background-color: var(
112
144
  --jh-list-item-color-background-selected,
113
145
  var(--jh-color-container-primary-selected)
114
146
  );
115
- border-left-color: var(
116
- --jh-list-item-color-border-selected,
117
- var(--jh-border-selected-color)
118
- );
119
- border-left-style: var(--jh-border-selected-style);
120
- border-left-width: var(--jh-border-selected-width);
121
147
  }
122
148
  :host([tabindex][selected]) .list-item {
123
149
  padding-left: calc(var(
124
150
  --jh-list-item-space-padding-left,
125
151
  var(--jh-dimension-600)
126
152
  ) - var(--jh-border-selected-width));
127
- }
128
- :host([tabindex][disabled]) {
129
- opacity: var(--jh-opacity-disabled);
130
- cursor: default;
131
- pointer-events: none;
132
- }
133
-
134
- :host([show-divider]) {
135
- padding-bottom: 0;
153
+ border-left-color: var(
154
+ --jh-list-item-color-border-selected,
155
+ var(--jh-border-selected-color)
156
+ );
157
+ border-left-style: var(--jh-border-selected-style);
158
+ border-left-width: var(--jh-border-selected-width);
136
159
  }
137
160
  jh-divider {
161
+ margin-top: 0;
138
162
  margin-bottom: 0;
139
163
  }
140
- ::slotted([slot='jh-list-item-left']) {
141
- color: var(
142
- --jh-list-item-color-text,
143
- var(--jh-color-content-primary-enabled)
144
- );
145
- margin-right: var(--jh-dimension-200);
164
+ slot[name="jh-list-item-left"],
165
+ slot[name="jh-list-item-right"] {
146
166
  flex: 0 0 auto;
167
+ align-items: center;
168
+ display: none;
147
169
  }
148
- ::slotted([slot='jh-list-item-content']) {
149
- color: var(
150
- --jh-list-item-color-text,
151
- var(--jh-color-content-primary-enabled)
152
- );
170
+ slot:not([name]) {
153
171
  flex: 1 1 auto;
172
+ display: none;
173
+ min-width: 0;
154
174
  }
155
175
  .text {
156
- display: flex;
176
+ gap: var(--jh-dimension-50);
177
+ display: none;
157
178
  flex-direction: column;
158
179
  flex: 1 1 auto;
159
180
  min-width: 0;
160
181
  }
161
- ::slotted([slot='jh-list-item-metadata']) {
162
- color: var(
163
- --jh-list-item-color-text,
164
- var(--jh-color-content-primary-enabled)
165
- );
166
- margin-left: var(--jh-dimension-200);
167
- flex: 0 0 auto;
168
- }
169
- .metadata {
170
- margin-left: var(--jh-dimension-200);
171
- flex: 0 0 auto;
182
+ .display,
183
+ slot[name="jh-list-item-left"].has-content,
184
+ slot[name="jh-list-item-right"].has-content,
185
+ slot:not([name]).has-content {
172
186
  display: flex;
173
- flex-direction: column;
174
- }
175
- ::slotted([slot='jh-list-item-right']) {
176
- color: var(
177
- --jh-list-item-color-text,
178
- var(--jh-color-content-primary-enabled)
179
- );
180
- margin-left: var(--jh-dimension-200);
181
- flex: 0 0 auto;
182
- }
183
- .primary-text {
184
- color: var(
185
- --jh-list-item-color-text-primary,
186
- var(--jh-color-content-primary-enabled)
187
- );
188
187
  }
189
188
  .secondary-text {
190
189
  color: var(
191
- --jh-list-item-color-text-secondary,
190
+ --jh-list-item-color-text-secondary-enabled,
192
191
  var(--jh-color-content-secondary-enabled)
193
192
  );
194
193
  font-family: var(--jh-font-helper-regular-font-family);
195
194
  font-weight: var(--jh-font-helper-regular-font-weight);
196
195
  font-size: var(--jh-font-helper-regular-font-size);
197
196
  line-height: var(--jh-font-helper-regular-line-height);
198
- margin-top: var(--jh-dimension-50);
199
197
  }
200
198
  .primary-text,
201
199
  .secondary-text {
202
200
  display: block;
203
201
  word-break: break-word;
204
202
  }
205
- .primary-metadata {
206
- color: var(
207
- --jh-list-item-metadata-color-text-primary,
208
- var(--jh-color-content-primary-enabled)
209
- );
210
- text-align: right;
211
- white-space: nowrap;
212
- }
213
- .secondary-metadata {
214
- color: var(
215
- --jh-list-item-metadata-color-text-secondary,
216
- var(--jh-color-content-secondary-enabled)
217
- );
218
- font-family: var(--jh-font-helper-regular-font-family);
219
- font-weight: var(--jh-font-helper-regular-font-weight);
220
- font-size: var(--jh-font-helper-regular-font-size);
221
- line-height: var(--jh-font-helper-regular-line-height);
222
- margin-top: var(--jh-dimension-50);
223
- text-align: right;
224
- white-space: nowrap;
225
- }
226
203
  `;
227
204
  }
228
205
 
@@ -242,13 +219,6 @@ export class JhListItem extends LitElement {
242
219
  type: Number,
243
220
  attribute: 'divider-inset',
244
221
  },
245
- /**
246
- * The text to show as primary metadata.
247
- */
248
- primaryMetadata: {
249
- type: String,
250
- attribute: 'primary-metadata',
251
- },
252
222
  /**
253
223
  * The text to show as primary text.
254
224
  */
@@ -256,13 +226,6 @@ export class JhListItem extends LitElement {
256
226
  type: String,
257
227
  attribute: 'primary-text',
258
228
  },
259
- /**
260
- * The text to show as secondary metadata.
261
- */
262
- secondaryMetadata: {
263
- type: String,
264
- attribute: 'secondary-metadata',
265
- },
266
229
  /**
267
230
  * The text to show as secondary text.
268
231
  */
@@ -285,31 +248,56 @@ export class JhListItem extends LitElement {
285
248
  reflect: true,
286
249
  attribute: 'show-divider',
287
250
  },
251
+ _showFallback: { type: Boolean, state: true },
252
+ _hasLeftSlotContent: { type: Boolean, state: true },
253
+ _hasRightSlotContent: { type: Boolean, state: true },
288
254
  };
289
255
  }
290
256
 
291
257
  constructor() {
292
258
  super();
293
- this.#internals = this.attachInternals();
294
- this.#internals.role = 'listitem';
259
+ this.internals.role = 'listitem';
295
260
  /** @type {?boolean} */
296
261
  this.disabled = false;
297
262
  /** @type {null|0|8|16|24|32|40|48|56|64|72|80|88|96} */
298
263
  this.dividerInset = null;
299
264
  /** @type {?string} */
300
- this.primaryMetadata = null;
301
- /** @type {?string} */
302
265
  this.primaryText = null;
303
266
  /** @type {?string} */
304
- this.secondaryMetadata = null;
305
- /** @type {?string} */
306
267
  this.secondaryText = null;
307
268
  /** @type {?boolean} */
308
269
  this.selected = false;
309
270
  /** @type {?boolean} */
310
271
  this.showDivider = false;
272
+ this._showFallback = true;
273
+ this._hasLeftSlotContent = false;
274
+ this._hasRightSlotContent = false;
311
275
  }
312
276
 
277
+ #checkSlotContent(slot) {
278
+ const slottedElements = slot.assignedElements({ flatten: true });
279
+ if (slottedElements.length > 0) return true;
280
+ if (slot.assignedNodes({ flatten: true }).some(
281
+ (node) => node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== ''
282
+ )) return true;
283
+ return false;
284
+ }
285
+
286
+ #handleSlotChange(e) {
287
+ const slot = e.target;
288
+ if (slot.name === 'jh-list-item-left') {
289
+ this._hasLeftSlotContent = this.#checkSlotContent(slot);
290
+ } else if (slot.name === 'jh-list-item-right') {
291
+ this._hasRightSlotContent = this.#checkSlotContent(slot);
292
+ } else {
293
+ // default slot
294
+ const nodes = slot.assignedNodes();
295
+ this._showFallback = nodes.every(
296
+ node => node.nodeType === Node.TEXT_NODE && !node.textContent.trim()
297
+ );
298
+ }
299
+ }
300
+
313
301
  render() {
314
302
  let showDivider;
315
303
 
@@ -329,25 +317,25 @@ export class JhListItem extends LitElement {
329
317
 
330
318
  return html`
331
319
  <div class="list-item">
332
- <slot></slot>
333
- <slot name="jh-list-item-left"></slot>
334
- <slot name="jh-list-item-content">
335
- <div class="text">
336
- <div class="primary-text">${this.primaryText}</div>
337
- <div class="secondary-text">${this.secondaryText}</div>
338
- </div>
339
- </slot>
340
- <slot name="jh-list-item-metadata">
341
- <div class="metadata">
342
- <div class="primary-metadata">${this.primaryMetadata}</div>
343
- <div class="secondary-metadata">${this.secondaryMetadata}</div>
344
- </div>
345
- </slot>
346
- <slot name="jh-list-item-right"></slot>
320
+ <slot
321
+ name="jh-list-item-left"
322
+ class=${this._hasLeftSlotContent ? 'has-content' : ''}
323
+ @slotchange=${this.#handleSlotChange}
324
+ ></slot>
325
+ <slot @slotchange=${this.#handleSlotChange}
326
+ class=${this._showFallback ? '' : 'has-content'}></slot>
327
+ <div class=${`text ${this._showFallback ? 'display' : ''}`}>
328
+ ${this.primaryText ? html`<div class="primary-text">${this.primaryText}</div>` : ''}
329
+ ${this.secondaryText ? html`<div class="secondary-text">${this.secondaryText}</div>` : ''}
330
+ </div>
331
+ <slot
332
+ name="jh-list-item-right"
333
+ class=${this._hasRightSlotContent ? 'has-content' : ''}
334
+ @slotchange=${this.#handleSlotChange}
335
+ ></slot>
347
336
  </div>
348
337
  ${showDivider}
349
338
  `;
350
339
  }
351
340
  }
352
-
353
- customElements.define('jh-list-item', JhListItem);
341
+ JhListItem.register('jh-list-item', JhListItem);
@@ -2,7 +2,8 @@
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
 
5
- import { LitElement, css, html } from 'lit';
5
+ import { css, html } from 'lit';
6
+ import { JhElement } from '../element/element.js';
6
7
 
7
8
  /**
8
9
  * @cssprop --jh-menu-z-index - The menu z-index. Defaults to `--jh-z-index-positive-1000`.
@@ -15,10 +16,7 @@ import { LitElement, css, html } from 'lit';
15
16
  * @slot default - Use to insert menu items.
16
17
  * @customElement jh-menu
17
18
  */
18
- export class JhMenu extends LitElement {
19
- /** @type {ElementInternals} */
20
- #internals;
21
-
19
+ export class JhMenu extends JhElement {
22
20
  static get styles() {
23
21
  return css`
24
22
  :host {
@@ -57,8 +55,7 @@ export class JhMenu extends LitElement {
57
55
  }
58
56
  constructor() {
59
57
  super();
60
- this.#internals = this.attachInternals();
61
- this.#internals.role = 'menu';
58
+ this.internals.role = 'menu';
62
59
  }
63
60
  render() {
64
61
  return html`
@@ -68,4 +65,4 @@ export class JhMenu extends LitElement {
68
65
  `;
69
66
  }
70
67
  }
71
- customElements.define('jh-menu', JhMenu);
68
+ JhMenu.register('jh-menu', JhMenu);
@@ -2,7 +2,8 @@
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
 
5
- import { LitElement, css, html } from 'lit';
5
+ import { css, html } from 'lit';
6
+ import { JhElement } from '../element/element.js';
6
7
  import '../button/button.js';
7
8
  import '@jack-henry/jh-icons/icons-wc/icon-xmark.js';
8
9
 
@@ -59,7 +60,7 @@ import '@jack-henry/jh-icons/icons-wc/icon-xmark.js';
59
60
  *
60
61
  * @customElement jh-notification
61
62
  */
62
- export class JhNotification extends LitElement {
63
+ export class JhNotification extends JhElement {
63
64
  static get styles() {
64
65
  return css`
65
66
  :host {
@@ -136,7 +137,7 @@ export class JhNotification extends LitElement {
136
137
  }
137
138
  /* Default slot styling */
138
139
  .display-default-slot {
139
- padding: var(--jh-dimension-200) 0;
140
+ padding: var(--jh-dimension-100) 0;
140
141
  margin: var(--jh-dimension-50) 0;
141
142
  font: var(--jh-font-body-regular-1);
142
143
  display: flex;
@@ -149,7 +150,7 @@ export class JhNotification extends LitElement {
149
150
  }
150
151
  slot[name="jh-notification-icon"]::slotted(*) {
151
152
  margin-right: var(--jh-dimension-400);
152
- padding: var(--jh-dimension-200) 0;
153
+ padding: var(--jh-dimension-100) 0;
153
154
  }
154
155
  :host([appearance='neutral']) slot[name="jh-notification-icon"] {
155
156
  --jh-icon-color-fill: var(--jh-notification-icon-color-fill-neutral, var(--jh-color-content-on-primary-enabled));
@@ -204,7 +205,8 @@ export class JhNotification extends LitElement {
204
205
  .stacked-container,
205
206
  .inline-container {
206
207
  display: flex;
207
- align-items: flex-start;
208
+ align-items: center;
209
+ line-height: 0;
208
210
  }
209
211
  `;
210
212
  }
@@ -252,7 +254,7 @@ export class JhNotification extends LitElement {
252
254
  }
253
255
 
254
256
  #handleDismissal() {
255
- this.#dispatch('jh-dismiss');
257
+ this.dispatchCustomEvent('jh-dismiss');
256
258
  // if notification is wrapped by jh-toast component, do not remove notification from DOM
257
259
  if (this.parentNode.host?.nodeName === 'JH-TOAST') {
258
260
  return;
@@ -261,16 +263,6 @@ export class JhNotification extends LitElement {
261
263
  }
262
264
  }
263
265
 
264
- #dispatch(name) {
265
- this.dispatchEvent(
266
- new CustomEvent(name, {
267
- bubbles: true,
268
- cancelable: true,
269
- composed: true,
270
- })
271
- );
272
- }
273
-
274
266
  #getActionButtons() {
275
267
  let className = this.stacked ? 'stacked-action-btn' : 'inline-action-btn';
276
268
  return html`
@@ -295,6 +287,13 @@ export class JhNotification extends LitElement {
295
287
  }
296
288
  }
297
289
 
290
+ #handleIconSlotChange(e) {
291
+ let newSlottedElement = e.target.assignedElements()[0];
292
+ if (newSlottedElement?.tagName.startsWith('JH-ICON')) {
293
+ newSlottedElement.setAttribute('size', 'medium');
294
+ }
295
+ }
296
+
298
297
  render() {
299
298
  let dismissBtn;
300
299
 
@@ -305,8 +304,8 @@ export class JhNotification extends LitElement {
305
304
  appearance="secondary"
306
305
  accessible-label=${this.dismissButtonAccessibleLabel}
307
306
  @click=${this.#handleDismissal}
308
- ><slot name="jh-notification-dismiss-icon" slot="jh-button-icon">
309
- <jh-icon-xmark slot="jh-button-icon"></jh-icon-xmark>
307
+ ><slot name="jh-notification-dismiss-icon" slot="jh-button-icon-left">
308
+ <jh-icon-xmark slot="jh-button-icon-left"></jh-icon-xmark>
310
309
  </slot>
311
310
  </jh-button>
312
311
  `;
@@ -314,7 +313,7 @@ export class JhNotification extends LitElement {
314
313
 
315
314
  return html`
316
315
  <div class=${this.stacked ? 'stacked-container' : 'inline-container'}>
317
- <slot aria-hidden="true" name="jh-notification-icon"></slot>
316
+ <slot aria-hidden="true" name="jh-notification-icon" @slotchange=${this.#handleIconSlotChange}></slot>
318
317
  <slot @slotchange=${this.#handleSlotChange}></slot>
319
318
  ${this.stacked ? null : this.#getActionButtons()}
320
319
  ${dismissBtn}
@@ -323,5 +322,4 @@ export class JhNotification extends LitElement {
323
322
  `;
324
323
  }
325
324
  }
326
-
327
- customElements.define('jh-notification', JhNotification);
325
+ JhNotification.register('jh-notification', JhNotification);