scb-wc-test 0.1.85 → 0.1.87

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.
@@ -1,23 +1,25 @@
1
- import { css as p, LitElement as d, html as e } from "lit";
2
- import { property as o, customElement as f } from "lit/decorators.js";
3
- import "@material/web/iconbutton/icon-button.js";
1
+ import { css as p, LitElement as d, html as s } from "lit";
2
+ import { property as e, customElement as f } from "lit/decorators.js";
4
3
  import "@material/web/icon/icon.js";
5
- var v = Object.defineProperty, u = Object.getOwnPropertyDescriptor, i = (r, s, a, c) => {
6
- for (var n = c > 1 ? void 0 : c ? u(s, a) : s, l = r.length - 1, h; l >= 0; l--)
7
- (h = r[l]) && (n = (c ? h(s, a, n) : h(n)) || n);
8
- return c && n && v(s, a, n), n;
4
+ import "@material/web/focus/md-focus-ring.js";
5
+ import "../scb-icon-button/scb-icon-button.js";
6
+ var m = Object.defineProperty, g = Object.getOwnPropertyDescriptor, i = (o, r, l, a) => {
7
+ for (var n = a > 1 ? void 0 : a ? g(r, l) : r, c = o.length - 1, h; c >= 0; c--)
8
+ (h = o[c]) && (n = (a ? h(r, l, n) : h(n)) || n);
9
+ return a && n && m(r, l, n), n;
9
10
  };
10
11
  let t = class extends d {
11
12
  constructor() {
12
- super(...arguments), this.variant = "success", this.direction = "horizontal", this.title = "", this.subtitle = "", this.supportingText = "", this.open = !1, this.linkText = "", this.linkhref = "#", this.showIcon = !1, this.showCloseButton = !1, this.fullHeight = !1, this.fullWidth = !1, this._closeNotification = () => {
13
+ super(...arguments), this.variant = "success", this.direction = "horizontal", this.title = "", this.subtitle = "", this.supportingText = "", this.open = !1, this.linkText = "", this.linkHref = "#", this.showIcon = !1, this.showCloseButton = !1, this.sizing = "stretch", this.width = "", this.maxWidth = "", this.height = "", this.maxHeight = "", this.fullHeight = !1, this.fullWidth = !1, this._closeNotification = () => {
13
14
  this.open = !1;
14
- const r = new CustomEvent("close", {
15
- detail: { open: this.open }
15
+ const o = new CustomEvent("close", {
16
+ detail: { open: this.open },
17
+ bubbles: !0,
18
+ composed: !0
16
19
  });
17
- this.dispatchEvent(r);
20
+ this.dispatchEvent(o);
18
21
  };
19
22
  }
20
- /** Return icon name for notification variant */
21
23
  _iconForVariant() {
22
24
  switch (this.variant) {
23
25
  case "success":
@@ -27,229 +29,367 @@ let t = class extends d {
27
29
  case "warning":
28
30
  return "warning";
29
31
  case "info":
30
- return "info";
31
32
  default:
32
33
  return "info";
33
34
  }
34
35
  }
36
+ updated(o) {
37
+ super.updated(o), o.has("width") && (this.width && this.width.trim() !== "" ? this.style.inlineSize = this.width : this.style.removeProperty("inline-size")), o.has("maxWidth") && (this.maxWidth && this.maxWidth.trim() !== "" ? this.style.maxInlineSize = this.maxWidth : this.style.removeProperty("max-inline-size")), o.has("height") && (this.height && this.height.trim() !== "" ? this.style.blockSize = this.height : this.style.removeProperty("block-size")), o.has("maxHeight") && (this.maxHeight && this.maxHeight.trim() !== "" ? this.style.maxBlockSize = this.maxHeight : this.style.removeProperty("max-block-size"));
38
+ }
35
39
  render() {
36
- const r = this.variant ? `${this.variant.toLowerCase()}` : "", s = this.direction ? `${this.direction.toLowerCase()}` : "", a = this.linkhref ? "clickable" : "";
37
- return e`
38
- <div class="notification ${s} ${a} ${r}" type=${this.variant} role="alert" aria-live="assertive" aria-atomic="true" style="display: ${this.open ? "flex" : "none"};">
39
- <div class="notification-content">
40
- ${this.showIcon || this.showCloseButton ? e`<div class="notification-header">
41
- ${this.showIcon ? e`<md-icon>${this._iconForVariant()}</md-icon>` : ""}
42
- </div>` : ""}
43
- <div class="notification-text-container">
44
- ${this.title ? e`<div class="notification-title">${this.title}</div>` : ""}
45
- ${this.subtitle ? e`<div class="notification-subtitle">${this.subtitle}</div>` : ""}
46
- ${this.supportingText ? e`<div class="notification-text">${this.supportingText}</div>` : ""}
47
- ${this.linkText ? e`
48
- <div class="notification-footer">
49
- <a class="footer-link" href="${this.linkhref}">${this.linkText}</a>
50
- </div>
51
- ` : ""}
52
- </div>
40
+ const o = this.direction === "vertical" ? "vertical" : "horizontal", r = this.variant === "success" ? "--_icon-color: var(--md-sys-color-on-success-container);" : this.variant === "error" ? "--_icon-color: var(--md-sys-color-on-error-container);" : this.variant === "warning" ? "--_icon-color: var(--md-sys-color-on-warning-container);" : "--_icon-color: var(--md-sys-color-on-info-container);";
41
+ return s`
42
+ <div
43
+ class="notification"
44
+ type=${this.variant}
45
+ role="alert"
46
+ aria-live="assertive"
47
+ aria-atomic="true"
48
+ >
49
+ <div class="notification-main ${o}">
50
+ ${this.showIcon ? s`
51
+ <div class="notification-leading-icon">
52
+ <md-icon aria-hidden="true">
53
+ ${this._iconForVariant()}
54
+ </md-icon>
53
55
  </div>
54
- ${this.showCloseButton ? e`<div class="notification-close-button"><md-icon-button @click=${this._closeNotification}
55
- style="--_icon-color: ${this.variant === "success" ? "var(--md-sys-color-on-success-container)" : this.variant === "error" ? "var(--md-sys-color-on-error-container)" : this.variant === "warning" ? "var(--md-sys-color-on-warning-container)" : "var(--md-sys-color-on-info-container)"};" tabindex="0"><md-icon aria-hidden="true">close</md-icon></md-icon-button></div>` : ""}
56
- </div>
57
- `;
56
+ ` : null}
57
+ <div class="notification-text-container">
58
+ ${this.title ? s`<div class="notification-title">${this.title}</div>` : null}
59
+ ${this.subtitle ? s`<div class="notification-subtitle">
60
+ ${this.subtitle}
61
+ </div>` : null}
62
+ ${this.supportingText ? s`<div class="notification-text">
63
+ ${this.supportingText}
64
+ </div>` : null}
65
+ ${this.linkText ? s`
66
+ <div class="notification-footer">
67
+ <a class="footer-link" href="${this.linkHref}">
68
+ ${this.linkText}
69
+ </a>
70
+ </div>
71
+ ` : null}
72
+ </div>
73
+ </div>
74
+ ${this.showCloseButton ? s`
75
+ <div class="notification-close-button">
76
+ <scb-icon-button
77
+ aria-label="Stäng meddelande"
78
+ icon="close"
79
+ style=${r}
80
+ @click=${this._closeNotification}
81
+ >
82
+ </scb-icon-button>
83
+ </div>
84
+ ` : null}
85
+ </div>
86
+ <md-focus-ring></md-focus-ring>
87
+ `;
58
88
  }
59
89
  };
60
90
  t.styles = [
61
91
  p`
62
- :host {
63
- display: block;
64
- position: relative;
65
- container-type: inline-size;
66
- container-name: notification-container;
67
- --scb-notification-card-h-max-w: 580px;
68
- --scb-notification-card-v-max-w: 600px;
69
- }
70
- :host([stretch]) { block-size: 100%; }
71
- :host([stretch]) .notification { block-size: 100%; }
72
-
73
- :host([full-height]) { block-size: 100%; }
74
- :host([full-height]) .notification { block-size: 100%; }
75
-
76
- :host([full-width]) { max-width: none; width: 100%; }
77
- :host([full-width]) .notification.horizontal,
78
- :host([full-width]) .notification.vertical {
79
- max-width: none;
80
- width: auto;
81
-
82
- .notification-content {
83
- width: 100%;
84
- }
85
- }
86
-
87
- :host([open]) .notification { opacity: 1; }
88
- :host(:not([open])) .notification {
89
- opacity: 0;
90
- pointer-events: none;
91
- }
92
+ :host {
93
+ display: block;
94
+ position: relative;
95
+ box-sizing: border-box;
96
+ inline-size: 100%;
97
+ min-inline-size: 0;
98
+ /* Om det behövs kan maxbredd styras via css-variabel, samma idé som övriga kort */
99
+ max-inline-size: var(--scb-notification-card-max-w, none);
100
+ height: auto;
101
+ padding: var(--scb-notification-card-focus-ring-gap, 4px);
102
+ }
92
103
 
93
- :host([variant="success"]) .notification {
94
- background: var(--md-sys-color-success-container);
95
- color: var(--md-sys-color-on-success-container);
96
- a {
97
- color: var(--md-sys-color-on-success-container);
98
- }
99
- }
100
- :host([variant="error"]) .notification {
101
- background: var(--md-sys-color-error-container);
102
- color: var(--md-sys-color-on-error-container);
103
- a {
104
- color: var(--md-sys-color-on-error-container);
105
- }
106
- }
107
- :host([variant="warning"]) .notification {
108
- background: var(--md-sys-color-warning-container);
109
- color: var(--md-sys-color-on-warning-container);
110
- a {
111
- color: var(--md-sys-color-on-warning-container);
112
- }
113
- }
114
- :host([variant="info"]) .notification {
115
- background: var(--md-sys-color-info-container);
116
- color: var(--md-sys-color-on-info-container);
117
- a {
118
- color: var(--md-sys-color-on-info-container);
119
- }
120
- }
104
+ /* Stretch: fyller både bredd och höjd, som standard */
105
+ :host([sizing='stretch']) {
106
+ inline-size: 100%;
107
+ block-size: 100%;
108
+ max-inline-size: none;
109
+ }
121
110
 
122
- .notification {
123
- border-radius: 12px;
124
- padding: 16px;
125
- display: flex;
126
- gap: var(--spacing-spacing-4, 12px);
127
- flex-direction: row;
128
-
129
- &.vertical {
130
- max-width: var(--scb-notification-card-v-max-w);
131
- }
132
-
133
- &.horizontal {
134
- max-width: var(--scb-notification-card-h-max-w);
135
-
136
- .notification-content{
137
- flex-direction: row;
138
- gap: var(--spacing-spacing-4, 12px);
139
- }
140
- }
141
-
142
- a {
143
- text-decoration: underline;
144
- text-decoration-thickness: 1px;
145
- text-underline-offset: .1578em;
146
- &:hover {text-decoration-thickness: 2px;}
147
- }
148
-
149
- .notification-close-button {
150
- position: relative;
151
- right: 8px;
152
- top: 8px;
153
- cursor: pointer;
154
- }
155
- }
111
+ /* Legacy full-width / full-height */
112
+ :host([full-width]) {
113
+ inline-size: 100%;
114
+ }
156
115
 
157
- .notification-content {
158
- display: flex;
159
- flex-direction: column;
160
- gap: 4px;
161
- }
116
+ :host([full-height]) {
117
+ block-size: 100%;
118
+ }
162
119
 
163
- .notification-text-container {
164
- display: flex;
165
- flex-direction: column;
166
- gap: var(--spacing-spacing-3, 8px);
167
- font-family: var(--Brand, Inter);
168
- font-style: normal;
169
-
170
- .notification-title {
171
- font-size: var(--md-sys-typescale-headline-small-Size, 24px);
172
- font-weight: var(--weight-bold, 700);
173
- line-height: var(--md-sys-typescale-headline-small-line-height2, 30px);
174
- letter-spacing: var(--md-sys-typescale-headline-small-tracking, -0.6px);
175
- }
176
-
177
- .notification-subtitle {
178
- font-size: var(--md-sys-typescale-title-medium-size, 18px);
179
- font-weight: var(--weight-semibold, 600);
180
- line-height: var(--md-sys-typescale-title-medium-line-height, 26px);
181
- letter-spacing: var(--md-sys-typescale-title-medium-tracking, -0.3px);
182
- }
183
-
184
- .notification-text {
185
- font-size: var(--md-sys-typescale-body-large-size, 18px);
186
- font-weight: var(--eeight-regular, 400);
187
- line-height: var(--md-sys-typescale-body-large-line-height, 26px);
188
- letter-spacing: var(--md-sys-typescale-body-large-tracking, -0.3px);
189
- }
190
- }
191
-
192
- .notification-footer {
193
- font-size: 18px;
194
- margin-top: 4px;
195
- line-height: 26px;
196
-
197
- .footer-link {
198
- display: inline-block;
199
- vertical-align: middle;
200
- transition: box-shadow 0.25s cubic-bezier(.4,0,.2,1);
201
- }
202
-
203
- .footer-link:focus-visible {
204
- outline: none;
205
- border-radius: 4px;
206
- animation: growShrinkRing 0.25s cubic-bezier(.4,0,.2,1);
207
- box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
208
- }
209
- }
120
+ /* content-width: samma upplägg som card / fact-card */
121
+ :host([sizing='content-width']) {
122
+ display: inline-block;
123
+ inline-size: auto;
124
+ block-size: auto;
125
+ }
126
+
127
+ :host([sizing='content-width']) .notification {
128
+ inline-size: max-content;
129
+ }
130
+
131
+ /* content-height: bredd fyller, höjd styrs av innehåll */
132
+ :host([sizing='content-height']) {
133
+ inline-size: 100%;
134
+ block-size: auto;
135
+ max-inline-size: none;
136
+ }
137
+
138
+ /* När värd-elementet fyller höjd ska själva kortet också göra det */
139
+ :host([height]) .notification,
140
+ :host([max-height]) .notification,
141
+ :host([sizing='stretch']) .notification,
142
+ :host([full-height]) .notification {
143
+ block-size: 100%;
144
+ }
145
+
146
+ /* Öppen / stängd */
147
+ :host([open]) .notification {
148
+ display: flex;
149
+ }
150
+
151
+ :host(:not([open])) .notification {
152
+ display: none;
153
+ }
154
+
155
+ md-focus-ring {
156
+ position: absolute;
157
+ inset: 0;
158
+ pointer-events: none;
159
+ display: none;
160
+ border-radius: var(
161
+ --scb-notification-card-focus-ring-radius,
162
+ var(--md-sys-shape-corner-large, 16px)
163
+ );
164
+ }
165
+
166
+ :host(:focus-within) md-focus-ring {
167
+ display: block;
168
+ }
169
+
170
+ .notification {
171
+ box-sizing: border-box;
172
+ border-radius: var(--md-sys-shape-corner-large, 16px);
173
+ padding: var(--spacing-5, 16px);
174
+ display: flex;
175
+ flex-direction: row;
176
+ align-items: flex-start;
177
+ justify-content: space-between;
178
+ column-gap: var(--spacing-4, 12px);
179
+ row-gap: var(--spacing-3, 8px);
180
+ inline-size: 100%;
181
+ max-inline-size: 100%;
182
+ color: inherit;
183
+ }
184
+
185
+ /* Variantfärger */
186
+ :host([variant='success']) .notification {
187
+ background: var(--md-sys-color-success-container);
188
+ color: var(--md-sys-color-on-success-container);
189
+ }
190
+
191
+ :host([variant='error']) .notification {
192
+ background: var(--md-sys-color-error-container);
193
+ color: var(--md-sys-color-on-error-container);
194
+ }
195
+
196
+ :host([variant='warning']) .notification {
197
+ background: var(--md-sys-color-warning-container);
198
+ color: var(--md-sys-color-on-warning-container);
199
+ }
200
+
201
+ :host([variant='info']) .notification {
202
+ background: var(--md-sys-color-info-container);
203
+ color: var(--md-sys-color-on-info-container);
204
+ }
205
+
206
+ .notification a {
207
+ text-decoration: underline;
208
+ text-decoration-thickness: 1px;
209
+ text-underline-offset: 0.1578em;
210
+ }
211
+
212
+ .notification a:hover {
213
+ text-decoration-thickness: 2px;
214
+ }
210
215
 
211
- @keyframes growShrinkRing {
212
- 0% { box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2); }
213
- 50% { box-shadow: 0 0 0 7px var(--md-sys-color-primary, #1976d2); }
214
- 100% { box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2); }
215
- }
216
+ .notification-main {
217
+ display: flex;
218
+ flex: 1 1 auto;
219
+ min-width: 0;
220
+ }
221
+
222
+ .notification-main.horizontal {
223
+ flex-direction: row;
224
+ column-gap: var(--spacing-4, 12px);
225
+ row-gap: 0;
226
+ align-items: flex-start;
227
+ }
228
+
229
+ .notification-main.vertical {
230
+ flex-direction: column;
231
+ column-gap: 0;
232
+ row-gap: var(--spacing-3, 8px);
233
+ align-items: flex-start;
234
+ }
235
+
236
+ .notification-leading-icon {
237
+ display: flex;
238
+ align-items: flex-start;
239
+ justify-content: center;
240
+ flex: 0 0 auto;
241
+ margin-top: 2px;
242
+ }
243
+
244
+ .notification-leading-icon md-icon {
245
+ font-size: var(--icon-size-small, 24px);
246
+ }
247
+
248
+ .notification-text-container {
249
+ display: flex;
250
+ flex-direction: column;
251
+ gap: var(--spacing-3, 8px);
252
+ font-family: var(--brand-font, Inter);
253
+ font-style: normal;
254
+ min-width: 0;
255
+ }
256
+
257
+ .notification-title {
258
+ font-size: var(--md-sys-typescale-headline-small-size, 24px);
259
+ font-weight: var(--weight-bold, 700);
260
+ line-height: var(--md-sys-typescale-headline-small-line-height, 30px);
261
+ letter-spacing: var(--md-sys-typescale-headline-small-tracking, -0.6px);
262
+
263
+ white-space: normal;
264
+ word-break: normal;
265
+ overflow-wrap: normal;
266
+ hyphens: auto;
267
+ overflow: visible;
268
+ text-overflow: clip;
269
+ }
270
+
271
+ .notification-subtitle {
272
+ font-size: var(--md-sys-typescale-title-medium-size, 18px);
273
+ font-weight: var(--weight-semibold, 600);
274
+ line-height: var(--md-sys-typescale-title-medium-line-height, 26px);
275
+ letter-spacing: var(--md-sys-typescale-title-medium-tracking, -0.3px);
276
+
277
+ white-space: normal;
278
+ word-break: normal;
279
+ overflow-wrap: normal;
280
+ hyphens: auto;
281
+ overflow: visible;
282
+ text-overflow: clip;
283
+ }
284
+
285
+ .notification-text {
286
+ font-size: var(--md-sys-typescale-body-large-size, 18px);
287
+ font-weight: var(--weight-regular, 400);
288
+ line-height: var(--md-sys-typescale-body-large-line-height, 26px);
289
+ letter-spacing: var(--md-sys-typescale-body-large-tracking, -0.3px);
290
+
291
+ white-space: normal;
292
+ word-break: normal;
293
+ overflow-wrap: normal;
294
+ hyphens: auto;
295
+ overflow: visible;
296
+ text-overflow: clip;
297
+ }
298
+
299
+ .notification-footer {
300
+ font-size: 18px;
301
+ margin-top: 4px;
302
+ line-height: 26px;
303
+ }
304
+
305
+ .footer-link {
306
+ display: inline-block;
307
+ vertical-align: middle;
308
+ transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
309
+ }
310
+
311
+ .footer-link:focus-visible {
312
+ outline: none;
313
+ border-radius: 4px;
314
+ animation: growShrinkRing 0.25s cubic-bezier(0.4, 0, 0.2, 1);
315
+ box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
316
+ }
317
+
318
+ .notification-close-button {
319
+ flex: 0 0 auto;
320
+ display: flex;
321
+ align-items: flex-start;
322
+ justify-content: flex-end;
323
+ }
324
+
325
+ /* Justering så att krysset linjerar bättre med ikon / titel */
326
+ .notification-close-button scb-icon-button {
327
+ margin-top: -5px;
328
+ }
329
+
330
+ @keyframes growShrinkRing {
331
+ 0% {
332
+ box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
333
+ }
334
+ 50% {
335
+ box-shadow: 0 0 0 7px var(--md-sys-color-primary, #1976d2);
336
+ }
337
+ 100% {
338
+ box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
339
+ }
340
+ }
216
341
  `
217
342
  ];
218
343
  i([
219
- o({ type: String })
344
+ e({ type: String })
220
345
  ], t.prototype, "variant", 2);
221
346
  i([
222
- o({ type: String, reflect: !0 })
347
+ e({ type: String, reflect: !0 })
223
348
  ], t.prototype, "direction", 2);
224
349
  i([
225
- o({ type: String })
350
+ e({ type: String })
226
351
  ], t.prototype, "title", 2);
227
352
  i([
228
- o({ type: String })
353
+ e({ type: String })
229
354
  ], t.prototype, "subtitle", 2);
230
355
  i([
231
- o({ type: String, attribute: "supporting-text" })
356
+ e({ type: String, attribute: "supporting-text" })
232
357
  ], t.prototype, "supportingText", 2);
233
358
  i([
234
- o({ type: Boolean, reflect: !0 })
359
+ e({ type: Boolean, reflect: !0 })
235
360
  ], t.prototype, "open", 2);
236
361
  i([
237
- o({ type: String, attribute: "link-text" })
362
+ e({ type: String, attribute: "link-text" })
238
363
  ], t.prototype, "linkText", 2);
239
364
  i([
240
- o({ type: String, attribute: "link-href" })
241
- ], t.prototype, "linkhref", 2);
365
+ e({ type: String, attribute: "link-href" })
366
+ ], t.prototype, "linkHref", 2);
242
367
  i([
243
- o({ type: Boolean, attribute: "show-icon" })
368
+ e({ type: Boolean, attribute: "show-icon" })
244
369
  ], t.prototype, "showIcon", 2);
245
370
  i([
246
- o({ type: Boolean, attribute: "show-close-button" })
371
+ e({ type: Boolean, attribute: "show-close-button" })
247
372
  ], t.prototype, "showCloseButton", 2);
248
373
  i([
249
- o({ type: Boolean, reflect: !0, attribute: "full-height" })
374
+ e({ type: String, reflect: !0 })
375
+ ], t.prototype, "sizing", 2);
376
+ i([
377
+ e({ type: String, reflect: !0 })
378
+ ], t.prototype, "width", 2);
379
+ i([
380
+ e({ type: String, reflect: !0, attribute: "max-width" })
381
+ ], t.prototype, "maxWidth", 2);
382
+ i([
383
+ e({ type: String, reflect: !0 })
384
+ ], t.prototype, "height", 2);
385
+ i([
386
+ e({ type: String, reflect: !0, attribute: "max-height" })
387
+ ], t.prototype, "maxHeight", 2);
388
+ i([
389
+ e({ type: Boolean, reflect: !0, attribute: "full-height" })
250
390
  ], t.prototype, "fullHeight", 2);
251
391
  i([
252
- o({ type: Boolean, reflect: !0, attribute: "full-width" })
392
+ e({ type: Boolean, reflect: !0, attribute: "full-width" })
253
393
  ], t.prototype, "fullWidth", 2);
254
394
  t = i([
255
395
  f("scb-notification-card")
@@ -1,6 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  export declare class ScbViz extends LitElement {
3
- variant: 'Standard' | 'Diagram' | 'Table' | 'Image';
3
+ variant: 'Standard' | 'Table' | 'Image';
4
4
  selectedChip: 'Diagram' | 'Table' | null;
5
5
  title: string;
6
6
  subtitle: string;
@@ -20,5 +20,5 @@ export declare class ScbViz extends LitElement {
20
20
  updated(): void;
21
21
  private _styleSlottedTable;
22
22
  render(): import('lit-html').TemplateResult<1>;
23
- private _onChipSelect;
23
+ private _onSegmentedChange;
24
24
  }