@justeattakeaway/pie-notification 0.8.0 → 0.9.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/README.md CHANGED
@@ -29,11 +29,9 @@ This component can be easily integrated into various frontend frameworks and cus
29
29
  To install `pie-notification` in your application, run the following on your command line:
30
30
 
31
31
  ```bash
32
- # npm
33
- $ npm i @justeattakeaway/pie-notification
32
+ npm i @justeattakeaway/pie-notification
34
33
 
35
- # yarn
36
- $ yarn add @justeattakeaway/pie-notification
34
+ yarn add @justeattakeaway/pie-notification
37
35
  ```
38
36
 
39
37
  For full information on using PIE components as part of an application, check out the [Getting Started Guide](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components).
@@ -92,4 +90,4 @@ In your markup or JSX, you can then use these to set the properties for the `pie
92
90
 
93
91
  ## Contributing
94
92
 
95
- Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
93
+ Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
@@ -277,49 +277,10 @@
277
277
  "text": "Array<HTMLElement>"
278
278
  }
279
279
  },
280
- {
281
- "kind": "field",
282
- "name": "_hasExternalIcon",
283
- "type": {
284
- "text": "boolean"
285
- },
286
- "privacy": "protected",
287
- "default": "false"
288
- },
289
- {
290
- "kind": "field",
291
- "name": "_hasIconClass",
292
- "type": {
293
- "text": "boolean"
294
- },
295
- "privacy": "protected",
296
- "default": "false"
297
- },
298
- {
299
- "kind": "method",
300
- "name": "updateIconProperties",
301
- "privacy": "private",
302
- "description": "Method responsible to check if an external icon has been provided.\nIt reads from icon slot if there is an external icon as well check if variant has default icon."
303
- },
304
280
  {
305
281
  "kind": "method",
306
282
  "name": "renderFooter",
307
283
  "privacy": "private",
308
- "parameters": [
309
- {
310
- "name": "leadingAction",
311
- "type": {
312
- "text": "ActionProps"
313
- }
314
- },
315
- {
316
- "name": "supportingAction",
317
- "optional": true,
318
- "type": {
319
- "text": "ActionProps"
320
- }
321
- }
322
- ],
323
284
  "description": "Template for the footer area\nCalled within the main render function."
324
285
  },
325
286
  {
@@ -331,64 +292,14 @@
331
292
  "text": "TemplateResult"
332
293
  }
333
294
  },
334
- "parameters": [
335
- {
336
- "name": "heading",
337
- "type": {
338
- "text": "NotificationProps['heading']"
339
- }
340
- },
341
- {
342
- "name": "headingTag",
343
- "type": {
344
- "text": "StaticValue"
345
- }
346
- }
347
- ],
348
295
  "description": "Template for the header area\nCalled within the main render function."
349
296
  },
350
- {
351
- "kind": "method",
352
- "name": "variantHasDefaultIcon",
353
- "privacy": "private",
354
- "parameters": [
355
- {
356
- "name": "variant",
357
- "type": {
358
- "text": "NonNullable<NotificationProps['variant']>"
359
- }
360
- }
361
- ],
362
- "description": "Util method that returns a boolean if variant has a default icon."
363
- },
364
297
  {
365
298
  "kind": "method",
366
299
  "name": "getDefaultVariantIcon",
367
300
  "privacy": "private",
368
- "parameters": [
369
- {
370
- "name": "variant",
371
- "type": {
372
- "text": "NonNullable<NotificationProps['variant']>"
373
- }
374
- }
375
- ],
376
301
  "description": "Util method that returns an icon from a variant that has default icon."
377
302
  },
378
- {
379
- "kind": "method",
380
- "name": "renderIconVariant",
381
- "privacy": "private",
382
- "parameters": [
383
- {
384
- "name": "variant",
385
- "type": {
386
- "text": "NonNullable<NotificationProps['variant']>"
387
- }
388
- }
389
- ],
390
- "description": "Util method that returns a template with a default icon according to the chosen variant.\nCalled within the renderIcon method."
391
- },
392
303
  {
393
304
  "kind": "method",
394
305
  "name": "renderIcon",
@@ -398,27 +309,7 @@
398
309
  "text": "TemplateResult | typeof nothing"
399
310
  }
400
311
  },
401
- "parameters": [
402
- {
403
- "name": "variant",
404
- "type": {
405
- "text": "NonNullable<NotificationProps['variant']>"
406
- }
407
- },
408
- {
409
- "name": "hasExternalIcon",
410
- "type": {
411
- "text": "boolean"
412
- }
413
- },
414
- {
415
- "name": "hasIconClass",
416
- "type": {
417
- "text": "boolean"
418
- }
419
- }
420
- ],
421
- "description": "Template for the heading icon area.\nIt can return an icon provided externally via named slot or it can return an default icon according to the chosen variant.\nCalled within the main render function."
312
+ "description": "Template for the heading icon area.\nIt can return an icon provided externally via named slot or it can return a default icon according to the chosen variant if defined.\nCalled within the main render function."
422
313
  },
423
314
  {
424
315
  "kind": "method",
package/dist/index.d.ts CHANGED
@@ -70,6 +70,7 @@ export declare interface NotificationProps {
70
70
  leadingAction?: ActionProps;
71
71
  /**
72
72
  * The supporting action for the notification.
73
+ * Will only render if `leadingAction` is passed
73
74
  */
74
75
  supportingAction?: ActionProps;
75
76
  /**
@@ -132,26 +133,12 @@ export declare class PieNotification extends LitElement implements NotificationP
132
133
  hasStackedActions: boolean;
133
134
  aria: NotificationProps['aria'];
134
135
  _iconSlot: Array<HTMLElement>;
135
- protected _hasExternalIcon: boolean;
136
- protected _hasIconClass: boolean;
137
136
  static styles: CSSResult;
138
- /**
139
- * Lifecycle method executed when component is about to update.
140
- * It update icon properties if variant has changes.
141
- */
142
- protected willUpdate(_changedProperties: PropertyValues<this>): void;
143
137
  /**
144
138
  * Lifecycle method executed when component is updated.
145
139
  * It dispatches an event if notification is opened.
146
140
  */
147
141
  protected updated(_changedProperties: PropertyValues<this>): void;
148
- /**
149
- * Method responsible to check if an external icon has been provided.
150
- * It reads from icon slot if there is an external icon as well check if variant has default icon.
151
- *
152
- * @private
153
- */
154
- private updateIconProperties;
155
142
  /**
156
143
  * Template for the footer area
157
144
  * Called within the main render function.
@@ -163,45 +150,20 @@ export declare class PieNotification extends LitElement implements NotificationP
163
150
  * Template for the header area
164
151
  * Called within the main render function.
165
152
  *
166
- * @param {NotificationProps['heading']} heading
167
- * @param {StaticValue} headingTag
168
- *
169
153
  * @private
170
154
  */
171
155
  private renderNotificationHeading;
172
- /**
173
- * Util method that returns a boolean if variant has a default icon.
174
- *
175
- * @param {NonNullable<NotificationProps['variant']>} variant
176
- *
177
- * @private
178
- */
179
- private variantHasDefaultIcon;
180
156
  /**
181
157
  * Util method that returns an icon from a variant that has default icon.
182
158
  *
183
- * @param {NonNullable<NotificationProps['variant']>} variant
184
- *
185
159
  * @private
186
160
  */
187
161
  private getDefaultVariantIcon;
188
- /**
189
- * Util method that returns a template with a default icon according to the chosen variant.
190
- * Called within the renderIcon method.
191
- *
192
- * @param {NonNullable<NotificationProps['variant']>} variant
193
- *
194
- * @private
195
- */
196
- private renderIconVariant;
197
162
  /**
198
163
  * Template for the heading icon area.
199
- * It can return an icon provided externally via named slot or it can return an default icon according to the chosen variant.
164
+ * It can return an icon provided externally via named slot or it can return a default icon according to the chosen variant if defined.
200
165
  * Called within the main render function.
201
166
  *
202
- * @param {NonNullable<NotificationProps['variant']>} variant
203
- * @param {boolean} hasExternalIcon
204
- *
205
167
  * @private
206
168
  */
207
169
  private renderIcon;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { unsafeCSS as E, LitElement as k, nothing as c } from "lit";
2
- import { html as d, unsafeStatic as w } from "lit/static-html.js";
3
- import { validPropertyValues as m, defineCustomElement as A, dispatchCustomEvent as v } from "@justeattakeaway/pie-webc-core";
4
- import { property as r, queryAssignedElements as z, state as C } from "lit/decorators.js";
5
- import { ifDefined as I } from "lit/directives/if-defined.js";
1
+ import { unsafeCSS as O, LitElement as x, nothing as c } from "lit";
2
+ import { html as d, unsafeStatic as N } from "lit/static-html.js";
3
+ import { validPropertyValues as b, defineCustomElement as I, dispatchCustomEvent as m } from "@justeattakeaway/pie-webc-core";
4
+ import { property as r, queryAssignedElements as _ } from "lit/decorators.js";
5
+ import { ifDefined as y } from "lit/directives/if-defined.js";
6
6
  import "@justeattakeaway/pie-button";
7
7
  import "@justeattakeaway/pie-icon-button";
8
8
  import "@justeattakeaway/pie-icons-webc/dist/IconAlertCircle.js";
@@ -10,7 +10,7 @@ import "@justeattakeaway/pie-icons-webc/dist/IconAlertTriangle.js";
10
10
  import "@justeattakeaway/pie-icons-webc/dist/IconCheckCircle.js";
11
11
  import "@justeattakeaway/pie-icons-webc/dist/IconClose.js";
12
12
  import "@justeattakeaway/pie-icons-webc/dist/IconInfoCircle.js";
13
- const S = ["neutral", "neutral-alternative", "info", "success", "warning", "error"], D = ["h2", "h3", "h4", "h5", "h6"], V = ["inline-content", "full-width"], t = "pie-notification", h = "c-notification", T = `${t}-close`, B = `${t}-open`, L = `${t}-leading-action-click`, P = `${t}-supporting-action-click`, l = {
13
+ const k = ["neutral", "neutral-alternative", "info", "success", "warning", "error"], w = ["h2", "h3", "h4", "h5", "h6"], A = ["inline-content", "full-width"], t = "pie-notification", h = "c-notification", E = `${t}-close`, z = `${t}-open`, S = `${t}-leading-action-click`, T = `${t}-supporting-action-click`, l = {
14
14
  isOpen: !0,
15
15
  variant: "neutral",
16
16
  position: "inline-content",
@@ -19,39 +19,23 @@ const S = ["neutral", "neutral-alternative", "info", "success", "warning", "erro
19
19
  headingLevel: "h2",
20
20
  hideIcon: !1,
21
21
  hasStackedActions: !1
22
- }, F = `*,*:after,*:before{box-sizing:inherit}.c-notification{--notification-border-radius: var(--dt-radius-rounded-c);--notification-background-color: var(--dt-color-container-subtle);--notification-direction: column;--notification-heading-font-size: calc(var(--dt-font-heading-s-size--narrow) * 1px);--notification-heading-line-height: calc(var(--dt-font-heading-s-line-height--narrow) * 1px);--notification-font-size: calc(var(--dt-font-body-l-size) * 1px);--notification-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--notification-icon-fill: var(--dt-color-content-default);--notification-close-icon-offset: var(--dt-spacing-b);--notification-heading-icon-offset: 2px;padding:var(--dt-spacing-d);border-radius:var(--notification-border-radius);background-color:var(--notification-background-color);position:relative;display:flex;flex-direction:var(--notification-direction);gap:var(--dt-spacing-d);font-size:var(--notification-font-size);line-height:var(--notification-line-height)}.c-notification[isCompact]{--notification-direction: row}.c-notification[position=full-width]{--notification-border-radius: var(--dt-radius-rounded-none)}.c-notification[variant=neutral-alternative]{--notification-background-color: var(--dt-color-container-default)}.c-notification[variant=info]{--notification-background-color: var(--dt-color-support-info-02);--notification-icon-fill: var(--dt-color-blue)}.c-notification[variant=success]{--notification-background-color: var(--dt-color-support-positive-02)}.c-notification[variant=warning]{--notification-background-color: var(--dt-color-support-warning-02)}.c-notification[variant=error]{--notification-background-color: var(--dt-color-support-error-02);--notification-icon-fill: var(--dt-color-red)}.c-notification-heading{margin:0;margin-block-end:var(--dt-spacing-a);font-size:var(--notification-heading-font-size);line-height:var(--notification-heading-line-height)}@media (min-width: 768px){.c-notification-heading{--notification-heading-font-size: calc(var(--dt-font-heading-s-size--wide) * 1px);--notification-heading-line-height: calc(var(--dt-font-heading-s-line-height--wide) * 1px)}}.c-notification-content-section{display:flex;flex-direction:row}.c-notification-content-section .has-icon{display:block ruby;margin-inline-end:var(--dt-spacing-c)}.c-notification-content-section[isDismissible]{max-width:calc(100% - var(--notification-close-icon-offset) - 40px)}.c-notification-heading-icon{padding-block-start:var(--notification-heading-icon-offset);color:var(--notification-icon-fill)}.c-notification-icon-close{position:absolute;inset-block-start:var(--notification-close-icon-offset);inset-inline-end:var(--notification-close-icon-offset)}.c-notification-footer{display:flex;flex-direction:row;justify-content:flex-end;gap:var(--dt-spacing-d)}.c-notification-footer[isCompact]{align-self:flex-end}@media (max-width: 768px){.c-notification-footer[isStacked]{flex-direction:column-reverse}}
22
+ }, B = `*,*:after,*:before{box-sizing:inherit}.c-notification{--notification-border-radius: var(--dt-radius-rounded-c);--notification-background-color: var(--dt-color-container-subtle);--notification-direction: column;--notification-heading-font-size: calc(var(--dt-font-heading-s-size--narrow) * 1px);--notification-heading-line-height: calc(var(--dt-font-heading-s-line-height--narrow) * 1px);--notification-font-size: calc(var(--dt-font-body-l-size) * 1px);--notification-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--notification-close-icon-offset: var(--dt-spacing-b);--notification-icon-fill: var(--dt-color-content-default);--notification-icon-offset: 2px;--icon-size-override: 24px;padding:var(--dt-spacing-d);border-radius:var(--notification-border-radius);background-color:var(--notification-background-color);position:relative;display:flex;flex-direction:var(--notification-direction);gap:var(--dt-spacing-d);font-size:var(--notification-font-size);line-height:var(--notification-line-height)}.c-notification[isCompact]{--notification-direction: row}.c-notification[position=full-width]{--notification-border-radius: var(--dt-radius-rounded-none)}.c-notification[variant=neutral-alternative]{--notification-background-color: var(--dt-color-container-default)}.c-notification[variant=info]{--notification-background-color: var(--dt-color-support-info-02);--notification-icon-fill: var(--dt-color-blue)}.c-notification[variant=success]{--notification-background-color: var(--dt-color-support-positive-02);--notification-icon-fill: var(--dt-color-content-positive)}.c-notification[variant=warning]{--notification-background-color: var(--dt-color-support-warning-02)}.c-notification[variant=error]{--notification-background-color: var(--dt-color-support-error-02);--notification-icon-fill: var(--dt-color-support-error)}.c-notification-heading{margin:0;margin-block-end:var(--dt-spacing-a);font-size:var(--notification-heading-font-size);line-height:var(--notification-heading-line-height)}@media (min-width: 768px){.c-notification-heading{--notification-heading-font-size: calc(var(--dt-font-heading-s-size--wide) * 1px);--notification-heading-line-height: calc(var(--dt-font-heading-s-line-height--wide) * 1px)}}.c-notification-content-section{display:flex;flex-direction:row;gap:var(--dt-spacing-c)}.c-notification-content-section[isDismissible]{max-width:calc(100% - var(--notification-close-icon-offset) - 40px)}.c-notification-icon-close{position:absolute;inset-block-start:var(--notification-close-icon-offset);inset-inline-end:var(--notification-close-icon-offset)}.c-notification-footer{display:flex;flex-direction:row;justify-content:flex-end;gap:var(--dt-spacing-d)}.c-notification-footer[isCompact]{align-self:flex-end}@media (max-width: 768px){.c-notification-footer[isStacked]{flex-direction:column-reverse}}.icon,::slotted([slot=icon]){display:inline-flex;color:var(--notification-icon-fill);margin-block-start:var(--notification-icon-offset)}@media (max-width: 768px){.icon,::slotted([slot=icon]){margin-block-start:0}}
23
23
  `;
24
- var j = Object.defineProperty, H = Object.getOwnPropertyDescriptor, e = (u, i, o, a) => {
25
- for (var s = a > 1 ? void 0 : a ? H(i, o) : i, f = u.length - 1, p; f >= 0; f--)
26
- (p = u[f]) && (s = (a ? p(i, o, s) : p(s)) || s);
27
- return a && s && j(i, o, s), s;
24
+ var D = Object.defineProperty, L = Object.getOwnPropertyDescriptor, a = (g, i, o, e) => {
25
+ for (var s = e > 1 ? void 0 : e ? L(i, o) : i, f = g.length - 1, p; f >= 0; f--)
26
+ (p = g[f]) && (s = (e ? p(i, o, s) : p(s)) || s);
27
+ return e && s && D(i, o, s), s;
28
28
  };
29
- class n extends k {
29
+ class n extends x {
30
30
  constructor() {
31
- super(...arguments), this.isOpen = l.isOpen, this.variant = l.variant, this.position = l.position, this.isDismissible = l.isDismissible, this.isCompact = l.isCompact, this.headingLevel = l.headingLevel, this.hideIcon = l.hideIcon, this.hasStackedActions = l.hasStackedActions, this._hasExternalIcon = !1, this._hasIconClass = !1;
32
- }
33
- /**
34
- * Lifecycle method executed when component is about to update.
35
- * It update icon properties if variant has changes.
36
- */
37
- willUpdate(i) {
38
- i.has("variant") && this.updateIconProperties();
31
+ super(...arguments), this.isOpen = l.isOpen, this.variant = l.variant, this.position = l.position, this.isDismissible = l.isDismissible, this.isCompact = l.isCompact, this.headingLevel = l.headingLevel, this.hideIcon = l.hideIcon, this.hasStackedActions = l.hasStackedActions;
39
32
  }
40
33
  /**
41
34
  * Lifecycle method executed when component is updated.
42
35
  * It dispatches an event if notification is opened.
43
36
  */
44
37
  updated(i) {
45
- i.has("isOpen") && this.isOpen && v(this, B, { targetNotification: this });
46
- }
47
- /**
48
- * Method responsible to check if an external icon has been provided.
49
- * It reads from icon slot if there is an external icon as well check if variant has default icon.
50
- *
51
- * @private
52
- */
53
- updateIconProperties() {
54
- this._hasExternalIcon = this._iconSlot.length > 0, this._hasIconClass = this._hasExternalIcon || this.variantHasDefaultIcon(this.variant);
38
+ i.has("isOpen") && this.isOpen && m(this, z, { targetNotification: this });
55
39
  }
56
40
  /**
57
41
  * Template for the footer area
@@ -59,7 +43,8 @@ class n extends k {
59
43
  *
60
44
  * @private
61
45
  */
62
- renderFooter(i, o) {
46
+ renderFooter() {
47
+ const { leadingAction: i, supportingAction: o } = this;
63
48
  return d`
64
49
  <footer class="${h}-footer" data-test-id="${t}-footer" ?isCompact="${this.isCompact}" ?isStacked="${this.hasStackedActions && !this.isCompact}">
65
50
  ${o ? this.renderActionButton(o, "supporting") : c}
@@ -71,77 +56,48 @@ class n extends k {
71
56
  * Template for the header area
72
57
  * Called within the main render function.
73
58
  *
74
- * @param {NotificationProps['heading']} heading
75
- * @param {StaticValue} headingTag
76
- *
77
59
  * @private
78
60
  */
79
- renderNotificationHeading(i, o) {
80
- return d`<${o}
61
+ renderNotificationHeading() {
62
+ const { heading: i, headingLevel: o } = this, e = N(o);
63
+ return d`<${e}
81
64
  id="${t}-heading"
82
65
  class="${h}-heading"
83
66
  data-test-id="${t}-heading">
84
67
  ${i}
85
- </${o}>`;
86
- }
87
- /**
88
- * Util method that returns a boolean if variant has a default icon.
89
- *
90
- * @param {NonNullable<NotificationProps['variant']>} variant
91
- *
92
- * @private
93
- */
94
- variantHasDefaultIcon(i) {
95
- return ["info", "success", "warning", "error"].includes(i);
68
+ </${e}>`;
96
69
  }
97
70
  /**
98
71
  * Util method that returns an icon from a variant that has default icon.
99
72
  *
100
- * @param {NonNullable<NotificationProps['variant']>} variant
101
- *
102
73
  * @private
103
74
  */
104
- getDefaultVariantIcon(i) {
105
- switch (i) {
75
+ getDefaultVariantIcon() {
76
+ switch (this.variant) {
106
77
  case "info":
107
- return d`<icon-info-circle size="m" data-test-id="${t}-heading-icon-info"></icon-info-circle>`;
78
+ return d`<icon-info-circle class="icon" size="m" data-test-id="${t}-heading-icon-info"></icon-info-circle>`;
108
79
  case "success":
109
- return d`<icon-check-circle size="m" data-test-id="${t}-heading-icon-success"></icon-check-circle>`;
80
+ return d`<icon-check-circle class="icon" size="m" data-test-id="${t}-heading-icon-success"></icon-check-circle>`;
110
81
  case "warning":
111
- return d`<icon-alert-triangle size="m" data-test-id="${t}-heading-icon-warning"></icon-alert-triangle>`;
82
+ return d`<icon-alert-triangle class="icon" size="m" data-test-id="${t}-heading-icon-warning"></icon-alert-triangle>`;
112
83
  case "error":
113
- return d`<icon-alert-circle size="m" data-test-id="${t}-heading-icon-error"></icon-alert-circle>`;
84
+ return d`<icon-alert-circle class="icon" size="m" data-test-id="${t}-heading-icon-error"></icon-alert-circle>`;
114
85
  default:
115
86
  return c;
116
87
  }
117
88
  }
118
- /**
119
- * Util method that returns a template with a default icon according to the chosen variant.
120
- * Called within the renderIcon method.
121
- *
122
- * @param {NonNullable<NotificationProps['variant']>} variant
123
- *
124
- * @private
125
- */
126
- renderIconVariant(i) {
127
- return this.variantHasDefaultIcon(i) ? this.getDefaultVariantIcon(i) : c;
128
- }
129
89
  /**
130
90
  * Template for the heading icon area.
131
- * It can return an icon provided externally via named slot or it can return an default icon according to the chosen variant.
91
+ * It can return an icon provided externally via named slot or it can return a default icon according to the chosen variant if defined.
132
92
  * Called within the main render function.
133
93
  *
134
- * @param {NonNullable<NotificationProps['variant']>} variant
135
- * @param {boolean} hasExternalIcon
136
- *
137
94
  * @private
138
95
  */
139
- renderIcon(i, o, a) {
96
+ renderIcon() {
97
+ const i = this._iconSlot.length > 0;
140
98
  return d`
141
- <div data-test-id="${t}-icon-area" class="${a ? "has-icon " : ""}${h}-heading-icon">
142
- ${o ? c : this.renderIconVariant(i)}
99
+ ${i ? c : this.getDefaultVariantIcon()}
143
100
  <slot name="icon"></slot>
144
- </div>
145
101
  `;
146
102
  }
147
103
  /**
@@ -159,8 +115,7 @@ class n extends k {
159
115
  class="${h}-icon-close"
160
116
  data-test-id="${t}-icon-close"
161
117
  @click="${this.handleCloseButton}"
162
- aria-label="${I((i = this.aria) == null ? void 0 : i.close)}"
163
- >
118
+ aria-label="${y((i = this.aria) == null ? void 0 : i.close)}">
164
119
  <icon-close></icon-close>
165
120
  </pie-icon-button>`;
166
121
  }
@@ -171,7 +126,7 @@ class n extends k {
171
126
  * @private
172
127
  */
173
128
  handleCloseButton() {
174
- this.closeNotificationComponent(), v(this, T, { targetNotification: this });
129
+ this.closeNotificationComponent(), m(this, E, { targetNotification: this });
175
130
  }
176
131
  /**
177
132
  * Util method responsible to close the component.
@@ -190,7 +145,7 @@ class n extends k {
190
145
  * @private
191
146
  */
192
147
  handleActionClick(i) {
193
- v(this, i === "leading" ? L : P, { targetNotification: this });
148
+ m(this, i === "leading" ? S : T, { targetNotification: this });
194
149
  }
195
150
  /**
196
151
  * Render the action button depending on action type and its action.
@@ -202,8 +157,8 @@ class n extends k {
202
157
  * @private
203
158
  */
204
159
  renderActionButton(i, o) {
205
- const { text: a, ariaLabel: s } = i;
206
- return a ? d`
160
+ const { text: e, ariaLabel: s } = i;
161
+ return e ? d`
207
162
  <pie-button
208
163
  variant="${o === "leading" ? "primary" : "ghost"}"
209
164
  size="small-productive"
@@ -212,7 +167,7 @@ class n extends k {
212
167
  data-test-id="${t}-${o}-action"
213
168
  ?isFullWidth="${this.hasStackedActions}"
214
169
  type="button">
215
- ${a}
170
+ ${e}
216
171
  </pie-button>
217
172
  ` : c;
218
173
  }
@@ -220,106 +175,96 @@ class n extends k {
220
175
  const {
221
176
  variant: i,
222
177
  position: o,
223
- heading: a,
224
- headingLevel: s,
225
- isDismissible: f,
226
- isCompact: p,
227
- _hasExternalIcon: y,
228
- hideIcon: _,
229
- _hasIconClass: O,
230
- leadingAction: b,
231
- supportingAction: N,
232
- isOpen: x,
233
- aria: g
178
+ heading: e,
179
+ isDismissible: s,
180
+ isCompact: f,
181
+ hideIcon: p,
182
+ leadingAction: u,
183
+ isOpen: C,
184
+ aria: v
234
185
  } = this;
235
- if (!x)
186
+ if (!C)
236
187
  return c;
237
- const $ = f && !p;
188
+ const $ = s && !f;
238
189
  return d`
239
190
  <div
240
191
  data-test-id="${t}"
241
192
  class="${h}"
242
193
  variant="${i}"
243
194
  position="${o}"
244
- ?isCompact="${p}"
195
+ ?isCompact="${f}"
245
196
  role="region"
246
197
  aria-live="${i === "error" ? "assertive" : "polite"}"
247
- aria-labelledby="${a ? `${t}-heading` : c}"
248
- aria-label="${!a && I(g == null ? void 0 : g.label)}">
198
+ aria-labelledby="${e ? `${t}-heading` : c}"
199
+ aria-label="${!e && y(v == null ? void 0 : v.label)}">
249
200
  ${$ ? this.renderCloseButton() : c}
250
201
 
251
202
  <section class="${h}-content-section" ?isDismissible="${$}">
252
- ${_ ? c : this.renderIcon(i, y, O)}
203
+ ${p ? c : this.renderIcon()}
253
204
  <article>
254
- ${a ? this.renderNotificationHeading(a, w(s)) : c}
205
+ ${e ? this.renderNotificationHeading() : c}
255
206
  <slot></slot>
256
207
  </article>
257
208
  </section>
258
209
 
259
- ${b ? this.renderFooter(b, N) : c}
210
+ ${u != null && u.text ? this.renderFooter() : c}
260
211
  </div>`;
261
212
  }
262
213
  }
263
- n.styles = E(F);
264
- e([
214
+ n.styles = O(B);
215
+ a([
265
216
  r({ type: Boolean })
266
217
  ], n.prototype, "isOpen", 2);
267
- e([
218
+ a([
268
219
  r(),
269
- m(t, S, l.variant)
220
+ b(t, k, l.variant)
270
221
  ], n.prototype, "variant", 2);
271
- e([
222
+ a([
272
223
  r(),
273
- m(t, V, l.position)
224
+ b(t, A, l.position)
274
225
  ], n.prototype, "position", 2);
275
- e([
226
+ a([
276
227
  r({ type: Boolean })
277
228
  ], n.prototype, "isDismissible", 2);
278
- e([
229
+ a([
279
230
  r({ type: Boolean })
280
231
  ], n.prototype, "isCompact", 2);
281
- e([
232
+ a([
282
233
  r({ type: String })
283
234
  ], n.prototype, "heading", 2);
284
- e([
235
+ a([
285
236
  r(),
286
- m(t, D, l.headingLevel)
237
+ b(t, w, l.headingLevel)
287
238
  ], n.prototype, "headingLevel", 2);
288
- e([
239
+ a([
289
240
  r({ type: Boolean })
290
241
  ], n.prototype, "hideIcon", 2);
291
- e([
242
+ a([
292
243
  r({ type: Object })
293
244
  ], n.prototype, "leadingAction", 2);
294
- e([
245
+ a([
295
246
  r({ type: Object })
296
247
  ], n.prototype, "supportingAction", 2);
297
- e([
248
+ a([
298
249
  r({ type: Boolean })
299
250
  ], n.prototype, "hasStackedActions", 2);
300
- e([
251
+ a([
301
252
  r({ type: Object })
302
253
  ], n.prototype, "aria", 2);
303
- e([
304
- z({ slot: "icon" })
254
+ a([
255
+ _({ slot: "icon" })
305
256
  ], n.prototype, "_iconSlot", 2);
306
- e([
307
- C()
308
- ], n.prototype, "_hasExternalIcon", 2);
309
- e([
310
- C()
311
- ], n.prototype, "_hasIconClass", 2);
312
- A(t, n);
257
+ I(t, n);
313
258
  export {
314
- T as ON_NOTIFICATION_CLOSE_EVENT,
315
- L as ON_NOTIFICATION_LEADING_ACTION_CLICK_EVENT,
316
- B as ON_NOTIFICATION_OPEN_EVENT,
317
- P as ON_NOTIFICATION_SUPPORTING_ACTION_CLICK_EVENT,
259
+ E as ON_NOTIFICATION_CLOSE_EVENT,
260
+ S as ON_NOTIFICATION_LEADING_ACTION_CLICK_EVENT,
261
+ z as ON_NOTIFICATION_OPEN_EVENT,
262
+ T as ON_NOTIFICATION_SUPPORTING_ACTION_CLICK_EVENT,
318
263
  n as PieNotification,
319
264
  h as componentClass,
320
265
  t as componentSelector,
321
266
  l as defaultProps,
322
- D as headingLevels,
323
- V as positions,
324
- S as variants
267
+ w as headingLevels,
268
+ A as positions,
269
+ k as variants
325
270
  };
package/dist/react.d.ts CHANGED
@@ -71,6 +71,7 @@ export declare interface NotificationProps {
71
71
  leadingAction?: ActionProps;
72
72
  /**
73
73
  * The supporting action for the notification.
74
+ * Will only render if `leadingAction` is passed
74
75
  */
75
76
  supportingAction?: ActionProps;
76
77
  /**
@@ -135,26 +136,12 @@ declare class PieNotification_2 extends LitElement implements NotificationProps
135
136
  hasStackedActions: boolean;
136
137
  aria: NotificationProps['aria'];
137
138
  _iconSlot: Array<HTMLElement>;
138
- protected _hasExternalIcon: boolean;
139
- protected _hasIconClass: boolean;
140
139
  static styles: CSSResult;
141
- /**
142
- * Lifecycle method executed when component is about to update.
143
- * It update icon properties if variant has changes.
144
- */
145
- protected willUpdate(_changedProperties: PropertyValues<this>): void;
146
140
  /**
147
141
  * Lifecycle method executed when component is updated.
148
142
  * It dispatches an event if notification is opened.
149
143
  */
150
144
  protected updated(_changedProperties: PropertyValues<this>): void;
151
- /**
152
- * Method responsible to check if an external icon has been provided.
153
- * It reads from icon slot if there is an external icon as well check if variant has default icon.
154
- *
155
- * @private
156
- */
157
- private updateIconProperties;
158
145
  /**
159
146
  * Template for the footer area
160
147
  * Called within the main render function.
@@ -166,45 +153,20 @@ declare class PieNotification_2 extends LitElement implements NotificationProps
166
153
  * Template for the header area
167
154
  * Called within the main render function.
168
155
  *
169
- * @param {NotificationProps['heading']} heading
170
- * @param {StaticValue} headingTag
171
- *
172
156
  * @private
173
157
  */
174
158
  private renderNotificationHeading;
175
- /**
176
- * Util method that returns a boolean if variant has a default icon.
177
- *
178
- * @param {NonNullable<NotificationProps['variant']>} variant
179
- *
180
- * @private
181
- */
182
- private variantHasDefaultIcon;
183
159
  /**
184
160
  * Util method that returns an icon from a variant that has default icon.
185
161
  *
186
- * @param {NonNullable<NotificationProps['variant']>} variant
187
- *
188
162
  * @private
189
163
  */
190
164
  private getDefaultVariantIcon;
191
- /**
192
- * Util method that returns a template with a default icon according to the chosen variant.
193
- * Called within the renderIcon method.
194
- *
195
- * @param {NonNullable<NotificationProps['variant']>} variant
196
- *
197
- * @private
198
- */
199
- private renderIconVariant;
200
165
  /**
201
166
  * Template for the heading icon area.
202
- * It can return an icon provided externally via named slot or it can return an default icon according to the chosen variant.
167
+ * It can return an icon provided externally via named slot or it can return a default icon according to the chosen variant if defined.
203
168
  * Called within the main render function.
204
169
  *
205
- * @param {NonNullable<NotificationProps['variant']>} variant
206
- * @param {boolean} hasExternalIcon
207
- *
208
170
  * @private
209
171
  */
210
172
  private renderIcon;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-notification",
3
3
  "description": "PIE Design System Notification built using Web Components",
4
- "version": "0.8.0",
4
+ "version": "0.9.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -13,7 +13,7 @@
13
13
  "**/*.d.ts"
14
14
  ],
15
15
  "pieMetadata": {
16
- "componentStatus": "alpha"
16
+ "componentStatus": "beta"
17
17
  },
18
18
  "scripts": {
19
19
  "build": "run -T vite build",
@@ -37,12 +37,12 @@
37
37
  "devDependencies": {
38
38
  "@custom-elements-manifest/analyzer": "0.9.0",
39
39
  "@justeattakeaway/pie-components-config": "0.16.0",
40
- "@justeattakeaway/pie-wrapper-react": "0.14.0",
40
+ "@justeattakeaway/pie-wrapper-react": "0.14.1",
41
41
  "cem-plugin-module-file-extensions": "0.0.5"
42
42
  },
43
43
  "dependencies": {
44
- "@justeattakeaway/pie-icon-button": "0.28.6",
45
- "@justeattakeaway/pie-icons-webc": "0.24.0",
44
+ "@justeattakeaway/pie-icon-button": "0.28.7",
45
+ "@justeattakeaway/pie-icons-webc": "0.24.1",
46
46
  "@justeattakeaway/pie-webc-core": "0.23.0"
47
47
  },
48
48
  "volta": {
package/src/defs.ts CHANGED
@@ -69,6 +69,7 @@ export interface NotificationProps {
69
69
 
70
70
  /**
71
71
  * The supporting action for the notification.
72
+ * Will only render if `leadingAction` is passed
72
73
  */
73
74
  supportingAction?: ActionProps;
74
75
 
package/src/index.ts CHANGED
@@ -5,9 +5,9 @@ import {
5
5
  type TemplateResult,
6
6
  type PropertyValues,
7
7
  } from 'lit';
8
- import { type StaticValue, html, unsafeStatic } from 'lit/static-html.js';
8
+ import { html, unsafeStatic } from 'lit/static-html.js';
9
9
  import { defineCustomElement, validPropertyValues, dispatchCustomEvent } from '@justeattakeaway/pie-webc-core';
10
- import { property, queryAssignedElements, state } from 'lit/decorators.js';
10
+ import { property, queryAssignedElements } from 'lit/decorators.js';
11
11
  import { ifDefined } from 'lit/directives/if-defined.js';
12
12
  import {
13
13
  type NotificationProps,
@@ -72,10 +72,10 @@ export class PieNotification extends LitElement implements NotificationProps {
72
72
  public hideIcon = defaultProps.hideIcon;
73
73
 
74
74
  @property({ type: Object })
75
- public leadingAction!: NotificationProps['leadingAction'];
75
+ public leadingAction: NotificationProps['leadingAction'];
76
76
 
77
77
  @property({ type: Object })
78
- public supportingAction!: NotificationProps['supportingAction'];
78
+ public supportingAction: NotificationProps['supportingAction'];
79
79
 
80
80
  @property({ type: Boolean })
81
81
  public hasStackedActions = defaultProps.hasStackedActions;
@@ -85,25 +85,9 @@ export class PieNotification extends LitElement implements NotificationProps {
85
85
 
86
86
  @queryAssignedElements({ slot: 'icon' }) _iconSlot!: Array<HTMLElement>;
87
87
 
88
- @state()
89
- protected _hasExternalIcon = false;
90
-
91
- @state()
92
- protected _hasIconClass = false;
93
-
94
88
  // Renders a `CSSResult` generated from SCSS by Vite
95
89
  static styles = unsafeCSS(styles);
96
90
 
97
- /**
98
- * Lifecycle method executed when component is about to update.
99
- * It update icon properties if variant has changes.
100
- */
101
- protected willUpdate (_changedProperties: PropertyValues<this>): void {
102
- if (_changedProperties.has('variant')) {
103
- this.updateIconProperties();
104
- }
105
- }
106
-
107
91
  /**
108
92
  * Lifecycle method executed when component is updated.
109
93
  * It dispatches an event if notification is opened.
@@ -114,24 +98,14 @@ export class PieNotification extends LitElement implements NotificationProps {
114
98
  }
115
99
  }
116
100
 
117
- /**
118
- * Method responsible to check if an external icon has been provided.
119
- * It reads from icon slot if there is an external icon as well check if variant has default icon.
120
- *
121
- * @private
122
- */
123
- private updateIconProperties () {
124
- this._hasExternalIcon = this._iconSlot.length > 0;
125
- this._hasIconClass = this._hasExternalIcon || this.variantHasDefaultIcon(this.variant);
126
- }
127
-
128
101
  /**
129
102
  * Template for the footer area
130
103
  * Called within the main render function.
131
104
  *
132
105
  * @private
133
106
  */
134
- private renderFooter (leadingAction: ActionProps, supportingAction?: ActionProps) {
107
+ private renderFooter () {
108
+ const { leadingAction, supportingAction } = this;
135
109
  return html`
136
110
  <footer class="${componentClass}-footer" data-test-id="${componentSelector}-footer" ?isCompact="${this.isCompact}" ?isStacked="${this.hasStackedActions && !this.isCompact}">
137
111
  ${supportingAction ? this.renderActionButton(supportingAction, 'supporting') : nothing}
@@ -144,87 +118,53 @@ export class PieNotification extends LitElement implements NotificationProps {
144
118
  * Template for the header area
145
119
  * Called within the main render function.
146
120
  *
147
- * @param {NotificationProps['heading']} heading
148
- * @param {StaticValue} headingTag
149
- *
150
121
  * @private
151
122
  */
152
- private renderNotificationHeading (heading: NotificationProps['heading'], headingTag: StaticValue): TemplateResult {
153
- return html`<${headingTag}
123
+ private renderNotificationHeading (): TemplateResult {
124
+ const { heading, headingLevel } = this;
125
+ const tag = unsafeStatic(headingLevel);
126
+
127
+ return html`<${tag}
154
128
  id="${componentSelector}-heading"
155
129
  class="${componentClass}-heading"
156
130
  data-test-id="${componentSelector}-heading">
157
131
  ${heading}
158
- </${headingTag}>`;
159
- }
160
-
161
- /**
162
- * Util method that returns a boolean if variant has a default icon.
163
- *
164
- * @param {NonNullable<NotificationProps['variant']>} variant
165
- *
166
- * @private
167
- */
168
- private variantHasDefaultIcon (variant: NonNullable<NotificationProps['variant']>) {
169
- const validVariants = ['info', 'success', 'warning', 'error'];
170
-
171
- return validVariants.includes(variant);
132
+ </${tag}>`;
172
133
  }
173
134
 
174
135
  /**
175
136
  * Util method that returns an icon from a variant that has default icon.
176
137
  *
177
- * @param {NonNullable<NotificationProps['variant']>} variant
178
- *
179
138
  * @private
180
139
  */
181
- private getDefaultVariantIcon (variant: NonNullable<NotificationProps['variant']>) {
182
- switch (variant) {
140
+ private getDefaultVariantIcon () {
141
+ switch (this.variant) {
183
142
  case 'info':
184
- return html`<icon-info-circle size="m" data-test-id="${componentSelector}-heading-icon-info"></icon-info-circle>`;
143
+ return html`<icon-info-circle class="icon" size="m" data-test-id="${componentSelector}-heading-icon-info"></icon-info-circle>`;
185
144
  case 'success':
186
- return html`<icon-check-circle size="m" data-test-id="${componentSelector}-heading-icon-success"></icon-check-circle>`;
145
+ return html`<icon-check-circle class="icon" size="m" data-test-id="${componentSelector}-heading-icon-success"></icon-check-circle>`;
187
146
  case 'warning':
188
- return html`<icon-alert-triangle size="m" data-test-id="${componentSelector}-heading-icon-warning"></icon-alert-triangle>`;
147
+ return html`<icon-alert-triangle class="icon" size="m" data-test-id="${componentSelector}-heading-icon-warning"></icon-alert-triangle>`;
189
148
  case 'error':
190
- return html`<icon-alert-circle size="m" data-test-id="${componentSelector}-heading-icon-error"></icon-alert-circle>`;
149
+ return html`<icon-alert-circle class="icon" size="m" data-test-id="${componentSelector}-heading-icon-error"></icon-alert-circle>`;
191
150
  default:
192
151
  return nothing as never;
193
152
  }
194
153
  }
195
154
 
196
- /**
197
- * Util method that returns a template with a default icon according to the chosen variant.
198
- * Called within the renderIcon method.
199
- *
200
- * @param {NonNullable<NotificationProps['variant']>} variant
201
- *
202
- * @private
203
- */
204
- private renderIconVariant (variant: NonNullable<NotificationProps['variant']>) {
205
- if (this.variantHasDefaultIcon(variant)) {
206
- return this.getDefaultVariantIcon(variant);
207
- }
208
-
209
- return nothing;
210
- }
211
-
212
155
  /**
213
156
  * Template for the heading icon area.
214
- * It can return an icon provided externally via named slot or it can return an default icon according to the chosen variant.
157
+ * It can return an icon provided externally via named slot or it can return a default icon according to the chosen variant if defined.
215
158
  * Called within the main render function.
216
159
  *
217
- * @param {NonNullable<NotificationProps['variant']>} variant
218
- * @param {boolean} hasExternalIcon
219
- *
220
160
  * @private
221
161
  */
222
- private renderIcon (variant: NonNullable<NotificationProps['variant']>, hasExternalIcon: boolean, hasIconClass: boolean): TemplateResult | typeof nothing {
162
+ private renderIcon (): TemplateResult | typeof nothing {
163
+ const hasExternalIcon = this._iconSlot.length > 0;
164
+
223
165
  return html`
224
- <div data-test-id="${componentSelector}-icon-area" class="${hasIconClass ? 'has-icon ' : ''}${componentClass}-heading-icon">
225
- ${!hasExternalIcon ? this.renderIconVariant(variant) : nothing}
166
+ ${!hasExternalIcon ? this.getDefaultVariantIcon() : nothing}
226
167
  <slot name="icon"></slot>
227
- </div>
228
168
  `;
229
169
  }
230
170
 
@@ -242,8 +182,7 @@ export class PieNotification extends LitElement implements NotificationProps {
242
182
  class="${componentClass}-icon-close"
243
183
  data-test-id="${componentSelector}-icon-close"
244
184
  @click="${this.handleCloseButton}"
245
- aria-label="${ifDefined(this.aria?.close)}"
246
- >
185
+ aria-label="${ifDefined(this.aria?.close)}">
247
186
  <icon-close></icon-close>
248
187
  </pie-icon-button>`;
249
188
  }
@@ -319,14 +258,10 @@ export class PieNotification extends LitElement implements NotificationProps {
319
258
  variant,
320
259
  position,
321
260
  heading,
322
- headingLevel,
323
261
  isDismissible,
324
262
  isCompact,
325
- _hasExternalIcon,
326
263
  hideIcon,
327
- _hasIconClass,
328
264
  leadingAction,
329
- supportingAction,
330
265
  isOpen,
331
266
  aria,
332
267
  } = this;
@@ -351,14 +286,14 @@ export class PieNotification extends LitElement implements NotificationProps {
351
286
  ${showCloseButton ? this.renderCloseButton() : nothing}
352
287
 
353
288
  <section class="${componentClass}-content-section" ?isDismissible="${showCloseButton}">
354
- ${!hideIcon ? this.renderIcon(variant, _hasExternalIcon, _hasIconClass) : nothing}
289
+ ${!hideIcon ? this.renderIcon() : nothing}
355
290
  <article>
356
- ${heading ? this.renderNotificationHeading(heading, unsafeStatic(headingLevel)) : nothing}
291
+ ${heading ? this.renderNotificationHeading() : nothing}
357
292
  <slot></slot>
358
293
  </article>
359
294
  </section>
360
295
 
361
- ${leadingAction ? this.renderFooter(leadingAction, supportingAction) : nothing}
296
+ ${leadingAction?.text ? this.renderFooter() : nothing}
362
297
  </div>`;
363
298
  }
364
299
  }
@@ -1,8 +1,8 @@
1
1
  @use '@justeattakeaway/pie-css/scss' as p;
2
2
 
3
- .c-notification {
4
- $breakpoint-wide: 768px;
3
+ $breakpoint-wide: 768px;
5
4
 
5
+ .c-notification {
6
6
  --notification-border-radius: var(--dt-radius-rounded-c);
7
7
  --notification-background-color: var(--dt-color-container-subtle);
8
8
  --notification-direction: column;
@@ -10,9 +10,10 @@
10
10
  --notification-heading-line-height: #{p.line-height(--dt-font-heading-s-line-height--narrow)};
11
11
  --notification-font-size: #{p.font-size(--dt-font-body-l-size)};
12
12
  --notification-line-height: #{p.line-height(--dt-font-body-l-line-height)};
13
- --notification-icon-fill: var(--dt-color-content-default);
14
13
  --notification-close-icon-offset: var(--dt-spacing-b);
15
- --notification-heading-icon-offset: 2px;
14
+ --notification-icon-fill: var(--dt-color-content-default);
15
+ --notification-icon-offset: 2px;
16
+ --icon-size-override: 24px;
16
17
 
17
18
  padding: var(--dt-spacing-d);
18
19
  border-radius: var(--notification-border-radius);
@@ -43,6 +44,7 @@
43
44
 
44
45
  &[variant='success'] {
45
46
  --notification-background-color: var(--dt-color-support-positive-02);
47
+ --notification-icon-fill: var(--dt-color-content-positive);
46
48
  }
47
49
 
48
50
  &[variant='warning'] {
@@ -51,7 +53,7 @@
51
53
 
52
54
  &[variant='error'] {
53
55
  --notification-background-color: var(--dt-color-support-error-02);
54
- --notification-icon-fill: var(--dt-color-red);
56
+ --notification-icon-fill: var(--dt-color-support-error);
55
57
  }
56
58
 
57
59
 
@@ -70,22 +72,13 @@
70
72
  &-content-section {
71
73
  display: flex;
72
74
  flex-direction: row;
73
-
74
- .has-icon {
75
- display: block ruby; // This is a hack to avoid the icon overlap the text in Firefox
76
- margin-inline-end: var(--dt-spacing-c);
77
- }
75
+ gap: var(--dt-spacing-c);
78
76
 
79
77
  &[isDismissible] {
80
78
  max-width: calc(100% - var(--notification-close-icon-offset) - 40px); // 40px is the size of the medium icon button
81
79
  }
82
80
  }
83
81
 
84
- &-heading-icon {
85
- padding-block-start: var(--notification-heading-icon-offset);
86
- color: var(--notification-icon-fill);
87
- }
88
-
89
82
  &-icon-close {
90
83
  position: absolute;
91
84
  inset-block-start: var(--notification-close-icon-offset);
@@ -109,3 +102,14 @@
109
102
  }
110
103
  }
111
104
  }
105
+
106
+ .icon,
107
+ ::slotted([slot="icon"]) {
108
+ display: inline-flex;
109
+ color: var(--notification-icon-fill);
110
+ margin-block-start: var(--notification-icon-offset);
111
+
112
+ @media (max-width: $breakpoint-wide) {
113
+ margin-block-start: 0;
114
+ }
115
+ }