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,176 +1,297 @@
1
- import{a as h,n as o,i as p,x as a,t as f}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(n,c,r){try{customElements.get(n)||s(n,c,r)}catch(d){var l=String(d||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var u=Object.defineProperty,v=Object.getOwnPropertyDescriptor,i=(e,s,n,c)=>{for(var r=c>1?void 0:c?v(s,n):s,l=e.length-1,d;l>=0;l--)(d=e[l])&&(r=(c?d(s,n,r):d(r))||r);return c&&r&&u(s,n,r),r};let t=class extends p{constructor(){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=()=>{this.open=!1;const e=new CustomEvent("close",{detail:{open:this.open}});this.dispatchEvent(e)}}_iconForVariant(){switch(this.variant){case"success":return"check_circle";case"error":return"error";case"warning":return"warning";case"info":return"info";default:return"info"}}render(){const e=this.variant?`${this.variant.toLowerCase()}`:"",s=this.direction?`${this.direction.toLowerCase()}`:"",n=this.linkhref?"clickable":"";return a`
2
- <div class="notification ${s} ${n} ${e}" type=${this.variant} role="alert" aria-live="assertive" aria-atomic="true" style="display: ${this.open?"flex":"none"};">
3
- <div class="notification-content">
4
- ${this.showIcon||this.showCloseButton?a`<div class="notification-header">
5
- ${this.showIcon?a`<md-icon>${this._iconForVariant()}</md-icon>`:""}
6
- </div>`:""}
7
- <div class="notification-text-container">
8
- ${this.title?a`<div class="notification-title">${this.title}</div>`:""}
9
- ${this.subtitle?a`<div class="notification-subtitle">${this.subtitle}</div>`:""}
10
- ${this.supportingText?a`<div class="notification-text">${this.supportingText}</div>`:""}
11
- ${this.linkText?a`
12
- <div class="notification-footer">
13
- <a class="footer-link" href="${this.linkhref}">${this.linkText}</a>
14
- </div>
15
- `:""}
16
- </div>
1
+ import{a as d,n as e,i as p,x as a,t as f}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/preload-helper.js";import"../scb-tooltip/scb-tooltip.js";import"../scb-button/scb-button.js";(function(){try{var o=typeof globalThis<"u"?globalThis:window;if(!o.__scb_ce_guard_installed__){o.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(r,l,n){try{customElements.get(r)||s(r,l,n)}catch(h){var c=String(h||"");if(c.indexOf("already been used")===-1&&c.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var m=Object.defineProperty,u=Object.getOwnPropertyDescriptor,i=(o,s,r,l)=>{for(var n=l>1?void 0:l?u(s,r):s,c=o.length-1,h;c>=0;c--)(h=o[c])&&(n=(l?h(s,r,n):h(n))||n);return l&&n&&m(s,r,n),n};let t=class extends p{constructor(){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=()=>{this.open=!1;const o=new CustomEvent("close",{detail:{open:this.open},bubbles:!0,composed:!0});this.dispatchEvent(o)}}_iconForVariant(){switch(this.variant){case"success":return"check_circle";case"error":return"error";case"warning":return"warning";case"info":default:return"info"}}updated(o){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"))}render(){const o=this.direction==="vertical"?"vertical":"horizontal",s=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);";return a`
2
+ <div
3
+ class="notification"
4
+ type=${this.variant}
5
+ role="alert"
6
+ aria-live="assertive"
7
+ aria-atomic="true"
8
+ >
9
+ <div class="notification-main ${o}">
10
+ ${this.showIcon?a`
11
+ <div class="notification-leading-icon">
12
+ <md-icon aria-hidden="true">
13
+ ${this._iconForVariant()}
14
+ </md-icon>
17
15
  </div>
18
- ${this.showCloseButton?a`<div class="notification-close-button"><md-icon-button @click=${this._closeNotification}
19
- 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>`:""}
20
- </div>
21
- `}};t.styles=[h`
22
- :host {
23
- display: block;
24
- position: relative;
25
- container-type: inline-size;
26
- container-name: notification-container;
27
- --scb-notification-card-h-max-w: 580px;
28
- --scb-notification-card-v-max-w: 600px;
29
- }
30
- :host([stretch]) { block-size: 100%; }
31
- :host([stretch]) .notification { block-size: 100%; }
32
-
33
- :host([full-height]) { block-size: 100%; }
34
- :host([full-height]) .notification { block-size: 100%; }
35
-
36
- :host([full-width]) { max-width: none; width: 100%; }
37
- :host([full-width]) .notification.horizontal,
38
- :host([full-width]) .notification.vertical {
39
- max-width: none;
40
- width: auto;
41
-
42
- .notification-content {
43
- width: 100%;
44
- }
45
- }
46
-
47
- :host([open]) .notification { opacity: 1; }
48
- :host(:not([open])) .notification {
49
- opacity: 0;
50
- pointer-events: none;
51
- }
16
+ `:null}
17
+ <div class="notification-text-container">
18
+ ${this.title?a`<div class="notification-title">${this.title}</div>`:null}
19
+ ${this.subtitle?a`<div class="notification-subtitle">
20
+ ${this.subtitle}
21
+ </div>`:null}
22
+ ${this.supportingText?a`<div class="notification-text">
23
+ ${this.supportingText}
24
+ </div>`:null}
25
+ ${this.linkText?a`
26
+ <div class="notification-footer">
27
+ <a class="footer-link" href="${this.linkHref}">
28
+ ${this.linkText}
29
+ </a>
30
+ </div>
31
+ `:null}
32
+ </div>
33
+ </div>
34
+ ${this.showCloseButton?a`
35
+ <div class="notification-close-button">
36
+ <scb-icon-button
37
+ aria-label="Stäng meddelande"
38
+ icon="close"
39
+ style=${s}
40
+ @click=${this._closeNotification}
41
+ >
42
+ </scb-icon-button>
43
+ </div>
44
+ `:null}
45
+ </div>
46
+ <md-focus-ring></md-focus-ring>
47
+ `}};t.styles=[d`
48
+ :host {
49
+ display: block;
50
+ position: relative;
51
+ box-sizing: border-box;
52
+ inline-size: 100%;
53
+ min-inline-size: 0;
54
+ /* Om det behövs kan maxbredd styras via css-variabel, samma idé som övriga kort */
55
+ max-inline-size: var(--scb-notification-card-max-w, none);
56
+ height: auto;
57
+ padding: var(--scb-notification-card-focus-ring-gap, 4px);
58
+ }
52
59
 
53
- :host([variant="success"]) .notification {
54
- background: var(--md-sys-color-success-container);
55
- color: var(--md-sys-color-on-success-container);
56
- a {
57
- color: var(--md-sys-color-on-success-container);
58
- }
59
- }
60
- :host([variant="error"]) .notification {
61
- background: var(--md-sys-color-error-container);
62
- color: var(--md-sys-color-on-error-container);
63
- a {
64
- color: var(--md-sys-color-on-error-container);
65
- }
66
- }
67
- :host([variant="warning"]) .notification {
68
- background: var(--md-sys-color-warning-container);
69
- color: var(--md-sys-color-on-warning-container);
70
- a {
71
- color: var(--md-sys-color-on-warning-container);
72
- }
73
- }
74
- :host([variant="info"]) .notification {
75
- background: var(--md-sys-color-info-container);
76
- color: var(--md-sys-color-on-info-container);
77
- a {
78
- color: var(--md-sys-color-on-info-container);
79
- }
80
- }
60
+ /* Stretch: fyller både bredd och höjd, som standard */
61
+ :host([sizing='stretch']) {
62
+ inline-size: 100%;
63
+ block-size: 100%;
64
+ max-inline-size: none;
65
+ }
81
66
 
82
- .notification {
83
- border-radius: 12px;
84
- padding: 16px;
85
- display: flex;
86
- gap: var(--spacing-spacing-4, 12px);
87
- flex-direction: row;
88
-
89
- &.vertical {
90
- max-width: var(--scb-notification-card-v-max-w);
91
- }
92
-
93
- &.horizontal {
94
- max-width: var(--scb-notification-card-h-max-w);
95
-
96
- .notification-content{
97
- flex-direction: row;
98
- gap: var(--spacing-spacing-4, 12px);
99
- }
100
- }
101
-
102
- a {
103
- text-decoration: underline;
104
- text-decoration-thickness: 1px;
105
- text-underline-offset: .1578em;
106
- &:hover {text-decoration-thickness: 2px;}
107
- }
108
-
109
- .notification-close-button {
110
- position: relative;
111
- right: 8px;
112
- top: 8px;
113
- cursor: pointer;
114
- }
115
- }
67
+ /* Legacy full-width / full-height */
68
+ :host([full-width]) {
69
+ inline-size: 100%;
70
+ }
116
71
 
117
- .notification-content {
118
- display: flex;
119
- flex-direction: column;
120
- gap: 4px;
121
- }
72
+ :host([full-height]) {
73
+ block-size: 100%;
74
+ }
122
75
 
123
- .notification-text-container {
124
- display: flex;
125
- flex-direction: column;
126
- gap: var(--spacing-spacing-3, 8px);
127
- font-family: var(--Brand, Inter);
128
- font-style: normal;
129
-
130
- .notification-title {
131
- font-size: var(--md-sys-typescale-headline-small-Size, 24px);
132
- font-weight: var(--weight-bold, 700);
133
- line-height: var(--md-sys-typescale-headline-small-line-height2, 30px);
134
- letter-spacing: var(--md-sys-typescale-headline-small-tracking, -0.6px);
135
- }
136
-
137
- .notification-subtitle {
138
- font-size: var(--md-sys-typescale-title-medium-size, 18px);
139
- font-weight: var(--weight-semibold, 600);
140
- line-height: var(--md-sys-typescale-title-medium-line-height, 26px);
141
- letter-spacing: var(--md-sys-typescale-title-medium-tracking, -0.3px);
142
- }
143
-
144
- .notification-text {
145
- font-size: var(--md-sys-typescale-body-large-size, 18px);
146
- font-weight: var(--eeight-regular, 400);
147
- line-height: var(--md-sys-typescale-body-large-line-height, 26px);
148
- letter-spacing: var(--md-sys-typescale-body-large-tracking, -0.3px);
149
- }
150
- }
151
-
152
- .notification-footer {
153
- font-size: 18px;
154
- margin-top: 4px;
155
- line-height: 26px;
156
-
157
- .footer-link {
158
- display: inline-block;
159
- vertical-align: middle;
160
- transition: box-shadow 0.25s cubic-bezier(.4,0,.2,1);
161
- }
162
-
163
- .footer-link:focus-visible {
164
- outline: none;
165
- border-radius: 4px;
166
- animation: growShrinkRing 0.25s cubic-bezier(.4,0,.2,1);
167
- box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
168
- }
169
- }
76
+ /* content-width: samma upplägg som card / fact-card */
77
+ :host([sizing='content-width']) {
78
+ display: inline-block;
79
+ inline-size: auto;
80
+ block-size: auto;
81
+ }
82
+
83
+ :host([sizing='content-width']) .notification {
84
+ inline-size: max-content;
85
+ }
86
+
87
+ /* content-height: bredd fyller, höjd styrs av innehåll */
88
+ :host([sizing='content-height']) {
89
+ inline-size: 100%;
90
+ block-size: auto;
91
+ max-inline-size: none;
92
+ }
93
+
94
+ /* När värd-elementet fyller höjd ska själva kortet också göra det */
95
+ :host([height]) .notification,
96
+ :host([max-height]) .notification,
97
+ :host([sizing='stretch']) .notification,
98
+ :host([full-height]) .notification {
99
+ block-size: 100%;
100
+ }
101
+
102
+ /* Öppen / stängd */
103
+ :host([open]) .notification {
104
+ display: flex;
105
+ }
106
+
107
+ :host(:not([open])) .notification {
108
+ display: none;
109
+ }
110
+
111
+ md-focus-ring {
112
+ position: absolute;
113
+ inset: 0;
114
+ pointer-events: none;
115
+ display: none;
116
+ border-radius: var(
117
+ --scb-notification-card-focus-ring-radius,
118
+ var(--md-sys-shape-corner-large, 16px)
119
+ );
120
+ }
121
+
122
+ :host(:focus-within) md-focus-ring {
123
+ display: block;
124
+ }
125
+
126
+ .notification {
127
+ box-sizing: border-box;
128
+ border-radius: var(--md-sys-shape-corner-large, 16px);
129
+ padding: var(--spacing-5, 16px);
130
+ display: flex;
131
+ flex-direction: row;
132
+ align-items: flex-start;
133
+ justify-content: space-between;
134
+ column-gap: var(--spacing-4, 12px);
135
+ row-gap: var(--spacing-3, 8px);
136
+ inline-size: 100%;
137
+ max-inline-size: 100%;
138
+ color: inherit;
139
+ }
140
+
141
+ /* Variantfärger */
142
+ :host([variant='success']) .notification {
143
+ background: var(--md-sys-color-success-container);
144
+ color: var(--md-sys-color-on-success-container);
145
+ }
146
+
147
+ :host([variant='error']) .notification {
148
+ background: var(--md-sys-color-error-container);
149
+ color: var(--md-sys-color-on-error-container);
150
+ }
151
+
152
+ :host([variant='warning']) .notification {
153
+ background: var(--md-sys-color-warning-container);
154
+ color: var(--md-sys-color-on-warning-container);
155
+ }
156
+
157
+ :host([variant='info']) .notification {
158
+ background: var(--md-sys-color-info-container);
159
+ color: var(--md-sys-color-on-info-container);
160
+ }
161
+
162
+ .notification a {
163
+ text-decoration: underline;
164
+ text-decoration-thickness: 1px;
165
+ text-underline-offset: 0.1578em;
166
+ }
170
167
 
171
- @keyframes growShrinkRing {
172
- 0% { box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2); }
173
- 50% { box-shadow: 0 0 0 7px var(--md-sys-color-primary, #1976d2); }
174
- 100% { box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2); }
175
- }
176
- `];i([o({type:String})],t.prototype,"variant",2);i([o({type:String,reflect:!0})],t.prototype,"direction",2);i([o({type:String})],t.prototype,"title",2);i([o({type:String})],t.prototype,"subtitle",2);i([o({type:String,attribute:"supporting-text"})],t.prototype,"supportingText",2);i([o({type:Boolean,reflect:!0})],t.prototype,"open",2);i([o({type:String,attribute:"link-text"})],t.prototype,"linkText",2);i([o({type:String,attribute:"link-href"})],t.prototype,"linkhref",2);i([o({type:Boolean,attribute:"show-icon"})],t.prototype,"showIcon",2);i([o({type:Boolean,attribute:"show-close-button"})],t.prototype,"showCloseButton",2);i([o({type:Boolean,reflect:!0,attribute:"full-height"})],t.prototype,"fullHeight",2);i([o({type:Boolean,reflect:!0,attribute:"full-width"})],t.prototype,"fullWidth",2);t=i([f("scb-notification-card")],t);
168
+ .notification a:hover {
169
+ text-decoration-thickness: 2px;
170
+ }
171
+
172
+ .notification-main {
173
+ display: flex;
174
+ flex: 1 1 auto;
175
+ min-width: 0;
176
+ }
177
+
178
+ .notification-main.horizontal {
179
+ flex-direction: row;
180
+ column-gap: var(--spacing-4, 12px);
181
+ row-gap: 0;
182
+ align-items: flex-start;
183
+ }
184
+
185
+ .notification-main.vertical {
186
+ flex-direction: column;
187
+ column-gap: 0;
188
+ row-gap: var(--spacing-3, 8px);
189
+ align-items: flex-start;
190
+ }
191
+
192
+ .notification-leading-icon {
193
+ display: flex;
194
+ align-items: flex-start;
195
+ justify-content: center;
196
+ flex: 0 0 auto;
197
+ margin-top: 2px;
198
+ }
199
+
200
+ .notification-leading-icon md-icon {
201
+ font-size: var(--icon-size-small, 24px);
202
+ }
203
+
204
+ .notification-text-container {
205
+ display: flex;
206
+ flex-direction: column;
207
+ gap: var(--spacing-3, 8px);
208
+ font-family: var(--brand-font, Inter);
209
+ font-style: normal;
210
+ min-width: 0;
211
+ }
212
+
213
+ .notification-title {
214
+ font-size: var(--md-sys-typescale-headline-small-size, 24px);
215
+ font-weight: var(--weight-bold, 700);
216
+ line-height: var(--md-sys-typescale-headline-small-line-height, 30px);
217
+ letter-spacing: var(--md-sys-typescale-headline-small-tracking, -0.6px);
218
+
219
+ white-space: normal;
220
+ word-break: normal;
221
+ overflow-wrap: normal;
222
+ hyphens: auto;
223
+ overflow: visible;
224
+ text-overflow: clip;
225
+ }
226
+
227
+ .notification-subtitle {
228
+ font-size: var(--md-sys-typescale-title-medium-size, 18px);
229
+ font-weight: var(--weight-semibold, 600);
230
+ line-height: var(--md-sys-typescale-title-medium-line-height, 26px);
231
+ letter-spacing: var(--md-sys-typescale-title-medium-tracking, -0.3px);
232
+
233
+ white-space: normal;
234
+ word-break: normal;
235
+ overflow-wrap: normal;
236
+ hyphens: auto;
237
+ overflow: visible;
238
+ text-overflow: clip;
239
+ }
240
+
241
+ .notification-text {
242
+ font-size: var(--md-sys-typescale-body-large-size, 18px);
243
+ font-weight: var(--weight-regular, 400);
244
+ line-height: var(--md-sys-typescale-body-large-line-height, 26px);
245
+ letter-spacing: var(--md-sys-typescale-body-large-tracking, -0.3px);
246
+
247
+ white-space: normal;
248
+ word-break: normal;
249
+ overflow-wrap: normal;
250
+ hyphens: auto;
251
+ overflow: visible;
252
+ text-overflow: clip;
253
+ }
254
+
255
+ .notification-footer {
256
+ font-size: 18px;
257
+ margin-top: 4px;
258
+ line-height: 26px;
259
+ }
260
+
261
+ .footer-link {
262
+ display: inline-block;
263
+ vertical-align: middle;
264
+ transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
265
+ }
266
+
267
+ .footer-link:focus-visible {
268
+ outline: none;
269
+ border-radius: 4px;
270
+ animation: growShrinkRing 0.25s cubic-bezier(0.4, 0, 0.2, 1);
271
+ box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
272
+ }
273
+
274
+ .notification-close-button {
275
+ flex: 0 0 auto;
276
+ display: flex;
277
+ align-items: flex-start;
278
+ justify-content: flex-end;
279
+ }
280
+
281
+ /* Justering så att krysset linjerar bättre med ikon / titel */
282
+ .notification-close-button scb-icon-button {
283
+ margin-top: -5px;
284
+ }
285
+
286
+ @keyframes growShrinkRing {
287
+ 0% {
288
+ box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
289
+ }
290
+ 50% {
291
+ box-shadow: 0 0 0 7px var(--md-sys-color-primary, #1976d2);
292
+ }
293
+ 100% {
294
+ box-shadow: 0 0 0 2px var(--md-sys-color-primary, #1976d2);
295
+ }
296
+ }
297
+ `];i([e({type:String})],t.prototype,"variant",2);i([e({type:String,reflect:!0})],t.prototype,"direction",2);i([e({type:String})],t.prototype,"title",2);i([e({type:String})],t.prototype,"subtitle",2);i([e({type:String,attribute:"supporting-text"})],t.prototype,"supportingText",2);i([e({type:Boolean,reflect:!0})],t.prototype,"open",2);i([e({type:String,attribute:"link-text"})],t.prototype,"linkText",2);i([e({type:String,attribute:"link-href"})],t.prototype,"linkHref",2);i([e({type:Boolean,attribute:"show-icon"})],t.prototype,"showIcon",2);i([e({type:Boolean,attribute:"show-close-button"})],t.prototype,"showCloseButton",2);i([e({type:String,reflect:!0})],t.prototype,"sizing",2);i([e({type:String,reflect:!0})],t.prototype,"width",2);i([e({type:String,reflect:!0,attribute:"max-width"})],t.prototype,"maxWidth",2);i([e({type:String,reflect:!0})],t.prototype,"height",2);i([e({type:String,reflect:!0,attribute:"max-height"})],t.prototype,"maxHeight",2);i([e({type:Boolean,reflect:!0,attribute:"full-height"})],t.prototype,"fullHeight",2);i([e({type:Boolean,reflect:!0,attribute:"full-width"})],t.prototype,"fullWidth",2);t=i([f("scb-notification-card")],t);