@justeattakeaway/pie-notification 0.22.0 → 0.23.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.
@@ -90,7 +90,7 @@
90
90
  "type": {
91
91
  "text": "ActionProps"
92
92
  },
93
- "default": "{\n text: '',\n ariaLabel: '',\n size: 'small-productive',\n}"
93
+ "default": "{ text: '', ariaLabel: '', size: 'small-productive', }"
94
94
  },
95
95
  {
96
96
  "kind": "variable",
@@ -98,7 +98,7 @@
98
98
  "type": {
99
99
  "text": "DefaultProps"
100
100
  },
101
- "default": "{\n variant: 'neutral',\n position: 'inline-content',\n isDismissible: false,\n isCompact: false,\n headingLevel: 'h2',\n hideIcon: false,\n isOpen: true,\n hasStackedActions: false,\n leadingAction: defaultActionButtonProps,\n supportingAction: defaultActionButtonProps,\n}"
101
+ "default": "{ variant: 'neutral', position: 'inline-content', isDismissible: false, isCompact: false, headingLevel: 'h2', hideIcon: false, isOpen: true, hasStackedActions: false, leadingAction: defaultActionButtonProps, supportingAction: defaultActionButtonProps, }"
102
102
  }
103
103
  ],
104
104
  "exports": [
@@ -230,27 +230,33 @@
230
230
  {
231
231
  "kind": "field",
232
232
  "name": "isOpen",
233
- "privacy": "public"
233
+ "privacy": "public",
234
+ "attribute": "isOpen"
234
235
  },
235
236
  {
236
237
  "kind": "field",
237
238
  "name": "variant",
238
- "privacy": "public"
239
+ "privacy": "public",
240
+ "attribute": "variant"
239
241
  },
240
242
  {
241
243
  "kind": "field",
242
244
  "name": "position",
243
- "privacy": "public"
245
+ "privacy": "public",
246
+ "attribute": "position"
244
247
  },
245
248
  {
246
249
  "kind": "field",
247
250
  "name": "isDismissible",
248
- "privacy": "public"
251
+ "privacy": "public",
252
+ "attribute": "isDismissible"
249
253
  },
250
254
  {
251
255
  "kind": "field",
252
256
  "name": "isCompact",
253
- "privacy": "public"
257
+ "privacy": "public",
258
+ "attribute": "isCompact",
259
+ "reflects": true
254
260
  },
255
261
  {
256
262
  "kind": "field",
@@ -258,17 +264,20 @@
258
264
  "type": {
259
265
  "text": "NotificationProps['heading']"
260
266
  },
261
- "privacy": "public"
267
+ "privacy": "public",
268
+ "attribute": "heading"
262
269
  },
263
270
  {
264
271
  "kind": "field",
265
272
  "name": "headingLevel",
266
- "privacy": "public"
273
+ "privacy": "public",
274
+ "attribute": "headingLevel"
267
275
  },
268
276
  {
269
277
  "kind": "field",
270
278
  "name": "hideIcon",
271
- "privacy": "public"
279
+ "privacy": "public",
280
+ "attribute": "hideIcon"
272
281
  },
273
282
  {
274
283
  "kind": "field",
@@ -276,7 +285,8 @@
276
285
  "type": {
277
286
  "text": "NotificationProps['leadingAction']"
278
287
  },
279
- "privacy": "public"
288
+ "privacy": "public",
289
+ "attribute": "leadingAction"
280
290
  },
281
291
  {
282
292
  "kind": "field",
@@ -284,12 +294,15 @@
284
294
  "type": {
285
295
  "text": "NotificationProps['supportingAction']"
286
296
  },
287
- "privacy": "public"
297
+ "privacy": "public",
298
+ "attribute": "supportingAction"
288
299
  },
289
300
  {
290
301
  "kind": "field",
291
302
  "name": "hasStackedActions",
292
- "privacy": "public"
303
+ "privacy": "public",
304
+ "attribute": "hasStackedActions",
305
+ "reflects": true
293
306
  },
294
307
  {
295
308
  "kind": "field",
@@ -297,7 +310,8 @@
297
310
  "type": {
298
311
  "text": "NotificationProps['aria']"
299
312
  },
300
- "privacy": "public"
313
+ "privacy": "public",
314
+ "attribute": "aria"
301
315
  },
302
316
  {
303
317
  "kind": "field",
@@ -441,6 +455,68 @@
441
455
  "name": "pie-notification-open"
442
456
  }
443
457
  ],
458
+ "attributes": [
459
+ {
460
+ "name": "isOpen",
461
+ "fieldName": "isOpen"
462
+ },
463
+ {
464
+ "name": "variant",
465
+ "fieldName": "variant"
466
+ },
467
+ {
468
+ "name": "position",
469
+ "fieldName": "position"
470
+ },
471
+ {
472
+ "name": "isDismissible",
473
+ "fieldName": "isDismissible"
474
+ },
475
+ {
476
+ "name": "isCompact",
477
+ "fieldName": "isCompact"
478
+ },
479
+ {
480
+ "name": "heading",
481
+ "type": {
482
+ "text": "NotificationProps['heading']"
483
+ },
484
+ "fieldName": "heading"
485
+ },
486
+ {
487
+ "name": "headingLevel",
488
+ "fieldName": "headingLevel"
489
+ },
490
+ {
491
+ "name": "hideIcon",
492
+ "fieldName": "hideIcon"
493
+ },
494
+ {
495
+ "name": "leadingAction",
496
+ "type": {
497
+ "text": "NotificationProps['leadingAction']"
498
+ },
499
+ "fieldName": "leadingAction"
500
+ },
501
+ {
502
+ "name": "supportingAction",
503
+ "type": {
504
+ "text": "NotificationProps['supportingAction']"
505
+ },
506
+ "fieldName": "supportingAction"
507
+ },
508
+ {
509
+ "name": "hasStackedActions",
510
+ "fieldName": "hasStackedActions"
511
+ },
512
+ {
513
+ "name": "aria",
514
+ "type": {
515
+ "text": "NotificationProps['aria']"
516
+ },
517
+ "fieldName": "aria"
518
+ }
519
+ ],
444
520
  "superclass": {
445
521
  "name": "PieElement",
446
522
  "package": "@justeattakeaway/pie-webc-core/src/internals/PieElement"
@@ -455,7 +531,7 @@
455
531
  "name": "*",
456
532
  "declaration": {
457
533
  "name": "*",
458
- "package": "./defs"
534
+ "module": "src/defs"
459
535
  }
460
536
  },
461
537
  {
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ const $ = class $ extends N {
16
16
  this.getAttribute("v") || this.setAttribute("v", $.v);
17
17
  }
18
18
  };
19
- $.v = "0.22.0";
19
+ $.v = "0.23.1";
20
20
  let C = $;
21
21
  const E = ["neutral", "neutral-alternative", "info", "success", "warning", "error", "translucent"], L = ["h2", "h3", "h4", "h5", "h6"], T = ["inline-content", "full-width"], B = ["small-productive", "xsmall"], o = "pie-notification", u = "c-notification", D = `${o}-close`, V = `${o}-open`, P = `${o}-leading-action-click`, F = `${o}-supporting-action-click`, b = {
22
22
  text: "",
@@ -34,10 +34,10 @@ const E = ["neutral", "neutral-alternative", "info", "success", "warning", "erro
34
34
  leadingAction: b,
35
35
  supportingAction: b
36
36
  }, j = "*,*:after,*:before{box-sizing:inherit}:host{display:block}.c-notification{--notification-border-radius: var(--dt-radius-rounded-c);--notification-background-color: var(--dt-color-container-subtle);--notification-direction: column;--notification-heading-font-family: var(--dt-font-heading-s-family);--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-heading-font-weight: var(--dt-font-heading-s-weight);--notification-font-family: var(--dt-font-body-l-family);--notification-font-size: calc(var(--dt-font-body-l-size) * 1px);--notification-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--notification-font-weight: var(--dt-font-body-l-weight);--notification-close-icon-offset: var(--dt-spacing-b);--notification-icon-fill: var(--dt-color-content-inverse);--notification-icon-background-color: var(--dt-color-container-inverse);--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);font-family:var(--notification-font-family);font-size:var(--notification-font-size);line-height:var(--notification-line-height);font-weight:var(--notification-font-weight);color:var(--dt-color-content-default)}.c-notification.is-compact{--notification-direction: row}.c-notification.c-notification--full-width{--notification-border-radius: var(--dt-radius-rounded-none)}.c-notification.c-notification--neutral-alternative{--notification-background-color: var(--dt-color-container-default)}.c-notification.c-notification--info{--notification-background-color: var(--dt-color-support-info-tonal);--notification-icon-background-color: var(--dt-color-support-info)}.c-notification.c-notification--success{--notification-background-color: var(--dt-color-support-positive-tonal);--notification-icon-background-color: var(--dt-color-support-positive)}.c-notification.c-notification--warning{--notification-background-color: var(--dt-color-support-warning-tonal);--notification-icon-background-color: var(--dt-color-support-warning);--notification-icon-fill: var(--dt-color-content-dark)}.c-notification.c-notification--error{--notification-background-color: var(--dt-color-support-error-tonal);--notification-icon-background-color: var(--dt-color-support-error);--notification-icon-fill: var(--dt-color-content-light)}.c-notification.c-notification--translucent{--notification-background-color: var(--dt-color-container-prominent);-webkit-backdrop-filter:blur(var(--dt-blur-prominent));backdrop-filter:blur(var(--dt-blur-prominent))}.c-notification-heading{margin:0;margin-block-end:var(--dt-spacing-a);font-family:var(--notification-heading-font-family);font-size:var(--notification-heading-font-size);line-height:var(--notification-heading-line-height);font-weight:var(--notification-heading-font-weight)}@media (min-width: 769px){.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;align-items:center;gap:var(--dt-spacing-c)}.c-notification-content-section.is-dismissible{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 pie-button,.c-notification-footer ::slotted(pie-button){margin-block-start:var(--dt-spacing-d)}.c-notification-footer.is-compact{align-self:center;margin-inline-start:auto}@media (max-width: 767px){.c-notification-footer.c-notification-footer--stacked{flex-direction:column-reverse;gap:0}.c-notification-footer.c-notification-footer--stacked ::slotted(pie-button){--btn-inline-size: 100%}}@media (min-width: 768px){.c-notification-footer.c-notification-footer--stacked>pie-button{width:auto}}.c-notification-footer ::slotted(:not(pie-button)){display:none}:host([isCompact]) .c-notification-footer pie-button,:host([isCompact]) .c-notification-footer ::slotted(pie-button){margin-block-start:0}.icon,::slotted([slot=icon]){display:inline-flex;align-self:flex-start;background-color:var(--notification-icon-background-color);color:var(--notification-icon-fill);border-radius:var(--dt-radius-rounded-b);padding:var(--dt-spacing-a)}";
37
- var G = Object.defineProperty, H = Object.getOwnPropertyDescriptor, c = (t, i, e, f) => {
38
- for (var a = f > 1 ? void 0 : f ? H(i, e) : i, p = t.length - 1, g; p >= 0; p--)
39
- (g = t[p]) && (a = (f ? g(i, e, a) : g(a)) || a);
40
- return f && a && G(i, e, a), a;
37
+ var G = Object.defineProperty, H = Object.getOwnPropertyDescriptor, c = (i, t, e, f) => {
38
+ for (var a = f > 1 ? void 0 : f ? H(t, e) : t, p = i.length - 1, g; p >= 0; p--)
39
+ (g = i[p]) && (a = (f ? g(t, e, a) : g(a)) || a);
40
+ return f && a && G(t, e, a), a;
41
41
  };
42
42
  let n = class extends C {
43
43
  constructor() {
@@ -47,8 +47,8 @@ let n = class extends C {
47
47
  * Lifecycle method executed when component is updated.
48
48
  * It dispatches an event if notification is opened.
49
49
  */
50
- updated(t) {
51
- t.has("isOpen") && this.isOpen && A(this, V, { targetNotification: this });
50
+ updated(i) {
51
+ i.has("isOpen") && this.isOpen && A(this, V, { targetNotification: this });
52
52
  }
53
53
  /**
54
54
  * Renders the supporting action - either from slot or props.
@@ -57,8 +57,8 @@ let n = class extends C {
57
57
  * @private
58
58
  */
59
59
  renderSupportingAction() {
60
- const { supportingAction: t, leadingAction: i } = this;
61
- return t && (i != null && i.text) ? this.renderActionButton(t, "supporting") : l;
60
+ const { supportingAction: i, leadingAction: t } = this;
61
+ return i && (t != null && t.text) ? this.renderActionButton(i, "supporting") : l;
62
62
  }
63
63
  /**
64
64
  * Renders the leading action from props.
@@ -66,8 +66,8 @@ let n = class extends C {
66
66
  * @private
67
67
  */
68
68
  renderLeadingAction() {
69
- const { leadingAction: t } = this;
70
- return t ? this.renderActionButton(t, "leading") : l;
69
+ const { leadingAction: i } = this;
70
+ return i ? this.renderActionButton(i, "leading") : l;
71
71
  }
72
72
  /**
73
73
  * Template for the footer area
@@ -77,22 +77,22 @@ let n = class extends C {
77
77
  */
78
78
  renderFooter() {
79
79
  const {
80
- isCompact: t,
81
- hasStackedActions: i
80
+ isCompact: i,
81
+ hasStackedActions: t
82
82
  } = this, e = {
83
83
  [`${u}-footer`]: !0,
84
- "is-compact": t,
85
- [`${u}-footer--stacked`]: i && !t
84
+ "is-compact": i,
85
+ [`${u}-footer--stacked`]: t && !i
86
86
  };
87
87
  return d`
88
- <footer
88
+ <div
89
89
  class="${w(e)}"
90
90
  data-test-id="${o}-footer">
91
91
  ${this.renderSupportingAction()}
92
92
  <slot name="supportingAction"></slot>
93
93
  ${this.renderLeadingAction()}
94
94
  <slot name="leadingAction"></slot>
95
- </footer>
95
+ </div>
96
96
  `;
97
97
  }
98
98
  /**
@@ -102,12 +102,12 @@ let n = class extends C {
102
102
  * @private
103
103
  */
104
104
  renderNotificationHeading() {
105
- const { heading: t, headingLevel: i } = this, e = z(i);
105
+ const { heading: i, headingLevel: t } = this, e = z(t);
106
106
  return d`<${e}
107
107
  id="${o}-heading"
108
108
  class="${u}-heading"
109
109
  data-test-id="${o}-heading">
110
- ${t}
110
+ ${i}
111
111
  </${e}>`;
112
112
  }
113
113
  /**
@@ -146,7 +146,7 @@ let n = class extends C {
146
146
  * @private
147
147
  */
148
148
  renderCloseButton() {
149
- var t;
149
+ var i;
150
150
  return d`
151
151
  <pie-icon-button
152
152
  variant="ghost-secondary"
@@ -154,7 +154,7 @@ let n = class extends C {
154
154
  class="${u}-icon-close"
155
155
  data-test-id="${o}-icon-close"
156
156
  @click="${this.handleCloseButton}"
157
- aria-label="${h((t = this.aria) == null ? void 0 : t.close)}">
157
+ aria-label="${h((i = this.aria) == null ? void 0 : i.close)}">
158
158
  <icon-close></icon-close>
159
159
  </pie-icon-button>`;
160
160
  }
@@ -175,8 +175,8 @@ let n = class extends C {
175
175
  *
176
176
  * @private
177
177
  */
178
- handleActionClick(t) {
179
- A(this, t === "leading" ? P : F, { targetNotification: this });
178
+ handleActionClick(i) {
179
+ A(this, i === "leading" ? P : F, { targetNotification: this });
180
180
  }
181
181
  /**
182
182
  * Render the action button depending on action type and its action.
@@ -187,7 +187,7 @@ let n = class extends C {
187
187
  * @returns {TemplateResult | typeof nothing} - The rendered action button or nothing if the action text is not defined.
188
188
  * @private
189
189
  */
190
- renderActionButton(t, i) {
190
+ renderActionButton(i, t) {
191
191
  const {
192
192
  text: e,
193
193
  ariaLabel: f,
@@ -196,17 +196,17 @@ let n = class extends C {
196
196
  target: g,
197
197
  rel: v,
198
198
  download: m
199
- } = t;
199
+ } = i;
200
200
  if (!e)
201
201
  return l;
202
- const y = i === "leading" ? "primary" : "ghost", k = a && B.includes(a) ? a : b.size, x = !!p;
202
+ const y = t === "leading" ? "primary" : "ghost", k = a && B.includes(a) ? a : b.size, x = !!p;
203
203
  return d`
204
204
  <pie-button
205
205
  variant="${y}"
206
206
  size="${h(k)}"
207
207
  aria-label="${h(f)}"
208
- @click="${() => this.handleActionClick(i)}"
209
- data-test-id="${o}-${i}-action"
208
+ @click="${() => this.handleActionClick(t)}"
209
+ data-test-id="${o}-${t}-action"
210
210
  ?isFullWidth="${this.hasStackedActions}"
211
211
  tag="${x ? "a" : "button"}"
212
212
  type="${x ? l : "button"}"
@@ -220,8 +220,8 @@ let n = class extends C {
220
220
  }
221
221
  render() {
222
222
  const {
223
- variant: t,
224
- position: i,
223
+ variant: i,
224
+ position: t,
225
225
  heading: e,
226
226
  isDismissible: f,
227
227
  isCompact: a,
@@ -233,8 +233,8 @@ let n = class extends C {
233
233
  return l;
234
234
  const m = f && !a, y = {
235
235
  [u]: !0,
236
- [`${u}--${t}`]: !0,
237
236
  [`${u}--${i}`]: !0,
237
+ [`${u}--${t}`]: !0,
238
238
  "is-compact": a
239
239
  }, k = {
240
240
  [`${u}-content-section`]: !0,
@@ -245,18 +245,18 @@ let n = class extends C {
245
245
  data-test-id="${o}"
246
246
  class="${w(y)}"
247
247
  role="region"
248
- aria-live="${t === "error" ? "assertive" : "polite"}"
248
+ aria-live="${i === "error" ? "assertive" : "polite"}"
249
249
  aria-labelledby="${e ? `${o}-heading` : l}"
250
250
  aria-label="${!e && h(v == null ? void 0 : v.label)}">
251
251
  ${m ? this.renderCloseButton() : l}
252
252
 
253
- <section class="${w(k)}">
253
+ <div class="${w(k)}">
254
254
  ${p ? l : this.renderIcon()}
255
- <article>
255
+ <div>
256
256
  ${e ? this.renderNotificationHeading() : l}
257
257
  <slot></slot>
258
- </article>
259
- </section>
258
+ </div>
259
+ </div>
260
260
 
261
261
  ${this.renderFooter()}
262
262
  </div>`;
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.22.0",
4
+ "version": "0.23.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/justeattakeaway/pie",
@@ -43,14 +43,14 @@
43
43
  "author": "Just Eat Takeaway.com - Design System Team",
44
44
  "license": "Apache-2.0",
45
45
  "devDependencies": {
46
- "@justeattakeaway/pie-components-config": "0.21.1",
46
+ "@justeattakeaway/pie-components-config": "0.21.2",
47
47
  "@justeattakeaway/pie-css": "1.1.1",
48
48
  "@justeattakeaway/pie-monorepo-utils": "0.9.1",
49
49
  "@justeattakeaway/pie-wrapper-react": "0.14.4"
50
50
  },
51
51
  "dependencies": {
52
- "@justeattakeaway/pie-icon-button": "2.7.11",
53
- "@justeattakeaway/pie-icons-webc": "1.23.0",
52
+ "@justeattakeaway/pie-icon-button": "2.7.13",
53
+ "@justeattakeaway/pie-icons-webc": "1.24.0",
54
54
  "@justeattakeaway/pie-webc-core": "14.0.1"
55
55
  },
56
56
  "volta": {
package/src/index.ts CHANGED
@@ -156,14 +156,14 @@ export class PieNotification extends PieElement implements NotificationProps {
156
156
  [`${componentClass}-footer--stacked`]: hasStackedActions && !isCompact,
157
157
  };
158
158
  return html`
159
- <footer
159
+ <div
160
160
  class="${classMap(classes)}"
161
161
  data-test-id="${componentSelector}-footer">
162
162
  ${this.renderSupportingAction()}
163
163
  <slot name="supportingAction"></slot>
164
164
  ${this.renderLeadingAction()}
165
165
  <slot name="leadingAction"></slot>
166
- </footer>
166
+ </div>
167
167
  `;
168
168
  }
169
169
 
@@ -347,13 +347,13 @@ export class PieNotification extends PieElement implements NotificationProps {
347
347
  aria-label="${!heading && ifDefined(aria?.label)}">
348
348
  ${showCloseButton ? this.renderCloseButton() : nothing}
349
349
 
350
- <section class="${classMap(contentSectionClasses)}">
350
+ <div class="${classMap(contentSectionClasses)}">
351
351
  ${!hideIcon ? this.renderIcon() : nothing}
352
- <article>
352
+ <div>
353
353
  ${heading ? this.renderNotificationHeading() : nothing}
354
354
  <slot></slot>
355
- </article>
356
- </section>
355
+ </div>
356
+ </div>
357
357
 
358
358
  ${this.renderFooter()}
359
359
  </div>`;