@spectrum-web-components/alert-banner 1.12.0-testing.20260223092154 → 1.12.0
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 +6 -1
- package/custom-elements.json +409 -6
- package/package.json +4 -5
- package/src/AlertBanner.base.d.ts +46 -0
- package/src/AlertBanner.base.dev.js +102 -0
- package/src/AlertBanner.base.dev.js.map +7 -0
- package/src/AlertBanner.base.js +2 -0
- package/src/AlertBanner.base.js.map +7 -0
- package/src/AlertBanner.d.ts +2 -1
- package/src/AlertBanner.dev.js +1 -3
- package/src/AlertBanner.dev.js.map +2 -2
- package/src/AlertBanner.js +1 -1
- package/src/AlertBanner.js.map +3 -3
- package/src/AlertBanner.types.d.ts +18 -0
- package/src/AlertBanner.types.dev.js +7 -0
- package/src/AlertBanner.types.dev.js.map +7 -0
- package/src/AlertBanner.types.js +2 -0
- package/src/AlertBanner.types.js.map +7 -0
package/README.md
CHANGED
|
@@ -38,7 +38,12 @@ An optional action using `slot="action"`:
|
|
|
38
38
|
```html
|
|
39
39
|
<sp-alert-banner open>
|
|
40
40
|
Your trial has expired
|
|
41
|
-
<sp-button
|
|
41
|
+
<sp-button
|
|
42
|
+
treatment="outline"
|
|
43
|
+
static-color="white"
|
|
44
|
+
variant="secondary"
|
|
45
|
+
slot="action"
|
|
46
|
+
>
|
|
42
47
|
Buy now
|
|
43
48
|
</sp-button>
|
|
44
49
|
</sp-alert-banner>
|
package/custom-elements.json
CHANGED
|
@@ -17,6 +17,197 @@
|
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "javascript-module",
|
|
22
|
+
"path": "src/AlertBanner.base.js",
|
|
23
|
+
"declarations": [
|
|
24
|
+
{
|
|
25
|
+
"kind": "class",
|
|
26
|
+
"description": "An alert banner shows pressing and high-signal messages, such as system alerts.\nIt is meant to be noticed and prompt users to take action.",
|
|
27
|
+
"name": "AlertBannerBase",
|
|
28
|
+
"slots": [
|
|
29
|
+
{
|
|
30
|
+
"description": "The main content of the alert banner.",
|
|
31
|
+
"name": ""
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"description": "An optional action button for the alert banner.",
|
|
35
|
+
"name": "action"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"members": [
|
|
39
|
+
{
|
|
40
|
+
"kind": "field",
|
|
41
|
+
"name": "open",
|
|
42
|
+
"type": {
|
|
43
|
+
"text": "boolean"
|
|
44
|
+
},
|
|
45
|
+
"privacy": "public",
|
|
46
|
+
"default": "false",
|
|
47
|
+
"description": "Controls the display of the alert banner.",
|
|
48
|
+
"attribute": "open",
|
|
49
|
+
"reflects": true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"kind": "field",
|
|
53
|
+
"name": "dismissible",
|
|
54
|
+
"type": {
|
|
55
|
+
"text": "boolean"
|
|
56
|
+
},
|
|
57
|
+
"privacy": "public",
|
|
58
|
+
"default": "false",
|
|
59
|
+
"description": "Whether to include an icon-only close button to dismiss the alert banner.",
|
|
60
|
+
"attribute": "dismissible",
|
|
61
|
+
"reflects": true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"kind": "field",
|
|
65
|
+
"name": "variant",
|
|
66
|
+
"privacy": "public",
|
|
67
|
+
"description": "The variant applies specific styling when set to `negative` or `info`;\n`variant` attribute is removed when it's passed an invalid variant.",
|
|
68
|
+
"type": {
|
|
69
|
+
"text": "AlertBannerVariant"
|
|
70
|
+
},
|
|
71
|
+
"attribute": "variant"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"kind": "field",
|
|
75
|
+
"name": "_variant",
|
|
76
|
+
"type": {
|
|
77
|
+
"text": "AlertBannerVariant"
|
|
78
|
+
},
|
|
79
|
+
"privacy": "private",
|
|
80
|
+
"default": "''"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"kind": "method",
|
|
84
|
+
"name": "isValidVariant",
|
|
85
|
+
"privacy": "protected",
|
|
86
|
+
"return": {
|
|
87
|
+
"type": {
|
|
88
|
+
"text": "boolean"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"parameters": [
|
|
92
|
+
{
|
|
93
|
+
"name": "variant",
|
|
94
|
+
"type": {
|
|
95
|
+
"text": "string"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"kind": "method",
|
|
102
|
+
"name": "renderIcon",
|
|
103
|
+
"privacy": "protected",
|
|
104
|
+
"return": {
|
|
105
|
+
"type": {
|
|
106
|
+
"text": "TemplateResult"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"parameters": [
|
|
110
|
+
{
|
|
111
|
+
"name": "variant",
|
|
112
|
+
"type": {
|
|
113
|
+
"text": "string"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"kind": "method",
|
|
120
|
+
"name": "shouldClose",
|
|
121
|
+
"privacy": "protected",
|
|
122
|
+
"return": {
|
|
123
|
+
"type": {
|
|
124
|
+
"text": "void"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"kind": "method",
|
|
130
|
+
"name": "close",
|
|
131
|
+
"privacy": "public",
|
|
132
|
+
"return": {
|
|
133
|
+
"type": {
|
|
134
|
+
"text": "void"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"kind": "method",
|
|
140
|
+
"name": "handleKeydown",
|
|
141
|
+
"privacy": "protected",
|
|
142
|
+
"return": {
|
|
143
|
+
"type": {
|
|
144
|
+
"text": "void"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"parameters": [
|
|
148
|
+
{
|
|
149
|
+
"name": "event",
|
|
150
|
+
"type": {
|
|
151
|
+
"text": "KeyboardEvent"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"events": [
|
|
158
|
+
{
|
|
159
|
+
"name": "close",
|
|
160
|
+
"type": {
|
|
161
|
+
"text": "CustomEvent"
|
|
162
|
+
},
|
|
163
|
+
"description": "Dispatched when the alert banner is dismissed. Cancelable."
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"attributes": [
|
|
167
|
+
{
|
|
168
|
+
"name": "open",
|
|
169
|
+
"type": {
|
|
170
|
+
"text": "boolean"
|
|
171
|
+
},
|
|
172
|
+
"default": "false",
|
|
173
|
+
"description": "Controls the display of the alert banner.",
|
|
174
|
+
"fieldName": "open"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "dismissible",
|
|
178
|
+
"type": {
|
|
179
|
+
"text": "boolean"
|
|
180
|
+
},
|
|
181
|
+
"default": "false",
|
|
182
|
+
"description": "Whether to include an icon-only close button to dismiss the alert banner.",
|
|
183
|
+
"fieldName": "dismissible"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"name": "variant",
|
|
187
|
+
"description": "The variant applies specific styling when set to `negative` or `info`;\n`variant` attribute is removed when it's passed an invalid variant.",
|
|
188
|
+
"type": {
|
|
189
|
+
"text": "AlertBannerVariant"
|
|
190
|
+
},
|
|
191
|
+
"fieldName": "variant"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"superclass": {
|
|
195
|
+
"name": "SpectrumElement",
|
|
196
|
+
"package": "@spectrum-web-components/base"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"exports": [
|
|
201
|
+
{
|
|
202
|
+
"kind": "js",
|
|
203
|
+
"name": "AlertBannerBase",
|
|
204
|
+
"declaration": {
|
|
205
|
+
"name": "AlertBannerBase",
|
|
206
|
+
"module": "src/AlertBanner.base.js"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
20
211
|
{
|
|
21
212
|
"kind": "javascript-module",
|
|
22
213
|
"path": "src/AlertBanner.js",
|
|
@@ -28,11 +219,19 @@
|
|
|
28
219
|
"slots": [
|
|
29
220
|
{
|
|
30
221
|
"description": "The alert banner text context",
|
|
31
|
-
"name": ""
|
|
222
|
+
"name": "",
|
|
223
|
+
"inheritedFrom": {
|
|
224
|
+
"name": "AlertBannerBase",
|
|
225
|
+
"module": "src/AlertBanner.base.ts"
|
|
226
|
+
}
|
|
32
227
|
},
|
|
33
228
|
{
|
|
34
229
|
"description": "Slot for the button element that surfaces the contextual action a user can take",
|
|
35
|
-
"name": "action"
|
|
230
|
+
"name": "action",
|
|
231
|
+
"inheritedFrom": {
|
|
232
|
+
"name": "AlertBannerBase",
|
|
233
|
+
"module": "src/AlertBanner.base.ts"
|
|
234
|
+
}
|
|
36
235
|
}
|
|
37
236
|
],
|
|
38
237
|
"members": [
|
|
@@ -52,21 +251,203 @@
|
|
|
52
251
|
"text": "string"
|
|
53
252
|
}
|
|
54
253
|
}
|
|
55
|
-
]
|
|
254
|
+
],
|
|
255
|
+
"inheritedFrom": {
|
|
256
|
+
"name": "AlertBannerBase",
|
|
257
|
+
"module": "src/AlertBanner.base.js"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"kind": "field",
|
|
262
|
+
"name": "open",
|
|
263
|
+
"type": {
|
|
264
|
+
"text": "boolean"
|
|
265
|
+
},
|
|
266
|
+
"privacy": "public",
|
|
267
|
+
"default": "false",
|
|
268
|
+
"description": "Controls the display of the alert banner.",
|
|
269
|
+
"attribute": "open",
|
|
270
|
+
"reflects": true,
|
|
271
|
+
"inheritedFrom": {
|
|
272
|
+
"name": "AlertBannerBase",
|
|
273
|
+
"module": "src/AlertBanner.base.js"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"kind": "field",
|
|
278
|
+
"name": "dismissible",
|
|
279
|
+
"type": {
|
|
280
|
+
"text": "boolean"
|
|
281
|
+
},
|
|
282
|
+
"privacy": "public",
|
|
283
|
+
"default": "false",
|
|
284
|
+
"description": "Whether to include an icon-only close button to dismiss the alert banner.",
|
|
285
|
+
"attribute": "dismissible",
|
|
286
|
+
"reflects": true,
|
|
287
|
+
"inheritedFrom": {
|
|
288
|
+
"name": "AlertBannerBase",
|
|
289
|
+
"module": "src/AlertBanner.base.js"
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"kind": "field",
|
|
294
|
+
"name": "variant",
|
|
295
|
+
"privacy": "public",
|
|
296
|
+
"description": "The variant applies specific styling when set to `negative` or `info`;\n`variant` attribute is removed when it's passed an invalid variant.",
|
|
297
|
+
"type": {
|
|
298
|
+
"text": "AlertBannerVariant"
|
|
299
|
+
},
|
|
300
|
+
"attribute": "variant",
|
|
301
|
+
"inheritedFrom": {
|
|
302
|
+
"name": "AlertBannerBase",
|
|
303
|
+
"module": "src/AlertBanner.base.js"
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"kind": "field",
|
|
308
|
+
"name": "_variant",
|
|
309
|
+
"type": {
|
|
310
|
+
"text": "AlertBannerVariant"
|
|
311
|
+
},
|
|
312
|
+
"privacy": "private",
|
|
313
|
+
"default": "''",
|
|
314
|
+
"inheritedFrom": {
|
|
315
|
+
"name": "AlertBannerBase",
|
|
316
|
+
"module": "src/AlertBanner.base.js"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"kind": "method",
|
|
321
|
+
"name": "isValidVariant",
|
|
322
|
+
"privacy": "protected",
|
|
323
|
+
"return": {
|
|
324
|
+
"type": {
|
|
325
|
+
"text": "boolean"
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
"parameters": [
|
|
329
|
+
{
|
|
330
|
+
"name": "variant",
|
|
331
|
+
"type": {
|
|
332
|
+
"text": "string"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
"inheritedFrom": {
|
|
337
|
+
"name": "AlertBannerBase",
|
|
338
|
+
"module": "src/AlertBanner.base.js"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"kind": "method",
|
|
343
|
+
"name": "shouldClose",
|
|
344
|
+
"privacy": "protected",
|
|
345
|
+
"return": {
|
|
346
|
+
"type": {
|
|
347
|
+
"text": "void"
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
"inheritedFrom": {
|
|
351
|
+
"name": "AlertBannerBase",
|
|
352
|
+
"module": "src/AlertBanner.base.js"
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"kind": "method",
|
|
357
|
+
"name": "close",
|
|
358
|
+
"privacy": "public",
|
|
359
|
+
"return": {
|
|
360
|
+
"type": {
|
|
361
|
+
"text": "void"
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
"inheritedFrom": {
|
|
365
|
+
"name": "AlertBannerBase",
|
|
366
|
+
"module": "src/AlertBanner.base.js"
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"kind": "method",
|
|
371
|
+
"name": "handleKeydown",
|
|
372
|
+
"privacy": "protected",
|
|
373
|
+
"return": {
|
|
374
|
+
"type": {
|
|
375
|
+
"text": "void"
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"parameters": [
|
|
379
|
+
{
|
|
380
|
+
"name": "event",
|
|
381
|
+
"type": {
|
|
382
|
+
"text": "KeyboardEvent"
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
"inheritedFrom": {
|
|
387
|
+
"name": "AlertBannerBase",
|
|
388
|
+
"module": "src/AlertBanner.base.js"
|
|
389
|
+
}
|
|
56
390
|
}
|
|
57
391
|
],
|
|
58
392
|
"events": [
|
|
59
393
|
{
|
|
394
|
+
"name": "close",
|
|
395
|
+
"type": {
|
|
396
|
+
"text": "CustomEvent"
|
|
397
|
+
},
|
|
60
398
|
"description": "Announces the alert banner has been closed",
|
|
61
|
-
"
|
|
399
|
+
"inheritedFrom": {
|
|
400
|
+
"name": "AlertBannerBase",
|
|
401
|
+
"module": "src/AlertBanner.base.ts"
|
|
402
|
+
}
|
|
62
403
|
}
|
|
63
404
|
],
|
|
64
405
|
"superclass": {
|
|
65
406
|
"name": "AlertBannerBase",
|
|
66
|
-
"
|
|
407
|
+
"module": "/src/AlertBanner.base.js"
|
|
67
408
|
},
|
|
68
409
|
"tagName": "sp-alert-banner",
|
|
69
|
-
"customElement": true
|
|
410
|
+
"customElement": true,
|
|
411
|
+
"attributes": [
|
|
412
|
+
{
|
|
413
|
+
"name": "open",
|
|
414
|
+
"type": {
|
|
415
|
+
"text": "boolean"
|
|
416
|
+
},
|
|
417
|
+
"default": "false",
|
|
418
|
+
"description": "Controls the display of the alert banner.",
|
|
419
|
+
"fieldName": "open",
|
|
420
|
+
"inheritedFrom": {
|
|
421
|
+
"name": "AlertBannerBase",
|
|
422
|
+
"module": "src/AlertBanner.base.ts"
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"name": "dismissible",
|
|
427
|
+
"type": {
|
|
428
|
+
"text": "boolean"
|
|
429
|
+
},
|
|
430
|
+
"default": "false",
|
|
431
|
+
"description": "Whether to include an icon-only close button to dismiss the alert banner.",
|
|
432
|
+
"fieldName": "dismissible",
|
|
433
|
+
"inheritedFrom": {
|
|
434
|
+
"name": "AlertBannerBase",
|
|
435
|
+
"module": "src/AlertBanner.base.ts"
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "variant",
|
|
440
|
+
"description": "The variant applies specific styling when set to `negative` or `info`;\n`variant` attribute is removed when it's passed an invalid variant.",
|
|
441
|
+
"type": {
|
|
442
|
+
"text": "AlertBannerVariant"
|
|
443
|
+
},
|
|
444
|
+
"fieldName": "variant",
|
|
445
|
+
"inheritedFrom": {
|
|
446
|
+
"name": "AlertBannerBase",
|
|
447
|
+
"module": "src/AlertBanner.base.ts"
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
]
|
|
70
451
|
}
|
|
71
452
|
],
|
|
72
453
|
"exports": [
|
|
@@ -87,6 +468,28 @@
|
|
|
87
468
|
}
|
|
88
469
|
}
|
|
89
470
|
]
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"kind": "javascript-module",
|
|
474
|
+
"path": "src/AlertBanner.types.js",
|
|
475
|
+
"declarations": [
|
|
476
|
+
{
|
|
477
|
+
"kind": "variable",
|
|
478
|
+
"name": "ALERT_BANNER_VALID_VARIANTS",
|
|
479
|
+
"default": "[ 'neutral', 'info', 'negative', ] as const satisfies readonly string[]",
|
|
480
|
+
"description": "Copyright 2026 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License."
|
|
481
|
+
}
|
|
482
|
+
],
|
|
483
|
+
"exports": [
|
|
484
|
+
{
|
|
485
|
+
"kind": "js",
|
|
486
|
+
"name": "ALERT_BANNER_VALID_VARIANTS",
|
|
487
|
+
"declaration": {
|
|
488
|
+
"name": "ALERT_BANNER_VALID_VARIANTS",
|
|
489
|
+
"module": "src/AlertBanner.types.js"
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
]
|
|
90
493
|
}
|
|
91
494
|
]
|
|
92
495
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/alert-banner",
|
|
3
|
-
"version": "1.12.0
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Web component implementation of a Spectrum design AlertBanner",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Adobe",
|
|
@@ -54,10 +54,9 @@
|
|
|
54
54
|
],
|
|
55
55
|
"types": "./src/index.d.ts",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@spectrum-web-components/base": "1.12.0
|
|
58
|
-
"@spectrum-web-components/button": "1.12.0
|
|
59
|
-
"@spectrum-web-components/
|
|
60
|
-
"@spectrum-web-components/icons-workflow": "1.12.0-testing.20260223092154"
|
|
57
|
+
"@spectrum-web-components/base": "1.12.0",
|
|
58
|
+
"@spectrum-web-components/button": "1.12.0",
|
|
59
|
+
"@spectrum-web-components/icons-workflow": "1.12.0"
|
|
61
60
|
},
|
|
62
61
|
"keywords": [
|
|
63
62
|
"design-system",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
13
|
+
import { type AlertBannerVariant } from './AlertBanner.types.js';
|
|
14
|
+
/**
|
|
15
|
+
* An alert banner shows pressing and high-signal messages, such as system alerts.
|
|
16
|
+
* It is meant to be noticed and prompt users to take action.
|
|
17
|
+
*
|
|
18
|
+
* @slot - The main content of the alert banner.
|
|
19
|
+
* @slot action - An optional action button for the alert banner.
|
|
20
|
+
*
|
|
21
|
+
* @fires close - Dispatched when the alert banner is dismissed. Cancelable.
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class AlertBannerBase extends SpectrumElement {
|
|
24
|
+
static get styles(): CSSResultArray;
|
|
25
|
+
/**
|
|
26
|
+
* Controls the display of the alert banner.
|
|
27
|
+
*/
|
|
28
|
+
open: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to include an icon-only close button to dismiss the alert banner.
|
|
31
|
+
*/
|
|
32
|
+
dismissible: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The variant applies specific styling when set to `negative` or `info`;
|
|
35
|
+
* `variant` attribute is removed when it's passed an invalid variant.
|
|
36
|
+
*/
|
|
37
|
+
set variant(variant: AlertBannerVariant);
|
|
38
|
+
get variant(): AlertBannerVariant;
|
|
39
|
+
private _variant;
|
|
40
|
+
protected isValidVariant(variant: string): boolean;
|
|
41
|
+
protected abstract renderIcon(variant: string): TemplateResult;
|
|
42
|
+
protected shouldClose(): void;
|
|
43
|
+
close(): void;
|
|
44
|
+
protected handleKeydown(event: KeyboardEvent): void;
|
|
45
|
+
protected updated(changes: PropertyValues): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
SpectrumElement
|
|
14
|
+
} from "@spectrum-web-components/base";
|
|
15
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
16
|
+
import {
|
|
17
|
+
ALERT_BANNER_VALID_VARIANTS
|
|
18
|
+
} from "./AlertBanner.types.dev.js";
|
|
19
|
+
export class AlertBannerBase extends SpectrumElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.open = false;
|
|
23
|
+
this.dismissible = false;
|
|
24
|
+
this._variant = "";
|
|
25
|
+
}
|
|
26
|
+
static get styles() {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
set variant(variant) {
|
|
30
|
+
if (variant === this.variant) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const oldValue = this.variant;
|
|
34
|
+
if (this.isValidVariant(variant)) {
|
|
35
|
+
this.setAttribute("variant", variant);
|
|
36
|
+
this._variant = variant;
|
|
37
|
+
} else {
|
|
38
|
+
this.removeAttribute("variant");
|
|
39
|
+
this._variant = "";
|
|
40
|
+
if (true) {
|
|
41
|
+
window.__swc.warn(
|
|
42
|
+
this,
|
|
43
|
+
`<${this.localName}> element expects the "variant" attribute to be one of the following:`,
|
|
44
|
+
"https://opensource.adobe.com/spectrum-web-components/components/alert-banner/#variants",
|
|
45
|
+
{
|
|
46
|
+
issues: [...ALERT_BANNER_VALID_VARIANTS]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.requestUpdate("variant", oldValue);
|
|
52
|
+
}
|
|
53
|
+
get variant() {
|
|
54
|
+
return this._variant;
|
|
55
|
+
}
|
|
56
|
+
// ──────────────────────
|
|
57
|
+
// IMPLEMENTATION
|
|
58
|
+
// ──────────────────────
|
|
59
|
+
isValidVariant(variant) {
|
|
60
|
+
return ALERT_BANNER_VALID_VARIANTS.includes(variant);
|
|
61
|
+
}
|
|
62
|
+
shouldClose() {
|
|
63
|
+
const applyDefault = this.dispatchEvent(
|
|
64
|
+
new CustomEvent("close", {
|
|
65
|
+
composed: true,
|
|
66
|
+
bubbles: true,
|
|
67
|
+
cancelable: true
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
if (applyDefault) {
|
|
71
|
+
this.close();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
close() {
|
|
75
|
+
this.open = false;
|
|
76
|
+
}
|
|
77
|
+
handleKeydown(event) {
|
|
78
|
+
if (event.code === "Escape" && this.dismissible) {
|
|
79
|
+
this.shouldClose();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
updated(changes) {
|
|
83
|
+
super.updated(changes);
|
|
84
|
+
if (changes.has("open")) {
|
|
85
|
+
if (this.open) {
|
|
86
|
+
this.addEventListener("keydown", this.handleKeydown);
|
|
87
|
+
} else {
|
|
88
|
+
this.removeEventListener("keydown", this.handleKeydown);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
__decorateClass([
|
|
94
|
+
property({ type: Boolean, reflect: true })
|
|
95
|
+
], AlertBannerBase.prototype, "open", 2);
|
|
96
|
+
__decorateClass([
|
|
97
|
+
property({ type: Boolean, reflect: true })
|
|
98
|
+
], AlertBannerBase.prototype, "dismissible", 2);
|
|
99
|
+
__decorateClass([
|
|
100
|
+
property({ type: String })
|
|
101
|
+
], AlertBannerBase.prototype, "variant", 1);
|
|
102
|
+
//# sourceMappingURL=AlertBanner.base.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["AlertBanner.base.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport {\n ALERT_BANNER_VALID_VARIANTS,\n type AlertBannerVariant,\n} from './AlertBanner.types.dev.js'\n\n/**\n * An alert banner shows pressing and high-signal messages, such as system alerts.\n * It is meant to be noticed and prompt users to take action.\n *\n * @slot - The main content of the alert banner.\n * @slot action - An optional action button for the alert banner.\n *\n * @fires close - Dispatched when the alert banner is dismissed. Cancelable.\n */\nexport abstract class AlertBannerBase extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [];\n }\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // SHARED API\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Controls the display of the alert banner.\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * Whether to include an icon-only close button to dismiss the alert banner.\n */\n @property({ type: Boolean, reflect: true })\n public dismissible = false;\n\n /**\n * The variant applies specific styling when set to `negative` or `info`;\n * `variant` attribute is removed when it's passed an invalid variant.\n */\n @property({ type: String })\n public set variant(variant: AlertBannerVariant) {\n if (variant === this.variant) {\n return;\n }\n const oldValue = this.variant;\n\n if (this.isValidVariant(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n } else {\n this.removeAttribute('variant');\n this._variant = '';\n\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expects the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/alert-banner/#variants',\n {\n issues: [...ALERT_BANNER_VALID_VARIANTS],\n }\n );\n }\n }\n this.requestUpdate('variant', oldValue);\n }\n\n public get variant(): AlertBannerVariant {\n return this._variant;\n }\n\n private _variant: AlertBannerVariant = '';\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // IMPLEMENTATION\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n protected isValidVariant(variant: string): boolean {\n return (ALERT_BANNER_VALID_VARIANTS as readonly string[]).includes(variant);\n }\n\n protected abstract renderIcon(variant: string): TemplateResult;\n\n protected shouldClose(): void {\n const applyDefault = this.dispatchEvent(\n new CustomEvent('close', {\n composed: true,\n bubbles: true,\n cancelable: true,\n })\n );\n if (applyDefault) {\n this.close();\n }\n }\n\n public close(): void {\n this.open = false;\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n if (event.code === 'Escape' && this.dismissible) {\n this.shouldClose();\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n\n if (changes.has('open')) {\n if (this.open) {\n this.addEventListener('keydown', this.handleKeydown);\n } else {\n this.removeEventListener('keydown', this.handleKeydown);\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAWA;AAAA,EAGE;AAAA,OAEK;AACP,SAAS,gBAAgB;AAEzB;AAAA,EACE;AAAA,OAEK;AAWA,aAAe,wBAAwB,gBAAgB;AAAA,EAAvD;AAAA;AAaL,SAAO,OAAO;AAMd,SAAO,cAAc;AAsCrB,SAAQ,WAA+B;AAAA;AAAA,EAxDvC,WAA2B,SAAyB;AAClD,WAAO,CAAC;AAAA,EACV;AAAA,EAuBA,IAAW,QAAQ,SAA6B;AAC9C,QAAI,YAAY,KAAK,SAAS;AAC5B;AAAA,IACF;AACA,UAAM,WAAW,KAAK;AAEtB,QAAI,KAAK,eAAe,OAAO,GAAG;AAChC,WAAK,aAAa,WAAW,OAAO;AACpC,WAAK,WAAW;AAAA,IAClB,OAAO;AACL,WAAK,gBAAgB,SAAS;AAC9B,WAAK,WAAW;AAEhB,UAAI,MAAqB;AACvB,eAAO,MAAM;AAAA,UACX;AAAA,UACA,IAAI,KAAK,SAAS;AAAA,UAClB;AAAA,UACA;AAAA,YACE,QAAQ,CAAC,GAAG,2BAA2B;AAAA,UACzC;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,SAAK,cAAc,WAAW,QAAQ;AAAA,EACxC;AAAA,EAEA,IAAW,UAA8B;AACvC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAQU,eAAe,SAA0B;AACjD,WAAQ,4BAAkD,SAAS,OAAO;AAAA,EAC5E;AAAA,EAIU,cAAoB;AAC5B,UAAM,eAAe,KAAK;AAAA,MACxB,IAAI,YAAY,SAAS;AAAA,QACvB,UAAU;AAAA,QACV,SAAS;AAAA,QACT,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AACA,QAAI,cAAc;AAChB,WAAK,MAAM;AAAA,IACb;AAAA,EACF;AAAA,EAEO,QAAc;AACnB,SAAK,OAAO;AAAA,EACd;AAAA,EAEU,cAAc,OAA4B;AAClD,QAAI,MAAM,SAAS,YAAY,KAAK,aAAa;AAC/C,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AAAA,EAEmB,QAAQ,SAA+B;AACxD,UAAM,QAAQ,OAAO;AAErB,QAAI,QAAQ,IAAI,MAAM,GAAG;AACvB,UAAI,KAAK,MAAM;AACb,aAAK,iBAAiB,WAAW,KAAK,aAAa;AAAA,MACrD,OAAO;AACL,aAAK,oBAAoB,WAAW,KAAK,aAAa;AAAA,MACxD;AAAA,IACF;AAAA,EACF;AACF;AA1FS;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAZtB,gBAab;AAMA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAlBtB,gBAmBb;AAOI;AAAA,EADV,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAzBN,gBA0BT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var s=(a,i,e,r)=>{for(var t=r>1?void 0:r?d(i,e):i,n=a.length-1,o;n>=0;n--)(o=a[n])&&(t=(r?o(i,e,t):o(t))||t);return r&&t&&p(i,e,t),t};import{SpectrumElement as u}from"@spectrum-web-components/base";import{property as l}from"@spectrum-web-components/base/src/decorators.js";import{ALERT_BANNER_VALID_VARIANTS as c}from"./AlertBanner.types.js";export class AlertBannerBase extends u{constructor(){super(...arguments);this.open=!1;this.dismissible=!1;this._variant=""}static get styles(){return[]}set variant(e){if(e===this.variant)return;const r=this.variant;this.isValidVariant(e)?(this.setAttribute("variant",e),this._variant=e):(this.removeAttribute("variant"),this._variant=""),this.requestUpdate("variant",r)}get variant(){return this._variant}isValidVariant(e){return c.includes(e)}shouldClose(){this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0,cancelable:!0}))&&this.close()}close(){this.open=!1}handleKeydown(e){e.code==="Escape"&&this.dismissible&&this.shouldClose()}updated(e){super.updated(e),e.has("open")&&(this.open?this.addEventListener("keydown",this.handleKeydown):this.removeEventListener("keydown",this.handleKeydown))}}s([l({type:Boolean,reflect:!0})],AlertBannerBase.prototype,"open",2),s([l({type:Boolean,reflect:!0})],AlertBannerBase.prototype,"dismissible",2),s([l({type:String})],AlertBannerBase.prototype,"variant",1);
|
|
2
|
+
//# sourceMappingURL=AlertBanner.base.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["AlertBanner.base.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport {\n ALERT_BANNER_VALID_VARIANTS,\n type AlertBannerVariant,\n} from './AlertBanner.types.js';\n\n/**\n * An alert banner shows pressing and high-signal messages, such as system alerts.\n * It is meant to be noticed and prompt users to take action.\n *\n * @slot - The main content of the alert banner.\n * @slot action - An optional action button for the alert banner.\n *\n * @fires close - Dispatched when the alert banner is dismissed. Cancelable.\n */\nexport abstract class AlertBannerBase extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [];\n }\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // SHARED API\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Controls the display of the alert banner.\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * Whether to include an icon-only close button to dismiss the alert banner.\n */\n @property({ type: Boolean, reflect: true })\n public dismissible = false;\n\n /**\n * The variant applies specific styling when set to `negative` or `info`;\n * `variant` attribute is removed when it's passed an invalid variant.\n */\n @property({ type: String })\n public set variant(variant: AlertBannerVariant) {\n if (variant === this.variant) {\n return;\n }\n const oldValue = this.variant;\n\n if (this.isValidVariant(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n } else {\n this.removeAttribute('variant');\n this._variant = '';\n\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expects the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/alert-banner/#variants',\n {\n issues: [...ALERT_BANNER_VALID_VARIANTS],\n }\n );\n }\n }\n this.requestUpdate('variant', oldValue);\n }\n\n public get variant(): AlertBannerVariant {\n return this._variant;\n }\n\n private _variant: AlertBannerVariant = '';\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // IMPLEMENTATION\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n protected isValidVariant(variant: string): boolean {\n return (ALERT_BANNER_VALID_VARIANTS as readonly string[]).includes(variant);\n }\n\n protected abstract renderIcon(variant: string): TemplateResult;\n\n protected shouldClose(): void {\n const applyDefault = this.dispatchEvent(\n new CustomEvent('close', {\n composed: true,\n bubbles: true,\n cancelable: true,\n })\n );\n if (applyDefault) {\n this.close();\n }\n }\n\n public close(): void {\n this.open = false;\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n if (event.code === 'Escape' && this.dismissible) {\n this.shouldClose();\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n\n if (changes.has('open')) {\n if (this.open) {\n this.addEventListener('keydown', this.handleKeydown);\n } else {\n this.removeEventListener('keydown', this.handleKeydown);\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAWA,OAGE,mBAAAA,MAEK,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OACE,+BAAAC,MAEK,yBAWA,aAAe,wBAAwBF,CAAgB,CAAvD,kCAaL,KAAO,KAAO,GAMd,KAAO,YAAc,GAsCrB,KAAQ,SAA+B,GAxDvC,WAA2B,QAAyB,CAClD,MAAO,CAAC,CACV,CAuBA,IAAW,QAAQG,EAA6B,CAC9C,GAAIA,IAAY,KAAK,QACnB,OAEF,MAAMC,EAAW,KAAK,QAElB,KAAK,eAAeD,CAAO,GAC7B,KAAK,aAAa,UAAWA,CAAO,EACpC,KAAK,SAAWA,IAEhB,KAAK,gBAAgB,SAAS,EAC9B,KAAK,SAAW,IAalB,KAAK,cAAc,UAAWC,CAAQ,CACxC,CAEA,IAAW,SAA8B,CACvC,OAAO,KAAK,QACd,CAQU,eAAeD,EAA0B,CACjD,OAAQD,EAAkD,SAASC,CAAO,CAC5E,CAIU,aAAoB,CACP,KAAK,cACxB,IAAI,YAAY,QAAS,CACvB,SAAU,GACV,QAAS,GACT,WAAY,EACd,CAAC,CACH,GAEE,KAAK,MAAM,CAEf,CAEO,OAAc,CACnB,KAAK,KAAO,EACd,CAEU,cAAcE,EAA4B,CAC9CA,EAAM,OAAS,UAAY,KAAK,aAClC,KAAK,YAAY,CAErB,CAEmB,QAAQC,EAA+B,CACxD,MAAM,QAAQA,CAAO,EAEjBA,EAAQ,IAAI,MAAM,IAChB,KAAK,KACP,KAAK,iBAAiB,UAAW,KAAK,aAAa,EAEnD,KAAK,oBAAoB,UAAW,KAAK,aAAa,EAG5D,CACF,CA1FSC,EAAA,CADNN,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAZtB,gBAab,oBAMAM,EAAA,CADNN,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAlBtB,gBAmBb,2BAOIM,EAAA,CADVN,EAAS,CAAE,KAAM,MAAO,CAAC,GAzBN,gBA0BT",
|
|
6
|
+
"names": ["SpectrumElement", "property", "ALERT_BANNER_VALID_VARIANTS", "variant", "oldValue", "event", "changes", "__decorateClass"]
|
|
7
|
+
}
|
package/src/AlertBanner.d.ts
CHANGED
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { CSSResultArray, TemplateResult } from '@spectrum-web-components/base';
|
|
13
|
-
import { AlertBannerBase, AlertBannerVariants } from '@spectrum-web-components/core/components/alert-banner';
|
|
14
13
|
import '@spectrum-web-components/button/sp-close-button.js';
|
|
15
14
|
import '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';
|
|
16
15
|
import '@spectrum-web-components/icons-workflow/icons/sp-icon-info.js';
|
|
16
|
+
import { AlertBannerBase } from './AlertBanner.base.js';
|
|
17
|
+
import type { AlertBannerVariants } from './AlertBanner.types.js';
|
|
17
18
|
export type { AlertBannerVariants };
|
|
18
19
|
/**
|
|
19
20
|
* @element sp-alert-banner
|
package/src/AlertBanner.dev.js
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
html
|
|
4
4
|
} from "@spectrum-web-components/base";
|
|
5
|
-
import {
|
|
6
|
-
AlertBannerBase
|
|
7
|
-
} from "@spectrum-web-components/core/components/alert-banner";
|
|
8
5
|
import "@spectrum-web-components/button/sp-close-button.js";
|
|
9
6
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";
|
|
10
7
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-info.js";
|
|
11
8
|
import styles from "./alert-banner.css.js";
|
|
9
|
+
import { AlertBannerBase } from "./AlertBanner.base.dev.js";
|
|
12
10
|
export class AlertBanner extends AlertBannerBase {
|
|
13
11
|
static get styles() {
|
|
14
12
|
return [styles];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["AlertBanner.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\
|
|
5
|
-
"mappings": ";AAWA;AAAA,EAEE;AAAA,OAEK;
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-info.js';\n\nimport styles from './alert-banner.css.js';\nimport { AlertBannerBase } from './AlertBanner.base.dev.js'\nimport type { AlertBannerVariants } from './AlertBanner.types.dev.js'\n\nexport type { AlertBannerVariants };\n\n/**\n * @element sp-alert-banner\n *\n * @slot - The alert banner text context\n * @slot action - Slot for the button element that surfaces the contextual action a user can take\n *\n * @fires close - Announces the alert banner has been closed\n */\nexport class AlertBanner extends AlertBannerBase {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n protected override renderIcon(variant: string): TemplateResult {\n switch (variant) {\n case 'info':\n return html`\n <sp-icon-info label=\"Information\" class=\"type\"></sp-icon-info>\n `;\n case 'negative':\n return html`\n <sp-icon-alert label=\"Error\" class=\"type\"></sp-icon-alert>\n `;\n default:\n return html``;\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"body\" role=\"alert\">\n <div class=\"content\">\n ${this.renderIcon(this.variant)}\n <div class=\"text\"><slot></slot></div>\n </div>\n <slot name=\"action\"></slot>\n </div>\n <div class=\"end\">\n ${this.dismissible\n ? html`\n <sp-close-button\n @click=${this.shouldClose}\n label=\"Close\"\n static-color=\"white\"\n ></sp-close-button>\n `\n : html``}\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA;AAAA,EAEE;AAAA,OAEK;AAEP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,OAAO,YAAY;AACnB,SAAS,uBAAuB;AAazB,aAAM,oBAAoB,gBAAgB;AAAA,EAC/C,WAA2B,SAAyB;AAClD,WAAO,CAAC,MAAM;AAAA,EAChB;AAAA,EAEmB,WAAW,SAAiC;AAC7D,YAAQ,SAAS;AAAA,MACf,KAAK;AACH,eAAO;AAAA;AAAA;AAAA,MAGT,KAAK;AACH,eAAO;AAAA;AAAA;AAAA,MAGT;AACE,eAAO;AAAA,IACX;AAAA,EACF;AAAA,EAEmB,SAAyB;AAC1C,WAAO;AAAA;AAAA;AAAA,YAGC,KAAK,WAAW,KAAK,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAM/B,KAAK,cACH;AAAA;AAAA,yBAEa,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA,gBAK7B,MAAM;AAAA;AAAA;AAAA,EAGhB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/AlertBanner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";import{html as e}from"@spectrum-web-components/base";import
|
|
1
|
+
"use strict";import{html as e}from"@spectrum-web-components/base";import"@spectrum-web-components/button/sp-close-button.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js";import"@spectrum-web-components/icons-workflow/icons/sp-icon-info.js";import r from"./alert-banner.css.js";import{AlertBannerBase as s}from"./AlertBanner.base.js";export class AlertBanner extends s{static get styles(){return[r]}renderIcon(t){switch(t){case"info":return e`
|
|
2
2
|
<sp-icon-info label="Information" class="type"></sp-icon-info>
|
|
3
3
|
`;case"negative":return e`
|
|
4
4
|
<sp-icon-alert label="Error" class="type"></sp-icon-alert>
|
package/src/AlertBanner.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["AlertBanner.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\
|
|
5
|
-
"mappings": "aAWA,OAEE,QAAAA,MAEK,
|
|
6
|
-
"names": ["html", "
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/button/sp-close-button.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-alert.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-info.js';\n\nimport styles from './alert-banner.css.js';\nimport { AlertBannerBase } from './AlertBanner.base.js';\nimport type { AlertBannerVariants } from './AlertBanner.types.js';\n\nexport type { AlertBannerVariants };\n\n/**\n * @element sp-alert-banner\n *\n * @slot - The alert banner text context\n * @slot action - Slot for the button element that surfaces the contextual action a user can take\n *\n * @fires close - Announces the alert banner has been closed\n */\nexport class AlertBanner extends AlertBannerBase {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n protected override renderIcon(variant: string): TemplateResult {\n switch (variant) {\n case 'info':\n return html`\n <sp-icon-info label=\"Information\" class=\"type\"></sp-icon-info>\n `;\n case 'negative':\n return html`\n <sp-icon-alert label=\"Error\" class=\"type\"></sp-icon-alert>\n `;\n default:\n return html``;\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <div class=\"body\" role=\"alert\">\n <div class=\"content\">\n ${this.renderIcon(this.variant)}\n <div class=\"text\"><slot></slot></div>\n </div>\n <slot name=\"action\"></slot>\n </div>\n <div class=\"end\">\n ${this.dismissible\n ? html`\n <sp-close-button\n @click=${this.shouldClose}\n label=\"Close\"\n static-color=\"white\"\n ></sp-close-button>\n `\n : html``}\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAEE,QAAAA,MAEK,gCAEP,MAAO,qDACP,MAAO,iEACP,MAAO,gEAEP,OAAOC,MAAY,wBACnB,OAAS,mBAAAC,MAAuB,wBAazB,aAAM,oBAAoBA,CAAgB,CAC/C,WAA2B,QAAyB,CAClD,MAAO,CAACD,CAAM,CAChB,CAEmB,WAAWE,EAAiC,CAC7D,OAAQA,EAAS,CACf,IAAK,OACH,OAAOH;AAAA;AAAA,UAGT,IAAK,WACH,OAAOA;AAAA;AAAA,UAGT,QACE,OAAOA,GACX,CACF,CAEmB,QAAyB,CAC1C,OAAOA;AAAA;AAAA;AAAA,YAGC,KAAK,WAAW,KAAK,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAM/B,KAAK,YACHA;AAAA;AAAA,yBAEa,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA,cAK7BA,GAAM;AAAA;AAAA,KAGhB,CACF",
|
|
6
|
+
"names": ["html", "styles", "AlertBannerBase", "variant"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ALERT_BANNER_VALID_VARIANTS: readonly ["neutral", "info", "negative"];
|
|
13
|
+
export type AlertBannerVariant = (typeof ALERT_BANNER_VALID_VARIANTS)[number] | '';
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `AlertBannerVariant` instead.
|
|
16
|
+
* Kept as `string` for backward compatibility with 1st-gen.
|
|
17
|
+
*/
|
|
18
|
+
export type AlertBannerVariants = string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["AlertBanner.types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport const ALERT_BANNER_VALID_VARIANTS = [\n 'neutral',\n 'info',\n 'negative',\n] as const satisfies readonly string[];\n\nexport type AlertBannerVariant =\n | (typeof ALERT_BANNER_VALID_VARIANTS)[number]\n | '';\n\n/**\n * @deprecated Use `AlertBannerVariant` instead.\n * Kept as `string` for backward compatibility with 1st-gen.\n */\nexport type AlertBannerVariants = string;\n"],
|
|
5
|
+
"mappings": ";AAYO,aAAM,8BAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["AlertBanner.types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport const ALERT_BANNER_VALID_VARIANTS = [\n 'neutral',\n 'info',\n 'negative',\n] as const satisfies readonly string[];\n\nexport type AlertBannerVariant =\n | (typeof ALERT_BANNER_VALID_VARIANTS)[number]\n | '';\n\n/**\n * @deprecated Use `AlertBannerVariant` instead.\n * Kept as `string` for backward compatibility with 1st-gen.\n */\nexport type AlertBannerVariants = string;\n"],
|
|
5
|
+
"mappings": "aAYO,aAAM,4BAA8B,CACzC,UACA,OACA,UACF",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|